@medplum/agent 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cjs/index.cjs +324 -302
  2. package/package.json +1 -1
@@ -1285,9 +1285,9 @@ var require_receiver = __commonJS({
1285
1285
  }
1286
1286
  this._fragments.push(buf);
1287
1287
  }
1288
- const er = this.dataMessage();
1289
- if (er)
1290
- return cb(er);
1288
+ const er2 = this.dataMessage();
1289
+ if (er2)
1290
+ return cb(er2);
1291
1291
  this.startLoop(cb);
1292
1292
  });
1293
1293
  }
@@ -3501,7 +3501,7 @@ var require_websocket_server = __commonJS({
3501
3501
  socket.once("finish", socket.destroy);
3502
3502
  socket.end(
3503
3503
  `HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\r
3504
- ` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message
3504
+ ` + Object.keys(headers).map((h2) => `${h2}: ${headers[h2]}`).join("\r\n") + "\r\n\r\n" + message
3505
3505
  );
3506
3506
  }
3507
3507
  function abortHandshakeOrEmitwsClientError(server, req, socket, code, message) {
@@ -3526,101 +3526,101 @@ __export(main_exports, {
3526
3526
  module.exports = __toCommonJS(main_exports);
3527
3527
 
3528
3528
  // ../core/dist/esm/index.mjs
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) {
3529
+ var Ye = "ok";
3530
+ var Xe = "created";
3531
+ var et = "not-modified";
3532
+ var tt = "not-found";
3533
+ var ye = "accepted";
3534
+ var qt = { resourceType: "OperationOutcome", id: tt, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
3535
+ function k(r4, e) {
3536
3536
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r4 }, expression: e ? [e] : void 0 }] };
3537
3537
  }
3538
- function ye(r4) {
3538
+ function ge(r4) {
3539
3539
  return typeof r4 == "object" && r4 !== null && r4.resourceType === "OperationOutcome";
3540
3540
  }
3541
- function tt(r4) {
3542
- return r4.id === Je || r4.id === Ye || r4.id === Ze || r4.id === he;
3541
+ function rt(r4) {
3542
+ return r4.id === Ye || r4.id === Xe || r4.id === et || r4.id === ye;
3543
3543
  }
3544
- var m = class extends Error {
3544
+ var h = class extends Error {
3545
3545
  constructor(t, n) {
3546
- super(Nt(t));
3546
+ super($t(t));
3547
3547
  this.outcome = t, this.cause = n;
3548
3548
  }
3549
3549
  };
3550
- function rt(r4) {
3551
- return r4 instanceof m ? r4.outcome : ye(r4) ? r4 : I(Gr(r4));
3550
+ function nt(r4) {
3551
+ return r4 instanceof h ? r4.outcome : ge(r4) ? r4 : k(Jr(r4));
3552
3552
  }
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";
3553
+ function Jr(r4) {
3554
+ return r4 ? typeof r4 == "string" ? r4 : r4 instanceof Error ? r4.message : ge(r4) ? $t(r4) : typeof r4 == "object" && "code" in r4 && typeof r4.code == "string" ? r4.code : JSON.stringify(r4) : "Unknown error";
3555
3555
  }
3556
- function Nt(r4) {
3557
- let e = r4.issue?.map(zr) ?? [];
3556
+ function $t(r4) {
3557
+ let e = r4.issue?.map(Yr) ?? [];
3558
3558
  return e.length > 0 ? e.join("; ") : "Unknown error";
3559
3559
  }
3560
- function zr(r4) {
3560
+ function Yr(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 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) {
3564
+ var Wt = { 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 Gt(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
- function ie(r4) {
3570
- let e = $t(r4), t = cn(r4);
3569
+ function ae(r4) {
3570
+ let e = Jt(r4), t = ln(r4);
3571
3571
  return t === e ? { reference: e } : { reference: e, display: t };
3572
3572
  }
3573
- function $t(r4) {
3573
+ function Jt(r4) {
3574
3574
  return r4.resourceType + "/" + r4.id;
3575
3575
  }
3576
- function Ro(r4) {
3576
+ function wo(r4) {
3577
3577
  return r4?.reference?.split("/")[1];
3578
3578
  }
3579
- function an(r4) {
3579
+ function dn(r4) {
3580
3580
  return r4.resourceType === "Patient" || r4.resourceType === "Practitioner" || r4.resourceType === "RelatedPerson";
3581
3581
  }
3582
- function cn(r4) {
3583
- if (an(r4)) {
3584
- let e = un(r4);
3582
+ function ln(r4) {
3583
+ if (dn(r4)) {
3584
+ let e = pn(r4);
3585
3585
  if (e)
3586
3586
  return e;
3587
3587
  }
3588
3588
  if (r4.resourceType === "Device") {
3589
- let e = dn(r4);
3589
+ let e = fn(r4);
3590
3590
  if (e)
3591
3591
  return e;
3592
3592
  }
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);
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 : Jt(r4);
3594
3594
  }
3595
- function un(r4) {
3595
+ function pn(r4) {
3596
3596
  let e = r4.name;
3597
3597
  if (e && e.length > 0)
3598
- return qt(e[0]);
3598
+ return Gt(e[0]);
3599
3599
  }
3600
- function dn(r4) {
3600
+ function fn(r4) {
3601
3601
  let e = r4.deviceName;
3602
3602
  if (e && e.length > 0)
3603
3603
  return e[0].name;
3604
3604
  }
3605
- function ge(r4, e) {
3605
+ function xe(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();
3609
3609
  n.setUTCHours(0, 0, 0, 0);
3610
- let i2 = t.getUTCFullYear(), o = t.getUTCMonth(), s = t.getUTCDate(), a = n.getUTCFullYear(), c2 = n.getUTCMonth(), p2 = n.getUTCDate(), l2 = a - i2;
3611
- (c2 < o || c2 === o && p2 < s) && l2--;
3612
- let ne = a * 12 + c2 - (i2 * 12 + o);
3613
- p2 < s && ne--;
3614
- let me = Math.floor((n.getTime() - t.getTime()) / (1e3 * 60 * 60 * 24));
3615
- return { years: l2, months: ne, days: me };
3610
+ let i2 = t.getUTCFullYear(), o = t.getUTCMonth(), s = t.getUTCDate(), a = n.getUTCFullYear(), c2 = n.getUTCMonth(), f = n.getUTCDate(), l2 = a - i2;
3611
+ (c2 < o || c2 === o && f < s) && l2--;
3612
+ let F = a * 12 + c2 - (i2 * 12 + o);
3613
+ f < s && F--;
3614
+ let Kr = Math.floor((n.getTime() - t.getTime()) / (1e3 * 60 * 60 * 24));
3615
+ return { years: l2, months: F, days: Kr };
3616
3616
  }
3617
- function zt(r4, e) {
3618
- return JSON.stringify(r4, ln, e ? 2 : void 0);
3617
+ function er(r4, e) {
3618
+ return JSON.stringify(r4, hn, e ? 2 : void 0);
3619
3619
  }
3620
- function ln(r4, e) {
3621
- return !pn(r4) && b(e) ? void 0 : e;
3620
+ function hn(r4, e) {
3621
+ return !mn(r4) && b(e) ? void 0 : e;
3622
3622
  }
3623
- function pn(r4) {
3623
+ function mn(r4) {
3624
3624
  return !!/\d+$/.exec(r4);
3625
3625
  }
3626
3626
  function b(r4) {
@@ -3629,43 +3629,43 @@ 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 Jt(r4) {
3632
+ function tr(r4) {
3633
3633
  return r4.every((e) => typeof e == "string");
3634
3634
  }
3635
- var Yt = [];
3635
+ var rr = [];
3636
3636
  for (let r4 = 0; r4 < 256; r4++)
3637
- Yt.push(r4.toString(16).padStart(2, "0"));
3638
- function Xt(r4) {
3637
+ rr.push(r4.toString(16).padStart(2, "0"));
3638
+ function nr(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] = Yt[e[n]];
3641
+ t[n] = rr[e[n]];
3642
3642
  return t.join("");
3643
3643
  }
3644
- function Zt(r4) {
3644
+ function ir(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]);
3648
3648
  return window.btoa(t.join(""));
3649
3649
  }
3650
- function S(r4) {
3650
+ function R(r4) {
3651
3651
  return r4.charAt(0).toUpperCase() + r4.substring(1);
3652
3652
  }
3653
- var at = (r4) => new Promise((e) => {
3653
+ var ut = (r4) => new Promise((e) => {
3654
3654
  setTimeout(e, r4);
3655
3655
  });
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 ct(r4) {
3656
+ var z = ((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))(z || {});
3657
+ function dt(r4) {
3658
3658
  if (!r4.name)
3659
3659
  return;
3660
3660
  let t = r4.snapshot?.element;
3661
3661
  if (t) {
3662
3662
  for (let n of t)
3663
- Sn(r4, n);
3663
+ En(r4, n);
3664
3664
  for (let n of t)
3665
- Rn(r4, n);
3665
+ Pn(r4, n);
3666
3666
  }
3667
3667
  }
3668
- function Sn(r4, e) {
3668
+ function En(r4, e) {
3669
3669
  let t = e.path, n = e.type?.[0]?.code;
3670
3670
  if (n !== void 0 && n !== "Element" && n !== "BackboneElement")
3671
3671
  return;
@@ -3674,7 +3674,7 @@ function Sn(r4, e) {
3674
3674
  let o = L(i2), s = y.types[o];
3675
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 ?? {};
3676
3676
  }
3677
- function Rn(r4, e) {
3677
+ function Pn(r4, e) {
3678
3678
  let n = e.path.split(".");
3679
3679
  if (n.length === 1)
3680
3680
  return;
@@ -3685,16 +3685,16 @@ function Rn(r4, e) {
3685
3685
  let s = n[n.length - 1];
3686
3686
  o.properties[s] = e;
3687
3687
  }
3688
- function ut(r4) {
3688
+ function lt(r4) {
3689
3689
  for (let e of r4.base ?? []) {
3690
3690
  let t = y.types[e];
3691
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);
3692
3692
  }
3693
3693
  }
3694
3694
  function L(r4) {
3695
- return r4.length === 1 ? r4[0] : r4.map(S).join("");
3695
+ return r4.length === 1 ? r4[0] : r4.map(R).join("");
3696
3696
  }
3697
- function oe(r4, e) {
3697
+ function ce(r4, e) {
3698
3698
  let t = y.types[r4];
3699
3699
  if (!t)
3700
3700
  return;
@@ -3702,7 +3702,7 @@ function oe(r4, e) {
3702
3702
  if (n) {
3703
3703
  if (n.contentReference) {
3704
3704
  let i2 = n.contentReference.substring(1).split("."), o = i2.pop(), s = L(i2);
3705
- return oe(s, o);
3705
+ return ce(s, o);
3706
3706
  }
3707
3707
  return n;
3708
3708
  }
@@ -3710,8 +3710,8 @@ function oe(r4, e) {
3710
3710
  function _(r4) {
3711
3711
  return !!(r4 && typeof r4 == "object" && "resourceType" in r4);
3712
3712
  }
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 || {});
3713
+ var y = Wt;
3714
+ var kn = ((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))(kn || {});
3715
3715
  var Se = class {
3716
3716
  constructor(e, t) {
3717
3717
  this.operator = e;
@@ -3721,7 +3721,7 @@ var Se = class {
3721
3721
  return `${this.operator}(${this.child.toString()})`;
3722
3722
  }
3723
3723
  };
3724
- var Q = class {
3724
+ var $ = class {
3725
3725
  constructor(e, t, n) {
3726
3726
  this.operator = e;
3727
3727
  this.left = t;
@@ -3731,7 +3731,7 @@ var Q = class {
3731
3731
  return `${this.left.toString()} ${this.operator} ${this.right.toString()}`;
3732
3732
  }
3733
3733
  };
3734
- var Re = class {
3734
+ var Ae = class {
3735
3735
  constructor() {
3736
3736
  this.prefixParselets = {};
3737
3737
  this.infixParselets = {};
@@ -3755,10 +3755,10 @@ var Re = class {
3755
3755
  }, precedence: t });
3756
3756
  }
3757
3757
  construct(e) {
3758
- return new lt(e, this.prefixParselets, this.infixParselets);
3758
+ return new ft(e, this.prefixParselets, this.infixParselets);
3759
3759
  }
3760
3760
  };
3761
- var lt = class {
3761
+ var ft = class {
3762
3762
  constructor(e, t, n) {
3763
3763
  this.tokens = e, this.prefixParselets = t, this.infixParselets = n;
3764
3764
  }
@@ -3809,7 +3809,7 @@ var lt = class {
3809
3809
  return this.infixParselets[e.id === "Symbol" ? e.value : e.id];
3810
3810
  }
3811
3811
  };
3812
- function Z(r4) {
3812
+ function te(r4) {
3813
3813
  if (r4.startsWith("T"))
3814
3814
  return r4 + "T00:00:00.000Z".substring(r4.length);
3815
3815
  if (r4.length <= 10)
@@ -3823,10 +3823,10 @@ function Z(r4) {
3823
3823
  function d(r4) {
3824
3824
  return [{ type: "boolean", value: r4 }];
3825
3825
  }
3826
- function T(r4) {
3826
+ function x(r4) {
3827
3827
  return r4 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r4) ? { type: "integer", value: r4 } : typeof r4 == "number" ? { type: "decimal", value: r4 } : typeof r4 == "boolean" ? { type: "boolean", value: r4 } : typeof r4 == "string" ? { type: "string", value: r4 } : A(r4) ? { type: "Quantity", value: r4 } : _(r4) ? { type: r4.resourceType, value: r4 } : { type: "BackboneElement", value: r4 };
3828
3828
  }
3829
- function N(r4) {
3829
+ function M(r4) {
3830
3830
  return r4.length === 0 ? false : !!r4[0].value;
3831
3831
  }
3832
3832
  function O(r4, e) {
@@ -3836,13 +3836,13 @@ function O(r4, e) {
3836
3836
  throw new Error(`Expected singleton of type ${e}, but found ${JSON.stringify(r4)}`);
3837
3837
  }
3838
3838
  }
3839
- function P(r4, e) {
3839
+ function E(r4, e) {
3840
3840
  if (!r4.value)
3841
3841
  return;
3842
- let t = oe(r4.type, e);
3843
- return t ? Fn(r4, e, t) : qn(r4, e);
3842
+ let t = ce(r4.type, e);
3843
+ return t ? $n(r4, e, t) : Qn(r4, e);
3844
3844
  }
3845
- function Fn(r4, e, t) {
3845
+ function $n(r4, e, t) {
3846
3846
  let n = t.type;
3847
3847
  if (!n || n.length === 0)
3848
3848
  return;
@@ -3851,20 +3851,20 @@ function Fn(r4, e, t) {
3851
3851
  i2 = r4.value[e], o = n[0].code;
3852
3852
  else
3853
3853
  for (let a of n) {
3854
- let c2 = e.replace("[x]", "") + S(a.code);
3854
+ let c2 = e.replace("[x]", "") + R(a.code);
3855
3855
  if (c2 in r4.value) {
3856
3856
  i2 = r4.value[c2], o = a.code;
3857
3857
  break;
3858
3858
  }
3859
3859
  }
3860
3860
  let s = r4.value["_" + e];
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);
3861
+ if (s && (Array.isArray(i2) ? i2 = i2.map((a, c2) => s[c2] ? gr(a ?? {}, s[c2]) : a) : i2 = gr(i2 ?? {}, s)), !b(i2))
3862
+ return (o === "Element" || o === "BackboneElement") && (o = L(t.path?.split("."))), Array.isArray(i2) ? i2.map((a) => hr(a, o)) : hr(i2, o);
3863
3863
  }
3864
- function dr(r4, e) {
3864
+ function hr(r4, e) {
3865
3865
  return e === "Resource" && _(r4) && (e = r4.resourceType), { type: e, value: r4 };
3866
3866
  }
3867
- function qn(r4, e) {
3867
+ function Qn(r4, e) {
3868
3868
  let t = r4.value;
3869
3869
  if (!t || typeof t != "object")
3870
3870
  return;
@@ -3872,22 +3872,22 @@ function qn(r4, e) {
3872
3872
  if (e in t)
3873
3873
  n = t[e];
3874
3874
  else
3875
- for (let i2 in j) {
3876
- let o = e + S(i2);
3875
+ for (let i2 in z) {
3876
+ let o = e + R(i2);
3877
3877
  if (o in t) {
3878
3878
  n = t[o];
3879
3879
  break;
3880
3880
  }
3881
3881
  }
3882
3882
  if (!b(n))
3883
- return Array.isArray(n) ? n.map(T) : T(n);
3883
+ return Array.isArray(n) ? n.map(x) : x(n);
3884
3884
  }
3885
- function Ae(r4) {
3885
+ function Ee(r4) {
3886
3886
  let e = [];
3887
3887
  for (let t of r4) {
3888
3888
  let n = false;
3889
3889
  for (let i2 of e)
3890
- if (N(mr(t, i2))) {
3890
+ if (M(xr(t, i2))) {
3891
3891
  n = true;
3892
3892
  break;
3893
3893
  }
@@ -3895,28 +3895,28 @@ function Ae(r4) {
3895
3895
  }
3896
3896
  return e;
3897
3897
  }
3898
- function pt(r4) {
3899
- return d(!N(r4));
3898
+ function ht(r4) {
3899
+ return d(!M(r4));
3900
3900
  }
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]))));
3901
+ function mt(r4, e) {
3902
+ return r4.length === 0 || e.length === 0 ? [] : r4.length !== e.length ? d(false) : d(r4.every((t, n) => M(xr(t, e[n]))));
3903
3903
  }
3904
- function mr(r4, e) {
3904
+ function xr(r4, e) {
3905
3905
  let t = r4.value?.valueOf(), n = e.value?.valueOf();
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);
3906
+ return typeof t == "number" && typeof n == "number" ? d(Math.abs(t - n) < 1e-8) : A(t) && A(n) ? d(Tr(t, n)) : d(typeof t == "object" && typeof n == "object" ? gt(r4, e) : t === n);
3907
3907
  }
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])))));
3908
+ function yt(r4, e) {
3909
+ return r4.length === 0 && e.length === 0 ? d(true) : r4.length !== e.length ? d(false) : (r4.sort(mr), e.sort(mr), d(r4.every((t, n) => M(Hn(t, e[n])))));
3910
3910
  }
3911
- function jn(r4, e) {
3911
+ function Hn(r4, e) {
3912
3912
  let { type: t, value: n } = r4, { type: i2, value: o } = e, s = n?.valueOf(), a = o?.valueOf();
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);
3913
+ return typeof s == "number" && typeof a == "number" ? d(Math.abs(s - a) < 0.01) : A(s) && A(a) ? d(Tr(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" ? gt({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
3914
3914
  }
3915
- function lr(r4, e) {
3915
+ function mr(r4, e) {
3916
3916
  let t = r4.value?.valueOf(), n = e.value?.valueOf();
3917
3917
  return typeof t == "number" && typeof n == "number" ? t - n : typeof t == "string" && typeof n == "string" ? t.localeCompare(n) : 0;
3918
3918
  }
3919
- function Ee(r4, e) {
3919
+ function Pe(r4, e) {
3920
3920
  let { value: t } = r4;
3921
3921
  if (t == null)
3922
3922
  return false;
@@ -3933,44 +3933,44 @@ function Ee(r4, e) {
3933
3933
  case "Time":
3934
3934
  return typeof t == "string" && !!/^T\d/.exec(t);
3935
3935
  case "Period":
3936
- return Qn(t);
3936
+ return Wn(t);
3937
3937
  case "Quantity":
3938
3938
  return A(t);
3939
3939
  default:
3940
3940
  return typeof t == "object" && t?.resourceType === e;
3941
3941
  }
3942
3942
  }
3943
- function Qn(r4) {
3943
+ function Wn(r4) {
3944
3944
  return !!(r4 && typeof r4 == "object" && "start" in r4);
3945
3945
  }
3946
3946
  function A(r4) {
3947
3947
  return !!(r4 && typeof r4 == "object" && "value" in r4 && typeof r4.value == "number");
3948
3948
  }
3949
- function hr(r4, e) {
3949
+ function Tr(r4, e) {
3950
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);
3951
3951
  }
3952
- function ht(r4, e) {
3952
+ function gt(r4, e) {
3953
3953
  let t = Object.keys(r4), n = Object.keys(e);
3954
3954
  if (t.length !== n.length)
3955
3955
  return false;
3956
3956
  for (let i2 of t) {
3957
3957
  let o = r4[i2], s = e[i2];
3958
- if (pr(o) && pr(s)) {
3959
- if (!ht(o, s))
3958
+ if (yr(o) && yr(s)) {
3959
+ if (!gt(o, s))
3960
3960
  return false;
3961
3961
  } else if (o !== s)
3962
3962
  return false;
3963
3963
  }
3964
3964
  return true;
3965
3965
  }
3966
- function pr(r4) {
3966
+ function yr(r4) {
3967
3967
  return r4 !== null && typeof r4 == "object";
3968
3968
  }
3969
- function fr(r4, e) {
3969
+ function gr(r4, e) {
3970
3970
  return delete e.__proto__, delete e.constructor, Object.assign(r4, e);
3971
3971
  }
3972
- var se = () => [];
3973
- var R = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.filter((n) => N(t.eval(r4, [n]))).length > 0) : d(e.length > 0), all: (r4, e, t) => d(e.every((n) => N(t.eval(r4, [n])))), allTrue: (r4, e) => {
3972
+ var ue = () => [];
3973
+ var S = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.filter((n) => M(t.eval(r4, [n]))).length > 0) : d(e.length > 0), all: (r4, e, t) => d(e.every((n) => M(t.eval(r4, [n])))), allTrue: (r4, e) => {
3974
3974
  for (let t of e)
3975
3975
  if (!t.value)
3976
3976
  return d(false);
@@ -3990,12 +3990,12 @@ var R = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
3990
3990
  if (!t.value)
3991
3991
  return d(true);
3992
3992
  return d(false);
3993
- }, subsetOf: se, supersetOf: se, count: (r4, e) => [{ type: "integer", value: e.length }], distinct: (r4, e) => {
3993
+ }, subsetOf: ue, supersetOf: ue, count: (r4, e) => [{ type: "integer", value: e.length }], distinct: (r4, e) => {
3994
3994
  let t = [];
3995
3995
  for (let n of e)
3996
3996
  t.some((i2) => i2.value === n.value) || t.push(n);
3997
3997
  return t;
3998
- }, isDistinct: (r4, e) => d(e.length === R.distinct(r4, e).length), where: (r4, e, t) => e.filter((n) => N(t.eval(r4, [n]))), select: (r4, e, t) => e.map((n) => t.eval(r4, [n])).flat(), repeat: se, ofType: (r4, e, t) => e.filter((n) => n.type === t.name), single: (r4, e) => {
3998
+ }, isDistinct: (r4, e) => d(e.length === S.distinct(r4, e).length), where: (r4, e, t) => e.filter((n) => M(t.eval(r4, [n]))), select: (r4, e, t) => e.map((n) => t.eval(r4, [n])).flat(), repeat: ue, ofType: (r4, e, t) => e.filter((n) => n.type === t.name), single: (r4, e) => {
3999
3999
  if (e.length > 1)
4000
4000
  throw new Error("Expected input length one for single()");
4001
4001
  return e.length === 0 ? [] : e.slice(0, 1);
@@ -4027,17 +4027,17 @@ var R = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
4027
4027
  if (!t)
4028
4028
  return e;
4029
4029
  let n = t.eval(r4, e);
4030
- return Ae([...e, ...n]);
4030
+ return Ee([...e, ...n]);
4031
4031
  }, combine: (r4, e, t) => {
4032
4032
  if (!t)
4033
4033
  return e;
4034
4034
  let n = t.eval(r4, e);
4035
4035
  return [...e, ...n];
4036
- }, htmlChecks: (r4, e, t) => [T(true)], iif: (r4, e, t, n, i2) => {
4036
+ }, htmlChecks: (r4, e, t) => [x(true)], iif: (r4, e, t, n, i2) => {
4037
4037
  let o = t.eval(r4, e);
4038
4038
  if (o.length > 1 || o.length === 1 && typeof o[0].value != "boolean")
4039
4039
  throw new Error("Expected criterion to evaluate to a Boolean");
4040
- return N(o) ? n.eval(r4, e) : i2 ? i2.eval(r4, e) : [];
4040
+ return M(o) ? n.eval(r4, e) : i2 ? i2.eval(r4, e) : [];
4041
4041
  }, toBoolean: (r4, e) => {
4042
4042
  if (e.length === 0)
4043
4043
  return [];
@@ -4054,72 +4054,72 @@ var R = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
4054
4054
  return d(false);
4055
4055
  }
4056
4056
  return [];
4057
- }, convertsToBoolean: (r4, e) => e.length === 0 ? [] : d(R.toBoolean(r4, e).length === 1), toInteger: (r4, e) => {
4057
+ }, convertsToBoolean: (r4, e) => e.length === 0 ? [] : d(S.toBoolean(r4, e).length === 1), toInteger: (r4, e) => {
4058
4058
  if (e.length === 0)
4059
4059
  return [];
4060
4060
  let [{ value: t }] = U(e, 1);
4061
4061
  return typeof t == "number" ? [{ type: "integer", value: t }] : typeof t == "string" && /^[+-]?\d+$/.exec(t) ? [{ type: "integer", value: parseInt(t, 10) }] : typeof t == "boolean" ? [{ type: "integer", value: t ? 1 : 0 }] : [];
4062
- }, convertsToInteger: (r4, e) => e.length === 0 ? [] : d(R.toInteger(r4, e).length === 1), toDate: (r4, e) => {
4062
+ }, convertsToInteger: (r4, e) => e.length === 0 ? [] : d(S.toInteger(r4, e).length === 1), toDate: (r4, e) => {
4063
4063
  if (e.length === 0)
4064
4064
  return [];
4065
4065
  let [{ value: t }] = U(e, 1);
4066
- return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: "date", value: Z(t) }] : [];
4067
- }, convertsToDate: (r4, e) => e.length === 0 ? [] : d(R.toDate(r4, e).length === 1), toDateTime: (r4, e) => {
4066
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: "date", value: te(t) }] : [];
4067
+ }, convertsToDate: (r4, e) => e.length === 0 ? [] : d(S.toDate(r4, e).length === 1), toDateTime: (r4, e) => {
4068
4068
  if (e.length === 0)
4069
4069
  return [];
4070
4070
  let [{ value: t }] = U(e, 1);
4071
- return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: "dateTime", value: Z(t) }] : [];
4072
- }, convertsToDateTime: (r4, e) => e.length === 0 ? [] : d(R.toDateTime(r4, e).length === 1), toDecimal: (r4, e) => {
4071
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: "dateTime", value: te(t) }] : [];
4072
+ }, convertsToDateTime: (r4, e) => e.length === 0 ? [] : d(S.toDateTime(r4, e).length === 1), toDecimal: (r4, e) => {
4073
4073
  if (e.length === 0)
4074
4074
  return [];
4075
4075
  let [{ value: t }] = U(e, 1);
4076
4076
  return typeof t == "number" ? [{ type: "decimal", value: t }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?$/.exec(t) ? [{ type: "decimal", value: parseFloat(t) }] : typeof t == "boolean" ? [{ type: "decimal", value: t ? 1 : 0 }] : [];
4077
- }, convertsToDecimal: (r4, e) => e.length === 0 ? [] : d(R.toDecimal(r4, e).length === 1), toQuantity: (r4, e) => {
4077
+ }, convertsToDecimal: (r4, e) => e.length === 0 ? [] : d(S.toDecimal(r4, e).length === 1), toQuantity: (r4, e) => {
4078
4078
  if (e.length === 0)
4079
4079
  return [];
4080
4080
  let [{ value: t }] = U(e, 1);
4081
4081
  return A(t) ? [{ type: "Quantity", value: t }] : typeof t == "number" ? [{ type: "Quantity", value: { value: t, unit: "1" } }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?/.exec(t) ? [{ type: "Quantity", value: { value: parseFloat(t), unit: "1" } }] : typeof t == "boolean" ? [{ type: "Quantity", value: { value: t ? 1 : 0, unit: "1" } }] : [];
4082
- }, convertsToQuantity: (r4, e) => e.length === 0 ? [] : d(R.toQuantity(r4, e).length === 1), toString: (r4, e) => {
4082
+ }, convertsToQuantity: (r4, e) => e.length === 0 ? [] : d(S.toQuantity(r4, e).length === 1), toString: (r4, e) => {
4083
4083
  if (e.length === 0)
4084
4084
  return [];
4085
4085
  let [{ value: t }] = U(e, 1);
4086
4086
  return t == null ? [] : A(t) ? [{ type: "string", value: `${t.value} '${t.unit}'` }] : [{ type: "string", value: t.toString() }];
4087
- }, convertsToString: (r4, e) => e.length === 0 ? [] : d(R.toString(r4, e).length === 1), toTime: (r4, e) => {
4087
+ }, convertsToString: (r4, e) => e.length === 0 ? [] : d(S.toString(r4, e).length === 1), toTime: (r4, e) => {
4088
4088
  if (e.length === 0)
4089
4089
  return [];
4090
4090
  let [{ value: t }] = U(e, 1);
4091
4091
  if (typeof t == "string") {
4092
4092
  let n = /^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(t);
4093
4093
  if (n)
4094
- return [{ type: "time", value: Z("T" + n[1]) }];
4094
+ return [{ type: "time", value: te("T" + n[1]) }];
4095
4095
  }
4096
4096
  return [];
4097
- }, convertsToTime: (r4, e) => e.length === 0 ? [] : d(R.toTime(r4, e).length === 1), indexOf: (r4, e, t) => C((n, i2) => n.indexOf(i2), r4, e, t), substring: (r4, e, t, n) => C((i2, o, s) => {
4097
+ }, convertsToTime: (r4, e) => e.length === 0 ? [] : d(S.toTime(r4, e).length === 1), indexOf: (r4, e, t) => C((n, i2) => n.indexOf(i2), r4, e, t), substring: (r4, e, t, n) => C((i2, o, s) => {
4098
4098
  let a = o, c2 = s ? a + s : i2.length;
4099
4099
  return a < 0 || a >= i2.length ? void 0 : i2.substring(a, c2);
4100
- }, r4, e, t, n), startsWith: (r4, e, t) => C((n, i2) => n.startsWith(i2), r4, e, t), endsWith: (r4, e, t) => C((n, i2) => n.endsWith(i2), r4, e, t), contains: (r4, e, t) => C((n, i2) => n.includes(i2), r4, e, t), upper: (r4, e) => C((t) => t.toUpperCase(), r4, e), lower: (r4, e) => C((t) => t.toLowerCase(), r4, e), replace: (r4, e, t, n) => C((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), matches: (r4, e, t) => C((n, i2) => !!new RegExp(i2).exec(n), r4, e, t), replaceMatches: (r4, e, t, n) => C((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), length: (r4, e) => C((t) => t.length, r4, e), toChars: (r4, e) => C((t) => t ? t.split("") : void 0, r4, e), abs: (r4, e) => V(Math.abs, r4, e), ceiling: (r4, e) => V(Math.ceil, r4, e), exp: (r4, e) => V(Math.exp, r4, e), floor: (r4, e) => V(Math.floor, r4, e), ln: (r4, e) => V(Math.log, r4, e), log: (r4, e, t) => V((n, i2) => Math.log(n) / Math.log(i2), r4, e, t), power: (r4, e, t) => V(Math.pow, r4, e, t), round: (r4, e) => V(Math.round, r4, e), sqrt: (r4, e) => V(Math.sqrt, r4, e), truncate: (r4, e) => V((t) => t | 0, r4, e), children: se, descendants: se, trace: (r4, e, t) => (console.log("trace", e, t), e), now: () => [{ type: "dateTime", value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: "time", value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: "date", value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r4, e, t, n, i2) => {
4101
- let o = R.toDateTime(r4, t.eval(r4, e));
4100
+ }, r4, e, t, n), startsWith: (r4, e, t) => C((n, i2) => n.startsWith(i2), r4, e, t), endsWith: (r4, e, t) => C((n, i2) => n.endsWith(i2), r4, e, t), contains: (r4, e, t) => C((n, i2) => n.includes(i2), r4, e, t), upper: (r4, e) => C((t) => t.toUpperCase(), r4, e), lower: (r4, e) => C((t) => t.toLowerCase(), r4, e), replace: (r4, e, t, n) => C((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), matches: (r4, e, t) => C((n, i2) => !!new RegExp(i2).exec(n), r4, e, t), replaceMatches: (r4, e, t, n) => C((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), length: (r4, e) => C((t) => t.length, r4, e), toChars: (r4, e) => C((t) => t ? t.split("") : void 0, r4, e), abs: (r4, e) => V(Math.abs, r4, e), ceiling: (r4, e) => V(Math.ceil, r4, e), exp: (r4, e) => V(Math.exp, r4, e), floor: (r4, e) => V(Math.floor, r4, e), ln: (r4, e) => V(Math.log, r4, e), log: (r4, e, t) => V((n, i2) => Math.log(n) / Math.log(i2), r4, e, t), power: (r4, e, t) => V(Math.pow, r4, e, t), round: (r4, e) => V(Math.round, r4, e), sqrt: (r4, e) => V(Math.sqrt, r4, e), truncate: (r4, e) => V((t) => t | 0, r4, e), children: ue, descendants: ue, trace: (r4, e, t) => (console.log("trace", e, t), e), now: () => [{ type: "dateTime", value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: "time", value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: "date", value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r4, e, t, n, i2) => {
4101
+ let o = S.toDateTime(r4, t.eval(r4, e));
4102
4102
  if (o.length === 0)
4103
4103
  throw new Error("Invalid start date");
4104
- let s = R.toDateTime(r4, n.eval(r4, e));
4104
+ let s = S.toDateTime(r4, n.eval(r4, e));
4105
4105
  if (s.length === 0)
4106
4106
  throw new Error("Invalid end date");
4107
4107
  let a = i2.eval(r4, e)[0]?.value;
4108
4108
  if (a !== "years" && a !== "months" && a !== "days")
4109
4109
  throw new Error("Invalid units");
4110
- let c2 = ge(o[0].value, s[0].value);
4110
+ let c2 = xe(o[0].value, s[0].value);
4111
4111
  return [{ type: "Quantity", value: { value: c2[a], unit: a } }];
4112
4112
  }, is: (r4, e, t) => {
4113
4113
  let 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) })) : [];
4115
- }, not: (r4, e) => R.toBoolean(r4, e).map((t) => ({ type: "boolean", value: !t.value })), resolve: (r4, e) => e.map((t) => {
4114
+ return t instanceof N ? n = t.name : t instanceof H && (n = t.left.name + "." + t.right.name), n ? e.map((i2) => ({ type: "boolean", value: Pe(i2, n) })) : [];
4115
+ }, not: (r4, e) => S.toBoolean(r4, e).map((t) => ({ type: "boolean", value: !t.value })), resolve: (r4, e) => e.map((t) => {
4116
4116
  let n = t.value, i2;
4117
4117
  if (typeof n == "string")
4118
4118
  i2 = n;
4119
4119
  else if (typeof n == "object") {
4120
4120
  let o = n;
4121
4121
  if (o.resource)
4122
- return T(o.resource);
4122
+ return x(o.resource);
4123
4123
  o.reference ? i2 = o.reference : o.type && o.identifier && (i2 = `${o.type}?identifier=${o.identifier.system}|${o.identifier.value}`);
4124
4124
  }
4125
4125
  if (i2?.includes("?")) {
@@ -4145,7 +4145,7 @@ function C(r4, e, t, ...n) {
4145
4145
  if (typeof i2 != "string")
4146
4146
  throw new Error("String function cannot be called with non-string");
4147
4147
  let o = r4(i2, ...n.map((s) => s?.eval(e, t)[0]?.value));
4148
- return o === void 0 ? [] : Array.isArray(o) ? o.map(T) : [T(o)];
4148
+ return o === void 0 ? [] : Array.isArray(o) ? o.map(x) : [x(o)];
4149
4149
  }
4150
4150
  function V(r4, e, t, ...n) {
4151
4151
  if (t.length === 0)
@@ -4153,8 +4153,8 @@ function V(r4, e, t, ...n) {
4153
4153
  let [{ value: i2 }] = U(t, 1), o = A(i2), s = o ? i2.value : i2;
4154
4154
  if (typeof s != "number")
4155
4155
  throw new Error("Math function cannot be called with non-number");
4156
- let a = r4(s, ...n.map((l2) => l2.eval(e, t)[0]?.value)), c2 = o ? "Quantity" : t[0].type, p2 = o ? { ...i2, value: a } : a;
4157
- return [{ type: c2, value: p2 }];
4156
+ let a = r4(s, ...n.map((l2) => l2.eval(e, t)[0]?.value)), c2 = o ? "Quantity" : t[0].type, f = o ? { ...i2, value: a } : a;
4157
+ return [{ type: c2, value: f }];
4158
4158
  }
4159
4159
  function U(r4, e) {
4160
4160
  if (r4.length !== e)
@@ -4164,7 +4164,7 @@ function U(r4, e) {
4164
4164
  throw new Error("Expected non-null argument");
4165
4165
  return r4;
4166
4166
  }
4167
- var k = class {
4167
+ var I = class {
4168
4168
  constructor(e) {
4169
4169
  this.value = e;
4170
4170
  }
@@ -4176,7 +4176,7 @@ var k = class {
4176
4176
  return typeof e == "string" ? `'${e}'` : e.toString();
4177
4177
  }
4178
4178
  };
4179
- var M = class {
4179
+ var N = class {
4180
4180
  constructor(e) {
4181
4181
  this.name = e;
4182
4182
  }
@@ -4194,13 +4194,13 @@ var M = class {
4194
4194
  evalValue(e) {
4195
4195
  let t = e.value;
4196
4196
  if (!(!t || typeof t != "object"))
4197
- return _(t) && t.resourceType === this.name ? e : P(e, this.name);
4197
+ return _(t) && t.resourceType === this.name ? e : E(e, this.name);
4198
4198
  }
4199
4199
  toString() {
4200
4200
  return this.name;
4201
4201
  }
4202
4202
  };
4203
- var Ce = class {
4203
+ var we = class {
4204
4204
  eval() {
4205
4205
  return [];
4206
4206
  }
@@ -4208,7 +4208,7 @@ var Ce = class {
4208
4208
  return "{}";
4209
4209
  }
4210
4210
  };
4211
- var we = class extends Se {
4211
+ var Ie = class extends Se {
4212
4212
  constructor(t, n, i2) {
4213
4213
  super(t, n);
4214
4214
  this.impl = i2;
@@ -4220,17 +4220,17 @@ var we = class extends Se {
4220
4220
  return this.operator + this.child.toString();
4221
4221
  }
4222
4222
  };
4223
- var z = class extends Q {
4223
+ var K = class extends $ {
4224
4224
  constructor(e, t) {
4225
4225
  super("as", e, t);
4226
4226
  }
4227
4227
  eval(e, t) {
4228
- return R.ofType(e, this.left.eval(e, t), this.right);
4228
+ return S.ofType(e, this.left.eval(e, t), this.right);
4229
4229
  }
4230
4230
  };
4231
- var v = class extends Q {
4231
+ var v = class extends $ {
4232
4232
  };
4233
- var E = class extends v {
4233
+ var P = class extends v {
4234
4234
  constructor(t, n, i2, o) {
4235
4235
  super(t, n, i2);
4236
4236
  this.impl = o;
@@ -4242,11 +4242,11 @@ var E = class extends v {
4242
4242
  let o = this.right.eval(t, n);
4243
4243
  if (o.length !== 1)
4244
4244
  return [];
4245
- let s = i2[0].value, a = o[0].value, c2 = A(s) ? s.value : s, p2 = A(a) ? a.value : a, l2 = this.impl(c2, p2);
4246
- return typeof l2 == "boolean" ? d(l2) : A(s) ? [{ type: "Quantity", value: { ...s, value: l2 } }] : [T(l2)];
4245
+ let s = i2[0].value, a = o[0].value, c2 = A(s) ? s.value : s, f = A(a) ? a.value : a, l2 = this.impl(c2, f);
4246
+ return typeof l2 == "boolean" ? d(l2) : A(s) ? [{ type: "Quantity", value: { ...s, value: l2 } }] : [x(l2)];
4247
4247
  }
4248
4248
  };
4249
- var ke = class extends Q {
4249
+ var ke = class extends $ {
4250
4250
  constructor(e, t) {
4251
4251
  super("&", e, t);
4252
4252
  }
@@ -4255,7 +4255,7 @@ var ke = class extends Q {
4255
4255
  return o.length > 0 && o.every((s) => typeof s.value == "string") ? [{ type: "string", value: o.map((s) => s.value).join("") }] : o;
4256
4256
  }
4257
4257
  };
4258
- var Ie = class extends v {
4258
+ var De = class extends v {
4259
4259
  constructor(e, t) {
4260
4260
  super("contains", e, t);
4261
4261
  }
@@ -4264,7 +4264,7 @@ var Ie = class extends v {
4264
4264
  return d(n.some((o) => o.value === i2[0].value));
4265
4265
  }
4266
4266
  };
4267
- var De = class extends v {
4267
+ var Oe = class extends v {
4268
4268
  constructor(e, t) {
4269
4269
  super("in", e, t);
4270
4270
  }
@@ -4273,7 +4273,7 @@ var De = class extends v {
4273
4273
  return n ? d(i2.some((o) => o.value === n.value)) : [];
4274
4274
  }
4275
4275
  };
4276
- var H = class extends Q {
4276
+ var H = class extends $ {
4277
4277
  constructor(e, t) {
4278
4278
  super(".", e, t);
4279
4279
  }
@@ -4284,52 +4284,52 @@ var H = class extends Q {
4284
4284
  return `${this.left.toString()}.${this.right.toString()}`;
4285
4285
  }
4286
4286
  };
4287
- var ee = class extends Q {
4287
+ var re = class extends $ {
4288
4288
  constructor(e, t) {
4289
4289
  super("|", e, t);
4290
4290
  }
4291
4291
  eval(e, t) {
4292
4292
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
4293
- return Ae([...n, ...i2]);
4293
+ return Ee([...n, ...i2]);
4294
4294
  }
4295
4295
  };
4296
- var Oe = class extends v {
4296
+ var Ve = class extends v {
4297
4297
  constructor(e, t) {
4298
4298
  super("=", e, t);
4299
4299
  }
4300
4300
  eval(e, t) {
4301
4301
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
4302
- return ft(n, i2);
4302
+ return mt(n, i2);
4303
4303
  }
4304
4304
  };
4305
- var Ve = class extends v {
4305
+ var Ue = class extends v {
4306
4306
  constructor(e, t) {
4307
4307
  super("!=", e, t);
4308
4308
  }
4309
4309
  eval(e, t) {
4310
4310
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
4311
- return pt(ft(n, i2));
4311
+ return ht(mt(n, i2));
4312
4312
  }
4313
4313
  };
4314
- var Ue = class extends v {
4314
+ var Le = class extends v {
4315
4315
  constructor(e, t) {
4316
4316
  super("~", e, t);
4317
4317
  }
4318
4318
  eval(e, t) {
4319
4319
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
4320
- return mt(n, i2);
4320
+ return yt(n, i2);
4321
4321
  }
4322
4322
  };
4323
- var Le = class extends v {
4323
+ var _e = class extends v {
4324
4324
  constructor(e, t) {
4325
4325
  super("!~", e, t);
4326
4326
  }
4327
4327
  eval(e, t) {
4328
4328
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
4329
- return pt(mt(n, i2));
4329
+ return ht(yt(n, i2));
4330
4330
  }
4331
4331
  };
4332
- var K = class extends v {
4332
+ var J = class extends v {
4333
4333
  constructor(e, t) {
4334
4334
  super("is", e, t);
4335
4335
  }
@@ -4338,10 +4338,10 @@ var K = class extends v {
4338
4338
  if (n.length !== 1)
4339
4339
  return [];
4340
4340
  let i2 = this.right.name;
4341
- return d(Ee(n[0], i2));
4341
+ return d(Pe(n[0], i2));
4342
4342
  }
4343
4343
  };
4344
- var _e = class extends v {
4344
+ var Me = class extends v {
4345
4345
  constructor(e, t) {
4346
4346
  super("and", e, t);
4347
4347
  }
@@ -4359,7 +4359,7 @@ var Ne = class extends v {
4359
4359
  return n?.value === false && i2?.value === false ? d(false) : n?.value || i2?.value ? d(true) : [];
4360
4360
  }
4361
4361
  };
4362
- var Me = class extends v {
4362
+ var Be = class extends v {
4363
4363
  constructor(e, t) {
4364
4364
  super("xor", e, t);
4365
4365
  }
@@ -4368,7 +4368,7 @@ var Me = class extends v {
4368
4368
  return !n || !i2 ? [] : d(n.value !== i2.value);
4369
4369
  }
4370
4370
  };
4371
- var Be = class extends v {
4371
+ var Fe = class extends v {
4372
4372
  constructor(e, t) {
4373
4373
  super("implies", e, t);
4374
4374
  }
@@ -4383,7 +4383,7 @@ var B = class {
4383
4383
  this.args = t;
4384
4384
  }
4385
4385
  eval(e, t) {
4386
- let n = R[this.name];
4386
+ let n = S[this.name];
4387
4387
  if (!n)
4388
4388
  throw new Error("Unrecognized function: " + this.name);
4389
4389
  return n(e, t, ...this.args);
@@ -4392,7 +4392,7 @@ var B = class {
4392
4392
  return `${this.name}(${this.args.map((e) => e.toString()).join(", ")})`;
4393
4393
  }
4394
4394
  };
4395
- var J = class {
4395
+ var Y = class {
4396
4396
  constructor(e, t) {
4397
4397
  this.left = e;
4398
4398
  this.expr = t;
@@ -4411,60 +4411,60 @@ var J = class {
4411
4411
  return `${this.left.toString()}[${this.expr.toString()}]`;
4412
4412
  }
4413
4413
  };
4414
- var ce = ["!=", "!~", "<=", ">=", "{}", "->"];
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 };
4416
- var $n = { parse(r4) {
4414
+ var le = ["!=", "!~", "<=", ">=", "{}", "->"];
4415
+ var p = { 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 };
4416
+ var Gn = { parse(r4) {
4417
4417
  let e = r4.consumeAndParse();
4418
4418
  if (!r4.match(")"))
4419
4419
  throw new Error("Parse error: expected `)` got `" + r4.peek()?.value + "`");
4420
4420
  return e;
4421
4421
  } };
4422
- var Hn = { parse(r4, e) {
4422
+ var zn = { parse(r4, e) {
4423
4423
  let t = r4.consumeAndParse();
4424
4424
  if (!r4.match("]"))
4425
4425
  throw new Error("Parse error: expected `]`");
4426
- return new J(e, t);
4427
- }, precedence: f.Indexer };
4428
- var Wn = { parse(r4, e) {
4429
- if (!(e instanceof M))
4426
+ return new Y(e, t);
4427
+ }, precedence: p.Indexer };
4428
+ var Kn = { parse(r4, e) {
4429
+ if (!(e instanceof N))
4430
4430
  throw new Error("Unexpected parentheses");
4431
4431
  let t = [];
4432
4432
  for (; !r4.match(")"); )
4433
4433
  t.push(r4.consumeAndParse()), r4.match(",");
4434
4434
  return new B(e.name, t);
4435
- }, precedence: f.FunctionCall };
4436
- function Gn(r4) {
4435
+ }, precedence: p.FunctionCall };
4436
+ function Jn(r4) {
4437
4437
  let e = r4.split(" "), t = parseFloat(e[0]), n = e[1];
4438
4438
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
4439
4439
  }
4440
- function ue() {
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));
4440
+ function pe() {
4441
+ return new Ae().registerPrefix("String", { parse: (r4, e) => new I({ type: "string", value: e.value }) }).registerPrefix("DateTime", { parse: (r4, e) => new I({ type: "dateTime", value: te(e.value) }) }).registerPrefix("Quantity", { parse: (r4, e) => new I({ type: "Quantity", value: Jn(e.value) }) }).registerPrefix("Number", { parse: (r4, e) => new I({ type: "decimal", value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new I({ type: "boolean", value: true }) }).registerPrefix("false", { parse: () => new I({ type: "boolean", value: false }) }).registerPrefix("Symbol", { parse: (r4, e) => new N(e.value) }).registerPrefix("{}", { parse: () => new we() }).registerPrefix("(", Gn).registerInfix("[", zn).registerInfix("(", Kn).prefix("+", p.UnaryAdd, (r4, e) => new Ie("+", e, (t) => t)).prefix("-", p.UnarySubtract, (r4, e) => new P("-", e, e, (t, n) => -n)).infixLeft(".", p.Dot, (r4, e, t) => new H(r4, t)).infixLeft("/", p.Divide, (r4, e, t) => new P("/", r4, t, (n, i2) => n / i2)).infixLeft("*", p.Multiply, (r4, e, t) => new P("*", r4, t, (n, i2) => n * i2)).infixLeft("+", p.Add, (r4, e, t) => new P("+", r4, t, (n, i2) => n + i2)).infixLeft("-", p.Subtract, (r4, e, t) => new P("-", r4, t, (n, i2) => n - i2)).infixLeft("|", p.Union, (r4, e, t) => new re(r4, t)).infixLeft("=", p.Equals, (r4, e, t) => new Ve(r4, t)).infixLeft("!=", p.NotEquals, (r4, e, t) => new Ue(r4, t)).infixLeft("~", p.Equivalent, (r4, e, t) => new Le(r4, t)).infixLeft("!~", p.NotEquivalent, (r4, e, t) => new _e(r4, t)).infixLeft("<", p.LessThan, (r4, e, t) => new P("<", r4, t, (n, i2) => n < i2)).infixLeft("<=", p.LessThanOrEquals, (r4, e, t) => new P("<=", r4, t, (n, i2) => n <= i2)).infixLeft(">", p.GreaterThan, (r4, e, t) => new P(">", r4, t, (n, i2) => n > i2)).infixLeft(">=", p.GreaterThanOrEquals, (r4, e, t) => new P(">=", r4, t, (n, i2) => n >= i2)).infixLeft("&", p.Ampersand, (r4, e, t) => new ke(r4, t)).infixLeft("and", p.And, (r4, e, t) => new Me(r4, t)).infixLeft("as", p.As, (r4, e, t) => new K(r4, t)).infixLeft("contains", p.Contains, (r4, e, t) => new De(r4, t)).infixLeft("div", p.Divide, (r4, e, t) => new P("div", r4, t, (n, i2) => n / i2 | 0)).infixLeft("in", p.In, (r4, e, t) => new Oe(r4, t)).infixLeft("is", p.Is, (r4, e, t) => new J(r4, t)).infixLeft("mod", p.Modulo, (r4, e, t) => new P("mod", r4, t, (n, i2) => n % i2)).infixLeft("or", p.Or, (r4, e, t) => new Ne(r4, t)).infixLeft("xor", p.Xor, (r4, e, t) => new Be(r4, t)).infixLeft("implies", p.Implies, (r4, e, t) => new Fe(r4, t));
4442
4442
  }
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) {
4443
+ var Yn = pe();
4444
+ var br = ((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))(br || {});
4445
+ var fi = ((T) => (T.READ = "read", T.VREAD = "vread", T.UPDATE = "update", T.PATCH = "patch", T.DELETE = "delete", T.HISTORY = "history", T.HISTORY_INSTANCE = "history-instance", T.HISTORY_TYPE = "history-type", T.HISTORY_SYSTEM = "history-system", T.CREATE = "create", T.SEARCH = "search", T.SEARCH_TYPE = "search-type", T.SEARCH_SYSTEM = "search-system", T.SEARCH_COMPARTMENT = "search-compartment", T.CAPABILITIES = "capabilities", T.TRANSACTION = "transaction", T.BATCH = "batch", T.OPERATION = "operation", T))(fi || {});
4446
+ function wr(r4) {
4447
4447
  if (typeof window < "u")
4448
4448
  return window.atob(r4);
4449
4449
  if (typeof Buffer < "u")
4450
4450
  return Buffer.from(r4, "base64").toString("binary");
4451
4451
  throw new Error("Unable to decode base64");
4452
4452
  }
4453
- function Er(r4) {
4453
+ function Ir(r4) {
4454
4454
  if (typeof window < "u")
4455
4455
  return window.btoa(r4);
4456
4456
  if (typeof Buffer < "u")
4457
4457
  return Buffer.from(r4, "binary").toString("base64");
4458
4458
  throw new Error("Unable to encode base64");
4459
4459
  }
4460
- function bt() {
4460
+ function St() {
4461
4461
  let r4 = new Uint32Array(28);
4462
- return crypto.getRandomValues(r4), Xt(r4.buffer);
4462
+ return crypto.getRandomValues(r4), nr(r4.buffer);
4463
4463
  }
4464
- async function Pr(r4) {
4464
+ async function kr(r4) {
4465
4465
  return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r4));
4466
4466
  }
4467
- var qe = class {
4467
+ var je = class {
4468
4468
  constructor(e = 10) {
4469
4469
  this.max = e, this.cache = /* @__PURE__ */ new Map();
4470
4470
  }
@@ -4488,8 +4488,8 @@ var qe = class {
4488
4488
  return this.cache.keys().next().value;
4489
4489
  }
4490
4490
  };
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" };
4492
- var je = class {
4491
+ var X = { 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" };
4492
+ var $e = class {
4493
4493
  constructor() {
4494
4494
  this.listeners = {};
4495
4495
  }
@@ -4511,31 +4511,31 @@ var je = class {
4511
4511
  return t && t.forEach((n) => n.call(this, e)), !e.defaultPrevented;
4512
4512
  }
4513
4513
  };
4514
- function xi(r4) {
4515
- let e = r4.replace(/-/g, "+").replace(/_/g, "/"), t = Ar(e), n = Array.from(t).reduce((o, s) => {
4514
+ function Ri(r4) {
4515
+ let e = r4.replace(/-/g, "+").replace(/_/g, "/"), t = wr(e), n = Array.from(t).reduce((o, s) => {
4516
4516
  let a = ("00" + s.charCodeAt(0).toString(16)).slice(-2);
4517
4517
  return `${o}%${a}`;
4518
4518
  }, ""), i2 = decodeURIComponent(n);
4519
4519
  return JSON.parse(i2);
4520
4520
  }
4521
- function kr(r4) {
4521
+ function Or(r4) {
4522
4522
  return r4.split(".").length === 3;
4523
4523
  }
4524
- function St(r4) {
4524
+ function Et(r4) {
4525
4525
  let [e, t, n] = r4.split(".");
4526
- return xi(t);
4526
+ return Ri(t);
4527
4527
  }
4528
- function Ir(r4) {
4528
+ function Vr(r4) {
4529
4529
  try {
4530
- return typeof St(r4).login_id == "string";
4530
+ return typeof Et(r4).login_id == "string";
4531
4531
  } catch {
4532
4532
  return false;
4533
4533
  }
4534
4534
  }
4535
- var Ti;
4535
+ var Si;
4536
4536
  var w = class {
4537
4537
  constructor(e) {
4538
- this[Ti] = "ReadablePromise";
4538
+ this[Si] = "ReadablePromise";
4539
4539
  this.status = "pending";
4540
4540
  this.suspender = e.then((t) => (this.status = "success", this.response = t, t), (t) => {
4541
4541
  throw this.status = "error", this.error = t, t;
@@ -4567,10 +4567,10 @@ var w = class {
4567
4567
  return this.suspender.finally(e);
4568
4568
  }
4569
4569
  };
4570
- Ti = Symbol.toStringTag;
4570
+ Si = Symbol.toStringTag;
4571
4571
  var Qe = class {
4572
4572
  constructor() {
4573
- this.storage = typeof localStorage < "u" ? localStorage : new Rt();
4573
+ this.storage = typeof localStorage < "u" ? localStorage : new Pt();
4574
4574
  }
4575
4575
  clear() {
4576
4576
  this.storage.clear();
@@ -4586,10 +4586,10 @@ var Qe = class {
4586
4586
  return t ? JSON.parse(t) : void 0;
4587
4587
  }
4588
4588
  setObject(e, t) {
4589
- this.setString(e, t ? zt(t) : void 0);
4589
+ this.setString(e, t ? er(t) : void 0);
4590
4590
  }
4591
4591
  };
4592
- var Rt = class {
4592
+ var Pt = class {
4593
4593
  constructor() {
4594
4594
  this.data = /* @__PURE__ */ new Map();
4595
4595
  }
@@ -4612,19 +4612,20 @@ var Rt = class {
4612
4612
  return Array.from(this.data.keys())[e];
4613
4613
  }
4614
4614
  };
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
+ var Ai = "https://api.medplum.com/";
4616
+ var Ei = 1e3;
4617
+ var Pi = 6e4;
4618
+ var Ur = "Binary/";
4619
+ var Lr = { resourceType: "Device", id: "system", deviceName: [{ name: "System" }] };
4620
+ var Ci = ((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))(Ci || {});
4621
+ var wi = ((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))(wi || {});
4622
+ var Ii = ((e) => (e.JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", e))(Ii || {});
4623
+ var _r = class extends $e {
4623
4624
  constructor(t) {
4624
4625
  super();
4625
4626
  if (t?.baseUrl && !t.baseUrl.startsWith("http"))
4626
4627
  throw new Error("Base URL must start with http or https");
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);
4628
+ this.options = t ?? {}, this.fetch = t?.fetch ?? ki(), this.storage = t?.storage ?? new Qe(), this.createPdfImpl = t?.createPdf, this.baseUrl = Nr(t?.baseUrl ?? Ai), this.fhirBaseUrl = Nr(He(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4/")), this.authorizeUrl = He(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = He(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = He(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.onUnauthenticated = t?.onUnauthenticated, this.cacheTime = t?.cacheTime ?? Pi, this.cacheTime > 0 ? this.requestCache = new je(t?.resourceCacheSize ?? Ei) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0);
4628
4629
  let n = this.getActiveLogin();
4629
4630
  n && (this.setAccessToken(n.accessToken, n.refreshToken), this.refreshProfile().catch(console.log)), this.setupStorageListener();
4630
4631
  }
@@ -4634,6 +4635,12 @@ var Vr = class extends je {
4634
4635
  getAuthorizeUrl() {
4635
4636
  return this.authorizeUrl;
4636
4637
  }
4638
+ getTokenUrl() {
4639
+ return this.tokenUrl;
4640
+ }
4641
+ getLogoutUrl() {
4642
+ return this.logoutUrl;
4643
+ }
4637
4644
  clear() {
4638
4645
  this.storage.clear(), this.clearActiveLogin();
4639
4646
  }
@@ -4665,13 +4672,13 @@ var Vr = class extends je {
4665
4672
  return this.setCacheEntry(t, s), s;
4666
4673
  }
4667
4674
  post(t, n, i2, o = {}) {
4668
- return t = t.toString(), n && this.setRequestBody(o, n), i2 && this.setRequestContentType(o, i2), this.invalidateUrl(t), this.request("POST", t, o);
4675
+ return t = t.toString(), this.setRequestBody(o, n), i2 && this.setRequestContentType(o, i2), this.invalidateUrl(t), this.request("POST", t, o);
4669
4676
  }
4670
4677
  put(t, n, i2, o = {}) {
4671
- return t = t.toString(), n && this.setRequestBody(o, n), i2 && this.setRequestContentType(o, i2), this.invalidateUrl(t), this.request("PUT", t, o);
4678
+ return t = t.toString(), this.setRequestBody(o, n), i2 && this.setRequestContentType(o, i2), this.invalidateUrl(t), this.request("PUT", t, o);
4672
4679
  }
4673
4680
  patch(t, n, i2 = {}) {
4674
- return t = t.toString(), this.setRequestBody(i2, n), this.setRequestContentType(i2, Y.JSON_PATCH), this.invalidateUrl(t), this.request("PATCH", t, i2);
4681
+ return t = t.toString(), this.setRequestBody(i2, n), this.setRequestContentType(i2, X.JSON_PATCH), this.invalidateUrl(t), this.request("PATCH", t, i2);
4675
4682
  }
4676
4683
  delete(t, n) {
4677
4684
  return t = t.toString(), this.invalidateUrl(t), this.request("DELETE", t, n);
@@ -4727,7 +4734,7 @@ var Vr = class extends je {
4727
4734
  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();
4728
4735
  }
4729
4736
  fhirUrl(...t) {
4730
- return new URL(this.fhirBaseUrl + t.join("/"));
4737
+ return new URL(t.join("/"), this.fhirBaseUrl);
4731
4738
  }
4732
4739
  fhirSearchUrl(t, n) {
4733
4740
  let i2 = this.fhirUrl(t);
@@ -4738,11 +4745,11 @@ var Vr = class extends je {
4738
4745
  if (a)
4739
4746
  return a.value;
4740
4747
  let c2 = new w((async () => {
4741
- let p2 = await this.get(o, i2);
4742
- if (p2.entry)
4743
- for (let l2 of p2.entry)
4748
+ let f = await this.get(o, i2);
4749
+ if (f.entry)
4750
+ for (let l2 of f.entry)
4744
4751
  this.cacheResource(l2.resource);
4745
- return p2;
4752
+ return f;
4746
4753
  })());
4747
4754
  return this.setCacheEntry(s, c2), c2;
4748
4755
  }
@@ -4752,23 +4759,23 @@ var Vr = class extends je {
4752
4759
  let s = o.toString() + "-searchOne", a = this.getCacheEntry(s, i2);
4753
4760
  if (a)
4754
4761
  return a.value;
4755
- let c2 = new w(this.search(t, o.searchParams, i2).then((p2) => p2.entry?.[0]?.resource));
4762
+ let c2 = new w(this.search(t, o.searchParams, i2).then((f) => f.entry?.[0]?.resource));
4756
4763
  return this.setCacheEntry(s, c2), c2;
4757
4764
  }
4758
4765
  searchResources(t, n, i2) {
4759
4766
  let s = this.fhirSearchUrl(t, n).toString() + "-searchResources", a = this.getCacheEntry(s, i2);
4760
4767
  if (a)
4761
4768
  return a.value;
4762
- let c2 = new w(this.search(t, n, i2).then(Nr));
4769
+ let c2 = new w(this.search(t, n, i2).then(Fr));
4763
4770
  return this.setCacheEntry(s, c2), c2;
4764
4771
  }
4765
4772
  async *searchResourcePages(t, n, i2) {
4766
4773
  let o = this.fhirSearchUrl(t, n);
4767
4774
  for (; o; ) {
4768
- let s = new URL(o).searchParams, a = await this.search(t, s, i2), c2 = a.link?.find((p2) => p2.relation === "next");
4775
+ let s = new URL(o).searchParams, a = await this.search(t, s, i2), c2 = a.link?.find((f) => f.relation === "next");
4769
4776
  if (!a.entry?.length && !c2)
4770
4777
  break;
4771
- yield Nr(a), o = c2?.url ? new URL(c2.url) : void 0;
4778
+ yield Fr(a), o = c2?.url ? new URL(c2.url) : void 0;
4772
4779
  }
4773
4780
  }
4774
4781
  searchValueSet(t, n, i2) {
@@ -4784,7 +4791,7 @@ var Vr = class extends je {
4784
4791
  if (!n)
4785
4792
  return;
4786
4793
  if (n === "system")
4787
- return Or;
4794
+ return Lr;
4788
4795
  let [i2, o] = n.split("/");
4789
4796
  if (!(!i2 || !o))
4790
4797
  return this.getCached(i2, o);
@@ -4797,7 +4804,7 @@ var Vr = class extends je {
4797
4804
  if (!i2)
4798
4805
  return new w(Promise.reject(new Error("Missing reference")));
4799
4806
  if (i2 === "system")
4800
- return new w(Promise.resolve(Or));
4807
+ return new w(Promise.resolve(Lr));
4801
4808
  let [o, s] = i2.split("/");
4802
4809
  return !o || !s ? new w(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
4803
4810
  }
@@ -4841,9 +4848,9 @@ var Vr = class extends je {
4841
4848
  }
4842
4849
  }`.replace(/\s+/g, " "), a = await this.graphql(s);
4843
4850
  for (let c2 of a.data.StructureDefinitionList)
4844
- ct(c2);
4851
+ dt(c2);
4845
4852
  for (let c2 of a.data.SearchParameterList)
4846
- ut(c2);
4853
+ lt(c2);
4847
4854
  return y;
4848
4855
  })());
4849
4856
  return this.setCacheEntry(n, o), o;
@@ -4876,7 +4883,7 @@ var Vr = class extends je {
4876
4883
  uploadwithProgress(t, n, i2, o) {
4877
4884
  return new Promise((s, a) => {
4878
4885
  let c2 = new XMLHttpRequest();
4879
- c2.responseType = "json", c2.onabort = () => a(new Error("Request aborted")), c2.onerror = () => a(new Error("Request error")), o && (c2.upload.onprogress = (p2) => o(p2), c2.upload.onload = (p2) => o(p2)), c2.onload = () => {
4886
+ c2.responseType = "json", c2.onabort = () => a(new Error("Request aborted")), c2.onerror = () => a(new Error("Request error")), o && (c2.upload.onprogress = (f) => o(f), c2.upload.onload = (f) => o(f)), c2.onload = () => {
4880
4887
  c2.status >= 200 && c2.status < 300 ? s(c2.response) : a(new Error(c2.statusText));
4881
4888
  }, c2.open("POST", t), c2.withCredentials = true, c2.setRequestHeader("Authorization", "Bearer " + this.accessToken), c2.setRequestHeader("Cache-Control", "no-cache, no-store, max-age=0"), c2.setRequestHeader("Content-Type", i2), c2.setRequestHeader("X-Medplum", "extended"), c2.send(n);
4882
4889
  });
@@ -4889,7 +4896,7 @@ var Vr = class extends je {
4889
4896
  }
4890
4897
  createComment(t, n, i2) {
4891
4898
  let o = this.getProfile(), s, a;
4892
- return t.resourceType === "Encounter" && (s = ie(t), a = t.subject), t.resourceType === "ServiceRequest" && (s = t.encounter, a = t.subject), t.resourceType === "Patient" && (a = ie(t)), this.createResource({ resourceType: "Communication", basedOn: [ie(t)], encounter: s, subject: a, sender: o ? ie(o) : void 0, sent: (/* @__PURE__ */ new Date()).toISOString(), payload: [{ contentString: n }] }, i2);
4899
+ return t.resourceType === "Encounter" && (s = ae(t), a = t.subject), t.resourceType === "ServiceRequest" && (s = t.encounter, a = t.subject), t.resourceType === "Patient" && (a = ae(t)), this.createResource({ resourceType: "Communication", basedOn: [ae(t)], encounter: s, subject: a, sender: o ? ae(o) : void 0, sent: (/* @__PURE__ */ new Date()).toISOString(), payload: [{ contentString: n }] }, i2);
4893
4900
  }
4894
4901
  async updateResource(t, n) {
4895
4902
  if (!t.resourceType)
@@ -4924,10 +4931,10 @@ var Vr = class extends je {
4924
4931
  return this.post(this.fhirBaseUrl.slice(0, -1), t, void 0, n);
4925
4932
  }
4926
4933
  sendEmail(t, n) {
4927
- return this.post("email/v1/send", t, Y.JSON, n);
4934
+ return this.post("email/v1/send", t, X.JSON, n);
4928
4935
  }
4929
4936
  graphql(t, n, i2, o) {
4930
- return this.post(this.fhirUrl("$graphql"), { query: t, operationName: n, variables: i2 }, Y.JSON, o);
4937
+ return this.post(this.fhirUrl("$graphql"), { query: t, operationName: n, variables: i2 }, X.JSON, o);
4931
4938
  }
4932
4939
  readResourceGraph(t, n, i2, o) {
4933
4940
  return this.get(`${this.fhirUrl(t, n)}/$graph?graph=${i2}`, o);
@@ -4942,7 +4949,7 @@ var Vr = class extends je {
4942
4949
  return this.accessToken;
4943
4950
  }
4944
4951
  setAccessToken(t, n) {
4945
- this.accessToken = t, this.refreshToken = n, this.sessionDetails = void 0, this.medplumServer = Ir(t);
4952
+ this.accessToken = t, this.refreshToken = n, this.sessionDetails = void 0, this.medplumServer = Vr(t);
4946
4953
  }
4947
4954
  getLogins() {
4948
4955
  return this.storage.getObject("logins") ?? [];
@@ -4985,16 +4992,14 @@ var Vr = class extends je {
4985
4992
  getAccessPolicy() {
4986
4993
  return this.sessionDetails?.accessPolicy;
4987
4994
  }
4988
- normalizeFetchUrl(t) {
4989
- let n = t.toString();
4990
- return n.startsWith(Dr) && (n = this.fhirUrl(n).toString()), n;
4991
- }
4992
4995
  async download(t, n = {}) {
4993
- return this.refreshPromise && await this.refreshPromise, this.addFetchOptionsDefaults(n), (await this.fetch(this.normalizeFetchUrl(t), n)).blob();
4996
+ this.refreshPromise && await this.refreshPromise;
4997
+ let i2 = t.toString();
4998
+ return i2.startsWith(Ur) && (t = this.fhirUrl(i2)), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
4994
4999
  }
4995
5000
  async uploadMedia(t, n, i2, o, s) {
4996
5001
  let a = await this.createBinary(t, i2, n);
4997
- return this.createResource({ ...o, resourceType: "Media", content: { contentType: n, url: Dr + a.id, title: i2 } }, s);
5002
+ return this.createResource({ ...o, resourceType: "Media", content: { contentType: n, url: Ur + a.id, title: i2 } }, s);
4998
5003
  }
4999
5004
  async bulkExport(t = "", n, i2, o) {
5000
5005
  let s = t && `${t}/`, a = this.fhirUrl(`${s}$export`);
@@ -5006,7 +5011,7 @@ var Vr = class extends je {
5006
5011
  i2.Prefer = "respond-async";
5007
5012
  let o = await this.fetchWithRetry(t, n);
5008
5013
  if (o.status === 202) {
5009
- let s = await _r(o);
5014
+ let s = await Br(o);
5010
5015
  if (s)
5011
5016
  return this.pollStatus(s);
5012
5017
  }
@@ -5040,37 +5045,47 @@ var Vr = class extends je {
5040
5045
  return;
5041
5046
  let a = t.headers.get("content-type")?.includes("json");
5042
5047
  if (t.status === 404 && !a)
5043
- throw new m(Lt);
5044
- let c2 = t.headers.get("content-location");
5045
- if (t.status === 201 && c2 && o.redirect === "follow")
5048
+ throw new h(qt);
5049
+ let c2 = t.headers.get("content-location"), f = o.redirect ?? this.options.redirect;
5050
+ if (t.status === 201 && c2 && f === "follow")
5046
5051
  return this.request("GET", c2, { ...o, body: void 0 });
5047
- let p2;
5052
+ let l2;
5048
5053
  if (a)
5049
5054
  try {
5050
- p2 = await t.json();
5051
- } catch (l2) {
5052
- throw console.error("Error parsing response", t.status, l2), l2;
5055
+ l2 = await t.json();
5056
+ } catch (F) {
5057
+ throw console.error("Error parsing response", t.status, F), F;
5053
5058
  }
5054
5059
  else
5055
- p2 = await t.text();
5060
+ l2 = await t.text();
5056
5061
  if (t.status >= 400)
5057
- throw new m(rt(p2));
5058
- return p2;
5062
+ throw new h(nt(l2));
5063
+ return l2;
5059
5064
  }
5060
5065
  async fetchWithRetry(t, n) {
5061
5066
  t.startsWith("http") || (t = new URL(t, this.baseUrl).href);
5062
5067
  let i2 = 3, o = 200, s;
5063
5068
  for (let a = 0; a < i2; a++) {
5064
5069
  try {
5065
- if (s = await this.fetch(t, n), s.status < 500)
5070
+ if (this.options.verbose && this.logRequest(t, n), s = await this.fetch(t, n), this.options.verbose && this.logResponse(s), s.status < 500)
5066
5071
  return s;
5067
5072
  } catch (c2) {
5068
5073
  this.retryCatch(a, i2, c2);
5069
5074
  }
5070
- await at(o);
5075
+ await ut(o);
5071
5076
  }
5072
5077
  return s;
5073
5078
  }
5079
+ logRequest(t, n) {
5080
+ if (console.log(`> ${n.method} ${t}`), n.headers) {
5081
+ let i2 = n.headers, o = Object.entries(i2).sort((s, a) => s[0].localeCompare(a[0]));
5082
+ for (let [s, a] of o)
5083
+ console.log(`> ${s}: ${a}`);
5084
+ }
5085
+ }
5086
+ logResponse(t) {
5087
+ console.log(`< ${t.status} ${t.statusText}`), t.headers && t.headers.forEach((n, i2) => console.log(`< ${i2}: ${n}`));
5088
+ }
5074
5089
  async pollStatus(t) {
5075
5090
  let n = true, i2, o = 2e3;
5076
5091
  for (; n; ) {
@@ -5078,10 +5093,10 @@ var Vr = class extends je {
5078
5093
  this.addFetchOptionsDefaults(s);
5079
5094
  let a = await this.fetchWithRetry(t, s);
5080
5095
  if (a.status !== 202 && (n = false, i2 = a, a.status === 201)) {
5081
- let c2 = await _r(a);
5096
+ let c2 = await Br(a);
5082
5097
  c2 && (i2 = await this.fetchWithRetry(c2, s));
5083
5098
  }
5084
- await at(o);
5099
+ await ut(o);
5085
5100
  }
5086
5101
  return this.parseResponse(i2, "POST", t);
5087
5102
  }
@@ -5092,19 +5107,19 @@ var Vr = class extends je {
5092
5107
  try {
5093
5108
  o.resolve(await this.request(o.method, this.fhirBaseUrl + o.url, o.options));
5094
5109
  } catch (s) {
5095
- o.reject(new m(rt(s)));
5110
+ o.reject(new h(nt(s)));
5096
5111
  }
5097
5112
  return;
5098
5113
  }
5099
5114
  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);
5100
5115
  for (let o = 0; o < t.length; o++) {
5101
5116
  let s = t[o], a = i2.entry?.[o];
5102
- a?.response?.outcome && !tt(a.response.outcome) ? s.reject(new m(a.response.outcome)) : s.resolve(a?.resource);
5117
+ a?.response?.outcome && !rt(a.response.outcome) ? s.reject(new h(a.response.outcome)) : s.resolve(a?.resource);
5103
5118
  }
5104
5119
  }
5105
5120
  addFetchOptionsDefaults(t) {
5106
5121
  let n = t.headers;
5107
- n || (n = {}, t.headers = n), n.Accept = Y.FHIR_JSON, n["X-Medplum"] = "extended", t.body && !n["Content-Type"] && (n["Content-Type"] = Y.FHIR_JSON), this.accessToken ? n.Authorization = "Bearer " + this.accessToken : this.basicAuth && (n.Authorization = "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
5122
+ n || (n = {}, t.headers = n), n.Accept = X.FHIR_JSON, n["X-Medplum"] = "extended", t.body && !n["Content-Type"] && (n["Content-Type"] = X.FHIR_JSON), this.accessToken ? n.Authorization = "Bearer " + this.accessToken : this.basicAuth && (n.Authorization = "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
5108
5123
  }
5109
5124
  setRequestContentType(t, n) {
5110
5125
  t.headers || (t.headers = {});
@@ -5118,20 +5133,20 @@ var Vr = class extends je {
5118
5133
  return this.refresh() ? this.request(t, n, i2) : (this.clearActiveLogin(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new Error("Unauthenticated")));
5119
5134
  }
5120
5135
  async startPkce() {
5121
- let t = bt();
5136
+ let t = St();
5122
5137
  sessionStorage.setItem("pkceState", t);
5123
- let n = bt();
5138
+ let n = St();
5124
5139
  sessionStorage.setItem("codeVerifier", n);
5125
- let i2 = await Pr(n), o = Zt(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
5140
+ let i2 = await kr(n), o = ir(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
5126
5141
  return sessionStorage.setItem("codeChallenge", o), { codeChallengeMethod: "S256", codeChallenge: o };
5127
5142
  }
5128
5143
  async requestAuthorization(t) {
5129
5144
  let n = await this.ensureCodeChallenge(t ?? {}), i2 = new URL(this.authorizeUrl);
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());
5145
+ 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 ?? Mr()), 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());
5131
5146
  }
5132
5147
  processCode(t, n) {
5133
5148
  let i2 = new URLSearchParams();
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") {
5149
+ 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 ?? Mr()), typeof sessionStorage < "u") {
5135
5150
  let o = sessionStorage.getItem("codeVerifier");
5136
5151
  o && i2.set("code_verifier", o);
5137
5152
  }
@@ -5157,23 +5172,27 @@ var Vr = class extends je {
5157
5172
  let o = new URLSearchParams();
5158
5173
  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);
5159
5174
  }
5175
+ async startJwtAssertionLogin(t) {
5176
+ let n = new URLSearchParams();
5177
+ return n.append("grant_type", "client_credentials"), n.append("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), n.append("client_assertion", t), this.fetchTokens(n);
5178
+ }
5160
5179
  setBasicAuth(t, n) {
5161
- this.clientId = t, this.clientSecret = n, this.basicAuth = Er(t + ":" + n);
5180
+ this.clientId = t, this.clientSecret = n, this.basicAuth = Ir(t + ":" + n);
5162
5181
  }
5163
5182
  async invite(t, n) {
5164
5183
  return this.post("admin/projects/" + t + "/invite", n);
5165
5184
  }
5166
5185
  async fetchTokens(t) {
5167
- let n = { method: "POST", headers: { "Content-Type": Y.FORM_URL_ENCODED }, body: t.toString(), credentials: "include" }, i2 = n.headers;
5186
+ let n = { method: "POST", headers: { "Content-Type": X.FORM_URL_ENCODED }, body: t.toString(), credentials: "include" }, i2 = n.headers;
5168
5187
  this.basicAuth && (i2.Authorization = `Basic ${this.basicAuth}`);
5169
- let o = await this.fetch(this.tokenUrl, n);
5188
+ let o = await this.fetchWithRetry(this.tokenUrl, n);
5170
5189
  if (!o.ok) {
5171
5190
  this.clearActiveLogin();
5172
5191
  try {
5173
5192
  let a = await o.json();
5174
- throw new m(I(a.error_description));
5193
+ throw new h(k(a.error_description));
5175
5194
  } catch (a) {
5176
- throw new m(I("Failed to fetch tokens"), a);
5195
+ throw new h(k("Failed to fetch tokens"), a);
5177
5196
  }
5178
5197
  }
5179
5198
  let s = await o.json();
@@ -5181,8 +5200,8 @@ var Vr = class extends je {
5181
5200
  }
5182
5201
  async verifyTokens(t) {
5183
5202
  let n = t.access_token;
5184
- if (kr(n)) {
5185
- let i2 = St(n);
5203
+ if (Or(n)) {
5204
+ let i2 = Et(n);
5186
5205
  if (Date.now() >= i2.exp * 1e3)
5187
5206
  throw this.clearActiveLogin(), new Error("Token expired");
5188
5207
  if (i2.cid) {
@@ -5206,18 +5225,21 @@ var Vr = class extends je {
5206
5225
  throw i2;
5207
5226
  }
5208
5227
  };
5209
- function Ei() {
5228
+ function ki() {
5210
5229
  if (!globalThis.fetch)
5211
5230
  throw new Error("Fetch not available in this environment");
5212
5231
  return globalThis.fetch.bind(globalThis);
5213
5232
  }
5214
- function Ur() {
5233
+ function Mr() {
5215
5234
  return typeof window > "u" ? "" : window.location.protocol + "//" + window.location.host + "/";
5216
5235
  }
5217
- function Lr(r4) {
5218
- return r4 && (r4.endsWith("/") ? r4 : r4 + "/");
5236
+ function Nr(r4) {
5237
+ return r4.endsWith("/") ? r4 : r4 + "/";
5238
+ }
5239
+ function He(r4, e) {
5240
+ return new URL(e, r4).toString();
5219
5241
  }
5220
- async function _r(r4) {
5242
+ async function Br(r4) {
5221
5243
  let e = r4.headers.get("content-location");
5222
5244
  if (e)
5223
5245
  return e;
@@ -5225,17 +5247,17 @@ async function _r(r4) {
5225
5247
  if (t)
5226
5248
  return t;
5227
5249
  let n = await r4.json();
5228
- if (ye(n) && n.issue?.[0]?.diagnostics)
5250
+ if (ge(n) && n.issue?.[0]?.diagnostics)
5229
5251
  return n.issue[0].diagnostics;
5230
5252
  }
5231
- function Nr(r4) {
5253
+ function Fr(r4) {
5232
5254
  let e = r4.entry?.map((t) => t.resource) ?? [];
5233
5255
  return Object.assign(e, { bundle: r4 });
5234
5256
  }
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();
5257
+ var Di = [...le, "->", "<<", ">>"];
5258
+ var Oi = pe().registerInfix("->", { precedence: p.Arrow }).registerInfix(";", { precedence: p.Semicolon });
5259
+ var Vi = [...le, "eq", "ne", "co"];
5260
+ var _i = pe();
5239
5261
  var W = class {
5240
5262
  constructor(e = "\r", t = "|", n = "^", i2 = "~", o = "\\", s = "&") {
5241
5263
  this.segmentSeparator = e;
@@ -5252,7 +5274,7 @@ var W = class {
5252
5274
  return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
5253
5275
  }
5254
5276
  };
5255
- var Fr = class r {
5277
+ var $r = class r {
5256
5278
  constructor(e, t = new W()) {
5257
5279
  this.context = t, this.segments = e;
5258
5280
  }
@@ -5276,7 +5298,7 @@ var Fr = class r {
5276
5298
  }
5277
5299
  buildAck() {
5278
5300
  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";
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)]);
5301
+ return new r([new he(["MSH", this.context.getMsh2(), o, s, n, i2, Ni(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", c2], this.context), new he(["MSA", "AA", a, "OK"], this.context)]);
5280
5302
  }
5281
5303
  buildAckMessageType(e) {
5282
5304
  let t = e?.getField(9), n = t?.getComponent(2), i2 = t?.getComponent(3), o = "ACK";
@@ -5288,12 +5310,12 @@ var Fr = class r {
5288
5310
  throw n.type = "entity.parse.failed", n;
5289
5311
  }
5290
5312
  let t = new W("\r", e.charAt(3), e.charAt(4), e.charAt(5), e.charAt(6), e.charAt(7));
5291
- return new r(e.split(/[\r\n]+/).map((n) => pe.parse(n, t)), t);
5313
+ return new r(e.split(/[\r\n]+/).map((n) => he.parse(n, t)), t);
5292
5314
  }
5293
5315
  };
5294
- var pe = class r2 {
5316
+ var he = class r2 {
5295
5317
  constructor(e, t = new W()) {
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];
5318
+ this.context = t, tr(e) ? this.fields = e.map((n) => ie.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
5297
5319
  }
5298
5320
  get(e) {
5299
5321
  return this.fields[e];
@@ -5301,9 +5323,9 @@ var pe = class r2 {
5301
5323
  getField(e) {
5302
5324
  if (this.name === "MSH") {
5303
5325
  if (e === 1)
5304
- return new te([[this.context.getMsh1()]], this.context);
5326
+ return new ie([[this.context.getMsh1()]], this.context);
5305
5327
  if (e === 2)
5306
- return new te([[this.context.getMsh2()]], this.context);
5328
+ return new ie([[this.context.getMsh2()]], this.context);
5307
5329
  if (e > 2)
5308
5330
  return this.fields[e - 1];
5309
5331
  }
@@ -5316,10 +5338,10 @@ var pe = class r2 {
5316
5338
  return this.fields.map((e) => e.toString()).join(this.context.fieldSeparator);
5317
5339
  }
5318
5340
  static parse(e, t = new W()) {
5319
- return new r2(e.split(t.fieldSeparator).map((n) => te.parse(n, t)), t);
5341
+ return new r2(e.split(t.fieldSeparator).map((n) => ie.parse(n, t)), t);
5320
5342
  }
5321
5343
  };
5322
- var te = class r3 {
5344
+ var ie = class r3 {
5323
5345
  constructor(e, t = new W()) {
5324
5346
  this.context = t, this.components = e;
5325
5347
  }
@@ -5337,7 +5359,7 @@ var te = class r3 {
5337
5359
  return new r3(e.split(t.repetitionSeparator).map((n) => n.split(t.componentSeparator)), t);
5338
5360
  }
5339
5361
  };
5340
- function Vi(r4) {
5362
+ function Ni(r4) {
5341
5363
  let e = r4 instanceof Date ? r4 : new Date(r4), n = e.toISOString().replace(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i2 = e.getUTCMilliseconds();
5342
5364
  return i2 > 0 && (n += "." + i2.toString()), n;
5343
5365
  }
@@ -5352,8 +5374,8 @@ var i = class extends EventTarget {
5352
5374
  super.removeEventListener(n, e, t);
5353
5375
  }
5354
5376
  };
5355
- var m2 = String.fromCharCode(11);
5356
- var p = String.fromCharCode(28);
5377
+ var m = String.fromCharCode(11);
5378
+ var p2 = String.fromCharCode(28);
5357
5379
  var v2 = String.fromCharCode(13);
5358
5380
  var d2 = class extends Event {
5359
5381
  constructor(e, t) {
@@ -5376,8 +5398,8 @@ var c = class extends i {
5376
5398
  let o = "";
5377
5399
  e.on("data", (s) => {
5378
5400
  try {
5379
- if (o += s.toString(), o.endsWith(p + v2)) {
5380
- let r4 = Fr.parse(o.substring(1, o.length - 2));
5401
+ if (o += s.toString(), o.endsWith(p2 + v2)) {
5402
+ let r4 = $r.parse(o.substring(1, o.length - 2));
5381
5403
  this.dispatchEvent(new d2(this, r4)), o = "";
5382
5404
  }
5383
5405
  } catch (r4) {
@@ -5388,7 +5410,7 @@ var c = class extends i {
5388
5410
  });
5389
5411
  }
5390
5412
  send(e) {
5391
- this.socket.write(m2 + e.toString() + p + v2);
5413
+ this.socket.write(m + e.toString() + p2 + v2);
5392
5414
  }
5393
5415
  async sendAndWait(e) {
5394
5416
  let t = new Promise((o) => {
@@ -5505,7 +5527,7 @@ var AgentHl7ChannelConnection = class {
5505
5527
  type: "connect",
5506
5528
  accessToken: medplum.getAccessToken(),
5507
5529
  agentId: channel.app.agentId,
5508
- botId: Ro(channel.definition.targetReference)
5530
+ botId: wo(channel.definition.targetReference)
5509
5531
  })
5510
5532
  );
5511
5533
  });
@@ -5521,7 +5543,7 @@ var AgentHl7ChannelConnection = class {
5521
5543
  this.trySendToWebSocket();
5522
5544
  break;
5523
5545
  case "transmit":
5524
- this.hl7ConnectionQueue.push(Fr.parse(command.message));
5546
+ this.hl7ConnectionQueue.push($r.parse(command.message));
5525
5547
  this.trySendToHl7Connection();
5526
5548
  break;
5527
5549
  }
@@ -5575,7 +5597,7 @@ if (typeof require !== "undefined" && require.main === module) {
5575
5597
  process.exit(1);
5576
5598
  }
5577
5599
  const [_node, _script, baseUrl, clientId, clientSecret, agentId] = process.argv;
5578
- const medplum = new Vr({ baseUrl, clientId });
5600
+ const medplum = new _r({ baseUrl, clientId });
5579
5601
  medplum.startClientLogin(clientId, clientSecret).then(() => new App(medplum, agentId).start()).catch(console.error);
5580
5602
  }
5581
5603
  // Annotate the CommonJS export names for ESM import in node: