@medplum/agent 2.2.6 → 2.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cjs/index.cjs +825 -802
  2. package/package.json +1 -1
@@ -4470,23 +4470,23 @@ var require_AsyncEventEmitter = __commonJS({
4470
4470
  return self2;
4471
4471
  };
4472
4472
  AsyncEventEmitter.prototype.once = function(type, listener) {
4473
- var self2 = this, g3;
4473
+ var self2 = this, g2;
4474
4474
  if (typeof listener !== "function") {
4475
4475
  throw new TypeError("listener must be a function");
4476
4476
  }
4477
4477
  if (listener.length >= 2) {
4478
- g3 = function(e, next) {
4479
- self2.removeListener(type, g3);
4478
+ g2 = function(e, next) {
4479
+ self2.removeListener(type, g2);
4480
4480
  listener(e, next);
4481
4481
  };
4482
4482
  } else {
4483
- g3 = function(e) {
4484
- self2.removeListener(type, g3);
4483
+ g2 = function(e) {
4484
+ self2.removeListener(type, g2);
4485
4485
  listener(e);
4486
4486
  };
4487
4487
  }
4488
- g3.listener = listener;
4489
- self2.on(type, g3);
4488
+ g2.listener = listener;
4489
+ self2.on(type, g2);
4490
4490
  return self2;
4491
4491
  };
4492
4492
  AsyncEventEmitter.prototype.first = function(event, listener) {
@@ -4922,12 +4922,12 @@ var require_dcmjs = __commonJS({
4922
4922
  };
4923
4923
  return _getPrototypeOf(o);
4924
4924
  }
4925
- function _setPrototypeOf(o, p2) {
4926
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p3) {
4927
- o2.__proto__ = p3;
4925
+ function _setPrototypeOf(o, p3) {
4926
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p4) {
4927
+ o2.__proto__ = p4;
4928
4928
  return o2;
4929
4929
  };
4930
- return _setPrototypeOf(o, p2);
4930
+ return _setPrototypeOf(o, p3);
4931
4931
  }
4932
4932
  function _isNativeReflectConstruct() {
4933
4933
  if (typeof Reflect === "undefined" || !Reflect.construct)
@@ -5297,7 +5297,7 @@ var require_dcmjs = __commonJS({
5297
5297
  let n, m3;
5298
5298
  let bits;
5299
5299
  let xbits;
5300
- let f2;
5300
+ let f;
5301
5301
  let overflow = 0;
5302
5302
  for (bits = 0; bits <= MAX_BITS$1; bits++) {
5303
5303
  s.bl_count[bits] = 0;
@@ -5319,10 +5319,10 @@ var require_dcmjs = __commonJS({
5319
5319
  if (n >= base) {
5320
5320
  xbits = extra[n - base];
5321
5321
  }
5322
- f2 = tree[n * 2];
5323
- s.opt_len += f2 * (bits + xbits);
5322
+ f = tree[n * 2];
5323
+ s.opt_len += f * (bits + xbits);
5324
5324
  if (has_stree) {
5325
- s.static_len += f2 * (stree[n * 2 + 1] + xbits);
5325
+ s.static_len += f * (stree[n * 2 + 1] + xbits);
5326
5326
  }
5327
5327
  }
5328
5328
  if (overflow === 0) {
@@ -5958,8 +5958,8 @@ var require_dcmjs = __commonJS({
5958
5958
  strm.msg = messages[errorCode];
5959
5959
  return errorCode;
5960
5960
  };
5961
- const rank = (f2) => {
5962
- return (f2 << 1) - (f2 > 4 ? 9 : 0);
5961
+ const rank = (f) => {
5962
+ return (f << 1) - (f > 4 ? 9 : 0);
5963
5963
  };
5964
5964
  const zero$2 = (buf) => {
5965
5965
  let len2 = buf.length;
@@ -6067,7 +6067,7 @@ var require_dcmjs = __commonJS({
6067
6067
  };
6068
6068
  const fill_window = (s) => {
6069
6069
  const _w_size = s.w_size;
6070
- let p2, n, m3, more, str2;
6070
+ let p3, n, m3, more, str2;
6071
6071
  do {
6072
6072
  more = s.window_size - s.lookahead - s.strstart;
6073
6073
  if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {
@@ -6076,16 +6076,16 @@ var require_dcmjs = __commonJS({
6076
6076
  s.strstart -= _w_size;
6077
6077
  s.block_start -= _w_size;
6078
6078
  n = s.hash_size;
6079
- p2 = n;
6079
+ p3 = n;
6080
6080
  do {
6081
- m3 = s.head[--p2];
6082
- s.head[p2] = m3 >= _w_size ? m3 - _w_size : 0;
6081
+ m3 = s.head[--p3];
6082
+ s.head[p3] = m3 >= _w_size ? m3 - _w_size : 0;
6083
6083
  } while (--n);
6084
6084
  n = _w_size;
6085
- p2 = n;
6085
+ p3 = n;
6086
6086
  do {
6087
- m3 = s.prev[--p2];
6088
- s.prev[p2] = m3 >= _w_size ? m3 - _w_size : 0;
6087
+ m3 = s.prev[--p3];
6088
+ s.prev[p3] = m3 >= _w_size ? m3 - _w_size : 0;
6089
6089
  } while (--n);
6090
6090
  more += _w_size;
6091
6091
  }
@@ -6962,9 +6962,9 @@ var require_dcmjs = __commonJS({
6962
6962
  if (typeof source !== "object") {
6963
6963
  throw new TypeError(source + "must be non-object");
6964
6964
  }
6965
- for (const p2 in source) {
6966
- if (_has(source, p2)) {
6967
- obj[p2] = source[p2];
6965
+ for (const p3 in source) {
6966
+ if (_has(source, p3)) {
6967
+ obj[p3] = source[p3];
6968
6968
  }
6969
6969
  }
6970
6970
  }
@@ -9455,9 +9455,9 @@ var require_dcmjs = __commonJS({
9455
9455
  }, {
9456
9456
  key: "readVR",
9457
9457
  value: function readVR() {
9458
- var vr2 = String.fromCharCode(this.view.getUint8(this.offset)) + String.fromCharCode(this.view.getUint8(this.offset + 1));
9458
+ var vr = String.fromCharCode(this.view.getUint8(this.offset)) + String.fromCharCode(this.view.getUint8(this.offset + 1));
9459
9459
  this.increment(2);
9460
- return vr2;
9460
+ return vr;
9461
9461
  }
9462
9462
  }, {
9463
9463
  key: "readEncodedString",
@@ -9779,7 +9779,7 @@ var require_dcmjs = __commonJS({
9779
9779
  }
9780
9780
  }, {
9781
9781
  key: "is",
9782
- value: function is(t) {
9782
+ value: function is2(t) {
9783
9783
  return this.value == t;
9784
9784
  }
9785
9785
  }, {
@@ -9807,7 +9807,7 @@ var require_dcmjs = __commonJS({
9807
9807
  }, {
9808
9808
  key: "write",
9809
9809
  value: function write(stream, vrType, values, syntax, writeOptions) {
9810
- var vr2 = ValueRepresentation.createByTypeString(vrType), useSyntax = DicomMessage._normalizeSyntax(syntax);
9810
+ var vr = ValueRepresentation.createByTypeString(vrType), useSyntax = DicomMessage._normalizeSyntax(syntax);
9811
9811
  var implicit = useSyntax == IMPLICIT_LITTLE_ENDIAN ? true : false, isLittleEndian = useSyntax == IMPLICIT_LITTLE_ENDIAN || useSyntax == EXPLICIT_LITTLE_ENDIAN$1 ? true : false, isEncapsulated = this.isPixelDataTag() && DicomMessage.isEncapsulated(syntax);
9812
9812
  var oldEndian = stream.isLittleEndian;
9813
9813
  stream.setEndian(isLittleEndian);
@@ -9816,11 +9816,11 @@ var require_dcmjs = __commonJS({
9816
9816
  var tagStream = new WriteBufferStream(256), valueLength;
9817
9817
  tagStream.setEndian(isLittleEndian);
9818
9818
  if (vrType == "OW" || vrType == "OB" || vrType == "UN") {
9819
- valueLength = vr2.writeBytes(tagStream, values, useSyntax, isEncapsulated, writeOptions);
9819
+ valueLength = vr.writeBytes(tagStream, values, useSyntax, isEncapsulated, writeOptions);
9820
9820
  } else if (vrType == "SQ") {
9821
- valueLength = vr2.writeBytes(tagStream, values, useSyntax, writeOptions);
9821
+ valueLength = vr.writeBytes(tagStream, values, useSyntax, writeOptions);
9822
9822
  } else {
9823
- valueLength = vr2.writeBytes(tagStream, values, writeOptions);
9823
+ valueLength = vr.writeBytes(tagStream, values, writeOptions);
9824
9824
  }
9825
9825
  if (vrType == "SQ") {
9826
9826
  valueLength = 4294967295;
@@ -9830,13 +9830,13 @@ var require_dcmjs = __commonJS({
9830
9830
  stream.writeUint32(valueLength);
9831
9831
  written += 4;
9832
9832
  } else {
9833
- if (vr2.isExplicit()) {
9834
- stream.writeAsciiString(vr2.type);
9833
+ if (vr.isExplicit()) {
9834
+ stream.writeAsciiString(vr.type);
9835
9835
  stream.writeUint16(0);
9836
9836
  stream.writeUint32(valueLength);
9837
9837
  written += 8;
9838
9838
  } else {
9839
- stream.writeAsciiString(vr2.type);
9839
+ stream.writeAsciiString(vr.type);
9840
9840
  stream.writeUint16(valueLength);
9841
9841
  written += 4;
9842
9842
  }
@@ -10141,20 +10141,20 @@ var require_dcmjs = __commonJS({
10141
10141
  }, {
10142
10142
  key: "createByTypeString",
10143
10143
  value: function createByTypeString(type) {
10144
- var vr2 = VRinstances[type];
10145
- if (vr2 === void 0) {
10144
+ var vr = VRinstances[type];
10145
+ if (vr === void 0) {
10146
10146
  if (type == "ox") {
10147
10147
  validationLog.error("Invalid vr type", type, "- using OW");
10148
- vr2 = VRinstances["OW"];
10148
+ vr = VRinstances["OW"];
10149
10149
  } else if (type == "xs") {
10150
10150
  validationLog.error("Invalid vr type", type, "- using US");
10151
- vr2 = VRinstances["US"];
10151
+ vr = VRinstances["US"];
10152
10152
  } else {
10153
10153
  validationLog.error("Invalid vr type", type, "- using UN");
10154
- vr2 = VRinstances["UN"];
10154
+ vr = VRinstances["UN"];
10155
10155
  }
10156
10156
  }
10157
- return vr2;
10157
+ return vr;
10158
10158
  }
10159
10159
  }]);
10160
10160
  return ValueRepresentation2;
@@ -10606,17 +10606,17 @@ var require_dcmjs = __commonJS({
10606
10606
  key: "readBytes",
10607
10607
  value: function readBytes(stream, length2) {
10608
10608
  var BACKSLASH = String.fromCharCode(VM_DELIMITER);
10609
- var is = stream.readAsciiString(length2).trim();
10610
- is = is.replace(/[^0-9.\\\-+e]/gi, "");
10611
- if (is.indexOf(BACKSLASH) !== -1) {
10612
- var integerStringArray = is.split(BACKSLASH);
10613
- is = integerStringArray.map(function(is2) {
10614
- return is2 === "" ? null : Number(is2);
10609
+ var is2 = stream.readAsciiString(length2).trim();
10610
+ is2 = is2.replace(/[^0-9.\\\-+e]/gi, "");
10611
+ if (is2.indexOf(BACKSLASH) !== -1) {
10612
+ var integerStringArray = is2.split(BACKSLASH);
10613
+ is2 = integerStringArray.map(function(is3) {
10614
+ return is3 === "" ? null : Number(is3);
10615
10615
  });
10616
10616
  } else {
10617
- is = [is === "" ? null : Number(is)];
10617
+ is2 = [is2 === "" ? null : Number(is2)];
10618
10618
  }
10619
- return is;
10619
+ return is2;
10620
10620
  }
10621
10621
  }, {
10622
10622
  key: "formatValue",
@@ -10627,8 +10627,8 @@ var require_dcmjs = __commonJS({
10627
10627
  key: "writeBytes",
10628
10628
  value: function writeBytes(stream, value, writeOptions) {
10629
10629
  var _this12 = this;
10630
- var val = Array.isArray(value) ? value.map(function(is) {
10631
- return _this12.formatValue(is);
10630
+ var val = Array.isArray(value) ? value.map(function(is2) {
10631
+ return _this12.formatValue(is2);
10632
10632
  }) : [this.formatValue(value)];
10633
10633
  return _get(_getPrototypeOf(IntegerString2.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
10634
10634
  }
@@ -10845,8 +10845,8 @@ var require_dcmjs = __commonJS({
10845
10845
  if (undef) {
10846
10846
  var stack = 0;
10847
10847
  while (1) {
10848
- var g3 = stream.readUint16();
10849
- if (g3 == 65534) {
10848
+ var g2 = stream.readUint16();
10849
+ if (g2 == 65534) {
10850
10850
  var ge = stream.readUint16();
10851
10851
  var itemLength = stream.readUint32();
10852
10852
  stream.increment(-4);
@@ -11432,7 +11432,7 @@ var require_dcmjs = __commonJS({
11432
11432
  log.error("No value representation given for", naturalName);
11433
11433
  }
11434
11434
  }
11435
- var vr2 = ValueRepresentation.createByTypeString(dataItem.vr);
11435
+ var vr = ValueRepresentation.createByTypeString(dataItem.vr);
11436
11436
  dataItem.Value = DicomMetaDictionary2.denaturalizeValue(dataItem.Value);
11437
11437
  if (entry.vr == "SQ") {
11438
11438
  var unnaturalValues = [];
@@ -11442,11 +11442,11 @@ var require_dcmjs = __commonJS({
11442
11442
  }
11443
11443
  dataItem.Value = unnaturalValues;
11444
11444
  }
11445
- if (!vr2.isBinary() && vr2.maxLength) {
11445
+ if (!vr.isBinary() && vr.maxLength) {
11446
11446
  dataItem.Value = dataItem.Value.map(function(value) {
11447
- if (value.length > vr2.maxLength) {
11448
- log.warn("Truncating value ".concat(value, " of ").concat(naturalName, " because it is longer than ").concat(vr2.maxLength));
11449
- return value.slice(0, vr2.maxLength);
11447
+ if (value.length > vr.maxLength) {
11448
+ log.warn("Truncating value ".concat(value, " of ").concat(naturalName, " because it is longer than ").concat(vr.maxLength));
11449
+ return value.slice(0, vr.maxLength);
11450
11450
  } else {
11451
11451
  return value;
11452
11452
  }
@@ -11727,9 +11727,9 @@ var require_dcmjs = __commonJS({
11727
11727
  }
11728
11728
  }, {
11729
11729
  key: "writeTagObject",
11730
- value: function writeTagObject(stream, tagString, vr2, values, syntax, writeOptions) {
11730
+ value: function writeTagObject(stream, tagString, vr, values, syntax, writeOptions) {
11731
11731
  var tag = Tag.fromString(tagString);
11732
- tag.write(stream, vr2, values, syntax, writeOptions);
11732
+ tag.write(stream, vr, values, syntax, writeOptions);
11733
11733
  }
11734
11734
  }, {
11735
11735
  key: "write",
@@ -11763,7 +11763,7 @@ var require_dcmjs = __commonJS({
11763
11763
  };
11764
11764
  }
11765
11765
  }
11766
- var length2 = null, vr2 = null, vrType;
11766
+ var length2 = null, vr = null, vrType;
11767
11767
  if (implicit) {
11768
11768
  length2 = stream.readUint32();
11769
11769
  var elementData = DicomMessage2.lookupTag(tag);
@@ -11782,11 +11782,11 @@ var require_dcmjs = __commonJS({
11782
11782
  vrType = "UN";
11783
11783
  }
11784
11784
  }
11785
- vr2 = ValueRepresentation.createByTypeString(vrType);
11785
+ vr = ValueRepresentation.createByTypeString(vrType);
11786
11786
  } else {
11787
11787
  vrType = stream.readVR();
11788
- vr2 = ValueRepresentation.createByTypeString(vrType);
11789
- if (vr2.isExplicit()) {
11788
+ vr = ValueRepresentation.createByTypeString(vrType);
11789
+ if (vr.isExplicit()) {
11790
11790
  stream.increment(2);
11791
11791
  length2 = stream.readUint32();
11792
11792
  } else {
@@ -11794,21 +11794,21 @@ var require_dcmjs = __commonJS({
11794
11794
  }
11795
11795
  }
11796
11796
  var values = [];
11797
- if (vr2.isBinary() && length2 > vr2.maxLength && !vr2.noMultiple) {
11798
- var times = length2 / vr2.maxLength, i2 = 0;
11797
+ if (vr.isBinary() && length2 > vr.maxLength && !vr.noMultiple) {
11798
+ var times = length2 / vr.maxLength, i2 = 0;
11799
11799
  while (i2++ < times) {
11800
- values.push(vr2.read(stream, vr2.maxLength, syntax));
11800
+ values.push(vr.read(stream, vr.maxLength, syntax));
11801
11801
  }
11802
11802
  } else {
11803
- var val = vr2.read(stream, length2, syntax);
11804
- if (!vr2.isBinary() && singleVRs.indexOf(vr2.type) == -1) {
11803
+ var val = vr.read(stream, length2, syntax);
11804
+ if (!vr.isBinary() && singleVRs.indexOf(vr.type) == -1) {
11805
11805
  values = val;
11806
11806
  if (typeof val === "string") {
11807
11807
  values = val.split(String.fromCharCode(VM_DELIMITER));
11808
11808
  }
11809
- } else if (vr2.type == "SQ") {
11809
+ } else if (vr.type == "SQ") {
11810
11810
  values = val;
11811
- } else if (vr2.type == "OW" || vr2.type == "OB") {
11811
+ } else if (vr.type == "OW" || vr.type == "OB") {
11812
11812
  values = val;
11813
11813
  } else {
11814
11814
  Array.isArray(val) ? values = val : values.push(val);
@@ -11817,7 +11817,7 @@ var require_dcmjs = __commonJS({
11817
11817
  stream.setEndian(oldEndian);
11818
11818
  var retObj = ValueRepresentation.addTagAccessors({
11819
11819
  tag,
11820
- vr: vr2
11820
+ vr
11821
11821
  });
11822
11822
  retObj.values = values;
11823
11823
  return retObj;
@@ -11839,12 +11839,12 @@ var require_dcmjs = __commonJS({
11839
11839
  }
11840
11840
  _createClass(DicomDict2, [{
11841
11841
  key: "upsertTag",
11842
- value: function upsertTag(tag, vr2, values) {
11842
+ value: function upsertTag(tag, vr, values) {
11843
11843
  if (this.dict[tag]) {
11844
11844
  this.dict[tag].Value = values;
11845
11845
  } else {
11846
11846
  this.dict[tag] = ValueRepresentation.addTagAccessors({
11847
- vr: vr2
11847
+ vr
11848
11848
  });
11849
11849
  this.dict[tag].Value = values;
11850
11850
  }
@@ -15052,8 +15052,8 @@ var require_dcmjs = __commonJS({
15052
15052
  var imageId = images[frame].imageId;
15053
15053
  var imageIdSpecificToolState = toolState[imageId];
15054
15054
  var brushPixelData = imageIdSpecificToolState.brush.data[segmentIndex].pixelData;
15055
- for (var p2 = 0; p2 < brushPixelData.length; p2++) {
15056
- pixelData[pixelDataIndex] = brushPixelData[p2];
15055
+ for (var p3 = 0; p3 < brushPixelData.length; p3++) {
15056
+ pixelData[pixelDataIndex] = brushPixelData[p3];
15057
15057
  pixelDataIndex++;
15058
15058
  }
15059
15059
  }
@@ -15196,11 +15196,11 @@ var require_dcmjs = __commonJS({
15196
15196
  var _pixelData2D$shape = _slicedToArray(pixelData2D.shape, 2);
15197
15197
  _pixelData2D$shape[0];
15198
15198
  _pixelData2D$shape[1];
15199
- for (var p2 = 0; p2 < cToolsPixelData.length; p2++) {
15200
- if (pixelData2D.data[p2]) {
15201
- cToolsPixelData[p2] = 1;
15199
+ for (var p3 = 0; p3 < cToolsPixelData.length; p3++) {
15200
+ if (pixelData2D.data[p3]) {
15201
+ cToolsPixelData[p3] = 1;
15202
15202
  } else {
15203
- cToolsPixelData[p2] = 0;
15203
+ cToolsPixelData[p3] = 0;
15204
15204
  }
15205
15205
  }
15206
15206
  }
@@ -15287,11 +15287,11 @@ var require_dcmjs = __commonJS({
15287
15287
  var RANDOM = Math.random;
15288
15288
  if (!Math.hypot)
15289
15289
  Math.hypot = function() {
15290
- var y = 0, i2 = arguments.length;
15290
+ var y2 = 0, i2 = arguments.length;
15291
15291
  while (i2--) {
15292
- y += arguments[i2] * arguments[i2];
15292
+ y2 += arguments[i2] * arguments[i2];
15293
15293
  }
15294
- return Math.sqrt(y);
15294
+ return Math.sqrt(y2);
15295
15295
  };
15296
15296
  function create() {
15297
15297
  var out = new ARRAY_TYPE(3);
@@ -15311,14 +15311,14 @@ var require_dcmjs = __commonJS({
15311
15311
  }
15312
15312
  function length(a) {
15313
15313
  var x = a[0];
15314
- var y = a[1];
15314
+ var y2 = a[1];
15315
15315
  var z2 = a[2];
15316
- return Math.hypot(x, y, z2);
15316
+ return Math.hypot(x, y2, z2);
15317
15317
  }
15318
- function fromValues(x, y, z2) {
15318
+ function fromValues(x, y2, z2) {
15319
15319
  var out = new ARRAY_TYPE(3);
15320
15320
  out[0] = x;
15321
- out[1] = y;
15321
+ out[1] = y2;
15322
15322
  out[2] = z2;
15323
15323
  return out;
15324
15324
  }
@@ -15328,9 +15328,9 @@ var require_dcmjs = __commonJS({
15328
15328
  out[2] = a[2];
15329
15329
  return out;
15330
15330
  }
15331
- function set(out, x, y, z2) {
15331
+ function set(out, x, y2, z2) {
15332
15332
  out[0] = x;
15333
- out[1] = y;
15333
+ out[1] = y2;
15334
15334
  out[2] = z2;
15335
15335
  return out;
15336
15336
  }
@@ -15402,21 +15402,21 @@ var require_dcmjs = __commonJS({
15402
15402
  }
15403
15403
  function distance(a, b2) {
15404
15404
  var x = b2[0] - a[0];
15405
- var y = b2[1] - a[1];
15405
+ var y2 = b2[1] - a[1];
15406
15406
  var z2 = b2[2] - a[2];
15407
- return Math.hypot(x, y, z2);
15407
+ return Math.hypot(x, y2, z2);
15408
15408
  }
15409
15409
  function squaredDistance(a, b2) {
15410
15410
  var x = b2[0] - a[0];
15411
- var y = b2[1] - a[1];
15411
+ var y2 = b2[1] - a[1];
15412
15412
  var z2 = b2[2] - a[2];
15413
- return x * x + y * y + z2 * z2;
15413
+ return x * x + y2 * y2 + z2 * z2;
15414
15414
  }
15415
15415
  function squaredLength(a) {
15416
15416
  var x = a[0];
15417
- var y = a[1];
15417
+ var y2 = a[1];
15418
15418
  var z2 = a[2];
15419
- return x * x + y * y + z2 * z2;
15419
+ return x * x + y2 * y2 + z2 * z2;
15420
15420
  }
15421
15421
  function negate(out, a) {
15422
15422
  out[0] = -a[0];
@@ -15432,9 +15432,9 @@ var require_dcmjs = __commonJS({
15432
15432
  }
15433
15433
  function normalize$1(out, a) {
15434
15434
  var x = a[0];
15435
- var y = a[1];
15435
+ var y2 = a[1];
15436
15436
  var z2 = a[2];
15437
- var len2 = x * x + y * y + z2 * z2;
15437
+ var len2 = x * x + y2 * y2 + z2 * z2;
15438
15438
  if (len2 > 0) {
15439
15439
  len2 = 1 / Math.sqrt(len2);
15440
15440
  }
@@ -15498,25 +15498,25 @@ var require_dcmjs = __commonJS({
15498
15498
  return out;
15499
15499
  }
15500
15500
  function transformMat4(out, a, m3) {
15501
- var x = a[0], y = a[1], z2 = a[2];
15502
- var w2 = m3[3] * x + m3[7] * y + m3[11] * z2 + m3[15];
15501
+ var x = a[0], y2 = a[1], z2 = a[2];
15502
+ var w2 = m3[3] * x + m3[7] * y2 + m3[11] * z2 + m3[15];
15503
15503
  w2 = w2 || 1;
15504
- out[0] = (m3[0] * x + m3[4] * y + m3[8] * z2 + m3[12]) / w2;
15505
- out[1] = (m3[1] * x + m3[5] * y + m3[9] * z2 + m3[13]) / w2;
15506
- out[2] = (m3[2] * x + m3[6] * y + m3[10] * z2 + m3[14]) / w2;
15504
+ out[0] = (m3[0] * x + m3[4] * y2 + m3[8] * z2 + m3[12]) / w2;
15505
+ out[1] = (m3[1] * x + m3[5] * y2 + m3[9] * z2 + m3[13]) / w2;
15506
+ out[2] = (m3[2] * x + m3[6] * y2 + m3[10] * z2 + m3[14]) / w2;
15507
15507
  return out;
15508
15508
  }
15509
15509
  function transformMat3(out, a, m3) {
15510
- var x = a[0], y = a[1], z2 = a[2];
15511
- out[0] = x * m3[0] + y * m3[3] + z2 * m3[6];
15512
- out[1] = x * m3[1] + y * m3[4] + z2 * m3[7];
15513
- out[2] = x * m3[2] + y * m3[5] + z2 * m3[8];
15510
+ var x = a[0], y2 = a[1], z2 = a[2];
15511
+ out[0] = x * m3[0] + y2 * m3[3] + z2 * m3[6];
15512
+ out[1] = x * m3[1] + y2 * m3[4] + z2 * m3[7];
15513
+ out[2] = x * m3[2] + y2 * m3[5] + z2 * m3[8];
15514
15514
  return out;
15515
15515
  }
15516
15516
  function transformQuat(out, a, q) {
15517
15517
  var qx = q[0], qy = q[1], qz = q[2], qw = q[3];
15518
- var x = a[0], y = a[1], z2 = a[2];
15519
- var uvx = qy * z2 - qz * y, uvy = qz * x - qx * z2, uvz = qx * y - qy * x;
15518
+ var x = a[0], y2 = a[1], z2 = a[2];
15519
+ var uvx = qy * z2 - qz * y2, uvy = qz * x - qx * z2, uvz = qx * y2 - qy * x;
15520
15520
  var uuvx = qy * uvz - qz * uvy, uuvy = qz * uvx - qx * uvz, uuvz = qx * uvy - qy * uvx;
15521
15521
  var w2 = qw * 2;
15522
15522
  uvx *= w2;
@@ -15526,44 +15526,44 @@ var require_dcmjs = __commonJS({
15526
15526
  uuvy *= 2;
15527
15527
  uuvz *= 2;
15528
15528
  out[0] = x + uvx + uuvx;
15529
- out[1] = y + uvy + uuvy;
15529
+ out[1] = y2 + uvy + uuvy;
15530
15530
  out[2] = z2 + uvz + uuvz;
15531
15531
  return out;
15532
15532
  }
15533
15533
  function rotateX(out, a, b2, rad) {
15534
- var p2 = [], r4 = [];
15535
- p2[0] = a[0] - b2[0];
15536
- p2[1] = a[1] - b2[1];
15537
- p2[2] = a[2] - b2[2];
15538
- r4[0] = p2[0];
15539
- r4[1] = p2[1] * Math.cos(rad) - p2[2] * Math.sin(rad);
15540
- r4[2] = p2[1] * Math.sin(rad) + p2[2] * Math.cos(rad);
15534
+ var p3 = [], r4 = [];
15535
+ p3[0] = a[0] - b2[0];
15536
+ p3[1] = a[1] - b2[1];
15537
+ p3[2] = a[2] - b2[2];
15538
+ r4[0] = p3[0];
15539
+ r4[1] = p3[1] * Math.cos(rad) - p3[2] * Math.sin(rad);
15540
+ r4[2] = p3[1] * Math.sin(rad) + p3[2] * Math.cos(rad);
15541
15541
  out[0] = r4[0] + b2[0];
15542
15542
  out[1] = r4[1] + b2[1];
15543
15543
  out[2] = r4[2] + b2[2];
15544
15544
  return out;
15545
15545
  }
15546
15546
  function rotateY(out, a, b2, rad) {
15547
- var p2 = [], r4 = [];
15548
- p2[0] = a[0] - b2[0];
15549
- p2[1] = a[1] - b2[1];
15550
- p2[2] = a[2] - b2[2];
15551
- r4[0] = p2[2] * Math.sin(rad) + p2[0] * Math.cos(rad);
15552
- r4[1] = p2[1];
15553
- r4[2] = p2[2] * Math.cos(rad) - p2[0] * Math.sin(rad);
15547
+ var p3 = [], r4 = [];
15548
+ p3[0] = a[0] - b2[0];
15549
+ p3[1] = a[1] - b2[1];
15550
+ p3[2] = a[2] - b2[2];
15551
+ r4[0] = p3[2] * Math.sin(rad) + p3[0] * Math.cos(rad);
15552
+ r4[1] = p3[1];
15553
+ r4[2] = p3[2] * Math.cos(rad) - p3[0] * Math.sin(rad);
15554
15554
  out[0] = r4[0] + b2[0];
15555
15555
  out[1] = r4[1] + b2[1];
15556
15556
  out[2] = r4[2] + b2[2];
15557
15557
  return out;
15558
15558
  }
15559
15559
  function rotateZ(out, a, b2, rad) {
15560
- var p2 = [], r4 = [];
15561
- p2[0] = a[0] - b2[0];
15562
- p2[1] = a[1] - b2[1];
15563
- p2[2] = a[2] - b2[2];
15564
- r4[0] = p2[0] * Math.cos(rad) - p2[1] * Math.sin(rad);
15565
- r4[1] = p2[0] * Math.sin(rad) + p2[1] * Math.cos(rad);
15566
- r4[2] = p2[2];
15560
+ var p3 = [], r4 = [];
15561
+ p3[0] = a[0] - b2[0];
15562
+ p3[1] = a[1] - b2[1];
15563
+ p3[2] = a[2] - b2[2];
15564
+ r4[0] = p3[0] * Math.cos(rad) - p3[1] * Math.sin(rad);
15565
+ r4[1] = p3[0] * Math.sin(rad) + p3[1] * Math.cos(rad);
15566
+ r4[2] = p3[2];
15567
15567
  out[0] = r4[0] + b2[0];
15568
15568
  out[1] = r4[1] + b2[1];
15569
15569
  out[2] = r4[2] + b2[2];
@@ -15787,8 +15787,8 @@ var require_dcmjs = __commonJS({
15787
15787
  if (byteValue <= 127) {
15788
15788
  var N2 = byteValue + 1;
15789
15789
  var next = i2 + 1;
15790
- for (var p2 = next; p2 < next + N2; p2++) {
15791
- pixelData[pixelDataIndex] = uInt8Frame[p2];
15790
+ for (var p3 = next; p3 < next + N2; p3++) {
15791
+ pixelData[pixelDataIndex] = uInt8Frame[p3];
15792
15792
  pixelDataIndex++;
15793
15793
  }
15794
15794
  i2 += N2 + 1;
@@ -18194,10 +18194,10 @@ var require_dcmjs = __commonJS({
18194
18194
  rgba.push(255);
18195
18195
  return rgba;
18196
18196
  }
18197
- function cross(x, y, out) {
18198
- var Zx = x[1] * y[2] - x[2] * y[1];
18199
- var Zy = x[2] * y[0] - x[0] * y[2];
18200
- var Zz = x[0] * y[1] - x[1] * y[0];
18197
+ function cross(x, y2, out) {
18198
+ var Zx = x[1] * y2[2] - x[2] * y2[1];
18199
+ var Zy = x[2] * y2[0] - x[0] * y2[2];
18200
+ var Zz = x[0] * y2[1] - x[1] * y2[0];
18201
18201
  out[0] = Zx;
18202
18202
  out[1] = Zy;
18203
18203
  out[2] = Zz;
@@ -21714,7 +21714,7 @@ var require_dcmjs = __commonJS({
21714
21714
  __proto__: null,
21715
21715
  Comprehensive3DSR
21716
21716
  });
21717
- var sr2 = {
21717
+ var sr = {
21718
21718
  coding,
21719
21719
  contentItems,
21720
21720
  documents,
@@ -22026,7 +22026,7 @@ var require_dcmjs = __commonJS({
22026
22026
  data,
22027
22027
  derivations,
22028
22028
  normalizers,
22029
- sr: sr2,
22029
+ sr,
22030
22030
  utilities,
22031
22031
  log,
22032
22032
  anonymizer
@@ -22039,7 +22039,7 @@ var require_dcmjs = __commonJS({
22039
22039
  exports2.derivations = derivations;
22040
22040
  exports2.log = log;
22041
22041
  exports2.normalizers = normalizers;
22042
- exports2.sr = sr2;
22042
+ exports2.sr = sr;
22043
22043
  exports2.utilities = utilities;
22044
22044
  Object.defineProperty(exports2, "__esModule", { value: true });
22045
22045
  });
@@ -25473,7 +25473,7 @@ var require_ms = __commonJS({
25473
25473
  var h3 = m3 * 60;
25474
25474
  var d3 = h3 * 24;
25475
25475
  var w2 = d3 * 7;
25476
- var y = d3 * 365.25;
25476
+ var y2 = d3 * 365.25;
25477
25477
  module2.exports = function(val, options) {
25478
25478
  options = options || {};
25479
25479
  var type = typeof val;
@@ -25505,7 +25505,7 @@ var require_ms = __commonJS({
25505
25505
  case "yrs":
25506
25506
  case "yr":
25507
25507
  case "y":
25508
- return n * y;
25508
+ return n * y2;
25509
25509
  case "weeks":
25510
25510
  case "week":
25511
25511
  case "w":
@@ -26796,10 +26796,10 @@ var require_buffer_list = __commonJS({
26796
26796
  value: function join(s) {
26797
26797
  if (this.length === 0)
26798
26798
  return "";
26799
- var p2 = this.head;
26800
- var ret = "" + p2.data;
26801
- while (p2 = p2.next)
26802
- ret += s + p2.data;
26799
+ var p3 = this.head;
26800
+ var ret = "" + p3.data;
26801
+ while (p3 = p3.next)
26802
+ ret += s + p3.data;
26803
26803
  return ret;
26804
26804
  }
26805
26805
  }, {
@@ -26808,12 +26808,12 @@ var require_buffer_list = __commonJS({
26808
26808
  if (this.length === 0)
26809
26809
  return Buffer2.alloc(0);
26810
26810
  var ret = Buffer2.allocUnsafe(n >>> 0);
26811
- var p2 = this.head;
26811
+ var p3 = this.head;
26812
26812
  var i2 = 0;
26813
- while (p2) {
26814
- copyBuffer(p2.data, ret, i2);
26815
- i2 += p2.data.length;
26816
- p2 = p2.next;
26813
+ while (p3) {
26814
+ copyBuffer(p3.data, ret, i2);
26815
+ i2 += p3.data.length;
26816
+ p3 = p3.next;
26817
26817
  }
26818
26818
  return ret;
26819
26819
  }
@@ -26841,12 +26841,12 @@ var require_buffer_list = __commonJS({
26841
26841
  }, {
26842
26842
  key: "_getString",
26843
26843
  value: function _getString(n) {
26844
- var p2 = this.head;
26844
+ var p3 = this.head;
26845
26845
  var c3 = 1;
26846
- var ret = p2.data;
26846
+ var ret = p3.data;
26847
26847
  n -= ret.length;
26848
- while (p2 = p2.next) {
26849
- var str = p2.data;
26848
+ while (p3 = p3.next) {
26849
+ var str = p3.data;
26850
26850
  var nb = n > str.length ? str.length : n;
26851
26851
  if (nb === str.length)
26852
26852
  ret += str;
@@ -26856,13 +26856,13 @@ var require_buffer_list = __commonJS({
26856
26856
  if (n === 0) {
26857
26857
  if (nb === str.length) {
26858
26858
  ++c3;
26859
- if (p2.next)
26860
- this.head = p2.next;
26859
+ if (p3.next)
26860
+ this.head = p3.next;
26861
26861
  else
26862
26862
  this.head = this.tail = null;
26863
26863
  } else {
26864
- this.head = p2;
26865
- p2.data = str.slice(nb);
26864
+ this.head = p3;
26865
+ p3.data = str.slice(nb);
26866
26866
  }
26867
26867
  break;
26868
26868
  }
@@ -26876,25 +26876,25 @@ var require_buffer_list = __commonJS({
26876
26876
  key: "_getBuffer",
26877
26877
  value: function _getBuffer(n) {
26878
26878
  var ret = Buffer2.allocUnsafe(n);
26879
- var p2 = this.head;
26879
+ var p3 = this.head;
26880
26880
  var c3 = 1;
26881
- p2.data.copy(ret);
26882
- n -= p2.data.length;
26883
- while (p2 = p2.next) {
26884
- var buf = p2.data;
26881
+ p3.data.copy(ret);
26882
+ n -= p3.data.length;
26883
+ while (p3 = p3.next) {
26884
+ var buf = p3.data;
26885
26885
  var nb = n > buf.length ? buf.length : n;
26886
26886
  buf.copy(ret, ret.length - n, 0, nb);
26887
26887
  n -= nb;
26888
26888
  if (n === 0) {
26889
26889
  if (nb === buf.length) {
26890
26890
  ++c3;
26891
- if (p2.next)
26892
- this.head = p2.next;
26891
+ if (p3.next)
26892
+ this.head = p3.next;
26893
26893
  else
26894
26894
  this.head = this.tail = null;
26895
26895
  } else {
26896
- this.head = p2;
26897
- p2.data = buf.slice(nb);
26896
+ this.head = p3;
26897
+ p3.data = buf.slice(nb);
26898
26898
  }
26899
26899
  break;
26900
26900
  }
@@ -27136,7 +27136,7 @@ var require_string_decoder = __commonJS({
27136
27136
  }
27137
27137
  return 0;
27138
27138
  }
27139
- function utf8CheckExtraBytes(self2, buf, p2) {
27139
+ function utf8CheckExtraBytes(self2, buf, p3) {
27140
27140
  if ((buf[0] & 192) !== 128) {
27141
27141
  self2.lastNeed = 0;
27142
27142
  return "\uFFFD";
@@ -27155,15 +27155,15 @@ var require_string_decoder = __commonJS({
27155
27155
  }
27156
27156
  }
27157
27157
  function utf8FillLast(buf) {
27158
- var p2 = this.lastTotal - this.lastNeed;
27159
- var r4 = utf8CheckExtraBytes(this, buf, p2);
27158
+ var p3 = this.lastTotal - this.lastNeed;
27159
+ var r4 = utf8CheckExtraBytes(this, buf, p3);
27160
27160
  if (r4 !== void 0)
27161
27161
  return r4;
27162
27162
  if (this.lastNeed <= buf.length) {
27163
- buf.copy(this.lastChar, p2, 0, this.lastNeed);
27163
+ buf.copy(this.lastChar, p3, 0, this.lastNeed);
27164
27164
  return this.lastChar.toString(this.encoding, 0, this.lastTotal);
27165
27165
  }
27166
- buf.copy(this.lastChar, p2, 0, buf.length);
27166
+ buf.copy(this.lastChar, p3, 0, buf.length);
27167
27167
  this.lastNeed -= buf.length;
27168
27168
  }
27169
27169
  function utf8Text(buf, i2) {
@@ -27875,11 +27875,11 @@ var require_stream_readable = __commonJS({
27875
27875
  var decoder = new StringDecoder(enc);
27876
27876
  this._readableState.decoder = decoder;
27877
27877
  this._readableState.encoding = this._readableState.decoder.encoding;
27878
- var p2 = this._readableState.buffer.head;
27878
+ var p3 = this._readableState.buffer.head;
27879
27879
  var content = "";
27880
- while (p2 !== null) {
27881
- content += decoder.write(p2.data);
27882
- p2 = p2.next;
27880
+ while (p3 !== null) {
27881
+ content += decoder.write(p3.data);
27882
+ p3 = p3.next;
27883
27883
  }
27884
27884
  this._readableState.buffer.clear();
27885
27885
  if (content !== "")
@@ -30026,10 +30026,10 @@ var require_buffer_list2 = __commonJS({
30026
30026
  value: function join(s) {
30027
30027
  if (this.length === 0)
30028
30028
  return "";
30029
- var p2 = this.head;
30030
- var ret = "" + p2.data;
30031
- while (p2 = p2.next)
30032
- ret += s + p2.data;
30029
+ var p3 = this.head;
30030
+ var ret = "" + p3.data;
30031
+ while (p3 = p3.next)
30032
+ ret += s + p3.data;
30033
30033
  return ret;
30034
30034
  }
30035
30035
  }, {
@@ -30038,12 +30038,12 @@ var require_buffer_list2 = __commonJS({
30038
30038
  if (this.length === 0)
30039
30039
  return Buffer2.alloc(0);
30040
30040
  var ret = Buffer2.allocUnsafe(n >>> 0);
30041
- var p2 = this.head;
30041
+ var p3 = this.head;
30042
30042
  var i2 = 0;
30043
- while (p2) {
30044
- copyBuffer(p2.data, ret, i2);
30045
- i2 += p2.data.length;
30046
- p2 = p2.next;
30043
+ while (p3) {
30044
+ copyBuffer(p3.data, ret, i2);
30045
+ i2 += p3.data.length;
30046
+ p3 = p3.next;
30047
30047
  }
30048
30048
  return ret;
30049
30049
  }
@@ -30071,12 +30071,12 @@ var require_buffer_list2 = __commonJS({
30071
30071
  }, {
30072
30072
  key: "_getString",
30073
30073
  value: function _getString(n) {
30074
- var p2 = this.head;
30074
+ var p3 = this.head;
30075
30075
  var c3 = 1;
30076
- var ret = p2.data;
30076
+ var ret = p3.data;
30077
30077
  n -= ret.length;
30078
- while (p2 = p2.next) {
30079
- var str = p2.data;
30078
+ while (p3 = p3.next) {
30079
+ var str = p3.data;
30080
30080
  var nb = n > str.length ? str.length : n;
30081
30081
  if (nb === str.length)
30082
30082
  ret += str;
@@ -30086,13 +30086,13 @@ var require_buffer_list2 = __commonJS({
30086
30086
  if (n === 0) {
30087
30087
  if (nb === str.length) {
30088
30088
  ++c3;
30089
- if (p2.next)
30090
- this.head = p2.next;
30089
+ if (p3.next)
30090
+ this.head = p3.next;
30091
30091
  else
30092
30092
  this.head = this.tail = null;
30093
30093
  } else {
30094
- this.head = p2;
30095
- p2.data = str.slice(nb);
30094
+ this.head = p3;
30095
+ p3.data = str.slice(nb);
30096
30096
  }
30097
30097
  break;
30098
30098
  }
@@ -30106,25 +30106,25 @@ var require_buffer_list2 = __commonJS({
30106
30106
  key: "_getBuffer",
30107
30107
  value: function _getBuffer(n) {
30108
30108
  var ret = Buffer2.allocUnsafe(n);
30109
- var p2 = this.head;
30109
+ var p3 = this.head;
30110
30110
  var c3 = 1;
30111
- p2.data.copy(ret);
30112
- n -= p2.data.length;
30113
- while (p2 = p2.next) {
30114
- var buf = p2.data;
30111
+ p3.data.copy(ret);
30112
+ n -= p3.data.length;
30113
+ while (p3 = p3.next) {
30114
+ var buf = p3.data;
30115
30115
  var nb = n > buf.length ? buf.length : n;
30116
30116
  buf.copy(ret, ret.length - n, 0, nb);
30117
30117
  n -= nb;
30118
30118
  if (n === 0) {
30119
30119
  if (nb === buf.length) {
30120
30120
  ++c3;
30121
- if (p2.next)
30122
- this.head = p2.next;
30121
+ if (p3.next)
30122
+ this.head = p3.next;
30123
30123
  else
30124
30124
  this.head = this.tail = null;
30125
30125
  } else {
30126
- this.head = p2;
30127
- p2.data = buf.slice(nb);
30126
+ this.head = p3;
30127
+ p3.data = buf.slice(nb);
30128
30128
  }
30129
30129
  break;
30130
30130
  }
@@ -31604,11 +31604,11 @@ var require_stream_readable2 = __commonJS({
31604
31604
  var decoder = new StringDecoder(enc);
31605
31605
  this._readableState.decoder = decoder;
31606
31606
  this._readableState.encoding = this._readableState.decoder.encoding;
31607
- var p2 = this._readableState.buffer.head;
31607
+ var p3 = this._readableState.buffer.head;
31608
31608
  var content = "";
31609
- while (p2 !== null) {
31610
- content += decoder.write(p2.data);
31611
- p2 = p2.next;
31609
+ while (p3 !== null) {
31610
+ content += decoder.write(p3.data);
31611
+ p3 = p3.next;
31612
31612
  }
31613
31613
  this._readableState.buffer.clear();
31614
31614
  if (content !== "")
@@ -32188,21 +32188,21 @@ var require_stream_transform = __commonJS({
32188
32188
  var Duplex = require_stream_duplex2();
32189
32189
  require_inherits()(Transform, Duplex);
32190
32190
  function afterTransform(er, data) {
32191
- var ts2 = this._transformState;
32192
- ts2.transforming = false;
32193
- var cb = ts2.writecb;
32191
+ var ts = this._transformState;
32192
+ ts.transforming = false;
32193
+ var cb = ts.writecb;
32194
32194
  if (cb === null) {
32195
32195
  return this.emit("error", new ERR_MULTIPLE_CALLBACK());
32196
32196
  }
32197
- ts2.writechunk = null;
32198
- ts2.writecb = null;
32197
+ ts.writechunk = null;
32198
+ ts.writecb = null;
32199
32199
  if (data != null)
32200
32200
  this.push(data);
32201
32201
  cb(er);
32202
- var rs = this._readableState;
32203
- rs.reading = false;
32204
- if (rs.needReadable || rs.length < rs.highWaterMark) {
32205
- this._read(rs.highWaterMark);
32202
+ var rs2 = this._readableState;
32203
+ rs2.reading = false;
32204
+ if (rs2.needReadable || rs2.length < rs2.highWaterMark) {
32205
+ this._read(rs2.highWaterMark);
32206
32206
  }
32207
32207
  }
32208
32208
  function Transform(options) {
@@ -32245,23 +32245,23 @@ var require_stream_transform = __commonJS({
32245
32245
  cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()"));
32246
32246
  };
32247
32247
  Transform.prototype._write = function(chunk, encoding, cb) {
32248
- var ts2 = this._transformState;
32249
- ts2.writecb = cb;
32250
- ts2.writechunk = chunk;
32251
- ts2.writeencoding = encoding;
32252
- if (!ts2.transforming) {
32253
- var rs = this._readableState;
32254
- if (ts2.needTransform || rs.needReadable || rs.length < rs.highWaterMark)
32255
- this._read(rs.highWaterMark);
32248
+ var ts = this._transformState;
32249
+ ts.writecb = cb;
32250
+ ts.writechunk = chunk;
32251
+ ts.writeencoding = encoding;
32252
+ if (!ts.transforming) {
32253
+ var rs2 = this._readableState;
32254
+ if (ts.needTransform || rs2.needReadable || rs2.length < rs2.highWaterMark)
32255
+ this._read(rs2.highWaterMark);
32256
32256
  }
32257
32257
  };
32258
32258
  Transform.prototype._read = function(n) {
32259
- var ts2 = this._transformState;
32260
- if (ts2.writechunk !== null && !ts2.transforming) {
32261
- ts2.transforming = true;
32262
- this._transform(ts2.writechunk, ts2.writeencoding, ts2.afterTransform);
32259
+ var ts = this._transformState;
32260
+ if (ts.writechunk !== null && !ts.transforming) {
32261
+ ts.transforming = true;
32262
+ this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
32263
32263
  } else {
32264
- ts2.needTransform = true;
32264
+ ts.needTransform = true;
32265
32265
  }
32266
32266
  };
32267
32267
  Transform.prototype._destroy = function(err, cb) {
@@ -32894,9 +32894,9 @@ var require_color_string = __commonJS({
32894
32894
  cs.to.rgb.percent = function() {
32895
32895
  var rgba = swizzle(arguments);
32896
32896
  var r4 = Math.round(rgba[0] / 255 * 100);
32897
- var g3 = Math.round(rgba[1] / 255 * 100);
32897
+ var g2 = Math.round(rgba[1] / 255 * 100);
32898
32898
  var b2 = Math.round(rgba[2] / 255 * 100);
32899
- return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + r4 + "%, " + g3 + "%, " + b2 + "%)" : "rgba(" + r4 + "%, " + g3 + "%, " + b2 + "%, " + rgba[3] + ")";
32899
+ return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + r4 + "%, " + g2 + "%, " + b2 + "%)" : "rgba(" + r4 + "%, " + g2 + "%, " + b2 + "%, " + rgba[3] + ")";
32900
32900
  };
32901
32901
  cs.to.hsl = function() {
32902
32902
  var hsla = swizzle(arguments);
@@ -32976,10 +32976,10 @@ var require_conversions = __commonJS({
32976
32976
  var model;
32977
32977
  convert.rgb.hsl = function(rgb) {
32978
32978
  var r4 = rgb[0] / 255;
32979
- var g3 = rgb[1] / 255;
32979
+ var g2 = rgb[1] / 255;
32980
32980
  var b2 = rgb[2] / 255;
32981
- var min = Math.min(r4, g3, b2);
32982
- var max = Math.max(r4, g3, b2);
32981
+ var min = Math.min(r4, g2, b2);
32982
+ var max = Math.max(r4, g2, b2);
32983
32983
  var delta = max - min;
32984
32984
  var h3;
32985
32985
  var s;
@@ -32987,11 +32987,11 @@ var require_conversions = __commonJS({
32987
32987
  if (max === min) {
32988
32988
  h3 = 0;
32989
32989
  } else if (r4 === max) {
32990
- h3 = (g3 - b2) / delta;
32991
- } else if (g3 === max) {
32990
+ h3 = (g2 - b2) / delta;
32991
+ } else if (g2 === max) {
32992
32992
  h3 = 2 + (b2 - r4) / delta;
32993
32993
  } else if (b2 === max) {
32994
- h3 = 4 + (r4 - g3) / delta;
32994
+ h3 = 4 + (r4 - g2) / delta;
32995
32995
  }
32996
32996
  h3 = Math.min(h3 * 60, 360);
32997
32997
  if (h3 < 0) {
@@ -33014,10 +33014,10 @@ var require_conversions = __commonJS({
33014
33014
  var h3;
33015
33015
  var s;
33016
33016
  var r4 = rgb[0] / 255;
33017
- var g3 = rgb[1] / 255;
33017
+ var g2 = rgb[1] / 255;
33018
33018
  var b2 = rgb[2] / 255;
33019
- var v3 = Math.max(r4, g3, b2);
33020
- var diff = v3 - Math.min(r4, g3, b2);
33019
+ var v3 = Math.max(r4, g2, b2);
33020
+ var diff = v3 - Math.min(r4, g2, b2);
33021
33021
  var diffc = function(c3) {
33022
33022
  return (v3 - c3) / 6 / diff + 1 / 2;
33023
33023
  };
@@ -33026,11 +33026,11 @@ var require_conversions = __commonJS({
33026
33026
  } else {
33027
33027
  s = diff / v3;
33028
33028
  rdif = diffc(r4);
33029
- gdif = diffc(g3);
33029
+ gdif = diffc(g2);
33030
33030
  bdif = diffc(b2);
33031
33031
  if (r4 === v3) {
33032
33032
  h3 = bdif - gdif;
33033
- } else if (g3 === v3) {
33033
+ } else if (g2 === v3) {
33034
33034
  h3 = 1 / 3 + rdif - bdif;
33035
33035
  } else if (b2 === v3) {
33036
33036
  h3 = 2 / 3 + gdif - rdif;
@@ -33049,29 +33049,29 @@ var require_conversions = __commonJS({
33049
33049
  };
33050
33050
  convert.rgb.hwb = function(rgb) {
33051
33051
  var r4 = rgb[0];
33052
- var g3 = rgb[1];
33052
+ var g2 = rgb[1];
33053
33053
  var b2 = rgb[2];
33054
33054
  var h3 = convert.rgb.hsl(rgb)[0];
33055
- var w2 = 1 / 255 * Math.min(r4, Math.min(g3, b2));
33056
- b2 = 1 - 1 / 255 * Math.max(r4, Math.max(g3, b2));
33055
+ var w2 = 1 / 255 * Math.min(r4, Math.min(g2, b2));
33056
+ b2 = 1 - 1 / 255 * Math.max(r4, Math.max(g2, b2));
33057
33057
  return [h3, w2 * 100, b2 * 100];
33058
33058
  };
33059
33059
  convert.rgb.cmyk = function(rgb) {
33060
33060
  var r4 = rgb[0] / 255;
33061
- var g3 = rgb[1] / 255;
33061
+ var g2 = rgb[1] / 255;
33062
33062
  var b2 = rgb[2] / 255;
33063
33063
  var c3;
33064
33064
  var m3;
33065
- var y;
33065
+ var y2;
33066
33066
  var k2;
33067
- k2 = Math.min(1 - r4, 1 - g3, 1 - b2);
33067
+ k2 = Math.min(1 - r4, 1 - g2, 1 - b2);
33068
33068
  c3 = (1 - r4 - k2) / (1 - k2) || 0;
33069
- m3 = (1 - g3 - k2) / (1 - k2) || 0;
33070
- y = (1 - b2 - k2) / (1 - k2) || 0;
33071
- return [c3 * 100, m3 * 100, y * 100, k2 * 100];
33069
+ m3 = (1 - g2 - k2) / (1 - k2) || 0;
33070
+ y2 = (1 - b2 - k2) / (1 - k2) || 0;
33071
+ return [c3 * 100, m3 * 100, y2 * 100, k2 * 100];
33072
33072
  };
33073
- function comparativeDistance(x, y) {
33074
- return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
33073
+ function comparativeDistance(x, y2) {
33074
+ return Math.pow(x[0] - y2[0], 2) + Math.pow(x[1] - y2[1], 2) + Math.pow(x[2] - y2[2], 2);
33075
33075
  }
33076
33076
  convert.rgb.keyword = function(rgb) {
33077
33077
  var reversed = reverseKeywords[rgb];
@@ -33097,33 +33097,33 @@ var require_conversions = __commonJS({
33097
33097
  };
33098
33098
  convert.rgb.xyz = function(rgb) {
33099
33099
  var r4 = rgb[0] / 255;
33100
- var g3 = rgb[1] / 255;
33100
+ var g2 = rgb[1] / 255;
33101
33101
  var b2 = rgb[2] / 255;
33102
33102
  r4 = r4 > 0.04045 ? Math.pow((r4 + 0.055) / 1.055, 2.4) : r4 / 12.92;
33103
- g3 = g3 > 0.04045 ? Math.pow((g3 + 0.055) / 1.055, 2.4) : g3 / 12.92;
33103
+ g2 = g2 > 0.04045 ? Math.pow((g2 + 0.055) / 1.055, 2.4) : g2 / 12.92;
33104
33104
  b2 = b2 > 0.04045 ? Math.pow((b2 + 0.055) / 1.055, 2.4) : b2 / 12.92;
33105
- var x = r4 * 0.4124 + g3 * 0.3576 + b2 * 0.1805;
33106
- var y = r4 * 0.2126 + g3 * 0.7152 + b2 * 0.0722;
33107
- var z2 = r4 * 0.0193 + g3 * 0.1192 + b2 * 0.9505;
33108
- return [x * 100, y * 100, z2 * 100];
33105
+ var x = r4 * 0.4124 + g2 * 0.3576 + b2 * 0.1805;
33106
+ var y2 = r4 * 0.2126 + g2 * 0.7152 + b2 * 0.0722;
33107
+ var z2 = r4 * 0.0193 + g2 * 0.1192 + b2 * 0.9505;
33108
+ return [x * 100, y2 * 100, z2 * 100];
33109
33109
  };
33110
33110
  convert.rgb.lab = function(rgb) {
33111
33111
  var xyz = convert.rgb.xyz(rgb);
33112
33112
  var x = xyz[0];
33113
- var y = xyz[1];
33113
+ var y2 = xyz[1];
33114
33114
  var z2 = xyz[2];
33115
33115
  var l2;
33116
33116
  var a;
33117
33117
  var b2;
33118
33118
  x /= 95.047;
33119
- y /= 100;
33119
+ y2 /= 100;
33120
33120
  z2 /= 108.883;
33121
33121
  x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
33122
- y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
33122
+ y2 = y2 > 8856e-6 ? Math.pow(y2, 1 / 3) : 7.787 * y2 + 16 / 116;
33123
33123
  z2 = z2 > 8856e-6 ? Math.pow(z2, 1 / 3) : 7.787 * z2 + 16 / 116;
33124
- l2 = 116 * y - 16;
33125
- a = 500 * (x - y);
33126
- b2 = 200 * (y - z2);
33124
+ l2 = 116 * y2 - 16;
33125
+ a = 500 * (x - y2);
33126
+ b2 = 200 * (y2 - z2);
33127
33127
  return [l2, a, b2];
33128
33128
  };
33129
33129
  convert.hsl.rgb = function(hsl) {
@@ -33187,24 +33187,24 @@ var require_conversions = __commonJS({
33187
33187
  var s = hsv[1] / 100;
33188
33188
  var v3 = hsv[2] / 100;
33189
33189
  var hi2 = Math.floor(h3) % 6;
33190
- var f2 = h3 - Math.floor(h3);
33191
- var p2 = 255 * v3 * (1 - s);
33192
- var q = 255 * v3 * (1 - s * f2);
33193
- var t = 255 * v3 * (1 - s * (1 - f2));
33190
+ var f = h3 - Math.floor(h3);
33191
+ var p3 = 255 * v3 * (1 - s);
33192
+ var q = 255 * v3 * (1 - s * f);
33193
+ var t = 255 * v3 * (1 - s * (1 - f));
33194
33194
  v3 *= 255;
33195
33195
  switch (hi2) {
33196
33196
  case 0:
33197
- return [v3, t, p2];
33197
+ return [v3, t, p3];
33198
33198
  case 1:
33199
- return [q, v3, p2];
33199
+ return [q, v3, p3];
33200
33200
  case 2:
33201
- return [p2, v3, t];
33201
+ return [p3, v3, t];
33202
33202
  case 3:
33203
- return [p2, q, v3];
33203
+ return [p3, q, v3];
33204
33204
  case 4:
33205
- return [t, p2, v3];
33205
+ return [t, p3, v3];
33206
33206
  case 5:
33207
- return [v3, p2, q];
33207
+ return [v3, p3, q];
33208
33208
  }
33209
33209
  };
33210
33210
  convert.hsv.hsl = function(hsv) {
@@ -33230,7 +33230,7 @@ var require_conversions = __commonJS({
33230
33230
  var ratio = wh + bl;
33231
33231
  var i2;
33232
33232
  var v3;
33233
- var f2;
33233
+ var f;
33234
33234
  var n;
33235
33235
  if (ratio > 1) {
33236
33236
  wh /= ratio;
@@ -33238,97 +33238,97 @@ var require_conversions = __commonJS({
33238
33238
  }
33239
33239
  i2 = Math.floor(6 * h3);
33240
33240
  v3 = 1 - bl;
33241
- f2 = 6 * h3 - i2;
33241
+ f = 6 * h3 - i2;
33242
33242
  if ((i2 & 1) !== 0) {
33243
- f2 = 1 - f2;
33243
+ f = 1 - f;
33244
33244
  }
33245
- n = wh + f2 * (v3 - wh);
33245
+ n = wh + f * (v3 - wh);
33246
33246
  var r4;
33247
- var g3;
33247
+ var g2;
33248
33248
  var b2;
33249
33249
  switch (i2) {
33250
33250
  default:
33251
33251
  case 6:
33252
33252
  case 0:
33253
33253
  r4 = v3;
33254
- g3 = n;
33254
+ g2 = n;
33255
33255
  b2 = wh;
33256
33256
  break;
33257
33257
  case 1:
33258
33258
  r4 = n;
33259
- g3 = v3;
33259
+ g2 = v3;
33260
33260
  b2 = wh;
33261
33261
  break;
33262
33262
  case 2:
33263
33263
  r4 = wh;
33264
- g3 = v3;
33264
+ g2 = v3;
33265
33265
  b2 = n;
33266
33266
  break;
33267
33267
  case 3:
33268
33268
  r4 = wh;
33269
- g3 = n;
33269
+ g2 = n;
33270
33270
  b2 = v3;
33271
33271
  break;
33272
33272
  case 4:
33273
33273
  r4 = n;
33274
- g3 = wh;
33274
+ g2 = wh;
33275
33275
  b2 = v3;
33276
33276
  break;
33277
33277
  case 5:
33278
33278
  r4 = v3;
33279
- g3 = wh;
33279
+ g2 = wh;
33280
33280
  b2 = n;
33281
33281
  break;
33282
33282
  }
33283
- return [r4 * 255, g3 * 255, b2 * 255];
33283
+ return [r4 * 255, g2 * 255, b2 * 255];
33284
33284
  };
33285
33285
  convert.cmyk.rgb = function(cmyk) {
33286
33286
  var c3 = cmyk[0] / 100;
33287
33287
  var m3 = cmyk[1] / 100;
33288
- var y = cmyk[2] / 100;
33288
+ var y2 = cmyk[2] / 100;
33289
33289
  var k2 = cmyk[3] / 100;
33290
33290
  var r4;
33291
- var g3;
33291
+ var g2;
33292
33292
  var b2;
33293
33293
  r4 = 1 - Math.min(1, c3 * (1 - k2) + k2);
33294
- g3 = 1 - Math.min(1, m3 * (1 - k2) + k2);
33295
- b2 = 1 - Math.min(1, y * (1 - k2) + k2);
33296
- return [r4 * 255, g3 * 255, b2 * 255];
33294
+ g2 = 1 - Math.min(1, m3 * (1 - k2) + k2);
33295
+ b2 = 1 - Math.min(1, y2 * (1 - k2) + k2);
33296
+ return [r4 * 255, g2 * 255, b2 * 255];
33297
33297
  };
33298
33298
  convert.xyz.rgb = function(xyz) {
33299
33299
  var x = xyz[0] / 100;
33300
- var y = xyz[1] / 100;
33300
+ var y2 = xyz[1] / 100;
33301
33301
  var z2 = xyz[2] / 100;
33302
33302
  var r4;
33303
- var g3;
33303
+ var g2;
33304
33304
  var b2;
33305
- r4 = x * 3.2406 + y * -1.5372 + z2 * -0.4986;
33306
- g3 = x * -0.9689 + y * 1.8758 + z2 * 0.0415;
33307
- b2 = x * 0.0557 + y * -0.204 + z2 * 1.057;
33305
+ r4 = x * 3.2406 + y2 * -1.5372 + z2 * -0.4986;
33306
+ g2 = x * -0.9689 + y2 * 1.8758 + z2 * 0.0415;
33307
+ b2 = x * 0.0557 + y2 * -0.204 + z2 * 1.057;
33308
33308
  r4 = r4 > 31308e-7 ? 1.055 * Math.pow(r4, 1 / 2.4) - 0.055 : r4 * 12.92;
33309
- g3 = g3 > 31308e-7 ? 1.055 * Math.pow(g3, 1 / 2.4) - 0.055 : g3 * 12.92;
33309
+ g2 = g2 > 31308e-7 ? 1.055 * Math.pow(g2, 1 / 2.4) - 0.055 : g2 * 12.92;
33310
33310
  b2 = b2 > 31308e-7 ? 1.055 * Math.pow(b2, 1 / 2.4) - 0.055 : b2 * 12.92;
33311
33311
  r4 = Math.min(Math.max(0, r4), 1);
33312
- g3 = Math.min(Math.max(0, g3), 1);
33312
+ g2 = Math.min(Math.max(0, g2), 1);
33313
33313
  b2 = Math.min(Math.max(0, b2), 1);
33314
- return [r4 * 255, g3 * 255, b2 * 255];
33314
+ return [r4 * 255, g2 * 255, b2 * 255];
33315
33315
  };
33316
33316
  convert.xyz.lab = function(xyz) {
33317
33317
  var x = xyz[0];
33318
- var y = xyz[1];
33318
+ var y2 = xyz[1];
33319
33319
  var z2 = xyz[2];
33320
33320
  var l2;
33321
33321
  var a;
33322
33322
  var b2;
33323
33323
  x /= 95.047;
33324
- y /= 100;
33324
+ y2 /= 100;
33325
33325
  z2 /= 108.883;
33326
33326
  x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
33327
- y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
33327
+ y2 = y2 > 8856e-6 ? Math.pow(y2, 1 / 3) : 7.787 * y2 + 16 / 116;
33328
33328
  z2 = z2 > 8856e-6 ? Math.pow(z2, 1 / 3) : 7.787 * z2 + 16 / 116;
33329
- l2 = 116 * y - 16;
33330
- a = 500 * (x - y);
33331
- b2 = 200 * (y - z2);
33329
+ l2 = 116 * y2 - 16;
33330
+ a = 500 * (x - y2);
33331
+ b2 = 200 * (y2 - z2);
33332
33332
  return [l2, a, b2];
33333
33333
  };
33334
33334
  convert.lab.xyz = function(lab) {
@@ -33336,21 +33336,21 @@ var require_conversions = __commonJS({
33336
33336
  var a = lab[1];
33337
33337
  var b2 = lab[2];
33338
33338
  var x;
33339
- var y;
33339
+ var y2;
33340
33340
  var z2;
33341
- y = (l2 + 16) / 116;
33342
- x = a / 500 + y;
33343
- z2 = y - b2 / 200;
33344
- var y2 = Math.pow(y, 3);
33341
+ y2 = (l2 + 16) / 116;
33342
+ x = a / 500 + y2;
33343
+ z2 = y2 - b2 / 200;
33344
+ var y22 = Math.pow(y2, 3);
33345
33345
  var x2 = Math.pow(x, 3);
33346
33346
  var z22 = Math.pow(z2, 3);
33347
- y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
33347
+ y2 = y22 > 8856e-6 ? y22 : (y2 - 16 / 116) / 7.787;
33348
33348
  x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
33349
33349
  z2 = z22 > 8856e-6 ? z22 : (z2 - 16 / 116) / 7.787;
33350
33350
  x *= 95.047;
33351
- y *= 100;
33351
+ y2 *= 100;
33352
33352
  z2 *= 108.883;
33353
- return [x, y, z2];
33353
+ return [x, y2, z2];
33354
33354
  };
33355
33355
  convert.lab.lch = function(lab) {
33356
33356
  var l2 = lab[0];
@@ -33381,14 +33381,14 @@ var require_conversions = __commonJS({
33381
33381
  };
33382
33382
  convert.rgb.ansi16 = function(args) {
33383
33383
  var r4 = args[0];
33384
- var g3 = args[1];
33384
+ var g2 = args[1];
33385
33385
  var b2 = args[2];
33386
33386
  var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2];
33387
33387
  value = Math.round(value / 50);
33388
33388
  if (value === 0) {
33389
33389
  return 30;
33390
33390
  }
33391
- var ansi = 30 + (Math.round(b2 / 255) << 2 | Math.round(g3 / 255) << 1 | Math.round(r4 / 255));
33391
+ var ansi = 30 + (Math.round(b2 / 255) << 2 | Math.round(g2 / 255) << 1 | Math.round(r4 / 255));
33392
33392
  if (value === 2) {
33393
33393
  ansi += 60;
33394
33394
  }
@@ -33399,9 +33399,9 @@ var require_conversions = __commonJS({
33399
33399
  };
33400
33400
  convert.rgb.ansi256 = function(args) {
33401
33401
  var r4 = args[0];
33402
- var g3 = args[1];
33402
+ var g2 = args[1];
33403
33403
  var b2 = args[2];
33404
- if (r4 === g3 && g3 === b2) {
33404
+ if (r4 === g2 && g2 === b2) {
33405
33405
  if (r4 < 8) {
33406
33406
  return 16;
33407
33407
  }
@@ -33410,7 +33410,7 @@ var require_conversions = __commonJS({
33410
33410
  }
33411
33411
  return Math.round((r4 - 8) / 247 * 24) + 232;
33412
33412
  }
33413
- var ansi = 16 + 36 * Math.round(r4 / 255 * 5) + 6 * Math.round(g3 / 255 * 5) + Math.round(b2 / 255 * 5);
33413
+ var ansi = 16 + 36 * Math.round(r4 / 255 * 5) + 6 * Math.round(g2 / 255 * 5) + Math.round(b2 / 255 * 5);
33414
33414
  return ansi;
33415
33415
  };
33416
33416
  convert.ansi16.rgb = function(args) {
@@ -33424,9 +33424,9 @@ var require_conversions = __commonJS({
33424
33424
  }
33425
33425
  var mult = (~~(args > 50) + 1) * 0.5;
33426
33426
  var r4 = (color & 1) * mult * 255;
33427
- var g3 = (color >> 1 & 1) * mult * 255;
33427
+ var g2 = (color >> 1 & 1) * mult * 255;
33428
33428
  var b2 = (color >> 2 & 1) * mult * 255;
33429
- return [r4, g3, b2];
33429
+ return [r4, g2, b2];
33430
33430
  };
33431
33431
  convert.ansi256.rgb = function(args) {
33432
33432
  if (args >= 232) {
@@ -33436,9 +33436,9 @@ var require_conversions = __commonJS({
33436
33436
  args -= 16;
33437
33437
  var rem;
33438
33438
  var r4 = Math.floor(args / 36) / 5 * 255;
33439
- var g3 = Math.floor((rem = args % 36) / 6) / 5 * 255;
33439
+ var g2 = Math.floor((rem = args % 36) / 6) / 5 * 255;
33440
33440
  var b2 = rem % 6 / 5 * 255;
33441
- return [r4, g3, b2];
33441
+ return [r4, g2, b2];
33442
33442
  };
33443
33443
  convert.rgb.hex = function(args) {
33444
33444
  var integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
@@ -33458,16 +33458,16 @@ var require_conversions = __commonJS({
33458
33458
  }
33459
33459
  var integer = parseInt(colorString, 16);
33460
33460
  var r4 = integer >> 16 & 255;
33461
- var g3 = integer >> 8 & 255;
33461
+ var g2 = integer >> 8 & 255;
33462
33462
  var b2 = integer & 255;
33463
- return [r4, g3, b2];
33463
+ return [r4, g2, b2];
33464
33464
  };
33465
33465
  convert.rgb.hcg = function(rgb) {
33466
33466
  var r4 = rgb[0] / 255;
33467
- var g3 = rgb[1] / 255;
33467
+ var g2 = rgb[1] / 255;
33468
33468
  var b2 = rgb[2] / 255;
33469
- var max = Math.max(Math.max(r4, g3), b2);
33470
- var min = Math.min(Math.min(r4, g3), b2);
33469
+ var max = Math.max(Math.max(r4, g2), b2);
33470
+ var min = Math.min(Math.min(r4, g2), b2);
33471
33471
  var chroma = max - min;
33472
33472
  var grayscale;
33473
33473
  var hue;
@@ -33479,11 +33479,11 @@ var require_conversions = __commonJS({
33479
33479
  if (chroma <= 0) {
33480
33480
  hue = 0;
33481
33481
  } else if (max === r4) {
33482
- hue = (g3 - b2) / chroma % 6;
33483
- } else if (max === g3) {
33482
+ hue = (g2 - b2) / chroma % 6;
33483
+ } else if (max === g2) {
33484
33484
  hue = 2 + (b2 - r4) / chroma;
33485
33485
  } else {
33486
- hue = 4 + (r4 - g3) / chroma + 4;
33486
+ hue = 4 + (r4 - g2) / chroma + 4;
33487
33487
  }
33488
33488
  hue /= 6;
33489
33489
  hue %= 1;
@@ -33493,33 +33493,33 @@ var require_conversions = __commonJS({
33493
33493
  var s = hsl[1] / 100;
33494
33494
  var l2 = hsl[2] / 100;
33495
33495
  var c3 = 1;
33496
- var f2 = 0;
33496
+ var f = 0;
33497
33497
  if (l2 < 0.5) {
33498
33498
  c3 = 2 * s * l2;
33499
33499
  } else {
33500
33500
  c3 = 2 * s * (1 - l2);
33501
33501
  }
33502
33502
  if (c3 < 1) {
33503
- f2 = (l2 - 0.5 * c3) / (1 - c3);
33503
+ f = (l2 - 0.5 * c3) / (1 - c3);
33504
33504
  }
33505
- return [hsl[0], c3 * 100, f2 * 100];
33505
+ return [hsl[0], c3 * 100, f * 100];
33506
33506
  };
33507
33507
  convert.hsv.hcg = function(hsv) {
33508
33508
  var s = hsv[1] / 100;
33509
33509
  var v3 = hsv[2] / 100;
33510
33510
  var c3 = s * v3;
33511
- var f2 = 0;
33511
+ var f = 0;
33512
33512
  if (c3 < 1) {
33513
- f2 = (v3 - c3) / (1 - c3);
33513
+ f = (v3 - c3) / (1 - c3);
33514
33514
  }
33515
- return [hsv[0], c3 * 100, f2 * 100];
33515
+ return [hsv[0], c3 * 100, f * 100];
33516
33516
  };
33517
33517
  convert.hcg.rgb = function(hcg) {
33518
33518
  var h3 = hcg[0] / 360;
33519
33519
  var c3 = hcg[1] / 100;
33520
- var g3 = hcg[2] / 100;
33520
+ var g2 = hcg[2] / 100;
33521
33521
  if (c3 === 0) {
33522
- return [g3 * 255, g3 * 255, g3 * 255];
33522
+ return [g2 * 255, g2 * 255, g2 * 255];
33523
33523
  }
33524
33524
  var pure = [0, 0, 0];
33525
33525
  var hi2 = h3 % 1 * 6;
@@ -33557,7 +33557,7 @@ var require_conversions = __commonJS({
33557
33557
  pure[1] = 0;
33558
33558
  pure[2] = w2;
33559
33559
  }
33560
- mg = (1 - c3) * g3;
33560
+ mg = (1 - c3) * g2;
33561
33561
  return [
33562
33562
  (c3 * pure[0] + mg) * 255,
33563
33563
  (c3 * pure[1] + mg) * 255,
@@ -33566,18 +33566,18 @@ var require_conversions = __commonJS({
33566
33566
  };
33567
33567
  convert.hcg.hsv = function(hcg) {
33568
33568
  var c3 = hcg[1] / 100;
33569
- var g3 = hcg[2] / 100;
33570
- var v3 = c3 + g3 * (1 - c3);
33571
- var f2 = 0;
33569
+ var g2 = hcg[2] / 100;
33570
+ var v3 = c3 + g2 * (1 - c3);
33571
+ var f = 0;
33572
33572
  if (v3 > 0) {
33573
- f2 = c3 / v3;
33573
+ f = c3 / v3;
33574
33574
  }
33575
- return [hcg[0], f2 * 100, v3 * 100];
33575
+ return [hcg[0], f * 100, v3 * 100];
33576
33576
  };
33577
33577
  convert.hcg.hsl = function(hcg) {
33578
33578
  var c3 = hcg[1] / 100;
33579
- var g3 = hcg[2] / 100;
33580
- var l2 = g3 * (1 - c3) + 0.5 * c3;
33579
+ var g2 = hcg[2] / 100;
33580
+ var l2 = g2 * (1 - c3) + 0.5 * c3;
33581
33581
  var s = 0;
33582
33582
  if (l2 > 0 && l2 < 0.5) {
33583
33583
  s = c3 / (2 * l2);
@@ -33588,8 +33588,8 @@ var require_conversions = __commonJS({
33588
33588
  };
33589
33589
  convert.hcg.hwb = function(hcg) {
33590
33590
  var c3 = hcg[1] / 100;
33591
- var g3 = hcg[2] / 100;
33592
- var v3 = c3 + g3 * (1 - c3);
33591
+ var g2 = hcg[2] / 100;
33592
+ var v3 = c3 + g2 * (1 - c3);
33593
33593
  return [hcg[0], (v3 - c3) * 100, (1 - v3) * 100];
33594
33594
  };
33595
33595
  convert.hwb.hcg = function(hwb) {
@@ -33597,11 +33597,11 @@ var require_conversions = __commonJS({
33597
33597
  var b2 = hwb[2] / 100;
33598
33598
  var v3 = 1 - b2;
33599
33599
  var c3 = v3 - w2;
33600
- var g3 = 0;
33600
+ var g2 = 0;
33601
33601
  if (c3 < 1) {
33602
- g3 = (v3 - c3) / (1 - c3);
33602
+ g2 = (v3 - c3) / (1 - c3);
33603
33603
  }
33604
- return [hwb[0], c3 * 100, g3 * 100];
33604
+ return [hwb[0], c3 * 100, g2 * 100];
33605
33605
  };
33606
33606
  convert.apple.rgb = function(apple) {
33607
33607
  return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
@@ -34064,8 +34064,8 @@ var require_color = __commonJS({
34064
34064
  }
34065
34065
  var color1 = mixinColor.rgb();
34066
34066
  var color2 = this.rgb();
34067
- var p2 = weight === void 0 ? 0.5 : weight;
34068
- var w2 = 2 * p2 - 1;
34067
+ var p3 = weight === void 0 ? 0.5 : weight;
34068
+ var w2 = 2 * p3 - 1;
34069
34069
  var a = color1.alpha() - color2.alpha();
34070
34070
  var w1 = ((w2 * a === -1 ? w2 : (w2 + a) / (1 + w2 * a)) + 1) / 2;
34071
34071
  var w22 = 1 - w1;
@@ -34073,7 +34073,7 @@ var require_color = __commonJS({
34073
34073
  w1 * color1.red() + w22 * color2.red(),
34074
34074
  w1 * color1.green() + w22 * color2.green(),
34075
34075
  w1 * color1.blue() + w22 * color2.blue(),
34076
- color1.alpha() * p2 + color2.alpha() * (1 - p2)
34076
+ color1.alpha() * p3 + color2.alpha() * (1 - p3)
34077
34077
  );
34078
34078
  }
34079
34079
  };
@@ -34210,15 +34210,15 @@ var require_kuler = __commonJS({
34210
34210
  color[1] = color[0];
34211
34211
  color = color.join("");
34212
34212
  }
34213
- var r4 = color.substring(0, 2), g3 = color.substring(2, 4), b2 = color.substring(4, 6);
34214
- return [parseInt(r4, 16), parseInt(g3, 16), parseInt(b2, 16)];
34213
+ var r4 = color.substring(0, 2), g2 = color.substring(2, 4), b2 = color.substring(4, 6);
34214
+ return [parseInt(r4, 16), parseInt(g2, 16), parseInt(b2, 16)];
34215
34215
  };
34216
- Kuler.prototype.rgb = function rgb(r4, g3, b2) {
34217
- var red = r4 / 255 * 5, green = g3 / 255 * 5, blue = b2 / 255 * 5;
34216
+ Kuler.prototype.rgb = function rgb(r4, g2, b2) {
34217
+ var red = r4 / 255 * 5, green = g2 / 255 * 5, blue = b2 / 255 * 5;
34218
34218
  return this.ansi(red, green, blue);
34219
34219
  };
34220
- Kuler.prototype.ansi = function ansi(r4, g3, b2) {
34221
- var red = Math.round(r4), green = Math.round(g3), blue = Math.round(b2);
34220
+ Kuler.prototype.ansi = function ansi(r4, g2, b2) {
34221
+ var red = Math.round(r4), green = Math.round(g2), blue = Math.round(b2);
34222
34222
  return 16 + red * 36 + green * 6 + blue;
34223
34223
  };
34224
34224
  Kuler.prototype.reset = function reset() {
@@ -36851,7 +36851,7 @@ var require_dcmjs_dimse_min = __commonJS({
36851
36851
  "object" == typeof exports && "object" == typeof module2 ? module2.exports = t(require_async_eventemitter(), require_dcmjs(), require_smartbuffer(), require_cjs(), require_winston()) : "function" == typeof define && define.amd ? define("dcmjs-dimse", ["async-eventemitter", "dcmjs", "smart-buffer", "ts-mixer", "winston"], t) : "object" == typeof exports ? exports["dcmjs-dimse"] = t(require_async_eventemitter(), require_dcmjs(), require_smartbuffer(), require_cjs(), require_winston()) : e["dcmjs-dimse"] = t(e["async-eventemitter"], e.dcmjs, e["smart-buffer"], e["ts-mixer"], e.winston);
36852
36852
  }(global, (e, t, s, n, i2) => {
36853
36853
  return r4 = { 201: (e2, t2, s2) => {
36854
- const { CGetRequest: n2, CStoreRequest: i3 } = s2(406), { CommandFieldType: r5, PresentationContextResult: o2, SopClass: a, StorageClass: c3, TransferSyntax: d3, Uid: u2, UserIdentityType: h3 } = s2(855), m3 = s2(719), { EOL: g3 } = s2(37);
36854
+ const { CGetRequest: n2, CStoreRequest: i3 } = s2(406), { CommandFieldType: r5, PresentationContextResult: o2, SopClass: a, StorageClass: c3, TransferSyntax: d3, Uid: u2, UserIdentityType: h3 } = s2(855), m3 = s2(719), { EOL: g2 } = s2(37);
36855
36855
  class l2 {
36856
36856
  constructor(e3, t3, s3, n3) {
36857
36857
  this.pcId = e3, this.abstractSyntaxUid = t3, this.transferSyntaxes = [], s3 && this.transferSyntaxes.push(s3), this.result = n3 || o2.Proposed;
@@ -36910,7 +36910,7 @@ var require_dcmjs_dimse_min = __commonJS({
36910
36910
  const e3 = [];
36911
36911
  return e3.push(`Presentation Context: ${this.getPresentationContextId()} [${this.getResultDescription()}]`), e3.push(` Abstract: ${this.getAbstractSyntaxUid()}`), this.getTransferSyntaxUids().forEach((t3) => {
36912
36912
  e3.push(` Transfer: ${t3}`);
36913
- }), e3.join(g3);
36913
+ }), e3.join(g2);
36914
36914
  }
36915
36915
  }
36916
36916
  e2.exports = { Association: class {
@@ -37091,7 +37091,7 @@ var require_dcmjs_dimse_min = __commonJS({
37091
37091
  e3.push(` Presentation Context: ${t3.id} [${s3.getResultDescription()}]`), e3.push(` Abstract: ${this._uidNameFromValue([a, c3], s3.getAbstractSyntaxUid()) || s3.getAbstractSyntaxUid()}`), s3.getTransferSyntaxUids().forEach((t4) => {
37092
37092
  e3.push(` Transfer: ${this._uidNameFromValue(d3, t4) || t4}`);
37093
37093
  });
37094
- }), e3.push(""), e3.join(g3);
37094
+ }), e3.push(""), e3.join(g2);
37095
37095
  }
37096
37096
  _uidNameFromValue(e3, t3) {
37097
37097
  const s3 = Array.isArray(e3) ? Object.assign({}, ...e3) : e3;
@@ -37133,7 +37133,7 @@ var require_dcmjs_dimse_min = __commonJS({
37133
37133
  }
37134
37134
  }, PresentationContext: l2 };
37135
37135
  }, 185: (e2, t2, s2) => {
37136
- const { Association: n2, PresentationContext: i3 } = s2(201), { TransferSyntax: r5, UserIdentityType: o2 } = s2(855), { Request: a } = s2(406), c3 = s2(988), d3 = s2(266), u2 = s2(437), h3 = s2(425), m3 = s2(808), g3 = s2(404);
37136
+ const { Association: n2, PresentationContext: i3 } = s2(201), { TransferSyntax: r5, UserIdentityType: o2 } = s2(855), { Request: a } = s2(406), c3 = s2(988), d3 = s2(266), u2 = s2(437), h3 = s2(425), m3 = s2(808), g2 = s2(404);
37137
37137
  e2.exports = class extends h3 {
37138
37138
  constructor() {
37139
37139
  super(), this.requests = [], this.additionalPresentationContexts = [], this.network = void 0, this.statistics = new d3();
@@ -37165,26 +37165,26 @@ var require_dcmjs_dimse_min = __commonJS({
37165
37165
  });
37166
37166
  let h4 = {};
37167
37167
  a2.securityOptions && (h4 = { key: a2.securityOptions.key, cert: a2.securityOptions.cert, ca: a2.securityOptions.ca, requestCert: a2.securityOptions.requestCert, rejectUnauthorized: a2.securityOptions.rejectUnauthorized, minVersion: a2.securityOptions.minVersion, maxVersion: a2.securityOptions.maxVersion, ciphers: a2.securityOptions.ciphers }), u2.info(`Connecting to ${e3}:${t3} ${a2.securityOptions ? "(TLS)" : ""}`);
37168
- const l2 = (a2.securityOptions ? g3 : m3).connect({ host: e3, port: t3, ...h4 }), p2 = new c3(l2, a2);
37169
- p2.on("connect", () => {
37170
- this.emit("connected"), p2.sendAssociationRequest(d4);
37171
- }), p2.on("associationAccepted", (e4) => {
37172
- this.emit("associationAccepted", e4), p2.sendRequests(this.requests);
37173
- }), p2.on("associationReleaseResponse", () => {
37168
+ const l2 = (a2.securityOptions ? g2 : m3).connect({ host: e3, port: t3, ...h4 }), p3 = new c3(l2, a2);
37169
+ p3.on("connect", () => {
37170
+ this.emit("connected"), p3.sendAssociationRequest(d4);
37171
+ }), p3.on("associationAccepted", (e4) => {
37172
+ this.emit("associationAccepted", e4), p3.sendRequests(this.requests);
37173
+ }), p3.on("associationReleaseResponse", () => {
37174
37174
  this.emit("associationReleased"), l2.end();
37175
- }), p2.on("associationRejected", (e4) => {
37175
+ }), p3.on("associationRejected", (e4) => {
37176
37176
  this.emit("associationRejected", e4), l2.end();
37177
- }), p2.on("done", () => {
37178
- setTimeout(() => p2.sendAssociationReleaseRequest(), this.associationLingerTimeout);
37179
- }), p2.on("cStoreRequest", (e4, t4) => {
37177
+ }), p3.on("done", () => {
37178
+ setTimeout(() => p3.sendAssociationReleaseRequest(), this.associationLingerTimeout);
37179
+ }), p3.on("cStoreRequest", (e4, t4) => {
37180
37180
  this.emit("cStoreRequest", e4, t4);
37181
- }), p2.on("nEventReportRequest", (e4, t4) => {
37181
+ }), p3.on("nEventReportRequest", (e4, t4) => {
37182
37182
  this.emit("nEventReportRequest", e4, t4);
37183
- }), p2.on("networkError", (e4) => {
37183
+ }), p3.on("networkError", (e4) => {
37184
37184
  l2.end(), this.emit("networkError", e4);
37185
- }), p2.on("close", () => {
37186
- this.statistics.addFromOtherStatistics(p2.getStatistics()), this.network = void 0, this.emit("closed");
37187
- }), this.network = p2;
37185
+ }), p3.on("close", () => {
37186
+ this.statistics.addFromOtherStatistics(p3.getStatistics()), this.network = void 0, this.emit("closed");
37187
+ }), this.network = p3;
37188
37188
  }
37189
37189
  getStatistics() {
37190
37190
  return this.statistics;
@@ -37202,7 +37202,7 @@ var require_dcmjs_dimse_min = __commonJS({
37202
37202
  };
37203
37203
  }, 406: (e2, t2, s2) => {
37204
37204
  const { CommandFieldType: n2, Priority: i3, SopClass: r5, Status: o2 } = s2(855), a = s2(347), { Mixin: c3 } = s2(842), { EOL: d3 } = s2(37), u2 = s2(425), h3 = s2(836), { DicomMetaDictionary: m3 } = h3.data;
37205
- class g3 {
37205
+ class g2 {
37206
37206
  constructor(e3, t3) {
37207
37207
  this.commandDataset = e3 || new a(), this.dataset = t3;
37208
37208
  }
@@ -37281,7 +37281,7 @@ var require_dcmjs_dimse_min = __commonJS({
37281
37281
  }
37282
37282
  }
37283
37283
  }
37284
- class l2 extends c3(g3, u2) {
37284
+ class l2 extends c3(g2, u2) {
37285
37285
  constructor(e3, t3, s3) {
37286
37286
  switch (super(new a({ CommandField: e3, CommandDataSetType: s3 ? 514 : 257 })), e3) {
37287
37287
  case n2.NGetRequest:
@@ -37337,7 +37337,7 @@ var require_dcmjs_dimse_min = __commonJS({
37337
37337
  return `${super.toString(e3)} [id: ${this.getMessageId() || ""}]`;
37338
37338
  }
37339
37339
  }
37340
- class p2 extends g3 {
37340
+ class p3 extends g2 {
37341
37341
  constructor(e3, t3, s3, i4, r6) {
37342
37342
  switch (super(new a({ CommandField: e3, CommandDataSetType: s3 ? 514 : 257, Status: i4, ErrorComment: r6 })), e3) {
37343
37343
  case n2.NGetRequest:
@@ -37449,18 +37449,18 @@ var require_dcmjs_dimse_min = __commonJS({
37449
37449
  super(n2.CEchoRequest, r5.Verification, false);
37450
37450
  }
37451
37451
  }
37452
- class f2 extends p2 {
37452
+ class f extends p3 {
37453
37453
  constructor(e3, t3) {
37454
37454
  super(n2.CEchoResponse, r5.Verification, false, e3, t3);
37455
37455
  }
37456
37456
  static fromRequest(e3) {
37457
37457
  if (!(e3 instanceof R2))
37458
37458
  throw new Error("Request should be an instance of CEchoRequest");
37459
- const t3 = new f2(o2.ProcessingFailure);
37459
+ const t3 = new f(o2.ProcessingFailure);
37460
37460
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
37461
37461
  }
37462
37462
  }
37463
- class y extends l2 {
37463
+ class y2 extends l2 {
37464
37464
  constructor(e3) {
37465
37465
  super(n2.CFindRequest, r5.StudyRootQueryRetrieveInformationModelFind, false), this.setPriority(e3 || i3.Medium);
37466
37466
  }
@@ -37473,34 +37473,34 @@ var require_dcmjs_dimse_min = __commonJS({
37473
37473
  static createStudyFindRequest(e3, t3) {
37474
37474
  const s3 = { PatientID: "", PatientName: "", IssuerOfPatientID: "", PatientSex: "", PatientBirthDate: "", StudyInstanceUID: "", ModalitiesInStudy: "", StudyID: "", AccessionNumber: "", StudyDate: "", StudyTime: "", StudyDescription: "", NumberOfStudyRelatedSeries: "", NumberOfStudyRelatedInstances: "", ...e3 };
37475
37475
  s3.QueryRetrieveLevel = "STUDY";
37476
- const n3 = new y(t3);
37476
+ const n3 = new y2(t3);
37477
37477
  return n3.setDataset(new a(s3)), n3;
37478
37478
  }
37479
37479
  static createSeriesFindRequest(e3, t3) {
37480
37480
  const s3 = { StudyInstanceUID: "", SeriesInstanceUID: "", SeriesNumber: "", SeriesDescription: "", Modality: "", SeriesDate: "", SeriesTime: "", NumberOfSeriesRelatedInstances: "", ...e3 };
37481
37481
  s3.QueryRetrieveLevel = "SERIES";
37482
- const n3 = new y(t3);
37482
+ const n3 = new y2(t3);
37483
37483
  return n3.setDataset(new a(s3)), n3;
37484
37484
  }
37485
37485
  static createImageFindRequest(e3, t3) {
37486
37486
  const s3 = { StudyInstanceUID: "", SeriesInstanceUID: "", SOPInstanceUID: "", InstanceNumber: "", Modality: "", ...e3 };
37487
37487
  s3.QueryRetrieveLevel = "IMAGE";
37488
- const n3 = new y(t3);
37488
+ const n3 = new y2(t3);
37489
37489
  return n3.setDataset(new a(s3)), n3;
37490
37490
  }
37491
37491
  static createWorklistFindRequest(e3, t3) {
37492
37492
  const s3 = { PatientID: "", PatientName: "", IssuerOfPatientID: "", PatientSex: "", PatientWeight: "", PatientBirthDate: "", MedicalAlerts: "", PregnancyStatus: "", Allergies: "", PatientComments: "", SpecialNeeds: "", PatientState: "", CurrentPatientLocation: "", InstitutionName: "", AdmissionID: "", AccessionNumber: "", ReferringPhysicianName: "", AdmittingDiagnosesDescription: "", RequestingPhysician: "", StudyInstanceUID: "", StudyDescription: "", StudyID: "", ReasonForTheRequestedProcedure: "", StudyDate: "", StudyTime: "", RequestedProcedureID: "", RequestedProcedureDescription: "", RequestedProcedurePriority: "", RequestedProcedureCodeSequence: [], ReferencedStudySequence: [], ProcedureCodeSequence: [], ScheduledProcedureStepSequence: [{ ScheduledStationAETitle: "", ScheduledStationName: "", ScheduledProcedureStepStartDate: "", ScheduledProcedureStepStartTime: "", Modality: "", ScheduledPerformingPhysicianName: "", ScheduledProcedureStepDescription: "", ScheduledProtocolCodeSequence: [], ScheduledProcedureStepLocation: "", ScheduledProcedureStepID: "", RequestedContrastAgent: "", PreMedication: "", AnatomicalOrientationType: "" }], ...e3 };
37493
37493
  s3.QueryRetrieveLevel = "";
37494
- const n3 = new y(t3);
37494
+ const n3 = new y2(t3);
37495
37495
  return n3.setAffectedSopClassUid(r5.ModalityWorklistInformationModelFind), n3.setDataset(new a(s3)), n3;
37496
37496
  }
37497
37497
  }
37498
- class S2 extends p2 {
37498
+ class S2 extends p3 {
37499
37499
  constructor(e3, t3) {
37500
37500
  super(n2.CFindResponse, r5.StudyRootQueryRetrieveInformationModelFind, false, e3, t3);
37501
37501
  }
37502
37502
  static fromRequest(e3) {
37503
- if (!(e3 instanceof y))
37503
+ if (!(e3 instanceof y2))
37504
37504
  throw new Error("Request should be an instance of CFindRequest");
37505
37505
  const t3 = new S2(o2.ProcessingFailure);
37506
37506
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
@@ -37525,7 +37525,7 @@ var require_dcmjs_dimse_min = __commonJS({
37525
37525
  void 0 !== this.needsFullDatasetLoading && true === this.needsFullDatasetLoading && void 0 !== this.datasetOrFile && "" !== this.datasetOrFile.trim() && this.setDataset(a.fromFile(this.datasetOrFile));
37526
37526
  }
37527
37527
  }
37528
- class C2 extends p2 {
37528
+ class C2 extends p3 {
37529
37529
  constructor(e3, t3) {
37530
37530
  super(n2.CStoreResponse, "", false, e3, t3);
37531
37531
  }
@@ -37559,7 +37559,7 @@ var require_dcmjs_dimse_min = __commonJS({
37559
37559
  return o3.setDataset(new a(r6)), o3.getCommandDataset().setElement("MoveDestination", e3), o3;
37560
37560
  }
37561
37561
  }
37562
- class v3 extends p2 {
37562
+ class v3 extends p3 {
37563
37563
  constructor(e3, t3) {
37564
37564
  super(n2.CMoveResponse, r5.StudyRootQueryRetrieveInformationModelMove, false, e3, t3);
37565
37565
  }
@@ -37611,7 +37611,7 @@ var require_dcmjs_dimse_min = __commonJS({
37611
37611
  return r6.setDataset(new a(i4)), r6;
37612
37612
  }
37613
37613
  }
37614
- class w2 extends p2 {
37614
+ class w2 extends p3 {
37615
37615
  constructor(e3, t3) {
37616
37616
  super(n2.CGetResponse, r5.StudyRootQueryRetrieveInformationModelGet, false, e3, t3);
37617
37617
  }
@@ -37639,7 +37639,7 @@ var require_dcmjs_dimse_min = __commonJS({
37639
37639
  super(n2.NCreateRequest, e3, false), this.setAffectedSopInstanceUid(t3);
37640
37640
  }
37641
37641
  }
37642
- class U2 extends p2 {
37642
+ class U2 extends p3 {
37643
37643
  constructor(e3, t3, s3, i4) {
37644
37644
  super(n2.NCreateResponse, e3, false, s3, i4), this.setAffectedSopInstanceUid(t3);
37645
37645
  }
@@ -37661,7 +37661,7 @@ var require_dcmjs_dimse_min = __commonJS({
37661
37661
  this.getCommandDataset().setElement("ActionTypeID", e3);
37662
37662
  }
37663
37663
  }
37664
- class D2 extends p2 {
37664
+ class D2 extends p3 {
37665
37665
  constructor(e3, t3, s3, i4, r6) {
37666
37666
  super(n2.NActionResponse, e3, false, i4, r6), this.setAffectedSopInstanceUid(t3), this.setActionTypeId(s3);
37667
37667
  }
@@ -37683,7 +37683,7 @@ var require_dcmjs_dimse_min = __commonJS({
37683
37683
  super(n2.NDeleteRequest, e3, false), this.setRequestedSopInstanceUid(t3);
37684
37684
  }
37685
37685
  }
37686
- class T extends p2 {
37686
+ class T extends p3 {
37687
37687
  constructor(e3, t3, s3, i4) {
37688
37688
  super(n2.NDeleteResponse, e3, false, s3, i4), this.setAffectedSopInstanceUid(t3);
37689
37689
  }
@@ -37705,7 +37705,7 @@ var require_dcmjs_dimse_min = __commonJS({
37705
37705
  this.getCommandDataset().setElement("EventTypeID", e3);
37706
37706
  }
37707
37707
  }
37708
- class b2 extends p2 {
37708
+ class b2 extends p3 {
37709
37709
  constructor(e3, t3, s3, i4, r6) {
37710
37710
  super(n2.NEventReportResponse, e3, false, i4, r6), this.setAffectedSopInstanceUid(t3), this.setEventTypeId(s3);
37711
37711
  }
@@ -37748,7 +37748,7 @@ var require_dcmjs_dimse_min = __commonJS({
37748
37748
  return "0".repeat(t3 - s3.length) + s3;
37749
37749
  }
37750
37750
  }
37751
- class B2 extends p2 {
37751
+ class B2 extends p3 {
37752
37752
  constructor(e3, t3, s3, i4) {
37753
37753
  super(n2.NGetResponse, e3, false, s3, i4), this.setAffectedSopInstanceUid(t3);
37754
37754
  }
@@ -37764,7 +37764,7 @@ var require_dcmjs_dimse_min = __commonJS({
37764
37764
  super(n2.NSetRequest, e3, false), this.setRequestedSopInstanceUid(t3);
37765
37765
  }
37766
37766
  }
37767
- class L2 extends p2 {
37767
+ class L2 extends p3 {
37768
37768
  constructor(e3, t3, s3, i4) {
37769
37769
  super(n2.NSetResponse, e3, false, s3, i4), this.setAffectedSopInstanceUid(t3);
37770
37770
  }
@@ -37786,12 +37786,12 @@ var require_dcmjs_dimse_min = __commonJS({
37786
37786
  this.getCommandDataset().setElement("MessageIDBeingRespondedTo", e3);
37787
37787
  }
37788
37788
  static fromRequest(e3) {
37789
- if (!(e3 instanceof y || e3 instanceof P2 || e3 instanceof x))
37789
+ if (!(e3 instanceof y2 || e3 instanceof P2 || e3 instanceof x))
37790
37790
  throw new Error("Request should be an instance of CFindRequest, CMoveRequest or CGetRequest");
37791
37791
  return new F(e3.getAffectedSopClassUid(), e3.getMessageId());
37792
37792
  }
37793
37793
  }
37794
- e2.exports = { CCancelRequest: F, CEchoRequest: R2, CEchoResponse: f2, CFindRequest: y, CFindResponse: S2, CGetRequest: x, CGetResponse: w2, CMoveRequest: P2, CMoveResponse: v3, Command: g3, CStoreRequest: I2, CStoreResponse: C2, NActionRequest: q, NActionResponse: D2, NCreateRequest: A2, NCreateResponse: U2, NDeleteRequest: E2, NDeleteResponse: T, NEventReportRequest: O2, NEventReportResponse: b2, NGetRequest: N2, NGetResponse: B2, NSetRequest: M2, NSetResponse: L2, Request: l2, Response: p2 };
37794
+ e2.exports = { CCancelRequest: F, CEchoRequest: R2, CEchoResponse: f, CFindRequest: y2, CFindResponse: S2, CGetRequest: x, CGetResponse: w2, CMoveRequest: P2, CMoveResponse: v3, Command: g2, CStoreRequest: I2, CStoreResponse: C2, NActionRequest: q, NActionResponse: D2, NCreateRequest: A2, NCreateResponse: U2, NDeleteRequest: E2, NDeleteResponse: T, NEventReportRequest: O2, NEventReportResponse: b2, NGetRequest: N2, NGetResponse: B2, NSetRequest: M2, NSetResponse: L2, Request: l2, Response: p3 };
37795
37795
  }, 855: (e2) => {
37796
37796
  const t2 = { CStoreRequest: 1, CStoreResponse: 32769, CGetRequest: 16, CGetResponse: 32784, CFindRequest: 32, CFindResponse: 32800, CMoveRequest: 33, CMoveResponse: 32801, CEchoRequest: 48, CEchoResponse: 32816, NEventReportRequest: 256, NEventReportResponse: 33024, NGetRequest: 272, NGetResponse: 33040, NSetRequest: 288, NSetResponse: 33056, NActionRequest: 304, NActionResponse: 33072, NCreateRequest: 320, NCreateResponse: 33088, NDeleteRequest: 336, NDeleteResponse: 33104, CCancelRequest: 4095 };
37797
37797
  Object.freeze(t2);
@@ -37817,19 +37817,19 @@ var require_dcmjs_dimse_min = __commonJS({
37817
37817
  Object.freeze(h3);
37818
37818
  const m3 = { BasicTextSrStorage: "1.2.840.10008.5.1.4.1.1.88.11", BreastProjectionXRayImageStorageForPresentation: "1.2.840.10008.5.1.4.1.1.13.1.4", BreastProjectionXRayImageStorageForProcessing: "1.2.840.10008.5.1.4.1.1.13.1.5", BreastTomosynthesisImageStorage: "1.2.840.10008.5.1.4.1.1.13.1.3", ChestCadSrStorage: "1.2.840.10008.5.1.4.1.1.88.65", ComprehensiveSrStorage: "1.2.840.10008.5.1.4.1.1.88.33", ComputedRadiographyImageStorage: "1.2.840.10008.5.1.4.1.1.1", CtImageStorage: "1.2.840.10008.5.1.4.1.1.2", DigitalIntraOralXRayImageStorageForPresentation: "1.2.840.10008.5.1.4.1.1.1.3", DigitalIntraOralXRayImageStorageForProcessing: "1.2.840.10008.5.1.4.1.1.1.3.1", DigitalMammographyXRayImageStorageForPresentation: "1.2.840.10008.5.1.4.1.1.1.2", DigitalMammographyXRayImageStorageForProcessing: "1.2.840.10008.5.1.4.1.1.1.2.1", DigitalXRayImageStorageForPresentation: "1.2.840.10008.5.1.4.1.1.1.1", DigitalXRayImageStorageForProcessing: "1.2.840.10008.5.1.4.1.1.1.1.1", EncapsulatedCdaStorage: "1.2.840.10008.5.1.4.1.1.104.2", EncapsulatedPdfStorage: "1.2.840.10008.5.1.4.1.1.104.1", EnhancedCtImageStorage: "1.2.840.10008.5.1.4.1.1.2.1", EnhancedMrColorImageStorage: "1.2.840.10008.5.1.4.1.1.4.3", EnhancedMrImageStorage: "1.2.840.10008.5.1.4.1.1.4.1", EnhancedPetImageStorage: "1.2.840.10008.5.1.4.1.1.130", EnhancedSrStorage: "1.2.840.10008.5.1.4.1.1.88.22", EnhancedXaImageStorage: "1.2.840.10008.5.1.4.1.1.12.1.1", EnhancedXrfImageStorage: "1.2.840.10008.5.1.4.1.1.12.2.1", IntravascularOpticalCoherenceTomographyImageStorageForPresentation: "1.2.840.10008.5.1.4.1.1.14.1", IntravascularOpticalCoherenceTomographyImageStorageForProcessing: "1.2.840.10008.5.1.4.1.1.14.2", LegacyConvertedEnhancedCTImageStorage: "1.2.840.10008.5.1.4.1.1.2.2", LegacyConvertedEnhancedMRImageStorage: "1.2.840.10008.5.1.4.1.1.4.4", LegacyConvertedEnhancedPETImageStorage: "1.2.840.10008.5.1.4.1.1.128.1", MammographyCadSrStorage: "1.2.840.10008.5.1.4.1.1.88.50", MrImageStorage: "1.2.840.10008.5.1.4.1.1.4", MultiframeGrayscaleByteSecondaryCaptureImageStorage: "1.2.840.10008.5.1.4.1.1.7.2", MultiframeGrayscaleWordSecondaryCaptureImageStorage: "1.2.840.10008.5.1.4.1.1.7.3", MultiframeSingleBitSecondaryCaptureImageStorage: "1.2.840.10008.5.1.4.1.1.7.1", MultiframeTrueColorSecondaryCaptureImageStorage: "1.2.840.10008.5.1.4.1.1.7.4", NuclearMedicineImageStorage: "1.2.840.10008.5.1.4.1.1.20", OphthalmicOpticalCoherenceTomographyEnFaceImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.5.7", OphthalmicPhotography16BitImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.5.2", OphthalmicPhotography8BitImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.5.1", OphthalmicTomographyImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.5.4", PositronEmissionTomographyImageStorage: "1.2.840.10008.5.1.4.1.1.128", RtImageStorage: "1.2.840.10008.5.1.4.1.1.481.1", SecondaryCaptureImageStorage: "1.2.840.10008.5.1.4.1.1.7", UltrasoundImageStorage: "1.2.840.10008.5.1.4.1.1.6.1", UltrasoundMultiframeImageStorage: "1.2.840.10008.5.1.4.1.1.3.1", VideoEndoscopicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.1.1", VideoMicroscopicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.2.1", VideoPhotographicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.4.1", VlEndoscopicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.1", VlMicroscopicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.2", VlPhotographicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.4", VlSlideCoordinatesMicroscopicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.3", VlWholeSlideMicroscopyImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.6", WideFieldOphthalmicPhotography3dCoordinatesImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.5.6", WideFieldOphthalmicPhotographyStereographicProjectionImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.5.5", XRay3dAngiographicImageStorage: "1.2.840.10008.5.1.4.1.1.13.1.1", XRay3dCraniofacialImageStorage: "1.2.840.10008.5.1.4.1.1.13.1.2", XRayAngiographicImageStorage: "1.2.840.10008.5.1.4.1.1.12.1", XRayRadiationDoseSRStorage: "1.2.840.10008.5.1.4.1.1.88.67", XRayRadiofluoroscopicImageStorage: "1.2.840.10008.5.1.4.1.1.12.2" };
37819
37819
  Object.freeze(m3);
37820
- const g3 = { Verification: "1.2.840.10008.1.1", StudyRootQueryRetrieveInformationModelFind: "1.2.840.10008.5.1.4.1.2.2.1", ModalityWorklistInformationModelFind: "1.2.840.10008.5.1.4.31", ModalityPerformedProcedureStep: "1.2.840.10008.3.1.2.3.3", StudyRootQueryRetrieveInformationModelMove: "1.2.840.10008.5.1.4.1.2.2.2", StudyRootQueryRetrieveInformationModelGet: "1.2.840.10008.5.1.4.1.2.2.3", StorageCommitmentPushModel: "1.2.840.10008.1.20.1", BasicFilmSession: "1.2.840.10008.5.1.1.1", PrintJob: "1.2.840.10008.5.1.1.14", BasicAnnotationBox: "1.2.840.10008.5.1.1.15", Printer: "1.2.840.10008.5.1.1.16", PrinterConfigurationRetrieval: "1.2.840.10008.5.1.1.16.376", BasicGrayscalePrintManagementMeta: "1.2.840.10008.5.1.1.9", BasicColorPrintManagementMeta: "1.2.840.10008.5.1.1.18", BasicFilmBox: "1.2.840.10008.5.1.1.2", PresentationLut: "1.2.840.10008.5.1.1.23", BasicGrayscaleImageBox: "1.2.840.10008.5.1.1.4", BasicColorImageBox: "1.2.840.10008.5.1.1.4.1", InstanceAvailabilityNotification: "1.2.840.10008.5.1.4.33" };
37821
- Object.freeze(g3);
37820
+ const g2 = { Verification: "1.2.840.10008.1.1", StudyRootQueryRetrieveInformationModelFind: "1.2.840.10008.5.1.4.1.2.2.1", ModalityWorklistInformationModelFind: "1.2.840.10008.5.1.4.31", ModalityPerformedProcedureStep: "1.2.840.10008.3.1.2.3.3", StudyRootQueryRetrieveInformationModelMove: "1.2.840.10008.5.1.4.1.2.2.2", StudyRootQueryRetrieveInformationModelGet: "1.2.840.10008.5.1.4.1.2.2.3", StorageCommitmentPushModel: "1.2.840.10008.1.20.1", BasicFilmSession: "1.2.840.10008.5.1.1.1", PrintJob: "1.2.840.10008.5.1.1.14", BasicAnnotationBox: "1.2.840.10008.5.1.1.15", Printer: "1.2.840.10008.5.1.1.16", PrinterConfigurationRetrieval: "1.2.840.10008.5.1.1.16.376", BasicGrayscalePrintManagementMeta: "1.2.840.10008.5.1.1.9", BasicColorPrintManagementMeta: "1.2.840.10008.5.1.1.18", BasicFilmBox: "1.2.840.10008.5.1.1.2", PresentationLut: "1.2.840.10008.5.1.1.23", BasicGrayscaleImageBox: "1.2.840.10008.5.1.1.4", BasicColorImageBox: "1.2.840.10008.5.1.1.4.1", InstanceAvailabilityNotification: "1.2.840.10008.5.1.4.33" };
37821
+ Object.freeze(g2);
37822
37822
  const l2 = { ImplicitVRLittleEndian: "1.2.840.10008.1.2", ExplicitVRLittleEndian: "1.2.840.10008.1.2.1", DeflatedExplicitVRLittleEndian: "1.2.840.10008.1.2.1.99", ExplicitVRBigEndian: "1.2.840.10008.1.2.2", RleLossless: "1.2.840.10008.1.2.5", JpegBaseline: "1.2.840.10008.1.2.4.50", JpegLossless: "1.2.840.10008.1.2.4.70", JpegLsLossless: "1.2.840.10008.1.2.4.80", JpegLsLossy: "1.2.840.10008.1.2.4.81", Jpeg2000Lossless: "1.2.840.10008.1.2.4.90", Jpeg2000Lossy: "1.2.840.10008.1.2.4.91" };
37823
37823
  Object.freeze(l2);
37824
- const p2 = [l2.ImplicitVRLittleEndian, l2.ExplicitVRLittleEndian];
37825
- Object.freeze(p2);
37824
+ const p3 = [l2.ImplicitVRLittleEndian, l2.ExplicitVRLittleEndian];
37825
+ Object.freeze(p3);
37826
37826
  const R2 = { ImplementationClassUid: "1.2.826.0.1.3680043.10.854", ImplementationVersion: "DCMJS-DIMSE-V0.1", MaxPduLength: 262144 };
37827
- Object.freeze(R2), e2.exports = { AbortReason: r5, AbortSource: i3, CommandFieldType: t2, DefaultImplementation: R2, PresentationContextResult: s2, Priority: d3, RejectReason: c3, RejectResult: o2, RejectSource: a, SopClass: g3, Status: u2, StorageClass: m3, TranscodableTransferSyntaxes: p2, TransferSyntax: l2, Uid: h3, UserIdentityType: n2 };
37827
+ Object.freeze(R2), e2.exports = { AbortReason: r5, AbortSource: i3, CommandFieldType: t2, DefaultImplementation: R2, PresentationContextResult: s2, Priority: d3, RejectReason: c3, RejectResult: o2, RejectSource: a, SopClass: g2, Status: u2, StorageClass: m3, TranscodableTransferSyntaxes: p3, TransferSyntax: l2, Uid: h3, UserIdentityType: n2 };
37828
37828
  }, 347: (e2, t2, s2) => {
37829
- const { StorageClass: n2, TransferSyntax: i3 } = s2(855), r5 = s2(719), { readFile: o2, readFileSync: a, writeFile: c3, writeFileSync: d3 } = s2(147), { EOL: u2 } = s2(37), h3 = s2(836), { DicomDict: m3, DicomMessage: g3, DicomMetaDictionary: l2, ReadBufferStream: p2, WriteBufferStream: R2 } = h3.data, f2 = h3.log;
37830
- class y {
37829
+ const { StorageClass: n2, TransferSyntax: i3 } = s2(855), r5 = s2(719), { readFile: o2, readFileSync: a, writeFile: c3, writeFileSync: d3 } = s2(147), { EOL: u2 } = s2(37), h3 = s2(836), { DicomDict: m3, DicomMessage: g2, DicomMetaDictionary: l2, ReadBufferStream: p3, WriteBufferStream: R2 } = h3.data, f = h3.log;
37830
+ class y2 {
37831
37831
  constructor(e3, t3, s3) {
37832
- s3 = s3 || {}, s3 = { ignoreErrors: true, ...s3 }, f2.level = "error", this.transferSyntaxUid = t3 || i3.ImplicitVRLittleEndian, Buffer.isBuffer(e3) ? this.elements = this._fromElementsBuffer(e3, this.transferSyntaxUid, s3) : this.elements = e3 || {};
37832
+ s3 = s3 || {}, s3 = { ignoreErrors: true, ...s3 }, f.level = "error", this.transferSyntaxUid = t3 || i3.ImplicitVRLittleEndian, Buffer.isBuffer(e3) ? this.elements = this._fromElementsBuffer(e3, this.transferSyntaxUid, s3) : this.elements = e3 || {};
37833
37833
  }
37834
37834
  getElement(e3) {
37835
37835
  return this.elements[e3];
@@ -37848,11 +37848,11 @@ var require_dcmjs_dimse_min = __commonJS({
37848
37848
  }
37849
37849
  getDenaturalizedDataset(e3, t3) {
37850
37850
  const s3 = t3 ? l2.denaturalizeDataset(this.getElements(), { ...l2.nameMap, ...t3 }) : l2.denaturalizeDataset(this.getElements()), n3 = new R2();
37851
- return g3.write(s3, n3, this.transferSyntaxUid, e3), Buffer.from(n3.getBuffer());
37851
+ return g2.write(s3, n3, this.transferSyntaxUid, e3), Buffer.from(n3.getBuffer());
37852
37852
  }
37853
37853
  getDenaturalizedCommandDataset() {
37854
37854
  const e3 = l2.denaturalizeDataset(this.getElements()), t3 = new R2(), s3 = new R2();
37855
- return g3.write(e3, s3, i3.ImplicitVRLittleEndian, {}), g3.writeTagObject(t3, "00000000", "UL", s3.size, i3.ImplicitVRLittleEndian, {}), t3.concat(s3), Buffer.from(t3.getBuffer());
37855
+ return g2.write(e3, s3, i3.ImplicitVRLittleEndian, {}), g2.writeTagObject(t3, "00000000", "UL", s3.size, i3.ImplicitVRLittleEndian, {}), t3.concat(s3), Buffer.from(t3.getBuffer());
37856
37856
  }
37857
37857
  static fromFile(e3, t3, s3) {
37858
37858
  if (!(void 0 !== t3 && t3 instanceof Function))
@@ -37869,7 +37869,7 @@ var require_dcmjs_dimse_min = __commonJS({
37869
37869
  });
37870
37870
  }
37871
37871
  toFile(e3, t3, s3, i4) {
37872
- const o3 = { _meta: { FileMetaInformationVersion: new Uint8Array([0, 1]).buffer, MediaStorageSOPClassUID: this.getElement("SOPClassUID") || n2.SecondaryCaptureImageStorage, MediaStorageSOPInstanceUID: this.getElement("SOPInstanceUID") || y.generateDerivedUid(), TransferSyntaxUID: this.getTransferSyntaxUid(), ImplementationClassUID: r5.getImplementationClassUid(), ImplementationVersionName: r5.getImplementationVersion() }, ...this.getElements() }, a2 = l2.denaturalizeDataset(o3._meta), u3 = new m3(a2);
37872
+ const o3 = { _meta: { FileMetaInformationVersion: new Uint8Array([0, 1]).buffer, MediaStorageSOPClassUID: this.getElement("SOPClassUID") || n2.SecondaryCaptureImageStorage, MediaStorageSOPInstanceUID: this.getElement("SOPInstanceUID") || y2.generateDerivedUid(), TransferSyntaxUID: this.getTransferSyntaxUid(), ImplementationClassUID: r5.getImplementationClassUid(), ImplementationVersionName: r5.getImplementationVersion() }, ...this.getElements() }, a2 = l2.denaturalizeDataset(o3._meta), u3 = new m3(a2);
37873
37873
  u3.dict = s3 ? l2.denaturalizeDataset(o3, { ...l2.nameMap, ...s3 }) : l2.denaturalizeDataset(o3), t3 instanceof Function ? c3(e3, Buffer.from(u3.write(i4)), (e4) => {
37874
37874
  t3(e4 || void 0);
37875
37875
  }) : d3(e3, Buffer.from(u3.write(i4)));
@@ -37883,17 +37883,17 @@ var require_dcmjs_dimse_min = __commonJS({
37883
37883
  }
37884
37884
  static _fromP10Buffer(e3, t3) {
37885
37885
  t3 = t3 || {}, t3 = { ignoreErrors: true, ...t3 };
37886
- const s3 = g3.readFile(e3.buffer.slice(e3.byteOffset, e3.byteOffset + e3.byteLength), t3), n3 = l2.naturalizeDataset(s3.meta).TransferSyntaxUID, i4 = l2.naturalizeDataset(s3.dict);
37887
- return new y(i4, n3);
37886
+ const s3 = g2.readFile(e3.buffer.slice(e3.byteOffset, e3.byteOffset + e3.byteLength), t3), n3 = l2.naturalizeDataset(s3.meta).TransferSyntaxUID, i4 = l2.naturalizeDataset(s3.dict);
37887
+ return new y2(i4, n3);
37888
37888
  }
37889
37889
  _fromElementsBuffer(e3, t3, s3) {
37890
- const n3 = new p2(e3.buffer.slice(e3.byteOffset, e3.byteOffset + e3.byteLength));
37890
+ const n3 = new p3(e3.buffer.slice(e3.byteOffset, e3.byteOffset + e3.byteLength));
37891
37891
  let r6 = t3 === i3.ImplicitVRLittleEndian ? i3.ImplicitVRLittleEndian : i3.ExplicitVRLittleEndian;
37892
- const o3 = g3._read(n3, r6, s3);
37892
+ const o3 = g2._read(n3, r6, s3);
37893
37893
  return l2.naturalizeDataset(o3);
37894
37894
  }
37895
37895
  }
37896
- e2.exports = y;
37896
+ e2.exports = y2;
37897
37897
  }, 719: (e2, t2, s2) => {
37898
37898
  const { DefaultImplementation: n2 } = s2(855);
37899
37899
  e2.exports = class {
@@ -37917,7 +37917,7 @@ var require_dcmjs_dimse_min = __commonJS({
37917
37917
  }
37918
37918
  };
37919
37919
  }, 988: (e2, t2, s2) => {
37920
- const { Association: n2 } = s2(201), { AAbort: i3, AAssociateAC: r5, AAssociateRJ: o2, AAssociateRQ: a, AReleaseRP: c3, AReleaseRQ: d3, PDataTF: u2, Pdv: h3, RawPdu: m3 } = s2(634), { CommandFieldType: g3, Status: l2, TranscodableTransferSyntaxes: p2 } = s2(855), { CCancelRequest: R2, CEchoRequest: f2, CEchoResponse: y, CFindRequest: S2, CFindResponse: I2, CGetRequest: C2, CGetResponse: P2, CMoveRequest: v3, CMoveResponse: x, Command: w2, CStoreRequest: A2, CStoreResponse: U2, NActionRequest: q, NActionResponse: D2, NCreateRequest: E2, NCreateResponse: T, NDeleteRequest: O2, NDeleteResponse: b2, NEventReportRequest: N2, NEventReportResponse: B2, NGetRequest: M2, NGetResponse: L2, NSetRequest: F, NSetResponse: k2, Response: $ } = s2(406), j2 = s2(347), V2 = s2(719), G2 = s2(266), _2 = s2(437), { SmartBuffer: z2 } = s2(677), { EOL: Q2 } = s2(37), W = s2(425);
37920
+ const { Association: n2 } = s2(201), { AAbort: i3, AAssociateAC: r5, AAssociateRJ: o2, AAssociateRQ: a, AReleaseRP: c3, AReleaseRQ: d3, PDataTF: u2, Pdv: h3, RawPdu: m3 } = s2(634), { CommandFieldType: g2, Status: l2, TranscodableTransferSyntaxes: p3 } = s2(855), { CCancelRequest: R2, CEchoRequest: f, CEchoResponse: y2, CFindRequest: S2, CFindResponse: I2, CGetRequest: C2, CGetResponse: P2, CMoveRequest: v3, CMoveResponse: x, Command: w2, CStoreRequest: A2, CStoreResponse: U2, NActionRequest: q, NActionResponse: D2, NCreateRequest: E2, NCreateResponse: T, NDeleteRequest: O2, NDeleteResponse: b2, NEventReportRequest: N2, NEventReportResponse: B2, NGetRequest: M2, NGetResponse: L2, NSetRequest: F, NSetResponse: k2, Response: $ } = s2(406), j2 = s2(347), V2 = s2(719), G2 = s2(266), _2 = s2(437), { SmartBuffer: z2 } = s2(677), { EOL: Q2 } = s2(37), W = s2(425);
37921
37921
  class J2 extends W {
37922
37922
  constructor() {
37923
37923
  super();
@@ -38035,7 +38035,7 @@ var require_dcmjs_dimse_min = __commonJS({
38035
38035
  try {
38036
38036
  const t3 = e3.command.getDataset(), s3 = this.association.getPresentationContext(e3.context.getPresentationContextId()).getAcceptedTransferSyntaxUid();
38037
38037
  if (t3 && s3 !== t3.getTransferSyntaxUid()) {
38038
- if (!p2.includes(s3) || !p2.includes(t3.getTransferSyntaxUid()))
38038
+ if (!p3.includes(s3) || !p3.includes(t3.getTransferSyntaxUid()))
38039
38039
  return _2.error(`A transfer syntax transcoding from ${t3.getTransferSyntaxUid()} to ${s3} is currently not supported. Skipping...`), void e3.command.raiseDoneEvent();
38040
38040
  t3.setTransferSyntaxUid(s3);
38041
38041
  }
@@ -38116,73 +38116,73 @@ var require_dcmjs_dimse_min = __commonJS({
38116
38116
  if (e4.isCommand()) {
38117
38117
  const s3 = new w2(new j2(this.dimseBuffer.toBuffer()));
38118
38118
  switch (s3.getCommandFieldType()) {
38119
- case g3.CEchoRequest:
38120
- this.dimse = Object.assign(new f2(), s3);
38119
+ case g2.CEchoRequest:
38120
+ this.dimse = Object.assign(new f(), s3);
38121
38121
  break;
38122
- case g3.CEchoResponse:
38123
- this.dimse = Object.assign(new y(), s3);
38122
+ case g2.CEchoResponse:
38123
+ this.dimse = Object.assign(new y2(), s3);
38124
38124
  break;
38125
- case g3.CFindRequest:
38125
+ case g2.CFindRequest:
38126
38126
  this.dimse = Object.assign(new S2(), s3);
38127
38127
  break;
38128
- case g3.CFindResponse:
38128
+ case g2.CFindResponse:
38129
38129
  this.dimse = Object.assign(new I2(), s3);
38130
38130
  break;
38131
- case g3.CStoreRequest:
38131
+ case g2.CStoreRequest:
38132
38132
  this.dimse = Object.assign(new A2(), s3);
38133
38133
  break;
38134
- case g3.CStoreResponse:
38134
+ case g2.CStoreResponse:
38135
38135
  this.dimse = Object.assign(new U2(), s3);
38136
38136
  break;
38137
- case g3.CMoveRequest:
38137
+ case g2.CMoveRequest:
38138
38138
  this.dimse = Object.assign(new v3(), s3);
38139
38139
  break;
38140
- case g3.CMoveResponse:
38140
+ case g2.CMoveResponse:
38141
38141
  this.dimse = Object.assign(new x(), s3);
38142
38142
  break;
38143
- case g3.CGetRequest:
38143
+ case g2.CGetRequest:
38144
38144
  this.dimse = Object.assign(new C2(), s3);
38145
38145
  break;
38146
- case g3.CGetResponse:
38146
+ case g2.CGetResponse:
38147
38147
  this.dimse = Object.assign(new P2(), s3);
38148
38148
  break;
38149
- case g3.NCreateRequest:
38149
+ case g2.NCreateRequest:
38150
38150
  this.dimse = Object.assign(new E2(), s3);
38151
38151
  break;
38152
- case g3.NCreateResponse:
38152
+ case g2.NCreateResponse:
38153
38153
  this.dimse = Object.assign(new T(), s3);
38154
38154
  break;
38155
- case g3.NActionRequest:
38155
+ case g2.NActionRequest:
38156
38156
  this.dimse = Object.assign(new q(), s3);
38157
38157
  break;
38158
- case g3.NActionResponse:
38158
+ case g2.NActionResponse:
38159
38159
  this.dimse = Object.assign(new D2(), s3);
38160
38160
  break;
38161
- case g3.NDeleteRequest:
38161
+ case g2.NDeleteRequest:
38162
38162
  this.dimse = Object.assign(new O2(), s3);
38163
38163
  break;
38164
- case g3.NDeleteResponse:
38164
+ case g2.NDeleteResponse:
38165
38165
  this.dimse = Object.assign(new b2(), s3);
38166
38166
  break;
38167
- case g3.NEventReportRequest:
38167
+ case g2.NEventReportRequest:
38168
38168
  this.dimse = Object.assign(new N2(), s3);
38169
38169
  break;
38170
- case g3.NEventReportResponse:
38170
+ case g2.NEventReportResponse:
38171
38171
  this.dimse = Object.assign(new B2(), s3);
38172
38172
  break;
38173
- case g3.NGetRequest:
38173
+ case g2.NGetRequest:
38174
38174
  this.dimse = Object.assign(new M2(), s3);
38175
38175
  break;
38176
- case g3.NGetResponse:
38176
+ case g2.NGetResponse:
38177
38177
  this.dimse = Object.assign(new L2(), s3);
38178
38178
  break;
38179
- case g3.NSetRequest:
38179
+ case g2.NSetRequest:
38180
38180
  this.dimse = Object.assign(new F(), s3);
38181
38181
  break;
38182
- case g3.NSetResponse:
38182
+ case g2.NSetResponse:
38183
38183
  this.dimse = Object.assign(new k2(), s3);
38184
38184
  break;
38185
- case g3.CCancelRequest:
38185
+ case g2.CCancelRequest:
38186
38186
  this.dimse = Object.assign(new R2(), s3);
38187
38187
  break;
38188
38188
  default:
@@ -38205,35 +38205,35 @@ var require_dcmjs_dimse_min = __commonJS({
38205
38205
  const e4 = Object.assign(Object.create(Object.getPrototypeOf(t3)), t3), s3 = this.pending.find((e5) => e5.getMessageId() === t3.getMessageIdBeingRespondedTo());
38206
38206
  s3 && (s3.raiseResponseEvent(e4), e4.getStatus() !== l2.Pending && s3.raiseDoneEvent());
38207
38207
  } else
38208
- t3.getCommandFieldType() === g3.CEchoRequest ? this.emit("cEchoRequest", t3, (t4) => {
38208
+ t3.getCommandFieldType() === g2.CEchoRequest ? this.emit("cEchoRequest", t3, (t4) => {
38209
38209
  this._sendDimse({ context: e3, command: t4 });
38210
- }) : t3.getCommandFieldType() === g3.CFindRequest ? this.emit("cFindRequest", t3, (t4) => {
38210
+ }) : t3.getCommandFieldType() === g2.CFindRequest ? this.emit("cFindRequest", t3, (t4) => {
38211
38211
  (Array.isArray(t4) ? t4 : [t4]).forEach((t5) => {
38212
38212
  this._sendDimse({ context: e3, command: t5 });
38213
38213
  });
38214
- }) : t3.getCommandFieldType() === g3.CStoreRequest ? this.emit("cStoreRequest", t3, (t4) => {
38214
+ }) : t3.getCommandFieldType() === g2.CStoreRequest ? this.emit("cStoreRequest", t3, (t4) => {
38215
38215
  this._sendDimse({ context: e3, command: t4 });
38216
- }) : t3.getCommandFieldType() === g3.CMoveRequest ? this.emit("cMoveRequest", t3, (t4) => {
38216
+ }) : t3.getCommandFieldType() === g2.CMoveRequest ? this.emit("cMoveRequest", t3, (t4) => {
38217
38217
  (Array.isArray(t4) ? t4 : [t4]).forEach((t5) => {
38218
38218
  this._sendDimse({ context: e3, command: t5 });
38219
38219
  });
38220
- }) : t3.getCommandFieldType() === g3.CGetRequest ? this.emit("cGetRequest", t3, (t4) => {
38220
+ }) : t3.getCommandFieldType() === g2.CGetRequest ? this.emit("cGetRequest", t3, (t4) => {
38221
38221
  (Array.isArray(t4) ? t4 : [t4]).forEach((t5) => {
38222
38222
  this._sendDimse({ context: e3, command: t5 });
38223
38223
  });
38224
- }) : t3.getCommandFieldType() === g3.NCreateRequest ? this.emit("nCreateRequest", t3, (t4) => {
38224
+ }) : t3.getCommandFieldType() === g2.NCreateRequest ? this.emit("nCreateRequest", t3, (t4) => {
38225
38225
  this._sendDimse({ context: e3, command: t4 });
38226
- }) : t3.getCommandFieldType() === g3.NActionRequest ? this.emit("nActionRequest", t3, (t4) => {
38226
+ }) : t3.getCommandFieldType() === g2.NActionRequest ? this.emit("nActionRequest", t3, (t4) => {
38227
38227
  this._sendDimse({ context: e3, command: t4 });
38228
- }) : t3.getCommandFieldType() === g3.NDeleteRequest ? this.emit("nDeleteRequest", t3, (t4) => {
38228
+ }) : t3.getCommandFieldType() === g2.NDeleteRequest ? this.emit("nDeleteRequest", t3, (t4) => {
38229
38229
  this._sendDimse({ context: e3, command: t4 });
38230
- }) : t3.getCommandFieldType() === g3.NEventReportRequest ? this.emit("nEventReportRequest", t3, (t4) => {
38230
+ }) : t3.getCommandFieldType() === g2.NEventReportRequest ? this.emit("nEventReportRequest", t3, (t4) => {
38231
38231
  this._sendDimse({ context: e3, command: t4 });
38232
- }) : t3.getCommandFieldType() === g3.NGetRequest ? this.emit("nGetRequest", t3, (t4) => {
38232
+ }) : t3.getCommandFieldType() === g2.NGetRequest ? this.emit("nGetRequest", t3, (t4) => {
38233
38233
  this._sendDimse({ context: e3, command: t4 });
38234
- }) : t3.getCommandFieldType() === g3.NSetRequest ? this.emit("nSetRequest", t3, (t4) => {
38234
+ }) : t3.getCommandFieldType() === g2.NSetRequest ? this.emit("nSetRequest", t3, (t4) => {
38235
38235
  this._sendDimse({ context: e3, command: t4 });
38236
- }) : t3.getCommandFieldType() === g3.CCancelRequest && this.emit("cCancelRequest", t3);
38236
+ }) : t3.getCommandFieldType() === g2.CCancelRequest && this.emit("cCancelRequest", t3);
38237
38237
  }
38238
38238
  _wrapSocket() {
38239
38239
  this.socket.setTimeout(this.connectTimeout), this.socket.on("connect", () => {
@@ -38716,7 +38716,7 @@ var require_dcmjs_dimse_min = __commonJS({
38716
38716
  }
38717
38717
  }, Pdv: m3, RawPdu: h3 };
38718
38718
  }, 975: (e2, t2, s2) => {
38719
- const { CEchoResponse: n2, CFindResponse: i3, CGetResponse: r5, CMoveResponse: o2, CStoreResponse: a, NActionResponse: c3, NCreateResponse: d3, NDeleteResponse: u2, NEventReportResponse: h3, NGetResponse: m3, NSetResponse: g3 } = s2(406), l2 = s2(988), p2 = s2(266), R2 = s2(437), f2 = s2(425), y = s2(808), S2 = s2(404);
38719
+ const { CEchoResponse: n2, CFindResponse: i3, CGetResponse: r5, CMoveResponse: o2, CStoreResponse: a, NActionResponse: c3, NCreateResponse: d3, NDeleteResponse: u2, NEventReportResponse: h3, NGetResponse: m3, NSetResponse: g2 } = s2(406), l2 = s2(988), p3 = s2(266), R2 = s2(437), f = s2(425), y2 = s2(808), S2 = s2(404);
38720
38720
  e2.exports = { Scp: class extends l2 {
38721
38721
  constructor(e3, t3) {
38722
38722
  super(e3, t3), this.on("associationRequested", (e4) => {
@@ -38788,7 +38788,7 @@ var require_dcmjs_dimse_min = __commonJS({
38788
38788
  R2.error("nGetRequest method must be implemented"), t3(m3.fromRequest(e3));
38789
38789
  }
38790
38790
  nSetRequest(e3, t3) {
38791
- R2.error("nSetRequest method must be implemented"), t3(g3.fromRequest(e3));
38791
+ R2.error("nSetRequest method must be implemented"), t3(g2.fromRequest(e3));
38792
38792
  }
38793
38793
  cCancelRequest(e3) {
38794
38794
  R2.error("cCancelRequest method must be implemented");
@@ -38796,14 +38796,14 @@ var require_dcmjs_dimse_min = __commonJS({
38796
38796
  abort(e3, t3) {
38797
38797
  R2.error("abort method must be implemented");
38798
38798
  }
38799
- }, Server: class extends f2 {
38799
+ }, Server: class extends f {
38800
38800
  constructor(e3) {
38801
- super(), this.scp = { class: e3 }, this.server = void 0, this.clients = [], this.statistics = new p2();
38801
+ super(), this.scp = { class: e3 }, this.server = void 0, this.clients = [], this.statistics = new p3();
38802
38802
  }
38803
38803
  listen(e3, t3) {
38804
38804
  let s3 = {};
38805
38805
  (t3 = t3 || {}).securityOptions && (s3 = { key: t3.securityOptions.key, cert: t3.securityOptions.cert, ca: t3.securityOptions.ca, requestCert: t3.securityOptions.requestCert, rejectUnauthorized: t3.securityOptions.rejectUnauthorized, minVersion: t3.securityOptions.minVersion, maxVersion: t3.securityOptions.maxVersion, ciphers: t3.securityOptions.ciphers, SNICallback: t3.securityOptions.SNICallback });
38806
- const n3 = t3.securityOptions ? S2 : y;
38806
+ const n3 = t3.securityOptions ? S2 : y2;
38807
38807
  this.server = n3.createServer(s3, (e4) => {
38808
38808
  R2.info(`Client connecting from ${e4.remoteAddress}:${e4.remotePort} ${t3.securityOptions ? e4.authorized ? "(Authorized)" : "(Unauthorized)" : ""}`);
38809
38809
  const s4 = new this.scp.class(e4, t3);
@@ -38858,7 +38858,7 @@ var require_dcmjs_dimse_min = __commonJS({
38858
38858
  }
38859
38859
  };
38860
38860
  }, 10: (e2, t2, s2) => {
38861
- const { Association: n2, PresentationContext: i3 } = s2(201), { Scp: r5, Server: o2 } = s2(975), { CCancelRequest: a, CEchoRequest: c3, CEchoResponse: d3, CFindRequest: u2, CFindResponse: h3, CGetRequest: m3, CGetResponse: g3, CMoveRequest: l2, CMoveResponse: p2, CStoreRequest: R2, CStoreResponse: f2, NActionRequest: y, NActionResponse: S2, NCreateRequest: I2, NCreateResponse: C2, NDeleteRequest: P2, NDeleteResponse: v3, NEventReportRequest: x, NEventReportResponse: w2, NGetRequest: A2, NGetResponse: U2, NSetRequest: q, NSetResponse: D2 } = s2(406), { AbortReason: E2, AbortSource: T, CommandFieldType: O2, PresentationContextResult: b2, Priority: N2, RejectReason: B2, RejectResult: M2, RejectSource: L2, SopClass: F, Status: k2, StorageClass: $, TransferSyntax: j2, Uid: V2, UserIdentityType: G2 } = s2(855), _2 = s2(185), z2 = s2(347), Q2 = s2(719), W = s2(266), J2 = { association: { Association: n2, PresentationContext: i3 }, Client: _2, constants: { AbortReason: E2, AbortSource: T, CommandFieldType: O2, PresentationContextResult: b2, Priority: N2, RejectReason: B2, RejectResult: M2, RejectSource: L2, SopClass: F, Status: k2, StorageClass: $, TransferSyntax: j2, Uid: V2, UserIdentityType: G2 }, Dataset: z2, Implementation: Q2, log: s2(437), requests: { CCancelRequest: a, CEchoRequest: c3, CFindRequest: u2, CGetRequest: m3, CMoveRequest: l2, CStoreRequest: R2, NActionRequest: y, NCreateRequest: I2, NDeleteRequest: P2, NEventReportRequest: x, NGetRequest: A2, NSetRequest: q }, responses: { CEchoResponse: d3, CFindResponse: h3, CGetResponse: g3, CMoveResponse: p2, CStoreResponse: f2, NActionResponse: S2, NCreateResponse: C2, NDeleteResponse: v3, NEventReportResponse: w2, NGetResponse: U2, NSetResponse: D2 }, Scp: r5, Server: o2, Statistics: W, version: s2(972) };
38861
+ const { Association: n2, PresentationContext: i3 } = s2(201), { Scp: r5, Server: o2 } = s2(975), { CCancelRequest: a, CEchoRequest: c3, CEchoResponse: d3, CFindRequest: u2, CFindResponse: h3, CGetRequest: m3, CGetResponse: g2, CMoveRequest: l2, CMoveResponse: p3, CStoreRequest: R2, CStoreResponse: f, NActionRequest: y2, NActionResponse: S2, NCreateRequest: I2, NCreateResponse: C2, NDeleteRequest: P2, NDeleteResponse: v3, NEventReportRequest: x, NEventReportResponse: w2, NGetRequest: A2, NGetResponse: U2, NSetRequest: q, NSetResponse: D2 } = s2(406), { AbortReason: E2, AbortSource: T, CommandFieldType: O2, PresentationContextResult: b2, Priority: N2, RejectReason: B2, RejectResult: M2, RejectSource: L2, SopClass: F, Status: k2, StorageClass: $, TransferSyntax: j2, Uid: V2, UserIdentityType: G2 } = s2(855), _2 = s2(185), z2 = s2(347), Q2 = s2(719), W = s2(266), J2 = { association: { Association: n2, PresentationContext: i3 }, Client: _2, constants: { AbortReason: E2, AbortSource: T, CommandFieldType: O2, PresentationContextResult: b2, Priority: N2, RejectReason: B2, RejectResult: M2, RejectSource: L2, SopClass: F, Status: k2, StorageClass: $, TransferSyntax: j2, Uid: V2, UserIdentityType: G2 }, Dataset: z2, Implementation: Q2, log: s2(437), requests: { CCancelRequest: a, CEchoRequest: c3, CFindRequest: u2, CGetRequest: m3, CMoveRequest: l2, CStoreRequest: R2, NActionRequest: y2, NCreateRequest: I2, NDeleteRequest: P2, NEventReportRequest: x, NGetRequest: A2, NSetRequest: q }, responses: { CEchoResponse: d3, CFindResponse: h3, CGetResponse: g2, CMoveResponse: p3, CStoreResponse: f, NActionResponse: S2, NCreateResponse: C2, NDeleteResponse: v3, NEventReportResponse: w2, NGetResponse: U2, NSetResponse: D2 }, Scp: r5, Server: o2, Statistics: W, version: s2(972) };
38862
38862
  e2.exports = J2;
38863
38863
  }, 437: (e2, t2, s2) => {
38864
38864
  const { createLogger: n2, format: i3, transports: r5 } = s2(469), { combine: o2, printf: a, timestamp: c3 } = i3, d3 = n2({ format: o2(c3(), a(({ level: e3, message: t3, timestamp: s3 }) => `${s3} -- ${e3.toUpperCase()} -- ${t3}`)), transports: [new r5.Console()] });
@@ -38955,10 +38955,10 @@ var Pe = class {
38955
38955
  }, precedence: t });
38956
38956
  }
38957
38957
  construct(e) {
38958
- return new ct(e, this.prefixParselets, this.infixParselets);
38958
+ return new ut(e, this.prefixParselets, this.infixParselets);
38959
38959
  }
38960
38960
  };
38961
- var ct = class {
38961
+ var ut = class {
38962
38962
  constructor(e, t, n) {
38963
38963
  this.tokens = e, this.prefixParselets = t, this.infixParselets = n;
38964
38964
  }
@@ -39009,95 +39009,133 @@ var ct = class {
39009
39009
  return this.infixParselets[e.id === "Symbol" ? e.value : e.id];
39010
39010
  }
39011
39011
  };
39012
+ var lt = "ok";
39013
+ var Ce = "created";
39014
+ var pt = "not-modified";
39015
+ var ft = "not-found";
39016
+ var Ae = "accepted";
39017
+ var ir = { resourceType: "OperationOutcome", id: ft, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
39018
+ function v(r4, e) {
39019
+ return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r4 }, expression: e ? [e] : void 0 }] };
39020
+ }
39021
+ function h(r4) {
39022
+ return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "structure", details: { text: r4 } }] };
39023
+ }
39024
+ function ne(r4) {
39025
+ return typeof r4 == "object" && r4 !== null && r4.resourceType === "OperationOutcome";
39026
+ }
39027
+ function mt(r4) {
39028
+ return r4.id === lt || r4.id === Ce || r4.id === pt || r4.id === Ae;
39029
+ }
39030
+ var d = class extends Error {
39031
+ constructor(t, n) {
39032
+ super(or(t));
39033
+ this.outcome = t, this.cause = n;
39034
+ }
39035
+ };
39036
+ function we(r4) {
39037
+ return r4 instanceof d ? r4.outcome : ne(r4) ? r4 : v(Nn(r4));
39038
+ }
39039
+ function Nn(r4) {
39040
+ return r4 ? typeof r4 == "string" ? r4 : r4 instanceof Error ? r4.message : ne(r4) ? or(r4) : typeof r4 == "object" && "code" in r4 && typeof r4.code == "string" ? r4.code : JSON.stringify(r4) : "Unknown error";
39041
+ }
39042
+ function or(r4) {
39043
+ let e = r4.issue?.map(Fn) ?? [];
39044
+ return e.length > 0 ? e.join("; ") : "Unknown error";
39045
+ }
39046
+ function Fn(r4) {
39047
+ let e;
39048
+ return r4.details?.text ? r4.diagnostics ? e = `${r4.details.text} (${r4.diagnostics})` : e = r4.details.text : r4.diagnostics ? e = r4.diagnostics : e = "Unknown error", r4.expression?.length && (e += ` (${r4.expression.join(", ")})`), e;
39049
+ }
39012
39050
  function J(r4) {
39013
- let e = pe(r4), t = Nn(r4);
39051
+ let e = pe(r4), t = _n(r4);
39014
39052
  return t === e ? { reference: e } : { reference: e, display: t };
39015
39053
  }
39016
39054
  function pe(r4) {
39017
39055
  return fe(r4) ? r4.reference : `${r4.resourceType}/${r4.id}`;
39018
39056
  }
39019
- function rr(r4) {
39057
+ function ur(r4) {
39020
39058
  if (r4)
39021
39059
  return fe(r4) ? r4.reference.split("/")[1] : r4.id;
39022
39060
  }
39023
- function Dn(r4) {
39061
+ function Mn(r4) {
39024
39062
  return r4.resourceType === "Patient" || r4.resourceType === "Practitioner" || r4.resourceType === "RelatedPerson";
39025
39063
  }
39026
- function Nn(r4) {
39027
- if (Dn(r4)) {
39028
- let e = Fn(r4);
39064
+ function _n(r4) {
39065
+ if (Mn(r4)) {
39066
+ let e = Ln(r4);
39029
39067
  if (e)
39030
39068
  return e;
39031
39069
  }
39032
39070
  if (r4.resourceType === "Device") {
39033
- let e = Mn(r4);
39071
+ let e = Un(r4);
39034
39072
  if (e)
39035
39073
  return e;
39036
39074
  }
39037
39075
  return r4.resourceType === "Observation" && "code" in r4 && r4.code?.text ? r4.code.text : r4.resourceType === "User" && r4.email ? r4.email : "name" in r4 && r4.name && typeof r4.name == "string" ? r4.name : pe(r4);
39038
39076
  }
39039
- function Fn(r4) {
39077
+ function Ln(r4) {
39040
39078
  let e = r4.name;
39041
39079
  if (e && e.length > 0)
39042
- return Oe(e[0]);
39080
+ return Ne(e[0]);
39043
39081
  }
39044
- function Mn(r4) {
39082
+ function Un(r4) {
39045
39083
  let e = r4.deviceName;
39046
39084
  if (e && e.length > 0)
39047
39085
  return e[0].name;
39048
39086
  }
39049
- function Ce(r4, e) {
39087
+ function Ie(r4, e) {
39050
39088
  let t = new Date(r4);
39051
39089
  t.setUTCHours(0, 0, 0, 0);
39052
39090
  let n = e ? new Date(e) : /* @__PURE__ */ new Date();
39053
39091
  n.setUTCHours(0, 0, 0, 0);
39054
- let i2 = t.getUTCFullYear(), o = t.getUTCMonth(), s = t.getUTCDate(), a = n.getUTCFullYear(), u2 = n.getUTCMonth(), l2 = n.getUTCDate(), p2 = a - i2;
39055
- (u2 < o || u2 === o && l2 < s) && p2--;
39092
+ let i2 = t.getUTCFullYear(), o = t.getUTCMonth(), s = t.getUTCDate(), a = n.getUTCFullYear(), u2 = n.getUTCMonth(), l2 = n.getUTCDate(), f = a - i2;
39093
+ (u2 < o || u2 === o && l2 < s) && f--;
39056
39094
  let E2 = a * 12 + u2 - (i2 * 12 + o);
39057
39095
  l2 < s && E2--;
39058
39096
  let q = Math.floor((n.getTime() - t.getTime()) / (1e3 * 60 * 60 * 24));
39059
- return { years: p2, months: E2, days: q };
39097
+ return { years: f, months: E2, days: q };
39060
39098
  }
39061
- function or(r4, ...e) {
39099
+ function pr(r4, ...e) {
39062
39100
  let t = r4;
39063
39101
  for (let n = 0; n < e.length && t; n++)
39064
39102
  t = t?.extension?.find((i2) => i2.url === e[n]);
39065
39103
  return t;
39066
39104
  }
39067
- function sr(r4, e) {
39068
- return JSON.stringify(r4, _n, e ? 2 : void 0);
39105
+ function fr(r4, e) {
39106
+ return JSON.stringify(r4, Bn, e ? 2 : void 0);
39069
39107
  }
39070
- function _n(r4, e) {
39071
- return !Ln(r4) && R(e) ? void 0 : e;
39108
+ function Bn(r4, e) {
39109
+ return !qn(r4) && R(e) ? void 0 : e;
39072
39110
  }
39073
- function Ln(r4) {
39111
+ function qn(r4) {
39074
39112
  return !!/\d+$/.exec(r4);
39075
39113
  }
39076
39114
  function R(r4) {
39077
39115
  if (r4 == null)
39078
39116
  return true;
39079
39117
  let e = typeof r4;
39080
- return e === "string" || e === "object" ? !Un(r4) : false;
39118
+ return e === "string" || e === "object" ? !jn(r4) : false;
39081
39119
  }
39082
- function Un(r4) {
39120
+ function jn(r4) {
39083
39121
  if (r4 == null)
39084
39122
  return false;
39085
39123
  let e = typeof r4;
39086
39124
  return e === "string" && r4 !== "" || e === "object" && ("length" in r4 && r4.length > 0 || Object.keys(r4).length > 0);
39087
39125
  }
39088
- function ar(r4) {
39126
+ function mr(r4) {
39089
39127
  return r4.every((e) => typeof e == "string");
39090
39128
  }
39091
- var cr = [];
39129
+ var hr = [];
39092
39130
  for (let r4 = 0; r4 < 256; r4++)
39093
- cr.push(r4.toString(16).padStart(2, "0"));
39094
- function ur(r4) {
39131
+ hr.push(r4.toString(16).padStart(2, "0"));
39132
+ function gr(r4) {
39095
39133
  let e = new Uint8Array(r4), t = new Array(e.length);
39096
39134
  for (let n = 0; n < e.length; n++)
39097
- t[n] = cr[e[n]];
39135
+ t[n] = hr[e[n]];
39098
39136
  return t.join("");
39099
39137
  }
39100
- function lr(r4) {
39138
+ function yr(r4) {
39101
39139
  let e = new Uint8Array(r4), t = [];
39102
39140
  for (let n = 0; n < e.length; n++)
39103
39141
  t[n] = String.fromCharCode(e[n]);
@@ -39106,36 +39144,36 @@ function lr(r4) {
39106
39144
  function I(r4) {
39107
39145
  return r4 ? r4.charAt(0).toUpperCase() + r4.substring(1) : "";
39108
39146
  }
39109
- var dt = (r4) => new Promise((e) => {
39147
+ var xt = (r4) => new Promise((e) => {
39110
39148
  setTimeout(e, r4);
39111
39149
  });
39112
- function Oe(r4, e) {
39150
+ function Ne(r4, e) {
39113
39151
  let t = [];
39114
39152
  if (r4.prefix && e?.prefix !== false && t.push(...r4.prefix), r4.given && t.push(...r4.given), r4.family && t.push(r4.family), r4.suffix && e?.suffix !== false && t.push(...r4.suffix), r4.use && (e?.all || e?.use) && t.push("[" + r4.use + "]"), t.length === 0) {
39115
- let n = ne(r4.text);
39153
+ let n = ie(r4.text);
39116
39154
  if (n)
39117
39155
  return n;
39118
39156
  }
39119
39157
  return t.join(" ").trim();
39120
39158
  }
39121
- function ne(r4) {
39159
+ function ie(r4) {
39122
39160
  return typeof r4 == "string" ? r4 : void 0;
39123
39161
  }
39124
- function si(r4, e) {
39162
+ function ui(r4, e) {
39125
39163
  let t = e.max && e.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : e.max;
39126
39164
  return { path: r4, description: "", type: e.type ?? [], min: e.min ?? 0, max: t ?? 1, isArray: !!t && t > 1, constraints: [] };
39127
39165
  }
39128
- function mr(r4) {
39166
+ function Sr(r4) {
39129
39167
  let e = /* @__PURE__ */ Object.create(null);
39130
39168
  for (let [t, n] of Object.entries(r4))
39131
- e[t] = { name: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i2, o]) => [i2, si(i2, o)])), constraints: [], innerTypes: [] };
39169
+ e[t] = { name: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i2, o]) => [i2, ui(i2, o)])), constraints: [], innerTypes: [] };
39132
39170
  return e;
39133
39171
  }
39134
- var hr = { 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" }] }, maxDosePerLifetime: { type: [{ code: "Quantity" }] } } }, 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: "string" }] }, "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" }] }, account: { 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" }] }, high: { type: [{ code: "Quantity" }] } } }, 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" }] }, 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" }] } } }, MetadataResource: { elements: { id: { type: [{ code: "string" }] }, meta: { type: [{ code: "Meta" }] }, implicitRules: { type: [{ code: "uri" }] }, language: { type: [{ code: "code" }] }, text: { type: [{ code: "Narrative" }] }, contained: { max: 9007199254740991, type: [{ code: "Resource" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, name: { type: [{ code: "string" }] }, title: { type: [{ code: "string" }] }, status: { min: 1, type: [{ code: "code" }] }, experimental: { type: [{ code: "boolean" }] }, date: { type: [{ code: "dateTime" }] }, publisher: { type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] }, description: { type: [{ code: "markdown" }] }, useContext: { max: 9007199254740991, type: [{ code: "UsageContext" }] }, jurisdiction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, 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" }] } } } };
39135
- function d(r4) {
39172
+ var Er = { 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" }] }, maxDosePerLifetime: { type: [{ code: "Quantity" }] } } }, 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: "string" }] }, "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" }] }, account: { 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" }] }, high: { type: [{ code: "Quantity" }] } } }, 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" }] }, 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" }] } } }, MetadataResource: { elements: { id: { type: [{ code: "string" }] }, meta: { type: [{ code: "Meta" }] }, implicitRules: { type: [{ code: "uri" }] }, language: { type: [{ code: "code" }] }, text: { type: [{ code: "Narrative" }] }, contained: { max: 9007199254740991, type: [{ code: "Resource" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, name: { type: [{ code: "string" }] }, title: { type: [{ code: "string" }] }, status: { min: 1, type: [{ code: "code" }] }, experimental: { type: [{ code: "boolean" }] }, date: { type: [{ code: "dateTime" }] }, publisher: { type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] }, description: { type: [{ code: "markdown" }] }, useContext: { max: 9007199254740991, type: [{ code: "UsageContext" }] }, jurisdiction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, 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" }] } } } };
39173
+ function p(r4) {
39136
39174
  return [{ type: c.boolean, value: r4 }];
39137
39175
  }
39138
- function g(r4) {
39176
+ function y(r4) {
39139
39177
  return r4 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r4) ? { type: c.integer, value: r4 } : typeof r4 == "number" ? { type: c.decimal, value: r4 } : typeof r4 == "boolean" ? { type: c.boolean, value: r4 } : typeof r4 == "string" ? { type: c.string, value: r4 } : P(r4) ? { type: c.Quantity, value: r4 } : _(r4) ? { type: r4.resourceType, value: r4 } : { type: c.BackboneElement, value: r4 };
39140
39178
  }
39141
39179
  function D(r4) {
@@ -39151,10 +39189,10 @@ function M(r4, e) {
39151
39189
  function A(r4, e) {
39152
39190
  if (!r4.value)
39153
39191
  return;
39154
- let t = Ne(r4.type, e);
39155
- return t ? ci(r4.value, e, t) : ui(r4, e);
39192
+ let t = _e(r4.type, e);
39193
+ return t ? di(r4.value, e, t) : pi(r4, e);
39156
39194
  }
39157
- function ci(r4, e, t) {
39195
+ function di(r4, e, t) {
39158
39196
  let n = t.type;
39159
39197
  if (!n || n.length === 0)
39160
39198
  return;
@@ -39173,16 +39211,16 @@ function ci(r4, e, t) {
39173
39211
  if (s)
39174
39212
  if (Array.isArray(i2))
39175
39213
  for (let a = 0; a < Math.max(i2.length, s.length); a++)
39176
- i2[a] = Tr(i2[a], s[a]);
39214
+ i2[a] = Cr(i2[a], s[a]);
39177
39215
  else
39178
- i2 = Tr(i2, s);
39216
+ i2 = Cr(i2, s);
39179
39217
  if (!R(i2))
39180
- return (o === "Element" || o === "BackboneElement") && (o = t.type[0].code), Array.isArray(i2) ? i2.map((a) => gr(a, o)) : gr(i2, o);
39218
+ return (o === "Element" || o === "BackboneElement") && (o = t.type[0].code), Array.isArray(i2) ? i2.map((a) => br(a, o)) : br(i2, o);
39181
39219
  }
39182
- function gr(r4, e) {
39220
+ function br(r4, e) {
39183
39221
  return e === "Resource" && _(r4) && (e = r4.resourceType), { type: e, value: r4 };
39184
39222
  }
39185
- function ui(r4, e) {
39223
+ function pi(r4, e) {
39186
39224
  let t = r4.value;
39187
39225
  if (!t || typeof t != "object")
39188
39226
  return;
@@ -39198,14 +39236,14 @@ function ui(r4, e) {
39198
39236
  }
39199
39237
  }
39200
39238
  if (!R(n))
39201
- return Array.isArray(n) ? n.map(g) : g(n);
39239
+ return Array.isArray(n) ? n.map(y) : y(n);
39202
39240
  }
39203
- function Ve(r4) {
39241
+ function Fe(r4) {
39204
39242
  let e = [];
39205
39243
  for (let t of r4) {
39206
39244
  let n = false;
39207
39245
  for (let i2 of e)
39208
- if (D(vr(t, i2))) {
39246
+ if (D(Ar(t, i2))) {
39209
39247
  n = true;
39210
39248
  break;
39211
39249
  }
@@ -39213,28 +39251,28 @@ function Ve(r4) {
39213
39251
  }
39214
39252
  return e;
39215
39253
  }
39216
- function mt(r4) {
39217
- return d(!D(r4));
39254
+ function St(r4) {
39255
+ return p(!D(r4));
39218
39256
  }
39219
- function ht(r4, e) {
39220
- return r4.length === 0 || e.length === 0 ? [] : r4.length !== e.length ? d(false) : d(r4.every((t, n) => D(vr(t, e[n]))));
39257
+ function Et(r4, e) {
39258
+ return r4.length === 0 || e.length === 0 ? [] : r4.length !== e.length ? p(false) : p(r4.every((t, n) => D(Ar(t, e[n]))));
39221
39259
  }
39222
- function vr(r4, e) {
39260
+ function Ar(r4, e) {
39223
39261
  let t = r4.value?.valueOf(), n = e.value?.valueOf();
39224
- return typeof t == "number" && typeof n == "number" ? d(Math.abs(t - n) < 1e-8) : P(t) && P(n) ? d(Sr(t, n)) : d(typeof t == "object" && typeof n == "object" ? yt(r4, e) : t === n);
39262
+ return typeof t == "number" && typeof n == "number" ? p(Math.abs(t - n) < 1e-8) : P(t) && P(n) ? p(wr(t, n)) : p(typeof t == "object" && typeof n == "object" ? Rt(r4, e) : t === n);
39225
39263
  }
39226
- function gt(r4, e) {
39227
- return r4.length === 0 && e.length === 0 ? d(true) : r4.length !== e.length ? d(false) : (r4.sort(yr), e.sort(yr), d(r4.every((t, n) => D(li(t, e[n])))));
39264
+ function bt(r4, e) {
39265
+ return r4.length === 0 && e.length === 0 ? p(true) : r4.length !== e.length ? p(false) : (r4.sort(Rr), e.sort(Rr), p(r4.every((t, n) => D(fi(t, e[n])))));
39228
39266
  }
39229
- function li(r4, e) {
39267
+ function fi(r4, e) {
39230
39268
  let { type: t, value: n } = r4, { type: i2, value: o } = e, s = n?.valueOf(), a = o?.valueOf();
39231
- return typeof s == "number" && typeof a == "number" ? d(Math.abs(s - a) < 0.01) : P(s) && P(a) ? d(Sr(s, a)) : d(t === "Coding" && i2 === "Coding" ? typeof s != "object" || typeof a != "object" ? false : s.code === a.code && s.system === a.system : typeof s == "object" && typeof a == "object" ? yt({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
39269
+ return typeof s == "number" && typeof a == "number" ? p(Math.abs(s - a) < 0.01) : P(s) && P(a) ? p(wr(s, a)) : p(t === "Coding" && i2 === "Coding" ? typeof s != "object" || typeof a != "object" ? false : s.code === a.code && s.system === a.system : typeof s == "object" && typeof a == "object" ? Rt({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
39232
39270
  }
39233
- function yr(r4, e) {
39271
+ function Rr(r4, e) {
39234
39272
  let t = r4.value?.valueOf(), n = e.value?.valueOf();
39235
39273
  return typeof t == "number" && typeof n == "number" ? t - n : typeof t == "string" && typeof n == "string" ? t.localeCompare(n) : 0;
39236
39274
  }
39237
- function De(r4, e) {
39275
+ function Me(r4, e) {
39238
39276
  let { value: t } = r4;
39239
39277
  if (t == null)
39240
39278
  return false;
@@ -39251,110 +39289,72 @@ function De(r4, e) {
39251
39289
  case "Time":
39252
39290
  return typeof t == "string" && !!/^T\d/.exec(t);
39253
39291
  case "Period":
39254
- return di(t);
39292
+ return mi(t);
39255
39293
  case "Quantity":
39256
39294
  return P(t);
39257
39295
  default:
39258
39296
  return typeof t == "object" && t?.resourceType === e;
39259
39297
  }
39260
39298
  }
39261
- function di(r4) {
39299
+ function mi(r4) {
39262
39300
  return !!(r4 && typeof r4 == "object" && "start" in r4);
39263
39301
  }
39264
39302
  function P(r4) {
39265
39303
  return !!(r4 && typeof r4 == "object" && "value" in r4 && typeof r4.value == "number");
39266
39304
  }
39267
- function Sr(r4, e) {
39305
+ function wr(r4, e) {
39268
39306
  return Math.abs(r4.value - e.value) < 0.01 && (r4.unit === e.unit || r4.code === e.code || r4.unit === e.code || r4.code === e.unit);
39269
39307
  }
39270
- function yt(r4, e) {
39308
+ function Rt(r4, e) {
39271
39309
  let t = Object.keys(r4), n = Object.keys(e);
39272
39310
  if (t.length !== n.length)
39273
39311
  return false;
39274
39312
  for (let i2 of t) {
39275
39313
  let o = r4[i2], s = e[i2];
39276
- if (xr(o) && xr(s)) {
39277
- if (!yt(o, s))
39314
+ if (Pr(o) && Pr(s)) {
39315
+ if (!Rt(o, s))
39278
39316
  return false;
39279
39317
  } else if (o !== s)
39280
39318
  return false;
39281
39319
  }
39282
39320
  return true;
39283
39321
  }
39284
- function xr(r4) {
39322
+ function Pr(r4) {
39285
39323
  return r4 !== null && typeof r4 == "object";
39286
39324
  }
39287
- function Tr(r4, e) {
39325
+ function Cr(r4, e) {
39288
39326
  if (e) {
39289
39327
  if (typeof e != "object")
39290
39328
  throw new Error("Primitive extension must be an object");
39291
- return pi(r4 ?? {}, e);
39329
+ return hi(r4 ?? {}, e);
39292
39330
  }
39293
39331
  return r4;
39294
39332
  }
39295
- function pi(r4, e) {
39333
+ function hi(r4, e) {
39296
39334
  return delete e.__proto__, delete e.constructor, Object.assign(r4, e);
39297
39335
  }
39298
- var xt = "ok";
39299
- var Fe = "created";
39300
- var vt = "not-modified";
39301
- var St = "not-found";
39302
- var Me = "accepted";
39303
- var Pr = { resourceType: "OperationOutcome", id: St, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
39304
- function v(r4, e) {
39305
- return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r4 }, expression: e ? [e] : void 0 }] };
39306
- }
39307
- function h(r4) {
39308
- return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "structure", details: { text: r4 } }] };
39309
- }
39310
- function ie(r4) {
39311
- return typeof r4 == "object" && r4 !== null && r4.resourceType === "OperationOutcome";
39312
- }
39313
- function Et(r4) {
39314
- return r4.id === xt || r4.id === Fe || r4.id === vt || r4.id === Me;
39336
+ function wt(r4) {
39337
+ return new Ct(r4).parse();
39315
39338
  }
39316
- var f = class extends Error {
39317
- constructor(t, n) {
39318
- super(Cr(t));
39319
- this.outcome = t, this.cause = n;
39320
- }
39321
- };
39322
- function _e(r4) {
39323
- return r4 instanceof f ? r4.outcome : ie(r4) ? r4 : v(fi(r4));
39324
- }
39325
- function fi(r4) {
39326
- return r4 ? typeof r4 == "string" ? r4 : r4 instanceof Error ? r4.message : ie(r4) ? Cr(r4) : typeof r4 == "object" && "code" in r4 && typeof r4.code == "string" ? r4.code : JSON.stringify(r4) : "Unknown error";
39327
- }
39328
- function Cr(r4) {
39329
- let e = r4.issue?.map(mi) ?? [];
39330
- return e.length > 0 ? e.join("; ") : "Unknown error";
39331
- }
39332
- function mi(r4) {
39333
- let e;
39334
- return r4.details?.text ? r4.diagnostics ? e = `${r4.details.text} (${r4.diagnostics})` : e = r4.details.text : r4.diagnostics ? e = r4.diagnostics : e = "Unknown error", r4.expression?.length && (e += ` (${r4.expression.join(", ")})`), e;
39335
- }
39336
- function At(r4) {
39337
- return new Pt(r4).parse();
39338
- }
39339
- var me = mr(hr);
39340
- var wt = /* @__PURE__ */ Object.create(null);
39339
+ var me = Sr(Er);
39340
+ var It = /* @__PURE__ */ Object.create(null);
39341
39341
  var Ir = /* @__PURE__ */ Object.create(null);
39342
- function It(r4) {
39342
+ function kt(r4) {
39343
39343
  let e;
39344
39344
  return r4 ? (e = Ir[r4], e || (e = Ir[r4] = /* @__PURE__ */ Object.create(null))) : e = me, e;
39345
39345
  }
39346
- function kt(r4, e) {
39346
+ function Ot(r4, e) {
39347
39347
  let t = Array.isArray(r4) ? r4 : r4.entry?.map((n) => n.resource) ?? [];
39348
39348
  for (let n of t)
39349
- hi(n, e);
39349
+ gi(n, e);
39350
39350
  }
39351
- function hi(r4, e) {
39351
+ function gi(r4, e) {
39352
39352
  if (!r4?.name)
39353
39353
  throw new Error("Failed loading StructureDefinition from bundle");
39354
39354
  if (r4.resourceType !== "StructureDefinition")
39355
39355
  return;
39356
- let t = At(r4), n = It(e);
39357
- n[r4.name] = t, e && r4.url === e && (wt[e] = t);
39356
+ let t = wt(r4), n = kt(e);
39357
+ n[r4.name] = t, e && r4.url === e && (It[e] = t);
39358
39358
  for (let i2 of t.innerTypes)
39359
39359
  i2.parentType = t, n[i2.name] = i2;
39360
39360
  }
@@ -39362,16 +39362,16 @@ function Nr(r4) {
39362
39362
  return !!me[r4];
39363
39363
  }
39364
39364
  function Le(r4, e) {
39365
- return It(e)[r4];
39365
+ return kt(e)[r4];
39366
39366
  }
39367
39367
  function Mr(r4) {
39368
- return !!wt[r4];
39368
+ return !!It[r4];
39369
39369
  }
39370
- var Pt = class {
39370
+ var Ct = class {
39371
39371
  constructor(e) {
39372
39372
  if (!e.snapshot?.element || e.snapshot.element.length === 0)
39373
39373
  throw new Error(`No snapshot defined for StructureDefinition '${e.name}'`);
39374
- 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, title: e.title, type: e.type, url: e.url, kind: e.kind, description: Ti(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
39374
+ 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, title: e.title, type: e.type, url: e.url, kind: e.kind, description: vi(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
39375
39375
  }
39376
39376
  parse() {
39377
39377
  let e = this.next();
@@ -39380,7 +39380,7 @@ var Pt = class {
39380
39380
  this.parseSliceStart(e);
39381
39381
  else if (e.id?.includes(":")) {
39382
39382
  if (this.slicingContext?.current) {
39383
- let t = Rt(e, this.slicingContext.path);
39383
+ let t = Pt(e, this.slicingContext.path);
39384
39384
  this.slicingContext.current.elements[t] = this.parseElementDefinition(e);
39385
39385
  }
39386
39386
  } else {
@@ -39389,13 +39389,13 @@ var Pt = class {
39389
39389
  let n = this.backboneContext;
39390
39390
  for (; n; ) {
39391
39391
  if (e.path?.startsWith(n.path + ".")) {
39392
- n.type.elements[Rt(e, n.path)] = t;
39392
+ n.type.elements[Pt(e, n.path)] = t;
39393
39393
  break;
39394
39394
  }
39395
39395
  n = n.parent;
39396
39396
  }
39397
39397
  if (!n) {
39398
- let i2 = Rt(e, this.root.path);
39398
+ let i2 = Pt(e, this.root.path);
39399
39399
  e.isSummary && this.resourceSchema.summaryProperties?.add(i2.replace("[x]", "")), t.min > 0 && this.resourceSchema.mandatoryProperties?.add(i2.replace("[x]", "")), this.resourceSchema.elements[i2] = t;
39400
39400
  }
39401
39401
  this.checkFieldExit(e);
@@ -39410,10 +39410,10 @@ var Pt = class {
39410
39410
  enterInnerType(e) {
39411
39411
  for (; this.backboneContext && !oe(this.backboneContext?.path, e.path); )
39412
39412
  this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
39413
- this.backboneContext = { type: { name: Ct(e), title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path ?? "", parent: oe(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
39413
+ this.backboneContext = { type: { name: At(e), title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path ?? "", parent: oe(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
39414
39414
  }
39415
39415
  enterSlice(e, t) {
39416
- xi(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
39416
+ Ti(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
39417
39417
  if (n.type !== "value" && n.type !== "pattern" && n.type !== "type")
39418
39418
  throw new Error(`Unsupported slicing discriminator type: ${n.type}`);
39419
39419
  return { path: n.path, type: n.type };
@@ -39456,7 +39456,7 @@ var Pt = class {
39456
39456
  parseElementDefinitionType(e) {
39457
39457
  return (e.type ?? []).map((t) => {
39458
39458
  let n;
39459
- return (t.code === "BackboneElement" || t.code === "Element") && (n = Ct(e)), n || (n = or(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
39459
+ return (t.code === "BackboneElement" || t.code === "Element") && (n = At(e)), n || (n = pr(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
39460
39460
  });
39461
39461
  }
39462
39462
  parseElementDefinition(e) {
@@ -39467,10 +39467,10 @@ var Pt = class {
39467
39467
  function Or(r4) {
39468
39468
  return r4 === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(r4, 10);
39469
39469
  }
39470
- function Rt(r4, e = "") {
39471
- return yi(r4.path, e);
39470
+ function Pt(r4, e = "") {
39471
+ return xi(r4.path, e);
39472
39472
  }
39473
- function yi(r4, e) {
39473
+ function xi(r4, e) {
39474
39474
  return r4 ? e && r4.startsWith(e) ? r4.substring(e.length + 1) : r4 : "";
39475
39475
  }
39476
39476
  function oe(r4, e) {
@@ -39479,34 +39479,34 @@ function oe(r4, e) {
39479
39479
  function Vr(r4) {
39480
39480
  return Array.isArray(r4) && r4.length > 0 ? r4[0] : R(r4) ? void 0 : r4;
39481
39481
  }
39482
- function xi(r4) {
39482
+ function Ti(r4) {
39483
39483
  let e = r4.slicing?.discriminator;
39484
39484
  return !!(r4.type?.some((t) => t.code === "Extension") && e?.length === 1 && e[0].type === "value" && e[0].path === "url");
39485
39485
  }
39486
- function Ti(r4) {
39486
+ function vi(r4) {
39487
39487
  let e = r4.description;
39488
39488
  return e?.startsWith(`Base StructureDefinition for ${r4.name} Type: `) && (e = e.substring(`Base StructureDefinition for ${r4.name} Type: `.length)), e;
39489
39489
  }
39490
39490
  var c = { 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" };
39491
- function Vt(r4) {
39491
+ function Dt(r4) {
39492
39492
  for (let e of r4.base ?? []) {
39493
39493
  let t = N.types[e];
39494
39494
  t || (t = { searchParamsDetails: {} }, N.types[e] = t), t.searchParams || (t.searchParams = { _id: { base: [e], code: "_id", type: "token", expression: e + ".id" }, _lastUpdated: { base: [e], code: "_lastUpdated", type: "date", expression: e + ".meta.lastUpdated" }, _compartment: { base: [e], code: "_compartment", type: "reference", expression: e + ".meta.compartment" }, _profile: { base: [e], code: "_profile", type: "uri", expression: e + ".meta.profile" }, _security: { base: [e], code: "_security", type: "token", expression: e + ".meta.security" }, _source: { base: [e], code: "_source", type: "uri", expression: e + ".meta.source" }, _tag: { base: [e], code: "_tag", type: "token", expression: e + ".meta.tag" } }), t.searchParams[r4.code] = r4;
39495
39495
  }
39496
39496
  }
39497
- function Ct(r4) {
39497
+ function At(r4) {
39498
39498
  let e = r4.type?.[0]?.code;
39499
- return e === "BackboneElement" || e === "Element" ? vi((r4.base?.path ?? r4.path)?.split(".")) : e;
39499
+ return e === "BackboneElement" || e === "Element" ? Si((r4.base?.path ?? r4.path)?.split(".")) : e;
39500
39500
  }
39501
- function vi(r4) {
39501
+ function Si(r4) {
39502
39502
  return r4.length === 1 ? r4[0] : r4.map(I).join("");
39503
39503
  }
39504
- function Ne(r4, e) {
39504
+ function _e(r4, e) {
39505
39505
  let t = Le(r4);
39506
39506
  if (t)
39507
- return Ri(t.elements, e);
39507
+ return Pi(t.elements, e);
39508
39508
  }
39509
- function Ri(r4, e) {
39509
+ function Pi(r4, e) {
39510
39510
  let t = r4[e] ?? r4[e + "[x]"];
39511
39511
  if (t)
39512
39512
  return t;
@@ -39538,32 +39538,32 @@ function ae(r4) {
39538
39538
  }
39539
39539
  }
39540
39540
  var he = () => [];
39541
- var b = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.filter((n) => D(t.eval(r4, [n]))).length > 0) : d(e.length > 0), all: (r4, e, t) => d(e.every((n) => D(t.eval(r4, [n])))), allTrue: (r4, e) => {
39541
+ var b = { empty: (r4, e) => p(e.length === 0), exists: (r4, e, t) => t ? p(e.filter((n) => D(t.eval(r4, [n]))).length > 0) : p(e.length > 0), all: (r4, e, t) => p(e.every((n) => D(t.eval(r4, [n])))), allTrue: (r4, e) => {
39542
39542
  for (let t of e)
39543
39543
  if (!t.value)
39544
- return d(false);
39545
- return d(true);
39544
+ return p(false);
39545
+ return p(true);
39546
39546
  }, anyTrue: (r4, e) => {
39547
39547
  for (let t of e)
39548
39548
  if (t.value)
39549
- return d(true);
39550
- return d(false);
39549
+ return p(true);
39550
+ return p(false);
39551
39551
  }, allFalse: (r4, e) => {
39552
39552
  for (let t of e)
39553
39553
  if (t.value)
39554
- return d(false);
39555
- return d(true);
39554
+ return p(false);
39555
+ return p(true);
39556
39556
  }, anyFalse: (r4, e) => {
39557
39557
  for (let t of e)
39558
39558
  if (!t.value)
39559
- return d(true);
39560
- return d(false);
39559
+ return p(true);
39560
+ return p(false);
39561
39561
  }, subsetOf: he, supersetOf: he, count: (r4, e) => [{ type: c.integer, value: e.length }], distinct: (r4, e) => {
39562
39562
  let t = [];
39563
39563
  for (let n of e)
39564
39564
  t.some((i2) => i2.value === n.value) || t.push(n);
39565
39565
  return t;
39566
- }, isDistinct: (r4, e) => d(e.length === b.distinct(r4, e).length), where: (r4, e, t) => e.filter((n) => D(t.eval(r4, [n]))), select: (r4, e, t) => e.map((n) => t.eval(r4, [n])).flat(), repeat: he, ofType: (r4, e, t) => e.filter((n) => n.type === t.name), single: (r4, e) => {
39566
+ }, isDistinct: (r4, e) => p(e.length === b.distinct(r4, e).length), where: (r4, e, t) => e.filter((n) => D(t.eval(r4, [n]))), select: (r4, e, t) => e.map((n) => t.eval(r4, [n])).flat(), repeat: he, ofType: (r4, e, t) => e.filter((n) => n.type === t.name), single: (r4, e) => {
39567
39567
  if (e.length > 1)
39568
39568
  throw new Error("Expected input length one for single()");
39569
39569
  return e.length === 0 ? [] : e.slice(0, 1);
@@ -39595,13 +39595,13 @@ var b = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
39595
39595
  if (!t)
39596
39596
  return e;
39597
39597
  let n = t.eval(r4, e);
39598
- return Ve([...e, ...n]);
39598
+ return Fe([...e, ...n]);
39599
39599
  }, combine: (r4, e, t) => {
39600
39600
  if (!t)
39601
39601
  return e;
39602
39602
  let n = t.eval(r4, e);
39603
39603
  return [...e, ...n];
39604
- }, htmlChecks: (r4, e, t) => [g(true)], iif: (r4, e, t, n, i2) => {
39604
+ }, htmlChecks: (r4, e, t) => [y(true)], iif: (r4, e, t, n, i2) => {
39605
39605
  let o = t.eval(r4, e);
39606
39606
  if (o.length > 1 || o.length === 1 && typeof o[0].value != "boolean")
39607
39607
  throw new Error("Expected criterion to evaluate to a Boolean");
@@ -39613,46 +39613,46 @@ var b = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
39613
39613
  if (typeof t == "boolean")
39614
39614
  return [{ type: c.boolean, value: t }];
39615
39615
  if (typeof t == "number" && (t === 0 || t === 1))
39616
- return d(!!t);
39616
+ return p(!!t);
39617
39617
  if (typeof t == "string") {
39618
39618
  let n = t.toLowerCase();
39619
39619
  if (["true", "t", "yes", "y", "1", "1.0"].includes(n))
39620
- return d(true);
39620
+ return p(true);
39621
39621
  if (["false", "f", "no", "n", "0", "0.0"].includes(n))
39622
- return d(false);
39622
+ return p(false);
39623
39623
  }
39624
39624
  return [];
39625
- }, convertsToBoolean: (r4, e) => e.length === 0 ? [] : d(b.toBoolean(r4, e).length === 1), toInteger: (r4, e) => {
39625
+ }, convertsToBoolean: (r4, e) => e.length === 0 ? [] : p(b.toBoolean(r4, e).length === 1), toInteger: (r4, e) => {
39626
39626
  if (e.length === 0)
39627
39627
  return [];
39628
39628
  let [{ value: t }] = U(e, 1);
39629
39629
  return typeof t == "number" ? [{ type: c.integer, value: t }] : typeof t == "string" && /^[+-]?\d+$/.exec(t) ? [{ type: c.integer, value: parseInt(t, 10) }] : typeof t == "boolean" ? [{ type: c.integer, value: t ? 1 : 0 }] : [];
39630
- }, convertsToInteger: (r4, e) => e.length === 0 ? [] : d(b.toInteger(r4, e).length === 1), toDate: (r4, e) => {
39630
+ }, convertsToInteger: (r4, e) => e.length === 0 ? [] : p(b.toInteger(r4, e).length === 1), toDate: (r4, e) => {
39631
39631
  if (e.length === 0)
39632
39632
  return [];
39633
39633
  let [{ value: t }] = U(e, 1);
39634
39634
  return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: c.date, value: ae(t) }] : [];
39635
- }, convertsToDate: (r4, e) => e.length === 0 ? [] : d(b.toDate(r4, e).length === 1), toDateTime: (r4, e) => {
39635
+ }, convertsToDate: (r4, e) => e.length === 0 ? [] : p(b.toDate(r4, e).length === 1), toDateTime: (r4, e) => {
39636
39636
  if (e.length === 0)
39637
39637
  return [];
39638
39638
  let [{ value: t }] = U(e, 1);
39639
39639
  return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: c.dateTime, value: ae(t) }] : [];
39640
- }, convertsToDateTime: (r4, e) => e.length === 0 ? [] : d(b.toDateTime(r4, e).length === 1), toDecimal: (r4, e) => {
39640
+ }, convertsToDateTime: (r4, e) => e.length === 0 ? [] : p(b.toDateTime(r4, e).length === 1), toDecimal: (r4, e) => {
39641
39641
  if (e.length === 0)
39642
39642
  return [];
39643
39643
  let [{ value: t }] = U(e, 1);
39644
39644
  return typeof t == "number" ? [{ type: c.decimal, value: t }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?$/.exec(t) ? [{ type: c.decimal, value: parseFloat(t) }] : typeof t == "boolean" ? [{ type: c.decimal, value: t ? 1 : 0 }] : [];
39645
- }, convertsToDecimal: (r4, e) => e.length === 0 ? [] : d(b.toDecimal(r4, e).length === 1), toQuantity: (r4, e) => {
39645
+ }, convertsToDecimal: (r4, e) => e.length === 0 ? [] : p(b.toDecimal(r4, e).length === 1), toQuantity: (r4, e) => {
39646
39646
  if (e.length === 0)
39647
39647
  return [];
39648
39648
  let [{ value: t }] = U(e, 1);
39649
39649
  return P(t) ? [{ type: c.Quantity, value: t }] : typeof t == "number" ? [{ type: c.Quantity, value: { value: t, unit: "1" } }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?/.exec(t) ? [{ type: c.Quantity, value: { value: parseFloat(t), unit: "1" } }] : typeof t == "boolean" ? [{ type: c.Quantity, value: { value: t ? 1 : 0, unit: "1" } }] : [];
39650
- }, convertsToQuantity: (r4, e) => e.length === 0 ? [] : d(b.toQuantity(r4, e).length === 1), toString: (r4, e) => {
39650
+ }, convertsToQuantity: (r4, e) => e.length === 0 ? [] : p(b.toQuantity(r4, e).length === 1), toString: (r4, e) => {
39651
39651
  if (e.length === 0)
39652
39652
  return [];
39653
39653
  let [{ value: t }] = U(e, 1);
39654
39654
  return t == null ? [] : P(t) ? [{ type: c.string, value: `${t.value} '${t.unit}'` }] : [{ type: c.string, value: t.toString() }];
39655
- }, convertsToString: (r4, e) => e.length === 0 ? [] : d(b.toString(r4, e).length === 1), toTime: (r4, e) => {
39655
+ }, convertsToString: (r4, e) => e.length === 0 ? [] : p(b.toString(r4, e).length === 1), toTime: (r4, e) => {
39656
39656
  if (e.length === 0)
39657
39657
  return [];
39658
39658
  let [{ value: t }] = U(e, 1);
@@ -39662,7 +39662,7 @@ var b = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
39662
39662
  return [{ type: c.time, value: ae("T" + n[1]) }];
39663
39663
  }
39664
39664
  return [];
39665
- }, convertsToTime: (r4, e) => e.length === 0 ? [] : d(b.toTime(r4, e).length === 1), indexOf: (r4, e, t) => k((n, i2) => n.indexOf(i2), r4, e, t), substring: (r4, e, t, n) => k((i2, o, s) => {
39665
+ }, convertsToTime: (r4, e) => e.length === 0 ? [] : p(b.toTime(r4, e).length === 1), indexOf: (r4, e, t) => k((n, i2) => n.indexOf(i2), r4, e, t), substring: (r4, e, t, n) => k((i2, o, s) => {
39666
39666
  let a = o, u2 = s ? a + s : i2.length;
39667
39667
  return a < 0 || a >= i2.length ? void 0 : i2.substring(a, u2);
39668
39668
  }, r4, e, t, n), startsWith: (r4, e, t) => k((n, i2) => n.startsWith(i2), r4, e, t), endsWith: (r4, e, t) => k((n, i2) => n.endsWith(i2), r4, e, t), contains: (r4, e, t) => k((n, i2) => n.includes(i2), r4, e, t), upper: (r4, e) => k((t) => t.toUpperCase(), r4, e), lower: (r4, e) => k((t) => t.toLowerCase(), r4, e), replace: (r4, e, t, n) => k((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), matches: (r4, e, t) => k((n, i2) => !!new RegExp(i2).exec(n), r4, e, t), replaceMatches: (r4, e, t, n) => k((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), length: (r4, e) => k((t) => t.length, r4, e), toChars: (r4, e) => k((t) => t ? t.split("") : void 0, r4, e), abs: (r4, e) => L(Math.abs, r4, e), ceiling: (r4, e) => L(Math.ceil, r4, e), exp: (r4, e) => L(Math.exp, r4, e), floor: (r4, e) => L(Math.floor, r4, e), ln: (r4, e) => L(Math.log, r4, e), log: (r4, e, t) => L((n, i2) => Math.log(n) / Math.log(i2), r4, e, t), power: (r4, e, t) => L(Math.pow, r4, e, t), round: (r4, e) => L(Math.round, r4, e), sqrt: (r4, e) => L(Math.sqrt, r4, e), truncate: (r4, e) => L((t) => t | 0, r4, e), children: he, descendants: he, trace: (r4, e, t) => (console.log("trace", e, t), e), now: () => [{ type: c.dateTime, value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: c.time, value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: c.date, value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r4, e, t, n, i2) => {
@@ -39675,11 +39675,11 @@ var b = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
39675
39675
  let a = i2.eval(r4, e)[0]?.value;
39676
39676
  if (a !== "years" && a !== "months" && a !== "days")
39677
39677
  throw new Error("Invalid units");
39678
- let u2 = Ce(o[0].value, s[0].value);
39678
+ let u2 = Ie(o[0].value, s[0].value);
39679
39679
  return [{ type: c.Quantity, value: { value: u2[a], unit: a } }];
39680
39680
  }, is: (r4, e, t) => {
39681
39681
  let n = "";
39682
- return t instanceof B ? n = t.name : t instanceof G && (n = t.left.name + "." + t.right.name), n ? e.map((i2) => ({ type: c.boolean, value: De(i2, n) })) : [];
39682
+ return t instanceof B ? n = t.name : t instanceof G && (n = t.left.name + "." + t.right.name), n ? e.map((i2) => ({ type: c.boolean, value: Me(i2, n) })) : [];
39683
39683
  }, not: (r4, e) => b.toBoolean(r4, e).map((t) => ({ type: c.boolean, value: !t.value })), resolve: (r4, e) => e.map((t) => {
39684
39684
  let n = t.value, i2;
39685
39685
  if (typeof n == "string")
@@ -39687,7 +39687,7 @@ var b = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
39687
39687
  else if (typeof n == "object") {
39688
39688
  let o = n;
39689
39689
  if (o.resource)
39690
- return g(o.resource);
39690
+ return y(o.resource);
39691
39691
  o.reference ? i2 = o.reference : o.type && o.identifier && (i2 = `${o.type}?identifier=${o.identifier.system}|${o.identifier.value}`);
39692
39692
  }
39693
39693
  if (i2?.includes("?")) {
@@ -39713,7 +39713,7 @@ function k(r4, e, t, ...n) {
39713
39713
  if (typeof i2 != "string")
39714
39714
  throw new Error("String function cannot be called with non-string");
39715
39715
  let o = r4(i2, ...n.map((s) => s?.eval(e, t)[0]?.value));
39716
- return o === void 0 ? [] : Array.isArray(o) ? o.map(g) : [g(o)];
39716
+ return o === void 0 ? [] : Array.isArray(o) ? o.map(y) : [y(o)];
39717
39717
  }
39718
39718
  function L(r4, e, t, ...n) {
39719
39719
  if (t.length === 0)
@@ -39721,7 +39721,7 @@ function L(r4, e, t, ...n) {
39721
39721
  let [{ value: i2 }] = U(t, 1), o = P(i2), s = o ? i2.value : i2;
39722
39722
  if (typeof s != "number")
39723
39723
  throw new Error("Math function cannot be called with non-number");
39724
- let a = r4(s, ...n.map((p2) => p2.eval(e, t)[0]?.value)), u2 = o ? c.Quantity : t[0].type, l2 = o ? { ...i2, value: a } : a;
39724
+ let a = r4(s, ...n.map((f) => f.eval(e, t)[0]?.value)), u2 = o ? c.Quantity : t[0].type, l2 = o ? { ...i2, value: a } : a;
39725
39725
  return [{ type: u2, value: l2 }];
39726
39726
  }
39727
39727
  function U(r4, e) {
@@ -39809,8 +39809,8 @@ var C = class extends S {
39809
39809
  let o = this.right.eval(t, n);
39810
39810
  if (o.length !== 1)
39811
39811
  return [];
39812
- let s = i2[0].value, a = o[0].value, u2 = P(s) ? s.value : s, l2 = P(a) ? a.value : a, p2 = this.impl(u2, l2);
39813
- return typeof p2 == "boolean" ? d(p2) : P(s) ? [{ type: c.Quantity, value: { ...s, value: p2 } }] : [g(p2)];
39812
+ let s = i2[0].value, a = o[0].value, u2 = P(s) ? s.value : s, l2 = P(a) ? a.value : a, f = this.impl(u2, l2);
39813
+ return typeof f == "boolean" ? p(f) : P(s) ? [{ type: c.Quantity, value: { ...s, value: f } }] : [y(f)];
39814
39814
  }
39815
39815
  };
39816
39816
  var je = class extends Q {
@@ -39828,7 +39828,7 @@ var $e = class extends S {
39828
39828
  }
39829
39829
  eval(e, t) {
39830
39830
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
39831
- return d(n.some((o) => o.value === i2[0].value));
39831
+ return p(n.some((o) => o.value === i2[0].value));
39832
39832
  }
39833
39833
  };
39834
39834
  var Qe = class extends S {
@@ -39837,7 +39837,7 @@ var Qe = class extends S {
39837
39837
  }
39838
39838
  eval(e, t) {
39839
39839
  let n = M(this.left.eval(e, t)), i2 = this.right.eval(e, t);
39840
- return n ? d(i2.some((o) => o.value === n.value)) : [];
39840
+ return n ? p(i2.some((o) => o.value === n.value)) : [];
39841
39841
  }
39842
39842
  };
39843
39843
  var G = class extends Q {
@@ -39857,7 +39857,7 @@ var ce = class extends Q {
39857
39857
  }
39858
39858
  eval(e, t) {
39859
39859
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
39860
- return Ve([...n, ...i2]);
39860
+ return Fe([...n, ...i2]);
39861
39861
  }
39862
39862
  };
39863
39863
  var He = class extends S {
@@ -39866,7 +39866,7 @@ var He = class extends S {
39866
39866
  }
39867
39867
  eval(e, t) {
39868
39868
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
39869
- return ht(n, i2);
39869
+ return Et(n, i2);
39870
39870
  }
39871
39871
  };
39872
39872
  var Ge = class extends S {
@@ -39875,7 +39875,7 @@ var Ge = class extends S {
39875
39875
  }
39876
39876
  eval(e, t) {
39877
39877
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
39878
- return mt(ht(n, i2));
39878
+ return St(Et(n, i2));
39879
39879
  }
39880
39880
  };
39881
39881
  var Ke = class extends S {
@@ -39884,7 +39884,7 @@ var Ke = class extends S {
39884
39884
  }
39885
39885
  eval(e, t) {
39886
39886
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
39887
- return gt(n, i2);
39887
+ return bt(n, i2);
39888
39888
  }
39889
39889
  };
39890
39890
  var We = class extends S {
@@ -39893,7 +39893,7 @@ var We = class extends S {
39893
39893
  }
39894
39894
  eval(e, t) {
39895
39895
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
39896
- return mt(gt(n, i2));
39896
+ return St(bt(n, i2));
39897
39897
  }
39898
39898
  };
39899
39899
  var Z = class extends S {
@@ -39905,7 +39905,7 @@ var Z = class extends S {
39905
39905
  if (n.length !== 1)
39906
39906
  return [];
39907
39907
  let i2 = this.right.name;
39908
- return d(De(n[0], i2));
39908
+ return p(Me(n[0], i2));
39909
39909
  }
39910
39910
  };
39911
39911
  var ze = class extends S {
@@ -39914,7 +39914,7 @@ var ze = class extends S {
39914
39914
  }
39915
39915
  eval(e, t) {
39916
39916
  let n = M(this.left.eval(e, t), "boolean"), i2 = M(this.right.eval(e, t), "boolean");
39917
- return n?.value === true && i2?.value === true ? d(true) : n?.value === false || i2?.value === false ? d(false) : [];
39917
+ return n?.value === true && i2?.value === true ? p(true) : n?.value === false || i2?.value === false ? p(false) : [];
39918
39918
  }
39919
39919
  };
39920
39920
  var Je = class extends S {
@@ -39923,7 +39923,7 @@ var Je = class extends S {
39923
39923
  }
39924
39924
  eval(e, t) {
39925
39925
  let n = M(this.left.eval(e, t), "boolean"), i2 = M(this.right.eval(e, t), "boolean");
39926
- return n?.value === false && i2?.value === false ? d(false) : n?.value || i2?.value ? d(true) : [];
39926
+ return n?.value === false && i2?.value === false ? p(false) : n?.value || i2?.value ? p(true) : [];
39927
39927
  }
39928
39928
  };
39929
39929
  var Ye = class extends S {
@@ -39932,7 +39932,7 @@ var Ye = class extends S {
39932
39932
  }
39933
39933
  eval(e, t) {
39934
39934
  let n = M(this.left.eval(e, t), "boolean"), i2 = M(this.right.eval(e, t), "boolean");
39935
- return !n || !i2 ? [] : d(n.value !== i2.value);
39935
+ return !n || !i2 ? [] : p(n.value !== i2.value);
39936
39936
  }
39937
39937
  };
39938
39938
  var Xe = class extends S {
@@ -39941,7 +39941,7 @@ var Xe = class extends S {
39941
39941
  }
39942
39942
  eval(e, t) {
39943
39943
  let n = M(this.left.eval(e, t), "boolean"), i2 = M(this.right.eval(e, t), "boolean");
39944
- return i2?.value === true || n?.value === false ? d(true) : !n || !i2 ? [] : d(false);
39944
+ return i2?.value === true || n?.value === false ? p(true) : !n || !i2 ? [] : p(false);
39945
39945
  }
39946
39946
  };
39947
39947
  var j = class {
@@ -39980,19 +39980,19 @@ var ee = class {
39980
39980
  };
39981
39981
  var ye = ["!=", "!~", "<=", ">=", "{}", "->"];
39982
39982
  var m = { 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 };
39983
- var Ai = { parse(r4) {
39983
+ var wi = { parse(r4) {
39984
39984
  let e = r4.consumeAndParse();
39985
39985
  if (!r4.match(")"))
39986
39986
  throw new Error("Parse error: expected `)` got `" + r4.peek()?.value + "`");
39987
39987
  return e;
39988
39988
  } };
39989
- var wi = { parse(r4, e) {
39989
+ var Ii = { parse(r4, e) {
39990
39990
  let t = r4.consumeAndParse();
39991
39991
  if (!r4.match("]"))
39992
39992
  throw new Error("Parse error: expected `]`");
39993
39993
  return new ee(e, t);
39994
39994
  }, precedence: m.Indexer };
39995
- var Ii = { parse(r4, e) {
39995
+ var ki = { parse(r4, e) {
39996
39996
  if (!(e instanceof B))
39997
39997
  throw new Error("Unexpected parentheses");
39998
39998
  let t = [];
@@ -40000,17 +40000,17 @@ var Ii = { parse(r4, e) {
40000
40000
  t.push(r4.consumeAndParse()), r4.match(",");
40001
40001
  return new j(e.name, t);
40002
40002
  }, precedence: m.FunctionCall };
40003
- function ki(r4) {
40003
+ function Oi(r4) {
40004
40004
  let e = r4.split(" "), t = parseFloat(e[0]), n = e[1];
40005
40005
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
40006
40006
  }
40007
40007
  function xe() {
40008
- return new Pe().registerPrefix("String", { parse: (r4, e) => new O({ type: c.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r4, e) => new O({ type: c.dateTime, value: ae(e.value) }) }).registerPrefix("Quantity", { parse: (r4, e) => new O({ type: c.Quantity, value: ki(e.value) }) }).registerPrefix("Number", { parse: (r4, e) => new O({ type: e.value.includes(".") ? c.decimal : c.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new O({ type: c.boolean, value: true }) }).registerPrefix("false", { parse: () => new O({ type: c.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r4, e) => new B(e.value) }).registerPrefix("{}", { parse: () => new Be() }).registerPrefix("(", Ai).registerInfix("[", wi).registerInfix("(", Ii).prefix("+", m.UnaryAdd, (r4, e) => new qe("+", e, (t) => t)).prefix("-", m.UnarySubtract, (r4, e) => new C("-", e, e, (t, n) => -n)).infixLeft(".", m.Dot, (r4, e, t) => new G(r4, t)).infixLeft("/", m.Divide, (r4, e, t) => new C("/", r4, t, (n, i2) => n / i2)).infixLeft("*", m.Multiply, (r4, e, t) => new C("*", r4, t, (n, i2) => n * i2)).infixLeft("+", m.Add, (r4, e, t) => new C("+", r4, t, (n, i2) => n + i2)).infixLeft("-", m.Subtract, (r4, e, t) => new C("-", r4, t, (n, i2) => n - i2)).infixLeft("|", m.Union, (r4, e, t) => new ce(r4, t)).infixLeft("=", m.Equals, (r4, e, t) => new He(r4, t)).infixLeft("!=", m.NotEquals, (r4, e, t) => new Ge(r4, t)).infixLeft("~", m.Equivalent, (r4, e, t) => new Ke(r4, t)).infixLeft("!~", m.NotEquivalent, (r4, e, t) => new We(r4, t)).infixLeft("<", m.LessThan, (r4, e, t) => new C("<", r4, t, (n, i2) => n < i2)).infixLeft("<=", m.LessThanOrEquals, (r4, e, t) => new C("<=", r4, t, (n, i2) => n <= i2)).infixLeft(">", m.GreaterThan, (r4, e, t) => new C(">", r4, t, (n, i2) => n > i2)).infixLeft(">=", m.GreaterThanOrEquals, (r4, e, t) => new C(">=", r4, t, (n, i2) => n >= i2)).infixLeft("&", m.Ampersand, (r4, e, t) => new je(r4, t)).infixLeft("and", m.And, (r4, e, t) => new ze(r4, t)).infixLeft("as", m.As, (r4, e, t) => new X(r4, t)).infixLeft("contains", m.Contains, (r4, e, t) => new $e(r4, t)).infixLeft("div", m.Divide, (r4, e, t) => new C("div", r4, t, (n, i2) => n / i2 | 0)).infixLeft("in", m.In, (r4, e, t) => new Qe(r4, t)).infixLeft("is", m.Is, (r4, e, t) => new Z(r4, t)).infixLeft("mod", m.Modulo, (r4, e, t) => new C("mod", r4, t, (n, i2) => n % i2)).infixLeft("or", m.Or, (r4, e, t) => new Je(r4, t)).infixLeft("xor", m.Xor, (r4, e, t) => new Ye(r4, t)).infixLeft("implies", m.Implies, (r4, e, t) => new Xe(r4, t));
40008
+ return new Pe().registerPrefix("String", { parse: (r4, e) => new O({ type: c.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r4, e) => new O({ type: c.dateTime, value: ae(e.value) }) }).registerPrefix("Quantity", { parse: (r4, e) => new O({ type: c.Quantity, value: Oi(e.value) }) }).registerPrefix("Number", { parse: (r4, e) => new O({ type: e.value.includes(".") ? c.decimal : c.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new O({ type: c.boolean, value: true }) }).registerPrefix("false", { parse: () => new O({ type: c.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r4, e) => new B(e.value) }).registerPrefix("{}", { parse: () => new Be() }).registerPrefix("(", wi).registerInfix("[", Ii).registerInfix("(", ki).prefix("+", m.UnaryAdd, (r4, e) => new qe("+", e, (t) => t)).prefix("-", m.UnarySubtract, (r4, e) => new C("-", e, e, (t, n) => -n)).infixLeft(".", m.Dot, (r4, e, t) => new G(r4, t)).infixLeft("/", m.Divide, (r4, e, t) => new C("/", r4, t, (n, i2) => n / i2)).infixLeft("*", m.Multiply, (r4, e, t) => new C("*", r4, t, (n, i2) => n * i2)).infixLeft("+", m.Add, (r4, e, t) => new C("+", r4, t, (n, i2) => n + i2)).infixLeft("-", m.Subtract, (r4, e, t) => new C("-", r4, t, (n, i2) => n - i2)).infixLeft("|", m.Union, (r4, e, t) => new ce(r4, t)).infixLeft("=", m.Equals, (r4, e, t) => new He(r4, t)).infixLeft("!=", m.NotEquals, (r4, e, t) => new Ge(r4, t)).infixLeft("~", m.Equivalent, (r4, e, t) => new Ke(r4, t)).infixLeft("!~", m.NotEquivalent, (r4, e, t) => new We(r4, t)).infixLeft("<", m.LessThan, (r4, e, t) => new C("<", r4, t, (n, i2) => n < i2)).infixLeft("<=", m.LessThanOrEquals, (r4, e, t) => new C("<=", r4, t, (n, i2) => n <= i2)).infixLeft(">", m.GreaterThan, (r4, e, t) => new C(">", r4, t, (n, i2) => n > i2)).infixLeft(">=", m.GreaterThanOrEquals, (r4, e, t) => new C(">=", r4, t, (n, i2) => n >= i2)).infixLeft("&", m.Ampersand, (r4, e, t) => new je(r4, t)).infixLeft("and", m.And, (r4, e, t) => new ze(r4, t)).infixLeft("as", m.As, (r4, e, t) => new X(r4, t)).infixLeft("contains", m.Contains, (r4, e, t) => new $e(r4, t)).infixLeft("div", m.Divide, (r4, e, t) => new C("div", r4, t, (n, i2) => n / i2 | 0)).infixLeft("in", m.In, (r4, e, t) => new Qe(r4, t)).infixLeft("is", m.Is, (r4, e, t) => new Z(r4, t)).infixLeft("mod", m.Modulo, (r4, e, t) => new C("mod", r4, t, (n, i2) => n % i2)).infixLeft("or", m.Or, (r4, e, t) => new Je(r4, t)).infixLeft("xor", m.Xor, (r4, e, t) => new Ye(r4, t)).infixLeft("implies", m.Implies, (r4, e, t) => new Xe(r4, t));
40009
40009
  }
40010
- var Oi = xe();
40011
- var Br = ((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))(Br || {});
40012
- var Li = ((x) => (x.EQUALS = "eq", x.NOT_EQUALS = "ne", x.GREATER_THAN = "gt", x.LESS_THAN = "lt", x.GREATER_THAN_OR_EQUALS = "ge", x.LESS_THAN_OR_EQUALS = "le", x.STARTS_AFTER = "sa", x.ENDS_BEFORE = "eb", x.APPROXIMATELY = "ap", x.CONTAINS = "contains", x.EXACT = "exact", x.TEXT = "text", x.NOT = "not", x.ABOVE = "above", x.BELOW = "below", x.IN = "in", x.NOT_IN = "not-in", x.OF_TYPE = "of-type", x.MISSING = "missing", x.IDENTIFIER = "identifier", x.ITERATE = "iterate", x))(Li || {});
40013
- var oo = ((T) => (T.READ = "read", T.VREAD = "vread", T.UPDATE = "update", T.PATCH = "patch", T.DELETE = "delete", T.HISTORY = "history", T.HISTORY_INSTANCE = "history-instance", T.HISTORY_TYPE = "history-type", T.HISTORY_SYSTEM = "history-system", T.CREATE = "create", T.SEARCH = "search", T.SEARCH_TYPE = "search-type", T.SEARCH_SYSTEM = "search-system", T.SEARCH_COMPARTMENT = "search-compartment", T.CAPABILITIES = "capabilities", T.TRANSACTION = "transaction", T.BATCH = "batch", T.OPERATION = "operation", T))(oo || {});
40010
+ var Vi = xe();
40011
+ var Br = ((f) => (f.BOOLEAN = "BOOLEAN", f.NUMBER = "NUMBER", f.QUANTITY = "QUANTITY", f.TEXT = "TEXT", f.REFERENCE = "REFERENCE", f.CANONICAL = "CANONICAL", f.DATE = "DATE", f.DATETIME = "DATETIME", f.PERIOD = "PERIOD", f.UUID = "UUID", f))(Br || {});
40012
+ var Ui = ((x) => (x.EQUALS = "eq", x.NOT_EQUALS = "ne", x.GREATER_THAN = "gt", x.LESS_THAN = "lt", x.GREATER_THAN_OR_EQUALS = "ge", x.LESS_THAN_OR_EQUALS = "le", x.STARTS_AFTER = "sa", x.ENDS_BEFORE = "eb", x.APPROXIMATELY = "ap", x.CONTAINS = "contains", x.EXACT = "exact", x.TEXT = "text", x.NOT = "not", x.ABOVE = "above", x.BELOW = "below", x.IN = "in", x.NOT_IN = "not-in", x.OF_TYPE = "of-type", x.MISSING = "missing", x.IDENTIFIER = "identifier", x.ITERATE = "iterate", x))(Ui || {});
40013
+ var so = ((T) => (T.READ = "read", T.VREAD = "vread", T.UPDATE = "update", T.PATCH = "patch", T.DELETE = "delete", T.HISTORY = "history", T.HISTORY_INSTANCE = "history-instance", T.HISTORY_TYPE = "history-type", T.HISTORY_SYSTEM = "history-system", T.CREATE = "create", T.SEARCH = "search", T.SEARCH_TYPE = "search-type", T.SEARCH_SYSTEM = "search-system", T.SEARCH_COMPARTMENT = "search-compartment", T.CAPABILITIES = "capabilities", T.TRANSACTION = "transaction", T.BATCH = "batch", T.OPERATION = "operation", T))(so || {});
40014
40014
  function Xr(r4) {
40015
40015
  if (typeof window < "u")
40016
40016
  return window.atob(r4);
@@ -40025,9 +40025,9 @@ function Zr(r4) {
40025
40025
  return Buffer.from(r4, "binary").toString("base64");
40026
40026
  throw new Error("Unable to encode base64");
40027
40027
  }
40028
- function Bt() {
40028
+ function qt() {
40029
40029
  let r4 = new Uint32Array(28);
40030
- return crypto.getRandomValues(r4), ur(r4.buffer);
40030
+ return crypto.getRandomValues(r4), gr(r4.buffer);
40031
40031
  }
40032
40032
  async function en(r4) {
40033
40033
  return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r4));
@@ -40102,26 +40102,26 @@ var tt = class {
40102
40102
  this.emitter.removeEventListener(e, t);
40103
40103
  }
40104
40104
  };
40105
- var qt = { "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" };
40106
- var ho = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
40107
- var jt = ["DiagnosticReport-update"];
40105
+ var jt = { "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" };
40106
+ var go = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
40107
+ var $t = ["DiagnosticReport-update"];
40108
40108
  function nn(r4) {
40109
- return jt.includes(r4);
40109
+ return $t.includes(r4);
40110
40110
  }
40111
40111
  function on(r4) {
40112
- if (jt.includes(r4))
40113
- throw new f(h(`'context.version' is required for '${r4}'.`));
40112
+ if ($t.includes(r4))
40113
+ throw new d(h(`'context.version' is required for '${r4}'.`));
40114
40114
  }
40115
- var go = { "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" } } };
40116
- function yo(r4) {
40117
- return ho.includes(r4);
40115
+ var yo = { "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" } } };
40116
+ function xo(r4) {
40117
+ return go.includes(r4);
40118
40118
  }
40119
40119
  function sn(r4) {
40120
40120
  return !!r4.endpoint;
40121
40121
  }
40122
- function $t(r4) {
40122
+ function Qt(r4) {
40123
40123
  if (!nt(r4))
40124
- throw new f(h("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
40124
+ throw new d(h("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
40125
40125
  let { channelType: e, mode: t, topic: n, events: i2 } = r4, o = { "hub.channel.type": e, "hub.mode": t, "hub.topic": n, "hub.events": i2.join(",") };
40126
40126
  return sn(r4) && (o.endpoint = r4.endpoint), new URLSearchParams(o).toString();
40127
40127
  }
@@ -40132,70 +40132,70 @@ function nt(r4) {
40132
40132
  if (!(e && t && n && i2) || typeof n != "string" || typeof i2 != "object" || !Array.isArray(i2) || i2.length < 1 || e !== "websocket" || t !== "subscribe" && t !== "unsubscribe")
40133
40133
  return false;
40134
40134
  for (let o of i2)
40135
- if (!qt[o])
40135
+ if (!jt[o])
40136
40136
  return false;
40137
40137
  return !(sn(r4) && !(typeof r4.endpoint == "string" && r4.endpoint.startsWith("ws")));
40138
40138
  }
40139
40139
  function rn(r4, e, t, n) {
40140
40140
  if (typeof e != "object")
40141
- throw new f(h(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
40141
+ throw new d(h(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
40142
40142
  if (!(e.id && typeof e.id == "string"))
40143
- throw new f(h(`context[${t}] is invalid. Resource must contain a valid string ID.`));
40143
+ throw new d(h(`context[${t}] is invalid. Resource must contain a valid string ID.`));
40144
40144
  if (!e.resourceType)
40145
- throw new f(h(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
40145
+ throw new d(h(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
40146
40146
  let i2 = n.resourceType;
40147
40147
  if (i2 !== "*") {
40148
- if (!yo(e.resourceType))
40149
- throw new f(h(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
40148
+ if (!xo(e.resourceType))
40149
+ throw new d(h(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
40150
40150
  if (i2 && e.resourceType !== i2)
40151
- throw new f(h(`context[${t}] is invalid. context[${t}] for the '${r4}' event should contain resource of type ${i2}.`));
40151
+ throw new d(h(`context[${t}] is invalid. context[${t}] for the '${r4}' event should contain resource of type ${i2}.`));
40152
40152
  }
40153
40153
  }
40154
- function xo(r4, e, t, n, i2) {
40154
+ function To(r4, e, t, n, i2) {
40155
40155
  if (i2.set(e.key, (i2.get(e.key) ?? 0) + 1), !n.isArray)
40156
40156
  rn(r4, e.resource, t, n);
40157
40157
  else {
40158
40158
  let { resources: o } = e;
40159
40159
  if (!o)
40160
- throw new f(h(`context[${t}] is invalid. context[${t}] for the '${r4}' with key '${String(e.key)}' should contain an array of resources on the key 'resources'.`));
40160
+ throw new d(h(`context[${t}] is invalid. context[${t}] for the '${r4}' with key '${String(e.key)}' should contain an array of resources on the key 'resources'.`));
40161
40161
  for (let s of o)
40162
40162
  rn(r4, s, t, n);
40163
40163
  }
40164
40164
  }
40165
- function To(r4, e) {
40166
- let t = /* @__PURE__ */ new Map(), n = go[r4];
40165
+ function vo(r4, e) {
40166
+ let t = /* @__PURE__ */ new Map(), n = yo[r4];
40167
40167
  for (let i2 = 0; i2 < e.length; i2++) {
40168
40168
  let o = e[i2].key;
40169
40169
  if (!n[o])
40170
- throw new f(h(`Key '${o}' not found for event '${r4}'. Make sure to add only valid keys.`));
40171
- xo(r4, e[i2], i2, n[o], t);
40170
+ throw new d(h(`Key '${o}' not found for event '${r4}'. Make sure to add only valid keys.`));
40171
+ To(r4, e[i2], i2, n[o], t);
40172
40172
  }
40173
40173
  for (let [i2, o] of Object.entries(n)) {
40174
40174
  if (!(o.optional || t.has(i2)))
40175
- throw new f(h(`Missing required key '${i2}' on context for '${r4}' event.`));
40175
+ throw new d(h(`Missing required key '${i2}' on context for '${r4}' event.`));
40176
40176
  if (!o.manyAllowed && (t.get(i2) || 0) > 1)
40177
- throw new f(h(`${t.get(i2)} context entries with key '${i2}' found for the '${r4}' event when schema only allows for 1.`));
40177
+ throw new d(h(`${t.get(i2)} context entries with key '${i2}' found for the '${r4}' event when schema only allows for 1.`));
40178
40178
  }
40179
40179
  }
40180
- function Qt(r4, e, t, n) {
40180
+ function Ht(r4, e, t, n) {
40181
40181
  if (!(r4 && typeof r4 == "string"))
40182
- throw new f(h("Must provide a topic."));
40183
- if (!qt[e])
40184
- throw new f(h(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(qt).join(", ")}`));
40182
+ throw new d(h("Must provide a topic."));
40183
+ if (!jt[e])
40184
+ throw new d(h(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(jt).join(", ")}`));
40185
40185
  if (typeof t != "object")
40186
- throw new f(h("context must be a context object or array of context objects."));
40187
- if (jt.includes(e) && !n)
40188
- throw new f(h(`The '${e}' event must contain a 'context.versionId'.`));
40186
+ throw new d(h("context must be a context object or array of context objects."));
40187
+ if ($t.includes(e) && !n)
40188
+ throw new d(h(`The '${e}' event must contain a 'context.versionId'.`));
40189
40189
  let i2 = Array.isArray(t) ? t : [t];
40190
- return To(e, i2), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: te(), event: { "hub.topic": r4, "hub.event": e, context: i2, ...n ? { "context.versionId": n } : {} } };
40190
+ return vo(e, i2), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: te(), event: { "hub.topic": r4, "hub.event": e, context: i2, ...n ? { "context.versionId": n } : {} } };
40191
40191
  }
40192
40192
  var rt = class extends tt {
40193
40193
  constructor(t) {
40194
40194
  super();
40195
40195
  if (this.subRequest = t, !t.endpoint)
40196
- throw new f(h("Subscription request should contain an endpoint."));
40196
+ throw new d(h("Subscription request should contain an endpoint."));
40197
40197
  if (!nt(t))
40198
- throw new f(h("Subscription request failed validation."));
40198
+ throw new d(h("Subscription request failed validation."));
40199
40199
  let n = new WebSocket(t.endpoint);
40200
40200
  n.addEventListener("open", () => {
40201
40201
  this.dispatchEvent({ type: "connect" }), n.addEventListener("message", (i2) => {
@@ -40213,7 +40213,7 @@ var rt = class extends tt {
40213
40213
  this.websocket.close();
40214
40214
  }
40215
40215
  };
40216
- function vo(r4) {
40216
+ function So(r4) {
40217
40217
  let e = r4.replace(/-/g, "+").replace(/_/g, "/"), t = Xr(e), n = Array.from(t).reduce((o, s) => {
40218
40218
  let a = ("00" + s.charCodeAt(0).toString(16)).slice(-2);
40219
40219
  return `${o}%${a}`;
@@ -40223,21 +40223,29 @@ function vo(r4) {
40223
40223
  function an(r4) {
40224
40224
  return r4.split(".").length === 3;
40225
40225
  }
40226
- function Ht(r4) {
40226
+ function it(r4) {
40227
40227
  let [e, t, n] = r4.split(".");
40228
- return vo(t);
40228
+ return So(t);
40229
40229
  }
40230
40230
  function cn(r4) {
40231
40231
  try {
40232
- return typeof Ht(r4).login_id == "string";
40232
+ return typeof it(r4).login_id == "string";
40233
40233
  } catch {
40234
40234
  return false;
40235
40235
  }
40236
40236
  }
40237
- var So;
40237
+ function un(r4) {
40238
+ try {
40239
+ let t = it(r4).exp;
40240
+ return typeof t == "number" ? t * 1e3 : void 0;
40241
+ } catch {
40242
+ return;
40243
+ }
40244
+ }
40245
+ var Eo;
40238
40246
  var w = class {
40239
40247
  constructor(e) {
40240
- this[So] = "ReadablePromise";
40248
+ this[Eo] = "ReadablePromise";
40241
40249
  this.status = "pending";
40242
40250
  this.suspender = e.then((t) => (this.status = "success", this.response = t, t), (t) => {
40243
40251
  throw this.status = "error", this.error = t, t;
@@ -40269,7 +40277,7 @@ var w = class {
40269
40277
  return this.suspender.finally(e);
40270
40278
  }
40271
40279
  };
40272
- So = Symbol.toStringTag;
40280
+ Eo = Symbol.toStringTag;
40273
40281
  var Se = class {
40274
40282
  constructor(e) {
40275
40283
  this.storage = e ?? (typeof localStorage < "u" ? localStorage : new Gt());
@@ -40288,7 +40296,7 @@ var Se = class {
40288
40296
  return t ? JSON.parse(t) : void 0;
40289
40297
  }
40290
40298
  setObject(e, t) {
40291
- this.setString(e, t ? sr(t) : void 0);
40299
+ this.setString(e, t ? fr(t) : void 0);
40292
40300
  }
40293
40301
  };
40294
40302
  var Gt = class {
@@ -40314,23 +40322,23 @@ var Gt = class {
40314
40322
  return Array.from(this.data.keys())[e];
40315
40323
  }
40316
40324
  };
40317
- var Eo = V.FHIR_JSON + ", */*; q=0.1";
40318
- var bo = "https://api.medplum.com/";
40319
- var Ro = 1e3;
40320
- var Po = 6e4;
40321
- var ln = "Binary/";
40322
- var dn = { resourceType: "Device", id: "system", deviceName: [{ name: "System" }] };
40323
- var Co = ((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))(Co || {});
40324
- var Ao = ((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))(Ao || {});
40325
- var wo = ((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))(wo || {});
40326
- var Io = ((e) => (e.JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", e))(Io || {});
40327
- var pn = class extends ve {
40325
+ var bo = V.FHIR_JSON + ", */*; q=0.1";
40326
+ var Ro = "https://api.medplum.com/";
40327
+ var Po = 1e3;
40328
+ var Co = 6e4;
40329
+ var dn = "Binary/";
40330
+ var pn = { resourceType: "Device", id: "system", deviceName: [{ name: "System" }] };
40331
+ var Ao = ((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))(Ao || {});
40332
+ var wo = ((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))(wo || {});
40333
+ var Io = ((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))(Io || {});
40334
+ var ko = ((e) => (e.JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", e))(ko || {});
40335
+ var fn = class extends ve {
40328
40336
  constructor(t) {
40329
40337
  super();
40330
40338
  this.initComplete = true;
40331
40339
  if (t?.baseUrl && !t.baseUrl.startsWith("http"))
40332
40340
  throw new Error("Base URL must start with http or https");
40333
- if (this.options = t ?? {}, this.fetch = t?.fetch ?? ko(), this.storage = t?.storage ?? new Se(), this.createPdfImpl = t?.createPdf, this.baseUrl = mn(t?.baseUrl ?? bo), this.fhirBaseUrl = mn(it(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4/")), this.authorizeUrl = it(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = it(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = it(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.onUnauthenticated = t?.onUnauthenticated, this.cacheTime = t?.cacheTime ?? Po, this.cacheTime > 0 ? this.requestCache = new et(t?.resourceCacheSize ?? Ro) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken)
40341
+ if (this.options = t ?? {}, this.fetch = t?.fetch ?? Oo(), this.storage = t?.storage ?? new Se(), this.createPdfImpl = t?.createPdf, this.baseUrl = hn(t?.baseUrl ?? Ro), this.fhirBaseUrl = hn(ot(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4/")), this.authorizeUrl = ot(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = ot(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = ot(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.onUnauthenticated = t?.onUnauthenticated, this.cacheTime = t?.cacheTime ?? Co, this.cacheTime > 0 ? this.requestCache = new et(t?.resourceCacheSize ?? Po) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken)
40334
40342
  this.setAccessToken(t.accessToken), this.initPromise = Promise.resolve();
40335
40343
  else if (this.storage.getInitPromise !== void 0) {
40336
40344
  let n = this.storage.getInitPromise(), i2 = new Promise((o) => {
@@ -40369,7 +40377,7 @@ var pn = class extends ve {
40369
40377
  this.storage.clear(), sessionStorage.clear(), this.clearActiveLogin();
40370
40378
  }
40371
40379
  clearActiveLogin() {
40372
- this.storage.setString("activeLogin", void 0), this.requestCache?.clear(), this.accessToken = void 0, this.refreshToken = void 0, this.sessionDetails = void 0, this.medplumServer = void 0, this.dispatchEvent({ type: "change" });
40380
+ this.storage.setString("activeLogin", void 0), this.requestCache?.clear(), this.accessToken = void 0, this.refreshToken = void 0, this.accessTokenExpires = void 0, this.sessionDetails = void 0, this.medplumServer = void 0, this.dispatchEvent({ type: "change" });
40373
40381
  }
40374
40382
  invalidateUrl(t) {
40375
40383
  t = t.toString(), this.requestCache?.delete(t);
@@ -40431,9 +40439,11 @@ var pn = class extends ve {
40431
40439
  }
40432
40440
  async signInWithRedirect(t) {
40433
40441
  let i2 = new URLSearchParams(window.location.search).get("code");
40434
- if (i2)
40435
- return this.processCode(i2);
40436
- await this.requestAuthorization(t);
40442
+ if (!i2) {
40443
+ await this.requestAuthorization(t);
40444
+ return;
40445
+ }
40446
+ return this.processCode(i2);
40437
40447
  }
40438
40448
  signOutWithRedirect() {
40439
40449
  window.location.assign(this.logoutUrl);
@@ -40468,14 +40478,14 @@ var pn = class extends ve {
40468
40478
  return n && (i2.search = new URLSearchParams(n).toString()), i2;
40469
40479
  }
40470
40480
  search(t, n, i2) {
40471
- let o = this.fhirSearchUrl(t, n), s = o.toString() + "-search", a = this.getCacheEntry(s, i2);
40481
+ let o = this.fhirSearchUrl(t, n), s = "search-" + o.toString(), a = this.getCacheEntry(s, i2);
40472
40482
  if (a)
40473
40483
  return a.value;
40474
40484
  let u2 = new w((async () => {
40475
40485
  let l2 = await this.get(o, i2);
40476
40486
  if (l2.entry)
40477
- for (let p2 of l2.entry)
40478
- this.cacheResource(p2.resource);
40487
+ for (let f of l2.entry)
40488
+ this.cacheResource(f.resource);
40479
40489
  return l2;
40480
40490
  })());
40481
40491
  return this.setCacheEntry(s, u2), u2;
@@ -40483,17 +40493,17 @@ var pn = class extends ve {
40483
40493
  searchOne(t, n, i2) {
40484
40494
  let o = this.fhirSearchUrl(t, n);
40485
40495
  o.searchParams.set("_count", "1"), o.searchParams.sort();
40486
- let s = o.toString() + "-searchOne", a = this.getCacheEntry(s, i2);
40496
+ let s = "searchOne-" + o.toString(), a = this.getCacheEntry(s, i2);
40487
40497
  if (a)
40488
40498
  return a.value;
40489
40499
  let u2 = new w(this.search(t, o.searchParams, i2).then((l2) => l2.entry?.[0]?.resource));
40490
40500
  return this.setCacheEntry(s, u2), u2;
40491
40501
  }
40492
40502
  searchResources(t, n, i2) {
40493
- let s = this.fhirSearchUrl(t, n).toString() + "-searchResources", a = this.getCacheEntry(s, i2);
40503
+ let s = "searchResources-" + this.fhirSearchUrl(t, n).toString(), a = this.getCacheEntry(s, i2);
40494
40504
  if (a)
40495
40505
  return a.value;
40496
- let u2 = new w(this.search(t, n, i2).then(gn));
40506
+ let u2 = new w(this.search(t, n, i2).then(yn));
40497
40507
  return this.setCacheEntry(s, u2), u2;
40498
40508
  }
40499
40509
  async *searchResourcePages(t, n, i2) {
@@ -40502,12 +40512,15 @@ var pn = class extends ve {
40502
40512
  let s = new URL(o).searchParams, a = await this.search(t, s, i2), u2 = a.link?.find((l2) => l2.relation === "next");
40503
40513
  if (!a.entry?.length && !u2)
40504
40514
  break;
40505
- yield gn(a), o = u2?.url ? new URL(u2.url) : void 0;
40515
+ yield yn(a), o = u2?.url ? new URL(u2.url) : void 0;
40506
40516
  }
40507
40517
  }
40508
40518
  searchValueSet(t, n, i2) {
40509
- let o = this.fhirUrl("ValueSet", "$expand");
40510
- return o.searchParams.set("url", t), o.searchParams.set("filter", n), this.get(o.toString(), i2);
40519
+ return this.valueSetExpand({ url: t, filter: n }, i2);
40520
+ }
40521
+ valueSetExpand(t, n) {
40522
+ let i2 = this.fhirUrl("ValueSet", "$expand");
40523
+ return i2.search = new URLSearchParams(t).toString(), this.get(i2.toString(), n);
40511
40524
  }
40512
40525
  getCached(t, n) {
40513
40526
  let i2 = this.requestCache?.get(this.fhirUrl(t, n).toString())?.value;
@@ -40518,7 +40531,7 @@ var pn = class extends ve {
40518
40531
  if (!n)
40519
40532
  return;
40520
40533
  if (n === "system")
40521
- return dn;
40534
+ return pn;
40522
40535
  let [i2, o] = n.split("/");
40523
40536
  if (!(!i2 || !o))
40524
40537
  return this.getCached(i2, o);
@@ -40531,7 +40544,7 @@ var pn = class extends ve {
40531
40544
  if (!i2)
40532
40545
  return new w(Promise.reject(new Error("Missing reference")));
40533
40546
  if (i2 === "system")
40534
- return new w(Promise.resolve(dn));
40547
+ return new w(Promise.resolve(pn));
40535
40548
  let [o, s] = i2.split("/");
40536
40549
  return !o || !s ? new w(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
40537
40550
  }
@@ -40582,9 +40595,9 @@ var pn = class extends ve {
40582
40595
  target
40583
40596
  }
40584
40597
  }`.replace(/\s+/g, " "), a = await this.graphql(s);
40585
- kt(a.data.StructureDefinitionList);
40598
+ Ot(a.data.StructureDefinitionList);
40586
40599
  for (let u2 of a.data.SearchParameterList)
40587
- Vt(u2);
40600
+ Dt(u2);
40588
40601
  })());
40589
40602
  return this.setCacheEntry(n, o), o;
40590
40603
  }
@@ -40596,7 +40609,7 @@ var pn = class extends ve {
40596
40609
  return i2.value;
40597
40610
  let o = new w((async () => {
40598
40611
  let s = await this.searchOne("StructureDefinition", { url: t, _sort: "-_lastUpdated" });
40599
- s ? kt([s], t) : console.warn(`No StructureDefinition found for ${t}!`);
40612
+ s ? Ot([s], t) : console.warn(`No StructureDefinition found for ${t}!`);
40600
40613
  })());
40601
40614
  return this.setCacheEntry(n, o), o;
40602
40615
  }
@@ -40627,13 +40640,13 @@ var pn = class extends ve {
40627
40640
  }
40628
40641
  uploadwithProgress(t, n, i2, o, s) {
40629
40642
  return new Promise((a, u2) => {
40630
- let l2 = new XMLHttpRequest(), p2 = () => l2.abort();
40631
- s?.signal?.addEventListener("abort", p2);
40643
+ let l2 = new XMLHttpRequest(), f = () => l2.abort();
40644
+ s?.signal?.addEventListener("abort", f);
40632
40645
  let E2 = (q) => {
40633
- s?.signal?.removeEventListener("abort", p2), q instanceof Error ? u2(q) : a(q);
40646
+ s?.signal?.removeEventListener("abort", f), q instanceof Error ? u2(q) : a(q);
40634
40647
  };
40635
40648
  l2.responseType = "json", l2.onabort = () => E2(new Error("Request aborted")), l2.onerror = () => E2(new Error("Request error")), o && (l2.upload.onprogress = (q) => o(q), l2.upload.onload = (q) => o(q)), l2.onload = () => {
40636
- l2.status >= 200 && l2.status < 300 ? E2(l2.response) : E2(new f(_e(l2.response || l2.statusText)));
40649
+ l2.status >= 200 && l2.status < 300 ? E2(l2.response) : E2(new d(we(l2.response || l2.statusText)));
40637
40650
  }, l2.open("POST", t), l2.withCredentials = true, l2.setRequestHeader("Authorization", "Bearer " + this.accessToken), l2.setRequestHeader("Cache-Control", "no-cache, no-store, max-age=0"), l2.setRequestHeader("Content-Type", i2), l2.setRequestHeader("X-Medplum", "extended"), l2.send(n);
40638
40651
  });
40639
40652
  }
@@ -40688,7 +40701,7 @@ var pn = class extends ve {
40688
40701
  return this.get(`${this.fhirUrl(t, n)}/$graph?graph=${i2}`, o);
40689
40702
  }
40690
40703
  pushToAgent(t, n, i2, o, s, a) {
40691
- return this.post(this.fhirUrl("Agent", rr(t), "$push"), { destination: pe(n), body: i2, contentType: o, waitForResponse: s }, V.FHIR_JSON, a);
40704
+ return this.post(this.fhirUrl("Agent", ur(t), "$push"), { destination: pe(n), body: i2, contentType: o, waitForResponse: s }, V.FHIR_JSON, a);
40692
40705
  }
40693
40706
  getActiveLogin() {
40694
40707
  return this.storage.getObject("activeLogin");
@@ -40700,7 +40713,7 @@ var pn = class extends ve {
40700
40713
  return this.accessToken;
40701
40714
  }
40702
40715
  setAccessToken(t, n) {
40703
- this.accessToken = t, this.refreshToken = n, this.sessionDetails = void 0, this.medplumServer = cn(t);
40716
+ this.accessToken = t, this.refreshToken = n, this.sessionDetails = void 0, this.accessTokenExpires = un(t), this.medplumServer = cn(t);
40704
40717
  }
40705
40718
  getLogins() {
40706
40719
  return this.storage.getObject("logins") ?? [];
@@ -40748,11 +40761,11 @@ var pn = class extends ve {
40748
40761
  async download(t, n = {}) {
40749
40762
  this.refreshPromise && await this.refreshPromise;
40750
40763
  let i2 = t.toString();
40751
- return i2.startsWith(ln) && (t = this.fhirUrl(i2)), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
40764
+ return i2.startsWith(dn) && (t = this.fhirUrl(i2)), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
40752
40765
  }
40753
40766
  async uploadMedia(t, n, i2, o, s) {
40754
40767
  let a = await this.createBinary(t, i2, n);
40755
- return this.createResource({ resourceType: "Media", status: "completed", content: { contentType: n, url: ln + a.id, title: i2 }, ...o }, s);
40768
+ return this.createResource({ resourceType: "Media", status: "completed", content: { contentType: n, url: dn + a.id, title: i2 }, ...o }, s);
40756
40769
  }
40757
40770
  async bulkExport(t = "", n, i2, o) {
40758
40771
  let s = t && `${t}/`, a = this.fhirUrl(`${s}$export`);
@@ -40764,7 +40777,7 @@ var pn = class extends ve {
40764
40777
  i2.Prefer = "respond-async";
40765
40778
  let o = await this.fetchWithRetry(t, n);
40766
40779
  if (o.status === 202) {
40767
- let s = await hn(o);
40780
+ let s = await gn(o);
40768
40781
  if (s)
40769
40782
  return this.pollStatus(s);
40770
40783
  }
@@ -40787,7 +40800,7 @@ var pn = class extends ve {
40787
40800
  this.requestCache && this.requestCache.delete(t);
40788
40801
  }
40789
40802
  async request(t, n, i2 = {}) {
40790
- this.refreshPromise && await this.refreshPromise, i2.method = t, this.addFetchOptionsDefaults(i2);
40803
+ await this.refreshIfExpired(), i2.method = t, this.addFetchOptionsDefaults(i2);
40791
40804
  let o = await this.fetchWithRetry(n, i2);
40792
40805
  return this.parseResponse(o, t, n, i2);
40793
40806
  }
@@ -40798,22 +40811,22 @@ var pn = class extends ve {
40798
40811
  return;
40799
40812
  let a = t.headers.get("content-type")?.includes("json");
40800
40813
  if (t.status === 404 && !a)
40801
- throw new f(Pr);
40814
+ throw new d(ir);
40802
40815
  let u2 = t.headers.get("content-location"), l2 = o.redirect ?? this.options.redirect;
40803
40816
  if (t.status === 201 && u2 && l2 === "follow")
40804
40817
  return this.request("GET", u2, { ...o, body: void 0 });
40805
- let p2;
40818
+ let f;
40806
40819
  if (a)
40807
40820
  try {
40808
- p2 = await t.json();
40821
+ f = await t.json();
40809
40822
  } catch (E2) {
40810
40823
  throw console.error("Error parsing response", t.status, E2), E2;
40811
40824
  }
40812
40825
  else
40813
- p2 = await t.text();
40826
+ f = await t.text();
40814
40827
  if (t.status >= 400)
40815
- throw new f(_e(p2));
40816
- return p2;
40828
+ throw new d(we(f));
40829
+ return f;
40817
40830
  }
40818
40831
  async fetchWithRetry(t, n) {
40819
40832
  t.startsWith("http") || (t = new URL(t, this.baseUrl).href);
@@ -40825,7 +40838,7 @@ var pn = class extends ve {
40825
40838
  } catch (u2) {
40826
40839
  this.retryCatch(a, i2, u2);
40827
40840
  }
40828
- await dt(o);
40841
+ await xt(o);
40829
40842
  }
40830
40843
  return s;
40831
40844
  }
@@ -40846,10 +40859,10 @@ var pn = class extends ve {
40846
40859
  this.addFetchOptionsDefaults(s);
40847
40860
  let a = await this.fetchWithRetry(t, s);
40848
40861
  if (a.status !== 202 && (n = false, i2 = a, a.status === 201)) {
40849
- let u2 = await hn(a);
40862
+ let u2 = await gn(a);
40850
40863
  u2 && (i2 = await this.fetchWithRetry(u2, s));
40851
40864
  }
40852
- await dt(o);
40865
+ await xt(o);
40853
40866
  }
40854
40867
  return this.parseResponse(i2, "POST", t);
40855
40868
  }
@@ -40860,19 +40873,19 @@ var pn = class extends ve {
40860
40873
  try {
40861
40874
  o.resolve(await this.request(o.method, this.fhirBaseUrl + o.url, o.options));
40862
40875
  } catch (s) {
40863
- o.reject(new f(_e(s)));
40876
+ o.reject(new d(we(s)));
40864
40877
  }
40865
40878
  return;
40866
40879
  }
40867
40880
  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 })) }, i2 = await this.post(this.fhirBaseUrl.slice(0, -1), n);
40868
40881
  for (let o = 0; o < t.length; o++) {
40869
40882
  let s = t[o], a = i2.entry?.[o];
40870
- a?.response?.outcome && !Et(a.response.outcome) ? s.reject(new f(a.response.outcome)) : s.resolve(a?.resource);
40883
+ a?.response?.outcome && !mt(a.response.outcome) ? s.reject(new d(a.response.outcome)) : s.resolve(a?.resource);
40871
40884
  }
40872
40885
  }
40873
40886
  addFetchOptionsDefaults(t) {
40874
40887
  let n = t.headers;
40875
- n || (n = {}, t.headers = n), n.Accept || (n.Accept = Eo), n["X-Medplum"] = "extended", t.body && !n["Content-Type"] && (n["Content-Type"] = V.FHIR_JSON), this.accessToken ? n.Authorization = "Bearer " + this.accessToken : this.basicAuth && (n.Authorization = "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
40888
+ n || (n = {}, t.headers = n), n.Accept || (n.Accept = bo), n["X-Medplum"] = "extended", t.body && !n["Content-Type"] && (n["Content-Type"] = V.FHIR_JSON), this.accessToken ? n.Authorization = "Bearer " + this.accessToken : this.basicAuth && (n.Authorization = "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
40876
40889
  }
40877
40890
  setRequestContentType(t, n) {
40878
40891
  t.headers || (t.headers = {});
@@ -40886,25 +40899,28 @@ var pn = class extends ve {
40886
40899
  return this.refresh() ? this.request(t, n, i2) : (this.clearActiveLogin(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new Error("Unauthenticated")));
40887
40900
  }
40888
40901
  async startPkce() {
40889
- let t = Bt();
40902
+ let t = qt();
40890
40903
  sessionStorage.setItem("pkceState", t);
40891
- let n = Bt();
40904
+ let n = qt();
40892
40905
  sessionStorage.setItem("codeVerifier", n);
40893
- let i2 = await en(n), o = lr(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
40906
+ let i2 = await en(n), o = yr(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
40894
40907
  return sessionStorage.setItem("codeChallenge", o), { codeChallengeMethod: "S256", codeChallenge: o };
40895
40908
  }
40896
40909
  async requestAuthorization(t) {
40897
40910
  let n = await this.ensureCodeChallenge(t ?? {}), i2 = new URL(this.authorizeUrl);
40898
- i2.searchParams.set("response_type", "code"), i2.searchParams.set("state", sessionStorage.getItem("pkceState")), i2.searchParams.set("client_id", n.clientId ?? this.clientId), i2.searchParams.set("redirect_uri", n.redirectUri ?? fn()), i2.searchParams.set("code_challenge_method", n.codeChallengeMethod), i2.searchParams.set("code_challenge", n.codeChallenge), i2.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i2.toString());
40911
+ i2.searchParams.set("response_type", "code"), i2.searchParams.set("state", sessionStorage.getItem("pkceState")), i2.searchParams.set("client_id", n.clientId ?? this.clientId), i2.searchParams.set("redirect_uri", n.redirectUri ?? mn()), i2.searchParams.set("code_challenge_method", n.codeChallengeMethod), i2.searchParams.set("code_challenge", n.codeChallenge), i2.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i2.toString());
40899
40912
  }
40900
40913
  processCode(t, n) {
40901
40914
  let i2 = new URLSearchParams();
40902
- if (i2.set("grant_type", "authorization_code"), i2.set("code", t), i2.set("client_id", n?.clientId ?? this.clientId), i2.set("redirect_uri", n?.redirectUri ?? fn()), typeof sessionStorage < "u") {
40915
+ if (i2.set("grant_type", "authorization_code"), i2.set("code", t), i2.set("client_id", n?.clientId ?? this.clientId), i2.set("redirect_uri", n?.redirectUri ?? mn()), typeof sessionStorage < "u") {
40903
40916
  let o = sessionStorage.getItem("codeVerifier");
40904
40917
  o && i2.set("code_verifier", o);
40905
40918
  }
40906
40919
  return this.fetchTokens(i2);
40907
40920
  }
40921
+ refreshIfExpired() {
40922
+ return !this.refreshPromise && this.accessTokenExpires !== void 0 && this.accessTokenExpires < Date.now() && this.refresh(), this.refreshPromise ?? Promise.resolve();
40923
+ }
40908
40924
  refresh() {
40909
40925
  if (this.refreshPromise)
40910
40926
  return this.refreshPromise;
@@ -40934,26 +40950,26 @@ var pn = class extends ve {
40934
40950
  }
40935
40951
  async fhircastSubscribe(t, n) {
40936
40952
  if (!(typeof t == "string" && t !== ""))
40937
- throw new f(h("Invalid topic provided. Topic must be a valid string."));
40953
+ throw new d(h("Invalid topic provided. Topic must be a valid string."));
40938
40954
  if (!(typeof n == "object" && Array.isArray(n) && n.length > 0))
40939
- throw new f(h("Invalid events provided. Events must be an array of event names containing at least one event."));
40940
- let i2 = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post("/fhircast/STU3", $t(i2), V.FORM_URL_ENCODED))["hub.channel.endpoint"];
40955
+ throw new d(h("Invalid events provided. Events must be an array of event names containing at least one event."));
40956
+ let i2 = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post("/fhircast/STU3", Qt(i2), V.FORM_URL_ENCODED))["hub.channel.endpoint"];
40941
40957
  if (!s)
40942
40958
  throw new Error("Invalid response!");
40943
40959
  return i2.endpoint = s, i2;
40944
40960
  }
40945
40961
  async fhircastUnsubscribe(t) {
40946
40962
  if (!nt(t))
40947
- throw new f(h("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
40963
+ throw new d(h("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
40948
40964
  if (!(t.endpoint && typeof t.endpoint == "string" && t.endpoint.startsWith("ws")))
40949
- throw new f(h("Provided subscription request must have an endpoint in order to unsubscribe."));
40950
- t.mode = "unsubscribe", await this.post("/fhircast/STU3", $t(t), V.FORM_URL_ENCODED);
40965
+ throw new d(h("Provided subscription request must have an endpoint in order to unsubscribe."));
40966
+ t.mode = "unsubscribe", await this.post("/fhircast/STU3", Qt(t), V.FORM_URL_ENCODED);
40951
40967
  }
40952
40968
  fhircastConnect(t) {
40953
40969
  return new rt(t);
40954
40970
  }
40955
40971
  async fhircastPublish(t, n, i2, o) {
40956
- return nn(n) ? this.post(`/fhircast/STU3/${t}`, Qt(t, n, i2, o), V.JSON) : (on(n), this.post(`/fhircast/STU3/${t}`, Qt(t, n, i2), V.JSON));
40972
+ return nn(n) ? this.post(`/fhircast/STU3/${t}`, Ht(t, n, i2, o), V.JSON) : (on(n), this.post(`/fhircast/STU3/${t}`, Ht(t, n, i2), V.JSON));
40957
40973
  }
40958
40974
  async fhircastGetContext(t) {
40959
40975
  return this.get(`/fhircast/STU3/${t}`);
@@ -40969,9 +40985,9 @@ var pn = class extends ve {
40969
40985
  this.clearActiveLogin();
40970
40986
  try {
40971
40987
  let a = await o.json();
40972
- throw new f(v(a.error_description));
40988
+ throw new d(v(a.error_description));
40973
40989
  } catch (a) {
40974
- throw new f(v("Failed to fetch tokens"), a);
40990
+ throw new d(v("Failed to fetch tokens"), a);
40975
40991
  }
40976
40992
  }
40977
40993
  let s = await o.json();
@@ -40980,7 +40996,7 @@ var pn = class extends ve {
40980
40996
  async verifyTokens(t) {
40981
40997
  let n = t.access_token;
40982
40998
  if (an(n)) {
40983
- let i2 = Ht(n);
40999
+ let i2 = it(n);
40984
41000
  if (Date.now() >= i2.exp * 1e3)
40985
41001
  throw this.clearActiveLogin(), new Error("Token expired");
40986
41002
  if (i2.cid) {
@@ -41004,21 +41020,21 @@ var pn = class extends ve {
41004
41020
  throw i2;
41005
41021
  }
41006
41022
  };
41007
- function ko() {
41023
+ function Oo() {
41008
41024
  if (!globalThis.fetch)
41009
41025
  throw new Error("Fetch not available in this environment");
41010
41026
  return globalThis.fetch.bind(globalThis);
41011
41027
  }
41012
- function fn() {
41028
+ function mn() {
41013
41029
  return typeof window > "u" ? "" : window.location.protocol + "//" + window.location.host + "/";
41014
41030
  }
41015
- function mn(r4) {
41031
+ function hn(r4) {
41016
41032
  return r4.endsWith("/") ? r4 : r4 + "/";
41017
41033
  }
41018
- function it(r4, e) {
41034
+ function ot(r4, e) {
41019
41035
  return new URL(e, r4).toString();
41020
41036
  }
41021
- async function hn(r4) {
41037
+ async function gn(r4) {
41022
41038
  let e = r4.headers.get("content-location");
41023
41039
  if (e)
41024
41040
  return e;
@@ -41026,17 +41042,17 @@ async function hn(r4) {
41026
41042
  if (t)
41027
41043
  return t;
41028
41044
  let n = await r4.json();
41029
- if (ie(n) && n.issue?.[0]?.diagnostics)
41045
+ if (ne(n) && n.issue?.[0]?.diagnostics)
41030
41046
  return n.issue[0].diagnostics;
41031
41047
  }
41032
- function gn(r4) {
41048
+ function yn(r4) {
41033
41049
  let e = r4.entry?.map((t) => t.resource) ?? [];
41034
41050
  return Object.assign(e, { bundle: r4 });
41035
41051
  }
41036
- var Fo = [...ye, "->", "<<", ">>", "=="];
41037
- var Lo = xe().registerInfix("->", { precedence: m.Arrow }).registerInfix(";", { precedence: m.Semicolon });
41038
- var Xo = [...ye, "eq", "ne", "co"];
41039
- var ts = xe();
41052
+ var Mo = [...ye, "->", "<<", ">>", "=="];
41053
+ var Uo = xe().registerInfix("->", { precedence: m.Arrow }).registerInfix(";", { precedence: m.Semicolon });
41054
+ var Zo = [...ye, "eq", "ne", "co"];
41055
+ var rs = xe();
41040
41056
  var z = class {
41041
41057
  constructor(e = "\r", t = "|", n = "^", i2 = "~", o = "\\", s = "&") {
41042
41058
  this.segmentSeparator = e;
@@ -41053,7 +41069,7 @@ var z = class {
41053
41069
  return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
41054
41070
  }
41055
41071
  };
41056
- var In = class r {
41072
+ var kn = class r {
41057
41073
  constructor(e, t = new z()) {
41058
41074
  this.context = t, this.segments = e;
41059
41075
  }
@@ -41077,7 +41093,7 @@ var In = class r {
41077
41093
  }
41078
41094
  buildAck() {
41079
41095
  let e = /* @__PURE__ */ new Date(), t = this.getSegment("MSH"), n = t?.getField(3)?.toString() ?? "", i2 = t?.getField(4)?.toString() ?? "", o = t?.getField(5)?.toString() ?? "", s = t?.getField(6)?.toString() ?? "", a = t?.getField(10)?.toString() ?? "", u2 = t?.getField(12)?.toString() ?? "2.5.1";
41080
- return new r([new be(["MSH", this.context.getMsh2(), o, s, n, i2, ns(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", u2], this.context), new be(["MSA", "AA", a, "OK"], this.context)]);
41096
+ return new r([new be(["MSH", this.context.getMsh2(), o, s, n, i2, is(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", u2], this.context), new be(["MSA", "AA", a, "OK"], this.context)]);
41081
41097
  }
41082
41098
  buildAckMessageType(e) {
41083
41099
  let t = e?.getField(9), n = t?.getComponent(2), i2 = t?.getComponent(3), o = "ACK";
@@ -41094,7 +41110,7 @@ var In = class r {
41094
41110
  };
41095
41111
  var be = class r2 {
41096
41112
  constructor(e, t = new z()) {
41097
- this.context = t, ar(e) ? this.fields = e.map((n) => de.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
41113
+ this.context = t, mr(e) ? this.fields = e.map((n) => de.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
41098
41114
  }
41099
41115
  get(e) {
41100
41116
  return this.fields[e];
@@ -41138,7 +41154,7 @@ var de = class r3 {
41138
41154
  return new r3(e.split(t.repetitionSeparator).map((n) => n.split(t.componentSeparator)), t);
41139
41155
  }
41140
41156
  };
41141
- function ns(r4) {
41157
+ function is(r4) {
41142
41158
  let e = r4 instanceof Date ? r4 : new Date(r4), n = e.toISOString().replace(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i2 = e.getUTCMilliseconds();
41143
41159
  return i2 > 0 && (n += "." + i2.toString()), n;
41144
41160
  }
@@ -41158,7 +41174,7 @@ var i = class extends EventTarget {
41158
41174
  }
41159
41175
  };
41160
41176
  var m2 = "\v";
41161
- var p = "";
41177
+ var p2 = "";
41162
41178
  var v2 = "\r";
41163
41179
  var d2 = class extends Event {
41164
41180
  constructor(e, t) {
@@ -41181,8 +41197,8 @@ var c2 = class extends i {
41181
41197
  let o = "";
41182
41198
  e.on("data", (s) => {
41183
41199
  try {
41184
- if (o += s.toString(), o.endsWith(p + v2)) {
41185
- let r4 = In.parse(o.substring(1, o.length - 2));
41200
+ if (o += s.toString(), o.endsWith(p2 + v2)) {
41201
+ let r4 = kn.parse(o.substring(1, o.length - 2));
41186
41202
  this.dispatchEvent(new d2(this, r4)), o = "";
41187
41203
  }
41188
41204
  } catch (r4) {
@@ -41193,7 +41209,7 @@ var c2 = class extends i {
41193
41209
  });
41194
41210
  }
41195
41211
  send(e) {
41196
- this.socket.write(m2 + e.toString() + p + v2);
41212
+ this.socket.write(m2 + e.toString() + p2 + v2);
41197
41213
  }
41198
41214
  async sendAndWait(e) {
41199
41215
  let t = new Promise((o) => {
@@ -41288,8 +41304,8 @@ var DcmjsDimseScp = class extends dimse.Scp {
41288
41304
  associationRequested(association) {
41289
41305
  association.setMaxPduLength(65536);
41290
41306
  association.getPresentationContexts().forEach(({ context }) => {
41291
- context.getTransferSyntaxUids().forEach((ts2) => {
41292
- context.setResult(dimse.constants.PresentationContextResult.Accept, ts2);
41307
+ context.getTransferSyntaxUids().forEach((ts) => {
41308
+ context.setResult(dimse.constants.PresentationContextResult.Accept, ts);
41293
41309
  });
41294
41310
  });
41295
41311
  this.sendAssociationAccept();
@@ -41326,7 +41342,7 @@ var DcmjsDimseScp = class extends dimse.Scp {
41326
41342
  body: JSON.stringify(request.getDataset())
41327
41343
  });
41328
41344
  } catch (err) {
41329
- App.instance.log.error(`DICOM error: ${fi(err)}`);
41345
+ App.instance.log.error(`DICOM error: ${Nn(err)}`);
41330
41346
  }
41331
41347
  const response = dimse.responses.CStoreResponse.fromRequest(request);
41332
41348
  response.setStatus(dimse.constants.Status.Success);
@@ -41358,7 +41374,7 @@ var AgentHl7Channel = class {
41358
41374
  sendToRemote(msg) {
41359
41375
  const connection = this.connections.get(msg.remote);
41360
41376
  if (connection) {
41361
- connection.hl7Connection.send(In.parse(msg.body));
41377
+ connection.hl7Connection.send(kn.parse(msg.body));
41362
41378
  }
41363
41379
  }
41364
41380
  handleNewConnection(connection) {
@@ -41380,14 +41396,14 @@ var AgentHl7ChannelConnection = class {
41380
41396
  this.channel.app.log.info(event.message.toString().replaceAll("\r", "\n"));
41381
41397
  this.channel.app.addToWebSocketQueue({
41382
41398
  type: "agent:transmit:request",
41383
- accessToken: this.channel.app.medplum.getAccessToken(),
41399
+ accessToken: await this.channel.app.getAccessToken(),
41384
41400
  channel: this.channel.definition.name,
41385
41401
  remote: this.remote,
41386
41402
  contentType: V.HL7_V2,
41387
41403
  body: event.message.toString()
41388
41404
  });
41389
41405
  } catch (err) {
41390
- this.channel.app.log.error(`HL7 error: ${fi(err)}`);
41406
+ this.channel.app.log.error(`HL7 error: ${Nn(err)}`);
41391
41407
  }
41392
41408
  }
41393
41409
  close() {
@@ -41422,7 +41438,7 @@ var App = class _App {
41422
41438
  this.webSocket.binaryType = "nodebuffer";
41423
41439
  this.webSocket.addEventListener("error", (err) => {
41424
41440
  if (!this.shutdown) {
41425
- this.log.error(fi(err.error));
41441
+ this.log.error(Nn(err.error));
41426
41442
  }
41427
41443
  });
41428
41444
  this.webSocket.addEventListener("open", () => {
@@ -41462,11 +41478,14 @@ var App = class _App {
41462
41478
  case "agent:transmit:request":
41463
41479
  this.pushMessage(command);
41464
41480
  break;
41481
+ case "agent:error":
41482
+ this.log.error(command.body);
41483
+ break;
41465
41484
  default:
41466
41485
  this.log.error(`Unknown message type: ${command.type}`);
41467
41486
  }
41468
41487
  } catch (err) {
41469
- this.log.error(`WebSocket error: ${fi(err)}`);
41488
+ this.log.error(`WebSocket error: ${Nn(err)}`);
41470
41489
  }
41471
41490
  });
41472
41491
  }
@@ -41502,6 +41521,10 @@ var App = class _App {
41502
41521
  }
41503
41522
  this.log.info("Medplum service stopped successfully");
41504
41523
  }
41524
+ async getAccessToken() {
41525
+ await this.medplum.refreshIfExpired();
41526
+ return this.medplum.getAccessToken();
41527
+ }
41505
41528
  addToWebSocketQueue(message) {
41506
41529
  this.webSocketQueue.push(message);
41507
41530
  this.trySendToWebSocket();
@@ -41547,7 +41570,7 @@ var App = class _App {
41547
41570
  host: address.hostname,
41548
41571
  port: parseInt(address.port, 10)
41549
41572
  });
41550
- client.sendAndWait(In.parse(message.body)).then((response) => {
41573
+ client.sendAndWait(kn.parse(message.body)).then((response) => {
41551
41574
  this.log.info(`Response: ${response.toString().replaceAll("\r", "\n")}`);
41552
41575
  this.addToWebSocketQueue({
41553
41576
  type: "agent:transmit:response",
@@ -41558,7 +41581,7 @@ var App = class _App {
41558
41581
  body: response.toString()
41559
41582
  });
41560
41583
  }).catch((err) => {
41561
- this.log.error(`HL7 error: ${fi(err)}`);
41584
+ this.log.error(`HL7 error: ${Nn(err)}`);
41562
41585
  }).finally(() => {
41563
41586
  client.close();
41564
41587
  });
@@ -41591,7 +41614,7 @@ async function main(argv) {
41591
41614
  process.exit(1);
41592
41615
  }
41593
41616
  const { baseUrl, clientId, clientSecret, agentId } = args;
41594
- const medplum = new pn({ baseUrl, clientId });
41617
+ const medplum = new fn({ baseUrl, clientId });
41595
41618
  await medplum.startClientLogin(clientId, clientSecret);
41596
41619
  const app = new App(medplum, agentId);
41597
41620
  await app.start();