@medplum/agent 3.2.24 → 3.2.26

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 +664 -655
  2. package/package.json +5 -5
@@ -483,8 +483,8 @@ var require_utf32 = __commonJS({
483
483
  outer_loop:
484
484
  for (var i = 0; i < bufs.length; i++) {
485
485
  var buf = bufs[i];
486
- for (var j2 = 0; j2 < buf.length; j2++) {
487
- b2.push(buf[j2]);
486
+ for (var j = 0; j < buf.length; j++) {
487
+ b2.push(buf[j]);
488
488
  if (b2.length === 4) {
489
489
  if (charsProcessed === 0) {
490
490
  if (b2[0] === 255 && b2[1] === 254 && b2[2] === 0 && b2[3] === 0) {
@@ -543,19 +543,19 @@ var require_utf16 = __commonJS({
543
543
  Utf16BEDecoder.prototype.write = function(buf) {
544
544
  if (buf.length == 0)
545
545
  return "";
546
- var buf2 = Buffer2.alloc(buf.length + 1), i = 0, j2 = 0;
546
+ var buf2 = Buffer2.alloc(buf.length + 1), i = 0, j = 0;
547
547
  if (this.overflowByte !== -1) {
548
548
  buf2[0] = buf[0];
549
549
  buf2[1] = this.overflowByte;
550
550
  i = 1;
551
- j2 = 2;
551
+ j = 2;
552
552
  }
553
- for (; i < buf.length - 1; i += 2, j2 += 2) {
554
- buf2[j2] = buf[i + 1];
555
- buf2[j2 + 1] = buf[i];
553
+ for (; i < buf.length - 1; i += 2, j += 2) {
554
+ buf2[j] = buf[i + 1];
555
+ buf2[j + 1] = buf[i];
556
556
  }
557
557
  this.overflowByte = i == buf.length - 1 ? buf[buf.length - 1] : -1;
558
- return buf2.slice(0, j2).toString("ucs2");
558
+ return buf2.slice(0, j).toString("ucs2");
559
559
  };
560
560
  Utf16BEDecoder.prototype.end = function() {
561
561
  this.overflowByte = -1;
@@ -623,8 +623,8 @@ var require_utf16 = __commonJS({
623
623
  outer_loop:
624
624
  for (var i = 0; i < bufs.length; i++) {
625
625
  var buf = bufs[i];
626
- for (var j2 = 0; j2 < buf.length; j2++) {
627
- b2.push(buf[j2]);
626
+ for (var j = 0; j < buf.length; j++) {
627
+ b2.push(buf[j]);
628
628
  if (b2.length === 2) {
629
629
  if (charsProcessed === 0) {
630
630
  if (b2[0] === 255 && b2[1] === 254) return "utf-16le";
@@ -1548,13 +1548,13 @@ var require_dbcs_codec = __commonJS({
1548
1548
  var firstByteNode = this.decodeTables[0];
1549
1549
  for (var i2 = 129; i2 <= 254; i2++) {
1550
1550
  var secondByteNode = this.decodeTables[NODE_START - firstByteNode[i2]];
1551
- for (var j2 = 48; j2 <= 57; j2++) {
1552
- if (secondByteNode[j2] === UNASSIGNED) {
1553
- secondByteNode[j2] = NODE_START - commonThirdByteNodeIdx;
1554
- } else if (secondByteNode[j2] > NODE_START) {
1551
+ for (var j = 48; j <= 57; j++) {
1552
+ if (secondByteNode[j] === UNASSIGNED) {
1553
+ secondByteNode[j] = NODE_START - commonThirdByteNodeIdx;
1554
+ } else if (secondByteNode[j] > NODE_START) {
1555
1555
  throw new Error("gb18030 decode tables conflict at byte 2");
1556
1556
  }
1557
- var thirdByteNode = this.decodeTables[NODE_START - secondByteNode[j2]];
1557
+ var thirdByteNode = this.decodeTables[NODE_START - secondByteNode[j]];
1558
1558
  for (var k2 = 129; k2 <= 254; k2++) {
1559
1559
  if (thirdByteNode[k2] === UNASSIGNED) {
1560
1560
  thirdByteNode[k2] = NODE_START - commonFourthByteNodeIdx;
@@ -1582,8 +1582,8 @@ var require_dbcs_codec = __commonJS({
1582
1582
  if (typeof val === "number")
1583
1583
  skipEncodeChars[val] = true;
1584
1584
  else
1585
- for (var j2 = val.from; j2 <= val.to; j2++)
1586
- skipEncodeChars[j2] = true;
1585
+ for (var j = val.from; j <= val.to; j++)
1586
+ skipEncodeChars[j] = true;
1587
1587
  }
1588
1588
  this._fillEncodeTable(0, 0, skipEncodeChars);
1589
1589
  if (codecOptions.encodeAdd) {
@@ -1678,7 +1678,7 @@ var require_dbcs_codec = __commonJS({
1678
1678
  bucket[low] = SEQ_START - this.encodeTableSeq.length;
1679
1679
  this.encodeTableSeq.push(node);
1680
1680
  }
1681
- for (var j2 = 1; j2 < seq.length - 1; j2++) {
1681
+ for (var j = 1; j < seq.length - 1; j++) {
1682
1682
  var oldVal = node[uCode];
1683
1683
  if (typeof oldVal === "object")
1684
1684
  node = oldVal;
@@ -1728,7 +1728,7 @@ var require_dbcs_codec = __commonJS({
1728
1728
  this.gb18030 = codec.gb18030;
1729
1729
  }
1730
1730
  DBCSEncoder.prototype.write = function(str) {
1731
- var newBuf = Buffer2.alloc(str.length * (this.gb18030 ? 4 : 3)), leadSurrogate = this.leadSurrogate, seqObj = this.seqObj, nextChar = -1, i2 = 0, j2 = 0;
1731
+ var newBuf = Buffer2.alloc(str.length * (this.gb18030 ? 4 : 3)), leadSurrogate = this.leadSurrogate, seqObj = this.seqObj, nextChar = -1, i2 = 0, j = 0;
1732
1732
  while (true) {
1733
1733
  if (nextChar === -1) {
1734
1734
  if (i2 == str.length) break;
@@ -1788,13 +1788,13 @@ var require_dbcs_codec = __commonJS({
1788
1788
  var idx = findIdx(this.gb18030.uChars, uCode);
1789
1789
  if (idx != -1) {
1790
1790
  var dbcsCode = this.gb18030.gbChars[idx] + (uCode - this.gb18030.uChars[idx]);
1791
- newBuf[j2++] = 129 + Math.floor(dbcsCode / 12600);
1791
+ newBuf[j++] = 129 + Math.floor(dbcsCode / 12600);
1792
1792
  dbcsCode = dbcsCode % 12600;
1793
- newBuf[j2++] = 48 + Math.floor(dbcsCode / 1260);
1793
+ newBuf[j++] = 48 + Math.floor(dbcsCode / 1260);
1794
1794
  dbcsCode = dbcsCode % 1260;
1795
- newBuf[j2++] = 129 + Math.floor(dbcsCode / 10);
1795
+ newBuf[j++] = 129 + Math.floor(dbcsCode / 10);
1796
1796
  dbcsCode = dbcsCode % 10;
1797
- newBuf[j2++] = 48 + dbcsCode;
1797
+ newBuf[j++] = 48 + dbcsCode;
1798
1798
  continue;
1799
1799
  }
1800
1800
  }
@@ -1802,47 +1802,47 @@ var require_dbcs_codec = __commonJS({
1802
1802
  if (dbcsCode === UNASSIGNED)
1803
1803
  dbcsCode = this.defaultCharSingleByte;
1804
1804
  if (dbcsCode < 256) {
1805
- newBuf[j2++] = dbcsCode;
1805
+ newBuf[j++] = dbcsCode;
1806
1806
  } else if (dbcsCode < 65536) {
1807
- newBuf[j2++] = dbcsCode >> 8;
1808
- newBuf[j2++] = dbcsCode & 255;
1807
+ newBuf[j++] = dbcsCode >> 8;
1808
+ newBuf[j++] = dbcsCode & 255;
1809
1809
  } else if (dbcsCode < 16777216) {
1810
- newBuf[j2++] = dbcsCode >> 16;
1811
- newBuf[j2++] = dbcsCode >> 8 & 255;
1812
- newBuf[j2++] = dbcsCode & 255;
1810
+ newBuf[j++] = dbcsCode >> 16;
1811
+ newBuf[j++] = dbcsCode >> 8 & 255;
1812
+ newBuf[j++] = dbcsCode & 255;
1813
1813
  } else {
1814
- newBuf[j2++] = dbcsCode >>> 24;
1815
- newBuf[j2++] = dbcsCode >>> 16 & 255;
1816
- newBuf[j2++] = dbcsCode >>> 8 & 255;
1817
- newBuf[j2++] = dbcsCode & 255;
1814
+ newBuf[j++] = dbcsCode >>> 24;
1815
+ newBuf[j++] = dbcsCode >>> 16 & 255;
1816
+ newBuf[j++] = dbcsCode >>> 8 & 255;
1817
+ newBuf[j++] = dbcsCode & 255;
1818
1818
  }
1819
1819
  }
1820
1820
  this.seqObj = seqObj;
1821
1821
  this.leadSurrogate = leadSurrogate;
1822
- return newBuf.slice(0, j2);
1822
+ return newBuf.slice(0, j);
1823
1823
  };
1824
1824
  DBCSEncoder.prototype.end = function() {
1825
1825
  if (this.leadSurrogate === -1 && this.seqObj === void 0)
1826
1826
  return;
1827
- var newBuf = Buffer2.alloc(10), j2 = 0;
1827
+ var newBuf = Buffer2.alloc(10), j = 0;
1828
1828
  if (this.seqObj) {
1829
1829
  var dbcsCode = this.seqObj[DEF_CHAR];
1830
1830
  if (dbcsCode !== void 0) {
1831
1831
  if (dbcsCode < 256) {
1832
- newBuf[j2++] = dbcsCode;
1832
+ newBuf[j++] = dbcsCode;
1833
1833
  } else {
1834
- newBuf[j2++] = dbcsCode >> 8;
1835
- newBuf[j2++] = dbcsCode & 255;
1834
+ newBuf[j++] = dbcsCode >> 8;
1835
+ newBuf[j++] = dbcsCode & 255;
1836
1836
  }
1837
1837
  } else {
1838
1838
  }
1839
1839
  this.seqObj = void 0;
1840
1840
  }
1841
1841
  if (this.leadSurrogate !== -1) {
1842
- newBuf[j2++] = this.defaultCharSingleByte;
1842
+ newBuf[j++] = this.defaultCharSingleByte;
1843
1843
  this.leadSurrogate = -1;
1844
1844
  }
1845
- return newBuf.slice(0, j2);
1845
+ return newBuf.slice(0, j);
1846
1846
  };
1847
1847
  DBCSEncoder.prototype.findIdx = findIdx;
1848
1848
  function DBCSDecoder(options, codec) {
@@ -1855,7 +1855,7 @@ var require_dbcs_codec = __commonJS({
1855
1855
  }
1856
1856
  DBCSDecoder.prototype.write = function(buf) {
1857
1857
  var newBuf = Buffer2.alloc(buf.length * 2), nodeIdx = this.nodeIdx, prevBytes = this.prevBytes, prevOffset = this.prevBytes.length, seqStart = -this.prevBytes.length, uCode;
1858
- for (var i2 = 0, j2 = 0; i2 < buf.length; i2++) {
1858
+ for (var i2 = 0, j = 0; i2 < buf.length; i2++) {
1859
1859
  var curByte = i2 >= 0 ? buf[i2] : prevBytes[i2 + prevOffset];
1860
1860
  var uCode = this.decodeTables[nodeIdx][curByte];
1861
1861
  if (uCode >= 0) {
@@ -1877,8 +1877,8 @@ var require_dbcs_codec = __commonJS({
1877
1877
  var seq = this.decodeTableSeq[SEQ_START - uCode];
1878
1878
  for (var k2 = 0; k2 < seq.length - 1; k2++) {
1879
1879
  uCode = seq[k2];
1880
- newBuf[j2++] = uCode & 255;
1881
- newBuf[j2++] = uCode >> 8;
1880
+ newBuf[j++] = uCode & 255;
1881
+ newBuf[j++] = uCode >> 8;
1882
1882
  }
1883
1883
  uCode = seq[seq.length - 1];
1884
1884
  } else
@@ -1886,18 +1886,18 @@ var require_dbcs_codec = __commonJS({
1886
1886
  if (uCode >= 65536) {
1887
1887
  uCode -= 65536;
1888
1888
  var uCodeLead = 55296 | uCode >> 10;
1889
- newBuf[j2++] = uCodeLead & 255;
1890
- newBuf[j2++] = uCodeLead >> 8;
1889
+ newBuf[j++] = uCodeLead & 255;
1890
+ newBuf[j++] = uCodeLead >> 8;
1891
1891
  uCode = 56320 | uCode & 1023;
1892
1892
  }
1893
- newBuf[j2++] = uCode & 255;
1894
- newBuf[j2++] = uCode >> 8;
1893
+ newBuf[j++] = uCode & 255;
1894
+ newBuf[j++] = uCode >> 8;
1895
1895
  nodeIdx = 0;
1896
1896
  seqStart = i2 + 1;
1897
1897
  }
1898
1898
  this.nodeIdx = nodeIdx;
1899
1899
  this.prevBytes = seqStart >= 0 ? Array.prototype.slice.call(buf, seqStart) : prevBytes.slice(seqStart + prevOffset).concat(Array.prototype.slice.call(buf));
1900
- return newBuf.slice(0, j2).toString("ucs2");
1900
+ return newBuf.slice(0, j).toString("ucs2");
1901
1901
  };
1902
1902
  DBCSDecoder.prototype.end = function() {
1903
1903
  var ret = "";
@@ -7765,11 +7765,11 @@ var require_dcmjs = __commonJS({
7765
7765
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
7766
7766
  if (_i == null) return;
7767
7767
  var _arr = [];
7768
- var _n = true;
7768
+ var _n2 = true;
7769
7769
  var _d = false;
7770
7770
  var _s, _e;
7771
7771
  try {
7772
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
7772
+ for (_i = _i.call(arr); !(_n2 = (_s = _i.next()).done); _n2 = true) {
7773
7773
  _arr.push(_s.value);
7774
7774
  if (i && _arr.length === i) break;
7775
7775
  }
@@ -7778,7 +7778,7 @@ var require_dcmjs = __commonJS({
7778
7778
  _e = err2;
7779
7779
  } finally {
7780
7780
  try {
7781
- if (!_n && _i["return"] != null) _i["return"]();
7781
+ if (!_n2 && _i["return"] != null) _i["return"]();
7782
7782
  } finally {
7783
7783
  if (_d) throw _e;
7784
7784
  }
@@ -7805,10 +7805,10 @@ var require_dcmjs = __commonJS({
7805
7805
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
7806
7806
  }
7807
7807
  function _createForOfIteratorHelper(o, allowArrayLike) {
7808
- var it2 = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
7809
- if (!it2) {
7810
- if (Array.isArray(o) || (it2 = _unsupportedIterableToArray(o)) || allowArrayLike) {
7811
- if (it2) o = it2;
7808
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
7809
+ if (!it) {
7810
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike) {
7811
+ if (it) o = it;
7812
7812
  var i = 0;
7813
7813
  var F2 = function() {
7814
7814
  };
@@ -7834,10 +7834,10 @@ var require_dcmjs = __commonJS({
7834
7834
  var normalCompletion = true, didErr = false, err2;
7835
7835
  return {
7836
7836
  s: function() {
7837
- it2 = it2.call(o);
7837
+ it = it.call(o);
7838
7838
  },
7839
7839
  n: function() {
7840
- var step = it2.next();
7840
+ var step = it.next();
7841
7841
  normalCompletion = step.done;
7842
7842
  return step;
7843
7843
  },
@@ -7847,7 +7847,7 @@ var require_dcmjs = __commonJS({
7847
7847
  },
7848
7848
  f: function() {
7849
7849
  try {
7850
- if (!normalCompletion && it2.return != null) it2.return();
7850
+ if (!normalCompletion && it.return != null) it.return();
7851
7851
  } finally {
7852
7852
  if (didErr) throw err2;
7853
7853
  }
@@ -7927,9 +7927,9 @@ var require_dcmjs = __commonJS({
7927
7927
  const d_code = (dist2) => {
7928
7928
  return dist2 < 256 ? _dist_code[dist2] : _dist_code[256 + (dist2 >>> 7)];
7929
7929
  };
7930
- const put_short = (s, w3) => {
7931
- s.pending_buf[s.pending++] = w3 & 255;
7932
- s.pending_buf[s.pending++] = w3 >>> 8 & 255;
7930
+ const put_short = (s, w2) => {
7931
+ s.pending_buf[s.pending++] = w2 & 255;
7932
+ s.pending_buf[s.pending++] = w2 >>> 8 & 255;
7933
7933
  };
7934
7934
  const send_bits = (s, value, length2) => {
7935
7935
  if (s.bi_valid > Buf_size - length2) {
@@ -8156,17 +8156,17 @@ var require_dcmjs = __commonJS({
8156
8156
  };
8157
8157
  const pqdownheap = (s, tree, k2) => {
8158
8158
  const v2 = s.heap[k2];
8159
- let j2 = k2 << 1;
8160
- while (j2 <= s.heap_len) {
8161
- if (j2 < s.heap_len && smaller(tree, s.heap[j2 + 1], s.heap[j2], s.depth)) {
8162
- j2++;
8159
+ let j = k2 << 1;
8160
+ while (j <= s.heap_len) {
8161
+ if (j < s.heap_len && smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {
8162
+ j++;
8163
8163
  }
8164
- if (smaller(tree, v2, s.heap[j2], s.depth)) {
8164
+ if (smaller(tree, v2, s.heap[j], s.depth)) {
8165
8165
  break;
8166
8166
  }
8167
- s.heap[k2] = s.heap[j2];
8168
- k2 = j2;
8169
- j2 <<= 1;
8167
+ s.heap[k2] = s.heap[j];
8168
+ k2 = j;
8169
+ j <<= 1;
8170
8170
  }
8171
8171
  s.heap[k2] = v2;
8172
8172
  };
@@ -13156,8 +13156,8 @@ var require_dcmjs = __commonJS({
13156
13156
  if (fragmentMultiframe) {
13157
13157
  fragmentsLength = Math.ceil(frameStream.size / fragmentSize);
13158
13158
  }
13159
- for (var j2 = 0, fragmentStart = 0; j2 < fragmentsLength; j2++) {
13160
- var isFinalFragment = j2 === fragmentsLength - 1;
13159
+ for (var j = 0, fragmentStart = 0; j < fragmentsLength; j++) {
13160
+ var isFinalFragment = j === fragmentsLength - 1;
13161
13161
  var fragmentEnd = fragmentStart + frameStream.size;
13162
13162
  if (fragmentMultiframe) {
13163
13163
  fragmentEnd = fragmentStart + fragmentSize;
@@ -13522,17 +13522,17 @@ var require_dcmjs = __commonJS({
13522
13522
  key: "readBytes",
13523
13523
  value: function readBytes(stream, length2) {
13524
13524
  var BACKSLASH = String.fromCharCode(VM_DELIMITER);
13525
- var is2 = stream.readAsciiString(length2).trim();
13526
- is2 = is2.replace(/[^0-9.\\\-+e]/gi, "");
13527
- if (is2.indexOf(BACKSLASH) !== -1) {
13528
- var integerStringArray = is2.split(BACKSLASH);
13529
- is2 = integerStringArray.map(function(is3) {
13530
- return is3 === "" ? null : Number(is3);
13525
+ var is = stream.readAsciiString(length2).trim();
13526
+ is = is.replace(/[^0-9.\\\-+e]/gi, "");
13527
+ if (is.indexOf(BACKSLASH) !== -1) {
13528
+ var integerStringArray = is.split(BACKSLASH);
13529
+ is = integerStringArray.map(function(is2) {
13530
+ return is2 === "" ? null : Number(is2);
13531
13531
  });
13532
13532
  } else {
13533
- is2 = [is2 === "" ? null : Number(is2)];
13533
+ is = [is === "" ? null : Number(is)];
13534
13534
  }
13535
- return is2;
13535
+ return is;
13536
13536
  }
13537
13537
  }, {
13538
13538
  key: "formatValue",
@@ -13543,8 +13543,8 @@ var require_dcmjs = __commonJS({
13543
13543
  key: "writeBytes",
13544
13544
  value: function writeBytes(stream, value, writeOptions) {
13545
13545
  var _this12 = this;
13546
- var val = Array.isArray(value) ? value.map(function(is2) {
13547
- return _this12.formatValue(is2);
13546
+ var val = Array.isArray(value) ? value.map(function(is) {
13547
+ return _this12.formatValue(is);
13548
13548
  }) : [this.formatValue(value)];
13549
13549
  return _get(_getPrototypeOf(IntegerString2.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
13550
13550
  }
@@ -14260,7 +14260,7 @@ var require_dcmjs = __commonJS({
14260
14260
  }
14261
14261
  }, {
14262
14262
  key: "is",
14263
- value: function is2(t) {
14263
+ value: function is(t) {
14264
14264
  return this.value == t;
14265
14265
  }
14266
14266
  }, {
@@ -17727,8 +17727,8 @@ var require_dcmjs = __commonJS({
17727
17727
  var _matrix$shape = _slicedToArray(matrix.shape, 2), rows = _matrix$shape[0], cols = _matrix$shape[1];
17728
17728
  var result = ndarray$1(new Uint8Array(rows * cols), [rows, cols]);
17729
17729
  for (var i = 0; i < rows; i++) {
17730
- for (var j2 = 0; j2 < cols; j2++) {
17731
- result.set(i, j2, matrix.get(i, cols - 1 - j2));
17730
+ for (var j = 0; j < cols; j++) {
17731
+ result.set(i, j, matrix.get(i, cols - 1 - j));
17732
17732
  }
17733
17733
  }
17734
17734
  return result;
@@ -17736,9 +17736,9 @@ var require_dcmjs = __commonJS({
17736
17736
  function v(matrix) {
17737
17737
  var _matrix$shape2 = _slicedToArray(matrix.shape, 2), rows = _matrix$shape2[0], cols = _matrix$shape2[1];
17738
17738
  var result = ndarray$1(new Uint8Array(rows * cols), [rows, cols]);
17739
- for (var j2 = 0; j2 < cols; j2++) {
17739
+ for (var j = 0; j < cols; j++) {
17740
17740
  for (var i = 0; i < rows; i++) {
17741
- result.set(i, j2, matrix.get(rows - 1 - i, j2));
17741
+ result.set(i, j, matrix.get(rows - 1 - i, j));
17742
17742
  }
17743
17743
  }
17744
17744
  return result;
@@ -17748,8 +17748,8 @@ var require_dcmjs = __commonJS({
17748
17748
  var result = ndarray$1(new Uint8Array(rows * cols), [cols, rows]);
17749
17749
  var resultColsMinus1 = result.shape[1] - 1;
17750
17750
  for (var i = 0; i < rows; i++) {
17751
- for (var j2 = 0; j2 < cols; j2++) {
17752
- result.set(j2, resultColsMinus1 - i, matrix.get(i, j2));
17751
+ for (var j = 0; j < cols; j++) {
17752
+ result.set(j, resultColsMinus1 - i, matrix.get(i, j));
17753
17753
  }
17754
17754
  }
17755
17755
  return result;
@@ -18271,11 +18271,11 @@ var require_dcmjs = __commonJS({
18271
18271
  }
18272
18272
  function transformMat4(out, a2, m2) {
18273
18273
  var x2 = a2[0], y2 = a2[1], z2 = a2[2];
18274
- var w3 = m2[3] * x2 + m2[7] * y2 + m2[11] * z2 + m2[15];
18275
- w3 = w3 || 1;
18276
- out[0] = (m2[0] * x2 + m2[4] * y2 + m2[8] * z2 + m2[12]) / w3;
18277
- out[1] = (m2[1] * x2 + m2[5] * y2 + m2[9] * z2 + m2[13]) / w3;
18278
- out[2] = (m2[2] * x2 + m2[6] * y2 + m2[10] * z2 + m2[14]) / w3;
18274
+ var w2 = m2[3] * x2 + m2[7] * y2 + m2[11] * z2 + m2[15];
18275
+ w2 = w2 || 1;
18276
+ out[0] = (m2[0] * x2 + m2[4] * y2 + m2[8] * z2 + m2[12]) / w2;
18277
+ out[1] = (m2[1] * x2 + m2[5] * y2 + m2[9] * z2 + m2[13]) / w2;
18278
+ out[2] = (m2[2] * x2 + m2[6] * y2 + m2[10] * z2 + m2[14]) / w2;
18279
18279
  return out;
18280
18280
  }
18281
18281
  function transformMat3(out, a2, m2) {
@@ -18290,10 +18290,10 @@ var require_dcmjs = __commonJS({
18290
18290
  var x2 = a2[0], y2 = a2[1], z2 = a2[2];
18291
18291
  var uvx = qy * z2 - qz * y2, uvy = qz * x2 - qx * z2, uvz = qx * y2 - qy * x2;
18292
18292
  var uuvx = qy * uvz - qz * uvy, uuvy = qz * uvx - qx * uvz, uuvz = qx * uvy - qy * uvx;
18293
- var w22 = qw * 2;
18294
- uvx *= w22;
18295
- uvy *= w22;
18296
- uvz *= w22;
18293
+ var w2 = qw * 2;
18294
+ uvx *= w2;
18295
+ uvy *= w2;
18296
+ uvz *= w2;
18297
18297
  uuvx *= 2;
18298
18298
  uuvy *= 2;
18299
18299
  uuvz *= 2;
@@ -19459,10 +19459,10 @@ var require_dcmjs = __commonJS({
19459
19459
  continue;
19460
19460
  }
19461
19461
  var data3 = alignedPixelDataI.data;
19462
- for (var j2 = 0, len2 = data3.length; j2 < len2; ++j2) {
19463
- if (data3[j2] !== 0) {
19464
- temp2DArray[j2]++;
19465
- if (temp2DArray[j2] > 1) {
19462
+ for (var j = 0, len2 = data3.length; j < len2; ++j) {
19463
+ if (data3[j] !== 0) {
19464
+ temp2DArray[j]++;
19465
+ if (temp2DArray[j] > 1) {
19466
19466
  return true;
19467
19467
  }
19468
19468
  }
@@ -19526,9 +19526,9 @@ var require_dcmjs = __commonJS({
19526
19526
  var labelmap2DView = new Uint16Array(tempBuffer, byteOffset, sliceLength);
19527
19527
  var data3 = alignedPixelDataI.data;
19528
19528
  var segmentOnFrame = false;
19529
- for (var j2 = 0, len2 = alignedPixelDataI.data.length; j2 < len2; ++j2) {
19530
- if (data3[j2]) {
19531
- if (labelmap2DView[j2] !== 0) {
19529
+ for (var j = 0, len2 = alignedPixelDataI.data.length; j < len2; ++j) {
19530
+ if (data3[j]) {
19531
+ if (labelmap2DView[j] !== 0) {
19532
19532
  m2++;
19533
19533
  if (m2 >= M3) {
19534
19534
  labelmapBufferArray[m2] = new ArrayBuffer(arrayBufferLength);
@@ -19540,7 +19540,7 @@ var require_dcmjs = __commonJS({
19540
19540
  _i2 = 0;
19541
19541
  break;
19542
19542
  } else {
19543
- labelmap2DView[j2] = segmentIndex;
19543
+ labelmap2DView[j] = segmentIndex;
19544
19544
  segmentOnFrame = true;
19545
19545
  }
19546
19546
  }
@@ -19610,9 +19610,9 @@ var require_dcmjs = __commonJS({
19610
19610
  var byteOffset = sliceLength * 2 * imageIdIndex;
19611
19611
  var labelmap2DView = new Uint16Array(labelmapBufferArray[0], byteOffset, sliceLength);
19612
19612
  var data3 = alignedPixelDataI.data;
19613
- for (var j2 = 0, len2 = alignedPixelDataI.data.length; j2 < len2; ++j2) {
19614
- if (data3[j2]) {
19615
- for (var x2 = j2; x2 < len2; ++x2) {
19613
+ for (var j = 0, len2 = alignedPixelDataI.data.length; j < len2; ++j) {
19614
+ if (data3[j]) {
19615
+ for (var x2 = j; x2 < len2; ++x2) {
19616
19616
  if (data3[x2]) {
19617
19617
  labelmap2DView[x2] = segmentIndex;
19618
19618
  }
@@ -21237,8 +21237,8 @@ var require_dcmjs = __commonJS({
21237
21237
  return item.GraphicData;
21238
21238
  }).filter(/* @__PURE__ */ function(s) {
21239
21239
  return function(a2) {
21240
- return function(j2) {
21241
- return !s.has(j2) && s.add(j2);
21240
+ return function(j) {
21241
+ return !s.has(j) && s.add(j);
21242
21242
  }(JSON.stringify(a2));
21243
21243
  };
21244
21244
  }(/* @__PURE__ */ new Set()));
@@ -21356,8 +21356,8 @@ var require_dcmjs = __commonJS({
21356
21356
  return item.GraphicData;
21357
21357
  }).filter(/* @__PURE__ */ function(s) {
21358
21358
  return function(a2) {
21359
- return function(j2) {
21360
- return !s.has(j2) && s.add(j2);
21359
+ return function(j) {
21360
+ return !s.has(j) && s.add(j);
21361
21361
  }(JSON.stringify(a2));
21362
21362
  };
21363
21363
  }(/* @__PURE__ */ new Set()));
@@ -21402,8 +21402,8 @@ var require_dcmjs = __commonJS({
21402
21402
  });
21403
21403
  return measurement.filter(/* @__PURE__ */ function(s) {
21404
21404
  return function(a2) {
21405
- return function(j2) {
21406
- return !s.has(j2) && s.add(j2);
21405
+ return function(j) {
21406
+ return !s.has(j) && s.add(j);
21407
21407
  }(JSON.stringify(a2));
21408
21408
  };
21409
21409
  }(/* @__PURE__ */ new Set()));
@@ -21440,8 +21440,8 @@ var require_dcmjs = __commonJS({
21440
21440
  return item.GraphicData;
21441
21441
  }).filter(/* @__PURE__ */ function(s) {
21442
21442
  return function(a2) {
21443
- return function(j2) {
21444
- return !s.has(j2) && s.add(j2);
21443
+ return function(j) {
21444
+ return !s.has(j) && s.add(j);
21445
21445
  }(JSON.stringify(a2));
21446
21446
  };
21447
21447
  }(/* @__PURE__ */ new Set()));
@@ -21485,8 +21485,8 @@ var require_dcmjs = __commonJS({
21485
21485
  return item.GraphicData;
21486
21486
  }).filter(/* @__PURE__ */ function(s) {
21487
21487
  return function(a2) {
21488
- return function(j2) {
21489
- return !s.has(j2) && s.add(j2);
21488
+ return function(j) {
21489
+ return !s.has(j) && s.add(j);
21490
21490
  }(JSON.stringify(a2));
21491
21491
  };
21492
21492
  }(/* @__PURE__ */ new Set()));
@@ -21600,7 +21600,7 @@ var require_dcmjs = __commonJS({
21600
21600
  }
21601
21601
  function stringToUint8Array(str2) {
21602
21602
  var arr = new Uint8Array(str2.length);
21603
- for (var i = 0, j2 = str2.length; i < j2; i++) {
21603
+ for (var i = 0, j = str2.length; i < j; i++) {
21604
21604
  arr[i] = str2.charCodeAt(i);
21605
21605
  }
21606
21606
  return arr;
@@ -27590,7 +27590,7 @@ var require_has_flag = __commonJS({
27590
27590
  var require_supports_colors = __commonJS({
27591
27591
  "../../node_modules/logform/node_modules/@colors/colors/lib/system/supports-colors.js"(exports2, module2) {
27592
27592
  "use strict";
27593
- var os2 = require("os");
27593
+ var os = require("os");
27594
27594
  var hasFlag = require_has_flag();
27595
27595
  var env = process.env;
27596
27596
  var forceColor = void 0;
@@ -27628,7 +27628,7 @@ var require_supports_colors = __commonJS({
27628
27628
  }
27629
27629
  var min = forceColor ? 1 : 0;
27630
27630
  if (process.platform === "win32") {
27631
- var osRelease = os2.release().split(".");
27631
+ var osRelease = os.release().split(".");
27632
27632
  if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
27633
27633
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
27634
27634
  }
@@ -29288,7 +29288,7 @@ var require_ms = __commonJS({
29288
29288
  var m2 = s * 60;
29289
29289
  var h2 = m2 * 60;
29290
29290
  var d3 = h2 * 24;
29291
- var w3 = d3 * 7;
29291
+ var w2 = d3 * 7;
29292
29292
  var y2 = d3 * 365.25;
29293
29293
  module2.exports = function(val, options) {
29294
29294
  options = options || {};
@@ -29325,7 +29325,7 @@ var require_ms = __commonJS({
29325
29325
  case "weeks":
29326
29326
  case "week":
29327
29327
  case "w":
29328
- return n * w3;
29328
+ return n * w2;
29329
29329
  case "days":
29330
29330
  case "day":
29331
29331
  case "d":
@@ -30887,21 +30887,21 @@ var require_string_decoder = __commonJS({
30887
30887
  return byte >> 6 === 2 ? -1 : -2;
30888
30888
  }
30889
30889
  function utf8CheckIncomplete(self2, buf, i) {
30890
- var j2 = buf.length - 1;
30891
- if (j2 < i) return 0;
30892
- var nb = utf8CheckByte(buf[j2]);
30890
+ var j = buf.length - 1;
30891
+ if (j < i) return 0;
30892
+ var nb = utf8CheckByte(buf[j]);
30893
30893
  if (nb >= 0) {
30894
30894
  if (nb > 0) self2.lastNeed = nb - 1;
30895
30895
  return nb;
30896
30896
  }
30897
- if (--j2 < i || nb === -2) return 0;
30898
- nb = utf8CheckByte(buf[j2]);
30897
+ if (--j < i || nb === -2) return 0;
30898
+ nb = utf8CheckByte(buf[j]);
30899
30899
  if (nb >= 0) {
30900
30900
  if (nb > 0) self2.lastNeed = nb - 2;
30901
30901
  return nb;
30902
30902
  }
30903
- if (--j2 < i || nb === -2) return 0;
30904
- nb = utf8CheckByte(buf[j2]);
30903
+ if (--j < i || nb === -2) return 0;
30904
+ nb = utf8CheckByte(buf[j]);
30905
30905
  if (nb >= 0) {
30906
30906
  if (nb > 0) {
30907
30907
  if (nb === 2) nb = 0;
@@ -31548,10 +31548,10 @@ var require_stream_readable = __commonJS({
31548
31548
  state.reading = false;
31549
31549
  onEofChunk(stream, state);
31550
31550
  } else {
31551
- var er2;
31552
- if (!skipChunkCheck) er2 = chunkInvalid(state, chunk);
31553
- if (er2) {
31554
- errorOrDestroy(stream, er2);
31551
+ var er;
31552
+ if (!skipChunkCheck) er = chunkInvalid(state, chunk);
31553
+ if (er) {
31554
+ errorOrDestroy(stream, er);
31555
31555
  } else if (state.objectMode || chunk && chunk.length > 0) {
31556
31556
  if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) {
31557
31557
  chunk = _uint8ArrayToBuffer(chunk);
@@ -31593,11 +31593,11 @@ var require_stream_readable = __commonJS({
31593
31593
  maybeReadMore(stream, state);
31594
31594
  }
31595
31595
  function chunkInvalid(state, chunk) {
31596
- var er2;
31596
+ var er;
31597
31597
  if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) {
31598
- er2 = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
31598
+ er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
31599
31599
  }
31600
- return er2;
31600
+ return er;
31601
31601
  }
31602
31602
  Readable2.prototype.isPaused = function() {
31603
31603
  return this._readableState.flowing === false;
@@ -31823,11 +31823,11 @@ var require_stream_readable = __commonJS({
31823
31823
  src.pause();
31824
31824
  }
31825
31825
  }
31826
- function onerror(er2) {
31827
- debug("onerror", er2);
31826
+ function onerror(er) {
31827
+ debug("onerror", er);
31828
31828
  unpipe();
31829
31829
  dest.removeListener("error", onerror);
31830
- if (EElistenerCount(dest, "error") === 0) errorOrDestroy(dest, er2);
31830
+ if (EElistenerCount(dest, "error") === 0) errorOrDestroy(dest, er);
31831
31831
  }
31832
31832
  prependListener(dest, "error", onerror);
31833
31833
  function onclose() {
@@ -32292,8 +32292,8 @@ var require_stream_writable = __commonJS({
32292
32292
  this.corked = 0;
32293
32293
  this.sync = true;
32294
32294
  this.bufferProcessing = false;
32295
- this.onwrite = function(er2) {
32296
- onwrite(stream, er2);
32295
+ this.onwrite = function(er) {
32296
+ onwrite(stream, er);
32297
32297
  };
32298
32298
  this.writecb = null;
32299
32299
  this.writelen = 0;
@@ -32359,20 +32359,20 @@ var require_stream_writable = __commonJS({
32359
32359
  errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
32360
32360
  };
32361
32361
  function writeAfterEnd(stream, cb) {
32362
- var er2 = new ERR_STREAM_WRITE_AFTER_END();
32363
- errorOrDestroy(stream, er2);
32364
- process.nextTick(cb, er2);
32362
+ var er = new ERR_STREAM_WRITE_AFTER_END();
32363
+ errorOrDestroy(stream, er);
32364
+ process.nextTick(cb, er);
32365
32365
  }
32366
32366
  function validChunk(stream, state, chunk, cb) {
32367
- var er2;
32367
+ var er;
32368
32368
  if (chunk === null) {
32369
- er2 = new ERR_STREAM_NULL_VALUES();
32369
+ er = new ERR_STREAM_NULL_VALUES();
32370
32370
  } else if (typeof chunk !== "string" && !state.objectMode) {
32371
- er2 = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);
32371
+ er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);
32372
32372
  }
32373
- if (er2) {
32374
- errorOrDestroy(stream, er2);
32375
- process.nextTick(cb, er2);
32373
+ if (er) {
32374
+ errorOrDestroy(stream, er);
32375
+ process.nextTick(cb, er);
32376
32376
  return false;
32377
32377
  }
32378
32378
  return true;
@@ -32481,17 +32481,17 @@ var require_stream_writable = __commonJS({
32481
32481
  else stream._write(chunk, encoding, state.onwrite);
32482
32482
  state.sync = false;
32483
32483
  }
32484
- function onwriteError(stream, state, sync, er2, cb) {
32484
+ function onwriteError(stream, state, sync, er, cb) {
32485
32485
  --state.pendingcb;
32486
32486
  if (sync) {
32487
- process.nextTick(cb, er2);
32487
+ process.nextTick(cb, er);
32488
32488
  process.nextTick(finishMaybe, stream, state);
32489
32489
  stream._writableState.errorEmitted = true;
32490
- errorOrDestroy(stream, er2);
32490
+ errorOrDestroy(stream, er);
32491
32491
  } else {
32492
- cb(er2);
32492
+ cb(er);
32493
32493
  stream._writableState.errorEmitted = true;
32494
- errorOrDestroy(stream, er2);
32494
+ errorOrDestroy(stream, er);
32495
32495
  finishMaybe(stream, state);
32496
32496
  }
32497
32497
  }
@@ -32501,13 +32501,13 @@ var require_stream_writable = __commonJS({
32501
32501
  state.length -= state.writelen;
32502
32502
  state.writelen = 0;
32503
32503
  }
32504
- function onwrite(stream, er2) {
32504
+ function onwrite(stream, er) {
32505
32505
  var state = stream._writableState;
32506
32506
  var sync = state.sync;
32507
32507
  var cb = state.writecb;
32508
32508
  if (typeof cb !== "function") throw new ERR_MULTIPLE_CALLBACK();
32509
32509
  onwriteStateUpdate(state);
32510
- if (er2) onwriteError(stream, state, sync, er2, cb);
32510
+ if (er) onwriteError(stream, state, sync, er, cb);
32511
32511
  else {
32512
32512
  var finished = needFinish(state) || stream.destroyed;
32513
32513
  if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
@@ -32889,7 +32889,7 @@ var require_winston_transport = __commonJS({
32889
32889
  var require_console = __commonJS({
32890
32890
  "../../node_modules/winston/lib/winston/transports/console.js"(exports2, module2) {
32891
32891
  "use strict";
32892
- var os2 = require("os");
32892
+ var os = require("os");
32893
32893
  var { LEVEL, MESSAGE } = require_triple_beam();
32894
32894
  var TransportStream = require_winston_transport();
32895
32895
  module2.exports = class Console extends TransportStream {
@@ -32903,7 +32903,7 @@ var require_console = __commonJS({
32903
32903
  this.name = options.name || "console";
32904
32904
  this.stderrLevels = this._stringArrayToSet(options.stderrLevels);
32905
32905
  this.consoleWarnLevels = this._stringArrayToSet(options.consoleWarnLevels);
32906
- this.eol = typeof options.eol === "string" ? options.eol : os2.EOL;
32906
+ this.eol = typeof options.eol === "string" ? options.eol : os.EOL;
32907
32907
  this.forceConsole = options.forceConsole || false;
32908
32908
  this._consoleLog = console.log.bind(console);
32909
32909
  this._consoleWarn = console.warn.bind(console);
@@ -33538,7 +33538,7 @@ var require_stream_transform = __commonJS({
33538
33538
  var ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
33539
33539
  var Duplex = require_stream_duplex();
33540
33540
  require_inherits()(Transform, Duplex);
33541
- function afterTransform(er2, data2) {
33541
+ function afterTransform(er, data2) {
33542
33542
  var ts = this._transformState;
33543
33543
  ts.transforming = false;
33544
33544
  var cb = ts.writecb;
@@ -33549,7 +33549,7 @@ var require_stream_transform = __commonJS({
33549
33549
  ts.writecb = null;
33550
33550
  if (data2 != null)
33551
33551
  this.push(data2);
33552
- cb(er2);
33552
+ cb(er);
33553
33553
  var rs = this._readableState;
33554
33554
  rs.reading = false;
33555
33555
  if (rs.needReadable || rs.length < rs.highWaterMark) {
@@ -33578,8 +33578,8 @@ var require_stream_transform = __commonJS({
33578
33578
  function prefinish() {
33579
33579
  var _this = this;
33580
33580
  if (typeof this._flush === "function" && !this._readableState.destroyed) {
33581
- this._flush(function(er2, data2) {
33582
- done(_this, er2, data2);
33581
+ this._flush(function(er, data2) {
33582
+ done(_this, er, data2);
33583
33583
  });
33584
33584
  } else {
33585
33585
  done(this, null, null);
@@ -33616,8 +33616,8 @@ var require_stream_transform = __commonJS({
33616
33616
  cb(err2);
33617
33617
  });
33618
33618
  };
33619
- function done(stream, er2, data2) {
33620
- if (er2) return stream.emit("error", er2);
33619
+ function done(stream, er, data2) {
33620
+ if (er) return stream.emit("error", er);
33621
33621
  if (data2 != null)
33622
33622
  stream.push(data2);
33623
33623
  if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();
@@ -34075,25 +34075,25 @@ var require_color_string = __commonJS({
34075
34075
  }
34076
34076
  }
34077
34077
  var name;
34078
- var cs = module2.exports = {
34078
+ var cs2 = module2.exports = {
34079
34079
  to: {},
34080
34080
  get: {}
34081
34081
  };
34082
- cs.get = function(string) {
34082
+ cs2.get = function(string) {
34083
34083
  var prefix = string.substring(0, 3).toLowerCase();
34084
34084
  var val;
34085
34085
  var model;
34086
34086
  switch (prefix) {
34087
34087
  case "hsl":
34088
- val = cs.get.hsl(string);
34088
+ val = cs2.get.hsl(string);
34089
34089
  model = "hsl";
34090
34090
  break;
34091
34091
  case "hwb":
34092
- val = cs.get.hwb(string);
34092
+ val = cs2.get.hwb(string);
34093
34093
  model = "hwb";
34094
34094
  break;
34095
34095
  default:
34096
- val = cs.get.rgb(string);
34096
+ val = cs2.get.rgb(string);
34097
34097
  model = "rgb";
34098
34098
  break;
34099
34099
  }
@@ -34102,7 +34102,7 @@ var require_color_string = __commonJS({
34102
34102
  }
34103
34103
  return { model, value: val };
34104
34104
  };
34105
- cs.get.rgb = function(string) {
34105
+ cs2.get.rgb = function(string) {
34106
34106
  if (!string) {
34107
34107
  return null;
34108
34108
  }
@@ -34175,7 +34175,7 @@ var require_color_string = __commonJS({
34175
34175
  rgb[3] = clamp(rgb[3], 0, 1);
34176
34176
  return rgb;
34177
34177
  };
34178
- cs.get.hsl = function(string) {
34178
+ cs2.get.hsl = function(string) {
34179
34179
  if (!string) {
34180
34180
  return null;
34181
34181
  }
@@ -34191,7 +34191,7 @@ var require_color_string = __commonJS({
34191
34191
  }
34192
34192
  return null;
34193
34193
  };
34194
- cs.get.hwb = function(string) {
34194
+ cs2.get.hwb = function(string) {
34195
34195
  if (!string) {
34196
34196
  return null;
34197
34197
  }
@@ -34200,33 +34200,33 @@ var require_color_string = __commonJS({
34200
34200
  if (match) {
34201
34201
  var alpha = parseFloat(match[4]);
34202
34202
  var h2 = (parseFloat(match[1]) % 360 + 360) % 360;
34203
- var w3 = clamp(parseFloat(match[2]), 0, 100);
34203
+ var w2 = clamp(parseFloat(match[2]), 0, 100);
34204
34204
  var b2 = clamp(parseFloat(match[3]), 0, 100);
34205
34205
  var a2 = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
34206
- return [h2, w3, b2, a2];
34206
+ return [h2, w2, b2, a2];
34207
34207
  }
34208
34208
  return null;
34209
34209
  };
34210
- cs.to.hex = function() {
34210
+ cs2.to.hex = function() {
34211
34211
  var rgba = swizzle(arguments);
34212
34212
  return "#" + hexDouble(rgba[0]) + hexDouble(rgba[1]) + hexDouble(rgba[2]) + (rgba[3] < 1 ? hexDouble(Math.round(rgba[3] * 255)) : "");
34213
34213
  };
34214
- cs.to.rgb = function() {
34214
+ cs2.to.rgb = function() {
34215
34215
  var rgba = swizzle(arguments);
34216
34216
  return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + Math.round(rgba[0]) + ", " + Math.round(rgba[1]) + ", " + Math.round(rgba[2]) + ")" : "rgba(" + Math.round(rgba[0]) + ", " + Math.round(rgba[1]) + ", " + Math.round(rgba[2]) + ", " + rgba[3] + ")";
34217
34217
  };
34218
- cs.to.rgb.percent = function() {
34218
+ cs2.to.rgb.percent = function() {
34219
34219
  var rgba = swizzle(arguments);
34220
34220
  var r7 = Math.round(rgba[0] / 255 * 100);
34221
34221
  var g2 = Math.round(rgba[1] / 255 * 100);
34222
34222
  var b2 = Math.round(rgba[2] / 255 * 100);
34223
34223
  return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + r7 + "%, " + g2 + "%, " + b2 + "%)" : "rgba(" + r7 + "%, " + g2 + "%, " + b2 + "%, " + rgba[3] + ")";
34224
34224
  };
34225
- cs.to.hsl = function() {
34225
+ cs2.to.hsl = function() {
34226
34226
  var hsla = swizzle(arguments);
34227
34227
  return hsla.length < 4 || hsla[3] === 1 ? "hsl(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%)" : "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, " + hsla[3] + ")";
34228
34228
  };
34229
- cs.to.hwb = function() {
34229
+ cs2.to.hwb = function() {
34230
34230
  var hwba = swizzle(arguments);
34231
34231
  var a2 = "";
34232
34232
  if (hwba.length >= 4 && hwba[3] !== 1) {
@@ -34234,7 +34234,7 @@ var require_color_string = __commonJS({
34234
34234
  }
34235
34235
  return "hwb(" + hwba[0] + ", " + hwba[1] + "%, " + hwba[2] + "%" + a2 + ")";
34236
34236
  };
34237
- cs.to.keyword = function(rgb) {
34237
+ cs2.to.keyword = function(rgb) {
34238
34238
  return reverseNames[rgb.slice(0, 3)];
34239
34239
  };
34240
34240
  function clamp(num, min, max) {
@@ -34533,9 +34533,9 @@ var require_conversions = __commonJS({
34533
34533
  var g2 = rgb[1];
34534
34534
  var b2 = rgb[2];
34535
34535
  var h2 = convert.rgb.hsl(rgb)[0];
34536
- var w3 = 1 / 255 * Math.min(r7, Math.min(g2, b2));
34536
+ var w2 = 1 / 255 * Math.min(r7, Math.min(g2, b2));
34537
34537
  b2 = 1 - 1 / 255 * Math.max(r7, Math.max(g2, b2));
34538
- return [h2, w3 * 100, b2 * 100];
34538
+ return [h2, w2 * 100, b2 * 100];
34539
34539
  };
34540
34540
  convert.rgb.cmyk = function(rgb) {
34541
34541
  var r7 = rgb[0] / 255;
@@ -34667,13 +34667,13 @@ var require_conversions = __commonJS({
34667
34667
  var h2 = hsv[0] / 60;
34668
34668
  var s = hsv[1] / 100;
34669
34669
  var v = hsv[2] / 100;
34670
- var hi2 = Math.floor(h2) % 6;
34670
+ var hi = Math.floor(h2) % 6;
34671
34671
  var f2 = h2 - Math.floor(h2);
34672
34672
  var p2 = 255 * v * (1 - s);
34673
34673
  var q2 = 255 * v * (1 - s * f2);
34674
34674
  var t = 255 * v * (1 - s * (1 - f2));
34675
34675
  v *= 255;
34676
- switch (hi2) {
34676
+ switch (hi) {
34677
34677
  case 0:
34678
34678
  return [v, t, p2];
34679
34679
  case 1:
@@ -35003,18 +35003,18 @@ var require_conversions = __commonJS({
35003
35003
  return [g2 * 255, g2 * 255, g2 * 255];
35004
35004
  }
35005
35005
  var pure = [0, 0, 0];
35006
- var hi2 = h2 % 1 * 6;
35007
- var v = hi2 % 1;
35008
- var w3 = 1 - v;
35006
+ var hi = h2 % 1 * 6;
35007
+ var v = hi % 1;
35008
+ var w2 = 1 - v;
35009
35009
  var mg = 0;
35010
- switch (Math.floor(hi2)) {
35010
+ switch (Math.floor(hi)) {
35011
35011
  case 0:
35012
35012
  pure[0] = 1;
35013
35013
  pure[1] = v;
35014
35014
  pure[2] = 0;
35015
35015
  break;
35016
35016
  case 1:
35017
- pure[0] = w3;
35017
+ pure[0] = w2;
35018
35018
  pure[1] = 1;
35019
35019
  pure[2] = 0;
35020
35020
  break;
@@ -35025,7 +35025,7 @@ var require_conversions = __commonJS({
35025
35025
  break;
35026
35026
  case 3:
35027
35027
  pure[0] = 0;
35028
- pure[1] = w3;
35028
+ pure[1] = w2;
35029
35029
  pure[2] = 1;
35030
35030
  break;
35031
35031
  case 4:
@@ -35036,7 +35036,7 @@ var require_conversions = __commonJS({
35036
35036
  default:
35037
35037
  pure[0] = 1;
35038
35038
  pure[1] = 0;
35039
- pure[2] = w3;
35039
+ pure[2] = w2;
35040
35040
  }
35041
35041
  mg = (1 - c) * g2;
35042
35042
  return [
@@ -35074,10 +35074,10 @@ var require_conversions = __commonJS({
35074
35074
  return [hcg[0], (v - c) * 100, (1 - v) * 100];
35075
35075
  };
35076
35076
  convert.hwb.hcg = function(hwb) {
35077
- var w3 = hwb[1] / 100;
35077
+ var w2 = hwb[1] / 100;
35078
35078
  var b2 = hwb[2] / 100;
35079
35079
  var v = 1 - b2;
35080
- var c = v - w3;
35080
+ var c = v - w2;
35081
35081
  var g2 = 0;
35082
35082
  if (c < 1) {
35083
35083
  g2 = (v - c) / (1 - c);
@@ -35546,9 +35546,9 @@ var require_color = __commonJS({
35546
35546
  var color1 = mixinColor.rgb();
35547
35547
  var color2 = this.rgb();
35548
35548
  var p2 = weight === void 0 ? 0.5 : weight;
35549
- var w3 = 2 * p2 - 1;
35549
+ var w2 = 2 * p2 - 1;
35550
35550
  var a2 = color1.alpha() - color2.alpha();
35551
- var w1 = ((w3 * a2 === -1 ? w3 : (w3 + a2) / (1 + w3 * a2)) + 1) / 2;
35551
+ var w1 = ((w2 * a2 === -1 ? w2 : (w2 + a2) / (1 + w2 * a2)) + 1) / 2;
35552
35552
  var w22 = 1 - w1;
35553
35553
  return Color.rgb(
35554
35554
  w1 * color1.red() + w22 * color2.red(),
@@ -35931,7 +35931,7 @@ var require_file = __commonJS({
35931
35931
  var { Stream, PassThrough } = require_readable();
35932
35932
  var TransportStream = require_winston_transport();
35933
35933
  var debug = require_node2()("winston:file");
35934
- var os2 = require("os");
35934
+ var os = require("os");
35935
35935
  var tailFile = require_tail_file();
35936
35936
  module2.exports = class File extends TransportStream {
35937
35937
  /**
@@ -35969,7 +35969,7 @@ var require_file = __commonJS({
35969
35969
  this.rotationFormat = options.rotationFormat || false;
35970
35970
  this.zippedArchive = options.zippedArchive || false;
35971
35971
  this.maxFiles = options.maxFiles || null;
35972
- this.eol = typeof options.eol === "string" ? options.eol : os2.EOL;
35972
+ this.eol = typeof options.eol === "string" ? options.eol : os.EOL;
35973
35973
  this.tailable = options.tailable || false;
35974
35974
  this.lazy = options.lazy || false;
35975
35975
  this._size = 0;
@@ -36750,7 +36750,7 @@ var require_stream3 = __commonJS({
36750
36750
  "use strict";
36751
36751
  var isStream = require_is_stream();
36752
36752
  var { MESSAGE } = require_triple_beam();
36753
- var os2 = require("os");
36753
+ var os = require("os");
36754
36754
  var TransportStream = require_winston_transport();
36755
36755
  module2.exports = class Stream extends TransportStream {
36756
36756
  /**
@@ -36766,7 +36766,7 @@ var require_stream3 = __commonJS({
36766
36766
  this._stream = options.stream;
36767
36767
  this._stream.setMaxListeners(Infinity);
36768
36768
  this.isObjectMode = options.stream._writableState.objectMode;
36769
- this.eol = typeof options.eol === "string" ? options.eol : os2.EOL;
36769
+ this.eol = typeof options.eol === "string" ? options.eol : os.EOL;
36770
36770
  }
36771
36771
  /**
36772
36772
  * Core logging method exposed to Winston.
@@ -37150,7 +37150,7 @@ var require_exception_stream = __commonJS({
37150
37150
  var require_exception_handler = __commonJS({
37151
37151
  "../../node_modules/winston/lib/winston/exception-handler.js"(exports2, module2) {
37152
37152
  "use strict";
37153
- var os2 = require("os");
37153
+ var os = require("os");
37154
37154
  var asyncForEach = require_forEach();
37155
37155
  var debug = require_node2()("winston:exception");
37156
37156
  var once = require_one_time();
@@ -37245,8 +37245,8 @@ var require_exception_handler = __commonJS({
37245
37245
  */
37246
37246
  getOsInfo() {
37247
37247
  return {
37248
- loadavg: os2.loadavg(),
37249
- uptime: os2.uptime()
37248
+ loadavg: os.loadavg(),
37249
+ uptime: os.uptime()
37250
37250
  };
37251
37251
  }
37252
37252
  /**
@@ -37388,7 +37388,7 @@ var require_rejection_stream = __commonJS({
37388
37388
  var require_rejection_handler = __commonJS({
37389
37389
  "../../node_modules/winston/lib/winston/rejection-handler.js"(exports2, module2) {
37390
37390
  "use strict";
37391
- var os2 = require("os");
37391
+ var os = require("os");
37392
37392
  var asyncForEach = require_forEach();
37393
37393
  var debug = require_node2()("winston:rejection");
37394
37394
  var once = require_one_time();
@@ -37485,8 +37485,8 @@ var require_rejection_handler = __commonJS({
37485
37485
  */
37486
37486
  getOsInfo() {
37487
37487
  return {
37488
- loadavg: os2.loadavg(),
37489
- uptime: os2.uptime()
37488
+ loadavg: os.loadavg(),
37489
+ uptime: os.uptime()
37490
37490
  };
37491
37491
  }
37492
37492
  /**
@@ -39100,7 +39100,7 @@ var require_dcmjs_dimse_min = __commonJS({
39100
39100
  return o3.setDataset(new a2(r9)), o3.getCommandDataset().setElement("MoveDestination", e3), o3;
39101
39101
  }
39102
39102
  }
39103
- class A extends p2 {
39103
+ class A2 extends p2 {
39104
39104
  constructor(e3, t3) {
39105
39105
  super(n2.CMoveResponse, r8.StudyRootQueryRetrieveInformationModelMove, false, e3, t3);
39106
39106
  }
@@ -39118,7 +39118,7 @@ var require_dcmjs_dimse_min = __commonJS({
39118
39118
  }
39119
39119
  static fromRequest(e3) {
39120
39120
  if (!(e3 instanceof P2)) throw new Error("Request should be an instance of CMoveRequest");
39121
- const t3 = new A(o2.ProcessingFailure);
39121
+ const t3 = new A2(o2.ProcessingFailure);
39122
39122
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
39123
39123
  }
39124
39124
  }
@@ -39151,7 +39151,7 @@ var require_dcmjs_dimse_min = __commonJS({
39151
39151
  return r9.setDataset(new a2(i3)), r9;
39152
39152
  }
39153
39153
  }
39154
- class w3 extends p2 {
39154
+ class w2 extends p2 {
39155
39155
  constructor(e3, t3) {
39156
39156
  super(n2.CGetResponse, r8.StudyRootQueryRetrieveInformationModelGet, false, e3, t3);
39157
39157
  }
@@ -39169,7 +39169,7 @@ var require_dcmjs_dimse_min = __commonJS({
39169
39169
  }
39170
39170
  static fromRequest(e3) {
39171
39171
  if (!(e3 instanceof v)) throw new Error("Request should be an instance of CGetRequest");
39172
- const t3 = new w3(o2.ProcessingFailure);
39172
+ const t3 = new w2(o2.ProcessingFailure);
39173
39173
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
39174
39174
  }
39175
39175
  }
@@ -39323,7 +39323,7 @@ var require_dcmjs_dimse_min = __commonJS({
39323
39323
  return new F2(e3.getAffectedSopClassUid(), e3.getMessageId());
39324
39324
  }
39325
39325
  }
39326
- e2.exports = { CCancelRequest: F2, CEchoRequest: R2, CEchoResponse: S2, CFindRequest: f2, CFindResponse: y2, CGetRequest: v, CGetResponse: w3, CMoveRequest: P2, CMoveResponse: A, Command: g2, CStoreRequest: I2, CStoreResponse: C2, NActionRequest: q2, NActionResponse: D2, NCreateRequest: x2, NCreateResponse: U2, NDeleteRequest: E2, NDeleteResponse: T, NEventReportRequest: b2, NEventReportResponse: O2, NGetRequest: N2, NGetResponse: B2, NSetRequest: M3, NSetResponse: L2, Request: l3, Response: p2 };
39326
+ e2.exports = { CCancelRequest: F2, CEchoRequest: R2, CEchoResponse: S2, CFindRequest: f2, CFindResponse: y2, CGetRequest: v, CGetResponse: w2, CMoveRequest: P2, CMoveResponse: A2, Command: g2, CStoreRequest: I2, CStoreResponse: C2, NActionRequest: q2, NActionResponse: D2, NCreateRequest: x2, NCreateResponse: U2, NDeleteRequest: E2, NDeleteResponse: T, NEventReportRequest: b2, NEventReportResponse: O2, NGetRequest: N2, NGetResponse: B2, NSetRequest: M3, NSetResponse: L2, Request: l3, Response: p2 };
39327
39327
  }, 492: (e2) => {
39328
39328
  const t2 = { AAbort: 7, AAssociateAC: 2, AAssociateRJ: 3, AAssociateRQ: 1, AReleaseRP: 6, AReleaseRQ: 5, PDataTF: 4 };
39329
39329
  Object.freeze(t2);
@@ -39447,7 +39447,7 @@ var require_dcmjs_dimse_min = __commonJS({
39447
39447
  }
39448
39448
  };
39449
39449
  }, 371: (e2, t2, s2) => {
39450
- const { Association: n2 } = s2(570), { AAbort: i2, AAssociateAC: r8, AAssociateRJ: o2, AAssociateRQ: a2, AReleaseRP: c, AReleaseRQ: d3, PDataTF: u2, Pdv: h2, RawPdu: m2 } = s2(942), { CommandFieldType: g2, RawPduType: l3, Status: p2, TranscodableTransferSyntaxes: R2 } = s2(492), { CCancelRequest: S2, CEchoRequest: f2, CEchoResponse: y2, CFindRequest: I2, CFindResponse: C2, CGetRequest: P2, CGetResponse: A, CMoveRequest: v, CMoveResponse: w3, Command: x2, CStoreRequest: U2, CStoreResponse: q2, NActionRequest: D2, NActionResponse: E2, NCreateRequest: T, NCreateResponse: b2, NDeleteRequest: O2, NDeleteResponse: N2, NEventReportRequest: B2, NEventReportResponse: M3, NGetRequest: L2, NGetResponse: F2, NSetRequest: k2, NSetResponse: $, Response: j2 } = s2(940), V2 = s2(825), _ = s2(139), G2 = s2(906), z2 = s2(547), { SmartBuffer: Q } = s2(766), { EOL: W2 } = s2(857), J2 = s2(733);
39450
+ const { Association: n2 } = s2(570), { AAbort: i2, AAssociateAC: r8, AAssociateRJ: o2, AAssociateRQ: a2, AReleaseRP: c, AReleaseRQ: d3, PDataTF: u2, Pdv: h2, RawPdu: m2 } = s2(942), { CommandFieldType: g2, RawPduType: l3, Status: p2, TranscodableTransferSyntaxes: R2 } = s2(492), { CCancelRequest: S2, CEchoRequest: f2, CEchoResponse: y2, CFindRequest: I2, CFindResponse: C2, CGetRequest: P2, CGetResponse: A2, CMoveRequest: v, CMoveResponse: w2, Command: x2, CStoreRequest: U2, CStoreResponse: q2, NActionRequest: D2, NActionResponse: E2, NCreateRequest: T, NCreateResponse: b2, NDeleteRequest: O2, NDeleteResponse: N2, NEventReportRequest: B2, NEventReportResponse: M3, NGetRequest: L2, NGetResponse: F2, NSetRequest: k2, NSetResponse: $2, Response: j } = s2(940), V2 = s2(825), _ = s2(139), G2 = s2(906), z2 = s2(547), { SmartBuffer: Q } = s2(766), { EOL: W2 } = s2(857), J2 = s2(733);
39451
39451
  class X2 extends J2 {
39452
39452
  constructor() {
39453
39453
  super();
@@ -39656,13 +39656,13 @@ var require_dcmjs_dimse_min = __commonJS({
39656
39656
  this.dimse = Object.assign(new v(), s3);
39657
39657
  break;
39658
39658
  case g2.CMoveResponse:
39659
- this.dimse = Object.assign(new w3(), s3);
39659
+ this.dimse = Object.assign(new w2(), s3);
39660
39660
  break;
39661
39661
  case g2.CGetRequest:
39662
39662
  this.dimse = Object.assign(new P2(), s3);
39663
39663
  break;
39664
39664
  case g2.CGetResponse:
39665
- this.dimse = Object.assign(new A(), s3);
39665
+ this.dimse = Object.assign(new A2(), s3);
39666
39666
  break;
39667
39667
  case g2.NCreateRequest:
39668
39668
  this.dimse = Object.assign(new T(), s3);
@@ -39698,7 +39698,7 @@ var require_dcmjs_dimse_min = __commonJS({
39698
39698
  this.dimse = Object.assign(new k2(), s3);
39699
39699
  break;
39700
39700
  case g2.NSetResponse:
39701
- this.dimse = Object.assign(new $(), s3);
39701
+ this.dimse = Object.assign(new $2(), s3);
39702
39702
  break;
39703
39703
  case g2.CCancelRequest:
39704
39704
  this.dimse = Object.assign(new S2(), s3);
@@ -39718,7 +39718,7 @@ var require_dcmjs_dimse_min = __commonJS({
39718
39718
  }
39719
39719
  }
39720
39720
  _performDimse(e3, t3) {
39721
- if (t3 instanceof j2) {
39721
+ if (t3 instanceof j) {
39722
39722
  const e4 = Object.assign(Object.create(Object.getPrototypeOf(t3)), t3), s3 = this.pending.find((e5) => e5.getMessageId() === t3.getMessageIdBeingRespondedTo());
39723
39723
  s3 && (s3.raiseResponseEvent(e4), e4.getStatus() !== p2.Pending && s3.raiseDoneEvent());
39724
39724
  } else t3.getCommandFieldType() === g2.CEchoRequest ? this.emit("cEchoRequest", t3, (t4) => {
@@ -40357,7 +40357,7 @@ var require_dcmjs_dimse_min = __commonJS({
40357
40357
  }
40358
40358
  };
40359
40359
  }, 237: (e2, t2, s2) => {
40360
- const { Association: n2, PresentationContext: i2 } = s2(570), { Scp: r8, Server: o2 } = s2(538), { CCancelRequest: a2, CEchoRequest: c, CEchoResponse: d3, CFindRequest: u2, CFindResponse: h2, CGetRequest: m2, CGetResponse: g2, CMoveRequest: l3, CMoveResponse: p2, CStoreRequest: R2, CStoreResponse: S2, NActionRequest: f2, NActionResponse: y2, NCreateRequest: I2, NCreateResponse: C2, NDeleteRequest: P2, NDeleteResponse: A, NEventReportRequest: v, NEventReportResponse: w3, NGetRequest: x2, NGetResponse: U2, NSetRequest: q2, NSetResponse: D2 } = s2(940), { AbortReason: E2, AbortSource: T, CommandFieldType: b2, PresentationContextResult: O2, Priority: N2, RawPduType: B2, RejectReason: M3, RejectResult: L2, RejectSource: F2, SopClass: k2, Status: $, StorageClass: j2, TransferSyntax: V2, Uid: _, UserIdentityType: G2 } = s2(492), z2 = s2(422), Q = s2(825), W2 = s2(139), J2 = s2(906), X2 = { association: { Association: n2, PresentationContext: i2 }, Client: z2, constants: { AbortReason: E2, AbortSource: T, CommandFieldType: b2, PresentationContextResult: O2, Priority: N2, RawPduType: B2, RejectReason: M3, RejectResult: L2, RejectSource: F2, SopClass: k2, Status: $, StorageClass: j2, TransferSyntax: V2, Uid: _, UserIdentityType: G2 }, Dataset: Q, Implementation: W2, log: s2(547), requests: { CCancelRequest: a2, CEchoRequest: c, CFindRequest: u2, CGetRequest: m2, CMoveRequest: l3, CStoreRequest: R2, NActionRequest: f2, NCreateRequest: I2, NDeleteRequest: P2, NEventReportRequest: v, NGetRequest: x2, NSetRequest: q2 }, responses: { CEchoResponse: d3, CFindResponse: h2, CGetResponse: g2, CMoveResponse: p2, CStoreResponse: S2, NActionResponse: y2, NCreateResponse: C2, NDeleteResponse: A, NEventReportResponse: w3, NGetResponse: U2, NSetResponse: D2 }, Scp: r8, Server: o2, Statistics: J2, version: s2(837) };
40360
+ const { Association: n2, PresentationContext: i2 } = s2(570), { Scp: r8, Server: o2 } = s2(538), { CCancelRequest: a2, CEchoRequest: c, CEchoResponse: d3, CFindRequest: u2, CFindResponse: h2, CGetRequest: m2, CGetResponse: g2, CMoveRequest: l3, CMoveResponse: p2, CStoreRequest: R2, CStoreResponse: S2, NActionRequest: f2, NActionResponse: y2, NCreateRequest: I2, NCreateResponse: C2, NDeleteRequest: P2, NDeleteResponse: A2, NEventReportRequest: v, NEventReportResponse: w2, NGetRequest: x2, NGetResponse: U2, NSetRequest: q2, NSetResponse: D2 } = s2(940), { AbortReason: E2, AbortSource: T, CommandFieldType: b2, PresentationContextResult: O2, Priority: N2, RawPduType: B2, RejectReason: M3, RejectResult: L2, RejectSource: F2, SopClass: k2, Status: $2, StorageClass: j, TransferSyntax: V2, Uid: _, UserIdentityType: G2 } = s2(492), z2 = s2(422), Q = s2(825), W2 = s2(139), J2 = s2(906), X2 = { association: { Association: n2, PresentationContext: i2 }, Client: z2, constants: { AbortReason: E2, AbortSource: T, CommandFieldType: b2, PresentationContextResult: O2, Priority: N2, RawPduType: B2, RejectReason: M3, RejectResult: L2, RejectSource: F2, SopClass: k2, Status: $2, StorageClass: j, TransferSyntax: V2, Uid: _, UserIdentityType: G2 }, Dataset: Q, Implementation: W2, log: s2(547), requests: { CCancelRequest: a2, CEchoRequest: c, CFindRequest: u2, CGetRequest: m2, CMoveRequest: l3, CStoreRequest: R2, NActionRequest: f2, NCreateRequest: I2, NDeleteRequest: P2, NEventReportRequest: v, NGetRequest: x2, NSetRequest: q2 }, responses: { CEchoResponse: d3, CFindResponse: h2, CGetResponse: g2, CMoveResponse: p2, CStoreResponse: S2, NActionResponse: y2, NCreateResponse: C2, NDeleteResponse: A2, NEventReportResponse: w2, NGetResponse: U2, NSetResponse: D2 }, Scp: r8, Server: o2, Statistics: J2, version: s2(837) };
40361
40361
  e2.exports = X2;
40362
40362
  }, 547: (e2, t2, s2) => {
40363
40363
  const { createLogger: n2, format: i2, transports: r8 } = s2(688), { combine: o2, printf: a2, timestamp: c } = i2, d3 = n2({ format: o2(c(), a2(({ level: e3, message: t3, timestamp: s3 }) => `${s3} -- ${e3.toUpperCase()} -- ${t3}`)), transports: [new r8.Console()] });
@@ -40410,7 +40410,7 @@ __export(main_exports, {
40410
40410
  module.exports = __toCommonJS(main_exports);
40411
40411
 
40412
40412
  // ../core/dist/esm/index.mjs
40413
- var ze = class {
40413
+ var Ye = class {
40414
40414
  constructor(e, t) {
40415
40415
  this.operator = e;
40416
40416
  this.child = t;
@@ -40429,7 +40429,7 @@ var Y = class {
40429
40429
  return `${this.left.toString()} ${this.operator} ${this.right.toString()}`;
40430
40430
  }
40431
40431
  };
40432
- var Je = class {
40432
+ var Ze = class {
40433
40433
  constructor() {
40434
40434
  this.prefixParselets = {};
40435
40435
  this.infixParselets = {};
@@ -40453,10 +40453,10 @@ var Je = class {
40453
40453
  }, precedence: t });
40454
40454
  }
40455
40455
  construct(e) {
40456
- return new Kt(e, this.prefixParselets, this.infixParselets);
40456
+ return new zt(e, this.prefixParselets, this.infixParselets);
40457
40457
  }
40458
40458
  };
40459
- var Kt = class {
40459
+ var zt = class {
40460
40460
  constructor(e, t, n) {
40461
40461
  this.tokens = e, this.prefixParselets = t, this.infixParselets = n;
40462
40462
  }
@@ -40504,100 +40504,100 @@ var Kt = class {
40504
40504
  return this.infixParselets[e.id === "Symbol" ? e.value : e.id];
40505
40505
  }
40506
40506
  };
40507
- var zt = "ok";
40508
- var Ye = "created";
40509
- var Yt = "not-modified";
40510
- var Zt = "not-found";
40511
- var er = "unauthorized";
40512
- var Ze = "accepted";
40513
- var on = { resourceType: "OperationOutcome", id: Zt, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
40514
- var Ee = { resourceType: "OperationOutcome", id: er, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
40515
- var sn = { ...Ee, issue: [...Ee.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
40516
- var tr = { ...Ee, issue: [...Ee.issue, { severity: "error", code: "invalid", details: { text: "Token not issued for this audience" } }] };
40507
+ var Jt = "ok";
40508
+ var Xe = "created";
40509
+ var Zt = "not-modified";
40510
+ var Xt = "not-found";
40511
+ var tr = "unauthorized";
40512
+ var et = "accepted";
40513
+ var sn = { resourceType: "OperationOutcome", id: Xt, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
40514
+ var Ee = { resourceType: "OperationOutcome", id: tr, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
40515
+ var an = { ...Ee, issue: [...Ee.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
40516
+ var rr = { ...Ee, issue: [...Ee.issue, { severity: "error", code: "invalid", details: { text: "Token not issued for this audience" } }] };
40517
40517
  function E(r7, e) {
40518
40518
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r7 }, ...e ? { expression: [e] } : void 0 }] };
40519
40519
  }
40520
40520
  function h(r7) {
40521
40521
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "structure", details: { text: r7 } }] };
40522
40522
  }
40523
- function an(r7) {
40523
+ function cn(r7) {
40524
40524
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "exception", details: { text: "Internal server error" }, diagnostics: r7.toString() }] };
40525
40525
  }
40526
40526
  function be(r7) {
40527
40527
  return typeof r7 == "object" && r7 !== null && r7.resourceType === "OperationOutcome";
40528
40528
  }
40529
- function rr(r7) {
40530
- return r7.id === zt || r7.id === Ye || r7.id === Yt || r7.id === Ze;
40529
+ function nr(r7) {
40530
+ return r7.id === Jt || r7.id === Xe || r7.id === Zt || r7.id === et;
40531
40531
  }
40532
40532
  var d = class extends Error {
40533
40533
  constructor(e, t) {
40534
- super(cn(e)), this.outcome = e, this.cause = t;
40534
+ super(un(e)), this.outcome = e, this.cause = t;
40535
40535
  }
40536
40536
  };
40537
- function Xe(r7) {
40537
+ function tt(r7) {
40538
40538
  return r7 instanceof d ? r7.outcome : be(r7) ? r7 : E(Ne(r7));
40539
40539
  }
40540
40540
  function Ne(r7) {
40541
- return r7 ? typeof r7 == "string" ? r7 : r7 instanceof Error ? r7.message : be(r7) ? cn(r7) : typeof r7 == "object" && "code" in r7 && typeof r7.code == "string" ? r7.code : JSON.stringify(r7) : "Unknown error";
40541
+ return r7 ? typeof r7 == "string" ? r7 : r7 instanceof Error ? r7.message : be(r7) ? un(r7) : typeof r7 == "object" && "code" in r7 && typeof r7.code == "string" ? r7.code : JSON.stringify(r7) : "Unknown error";
40542
40542
  }
40543
- function cn(r7) {
40544
- let e = r7.issue?.map(Yi) ?? [];
40543
+ function un(r7) {
40544
+ let e = r7.issue?.map(Xi) ?? [];
40545
40545
  return e.length > 0 ? e.join("; ") : "Unknown error";
40546
40546
  }
40547
- function Yi(r7) {
40547
+ function Xi(r7) {
40548
40548
  let e;
40549
40549
  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;
40550
40550
  }
40551
- function Xi(r7, e) {
40551
+ function to(r7, e) {
40552
40552
  let t = e.max && e.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : e.max;
40553
40553
  return { path: r7, description: "", type: e.type ?? [], min: e.min ?? 0, max: t ?? 1, isArray: !!t && t > 1, constraints: [] };
40554
40554
  }
40555
- function pn(r7) {
40555
+ function dn(r7) {
40556
40556
  let e = /* @__PURE__ */ Object.create(null);
40557
- 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, Xi(i, o)])), constraints: [], innerTypes: [] };
40557
+ 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, to(i, o)])), constraints: [], innerTypes: [] };
40558
40558
  return e;
40559
40559
  }
40560
- var dn = { Element: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, BackboneElement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, Address: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: 9007199254740991, type: [{ code: "string" }] }, city: { type: [{ code: "string" }] }, district: { type: [{ code: "string" }] }, state: { type: [{ code: "string" }] }, postalCode: { type: [{ code: "string" }] }, country: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Age: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "author[x]": { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Organization"] }, { code: "string" }] }, time: { type: [{ code: "dateTime" }] }, text: { min: 1, type: [{ code: "markdown" }] } } }, Attachment: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, contentType: { type: [{ code: "code" }] }, language: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] }, url: { type: [{ code: "url" }] }, size: { type: [{ code: "unsignedInt" }] }, hash: { type: [{ code: "base64Binary" }] }, title: { type: [{ code: "string" }] }, creation: { type: [{ code: "dateTime" }] } } }, CodeableConcept: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, coding: { max: 9007199254740991, type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: 9007199254740991, type: [{ code: "ContactPoint" }] } } }, ContactPoint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] } } }, Count: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, "subject[x]": { type: [{ code: "CodeableConcept" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Group"] }] }, mustSupport: { max: 9007199254740991, type: [{ code: "string" }] }, codeFilter: { max: 9007199254740991, type: [{ code: "DataRequirementCodeFilter" }] }, dateFilter: { max: 9007199254740991, type: [{ code: "DataRequirementDateFilter" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: 9007199254740991, type: [{ code: "DataRequirementSort" }] } } }, Distance: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] }, patientInstruction: { type: [{ code: "string" }] }, timing: { type: [{ code: "Timing" }] }, "asNeeded[x]": { type: [{ code: "boolean" }, { code: "CodeableConcept" }] }, site: { type: [{ code: "CodeableConcept" }] }, route: { type: [{ code: "CodeableConcept" }] }, method: { type: [{ code: "CodeableConcept" }] }, doseAndRate: { max: 9007199254740991, type: [{ code: "DosageDoseAndRate" }] }, maxDosePerPeriod: { type: [{ code: "Ratio" }] }, maxDosePerAdministration: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, maxDosePerLifetime: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Duration: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: 9007199254740991, type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] }, slicing: { type: [{ code: "ElementDefinitionSlicing" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: 9007199254740991, type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "ElementDefinitionBase" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: 9007199254740991, type: [{ code: "ElementDefinitionType" }] }, "defaultValue[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, meaningWhenMissing: { type: [{ code: "markdown" }] }, orderMeaning: { type: [{ code: "string" }] }, "fixed[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, "pattern[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, example: { max: 9007199254740991, type: [{ code: "ElementDefinitionExample" }] }, "minValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, "maxValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, maxLength: { type: [{ code: "integer" }] }, condition: { max: 9007199254740991, type: [{ code: "id" }] }, constraint: { max: 9007199254740991, type: [{ code: "ElementDefinitionConstraint" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "ElementDefinitionBinding" }] }, mapping: { max: 9007199254740991, type: [{ code: "ElementDefinitionMapping" }] } } }, Expression: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, description: { type: [{ code: "string" }] }, name: { type: [{ code: "id" }] }, language: { min: 1, type: [{ code: "code" }] }, expression: { type: [{ code: "string" }] }, reference: { type: [{ code: "uri" }] } } }, Extension: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "uri" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: 9007199254740991, type: [{ code: "string" }] }, prefix: { max: 9007199254740991, type: [{ code: "string" }] }, suffix: { max: 9007199254740991, type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "CodeableConcept" }] }, system: { type: [{ code: "uri" }] }, value: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] }, assigner: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MarketingStatus: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, country: { min: 1, type: [{ code: "CodeableConcept" }] }, jurisdiction: { type: [{ code: "CodeableConcept" }] }, status: { min: 1, type: [{ code: "CodeableConcept" }] }, dateRange: { min: 1, type: [{ code: "Period" }] }, restoreDate: { type: [{ code: "dateTime" }] } } }, Meta: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: 9007199254740991, type: [{ code: "Coding" }] }, tag: { max: 9007199254740991, type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, 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" }] } } }, Timing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, event: { max: 9007199254740991, type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "TimingRepeat" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TriggerDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { type: [{ code: "string" }] }, "timing[x]": { type: [{ code: "Timing" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Schedule"] }, { code: "date" }, { code: "dateTime" }] }, data: { max: 9007199254740991, type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "Coding" }] }, "value[x]": { min: 1, type: [{ code: "CodeableConcept" }, { code: "Quantity" }, { code: "Range" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/PlanDefinition", "http://hl7.org/fhir/StructureDefinition/ResearchStudy", "http://hl7.org/fhir/StructureDefinition/InsurancePlan", "http://hl7.org/fhir/StructureDefinition/HealthcareService", "http://hl7.org/fhir/StructureDefinition/Group", "http://hl7.org/fhir/StructureDefinition/Location", "http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MoneyQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, SimpleQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { max: 0, type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, 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" }] } } } };
40561
- function sr(r7) {
40562
- return new ir(r7).parse();
40560
+ var fn = { 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" }] } } } };
40561
+ function ar(r7) {
40562
+ return new or(r7).parse();
40563
40563
  }
40564
- var ce = pn(dn);
40565
- var ar = /* @__PURE__ */ Object.create(null);
40566
- var fn = /* @__PURE__ */ Object.create(null);
40567
- var to = { "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" };
40568
- function gn(r7) {
40564
+ var ue = dn(fn);
40565
+ var cr = /* @__PURE__ */ Object.create(null);
40566
+ var mn = /* @__PURE__ */ Object.create(null);
40567
+ var no = { "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" };
40568
+ function xn(r7) {
40569
40569
  let e;
40570
- return e = fn[r7], e || (e = fn[r7] = /* @__PURE__ */ Object.create(null)), e;
40570
+ return e = mn[r7], e || (e = mn[r7] = /* @__PURE__ */ Object.create(null)), e;
40571
40571
  }
40572
- function cr(r7) {
40572
+ function ur(r7) {
40573
40573
  let e = Array.isArray(r7) ? r7 : r7.entry?.map((t) => t.resource) ?? [];
40574
- for (let t of e) ur(t);
40574
+ for (let t of e) lr(t);
40575
40575
  }
40576
- function ur(r7) {
40576
+ function lr(r7) {
40577
40577
  if (!r7?.name) throw new Error("Failed loading StructureDefinition from bundle");
40578
40578
  if (r7.resourceType !== "StructureDefinition") return;
40579
- let e = sr(r7), t = to[r7.url], n, i;
40580
- t ? (n = ce, 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 = ce, i = r7.type) : (n = gn(r7.url), i = r7.type), n[i] = e;
40579
+ let e = ar(r7), t = no[r7.url], n, i;
40580
+ t ? (n = ue, 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 = ue, i = r7.type) : (n = xn(r7.url), i = r7.type), n[i] = e;
40581
40581
  for (let o of e.innerTypes) o.parentType = e, n[o.name] = o;
40582
- ar[r7.url] = e;
40582
+ cr[r7.url] = e;
40583
40583
  }
40584
- function xn(r7) {
40585
- return !!ce[r7];
40584
+ function Tn(r7) {
40585
+ return !!ue[r7];
40586
40586
  }
40587
40587
  function Le(r7, e) {
40588
40588
  if (e) {
40589
- let t = gn(e)[r7];
40589
+ let t = xn(e)[r7];
40590
40590
  if (t) return t;
40591
40591
  }
40592
- return ce[r7];
40592
+ return ue[r7];
40593
40593
  }
40594
- function Sn(r7) {
40595
- return !!ar[r7];
40594
+ function En(r7) {
40595
+ return !!cr[r7];
40596
40596
  }
40597
- var ir = class {
40597
+ var or = class {
40598
40598
  constructor(e) {
40599
40599
  if (!e.snapshot?.element || e.snapshot.element.length === 0) throw new Error(`No snapshot defined for StructureDefinition '${e.name}'`);
40600
- 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, kind: e.kind, description: oo(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
40600
+ 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, kind: e.kind, description: ao(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
40601
40601
  }
40602
40602
  parse() {
40603
40603
  let e = this.next();
@@ -40605,7 +40605,7 @@ var ir = class {
40605
40605
  if (e.sliceName) this.parseSliceStart(e);
40606
40606
  else if (e.id?.includes(":")) {
40607
40607
  if (this.slicingContext?.current) {
40608
- let t = nr(e, this.slicingContext.path);
40608
+ let t = ir(e, this.slicingContext.path);
40609
40609
  this.slicingContext.current.elements[t] = this.parseElementDefinition(e);
40610
40610
  }
40611
40611
  } else {
@@ -40614,13 +40614,13 @@ var ir = class {
40614
40614
  let n = this.backboneContext;
40615
40615
  for (; n; ) {
40616
40616
  if (e.path?.startsWith(n.path + ".")) {
40617
- n.type.elements[nr(e, n.path)] = t;
40617
+ n.type.elements[ir(e, n.path)] = t;
40618
40618
  break;
40619
40619
  }
40620
40620
  n = n.parent;
40621
40621
  }
40622
40622
  if (!n) {
40623
- let i = nr(e, this.root.path);
40623
+ let i = ir(e, this.root.path);
40624
40624
  e.isSummary && this.resourceSchema.summaryProperties?.add(i.replace("[x]", "")), t.min > 0 && this.resourceSchema.mandatoryProperties?.add(i.replace("[x]", "")), this.resourceSchema.elements[i] = t;
40625
40625
  }
40626
40626
  this.checkFieldExit(e);
@@ -40634,11 +40634,11 @@ var ir = class {
40634
40634
  }
40635
40635
  enterInnerType(e) {
40636
40636
  for (; this.backboneContext && !Re(this.backboneContext?.path, e.path); ) this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
40637
- let t = or(e);
40637
+ let t = sr(e);
40638
40638
  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: Re(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
40639
40639
  }
40640
40640
  enterSlice(e, t) {
40641
- io(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
40641
+ so(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
40642
40642
  if (n.type !== "value" && n.type !== "pattern" && n.type !== "type") throw new Error(`Unsupported slicing discriminator type: ${n.type}`);
40643
40643
  return { path: n.path, type: n.type };
40644
40644
  }), slices: [], ordered: e.slicing?.ordered ?? false, rule: e.slicing?.rules }, this.slicingContext = { field: t.slicing, path: e.path ?? "" });
@@ -40674,48 +40674,48 @@ var ir = class {
40674
40674
  parseElementDefinitionType(e) {
40675
40675
  return (e.type ?? []).map((t) => {
40676
40676
  let n;
40677
- return (t.code === "BackboneElement" || t.code === "Element") && (n = or(e)), n || (n = X(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
40677
+ return (t.code === "BackboneElement" || t.code === "Element") && (n = sr(e)), n || (n = X(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
40678
40678
  });
40679
40679
  }
40680
40680
  parseElementDefinition(e) {
40681
- let t = hn(e.max), n = e.base?.max ? hn(e.base.max) : t, i = { type: "ElementDefinition", value: e };
40682
- 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: yn(P(i, "fixed[x]")), pattern: yn(P(i, "pattern[x]")), binding: e.binding };
40681
+ let t = yn(e.max), n = e.base?.max ? yn(e.base.max) : t, i = { type: "ElementDefinition", value: e };
40682
+ 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: gn(P(i, "fixed[x]")), pattern: gn(P(i, "pattern[x]")), binding: e.binding };
40683
40683
  }
40684
40684
  };
40685
- function hn(r7) {
40685
+ function yn(r7) {
40686
40686
  return r7 === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(r7, 10);
40687
40687
  }
40688
- function nr(r7, e = "") {
40689
- return no(r7.path, e);
40688
+ function ir(r7, e = "") {
40689
+ return oo(r7.path, e);
40690
40690
  }
40691
- function no(r7, e) {
40691
+ function oo(r7, e) {
40692
40692
  return r7 ? e && r7.startsWith(e) ? r7.substring(e.length + 1) : r7 : "";
40693
40693
  }
40694
40694
  function Re(r7, e) {
40695
40695
  return !r7 || !e ? false : e.startsWith(r7 + ".") || e === r7;
40696
40696
  }
40697
- function yn(r7) {
40697
+ function gn(r7) {
40698
40698
  return Array.isArray(r7) && r7.length > 0 ? r7[0] : S(r7) ? void 0 : r7;
40699
40699
  }
40700
- function io(r7) {
40700
+ function so(r7) {
40701
40701
  let e = r7.slicing?.discriminator;
40702
40702
  return !!(r7.type?.some((t) => t.code === "Extension") && e?.length === 1 && e[0].type === "value" && e[0].path === "url");
40703
40703
  }
40704
- function oo(r7) {
40704
+ function ao(r7) {
40705
40705
  let e = r7.description;
40706
40706
  return e?.startsWith(`Base StructureDefinition for ${r7.name} Type: `) && (e = e.substring(`Base StructureDefinition for ${r7.name} Type: `.length)), e;
40707
40707
  }
40708
- var nt = { base64Binary: /^([A-Za-z\d+/]{4})*([A-Za-z\d+/]{2}==|[A-Za-z\d+/]{3}=)?$/, canonical: /^\S*$/, code: /^[^\s]+( [^\s]+)*$/, date: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1]))?)?$/, dateTime: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1])(T([01]\d|2[0-3])(:[0-5]\d:([0-5]\d|60)(\.\d{1,9})?)?)?)?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00)?)?)?$/, id: /^[A-Za-z0-9\-.]{1,64}$/, instant: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1])T([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00))$/, markdown: /^[\s\S]+$/, oid: /^urn:oid:[0-2](\.(0|[1-9]\d*))+$/, string: /^[\s\S]+$/, time: /^([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?$/, uri: /^\S*$/, url: /^\S*$/, uuid: /^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/, xhtml: /.*/ };
40708
+ var ot = { base64Binary: /^([A-Za-z\d+/]{4})*([A-Za-z\d+/]{2}==|[A-Za-z\d+/]{3}=)?$/, canonical: /^\S*$/, code: /^[^\s]+( [^\s]+)*$/, date: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1]))?)?$/, dateTime: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1])(T([01]\d|2[0-3])(:[0-5]\d:([0-5]\d|60)(\.\d{1,9})?)?)?)?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00)?)?)?$/, id: /^[A-Za-z0-9\-.]{1,64}$/, instant: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1])T([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00))$/, markdown: /^[\s\S]+$/, oid: /^urn:oid:[0-2](\.(0|[1-9]\d*))+$/, string: /^[\s\S]+$/, time: /^([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?$/, uri: /^\S*$/, url: /^\S*$/, uuid: /^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/, xhtml: /.*/ };
40709
40709
  function f(r7) {
40710
40710
  return [{ type: l.boolean, value: r7 }];
40711
40711
  }
40712
40712
  function g(r7) {
40713
- 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 } : I(r7) ? { type: r7.resourceType, value: r7 } : Tr(r7) ? { type: l.CodeableConcept, value: r7 } : xr(r7) ? { type: l.Coding, value: r7 } : { type: l.BackboneElement, value: r7 };
40713
+ 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 } : I(r7) ? { type: r7.resourceType, value: r7 } : Sr(r7) ? { type: l.CodeableConcept, value: r7 } : Tr(r7) ? { type: l.Coding, value: r7 } : { type: l.BackboneElement, value: r7 };
40714
40714
  }
40715
40715
  function N(r7) {
40716
40716
  return r7.length === 0 ? false : !!r7[0].value;
40717
40717
  }
40718
- function j(r7, e) {
40718
+ function W(r7, e) {
40719
40719
  if (r7.length !== 0) {
40720
40720
  if (r7.length === 1 && (!e || r7[0].type === e)) return r7[0];
40721
40721
  throw new Error(`Expected singleton of type ${e}, but found ${JSON.stringify(r7)}`);
@@ -40723,15 +40723,15 @@ function j(r7, e) {
40723
40723
  }
40724
40724
  function P(r7, e, t) {
40725
40725
  if (!r7.value) return;
40726
- let n = st(r7.type, e, t?.profileUrl);
40727
- return n ? go(r7, e, n) : vo(r7, e);
40726
+ let n = ct(r7.type, e, t?.profileUrl);
40727
+ return n ? vo(r7, e, n) : To(r7, e);
40728
40728
  }
40729
- function go(r7, e, t) {
40729
+ function vo(r7, e, t) {
40730
40730
  let n = r7.value, i = t.type;
40731
40731
  if (!i || i.length === 0) return;
40732
40732
  let o, s = "undefined", a2, c = t.path.lastIndexOf("."), u2 = t.path.substring(c + 1);
40733
40733
  for (let p2 of i) {
40734
- let m2 = u2.replace("[x]", w(p2.code));
40734
+ let m2 = u2.replace("[x]", O(p2.code));
40735
40735
  if (o = n[m2], a2 = n["_" + m2], o !== void 0 || a2 !== void 0) {
40736
40736
  s = p2.code;
40737
40737
  break;
@@ -40739,14 +40739,14 @@ function go(r7, e, t) {
40739
40739
  }
40740
40740
  if (a2) if (Array.isArray(o)) {
40741
40741
  o = o.slice();
40742
- for (let p2 = 0; p2 < Math.max(o.length, a2.length); p2++) o[p2] = An(o[p2], a2[p2]);
40743
- } else o = An(o, a2);
40744
- if (!S(o)) return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o) ? o.map((p2) => Rn(p2, s)) : Rn(o, s);
40742
+ for (let p2 = 0; p2 < Math.max(o.length, a2.length); p2++) o[p2] = On(o[p2], a2[p2]);
40743
+ } else o = On(o, a2);
40744
+ if (!S(o)) return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o) ? o.map((p2) => Cn(p2, s)) : Cn(o, s);
40745
40745
  }
40746
- function Rn(r7, e) {
40746
+ function Cn(r7, e) {
40747
40747
  return e === "Resource" && I(r7) && (e = r7.resourceType), { type: e, value: r7 };
40748
40748
  }
40749
- function vo(r7, e) {
40749
+ function To(r7, e) {
40750
40750
  let t = r7.value;
40751
40751
  if (!t || typeof t != "object") return;
40752
40752
  let n;
@@ -40756,7 +40756,7 @@ function vo(r7, e) {
40756
40756
  } else {
40757
40757
  let i = e.endsWith("[x]") ? e.substring(0, e.length - 3) : e;
40758
40758
  for (let o of Object.values(l)) {
40759
- let s = i + w(o);
40759
+ let s = i + O(o);
40760
40760
  if (s in t) {
40761
40761
  let a2 = t[s];
40762
40762
  Array.isArray(a2) ? n = a2.map((c) => ({ type: o, value: c })) : n = { type: o, value: a2 };
@@ -40769,11 +40769,11 @@ function vo(r7, e) {
40769
40769
  } else if (S(n)) return;
40770
40770
  return n;
40771
40771
  }
40772
- function it(r7) {
40772
+ function st(r7) {
40773
40773
  let e = [];
40774
40774
  for (let t of r7) {
40775
40775
  let n = false;
40776
- for (let i of e) if (N(yr(t, i))) {
40776
+ for (let i of e) if (N(gr(t, i))) {
40777
40777
  n = true;
40778
40778
  break;
40779
40779
  }
@@ -40781,31 +40781,31 @@ function it(r7) {
40781
40781
  }
40782
40782
  return e;
40783
40783
  }
40784
- function On(r7) {
40784
+ function In(r7) {
40785
40785
  return f(!N(r7));
40786
40786
  }
40787
- function In(r7, e) {
40788
- return r7.length === 0 || e.length === 0 ? [] : r7.length !== e.length ? f(false) : f(r7.every((t, n) => N(yr(t, e[n]))));
40789
- }
40790
40787
  function kn(r7, e) {
40791
- return r7.length === 0 || e.length === 0 ? [] : r7.length !== e.length ? f(true) : f(r7.some((t, n) => !N(yr(t, e[n]))));
40788
+ return r7.length === 0 || e.length === 0 ? [] : r7.length !== e.length ? f(false) : f(r7.every((t, n) => N(gr(t, e[n]))));
40792
40789
  }
40793
- function yr(r7, e) {
40794
- let t = r7.value?.valueOf(), n = e.value?.valueOf();
40795
- return typeof t == "number" && typeof n == "number" ? f(Math.abs(t - n) < 1e-8) : k(t) && k(n) ? f(Mn(t, n)) : f(typeof t == "object" && typeof n == "object" ? vr(r7, e) : t === n);
40790
+ function Vn(r7, e) {
40791
+ return r7.length === 0 || e.length === 0 ? [] : r7.length !== e.length ? f(true) : f(r7.some((t, n) => !N(gr(t, e[n]))));
40796
40792
  }
40797
40793
  function gr(r7, e) {
40798
- return r7.length === 0 && e.length === 0 ? f(true) : r7.length !== e.length ? f(false) : (r7.sort(Cn), e.sort(Cn), f(r7.every((t, n) => N(xo(t, e[n])))));
40794
+ let t = r7.value?.valueOf(), n = e.value?.valueOf();
40795
+ return typeof t == "number" && typeof n == "number" ? f(Math.abs(t - n) < 1e-8) : k(t) && k(n) ? f(_n(t, n)) : f(typeof t == "object" && typeof n == "object" ? vr(r7, e) : t === n);
40796
+ }
40797
+ function xr(r7, e) {
40798
+ return r7.length === 0 && e.length === 0 ? f(true) : r7.length !== e.length ? f(false) : (r7.sort(Pn), e.sort(Pn), f(r7.every((t, n) => N(So(t, e[n])))));
40799
40799
  }
40800
- function xo(r7, e) {
40800
+ function So(r7, e) {
40801
40801
  let { type: t, value: n } = r7, { type: i, value: o } = e, s = n?.valueOf(), a2 = o?.valueOf();
40802
- return typeof s == "number" && typeof a2 == "number" ? f(Math.abs(s - a2) < 0.01) : k(s) && k(a2) ? f(Mn(s, a2)) : f(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" ? vr({ ...s, id: void 0 }, { ...a2, id: void 0 }) : typeof s == "string" && typeof a2 == "string" ? s.toLowerCase() === a2.toLowerCase() : s === a2);
40802
+ return typeof s == "number" && typeof a2 == "number" ? f(Math.abs(s - a2) < 0.01) : k(s) && k(a2) ? f(_n(s, a2)) : f(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" ? vr({ ...s, id: void 0 }, { ...a2, id: void 0 }) : typeof s == "string" && typeof a2 == "string" ? s.toLowerCase() === a2.toLowerCase() : s === a2);
40803
40803
  }
40804
- function Cn(r7, e) {
40804
+ function Pn(r7, e) {
40805
40805
  let t = r7.value?.valueOf(), n = e.value?.valueOf();
40806
40806
  return typeof t == "number" && typeof n == "number" ? t - n : typeof t == "string" && typeof n == "string" ? t.localeCompare(n) : 0;
40807
40807
  }
40808
- function ot(r7, e) {
40808
+ function at(r7, e) {
40809
40809
  let { value: t } = r7;
40810
40810
  if (t == null) return false;
40811
40811
  switch (e) {
@@ -40815,32 +40815,32 @@ function ot(r7, e) {
40815
40815
  case "Integer":
40816
40816
  return typeof t == "number";
40817
40817
  case "Date":
40818
- return Vn(t);
40818
+ return Dn(t);
40819
40819
  case "DateTime":
40820
40820
  return Pe(t);
40821
40821
  case "Time":
40822
40822
  return typeof t == "string" && !!/^T\d/.exec(t);
40823
40823
  case "Period":
40824
- return Dn(t);
40824
+ return Mn(t);
40825
40825
  case "Quantity":
40826
40826
  return k(t);
40827
40827
  default:
40828
40828
  return typeof t == "object" && t?.resourceType === e;
40829
40829
  }
40830
40830
  }
40831
- function Vn(r7) {
40832
- return typeof r7 == "string" && !!nt.date.exec(r7);
40831
+ function Dn(r7) {
40832
+ return typeof r7 == "string" && !!ot.date.exec(r7);
40833
40833
  }
40834
40834
  function Pe(r7) {
40835
- return typeof r7 == "string" && !!nt.dateTime.exec(r7);
40835
+ return typeof r7 == "string" && !!ot.dateTime.exec(r7);
40836
40836
  }
40837
- function Dn(r7) {
40837
+ function Mn(r7) {
40838
40838
  return !!(r7 && typeof r7 == "object" && ("start" in r7 && Pe(r7.start) || "end" in r7 && Pe(r7.end)));
40839
40839
  }
40840
40840
  function k(r7) {
40841
40841
  return !!(r7 && typeof r7 == "object" && "value" in r7 && typeof r7.value == "number");
40842
40842
  }
40843
- function Mn(r7, e) {
40843
+ function _n(r7, e) {
40844
40844
  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);
40845
40845
  }
40846
40846
  function vr(r7, e) {
@@ -40848,67 +40848,67 @@ function vr(r7, e) {
40848
40848
  if (t.length !== n.length) return false;
40849
40849
  for (let i of t) {
40850
40850
  let o = r7[i], s = e[i];
40851
- if (wn(o) && wn(s)) {
40851
+ if (An(o) && An(s)) {
40852
40852
  if (!vr(o, s)) return false;
40853
40853
  } else if (o !== s) return false;
40854
40854
  }
40855
40855
  return true;
40856
40856
  }
40857
- function wn(r7) {
40857
+ function An(r7) {
40858
40858
  return r7 !== null && typeof r7 == "object";
40859
40859
  }
40860
- function An(r7, e) {
40860
+ function On(r7, e) {
40861
40861
  if (e) {
40862
40862
  if (typeof e != "object") throw new Error("Primitive extension must be an object");
40863
- return To(r7 ?? {}, e);
40863
+ return Eo(r7 ?? {}, e);
40864
40864
  }
40865
40865
  return r7;
40866
40866
  }
40867
- function To(r7, e) {
40867
+ function Eo(r7, e) {
40868
40868
  return delete e.__proto__, delete e.constructor, Object.assign(r7, e);
40869
40869
  }
40870
40870
  function te(r7) {
40871
- let e = le(r7), t = Eo(r7);
40871
+ let e = pe(r7), t = Ro(r7);
40872
40872
  return t === e ? { reference: e } : { reference: e, display: t };
40873
40873
  }
40874
- function le(r7) {
40875
- return ue(r7) ? r7.reference : `${r7.resourceType}/${r7.id}`;
40876
- }
40877
40874
  function pe(r7) {
40878
- if (r7) return ue(r7) ? r7.reference.split("/")[1] : r7.id;
40875
+ return le(r7) ? r7.reference : `${r7.resourceType}/${r7.id}`;
40876
+ }
40877
+ function de(r7) {
40878
+ if (r7) return le(r7) ? r7.reference.split("/")[1] : r7.id;
40879
40879
  }
40880
- function So(r7) {
40880
+ function bo(r7) {
40881
40881
  return r7.resourceType === "Patient" || r7.resourceType === "Practitioner" || r7.resourceType === "RelatedPerson";
40882
40882
  }
40883
- function Eo(r7) {
40884
- if (So(r7)) {
40885
- let e = bo(r7);
40883
+ function Ro(r7) {
40884
+ if (bo(r7)) {
40885
+ let e = Co(r7);
40886
40886
  if (e) return e;
40887
40887
  }
40888
40888
  if (r7.resourceType === "Device") {
40889
- let e = Ro(r7);
40889
+ let e = Po(r7);
40890
40890
  if (e) return e;
40891
40891
  }
40892
- if (r7.resourceType === "MedicationRequest" && r7.medicationCodeableConcept) return at(r7.medicationCodeableConcept);
40892
+ if (r7.resourceType === "MedicationRequest" && r7.medicationCodeableConcept) return Be(r7.medicationCodeableConcept);
40893
40893
  if (r7.resourceType === "Subscription" && r7.criteria) return r7.criteria;
40894
40894
  if (r7.resourceType === "User" && r7.email) return r7.email;
40895
40895
  if ("name" in r7 && r7.name && typeof r7.name == "string") return r7.name;
40896
40896
  if ("code" in r7 && r7.code) {
40897
40897
  let e = r7.code;
40898
- if (Array.isArray(e) && (e = e[0]), Tr(e)) return at(e);
40899
- if (Do(e)) return e.text;
40898
+ if (Array.isArray(e) && (e = e[0]), Sr(e)) return Be(e);
40899
+ if (_o(e)) return e.text;
40900
40900
  }
40901
- return le(r7);
40901
+ return pe(r7);
40902
40902
  }
40903
- function bo(r7) {
40903
+ function Co(r7) {
40904
40904
  let e = r7.name;
40905
- if (e && e.length > 0) return lt(e[0]);
40905
+ if (e && e.length > 0) return qe(e[0]);
40906
40906
  }
40907
- function Ro(r7) {
40907
+ function Po(r7) {
40908
40908
  let e = r7.deviceName;
40909
40909
  if (e && e.length > 0) return e[0].name;
40910
40910
  }
40911
- function ct(r7, e) {
40911
+ function ut(r7, e) {
40912
40912
  let t = new Date(r7);
40913
40913
  t.setUTCHours(0, 0, 0, 0);
40914
40914
  let n = e ? new Date(e) : /* @__PURE__ */ new Date();
@@ -40917,21 +40917,21 @@ function ct(r7, e) {
40917
40917
  (c < o || c === o && u2 < s) && p2--;
40918
40918
  let m2 = a2 * 12 + c - (i * 12 + o);
40919
40919
  u2 < s && m2--;
40920
- let v = Math.floor((n.getTime() - t.getTime()) / (1e3 * 60 * 60 * 24));
40921
- return { years: p2, months: m2, days: v };
40920
+ let x2 = Math.floor((n.getTime() - t.getTime()) / (1e3 * 60 * 60 * 24));
40921
+ return { years: p2, months: m2, days: x2 };
40922
40922
  }
40923
40923
  function X(r7, ...e) {
40924
40924
  let t = r7;
40925
40925
  for (let n = 0; n < e.length && t; n++) t = t?.extension?.find((i) => i.url === e[n]);
40926
40926
  return t;
40927
40927
  }
40928
- function Fn(r7, e) {
40929
- return JSON.stringify(r7, Po, e ? 2 : void 0);
40928
+ function lt(r7, e) {
40929
+ return JSON.stringify(r7, Ao, e ? 2 : void 0) ?? "";
40930
40930
  }
40931
- function Po(r7, e) {
40932
- return !wo(r7) && S(e) ? void 0 : e;
40931
+ function Ao(r7, e) {
40932
+ return !Oo(r7) && S(e) ? void 0 : e;
40933
40933
  }
40934
- function wo(r7) {
40934
+ function Oo(r7) {
40935
40935
  return !!/\d+$/.exec(r7);
40936
40936
  }
40937
40937
  function S(r7) {
@@ -40945,14 +40945,14 @@ function K(r7) {
40945
40945
  return e === "string" && r7 !== "" || e === "object" && ("length" in r7 && r7.length > 0 || Object.keys(r7).length > 0);
40946
40946
  }
40947
40947
  function ee(r7, e, t) {
40948
- return r7 === e || S(r7) && S(e) ? true : S(r7) || S(e) ? false : Array.isArray(r7) && Array.isArray(e) ? Ao(r7, e) : Array.isArray(r7) || Array.isArray(e) ? false : R(r7) && R(e) ? Oo(r7, e, t) : (R(r7) || R(e), false);
40948
+ return r7 === e || S(r7) && S(e) ? true : S(r7) || S(e) ? false : Array.isArray(r7) && Array.isArray(e) ? Io(r7, e) : Array.isArray(r7) || Array.isArray(e) ? false : R(r7) && R(e) ? ko(r7, e, t) : (R(r7) || R(e), false);
40949
40949
  }
40950
- function Ao(r7, e) {
40950
+ function Io(r7, e) {
40951
40951
  if (r7.length !== e.length) return false;
40952
40952
  for (let t = 0; t < r7.length; t++) if (!ee(r7[t], e[t])) return false;
40953
40953
  return true;
40954
40954
  }
40955
- function Oo(r7, e, t) {
40955
+ function ko(r7, e, t) {
40956
40956
  let n = /* @__PURE__ */ new Set();
40957
40957
  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"));
40958
40958
  for (let i of n) {
@@ -40965,52 +40965,52 @@ function R(r7) {
40965
40965
  return r7 !== null && typeof r7 == "object";
40966
40966
  }
40967
40967
  function Un(r7) {
40968
- return r7.every(Vo);
40968
+ return r7.every(Mo);
40969
40969
  }
40970
- function Vo(r7) {
40970
+ function Mo(r7) {
40971
40971
  return typeof r7 == "string";
40972
40972
  }
40973
- function xr(r7) {
40973
+ function Tr(r7) {
40974
40974
  return R(r7) && "code" in r7 && typeof r7.code == "string";
40975
40975
  }
40976
- function Tr(r7) {
40977
- return R(r7) && "coding" in r7 && Array.isArray(r7.coding) && r7.coding.every(xr);
40976
+ function Sr(r7) {
40977
+ return R(r7) && "coding" in r7 && Array.isArray(r7.coding) && r7.coding.every(Tr);
40978
40978
  }
40979
- function Do(r7) {
40979
+ function _o(r7) {
40980
40980
  return R(r7) && "text" in r7 && typeof r7.text == "string";
40981
40981
  }
40982
40982
  var Bn = [];
40983
40983
  for (let r7 = 0; r7 < 256; r7++) Bn.push(r7.toString(16).padStart(2, "0"));
40984
40984
  function qn(r7) {
40985
- let e = $n(r7), t = new Uint8Array(e), n = new Array(t.length);
40985
+ let e = jn(r7), t = new Uint8Array(e), n = new Array(t.length);
40986
40986
  for (let i = 0; i < t.length; i++) n[i] = Bn[t[i]];
40987
40987
  return n.join("");
40988
40988
  }
40989
- function jn(r7) {
40990
- let e = $n(r7), t = new Uint8Array(e), n = new Array(t.length);
40989
+ function Wn(r7) {
40990
+ let e = jn(r7), t = new Uint8Array(e), n = new Array(t.length);
40991
40991
  for (let i = 0; i < t.length; i++) n[i] = String.fromCharCode(t[i]);
40992
40992
  return window.btoa(n.join(""));
40993
40993
  }
40994
- function $n(r7) {
40994
+ function jn(r7) {
40995
40995
  return ArrayBuffer.isView(r7) ? r7.buffer : r7;
40996
40996
  }
40997
- function w(r7) {
40997
+ function O(r7) {
40998
40998
  return r7 ? r7.charAt(0).toUpperCase() + r7.substring(1) : "";
40999
40999
  }
41000
- var br = (r7) => new Promise((e) => {
41000
+ var Rr = (r7) => new Promise((e) => {
41001
41001
  setTimeout(e, r7);
41002
41002
  });
41003
- function ut(r7) {
41003
+ function pt(r7) {
41004
41004
  return r7.sort((e, t) => e.localeCompare(t));
41005
41005
  }
41006
- function Cr(r7) {
41006
+ function Pr(r7) {
41007
41007
  return r7.endsWith("/") ? r7 : r7 + "/";
41008
41008
  }
41009
- function Uo(r7) {
41009
+ function qo(r7) {
41010
41010
  return r7.startsWith("/") ? r7.slice(1) : r7;
41011
41011
  }
41012
41012
  function B(r7, e) {
41013
- return new URL(Uo(e), Cr(r7.toString())).toString();
41013
+ return new URL(qo(e), Pr(r7.toString())).toString();
41014
41014
  }
41015
41015
  function Qn(r7, e) {
41016
41016
  return B(r7, e).toString().replace("http://", "ws://").replace("https://", "wss://");
@@ -41018,11 +41018,11 @@ function Qn(r7, e) {
41018
41018
  function Kn(r7) {
41019
41019
  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();
41020
41020
  }
41021
- var Bo = /^(([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])$/;
41022
- function nl(r7) {
41023
- return Bo.test(r7);
41021
+ var Wo = /^(([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])$/;
41022
+ function cl(r7) {
41023
+ return Wo.test(r7);
41024
41024
  }
41025
- function lt(r7, e) {
41025
+ function qe(r7, e) {
41026
41026
  let t = [];
41027
41027
  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) {
41028
41028
  let n = me(r7.text);
@@ -41030,12 +41030,12 @@ function lt(r7, e) {
41030
41030
  }
41031
41031
  return t.join(" ").trim();
41032
41032
  }
41033
- function at(r7) {
41033
+ function Be(r7) {
41034
41034
  if (!r7) return "";
41035
41035
  let e = me(r7.text);
41036
- return e || (r7.coding ? r7.coding.map((t) => Ho(t)).join(", ") : "");
41036
+ return e || (r7.coding ? r7.coding.map((t) => Jn(t)).join(", ") : "");
41037
41037
  }
41038
- function Ho(r7, e) {
41038
+ function Jn(r7, e) {
41039
41039
  let t = me(r7?.display);
41040
41040
  if (t) {
41041
41041
  let n = e ? me(r7?.code) : void 0;
@@ -41047,28 +41047,28 @@ function me(r7) {
41047
41047
  return typeof r7 == "string" ? r7 : void 0;
41048
41048
  }
41049
41049
  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" };
41050
- function Zn(r7) {
41050
+ function Xn(r7) {
41051
41051
  let e = L.types[r7];
41052
41052
  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;
41053
41053
  }
41054
- function Ar(r7) {
41054
+ function Or(r7) {
41055
41055
  for (let e of r7.base ?? []) {
41056
- let t = Zn(e);
41056
+ let t = Xn(e);
41057
41057
  t.searchParams || (t.searchParams = {}), t.searchParams[r7.code] = r7;
41058
41058
  }
41059
41059
  }
41060
- function or(r7) {
41060
+ function sr(r7) {
41061
41061
  let e = r7.type?.[0]?.code;
41062
- return e === "BackboneElement" || e === "Element" ? Jo((r7.base?.path ?? r7.path)?.split(".")) : e;
41062
+ return e === "BackboneElement" || e === "Element" ? Xo((r7.base?.path ?? r7.path)?.split(".")) : e;
41063
41063
  }
41064
- function Jo(r7) {
41065
- return r7.length === 1 ? r7[0] : r7.map(w).join("");
41064
+ function Xo(r7) {
41065
+ return r7.length === 1 ? r7[0] : r7.map(O).join("");
41066
41066
  }
41067
- function st(r7, e, t) {
41067
+ function ct(r7, e, t) {
41068
41068
  let n = Le(r7, t);
41069
- if (n) return es(n.elements, e);
41069
+ if (n) return ns(n.elements, e);
41070
41070
  }
41071
- function es(r7, e) {
41071
+ function ns(r7, e) {
41072
41072
  let t = r7[e] ?? r7[e + "[x]"];
41073
41073
  if (t) return t;
41074
41074
  for (let n = 0; n < e.length; n++) {
@@ -41082,7 +41082,7 @@ function es(r7, e) {
41082
41082
  function I(r7) {
41083
41083
  return !!(r7 && typeof r7 == "object" && "resourceType" in r7);
41084
41084
  }
41085
- function ue(r7) {
41085
+ function le(r7) {
41086
41086
  return !!(r7 && typeof r7 == "object" && "reference" in r7 && typeof r7.reference == "string");
41087
41087
  }
41088
41088
  var L = { types: {} };
@@ -41096,7 +41096,7 @@ function Oe(r7) {
41096
41096
  }
41097
41097
  }
41098
41098
  var z = () => [];
41099
- var O = { empty: (r7, e) => f(e.length === 0 || e.every((t) => S(t.value))), hasValue: (r7, e) => f(e.length !== 0), exists: (r7, e, t) => t ? f(e.filter((n) => N(t.eval(r7, [n]))).length > 0) : f(e.length > 0 && e.every((n) => !S(n.value))), all: (r7, e, t) => f(e.every((n) => N(t.eval(r7, [n])))), allTrue: (r7, e) => {
41099
+ var A = { empty: (r7, e) => f(e.length === 0 || e.every((t) => S(t.value))), hasValue: (r7, e) => f(e.length !== 0), exists: (r7, e, t) => t ? f(e.filter((n) => N(t.eval(r7, [n]))).length > 0) : f(e.length > 0 && e.every((n) => !S(n.value))), all: (r7, e, t) => f(e.every((n) => N(t.eval(r7, [n])))), allTrue: (r7, e) => {
41100
41100
  for (let t of e) if (!t.value) return f(false);
41101
41101
  return f(true);
41102
41102
  }, anyTrue: (r7, e) => {
@@ -41119,7 +41119,7 @@ var O = { empty: (r7, e) => f(e.length === 0 || e.every((t) => S(t.value))), has
41119
41119
  let t = [];
41120
41120
  for (let n of e) t.some((i) => i.value === n.value) || t.push(n);
41121
41121
  return t;
41122
- }, isDistinct: (r7, e) => f(e.length === O.distinct(r7, e).length), where: (r7, e, t) => e.filter((n) => N(t.eval(r7, [n]))), select: (r7, e, t) => e.map((n) => t.eval({ parent: r7, variables: { $this: n } }, [n])).flat(), repeat: z, ofType: (r7, e, t) => e.filter((n) => n.type === t.name), single: (r7, e) => {
41122
+ }, isDistinct: (r7, e) => f(e.length === A.distinct(r7, e).length), where: (r7, e, t) => e.filter((n) => N(t.eval(r7, [n]))), select: (r7, e, t) => e.map((n) => t.eval({ parent: r7, variables: { $this: n } }, [n])).flat(), repeat: z, ofType: (r7, e, t) => e.filter((n) => n.type === t.name), single: (r7, e) => {
41123
41123
  if (e.length > 1) throw new Error("Expected input length one for single()");
41124
41124
  return e.length === 0 ? [] : e.slice(0, 1);
41125
41125
  }, first: (r7, e) => e.length === 0 ? [] : e.slice(0, 1), last: (r7, e) => e.length === 0 ? [] : e.slice(e.length - 1, e.length), tail: (r7, e) => e.length === 0 ? [] : e.slice(1, e.length), skip: (r7, e, t) => {
@@ -41143,7 +41143,7 @@ var O = { empty: (r7, e) => f(e.length === 0 || e.every((t) => S(t.value))), has
41143
41143
  }, union: (r7, e, t) => {
41144
41144
  if (!t) return e;
41145
41145
  let n = t.eval(r7, he(r7));
41146
- return it([...e, ...n]);
41146
+ return st([...e, ...n]);
41147
41147
  }, combine: (r7, e, t) => {
41148
41148
  if (!t) return e;
41149
41149
  let n = t.eval(r7, he(r7));
@@ -41163,31 +41163,31 @@ var O = { empty: (r7, e) => f(e.length === 0 || e.every((t) => S(t.value))), has
41163
41163
  if (["false", "f", "no", "n", "0", "0.0"].includes(n)) return f(false);
41164
41164
  }
41165
41165
  return [];
41166
- }, convertsToBoolean: (r7, e) => e.length === 0 ? [] : f(O.toBoolean(r7, e).length === 1), toInteger: (r7, e) => {
41166
+ }, convertsToBoolean: (r7, e) => e.length === 0 ? [] : f(A.toBoolean(r7, e).length === 1), toInteger: (r7, e) => {
41167
41167
  if (e.length === 0) return [];
41168
41168
  let [{ value: t }] = G(e, 1);
41169
41169
  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 }] : [];
41170
- }, convertsToInteger: (r7, e) => e.length === 0 ? [] : f(O.toInteger(r7, e).length === 1), toDate: (r7, e) => {
41170
+ }, convertsToInteger: (r7, e) => e.length === 0 ? [] : f(A.toInteger(r7, e).length === 1), toDate: (r7, e) => {
41171
41171
  if (e.length === 0) return [];
41172
41172
  let [{ value: t }] = G(e, 1);
41173
41173
  return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.date, value: Oe(t) }] : [];
41174
- }, convertsToDate: (r7, e) => e.length === 0 ? [] : f(O.toDate(r7, e).length === 1), toDateTime: (r7, e) => {
41174
+ }, convertsToDate: (r7, e) => e.length === 0 ? [] : f(A.toDate(r7, e).length === 1), toDateTime: (r7, e) => {
41175
41175
  if (e.length === 0) return [];
41176
41176
  let [{ value: t }] = G(e, 1);
41177
41177
  return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.dateTime, value: Oe(t) }] : [];
41178
- }, convertsToDateTime: (r7, e) => e.length === 0 ? [] : f(O.toDateTime(r7, e).length === 1), toDecimal: (r7, e) => {
41178
+ }, convertsToDateTime: (r7, e) => e.length === 0 ? [] : f(A.toDateTime(r7, e).length === 1), toDecimal: (r7, e) => {
41179
41179
  if (e.length === 0) return [];
41180
41180
  let [{ value: t }] = G(e, 1);
41181
41181
  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 }] : [];
41182
- }, convertsToDecimal: (r7, e) => e.length === 0 ? [] : f(O.toDecimal(r7, e).length === 1), toQuantity: (r7, e) => {
41182
+ }, convertsToDecimal: (r7, e) => e.length === 0 ? [] : f(A.toDecimal(r7, e).length === 1), toQuantity: (r7, e) => {
41183
41183
  if (e.length === 0) return [];
41184
41184
  let [{ value: t }] = G(e, 1);
41185
41185
  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" } }] : [];
41186
- }, convertsToQuantity: (r7, e) => e.length === 0 ? [] : f(O.toQuantity(r7, e).length === 1), toString: (r7, e) => {
41186
+ }, convertsToQuantity: (r7, e) => e.length === 0 ? [] : f(A.toQuantity(r7, e).length === 1), toString: (r7, e) => {
41187
41187
  if (e.length === 0) return [];
41188
41188
  let [{ value: t }] = G(e, 1);
41189
41189
  return t == null ? [] : k(t) ? [{ type: l.string, value: `${t.value} '${t.unit}'` }] : [{ type: l.string, value: t.toString() }];
41190
- }, convertsToString: (r7, e) => e.length === 0 ? [] : f(O.toString(r7, e).length === 1), toTime: (r7, e) => {
41190
+ }, convertsToString: (r7, e) => e.length === 0 ? [] : f(A.toString(r7, e).length === 1), toTime: (r7, e) => {
41191
41191
  if (e.length === 0) return [];
41192
41192
  let [{ value: t }] = G(e, 1);
41193
41193
  if (typeof t == "string") {
@@ -41195,26 +41195,26 @@ var O = { empty: (r7, e) => f(e.length === 0 || e.every((t) => S(t.value))), has
41195
41195
  if (n) return [{ type: l.time, value: Oe("T" + n[1]) }];
41196
41196
  }
41197
41197
  return [];
41198
- }, convertsToTime: (r7, e) => e.length === 0 ? [] : f(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) => {
41198
+ }, convertsToTime: (r7, e) => e.length === 0 ? [] : f(A.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) => {
41199
41199
  let a2 = o, c = s ? a2 + s : i.length;
41200
41200
  return a2 < 0 || a2 >= i.length ? void 0 : i.substring(a2, c);
41201
41201
  }, 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: z, decode: z, escape: z, unescape: z, trim: z, split: z, join: (r7, e, t) => {
41202
41202
  let n = t?.eval(r7, he(r7))[0]?.value ?? "";
41203
41203
  if (typeof n != "string") throw new Error("Separator must be a string.");
41204
41204
  return [{ type: l.string, value: e.map((i) => i.value?.toString() ?? "").join(n) }];
41205
- }, abs: (r7, e) => W(Math.abs, r7, e), ceiling: (r7, e) => W(Math.ceil, r7, e), exp: (r7, e) => W(Math.exp, r7, e), floor: (r7, e) => W(Math.floor, r7, e), ln: (r7, e) => W(Math.log, r7, e), log: (r7, e, t) => W((n, i) => Math.log(n) / Math.log(i), r7, e, t), power: (r7, e, t) => W(Math.pow, r7, e, t), round: (r7, e) => W(Math.round, r7, e), sqrt: (r7, e) => W(Math.sqrt, r7, e), truncate: (r7, e) => W((t) => t | 0, r7, e), children: z, descendants: z, 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) => {
41206
- let o = O.toDateTime(r7, t.eval(r7, e));
41205
+ }, abs: (r7, e) => $(Math.abs, r7, e), ceiling: (r7, e) => $(Math.ceil, r7, e), exp: (r7, e) => $(Math.exp, r7, e), floor: (r7, e) => $(Math.floor, r7, e), ln: (r7, e) => $(Math.log, r7, e), log: (r7, e, t) => $((n, i) => Math.log(n) / Math.log(i), r7, e, t), power: (r7, e, t) => $(Math.pow, r7, e, t), round: (r7, e) => $(Math.round, r7, e), sqrt: (r7, e) => $(Math.sqrt, r7, e), truncate: (r7, e) => $((t) => t | 0, r7, e), children: z, descendants: z, 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) => {
41206
+ let o = A.toDateTime(r7, t.eval(r7, e));
41207
41207
  if (o.length === 0) throw new Error("Invalid start date");
41208
- let s = O.toDateTime(r7, n.eval(r7, e));
41208
+ let s = A.toDateTime(r7, n.eval(r7, e));
41209
41209
  if (s.length === 0) throw new Error("Invalid end date");
41210
41210
  let a2 = i.eval(r7, e)[0]?.value;
41211
41211
  if (a2 !== "years" && a2 !== "months" && a2 !== "days") throw new Error("Invalid units");
41212
- let c = ct(o[0].value, s[0].value);
41212
+ let c = ut(o[0].value, s[0].value);
41213
41213
  return [{ type: l.Quantity, value: { value: c[a2], unit: a2 } }];
41214
41214
  }, is: (r7, e, t) => {
41215
41215
  let n = "";
41216
- return t instanceof q ? n = t.name : t instanceof re && (n = t.left.name + "." + t.right.name), n ? e.map((i) => ({ type: l.boolean, value: ot(i, n) })) : [];
41217
- }, not: (r7, e) => O.toBoolean(r7, e).map((t) => ({ type: l.boolean, value: !t.value })), resolve: (r7, e) => e.map((t) => {
41216
+ return t instanceof q ? n = t.name : t instanceof ne && (n = t.left.name + "." + t.right.name), n ? e.map((i) => ({ type: l.boolean, value: at(i, n) })) : [];
41217
+ }, not: (r7, e) => A.toBoolean(r7, e).map((t) => ({ type: l.boolean, value: !t.value })), resolve: (r7, e) => e.map((t) => {
41218
41218
  let n = t.value, i;
41219
41219
  if (typeof n == "string") i = n;
41220
41220
  else if (typeof n == "object") {
@@ -41243,7 +41243,7 @@ var O = { empty: (r7, e) => f(e.length === 0 || e.every((t) => S(t.value))), has
41243
41243
  let n = e[0].value;
41244
41244
  if (!n?.reference) return [];
41245
41245
  let i = "";
41246
- return t instanceof q && (i = t.name), i && !n.reference.startsWith(i + "/") ? [] : [{ type: l.id, value: pe(n) }];
41246
+ return t instanceof q && (i = t.name), i && !n.reference.startsWith(i + "/") ? [] : [{ type: l.id, value: de(n) }];
41247
41247
  }, extension: (r7, e, t) => {
41248
41248
  let n = t.eval(r7, e)[0].value, i = e?.[0]?.value;
41249
41249
  if (i) {
@@ -41259,7 +41259,7 @@ function F(r7, e, t, ...n) {
41259
41259
  let o = r7(i, ...n.map((s) => s?.eval(e, t)[0]?.value));
41260
41260
  return o === void 0 ? [] : Array.isArray(o) ? o.map(g) : [g(o)];
41261
41261
  }
41262
- function W(r7, e, t, ...n) {
41262
+ function $(r7, e, t, ...n) {
41263
41263
  if (t.length === 0) return [];
41264
41264
  let [{ value: i }] = G(t, 1), o = k(i), s = o ? i.value : i;
41265
41265
  if (typeof s != "number") throw new Error("Math function cannot be called with non-number");
@@ -41312,7 +41312,7 @@ var q = class {
41312
41312
  return this.name;
41313
41313
  }
41314
41314
  };
41315
- var dt = class {
41315
+ var ft = class {
41316
41316
  eval() {
41317
41317
  return [];
41318
41318
  }
@@ -41320,7 +41320,7 @@ var dt = class {
41320
41320
  return "{}";
41321
41321
  }
41322
41322
  };
41323
- var ft = class extends ze {
41323
+ var mt = class extends Ye {
41324
41324
  constructor(t, n, i) {
41325
41325
  super(t, n);
41326
41326
  this.impl = i;
@@ -41337,7 +41337,7 @@ var ye = class extends Y {
41337
41337
  super("as", e, t);
41338
41338
  }
41339
41339
  eval(e, t) {
41340
- return O.ofType(e, this.left.eval(e, t), this.right);
41340
+ return A.ofType(e, this.left.eval(e, t), this.right);
41341
41341
  }
41342
41342
  };
41343
41343
  var C = class extends Y {
@@ -41356,7 +41356,7 @@ var V = class extends C {
41356
41356
  return typeof p2 == "boolean" ? f(p2) : k(s) ? [{ type: l.Quantity, value: { ...s, value: p2 } }] : [g(p2)];
41357
41357
  }
41358
41358
  };
41359
- var mt = class extends Y {
41359
+ var ht = class extends Y {
41360
41360
  constructor(e, t) {
41361
41361
  super("&", e, t);
41362
41362
  }
@@ -41365,7 +41365,7 @@ var mt = class extends Y {
41365
41365
  return o.length > 0 && o.every((s) => typeof s.value == "string") ? [{ type: l.string, value: o.map((s) => s.value).join("") }] : o;
41366
41366
  }
41367
41367
  };
41368
- var ht = class extends C {
41368
+ var yt = class extends C {
41369
41369
  constructor(e, t) {
41370
41370
  super("contains", e, t);
41371
41371
  }
@@ -41374,16 +41374,16 @@ var ht = class extends C {
41374
41374
  return f(n.some((o) => o.value === i[0].value));
41375
41375
  }
41376
41376
  };
41377
- var yt = class extends C {
41377
+ var gt = class extends C {
41378
41378
  constructor(e, t) {
41379
41379
  super("in", e, t);
41380
41380
  }
41381
41381
  eval(e, t) {
41382
- let n = j(this.left.eval(e, t)), i = this.right.eval(e, t);
41382
+ let n = W(this.left.eval(e, t)), i = this.right.eval(e, t);
41383
41383
  return n ? f(i.some((o) => o.value === n.value)) : [];
41384
41384
  }
41385
41385
  };
41386
- var re = class extends Y {
41386
+ var ne = class extends Y {
41387
41387
  constructor(e, t) {
41388
41388
  super(".", e, t);
41389
41389
  }
@@ -41400,16 +41400,16 @@ var Ie = class extends Y {
41400
41400
  }
41401
41401
  eval(e, t) {
41402
41402
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
41403
- return it([...n, ...i]);
41403
+ return st([...n, ...i]);
41404
41404
  }
41405
41405
  };
41406
- var gt = class extends C {
41406
+ var xt = class extends C {
41407
41407
  constructor(e, t) {
41408
41408
  super("=", e, t);
41409
41409
  }
41410
41410
  eval(e, t) {
41411
41411
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
41412
- return In(n, i);
41412
+ return kn(n, i);
41413
41413
  }
41414
41414
  };
41415
41415
  var vt = class extends C {
@@ -41418,25 +41418,25 @@ var vt = class extends C {
41418
41418
  }
41419
41419
  eval(e, t) {
41420
41420
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
41421
- return kn(n, i);
41421
+ return Vn(n, i);
41422
41422
  }
41423
41423
  };
41424
- var xt = class extends C {
41424
+ var Tt = class extends C {
41425
41425
  constructor(e, t) {
41426
41426
  super("~", e, t);
41427
41427
  }
41428
41428
  eval(e, t) {
41429
41429
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
41430
- return gr(n, i);
41430
+ return xr(n, i);
41431
41431
  }
41432
41432
  };
41433
- var Tt = class extends C {
41433
+ var St = class extends C {
41434
41434
  constructor(e, t) {
41435
41435
  super("!~", e, t);
41436
41436
  }
41437
41437
  eval(e, t) {
41438
41438
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
41439
- return On(gr(n, i));
41439
+ return In(xr(n, i));
41440
41440
  }
41441
41441
  };
41442
41442
  var ge = class extends C {
@@ -41447,42 +41447,42 @@ var ge = class extends C {
41447
41447
  let n = this.left.eval(e, t);
41448
41448
  if (n.length !== 1) return [];
41449
41449
  let i = this.right.name;
41450
- return f(ot(n[0], i));
41450
+ return f(at(n[0], i));
41451
41451
  }
41452
41452
  };
41453
- var St = class extends C {
41453
+ var Et = class extends C {
41454
41454
  constructor(e, t) {
41455
41455
  super("and", e, t);
41456
41456
  }
41457
41457
  eval(e, t) {
41458
- let n = j(this.left.eval(e, t), "boolean"), i = j(this.right.eval(e, t), "boolean");
41458
+ let n = W(this.left.eval(e, t), "boolean"), i = W(this.right.eval(e, t), "boolean");
41459
41459
  return n?.value === true && i?.value === true ? f(true) : n?.value === false || i?.value === false ? f(false) : [];
41460
41460
  }
41461
41461
  };
41462
- var Et = class extends C {
41462
+ var bt = class extends C {
41463
41463
  constructor(e, t) {
41464
41464
  super("or", e, t);
41465
41465
  }
41466
41466
  eval(e, t) {
41467
- let n = j(this.left.eval(e, t), "boolean"), i = j(this.right.eval(e, t), "boolean");
41467
+ let n = W(this.left.eval(e, t), "boolean"), i = W(this.right.eval(e, t), "boolean");
41468
41468
  return n?.value === false && i?.value === false ? f(false) : n?.value || i?.value ? f(true) : [];
41469
41469
  }
41470
41470
  };
41471
- var bt = class extends C {
41471
+ var Rt = class extends C {
41472
41472
  constructor(e, t) {
41473
41473
  super("xor", e, t);
41474
41474
  }
41475
41475
  eval(e, t) {
41476
- let n = j(this.left.eval(e, t), "boolean"), i = j(this.right.eval(e, t), "boolean");
41476
+ let n = W(this.left.eval(e, t), "boolean"), i = W(this.right.eval(e, t), "boolean");
41477
41477
  return !n || !i ? [] : f(n.value !== i.value);
41478
41478
  }
41479
41479
  };
41480
- var Rt = class extends C {
41480
+ var Ct = class extends C {
41481
41481
  constructor(e, t) {
41482
41482
  super("implies", e, t);
41483
41483
  }
41484
41484
  eval(e, t) {
41485
- let n = j(this.left.eval(e, t), "boolean"), i = j(this.right.eval(e, t), "boolean");
41485
+ let n = W(this.left.eval(e, t), "boolean"), i = W(this.right.eval(e, t), "boolean");
41486
41486
  return i?.value === true || n?.value === false ? f(true) : !n || !i ? [] : f(false);
41487
41487
  }
41488
41488
  };
@@ -41492,7 +41492,7 @@ var J = class {
41492
41492
  this.args = t;
41493
41493
  }
41494
41494
  eval(e, t) {
41495
- let n = O[this.name];
41495
+ let n = A[this.name];
41496
41496
  if (!n) throw new Error("Unrecognized function: " + this.name);
41497
41497
  return n(e, t, ...this.args);
41498
41498
  }
@@ -41500,7 +41500,7 @@ var J = class {
41500
41500
  return `${this.name}(${this.args.map((e) => e.toString()).join(", ")})`;
41501
41501
  }
41502
41502
  };
41503
- var ve = class {
41503
+ var xe = class {
41504
41504
  constructor(e, t) {
41505
41505
  this.left = e;
41506
41506
  this.expr = t;
@@ -41517,36 +41517,36 @@ var ve = class {
41517
41517
  return `${this.left.toString()}[${this.expr.toString()}]`;
41518
41518
  }
41519
41519
  };
41520
- var qe = ["!=", "!~", "<=", ">=", "{}", "->"];
41520
+ var je = ["!=", "!~", "<=", ">=", "{}", "->"];
41521
41521
  var y = { 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 };
41522
- var ns = { parse(r7) {
41522
+ var ss = { parse(r7) {
41523
41523
  let e = r7.consumeAndParse();
41524
41524
  if (!r7.match(")")) throw new Error("Parse error: expected `)` got `" + r7.peek()?.value + "`");
41525
41525
  return e;
41526
41526
  } };
41527
- var is = { parse(r7, e) {
41527
+ var as = { parse(r7, e) {
41528
41528
  let t = r7.consumeAndParse();
41529
41529
  if (!r7.match("]")) throw new Error("Parse error: expected `]`");
41530
- return new ve(e, t);
41530
+ return new xe(e, t);
41531
41531
  }, precedence: y.Indexer };
41532
- var os = { parse(r7, e) {
41532
+ var cs = { parse(r7, e) {
41533
41533
  if (!(e instanceof q)) throw new Error("Unexpected parentheses");
41534
41534
  let t = [];
41535
41535
  for (; !r7.match(")"); ) t.push(r7.consumeAndParse()), r7.match(",");
41536
41536
  return new J(e.name, t);
41537
41537
  }, precedence: y.FunctionCall };
41538
- function ss(r7) {
41538
+ function us(r7) {
41539
41539
  let e = r7.split(" "), t = parseFloat(e[0]), n = e[1];
41540
41540
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
41541
41541
  }
41542
- function je() {
41543
- return new Je().registerPrefix("String", { parse: (r7, e) => new U({ type: l.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r7, e) => new U({ type: l.dateTime, value: Oe(e.value) }) }).registerPrefix("Quantity", { parse: (r7, e) => new U({ type: l.Quantity, value: ss(e.value) }) }).registerPrefix("Number", { parse: (r7, e) => new U({ type: e.value.includes(".") ? l.decimal : l.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new U({ type: l.boolean, value: true }) }).registerPrefix("false", { parse: () => new U({ type: l.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r7, e) => new q(e.value) }).registerPrefix("{}", { parse: () => new dt() }).registerPrefix("(", ns).registerInfix("[", is).registerInfix("(", os).prefix("+", y.UnaryAdd, (r7, e) => new ft("+", e, (t) => t)).prefix("-", y.UnarySubtract, (r7, e) => new V("-", e, e, (t, n) => -n)).infixLeft(".", y.Dot, (r7, e, t) => new re(r7, t)).infixLeft("/", y.Divide, (r7, e, t) => new V("/", r7, t, (n, i) => n / i)).infixLeft("*", y.Multiply, (r7, e, t) => new V("*", r7, t, (n, i) => n * i)).infixLeft("+", y.Add, (r7, e, t) => new V("+", r7, t, (n, i) => n + i)).infixLeft("-", y.Subtract, (r7, e, t) => new V("-", r7, t, (n, i) => n - i)).infixLeft("|", y.Union, (r7, e, t) => new Ie(r7, t)).infixLeft("=", y.Equals, (r7, e, t) => new gt(r7, t)).infixLeft("!=", y.NotEquals, (r7, e, t) => new vt(r7, t)).infixLeft("~", y.Equivalent, (r7, e, t) => new xt(r7, t)).infixLeft("!~", y.NotEquivalent, (r7, e, t) => new Tt(r7, t)).infixLeft("<", y.LessThan, (r7, e, t) => new V("<", r7, t, (n, i) => n < i)).infixLeft("<=", y.LessThanOrEquals, (r7, e, t) => new V("<=", r7, t, (n, i) => n <= i)).infixLeft(">", y.GreaterThan, (r7, e, t) => new V(">", r7, t, (n, i) => n > i)).infixLeft(">=", y.GreaterThanOrEquals, (r7, e, t) => new V(">=", r7, t, (n, i) => n >= i)).infixLeft("&", y.Ampersand, (r7, e, t) => new mt(r7, t)).infixLeft("and", y.And, (r7, e, t) => new St(r7, t)).infixLeft("as", y.As, (r7, e, t) => new ye(r7, t)).infixLeft("contains", y.Contains, (r7, e, t) => new ht(r7, t)).infixLeft("div", y.Divide, (r7, e, t) => new V("div", r7, t, (n, i) => n / i | 0)).infixLeft("in", y.In, (r7, e, t) => new yt(r7, t)).infixLeft("is", y.Is, (r7, e, t) => new ge(r7, t)).infixLeft("mod", y.Modulo, (r7, e, t) => new V("mod", r7, t, (n, i) => n % i)).infixLeft("or", y.Or, (r7, e, t) => new Et(r7, t)).infixLeft("xor", y.Xor, (r7, e, t) => new bt(r7, t)).infixLeft("implies", y.Implies, (r7, e, t) => new Rt(r7, t));
41542
+ function $e() {
41543
+ return new Ze().registerPrefix("String", { parse: (r7, e) => new U({ type: l.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r7, e) => new U({ type: l.dateTime, value: Oe(e.value) }) }).registerPrefix("Quantity", { parse: (r7, e) => new U({ type: l.Quantity, value: us(e.value) }) }).registerPrefix("Number", { parse: (r7, e) => new U({ type: e.value.includes(".") ? l.decimal : l.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new U({ type: l.boolean, value: true }) }).registerPrefix("false", { parse: () => new U({ type: l.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r7, e) => new q(e.value) }).registerPrefix("{}", { parse: () => new ft() }).registerPrefix("(", ss).registerInfix("[", as).registerInfix("(", cs).prefix("+", y.UnaryAdd, (r7, e) => new mt("+", e, (t) => t)).prefix("-", y.UnarySubtract, (r7, e) => new V("-", e, e, (t, n) => -n)).infixLeft(".", y.Dot, (r7, e, t) => new ne(r7, t)).infixLeft("/", y.Divide, (r7, e, t) => new V("/", r7, t, (n, i) => n / i)).infixLeft("*", y.Multiply, (r7, e, t) => new V("*", r7, t, (n, i) => n * i)).infixLeft("+", y.Add, (r7, e, t) => new V("+", r7, t, (n, i) => n + i)).infixLeft("-", y.Subtract, (r7, e, t) => new V("-", r7, t, (n, i) => n - i)).infixLeft("|", y.Union, (r7, e, t) => new Ie(r7, t)).infixLeft("=", y.Equals, (r7, e, t) => new xt(r7, t)).infixLeft("!=", y.NotEquals, (r7, e, t) => new vt(r7, t)).infixLeft("~", y.Equivalent, (r7, e, t) => new Tt(r7, t)).infixLeft("!~", y.NotEquivalent, (r7, e, t) => new St(r7, t)).infixLeft("<", y.LessThan, (r7, e, t) => new V("<", r7, t, (n, i) => n < i)).infixLeft("<=", y.LessThanOrEquals, (r7, e, t) => new V("<=", r7, t, (n, i) => n <= i)).infixLeft(">", y.GreaterThan, (r7, e, t) => new V(">", r7, t, (n, i) => n > i)).infixLeft(">=", y.GreaterThanOrEquals, (r7, e, t) => new V(">=", r7, t, (n, i) => n >= i)).infixLeft("&", y.Ampersand, (r7, e, t) => new ht(r7, t)).infixLeft("and", y.And, (r7, e, t) => new Et(r7, t)).infixLeft("as", y.As, (r7, e, t) => new ye(r7, t)).infixLeft("contains", y.Contains, (r7, e, t) => new yt(r7, t)).infixLeft("div", y.Divide, (r7, e, t) => new V("div", r7, t, (n, i) => n / i | 0)).infixLeft("in", y.In, (r7, e, t) => new gt(r7, t)).infixLeft("is", y.Is, (r7, e, t) => new ge(r7, t)).infixLeft("mod", y.Modulo, (r7, e, t) => new V("mod", r7, t, (n, i) => n % i)).infixLeft("or", y.Or, (r7, e, t) => new bt(r7, t)).infixLeft("xor", y.Xor, (r7, e, t) => new Rt(r7, t)).infixLeft("implies", y.Implies, (r7, e, t) => new Ct(r7, t));
41544
41544
  }
41545
- var as = je();
41546
- var ti = ((p2) => (p2.BOOLEAN = "BOOLEAN", p2.NUMBER = "NUMBER", p2.QUANTITY = "QUANTITY", p2.TEXT = "TEXT", p2.REFERENCE = "REFERENCE", p2.CANONICAL = "CANONICAL", p2.DATE = "DATE", p2.DATETIME = "DATETIME", p2.PERIOD = "PERIOD", p2.UUID = "UUID", p2))(ti || {});
41547
- var ai = ((T) => (T.EQUALS = "eq", T.NOT_EQUALS = "ne", T.GREATER_THAN = "gt", T.LESS_THAN = "lt", T.GREATER_THAN_OR_EQUALS = "ge", T.LESS_THAN_OR_EQUALS = "le", T.STARTS_AFTER = "sa", T.ENDS_BEFORE = "eb", T.APPROXIMATELY = "ap", T.CONTAINS = "contains", T.EXACT = "exact", T.TEXT = "text", T.NOT = "not", T.ABOVE = "above", T.BELOW = "below", T.IN = "in", T.NOT_IN = "not-in", T.OF_TYPE = "of-type", T.MISSING = "missing", T.PRESENT = "present", T.IDENTIFIER = "identifier", T.ITERATE = "iterate", T))(ai || {});
41548
- var Ns = ((b2) => (b2.READ = "read", b2.VREAD = "vread", b2.UPDATE = "update", b2.PATCH = "patch", b2.DELETE = "delete", b2.HISTORY = "history", b2.HISTORY_INSTANCE = "history-instance", b2.HISTORY_TYPE = "history-type", b2.HISTORY_SYSTEM = "history-system", b2.CREATE = "create", b2.SEARCH = "search", b2.SEARCH_TYPE = "search-type", b2.SEARCH_SYSTEM = "search-system", b2.SEARCH_COMPARTMENT = "search-compartment", b2.CAPABILITIES = "capabilities", b2.TRANSACTION = "transaction", b2.BATCH = "batch", b2.OPERATION = "operation", b2))(Ns || {});
41549
- function pi(r7) {
41545
+ var ls = $e();
41546
+ var ri = ((p2) => (p2.BOOLEAN = "BOOLEAN", p2.NUMBER = "NUMBER", p2.QUANTITY = "QUANTITY", p2.TEXT = "TEXT", p2.REFERENCE = "REFERENCE", p2.CANONICAL = "CANONICAL", p2.DATE = "DATE", p2.DATETIME = "DATETIME", p2.PERIOD = "PERIOD", p2.UUID = "UUID", p2))(ri || {});
41547
+ var ci = ((v) => (v.EQUALS = "eq", v.NOT_EQUALS = "ne", v.GREATER_THAN = "gt", v.LESS_THAN = "lt", v.GREATER_THAN_OR_EQUALS = "ge", v.LESS_THAN_OR_EQUALS = "le", v.STARTS_AFTER = "sa", v.ENDS_BEFORE = "eb", v.APPROXIMATELY = "ap", v.CONTAINS = "contains", v.STARTS_WITH = "sw", v.EXACT = "exact", v.TEXT = "text", v.NOT = "not", v.ABOVE = "above", v.BELOW = "below", v.IN = "in", v.NOT_IN = "not-in", v.OF_TYPE = "of-type", v.MISSING = "missing", v.PRESENT = "present", v.IDENTIFIER = "identifier", v.ITERATE = "iterate", v))(ci || {});
41548
+ var Fs = ((b2) => (b2.READ = "read", b2.VREAD = "vread", b2.UPDATE = "update", b2.PATCH = "patch", b2.DELETE = "delete", b2.HISTORY = "history", b2.HISTORY_INSTANCE = "history-instance", b2.HISTORY_TYPE = "history-type", b2.HISTORY_SYSTEM = "history-system", b2.CREATE = "create", b2.SEARCH = "search", b2.SEARCH_TYPE = "search-type", b2.SEARCH_SYSTEM = "search-system", b2.SEARCH_COMPARTMENT = "search-compartment", b2.CAPABILITIES = "capabilities", b2.TRANSACTION = "transaction", b2.BATCH = "batch", b2.OPERATION = "operation", b2))(Fs || {});
41549
+ function di(r7) {
41550
41550
  if (typeof window < "u") {
41551
41551
  let e = window.atob(r7), t = Uint8Array.from(e, (n) => n.charCodeAt(0));
41552
41552
  return new window.TextDecoder().decode(t);
@@ -41554,7 +41554,7 @@ function pi(r7) {
41554
41554
  if (typeof Buffer < "u") return Buffer.from(r7, "base64").toString("utf-8");
41555
41555
  throw new Error("Unable to decode base64");
41556
41556
  }
41557
- function di(r7) {
41557
+ function fi(r7) {
41558
41558
  if (typeof window < "u") {
41559
41559
  let e = new window.TextEncoder().encode(r7), t = String.fromCharCode.apply(null, e);
41560
41560
  return window.btoa(t);
@@ -41562,20 +41562,20 @@ function di(r7) {
41562
41562
  if (typeof Buffer < "u") return Buffer.from(r7, "utf8").toString("base64");
41563
41563
  throw new Error("Unable to encode base64");
41564
41564
  }
41565
- function _r() {
41565
+ function Nr() {
41566
41566
  let r7 = new Uint32Array(28);
41567
41567
  return crypto.getRandomValues(r7), qn(r7.buffer);
41568
41568
  }
41569
- async function fi(r7) {
41569
+ async function mi(r7) {
41570
41570
  return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r7));
41571
41571
  }
41572
- function xe() {
41572
+ function ve() {
41573
41573
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r7) => {
41574
41574
  let e = Math.random() * 16 | 0;
41575
41575
  return (r7 === "x" ? e : e & 3 | 8).toString(16);
41576
41576
  });
41577
41577
  }
41578
- var At = class {
41578
+ var Ot = class {
41579
41579
  constructor(e = 10) {
41580
41580
  this.max = e, this.cache = /* @__PURE__ */ new Map();
41581
41581
  }
@@ -41600,7 +41600,7 @@ var At = class {
41600
41600
  }
41601
41601
  };
41602
41602
  var D = { CSS: "text/css", DICOM: "application/dicom", FAVICON: "image/vnd.microsoft.icon", FHIR_JSON: "application/fhir+json", FORM_URL_ENCODED: "application/x-www-form-urlencoded", HL7_V2: "x-application/hl7-v2+er7", HTML: "text/html", JAVASCRIPT: "text/javascript", JSON: "application/json", JSON_PATCH: "application/json-patch+json", PNG: "image/png", SCIM_JSON: "application/scim+json", SVG: "image/svg+xml", TEXT: "text/plain", TYPESCRIPT: "text/typescript", PING: "x-application/ping" };
41603
- var Nr = class {
41603
+ var Lr = class {
41604
41604
  constructor() {
41605
41605
  this.listeners = {};
41606
41606
  }
@@ -41627,7 +41627,7 @@ var Nr = class {
41627
41627
  };
41628
41628
  var H = class {
41629
41629
  constructor() {
41630
- this.emitter = new Nr();
41630
+ this.emitter = new Lr();
41631
41631
  }
41632
41632
  dispatchEvent(e) {
41633
41633
  this.emitter.dispatchEvent(e);
@@ -41642,76 +41642,76 @@ var H = class {
41642
41642
  this.emitter.removeAllListeners();
41643
41643
  }
41644
41644
  };
41645
- var Lr = { "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" };
41646
- var Gs = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
41647
- var Fr = ["DiagnosticReport-update"];
41648
- function yi(r7) {
41649
- return Fr.includes(r7);
41650
- }
41645
+ var Fr = { "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" };
41646
+ var Qs = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
41647
+ var Ur = ["DiagnosticReport-update"];
41651
41648
  function gi(r7) {
41652
- if (Fr.includes(r7)) throw new d(h(`'context.version' is required for '${r7}'.`));
41649
+ return Ur.includes(r7);
41653
41650
  }
41654
- var Hs = { "Patient-open": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "Patient-close": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "ImagingStudy-open": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "ImagingStudy-close": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "Encounter-open": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "Encounter-close": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "DiagnosticReport-open": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-close": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-select": { report: { resourceType: "DiagnosticReport" }, select: { resourceType: "*", isArray: true } }, "DiagnosticReport-update": { report: { resourceType: "DiagnosticReport" }, patient: { resourceType: "Patient", optional: true }, study: { resourceType: "ImagingStudy", optional: true }, updates: { resourceType: "Bundle" } }, syncerror: { operationoutcome: { resourceType: "OperationOutcome" } } };
41655
- function Qs(r7) {
41656
- return Gs.includes(r7);
41651
+ function xi(r7) {
41652
+ if (Ur.includes(r7)) throw new d(h(`'context.version' is required for '${r7}'.`));
41653
+ }
41654
+ var Ks = { "Patient-open": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "Patient-close": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "ImagingStudy-open": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "ImagingStudy-close": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "Encounter-open": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "Encounter-close": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "DiagnosticReport-open": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-close": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-select": { report: { resourceType: "DiagnosticReport" }, select: { resourceType: "*", isArray: true } }, "DiagnosticReport-update": { report: { resourceType: "DiagnosticReport" }, patient: { resourceType: "Patient", optional: true }, study: { resourceType: "ImagingStudy", optional: true }, updates: { resourceType: "Bundle" } }, syncerror: { operationoutcome: { resourceType: "OperationOutcome" } } };
41655
+ function zs(r7) {
41656
+ return Qs.includes(r7);
41657
41657
  }
41658
41658
  function vi(r7) {
41659
41659
  return !!r7.endpoint;
41660
41660
  }
41661
- function Ur(r7) {
41662
- if (!It(r7)) throw new d(h("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
41661
+ function Br(r7) {
41662
+ if (!kt(r7)) throw new d(h("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
41663
41663
  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(",") };
41664
41664
  return vi(r7) && (o.endpoint = r7.endpoint), new URLSearchParams(o).toString();
41665
41665
  }
41666
- function It(r7) {
41666
+ function kt(r7) {
41667
41667
  if (typeof r7 != "object") return false;
41668
41668
  let { channelType: e, mode: t, topic: n, events: i } = r7;
41669
41669
  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;
41670
- for (let o of i) if (!Lr[o]) return false;
41670
+ for (let o of i) if (!Fr[o]) return false;
41671
41671
  return !(vi(r7) && !(typeof r7.endpoint == "string" && r7.endpoint.startsWith("ws")));
41672
41672
  }
41673
- function hi(r7, e, t, n) {
41673
+ function yi(r7, e, t, n) {
41674
41674
  if (typeof e != "object") throw new d(h(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
41675
41675
  if (!(e.id && typeof e.id == "string")) throw new d(h(`context[${t}] is invalid. Resource must contain a valid string ID.`));
41676
41676
  if (!e.resourceType) throw new d(h(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
41677
41677
  let i = n.resourceType;
41678
41678
  if (i !== "*") {
41679
- if (!Qs(e.resourceType)) throw new d(h(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
41679
+ if (!zs(e.resourceType)) throw new d(h(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
41680
41680
  if (i && e.resourceType !== i) throw new d(h(`context[${t}] is invalid. context[${t}] for the '${r7}' event should contain resource of type ${i}.`));
41681
41681
  }
41682
41682
  }
41683
- function Ks(r7, e, t, n, i) {
41684
- if (i.set(e.key, (i.get(e.key) ?? 0) + 1), !n.isArray) hi(r7, e.resource, t, n);
41683
+ function Js(r7, e, t, n, i) {
41684
+ if (i.set(e.key, (i.get(e.key) ?? 0) + 1), !n.isArray) yi(r7, e.resource, t, n);
41685
41685
  else {
41686
41686
  let { resources: o } = e;
41687
41687
  if (!o) throw new d(h(`context[${t}] is invalid. context[${t}] for the '${r7}' with key '${String(e.key)}' should contain an array of resources on the key 'resources'.`));
41688
- for (let s of o) hi(r7, s, t, n);
41688
+ for (let s of o) yi(r7, s, t, n);
41689
41689
  }
41690
41690
  }
41691
- function zs(r7, e) {
41692
- let t = /* @__PURE__ */ new Map(), n = Hs[r7];
41691
+ function Ys(r7, e) {
41692
+ let t = /* @__PURE__ */ new Map(), n = Ks[r7];
41693
41693
  for (let i = 0; i < e.length; i++) {
41694
41694
  let o = e[i].key;
41695
41695
  if (!n[o]) throw new d(h(`Key '${o}' not found for event '${r7}'. Make sure to add only valid keys.`));
41696
- Ks(r7, e[i], i, n[o], t);
41696
+ Js(r7, e[i], i, n[o], t);
41697
41697
  }
41698
41698
  for (let [i, o] of Object.entries(n)) {
41699
41699
  if (!(o.optional || t.has(i))) throw new d(h(`Missing required key '${i}' on context for '${r7}' event.`));
41700
41700
  if (!o.manyAllowed && (t.get(i) || 0) > 1) throw new d(h(`${t.get(i)} context entries with key '${i}' found for the '${r7}' event when schema only allows for 1.`));
41701
41701
  }
41702
41702
  }
41703
- function Br(r7, e, t, n) {
41703
+ function qr(r7, e, t, n) {
41704
41704
  if (!(r7 && typeof r7 == "string")) throw new d(h("Must provide a topic."));
41705
- if (!Lr[e]) throw new d(h(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Lr).join(", ")}`));
41705
+ if (!Fr[e]) throw new d(h(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Fr).join(", ")}`));
41706
41706
  if (typeof t != "object") throw new d(h("context must be a context object or array of context objects."));
41707
- if (Fr.includes(e) && !n) throw new d(h(`The '${e}' event must contain a 'context.versionId'.`));
41707
+ if (Ur.includes(e) && !n) throw new d(h(`The '${e}' event must contain a 'context.versionId'.`));
41708
41708
  let i = Array.isArray(t) ? t : [t];
41709
- return zs(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: xe(), event: { "hub.topic": r7, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
41709
+ return Ys(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: ve(), event: { "hub.topic": r7, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
41710
41710
  }
41711
- var Ot = class extends H {
41711
+ var It = class extends H {
41712
41712
  constructor(e) {
41713
41713
  if (super(), this.subRequest = e, !e.endpoint) throw new d(h("Subscription request should contain an endpoint."));
41714
- if (!It(e)) throw new d(h("Subscription request failed validation."));
41714
+ if (!kt(e)) throw new d(h("Subscription request failed validation."));
41715
41715
  let t = new WebSocket(e.endpoint);
41716
41716
  t.addEventListener("open", () => {
41717
41717
  this.dispatchEvent({ type: "connect" }), t.addEventListener("message", (n) => {
@@ -41728,36 +41728,36 @@ var Ot = class extends H {
41728
41728
  this.websocket.close();
41729
41729
  }
41730
41730
  };
41731
- function Js(r7) {
41732
- let e = r7.replace(/-/g, "+").replace(/_/g, "/"), t = pi(e), n = Array.from(t).reduce((o, s) => {
41731
+ function Zs(r7) {
41732
+ let e = r7.replace(/-/g, "+").replace(/_/g, "/"), t = di(e), n = Array.from(t).reduce((o, s) => {
41733
41733
  let a2 = ("00" + s.charCodeAt(0).toString(16)).slice(-2);
41734
41734
  return `${o}%${a2}`;
41735
41735
  }, ""), i = decodeURIComponent(n);
41736
41736
  return JSON.parse(i);
41737
41737
  }
41738
- function xi(r7) {
41738
+ function Ti(r7) {
41739
41739
  return r7.split(".").length === 3;
41740
41740
  }
41741
- function kt(r7) {
41741
+ function Vt(r7) {
41742
41742
  let [e, t, n] = r7.split(".");
41743
- return Js(t);
41743
+ return Zs(t);
41744
41744
  }
41745
- function Ti(r7) {
41745
+ function Si(r7) {
41746
41746
  try {
41747
- return typeof kt(r7).login_id == "string";
41747
+ return typeof Vt(r7).login_id == "string";
41748
41748
  } catch {
41749
41749
  return false;
41750
41750
  }
41751
41751
  }
41752
- function Si(r7) {
41752
+ function Ei(r7) {
41753
41753
  try {
41754
- let t = kt(r7).exp;
41754
+ let t = Vt(r7).exp;
41755
41755
  return typeof t == "number" ? t * 1e3 : void 0;
41756
41756
  } catch {
41757
41757
  return;
41758
41758
  }
41759
41759
  }
41760
- var Vt = class {
41760
+ var Dt = class {
41761
41761
  constructor(e) {
41762
41762
  this.medplum = e;
41763
41763
  }
@@ -41771,11 +41771,11 @@ var Vt = class {
41771
41771
  await this.medplum.delete(`keyvalue/v1/${e}`);
41772
41772
  }
41773
41773
  };
41774
- var Ei;
41775
- Ei = Symbol.toStringTag;
41774
+ var bi;
41775
+ bi = Symbol.toStringTag;
41776
41776
  var M = class {
41777
41777
  constructor(e) {
41778
- this[Ei] = "ReadablePromise";
41778
+ this[bi] = "ReadablePromise";
41779
41779
  this.status = "pending";
41780
41780
  this.suspender = e.then((t) => (this.status = "success", this.response = t, t), (t) => {
41781
41781
  throw this.status = "error", this.error = t, t;
@@ -41807,9 +41807,9 @@ var M = class {
41807
41807
  return this.suspender.finally(e);
41808
41808
  }
41809
41809
  };
41810
- var We = class {
41810
+ var He = class {
41811
41811
  constructor(e) {
41812
- this.storage = e ?? (typeof localStorage < "u" ? localStorage : new qr());
41812
+ this.storage = e ?? (typeof localStorage < "u" ? localStorage : new Wr());
41813
41813
  }
41814
41814
  clear() {
41815
41815
  this.storage.clear();
@@ -41825,10 +41825,10 @@ var We = class {
41825
41825
  return t ? JSON.parse(t) : void 0;
41826
41826
  }
41827
41827
  setObject(e, t) {
41828
- this.setString(e, t ? Fn(t) : void 0);
41828
+ this.setString(e, t ? lt(t) : void 0);
41829
41829
  }
41830
41830
  };
41831
- var qr = class {
41831
+ var Wr = class {
41832
41832
  constructor() {
41833
41833
  this.data = /* @__PURE__ */ new Map();
41834
41834
  }
@@ -41852,8 +41852,8 @@ var qr = class {
41852
41852
  }
41853
41853
  };
41854
41854
  var Ve = { Event: typeof globalThis.Event < "u" ? globalThis.Event : void 0, ErrorEvent: void 0, CloseEvent: void 0 };
41855
- var Ri = false;
41856
- function Ys() {
41855
+ var Ci = false;
41856
+ function Xs() {
41857
41857
  if (typeof globalThis.Event > "u") throw new Error("Unable to lazy init events for ReconnectingWebSocket. globalThis.Event is not defined yet");
41858
41858
  Ve.Event = globalThis.Event, Ve.ErrorEvent = class extends Event {
41859
41859
  constructor(e, t) {
@@ -41867,17 +41867,17 @@ function Ys() {
41867
41867
  }
41868
41868
  };
41869
41869
  }
41870
- function Zs(r7, e) {
41870
+ function ea(r7, e) {
41871
41871
  if (!r7) throw new Error(e);
41872
41872
  }
41873
- function Dt(r7) {
41873
+ function Mt(r7) {
41874
41874
  return new r7.constructor(r7.type, r7);
41875
41875
  }
41876
41876
  var Te = { maxReconnectionDelay: 1e4, minReconnectionDelay: 1e3 + Math.random() * 4e3, minUptime: 5e3, reconnectionDelayGrowFactor: 1.3, connectionTimeout: 4e3, maxRetries: 1 / 0, maxEnqueuedMessages: 1 / 0, startClosed: false, debug: false };
41877
- var Ci = false;
41878
- var Mt = class r extends H {
41877
+ var Pi = false;
41878
+ var _t = class r extends H {
41879
41879
  constructor(t, n, i = {}) {
41880
- Ri || (Ys(), Ri = true);
41880
+ Ci || (Xs(), Ci = true);
41881
41881
  super();
41882
41882
  this._retryCount = -1;
41883
41883
  this._shouldReconnect = true;
@@ -41892,16 +41892,16 @@ var Mt = class r extends H {
41892
41892
  this._handleOpen = (t2) => {
41893
41893
  this._debug("open event");
41894
41894
  let { minUptime: n2 = Te.minUptime } = this._options;
41895
- clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), Zs(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(Dt(t2));
41895
+ clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), ea(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(Mt(t2));
41896
41896
  };
41897
41897
  this._handleMessage = (t2) => {
41898
- this._debug("message event"), this.onmessage && this.onmessage(t2), this.dispatchEvent(Dt(t2));
41898
+ this._debug("message event"), this.onmessage && this.onmessage(t2), this.dispatchEvent(Mt(t2));
41899
41899
  };
41900
41900
  this._handleError = (t2) => {
41901
- this._debug("error event", t2.message), this._disconnect(void 0, t2.message === "TIMEOUT" ? "timeout" : void 0), this.onerror && this.onerror(t2), this._debug("exec error listeners"), this.dispatchEvent(Dt(t2)), this._connect();
41901
+ this._debug("error event", t2.message), this._disconnect(void 0, t2.message === "TIMEOUT" ? "timeout" : void 0), this.onerror && this.onerror(t2), this._debug("exec error listeners"), this.dispatchEvent(Mt(t2)), this._connect();
41902
41902
  };
41903
41903
  this._handleClose = (t2) => {
41904
- this._debug("close event"), this._clearTimeouts(), this._shouldReconnect && this._connect(), this.onclose && this.onclose(t2), this.dispatchEvent(Dt(t2));
41904
+ this._debug("close event"), this._clearTimeouts(), this._shouldReconnect && this._connect(), this.onclose && this.onclose(t2), this.dispatchEvent(Mt(t2));
41905
41905
  };
41906
41906
  this._url = t, this._protocols = n, this._options = i, this._options.startClosed && (this._shouldReconnect = false), this._options.binaryType ? this._binaryType = this._options.binaryType : this._binaryType = "blob", this._options.debugLogger && (this._debugLogger = this._options.debugLogger), this._connect();
41907
41907
  }
@@ -42002,7 +42002,7 @@ var Mt = class r extends H {
42002
42002
  this._connectLock = false;
42003
42003
  return;
42004
42004
  }
42005
- !this._options.WebSocket && typeof WebSocket > "u" && !Ci && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), Ci = true);
42005
+ !this._options.WebSocket && typeof WebSocket > "u" && !Pi && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), Pi = true);
42006
42006
  let i = this._options.WebSocket || WebSocket;
42007
42007
  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);
42008
42008
  }).catch((i) => {
@@ -42034,8 +42034,8 @@ var Mt = class r extends H {
42034
42034
  clearTimeout(this._connectTimeout), clearTimeout(this._uptimeTimeout);
42035
42035
  }
42036
42036
  };
42037
- var Xs = 5e3;
42038
- var Ge = class extends H {
42037
+ var ta = 5e3;
42038
+ var Qe = class extends H {
42039
42039
  constructor(...e) {
42040
42040
  super(), this.criteria = new Set(e);
42041
42041
  }
@@ -42052,25 +42052,25 @@ var Ge = class extends H {
42052
42052
  var jr = class {
42053
42053
  constructor(e, t) {
42054
42054
  this.connecting = false;
42055
- this.criteria = e, this.emitter = new Ge(e), this.refCount = 1, this.subscriptionProps = t ? { ...t } : void 0;
42055
+ this.criteria = e, this.emitter = new Qe(e), this.refCount = 1, this.subscriptionProps = t ? { ...t } : void 0;
42056
42056
  }
42057
42057
  clearAttachedSubscription() {
42058
42058
  this.subscriptionId = void 0, this.token = void 0;
42059
42059
  }
42060
42060
  };
42061
- var _t = class {
42061
+ var Nt = class {
42062
42062
  constructor(e, t, n) {
42063
42063
  this.pingTimer = void 0;
42064
42064
  this.waitingForPong = false;
42065
- if (!(e instanceof Nt)) throw new d(h("First arg of constructor should be a `MedplumClient`"));
42065
+ if (!(e instanceof Lt)) throw new d(h("First arg of constructor should be a `MedplumClient`"));
42066
42066
  let i;
42067
42067
  try {
42068
42068
  i = new URL(t).toString();
42069
42069
  } catch {
42070
42070
  throw new d(h("Not a valid URL"));
42071
42071
  }
42072
- let o = n?.ReconnectingWebSocket ? new n.ReconnectingWebSocket(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger }) : new Mt(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger });
42073
- this.medplum = e, this.ws = o, this.masterSubEmitter = new Ge(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ?? Xs, this.currentProfile = e.getProfile(), this.setupListeners();
42072
+ let o = n?.ReconnectingWebSocket ? new n.ReconnectingWebSocket(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger }) : new _t(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger });
42073
+ this.medplum = e, this.ws = o, this.masterSubEmitter = new Qe(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ?? ta, this.currentProfile = e.getProfile(), this.setupListeners();
42074
42074
  }
42075
42075
  setupListeners() {
42076
42076
  let e = this.ws;
@@ -42087,7 +42087,7 @@ var _t = class {
42087
42087
  return;
42088
42088
  }
42089
42089
  if (o.type === "handshake") {
42090
- let a2 = pe(o.subscription), c = { type: "connect", payload: { subscriptionId: a2 } };
42090
+ let a2 = de(o.subscription), c = { type: "connect", payload: { subscriptionId: a2 } };
42091
42091
  this.masterSubEmitter?.dispatchEvent(c);
42092
42092
  let u2 = this.criteriaEntriesBySubscriptionId.get(a2);
42093
42093
  if (!u2) {
@@ -42098,7 +42098,7 @@ var _t = class {
42098
42098
  return;
42099
42099
  }
42100
42100
  this.masterSubEmitter?.dispatchEvent({ type: "message", payload: i });
42101
- let s = this.criteriaEntriesBySubscriptionId.get(pe(o.subscription));
42101
+ let s = this.criteriaEntriesBySubscriptionId.get(de(o.subscription));
42102
42102
  if (!s) {
42103
42103
  console.warn("Received notification for criteria the SubscriptionManager is not listening for");
42104
42104
  return;
@@ -42111,7 +42111,7 @@ var _t = class {
42111
42111
  for (let o of this.getAllCriteriaEmitters()) o.dispatchEvent({ ...i });
42112
42112
  }
42113
42113
  }), e.addEventListener("error", () => {
42114
- let t = { type: "error", payload: new d(an(new Error("WebSocket error"))) };
42114
+ let t = { type: "error", payload: new d(cn(new Error("WebSocket error"))) };
42115
42115
  this.masterSubEmitter?.dispatchEvent(t);
42116
42116
  for (let n of this.getAllCriteriaEmitters()) n.dispatchEvent({ ...t });
42117
42117
  }), e.addEventListener("close", () => {
@@ -42148,7 +42148,7 @@ var _t = class {
42148
42148
  }
42149
42149
  async getTokenForCriteria(e) {
42150
42150
  let t = e?.subscriptionId;
42151
- t || (t = (await this.medplum.createResource({ ...e.subscriptionProps, resourceType: "Subscription", status: "active", reason: `WebSocket subscription for ${le(this.medplum.getProfile())}`, channel: { type: "websocket" }, criteria: e.criteria })).id);
42151
+ t || (t = (await this.medplum.createResource({ ...e.subscriptionProps, resourceType: "Subscription", status: "active", reason: `WebSocket subscription for ${pe(this.medplum.getProfile())}`, channel: { type: "websocket" }, criteria: e.criteria })).id);
42152
42152
  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;
42153
42153
  if (!i) throw new d(h("Failed to get token"));
42154
42154
  if (!o) throw new d(h("Failed to get URL from $get-ws-binding-token"));
@@ -42225,28 +42225,28 @@ var _t = class {
42225
42225
  return this.getAllCriteriaEmitters().length;
42226
42226
  }
42227
42227
  getMasterEmitter() {
42228
- return this.masterSubEmitter || (this.masterSubEmitter = new Ge(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
42228
+ return this.masterSubEmitter || (this.masterSubEmitter = new Qe(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
42229
42229
  }
42230
42230
  };
42231
- var ef = "3.2.24-75ed53f1f";
42232
- var ra = D.FHIR_JSON + ", */*; q=0.1";
42233
- var na = "https://api.medplum.com/";
42234
- var ia = 1e3;
42235
- var oa = 6e4;
42236
- var sa = 0;
42237
- var aa = 3e5;
42238
- var ca = "Binary/";
42239
- var Pi = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
42240
- var ua = ((o) => (o.ClientCredentials = "client_credentials", o.AuthorizationCode = "authorization_code", o.RefreshToken = "refresh_token", o.JwtBearer = "urn:ietf:params:oauth:grant-type:jwt-bearer", o.TokenExchange = "urn:ietf:params:oauth:grant-type:token-exchange", o))(ua || {});
42241
- var la = ((o) => (o.AccessToken = "urn:ietf:params:oauth:token-type:access_token", o.RefreshToken = "urn:ietf:params:oauth:token-type:refresh_token", o.IdToken = "urn:ietf:params:oauth:token-type:id_token", o.Saml1Token = "urn:ietf:params:oauth:token-type:saml1", o.Saml2Token = "urn:ietf:params:oauth:token-type:saml2", o))(la || {});
42242
- var pa = ((o) => (o.ClientSecretBasic = "client_secret_basic", o.ClientSecretPost = "client_secret_post", o.ClientSecretJwt = "client_secret_jwt", o.PrivateKeyJwt = "private_key_jwt", o.None = "none", o))(pa || {});
42243
- var da = ((e) => (e.JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", e))(da || {});
42244
- var Nt = class extends H {
42231
+ var sf = "3.2.26-cf1eed691";
42232
+ var ia = D.FHIR_JSON + ", */*; q=0.1";
42233
+ var oa = "https://api.medplum.com/";
42234
+ var sa = 1e3;
42235
+ var aa = 6e4;
42236
+ var ca = 0;
42237
+ var ua = 3e5;
42238
+ var la = "Binary/";
42239
+ var wi = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
42240
+ var pa = ((o) => (o.ClientCredentials = "client_credentials", o.AuthorizationCode = "authorization_code", o.RefreshToken = "refresh_token", o.JwtBearer = "urn:ietf:params:oauth:grant-type:jwt-bearer", o.TokenExchange = "urn:ietf:params:oauth:grant-type:token-exchange", o))(pa || {});
42241
+ var da = ((o) => (o.AccessToken = "urn:ietf:params:oauth:token-type:access_token", o.RefreshToken = "urn:ietf:params:oauth:token-type:refresh_token", o.IdToken = "urn:ietf:params:oauth:token-type:id_token", o.Saml1Token = "urn:ietf:params:oauth:token-type:saml1", o.Saml2Token = "urn:ietf:params:oauth:token-type:saml2", o))(da || {});
42242
+ var fa = ((o) => (o.ClientSecretBasic = "client_secret_basic", o.ClientSecretPost = "client_secret_post", o.ClientSecretJwt = "client_secret_jwt", o.PrivateKeyJwt = "private_key_jwt", o.None = "none", o))(fa || {});
42243
+ var ma = ((e) => (e.JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", e))(ma || {});
42244
+ var Lt = class extends H {
42245
42245
  constructor(t) {
42246
42246
  super();
42247
42247
  this.initComplete = true;
42248
42248
  if (t?.baseUrl && !t.baseUrl.startsWith("http")) throw new Error("Base URL must start with http or https");
42249
- this.options = t ?? {}, this.fetch = t?.fetch ?? fa(), this.storage = t?.storage ?? new We(), this.createPdfImpl = t?.createPdf, this.baseUrl = Cr(t?.baseUrl ?? na), 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.onUnauthenticated = t?.onUnauthenticated, this.refreshGracePeriod = t?.refreshGracePeriod ?? aa, this.cacheTime = t?.cacheTime ?? (typeof window > "u" ? sa : oa), this.cacheTime > 0 ? this.requestCache = new At(t?.resourceCacheSize ?? ia) : 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(() => {
42249
+ this.options = t ?? {}, this.fetch = t?.fetch ?? ha(), this.storage = t?.storage ?? new He(), this.createPdfImpl = t?.createPdf, this.baseUrl = Pr(t?.baseUrl ?? oa), 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.defaultHeaders = t?.defaultHeaders ?? {}, this.onUnauthenticated = t?.onUnauthenticated, this.refreshGracePeriod = t?.refreshGracePeriod ?? ua, this.cacheTime = t?.cacheTime ?? (typeof window > "u" ? ca : aa), this.cacheTime > 0 ? this.requestCache = new Ot(t?.resourceCacheSize ?? sa) : 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(() => {
42250
42250
  t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initComplete = true, this.dispatchEvent({ type: "storageInitialized" });
42251
42251
  }).catch((n) => {
42252
42252
  console.error(n), this.initComplete = true, this.dispatchEvent({ type: "storageInitFailed", payload: { error: n } });
@@ -42277,6 +42277,9 @@ var Nt = class extends H {
42277
42277
  getFhircastHubUrl() {
42278
42278
  return this.fhircastHubUrl;
42279
42279
  }
42280
+ getDefaultHeaders() {
42281
+ return this.defaultHeaders;
42282
+ }
42280
42283
  clear() {
42281
42284
  this.storage.clear(), typeof window < "u" && sessionStorage.clear(), this.clearActiveLogin();
42282
42285
  }
@@ -42396,7 +42399,7 @@ var Nt = class extends H {
42396
42399
  searchResources(t, n, i) {
42397
42400
  let s = "searchResources-" + this.fhirSearchUrl(t, n).toString(), a2 = this.getCacheEntry(s, i);
42398
42401
  if (a2) return a2.value;
42399
- let c = new M(this.search(t, n, i).then(Oi));
42402
+ let c = new M(this.search(t, n, i).then(Ii));
42400
42403
  return this.setCacheEntry(s, c), c;
42401
42404
  }
42402
42405
  async *searchResourcePages(t, n, i) {
@@ -42404,7 +42407,7 @@ var Nt = class extends H {
42404
42407
  for (; o; ) {
42405
42408
  let s = new URL(o).searchParams, a2 = await this.search(t, s, i), c = a2.link?.find((u2) => u2.relation === "next");
42406
42409
  if (!a2.entry?.length && !c) break;
42407
- yield Oi(a2), o = c?.url ? new URL(c.url) : void 0;
42410
+ yield Ii(a2), o = c?.url ? new URL(c.url) : void 0;
42408
42411
  }
42409
42412
  }
42410
42413
  searchValueSet(t, n, i) {
@@ -42421,7 +42424,7 @@ var Nt = class extends H {
42421
42424
  getCachedReference(t) {
42422
42425
  let n = t.reference;
42423
42426
  if (!n) return;
42424
- if (n === "system") return Pi;
42427
+ if (n === "system") return wi;
42425
42428
  let [i, o] = n.split("/");
42426
42429
  if (!(!i || !o)) return this.getCached(i, o);
42427
42430
  }
@@ -42432,12 +42435,12 @@ var Nt = class extends H {
42432
42435
  readReference(t, n) {
42433
42436
  let i = t.reference;
42434
42437
  if (!i) return new M(Promise.reject(new Error("Missing reference")));
42435
- if (i === "system") return new M(Promise.resolve(Pi));
42438
+ if (i === "system") return new M(Promise.resolve(wi));
42436
42439
  let [o, s] = i.split("/");
42437
42440
  return !o || !s ? new M(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
42438
42441
  }
42439
42442
  requestSchema(t) {
42440
- if (xn(t)) return Promise.resolve();
42443
+ if (Tn(t)) return Promise.resolve();
42441
42444
  let n = t + "-requestSchema", i = this.getCacheEntry(n, void 0);
42442
42445
  if (i) return i.value;
42443
42446
  let o = new M((async () => {
@@ -42482,13 +42485,13 @@ var Nt = class extends H {
42482
42485
  target
42483
42486
  }
42484
42487
  }`.replace(/\s+/g, " "), a2 = await this.graphql(s);
42485
- cr(a2.data.StructureDefinitionList);
42486
- for (let c of a2.data.SearchParameterList) Ar(c);
42488
+ ur(a2.data.StructureDefinitionList.filter((c) => c.name === t));
42489
+ for (let c of a2.data.SearchParameterList) Or(c);
42487
42490
  })());
42488
42491
  return this.setCacheEntry(n, o), o;
42489
42492
  }
42490
42493
  requestProfileSchema(t, n) {
42491
- if (!n?.expandProfile && Sn(t)) return Promise.resolve();
42494
+ if (!n?.expandProfile && En(t)) return Promise.resolve();
42492
42495
  let i = t + "-requestSchema" + (n?.expandProfile ? "-nested" : ""), o = this.getCacheEntry(i, void 0);
42493
42496
  if (o) return o.value;
42494
42497
  let s = new M((async () => {
@@ -42496,14 +42499,14 @@ var Nt = class extends H {
42496
42499
  let a2 = this.fhirUrl("StructureDefinition", "$expand-profile");
42497
42500
  a2.search = new URLSearchParams({ url: t }).toString();
42498
42501
  let c = await this.post(a2.toString(), {});
42499
- cr(c);
42502
+ ur(c);
42500
42503
  } else {
42501
42504
  let a2 = await this.searchOne("StructureDefinition", { url: t, _sort: "-_lastUpdated" });
42502
42505
  if (!a2) {
42503
42506
  console.warn(`No StructureDefinition found for ${t}!`);
42504
42507
  return;
42505
42508
  }
42506
- ur(a2);
42509
+ lr(a2);
42507
42510
  }
42508
42511
  })());
42509
42512
  return this.setCacheEntry(i, s), s;
@@ -42532,32 +42535,32 @@ var Nt = class extends H {
42532
42535
  return s || (s = t), this.cacheResource(s), this.invalidateUrl(this.fhirUrl(t.resourceType, t.id, "_history")), this.invalidateSearches(t.resourceType), s;
42533
42536
  }
42534
42537
  async createAttachment(t, n, i, o, s) {
42535
- let a2 = Ii(t, n, i, o), c = s ?? (typeof n == "object" ? n : {}), u2 = await this.createBinary(a2, c);
42538
+ let a2 = ki(t, n, i, o), c = s ?? (typeof n == "object" ? n : {}), u2 = await this.createBinary(a2, c);
42536
42539
  return { contentType: a2.contentType, url: u2.url, title: a2.filename };
42537
42540
  }
42538
42541
  createBinary(t, n, i, o, s) {
42539
- let a2 = Ii(t, n, i, o), c = s ?? (typeof n == "object" ? n : {}), { data: u2, contentType: p2, filename: m2, securityContext: v, onProgress: Q } = a2, _e = this.fhirUrl("Binary");
42540
- return m2 && _e.searchParams.set("_filename", m2), v?.reference && this.setRequestHeader(c, "X-Security-Context", v.reference), Q ? this.uploadwithProgress(_e, u2, p2, Q, c) : this.post(_e, u2, p2, c);
42542
+ let a2 = ki(t, n, i, o), c = s ?? (typeof n == "object" ? n : {}), { data: u2, contentType: p2, filename: m2, securityContext: x2, onProgress: Q } = a2, _e = this.fhirUrl("Binary");
42543
+ return m2 && _e.searchParams.set("_filename", m2), x2?.reference && this.setRequestHeader(c, "X-Security-Context", x2.reference), Q ? this.uploadwithProgress(_e, u2, p2, Q, c) : this.post(_e, u2, p2, c);
42541
42544
  }
42542
42545
  uploadwithProgress(t, n, i, o, s) {
42543
42546
  return new Promise((a2, c) => {
42544
42547
  let u2 = new XMLHttpRequest(), p2 = () => u2.abort();
42545
42548
  s?.signal?.addEventListener("abort", p2);
42546
- let m2 = (v) => {
42547
- s?.signal?.removeEventListener("abort", p2), v instanceof Error ? c(v) : a2(v);
42549
+ let m2 = (x2) => {
42550
+ s?.signal?.removeEventListener("abort", p2), x2 instanceof Error ? c(x2) : a2(x2);
42548
42551
  };
42549
- if (u2.responseType = "json", u2.onabort = () => m2(new DOMException("Request aborted", "AbortError")), u2.onerror = () => m2(new Error("Request error")), o && (u2.upload.onprogress = (v) => o(v), u2.upload.onload = (v) => o(v)), u2.onload = () => {
42550
- u2.status >= 200 && u2.status < 300 ? m2(u2.response) : m2(new d(Xe(u2.response || u2.statusText)));
42552
+ 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 = () => {
42553
+ u2.status >= 200 && u2.status < 300 ? m2(u2.response) : m2(new d(tt(u2.response || u2.statusText)));
42551
42554
  }, 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) {
42552
- let v = s.headers;
42553
- for (let [Q, _e] of Object.entries(v)) u2.setRequestHeader(Q, _e);
42555
+ let x2 = s.headers;
42556
+ for (let [Q, _e] of Object.entries(x2)) u2.setRequestHeader(Q, _e);
42554
42557
  }
42555
42558
  u2.send(n);
42556
42559
  });
42557
42560
  }
42558
42561
  async createPdf(t, n, i, o) {
42559
42562
  if (!this.createPdfImpl) throw new Error("PDF creation not enabled");
42560
- let s = ya(t, n, i, o), a2 = typeof n == "object" ? n : {}, { docDefinition: c, tableLayouts: u2, fonts: p2, ...m2 } = s, v = await this.createPdfImpl(c, u2, p2), Q = { ...m2, data: v, contentType: "application/pdf" };
42563
+ let s = xa(t, n, i, o), a2 = typeof n == "object" ? n : {}, { docDefinition: c, tableLayouts: u2, fonts: p2, ...m2 } = s, x2 = await this.createPdfImpl(c, u2, p2), Q = { ...m2, data: x2, contentType: "application/pdf" };
42561
42564
  return this.createBinary(Q, a2);
42562
42565
  }
42563
42566
  createComment(t, n, i) {
@@ -42604,19 +42607,22 @@ var Nt = class extends H {
42604
42607
  return this.get(`${this.fhirUrl(t, n)}/$graph?graph=${i}`, o);
42605
42608
  }
42606
42609
  pushToAgent(t, n, i, o, s, a2) {
42607
- return this.post(this.fhirUrl("Agent", pe(t), "$push"), { destination: typeof n == "string" ? n : le(n), body: i, contentType: o, waitForResponse: s }, D.FHIR_JSON, a2);
42610
+ return this.post(this.fhirUrl("Agent", de(t), "$push"), { destination: typeof n == "string" ? n : pe(n), body: i, contentType: o, waitForResponse: s }, D.FHIR_JSON, a2);
42608
42611
  }
42609
42612
  getActiveLogin() {
42610
42613
  return this.storage.getObject("activeLogin");
42611
42614
  }
42612
42615
  async setActiveLogin(t) {
42613
- (!this.sessionDetails?.profile || le(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();
42616
+ (!this.sessionDetails?.profile || pe(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();
42614
42617
  }
42615
42618
  getAccessToken() {
42616
42619
  return this.accessToken;
42617
42620
  }
42621
+ isAuthenticated(t) {
42622
+ return this.accessTokenExpires !== void 0 && Date.now() < this.accessTokenExpires - (t ?? this.refreshGracePeriod);
42623
+ }
42618
42624
  setAccessToken(t, n) {
42619
- this.accessToken = t, this.refreshToken = n, this.accessTokenExpires = Si(t), this.medplumServer = Ti(t);
42625
+ this.accessToken = t, this.refreshToken = n, this.accessTokenExpires = Ei(t), this.medplumServer = Si(t);
42620
42626
  }
42621
42627
  getLogins() {
42622
42628
  return this.storage.getObject("logins") ?? [];
@@ -42664,7 +42670,7 @@ var Nt = class extends H {
42664
42670
  async download(t, n = {}) {
42665
42671
  this.refreshPromise && await this.refreshPromise;
42666
42672
  let i = t.toString();
42667
- i.startsWith(ca) && (t = this.fhirUrl(i));
42673
+ i.startsWith(la) && (t = this.fhirUrl(i));
42668
42674
  let o = n.headers;
42669
42675
  return o || (o = {}, n.headers = o), o.Accept || (o.Accept = "*/*"), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
42670
42676
  }
@@ -42687,7 +42693,7 @@ var Nt = class extends H {
42687
42693
  return i.Prefer = "respond-async", this.request("POST", t, n);
42688
42694
  }
42689
42695
  get keyValue() {
42690
- return this.keyValueClient || (this.keyValueClient = new Vt(this)), this.keyValueClient;
42696
+ return this.keyValueClient || (this.keyValueClient = new Dt(this)), this.keyValueClient;
42691
42697
  }
42692
42698
  getCacheEntry(t, n) {
42693
42699
  if (!this.requestCache || n?.cache === "no-cache" || n?.cache === "reload") return;
@@ -42709,17 +42715,17 @@ var Nt = class extends H {
42709
42715
  if (s.status === 401) return this.handleUnauthenticated(t, n, i);
42710
42716
  if (s.status === 204 || s.status === 304) return;
42711
42717
  let c = s.headers.get("content-type")?.includes("json");
42712
- if (s.status === 404 && !c) throw new d(on);
42718
+ if (s.status === 404 && !c) throw new d(sn);
42713
42719
  let u2 = await this.parseBody(s, c);
42714
42720
  if (s.status === 200 && i.followRedirectOnOk || s.status === 201 && i.followRedirectOnCreated) {
42715
- let p2 = await Ai(s, u2);
42721
+ let p2 = await Oi(s, u2);
42716
42722
  if (p2) return this.request("GET", p2, { ...i, body: void 0 });
42717
42723
  }
42718
42724
  if (s.status === 202 && i.pollStatusOnAccepted) {
42719
- let m2 = await Ai(s, u2) ?? o.statusUrl;
42725
+ let m2 = await Oi(s, u2) ?? o.statusUrl;
42720
42726
  if (m2) return this.pollStatus(m2, i, o);
42721
42727
  }
42722
- if (s.status >= 400) throw new d(Xe(u2));
42728
+ if (s.status >= 400) throw new d(tt(u2));
42723
42729
  return u2;
42724
42730
  }
42725
42731
  async parseBody(t, n) {
@@ -42743,14 +42749,14 @@ var Nt = class extends H {
42743
42749
  } catch (a2) {
42744
42750
  if (a2.message === "Failed to fetch" && s === 0 && this.dispatchEvent({ type: "offline" }), a2.name === "AbortError" || s === i) throw a2;
42745
42751
  }
42746
- await br(o);
42752
+ await Rr(o);
42747
42753
  }
42748
42754
  throw new Error("Unreachable");
42749
42755
  }
42750
42756
  logRequest(t, n) {
42751
42757
  if (console.log(`> ${n.method} ${t}`), n.headers) {
42752
42758
  let i = n.headers;
42753
- for (let o of ut(Object.keys(i))) console.log(`> ${o}: ${i[o]}`);
42759
+ for (let o of pt(Object.keys(i))) console.log(`> ${o}: ${i[o]}`);
42754
42760
  }
42755
42761
  }
42756
42762
  logResponse(t) {
@@ -42761,7 +42767,7 @@ var Nt = class extends H {
42761
42767
  if (i.pollCount === void 0) n.headers && typeof n.headers == "object" && "Prefer" in n.headers && (o.headers = { ...n.headers }, delete o.headers.Prefer), i.statusUrl = t, i.pollCount = 1;
42762
42768
  else {
42763
42769
  let s = n.pollStatusPeriod ?? 1e3;
42764
- await br(s), i.pollCount++;
42770
+ await Rr(s), i.pollCount++;
42765
42771
  }
42766
42772
  return this.request("GET", t, o, i);
42767
42773
  }
@@ -42773,18 +42779,20 @@ var Nt = class extends H {
42773
42779
  try {
42774
42780
  o.resolve(await this.request(o.method, B(this.fhirBaseUrl, o.url), o.options));
42775
42781
  } catch (s) {
42776
- o.reject(new d(Xe(s)));
42782
+ o.reject(new d(tt(s)));
42777
42783
  }
42778
42784
  return;
42779
42785
  }
42780
42786
  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);
42781
42787
  for (let o = 0; o < t.length; o++) {
42782
42788
  let s = t[o], a2 = i.entry?.[o];
42783
- a2?.response?.outcome && !rr(a2.response.outcome) ? s.reject(new d(a2.response.outcome)) : s.resolve(a2?.resource);
42789
+ a2?.response?.outcome && !nr(a2.response.outcome) ? s.reject(new d(a2.response.outcome)) : s.resolve(a2?.resource);
42784
42790
  }
42785
42791
  }
42786
42792
  addFetchOptionsDefaults(t) {
42787
- this.setRequestHeader(t, "Accept", ra, true), this.options.extendedMode !== false && this.setRequestHeader(t, "X-Medplum", "extended"), t.body && this.setRequestHeader(t, "Content-Type", D.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");
42793
+ Object.entries(this.defaultHeaders).forEach(([n, i]) => {
42794
+ this.setRequestHeader(t, n, i);
42795
+ }), this.setRequestHeader(t, "Accept", ia, true), this.options.extendedMode !== false && this.setRequestHeader(t, "X-Medplum", "extended"), t.body && this.setRequestHeader(t, "Content-Type", D.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");
42788
42796
  }
42789
42797
  setRequestContentType(t, n) {
42790
42798
  this.setRequestHeader(t, "Content-Type", n);
@@ -42801,27 +42809,27 @@ var Nt = class extends H {
42801
42809
  return this.refresh() ? this.request(t, n, i) : (this.clear(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new d(Ee)));
42802
42810
  }
42803
42811
  async startPkce() {
42804
- let t = _r();
42812
+ let t = Nr();
42805
42813
  sessionStorage.setItem("pkceState", t);
42806
- let n = _r().slice(0, 128);
42814
+ let n = Nr().slice(0, 128);
42807
42815
  sessionStorage.setItem("codeVerifier", n);
42808
- let i = await fi(n), o = jn(i).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
42816
+ let i = await mi(n), o = Wn(i).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
42809
42817
  return sessionStorage.setItem("codeChallenge", o), { codeChallengeMethod: "S256", codeChallenge: o };
42810
42818
  }
42811
42819
  async requestAuthorization(t) {
42812
42820
  let n = await this.ensureCodeChallenge(t ?? {}), i = new URL(this.authorizeUrl);
42813
- 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 ?? wi()), 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());
42821
+ 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 ?? Ai()), 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());
42814
42822
  }
42815
42823
  processCode(t, n) {
42816
42824
  let i = new URLSearchParams();
42817
- if (i.set("grant_type", "authorization_code"), i.set("code", t), i.set("client_id", n?.clientId ?? this.clientId), i.set("redirect_uri", n?.redirectUri ?? wi()), typeof sessionStorage < "u") {
42825
+ if (i.set("grant_type", "authorization_code"), i.set("code", t), i.set("client_id", n?.clientId ?? this.clientId), i.set("redirect_uri", n?.redirectUri ?? Ai()), typeof sessionStorage < "u") {
42818
42826
  let o = sessionStorage.getItem("codeVerifier");
42819
42827
  o && i.set("code_verifier", o);
42820
42828
  }
42821
42829
  return this.fetchTokens(i);
42822
42830
  }
42823
42831
  refreshIfExpired(t) {
42824
- return t === void 0 && (t = this.refreshGracePeriod), !this.refreshPromise && this.accessTokenExpires !== void 0 && Date.now() > this.accessTokenExpires - t && this.refresh(), this.refreshPromise ?? Promise.resolve();
42832
+ return !this.refreshPromise && this.accessTokenExpires !== void 0 && !this.isAuthenticated(t) && this.refresh(), this.refreshPromise ?? Promise.resolve();
42825
42833
  }
42826
42834
  refresh() {
42827
42835
  if (this.refreshPromise) return this.refreshPromise;
@@ -42846,25 +42854,25 @@ var Nt = class extends H {
42846
42854
  return n.append("grant_type", "client_credentials"), n.append("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), n.append("client_assertion", t), this.fetchTokens(n);
42847
42855
  }
42848
42856
  setBasicAuth(t, n) {
42849
- this.clientId = t, this.clientSecret = n, this.basicAuth = di(t + ":" + n);
42857
+ this.clientId = t, this.clientSecret = n, this.basicAuth = fi(t + ":" + n);
42850
42858
  }
42851
42859
  async fhircastSubscribe(t, n) {
42852
42860
  if (!(typeof t == "string" && t !== "")) throw new d(h("Invalid topic provided. Topic must be a valid string."));
42853
42861
  if (!(typeof n == "object" && Array.isArray(n) && n.length > 0)) throw new d(h("Invalid events provided. Events must be an array of event names containing at least one event."));
42854
- let i = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post(this.fhircastHubUrl, Ur(i), D.FORM_URL_ENCODED))["hub.channel.endpoint"];
42862
+ let i = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post(this.fhircastHubUrl, Br(i), D.FORM_URL_ENCODED))["hub.channel.endpoint"];
42855
42863
  if (!s) throw new Error("Invalid response!");
42856
42864
  return i.endpoint = s, i;
42857
42865
  }
42858
42866
  async fhircastUnsubscribe(t) {
42859
- if (!It(t)) throw new d(h("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
42867
+ if (!kt(t)) throw new d(h("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
42860
42868
  if (!(t.endpoint && typeof t.endpoint == "string" && t.endpoint.startsWith("ws"))) throw new d(h("Provided subscription request must have an endpoint in order to unsubscribe."));
42861
- t.mode = "unsubscribe", await this.post(this.fhircastHubUrl, Ur(t), D.FORM_URL_ENCODED);
42869
+ t.mode = "unsubscribe", await this.post(this.fhircastHubUrl, Br(t), D.FORM_URL_ENCODED);
42862
42870
  }
42863
42871
  fhircastConnect(t) {
42864
- return new Ot(t);
42872
+ return new It(t);
42865
42873
  }
42866
42874
  async fhircastPublish(t, n, i, o) {
42867
- return yi(n) ? this.post(this.fhircastHubUrl, Br(t, n, i, o), D.JSON) : (gi(n), this.post(this.fhircastHubUrl, Br(t, n, i), D.JSON));
42875
+ return gi(n) ? this.post(this.fhircastHubUrl, qr(t, n, i, o), D.JSON) : (xi(n), this.post(this.fhircastHubUrl, qr(t, n, i), D.JSON));
42868
42876
  }
42869
42877
  async fhircastGetContext(t) {
42870
42878
  return this.get(`${this.fhircastHubUrl}/${t}`);
@@ -42874,7 +42882,7 @@ var Nt = class extends H {
42874
42882
  }
42875
42883
  async fetchTokens(t) {
42876
42884
  let n = { method: "POST", headers: { "Content-Type": D.FORM_URL_ENCODED }, body: t.toString(), credentials: "include" }, i = n.headers;
42877
- this.basicAuth && (i.Authorization = `Basic ${this.basicAuth}`);
42885
+ Object.assign(i, this.defaultHeaders), this.basicAuth && (i.Authorization = `Basic ${this.basicAuth}`);
42878
42886
  let o;
42879
42887
  try {
42880
42888
  o = await this.fetchWithRetry(this.tokenUrl, n);
@@ -42895,12 +42903,12 @@ var Nt = class extends H {
42895
42903
  }
42896
42904
  async verifyTokens(t) {
42897
42905
  let n = t.access_token;
42898
- if (xi(n)) {
42899
- let i = kt(n);
42900
- if (Date.now() >= i.exp * 1e3) throw this.clearActiveLogin(), new d(sn);
42906
+ if (Ti(n)) {
42907
+ let i = Vt(n);
42908
+ if (Date.now() >= i.exp * 1e3) throw this.clearActiveLogin(), new d(an);
42901
42909
  if (i.cid) {
42902
- if (i.cid !== this.clientId) throw this.clearActiveLogin(), new d(tr);
42903
- } else if (this.clientId && i.client_id !== this.clientId) throw this.clearActiveLogin(), new d(tr);
42910
+ if (i.cid !== this.clientId) throw this.clearActiveLogin(), new d(rr);
42911
+ } else if (this.clientId && i.client_id !== this.clientId) throw this.clearActiveLogin(), new d(rr);
42904
42912
  }
42905
42913
  return this.setActiveLogin({ accessToken: n, refreshToken: t.refresh_token, project: t.project, profile: t.profile });
42906
42914
  }
@@ -42920,7 +42928,7 @@ var Nt = class extends H {
42920
42928
  }
42921
42929
  }
42922
42930
  getSubscriptionManager() {
42923
- return this.subscriptionManager || (this.subscriptionManager = new _t(this, Qn(this.baseUrl, "/ws/subscriptions-r4"))), this.subscriptionManager;
42931
+ return this.subscriptionManager || (this.subscriptionManager = new Nt(this, Qn(this.baseUrl, "/ws/subscriptions-r4"))), this.subscriptionManager;
42924
42932
  }
42925
42933
  subscribeToCriteria(t, n) {
42926
42934
  return this.getSubscriptionManager().addCriteria(t, n);
@@ -42932,41 +42940,42 @@ var Nt = class extends H {
42932
42940
  return this.getSubscriptionManager().getMasterEmitter();
42933
42941
  }
42934
42942
  };
42935
- function fa() {
42943
+ function ha() {
42936
42944
  if (!globalThis.fetch) throw new Error("Fetch not available in this environment");
42937
42945
  return globalThis.fetch.bind(globalThis);
42938
42946
  }
42939
- function wi() {
42947
+ function Ai() {
42940
42948
  return typeof window > "u" ? "" : window.location.protocol + "//" + window.location.host + "/";
42941
42949
  }
42942
- async function Ai(r7, e) {
42950
+ async function Oi(r7, e) {
42943
42951
  let t = r7.headers.get("content-location");
42944
42952
  if (t) return t;
42945
42953
  let n = r7.headers.get("location");
42946
42954
  if (n) return n;
42947
42955
  if (be(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
42948
42956
  }
42949
- function Oi(r7) {
42957
+ function Ii(r7) {
42950
42958
  let e = r7.entry?.map((t) => t.resource) ?? [];
42951
42959
  return Object.assign(e, { bundle: r7 });
42952
42960
  }
42953
- function ma(r7) {
42961
+ function ya(r7) {
42954
42962
  return R(r7) && "data" in r7 && "contentType" in r7;
42955
42963
  }
42956
- function Ii(r7, e, t, n) {
42957
- return ma(r7) ? r7 : { data: r7, filename: e, contentType: t, onProgress: n };
42964
+ function ki(r7, e, t, n) {
42965
+ return ya(r7) ? r7 : { data: r7, filename: e, contentType: t, onProgress: n };
42958
42966
  }
42959
- function ha(r7) {
42967
+ function ga(r7) {
42960
42968
  return R(r7) && "docDefinition" in r7;
42961
42969
  }
42962
- function ya(r7, e, t, n) {
42963
- return ha(r7) ? r7 : { docDefinition: r7, filename: e, tableLayouts: t, fonts: n };
42970
+ function xa(r7, e, t, n) {
42971
+ return ga(r7) ? r7 : { docDefinition: r7, filename: e, tableLayouts: t, fonts: n };
42964
42972
  }
42965
- var Aa = [...qe, "->", "<<", ">>", "=="];
42966
- var ka = je().registerInfix("->", { precedence: y.Arrow }).registerInfix(";", { precedence: y.Semicolon });
42967
- var za = [...qe, "eq", "ne", "co"];
42968
- var Za = je();
42969
- var se = class {
42973
+ var Ia = [...je, "->", "<<", ">>", "=="];
42974
+ var Da = $e().registerInfix("->", { precedence: y.Arrow }).registerInfix(";", { precedence: y.Semicolon });
42975
+ var Ya = " ".repeat(2);
42976
+ var Xa = [...je, "eq", "ne", "co"];
42977
+ var rc = $e();
42978
+ var ae = class {
42970
42979
  constructor(e = "\r", t = "|", n = "^", i = "~", o = "\\", s = "&") {
42971
42980
  this.segmentSeparator = e;
42972
42981
  this.fieldSeparator = t;
@@ -42982,8 +42991,8 @@ var se = class {
42982
42991
  return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
42983
42992
  }
42984
42993
  };
42985
- var Qi = class r2 {
42986
- constructor(e, t = new se()) {
42994
+ var zi = class r2 {
42995
+ constructor(e, t = new ae()) {
42987
42996
  this.context = t, this.segments = e;
42988
42997
  }
42989
42998
  get header() {
@@ -43006,7 +43015,7 @@ var Qi = class r2 {
43006
43015
  }
43007
43016
  buildAck() {
43008
43017
  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";
43009
- return new r2([new Ke(["MSH", this.context.getMsh2(), o, s, n, i, ec(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", c], this.context), new Ke(["MSA", "AA", a2, "OK"], this.context)]);
43018
+ return new r2([new Je(["MSH", this.context.getMsh2(), o, s, n, i, ic(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", c], this.context), new Je(["MSA", "AA", a2, "OK"], this.context)]);
43010
43019
  }
43011
43020
  buildAckMessageType(e) {
43012
43021
  let t = e?.getField(9), n = t?.getComponent(2), i = t?.getComponent(3), o = "ACK";
@@ -43017,12 +43026,12 @@ var Qi = class r2 {
43017
43026
  let n = new Error("Invalid HL7 message");
43018
43027
  throw n.type = "entity.parse.failed", n;
43019
43028
  }
43020
- let t = new se("\r", e.charAt(3), e.charAt(4), e.charAt(5), e.charAt(6), e.charAt(7));
43021
- return new r2(e.split(/[\r\n]+/).map((n) => Ke.parse(n, t)), t);
43029
+ let t = new ae("\r", e.charAt(3), e.charAt(4), e.charAt(5), e.charAt(6), e.charAt(7));
43030
+ return new r2(e.split(/[\r\n]+/).map((n) => Je.parse(n, t)), t);
43022
43031
  }
43023
43032
  };
43024
- var Ke = class r3 {
43025
- constructor(e, t = new se()) {
43033
+ var Je = class r3 {
43034
+ constructor(e, t = new ae()) {
43026
43035
  this.context = t, Un(e) ? this.fields = e.map((n) => Me.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
43027
43036
  }
43028
43037
  get(e) {
@@ -43042,12 +43051,12 @@ var Ke = class r3 {
43042
43051
  toString() {
43043
43052
  return this.fields.map((e) => e.toString()).join(this.context.fieldSeparator);
43044
43053
  }
43045
- static parse(e, t = new se()) {
43054
+ static parse(e, t = new ae()) {
43046
43055
  return new r3(e.split(t.fieldSeparator).map((n) => Me.parse(n, t)), t);
43047
43056
  }
43048
43057
  };
43049
43058
  var Me = class r4 {
43050
- constructor(e, t = new se()) {
43059
+ constructor(e, t = new ae()) {
43051
43060
  this.context = t, this.components = e;
43052
43061
  }
43053
43062
  get(e, t, n = 0) {
@@ -43060,16 +43069,16 @@ var Me = class r4 {
43060
43069
  toString() {
43061
43070
  return this.components.map((e) => e.join(this.context.componentSeparator)).join(this.context.repetitionSeparator);
43062
43071
  }
43063
- static parse(e, t = new se()) {
43072
+ static parse(e, t = new ae()) {
43064
43073
  return new r4(e.split(t.repetitionSeparator).map((n) => n.split(t.componentSeparator)), t);
43065
43074
  }
43066
43075
  };
43067
- function ec(r7) {
43076
+ function ic(r7) {
43068
43077
  let e = r7 instanceof Date ? r7 : new Date(r7), n = e.toISOString().replace(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i = e.getUTCMilliseconds();
43069
43078
  return i > 0 && (n += "." + i.toString()), n;
43070
43079
  }
43071
- var zr = ((o) => (o[o.NONE = 0] = "NONE", o[o.ERROR = 1] = "ERROR", o[o.WARN = 2] = "WARN", o[o.INFO = 3] = "INFO", o[o.DEBUG = 4] = "DEBUG", o))(zr || {});
43072
- var Ki = class r5 {
43080
+ var Jr = ((o) => (o[o.NONE = 0] = "NONE", o[o.ERROR = 1] = "ERROR", o[o.WARN = 2] = "WARN", o[o.INFO = 3] = "INFO", o[o.DEBUG = 4] = "DEBUG", o))(Jr || {});
43081
+ var Ji = class r5 {
43073
43082
  constructor(e, t = {}, n = 3, i) {
43074
43083
  this.write = e;
43075
43084
  this.metadata = t;
@@ -43099,17 +43108,17 @@ var Ki = class r5 {
43099
43108
  }
43100
43109
  log(e, t, n) {
43101
43110
  e > this.level || (n instanceof Error && (n = { error: n.toString(), stack: n.stack?.split(`
43102
- `) }), this.write(JSON.stringify({ level: zr[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...n, ...this.metadata })));
43111
+ `) }), this.write(JSON.stringify({ level: Jr[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...n, ...this.metadata })));
43103
43112
  }
43104
43113
  };
43105
- function fm(r7) {
43106
- let e = zr[r7.toUpperCase()];
43114
+ function vm(r7) {
43115
+ let e = Jr[r7.toUpperCase()];
43107
43116
  if (e === void 0) throw new Error(`Invalid log level: ${r7}`);
43108
43117
  return e;
43109
43118
  }
43110
- var ac = "https://api.github.com/repos/medplum/medplum/releases";
43111
- var Qt = /* @__PURE__ */ new Map();
43112
- function cc(r7) {
43119
+ var pc = "https://api.github.com/repos/medplum/medplum/releases";
43120
+ var Kt = /* @__PURE__ */ new Map();
43121
+ function dc(r7) {
43113
43122
  let e = r7;
43114
43123
  if (!e.tag_name) throw new Error("Manifest missing tag_name");
43115
43124
  let t = e.assets;
@@ -43119,10 +43128,10 @@ function cc(r7) {
43119
43128
  if (!n.name) throw new Error("Asset missing name");
43120
43129
  }
43121
43130
  }
43122
- async function Ji(r7) {
43123
- let e = Qt.get(r7 ?? "latest");
43131
+ async function Zi(r7) {
43132
+ let e = Kt.get(r7 ?? "latest");
43124
43133
  if (!e) {
43125
- let t = r7 ? `tags/v${r7}` : "latest", n = await fetch(`${ac}/${t}`);
43134
+ let t = r7 ? `tags/v${r7}` : "latest", n = await fetch(`${pc}/${t}`);
43126
43135
  if (n.status !== 200) {
43127
43136
  let o;
43128
43137
  try {
@@ -43133,24 +43142,24 @@ async function Ji(r7) {
43133
43142
  throw new Error(`Received status code ${n.status} while fetching manifest for version '${r7 ?? "latest"}'. Message: ${o}`);
43134
43143
  }
43135
43144
  let i = await n.json();
43136
- cc(i), e = i, Qt.set(r7 ?? "latest", e), r7 || Qt.set(e.tag_name.slice(1), e);
43145
+ dc(i), e = i, Kt.set(r7 ?? "latest", e), r7 || Kt.set(e.tag_name.slice(1), e);
43137
43146
  }
43138
43147
  return e;
43139
43148
  }
43140
- function uc(r7) {
43149
+ function fc(r7) {
43141
43150
  return /^\d+\.\d+\.\d+$/.test(r7);
43142
43151
  }
43143
- async function wm(r7) {
43144
- if (!uc(r7)) return false;
43152
+ async function Dm(r7) {
43153
+ if (!fc(r7)) return false;
43145
43154
  try {
43146
- await Ji(r7);
43155
+ await Zi(r7);
43147
43156
  } catch {
43148
43157
  return false;
43149
43158
  }
43150
43159
  return true;
43151
43160
  }
43152
- async function Am() {
43153
- let r7 = await Ji();
43161
+ async function Mm() {
43162
+ let r7 = await Zi();
43154
43163
  if (!r7.tag_name.startsWith("v")) throw new Error(`Invalid release name found. Release tag '${r7.tag_name}' did not start with 'v'`);
43155
43164
  return r7.tag_name.slice(1);
43156
43165
  }
@@ -43198,7 +43207,7 @@ var p = class extends a {
43198
43207
  e.on("data", (s) => {
43199
43208
  try {
43200
43209
  if (this.appendData(s), s.at(-2) === 28 && s.at(-1) === 13) {
43201
- let o = Buffer.concat(this.chunks), i = o.subarray(1, o.length - 2), f2 = (0, import_iconv_lite.decode)(i, this.encoding), g2 = Qi.parse(f2);
43210
+ let o = Buffer.concat(this.chunks), i = o.subarray(1, o.length - 2), f2 = (0, import_iconv_lite.decode)(i, this.encoding), g2 = zi.parse(f2);
43202
43211
  this.dispatchEvent(new d2(this, g2)), this.resetBuffer();
43203
43212
  }
43204
43213
  } catch (o) {
@@ -43527,7 +43536,7 @@ var AgentHl7Channel = class extends BaseChannel {
43527
43536
  sendToRemote(msg) {
43528
43537
  const connection = this.connections.get(msg.remote);
43529
43538
  if (connection) {
43530
- connection.hl7Connection.send(Qi.parse(msg.body));
43539
+ connection.hl7Connection.send(zi.parse(msg.body));
43531
43540
  }
43532
43541
  }
43533
43542
  handleNewConnection(connection) {
@@ -43576,7 +43585,7 @@ var UPGRADER_LOG_PATH = (0, import_node_path2.resolve)(
43576
43585
  );
43577
43586
  var RELEASES_PATH = (0, import_node_path2.resolve)(__dirname);
43578
43587
  async function downloadRelease(version, path) {
43579
- const release = await Ji(version);
43588
+ const release = await Zi(version);
43580
43589
  const downloadUrl = parseDownloadUrl(release, (0, import_node_os2.platform)());
43581
43590
  const { body } = await fetch(downloadUrl);
43582
43591
  if (!body) {
@@ -43588,9 +43597,9 @@ async function downloadRelease(version, path) {
43588
43597
  writeStream.once("close", resolve2);
43589
43598
  });
43590
43599
  }
43591
- function parseDownloadUrl(release, os2) {
43600
+ function parseDownloadUrl(release, os) {
43592
43601
  let endingToMatch;
43593
- switch (os2) {
43602
+ switch (os) {
43594
43603
  case "win32":
43595
43604
  endingToMatch = ".exe";
43596
43605
  break;
@@ -43598,14 +43607,14 @@ function parseDownloadUrl(release, os2) {
43598
43607
  endingToMatch = "linux";
43599
43608
  break;
43600
43609
  default:
43601
- throw new Error(`Unsupported platform: ${os2}`);
43610
+ throw new Error(`Unsupported platform: ${os}`);
43602
43611
  }
43603
43612
  for (const asset of release.assets) {
43604
43613
  if (asset.name.endsWith(endingToMatch)) {
43605
43614
  return asset.browser_download_url;
43606
43615
  }
43607
43616
  }
43608
- throw new Error(`No download URL found for release '${release.tag_name}' for ${os2}`);
43617
+ throw new Error(`No download URL found for release '${release.tag_name}' for ${os}`);
43609
43618
  }
43610
43619
  function getReleaseBinPath(version) {
43611
43620
  let binaryName;
@@ -43652,7 +43661,7 @@ var App = class _App {
43652
43661
  this.shutdown = false;
43653
43662
  this.keepAlive = false;
43654
43663
  _App.instance = this;
43655
- this.log = new Ki((msg) => console.log(msg), void 0, logLevel);
43664
+ this.log = new Ji((msg) => console.log(msg), void 0, logLevel);
43656
43665
  }
43657
43666
  async start() {
43658
43667
  this.log.info("Medplum service starting...");
@@ -43672,7 +43681,7 @@ var App = class _App {
43672
43681
  if ((0, import_node_fs3.existsSync)(UPGRADE_MANIFEST_PATH)) {
43673
43682
  const upgradeFile = (0, import_node_fs3.readFileSync)(UPGRADE_MANIFEST_PATH, { encoding: "utf-8" });
43674
43683
  const upgradeDetails = JSON.parse(upgradeFile);
43675
- if (upgradeDetails.targetVersion === ef.split("-")[0]) {
43684
+ if (upgradeDetails.targetVersion === sf.split("-")[0]) {
43676
43685
  await this.sendToWebSocket({
43677
43686
  type: "agent:upgrade:response",
43678
43687
  statusCode: 200,
@@ -43680,7 +43689,7 @@ var App = class _App {
43680
43689
  });
43681
43690
  this.log.info(`Successfully upgraded to version ${upgradeDetails.targetVersion}`);
43682
43691
  } else {
43683
- const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${ef}`;
43692
+ const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${sf}`;
43684
43693
  await this.sendToWebSocket({
43685
43694
  type: "agent:error",
43686
43695
  body: errMsg,
@@ -43717,7 +43726,7 @@ var App = class _App {
43717
43726
  webSocketUrl.protocol = webSocketUrl.protocol === "https:" ? "wss:" : "ws:";
43718
43727
  webSocketUrl.pathname = "/ws/agent";
43719
43728
  this.log.info(`Connecting to WebSocket: ${webSocketUrl.href}`);
43720
- this.webSocket = new Mt(webSocketUrl.toString(), void 0, {
43729
+ this.webSocket = new _t(webSocketUrl.toString(), void 0, {
43721
43730
  WebSocket: wrapper_default,
43722
43731
  binaryType: "nodebuffer"
43723
43732
  });
@@ -43755,7 +43764,7 @@ var App = class _App {
43755
43764
  break;
43756
43765
  case "agent:heartbeat:request":
43757
43766
  this.outstandingHeartbeats = 0;
43758
- await this.sendToWebSocket({ type: "agent:heartbeat:response", version: ef });
43767
+ await this.sendToWebSocket({ type: "agent:heartbeat:response", version: sf });
43759
43768
  break;
43760
43769
  case "agent:heartbeat:response":
43761
43770
  this.outstandingHeartbeats = 0;
@@ -44030,7 +44039,7 @@ IPv6 is currently unsupported.`;
44030
44039
  this.log.error(errMsg);
44031
44040
  throw new Error(errMsg);
44032
44041
  }
44033
- if (!((0, import_node_net3.isIPv4)(message.remote) || nl(message.remote))) {
44042
+ if (!((0, import_node_net3.isIPv4)(message.remote) || cl(message.remote))) {
44034
44043
  const errMsg = `Attempted to ping an invalid host.
44035
44044
 
44036
44045
  "${message.remote}" is not a valid IPv4 address or a resolvable hostname.`;
@@ -44093,7 +44102,7 @@ ${result}`);
44093
44102
  return;
44094
44103
  }
44095
44104
  let child;
44096
- if (message.version && !await wm(message.version)) {
44105
+ if (message.version && !await Dm(message.version)) {
44097
44106
  const versionTag = message.version ? `v${message.version}` : "latest";
44098
44107
  const errMsg = `Error during upgrading to version '${versionTag}'. '${message.version}' is not a valid version`;
44099
44108
  this.log.error(errMsg);
@@ -44140,12 +44149,12 @@ ${result}`);
44140
44149
  try {
44141
44150
  await this.stop();
44142
44151
  this.log.info("Successfully stopped agent network services");
44143
- const targetVersion = message.version ?? await Am();
44144
- this.log.info("Writing upgrade manifest...", { previousVersion: ef, targetVersion });
44152
+ const targetVersion = message.version ?? await Mm();
44153
+ this.log.info("Writing upgrade manifest...", { previousVersion: sf, targetVersion });
44145
44154
  (0, import_node_fs3.writeFileSync)(
44146
44155
  UPGRADE_MANIFEST_PATH,
44147
44156
  JSON.stringify({
44148
- previousVersion: ef,
44157
+ previousVersion: sf,
44149
44158
  targetVersion,
44150
44159
  callback: message.callback ?? null
44151
44160
  }),
@@ -44213,7 +44222,7 @@ ${result}`);
44213
44222
  });
44214
44223
  }
44215
44224
  }
44216
- client.sendAndWait(Qi.parse(message.body)).then((response) => {
44225
+ client.sendAndWait(zi.parse(message.body)).then((response) => {
44217
44226
  this.log.info(`Response: ${response.toString().replaceAll("\r", "\n")}`);
44218
44227
  this.addToWebSocketQueue({
44219
44228
  type: "agent:transmit:response",
@@ -44280,9 +44289,9 @@ async function agentMain(argv) {
44280
44289
  process.exit(1);
44281
44290
  }
44282
44291
  const { baseUrl, clientId, clientSecret, agentId } = args;
44283
- const medplum = new Nt({ baseUrl, clientId });
44292
+ const medplum = new Lt({ baseUrl, clientId });
44284
44293
  await medplum.startClientLogin(clientId, clientSecret);
44285
- const app = new App(medplum, agentId, fm(args.logLevel ?? "INFO"));
44294
+ const app = new App(medplum, agentId, vm(args.logLevel ?? "INFO"));
44286
44295
  await app.start();
44287
44296
  process.on("SIGINT", async () => {
44288
44297
  console.log("Gracefully shutting down from SIGINT (Ctrl-C)");
@@ -44310,7 +44319,7 @@ async function upgraderMain(argv) {
44310
44319
  if ((0, import_node_os4.platform)() !== "win32") {
44311
44320
  throw new Error(`Unsupported platform: ${(0, import_node_os4.platform)()}. Agent upgrader currently only supports Windows`);
44312
44321
  }
44313
- const globalLogger = new Ki((msg) => console.log(msg));
44322
+ const globalLogger = new Ji((msg) => console.log(msg));
44314
44323
  if (!import_node_process2.default.send) {
44315
44324
  globalLogger.error("Upgrader not started as a child process with Node IPC enabled. Aborting...");
44316
44325
  import_node_process2.default.exit(1);
@@ -44323,10 +44332,10 @@ async function upgraderMain(argv) {
44323
44332
  });
44324
44333
  });
44325
44334
  import_node_process2.default.send({ type: "STARTED" });
44326
- if (argv[3] && !uc(argv[3])) {
44335
+ if (argv[3] && !fc(argv[3])) {
44327
44336
  throw new Error("Invalid version specified");
44328
44337
  }
44329
- const version = argv[3] ?? await Am();
44338
+ const version = argv[3] ?? await Mm();
44330
44339
  const binPath = getReleaseBinPath(version);
44331
44340
  if (!(0, import_node_fs5.existsSync)(binPath)) {
44332
44341
  globalLogger.info(`Could not find binary at "${binPath}". Downloading release from GitHub...`);