@medplum/agent 2.0.31 → 2.1.0

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.
@@ -30,9 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  ));
31
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
32
 
33
- // ../../node_modules/ws/lib/stream.js
33
+ // node_modules/ws/lib/stream.js
34
34
  var require_stream = __commonJS({
35
- "../../node_modules/ws/lib/stream.js"(exports, module2) {
35
+ "node_modules/ws/lib/stream.js"(exports, module2) {
36
36
  "use strict";
37
37
  var { Duplex } = require("stream");
38
38
  function emitClose(stream) {
@@ -135,9 +135,9 @@ var require_stream = __commonJS({
135
135
  }
136
136
  });
137
137
 
138
- // ../../node_modules/ws/lib/constants.js
138
+ // node_modules/ws/lib/constants.js
139
139
  var require_constants = __commonJS({
140
- "../../node_modules/ws/lib/constants.js"(exports, module2) {
140
+ "node_modules/ws/lib/constants.js"(exports, module2) {
141
141
  "use strict";
142
142
  module2.exports = {
143
143
  BINARY_TYPES: ["nodebuffer", "arraybuffer", "fragments"],
@@ -153,9 +153,9 @@ var require_constants = __commonJS({
153
153
  }
154
154
  });
155
155
 
156
- // ../../node_modules/ws/lib/buffer-util.js
156
+ // node_modules/ws/lib/buffer-util.js
157
157
  var require_buffer_util = __commonJS({
158
- "../../node_modules/ws/lib/buffer-util.js"(exports, module2) {
158
+ "node_modules/ws/lib/buffer-util.js"(exports, module2) {
159
159
  "use strict";
160
160
  var { EMPTY_BUFFER } = require_constants();
161
161
  var FastBuffer = Buffer[Symbol.species];
@@ -235,9 +235,9 @@ var require_buffer_util = __commonJS({
235
235
  }
236
236
  });
237
237
 
238
- // ../../node_modules/ws/lib/limiter.js
238
+ // node_modules/ws/lib/limiter.js
239
239
  var require_limiter = __commonJS({
240
- "../../node_modules/ws/lib/limiter.js"(exports, module2) {
240
+ "node_modules/ws/lib/limiter.js"(exports, module2) {
241
241
  "use strict";
242
242
  var kDone = Symbol("kDone");
243
243
  var kRun = Symbol("kRun");
@@ -286,9 +286,9 @@ var require_limiter = __commonJS({
286
286
  }
287
287
  });
288
288
 
289
- // ../../node_modules/ws/lib/permessage-deflate.js
289
+ // node_modules/ws/lib/permessage-deflate.js
290
290
  var require_permessage_deflate = __commonJS({
291
- "../../node_modules/ws/lib/permessage-deflate.js"(exports, module2) {
291
+ "node_modules/ws/lib/permessage-deflate.js"(exports, module2) {
292
292
  "use strict";
293
293
  var zlib = require("zlib");
294
294
  var bufferUtil = require_buffer_util();
@@ -666,9 +666,9 @@ var require_permessage_deflate = __commonJS({
666
666
  }
667
667
  });
668
668
 
669
- // ../../node_modules/ws/lib/validation.js
669
+ // node_modules/ws/lib/validation.js
670
670
  var require_validation = __commonJS({
671
- "../../node_modules/ws/lib/validation.js"(exports, module2) {
671
+ "node_modules/ws/lib/validation.js"(exports, module2) {
672
672
  "use strict";
673
673
  var { isUtf8 } = require("buffer");
674
674
  var tokenChars = [
@@ -862,9 +862,9 @@ var require_validation = __commonJS({
862
862
  }
863
863
  });
864
864
 
865
- // ../../node_modules/ws/lib/receiver.js
865
+ // node_modules/ws/lib/receiver.js
866
866
  var require_receiver = __commonJS({
867
- "../../node_modules/ws/lib/receiver.js"(exports, module2) {
867
+ "node_modules/ws/lib/receiver.js"(exports, module2) {
868
868
  "use strict";
869
869
  var { Writable } = require("stream");
870
870
  var PerMessageDeflate = require_permessage_deflate();
@@ -1394,9 +1394,9 @@ var require_receiver = __commonJS({
1394
1394
  }
1395
1395
  });
1396
1396
 
1397
- // ../../node_modules/ws/lib/sender.js
1397
+ // node_modules/ws/lib/sender.js
1398
1398
  var require_sender = __commonJS({
1399
- "../../node_modules/ws/lib/sender.js"(exports, module2) {
1399
+ "node_modules/ws/lib/sender.js"(exports, module2) {
1400
1400
  "use strict";
1401
1401
  var net = require("net");
1402
1402
  var tls = require("tls");
@@ -1806,9 +1806,9 @@ var require_sender = __commonJS({
1806
1806
  }
1807
1807
  });
1808
1808
 
1809
- // ../../node_modules/ws/lib/event-target.js
1809
+ // node_modules/ws/lib/event-target.js
1810
1810
  var require_event_target = __commonJS({
1811
- "../../node_modules/ws/lib/event-target.js"(exports, module2) {
1811
+ "node_modules/ws/lib/event-target.js"(exports, module2) {
1812
1812
  "use strict";
1813
1813
  var { kForOnEventAttribute, kListener } = require_constants();
1814
1814
  var kCode = Symbol("kCode");
@@ -2035,9 +2035,9 @@ var require_event_target = __commonJS({
2035
2035
  }
2036
2036
  });
2037
2037
 
2038
- // ../../node_modules/ws/lib/extension.js
2038
+ // node_modules/ws/lib/extension.js
2039
2039
  var require_extension = __commonJS({
2040
- "../../node_modules/ws/lib/extension.js"(exports, module2) {
2040
+ "node_modules/ws/lib/extension.js"(exports, module2) {
2041
2041
  "use strict";
2042
2042
  var { tokenChars } = require_validation();
2043
2043
  function push(dest, name, elem) {
@@ -2205,9 +2205,9 @@ var require_extension = __commonJS({
2205
2205
  }
2206
2206
  });
2207
2207
 
2208
- // ../../node_modules/ws/lib/websocket.js
2208
+ // node_modules/ws/lib/websocket.js
2209
2209
  var require_websocket = __commonJS({
2210
- "../../node_modules/ws/lib/websocket.js"(exports, module2) {
2210
+ "node_modules/ws/lib/websocket.js"(exports, module2) {
2211
2211
  "use strict";
2212
2212
  var EventEmitter = require("events");
2213
2213
  var https = require("https");
@@ -3077,9 +3077,9 @@ var require_websocket = __commonJS({
3077
3077
  }
3078
3078
  });
3079
3079
 
3080
- // ../../node_modules/ws/lib/subprotocol.js
3080
+ // node_modules/ws/lib/subprotocol.js
3081
3081
  var require_subprotocol = __commonJS({
3082
- "../../node_modules/ws/lib/subprotocol.js"(exports, module2) {
3082
+ "node_modules/ws/lib/subprotocol.js"(exports, module2) {
3083
3083
  "use strict";
3084
3084
  var { tokenChars } = require_validation();
3085
3085
  function parse(header) {
@@ -3125,9 +3125,9 @@ var require_subprotocol = __commonJS({
3125
3125
  }
3126
3126
  });
3127
3127
 
3128
- // ../../node_modules/ws/lib/websocket-server.js
3128
+ // node_modules/ws/lib/websocket-server.js
3129
3129
  var require_websocket_server = __commonJS({
3130
- "../../node_modules/ws/lib/websocket-server.js"(exports, module2) {
3130
+ "node_modules/ws/lib/websocket-server.js"(exports, module2) {
3131
3131
  "use strict";
3132
3132
  var EventEmitter = require("events");
3133
3133
  var http = require("http");
@@ -3526,48 +3526,48 @@ __export(main_exports, {
3526
3526
  module.exports = __toCommonJS(main_exports);
3527
3527
 
3528
3528
  // ../core/dist/esm/index.mjs
3529
- var Ke = "ok";
3530
- var Je = "created";
3531
- var Xe = "not-modified";
3532
- var Ze = "not-found";
3533
- var me = "accepted";
3534
- var Ut = { resourceType: "OperationOutcome", id: Ze, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
3535
- function D(r4, e) {
3529
+ var Je = "ok";
3530
+ var Ye = "created";
3531
+ var Ze = "not-modified";
3532
+ var et = "not-found";
3533
+ var he = "accepted";
3534
+ var Lt = { resourceType: "OperationOutcome", id: et, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
3535
+ function I(r4, e) {
3536
3536
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r4 }, expression: e ? [e] : void 0 }] };
3537
3537
  }
3538
- function he(r4) {
3538
+ function ye(r4) {
3539
3539
  return typeof r4 == "object" && r4 !== null && r4.resourceType === "OperationOutcome";
3540
3540
  }
3541
- function et(r4) {
3542
- return r4.id === Ke || r4.id === Je || r4.id === Xe || r4.id === me;
3541
+ function tt(r4) {
3542
+ return r4.id === Je || r4.id === Ye || r4.id === Ze || r4.id === he;
3543
3543
  }
3544
3544
  var m = class extends Error {
3545
3545
  constructor(t, n) {
3546
- super(_t(t));
3546
+ super(Nt(t));
3547
3547
  this.outcome = t, this.cause = n;
3548
3548
  }
3549
3549
  };
3550
- function tt(r4) {
3551
- return r4 instanceof m ? r4.outcome : he(r4) ? r4 : D(Qr(r4));
3550
+ function rt(r4) {
3551
+ return r4 instanceof m ? r4.outcome : ye(r4) ? r4 : I(Gr(r4));
3552
3552
  }
3553
- function Qr(r4) {
3554
- return r4 ? typeof r4 == "string" ? r4 : r4 instanceof Error ? r4.message : he(r4) ? _t(r4) : typeof r4 == "object" && "code" in r4 && typeof r4.code == "string" ? r4.code : JSON.stringify(r4) : "Unknown error";
3553
+ function Gr(r4) {
3554
+ return r4 ? typeof r4 == "string" ? r4 : r4 instanceof Error ? r4.message : ye(r4) ? Nt(r4) : typeof r4 == "object" && "code" in r4 && typeof r4.code == "string" ? r4.code : JSON.stringify(r4) : "Unknown error";
3555
3555
  }
3556
- function _t(r4) {
3557
- let e = r4.issue?.map(Hr) ?? [];
3556
+ function Nt(r4) {
3557
+ let e = r4.issue?.map(zr) ?? [];
3558
3558
  return e.length > 0 ? e.join("; ") : "Unknown error";
3559
3559
  }
3560
- function Hr(r4) {
3560
+ function zr(r4) {
3561
3561
  let e = r4.details?.text ?? r4.diagnostics ?? "Unknown error";
3562
3562
  return r4.expression?.length && (e += ` (${r4.expression.join(", ")})`), e;
3563
3563
  }
3564
- var Bt = { types: { Element: { display: "Element", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] } } }, BackboneElement: { display: "BackboneElement", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] } } }, Address: { display: "Address", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: "*", 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: { display: "Age", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { display: "Annotation", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Attachment", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "CodeableConcept", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, coding: { max: "*", type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { display: "Coding", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { display: "ContactDetail", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: "*", type: [{ code: "ContactPoint" }] } } }, ContactPoint: { display: "ContactPoint", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { display: "Contributor", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: "*", type: [{ code: "ContactDetail" }] } } }, Count: { display: "Count", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { display: "DataRequirement", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: "*", 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: "*", type: [{ code: "string" }] }, codeFilter: { max: "*", type: [{ code: "Element" }] }, dateFilter: { max: "*", type: [{ code: "Element" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: "*", type: [{ code: "Element" }] } } }, DataRequirementCodeFilter: { display: "DataRequirementCodeFilter", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] }, code: { max: "*", type: [{ code: "Coding" }] } } }, DataRequirementDateFilter: { display: "DataRequirementDateFilter", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, "value[x]": { type: [{ code: "dateTime" }, { code: "Period" }, { code: "Duration" }] } } }, DataRequirementSort: { display: "DataRequirementSort", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, direction: { min: 1, type: [{ code: "code" }] } } }, Distance: { display: "Distance", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { display: "Dosage", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: "*", 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: "*", type: [{ code: "Element" }] }, 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: { display: "DosageDoseAndRate", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Duration", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { display: "ElementDefinition", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: "*", type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: "*", type: [{ code: "Coding" }] }, slicing: { type: [{ code: "Element" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: "*", type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "Element" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: "*", type: [{ code: "Element" }] }, "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: "*", type: [{ code: "Element" }] }, "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: "*", type: [{ code: "id" }] }, constraint: { max: "*", type: [{ code: "Element" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "Element" }] }, mapping: { max: "*", type: [{ code: "Element" }] } } }, ElementDefinitionSlicing: { display: "ElementDefinitionSlicing", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, discriminator: { max: "*", type: [{ code: "Element" }] }, description: { type: [{ code: "string" }] }, ordered: { type: [{ code: "boolean" }] }, rules: { min: 1, type: [{ code: "code" }] } } }, ElementDefinitionSlicingDiscriminator: { display: "ElementDefinitionSlicingDiscriminator", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, path: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionBase: { display: "ElementDefinitionBase", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, min: { min: 1, type: [{ code: "unsignedInt" }] }, max: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionType: { display: "ElementDefinitionType", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "uri" }] }, profile: { max: "*", type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, targetProfile: { max: "*", type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, aggregation: { max: "*", type: [{ code: "code" }] }, versioning: { type: [{ code: "code" }] } } }, ElementDefinitionExample: { display: "ElementDefinitionExample", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "ElementDefinitionConstraint", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "ElementDefinitionBinding", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "ElementDefinitionMapping", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, identity: { min: 1, type: [{ code: "id" }] }, language: { type: [{ code: "code" }] }, map: { min: 1, type: [{ code: "string" }] }, comment: { type: [{ code: "string" }] } } }, Expression: { display: "Expression", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Extension", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "string" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { display: "HumanName", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: "*", type: [{ code: "string" }] }, prefix: { max: "*", type: [{ code: "string" }] }, suffix: { max: "*", type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { display: "Identifier", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "MarketingStatus", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", 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: { display: "Meta", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: "*", type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: "*", type: [{ code: "Coding" }] }, tag: { max: "*", type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, compartment: { max: "*", type: [{ code: "Reference" }] } } }, Money: { display: "Money", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { display: "Narrative", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { display: "ParameterDefinition", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Period", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { display: "Population", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { display: "ProdCharacteristic", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", 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: "*", type: [{ code: "string" }] }, imprint: { max: "*", type: [{ code: "string" }] }, image: { max: "*", type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { display: "ProductShelfLife", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: "*", type: [{ code: "CodeableConcept" }] } } }, Quantity: { display: "Quantity", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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" }] } } }, Range: { display: "Range", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Ratio", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { display: "Reference", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { display: "RelatedArtifact", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "SampledData", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Signature", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, type: { min: 1, max: "*", 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: { display: "SubstanceAmount", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "Element" }] } } }, SubstanceAmountReferenceRange: { display: "SubstanceAmountReferenceRange", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, lowLimit: { type: [{ code: "Quantity" }] }, highLimit: { type: [{ code: "Quantity" }] } } }, Timing: { display: "Timing", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, event: { max: "*", type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "Element" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TimingRepeat: { display: "TimingRepeat", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: "*", type: [{ code: "code" }] }, timeOfDay: { max: "*", type: [{ code: "time" }] }, when: { max: "*", type: [{ code: "code" }] }, offset: { type: [{ code: "unsignedInt" }] } } }, TriggerDefinition: { display: "TriggerDefinition", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: "*", type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { display: "UsageContext", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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"] }] } } }, MetadataResource: { display: "MetadataResource", properties: { id: { type: [{ code: "string" }] }, meta: { type: [{ code: "Meta" }] }, implicitRules: { type: [{ code: "uri" }] }, language: { type: [{ code: "code" }] }, text: { type: [{ code: "Narrative" }] }, contained: { max: "*", type: [{ code: "Resource" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, url: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, name: { type: [{ code: "string" }] }, title: { type: [{ code: "string" }] }, status: { min: 1, type: [{ code: "code" }] }, experimental: { type: [{ code: "boolean" }] }, date: { type: [{ code: "dateTime" }] }, publisher: { type: [{ code: "string" }] }, contact: { max: "*", type: [{ code: "ContactDetail" }] }, description: { type: [{ code: "markdown" }] }, useContext: { max: "*", type: [{ code: "UsageContext" }] }, jurisdiction: { max: "*", type: [{ code: "CodeableConcept" }] } } }, IdentityProvider: { display: "IdentityProvider", properties: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, useSubject: { type: [{ code: "boolean" }] } } } } };
3565
- function Ft(r4, e) {
3564
+ var Ft = { types: { Element: { display: "Element", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] } } }, BackboneElement: { display: "BackboneElement", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] } } }, Address: { display: "Address", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: "*", 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: { display: "Age", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { display: "Annotation", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Attachment", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "CodeableConcept", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, coding: { max: "*", type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { display: "Coding", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { display: "ContactDetail", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: "*", type: [{ code: "ContactPoint" }] } } }, ContactPoint: { display: "ContactPoint", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { display: "Contributor", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: "*", type: [{ code: "ContactDetail" }] } } }, Count: { display: "Count", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { display: "DataRequirement", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: "*", 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: "*", type: [{ code: "string" }] }, codeFilter: { max: "*", type: [{ code: "Element" }] }, dateFilter: { max: "*", type: [{ code: "Element" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: "*", type: [{ code: "Element" }] } } }, DataRequirementCodeFilter: { display: "DataRequirementCodeFilter", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] }, code: { max: "*", type: [{ code: "Coding" }] } } }, DataRequirementDateFilter: { display: "DataRequirementDateFilter", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, "value[x]": { type: [{ code: "dateTime" }, { code: "Period" }, { code: "Duration" }] } } }, DataRequirementSort: { display: "DataRequirementSort", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, direction: { min: 1, type: [{ code: "code" }] } } }, Distance: { display: "Distance", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { display: "Dosage", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: "*", 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: "*", type: [{ code: "Element" }] }, 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: { display: "DosageDoseAndRate", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Duration", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { display: "ElementDefinition", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: "*", type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: "*", type: [{ code: "Coding" }] }, slicing: { type: [{ code: "Element" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: "*", type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "Element" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: "*", type: [{ code: "Element" }] }, "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: "*", type: [{ code: "Element" }] }, "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: "*", type: [{ code: "id" }] }, constraint: { max: "*", type: [{ code: "Element" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "Element" }] }, mapping: { max: "*", type: [{ code: "Element" }] } } }, ElementDefinitionSlicing: { display: "ElementDefinitionSlicing", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, discriminator: { max: "*", type: [{ code: "Element" }] }, description: { type: [{ code: "string" }] }, ordered: { type: [{ code: "boolean" }] }, rules: { min: 1, type: [{ code: "code" }] } } }, ElementDefinitionSlicingDiscriminator: { display: "ElementDefinitionSlicingDiscriminator", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, path: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionBase: { display: "ElementDefinitionBase", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, min: { min: 1, type: [{ code: "unsignedInt" }] }, max: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionType: { display: "ElementDefinitionType", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "uri" }] }, profile: { max: "*", type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, targetProfile: { max: "*", type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, aggregation: { max: "*", type: [{ code: "code" }] }, versioning: { type: [{ code: "code" }] } } }, ElementDefinitionExample: { display: "ElementDefinitionExample", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "ElementDefinitionConstraint", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "ElementDefinitionBinding", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "ElementDefinitionMapping", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, identity: { min: 1, type: [{ code: "id" }] }, language: { type: [{ code: "code" }] }, map: { min: 1, type: [{ code: "string" }] }, comment: { type: [{ code: "string" }] } } }, Expression: { display: "Expression", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Extension", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "string" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { display: "HumanName", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: "*", type: [{ code: "string" }] }, prefix: { max: "*", type: [{ code: "string" }] }, suffix: { max: "*", type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { display: "Identifier", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "MarketingStatus", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", 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: { display: "Meta", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: "*", type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: "*", type: [{ code: "Coding" }] }, tag: { max: "*", type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, compartment: { max: "*", type: [{ code: "Reference" }] } } }, Money: { display: "Money", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { display: "Narrative", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { display: "ParameterDefinition", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Period", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { display: "Population", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { display: "ProdCharacteristic", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", 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: "*", type: [{ code: "string" }] }, imprint: { max: "*", type: [{ code: "string" }] }, image: { max: "*", type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { display: "ProductShelfLife", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: "*", type: [{ code: "CodeableConcept" }] } } }, Quantity: { display: "Quantity", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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" }] } } }, Range: { display: "Range", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Ratio", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { display: "Reference", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { display: "RelatedArtifact", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "SampledData", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Signature", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, type: { min: 1, max: "*", 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: { display: "SubstanceAmount", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "Element" }] } } }, SubstanceAmountReferenceRange: { display: "SubstanceAmountReferenceRange", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, lowLimit: { type: [{ code: "Quantity" }] }, highLimit: { type: [{ code: "Quantity" }] } } }, Timing: { display: "Timing", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, event: { max: "*", type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "Element" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TimingRepeat: { display: "TimingRepeat", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: "*", type: [{ code: "code" }] }, timeOfDay: { max: "*", type: [{ code: "time" }] }, when: { max: "*", type: [{ code: "code" }] }, offset: { type: [{ code: "unsignedInt" }] } } }, TriggerDefinition: { display: "TriggerDefinition", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: "*", type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { display: "UsageContext", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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"] }] } } }, MetadataResource: { display: "MetadataResource", properties: { id: { type: [{ code: "string" }] }, meta: { type: [{ code: "Meta" }] }, implicitRules: { type: [{ code: "uri" }] }, language: { type: [{ code: "code" }] }, text: { type: [{ code: "Narrative" }] }, contained: { max: "*", type: [{ code: "Resource" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, url: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, name: { type: [{ code: "string" }] }, title: { type: [{ code: "string" }] }, status: { min: 1, type: [{ code: "code" }] }, experimental: { type: [{ code: "boolean" }] }, date: { type: [{ code: "dateTime" }] }, publisher: { type: [{ code: "string" }] }, contact: { max: "*", type: [{ code: "ContactDetail" }] }, description: { type: [{ code: "markdown" }] }, useContext: { max: "*", type: [{ code: "UsageContext" }] }, jurisdiction: { max: "*", type: [{ code: "CodeableConcept" }] } } }, IdentityProvider: { display: "IdentityProvider", properties: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, useSubject: { type: [{ code: "boolean" }] } } } } };
3565
+ function qt(r4, e) {
3566
3566
  let t = [];
3567
3567
  return r4.prefix && e?.prefix !== false && t.push(...r4.prefix), r4.given && t.push(...r4.given), r4.family && t.push(r4.family), r4.suffix && e?.suffix !== false && t.push(...r4.suffix), r4.use && (e?.all || e?.use) && t.push("[" + r4.use + "]"), t.join(" ").trim();
3568
3568
  }
3569
3569
  function ie(r4) {
3570
- let e = $t(r4), t = on(r4);
3570
+ let e = $t(r4), t = cn(r4);
3571
3571
  return t === e ? { reference: e } : { reference: e, display: t };
3572
3572
  }
3573
3573
  function $t(r4) {
@@ -3576,33 +3576,33 @@ function $t(r4) {
3576
3576
  function Ro(r4) {
3577
3577
  return r4?.reference?.split("/")[1];
3578
3578
  }
3579
- function nn(r4) {
3579
+ function an(r4) {
3580
3580
  return r4.resourceType === "Patient" || r4.resourceType === "Practitioner" || r4.resourceType === "RelatedPerson";
3581
3581
  }
3582
- function on(r4) {
3583
- if (nn(r4)) {
3584
- let e = sn(r4);
3582
+ function cn(r4) {
3583
+ if (an(r4)) {
3584
+ let e = un(r4);
3585
3585
  if (e)
3586
3586
  return e;
3587
3587
  }
3588
3588
  if (r4.resourceType === "Device") {
3589
- let e = an(r4);
3589
+ let e = dn(r4);
3590
3590
  if (e)
3591
3591
  return e;
3592
3592
  }
3593
3593
  return r4.resourceType === "Observation" && "code" in r4 && r4.code?.text ? r4.code.text : r4.resourceType === "User" && r4.email ? r4.email : "name" in r4 && r4.name && typeof r4.name == "string" ? r4.name : $t(r4);
3594
3594
  }
3595
- function sn(r4) {
3595
+ function un(r4) {
3596
3596
  let e = r4.name;
3597
3597
  if (e && e.length > 0)
3598
- return Ft(e[0]);
3598
+ return qt(e[0]);
3599
3599
  }
3600
- function an(r4) {
3600
+ function dn(r4) {
3601
3601
  let e = r4.deviceName;
3602
3602
  if (e && e.length > 0)
3603
3603
  return e[0].name;
3604
3604
  }
3605
- function ye(r4, e) {
3605
+ function ge(r4, e) {
3606
3606
  let t = new Date(r4);
3607
3607
  t.setUTCHours(0, 0, 0, 0);
3608
3608
  let n = e ? new Date(e) : /* @__PURE__ */ new Date();
@@ -3611,16 +3611,16 @@ function ye(r4, e) {
3611
3611
  (c2 < o || c2 === o && p2 < s) && l2--;
3612
3612
  let ne = a * 12 + c2 - (i2 * 12 + o);
3613
3613
  p2 < s && ne--;
3614
- let fe = Math.floor((n.getTime() - t.getTime()) / (1e3 * 60 * 60 * 24));
3615
- return { years: l2, months: ne, days: fe };
3614
+ let me = Math.floor((n.getTime() - t.getTime()) / (1e3 * 60 * 60 * 24));
3615
+ return { years: l2, months: ne, days: me };
3616
3616
  }
3617
- function Wt(r4, e) {
3618
- return JSON.stringify(r4, cn, e ? 2 : void 0);
3617
+ function zt(r4, e) {
3618
+ return JSON.stringify(r4, ln, e ? 2 : void 0);
3619
3619
  }
3620
- function cn(r4, e) {
3621
- return !un(r4) && b(e) ? void 0 : e;
3620
+ function ln(r4, e) {
3621
+ return !pn(r4) && b(e) ? void 0 : e;
3622
3622
  }
3623
- function un(r4) {
3623
+ function pn(r4) {
3624
3624
  return !!/\d+$/.exec(r4);
3625
3625
  }
3626
3626
  function b(r4) {
@@ -3629,19 +3629,19 @@ function b(r4) {
3629
3629
  let e = typeof r4;
3630
3630
  return e === "string" && r4 === "" || e === "object" && Object.keys(r4).length === 0;
3631
3631
  }
3632
- function zt(r4) {
3632
+ function Jt(r4) {
3633
3633
  return r4.every((e) => typeof e == "string");
3634
3634
  }
3635
- var Kt = [];
3635
+ var Yt = [];
3636
3636
  for (let r4 = 0; r4 < 256; r4++)
3637
- Kt.push(r4.toString(16).padStart(2, "0"));
3638
- function Jt(r4) {
3637
+ Yt.push(r4.toString(16).padStart(2, "0"));
3638
+ function Xt(r4) {
3639
3639
  let e = new Uint8Array(r4), t = new Array(e.length);
3640
3640
  for (let n = 0; n < e.length; n++)
3641
- t[n] = Kt[e[n]];
3641
+ t[n] = Yt[e[n]];
3642
3642
  return t.join("");
3643
3643
  }
3644
- function Yt(r4) {
3644
+ function Zt(r4) {
3645
3645
  let e = new Uint8Array(r4), t = [];
3646
3646
  for (let n = 0; n < e.length; n++)
3647
3647
  t[n] = String.fromCharCode(e[n]);
@@ -3650,17 +3650,22 @@ function Yt(r4) {
3650
3650
  function S(r4) {
3651
3651
  return r4.charAt(0).toUpperCase() + r4.substring(1);
3652
3652
  }
3653
- var st = (r4) => new Promise((e) => {
3653
+ var at = (r4) => new Promise((e) => {
3654
3654
  setTimeout(e, r4);
3655
3655
  });
3656
3656
  var j = ((u2) => (u2.Address = "Address", u2.Age = "Age", u2.Annotation = "Annotation", u2.Attachment = "Attachment", u2.BackboneElement = "BackboneElement", u2.CodeableConcept = "CodeableConcept", u2.Coding = "Coding", u2.ContactDetail = "ContactDetail", u2.ContactPoint = "ContactPoint", u2.Contributor = "Contributor", u2.Count = "Count", u2.DataRequirement = "DataRequirement", u2.Distance = "Distance", u2.Dosage = "Dosage", u2.Duration = "Duration", u2.Expression = "Expression", u2.Extension = "Extension", u2.HumanName = "HumanName", u2.Identifier = "Identifier", u2.MarketingStatus = "MarketingStatus", u2.Meta = "Meta", u2.Money = "Money", u2.Narrative = "Narrative", u2.ParameterDefinition = "ParameterDefinition", u2.Period = "Period", u2.Population = "Population", u2.ProdCharacteristic = "ProdCharacteristic", u2.ProductShelfLife = "ProductShelfLife", u2.Quantity = "Quantity", u2.Range = "Range", u2.Ratio = "Ratio", u2.Reference = "Reference", u2.RelatedArtifact = "RelatedArtifact", u2.SampledData = "SampledData", u2.Signature = "Signature", u2.SubstanceAmount = "SubstanceAmount", u2.SystemString = "http://hl7.org/fhirpath/System.String", u2.Timing = "Timing", u2.TriggerDefinition = "TriggerDefinition", u2.UsageContext = "UsageContext", u2.base64Binary = "base64Binary", u2.boolean = "boolean", u2.canonical = "canonical", u2.code = "code", u2.date = "date", u2.dateTime = "dateTime", u2.decimal = "decimal", u2.id = "id", u2.instant = "instant", u2.integer = "integer", u2.markdown = "markdown", u2.oid = "oid", u2.positiveInt = "positiveInt", u2.string = "string", u2.time = "time", u2.unsignedInt = "unsignedInt", u2.uri = "uri", u2.url = "url", u2.uuid = "uuid", u2))(j || {});
3657
- function at(r4) {
3657
+ function ct(r4) {
3658
3658
  if (!r4.name)
3659
3659
  return;
3660
3660
  let t = r4.snapshot?.element;
3661
- t && (t.forEach((n) => Tn(r4, n)), t.forEach((n) => vn(r4, n)));
3661
+ if (t) {
3662
+ for (let n of t)
3663
+ Sn(r4, n);
3664
+ for (let n of t)
3665
+ Rn(r4, n);
3666
+ }
3662
3667
  }
3663
- function Tn(r4, e) {
3668
+ function Sn(r4, e) {
3664
3669
  let t = e.path, n = e.type?.[0]?.code;
3665
3670
  if (n !== void 0 && n !== "Element" && n !== "BackboneElement")
3666
3671
  return;
@@ -3669,7 +3674,7 @@ function Tn(r4, e) {
3669
3674
  let o = L(i2), s = y.types[o];
3670
3675
  s || (y.types[o] = s = {}), s.parentType = s.parentType ?? L(i2.slice(0, i2.length - 1)), s.display = s.display ?? o, s.structureDefinition = s.structureDefinition ?? r4, s.elementDefinition = s.elementDefinition ?? e, s.description = s.description ?? e.definition, s.properties = s.properties ?? {};
3671
3676
  }
3672
- function vn(r4, e) {
3677
+ function Rn(r4, e) {
3673
3678
  let n = e.path.split(".");
3674
3679
  if (n.length === 1)
3675
3680
  return;
@@ -3680,7 +3685,7 @@ function vn(r4, e) {
3680
3685
  let s = n[n.length - 1];
3681
3686
  o.properties[s] = e;
3682
3687
  }
3683
- function ct(r4) {
3688
+ function ut(r4) {
3684
3689
  for (let e of r4.base ?? []) {
3685
3690
  let t = y.types[e];
3686
3691
  t && (t.searchParams || (t.searchParams = { _id: { base: [e], code: "_id", type: "token", expression: e + ".id" }, _lastUpdated: { base: [e], code: "_lastUpdated", type: "date", expression: e + ".meta.lastUpdated" }, _compartment: { base: [e], code: "_compartment", type: "reference", expression: e + ".meta.compartment" }, _profile: { base: [e], code: "_profile", type: "uri", expression: e + ".meta.profile" }, _security: { base: [e], code: "_security", type: "token", expression: e + ".meta.security" }, _source: { base: [e], code: "_source", type: "uri", expression: e + ".meta.source" }, _tag: { base: [e], code: "_tag", type: "token", expression: e + ".meta.tag" } }), t.searchParams[r4.code] = r4);
@@ -3705,9 +3710,9 @@ function oe(r4, e) {
3705
3710
  function _(r4) {
3706
3711
  return !!(r4 && typeof r4 == "object" && "resourceType" in r4);
3707
3712
  }
3708
- var y = Bt;
3709
- var An = ((g) => (g.EQUALS = "eq", g.NOT_EQUALS = "ne", g.GREATER_THAN = "gt", g.LESS_THAN = "lt", g.GREATER_THAN_OR_EQUALS = "ge", g.LESS_THAN_OR_EQUALS = "le", g.STARTS_AFTER = "sa", g.ENDS_BEFORE = "eb", g.APPROXIMATELY = "ap", g.CONTAINS = "contains", g.EXACT = "exact", g.TEXT = "text", g.NOT = "not", g.ABOVE = "above", g.BELOW = "below", g.IN = "in", g.NOT_IN = "not-in", g.OF_TYPE = "of-type", g.MISSING = "missing", g.IDENTIFIER = "identifier", g.ITERATE = "iterate", g))(An || {});
3710
- var be = class {
3713
+ var y = Ft;
3714
+ var Cn = ((g) => (g.EQUALS = "eq", g.NOT_EQUALS = "ne", g.GREATER_THAN = "gt", g.LESS_THAN = "lt", g.GREATER_THAN_OR_EQUALS = "ge", g.LESS_THAN_OR_EQUALS = "le", g.STARTS_AFTER = "sa", g.ENDS_BEFORE = "eb", g.APPROXIMATELY = "ap", g.CONTAINS = "contains", g.EXACT = "exact", g.TEXT = "text", g.NOT = "not", g.ABOVE = "above", g.BELOW = "below", g.IN = "in", g.NOT_IN = "not-in", g.OF_TYPE = "of-type", g.MISSING = "missing", g.IDENTIFIER = "identifier", g.ITERATE = "iterate", g))(Cn || {});
3715
+ var Se = class {
3711
3716
  constructor(e, t) {
3712
3717
  this.operator = e;
3713
3718
  this.child = t;
@@ -3716,7 +3721,7 @@ var be = class {
3716
3721
  return `${this.operator}(${this.child.toString()})`;
3717
3722
  }
3718
3723
  };
3719
- var $ = class {
3724
+ var Q = class {
3720
3725
  constructor(e, t, n) {
3721
3726
  this.operator = e;
3722
3727
  this.left = t;
@@ -3726,7 +3731,7 @@ var $ = class {
3726
3731
  return `${this.left.toString()} ${this.operator} ${this.right.toString()}`;
3727
3732
  }
3728
3733
  };
3729
- var Se = class {
3734
+ var Re = class {
3730
3735
  constructor() {
3731
3736
  this.prefixParselets = {};
3732
3737
  this.infixParselets = {};
@@ -3750,10 +3755,10 @@ var Se = class {
3750
3755
  }, precedence: t });
3751
3756
  }
3752
3757
  construct(e) {
3753
- return new dt(e, this.prefixParselets, this.infixParselets);
3758
+ return new lt(e, this.prefixParselets, this.infixParselets);
3754
3759
  }
3755
3760
  };
3756
- var dt = class {
3761
+ var lt = class {
3757
3762
  constructor(e, t, n) {
3758
3763
  this.tokens = e, this.prefixParselets = t, this.infixParselets = n;
3759
3764
  }
@@ -3835,9 +3840,9 @@ function P(r4, e) {
3835
3840
  if (!r4.value)
3836
3841
  return;
3837
3842
  let t = oe(r4.type, e);
3838
- return t ? Nn(r4, e, t) : Mn(r4, e);
3843
+ return t ? Fn(r4, e, t) : qn(r4, e);
3839
3844
  }
3840
- function Nn(r4, e, t) {
3845
+ function Fn(r4, e, t) {
3841
3846
  let n = t.type;
3842
3847
  if (!n || n.length === 0)
3843
3848
  return;
@@ -3853,13 +3858,13 @@ function Nn(r4, e, t) {
3853
3858
  }
3854
3859
  }
3855
3860
  let s = r4.value["_" + e];
3856
- if (s && (Array.isArray(i2) ? i2 = i2.map((a, c2) => s[c2] ? lr(a ?? {}, s[c2]) : a) : i2 = lr(i2 ?? {}, s)), !b(i2))
3857
- return (o === "Element" || o === "BackboneElement") && (o = L(t.path?.split("."))), Array.isArray(i2) ? i2.map((a) => cr(a, o)) : cr(i2, o);
3861
+ if (s && (Array.isArray(i2) ? i2 = i2.map((a, c2) => s[c2] ? fr(a ?? {}, s[c2]) : a) : i2 = fr(i2 ?? {}, s)), !b(i2))
3862
+ return (o === "Element" || o === "BackboneElement") && (o = L(t.path?.split("."))), Array.isArray(i2) ? i2.map((a) => dr(a, o)) : dr(i2, o);
3858
3863
  }
3859
- function cr(r4, e) {
3864
+ function dr(r4, e) {
3860
3865
  return e === "Resource" && _(r4) && (e = r4.resourceType), { type: e, value: r4 };
3861
3866
  }
3862
- function Mn(r4, e) {
3867
+ function qn(r4, e) {
3863
3868
  let t = r4.value;
3864
3869
  if (!t || typeof t != "object")
3865
3870
  return;
@@ -3877,12 +3882,12 @@ function Mn(r4, e) {
3877
3882
  if (!b(n))
3878
3883
  return Array.isArray(n) ? n.map(T) : T(n);
3879
3884
  }
3880
- function Re(r4) {
3885
+ function Ae(r4) {
3881
3886
  let e = [];
3882
3887
  for (let t of r4) {
3883
3888
  let n = false;
3884
3889
  for (let i2 of e)
3885
- if (N(pr(t, i2))) {
3890
+ if (N(mr(t, i2))) {
3886
3891
  n = true;
3887
3892
  break;
3888
3893
  }
@@ -3890,28 +3895,28 @@ function Re(r4) {
3890
3895
  }
3891
3896
  return e;
3892
3897
  }
3893
- function lt(r4) {
3898
+ function pt(r4) {
3894
3899
  return d(!N(r4));
3895
3900
  }
3896
- function pt(r4, e) {
3897
- return r4.length === 0 || e.length === 0 ? [] : r4.length !== e.length ? d(false) : d(r4.every((t, n) => N(pr(t, e[n]))));
3901
+ function ft(r4, e) {
3902
+ return r4.length === 0 || e.length === 0 ? [] : r4.length !== e.length ? d(false) : d(r4.every((t, n) => N(mr(t, e[n]))));
3898
3903
  }
3899
- function pr(r4, e) {
3904
+ function mr(r4, e) {
3900
3905
  let t = r4.value?.valueOf(), n = e.value?.valueOf();
3901
- return typeof t == "number" && typeof n == "number" ? d(Math.abs(t - n) < 1e-8) : A(t) && A(n) ? d(fr(t, n)) : d(typeof t == "object" && typeof n == "object" ? mt(r4, e) : t === n);
3906
+ return typeof t == "number" && typeof n == "number" ? d(Math.abs(t - n) < 1e-8) : A(t) && A(n) ? d(hr(t, n)) : d(typeof t == "object" && typeof n == "object" ? ht(r4, e) : t === n);
3902
3907
  }
3903
- function ft(r4, e) {
3904
- return r4.length === 0 && e.length === 0 ? d(true) : r4.length !== e.length ? d(false) : (r4.sort(ur), e.sort(ur), d(r4.every((t, n) => N(Bn(t, e[n])))));
3908
+ function mt(r4, e) {
3909
+ return r4.length === 0 && e.length === 0 ? d(true) : r4.length !== e.length ? d(false) : (r4.sort(lr), e.sort(lr), d(r4.every((t, n) => N(jn(t, e[n])))));
3905
3910
  }
3906
- function Bn(r4, e) {
3911
+ function jn(r4, e) {
3907
3912
  let { type: t, value: n } = r4, { type: i2, value: o } = e, s = n?.valueOf(), a = o?.valueOf();
3908
- return typeof s == "number" && typeof a == "number" ? d(Math.abs(s - a) < 0.01) : A(s) && A(a) ? d(fr(s, a)) : d(t === "Coding" && i2 === "Coding" ? typeof s != "object" || typeof a != "object" ? false : s.code === a.code && s.system === a.system : typeof s == "object" && typeof a == "object" ? mt({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
3913
+ return typeof s == "number" && typeof a == "number" ? d(Math.abs(s - a) < 0.01) : A(s) && A(a) ? d(hr(s, a)) : d(t === "Coding" && i2 === "Coding" ? typeof s != "object" || typeof a != "object" ? false : s.code === a.code && s.system === a.system : typeof s == "object" && typeof a == "object" ? ht({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
3909
3914
  }
3910
- function ur(r4, e) {
3915
+ function lr(r4, e) {
3911
3916
  let t = r4.value?.valueOf(), n = e.value?.valueOf();
3912
3917
  return typeof t == "number" && typeof n == "number" ? t - n : typeof t == "string" && typeof n == "string" ? t.localeCompare(n) : 0;
3913
3918
  }
3914
- function Ae(r4, e) {
3919
+ function Ee(r4, e) {
3915
3920
  let { value: t } = r4;
3916
3921
  if (t == null)
3917
3922
  return false;
@@ -3928,40 +3933,40 @@ function Ae(r4, e) {
3928
3933
  case "Time":
3929
3934
  return typeof t == "string" && !!/^T\d/.exec(t);
3930
3935
  case "Period":
3931
- return Fn(t);
3936
+ return Qn(t);
3932
3937
  case "Quantity":
3933
3938
  return A(t);
3934
3939
  default:
3935
3940
  return typeof t == "object" && t?.resourceType === e;
3936
3941
  }
3937
3942
  }
3938
- function Fn(r4) {
3943
+ function Qn(r4) {
3939
3944
  return !!(r4 && typeof r4 == "object" && "start" in r4);
3940
3945
  }
3941
3946
  function A(r4) {
3942
3947
  return !!(r4 && typeof r4 == "object" && "value" in r4 && typeof r4.value == "number");
3943
3948
  }
3944
- function fr(r4, e) {
3949
+ function hr(r4, e) {
3945
3950
  return Math.abs(r4.value - e.value) < 0.01 && (r4.unit === e.unit || r4.code === e.code || r4.unit === e.code || r4.code === e.unit);
3946
3951
  }
3947
- function mt(r4, e) {
3952
+ function ht(r4, e) {
3948
3953
  let t = Object.keys(r4), n = Object.keys(e);
3949
3954
  if (t.length !== n.length)
3950
3955
  return false;
3951
3956
  for (let i2 of t) {
3952
3957
  let o = r4[i2], s = e[i2];
3953
- if (dr(o) && dr(s)) {
3954
- if (!mt(o, s))
3958
+ if (pr(o) && pr(s)) {
3959
+ if (!ht(o, s))
3955
3960
  return false;
3956
3961
  } else if (o !== s)
3957
3962
  return false;
3958
3963
  }
3959
3964
  return true;
3960
3965
  }
3961
- function dr(r4) {
3966
+ function pr(r4) {
3962
3967
  return r4 !== null && typeof r4 == "object";
3963
3968
  }
3964
- function lr(r4, e) {
3969
+ function fr(r4, e) {
3965
3970
  return delete e.__proto__, delete e.constructor, Object.assign(r4, e);
3966
3971
  }
3967
3972
  var se = () => [];
@@ -4022,7 +4027,7 @@ var R = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
4022
4027
  if (!t)
4023
4028
  return e;
4024
4029
  let n = t.eval(r4, e);
4025
- return Re([...e, ...n]);
4030
+ return Ae([...e, ...n]);
4026
4031
  }, combine: (r4, e, t) => {
4027
4032
  if (!t)
4028
4033
  return e;
@@ -4102,11 +4107,11 @@ var R = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
4102
4107
  let a = i2.eval(r4, e)[0]?.value;
4103
4108
  if (a !== "years" && a !== "months" && a !== "days")
4104
4109
  throw new Error("Invalid units");
4105
- let c2 = ye(o[0].value, s[0].value);
4110
+ let c2 = ge(o[0].value, s[0].value);
4106
4111
  return [{ type: "Quantity", value: { value: c2[a], unit: a } }];
4107
4112
  }, is: (r4, e, t) => {
4108
4113
  let n = "";
4109
- return t instanceof M ? n = t.name : t instanceof H && (n = t.left.name + "." + t.right.name), n ? e.map((i2) => ({ type: "boolean", value: Ae(i2, n) })) : [];
4114
+ return t instanceof M ? n = t.name : t instanceof H && (n = t.left.name + "." + t.right.name), n ? e.map((i2) => ({ type: "boolean", value: Ee(i2, n) })) : [];
4110
4115
  }, not: (r4, e) => R.toBoolean(r4, e).map((t) => ({ type: "boolean", value: !t.value })), resolve: (r4, e) => e.map((t) => {
4111
4116
  let n = t.value, i2;
4112
4117
  if (typeof n == "string")
@@ -4195,7 +4200,7 @@ var M = class {
4195
4200
  return this.name;
4196
4201
  }
4197
4202
  };
4198
- var Pe = class {
4203
+ var Ce = class {
4199
4204
  eval() {
4200
4205
  return [];
4201
4206
  }
@@ -4203,7 +4208,7 @@ var Pe = class {
4203
4208
  return "{}";
4204
4209
  }
4205
4210
  };
4206
- var Ce = class extends be {
4211
+ var we = class extends Se {
4207
4212
  constructor(t, n, i2) {
4208
4213
  super(t, n);
4209
4214
  this.impl = i2;
@@ -4215,7 +4220,7 @@ var Ce = class extends be {
4215
4220
  return this.operator + this.child.toString();
4216
4221
  }
4217
4222
  };
4218
- var z = class extends $ {
4223
+ var z = class extends Q {
4219
4224
  constructor(e, t) {
4220
4225
  super("as", e, t);
4221
4226
  }
@@ -4223,7 +4228,7 @@ var z = class extends $ {
4223
4228
  return R.ofType(e, this.left.eval(e, t), this.right);
4224
4229
  }
4225
4230
  };
4226
- var v = class extends $ {
4231
+ var v = class extends Q {
4227
4232
  };
4228
4233
  var E = class extends v {
4229
4234
  constructor(t, n, i2, o) {
@@ -4241,7 +4246,7 @@ var E = class extends v {
4241
4246
  return typeof l2 == "boolean" ? d(l2) : A(s) ? [{ type: "Quantity", value: { ...s, value: l2 } }] : [T(l2)];
4242
4247
  }
4243
4248
  };
4244
- var we = class extends $ {
4249
+ var ke = class extends Q {
4245
4250
  constructor(e, t) {
4246
4251
  super("&", e, t);
4247
4252
  }
@@ -4250,7 +4255,7 @@ var we = class extends $ {
4250
4255
  return o.length > 0 && o.every((s) => typeof s.value == "string") ? [{ type: "string", value: o.map((s) => s.value).join("") }] : o;
4251
4256
  }
4252
4257
  };
4253
- var ke = class extends v {
4258
+ var Ie = class extends v {
4254
4259
  constructor(e, t) {
4255
4260
  super("contains", e, t);
4256
4261
  }
@@ -4268,7 +4273,7 @@ var De = class extends v {
4268
4273
  return n ? d(i2.some((o) => o.value === n.value)) : [];
4269
4274
  }
4270
4275
  };
4271
- var H = class extends $ {
4276
+ var H = class extends Q {
4272
4277
  constructor(e, t) {
4273
4278
  super(".", e, t);
4274
4279
  }
@@ -4279,49 +4284,49 @@ var H = class extends $ {
4279
4284
  return `${this.left.toString()}.${this.right.toString()}`;
4280
4285
  }
4281
4286
  };
4282
- var ee = class extends $ {
4287
+ var ee = class extends Q {
4283
4288
  constructor(e, t) {
4284
4289
  super("|", e, t);
4285
4290
  }
4286
4291
  eval(e, t) {
4287
4292
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
4288
- return Re([...n, ...i2]);
4293
+ return Ae([...n, ...i2]);
4289
4294
  }
4290
4295
  };
4291
- var Ie = class extends v {
4296
+ var Oe = class extends v {
4292
4297
  constructor(e, t) {
4293
4298
  super("=", e, t);
4294
4299
  }
4295
4300
  eval(e, t) {
4296
4301
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
4297
- return pt(n, i2);
4302
+ return ft(n, i2);
4298
4303
  }
4299
4304
  };
4300
- var Oe = class extends v {
4305
+ var Ve = class extends v {
4301
4306
  constructor(e, t) {
4302
4307
  super("!=", e, t);
4303
4308
  }
4304
4309
  eval(e, t) {
4305
4310
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
4306
- return lt(pt(n, i2));
4311
+ return pt(ft(n, i2));
4307
4312
  }
4308
4313
  };
4309
- var Ve = class extends v {
4314
+ var Ue = class extends v {
4310
4315
  constructor(e, t) {
4311
4316
  super("~", e, t);
4312
4317
  }
4313
4318
  eval(e, t) {
4314
4319
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
4315
- return ft(n, i2);
4320
+ return mt(n, i2);
4316
4321
  }
4317
4322
  };
4318
- var Ue = class extends v {
4323
+ var Le = class extends v {
4319
4324
  constructor(e, t) {
4320
4325
  super("!~", e, t);
4321
4326
  }
4322
4327
  eval(e, t) {
4323
4328
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
4324
- return lt(ft(n, i2));
4329
+ return pt(mt(n, i2));
4325
4330
  }
4326
4331
  };
4327
4332
  var K = class extends v {
@@ -4333,10 +4338,10 @@ var K = class extends v {
4333
4338
  if (n.length !== 1)
4334
4339
  return [];
4335
4340
  let i2 = this.right.name;
4336
- return d(Ae(n[0], i2));
4341
+ return d(Ee(n[0], i2));
4337
4342
  }
4338
4343
  };
4339
- var Le = class extends v {
4344
+ var _e = class extends v {
4340
4345
  constructor(e, t) {
4341
4346
  super("and", e, t);
4342
4347
  }
@@ -4345,7 +4350,7 @@ var Le = class extends v {
4345
4350
  return n?.value === true && i2?.value === true ? d(true) : n?.value === false || i2?.value === false ? d(false) : [];
4346
4351
  }
4347
4352
  };
4348
- var _e = class extends v {
4353
+ var Ne = class extends v {
4349
4354
  constructor(e, t) {
4350
4355
  super("or", e, t);
4351
4356
  }
@@ -4354,7 +4359,7 @@ var _e = class extends v {
4354
4359
  return n?.value === false && i2?.value === false ? d(false) : n?.value || i2?.value ? d(true) : [];
4355
4360
  }
4356
4361
  };
4357
- var Ne = class extends v {
4362
+ var Me = class extends v {
4358
4363
  constructor(e, t) {
4359
4364
  super("xor", e, t);
4360
4365
  }
@@ -4363,7 +4368,7 @@ var Ne = class extends v {
4363
4368
  return !n || !i2 ? [] : d(n.value !== i2.value);
4364
4369
  }
4365
4370
  };
4366
- var Me = class extends v {
4371
+ var Be = class extends v {
4367
4372
  constructor(e, t) {
4368
4373
  super("implies", e, t);
4369
4374
  }
@@ -4408,19 +4413,19 @@ var J = class {
4408
4413
  };
4409
4414
  var ce = ["!=", "!~", "<=", ">=", "{}", "->"];
4410
4415
  var f = { 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 };
4411
- var qn = { parse(r4) {
4416
+ var $n = { parse(r4) {
4412
4417
  let e = r4.consumeAndParse();
4413
4418
  if (!r4.match(")"))
4414
4419
  throw new Error("Parse error: expected `)` got `" + r4.peek()?.value + "`");
4415
4420
  return e;
4416
4421
  } };
4417
- var jn = { parse(r4, e) {
4422
+ var Hn = { parse(r4, e) {
4418
4423
  let t = r4.consumeAndParse();
4419
4424
  if (!r4.match("]"))
4420
4425
  throw new Error("Parse error: expected `]`");
4421
4426
  return new J(e, t);
4422
4427
  }, precedence: f.Indexer };
4423
- var $n = { parse(r4, e) {
4428
+ var Wn = { parse(r4, e) {
4424
4429
  if (!(e instanceof M))
4425
4430
  throw new Error("Unexpected parentheses");
4426
4431
  let t = [];
@@ -4428,38 +4433,38 @@ var $n = { parse(r4, e) {
4428
4433
  t.push(r4.consumeAndParse()), r4.match(",");
4429
4434
  return new B(e.name, t);
4430
4435
  }, precedence: f.FunctionCall };
4431
- function Qn(r4) {
4436
+ function Gn(r4) {
4432
4437
  let e = r4.split(" "), t = parseFloat(e[0]), n = e[1];
4433
4438
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
4434
4439
  }
4435
4440
  function ue() {
4436
- return new Se().registerPrefix("String", { parse: (r4, e) => new k({ type: "string", value: e.value }) }).registerPrefix("DateTime", { parse: (r4, e) => new k({ type: "dateTime", value: Z(e.value) }) }).registerPrefix("Quantity", { parse: (r4, e) => new k({ type: "Quantity", value: Qn(e.value) }) }).registerPrefix("Number", { parse: (r4, e) => new k({ type: "decimal", value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new k({ type: "boolean", value: true }) }).registerPrefix("false", { parse: () => new k({ type: "boolean", value: false }) }).registerPrefix("Symbol", { parse: (r4, e) => new M(e.value) }).registerPrefix("{}", { parse: () => new Pe() }).registerPrefix("(", qn).registerInfix("[", jn).registerInfix("(", $n).prefix("+", f.UnaryAdd, (r4, e) => new Ce("+", e, (t) => t)).prefix("-", f.UnarySubtract, (r4, e) => new E("-", e, e, (t, n) => -n)).infixLeft(".", f.Dot, (r4, e, t) => new H(r4, t)).infixLeft("/", f.Divide, (r4, e, t) => new E("/", r4, t, (n, i2) => n / i2)).infixLeft("*", f.Multiply, (r4, e, t) => new E("*", r4, t, (n, i2) => n * i2)).infixLeft("+", f.Add, (r4, e, t) => new E("+", r4, t, (n, i2) => n + i2)).infixLeft("-", f.Subtract, (r4, e, t) => new E("-", r4, t, (n, i2) => n - i2)).infixLeft("|", f.Union, (r4, e, t) => new ee(r4, t)).infixLeft("=", f.Equals, (r4, e, t) => new Ie(r4, t)).infixLeft("!=", f.NotEquals, (r4, e, t) => new Oe(r4, t)).infixLeft("~", f.Equivalent, (r4, e, t) => new Ve(r4, t)).infixLeft("!~", f.NotEquivalent, (r4, e, t) => new Ue(r4, t)).infixLeft("<", f.LessThan, (r4, e, t) => new E("<", r4, t, (n, i2) => n < i2)).infixLeft("<=", f.LessThanOrEquals, (r4, e, t) => new E("<=", r4, t, (n, i2) => n <= i2)).infixLeft(">", f.GreaterThan, (r4, e, t) => new E(">", r4, t, (n, i2) => n > i2)).infixLeft(">=", f.GreaterThanOrEquals, (r4, e, t) => new E(">=", r4, t, (n, i2) => n >= i2)).infixLeft("&", f.Ampersand, (r4, e, t) => new we(r4, t)).infixLeft("and", f.And, (r4, e, t) => new Le(r4, t)).infixLeft("as", f.As, (r4, e, t) => new z(r4, t)).infixLeft("contains", f.Contains, (r4, e, t) => new ke(r4, t)).infixLeft("div", f.Divide, (r4, e, t) => new E("div", r4, t, (n, i2) => n / i2 | 0)).infixLeft("in", f.In, (r4, e, t) => new De(r4, t)).infixLeft("is", f.Is, (r4, e, t) => new K(r4, t)).infixLeft("mod", f.Modulo, (r4, e, t) => new E("mod", r4, t, (n, i2) => n % i2)).infixLeft("or", f.Or, (r4, e, t) => new _e(r4, t)).infixLeft("xor", f.Xor, (r4, e, t) => new Ne(r4, t)).infixLeft("implies", f.Implies, (r4, e, t) => new Me(r4, t));
4441
+ return new Re().registerPrefix("String", { parse: (r4, e) => new k({ type: "string", value: e.value }) }).registerPrefix("DateTime", { parse: (r4, e) => new k({ type: "dateTime", value: Z(e.value) }) }).registerPrefix("Quantity", { parse: (r4, e) => new k({ type: "Quantity", value: Gn(e.value) }) }).registerPrefix("Number", { parse: (r4, e) => new k({ type: "decimal", value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new k({ type: "boolean", value: true }) }).registerPrefix("false", { parse: () => new k({ type: "boolean", value: false }) }).registerPrefix("Symbol", { parse: (r4, e) => new M(e.value) }).registerPrefix("{}", { parse: () => new Ce() }).registerPrefix("(", $n).registerInfix("[", Hn).registerInfix("(", Wn).prefix("+", f.UnaryAdd, (r4, e) => new we("+", e, (t) => t)).prefix("-", f.UnarySubtract, (r4, e) => new E("-", e, e, (t, n) => -n)).infixLeft(".", f.Dot, (r4, e, t) => new H(r4, t)).infixLeft("/", f.Divide, (r4, e, t) => new E("/", r4, t, (n, i2) => n / i2)).infixLeft("*", f.Multiply, (r4, e, t) => new E("*", r4, t, (n, i2) => n * i2)).infixLeft("+", f.Add, (r4, e, t) => new E("+", r4, t, (n, i2) => n + i2)).infixLeft("-", f.Subtract, (r4, e, t) => new E("-", r4, t, (n, i2) => n - i2)).infixLeft("|", f.Union, (r4, e, t) => new ee(r4, t)).infixLeft("=", f.Equals, (r4, e, t) => new Oe(r4, t)).infixLeft("!=", f.NotEquals, (r4, e, t) => new Ve(r4, t)).infixLeft("~", f.Equivalent, (r4, e, t) => new Ue(r4, t)).infixLeft("!~", f.NotEquivalent, (r4, e, t) => new Le(r4, t)).infixLeft("<", f.LessThan, (r4, e, t) => new E("<", r4, t, (n, i2) => n < i2)).infixLeft("<=", f.LessThanOrEquals, (r4, e, t) => new E("<=", r4, t, (n, i2) => n <= i2)).infixLeft(">", f.GreaterThan, (r4, e, t) => new E(">", r4, t, (n, i2) => n > i2)).infixLeft(">=", f.GreaterThanOrEquals, (r4, e, t) => new E(">=", r4, t, (n, i2) => n >= i2)).infixLeft("&", f.Ampersand, (r4, e, t) => new ke(r4, t)).infixLeft("and", f.And, (r4, e, t) => new _e(r4, t)).infixLeft("as", f.As, (r4, e, t) => new z(r4, t)).infixLeft("contains", f.Contains, (r4, e, t) => new Ie(r4, t)).infixLeft("div", f.Divide, (r4, e, t) => new E("div", r4, t, (n, i2) => n / i2 | 0)).infixLeft("in", f.In, (r4, e, t) => new De(r4, t)).infixLeft("is", f.Is, (r4, e, t) => new K(r4, t)).infixLeft("mod", f.Modulo, (r4, e, t) => new E("mod", r4, t, (n, i2) => n % i2)).infixLeft("or", f.Or, (r4, e, t) => new Ne(r4, t)).infixLeft("xor", f.Xor, (r4, e, t) => new Me(r4, t)).infixLeft("implies", f.Implies, (r4, e, t) => new Be(r4, t));
4437
4442
  }
4438
- var Hn = ue();
4439
- var hr = ((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))(hr || {});
4440
- var ci = ((x) => (x.READ = "read", x.VREAD = "vread", x.UPDATE = "update", x.PATCH = "patch", x.DELETE = "delete", x.HISTORY = "history", x.HISTORY_INSTANCE = "history-instance", x.HISTORY_TYPE = "history-type", x.HISTORY_SYSTEM = "history-system", x.CREATE = "create", x.SEARCH = "search", x.SEARCH_TYPE = "search-type", x.SEARCH_SYSTEM = "search-system", x.SEARCH_COMPARTMENT = "search-compartment", x.CAPABILITIES = "capabilities", x.TRANSACTION = "transaction", x.BATCH = "batch", x.OPERATION = "operation", x))(ci || {});
4441
- function Sr(r4) {
4443
+ var zn = ue();
4444
+ var gr = ((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))(gr || {});
4445
+ var di = ((x) => (x.READ = "read", x.VREAD = "vread", x.UPDATE = "update", x.PATCH = "patch", x.DELETE = "delete", x.HISTORY = "history", x.HISTORY_INSTANCE = "history-instance", x.HISTORY_TYPE = "history-type", x.HISTORY_SYSTEM = "history-system", x.CREATE = "create", x.SEARCH = "search", x.SEARCH_TYPE = "search-type", x.SEARCH_SYSTEM = "search-system", x.SEARCH_COMPARTMENT = "search-compartment", x.CAPABILITIES = "capabilities", x.TRANSACTION = "transaction", x.BATCH = "batch", x.OPERATION = "operation", x))(di || {});
4446
+ function Ar(r4) {
4442
4447
  if (typeof window < "u")
4443
4448
  return window.atob(r4);
4444
4449
  if (typeof Buffer < "u")
4445
4450
  return Buffer.from(r4, "base64").toString("binary");
4446
4451
  throw new Error("Unable to decode base64");
4447
4452
  }
4448
- function Rr(r4) {
4453
+ function Er(r4) {
4449
4454
  if (typeof window < "u")
4450
4455
  return window.btoa(r4);
4451
4456
  if (typeof Buffer < "u")
4452
4457
  return Buffer.from(r4, "binary").toString("base64");
4453
4458
  throw new Error("Unable to encode base64");
4454
4459
  }
4455
- function vt() {
4460
+ function bt() {
4456
4461
  let r4 = new Uint32Array(28);
4457
- return crypto.getRandomValues(r4), Jt(r4.buffer);
4462
+ return crypto.getRandomValues(r4), Xt(r4.buffer);
4458
4463
  }
4459
- async function Ar(r4) {
4464
+ async function Pr(r4) {
4460
4465
  return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r4));
4461
4466
  }
4462
- var Fe = class {
4467
+ var qe = class {
4463
4468
  constructor(e = 10) {
4464
4469
  this.max = e, this.cache = /* @__PURE__ */ new Map();
4465
4470
  }
@@ -4484,7 +4489,7 @@ var Fe = class {
4484
4489
  }
4485
4490
  };
4486
4491
  var Y = { CSS: "text/css", 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", SVG: "image/svg+xml", TEXT: "text/plain", TYPESCRIPT: "text/typescript" };
4487
- var qe = class {
4492
+ var je = class {
4488
4493
  constructor() {
4489
4494
  this.listeners = {};
4490
4495
  }
@@ -4506,28 +4511,31 @@ var qe = class {
4506
4511
  return t && t.forEach((n) => n.call(this, e)), !e.defaultPrevented;
4507
4512
  }
4508
4513
  };
4509
- function yi(r4) {
4510
- let e = r4.replace(/-/g, "+").replace(/_/g, "/"), t = Sr(e), n = Array.from(t).reduce((o, s) => {
4514
+ function xi(r4) {
4515
+ let e = r4.replace(/-/g, "+").replace(/_/g, "/"), t = Ar(e), n = Array.from(t).reduce((o, s) => {
4511
4516
  let a = ("00" + s.charCodeAt(0).toString(16)).slice(-2);
4512
4517
  return `${o}%${a}`;
4513
4518
  }, ""), i2 = decodeURIComponent(n);
4514
4519
  return JSON.parse(i2);
4515
4520
  }
4516
- function bt(r4) {
4521
+ function kr(r4) {
4522
+ return r4.split(".").length === 3;
4523
+ }
4524
+ function St(r4) {
4517
4525
  let [e, t, n] = r4.split(".");
4518
- return yi(t);
4526
+ return xi(t);
4519
4527
  }
4520
- function Cr(r4) {
4528
+ function Ir(r4) {
4521
4529
  try {
4522
- return typeof bt(r4).login_id == "string";
4530
+ return typeof St(r4).login_id == "string";
4523
4531
  } catch {
4524
4532
  return false;
4525
4533
  }
4526
4534
  }
4527
- var gi;
4535
+ var Ti;
4528
4536
  var w = class {
4529
4537
  constructor(e) {
4530
- this[gi] = "ReadablePromise";
4538
+ this[Ti] = "ReadablePromise";
4531
4539
  this.status = "pending";
4532
4540
  this.suspender = e.then((t) => (this.status = "success", this.response = t, t), (t) => {
4533
4541
  throw this.status = "error", this.error = t, t;
@@ -4559,10 +4567,10 @@ var w = class {
4559
4567
  return this.suspender.finally(e);
4560
4568
  }
4561
4569
  };
4562
- gi = Symbol.toStringTag;
4563
- var je = class {
4570
+ Ti = Symbol.toStringTag;
4571
+ var Qe = class {
4564
4572
  constructor() {
4565
- this.storage = typeof localStorage < "u" ? localStorage : new St();
4573
+ this.storage = typeof localStorage < "u" ? localStorage : new Rt();
4566
4574
  }
4567
4575
  clear() {
4568
4576
  this.storage.clear();
@@ -4578,10 +4586,10 @@ var je = class {
4578
4586
  return t ? JSON.parse(t) : void 0;
4579
4587
  }
4580
4588
  setObject(e, t) {
4581
- this.setString(e, t ? Wt(t) : void 0);
4589
+ this.setString(e, t ? zt(t) : void 0);
4582
4590
  }
4583
4591
  };
4584
- var St = class {
4592
+ var Rt = class {
4585
4593
  constructor() {
4586
4594
  this.data = /* @__PURE__ */ new Map();
4587
4595
  }
@@ -4604,19 +4612,19 @@ var St = class {
4604
4612
  return Array.from(this.data.keys())[e];
4605
4613
  }
4606
4614
  };
4607
- var xi = "https://api.medplum.com/";
4608
- var Ti = 1e3;
4609
- var vi = 6e4;
4610
- var wr = "Binary/";
4611
- var kr = { resourceType: "Device", id: "system", deviceName: [{ name: "System" }] };
4612
- var bi = ((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))(bi || {});
4613
- var Si = ((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))(Si || {});
4614
- var Dr = class extends qe {
4615
+ var vi = "https://api.medplum.com/";
4616
+ var bi = 1e3;
4617
+ var Si = 6e4;
4618
+ var Dr = "Binary/";
4619
+ var Or = { resourceType: "Device", id: "system", deviceName: [{ name: "System" }] };
4620
+ var Ri = ((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))(Ri || {});
4621
+ var Ai = ((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))(Ai || {});
4622
+ var Vr = class extends je {
4615
4623
  constructor(t) {
4616
4624
  super();
4617
4625
  if (t?.baseUrl && !t.baseUrl.startsWith("http"))
4618
4626
  throw new Error("Base URL must start with http or https");
4619
- this.fetch = t?.fetch ?? Ri(), this.storage = t?.storage ?? new je(), this.createPdfImpl = t?.createPdf, this.baseUrl = Or(t?.baseUrl) ?? xi, this.fhirBaseUrl = this.baseUrl + (Or(t?.fhirUrlPath) ?? "fhir/R4/"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.authorizeUrl = t?.authorizeUrl ?? this.baseUrl + "oauth2/authorize", this.tokenUrl = t?.tokenUrl ?? this.baseUrl + "oauth2/token", this.logoutUrl = t?.logoutUrl ?? this.baseUrl + "oauth2/logout", this.onUnauthenticated = t?.onUnauthenticated, this.cacheTime = t?.cacheTime ?? vi, this.cacheTime > 0 ? this.requestCache = new Fe(t?.resourceCacheSize ?? Ti) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0);
4627
+ this.fetch = t?.fetch ?? Ei(), this.storage = t?.storage ?? new Qe(), this.createPdfImpl = t?.createPdf, this.baseUrl = Lr(t?.baseUrl) ?? vi, this.fhirBaseUrl = this.baseUrl + (Lr(t?.fhirUrlPath) ?? "fhir/R4/"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.authorizeUrl = t?.authorizeUrl ?? this.baseUrl + "oauth2/authorize", this.tokenUrl = t?.tokenUrl ?? this.baseUrl + "oauth2/token", this.logoutUrl = t?.logoutUrl ?? this.baseUrl + "oauth2/logout", this.onUnauthenticated = t?.onUnauthenticated, this.cacheTime = t?.cacheTime ?? Si, this.cacheTime > 0 ? this.requestCache = new qe(t?.resourceCacheSize ?? bi) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0);
4620
4628
  let n = this.getActiveLogin();
4621
4629
  n && (this.setAccessToken(n.accessToken, n.refreshToken), this.refreshProfile().catch(console.log)), this.setupStorageListener();
4622
4630
  }
@@ -4710,8 +4718,13 @@ var Dr = class extends qe {
4710
4718
  return i2.set("grant_type", "urn:ietf:params:oauth:grant-type:token-exchange"), i2.set("subject_token_type", "urn:ietf:params:oauth:token-type:access_token"), i2.set("client_id", n), i2.set("subject_token", t), this.fetchTokens(i2);
4711
4719
  }
4712
4720
  getExternalAuthRedirectUri(t, n, i2, o) {
4713
- let s = new URL(t);
4714
- return s.searchParams.set("response_type", "code"), s.searchParams.set("client_id", n), s.searchParams.set("redirect_uri", i2), s.searchParams.set("scope", "openid profile email"), s.searchParams.set("state", JSON.stringify(o)), s.toString();
4721
+ let { codeChallenge: s, codeChallengeMethod: a } = o;
4722
+ if (!a)
4723
+ throw new Error("`LoginRequest` for external auth must include a `codeChallengeMethod`.");
4724
+ if (!s)
4725
+ throw new Error("`LoginRequest` for external auth must include a `codeChallenge`.");
4726
+ let c2 = new URL(t);
4727
+ return c2.searchParams.set("response_type", "code"), c2.searchParams.set("client_id", n), c2.searchParams.set("redirect_uri", i2), c2.searchParams.set("scope", "openid profile email"), c2.searchParams.set("state", JSON.stringify(o)), c2.searchParams.set("code_challenge_method", a), c2.searchParams.set("code_challenge", s), c2.toString();
4715
4728
  }
4716
4729
  fhirUrl(...t) {
4717
4730
  return new URL(this.fhirBaseUrl + t.join("/"));
@@ -4746,7 +4759,7 @@ var Dr = class extends qe {
4746
4759
  let s = this.fhirSearchUrl(t, n).toString() + "-searchResources", a = this.getCacheEntry(s, i2);
4747
4760
  if (a)
4748
4761
  return a.value;
4749
- let c2 = new w(this.search(t, n, i2).then(Ur));
4762
+ let c2 = new w(this.search(t, n, i2).then(Nr));
4750
4763
  return this.setCacheEntry(s, c2), c2;
4751
4764
  }
4752
4765
  async *searchResourcePages(t, n, i2) {
@@ -4755,7 +4768,7 @@ var Dr = class extends qe {
4755
4768
  let s = new URL(o).searchParams, a = await this.search(t, s, i2), c2 = a.link?.find((p2) => p2.relation === "next");
4756
4769
  if (!a.entry?.length && !c2)
4757
4770
  break;
4758
- yield Ur(a), o = c2?.url ? new URL(c2.url) : void 0;
4771
+ yield Nr(a), o = c2?.url ? new URL(c2.url) : void 0;
4759
4772
  }
4760
4773
  }
4761
4774
  searchValueSet(t, n, i2) {
@@ -4771,7 +4784,7 @@ var Dr = class extends qe {
4771
4784
  if (!n)
4772
4785
  return;
4773
4786
  if (n === "system")
4774
- return kr;
4787
+ return Or;
4775
4788
  let [i2, o] = n.split("/");
4776
4789
  if (!(!i2 || !o))
4777
4790
  return this.getCached(i2, o);
@@ -4784,7 +4797,7 @@ var Dr = class extends qe {
4784
4797
  if (!i2)
4785
4798
  return new w(Promise.reject(new Error("Missing reference")));
4786
4799
  if (i2 === "system")
4787
- return new w(Promise.resolve(kr));
4800
+ return new w(Promise.resolve(Or));
4788
4801
  let [o, s] = i2.split("/");
4789
4802
  return !o || !s ? new w(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
4790
4803
  }
@@ -4828,9 +4841,9 @@ var Dr = class extends qe {
4828
4841
  }
4829
4842
  }`.replace(/\s+/g, " "), a = await this.graphql(s);
4830
4843
  for (let c2 of a.data.StructureDefinitionList)
4831
- at(c2);
4832
- for (let c2 of a.data.SearchParameterList)
4833
4844
  ct(c2);
4845
+ for (let c2 of a.data.SearchParameterList)
4846
+ ut(c2);
4834
4847
  return y;
4835
4848
  })());
4836
4849
  return this.setCacheEntry(n, o), o;
@@ -4929,7 +4942,7 @@ var Dr = class extends qe {
4929
4942
  return this.accessToken;
4930
4943
  }
4931
4944
  setAccessToken(t, n) {
4932
- this.accessToken = t, this.refreshToken = n, this.sessionDetails = void 0, this.medplumServer = Cr(t);
4945
+ this.accessToken = t, this.refreshToken = n, this.sessionDetails = void 0, this.medplumServer = Ir(t);
4933
4946
  }
4934
4947
  getLogins() {
4935
4948
  return this.storage.getObject("logins") ?? [];
@@ -4974,14 +4987,14 @@ var Dr = class extends qe {
4974
4987
  }
4975
4988
  normalizeFetchUrl(t) {
4976
4989
  let n = t.toString();
4977
- return n.startsWith(wr) && (n = this.fhirUrl(n).toString()), n;
4990
+ return n.startsWith(Dr) && (n = this.fhirUrl(n).toString()), n;
4978
4991
  }
4979
4992
  async download(t, n = {}) {
4980
4993
  return this.refreshPromise && await this.refreshPromise, this.addFetchOptionsDefaults(n), (await this.fetch(this.normalizeFetchUrl(t), n)).blob();
4981
4994
  }
4982
4995
  async uploadMedia(t, n, i2, o, s) {
4983
4996
  let a = await this.createBinary(t, i2, n);
4984
- return this.createResource({ ...o, resourceType: "Media", content: { contentType: n, url: wr + a.id, title: i2 } }, s);
4997
+ return this.createResource({ ...o, resourceType: "Media", content: { contentType: n, url: Dr + a.id, title: i2 } }, s);
4985
4998
  }
4986
4999
  async bulkExport(t = "", n, i2, o) {
4987
5000
  let s = t && `${t}/`, a = this.fhirUrl(`${s}$export`);
@@ -4993,7 +5006,7 @@ var Dr = class extends qe {
4993
5006
  i2.Prefer = "respond-async";
4994
5007
  let o = await this.fetchWithRetry(t, n);
4995
5008
  if (o.status === 202) {
4996
- let s = await Vr(o);
5009
+ let s = await _r(o);
4997
5010
  if (s)
4998
5011
  return this.pollStatus(s);
4999
5012
  }
@@ -5027,19 +5040,22 @@ var Dr = class extends qe {
5027
5040
  return;
5028
5041
  let a = t.headers.get("content-type")?.includes("json");
5029
5042
  if (t.status === 404 && !a)
5030
- throw new m(Ut);
5031
- let c2;
5043
+ throw new m(Lt);
5044
+ let c2 = t.headers.get("content-location");
5045
+ if (t.status === 201 && c2 && o.redirect === "follow")
5046
+ return this.request("GET", c2, { ...o, body: void 0 });
5047
+ let p2;
5032
5048
  if (a)
5033
5049
  try {
5034
- c2 = await t.json();
5035
- } catch (p2) {
5036
- throw console.error("Error parsing response", t.status, p2), p2;
5050
+ p2 = await t.json();
5051
+ } catch (l2) {
5052
+ throw console.error("Error parsing response", t.status, l2), l2;
5037
5053
  }
5038
5054
  else
5039
- c2 = await t.text();
5055
+ p2 = await t.text();
5040
5056
  if (t.status >= 400)
5041
- throw new m(tt(c2));
5042
- return c2;
5057
+ throw new m(rt(p2));
5058
+ return p2;
5043
5059
  }
5044
5060
  async fetchWithRetry(t, n) {
5045
5061
  t.startsWith("http") || (t = new URL(t, this.baseUrl).href);
@@ -5051,7 +5067,7 @@ var Dr = class extends qe {
5051
5067
  } catch (c2) {
5052
5068
  this.retryCatch(a, i2, c2);
5053
5069
  }
5054
- await st(o);
5070
+ await at(o);
5055
5071
  }
5056
5072
  return s;
5057
5073
  }
@@ -5062,10 +5078,10 @@ var Dr = class extends qe {
5062
5078
  this.addFetchOptionsDefaults(s);
5063
5079
  let a = await this.fetchWithRetry(t, s);
5064
5080
  if (a.status !== 202 && (n = false, i2 = a, a.status === 201)) {
5065
- let c2 = await Vr(a);
5081
+ let c2 = await _r(a);
5066
5082
  c2 && (i2 = await this.fetchWithRetry(c2, s));
5067
5083
  }
5068
- await st(o);
5084
+ await at(o);
5069
5085
  }
5070
5086
  return this.parseResponse(i2, "POST", t);
5071
5087
  }
@@ -5076,14 +5092,14 @@ var Dr = class extends qe {
5076
5092
  try {
5077
5093
  o.resolve(await this.request(o.method, this.fhirBaseUrl + o.url, o.options));
5078
5094
  } catch (s) {
5079
- o.reject(new m(tt(s)));
5095
+ o.reject(new m(rt(s)));
5080
5096
  }
5081
5097
  return;
5082
5098
  }
5083
5099
  let n = { resourceType: "Bundle", type: "batch", entry: t.map((o) => ({ request: { method: o.method, url: o.url }, resource: o.options.body ? JSON.parse(o.options.body) : void 0 })) }, i2 = await this.post(this.fhirBaseUrl.slice(0, -1), n);
5084
5100
  for (let o = 0; o < t.length; o++) {
5085
5101
  let s = t[o], a = i2.entry?.[o];
5086
- a?.response?.outcome && !et(a.response.outcome) ? s.reject(new m(a.response.outcome)) : s.resolve(a?.resource);
5102
+ a?.response?.outcome && !tt(a.response.outcome) ? s.reject(new m(a.response.outcome)) : s.resolve(a?.resource);
5087
5103
  }
5088
5104
  }
5089
5105
  addFetchOptionsDefaults(t) {
@@ -5102,20 +5118,20 @@ var Dr = class extends qe {
5102
5118
  return this.refresh() ? this.request(t, n, i2) : (this.clearActiveLogin(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new Error("Unauthenticated")));
5103
5119
  }
5104
5120
  async startPkce() {
5105
- let t = vt();
5121
+ let t = bt();
5106
5122
  sessionStorage.setItem("pkceState", t);
5107
- let n = vt();
5123
+ let n = bt();
5108
5124
  sessionStorage.setItem("codeVerifier", n);
5109
- let i2 = await Ar(n), o = Yt(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
5125
+ let i2 = await Pr(n), o = Zt(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
5110
5126
  return sessionStorage.setItem("codeChallenge", o), { codeChallengeMethod: "S256", codeChallenge: o };
5111
5127
  }
5112
5128
  async requestAuthorization(t) {
5113
5129
  let n = await this.ensureCodeChallenge(t ?? {}), i2 = new URL(this.authorizeUrl);
5114
- i2.searchParams.set("response_type", "code"), i2.searchParams.set("state", sessionStorage.getItem("pkceState")), i2.searchParams.set("client_id", n.clientId ?? this.clientId), i2.searchParams.set("redirect_uri", n.redirectUri ?? Ir()), i2.searchParams.set("code_challenge_method", n.codeChallengeMethod), i2.searchParams.set("code_challenge", n.codeChallenge), i2.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i2.toString());
5130
+ i2.searchParams.set("response_type", "code"), i2.searchParams.set("state", sessionStorage.getItem("pkceState")), i2.searchParams.set("client_id", n.clientId ?? this.clientId), i2.searchParams.set("redirect_uri", n.redirectUri ?? Ur()), i2.searchParams.set("code_challenge_method", n.codeChallengeMethod), i2.searchParams.set("code_challenge", n.codeChallenge), i2.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i2.toString());
5115
5131
  }
5116
5132
  processCode(t, n) {
5117
5133
  let i2 = new URLSearchParams();
5118
- if (i2.set("grant_type", "authorization_code"), i2.set("code", t), i2.set("client_id", n?.clientId ?? this.clientId), i2.set("redirect_uri", n?.redirectUri ?? Ir()), typeof sessionStorage < "u") {
5134
+ if (i2.set("grant_type", "authorization_code"), i2.set("code", t), i2.set("client_id", n?.clientId ?? this.clientId), i2.set("redirect_uri", n?.redirectUri ?? Ur()), typeof sessionStorage < "u") {
5119
5135
  let o = sessionStorage.getItem("codeVerifier");
5120
5136
  o && i2.set("code_verifier", o);
5121
5137
  }
@@ -5142,7 +5158,7 @@ var Dr = class extends qe {
5142
5158
  return o.set("grant_type", "urn:ietf:params:oauth:grant-type:jwt-bearer"), o.set("client_id", t), o.set("assertion", n), o.set("scope", i2), this.fetchTokens(o);
5143
5159
  }
5144
5160
  setBasicAuth(t, n) {
5145
- this.clientId = t, this.clientSecret = n, this.basicAuth = Rr(t + ":" + n);
5161
+ this.clientId = t, this.clientSecret = n, this.basicAuth = Er(t + ":" + n);
5146
5162
  }
5147
5163
  async invite(t, n) {
5148
5164
  return this.post("admin/projects/" + t + "/invite", n);
@@ -5155,23 +5171,26 @@ var Dr = class extends qe {
5155
5171
  this.clearActiveLogin();
5156
5172
  try {
5157
5173
  let a = await o.json();
5158
- throw new m(D(a.error_description));
5174
+ throw new m(I(a.error_description));
5159
5175
  } catch (a) {
5160
- throw new m(D("Failed to fetch tokens"), a);
5176
+ throw new m(I("Failed to fetch tokens"), a);
5161
5177
  }
5162
5178
  }
5163
5179
  let s = await o.json();
5164
5180
  return await this.verifyTokens(s), this.getProfile();
5165
5181
  }
5166
5182
  async verifyTokens(t) {
5167
- let n = t.access_token, i2 = bt(n);
5168
- if (Date.now() >= i2.exp * 1e3)
5169
- throw this.clearActiveLogin(), new Error("Token expired");
5170
- if (i2.cid) {
5171
- if (i2.cid !== this.clientId)
5183
+ let n = t.access_token;
5184
+ if (kr(n)) {
5185
+ let i2 = St(n);
5186
+ if (Date.now() >= i2.exp * 1e3)
5187
+ throw this.clearActiveLogin(), new Error("Token expired");
5188
+ if (i2.cid) {
5189
+ if (i2.cid !== this.clientId)
5190
+ throw this.clearActiveLogin(), new Error("Token was not issued for this audience");
5191
+ } else if (this.clientId && i2.client_id !== this.clientId)
5172
5192
  throw this.clearActiveLogin(), new Error("Token was not issued for this audience");
5173
- } else if (this.clientId && i2.client_id !== this.clientId)
5174
- throw this.clearActiveLogin(), new Error("Token was not issued for this audience");
5193
+ }
5175
5194
  return this.setActiveLogin({ accessToken: n, refreshToken: t.refresh_token, project: t.project, profile: t.profile });
5176
5195
  }
5177
5196
  setupStorageListener() {
@@ -5187,18 +5206,18 @@ var Dr = class extends qe {
5187
5206
  throw i2;
5188
5207
  }
5189
5208
  };
5190
- function Ri() {
5209
+ function Ei() {
5191
5210
  if (!globalThis.fetch)
5192
5211
  throw new Error("Fetch not available in this environment");
5193
5212
  return globalThis.fetch.bind(globalThis);
5194
5213
  }
5195
- function Ir() {
5214
+ function Ur() {
5196
5215
  return typeof window > "u" ? "" : window.location.protocol + "//" + window.location.host + "/";
5197
5216
  }
5198
- function Or(r4) {
5217
+ function Lr(r4) {
5199
5218
  return r4 && (r4.endsWith("/") ? r4 : r4 + "/");
5200
5219
  }
5201
- async function Vr(r4) {
5220
+ async function _r(r4) {
5202
5221
  let e = r4.headers.get("content-location");
5203
5222
  if (e)
5204
5223
  return e;
@@ -5206,17 +5225,17 @@ async function Vr(r4) {
5206
5225
  if (t)
5207
5226
  return t;
5208
5227
  let n = await r4.json();
5209
- if (he(n) && n.issue?.[0]?.diagnostics)
5228
+ if (ye(n) && n.issue?.[0]?.diagnostics)
5210
5229
  return n.issue[0].diagnostics;
5211
5230
  }
5212
- function Ur(r4) {
5231
+ function Nr(r4) {
5213
5232
  let e = r4.entry?.map((t) => t.resource) ?? [];
5214
5233
  return Object.assign(e, { bundle: r4 });
5215
5234
  }
5216
- var Ai = [...ce, "->", "<<", ">>"];
5217
- var Ei = ue().registerInfix("->", { precedence: f.Arrow }).registerInfix(";", { precedence: f.Semicolon });
5218
- var Pi = [...ce, "eq", "ne", "co"];
5219
- var ki = ue();
5235
+ var Pi = [...ce, "->", "<<", ">>"];
5236
+ var Ci = ue().registerInfix("->", { precedence: f.Arrow }).registerInfix(";", { precedence: f.Semicolon });
5237
+ var wi = [...ce, "eq", "ne", "co"];
5238
+ var Di = ue();
5220
5239
  var W = class {
5221
5240
  constructor(e = "\r", t = "|", n = "^", i2 = "~", o = "\\", s = "&") {
5222
5241
  this.segmentSeparator = e;
@@ -5233,7 +5252,7 @@ var W = class {
5233
5252
  return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
5234
5253
  }
5235
5254
  };
5236
- var Nr = class r {
5255
+ var Fr = class r {
5237
5256
  constructor(e, t = new W()) {
5238
5257
  this.context = t, this.segments = e;
5239
5258
  }
@@ -5257,7 +5276,7 @@ var Nr = class r {
5257
5276
  }
5258
5277
  buildAck() {
5259
5278
  let e = /* @__PURE__ */ new Date(), t = this.getSegment("MSH"), n = t?.getField(3)?.toString() ?? "", i2 = t?.getField(4)?.toString() ?? "", o = t?.getField(5)?.toString() ?? "", s = t?.getField(6)?.toString() ?? "", a = t?.getField(10)?.toString() ?? "", c2 = t?.getField(12)?.toString() ?? "2.5.1";
5260
- return new r([new pe(["MSH", this.context.getMsh2(), o, s, n, i2, Ii(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", c2], this.context), new pe(["MSA", "AA", a, "OK"], this.context)]);
5279
+ return new r([new pe(["MSH", this.context.getMsh2(), o, s, n, i2, Vi(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", c2], this.context), new pe(["MSA", "AA", a, "OK"], this.context)]);
5261
5280
  }
5262
5281
  buildAckMessageType(e) {
5263
5282
  let t = e?.getField(9), n = t?.getComponent(2), i2 = t?.getComponent(3), o = "ACK";
@@ -5274,7 +5293,7 @@ var Nr = class r {
5274
5293
  };
5275
5294
  var pe = class r2 {
5276
5295
  constructor(e, t = new W()) {
5277
- this.context = t, zt(e) ? this.fields = e.map((n) => te.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
5296
+ this.context = t, Jt(e) ? this.fields = e.map((n) => te.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
5278
5297
  }
5279
5298
  get(e) {
5280
5299
  return this.fields[e];
@@ -5318,7 +5337,7 @@ var te = class r3 {
5318
5337
  return new r3(e.split(t.repetitionSeparator).map((n) => n.split(t.componentSeparator)), t);
5319
5338
  }
5320
5339
  };
5321
- function Ii(r4) {
5340
+ function Vi(r4) {
5322
5341
  let e = r4 instanceof Date ? r4 : new Date(r4), n = e.toISOString().replace(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i2 = e.getUTCMilliseconds();
5323
5342
  return i2 > 0 && (n += "." + i2.toString()), n;
5324
5343
  }
@@ -5358,7 +5377,7 @@ var c = class extends i {
5358
5377
  e.on("data", (s) => {
5359
5378
  try {
5360
5379
  if (o += s.toString(), o.endsWith(p + v2)) {
5361
- let r4 = Nr.parse(o.substring(1, o.length - 2));
5380
+ let r4 = Fr.parse(o.substring(1, o.length - 2));
5362
5381
  this.dispatchEvent(new d2(this, r4)), o = "";
5363
5382
  }
5364
5383
  } catch (r4) {
@@ -5400,7 +5419,7 @@ var E2 = class {
5400
5419
  }
5401
5420
  };
5402
5421
 
5403
- // ../../node_modules/ws/wrapper.mjs
5422
+ // node_modules/ws/wrapper.mjs
5404
5423
  var import_stream = __toESM(require_stream(), 1);
5405
5424
  var import_receiver = __toESM(require_receiver(), 1);
5406
5425
  var import_sender = __toESM(require_sender(), 1);
@@ -5485,6 +5504,7 @@ var AgentHl7ChannelConnection = class {
5485
5504
  JSON.stringify({
5486
5505
  type: "connect",
5487
5506
  accessToken: medplum.getAccessToken(),
5507
+ agentId: channel.app.agentId,
5488
5508
  botId: Ro(channel.definition.targetReference)
5489
5509
  })
5490
5510
  );
@@ -5501,7 +5521,7 @@ var AgentHl7ChannelConnection = class {
5501
5521
  this.trySendToWebSocket();
5502
5522
  break;
5503
5523
  case "transmit":
5504
- this.hl7ConnectionQueue.push(Nr.parse(command.message));
5524
+ this.hl7ConnectionQueue.push(Fr.parse(command.message));
5505
5525
  this.trySendToHl7Connection();
5506
5526
  break;
5507
5527
  }
@@ -5528,6 +5548,7 @@ var AgentHl7ChannelConnection = class {
5528
5548
  this.webSocket.send(
5529
5549
  JSON.stringify({
5530
5550
  type: "transmit",
5551
+ forwardedFor: this.hl7Connection.socket.remoteAddress,
5531
5552
  message: msg.toString()
5532
5553
  })
5533
5554
  );
@@ -5554,7 +5575,7 @@ if (typeof require !== "undefined" && require.main === module) {
5554
5575
  process.exit(1);
5555
5576
  }
5556
5577
  const [_node, _script, baseUrl, clientId, clientSecret, agentId] = process.argv;
5557
- const medplum = new Dr({ baseUrl, clientId });
5578
+ const medplum = new Vr({ baseUrl, clientId });
5558
5579
  medplum.startClientLogin(clientId, clientSecret).then(() => new App(medplum, agentId).start()).catch(console.error);
5559
5580
  }
5560
5581
  // Annotate the CommonJS export names for ESM import in node: