@medplum/agent 3.2.31 → 3.2.32

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 +501 -501
  2. package/package.json +5 -5
@@ -12,13 +12,13 @@ var __export = (target, all) => {
12
12
  for (var name in all)
13
13
  __defProp(target, name, { get: all[name], enumerable: true });
14
14
  };
15
- var __copyProps = (to, from, except, desc) => {
15
+ var __copyProps = (to2, from, except, desc) => {
16
16
  if (from && typeof from === "object" || typeof from === "function") {
17
17
  for (let key of __getOwnPropNames(from))
18
- if (!__hasOwnProp.call(to, key) && key !== except)
19
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ if (!__hasOwnProp.call(to2, key) && key !== except)
19
+ __defProp(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
20
  }
21
- return to;
21
+ return to2;
22
22
  };
23
23
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
24
  // If the importer is in node compatibility mode or this is not an ESM
@@ -13397,17 +13397,17 @@ var require_dcmjs = __commonJS({
13397
13397
  key: "readBytes",
13398
13398
  value: function readBytes(stream, length2) {
13399
13399
  var BACKSLASH = String.fromCharCode(VM_DELIMITER);
13400
- var ds = stream.readAsciiString(length2);
13401
- ds = ds.replace(/[^0-9.\\\-+e]/gi, "");
13402
- if (ds.indexOf(BACKSLASH) !== -1) {
13403
- var dsArray = ds.split(BACKSLASH);
13404
- ds = dsArray.map(function(ds2) {
13405
- return ds2 === "" ? null : Number(ds2);
13400
+ var ds2 = stream.readAsciiString(length2);
13401
+ ds2 = ds2.replace(/[^0-9.\\\-+e]/gi, "");
13402
+ if (ds2.indexOf(BACKSLASH) !== -1) {
13403
+ var dsArray = ds2.split(BACKSLASH);
13404
+ ds2 = dsArray.map(function(ds3) {
13405
+ return ds3 === "" ? null : Number(ds3);
13406
13406
  });
13407
13407
  } else {
13408
- ds = [ds === "" ? null : Number(ds)];
13408
+ ds2 = [ds2 === "" ? null : Number(ds2)];
13409
13409
  }
13410
- return ds;
13410
+ return ds2;
13411
13411
  }
13412
13412
  }, {
13413
13413
  key: "formatValue",
@@ -13434,8 +13434,8 @@ var require_dcmjs = __commonJS({
13434
13434
  key: "writeBytes",
13435
13435
  value: function writeBytes(stream, value, writeOptions) {
13436
13436
  var _this7 = this;
13437
- var val = Array.isArray(value) ? value.map(function(ds) {
13438
- return _this7.formatValue(ds);
13437
+ var val = Array.isArray(value) ? value.map(function(ds2) {
13438
+ return _this7.formatValue(ds2);
13439
13439
  }) : [this.formatValue(value)];
13440
13440
  return _get(_getPrototypeOf(DecimalString2.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
13441
13441
  }
@@ -13522,17 +13522,17 @@ var require_dcmjs = __commonJS({
13522
13522
  key: "readBytes",
13523
13523
  value: function readBytes(stream, length2) {
13524
13524
  var BACKSLASH = String.fromCharCode(VM_DELIMITER);
13525
- var is2 = stream.readAsciiString(length2).trim();
13526
- is2 = is2.replace(/[^0-9.\\\-+e]/gi, "");
13527
- if (is2.indexOf(BACKSLASH) !== -1) {
13528
- var integerStringArray = is2.split(BACKSLASH);
13529
- is2 = integerStringArray.map(function(is3) {
13530
- return is3 === "" ? null : Number(is3);
13525
+ var is = stream.readAsciiString(length2).trim();
13526
+ is = is.replace(/[^0-9.\\\-+e]/gi, "");
13527
+ if (is.indexOf(BACKSLASH) !== -1) {
13528
+ var integerStringArray = is.split(BACKSLASH);
13529
+ is = integerStringArray.map(function(is2) {
13530
+ return is2 === "" ? null : Number(is2);
13531
13531
  });
13532
13532
  } else {
13533
- is2 = [is2 === "" ? null : Number(is2)];
13533
+ is = [is === "" ? null : Number(is)];
13534
13534
  }
13535
- return is2;
13535
+ return is;
13536
13536
  }
13537
13537
  }, {
13538
13538
  key: "formatValue",
@@ -13543,8 +13543,8 @@ var require_dcmjs = __commonJS({
13543
13543
  key: "writeBytes",
13544
13544
  value: function writeBytes(stream, value, writeOptions) {
13545
13545
  var _this12 = this;
13546
- var val = Array.isArray(value) ? value.map(function(is2) {
13547
- return _this12.formatValue(is2);
13546
+ var val = Array.isArray(value) ? value.map(function(is) {
13547
+ return _this12.formatValue(is);
13548
13548
  }) : [this.formatValue(value)];
13549
13549
  return _get(_getPrototypeOf(IntegerString2.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
13550
13550
  }
@@ -14260,7 +14260,7 @@ var require_dcmjs = __commonJS({
14260
14260
  }
14261
14261
  }, {
14262
14262
  key: "is",
14263
- value: function is2(t) {
14263
+ value: function is(t) {
14264
14264
  return this.value == t;
14265
14265
  }
14266
14266
  }, {
@@ -15100,8 +15100,8 @@ var require_dcmjs = __commonJS({
15100
15100
  }, {
15101
15101
  key: "isMultiframeDataset",
15102
15102
  value: function isMultiframeDataset() {
15103
- var ds = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dataset;
15104
- var sopClassUID = ds.SOPClassUID.replace(/[^0-9.]/g, "");
15103
+ var ds2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dataset;
15104
+ var sopClassUID = ds2.SOPClassUID.replace(/[^0-9.]/g, "");
15105
15105
  return Normalizer2.isMultiframeSOPClassUID(sopClassUID);
15106
15106
  }
15107
15107
  }, {
@@ -15142,16 +15142,16 @@ var require_dcmjs = __commonJS({
15142
15142
  }
15143
15143
  this.derivation = new DerivedImage(this.datasets);
15144
15144
  this.dataset = this.derivation.dataset;
15145
- var ds = this.dataset;
15145
+ var ds2 = this.dataset;
15146
15146
  var referenceDataset = this.datasets[0];
15147
- ds.NumberOfFrames = this.datasets.length;
15148
- ds.SOPClassUID = referenceDataset.SOPClassUID;
15149
- ds.Rows = referenceDataset.Rows;
15150
- ds.Columns = referenceDataset.Columns;
15151
- ds.BitsAllocated = referenceDataset.BitsAllocated;
15152
- ds.PixelRepresentation = referenceDataset.PixelRepresentation;
15153
- ds.RescaleSlope = referenceDataset.RescaleSlope || "1";
15154
- ds.RescaleIntercept = referenceDataset.RescaleIntercept || "0";
15147
+ ds2.NumberOfFrames = this.datasets.length;
15148
+ ds2.SOPClassUID = referenceDataset.SOPClassUID;
15149
+ ds2.Rows = referenceDataset.Rows;
15150
+ ds2.Columns = referenceDataset.Columns;
15151
+ ds2.BitsAllocated = referenceDataset.BitsAllocated;
15152
+ ds2.PixelRepresentation = referenceDataset.PixelRepresentation;
15153
+ ds2.RescaleSlope = referenceDataset.RescaleSlope || "1";
15154
+ ds2.RescaleIntercept = referenceDataset.RescaleIntercept || "0";
15155
15155
  var referencePosition = referenceDataset.ImagePositionPatient;
15156
15156
  var rowVector = referenceDataset.ImageOrientationPatient.slice(0, 3);
15157
15157
  var columnVector = referenceDataset.ImageOrientationPatient.slice(3, 6);
@@ -15166,43 +15166,43 @@ var require_dcmjs = __commonJS({
15166
15166
  distanceDatasetPairs.sort(function(a2, b2) {
15167
15167
  return b2[0] - a2[0];
15168
15168
  });
15169
- if (ds.BitsAllocated !== 16) {
15169
+ if (ds2.BitsAllocated !== 16) {
15170
15170
  log.error("Only works with 16 bit data, not " + String(this.dataset.BitsAllocated));
15171
15171
  }
15172
15172
  if (referenceDataset._vrMap && !referenceDataset._vrMap.PixelData) {
15173
15173
  log.warn("No vr map given for pixel data, using OW");
15174
- ds._vrMap = {
15174
+ ds2._vrMap = {
15175
15175
  PixelData: "OW"
15176
15176
  };
15177
15177
  } else {
15178
- ds._vrMap = {
15178
+ ds2._vrMap = {
15179
15179
  PixelData: referenceDataset._vrMap.PixelData
15180
15180
  };
15181
15181
  }
15182
15182
  var frameSize = referenceDataset.PixelData.byteLength;
15183
- ds.PixelData = new ArrayBuffer(ds.NumberOfFrames * frameSize);
15183
+ ds2.PixelData = new ArrayBuffer(ds2.NumberOfFrames * frameSize);
15184
15184
  var frame = 0;
15185
15185
  distanceDatasetPairs.forEach(function(pair) {
15186
15186
  var dataset = pair[1];
15187
15187
  var pixels = new Uint16Array(dataset.PixelData);
15188
- var frameView = new Uint16Array(ds.PixelData, frame * frameSize, frameSize / 2);
15188
+ var frameView = new Uint16Array(ds2.PixelData, frame * frameSize, frameSize / 2);
15189
15189
  try {
15190
15190
  frameView.set(pixels);
15191
15191
  } catch (e) {
15192
15192
  if (e instanceof RangeError) {
15193
- var message2 = "Error inserting pixels in PixelData\n" + "frameSize ".concat(frameSize, "\n") + "NumberOfFrames ".concat(ds.NumberOfFrames, "\n") + "pair ".concat(pair, "\n") + "dataset PixelData size ".concat(dataset.PixelData.length);
15193
+ var message2 = "Error inserting pixels in PixelData\n" + "frameSize ".concat(frameSize, "\n") + "NumberOfFrames ".concat(ds2.NumberOfFrames, "\n") + "pair ".concat(pair, "\n") + "dataset PixelData size ".concat(dataset.PixelData.length);
15194
15194
  log.error(message2);
15195
15195
  }
15196
15196
  }
15197
15197
  frame++;
15198
15198
  });
15199
- if (ds.NumberOfFrames < 2) {
15199
+ if (ds2.NumberOfFrames < 2) {
15200
15200
  log.error("Cannot populate shared groups uniquely without multiple frames");
15201
15201
  }
15202
15202
  var _distanceDatasetPairs = _slicedToArray(distanceDatasetPairs[0], 2), distance0 = _distanceDatasetPairs[0], dataset0 = _distanceDatasetPairs[1];
15203
15203
  var distance1 = distanceDatasetPairs[1][0];
15204
15204
  var SpacingBetweenSlices = Math.abs(distance1 - distance0);
15205
- ds.SharedFunctionalGroupsSequence = {
15205
+ ds2.SharedFunctionalGroupsSequence = {
15206
15206
  PlaneOrientationSequence: {
15207
15207
  ImageOrientationPatient: dataset0.ImageOrientationPatient
15208
15208
  },
@@ -15212,14 +15212,14 @@ var require_dcmjs = __commonJS({
15212
15212
  SliceThickness: SpacingBetweenSlices
15213
15213
  }
15214
15214
  };
15215
- ds.ReferencedSeriesSequence = {
15215
+ ds2.ReferencedSeriesSequence = {
15216
15216
  SeriesInstanceUID: dataset0.SeriesInstanceUID,
15217
15217
  ReferencedInstanceSequence: []
15218
15218
  };
15219
- ds.PerFrameFunctionalGroupsSequence = [];
15219
+ ds2.PerFrameFunctionalGroupsSequence = [];
15220
15220
  distanceDatasetPairs.forEach(function(pair) {
15221
15221
  var dataset = pair[1];
15222
- ds.PerFrameFunctionalGroupsSequence.push({
15222
+ ds2.PerFrameFunctionalGroupsSequence.push({
15223
15223
  PlanePositionSequence: {
15224
15224
  ImagePositionPatient: dataset.ImagePositionPatient
15225
15225
  },
@@ -15228,7 +15228,7 @@ var require_dcmjs = __commonJS({
15228
15228
  WindowWidth: dataset.WindowWidth
15229
15229
  }
15230
15230
  });
15231
- ds.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
15231
+ ds2.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
15232
15232
  ReferencedSOPClassUID: dataset.SOPClassUID,
15233
15233
  ReferencedSOPInstanceUID: dataset.SOPInstanceUID
15234
15234
  });
@@ -15248,29 +15248,29 @@ var require_dcmjs = __commonJS({
15248
15248
  }, {
15249
15249
  key: "normalizeMultiframe",
15250
15250
  value: function normalizeMultiframe() {
15251
- var ds = this.dataset;
15252
- if (!ds.NumberOfFrames) {
15251
+ var ds2 = this.dataset;
15252
+ if (!ds2.NumberOfFrames) {
15253
15253
  log.error("Missing number or frames not supported");
15254
15254
  return;
15255
15255
  }
15256
- if (!ds.PixelRepresentation) {
15257
- ds.PixelRepresentation = 1;
15256
+ if (!ds2.PixelRepresentation) {
15257
+ ds2.PixelRepresentation = 1;
15258
15258
  }
15259
- if (!ds.StudyID || ds.StudyID === "") {
15260
- ds.StudyID = "No Study ID";
15259
+ if (!ds2.StudyID || ds2.StudyID === "") {
15260
+ ds2.StudyID = "No Study ID";
15261
15261
  }
15262
15262
  var validLateralities = ["R", "L"];
15263
- if (validLateralities.indexOf(ds.Laterality) === -1) {
15264
- delete ds.Laterality;
15263
+ if (validLateralities.indexOf(ds2.Laterality) === -1) {
15264
+ delete ds2.Laterality;
15265
15265
  }
15266
- if (!ds.PresentationLUTShape) {
15267
- ds.PresentationLUTShape = "IDENTITY";
15266
+ if (!ds2.PresentationLUTShape) {
15267
+ ds2.PresentationLUTShape = "IDENTITY";
15268
15268
  }
15269
- if (!ds.SharedFunctionalGroupsSequence) {
15269
+ if (!ds2.SharedFunctionalGroupsSequence) {
15270
15270
  log.error("Can only process multiframe data with SharedFunctionalGroupsSequence");
15271
15271
  }
15272
- if (ds.BodyPartExamined === "PROSTATE") {
15273
- ds.SharedFunctionalGroupsSequence.FrameAnatomySequence = {
15272
+ if (ds2.BodyPartExamined === "PROSTATE") {
15273
+ ds2.SharedFunctionalGroupsSequence.FrameAnatomySequence = {
15274
15274
  AnatomicRegionSequence: {
15275
15275
  CodeValue: "T-9200B",
15276
15276
  CodingSchemeDesignator: "SRT",
@@ -15279,17 +15279,17 @@ var require_dcmjs = __commonJS({
15279
15279
  FrameLaterality: "U"
15280
15280
  };
15281
15281
  }
15282
- var rescaleIntercept = ds.RescaleIntercept || 0;
15283
- var rescaleSlope = ds.RescaleSlope || 1;
15284
- ds.SharedFunctionalGroupsSequence.PixelValueTransformationSequence = {
15282
+ var rescaleIntercept = ds2.RescaleIntercept || 0;
15283
+ var rescaleSlope = ds2.RescaleSlope || 1;
15284
+ ds2.SharedFunctionalGroupsSequence.PixelValueTransformationSequence = {
15285
15285
  RescaleIntercept: rescaleIntercept,
15286
15286
  RescaleSlope: rescaleSlope,
15287
15287
  RescaleType: "US"
15288
15288
  };
15289
15289
  var frameNumber = 1;
15290
15290
  this.datasets.forEach(function(dataset) {
15291
- if (ds.NumberOfFrames === 1) ds.PerFrameFunctionalGroupsSequence = [ds.PerFrameFunctionalGroupsSequence];
15292
- ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
15291
+ if (ds2.NumberOfFrames === 1) ds2.PerFrameFunctionalGroupsSequence = [ds2.PerFrameFunctionalGroupsSequence];
15292
+ ds2.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
15293
15293
  FrameAcquisitionDuration: 0,
15294
15294
  StackID: 1,
15295
15295
  InStackPositionNumber: frameNumber,
@@ -15297,30 +15297,30 @@ var require_dcmjs = __commonJS({
15297
15297
  };
15298
15298
  var frameTime = dataset.AcquisitionDate + dataset.AcquisitionTime;
15299
15299
  if (!isNaN(frameTime)) {
15300
- var frameContentSequence = ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
15300
+ var frameContentSequence = ds2.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
15301
15301
  frameContentSequence.FrameAcquisitionDateTime = frameTime;
15302
15302
  frameContentSequence.FrameReferenceDateTime = frameTime;
15303
15303
  }
15304
15304
  frameNumber++;
15305
15305
  });
15306
- if (ds.WindowCenter && ds.WindowWidth) {
15307
- if (!Array.isArray(ds.WindowCenter)) {
15308
- ds.WindowCenter = [ds.WindowCenter];
15306
+ if (ds2.WindowCenter && ds2.WindowWidth) {
15307
+ if (!Array.isArray(ds2.WindowCenter)) {
15308
+ ds2.WindowCenter = [ds2.WindowCenter];
15309
15309
  }
15310
- if (!Array.isArray(ds.WindowWidth)) {
15311
- ds.WindowWidth = [ds.WindowWidth];
15310
+ if (!Array.isArray(ds2.WindowWidth)) {
15311
+ ds2.WindowWidth = [ds2.WindowWidth];
15312
15312
  }
15313
15313
  }
15314
- if (!ds.WindowCenter || !ds.WindowWidth) {
15315
- ds.WindowCenter = [];
15316
- ds.WindowWidth = [];
15317
- if (ds.PerFrameFunctionalGroupsSequence) {
15314
+ if (!ds2.WindowCenter || !ds2.WindowWidth) {
15315
+ ds2.WindowCenter = [];
15316
+ ds2.WindowWidth = [];
15317
+ if (ds2.PerFrameFunctionalGroupsSequence) {
15318
15318
  var wcww = {
15319
15319
  center: 0,
15320
15320
  width: 0,
15321
15321
  count: 0
15322
15322
  };
15323
- ds.PerFrameFunctionalGroupsSequence.forEach(function(functionalGroup) {
15323
+ ds2.PerFrameFunctionalGroupsSequence.forEach(function(functionalGroup) {
15324
15324
  if (functionalGroup.FrameVOILUT) {
15325
15325
  var wc = functionalGroup.FrameVOILUTSequence.WindowCenter;
15326
15326
  var ww = functionalGroup.FrameVOILUTSequence.WindowWidth;
@@ -15338,16 +15338,16 @@ var require_dcmjs = __commonJS({
15338
15338
  }
15339
15339
  });
15340
15340
  if (wcww.count > 0) {
15341
- ds.WindowCenter.push(String(wcww.center / wcww.count));
15342
- ds.WindowWidth.push(String(wcww.width / wcww.count));
15341
+ ds2.WindowCenter.push(String(wcww.center / wcww.count));
15342
+ ds2.WindowWidth.push(String(wcww.width / wcww.count));
15343
15343
  }
15344
15344
  }
15345
15345
  }
15346
- if (ds.WindowCenter.length === 0) {
15347
- ds.WindowCenter = [300];
15346
+ if (ds2.WindowCenter.length === 0) {
15347
+ ds2.WindowCenter = [300];
15348
15348
  }
15349
- if (ds.WindowWidth.length === 0) {
15350
- ds.WindowWidth = [500];
15349
+ if (ds2.WindowWidth.length === 0) {
15350
+ ds2.WindowWidth = [500];
15351
15351
  }
15352
15352
  }
15353
15353
  }], [{
@@ -15394,12 +15394,12 @@ var require_dcmjs = __commonJS({
15394
15394
  key: "normalizeMultiframe",
15395
15395
  value: function normalizeMultiframe() {
15396
15396
  _get(_getPrototypeOf(MRImageNormalizer2.prototype), "normalizeMultiframe", this).call(this);
15397
- var ds = this.dataset;
15398
- if (!ds.ImageType || !ds.ImageType.constructor || ds.ImageType.constructor.name != "Array" || ds.ImageType.length != 4) {
15399
- ds.ImageType = ["ORIGINAL", "PRIMARY", "OTHER", "NONE"];
15397
+ var ds2 = this.dataset;
15398
+ if (!ds2.ImageType || !ds2.ImageType.constructor || ds2.ImageType.constructor.name != "Array" || ds2.ImageType.length != 4) {
15399
+ ds2.ImageType = ["ORIGINAL", "PRIMARY", "OTHER", "NONE"];
15400
15400
  }
15401
- ds.SharedFunctionalGroupsSequence.MRImageFrameTypeSequence = {
15402
- FrameType: ds.ImageType,
15401
+ ds2.SharedFunctionalGroupsSequence.MRImageFrameTypeSequence = {
15402
+ FrameType: ds2.ImageType,
15403
15403
  PixelPresentation: "MONOCHROME",
15404
15404
  VolumetricProperties: "VOLUME",
15405
15405
  VolumeBasedCalculationTechnique: "NONE",
@@ -15532,9 +15532,9 @@ var require_dcmjs = __commonJS({
15532
15532
  key: "normalize",
15533
15533
  value: function normalize2() {
15534
15534
  _get(_getPrototypeOf(PMImageNormalizer2.prototype), "normalize", this).call(this);
15535
- var ds = this.datasets[0];
15536
- if (ds.BitsAllocated !== 32) {
15537
- log.error("Only works with 32 bit data, not " + String(ds.BitsAllocated));
15535
+ var ds2 = this.datasets[0];
15536
+ if (ds2.BitsAllocated !== 32) {
15537
+ log.error("Only works with 32 bit data, not " + String(ds2.BitsAllocated));
15538
15538
  }
15539
15539
  }
15540
15540
  }]);
@@ -16311,8 +16311,8 @@ var require_dcmjs = __commonJS({
16311
16311
  return contentItem.ConceptNameCodeSequence.CodeMeaning === TRACKING_IDENTIFIER;
16312
16312
  });
16313
16313
  var TrackingIdentifierValue = TrackingIdentifierGroup.TextValue;
16314
- var toolClass = hooks.getToolClass ? hooks.getToolClass(measurementGroup, dataset, registeredToolClasses) : registeredToolClasses.find(function(tc2) {
16315
- return tc2.isValidCornerstoneTrackingIdentifier(TrackingIdentifierValue);
16314
+ var toolClass = hooks.getToolClass ? hooks.getToolClass(measurementGroup, dataset, registeredToolClasses) : registeredToolClasses.find(function(tc) {
16315
+ return tc.isValidCornerstoneTrackingIdentifier(TrackingIdentifierValue);
16316
16316
  });
16317
16317
  if (toolClass) {
16318
16318
  var measurement = toolClass.getMeasurementData(measurementGroup);
@@ -20344,8 +20344,8 @@ var require_dcmjs = __commonJS({
20344
20344
  return contentItem.ConceptNameCodeSequence.CodeMeaning === TRACKING_IDENTIFIER;
20345
20345
  });
20346
20346
  var TrackingIdentifierValue = TrackingIdentifierGroup.TextValue;
20347
- var toolClass = hooks.getToolClass ? hooks.getToolClass(measurementGroup, dataset, registeredToolClasses) : registeredToolClasses.find(function(tc2) {
20348
- return tc2.isValidCornerstoneTrackingIdentifier(TrackingIdentifierValue);
20347
+ var toolClass = hooks.getToolClass ? hooks.getToolClass(measurementGroup, dataset, registeredToolClasses) : registeredToolClasses.find(function(tc) {
20348
+ return tc.isValidCornerstoneTrackingIdentifier(TrackingIdentifierValue);
20349
20349
  });
20350
20350
  if (toolClass) {
20351
20351
  var measurement = toolClass.getMeasurementData(measurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata);
@@ -27117,8 +27117,8 @@ var require_util = __commonJS({
27117
27117
  };
27118
27118
  exports2.nearestCommonProto = nearestCommonProto;
27119
27119
  var hardMixProtos = (ingredients, constructor, exclude = []) => {
27120
- var _a2;
27121
- const base = (_a2 = (0, exports2.nearestCommonProto)(...ingredients)) !== null && _a2 !== void 0 ? _a2 : Object.prototype;
27120
+ var _a;
27121
+ const base = (_a = (0, exports2.nearestCommonProto)(...ingredients)) !== null && _a !== void 0 ? _a : Object.prototype;
27122
27122
  const mixedProto = Object.create(base);
27123
27123
  const visitedProtos = (0, exports2.protoChain)(base);
27124
27124
  for (let prototype of ingredients) {
@@ -27248,8 +27248,8 @@ var require_mixin_tracking = __commonJS({
27248
27248
  frontier.forEach((item) => visited.add(item));
27249
27249
  const newFrontier = /* @__PURE__ */ new Set();
27250
27250
  frontier.forEach((item) => {
27251
- var _a2;
27252
- const itemConstituents = (_a2 = mixins.get(item)) !== null && _a2 !== void 0 ? _a2 : (0, util_1.protoChain)(item.prototype).map((proto) => proto.constructor).filter((item2) => item2 !== null);
27251
+ var _a;
27252
+ const itemConstituents = (_a = mixins.get(item)) !== null && _a !== void 0 ? _a : (0, util_1.protoChain)(item.prototype).map((proto) => proto.constructor).filter((item2) => item2 !== null);
27253
27253
  if (itemConstituents)
27254
27254
  itemConstituents.forEach((constituent) => {
27255
27255
  if (!visited.has(constituent) && !frontier.has(constituent))
@@ -27273,37 +27273,37 @@ var require_decorator = __commonJS({
27273
27273
  var util_1 = require_util();
27274
27274
  var mixin_tracking_1 = require_mixin_tracking();
27275
27275
  var mergeObjectsOfDecorators = (o1, o2) => {
27276
- var _a2, _b;
27276
+ var _a, _b;
27277
27277
  const allKeys = (0, util_1.unique)([...Object.getOwnPropertyNames(o1), ...Object.getOwnPropertyNames(o2)]);
27278
27278
  const mergedObject = {};
27279
27279
  for (let key of allKeys)
27280
- mergedObject[key] = (0, util_1.unique)([...(_a2 = o1 === null || o1 === void 0 ? void 0 : o1[key]) !== null && _a2 !== void 0 ? _a2 : [], ...(_b = o2 === null || o2 === void 0 ? void 0 : o2[key]) !== null && _b !== void 0 ? _b : []]);
27280
+ mergedObject[key] = (0, util_1.unique)([...(_a = o1 === null || o1 === void 0 ? void 0 : o1[key]) !== null && _a !== void 0 ? _a : [], ...(_b = o2 === null || o2 === void 0 ? void 0 : o2[key]) !== null && _b !== void 0 ? _b : []]);
27281
27281
  return mergedObject;
27282
27282
  };
27283
27283
  var mergePropertyAndMethodDecorators = (d1, d22) => {
27284
- var _a2, _b, _c, _d;
27284
+ var _a, _b, _c, _d;
27285
27285
  return {
27286
- property: mergeObjectsOfDecorators((_a2 = d1 === null || d1 === void 0 ? void 0 : d1.property) !== null && _a2 !== void 0 ? _a2 : {}, (_b = d22 === null || d22 === void 0 ? void 0 : d22.property) !== null && _b !== void 0 ? _b : {}),
27286
+ property: mergeObjectsOfDecorators((_a = d1 === null || d1 === void 0 ? void 0 : d1.property) !== null && _a !== void 0 ? _a : {}, (_b = d22 === null || d22 === void 0 ? void 0 : d22.property) !== null && _b !== void 0 ? _b : {}),
27287
27287
  method: mergeObjectsOfDecorators((_c = d1 === null || d1 === void 0 ? void 0 : d1.method) !== null && _c !== void 0 ? _c : {}, (_d = d22 === null || d22 === void 0 ? void 0 : d22.method) !== null && _d !== void 0 ? _d : {})
27288
27288
  };
27289
27289
  };
27290
27290
  var mergeDecorators = (d1, d22) => {
27291
- var _a2, _b, _c, _d, _e, _f;
27291
+ var _a, _b, _c, _d, _e, _f;
27292
27292
  return {
27293
- class: (0, util_1.unique)([...(_a2 = d1 === null || d1 === void 0 ? void 0 : d1.class) !== null && _a2 !== void 0 ? _a2 : [], ...(_b = d22 === null || d22 === void 0 ? void 0 : d22.class) !== null && _b !== void 0 ? _b : []]),
27293
+ class: (0, util_1.unique)([...(_a = d1 === null || d1 === void 0 ? void 0 : d1.class) !== null && _a !== void 0 ? _a : [], ...(_b = d22 === null || d22 === void 0 ? void 0 : d22.class) !== null && _b !== void 0 ? _b : []]),
27294
27294
  static: mergePropertyAndMethodDecorators((_c = d1 === null || d1 === void 0 ? void 0 : d1.static) !== null && _c !== void 0 ? _c : {}, (_d = d22 === null || d22 === void 0 ? void 0 : d22.static) !== null && _d !== void 0 ? _d : {}),
27295
27295
  instance: mergePropertyAndMethodDecorators((_e = d1 === null || d1 === void 0 ? void 0 : d1.instance) !== null && _e !== void 0 ? _e : {}, (_f = d22 === null || d22 === void 0 ? void 0 : d22.instance) !== null && _f !== void 0 ? _f : {})
27296
27296
  };
27297
27297
  };
27298
27298
  var decorators = /* @__PURE__ */ new Map();
27299
27299
  var findAllConstituentClasses = (...classes) => {
27300
- var _a2;
27300
+ var _a;
27301
27301
  const allClasses = /* @__PURE__ */ new Set();
27302
27302
  const frontier = /* @__PURE__ */ new Set([...classes]);
27303
27303
  while (frontier.size > 0) {
27304
27304
  for (let clazz of frontier) {
27305
27305
  const protoChainClasses = (0, util_1.protoChain)(clazz.prototype).map((proto) => proto.constructor);
27306
- const mixinClasses = (_a2 = (0, mixin_tracking_1.getMixinsForClass)(clazz)) !== null && _a2 !== void 0 ? _a2 : [];
27306
+ const mixinClasses = (_a = (0, mixin_tracking_1.getMixinsForClass)(clazz)) !== null && _a !== void 0 ? _a : [];
27307
27307
  const potentiallyNewClasses = [...protoChainClasses, ...mixinClasses];
27308
27308
  const newClasses = potentiallyNewClasses.filter((c) => !allClasses.has(c));
27309
27309
  for (let newClass of newClasses)
@@ -27352,12 +27352,12 @@ var require_decorator = __commonJS({
27352
27352
  return decorator(clazz);
27353
27353
  };
27354
27354
  var decorateMember = (decorator) => (object, key, ...otherArgs) => {
27355
- var _a2, _b, _c;
27355
+ var _a, _b, _c;
27356
27356
  const decoratorTargetType = typeof object === "function" ? "static" : "instance";
27357
27357
  const decoratorType = typeof object[key] === "function" ? "method" : "property";
27358
27358
  const clazz = decoratorTargetType === "static" ? object : object.constructor;
27359
27359
  const decoratorsForClass = (0, exports2.getDecoratorsForClass)(clazz);
27360
- const decoratorsForTargetType = (_a2 = decoratorsForClass === null || decoratorsForClass === void 0 ? void 0 : decoratorsForClass[decoratorTargetType]) !== null && _a2 !== void 0 ? _a2 : {};
27360
+ const decoratorsForTargetType = (_a = decoratorsForClass === null || decoratorsForClass === void 0 ? void 0 : decoratorsForClass[decoratorTargetType]) !== null && _a !== void 0 ? _a : {};
27361
27361
  decoratorsForClass[decoratorTargetType] = decoratorsForTargetType;
27362
27362
  let decoratorsForType = (_b = decoratorsForTargetType === null || decoratorsForTargetType === void 0 ? void 0 : decoratorsForTargetType[decoratorType]) !== null && _b !== void 0 ? _b : {};
27363
27363
  decoratorsForTargetType[decoratorType] = decoratorsForType;
@@ -27387,7 +27387,7 @@ var require_mixins = __commonJS({
27387
27387
  var decorator_1 = require_decorator();
27388
27388
  var mixin_tracking_1 = require_mixin_tracking();
27389
27389
  function Mixin(...constructors) {
27390
- var _a2, _b, _c;
27390
+ var _a, _b, _c;
27391
27391
  const prototypes = constructors.map((constructor) => constructor.prototype);
27392
27392
  const initFunctionName = settings_1.settings.initFunction;
27393
27393
  if (initFunctionName !== null) {
@@ -27410,7 +27410,7 @@ var require_mixins = __commonJS({
27410
27410
  let DecoratedMixedClass = MixedClass;
27411
27411
  if (settings_1.settings.decoratorInheritance !== "none") {
27412
27412
  const classDecorators = settings_1.settings.decoratorInheritance === "deep" ? (0, decorator_1.deepDecoratorSearch)(...constructors) : (0, decorator_1.directDecoratorSearch)(...constructors);
27413
- for (let decorator of (_a2 = classDecorators === null || classDecorators === void 0 ? void 0 : classDecorators.class) !== null && _a2 !== void 0 ? _a2 : []) {
27413
+ for (let decorator of (_a = classDecorators === null || classDecorators === void 0 ? void 0 : classDecorators.class) !== null && _a !== void 0 ? _a : []) {
27414
27414
  const result = decorator(DecoratedMixedClass);
27415
27415
  if (result) {
27416
27416
  DecoratedMixedClass = result;
@@ -27590,7 +27590,7 @@ var require_has_flag = __commonJS({
27590
27590
  var require_supports_colors = __commonJS({
27591
27591
  "../../node_modules/logform/node_modules/@colors/colors/lib/system/supports-colors.js"(exports2, module2) {
27592
27592
  "use strict";
27593
- var os = require("os");
27593
+ var os2 = require("os");
27594
27594
  var hasFlag = require_has_flag();
27595
27595
  var env = process.env;
27596
27596
  var forceColor = void 0;
@@ -27628,7 +27628,7 @@ var require_supports_colors = __commonJS({
27628
27628
  }
27629
27629
  var min = forceColor ? 1 : 0;
27630
27630
  if (process.platform === "win32") {
27631
- var osRelease = os.release().split(".");
27631
+ var osRelease = os2.release().split(".");
27632
27632
  if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
27633
27633
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
27634
27634
  }
@@ -29587,8 +29587,8 @@ var require_fecha_umd = __commonJS({
29587
29587
  for (var _i = 1; _i < arguments.length; _i++) {
29588
29588
  args[_i - 1] = arguments[_i];
29589
29589
  }
29590
- for (var _a2 = 0, args_1 = args; _a2 < args_1.length; _a2++) {
29591
- var obj = args_1[_a2];
29590
+ for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
29591
+ var obj = args_1[_a];
29592
29592
  for (var key in obj) {
29593
29593
  origObj[key] = obj[key];
29594
29594
  }
@@ -29909,7 +29909,7 @@ var require_fecha_umd = __commonJS({
29909
29909
  }
29910
29910
  var combinedI18nSettings = assign(assign({}, globalI18n), i18n);
29911
29911
  for (var i = 1; i < matches.length; i++) {
29912
- var _a2 = parseInfo[i - 1], field = _a2[0], parser = _a2[2];
29912
+ var _a = parseInfo[i - 1], field = _a[0], parser = _a[2];
29913
29913
  var value = parser ? parser(matches[i], combinedI18nSettings) : +matches[i];
29914
29914
  if (value == null) {
29915
29915
  return null;
@@ -31548,10 +31548,10 @@ var require_stream_readable = __commonJS({
31548
31548
  state.reading = false;
31549
31549
  onEofChunk(stream, state);
31550
31550
  } else {
31551
- var er;
31552
- if (!skipChunkCheck) er = chunkInvalid(state, chunk);
31553
- if (er) {
31554
- errorOrDestroy(stream, er);
31551
+ var er2;
31552
+ if (!skipChunkCheck) er2 = chunkInvalid(state, chunk);
31553
+ if (er2) {
31554
+ errorOrDestroy(stream, er2);
31555
31555
  } else if (state.objectMode || chunk && chunk.length > 0) {
31556
31556
  if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) {
31557
31557
  chunk = _uint8ArrayToBuffer(chunk);
@@ -31593,11 +31593,11 @@ var require_stream_readable = __commonJS({
31593
31593
  maybeReadMore(stream, state);
31594
31594
  }
31595
31595
  function chunkInvalid(state, chunk) {
31596
- var er;
31596
+ var er2;
31597
31597
  if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) {
31598
- er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
31598
+ er2 = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
31599
31599
  }
31600
- return er;
31600
+ return er2;
31601
31601
  }
31602
31602
  Readable2.prototype.isPaused = function() {
31603
31603
  return this._readableState.flowing === false;
@@ -31823,11 +31823,11 @@ var require_stream_readable = __commonJS({
31823
31823
  src.pause();
31824
31824
  }
31825
31825
  }
31826
- function onerror(er) {
31827
- debug("onerror", er);
31826
+ function onerror(er2) {
31827
+ debug("onerror", er2);
31828
31828
  unpipe();
31829
31829
  dest.removeListener("error", onerror);
31830
- if (EElistenerCount(dest, "error") === 0) errorOrDestroy(dest, er);
31830
+ if (EElistenerCount(dest, "error") === 0) errorOrDestroy(dest, er2);
31831
31831
  }
31832
31832
  prependListener(dest, "error", onerror);
31833
31833
  function onclose() {
@@ -32292,8 +32292,8 @@ var require_stream_writable = __commonJS({
32292
32292
  this.corked = 0;
32293
32293
  this.sync = true;
32294
32294
  this.bufferProcessing = false;
32295
- this.onwrite = function(er) {
32296
- onwrite(stream, er);
32295
+ this.onwrite = function(er2) {
32296
+ onwrite(stream, er2);
32297
32297
  };
32298
32298
  this.writecb = null;
32299
32299
  this.writelen = 0;
@@ -32359,20 +32359,20 @@ var require_stream_writable = __commonJS({
32359
32359
  errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
32360
32360
  };
32361
32361
  function writeAfterEnd(stream, cb) {
32362
- var er = new ERR_STREAM_WRITE_AFTER_END();
32363
- errorOrDestroy(stream, er);
32364
- process.nextTick(cb, er);
32362
+ var er2 = new ERR_STREAM_WRITE_AFTER_END();
32363
+ errorOrDestroy(stream, er2);
32364
+ process.nextTick(cb, er2);
32365
32365
  }
32366
32366
  function validChunk(stream, state, chunk, cb) {
32367
- var er;
32367
+ var er2;
32368
32368
  if (chunk === null) {
32369
- er = new ERR_STREAM_NULL_VALUES();
32369
+ er2 = new ERR_STREAM_NULL_VALUES();
32370
32370
  } else if (typeof chunk !== "string" && !state.objectMode) {
32371
- er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);
32371
+ er2 = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);
32372
32372
  }
32373
- if (er) {
32374
- errorOrDestroy(stream, er);
32375
- process.nextTick(cb, er);
32373
+ if (er2) {
32374
+ errorOrDestroy(stream, er2);
32375
+ process.nextTick(cb, er2);
32376
32376
  return false;
32377
32377
  }
32378
32378
  return true;
@@ -32481,17 +32481,17 @@ var require_stream_writable = __commonJS({
32481
32481
  else stream._write(chunk, encoding, state.onwrite);
32482
32482
  state.sync = false;
32483
32483
  }
32484
- function onwriteError(stream, state, sync, er, cb) {
32484
+ function onwriteError(stream, state, sync, er2, cb) {
32485
32485
  --state.pendingcb;
32486
32486
  if (sync) {
32487
- process.nextTick(cb, er);
32487
+ process.nextTick(cb, er2);
32488
32488
  process.nextTick(finishMaybe, stream, state);
32489
32489
  stream._writableState.errorEmitted = true;
32490
- errorOrDestroy(stream, er);
32490
+ errorOrDestroy(stream, er2);
32491
32491
  } else {
32492
- cb(er);
32492
+ cb(er2);
32493
32493
  stream._writableState.errorEmitted = true;
32494
- errorOrDestroy(stream, er);
32494
+ errorOrDestroy(stream, er2);
32495
32495
  finishMaybe(stream, state);
32496
32496
  }
32497
32497
  }
@@ -32501,13 +32501,13 @@ var require_stream_writable = __commonJS({
32501
32501
  state.length -= state.writelen;
32502
32502
  state.writelen = 0;
32503
32503
  }
32504
- function onwrite(stream, er) {
32504
+ function onwrite(stream, er2) {
32505
32505
  var state = stream._writableState;
32506
32506
  var sync = state.sync;
32507
32507
  var cb = state.writecb;
32508
32508
  if (typeof cb !== "function") throw new ERR_MULTIPLE_CALLBACK();
32509
32509
  onwriteStateUpdate(state);
32510
- if (er) onwriteError(stream, state, sync, er, cb);
32510
+ if (er2) onwriteError(stream, state, sync, er2, cb);
32511
32511
  else {
32512
32512
  var finished = needFinish(state) || stream.destroyed;
32513
32513
  if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
@@ -32889,7 +32889,7 @@ var require_winston_transport = __commonJS({
32889
32889
  var require_console = __commonJS({
32890
32890
  "../../node_modules/winston/lib/winston/transports/console.js"(exports2, module2) {
32891
32891
  "use strict";
32892
- var os = require("os");
32892
+ var os2 = require("os");
32893
32893
  var { LEVEL, MESSAGE } = require_triple_beam();
32894
32894
  var TransportStream = require_winston_transport();
32895
32895
  module2.exports = class Console extends TransportStream {
@@ -32903,7 +32903,7 @@ var require_console = __commonJS({
32903
32903
  this.name = options.name || "console";
32904
32904
  this.stderrLevels = this._stringArrayToSet(options.stderrLevels);
32905
32905
  this.consoleWarnLevels = this._stringArrayToSet(options.consoleWarnLevels);
32906
- this.eol = typeof options.eol === "string" ? options.eol : os.EOL;
32906
+ this.eol = typeof options.eol === "string" ? options.eol : os2.EOL;
32907
32907
  this.forceConsole = options.forceConsole || false;
32908
32908
  this._consoleLog = console.log.bind(console);
32909
32909
  this._consoleWarn = console.warn.bind(console);
@@ -33538,18 +33538,18 @@ var require_stream_transform = __commonJS({
33538
33538
  var ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
33539
33539
  var Duplex = require_stream_duplex();
33540
33540
  require_inherits()(Transform, Duplex);
33541
- function afterTransform(er, data2) {
33542
- var ts = this._transformState;
33543
- ts.transforming = false;
33544
- var cb = ts.writecb;
33541
+ function afterTransform(er2, data2) {
33542
+ var ts2 = this._transformState;
33543
+ ts2.transforming = false;
33544
+ var cb = ts2.writecb;
33545
33545
  if (cb === null) {
33546
33546
  return this.emit("error", new ERR_MULTIPLE_CALLBACK());
33547
33547
  }
33548
- ts.writechunk = null;
33549
- ts.writecb = null;
33548
+ ts2.writechunk = null;
33549
+ ts2.writecb = null;
33550
33550
  if (data2 != null)
33551
33551
  this.push(data2);
33552
- cb(er);
33552
+ cb(er2);
33553
33553
  var rs = this._readableState;
33554
33554
  rs.reading = false;
33555
33555
  if (rs.needReadable || rs.length < rs.highWaterMark) {
@@ -33578,8 +33578,8 @@ var require_stream_transform = __commonJS({
33578
33578
  function prefinish() {
33579
33579
  var _this = this;
33580
33580
  if (typeof this._flush === "function" && !this._readableState.destroyed) {
33581
- this._flush(function(er, data2) {
33582
- done(_this, er, data2);
33581
+ this._flush(function(er2, data2) {
33582
+ done(_this, er2, data2);
33583
33583
  });
33584
33584
  } else {
33585
33585
  done(this, null, null);
@@ -33593,22 +33593,22 @@ var require_stream_transform = __commonJS({
33593
33593
  cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()"));
33594
33594
  };
33595
33595
  Transform.prototype._write = function(chunk, encoding, cb) {
33596
- var ts = this._transformState;
33597
- ts.writecb = cb;
33598
- ts.writechunk = chunk;
33599
- ts.writeencoding = encoding;
33600
- if (!ts.transforming) {
33596
+ var ts2 = this._transformState;
33597
+ ts2.writecb = cb;
33598
+ ts2.writechunk = chunk;
33599
+ ts2.writeencoding = encoding;
33600
+ if (!ts2.transforming) {
33601
33601
  var rs = this._readableState;
33602
- if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
33602
+ if (ts2.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
33603
33603
  }
33604
33604
  };
33605
33605
  Transform.prototype._read = function(n) {
33606
- var ts = this._transformState;
33607
- if (ts.writechunk !== null && !ts.transforming) {
33608
- ts.transforming = true;
33609
- this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
33606
+ var ts2 = this._transformState;
33607
+ if (ts2.writechunk !== null && !ts2.transforming) {
33608
+ ts2.transforming = true;
33609
+ this._transform(ts2.writechunk, ts2.writeencoding, ts2.afterTransform);
33610
33610
  } else {
33611
- ts.needTransform = true;
33611
+ ts2.needTransform = true;
33612
33612
  }
33613
33613
  };
33614
33614
  Transform.prototype._destroy = function(err, cb) {
@@ -33616,8 +33616,8 @@ var require_stream_transform = __commonJS({
33616
33616
  cb(err2);
33617
33617
  });
33618
33618
  };
33619
- function done(stream, er, data2) {
33620
- if (er) return stream.emit("error", er);
33619
+ function done(stream, er2, data2) {
33620
+ if (er2) return stream.emit("error", er2);
33621
33621
  if (data2 != null)
33622
33622
  stream.push(data2);
33623
33623
  if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();
@@ -33694,8 +33694,8 @@ var require_pipeline = __commonJS({
33694
33694
  function call(fn) {
33695
33695
  fn();
33696
33696
  }
33697
- function pipe(from, to) {
33698
- return from.pipe(to);
33697
+ function pipe(from, to2) {
33698
+ return from.pipe(to2);
33699
33699
  }
33700
33700
  function popCallback(streams) {
33701
33701
  if (!streams.length) return noop;
@@ -35155,9 +35155,9 @@ var require_route = __commonJS({
35155
35155
  }
35156
35156
  return graph;
35157
35157
  }
35158
- function link(from, to) {
35158
+ function link(from, to2) {
35159
35159
  return function(args) {
35160
- return to(from(args));
35160
+ return to2(from(args));
35161
35161
  };
35162
35162
  }
35163
35163
  function wrapConversion(toModel, graph) {
@@ -35931,7 +35931,7 @@ var require_file = __commonJS({
35931
35931
  var { Stream, PassThrough } = require_readable();
35932
35932
  var TransportStream = require_winston_transport();
35933
35933
  var debug = require_node2()("winston:file");
35934
- var os = require("os");
35934
+ var os2 = require("os");
35935
35935
  var tailFile = require_tail_file();
35936
35936
  module2.exports = class File extends TransportStream {
35937
35937
  /**
@@ -35969,7 +35969,7 @@ var require_file = __commonJS({
35969
35969
  this.rotationFormat = options.rotationFormat || false;
35970
35970
  this.zippedArchive = options.zippedArchive || false;
35971
35971
  this.maxFiles = options.maxFiles || null;
35972
- this.eol = typeof options.eol === "string" ? options.eol : os.EOL;
35972
+ this.eol = typeof options.eol === "string" ? options.eol : os2.EOL;
35973
35973
  this.tailable = options.tailable || false;
35974
35974
  this.lazy = options.lazy || false;
35975
35975
  this._size = 0;
@@ -36750,7 +36750,7 @@ var require_stream3 = __commonJS({
36750
36750
  "use strict";
36751
36751
  var isStream = require_is_stream();
36752
36752
  var { MESSAGE } = require_triple_beam();
36753
- var os = require("os");
36753
+ var os2 = require("os");
36754
36754
  var TransportStream = require_winston_transport();
36755
36755
  module2.exports = class Stream extends TransportStream {
36756
36756
  /**
@@ -36766,7 +36766,7 @@ var require_stream3 = __commonJS({
36766
36766
  this._stream = options.stream;
36767
36767
  this._stream.setMaxListeners(Infinity);
36768
36768
  this.isObjectMode = options.stream._writableState.objectMode;
36769
- this.eol = typeof options.eol === "string" ? options.eol : os.EOL;
36769
+ this.eol = typeof options.eol === "string" ? options.eol : os2.EOL;
36770
36770
  }
36771
36771
  /**
36772
36772
  * Core logging method exposed to Winston.
@@ -37150,7 +37150,7 @@ var require_exception_stream = __commonJS({
37150
37150
  var require_exception_handler = __commonJS({
37151
37151
  "../../node_modules/winston/lib/winston/exception-handler.js"(exports2, module2) {
37152
37152
  "use strict";
37153
- var os = require("os");
37153
+ var os2 = require("os");
37154
37154
  var asyncForEach = require_forEach();
37155
37155
  var debug = require_node2()("winston:exception");
37156
37156
  var once = require_one_time();
@@ -37245,8 +37245,8 @@ var require_exception_handler = __commonJS({
37245
37245
  */
37246
37246
  getOsInfo() {
37247
37247
  return {
37248
- loadavg: os.loadavg(),
37249
- uptime: os.uptime()
37248
+ loadavg: os2.loadavg(),
37249
+ uptime: os2.uptime()
37250
37250
  };
37251
37251
  }
37252
37252
  /**
@@ -37388,7 +37388,7 @@ var require_rejection_stream = __commonJS({
37388
37388
  var require_rejection_handler = __commonJS({
37389
37389
  "../../node_modules/winston/lib/winston/rejection-handler.js"(exports2, module2) {
37390
37390
  "use strict";
37391
- var os = require("os");
37391
+ var os2 = require("os");
37392
37392
  var asyncForEach = require_forEach();
37393
37393
  var debug = require_node2()("winston:rejection");
37394
37394
  var once = require_one_time();
@@ -37485,8 +37485,8 @@ var require_rejection_handler = __commonJS({
37485
37485
  */
37486
37486
  getOsInfo() {
37487
37487
  return {
37488
- loadavg: os.loadavg(),
37489
- uptime: os.uptime()
37488
+ loadavg: os2.loadavg(),
37489
+ uptime: os2.uptime()
37490
37490
  };
37491
37491
  }
37492
37492
  /**
@@ -40507,98 +40507,98 @@ var zt = class {
40507
40507
  var Jt = "ok";
40508
40508
  var Ze = "created";
40509
40509
  var Zt = "not-modified";
40510
- var Xt = "not-found";
40511
- var tr = "unauthorized";
40510
+ var er = "not-found";
40511
+ var rr = "unauthorized";
40512
40512
  var Xe = "accepted";
40513
- var cn = { resourceType: "OperationOutcome", id: Xt, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
40514
- var be = { resourceType: "OperationOutcome", id: tr, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
40515
- var un = { ...be, issue: [...be.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
40516
- var rr = { ...be, issue: [...be.issue, { severity: "error", code: "invalid", details: { text: "Token not issued for this audience" } }] };
40513
+ var un = { resourceType: "OperationOutcome", id: er, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
40514
+ var be = { resourceType: "OperationOutcome", id: rr, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
40515
+ var ln = { ...be, issue: [...be.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
40516
+ var nr = { ...be, issue: [...be.issue, { severity: "error", code: "invalid", details: { text: "Token not issued for this audience" } }] };
40517
40517
  function E(r7, e) {
40518
40518
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r7 }, ...e ? { expression: [e] } : void 0 }] };
40519
40519
  }
40520
40520
  function h(r7) {
40521
40521
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "structure", details: { text: r7 } }] };
40522
40522
  }
40523
- function ln(r7) {
40523
+ function pn(r7) {
40524
40524
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "exception", details: { text: "Internal server error" }, diagnostics: r7.toString() }] };
40525
40525
  }
40526
40526
  function Re(r7) {
40527
40527
  return typeof r7 == "object" && r7 !== null && r7.resourceType === "OperationOutcome";
40528
40528
  }
40529
- function nr(r7) {
40529
+ function ir(r7) {
40530
40530
  return r7.id === Jt || r7.id === Ze || r7.id === Zt || r7.id === Xe;
40531
40531
  }
40532
40532
  var d = class extends Error {
40533
40533
  constructor(e, t) {
40534
- super(pn(e)), this.outcome = e, this.cause = t;
40534
+ super(dn(e)), this.outcome = e, this.cause = t;
40535
40535
  }
40536
40536
  };
40537
40537
  function et(r7) {
40538
40538
  return r7 instanceof d ? r7.outcome : Re(r7) ? r7 : E(Ce(r7));
40539
40539
  }
40540
40540
  function Ce(r7) {
40541
- return r7 ? typeof r7 == "string" ? r7 : r7 instanceof Error ? r7.message : Re(r7) ? pn(r7) : typeof r7 == "object" && "code" in r7 && typeof r7.code == "string" ? r7.code : JSON.stringify(r7) : "Unknown error";
40541
+ return r7 ? typeof r7 == "string" ? r7 : r7 instanceof Error ? r7.message : Re(r7) ? dn(r7) : typeof r7 == "object" && "code" in r7 && typeof r7.code == "string" ? r7.code : JSON.stringify(r7) : "Unknown error";
40542
40542
  }
40543
- function pn(r7) {
40544
- let e = r7.issue?.map(eo) ?? [];
40543
+ function dn(r7) {
40544
+ let e = r7.issue?.map(to) ?? [];
40545
40545
  return e.length > 0 ? e.join("; ") : "Unknown error";
40546
40546
  }
40547
- function eo(r7) {
40547
+ function to(r7) {
40548
40548
  let e;
40549
40549
  return r7.details?.text ? r7.diagnostics ? e = `${r7.details.text} (${r7.diagnostics})` : e = r7.details.text : r7.diagnostics ? e = r7.diagnostics : e = "Unknown error", r7.expression?.length && (e += ` (${r7.expression.join(", ")})`), e;
40550
40550
  }
40551
- function ro(r7, e) {
40551
+ function no(r7, e) {
40552
40552
  let t = e.max && e.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : e.max;
40553
40553
  return { path: r7, description: "", type: e.type ?? [], min: e.min ?? 0, max: t ?? 1, isArray: !!t && t > 1, constraints: [] };
40554
40554
  }
40555
- function mn(r7) {
40555
+ function hn(r7) {
40556
40556
  let e = /* @__PURE__ */ Object.create(null);
40557
- for (let [t, n] of Object.entries(r7)) e[t] = { name: t, type: t, path: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i, o]) => [i, ro(i, o)])), constraints: [], innerTypes: [] };
40557
+ for (let [t, n] of Object.entries(r7)) e[t] = { name: t, type: t, path: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i, o]) => [i, no(i, o)])), constraints: [], innerTypes: [] };
40558
40558
  return e;
40559
40559
  }
40560
- var hn = { Element: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, BackboneElement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, Address: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: 9007199254740991, type: [{ code: "string" }] }, city: { type: [{ code: "string" }] }, district: { type: [{ code: "string" }] }, state: { type: [{ code: "string" }] }, postalCode: { type: [{ code: "string" }] }, country: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Age: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "author[x]": { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Organization"] }, { code: "string" }] }, time: { type: [{ code: "dateTime" }] }, text: { min: 1, type: [{ code: "markdown" }] } } }, Attachment: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, contentType: { type: [{ code: "code" }] }, language: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] }, url: { type: [{ code: "url" }] }, size: { type: [{ code: "unsignedInt" }] }, hash: { type: [{ code: "base64Binary" }] }, title: { type: [{ code: "string" }] }, creation: { type: [{ code: "dateTime" }] } } }, CodeableConcept: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, coding: { max: 9007199254740991, type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: 9007199254740991, type: [{ code: "ContactPoint" }] } } }, ContactPoint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] } } }, Count: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, "subject[x]": { type: [{ code: "CodeableConcept" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Group"] }] }, mustSupport: { max: 9007199254740991, type: [{ code: "string" }] }, codeFilter: { max: 9007199254740991, type: [{ code: "DataRequirementCodeFilter" }] }, dateFilter: { max: 9007199254740991, type: [{ code: "DataRequirementDateFilter" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: 9007199254740991, type: [{ code: "DataRequirementSort" }] } } }, DataRequirementCodeFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] } } }, DataRequirementDateFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, "value[x]": { type: [{ code: "dateTime" }, { code: "Period" }, { code: "Duration" }] } } }, DataRequirementSort: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, direction: { min: 1, type: [{ code: "code" }] } } }, Distance: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] }, patientInstruction: { type: [{ code: "string" }] }, timing: { type: [{ code: "Timing" }] }, "asNeeded[x]": { type: [{ code: "boolean" }, { code: "CodeableConcept" }] }, site: { type: [{ code: "CodeableConcept" }] }, route: { type: [{ code: "CodeableConcept" }] }, method: { type: [{ code: "CodeableConcept" }] }, doseAndRate: { max: 9007199254740991, type: [{ code: "DosageDoseAndRate" }] }, maxDosePerPeriod: { type: [{ code: "Ratio" }] }, maxDosePerAdministration: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, maxDosePerLifetime: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, DosageDoseAndRate: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { type: [{ code: "CodeableConcept" }] }, "dose[x]": { type: [{ code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, "rate[x]": { type: [{ code: "Ratio" }, { code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Duration: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: 9007199254740991, type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] }, slicing: { type: [{ code: "ElementDefinitionSlicing" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: 9007199254740991, type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "ElementDefinitionBase" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: 9007199254740991, type: [{ code: "ElementDefinitionType" }] }, "defaultValue[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, meaningWhenMissing: { type: [{ code: "markdown" }] }, orderMeaning: { type: [{ code: "string" }] }, "fixed[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, "pattern[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, example: { max: 9007199254740991, type: [{ code: "ElementDefinitionExample" }] }, "minValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, "maxValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, maxLength: { type: [{ code: "integer" }] }, condition: { max: 9007199254740991, type: [{ code: "id" }] }, constraint: { max: 9007199254740991, type: [{ code: "ElementDefinitionConstraint" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "ElementDefinitionBinding" }] }, mapping: { max: 9007199254740991, type: [{ code: "ElementDefinitionMapping" }] } } }, ElementDefinitionSlicingDiscriminator: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, path: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionSlicing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, discriminator: { max: 9007199254740991, type: [{ code: "ElementDefinitionSlicingDiscriminator" }] }, description: { type: [{ code: "string" }] }, ordered: { type: [{ code: "boolean" }] }, rules: { min: 1, type: [{ code: "code" }] } } }, ElementDefinitionBase: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, min: { min: 1, type: [{ code: "unsignedInt" }] }, max: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionType: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, targetProfile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, aggregation: { max: 9007199254740991, type: [{ code: "code" }] }, versioning: { type: [{ code: "code" }] } } }, ElementDefinitionExample: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, label: { min: 1, type: [{ code: "string" }] }, "value[x]": { min: 1, type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, ElementDefinitionConstraint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, key: { min: 1, type: [{ code: "id" }] }, requirements: { type: [{ code: "string" }] }, severity: { min: 1, type: [{ code: "code" }] }, human: { min: 1, type: [{ code: "string" }] }, expression: { type: [{ code: "string" }] }, xpath: { type: [{ code: "string" }] }, source: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, ElementDefinitionBinding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, strength: { min: 1, type: [{ code: "code" }] }, description: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] } } }, ElementDefinitionMapping: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identity: { min: 1, type: [{ code: "id" }] }, language: { type: [{ code: "code" }] }, map: { min: 1, type: [{ code: "string" }] }, comment: { type: [{ code: "string" }] } } }, Expression: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, description: { type: [{ code: "string" }] }, name: { type: [{ code: "id" }] }, language: { min: 1, type: [{ code: "code" }] }, expression: { type: [{ code: "string" }] }, reference: { type: [{ code: "uri" }] } } }, Extension: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "uri" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: 9007199254740991, type: [{ code: "string" }] }, prefix: { max: 9007199254740991, type: [{ code: "string" }] }, suffix: { max: 9007199254740991, type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "CodeableConcept" }] }, system: { type: [{ code: "uri" }] }, value: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] }, assigner: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MarketingStatus: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, country: { min: 1, type: [{ code: "CodeableConcept" }] }, jurisdiction: { type: [{ code: "CodeableConcept" }] }, status: { min: 1, type: [{ code: "CodeableConcept" }] }, dateRange: { min: 1, type: [{ code: "Period" }] }, restoreDate: { type: [{ code: "dateTime" }] } } }, Meta: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: 9007199254740991, type: [{ code: "Coding" }] }, tag: { max: 9007199254740991, type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, onBehalfOf: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, accounts: { max: 9007199254740991, type: [{ code: "Reference" }] }, compartment: { max: 9007199254740991, type: [{ code: "Reference" }] } } }, Money: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "code" }] }, use: { min: 1, type: [{ code: "code" }] }, min: { type: [{ code: "integer" }] }, max: { type: [{ code: "string" }] }, documentation: { type: [{ code: "string" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, Period: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, height: { type: [{ code: "Quantity" }] }, width: { type: [{ code: "Quantity" }] }, depth: { type: [{ code: "Quantity" }] }, weight: { type: [{ code: "Quantity" }] }, nominalVolume: { type: [{ code: "Quantity" }] }, externalDiameter: { type: [{ code: "Quantity" }] }, shape: { type: [{ code: "string" }] }, color: { max: 9007199254740991, type: [{ code: "string" }] }, imprint: { max: 9007199254740991, type: [{ code: "string" }] }, image: { max: 9007199254740991, type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, Quantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Range: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, low: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, high: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Ratio: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, label: { type: [{ code: "string" }] }, display: { type: [{ code: "string" }] }, citation: { type: [{ code: "markdown" }] }, url: { type: [{ code: "url" }] }, document: { type: [{ code: "Attachment" }] }, resource: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Resource"] }] } } }, SampledData: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, origin: { min: 1, type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, period: { min: 1, type: [{ code: "decimal" }] }, factor: { type: [{ code: "decimal" }] }, lowerLimit: { type: [{ code: "decimal" }] }, upperLimit: { type: [{ code: "decimal" }] }, dimensions: { min: 1, type: [{ code: "positiveInt" }] }, data: { type: [{ code: "string" }] } } }, Signature: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, max: 9007199254740991, type: [{ code: "Coding" }] }, when: { min: 1, type: [{ code: "instant" }] }, who: { min: 1, type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, onBehalfOf: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, targetFormat: { type: [{ code: "code" }] }, sigFormat: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] } } }, SubstanceAmount: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "SubstanceAmountReferenceRange" }] } } }, SubstanceAmountReferenceRange: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, lowLimit: { type: [{ code: "Quantity" }] }, highLimit: { type: [{ code: "Quantity" }] } } }, Timing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, event: { max: 9007199254740991, type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "TimingRepeat" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TimingRepeat: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "bounds[x]": { type: [{ code: "Duration" }, { code: "Range" }, { code: "Period" }] }, count: { type: [{ code: "positiveInt" }] }, countMax: { type: [{ code: "positiveInt" }] }, duration: { type: [{ code: "decimal" }] }, durationMax: { type: [{ code: "decimal" }] }, durationUnit: { type: [{ code: "code" }] }, frequency: { type: [{ code: "positiveInt" }] }, frequencyMax: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "decimal" }] }, periodMax: { type: [{ code: "decimal" }] }, periodUnit: { type: [{ code: "code" }] }, dayOfWeek: { max: 9007199254740991, type: [{ code: "code" }] }, timeOfDay: { max: 9007199254740991, type: [{ code: "time" }] }, when: { max: 9007199254740991, type: [{ code: "code" }] }, offset: { type: [{ code: "unsignedInt" }] } } }, TriggerDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { type: [{ code: "string" }] }, "timing[x]": { type: [{ code: "Timing" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Schedule"] }, { code: "date" }, { code: "dateTime" }] }, data: { max: 9007199254740991, type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "Coding" }] }, "value[x]": { min: 1, type: [{ code: "CodeableConcept" }, { code: "Quantity" }, { code: "Range" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/PlanDefinition", "http://hl7.org/fhir/StructureDefinition/ResearchStudy", "http://hl7.org/fhir/StructureDefinition/InsurancePlan", "http://hl7.org/fhir/StructureDefinition/HealthcareService", "http://hl7.org/fhir/StructureDefinition/Group", "http://hl7.org/fhir/StructureDefinition/Location", "http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MoneyQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, SimpleQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { max: 0, type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, IdentityProvider: { elements: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, tokenAuthMethod: { type: [{ code: "code" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, usePkce: { type: [{ code: "boolean" }] }, useSubject: { type: [{ code: "boolean" }] } } } };
40561
- function ar(r7) {
40562
- return new or(r7).parse();
40560
+ var yn = { Element: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, BackboneElement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, Address: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: 9007199254740991, type: [{ code: "string" }] }, city: { type: [{ code: "string" }] }, district: { type: [{ code: "string" }] }, state: { type: [{ code: "string" }] }, postalCode: { type: [{ code: "string" }] }, country: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Age: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "author[x]": { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Organization"] }, { code: "string" }] }, time: { type: [{ code: "dateTime" }] }, text: { min: 1, type: [{ code: "markdown" }] } } }, Attachment: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, contentType: { type: [{ code: "code" }] }, language: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] }, url: { type: [{ code: "url" }] }, size: { type: [{ code: "unsignedInt" }] }, hash: { type: [{ code: "base64Binary" }] }, title: { type: [{ code: "string" }] }, creation: { type: [{ code: "dateTime" }] } } }, CodeableConcept: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, coding: { max: 9007199254740991, type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: 9007199254740991, type: [{ code: "ContactPoint" }] } } }, ContactPoint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] } } }, Count: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, "subject[x]": { type: [{ code: "CodeableConcept" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Group"] }] }, mustSupport: { max: 9007199254740991, type: [{ code: "string" }] }, codeFilter: { max: 9007199254740991, type: [{ code: "DataRequirementCodeFilter" }] }, dateFilter: { max: 9007199254740991, type: [{ code: "DataRequirementDateFilter" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: 9007199254740991, type: [{ code: "DataRequirementSort" }] } } }, DataRequirementCodeFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] } } }, DataRequirementDateFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, "value[x]": { type: [{ code: "dateTime" }, { code: "Period" }, { code: "Duration" }] } } }, DataRequirementSort: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, direction: { min: 1, type: [{ code: "code" }] } } }, Distance: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] }, patientInstruction: { type: [{ code: "string" }] }, timing: { type: [{ code: "Timing" }] }, "asNeeded[x]": { type: [{ code: "boolean" }, { code: "CodeableConcept" }] }, site: { type: [{ code: "CodeableConcept" }] }, route: { type: [{ code: "CodeableConcept" }] }, method: { type: [{ code: "CodeableConcept" }] }, doseAndRate: { max: 9007199254740991, type: [{ code: "DosageDoseAndRate" }] }, maxDosePerPeriod: { type: [{ code: "Ratio" }] }, maxDosePerAdministration: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, maxDosePerLifetime: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, DosageDoseAndRate: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { type: [{ code: "CodeableConcept" }] }, "dose[x]": { type: [{ code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, "rate[x]": { type: [{ code: "Ratio" }, { code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Duration: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: 9007199254740991, type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] }, slicing: { type: [{ code: "ElementDefinitionSlicing" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: 9007199254740991, type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "ElementDefinitionBase" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: 9007199254740991, type: [{ code: "ElementDefinitionType" }] }, "defaultValue[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, meaningWhenMissing: { type: [{ code: "markdown" }] }, orderMeaning: { type: [{ code: "string" }] }, "fixed[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, "pattern[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, example: { max: 9007199254740991, type: [{ code: "ElementDefinitionExample" }] }, "minValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, "maxValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, maxLength: { type: [{ code: "integer" }] }, condition: { max: 9007199254740991, type: [{ code: "id" }] }, constraint: { max: 9007199254740991, type: [{ code: "ElementDefinitionConstraint" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "ElementDefinitionBinding" }] }, mapping: { max: 9007199254740991, type: [{ code: "ElementDefinitionMapping" }] } } }, ElementDefinitionSlicingDiscriminator: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, path: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionSlicing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, discriminator: { max: 9007199254740991, type: [{ code: "ElementDefinitionSlicingDiscriminator" }] }, description: { type: [{ code: "string" }] }, ordered: { type: [{ code: "boolean" }] }, rules: { min: 1, type: [{ code: "code" }] } } }, ElementDefinitionBase: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, min: { min: 1, type: [{ code: "unsignedInt" }] }, max: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionType: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, targetProfile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, aggregation: { max: 9007199254740991, type: [{ code: "code" }] }, versioning: { type: [{ code: "code" }] } } }, ElementDefinitionExample: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, label: { min: 1, type: [{ code: "string" }] }, "value[x]": { min: 1, type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, ElementDefinitionConstraint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, key: { min: 1, type: [{ code: "id" }] }, requirements: { type: [{ code: "string" }] }, severity: { min: 1, type: [{ code: "code" }] }, human: { min: 1, type: [{ code: "string" }] }, expression: { type: [{ code: "string" }] }, xpath: { type: [{ code: "string" }] }, source: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, ElementDefinitionBinding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, strength: { min: 1, type: [{ code: "code" }] }, description: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] } } }, ElementDefinitionMapping: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identity: { min: 1, type: [{ code: "id" }] }, language: { type: [{ code: "code" }] }, map: { min: 1, type: [{ code: "string" }] }, comment: { type: [{ code: "string" }] } } }, Expression: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, description: { type: [{ code: "string" }] }, name: { type: [{ code: "id" }] }, language: { min: 1, type: [{ code: "code" }] }, expression: { type: [{ code: "string" }] }, reference: { type: [{ code: "uri" }] } } }, Extension: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "uri" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: 9007199254740991, type: [{ code: "string" }] }, prefix: { max: 9007199254740991, type: [{ code: "string" }] }, suffix: { max: 9007199254740991, type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "CodeableConcept" }] }, system: { type: [{ code: "uri" }] }, value: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] }, assigner: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MarketingStatus: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, country: { min: 1, type: [{ code: "CodeableConcept" }] }, jurisdiction: { type: [{ code: "CodeableConcept" }] }, status: { min: 1, type: [{ code: "CodeableConcept" }] }, dateRange: { min: 1, type: [{ code: "Period" }] }, restoreDate: { type: [{ code: "dateTime" }] } } }, Meta: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: 9007199254740991, type: [{ code: "Coding" }] }, tag: { max: 9007199254740991, type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, onBehalfOf: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, accounts: { max: 9007199254740991, type: [{ code: "Reference" }] }, compartment: { max: 9007199254740991, type: [{ code: "Reference" }] } } }, Money: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "code" }] }, use: { min: 1, type: [{ code: "code" }] }, min: { type: [{ code: "integer" }] }, max: { type: [{ code: "string" }] }, documentation: { type: [{ code: "string" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, Period: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, height: { type: [{ code: "Quantity" }] }, width: { type: [{ code: "Quantity" }] }, depth: { type: [{ code: "Quantity" }] }, weight: { type: [{ code: "Quantity" }] }, nominalVolume: { type: [{ code: "Quantity" }] }, externalDiameter: { type: [{ code: "Quantity" }] }, shape: { type: [{ code: "string" }] }, color: { max: 9007199254740991, type: [{ code: "string" }] }, imprint: { max: 9007199254740991, type: [{ code: "string" }] }, image: { max: 9007199254740991, type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, Quantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Range: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, low: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, high: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Ratio: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, label: { type: [{ code: "string" }] }, display: { type: [{ code: "string" }] }, citation: { type: [{ code: "markdown" }] }, url: { type: [{ code: "url" }] }, document: { type: [{ code: "Attachment" }] }, resource: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Resource"] }] } } }, SampledData: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, origin: { min: 1, type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, period: { min: 1, type: [{ code: "decimal" }] }, factor: { type: [{ code: "decimal" }] }, lowerLimit: { type: [{ code: "decimal" }] }, upperLimit: { type: [{ code: "decimal" }] }, dimensions: { min: 1, type: [{ code: "positiveInt" }] }, data: { type: [{ code: "string" }] } } }, Signature: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, max: 9007199254740991, type: [{ code: "Coding" }] }, when: { min: 1, type: [{ code: "instant" }] }, who: { min: 1, type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, onBehalfOf: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, targetFormat: { type: [{ code: "code" }] }, sigFormat: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] } } }, SubstanceAmount: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "SubstanceAmountReferenceRange" }] } } }, SubstanceAmountReferenceRange: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, lowLimit: { type: [{ code: "Quantity" }] }, highLimit: { type: [{ code: "Quantity" }] } } }, Timing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, event: { max: 9007199254740991, type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "TimingRepeat" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TimingRepeat: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "bounds[x]": { type: [{ code: "Duration" }, { code: "Range" }, { code: "Period" }] }, count: { type: [{ code: "positiveInt" }] }, countMax: { type: [{ code: "positiveInt" }] }, duration: { type: [{ code: "decimal" }] }, durationMax: { type: [{ code: "decimal" }] }, durationUnit: { type: [{ code: "code" }] }, frequency: { type: [{ code: "positiveInt" }] }, frequencyMax: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "decimal" }] }, periodMax: { type: [{ code: "decimal" }] }, periodUnit: { type: [{ code: "code" }] }, dayOfWeek: { max: 9007199254740991, type: [{ code: "code" }] }, timeOfDay: { max: 9007199254740991, type: [{ code: "time" }] }, when: { max: 9007199254740991, type: [{ code: "code" }] }, offset: { type: [{ code: "unsignedInt" }] } } }, TriggerDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { type: [{ code: "string" }] }, "timing[x]": { type: [{ code: "Timing" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Schedule"] }, { code: "date" }, { code: "dateTime" }] }, data: { max: 9007199254740991, type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "Coding" }] }, "value[x]": { min: 1, type: [{ code: "CodeableConcept" }, { code: "Quantity" }, { code: "Range" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/PlanDefinition", "http://hl7.org/fhir/StructureDefinition/ResearchStudy", "http://hl7.org/fhir/StructureDefinition/InsurancePlan", "http://hl7.org/fhir/StructureDefinition/HealthcareService", "http://hl7.org/fhir/StructureDefinition/Group", "http://hl7.org/fhir/StructureDefinition/Location", "http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MoneyQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, SimpleQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { max: 0, type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, IdentityProvider: { elements: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, tokenAuthMethod: { type: [{ code: "code" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, usePkce: { type: [{ code: "boolean" }] }, useSubject: { type: [{ code: "boolean" }] } } } };
40561
+ function cr(r7) {
40562
+ return new sr(r7).parse();
40563
40563
  }
40564
- var le = mn(hn);
40565
- var cr = /* @__PURE__ */ Object.create(null);
40566
- var yn = /* @__PURE__ */ Object.create(null);
40567
- var io = { "http://hl7.org/fhir/StructureDefinition/MoneyQuantity": "MoneyQuantity", "http://hl7.org/fhir/StructureDefinition/SimpleQuantity": "SimpleQuantity", "http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ViewDefinition": "ViewDefinition" };
40568
- function Tn(r7) {
40564
+ var le = hn(yn);
40565
+ var ur = /* @__PURE__ */ Object.create(null);
40566
+ var gn = /* @__PURE__ */ Object.create(null);
40567
+ var oo = { "http://hl7.org/fhir/StructureDefinition/MoneyQuantity": "MoneyQuantity", "http://hl7.org/fhir/StructureDefinition/SimpleQuantity": "SimpleQuantity", "http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ViewDefinition": "ViewDefinition" };
40568
+ function Sn(r7) {
40569
40569
  let e;
40570
- return e = yn[r7], e || (e = yn[r7] = /* @__PURE__ */ Object.create(null)), e;
40570
+ return e = gn[r7], e || (e = gn[r7] = /* @__PURE__ */ Object.create(null)), e;
40571
40571
  }
40572
- function ur(r7) {
40572
+ function lr(r7) {
40573
40573
  let t = (Array.isArray(r7) ? r7 : r7.entry?.map((n) => n.resource) ?? []).filter((n) => n?.resourceType === "StructureDefinition");
40574
- Pn(t);
40575
- for (let n of t) lr(n);
40574
+ wn(t);
40575
+ for (let n of t) pr(n);
40576
40576
  }
40577
- function lr(r7) {
40577
+ function pr(r7) {
40578
40578
  if (!r7?.name) throw new Error("Failed loading StructureDefinition from bundle");
40579
40579
  if (r7.resourceType !== "StructureDefinition") return;
40580
- let e = ar(r7), t = io[r7.url], n, i;
40581
- t ? (n = le, i = t) : r7.url === `http://hl7.org/fhir/StructureDefinition/${r7.type}` || r7.url === `https://medplum.com/fhir/StructureDefinition/${r7.type}` || r7.type?.startsWith("http://") || r7.type?.startsWith("https://") ? (n = le, i = r7.type) : (n = Tn(r7.url), i = r7.type), n[i] = e;
40580
+ let e = cr(r7), t = oo[r7.url], n, i;
40581
+ t ? (n = le, i = t) : r7.url === `http://hl7.org/fhir/StructureDefinition/${r7.type}` || r7.url === `https://medplum.com/fhir/StructureDefinition/${r7.type}` || r7.type?.startsWith("http://") || r7.type?.startsWith("https://") ? (n = le, i = r7.type) : (n = Sn(r7.url), i = r7.type), n[i] = e;
40582
40582
  for (let o of e.innerTypes) o.parentType = e, n[o.name] = o;
40583
- cr[r7.url] = e;
40583
+ ur[r7.url] = e;
40584
40584
  }
40585
- function En(r7) {
40585
+ function bn(r7) {
40586
40586
  return !!le[r7];
40587
40587
  }
40588
40588
  function Le(r7, e) {
40589
40589
  if (e) {
40590
- let t = Tn(e)[r7];
40590
+ let t = Sn(e)[r7];
40591
40591
  if (t) return t;
40592
40592
  }
40593
40593
  return le[r7];
40594
40594
  }
40595
- function Rn(r7) {
40596
- return !!cr[r7];
40595
+ function Cn(r7) {
40596
+ return !!ur[r7];
40597
40597
  }
40598
- var or = class {
40598
+ var sr = class {
40599
40599
  constructor(e) {
40600
40600
  if (!e.snapshot?.element || e.snapshot.element.length === 0) throw new Error(`No snapshot defined for StructureDefinition '${e.name}'`);
40601
- this.root = e.snapshot.element[0], this.elements = e.snapshot.element.slice(1), this.elementIndex = /* @__PURE__ */ Object.create(null), this.index = 0, this.resourceSchema = { name: e.name, path: this.root.path, title: e.title, type: e.type, url: e.url, version: e.version, kind: e.kind, description: co(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
40601
+ this.root = e.snapshot.element[0], this.elements = e.snapshot.element.slice(1), this.elementIndex = /* @__PURE__ */ Object.create(null), this.index = 0, this.resourceSchema = { name: e.name, path: this.root.path, title: e.title, type: e.type, url: e.url, version: e.version, kind: e.kind, description: uo(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
40602
40602
  }
40603
40603
  parse() {
40604
40604
  let e = this.next();
@@ -40606,7 +40606,7 @@ var or = class {
40606
40606
  if (e.sliceName) this.parseSliceStart(e);
40607
40607
  else if (e.id?.includes(":")) {
40608
40608
  if (this.slicingContext?.current) {
40609
- let t = ir(e, this.slicingContext.path);
40609
+ let t = or(e, this.slicingContext.path);
40610
40610
  this.slicingContext.current.elements[t] = this.parseElementDefinition(e);
40611
40611
  }
40612
40612
  } else {
@@ -40615,13 +40615,13 @@ var or = class {
40615
40615
  let n = this.backboneContext;
40616
40616
  for (; n; ) {
40617
40617
  if (e.path?.startsWith(n.path + ".")) {
40618
- n.type.elements[ir(e, n.path)] = t;
40618
+ n.type.elements[or(e, n.path)] = t;
40619
40619
  break;
40620
40620
  }
40621
40621
  n = n.parent;
40622
40622
  }
40623
40623
  if (!n) {
40624
- let i = ir(e, this.root.path);
40624
+ let i = or(e, this.root.path);
40625
40625
  e.isSummary && this.resourceSchema.summaryProperties?.add(i.replace("[x]", "")), t.min > 0 && this.resourceSchema.mandatoryProperties?.add(i.replace("[x]", "")), this.resourceSchema.elements[i] = t;
40626
40626
  }
40627
40627
  this.checkFieldExit(e);
@@ -40635,11 +40635,11 @@ var or = class {
40635
40635
  }
40636
40636
  enterInnerType(e) {
40637
40637
  for (; this.backboneContext && !Pe(this.backboneContext?.path, e.path); ) this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
40638
- let t = sr(e);
40638
+ let t = ar(e);
40639
40639
  this.backboneContext = { type: { name: t, type: t, path: e.path, title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path, parent: Pe(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
40640
40640
  }
40641
40641
  enterSlice(e, t) {
40642
- ao(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
40642
+ co(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
40643
40643
  if (n.type !== "value" && n.type !== "pattern" && n.type !== "type") throw new Error(`Unsupported slicing discriminator type: ${n.type}`);
40644
40644
  return { path: n.path, type: n.type };
40645
40645
  }), slices: [], ordered: e.slicing?.ordered ?? false, rule: e.slicing?.rules }, this.slicingContext = { field: t.slicing, path: e.path ?? "" });
@@ -40675,34 +40675,34 @@ var or = class {
40675
40675
  parseElementDefinitionType(e) {
40676
40676
  return (e.type ?? []).map((t) => {
40677
40677
  let n;
40678
- return (t.code === "BackboneElement" || t.code === "Element") && (n = sr(e)), n || (n = ee(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
40678
+ return (t.code === "BackboneElement" || t.code === "Element") && (n = ar(e)), n || (n = ee(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
40679
40679
  });
40680
40680
  }
40681
40681
  parseElementDefinition(e) {
40682
- let t = xn(e.max), n = e.base?.max ? xn(e.base.max) : t, i = { type: "ElementDefinition", value: e };
40683
- return { description: e.definition || "", path: e.path || e.base?.path || "", min: e.min ?? 0, max: t, isArray: n > 1, constraints: (e.constraint ?? []).map((o) => ({ key: o.key ?? "", severity: o.severity ?? "error", expression: o.expression ?? "", description: o.human ?? "" })), type: this.parseElementDefinitionType(e), fixed: vn(P(i, "fixed[x]")), pattern: vn(P(i, "pattern[x]")), binding: e.binding };
40682
+ let t = vn(e.max), n = e.base?.max ? vn(e.base.max) : t, i = { type: "ElementDefinition", value: e };
40683
+ return { description: e.definition || "", path: e.path || e.base?.path || "", min: e.min ?? 0, max: t, isArray: n > 1, constraints: (e.constraint ?? []).map((o) => ({ key: o.key ?? "", severity: o.severity ?? "error", expression: o.expression ?? "", description: o.human ?? "" })), type: this.parseElementDefinitionType(e), fixed: Tn(P(i, "fixed[x]")), pattern: Tn(P(i, "pattern[x]")), binding: e.binding };
40684
40684
  }
40685
40685
  };
40686
- function xn(r7) {
40686
+ function vn(r7) {
40687
40687
  return r7 === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(r7, 10);
40688
40688
  }
40689
- function ir(r7, e = "") {
40690
- return so(r7.path, e);
40689
+ function or(r7, e = "") {
40690
+ return ao(r7.path, e);
40691
40691
  }
40692
- function so(r7, e) {
40692
+ function ao(r7, e) {
40693
40693
  return r7 ? e && r7.startsWith(e) ? r7.substring(e.length + 1) : r7 : "";
40694
40694
  }
40695
40695
  function Pe(r7, e) {
40696
40696
  return !r7 || !e ? false : e.startsWith(r7 + ".") || e === r7;
40697
40697
  }
40698
- function vn(r7) {
40698
+ function Tn(r7) {
40699
40699
  return Array.isArray(r7) && r7.length > 0 ? r7[0] : S(r7) ? void 0 : r7;
40700
40700
  }
40701
- function ao(r7) {
40701
+ function co(r7) {
40702
40702
  let e = r7.slicing?.discriminator;
40703
40703
  return !!(r7.type?.some((t) => t.code === "Extension") && e?.length === 1 && e[0].type === "value" && e[0].path === "url");
40704
40704
  }
40705
- function co(r7) {
40705
+ function uo(r7) {
40706
40706
  let e = r7.description;
40707
40707
  return e?.startsWith(`Base StructureDefinition for ${r7.name} Type: `) && (e = e.substring(`Base StructureDefinition for ${r7.name} Type: `.length)), e;
40708
40708
  }
@@ -40711,7 +40711,7 @@ function f(r7) {
40711
40711
  return [{ type: p.boolean, value: r7 }];
40712
40712
  }
40713
40713
  function g(r7) {
40714
- return r7 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r7) ? { type: p.integer, value: r7 } : typeof r7 == "number" ? { type: p.decimal, value: r7 } : typeof r7 == "boolean" ? { type: p.boolean, value: r7 } : typeof r7 == "string" ? { type: p.string, value: r7 } : V(r7) ? { type: p.Quantity, value: r7 } : k(r7) ? { type: r7.resourceType, value: r7 } : Sr(r7) ? { type: p.CodeableConcept, value: r7 } : Tr(r7) ? { type: p.Coding, value: r7 } : { type: p.BackboneElement, value: r7 };
40714
+ return r7 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r7) ? { type: p.integer, value: r7 } : typeof r7 == "number" ? { type: p.decimal, value: r7 } : typeof r7 == "boolean" ? { type: p.boolean, value: r7 } : typeof r7 == "string" ? { type: p.string, value: r7 } : V(r7) ? { type: p.Quantity, value: r7 } : k(r7) ? { type: r7.resourceType, value: r7 } : Er(r7) ? { type: p.CodeableConcept, value: r7 } : Sr(r7) ? { type: p.Coding, value: r7 } : { type: p.BackboneElement, value: r7 };
40715
40715
  }
40716
40716
  function N(r7) {
40717
40717
  return r7.length === 0 ? false : !!r7[0].value;
@@ -40725,9 +40725,9 @@ function $(r7, e) {
40725
40725
  function P(r7, e, t) {
40726
40726
  if (!r7.value) return;
40727
40727
  let n = at(r7.type, e, t?.profileUrl);
40728
- return n ? To(r7, e, n) : So(r7, e);
40728
+ return n ? So(r7, e, n) : Eo(r7, e);
40729
40729
  }
40730
- function To(r7, e, t) {
40730
+ function So(r7, e, t) {
40731
40731
  let n = r7.value, i = t.type;
40732
40732
  if (!i || i.length === 0) return;
40733
40733
  let o, s = "undefined", a2, c = t.path.lastIndexOf("."), u2 = t.path.substring(c + 1);
@@ -40740,14 +40740,14 @@ function To(r7, e, t) {
40740
40740
  }
40741
40741
  if (a2) if (Array.isArray(o)) {
40742
40742
  o = o.slice();
40743
- for (let l2 = 0; l2 < Math.max(o.length, a2.length); l2++) o[l2] = Vn(o[l2], a2[l2]);
40744
- } else o = Vn(o, a2);
40745
- if (!S(o)) return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o) ? o.map((l2) => An(l2, s)) : An(o, s);
40743
+ for (let l2 = 0; l2 < Math.max(o.length, a2.length); l2++) o[l2] = Dn(o[l2], a2[l2]);
40744
+ } else o = Dn(o, a2);
40745
+ if (!S(o)) return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o) ? o.map((l2) => On(l2, s)) : On(o, s);
40746
40746
  }
40747
- function An(r7, e) {
40747
+ function On(r7, e) {
40748
40748
  return e === "Resource" && k(r7) && (e = r7.resourceType), { type: e, value: r7 };
40749
40749
  }
40750
- function So(r7, e) {
40750
+ function Eo(r7, e) {
40751
40751
  let t = r7.value;
40752
40752
  if (!t || typeof t != "object") return;
40753
40753
  let n;
@@ -40774,7 +40774,7 @@ function ot(r7) {
40774
40774
  let e = [];
40775
40775
  for (let t of r7) {
40776
40776
  let n = false;
40777
- for (let i of e) if (N(gr(t, i))) {
40777
+ for (let i of e) if (N(xr(t, i))) {
40778
40778
  n = true;
40779
40779
  break;
40780
40780
  }
@@ -40782,27 +40782,27 @@ function ot(r7) {
40782
40782
  }
40783
40783
  return e;
40784
40784
  }
40785
- function Dn(r7) {
40785
+ function Mn(r7) {
40786
40786
  return f(!N(r7));
40787
40787
  }
40788
- function Mn(r7, e) {
40789
- return r7.length === 0 || e.length === 0 ? [] : r7.length !== e.length ? f(false) : f(r7.every((t, n) => N(gr(t, e[n]))));
40790
- }
40791
40788
  function _n(r7, e) {
40792
- return r7.length === 0 || e.length === 0 ? [] : r7.length !== e.length ? f(true) : f(r7.some((t, n) => !N(gr(t, e[n]))));
40789
+ return r7.length === 0 || e.length === 0 ? [] : r7.length !== e.length ? f(false) : f(r7.every((t, n) => N(xr(t, e[n]))));
40793
40790
  }
40794
- function gr(r7, e) {
40795
- let t = r7.value?.valueOf(), n = e.value?.valueOf();
40796
- return typeof t == "number" && typeof n == "number" ? f(Math.abs(t - n) < 1e-8) : V(t) && V(n) ? f(Fn(t, n)) : f(typeof t == "object" && typeof n == "object" ? vr(r7, e) : t === n);
40791
+ function Nn(r7, e) {
40792
+ return r7.length === 0 || e.length === 0 ? [] : r7.length !== e.length ? f(true) : f(r7.some((t, n) => !N(xr(t, e[n]))));
40797
40793
  }
40798
40794
  function xr(r7, e) {
40799
- return r7.length === 0 && e.length === 0 ? f(true) : r7.length !== e.length ? f(false) : (r7.sort(On), e.sort(On), f(r7.every((t, n) => N(Eo(t, e[n])))));
40795
+ let t = r7.value?.valueOf(), n = e.value?.valueOf();
40796
+ return typeof t == "number" && typeof n == "number" ? f(Math.abs(t - n) < 1e-8) : V(t) && V(n) ? f(Un(t, n)) : f(typeof t == "object" && typeof n == "object" ? Tr(r7, e) : t === n);
40800
40797
  }
40801
- function Eo(r7, e) {
40798
+ function vr(r7, e) {
40799
+ return r7.length === 0 && e.length === 0 ? f(true) : r7.length !== e.length ? f(false) : (r7.sort(In), e.sort(In), f(r7.every((t, n) => N(bo(t, e[n])))));
40800
+ }
40801
+ function bo(r7, e) {
40802
40802
  let { type: t, value: n } = r7, { type: i, value: o } = e, s = n?.valueOf(), a2 = o?.valueOf();
40803
- return typeof s == "number" && typeof a2 == "number" ? f(Math.abs(s - a2) < 0.01) : V(s) && V(a2) ? f(Fn(s, a2)) : f(t === "Coding" && i === "Coding" ? typeof s != "object" || typeof a2 != "object" ? false : s.code === a2.code && s.system === a2.system : typeof s == "object" && typeof a2 == "object" ? vr({ ...s, id: void 0 }, { ...a2, id: void 0 }) : typeof s == "string" && typeof a2 == "string" ? s.toLowerCase() === a2.toLowerCase() : s === a2);
40803
+ return typeof s == "number" && typeof a2 == "number" ? f(Math.abs(s - a2) < 0.01) : V(s) && V(a2) ? f(Un(s, a2)) : f(t === "Coding" && i === "Coding" ? typeof s != "object" || typeof a2 != "object" ? false : s.code === a2.code && s.system === a2.system : typeof s == "object" && typeof a2 == "object" ? Tr({ ...s, id: void 0 }, { ...a2, id: void 0 }) : typeof s == "string" && typeof a2 == "string" ? s.toLowerCase() === a2.toLowerCase() : s === a2);
40804
40804
  }
40805
- function On(r7, e) {
40805
+ function In(r7, e) {
40806
40806
  let t = r7.value?.valueOf(), n = e.value?.valueOf();
40807
40807
  return typeof t == "number" && typeof n == "number" ? t - n : typeof t == "string" && typeof n == "string" ? t.localeCompare(n) : 0;
40808
40808
  }
@@ -40816,60 +40816,60 @@ function st(r7, e) {
40816
40816
  case "Integer":
40817
40817
  return typeof t == "number";
40818
40818
  case "Date":
40819
- return Nn(t);
40819
+ return Ln(t);
40820
40820
  case "DateTime":
40821
40821
  return Ae(t);
40822
40822
  case "Time":
40823
40823
  return typeof t == "string" && !!/^T\d/.exec(t);
40824
40824
  case "Period":
40825
- return Ln(t);
40825
+ return Fn(t);
40826
40826
  case "Quantity":
40827
40827
  return V(t);
40828
40828
  default:
40829
40829
  return r7.type === e || typeof t == "object" && t?.resourceType === e;
40830
40830
  }
40831
40831
  }
40832
- function Nn(r7) {
40832
+ function Ln(r7) {
40833
40833
  return typeof r7 == "string" && !!it.date.exec(r7);
40834
40834
  }
40835
40835
  function Ae(r7) {
40836
40836
  return typeof r7 == "string" && !!it.dateTime.exec(r7);
40837
40837
  }
40838
- function Ln(r7) {
40838
+ function Fn(r7) {
40839
40839
  return !!(r7 && typeof r7 == "object" && ("start" in r7 && Ae(r7.start) || "end" in r7 && Ae(r7.end)));
40840
40840
  }
40841
40841
  function V(r7) {
40842
40842
  return !!(r7 && typeof r7 == "object" && "value" in r7 && typeof r7.value == "number");
40843
40843
  }
40844
- function Fn(r7, e) {
40844
+ function Un(r7, e) {
40845
40845
  return Math.abs(r7.value - e.value) < 0.01 && (r7.unit === e.unit || r7.code === e.code || r7.unit === e.code || r7.code === e.unit);
40846
40846
  }
40847
- function vr(r7, e) {
40847
+ function Tr(r7, e) {
40848
40848
  let t = Object.keys(r7), n = Object.keys(e);
40849
40849
  if (t.length !== n.length) return false;
40850
40850
  for (let i of t) {
40851
40851
  let o = r7[i], s = e[i];
40852
- if (kn(o) && kn(s)) {
40853
- if (!vr(o, s)) return false;
40852
+ if (Vn(o) && Vn(s)) {
40853
+ if (!Tr(o, s)) return false;
40854
40854
  } else if (o !== s) return false;
40855
40855
  }
40856
40856
  return true;
40857
40857
  }
40858
- function kn(r7) {
40858
+ function Vn(r7) {
40859
40859
  return r7 !== null && typeof r7 == "object";
40860
40860
  }
40861
- function Vn(r7, e) {
40861
+ function Dn(r7, e) {
40862
40862
  if (e) {
40863
40863
  if (typeof e != "object") throw new Error("Primitive extension must be an object");
40864
- return bo(r7 ?? {}, e);
40864
+ return Ro(r7 ?? {}, e);
40865
40865
  }
40866
40866
  return r7;
40867
40867
  }
40868
- function bo(r7, e) {
40868
+ function Ro(r7, e) {
40869
40869
  return delete e.__proto__, delete e.constructor, Object.assign(r7, e);
40870
40870
  }
40871
40871
  function re(r7) {
40872
- let e = de(r7), t = Co(r7);
40872
+ let e = de(r7), t = Po(r7);
40873
40873
  return t === e ? { reference: e } : { reference: e, display: t };
40874
40874
  }
40875
40875
  function de(r7) {
@@ -40878,16 +40878,16 @@ function de(r7) {
40878
40878
  function fe(r7) {
40879
40879
  if (r7) return pe(r7) ? r7.reference.split("/")[1] : r7.id;
40880
40880
  }
40881
- function Ro(r7) {
40881
+ function Co(r7) {
40882
40882
  return r7.resourceType === "Patient" || r7.resourceType === "Practitioner" || r7.resourceType === "RelatedPerson";
40883
40883
  }
40884
- function Co(r7) {
40885
- if (Ro(r7)) {
40886
- let e = Po(r7);
40884
+ function Po(r7) {
40885
+ if (Co(r7)) {
40886
+ let e = wo(r7);
40887
40887
  if (e) return e;
40888
40888
  }
40889
40889
  if (r7.resourceType === "Device") {
40890
- let e = wo(r7);
40890
+ let e = Ao(r7);
40891
40891
  if (e) return e;
40892
40892
  }
40893
40893
  if (r7.resourceType === "MedicationRequest" && r7.medicationCodeableConcept) return Be(r7.medicationCodeableConcept);
@@ -40896,16 +40896,16 @@ function Co(r7) {
40896
40896
  if ("name" in r7 && r7.name && typeof r7.name == "string") return r7.name;
40897
40897
  if ("code" in r7 && r7.code) {
40898
40898
  let e = r7.code;
40899
- if (Array.isArray(e) && (e = e[0]), Sr(e)) return Be(e);
40900
- if (No(e)) return e.text;
40899
+ if (Array.isArray(e) && (e = e[0]), Er(e)) return Be(e);
40900
+ if (Lo(e)) return e.text;
40901
40901
  }
40902
40902
  return de(r7);
40903
40903
  }
40904
- function Po(r7) {
40904
+ function wo(r7) {
40905
40905
  let e = r7.name;
40906
40906
  if (e && e.length > 0) return qe(e[0]);
40907
40907
  }
40908
- function wo(r7) {
40908
+ function Ao(r7) {
40909
40909
  let e = r7.deviceName;
40910
40910
  if (e && e.length > 0) return e[0].name;
40911
40911
  }
@@ -40927,12 +40927,12 @@ function ee(r7, ...e) {
40927
40927
  return t;
40928
40928
  }
40929
40929
  function ut(r7, e) {
40930
- return JSON.stringify(r7, Oo, e ? 2 : void 0) ?? "";
40930
+ return JSON.stringify(r7, Io, e ? 2 : void 0) ?? "";
40931
40931
  }
40932
- function Oo(r7, e) {
40933
- return !Io(r7) && S(e) ? void 0 : e;
40932
+ function Io(r7, e) {
40933
+ return !ko(r7) && S(e) ? void 0 : e;
40934
40934
  }
40935
- function Io(r7) {
40935
+ function ko(r7) {
40936
40936
  return !!/\d+$/.exec(r7);
40937
40937
  }
40938
40938
  function S(r7) {
@@ -40946,14 +40946,14 @@ function z(r7) {
40946
40946
  return e === "string" && r7 !== "" || e === "object" && ("length" in r7 && r7.length > 0 || Object.keys(r7).length > 0);
40947
40947
  }
40948
40948
  function te(r7, e, t) {
40949
- return r7 === e || S(r7) && S(e) ? true : S(r7) || S(e) ? false : Array.isArray(r7) && Array.isArray(e) ? ko(r7, e) : Array.isArray(r7) || Array.isArray(e) ? false : R(r7) && R(e) ? Vo(r7, e, t) : (R(r7) || R(e), false);
40949
+ return r7 === e || S(r7) && S(e) ? true : S(r7) || S(e) ? false : Array.isArray(r7) && Array.isArray(e) ? Vo(r7, e) : Array.isArray(r7) || Array.isArray(e) ? false : R(r7) && R(e) ? Do(r7, e, t) : (R(r7) || R(e), false);
40950
40950
  }
40951
- function ko(r7, e) {
40951
+ function Vo(r7, e) {
40952
40952
  if (r7.length !== e.length) return false;
40953
40953
  for (let t = 0; t < r7.length; t++) if (!te(r7[t], e[t])) return false;
40954
40954
  return true;
40955
40955
  }
40956
- function Vo(r7, e, t) {
40956
+ function Do(r7, e, t) {
40957
40957
  let n = /* @__PURE__ */ new Set();
40958
40958
  Object.keys(r7).forEach((i) => n.add(i)), Object.keys(e).forEach((i) => n.add(i)), t === "meta" && (n.delete("versionId"), n.delete("lastUpdated"), n.delete("author"));
40959
40959
  for (let i of n) {
@@ -40965,63 +40965,63 @@ function Vo(r7, e, t) {
40965
40965
  function R(r7) {
40966
40966
  return r7 !== null && typeof r7 == "object";
40967
40967
  }
40968
- function jn(r7) {
40969
- return r7.every(_o);
40968
+ function Wn(r7) {
40969
+ return r7.every(No);
40970
40970
  }
40971
- function _o(r7) {
40971
+ function No(r7) {
40972
40972
  return typeof r7 == "string";
40973
40973
  }
40974
- function Tr(r7) {
40974
+ function Sr(r7) {
40975
40975
  return R(r7) && "code" in r7 && typeof r7.code == "string";
40976
40976
  }
40977
- function Sr(r7) {
40978
- return R(r7) && "coding" in r7 && Array.isArray(r7.coding) && r7.coding.every(Tr);
40977
+ function Er(r7) {
40978
+ return R(r7) && "coding" in r7 && Array.isArray(r7.coding) && r7.coding.every(Sr);
40979
40979
  }
40980
- function No(r7) {
40980
+ function Lo(r7) {
40981
40981
  return R(r7) && "text" in r7 && typeof r7.text == "string";
40982
40982
  }
40983
- var Wn = [];
40984
- for (let r7 = 0; r7 < 256; r7++) Wn.push(r7.toString(16).padStart(2, "0"));
40985
- function $n(r7) {
40986
- let e = Hn(r7), t = new Uint8Array(e), n = new Array(t.length);
40987
- for (let i = 0; i < t.length; i++) n[i] = Wn[t[i]];
40983
+ var $n = [];
40984
+ for (let r7 = 0; r7 < 256; r7++) $n.push(r7.toString(16).padStart(2, "0"));
40985
+ function Gn(r7) {
40986
+ let e = Qn(r7), t = new Uint8Array(e), n = new Array(t.length);
40987
+ for (let i = 0; i < t.length; i++) n[i] = $n[t[i]];
40988
40988
  return n.join("");
40989
40989
  }
40990
- function Gn(r7) {
40991
- let e = Hn(r7), t = new Uint8Array(e), n = new Array(t.length);
40990
+ function Hn(r7) {
40991
+ let e = Qn(r7), t = new Uint8Array(e), n = new Array(t.length);
40992
40992
  for (let i = 0; i < t.length; i++) n[i] = String.fromCharCode(t[i]);
40993
40993
  return window.btoa(n.join(""));
40994
40994
  }
40995
- function Hn(r7) {
40995
+ function Qn(r7) {
40996
40996
  return ArrayBuffer.isView(r7) ? r7.buffer : r7;
40997
40997
  }
40998
40998
  function I(r7) {
40999
40999
  return r7 ? r7.charAt(0).toUpperCase() + r7.substring(1) : "";
41000
41000
  }
41001
- var Rr = (r7) => new Promise((e) => {
41001
+ var Cr = (r7) => new Promise((e) => {
41002
41002
  setTimeout(e, r7);
41003
41003
  });
41004
41004
  function lt(r7) {
41005
41005
  return r7.sort((e, t) => e.localeCompare(t));
41006
41006
  }
41007
- function Pr(r7) {
41007
+ function wr(r7) {
41008
41008
  return r7.endsWith("/") ? r7 : r7 + "/";
41009
41009
  }
41010
- function jo(r7) {
41010
+ function Wo(r7) {
41011
41011
  return r7.startsWith("/") ? r7.slice(1) : r7;
41012
41012
  }
41013
41013
  function q(r7, e) {
41014
- return new URL(jo(e), Pr(r7.toString())).toString();
41014
+ return new URL(Wo(e), wr(r7.toString())).toString();
41015
41015
  }
41016
- function Jn(r7, e) {
41016
+ function Yn(r7, e) {
41017
41017
  return q(r7, e).toString().replace("http://", "ws://").replace("https://", "wss://");
41018
41018
  }
41019
- function Yn(r7) {
41019
+ function Zn(r7) {
41020
41020
  return typeof r7 == "object" && !Array.isArray(r7) && !(r7 instanceof URLSearchParams) && (r7 = Object.fromEntries(Object.entries(r7).filter((e) => e[1] !== void 0))), new URLSearchParams(r7).toString();
41021
41021
  }
41022
- var Wo = /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-_]*[A-Za-z0-9])$/;
41023
- function ll(r7) {
41024
- return Wo.test(r7);
41022
+ var $o = /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-_]*[A-Za-z0-9])$/;
41023
+ function fl(r7) {
41024
+ return $o.test(r7);
41025
41025
  }
41026
41026
  function qe(r7, e) {
41027
41027
  let t = [];
@@ -41034,9 +41034,9 @@ function qe(r7, e) {
41034
41034
  function Be(r7) {
41035
41035
  if (!r7) return "";
41036
41036
  let e = he(r7.text);
41037
- return e || (r7.coding ? r7.coding.map((t) => Zn(t)).join(", ") : "");
41037
+ return e || (r7.coding ? r7.coding.map((t) => Xn(t)).join(", ") : "");
41038
41038
  }
41039
- function Zn(r7, e) {
41039
+ function Xn(r7, e) {
41040
41040
  let t = he(r7?.display);
41041
41041
  if (t) {
41042
41042
  let n = e ? he(r7?.code) : void 0;
@@ -41048,32 +41048,32 @@ function he(r7) {
41048
41048
  return typeof r7 == "string" ? r7 : void 0;
41049
41049
  }
41050
41050
  var p = { 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" };
41051
- function Pn(r7) {
41051
+ function wn(r7) {
41052
41052
  let e = Array.isArray(r7) ? r7 : r7.entry?.map((t) => t.resource) ?? [];
41053
- for (let t of e) t?.resourceType === "StructureDefinition" && t.kind === "resource" && ti(t.type);
41053
+ for (let t of e) t?.resourceType === "StructureDefinition" && t.kind === "resource" && ri(t.type);
41054
41054
  }
41055
- function ti(r7) {
41055
+ function ri(r7) {
41056
41056
  let e = L.types[r7];
41057
41057
  return e || (e = { searchParamsDetails: {} }, L.types[r7] = e), e.searchParams || (e.searchParams = { _id: { base: [r7], code: "_id", type: "token", expression: r7 + ".id" }, _lastUpdated: { base: [r7], code: "_lastUpdated", type: "date", expression: r7 + ".meta.lastUpdated" }, _compartment: { base: [r7], code: "_compartment", type: "reference", expression: r7 + ".meta.compartment" }, _profile: { base: [r7], code: "_profile", type: "uri", expression: r7 + ".meta.profile" }, _security: { base: [r7], code: "_security", type: "token", expression: r7 + ".meta.security" }, _source: { base: [r7], code: "_source", type: "uri", expression: r7 + ".meta.source" }, _tag: { base: [r7], code: "_tag", type: "token", expression: r7 + ".meta.tag" } }), e;
41058
41058
  }
41059
- function Or(r7) {
41059
+ function Ir(r7) {
41060
41060
  for (let e of r7.base ?? []) {
41061
- let t = ti(e);
41061
+ let t = ri(e);
41062
41062
  t.searchParams || (t.searchParams = {}), t.searchParams[r7.code] = r7;
41063
41063
  }
41064
41064
  }
41065
- function sr(r7) {
41065
+ function ar(r7) {
41066
41066
  let e = r7.type?.[0]?.code;
41067
- return e === "BackboneElement" || e === "Element" ? es((r7.base?.path ?? r7.path)?.split(".")) : e;
41067
+ return e === "BackboneElement" || e === "Element" ? ts((r7.base?.path ?? r7.path)?.split(".")) : e;
41068
41068
  }
41069
- function es(r7) {
41069
+ function ts(r7) {
41070
41070
  return r7.length === 1 ? r7[0] : r7.map(I).join("");
41071
41071
  }
41072
41072
  function at(r7, e, t) {
41073
41073
  let n = Le(r7, t);
41074
- if (n) return is(n.elements, e);
41074
+ if (n) return os(n.elements, e);
41075
41075
  }
41076
- function is(r7, e) {
41076
+ function os(r7, e) {
41077
41077
  let t = r7[e] ?? r7[e + "[x]"];
41078
41078
  if (t) return t;
41079
41079
  for (let n = 0; n < e.length; n++) {
@@ -41414,7 +41414,7 @@ var gt = class extends C {
41414
41414
  }
41415
41415
  eval(e, t) {
41416
41416
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
41417
- return Mn(n, i);
41417
+ return _n(n, i);
41418
41418
  }
41419
41419
  };
41420
41420
  var xt = class extends C {
@@ -41423,7 +41423,7 @@ var xt = class extends C {
41423
41423
  }
41424
41424
  eval(e, t) {
41425
41425
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
41426
- return _n(n, i);
41426
+ return Nn(n, i);
41427
41427
  }
41428
41428
  };
41429
41429
  var vt = class extends C {
@@ -41432,7 +41432,7 @@ var vt = class extends C {
41432
41432
  }
41433
41433
  eval(e, t) {
41434
41434
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
41435
- return xr(n, i);
41435
+ return vr(n, i);
41436
41436
  }
41437
41437
  };
41438
41438
  var Tt = class extends C {
@@ -41441,7 +41441,7 @@ var Tt = class extends C {
41441
41441
  }
41442
41442
  eval(e, t) {
41443
41443
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
41444
- return Dn(xr(n, i));
41444
+ return Mn(vr(n, i));
41445
41445
  }
41446
41446
  };
41447
41447
  var xe = class extends C {
@@ -41524,34 +41524,34 @@ var ve = class {
41524
41524
  };
41525
41525
  var We = ["!=", "!~", "<=", ">=", "{}", "->"];
41526
41526
  var y = { FunctionCall: 0, Dot: 1, Indexer: 2, UnaryAdd: 3, UnarySubtract: 3, Multiply: 4, Divide: 4, IntegerDivide: 4, Modulo: 4, Add: 5, Subtract: 5, Ampersand: 5, Is: 6, As: 6, Union: 7, GreaterThan: 8, GreaterThanOrEquals: 8, LessThan: 8, LessThanOrEquals: 8, Equals: 9, Equivalent: 9, NotEquals: 9, NotEquivalent: 9, In: 10, Contains: 10, And: 11, Xor: 12, Or: 12, Implies: 13, Arrow: 100, Semicolon: 200 };
41527
- var as = { parse(r7) {
41527
+ var cs = { parse(r7) {
41528
41528
  let e = r7.consumeAndParse();
41529
41529
  if (!r7.match(")")) throw new Error("Parse error: expected `)` got `" + r7.peek()?.value + "`");
41530
41530
  return e;
41531
41531
  } };
41532
- var cs = { parse(r7, e) {
41532
+ var us = { parse(r7, e) {
41533
41533
  let t = r7.consumeAndParse();
41534
41534
  if (!r7.match("]")) throw new Error("Parse error: expected `]`");
41535
41535
  return new ve(e, t);
41536
41536
  }, precedence: y.Indexer };
41537
- var us = { parse(r7, e) {
41537
+ var ls = { parse(r7, e) {
41538
41538
  if (!(e instanceof j)) throw new Error("Unexpected parentheses");
41539
41539
  let t = [];
41540
41540
  for (; !r7.match(")"); ) t.push(r7.consumeAndParse()), r7.match(",");
41541
41541
  return new Y(e.name, t);
41542
41542
  }, precedence: y.FunctionCall };
41543
- function ls(r7) {
41543
+ function ps(r7) {
41544
41544
  let e = r7.split(" "), t = parseFloat(e[0]), n = e[1];
41545
41545
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
41546
41546
  }
41547
41547
  function $e() {
41548
- return new Ye().registerPrefix("String", { parse: (r7, e) => new U({ type: p.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r7, e) => new U({ type: p.dateTime, value: ke(e.value) }) }).registerPrefix("Quantity", { parse: (r7, e) => new U({ type: p.Quantity, value: ls(e.value) }) }).registerPrefix("Number", { parse: (r7, e) => new U({ type: e.value.includes(".") ? p.decimal : p.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new U({ type: p.boolean, value: true }) }).registerPrefix("false", { parse: () => new U({ type: p.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r7, e) => new j(e.value) }).registerPrefix("{}", { parse: () => new dt() }).registerPrefix("(", as).registerInfix("[", cs).registerInfix("(", us).prefix("+", y.UnaryAdd, (r7, e) => new ft("+", e, (t) => t)).prefix("-", y.UnarySubtract, (r7, e) => new D("-", e, e, (t, n) => -n)).infixLeft(".", y.Dot, (r7, e, t) => new ie(r7, t)).infixLeft("/", y.Divide, (r7, e, t) => new D("/", r7, t, (n, i) => n / i)).infixLeft("*", y.Multiply, (r7, e, t) => new D("*", r7, t, (n, i) => n * i)).infixLeft("+", y.Add, (r7, e, t) => new D("+", r7, t, (n, i) => n + i)).infixLeft("-", y.Subtract, (r7, e, t) => new D("-", r7, t, (n, i) => n - i)).infixLeft("|", y.Union, (r7, e, t) => new Ve(r7, t)).infixLeft("=", y.Equals, (r7, e, t) => new gt(r7, t)).infixLeft("!=", y.NotEquals, (r7, e, t) => new xt(r7, t)).infixLeft("~", y.Equivalent, (r7, e, t) => new vt(r7, t)).infixLeft("!~", y.NotEquivalent, (r7, e, t) => new Tt(r7, t)).infixLeft("<", y.LessThan, (r7, e, t) => new D("<", r7, t, (n, i) => n < i)).infixLeft("<=", y.LessThanOrEquals, (r7, e, t) => new D("<=", r7, t, (n, i) => n <= i)).infixLeft(">", y.GreaterThan, (r7, e, t) => new D(">", r7, t, (n, i) => n > i)).infixLeft(">=", y.GreaterThanOrEquals, (r7, e, t) => new D(">=", r7, t, (n, i) => n >= i)).infixLeft("&", y.Ampersand, (r7, e, t) => new mt(r7, t)).infixLeft("and", y.And, (r7, e, t) => new St(r7, t)).infixLeft("as", y.As, (r7, e, t) => new ge(r7, t)).infixLeft("contains", y.Contains, (r7, e, t) => new ht(r7, t)).infixLeft("div", y.Divide, (r7, e, t) => new D("div", r7, t, (n, i) => n / i | 0)).infixLeft("in", y.In, (r7, e, t) => new yt(r7, t)).infixLeft("is", y.Is, (r7, e, t) => new xe(r7, t)).infixLeft("mod", y.Modulo, (r7, e, t) => new D("mod", r7, t, (n, i) => n % i)).infixLeft("or", y.Or, (r7, e, t) => new Et(r7, t)).infixLeft("xor", y.Xor, (r7, e, t) => new bt(r7, t)).infixLeft("implies", y.Implies, (r7, e, t) => new Rt(r7, t));
41548
+ return new Ye().registerPrefix("String", { parse: (r7, e) => new U({ type: p.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r7, e) => new U({ type: p.dateTime, value: ke(e.value) }) }).registerPrefix("Quantity", { parse: (r7, e) => new U({ type: p.Quantity, value: ps(e.value) }) }).registerPrefix("Number", { parse: (r7, e) => new U({ type: e.value.includes(".") ? p.decimal : p.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new U({ type: p.boolean, value: true }) }).registerPrefix("false", { parse: () => new U({ type: p.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r7, e) => new j(e.value) }).registerPrefix("{}", { parse: () => new dt() }).registerPrefix("(", cs).registerInfix("[", us).registerInfix("(", ls).prefix("+", y.UnaryAdd, (r7, e) => new ft("+", e, (t) => t)).prefix("-", y.UnarySubtract, (r7, e) => new D("-", e, e, (t, n) => -n)).infixLeft(".", y.Dot, (r7, e, t) => new ie(r7, t)).infixLeft("/", y.Divide, (r7, e, t) => new D("/", r7, t, (n, i) => n / i)).infixLeft("*", y.Multiply, (r7, e, t) => new D("*", r7, t, (n, i) => n * i)).infixLeft("+", y.Add, (r7, e, t) => new D("+", r7, t, (n, i) => n + i)).infixLeft("-", y.Subtract, (r7, e, t) => new D("-", r7, t, (n, i) => n - i)).infixLeft("|", y.Union, (r7, e, t) => new Ve(r7, t)).infixLeft("=", y.Equals, (r7, e, t) => new gt(r7, t)).infixLeft("!=", y.NotEquals, (r7, e, t) => new xt(r7, t)).infixLeft("~", y.Equivalent, (r7, e, t) => new vt(r7, t)).infixLeft("!~", y.NotEquivalent, (r7, e, t) => new Tt(r7, t)).infixLeft("<", y.LessThan, (r7, e, t) => new D("<", r7, t, (n, i) => n < i)).infixLeft("<=", y.LessThanOrEquals, (r7, e, t) => new D("<=", r7, t, (n, i) => n <= i)).infixLeft(">", y.GreaterThan, (r7, e, t) => new D(">", r7, t, (n, i) => n > i)).infixLeft(">=", y.GreaterThanOrEquals, (r7, e, t) => new D(">=", r7, t, (n, i) => n >= i)).infixLeft("&", y.Ampersand, (r7, e, t) => new mt(r7, t)).infixLeft("and", y.And, (r7, e, t) => new St(r7, t)).infixLeft("as", y.As, (r7, e, t) => new ge(r7, t)).infixLeft("contains", y.Contains, (r7, e, t) => new ht(r7, t)).infixLeft("div", y.Divide, (r7, e, t) => new D("div", r7, t, (n, i) => n / i | 0)).infixLeft("in", y.In, (r7, e, t) => new yt(r7, t)).infixLeft("is", y.Is, (r7, e, t) => new xe(r7, t)).infixLeft("mod", y.Modulo, (r7, e, t) => new D("mod", r7, t, (n, i) => n % i)).infixLeft("or", y.Or, (r7, e, t) => new Et(r7, t)).infixLeft("xor", y.Xor, (r7, e, t) => new bt(r7, t)).infixLeft("implies", y.Implies, (r7, e, t) => new Rt(r7, t));
41549
41549
  }
41550
- var ps = $e();
41551
- var ii = ((l2) => (l2.BOOLEAN = "BOOLEAN", l2.NUMBER = "NUMBER", l2.QUANTITY = "QUANTITY", l2.TEXT = "TEXT", l2.REFERENCE = "REFERENCE", l2.CANONICAL = "CANONICAL", l2.DATE = "DATE", l2.DATETIME = "DATETIME", l2.PERIOD = "PERIOD", l2.UUID = "UUID", l2))(ii || {});
41552
- var li = ((v) => (v.EQUALS = "eq", v.NOT_EQUALS = "ne", v.GREATER_THAN = "gt", v.LESS_THAN = "lt", v.GREATER_THAN_OR_EQUALS = "ge", v.LESS_THAN_OR_EQUALS = "le", v.STARTS_AFTER = "sa", v.ENDS_BEFORE = "eb", v.APPROXIMATELY = "ap", v.CONTAINS = "contains", v.STARTS_WITH = "sw", v.EXACT = "exact", v.TEXT = "text", v.NOT = "not", v.ABOVE = "above", v.BELOW = "below", v.IN = "in", v.NOT_IN = "not-in", v.OF_TYPE = "of-type", v.MISSING = "missing", v.PRESENT = "present", v.IDENTIFIER = "identifier", v.ITERATE = "iterate", v))(li || {});
41553
- var Bs = ((b2) => (b2.READ = "read", b2.VREAD = "vread", b2.UPDATE = "update", b2.PATCH = "patch", b2.DELETE = "delete", b2.HISTORY = "history", b2.HISTORY_INSTANCE = "history-instance", b2.HISTORY_TYPE = "history-type", b2.HISTORY_SYSTEM = "history-system", b2.CREATE = "create", b2.SEARCH = "search", b2.SEARCH_TYPE = "search-type", b2.SEARCH_SYSTEM = "search-system", b2.SEARCH_COMPARTMENT = "search-compartment", b2.CAPABILITIES = "capabilities", b2.TRANSACTION = "transaction", b2.BATCH = "batch", b2.OPERATION = "operation", b2))(Bs || {});
41554
- function mi(r7) {
41550
+ var ds = $e();
41551
+ var oi = ((l2) => (l2.BOOLEAN = "BOOLEAN", l2.NUMBER = "NUMBER", l2.QUANTITY = "QUANTITY", l2.TEXT = "TEXT", l2.REFERENCE = "REFERENCE", l2.CANONICAL = "CANONICAL", l2.DATE = "DATE", l2.DATETIME = "DATETIME", l2.PERIOD = "PERIOD", l2.UUID = "UUID", l2))(oi || {});
41552
+ var pi = ((v) => (v.EQUALS = "eq", v.NOT_EQUALS = "ne", v.GREATER_THAN = "gt", v.LESS_THAN = "lt", v.GREATER_THAN_OR_EQUALS = "ge", v.LESS_THAN_OR_EQUALS = "le", v.STARTS_AFTER = "sa", v.ENDS_BEFORE = "eb", v.APPROXIMATELY = "ap", v.CONTAINS = "contains", v.STARTS_WITH = "sw", v.EXACT = "exact", v.TEXT = "text", v.NOT = "not", v.ABOVE = "above", v.BELOW = "below", v.IN = "in", v.NOT_IN = "not-in", v.OF_TYPE = "of-type", v.MISSING = "missing", v.PRESENT = "present", v.IDENTIFIER = "identifier", v.ITERATE = "iterate", v))(pi || {});
41553
+ var qs = ((b2) => (b2.READ = "read", b2.VREAD = "vread", b2.UPDATE = "update", b2.PATCH = "patch", b2.DELETE = "delete", b2.HISTORY = "history", b2.HISTORY_INSTANCE = "history-instance", b2.HISTORY_TYPE = "history-type", b2.HISTORY_SYSTEM = "history-system", b2.CREATE = "create", b2.SEARCH = "search", b2.SEARCH_TYPE = "search-type", b2.SEARCH_SYSTEM = "search-system", b2.SEARCH_COMPARTMENT = "search-compartment", b2.CAPABILITIES = "capabilities", b2.TRANSACTION = "transaction", b2.BATCH = "batch", b2.OPERATION = "operation", b2))(qs || {});
41554
+ function hi(r7) {
41555
41555
  if (typeof window < "u") {
41556
41556
  let e = window.atob(r7), t = Uint8Array.from(e, (n) => n.charCodeAt(0));
41557
41557
  return new window.TextDecoder().decode(t);
@@ -41559,7 +41559,7 @@ function mi(r7) {
41559
41559
  if (typeof Buffer < "u") return Buffer.from(r7, "base64").toString("utf-8");
41560
41560
  throw new Error("Unable to decode base64");
41561
41561
  }
41562
- function hi(r7) {
41562
+ function yi(r7) {
41563
41563
  if (typeof window < "u") {
41564
41564
  let e = new window.TextEncoder().encode(r7), t = String.fromCharCode.apply(null, e);
41565
41565
  return window.btoa(t);
@@ -41567,11 +41567,11 @@ function hi(r7) {
41567
41567
  if (typeof Buffer < "u") return Buffer.from(r7, "utf8").toString("base64");
41568
41568
  throw new Error("Unable to encode base64");
41569
41569
  }
41570
- function Nr() {
41570
+ function Lr() {
41571
41571
  let r7 = new Uint32Array(28);
41572
- return crypto.getRandomValues(r7), $n(r7.buffer);
41572
+ return crypto.getRandomValues(r7), Gn(r7.buffer);
41573
41573
  }
41574
- async function yi(r7) {
41574
+ async function gi(r7) {
41575
41575
  return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r7));
41576
41576
  }
41577
41577
  function Te() {
@@ -41605,7 +41605,7 @@ var Ot = class {
41605
41605
  }
41606
41606
  };
41607
41607
  var A = { CSS: "text/css", DICOM: "application/dicom", FAVICON: "image/vnd.microsoft.icon", FHIR_JSON: "application/fhir+json", FORM_URL_ENCODED: "application/x-www-form-urlencoded", HL7_V2: "x-application/hl7-v2+er7", HTML: "text/html", JAVASCRIPT: "text/javascript", JSON: "application/json", JSON_PATCH: "application/json-patch+json", PNG: "image/png", SCIM_JSON: "application/scim+json", SVG: "image/svg+xml", TEXT: "text/plain", TYPESCRIPT: "text/typescript", PING: "x-application/ping", XML: "text/xml", CDA_XML: "application/cda+xml" };
41608
- var Lr = class {
41608
+ var Fr = class {
41609
41609
  constructor() {
41610
41610
  this.listeners = {};
41611
41611
  }
@@ -41632,7 +41632,7 @@ var Lr = class {
41632
41632
  };
41633
41633
  var K = class {
41634
41634
  constructor() {
41635
- this.emitter = new Lr();
41635
+ this.emitter = new Fr();
41636
41636
  }
41637
41637
  dispatchEvent(e) {
41638
41638
  this.emitter.dispatchEvent(e);
@@ -41647,71 +41647,71 @@ var K = class {
41647
41647
  this.emitter.removeAllListeners();
41648
41648
  }
41649
41649
  };
41650
- var Fr = { "Patient-open": "Patient-open", "Patient-close": "Patient-close", "ImagingStudy-open": "ImagingStudy-open", "ImagingStudy-close": "ImagingStudy-close", "Encounter-open": "Encounter-open", "Encounter-close": "Encounter-close", "DiagnosticReport-open": "DiagnosticReport-open", "DiagnosticReport-close": "DiagnosticReport-close", "DiagnosticReport-select": "DiagnosticReport-select", "DiagnosticReport-update": "DiagnosticReport-update", syncerror: "syncerror" };
41651
- var zs = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
41652
- var Ur = ["DiagnosticReport-update"];
41653
- function vi(r7) {
41654
- return Ur.includes(r7);
41655
- }
41650
+ var Ur = { "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" };
41651
+ var Js = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
41652
+ var Br = ["DiagnosticReport-update"];
41656
41653
  function Ti(r7) {
41657
- if (Ur.includes(r7)) throw new d(h(`'context.version' is required for '${r7}'.`));
41658
- }
41659
- var Js = { "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" } } };
41660
- function Ys(r7) {
41661
- return zs.includes(r7);
41654
+ return Br.includes(r7);
41662
41655
  }
41663
41656
  function Si(r7) {
41657
+ if (Br.includes(r7)) throw new d(h(`'context.version' is required for '${r7}'.`));
41658
+ }
41659
+ var Ys = { "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" } } };
41660
+ function Zs(r7) {
41661
+ return Js.includes(r7);
41662
+ }
41663
+ function Ei(r7) {
41664
41664
  return !!r7.endpoint;
41665
41665
  }
41666
- function Br(r7) {
41666
+ function qr(r7) {
41667
41667
  if (!kt(r7)) throw new d(h("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
41668
41668
  let { channelType: e, mode: t, topic: n, events: i } = r7, o = { "hub.channel.type": e, "hub.mode": t, "hub.topic": n, "hub.events": i.join(",") };
41669
- return Si(r7) && (o.endpoint = r7.endpoint), new URLSearchParams(o).toString();
41669
+ return Ei(r7) && (o.endpoint = r7.endpoint), new URLSearchParams(o).toString();
41670
41670
  }
41671
41671
  function kt(r7) {
41672
41672
  if (typeof r7 != "object") return false;
41673
41673
  let { channelType: e, mode: t, topic: n, events: i } = r7;
41674
41674
  if (!(e && t && n && i) || typeof n != "string" || typeof i != "object" || !Array.isArray(i) || i.length < 1 || e !== "websocket" || t !== "subscribe" && t !== "unsubscribe") return false;
41675
- for (let o of i) if (!Fr[o]) return false;
41676
- return !(Si(r7) && !(typeof r7.endpoint == "string" && r7.endpoint.startsWith("ws")));
41675
+ for (let o of i) if (!Ur[o]) return false;
41676
+ return !(Ei(r7) && !(typeof r7.endpoint == "string" && r7.endpoint.startsWith("ws")));
41677
41677
  }
41678
- function xi(r7, e, t, n) {
41678
+ function vi(r7, e, t, n) {
41679
41679
  if (typeof e != "object") throw new d(h(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
41680
41680
  if (!(e.id && typeof e.id == "string")) throw new d(h(`context[${t}] is invalid. Resource must contain a valid string ID.`));
41681
41681
  if (!e.resourceType) throw new d(h(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
41682
41682
  let i = n.resourceType;
41683
41683
  if (i !== "*") {
41684
- if (!Ys(e.resourceType)) throw new d(h(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
41684
+ if (!Zs(e.resourceType)) throw new d(h(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
41685
41685
  if (i && e.resourceType !== i) throw new d(h(`context[${t}] is invalid. context[${t}] for the '${r7}' event should contain resource of type ${i}.`));
41686
41686
  }
41687
41687
  }
41688
- function Zs(r7, e, t, n, i) {
41689
- if (i.set(e.key, (i.get(e.key) ?? 0) + 1), !n.isArray) xi(r7, e.resource, t, n);
41688
+ function Xs(r7, e, t, n, i) {
41689
+ if (i.set(e.key, (i.get(e.key) ?? 0) + 1), !n.isArray) vi(r7, e.resource, t, n);
41690
41690
  else {
41691
41691
  let { resources: o } = e;
41692
41692
  if (!o) throw new d(h(`context[${t}] is invalid. context[${t}] for the '${r7}' with key '${String(e.key)}' should contain an array of resources on the key 'resources'.`));
41693
- for (let s of o) xi(r7, s, t, n);
41693
+ for (let s of o) vi(r7, s, t, n);
41694
41694
  }
41695
41695
  }
41696
- function Xs(r7, e) {
41697
- let t = /* @__PURE__ */ new Map(), n = Js[r7];
41696
+ function ea(r7, e) {
41697
+ let t = /* @__PURE__ */ new Map(), n = Ys[r7];
41698
41698
  for (let i = 0; i < e.length; i++) {
41699
41699
  let o = e[i].key;
41700
41700
  if (!n[o]) throw new d(h(`Key '${o}' not found for event '${r7}'. Make sure to add only valid keys.`));
41701
- Zs(r7, e[i], i, n[o], t);
41701
+ Xs(r7, e[i], i, n[o], t);
41702
41702
  }
41703
41703
  for (let [i, o] of Object.entries(n)) {
41704
41704
  if (!(o.optional || t.has(i))) throw new d(h(`Missing required key '${i}' on context for '${r7}' event.`));
41705
41705
  if (!o.manyAllowed && (t.get(i) || 0) > 1) throw new d(h(`${t.get(i)} context entries with key '${i}' found for the '${r7}' event when schema only allows for 1.`));
41706
41706
  }
41707
41707
  }
41708
- function qr(r7, e, t, n) {
41708
+ function jr(r7, e, t, n) {
41709
41709
  if (!(r7 && typeof r7 == "string")) throw new d(h("Must provide a topic."));
41710
- if (!Fr[e]) throw new d(h(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Fr).join(", ")}`));
41710
+ if (!Ur[e]) throw new d(h(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Ur).join(", ")}`));
41711
41711
  if (typeof t != "object") throw new d(h("context must be a context object or array of context objects."));
41712
- if (Ur.includes(e) && !n) throw new d(h(`The '${e}' event must contain a 'context.versionId'.`));
41712
+ if (Br.includes(e) && !n) throw new d(h(`The '${e}' event must contain a 'context.versionId'.`));
41713
41713
  let i = Array.isArray(t) ? t : [t];
41714
- return Xs(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: Te(), event: { "hub.topic": r7, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
41714
+ return ea(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: Te(), event: { "hub.topic": r7, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
41715
41715
  }
41716
41716
  var It = class extends K {
41717
41717
  constructor(e) {
@@ -41733,28 +41733,28 @@ var It = class extends K {
41733
41733
  this.websocket.close();
41734
41734
  }
41735
41735
  };
41736
- function ea(r7) {
41737
- let e = r7.replace(/-/g, "+").replace(/_/g, "/"), t = mi(e), n = Array.from(t).reduce((o, s) => {
41736
+ function ta(r7) {
41737
+ let e = r7.replace(/-/g, "+").replace(/_/g, "/"), t = hi(e), n = Array.from(t).reduce((o, s) => {
41738
41738
  let a2 = ("00" + s.charCodeAt(0).toString(16)).slice(-2);
41739
41739
  return `${o}%${a2}`;
41740
41740
  }, ""), i = decodeURIComponent(n);
41741
41741
  return JSON.parse(i);
41742
41742
  }
41743
- function Ei(r7) {
41743
+ function bi(r7) {
41744
41744
  return r7.split(".").length === 3;
41745
41745
  }
41746
41746
  function Vt(r7) {
41747
41747
  let [e, t, n] = r7.split(".");
41748
- return ea(t);
41748
+ return ta(t);
41749
41749
  }
41750
- function bi(r7) {
41750
+ function Ri(r7) {
41751
41751
  try {
41752
41752
  return typeof Vt(r7).login_id == "string";
41753
41753
  } catch {
41754
41754
  return false;
41755
41755
  }
41756
41756
  }
41757
- function Ri(r7) {
41757
+ function Ci(r7) {
41758
41758
  try {
41759
41759
  let t = Vt(r7).exp;
41760
41760
  return typeof t == "number" ? t * 1e3 : void 0;
@@ -41776,11 +41776,11 @@ var Dt = class {
41776
41776
  await this.medplum.delete(`keyvalue/v1/${e}`);
41777
41777
  }
41778
41778
  };
41779
- var Ci;
41780
- Ci = Symbol.toStringTag;
41779
+ var Pi;
41780
+ Pi = Symbol.toStringTag;
41781
41781
  var M = class {
41782
41782
  constructor(e) {
41783
- this[Ci] = "ReadablePromise";
41783
+ this[Pi] = "ReadablePromise";
41784
41784
  this.status = "pending";
41785
41785
  this.suspender = e.then((t) => (this.status = "success", this.response = t, t), (t) => {
41786
41786
  throw this.status = "error", this.error = t, t;
@@ -41814,7 +41814,7 @@ var M = class {
41814
41814
  };
41815
41815
  var Ge = class {
41816
41816
  constructor(e) {
41817
- this.storage = e ?? (typeof localStorage < "u" ? localStorage : new jr());
41817
+ this.storage = e ?? (typeof localStorage < "u" ? localStorage : new Wr());
41818
41818
  }
41819
41819
  clear() {
41820
41820
  this.storage.clear();
@@ -41833,7 +41833,7 @@ var Ge = class {
41833
41833
  this.setString(e, t ? ut(t) : void 0);
41834
41834
  }
41835
41835
  };
41836
- var jr = class {
41836
+ var Wr = class {
41837
41837
  constructor() {
41838
41838
  this.data = /* @__PURE__ */ new Map();
41839
41839
  }
@@ -41857,8 +41857,8 @@ var jr = class {
41857
41857
  }
41858
41858
  };
41859
41859
  var Me = { Event: typeof globalThis.Event < "u" ? globalThis.Event : void 0, ErrorEvent: void 0, CloseEvent: void 0 };
41860
- var wi = false;
41861
- function ta() {
41860
+ var Ai = false;
41861
+ function ra() {
41862
41862
  if (typeof globalThis.Event > "u") throw new Error("Unable to lazy init events for ReconnectingWebSocket. globalThis.Event is not defined yet");
41863
41863
  Me.Event = globalThis.Event, Me.ErrorEvent = class extends Event {
41864
41864
  constructor(e, t) {
@@ -41872,17 +41872,17 @@ function ta() {
41872
41872
  }
41873
41873
  };
41874
41874
  }
41875
- function ra(r7, e) {
41875
+ function na(r7, e) {
41876
41876
  if (!r7) throw new Error(e);
41877
41877
  }
41878
41878
  function Mt(r7) {
41879
41879
  return new r7.constructor(r7.type, r7);
41880
41880
  }
41881
41881
  var Se = { maxReconnectionDelay: 1e4, minReconnectionDelay: 1e3 + Math.random() * 4e3, minUptime: 5e3, reconnectionDelayGrowFactor: 1.3, connectionTimeout: 4e3, maxRetries: 1 / 0, maxEnqueuedMessages: 1 / 0, startClosed: false, debug: false };
41882
- var Ai = false;
41882
+ var Oi = false;
41883
41883
  var _t = class r extends K {
41884
41884
  constructor(t, n, i = {}) {
41885
- wi || (ta(), wi = true);
41885
+ Ai || (ra(), Ai = true);
41886
41886
  super();
41887
41887
  this._retryCount = -1;
41888
41888
  this._shouldReconnect = true;
@@ -41897,7 +41897,7 @@ var _t = class r extends K {
41897
41897
  this._handleOpen = (t2) => {
41898
41898
  this._debug("open event");
41899
41899
  let { minUptime: n2 = Se.minUptime } = this._options;
41900
- clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), ra(this._ws, "WebSocket is not defined"), this._ws.binaryType = this._binaryType, this._messageQueue.forEach((i2) => this._ws?.send(i2)), this._messageQueue = [], this.onopen && this.onopen(t2), this.dispatchEvent(Mt(t2));
41900
+ clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), na(this._ws, "WebSocket is not defined"), this._ws.binaryType = this._binaryType, this._messageQueue.forEach((i2) => this._ws?.send(i2)), this._messageQueue = [], this.onopen && this.onopen(t2), this.dispatchEvent(Mt(t2));
41901
41901
  };
41902
41902
  this._handleMessage = (t2) => {
41903
41903
  this._debug("message event"), this.onmessage && this.onmessage(t2), this.dispatchEvent(Mt(t2));
@@ -42007,7 +42007,7 @@ var _t = class r extends K {
42007
42007
  this._connectLock = false;
42008
42008
  return;
42009
42009
  }
42010
- !this._options.WebSocket && typeof WebSocket > "u" && !Ai && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), Ai = true);
42010
+ !this._options.WebSocket && typeof WebSocket > "u" && !Oi && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), Oi = true);
42011
42011
  let i = this._options.WebSocket || WebSocket;
42012
42012
  this._debug("connect", { url: this._url, protocols: this._protocols }), this._ws = this._protocols ? new i(this._url, this._protocols) : new i(this._url), this._ws.binaryType = this._binaryType, this._connectLock = false, this._addListeners(), this._connectTimeout = setTimeout(() => this._handleTimeout(), n);
42013
42013
  }).catch((i) => {
@@ -42039,7 +42039,7 @@ var _t = class r extends K {
42039
42039
  clearTimeout(this._connectTimeout), clearTimeout(this._uptimeTimeout);
42040
42040
  }
42041
42041
  };
42042
- var na = 5e3;
42042
+ var ia = 5e3;
42043
42043
  var He = class extends K {
42044
42044
  constructor(...e) {
42045
42045
  super(), this.criteria = new Set(e);
@@ -42054,7 +42054,7 @@ var He = class extends K {
42054
42054
  this.criteria.delete(e);
42055
42055
  }
42056
42056
  };
42057
- var Wr = class {
42057
+ var $r = class {
42058
42058
  constructor(e, t) {
42059
42059
  this.connecting = false;
42060
42060
  this.criteria = e, this.emitter = new He(e), this.refCount = 1, this.subscriptionProps = t ? { ...t } : void 0;
@@ -42075,7 +42075,7 @@ var Nt = class {
42075
42075
  throw new d(h("Not a valid URL"));
42076
42076
  }
42077
42077
  let o = n?.ReconnectingWebSocket ? new n.ReconnectingWebSocket(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger }) : new _t(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger });
42078
- this.medplum = e, this.ws = o, this.masterSubEmitter = new He(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ?? na, this.currentProfile = e.getProfile(), this.setupListeners();
42078
+ this.medplum = e, this.ws = o, this.masterSubEmitter = new He(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ?? ia, this.currentProfile = e.getProfile(), this.setupListeners();
42079
42079
  }
42080
42080
  setupListeners() {
42081
42081
  let e = this.ws;
@@ -42116,7 +42116,7 @@ var Nt = class {
42116
42116
  for (let o of this.getAllCriteriaEmitters()) o.dispatchEvent({ ...i });
42117
42117
  }
42118
42118
  }), e.addEventListener("error", () => {
42119
- let t = { type: "error", payload: new d(ln(new Error("WebSocket error"))) };
42119
+ let t = { type: "error", payload: new d(pn(new Error("WebSocket error"))) };
42120
42120
  this.masterSubEmitter?.dispatchEvent(t);
42121
42121
  for (let n of this.getAllCriteriaEmitters()) n.dispatchEvent({ ...t });
42122
42122
  }), e.addEventListener("close", () => {
@@ -42206,7 +42206,7 @@ var Nt = class {
42206
42206
  this.masterSubEmitter && this.masterSubEmitter._addCriteria(e);
42207
42207
  let n = this.maybeGetCriteriaEntry(e, t);
42208
42208
  if (n) return n.refCount += 1, n.emitter;
42209
- let i = new Wr(e, t);
42209
+ let i = new $r(e, t);
42210
42210
  return this.addCriteriaEntry(i), this.subscribeToCriteria(i).catch(console.error), i.emitter;
42211
42211
  }
42212
42212
  removeCriteria(e, t) {
@@ -42233,25 +42233,25 @@ var Nt = class {
42233
42233
  return this.masterSubEmitter || (this.masterSubEmitter = new He(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
42234
42234
  }
42235
42235
  };
42236
- var $r = "3.2.31-bf22d6e26";
42237
- var sa = A.FHIR_JSON + ", */*; q=0.1";
42238
- var aa = "https://api.medplum.com/";
42239
- var ca = 1e3;
42240
- var ua = 6e4;
42241
- var la = 0;
42242
- var pa = 3e5;
42243
- var da = "Binary/";
42244
- var Oi = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
42245
- var fa = ((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))(fa || {});
42246
- var ma = ((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))(ma || {});
42247
- var ha = ((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))(ha || {});
42248
- var ya = ((e) => (e.JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", e))(ya || {});
42236
+ var Gr = "3.2.32-26a8c8c7b";
42237
+ var aa = A.FHIR_JSON + ", */*; q=0.1";
42238
+ var ca = "https://api.medplum.com/";
42239
+ var ua = 1e3;
42240
+ var la = 6e4;
42241
+ var pa = 0;
42242
+ var da = 3e5;
42243
+ var fa = "Binary/";
42244
+ var Ii = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
42245
+ var ma = ((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))(ma || {});
42246
+ var ha = ((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))(ha || {});
42247
+ var ya = ((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))(ya || {});
42248
+ var ga = ((e) => (e.JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", e))(ga || {});
42249
42249
  var Lt = class extends K {
42250
42250
  constructor(t) {
42251
42251
  super();
42252
42252
  this.initComplete = true;
42253
42253
  if (t?.baseUrl && !t.baseUrl.startsWith("http")) throw new Error("Base URL must start with http or https");
42254
- this.options = t ?? {}, this.fetch = t?.fetch ?? ga(), this.storage = t?.storage ?? new Ge(), this.createPdfImpl = t?.createPdf, this.baseUrl = Pr(t?.baseUrl ?? aa), this.fhirBaseUrl = q(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = q(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = q(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = q(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = q(this.baseUrl, t?.fhircastHubUrl ?? "fhircast/STU3"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.defaultHeaders = t?.defaultHeaders ?? {}, this.onUnauthenticated = t?.onUnauthenticated, this.refreshGracePeriod = t?.refreshGracePeriod ?? pa, this.cacheTime = t?.cacheTime ?? (typeof window > "u" ? la : ua), this.cacheTime > 0 ? this.requestCache = new Ot(t?.resourceCacheSize ?? ca) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken && this.setAccessToken(t.accessToken), this.storage.getInitPromise === void 0 ? (t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initPromise = Promise.resolve(), this.dispatchEvent({ type: "storageInitialized" })) : (this.initComplete = false, this.initPromise = this.storage.getInitPromise(), this.initPromise.then(() => {
42254
+ this.options = t ?? {}, this.fetch = t?.fetch ?? xa(), this.storage = t?.storage ?? new Ge(), this.createPdfImpl = t?.createPdf, this.baseUrl = wr(t?.baseUrl ?? ca), this.fhirBaseUrl = q(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = q(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = q(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = q(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = q(this.baseUrl, t?.fhircastHubUrl ?? "fhircast/STU3"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.defaultHeaders = t?.defaultHeaders ?? {}, this.onUnauthenticated = t?.onUnauthenticated, this.refreshGracePeriod = t?.refreshGracePeriod ?? da, this.cacheTime = t?.cacheTime ?? (typeof window > "u" ? pa : la), this.cacheTime > 0 ? this.requestCache = new Ot(t?.resourceCacheSize ?? ua) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken && this.setAccessToken(t.accessToken), this.storage.getInitPromise === void 0 ? (t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initPromise = Promise.resolve(), this.dispatchEvent({ type: "storageInitialized" })) : (this.initComplete = false, this.initPromise = this.storage.getInitPromise(), this.initPromise.then(() => {
42255
42255
  t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initComplete = true, this.dispatchEvent({ type: "storageInitialized" });
42256
42256
  }).catch((n) => {
42257
42257
  console.error(n), this.initComplete = true, this.dispatchEvent({ type: "storageInitFailed", payload: { error: n } });
@@ -42381,7 +42381,7 @@ var Lt = class extends K {
42381
42381
  }
42382
42382
  fhirSearchUrl(t, n) {
42383
42383
  let i = this.fhirUrl(t);
42384
- return n && (i.search = Yn(n)), i;
42384
+ return n && (i.search = Zn(n)), i;
42385
42385
  }
42386
42386
  search(t, n, i) {
42387
42387
  let o = this.fhirSearchUrl(t, n), s = "search-" + o.toString(), a2 = this.getCacheEntry(s, i);
@@ -42404,7 +42404,7 @@ var Lt = class extends K {
42404
42404
  searchResources(t, n, i) {
42405
42405
  let s = "searchResources-" + this.fhirSearchUrl(t, n).toString(), a2 = this.getCacheEntry(s, i);
42406
42406
  if (a2) return a2.value;
42407
- let c = new M(this.search(t, n, i).then(Vi));
42407
+ let c = new M(this.search(t, n, i).then(Di));
42408
42408
  return this.setCacheEntry(s, c), c;
42409
42409
  }
42410
42410
  async *searchResourcePages(t, n, i) {
@@ -42412,7 +42412,7 @@ var Lt = class extends K {
42412
42412
  for (; o; ) {
42413
42413
  let s = new URL(o).searchParams, a2 = await this.search(t, s, i), c = a2.link?.find((u2) => u2.relation === "next");
42414
42414
  if (!a2.entry?.length && !c) break;
42415
- yield Vi(a2), o = c?.url ? new URL(c.url) : void 0;
42415
+ yield Di(a2), o = c?.url ? new URL(c.url) : void 0;
42416
42416
  }
42417
42417
  }
42418
42418
  searchValueSet(t, n, i) {
@@ -42429,7 +42429,7 @@ var Lt = class extends K {
42429
42429
  getCachedReference(t) {
42430
42430
  let n = t.reference;
42431
42431
  if (!n) return;
42432
- if (n === "system") return Oi;
42432
+ if (n === "system") return Ii;
42433
42433
  let [i, o] = n.split("/");
42434
42434
  if (!(!i || !o)) return this.getCached(i, o);
42435
42435
  }
@@ -42440,12 +42440,12 @@ var Lt = class extends K {
42440
42440
  readReference(t, n) {
42441
42441
  let i = t.reference;
42442
42442
  if (!i) return new M(Promise.reject(new Error("Missing reference")));
42443
- if (i === "system") return new M(Promise.resolve(Oi));
42443
+ if (i === "system") return new M(Promise.resolve(Ii));
42444
42444
  let [o, s] = i.split("/");
42445
42445
  return !o || !s ? new M(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
42446
42446
  }
42447
42447
  requestSchema(t) {
42448
- if (En(t)) return Promise.resolve();
42448
+ if (bn(t)) return Promise.resolve();
42449
42449
  let n = t + "-requestSchema", i = this.getCacheEntry(n, void 0);
42450
42450
  if (i) return i.value;
42451
42451
  let o = new M((async () => {
@@ -42490,13 +42490,13 @@ var Lt = class extends K {
42490
42490
  target
42491
42491
  }
42492
42492
  }`.replace(/\s+/g, " "), a2 = await this.graphql(s);
42493
- ur(a2.data.StructureDefinitionList.filter((c) => c.name === t));
42494
- for (let c of a2.data.SearchParameterList) Or(c);
42493
+ lr(a2.data.StructureDefinitionList.filter((c) => c.name === t));
42494
+ for (let c of a2.data.SearchParameterList) Ir(c);
42495
42495
  })());
42496
42496
  return this.setCacheEntry(n, o), o;
42497
42497
  }
42498
42498
  requestProfileSchema(t, n) {
42499
- if (!n?.expandProfile && Rn(t)) return Promise.resolve();
42499
+ if (!n?.expandProfile && Cn(t)) return Promise.resolve();
42500
42500
  let i = t + "-requestSchema" + (n?.expandProfile ? "-nested" : ""), o = this.getCacheEntry(i, void 0);
42501
42501
  if (o) return o.value;
42502
42502
  let s = new M((async () => {
@@ -42504,14 +42504,14 @@ var Lt = class extends K {
42504
42504
  let a2 = this.fhirUrl("StructureDefinition", "$expand-profile");
42505
42505
  a2.search = new URLSearchParams({ url: t }).toString();
42506
42506
  let c = await this.post(a2.toString(), {});
42507
- ur(c);
42507
+ lr(c);
42508
42508
  } else {
42509
42509
  let a2 = await this.searchOne("StructureDefinition", { url: t, _sort: "-_lastUpdated" });
42510
42510
  if (!a2) {
42511
42511
  console.warn(`No StructureDefinition found for ${t}!`);
42512
42512
  return;
42513
42513
  }
42514
- lr(a2);
42514
+ pr(a2);
42515
42515
  }
42516
42516
  })());
42517
42517
  return this.setCacheEntry(i, s), s;
@@ -42540,7 +42540,7 @@ var Lt = class extends K {
42540
42540
  return s || (s = t), this.cacheResource(s), this.invalidateUrl(this.fhirUrl(t.resourceType, t.id, "_history")), this.invalidateSearches(t.resourceType), s;
42541
42541
  }
42542
42542
  async createAttachment(t, n, i, o, s) {
42543
- let a2 = Di(t, n, i, o);
42543
+ let a2 = Mi(t, n, i, o);
42544
42544
  if (a2.contentType === A.XML) {
42545
42545
  let l2 = a2.data, m2;
42546
42546
  l2 instanceof Blob ? m2 = await new Promise((x2, B) => {
@@ -42558,7 +42558,7 @@ var Lt = class extends K {
42558
42558
  return { contentType: a2.contentType, url: u2.url, title: a2.filename };
42559
42559
  }
42560
42560
  createBinary(t, n, i, o, s) {
42561
- let a2 = Di(t, n, i, o), c = s ?? (typeof n == "object" ? n : {}), { data: u2, contentType: l2, filename: m2, securityContext: x2, onProgress: B } = a2, W = this.fhirUrl("Binary");
42561
+ let a2 = Mi(t, n, i, o), c = s ?? (typeof n == "object" ? n : {}), { data: u2, contentType: l2, filename: m2, securityContext: x2, onProgress: B } = a2, W = this.fhirUrl("Binary");
42562
42562
  return m2 && W.searchParams.set("_filename", m2), x2?.reference && this.setRequestHeader(c, "X-Security-Context", x2.reference), B ? this.uploadwithProgress(W, u2, l2, B, c) : this.post(W, u2, l2, c);
42563
42563
  }
42564
42564
  uploadwithProgress(t, n, i, o, s) {
@@ -42579,7 +42579,7 @@ var Lt = class extends K {
42579
42579
  }
42580
42580
  async createPdf(t, n, i, o) {
42581
42581
  if (!this.createPdfImpl) throw new Error("PDF creation not enabled");
42582
- let s = Ta(t, n, i, o), a2 = typeof n == "object" ? n : {}, { docDefinition: c, tableLayouts: u2, fonts: l2, ...m2 } = s, x2 = await this.createPdfImpl(c, u2, l2), B = { ...m2, data: x2, contentType: "application/pdf" };
42582
+ let s = Sa(t, n, i, o), a2 = typeof n == "object" ? n : {}, { docDefinition: c, tableLayouts: u2, fonts: l2, ...m2 } = s, x2 = await this.createPdfImpl(c, u2, l2), B = { ...m2, data: x2, contentType: "application/pdf" };
42583
42583
  return this.createBinary(B, a2);
42584
42584
  }
42585
42585
  createComment(t, n, i) {
@@ -42641,7 +42641,7 @@ var Lt = class extends K {
42641
42641
  return this.accessTokenExpires !== void 0 && Date.now() < this.accessTokenExpires - (t ?? this.refreshGracePeriod);
42642
42642
  }
42643
42643
  setAccessToken(t, n) {
42644
- this.accessToken = t, this.refreshToken = n, this.accessTokenExpires = Ri(t), this.medplumServer = bi(t);
42644
+ this.accessToken = t, this.refreshToken = n, this.accessTokenExpires = Ci(t), this.medplumServer = Ri(t);
42645
42645
  }
42646
42646
  getLogins() {
42647
42647
  return this.storage.getObject("logins") ?? [];
@@ -42689,7 +42689,7 @@ var Lt = class extends K {
42689
42689
  async download(t, n = {}) {
42690
42690
  this.refreshPromise && await this.refreshPromise;
42691
42691
  let i = t.toString();
42692
- i.startsWith(da) && (t = this.fhirUrl(i));
42692
+ i.startsWith(fa) && (t = this.fhirUrl(i));
42693
42693
  let o = n.headers;
42694
42694
  return o || (o = {}, n.headers = o), o.Accept || (o.Accept = "*/*"), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
42695
42695
  }
@@ -42734,14 +42734,14 @@ var Lt = class extends K {
42734
42734
  if (s.status === 401) return this.handleUnauthenticated(t, n, i);
42735
42735
  if (s.status === 204 || s.status === 304) return;
42736
42736
  let c = s.headers.get("content-type")?.includes("json");
42737
- if (s.status === 404 && !c) throw new d(cn);
42737
+ if (s.status === 404 && !c) throw new d(un);
42738
42738
  let u2 = await this.parseBody(s, c);
42739
42739
  if (s.status === 200 && i.followRedirectOnOk || s.status === 201 && i.followRedirectOnCreated) {
42740
- let l2 = await ki(s, u2);
42740
+ let l2 = await Vi(s, u2);
42741
42741
  if (l2) return this.request("GET", l2, { ...i, body: void 0 });
42742
42742
  }
42743
42743
  if (s.status === 202 && i.pollStatusOnAccepted) {
42744
- let m2 = await ki(s, u2) ?? o.statusUrl;
42744
+ let m2 = await Vi(s, u2) ?? o.statusUrl;
42745
42745
  if (m2) return this.pollStatus(m2, i, o);
42746
42746
  }
42747
42747
  if (s.status >= 400) throw new d(et(u2));
@@ -42770,7 +42770,7 @@ var Lt = class extends K {
42770
42770
  } catch (a2) {
42771
42771
  if (a2.message === "Failed to fetch" && s === 0 && this.dispatchEvent({ type: "offline" }), a2.name === "AbortError" || s === i) throw a2;
42772
42772
  }
42773
- await Rr(o);
42773
+ await Cr(o);
42774
42774
  }
42775
42775
  throw new Error("Unreachable");
42776
42776
  }
@@ -42788,7 +42788,7 @@ var Lt = class extends K {
42788
42788
  if (i.pollCount === void 0) n.headers && typeof n.headers == "object" && "Prefer" in n.headers && (o.headers = { ...n.headers }, delete o.headers.Prefer), i.statusUrl = t, i.pollCount = 1;
42789
42789
  else {
42790
42790
  let s = n.pollStatusPeriod ?? 1e3;
42791
- await Rr(s), i.pollCount++;
42791
+ await Cr(s), i.pollCount++;
42792
42792
  }
42793
42793
  return this.request("GET", t, o, i);
42794
42794
  }
@@ -42807,13 +42807,13 @@ var Lt = class extends K {
42807
42807
  let n = { resourceType: "Bundle", type: "batch", entry: t.map((o) => ({ request: { method: o.method, url: o.url }, resource: o.options.body ? JSON.parse(o.options.body) : void 0 })) }, i = await this.post(this.fhirBaseUrl, n);
42808
42808
  for (let o = 0; o < t.length; o++) {
42809
42809
  let s = t[o], a2 = i.entry?.[o];
42810
- a2?.response?.outcome && !nr(a2.response.outcome) ? s.reject(new d(a2.response.outcome)) : s.resolve(a2?.resource);
42810
+ a2?.response?.outcome && !ir(a2.response.outcome) ? s.reject(new d(a2.response.outcome)) : s.resolve(a2?.resource);
42811
42811
  }
42812
42812
  }
42813
42813
  addFetchOptionsDefaults(t) {
42814
42814
  Object.entries(this.defaultHeaders).forEach(([n, i]) => {
42815
42815
  this.setRequestHeader(t, n, i);
42816
- }), this.setRequestHeader(t, "Accept", sa, true), this.options.extendedMode !== false && this.setRequestHeader(t, "X-Medplum", "extended"), t.body && this.setRequestHeader(t, "Content-Type", A.FHIR_JSON, true), this.accessToken ? this.setRequestHeader(t, "Authorization", "Bearer " + this.accessToken) : this.basicAuth && this.setRequestHeader(t, "Authorization", "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
42816
+ }), this.setRequestHeader(t, "Accept", aa, true), this.options.extendedMode !== false && this.setRequestHeader(t, "X-Medplum", "extended"), t.body && this.setRequestHeader(t, "Content-Type", A.FHIR_JSON, true), this.accessToken ? this.setRequestHeader(t, "Authorization", "Bearer " + this.accessToken) : this.basicAuth && this.setRequestHeader(t, "Authorization", "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
42817
42817
  }
42818
42818
  setRequestContentType(t, n) {
42819
42819
  this.setRequestHeader(t, "Content-Type", n);
@@ -42830,20 +42830,20 @@ var Lt = class extends K {
42830
42830
  return this.refresh() ? this.request(t, n, i) : (this.clear(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new d(be)));
42831
42831
  }
42832
42832
  async startPkce() {
42833
- let t = Nr();
42833
+ let t = Lr();
42834
42834
  sessionStorage.setItem("pkceState", t);
42835
- let n = Nr().slice(0, 128);
42835
+ let n = Lr().slice(0, 128);
42836
42836
  sessionStorage.setItem("codeVerifier", n);
42837
- let i = await yi(n), o = Gn(i).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
42837
+ let i = await gi(n), o = Hn(i).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
42838
42838
  return sessionStorage.setItem("codeChallenge", o), { codeChallengeMethod: "S256", codeChallenge: o };
42839
42839
  }
42840
42840
  async requestAuthorization(t) {
42841
42841
  let n = await this.ensureCodeChallenge(t ?? {}), i = new URL(this.authorizeUrl);
42842
- i.searchParams.set("response_type", "code"), i.searchParams.set("state", sessionStorage.getItem("pkceState")), i.searchParams.set("client_id", n.clientId ?? this.clientId), i.searchParams.set("redirect_uri", n.redirectUri ?? Ii()), i.searchParams.set("code_challenge_method", n.codeChallengeMethod), i.searchParams.set("code_challenge", n.codeChallenge), i.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i.toString());
42842
+ i.searchParams.set("response_type", "code"), i.searchParams.set("state", sessionStorage.getItem("pkceState")), i.searchParams.set("client_id", n.clientId ?? this.clientId), i.searchParams.set("redirect_uri", n.redirectUri ?? ki()), i.searchParams.set("code_challenge_method", n.codeChallengeMethod), i.searchParams.set("code_challenge", n.codeChallenge), i.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i.toString());
42843
42843
  }
42844
42844
  processCode(t, n) {
42845
42845
  let i = new URLSearchParams();
42846
- if (i.set("grant_type", "authorization_code"), i.set("code", t), i.set("client_id", n?.clientId ?? this.clientId), i.set("redirect_uri", n?.redirectUri ?? Ii()), typeof sessionStorage < "u") {
42846
+ if (i.set("grant_type", "authorization_code"), i.set("code", t), i.set("client_id", n?.clientId ?? this.clientId), i.set("redirect_uri", n?.redirectUri ?? ki()), typeof sessionStorage < "u") {
42847
42847
  let o = sessionStorage.getItem("codeVerifier");
42848
42848
  o && i.set("code_verifier", o);
42849
42849
  }
@@ -42875,25 +42875,25 @@ var Lt = class extends K {
42875
42875
  return n.append("grant_type", "client_credentials"), n.append("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), n.append("client_assertion", t), this.fetchTokens(n);
42876
42876
  }
42877
42877
  setBasicAuth(t, n) {
42878
- this.clientId = t, this.clientSecret = n, this.basicAuth = hi(t + ":" + n);
42878
+ this.clientId = t, this.clientSecret = n, this.basicAuth = yi(t + ":" + n);
42879
42879
  }
42880
42880
  async fhircastSubscribe(t, n) {
42881
42881
  if (!(typeof t == "string" && t !== "")) throw new d(h("Invalid topic provided. Topic must be a valid string."));
42882
42882
  if (!(typeof n == "object" && Array.isArray(n) && n.length > 0)) throw new d(h("Invalid events provided. Events must be an array of event names containing at least one event."));
42883
- let i = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post(this.fhircastHubUrl, Br(i), A.FORM_URL_ENCODED))["hub.channel.endpoint"];
42883
+ let i = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post(this.fhircastHubUrl, qr(i), A.FORM_URL_ENCODED))["hub.channel.endpoint"];
42884
42884
  if (!s) throw new Error("Invalid response!");
42885
42885
  return i.endpoint = s, i;
42886
42886
  }
42887
42887
  async fhircastUnsubscribe(t) {
42888
42888
  if (!kt(t)) throw new d(h("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
42889
42889
  if (!(t.endpoint && typeof t.endpoint == "string" && t.endpoint.startsWith("ws"))) throw new d(h("Provided subscription request must have an endpoint in order to unsubscribe."));
42890
- t.mode = "unsubscribe", await this.post(this.fhircastHubUrl, Br(t), A.FORM_URL_ENCODED);
42890
+ t.mode = "unsubscribe", await this.post(this.fhircastHubUrl, qr(t), A.FORM_URL_ENCODED);
42891
42891
  }
42892
42892
  fhircastConnect(t) {
42893
42893
  return new It(t);
42894
42894
  }
42895
42895
  async fhircastPublish(t, n, i, o) {
42896
- return vi(n) ? this.post(this.fhircastHubUrl, qr(t, n, i, o), A.JSON) : (Ti(n), this.post(this.fhircastHubUrl, qr(t, n, i), A.JSON));
42896
+ return Ti(n) ? this.post(this.fhircastHubUrl, jr(t, n, i, o), A.JSON) : (Si(n), this.post(this.fhircastHubUrl, jr(t, n, i), A.JSON));
42897
42897
  }
42898
42898
  async fhircastGetContext(t) {
42899
42899
  return this.get(`${this.fhircastHubUrl}/${t}`);
@@ -42924,12 +42924,12 @@ var Lt = class extends K {
42924
42924
  }
42925
42925
  async verifyTokens(t) {
42926
42926
  let n = t.access_token;
42927
- if (Ei(n)) {
42927
+ if (bi(n)) {
42928
42928
  let i = Vt(n);
42929
- if (Date.now() >= i.exp * 1e3) throw this.clearActiveLogin(), new d(un);
42929
+ if (Date.now() >= i.exp * 1e3) throw this.clearActiveLogin(), new d(ln);
42930
42930
  if (i.cid) {
42931
- if (i.cid !== this.clientId) throw this.clearActiveLogin(), new d(rr);
42932
- } else if (this.clientId && i.client_id !== this.clientId) throw this.clearActiveLogin(), new d(rr);
42931
+ if (i.cid !== this.clientId) throw this.clearActiveLogin(), new d(nr);
42932
+ } else if (this.clientId && i.client_id !== this.clientId) throw this.clearActiveLogin(), new d(nr);
42933
42933
  }
42934
42934
  return this.setActiveLogin({ accessToken: n, refreshToken: t.refresh_token, project: t.project, profile: t.profile });
42935
42935
  }
@@ -42949,7 +42949,7 @@ var Lt = class extends K {
42949
42949
  }
42950
42950
  }
42951
42951
  getSubscriptionManager() {
42952
- return this.subscriptionManager || (this.subscriptionManager = new Nt(this, Jn(this.baseUrl, "/ws/subscriptions-r4"))), this.subscriptionManager;
42952
+ return this.subscriptionManager || (this.subscriptionManager = new Nt(this, Yn(this.baseUrl, "/ws/subscriptions-r4"))), this.subscriptionManager;
42953
42953
  }
42954
42954
  subscribeToCriteria(t, n) {
42955
42955
  return this.getSubscriptionManager().addCriteria(t, n);
@@ -42961,41 +42961,41 @@ var Lt = class extends K {
42961
42961
  return this.getSubscriptionManager().getMasterEmitter();
42962
42962
  }
42963
42963
  };
42964
- function ga() {
42964
+ function xa() {
42965
42965
  if (!globalThis.fetch) throw new Error("Fetch not available in this environment");
42966
42966
  return globalThis.fetch.bind(globalThis);
42967
42967
  }
42968
- function Ii() {
42968
+ function ki() {
42969
42969
  return typeof window > "u" ? "" : window.location.protocol + "//" + window.location.host + "/";
42970
42970
  }
42971
- async function ki(r7, e) {
42971
+ async function Vi(r7, e) {
42972
42972
  let t = r7.headers.get("content-location");
42973
42973
  if (t) return t;
42974
42974
  let n = r7.headers.get("location");
42975
42975
  if (n) return n;
42976
42976
  if (Re(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
42977
42977
  }
42978
- function Vi(r7) {
42978
+ function Di(r7) {
42979
42979
  let e = r7.entry?.map((t) => t.resource) ?? [];
42980
42980
  return Object.assign(e, { bundle: r7 });
42981
42981
  }
42982
- function xa(r7) {
42982
+ function va(r7) {
42983
42983
  return R(r7) && "data" in r7 && "contentType" in r7;
42984
42984
  }
42985
- function Di(r7, e, t, n) {
42986
- return xa(r7) ? r7 : { data: r7, filename: e, contentType: t, onProgress: n };
42985
+ function Mi(r7, e, t, n) {
42986
+ return va(r7) ? r7 : { data: r7, filename: e, contentType: t, onProgress: n };
42987
42987
  }
42988
- function va(r7) {
42988
+ function Ta(r7) {
42989
42989
  return R(r7) && "docDefinition" in r7;
42990
42990
  }
42991
- function Ta(r7, e, t, n) {
42992
- return va(r7) ? r7 : { docDefinition: r7, filename: e, tableLayouts: t, fonts: n };
42991
+ function Sa(r7, e, t, n) {
42992
+ return Ta(r7) ? r7 : { docDefinition: r7, filename: e, tableLayouts: t, fonts: n };
42993
42993
  }
42994
- var Va = [...We, "->", "<<", ">>", "=="];
42995
- var _a = $e().registerInfix("->", { precedence: y.Arrow }).registerInfix(";", { precedence: y.Semicolon });
42996
- var Xa = " ".repeat(2);
42997
- var tc = [...We, "eq", "ne", "co"];
42998
- var ic = $e();
42994
+ var Da = [...We, "->", "<<", ">>", "=="];
42995
+ var Na = $e().registerInfix("->", { precedence: y.Arrow }).registerInfix(";", { precedence: y.Semicolon });
42996
+ var ec = " ".repeat(2);
42997
+ var rc = [...We, "eq", "ne", "co"];
42998
+ var oc = $e();
42999
42999
  var ce = class {
43000
43000
  constructor(e = "\r", t = "|", n = "^", i = "~", o = "\\", s = "&") {
43001
43001
  this.segmentSeparator = e;
@@ -43012,7 +43012,7 @@ var ce = class {
43012
43012
  return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
43013
43013
  }
43014
43014
  };
43015
- var Yi = class r2 {
43015
+ var Zi = class r2 {
43016
43016
  constructor(e, t = new ce()) {
43017
43017
  this.context = t, this.segments = e;
43018
43018
  }
@@ -43036,7 +43036,7 @@ var Yi = class r2 {
43036
43036
  }
43037
43037
  buildAck() {
43038
43038
  let e = /* @__PURE__ */ new Date(), t = this.getSegment("MSH"), n = t?.getField(3)?.toString() ?? "", i = t?.getField(4)?.toString() ?? "", o = t?.getField(5)?.toString() ?? "", s = t?.getField(6)?.toString() ?? "", a2 = t?.getField(10)?.toString() ?? "", c = t?.getField(12)?.toString() ?? "2.5.1";
43039
- return new r2([new ze(["MSH", this.context.getMsh2(), o, s, n, i, sc(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", c], this.context), new ze(["MSA", "AA", a2, "OK"], this.context)]);
43039
+ return new r2([new ze(["MSH", this.context.getMsh2(), o, s, n, i, ac(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", c], this.context), new ze(["MSA", "AA", a2, "OK"], this.context)]);
43040
43040
  }
43041
43041
  buildAckMessageType(e) {
43042
43042
  let t = e?.getField(9), n = t?.getComponent(2), i = t?.getComponent(3), o = "ACK";
@@ -43053,7 +43053,7 @@ var Yi = class r2 {
43053
43053
  };
43054
43054
  var ze = class r3 {
43055
43055
  constructor(e, t = new ce()) {
43056
- this.context = t, jn(e) ? this.fields = e.map((n) => Ne.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
43056
+ this.context = t, Wn(e) ? this.fields = e.map((n) => Ne.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
43057
43057
  }
43058
43058
  get(e) {
43059
43059
  return this.fields[e];
@@ -43094,12 +43094,12 @@ var Ne = class r4 {
43094
43094
  return new r4(e.split(t.repetitionSeparator).map((n) => n.split(t.componentSeparator)), t);
43095
43095
  }
43096
43096
  };
43097
- function sc(r7) {
43097
+ function ac(r7) {
43098
43098
  let e = r7 instanceof Date ? r7 : new Date(r7), n = e.toISOString().replace(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i = e.getUTCMilliseconds();
43099
43099
  return i > 0 && (n += "." + i.toString()), n;
43100
43100
  }
43101
- var Yr = ((o) => (o[o.NONE = 0] = "NONE", o[o.ERROR = 1] = "ERROR", o[o.WARN = 2] = "WARN", o[o.INFO = 3] = "INFO", o[o.DEBUG = 4] = "DEBUG", o))(Yr || {});
43102
- var Zi = class r5 {
43101
+ var Zr = ((o) => (o[o.NONE = 0] = "NONE", o[o.ERROR = 1] = "ERROR", o[o.WARN = 2] = "WARN", o[o.INFO = 3] = "INFO", o[o.DEBUG = 4] = "DEBUG", o))(Zr || {});
43102
+ var Xi = class r5 {
43103
43103
  constructor(e, t = {}, n = 3, i) {
43104
43104
  this.write = e;
43105
43105
  this.metadata = t;
@@ -43129,17 +43129,17 @@ var Zi = class r5 {
43129
43129
  }
43130
43130
  log(e, t, n) {
43131
43131
  e > this.level || (n instanceof Error && (n = { error: n.toString(), stack: n.stack?.split(`
43132
- `) }), this.write(JSON.stringify({ level: Yr[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...n, ...this.metadata })));
43132
+ `) }), this.write(JSON.stringify({ level: Zr[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...n, ...this.metadata })));
43133
43133
  }
43134
43134
  };
43135
- function Tm(r7) {
43136
- let e = Yr[r7.toUpperCase()];
43135
+ function bm(r7) {
43136
+ let e = Zr[r7.toUpperCase()];
43137
43137
  if (e === void 0) throw new Error(`Invalid log level: ${r7}`);
43138
43138
  return e;
43139
43139
  }
43140
- var fc = "https://meta.medplum.com/releases";
43140
+ var mc = "https://meta.medplum.com/releases";
43141
43141
  var Kt = /* @__PURE__ */ new Map();
43142
- function mc(r7) {
43142
+ function hc(r7) {
43143
43143
  let e = r7;
43144
43144
  if (!e.tag_name) throw new Error("Manifest missing tag_name");
43145
43145
  let t = e.assets;
@@ -43149,11 +43149,11 @@ function mc(r7) {
43149
43149
  if (!n.name) throw new Error("Asset missing name");
43150
43150
  }
43151
43151
  }
43152
- async function Xr(r7, e, t) {
43152
+ async function en(r7, e, t) {
43153
43153
  let n = Kt.get(e ?? "latest");
43154
43154
  if (!n) {
43155
- let i = e ? `v${e}` : "latest", o = new URL(`${fc}/${i}.json`);
43156
- if (o.searchParams.set("a", r7), o.searchParams.set("c", $r), t) for (let [c, u2] of Object.entries(t)) o.searchParams.set(c, u2);
43155
+ let i = e ? `v${e}` : "latest", o = new URL(`${mc}/${i}.json`);
43156
+ if (o.searchParams.set("a", r7), o.searchParams.set("c", Gr), t) for (let [c, u2] of Object.entries(t)) o.searchParams.set(c, u2);
43157
43157
  let s = await fetch(o.toString());
43158
43158
  if (s.status !== 200) {
43159
43159
  let c;
@@ -43165,24 +43165,24 @@ async function Xr(r7, e, t) {
43165
43165
  throw new Error(`Received status code ${s.status} while fetching manifest for version '${e ?? "latest"}'. Message: ${c}`);
43166
43166
  }
43167
43167
  let a2 = await s.json();
43168
- mc(a2), n = a2, Kt.set(e ?? "latest", n), e || Kt.set(n.tag_name.slice(1), n);
43168
+ hc(a2), n = a2, Kt.set(e ?? "latest", n), e || Kt.set(n.tag_name.slice(1), n);
43169
43169
  }
43170
43170
  return n;
43171
43171
  }
43172
- function hc(r7) {
43172
+ function yc(r7) {
43173
43173
  return /^\d+\.\d+\.\d+$/.test(r7);
43174
43174
  }
43175
- async function _m(r7, e) {
43176
- if (!hc(e)) return false;
43175
+ async function Fm(r7, e) {
43176
+ if (!yc(e)) return false;
43177
43177
  try {
43178
- await Xr(r7, e);
43178
+ await en(r7, e);
43179
43179
  } catch {
43180
43180
  return false;
43181
43181
  }
43182
43182
  return true;
43183
43183
  }
43184
- async function Nm(r7) {
43185
- let e = await Xr(r7);
43184
+ async function Um(r7) {
43185
+ let e = await en(r7);
43186
43186
  if (!e.tag_name.startsWith("v")) throw new Error(`Invalid release name found. Release tag '${e.tag_name}' did not start with 'v'`);
43187
43187
  return e.tag_name.slice(1);
43188
43188
  }
@@ -43230,7 +43230,7 @@ var p2 = class extends a {
43230
43230
  e.on("data", (s) => {
43231
43231
  try {
43232
43232
  if (this.appendData(s), s.at(-2) === 28 && s.at(-1) === 13) {
43233
- let o = Buffer.concat(this.chunks), i = o.subarray(1, o.length - 2), f2 = (0, import_iconv_lite.decode)(i, this.encoding), g2 = Yi.parse(f2);
43233
+ let o = Buffer.concat(this.chunks), i = o.subarray(1, o.length - 2), f2 = (0, import_iconv_lite.decode)(i, this.encoding), g2 = Zi.parse(f2);
43234
43234
  this.dispatchEvent(new d2(this, g2)), this.resetBuffer();
43235
43235
  }
43236
43236
  } catch (o) {
@@ -43413,8 +43413,8 @@ var AgentDicomChannel = class extends BaseChannel {
43413
43413
  this.association = association;
43414
43414
  association.setMaxPduLength(65536);
43415
43415
  association.getPresentationContexts().forEach(({ context }) => {
43416
- context.getTransferSyntaxUids().forEach((ts) => {
43417
- context.setResult(dimse.constants.PresentationContextResult.Accept, ts);
43416
+ context.getTransferSyntaxUids().forEach((ts2) => {
43417
+ context.setResult(dimse.constants.PresentationContextResult.Accept, ts2);
43418
43418
  });
43419
43419
  });
43420
43420
  this.sendAssociationAccept();
@@ -43559,7 +43559,7 @@ var AgentHl7Channel = class extends BaseChannel {
43559
43559
  sendToRemote(msg) {
43560
43560
  const connection = this.connections.get(msg.remote);
43561
43561
  if (connection) {
43562
- connection.hl7Connection.send(Yi.parse(msg.body));
43562
+ connection.hl7Connection.send(Zi.parse(msg.body));
43563
43563
  }
43564
43564
  }
43565
43565
  handleNewConnection(connection) {
@@ -43608,7 +43608,7 @@ var UPGRADER_LOG_PATH = (0, import_node_path2.resolve)(
43608
43608
  );
43609
43609
  var RELEASES_PATH = (0, import_node_path2.resolve)(__dirname);
43610
43610
  async function downloadRelease(version, path) {
43611
- const release = await Xr("agent-upgrader", version);
43611
+ const release = await en("agent-upgrader", version);
43612
43612
  const downloadUrl = parseDownloadUrl(release, (0, import_node_os2.platform)());
43613
43613
  const { body } = await fetch(downloadUrl);
43614
43614
  if (!body) {
@@ -43620,9 +43620,9 @@ async function downloadRelease(version, path) {
43620
43620
  writeStream.once("close", resolve2);
43621
43621
  });
43622
43622
  }
43623
- function parseDownloadUrl(release, os) {
43623
+ function parseDownloadUrl(release, os2) {
43624
43624
  let endingToMatch;
43625
- switch (os) {
43625
+ switch (os2) {
43626
43626
  case "win32":
43627
43627
  endingToMatch = ".exe";
43628
43628
  break;
@@ -43630,14 +43630,14 @@ function parseDownloadUrl(release, os) {
43630
43630
  endingToMatch = "linux";
43631
43631
  break;
43632
43632
  default:
43633
- throw new Error(`Unsupported platform: ${os}`);
43633
+ throw new Error(`Unsupported platform: ${os2}`);
43634
43634
  }
43635
43635
  for (const asset of release.assets) {
43636
43636
  if (asset.name.endsWith(endingToMatch)) {
43637
43637
  return asset.browser_download_url;
43638
43638
  }
43639
43639
  }
43640
- throw new Error(`No download URL found for release '${release.tag_name}' for ${os}`);
43640
+ throw new Error(`No download URL found for release '${release.tag_name}' for ${os2}`);
43641
43641
  }
43642
43642
  function getReleaseBinPath(version) {
43643
43643
  let binaryName;
@@ -43684,7 +43684,7 @@ var App = class _App {
43684
43684
  this.shutdown = false;
43685
43685
  this.keepAlive = false;
43686
43686
  _App.instance = this;
43687
- this.log = new Zi((msg) => console.log(msg), void 0, logLevel);
43687
+ this.log = new Xi((msg) => console.log(msg), void 0, logLevel);
43688
43688
  }
43689
43689
  async start() {
43690
43690
  this.log.info("Medplum service starting...");
@@ -43704,7 +43704,7 @@ var App = class _App {
43704
43704
  if ((0, import_node_fs3.existsSync)(UPGRADE_MANIFEST_PATH)) {
43705
43705
  const upgradeFile = (0, import_node_fs3.readFileSync)(UPGRADE_MANIFEST_PATH, { encoding: "utf-8" });
43706
43706
  const upgradeDetails = JSON.parse(upgradeFile);
43707
- if (upgradeDetails.targetVersion === $r.split("-")[0]) {
43707
+ if (upgradeDetails.targetVersion === Gr.split("-")[0]) {
43708
43708
  await this.sendToWebSocket({
43709
43709
  type: "agent:upgrade:response",
43710
43710
  statusCode: 200,
@@ -43712,7 +43712,7 @@ var App = class _App {
43712
43712
  });
43713
43713
  this.log.info(`Successfully upgraded to version ${upgradeDetails.targetVersion}`);
43714
43714
  } else {
43715
- const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${$r}`;
43715
+ const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${Gr}`;
43716
43716
  await this.sendToWebSocket({
43717
43717
  type: "agent:error",
43718
43718
  body: errMsg,
@@ -43787,7 +43787,7 @@ var App = class _App {
43787
43787
  break;
43788
43788
  case "agent:heartbeat:request":
43789
43789
  this.outstandingHeartbeats = 0;
43790
- await this.sendToWebSocket({ type: "agent:heartbeat:response", version: $r });
43790
+ await this.sendToWebSocket({ type: "agent:heartbeat:response", version: Gr });
43791
43791
  break;
43792
43792
  case "agent:heartbeat:response":
43793
43793
  this.outstandingHeartbeats = 0;
@@ -44062,7 +44062,7 @@ IPv6 is currently unsupported.`;
44062
44062
  this.log.error(errMsg);
44063
44063
  throw new Error(errMsg);
44064
44064
  }
44065
- if (!((0, import_node_net3.isIPv4)(message.remote) || ll(message.remote))) {
44065
+ if (!((0, import_node_net3.isIPv4)(message.remote) || fl(message.remote))) {
44066
44066
  const errMsg = `Attempted to ping an invalid host.
44067
44067
 
44068
44068
  "${message.remote}" is not a valid IPv4 address or a resolvable hostname.`;
@@ -44125,7 +44125,7 @@ ${result}`);
44125
44125
  return;
44126
44126
  }
44127
44127
  let child;
44128
- if (message.version && !await _m("agent-upgrader", message.version)) {
44128
+ if (message.version && !await Fm("agent-upgrader", message.version)) {
44129
44129
  const versionTag = message.version ? `v${message.version}` : "latest";
44130
44130
  const errMsg = `Error during upgrading to version '${versionTag}'. '${message.version}' is not a valid version`;
44131
44131
  this.log.error(errMsg);
@@ -44172,12 +44172,12 @@ ${result}`);
44172
44172
  try {
44173
44173
  await this.stop();
44174
44174
  this.log.info("Successfully stopped agent network services");
44175
- const targetVersion = message.version ?? await Nm("agent-upgrader");
44176
- this.log.info("Writing upgrade manifest...", { previousVersion: $r, targetVersion });
44175
+ const targetVersion = message.version ?? await Um("agent-upgrader");
44176
+ this.log.info("Writing upgrade manifest...", { previousVersion: Gr, targetVersion });
44177
44177
  (0, import_node_fs3.writeFileSync)(
44178
44178
  UPGRADE_MANIFEST_PATH,
44179
44179
  JSON.stringify({
44180
- previousVersion: $r,
44180
+ previousVersion: Gr,
44181
44181
  targetVersion,
44182
44182
  callback: message.callback ?? null
44183
44183
  }),
@@ -44245,7 +44245,7 @@ ${result}`);
44245
44245
  });
44246
44246
  }
44247
44247
  }
44248
- client.sendAndWait(Yi.parse(message.body)).then((response) => {
44248
+ client.sendAndWait(Zi.parse(message.body)).then((response) => {
44249
44249
  this.log.info(`Response: ${response.toString().replaceAll("\r", "\n")}`);
44250
44250
  this.addToWebSocketQueue({
44251
44251
  type: "agent:transmit:response",
@@ -44314,7 +44314,7 @@ async function agentMain(argv) {
44314
44314
  const { baseUrl, clientId, clientSecret, agentId } = args;
44315
44315
  const medplum = new Lt({ baseUrl, clientId });
44316
44316
  await medplum.startClientLogin(clientId, clientSecret);
44317
- const app = new App(medplum, agentId, Tm(args.logLevel ?? "INFO"));
44317
+ const app = new App(medplum, agentId, bm(args.logLevel ?? "INFO"));
44318
44318
  await app.start();
44319
44319
  process.on("SIGINT", async () => {
44320
44320
  console.log("Gracefully shutting down from SIGINT (Ctrl-C)");
@@ -44342,7 +44342,7 @@ async function upgraderMain(argv) {
44342
44342
  if ((0, import_node_os4.platform)() !== "win32") {
44343
44343
  throw new Error(`Unsupported platform: ${(0, import_node_os4.platform)()}. Agent upgrader currently only supports Windows`);
44344
44344
  }
44345
- const globalLogger = new Zi((msg) => console.log(msg));
44345
+ const globalLogger = new Xi((msg) => console.log(msg));
44346
44346
  if (!import_node_process2.default.send) {
44347
44347
  globalLogger.error("Upgrader not started as a child process with Node IPC enabled. Aborting...");
44348
44348
  import_node_process2.default.exit(1);
@@ -44355,10 +44355,10 @@ async function upgraderMain(argv) {
44355
44355
  });
44356
44356
  });
44357
44357
  import_node_process2.default.send({ type: "STARTED" });
44358
- if (argv[3] && !hc(argv[3])) {
44358
+ if (argv[3] && !yc(argv[3])) {
44359
44359
  throw new Error("Invalid version specified");
44360
44360
  }
44361
- const version = argv[3] ?? await Nm("agent-upgrader");
44361
+ const version = argv[3] ?? await Um("agent-upgrader");
44362
44362
  const binPath = getReleaseBinPath(version);
44363
44363
  if (!(0, import_node_fs5.existsSync)(binPath)) {
44364
44364
  globalLogger.info(`Could not find binary at "${binPath}". Downloading release from GitHub...`);