@medplum/agent 3.2.23 → 3.2.24

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 +208 -205
  2. package/package.json +5 -5
@@ -12,13 +12,13 @@ var __export = (target, all) => {
12
12
  for (var name in all)
13
13
  __defProp(target, name, { get: all[name], enumerable: true });
14
14
  };
15
- var __copyProps = (to, from, except, desc) => {
15
+ var __copyProps = (to2, from, except, desc) => {
16
16
  if (from && typeof from === "object" || typeof from === "function") {
17
17
  for (let key of __getOwnPropNames(from))
18
- if (!__hasOwnProp.call(to, key) && key !== except)
19
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ if (!__hasOwnProp.call(to2, key) && key !== except)
19
+ __defProp(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
20
  }
21
- return to;
21
+ return to2;
22
22
  };
23
23
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
24
  // If the importer is in node compatibility mode or this is not an ESM
@@ -7767,10 +7767,10 @@ var require_dcmjs = __commonJS({
7767
7767
  var _arr = [];
7768
7768
  var _n = true;
7769
7769
  var _d = false;
7770
- var _s2, _e;
7770
+ var _s, _e;
7771
7771
  try {
7772
- for (_i = _i.call(arr); !(_n = (_s2 = _i.next()).done); _n = true) {
7773
- _arr.push(_s2.value);
7772
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
7773
+ _arr.push(_s.value);
7774
7774
  if (i && _arr.length === i) break;
7775
7775
  }
7776
7776
  } catch (err2) {
@@ -33550,10 +33550,10 @@ var require_stream_transform = __commonJS({
33550
33550
  if (data2 != null)
33551
33551
  this.push(data2);
33552
33552
  cb(er2);
33553
- var rs2 = this._readableState;
33554
- rs2.reading = false;
33555
- if (rs2.needReadable || rs2.length < rs2.highWaterMark) {
33556
- this._read(rs2.highWaterMark);
33553
+ var rs = this._readableState;
33554
+ rs.reading = false;
33555
+ if (rs.needReadable || rs.length < rs.highWaterMark) {
33556
+ this._read(rs.highWaterMark);
33557
33557
  }
33558
33558
  }
33559
33559
  function Transform(options) {
@@ -33598,8 +33598,8 @@ var require_stream_transform = __commonJS({
33598
33598
  ts.writechunk = chunk;
33599
33599
  ts.writeencoding = encoding;
33600
33600
  if (!ts.transforming) {
33601
- var rs2 = this._readableState;
33602
- if (ts.needTransform || rs2.needReadable || rs2.length < rs2.highWaterMark) this._read(rs2.highWaterMark);
33601
+ var rs = this._readableState;
33602
+ if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
33603
33603
  }
33604
33604
  };
33605
33605
  Transform.prototype._read = function(n) {
@@ -33694,8 +33694,8 @@ var require_pipeline = __commonJS({
33694
33694
  function call(fn2) {
33695
33695
  fn2();
33696
33696
  }
33697
- function pipe(from, to) {
33698
- return from.pipe(to);
33697
+ function pipe(from, to2) {
33698
+ return from.pipe(to2);
33699
33699
  }
33700
33700
  function popCallback(streams) {
33701
33701
  if (!streams.length) return noop;
@@ -35155,9 +35155,9 @@ var require_route = __commonJS({
35155
35155
  }
35156
35156
  return graph;
35157
35157
  }
35158
- function link(from, to) {
35158
+ function link(from, to2) {
35159
35159
  return function(args) {
35160
- return to(from(args));
35160
+ return to2(from(args));
35161
35161
  };
35162
35162
  }
35163
35163
  function wrapConversion(toModel, graph) {
@@ -40541,20 +40541,20 @@ function Ne(r7) {
40541
40541
  return r7 ? typeof r7 == "string" ? r7 : r7 instanceof Error ? r7.message : be(r7) ? cn(r7) : typeof r7 == "object" && "code" in r7 && typeof r7.code == "string" ? r7.code : JSON.stringify(r7) : "Unknown error";
40542
40542
  }
40543
40543
  function cn(r7) {
40544
- let e = r7.issue?.map(Ji) ?? [];
40544
+ let e = r7.issue?.map(Yi) ?? [];
40545
40545
  return e.length > 0 ? e.join("; ") : "Unknown error";
40546
40546
  }
40547
- function Ji(r7) {
40547
+ function Yi(r7) {
40548
40548
  let e;
40549
40549
  return r7.details?.text ? r7.diagnostics ? e = `${r7.details.text} (${r7.diagnostics})` : e = r7.details.text : r7.diagnostics ? e = r7.diagnostics : e = "Unknown error", r7.expression?.length && (e += ` (${r7.expression.join(", ")})`), e;
40550
40550
  }
40551
- function Zi(r7, e) {
40551
+ function Xi(r7, e) {
40552
40552
  let t = e.max && e.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : e.max;
40553
40553
  return { path: r7, description: "", type: e.type ?? [], min: e.min ?? 0, max: t ?? 1, isArray: !!t && t > 1, constraints: [] };
40554
40554
  }
40555
40555
  function pn(r7) {
40556
40556
  let e = /* @__PURE__ */ Object.create(null);
40557
- for (let [t, n] of Object.entries(r7)) e[t] = { name: t, type: t, path: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i, o]) => [i, Zi(i, o)])), constraints: [], innerTypes: [] };
40557
+ for (let [t, n] of Object.entries(r7)) e[t] = { name: t, type: t, path: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i, o]) => [i, Xi(i, o)])), constraints: [], innerTypes: [] };
40558
40558
  return e;
40559
40559
  }
40560
40560
  var dn = { 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", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, maxDosePerLifetime: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Duration: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: 9007199254740991, type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] }, slicing: { type: [{ code: "ElementDefinitionSlicing" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: 9007199254740991, type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "ElementDefinitionBase" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: 9007199254740991, type: [{ code: "ElementDefinitionType" }] }, "defaultValue[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, meaningWhenMissing: { type: [{ code: "markdown" }] }, orderMeaning: { type: [{ code: "string" }] }, "fixed[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, "pattern[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, example: { max: 9007199254740991, type: [{ code: "ElementDefinitionExample" }] }, "minValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, "maxValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, maxLength: { type: [{ code: "integer" }] }, condition: { max: 9007199254740991, type: [{ code: "id" }] }, constraint: { max: 9007199254740991, type: [{ code: "ElementDefinitionConstraint" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "ElementDefinitionBinding" }] }, mapping: { max: 9007199254740991, type: [{ code: "ElementDefinitionMapping" }] } } }, Expression: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, description: { type: [{ code: "string" }] }, name: { type: [{ code: "id" }] }, language: { min: 1, type: [{ code: "code" }] }, expression: { type: [{ code: "string" }] }, reference: { type: [{ code: "uri" }] } } }, Extension: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "uri" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: 9007199254740991, type: [{ code: "string" }] }, prefix: { max: 9007199254740991, type: [{ code: "string" }] }, suffix: { max: 9007199254740991, type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "CodeableConcept" }] }, system: { type: [{ code: "uri" }] }, value: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] }, assigner: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MarketingStatus: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, country: { min: 1, type: [{ code: "CodeableConcept" }] }, jurisdiction: { type: [{ code: "CodeableConcept" }] }, status: { min: 1, type: [{ code: "CodeableConcept" }] }, dateRange: { min: 1, type: [{ code: "Period" }] }, restoreDate: { type: [{ code: "dateTime" }] } } }, Meta: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: 9007199254740991, type: [{ code: "Coding" }] }, tag: { max: 9007199254740991, type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, onBehalfOf: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, accounts: { max: 9007199254740991, type: [{ code: "Reference" }] }, compartment: { max: 9007199254740991, type: [{ code: "Reference" }] } } }, Money: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "code" }] }, use: { min: 1, type: [{ code: "code" }] }, min: { type: [{ code: "integer" }] }, max: { type: [{ code: "string" }] }, documentation: { type: [{ code: "string" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, Period: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, height: { type: [{ code: "Quantity" }] }, width: { type: [{ code: "Quantity" }] }, depth: { type: [{ code: "Quantity" }] }, weight: { type: [{ code: "Quantity" }] }, nominalVolume: { type: [{ code: "Quantity" }] }, externalDiameter: { type: [{ code: "Quantity" }] }, shape: { type: [{ code: "string" }] }, color: { max: 9007199254740991, type: [{ code: "string" }] }, imprint: { max: 9007199254740991, type: [{ code: "string" }] }, image: { max: 9007199254740991, type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, Quantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Range: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, low: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, high: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Ratio: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, label: { type: [{ code: "string" }] }, display: { type: [{ code: "string" }] }, citation: { type: [{ code: "markdown" }] }, url: { type: [{ code: "url" }] }, document: { type: [{ code: "Attachment" }] }, resource: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Resource"] }] } } }, SampledData: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, origin: { min: 1, type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, period: { min: 1, type: [{ code: "decimal" }] }, factor: { type: [{ code: "decimal" }] }, lowerLimit: { type: [{ code: "decimal" }] }, upperLimit: { type: [{ code: "decimal" }] }, dimensions: { min: 1, type: [{ code: "positiveInt" }] }, data: { type: [{ code: "string" }] } } }, Signature: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, max: 9007199254740991, type: [{ code: "Coding" }] }, when: { min: 1, type: [{ code: "instant" }] }, who: { min: 1, type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, onBehalfOf: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, targetFormat: { type: [{ code: "code" }] }, sigFormat: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] } } }, SubstanceAmount: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "SubstanceAmountReferenceRange" }] } } }, 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" }] } } }, IdentityProvider: { elements: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, tokenAuthMethod: { type: [{ code: "code" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, usePkce: { type: [{ code: "boolean" }] }, useSubject: { type: [{ code: "boolean" }] } } } };
@@ -40564,7 +40564,7 @@ function sr(r7) {
40564
40564
  var ce = pn(dn);
40565
40565
  var ar = /* @__PURE__ */ Object.create(null);
40566
40566
  var fn = /* @__PURE__ */ Object.create(null);
40567
- var eo = { "http://hl7.org/fhir/StructureDefinition/MoneyQuantity": "MoneyQuantity", "http://hl7.org/fhir/StructureDefinition/SimpleQuantity": "SimpleQuantity", "http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ViewDefinition": "ViewDefinition" };
40567
+ var to = { "http://hl7.org/fhir/StructureDefinition/MoneyQuantity": "MoneyQuantity", "http://hl7.org/fhir/StructureDefinition/SimpleQuantity": "SimpleQuantity", "http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ViewDefinition": "ViewDefinition" };
40568
40568
  function gn(r7) {
40569
40569
  let e;
40570
40570
  return e = fn[r7], e || (e = fn[r7] = /* @__PURE__ */ Object.create(null)), e;
@@ -40576,7 +40576,7 @@ function cr(r7) {
40576
40576
  function ur(r7) {
40577
40577
  if (!r7?.name) throw new Error("Failed loading StructureDefinition from bundle");
40578
40578
  if (r7.resourceType !== "StructureDefinition") return;
40579
- let e = sr(r7), t = eo[r7.url], n, i;
40579
+ let e = sr(r7), t = to[r7.url], n, i;
40580
40580
  t ? (n = ce, i = t) : r7.url === `http://hl7.org/fhir/StructureDefinition/${r7.type}` || r7.url === `https://medplum.com/fhir/StructureDefinition/${r7.type}` || r7.type?.startsWith("http://") || r7.type?.startsWith("https://") ? (n = ce, i = r7.type) : (n = gn(r7.url), i = r7.type), n[i] = e;
40581
40581
  for (let o of e.innerTypes) o.parentType = e, n[o.name] = o;
40582
40582
  ar[r7.url] = e;
@@ -40597,7 +40597,7 @@ function Sn(r7) {
40597
40597
  var ir = class {
40598
40598
  constructor(e) {
40599
40599
  if (!e.snapshot?.element || e.snapshot.element.length === 0) throw new Error(`No snapshot defined for StructureDefinition '${e.name}'`);
40600
- this.root = e.snapshot.element[0], this.elements = e.snapshot.element.slice(1), this.elementIndex = /* @__PURE__ */ Object.create(null), this.index = 0, this.resourceSchema = { name: e.name, path: this.root.path, title: e.title, type: e.type, url: e.url, kind: e.kind, description: io(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
40600
+ this.root = e.snapshot.element[0], this.elements = e.snapshot.element.slice(1), this.elementIndex = /* @__PURE__ */ Object.create(null), this.index = 0, this.resourceSchema = { name: e.name, path: this.root.path, title: e.title, type: e.type, url: e.url, kind: e.kind, description: oo(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
40601
40601
  }
40602
40602
  parse() {
40603
40603
  let e = this.next();
@@ -40638,7 +40638,7 @@ var ir = class {
40638
40638
  this.backboneContext = { type: { name: t, type: t, path: e.path, title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path, parent: Re(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
40639
40639
  }
40640
40640
  enterSlice(e, t) {
40641
- no(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
40641
+ io(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
40642
40642
  if (n.type !== "value" && n.type !== "pattern" && n.type !== "type") throw new Error(`Unsupported slicing discriminator type: ${n.type}`);
40643
40643
  return { path: n.path, type: n.type };
40644
40644
  }), slices: [], ordered: e.slicing?.ordered ?? false, rule: e.slicing?.rules }, this.slicingContext = { field: t.slicing, path: e.path ?? "" });
@@ -40686,9 +40686,9 @@ function hn(r7) {
40686
40686
  return r7 === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(r7, 10);
40687
40687
  }
40688
40688
  function nr(r7, e = "") {
40689
- return ro(r7.path, e);
40689
+ return no(r7.path, e);
40690
40690
  }
40691
- function ro(r7, e) {
40691
+ function no(r7, e) {
40692
40692
  return r7 ? e && r7.startsWith(e) ? r7.substring(e.length + 1) : r7 : "";
40693
40693
  }
40694
40694
  function Re(r7, e) {
@@ -40697,11 +40697,11 @@ function Re(r7, e) {
40697
40697
  function yn(r7) {
40698
40698
  return Array.isArray(r7) && r7.length > 0 ? r7[0] : S(r7) ? void 0 : r7;
40699
40699
  }
40700
- function no(r7) {
40700
+ function io(r7) {
40701
40701
  let e = r7.slicing?.discriminator;
40702
40702
  return !!(r7.type?.some((t) => t.code === "Extension") && e?.length === 1 && e[0].type === "value" && e[0].path === "url");
40703
40703
  }
40704
- function io(r7) {
40704
+ function oo(r7) {
40705
40705
  let e = r7.description;
40706
40706
  return e?.startsWith(`Base StructureDefinition for ${r7.name} Type: `) && (e = e.substring(`Base StructureDefinition for ${r7.name} Type: `.length)), e;
40707
40707
  }
@@ -40724,9 +40724,9 @@ function j(r7, e) {
40724
40724
  function P(r7, e, t) {
40725
40725
  if (!r7.value) return;
40726
40726
  let n = st(r7.type, e, t?.profileUrl);
40727
- return n ? yo(r7, e, n) : go(r7, e);
40727
+ return n ? go(r7, e, n) : vo(r7, e);
40728
40728
  }
40729
- function yo(r7, e, t) {
40729
+ function go(r7, e, t) {
40730
40730
  let n = r7.value, i = t.type;
40731
40731
  if (!i || i.length === 0) return;
40732
40732
  let o, s = "undefined", a2, c = t.path.lastIndexOf("."), u2 = t.path.substring(c + 1);
@@ -40746,7 +40746,7 @@ function yo(r7, e, t) {
40746
40746
  function Rn(r7, e) {
40747
40747
  return e === "Resource" && I(r7) && (e = r7.resourceType), { type: e, value: r7 };
40748
40748
  }
40749
- function go(r7, e) {
40749
+ function vo(r7, e) {
40750
40750
  let t = r7.value;
40751
40751
  if (!t || typeof t != "object") return;
40752
40752
  let n;
@@ -40795,9 +40795,9 @@ function yr(r7, e) {
40795
40795
  return typeof t == "number" && typeof n == "number" ? f(Math.abs(t - n) < 1e-8) : k(t) && k(n) ? f(Mn(t, n)) : f(typeof t == "object" && typeof n == "object" ? vr(r7, e) : t === n);
40796
40796
  }
40797
40797
  function gr(r7, e) {
40798
- return r7.length === 0 && e.length === 0 ? f(true) : r7.length !== e.length ? f(false) : (r7.sort(Cn), e.sort(Cn), f(r7.every((t, n) => N(vo(t, e[n])))));
40798
+ return r7.length === 0 && e.length === 0 ? f(true) : r7.length !== e.length ? f(false) : (r7.sort(Cn), e.sort(Cn), f(r7.every((t, n) => N(xo(t, e[n])))));
40799
40799
  }
40800
- function vo(r7, e) {
40800
+ function xo(r7, e) {
40801
40801
  let { type: t, value: n } = r7, { type: i, value: o } = e, s = n?.valueOf(), a2 = o?.valueOf();
40802
40802
  return typeof s == "number" && typeof a2 == "number" ? f(Math.abs(s - a2) < 0.01) : k(s) && k(a2) ? f(Mn(s, a2)) : f(t === "Coding" && i === "Coding" ? typeof s != "object" || typeof a2 != "object" ? false : s.code === a2.code && s.system === a2.system : typeof s == "object" && typeof a2 == "object" ? vr({ ...s, id: void 0 }, { ...a2, id: void 0 }) : typeof s == "string" && typeof a2 == "string" ? s.toLowerCase() === a2.toLowerCase() : s === a2);
40803
40803
  }
@@ -40860,15 +40860,15 @@ function wn(r7) {
40860
40860
  function An(r7, e) {
40861
40861
  if (e) {
40862
40862
  if (typeof e != "object") throw new Error("Primitive extension must be an object");
40863
- return xo(r7 ?? {}, e);
40863
+ return To(r7 ?? {}, e);
40864
40864
  }
40865
40865
  return r7;
40866
40866
  }
40867
- function xo(r7, e) {
40867
+ function To(r7, e) {
40868
40868
  return delete e.__proto__, delete e.constructor, Object.assign(r7, e);
40869
40869
  }
40870
40870
  function te(r7) {
40871
- let e = le(r7), t = So(r7);
40871
+ let e = le(r7), t = Eo(r7);
40872
40872
  return t === e ? { reference: e } : { reference: e, display: t };
40873
40873
  }
40874
40874
  function le(r7) {
@@ -40877,16 +40877,16 @@ function le(r7) {
40877
40877
  function pe(r7) {
40878
40878
  if (r7) return ue(r7) ? r7.reference.split("/")[1] : r7.id;
40879
40879
  }
40880
- function To(r7) {
40880
+ function So(r7) {
40881
40881
  return r7.resourceType === "Patient" || r7.resourceType === "Practitioner" || r7.resourceType === "RelatedPerson";
40882
40882
  }
40883
- function So(r7) {
40884
- if (To(r7)) {
40885
- let e = Eo(r7);
40883
+ function Eo(r7) {
40884
+ if (So(r7)) {
40885
+ let e = bo(r7);
40886
40886
  if (e) return e;
40887
40887
  }
40888
40888
  if (r7.resourceType === "Device") {
40889
- let e = bo(r7);
40889
+ let e = Ro(r7);
40890
40890
  if (e) return e;
40891
40891
  }
40892
40892
  if (r7.resourceType === "MedicationRequest" && r7.medicationCodeableConcept) return at(r7.medicationCodeableConcept);
@@ -40896,15 +40896,15 @@ function So(r7) {
40896
40896
  if ("code" in r7 && r7.code) {
40897
40897
  let e = r7.code;
40898
40898
  if (Array.isArray(e) && (e = e[0]), Tr(e)) return at(e);
40899
- if (Vo(e)) return e.text;
40899
+ if (Do(e)) return e.text;
40900
40900
  }
40901
40901
  return le(r7);
40902
40902
  }
40903
- function Eo(r7) {
40903
+ function bo(r7) {
40904
40904
  let e = r7.name;
40905
40905
  if (e && e.length > 0) return lt(e[0]);
40906
40906
  }
40907
- function bo(r7) {
40907
+ function Ro(r7) {
40908
40908
  let e = r7.deviceName;
40909
40909
  if (e && e.length > 0) return e[0].name;
40910
40910
  }
@@ -40926,12 +40926,12 @@ function X(r7, ...e) {
40926
40926
  return t;
40927
40927
  }
40928
40928
  function Fn(r7, e) {
40929
- return JSON.stringify(r7, Co, e ? 2 : void 0);
40929
+ return JSON.stringify(r7, Po, e ? 2 : void 0);
40930
40930
  }
40931
- function Co(r7, e) {
40932
- return !Po(r7) && S(e) ? void 0 : e;
40931
+ function Po(r7, e) {
40932
+ return !wo(r7) && S(e) ? void 0 : e;
40933
40933
  }
40934
- function Po(r7) {
40934
+ function wo(r7) {
40935
40935
  return !!/\d+$/.exec(r7);
40936
40936
  }
40937
40937
  function S(r7) {
@@ -40945,14 +40945,14 @@ function K(r7) {
40945
40945
  return e === "string" && r7 !== "" || e === "object" && ("length" in r7 && r7.length > 0 || Object.keys(r7).length > 0);
40946
40946
  }
40947
40947
  function ee(r7, e, t) {
40948
- return r7 === e || S(r7) && S(e) ? true : S(r7) || S(e) ? false : Array.isArray(r7) && Array.isArray(e) ? wo(r7, e) : Array.isArray(r7) || Array.isArray(e) ? false : R(r7) && R(e) ? Ao(r7, e, t) : (R(r7) || R(e), false);
40948
+ return r7 === e || S(r7) && S(e) ? true : S(r7) || S(e) ? false : Array.isArray(r7) && Array.isArray(e) ? Ao(r7, e) : Array.isArray(r7) || Array.isArray(e) ? false : R(r7) && R(e) ? Oo(r7, e, t) : (R(r7) || R(e), false);
40949
40949
  }
40950
- function wo(r7, e) {
40950
+ function Ao(r7, e) {
40951
40951
  if (r7.length !== e.length) return false;
40952
40952
  for (let t = 0; t < r7.length; t++) if (!ee(r7[t], e[t])) return false;
40953
40953
  return true;
40954
40954
  }
40955
- function Ao(r7, e, t) {
40955
+ function Oo(r7, e, t) {
40956
40956
  let n = /* @__PURE__ */ new Set();
40957
40957
  Object.keys(r7).forEach((i) => n.add(i)), Object.keys(e).forEach((i) => n.add(i)), t === "meta" && (n.delete("versionId"), n.delete("lastUpdated"), n.delete("author"));
40958
40958
  for (let i of n) {
@@ -40965,9 +40965,9 @@ function R(r7) {
40965
40965
  return r7 !== null && typeof r7 == "object";
40966
40966
  }
40967
40967
  function Un(r7) {
40968
- return r7.every(ko);
40968
+ return r7.every(Vo);
40969
40969
  }
40970
- function ko(r7) {
40970
+ function Vo(r7) {
40971
40971
  return typeof r7 == "string";
40972
40972
  }
40973
40973
  function xr(r7) {
@@ -40976,20 +40976,23 @@ function xr(r7) {
40976
40976
  function Tr(r7) {
40977
40977
  return R(r7) && "coding" in r7 && Array.isArray(r7.coding) && r7.coding.every(xr);
40978
40978
  }
40979
- function Vo(r7) {
40979
+ function Do(r7) {
40980
40980
  return R(r7) && "text" in r7 && typeof r7.text == "string";
40981
40981
  }
40982
40982
  var Bn = [];
40983
40983
  for (let r7 = 0; r7 < 256; r7++) Bn.push(r7.toString(16).padStart(2, "0"));
40984
40984
  function qn(r7) {
40985
- let e = new Uint8Array(r7), t = new Array(e.length);
40986
- for (let n = 0; n < e.length; n++) t[n] = Bn[e[n]];
40987
- return t.join("");
40985
+ let e = $n(r7), t = new Uint8Array(e), n = new Array(t.length);
40986
+ for (let i = 0; i < t.length; i++) n[i] = Bn[t[i]];
40987
+ return n.join("");
40988
40988
  }
40989
40989
  function jn(r7) {
40990
- let e = new Uint8Array(r7), t = [];
40991
- for (let n = 0; n < e.length; n++) t[n] = String.fromCharCode(e[n]);
40992
- return window.btoa(t.join(""));
40990
+ let e = $n(r7), t = new Uint8Array(e), n = new Array(t.length);
40991
+ for (let i = 0; i < t.length; i++) n[i] = String.fromCharCode(t[i]);
40992
+ return window.btoa(n.join(""));
40993
+ }
40994
+ function $n(r7) {
40995
+ return ArrayBuffer.isView(r7) ? r7.buffer : r7;
40993
40996
  }
40994
40997
  function w(r7) {
40995
40998
  return r7 ? r7.charAt(0).toUpperCase() + r7.substring(1) : "";
@@ -41003,21 +41006,21 @@ function ut(r7) {
41003
41006
  function Cr(r7) {
41004
41007
  return r7.endsWith("/") ? r7 : r7 + "/";
41005
41008
  }
41006
- function Fo(r7) {
41009
+ function Uo(r7) {
41007
41010
  return r7.startsWith("/") ? r7.slice(1) : r7;
41008
41011
  }
41009
41012
  function B(r7, e) {
41010
- return new URL(Fo(e), Cr(r7.toString())).toString();
41013
+ return new URL(Uo(e), Cr(r7.toString())).toString();
41011
41014
  }
41012
- function Hn(r7, e) {
41015
+ function Qn(r7, e) {
41013
41016
  return B(r7, e).toString().replace("http://", "ws://").replace("https://", "wss://");
41014
41017
  }
41015
- function Qn(r7) {
41018
+ function Kn(r7) {
41016
41019
  return typeof r7 == "object" && !Array.isArray(r7) && !(r7 instanceof URLSearchParams) && (r7 = Object.fromEntries(Object.entries(r7).filter((e) => e[1] !== void 0))), new URLSearchParams(r7).toString();
41017
41020
  }
41018
- var Uo = /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-_]*[A-Za-z0-9])$/;
41019
- function rl(r7) {
41020
- return Uo.test(r7);
41021
+ var Bo = /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-_]*[A-Za-z0-9])$/;
41022
+ function nl(r7) {
41023
+ return Bo.test(r7);
41021
41024
  }
41022
41025
  function lt(r7, e) {
41023
41026
  let t = [];
@@ -41030,9 +41033,9 @@ function lt(r7, e) {
41030
41033
  function at(r7) {
41031
41034
  if (!r7) return "";
41032
41035
  let e = me(r7.text);
41033
- return e || (r7.coding ? r7.coding.map((t) => Go(t)).join(", ") : "");
41036
+ return e || (r7.coding ? r7.coding.map((t) => Ho(t)).join(", ") : "");
41034
41037
  }
41035
- function Go(r7, e) {
41038
+ function Ho(r7, e) {
41036
41039
  let t = me(r7?.display);
41037
41040
  if (t) {
41038
41041
  let n = e ? me(r7?.code) : void 0;
@@ -41044,28 +41047,28 @@ function me(r7) {
41044
41047
  return typeof r7 == "string" ? r7 : void 0;
41045
41048
  }
41046
41049
  var l = { Address: "Address", Age: "Age", Annotation: "Annotation", Attachment: "Attachment", BackboneElement: "BackboneElement", CodeableConcept: "CodeableConcept", Coding: "Coding", ContactDetail: "ContactDetail", ContactPoint: "ContactPoint", Contributor: "Contributor", Count: "Count", DataRequirement: "DataRequirement", Distance: "Distance", Dosage: "Dosage", Duration: "Duration", Expression: "Expression", Extension: "Extension", HumanName: "HumanName", Identifier: "Identifier", MarketingStatus: "MarketingStatus", Meta: "Meta", Money: "Money", Narrative: "Narrative", ParameterDefinition: "ParameterDefinition", Period: "Period", Population: "Population", ProdCharacteristic: "ProdCharacteristic", ProductShelfLife: "ProductShelfLife", Quantity: "Quantity", Range: "Range", Ratio: "Ratio", Reference: "Reference", RelatedArtifact: "RelatedArtifact", SampledData: "SampledData", Signature: "Signature", SubstanceAmount: "SubstanceAmount", SystemString: "http://hl7.org/fhirpath/System.String", Timing: "Timing", TriggerDefinition: "TriggerDefinition", UsageContext: "UsageContext", base64Binary: "base64Binary", boolean: "boolean", canonical: "canonical", code: "code", date: "date", dateTime: "dateTime", decimal: "decimal", id: "id", instant: "instant", integer: "integer", markdown: "markdown", oid: "oid", positiveInt: "positiveInt", string: "string", time: "time", unsignedInt: "unsignedInt", uri: "uri", url: "url", uuid: "uuid" };
41047
- function Yn(r7) {
41050
+ function Zn(r7) {
41048
41051
  let e = L.types[r7];
41049
41052
  return e || (e = { searchParamsDetails: {} }, L.types[r7] = e), e.searchParams || (e.searchParams = { _id: { base: [r7], code: "_id", type: "token", expression: r7 + ".id" }, _lastUpdated: { base: [r7], code: "_lastUpdated", type: "date", expression: r7 + ".meta.lastUpdated" }, _compartment: { base: [r7], code: "_compartment", type: "reference", expression: r7 + ".meta.compartment" }, _profile: { base: [r7], code: "_profile", type: "uri", expression: r7 + ".meta.profile" }, _security: { base: [r7], code: "_security", type: "token", expression: r7 + ".meta.security" }, _source: { base: [r7], code: "_source", type: "uri", expression: r7 + ".meta.source" }, _tag: { base: [r7], code: "_tag", type: "token", expression: r7 + ".meta.tag" } }), e;
41050
41053
  }
41051
41054
  function Ar(r7) {
41052
41055
  for (let e of r7.base ?? []) {
41053
- let t = Yn(e);
41056
+ let t = Zn(e);
41054
41057
  t.searchParams || (t.searchParams = {}), t.searchParams[r7.code] = r7;
41055
41058
  }
41056
41059
  }
41057
41060
  function or(r7) {
41058
41061
  let e = r7.type?.[0]?.code;
41059
- return e === "BackboneElement" || e === "Element" ? zo((r7.base?.path ?? r7.path)?.split(".")) : e;
41062
+ return e === "BackboneElement" || e === "Element" ? Jo((r7.base?.path ?? r7.path)?.split(".")) : e;
41060
41063
  }
41061
- function zo(r7) {
41064
+ function Jo(r7) {
41062
41065
  return r7.length === 1 ? r7[0] : r7.map(w).join("");
41063
41066
  }
41064
41067
  function st(r7, e, t) {
41065
41068
  let n = Le(r7, t);
41066
- if (n) return Xo(n.elements, e);
41069
+ if (n) return es(n.elements, e);
41067
41070
  }
41068
- function Xo(r7, e) {
41071
+ function es(r7, e) {
41069
41072
  let t = r7[e] ?? r7[e + "[x]"];
41070
41073
  if (t) return t;
41071
41074
  for (let n = 0; n < e.length; n++) {
@@ -41516,34 +41519,34 @@ var ve = class {
41516
41519
  };
41517
41520
  var qe = ["!=", "!~", "<=", ">=", "{}", "->"];
41518
41521
  var y = { FunctionCall: 0, Dot: 1, Indexer: 2, UnaryAdd: 3, UnarySubtract: 3, Multiply: 4, Divide: 4, IntegerDivide: 4, Modulo: 4, Add: 5, Subtract: 5, Ampersand: 5, Is: 6, As: 6, Union: 7, GreaterThan: 8, GreaterThanOrEquals: 8, LessThan: 8, LessThanOrEquals: 8, Equals: 9, Equivalent: 9, NotEquals: 9, NotEquivalent: 9, In: 10, Contains: 10, And: 11, Xor: 12, Or: 12, Implies: 13, Arrow: 100, Semicolon: 200 };
41519
- var rs = { parse(r7) {
41522
+ var ns = { parse(r7) {
41520
41523
  let e = r7.consumeAndParse();
41521
41524
  if (!r7.match(")")) throw new Error("Parse error: expected `)` got `" + r7.peek()?.value + "`");
41522
41525
  return e;
41523
41526
  } };
41524
- var ns = { parse(r7, e) {
41527
+ var is = { parse(r7, e) {
41525
41528
  let t = r7.consumeAndParse();
41526
41529
  if (!r7.match("]")) throw new Error("Parse error: expected `]`");
41527
41530
  return new ve(e, t);
41528
41531
  }, precedence: y.Indexer };
41529
- var is = { parse(r7, e) {
41532
+ var os = { parse(r7, e) {
41530
41533
  if (!(e instanceof q)) throw new Error("Unexpected parentheses");
41531
41534
  let t = [];
41532
41535
  for (; !r7.match(")"); ) t.push(r7.consumeAndParse()), r7.match(",");
41533
41536
  return new J(e.name, t);
41534
41537
  }, precedence: y.FunctionCall };
41535
- function os(r7) {
41538
+ function ss(r7) {
41536
41539
  let e = r7.split(" "), t = parseFloat(e[0]), n = e[1];
41537
41540
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
41538
41541
  }
41539
41542
  function je() {
41540
- return new Je().registerPrefix("String", { parse: (r7, e) => new U({ type: l.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r7, e) => new U({ type: l.dateTime, value: Oe(e.value) }) }).registerPrefix("Quantity", { parse: (r7, e) => new U({ type: l.Quantity, value: os(e.value) }) }).registerPrefix("Number", { parse: (r7, e) => new U({ type: e.value.includes(".") ? l.decimal : l.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new U({ type: l.boolean, value: true }) }).registerPrefix("false", { parse: () => new U({ type: l.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r7, e) => new q(e.value) }).registerPrefix("{}", { parse: () => new dt() }).registerPrefix("(", rs).registerInfix("[", ns).registerInfix("(", is).prefix("+", y.UnaryAdd, (r7, e) => new ft("+", e, (t) => t)).prefix("-", y.UnarySubtract, (r7, e) => new V("-", e, e, (t, n) => -n)).infixLeft(".", y.Dot, (r7, e, t) => new re(r7, t)).infixLeft("/", y.Divide, (r7, e, t) => new V("/", r7, t, (n, i) => n / i)).infixLeft("*", y.Multiply, (r7, e, t) => new V("*", r7, t, (n, i) => n * i)).infixLeft("+", y.Add, (r7, e, t) => new V("+", r7, t, (n, i) => n + i)).infixLeft("-", y.Subtract, (r7, e, t) => new V("-", r7, t, (n, i) => n - i)).infixLeft("|", y.Union, (r7, e, t) => new Ie(r7, t)).infixLeft("=", y.Equals, (r7, e, t) => new gt(r7, t)).infixLeft("!=", y.NotEquals, (r7, e, t) => new vt(r7, t)).infixLeft("~", y.Equivalent, (r7, e, t) => new xt(r7, t)).infixLeft("!~", y.NotEquivalent, (r7, e, t) => new Tt(r7, t)).infixLeft("<", y.LessThan, (r7, e, t) => new V("<", r7, t, (n, i) => n < i)).infixLeft("<=", y.LessThanOrEquals, (r7, e, t) => new V("<=", r7, t, (n, i) => n <= i)).infixLeft(">", y.GreaterThan, (r7, e, t) => new V(">", r7, t, (n, i) => n > i)).infixLeft(">=", y.GreaterThanOrEquals, (r7, e, t) => new V(">=", r7, t, (n, i) => n >= i)).infixLeft("&", y.Ampersand, (r7, e, t) => new mt(r7, t)).infixLeft("and", y.And, (r7, e, t) => new St(r7, t)).infixLeft("as", y.As, (r7, e, t) => new ye(r7, t)).infixLeft("contains", y.Contains, (r7, e, t) => new ht(r7, t)).infixLeft("div", y.Divide, (r7, e, t) => new V("div", r7, t, (n, i) => n / i | 0)).infixLeft("in", y.In, (r7, e, t) => new yt(r7, t)).infixLeft("is", y.Is, (r7, e, t) => new ge(r7, t)).infixLeft("mod", y.Modulo, (r7, e, t) => new V("mod", r7, t, (n, i) => n % i)).infixLeft("or", y.Or, (r7, e, t) => new Et(r7, t)).infixLeft("xor", y.Xor, (r7, e, t) => new bt(r7, t)).infixLeft("implies", y.Implies, (r7, e, t) => new Rt(r7, t));
41543
+ return new Je().registerPrefix("String", { parse: (r7, e) => new U({ type: l.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r7, e) => new U({ type: l.dateTime, value: Oe(e.value) }) }).registerPrefix("Quantity", { parse: (r7, e) => new U({ type: l.Quantity, value: ss(e.value) }) }).registerPrefix("Number", { parse: (r7, e) => new U({ type: e.value.includes(".") ? l.decimal : l.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new U({ type: l.boolean, value: true }) }).registerPrefix("false", { parse: () => new U({ type: l.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r7, e) => new q(e.value) }).registerPrefix("{}", { parse: () => new dt() }).registerPrefix("(", ns).registerInfix("[", is).registerInfix("(", os).prefix("+", y.UnaryAdd, (r7, e) => new ft("+", e, (t) => t)).prefix("-", y.UnarySubtract, (r7, e) => new V("-", e, e, (t, n) => -n)).infixLeft(".", y.Dot, (r7, e, t) => new re(r7, t)).infixLeft("/", y.Divide, (r7, e, t) => new V("/", r7, t, (n, i) => n / i)).infixLeft("*", y.Multiply, (r7, e, t) => new V("*", r7, t, (n, i) => n * i)).infixLeft("+", y.Add, (r7, e, t) => new V("+", r7, t, (n, i) => n + i)).infixLeft("-", y.Subtract, (r7, e, t) => new V("-", r7, t, (n, i) => n - i)).infixLeft("|", y.Union, (r7, e, t) => new Ie(r7, t)).infixLeft("=", y.Equals, (r7, e, t) => new gt(r7, t)).infixLeft("!=", y.NotEquals, (r7, e, t) => new vt(r7, t)).infixLeft("~", y.Equivalent, (r7, e, t) => new xt(r7, t)).infixLeft("!~", y.NotEquivalent, (r7, e, t) => new Tt(r7, t)).infixLeft("<", y.LessThan, (r7, e, t) => new V("<", r7, t, (n, i) => n < i)).infixLeft("<=", y.LessThanOrEquals, (r7, e, t) => new V("<=", r7, t, (n, i) => n <= i)).infixLeft(">", y.GreaterThan, (r7, e, t) => new V(">", r7, t, (n, i) => n > i)).infixLeft(">=", y.GreaterThanOrEquals, (r7, e, t) => new V(">=", r7, t, (n, i) => n >= i)).infixLeft("&", y.Ampersand, (r7, e, t) => new mt(r7, t)).infixLeft("and", y.And, (r7, e, t) => new St(r7, t)).infixLeft("as", y.As, (r7, e, t) => new ye(r7, t)).infixLeft("contains", y.Contains, (r7, e, t) => new ht(r7, t)).infixLeft("div", y.Divide, (r7, e, t) => new V("div", r7, t, (n, i) => n / i | 0)).infixLeft("in", y.In, (r7, e, t) => new yt(r7, t)).infixLeft("is", y.Is, (r7, e, t) => new ge(r7, t)).infixLeft("mod", y.Modulo, (r7, e, t) => new V("mod", r7, t, (n, i) => n % i)).infixLeft("or", y.Or, (r7, e, t) => new Et(r7, t)).infixLeft("xor", y.Xor, (r7, e, t) => new bt(r7, t)).infixLeft("implies", y.Implies, (r7, e, t) => new Rt(r7, t));
41541
41544
  }
41542
- var ss = je();
41543
- var ei = ((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))(ei || {});
41544
- var si = ((T) => (T.EQUALS = "eq", T.NOT_EQUALS = "ne", T.GREATER_THAN = "gt", T.LESS_THAN = "lt", T.GREATER_THAN_OR_EQUALS = "ge", T.LESS_THAN_OR_EQUALS = "le", T.STARTS_AFTER = "sa", T.ENDS_BEFORE = "eb", T.APPROXIMATELY = "ap", T.CONTAINS = "contains", T.EXACT = "exact", T.TEXT = "text", T.NOT = "not", T.ABOVE = "above", T.BELOW = "below", T.IN = "in", T.NOT_IN = "not-in", T.OF_TYPE = "of-type", T.MISSING = "missing", T.PRESENT = "present", T.IDENTIFIER = "identifier", T.ITERATE = "iterate", T))(si || {});
41545
- var _s = ((b2) => (b2.READ = "read", b2.VREAD = "vread", b2.UPDATE = "update", b2.PATCH = "patch", b2.DELETE = "delete", b2.HISTORY = "history", b2.HISTORY_INSTANCE = "history-instance", b2.HISTORY_TYPE = "history-type", b2.HISTORY_SYSTEM = "history-system", b2.CREATE = "create", b2.SEARCH = "search", b2.SEARCH_TYPE = "search-type", b2.SEARCH_SYSTEM = "search-system", b2.SEARCH_COMPARTMENT = "search-compartment", b2.CAPABILITIES = "capabilities", b2.TRANSACTION = "transaction", b2.BATCH = "batch", b2.OPERATION = "operation", b2))(_s || {});
41546
- function li(r7) {
41545
+ var as = je();
41546
+ var ti = ((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))(ti || {});
41547
+ var ai = ((T) => (T.EQUALS = "eq", T.NOT_EQUALS = "ne", T.GREATER_THAN = "gt", T.LESS_THAN = "lt", T.GREATER_THAN_OR_EQUALS = "ge", T.LESS_THAN_OR_EQUALS = "le", T.STARTS_AFTER = "sa", T.ENDS_BEFORE = "eb", T.APPROXIMATELY = "ap", T.CONTAINS = "contains", T.EXACT = "exact", T.TEXT = "text", T.NOT = "not", T.ABOVE = "above", T.BELOW = "below", T.IN = "in", T.NOT_IN = "not-in", T.OF_TYPE = "of-type", T.MISSING = "missing", T.PRESENT = "present", T.IDENTIFIER = "identifier", T.ITERATE = "iterate", T))(ai || {});
41548
+ var Ns = ((b2) => (b2.READ = "read", b2.VREAD = "vread", b2.UPDATE = "update", b2.PATCH = "patch", b2.DELETE = "delete", b2.HISTORY = "history", b2.HISTORY_INSTANCE = "history-instance", b2.HISTORY_TYPE = "history-type", b2.HISTORY_SYSTEM = "history-system", b2.CREATE = "create", b2.SEARCH = "search", b2.SEARCH_TYPE = "search-type", b2.SEARCH_SYSTEM = "search-system", b2.SEARCH_COMPARTMENT = "search-compartment", b2.CAPABILITIES = "capabilities", b2.TRANSACTION = "transaction", b2.BATCH = "batch", b2.OPERATION = "operation", b2))(Ns || {});
41549
+ function pi(r7) {
41547
41550
  if (typeof window < "u") {
41548
41551
  let e = window.atob(r7), t = Uint8Array.from(e, (n) => n.charCodeAt(0));
41549
41552
  return new window.TextDecoder().decode(t);
@@ -41551,7 +41554,7 @@ function li(r7) {
41551
41554
  if (typeof Buffer < "u") return Buffer.from(r7, "base64").toString("utf-8");
41552
41555
  throw new Error("Unable to decode base64");
41553
41556
  }
41554
- function pi(r7) {
41557
+ function di(r7) {
41555
41558
  if (typeof window < "u") {
41556
41559
  let e = new window.TextEncoder().encode(r7), t = String.fromCharCode.apply(null, e);
41557
41560
  return window.btoa(t);
@@ -41563,7 +41566,7 @@ function _r() {
41563
41566
  let r7 = new Uint32Array(28);
41564
41567
  return crypto.getRandomValues(r7), qn(r7.buffer);
41565
41568
  }
41566
- async function di(r7) {
41569
+ async function fi(r7) {
41567
41570
  return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r7));
41568
41571
  }
41569
41572
  function xe() {
@@ -41640,57 +41643,57 @@ var H = class {
41640
41643
  }
41641
41644
  };
41642
41645
  var Lr = { "Patient-open": "Patient-open", "Patient-close": "Patient-close", "ImagingStudy-open": "ImagingStudy-open", "ImagingStudy-close": "ImagingStudy-close", "Encounter-open": "Encounter-open", "Encounter-close": "Encounter-close", "DiagnosticReport-open": "DiagnosticReport-open", "DiagnosticReport-close": "DiagnosticReport-close", "DiagnosticReport-select": "DiagnosticReport-select", "DiagnosticReport-update": "DiagnosticReport-update", syncerror: "syncerror" };
41643
- var Ws = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
41646
+ var Gs = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
41644
41647
  var Fr = ["DiagnosticReport-update"];
41645
- function hi(r7) {
41648
+ function yi(r7) {
41646
41649
  return Fr.includes(r7);
41647
41650
  }
41648
- function yi(r7) {
41651
+ function gi(r7) {
41649
41652
  if (Fr.includes(r7)) throw new d(h(`'context.version' is required for '${r7}'.`));
41650
41653
  }
41651
- var Gs = { "Patient-open": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "Patient-close": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "ImagingStudy-open": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "ImagingStudy-close": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "Encounter-open": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "Encounter-close": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "DiagnosticReport-open": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-close": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-select": { report: { resourceType: "DiagnosticReport" }, select: { resourceType: "*", isArray: true } }, "DiagnosticReport-update": { report: { resourceType: "DiagnosticReport" }, patient: { resourceType: "Patient", optional: true }, study: { resourceType: "ImagingStudy", optional: true }, updates: { resourceType: "Bundle" } }, syncerror: { operationoutcome: { resourceType: "OperationOutcome" } } };
41652
- function Hs(r7) {
41653
- return Ws.includes(r7);
41654
+ var Hs = { "Patient-open": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "Patient-close": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "ImagingStudy-open": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "ImagingStudy-close": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "Encounter-open": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "Encounter-close": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "DiagnosticReport-open": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-close": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-select": { report: { resourceType: "DiagnosticReport" }, select: { resourceType: "*", isArray: true } }, "DiagnosticReport-update": { report: { resourceType: "DiagnosticReport" }, patient: { resourceType: "Patient", optional: true }, study: { resourceType: "ImagingStudy", optional: true }, updates: { resourceType: "Bundle" } }, syncerror: { operationoutcome: { resourceType: "OperationOutcome" } } };
41655
+ function Qs(r7) {
41656
+ return Gs.includes(r7);
41654
41657
  }
41655
- function gi(r7) {
41658
+ function vi(r7) {
41656
41659
  return !!r7.endpoint;
41657
41660
  }
41658
41661
  function Ur(r7) {
41659
41662
  if (!It(r7)) throw new d(h("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
41660
41663
  let { channelType: e, mode: t, topic: n, events: i } = r7, o = { "hub.channel.type": e, "hub.mode": t, "hub.topic": n, "hub.events": i.join(",") };
41661
- return gi(r7) && (o.endpoint = r7.endpoint), new URLSearchParams(o).toString();
41664
+ return vi(r7) && (o.endpoint = r7.endpoint), new URLSearchParams(o).toString();
41662
41665
  }
41663
41666
  function It(r7) {
41664
41667
  if (typeof r7 != "object") return false;
41665
41668
  let { channelType: e, mode: t, topic: n, events: i } = r7;
41666
41669
  if (!(e && t && n && i) || typeof n != "string" || typeof i != "object" || !Array.isArray(i) || i.length < 1 || e !== "websocket" || t !== "subscribe" && t !== "unsubscribe") return false;
41667
41670
  for (let o of i) if (!Lr[o]) return false;
41668
- return !(gi(r7) && !(typeof r7.endpoint == "string" && r7.endpoint.startsWith("ws")));
41671
+ return !(vi(r7) && !(typeof r7.endpoint == "string" && r7.endpoint.startsWith("ws")));
41669
41672
  }
41670
- function mi(r7, e, t, n) {
41673
+ function hi(r7, e, t, n) {
41671
41674
  if (typeof e != "object") throw new d(h(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
41672
41675
  if (!(e.id && typeof e.id == "string")) throw new d(h(`context[${t}] is invalid. Resource must contain a valid string ID.`));
41673
41676
  if (!e.resourceType) throw new d(h(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
41674
41677
  let i = n.resourceType;
41675
41678
  if (i !== "*") {
41676
- if (!Hs(e.resourceType)) throw new d(h(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
41679
+ if (!Qs(e.resourceType)) throw new d(h(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
41677
41680
  if (i && e.resourceType !== i) throw new d(h(`context[${t}] is invalid. context[${t}] for the '${r7}' event should contain resource of type ${i}.`));
41678
41681
  }
41679
41682
  }
41680
- function Qs(r7, e, t, n, i) {
41681
- if (i.set(e.key, (i.get(e.key) ?? 0) + 1), !n.isArray) mi(r7, e.resource, t, n);
41683
+ function Ks(r7, e, t, n, i) {
41684
+ if (i.set(e.key, (i.get(e.key) ?? 0) + 1), !n.isArray) hi(r7, e.resource, t, n);
41682
41685
  else {
41683
41686
  let { resources: o } = e;
41684
41687
  if (!o) throw new d(h(`context[${t}] is invalid. context[${t}] for the '${r7}' with key '${String(e.key)}' should contain an array of resources on the key 'resources'.`));
41685
- for (let s of o) mi(r7, s, t, n);
41688
+ for (let s of o) hi(r7, s, t, n);
41686
41689
  }
41687
41690
  }
41688
- function Ks(r7, e) {
41689
- let t = /* @__PURE__ */ new Map(), n = Gs[r7];
41691
+ function zs(r7, e) {
41692
+ let t = /* @__PURE__ */ new Map(), n = Hs[r7];
41690
41693
  for (let i = 0; i < e.length; i++) {
41691
41694
  let o = e[i].key;
41692
41695
  if (!n[o]) throw new d(h(`Key '${o}' not found for event '${r7}'. Make sure to add only valid keys.`));
41693
- Qs(r7, e[i], i, n[o], t);
41696
+ Ks(r7, e[i], i, n[o], t);
41694
41697
  }
41695
41698
  for (let [i, o] of Object.entries(n)) {
41696
41699
  if (!(o.optional || t.has(i))) throw new d(h(`Missing required key '${i}' on context for '${r7}' event.`));
@@ -41703,7 +41706,7 @@ function Br(r7, e, t, n) {
41703
41706
  if (typeof t != "object") throw new d(h("context must be a context object or array of context objects."));
41704
41707
  if (Fr.includes(e) && !n) throw new d(h(`The '${e}' event must contain a 'context.versionId'.`));
41705
41708
  let i = Array.isArray(t) ? t : [t];
41706
- return Ks(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: xe(), event: { "hub.topic": r7, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
41709
+ return zs(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: xe(), event: { "hub.topic": r7, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
41707
41710
  }
41708
41711
  var Ot = class extends H {
41709
41712
  constructor(e) {
@@ -41725,28 +41728,28 @@ var Ot = class extends H {
41725
41728
  this.websocket.close();
41726
41729
  }
41727
41730
  };
41728
- function zs(r7) {
41729
- let e = r7.replace(/-/g, "+").replace(/_/g, "/"), t = li(e), n = Array.from(t).reduce((o, s) => {
41731
+ function Js(r7) {
41732
+ let e = r7.replace(/-/g, "+").replace(/_/g, "/"), t = pi(e), n = Array.from(t).reduce((o, s) => {
41730
41733
  let a2 = ("00" + s.charCodeAt(0).toString(16)).slice(-2);
41731
41734
  return `${o}%${a2}`;
41732
41735
  }, ""), i = decodeURIComponent(n);
41733
41736
  return JSON.parse(i);
41734
41737
  }
41735
- function vi(r7) {
41738
+ function xi(r7) {
41736
41739
  return r7.split(".").length === 3;
41737
41740
  }
41738
41741
  function kt(r7) {
41739
41742
  let [e, t, n] = r7.split(".");
41740
- return zs(t);
41743
+ return Js(t);
41741
41744
  }
41742
- function xi(r7) {
41745
+ function Ti(r7) {
41743
41746
  try {
41744
41747
  return typeof kt(r7).login_id == "string";
41745
41748
  } catch {
41746
41749
  return false;
41747
41750
  }
41748
41751
  }
41749
- function Ti(r7) {
41752
+ function Si(r7) {
41750
41753
  try {
41751
41754
  let t = kt(r7).exp;
41752
41755
  return typeof t == "number" ? t * 1e3 : void 0;
@@ -41768,11 +41771,11 @@ var Vt = class {
41768
41771
  await this.medplum.delete(`keyvalue/v1/${e}`);
41769
41772
  }
41770
41773
  };
41771
- var Si;
41772
- Si = Symbol.toStringTag;
41774
+ var Ei;
41775
+ Ei = Symbol.toStringTag;
41773
41776
  var M = class {
41774
41777
  constructor(e) {
41775
- this[Si] = "ReadablePromise";
41778
+ this[Ei] = "ReadablePromise";
41776
41779
  this.status = "pending";
41777
41780
  this.suspender = e.then((t) => (this.status = "success", this.response = t, t), (t) => {
41778
41781
  throw this.status = "error", this.error = t, t;
@@ -41849,8 +41852,8 @@ var qr = class {
41849
41852
  }
41850
41853
  };
41851
41854
  var Ve = { Event: typeof globalThis.Event < "u" ? globalThis.Event : void 0, ErrorEvent: void 0, CloseEvent: void 0 };
41852
- var bi = false;
41853
- function Js() {
41855
+ var Ri = false;
41856
+ function Ys() {
41854
41857
  if (typeof globalThis.Event > "u") throw new Error("Unable to lazy init events for ReconnectingWebSocket. globalThis.Event is not defined yet");
41855
41858
  Ve.Event = globalThis.Event, Ve.ErrorEvent = class extends Event {
41856
41859
  constructor(e, t) {
@@ -41864,17 +41867,17 @@ function Js() {
41864
41867
  }
41865
41868
  };
41866
41869
  }
41867
- function Ys(r7, e) {
41870
+ function Zs(r7, e) {
41868
41871
  if (!r7) throw new Error(e);
41869
41872
  }
41870
41873
  function Dt(r7) {
41871
41874
  return new r7.constructor(r7.type, r7);
41872
41875
  }
41873
41876
  var Te = { maxReconnectionDelay: 1e4, minReconnectionDelay: 1e3 + Math.random() * 4e3, minUptime: 5e3, reconnectionDelayGrowFactor: 1.3, connectionTimeout: 4e3, maxRetries: 1 / 0, maxEnqueuedMessages: 1 / 0, startClosed: false, debug: false };
41874
- var Ri = false;
41877
+ var Ci = false;
41875
41878
  var Mt = class r extends H {
41876
41879
  constructor(t, n, i = {}) {
41877
- bi || (Js(), bi = true);
41880
+ Ri || (Ys(), Ri = true);
41878
41881
  super();
41879
41882
  this._retryCount = -1;
41880
41883
  this._shouldReconnect = true;
@@ -41889,7 +41892,7 @@ var Mt = class r extends H {
41889
41892
  this._handleOpen = (t2) => {
41890
41893
  this._debug("open event");
41891
41894
  let { minUptime: n2 = Te.minUptime } = this._options;
41892
- clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), Ys(this._ws, "WebSocket is not defined"), this._ws.binaryType = this._binaryType, this._messageQueue.forEach((i2) => this._ws?.send(i2)), this._messageQueue = [], this.onopen && this.onopen(t2), this.dispatchEvent(Dt(t2));
41895
+ clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), Zs(this._ws, "WebSocket is not defined"), this._ws.binaryType = this._binaryType, this._messageQueue.forEach((i2) => this._ws?.send(i2)), this._messageQueue = [], this.onopen && this.onopen(t2), this.dispatchEvent(Dt(t2));
41893
41896
  };
41894
41897
  this._handleMessage = (t2) => {
41895
41898
  this._debug("message event"), this.onmessage && this.onmessage(t2), this.dispatchEvent(Dt(t2));
@@ -41999,7 +42002,7 @@ var Mt = class r extends H {
41999
42002
  this._connectLock = false;
42000
42003
  return;
42001
42004
  }
42002
- !this._options.WebSocket && typeof WebSocket > "u" && !Ri && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), Ri = true);
42005
+ !this._options.WebSocket && typeof WebSocket > "u" && !Ci && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), Ci = true);
42003
42006
  let i = this._options.WebSocket || WebSocket;
42004
42007
  this._debug("connect", { url: this._url, protocols: this._protocols }), this._ws = this._protocols ? new i(this._url, this._protocols) : new i(this._url), this._ws.binaryType = this._binaryType, this._connectLock = false, this._addListeners(), this._connectTimeout = setTimeout(() => this._handleTimeout(), n);
42005
42008
  }).catch((i) => {
@@ -42031,7 +42034,7 @@ var Mt = class r extends H {
42031
42034
  clearTimeout(this._connectTimeout), clearTimeout(this._uptimeTimeout);
42032
42035
  }
42033
42036
  };
42034
- var Zs = 5e3;
42037
+ var Xs = 5e3;
42035
42038
  var Ge = class extends H {
42036
42039
  constructor(...e) {
42037
42040
  super(), this.criteria = new Set(e);
@@ -42067,7 +42070,7 @@ var _t = class {
42067
42070
  throw new d(h("Not a valid URL"));
42068
42071
  }
42069
42072
  let o = n?.ReconnectingWebSocket ? new n.ReconnectingWebSocket(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger }) : new Mt(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger });
42070
- this.medplum = e, this.ws = o, this.masterSubEmitter = new Ge(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ?? Zs, this.currentProfile = e.getProfile(), this.setupListeners();
42073
+ this.medplum = e, this.ws = o, this.masterSubEmitter = new Ge(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ?? Xs, this.currentProfile = e.getProfile(), this.setupListeners();
42071
42074
  }
42072
42075
  setupListeners() {
42073
42076
  let e = this.ws;
@@ -42225,25 +42228,25 @@ var _t = class {
42225
42228
  return this.masterSubEmitter || (this.masterSubEmitter = new Ge(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
42226
42229
  }
42227
42230
  };
42228
- var Xd = "3.2.23-b7a535d09";
42229
- var ta = D.FHIR_JSON + ", */*; q=0.1";
42230
- var ra = "https://api.medplum.com/";
42231
- var na = 1e3;
42232
- var ia = 6e4;
42233
- var oa = 0;
42234
- var sa = 3e5;
42235
- var aa = "Binary/";
42236
- var Ci = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
42237
- var ca = ((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))(ca || {});
42238
- var ua = ((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))(ua || {});
42239
- var la = ((o) => (o.ClientSecretBasic = "client_secret_basic", o.ClientSecretPost = "client_secret_post", o.ClientSecretJwt = "client_secret_jwt", o.PrivateKeyJwt = "private_key_jwt", o.None = "none", o))(la || {});
42240
- var pa = ((e) => (e.JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", e))(pa || {});
42231
+ var ef = "3.2.24-75ed53f1f";
42232
+ var ra = D.FHIR_JSON + ", */*; q=0.1";
42233
+ var na = "https://api.medplum.com/";
42234
+ var ia = 1e3;
42235
+ var oa = 6e4;
42236
+ var sa = 0;
42237
+ var aa = 3e5;
42238
+ var ca = "Binary/";
42239
+ var Pi = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
42240
+ var ua = ((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))(ua || {});
42241
+ var la = ((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))(la || {});
42242
+ var pa = ((o) => (o.ClientSecretBasic = "client_secret_basic", o.ClientSecretPost = "client_secret_post", o.ClientSecretJwt = "client_secret_jwt", o.PrivateKeyJwt = "private_key_jwt", o.None = "none", o))(pa || {});
42243
+ var da = ((e) => (e.JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", e))(da || {});
42241
42244
  var Nt = class extends H {
42242
42245
  constructor(t) {
42243
42246
  super();
42244
42247
  this.initComplete = true;
42245
42248
  if (t?.baseUrl && !t.baseUrl.startsWith("http")) throw new Error("Base URL must start with http or https");
42246
- this.options = t ?? {}, this.fetch = t?.fetch ?? da(), this.storage = t?.storage ?? new We(), this.createPdfImpl = t?.createPdf, this.baseUrl = Cr(t?.baseUrl ?? ra), this.fhirBaseUrl = B(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = B(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = B(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = B(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = B(this.baseUrl, t?.fhircastHubUrl ?? "fhircast/STU3"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.onUnauthenticated = t?.onUnauthenticated, this.refreshGracePeriod = t?.refreshGracePeriod ?? sa, this.cacheTime = t?.cacheTime ?? (typeof window > "u" ? oa : ia), this.cacheTime > 0 ? this.requestCache = new At(t?.resourceCacheSize ?? na) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken && this.setAccessToken(t.accessToken), this.storage.getInitPromise === void 0 ? (t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initPromise = Promise.resolve(), this.dispatchEvent({ type: "storageInitialized" })) : (this.initComplete = false, this.initPromise = this.storage.getInitPromise(), this.initPromise.then(() => {
42249
+ this.options = t ?? {}, this.fetch = t?.fetch ?? fa(), this.storage = t?.storage ?? new We(), this.createPdfImpl = t?.createPdf, this.baseUrl = Cr(t?.baseUrl ?? na), this.fhirBaseUrl = B(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = B(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = B(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = B(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = B(this.baseUrl, t?.fhircastHubUrl ?? "fhircast/STU3"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.onUnauthenticated = t?.onUnauthenticated, this.refreshGracePeriod = t?.refreshGracePeriod ?? aa, this.cacheTime = t?.cacheTime ?? (typeof window > "u" ? sa : oa), this.cacheTime > 0 ? this.requestCache = new At(t?.resourceCacheSize ?? ia) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken && this.setAccessToken(t.accessToken), this.storage.getInitPromise === void 0 ? (t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initPromise = Promise.resolve(), this.dispatchEvent({ type: "storageInitialized" })) : (this.initComplete = false, this.initPromise = this.storage.getInitPromise(), this.initPromise.then(() => {
42247
42250
  t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initComplete = true, this.dispatchEvent({ type: "storageInitialized" });
42248
42251
  }).catch((n) => {
42249
42252
  console.error(n), this.initComplete = true, this.dispatchEvent({ type: "storageInitFailed", payload: { error: n } });
@@ -42370,7 +42373,7 @@ var Nt = class extends H {
42370
42373
  }
42371
42374
  fhirSearchUrl(t, n) {
42372
42375
  let i = this.fhirUrl(t);
42373
- return n && (i.search = Qn(n)), i;
42376
+ return n && (i.search = Kn(n)), i;
42374
42377
  }
42375
42378
  search(t, n, i) {
42376
42379
  let o = this.fhirSearchUrl(t, n), s = "search-" + o.toString(), a2 = this.getCacheEntry(s, i);
@@ -42393,7 +42396,7 @@ var Nt = class extends H {
42393
42396
  searchResources(t, n, i) {
42394
42397
  let s = "searchResources-" + this.fhirSearchUrl(t, n).toString(), a2 = this.getCacheEntry(s, i);
42395
42398
  if (a2) return a2.value;
42396
- let c = new M(this.search(t, n, i).then(Ai));
42399
+ let c = new M(this.search(t, n, i).then(Oi));
42397
42400
  return this.setCacheEntry(s, c), c;
42398
42401
  }
42399
42402
  async *searchResourcePages(t, n, i) {
@@ -42401,7 +42404,7 @@ var Nt = class extends H {
42401
42404
  for (; o; ) {
42402
42405
  let s = new URL(o).searchParams, a2 = await this.search(t, s, i), c = a2.link?.find((u2) => u2.relation === "next");
42403
42406
  if (!a2.entry?.length && !c) break;
42404
- yield Ai(a2), o = c?.url ? new URL(c.url) : void 0;
42407
+ yield Oi(a2), o = c?.url ? new URL(c.url) : void 0;
42405
42408
  }
42406
42409
  }
42407
42410
  searchValueSet(t, n, i) {
@@ -42418,7 +42421,7 @@ var Nt = class extends H {
42418
42421
  getCachedReference(t) {
42419
42422
  let n = t.reference;
42420
42423
  if (!n) return;
42421
- if (n === "system") return Ci;
42424
+ if (n === "system") return Pi;
42422
42425
  let [i, o] = n.split("/");
42423
42426
  if (!(!i || !o)) return this.getCached(i, o);
42424
42427
  }
@@ -42429,7 +42432,7 @@ var Nt = class extends H {
42429
42432
  readReference(t, n) {
42430
42433
  let i = t.reference;
42431
42434
  if (!i) return new M(Promise.reject(new Error("Missing reference")));
42432
- if (i === "system") return new M(Promise.resolve(Ci));
42435
+ if (i === "system") return new M(Promise.resolve(Pi));
42433
42436
  let [o, s] = i.split("/");
42434
42437
  return !o || !s ? new M(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
42435
42438
  }
@@ -42529,11 +42532,11 @@ var Nt = class extends H {
42529
42532
  return s || (s = t), this.cacheResource(s), this.invalidateUrl(this.fhirUrl(t.resourceType, t.id, "_history")), this.invalidateSearches(t.resourceType), s;
42530
42533
  }
42531
42534
  async createAttachment(t, n, i, o, s) {
42532
- let a2 = Oi(t, n, i, o), c = s ?? (typeof n == "object" ? n : {}), u2 = await this.createBinary(a2, c);
42535
+ let a2 = Ii(t, n, i, o), c = s ?? (typeof n == "object" ? n : {}), u2 = await this.createBinary(a2, c);
42533
42536
  return { contentType: a2.contentType, url: u2.url, title: a2.filename };
42534
42537
  }
42535
42538
  createBinary(t, n, i, o, s) {
42536
- let a2 = Oi(t, n, i, o), c = s ?? (typeof n == "object" ? n : {}), { data: u2, contentType: p2, filename: m2, securityContext: v, onProgress: Q } = a2, _e = this.fhirUrl("Binary");
42539
+ let a2 = Ii(t, n, i, o), c = s ?? (typeof n == "object" ? n : {}), { data: u2, contentType: p2, filename: m2, securityContext: v, onProgress: Q } = a2, _e = this.fhirUrl("Binary");
42537
42540
  return m2 && _e.searchParams.set("_filename", m2), v?.reference && this.setRequestHeader(c, "X-Security-Context", v.reference), Q ? this.uploadwithProgress(_e, u2, p2, Q, c) : this.post(_e, u2, p2, c);
42538
42541
  }
42539
42542
  uploadwithProgress(t, n, i, o, s) {
@@ -42554,7 +42557,7 @@ var Nt = class extends H {
42554
42557
  }
42555
42558
  async createPdf(t, n, i, o) {
42556
42559
  if (!this.createPdfImpl) throw new Error("PDF creation not enabled");
42557
- let s = ha(t, n, i, o), a2 = typeof n == "object" ? n : {}, { docDefinition: c, tableLayouts: u2, fonts: p2, ...m2 } = s, v = await this.createPdfImpl(c, u2, p2), Q = { ...m2, data: v, contentType: "application/pdf" };
42560
+ let s = ya(t, n, i, o), a2 = typeof n == "object" ? n : {}, { docDefinition: c, tableLayouts: u2, fonts: p2, ...m2 } = s, v = await this.createPdfImpl(c, u2, p2), Q = { ...m2, data: v, contentType: "application/pdf" };
42558
42561
  return this.createBinary(Q, a2);
42559
42562
  }
42560
42563
  createComment(t, n, i) {
@@ -42613,7 +42616,7 @@ var Nt = class extends H {
42613
42616
  return this.accessToken;
42614
42617
  }
42615
42618
  setAccessToken(t, n) {
42616
- this.accessToken = t, this.refreshToken = n, this.accessTokenExpires = Ti(t), this.medplumServer = xi(t);
42619
+ this.accessToken = t, this.refreshToken = n, this.accessTokenExpires = Si(t), this.medplumServer = Ti(t);
42617
42620
  }
42618
42621
  getLogins() {
42619
42622
  return this.storage.getObject("logins") ?? [];
@@ -42661,7 +42664,7 @@ var Nt = class extends H {
42661
42664
  async download(t, n = {}) {
42662
42665
  this.refreshPromise && await this.refreshPromise;
42663
42666
  let i = t.toString();
42664
- i.startsWith(aa) && (t = this.fhirUrl(i));
42667
+ i.startsWith(ca) && (t = this.fhirUrl(i));
42665
42668
  let o = n.headers;
42666
42669
  return o || (o = {}, n.headers = o), o.Accept || (o.Accept = "*/*"), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
42667
42670
  }
@@ -42709,11 +42712,11 @@ var Nt = class extends H {
42709
42712
  if (s.status === 404 && !c) throw new d(on);
42710
42713
  let u2 = await this.parseBody(s, c);
42711
42714
  if (s.status === 200 && i.followRedirectOnOk || s.status === 201 && i.followRedirectOnCreated) {
42712
- let p2 = await wi(s, u2);
42715
+ let p2 = await Ai(s, u2);
42713
42716
  if (p2) return this.request("GET", p2, { ...i, body: void 0 });
42714
42717
  }
42715
42718
  if (s.status === 202 && i.pollStatusOnAccepted) {
42716
- let m2 = await wi(s, u2) ?? o.statusUrl;
42719
+ let m2 = await Ai(s, u2) ?? o.statusUrl;
42717
42720
  if (m2) return this.pollStatus(m2, i, o);
42718
42721
  }
42719
42722
  if (s.status >= 400) throw new d(Xe(u2));
@@ -42781,7 +42784,7 @@ var Nt = class extends H {
42781
42784
  }
42782
42785
  }
42783
42786
  addFetchOptionsDefaults(t) {
42784
- this.setRequestHeader(t, "Accept", ta, true), this.options.extendedMode !== false && this.setRequestHeader(t, "X-Medplum", "extended"), t.body && this.setRequestHeader(t, "Content-Type", D.FHIR_JSON, true), this.accessToken ? this.setRequestHeader(t, "Authorization", "Bearer " + this.accessToken) : this.basicAuth && this.setRequestHeader(t, "Authorization", "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
42787
+ this.setRequestHeader(t, "Accept", ra, true), this.options.extendedMode !== false && this.setRequestHeader(t, "X-Medplum", "extended"), t.body && this.setRequestHeader(t, "Content-Type", D.FHIR_JSON, true), this.accessToken ? this.setRequestHeader(t, "Authorization", "Bearer " + this.accessToken) : this.basicAuth && this.setRequestHeader(t, "Authorization", "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
42785
42788
  }
42786
42789
  setRequestContentType(t, n) {
42787
42790
  this.setRequestHeader(t, "Content-Type", n);
@@ -42802,16 +42805,16 @@ var Nt = class extends H {
42802
42805
  sessionStorage.setItem("pkceState", t);
42803
42806
  let n = _r().slice(0, 128);
42804
42807
  sessionStorage.setItem("codeVerifier", n);
42805
- let i = await di(n), o = jn(i).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
42808
+ let i = await fi(n), o = jn(i).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
42806
42809
  return sessionStorage.setItem("codeChallenge", o), { codeChallengeMethod: "S256", codeChallenge: o };
42807
42810
  }
42808
42811
  async requestAuthorization(t) {
42809
42812
  let n = await this.ensureCodeChallenge(t ?? {}), i = new URL(this.authorizeUrl);
42810
- i.searchParams.set("response_type", "code"), i.searchParams.set("state", sessionStorage.getItem("pkceState")), i.searchParams.set("client_id", n.clientId ?? this.clientId), i.searchParams.set("redirect_uri", n.redirectUri ?? Pi()), i.searchParams.set("code_challenge_method", n.codeChallengeMethod), i.searchParams.set("code_challenge", n.codeChallenge), i.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i.toString());
42813
+ i.searchParams.set("response_type", "code"), i.searchParams.set("state", sessionStorage.getItem("pkceState")), i.searchParams.set("client_id", n.clientId ?? this.clientId), i.searchParams.set("redirect_uri", n.redirectUri ?? wi()), i.searchParams.set("code_challenge_method", n.codeChallengeMethod), i.searchParams.set("code_challenge", n.codeChallenge), i.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i.toString());
42811
42814
  }
42812
42815
  processCode(t, n) {
42813
42816
  let i = new URLSearchParams();
42814
- if (i.set("grant_type", "authorization_code"), i.set("code", t), i.set("client_id", n?.clientId ?? this.clientId), i.set("redirect_uri", n?.redirectUri ?? Pi()), typeof sessionStorage < "u") {
42817
+ if (i.set("grant_type", "authorization_code"), i.set("code", t), i.set("client_id", n?.clientId ?? this.clientId), i.set("redirect_uri", n?.redirectUri ?? wi()), typeof sessionStorage < "u") {
42815
42818
  let o = sessionStorage.getItem("codeVerifier");
42816
42819
  o && i.set("code_verifier", o);
42817
42820
  }
@@ -42843,7 +42846,7 @@ var Nt = class extends H {
42843
42846
  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);
42844
42847
  }
42845
42848
  setBasicAuth(t, n) {
42846
- this.clientId = t, this.clientSecret = n, this.basicAuth = pi(t + ":" + n);
42849
+ this.clientId = t, this.clientSecret = n, this.basicAuth = di(t + ":" + n);
42847
42850
  }
42848
42851
  async fhircastSubscribe(t, n) {
42849
42852
  if (!(typeof t == "string" && t !== "")) throw new d(h("Invalid topic provided. Topic must be a valid string."));
@@ -42861,7 +42864,7 @@ var Nt = class extends H {
42861
42864
  return new Ot(t);
42862
42865
  }
42863
42866
  async fhircastPublish(t, n, i, o) {
42864
- return hi(n) ? this.post(this.fhircastHubUrl, Br(t, n, i, o), D.JSON) : (yi(n), this.post(this.fhircastHubUrl, Br(t, n, i), D.JSON));
42867
+ return yi(n) ? this.post(this.fhircastHubUrl, Br(t, n, i, o), D.JSON) : (gi(n), this.post(this.fhircastHubUrl, Br(t, n, i), D.JSON));
42865
42868
  }
42866
42869
  async fhircastGetContext(t) {
42867
42870
  return this.get(`${this.fhircastHubUrl}/${t}`);
@@ -42892,7 +42895,7 @@ var Nt = class extends H {
42892
42895
  }
42893
42896
  async verifyTokens(t) {
42894
42897
  let n = t.access_token;
42895
- if (vi(n)) {
42898
+ if (xi(n)) {
42896
42899
  let i = kt(n);
42897
42900
  if (Date.now() >= i.exp * 1e3) throw this.clearActiveLogin(), new d(sn);
42898
42901
  if (i.cid) {
@@ -42917,7 +42920,7 @@ var Nt = class extends H {
42917
42920
  }
42918
42921
  }
42919
42922
  getSubscriptionManager() {
42920
- return this.subscriptionManager || (this.subscriptionManager = new _t(this, Hn(this.baseUrl, "/ws/subscriptions-r4"))), this.subscriptionManager;
42923
+ return this.subscriptionManager || (this.subscriptionManager = new _t(this, Qn(this.baseUrl, "/ws/subscriptions-r4"))), this.subscriptionManager;
42921
42924
  }
42922
42925
  subscribeToCriteria(t, n) {
42923
42926
  return this.getSubscriptionManager().addCriteria(t, n);
@@ -42929,40 +42932,40 @@ var Nt = class extends H {
42929
42932
  return this.getSubscriptionManager().getMasterEmitter();
42930
42933
  }
42931
42934
  };
42932
- function da() {
42935
+ function fa() {
42933
42936
  if (!globalThis.fetch) throw new Error("Fetch not available in this environment");
42934
42937
  return globalThis.fetch.bind(globalThis);
42935
42938
  }
42936
- function Pi() {
42939
+ function wi() {
42937
42940
  return typeof window > "u" ? "" : window.location.protocol + "//" + window.location.host + "/";
42938
42941
  }
42939
- async function wi(r7, e) {
42942
+ async function Ai(r7, e) {
42940
42943
  let t = r7.headers.get("content-location");
42941
42944
  if (t) return t;
42942
42945
  let n = r7.headers.get("location");
42943
42946
  if (n) return n;
42944
42947
  if (be(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
42945
42948
  }
42946
- function Ai(r7) {
42949
+ function Oi(r7) {
42947
42950
  let e = r7.entry?.map((t) => t.resource) ?? [];
42948
42951
  return Object.assign(e, { bundle: r7 });
42949
42952
  }
42950
- function fa(r7) {
42953
+ function ma(r7) {
42951
42954
  return R(r7) && "data" in r7 && "contentType" in r7;
42952
42955
  }
42953
- function Oi(r7, e, t, n) {
42954
- return fa(r7) ? r7 : { data: r7, filename: e, contentType: t, onProgress: n };
42956
+ function Ii(r7, e, t, n) {
42957
+ return ma(r7) ? r7 : { data: r7, filename: e, contentType: t, onProgress: n };
42955
42958
  }
42956
- function ma(r7) {
42959
+ function ha(r7) {
42957
42960
  return R(r7) && "docDefinition" in r7;
42958
42961
  }
42959
- function ha(r7, e, t, n) {
42960
- return ma(r7) ? r7 : { docDefinition: r7, filename: e, tableLayouts: t, fonts: n };
42962
+ function ya(r7, e, t, n) {
42963
+ return ha(r7) ? r7 : { docDefinition: r7, filename: e, tableLayouts: t, fonts: n };
42961
42964
  }
42962
- var wa = [...qe, "->", "<<", ">>", "=="];
42963
- var Ia = je().registerInfix("->", { precedence: y.Arrow }).registerInfix(";", { precedence: y.Semicolon });
42964
- var Ka = [...qe, "eq", "ne", "co"];
42965
- var Ya = je();
42965
+ var Aa = [...qe, "->", "<<", ">>", "=="];
42966
+ var ka = je().registerInfix("->", { precedence: y.Arrow }).registerInfix(";", { precedence: y.Semicolon });
42967
+ var za = [...qe, "eq", "ne", "co"];
42968
+ var Za = je();
42966
42969
  var se = class {
42967
42970
  constructor(e = "\r", t = "|", n = "^", i = "~", o = "\\", s = "&") {
42968
42971
  this.segmentSeparator = e;
@@ -42979,7 +42982,7 @@ var se = class {
42979
42982
  return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
42980
42983
  }
42981
42984
  };
42982
- var Hi = class r2 {
42985
+ var Qi = class r2 {
42983
42986
  constructor(e, t = new se()) {
42984
42987
  this.context = t, this.segments = e;
42985
42988
  }
@@ -43003,7 +43006,7 @@ var Hi = class r2 {
43003
43006
  }
43004
43007
  buildAck() {
43005
43008
  let e = /* @__PURE__ */ new Date(), t = this.getSegment("MSH"), n = t?.getField(3)?.toString() ?? "", i = t?.getField(4)?.toString() ?? "", o = t?.getField(5)?.toString() ?? "", s = t?.getField(6)?.toString() ?? "", a2 = t?.getField(10)?.toString() ?? "", c = t?.getField(12)?.toString() ?? "2.5.1";
43006
- return new r2([new Ke(["MSH", this.context.getMsh2(), o, s, n, i, Xa(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", c], this.context), new Ke(["MSA", "AA", a2, "OK"], this.context)]);
43009
+ return new r2([new Ke(["MSH", this.context.getMsh2(), o, s, n, i, ec(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", c], this.context), new Ke(["MSA", "AA", a2, "OK"], this.context)]);
43007
43010
  }
43008
43011
  buildAckMessageType(e) {
43009
43012
  let t = e?.getField(9), n = t?.getComponent(2), i = t?.getComponent(3), o = "ACK";
@@ -43061,12 +43064,12 @@ var Me = class r4 {
43061
43064
  return new r4(e.split(t.repetitionSeparator).map((n) => n.split(t.componentSeparator)), t);
43062
43065
  }
43063
43066
  };
43064
- function Xa(r7) {
43067
+ function ec(r7) {
43065
43068
  let e = r7 instanceof Date ? r7 : new Date(r7), n = e.toISOString().replace(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i = e.getUTCMilliseconds();
43066
43069
  return i > 0 && (n += "." + i.toString()), n;
43067
43070
  }
43068
43071
  var zr = ((o) => (o[o.NONE = 0] = "NONE", o[o.ERROR = 1] = "ERROR", o[o.WARN = 2] = "WARN", o[o.INFO = 3] = "INFO", o[o.DEBUG = 4] = "DEBUG", o))(zr || {});
43069
- var Qi = class r5 {
43072
+ var Ki = class r5 {
43070
43073
  constructor(e, t = {}, n = 3, i) {
43071
43074
  this.write = e;
43072
43075
  this.metadata = t;
@@ -43099,14 +43102,14 @@ var Qi = class r5 {
43099
43102
  `) }), this.write(JSON.stringify({ level: zr[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...n, ...this.metadata })));
43100
43103
  }
43101
43104
  };
43102
- function dm(r7) {
43105
+ function fm(r7) {
43103
43106
  let e = zr[r7.toUpperCase()];
43104
43107
  if (e === void 0) throw new Error(`Invalid log level: ${r7}`);
43105
43108
  return e;
43106
43109
  }
43107
- var sc = "https://api.github.com/repos/medplum/medplum/releases";
43110
+ var ac = "https://api.github.com/repos/medplum/medplum/releases";
43108
43111
  var Qt = /* @__PURE__ */ new Map();
43109
- function ac(r7) {
43112
+ function cc(r7) {
43110
43113
  let e = r7;
43111
43114
  if (!e.tag_name) throw new Error("Manifest missing tag_name");
43112
43115
  let t = e.assets;
@@ -43116,10 +43119,10 @@ function ac(r7) {
43116
43119
  if (!n.name) throw new Error("Asset missing name");
43117
43120
  }
43118
43121
  }
43119
- async function zi(r7) {
43122
+ async function Ji(r7) {
43120
43123
  let e = Qt.get(r7 ?? "latest");
43121
43124
  if (!e) {
43122
- let t = r7 ? `tags/v${r7}` : "latest", n = await fetch(`${sc}/${t}`);
43125
+ let t = r7 ? `tags/v${r7}` : "latest", n = await fetch(`${ac}/${t}`);
43123
43126
  if (n.status !== 200) {
43124
43127
  let o;
43125
43128
  try {
@@ -43130,24 +43133,24 @@ async function zi(r7) {
43130
43133
  throw new Error(`Received status code ${n.status} while fetching manifest for version '${r7 ?? "latest"}'. Message: ${o}`);
43131
43134
  }
43132
43135
  let i = await n.json();
43133
- ac(i), e = i, Qt.set(r7 ?? "latest", e), r7 || Qt.set(e.tag_name.slice(1), e);
43136
+ cc(i), e = i, Qt.set(r7 ?? "latest", e), r7 || Qt.set(e.tag_name.slice(1), e);
43134
43137
  }
43135
43138
  return e;
43136
43139
  }
43137
- function cc(r7) {
43140
+ function uc(r7) {
43138
43141
  return /^\d+\.\d+\.\d+$/.test(r7);
43139
43142
  }
43140
- async function Pm(r7) {
43141
- if (!cc(r7)) return false;
43143
+ async function wm(r7) {
43144
+ if (!uc(r7)) return false;
43142
43145
  try {
43143
- await zi(r7);
43146
+ await Ji(r7);
43144
43147
  } catch {
43145
43148
  return false;
43146
43149
  }
43147
43150
  return true;
43148
43151
  }
43149
- async function wm() {
43150
- let r7 = await zi();
43152
+ async function Am() {
43153
+ let r7 = await Ji();
43151
43154
  if (!r7.tag_name.startsWith("v")) throw new Error(`Invalid release name found. Release tag '${r7.tag_name}' did not start with 'v'`);
43152
43155
  return r7.tag_name.slice(1);
43153
43156
  }
@@ -43195,7 +43198,7 @@ var p = class extends a {
43195
43198
  e.on("data", (s) => {
43196
43199
  try {
43197
43200
  if (this.appendData(s), s.at(-2) === 28 && s.at(-1) === 13) {
43198
- let o = Buffer.concat(this.chunks), i = o.subarray(1, o.length - 2), f2 = (0, import_iconv_lite.decode)(i, this.encoding), g2 = Hi.parse(f2);
43201
+ let o = Buffer.concat(this.chunks), i = o.subarray(1, o.length - 2), f2 = (0, import_iconv_lite.decode)(i, this.encoding), g2 = Qi.parse(f2);
43199
43202
  this.dispatchEvent(new d2(this, g2)), this.resetBuffer();
43200
43203
  }
43201
43204
  } catch (o) {
@@ -43524,7 +43527,7 @@ var AgentHl7Channel = class extends BaseChannel {
43524
43527
  sendToRemote(msg) {
43525
43528
  const connection = this.connections.get(msg.remote);
43526
43529
  if (connection) {
43527
- connection.hl7Connection.send(Hi.parse(msg.body));
43530
+ connection.hl7Connection.send(Qi.parse(msg.body));
43528
43531
  }
43529
43532
  }
43530
43533
  handleNewConnection(connection) {
@@ -43573,7 +43576,7 @@ var UPGRADER_LOG_PATH = (0, import_node_path2.resolve)(
43573
43576
  );
43574
43577
  var RELEASES_PATH = (0, import_node_path2.resolve)(__dirname);
43575
43578
  async function downloadRelease(version, path) {
43576
- const release = await zi(version);
43579
+ const release = await Ji(version);
43577
43580
  const downloadUrl = parseDownloadUrl(release, (0, import_node_os2.platform)());
43578
43581
  const { body } = await fetch(downloadUrl);
43579
43582
  if (!body) {
@@ -43649,7 +43652,7 @@ var App = class _App {
43649
43652
  this.shutdown = false;
43650
43653
  this.keepAlive = false;
43651
43654
  _App.instance = this;
43652
- this.log = new Qi((msg) => console.log(msg), void 0, logLevel);
43655
+ this.log = new Ki((msg) => console.log(msg), void 0, logLevel);
43653
43656
  }
43654
43657
  async start() {
43655
43658
  this.log.info("Medplum service starting...");
@@ -43669,7 +43672,7 @@ var App = class _App {
43669
43672
  if ((0, import_node_fs3.existsSync)(UPGRADE_MANIFEST_PATH)) {
43670
43673
  const upgradeFile = (0, import_node_fs3.readFileSync)(UPGRADE_MANIFEST_PATH, { encoding: "utf-8" });
43671
43674
  const upgradeDetails = JSON.parse(upgradeFile);
43672
- if (upgradeDetails.targetVersion === Xd.split("-")[0]) {
43675
+ if (upgradeDetails.targetVersion === ef.split("-")[0]) {
43673
43676
  await this.sendToWebSocket({
43674
43677
  type: "agent:upgrade:response",
43675
43678
  statusCode: 200,
@@ -43677,7 +43680,7 @@ var App = class _App {
43677
43680
  });
43678
43681
  this.log.info(`Successfully upgraded to version ${upgradeDetails.targetVersion}`);
43679
43682
  } else {
43680
- const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${Xd}`;
43683
+ const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${ef}`;
43681
43684
  await this.sendToWebSocket({
43682
43685
  type: "agent:error",
43683
43686
  body: errMsg,
@@ -43752,7 +43755,7 @@ var App = class _App {
43752
43755
  break;
43753
43756
  case "agent:heartbeat:request":
43754
43757
  this.outstandingHeartbeats = 0;
43755
- await this.sendToWebSocket({ type: "agent:heartbeat:response", version: Xd });
43758
+ await this.sendToWebSocket({ type: "agent:heartbeat:response", version: ef });
43756
43759
  break;
43757
43760
  case "agent:heartbeat:response":
43758
43761
  this.outstandingHeartbeats = 0;
@@ -44027,7 +44030,7 @@ IPv6 is currently unsupported.`;
44027
44030
  this.log.error(errMsg);
44028
44031
  throw new Error(errMsg);
44029
44032
  }
44030
- if (!((0, import_node_net3.isIPv4)(message.remote) || rl(message.remote))) {
44033
+ if (!((0, import_node_net3.isIPv4)(message.remote) || nl(message.remote))) {
44031
44034
  const errMsg = `Attempted to ping an invalid host.
44032
44035
 
44033
44036
  "${message.remote}" is not a valid IPv4 address or a resolvable hostname.`;
@@ -44090,7 +44093,7 @@ ${result}`);
44090
44093
  return;
44091
44094
  }
44092
44095
  let child;
44093
- if (message.version && !await Pm(message.version)) {
44096
+ if (message.version && !await wm(message.version)) {
44094
44097
  const versionTag = message.version ? `v${message.version}` : "latest";
44095
44098
  const errMsg = `Error during upgrading to version '${versionTag}'. '${message.version}' is not a valid version`;
44096
44099
  this.log.error(errMsg);
@@ -44137,12 +44140,12 @@ ${result}`);
44137
44140
  try {
44138
44141
  await this.stop();
44139
44142
  this.log.info("Successfully stopped agent network services");
44140
- const targetVersion = message.version ?? await wm();
44141
- this.log.info("Writing upgrade manifest...", { previousVersion: Xd, targetVersion });
44143
+ const targetVersion = message.version ?? await Am();
44144
+ this.log.info("Writing upgrade manifest...", { previousVersion: ef, targetVersion });
44142
44145
  (0, import_node_fs3.writeFileSync)(
44143
44146
  UPGRADE_MANIFEST_PATH,
44144
44147
  JSON.stringify({
44145
- previousVersion: Xd,
44148
+ previousVersion: ef,
44146
44149
  targetVersion,
44147
44150
  callback: message.callback ?? null
44148
44151
  }),
@@ -44210,7 +44213,7 @@ ${result}`);
44210
44213
  });
44211
44214
  }
44212
44215
  }
44213
- client.sendAndWait(Hi.parse(message.body)).then((response) => {
44216
+ client.sendAndWait(Qi.parse(message.body)).then((response) => {
44214
44217
  this.log.info(`Response: ${response.toString().replaceAll("\r", "\n")}`);
44215
44218
  this.addToWebSocketQueue({
44216
44219
  type: "agent:transmit:response",
@@ -44279,7 +44282,7 @@ async function agentMain(argv) {
44279
44282
  const { baseUrl, clientId, clientSecret, agentId } = args;
44280
44283
  const medplum = new Nt({ baseUrl, clientId });
44281
44284
  await medplum.startClientLogin(clientId, clientSecret);
44282
- const app = new App(medplum, agentId, dm(args.logLevel ?? "INFO"));
44285
+ const app = new App(medplum, agentId, fm(args.logLevel ?? "INFO"));
44283
44286
  await app.start();
44284
44287
  process.on("SIGINT", async () => {
44285
44288
  console.log("Gracefully shutting down from SIGINT (Ctrl-C)");
@@ -44307,7 +44310,7 @@ async function upgraderMain(argv) {
44307
44310
  if ((0, import_node_os4.platform)() !== "win32") {
44308
44311
  throw new Error(`Unsupported platform: ${(0, import_node_os4.platform)()}. Agent upgrader currently only supports Windows`);
44309
44312
  }
44310
- const globalLogger = new Qi((msg) => console.log(msg));
44313
+ const globalLogger = new Ki((msg) => console.log(msg));
44311
44314
  if (!import_node_process2.default.send) {
44312
44315
  globalLogger.error("Upgrader not started as a child process with Node IPC enabled. Aborting...");
44313
44316
  import_node_process2.default.exit(1);
@@ -44320,10 +44323,10 @@ async function upgraderMain(argv) {
44320
44323
  });
44321
44324
  });
44322
44325
  import_node_process2.default.send({ type: "STARTED" });
44323
- if (argv[3] && !cc(argv[3])) {
44326
+ if (argv[3] && !uc(argv[3])) {
44324
44327
  throw new Error("Invalid version specified");
44325
44328
  }
44326
- const version = argv[3] ?? await wm();
44329
+ const version = argv[3] ?? await Am();
44327
44330
  const binPath = getReleaseBinPath(version);
44328
44331
  if (!(0, import_node_fs5.existsSync)(binPath)) {
44329
44332
  globalLogger.info(`Could not find binary at "${binPath}". Downloading release from GitHub...`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medplum/agent",
3
- "version": "3.2.23",
3
+ "version": "3.2.24",
4
4
  "description": "Medplum Agent",
5
5
  "homepage": "https://www.medplum.com/",
6
6
  "bugs": {
@@ -24,15 +24,15 @@
24
24
  "test": "jest"
25
25
  },
26
26
  "dependencies": {
27
- "@medplum/core": "3.2.23",
28
- "@medplum/hl7": "3.2.23",
27
+ "@medplum/core": "3.2.24",
28
+ "@medplum/hl7": "3.2.24",
29
29
  "dcmjs-dimse": "0.1.30",
30
30
  "iconv-lite": "0.6.3",
31
31
  "ws": "8.18.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@medplum/fhirtypes": "3.2.23",
35
- "@medplum/mock": "3.2.23",
34
+ "@medplum/fhirtypes": "3.2.24",
35
+ "@medplum/mock": "3.2.24",
36
36
  "@types/async-eventemitter": "0.2.4",
37
37
  "@types/ws": "8.5.13",
38
38
  "mock-socket": "9.3.1",