@medplum/core
Version:
Medplum TS/JS Library
1 lines • 234 kB
JavaScript
"use strict";var Kt=Object.defineProperty;var ys=Object.getOwnPropertyDescriptor;var gs=Object.getOwnPropertyNames;var xs=Object.prototype.hasOwnProperty;var vs=(r,e,t)=>e in r?Kt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Ts=(r,e)=>{for(var t in e)Kt(r,t,{get:e[t],enumerable:!0})},Ss=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of gs(e))!xs.call(r,i)&&i!==t&&Kt(r,i,{get:()=>e[i],enumerable:!(n=ys(e,i))||n.enumerable});return r};var bs=r=>Ss(Kt({},"__esModule",{value:!0}),r);var c=(r,e,t)=>vs(r,typeof e!="symbol"?e+"":e,t);var mp={};Ts(mp,{AccessPolicyInteraction:()=>Re,AckCode:()=>jl,AndAtom:()=>wt,ArithemticOperatorAtom:()=>M,AsAtom:()=>he,BooleanInfixOperatorAtom:()=>P,CPT:()=>Ps,ClientStorage:()=>et,ConcatAtom:()=>Tt,ContainsAtom:()=>St,ContentType:()=>w,DEFAULT_ACCEPT:()=>$o,DEFAULT_MAX_SEARCH_COUNT:()=>jc,DEFAULT_SEARCH_COUNT:()=>qc,DataSampler:()=>_r,DotAtom:()=>z,EmptySetAtom:()=>xt,EqualsAtom:()=>Et,EquivalentAtom:()=>Ct,EventTarget:()=>wr,ExternalSecretSystems:()=>Yu,FHIRCAST_EVENT_NAMES:()=>Ar,FHIRCAST_EVENT_RESOURCES:()=>Mo,FHIRCAST_EVENT_VERSION_REQUIRED:()=>Or,FHIRCAST_RESOURCE_TYPES:()=>Do,FhirFilterComparison:()=>Gt,FhirFilterConnective:()=>zt,FhirFilterNegation:()=>Qt,FhirPathAtom:()=>fe,FhircastConnection:()=>Lt,FileBuilder:()=>hi,FunctionAtom:()=>re,HTTP_HL7_ORG:()=>zr,HTTP_TERMINOLOGY_HL7_ORG:()=>Os,Hl7Context:()=>ye,Hl7Field:()=>K,Hl7Message:()=>yi,Hl7Segment:()=>nt,ICD10:()=>ws,ImpliesAtom:()=>It,InAtom:()=>bt,IndexerAtom:()=>Ee,InfixOperatorAtom:()=>se,IsAtom:()=>be,LOINC:()=>Es,LRUCache:()=>Pe,LiteralAtom:()=>U,LogLevel:()=>Be,LogLevelNames:()=>ps,Logger:()=>gi,MEDPLUM_CLI_CLIENT_ID:()=>Uu,MEDPLUM_RELEASES_URL:()=>fs,MEDPLUM_VERSION:()=>Mr,MedplumClient:()=>qt,MedplumKeyValueClient:()=>Ut,MemoryStorage:()=>Vr,MockAsyncClientStorage:()=>ri,NDC:()=>As,NotEqualsAtom:()=>Rt,NotEquivalentAtom:()=>Pt,OAuthClientAssertionType:()=>Go,OAuthGrantType:()=>Ne,OAuthSigningAlgorithm:()=>Qu,OAuthTokenAuthMethod:()=>Gu,OAuthTokenType:()=>Ho,OperationOutcomeError:()=>f,Operator:()=>h,OperatorPrecedence:()=>x,OrAtom:()=>At,Parser:()=>Xt,ParserBuilder:()=>ot,PrefixOperatorAtom:()=>it,PropertyType:()=>d,RXNORM:()=>Cs,ReadablePromise:()=>L,ReconnectingWebSocket:()=>Bt,SNOMED:()=>Rs,SearchParameterType:()=>oe,SubscriptionEmitter:()=>rt,SubscriptionManager:()=>Wt,SymbolAtom:()=>_,Tokenizer:()=>me,TransformMapCollection:()=>Br,TypedEventTarget:()=>J,UCUM:()=>Qr,UnaryOperatorAtom:()=>vt,UnionAtom:()=>Se,VALID_HOSTNAME_REGEX:()=>oo,XorAtom:()=>Ot,accepted:()=>Us,accessPolicySupportsInteraction:()=>Qn,addProfileToResource:()=>ec,allOk:()=>Is,append:()=>G,applyDefaultValuesToElement:()=>ul,applyDefaultValuesToResource:()=>cl,applyFixedOrPatternValue:()=>$t,arrayBufferToBase64:()=>Vn,arrayBufferToHex:()=>kn,arrayify:()=>ke,assert:()=>Uo,assertContextVersionOptional:()=>Xn,assertOk:()=>Ys,assertReleaseManifest:()=>hs,badRequest:()=>b,booleanToTypedValue:()=>m,buildCdsRequest:()=>Pu,buildElementsContext:()=>Fr,buildTypeName:()=>ho,businessRule:()=>js,calculateAge:()=>mt,calculateAgeString:()=>Pa,canReadResourceType:()=>hu,canWriteResource:()=>yu,canWriteResourceType:()=>mu,capitalize:()=>k,checkForNull:()=>xi,checkIfValidMedplumVersion:()=>dp,clearReleaseCache:()=>pp,compressElement:()=>ea,concatUrls:()=>j,conceptMapTranslate:()=>li,conflict:()=>Bs,convertContainedResourcesToBundle:()=>Ru,convertToSearchableDates:()=>Wn,convertToSearchableNumbers:()=>_c,convertToSearchableQuantities:()=>Lc,convertToSearchableReferences:()=>jn,convertToSearchableStrings:()=>qn,convertToSearchableTokens:()=>$n,convertToSearchableUris:()=>Fc,convertToTransactionBundle:()=>Oo,crawlTypedValue:()=>cr,crawlTypedValueAsync:()=>ca,createConstraintIssue:()=>sn,createFhircastMessagePayload:()=>kr,createOperationOutcomeIssue:()=>ge,createProcessingIssue:()=>an,createReference:()=>xe,createStructureIssue:()=>S,created:()=>ks,decodeBase64:()=>Ao,decodeBase64Url:()=>zn,deepClone:()=>Te,deepEquals:()=>ue,deepIncludes:()=>je,deriveIdentifierSearchParameter:()=>Xl,encodeBase64:()=>_t,encodeBase64Url:()=>Tu,encryptSHA256:()=>Jn,ensureNoLeadingSlash:()=>io,ensureTrailingSlash:()=>Tr,escapeHtml:()=>ic,evalFhirPath:()=>Mc,evalFhirPathTyped:()=>C,evalSqlOnFhir:()=>sp,expandSampledData:()=>oi,expandSampledObservation:()=>rl,extractAccountReferences:()=>gr,fetchLatestVersionString:()=>fp,fetchVersionManifest:()=>Gr,fhirPathArrayEquals:()=>En,fhirPathArrayEquivalent:()=>fr,fhirPathArrayNotEquals:()=>Rn,fhirPathEquals:()=>$e,fhirPathEquivalent:()=>Hi,fhirPathIs:()=>dt,fhirPathNot:()=>bn,fhirTypeToJsType:()=>lr,findCodeBySystem:()=>Ua,findObservationInterval:()=>qa,findObservationReferenceRange:()=>ja,findObservationReferenceRanges:()=>eo,findResourceByCode:()=>Xa,findResourceInBundle:()=>Cu,flatMapFilter:()=>nc,forbidden:()=>Ds,formatAddress:()=>ao,formatCodeableConcept:()=>He,formatCoding:()=>Un,formatDate:()=>ac,formatDateTime:()=>Sr,formatFamilyName:()=>sc,formatGivenName:()=>oc,formatHl7DateTime:()=>ls,formatHumanName:()=>ze,formatMoney:()=>mc,formatObservationValue:()=>uo,formatPeriod:()=>cc,formatQuantity:()=>pe,formatRange:()=>hc,formatReferenceString:()=>so,formatSearchQuery:()=>Zc,formatTime:()=>co,formatTiming:()=>dc,generateId:()=>ie,getAllDataTypes:()=>dn,getAllQuestionnaireAnswers:()=>Aa,getBuffer:()=>Cr,getCodeBySystem:()=>yr,getDataType:()=>ae,getDateProperty:()=>Ca,getDefaultValuesForNewSliceEntry:()=>ll,getDisplayString:()=>zi,getElementDefinition:()=>ht,getElementDefinitionFromElements:()=>yo,getElementDefinitionTypeName:()=>nr,getExpressionForResourceType:()=>ip,getExpressionsForResourceType:()=>bi,getExtension:()=>ce,getExtensionValue:()=>Ia,getIdentifier:()=>Xi,getImageSrc:()=>Ra,getInnerDerivedIdentifierExpression:()=>vi,getNestedProperty:()=>Ie,getParsedDerivedIdentifierExpression:()=>Ti,getParsedExpressionForResourceType:()=>Si,getPathDifference:()=>le,getPathDisplayName:()=>bc,getPropertyDisplayName:()=>mo,getQueryString:()=>Fn,getQuestionnaireAnswers:()=>wa,getRandomString:()=>Pr,getReferenceString:()=>V,getResourceTypes:()=>vc,getSearchParameter:()=>Sc,getSearchParameterDetails:()=>Yl,getSearchParameters:()=>Tc,getStatus:()=>Xs,getTypedPropertyValue:()=>I,getTypedPropertyValueWithPath:()=>ur,getTypedPropertyValueWithSchema:()=>ji,getTypedPropertyValueWithoutSchema:()=>$i,getValueSliceName:()=>ai,getWebSocketUrl:()=>Ln,getWindow:()=>vu,globalSchema:()=>N,gone:()=>Ms,indexConceptMapCodings:()=>Ko,indexDefaultSearchParameters:()=>yn,indexSearchParameter:()=>Er,indexSearchParameterBundle:()=>xc,indexStructureDefinitionBundle:()=>or,inflateBaseSchema:()=>cn,inflateElement:()=>Vi,initFhirPathParserBuilder:()=>Ke,invalidSearchOperator:()=>nu,isAccepted:()=>Hs,isBrowserEnvironment:()=>B,isCodeableConcept:()=>mr,isCoding:()=>hr,isCompletedSubscriptionRequest:()=>Yn,isComplexTypeCode:()=>xr,isConflict:()=>zs,isContextVersionRequired:()=>Kn,isCreated:()=>$s,isDataTypeLoaded:()=>fn,isDateString:()=>Cn,isDateTimeString:()=>Ve,isEmpty:()=>E,isError:()=>tr,isFhirCriteriaMet:()=>Bo,isFhircastResourceType:()=>_o,isGone:()=>Js,isJwt:()=>Zn,isLowerCase:()=>Ba,isMedplumAccessToken:()=>ei,isNodeEnvironment:()=>xu,isNotFound:()=>Qs,isObject:()=>R,isOk:()=>rr,isOperationOutcome:()=>st,isPeriod:()=>Pn,isPopulated:()=>Z,isPrimitiveType:()=>ut,isProfileLoaded:()=>hn,isProfileResource:()=>Qi,isQuantity:()=>A,isQuantityEquivalent:()=>wn,isRedirect:()=>Gs,isReference:()=>q,isResource:()=>O,isResourceType:()=>ct,isResourceTypeSchema:()=>ar,isResourceWithId:()=>Ge,isSliceDefinitionWithTypes:()=>si,isString:()=>De,isStringArray:()=>In,isTextObject:()=>Yi,isTypedValue:()=>Cc,isUUID:()=>Na,isUnauthenticated:()=>Ks,isValidDate:()=>br,isValidHostname:()=>Za,isValidMedplumSemver:()=>ms,lazy:()=>_n,loadDataType:()=>sr,locationUtils:()=>ne,mapByIdentifier:()=>tc,matchDiscriminant:()=>pr,matchesRange:()=>Mn,matchesSearchRequest:()=>Mt,multipleMatches:()=>Fs,normalizeArrayBufferView:()=>Dn,normalizeCreateBinaryOptions:()=>ii,normalizeCreatePdfOptions:()=>Qo,normalizeErrorString:()=>Ae,normalizeOperationOutcome:()=>at,notFound:()=>tn,notModified:()=>Vs,operationOutcomeIssueToString:()=>ki,operationOutcomeToString:()=>on,parseFhirPath:()=>Dt,parseFilterParameter:()=>ql,parseHl7DateTime:()=>Hl,parseJWTPayload:()=>Nt,parseLogLevel:()=>Ql,parseMappingLanguage:()=>xl,parseParameter:()=>bo,parseReference:()=>Sa,parseSearchRequest:()=>Xe,parseStructureDefinition:()=>ir,parseXFhirQuery:()=>Yc,pathToJSONPointer:()=>la,preciseEquals:()=>za,preciseGreaterThan:()=>Ka,preciseGreaterThanOrEquals:()=>no,preciseLessThan:()=>Ja,preciseLessThanOrEquals:()=>ro,preciseRound:()=>Qa,preconditionFailed:()=>_s,projectAdminResourceTypes:()=>Ro,protectedResourceTypes:()=>Eo,readInteractions:()=>Co,redirect:()=>qs,removeDuplicates:()=>pt,removeProfileFromResource:()=>rc,reorderBundle:()=>Io,replaceQueryVariables:()=>Vo,resolveId:()=>ve,resourceMatchesSubscriptionCriteria:()=>Fu,satisfiedAccessPolicy:()=>Po,serializeError:()=>Jt,serializeFhircastSubscriptionRequest:()=>Ir,serverError:()=>nn,serverTimeout:()=>Ws,setCodeBySystem:()=>Wa,setIdentifier:()=>Oa,singleton:()=>Q,singularize:()=>Ya,sleep:()=>vr,sortStringArray:()=>gt,splitN:()=>Qe,splitSearchOnComma:()=>Ye,streamToBuffer:()=>op,stringify:()=>yt,stringifyTypedValue:()=>Bn,structureMapTransform:()=>vl,subsetResource:()=>na,summarizeObservations:()=>Zu,toJsBoolean:()=>F,toPeriod:()=>ft,toTypedValue:()=>T,tooManyRequests:()=>Ns,trimTrailingEmptyElements:()=>Da,tryGetDataType:()=>qe,tryGetJwtExpiration:()=>ti,tryGetProfile:()=>mn,typedValueToString:()=>Nn,unauthorized:()=>we,unauthorizedTokenAudience:()=>er,unauthorizedTokenExpired:()=>rn,unsupportedMediaType:()=>Ls,validateFhircastSubscriptionRequest:()=>Ft,validateResource:()=>fa,validateResourceType:()=>zl,validateTypedValue:()=>Ui,validationError:()=>g,validationRegexes:()=>lt,warnIfNewerVersionAvailable:()=>hp,wordWrap:()=>cs});module.exports=bs(mp);var it=class{constructor(e,t){c(this,"operator");c(this,"child");this.operator=e,this.child=t}toString(){return`${this.operator}(${this.child.toString()})`}},se=class{constructor(e,t,n){c(this,"operator");c(this,"left");c(this,"right");this.operator=e,this.left=t,this.right=n}toString(){return`(${this.left.toString()} ${this.operator} ${this.right.toString()})`}},ot=class{constructor(){c(this,"prefixParselets",{});c(this,"infixParselets",{})}registerInfix(e,t){return this.infixParselets[e]=t,this}registerPrefix(e,t){return this.prefixParselets[e]=t,this}prefix(e,t,n){return this.registerPrefix(e,{parse(i,o){let s=i.consumeAndParse(t);return n(o,s)}})}infixLeft(e,t,n){return this.registerInfix(e,{parse(i,o,s){let a=i.consumeAndParse(t);return n(o,s,a)},precedence:t})}construct(e){return new Xt(e,this.prefixParselets,this.infixParselets)}},Xt=class{constructor(e,t,n){c(this,"tokens");c(this,"prefixParselets");c(this,"infixParselets");this.tokens=e,this.prefixParselets=t,this.infixParselets=n}hasMore(){return this.tokens.length>0}match(e){return this.peek()?.id!==e?!1:(this.consume(),!0)}consumeAndParse(e=1/0){let t=this.consume(),n=this.prefixParselets[t.id];if(!n)throw new Error(`Parse error at "${t.value}" (line ${t.line}, column ${t.column}). No matching prefix parselet.`);let i=n.parse(this,t);for(;e>this.getPrecedence();){let o=this.consume();i=this.getInfixParselet(o).parse(this,i,o)}return i}getPrecedence(){let e=this.peek();if(!e)return 1/0;let t=this.getInfixParselet(e);return t?t.precedence:1/0}consume(e,t){if(!this.tokens.length)throw new Error("Cant consume unknown more tokens.");if(e&&this.peek()?.id!==e){let n=this.peek();throw new Error(`Expected ${e} but got "${n.id}" (${n.value}) at line ${n.line} column ${n.column}.`)}if(t&&this.peek()?.value!==t){let n=this.peek();throw new Error(`Expected "${t}" but got "${n.value}" at line ${n.line} column ${n.column}.`)}return this.tokens.shift()}peek(){return this.tokens.length>0?this.tokens[0]:void 0}removeComments(){this.tokens=this.tokens.filter(e=>e.id!=="Comment")}getInfixParselet(e){return this.infixParselets[e.id==="Symbol"?e.value:e.id]}};var Pe=class{constructor(e=10){c(this,"max");c(this,"cache");this.max=e,this.cache=new Map}clear(){this.cache.clear()}get(e){let t=this.cache.get(e);return t&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){this.cache.has(e)?this.cache.delete(e):this.cache.size>=this.max&&this.cache.delete(this.first()),this.cache.set(e,t)}delete(e){this.cache.delete(e)}keys(){return this.cache.keys()}first(){return this.cache.keys().next().value}};var Qr="http://unitsofmeasure.org",Es="http://loinc.org",Rs="http://snomed.info/sct",Cs="http://www.nlm.nih.gov/research/umls/rxnorm",Ps="http://www.ama-assn.org/go/cpt",ws="http://hl7.org/fhir/sid/icd-10",As="http://hl7.org/fhir/sid/ndc",zr="http://hl7.org",Os="http://terminology.hl7.org";var Yt="created",Jr="gone",Kr="not-modified",Xr="found",Yr="not-found",Zr="conflict",en="unauthorized",Ri="forbidden",Ci="precondition-failed",Pi="unsupported-media-type",wi="multiple-matches",Ai="too-many-requests",Zt="accepted",Oi="server-timeout",Ii="business-rule",Is={resourceType:"OperationOutcome",id:"ok",issue:[{severity:"information",code:"informational",details:{text:"All OK"}}]},ks={resourceType:"OperationOutcome",id:Yt,issue:[{severity:"information",code:"informational",details:{text:"Created"}}]},Vs={resourceType:"OperationOutcome",id:Kr,issue:[{severity:"information",code:"informational",details:{text:"Not Modified"}}]},tn={resourceType:"OperationOutcome",id:Yr,issue:[{severity:"error",code:"not-found",details:{text:"Not found"}}]},we={resourceType:"OperationOutcome",id:en,issue:[{severity:"error",code:"login",details:{text:"Unauthorized"}}]},rn={...we,issue:[...we.issue,{severity:"error",code:"expired",details:{text:"Token expired"}}]},er={...we,issue:[...we.issue,{severity:"error",code:"invalid",details:{text:"Token not issued for this audience"}}]},Ds={resourceType:"OperationOutcome",id:Ri,issue:[{severity:"error",code:"forbidden",details:{text:"Forbidden"}}]},Ms={resourceType:"OperationOutcome",id:Jr,issue:[{severity:"error",code:"deleted",details:{text:"Gone"}}]},_s={resourceType:"OperationOutcome",id:Ci,issue:[{severity:"error",code:"processing",details:{text:"Precondition Failed"}}]},Ls={resourceType:"OperationOutcome",id:Pi,issue:[{severity:"error",code:"not-supported",details:{text:"Unsupported media type"}}]},Fs={resourceType:"OperationOutcome",id:wi,issue:[{severity:"error",code:"multiple-matches",details:{text:"Multiple resources found matching condition"}}]},Ns={resourceType:"OperationOutcome",id:Ai,issue:[{severity:"error",code:"throttled",details:{text:"Too Many Requests"}}]};function Us(r){return{resourceType:"OperationOutcome",id:Zt,issue:[{severity:"information",code:"informational",details:{text:"Accepted"},diagnostics:r}]}}function b(r,e){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"invalid",details:{text:r},...e?{expression:[e]}:void 0}]}}function Bs(r,e){return{resourceType:"OperationOutcome",id:Zr,issue:[{severity:"error",code:"conflict",details:{coding:e?[{code:e}]:void 0,text:r}}]}}function g(r){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"structure",details:{text:r}}]}}function nn(r){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"exception",details:{text:"Internal server error"},diagnostics:r.toString()}]}}function Ws(r){return{resourceType:"OperationOutcome",id:Oi,issue:[{severity:"error",code:"timeout",details:{text:r??"Server timeout"}}]}}function qs(r){let e=r.toString();return{resourceType:"OperationOutcome",id:Xr,issue:[{severity:"information",code:"informational",details:{coding:[{system:"urn:ietf:rfc:3986",code:e}],text:"Redirect to "+e}}]}}function js(r,e){return{resourceType:"OperationOutcome",id:Ii,issue:[{severity:"error",code:"business-rule",details:{id:r,text:e}}]}}function tr(r){return!r||typeof r!="object"?!1:r instanceof Error||typeof DOMException<"u"&&r instanceof DOMException?!0:Object.prototype.toString.call(r)==="[object Error]"}function st(r){return typeof r=="object"&&r!==null&&r.resourceType==="OperationOutcome"}function rr(r){return r.id==="ok"||r.id===Yt||r.id===Kr||r.id===Zt}function $s(r){return r.id===Yt}function Hs(r){return r.id===Zt}function Gs(r){return r.id===Xr}function Qs(r){return r.id===Yr}function zs(r){return r.id===Zr}function Js(r){return r.id===Jr}function Ks(r){return r.id===en}function Xs(r){switch(r.id){case"ok":return 200;case Yt:return 201;case Zt:return 202;case Xr:return 302;case Kr:return 304;case en:return 401;case Ri:return 403;case Yr:return 404;case Zr:return 409;case Jr:return 410;case Ci:case wi:return 412;case Pi:return 415;case Ii:return 422;case Ai:return 429;case Oi:return 504;default:return r.issue?.[0]?.code==="exception"?500:400}}function Ys(r,e){if(!rr(r)||e===void 0)throw new f(r)}var f=class extends Error{constructor(t,n){super(on(t),n);c(this,"outcome");this.name="OperationOutcomeError",this.outcome=t}};function at(r){return r instanceof f?r.outcome:st(r)?r:b(Ae(r))}function Ae(r){return r?typeof r=="string"?r:tr(r)?r.message:st(r)?on(r):typeof r=="object"&&"code"in r&&typeof r.code=="string"?r.code:JSON.stringify(r):"Unknown error"}function on(r){let e=r.issue?.map(ki)??[];return e.length>0?e.join("; "):"Unknown error"}function ki(r){let e;return r.details?.text?r.diagnostics?e=`${r.details.text} (${r.diagnostics})`:e=r.details.text:r.diagnostics?e=r.diagnostics:e="Unknown error",r.expression?.length&&(e+=` (${r.expression.join(", ")})`),e}function ge(r,e,t,n,i){let o={severity:r,code:e,details:{text:t},expression:[n]};return i&&(o.diagnostics=JSON.stringify(i)),o}function S(r,e){return ge("error","structure",e,r)}function sn(r,e){return ge("error","invariant",`Constraint ${e.key} not met: ${e.description}`,r,{fhirpath:e.expression})}function an(r,e,t,n){return ge("error","processing",e,r,{...n,error:t})}var Zs={"http://hl7.org/fhirpath/System.String":"string"};function ea(r){let e={};return r.min!==0&&(e.min=r.min),r.max!==1&&Number.isFinite(r.max)?e.max=r.max:r.max===Number.POSITIVE_INFINITY&&(e.max=Number.MAX_SAFE_INTEGER),e.type=r.type?.map(t=>({...t,extension:void 0,code:Zs[t.code]??t.code})),e}function Vi(r,e){let t=e.max&&e.max===Number.MAX_SAFE_INTEGER?Number.POSITIVE_INFINITY:e.max;return{path:r,description:"",type:e.type??[],min:e.min??0,max:t??1,isArray:!!t&&t>1,constraints:[]}}function cn(r){let e=Object.create(null);for(let[t,n]of Object.entries(r))e[t]={name:t,type:t,path:t,elements:Object.fromEntries(Object.entries(n.elements).map(([i,o])=>[i,Vi(i,o)])),constraints:[],innerTypes:[]};return e}var Di={Element:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]}}},BackboneElement:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]}}},Address:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},use:{type:[{code:"code"}]},type:{type:[{code:"code"}]},text:{type:[{code:"string"}]},line:{max:9007199254740991,type:[{code:"string"}]},city:{type:[{code:"string"}]},district:{type:[{code:"string"}]},state:{type:[{code:"string"}]},postalCode:{type:[{code:"string"}]},country:{type:[{code:"string"}]},period:{type:[{code:"Period"}]}}},Age:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},Annotation:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},"author[x]":{type:[{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Practitioner","http://hl7.org/fhir/StructureDefinition/Patient","http://hl7.org/fhir/StructureDefinition/RelatedPerson","http://hl7.org/fhir/StructureDefinition/Organization"]},{code:"string"}]},time:{type:[{code:"dateTime"}]},text:{min:1,type:[{code:"markdown"}]}}},Attachment:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},contentType:{type:[{code:"code"}]},language:{type:[{code:"code"}]},data:{type:[{code:"base64Binary"}]},url:{type:[{code:"url"}]},size:{type:[{code:"unsignedInt"}]},hash:{type:[{code:"base64Binary"}]},title:{type:[{code:"string"}]},creation:{type:[{code:"dateTime"}]}}},CodeableConcept:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},coding:{max:9007199254740991,type:[{code:"Coding"}]},text:{type:[{code:"string"}]}}},Coding:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},system:{type:[{code:"uri"}]},version:{type:[{code:"string"}]},code:{type:[{code:"code"}]},display:{type:[{code:"string"}]},userSelected:{type:[{code:"boolean"}]}}},ContactDetail:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},name:{type:[{code:"string"}]},telecom:{max:9007199254740991,type:[{code:"ContactPoint"}]}}},ContactPoint:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},system:{type:[{code:"code"}]},value:{type:[{code:"string"}]},use:{type:[{code:"code"}]},rank:{type:[{code:"positiveInt"}]},period:{type:[{code:"Period"}]}}},Contributor:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},type:{min:1,type:[{code:"code"}]},name:{min:1,type:[{code:"string"}]},contact:{max:9007199254740991,type:[{code:"ContactDetail"}]}}},Count:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},DataRequirement:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},type:{min:1,type:[{code:"code"}]},profile:{max:9007199254740991,type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]},"subject[x]":{type:[{code:"CodeableConcept"},{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Group"]}]},mustSupport:{max:9007199254740991,type:[{code:"string"}]},codeFilter:{max:9007199254740991,type:[{code:"DataRequirementCodeFilter"}]},dateFilter:{max:9007199254740991,type:[{code:"DataRequirementDateFilter"}]},limit:{type:[{code:"positiveInt"}]},sort:{max:9007199254740991,type:[{code:"DataRequirementSort"}]}}},DataRequirementCodeFilter:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},path:{type:[{code:"string"}]},searchParam:{type:[{code:"string"}]},valueSet:{type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/ValueSet"]}]},code:{max:9007199254740991,type:[{code:"Coding"}]}}},DataRequirementDateFilter:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},path:{type:[{code:"string"}]},searchParam:{type:[{code:"string"}]},"value[x]":{type:[{code:"dateTime"},{code:"Period"},{code:"Duration"}]}}},DataRequirementSort:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},path:{min:1,type:[{code:"string"}]},direction:{min:1,type:[{code:"code"}]}}},Distance:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},Dosage:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},sequence:{type:[{code:"integer"}]},text:{type:[{code:"string"}]},additionalInstruction:{max:9007199254740991,type:[{code:"CodeableConcept"}]},patientInstruction:{type:[{code:"string"}]},timing:{type:[{code:"Timing"}]},"asNeeded[x]":{type:[{code:"boolean"},{code:"CodeableConcept"}]},site:{type:[{code:"CodeableConcept"}]},route:{type:[{code:"CodeableConcept"}]},method:{type:[{code:"CodeableConcept"}]},doseAndRate:{max:9007199254740991,type:[{code:"DosageDoseAndRate"}]},maxDosePerPeriod:{type:[{code:"Ratio"}]},maxDosePerAdministration:{type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},maxDosePerLifetime:{type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]}}},DosageDoseAndRate:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},type:{type:[{code:"CodeableConcept"}]},"dose[x]":{type:[{code:"Range"},{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},"rate[x]":{type:[{code:"Ratio"},{code:"Range"},{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]}}},Duration:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},ElementDefinition:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},path:{min:1,type:[{code:"string"}]},representation:{max:9007199254740991,type:[{code:"code"}]},sliceName:{type:[{code:"string"}]},sliceIsConstraining:{type:[{code:"boolean"}]},label:{type:[{code:"string"}]},code:{max:9007199254740991,type:[{code:"Coding"}]},slicing:{type:[{code:"ElementDefinitionSlicing"}]},short:{type:[{code:"string"}]},definition:{type:[{code:"markdown"}]},comment:{type:[{code:"markdown"}]},requirements:{type:[{code:"markdown"}]},alias:{max:9007199254740991,type:[{code:"string"}]},min:{type:[{code:"unsignedInt"}]},max:{type:[{code:"string"}]},base:{type:[{code:"ElementDefinitionBase"}]},contentReference:{type:[{code:"uri"}]},type:{max:9007199254740991,type:[{code:"ElementDefinitionType"}]},"defaultValue[x]":{type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]},meaningWhenMissing:{type:[{code:"markdown"}]},orderMeaning:{type:[{code:"string"}]},"fixed[x]":{type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]},"pattern[x]":{type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]},example:{max:9007199254740991,type:[{code:"ElementDefinitionExample"}]},"minValue[x]":{type:[{code:"date"},{code:"dateTime"},{code:"instant"},{code:"time"},{code:"decimal"},{code:"integer"},{code:"positiveInt"},{code:"unsignedInt"},{code:"Quantity"}]},"maxValue[x]":{type:[{code:"date"},{code:"dateTime"},{code:"instant"},{code:"time"},{code:"decimal"},{code:"integer"},{code:"positiveInt"},{code:"unsignedInt"},{code:"Quantity"}]},maxLength:{type:[{code:"integer"}]},condition:{max:9007199254740991,type:[{code:"id"}]},constraint:{max:9007199254740991,type:[{code:"ElementDefinitionConstraint"}]},mustSupport:{type:[{code:"boolean"}]},isModifier:{type:[{code:"boolean"}]},isModifierReason:{type:[{code:"string"}]},isSummary:{type:[{code:"boolean"}]},binding:{type:[{code:"ElementDefinitionBinding"}]},mapping:{max:9007199254740991,type:[{code:"ElementDefinitionMapping"}]}}},ElementDefinitionSlicingDiscriminator:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},type:{min:1,type:[{code:"code"}]},path:{min:1,type:[{code:"string"}]}}},ElementDefinitionSlicing:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},discriminator:{max:9007199254740991,type:[{code:"ElementDefinitionSlicingDiscriminator"}]},description:{type:[{code:"string"}]},ordered:{type:[{code:"boolean"}]},rules:{min:1,type:[{code:"code"}]}}},ElementDefinitionBase:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},path:{min:1,type:[{code:"string"}]},min:{min:1,type:[{code:"unsignedInt"}]},max:{min:1,type:[{code:"string"}]}}},ElementDefinitionType:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},code:{min:1,type:[{code:"uri"}]},profile:{max:9007199254740991,type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition","http://hl7.org/fhir/StructureDefinition/ImplementationGuide"]}]},targetProfile:{max:9007199254740991,type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition","http://hl7.org/fhir/StructureDefinition/ImplementationGuide"]}]},aggregation:{max:9007199254740991,type:[{code:"code"}]},versioning:{type:[{code:"code"}]}}},ElementDefinitionExample:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},label:{min:1,type:[{code:"string"}]},"value[x]":{min:1,type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]}}},ElementDefinitionConstraint:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},key:{min:1,type:[{code:"id"}]},requirements:{type:[{code:"string"}]},severity:{min:1,type:[{code:"code"}]},human:{min:1,type:[{code:"string"}]},expression:{type:[{code:"string"}]},xpath:{type:[{code:"string"}]},source:{type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]}}},ElementDefinitionBinding:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},strength:{min:1,type:[{code:"code"}]},description:{type:[{code:"string"}]},valueSet:{type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/ValueSet"]}]}}},ElementDefinitionMapping:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},identity:{min:1,type:[{code:"id"}]},language:{type:[{code:"code"}]},map:{min:1,type:[{code:"string"}]},comment:{type:[{code:"string"}]}}},Expression:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},description:{type:[{code:"string"}]},name:{type:[{code:"id"}]},language:{min:1,type:[{code:"code"}]},expression:{type:[{code:"string"}]},reference:{type:[{code:"uri"}]}}},Extension:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},url:{min:1,type:[{code:"uri"}]},"value[x]":{type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]}}},HumanName:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},use:{type:[{code:"code"}]},text:{type:[{code:"string"}]},family:{type:[{code:"string"}]},given:{max:9007199254740991,type:[{code:"string"}]},prefix:{max:9007199254740991,type:[{code:"string"}]},suffix:{max:9007199254740991,type:[{code:"string"}]},period:{type:[{code:"Period"}]}}},Identifier:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},use:{type:[{code:"code"}]},type:{type:[{code:"CodeableConcept"}]},system:{type:[{code:"uri"}]},value:{type:[{code:"string"}]},period:{type:[{code:"Period"}]},assigner:{type:[{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Organization"]}]}}},MarketingStatus:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},country:{min:1,type:[{code:"CodeableConcept"}]},jurisdiction:{type:[{code:"CodeableConcept"}]},status:{min:1,type:[{code:"CodeableConcept"}]},dateRange:{min:1,type:[{code:"Period"}]},restoreDate:{type:[{code:"dateTime"}]}}},Meta:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},versionId:{type:[{code:"id"}]},lastUpdated:{type:[{code:"instant"}]},source:{type:[{code:"uri"}]},profile:{max:9007199254740991,type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]},security:{max:9007199254740991,type:[{code:"Coding"}]},tag:{max:9007199254740991,type:[{code:"Coding"}]},project:{type:[{code:"uri"}]},author:{type:[{code:"Reference"}]},onBehalfOf:{type:[{code:"Reference"}]},account:{type:[{code:"Reference"}]},accounts:{max:9007199254740991,type:[{code:"Reference"}]},compartment:{max:9007199254740991,type:[{code:"Reference"}]}}},Money:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},currency:{type:[{code:"code"}]}}},Narrative:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},status:{min:1,type:[{code:"code"}]},div:{min:1,type:[{code:"xhtml"}]}}},ParameterDefinition:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},name:{type:[{code:"code"}]},use:{min:1,type:[{code:"code"}]},min:{type:[{code:"integer"}]},max:{type:[{code:"string"}]},documentation:{type:[{code:"string"}]},type:{min:1,type:[{code:"code"}]},profile:{type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]}}},Period:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},start:{type:[{code:"dateTime"}]},end:{type:[{code:"dateTime"}]}}},Population:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},"age[x]":{type:[{code:"Range"},{code:"CodeableConcept"}]},gender:{type:[{code:"CodeableConcept"}]},race:{type:[{code:"CodeableConcept"}]},physiologicalCondition:{type:[{code:"CodeableConcept"}]}}},ProdCharacteristic:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},height:{type:[{code:"Quantity"}]},width:{type:[{code:"Quantity"}]},depth:{type:[{code:"Quantity"}]},weight:{type:[{code:"Quantity"}]},nominalVolume:{type:[{code:"Quantity"}]},externalDiameter:{type:[{code:"Quantity"}]},shape:{type:[{code:"string"}]},color:{max:9007199254740991,type:[{code:"string"}]},imprint:{max:9007199254740991,type:[{code:"string"}]},image:{max:9007199254740991,type:[{code:"Attachment"}]},scoring:{type:[{code:"CodeableConcept"}]}}},ProductShelfLife:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},identifier:{type:[{code:"Identifier"}]},type:{min:1,type:[{code:"CodeableConcept"}]},period:{min:1,type:[{code:"Quantity"}]},specialPrecautionsForStorage:{max:9007199254740991,type:[{code:"CodeableConcept"}]}}},Quantity:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},Range:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},low:{type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},high:{type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]}}},Ratio:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},numerator:{type:[{code:"Quantity"}]},denominator:{type:[{code:"Quantity"}]}}},Reference:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},reference:{type:[{code:"string"}]},type:{type:[{code:"uri"}]},identifier:{type:[{code:"Identifier"}]},display:{type:[{code:"string"}]}}},RelatedArtifact:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},type:{min:1,type:[{code:"code"}]},label:{type:[{code:"string"}]},display:{type:[{code:"string"}]},citation:{type:[{code:"markdown"}]},url:{type:[{code:"url"}]},document:{type:[{code:"Attachment"}]},resource:{type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/Resource"]}]}}},SampledData:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},origin:{min:1,type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},period:{min:1,type:[{code:"decimal"}]},factor:{type:[{code:"decimal"}]},lowerLimit:{type:[{code:"decimal"}]},upperLimit:{type:[{code:"decimal"}]},dimensions:{min:1,type:[{code:"positiveInt"}]},data:{type:[{code:"string"}]}}},Signature:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},type:{min:1,max:9007199254740991,type:[{code:"Coding"}]},when:{min:1,type:[{code:"instant"}]},who:{min:1,type:[{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Practitioner","http://hl7.org/fhir/StructureDefinition/PractitionerRole","http://hl7.org/fhir/StructureDefinition/RelatedPerson","http://hl7.org/fhir/StructureDefinition/Patient","http://hl7.org/fhir/StructureDefinition/Device","http://hl7.org/fhir/StructureDefinition/Organization"]}]},onBehalfOf:{type:[{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Practitioner","http://hl7.org/fhir/StructureDefinition/PractitionerRole","http://hl7.org/fhir/StructureDefinition/RelatedPerson","http://hl7.org/fhir/StructureDefinition/Patient","http://hl7.org/fhir/StructureDefinition/Device","http://hl7.org/fhir/StructureDefinition/Organization"]}]},targetFormat:{type:[{code:"code"}]},sigFormat:{type:[{code:"code"}]},data:{type:[{code:"base64Binary"}]}}},SubstanceAmount:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},"amount[x]":{type:[{code:"Quantity"},{code:"Range"},{code:"string"}]},amountType:{type:[{code:"CodeableConcept"}]},amountText:{type:[{code:"string"}]},referenceRange:{type:[{code:"SubstanceAmountReferenceRange"}]}}},SubstanceAmountReferenceRange:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},lowLimit:{type:[{code:"Quantity"}]},highLimit:{type:[{code:"Quantity"}]}}},Timing:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},event:{max:9007199254740991,type:[{code:"dateTime"}]},repeat:{type:[{code:"TimingRepeat"}]},code:{type:[{code:"CodeableConcept"}]}}},TimingRepeat:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},"bounds[x]":{type:[{code:"Duration"},{code:"Range"},{code:"Period"}]},count:{type:[{code:"positiveInt"}]},countMax:{type:[{code:"positiveInt"}]},duration:{type:[{code:"decimal"}]},durationMax:{type:[{code:"decimal"}]},durationUnit:{type:[{code:"code"}]},frequency:{type:[{code:"positiveInt"}]},frequencyMax:{type:[{code:"positiveInt"}]},period:{type:[{code:"decimal"}]},periodMax:{type:[{code:"decimal"}]},periodUnit:{type:[{code:"code"}]},dayOfWeek:{max:9007199254740991,type:[{code:"code"}]},timeOfDay:{max:9007199254740991,type:[{code:"time"}]},when:{max:9007199254740991,type:[{code:"code"}]},offset:{type:[{code:"unsignedInt"}]}}},TriggerDefinition:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},type:{min:1,type:[{code:"code"}]},name:{type:[{code:"string"}]},"timing[x]":{type:[{code:"Timing"},{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Schedule"]},{code:"date"},{code:"dateTime"}]},data:{max:9007199254740991,type:[{code:"DataRequirement"}]},condition:{type:[{code:"Expression"}]}}},UsageContext:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},code:{min:1,type:[{code:"Coding"}]},"value[x]":{min:1,type:[{code:"CodeableConcept"},{code:"Quantity"},{code:"Range"},{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/PlanDefinition","http://hl7.org/fhir/StructureDefinition/ResearchStudy","http://hl7.org/fhir/StructureDefinition/InsurancePlan","http://hl7.org/fhir/StructureDefinition/HealthcareService","http://hl7.org/fhir/StructureDefinition/Group","http://hl7.org/fhir/StructureDefinition/Location","http://hl7.org/fhir/StructureDefinition/Organization"]}]}}},MoneyQuantity:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},SimpleQuantity:{elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{max:0,type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},IdentityProvider:{elements:{authorizeUrl:{min:1,type:[{code:"string"}]},tokenUrl:{min:1,type:[{code:"string"}]},tokenAuthMethod:{type:[{code:"code"}]},userInfoUrl:{min:1,type:[{code:"string"}]},clientId:{min:1,type:[{code:"string"}]},clientSecret:{min:1,type:[{code:"string"}]},usePkce:{type:[{code:"boolean"}]},useSubject:{type:[{code:"boolean"}]}}}};function ir(r){return new ln(r).parse()}var Oe=cn(Di),pn=Object.create(null),Mi=Object.create(null),ra={"http://hl7.org/fhir/StructureDefinition/MoneyQuantity":"MoneyQuantity","http://hl7.org/fhir/StructureDefinition/SimpleQuantity":"SimpleQuantity","http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ViewDefinition":"ViewDefinition"};function Ni(r){let e;return e=Mi[r],e||(e=Mi[r]=Object.create(null)),e}function or(r){let t=(Array.isArray(r)?r:r.entry?.map(n=>n.resource)??[]).filter(n=>n?.resourceType==="StructureDefinition");yn(t);for(let n of t)sr(n)}function sr(r){if(!r?.name)throw new Error("Failed loading StructureDefinition from bundle");if(r.resourceType!=="StructureDefinition")return;let e=ir(r),t=ra[r.url],n,i;t?(n=Oe,i=t):r.url===`http://hl7.org/fhir/StructureDefinition/${r.type}`||r.url===`https://medplum.com/fhir/StructureDefinition/${r.type}`||r.type?.startsWith("http://")||r.type?.startsWith("https://")?(n=Oe,i=r.type):(n=Ni(r.url),i=r.type),n[i]=e;for(let o of e.innerTypes)o.parentType=e,n[o.name]=o;pn[r.url]=e}function dn(){return Oe}function fn(r){return!!Oe[r]}function qe(r,e){if(e){let t=Ni(e)[r];if(t)return t}return Oe[r]}function ae(r,e){let t=qe(r,e);if(!t)throw new f(b("Unknown data type: "+r));return t}function ct(r){let e=Oe[r];return e&&ar(e)}function hn(r){return!!pn[r]}function mn(r){return pn[r]}var ln=class{constructor(e){c(this,"root");c(this,"elements");c(this,"elementIndex");c(this,"index");c(this,"resourceSchema");c(this,"slicingContext");c(this,"innerTypes");c(this,"backboneContext");if(!e.snapshot?.element||e.snapshot.element.length===0)throw new Error(`No snapshot defined for StructureDefinition '${e.name}'`);this.root=e.snapshot.element[0],this.elements=e.snapshot.element.slice(1),this.elementIndex=Object.create(null),this.index=0,this.resourceSchema={name:e.name,path:this.root.path,title:e.title,type:e.type,url:e.url,version:e.version,kind:e.kind,description:aa(e),elements:{},constraints:this.parseElementDefinition(this.root).constraints,innerTypes:[],summaryProperties:new Set,mandatoryProperties:new Set},this.innerTypes=[]}parse(){let e=this.next();for(;e;){if(e.sliceName)this.parseSliceStart(e);else if(e.id?.includes(":")){if(this.slicingContext?.current){let t=un(e,this.slicingContext.path);this.slicingContext.current.elements[t]=this.parseElementDefinition(e)}}else{let t=this.parseElementDefinition(e);this.checkFieldEnter(e,t);let n=this.backboneContext;for(;n;){if(e.path?.startsWith(n.path+".")){n.type.elements[un(e,n.path)]=t;break}n=n.parent}if(!n){let i=un(e,this.root.path);e.isSummary&&this.resourceSchema.summaryProperties?.add(i.replace("[x]","")),t.min>0&&this.resourceSchema.mandatoryProperties?.add(i.replace("[x]","")),this.resourceSchema.elements[i]=t}this.checkFieldExit(e)}e=this.next()}return this.checkFieldExit(),this.innerTypes.length>0&&(this.resourceSchema.innerTypes=this.innerTypes),this.resourceSchema}checkFieldEnter(e,t){this.isInnerType(e)&&this.enterInnerType(e),this.slicingContext&&!We(this.slicingContext.path,e?.path)&&(this.slicingContext=void 0),e.slicing&&!this.slicingContext&&this.enterSlice(e,t)}enterInnerType(e){for(;this.backboneContext&&!We(this.backboneContext?.path,e.path);)this.innerTypes.push(this.backboneContext.type),this.backboneContext=this.backboneContext.parent;let t=nr(e);this.backboneContext={type:{name:t,type:t,path:e.path,title:e.label,description:e.definition,elements:{},constraints:this.parseElementDefinition(e).constraints,innerTypes:[]},path:e.path,parent:We(this.backboneContext?.path,e.path)?this.backboneContext:this.backboneContext?.parent}}enterSlice(e,t){sa(e)&&!this.peek()?.sliceName||(t.slicing={discriminator:(e.slicing?.discriminator??[]).map(n=>{if(n.type!=="value"&&n.type!=="pattern"&&n.type!=="type")throw new Error(`Unsupported slicing discriminator type: ${n.type}`);return{path:n.path,type:n.type}}),slices:[],ordered:e.slicing?.ordered??!1,rule:e.slicing?.rules},this.slicingContext={field:t.slicing,path:e.path??""})}checkFieldExit(e=void 0){if(this.backboneContext&&!We(this.backboneContext.path,e?.path))if(this.backboneContext.parent)do this.innerTypes.push(this.backboneContext.type),this.backboneContext=this.backboneContext.parent;while(this.backboneContext&&!We(this.backboneContext.path,e?.path));else this.innerTypes.push(this.backboneContext.type),this.backboneContext=void 0}next(){let e=this.peek();if(e)return this.index++,e}peek(){let e=this.elements[this.index];if