@medplum/agent 2.1.8 → 2.1.9

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 +99 -99
  2. package/package.json +1 -1
@@ -3591,10 +3591,10 @@ var xe = class {
3591
3591
  }, precedence: t });
3592
3592
  }
3593
3593
  construct(e) {
3594
- return new rt(e, this.prefixParselets, this.infixParselets);
3594
+ return new nt(e, this.prefixParselets, this.infixParselets);
3595
3595
  }
3596
3596
  };
3597
- var rt = class {
3597
+ var nt = class {
3598
3598
  constructor(e, t, n) {
3599
3599
  this.tokens = e, this.prefixParselets = t, this.infixParselets = n;
3600
3600
  }
@@ -3698,12 +3698,12 @@ function Gt(r4, e) {
3698
3698
  return JSON.stringify(r4, mn, e ? 2 : void 0);
3699
3699
  }
3700
3700
  function mn(r4, e) {
3701
- return !hn(r4) && R(e) ? void 0 : e;
3701
+ return !hn(r4) && b(e) ? void 0 : e;
3702
3702
  }
3703
3703
  function hn(r4) {
3704
3704
  return !!/\d+$/.exec(r4);
3705
3705
  }
3706
- function R(r4) {
3706
+ function b(r4) {
3707
3707
  if (r4 == null)
3708
3708
  return true;
3709
3709
  let e = typeof r4;
@@ -3730,21 +3730,21 @@ function Yt(r4) {
3730
3730
  function A(r4) {
3731
3731
  return r4.charAt(0).toUpperCase() + r4.substring(1);
3732
3732
  }
3733
- var ot = (r4) => new Promise((e) => {
3733
+ var st = (r4) => new Promise((e) => {
3734
3734
  setTimeout(e, r4);
3735
3735
  });
3736
3736
  function Ee(r4, e) {
3737
3737
  let t = [];
3738
3738
  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.length === 0 && r4.text ? r4.text : t.join(" ").trim();
3739
3739
  }
3740
- function Ln(r4) {
3740
+ function Un(r4) {
3741
3741
  let e = r4.max && r4.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : r4.max;
3742
3742
  return { path: "", description: "", type: r4.type ?? [], min: r4.min ?? 0, max: e ?? 1, isArray: !!e && e > 1, constraints: [] };
3743
3743
  }
3744
3744
  function tr(r4) {
3745
3745
  let e = /* @__PURE__ */ Object.create(null);
3746
3746
  for (let [t, n] of Object.entries(r4))
3747
- e[t] = { name: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i2, o]) => [i2, Ln(o)])), constraints: [], innerTypes: [] };
3747
+ e[t] = { name: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i2, o]) => [i2, Un(o)])), constraints: [], innerTypes: [] };
3748
3748
  return e;
3749
3749
  }
3750
3750
  var rr = { Element: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, BackboneElement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, Address: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: 9007199254740991, type: [{ code: "string" }] }, city: { type: [{ code: "string" }] }, district: { type: [{ code: "string" }] }, state: { type: [{ code: "string" }] }, postalCode: { type: [{ code: "string" }] }, country: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Age: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "author[x]": { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Organization"] }, { code: "string" }] }, time: { type: [{ code: "dateTime" }] }, text: { min: 1, type: [{ code: "markdown" }] } } }, Attachment: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, contentType: { type: [{ code: "code" }] }, language: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] }, url: { type: [{ code: "url" }] }, size: { type: [{ code: "unsignedInt" }] }, hash: { type: [{ code: "base64Binary" }] }, title: { type: [{ code: "string" }] }, creation: { type: [{ code: "dateTime" }] } } }, CodeableConcept: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, coding: { max: 9007199254740991, type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: 9007199254740991, type: [{ code: "ContactPoint" }] } } }, ContactPoint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] } } }, Count: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, "subject[x]": { type: [{ code: "CodeableConcept" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Group"] }] }, mustSupport: { max: 9007199254740991, type: [{ code: "string" }] }, codeFilter: { max: 9007199254740991, type: [{ code: "DataRequirementCodeFilter" }] }, dateFilter: { max: 9007199254740991, type: [{ code: "DataRequirementDateFilter" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: 9007199254740991, type: [{ code: "DataRequirementSort" }] } } }, Distance: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] }, patientInstruction: { type: [{ code: "string" }] }, timing: { type: [{ code: "Timing" }] }, "asNeeded[x]": { type: [{ code: "boolean" }, { code: "CodeableConcept" }] }, site: { type: [{ code: "CodeableConcept" }] }, route: { type: [{ code: "CodeableConcept" }] }, method: { type: [{ code: "CodeableConcept" }] }, doseAndRate: { max: 9007199254740991, type: [{ code: "DosageDoseAndRate" }] }, maxDosePerPeriod: { type: [{ code: "Ratio" }] }, maxDosePerAdministration: { type: [{ code: "Quantity" }] }, maxDosePerLifetime: { type: [{ code: "Quantity" }] } } }, Duration: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: 9007199254740991, type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] }, slicing: { type: [{ code: "ElementDefinitionSlicing" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: 9007199254740991, type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "ElementDefinitionBase" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: 9007199254740991, type: [{ code: "ElementDefinitionType" }] }, "defaultValue[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, meaningWhenMissing: { type: [{ code: "markdown" }] }, orderMeaning: { type: [{ code: "string" }] }, "fixed[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, "pattern[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, example: { max: 9007199254740991, type: [{ code: "ElementDefinitionExample" }] }, "minValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, "maxValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, maxLength: { type: [{ code: "integer" }] }, condition: { max: 9007199254740991, type: [{ code: "id" }] }, constraint: { max: 9007199254740991, type: [{ code: "ElementDefinitionConstraint" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "ElementDefinitionBinding" }] }, mapping: { max: 9007199254740991, type: [{ code: "ElementDefinitionMapping" }] } } }, Expression: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, description: { type: [{ code: "string" }] }, name: { type: [{ code: "id" }] }, language: { min: 1, type: [{ code: "code" }] }, expression: { type: [{ code: "string" }] }, reference: { type: [{ code: "uri" }] } } }, Extension: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "string" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: 9007199254740991, type: [{ code: "string" }] }, prefix: { max: 9007199254740991, type: [{ code: "string" }] }, suffix: { max: 9007199254740991, type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "CodeableConcept" }] }, system: { type: [{ code: "uri" }] }, value: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] }, assigner: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MarketingStatus: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, country: { min: 1, type: [{ code: "CodeableConcept" }] }, jurisdiction: { type: [{ code: "CodeableConcept" }] }, status: { min: 1, type: [{ code: "CodeableConcept" }] }, dateRange: { min: 1, type: [{ code: "Period" }] }, restoreDate: { type: [{ code: "dateTime" }] } } }, Meta: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: 9007199254740991, type: [{ code: "Coding" }] }, tag: { max: 9007199254740991, type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, compartment: { max: 9007199254740991, type: [{ code: "Reference" }] } } }, Money: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "code" }] }, use: { min: 1, type: [{ code: "code" }] }, min: { type: [{ code: "integer" }] }, max: { type: [{ code: "string" }] }, documentation: { type: [{ code: "string" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, Period: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, height: { type: [{ code: "Quantity" }] }, width: { type: [{ code: "Quantity" }] }, depth: { type: [{ code: "Quantity" }] }, weight: { type: [{ code: "Quantity" }] }, nominalVolume: { type: [{ code: "Quantity" }] }, externalDiameter: { type: [{ code: "Quantity" }] }, shape: { type: [{ code: "string" }] }, color: { max: 9007199254740991, type: [{ code: "string" }] }, imprint: { max: 9007199254740991, type: [{ code: "string" }] }, image: { max: 9007199254740991, type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, Quantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Range: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, low: { type: [{ code: "Quantity" }] }, high: { type: [{ code: "Quantity" }] } } }, Ratio: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, label: { type: [{ code: "string" }] }, display: { type: [{ code: "string" }] }, citation: { type: [{ code: "markdown" }] }, url: { type: [{ code: "url" }] }, document: { type: [{ code: "Attachment" }] }, resource: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Resource"] }] } } }, SampledData: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, origin: { min: 1, type: [{ code: "Quantity" }] }, period: { min: 1, type: [{ code: "decimal" }] }, factor: { type: [{ code: "decimal" }] }, lowerLimit: { type: [{ code: "decimal" }] }, upperLimit: { type: [{ code: "decimal" }] }, dimensions: { min: 1, type: [{ code: "positiveInt" }] }, data: { type: [{ code: "string" }] } } }, Signature: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, max: 9007199254740991, type: [{ code: "Coding" }] }, when: { min: 1, type: [{ code: "instant" }] }, who: { min: 1, type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, onBehalfOf: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, targetFormat: { type: [{ code: "code" }] }, sigFormat: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] } } }, SubstanceAmount: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "SubstanceAmountReferenceRange" }] } } }, Timing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, event: { max: 9007199254740991, type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "TimingRepeat" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TriggerDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { type: [{ code: "string" }] }, "timing[x]": { type: [{ code: "Timing" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Schedule"] }, { code: "date" }, { code: "dateTime" }] }, data: { max: 9007199254740991, type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "Coding" }] }, "value[x]": { min: 1, type: [{ code: "CodeableConcept" }, { code: "Quantity" }, { code: "Range" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/PlanDefinition", "http://hl7.org/fhir/StructureDefinition/ResearchStudy", "http://hl7.org/fhir/StructureDefinition/InsurancePlan", "http://hl7.org/fhir/StructureDefinition/HealthcareService", "http://hl7.org/fhir/StructureDefinition/Group", "http://hl7.org/fhir/StructureDefinition/Location", "http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MoneyQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, SimpleQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { max: 0, type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, MetadataResource: { elements: { id: { type: [{ code: "string" }] }, meta: { type: [{ code: "Meta" }] }, implicitRules: { type: [{ code: "uri" }] }, language: { type: [{ code: "code" }] }, text: { type: [{ code: "Narrative" }] }, contained: { max: 9007199254740991, type: [{ code: "Resource" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, name: { type: [{ code: "string" }] }, title: { type: [{ code: "string" }] }, status: { min: 1, type: [{ code: "code" }] }, experimental: { type: [{ code: "boolean" }] }, date: { type: [{ code: "dateTime" }] }, publisher: { type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] }, description: { type: [{ code: "markdown" }] }, useContext: { max: 9007199254740991, type: [{ code: "UsageContext" }] }, jurisdiction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, IdentityProvider: { elements: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, useSubject: { type: [{ code: "boolean" }] } } } };
@@ -3752,9 +3752,9 @@ function l(r4) {
3752
3752
  return [{ type: u.boolean, value: r4 }];
3753
3753
  }
3754
3754
  function T(r4) {
3755
- return r4 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r4) ? { type: u.integer, value: r4 } : typeof r4 == "number" ? { type: u.decimal, value: r4 } : typeof r4 == "boolean" ? { type: u.boolean, value: r4 } : typeof r4 == "string" ? { type: u.string, value: r4 } : b(r4) ? { type: u.Quantity, value: r4 } : _(r4) ? { type: r4.resourceType, value: r4 } : { type: u.BackboneElement, value: r4 };
3755
+ return r4 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r4) ? { type: u.integer, value: r4 } : typeof r4 == "number" ? { type: u.decimal, value: r4 } : typeof r4 == "boolean" ? { type: u.boolean, value: r4 } : typeof r4 == "string" ? { type: u.string, value: r4 } : R(r4) ? { type: u.Quantity, value: r4 } : _(r4) ? { type: r4.resourceType, value: r4 } : { type: u.BackboneElement, value: r4 };
3756
3756
  }
3757
- function N(r4) {
3757
+ function F(r4) {
3758
3758
  return r4.length === 0 ? false : !!r4[0].value;
3759
3759
  }
3760
3760
  function V(r4, e) {
@@ -3768,9 +3768,9 @@ function w(r4, e) {
3768
3768
  if (!r4.value)
3769
3769
  return;
3770
3770
  let t = Ce(r4.type, e);
3771
- return t ? Nn(r4, e, t) : Mn(r4, e);
3771
+ return t ? Fn(r4, e, t) : Mn(r4, e);
3772
3772
  }
3773
- function Nn(r4, e, t) {
3773
+ function Fn(r4, e, t) {
3774
3774
  let n = t.type;
3775
3775
  if (!n || n.length === 0)
3776
3776
  return;
@@ -3786,7 +3786,7 @@ function Nn(r4, e, t) {
3786
3786
  }
3787
3787
  }
3788
3788
  let s = r4.value["_" + e];
3789
- if (s && (Array.isArray(i2) ? i2 = i2.map((a, c2) => s[c2] ? sr(a ?? {}, s[c2]) : a) : i2 = sr(i2 ?? {}, s)), !R(i2))
3789
+ if (s && (Array.isArray(i2) ? i2 = i2.map((a, c2) => s[c2] ? sr(a ?? {}, s[c2]) : a) : i2 = sr(i2 ?? {}, s)), !b(i2))
3790
3790
  return (o === "Element" || o === "BackboneElement") && (o = t.type[0].code), Array.isArray(i2) ? i2.map((a) => nr(a, o)) : nr(i2, o);
3791
3791
  }
3792
3792
  function nr(r4, e) {
@@ -3807,7 +3807,7 @@ function Mn(r4, e) {
3807
3807
  break;
3808
3808
  }
3809
3809
  }
3810
- if (!R(n))
3810
+ if (!b(n))
3811
3811
  return Array.isArray(n) ? n.map(T) : T(n);
3812
3812
  }
3813
3813
  function Ae(r4) {
@@ -3815,7 +3815,7 @@ function Ae(r4) {
3815
3815
  for (let t of r4) {
3816
3816
  let n = false;
3817
3817
  for (let i2 of e)
3818
- if (N(ar(t, i2))) {
3818
+ if (F(ar(t, i2))) {
3819
3819
  n = true;
3820
3820
  break;
3821
3821
  }
@@ -3823,22 +3823,22 @@ function Ae(r4) {
3823
3823
  }
3824
3824
  return e;
3825
3825
  }
3826
- function ct(r4) {
3827
- return l(!N(r4));
3826
+ function ut(r4) {
3827
+ return l(!F(r4));
3828
3828
  }
3829
- function ut(r4, e) {
3830
- return r4.length === 0 || e.length === 0 ? [] : r4.length !== e.length ? l(false) : l(r4.every((t, n) => N(ar(t, e[n]))));
3829
+ function lt(r4, e) {
3830
+ return r4.length === 0 || e.length === 0 ? [] : r4.length !== e.length ? l(false) : l(r4.every((t, n) => F(ar(t, e[n]))));
3831
3831
  }
3832
3832
  function ar(r4, e) {
3833
3833
  let t = r4.value?.valueOf(), n = e.value?.valueOf();
3834
- return typeof t == "number" && typeof n == "number" ? l(Math.abs(t - n) < 1e-8) : b(t) && b(n) ? l(cr(t, n)) : l(typeof t == "object" && typeof n == "object" ? dt(r4, e) : t === n);
3834
+ return typeof t == "number" && typeof n == "number" ? l(Math.abs(t - n) < 1e-8) : R(t) && R(n) ? l(cr(t, n)) : l(typeof t == "object" && typeof n == "object" ? pt(r4, e) : t === n);
3835
3835
  }
3836
- function lt(r4, e) {
3837
- return r4.length === 0 && e.length === 0 ? l(true) : r4.length !== e.length ? l(false) : (r4.sort(ir), e.sort(ir), l(r4.every((t, n) => N(Bn(t, e[n])))));
3836
+ function dt(r4, e) {
3837
+ return r4.length === 0 && e.length === 0 ? l(true) : r4.length !== e.length ? l(false) : (r4.sort(ir), e.sort(ir), l(r4.every((t, n) => F(Bn(t, e[n])))));
3838
3838
  }
3839
3839
  function Bn(r4, e) {
3840
3840
  let { type: t, value: n } = r4, { type: i2, value: o } = e, s = n?.valueOf(), a = o?.valueOf();
3841
- return typeof s == "number" && typeof a == "number" ? l(Math.abs(s - a) < 0.01) : b(s) && b(a) ? l(cr(s, a)) : l(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" ? dt({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
3841
+ return typeof s == "number" && typeof a == "number" ? l(Math.abs(s - a) < 0.01) : R(s) && R(a) ? l(cr(s, a)) : l(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" ? pt({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
3842
3842
  }
3843
3843
  function ir(r4, e) {
3844
3844
  let t = r4.value?.valueOf(), n = e.value?.valueOf();
@@ -3863,7 +3863,7 @@ function Pe(r4, e) {
3863
3863
  case "Period":
3864
3864
  return qn(t);
3865
3865
  case "Quantity":
3866
- return b(t);
3866
+ return R(t);
3867
3867
  default:
3868
3868
  return typeof t == "object" && t?.resourceType === e;
3869
3869
  }
@@ -3871,20 +3871,20 @@ function Pe(r4, e) {
3871
3871
  function qn(r4) {
3872
3872
  return !!(r4 && typeof r4 == "object" && "start" in r4);
3873
3873
  }
3874
- function b(r4) {
3874
+ function R(r4) {
3875
3875
  return !!(r4 && typeof r4 == "object" && "value" in r4 && typeof r4.value == "number");
3876
3876
  }
3877
3877
  function cr(r4, e) {
3878
3878
  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);
3879
3879
  }
3880
- function dt(r4, e) {
3880
+ function pt(r4, e) {
3881
3881
  let t = Object.keys(r4), n = Object.keys(e);
3882
3882
  if (t.length !== n.length)
3883
3883
  return false;
3884
3884
  for (let i2 of t) {
3885
3885
  let o = r4[i2], s = e[i2];
3886
3886
  if (or(o) && or(s)) {
3887
- if (!dt(o, s))
3887
+ if (!pt(o, s))
3888
3888
  return false;
3889
3889
  } else if (o !== s)
3890
3890
  return false;
@@ -3897,13 +3897,13 @@ function or(r4) {
3897
3897
  function sr(r4, e) {
3898
3898
  return delete e.__proto__, delete e.constructor, Object.assign(r4, e);
3899
3899
  }
3900
- var pt = "ok";
3900
+ var ft = "ok";
3901
3901
  var we = "created";
3902
- var mt = "not-modified";
3903
- var ht = "not-found";
3902
+ var ht = "not-modified";
3903
+ var yt = "not-found";
3904
3904
  var Ie = "accepted";
3905
- var pr = { resourceType: "OperationOutcome", id: ht, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
3906
- function U(r4, e) {
3905
+ var pr = { resourceType: "OperationOutcome", id: yt, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
3906
+ function L(r4, e) {
3907
3907
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r4 }, expression: e ? [e] : void 0 }] };
3908
3908
  }
3909
3909
  function h(r4) {
@@ -3912,8 +3912,8 @@ function h(r4) {
3912
3912
  function ke(r4) {
3913
3913
  return typeof r4 == "object" && r4 !== null && r4.resourceType === "OperationOutcome";
3914
3914
  }
3915
- function yt(r4) {
3916
- return r4.id === pt || r4.id === we || r4.id === mt || r4.id === Ie;
3915
+ function gt(r4) {
3916
+ return r4.id === ft || r4.id === we || r4.id === ht || r4.id === Ie;
3917
3917
  }
3918
3918
  var d = class extends Error {
3919
3919
  constructor(t, n) {
@@ -3921,8 +3921,8 @@ var d = class extends Error {
3921
3921
  this.outcome = t, this.cause = n;
3922
3922
  }
3923
3923
  };
3924
- function gt(r4) {
3925
- return r4 instanceof d ? r4.outcome : ke(r4) ? r4 : U($n(r4));
3924
+ function Oe(r4) {
3925
+ return r4 instanceof d ? r4.outcome : ke(r4) ? r4 : L($n(r4));
3926
3926
  }
3927
3927
  function $n(r4) {
3928
3928
  return r4 ? typeof r4 == "string" ? r4 : r4 instanceof Error ? r4.message : ke(r4) ? mr(r4) : typeof r4 == "object" && "code" in r4 && typeof r4.code == "string" ? r4.code : JSON.stringify(r4) : "Unknown error";
@@ -3935,7 +3935,7 @@ function jn(r4) {
3935
3935
  let e;
3936
3936
  return r4.details?.text ? r4.diagnostics ? e = `${r4.details.text} (${r4.diagnostics})` : e = r4.details.text : r4.diagnostics ? e = r4.diagnostics : e = "Unknown error", r4.expression?.length && (e += ` (${r4.expression.join(", ")})`), e;
3937
3937
  }
3938
- function Rt(r4) {
3938
+ function bt(r4) {
3939
3939
  return new vt(r4).parse();
3940
3940
  }
3941
3941
  var H = tr(rr);
@@ -3949,15 +3949,15 @@ function Hn(r4) {
3949
3949
  throw new Error("Failed loading StructureDefinition from bundle");
3950
3950
  if (r4.resourceType !== "StructureDefinition")
3951
3951
  return;
3952
- let e = Rt(r4);
3952
+ let e = bt(r4);
3953
3953
  H[r4.name] = e;
3954
3954
  for (let t of e.innerTypes)
3955
3955
  t.parentType = e, H[t.name] = t;
3956
3956
  }
3957
- function Rr(r4) {
3957
+ function br(r4) {
3958
3958
  return !!H[r4];
3959
3959
  }
3960
- function br(r4) {
3960
+ function Rr(r4) {
3961
3961
  return H[r4];
3962
3962
  }
3963
3963
  var vt = class {
@@ -4064,7 +4064,7 @@ function ee(r4, e) {
4064
4064
  return !r4 || !e ? false : e.startsWith(r4 + ".") || e === r4;
4065
4065
  }
4066
4066
  function Tr(r4) {
4067
- return Array.isArray(r4) && r4.length > 0 ? r4[0] : R(r4) ? void 0 : r4;
4067
+ return Array.isArray(r4) && r4.length > 0 ? r4[0] : b(r4) ? void 0 : r4;
4068
4068
  }
4069
4069
  function Gn(r4) {
4070
4070
  let e = r4.slicing?.discriminator;
@@ -4085,7 +4085,7 @@ function Kn(r4) {
4085
4085
  return r4.length === 1 ? r4[0] : r4.map(A).join("");
4086
4086
  }
4087
4087
  function Ce(r4, e) {
4088
- let t = br(r4);
4088
+ let t = Rr(r4);
4089
4089
  if (t)
4090
4090
  return t.elements[e] ?? t.elements[e + "[x]"];
4091
4091
  }
@@ -4108,7 +4108,7 @@ function re(r4) {
4108
4108
  }
4109
4109
  }
4110
4110
  var ce = () => [];
4111
- var S = { empty: (r4, e) => l(e.length === 0), exists: (r4, e, t) => t ? l(e.filter((n) => N(t.eval(r4, [n]))).length > 0) : l(e.length > 0), all: (r4, e, t) => l(e.every((n) => N(t.eval(r4, [n])))), allTrue: (r4, e) => {
4111
+ var S = { empty: (r4, e) => l(e.length === 0), exists: (r4, e, t) => t ? l(e.filter((n) => F(t.eval(r4, [n]))).length > 0) : l(e.length > 0), all: (r4, e, t) => l(e.every((n) => F(t.eval(r4, [n])))), allTrue: (r4, e) => {
4112
4112
  for (let t of e)
4113
4113
  if (!t.value)
4114
4114
  return l(false);
@@ -4133,7 +4133,7 @@ var S = { empty: (r4, e) => l(e.length === 0), exists: (r4, e, t) => t ? l(e.fil
4133
4133
  for (let n of e)
4134
4134
  t.some((i2) => i2.value === n.value) || t.push(n);
4135
4135
  return t;
4136
- }, isDistinct: (r4, e) => l(e.length === S.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: ce, ofType: (r4, e, t) => e.filter((n) => n.type === t.name), single: (r4, e) => {
4136
+ }, isDistinct: (r4, e) => l(e.length === S.distinct(r4, e).length), where: (r4, e, t) => e.filter((n) => F(t.eval(r4, [n]))), select: (r4, e, t) => e.map((n) => t.eval(r4, [n])).flat(), repeat: ce, ofType: (r4, e, t) => e.filter((n) => n.type === t.name), single: (r4, e) => {
4137
4137
  if (e.length > 1)
4138
4138
  throw new Error("Expected input length one for single()");
4139
4139
  return e.length === 0 ? [] : e.slice(0, 1);
@@ -4175,11 +4175,11 @@ var S = { empty: (r4, e) => l(e.length === 0), exists: (r4, e, t) => t ? l(e.fil
4175
4175
  let o = t.eval(r4, e);
4176
4176
  if (o.length > 1 || o.length === 1 && typeof o[0].value != "boolean")
4177
4177
  throw new Error("Expected criterion to evaluate to a Boolean");
4178
- return N(o) ? n.eval(r4, e) : i2 ? i2.eval(r4, e) : [];
4178
+ return F(o) ? n.eval(r4, e) : i2 ? i2.eval(r4, e) : [];
4179
4179
  }, toBoolean: (r4, e) => {
4180
4180
  if (e.length === 0)
4181
4181
  return [];
4182
- let [{ value: t }] = F(e, 1);
4182
+ let [{ value: t }] = N(e, 1);
4183
4183
  if (typeof t == "boolean")
4184
4184
  return [{ type: u.boolean, value: t }];
4185
4185
  if (typeof t == "number" && (t === 0 || t === 1))
@@ -4195,37 +4195,37 @@ var S = { empty: (r4, e) => l(e.length === 0), exists: (r4, e, t) => t ? l(e.fil
4195
4195
  }, convertsToBoolean: (r4, e) => e.length === 0 ? [] : l(S.toBoolean(r4, e).length === 1), toInteger: (r4, e) => {
4196
4196
  if (e.length === 0)
4197
4197
  return [];
4198
- let [{ value: t }] = F(e, 1);
4198
+ let [{ value: t }] = N(e, 1);
4199
4199
  return typeof t == "number" ? [{ type: u.integer, value: t }] : typeof t == "string" && /^[+-]?\d+$/.exec(t) ? [{ type: u.integer, value: parseInt(t, 10) }] : typeof t == "boolean" ? [{ type: u.integer, value: t ? 1 : 0 }] : [];
4200
4200
  }, convertsToInteger: (r4, e) => e.length === 0 ? [] : l(S.toInteger(r4, e).length === 1), toDate: (r4, e) => {
4201
4201
  if (e.length === 0)
4202
4202
  return [];
4203
- let [{ value: t }] = F(e, 1);
4203
+ let [{ value: t }] = N(e, 1);
4204
4204
  return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: u.date, value: re(t) }] : [];
4205
4205
  }, convertsToDate: (r4, e) => e.length === 0 ? [] : l(S.toDate(r4, e).length === 1), toDateTime: (r4, e) => {
4206
4206
  if (e.length === 0)
4207
4207
  return [];
4208
- let [{ value: t }] = F(e, 1);
4208
+ let [{ value: t }] = N(e, 1);
4209
4209
  return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: u.dateTime, value: re(t) }] : [];
4210
4210
  }, convertsToDateTime: (r4, e) => e.length === 0 ? [] : l(S.toDateTime(r4, e).length === 1), toDecimal: (r4, e) => {
4211
4211
  if (e.length === 0)
4212
4212
  return [];
4213
- let [{ value: t }] = F(e, 1);
4213
+ let [{ value: t }] = N(e, 1);
4214
4214
  return typeof t == "number" ? [{ type: u.decimal, value: t }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?$/.exec(t) ? [{ type: u.decimal, value: parseFloat(t) }] : typeof t == "boolean" ? [{ type: u.decimal, value: t ? 1 : 0 }] : [];
4215
4215
  }, convertsToDecimal: (r4, e) => e.length === 0 ? [] : l(S.toDecimal(r4, e).length === 1), toQuantity: (r4, e) => {
4216
4216
  if (e.length === 0)
4217
4217
  return [];
4218
- let [{ value: t }] = F(e, 1);
4219
- return b(t) ? [{ type: u.Quantity, value: t }] : typeof t == "number" ? [{ type: u.Quantity, value: { value: t, unit: "1" } }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?/.exec(t) ? [{ type: u.Quantity, value: { value: parseFloat(t), unit: "1" } }] : typeof t == "boolean" ? [{ type: u.Quantity, value: { value: t ? 1 : 0, unit: "1" } }] : [];
4218
+ let [{ value: t }] = N(e, 1);
4219
+ return R(t) ? [{ type: u.Quantity, value: t }] : typeof t == "number" ? [{ type: u.Quantity, value: { value: t, unit: "1" } }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?/.exec(t) ? [{ type: u.Quantity, value: { value: parseFloat(t), unit: "1" } }] : typeof t == "boolean" ? [{ type: u.Quantity, value: { value: t ? 1 : 0, unit: "1" } }] : [];
4220
4220
  }, convertsToQuantity: (r4, e) => e.length === 0 ? [] : l(S.toQuantity(r4, e).length === 1), toString: (r4, e) => {
4221
4221
  if (e.length === 0)
4222
4222
  return [];
4223
- let [{ value: t }] = F(e, 1);
4224
- return t == null ? [] : b(t) ? [{ type: u.string, value: `${t.value} '${t.unit}'` }] : [{ type: u.string, value: t.toString() }];
4223
+ let [{ value: t }] = N(e, 1);
4224
+ return t == null ? [] : R(t) ? [{ type: u.string, value: `${t.value} '${t.unit}'` }] : [{ type: u.string, value: t.toString() }];
4225
4225
  }, convertsToString: (r4, e) => e.length === 0 ? [] : l(S.toString(r4, e).length === 1), toTime: (r4, e) => {
4226
4226
  if (e.length === 0)
4227
4227
  return [];
4228
- let [{ value: t }] = F(e, 1);
4228
+ let [{ value: t }] = N(e, 1);
4229
4229
  if (typeof t == "string") {
4230
4230
  let n = /^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(t);
4231
4231
  if (n)
@@ -4235,7 +4235,7 @@ var S = { empty: (r4, e) => l(e.length === 0), exists: (r4, e, t) => t ? l(e.fil
4235
4235
  }, convertsToTime: (r4, e) => e.length === 0 ? [] : l(S.toTime(r4, e).length === 1), indexOf: (r4, e, t) => P((n, i2) => n.indexOf(i2), r4, e, t), substring: (r4, e, t, n) => P((i2, o, s) => {
4236
4236
  let a = o, c2 = s ? a + s : i2.length;
4237
4237
  return a < 0 || a >= i2.length ? void 0 : i2.substring(a, c2);
4238
- }, r4, e, t, n), startsWith: (r4, e, t) => P((n, i2) => n.startsWith(i2), r4, e, t), endsWith: (r4, e, t) => P((n, i2) => n.endsWith(i2), r4, e, t), contains: (r4, e, t) => P((n, i2) => n.includes(i2), r4, e, t), upper: (r4, e) => P((t) => t.toUpperCase(), r4, e), lower: (r4, e) => P((t) => t.toLowerCase(), r4, e), replace: (r4, e, t, n) => P((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), matches: (r4, e, t) => P((n, i2) => !!new RegExp(i2).exec(n), r4, e, t), replaceMatches: (r4, e, t, n) => P((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), length: (r4, e) => P((t) => t.length, r4, e), toChars: (r4, e) => P((t) => t ? t.split("") : void 0, r4, e), abs: (r4, e) => L(Math.abs, r4, e), ceiling: (r4, e) => L(Math.ceil, r4, e), exp: (r4, e) => L(Math.exp, r4, e), floor: (r4, e) => L(Math.floor, r4, e), ln: (r4, e) => L(Math.log, r4, e), log: (r4, e, t) => L((n, i2) => Math.log(n) / Math.log(i2), r4, e, t), power: (r4, e, t) => L(Math.pow, r4, e, t), round: (r4, e) => L(Math.round, r4, e), sqrt: (r4, e) => L(Math.sqrt, r4, e), truncate: (r4, e) => L((t) => t | 0, r4, e), children: ce, descendants: ce, trace: (r4, e, t) => (console.log("trace", e, t), e), now: () => [{ type: u.dateTime, value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: u.time, value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: u.date, value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r4, e, t, n, i2) => {
4238
+ }, r4, e, t, n), startsWith: (r4, e, t) => P((n, i2) => n.startsWith(i2), r4, e, t), endsWith: (r4, e, t) => P((n, i2) => n.endsWith(i2), r4, e, t), contains: (r4, e, t) => P((n, i2) => n.includes(i2), r4, e, t), upper: (r4, e) => P((t) => t.toUpperCase(), r4, e), lower: (r4, e) => P((t) => t.toLowerCase(), r4, e), replace: (r4, e, t, n) => P((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), matches: (r4, e, t) => P((n, i2) => !!new RegExp(i2).exec(n), r4, e, t), replaceMatches: (r4, e, t, n) => P((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), length: (r4, e) => P((t) => t.length, r4, e), toChars: (r4, e) => P((t) => t ? t.split("") : void 0, r4, e), abs: (r4, e) => U(Math.abs, r4, e), ceiling: (r4, e) => U(Math.ceil, r4, e), exp: (r4, e) => U(Math.exp, r4, e), floor: (r4, e) => U(Math.floor, r4, e), ln: (r4, e) => U(Math.log, r4, e), log: (r4, e, t) => U((n, i2) => Math.log(n) / Math.log(i2), r4, e, t), power: (r4, e, t) => U(Math.pow, r4, e, t), round: (r4, e) => U(Math.round, r4, e), sqrt: (r4, e) => U(Math.sqrt, r4, e), truncate: (r4, e) => U((t) => t | 0, r4, e), children: ce, descendants: ce, trace: (r4, e, t) => (console.log("trace", e, t), e), now: () => [{ type: u.dateTime, value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: u.time, value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: u.date, value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r4, e, t, n, i2) => {
4239
4239
  let o = S.toDateTime(r4, t.eval(r4, e));
4240
4240
  if (o.length === 0)
4241
4241
  throw new Error("Invalid start date");
@@ -4279,22 +4279,22 @@ var S = { empty: (r4, e) => l(e.length === 0), exists: (r4, e, t) => t ? l(e.fil
4279
4279
  function P(r4, e, t, ...n) {
4280
4280
  if (t.length === 0)
4281
4281
  return [];
4282
- let [{ value: i2 }] = F(t, 1);
4282
+ let [{ value: i2 }] = N(t, 1);
4283
4283
  if (typeof i2 != "string")
4284
4284
  throw new Error("String function cannot be called with non-string");
4285
4285
  let o = r4(i2, ...n.map((s) => s?.eval(e, t)[0]?.value));
4286
4286
  return o === void 0 ? [] : Array.isArray(o) ? o.map(T) : [T(o)];
4287
4287
  }
4288
- function L(r4, e, t, ...n) {
4288
+ function U(r4, e, t, ...n) {
4289
4289
  if (t.length === 0)
4290
4290
  return [];
4291
- let [{ value: i2 }] = F(t, 1), o = b(i2), s = o ? i2.value : i2;
4291
+ let [{ value: i2 }] = N(t, 1), o = R(i2), s = o ? i2.value : i2;
4292
4292
  if (typeof s != "number")
4293
4293
  throw new Error("Math function cannot be called with non-number");
4294
4294
  let a = r4(s, ...n.map((p2) => p2.eval(e, t)[0]?.value)), c2 = o ? u.Quantity : t[0].type, m2 = o ? { ...i2, value: a } : a;
4295
4295
  return [{ type: c2, value: m2 }];
4296
4296
  }
4297
- function F(r4, e) {
4297
+ function N(r4, e) {
4298
4298
  if (r4.length !== e)
4299
4299
  throw new Error(`Expected ${e} arguments`);
4300
4300
  for (let t of r4)
@@ -4338,7 +4338,7 @@ var M = class {
4338
4338
  return this.name;
4339
4339
  }
4340
4340
  };
4341
- var De = class {
4341
+ var Ve = class {
4342
4342
  eval() {
4343
4343
  return [];
4344
4344
  }
@@ -4346,7 +4346,7 @@ var De = class {
4346
4346
  return "{}";
4347
4347
  }
4348
4348
  };
4349
- var Ve = class extends ge {
4349
+ var _e = class extends ge {
4350
4350
  constructor(t, n, i2) {
4351
4351
  super(t, n);
4352
4352
  this.impl = i2;
@@ -4380,11 +4380,11 @@ var E = class extends v {
4380
4380
  let o = this.right.eval(t, n);
4381
4381
  if (o.length !== 1)
4382
4382
  return [];
4383
- let s = i2[0].value, a = o[0].value, c2 = b(s) ? s.value : s, m2 = b(a) ? a.value : a, p2 = this.impl(c2, m2);
4384
- return typeof p2 == "boolean" ? l(p2) : b(s) ? [{ type: u.Quantity, value: { ...s, value: p2 } }] : [T(p2)];
4383
+ let s = i2[0].value, a = o[0].value, c2 = R(s) ? s.value : s, m2 = R(a) ? a.value : a, p2 = this.impl(c2, m2);
4384
+ return typeof p2 == "boolean" ? l(p2) : R(s) ? [{ type: u.Quantity, value: { ...s, value: p2 } }] : [T(p2)];
4385
4385
  }
4386
4386
  };
4387
- var _e = class extends $ {
4387
+ var Le = class extends $ {
4388
4388
  constructor(e, t) {
4389
4389
  super("&", e, t);
4390
4390
  }
@@ -4402,7 +4402,7 @@ var Ue = class extends v {
4402
4402
  return l(n.some((o) => o.value === i2[0].value));
4403
4403
  }
4404
4404
  };
4405
- var Le = class extends v {
4405
+ var Ne = class extends v {
4406
4406
  constructor(e, t) {
4407
4407
  super("in", e, t);
4408
4408
  }
@@ -4437,34 +4437,34 @@ var Fe = class extends v {
4437
4437
  }
4438
4438
  eval(e, t) {
4439
4439
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
4440
- return ut(n, i2);
4440
+ return lt(n, i2);
4441
4441
  }
4442
4442
  };
4443
- var Ne = class extends v {
4443
+ var Me = class extends v {
4444
4444
  constructor(e, t) {
4445
4445
  super("!=", e, t);
4446
4446
  }
4447
4447
  eval(e, t) {
4448
4448
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
4449
- return ct(ut(n, i2));
4449
+ return ut(lt(n, i2));
4450
4450
  }
4451
4451
  };
4452
- var Me = class extends v {
4452
+ var Be = class extends v {
4453
4453
  constructor(e, t) {
4454
4454
  super("~", e, t);
4455
4455
  }
4456
4456
  eval(e, t) {
4457
4457
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
4458
- return lt(n, i2);
4458
+ return dt(n, i2);
4459
4459
  }
4460
4460
  };
4461
- var Be = class extends v {
4461
+ var qe = class extends v {
4462
4462
  constructor(e, t) {
4463
4463
  super("!~", e, t);
4464
4464
  }
4465
4465
  eval(e, t) {
4466
4466
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
4467
- return ct(lt(n, i2));
4467
+ return ut(dt(n, i2));
4468
4468
  }
4469
4469
  };
4470
4470
  var Y = class extends v {
@@ -4479,7 +4479,7 @@ var Y = class extends v {
4479
4479
  return l(Pe(n[0], i2));
4480
4480
  }
4481
4481
  };
4482
- var qe = class extends v {
4482
+ var $e = class extends v {
4483
4483
  constructor(e, t) {
4484
4484
  super("and", e, t);
4485
4485
  }
@@ -4488,7 +4488,7 @@ var qe = class extends v {
4488
4488
  return n?.value === true && i2?.value === true ? l(true) : n?.value === false || i2?.value === false ? l(false) : [];
4489
4489
  }
4490
4490
  };
4491
- var $e = class extends v {
4491
+ var je = class extends v {
4492
4492
  constructor(e, t) {
4493
4493
  super("or", e, t);
4494
4494
  }
@@ -4497,7 +4497,7 @@ var $e = class extends v {
4497
4497
  return n?.value === false && i2?.value === false ? l(false) : n?.value || i2?.value ? l(true) : [];
4498
4498
  }
4499
4499
  };
4500
- var je = class extends v {
4500
+ var He = class extends v {
4501
4501
  constructor(e, t) {
4502
4502
  super("xor", e, t);
4503
4503
  }
@@ -4506,7 +4506,7 @@ var je = class extends v {
4506
4506
  return !n || !i2 ? [] : l(n.value !== i2.value);
4507
4507
  }
4508
4508
  };
4509
- var He = class extends v {
4509
+ var Qe = class extends v {
4510
4510
  constructor(e, t) {
4511
4511
  super("implies", e, t);
4512
4512
  }
@@ -4576,7 +4576,7 @@ function ri(r4) {
4576
4576
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
4577
4577
  }
4578
4578
  function de() {
4579
- return new xe().registerPrefix("String", { parse: (r4, e) => new k({ type: u.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r4, e) => new k({ type: u.dateTime, value: re(e.value) }) }).registerPrefix("Quantity", { parse: (r4, e) => new k({ type: u.Quantity, value: ri(e.value) }) }).registerPrefix("Number", { parse: (r4, e) => new k({ type: u.decimal, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new k({ type: u.boolean, value: true }) }).registerPrefix("false", { parse: () => new k({ type: u.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r4, e) => new M(e.value) }).registerPrefix("{}", { parse: () => new De() }).registerPrefix("(", Zn).registerInfix("[", ei).registerInfix("(", ti).prefix("+", f.UnaryAdd, (r4, e) => new Ve("+", e, (t) => t)).prefix("-", f.UnarySubtract, (r4, e) => new E("-", e, e, (t, n) => -n)).infixLeft(".", f.Dot, (r4, e, t) => new Q(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 ne(r4, t)).infixLeft("=", f.Equals, (r4, e, t) => new Fe(r4, t)).infixLeft("!=", f.NotEquals, (r4, e, t) => new Ne(r4, t)).infixLeft("~", f.Equivalent, (r4, e, t) => new Me(r4, t)).infixLeft("!~", f.NotEquivalent, (r4, e, t) => new Be(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 _e(r4, t)).infixLeft("and", f.And, (r4, e, t) => new qe(r4, t)).infixLeft("as", f.As, (r4, e, t) => new J(r4, t)).infixLeft("contains", f.Contains, (r4, e, t) => new Ue(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 Le(r4, t)).infixLeft("is", f.Is, (r4, e, t) => new Y(r4, t)).infixLeft("mod", f.Modulo, (r4, e, t) => new E("mod", r4, t, (n, i2) => n % i2)).infixLeft("or", f.Or, (r4, e, t) => new $e(r4, t)).infixLeft("xor", f.Xor, (r4, e, t) => new je(r4, t)).infixLeft("implies", f.Implies, (r4, e, t) => new He(r4, t));
4579
+ return new xe().registerPrefix("String", { parse: (r4, e) => new k({ type: u.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r4, e) => new k({ type: u.dateTime, value: re(e.value) }) }).registerPrefix("Quantity", { parse: (r4, e) => new k({ type: u.Quantity, value: ri(e.value) }) }).registerPrefix("Number", { parse: (r4, e) => new k({ type: u.decimal, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new k({ type: u.boolean, value: true }) }).registerPrefix("false", { parse: () => new k({ type: u.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r4, e) => new M(e.value) }).registerPrefix("{}", { parse: () => new Ve() }).registerPrefix("(", Zn).registerInfix("[", ei).registerInfix("(", ti).prefix("+", f.UnaryAdd, (r4, e) => new _e("+", e, (t) => t)).prefix("-", f.UnarySubtract, (r4, e) => new E("-", e, e, (t, n) => -n)).infixLeft(".", f.Dot, (r4, e, t) => new Q(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 ne(r4, t)).infixLeft("=", f.Equals, (r4, e, t) => new Fe(r4, t)).infixLeft("!=", f.NotEquals, (r4, e, t) => new Me(r4, t)).infixLeft("~", f.Equivalent, (r4, e, t) => new Be(r4, t)).infixLeft("!~", f.NotEquivalent, (r4, e, t) => new qe(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 Le(r4, t)).infixLeft("and", f.And, (r4, e, t) => new $e(r4, t)).infixLeft("as", f.As, (r4, e, t) => new J(r4, t)).infixLeft("contains", f.Contains, (r4, e, t) => new Ue(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 Ne(r4, t)).infixLeft("is", f.Is, (r4, e, t) => new Y(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 je(r4, t)).infixLeft("xor", f.Xor, (r4, e, t) => new He(r4, t)).infixLeft("implies", f.Implies, (r4, e, t) => new Qe(r4, t));
4580
4580
  }
4581
4581
  var ni = de();
4582
4582
  var wr = ((p2) => (p2.BOOLEAN = "BOOLEAN", p2.NUMBER = "NUMBER", p2.QUANTITY = "QUANTITY", p2.TEXT = "TEXT", p2.REFERENCE = "REFERENCE", p2.CANONICAL = "CANONICAL", p2.DATE = "DATE", p2.DATETIME = "DATETIME", p2.PERIOD = "PERIOD", p2.UUID = "UUID", p2))(wr || {});
@@ -4609,7 +4609,7 @@ function me() {
4609
4609
  return (r4 === "x" ? e : e & 3 | 8).toString(16);
4610
4610
  });
4611
4611
  }
4612
- var Ge = class {
4612
+ var Ke = class {
4613
4613
  constructor(e = 10) {
4614
4614
  this.max = e, this.cache = /* @__PURE__ */ new Map();
4615
4615
  }
@@ -4659,7 +4659,7 @@ var he = class {
4659
4659
  return !e.defaultPrevented;
4660
4660
  }
4661
4661
  };
4662
- var Ke = class {
4662
+ var ze = class {
4663
4663
  constructor() {
4664
4664
  this.emitter = new he();
4665
4665
  }
@@ -4685,12 +4685,12 @@ function Hr(r4) {
4685
4685
  return !!r4.endpoint;
4686
4686
  }
4687
4687
  function Vt(r4) {
4688
- if (!Je(r4))
4688
+ if (!Ye(r4))
4689
4689
  throw new d(h("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
4690
4690
  let { channelType: e, mode: t, topic: n, events: i2 } = r4, o = { "hub.channel.type": e, "hub.mode": t, "hub.topic": n, "hub.events": i2.join(",") };
4691
4691
  return Hr(r4) && (o.endpoint = r4.endpoint), new URLSearchParams(o).toString();
4692
4692
  }
4693
- function Je(r4) {
4693
+ function Ye(r4) {
4694
4694
  if (typeof r4 != "object")
4695
4695
  return false;
4696
4696
  let { channelType: e, mode: t, topic: n, events: i2 } = r4;
@@ -4737,12 +4737,12 @@ function Qr(r4, e, t) {
4737
4737
  let n = Array.isArray(t) ? t : [t];
4738
4738
  return Wi(e, n), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: me(), event: { "hub.topic": r4, "hub.event": e, context: n } };
4739
4739
  }
4740
- var ze = class extends Ke {
4740
+ var Je = class extends ze {
4741
4741
  constructor(t) {
4742
4742
  super();
4743
4743
  if (this.subRequest = t, !t.endpoint)
4744
4744
  throw new d(h("Subscription request should contain an endpoint."));
4745
- if (!Je(t))
4745
+ if (!Ye(t))
4746
4746
  throw new d(h("Subscription request failed validation."));
4747
4747
  let n = new WebSocket(t.endpoint);
4748
4748
  n.addEventListener("open", () => {
@@ -4818,9 +4818,9 @@ var C = class {
4818
4818
  }
4819
4819
  };
4820
4820
  Ki = Symbol.toStringTag;
4821
- var Ye = class {
4821
+ var Xe = class {
4822
4822
  constructor() {
4823
- this.storage = typeof localStorage < "u" ? localStorage : new Ut();
4823
+ this.storage = typeof localStorage < "u" ? localStorage : new Lt();
4824
4824
  }
4825
4825
  clear() {
4826
4826
  this.storage.clear();
@@ -4839,7 +4839,7 @@ var Ye = class {
4839
4839
  this.setString(e, t ? Gt(t) : void 0);
4840
4840
  }
4841
4841
  };
4842
- var Ut = class {
4842
+ var Lt = class {
4843
4843
  constructor() {
4844
4844
  this.data = /* @__PURE__ */ new Map();
4845
4845
  }
@@ -4876,7 +4876,7 @@ var Jr = class extends he {
4876
4876
  super();
4877
4877
  if (t?.baseUrl && !t.baseUrl.startsWith("http"))
4878
4878
  throw new Error("Base URL must start with http or https");
4879
- if (this.options = t ?? {}, this.fetch = t?.fetch ?? ro(), this.storage = t?.storage ?? new Ye(), this.createPdfImpl = t?.createPdf, this.baseUrl = Xr(t?.baseUrl ?? Ji), this.fhirBaseUrl = Xr(Xe(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4/")), this.authorizeUrl = Xe(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = Xe(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = Xe(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.onUnauthenticated = t?.onUnauthenticated, this.cacheTime = t?.cacheTime ?? Xi, this.cacheTime > 0 ? this.requestCache = new Ge(t?.resourceCacheSize ?? Yi) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken)
4879
+ if (this.options = t ?? {}, this.fetch = t?.fetch ?? ro(), this.storage = t?.storage ?? new Xe(), this.createPdfImpl = t?.createPdf, this.baseUrl = Xr(t?.baseUrl ?? Ji), this.fhirBaseUrl = Xr(Ze(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4/")), this.authorizeUrl = Ze(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = Ze(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = Ze(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.onUnauthenticated = t?.onUnauthenticated, this.cacheTime = t?.cacheTime ?? Xi, this.cacheTime > 0 ? this.requestCache = new Ke(t?.resourceCacheSize ?? Yi) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken)
4880
4880
  this.setAccessToken(t.accessToken);
4881
4881
  else {
4882
4882
  let n = this.getActiveLogin();
@@ -5064,7 +5064,7 @@ var Jr = class extends he {
5064
5064
  return !o || !s ? new C(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
5065
5065
  }
5066
5066
  requestSchema(t) {
5067
- if (Rr(t))
5067
+ if (br(t))
5068
5068
  return Promise.resolve();
5069
5069
  let n = t + "-requestSchema", i2 = this.getCacheEntry(n, void 0);
5070
5070
  if (i2)
@@ -5143,7 +5143,7 @@ var Jr = class extends he {
5143
5143
  return new Promise((s, a) => {
5144
5144
  let c2 = new XMLHttpRequest();
5145
5145
  c2.responseType = "json", c2.onabort = () => a(new Error("Request aborted")), c2.onerror = () => a(new Error("Request error")), o && (c2.upload.onprogress = (m2) => o(m2), c2.upload.onload = (m2) => o(m2)), c2.onload = () => {
5146
- c2.status >= 200 && c2.status < 300 ? s(c2.response) : a(new Error(c2.statusText));
5146
+ c2.status >= 200 && c2.status < 300 ? s(c2.response) : a(new d(Oe(c2.response || c2.statusText)));
5147
5147
  }, 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);
5148
5148
  });
5149
5149
  }
@@ -5323,7 +5323,7 @@ var Jr = class extends he {
5323
5323
  else
5324
5324
  p2 = await t.text();
5325
5325
  if (t.status >= 400)
5326
- throw new d(gt(p2));
5326
+ throw new d(Oe(p2));
5327
5327
  return p2;
5328
5328
  }
5329
5329
  async fetchWithRetry(t, n) {
@@ -5336,7 +5336,7 @@ var Jr = class extends he {
5336
5336
  } catch (c2) {
5337
5337
  this.retryCatch(a, i2, c2);
5338
5338
  }
5339
- await ot(o);
5339
+ await st(o);
5340
5340
  }
5341
5341
  return s;
5342
5342
  }
@@ -5360,7 +5360,7 @@ var Jr = class extends he {
5360
5360
  let c2 = await Zr(a);
5361
5361
  c2 && (i2 = await this.fetchWithRetry(c2, s));
5362
5362
  }
5363
- await ot(o);
5363
+ await st(o);
5364
5364
  }
5365
5365
  return this.parseResponse(i2, "POST", t);
5366
5366
  }
@@ -5371,14 +5371,14 @@ var Jr = class extends he {
5371
5371
  try {
5372
5372
  o.resolve(await this.request(o.method, this.fhirBaseUrl + o.url, o.options));
5373
5373
  } catch (s) {
5374
- o.reject(new d(gt(s)));
5374
+ o.reject(new d(Oe(s)));
5375
5375
  }
5376
5376
  return;
5377
5377
  }
5378
5378
  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);
5379
5379
  for (let o = 0; o < t.length; o++) {
5380
5380
  let s = t[o], a = i2.entry?.[o];
5381
- a?.response?.outcome && !yt(a.response.outcome) ? s.reject(new d(a.response.outcome)) : s.resolve(a?.resource);
5381
+ a?.response?.outcome && !gt(a.response.outcome) ? s.reject(new d(a.response.outcome)) : s.resolve(a?.resource);
5382
5382
  }
5383
5383
  }
5384
5384
  addFetchOptionsDefaults(t) {
@@ -5454,14 +5454,14 @@ var Jr = class extends he {
5454
5454
  return i2.endpoint = s, i2;
5455
5455
  }
5456
5456
  async fhircastUnsubscribe(t) {
5457
- if (!Je(t))
5457
+ if (!Ye(t))
5458
5458
  throw new d(h("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
5459
5459
  if (!(t.endpoint && typeof t.endpoint == "string" && t.endpoint.startsWith("ws")))
5460
5460
  throw new d(h("Provided subscription request must have an endpoint in order to unsubscribe."));
5461
5461
  t.mode = "unsubscribe", await this.post("/fhircast/STU2", Vt(t), O.FORM_URL_ENCODED);
5462
5462
  }
5463
5463
  fhircastConnect(t) {
5464
- return new ze(t);
5464
+ return new Je(t);
5465
5465
  }
5466
5466
  async fhircastPublish(t, n, i2) {
5467
5467
  return this.post(`/fhircast/STU2/${t}`, Qr(t, n, i2), O.JSON);
@@ -5477,9 +5477,9 @@ var Jr = class extends he {
5477
5477
  this.clearActiveLogin();
5478
5478
  try {
5479
5479
  let a = await o.json();
5480
- throw new d(U(a.error_description));
5480
+ throw new d(L(a.error_description));
5481
5481
  } catch (a) {
5482
- throw new d(U("Failed to fetch tokens"), a);
5482
+ throw new d(L("Failed to fetch tokens"), a);
5483
5483
  }
5484
5484
  }
5485
5485
  let s = await o.json();
@@ -5523,7 +5523,7 @@ function Yr() {
5523
5523
  function Xr(r4) {
5524
5524
  return r4.endsWith("/") ? r4 : r4 + "/";
5525
5525
  }
5526
- function Xe(r4, e) {
5526
+ function Ze(r4, e) {
5527
5527
  return new URL(e, r4).toString();
5528
5528
  }
5529
5529
  async function Zr(r4) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medplum/agent",
3
- "version": "2.1.8",
3
+ "version": "2.1.9",
4
4
  "description": "Medplum Agent",
5
5
  "author": "Medplum <hello@medplum.com>",
6
6
  "license": "Apache-2.0",