@medplum/agent 2.1.5 → 2.1.6

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.
@@ -878,6 +878,7 @@ var require_receiver = __commonJS({
878
878
  var { isValidStatusCode, isValidUTF8 } = require_validation();
879
879
  var FastBuffer = Buffer[Symbol.species];
880
880
  var promise = Promise.resolve();
881
+ var queueTask = typeof queueMicrotask === "function" ? queueMicrotask : queueMicrotaskShim;
881
882
  var GET_INFO = 0;
882
883
  var GET_PAYLOAD_LENGTH_16 = 1;
883
884
  var GET_PAYLOAD_LENGTH_64 = 2;
@@ -1006,7 +1007,7 @@ var require_receiver = __commonJS({
1006
1007
  return;
1007
1008
  default:
1008
1009
  this._loop = false;
1009
- promise.then(() => {
1010
+ queueTask(() => {
1010
1011
  this._state = GET_INFO;
1011
1012
  this.startLoop(cb);
1012
1013
  });
@@ -1403,6 +1404,15 @@ var require_receiver = __commonJS({
1403
1404
  err[kStatusCode] = statusCode;
1404
1405
  return err;
1405
1406
  }
1407
+ function queueMicrotaskShim(cb) {
1408
+ promise.then(cb).catch(throwErrorNextTick);
1409
+ }
1410
+ function throwError(err) {
1411
+ throw err;
1412
+ }
1413
+ function throwErrorNextTick(err) {
1414
+ process.nextTick(throwError, err);
1415
+ }
1406
1416
  }
1407
1417
  });
1408
1418
 
@@ -3538,76 +3548,135 @@ __export(main_exports, {
3538
3548
  module.exports = __toCommonJS(main_exports);
3539
3549
 
3540
3550
  // ../core/dist/esm/index.mjs
3541
- var Ze = "ok";
3542
- var et = "created";
3543
- var rt = "not-modified";
3544
- var nt = "not-found";
3545
- var he = "accepted";
3546
- var Ht = { resourceType: "OperationOutcome", id: nt, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
3547
- function O(r4, e) {
3548
- return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r4 }, expression: e ? [e] : void 0 }] };
3549
- }
3550
- function h(r4) {
3551
- return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "structure", details: { text: r4 } }] };
3552
- }
3553
- function ye(r4) {
3554
- return typeof r4 == "object" && r4 !== null && r4.resourceType === "OperationOutcome";
3555
- }
3556
- function it(r4) {
3557
- return r4.id === Ze || r4.id === et || r4.id === rt || r4.id === he;
3558
- }
3559
- var d = class extends Error {
3560
- constructor(t, n) {
3561
- super(Wt(t));
3562
- this.outcome = t, this.cause = n;
3551
+ var he = class {
3552
+ constructor(e, t) {
3553
+ this.operator = e;
3554
+ this.child = t;
3555
+ }
3556
+ toString() {
3557
+ return `${this.operator}(${this.child.toString()})`;
3558
+ }
3559
+ };
3560
+ var $ = class {
3561
+ constructor(e, t, n) {
3562
+ this.operator = e;
3563
+ this.left = t;
3564
+ this.right = n;
3565
+ }
3566
+ toString() {
3567
+ return `${this.left.toString()} ${this.operator} ${this.right.toString()}`;
3568
+ }
3569
+ };
3570
+ var ye = class {
3571
+ constructor() {
3572
+ this.prefixParselets = {};
3573
+ this.infixParselets = {};
3574
+ }
3575
+ registerInfix(e, t) {
3576
+ return this.infixParselets[e] = t, this;
3577
+ }
3578
+ registerPrefix(e, t) {
3579
+ return this.prefixParselets[e] = t, this;
3580
+ }
3581
+ prefix(e, t, n) {
3582
+ return this.registerPrefix(e, { parse(i2, o) {
3583
+ let s = i2.consumeAndParse(t);
3584
+ return n(o, s);
3585
+ } });
3586
+ }
3587
+ infixLeft(e, t, n) {
3588
+ return this.registerInfix(e, { parse(i2, o, s) {
3589
+ let a = i2.consumeAndParse(t);
3590
+ return n(o, s, a);
3591
+ }, precedence: t });
3592
+ }
3593
+ construct(e) {
3594
+ return new et(e, this.prefixParselets, this.infixParselets);
3595
+ }
3596
+ };
3597
+ var et = class {
3598
+ constructor(e, t, n) {
3599
+ this.tokens = e, this.prefixParselets = t, this.infixParselets = n;
3600
+ }
3601
+ hasMore() {
3602
+ return this.tokens.length > 0;
3603
+ }
3604
+ match(e) {
3605
+ return this.peek()?.id !== e ? false : (this.consume(), true);
3606
+ }
3607
+ consumeAndParse(e = 1 / 0) {
3608
+ let t = this.consume(), n = this.prefixParselets[t.id];
3609
+ if (!n)
3610
+ throw Error(`Parse error at "${t.value}" (line ${t.line}, column ${t.column}). No matching prefix parselet.`);
3611
+ let i2 = n.parse(this, t);
3612
+ for (; e > this.getPrecedence(); ) {
3613
+ let o = this.consume();
3614
+ i2 = this.getInfixParselet(o).parse(this, i2, o);
3615
+ }
3616
+ return i2;
3617
+ }
3618
+ getPrecedence() {
3619
+ let e = this.peek();
3620
+ if (!e)
3621
+ return 1 / 0;
3622
+ let t = this.getInfixParselet(e);
3623
+ return t ? t.precedence : 1 / 0;
3624
+ }
3625
+ consume(e, t) {
3626
+ if (!this.tokens.length)
3627
+ throw Error("Cant consume unknown more tokens.");
3628
+ if (e && this.peek()?.id !== e) {
3629
+ let n = this.peek();
3630
+ throw Error(`Expected ${e} but got "${n.id}" at line ${n.line} column ${n.column}.`);
3631
+ }
3632
+ if (t && this.peek()?.value !== t) {
3633
+ let n = this.peek();
3634
+ throw Error(`Expected "${t}" but got "${n.value}" at line ${n.line} column ${n.column}.`);
3635
+ }
3636
+ return this.tokens.shift();
3637
+ }
3638
+ peek() {
3639
+ return this.tokens.length > 0 ? this.tokens[0] : void 0;
3640
+ }
3641
+ removeComments() {
3642
+ this.tokens = this.tokens.filter((e) => e.id !== "Comment");
3643
+ }
3644
+ getInfixParselet(e) {
3645
+ return this.infixParselets[e.id === "Symbol" ? e.value : e.id];
3563
3646
  }
3564
3647
  };
3565
- function ot(r4) {
3566
- return r4 instanceof d ? r4.outcome : ye(r4) ? r4 : O(un(r4));
3567
- }
3568
- function un(r4) {
3569
- return r4 ? typeof r4 == "string" ? r4 : r4 instanceof Error ? r4.message : ye(r4) ? Wt(r4) : typeof r4 == "object" && "code" in r4 && typeof r4.code == "string" ? r4.code : JSON.stringify(r4) : "Unknown error";
3570
- }
3571
- function Wt(r4) {
3572
- let e = r4.issue?.map(ln) ?? [];
3573
- return e.length > 0 ? e.join("; ") : "Unknown error";
3574
- }
3575
- function ln(r4) {
3576
- let e;
3577
- return r4.details?.text ? r4.diagnostics ? e = `${r4.details.text} (${r4.diagnostics})` : e = r4.details.text : r4.diagnostics ? e = r4.diagnostics : e = "Unknown error", r4.expression?.length && (e += ` (${r4.expression.join(", ")})`), e;
3578
- }
3579
3648
  function K(r4) {
3580
- let e = Jt(r4), t = pn(r4);
3649
+ let e = $t(r4), t = ln(r4);
3581
3650
  return t === e ? { reference: e } : { reference: e, display: t };
3582
3651
  }
3583
- function Jt(r4) {
3652
+ function $t(r4) {
3584
3653
  return r4.resourceType + "/" + r4.id;
3585
3654
  }
3586
- function _o(r4) {
3655
+ function So(r4) {
3587
3656
  return r4?.reference?.split("/")[1];
3588
3657
  }
3589
- function dn(r4) {
3658
+ function un(r4) {
3590
3659
  return r4.resourceType === "Patient" || r4.resourceType === "Practitioner" || r4.resourceType === "RelatedPerson";
3591
3660
  }
3592
- function pn(r4) {
3593
- if (dn(r4)) {
3594
- let e = fn(r4);
3661
+ function ln(r4) {
3662
+ if (un(r4)) {
3663
+ let e = dn(r4);
3595
3664
  if (e)
3596
3665
  return e;
3597
3666
  }
3598
3667
  if (r4.resourceType === "Device") {
3599
- let e = mn(r4);
3668
+ let e = pn(r4);
3600
3669
  if (e)
3601
3670
  return e;
3602
3671
  }
3603
- return r4.resourceType === "Observation" && "code" in r4 && r4.code?.text ? r4.code.text : r4.resourceType === "User" && r4.email ? r4.email : "name" in r4 && r4.name && typeof r4.name == "string" ? r4.name : Jt(r4);
3672
+ return r4.resourceType === "Observation" && "code" in r4 && r4.code?.text ? r4.code.text : r4.resourceType === "User" && r4.email ? r4.email : "name" in r4 && r4.name && typeof r4.name == "string" ? r4.name : $t(r4);
3604
3673
  }
3605
- function fn(r4) {
3674
+ function dn(r4) {
3606
3675
  let e = r4.name;
3607
3676
  if (e && e.length > 0)
3608
3677
  return be(e[0]);
3609
3678
  }
3610
- function mn(r4) {
3679
+ function pn(r4) {
3611
3680
  let e = r4.deviceName;
3612
3681
  if (e && e.length > 0)
3613
3682
  return e[0].name;
@@ -3624,13 +3693,13 @@ function ge(r4, e) {
3624
3693
  let cn = Math.floor((n.getTime() - t.getTime()) / (1e3 * 60 * 60 * 24));
3625
3694
  return { years: p2, months: q, days: cn };
3626
3695
  }
3627
- function Zt(r4, e) {
3628
- return JSON.stringify(r4, hn, e ? 2 : void 0);
3696
+ function Qt(r4, e) {
3697
+ return JSON.stringify(r4, fn, e ? 2 : void 0);
3629
3698
  }
3630
- function hn(r4, e) {
3631
- return !yn(r4) && b(e) ? void 0 : e;
3699
+ function fn(r4, e) {
3700
+ return !mn(r4) && b(e) ? void 0 : e;
3632
3701
  }
3633
- function yn(r4) {
3702
+ function mn(r4) {
3634
3703
  return !!/\d+$/.exec(r4);
3635
3704
  }
3636
3705
  function b(r4) {
@@ -3639,19 +3708,19 @@ function b(r4) {
3639
3708
  let e = typeof r4;
3640
3709
  return e === "string" && r4 === "" || e === "object" && Object.keys(r4).length === 0;
3641
3710
  }
3642
- function er(r4) {
3711
+ function Wt(r4) {
3643
3712
  return r4.every((e) => typeof e == "string");
3644
3713
  }
3645
- var tr = [];
3714
+ var Gt = [];
3646
3715
  for (let r4 = 0; r4 < 256; r4++)
3647
- tr.push(r4.toString(16).padStart(2, "0"));
3648
- function rr(r4) {
3716
+ Gt.push(r4.toString(16).padStart(2, "0"));
3717
+ function Kt(r4) {
3649
3718
  let e = new Uint8Array(r4), t = new Array(e.length);
3650
3719
  for (let n = 0; n < e.length; n++)
3651
- t[n] = tr[e[n]];
3720
+ t[n] = Gt[e[n]];
3652
3721
  return t.join("");
3653
3722
  }
3654
- function nr(r4) {
3723
+ function zt(r4) {
3655
3724
  let e = new Uint8Array(r4), t = [];
3656
3725
  for (let n = 0; n < e.length; n++)
3657
3726
  t[n] = String.fromCharCode(e[n]);
@@ -3660,34 +3729,34 @@ function nr(r4) {
3660
3729
  function A(r4) {
3661
3730
  return r4.charAt(0).toUpperCase() + r4.substring(1);
3662
3731
  }
3663
- var ut = (r4) => new Promise((e) => {
3732
+ var nt = (r4) => new Promise((e) => {
3664
3733
  setTimeout(e, r4);
3665
3734
  });
3666
3735
  function be(r4, e) {
3667
3736
  let t = [];
3668
3737
  return r4.prefix && e?.prefix !== false && t.push(...r4.prefix), r4.given && t.push(...r4.given), r4.family && t.push(r4.family), r4.suffix && e?.suffix !== false && t.push(...r4.suffix), r4.use && (e?.all || e?.use) && t.push("[" + r4.use + "]"), t.length === 0 && r4.text ? r4.text : t.join(" ").trim();
3669
3738
  }
3670
- function Fn(r4) {
3739
+ function Un(r4) {
3671
3740
  let e = r4.max && r4.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : r4.max;
3672
3741
  return { path: "", description: "", type: r4.type ?? [], min: r4.min ?? 0, max: e ?? 1, isArray: !!e && e > 1, constraints: [] };
3673
3742
  }
3674
- function ar(r4) {
3743
+ function Zt(r4) {
3675
3744
  let e = /* @__PURE__ */ Object.create(null);
3676
3745
  for (let [t, n] of Object.entries(r4))
3677
- e[t] = { name: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i2, o]) => [i2, Fn(o)])), constraints: [], innerTypes: [] };
3746
+ e[t] = { name: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i2, o]) => [i2, Un(o)])), constraints: [], innerTypes: [] };
3678
3747
  return e;
3679
3748
  }
3680
- var cr = { Element: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, BackboneElement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, Address: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: 9007199254740991, type: [{ code: "string" }] }, city: { type: [{ code: "string" }] }, district: { type: [{ code: "string" }] }, state: { type: [{ code: "string" }] }, postalCode: { type: [{ code: "string" }] }, country: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Age: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "author[x]": { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Organization"] }, { code: "string" }] }, time: { type: [{ code: "dateTime" }] }, text: { min: 1, type: [{ code: "markdown" }] } } }, Attachment: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, contentType: { type: [{ code: "code" }] }, language: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] }, url: { type: [{ code: "url" }] }, size: { type: [{ code: "unsignedInt" }] }, hash: { type: [{ code: "base64Binary" }] }, title: { type: [{ code: "string" }] }, creation: { type: [{ code: "dateTime" }] } } }, CodeableConcept: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, coding: { max: 9007199254740991, type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: 9007199254740991, type: [{ code: "ContactPoint" }] } } }, ContactPoint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] } } }, Count: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, "subject[x]": { type: [{ code: "CodeableConcept" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Group"] }] }, mustSupport: { max: 9007199254740991, type: [{ code: "string" }] }, codeFilter: { max: 9007199254740991, type: [{ code: "DataRequirementCodeFilter" }] }, dateFilter: { max: 9007199254740991, type: [{ code: "DataRequirementDateFilter" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: 9007199254740991, type: [{ code: "DataRequirementSort" }] } } }, Distance: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] }, patientInstruction: { type: [{ code: "string" }] }, timing: { type: [{ code: "Timing" }] }, "asNeeded[x]": { type: [{ code: "boolean" }, { code: "CodeableConcept" }] }, site: { type: [{ code: "CodeableConcept" }] }, route: { type: [{ code: "CodeableConcept" }] }, method: { type: [{ code: "CodeableConcept" }] }, doseAndRate: { max: 9007199254740991, type: [{ code: "DosageDoseAndRate" }] }, maxDosePerPeriod: { type: [{ code: "Ratio" }] }, maxDosePerAdministration: { type: [{ code: "Quantity" }] }, maxDosePerLifetime: { type: [{ code: "Quantity" }] } } }, Duration: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: 9007199254740991, type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] }, slicing: { type: [{ code: "ElementDefinitionSlicing" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: 9007199254740991, type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "ElementDefinitionBase" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: 9007199254740991, type: [{ code: "ElementDefinitionType" }] }, "defaultValue[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, meaningWhenMissing: { type: [{ code: "markdown" }] }, orderMeaning: { type: [{ code: "string" }] }, "fixed[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, "pattern[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, example: { max: 9007199254740991, type: [{ code: "ElementDefinitionExample" }] }, "minValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, "maxValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, maxLength: { type: [{ code: "integer" }] }, condition: { max: 9007199254740991, type: [{ code: "id" }] }, constraint: { max: 9007199254740991, type: [{ code: "ElementDefinitionConstraint" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "ElementDefinitionBinding" }] }, mapping: { max: 9007199254740991, type: [{ code: "ElementDefinitionMapping" }] } } }, Expression: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, description: { type: [{ code: "string" }] }, name: { type: [{ code: "id" }] }, language: { min: 1, type: [{ code: "code" }] }, expression: { type: [{ code: "string" }] }, reference: { type: [{ code: "uri" }] } } }, Extension: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "string" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: 9007199254740991, type: [{ code: "string" }] }, prefix: { max: 9007199254740991, type: [{ code: "string" }] }, suffix: { max: 9007199254740991, type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "CodeableConcept" }] }, system: { type: [{ code: "uri" }] }, value: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] }, assigner: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MarketingStatus: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, country: { min: 1, type: [{ code: "CodeableConcept" }] }, jurisdiction: { type: [{ code: "CodeableConcept" }] }, status: { min: 1, type: [{ code: "CodeableConcept" }] }, dateRange: { min: 1, type: [{ code: "Period" }] }, restoreDate: { type: [{ code: "dateTime" }] } } }, Meta: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: 9007199254740991, type: [{ code: "Coding" }] }, tag: { max: 9007199254740991, type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, compartment: { max: 9007199254740991, type: [{ code: "Reference" }] } } }, Money: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "code" }] }, use: { min: 1, type: [{ code: "code" }] }, min: { type: [{ code: "integer" }] }, max: { type: [{ code: "string" }] }, documentation: { type: [{ code: "string" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, Period: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, height: { type: [{ code: "Quantity" }] }, width: { type: [{ code: "Quantity" }] }, depth: { type: [{ code: "Quantity" }] }, weight: { type: [{ code: "Quantity" }] }, nominalVolume: { type: [{ code: "Quantity" }] }, externalDiameter: { type: [{ code: "Quantity" }] }, shape: { type: [{ code: "string" }] }, color: { max: 9007199254740991, type: [{ code: "string" }] }, imprint: { max: 9007199254740991, type: [{ code: "string" }] }, image: { max: 9007199254740991, type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, Quantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Range: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, low: { type: [{ code: "Quantity" }] }, high: { type: [{ code: "Quantity" }] } } }, Ratio: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, label: { type: [{ code: "string" }] }, display: { type: [{ code: "string" }] }, citation: { type: [{ code: "markdown" }] }, url: { type: [{ code: "url" }] }, document: { type: [{ code: "Attachment" }] }, resource: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Resource"] }] } } }, SampledData: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, origin: { min: 1, type: [{ code: "Quantity" }] }, period: { min: 1, type: [{ code: "decimal" }] }, factor: { type: [{ code: "decimal" }] }, lowerLimit: { type: [{ code: "decimal" }] }, upperLimit: { type: [{ code: "decimal" }] }, dimensions: { min: 1, type: [{ code: "positiveInt" }] }, data: { type: [{ code: "string" }] } } }, Signature: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, max: 9007199254740991, type: [{ code: "Coding" }] }, when: { min: 1, type: [{ code: "instant" }] }, who: { min: 1, type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, onBehalfOf: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, targetFormat: { type: [{ code: "code" }] }, sigFormat: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] } } }, SubstanceAmount: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "SubstanceAmountReferenceRange" }] } } }, Timing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, event: { max: 9007199254740991, type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "TimingRepeat" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TriggerDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { type: [{ code: "string" }] }, "timing[x]": { type: [{ code: "Timing" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Schedule"] }, { code: "date" }, { code: "dateTime" }] }, data: { max: 9007199254740991, type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "Coding" }] }, "value[x]": { min: 1, type: [{ code: "CodeableConcept" }, { code: "Quantity" }, { code: "Range" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/PlanDefinition", "http://hl7.org/fhir/StructureDefinition/ResearchStudy", "http://hl7.org/fhir/StructureDefinition/InsurancePlan", "http://hl7.org/fhir/StructureDefinition/HealthcareService", "http://hl7.org/fhir/StructureDefinition/Group", "http://hl7.org/fhir/StructureDefinition/Location", "http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MoneyQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, SimpleQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { max: 0, type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, MetadataResource: { elements: { id: { type: [{ code: "string" }] }, meta: { type: [{ code: "Meta" }] }, implicitRules: { type: [{ code: "uri" }] }, language: { type: [{ code: "code" }] }, text: { type: [{ code: "Narrative" }] }, contained: { max: 9007199254740991, type: [{ code: "Resource" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, name: { type: [{ code: "string" }] }, title: { type: [{ code: "string" }] }, status: { min: 1, type: [{ code: "code" }] }, experimental: { type: [{ code: "boolean" }] }, date: { type: [{ code: "dateTime" }] }, publisher: { type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] }, description: { type: [{ code: "markdown" }] }, useContext: { max: 9007199254740991, type: [{ code: "UsageContext" }] }, jurisdiction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, IdentityProvider: { elements: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, useSubject: { type: [{ code: "boolean" }] } } } };
3749
+ var er = { Element: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, BackboneElement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, Address: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: 9007199254740991, type: [{ code: "string" }] }, city: { type: [{ code: "string" }] }, district: { type: [{ code: "string" }] }, state: { type: [{ code: "string" }] }, postalCode: { type: [{ code: "string" }] }, country: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Age: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "author[x]": { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Organization"] }, { code: "string" }] }, time: { type: [{ code: "dateTime" }] }, text: { min: 1, type: [{ code: "markdown" }] } } }, Attachment: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, contentType: { type: [{ code: "code" }] }, language: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] }, url: { type: [{ code: "url" }] }, size: { type: [{ code: "unsignedInt" }] }, hash: { type: [{ code: "base64Binary" }] }, title: { type: [{ code: "string" }] }, creation: { type: [{ code: "dateTime" }] } } }, CodeableConcept: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, coding: { max: 9007199254740991, type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: 9007199254740991, type: [{ code: "ContactPoint" }] } } }, ContactPoint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] } } }, Count: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, "subject[x]": { type: [{ code: "CodeableConcept" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Group"] }] }, mustSupport: { max: 9007199254740991, type: [{ code: "string" }] }, codeFilter: { max: 9007199254740991, type: [{ code: "DataRequirementCodeFilter" }] }, dateFilter: { max: 9007199254740991, type: [{ code: "DataRequirementDateFilter" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: 9007199254740991, type: [{ code: "DataRequirementSort" }] } } }, Distance: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] }, patientInstruction: { type: [{ code: "string" }] }, timing: { type: [{ code: "Timing" }] }, "asNeeded[x]": { type: [{ code: "boolean" }, { code: "CodeableConcept" }] }, site: { type: [{ code: "CodeableConcept" }] }, route: { type: [{ code: "CodeableConcept" }] }, method: { type: [{ code: "CodeableConcept" }] }, doseAndRate: { max: 9007199254740991, type: [{ code: "DosageDoseAndRate" }] }, maxDosePerPeriod: { type: [{ code: "Ratio" }] }, maxDosePerAdministration: { type: [{ code: "Quantity" }] }, maxDosePerLifetime: { type: [{ code: "Quantity" }] } } }, Duration: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: 9007199254740991, type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] }, slicing: { type: [{ code: "ElementDefinitionSlicing" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: 9007199254740991, type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "ElementDefinitionBase" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: 9007199254740991, type: [{ code: "ElementDefinitionType" }] }, "defaultValue[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, meaningWhenMissing: { type: [{ code: "markdown" }] }, orderMeaning: { type: [{ code: "string" }] }, "fixed[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, "pattern[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, example: { max: 9007199254740991, type: [{ code: "ElementDefinitionExample" }] }, "minValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, "maxValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, maxLength: { type: [{ code: "integer" }] }, condition: { max: 9007199254740991, type: [{ code: "id" }] }, constraint: { max: 9007199254740991, type: [{ code: "ElementDefinitionConstraint" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "ElementDefinitionBinding" }] }, mapping: { max: 9007199254740991, type: [{ code: "ElementDefinitionMapping" }] } } }, Expression: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, description: { type: [{ code: "string" }] }, name: { type: [{ code: "id" }] }, language: { min: 1, type: [{ code: "code" }] }, expression: { type: [{ code: "string" }] }, reference: { type: [{ code: "uri" }] } } }, Extension: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "string" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: 9007199254740991, type: [{ code: "string" }] }, prefix: { max: 9007199254740991, type: [{ code: "string" }] }, suffix: { max: 9007199254740991, type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "CodeableConcept" }] }, system: { type: [{ code: "uri" }] }, value: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] }, assigner: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MarketingStatus: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, country: { min: 1, type: [{ code: "CodeableConcept" }] }, jurisdiction: { type: [{ code: "CodeableConcept" }] }, status: { min: 1, type: [{ code: "CodeableConcept" }] }, dateRange: { min: 1, type: [{ code: "Period" }] }, restoreDate: { type: [{ code: "dateTime" }] } } }, Meta: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: 9007199254740991, type: [{ code: "Coding" }] }, tag: { max: 9007199254740991, type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, compartment: { max: 9007199254740991, type: [{ code: "Reference" }] } } }, Money: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "code" }] }, use: { min: 1, type: [{ code: "code" }] }, min: { type: [{ code: "integer" }] }, max: { type: [{ code: "string" }] }, documentation: { type: [{ code: "string" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, Period: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, height: { type: [{ code: "Quantity" }] }, width: { type: [{ code: "Quantity" }] }, depth: { type: [{ code: "Quantity" }] }, weight: { type: [{ code: "Quantity" }] }, nominalVolume: { type: [{ code: "Quantity" }] }, externalDiameter: { type: [{ code: "Quantity" }] }, shape: { type: [{ code: "string" }] }, color: { max: 9007199254740991, type: [{ code: "string" }] }, imprint: { max: 9007199254740991, type: [{ code: "string" }] }, image: { max: 9007199254740991, type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, Quantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Range: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, low: { type: [{ code: "Quantity" }] }, high: { type: [{ code: "Quantity" }] } } }, Ratio: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, label: { type: [{ code: "string" }] }, display: { type: [{ code: "string" }] }, citation: { type: [{ code: "markdown" }] }, url: { type: [{ code: "url" }] }, document: { type: [{ code: "Attachment" }] }, resource: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Resource"] }] } } }, SampledData: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, origin: { min: 1, type: [{ code: "Quantity" }] }, period: { min: 1, type: [{ code: "decimal" }] }, factor: { type: [{ code: "decimal" }] }, lowerLimit: { type: [{ code: "decimal" }] }, upperLimit: { type: [{ code: "decimal" }] }, dimensions: { min: 1, type: [{ code: "positiveInt" }] }, data: { type: [{ code: "string" }] } } }, Signature: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, max: 9007199254740991, type: [{ code: "Coding" }] }, when: { min: 1, type: [{ code: "instant" }] }, who: { min: 1, type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, onBehalfOf: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, targetFormat: { type: [{ code: "code" }] }, sigFormat: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] } } }, SubstanceAmount: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "SubstanceAmountReferenceRange" }] } } }, Timing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, event: { max: 9007199254740991, type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "TimingRepeat" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TriggerDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { type: [{ code: "string" }] }, "timing[x]": { type: [{ code: "Timing" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Schedule"] }, { code: "date" }, { code: "dateTime" }] }, data: { max: 9007199254740991, type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "Coding" }] }, "value[x]": { min: 1, type: [{ code: "CodeableConcept" }, { code: "Quantity" }, { code: "Range" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/PlanDefinition", "http://hl7.org/fhir/StructureDefinition/ResearchStudy", "http://hl7.org/fhir/StructureDefinition/InsurancePlan", "http://hl7.org/fhir/StructureDefinition/HealthcareService", "http://hl7.org/fhir/StructureDefinition/Group", "http://hl7.org/fhir/StructureDefinition/Location", "http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MoneyQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, SimpleQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { max: 0, type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, MetadataResource: { elements: { id: { type: [{ code: "string" }] }, meta: { type: [{ code: "Meta" }] }, implicitRules: { type: [{ code: "uri" }] }, language: { type: [{ code: "code" }] }, text: { type: [{ code: "Narrative" }] }, contained: { max: 9007199254740991, type: [{ code: "Resource" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, name: { type: [{ code: "string" }] }, title: { type: [{ code: "string" }] }, status: { min: 1, type: [{ code: "code" }] }, experimental: { type: [{ code: "boolean" }] }, date: { type: [{ code: "dateTime" }] }, publisher: { type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] }, description: { type: [{ code: "markdown" }] }, useContext: { max: 9007199254740991, type: [{ code: "UsageContext" }] }, jurisdiction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, IdentityProvider: { elements: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, useSubject: { type: [{ code: "boolean" }] } } } };
3681
3750
  function l(r4) {
3682
3751
  return [{ type: u.boolean, value: r4 }];
3683
3752
  }
3684
3753
  function T(r4) {
3685
- return r4 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r4) ? { type: u.integer, value: r4 } : typeof r4 == "number" ? { type: u.decimal, value: r4 } : typeof r4 == "boolean" ? { type: u.boolean, value: r4 } : typeof r4 == "string" ? { type: u.string, value: r4 } : R(r4) ? { type: u.Quantity, value: r4 } : _(r4) ? { type: r4.resourceType, value: r4 } : { type: u.BackboneElement, value: r4 };
3754
+ return r4 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r4) ? { type: u.integer, value: r4 } : typeof r4 == "number" ? { type: u.decimal, value: r4 } : typeof r4 == "boolean" ? { type: u.boolean, value: r4 } : typeof r4 == "string" ? { type: u.string, value: r4 } : R(r4) ? { type: u.Quantity, value: r4 } : V(r4) ? { type: r4.resourceType, value: r4 } : { type: u.BackboneElement, value: r4 };
3686
3755
  }
3687
3756
  function N(r4) {
3688
3757
  return r4.length === 0 ? false : !!r4[0].value;
3689
3758
  }
3690
- function V(r4, e) {
3759
+ function D(r4, e) {
3691
3760
  if (r4.length !== 0) {
3692
3761
  if (r4.length === 1 && (!e || r4[0].type === e))
3693
3762
  return r4[0];
@@ -3698,9 +3767,9 @@ function w(r4, e) {
3698
3767
  if (!r4.value)
3699
3768
  return;
3700
3769
  let t = Ae(r4.type, e);
3701
- return t ? Mn(r4, e, t) : Bn(r4, e);
3770
+ return t ? Fn(r4, e, t) : Nn(r4, e);
3702
3771
  }
3703
- function Mn(r4, e, t) {
3772
+ function Fn(r4, e, t) {
3704
3773
  let n = t.type;
3705
3774
  if (!n || n.length === 0)
3706
3775
  return;
@@ -3716,13 +3785,13 @@ function Mn(r4, e, t) {
3716
3785
  }
3717
3786
  }
3718
3787
  let s = r4.value["_" + e];
3719
- if (s && (Array.isArray(i2) ? i2 = i2.map((a, c2) => s[c2] ? pr(a ?? {}, s[c2]) : a) : i2 = pr(i2 ?? {}, s)), !b(i2))
3720
- return (o === "Element" || o === "BackboneElement") && (o = t.type[0].code), Array.isArray(i2) ? i2.map((a) => ur(a, o)) : ur(i2, o);
3788
+ if (s && (Array.isArray(i2) ? i2 = i2.map((a, c2) => s[c2] ? ir(a ?? {}, s[c2]) : a) : i2 = ir(i2 ?? {}, s)), !b(i2))
3789
+ return (o === "Element" || o === "BackboneElement") && (o = t.type[0].code), Array.isArray(i2) ? i2.map((a) => tr(a, o)) : tr(i2, o);
3721
3790
  }
3722
- function ur(r4, e) {
3723
- return e === "Resource" && _(r4) && (e = r4.resourceType), { type: e, value: r4 };
3791
+ function tr(r4, e) {
3792
+ return e === "Resource" && V(r4) && (e = r4.resourceType), { type: e, value: r4 };
3724
3793
  }
3725
- function Bn(r4, e) {
3794
+ function Nn(r4, e) {
3726
3795
  let t = r4.value;
3727
3796
  if (!t || typeof t != "object")
3728
3797
  return;
@@ -3745,7 +3814,7 @@ function Re(r4) {
3745
3814
  for (let t of r4) {
3746
3815
  let n = false;
3747
3816
  for (let i2 of e)
3748
- if (N(fr(t, i2))) {
3817
+ if (N(or(t, i2))) {
3749
3818
  n = true;
3750
3819
  break;
3751
3820
  }
@@ -3753,24 +3822,24 @@ function Re(r4) {
3753
3822
  }
3754
3823
  return e;
3755
3824
  }
3756
- function pt(r4) {
3825
+ function st(r4) {
3757
3826
  return l(!N(r4));
3758
3827
  }
3759
- function ft(r4, e) {
3760
- return r4.length === 0 || e.length === 0 ? [] : r4.length !== e.length ? l(false) : l(r4.every((t, n) => N(fr(t, e[n]))));
3828
+ function at(r4, e) {
3829
+ return r4.length === 0 || e.length === 0 ? [] : r4.length !== e.length ? l(false) : l(r4.every((t, n) => N(or(t, e[n]))));
3761
3830
  }
3762
- function fr(r4, e) {
3831
+ function or(r4, e) {
3763
3832
  let t = r4.value?.valueOf(), n = e.value?.valueOf();
3764
- return typeof t == "number" && typeof n == "number" ? l(Math.abs(t - n) < 1e-8) : R(t) && R(n) ? l(mr(t, n)) : l(typeof t == "object" && typeof n == "object" ? ht(r4, e) : t === n);
3833
+ return typeof t == "number" && typeof n == "number" ? l(Math.abs(t - n) < 1e-8) : R(t) && R(n) ? l(sr(t, n)) : l(typeof t == "object" && typeof n == "object" ? ut(r4, e) : t === n);
3765
3834
  }
3766
- function mt(r4, e) {
3767
- return r4.length === 0 && e.length === 0 ? l(true) : r4.length !== e.length ? l(false) : (r4.sort(lr), e.sort(lr), l(r4.every((t, n) => N(qn(t, e[n])))));
3835
+ function ct(r4, e) {
3836
+ return r4.length === 0 && e.length === 0 ? l(true) : r4.length !== e.length ? l(false) : (r4.sort(rr), e.sort(rr), l(r4.every((t, n) => N(Mn(t, e[n])))));
3768
3837
  }
3769
- function qn(r4, e) {
3838
+ function Mn(r4, e) {
3770
3839
  let { type: t, value: n } = r4, { type: i2, value: o } = e, s = n?.valueOf(), a = o?.valueOf();
3771
- return typeof s == "number" && typeof a == "number" ? l(Math.abs(s - a) < 0.01) : R(s) && R(a) ? l(mr(s, a)) : l(t === "Coding" && i2 === "Coding" ? typeof s != "object" || typeof a != "object" ? false : s.code === a.code && s.system === a.system : typeof s == "object" && typeof a == "object" ? ht({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
3840
+ return typeof s == "number" && typeof a == "number" ? l(Math.abs(s - a) < 0.01) : R(s) && R(a) ? l(sr(s, a)) : l(t === "Coding" && i2 === "Coding" ? typeof s != "object" || typeof a != "object" ? false : s.code === a.code && s.system === a.system : typeof s == "object" && typeof a == "object" ? ut({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
3772
3841
  }
3773
- function lr(r4, e) {
3842
+ function rr(r4, e) {
3774
3843
  let t = r4.value?.valueOf(), n = e.value?.valueOf();
3775
3844
  return typeof t == "number" && typeof n == "number" ? t - n : typeof t == "string" && typeof n == "string" ? t.localeCompare(n) : 0;
3776
3845
  }
@@ -3791,46 +3860,84 @@ function Ee(r4, e) {
3791
3860
  case "Time":
3792
3861
  return typeof t == "string" && !!/^T\d/.exec(t);
3793
3862
  case "Period":
3794
- return $n(t);
3863
+ return Bn(t);
3795
3864
  case "Quantity":
3796
3865
  return R(t);
3797
3866
  default:
3798
3867
  return typeof t == "object" && t?.resourceType === e;
3799
3868
  }
3800
3869
  }
3801
- function $n(r4) {
3870
+ function Bn(r4) {
3802
3871
  return !!(r4 && typeof r4 == "object" && "start" in r4);
3803
3872
  }
3804
3873
  function R(r4) {
3805
3874
  return !!(r4 && typeof r4 == "object" && "value" in r4 && typeof r4.value == "number");
3806
3875
  }
3807
- function mr(r4, e) {
3876
+ function sr(r4, e) {
3808
3877
  return Math.abs(r4.value - e.value) < 0.01 && (r4.unit === e.unit || r4.code === e.code || r4.unit === e.code || r4.code === e.unit);
3809
3878
  }
3810
- function ht(r4, e) {
3879
+ function ut(r4, e) {
3811
3880
  let t = Object.keys(r4), n = Object.keys(e);
3812
3881
  if (t.length !== n.length)
3813
3882
  return false;
3814
3883
  for (let i2 of t) {
3815
3884
  let o = r4[i2], s = e[i2];
3816
- if (dr(o) && dr(s)) {
3817
- if (!ht(o, s))
3885
+ if (nr(o) && nr(s)) {
3886
+ if (!ut(o, s))
3818
3887
  return false;
3819
3888
  } else if (o !== s)
3820
3889
  return false;
3821
3890
  }
3822
3891
  return true;
3823
3892
  }
3824
- function dr(r4) {
3893
+ function nr(r4) {
3825
3894
  return r4 !== null && typeof r4 == "object";
3826
3895
  }
3827
- function pr(r4, e) {
3896
+ function ir(r4, e) {
3828
3897
  return delete e.__proto__, delete e.constructor, Object.assign(r4, e);
3829
3898
  }
3830
- function Tt(r4) {
3831
- return new gt(r4).parse();
3899
+ var lt = "ok";
3900
+ var Pe = "created";
3901
+ var pt = "not-modified";
3902
+ var ft = "not-found";
3903
+ var Ce = "accepted";
3904
+ var lr = { resourceType: "OperationOutcome", id: ft, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
3905
+ function _(r4, e) {
3906
+ return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r4 }, expression: e ? [e] : void 0 }] };
3907
+ }
3908
+ function h(r4) {
3909
+ return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "structure", details: { text: r4 } }] };
3832
3910
  }
3833
- var j = ar(cr);
3911
+ function we(r4) {
3912
+ return typeof r4 == "object" && r4 !== null && r4.resourceType === "OperationOutcome";
3913
+ }
3914
+ function mt(r4) {
3915
+ return r4.id === lt || r4.id === Pe || r4.id === pt || r4.id === Ce;
3916
+ }
3917
+ var d = class extends Error {
3918
+ constructor(t, n) {
3919
+ super(pr(t));
3920
+ this.outcome = t, this.cause = n;
3921
+ }
3922
+ };
3923
+ function ht(r4) {
3924
+ return r4 instanceof d ? r4.outcome : we(r4) ? r4 : _(qn(r4));
3925
+ }
3926
+ function qn(r4) {
3927
+ return r4 ? typeof r4 == "string" ? r4 : r4 instanceof Error ? r4.message : we(r4) ? pr(r4) : typeof r4 == "object" && "code" in r4 && typeof r4.code == "string" ? r4.code : JSON.stringify(r4) : "Unknown error";
3928
+ }
3929
+ function pr(r4) {
3930
+ let e = r4.issue?.map($n) ?? [];
3931
+ return e.length > 0 ? e.join("; ") : "Unknown error";
3932
+ }
3933
+ function $n(r4) {
3934
+ let e;
3935
+ return r4.details?.text ? r4.diagnostics ? e = `${r4.details.text} (${r4.diagnostics})` : e = r4.details.text : r4.diagnostics ? e = r4.diagnostics : e = "Unknown error", r4.expression?.length && (e += ` (${r4.expression.join(", ")})`), e;
3936
+ }
3937
+ function vt(r4) {
3938
+ return new xt(r4).parse();
3939
+ }
3940
+ var H = Zt(er);
3834
3941
  function xr(r4) {
3835
3942
  let e = Array.isArray(r4) ? r4 : r4.entry?.map((t) => t.resource) ?? [];
3836
3943
  for (let t of e)
@@ -3841,18 +3948,18 @@ function jn(r4) {
3841
3948
  throw new Error("Failed loading StructureDefinition from bundle");
3842
3949
  if (r4.resourceType !== "StructureDefinition")
3843
3950
  return;
3844
- let e = Tt(r4);
3845
- j[r4.name] = e;
3951
+ let e = vt(r4);
3952
+ H[r4.name] = e;
3846
3953
  for (let t of e.innerTypes)
3847
- t.parentType = e, j[t.name] = t;
3954
+ t.parentType = e, H[t.name] = t;
3848
3955
  }
3849
3956
  function vr(r4) {
3850
- return !!j[r4];
3957
+ return !!H[r4];
3851
3958
  }
3852
3959
  function Sr(r4) {
3853
- return j[r4];
3960
+ return H[r4];
3854
3961
  }
3855
- var gt = class {
3962
+ var xt = class {
3856
3963
  constructor(e) {
3857
3964
  if (!e.snapshot?.element || e.snapshot.element.length === 0)
3858
3965
  throw new Error(`No snapshot defined for StructureDefinition '${e.name}'`);
@@ -3865,7 +3972,7 @@ var gt = class {
3865
3972
  this.parseSliceStart(e);
3866
3973
  else if (e.id?.includes(":")) {
3867
3974
  if (this.slicingContext?.current) {
3868
- let t = yt(e, this.slicingContext.path);
3975
+ let t = gt(e, this.slicingContext.path);
3869
3976
  this.slicingContext.current.elements[t] = this.parseElementDefinition(e);
3870
3977
  }
3871
3978
  } else {
@@ -3874,13 +3981,13 @@ var gt = class {
3874
3981
  let n = this.backboneContext;
3875
3982
  for (; n; ) {
3876
3983
  if (e.path?.startsWith(n.path + ".")) {
3877
- n.type.elements[yt(e, n.path)] = t;
3984
+ n.type.elements[gt(e, n.path)] = t;
3878
3985
  break;
3879
3986
  }
3880
3987
  n = n.parent;
3881
3988
  }
3882
3989
  if (!n) {
3883
- let i2 = yt(e, this.root.path);
3990
+ let i2 = gt(e, this.root.path);
3884
3991
  e.isSummary && this.resourceSchema.summaryProperties?.add(i2.replace("[x]", "")), t.min > 0 && this.resourceSchema.mandatoryProperties?.add(i2.replace("[x]", "")), this.resourceSchema.elements[i2] = t;
3885
3992
  }
3886
3993
  this.checkFieldExit(e);
@@ -3895,7 +4002,7 @@ var gt = class {
3895
4002
  enterInnerType(e) {
3896
4003
  for (; this.backboneContext && !ee(this.backboneContext?.path, e.path); )
3897
4004
  this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
3898
- this.backboneContext = { type: { name: xt(e), description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path ?? "", parent: ee(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
4005
+ this.backboneContext = { type: { name: Tt(e), description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path ?? "", parent: ee(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
3899
4006
  }
3900
4007
  enterSlice(e, t) {
3901
4008
  Wn(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
@@ -3940,13 +4047,13 @@ var gt = class {
3940
4047
  }
3941
4048
  parseElementDefinition(e) {
3942
4049
  let t = yr(e.max), n = e.base?.max ? yr(e.base.max) : t, i2 = { type: "ElementDefinition", value: e };
3943
- return { description: e.definition || "", path: e.path || e.base?.path || "", min: e.min ?? 0, max: t, isArray: n > 1, constraints: (e.constraint ?? []).map((o) => ({ key: o.key ?? "", severity: o.severity ?? "error", expression: o.expression ?? "", description: o.human ?? "" })), type: (e.type ?? []).map((o) => ({ code: ["BackboneElement", "Element"].includes(o.code) ? xt(e) : o.code ?? "", targetProfile: o.targetProfile })), fixed: gr(w(i2, "fixed")), pattern: gr(w(i2, "pattern")), binding: e.binding };
4050
+ return { description: e.definition || "", path: e.path || e.base?.path || "", min: e.min ?? 0, max: t, isArray: n > 1, constraints: (e.constraint ?? []).map((o) => ({ key: o.key ?? "", severity: o.severity ?? "error", expression: o.expression ?? "", description: o.human ?? "" })), type: (e.type ?? []).map((o) => ({ code: ["BackboneElement", "Element"].includes(o.code) ? Tt(e) : o.code ?? "", targetProfile: o.targetProfile })), fixed: gr(w(i2, "fixed")), pattern: gr(w(i2, "pattern")), binding: e.binding };
3944
4051
  }
3945
4052
  };
3946
4053
  function yr(r4) {
3947
4054
  return r4 === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(r4, 10);
3948
4055
  }
3949
- function yt(r4, e = "") {
4056
+ function gt(r4, e = "") {
3950
4057
  return Qn(r4.path, e);
3951
4058
  }
3952
4059
  function Qn(r4, e) {
@@ -3963,13 +4070,13 @@ function Wn(r4) {
3963
4070
  return !!(r4.type?.some((t) => t.code === "Extension") && e?.length === 1 && e[0].type === "value" && e[0].path === "url");
3964
4071
  }
3965
4072
  var u = { 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" };
3966
- function St(r4) {
4073
+ function bt(r4) {
3967
4074
  for (let e of r4.base ?? []) {
3968
4075
  let t = I.types[e];
3969
4076
  t || (t = { searchParamsDetails: {} }, I.types[e] = t), t.searchParams || (t.searchParams = { _id: { base: [e], code: "_id", type: "token", expression: e + ".id" }, _lastUpdated: { base: [e], code: "_lastUpdated", type: "date", expression: e + ".meta.lastUpdated" }, _compartment: { base: [e], code: "_compartment", type: "reference", expression: e + ".meta.compartment" }, _profile: { base: [e], code: "_profile", type: "uri", expression: e + ".meta.profile" }, _security: { base: [e], code: "_security", type: "token", expression: e + ".meta.security" }, _source: { base: [e], code: "_source", type: "uri", expression: e + ".meta.source" }, _tag: { base: [e], code: "_tag", type: "token", expression: e + ".meta.tag" } }), t.searchParams[r4.code] = r4;
3970
4077
  }
3971
4078
  }
3972
- function xt(r4) {
4079
+ function Tt(r4) {
3973
4080
  let e = r4.type?.[0]?.code;
3974
4081
  return e === "BackboneElement" || e === "Element" ? Gn((r4.base?.path ?? r4.path)?.split(".")) : e;
3975
4082
  }
@@ -3981,107 +4088,10 @@ function Ae(r4, e) {
3981
4088
  if (t)
3982
4089
  return t.elements[e] ?? t.elements[e + "[x]"];
3983
4090
  }
3984
- function _(r4) {
4091
+ function V(r4) {
3985
4092
  return !!(r4 && typeof r4 == "object" && "resourceType" in r4);
3986
4093
  }
3987
4094
  var I = { types: {} };
3988
- var Pe = class {
3989
- constructor(e, t) {
3990
- this.operator = e;
3991
- this.child = t;
3992
- }
3993
- toString() {
3994
- return `${this.operator}(${this.child.toString()})`;
3995
- }
3996
- };
3997
- var H = class {
3998
- constructor(e, t, n) {
3999
- this.operator = e;
4000
- this.left = t;
4001
- this.right = n;
4002
- }
4003
- toString() {
4004
- return `${this.left.toString()} ${this.operator} ${this.right.toString()}`;
4005
- }
4006
- };
4007
- var Ce = class {
4008
- constructor() {
4009
- this.prefixParselets = {};
4010
- this.infixParselets = {};
4011
- }
4012
- registerInfix(e, t) {
4013
- return this.infixParselets[e] = t, this;
4014
- }
4015
- registerPrefix(e, t) {
4016
- return this.prefixParselets[e] = t, this;
4017
- }
4018
- prefix(e, t, n) {
4019
- return this.registerPrefix(e, { parse(i2, o) {
4020
- let s = i2.consumeAndParse(t);
4021
- return n(o, s);
4022
- } });
4023
- }
4024
- infixLeft(e, t, n) {
4025
- return this.registerInfix(e, { parse(i2, o, s) {
4026
- let a = i2.consumeAndParse(t);
4027
- return n(o, s, a);
4028
- }, precedence: t });
4029
- }
4030
- construct(e) {
4031
- return new bt(e, this.prefixParselets, this.infixParselets);
4032
- }
4033
- };
4034
- var bt = class {
4035
- constructor(e, t, n) {
4036
- this.tokens = e, this.prefixParselets = t, this.infixParselets = n;
4037
- }
4038
- hasMore() {
4039
- return this.tokens.length > 0;
4040
- }
4041
- match(e) {
4042
- return this.peek()?.id !== e ? false : (this.consume(), true);
4043
- }
4044
- consumeAndParse(e = 1 / 0) {
4045
- let t = this.consume(), n = this.prefixParselets[t.id];
4046
- if (!n)
4047
- throw Error(`Parse error at "${t.value}" (line ${t.line}, column ${t.column}). No matching prefix parselet.`);
4048
- let i2 = n.parse(this, t);
4049
- for (; e > this.getPrecedence(); ) {
4050
- let o = this.consume();
4051
- i2 = this.getInfixParselet(o).parse(this, i2, o);
4052
- }
4053
- return i2;
4054
- }
4055
- getPrecedence() {
4056
- let e = this.peek();
4057
- if (!e)
4058
- return 1 / 0;
4059
- let t = this.getInfixParselet(e);
4060
- return t ? t.precedence : 1 / 0;
4061
- }
4062
- consume(e, t) {
4063
- if (!this.tokens.length)
4064
- throw Error("Cant consume unknown more tokens.");
4065
- if (e && this.peek()?.id !== e) {
4066
- let n = this.peek();
4067
- throw Error(`Expected ${e} but got "${n.id}" at line ${n.line} column ${n.column}.`);
4068
- }
4069
- if (t && this.peek()?.value !== t) {
4070
- let n = this.peek();
4071
- throw Error(`Expected "${t}" but got "${n.value}" at line ${n.line} column ${n.column}.`);
4072
- }
4073
- return this.tokens.shift();
4074
- }
4075
- peek() {
4076
- return this.tokens.length > 0 ? this.tokens[0] : void 0;
4077
- }
4078
- removeComments() {
4079
- this.tokens = this.tokens.filter((e) => e.id !== "Comment");
4080
- }
4081
- getInfixParselet(e) {
4082
- return this.infixParselets[e.id === "Symbol" ? e.value : e.id];
4083
- }
4084
- };
4085
4095
  function re(r4) {
4086
4096
  if (r4.startsWith("T"))
4087
4097
  return r4 + "T00:00:00.000Z".substring(r4.length);
@@ -4255,7 +4265,7 @@ var S = { empty: (r4, e) => l(e.length === 0), exists: (r4, e, t) => t ? l(e.fil
4255
4265
  return { type: o, value: { resourceType: o, id: s } };
4256
4266
  }
4257
4267
  return { type: u.BackboneElement, value: void 0 };
4258
- }).filter((t) => !!t.value), as: (r4, e) => e, type: (r4, e) => e.map(({ value: t }) => typeof t == "boolean" ? { type: u.BackboneElement, value: { namespace: "System", name: "Boolean" } } : typeof t == "number" ? { type: u.BackboneElement, value: { namespace: "System", name: "Integer" } } : _(t) ? { type: u.BackboneElement, value: { namespace: "FHIR", name: t.resourceType } } : { type: u.BackboneElement, value: null }), conformsTo: (r4, e, t) => {
4268
+ }).filter((t) => !!t.value), as: (r4, e) => e, type: (r4, e) => e.map(({ value: t }) => typeof t == "boolean" ? { type: u.BackboneElement, value: { namespace: "System", name: "Boolean" } } : typeof t == "number" ? { type: u.BackboneElement, value: { namespace: "System", name: "Integer" } } : V(t) ? { type: u.BackboneElement, value: { namespace: "FHIR", name: t.resourceType } } : { type: u.BackboneElement, value: null }), conformsTo: (r4, e, t) => {
4259
4269
  let n = t.eval(r4, e)[0].value;
4260
4270
  if (!n.startsWith("http://hl7.org/fhir/StructureDefinition/"))
4261
4271
  throw new Error("Expected a StructureDefinition URL");
@@ -4318,13 +4328,13 @@ var M = class {
4318
4328
  evalValue(e) {
4319
4329
  let t = e.value;
4320
4330
  if (!(!t || typeof t != "object"))
4321
- return _(t) && t.resourceType === this.name ? e : w(e, this.name);
4331
+ return V(t) && t.resourceType === this.name ? e : w(e, this.name);
4322
4332
  }
4323
4333
  toString() {
4324
4334
  return this.name;
4325
4335
  }
4326
4336
  };
4327
- var Ie = class {
4337
+ var ke = class {
4328
4338
  eval() {
4329
4339
  return [];
4330
4340
  }
@@ -4332,7 +4342,7 @@ var Ie = class {
4332
4342
  return "{}";
4333
4343
  }
4334
4344
  };
4335
- var ke = class extends Pe {
4345
+ var Oe = class extends he {
4336
4346
  constructor(t, n, i2) {
4337
4347
  super(t, n);
4338
4348
  this.impl = i2;
@@ -4344,7 +4354,7 @@ var ke = class extends Pe {
4344
4354
  return this.operator + this.child.toString();
4345
4355
  }
4346
4356
  };
4347
- var J = class extends H {
4357
+ var J = class extends $ {
4348
4358
  constructor(e, t) {
4349
4359
  super("as", e, t);
4350
4360
  }
@@ -4352,7 +4362,7 @@ var J = class extends H {
4352
4362
  return S.ofType(e, this.left.eval(e, t), this.right);
4353
4363
  }
4354
4364
  };
4355
- var v = class extends H {
4365
+ var v = class extends $ {
4356
4366
  };
4357
4367
  var E = class extends v {
4358
4368
  constructor(t, n, i2, o) {
@@ -4370,7 +4380,7 @@ var E = class extends v {
4370
4380
  return typeof p2 == "boolean" ? l(p2) : R(s) ? [{ type: u.Quantity, value: { ...s, value: p2 } }] : [T(p2)];
4371
4381
  }
4372
4382
  };
4373
- var Oe = class extends H {
4383
+ var De = class extends $ {
4374
4384
  constructor(e, t) {
4375
4385
  super("&", e, t);
4376
4386
  }
@@ -4379,7 +4389,7 @@ var Oe = class extends H {
4379
4389
  return o.length > 0 && o.every((s) => typeof s.value == "string") ? [{ type: u.string, value: o.map((s) => s.value).join("") }] : o;
4380
4390
  }
4381
4391
  };
4382
- var De = class extends v {
4392
+ var Ve = class extends v {
4383
4393
  constructor(e, t) {
4384
4394
  super("contains", e, t);
4385
4395
  }
@@ -4388,16 +4398,16 @@ var De = class extends v {
4388
4398
  return l(n.some((o) => o.value === i2[0].value));
4389
4399
  }
4390
4400
  };
4391
- var Ve = class extends v {
4401
+ var _e = class extends v {
4392
4402
  constructor(e, t) {
4393
4403
  super("in", e, t);
4394
4404
  }
4395
4405
  eval(e, t) {
4396
- let n = V(this.left.eval(e, t)), i2 = this.right.eval(e, t);
4406
+ let n = D(this.left.eval(e, t)), i2 = this.right.eval(e, t);
4397
4407
  return n ? l(i2.some((o) => o.value === n.value)) : [];
4398
4408
  }
4399
4409
  };
4400
- var Q = class extends H {
4410
+ var Q = class extends $ {
4401
4411
  constructor(e, t) {
4402
4412
  super(".", e, t);
4403
4413
  }
@@ -4408,7 +4418,7 @@ var Q = class extends H {
4408
4418
  return `${this.left.toString()}.${this.right.toString()}`;
4409
4419
  }
4410
4420
  };
4411
- var ne = class extends H {
4421
+ var ne = class extends $ {
4412
4422
  constructor(e, t) {
4413
4423
  super("|", e, t);
4414
4424
  }
@@ -4417,40 +4427,40 @@ var ne = class extends H {
4417
4427
  return Re([...n, ...i2]);
4418
4428
  }
4419
4429
  };
4420
- var _e = class extends v {
4430
+ var Ue = class extends v {
4421
4431
  constructor(e, t) {
4422
4432
  super("=", e, t);
4423
4433
  }
4424
4434
  eval(e, t) {
4425
4435
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
4426
- return ft(n, i2);
4436
+ return at(n, i2);
4427
4437
  }
4428
4438
  };
4429
- var Ue = class extends v {
4439
+ var Le = class extends v {
4430
4440
  constructor(e, t) {
4431
4441
  super("!=", e, t);
4432
4442
  }
4433
4443
  eval(e, t) {
4434
4444
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
4435
- return pt(ft(n, i2));
4445
+ return st(at(n, i2));
4436
4446
  }
4437
4447
  };
4438
- var Le = class extends v {
4448
+ var Fe = class extends v {
4439
4449
  constructor(e, t) {
4440
4450
  super("~", e, t);
4441
4451
  }
4442
4452
  eval(e, t) {
4443
4453
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
4444
- return mt(n, i2);
4454
+ return ct(n, i2);
4445
4455
  }
4446
4456
  };
4447
- var Fe = class extends v {
4457
+ var Ne = class extends v {
4448
4458
  constructor(e, t) {
4449
4459
  super("!~", e, t);
4450
4460
  }
4451
4461
  eval(e, t) {
4452
4462
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
4453
- return pt(mt(n, i2));
4463
+ return st(ct(n, i2));
4454
4464
  }
4455
4465
  };
4456
4466
  var Y = class extends v {
@@ -4465,39 +4475,39 @@ var Y = class extends v {
4465
4475
  return l(Ee(n[0], i2));
4466
4476
  }
4467
4477
  };
4468
- var Ne = class extends v {
4478
+ var Me = class extends v {
4469
4479
  constructor(e, t) {
4470
4480
  super("and", e, t);
4471
4481
  }
4472
4482
  eval(e, t) {
4473
- let n = V(this.left.eval(e, t), "boolean"), i2 = V(this.right.eval(e, t), "boolean");
4483
+ let n = D(this.left.eval(e, t), "boolean"), i2 = D(this.right.eval(e, t), "boolean");
4474
4484
  return n?.value === true && i2?.value === true ? l(true) : n?.value === false || i2?.value === false ? l(false) : [];
4475
4485
  }
4476
4486
  };
4477
- var Me = class extends v {
4487
+ var Be = class extends v {
4478
4488
  constructor(e, t) {
4479
4489
  super("or", e, t);
4480
4490
  }
4481
4491
  eval(e, t) {
4482
- let n = V(this.left.eval(e, t), "boolean"), i2 = V(this.right.eval(e, t), "boolean");
4492
+ let n = D(this.left.eval(e, t), "boolean"), i2 = D(this.right.eval(e, t), "boolean");
4483
4493
  return n?.value === false && i2?.value === false ? l(false) : n?.value || i2?.value ? l(true) : [];
4484
4494
  }
4485
4495
  };
4486
- var Be = class extends v {
4496
+ var qe = class extends v {
4487
4497
  constructor(e, t) {
4488
4498
  super("xor", e, t);
4489
4499
  }
4490
4500
  eval(e, t) {
4491
- let n = V(this.left.eval(e, t), "boolean"), i2 = V(this.right.eval(e, t), "boolean");
4501
+ let n = D(this.left.eval(e, t), "boolean"), i2 = D(this.right.eval(e, t), "boolean");
4492
4502
  return !n || !i2 ? [] : l(n.value !== i2.value);
4493
4503
  }
4494
4504
  };
4495
- var qe = class extends v {
4505
+ var $e = class extends v {
4496
4506
  constructor(e, t) {
4497
4507
  super("implies", e, t);
4498
4508
  }
4499
4509
  eval(e, t) {
4500
- let n = V(this.left.eval(e, t), "boolean"), i2 = V(this.right.eval(e, t), "boolean");
4510
+ let n = D(this.left.eval(e, t), "boolean"), i2 = D(this.right.eval(e, t), "boolean");
4501
4511
  return i2?.value === true || n?.value === false ? l(true) : !n || !i2 ? [] : l(false);
4502
4512
  }
4503
4513
  };
@@ -4562,11 +4572,11 @@ function ti(r4) {
4562
4572
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
4563
4573
  }
4564
4574
  function ue() {
4565
- return new Ce().registerPrefix("String", { parse: (r4, e) => new k({ type: u.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r4, e) => new k({ type: u.dateTime, value: re(e.value) }) }).registerPrefix("Quantity", { parse: (r4, e) => new k({ type: u.Quantity, value: ti(e.value) }) }).registerPrefix("Number", { parse: (r4, e) => new k({ type: u.decimal, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new k({ type: u.boolean, value: true }) }).registerPrefix("false", { parse: () => new k({ type: u.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r4, e) => new M(e.value) }).registerPrefix("{}", { parse: () => new Ie() }).registerPrefix("(", Xn).registerInfix("[", Zn).registerInfix("(", ei).prefix("+", f.UnaryAdd, (r4, e) => new ke("+", e, (t) => t)).prefix("-", f.UnarySubtract, (r4, e) => new E("-", e, e, (t, n) => -n)).infixLeft(".", f.Dot, (r4, e, t) => new Q(r4, t)).infixLeft("/", f.Divide, (r4, e, t) => new E("/", r4, t, (n, i2) => n / i2)).infixLeft("*", f.Multiply, (r4, e, t) => new E("*", r4, t, (n, i2) => n * i2)).infixLeft("+", f.Add, (r4, e, t) => new E("+", r4, t, (n, i2) => n + i2)).infixLeft("-", f.Subtract, (r4, e, t) => new E("-", r4, t, (n, i2) => n - i2)).infixLeft("|", f.Union, (r4, e, t) => new ne(r4, t)).infixLeft("=", f.Equals, (r4, e, t) => new _e(r4, t)).infixLeft("!=", f.NotEquals, (r4, e, t) => new Ue(r4, t)).infixLeft("~", f.Equivalent, (r4, e, t) => new Le(r4, t)).infixLeft("!~", f.NotEquivalent, (r4, e, t) => new Fe(r4, t)).infixLeft("<", f.LessThan, (r4, e, t) => new E("<", r4, t, (n, i2) => n < i2)).infixLeft("<=", f.LessThanOrEquals, (r4, e, t) => new E("<=", r4, t, (n, i2) => n <= i2)).infixLeft(">", f.GreaterThan, (r4, e, t) => new E(">", r4, t, (n, i2) => n > i2)).infixLeft(">=", f.GreaterThanOrEquals, (r4, e, t) => new E(">=", r4, t, (n, i2) => n >= i2)).infixLeft("&", f.Ampersand, (r4, e, t) => new Oe(r4, t)).infixLeft("and", f.And, (r4, e, t) => new Ne(r4, t)).infixLeft("as", f.As, (r4, e, t) => new J(r4, t)).infixLeft("contains", f.Contains, (r4, e, t) => new De(r4, t)).infixLeft("div", f.Divide, (r4, e, t) => new E("div", r4, t, (n, i2) => n / i2 | 0)).infixLeft("in", f.In, (r4, e, t) => new Ve(r4, t)).infixLeft("is", f.Is, (r4, e, t) => new Y(r4, t)).infixLeft("mod", f.Modulo, (r4, e, t) => new E("mod", r4, t, (n, i2) => n % i2)).infixLeft("or", f.Or, (r4, e, t) => new Me(r4, t)).infixLeft("xor", f.Xor, (r4, e, t) => new Be(r4, t)).infixLeft("implies", f.Implies, (r4, e, t) => new qe(r4, t));
4575
+ return new ye().registerPrefix("String", { parse: (r4, e) => new k({ type: u.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r4, e) => new k({ type: u.dateTime, value: re(e.value) }) }).registerPrefix("Quantity", { parse: (r4, e) => new k({ type: u.Quantity, value: ti(e.value) }) }).registerPrefix("Number", { parse: (r4, e) => new k({ type: u.decimal, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new k({ type: u.boolean, value: true }) }).registerPrefix("false", { parse: () => new k({ type: u.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r4, e) => new M(e.value) }).registerPrefix("{}", { parse: () => new ke() }).registerPrefix("(", Xn).registerInfix("[", Zn).registerInfix("(", ei).prefix("+", f.UnaryAdd, (r4, e) => new Oe("+", e, (t) => t)).prefix("-", f.UnarySubtract, (r4, e) => new E("-", e, e, (t, n) => -n)).infixLeft(".", f.Dot, (r4, e, t) => new Q(r4, t)).infixLeft("/", f.Divide, (r4, e, t) => new E("/", r4, t, (n, i2) => n / i2)).infixLeft("*", f.Multiply, (r4, e, t) => new E("*", r4, t, (n, i2) => n * i2)).infixLeft("+", f.Add, (r4, e, t) => new E("+", r4, t, (n, i2) => n + i2)).infixLeft("-", f.Subtract, (r4, e, t) => new E("-", r4, t, (n, i2) => n - i2)).infixLeft("|", f.Union, (r4, e, t) => new ne(r4, t)).infixLeft("=", f.Equals, (r4, e, t) => new Ue(r4, t)).infixLeft("!=", f.NotEquals, (r4, e, t) => new Le(r4, t)).infixLeft("~", f.Equivalent, (r4, e, t) => new Fe(r4, t)).infixLeft("!~", f.NotEquivalent, (r4, e, t) => new Ne(r4, t)).infixLeft("<", f.LessThan, (r4, e, t) => new E("<", r4, t, (n, i2) => n < i2)).infixLeft("<=", f.LessThanOrEquals, (r4, e, t) => new E("<=", r4, t, (n, i2) => n <= i2)).infixLeft(">", f.GreaterThan, (r4, e, t) => new E(">", r4, t, (n, i2) => n > i2)).infixLeft(">=", f.GreaterThanOrEquals, (r4, e, t) => new E(">=", r4, t, (n, i2) => n >= i2)).infixLeft("&", f.Ampersand, (r4, e, t) => new De(r4, t)).infixLeft("and", f.And, (r4, e, t) => new Me(r4, t)).infixLeft("as", f.As, (r4, e, t) => new J(r4, t)).infixLeft("contains", f.Contains, (r4, e, t) => new Ve(r4, t)).infixLeft("div", f.Divide, (r4, e, t) => new E("div", r4, t, (n, i2) => n / i2 | 0)).infixLeft("in", f.In, (r4, e, t) => new _e(r4, t)).infixLeft("is", f.Is, (r4, e, t) => new Y(r4, t)).infixLeft("mod", f.Modulo, (r4, e, t) => new E("mod", r4, t, (n, i2) => n % i2)).infixLeft("or", f.Or, (r4, e, t) => new Be(r4, t)).infixLeft("xor", f.Xor, (r4, e, t) => new qe(r4, t)).infixLeft("implies", f.Implies, (r4, e, t) => new $e(r4, t));
4566
4576
  }
4567
4577
  var ri = ue();
4568
- var ni = ((g) => (g.EQUALS = "eq", g.NOT_EQUALS = "ne", g.GREATER_THAN = "gt", g.LESS_THAN = "lt", g.GREATER_THAN_OR_EQUALS = "ge", g.LESS_THAN_OR_EQUALS = "le", g.STARTS_AFTER = "sa", g.ENDS_BEFORE = "eb", g.APPROXIMATELY = "ap", g.CONTAINS = "contains", g.EXACT = "exact", g.TEXT = "text", g.NOT = "not", g.ABOVE = "above", g.BELOW = "below", g.IN = "in", g.NOT_IN = "not-in", g.OF_TYPE = "of-type", g.MISSING = "missing", g.IDENTIFIER = "identifier", g.ITERATE = "iterate", g))(ni || {});
4569
- var Dr = ((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))(Dr || {});
4578
+ var Cr = ((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))(Cr || {});
4579
+ var ui = ((g) => (g.EQUALS = "eq", g.NOT_EQUALS = "ne", g.GREATER_THAN = "gt", g.LESS_THAN = "lt", g.GREATER_THAN_OR_EQUALS = "ge", g.LESS_THAN_OR_EQUALS = "le", g.STARTS_AFTER = "sa", g.ENDS_BEFORE = "eb", g.APPROXIMATELY = "ap", g.CONTAINS = "contains", g.EXACT = "exact", g.TEXT = "text", g.NOT = "not", g.ABOVE = "above", g.BELOW = "below", g.IN = "in", g.NOT_IN = "not-in", g.OF_TYPE = "of-type", g.MISSING = "missing", g.IDENTIFIER = "identifier", g.ITERATE = "iterate", g))(ui || {});
4570
4580
  var ki = ((x) => (x.READ = "read", x.VREAD = "vread", x.UPDATE = "update", x.PATCH = "patch", x.DELETE = "delete", x.HISTORY = "history", x.HISTORY_INSTANCE = "history-instance", x.HISTORY_TYPE = "history-type", x.HISTORY_SYSTEM = "history-system", x.CREATE = "create", x.SEARCH = "search", x.SEARCH_TYPE = "search-type", x.SEARCH_SYSTEM = "search-system", x.SEARCH_COMPARTMENT = "search-compartment", x.CAPABILITIES = "capabilities", x.TRANSACTION = "transaction", x.BATCH = "batch", x.OPERATION = "operation", x))(ki || {});
4571
4581
  function Mr(r4) {
4572
4582
  if (typeof window < "u")
@@ -4584,7 +4594,7 @@ function Br(r4) {
4584
4594
  }
4585
4595
  function It() {
4586
4596
  let r4 = new Uint32Array(28);
4587
- return crypto.getRandomValues(r4), rr(r4.buffer);
4597
+ return crypto.getRandomValues(r4), Kt(r4.buffer);
4588
4598
  }
4589
4599
  async function qr(r4) {
4590
4600
  return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r4));
@@ -4595,7 +4605,7 @@ function pe() {
4595
4605
  return (r4 === "x" ? e : e & 3 | 8).toString(16);
4596
4606
  });
4597
4607
  }
4598
- var He = class {
4608
+ var Qe = class {
4599
4609
  constructor(e = 10) {
4600
4610
  this.max = e, this.cache = /* @__PURE__ */ new Map();
4601
4611
  }
@@ -4645,7 +4655,7 @@ var fe = class {
4645
4655
  return !e.defaultPrevented;
4646
4656
  }
4647
4657
  };
4648
- var Qe = class {
4658
+ var We = class {
4649
4659
  constructor() {
4650
4660
  this.emitter = new fe();
4651
4661
  }
@@ -4671,12 +4681,12 @@ function jr(r4) {
4671
4681
  return !!r4.endpoint;
4672
4682
  }
4673
4683
  function Ot(r4) {
4674
- if (!Ge(r4))
4684
+ if (!Ke(r4))
4675
4685
  throw new d(h("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
4676
4686
  let { channelType: e, mode: t, topic: n, events: i2 } = r4, o = { "hub.channel.type": e, "hub.mode": t, "hub.topic": n, "hub.events": i2.join(",") };
4677
4687
  return jr(r4) && (o.endpoint = r4.endpoint), new URLSearchParams(o).toString();
4678
4688
  }
4679
- function Ge(r4) {
4689
+ function Ke(r4) {
4680
4690
  if (typeof r4 != "object")
4681
4691
  return false;
4682
4692
  let { channelType: e, mode: t, topic: n, events: i2 } = r4;
@@ -4723,12 +4733,12 @@ function Hr(r4, e, t) {
4723
4733
  let n = Array.isArray(t) ? t : [t];
4724
4734
  return Qi(e, n), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: pe(), event: { "hub.topic": r4, "hub.event": e, context: n } };
4725
4735
  }
4726
- var We = class extends Qe {
4736
+ var Ge = class extends We {
4727
4737
  constructor(t) {
4728
4738
  super();
4729
4739
  if (this.subRequest = t, !t.endpoint)
4730
4740
  throw new d(h("Subscription request should contain an endpoint."));
4731
- if (!Ge(t))
4741
+ if (!Ke(t))
4732
4742
  throw new d(h("Subscription request failed validation."));
4733
4743
  let n = new WebSocket(t.endpoint);
4734
4744
  n.addEventListener("open", () => {
@@ -4804,7 +4814,7 @@ var C = class {
4804
4814
  }
4805
4815
  };
4806
4816
  Gi = Symbol.toStringTag;
4807
- var Ke = class {
4817
+ var ze = class {
4808
4818
  constructor() {
4809
4819
  this.storage = typeof localStorage < "u" ? localStorage : new Vt();
4810
4820
  }
@@ -4822,7 +4832,7 @@ var Ke = class {
4822
4832
  return t ? JSON.parse(t) : void 0;
4823
4833
  }
4824
4834
  setObject(e, t) {
4825
- this.setString(e, t ? Zt(t) : void 0);
4835
+ this.setString(e, t ? Qt(t) : void 0);
4826
4836
  }
4827
4837
  };
4828
4838
  var Vt = class {
@@ -4861,9 +4871,13 @@ var zr = class extends fe {
4861
4871
  super();
4862
4872
  if (t?.baseUrl && !t.baseUrl.startsWith("http"))
4863
4873
  throw new Error("Base URL must start with http or https");
4864
- this.options = t ?? {}, this.fetch = t?.fetch ?? eo(), this.storage = t?.storage ?? new Ke(), this.createPdfImpl = t?.createPdf, this.baseUrl = Yr(t?.baseUrl ?? Ki), this.fhirBaseUrl = Yr(ze(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4/")), this.authorizeUrl = ze(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = ze(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = ze(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.onUnauthenticated = t?.onUnauthenticated, this.cacheTime = t?.cacheTime ?? Ji, this.cacheTime > 0 ? this.requestCache = new He(t?.resourceCacheSize ?? zi) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0);
4865
- let n = this.getActiveLogin();
4866
- n && (this.setAccessToken(n.accessToken, n.refreshToken), this.refreshProfile().catch(console.log)), this.setupStorageListener();
4874
+ if (this.options = t ?? {}, this.fetch = t?.fetch ?? eo(), this.storage = t?.storage ?? new ze(), this.createPdfImpl = t?.createPdf, this.baseUrl = Yr(t?.baseUrl ?? Ki), this.fhirBaseUrl = Yr(Je(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4/")), this.authorizeUrl = Je(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = Je(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = Je(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.onUnauthenticated = t?.onUnauthenticated, this.cacheTime = t?.cacheTime ?? Ji, this.cacheTime > 0 ? this.requestCache = new Qe(t?.resourceCacheSize ?? zi) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken)
4875
+ this.setAccessToken(t.accessToken);
4876
+ else {
4877
+ let n = this.getActiveLogin();
4878
+ n && (this.setAccessToken(n.accessToken, n.refreshToken), this.refreshProfile().catch(console.log));
4879
+ }
4880
+ this.setupStorageListener();
4867
4881
  }
4868
4882
  getBaseUrl() {
4869
4883
  return this.baseUrl;
@@ -5091,7 +5105,7 @@ var zr = class extends fe {
5091
5105
  }`.replace(/\s+/g, " "), a = await this.graphql(s);
5092
5106
  xr(a.data.StructureDefinitionList);
5093
5107
  for (let c2 of a.data.SearchParameterList)
5094
- St(c2);
5108
+ bt(c2);
5095
5109
  })());
5096
5110
  return this.setCacheEntry(n, o), o;
5097
5111
  }
@@ -5288,7 +5302,7 @@ var zr = class extends fe {
5288
5302
  return;
5289
5303
  let a = t.headers.get("content-type")?.includes("json");
5290
5304
  if (t.status === 404 && !a)
5291
- throw new d(Ht);
5305
+ throw new d(lr);
5292
5306
  let c2 = t.headers.get("content-location"), m2 = o.redirect ?? this.options.redirect;
5293
5307
  if (t.status === 201 && c2 && m2 === "follow")
5294
5308
  return this.request("GET", c2, { ...o, body: void 0 });
@@ -5302,7 +5316,7 @@ var zr = class extends fe {
5302
5316
  else
5303
5317
  p2 = await t.text();
5304
5318
  if (t.status >= 400)
5305
- throw new d(ot(p2));
5319
+ throw new d(ht(p2));
5306
5320
  return p2;
5307
5321
  }
5308
5322
  async fetchWithRetry(t, n) {
@@ -5315,7 +5329,7 @@ var zr = class extends fe {
5315
5329
  } catch (c2) {
5316
5330
  this.retryCatch(a, i2, c2);
5317
5331
  }
5318
- await ut(o);
5332
+ await nt(o);
5319
5333
  }
5320
5334
  return s;
5321
5335
  }
@@ -5339,7 +5353,7 @@ var zr = class extends fe {
5339
5353
  let c2 = await Xr(a);
5340
5354
  c2 && (i2 = await this.fetchWithRetry(c2, s));
5341
5355
  }
5342
- await ut(o);
5356
+ await nt(o);
5343
5357
  }
5344
5358
  return this.parseResponse(i2, "POST", t);
5345
5359
  }
@@ -5350,14 +5364,14 @@ var zr = class extends fe {
5350
5364
  try {
5351
5365
  o.resolve(await this.request(o.method, this.fhirBaseUrl + o.url, o.options));
5352
5366
  } catch (s) {
5353
- o.reject(new d(ot(s)));
5367
+ o.reject(new d(ht(s)));
5354
5368
  }
5355
5369
  return;
5356
5370
  }
5357
5371
  let n = { resourceType: "Bundle", type: "batch", entry: t.map((o) => ({ request: { method: o.method, url: o.url }, resource: o.options.body ? JSON.parse(o.options.body) : void 0 })) }, i2 = await this.post(this.fhirBaseUrl.slice(0, -1), n);
5358
5372
  for (let o = 0; o < t.length; o++) {
5359
5373
  let s = t[o], a = i2.entry?.[o];
5360
- a?.response?.outcome && !it(a.response.outcome) ? s.reject(new d(a.response.outcome)) : s.resolve(a?.resource);
5374
+ a?.response?.outcome && !mt(a.response.outcome) ? s.reject(new d(a.response.outcome)) : s.resolve(a?.resource);
5361
5375
  }
5362
5376
  }
5363
5377
  addFetchOptionsDefaults(t) {
@@ -5380,7 +5394,7 @@ var zr = class extends fe {
5380
5394
  sessionStorage.setItem("pkceState", t);
5381
5395
  let n = It();
5382
5396
  sessionStorage.setItem("codeVerifier", n);
5383
- let i2 = await qr(n), o = nr(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
5397
+ let i2 = await qr(n), o = zt(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
5384
5398
  return sessionStorage.setItem("codeChallenge", o), { codeChallengeMethod: "S256", codeChallenge: o };
5385
5399
  }
5386
5400
  async requestAuthorization(t) {
@@ -5433,14 +5447,14 @@ var zr = class extends fe {
5433
5447
  return i2.endpoint = s, i2;
5434
5448
  }
5435
5449
  async fhircastUnsubscribe(t) {
5436
- if (!Ge(t))
5450
+ if (!Ke(t))
5437
5451
  throw new d(h("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
5438
5452
  if (!(t.endpoint && typeof t.endpoint == "string" && t.endpoint.startsWith("ws")))
5439
5453
  throw new d(h("Provided subscription request must have an endpoint in order to unsubscribe."));
5440
5454
  t.mode = "unsubscribe", await this.post("/fhircast/STU2", Ot(t), F.FORM_URL_ENCODED);
5441
5455
  }
5442
5456
  fhircastConnect(t) {
5443
- return new We(t);
5457
+ return new Ge(t);
5444
5458
  }
5445
5459
  async fhircastPublish(t, n, i2) {
5446
5460
  return this.post(`/fhircast/STU2/${t}`, Hr(t, n, i2), F.JSON);
@@ -5456,9 +5470,9 @@ var zr = class extends fe {
5456
5470
  this.clearActiveLogin();
5457
5471
  try {
5458
5472
  let a = await o.json();
5459
- throw new d(O(a.error_description));
5473
+ throw new d(_(a.error_description));
5460
5474
  } catch (a) {
5461
- throw new d(O("Failed to fetch tokens"), a);
5475
+ throw new d(_("Failed to fetch tokens"), a);
5462
5476
  }
5463
5477
  }
5464
5478
  let s = await o.json();
@@ -5502,7 +5516,7 @@ function Jr() {
5502
5516
  function Yr(r4) {
5503
5517
  return r4.endsWith("/") ? r4 : r4 + "/";
5504
5518
  }
5505
- function ze(r4, e) {
5519
+ function Je(r4, e) {
5506
5520
  return new URL(e, r4).toString();
5507
5521
  }
5508
5522
  async function Xr(r4) {
@@ -5513,7 +5527,7 @@ async function Xr(r4) {
5513
5527
  if (t)
5514
5528
  return t;
5515
5529
  let n = await r4.json();
5516
- if (ye(n) && n.issue?.[0]?.diagnostics)
5530
+ if (we(n) && n.issue?.[0]?.diagnostics)
5517
5531
  return n.issue[0].diagnostics;
5518
5532
  }
5519
5533
  function Zr(r4) {
@@ -5581,7 +5595,7 @@ var nn = class r {
5581
5595
  };
5582
5596
  var me = class r2 {
5583
5597
  constructor(e, t = new G()) {
5584
- this.context = t, er(e) ? this.fields = e.map((n) => oe.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
5598
+ this.context = t, Wt(e) ? this.fields = e.map((n) => oe.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
5585
5599
  }
5586
5600
  get(e) {
5587
5601
  return this.fields[e];
@@ -5793,7 +5807,7 @@ var AgentHl7ChannelConnection = class {
5793
5807
  type: "connect",
5794
5808
  accessToken: medplum.getAccessToken(),
5795
5809
  agentId: channel.app.agentId,
5796
- botId: _o(channel.definition.targetReference)
5810
+ botId: So(channel.definition.targetReference)
5797
5811
  })
5798
5812
  );
5799
5813
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medplum/agent",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "description": "Medplum Agent",
5
5
  "author": "Medplum <hello@medplum.com>",
6
6
  "license": "Apache-2.0",
@@ -25,13 +25,13 @@
25
25
  "@medplum/core": "*",
26
26
  "@medplum/hl7": "*",
27
27
  "node-windows": "1.0.0-beta.8",
28
- "ws": "8.14.1"
28
+ "ws": "8.14.2"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@medplum/fhirtypes": "*",
32
32
  "@medplum/mock": "*",
33
- "@types/node-windows": "0.1.3",
34
- "@types/ws": "8.5.5",
33
+ "@types/node-windows": "0.1.4",
34
+ "@types/ws": "8.5.7",
35
35
  "mock-socket": "9.3.1",
36
36
  "pkg": "5.8.1"
37
37
  }
package/tsconfig.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "../../tsconfig.base.json",
2
+ "extends": "../../tsconfig.json",
3
3
  "compilerOptions": {
4
4
  "outDir": "dist",
5
5
  "lib": ["esnext"]