@medplum/core 0.9.38 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- function e(e,t,i,n){return new(i||(i=Promise))((function(o,r){function a(e){try{c(n.next(e))}catch(e){r(e)}}function s(e){try{c(n.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function t(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)}function i(e,t,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,i):o?o.value=i:t.set(e,i),i}var n,o,r,a;class s{constructor(e=10){n.add(this),o.set(this,void 0),r.set(this,void 0),i(this,o,e,"f"),i(this,r,new Map,"f")}clear(){t(this,r,"f").clear()}get(e){const i=t(this,r,"f").get(e);return i&&(t(this,r,"f").delete(e),t(this,r,"f").set(e,i)),i}set(e,i){t(this,r,"f").has(e)?t(this,r,"f").delete(e):t(this,r,"f").size>=t(this,o,"f")&&t(this,r,"f").delete(t(this,n,"m",a).call(this)),t(this,r,"f").set(e,i)}delete(e){t(this,r,"f").delete(e)}keys(){return t(this,r,"f").keys()}}function c(e,t){const i=[];return e.line&&i.push(...e.line),e.city&&i.push(e.city),e.state&&i.push(e.state),e.postalCode&&i.push(e.postalCode),e.use&&((null==t?void 0:t.all)||(null==t?void 0:t.use))&&i.push("["+e.use+"]"),i.join(", ").trim()}function d(e,t){const i=[];return e.prefix&&!1!==(null==t?void 0:t.prefix)&&i.push(...e.prefix),e.given&&i.push(...e.given),e.family&&i.push(e.family),e.suffix&&!1!==(null==t?void 0:t.suffix)&&i.push(...e.suffix),e.use&&((null==t?void 0:t.all)||(null==t?void 0:t.use))&&i.push("["+e.use+"]"),i.join(" ").trim()}function l(e){const t=[];return e.given&&t.push(...e.given),t.join(" ").trim()}function u(e){return e.family||""}function m(e){return e instanceof Date&&!isNaN(e.getTime())}function h(e,t){if(!e)return"";const i=new Date(e);return m(i)?i.toLocaleDateString(void 0,t):""}function p(e,t){if(!e)return"";const i=new Date("2000-01-01T"+e+"Z");return m(i)?i.toLocaleTimeString(void 0,t):""}function f(e,t){if(!e)return"";const i=new Date(e);return m(i)?i.toLocaleString(void 0,t):""}function y(e){return e&&(e.start||e.end)?f(e.start)+" - "+f(e.end):""}o=new WeakMap,r=new WeakMap,n=new WeakSet,a=function(){return t(this,r,"f").keys().next().value};const g={s:"every second",min:"every minute",h:"hourly",d:"daily",wk:"weekly",mo:"monthly",a:"annually"},x={s:"second",min:"minute",h:"hour",d:"day",wk:"week",mo:"month",a:"year"},v={s:"seconds",min:"minutes",h:"hours",d:"days",wk:"weeks",mo:"months",a:"years"};function w(e){var t;if(!e)return"";const i=[];if(null===(t=e.repeat)||void 0===t?void 0:t.periodUnit){const t=e.repeat.frequency||1,n=e.repeat.period||1,o=e.repeat.periodUnit;1===t&&1===n?i.push(g[o]):(1===t?i.push("once"):i.push(t+" times"),1===n?i.push("per "+x[o]):i.push("per "+n+" "+v[o])),e.repeat.dayOfWeek&&i.push("on "+e.repeat.dayOfWeek.map(z).join(", ")),e.repeat.timeOfDay&&i.push("at "+e.repeat.timeOfDay.map((e=>p(e))).join(", "))}return e.event&&i.push(e.event.map((e=>f(e))).join(", ")),z(i.join(" ").trim())}function E(e){const t=S(e),i=T(e);return i===t?{reference:t}:{reference:t,display:i}}function S(e){return e.resourceType+"/"+e.id}function b(e){var t;return null===(t=null==e?void 0:e.reference)||void 0===t?void 0:t.split("/")[1]}function D(e){return"Patient"===e.resourceType||"Practitioner"===e.resourceType||"RelatedPerson"===e.resourceType}function T(e){var t,i;if(D(e)){const t=function(e){const t=e.name;if(t&&t.length>0)return d(t[0]);return}(e);if(t)return t}if("Device"===e.resourceType){const t=function(e){const t=e.deviceName;if(t&&t.length>0)return t[0].name;return}(e);if(t)return t}return"Observation"===e.resourceType&&"code"in e&&(null===(t=e.code)||void 0===t?void 0:t.text)?null===(i=e.code)||void 0===i?void 0:i.text:"User"===e.resourceType&&e.email?e.email:"name"in e&&e.name&&"string"==typeof e.name?e.name:S(e)}function C(e){if(D(e)){const t=e.photo;if(t)for(const e of t){const t=P(e);if(t)return t}}if("Bot"===e.resourceType&&e.photo){const t=P(e.photo);if(t)return t}}function P(e){if(e.url&&e.contentType&&e.contentType.startsWith("image/"))return e.url}function R(e){return e?new Date(e):void 0}function A(e,t){const i=new Date(e);i.setUTCHours(0,0,0,0);const n=t?new Date(t):new Date;n.setUTCHours(0,0,0,0);const o=i.getUTCFullYear(),r=i.getUTCMonth(),a=i.getUTCDate(),s=n.getUTCFullYear(),c=n.getUTCMonth(),d=n.getUTCDate();let l=s-o;(c<r||c===r&&d<a)&&l--;let u=12*s+c-(12*o+r);d<a&&u--;return{years:l,months:u,days:Math.floor((n.getTime()-i.getTime())/864e5)}}function k(e,t){const{years:i,months:n,days:o}=A(e,t);return i>=2?i.toString().padStart(3,"0")+"Y":n>=1?n.toString().padStart(3,"0")+"M":o.toString().padStart(3,"0")+"D"}function M(e){const t={};return I(e.item,t),t}function I(e,t){if(e)for(const i of e)i.linkId&&i.answer&&i.answer.length>0&&(t[i.linkId]=i.answer[0]),I(i.item,t)}function O(e,t){const i=e.identifier;if(!i)return;const n=Array.isArray(i)?i:[i];for(const e of n)if(e.system===t)return e.value}function U(e,...t){var i;let n=e;for(let e=0;e<t.length&&n;e++)n=null===(i=null==n?void 0:n.extension)||void 0===i?void 0:i.find((i=>i.url===t[e]));return null==n?void 0:n.valueString}function L(e,t){return JSON.stringify(e,j,t?2:void 0)}function j(e,t){return!function(e){return!!e.match(/\d+$/)}(e)&&N(t)?void 0:t}function N(e){if(null==e)return!0;const t=typeof e;return"string"===t&&""===e||"object"===t&&0===Object.keys(e).length}function _(e,t,i){return e===t||(!(!N(e)||!N(t))||!N(e)&&!N(t)&&(Array.isArray(e)&&Array.isArray(t)?function(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!_(e[i],t[i]))return!1;return!0}(e,t):!Array.isArray(e)&&!Array.isArray(t)&&(B(e)&&B(t)?function(e,t,i){const n=new Set;Object.keys(e).forEach((e=>n.add(e))),Object.keys(t).forEach((e=>n.add(e))),"meta"===i&&(n.delete("versionId"),n.delete("lastUpdated"),n.delete("author"));for(const i of n){if(!_(e[i],t[i],i))return!1}return!0}(e,t,i):(B(e)||B(t),!1))))}function W(e){return JSON.parse(JSON.stringify(e))}function Q(e){return!!e.match(/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/i)}function B(e){return null!==e&&"object"==typeof e}function q(e){return e.every((e=>"string"==typeof e))}const $=[];for(let e=0;e<256;e++)$.push(e.toString(16).padStart(2,"0"));function F(e){const t=new Uint8Array(e),i=new Array(t.length);for(let e=0;e<t.length;e++)i[e]=$[t[e]];return i.join("")}function H(e){const t=new Uint8Array(e),i=[];for(let e=0;e<t.length;e++)i[e]=String.fromCharCode(t[e]);return window.btoa(i.join(""))}function z(e){return e.charAt(0).toUpperCase()+e.substring(1)}function G(e){return e===e.toLowerCase()&&e!==e.toUpperCase()}function V(e,t){var i,n;return null===(n=null===(i=null==e?void 0:e.coding)||void 0===i?void 0:i.find((e=>e.system===t)))||void 0===n?void 0:n.code}function X(e,t,i){var n,o;e.coding||(e.coding=[]);const r=null===(n=e.coding)||void 0===n?void 0:n.find((e=>e.system===t));r?r.code=i:null===(o=e.coding)||void 0===o||o.push({system:t,code:i})}function Y(e,t,i,n){var o;return null===(o=e.qualifiedInterval)||void 0===o?void 0:o.find((o=>{var r;return Z(o,t)&&function(e,t,i){return!!e.range&&K(t,e.range,i)}(o,i,null===(r=e.quantitativeDetails)||void 0===r?void 0:r.decimalPrecision)&&(void 0===n||o.category===n)}))}function J(e,t,i){var n;return null===(n=e.qualifiedInterval)||void 0===n?void 0:n.find((e=>Z(e,t)&&i.includes(e.condition)))}function Z(e,t){return function(e,t){return!e.gender||e.gender===t.gender}(e,t)&&function(e,t){return!e.age||K(A(t.birthDate).years,e.age)}(e,t)}function K(e,t,i){var n,o;return(void 0===(null===(n=t.low)||void 0===n?void 0:n.value)||oe(e,t.low.value,i))&&(void 0===(null===(o=t.high)||void 0===o?void 0:o.value)||ne(e,t.high.value,i))}function ee(e,t,i){return i?Math.abs(e-t)<Math.pow(10,-i):e===t}function te(e,t,i){return i?e<t&&Math.abs(e-t)>Math.pow(10,-i):e<t}function ie(e,t,i){return i?e>t&&Math.abs(e-t)>Math.pow(10,-i):e>t}function ne(e,t,i){return te(e,t,i)||ee(e,t,i)}function oe(e,t,i){return ie(e,t,i)||ee(e,t,i)}function re(){const e=new Uint32Array(28);return crypto.getRandomValues(e),F(e.buffer)}var ae,se,ce,de,le,ue,me,he;function pe(e){const t=function(e){if("undefined"!=typeof window)return window.atob(e);if("undefined"!=typeof Buffer)return Buffer.from(e,"base64").toString("binary");throw new Error("Unable to decode base64")}(e.replace(/-/g,"+").replace(/_/g,"/")),i=Array.from(t).reduce(((e,t)=>`${e}%${("00"+t.charCodeAt(0).toString(16)).slice(-2)}`),""),n=decodeURIComponent(i);return JSON.parse(n)}function fe(e){const[t,i,n]=e.split(".");return pe(i)}ae=new WeakMap;class ye{constructor(e){this[ue]="ReadablePromise",se.set(this,void 0),ce.set(this,"pending"),de.set(this,void 0),le.set(this,void 0),i(this,se,e.then((e=>(i(this,ce,"success","f"),i(this,de,e,"f"),e)),(e=>{throw i(this,ce,"error","f"),i(this,le,e,"f"),e})),"f")}isPending(){return"pending"===t(this,ce,"f")}isOk(){return"success"===t(this,ce,"f")}read(){switch(t(this,ce,"f")){case"pending":throw t(this,se,"f");case"error":throw t(this,le,"f");default:return t(this,de,"f")}}then(e,i){return t(this,se,"f").then(e,i)}catch(e){return t(this,se,"f").catch(e)}finally(e){return t(this,se,"f").finally(e)}}se=new WeakMap,ce=new WeakMap,de=new WeakMap,le=new WeakMap,ue=Symbol.toStringTag;class ge{constructor(){me.set(this,void 0),i(this,me,"undefined"!=typeof localStorage?localStorage:new xe,"f")}clear(){t(this,me,"f").clear()}getString(e){return t(this,me,"f").getItem(e)||void 0}setString(e,i){i?t(this,me,"f").setItem(e,i):t(this,me,"f").removeItem(e)}getObject(e){const t=this.getString(e);return t?JSON.parse(t):void 0}setObject(e,t){this.setString(e,t?L(t):void 0)}}me=new WeakMap;class xe{constructor(){he.set(this,void 0),i(this,he,new Map,"f")}get length(){return t(this,he,"f").size}clear(){t(this,he,"f").clear()}getItem(e){var i;return null!==(i=t(this,he,"f").get(e))&&void 0!==i?i:null}setItem(e,i){i?t(this,he,"f").set(e,i):t(this,he,"f").delete(e)}removeItem(e){t(this,he,"f").delete(e)}key(e){return Array.from(t(this,he,"f").keys())[e]}}he=new WeakMap;var ve,we={types:{Element:{display:"Element",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]}}},BackboneElement:{display:"BackboneElement",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]}}},Address:{display:"Address",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},use:{min:0,max:"1",type:[{code:"code"}]},type:{min:0,max:"1",type:[{code:"code"}]},text:{min:0,max:"1",type:[{code:"string"}]},line:{min:0,max:"*",type:[{code:"string"}]},city:{min:0,max:"1",type:[{code:"string"}]},district:{min:0,max:"1",type:[{code:"string"}]},state:{min:0,max:"1",type:[{code:"string"}]},postalCode:{min:0,max:"1",type:[{code:"string"}]},country:{min:0,max:"1",type:[{code:"string"}]},period:{min:0,max:"1",type:[{code:"Period"}]}}},Age:{display:"Age",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},value:{min:0,max:"1",type:[{code:"decimal"}]},comparator:{min:0,max:"1",type:[{code:"code"}]},unit:{min:0,max:"1",type:[{code:"string"}]},system:{min:0,max:"1",type:[{code:"uri"}]},code:{min:0,max:"1",type:[{code:"code"}]}}},Annotation:{display:"Annotation",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},"author[x]":{min:0,max:"1",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:{min:0,max:"1",type:[{code:"dateTime"}]},text:{min:1,max:"1",type:[{code:"markdown"}]}}},Attachment:{display:"Attachment",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},contentType:{min:0,max:"1",type:[{code:"code"}]},language:{min:0,max:"1",type:[{code:"code"}]},data:{min:0,max:"1",type:[{code:"base64Binary"}]},url:{min:0,max:"1",type:[{code:"url"}]},size:{min:0,max:"1",type:[{code:"unsignedInt"}]},hash:{min:0,max:"1",type:[{code:"base64Binary"}]},title:{min:0,max:"1",type:[{code:"string"}]},creation:{min:0,max:"1",type:[{code:"dateTime"}]}}},CodeableConcept:{display:"CodeableConcept",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},coding:{min:0,max:"*",type:[{code:"Coding"}]},text:{min:0,max:"1",type:[{code:"string"}]}}},Coding:{display:"Coding",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},system:{min:0,max:"1",type:[{code:"uri"}]},version:{min:0,max:"1",type:[{code:"string"}]},code:{min:0,max:"1",type:[{code:"code"}]},display:{min:0,max:"1",type:[{code:"string"}]},userSelected:{min:0,max:"1",type:[{code:"boolean"}]}}},ContactDetail:{display:"ContactDetail",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},name:{min:0,max:"1",type:[{code:"string"}]},telecom:{min:0,max:"*",type:[{code:"ContactPoint"}]}}},ContactPoint:{display:"ContactPoint",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},system:{min:0,max:"1",type:[{code:"code"}]},value:{min:0,max:"1",type:[{code:"string"}]},use:{min:0,max:"1",type:[{code:"code"}]},rank:{min:0,max:"1",type:[{code:"positiveInt"}]},period:{min:0,max:"1",type:[{code:"Period"}]}}},Contributor:{display:"Contributor",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},type:{min:1,max:"1",type:[{code:"code"}]},name:{min:1,max:"1",type:[{code:"string"}]},contact:{min:0,max:"*",type:[{code:"ContactDetail"}]}}},Count:{display:"Count",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},value:{min:0,max:"1",type:[{code:"decimal"}]},comparator:{min:0,max:"1",type:[{code:"code"}]},unit:{min:0,max:"1",type:[{code:"string"}]},system:{min:0,max:"1",type:[{code:"uri"}]},code:{min:0,max:"1",type:[{code:"code"}]}}},DataRequirement:{display:"DataRequirement",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},type:{min:1,max:"1",type:[{code:"code"}]},profile:{min:0,max:"*",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]},"subject[x]":{min:0,max:"1",type:[{code:"CodeableConcept"},{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Group"]}]},mustSupport:{min:0,max:"*",type:[{code:"string"}]},codeFilter:{min:0,max:"*",type:[{code:"Element"}]},dateFilter:{min:0,max:"*",type:[{code:"Element"}]},limit:{min:0,max:"1",type:[{code:"positiveInt"}]},sort:{min:0,max:"*",type:[{code:"Element"}]}}},DataRequirementCodeFilter:{display:"DataRequirementCodeFilter",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},path:{min:0,max:"1",type:[{code:"string"}]},searchParam:{min:0,max:"1",type:[{code:"string"}]},valueSet:{min:0,max:"1",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/ValueSet"]}]},code:{min:0,max:"*",type:[{code:"Coding"}]}},parentType:"DataRequirement"},DataRequirementDateFilter:{display:"DataRequirementDateFilter",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},path:{min:0,max:"1",type:[{code:"string"}]},searchParam:{min:0,max:"1",type:[{code:"string"}]},"value[x]":{min:0,max:"1",type:[{code:"dateTime"},{code:"Period"},{code:"Duration"}]}},parentType:"DataRequirement"},DataRequirementSort:{display:"DataRequirementSort",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},path:{min:1,max:"1",type:[{code:"string"}]},direction:{min:1,max:"1",type:[{code:"code"}]}},parentType:"DataRequirement"},Distance:{display:"Distance",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},value:{min:0,max:"1",type:[{code:"decimal"}]},comparator:{min:0,max:"1",type:[{code:"code"}]},unit:{min:0,max:"1",type:[{code:"string"}]},system:{min:0,max:"1",type:[{code:"uri"}]},code:{min:0,max:"1",type:[{code:"code"}]}}},Dosage:{display:"Dosage",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},sequence:{min:0,max:"1",type:[{code:"integer"}]},text:{min:0,max:"1",type:[{code:"string"}]},additionalInstruction:{min:0,max:"*",type:[{code:"CodeableConcept"}]},patientInstruction:{min:0,max:"1",type:[{code:"string"}]},timing:{min:0,max:"1",type:[{code:"Timing"}]},"asNeeded[x]":{min:0,max:"1",type:[{code:"boolean"},{code:"CodeableConcept"}]},site:{min:0,max:"1",type:[{code:"CodeableConcept"}]},route:{min:0,max:"1",type:[{code:"CodeableConcept"}]},method:{min:0,max:"1",type:[{code:"CodeableConcept"}]},doseAndRate:{min:0,max:"*",type:[{code:"Element"}]},maxDosePerPeriod:{min:0,max:"1",type:[{code:"Ratio"}]},maxDosePerAdministration:{min:0,max:"1",type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},maxDosePerLifetime:{min:0,max:"1",type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]}}},DosageDoseAndRate:{display:"DosageDoseAndRate",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},type:{min:0,max:"1",type:[{code:"CodeableConcept"}]},"dose[x]":{min:0,max:"1",type:[{code:"Range"},{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},"rate[x]":{min:0,max:"1",type:[{code:"Ratio"},{code:"Range"},{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]}},parentType:"Dosage"},Duration:{display:"Duration",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},value:{min:0,max:"1",type:[{code:"decimal"}]},comparator:{min:0,max:"1",type:[{code:"code"}]},unit:{min:0,max:"1",type:[{code:"string"}]},system:{min:0,max:"1",type:[{code:"uri"}]},code:{min:0,max:"1",type:[{code:"code"}]}}},ElementDefinition:{display:"ElementDefinition",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},path:{min:1,max:"1",type:[{code:"string"}]},representation:{min:0,max:"*",type:[{code:"code"}]},sliceName:{min:0,max:"1",type:[{code:"string"}]},sliceIsConstraining:{min:0,max:"1",type:[{code:"boolean"}]},label:{min:0,max:"1",type:[{code:"string"}]},code:{min:0,max:"*",type:[{code:"Coding"}]},slicing:{min:0,max:"1",type:[{code:"Element"}]},short:{min:0,max:"1",type:[{code:"string"}]},definition:{min:0,max:"1",type:[{code:"markdown"}]},comment:{min:0,max:"1",type:[{code:"markdown"}]},requirements:{min:0,max:"1",type:[{code:"markdown"}]},alias:{min:0,max:"*",type:[{code:"string"}]},min:{min:0,max:"1",type:[{code:"unsignedInt"}]},max:{min:0,max:"1",type:[{code:"string"}]},base:{min:0,max:"1",type:[{code:"Element"}]},contentReference:{min:0,max:"1",type:[{code:"uri"}]},type:{min:0,max:"*",type:[{code:"Element"}]},"defaultValue[x]":{min:0,max:"1",type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]},meaningWhenMissing:{min:0,max:"1",type:[{code:"markdown"}]},orderMeaning:{min:0,max:"1",type:[{code:"string"}]},"fixed[x]":{min:0,max:"1",type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]},"pattern[x]":{min:0,max:"1",type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]},example:{min:0,max:"*",type:[{code:"Element"}]},"minValue[x]":{min:0,max:"1",type:[{code:"date"},{code:"dateTime"},{code:"instant"},{code:"time"},{code:"decimal"},{code:"integer"},{code:"positiveInt"},{code:"unsignedInt"},{code:"Quantity"}]},"maxValue[x]":{min:0,max:"1",type:[{code:"date"},{code:"dateTime"},{code:"instant"},{code:"time"},{code:"decimal"},{code:"integer"},{code:"positiveInt"},{code:"unsignedInt"},{code:"Quantity"}]},maxLength:{min:0,max:"1",type:[{code:"integer"}]},condition:{min:0,max:"*",type:[{code:"id"}]},constraint:{min:0,max:"*",type:[{code:"Element"}]},mustSupport:{min:0,max:"1",type:[{code:"boolean"}]},isModifier:{min:0,max:"1",type:[{code:"boolean"}]},isModifierReason:{min:0,max:"1",type:[{code:"string"}]},isSummary:{min:0,max:"1",type:[{code:"boolean"}]},binding:{min:0,max:"1",type:[{code:"Element"}]},mapping:{min:0,max:"*",type:[{code:"Element"}]}}},ElementDefinitionSlicing:{display:"ElementDefinitionSlicing",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},discriminator:{min:0,max:"*",type:[{code:"Element"}]},description:{min:0,max:"1",type:[{code:"string"}]},ordered:{min:0,max:"1",type:[{code:"boolean"}]},rules:{min:1,max:"1",type:[{code:"code"}]}},parentType:"ElementDefinition"},ElementDefinitionSlicingDiscriminator:{display:"ElementDefinitionSlicingDiscriminator",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},type:{min:1,max:"1",type:[{code:"code"}]},path:{min:1,max:"1",type:[{code:"string"}]}},parentType:"ElementDefinitionSlicing"},ElementDefinitionBase:{display:"ElementDefinitionBase",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},path:{min:1,max:"1",type:[{code:"string"}]},min:{min:1,max:"1",type:[{code:"unsignedInt"}]},max:{min:1,max:"1",type:[{code:"string"}]}},parentType:"ElementDefinition"},ElementDefinitionType:{display:"ElementDefinitionType",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},code:{min:1,max:"1",type:[{code:"uri"}]},profile:{min:0,max:"*",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition","http://hl7.org/fhir/StructureDefinition/ImplementationGuide"]}]},targetProfile:{min:0,max:"*",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition","http://hl7.org/fhir/StructureDefinition/ImplementationGuide"]}]},aggregation:{min:0,max:"*",type:[{code:"code"}]},versioning:{min:0,max:"1",type:[{code:"code"}]}},parentType:"ElementDefinition"},ElementDefinitionExample:{display:"ElementDefinitionExample",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},label:{min:1,max:"1",type:[{code:"string"}]},"value[x]":{min:1,max:"1",type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]}},parentType:"ElementDefinition"},ElementDefinitionConstraint:{display:"ElementDefinitionConstraint",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},key:{min:1,max:"1",type:[{code:"id"}]},requirements:{min:0,max:"1",type:[{code:"string"}]},severity:{min:1,max:"1",type:[{code:"code"}]},human:{min:1,max:"1",type:[{code:"string"}]},expression:{min:0,max:"1",type:[{code:"string"}]},xpath:{min:0,max:"1",type:[{code:"string"}]},source:{min:0,max:"1",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]}},parentType:"ElementDefinition"},ElementDefinitionBinding:{display:"ElementDefinitionBinding",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},strength:{min:1,max:"1",type:[{code:"code"}]},description:{min:0,max:"1",type:[{code:"string"}]},valueSet:{min:0,max:"1",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/ValueSet"]}]}},parentType:"ElementDefinition"},ElementDefinitionMapping:{display:"ElementDefinitionMapping",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},identity:{min:1,max:"1",type:[{code:"id"}]},language:{min:0,max:"1",type:[{code:"code"}]},map:{min:1,max:"1",type:[{code:"string"}]},comment:{min:0,max:"1",type:[{code:"string"}]}},parentType:"ElementDefinition"},Expression:{display:"Expression",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},description:{min:0,max:"1",type:[{code:"string"}]},name:{min:0,max:"1",type:[{code:"id"}]},language:{min:1,max:"1",type:[{code:"code"}]},expression:{min:0,max:"1",type:[{code:"string"}]},reference:{min:0,max:"1",type:[{code:"uri"}]}}},Extension:{display:"Extension",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},url:{min:1,max:"1",type:[{code:"string"}]},"value[x]":{min:0,max:"1",type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]}}},HumanName:{display:"HumanName",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},use:{min:0,max:"1",type:[{code:"code"}]},text:{min:0,max:"1",type:[{code:"string"}]},family:{min:0,max:"1",type:[{code:"string"}]},given:{min:0,max:"*",type:[{code:"string"}]},prefix:{min:0,max:"*",type:[{code:"string"}]},suffix:{min:0,max:"*",type:[{code:"string"}]},period:{min:0,max:"1",type:[{code:"Period"}]}}},Identifier:{display:"Identifier",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},use:{min:0,max:"1",type:[{code:"code"}]},type:{min:0,max:"1",type:[{code:"CodeableConcept"}]},system:{min:0,max:"1",type:[{code:"uri"}]},value:{min:0,max:"1",type:[{code:"string"}]},period:{min:0,max:"1",type:[{code:"Period"}]},assigner:{min:0,max:"1",type:[{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Organization"]}]}}},MarketingStatus:{display:"MarketingStatus",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},country:{min:1,max:"1",type:[{code:"CodeableConcept"}]},jurisdiction:{min:0,max:"1",type:[{code:"CodeableConcept"}]},status:{min:1,max:"1",type:[{code:"CodeableConcept"}]},dateRange:{min:1,max:"1",type:[{code:"Period"}]},restoreDate:{min:0,max:"1",type:[{code:"dateTime"}]}}},Meta:{display:"Meta",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},versionId:{min:0,max:"1",type:[{code:"id"}]},lastUpdated:{min:0,max:"1",type:[{code:"instant"}]},source:{min:0,max:"1",type:[{code:"uri"}]},profile:{min:0,max:"*",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]},security:{min:0,max:"*",type:[{code:"Coding"}]},tag:{min:0,max:"*",type:[{code:"Coding"}]},project:{min:0,max:"1",type:[{code:"uri"}]},author:{min:0,max:"1",type:[{code:"Reference"}]},account:{min:0,max:"1",type:[{code:"Reference"}]}}},Money:{display:"Money",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},value:{min:0,max:"1",type:[{code:"decimal"}]},currency:{min:0,max:"1",type:[{code:"code"}]}}},Narrative:{display:"Narrative",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},status:{min:1,max:"1",type:[{code:"code"}]},div:{min:1,max:"1",type:[{code:"xhtml"}]}}},ParameterDefinition:{display:"ParameterDefinition",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},name:{min:0,max:"1",type:[{code:"code"}]},use:{min:1,max:"1",type:[{code:"code"}]},min:{min:0,max:"1",type:[{code:"integer"}]},max:{min:0,max:"1",type:[{code:"string"}]},documentation:{min:0,max:"1",type:[{code:"string"}]},type:{min:1,max:"1",type:[{code:"code"}]},profile:{min:0,max:"1",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]}}},Period:{display:"Period",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},start:{min:0,max:"1",type:[{code:"dateTime"}]},end:{min:0,max:"1",type:[{code:"dateTime"}]}}},Population:{display:"Population",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},"age[x]":{min:0,max:"1",type:[{code:"Range"},{code:"CodeableConcept"}]},gender:{min:0,max:"1",type:[{code:"CodeableConcept"}]},race:{min:0,max:"1",type:[{code:"CodeableConcept"}]},physiologicalCondition:{min:0,max:"1",type:[{code:"CodeableConcept"}]}}},ProdCharacteristic:{display:"ProdCharacteristic",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},height:{min:0,max:"1",type:[{code:"Quantity"}]},width:{min:0,max:"1",type:[{code:"Quantity"}]},depth:{min:0,max:"1",type:[{code:"Quantity"}]},weight:{min:0,max:"1",type:[{code:"Quantity"}]},nominalVolume:{min:0,max:"1",type:[{code:"Quantity"}]},externalDiameter:{min:0,max:"1",type:[{code:"Quantity"}]},shape:{min:0,max:"1",type:[{code:"string"}]},color:{min:0,max:"*",type:[{code:"string"}]},imprint:{min:0,max:"*",type:[{code:"string"}]},image:{min:0,max:"*",type:[{code:"Attachment"}]},scoring:{min:0,max:"1",type:[{code:"CodeableConcept"}]}}},ProductShelfLife:{display:"ProductShelfLife",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},identifier:{min:0,max:"1",type:[{code:"Identifier"}]},type:{min:1,max:"1",type:[{code:"CodeableConcept"}]},period:{min:1,max:"1",type:[{code:"Quantity"}]},specialPrecautionsForStorage:{min:0,max:"*",type:[{code:"CodeableConcept"}]}}},Quantity:{display:"Quantity",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},value:{min:0,max:"1",type:[{code:"decimal"}]},comparator:{min:0,max:"0",type:[{code:"code"}]},unit:{min:0,max:"1",type:[{code:"string"}]},system:{min:0,max:"1",type:[{code:"uri"}]},code:{min:0,max:"1",type:[{code:"code"}]}}},Range:{display:"Range",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},low:{min:0,max:"1",type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},high:{min:0,max:"1",type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]}}},Ratio:{display:"Ratio",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},numerator:{min:0,max:"1",type:[{code:"Quantity"}]},denominator:{min:0,max:"1",type:[{code:"Quantity"}]}}},Reference:{display:"Reference",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},reference:{min:0,max:"1",type:[{code:"string"}]},type:{min:0,max:"1",type:[{code:"uri"}]},identifier:{min:0,max:"1",type:[{code:"Identifier"}]},display:{min:0,max:"1",type:[{code:"string"}]}}},RelatedArtifact:{display:"RelatedArtifact",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},type:{min:1,max:"1",type:[{code:"code"}]},label:{min:0,max:"1",type:[{code:"string"}]},display:{min:0,max:"1",type:[{code:"string"}]},citation:{min:0,max:"1",type:[{code:"markdown"}]},url:{min:0,max:"1",type:[{code:"url"}]},document:{min:0,max:"1",type:[{code:"Attachment"}]},resource:{min:0,max:"1",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/Resource"]}]}}},SampledData:{display:"SampledData",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},origin:{min:1,max:"1",type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},period:{min:1,max:"1",type:[{code:"decimal"}]},factor:{min:0,max:"1",type:[{code:"decimal"}]},lowerLimit:{min:0,max:"1",type:[{code:"decimal"}]},upperLimit:{min:0,max:"1",type:[{code:"decimal"}]},dimensions:{min:1,max:"1",type:[{code:"positiveInt"}]},data:{min:0,max:"1",type:[{code:"string"}]}}},Signature:{display:"Signature",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},type:{min:1,max:"*",type:[{code:"Coding"}]},when:{min:1,max:"1",type:[{code:"instant"}]},who:{min:1,max:"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:{min:0,max:"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"]}]},targetFormat:{min:0,max:"1",type:[{code:"code"}]},sigFormat:{min:0,max:"1",type:[{code:"code"}]},data:{min:0,max:"1",type:[{code:"base64Binary"}]}}},SubstanceAmount:{display:"SubstanceAmount",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},"amount[x]":{min:0,max:"1",type:[{code:"Quantity"},{code:"Range"},{code:"string"}]},amountType:{min:0,max:"1",type:[{code:"CodeableConcept"}]},amountText:{min:0,max:"1",type:[{code:"string"}]},referenceRange:{min:0,max:"1",type:[{code:"Element"}]}}},SubstanceAmountReferenceRange:{display:"SubstanceAmountReferenceRange",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},lowLimit:{min:0,max:"1",type:[{code:"Quantity"}]},highLimit:{min:0,max:"1",type:[{code:"Quantity"}]}},parentType:"SubstanceAmount"},Timing:{display:"Timing",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},event:{min:0,max:"*",type:[{code:"dateTime"}]},repeat:{min:0,max:"1",type:[{code:"Element"}]},code:{min:0,max:"1",type:[{code:"CodeableConcept"}]}}},TimingRepeat:{display:"TimingRepeat",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},"bounds[x]":{min:0,max:"1",type:[{code:"Duration"},{code:"Range"},{code:"Period"}]},count:{min:0,max:"1",type:[{code:"positiveInt"}]},countMax:{min:0,max:"1",type:[{code:"positiveInt"}]},duration:{min:0,max:"1",type:[{code:"decimal"}]},durationMax:{min:0,max:"1",type:[{code:"decimal"}]},durationUnit:{min:0,max:"1",type:[{code:"code"}]},frequency:{min:0,max:"1",type:[{code:"positiveInt"}]},frequencyMax:{min:0,max:"1",type:[{code:"positiveInt"}]},period:{min:0,max:"1",type:[{code:"decimal"}]},periodMax:{min:0,max:"1",type:[{code:"decimal"}]},periodUnit:{min:0,max:"1",type:[{code:"code"}]},dayOfWeek:{min:0,max:"*",type:[{code:"code"}]},timeOfDay:{min:0,max:"*",type:[{code:"time"}]},when:{min:0,max:"*",type:[{code:"code"}]},offset:{min:0,max:"1",type:[{code:"unsignedInt"}]}},parentType:"Timing"},TriggerDefinition:{display:"TriggerDefinition",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},type:{min:1,max:"1",type:[{code:"code"}]},name:{min:0,max:"1",type:[{code:"string"}]},"timing[x]":{min:0,max:"1",type:[{code:"Timing"},{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Schedule"]},{code:"date"},{code:"dateTime"}]},data:{min:0,max:"*",type:[{code:"DataRequirement"}]},condition:{min:0,max:"1",type:[{code:"Expression"}]}}},UsageContext:{display:"UsageContext",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},code:{min:1,max:"1",type:[{code:"Coding"}]},"value[x]":{min:1,max:"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"]}]}}}}};function Ee(){return{types:{}}}function Se(e){for(const t of e.entry){const e=t.resource;"StructureDefinition"===e.resourceType&&be(e)}}function be(e){var t;if(!e.name)return;const i=null===(t=e.snapshot)||void 0===t?void 0:t.element;i&&(i.forEach((t=>function(e,t){var i,n;const o=t.path,r=null===(n=null===(i=t.type)||void 0===i?void 0:i[0])||void 0===n?void 0:n.code;if(void 0!==r&&"Element"!==r&&"BackboneElement"!==r)return;const a=o.split("."),s=Te(a);Re.types[s]=function(e,t,i){return{structureDefinition:t,elementDefinition:i,display:e,description:i.definition,properties:{}}}(s,e,t),Re.types[s].parentType=Te(a.slice(0,a.length-1))}(e,t))),i.forEach((e=>function(e){const t=e.path.split(".");if(1===t.length)return;const i=Te(t.slice(0,t.length-1)),n=Re.types[i];if(!n)return;const o=t[t.length-1];n.properties[o]=e}(e))))}function De(e){if(e.base)for(const t of e.base){const i=Re.types[t];i&&(i.searchParams||(i.searchParams={_id:{base:[t],code:"_id",type:"token",expression:t+".id"},_lastUpdated:{base:[t],code:"_lastUpdated",type:"date",expression:t+".meta.lastUpdated"}}),i.searchParams[e.code]=e)}}function Te(e){return 1===e.length?e[0]:e.map(z).join("")}function Ce(e){const t=e.replaceAll("[x]","").split(".").pop();return"id"===t?"ID":t.split(/(?=[A-Z])/).map(z).join(" ").replace("_"," ").replace(/\s+/g," ")}function Pe(e,t){var i;const n=Re.types[e];if(!n)return;const o=null!==(i=n.properties[t])&&void 0!==i?i:n.properties[t+"[x]"];if(o){if(o.contentReference){const e=o.contentReference.substring(1).split("."),t=e.pop();return Pe(Te(e),t)}return o}}!function(e){e.Address="Address",e.Age="Age",e.Annotation="Annotation",e.Attachment="Attachment",e.BackboneElement="BackboneElement",e.CodeableConcept="CodeableConcept",e.Coding="Coding",e.ContactDetail="ContactDetail",e.ContactPoint="ContactPoint",e.Contributor="Contributor",e.Count="Count",e.DataRequirement="DataRequirement",e.Distance="Distance",e.Dosage="Dosage",e.Duration="Duration",e.Expression="Expression",e.Extension="Extension",e.HumanName="HumanName",e.Identifier="Identifier",e.MarketingStatus="MarketingStatus",e.Meta="Meta",e.Money="Money",e.Narrative="Narrative",e.ParameterDefinition="ParameterDefinition",e.Period="Period",e.Population="Population",e.ProdCharacteristic="ProdCharacteristic",e.ProductShelfLife="ProductShelfLife",e.Quantity="Quantity",e.Range="Range",e.Ratio="Ratio",e.Reference="Reference",e.RelatedArtifact="RelatedArtifact",e.SampledData="SampledData",e.Signature="Signature",e.SubstanceAmount="SubstanceAmount",e.SystemString="http://hl7.org/fhirpath/System.String",e.Timing="Timing",e.TriggerDefinition="TriggerDefinition",e.UsageContext="UsageContext",e.base64Binary="base64Binary",e.boolean="boolean",e.canonical="canonical",e.code="code",e.date="date",e.dateTime="dateTime",e.decimal="decimal",e.id="id",e.instant="instant",e.integer="integer",e.markdown="markdown",e.oid="oid",e.positiveInt="positiveInt",e.string="string",e.time="time",e.unsignedInt="unsignedInt",e.uri="uri",e.url="url",e.uuid="uuid"}(ve||(ve={}));const Re=we;var Ae,ke,Me,Ie,Oe,Ue,Le,je,Ne,_e,We,Qe,Be,qe,$e,Fe,He,ze,Ge,Ve,Xe,Ye,Je,Ze,Ke,et,tt,it,nt,ot,rt,at;const st="launch/patient openid fhirUser offline_access user/*.*";class ct extends class{constructor(){ae.set(this,void 0),i(this,ae,{},"f")}addEventListener(e,i){t(this,ae,"f")[e]||(t(this,ae,"f")[e]=[]),t(this,ae,"f")[e].push(i)}removeEventListeneer(e,i){const n=t(this,ae,"f")[e];if(n)for(let e=0;e<n.length;e++)if(n[e]===i)return void n.splice(e,1)}dispatchEvent(e){const i=t(this,ae,"f")[e.type];return i&&i.forEach((t=>t.call(this,e))),!e.defaultPrevented}}{constructor(e){var n,o;if(super(),Ae.add(this),ke.set(this,void 0),Me.set(this,void 0),Ie.set(this,void 0),Oe.set(this,void 0),Ue.set(this,void 0),Le.set(this,void 0),je.set(this,void 0),Ne.set(this,void 0),_e.set(this,void 0),We.set(this,void 0),Qe.set(this,void 0),Be.set(this,void 0),qe.set(this,void 0),$e.set(this,void 0),Fe.set(this,void 0),He.set(this,void 0),ze.set(this,void 0),(null==e?void 0:e.baseUrl)&&!e.baseUrl.startsWith("http"))throw new Error("Base URL must start with http or https");i(this,ke,(null==e?void 0:e.fetch)||window.fetch.bind(window),"f"),i(this,Me,null==e?void 0:e.createPdf,"f"),i(this,Ie,new ge,"f"),i(this,Oe,new s(null!==(n=null==e?void 0:e.resourceCacheSize)&&void 0!==n?n:1e3),"f"),i(this,Ue,null!==(o=null==e?void 0:e.cacheTime)&&void 0!==o?o:6e4,"f"),i(this,Le,function(e){if(!e)return e;return e.endsWith("/")?e:e+"/"}(null==e?void 0:e.baseUrl)||"https://api.medplum.com/","f"),i(this,je,(null==e?void 0:e.clientId)||"","f"),i(this,Ne,(null==e?void 0:e.authorizeUrl)||t(this,Le,"f")+"oauth2/authorize","f"),i(this,_e,(null==e?void 0:e.tokenUrl)||t(this,Le,"f")+"oauth2/token","f"),i(this,We,(null==e?void 0:e.logoutUrl)||t(this,Le,"f")+"oauth2/logout","f"),i(this,Qe,null==e?void 0:e.onUnauthenticated,"f");const r=this.getActiveLogin();r&&(i(this,Be,r.accessToken,"f"),i(this,qe,r.refreshToken,"f"),t(this,Ae,"m",Ve).call(this).catch(console.log)),t(this,Ae,"m",at).call(this)}getBaseUrl(){return t(this,Le,"f")}clear(){t(this,Ie,"f").clear(),t(this,Oe,"f").clear(),i(this,Be,void 0,"f"),i(this,qe,void 0,"f"),i(this,He,void 0,"f"),i(this,ze,void 0,"f"),this.dispatchEvent({type:"change"})}invalidateUrl(e){e=e.toString(),t(this,Oe,"f").delete(e)}invalidateSearches(e){const i="fhir/R4/"+e;for(const e of t(this,Oe,"f").keys())(e.endsWith(i)||e.includes(i+"?"))&&t(this,Oe,"f").delete(e)}get(e,i={}){e=e.toString();const n=t(this,Ae,"m",Xe).call(this,e,i);if(n)return n.value;const o=new ye(t(this,Ae,"m",Je).call(this,"GET",e,i));return t(this,Ae,"m",Ye).call(this,e,o),o}post(e,i,n,o={}){return e=e.toString(),i&&t(this,Ae,"m",et).call(this,o,i),n&&t(this,Ae,"m",Ke).call(this,o,n),this.invalidateUrl(e),t(this,Ae,"m",Je).call(this,"POST",e,o)}put(e,i,n,o={}){return e=e.toString(),i&&t(this,Ae,"m",et).call(this,o,i),n&&t(this,Ae,"m",Ke).call(this,o,n),this.invalidateUrl(e),t(this,Ae,"m",Je).call(this,"PUT",e,o)}patch(e,i,n={}){return e=e.toString(),t(this,Ae,"m",et).call(this,n,i),t(this,Ae,"m",Ke).call(this,n,"application/json-patch+json"),this.invalidateUrl(e),t(this,Ae,"m",Je).call(this,"PATCH",e,n)}delete(e,i={}){return e=e.toString(),this.invalidateUrl(e),t(this,Ae,"m",Je).call(this,"DELETE",e,i)}startNewUser(t){return e(this,void 0,void 0,(function*(){return yield this.startPkce(),this.post("auth/newuser",Object.assign(Object.assign({},t),{codeChallengeMethod:"S256",codeChallenge:sessionStorage.getItem("codeChallenge")}))}))}startNewProject(t){return e(this,void 0,void 0,(function*(){return this.post("auth/newproject",t)}))}startNewPatient(t){return e(this,void 0,void 0,(function*(){return this.post("auth/newpatient",t)}))}startLogin(i){var n,o;return e(this,void 0,void 0,(function*(){const{codeChallenge:e,codeChallengeMethod:r}=this.getCodeChallenge(i);return this.post("auth/login",Object.assign(Object.assign({},i),{clientId:null!==(n=i.clientId)&&void 0!==n?n:t(this,je,"f"),scope:null!==(o=i.scope)&&void 0!==o?o:st,codeChallengeMethod:r,codeChallenge:e}))}))}startGoogleLogin(i){var n,o;return e(this,void 0,void 0,(function*(){const{codeChallenge:e,codeChallengeMethod:r}=this.getCodeChallenge(i);return this.post("auth/google",Object.assign(Object.assign({},i),{clientId:null!==(n=i.clientId)&&void 0!==n?n:t(this,je,"f"),scope:null!==(o=i.scope)&&void 0!==o?o:st,codeChallengeMethod:r,codeChallenge:e}))}))}getCodeChallenge(e){if(e.codeChallenge)return{codeChallenge:e.codeChallenge,codeChallengeMethod:e.codeChallengeMethod};const t=sessionStorage.getItem("codeChallenge");return t?{codeChallenge:t,codeChallengeMethod:"S256"}:{}}signOut(){this.clear()}signInWithRedirect(){return e(this,void 0,void 0,(function*(){const e=new URLSearchParams(window.location.search).get("code");return e?this.processCode(e):void(yield t(this,Ae,"m",it).call(this))}))}signOutWithRedirect(){window.location.assign(t(this,We,"f"))}fhirUrl(...e){return new URL(t(this,Le,"f")+"fhir/R4/"+e.join("/"))}fhirSearchUrl(e,t){const i=this.fhirUrl(e);return t&&(i.search=t.toString()),i}search(e,t,i={}){return this.get(this.fhirSearchUrl(e,t),i)}searchOne(e,i,n={}){const o=this.fhirSearchUrl(e,i);o.searchParams.set("_count","1"),o.searchParams.sort();const r=o.toString()+"-searchOne",a=t(this,Ae,"m",Xe).call(this,r,n);if(a)return a.value;const s=new ye(this.search(e,o.searchParams,n).then((e=>{var t,i;return null===(i=null===(t=e.entry)||void 0===t?void 0:t[0])||void 0===i?void 0:i.resource})));return t(this,Ae,"m",Ye).call(this,r,s),s}searchResources(e,i,n={}){const o=this.fhirSearchUrl(e,i).toString()+"-searchResources",r=t(this,Ae,"m",Xe).call(this,o,n);if(r)return r.value;const a=new ye(this.search(e,i,n).then((e=>{var t,i;return null!==(i=null===(t=e.entry)||void 0===t?void 0:t.map((e=>e.resource)))&&void 0!==i?i:[]})));return t(this,Ae,"m",Ye).call(this,o,a),a}searchValueSet(e,t,i={}){const n=this.fhirUrl("ValueSet","$expand");return n.searchParams.set("url",e),n.searchParams.set("filter",t),this.get(n.toString(),i)}getCached(e,i){var n;const o=null===(n=t(this,Oe,"f").get(this.fhirUrl(e,i).toString()))||void 0===n?void 0:n.value;return o&&o.isOk()?o.read():void 0}getCachedReference(e){const t=e.reference;if(!t)return;const[i,n]=t.split("/");return i&&n?this.getCached(i,n):void 0}readResource(e,t,i={}){return this.get(this.fhirUrl(e,t),i)}readReference(e,t={}){const i=null==e?void 0:e.reference;if(!i)return new ye(Promise.reject(new Error("Missing reference")));const[n,o]=i.split("/");return n&&o?this.readResource(n,o,t):new ye(Promise.reject(new Error("Invalid reference")))}getSchema(){return Re}requestSchema(t){return e(this,void 0,void 0,(function*(){if(t in Re.types)return Re;const e=`{\n StructureDefinitionList(name: "${t}") {\n name,\n description,\n snapshot {\n element {\n id,\n path,\n min,\n max,\n type {\n code,\n targetProfile\n },\n binding {\n valueSet\n },\n definition\n }\n }\n }\n SearchParameterList(base: "${t}", _count: 100) {\n base,\n code,\n type,\n expression,\n target\n }\n }`.replace(/\s+/g," "),i=yield this.graphql(e);for(const e of i.data.StructureDefinitionList)be(e);for(const e of i.data.SearchParameterList)De(e);return Re}))}readHistory(e,t,i={}){return this.get(this.fhirUrl(e,t,"_history"),i)}readVersion(e,t,i,n={}){return this.get(this.fhirUrl(e,t,"_history",i),n)}readPatientEverything(e,t={}){return this.get(this.fhirUrl("Patient",e,"$everything"),t)}createResource(e){if(!e.resourceType)throw new Error("Missing resourceType");return this.invalidateSearches(e.resourceType),this.post(this.fhirUrl(e.resourceType),e)}createResourceIfNoneExist(t,i){var n;return e(this,void 0,void 0,(function*(){return null!==(n=yield this.searchOne(t.resourceType,i))&&void 0!==n?n:this.createResource(t)}))}createBinary(e,t,i){const n=this.fhirUrl("Binary");return t&&n.searchParams.set("_filename",t),this.post(n,e,i)}createPdf(i,n,o,r){return e(this,void 0,void 0,(function*(){if(!t(this,Me,"f"))throw new Error("PDF creation not enabled");const e=yield t(this,Me,"f").call(this,i,o,r);return this.createBinary(e,n,"application/pdf")}))}createComment(e,t){const i=this.getProfile();let n,o;return"Encounter"===e.resourceType&&(n=E(e),o=e.subject),"ServiceRequest"===e.resourceType&&(n=e.encounter,o=e.subject),"Patient"===e.resourceType&&(o=E(e)),this.createResource({resourceType:"Communication",basedOn:[E(e)],encounter:n,subject:o,sender:i?E(i):void 0,sent:(new Date).toISOString(),payload:[{contentString:t}]})}updateResource(t){return e(this,void 0,void 0,(function*(){if(!t.resourceType)throw new Error("Missing resourceType");if(!t.id)throw new Error("Missing id");this.invalidateSearches(t.resourceType);const e=yield this.put(this.fhirUrl(t.resourceType,t.id),t);return null!=e?e:t}))}patchResource(e,t,i){return this.invalidateSearches(e),this.patch(this.fhirUrl(e,t),i)}deleteResource(e,t){return this.invalidateSearches(e),this.delete(this.fhirUrl(e,t))}executeBatch(e){return this.post("fhir/R4",e)}sendEmail(e){return this.post("email/v1/send",e,"application/json")}graphql(e,t,i,n){return this.post(this.fhirUrl("$graphql"),{query:e,operationName:t,variables:i},"application/json",n)}readResourceGraph(e,t,i){return this.get(`${this.fhirUrl(e,t)}/$graph?graph=${i}`)}getActiveLogin(){return t(this,Ie,"f").getObject("activeLogin")}setActiveLogin(n){return e(this,void 0,void 0,(function*(){i(this,Be,n.accessToken,"f"),i(this,qe,n.refreshToken,"f"),i(this,He,void 0,"f"),i(this,ze,void 0,"f"),t(this,Ie,"f").setObject("activeLogin",n),t(this,Ae,"m",Ge).call(this,n),t(this,Oe,"f").clear(),i(this,$e,void 0,"f"),yield t(this,Ae,"m",Ve).call(this)}))}getAccessToken(){return t(this,Be,"f")}setAccessToken(e){i(this,Be,e,"f"),i(this,qe,void 0,"f"),i(this,He,void 0,"f"),i(this,ze,void 0,"f")}getLogins(){var e;return null!==(e=t(this,Ie,"f").getObject("logins"))&&void 0!==e?e:[]}isLoading(){return!!t(this,Fe,"f")}getProfile(){return t(this,He,"f")}getProfileAsync(){return e(this,void 0,void 0,(function*(){return t(this,Fe,"f")&&(yield t(this,Fe,"f")),this.getProfile()}))}getUserConfiguration(){return t(this,ze,"f")}download(i,n={}){return e(this,void 0,void 0,(function*(){t(this,$e,"f")&&(yield t(this,$e,"f")),t(this,Ae,"m",Ze).call(this,n);return(yield t(this,ke,"f").call(this,i.toString(),n)).blob()}))}startPkce(){return e(this,void 0,void 0,(function*(){const t=re();sessionStorage.setItem("pkceState",t);const i=re();sessionStorage.setItem("codeVerifier",i);const n=H(yield function(t){return e(this,void 0,void 0,(function*(){return crypto.subtle.digest("SHA-256",(new TextEncoder).encode(t))}))}(i)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"");sessionStorage.setItem("codeChallenge",n)}))}processCode(e){const i=new URLSearchParams;i.set("grant_type","authorization_code"),i.set("client_id",t(this,je,"f")),i.set("code",e),i.set("redirect_uri",dt());const n=sessionStorage.getItem("codeVerifier");return n&&i.set("code_verifier",n),t(this,Ae,"m",ot).call(this,i)}startClientLogin(i,n){return e(this,void 0,void 0,(function*(){const e=new URLSearchParams;return e.set("grant_type","client_credentials"),e.set("client_id",i),e.set("client_secret",n),t(this,Ae,"m",ot).call(this,e)}))}}function dt(){return window.location.protocol+"//"+window.location.host+"/"}function lt(e){if(e.startsWith("T"))return e+"T00:00:00.000Z".substring(e.length);if(e.length<=10)return e;try{return new Date(e).toISOString()}catch(t){return e}}function ut(e){return[{type:ve.boolean,value:e}]}function mt(e){return null==e?{type:"undefined",value:void 0}:Number.isSafeInteger(e)?{type:ve.integer,value:e}:"number"==typeof e?{type:ve.decimal,value:e}:"boolean"==typeof e?{type:ve.boolean,value:e}:"string"==typeof e?{type:ve.string,value:e}:Tt(e)?{type:ve.Quantity,value:e}:"object"==typeof e&&"resourceType"in e?{type:e.resourceType,value:e}:{type:ve.BackboneElement,value:e}}function ht(e){return 0!==e.length&&!!e[0].value}function pt(e,t){if(!(null==e?void 0:e.value))return;const i=Pe(e.type,t);if(i){const n=function(e,t,i){var n;const o=i.type;if(!o||0===o.length)return;let r,a="undefined";if(1===o.length)r=e.value[t],a=o[0].code;else for(const i of o){const n=t.replace("[x]","")+z(i.code);if(n in e.value){r=e.value[n],a=i.code;break}}if(N(r))return;"Element"!==a&&"BackboneElement"!==a||(a=Te(null===(n=i.path)||void 0===n?void 0:n.split(".")));return Array.isArray(r)?r.map((e=>ft(e,a))):ft(r,a)}(e,t,i);if(n)return n}return function(e,t){const i=e.value;if(!i||"object"!=typeof i)return;let n;if(t in i)n=i[t];else for(const e in ve){const o=t+z(e);if(o in i){n=i[o];break}}if(N(n))return;return Array.isArray(n)?n.map(mt):mt(n)}(e,t)}function ft(e,t){return"Resource"===t&&"object"==typeof e&&"resourceType"in e&&(t=e.resourceType),{type:t,value:e}}function yt(e){const t=[];for(const i of e){let e=!1;for(const n of t)if(ht(vt(i,n))){e=!0;break}e||t.push(i)}return t}function gt(e){return ut(!ht(e))}function xt(e,t){return 0===e.length||0===t.length?[]:e.length!==t.length?ut(!1):ut(e.every(((e,i)=>ht(vt(e,t[i])))))}function vt(e,t){const i=e.value,n=t.value;return"number"==typeof i&&"number"==typeof n?ut(Math.abs(i-n)<1e-8):Tt(i)&&Tt(n)?ut(Ct(i,n)):ut("object"==typeof i&&"object"==typeof n?Pt(e,t):i===n)}function wt(e,t){return 0===e.length&&0===t.length?ut(!0):e.length!==t.length?ut(!1):(e.sort(St),t.sort(St),ut(e.every(((e,i)=>ht(Et(e,t[i]))))))}function Et(e,t){const i=e.value,n=t.value;return"number"==typeof i&&"number"==typeof n?ut(Math.abs(i-n)<.01):Tt(i)&&Tt(n)?ut(Ct(i,n)):ut("object"==typeof i&&"object"==typeof n?Pt(i,n):"string"==typeof i&&"string"==typeof n?i.toLowerCase()===n.toLowerCase():i===n)}function St(e,t){const i=e.value,n=t.value;return"number"==typeof i&&"number"==typeof n?i-n:"string"==typeof i&&"string"==typeof n?i.localeCompare(n):0}function bt(e,t){const{value:i}=e;if(null==i)return!1;switch(t){case"Boolean":return"boolean"==typeof i;case"Decimal":case"Integer":return"number"==typeof i;case"Date":return"string"==typeof i&&!!i.match(/^\d{4}(-\d{2}(-\d{2})?)?/);case"DateTime":return"string"==typeof i&&!!i.match(/^\d{4}(-\d{2}(-\d{2})?)?T/);case"Time":return"string"==typeof i&&!!i.match(/^T\d/);case"Period":return Dt(i);case"Quantity":return Tt(i);default:return"object"==typeof i&&(null==i?void 0:i.resourceType)===t}}function Dt(e){return!(!e||"object"!=typeof e||!("start"in e))}function Tt(e){return!(!e||"object"!=typeof e||!("value"in e)||"number"!=typeof e.value)}function Ct(e,t){return Math.abs(e.value-t.value)<.01&&(e.unit===t.unit||e.code===t.code||e.unit===t.code||e.code===t.unit)}function Pt(e,t){const i=Object.keys(e),n=Object.keys(t);if(i.length!==n.length)return!1;for(const n of i){const i=e[n],o=t[n];if(Rt(i)&&Rt(o)){if(!Pt(i,o))return!1}else if(i!==o)return!1}return!0}function Rt(e){return null!==e&&"object"==typeof e}ke=new WeakMap,Me=new WeakMap,Ie=new WeakMap,Oe=new WeakMap,Ue=new WeakMap,Le=new WeakMap,je=new WeakMap,Ne=new WeakMap,_e=new WeakMap,We=new WeakMap,Qe=new WeakMap,Be=new WeakMap,qe=new WeakMap,$e=new WeakMap,Fe=new WeakMap,He=new WeakMap,ze=new WeakMap,Ae=new WeakSet,Ge=function(e){const i=this.getLogins().filter((t=>{var i,n;return(null===(i=t.profile)||void 0===i?void 0:i.reference)!==(null===(n=e.profile)||void 0===n?void 0:n.reference)}));i.push(e),t(this,Ie,"f").setObject("logins",i)},Ve=function(){return e(this,void 0,void 0,(function*(){return i(this,Fe,new Promise(((e,n)=>{this.get("auth/me").then((n=>{i(this,Fe,void 0,"f"),i(this,He,n.profile,"f"),i(this,ze,n.config,"f"),this.dispatchEvent({type:"change"}),e(t(this,He,"f"))})).catch(n)})),"f"),t(this,Fe,"f")}))},Xe=function(e,i){if(t(this,Ue,"f")<=0||"no-cache"===(null==i?void 0:i.cache)||"reload"===(null==i?void 0:i.cache))return;const n=t(this,Oe,"f").get(e);return!n||n.requestTime+t(this,Ue,"f")<Date.now()?void 0:n},Ye=function(e,i){t(this,Ue,"f")>0&&t(this,Oe,"f").set(e,{requestTime:Date.now(),value:i})},Je=function(i,n,o={}){return e(this,void 0,void 0,(function*(){t(this,$e,"f")&&(yield t(this,$e,"f")),n.startsWith("http")||(n=t(this,Le,"f")+n),o.method=i,t(this,Ae,"m",Ze).call(this,o);const e=yield t(this,ke,"f").call(this,n,o);if(401===e.status)return t(this,Ae,"m",tt).call(this,i,n,o);if(204===e.status||304===e.status)return;const r=yield e.json();if(e.status>=400)throw r;return r}))},Ze=function(e){e.headers||(e.headers={});const i=e.headers;i["X-Medplum"]="extended",i["Content-Type"]||(i["Content-Type"]="application/fhir+json"),t(this,Be,"f")&&(i.Authorization="Bearer "+t(this,Be,"f")),e.cache||(e.cache="no-cache"),e.credentials||(e.credentials="include")},Ke=function(e,t){e.headers||(e.headers={});e.headers["Content-Type"]=t},et=function(e,t){"string"==typeof t||"undefined"!=typeof Blob&&t instanceof Blob||"undefined"!=typeof File&&t instanceof File||"undefined"!=typeof Uint8Array&&t instanceof Uint8Array?e.body=t:t&&(e.body=JSON.stringify(t))},tt=function(i,n,o){return e(this,void 0,void 0,(function*(){return t(this,Ae,"m",nt).call(this).then((()=>t(this,Ae,"m",Je).call(this,i,n,o))).catch((e=>(this.clear(),t(this,Qe,"f")&&t(this,Qe,"f").call(this),Promise.reject(e))))}))},it=function(){return e(this,void 0,void 0,(function*(){yield this.startPkce();const e=new URL(t(this,Ne,"f"));e.searchParams.set("response_type","code"),e.searchParams.set("state",sessionStorage.getItem("pkceState")),e.searchParams.set("client_id",t(this,je,"f")),e.searchParams.set("redirect_uri",dt()),e.searchParams.set("scope",st),e.searchParams.set("code_challenge_method","S256"),e.searchParams.set("code_challenge",sessionStorage.getItem("codeChallenge")),window.location.assign(e.toString())}))},nt=function(){return e(this,void 0,void 0,(function*(){if(t(this,$e,"f"))return t(this,$e,"f");if(!t(this,qe,"f"))throw this.clear(),new Error("Invalid refresh token");const e=new URLSearchParams;e.set("grant_type","refresh_token"),e.set("client_id",t(this,je,"f")),e.set("refresh_token",t(this,qe,"f")),i(this,$e,t(this,Ae,"m",ot).call(this,e),"f"),yield t(this,$e,"f")}))},ot=function(i){return e(this,void 0,void 0,(function*(){return t(this,ke,"f").call(this,t(this,_e,"f"),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:i,credentials:"include"}).then((e=>{if(!e.ok)throw new Error("Failed to fetch tokens");return e.json()})).then((e=>t(this,Ae,"m",rt).call(this,e))).then((()=>this.getProfile()))}))},rt=function(i){return e(this,void 0,void 0,(function*(){const e=i.access_token,n=fe(e);if(Date.now()>=1e3*n.exp)throw this.clear(),new Error("Token expired");if(t(this,je,"f")&&n.client_id!==t(this,je,"f"))throw this.clear(),new Error("Token was not issued for this audience");yield this.setActiveLogin({accessToken:e,refreshToken:i.refresh_token,project:i.project,profile:i.profile})}))},at=function(){try{window.addEventListener("storage",(e=>{null!==e.key&&"activeLogin"!==e.key||window.location.reload()}))}catch(e){}};const At=()=>[],kt={empty:e=>ut(0===e.length),exists:(e,t)=>ut(t?e.filter((e=>ht(t.eval([e])))).length>0:e.length>0),all:(e,t)=>ut(e.every((e=>ht(t.eval([e]))))),allTrue:e=>{for(const t of e)if(!t.value)return ut(!1);return ut(!0)},anyTrue:e=>{for(const t of e)if(t.value)return ut(!0);return ut(!1)},allFalse:e=>{for(const t of e)if(t.value)return ut(!1);return ut(!0)},anyFalse:e=>{for(const t of e)if(!t.value)return ut(!0);return ut(!1)},subsetOf:At,supersetOf:At,count:e=>[{type:ve.integer,value:e.length}],distinct:e=>{const t=[];for(const i of e)t.some((e=>e.value===i.value))||t.push(i);return t},isDistinct:e=>ut(e.length===kt.distinct(e).length),where:(e,t)=>e.filter((e=>ht(t.eval([e])))),select:(e,t)=>e.map((e=>t.eval([e]))).flat(),repeat:At,ofType:(e,t)=>e.filter((e=>e.type===t.name)),single:e=>{if(e.length>1)throw new Error("Expected input length one for single()");return 0===e.length?[]:e.slice(0,1)},first:e=>0===e.length?[]:e.slice(0,1),last:e=>0===e.length?[]:e.slice(e.length-1,e.length),tail:e=>0===e.length?[]:e.slice(1,e.length),skip:(e,t)=>{var i;const n=null===(i=t.eval(e)[0])||void 0===i?void 0:i.value;if("number"!=typeof n)throw new Error("Expected a number for skip(num)");return n>=e.length?[]:n<=0?e:e.slice(n,e.length)},take:(e,t)=>{var i;const n=null===(i=t.eval(e)[0])||void 0===i?void 0:i.value;if("number"!=typeof n)throw new Error("Expected a number for take(num)");return n>=e.length?e:n<=0?[]:e.slice(0,n)},intersect:(e,t)=>{if(!t)return e;const i=t.eval(e),n=[];for(const t of e)!n.some((e=>e.value===t.value))&&i.some((e=>e.value===t.value))&&n.push(t);return n},exclude:(e,t)=>{if(!t)return e;const i=t.eval(e),n=[];for(const t of e)i.some((e=>e.value===t.value))||n.push(t);return n},union:(e,t)=>{if(!t)return e;const i=t.eval(e);return yt([...e,...i])},combine:(e,t)=>{if(!t)return e;const i=t.eval(e);return[...e,...i]},iif:(e,t,i,n)=>{const o=t.eval(e);if(o.length>1||1===o.length&&"boolean"!=typeof o[0].value)throw new Error("Expected criterion to evaluate to a Boolean");return ht(o)?i.eval(e):n?n.eval(e):[]},toBoolean:e=>{if(0===e.length)return[];const[{value:t}]=Ot(e,1);if("boolean"==typeof t)return[{type:ve.boolean,value:t}];if("number"==typeof t&&(0===t||1===t))return ut(!!t);if("string"==typeof t){const e=t.toLowerCase();if(["true","t","yes","y","1","1.0"].includes(e))return ut(!0);if(["false","f","no","n","0","0.0"].includes(e))return ut(!1)}return[]},convertsToBoolean:e=>0===e.length?[]:ut(1===kt.toBoolean(e).length),toInteger:e=>{if(0===e.length)return[];const[{value:t}]=Ot(e,1);return"number"==typeof t?[{type:ve.integer,value:t}]:"string"==typeof t&&t.match(/^[+-]?\d+$/)?[{type:ve.integer,value:parseInt(t,10)}]:"boolean"==typeof t?[{type:ve.integer,value:t?1:0}]:[]},convertsToInteger:e=>0===e.length?[]:ut(1===kt.toInteger(e).length),toDate:e=>{if(0===e.length)return[];const[{value:t}]=Ot(e,1);return"string"==typeof t&&t.match(/^\d{4}(-\d{2}(-\d{2})?)?/)?[{type:ve.date,value:lt(t)}]:[]},convertsToDate:e=>0===e.length?[]:ut(1===kt.toDate(e).length),toDateTime:e=>{if(0===e.length)return[];const[{value:t}]=Ot(e,1);return"string"==typeof t&&t.match(/^\d{4}(-\d{2}(-\d{2})?)?/)?[{type:ve.dateTime,value:lt(t)}]:[]},convertsToDateTime:e=>0===e.length?[]:ut(1===kt.toDateTime(e).length),toDecimal:e=>{if(0===e.length)return[];const[{value:t}]=Ot(e,1);return"number"==typeof t?[{type:ve.decimal,value:t}]:"string"==typeof t&&t.match(/^-?\d{1,9}(\.\d{1,9})?$/)?[{type:ve.decimal,value:parseFloat(t)}]:"boolean"==typeof t?[{type:ve.decimal,value:t?1:0}]:[]},convertsToDecimal:e=>0===e.length?[]:ut(1===kt.toDecimal(e).length),toQuantity:e=>{if(0===e.length)return[];const[{value:t}]=Ot(e,1);return Tt(t)?[{type:ve.Quantity,value:t}]:"number"==typeof t?[{type:ve.Quantity,value:{value:t,unit:"1"}}]:"string"==typeof t&&t.match(/^-?\d{1,9}(\.\d{1,9})?/)?[{type:ve.Quantity,value:{value:parseFloat(t),unit:"1"}}]:"boolean"==typeof t?[{type:ve.Quantity,value:{value:t?1:0,unit:"1"}}]:[]},convertsToQuantity:e=>0===e.length?[]:ut(1===kt.toQuantity(e).length),toString:e=>{if(0===e.length)return[];const[{value:t}]=Ot(e,1);return null==t?[]:Tt(t)?[{type:ve.string,value:`${t.value} '${t.unit}'`}]:[{type:ve.string,value:t.toString()}]},convertsToString:e=>0===e.length?[]:ut(1===kt.toString(e).length),toTime:e=>{if(0===e.length)return[];const[{value:t}]=Ot(e,1);if("string"==typeof t){const e=t.match(/^T?(\d{2}(:\d{2}(:\d{2})?)?)/);if(e)return[{type:ve.time,value:lt("T"+e[1])}]}return[]},convertsToTime:e=>0===e.length?[]:ut(1===kt.toTime(e).length),indexOf:(e,t)=>Mt(((e,t)=>e.indexOf(t)),e,t),substring:(e,t,i)=>Mt(((e,t,i)=>{const n=t,o=i?n+i:e.length;return n<0||n>=e.length?void 0:e.substring(n,o)}),e,t,i),startsWith:(e,t)=>Mt(((e,t)=>e.startsWith(t)),e,t),endsWith:(e,t)=>Mt(((e,t)=>e.endsWith(t)),e,t),contains:(e,t)=>Mt(((e,t)=>e.includes(t)),e,t),upper:e=>Mt((e=>e.toUpperCase()),e),lower:e=>Mt((e=>e.toLowerCase()),e),replace:(e,t,i)=>Mt(((e,t,i)=>e.replaceAll(t,i)),e,t,i),matches:(e,t)=>Mt(((e,t)=>!!e.match(t)),e,t),replaceMatches:(e,t,i)=>Mt(((e,t,i)=>e.replaceAll(t,i)),e,t,i),length:e=>Mt((e=>e.length),e),toChars:e=>Mt((e=>e?e.split(""):void 0),e),abs:e=>It(Math.abs,e),ceiling:e=>It(Math.ceil,e),exp:e=>It(Math.exp,e),floor:e=>It(Math.floor,e),ln:e=>It(Math.log,e),log:(e,t)=>It(((e,t)=>Math.log(e)/Math.log(t)),e,t),power:(e,t)=>It(Math.pow,e,t),round:e=>It(Math.round,e),sqrt:e=>It(Math.sqrt,e),truncate:e=>It((e=>0|e),e),children:At,descendants:At,trace:(e,t)=>(console.log("trace",e,t),e),now:()=>[{type:ve.dateTime,value:(new Date).toISOString()}],timeOfDay:()=>[{type:ve.time,value:(new Date).toISOString().substring(11)}],today:()=>[{type:ve.date,value:(new Date).toISOString().substring(0,10)}],between:(e,t,i,n)=>{var o;const r=kt.toDateTime(t.eval(e));if(0===r.length)throw new Error("Invalid start date");const a=kt.toDateTime(i.eval(e));if(0===a.length)throw new Error("Invalid end date");const s=null===(o=n.eval(e)[0])||void 0===o?void 0:o.value;if("years"!==s&&"months"!==s&&"days"!==s)throw new Error("Invalid units");const c=A(r[0].value,a[0].value);return[{type:ve.Quantity,value:{value:c[s],unit:s}}]},is:(e,t)=>{let i="";return t instanceof yi?i=t.name:t instanceof Di&&(i=t.left.name+"."+t.right.name),i?e.map((e=>({type:ve.boolean,value:bt(e,i)}))):[]},not:e=>kt.toBoolean(e).map((e=>({type:ve.boolean,value:!e.value}))),resolve:e=>e.map((e=>{const t=e.value;let i;if("string"==typeof t)i=t;else if("object"==typeof t){const e=t;if(e.resource)return mt(e.resource);i=e.reference}if(!i)return{type:ve.BackboneElement,value:null};const[n,o]=i.split("/");return{type:ve.BackboneElement,value:{resourceType:n,id:o}}})).filter((e=>!!e.value)),as:e=>e,type:e=>e.map((({value:e})=>"boolean"==typeof e?{type:ve.BackboneElement,value:{namespace:"System",name:"Boolean"}}:"number"==typeof e?{type:ve.BackboneElement,value:{namespace:"System",name:"Integer"}}:e&&"object"==typeof e&&"resourceType"in e?{type:ve.BackboneElement,value:{namespace:"FHIR",name:e.resourceType}}:{type:ve.BackboneElement,value:null})),conformsTo:(e,t)=>{const i=t.eval(e)[0].value;if(!i.startsWith("http://hl7.org/fhir/StructureDefinition/"))throw new Error("Expected a StructureDefinition URL");const n=i.replace("http://hl7.org/fhir/StructureDefinition/","");return e.map((e=>{var t;return{type:ve.boolean,value:(null===(t=e.value)||void 0===t?void 0:t.resourceType)===n}}))}};function Mt(e,t,...i){if(0===t.length)return[];const[{value:n}]=Ot(t,1);if("string"!=typeof n)throw new Error("String function cannot be called with non-string");const o=e(n,...i.map((e=>{var i,n;return e&&(null===(n=null===(i=e.eval(t))||void 0===i?void 0:i[0])||void 0===n?void 0:n.value)})));return void 0===o?[]:Array.isArray(o)?o.map(mt):[mt(o)]}function It(e,t,...i){if(0===t.length)return[];const[{value:n}]=Ot(t,1),o=Tt(n),r=o?n.value:n;if("number"!=typeof r)throw new Error("Math function cannot be called with non-number");const a=e(r,...i.map((e=>{var i,n;return null===(n=null===(i=e.eval(t))||void 0===i?void 0:i[0])||void 0===n?void 0:n.value})));return[{type:o?ve.Quantity:t[0].type,value:o?Object.assign(Object.assign({},n),{value:a}):a}]}function Ot(e,t){if(e.length!==t)throw new Error(`Expected ${t} arguments`);for(const t of e)if(null==t)throw new Error("Expected non-null argument");return e}var Ut,Lt,jt,Nt,_t,Wt,Qt,Bt,qt,$t,Ft,Ht,zt,Gt,Vt,Xt,Yt,Jt,Zt,Kt,ei,ti,ii,ni,oi,ri,ai,si,ci,di,li,ui,mi,hi;class pi{constructor(e,t){this.original=e,this.child=t}eval(e){try{return e.length>0?e.map((e=>this.child.eval([e]))).flat():this.child.eval([])}catch(e){throw new Error(`FhirPathError on "${this.original}": ${e}`)}}}class fi{constructor(e){this.value=e}eval(){return[this.value]}}class yi{constructor(e){this.name=e,Ut.add(this)}eval(e){return"$this"===this.name?e:e.map((e=>t(this,Ut,"m",Lt).call(this,e))).flat().filter((e=>void 0!==(null==e?void 0:e.value)))}}Ut=new WeakSet,Lt=function(e){const t=e.value;if(t&&"object"==typeof t)return"resourceType"in t&&t.resourceType===this.name?e:pt(e,this.name)};class gi{eval(){return[]}}class xi{constructor(e,t){this.child=e,this.impl=t}eval(e){return this.impl(this.child.eval(e))}}class vi{constructor(e,t){this.left=e,this.right=t}eval(e){return kt.ofType(this.left.eval(e),this.right)}}class wi{constructor(e,t,i){this.left=e,this.right=t,this.impl=i}eval(e){const t=this.left.eval(e);if(1!==t.length)return[];const i=this.right.eval(e);if(1!==i.length)return[];const n=t[0].value,o=i[0].value,r=Tt(n)?n.value:n,a=Tt(o)?o.value:o,s=this.impl(r,a);return"boolean"==typeof s?ut(s):Tt(n)?[{type:ve.Quantity,value:Object.assign(Object.assign({},n),{value:s})}]:[mt(s)]}}class Ei{constructor(e,t){this.left=e,this.right=t}eval(e){const t=[...this.left.eval(e),...this.right.eval(e)];return t.length>0&&t.every((e=>"string"==typeof e.value))?[{type:ve.string,value:t.map((e=>e.value)).join("")}]:t}}class Si{constructor(e,t){this.left=e,this.right=t}eval(e){const t=this.left.eval(e),i=this.right.eval(e);return ut(t.some((e=>e.value===i[0].value)))}}class bi{constructor(e,t){this.left=e,this.right=t}eval(e){const t=this.left.eval(e);return ut(this.right.eval(e).some((e=>e.value===t[0].value)))}}class Di{constructor(e,t){this.left=e,this.right=t}eval(e){return this.right.eval(this.left.eval(e))}}class Ti{constructor(e,t){this.left=e,this.right=t}eval(e){return yt([...this.left.eval(e),...this.right.eval(e)])}}class Ci{constructor(e,t){this.left=e,this.right=t}eval(e){return xt(this.left.eval(e),this.right.eval(e))}}class Pi{constructor(e,t){this.left=e,this.right=t}eval(e){return gt(xt(this.left.eval(e),this.right.eval(e)))}}class Ri{constructor(e,t){this.left=e,this.right=t}eval(e){return wt(this.left.eval(e),this.right.eval(e))}}class Ai{constructor(e,t){this.left=e,this.right=t}eval(e){return gt(wt(this.left.eval(e),this.right.eval(e)))}}class ki{constructor(e,t){this.left=e,this.right=t}eval(e){const t=this.left.eval(e);if(1!==t.length)return[];const i=this.right.name;return ut(bt(t[0],i))}}class Mi{constructor(e,t){this.left=e,this.right=t}eval(e){var t,i,n,o;const r=this.left.eval(e),a=this.right.eval(e);return!0===(null===(t=r[0])||void 0===t?void 0:t.value)&&!0===(null===(i=a[0])||void 0===i?void 0:i.value)?ut(!0):!1===(null===(n=r[0])||void 0===n?void 0:n.value)||!1===(null===(o=a[0])||void 0===o?void 0:o.value)?ut(!1):[]}}class Ii{constructor(e,t){this.left=e,this.right=t}eval(e){const t=this.left.eval(e);if(ht(t))return t;const i=this.right.eval(e);return ht(i)?i:[]}}class Oi{constructor(e,t){this.left=e,this.right=t}eval(e){const t=this.left.eval(e),i=this.right.eval(e);if(0===t.length&&0===i.length)return[];const n=0===t.length?null:t[0].value,o=0===i.length?null:i[0].value;return!0===n&&!0!==o||!0!==n&&!0===o?ut(!0):!0===n&&!0===o||!1===n&&!1===o?ut(!1):[]}}class Ui{constructor(e,t,i){this.name=e,this.args=t,this.impl=i}eval(e){return this.impl(e,...this.args)}}class Li{constructor(e,t){this.left=e,this.expr=t}eval(e){const t=this.expr.eval(e);if(1!==t.length)return[];const i=t[0].value;if("number"!=typeof i)throw new Error("Invalid indexer expression: should return integer}");const n=this.left.eval(e);return i in n?[n[i]]:[]}}class ji{constructor(){jt.set(this,{}),Nt.set(this,{})}registerInfix(e,i){return t(this,Nt,"f")[e]=i,this}registerPrefix(e,i){return t(this,jt,"f")[e]=i,this}prefix(e,t,i){return this.registerPrefix(e,{parse(e,n){const o=e.consumeAndParse(t);return i(n,o)}})}infixLeft(e,t,i){return this.registerInfix(e,{parse(e,n,o){const r=e.consumeAndParse(t);return i(n,o,r)},precedence:t})}construct(e){return new Ni(e,t(this,jt,"f"),t(this,Nt,"f"))}}jt=new WeakMap,Nt=new WeakMap;class Ni{constructor(e,t,n){_t.set(this,void 0),Wt.set(this,void 0),Qt.set(this,void 0),i(this,_t,e,"f"),i(this,Wt,t,"f"),i(this,Qt,n,"f")}hasMore(){return t(this,_t,"f").length>0}match(e){const t=this.peek();return(null==t?void 0:t.id)===e&&(this.consume(),!0)}consumeAndParse(e=1/0){const i=this.consume(),n=t(this,Wt,"f")[i.id];if(!n)throw Error(`Parse error at "${i.value}" (line ${i.line}, column ${i.column}). No matching prefix parselet.`);let o=n.parse(this,i);for(;e>this.getPrecedence();){const e=this.consume();o=t(this,Qt,"f")[e.id].parse(this,o,e)}return o}getPrecedence(){const e=this.peek();if(!e)return 1/0;const i=t(this,Qt,"f")[e.id];return i?i.precedence:1/0}consume(e){var i;if(!t(this,_t,"f").length)throw Error("Cant consume unknown more tokens.");if(e&&(null===(i=this.peek())||void 0===i?void 0:i.id)!==e){const t=this.peek();throw Error(`Expected ${e} but got "${t.value}" at line ${t.line} column ${t.column}.`)}return t(this,_t,"f").shift()}peek(){return t(this,_t,"f").length>0?t(this,_t,"f")[0]:void 0}removeComments(){i(this,_t,t(this,_t,"f").filter((e=>"Comment"!==e.id)),"f")}}_t=new WeakMap,Wt=new WeakMap,Qt=new WeakMap;const _i=["year","years","month","months","week","weeks","day","days","hour","hours","minute","minutes","second","seconds","millisecond","milliseconds"];class Wi{constructor(e,t,n){Bt.add(this),qt.set(this,void 0),$t.set(this,void 0),Ft.set(this,void 0),Ht.set(this,[]),zt.set(this,{index:0,line:0,column:0}),Gt.set(this,[]),i(this,qt,e,"f"),i(this,$t,t,"f"),i(this,Ft,n,"f")}tokenize(){for(;t(this,zt,"f").index<t(this,qt,"f").length;){const e=t(this,Bt,"m",Yt).call(this);e&&t(this,Ht,"f").push(e)}return t(this,Ht,"f")}}qt=new WeakMap,$t=new WeakMap,Ft=new WeakMap,Ht=new WeakMap,zt=new WeakMap,Gt=new WeakMap,Bt=new WeakSet,Vt=function(){return t(this,Ht,"f").slice(-1)[0]},Xt=function(){t(this,Bt,"m",li).call(this);const e=t(this,Bt,"m",Yt).call(this);return t(this,Bt,"m",ui).call(this),e},Yt=function(){t(this,Bt,"m",Jt).call(this);const e=t(this,Bt,"m",si).call(this);if(!e)return;t(this,Bt,"m",li).call(this);const i=t(this,Bt,"m",di).call(this);return"/"===e&&"*"===i?t(this,Bt,"m",Zt).call(this):"/"===e&&"/"===i?t(this,Bt,"m",Kt).call(this):"'"===e||'"'===e?t(this,Bt,"m",ei).call(this,e):"`"===e?t(this,Bt,"m",ti).call(this):"@"===e?t(this,Bt,"m",ii).call(this):e.match(/\d/)?t(this,Bt,"m",ni).call(this):e.match(/\w/)||"$"===e&&i.match(/\w/)?t(this,Bt,"m",oi).call(this):t(this,Bt,"m",ri).call(this)},Jt=function(){t(this,Bt,"m",ai).call(this,(()=>t(this,Bt,"m",si).call(this).match(/\s/)))},Zt=function(){const e=t(this,zt,"f").index;return t(this,Bt,"m",ai).call(this,(()=>"*"!==t(this,Bt,"m",si).call(this)||"/"!==t(this,Bt,"m",di).call(this))),t(this,Bt,"m",mi).call(this),t(this,Bt,"m",mi).call(this),t(this,Bt,"m",hi).call(this,"Comment",t(this,qt,"f").substring(e,t(this,zt,"f").index))},Kt=function(){return t(this,Bt,"m",hi).call(this,"Comment",t(this,Bt,"m",ai).call(this,(()=>"\n"!==t(this,Bt,"m",si).call(this))))},ei=function(e){t(this,Bt,"m",mi).call(this);const i=t(this,Bt,"m",hi).call(this,"String",t(this,Bt,"m",ai).call(this,(()=>"\\"===t(this,Bt,"m",ci).call(this)||t(this,Bt,"m",si).call(this)!==e)));return t(this,Bt,"m",mi).call(this),i},ti=function(){t(this,Bt,"m",mi).call(this);const e=t(this,Bt,"m",hi).call(this,"Symbol",t(this,Bt,"m",ai).call(this,(()=>"`"!==t(this,Bt,"m",si).call(this))));return t(this,Bt,"m",mi).call(this),e},ii=function(){t(this,Bt,"m",mi).call(this);const e=t(this,zt,"f").index;return t(this,Bt,"m",ai).call(this,(()=>t(this,Bt,"m",si).call(this).match(/[\d-]/))),"T"===t(this,Bt,"m",si).call(this)&&(t(this,Bt,"m",mi).call(this),t(this,Bt,"m",ai).call(this,(()=>t(this,Bt,"m",si).call(this).match(/[\d:]/))),"."===t(this,Bt,"m",si).call(this)&&t(this,Bt,"m",di).call(this).match(/\d/)&&(t(this,Bt,"m",mi).call(this),t(this,Bt,"m",ai).call(this,(()=>t(this,Bt,"m",si).call(this).match(/\d/)))),"Z"===t(this,Bt,"m",si).call(this)?t(this,Bt,"m",mi).call(this):"+"!==t(this,Bt,"m",si).call(this)&&"-"!==t(this,Bt,"m",si).call(this)||(t(this,Bt,"m",mi).call(this),t(this,Bt,"m",ai).call(this,(()=>t(this,Bt,"m",si).call(this).match(/[\d:]/))))),t(this,Bt,"m",hi).call(this,"DateTime",t(this,qt,"f").substring(e,t(this,zt,"f").index))},ni=function(){const e=t(this,zt,"f").index;let i="Number";return t(this,Bt,"m",ai).call(this,(()=>t(this,Bt,"m",si).call(this).match(/\d/))),"."===t(this,Bt,"m",si).call(this)&&t(this,Bt,"m",di).call(this).match(/\d/)&&(t(this,Bt,"m",mi).call(this),t(this,Bt,"m",ai).call(this,(()=>t(this,Bt,"m",si).call(this).match(/\d/))))," "===t(this,Bt,"m",si).call(this)&&function(e){if(e){if("String"===e.id)return!0;if("Symbol"===e.id&&_i.includes(e.value))return!0}return!1}(t(this,Bt,"m",Xt).call(this))&&(i="Quantity",t(this,Bt,"m",Yt).call(this)),t(this,Bt,"m",hi).call(this,i,t(this,qt,"f").substring(e,t(this,zt,"f").index))},oi=function(){var e;const i=t(this,Bt,"m",ai).call(this,(()=>t(this,Bt,"m",si).call(this).match(/[$\w]/)));return"."!==(null===(e=t(this,Bt,"m",Vt).call(this))||void 0===e?void 0:e.value)&&t(this,$t,"f").includes(i)?t(this,Bt,"m",hi).call(this,i,i):t(this,Bt,"m",hi).call(this,"Symbol",i)},ri=function(){const e=t(this,Bt,"m",si).call(this),i=e+t(this,Bt,"m",di).call(this);return t(this,Ft,"f").includes(i)?(t(this,Bt,"m",mi).call(this),t(this,Bt,"m",mi).call(this),t(this,Bt,"m",hi).call(this,i,i)):(t(this,Bt,"m",mi).call(this),t(this,Bt,"m",hi).call(this,e,e))},ai=function(e){const i=t(this,zt,"f").index;for(;t(this,zt,"f").index<t(this,qt,"f").length&&e();)t(this,Bt,"m",mi).call(this);return t(this,qt,"f").substring(i,t(this,zt,"f").index)},si=function(){return t(this,qt,"f")[t(this,zt,"f").index]},ci=function(){var e;return null!==(e=t(this,qt,"f")[t(this,zt,"f").index-1])&&void 0!==e?e:""},di=function(){var e;return null!==(e=t(this,qt,"f")[t(this,zt,"f").index+1])&&void 0!==e?e:""},li=function(){t(this,Gt,"f").push(Object.assign({},t(this,zt,"f")))},ui=function(){const e=t(this,Gt,"f").pop();if(!e)throw new Error("No mark to reset to");t(this,zt,"f").index=e.index,t(this,zt,"f").line=e.line,t(this,zt,"f").column=e.column},mi=function(){t(this,zt,"f").index++,"\n"===t(this,Bt,"m",si).call(this)?(t(this,zt,"f").line++,t(this,zt,"f").column=0):t(this,zt,"f").column++},hi=function(e,i){const n=t(this,Gt,"f").pop();if(!n)throw new Error("No mark for token");return Object.assign({id:e,value:i},n)};const Qi=["true","false","and","as","contains","div","in","is","mod","or","xor"],Bi=["!=","!~","<=",">=","{}","->"];function qi(e){return new Wi(e,Qi,Bi).tokenize()}const $i={parse(e){const t=e.consumeAndParse();if(!e.match(")"))throw new Error("Parse error: expected `)`");return t}},Fi={parse(e,t){const i=e.consumeAndParse();if(!e.match("]"))throw new Error("Parse error: expected `]`");return new Li(t,i)},precedence:2},Hi={parse(e,t){if(!(t instanceof yi))throw new Error("Unexpected parentheses");if(!(t.name in kt))throw new Error("Unrecognized function: "+t.name);const i=[];for(;!e.match(")");)i.push(e.consumeAndParse()),e.match(",");return new Ui(t.name,i,kt[t.name])},precedence:0};function zi(e){const t=e.split(" "),i=parseFloat(t[0]);let n=t[1];return n=n&&n.startsWith("'")&&n.endsWith("'")?n.substring(1,n.length-1):"{"+n+"}",{value:i,unit:n}}function Gi(){return(new ji).registerPrefix("String",{parse:(e,t)=>new fi({type:ve.string,value:t.value})}).registerPrefix("DateTime",{parse:(e,t)=>new fi({type:ve.dateTime,value:lt(t.value)})}).registerPrefix("Quantity",{parse:(e,t)=>new fi({type:ve.Quantity,value:zi(t.value)})}).registerPrefix("Number",{parse:(e,t)=>new fi({type:ve.decimal,value:parseFloat(t.value)})}).registerPrefix("true",{parse:()=>new fi({type:ve.boolean,value:!0})}).registerPrefix("false",{parse:()=>new fi({type:ve.boolean,value:!1})}).registerPrefix("Symbol",{parse:(e,t)=>new yi(t.value)}).registerPrefix("{}",{parse:()=>new gi}).registerPrefix("(",$i).registerInfix("[",Fi).registerInfix("(",Hi).prefix("+",3,((e,t)=>new xi(t,(e=>e)))).prefix("-",3,((e,t)=>new wi(t,t,((e,t)=>-t)))).infixLeft(".",1,((e,t,i)=>new Di(e,i))).infixLeft("/",4,((e,t,i)=>new wi(e,i,((e,t)=>e/t)))).infixLeft("*",4,((e,t,i)=>new wi(e,i,((e,t)=>e*t)))).infixLeft("+",5,((e,t,i)=>new wi(e,i,((e,t)=>e+t)))).infixLeft("-",5,((e,t,i)=>new wi(e,i,((e,t)=>e-t)))).infixLeft("|",7,((e,t,i)=>new Ti(e,i))).infixLeft("=",9,((e,t,i)=>new Ci(e,i))).infixLeft("!=",9,((e,t,i)=>new Pi(e,i))).infixLeft("~",9,((e,t,i)=>new Ri(e,i))).infixLeft("!~",9,((e,t,i)=>new Ai(e,i))).infixLeft("<",8,((e,t,i)=>new wi(e,i,((e,t)=>e<t)))).infixLeft("<=",8,((e,t,i)=>new wi(e,i,((e,t)=>e<=t)))).infixLeft(">",8,((e,t,i)=>new wi(e,i,((e,t)=>e>t)))).infixLeft(">=",8,((e,t,i)=>new wi(e,i,((e,t)=>e>=t)))).infixLeft("&",5,((e,t,i)=>new Ei(e,i))).infixLeft("and",6,((e,t,i)=>new Mi(e,i))).infixLeft("as",6,((e,t,i)=>new vi(e,i))).infixLeft("contains",6,((e,t,i)=>new Si(e,i))).infixLeft("div",6,((e,t,i)=>new wi(e,i,((e,t)=>e/t|0)))).infixLeft("in",6,((e,t,i)=>new bi(e,i))).infixLeft("is",6,((e,t,i)=>new ki(e,i))).infixLeft("mod",6,((e,t,i)=>new wi(e,i,((e,t)=>e%t)))).infixLeft("or",6,((e,t,i)=>new Ii(e,i))).infixLeft("xor",6,((e,t,i)=>new Oi(e,i)))}const Vi=Gi();function Xi(e){return new pi(e,Vi.construct(qi(e)).consumeAndParse())}function Yi(e,t){const i=Array.isArray(t)?t:[t];for(let e=0;e<i.length;e++){const t=i[e];"object"==typeof t&&"type"in t&&"value"in t||(i[e]=mt(i[e]))}return Ji(e,i).map((e=>e.value))}function Ji(e,t){return Xi(e).eval(t)}const Zi="\r",Ki="|",en="^";class tn{constructor(e){this.segments=e}get(e){return"number"==typeof e?this.segments[e]:this.segments.find((t=>t.name===e))}getAll(e){return this.segments.filter((t=>t.name===e))}toString(){return this.segments.map((e=>e.toString())).join("\r")}buildAck(){var e,t,i,n,o,r;const a=new Date,s=this.get("MSH"),c=(null===(e=null==s?void 0:s.get(2))||void 0===e?void 0:e.toString())||"",d=(null===(t=null==s?void 0:s.get(3))||void 0===t?void 0:t.toString())||"",l=(null===(i=null==s?void 0:s.get(4))||void 0===i?void 0:i.toString())||"",u=(null===(n=null==s?void 0:s.get(5))||void 0===n?void 0:n.toString())||"",m=(null===(o=null==s?void 0:s.get(9))||void 0===o?void 0:o.toString())||"",h=(null===(r=null==s?void 0:s.get(12))||void 0===r?void 0:r.toString())||"2.5.1";return new tn([new nn(["MSH","^~\\&",l,u,c,d,a.toISOString(),"","ACK",a.getTime().toString(),"P",h]),new nn(["MSA","AA",m,"OK"])])}static parse(e){if(!e.startsWith("MSH|^~\\&")){const e=new Error("Invalid HL7 message");throw e.type="entity.parse.failed",e}return new tn(e.split(/[\r\n]+/).map((e=>nn.parse(e))))}}class nn{constructor(e){q(e)?this.fields=e.map((e=>on.parse(e))):this.fields=e,this.name=this.fields[0].components[0]}get(e){return this.fields[e]}toString(){return this.fields.map((e=>e.toString())).join("|")}static parse(e){return new nn(e.split("|").map((e=>on.parse(e))))}}class on{constructor(e){this.components=e}get(e){return this.components[e]}toString(){return this.components.join("^")}static parse(e){return new on(e.split("^"))}}const rn={resourceType:"OperationOutcome",id:"ok",issue:[{severity:"information",code:"informational",details:{text:"All OK"}}]},an={resourceType:"OperationOutcome",id:"created",issue:[{severity:"information",code:"informational",details:{text:"Created"}}]},sn={resourceType:"OperationOutcome",id:"not-modified",issue:[{severity:"information",code:"informational",details:{text:"Not Modified"}}]},cn={resourceType:"OperationOutcome",id:"not-found",issue:[{severity:"error",code:"not-found",details:{text:"Not found"}}]},dn={resourceType:"OperationOutcome",id:"unauthorized",issue:[{severity:"error",code:"login",details:{text:"Unauthorized"}}]},ln={resourceType:"OperationOutcome",id:"forbidden",issue:[{severity:"error",code:"forbidden",details:{text:"Forbidden"}}]},un={resourceType:"OperationOutcome",id:"gone",issue:[{severity:"error",code:"deleted",details:{text:"Gone"}}]},mn={resourceType:"OperationOutcome",id:"too-many-requests",issue:[{severity:"error",code:"throttled",details:{text:"Too Many Requests"}}]};function hn(e,t){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"invalid",details:{text:e},expression:t?[t]:void 0}]}}function pn(e){return"ok"===e.id||"created"===e.id||"not-modified"===e.id}function fn(e){return"not-found"===e.id}function yn(e){return"gone"===e.id}function gn(e){return"ok"===e.id?200:"created"===e.id?201:"not-modified"===e.id?304:"unauthorized"===e.id?401:"forbidden"===e.id?403:"not-found"===e.id?404:"gone"===e.id?410:"too-many-requests"===e.id?429:400}function xn(e,t){if(!pn(e)||void 0===t)throw new vn(e)}class vn extends Error{constructor(e){var t,i;super(null===(i=null===(t=null==e?void 0:e.issue)||void 0===t?void 0:t[0].details)||void 0===i?void 0:i.text),this.outcome=e}}function wn(e){var t,i,n,o;if(!e)return"Unknown error";if("string"==typeof e)return e;if(e instanceof Error)return e.message;if("object"==typeof e&&"resourceType"in e){return null!==(o=null===(n=null===(i=null===(t=e.issue)||void 0===t?void 0:t[0])||void 0===i?void 0:i.details)||void 0===n?void 0:n.text)&&void 0!==o?o:"Unknown error"}return JSON.stringify(e)}const En=20;var Sn;!function(e){e.EQUALS="eq",e.NOT_EQUALS="ne",e.GREATER_THAN="gt",e.LESS_THAN="lt",e.GREATER_THAN_OR_EQUALS="ge",e.LESS_THAN_OR_EQUALS="le",e.STARTS_AFTER="sa",e.ENDS_BEFORE="eb",e.APPROXIMATELY="ap",e.CONTAINS="contains",e.EXACT="exact",e.TEXT="text",e.NOT="not",e.ABOVE="above",e.BELOW="below",e.IN="in",e.NOT_IN="not-in",e.OF_TYPE="of-type",e.MISSING="missing"}(Sn||(Sn={}));const bn=[Sn.CONTAINS,Sn.EXACT,Sn.TEXT,Sn.NOT,Sn.ABOVE,Sn.BELOW,Sn.IN,Sn.NOT_IN,Sn.OF_TYPE,Sn.MISSING],Dn=[Sn.NOT_EQUALS,Sn.GREATER_THAN,Sn.LESS_THAN,Sn.GREATER_THAN_OR_EQUALS,Sn.LESS_THAN_OR_EQUALS,Sn.STARTS_AFTER,Sn.ENDS_BEFORE,Sn.APPROXIMATELY];function Tn(e){const t=new URL(e,"https://example.com/"),i=t.pathname.replace(/(^\/)|(\/$)/g,"").split("/").pop();let n,o,r,a,s,c;return new URLSearchParams(t.search).forEach(((e,t)=>{"_fields"===t?r=e.split(","):"_offset"===t?a=parseInt(e):"_count"===t?s=parseInt(e):"_total"===t?c=e:"_sort"===t?(o=o||[],o.push(function(e){return e.startsWith("-")?{code:e.substring(1),descending:!0}:{code:e}}(e))):(n=n||[],n.push(function(e,t){let i=e,n=Sn.EQUALS;for(const e of bn){const t=i.indexOf(":"+e);-1!==t&&(n=e,i=i.substring(0,t))}for(const e of Dn)t.match(new RegExp("^"+e+"\\d"))&&(n=e,t=t.substring(e.length));return{code:i,operator:n,value:t}}(t,e)))})),{resourceType:i,filters:n,fields:r,offset:a,count:s,total:c,sortRules:o}}function Cn(e){const t=[];return e.fields&&t.push("_fields="+e.fields.join(",")),e.filters&&e.filters.forEach((e=>t.push(function(e){const t=bn.includes(e.operator)?":"+e.operator:"",i=Dn.includes(e.operator)?e.operator:"";return`${e.code}${t}=${i}${encodeURIComponent(e.value)}`}(e)))),e.sortRules&&e.sortRules.length>0&&t.push(function(e){if(!e||0===e.length)return"";return"_sort="+e.map((e=>e.descending?"-"+e.code:e.code)).join(",")}(e.sortRules)),void 0!==e.offset&&t.push("_offset="+e.offset),void 0!==e.count&&t.push("_count="+e.count),void 0!==e.total&&t.push("_total="+e.total),0===t.length?"":(t.sort(),"?"+t.join("&"))}var Pn;function Rn(e,t){var i,n;let o=null===(n=null===(i=Re.types[e])||void 0===i?void 0:i.searchParamsDetails)||void 0===n?void 0:n[t.code];return o||(o=function(e,t){var i,n,o,r,a,s,c;if("_lastUpdated"===t.code)return{columnName:"lastUpdated",type:Pn.DATETIME};const d=t.code,l=function(e){return e.split("-").reduce(((e,t,i)=>e+(i?z(t):t)),"")}(d),u=null===(i=kn(e,t.expression))||void 0===i?void 0:i.split(".");if(!u)return{columnName:l,type:Pn.TEXT};const m=An(t);let h,p,f=e,y=!1;for(let i=1;i<u.length;i++){const d=u[i];if(h=null!==(r=null===(o=null===(n=Re.types[f])||void 0===n?void 0:n.properties)||void 0===o?void 0:o[d])&&void 0!==r?r:null===(s=null===(a=Re.types[f])||void 0===a?void 0:a.properties)||void 0===s?void 0:s[d+"[x]"],!h)throw new Error(`Element definition not found for ${e} ${t.code}`);if("*"===h.max&&(y=!0),p=null===(c=h.type)||void 0===c?void 0:c[0].code,!p)return{columnName:l,type:m,array:y};i<u.length-1&&("Element"===p||"BackboneElement"===p?f+=z(d):f=p)}const g=An(t,p),x={columnName:l,type:g,elementDefinition:h,array:y};return function(e,t,i){const n=Re.types[e];n.searchParamsDetails||(n.searchParamsDetails={});n.searchParamsDetails[t]=i}(e,d,x),x}(e,t)),o}function An(e,t){let i=Pn.TEXT;switch(e.type){case"date":i=t===ve.dateTime||t===ve.instant?Pn.DATETIME:Pn.DATE;break;case"number":i=Pn.NUMBER;break;case"quantity":i=Pn.QUANTITY;break;case"reference":i=Pn.REFERENCE;break;case"token":"boolean"===t&&(i=Pn.BOOLEAN)}return i}function kn(e,t){const i=t.split(" | ");for(const t of i){if((n=t).includes(" as Period")||n.includes(" as SampledDate"))continue;const i=Mn(t);if(i.startsWith(e+"."))return i}var n}function Mn(e){let t=e.trim();t.startsWith("(")&&t.endsWith(")")&&(t=t.substring(1,t.length-1)),t.includes("[0]")&&(t=t.replaceAll("[0]",""));const i=[" != "," as ",".as(",".exists(",".where("];for(const e of i)t.includes(e)&&(t=t.substring(0,t.indexOf(e)));return t}!function(e){e.BOOLEAN="BOOLEAN",e.NUMBER="NUMBER",e.QUANTITY="QUANTITY",e.TEXT="TEXT",e.REFERENCE="REFERENCE",e.DATE="DATE",e.DATETIME="DATETIME",e.PERIOD="PERIOD"}(Pn||(Pn={}));export{Mi as AndAtom,wi as ArithemticOperatorAtom,vi as AsAtom,en as COMPONENT_SEPARATOR,Ei as ConcatAtom,Si as ContainsAtom,En as DEFAULT_SEARCH_COUNT,Di as DotAtom,gi as EmptySetAtom,Ci as EqualsAtom,Ri as EquivalentAtom,Qi as FHIRPATH_KEYWORDS,Bi as FHIRPATH_OPERATORS,Ki as FIELD_SEPARATOR,pi as FhirPathAtom,Ui as FunctionAtom,on as Hl7Field,tn as Hl7Message,nn as Hl7Segment,bi as InAtom,Li as IndexerAtom,ki as IsAtom,s as LRUCache,fi as LiteralAtom,ct as MedplumClient,Pi as NotEqualsAtom,Ai as NotEquivalentAtom,vn as OperationOutcomeError,Sn as Operator,Ii as OrAtom,ve as PropertyType,ye as ReadablePromise,Zi as SEGMENT_SEPARATOR,Pn as SearchParameterType,yi as SymbolAtom,xi as UnaryOperatorAtom,Ti as UnionAtom,Oi as XorAtom,rn as allOk,H as arrayBufferToBase64,F as arrayBufferToHex,xn as assertOk,hn as badRequest,ut as booleanToTypedValue,Te as buildTypeName,A as calculateAge,k as calculateAgeString,z as capitalize,E as createReference,Ee as createSchema,an as created,W as deepClone,_ as deepEquals,Yi as evalFhirPath,Ji as evalFhirPathTyped,xt as fhirPathArrayEquals,wt as fhirPathArrayEquivalent,vt as fhirPathEquals,Et as fhirPathEquivalent,bt as fhirPathIs,gt as fhirPathNot,Y as findObservationInterval,J as findObservationReferenceRange,ln as forbidden,c as formatAddress,h as formatDate,f as formatDateTime,u as formatFamilyName,l as formatGivenName,d as formatHumanName,y as formatPeriod,Cn as formatSearchQuery,p as formatTime,w as formatTiming,V as getCodeBySystem,R as getDateProperty,T as getDisplayString,Pe as getElementDefinition,kn as getExpressionForResourceType,U as getExtensionValue,O as getIdentifier,C as getImageSrc,Ce as getPropertyDisplayName,M as getQuestionnaireAnswers,S as getReferenceString,Rn as getSearchParameterDetails,gn as getStatus,pt as getTypedPropertyValue,Re as globalSchema,un as gone,De as indexSearchParameter,be as indexStructureDefinition,Se as indexStructureDefinitionBundle,Gi as initFhirPathParserBuilder,N as isEmpty,yn as isGone,G as isLowerCase,fn as isNotFound,B as isObject,pn as isOk,Dt as isPeriod,D as isProfileResource,Tt as isQuantity,Ct as isQuantityEquivalent,q as isStringArray,Q as isUUID,m as isValidDate,K as matchesRange,wn as normalizeErrorString,cn as notFound,sn as notModified,Xi as parseFhirPath,fe as parseJWTPayload,Tn as parseSearchDefinition,ee as preciseEquals,ie as preciseGreaterThan,oe as preciseGreaterThanOrEquals,te as preciseLessThan,ne as preciseLessThanOrEquals,yt as removeDuplicates,b as resolveId,X as setCodeBySystem,L as stringify,ht as toJsBoolean,mt as toTypedValue,qi as tokenize,mn as tooManyRequests,dn as unauthorized};
1
+ function e(e,t,i,n){return new(i||(i=Promise))((function(o,r){function a(e){try{c(n.next(e))}catch(e){r(e)}}function s(e){try{c(n.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function t(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)}function i(e,t,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,i):o?o.value=i:t.set(e,i),i}var n,o,r,a;class s{constructor(e=10){n.add(this),o.set(this,void 0),r.set(this,void 0),i(this,o,e,"f"),i(this,r,new Map,"f")}clear(){t(this,r,"f").clear()}get(e){const i=t(this,r,"f").get(e);return i&&(t(this,r,"f").delete(e),t(this,r,"f").set(e,i)),i}set(e,i){t(this,r,"f").has(e)?t(this,r,"f").delete(e):t(this,r,"f").size>=t(this,o,"f")&&t(this,r,"f").delete(t(this,n,"m",a).call(this)),t(this,r,"f").set(e,i)}delete(e){t(this,r,"f").delete(e)}keys(){return t(this,r,"f").keys()}}function c(e,t){const i=[];return e.line&&i.push(...e.line),e.city&&i.push(e.city),e.state&&i.push(e.state),e.postalCode&&i.push(e.postalCode),e.use&&((null==t?void 0:t.all)||(null==t?void 0:t.use))&&i.push("["+e.use+"]"),i.join(", ").trim()}function d(e,t){const i=[];return e.prefix&&!1!==(null==t?void 0:t.prefix)&&i.push(...e.prefix),e.given&&i.push(...e.given),e.family&&i.push(e.family),e.suffix&&!1!==(null==t?void 0:t.suffix)&&i.push(...e.suffix),e.use&&((null==t?void 0:t.all)||(null==t?void 0:t.use))&&i.push("["+e.use+"]"),i.join(" ").trim()}function l(e){const t=[];return e.given&&t.push(...e.given),t.join(" ").trim()}function u(e){return e.family||""}function m(e){return e instanceof Date&&!isNaN(e.getTime())}function h(e,t){if(!e)return"";const i=new Date(e);return m(i)?i.toLocaleDateString(void 0,t):""}function p(e,t){if(!e)return"";const i=new Date("2000-01-01T"+e+"Z");return m(i)?i.toLocaleTimeString(void 0,t):""}function f(e,t){if(!e)return"";const i=new Date(e);return m(i)?i.toLocaleString(void 0,t):""}function y(e){return e&&(e.start||e.end)?f(e.start)+" - "+f(e.end):""}o=new WeakMap,r=new WeakMap,n=new WeakSet,a=function(){return t(this,r,"f").keys().next().value};const g={s:"every second",min:"every minute",h:"hourly",d:"daily",wk:"weekly",mo:"monthly",a:"annually"},x={s:"second",min:"minute",h:"hour",d:"day",wk:"week",mo:"month",a:"year"},v={s:"seconds",min:"minutes",h:"hours",d:"days",wk:"weeks",mo:"months",a:"years"};function w(e){var t;if(!e)return"";const i=[];if(null===(t=e.repeat)||void 0===t?void 0:t.periodUnit){const t=e.repeat.frequency||1,n=e.repeat.period||1,o=e.repeat.periodUnit;1===t&&1===n?i.push(g[o]):(1===t?i.push("once"):i.push(t+" times"),1===n?i.push("per "+x[o]):i.push("per "+n+" "+v[o])),e.repeat.dayOfWeek&&i.push("on "+e.repeat.dayOfWeek.map(z).join(", ")),e.repeat.timeOfDay&&i.push("at "+e.repeat.timeOfDay.map((e=>p(e))).join(", "))}return e.event&&i.push(e.event.map((e=>f(e))).join(", ")),z(i.join(" ").trim())}function E(e){const t=S(e),i=T(e);return i===t?{reference:t}:{reference:t,display:i}}function S(e){return e.resourceType+"/"+e.id}function b(e){var t;return null===(t=null==e?void 0:e.reference)||void 0===t?void 0:t.split("/")[1]}function D(e){return"Patient"===e.resourceType||"Practitioner"===e.resourceType||"RelatedPerson"===e.resourceType}function T(e){var t,i;if(D(e)){const t=function(e){const t=e.name;if(t&&t.length>0)return d(t[0]);return}(e);if(t)return t}if("Device"===e.resourceType){const t=function(e){const t=e.deviceName;if(t&&t.length>0)return t[0].name;return}(e);if(t)return t}return"Observation"===e.resourceType&&"code"in e&&(null===(t=e.code)||void 0===t?void 0:t.text)?null===(i=e.code)||void 0===i?void 0:i.text:"User"===e.resourceType&&e.email?e.email:"name"in e&&e.name&&"string"==typeof e.name?e.name:S(e)}function C(e){if(D(e)){const t=e.photo;if(t)for(const e of t){const t=P(e);if(t)return t}}if("Bot"===e.resourceType&&e.photo){const t=P(e.photo);if(t)return t}}function P(e){if(e.url&&e.contentType&&e.contentType.startsWith("image/"))return e.url}function R(e){return e?new Date(e):void 0}function A(e,t){const i=new Date(e);i.setUTCHours(0,0,0,0);const n=t?new Date(t):new Date;n.setUTCHours(0,0,0,0);const o=i.getUTCFullYear(),r=i.getUTCMonth(),a=i.getUTCDate(),s=n.getUTCFullYear(),c=n.getUTCMonth(),d=n.getUTCDate();let l=s-o;(c<r||c===r&&d<a)&&l--;let u=12*s+c-(12*o+r);d<a&&u--;return{years:l,months:u,days:Math.floor((n.getTime()-i.getTime())/864e5)}}function k(e,t){const{years:i,months:n,days:o}=A(e,t);return i>=2?i.toString().padStart(3,"0")+"Y":n>=1?n.toString().padStart(3,"0")+"M":o.toString().padStart(3,"0")+"D"}function M(e){const t={};return I(e.item,t),t}function I(e,t){if(e)for(const i of e)i.linkId&&i.answer&&i.answer.length>0&&(t[i.linkId]=i.answer[0]),I(i.item,t)}function O(e,t){const i=e.identifier;if(!i)return;const n=Array.isArray(i)?i:[i];for(const e of n)if(e.system===t)return e.value}function U(e,...t){var i;let n=e;for(let e=0;e<t.length&&n;e++)n=null===(i=null==n?void 0:n.extension)||void 0===i?void 0:i.find((i=>i.url===t[e]));return null==n?void 0:n.valueString}function L(e,t){return JSON.stringify(e,j,t?2:void 0)}function j(e,t){return!function(e){return!!e.match(/\d+$/)}(e)&&N(t)?void 0:t}function N(e){if(null==e)return!0;const t=typeof e;return"string"===t&&""===e||"object"===t&&0===Object.keys(e).length}function _(e,t,i){return e===t||(!(!N(e)||!N(t))||!N(e)&&!N(t)&&(Array.isArray(e)&&Array.isArray(t)?function(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!_(e[i],t[i]))return!1;return!0}(e,t):!Array.isArray(e)&&!Array.isArray(t)&&(B(e)&&B(t)?function(e,t,i){const n=new Set;Object.keys(e).forEach((e=>n.add(e))),Object.keys(t).forEach((e=>n.add(e))),"meta"===i&&(n.delete("versionId"),n.delete("lastUpdated"),n.delete("author"));for(const i of n){if(!_(e[i],t[i],i))return!1}return!0}(e,t,i):(B(e)||B(t),!1))))}function W(e){return JSON.parse(JSON.stringify(e))}function Q(e){return!!e.match(/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/i)}function B(e){return null!==e&&"object"==typeof e}function q(e){return e.every((e=>"string"==typeof e))}const $=[];for(let e=0;e<256;e++)$.push(e.toString(16).padStart(2,"0"));function F(e){const t=new Uint8Array(e),i=new Array(t.length);for(let e=0;e<t.length;e++)i[e]=$[t[e]];return i.join("")}function H(e){const t=new Uint8Array(e),i=[];for(let e=0;e<t.length;e++)i[e]=String.fromCharCode(t[e]);return window.btoa(i.join(""))}function z(e){return e.charAt(0).toUpperCase()+e.substring(1)}function G(e){return e===e.toLowerCase()&&e!==e.toUpperCase()}function V(e,t){var i,n;return null===(n=null===(i=null==e?void 0:e.coding)||void 0===i?void 0:i.find((e=>e.system===t)))||void 0===n?void 0:n.code}function X(e,t,i){var n,o;e.coding||(e.coding=[]);const r=null===(n=e.coding)||void 0===n?void 0:n.find((e=>e.system===t));r?r.code=i:null===(o=e.coding)||void 0===o||o.push({system:t,code:i})}function Y(e,t,i,n){var o;return null===(o=e.qualifiedInterval)||void 0===o?void 0:o.find((o=>{var r;return Z(o,t)&&function(e,t,i){return!!e.range&&K(t,e.range,i)}(o,i,null===(r=e.quantitativeDetails)||void 0===r?void 0:r.decimalPrecision)&&(void 0===n||o.category===n)}))}function J(e,t,i){var n;return null===(n=e.qualifiedInterval)||void 0===n?void 0:n.find((e=>Z(e,t)&&i.includes(e.condition)))}function Z(e,t){return function(e,t){return!e.gender||e.gender===t.gender}(e,t)&&function(e,t){return!e.age||K(A(t.birthDate).years,e.age)}(e,t)}function K(e,t,i){var n,o;return(void 0===(null===(n=t.low)||void 0===n?void 0:n.value)||oe(e,t.low.value,i))&&(void 0===(null===(o=t.high)||void 0===o?void 0:o.value)||ne(e,t.high.value,i))}function ee(e,t,i){return i?Math.abs(e-t)<Math.pow(10,-i):e===t}function te(e,t,i){return i?e<t&&Math.abs(e-t)>Math.pow(10,-i):e<t}function ie(e,t,i){return i?e>t&&Math.abs(e-t)>Math.pow(10,-i):e>t}function ne(e,t,i){return te(e,t,i)||ee(e,t,i)}function oe(e,t,i){return ie(e,t,i)||ee(e,t,i)}function re(){const e=new Uint32Array(28);return crypto.getRandomValues(e),F(e.buffer)}var ae,se,ce,de,le,ue,me,he;function pe(e){const t=function(e){if("undefined"!=typeof window)return window.atob(e);if("undefined"!=typeof Buffer)return Buffer.from(e,"base64").toString("binary");throw new Error("Unable to decode base64")}(e.replace(/-/g,"+").replace(/_/g,"/")),i=Array.from(t).reduce(((e,t)=>`${e}%${("00"+t.charCodeAt(0).toString(16)).slice(-2)}`),""),n=decodeURIComponent(i);return JSON.parse(n)}function fe(e){const[t,i,n]=e.split(".");return pe(i)}ae=new WeakMap;class ye{constructor(e){this[ue]="ReadablePromise",se.set(this,void 0),ce.set(this,"pending"),de.set(this,void 0),le.set(this,void 0),i(this,se,e.then((e=>(i(this,ce,"success","f"),i(this,de,e,"f"),e)),(e=>{throw i(this,ce,"error","f"),i(this,le,e,"f"),e})),"f")}isPending(){return"pending"===t(this,ce,"f")}isOk(){return"success"===t(this,ce,"f")}read(){switch(t(this,ce,"f")){case"pending":throw t(this,se,"f");case"error":throw t(this,le,"f");default:return t(this,de,"f")}}then(e,i){return t(this,se,"f").then(e,i)}catch(e){return t(this,se,"f").catch(e)}finally(e){return t(this,se,"f").finally(e)}}se=new WeakMap,ce=new WeakMap,de=new WeakMap,le=new WeakMap,ue=Symbol.toStringTag;class ge{constructor(){me.set(this,void 0),i(this,me,"undefined"!=typeof localStorage?localStorage:new xe,"f")}clear(){t(this,me,"f").clear()}getString(e){return t(this,me,"f").getItem(e)||void 0}setString(e,i){i?t(this,me,"f").setItem(e,i):t(this,me,"f").removeItem(e)}getObject(e){const t=this.getString(e);return t?JSON.parse(t):void 0}setObject(e,t){this.setString(e,t?L(t):void 0)}}me=new WeakMap;class xe{constructor(){he.set(this,void 0),i(this,he,new Map,"f")}get length(){return t(this,he,"f").size}clear(){t(this,he,"f").clear()}getItem(e){var i;return null!==(i=t(this,he,"f").get(e))&&void 0!==i?i:null}setItem(e,i){i?t(this,he,"f").set(e,i):t(this,he,"f").delete(e)}removeItem(e){t(this,he,"f").delete(e)}key(e){return Array.from(t(this,he,"f").keys())[e]}}he=new WeakMap;var ve,we={types:{Element:{display:"Element",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]}}},BackboneElement:{display:"BackboneElement",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]}}},Address:{display:"Address",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},use:{min:0,max:"1",type:[{code:"code"}]},type:{min:0,max:"1",type:[{code:"code"}]},text:{min:0,max:"1",type:[{code:"string"}]},line:{min:0,max:"*",type:[{code:"string"}]},city:{min:0,max:"1",type:[{code:"string"}]},district:{min:0,max:"1",type:[{code:"string"}]},state:{min:0,max:"1",type:[{code:"string"}]},postalCode:{min:0,max:"1",type:[{code:"string"}]},country:{min:0,max:"1",type:[{code:"string"}]},period:{min:0,max:"1",type:[{code:"Period"}]}}},Age:{display:"Age",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},value:{min:0,max:"1",type:[{code:"decimal"}]},comparator:{min:0,max:"1",type:[{code:"code"}]},unit:{min:0,max:"1",type:[{code:"string"}]},system:{min:0,max:"1",type:[{code:"uri"}]},code:{min:0,max:"1",type:[{code:"code"}]}}},Annotation:{display:"Annotation",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},"author[x]":{min:0,max:"1",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:{min:0,max:"1",type:[{code:"dateTime"}]},text:{min:1,max:"1",type:[{code:"markdown"}]}}},Attachment:{display:"Attachment",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},contentType:{min:0,max:"1",type:[{code:"code"}]},language:{min:0,max:"1",type:[{code:"code"}]},data:{min:0,max:"1",type:[{code:"base64Binary"}]},url:{min:0,max:"1",type:[{code:"url"}]},size:{min:0,max:"1",type:[{code:"unsignedInt"}]},hash:{min:0,max:"1",type:[{code:"base64Binary"}]},title:{min:0,max:"1",type:[{code:"string"}]},creation:{min:0,max:"1",type:[{code:"dateTime"}]}}},CodeableConcept:{display:"CodeableConcept",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},coding:{min:0,max:"*",type:[{code:"Coding"}]},text:{min:0,max:"1",type:[{code:"string"}]}}},Coding:{display:"Coding",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},system:{min:0,max:"1",type:[{code:"uri"}]},version:{min:0,max:"1",type:[{code:"string"}]},code:{min:0,max:"1",type:[{code:"code"}]},display:{min:0,max:"1",type:[{code:"string"}]},userSelected:{min:0,max:"1",type:[{code:"boolean"}]}}},ContactDetail:{display:"ContactDetail",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},name:{min:0,max:"1",type:[{code:"string"}]},telecom:{min:0,max:"*",type:[{code:"ContactPoint"}]}}},ContactPoint:{display:"ContactPoint",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},system:{min:0,max:"1",type:[{code:"code"}]},value:{min:0,max:"1",type:[{code:"string"}]},use:{min:0,max:"1",type:[{code:"code"}]},rank:{min:0,max:"1",type:[{code:"positiveInt"}]},period:{min:0,max:"1",type:[{code:"Period"}]}}},Contributor:{display:"Contributor",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},type:{min:1,max:"1",type:[{code:"code"}]},name:{min:1,max:"1",type:[{code:"string"}]},contact:{min:0,max:"*",type:[{code:"ContactDetail"}]}}},Count:{display:"Count",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},value:{min:0,max:"1",type:[{code:"decimal"}]},comparator:{min:0,max:"1",type:[{code:"code"}]},unit:{min:0,max:"1",type:[{code:"string"}]},system:{min:0,max:"1",type:[{code:"uri"}]},code:{min:0,max:"1",type:[{code:"code"}]}}},DataRequirement:{display:"DataRequirement",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},type:{min:1,max:"1",type:[{code:"code"}]},profile:{min:0,max:"*",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]},"subject[x]":{min:0,max:"1",type:[{code:"CodeableConcept"},{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Group"]}]},mustSupport:{min:0,max:"*",type:[{code:"string"}]},codeFilter:{min:0,max:"*",type:[{code:"Element"}]},dateFilter:{min:0,max:"*",type:[{code:"Element"}]},limit:{min:0,max:"1",type:[{code:"positiveInt"}]},sort:{min:0,max:"*",type:[{code:"Element"}]}}},DataRequirementCodeFilter:{display:"DataRequirementCodeFilter",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},path:{min:0,max:"1",type:[{code:"string"}]},searchParam:{min:0,max:"1",type:[{code:"string"}]},valueSet:{min:0,max:"1",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/ValueSet"]}]},code:{min:0,max:"*",type:[{code:"Coding"}]}},parentType:"DataRequirement"},DataRequirementDateFilter:{display:"DataRequirementDateFilter",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},path:{min:0,max:"1",type:[{code:"string"}]},searchParam:{min:0,max:"1",type:[{code:"string"}]},"value[x]":{min:0,max:"1",type:[{code:"dateTime"},{code:"Period"},{code:"Duration"}]}},parentType:"DataRequirement"},DataRequirementSort:{display:"DataRequirementSort",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},path:{min:1,max:"1",type:[{code:"string"}]},direction:{min:1,max:"1",type:[{code:"code"}]}},parentType:"DataRequirement"},Distance:{display:"Distance",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},value:{min:0,max:"1",type:[{code:"decimal"}]},comparator:{min:0,max:"1",type:[{code:"code"}]},unit:{min:0,max:"1",type:[{code:"string"}]},system:{min:0,max:"1",type:[{code:"uri"}]},code:{min:0,max:"1",type:[{code:"code"}]}}},Dosage:{display:"Dosage",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},sequence:{min:0,max:"1",type:[{code:"integer"}]},text:{min:0,max:"1",type:[{code:"string"}]},additionalInstruction:{min:0,max:"*",type:[{code:"CodeableConcept"}]},patientInstruction:{min:0,max:"1",type:[{code:"string"}]},timing:{min:0,max:"1",type:[{code:"Timing"}]},"asNeeded[x]":{min:0,max:"1",type:[{code:"boolean"},{code:"CodeableConcept"}]},site:{min:0,max:"1",type:[{code:"CodeableConcept"}]},route:{min:0,max:"1",type:[{code:"CodeableConcept"}]},method:{min:0,max:"1",type:[{code:"CodeableConcept"}]},doseAndRate:{min:0,max:"*",type:[{code:"Element"}]},maxDosePerPeriod:{min:0,max:"1",type:[{code:"Ratio"}]},maxDosePerAdministration:{min:0,max:"1",type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},maxDosePerLifetime:{min:0,max:"1",type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]}}},DosageDoseAndRate:{display:"DosageDoseAndRate",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},type:{min:0,max:"1",type:[{code:"CodeableConcept"}]},"dose[x]":{min:0,max:"1",type:[{code:"Range"},{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},"rate[x]":{min:0,max:"1",type:[{code:"Ratio"},{code:"Range"},{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]}},parentType:"Dosage"},Duration:{display:"Duration",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},value:{min:0,max:"1",type:[{code:"decimal"}]},comparator:{min:0,max:"1",type:[{code:"code"}]},unit:{min:0,max:"1",type:[{code:"string"}]},system:{min:0,max:"1",type:[{code:"uri"}]},code:{min:0,max:"1",type:[{code:"code"}]}}},ElementDefinition:{display:"ElementDefinition",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},path:{min:1,max:"1",type:[{code:"string"}]},representation:{min:0,max:"*",type:[{code:"code"}]},sliceName:{min:0,max:"1",type:[{code:"string"}]},sliceIsConstraining:{min:0,max:"1",type:[{code:"boolean"}]},label:{min:0,max:"1",type:[{code:"string"}]},code:{min:0,max:"*",type:[{code:"Coding"}]},slicing:{min:0,max:"1",type:[{code:"Element"}]},short:{min:0,max:"1",type:[{code:"string"}]},definition:{min:0,max:"1",type:[{code:"markdown"}]},comment:{min:0,max:"1",type:[{code:"markdown"}]},requirements:{min:0,max:"1",type:[{code:"markdown"}]},alias:{min:0,max:"*",type:[{code:"string"}]},min:{min:0,max:"1",type:[{code:"unsignedInt"}]},max:{min:0,max:"1",type:[{code:"string"}]},base:{min:0,max:"1",type:[{code:"Element"}]},contentReference:{min:0,max:"1",type:[{code:"uri"}]},type:{min:0,max:"*",type:[{code:"Element"}]},"defaultValue[x]":{min:0,max:"1",type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]},meaningWhenMissing:{min:0,max:"1",type:[{code:"markdown"}]},orderMeaning:{min:0,max:"1",type:[{code:"string"}]},"fixed[x]":{min:0,max:"1",type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]},"pattern[x]":{min:0,max:"1",type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]},example:{min:0,max:"*",type:[{code:"Element"}]},"minValue[x]":{min:0,max:"1",type:[{code:"date"},{code:"dateTime"},{code:"instant"},{code:"time"},{code:"decimal"},{code:"integer"},{code:"positiveInt"},{code:"unsignedInt"},{code:"Quantity"}]},"maxValue[x]":{min:0,max:"1",type:[{code:"date"},{code:"dateTime"},{code:"instant"},{code:"time"},{code:"decimal"},{code:"integer"},{code:"positiveInt"},{code:"unsignedInt"},{code:"Quantity"}]},maxLength:{min:0,max:"1",type:[{code:"integer"}]},condition:{min:0,max:"*",type:[{code:"id"}]},constraint:{min:0,max:"*",type:[{code:"Element"}]},mustSupport:{min:0,max:"1",type:[{code:"boolean"}]},isModifier:{min:0,max:"1",type:[{code:"boolean"}]},isModifierReason:{min:0,max:"1",type:[{code:"string"}]},isSummary:{min:0,max:"1",type:[{code:"boolean"}]},binding:{min:0,max:"1",type:[{code:"Element"}]},mapping:{min:0,max:"*",type:[{code:"Element"}]}}},ElementDefinitionSlicing:{display:"ElementDefinitionSlicing",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},discriminator:{min:0,max:"*",type:[{code:"Element"}]},description:{min:0,max:"1",type:[{code:"string"}]},ordered:{min:0,max:"1",type:[{code:"boolean"}]},rules:{min:1,max:"1",type:[{code:"code"}]}},parentType:"ElementDefinition"},ElementDefinitionSlicingDiscriminator:{display:"ElementDefinitionSlicingDiscriminator",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},type:{min:1,max:"1",type:[{code:"code"}]},path:{min:1,max:"1",type:[{code:"string"}]}},parentType:"ElementDefinitionSlicing"},ElementDefinitionBase:{display:"ElementDefinitionBase",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},path:{min:1,max:"1",type:[{code:"string"}]},min:{min:1,max:"1",type:[{code:"unsignedInt"}]},max:{min:1,max:"1",type:[{code:"string"}]}},parentType:"ElementDefinition"},ElementDefinitionType:{display:"ElementDefinitionType",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},code:{min:1,max:"1",type:[{code:"uri"}]},profile:{min:0,max:"*",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition","http://hl7.org/fhir/StructureDefinition/ImplementationGuide"]}]},targetProfile:{min:0,max:"*",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition","http://hl7.org/fhir/StructureDefinition/ImplementationGuide"]}]},aggregation:{min:0,max:"*",type:[{code:"code"}]},versioning:{min:0,max:"1",type:[{code:"code"}]}},parentType:"ElementDefinition"},ElementDefinitionExample:{display:"ElementDefinitionExample",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},label:{min:1,max:"1",type:[{code:"string"}]},"value[x]":{min:1,max:"1",type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]}},parentType:"ElementDefinition"},ElementDefinitionConstraint:{display:"ElementDefinitionConstraint",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},key:{min:1,max:"1",type:[{code:"id"}]},requirements:{min:0,max:"1",type:[{code:"string"}]},severity:{min:1,max:"1",type:[{code:"code"}]},human:{min:1,max:"1",type:[{code:"string"}]},expression:{min:0,max:"1",type:[{code:"string"}]},xpath:{min:0,max:"1",type:[{code:"string"}]},source:{min:0,max:"1",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]}},parentType:"ElementDefinition"},ElementDefinitionBinding:{display:"ElementDefinitionBinding",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},strength:{min:1,max:"1",type:[{code:"code"}]},description:{min:0,max:"1",type:[{code:"string"}]},valueSet:{min:0,max:"1",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/ValueSet"]}]}},parentType:"ElementDefinition"},ElementDefinitionMapping:{display:"ElementDefinitionMapping",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},identity:{min:1,max:"1",type:[{code:"id"}]},language:{min:0,max:"1",type:[{code:"code"}]},map:{min:1,max:"1",type:[{code:"string"}]},comment:{min:0,max:"1",type:[{code:"string"}]}},parentType:"ElementDefinition"},Expression:{display:"Expression",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},description:{min:0,max:"1",type:[{code:"string"}]},name:{min:0,max:"1",type:[{code:"id"}]},language:{min:1,max:"1",type:[{code:"code"}]},expression:{min:0,max:"1",type:[{code:"string"}]},reference:{min:0,max:"1",type:[{code:"uri"}]}}},Extension:{display:"Extension",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},url:{min:1,max:"1",type:[{code:"string"}]},"value[x]":{min:0,max:"1",type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]}}},HumanName:{display:"HumanName",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},use:{min:0,max:"1",type:[{code:"code"}]},text:{min:0,max:"1",type:[{code:"string"}]},family:{min:0,max:"1",type:[{code:"string"}]},given:{min:0,max:"*",type:[{code:"string"}]},prefix:{min:0,max:"*",type:[{code:"string"}]},suffix:{min:0,max:"*",type:[{code:"string"}]},period:{min:0,max:"1",type:[{code:"Period"}]}}},Identifier:{display:"Identifier",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},use:{min:0,max:"1",type:[{code:"code"}]},type:{min:0,max:"1",type:[{code:"CodeableConcept"}]},system:{min:0,max:"1",type:[{code:"uri"}]},value:{min:0,max:"1",type:[{code:"string"}]},period:{min:0,max:"1",type:[{code:"Period"}]},assigner:{min:0,max:"1",type:[{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Organization"]}]}}},MarketingStatus:{display:"MarketingStatus",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},country:{min:1,max:"1",type:[{code:"CodeableConcept"}]},jurisdiction:{min:0,max:"1",type:[{code:"CodeableConcept"}]},status:{min:1,max:"1",type:[{code:"CodeableConcept"}]},dateRange:{min:1,max:"1",type:[{code:"Period"}]},restoreDate:{min:0,max:"1",type:[{code:"dateTime"}]}}},Meta:{display:"Meta",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},versionId:{min:0,max:"1",type:[{code:"id"}]},lastUpdated:{min:0,max:"1",type:[{code:"instant"}]},source:{min:0,max:"1",type:[{code:"uri"}]},profile:{min:0,max:"*",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]},security:{min:0,max:"*",type:[{code:"Coding"}]},tag:{min:0,max:"*",type:[{code:"Coding"}]},project:{min:0,max:"1",type:[{code:"uri"}]},author:{min:0,max:"1",type:[{code:"Reference"}]},account:{min:0,max:"1",type:[{code:"Reference"}]}}},Money:{display:"Money",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},value:{min:0,max:"1",type:[{code:"decimal"}]},currency:{min:0,max:"1",type:[{code:"code"}]}}},Narrative:{display:"Narrative",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},status:{min:1,max:"1",type:[{code:"code"}]},div:{min:1,max:"1",type:[{code:"xhtml"}]}}},ParameterDefinition:{display:"ParameterDefinition",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},name:{min:0,max:"1",type:[{code:"code"}]},use:{min:1,max:"1",type:[{code:"code"}]},min:{min:0,max:"1",type:[{code:"integer"}]},max:{min:0,max:"1",type:[{code:"string"}]},documentation:{min:0,max:"1",type:[{code:"string"}]},type:{min:1,max:"1",type:[{code:"code"}]},profile:{min:0,max:"1",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]}}},Period:{display:"Period",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},start:{min:0,max:"1",type:[{code:"dateTime"}]},end:{min:0,max:"1",type:[{code:"dateTime"}]}}},Population:{display:"Population",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},"age[x]":{min:0,max:"1",type:[{code:"Range"},{code:"CodeableConcept"}]},gender:{min:0,max:"1",type:[{code:"CodeableConcept"}]},race:{min:0,max:"1",type:[{code:"CodeableConcept"}]},physiologicalCondition:{min:0,max:"1",type:[{code:"CodeableConcept"}]}}},ProdCharacteristic:{display:"ProdCharacteristic",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},height:{min:0,max:"1",type:[{code:"Quantity"}]},width:{min:0,max:"1",type:[{code:"Quantity"}]},depth:{min:0,max:"1",type:[{code:"Quantity"}]},weight:{min:0,max:"1",type:[{code:"Quantity"}]},nominalVolume:{min:0,max:"1",type:[{code:"Quantity"}]},externalDiameter:{min:0,max:"1",type:[{code:"Quantity"}]},shape:{min:0,max:"1",type:[{code:"string"}]},color:{min:0,max:"*",type:[{code:"string"}]},imprint:{min:0,max:"*",type:[{code:"string"}]},image:{min:0,max:"*",type:[{code:"Attachment"}]},scoring:{min:0,max:"1",type:[{code:"CodeableConcept"}]}}},ProductShelfLife:{display:"ProductShelfLife",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},identifier:{min:0,max:"1",type:[{code:"Identifier"}]},type:{min:1,max:"1",type:[{code:"CodeableConcept"}]},period:{min:1,max:"1",type:[{code:"Quantity"}]},specialPrecautionsForStorage:{min:0,max:"*",type:[{code:"CodeableConcept"}]}}},Quantity:{display:"Quantity",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},value:{min:0,max:"1",type:[{code:"decimal"}]},comparator:{min:0,max:"0",type:[{code:"code"}]},unit:{min:0,max:"1",type:[{code:"string"}]},system:{min:0,max:"1",type:[{code:"uri"}]},code:{min:0,max:"1",type:[{code:"code"}]}}},Range:{display:"Range",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},low:{min:0,max:"1",type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},high:{min:0,max:"1",type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]}}},Ratio:{display:"Ratio",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},numerator:{min:0,max:"1",type:[{code:"Quantity"}]},denominator:{min:0,max:"1",type:[{code:"Quantity"}]}}},Reference:{display:"Reference",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},reference:{min:0,max:"1",type:[{code:"string"}]},type:{min:0,max:"1",type:[{code:"uri"}]},identifier:{min:0,max:"1",type:[{code:"Identifier"}]},display:{min:0,max:"1",type:[{code:"string"}]}}},RelatedArtifact:{display:"RelatedArtifact",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},type:{min:1,max:"1",type:[{code:"code"}]},label:{min:0,max:"1",type:[{code:"string"}]},display:{min:0,max:"1",type:[{code:"string"}]},citation:{min:0,max:"1",type:[{code:"markdown"}]},url:{min:0,max:"1",type:[{code:"url"}]},document:{min:0,max:"1",type:[{code:"Attachment"}]},resource:{min:0,max:"1",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/Resource"]}]}}},SampledData:{display:"SampledData",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},origin:{min:1,max:"1",type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},period:{min:1,max:"1",type:[{code:"decimal"}]},factor:{min:0,max:"1",type:[{code:"decimal"}]},lowerLimit:{min:0,max:"1",type:[{code:"decimal"}]},upperLimit:{min:0,max:"1",type:[{code:"decimal"}]},dimensions:{min:1,max:"1",type:[{code:"positiveInt"}]},data:{min:0,max:"1",type:[{code:"string"}]}}},Signature:{display:"Signature",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},type:{min:1,max:"*",type:[{code:"Coding"}]},when:{min:1,max:"1",type:[{code:"instant"}]},who:{min:1,max:"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:{min:0,max:"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"]}]},targetFormat:{min:0,max:"1",type:[{code:"code"}]},sigFormat:{min:0,max:"1",type:[{code:"code"}]},data:{min:0,max:"1",type:[{code:"base64Binary"}]}}},SubstanceAmount:{display:"SubstanceAmount",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},"amount[x]":{min:0,max:"1",type:[{code:"Quantity"},{code:"Range"},{code:"string"}]},amountType:{min:0,max:"1",type:[{code:"CodeableConcept"}]},amountText:{min:0,max:"1",type:[{code:"string"}]},referenceRange:{min:0,max:"1",type:[{code:"Element"}]}}},SubstanceAmountReferenceRange:{display:"SubstanceAmountReferenceRange",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},lowLimit:{min:0,max:"1",type:[{code:"Quantity"}]},highLimit:{min:0,max:"1",type:[{code:"Quantity"}]}},parentType:"SubstanceAmount"},Timing:{display:"Timing",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},event:{min:0,max:"*",type:[{code:"dateTime"}]},repeat:{min:0,max:"1",type:[{code:"Element"}]},code:{min:0,max:"1",type:[{code:"CodeableConcept"}]}}},TimingRepeat:{display:"TimingRepeat",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},"bounds[x]":{min:0,max:"1",type:[{code:"Duration"},{code:"Range"},{code:"Period"}]},count:{min:0,max:"1",type:[{code:"positiveInt"}]},countMax:{min:0,max:"1",type:[{code:"positiveInt"}]},duration:{min:0,max:"1",type:[{code:"decimal"}]},durationMax:{min:0,max:"1",type:[{code:"decimal"}]},durationUnit:{min:0,max:"1",type:[{code:"code"}]},frequency:{min:0,max:"1",type:[{code:"positiveInt"}]},frequencyMax:{min:0,max:"1",type:[{code:"positiveInt"}]},period:{min:0,max:"1",type:[{code:"decimal"}]},periodMax:{min:0,max:"1",type:[{code:"decimal"}]},periodUnit:{min:0,max:"1",type:[{code:"code"}]},dayOfWeek:{min:0,max:"*",type:[{code:"code"}]},timeOfDay:{min:0,max:"*",type:[{code:"time"}]},when:{min:0,max:"*",type:[{code:"code"}]},offset:{min:0,max:"1",type:[{code:"unsignedInt"}]}},parentType:"Timing"},TriggerDefinition:{display:"TriggerDefinition",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},type:{min:1,max:"1",type:[{code:"code"}]},name:{min:0,max:"1",type:[{code:"string"}]},"timing[x]":{min:0,max:"1",type:[{code:"Timing"},{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Schedule"]},{code:"date"},{code:"dateTime"}]},data:{min:0,max:"*",type:[{code:"DataRequirement"}]},condition:{min:0,max:"1",type:[{code:"Expression"}]}}},UsageContext:{display:"UsageContext",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},code:{min:1,max:"1",type:[{code:"Coding"}]},"value[x]":{min:1,max:"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"]}]}}}}};function Ee(){return{types:{}}}function Se(e){for(const t of e.entry){const e=t.resource;"StructureDefinition"===e.resourceType&&be(e)}}function be(e){var t;if(!e.name)return;const i=null===(t=e.snapshot)||void 0===t?void 0:t.element;i&&(i.forEach((t=>function(e,t){var i,n;const o=t.path,r=null===(n=null===(i=t.type)||void 0===i?void 0:i[0])||void 0===n?void 0:n.code;if(void 0!==r&&"Element"!==r&&"BackboneElement"!==r)return;const a=o.split("."),s=Te(a);Re.types[s]=function(e,t,i){return{structureDefinition:t,elementDefinition:i,display:e,description:i.definition,properties:{}}}(s,e,t),Re.types[s].parentType=Te(a.slice(0,a.length-1))}(e,t))),i.forEach((e=>function(e){const t=e.path.split(".");if(1===t.length)return;const i=Te(t.slice(0,t.length-1)),n=Re.types[i];if(!n)return;const o=t[t.length-1];n.properties[o]=e}(e))))}function De(e){if(e.base)for(const t of e.base){const i=Re.types[t];i&&(i.searchParams||(i.searchParams={_id:{base:[t],code:"_id",type:"token",expression:t+".id"},_lastUpdated:{base:[t],code:"_lastUpdated",type:"date",expression:t+".meta.lastUpdated"}}),i.searchParams[e.code]=e)}}function Te(e){return 1===e.length?e[0]:e.map(z).join("")}function Ce(e){const t=e.replaceAll("[x]","").split(".").pop();return"id"===t?"ID":t.split(/(?=[A-Z])/).map(z).join(" ").replace("_"," ").replace(/\s+/g," ")}function Pe(e,t){var i;const n=Re.types[e];if(!n)return;const o=null!==(i=n.properties[t])&&void 0!==i?i:n.properties[t+"[x]"];if(o){if(o.contentReference){const e=o.contentReference.substring(1).split("."),t=e.pop();return Pe(Te(e),t)}return o}}!function(e){e.Address="Address",e.Age="Age",e.Annotation="Annotation",e.Attachment="Attachment",e.BackboneElement="BackboneElement",e.CodeableConcept="CodeableConcept",e.Coding="Coding",e.ContactDetail="ContactDetail",e.ContactPoint="ContactPoint",e.Contributor="Contributor",e.Count="Count",e.DataRequirement="DataRequirement",e.Distance="Distance",e.Dosage="Dosage",e.Duration="Duration",e.Expression="Expression",e.Extension="Extension",e.HumanName="HumanName",e.Identifier="Identifier",e.MarketingStatus="MarketingStatus",e.Meta="Meta",e.Money="Money",e.Narrative="Narrative",e.ParameterDefinition="ParameterDefinition",e.Period="Period",e.Population="Population",e.ProdCharacteristic="ProdCharacteristic",e.ProductShelfLife="ProductShelfLife",e.Quantity="Quantity",e.Range="Range",e.Ratio="Ratio",e.Reference="Reference",e.RelatedArtifact="RelatedArtifact",e.SampledData="SampledData",e.Signature="Signature",e.SubstanceAmount="SubstanceAmount",e.SystemString="http://hl7.org/fhirpath/System.String",e.Timing="Timing",e.TriggerDefinition="TriggerDefinition",e.UsageContext="UsageContext",e.base64Binary="base64Binary",e.boolean="boolean",e.canonical="canonical",e.code="code",e.date="date",e.dateTime="dateTime",e.decimal="decimal",e.id="id",e.instant="instant",e.integer="integer",e.markdown="markdown",e.oid="oid",e.positiveInt="positiveInt",e.string="string",e.time="time",e.unsignedInt="unsignedInt",e.uri="uri",e.url="url",e.uuid="uuid"}(ve||(ve={}));const Re=we;var Ae,ke,Me,Ie,Oe,Ue,Le,je,Ne,_e,We,Qe,Be,qe,$e,Fe,He,ze,Ge,Ve,Xe,Ye,Je,Ze,Ke,et,tt,it,nt,ot,rt,at;const st="0.10.1-221e9b95",ct="launch/patient openid fhirUser offline_access user/*.*";class dt extends class{constructor(){ae.set(this,void 0),i(this,ae,{},"f")}addEventListener(e,i){t(this,ae,"f")[e]||(t(this,ae,"f")[e]=[]),t(this,ae,"f")[e].push(i)}removeEventListeneer(e,i){const n=t(this,ae,"f")[e];if(n)for(let e=0;e<n.length;e++)if(n[e]===i)return void n.splice(e,1)}dispatchEvent(e){const i=t(this,ae,"f")[e.type];return i&&i.forEach((t=>t.call(this,e))),!e.defaultPrevented}}{constructor(e){var n,o;if(super(),Ae.add(this),ke.set(this,void 0),Me.set(this,void 0),Ie.set(this,void 0),Oe.set(this,void 0),Ue.set(this,void 0),Le.set(this,void 0),je.set(this,void 0),Ne.set(this,void 0),_e.set(this,void 0),We.set(this,void 0),Qe.set(this,void 0),Be.set(this,void 0),qe.set(this,void 0),$e.set(this,void 0),Fe.set(this,void 0),He.set(this,void 0),ze.set(this,void 0),(null==e?void 0:e.baseUrl)&&!e.baseUrl.startsWith("http"))throw new Error("Base URL must start with http or https");i(this,ke,(null==e?void 0:e.fetch)||window.fetch.bind(window),"f"),i(this,Me,null==e?void 0:e.createPdf,"f"),i(this,Ie,new ge,"f"),i(this,Oe,new s(null!==(n=null==e?void 0:e.resourceCacheSize)&&void 0!==n?n:1e3),"f"),i(this,Ue,null!==(o=null==e?void 0:e.cacheTime)&&void 0!==o?o:6e4,"f"),i(this,Le,function(e){if(!e)return e;return e.endsWith("/")?e:e+"/"}(null==e?void 0:e.baseUrl)||"https://api.medplum.com/","f"),i(this,je,(null==e?void 0:e.clientId)||"","f"),i(this,Ne,(null==e?void 0:e.authorizeUrl)||t(this,Le,"f")+"oauth2/authorize","f"),i(this,_e,(null==e?void 0:e.tokenUrl)||t(this,Le,"f")+"oauth2/token","f"),i(this,We,(null==e?void 0:e.logoutUrl)||t(this,Le,"f")+"oauth2/logout","f"),i(this,Qe,null==e?void 0:e.onUnauthenticated,"f");const r=this.getActiveLogin();r&&(i(this,Be,r.accessToken,"f"),i(this,qe,r.refreshToken,"f"),t(this,Ae,"m",Ve).call(this).catch(console.log)),t(this,Ae,"m",at).call(this)}getBaseUrl(){return t(this,Le,"f")}clear(){t(this,Ie,"f").clear(),t(this,Oe,"f").clear(),i(this,Be,void 0,"f"),i(this,qe,void 0,"f"),i(this,He,void 0,"f"),i(this,ze,void 0,"f"),this.dispatchEvent({type:"change"})}invalidateUrl(e){e=e.toString(),t(this,Oe,"f").delete(e)}invalidateSearches(e){const i="fhir/R4/"+e;for(const e of t(this,Oe,"f").keys())(e.endsWith(i)||e.includes(i+"?"))&&t(this,Oe,"f").delete(e)}get(e,i={}){e=e.toString();const n=t(this,Ae,"m",Xe).call(this,e,i);if(n)return n.value;const o=new ye(t(this,Ae,"m",Je).call(this,"GET",e,i));return t(this,Ae,"m",Ye).call(this,e,o),o}post(e,i,n,o={}){return e=e.toString(),i&&t(this,Ae,"m",et).call(this,o,i),n&&t(this,Ae,"m",Ke).call(this,o,n),this.invalidateUrl(e),t(this,Ae,"m",Je).call(this,"POST",e,o)}put(e,i,n,o={}){return e=e.toString(),i&&t(this,Ae,"m",et).call(this,o,i),n&&t(this,Ae,"m",Ke).call(this,o,n),this.invalidateUrl(e),t(this,Ae,"m",Je).call(this,"PUT",e,o)}patch(e,i,n={}){return e=e.toString(),t(this,Ae,"m",et).call(this,n,i),t(this,Ae,"m",Ke).call(this,n,"application/json-patch+json"),this.invalidateUrl(e),t(this,Ae,"m",Je).call(this,"PATCH",e,n)}delete(e,i={}){return e=e.toString(),this.invalidateUrl(e),t(this,Ae,"m",Je).call(this,"DELETE",e,i)}startNewUser(t){return e(this,void 0,void 0,(function*(){return yield this.startPkce(),this.post("auth/newuser",Object.assign(Object.assign({},t),{codeChallengeMethod:"S256",codeChallenge:sessionStorage.getItem("codeChallenge")}))}))}startNewProject(t){return e(this,void 0,void 0,(function*(){return this.post("auth/newproject",t)}))}startNewPatient(t){return e(this,void 0,void 0,(function*(){return this.post("auth/newpatient",t)}))}startLogin(i){var n,o;return e(this,void 0,void 0,(function*(){const{codeChallenge:e,codeChallengeMethod:r}=this.getCodeChallenge(i);return this.post("auth/login",Object.assign(Object.assign({},i),{clientId:null!==(n=i.clientId)&&void 0!==n?n:t(this,je,"f"),scope:null!==(o=i.scope)&&void 0!==o?o:ct,codeChallengeMethod:r,codeChallenge:e}))}))}startGoogleLogin(i){var n,o;return e(this,void 0,void 0,(function*(){const{codeChallenge:e,codeChallengeMethod:r}=this.getCodeChallenge(i);return this.post("auth/google",Object.assign(Object.assign({},i),{clientId:null!==(n=i.clientId)&&void 0!==n?n:t(this,je,"f"),scope:null!==(o=i.scope)&&void 0!==o?o:ct,codeChallengeMethod:r,codeChallenge:e}))}))}getCodeChallenge(e){if(e.codeChallenge)return{codeChallenge:e.codeChallenge,codeChallengeMethod:e.codeChallengeMethod};const t=sessionStorage.getItem("codeChallenge");return t?{codeChallenge:t,codeChallengeMethod:"S256"}:{}}signOut(){this.clear()}signInWithRedirect(){return e(this,void 0,void 0,(function*(){const e=new URLSearchParams(window.location.search).get("code");return e?this.processCode(e):void(yield t(this,Ae,"m",it).call(this))}))}signOutWithRedirect(){window.location.assign(t(this,We,"f"))}fhirUrl(...e){return new URL(t(this,Le,"f")+"fhir/R4/"+e.join("/"))}fhirSearchUrl(e,t){const i=this.fhirUrl(e);return t&&(i.search=t.toString()),i}search(e,t,i={}){return this.get(this.fhirSearchUrl(e,t),i)}searchOne(e,i,n={}){const o=this.fhirSearchUrl(e,i);o.searchParams.set("_count","1"),o.searchParams.sort();const r=o.toString()+"-searchOne",a=t(this,Ae,"m",Xe).call(this,r,n);if(a)return a.value;const s=new ye(this.search(e,o.searchParams,n).then((e=>{var t,i;return null===(i=null===(t=e.entry)||void 0===t?void 0:t[0])||void 0===i?void 0:i.resource})));return t(this,Ae,"m",Ye).call(this,r,s),s}searchResources(e,i,n={}){const o=this.fhirSearchUrl(e,i).toString()+"-searchResources",r=t(this,Ae,"m",Xe).call(this,o,n);if(r)return r.value;const a=new ye(this.search(e,i,n).then((e=>{var t,i;return null!==(i=null===(t=e.entry)||void 0===t?void 0:t.map((e=>e.resource)))&&void 0!==i?i:[]})));return t(this,Ae,"m",Ye).call(this,o,a),a}searchValueSet(e,t,i={}){const n=this.fhirUrl("ValueSet","$expand");return n.searchParams.set("url",e),n.searchParams.set("filter",t),this.get(n.toString(),i)}getCached(e,i){var n;const o=null===(n=t(this,Oe,"f").get(this.fhirUrl(e,i).toString()))||void 0===n?void 0:n.value;return o&&o.isOk()?o.read():void 0}getCachedReference(e){const t=e.reference;if(!t)return;const[i,n]=t.split("/");return i&&n?this.getCached(i,n):void 0}readResource(e,t,i={}){return this.get(this.fhirUrl(e,t),i)}readReference(e,t={}){const i=null==e?void 0:e.reference;if(!i)return new ye(Promise.reject(new Error("Missing reference")));const[n,o]=i.split("/");return n&&o?this.readResource(n,o,t):new ye(Promise.reject(new Error("Invalid reference")))}getSchema(){return Re}requestSchema(t){return e(this,void 0,void 0,(function*(){if(t in Re.types)return Re;const e=`{\n StructureDefinitionList(name: "${t}") {\n name,\n description,\n snapshot {\n element {\n id,\n path,\n min,\n max,\n type {\n code,\n targetProfile\n },\n binding {\n valueSet\n },\n definition\n }\n }\n }\n SearchParameterList(base: "${t}", _count: 100) {\n base,\n code,\n type,\n expression,\n target\n }\n }`.replace(/\s+/g," "),i=yield this.graphql(e);for(const e of i.data.StructureDefinitionList)be(e);for(const e of i.data.SearchParameterList)De(e);return Re}))}readHistory(e,t,i={}){return this.get(this.fhirUrl(e,t,"_history"),i)}readVersion(e,t,i,n={}){return this.get(this.fhirUrl(e,t,"_history",i),n)}readPatientEverything(e,t={}){return this.get(this.fhirUrl("Patient",e,"$everything"),t)}createResource(e){if(!e.resourceType)throw new Error("Missing resourceType");return this.invalidateSearches(e.resourceType),this.post(this.fhirUrl(e.resourceType),e)}createResourceIfNoneExist(t,i){var n;return e(this,void 0,void 0,(function*(){return null!==(n=yield this.searchOne(t.resourceType,i))&&void 0!==n?n:this.createResource(t)}))}createBinary(e,t,i){const n=this.fhirUrl("Binary");return t&&n.searchParams.set("_filename",t),this.post(n,e,i)}createPdf(i,n,o,r){return e(this,void 0,void 0,(function*(){if(!t(this,Me,"f"))throw new Error("PDF creation not enabled");const e=yield t(this,Me,"f").call(this,i,o,r);return this.createBinary(e,n,"application/pdf")}))}createComment(e,t){const i=this.getProfile();let n,o;return"Encounter"===e.resourceType&&(n=E(e),o=e.subject),"ServiceRequest"===e.resourceType&&(n=e.encounter,o=e.subject),"Patient"===e.resourceType&&(o=E(e)),this.createResource({resourceType:"Communication",basedOn:[E(e)],encounter:n,subject:o,sender:i?E(i):void 0,sent:(new Date).toISOString(),payload:[{contentString:t}]})}updateResource(t){return e(this,void 0,void 0,(function*(){if(!t.resourceType)throw new Error("Missing resourceType");if(!t.id)throw new Error("Missing id");this.invalidateSearches(t.resourceType);const e=yield this.put(this.fhirUrl(t.resourceType,t.id),t);return null!=e?e:t}))}patchResource(e,t,i){return this.invalidateSearches(e),this.patch(this.fhirUrl(e,t),i)}deleteResource(e,t){return this.invalidateSearches(e),this.delete(this.fhirUrl(e,t))}executeBatch(e){return this.post("fhir/R4",e)}sendEmail(e){return this.post("email/v1/send",e,"application/json")}graphql(e,t,i,n){return this.post(this.fhirUrl("$graphql"),{query:e,operationName:t,variables:i},"application/json",n)}readResourceGraph(e,t,i){return this.get(`${this.fhirUrl(e,t)}/$graph?graph=${i}`)}getActiveLogin(){return t(this,Ie,"f").getObject("activeLogin")}setActiveLogin(n){return e(this,void 0,void 0,(function*(){i(this,Be,n.accessToken,"f"),i(this,qe,n.refreshToken,"f"),i(this,He,void 0,"f"),i(this,ze,void 0,"f"),t(this,Ie,"f").setObject("activeLogin",n),t(this,Ae,"m",Ge).call(this,n),t(this,Oe,"f").clear(),i(this,$e,void 0,"f"),yield t(this,Ae,"m",Ve).call(this)}))}getAccessToken(){return t(this,Be,"f")}setAccessToken(e){i(this,Be,e,"f"),i(this,qe,void 0,"f"),i(this,He,void 0,"f"),i(this,ze,void 0,"f")}getLogins(){var e;return null!==(e=t(this,Ie,"f").getObject("logins"))&&void 0!==e?e:[]}isLoading(){return!!t(this,Fe,"f")}getProfile(){return t(this,He,"f")}getProfileAsync(){return e(this,void 0,void 0,(function*(){return t(this,Fe,"f")&&(yield t(this,Fe,"f")),this.getProfile()}))}getUserConfiguration(){return t(this,ze,"f")}download(i,n={}){return e(this,void 0,void 0,(function*(){t(this,$e,"f")&&(yield t(this,$e,"f")),t(this,Ae,"m",Ze).call(this,n);return(yield t(this,ke,"f").call(this,i.toString(),n)).blob()}))}startPkce(){return e(this,void 0,void 0,(function*(){const t=re();sessionStorage.setItem("pkceState",t);const i=re();sessionStorage.setItem("codeVerifier",i);const n=H(yield function(t){return e(this,void 0,void 0,(function*(){return crypto.subtle.digest("SHA-256",(new TextEncoder).encode(t))}))}(i)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"");sessionStorage.setItem("codeChallenge",n)}))}processCode(e){const i=new URLSearchParams;i.set("grant_type","authorization_code"),i.set("client_id",t(this,je,"f")),i.set("code",e),i.set("redirect_uri",lt());const n=sessionStorage.getItem("codeVerifier");return n&&i.set("code_verifier",n),t(this,Ae,"m",ot).call(this,i)}startClientLogin(i,n){return e(this,void 0,void 0,(function*(){const e=new URLSearchParams;return e.set("grant_type","client_credentials"),e.set("client_id",i),e.set("client_secret",n),t(this,Ae,"m",ot).call(this,e)}))}}function lt(){return window.location.protocol+"//"+window.location.host+"/"}function ut(e){if(e.startsWith("T"))return e+"T00:00:00.000Z".substring(e.length);if(e.length<=10)return e;try{return new Date(e).toISOString()}catch(t){return e}}function mt(e){return[{type:ve.boolean,value:e}]}function ht(e){return null==e?{type:"undefined",value:void 0}:Number.isSafeInteger(e)?{type:ve.integer,value:e}:"number"==typeof e?{type:ve.decimal,value:e}:"boolean"==typeof e?{type:ve.boolean,value:e}:"string"==typeof e?{type:ve.string,value:e}:Ct(e)?{type:ve.Quantity,value:e}:"object"==typeof e&&"resourceType"in e?{type:e.resourceType,value:e}:{type:ve.BackboneElement,value:e}}function pt(e){return 0!==e.length&&!!e[0].value}function ft(e,t){if(!(null==e?void 0:e.value))return;const i=Pe(e.type,t);if(i){const n=function(e,t,i){var n;const o=i.type;if(!o||0===o.length)return;let r,a="undefined";if(1===o.length)r=e.value[t],a=o[0].code;else for(const i of o){const n=t.replace("[x]","")+z(i.code);if(n in e.value){r=e.value[n],a=i.code;break}}if(N(r))return;"Element"!==a&&"BackboneElement"!==a||(a=Te(null===(n=i.path)||void 0===n?void 0:n.split(".")));return Array.isArray(r)?r.map((e=>yt(e,a))):yt(r,a)}(e,t,i);if(n)return n}return function(e,t){const i=e.value;if(!i||"object"!=typeof i)return;let n;if(t in i)n=i[t];else for(const e in ve){const o=t+z(e);if(o in i){n=i[o];break}}if(N(n))return;return Array.isArray(n)?n.map(ht):ht(n)}(e,t)}function yt(e,t){return"Resource"===t&&"object"==typeof e&&"resourceType"in e&&(t=e.resourceType),{type:t,value:e}}function gt(e){const t=[];for(const i of e){let e=!1;for(const n of t)if(pt(wt(i,n))){e=!0;break}e||t.push(i)}return t}function xt(e){return mt(!pt(e))}function vt(e,t){return 0===e.length||0===t.length?[]:e.length!==t.length?mt(!1):mt(e.every(((e,i)=>pt(wt(e,t[i])))))}function wt(e,t){const i=e.value,n=t.value;return"number"==typeof i&&"number"==typeof n?mt(Math.abs(i-n)<1e-8):Ct(i)&&Ct(n)?mt(Pt(i,n)):mt("object"==typeof i&&"object"==typeof n?Rt(e,t):i===n)}function Et(e,t){return 0===e.length&&0===t.length?mt(!0):e.length!==t.length?mt(!1):(e.sort(bt),t.sort(bt),mt(e.every(((e,i)=>pt(St(e,t[i]))))))}function St(e,t){const i=e.value,n=t.value;return"number"==typeof i&&"number"==typeof n?mt(Math.abs(i-n)<.01):Ct(i)&&Ct(n)?mt(Pt(i,n)):mt("object"==typeof i&&"object"==typeof n?Rt(i,n):"string"==typeof i&&"string"==typeof n?i.toLowerCase()===n.toLowerCase():i===n)}function bt(e,t){const i=e.value,n=t.value;return"number"==typeof i&&"number"==typeof n?i-n:"string"==typeof i&&"string"==typeof n?i.localeCompare(n):0}function Dt(e,t){const{value:i}=e;if(null==i)return!1;switch(t){case"Boolean":return"boolean"==typeof i;case"Decimal":case"Integer":return"number"==typeof i;case"Date":return"string"==typeof i&&!!i.match(/^\d{4}(-\d{2}(-\d{2})?)?/);case"DateTime":return"string"==typeof i&&!!i.match(/^\d{4}(-\d{2}(-\d{2})?)?T/);case"Time":return"string"==typeof i&&!!i.match(/^T\d/);case"Period":return Tt(i);case"Quantity":return Ct(i);default:return"object"==typeof i&&(null==i?void 0:i.resourceType)===t}}function Tt(e){return!(!e||"object"!=typeof e||!("start"in e))}function Ct(e){return!(!e||"object"!=typeof e||!("value"in e)||"number"!=typeof e.value)}function Pt(e,t){return Math.abs(e.value-t.value)<.01&&(e.unit===t.unit||e.code===t.code||e.unit===t.code||e.code===t.unit)}function Rt(e,t){const i=Object.keys(e),n=Object.keys(t);if(i.length!==n.length)return!1;for(const n of i){const i=e[n],o=t[n];if(At(i)&&At(o)){if(!Rt(i,o))return!1}else if(i!==o)return!1}return!0}function At(e){return null!==e&&"object"==typeof e}ke=new WeakMap,Me=new WeakMap,Ie=new WeakMap,Oe=new WeakMap,Ue=new WeakMap,Le=new WeakMap,je=new WeakMap,Ne=new WeakMap,_e=new WeakMap,We=new WeakMap,Qe=new WeakMap,Be=new WeakMap,qe=new WeakMap,$e=new WeakMap,Fe=new WeakMap,He=new WeakMap,ze=new WeakMap,Ae=new WeakSet,Ge=function(e){const i=this.getLogins().filter((t=>{var i,n;return(null===(i=t.profile)||void 0===i?void 0:i.reference)!==(null===(n=e.profile)||void 0===n?void 0:n.reference)}));i.push(e),t(this,Ie,"f").setObject("logins",i)},Ve=function(){return e(this,void 0,void 0,(function*(){return i(this,Fe,new Promise(((e,n)=>{this.get("auth/me").then((n=>{i(this,Fe,void 0,"f"),i(this,He,n.profile,"f"),i(this,ze,n.config,"f"),this.dispatchEvent({type:"change"}),e(t(this,He,"f"))})).catch(n)})),"f"),t(this,Fe,"f")}))},Xe=function(e,i){if(t(this,Ue,"f")<=0||"no-cache"===(null==i?void 0:i.cache)||"reload"===(null==i?void 0:i.cache))return;const n=t(this,Oe,"f").get(e);return!n||n.requestTime+t(this,Ue,"f")<Date.now()?void 0:n},Ye=function(e,i){t(this,Ue,"f")>0&&t(this,Oe,"f").set(e,{requestTime:Date.now(),value:i})},Je=function(i,n,o={}){return e(this,void 0,void 0,(function*(){t(this,$e,"f")&&(yield t(this,$e,"f")),n.startsWith("http")||(n=t(this,Le,"f")+n),o.method=i,t(this,Ae,"m",Ze).call(this,o);const e=yield t(this,ke,"f").call(this,n,o);if(401===e.status)return t(this,Ae,"m",tt).call(this,i,n,o);if(204===e.status||304===e.status)return;const r=yield e.json();if(e.status>=400)throw r;return r}))},Ze=function(e){e.headers||(e.headers={});const i=e.headers;i["X-Medplum"]="extended",i["Content-Type"]||(i["Content-Type"]="application/fhir+json"),t(this,Be,"f")&&(i.Authorization="Bearer "+t(this,Be,"f")),e.cache||(e.cache="no-cache"),e.credentials||(e.credentials="include")},Ke=function(e,t){e.headers||(e.headers={});e.headers["Content-Type"]=t},et=function(e,t){"string"==typeof t||"undefined"!=typeof Blob&&t instanceof Blob||"undefined"!=typeof File&&t instanceof File||"undefined"!=typeof Uint8Array&&t instanceof Uint8Array?e.body=t:t&&(e.body=JSON.stringify(t))},tt=function(i,n,o){return e(this,void 0,void 0,(function*(){return t(this,Ae,"m",nt).call(this).then((()=>t(this,Ae,"m",Je).call(this,i,n,o))).catch((e=>(this.clear(),t(this,Qe,"f")&&t(this,Qe,"f").call(this),Promise.reject(e))))}))},it=function(){return e(this,void 0,void 0,(function*(){yield this.startPkce();const e=new URL(t(this,Ne,"f"));e.searchParams.set("response_type","code"),e.searchParams.set("state",sessionStorage.getItem("pkceState")),e.searchParams.set("client_id",t(this,je,"f")),e.searchParams.set("redirect_uri",lt()),e.searchParams.set("scope",ct),e.searchParams.set("code_challenge_method","S256"),e.searchParams.set("code_challenge",sessionStorage.getItem("codeChallenge")),window.location.assign(e.toString())}))},nt=function(){return e(this,void 0,void 0,(function*(){if(t(this,$e,"f"))return t(this,$e,"f");if(!t(this,qe,"f"))throw this.clear(),new Error("Invalid refresh token");const e=new URLSearchParams;e.set("grant_type","refresh_token"),e.set("client_id",t(this,je,"f")),e.set("refresh_token",t(this,qe,"f")),i(this,$e,t(this,Ae,"m",ot).call(this,e),"f"),yield t(this,$e,"f")}))},ot=function(i){return e(this,void 0,void 0,(function*(){return t(this,ke,"f").call(this,t(this,_e,"f"),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:i,credentials:"include"}).then((e=>{if(!e.ok)throw new Error("Failed to fetch tokens");return e.json()})).then((e=>t(this,Ae,"m",rt).call(this,e))).then((()=>this.getProfile()))}))},rt=function(i){return e(this,void 0,void 0,(function*(){const e=i.access_token,n=fe(e);if(Date.now()>=1e3*n.exp)throw this.clear(),new Error("Token expired");if(t(this,je,"f")&&n.client_id!==t(this,je,"f"))throw this.clear(),new Error("Token was not issued for this audience");yield this.setActiveLogin({accessToken:e,refreshToken:i.refresh_token,project:i.project,profile:i.profile})}))},at=function(){try{window.addEventListener("storage",(e=>{null!==e.key&&"activeLogin"!==e.key||window.location.reload()}))}catch(e){}};const kt=()=>[],Mt={empty:e=>mt(0===e.length),exists:(e,t)=>mt(t?e.filter((e=>pt(t.eval([e])))).length>0:e.length>0),all:(e,t)=>mt(e.every((e=>pt(t.eval([e]))))),allTrue:e=>{for(const t of e)if(!t.value)return mt(!1);return mt(!0)},anyTrue:e=>{for(const t of e)if(t.value)return mt(!0);return mt(!1)},allFalse:e=>{for(const t of e)if(t.value)return mt(!1);return mt(!0)},anyFalse:e=>{for(const t of e)if(!t.value)return mt(!0);return mt(!1)},subsetOf:kt,supersetOf:kt,count:e=>[{type:ve.integer,value:e.length}],distinct:e=>{const t=[];for(const i of e)t.some((e=>e.value===i.value))||t.push(i);return t},isDistinct:e=>mt(e.length===Mt.distinct(e).length),where:(e,t)=>e.filter((e=>pt(t.eval([e])))),select:(e,t)=>e.map((e=>t.eval([e]))).flat(),repeat:kt,ofType:(e,t)=>e.filter((e=>e.type===t.name)),single:e=>{if(e.length>1)throw new Error("Expected input length one for single()");return 0===e.length?[]:e.slice(0,1)},first:e=>0===e.length?[]:e.slice(0,1),last:e=>0===e.length?[]:e.slice(e.length-1,e.length),tail:e=>0===e.length?[]:e.slice(1,e.length),skip:(e,t)=>{var i;const n=null===(i=t.eval(e)[0])||void 0===i?void 0:i.value;if("number"!=typeof n)throw new Error("Expected a number for skip(num)");return n>=e.length?[]:n<=0?e:e.slice(n,e.length)},take:(e,t)=>{var i;const n=null===(i=t.eval(e)[0])||void 0===i?void 0:i.value;if("number"!=typeof n)throw new Error("Expected a number for take(num)");return n>=e.length?e:n<=0?[]:e.slice(0,n)},intersect:(e,t)=>{if(!t)return e;const i=t.eval(e),n=[];for(const t of e)!n.some((e=>e.value===t.value))&&i.some((e=>e.value===t.value))&&n.push(t);return n},exclude:(e,t)=>{if(!t)return e;const i=t.eval(e),n=[];for(const t of e)i.some((e=>e.value===t.value))||n.push(t);return n},union:(e,t)=>{if(!t)return e;const i=t.eval(e);return gt([...e,...i])},combine:(e,t)=>{if(!t)return e;const i=t.eval(e);return[...e,...i]},iif:(e,t,i,n)=>{const o=t.eval(e);if(o.length>1||1===o.length&&"boolean"!=typeof o[0].value)throw new Error("Expected criterion to evaluate to a Boolean");return pt(o)?i.eval(e):n?n.eval(e):[]},toBoolean:e=>{if(0===e.length)return[];const[{value:t}]=Ut(e,1);if("boolean"==typeof t)return[{type:ve.boolean,value:t}];if("number"==typeof t&&(0===t||1===t))return mt(!!t);if("string"==typeof t){const e=t.toLowerCase();if(["true","t","yes","y","1","1.0"].includes(e))return mt(!0);if(["false","f","no","n","0","0.0"].includes(e))return mt(!1)}return[]},convertsToBoolean:e=>0===e.length?[]:mt(1===Mt.toBoolean(e).length),toInteger:e=>{if(0===e.length)return[];const[{value:t}]=Ut(e,1);return"number"==typeof t?[{type:ve.integer,value:t}]:"string"==typeof t&&t.match(/^[+-]?\d+$/)?[{type:ve.integer,value:parseInt(t,10)}]:"boolean"==typeof t?[{type:ve.integer,value:t?1:0}]:[]},convertsToInteger:e=>0===e.length?[]:mt(1===Mt.toInteger(e).length),toDate:e=>{if(0===e.length)return[];const[{value:t}]=Ut(e,1);return"string"==typeof t&&t.match(/^\d{4}(-\d{2}(-\d{2})?)?/)?[{type:ve.date,value:ut(t)}]:[]},convertsToDate:e=>0===e.length?[]:mt(1===Mt.toDate(e).length),toDateTime:e=>{if(0===e.length)return[];const[{value:t}]=Ut(e,1);return"string"==typeof t&&t.match(/^\d{4}(-\d{2}(-\d{2})?)?/)?[{type:ve.dateTime,value:ut(t)}]:[]},convertsToDateTime:e=>0===e.length?[]:mt(1===Mt.toDateTime(e).length),toDecimal:e=>{if(0===e.length)return[];const[{value:t}]=Ut(e,1);return"number"==typeof t?[{type:ve.decimal,value:t}]:"string"==typeof t&&t.match(/^-?\d{1,9}(\.\d{1,9})?$/)?[{type:ve.decimal,value:parseFloat(t)}]:"boolean"==typeof t?[{type:ve.decimal,value:t?1:0}]:[]},convertsToDecimal:e=>0===e.length?[]:mt(1===Mt.toDecimal(e).length),toQuantity:e=>{if(0===e.length)return[];const[{value:t}]=Ut(e,1);return Ct(t)?[{type:ve.Quantity,value:t}]:"number"==typeof t?[{type:ve.Quantity,value:{value:t,unit:"1"}}]:"string"==typeof t&&t.match(/^-?\d{1,9}(\.\d{1,9})?/)?[{type:ve.Quantity,value:{value:parseFloat(t),unit:"1"}}]:"boolean"==typeof t?[{type:ve.Quantity,value:{value:t?1:0,unit:"1"}}]:[]},convertsToQuantity:e=>0===e.length?[]:mt(1===Mt.toQuantity(e).length),toString:e=>{if(0===e.length)return[];const[{value:t}]=Ut(e,1);return null==t?[]:Ct(t)?[{type:ve.string,value:`${t.value} '${t.unit}'`}]:[{type:ve.string,value:t.toString()}]},convertsToString:e=>0===e.length?[]:mt(1===Mt.toString(e).length),toTime:e=>{if(0===e.length)return[];const[{value:t}]=Ut(e,1);if("string"==typeof t){const e=t.match(/^T?(\d{2}(:\d{2}(:\d{2})?)?)/);if(e)return[{type:ve.time,value:ut("T"+e[1])}]}return[]},convertsToTime:e=>0===e.length?[]:mt(1===Mt.toTime(e).length),indexOf:(e,t)=>It(((e,t)=>e.indexOf(t)),e,t),substring:(e,t,i)=>It(((e,t,i)=>{const n=t,o=i?n+i:e.length;return n<0||n>=e.length?void 0:e.substring(n,o)}),e,t,i),startsWith:(e,t)=>It(((e,t)=>e.startsWith(t)),e,t),endsWith:(e,t)=>It(((e,t)=>e.endsWith(t)),e,t),contains:(e,t)=>It(((e,t)=>e.includes(t)),e,t),upper:e=>It((e=>e.toUpperCase()),e),lower:e=>It((e=>e.toLowerCase()),e),replace:(e,t,i)=>It(((e,t,i)=>e.replaceAll(t,i)),e,t,i),matches:(e,t)=>It(((e,t)=>!!e.match(t)),e,t),replaceMatches:(e,t,i)=>It(((e,t,i)=>e.replaceAll(t,i)),e,t,i),length:e=>It((e=>e.length),e),toChars:e=>It((e=>e?e.split(""):void 0),e),abs:e=>Ot(Math.abs,e),ceiling:e=>Ot(Math.ceil,e),exp:e=>Ot(Math.exp,e),floor:e=>Ot(Math.floor,e),ln:e=>Ot(Math.log,e),log:(e,t)=>Ot(((e,t)=>Math.log(e)/Math.log(t)),e,t),power:(e,t)=>Ot(Math.pow,e,t),round:e=>Ot(Math.round,e),sqrt:e=>Ot(Math.sqrt,e),truncate:e=>Ot((e=>0|e),e),children:kt,descendants:kt,trace:(e,t)=>(console.log("trace",e,t),e),now:()=>[{type:ve.dateTime,value:(new Date).toISOString()}],timeOfDay:()=>[{type:ve.time,value:(new Date).toISOString().substring(11)}],today:()=>[{type:ve.date,value:(new Date).toISOString().substring(0,10)}],between:(e,t,i,n)=>{var o;const r=Mt.toDateTime(t.eval(e));if(0===r.length)throw new Error("Invalid start date");const a=Mt.toDateTime(i.eval(e));if(0===a.length)throw new Error("Invalid end date");const s=null===(o=n.eval(e)[0])||void 0===o?void 0:o.value;if("years"!==s&&"months"!==s&&"days"!==s)throw new Error("Invalid units");const c=A(r[0].value,a[0].value);return[{type:ve.Quantity,value:{value:c[s],unit:s}}]},is:(e,t)=>{let i="";return t instanceof gi?i=t.name:t instanceof Ti&&(i=t.left.name+"."+t.right.name),i?e.map((e=>({type:ve.boolean,value:Dt(e,i)}))):[]},not:e=>Mt.toBoolean(e).map((e=>({type:ve.boolean,value:!e.value}))),resolve:e=>e.map((e=>{const t=e.value;let i;if("string"==typeof t)i=t;else if("object"==typeof t){const e=t;if(e.resource)return ht(e.resource);i=e.reference}if(!i)return{type:ve.BackboneElement,value:null};const[n,o]=i.split("/");return{type:ve.BackboneElement,value:{resourceType:n,id:o}}})).filter((e=>!!e.value)),as:e=>e,type:e=>e.map((({value:e})=>"boolean"==typeof e?{type:ve.BackboneElement,value:{namespace:"System",name:"Boolean"}}:"number"==typeof e?{type:ve.BackboneElement,value:{namespace:"System",name:"Integer"}}:e&&"object"==typeof e&&"resourceType"in e?{type:ve.BackboneElement,value:{namespace:"FHIR",name:e.resourceType}}:{type:ve.BackboneElement,value:null})),conformsTo:(e,t)=>{const i=t.eval(e)[0].value;if(!i.startsWith("http://hl7.org/fhir/StructureDefinition/"))throw new Error("Expected a StructureDefinition URL");const n=i.replace("http://hl7.org/fhir/StructureDefinition/","");return e.map((e=>{var t;return{type:ve.boolean,value:(null===(t=e.value)||void 0===t?void 0:t.resourceType)===n}}))}};function It(e,t,...i){if(0===t.length)return[];const[{value:n}]=Ut(t,1);if("string"!=typeof n)throw new Error("String function cannot be called with non-string");const o=e(n,...i.map((e=>{var i,n;return e&&(null===(n=null===(i=e.eval(t))||void 0===i?void 0:i[0])||void 0===n?void 0:n.value)})));return void 0===o?[]:Array.isArray(o)?o.map(ht):[ht(o)]}function Ot(e,t,...i){if(0===t.length)return[];const[{value:n}]=Ut(t,1),o=Ct(n),r=o?n.value:n;if("number"!=typeof r)throw new Error("Math function cannot be called with non-number");const a=e(r,...i.map((e=>{var i,n;return null===(n=null===(i=e.eval(t))||void 0===i?void 0:i[0])||void 0===n?void 0:n.value})));return[{type:o?ve.Quantity:t[0].type,value:o?Object.assign(Object.assign({},n),{value:a}):a}]}function Ut(e,t){if(e.length!==t)throw new Error(`Expected ${t} arguments`);for(const t of e)if(null==t)throw new Error("Expected non-null argument");return e}var Lt,jt,Nt,_t,Wt,Qt,Bt,qt,$t,Ft,Ht,zt,Gt,Vt,Xt,Yt,Jt,Zt,Kt,ei,ti,ii,ni,oi,ri,ai,si,ci,di,li,ui,mi,hi,pi;class fi{constructor(e,t){this.original=e,this.child=t}eval(e){try{return e.length>0?e.map((e=>this.child.eval([e]))).flat():this.child.eval([])}catch(e){throw new Error(`FhirPathError on "${this.original}": ${e}`)}}}class yi{constructor(e){this.value=e}eval(){return[this.value]}}class gi{constructor(e){this.name=e,Lt.add(this)}eval(e){return"$this"===this.name?e:e.map((e=>t(this,Lt,"m",jt).call(this,e))).flat().filter((e=>void 0!==(null==e?void 0:e.value)))}}Lt=new WeakSet,jt=function(e){const t=e.value;if(t&&"object"==typeof t)return"resourceType"in t&&t.resourceType===this.name?e:ft(e,this.name)};class xi{eval(){return[]}}class vi{constructor(e,t){this.child=e,this.impl=t}eval(e){return this.impl(this.child.eval(e))}}class wi{constructor(e,t){this.left=e,this.right=t}eval(e){return Mt.ofType(this.left.eval(e),this.right)}}class Ei{constructor(e,t,i){this.left=e,this.right=t,this.impl=i}eval(e){const t=this.left.eval(e);if(1!==t.length)return[];const i=this.right.eval(e);if(1!==i.length)return[];const n=t[0].value,o=i[0].value,r=Ct(n)?n.value:n,a=Ct(o)?o.value:o,s=this.impl(r,a);return"boolean"==typeof s?mt(s):Ct(n)?[{type:ve.Quantity,value:Object.assign(Object.assign({},n),{value:s})}]:[ht(s)]}}class Si{constructor(e,t){this.left=e,this.right=t}eval(e){const t=[...this.left.eval(e),...this.right.eval(e)];return t.length>0&&t.every((e=>"string"==typeof e.value))?[{type:ve.string,value:t.map((e=>e.value)).join("")}]:t}}class bi{constructor(e,t){this.left=e,this.right=t}eval(e){const t=this.left.eval(e),i=this.right.eval(e);return mt(t.some((e=>e.value===i[0].value)))}}class Di{constructor(e,t){this.left=e,this.right=t}eval(e){const t=this.left.eval(e);return mt(this.right.eval(e).some((e=>e.value===t[0].value)))}}class Ti{constructor(e,t){this.left=e,this.right=t}eval(e){return this.right.eval(this.left.eval(e))}}class Ci{constructor(e,t){this.left=e,this.right=t}eval(e){return gt([...this.left.eval(e),...this.right.eval(e)])}}class Pi{constructor(e,t){this.left=e,this.right=t}eval(e){return vt(this.left.eval(e),this.right.eval(e))}}class Ri{constructor(e,t){this.left=e,this.right=t}eval(e){return xt(vt(this.left.eval(e),this.right.eval(e)))}}class Ai{constructor(e,t){this.left=e,this.right=t}eval(e){return Et(this.left.eval(e),this.right.eval(e))}}class ki{constructor(e,t){this.left=e,this.right=t}eval(e){return xt(Et(this.left.eval(e),this.right.eval(e)))}}class Mi{constructor(e,t){this.left=e,this.right=t}eval(e){const t=this.left.eval(e);if(1!==t.length)return[];const i=this.right.name;return mt(Dt(t[0],i))}}class Ii{constructor(e,t){this.left=e,this.right=t}eval(e){var t,i,n,o;const r=this.left.eval(e),a=this.right.eval(e);return!0===(null===(t=r[0])||void 0===t?void 0:t.value)&&!0===(null===(i=a[0])||void 0===i?void 0:i.value)?mt(!0):!1===(null===(n=r[0])||void 0===n?void 0:n.value)||!1===(null===(o=a[0])||void 0===o?void 0:o.value)?mt(!1):[]}}class Oi{constructor(e,t){this.left=e,this.right=t}eval(e){const t=this.left.eval(e);if(pt(t))return t;const i=this.right.eval(e);return pt(i)?i:[]}}class Ui{constructor(e,t){this.left=e,this.right=t}eval(e){const t=this.left.eval(e),i=this.right.eval(e);if(0===t.length&&0===i.length)return[];const n=0===t.length?null:t[0].value,o=0===i.length?null:i[0].value;return!0===n&&!0!==o||!0!==n&&!0===o?mt(!0):!0===n&&!0===o||!1===n&&!1===o?mt(!1):[]}}class Li{constructor(e,t,i){this.name=e,this.args=t,this.impl=i}eval(e){return this.impl(e,...this.args)}}class ji{constructor(e,t){this.left=e,this.expr=t}eval(e){const t=this.expr.eval(e);if(1!==t.length)return[];const i=t[0].value;if("number"!=typeof i)throw new Error("Invalid indexer expression: should return integer}");const n=this.left.eval(e);return i in n?[n[i]]:[]}}class Ni{constructor(){Nt.set(this,{}),_t.set(this,{})}registerInfix(e,i){return t(this,_t,"f")[e]=i,this}registerPrefix(e,i){return t(this,Nt,"f")[e]=i,this}prefix(e,t,i){return this.registerPrefix(e,{parse(e,n){const o=e.consumeAndParse(t);return i(n,o)}})}infixLeft(e,t,i){return this.registerInfix(e,{parse(e,n,o){const r=e.consumeAndParse(t);return i(n,o,r)},precedence:t})}construct(e){return new _i(e,t(this,Nt,"f"),t(this,_t,"f"))}}Nt=new WeakMap,_t=new WeakMap;class _i{constructor(e,t,n){Wt.set(this,void 0),Qt.set(this,void 0),Bt.set(this,void 0),i(this,Wt,e,"f"),i(this,Qt,t,"f"),i(this,Bt,n,"f")}hasMore(){return t(this,Wt,"f").length>0}match(e){const t=this.peek();return(null==t?void 0:t.id)===e&&(this.consume(),!0)}consumeAndParse(e=1/0){const i=this.consume(),n=t(this,Qt,"f")[i.id];if(!n)throw Error(`Parse error at "${i.value}" (line ${i.line}, column ${i.column}). No matching prefix parselet.`);let o=n.parse(this,i);for(;e>this.getPrecedence();){const e=this.consume();o=t(this,Bt,"f")[e.id].parse(this,o,e)}return o}getPrecedence(){const e=this.peek();if(!e)return 1/0;const i=t(this,Bt,"f")[e.id];return i?i.precedence:1/0}consume(e){var i;if(!t(this,Wt,"f").length)throw Error("Cant consume unknown more tokens.");if(e&&(null===(i=this.peek())||void 0===i?void 0:i.id)!==e){const t=this.peek();throw Error(`Expected ${e} but got "${t.value}" at line ${t.line} column ${t.column}.`)}return t(this,Wt,"f").shift()}peek(){return t(this,Wt,"f").length>0?t(this,Wt,"f")[0]:void 0}removeComments(){i(this,Wt,t(this,Wt,"f").filter((e=>"Comment"!==e.id)),"f")}}Wt=new WeakMap,Qt=new WeakMap,Bt=new WeakMap;const Wi=["year","years","month","months","week","weeks","day","days","hour","hours","minute","minutes","second","seconds","millisecond","milliseconds"];class Qi{constructor(e,t,n){qt.add(this),$t.set(this,void 0),Ft.set(this,void 0),Ht.set(this,void 0),zt.set(this,[]),Gt.set(this,{index:0,line:0,column:0}),Vt.set(this,[]),i(this,$t,e,"f"),i(this,Ft,t,"f"),i(this,Ht,n,"f")}tokenize(){for(;t(this,Gt,"f").index<t(this,$t,"f").length;){const e=t(this,qt,"m",Jt).call(this);e&&t(this,zt,"f").push(e)}return t(this,zt,"f")}}$t=new WeakMap,Ft=new WeakMap,Ht=new WeakMap,zt=new WeakMap,Gt=new WeakMap,Vt=new WeakMap,qt=new WeakSet,Xt=function(){return t(this,zt,"f").slice(-1)[0]},Yt=function(){t(this,qt,"m",ui).call(this);const e=t(this,qt,"m",Jt).call(this);return t(this,qt,"m",mi).call(this),e},Jt=function(){t(this,qt,"m",Zt).call(this);const e=t(this,qt,"m",ci).call(this);if(!e)return;t(this,qt,"m",ui).call(this);const i=t(this,qt,"m",li).call(this);return"/"===e&&"*"===i?t(this,qt,"m",Kt).call(this):"/"===e&&"/"===i?t(this,qt,"m",ei).call(this):"'"===e||'"'===e?t(this,qt,"m",ti).call(this,e):"`"===e?t(this,qt,"m",ii).call(this):"@"===e?t(this,qt,"m",ni).call(this):e.match(/\d/)?t(this,qt,"m",oi).call(this):e.match(/\w/)||"$"===e&&i.match(/\w/)?t(this,qt,"m",ri).call(this):t(this,qt,"m",ai).call(this)},Zt=function(){t(this,qt,"m",si).call(this,(()=>t(this,qt,"m",ci).call(this).match(/\s/)))},Kt=function(){const e=t(this,Gt,"f").index;return t(this,qt,"m",si).call(this,(()=>"*"!==t(this,qt,"m",ci).call(this)||"/"!==t(this,qt,"m",li).call(this))),t(this,qt,"m",hi).call(this),t(this,qt,"m",hi).call(this),t(this,qt,"m",pi).call(this,"Comment",t(this,$t,"f").substring(e,t(this,Gt,"f").index))},ei=function(){return t(this,qt,"m",pi).call(this,"Comment",t(this,qt,"m",si).call(this,(()=>"\n"!==t(this,qt,"m",ci).call(this))))},ti=function(e){t(this,qt,"m",hi).call(this);const i=t(this,qt,"m",pi).call(this,"String",t(this,qt,"m",si).call(this,(()=>"\\"===t(this,qt,"m",di).call(this)||t(this,qt,"m",ci).call(this)!==e)));return t(this,qt,"m",hi).call(this),i},ii=function(){t(this,qt,"m",hi).call(this);const e=t(this,qt,"m",pi).call(this,"Symbol",t(this,qt,"m",si).call(this,(()=>"`"!==t(this,qt,"m",ci).call(this))));return t(this,qt,"m",hi).call(this),e},ni=function(){t(this,qt,"m",hi).call(this);const e=t(this,Gt,"f").index;return t(this,qt,"m",si).call(this,(()=>t(this,qt,"m",ci).call(this).match(/[\d-]/))),"T"===t(this,qt,"m",ci).call(this)&&(t(this,qt,"m",hi).call(this),t(this,qt,"m",si).call(this,(()=>t(this,qt,"m",ci).call(this).match(/[\d:]/))),"."===t(this,qt,"m",ci).call(this)&&t(this,qt,"m",li).call(this).match(/\d/)&&(t(this,qt,"m",hi).call(this),t(this,qt,"m",si).call(this,(()=>t(this,qt,"m",ci).call(this).match(/\d/)))),"Z"===t(this,qt,"m",ci).call(this)?t(this,qt,"m",hi).call(this):"+"!==t(this,qt,"m",ci).call(this)&&"-"!==t(this,qt,"m",ci).call(this)||(t(this,qt,"m",hi).call(this),t(this,qt,"m",si).call(this,(()=>t(this,qt,"m",ci).call(this).match(/[\d:]/))))),t(this,qt,"m",pi).call(this,"DateTime",t(this,$t,"f").substring(e,t(this,Gt,"f").index))},oi=function(){const e=t(this,Gt,"f").index;let i="Number";return t(this,qt,"m",si).call(this,(()=>t(this,qt,"m",ci).call(this).match(/\d/))),"."===t(this,qt,"m",ci).call(this)&&t(this,qt,"m",li).call(this).match(/\d/)&&(t(this,qt,"m",hi).call(this),t(this,qt,"m",si).call(this,(()=>t(this,qt,"m",ci).call(this).match(/\d/))))," "===t(this,qt,"m",ci).call(this)&&function(e){if(e){if("String"===e.id)return!0;if("Symbol"===e.id&&Wi.includes(e.value))return!0}return!1}(t(this,qt,"m",Yt).call(this))&&(i="Quantity",t(this,qt,"m",Jt).call(this)),t(this,qt,"m",pi).call(this,i,t(this,$t,"f").substring(e,t(this,Gt,"f").index))},ri=function(){var e;const i=t(this,qt,"m",si).call(this,(()=>t(this,qt,"m",ci).call(this).match(/[$\w]/)));return"."!==(null===(e=t(this,qt,"m",Xt).call(this))||void 0===e?void 0:e.value)&&t(this,Ft,"f").includes(i)?t(this,qt,"m",pi).call(this,i,i):t(this,qt,"m",pi).call(this,"Symbol",i)},ai=function(){const e=t(this,qt,"m",ci).call(this),i=e+t(this,qt,"m",li).call(this);return t(this,Ht,"f").includes(i)?(t(this,qt,"m",hi).call(this),t(this,qt,"m",hi).call(this),t(this,qt,"m",pi).call(this,i,i)):(t(this,qt,"m",hi).call(this),t(this,qt,"m",pi).call(this,e,e))},si=function(e){const i=t(this,Gt,"f").index;for(;t(this,Gt,"f").index<t(this,$t,"f").length&&e();)t(this,qt,"m",hi).call(this);return t(this,$t,"f").substring(i,t(this,Gt,"f").index)},ci=function(){return t(this,$t,"f")[t(this,Gt,"f").index]},di=function(){var e;return null!==(e=t(this,$t,"f")[t(this,Gt,"f").index-1])&&void 0!==e?e:""},li=function(){var e;return null!==(e=t(this,$t,"f")[t(this,Gt,"f").index+1])&&void 0!==e?e:""},ui=function(){t(this,Vt,"f").push(Object.assign({},t(this,Gt,"f")))},mi=function(){const e=t(this,Vt,"f").pop();if(!e)throw new Error("No mark to reset to");t(this,Gt,"f").index=e.index,t(this,Gt,"f").line=e.line,t(this,Gt,"f").column=e.column},hi=function(){t(this,Gt,"f").index++,"\n"===t(this,qt,"m",ci).call(this)?(t(this,Gt,"f").line++,t(this,Gt,"f").column=0):t(this,Gt,"f").column++},pi=function(e,i){const n=t(this,Vt,"f").pop();if(!n)throw new Error("No mark for token");return Object.assign({id:e,value:i},n)};const Bi=["true","false","and","as","contains","div","in","is","mod","or","xor"],qi=["!=","!~","<=",">=","{}","->"];function $i(e){return new Qi(e,Bi,qi).tokenize()}const Fi={parse(e){const t=e.consumeAndParse();if(!e.match(")"))throw new Error("Parse error: expected `)`");return t}},Hi={parse(e,t){const i=e.consumeAndParse();if(!e.match("]"))throw new Error("Parse error: expected `]`");return new ji(t,i)},precedence:2},zi={parse(e,t){if(!(t instanceof gi))throw new Error("Unexpected parentheses");if(!(t.name in Mt))throw new Error("Unrecognized function: "+t.name);const i=[];for(;!e.match(")");)i.push(e.consumeAndParse()),e.match(",");return new Li(t.name,i,Mt[t.name])},precedence:0};function Gi(e){const t=e.split(" "),i=parseFloat(t[0]);let n=t[1];return n=n&&n.startsWith("'")&&n.endsWith("'")?n.substring(1,n.length-1):"{"+n+"}",{value:i,unit:n}}function Vi(){return(new Ni).registerPrefix("String",{parse:(e,t)=>new yi({type:ve.string,value:t.value})}).registerPrefix("DateTime",{parse:(e,t)=>new yi({type:ve.dateTime,value:ut(t.value)})}).registerPrefix("Quantity",{parse:(e,t)=>new yi({type:ve.Quantity,value:Gi(t.value)})}).registerPrefix("Number",{parse:(e,t)=>new yi({type:ve.decimal,value:parseFloat(t.value)})}).registerPrefix("true",{parse:()=>new yi({type:ve.boolean,value:!0})}).registerPrefix("false",{parse:()=>new yi({type:ve.boolean,value:!1})}).registerPrefix("Symbol",{parse:(e,t)=>new gi(t.value)}).registerPrefix("{}",{parse:()=>new xi}).registerPrefix("(",Fi).registerInfix("[",Hi).registerInfix("(",zi).prefix("+",3,((e,t)=>new vi(t,(e=>e)))).prefix("-",3,((e,t)=>new Ei(t,t,((e,t)=>-t)))).infixLeft(".",1,((e,t,i)=>new Ti(e,i))).infixLeft("/",4,((e,t,i)=>new Ei(e,i,((e,t)=>e/t)))).infixLeft("*",4,((e,t,i)=>new Ei(e,i,((e,t)=>e*t)))).infixLeft("+",5,((e,t,i)=>new Ei(e,i,((e,t)=>e+t)))).infixLeft("-",5,((e,t,i)=>new Ei(e,i,((e,t)=>e-t)))).infixLeft("|",7,((e,t,i)=>new Ci(e,i))).infixLeft("=",9,((e,t,i)=>new Pi(e,i))).infixLeft("!=",9,((e,t,i)=>new Ri(e,i))).infixLeft("~",9,((e,t,i)=>new Ai(e,i))).infixLeft("!~",9,((e,t,i)=>new ki(e,i))).infixLeft("<",8,((e,t,i)=>new Ei(e,i,((e,t)=>e<t)))).infixLeft("<=",8,((e,t,i)=>new Ei(e,i,((e,t)=>e<=t)))).infixLeft(">",8,((e,t,i)=>new Ei(e,i,((e,t)=>e>t)))).infixLeft(">=",8,((e,t,i)=>new Ei(e,i,((e,t)=>e>=t)))).infixLeft("&",5,((e,t,i)=>new Si(e,i))).infixLeft("and",6,((e,t,i)=>new Ii(e,i))).infixLeft("as",6,((e,t,i)=>new wi(e,i))).infixLeft("contains",6,((e,t,i)=>new bi(e,i))).infixLeft("div",6,((e,t,i)=>new Ei(e,i,((e,t)=>e/t|0)))).infixLeft("in",6,((e,t,i)=>new Di(e,i))).infixLeft("is",6,((e,t,i)=>new Mi(e,i))).infixLeft("mod",6,((e,t,i)=>new Ei(e,i,((e,t)=>e%t)))).infixLeft("or",6,((e,t,i)=>new Oi(e,i))).infixLeft("xor",6,((e,t,i)=>new Ui(e,i)))}const Xi=Vi();function Yi(e){return new fi(e,Xi.construct($i(e)).consumeAndParse())}function Ji(e,t){const i=Array.isArray(t)?t:[t];for(let e=0;e<i.length;e++){const t=i[e];"object"==typeof t&&"type"in t&&"value"in t||(i[e]=ht(i[e]))}return Zi(e,i).map((e=>e.value))}function Zi(e,t){return Yi(e).eval(t)}const Ki="\r",en="|",tn="^";class nn{constructor(e){this.segments=e}get(e){return"number"==typeof e?this.segments[e]:this.segments.find((t=>t.name===e))}getAll(e){return this.segments.filter((t=>t.name===e))}toString(){return this.segments.map((e=>e.toString())).join("\r")}buildAck(){var e,t,i,n,o,r;const a=new Date,s=this.get("MSH"),c=(null===(e=null==s?void 0:s.get(2))||void 0===e?void 0:e.toString())||"",d=(null===(t=null==s?void 0:s.get(3))||void 0===t?void 0:t.toString())||"",l=(null===(i=null==s?void 0:s.get(4))||void 0===i?void 0:i.toString())||"",u=(null===(n=null==s?void 0:s.get(5))||void 0===n?void 0:n.toString())||"",m=(null===(o=null==s?void 0:s.get(9))||void 0===o?void 0:o.toString())||"",h=(null===(r=null==s?void 0:s.get(12))||void 0===r?void 0:r.toString())||"2.5.1";return new nn([new on(["MSH","^~\\&",l,u,c,d,a.toISOString(),"","ACK",a.getTime().toString(),"P",h]),new on(["MSA","AA",m,"OK"])])}static parse(e){if(!e.startsWith("MSH|^~\\&")){const e=new Error("Invalid HL7 message");throw e.type="entity.parse.failed",e}return new nn(e.split(/[\r\n]+/).map((e=>on.parse(e))))}}class on{constructor(e){q(e)?this.fields=e.map((e=>rn.parse(e))):this.fields=e,this.name=this.fields[0].components[0]}get(e){return this.fields[e]}toString(){return this.fields.map((e=>e.toString())).join("|")}static parse(e){return new on(e.split("|").map((e=>rn.parse(e))))}}class rn{constructor(e){this.components=e}get(e){return this.components[e]}toString(){return this.components.join("^")}static parse(e){return new rn(e.split("^"))}}const an={resourceType:"OperationOutcome",id:"ok",issue:[{severity:"information",code:"informational",details:{text:"All OK"}}]},sn={resourceType:"OperationOutcome",id:"created",issue:[{severity:"information",code:"informational",details:{text:"Created"}}]},cn={resourceType:"OperationOutcome",id:"not-modified",issue:[{severity:"information",code:"informational",details:{text:"Not Modified"}}]},dn={resourceType:"OperationOutcome",id:"not-found",issue:[{severity:"error",code:"not-found",details:{text:"Not found"}}]},ln={resourceType:"OperationOutcome",id:"unauthorized",issue:[{severity:"error",code:"login",details:{text:"Unauthorized"}}]},un={resourceType:"OperationOutcome",id:"forbidden",issue:[{severity:"error",code:"forbidden",details:{text:"Forbidden"}}]},mn={resourceType:"OperationOutcome",id:"gone",issue:[{severity:"error",code:"deleted",details:{text:"Gone"}}]},hn={resourceType:"OperationOutcome",id:"too-many-requests",issue:[{severity:"error",code:"throttled",details:{text:"Too Many Requests"}}]};function pn(e,t){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"invalid",details:{text:e},expression:t?[t]:void 0}]}}function fn(e){return"ok"===e.id||"created"===e.id||"not-modified"===e.id}function yn(e){return"not-found"===e.id}function gn(e){return"gone"===e.id}function xn(e){return"ok"===e.id?200:"created"===e.id?201:"not-modified"===e.id?304:"unauthorized"===e.id?401:"forbidden"===e.id?403:"not-found"===e.id?404:"gone"===e.id?410:"too-many-requests"===e.id?429:400}function vn(e,t){if(!fn(e)||void 0===t)throw new wn(e)}class wn extends Error{constructor(e){var t,i;super(null===(i=null===(t=null==e?void 0:e.issue)||void 0===t?void 0:t[0].details)||void 0===i?void 0:i.text),this.outcome=e}}function En(e){var t,i,n,o;if(!e)return"Unknown error";if("string"==typeof e)return e;if(e instanceof Error)return e.message;if("object"==typeof e&&"resourceType"in e){return null!==(o=null===(n=null===(i=null===(t=e.issue)||void 0===t?void 0:t[0])||void 0===i?void 0:i.details)||void 0===n?void 0:n.text)&&void 0!==o?o:"Unknown error"}return JSON.stringify(e)}const Sn=20;var bn;!function(e){e.EQUALS="eq",e.NOT_EQUALS="ne",e.GREATER_THAN="gt",e.LESS_THAN="lt",e.GREATER_THAN_OR_EQUALS="ge",e.LESS_THAN_OR_EQUALS="le",e.STARTS_AFTER="sa",e.ENDS_BEFORE="eb",e.APPROXIMATELY="ap",e.CONTAINS="contains",e.EXACT="exact",e.TEXT="text",e.NOT="not",e.ABOVE="above",e.BELOW="below",e.IN="in",e.NOT_IN="not-in",e.OF_TYPE="of-type",e.MISSING="missing"}(bn||(bn={}));const Dn=[bn.CONTAINS,bn.EXACT,bn.TEXT,bn.NOT,bn.ABOVE,bn.BELOW,bn.IN,bn.NOT_IN,bn.OF_TYPE,bn.MISSING],Tn=[bn.NOT_EQUALS,bn.GREATER_THAN,bn.LESS_THAN,bn.GREATER_THAN_OR_EQUALS,bn.LESS_THAN_OR_EQUALS,bn.STARTS_AFTER,bn.ENDS_BEFORE,bn.APPROXIMATELY];function Cn(e){const t=new URL(e,"https://example.com/"),i=t.pathname.replace(/(^\/)|(\/$)/g,"").split("/").pop();let n,o,r,a,s,c;return new URLSearchParams(t.search).forEach(((e,t)=>{"_fields"===t?r=e.split(","):"_offset"===t?a=parseInt(e):"_count"===t?s=parseInt(e):"_total"===t?c=e:"_sort"===t?(o=o||[],o.push(function(e){return e.startsWith("-")?{code:e.substring(1),descending:!0}:{code:e}}(e))):(n=n||[],n.push(function(e,t){let i=e,n=bn.EQUALS;for(const e of Dn){const t=i.indexOf(":"+e);-1!==t&&(n=e,i=i.substring(0,t))}for(const e of Tn)t.match(new RegExp("^"+e+"\\d"))&&(n=e,t=t.substring(e.length));return{code:i,operator:n,value:t}}(t,e)))})),{resourceType:i,filters:n,fields:r,offset:a,count:s,total:c,sortRules:o}}function Pn(e){const t=[];return e.fields&&t.push("_fields="+e.fields.join(",")),e.filters&&e.filters.forEach((e=>t.push(function(e){const t=Dn.includes(e.operator)?":"+e.operator:"",i=Tn.includes(e.operator)?e.operator:"";return`${e.code}${t}=${i}${encodeURIComponent(e.value)}`}(e)))),e.sortRules&&e.sortRules.length>0&&t.push(function(e){if(!e||0===e.length)return"";return"_sort="+e.map((e=>e.descending?"-"+e.code:e.code)).join(",")}(e.sortRules)),void 0!==e.offset&&t.push("_offset="+e.offset),void 0!==e.count&&t.push("_count="+e.count),void 0!==e.total&&t.push("_total="+e.total),0===t.length?"":(t.sort(),"?"+t.join("&"))}var Rn;function An(e,t){var i,n;let o=null===(n=null===(i=Re.types[e])||void 0===i?void 0:i.searchParamsDetails)||void 0===n?void 0:n[t.code];return o||(o=function(e,t){var i,n,o,r,a,s,c;if("_lastUpdated"===t.code)return{columnName:"lastUpdated",type:Rn.DATETIME};const d=t.code,l=function(e){return e.split("-").reduce(((e,t,i)=>e+(i?z(t):t)),"")}(d),u=null===(i=Mn(e,t.expression))||void 0===i?void 0:i.split(".");if(!u)return{columnName:l,type:Rn.TEXT};const m=kn(t);let h,p,f=e,y=!1;for(let i=1;i<u.length;i++){const d=u[i];if(h=null!==(r=null===(o=null===(n=Re.types[f])||void 0===n?void 0:n.properties)||void 0===o?void 0:o[d])&&void 0!==r?r:null===(s=null===(a=Re.types[f])||void 0===a?void 0:a.properties)||void 0===s?void 0:s[d+"[x]"],!h)throw new Error(`Element definition not found for ${e} ${t.code}`);if("*"===h.max&&(y=!0),p=null===(c=h.type)||void 0===c?void 0:c[0].code,!p)return{columnName:l,type:m,array:y};i<u.length-1&&("Element"===p||"BackboneElement"===p?f+=z(d):f=p)}const g=kn(t,p),x={columnName:l,type:g,elementDefinition:h,array:y};return function(e,t,i){const n=Re.types[e];n.searchParamsDetails||(n.searchParamsDetails={});n.searchParamsDetails[t]=i}(e,d,x),x}(e,t)),o}function kn(e,t){let i=Rn.TEXT;switch(e.type){case"date":i=t===ve.dateTime||t===ve.instant?Rn.DATETIME:Rn.DATE;break;case"number":i=Rn.NUMBER;break;case"quantity":i=Rn.QUANTITY;break;case"reference":i=Rn.REFERENCE;break;case"token":"boolean"===t&&(i=Rn.BOOLEAN)}return i}function Mn(e,t){const i=t.split(" | ");for(const t of i){if((n=t).includes(" as Period")||n.includes(" as SampledDate"))continue;const i=In(t);if(i.startsWith(e+"."))return i}var n}function In(e){let t=e.trim();t.startsWith("(")&&t.endsWith(")")&&(t=t.substring(1,t.length-1)),t.includes("[0]")&&(t=t.replaceAll("[0]",""));const i=[" != "," as ",".as(",".exists(",".where("];for(const e of i)t.includes(e)&&(t=t.substring(0,t.indexOf(e)));return t}!function(e){e.BOOLEAN="BOOLEAN",e.NUMBER="NUMBER",e.QUANTITY="QUANTITY",e.TEXT="TEXT",e.REFERENCE="REFERENCE",e.DATE="DATE",e.DATETIME="DATETIME",e.PERIOD="PERIOD"}(Rn||(Rn={}));export{Ii as AndAtom,Ei as ArithemticOperatorAtom,wi as AsAtom,tn as COMPONENT_SEPARATOR,Si as ConcatAtom,bi as ContainsAtom,Sn as DEFAULT_SEARCH_COUNT,Ti as DotAtom,xi as EmptySetAtom,Pi as EqualsAtom,Ai as EquivalentAtom,Bi as FHIRPATH_KEYWORDS,qi as FHIRPATH_OPERATORS,en as FIELD_SEPARATOR,fi as FhirPathAtom,Li as FunctionAtom,rn as Hl7Field,nn as Hl7Message,on as Hl7Segment,Di as InAtom,ji as IndexerAtom,Mi as IsAtom,s as LRUCache,yi as LiteralAtom,st as MEDPLUM_VERSION,dt as MedplumClient,Ri as NotEqualsAtom,ki as NotEquivalentAtom,wn as OperationOutcomeError,bn as Operator,Oi as OrAtom,ve as PropertyType,ye as ReadablePromise,Ki as SEGMENT_SEPARATOR,Rn as SearchParameterType,gi as SymbolAtom,vi as UnaryOperatorAtom,Ci as UnionAtom,Ui as XorAtom,an as allOk,H as arrayBufferToBase64,F as arrayBufferToHex,vn as assertOk,pn as badRequest,mt as booleanToTypedValue,Te as buildTypeName,A as calculateAge,k as calculateAgeString,z as capitalize,E as createReference,Ee as createSchema,sn as created,W as deepClone,_ as deepEquals,Ji as evalFhirPath,Zi as evalFhirPathTyped,vt as fhirPathArrayEquals,Et as fhirPathArrayEquivalent,wt as fhirPathEquals,St as fhirPathEquivalent,Dt as fhirPathIs,xt as fhirPathNot,Y as findObservationInterval,J as findObservationReferenceRange,un as forbidden,c as formatAddress,h as formatDate,f as formatDateTime,u as formatFamilyName,l as formatGivenName,d as formatHumanName,y as formatPeriod,Pn as formatSearchQuery,p as formatTime,w as formatTiming,V as getCodeBySystem,R as getDateProperty,T as getDisplayString,Pe as getElementDefinition,Mn as getExpressionForResourceType,U as getExtensionValue,O as getIdentifier,C as getImageSrc,Ce as getPropertyDisplayName,M as getQuestionnaireAnswers,S as getReferenceString,An as getSearchParameterDetails,xn as getStatus,ft as getTypedPropertyValue,Re as globalSchema,mn as gone,De as indexSearchParameter,be as indexStructureDefinition,Se as indexStructureDefinitionBundle,Vi as initFhirPathParserBuilder,N as isEmpty,gn as isGone,G as isLowerCase,yn as isNotFound,B as isObject,fn as isOk,Tt as isPeriod,D as isProfileResource,Ct as isQuantity,Pt as isQuantityEquivalent,q as isStringArray,Q as isUUID,m as isValidDate,K as matchesRange,En as normalizeErrorString,dn as notFound,cn as notModified,Yi as parseFhirPath,fe as parseJWTPayload,Cn as parseSearchDefinition,ee as preciseEquals,ie as preciseGreaterThan,oe as preciseGreaterThanOrEquals,te as preciseLessThan,ne as preciseLessThanOrEquals,gt as removeDuplicates,b as resolveId,X as setCodeBySystem,L as stringify,pt as toJsBoolean,ht as toTypedValue,$i as tokenize,hn as tooManyRequests,ln as unauthorized};
2
2
  //# sourceMappingURL=index.min.js.map