@medplum/react 3.2.11 → 3.2.13

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,4 +1,4 @@
1
- "use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __commonJS=(cb,mod)=>function(){return mod||(0,cb[__getOwnPropNames(cb)[0]])((mod={exports:{}}).exports,mod),mod.exports};var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var require_pointer=__commonJS({"../../node_modules/rfc6902/pointer.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.Pointer=void 0;function unescape(token){return token.replace(/~1/g,"/").replace(/~0/g,"~")}function escape(token){return token.replace(/~/g,"~0").replace(/\//g,"~1")}var Pointer=function(){function Pointer2(tokens){tokens===void 0&&(tokens=[""]),this.tokens=tokens}return Pointer2.fromJSON=function(path){var tokens=path.split("/").map(unescape);if(tokens[0]!=="")throw new Error("Invalid JSON Pointer: ".concat(path));return new Pointer2(tokens)},Pointer2.prototype.toString=function(){return this.tokens.map(escape).join("/")},Pointer2.prototype.evaluate=function(object){for(var parent=null,key="",value=object,i=1,l=this.tokens.length;i<l;i++)parent=value,key=this.tokens[i],!(key=="__proto__"||key=="constructor"||key=="prototype")&&(value=(parent||{})[key]);return{parent,key,value}},Pointer2.prototype.get=function(object){return this.evaluate(object).value},Pointer2.prototype.set=function(object,value){var endpoint=this.evaluate(object);endpoint.parent&&(endpoint.parent[endpoint.key]=value)},Pointer2.prototype.push=function(token){this.tokens.push(token)},Pointer2.prototype.add=function(token){var tokens=this.tokens.concat(String(token));return new Pointer2(tokens)},Pointer2}();exports.Pointer=Pointer}});var require_util=__commonJS({"../../node_modules/rfc6902/util.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.clone=exports.objectType=exports.hasOwnProperty=void 0;exports.hasOwnProperty=Object.prototype.hasOwnProperty;function objectType(object){return object===void 0?"undefined":object===null?"null":Array.isArray(object)?"array":typeof object}exports.objectType=objectType;function isNonPrimitive(value){return value!=null&&typeof value=="object"}function clone(source){if(!isNonPrimitive(source))return source;if(source.constructor==Array){for(var length_1=source.length,arrayTarget=new Array(length_1),i=0;i<length_1;i++)arrayTarget[i]=clone(source[i]);return arrayTarget}if(source.constructor==Date){var dateTarget=new Date(+source);return dateTarget}var objectTarget={};for(var key in source)exports.hasOwnProperty.call(source,key)&&(objectTarget[key]=clone(source[key]));return objectTarget}exports.clone=clone}});var require_diff=__commonJS({"../../node_modules/rfc6902/diff.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.diffAny=exports.diffObjects=exports.diffArrays=exports.intersection=exports.subtract=exports.isDestructive=void 0;var util_1=require_util();function isDestructive(_a){var op=_a.op;return op==="remove"||op==="replace"||op==="copy"||op==="move"}exports.isDestructive=isDestructive;function subtract(minuend,subtrahend){var obj={};for(var add_key in minuend)util_1.hasOwnProperty.call(minuend,add_key)&&minuend[add_key]!==void 0&&(obj[add_key]=1);for(var del_key in subtrahend)util_1.hasOwnProperty.call(subtrahend,del_key)&&subtrahend[del_key]!==void 0&&delete obj[del_key];return Object.keys(obj)}exports.subtract=subtract;function intersection(objects){for(var length=objects.length,counter={},i=0;i<length;i++){var object=objects[i];for(var key in object)util_1.hasOwnProperty.call(object,key)&&object[key]!==void 0&&(counter[key]=(counter[key]||0)+1)}for(var key in counter)counter[key]<length&&delete counter[key];return Object.keys(counter)}exports.intersection=intersection;function isArrayAdd(array_operation){return array_operation.op==="add"}function isArrayRemove(array_operation){return array_operation.op==="remove"}function appendArrayOperation(base,operation){return{operations:base.operations.concat(operation),cost:base.cost+1}}function diffArrays(input,output,ptr,diff2){diff2===void 0&&(diff2=diffAny);var memo2={"0,0":{operations:[],cost:0}};function dist(i,j2){var memo_key="".concat(i,",").concat(j2),memoized=memo2[memo_key];if(memoized===void 0){if(i>0&&j2>0&&!diff2(input[i-1],output[j2-1],ptr.add(String(i-1))).length)memoized=dist(i-1,j2-1);else{var alternatives=[];if(i>0){var remove_base=dist(i-1,j2),remove_operation={op:"remove",index:i-1};alternatives.push(appendArrayOperation(remove_base,remove_operation))}if(j2>0){var add_base=dist(i,j2-1),add_operation={op:"add",index:i-1,value:output[j2-1]};alternatives.push(appendArrayOperation(add_base,add_operation))}if(i>0&&j2>0){var replace_base=dist(i-1,j2-1),replace_operation={op:"replace",index:i-1,original:input[i-1],value:output[j2-1]};alternatives.push(appendArrayOperation(replace_base,replace_operation))}var best=alternatives.sort(function(a,b2){return a.cost-b2.cost})[0];memoized=best}memo2[memo_key]=memoized}return memoized}var input_length=isNaN(input.length)||input.length<=0?0:input.length,output_length=isNaN(output.length)||output.length<=0?0:output.length,array_operations=dist(input_length,output_length).operations,padded_operations=array_operations.reduce(function(_a,array_operation){var operations=_a[0],padding=_a[1];if(isArrayAdd(array_operation)){var padded_index=array_operation.index+1+padding,index_token=padded_index<input_length+padding?String(padded_index):"-",operation={op:array_operation.op,path:ptr.add(index_token).toString(),value:array_operation.value};return[operations.concat(operation),padding+1]}else if(isArrayRemove(array_operation)){var operation={op:array_operation.op,path:ptr.add(String(array_operation.index+padding)).toString()};return[operations.concat(operation),padding-1]}else{var replace_ptr=ptr.add(String(array_operation.index+padding)),replace_operations=diff2(array_operation.original,array_operation.value,replace_ptr);return[operations.concat.apply(operations,replace_operations),padding]}},[[],0])[0];return padded_operations}exports.diffArrays=diffArrays;function diffObjects(input,output,ptr,diff2){diff2===void 0&&(diff2=diffAny);var operations=[];return subtract(input,output).forEach(function(key){operations.push({op:"remove",path:ptr.add(key).toString()})}),subtract(output,input).forEach(function(key){operations.push({op:"add",path:ptr.add(key).toString(),value:output[key]})}),intersection([input,output]).forEach(function(key){operations.push.apply(operations,diff2(input[key],output[key],ptr.add(key)))}),operations}exports.diffObjects=diffObjects;function diffAny(input,output,ptr,diff2){if(diff2===void 0&&(diff2=diffAny),input===output)return[];var input_type=(0,util_1.objectType)(input),output_type=(0,util_1.objectType)(output);return input_type=="array"&&output_type=="array"?diffArrays(input,output,ptr,diff2):input_type=="object"&&output_type=="object"?diffObjects(input,output,ptr,diff2):[{op:"replace",path:ptr.toString(),value:output}]}exports.diffAny=diffAny}});var require_patch=__commonJS({"../../node_modules/rfc6902/patch.js"(exports){"use strict";var __extends=exports&&exports.__extends||function(){var extendStatics=function(d,b2){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d2,b3){d2.__proto__=b3}||function(d2,b3){for(var p2 in b3)Object.prototype.hasOwnProperty.call(b3,p2)&&(d2[p2]=b3[p2])},extendStatics(d,b2)};return function(d,b2){if(typeof b2!="function"&&b2!==null)throw new TypeError("Class extends value "+String(b2)+" is not a constructor or null");extendStatics(d,b2);function __(){this.constructor=d}d.prototype=b2===null?Object.create(b2):(__.prototype=b2.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:!0});exports.apply=exports.InvalidOperationError=exports.test=exports.copy=exports.move=exports.replace=exports.remove=exports.add=exports.TestError=exports.MissingError=void 0;var pointer_1=require_pointer(),util_1=require_util(),diff_1=require_diff(),MissingError=function(_super){__extends(MissingError2,_super);function MissingError2(path){var _this=_super.call(this,"Value required at path: ".concat(path))||this;return _this.path=path,_this.name="MissingError",_this}return MissingError2}(Error);exports.MissingError=MissingError;var TestError=function(_super){__extends(TestError2,_super);function TestError2(actual,expected){var _this=_super.call(this,"Test failed: ".concat(actual," != ").concat(expected))||this;return _this.actual=actual,_this.expected=expected,_this.name="TestError",_this}return TestError2}(Error);exports.TestError=TestError;function _add(object,key,value){if(Array.isArray(object))if(key=="-")object.push(value);else{var index=parseInt(key,10);object.splice(index,0,value)}else object[key]=value}function _remove(object,key){if(Array.isArray(object)){var index=parseInt(key,10);object.splice(index,1)}else delete object[key]}function add(object,operation){var endpoint=pointer_1.Pointer.fromJSON(operation.path).evaluate(object);return endpoint.parent===void 0?new MissingError(operation.path):(_add(endpoint.parent,endpoint.key,(0,util_1.clone)(operation.value)),null)}exports.add=add;function remove(object,operation){var endpoint=pointer_1.Pointer.fromJSON(operation.path).evaluate(object);return endpoint.value===void 0?new MissingError(operation.path):(_remove(endpoint.parent,endpoint.key),null)}exports.remove=remove;function replace(object,operation){var endpoint=pointer_1.Pointer.fromJSON(operation.path).evaluate(object);if(endpoint.parent===null)return new MissingError(operation.path);if(Array.isArray(endpoint.parent)){if(parseInt(endpoint.key,10)>=endpoint.parent.length)return new MissingError(operation.path)}else if(endpoint.value===void 0)return new MissingError(operation.path);return endpoint.parent[endpoint.key]=(0,util_1.clone)(operation.value),null}exports.replace=replace;function move(object,operation){var from_endpoint=pointer_1.Pointer.fromJSON(operation.from).evaluate(object);if(from_endpoint.value===void 0)return new MissingError(operation.from);var endpoint=pointer_1.Pointer.fromJSON(operation.path).evaluate(object);return endpoint.parent===void 0?new MissingError(operation.path):(_remove(from_endpoint.parent,from_endpoint.key),_add(endpoint.parent,endpoint.key,from_endpoint.value),null)}exports.move=move;function copy(object,operation){var from_endpoint=pointer_1.Pointer.fromJSON(operation.from).evaluate(object);if(from_endpoint.value===void 0)return new MissingError(operation.from);var endpoint=pointer_1.Pointer.fromJSON(operation.path).evaluate(object);return endpoint.parent===void 0?new MissingError(operation.path):(_add(endpoint.parent,endpoint.key,(0,util_1.clone)(from_endpoint.value)),null)}exports.copy=copy;function test(object,operation){var endpoint=pointer_1.Pointer.fromJSON(operation.path).evaluate(object);return(0,diff_1.diffAny)(endpoint.value,operation.value,new pointer_1.Pointer).length?new TestError(endpoint.value,operation.value):null}exports.test=test;var InvalidOperationError=function(_super){__extends(InvalidOperationError2,_super);function InvalidOperationError2(operation){var _this=_super.call(this,"Invalid operation: ".concat(operation.op))||this;return _this.operation=operation,_this.name="InvalidOperationError",_this}return InvalidOperationError2}(Error);exports.InvalidOperationError=InvalidOperationError;function apply(object,operation){switch(operation.op){case"add":return add(object,operation);case"remove":return remove(object,operation);case"replace":return replace(object,operation);case"move":return move(object,operation);case"copy":return copy(object,operation);case"test":return test(object,operation)}return new InvalidOperationError(operation)}exports.apply=apply}});var require_rfc6902=__commonJS({"../../node_modules/rfc6902/index.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.createTests=exports.createPatch=exports.applyPatch=exports.Pointer=void 0;var pointer_1=require_pointer();Object.defineProperty(exports,"Pointer",{enumerable:!0,get:function(){return pointer_1.Pointer}});var patch_1=require_patch(),diff_1=require_diff();function applyPatch(object,patch){return patch.map(function(operation){return(0,patch_1.apply)(object,operation)})}exports.applyPatch=applyPatch;function wrapVoidableDiff(diff2){function wrappedDiff(input,output,ptr){var custom_patch=diff2(input,output,ptr);return Array.isArray(custom_patch)?custom_patch:(0,diff_1.diffAny)(input,output,ptr,wrappedDiff)}return wrappedDiff}function createPatch2(input,output,diff2){var ptr=new pointer_1.Pointer;return(diff2?wrapVoidableDiff(diff2):diff_1.diffAny)(input,output,ptr)}exports.createPatch=createPatch2;function createTest(input,path){var endpoint=pointer_1.Pointer.fromJSON(path).evaluate(input);if(endpoint!==void 0)return{op:"test",path,value:endpoint.value}}function createTests(input,patch){var tests=new Array;return patch.filter(diff_1.isDestructive).forEach(function(operation){var pathTest=createTest(input,operation.path);if(pathTest&&tests.push(pathTest),"from"in operation){var fromTest=createTest(input,operation.from);fromTest&&tests.push(fromTest)}}),tests}exports.createTests=createTests}});var src_exports={};__export(src_exports,{AddressDisplay:()=>AddressDisplay,AddressInput:()=>AddressInput,AnnotationInput:()=>AnnotationInput,AppShell:()=>AppShell,AsyncAutocomplete:()=>AsyncAutocomplete,AttachmentArrayDisplay:()=>AttachmentArrayDisplay,AttachmentArrayInput:()=>AttachmentArrayInput,AttachmentButton:()=>AttachmentButton,AttachmentDisplay:()=>AttachmentDisplay,AttachmentInput:()=>AttachmentInput,BackboneElementDisplay:()=>BackboneElementDisplay,BackboneElementInput:()=>BackboneElementInput,BaseChat:()=>BaseChat,CalendarInput:()=>CalendarInput,ChatModal:()=>ChatModal,CheckboxFormSection:()=>CheckboxFormSection,CodeInput:()=>CodeInput,CodeableConceptDisplay:()=>CodeableConceptDisplay,CodeableConceptInput:()=>CodeableConceptInput,CodingDisplay:()=>CodingDisplay,CodingInput:()=>CodingInput,ContactDetailDisplay:()=>ContactDetailDisplay,ContactDetailInput:()=>ContactDetailInput,ContactPointDisplay:()=>ContactPointDisplay,ContactPointInput:()=>ContactPointInput,Container:()=>Container,DateTimeInput:()=>DateTimeInput,DefaultResourceTimeline:()=>DefaultResourceTimeline,DescriptionList:()=>DescriptionList,DescriptionListEntry:()=>DescriptionListEntry,DiagnosticReportDisplay:()=>DiagnosticReportDisplay,Document:()=>Document,ElementDefinitionInputSelector:()=>ElementDefinitionInputSelector,ElementDefinitionTypeInput:()=>ElementDefinitionTypeInput,EncounterTimeline:()=>EncounterTimeline,ErrorBoundary:()=>ErrorBoundary,FhirPathTable:()=>FhirPathTable,Form:()=>Form,FormSection:()=>FormSection,Header:()=>Header,HumanNameDisplay:()=>HumanNameDisplay,HumanNameInput:()=>HumanNameInput,IdentifierDisplay:()=>IdentifierDisplay,IdentifierInput:()=>IdentifierInput,Loading:()=>Loading,Logo:()=>Logo,MeasureReportDisplay:()=>MeasureReportDisplay,MedplumLink:()=>MedplumLink,MedplumProvider:()=>me,MemoizedFhirPathTable:()=>MemoizedFhirPathTable,MemoizedSearchControl:()=>MemoizedSearchControl,MoneyDisplay:()=>MoneyDisplay,MoneyInput:()=>MoneyInput,Navbar:()=>Navbar,NoteDisplay:()=>NoteDisplay,NotificationIcon:()=>NotificationIcon,ObservationTable:()=>ObservationTable,OperationOutcomeAlert:()=>OperationOutcomeAlert,Panel:()=>Panel,PatientSummary:()=>PatientSummary,PatientTimeline:()=>PatientTimeline,PlanDefinitionBuilder:()=>PlanDefinitionBuilder,QuantityDisplay:()=>QuantityDisplay,QuantityInput:()=>QuantityInput,QuestionnaireBuilder:()=>QuestionnaireBuilder,QuestionnaireForm:()=>QuestionnaireForm,QuestionnaireFormContext:()=>QuestionnaireFormContext,QuestionnaireItemType:()=>QuestionnaireItemType,RangeDisplay:()=>RangeDisplay,RangeInput:()=>RangeInput,RatioInput:()=>RatioInput,ReferenceDisplay:()=>ReferenceDisplay,ReferenceInput:()=>ReferenceInput,ReferenceRangeEditor:()=>ReferenceRangeEditor,ReferenceRangeGroupEditor:()=>ReferenceRangeGroupEditor,RegisterForm:()=>RegisterForm,RequestGroupDisplay:()=>RequestGroupDisplay,ResourceArrayDisplay:()=>ResourceArrayDisplay,ResourceArrayInput:()=>ResourceArrayInput,ResourceAvatar:()=>ResourceAvatar,ResourceBadge:()=>ResourceBadge,ResourceBlame:()=>ResourceBlame,ResourceDiff:()=>ResourceDiff,ResourceForm:()=>ResourceForm,ResourceHistoryTable:()=>ResourceHistoryTable,ResourceInput:()=>ResourceInput,ResourceName:()=>ResourceName,ResourcePropertyDisplay:()=>ResourcePropertyDisplay,ResourcePropertyInput:()=>ResourcePropertyInput,ResourceTable:()=>ResourceTable,ResourceTimeline:()=>ResourceTimeline,Scheduler:()=>Scheduler,SearchChangeEvent:()=>SearchChangeEvent,SearchClickEvent:()=>SearchClickEvent,SearchControl:()=>SearchControl,SearchFieldEditor:()=>SearchFieldEditor,SearchFilterEditor:()=>SearchFilterEditor,SearchLoadEvent:()=>SearchLoadEvent,ServiceRequestTimeline:()=>ServiceRequestTimeline,SignInForm:()=>SignInForm,SmartAppLaunchLink:()=>SmartAppLaunchLink,StatusBadge:()=>StatusBadge,ThreadChat:()=>ThreadChat,Timeline:()=>Timeline,TimelineItem:()=>TimelineItem,TimingInput:()=>TimingInput,ValueSetAutocomplete:()=>ValueSetAutocomplete,addDateFilterBetween:()=>addDateFilterBetween,addField:()=>addField,addFilter:()=>addFilter,addLastMonthFilter:()=>addLastMonthFilter,addMissingFilter:()=>addMissingFilter,addNextMonthFilter:()=>addNextMonthFilter,addThisMonthFilter:()=>addThisMonthFilter,addTodayFilter:()=>addTodayFilter,addTomorrowFilter:()=>addTomorrowFilter,addYearToDateFilter:()=>addYearToDateFilter,addYesterdayFilter:()=>addYesterdayFilter,buildFieldNameString:()=>buildFieldNameString,buildInitialResponse:()=>buildInitialResponse,buildInitialResponseItem:()=>buildInitialResponseItem,clearFilters:()=>clearFilters,clearFiltersOnField:()=>clearFiltersOnField,convertIsoToLocal:()=>convertIsoToLocal,convertLocalToIso:()=>convertLocalToIso,createScriptTag:()=>createScriptTag,deleteFilter:()=>deleteFilter,formatReferenceString:()=>formatReferenceString,getErrorsForInput:()=>getErrorsForInput,getFieldDefinitions:()=>getFieldDefinitions,getIssuesForExpression:()=>getIssuesForExpression,getNewMultiSelectValues:()=>getNewMultiSelectValues,getNumberOfPages:()=>getNumberOfPages,getOpString:()=>getOpString,getQuestionnaireItemReferenceFilter:()=>getQuestionnaireItemReferenceFilter,getQuestionnaireItemReferenceTargetTypes:()=>getQuestionnaireItemReferenceTargetTypes,getRecaptcha:()=>getRecaptcha,getSearchOperators:()=>getSearchOperators,getSortField:()=>getSortField,getValuePath:()=>getValuePath,initRecaptcha:()=>initRecaptcha,isChoiceQuestion:()=>isChoiceQuestion,isQuestionEnabled:()=>isQuestionEnabled,isSortDescending:()=>isSortDescending,isSupportedProfileStructureDefinition:()=>isSupportedProfileStructureDefinition,parseForm:()=>parseForm,reactContext:()=>O,renderValue:()=>renderValue,setFilters:()=>setFilters,setOffset:()=>setOffset,setPage:()=>setPage,setPropertyValue:()=>setPropertyValue,setQuestionnaireItemReferenceTargetTypes:()=>setQuestionnaireItemReferenceTargetTypes,setSort:()=>setSort,sortByDateAndPriority:()=>sortByDateAndPriority,toggleSort:()=>toggleSort,useCachedBinaryUrl:()=>Se,useMedplum:()=>b,useMedplumContext:()=>T,useMedplumNavigate:()=>se,useMedplumProfile:()=>ue,usePrevious:()=>xe,useResource:()=>Te,useSearch:()=>Ne,useSearchOne:()=>Ue,useSearchResources:()=>We,useSubscription:()=>Qe});module.exports=__toCommonJS(src_exports);var import_react=require("react"),import_react2=require("react"),import_jsx_runtime=require("react/jsx-runtime"),import_react3=require("react"),import_react4=require("react"),import_core=require("@medplum/core"),import_react5=require("react"),import_core2=require("@medplum/core"),import_react6=require("react"),import_core3=require("@medplum/core"),import_react7=require("react"),O=(0,import_react2.createContext)(void 0);function T(){return(0,import_react2.useContext)(O)}function b(){return T().medplum}function se(){return T().navigate}function ue(){return T().profile}var N=["change","storageInitialized","storageInitFailed","profileRefreshing","profileRefreshed"];function me(e){let t=e.medplum,n=e.navigate??V,[i,r2]=(0,import_react.useState)({profile:t.getProfile(),loading:t.isLoading()});(0,import_react.useEffect)(()=>{function o(){r2(u=>({...u,profile:t.getProfile(),loading:t.isLoading()}))}for(let u of N)t.addEventListener(u,o);return()=>{for(let u of N)t.removeEventListener(u,o)}},[t]);let s=(0,import_react.useMemo)(()=>({...i,medplum:t,navigate:n}),[i,t,n]);return(0,import_jsx_runtime.jsx)(O.Provider,{value:s,children:e.children})}function V(e){window.location.assign(e)}var U=new Map,Se=e=>(0,import_react3.useMemo)(()=>{if(!e)return;let t=e.split("?")[0];if(!t)return e;let n;try{n=new URLSearchParams(new URL(e).search)}catch{return e}if(!n.has("Key-Pair-Id")||!n.has("Signature"))return e;let i=n.get("Expires");if(!i||i.length>13)return e;let r2=U.get(t);if(r2){let o=new URLSearchParams(new URL(r2).search).get("Expires");if(o&&parseInt(o,10)*1e3-5e3>Date.now())return r2}return U.set(t,e),e},[e]);function xe(e){let t=(0,import_react4.useRef)();return(0,import_react4.useEffect)(()=>{t.current=e}),t.current}function Te(e,t){let n=b(),[i,r2]=(0,import_react5.useState)(()=>W(n,e)),s=(0,import_react5.useCallback)(o=>{(0,import_core.deepEquals)(o,i)||r2(o)},[i]);return(0,import_react5.useEffect)(()=>{let o=!0,u=W(n,e);return!u&&(0,import_core.isReference)(e)?n.readReference(e).then(a=>{o&&s(a)}).catch(a=>{o&&(s(void 0),t&&t((0,import_core.normalizeOperationOutcome)(a)))}):s(u),()=>o=!1},[n,e,s,t]),i}function W(e,t){if(t){if((0,import_core.isResource)(t))return t;if((0,import_core.isReference)(t))return e.getCachedReference(t)}}function Ne(e,t){return P("search",e,t)}function Ue(e,t){return P("searchOne",e,t)}function We(e,t){return P("searchResources",e,t)}function P(e,t,n){let i=b(),[r2,s]=(0,import_react6.useState)(),[o,u]=(0,import_react6.useState)(!0),[a,d]=(0,import_react6.useState)(),[f,m]=(0,import_react6.useState)();return(0,import_react6.useEffect)(()=>{let S=i.fhirSearchUrl(t,n).toString();S!==r2&&(s(S),i[e](t,n).then(l=>{u(!1),d(l),m(import_core2.allOk)}).catch(l=>{u(!1),d(void 0),m((0,import_core2.normalizeOperationOutcome)(l))}))},[i,e,t,n,r2]),[a,o,f]}var oe=3e3;function Qe(e,t,n){let i=b(),[r2,s]=(0,import_react7.useState)(),[o,u]=(0,import_react7.useState)(n?.subscriptionProps),a=(0,import_react7.useRef)(!1),d=(0,import_react7.useRef)(),f=(0,import_react7.useRef)(),m=(0,import_react7.useRef)(),S=(0,import_react7.useRef)();S.current=t;let l=(0,import_react7.useRef)();l.current=n?.onWebSocketOpen;let L=(0,import_react7.useRef)();L.current=n?.onWebSocketClose;let K=(0,import_react7.useRef)();K.current=n?.onSubscriptionConnect;let k=(0,import_react7.useRef)();k.current=n?.onSubscriptionDisconnect;let I=(0,import_react7.useRef)();I.current=n?.onError,(0,import_react7.useEffect)(()=>{(0,import_core3.deepEquals)(n?.subscriptionProps,o)||u(n?.subscriptionProps)},[o,n]),(0,import_react7.useEffect)(()=>{d.current&&(clearTimeout(d.current),d.current=void 0);let c=!1;return(f.current!==e||!(0,import_core3.deepEquals)(m.current,o))&&(c=!0),c&&f.current&&i.unsubscribeFromCriteria(f.current,m.current),f.current=e,m.current=o,c&&s(i.subscribeToCriteria(e,o)),()=>{d.current=setTimeout(()=>{s(void 0),i.unsubscribeFromCriteria(e,o)},oe)}},[i,e,o]);let E=(0,import_react7.useCallback)(c=>{S.current?.(c.payload)},[]),x=(0,import_react7.useCallback)(()=>{l.current?.()},[]),g=(0,import_react7.useCallback)(()=>{L.current?.()},[]),C=(0,import_react7.useCallback)(c=>{K.current?.(c.payload.subscriptionId)},[]),h=(0,import_react7.useCallback)(c=>{k.current?.(c.payload.subscriptionId)},[]),M=(0,import_react7.useCallback)(c=>{I.current?.(c.payload)},[]);(0,import_react7.useEffect)(()=>r2?(a.current||(r2.addEventListener("message",E),r2.addEventListener("open",x),r2.addEventListener("close",g),r2.addEventListener("connect",C),r2.addEventListener("disconnect",h),r2.addEventListener("error",M),a.current=!0),()=>{a.current=!1,r2.removeEventListener("message",E),r2.removeEventListener("open",x),r2.removeEventListener("close",g),r2.removeEventListener("connect",C),r2.removeEventListener("disconnect",h),r2.removeEventListener("error",M)}):()=>{},[r2,E,x,g,C,h,M])}var import_core4=require("@medplum/core"),import_jsx_runtime2=require("react/jsx-runtime");function AddressDisplay(props){let address=props.value;return address?(0,import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment,{children:(0,import_core4.formatAddress)(address)}):null}var import_core6=require("@mantine/core"),import_react9=require("react");var import_core5=require("@medplum/core"),import_react8=require("react");var DEFAULT_IGNORED_PROPERTIES=["meta","implicitRules","contained","extension","modifierExtension"],DEFAULT_IGNORED_NON_NESTED_PROPERTIES=["language","text"];var ElementsContext=(0,import_react8.createContext)({path:"",profileUrl:void 0,elements:Object.create(null),elementsByPath:Object.create(null),getExtendedProps:()=>({readonly:!1,hidden:!1}),accessPolicyResource:void 0,debugMode:!1,isDefaultContext:!0});ElementsContext.displayName="ElementsContext";var EXTENSION_KEYS=["extension","modifierExtension"],IGNORED_PROPERTIES=["id",...DEFAULT_IGNORED_PROPERTIES].filter(prop=>!EXTENSION_KEYS.includes(prop));function getElementsToRender(inputElements){return Object.entries(inputElements).filter(([key,element])=>!(0,import_core5.isPopulated)(element.type)||element.max===0||element.path.toLowerCase().endsWith("extension.url")&&element.fixed||EXTENSION_KEYS.includes(key)&&!(0,import_core5.isPopulated)(element.slicing?.slices)||IGNORED_PROPERTIES.includes(key)?!1:!(DEFAULT_IGNORED_NON_NESTED_PROPERTIES.includes(key)&&element.path.split(".").length===2||key.includes(".")))}var import_jsx_runtime3=require("react/jsx-runtime");function getLine(address,index){return address.line&&address.line.length>index?address.line[index]:""}function setLine(address,index,str){let line=address.line||[];for(;line.length<=index;)line.push("");return line[index]=str,{...address,line}}function AddressInput(props){let[value,setValue]=(0,import_react9.useState)(props.defaultValue||{}),valueRef=(0,import_react9.useRef)();valueRef.current=value;let{getExtendedProps}=(0,import_react9.useContext)(ElementsContext),[useProps,typeProps,line1Props,line2Props,cityProps,stateProps,postalCodeProps]=(0,import_react9.useMemo)(()=>["use","type","line1","line2","city","state","postalCode"].map(field=>getExtendedProps(props.path+"."+field)),[getExtendedProps,props.path]);function setValueWrapper(newValue){setValue(newValue),props.onChange&&props.onChange(newValue)}function setUse(use){setValueWrapper({...valueRef.current,use})}function setType(type){setValueWrapper({...valueRef.current,type})}function setLine1(line1){setValueWrapper(setLine(valueRef.current||{},0,line1))}function setLine2(line2){setValueWrapper(setLine(valueRef.current||{},1,line2))}function setCity(city){setValueWrapper({...valueRef.current,city})}function setState(state){setValueWrapper({...valueRef.current,state})}function setPostalCode(postalCode){setValueWrapper({...valueRef.current,postalCode})}return(0,import_jsx_runtime3.jsxs)(import_core6.Group,{gap:"xs",wrap:"nowrap",grow:!0,children:[(0,import_jsx_runtime3.jsx)(import_core6.NativeSelect,{disabled:props.disabled||useProps?.readonly,"data-testid":"address-use",defaultValue:value.use,onChange:e=>setUse(e.currentTarget.value),data:["","home","work","temp","old","billing"]}),(0,import_jsx_runtime3.jsx)(import_core6.NativeSelect,{disabled:props.disabled||typeProps?.readonly,"data-testid":"address-type",defaultValue:value.type,onChange:e=>setType(e.currentTarget.value),data:["","postal","physical","both"]}),(0,import_jsx_runtime3.jsx)(import_core6.TextInput,{disabled:props.disabled||line1Props?.readonly,placeholder:"Line 1",defaultValue:getLine(value,0),onChange:e=>setLine1(e.currentTarget.value)}),(0,import_jsx_runtime3.jsx)(import_core6.TextInput,{disabled:props.disabled||line2Props?.readonly,placeholder:"Line 2",defaultValue:getLine(value,1),onChange:e=>setLine2(e.currentTarget.value)}),(0,import_jsx_runtime3.jsx)(import_core6.TextInput,{disabled:props.disabled||cityProps?.readonly,placeholder:"City",defaultValue:value.city,onChange:e=>setCity(e.currentTarget.value)}),(0,import_jsx_runtime3.jsx)(import_core6.TextInput,{disabled:props.disabled||stateProps?.readonly,placeholder:"State",defaultValue:value.state,onChange:e=>setState(e.currentTarget.value)}),(0,import_jsx_runtime3.jsx)(import_core6.TextInput,{disabled:props.disabled||postalCodeProps?.readonly,placeholder:"Postal Code",defaultValue:value.postalCode,onChange:e=>setPostalCode(e.currentTarget.value)})]})}var import_core7=require("@mantine/core"),import_core8=require("@medplum/core");var import_react10=require("react"),import_jsx_runtime4=require("react/jsx-runtime");function AnnotationInput(props){let author=ue(),[value,setValue]=(0,import_react10.useState)(props.defaultValue||{});function setText(text){let newValue=text?{text,authorReference:author&&(0,import_core8.createReference)(author),time:new Date().toISOString()}:{};setValue(newValue),props.onChange&&props.onChange(newValue)}return(0,import_jsx_runtime4.jsx)(import_core7.TextInput,{disabled:props.disabled,name:props.name,placeholder:"Annotation text",defaultValue:value.text,onChange:e=>setText(e.currentTarget.value)})}var import_core29=require("@mantine/core"),import_notifications3=require("@mantine/notifications");var import_react20=require("react");var import_core9=require("@mantine/core"),import_core10=require("@medplum/core");var import_react11=require("react");var defaultAttributes={outline:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},filled:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",stroke:"none"}};var createReactComponent=(type,iconName,iconNamePascal,iconNode)=>{let Component2=(0,import_react11.forwardRef)(({color="currentColor",size=24,stroke=2,title,className,children,...rest},ref)=>(0,import_react11.createElement)("svg",{ref,...defaultAttributes[type],width:size,height:size,className:["tabler-icon",`tabler-icon-${iconName}`,className].join(" "),...type==="filled"?{fill:color}:{strokeWidth:stroke,stroke:color},...rest},[title&&(0,import_react11.createElement)("title",{key:"svg-title"},title),...iconNode.map(([tag,attrs])=>(0,import_react11.createElement)(tag,attrs)),...Array.isArray(children)?children:[children]]));return Component2.displayName=`${iconNamePascal}`,Component2};var IconAdjustmentsHorizontal=createReactComponent("outline","adjustments-horizontal","IconAdjustmentsHorizontal",[["path",{d:"M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M4 6l8 0",key:"svg-1"}],["path",{d:"M16 6l4 0",key:"svg-2"}],["path",{d:"M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-3"}],["path",{d:"M4 12l2 0",key:"svg-4"}],["path",{d:"M10 12l10 0",key:"svg-5"}],["path",{d:"M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-6"}],["path",{d:"M4 18l11 0",key:"svg-7"}],["path",{d:"M19 18l1 0",key:"svg-8"}]]);var IconAlertCircle=createReactComponent("outline","alert-circle","IconAlertCircle",[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M12 8v4",key:"svg-1"}],["path",{d:"M12 16h.01",key:"svg-2"}]]);var IconArrowDown=createReactComponent("outline","arrow-down","IconArrowDown",[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M18 13l-6 6",key:"svg-1"}],["path",{d:"M6 13l6 6",key:"svg-2"}]]);var IconArrowRight=createReactComponent("outline","arrow-right","IconArrowRight",[["path",{d:"M5 12l14 0",key:"svg-0"}],["path",{d:"M13 18l6 -6",key:"svg-1"}],["path",{d:"M13 6l6 6",key:"svg-2"}]]);var IconArrowUp=createReactComponent("outline","arrow-up","IconArrowUp",[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M18 11l-6 -6",key:"svg-1"}],["path",{d:"M6 11l6 -6",key:"svg-2"}]]);var IconBleachOff=createReactComponent("outline","bleach-off","IconBleachOff",[["path",{d:"M5 19h14m1.986 -1.977a2 2 0 0 0 -.146 -.773l-7.1 -12.25a2 2 0 0 0 -3.5 0l-.815 1.405m-1.488 2.568l-4.797 8.277a2 2 0 0 0 1.75 2.75",key:"svg-0"}],["path",{d:"M3 3l18 18",key:"svg-1"}]]);var IconBleach=createReactComponent("outline","bleach","IconBleach",[["path",{d:"M5 19h14a2 2 0 0 0 1.84 -2.75l-7.1 -12.25a2 2 0 0 0 -3.5 0l-7.1 12.25a2 2 0 0 0 1.75 2.75",key:"svg-0"}]]);var IconBoxMultiple=createReactComponent("outline","box-multiple","IconBoxMultiple",[["path",{d:"M7 3m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z",key:"svg-0"}],["path",{d:"M17 17v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2h2",key:"svg-1"}]]);var IconBracketsContain=createReactComponent("outline","brackets-contain","IconBracketsContain",[["path",{d:"M7 4h-4v16h4",key:"svg-0"}],["path",{d:"M17 4h4v16h-4",key:"svg-1"}],["path",{d:"M8 16h.01",key:"svg-2"}],["path",{d:"M12 16h.01",key:"svg-3"}],["path",{d:"M16 16h.01",key:"svg-4"}]]);var IconBucketOff=createReactComponent("outline","bucket-off","IconBucketOff",[["path",{d:"M5.029 5.036c-.655 .58 -1.029 1.25 -1.029 1.964c0 2.033 3.033 3.712 6.96 3.967m3.788 -.21c3.064 -.559 5.252 -2.029 5.252 -3.757c0 -2.21 -3.582 -4 -8 -4c-1.605 0 -3.1 .236 -4.352 .643",key:"svg-0"}],["path",{d:"M4 7c0 .664 .088 1.324 .263 1.965l2.737 10.035c.5 1.5 2.239 2 5 2s4.5 -.5 5 -2c.1 -.3 .252 -.812 .457 -1.535m.862 -3.146c.262 -.975 .735 -2.76 1.418 -5.354a7.45 7.45 0 0 0 .263 -1.965",key:"svg-1"}],["path",{d:"M3 3l18 18",key:"svg-2"}]]);var IconBucket=createReactComponent("outline","bucket","IconBucket",[["path",{d:"M12 7m-8 0a8 4 0 1 0 16 0a8 4 0 1 0 -16 0",key:"svg-0"}],["path",{d:"M4 7c0 .664 .088 1.324 .263 1.965l2.737 10.035c.5 1.5 2.239 2 5 2s4.5 -.5 5 -2c.333 -1 1.246 -4.345 2.737 -10.035a7.45 7.45 0 0 0 .263 -1.965",key:"svg-1"}]]);var IconCalendar=createReactComponent("outline","calendar","IconCalendar",[["path",{d:"M4 7a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12z",key:"svg-0"}],["path",{d:"M16 3v4",key:"svg-1"}],["path",{d:"M8 3v4",key:"svg-2"}],["path",{d:"M4 11h16",key:"svg-3"}],["path",{d:"M11 15h1",key:"svg-4"}],["path",{d:"M12 15v3",key:"svg-5"}]]);var IconCheck=createReactComponent("outline","check","IconCheck",[["path",{d:"M5 12l5 5l10 -10",key:"svg-0"}]]);var IconCheckbox=createReactComponent("outline","checkbox","IconCheckbox",[["path",{d:"M9 11l3 3l8 -8",key:"svg-0"}],["path",{d:"M20 12v6a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h9",key:"svg-1"}]]);var IconChevronDown=createReactComponent("outline","chevron-down","IconChevronDown",[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]]);var IconChevronUp=createReactComponent("outline","chevron-up","IconChevronUp",[["path",{d:"M6 15l6 -6l6 6",key:"svg-0"}]]);var IconCircleMinus=createReactComponent("outline","circle-minus","IconCircleMinus",[["path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-0"}],["path",{d:"M9 12l6 0",key:"svg-1"}]]);var IconCirclePlus=createReactComponent("outline","circle-plus","IconCirclePlus",[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M9 12h6",key:"svg-1"}],["path",{d:"M12 9v6",key:"svg-2"}]]);var IconCloudUpload=createReactComponent("outline","cloud-upload","IconCloudUpload",[["path",{d:"M7 18a4.6 4.4 0 0 1 0 -9a5 4.5 0 0 1 11 2h1a3.5 3.5 0 0 1 0 7h-1",key:"svg-0"}],["path",{d:"M9 15l3 -3l3 3",key:"svg-1"}],["path",{d:"M12 12l0 9",key:"svg-2"}]]);var IconColumns=createReactComponent("outline","columns","IconColumns",[["path",{d:"M4 6l5.5 0",key:"svg-0"}],["path",{d:"M4 10l5.5 0",key:"svg-1"}],["path",{d:"M4 14l5.5 0",key:"svg-2"}],["path",{d:"M4 18l5.5 0",key:"svg-3"}],["path",{d:"M14.5 6l5.5 0",key:"svg-4"}],["path",{d:"M14.5 10l5.5 0",key:"svg-5"}],["path",{d:"M14.5 14l5.5 0",key:"svg-6"}],["path",{d:"M14.5 18l5.5 0",key:"svg-7"}]]);var IconCopy=createReactComponent("outline","copy","IconCopy",[["path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z",key:"svg-0"}],["path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1",key:"svg-1"}]]);var IconCurrencyDollar=createReactComponent("outline","currency-dollar","IconCurrencyDollar",[["path",{d:"M16.7 8a3 3 0 0 0 -2.7 -2h-4a3 3 0 0 0 0 6h4a3 3 0 0 1 0 6h-4a3 3 0 0 1 -2.7 -2",key:"svg-0"}],["path",{d:"M12 3v3m0 12v3",key:"svg-1"}]]);var IconDots=createReactComponent("outline","dots","IconDots",[["path",{d:"M5 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M19 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}]]);var IconEdit=createReactComponent("outline","edit","IconEdit",[["path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1",key:"svg-0"}],["path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z",key:"svg-1"}],["path",{d:"M16 5l3 3",key:"svg-2"}]]);var IconEqualNot=createReactComponent("outline","equal-not","IconEqualNot",[["path",{d:"M5 10h14",key:"svg-0"}],["path",{d:"M5 14h14",key:"svg-1"}],["path",{d:"M5 19l14 -14",key:"svg-2"}]]);var IconEqual=createReactComponent("outline","equal","IconEqual",[["path",{d:"M5 10h14",key:"svg-0"}],["path",{d:"M5 14h14",key:"svg-1"}]]);var IconFileAlert=createReactComponent("outline","file-alert","IconFileAlert",[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z",key:"svg-1"}],["path",{d:"M12 17l.01 0",key:"svg-2"}],["path",{d:"M12 11l0 3",key:"svg-3"}]]);var IconFilePlus=createReactComponent("outline","file-plus","IconFilePlus",[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z",key:"svg-1"}],["path",{d:"M12 11l0 6",key:"svg-2"}],["path",{d:"M9 14l6 0",key:"svg-3"}]]);var IconFilter=createReactComponent("outline","filter","IconFilter",[["path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z",key:"svg-0"}]]);var IconGenderFemale=createReactComponent("outline","gender-female","IconGenderFemale",[["path",{d:"M12 9m-5 0a5 5 0 1 0 10 0a5 5 0 1 0 -10 0",key:"svg-0"}],["path",{d:"M12 14v7",key:"svg-1"}],["path",{d:"M9 18h6",key:"svg-2"}]]);var IconGenderMale=createReactComponent("outline","gender-male","IconGenderMale",[["path",{d:"M10 14m-5 0a5 5 0 1 0 10 0a5 5 0 1 0 -10 0",key:"svg-0"}],["path",{d:"M19 5l-5.4 5.4",key:"svg-1"}],["path",{d:"M19 5h-5",key:"svg-2"}],["path",{d:"M19 5v5",key:"svg-3"}]]);var IconLogout=createReactComponent("outline","logout","IconLogout",[["path",{d:"M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M9 12h12l-3 -3",key:"svg-1"}],["path",{d:"M18 15l3 -3",key:"svg-2"}]]);var IconMathGreater=createReactComponent("outline","math-greater","IconMathGreater",[["path",{d:"M5 18l14 -6l-14 -6",key:"svg-0"}]]);var IconMathLower=createReactComponent("outline","math-lower","IconMathLower",[["path",{d:"M19 18l-14 -6l14 -6",key:"svg-0"}]]);var IconMessage=createReactComponent("outline","message","IconMessage",[["path",{d:"M8 9h8",key:"svg-0"}],["path",{d:"M8 13h6",key:"svg-1"}],["path",{d:"M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12z",key:"svg-2"}]]);var IconPlus=createReactComponent("outline","plus","IconPlus",[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M5 12l14 0",key:"svg-1"}]]);var IconRefresh=createReactComponent("outline","refresh","IconRefresh",[["path",{d:"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4",key:"svg-0"}],["path",{d:"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4",key:"svg-1"}]]);var IconSearch=createReactComponent("outline","search","IconSearch",[["path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M21 21l-6 -6",key:"svg-1"}]]);var IconSettings=createReactComponent("outline","settings","IconSettings",[["path",{d:"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z",key:"svg-0"}],["path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-1"}]]);var IconSortAscending=createReactComponent("outline","sort-ascending","IconSortAscending",[["path",{d:"M4 6l7 0",key:"svg-0"}],["path",{d:"M4 12l7 0",key:"svg-1"}],["path",{d:"M4 18l9 0",key:"svg-2"}],["path",{d:"M15 9l3 -3l3 3",key:"svg-3"}],["path",{d:"M18 6l0 12",key:"svg-4"}]]);var IconSortDescending=createReactComponent("outline","sort-descending","IconSortDescending",[["path",{d:"M4 6l9 0",key:"svg-0"}],["path",{d:"M4 12l7 0",key:"svg-1"}],["path",{d:"M4 18l7 0",key:"svg-2"}],["path",{d:"M15 15l3 3l3 -3",key:"svg-3"}],["path",{d:"M18 6l0 12",key:"svg-4"}]]);var IconSquare=createReactComponent("outline","square","IconSquare",[["path",{d:"M3 3m0 2a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z",key:"svg-0"}]]);var IconStethoscope=createReactComponent("outline","stethoscope","IconStethoscope",[["path",{d:"M6 4h-1a2 2 0 0 0 -2 2v3.5h0a5.5 5.5 0 0 0 11 0v-3.5a2 2 0 0 0 -2 -2h-1",key:"svg-0"}],["path",{d:"M8 15a6 6 0 1 0 12 0v-3",key:"svg-1"}],["path",{d:"M11 3v2",key:"svg-2"}],["path",{d:"M6 3v2",key:"svg-3"}],["path",{d:"M20 10m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-4"}]]);var IconSwitchHorizontal=createReactComponent("outline","switch-horizontal","IconSwitchHorizontal",[["path",{d:"M16 3l4 4l-4 4",key:"svg-0"}],["path",{d:"M10 7l10 0",key:"svg-1"}],["path",{d:"M8 13l-4 4l4 4",key:"svg-2"}],["path",{d:"M4 17l9 0",key:"svg-3"}]]);var IconTableExport=createReactComponent("outline","table-export","IconTableExport",[["path",{d:"M12.5 21h-7.5a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v7.5",key:"svg-0"}],["path",{d:"M3 10h18",key:"svg-1"}],["path",{d:"M10 3v18",key:"svg-2"}],["path",{d:"M16 19h6",key:"svg-3"}],["path",{d:"M19 16l3 3l-3 3",key:"svg-4"}]]);var IconTrash=createReactComponent("outline","trash","IconTrash",[["path",{d:"M4 7l16 0",key:"svg-0"}],["path",{d:"M10 11l0 6",key:"svg-1"}],["path",{d:"M14 11l0 6",key:"svg-2"}],["path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12",key:"svg-3"}],["path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3",key:"svg-4"}]]);var IconUserSquare=createReactComponent("outline","user-square","IconUserSquare",[["path",{d:"M9 10a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-0"}],["path",{d:"M6 21v-1a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v1",key:"svg-1"}],["path",{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z",key:"svg-2"}]]);var IconX=createReactComponent("outline","x","IconX",[["path",{d:"M18 6l-12 12",key:"svg-0"}],["path",{d:"M6 6l12 12",key:"svg-1"}]]);var import_react12=require("react"),import_jsx_runtime5=require("react/jsx-runtime"),ErrorBoundary=class extends import_react12.Component{constructor(props){super(props),this.state={lastLocation:window.location.toString()}}static getDerivedStateFromError(error){return{error,lastLocation:window.location.toString()}}componentDidUpdate(_prevProps,_prevState){window.location.toString()!==this.state.lastLocation&&this.setState({lastLocation:window.location.toString(),error:void 0})}shouldComponentUpdate(nextProps,nextState){return!!(this.props.children!==nextProps.children||nextState.error&&!this.state.error||this.state.lastLocation!==window.location.toString())}componentDidCatch(error,errorInfo){console.error("Uncaught error:",error,errorInfo)}render(){return this.state.error?(0,import_jsx_runtime5.jsx)(import_core9.Alert,{icon:(0,import_jsx_runtime5.jsx)(IconAlertCircle,{size:16}),title:"Something went wrong",color:"red",children:(0,import_core10.normalizeErrorString)(this.state.error)}):this.props.children}};var import_core11=require("@mantine/core"),import_jsx_runtime6=require("react/jsx-runtime");function Loading(){return(0,import_jsx_runtime6.jsx)(import_core11.Center,{style:{width:"100%",height:"100vh"},children:(0,import_jsx_runtime6.jsx)(import_core11.Loader,{})})}var AppShell_default={main:"AppShell_main"};var import_core23=require("@mantine/core"),import_core24=require("@medplum/core");function r(e){var t,f,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}var clsx_default=clsx;var import_react15=require("react");var import_core14=require("@mantine/core"),import_core15=require("@medplum/core");var import_core12=require("@mantine/core"),import_core13=require("@medplum/core");function killEvent(e){e.preventDefault(),e.stopPropagation()}function isCheckboxCell(el){if(isCheckboxElement(el))return!0;if(el instanceof HTMLTableCellElement){let children=el.children;if(children.length===1&&isCheckboxElement(children[0]))return!0}return!1}function isCheckboxElement(el){return el instanceof HTMLInputElement&&el.type==="checkbox"}var import_jsx_runtime7=require("react/jsx-runtime");function MedplumLink(props){let navigate=se(),{to,suffix,label,onClick,children,...rest}=props,href=getHref(to);return suffix&&(href+="/"+suffix),(0,import_jsx_runtime7.jsx)(import_core12.Anchor,{href,"aria-label":label,onClick:e=>{killEvent(e),onClick?onClick(e):to&&navigate(href)},...rest,children})}function getHref(to){if(to){if(typeof to=="string")return getStringHref(to);if((0,import_core13.isResource)(to))return getResourceHref(to);if((0,import_core13.isReference)(to))return getReferenceHref(to)}return"#"}function getStringHref(to){return to.startsWith("http://")||to.startsWith("https://")||to.startsWith("/")?to:"/"+to}function getResourceHref(to){return`/${to.resourceType}/${to.id}`}function getReferenceHref(to){return`/${to.reference}`}function getInitials(input){let words=input.split(" ").filter(Boolean);return words.length>1?words[0][0]+words[words.length-1][0]:words.length===1?words[0][0]:""}var import_jsx_runtime8=require("react/jsx-runtime");function ResourceAvatar(props){let resource=Te(props.value),text=resource?(0,import_core15.getDisplayString)(resource):props.alt??"",initials=getInitials(text),uncachedImageUrl=(resource&&(0,import_core15.getImageSrc)(resource))??props.src,imageUrl=Se(uncachedImageUrl??void 0),radius=props.radius??"xl",avatarProps={...props,value:void 0,link:void 0};return props.link?(0,import_jsx_runtime8.jsx)(MedplumLink,{to:resource,children:(0,import_jsx_runtime8.jsx)(import_core14.Avatar,{src:imageUrl,alt:text,radius,...avatarProps,children:initials})}):(0,import_jsx_runtime8.jsx)(import_core14.Avatar,{src:imageUrl,alt:text,radius,...avatarProps,children:initials})}var Header_default={logoButton:"Header_logoButton",user:"Header_user",userName:"Header_userName",userActive:"Header_userActive"};var import_core17=require("@mantine/core"),import_core18=require("@medplum/core");var import_core16=require("@medplum/core"),import_jsx_runtime9=require("react/jsx-runtime");function HumanNameDisplay(props){let name=props.value;return name?(0,import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment,{children:(0,import_core16.formatHumanName)(name,props.options)}):null}var import_jsx_runtime10=require("react/jsx-runtime");function HeaderDropdown(props){let context=T(),{medplum,profile,navigate}=context,logins=medplum.getLogins(),{colorScheme,setColorScheme}=(0,import_core17.useMantineColorScheme)();return(0,import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment,{children:[(0,import_jsx_runtime10.jsxs)(import_core17.Stack,{align:"center",p:"xl",children:[(0,import_jsx_runtime10.jsx)(ResourceAvatar,{size:"xl",radius:100,value:context.profile}),(0,import_jsx_runtime10.jsx)(HumanNameDisplay,{value:context.profile?.name?.[0]}),(0,import_jsx_runtime10.jsx)(import_core17.Text,{c:"dimmed",size:"xs",children:medplum.getActiveLogin()?.project.display})]}),logins.length>1&&(0,import_jsx_runtime10.jsx)(import_core17.Menu.Divider,{}),logins.map(login=>login.profile.reference!==(0,import_core18.getReferenceString)(context.profile)&&(0,import_jsx_runtime10.jsx)(import_core17.Menu.Item,{onClick:()=>{medplum.setActiveLogin(login).then(()=>window.location.reload()).catch(console.log)},children:(0,import_jsx_runtime10.jsxs)(import_core17.Group,{children:[(0,import_jsx_runtime10.jsx)(import_core17.Avatar,{radius:"xl"}),(0,import_jsx_runtime10.jsxs)("div",{style:{flex:1},children:[(0,import_jsx_runtime10.jsx)(import_core17.Text,{size:"sm",fw:500,children:login.profile.display}),(0,import_jsx_runtime10.jsx)(import_core17.Text,{c:"dimmed",size:"xs",children:login.project.display})]})]})},login.profile.reference)),(0,import_jsx_runtime10.jsx)(import_core17.Menu.Divider,{}),(0,import_jsx_runtime10.jsx)(import_core17.Group,{justify:"center",children:(0,import_jsx_runtime10.jsx)(import_core17.SegmentedControl,{size:"xs",value:colorScheme,onChange:newValue=>setColorScheme(newValue),data:[{label:"Light",value:"light"},{label:"Dark",value:"dark"},{label:"Auto",value:"auto"}]})}),(0,import_jsx_runtime10.jsx)(import_core17.Menu.Divider,{}),(0,import_jsx_runtime10.jsx)(import_core17.Menu.Item,{leftSection:(0,import_jsx_runtime10.jsx)(IconSwitchHorizontal,{size:14,stroke:1.5}),onClick:()=>navigate("/signin"),children:"Add another account"}),(0,import_jsx_runtime10.jsx)(import_core17.Menu.Item,{leftSection:(0,import_jsx_runtime10.jsx)(IconSettings,{size:14,stroke:1.5}),onClick:()=>navigate(`/${(0,import_core18.getReferenceString)(profile)}`),children:"Account settings"}),(0,import_jsx_runtime10.jsx)(import_core17.Menu.Item,{leftSection:(0,import_jsx_runtime10.jsx)(IconLogout,{size:14,stroke:1.5}),onClick:async()=>{await medplum.signOut(),navigate("/signin")},children:"Sign out"}),(0,import_jsx_runtime10.jsx)(import_core17.Text,{size:"xs",c:"dimmed",ta:"center",children:props.version})]})}var import_core21=require("@mantine/core"),import_core22=require("@medplum/core");var import_react14=require("react");var import_core19=require("@mantine/core"),import_notifications=require("@mantine/notifications"),import_core20=require("@medplum/core"),import_react13=require("react");var AsyncAutocompleteTestIds={selectedItems:"selected-items",options:"options"};var import_jsx_runtime11=require("react/jsx-runtime");function AsyncAutocomplete(props){let combobox=(0,import_core19.useCombobox)({onDropdownClose:()=>combobox.resetSelectedOption(),onDropdownOpen:()=>combobox.updateSelectedOptionIndex("active")}),{name,label,description,error,defaultValue:defaultValue2,toOption:toOption4,loadOptions,itemComponent,pillComponent,emptyComponent,onChange,onCreate,creatable,clearable,required,placeholder,leftSection,maxValues,optionsDropdownMaxHeight=320,minInputLength=0,...rest}=props,disabled=rest.disabled,defaultItems=toDefaultItems(defaultValue2),[search,setSearch]=(0,import_react13.useState)(""),[timer,setTimer]=(0,import_react13.useState)(),[abortController,setAbortController]=(0,import_react13.useState)(),[autoSubmit,setAutoSubmit]=(0,import_react13.useState)(),[selected,setSelected]=(0,import_react13.useState)(defaultItems.map(toOption4)),[options,setOptions]=(0,import_react13.useState)([]),ItemComponent3=itemComponent??DefaultItemComponent,PillComponent=pillComponent??DefaultPillComponent,EmptyComponent=emptyComponent??DefaultEmptyComponent,searchRef=(0,import_react13.useRef)();searchRef.current=search;let lastLoadOptionsRef=(0,import_react13.useRef)(),lastValueRef=(0,import_react13.useRef)(),timerRef=(0,import_react13.useRef)();timerRef.current=timer;let abortControllerRef=(0,import_react13.useRef)();abortControllerRef.current=abortController;let autoSubmitRef=(0,import_react13.useRef)();autoSubmitRef.current=autoSubmit;let optionsRef=(0,import_react13.useRef)();optionsRef.current=options;let handleTimer=(0,import_react13.useCallback)(()=>{if(setTimer(void 0),searchRef.current===lastValueRef.current&&loadOptions===lastLoadOptionsRef.current||(searchRef.current?.length??0)<minInputLength)return;lastValueRef.current=searchRef.current,lastLoadOptionsRef.current=loadOptions;let newAbortController=new AbortController;setAbortController(newAbortController),loadOptions(searchRef.current??"",newAbortController.signal).then(newValues=>{newAbortController.signal.aborted||(setOptions(newValues.map(toOption4)),autoSubmitRef.current?(newValues.length>0&&onChange(newValues.slice(0,1)),setAutoSubmit(!1)):newValues.length>0&&combobox.openDropdown())}).catch(err=>{newAbortController.signal.aborted||err.message.includes("aborted")||(0,import_notifications.showNotification)({color:"red",message:(0,import_core20.normalizeErrorString)(err)})}).finally(()=>{newAbortController.signal.aborted||setAbortController(void 0)})},[combobox,loadOptions,onChange,toOption4,minInputLength]),handleSearchChange=(0,import_react13.useCallback)(e=>{(options&&options.length>0||creatable)&&combobox.openDropdown(),combobox.updateSelectedOptionIndex(),setSearch(e.currentTarget.value),abortControllerRef.current&&(abortControllerRef.current.abort(),setAbortController(void 0)),timerRef.current!==void 0&&window.clearTimeout(timerRef.current);let newTimer=window.setTimeout(()=>handleTimer(),100);setTimer(newTimer)},[combobox,options,creatable,handleTimer]),addSelected=(0,import_react13.useCallback)(newValue=>{let alreadySelected=selected.some(v2=>v2.value===newValue),newSelected=alreadySelected?selected.filter(v2=>v2.value!==newValue):[...selected],option=options?.find(option2=>option2.value===newValue);if(!option&&creatable!==!1&&onCreate){let createdResource=onCreate(newValue);option=toOption4(createdResource)}if(option){if(maxValues===0){onChange([option.resource]),selected.length>0&&setSelected([]);return}alreadySelected||newSelected.push(option)}if(maxValues!==void 0)for(;newSelected.length>maxValues;)newSelected.shift();onChange(newSelected.map(v2=>v2.resource)),setSelected(newSelected)},[creatable,options,selected,maxValues,onChange,onCreate,toOption4]),handleValueSelect=(0,import_react13.useMemo)(()=>{if(!disabled)return val=>{disabled||(maxValues===1&&(setSearch(""),setOptions([]),combobox.closeDropdown()),lastValueRef.current=void 0,addSelected(val==="$create"?search:val))}},[addSelected,combobox,disabled,maxValues,search]),handleValueRemove=(0,import_react13.useCallback)(item=>{let newSelected=selected.filter(v2=>v2.value!==item.value);onChange(newSelected.map(v2=>v2.resource)),setSelected(newSelected)},[selected,onChange]),handleKeyDown=(0,import_react13.useCallback)(e=>{e.key==="Enter"?(timer||abortController)&&setAutoSubmit(!0):e.key==="Backspace"&&search.length===0&&(killEvent(e),handleValueRemove(selected[selected.length-1]))},[abortController,handleValueRemove,search.length,selected,timer]);(0,import_react13.useEffect)(()=>()=>{abortControllerRef.current&&abortControllerRef.current.abort()},[]);let clearButton=!disabled&&clearable&&selected.length>0&&(0,import_jsx_runtime11.jsx)(import_core19.Combobox.ClearButton,{title:"Clear all",size:16,onClear:()=>{setSearch(""),setSelected([]),onChange([]),combobox.closeDropdown()}});return(0,import_jsx_runtime11.jsxs)(import_core19.Combobox,{store:combobox,onOptionSubmit:handleValueSelect,withinPortal:!0,shadow:"xl",...rest,children:[(0,import_jsx_runtime11.jsx)(import_core19.Combobox.DropdownTarget,{children:(0,import_jsx_runtime11.jsx)(import_core19.PillsInput,{label,description,error,className:props.className,leftSection,rightSection:abortController?(0,import_jsx_runtime11.jsx)(import_core19.Loader,{size:16}):clearButton,required,disabled,children:(0,import_jsx_runtime11.jsxs)(import_core19.Pill.Group,{"data-testid":AsyncAutocompleteTestIds.selectedItems,children:[selected.map(item=>(0,import_jsx_runtime11.jsx)(PillComponent,{item,disabled,onRemove:()=>handleValueRemove(item)},item.value)),!disabled&&(maxValues===void 0||maxValues===0||selected.length<maxValues)&&(0,import_jsx_runtime11.jsx)(import_core19.Combobox.EventsTarget,{children:(0,import_jsx_runtime11.jsx)(import_core19.PillsInput.Field,{role:"searchbox",name,value:search,placeholder,onFocus:handleSearchChange,onBlur:()=>{combobox.closeDropdown(),setSearch("")},onKeyDown:handleKeyDown,onChange:handleSearchChange})})]})})}),(0,import_jsx_runtime11.jsx)(import_core19.Combobox.Dropdown,{hidden:options.length===0,"data-testid":AsyncAutocompleteTestIds.options,children:(0,import_jsx_runtime11.jsx)(import_core19.Combobox.Options,{children:(0,import_jsx_runtime11.jsxs)(import_core19.ScrollAreaAutosize,{type:"scroll",mah:optionsDropdownMaxHeight,children:[options.map(item=>{let active=selected.some(v2=>v2.value===item.value);return(0,import_jsx_runtime11.jsx)(import_core19.Combobox.Option,{value:item.value,active,children:(0,import_jsx_runtime11.jsx)(ItemComponent3,{...item,active})},item.value)}),creatable&&search.trim().length>0&&(0,import_jsx_runtime11.jsxs)(import_core19.Combobox.Option,{value:"$create",children:["+ Create ",search]}),!creatable&&search.trim().length>0&&options.length===0&&(0,import_jsx_runtime11.jsx)(EmptyComponent,{search})]})})})]})}function toDefaultItems(defaultValue2){return defaultValue2?Array.isArray(defaultValue2)?defaultValue2:[defaultValue2]:[]}function DefaultItemComponent(props){return(0,import_jsx_runtime11.jsxs)(import_core19.Group,{gap:"xs",children:[props.active&&(0,import_jsx_runtime11.jsx)(IconCheck,{size:12}),(0,import_jsx_runtime11.jsx)("span",{children:props.label})]})}function DefaultPillComponent({item,disabled,onRemove}){return(0,import_jsx_runtime11.jsx)(import_core19.Pill,{withRemoveButton:!disabled,onRemove,children:item.label})}function DefaultEmptyComponent(){return(0,import_jsx_runtime11.jsx)(import_core19.Combobox.Empty,{children:"Nothing found"})}var HeaderSearchInput_default={searchInput:"HeaderSearchInput_searchInput"};var import_jsx_runtime12=require("react/jsx-runtime");function toOption(resource){return{value:resource.id,label:(0,import_core22.getDisplayString)(resource),resource}}function HeaderSearchInput(props){let navigate=se(),medplum=b(),loadData=(0,import_react14.useCallback)(async(input,signal)=>{let query=buildGraphQLQuery(input),options={signal},response=await medplum.graphql(query,void 0,void 0,options);return getResourcesFromResponse(response,input)},[medplum]),handleSelect=(0,import_react14.useCallback)(item=>{item.length>0&&navigate(`/${(0,import_core22.getReferenceString)(item[0])}`)},[navigate]);return(0,import_jsx_runtime12.jsx)(AsyncAutocomplete,{size:"sm",radius:"md",className:HeaderSearchInput_default.searchInput,leftSection:(0,import_jsx_runtime12.jsx)(IconSearch,{size:16}),placeholder:"Search",itemComponent:ItemComponent,toOption,onChange:handleSelect,loadOptions:loadData,maxValues:0,clearable:!1},`${props.pathname}?${props.searchParams}`)}var ItemComponent=(0,import_react14.forwardRef)(({resource,active:_active,...others},ref)=>{let helpText;return resource.resourceType==="Patient"?helpText=resource.birthDate:resource.resourceType==="ServiceRequest"&&(helpText=resource.subject?.display),(0,import_jsx_runtime12.jsx)("div",{ref,...others,children:(0,import_jsx_runtime12.jsxs)(import_core21.Group,{wrap:"nowrap",children:[(0,import_jsx_runtime12.jsx)(ResourceAvatar,{value:resource}),(0,import_jsx_runtime12.jsxs)("div",{children:[(0,import_jsx_runtime12.jsx)(import_core21.Text,{children:(0,import_core22.getDisplayString)(resource)}),(0,import_jsx_runtime12.jsx)(import_core21.Text,{size:"xs",c:"dimmed",children:helpText})]})]})})});function buildGraphQLQuery(input){let escaped=JSON.stringify(input);return(0,import_core22.isUUID)(input)?`{
1
+ "use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __commonJS=(cb,mod)=>function(){return mod||(0,cb[__getOwnPropNames(cb)[0]])((mod={exports:{}}).exports,mod),mod.exports};var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var require_pointer=__commonJS({"../../node_modules/rfc6902/pointer.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.Pointer=void 0;function unescape(token){return token.replace(/~1/g,"/").replace(/~0/g,"~")}function escape(token){return token.replace(/~/g,"~0").replace(/\//g,"~1")}var Pointer=function(){function Pointer2(tokens){tokens===void 0&&(tokens=[""]),this.tokens=tokens}return Pointer2.fromJSON=function(path){var tokens=path.split("/").map(unescape);if(tokens[0]!=="")throw new Error("Invalid JSON Pointer: ".concat(path));return new Pointer2(tokens)},Pointer2.prototype.toString=function(){return this.tokens.map(escape).join("/")},Pointer2.prototype.evaluate=function(object){for(var parent=null,key="",value=object,i=1,l=this.tokens.length;i<l;i++)parent=value,key=this.tokens[i],!(key=="__proto__"||key=="constructor"||key=="prototype")&&(value=(parent||{})[key]);return{parent,key,value}},Pointer2.prototype.get=function(object){return this.evaluate(object).value},Pointer2.prototype.set=function(object,value){var endpoint=this.evaluate(object);endpoint.parent&&(endpoint.parent[endpoint.key]=value)},Pointer2.prototype.push=function(token){this.tokens.push(token)},Pointer2.prototype.add=function(token){var tokens=this.tokens.concat(String(token));return new Pointer2(tokens)},Pointer2}();exports.Pointer=Pointer}});var require_util=__commonJS({"../../node_modules/rfc6902/util.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.clone=exports.objectType=exports.hasOwnProperty=void 0;exports.hasOwnProperty=Object.prototype.hasOwnProperty;function objectType(object){return object===void 0?"undefined":object===null?"null":Array.isArray(object)?"array":typeof object}exports.objectType=objectType;function isNonPrimitive(value){return value!=null&&typeof value=="object"}function clone(source){if(!isNonPrimitive(source))return source;if(source.constructor==Array){for(var length_1=source.length,arrayTarget=new Array(length_1),i=0;i<length_1;i++)arrayTarget[i]=clone(source[i]);return arrayTarget}if(source.constructor==Date){var dateTarget=new Date(+source);return dateTarget}var objectTarget={};for(var key in source)exports.hasOwnProperty.call(source,key)&&(objectTarget[key]=clone(source[key]));return objectTarget}exports.clone=clone}});var require_diff=__commonJS({"../../node_modules/rfc6902/diff.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.diffAny=exports.diffObjects=exports.diffArrays=exports.intersection=exports.subtract=exports.isDestructive=void 0;var util_1=require_util();function isDestructive(_a){var op=_a.op;return op==="remove"||op==="replace"||op==="copy"||op==="move"}exports.isDestructive=isDestructive;function subtract(minuend,subtrahend){var obj={};for(var add_key in minuend)util_1.hasOwnProperty.call(minuend,add_key)&&minuend[add_key]!==void 0&&(obj[add_key]=1);for(var del_key in subtrahend)util_1.hasOwnProperty.call(subtrahend,del_key)&&subtrahend[del_key]!==void 0&&delete obj[del_key];return Object.keys(obj)}exports.subtract=subtract;function intersection(objects){for(var length=objects.length,counter={},i=0;i<length;i++){var object=objects[i];for(var key in object)util_1.hasOwnProperty.call(object,key)&&object[key]!==void 0&&(counter[key]=(counter[key]||0)+1)}for(var key in counter)counter[key]<length&&delete counter[key];return Object.keys(counter)}exports.intersection=intersection;function isArrayAdd(array_operation){return array_operation.op==="add"}function isArrayRemove(array_operation){return array_operation.op==="remove"}function appendArrayOperation(base,operation){return{operations:base.operations.concat(operation),cost:base.cost+1}}function diffArrays(input,output,ptr,diff2){diff2===void 0&&(diff2=diffAny);var memo2={"0,0":{operations:[],cost:0}};function dist(i,j2){var memo_key="".concat(i,",").concat(j2),memoized=memo2[memo_key];if(memoized===void 0){if(i>0&&j2>0&&!diff2(input[i-1],output[j2-1],ptr.add(String(i-1))).length)memoized=dist(i-1,j2-1);else{var alternatives=[];if(i>0){var remove_base=dist(i-1,j2),remove_operation={op:"remove",index:i-1};alternatives.push(appendArrayOperation(remove_base,remove_operation))}if(j2>0){var add_base=dist(i,j2-1),add_operation={op:"add",index:i-1,value:output[j2-1]};alternatives.push(appendArrayOperation(add_base,add_operation))}if(i>0&&j2>0){var replace_base=dist(i-1,j2-1),replace_operation={op:"replace",index:i-1,original:input[i-1],value:output[j2-1]};alternatives.push(appendArrayOperation(replace_base,replace_operation))}var best=alternatives.sort(function(a,b2){return a.cost-b2.cost})[0];memoized=best}memo2[memo_key]=memoized}return memoized}var input_length=isNaN(input.length)||input.length<=0?0:input.length,output_length=isNaN(output.length)||output.length<=0?0:output.length,array_operations=dist(input_length,output_length).operations,padded_operations=array_operations.reduce(function(_a,array_operation){var operations=_a[0],padding=_a[1];if(isArrayAdd(array_operation)){var padded_index=array_operation.index+1+padding,index_token=padded_index<input_length+padding?String(padded_index):"-",operation={op:array_operation.op,path:ptr.add(index_token).toString(),value:array_operation.value};return[operations.concat(operation),padding+1]}else if(isArrayRemove(array_operation)){var operation={op:array_operation.op,path:ptr.add(String(array_operation.index+padding)).toString()};return[operations.concat(operation),padding-1]}else{var replace_ptr=ptr.add(String(array_operation.index+padding)),replace_operations=diff2(array_operation.original,array_operation.value,replace_ptr);return[operations.concat.apply(operations,replace_operations),padding]}},[[],0])[0];return padded_operations}exports.diffArrays=diffArrays;function diffObjects(input,output,ptr,diff2){diff2===void 0&&(diff2=diffAny);var operations=[];return subtract(input,output).forEach(function(key){operations.push({op:"remove",path:ptr.add(key).toString()})}),subtract(output,input).forEach(function(key){operations.push({op:"add",path:ptr.add(key).toString(),value:output[key]})}),intersection([input,output]).forEach(function(key){operations.push.apply(operations,diff2(input[key],output[key],ptr.add(key)))}),operations}exports.diffObjects=diffObjects;function diffAny(input,output,ptr,diff2){if(diff2===void 0&&(diff2=diffAny),input===output)return[];var input_type=(0,util_1.objectType)(input),output_type=(0,util_1.objectType)(output);return input_type=="array"&&output_type=="array"?diffArrays(input,output,ptr,diff2):input_type=="object"&&output_type=="object"?diffObjects(input,output,ptr,diff2):[{op:"replace",path:ptr.toString(),value:output}]}exports.diffAny=diffAny}});var require_patch=__commonJS({"../../node_modules/rfc6902/patch.js"(exports){"use strict";var __extends=exports&&exports.__extends||function(){var extendStatics=function(d,b2){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d2,b3){d2.__proto__=b3}||function(d2,b3){for(var p2 in b3)Object.prototype.hasOwnProperty.call(b3,p2)&&(d2[p2]=b3[p2])},extendStatics(d,b2)};return function(d,b2){if(typeof b2!="function"&&b2!==null)throw new TypeError("Class extends value "+String(b2)+" is not a constructor or null");extendStatics(d,b2);function __(){this.constructor=d}d.prototype=b2===null?Object.create(b2):(__.prototype=b2.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:!0});exports.apply=exports.InvalidOperationError=exports.test=exports.copy=exports.move=exports.replace=exports.remove=exports.add=exports.TestError=exports.MissingError=void 0;var pointer_1=require_pointer(),util_1=require_util(),diff_1=require_diff(),MissingError=function(_super){__extends(MissingError2,_super);function MissingError2(path){var _this=_super.call(this,"Value required at path: ".concat(path))||this;return _this.path=path,_this.name="MissingError",_this}return MissingError2}(Error);exports.MissingError=MissingError;var TestError=function(_super){__extends(TestError2,_super);function TestError2(actual,expected){var _this=_super.call(this,"Test failed: ".concat(actual," != ").concat(expected))||this;return _this.actual=actual,_this.expected=expected,_this.name="TestError",_this}return TestError2}(Error);exports.TestError=TestError;function _add(object,key,value){if(Array.isArray(object))if(key=="-")object.push(value);else{var index=parseInt(key,10);object.splice(index,0,value)}else object[key]=value}function _remove(object,key){if(Array.isArray(object)){var index=parseInt(key,10);object.splice(index,1)}else delete object[key]}function add(object,operation){var endpoint=pointer_1.Pointer.fromJSON(operation.path).evaluate(object);return endpoint.parent===void 0?new MissingError(operation.path):(_add(endpoint.parent,endpoint.key,(0,util_1.clone)(operation.value)),null)}exports.add=add;function remove(object,operation){var endpoint=pointer_1.Pointer.fromJSON(operation.path).evaluate(object);return endpoint.value===void 0?new MissingError(operation.path):(_remove(endpoint.parent,endpoint.key),null)}exports.remove=remove;function replace(object,operation){var endpoint=pointer_1.Pointer.fromJSON(operation.path).evaluate(object);if(endpoint.parent===null)return new MissingError(operation.path);if(Array.isArray(endpoint.parent)){if(parseInt(endpoint.key,10)>=endpoint.parent.length)return new MissingError(operation.path)}else if(endpoint.value===void 0)return new MissingError(operation.path);return endpoint.parent[endpoint.key]=(0,util_1.clone)(operation.value),null}exports.replace=replace;function move(object,operation){var from_endpoint=pointer_1.Pointer.fromJSON(operation.from).evaluate(object);if(from_endpoint.value===void 0)return new MissingError(operation.from);var endpoint=pointer_1.Pointer.fromJSON(operation.path).evaluate(object);return endpoint.parent===void 0?new MissingError(operation.path):(_remove(from_endpoint.parent,from_endpoint.key),_add(endpoint.parent,endpoint.key,from_endpoint.value),null)}exports.move=move;function copy(object,operation){var from_endpoint=pointer_1.Pointer.fromJSON(operation.from).evaluate(object);if(from_endpoint.value===void 0)return new MissingError(operation.from);var endpoint=pointer_1.Pointer.fromJSON(operation.path).evaluate(object);return endpoint.parent===void 0?new MissingError(operation.path):(_add(endpoint.parent,endpoint.key,(0,util_1.clone)(from_endpoint.value)),null)}exports.copy=copy;function test(object,operation){var endpoint=pointer_1.Pointer.fromJSON(operation.path).evaluate(object);return(0,diff_1.diffAny)(endpoint.value,operation.value,new pointer_1.Pointer).length?new TestError(endpoint.value,operation.value):null}exports.test=test;var InvalidOperationError=function(_super){__extends(InvalidOperationError2,_super);function InvalidOperationError2(operation){var _this=_super.call(this,"Invalid operation: ".concat(operation.op))||this;return _this.operation=operation,_this.name="InvalidOperationError",_this}return InvalidOperationError2}(Error);exports.InvalidOperationError=InvalidOperationError;function apply(object,operation){switch(operation.op){case"add":return add(object,operation);case"remove":return remove(object,operation);case"replace":return replace(object,operation);case"move":return move(object,operation);case"copy":return copy(object,operation);case"test":return test(object,operation)}return new InvalidOperationError(operation)}exports.apply=apply}});var require_rfc6902=__commonJS({"../../node_modules/rfc6902/index.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.createTests=exports.createPatch=exports.applyPatch=exports.Pointer=void 0;var pointer_1=require_pointer();Object.defineProperty(exports,"Pointer",{enumerable:!0,get:function(){return pointer_1.Pointer}});var patch_1=require_patch(),diff_1=require_diff();function applyPatch(object,patch){return patch.map(function(operation){return(0,patch_1.apply)(object,operation)})}exports.applyPatch=applyPatch;function wrapVoidableDiff(diff2){function wrappedDiff(input,output,ptr){var custom_patch=diff2(input,output,ptr);return Array.isArray(custom_patch)?custom_patch:(0,diff_1.diffAny)(input,output,ptr,wrappedDiff)}return wrappedDiff}function createPatch2(input,output,diff2){var ptr=new pointer_1.Pointer;return(diff2?wrapVoidableDiff(diff2):diff_1.diffAny)(input,output,ptr)}exports.createPatch=createPatch2;function createTest(input,path){var endpoint=pointer_1.Pointer.fromJSON(path).evaluate(input);if(endpoint!==void 0)return{op:"test",path,value:endpoint.value}}function createTests(input,patch){var tests=new Array;return patch.filter(diff_1.isDestructive).forEach(function(operation){var pathTest=createTest(input,operation.path);if(pathTest&&tests.push(pathTest),"from"in operation){var fromTest=createTest(input,operation.from);fromTest&&tests.push(fromTest)}}),tests}exports.createTests=createTests}});var src_exports={};__export(src_exports,{AddressDisplay:()=>AddressDisplay,AddressInput:()=>AddressInput,AnnotationInput:()=>AnnotationInput,AppShell:()=>AppShell,AsyncAutocomplete:()=>AsyncAutocomplete,AttachmentArrayDisplay:()=>AttachmentArrayDisplay,AttachmentArrayInput:()=>AttachmentArrayInput,AttachmentButton:()=>AttachmentButton,AttachmentDisplay:()=>AttachmentDisplay,AttachmentInput:()=>AttachmentInput,BackboneElementDisplay:()=>BackboneElementDisplay,BackboneElementInput:()=>BackboneElementInput,BaseChat:()=>BaseChat,CalendarInput:()=>CalendarInput,ChatModal:()=>ChatModal,CheckboxFormSection:()=>CheckboxFormSection,CodeInput:()=>CodeInput,CodeableConceptDisplay:()=>CodeableConceptDisplay,CodeableConceptInput:()=>CodeableConceptInput,CodingDisplay:()=>CodingDisplay,CodingInput:()=>CodingInput,ContactDetailDisplay:()=>ContactDetailDisplay,ContactDetailInput:()=>ContactDetailInput,ContactPointDisplay:()=>ContactPointDisplay,ContactPointInput:()=>ContactPointInput,Container:()=>Container,DateTimeInput:()=>DateTimeInput,DefaultResourceTimeline:()=>DefaultResourceTimeline,DescriptionList:()=>DescriptionList,DescriptionListEntry:()=>DescriptionListEntry,DiagnosticReportDisplay:()=>DiagnosticReportDisplay,Document:()=>Document,ElementDefinitionInputSelector:()=>ElementDefinitionInputSelector,ElementDefinitionTypeInput:()=>ElementDefinitionTypeInput,EncounterTimeline:()=>EncounterTimeline,ErrorBoundary:()=>ErrorBoundary,FhirPathTable:()=>FhirPathTable,Form:()=>Form,FormSection:()=>FormSection,Header:()=>Header,HumanNameDisplay:()=>HumanNameDisplay,HumanNameInput:()=>HumanNameInput,IdentifierDisplay:()=>IdentifierDisplay,IdentifierInput:()=>IdentifierInput,Loading:()=>Loading,Logo:()=>Logo,MeasureReportDisplay:()=>MeasureReportDisplay,MedplumLink:()=>MedplumLink,MedplumProvider:()=>me,MemoizedFhirPathTable:()=>MemoizedFhirPathTable,MemoizedSearchControl:()=>MemoizedSearchControl,MoneyDisplay:()=>MoneyDisplay,MoneyInput:()=>MoneyInput,Navbar:()=>Navbar,NoteDisplay:()=>NoteDisplay,NotificationIcon:()=>NotificationIcon,ObservationTable:()=>ObservationTable,OperationOutcomeAlert:()=>OperationOutcomeAlert,Panel:()=>Panel,PatientSummary:()=>PatientSummary,PatientTimeline:()=>PatientTimeline,PlanDefinitionBuilder:()=>PlanDefinitionBuilder,QuantityDisplay:()=>QuantityDisplay,QuantityInput:()=>QuantityInput,QuestionnaireBuilder:()=>QuestionnaireBuilder,QuestionnaireForm:()=>QuestionnaireForm,QuestionnaireFormContext:()=>QuestionnaireFormContext,QuestionnaireItemType:()=>QuestionnaireItemType,RangeDisplay:()=>RangeDisplay,RangeInput:()=>RangeInput,RatioInput:()=>RatioInput,ReferenceDisplay:()=>ReferenceDisplay,ReferenceInput:()=>ReferenceInput,ReferenceRangeEditor:()=>ReferenceRangeEditor,ReferenceRangeGroupEditor:()=>ReferenceRangeGroupEditor,RegisterForm:()=>RegisterForm,RequestGroupDisplay:()=>RequestGroupDisplay,ResourceArrayDisplay:()=>ResourceArrayDisplay,ResourceArrayInput:()=>ResourceArrayInput,ResourceAvatar:()=>ResourceAvatar,ResourceBadge:()=>ResourceBadge,ResourceBlame:()=>ResourceBlame,ResourceDiff:()=>ResourceDiff,ResourceForm:()=>ResourceForm,ResourceHistoryTable:()=>ResourceHistoryTable,ResourceInput:()=>ResourceInput,ResourceName:()=>ResourceName,ResourcePropertyDisplay:()=>ResourcePropertyDisplay,ResourcePropertyInput:()=>ResourcePropertyInput,ResourceTable:()=>ResourceTable,ResourceTimeline:()=>ResourceTimeline,Scheduler:()=>Scheduler,SearchChangeEvent:()=>SearchChangeEvent,SearchClickEvent:()=>SearchClickEvent,SearchControl:()=>SearchControl,SearchFieldEditor:()=>SearchFieldEditor,SearchFilterEditor:()=>SearchFilterEditor,SearchLoadEvent:()=>SearchLoadEvent,ServiceRequestTimeline:()=>ServiceRequestTimeline,SignInForm:()=>SignInForm,SmartAppLaunchLink:()=>SmartAppLaunchLink,StatusBadge:()=>StatusBadge,ThreadChat:()=>ThreadChat,Timeline:()=>Timeline,TimelineItem:()=>TimelineItem,TimingInput:()=>TimingInput,ValueSetAutocomplete:()=>ValueSetAutocomplete,addDateFilterBetween:()=>addDateFilterBetween,addField:()=>addField,addFilter:()=>addFilter,addLastMonthFilter:()=>addLastMonthFilter,addMissingFilter:()=>addMissingFilter,addNextMonthFilter:()=>addNextMonthFilter,addThisMonthFilter:()=>addThisMonthFilter,addTodayFilter:()=>addTodayFilter,addTomorrowFilter:()=>addTomorrowFilter,addYearToDateFilter:()=>addYearToDateFilter,addYesterdayFilter:()=>addYesterdayFilter,buildFieldNameString:()=>buildFieldNameString,buildInitialResponse:()=>buildInitialResponse,buildInitialResponseItem:()=>buildInitialResponseItem,clearFilters:()=>clearFilters,clearFiltersOnField:()=>clearFiltersOnField,convertIsoToLocal:()=>convertIsoToLocal,convertLocalToIso:()=>convertLocalToIso,createScriptTag:()=>createScriptTag,deleteFilter:()=>deleteFilter,formatReferenceString:()=>formatReferenceString,getErrorsForInput:()=>getErrorsForInput,getFieldDefinitions:()=>getFieldDefinitions,getIssuesForExpression:()=>getIssuesForExpression,getNewMultiSelectValues:()=>getNewMultiSelectValues,getNumberOfPages:()=>getNumberOfPages,getOpString:()=>getOpString,getQuestionnaireItemReferenceFilter:()=>getQuestionnaireItemReferenceFilter,getQuestionnaireItemReferenceTargetTypes:()=>getQuestionnaireItemReferenceTargetTypes,getRecaptcha:()=>getRecaptcha,getSearchOperators:()=>getSearchOperators,getSortField:()=>getSortField,getValuePath:()=>getValuePath,initRecaptcha:()=>initRecaptcha,isChoiceQuestion:()=>isChoiceQuestion,isQuestionEnabled:()=>isQuestionEnabled,isSortDescending:()=>isSortDescending,isSupportedProfileStructureDefinition:()=>isSupportedProfileStructureDefinition,parseForm:()=>parseForm,reactContext:()=>O,renderValue:()=>renderValue,setFilters:()=>setFilters,setOffset:()=>setOffset,setPage:()=>setPage,setPropertyValue:()=>setPropertyValue,setQuestionnaireItemReferenceTargetTypes:()=>setQuestionnaireItemReferenceTargetTypes,setSort:()=>setSort,sortByDateAndPriority:()=>sortByDateAndPriority,toggleSort:()=>toggleSort,useCachedBinaryUrl:()=>Se,useMedplum:()=>b,useMedplumContext:()=>T,useMedplumNavigate:()=>se,useMedplumProfile:()=>ue,usePrevious:()=>xe,useResource:()=>Te,useSearch:()=>Ne,useSearchOne:()=>Ue,useSearchResources:()=>We,useSubscription:()=>Qe});module.exports=__toCommonJS(src_exports);var import_react=require("react"),import_react2=require("react"),import_jsx_runtime=require("react/jsx-runtime"),import_react3=require("react"),import_react4=require("react"),import_core=require("@medplum/core"),import_react5=require("react"),import_core2=require("@medplum/core"),import_react6=require("react"),import_core3=require("@medplum/core"),import_react7=require("react"),O=(0,import_react2.createContext)(void 0);function T(){return(0,import_react2.useContext)(O)}function b(){return T().medplum}function se(){return T().navigate}function ue(){return T().profile}var N=["change","storageInitialized","storageInitFailed","profileRefreshing","profileRefreshed"];function me(e){let n=e.medplum,t=e.navigate??V,[i,r2]=(0,import_react.useState)({profile:n.getProfile(),loading:n.isLoading()});(0,import_react.useEffect)(()=>{function o(){r2(u=>({...u,profile:n.getProfile(),loading:n.isLoading()}))}for(let u of N)n.addEventListener(u,o);return()=>{for(let u of N)n.removeEventListener(u,o)}},[n]);let s=(0,import_react.useMemo)(()=>({...i,medplum:n,navigate:t}),[i,n,t]);return(0,import_jsx_runtime.jsx)(O.Provider,{value:s,children:e.children})}function V(e){window.location.assign(e)}var U=new Map,Se=e=>(0,import_react3.useMemo)(()=>{if(!e)return;let n=e.split("?")[0];if(!n)return e;let t;try{t=new URLSearchParams(new URL(e).search)}catch{return e}if(!t.has("Key-Pair-Id")||!t.has("Signature"))return e;let i=t.get("Expires");if(!i||i.length>13)return e;let r2=U.get(n);if(r2){let o=new URLSearchParams(new URL(r2).search).get("Expires");if(o&&parseInt(o,10)*1e3-5e3>Date.now())return r2}return U.set(n,e),e},[e]);function xe(e){let n=(0,import_react4.useRef)();return(0,import_react4.useEffect)(()=>{n.current=e}),n.current}function Te(e,n){let t=b(),[i,r2]=(0,import_react5.useState)(()=>W(t,e)),s=(0,import_react5.useCallback)(o=>{(0,import_core.deepEquals)(o,i)||r2(o)},[i]);return(0,import_react5.useEffect)(()=>{let o=!0,u=W(t,e);return!u&&(0,import_core.isReference)(e)?t.readReference(e).then(d=>{o&&s(d)}).catch(d=>{o&&(s(void 0),n&&n((0,import_core.normalizeOperationOutcome)(d)))}):s(u),()=>o=!1},[t,e,s,n]),i}function W(e,n){if(n){if((0,import_core.isResource)(n))return n;if((0,import_core.isReference)(n))return e.getCachedReference(n)}}function Ne(e,n){return P("search",e,n)}function Ue(e,n){return P("searchOne",e,n)}function We(e,n){return P("searchResources",e,n)}function P(e,n,t){let i=b(),[r2,s]=(0,import_react6.useState)(),[o,u]=(0,import_react6.useState)(!0),[d,a]=(0,import_react6.useState)(),[f,m]=(0,import_react6.useState)();return(0,import_react6.useEffect)(()=>{let S=i.fhirSearchUrl(n,t).toString();S!==r2&&(s(S),i[e](n,t).then(l=>{u(!1),a(l),m(import_core2.allOk)}).catch(l=>{u(!1),a(void 0),m((0,import_core2.normalizeOperationOutcome)(l))}))},[i,e,n,t,r2]),[d,o,f]}var oe=3e3;function Qe(e,n,t){let i=b(),[r2,s]=(0,import_react7.useState)(),[o,u]=(0,import_react7.useState)(t?.subscriptionProps),d=(0,import_react7.useRef)(!1),a=(0,import_react7.useRef)(),f=(0,import_react7.useRef)(),m=(0,import_react7.useRef)(),S=(0,import_react7.useRef)();S.current=n;let l=(0,import_react7.useRef)();l.current=t?.onWebSocketOpen;let L=(0,import_react7.useRef)();L.current=t?.onWebSocketClose;let K=(0,import_react7.useRef)();K.current=t?.onSubscriptionConnect;let k=(0,import_react7.useRef)();k.current=t?.onSubscriptionDisconnect;let I=(0,import_react7.useRef)();I.current=t?.onError,(0,import_react7.useEffect)(()=>{(0,import_core3.deepEquals)(t?.subscriptionProps,o)||u(t?.subscriptionProps)},[o,t]),(0,import_react7.useEffect)(()=>{a.current&&(clearTimeout(a.current),a.current=void 0);let c=!1;return(f.current!==e||!(0,import_core3.deepEquals)(m.current,o))&&(c=!0),c&&f.current&&i.unsubscribeFromCriteria(f.current,m.current),f.current=e,m.current=o,c&&e?s(i.subscribeToCriteria(e,o)):e||s(void 0),()=>{a.current=setTimeout(()=>{s(void 0),e&&i.unsubscribeFromCriteria(e,o)},oe)}},[i,e,o]);let E=(0,import_react7.useCallback)(c=>{S.current?.(c.payload)},[]),x=(0,import_react7.useCallback)(()=>{l.current?.()},[]),g=(0,import_react7.useCallback)(()=>{L.current?.()},[]),C=(0,import_react7.useCallback)(c=>{K.current?.(c.payload.subscriptionId)},[]),h=(0,import_react7.useCallback)(c=>{k.current?.(c.payload.subscriptionId)},[]),M=(0,import_react7.useCallback)(c=>{I.current?.(c.payload)},[]);(0,import_react7.useEffect)(()=>r2?(d.current||(r2.addEventListener("message",E),r2.addEventListener("open",x),r2.addEventListener("close",g),r2.addEventListener("connect",C),r2.addEventListener("disconnect",h),r2.addEventListener("error",M),d.current=!0),()=>{d.current=!1,r2.removeEventListener("message",E),r2.removeEventListener("open",x),r2.removeEventListener("close",g),r2.removeEventListener("connect",C),r2.removeEventListener("disconnect",h),r2.removeEventListener("error",M)}):()=>{},[r2,E,x,g,C,h,M])}var import_core4=require("@medplum/core"),import_jsx_runtime2=require("react/jsx-runtime");function AddressDisplay(props){let address=props.value;return address?(0,import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment,{children:(0,import_core4.formatAddress)(address)}):null}var import_core6=require("@mantine/core"),import_react9=require("react");var import_core5=require("@medplum/core"),import_react8=require("react");var DEFAULT_IGNORED_PROPERTIES=["meta","implicitRules","contained","extension","modifierExtension"],DEFAULT_IGNORED_NON_NESTED_PROPERTIES=["language","text"];var ElementsContext=(0,import_react8.createContext)({path:"",profileUrl:void 0,elements:Object.create(null),elementsByPath:Object.create(null),getExtendedProps:()=>({readonly:!1,hidden:!1}),accessPolicyResource:void 0,debugMode:!1,isDefaultContext:!0});ElementsContext.displayName="ElementsContext";var EXTENSION_KEYS=["extension","modifierExtension"],IGNORED_PROPERTIES=["id",...DEFAULT_IGNORED_PROPERTIES].filter(prop=>!EXTENSION_KEYS.includes(prop));function getElementsToRender(inputElements){return Object.entries(inputElements).filter(([key,element])=>!(0,import_core5.isPopulated)(element.type)||element.max===0||element.path.toLowerCase().endsWith("extension.url")&&element.fixed||EXTENSION_KEYS.includes(key)&&!(0,import_core5.isPopulated)(element.slicing?.slices)||IGNORED_PROPERTIES.includes(key)?!1:!(DEFAULT_IGNORED_NON_NESTED_PROPERTIES.includes(key)&&element.path.split(".").length===2||key.includes(".")))}var import_jsx_runtime3=require("react/jsx-runtime");function getLine(address,index){return address.line&&address.line.length>index?address.line[index]:""}function setLine(address,index,str){let line=address.line||[];for(;line.length<=index;)line.push("");return line[index]=str,{...address,line}}function AddressInput(props){let[value,setValue]=(0,import_react9.useState)(props.defaultValue||{}),valueRef=(0,import_react9.useRef)();valueRef.current=value;let{getExtendedProps}=(0,import_react9.useContext)(ElementsContext),[useProps,typeProps,line1Props,line2Props,cityProps,stateProps,postalCodeProps]=(0,import_react9.useMemo)(()=>["use","type","line1","line2","city","state","postalCode"].map(field=>getExtendedProps(props.path+"."+field)),[getExtendedProps,props.path]);function setValueWrapper(newValue){setValue(newValue),props.onChange&&props.onChange(newValue)}function setUse(use){setValueWrapper({...valueRef.current,use})}function setType(type){setValueWrapper({...valueRef.current,type})}function setLine1(line1){setValueWrapper(setLine(valueRef.current||{},0,line1))}function setLine2(line2){setValueWrapper(setLine(valueRef.current||{},1,line2))}function setCity(city){setValueWrapper({...valueRef.current,city})}function setState(state){setValueWrapper({...valueRef.current,state})}function setPostalCode(postalCode){setValueWrapper({...valueRef.current,postalCode})}return(0,import_jsx_runtime3.jsxs)(import_core6.Group,{gap:"xs",wrap:"nowrap",grow:!0,children:[(0,import_jsx_runtime3.jsx)(import_core6.NativeSelect,{disabled:props.disabled||useProps?.readonly,"data-testid":"address-use",defaultValue:value.use,onChange:e=>setUse(e.currentTarget.value),data:["","home","work","temp","old","billing"]}),(0,import_jsx_runtime3.jsx)(import_core6.NativeSelect,{disabled:props.disabled||typeProps?.readonly,"data-testid":"address-type",defaultValue:value.type,onChange:e=>setType(e.currentTarget.value),data:["","postal","physical","both"]}),(0,import_jsx_runtime3.jsx)(import_core6.TextInput,{disabled:props.disabled||line1Props?.readonly,placeholder:"Line 1",defaultValue:getLine(value,0),onChange:e=>setLine1(e.currentTarget.value)}),(0,import_jsx_runtime3.jsx)(import_core6.TextInput,{disabled:props.disabled||line2Props?.readonly,placeholder:"Line 2",defaultValue:getLine(value,1),onChange:e=>setLine2(e.currentTarget.value)}),(0,import_jsx_runtime3.jsx)(import_core6.TextInput,{disabled:props.disabled||cityProps?.readonly,placeholder:"City",defaultValue:value.city,onChange:e=>setCity(e.currentTarget.value)}),(0,import_jsx_runtime3.jsx)(import_core6.TextInput,{disabled:props.disabled||stateProps?.readonly,placeholder:"State",defaultValue:value.state,onChange:e=>setState(e.currentTarget.value)}),(0,import_jsx_runtime3.jsx)(import_core6.TextInput,{disabled:props.disabled||postalCodeProps?.readonly,placeholder:"Postal Code",defaultValue:value.postalCode,onChange:e=>setPostalCode(e.currentTarget.value)})]})}var import_core7=require("@mantine/core"),import_core8=require("@medplum/core");var import_react10=require("react"),import_jsx_runtime4=require("react/jsx-runtime");function AnnotationInput(props){let author=ue(),[value,setValue]=(0,import_react10.useState)(props.defaultValue||{});function setText(text){let newValue=text?{text,authorReference:author&&(0,import_core8.createReference)(author),time:new Date().toISOString()}:{};setValue(newValue),props.onChange&&props.onChange(newValue)}return(0,import_jsx_runtime4.jsx)(import_core7.TextInput,{disabled:props.disabled,name:props.name,placeholder:"Annotation text",defaultValue:value.text,onChange:e=>setText(e.currentTarget.value)})}var import_core29=require("@mantine/core"),import_notifications3=require("@mantine/notifications");var import_react20=require("react");var import_core9=require("@mantine/core"),import_core10=require("@medplum/core");var import_react11=require("react");var defaultAttributes={outline:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},filled:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",stroke:"none"}};var createReactComponent=(type,iconName,iconNamePascal,iconNode)=>{let Component2=(0,import_react11.forwardRef)(({color="currentColor",size=24,stroke=2,title,className,children,...rest},ref)=>(0,import_react11.createElement)("svg",{ref,...defaultAttributes[type],width:size,height:size,className:["tabler-icon",`tabler-icon-${iconName}`,className].join(" "),...type==="filled"?{fill:color}:{strokeWidth:stroke,stroke:color},...rest},[title&&(0,import_react11.createElement)("title",{key:"svg-title"},title),...iconNode.map(([tag,attrs])=>(0,import_react11.createElement)(tag,attrs)),...Array.isArray(children)?children:[children]]));return Component2.displayName=`${iconNamePascal}`,Component2};var IconAdjustmentsHorizontal=createReactComponent("outline","adjustments-horizontal","IconAdjustmentsHorizontal",[["path",{d:"M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M4 6l8 0",key:"svg-1"}],["path",{d:"M16 6l4 0",key:"svg-2"}],["path",{d:"M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-3"}],["path",{d:"M4 12l2 0",key:"svg-4"}],["path",{d:"M10 12l10 0",key:"svg-5"}],["path",{d:"M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-6"}],["path",{d:"M4 18l11 0",key:"svg-7"}],["path",{d:"M19 18l1 0",key:"svg-8"}]]);var IconAlertCircle=createReactComponent("outline","alert-circle","IconAlertCircle",[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M12 8v4",key:"svg-1"}],["path",{d:"M12 16h.01",key:"svg-2"}]]);var IconArrowDown=createReactComponent("outline","arrow-down","IconArrowDown",[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M18 13l-6 6",key:"svg-1"}],["path",{d:"M6 13l6 6",key:"svg-2"}]]);var IconArrowRight=createReactComponent("outline","arrow-right","IconArrowRight",[["path",{d:"M5 12l14 0",key:"svg-0"}],["path",{d:"M13 18l6 -6",key:"svg-1"}],["path",{d:"M13 6l6 6",key:"svg-2"}]]);var IconArrowUp=createReactComponent("outline","arrow-up","IconArrowUp",[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M18 11l-6 -6",key:"svg-1"}],["path",{d:"M6 11l6 -6",key:"svg-2"}]]);var IconBleachOff=createReactComponent("outline","bleach-off","IconBleachOff",[["path",{d:"M5 19h14m1.986 -1.977a2 2 0 0 0 -.146 -.773l-7.1 -12.25a2 2 0 0 0 -3.5 0l-.815 1.405m-1.488 2.568l-4.797 8.277a2 2 0 0 0 1.75 2.75",key:"svg-0"}],["path",{d:"M3 3l18 18",key:"svg-1"}]]);var IconBleach=createReactComponent("outline","bleach","IconBleach",[["path",{d:"M5 19h14a2 2 0 0 0 1.84 -2.75l-7.1 -12.25a2 2 0 0 0 -3.5 0l-7.1 12.25a2 2 0 0 0 1.75 2.75",key:"svg-0"}]]);var IconBoxMultiple=createReactComponent("outline","box-multiple","IconBoxMultiple",[["path",{d:"M7 3m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z",key:"svg-0"}],["path",{d:"M17 17v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2h2",key:"svg-1"}]]);var IconBracketsContain=createReactComponent("outline","brackets-contain","IconBracketsContain",[["path",{d:"M7 4h-4v16h4",key:"svg-0"}],["path",{d:"M17 4h4v16h-4",key:"svg-1"}],["path",{d:"M8 16h.01",key:"svg-2"}],["path",{d:"M12 16h.01",key:"svg-3"}],["path",{d:"M16 16h.01",key:"svg-4"}]]);var IconBucketOff=createReactComponent("outline","bucket-off","IconBucketOff",[["path",{d:"M5.029 5.036c-.655 .58 -1.029 1.25 -1.029 1.964c0 2.033 3.033 3.712 6.96 3.967m3.788 -.21c3.064 -.559 5.252 -2.029 5.252 -3.757c0 -2.21 -3.582 -4 -8 -4c-1.605 0 -3.1 .236 -4.352 .643",key:"svg-0"}],["path",{d:"M4 7c0 .664 .088 1.324 .263 1.965l2.737 10.035c.5 1.5 2.239 2 5 2s4.5 -.5 5 -2c.1 -.3 .252 -.812 .457 -1.535m.862 -3.146c.262 -.975 .735 -2.76 1.418 -5.354a7.45 7.45 0 0 0 .263 -1.965",key:"svg-1"}],["path",{d:"M3 3l18 18",key:"svg-2"}]]);var IconBucket=createReactComponent("outline","bucket","IconBucket",[["path",{d:"M12 7m-8 0a8 4 0 1 0 16 0a8 4 0 1 0 -16 0",key:"svg-0"}],["path",{d:"M4 7c0 .664 .088 1.324 .263 1.965l2.737 10.035c.5 1.5 2.239 2 5 2s4.5 -.5 5 -2c.333 -1 1.246 -4.345 2.737 -10.035a7.45 7.45 0 0 0 .263 -1.965",key:"svg-1"}]]);var IconCalendar=createReactComponent("outline","calendar","IconCalendar",[["path",{d:"M4 7a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12z",key:"svg-0"}],["path",{d:"M16 3v4",key:"svg-1"}],["path",{d:"M8 3v4",key:"svg-2"}],["path",{d:"M4 11h16",key:"svg-3"}],["path",{d:"M11 15h1",key:"svg-4"}],["path",{d:"M12 15v3",key:"svg-5"}]]);var IconCheck=createReactComponent("outline","check","IconCheck",[["path",{d:"M5 12l5 5l10 -10",key:"svg-0"}]]);var IconCheckbox=createReactComponent("outline","checkbox","IconCheckbox",[["path",{d:"M9 11l3 3l8 -8",key:"svg-0"}],["path",{d:"M20 12v6a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h9",key:"svg-1"}]]);var IconChevronDown=createReactComponent("outline","chevron-down","IconChevronDown",[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]]);var IconChevronUp=createReactComponent("outline","chevron-up","IconChevronUp",[["path",{d:"M6 15l6 -6l6 6",key:"svg-0"}]]);var IconCircleMinus=createReactComponent("outline","circle-minus","IconCircleMinus",[["path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-0"}],["path",{d:"M9 12l6 0",key:"svg-1"}]]);var IconCirclePlus=createReactComponent("outline","circle-plus","IconCirclePlus",[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M9 12h6",key:"svg-1"}],["path",{d:"M12 9v6",key:"svg-2"}]]);var IconCloudUpload=createReactComponent("outline","cloud-upload","IconCloudUpload",[["path",{d:"M7 18a4.6 4.4 0 0 1 0 -9a5 4.5 0 0 1 11 2h1a3.5 3.5 0 0 1 0 7h-1",key:"svg-0"}],["path",{d:"M9 15l3 -3l3 3",key:"svg-1"}],["path",{d:"M12 12l0 9",key:"svg-2"}]]);var IconColumns=createReactComponent("outline","columns","IconColumns",[["path",{d:"M4 6l5.5 0",key:"svg-0"}],["path",{d:"M4 10l5.5 0",key:"svg-1"}],["path",{d:"M4 14l5.5 0",key:"svg-2"}],["path",{d:"M4 18l5.5 0",key:"svg-3"}],["path",{d:"M14.5 6l5.5 0",key:"svg-4"}],["path",{d:"M14.5 10l5.5 0",key:"svg-5"}],["path",{d:"M14.5 14l5.5 0",key:"svg-6"}],["path",{d:"M14.5 18l5.5 0",key:"svg-7"}]]);var IconCopy=createReactComponent("outline","copy","IconCopy",[["path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z",key:"svg-0"}],["path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1",key:"svg-1"}]]);var IconCurrencyDollar=createReactComponent("outline","currency-dollar","IconCurrencyDollar",[["path",{d:"M16.7 8a3 3 0 0 0 -2.7 -2h-4a3 3 0 0 0 0 6h4a3 3 0 0 1 0 6h-4a3 3 0 0 1 -2.7 -2",key:"svg-0"}],["path",{d:"M12 3v3m0 12v3",key:"svg-1"}]]);var IconDots=createReactComponent("outline","dots","IconDots",[["path",{d:"M5 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M19 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}]]);var IconEdit=createReactComponent("outline","edit","IconEdit",[["path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1",key:"svg-0"}],["path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z",key:"svg-1"}],["path",{d:"M16 5l3 3",key:"svg-2"}]]);var IconEqualNot=createReactComponent("outline","equal-not","IconEqualNot",[["path",{d:"M5 10h14",key:"svg-0"}],["path",{d:"M5 14h14",key:"svg-1"}],["path",{d:"M5 19l14 -14",key:"svg-2"}]]);var IconEqual=createReactComponent("outline","equal","IconEqual",[["path",{d:"M5 10h14",key:"svg-0"}],["path",{d:"M5 14h14",key:"svg-1"}]]);var IconFileAlert=createReactComponent("outline","file-alert","IconFileAlert",[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z",key:"svg-1"}],["path",{d:"M12 17l.01 0",key:"svg-2"}],["path",{d:"M12 11l0 3",key:"svg-3"}]]);var IconFilePlus=createReactComponent("outline","file-plus","IconFilePlus",[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z",key:"svg-1"}],["path",{d:"M12 11l0 6",key:"svg-2"}],["path",{d:"M9 14l6 0",key:"svg-3"}]]);var IconFilter=createReactComponent("outline","filter","IconFilter",[["path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z",key:"svg-0"}]]);var IconGenderFemale=createReactComponent("outline","gender-female","IconGenderFemale",[["path",{d:"M12 9m-5 0a5 5 0 1 0 10 0a5 5 0 1 0 -10 0",key:"svg-0"}],["path",{d:"M12 14v7",key:"svg-1"}],["path",{d:"M9 18h6",key:"svg-2"}]]);var IconGenderMale=createReactComponent("outline","gender-male","IconGenderMale",[["path",{d:"M10 14m-5 0a5 5 0 1 0 10 0a5 5 0 1 0 -10 0",key:"svg-0"}],["path",{d:"M19 5l-5.4 5.4",key:"svg-1"}],["path",{d:"M19 5h-5",key:"svg-2"}],["path",{d:"M19 5v5",key:"svg-3"}]]);var IconLogout=createReactComponent("outline","logout","IconLogout",[["path",{d:"M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M9 12h12l-3 -3",key:"svg-1"}],["path",{d:"M18 15l3 -3",key:"svg-2"}]]);var IconMathGreater=createReactComponent("outline","math-greater","IconMathGreater",[["path",{d:"M5 18l14 -6l-14 -6",key:"svg-0"}]]);var IconMathLower=createReactComponent("outline","math-lower","IconMathLower",[["path",{d:"M19 18l-14 -6l14 -6",key:"svg-0"}]]);var IconMessage=createReactComponent("outline","message","IconMessage",[["path",{d:"M8 9h8",key:"svg-0"}],["path",{d:"M8 13h6",key:"svg-1"}],["path",{d:"M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12z",key:"svg-2"}]]);var IconPlus=createReactComponent("outline","plus","IconPlus",[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M5 12l14 0",key:"svg-1"}]]);var IconRefresh=createReactComponent("outline","refresh","IconRefresh",[["path",{d:"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4",key:"svg-0"}],["path",{d:"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4",key:"svg-1"}]]);var IconSearch=createReactComponent("outline","search","IconSearch",[["path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M21 21l-6 -6",key:"svg-1"}]]);var IconSettings=createReactComponent("outline","settings","IconSettings",[["path",{d:"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z",key:"svg-0"}],["path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-1"}]]);var IconSortAscending=createReactComponent("outline","sort-ascending","IconSortAscending",[["path",{d:"M4 6l7 0",key:"svg-0"}],["path",{d:"M4 12l7 0",key:"svg-1"}],["path",{d:"M4 18l9 0",key:"svg-2"}],["path",{d:"M15 9l3 -3l3 3",key:"svg-3"}],["path",{d:"M18 6l0 12",key:"svg-4"}]]);var IconSortDescending=createReactComponent("outline","sort-descending","IconSortDescending",[["path",{d:"M4 6l9 0",key:"svg-0"}],["path",{d:"M4 12l7 0",key:"svg-1"}],["path",{d:"M4 18l7 0",key:"svg-2"}],["path",{d:"M15 15l3 3l3 -3",key:"svg-3"}],["path",{d:"M18 6l0 12",key:"svg-4"}]]);var IconSquare=createReactComponent("outline","square","IconSquare",[["path",{d:"M3 3m0 2a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z",key:"svg-0"}]]);var IconStethoscope=createReactComponent("outline","stethoscope","IconStethoscope",[["path",{d:"M6 4h-1a2 2 0 0 0 -2 2v3.5h0a5.5 5.5 0 0 0 11 0v-3.5a2 2 0 0 0 -2 -2h-1",key:"svg-0"}],["path",{d:"M8 15a6 6 0 1 0 12 0v-3",key:"svg-1"}],["path",{d:"M11 3v2",key:"svg-2"}],["path",{d:"M6 3v2",key:"svg-3"}],["path",{d:"M20 10m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-4"}]]);var IconSwitchHorizontal=createReactComponent("outline","switch-horizontal","IconSwitchHorizontal",[["path",{d:"M16 3l4 4l-4 4",key:"svg-0"}],["path",{d:"M10 7l10 0",key:"svg-1"}],["path",{d:"M8 13l-4 4l4 4",key:"svg-2"}],["path",{d:"M4 17l9 0",key:"svg-3"}]]);var IconTableExport=createReactComponent("outline","table-export","IconTableExport",[["path",{d:"M12.5 21h-7.5a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v7.5",key:"svg-0"}],["path",{d:"M3 10h18",key:"svg-1"}],["path",{d:"M10 3v18",key:"svg-2"}],["path",{d:"M16 19h6",key:"svg-3"}],["path",{d:"M19 16l3 3l-3 3",key:"svg-4"}]]);var IconTrash=createReactComponent("outline","trash","IconTrash",[["path",{d:"M4 7l16 0",key:"svg-0"}],["path",{d:"M10 11l0 6",key:"svg-1"}],["path",{d:"M14 11l0 6",key:"svg-2"}],["path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12",key:"svg-3"}],["path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3",key:"svg-4"}]]);var IconUserSquare=createReactComponent("outline","user-square","IconUserSquare",[["path",{d:"M9 10a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-0"}],["path",{d:"M6 21v-1a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v1",key:"svg-1"}],["path",{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z",key:"svg-2"}]]);var IconX=createReactComponent("outline","x","IconX",[["path",{d:"M18 6l-12 12",key:"svg-0"}],["path",{d:"M6 6l12 12",key:"svg-1"}]]);var import_react12=require("react"),import_jsx_runtime5=require("react/jsx-runtime"),ErrorBoundary=class extends import_react12.Component{constructor(props){super(props),this.state={lastLocation:window.location.toString()}}static getDerivedStateFromError(error){return{error,lastLocation:window.location.toString()}}componentDidUpdate(_prevProps,_prevState){window.location.toString()!==this.state.lastLocation&&this.setState({lastLocation:window.location.toString(),error:void 0})}shouldComponentUpdate(nextProps,nextState){return!!(this.props.children!==nextProps.children||nextState.error&&!this.state.error||this.state.lastLocation!==window.location.toString())}componentDidCatch(error,errorInfo){console.error("Uncaught error:",error,errorInfo)}render(){return this.state.error?(0,import_jsx_runtime5.jsx)(import_core9.Alert,{icon:(0,import_jsx_runtime5.jsx)(IconAlertCircle,{size:16}),title:"Something went wrong",color:"red",children:(0,import_core10.normalizeErrorString)(this.state.error)}):this.props.children}};var import_core11=require("@mantine/core"),import_jsx_runtime6=require("react/jsx-runtime");function Loading(){return(0,import_jsx_runtime6.jsx)(import_core11.Center,{style:{width:"100%",height:"100vh"},children:(0,import_jsx_runtime6.jsx)(import_core11.Loader,{})})}var AppShell_default={main:"AppShell_main"};var import_core23=require("@mantine/core"),import_core24=require("@medplum/core");function r(e){var t,f,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}var clsx_default=clsx;var import_react15=require("react");var import_core14=require("@mantine/core"),import_core15=require("@medplum/core");var import_core12=require("@mantine/core"),import_core13=require("@medplum/core");function killEvent(e){e.preventDefault(),e.stopPropagation()}function isCheckboxCell(el){if(isCheckboxElement(el))return!0;if(el instanceof HTMLTableCellElement){let children=el.children;if(children.length===1&&isCheckboxElement(children[0]))return!0}return!1}function isCheckboxElement(el){return el instanceof HTMLInputElement&&el.type==="checkbox"}var import_jsx_runtime7=require("react/jsx-runtime");function MedplumLink(props){let navigate=se(),{to,suffix,label,onClick,children,...rest}=props,href=getHref(to);return suffix&&(href+="/"+suffix),(0,import_jsx_runtime7.jsx)(import_core12.Anchor,{href,"aria-label":label,onClick:e=>{killEvent(e),onClick?onClick(e):to&&navigate(href)},...rest,children})}function getHref(to){if(to){if(typeof to=="string")return getStringHref(to);if((0,import_core13.isResource)(to))return getResourceHref(to);if((0,import_core13.isReference)(to))return getReferenceHref(to)}return"#"}function getStringHref(to){return to.startsWith("http://")||to.startsWith("https://")||to.startsWith("/")?to:"/"+to}function getResourceHref(to){return`/${to.resourceType}/${to.id}`}function getReferenceHref(to){return`/${to.reference}`}function getInitials(input){let words=input.split(" ").filter(Boolean);return words.length>1?words[0][0]+words[words.length-1][0]:words.length===1?words[0][0]:""}var import_jsx_runtime8=require("react/jsx-runtime");function ResourceAvatar(props){let resource=Te(props.value),text=resource?(0,import_core15.getDisplayString)(resource):props.alt??"",initials=getInitials(text),uncachedImageUrl=(resource&&(0,import_core15.getImageSrc)(resource))??props.src,imageUrl=Se(uncachedImageUrl??void 0),radius=props.radius??"xl",avatarProps={...props,value:void 0,link:void 0};return props.link?(0,import_jsx_runtime8.jsx)(MedplumLink,{to:resource,children:(0,import_jsx_runtime8.jsx)(import_core14.Avatar,{src:imageUrl,alt:text,radius,...avatarProps,children:initials})}):(0,import_jsx_runtime8.jsx)(import_core14.Avatar,{src:imageUrl,alt:text,radius,...avatarProps,children:initials})}var Header_default={logoButton:"Header_logoButton",user:"Header_user",userName:"Header_userName",userActive:"Header_userActive"};var import_core17=require("@mantine/core"),import_core18=require("@medplum/core");var import_core16=require("@medplum/core"),import_jsx_runtime9=require("react/jsx-runtime");function HumanNameDisplay(props){let name=props.value;return name?(0,import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment,{children:(0,import_core16.formatHumanName)(name,props.options)}):null}var import_jsx_runtime10=require("react/jsx-runtime");function HeaderDropdown(props){let context=T(),{medplum,profile,navigate}=context,logins=medplum.getLogins(),{colorScheme,setColorScheme}=(0,import_core17.useMantineColorScheme)();return(0,import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment,{children:[(0,import_jsx_runtime10.jsxs)(import_core17.Stack,{align:"center",p:"xl",children:[(0,import_jsx_runtime10.jsx)(ResourceAvatar,{size:"xl",radius:100,value:context.profile}),(0,import_jsx_runtime10.jsx)(HumanNameDisplay,{value:context.profile?.name?.[0]}),(0,import_jsx_runtime10.jsx)(import_core17.Text,{c:"dimmed",size:"xs",children:medplum.getActiveLogin()?.project.display})]}),logins.length>1&&(0,import_jsx_runtime10.jsx)(import_core17.Menu.Divider,{}),logins.map(login=>login.profile.reference!==(0,import_core18.getReferenceString)(context.profile)&&(0,import_jsx_runtime10.jsx)(import_core17.Menu.Item,{onClick:()=>{medplum.setActiveLogin(login).then(()=>window.location.reload()).catch(console.log)},children:(0,import_jsx_runtime10.jsxs)(import_core17.Group,{children:[(0,import_jsx_runtime10.jsx)(import_core17.Avatar,{radius:"xl"}),(0,import_jsx_runtime10.jsxs)("div",{style:{flex:1},children:[(0,import_jsx_runtime10.jsx)(import_core17.Text,{size:"sm",fw:500,children:login.profile.display}),(0,import_jsx_runtime10.jsx)(import_core17.Text,{c:"dimmed",size:"xs",children:login.project.display})]})]})},login.profile.reference)),(0,import_jsx_runtime10.jsx)(import_core17.Menu.Divider,{}),(0,import_jsx_runtime10.jsx)(import_core17.Group,{justify:"center",children:(0,import_jsx_runtime10.jsx)(import_core17.SegmentedControl,{size:"xs",value:colorScheme,onChange:newValue=>setColorScheme(newValue),data:[{label:"Light",value:"light"},{label:"Dark",value:"dark"},{label:"Auto",value:"auto"}]})}),(0,import_jsx_runtime10.jsx)(import_core17.Menu.Divider,{}),(0,import_jsx_runtime10.jsx)(import_core17.Menu.Item,{leftSection:(0,import_jsx_runtime10.jsx)(IconSwitchHorizontal,{size:14,stroke:1.5}),onClick:()=>navigate("/signin"),children:"Add another account"}),(0,import_jsx_runtime10.jsx)(import_core17.Menu.Item,{leftSection:(0,import_jsx_runtime10.jsx)(IconSettings,{size:14,stroke:1.5}),onClick:()=>navigate(`/${(0,import_core18.getReferenceString)(profile)}`),children:"Account settings"}),(0,import_jsx_runtime10.jsx)(import_core17.Menu.Item,{leftSection:(0,import_jsx_runtime10.jsx)(IconLogout,{size:14,stroke:1.5}),onClick:async()=>{await medplum.signOut(),navigate("/signin")},children:"Sign out"}),(0,import_jsx_runtime10.jsx)(import_core17.Text,{size:"xs",c:"dimmed",ta:"center",children:props.version})]})}var import_core21=require("@mantine/core"),import_core22=require("@medplum/core");var import_react14=require("react");var import_core19=require("@mantine/core"),import_notifications=require("@mantine/notifications"),import_core20=require("@medplum/core"),import_react13=require("react");var AsyncAutocompleteTestIds={selectedItems:"selected-items",options:"options"};var import_jsx_runtime11=require("react/jsx-runtime");function AsyncAutocomplete(props){let combobox=(0,import_core19.useCombobox)({onDropdownClose:()=>combobox.resetSelectedOption(),onDropdownOpen:()=>combobox.updateSelectedOptionIndex("active")}),{name,label,description,error,defaultValue:defaultValue2,toOption:toOption4,loadOptions,itemComponent,pillComponent,emptyComponent,onChange,onCreate,creatable,clearable,required,placeholder,leftSection,maxValues,optionsDropdownMaxHeight=320,minInputLength=0,...rest}=props,disabled=rest.disabled,defaultItems=toDefaultItems(defaultValue2),[search,setSearch]=(0,import_react13.useState)(""),[timer,setTimer]=(0,import_react13.useState)(),[abortController,setAbortController]=(0,import_react13.useState)(),[autoSubmit,setAutoSubmit]=(0,import_react13.useState)(),[selected,setSelected]=(0,import_react13.useState)(defaultItems.map(toOption4)),[options,setOptions]=(0,import_react13.useState)([]),ItemComponent3=itemComponent??DefaultItemComponent,PillComponent=pillComponent??DefaultPillComponent,EmptyComponent=emptyComponent??DefaultEmptyComponent,searchRef=(0,import_react13.useRef)();searchRef.current=search;let lastLoadOptionsRef=(0,import_react13.useRef)(),lastValueRef=(0,import_react13.useRef)(),timerRef=(0,import_react13.useRef)();timerRef.current=timer;let abortControllerRef=(0,import_react13.useRef)();abortControllerRef.current=abortController;let autoSubmitRef=(0,import_react13.useRef)();autoSubmitRef.current=autoSubmit;let optionsRef=(0,import_react13.useRef)();optionsRef.current=options;let handleTimer=(0,import_react13.useCallback)(()=>{if(setTimer(void 0),searchRef.current===lastValueRef.current&&loadOptions===lastLoadOptionsRef.current||(searchRef.current?.length??0)<minInputLength)return;lastValueRef.current=searchRef.current,lastLoadOptionsRef.current=loadOptions;let newAbortController=new AbortController;setAbortController(newAbortController),loadOptions(searchRef.current??"",newAbortController.signal).then(newValues=>{newAbortController.signal.aborted||(setOptions(newValues.map(toOption4)),autoSubmitRef.current?(newValues.length>0&&onChange(newValues.slice(0,1)),setAutoSubmit(!1)):newValues.length>0&&combobox.openDropdown())}).catch(err=>{newAbortController.signal.aborted||err.message.includes("aborted")||(0,import_notifications.showNotification)({color:"red",message:(0,import_core20.normalizeErrorString)(err)})}).finally(()=>{newAbortController.signal.aborted||setAbortController(void 0)})},[combobox,loadOptions,onChange,toOption4,minInputLength]),handleSearchChange=(0,import_react13.useCallback)(e=>{(options&&options.length>0||creatable)&&combobox.openDropdown(),combobox.updateSelectedOptionIndex(),setSearch(e.currentTarget.value),abortControllerRef.current&&(abortControllerRef.current.abort(),setAbortController(void 0)),timerRef.current!==void 0&&window.clearTimeout(timerRef.current);let newTimer=window.setTimeout(()=>handleTimer(),100);setTimer(newTimer)},[combobox,options,creatable,handleTimer]),addSelected=(0,import_react13.useCallback)(newValue=>{let alreadySelected=selected.some(v2=>v2.value===newValue),newSelected=alreadySelected?selected.filter(v2=>v2.value!==newValue):[...selected],option=options?.find(option2=>option2.value===newValue);if(!option&&creatable!==!1&&onCreate){let createdResource=onCreate(newValue);option=toOption4(createdResource)}if(option){if(maxValues===0){onChange([option.resource]),selected.length>0&&setSelected([]);return}alreadySelected||newSelected.push(option)}if(maxValues!==void 0)for(;newSelected.length>maxValues;)newSelected.shift();onChange(newSelected.map(v2=>v2.resource)),setSelected(newSelected)},[creatable,options,selected,maxValues,onChange,onCreate,toOption4]),handleValueSelect=(0,import_react13.useMemo)(()=>{if(!disabled)return val=>{disabled||(maxValues===1&&(setSearch(""),setOptions([]),combobox.closeDropdown()),lastValueRef.current=void 0,addSelected(val==="$create"?search:val))}},[addSelected,combobox,disabled,maxValues,search]),handleValueRemove=(0,import_react13.useCallback)(item=>{let newSelected=selected.filter(v2=>v2.value!==item.value);onChange(newSelected.map(v2=>v2.resource)),setSelected(newSelected)},[selected,onChange]),handleKeyDown=(0,import_react13.useCallback)(e=>{e.key==="Enter"?(timer||abortController)&&setAutoSubmit(!0):e.key==="Backspace"&&search.length===0&&(killEvent(e),handleValueRemove(selected[selected.length-1]))},[abortController,handleValueRemove,search.length,selected,timer]);(0,import_react13.useEffect)(()=>()=>{abortControllerRef.current&&abortControllerRef.current.abort()},[]);let clearButton=!disabled&&clearable&&selected.length>0&&(0,import_jsx_runtime11.jsx)(import_core19.Combobox.ClearButton,{title:"Clear all",size:16,onClear:()=>{setSearch(""),setSelected([]),onChange([]),combobox.closeDropdown()}});return(0,import_jsx_runtime11.jsxs)(import_core19.Combobox,{store:combobox,onOptionSubmit:handleValueSelect,withinPortal:!0,shadow:"xl",...rest,children:[(0,import_jsx_runtime11.jsx)(import_core19.Combobox.DropdownTarget,{children:(0,import_jsx_runtime11.jsx)(import_core19.PillsInput,{label,description,error,className:props.className,leftSection,rightSection:abortController?(0,import_jsx_runtime11.jsx)(import_core19.Loader,{size:16}):clearButton,required,disabled,children:(0,import_jsx_runtime11.jsxs)(import_core19.Pill.Group,{"data-testid":AsyncAutocompleteTestIds.selectedItems,children:[selected.map(item=>(0,import_jsx_runtime11.jsx)(PillComponent,{item,disabled,onRemove:()=>handleValueRemove(item)},item.value)),!disabled&&(maxValues===void 0||maxValues===0||selected.length<maxValues)&&(0,import_jsx_runtime11.jsx)(import_core19.Combobox.EventsTarget,{children:(0,import_jsx_runtime11.jsx)(import_core19.PillsInput.Field,{role:"searchbox",name,value:search,placeholder,onFocus:handleSearchChange,onBlur:()=>{combobox.closeDropdown(),setSearch("")},onKeyDown:handleKeyDown,onChange:handleSearchChange})})]})})}),(0,import_jsx_runtime11.jsx)(import_core19.Combobox.Dropdown,{hidden:options.length===0,"data-testid":AsyncAutocompleteTestIds.options,children:(0,import_jsx_runtime11.jsx)(import_core19.Combobox.Options,{children:(0,import_jsx_runtime11.jsxs)(import_core19.ScrollAreaAutosize,{type:"scroll",mah:optionsDropdownMaxHeight,children:[options.map(item=>{let active=selected.some(v2=>v2.value===item.value);return(0,import_jsx_runtime11.jsx)(import_core19.Combobox.Option,{value:item.value,active,children:(0,import_jsx_runtime11.jsx)(ItemComponent3,{...item,active})},item.value)}),creatable&&search.trim().length>0&&(0,import_jsx_runtime11.jsxs)(import_core19.Combobox.Option,{value:"$create",children:["+ Create ",search]}),!creatable&&search.trim().length>0&&options.length===0&&(0,import_jsx_runtime11.jsx)(EmptyComponent,{search})]})})})]})}function toDefaultItems(defaultValue2){return defaultValue2?Array.isArray(defaultValue2)?defaultValue2:[defaultValue2]:[]}function DefaultItemComponent(props){return(0,import_jsx_runtime11.jsxs)(import_core19.Group,{gap:"xs",children:[props.active&&(0,import_jsx_runtime11.jsx)(IconCheck,{size:12}),(0,import_jsx_runtime11.jsx)("span",{children:props.label})]})}function DefaultPillComponent({item,disabled,onRemove}){return(0,import_jsx_runtime11.jsx)(import_core19.Pill,{withRemoveButton:!disabled,onRemove,children:item.label})}function DefaultEmptyComponent(){return(0,import_jsx_runtime11.jsx)(import_core19.Combobox.Empty,{children:"Nothing found"})}var HeaderSearchInput_default={searchInput:"HeaderSearchInput_searchInput"};var import_jsx_runtime12=require("react/jsx-runtime");function toOption(resource){return{value:resource.id,label:(0,import_core22.getDisplayString)(resource),resource}}function HeaderSearchInput(props){let navigate=se(),medplum=b(),loadData=(0,import_react14.useCallback)(async(input,signal)=>{let query=buildGraphQLQuery(input),options={signal},response=await medplum.graphql(query,void 0,void 0,options);return getResourcesFromResponse(response,input)},[medplum]),handleSelect=(0,import_react14.useCallback)(item=>{item.length>0&&navigate(`/${(0,import_core22.getReferenceString)(item[0])}`)},[navigate]);return(0,import_jsx_runtime12.jsx)(AsyncAutocomplete,{size:"sm",radius:"md",className:HeaderSearchInput_default.searchInput,leftSection:(0,import_jsx_runtime12.jsx)(IconSearch,{size:16}),placeholder:"Search",itemComponent:ItemComponent,toOption,onChange:handleSelect,loadOptions:loadData,maxValues:0,clearable:!1},`${props.pathname}?${props.searchParams}`)}var ItemComponent=(0,import_react14.forwardRef)(({resource,active:_active,...others},ref)=>{let helpText;return resource.resourceType==="Patient"?helpText=resource.birthDate:resource.resourceType==="ServiceRequest"&&(helpText=resource.subject?.display),(0,import_jsx_runtime12.jsx)("div",{ref,...others,children:(0,import_jsx_runtime12.jsxs)(import_core21.Group,{wrap:"nowrap",children:[(0,import_jsx_runtime12.jsx)(ResourceAvatar,{value:resource}),(0,import_jsx_runtime12.jsxs)("div",{children:[(0,import_jsx_runtime12.jsx)(import_core21.Text,{children:(0,import_core22.getDisplayString)(resource)}),(0,import_jsx_runtime12.jsx)(import_core21.Text,{size:"xs",c:"dimmed",children:helpText})]})]})})});function buildGraphQLQuery(input){let escaped=JSON.stringify(input);return(0,import_core22.isUUID)(input)?`{
2
2
  Patients1: PatientList(_id: ${escaped}, _count: 1) {
3
3
  resourceType
4
4
  id
@@ -62,7 +62,7 @@
62
62
  }
63
63
  }
64
64
  }`.replace(/\s+/g," ")}function getResourcesFromResponse(response,query){let resources=[];return response.data.Patients1&&resources.push(...response.data.Patients1),response.data.Patients2&&resources.push(...response.data.Patients2),response.data.ServiceRequestList&&resources.push(...response.data.ServiceRequestList),sortByRelevance(dedupeResources(resources),query).slice(0,5)}function dedupeResources(resources){let ids=new Set,result=[];for(let resource of resources)ids.has(resource.id)||(ids.add(resource.id),result.push(resource));return result}function sortByRelevance(resources,query){return resources.sort((a,b2)=>getResourceScore(b2,query)-getResourceScore(a,query))}function getResourceScore(resource,query){let bestScore=0;if(resource.identifier)for(let identifier of resource.identifier)bestScore=Math.max(bestScore,getStringScore(identifier.value,query));if(resource.resourceType==="Patient"&&resource.name)for(let name of resource.name)bestScore=Math.max(bestScore,getStringScore((0,import_core22.formatHumanName)(name),query));return bestScore}function getStringScore(str,query){if(!str)return 0;let index=str.toLowerCase().indexOf(query.toLowerCase());return index<0?0:100-index}var import_jsx_runtime13=require("react/jsx-runtime");function Header(props){let profile=ue(),[userMenuOpened,setUserMenuOpened]=(0,import_react15.useState)(!1);return(0,import_jsx_runtime13.jsx)(import_core23.AppShell.Header,{p:8,style:{zIndex:101},children:(0,import_jsx_runtime13.jsxs)(import_core23.Group,{justify:"space-between",children:[(0,import_jsx_runtime13.jsxs)(import_core23.Group,{gap:"xs",children:[(0,import_jsx_runtime13.jsx)(import_core23.UnstyledButton,{className:Header_default.logoButton,onClick:props.navbarToggle,children:props.logo}),!props.headerSearchDisabled&&(0,import_jsx_runtime13.jsx)(HeaderSearchInput,{pathname:props.pathname,searchParams:props.searchParams})]}),(0,import_jsx_runtime13.jsxs)(import_core23.Group,{gap:"lg",pr:"sm",children:[props.notifications,(0,import_jsx_runtime13.jsxs)(import_core23.Menu,{width:260,shadow:"xl",position:"bottom-end",transitionProps:{transition:"pop-top-right"},opened:userMenuOpened,onClose:()=>setUserMenuOpened(!1),children:[(0,import_jsx_runtime13.jsx)(import_core23.Menu.Target,{children:(0,import_jsx_runtime13.jsx)(import_core23.UnstyledButton,{className:clsx_default(Header_default.user,{[Header_default.userActive]:userMenuOpened}),onClick:()=>setUserMenuOpened(o=>!o),children:(0,import_jsx_runtime13.jsxs)(import_core23.Group,{gap:7,children:[(0,import_jsx_runtime13.jsx)(ResourceAvatar,{value:profile,radius:"xl",size:24}),(0,import_jsx_runtime13.jsx)(import_core23.Text,{size:"sm",className:Header_default.userName,children:(0,import_core24.formatHumanName)(profile?.name?.[0])}),(0,import_jsx_runtime13.jsx)(IconChevronDown,{size:12,stroke:1.5})]})})}),(0,import_jsx_runtime13.jsx)(import_core23.Menu.Dropdown,{children:(0,import_jsx_runtime13.jsx)(HeaderDropdown,{version:props.version})})]})]})]})})}var import_core28=require("@mantine/core");var import_react19=require("react");var import_core25=require("@mantine/core"),import_notifications2=require("@mantine/notifications"),import_core26=require("@medplum/core");function parseForm(form){let result={};for(let element of Array.from(form.elements))element instanceof HTMLInputElement?parseInputElement(result,element):element instanceof HTMLTextAreaElement?result[element.name]=element.value:element instanceof HTMLSelectElement&&parseSelectElement(result,element);return result}function parseInputElement(result,el){el.disabled||(el.type==="checkbox"||el.type==="radio")&&!el.checked||(result[el.name]=el.value)}function parseSelectElement(result,el){result[el.name]=el.value}var import_jsx_runtime14=require("react/jsx-runtime");function Form(props){return(0,import_jsx_runtime14.jsx)("form",{style:props.style,"data-testid":props.testid,onSubmit:e=>{e.preventDefault();let formData=parseForm(e.target);props.onSubmit&&props.onSubmit(formData)},children:props.children})}var import_jsx_runtime15=require("react/jsx-runtime");function BookmarkDialog(props){let medplum=b(),config=medplum.getUserConfiguration();function submitHandler(formData){let{menuname,bookmarkname:name}=formData,target=`${props.pathname}?${props.searchParams.toString()}`,newConfig=(0,import_core26.deepClone)(config);newConfig.menu?.find(({title})=>title===menuname)?.link?.push({name,target}),medplum.updateResource(newConfig).then(res=>{config.menu=res.menu,medplum.dispatchEvent({type:"change"}),(0,import_notifications2.showNotification)({color:"green",message:"Success"}),props.onOk()}).catch(err=>{(0,import_notifications2.showNotification)({color:"red",message:(0,import_core26.normalizeErrorString)(err)})})}return(0,import_jsx_runtime15.jsx)(import_core25.Modal,{title:"Add Bookmark",closeButtonProps:{"aria-label":"Close"},opened:props.visible,onClose:props.onCancel,children:(0,import_jsx_runtime15.jsx)(Form,{onSubmit:submitHandler,children:(0,import_jsx_runtime15.jsxs)(import_core25.Stack,{children:[(0,import_jsx_runtime15.jsx)(SelectMenu,{config}),(0,import_jsx_runtime15.jsx)(import_core25.TextInput,{label:"Bookmark Name",type:"text",name:"bookmarkname",placeholder:"Bookmark Name",withAsterisk:!0}),(0,import_jsx_runtime15.jsx)(import_core25.Group,{justify:"flex-end",children:(0,import_jsx_runtime15.jsx)(import_core25.Button,{mt:"sm",type:"submit",children:"OK"})})]})})})}function SelectMenu(props){function userConfigToMenu(config){return config?.menu?.map(menu=>menu.title)}let menus=userConfigToMenu(props.config);return(0,import_jsx_runtime15.jsx)(import_core25.NativeSelect,{name:"menuname",defaultValue:menus[0],label:"Select Menu Option",data:menus,withAsterisk:!0})}var import_react18=require("react");var import_react17=require("react");var import_core27=require("@mantine/core");var import_react16=require("react");var import_jsx_runtime16=require("react/jsx-runtime");function toKey(element){return typeof element.code=="string"?element.code:JSON.stringify(element)}function getDisplay(item){return typeof item.display=="string"?item.display:toKey(item)}function toOption2(element){return{value:toKey(element),label:getDisplay(element),resource:element}}function createValue(input){return{code:input,display:input}}function ValueSetAutocomplete(props){let medplum=b(),{binding,creatable,clearable,expandParams,withHelpText,...rest}=props,loadValues=(0,import_react16.useCallback)(async(input,signal)=>{if(!binding)return[];let valueSetElements=(await medplum.valueSetExpand({...expandParams,url:binding,filter:input},{signal})).expansion?.contains,newData=[];for(let valueSetElement of valueSetElements)valueSetElement.code&&!newData.some(item=>item.code===valueSetElement.code)&&newData.push(valueSetElement);return newData},[medplum,expandParams,binding]);return(0,import_jsx_runtime16.jsx)(AsyncAutocomplete,{...rest,creatable:creatable??!0,clearable:clearable??!0,toOption:toOption2,loadOptions:loadValues,onCreate:createValue,itemComponent:withHelpText?ItemComponent2:void 0})}var ItemComponent2=(0,import_react16.forwardRef)(({label,resource,active,...others},ref)=>(0,import_jsx_runtime16.jsx)("div",{ref,...others,children:(0,import_jsx_runtime16.jsxs)(import_core27.Group,{wrap:"nowrap",gap:"xs",children:[active&&(0,import_jsx_runtime16.jsx)(IconCheck,{size:12}),(0,import_jsx_runtime16.jsxs)("div",{children:[(0,import_jsx_runtime16.jsx)(import_core27.Text,{children:label}),(0,import_jsx_runtime16.jsx)(import_core27.Text,{size:"xs",c:"dimmed",children:`${resource.system}#${resource.code}`})]})]})}));var import_jsx_runtime17=require("react/jsx-runtime");function CodeInput(props){let{defaultValue:defaultValue2,onChange,withHelpText,...rest}=props,[value,setValue]=(0,import_react17.useState)(defaultValue2);function handleChange(newValues){let newValue=newValues[0],newCode=valueSetElementToCode(newValue);setValue(newCode),onChange&&onChange(newCode)}return(0,import_jsx_runtime17.jsx)(ValueSetAutocomplete,{defaultValue:codeToValueSetElement(value),onChange:handleChange,withHelpText:withHelpText??!0,...rest})}function codeToValueSetElement(code){return code?{code}:void 0}function valueSetElementToCode(element){return element?.code}var import_jsx_runtime18=require("react/jsx-runtime");function ResourceTypeInput(props){let[resourceType,setResourceType]=(0,import_react18.useState)(props.defaultValue),onChange=props.onChange,setResourceTypeWrapper=(0,import_react18.useCallback)(newResourceType=>{setResourceType(newResourceType),onChange&&onChange(newResourceType)},[onChange]);return(0,import_jsx_runtime18.jsx)(CodeInput,{disabled:props.disabled,"data-autofocus":props.autoFocus,"data-testid":props.testId,defaultValue:resourceType,onChange:setResourceTypeWrapper,name:props.name,placeholder:props.placeholder,binding:"https://medplum.com/fhir/ValueSet/resource-types",creatable:!1,maxValues:props.maxValues??1,clearable:!1,withHelpText:!1})}var Navbar_default={menuTitle:"Navbar_menuTitle",link:"Navbar_link",linkActive:"Navbar_linkActive"};var import_jsx_runtime19=require("react/jsx-runtime");function Navbar(props){let navigate=se(),activeLink=getActiveLink(props.pathname,props.searchParams,props.menus),[bookmarkDialogVisible,setBookmarkDialogVisible]=(0,import_react19.useState)(!1);function onLinkClick(e,to){e.stopPropagation(),e.preventDefault(),navigate(to),window.innerWidth<768&&props.closeNavbar()}function navigateResourceType(resourceType){resourceType&&navigate(`/${resourceType}`)}return(0,import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment,{children:[(0,import_jsx_runtime19.jsx)(import_core28.AppShell.Navbar,{children:(0,import_jsx_runtime19.jsxs)(import_core28.ScrollArea,{p:"xs",children:[!props.resourceTypeSearchDisabled&&(0,import_jsx_runtime19.jsx)(import_core28.AppShell.Section,{mb:"sm",children:(0,import_jsx_runtime19.jsx)(ResourceTypeInput,{name:"resourceType",placeholder:"Resource Type",maxValues:0,onChange:newValue=>navigateResourceType(newValue)},window.location.pathname)}),(0,import_jsx_runtime19.jsxs)(import_core28.AppShell.Section,{grow:!0,children:[props.menus?.map(menu=>(0,import_jsx_runtime19.jsxs)(import_react19.Fragment,{children:[(0,import_jsx_runtime19.jsx)(import_core28.Text,{className:Navbar_default.menuTitle,children:menu.title}),menu.links?.map(link=>(0,import_jsx_runtime19.jsxs)(NavbarLink,{to:link.href,active:link.href===activeLink?.href,onClick:e=>onLinkClick(e,link.href),children:[(0,import_jsx_runtime19.jsx)(NavLinkIcon,{to:link.href,icon:link.icon}),(0,import_jsx_runtime19.jsx)("span",{children:link.label})]},link.href))]},`menu-${menu.title}`)),props.displayAddBookmark&&(0,import_jsx_runtime19.jsx)(import_core28.Button,{variant:"subtle",size:"xs",mt:"xl",leftSection:(0,import_jsx_runtime19.jsx)(IconPlus,{size:"0.75rem"}),onClick:()=>setBookmarkDialogVisible(!0),children:"Add Bookmark"})]})]})}),props.pathname&&props.searchParams&&(0,import_jsx_runtime19.jsx)(BookmarkDialog,{pathname:props.pathname,searchParams:props.searchParams,visible:bookmarkDialogVisible,onOk:()=>setBookmarkDialogVisible(!1),onCancel:()=>setBookmarkDialogVisible(!1)})]})}function NavbarLink(props){return(0,import_jsx_runtime19.jsx)(MedplumLink,{onClick:props.onClick,to:props.to,className:clsx_default(Navbar_default.link,{[Navbar_default.linkActive]:props.active}),children:props.children})}function NavLinkIcon(props){return props.icon?props.icon:(0,import_jsx_runtime19.jsx)(import_core28.Space,{w:30})}function getActiveLink(currentPathname,currentSearchParams,menus){if(!currentPathname||!currentSearchParams||!menus)return;let bestLink,bestScore=0;for(let menu of menus)if(menu.links)for(let link of menu.links){let score=getLinkScore(currentPathname,currentSearchParams,link.href);score>bestScore&&(bestScore=score,bestLink=link)}return bestLink}function getLinkScore(currentPathname,currentSearchParams,linkHref){let linkUrl=new URL(linkHref,"https://example.com");if(currentPathname!==linkUrl.pathname)return 0;let ignoredParams=["_count","_offset"];for(let[key,value]of linkUrl.searchParams.entries())if(!ignoredParams.includes(key)&&currentSearchParams.get(key)!==value)return 0;let count=1;for(let[key,value]of currentSearchParams.entries())ignoredParams.includes(key)||linkUrl.searchParams.get(key)===value&&count++;return count}var import_jsx_runtime20=require("react/jsx-runtime");function AppShell(props){let[navbarOpen,setNavbarOpen]=(0,import_react20.useState)(localStorage.navbarOpen==="true"),medplum=b(),profile=ue();(0,import_react20.useEffect)(()=>{function eventListener(){(0,import_notifications3.showNotification)({color:"red",message:"No connection to server",autoClose:!1})}return medplum.addEventListener("offline",eventListener),()=>medplum.removeEventListener("offline",eventListener)},[medplum]);function setNavbarOpenWrapper(open){localStorage.navbarOpen=open.toString(),setNavbarOpen(open)}function closeNavbar(){setNavbarOpenWrapper(!1)}function toggleNavbar(){setNavbarOpenWrapper(!navbarOpen)}return medplum.isLoading()?(0,import_jsx_runtime20.jsx)(Loading,{}):(0,import_jsx_runtime20.jsxs)(import_core29.AppShell,{header:{height:60},navbar:{width:250,breakpoint:"sm",collapsed:{desktop:!profile||!navbarOpen,mobile:!profile||!navbarOpen}},padding:0,children:[profile&&(0,import_jsx_runtime20.jsx)(Header,{pathname:props.pathname,searchParams:props.searchParams,headerSearchDisabled:props.headerSearchDisabled,logo:props.logo,version:props.version,navbarToggle:toggleNavbar,notifications:props.notifications}),profile&&navbarOpen?(0,import_jsx_runtime20.jsx)(Navbar,{pathname:props.pathname,searchParams:props.searchParams,menus:props.menus,closeNavbar,displayAddBookmark:props.displayAddBookmark,resourceTypeSearchDisabled:props.resourceTypeSearchDisabled}):void 0,(0,import_jsx_runtime20.jsx)(import_core29.AppShell.Main,{className:AppShell_default.main,children:(0,import_jsx_runtime20.jsx)(ErrorBoundary,{children:(0,import_jsx_runtime20.jsx)(import_react20.Suspense,{fallback:(0,import_jsx_runtime20.jsx)(Loading,{}),children:props.children})})})]})}var import_core30=require("@mantine/core");var import_jsx_runtime21=require("react/jsx-runtime");function AttachmentDisplay(props){let{contentType,url:uncachedUrl,title}=props.value??{},url=Se(uncachedUrl);return url?(0,import_jsx_runtime21.jsxs)("div",{"data-testid":"attachment-display",children:[contentType?.startsWith("image/")&&(0,import_jsx_runtime21.jsx)("img",{"data-testid":"attachment-image",style:{maxWidth:props.maxWidth},src:url,alt:title}),contentType?.startsWith("video/")&&(0,import_jsx_runtime21.jsx)("video",{"data-testid":"attachment-video",style:{maxWidth:props.maxWidth},controls:!0,children:(0,import_jsx_runtime21.jsx)("source",{type:contentType,src:url})}),(contentType?.startsWith("text/")||contentType==="application/json"||contentType==="application/pdf")&&(0,import_jsx_runtime21.jsx)("div",{"data-testid":"attachment-iframe",style:{maxWidth:props.maxWidth,minHeight:400},children:(0,import_jsx_runtime21.jsx)("iframe",{width:"100%",height:"400",src:url+"#navpanes=0",allowFullScreen:!0,frameBorder:0,seamless:!0})}),(0,import_jsx_runtime21.jsx)("div",{"data-testid":"download-link",style:{padding:"2px 16px 16px 16px"},children:(0,import_jsx_runtime21.jsx)(import_core30.Anchor,{href:uncachedUrl,"data-testid":"attachment-details",target:"_blank",rel:"noopener noreferrer",download:getDownloadName(title),children:title||"Download"})})]}):null}function getDownloadName(title){return title?.includes(".")?title:void 0}var DescriptionList_default={root:"DescriptionList_root",compact:"DescriptionList_compact"};var import_jsx_runtime22=require("react/jsx-runtime");function DescriptionList(props){let{children,compact}=props;return(0,import_jsx_runtime22.jsx)("dl",{className:clsx_default(DescriptionList_default.root,{[DescriptionList_default.compact]:compact}),children})}function DescriptionListEntry(props){return(0,import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment,{children:[(0,import_jsx_runtime22.jsx)("dt",{children:props.term}),(0,import_jsx_runtime22.jsx)("dd",{children:props.children})]})}var import_core31=require("@medplum/core"),import_jsx_runtime23=require("react/jsx-runtime");function AttachmentArrayDisplay(props){let attachmentElements=props.values?.map((v2,index)=>(0,import_jsx_runtime23.jsx)("div",{children:(0,import_jsx_runtime23.jsx)(AttachmentDisplay,{value:v2,maxWidth:props.maxWidth})},"attatchment-"+index)),content;if(props.includeDescriptionListEntry){if(props.property===void 0)throw new Error("props.property is required when includeDescriptionListEntry is true");if(!(0,import_core31.isPopulated)(props.path))throw new Error("props.path is required when includeDescriptionListEntry is true");let key=props.path.split(".").pop();content=(0,import_jsx_runtime23.jsx)(DescriptionListEntry,{term:(0,import_core31.getPathDisplayName)(key),children:attachmentElements})}else content=(0,import_jsx_runtime23.jsx)(import_jsx_runtime23.Fragment,{children:attachmentElements});return content}var import_core33=require("@mantine/core");var import_react22=require("react");var import_core32=require("@medplum/core");var import_react21=require("react");var import_jsx_runtime24=require("react/jsx-runtime");function AttachmentButton(props){let medplum=b(),fileInputRef=(0,import_react21.useRef)(null);function onClick(e){killEvent(e),fileInputRef.current?.click()}function onFileChange(e){killEvent(e);let files=e.target.files;files&&Array.from(files).forEach(processFile)}function processFile(file){!file||!file.name||(props.onUploadStart&&props.onUploadStart(),medplum.createAttachment({data:file,contentType:file.type||"application/octet-stream",filename:file.name,securityContext:props.securityContext,onProgress:props.onUploadProgress}).then(attachment=>props.onUpload(attachment)).catch(err=>{props.onUploadError&&props.onUploadError((0,import_core32.normalizeOperationOutcome)(err))}))}return(0,import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment,{children:[(0,import_jsx_runtime24.jsx)("input",{disabled:props.disabled,type:"file","data-testid":"upload-file-input",style:{display:"none"},ref:fileInputRef,onChange:e=>onFileChange(e)}),props.children({onClick,disabled:props.disabled})]})}var import_jsx_runtime25=require("react/jsx-runtime");function AttachmentArrayInput(props){let[values,setValues]=(0,import_react22.useState)(props.defaultValue??[]),valuesRef=(0,import_react22.useRef)();valuesRef.current=values;function setValuesWrapper(newValues){setValues(newValues),props.onChange&&props.onChange(newValues)}return(0,import_jsx_runtime25.jsxs)("table",{style:{width:"100%"},children:[(0,import_jsx_runtime25.jsxs)("colgroup",{children:[(0,import_jsx_runtime25.jsx)("col",{width:"97%"}),(0,import_jsx_runtime25.jsx)("col",{width:"3%"})]}),(0,import_jsx_runtime25.jsxs)("tbody",{children:[values.map((v2,index)=>(0,import_jsx_runtime25.jsxs)("tr",{children:[(0,import_jsx_runtime25.jsx)("td",{children:(0,import_jsx_runtime25.jsx)(AttachmentDisplay,{value:v2,maxWidth:200})}),(0,import_jsx_runtime25.jsx)("td",{children:(0,import_jsx_runtime25.jsx)(import_core33.ActionIcon,{disabled:props.disabled,title:"Remove",variant:"subtle",size:"sm",color:"gray",onClick:e=>{killEvent(e);let copy=values.slice();copy.splice(index,1),setValuesWrapper(copy)},children:(0,import_jsx_runtime25.jsx)(IconCircleMinus,{})})})]},`${index}-${values.length}`)),(0,import_jsx_runtime25.jsxs)("tr",{children:[(0,import_jsx_runtime25.jsx)("td",{}),(0,import_jsx_runtime25.jsx)("td",{children:(0,import_jsx_runtime25.jsx)(AttachmentButton,{disabled:props.disabled,onUpload:attachment=>{setValuesWrapper([...valuesRef.current,attachment])},children:props2=>(0,import_jsx_runtime25.jsx)(import_core33.ActionIcon,{...props2,title:"Add",variant:"subtle",size:"sm",color:props2.disabled?"gray":"green",children:(0,import_jsx_runtime25.jsx)(IconCloudUpload,{})})})})]})]})]})}var import_core34=require("@mantine/core"),import_react23=require("react");var import_jsx_runtime26=require("react/jsx-runtime");function AttachmentInput(props){let[value,setValue]=(0,import_react23.useState)(props.defaultValue);function setValueWrapper(newValue){setValue(newValue),props.onChange&&props.onChange(newValue)}return value?(0,import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment,{children:[(0,import_jsx_runtime26.jsx)(AttachmentDisplay,{value,maxWidth:200}),(0,import_jsx_runtime26.jsx)(import_core34.Button,{disabled:props.disabled,onClick:e=>{killEvent(e),setValueWrapper(void 0)},children:"Remove"})]}):(0,import_jsx_runtime26.jsx)(AttachmentButton,{disabled:props.disabled,securityContext:props.securityContext,onUpload:setValueWrapper,children:props2=>(0,import_jsx_runtime26.jsx)(import_core34.Button,{...props2,children:"Upload..."})})}var import_core48=require("@medplum/core");var import_core46=require("@mantine/core"),import_core47=require("@medplum/core");var import_core35=require("@medplum/core"),import_jsx_runtime27=require("react/jsx-runtime");function CodeableConceptDisplay(props){return(0,import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment,{children:(0,import_core35.formatCodeableConcept)(props.value)})}var import_core36=require("@medplum/core"),import_jsx_runtime28=require("react/jsx-runtime");function CodingDisplay(props){return(0,import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment,{children:(0,import_core36.formatCoding)(props.value)})}var import_jsx_runtime29=require("react/jsx-runtime");function ContactPointDisplay(props){let contactPoint=props.value;if(!contactPoint)return null;let builder=[];return contactPoint.value&&builder.push(contactPoint.value),(contactPoint.use||contactPoint.system)&&(builder.push(" ["),contactPoint.use&&builder.push(contactPoint.use),contactPoint.use&&contactPoint.system&&builder.push(" "),contactPoint.system&&builder.push(contactPoint.system),builder.push("]")),(0,import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment,{children:builder.join("").trim()})}var import_jsx_runtime30=require("react/jsx-runtime");function ContactDetailDisplay(props){let contactDetail=props.value;return contactDetail?(0,import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment,{children:[contactDetail.name,contactDetail.name&&": ",contactDetail.telecom?.map(telecom=>(0,import_jsx_runtime30.jsx)(ContactPointDisplay,{value:telecom},`telecom-${contactDetail.name}-${telecom.value}`))]}):null}var import_jsx_runtime31=require("react/jsx-runtime");function IdentifierDisplay(props){return(0,import_jsx_runtime31.jsxs)("div",{children:[props.value?.system,": ",props.value?.value]})}var import_core37=require("@medplum/core"),import_jsx_runtime32=require("react/jsx-runtime");function MoneyDisplay(props){return(0,import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment,{children:(0,import_core37.formatMoney)(props.value)})}var import_core38=require("@medplum/core"),import_jsx_runtime33=require("react/jsx-runtime");function QuantityDisplay(props){return(0,import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment,{children:(0,import_core38.formatQuantity)(props.value)})}var import_core39=require("@medplum/core"),import_jsx_runtime34=require("react/jsx-runtime");function RangeDisplay(props){return(0,import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment,{children:(0,import_core39.formatRange)(props.value)})}var import_jsx_runtime35=require("react/jsx-runtime");function RatioDisplay(props){let value=props.value;return value?(0,import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment,{children:[(0,import_jsx_runtime35.jsx)(QuantityDisplay,{value:value.numerator}),"\xA0/\xA0",(0,import_jsx_runtime35.jsx)(QuantityDisplay,{value:value.denominator})]}):null}var import_core40=require("@medplum/core");var import_jsx_runtime36=require("react/jsx-runtime");function ReferenceDisplay(props){if(!props.value)return null;let displayString=props.value.display||props.value.reference||(0,import_core40.stringify)(props.value);return props.link!==!1&&props.value.reference?(0,import_jsx_runtime36.jsx)(MedplumLink,{to:props.value,children:displayString}):(0,import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment,{children:displayString})}var import_core43=require("@medplum/core");var import_react25=require("react");var import_core41=require("@medplum/core");function assignValuesIntoSlices(values,slices,slicing,profileUrl){if(!(0,import_core41.isPopulated)(slicing?.slices))return[values];let slicedValues=new Array(slices.length+1);for(let i=0;i<slicedValues.length;i++)slicedValues[i]=[];for(let value of values){let sliceName=(0,import_core41.getValueSliceName)(value,slices,slicing.discriminator,profileUrl),sliceIndex=sliceName?slices.findIndex(slice=>slice.name===sliceName):-1;sliceIndex===-1&&(sliceIndex=slices.length),slicedValues[sliceIndex].push(value)}return slicedValues}async function prepareSlices({medplum,property}){return new Promise((resolve,reject)=>{if(!property.slicing){resolve([]);return}let supportedSlices=[],profileUrls=[],promises=[];for(let slice of property.slicing.slices){if(!(0,import_core41.isSliceDefinitionWithTypes)(slice)){console.debug("Unsupported slice definition",slice);continue}let profileUrl;(0,import_core41.isPopulated)(slice.elements)||(profileUrl=slice.type[0]?.profile?.[0]),supportedSlices.push(slice),profileUrls.push(profileUrl),profileUrl&&promises.push(medplum.requestProfileSchema(profileUrl))}Promise.all(promises).then(()=>{for(let i=0;i<supportedSlices.length;i++){let slice=supportedSlices[i],profileUrl=profileUrls[i];if(profileUrl){let typeSchema=(0,import_core41.tryGetProfile)(profileUrl);slice.typeSchema=typeSchema}}resolve(supportedSlices)}).catch(reject)})}var import_core42=require("@medplum/core"),import_react24=require("react");var import_jsx_runtime37=require("react/jsx-runtime");function maybeWrapWithContext(ContextProvider,contextValue,contents){return contextValue!==void 0?(0,import_jsx_runtime37.jsx)(ContextProvider,{value:contextValue,children:contents}):contents}var import_jsx_runtime38=require("react/jsx-runtime");function SliceDisplay(props){let{slice,property}=props,sliceElements=slice.typeSchema?.elements??slice.elements,parentContext=(0,import_react24.useContext)(ElementsContext),contextValue=(0,import_react24.useMemo)(()=>{if((0,import_core42.isPopulated)(sliceElements))return(0,import_core42.buildElementsContext)({parentContext,elements:sliceElements,path:props.path,profileUrl:slice.typeSchema?.url})},[parentContext,props.path,slice.typeSchema?.url,sliceElements]);return maybeWrapWithContext(ElementsContext.Provider,contextValue,(0,import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment,{children:props.value.map((value,valueIndex)=>(0,import_jsx_runtime38.jsx)("div",{children:(0,import_jsx_runtime38.jsx)(ResourcePropertyDisplay,{property,path:props.path,arrayElement:!0,elementDefinitionType:slice.type[0],propertyType:slice.type[0].code,value,ignoreMissingValues:props.ignoreMissingValues,link:props.link})},`${valueIndex}-${props.value.length}`))}))}var import_jsx_runtime39=require("react/jsx-runtime");function ResourceArrayDisplay(props){let{property,propertyType}=props,medplum=b(),values=(0,import_react25.useMemo)(()=>Array.isArray(props.values)?props.values:[],[props.values]),[loading,setLoading]=(0,import_react25.useState)(!0),[slices,setSlices]=(0,import_react25.useState)([]),[slicedValues,setSlicedValues]=(0,import_react25.useState)(()=>[values]),ctx=(0,import_react25.useContext)(ElementsContext);if((0,import_react25.useEffect)(()=>{prepareSlices({medplum,property}).then(slices2=>{setSlices(slices2);let slicedValues2=assignValuesIntoSlices(values,slices2,property.slicing,ctx.profileUrl);setSlicedValues(slicedValues2),setLoading(!1)}).catch(reason=>{console.error(reason),setLoading(!1)})},[medplum,property,ctx.profileUrl,setSlicedValues,values]),loading)return(0,import_jsx_runtime39.jsx)("div",{children:"Loading..."});let nonSliceContent;if(property.type[0]?.code!=="Extension"){let nonSliceValues=slicedValues[slices.length],nonSliceElements=nonSliceValues.map((value,valueIndex)=>(0,import_jsx_runtime39.jsx)("div",{children:(0,import_jsx_runtime39.jsx)(ResourcePropertyDisplay,{path:props.path,arrayElement:!0,property,propertyType,value,ignoreMissingValues:props.ignoreMissingValues,link:props.link})},`${valueIndex}-${nonSliceValues.length}`));if(props.includeDescriptionListEntry){if(!(0,import_core43.isPopulated)(props.path))throw new Error("props.path is required when includeDescriptionListEntry is true");let key=props.path.split(".").pop();nonSliceContent=(0,import_jsx_runtime39.jsx)(DescriptionListEntry,{term:(0,import_core43.getPathDisplayName)(key),children:nonSliceElements})}else nonSliceContent=(0,import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment,{children:nonSliceElements})}return(0,import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment,{children:[slices.map((slice,sliceIndex)=>{if(!props.path)throw Error(`Displaying a resource property with slices of type ${props.propertyType} requires path`);let sliceDisplay=(0,import_jsx_runtime39.jsx)(SliceDisplay,{path:props.path,slice,property,value:slicedValues[sliceIndex],ignoreMissingValues:props.ignoreMissingValues,link:props.link},slice.name);return props.includeDescriptionListEntry&&(sliceDisplay=(0,import_jsx_runtime39.jsx)(DescriptionListEntry,{term:(0,import_core43.getPathDisplayName)(slice.name),children:sliceDisplay},slice.name)),sliceDisplay}),nonSliceContent]})}var import_core45=require("@medplum/core");var import_react26=require("react");var import_core44=require("@medplum/core");function getValueAndType(context,path,profileUrl){let typedResult=(0,import_core44.getTypedPropertyValue)(context,path,{profileUrl});return typedResult?Array.isArray(typedResult)?[typedResult.map(e=>e.value),typedResult[0].type]:[typedResult.value,typedResult.type]:[void 0,"undefined"]}function getValueAndTypeFromElement(typedValue,path,element){let typedResult=(0,import_core44.getTypedPropertyValueWithSchema)(typedValue,path,element);return typedResult?Array.isArray(typedResult)?[typedResult.map(e=>e.value),typedResult[0].type]:[typedResult.value,typedResult.type]:[void 0,"undefined"]}var import_jsx_runtime40=require("react/jsx-runtime");function ExtensionDisplay(props){let{elementDefinitionType}=props,medplum=b(),ctx=(0,import_react26.useContext)(ElementsContext),[typeSchema,setTypeSchema]=(0,import_react26.useState)((0,import_core45.getDataType)("Extension")),profileUrl=(0,import_react26.useMemo)(()=>{if((0,import_core45.isPopulated)(elementDefinitionType?.profile))return elementDefinitionType.profile[0]},[elementDefinitionType]),[loadingProfile,setLoadingProfile]=(0,import_react26.useState)(profileUrl!==void 0);if((0,import_react26.useEffect)(()=>{profileUrl&&(setLoadingProfile(!0),medplum.requestProfileSchema(profileUrl).then(()=>{let profile=(0,import_core45.tryGetProfile)(profileUrl);setLoadingProfile(!1),profile&&setTypeSchema(profile)}).catch(reason=>{setLoadingProfile(!1),console.warn(reason)}))},[medplum,profileUrl]),profileUrl&&(loadingProfile||!(0,import_core45.isProfileLoaded)(profileUrl)))return(0,import_jsx_runtime40.jsx)("div",{children:"Loading..."});if(typeSchema.elements["value[x]"]?.max!==0){let[propertyValue,propertyType]=getValueAndType({type:"Extension",value:props.value},"value[x]",profileUrl??ctx.profileUrl);return(0,import_jsx_runtime40.jsx)(ResourcePropertyDisplay,{propertyType,value:propertyValue})}return(0,import_jsx_runtime40.jsx)(BackboneElementDisplay,{path:props.path,value:{type:typeSchema.type,value:props.value},compact:props.compact,ignoreMissingValues:props.ignoreMissingValues,link:props.link,profileUrl})}var import_jsx_runtime41=require("react/jsx-runtime");function ResourcePropertyDisplay(props){let{property,propertyType,value}=props;if(property?.path?.endsWith(".id"))return(0,import_jsx_runtime41.jsxs)(import_core46.Box,{component:"div",style:{display:"flex",gap:3,alignItems:"center"},children:[value,!(0,import_core47.isEmpty)(value)&&(0,import_jsx_runtime41.jsx)(import_core46.CopyButton,{value,timeout:2e3,children:({copied,copy})=>(0,import_jsx_runtime41.jsx)(import_core46.Tooltip,{label:copied?"Copied":"Copy",withArrow:!0,position:"right",children:(0,import_jsx_runtime41.jsx)(import_core46.ActionIcon,{variant:"subtle",color:copied?"teal":"gray",onClick:copy,children:copied?(0,import_jsx_runtime41.jsx)(IconCheck,{size:"1rem"}):(0,import_jsx_runtime41.jsx)(IconCopy,{size:"1rem"})})})})]});if(property&&(property.isArray||property.max>1)&&!props.arrayElement)return propertyType===import_core47.PropertyType.Attachment?(0,import_jsx_runtime41.jsx)(AttachmentArrayDisplay,{values:value,maxWidth:props.maxWidth,includeDescriptionListEntry:props.includeArrayDescriptionListEntry,property,path:props.path}):(0,import_jsx_runtime41.jsx)(ResourceArrayDisplay,{path:props.path,property,propertyType,values:value,includeDescriptionListEntry:props.includeArrayDescriptionListEntry,ignoreMissingValues:props.ignoreMissingValues,link:props.link});switch(propertyType){case import_core47.PropertyType.boolean:return(0,import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment,{children:value===void 0?"":(!!value).toString()});case import_core47.PropertyType.SystemString:case import_core47.PropertyType.string:return(0,import_jsx_runtime41.jsx)("div",{style:{whiteSpace:"pre-wrap"},children:value});case import_core47.PropertyType.code:case import_core47.PropertyType.date:case import_core47.PropertyType.decimal:case import_core47.PropertyType.id:case import_core47.PropertyType.integer:case import_core47.PropertyType.positiveInt:case import_core47.PropertyType.unsignedInt:case import_core47.PropertyType.uri:case import_core47.PropertyType.url:return(0,import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment,{children:value});case import_core47.PropertyType.canonical:return(0,import_jsx_runtime41.jsx)(ReferenceDisplay,{value:{reference:value},link:props.link});case import_core47.PropertyType.dateTime:case import_core47.PropertyType.instant:return(0,import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment,{children:(0,import_core47.formatDateTime)(value)});case import_core47.PropertyType.markdown:return(0,import_jsx_runtime41.jsx)("pre",{children:value});case import_core47.PropertyType.Address:return(0,import_jsx_runtime41.jsx)(AddressDisplay,{value});case import_core47.PropertyType.Annotation:return(0,import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment,{children:value?.text});case import_core47.PropertyType.Attachment:return(0,import_jsx_runtime41.jsx)(AttachmentDisplay,{value,maxWidth:props.maxWidth});case import_core47.PropertyType.CodeableConcept:return(0,import_jsx_runtime41.jsx)(CodeableConceptDisplay,{value});case import_core47.PropertyType.Coding:return(0,import_jsx_runtime41.jsx)(CodingDisplay,{value});case import_core47.PropertyType.ContactDetail:return(0,import_jsx_runtime41.jsx)(ContactDetailDisplay,{value});case import_core47.PropertyType.ContactPoint:return(0,import_jsx_runtime41.jsx)(ContactPointDisplay,{value});case import_core47.PropertyType.HumanName:return(0,import_jsx_runtime41.jsx)(HumanNameDisplay,{value});case import_core47.PropertyType.Identifier:return(0,import_jsx_runtime41.jsx)(IdentifierDisplay,{value});case import_core47.PropertyType.Money:return(0,import_jsx_runtime41.jsx)(MoneyDisplay,{value});case import_core47.PropertyType.Period:return(0,import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment,{children:(0,import_core47.formatPeriod)(value)});case import_core47.PropertyType.Quantity:case import_core47.PropertyType.Duration:return(0,import_jsx_runtime41.jsx)(QuantityDisplay,{value});case import_core47.PropertyType.Range:return(0,import_jsx_runtime41.jsx)(RangeDisplay,{value});case import_core47.PropertyType.Ratio:return(0,import_jsx_runtime41.jsx)(RatioDisplay,{value});case import_core47.PropertyType.Reference:return(0,import_jsx_runtime41.jsx)(ReferenceDisplay,{value,link:props.link});case import_core47.PropertyType.Timing:return(0,import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment,{children:(0,import_core47.formatTiming)(value)});case import_core47.PropertyType.Dosage:case import_core47.PropertyType.UsageContext:if(!props.path)throw Error(`Displaying property of type ${props.propertyType} requires path`);return(0,import_jsx_runtime41.jsx)(BackboneElementDisplay,{path:props.path,value:{type:propertyType,value},compact:!0,ignoreMissingValues:props.ignoreMissingValues});case import_core47.PropertyType.Extension:if(!props.path)throw Error(`Displaying property of type ${props.propertyType} requires path`);return(0,import_jsx_runtime41.jsx)(ExtensionDisplay,{path:props.path,value,compact:!0,ignoreMissingValues:props.ignoreMissingValues,elementDefinitionType:props.elementDefinitionType});default:if(!property)throw Error(`Displaying property of type ${props.propertyType} requires element schema`);if(!props.path)throw Error(`Displaying property of type ${props.propertyType} requires path`);return(0,import_jsx_runtime41.jsx)(BackboneElementDisplay,{path:props.path,value:{type:property.type[0].code,value},compact:!0,ignoreMissingValues:props.ignoreMissingValues})}}var import_react27=require("react");var import_jsx_runtime42=require("react/jsx-runtime"),EXTENSION_KEYS2=["extension","modifierExtension"],IGNORED_PROPERTIES2=DEFAULT_IGNORED_PROPERTIES.filter(prop=>!EXTENSION_KEYS2.includes(prop));function BackboneElementDisplay(props){let typedValue=props.value,{value,type:typeName}=typedValue,parentElementsContext=(0,import_react27.useContext)(ElementsContext),profileUrl=props.profileUrl??parentElementsContext?.profileUrl,typeSchema=(0,import_react27.useMemo)(()=>(0,import_core48.tryGetDataType)(typeName,profileUrl),[profileUrl,typeName]),newElementsContext=(0,import_react27.useMemo)(()=>{if(typeSchema)return(0,import_core48.buildElementsContext)({parentContext:parentElementsContext,elements:typeSchema.elements,path:props.path,profileUrl:typeSchema.url,accessPolicyResource:props.accessPolicyResource})},[typeSchema,parentElementsContext,props.path,props.accessPolicyResource]);if((0,import_core48.isEmpty)(value))return null;if(!typeSchema)return(0,import_jsx_runtime42.jsxs)("div",{children:[typeName,"\xA0not implemented"]});if(typeof value=="object"&&"name"in value&&Object.keys(value).length===1&&typeof value.name=="string")return(0,import_jsx_runtime42.jsx)("div",{children:value.name});let elementsContext=newElementsContext??parentElementsContext;return maybeWrapWithContext(ElementsContext.Provider,newElementsContext,(0,import_jsx_runtime42.jsx)(DescriptionList,{compact:props.compact,children:Object.entries(elementsContext.elements).map(([key,property])=>{if(EXTENSION_KEYS2.includes(key)&&(0,import_core48.isEmpty)(property.slicing?.slices))return null;if(IGNORED_PROPERTIES2.includes(key))return null;if(DEFAULT_IGNORED_NON_NESTED_PROPERTIES.includes(key)&&property.path.split(".").length===2||key.includes("."))return null;let[propertyValue,propertyType]=getValueAndType(typedValue,key,elementsContext.profileUrl);if((props.ignoreMissingValues||property.max===0)&&(0,import_core48.isEmpty)(propertyValue)||props.path.endsWith(".extension")&&(key==="url"||key==="id"))return null;let isArrayProperty=property.max>1||property.isArray,resourcePropertyDisplay=(0,import_jsx_runtime42.jsx)(ResourcePropertyDisplay,{property,propertyType,path:props.path+"."+key,value:propertyValue,ignoreMissingValues:props.ignoreMissingValues,includeArrayDescriptionListEntry:isArrayProperty,link:props.link},key);return isArrayProperty?resourcePropertyDisplay:(0,import_jsx_runtime42.jsx)(DescriptionListEntry,{term:(0,import_core48.getPathDisplayName)(key),children:resourcePropertyDisplay},key)})}))}var import_core82=require("@medplum/core"),import_react50=require("react");var import_core80=require("@mantine/core"),import_core81=require("@medplum/core"),import_react49=require("react");var import_core50=require("@mantine/core"),import_react28=require("react");var import_core49=require("@mantine/core"),import_jsx_runtime43=require("react/jsx-runtime"),READ_ONLY_TOOLTIP_TEXT="Read Only";function maybeWrapWithTooltip(tooltipText,children){return tooltipText?(0,import_jsx_runtime43.jsx)(import_core49.Tooltip.Floating,{label:tooltipText,children}):children}var FormSection_default={dimmed:"FormSection_dimmed"};var import_jsx_runtime44=require("react/jsx-runtime");function CheckboxFormSection(props){let{debugMode}=(0,import_react28.useContext)(ElementsContext),label;return debugMode&&props.fhirPath?label=`${props.title} - ${props.fhirPath}`:label=props.title,maybeWrapWithTooltip(props?.readonly?READ_ONLY_TOOLTIP_TEXT:void 0,(0,import_jsx_runtime44.jsxs)(import_core50.Group,{wrap:"nowrap","data-testid":props.testId,children:[(0,import_jsx_runtime44.jsx)("div",{children:props.children}),(0,import_jsx_runtime44.jsx)("div",{children:(0,import_jsx_runtime44.jsx)(import_core50.Input.Wrapper,{id:props.htmlFor,label,classNames:{label:props?.readonly?FormSection_default.dimmed:void 0},description:props.description,withAsterisk:props.withAsterisk,children:null})})]}))}var import_core51=require("@mantine/core"),import_react29=require("react");function getErrorsForInput(outcome,expression){return outcome?.issue?.filter(issue=>isExpressionMatch(issue.expression?.[0],expression))?.map(issue=>issue.details?.text)?.join(`
65
- `)}function getIssuesForExpression(outcome,expression){return outcome?.issue?.filter(issue=>isExpressionMatch(issue.expression?.[0],expression))}var ARRAY_INDEX_REGEX=/\[\d+\]/;function isExpressionMatch(expr1,expr2){let isExpr1Indexed=typeof expr1=="string"&&ARRAY_INDEX_REGEX.test(expr1),isExpr2Indexed=typeof expr2=="string"&&ARRAY_INDEX_REGEX.test(expr2);if(isExpr1Indexed!==isExpr2Indexed&&(expr1=expr1?.replace(ARRAY_INDEX_REGEX,""),expr2=expr2?.replace(ARRAY_INDEX_REGEX,"")),expr1===expr2)return!0;if(!expr1||!expr2)return!1;let dot1=expr1.indexOf(".");if(dot1>=0&&expr1.substring(dot1+1)===expr2)return!0;let dot2=expr2.indexOf(".");return dot2>=0&&expr2.substring(dot2+1)===expr1}var import_jsx_runtime45=require("react/jsx-runtime");function FormSection(props){let{debugMode}=(0,import_react29.useContext)(ElementsContext),label;return debugMode&&props.fhirPath?label=`${props.title} - ${props.fhirPath}`:label=props.title,maybeWrapWithTooltip(props?.readonly?READ_ONLY_TOOLTIP_TEXT:void 0,(0,import_jsx_runtime45.jsx)(import_core51.Input.Wrapper,{id:props.htmlFor,label,classNames:{label:props?.readonly?FormSection_default.dimmed:void 0},description:props.description,withAsterisk:props.withAsterisk,error:getErrorsForInput(props.outcome,props.errorExpression??props.htmlFor),"data-testid":props.testId,children:props.children}))}var import_core52=require("@medplum/core");function setPropertyValue(obj,key,propName,elementDefinition,value){let types=elementDefinition.type;if(types.length>1)for(let type of types){let compoundKey=key.replace("[x]",(0,import_core52.capitalize)(type.code));compoundKey in obj&&delete obj[compoundKey]}return obj[propName]=value,obj}function isSupportedProfileStructureDefinition(profile){return!!profile&&!(0,import_core52.isEmpty)(profile.url)&&!(0,import_core52.isEmpty)(profile.name)}var import_core78=require("@mantine/core"),import_core79=require("@medplum/core"),import_react48=require("react");var import_react30=require("react");var import_jsx_runtime46=require("react/jsx-runtime");function CodeableConceptInput(props){let{defaultValue:defaultValue2,onChange,withHelpText,outcome:_outcome,path:_path,valuePath:_valuePath,...rest}=props,[value,setValue]=(0,import_react30.useState)(defaultValue2);function handleChange(newValues){let newConcept=valueSetElementToCodeableConcept(newValues);setValue(newConcept),onChange&&onChange(newConcept)}return(0,import_jsx_runtime46.jsx)(ValueSetAutocomplete,{defaultValue:value&&codeableConceptToValueSetElement(value),onChange:handleChange,withHelpText:withHelpText??!0,...rest})}function codeableConceptToValueSetElement(concept){return concept.coding?.map(c=>({system:c.system,code:c.code,display:c.display}))}function valueSetElementToCodeableConcept(elements){if(elements.length!==0)return{coding:elements.map(e=>({system:e.system,code:e.code,display:e.display}))}}var import_react31=require("react");var import_jsx_runtime47=require("react/jsx-runtime");function CodingInput(props){let{defaultValue:defaultValue2,onChange,withHelpText,...rest}=props,[value,setValue]=(0,import_react31.useState)(defaultValue2);function handleChange(newValues){let newValue=newValues[0],newConcept=newValue&&valueSetElementToCoding(newValue);setValue(newConcept),onChange&&onChange(newConcept)}return(0,import_jsx_runtime47.jsx)(ValueSetAutocomplete,{defaultValue:value&&codingToValueSetElement(value),maxValues:1,onChange:handleChange,withHelpText:withHelpText??!0,...rest})}function codingToValueSetElement(coding){return{system:coding.system,code:coding.code,display:coding.display}}function valueSetElementToCoding(element){return{system:element.system,code:element.code,display:element.display}}var import_core54=require("@mantine/core"),import_react33=require("react");var import_core53=require("@mantine/core"),import_react32=require("react");var import_jsx_runtime48=require("react/jsx-runtime");function ContactPointInput(props){let{path,outcome}=props,{elementsByPath,getExtendedProps}=(0,import_react32.useContext)(ElementsContext),[contactPoint,setContactPoint]=(0,import_react32.useState)(props.defaultValue),ref=(0,import_react32.useRef)();ref.current=contactPoint;let[systemElement,useElement,valueElement]=(0,import_react32.useMemo)(()=>["system","use","value"].map(field=>elementsByPath[path+"."+field]),[elementsByPath,path]),[systemProps,useProps,valueProps]=(0,import_react32.useMemo)(()=>["system","use","value"].map(field=>getExtendedProps(path+"."+field)),[getExtendedProps,path]);function setContactPointWrapper(newValue){newValue&&Object.keys(newValue).length===0&&(newValue=void 0),setContactPoint(newValue),props.onChange&&props.onChange(newValue)}function setSystem(system){let newValue={...ref.current,system};system||delete newValue.system,setContactPointWrapper(newValue)}function setUse(use){let newValue={...ref.current,use};use||delete newValue.use,setContactPointWrapper(newValue)}function setValue(value){let newValue={...ref.current,value};value||delete newValue.value,setContactPointWrapper(newValue)}let errorPath=props.valuePath??path;return(0,import_jsx_runtime48.jsxs)(import_core53.Group,{gap:"xs",grow:!0,wrap:"nowrap",align:"flex-start",children:[(0,import_jsx_runtime48.jsx)(import_core53.NativeSelect,{disabled:props.disabled||systemProps?.readonly,"data-testid":"system",defaultValue:contactPoint?.system,required:(systemElement?.min??0)>0,onChange:e=>setSystem(e.currentTarget.value),data:["","email","phone","fax","pager","sms","other"],error:getErrorsForInput(outcome,errorPath+".system")}),(0,import_jsx_runtime48.jsx)(import_core53.NativeSelect,{disabled:props.disabled||useProps?.readonly,"data-testid":"use",defaultValue:contactPoint?.use,required:(useElement?.min??0)>0,onChange:e=>setUse(e.currentTarget.value),data:["","home","work","temp","old","mobile"],error:getErrorsForInput(outcome,errorPath+".use")}),(0,import_jsx_runtime48.jsx)(import_core53.TextInput,{disabled:props.disabled||valueProps?.readonly,placeholder:"Value",defaultValue:contactPoint?.value,required:(valueElement?.min??0)>0,onChange:e=>setValue(e.currentTarget.value),error:getErrorsForInput(outcome,errorPath+".value")})]})}var import_jsx_runtime49=require("react/jsx-runtime");function ContactDetailInput(props){let[contactPoint,setContactDetail]=(0,import_react33.useState)(props.defaultValue),ref=(0,import_react33.useRef)();ref.current=contactPoint;let{getExtendedProps}=(0,import_react33.useContext)(ElementsContext),[nameProps,telecomProps]=(0,import_react33.useMemo)(()=>["name","telecom"].map(field=>getExtendedProps(props.path+"."+field)),[getExtendedProps,props.path]);function setContactDetailWrapper(newValue){setContactDetail(newValue),props.onChange&&props.onChange(newValue)}function setName(name){let newValue={...ref.current,name};name||delete newValue.name,setContactDetailWrapper(newValue)}function setTelecom(telecom){let newValue={...ref.current,telecom:telecom&&[telecom]};telecom||delete newValue.telecom,setContactDetailWrapper(newValue)}return(0,import_jsx_runtime49.jsxs)(import_core54.Group,{gap:"xs",grow:!0,wrap:"nowrap",children:[(0,import_jsx_runtime49.jsx)(import_core54.TextInput,{disabled:props.disabled||nameProps?.readonly,"data-testid":props.name+"-name",name:props.name+"-name",placeholder:"Name",style:{width:180},defaultValue:contactPoint?.name,onChange:e=>setName(e.currentTarget.value)}),(0,import_jsx_runtime49.jsx)(ContactPointInput,{disabled:props.disabled||telecomProps?.readonly,name:props.name+"-telecom",path:props.path+".telecom",defaultValue:contactPoint?.telecom?.[0],onChange:setTelecom,outcome:props.outcome})]})}var import_core56=require("@mantine/core");var import_core55=require("@medplum/core");function convertIsoToLocal(isoString){if(!isoString)return"";let date=new Date(isoString);return(0,import_core55.isValidDate)(date)?date.toLocaleDateString("sv")+"T"+date.toLocaleTimeString("sv"):""}function convertLocalToIso(localString){if(!localString)return"";let date=new Date(localString);return(0,import_core55.isValidDate)(date)?date.toISOString():""}var import_jsx_runtime50=require("react/jsx-runtime");function DateTimeInput(props){return(0,import_jsx_runtime50.jsx)(import_core56.TextInput,{id:props.name,name:props.name,label:props.label,"data-autofocus":props.autoFocus,"data-testid":props["data-testid"]??props.name,placeholder:props.placeholder,required:props.required,disabled:props.disabled,type:getInputType(),defaultValue:convertIsoToLocal(props.defaultValue),autoFocus:props.autoFocus,error:getErrorsForInput(props.outcome,props.name),onChange:e=>{if(props.onChange){let newValue=e.currentTarget.value;props.onChange(convertLocalToIso(newValue))}}})}function getInputType(){return"datetime-local"}var import_core57=require("@medplum/core");var import_react34=require("react");var import_jsx_runtime51=require("react/jsx-runtime");function ExtensionInput(props){let{propertyType}=props,medplum=b(),profileUrl=(0,import_react34.useMemo)(()=>{if((0,import_core57.isPopulated)(propertyType.profile))return propertyType.profile[0]},[propertyType]),[loadingProfile,setLoadingProfile]=(0,import_react34.useState)(profileUrl!==void 0);return(0,import_react34.useEffect)(()=>{profileUrl&&(setLoadingProfile(!0),medplum.requestProfileSchema(profileUrl).then(()=>setLoadingProfile(!1)).catch(reason=>{setLoadingProfile(!1),console.warn(reason)}))},[medplum,profileUrl]),profileUrl&&(loadingProfile||!(0,import_core57.isProfileLoaded)(profileUrl))?(0,import_jsx_runtime51.jsx)("div",{children:"Loading..."}):(0,import_jsx_runtime51.jsx)(BackboneElementInput,{profileUrl,path:props.path,typeName:"Extension",defaultValue:props.defaultValue,onChange:props.onChange})}var import_core58=require("@mantine/core"),import_react35=require("react");var import_jsx_runtime52=require("react/jsx-runtime");function HumanNameInput(props){let{outcome,path}=props,[value,setValue]=(0,import_react35.useState)(props.defaultValue),{getExtendedProps}=(0,import_react35.useContext)(ElementsContext),[useProps,prefixProps,givenProps,familyProps,suffixProps]=(0,import_react35.useMemo)(()=>["use","prefix","given","family","suffix"].map(field=>getExtendedProps(props.path+"."+field)),[getExtendedProps,props.path]);function setValueWrapper(newValue){setValue(newValue),props.onChange&&props.onChange(newValue)}function setUse(use){setValueWrapper({...value,use:use||void 0})}function setPrefix(prefix){setValueWrapper({...value,prefix:prefix?prefix.split(" "):void 0})}function setGiven(given){setValueWrapper({...value,given:given?given.split(" "):void 0})}function setFamily(family){setValueWrapper({...value,family:family||void 0})}function setSuffix(suffix){setValueWrapper({...value,suffix:suffix?suffix.split(" "):void 0})}let errorPath=props.valuePath??path;return(0,import_jsx_runtime52.jsxs)(import_core58.Group,{gap:"xs",grow:!0,wrap:"nowrap",children:[(0,import_jsx_runtime52.jsx)(import_core58.NativeSelect,{disabled:props.disabled||useProps?.readonly,defaultValue:value?.use,name:props.name+"-use","data-testid":"use",onChange:e=>setUse(e.currentTarget.value),data:["","temp","old","usual","official","nickname","anonymous","maiden"],error:getErrorsForInput(outcome,errorPath+".use")}),(0,import_jsx_runtime52.jsx)(import_core58.TextInput,{disabled:props.disabled||prefixProps?.readonly,placeholder:"Prefix",name:props.name+"-prefix",defaultValue:value?.prefix?.join(" "),onChange:e=>setPrefix(e.currentTarget.value),error:getErrorsForInput(outcome,errorPath+".prefix")}),(0,import_jsx_runtime52.jsx)(import_core58.TextInput,{disabled:props.disabled||givenProps?.readonly,placeholder:"Given",name:props.name+"-given",defaultValue:value?.given?.join(" "),onChange:e=>setGiven(e.currentTarget.value),error:getErrorsForInput(outcome,errorPath+".given")}),(0,import_jsx_runtime52.jsx)(import_core58.TextInput,{disabled:props.disabled||familyProps?.readonly,name:props.name+"-family",placeholder:"Family",defaultValue:value?.family,onChange:e=>setFamily(e.currentTarget.value),error:getErrorsForInput(outcome,errorPath+".family")}),(0,import_jsx_runtime52.jsx)(import_core58.TextInput,{disabled:props.disabled||suffixProps?.readonly,placeholder:"Suffix",name:props.name+"-suffix",defaultValue:value?.suffix?.join(" "),onChange:e=>setSuffix(e.currentTarget.value),error:getErrorsForInput(outcome,errorPath+".suffix")})]})}var import_core59=require("@mantine/core"),import_react36=require("react");var import_jsx_runtime53=require("react/jsx-runtime");function IdentifierInput(props){let[value,setValue]=(0,import_react36.useState)(props.defaultValue),{elementsByPath,getExtendedProps}=(0,import_react36.useContext)(ElementsContext),[systemElement,valueElement]=(0,import_react36.useMemo)(()=>["system","value"].map(field=>elementsByPath[props.path+"."+field]),[elementsByPath,props.path]),[systemProps,valueProps]=(0,import_react36.useMemo)(()=>["system","value"].map(field=>getExtendedProps(props.path+"."+field)),[getExtendedProps,props.path]);function setValueWrapper(newValue){setValue(newValue),props.onChange&&props.onChange(newValue)}let errorPath=props.valuePath??props.path;return(0,import_jsx_runtime53.jsxs)(import_core59.Group,{gap:"xs",grow:!0,wrap:"nowrap",align:"flex-start",children:[(0,import_jsx_runtime53.jsx)(import_core59.TextInput,{disabled:props.disabled||systemProps?.readonly,placeholder:"System",required:(systemElement?.min??0)>0,defaultValue:value?.system,onChange:e=>setValueWrapper({...value,system:e.currentTarget.value}),error:getErrorsForInput(props.outcome,errorPath+".system")}),(0,import_jsx_runtime53.jsx)(import_core59.TextInput,{disabled:props.disabled||valueProps?.readonly,placeholder:"Value",required:(valueElement?.min??0)>0,defaultValue:value?.value,onChange:e=>setValueWrapper({...value,value:e.currentTarget.value}),error:getErrorsForInput(props.outcome,errorPath+".value")})]})}var import_core60=require("@mantine/core");var import_react37=require("react");var import_jsx_runtime54=require("react/jsx-runtime"),data=["USD","EUR","CAD","GBP","AUD"];function MoneyInput(props){let{onChange}=props,[value,setValue]=(0,import_react37.useState)(props.defaultValue),{getExtendedProps}=(0,import_react37.useContext)(ElementsContext),[currencyProps,valueProps]=(0,import_react37.useMemo)(()=>["currency","value"].map(field=>getExtendedProps(props.path+"."+field)),[getExtendedProps,props.path]),setValueWrapper=(0,import_react37.useCallback)(newValue=>{setValue(newValue),onChange&&onChange(newValue)},[onChange]),handleCurrencyChange=(0,import_react37.useCallback)(e=>{setValueWrapper({...value,currency:e.currentTarget.value})},[value,setValueWrapper]),handleValueChange=(0,import_react37.useCallback)(e=>{setValueWrapper({...value,value:e.currentTarget.valueAsNumber})},[value,setValueWrapper]),select=(0,import_jsx_runtime54.jsx)(import_core60.NativeSelect,{disabled:props.disabled||currencyProps?.readonly,defaultValue:value?.currency,data,styles:{input:{fontWeight:500,borderTopLeftRadius:0,borderBottomLeftRadius:0,width:92}},onChange:handleCurrencyChange});return(0,import_jsx_runtime54.jsx)(import_core60.TextInput,{disabled:props.disabled||valueProps?.readonly,type:"number",name:props.name,label:props.label,placeholder:props.placeholder??"Value",defaultValue:value?.value?.toString()??"USD",leftSection:(0,import_jsx_runtime54.jsx)(IconCurrencyDollar,{size:14}),rightSection:select,rightSectionWidth:92,onChange:handleValueChange})}var import_core61=require("@mantine/core"),import_react38=require("react");var import_jsx_runtime55=require("react/jsx-runtime");function PeriodInput(props){let[value,setValue]=(0,import_react38.useState)(props.defaultValue),{getExtendedProps}=(0,import_react38.useContext)(ElementsContext),[startProps,endProps]=(0,import_react38.useMemo)(()=>["start","end"].map(field=>getExtendedProps(props.path+"."+field)),[getExtendedProps,props.path]);function setValueWrapper(newValue){setValue(newValue),props.onChange&&props.onChange(newValue)}return(0,import_jsx_runtime55.jsxs)(import_core61.Group,{gap:"xs",grow:!0,wrap:"nowrap",children:[(0,import_jsx_runtime55.jsx)(DateTimeInput,{disabled:props.disabled||startProps?.readonly,name:props.name+".start",placeholder:"Start",defaultValue:value?.start,onChange:newValue=>setValueWrapper({...value,start:newValue})}),(0,import_jsx_runtime55.jsx)(DateTimeInput,{disabled:props.disabled||endProps?.readonly,name:props.name+".end",placeholder:"End",defaultValue:value?.end,onChange:newValue=>setValueWrapper({...value,end:newValue})})]})}var import_core62=require("@mantine/core"),import_react39=require("react");var import_jsx_runtime56=require("react/jsx-runtime");function QuantityInput(props){let[value,setValue]=(0,import_react39.useState)(props.defaultValue),{getExtendedProps}=(0,import_react39.useContext)(ElementsContext),[comparatorProps,valueProps,unitProps]=(0,import_react39.useMemo)(()=>["comparator","value","unit"].map(field=>getExtendedProps(props.path+"."+field)),[getExtendedProps,props.path]);function setValueWrapper(newValue){setValue(newValue),props.onChange&&props.onChange(newValue)}return(0,import_jsx_runtime56.jsxs)(import_core62.Group,{gap:"xs",grow:!0,wrap:"nowrap",children:[(0,import_jsx_runtime56.jsx)(import_core62.NativeSelect,{disabled:props.disabled||comparatorProps?.readonly,style:{width:80},"data-testid":props.name+"-comparator",defaultValue:value?.comparator,data:["","<","<=",">=",">"],onChange:e=>setValueWrapper({...value,comparator:e.currentTarget.value})}),(0,import_jsx_runtime56.jsx)(import_core62.TextInput,{disabled:props.disabled||valueProps?.readonly,id:props.name,name:props.name,required:props.required,"data-autofocus":props.autoFocus,"data-testid":props.name+"-value",type:"number",placeholder:"Value",defaultValue:value?.value,autoFocus:props.autoFocus,step:"any",onWheel:e=>{props.disableWheel&&e.currentTarget.blur()},onChange:e=>{setValueWrapper({...value,value:tryParseNumber(e.currentTarget.value)})}}),(0,import_jsx_runtime56.jsx)(import_core62.TextInput,{disabled:props.disabled||unitProps?.readonly,placeholder:"Unit","data-testid":props.name+"-unit",defaultValue:value?.unit,onChange:e=>setValueWrapper({...value,unit:e.currentTarget.value})})]})}function tryParseNumber(str){if(str)return parseFloat(str)}var import_core63=require("@mantine/core"),import_react40=require("react");var import_jsx_runtime57=require("react/jsx-runtime");function RangeInput(props){let[value,setValue]=(0,import_react40.useState)(props.defaultValue),{getExtendedProps}=(0,import_react40.useContext)(ElementsContext),[lowProps,highProps]=(0,import_react40.useMemo)(()=>["low","high"].map(field=>getExtendedProps(props.path+"."+field)),[getExtendedProps,props.path]);function setValueWrapper(newValue){setValue(newValue),props.onChange&&props.onChange(newValue)}return(0,import_jsx_runtime57.jsxs)(import_core63.Group,{gap:"xs",grow:!0,wrap:"nowrap",children:[(0,import_jsx_runtime57.jsx)(QuantityInput,{path:props.path+".low",disabled:props.disabled||lowProps?.readonly,name:props.name+"-low",defaultValue:value?.low,onChange:v2=>setValueWrapper({...value,low:v2})}),(0,import_jsx_runtime57.jsx)(QuantityInput,{path:props.path+".high",disabled:props.disabled||highProps?.readonly,name:props.name+"-high",defaultValue:value?.high,onChange:v2=>setValueWrapper({...value,high:v2})})]})}var import_core64=require("@mantine/core"),import_react41=require("react");var import_jsx_runtime58=require("react/jsx-runtime");function RatioInput(props){let[value,setValue]=(0,import_react41.useState)(props.defaultValue),{getExtendedProps}=(0,import_react41.useContext)(ElementsContext),[numeratorProps,denominatorProps]=(0,import_react41.useMemo)(()=>["numerator","denominator"].map(field=>getExtendedProps(props.path+"."+field)),[getExtendedProps,props.path]);function setValueWrapper(newValue){setValue(newValue),props.onChange&&props.onChange(newValue)}return(0,import_jsx_runtime58.jsxs)(import_core64.Group,{gap:"xs",grow:!0,wrap:"nowrap",children:[(0,import_jsx_runtime58.jsx)(QuantityInput,{path:props.path+".numerator",disabled:props.disabled||numeratorProps?.readonly,name:props.name+"-numerator",defaultValue:value?.numerator,onChange:v2=>setValueWrapper({...value,numerator:v2})}),(0,import_jsx_runtime58.jsx)(QuantityInput,{path:props.path+".denominator",disabled:props.disabled||denominatorProps?.readonly,name:props.name+"-denominator",defaultValue:value?.denominator,onChange:v2=>setValueWrapper({...value,denominator:v2})})]})}var import_core67=require("@mantine/core"),import_core68=require("@medplum/core");var import_react43=require("react");var import_core65=require("@mantine/core"),import_core66=require("@medplum/core");var import_react42=require("react");var import_jsx_runtime59=require("react/jsx-runtime"),SEARCH_CODES={Device:"device-name",Observation:"code",Subscription:"criteria",User:"email:contains"},NAME_RESOURCE_TYPES=["AccessPolicy","Account","ActivityDefinition","Bot","CapabilityStatement","CareTeam","ClientApplication","CodeSystem","CompartmentDefinition","ConceptMap","EffectEvidenceSynthesis","Endpoint","EventDefinition","Evidence","EvidenceVariable","ExampleScenario","GraphDefinition","Group","HealthcareService","ImplementationGuide","InsurancePlan","Library","Location","Measure","MedicinalProduct","MessageDefinition","NamingSystem","OperationDefinition","Organization","Patient","Person","PlanDefinition","Practitioner","Project","Questionnaire","RelatedPerson","ResearchDefinition","ResearchElementDefinition","RiskEvidenceSynthesis","SearchParameter","StructureDefinition","StructureMap","TerminologyCapabilities","TestScript","UserConfiguration","ValueSet"];function toOption3(resource){return{value:(0,import_core66.getReferenceString)(resource),label:(0,import_core66.getDisplayString)(resource),resource}}function ResourceInput(props){let medplum=b(),{resourceType,searchCriteria}=props,[outcome,setOutcome]=(0,import_react42.useState)(),defaultValue2=Te(props.defaultValue,setOutcome),ItemComponent3=props.itemComponent??DefaultItemComponent2,onChange=props.onChange,loadValues=(0,import_react42.useCallback)(async(input,signal)=>{let searchCode=getSearchParamForResourceType(resourceType),searchParams=new URLSearchParams({[searchCode]:input??"",_count:"10",...searchCriteria});return await medplum.searchResources(resourceType,searchParams,{signal})},[medplum,resourceType,searchCriteria]),handleChange=(0,import_react42.useCallback)(newResources=>{onChange&&onChange(newResources[0])},[onChange]);return(0,import_core66.isPopulated)(props.defaultValue)&&!outcome&&!defaultValue2?null:(0,import_jsx_runtime59.jsx)(AsyncAutocomplete,{disabled:props.disabled,name:props.name,required:props.required,itemComponent:ItemComponent3,defaultValue:defaultValue2,placeholder:props.placeholder,maxValues:1,toOption:toOption3,loadOptions:loadValues,onChange:handleChange,clearable:!0})}var DefaultItemComponent2=(0,import_react42.forwardRef)(({label,resource,active:_active,...others},ref)=>(0,import_jsx_runtime59.jsx)("div",{ref,...others,children:(0,import_jsx_runtime59.jsxs)(import_core65.Group,{wrap:"nowrap",children:[(0,import_jsx_runtime59.jsx)(ResourceAvatar,{value:resource}),(0,import_jsx_runtime59.jsxs)("div",{children:[(0,import_jsx_runtime59.jsx)(import_core65.Text,{children:label}),(0,import_jsx_runtime59.jsx)(import_core65.Text,{size:"xs",c:"dimmed",children:resource.birthDate||resource.id})]})]})}));function getSearchParamForResourceType(resourceType){return SEARCH_CODES[resourceType]??(NAME_RESOURCE_TYPES.includes(resourceType)?"name":"_id")}var import_jsx_runtime60=require("react/jsx-runtime");function ReferenceInput(props){let{onChange}=props,medplum=b(),[value,setValue]=(0,import_react43.useState)(props.defaultValue),[targetTypes,setTargetTypes]=(0,import_react43.useState)(()=>createTargetTypes(props.targetTypes)),[targetType,setTargetType]=(0,import_react43.useState)(()=>getInitialTargetType(props.defaultValue,targetTypes)),promiseCache=(0,import_react43.useRef)(new import_core68.LRUCache),searchCriteria=(0,import_react43.useMemo)(()=>targetType?.type==="profile"?{...props.searchCriteria,_profile:targetType.value}:props.searchCriteria,[props.searchCriteria,targetType]);(0,import_react43.useEffect)(()=>{let anyToFetch=!1,newTargetTypePromises=targetTypes?.map(tt=>{if(!shouldFetchResourceType(tt))return Promise.resolve(tt);anyToFetch=!0;let cacheKey=tt.value,cached=promiseCache.current.get(cacheKey);if(cached)return cached;let promise=fetchResourceTypeOfProfile(medplum,tt.value).then(profile=>{let newTargetType={...tt};return profile?(0,import_core68.isPopulated)(profile.type)?(newTargetType.resourceType=profile.type,newTargetType.name=profile.name,newTargetType.title=profile.title):(console.error(`StructureDefinition.type missing for ${tt.value}`),newTargetType.error="StructureDefinition.type missing"):(console.error(`StructureDefinition not found for ${tt.value}`),newTargetType.error="StructureDefinition not found"),newTargetType}).catch(reason=>(console.error(reason),{...tt,error:reason})),readablePromise=new import_core68.ReadablePromise(promise);return promiseCache.current.set(cacheKey,readablePromise),readablePromise});!newTargetTypePromises||!anyToFetch||Promise.all(newTargetTypePromises).then(newTargetTypes=>{if(setTargetTypes(newTargetTypes),!targetType)return;let index=newTargetTypes.findIndex(tt=>tt.value===targetType.value||tt.resourceType===targetType.resourceType);if(index===-1){console.debug(`defaultValue had unexpected resourceType: ${targetType.resourceType}`);return}setTargetType(newTargetTypes[index])}).catch(console.error)},[medplum,targetType,targetTypes]);let setValueHelper=(0,import_react43.useCallback)(item=>{let newValue=item?(0,import_core68.createReference)(item):void 0;setValue(newValue),onChange&&onChange(newValue)},[onChange]),typeSelectOptions=(0,import_react43.useMemo)(()=>targetTypes?targetTypes.map(tt=>({value:tt.value,label:tt.type==="profile"?tt.title??tt.name??tt.resourceType??tt.value:tt.value})):[],[targetTypes]);return(0,import_jsx_runtime60.jsxs)(import_core67.Group,{gap:"xs",grow:!0,wrap:"nowrap",children:[targetTypes&&targetTypes.length>1&&(0,import_jsx_runtime60.jsx)(import_core67.NativeSelect,{disabled:props.disabled,"data-autofocus":props.autoFocus,"data-testid":"reference-input-resource-type-select",defaultValue:targetType?.resourceType,autoFocus:props.autoFocus,onChange:e=>{let newValue=e.currentTarget.value,newTargetType=targetTypes.find(tt=>tt.value===newValue);setTargetType(newTargetType)},data:typeSelectOptions}),!targetTypes&&(0,import_jsx_runtime60.jsx)(ResourceTypeInput,{disabled:props.disabled,autoFocus:props.autoFocus,testId:"reference-input-resource-type-input",defaultValue:targetType?.resourceType,onChange:newResourceType=>{setTargetType(newResourceType?{type:"resourceType",value:newResourceType,resourceType:newResourceType}:void 0)},name:props.name+"-resourceType",placeholder:"Resource Type"}),(0,import_jsx_runtime60.jsx)(ResourceInput,{resourceType:targetType?.resourceType,name:props.name+"-id",required:props.required,placeholder:props.placeholder,defaultValue:value,searchCriteria,onChange:setValueHelper,disabled:props.disabled})]})}function createTargetTypes(resourceTypesAndProfileUrls){if(!resourceTypesAndProfileUrls||resourceTypesAndProfileUrls.length===0||resourceTypesAndProfileUrls.length===1&&resourceTypesAndProfileUrls[0]==="Resource")return;let results=[];for(let value of resourceTypesAndProfileUrls)value.includes("/")?results.push({type:"profile",value}):results.push({type:"resourceType",value,resourceType:value});return results}function getInitialTargetType(defaultValue2,targetTypes){let defaultValueResourceType=defaultValue2?.reference?.split("/")[0];if(defaultValueResourceType){let targetType=targetTypes?.find(tt=>tt.resourceType===defaultValueResourceType);return targetType||{type:"resourceType",value:defaultValueResourceType,resourceType:defaultValueResourceType}}if(targetTypes&&targetTypes.length>0)return targetTypes[0]}async function fetchResourceTypeOfProfile(medplum,profileUrl){let profile=(0,import_core68.tryGetProfile)(profileUrl);if(profile)return{type:profile.type,name:profile.name,title:profile.title};let query=`{
65
+ `)}function getIssuesForExpression(outcome,expression){return outcome?.issue?.filter(issue=>isExpressionMatch(issue.expression?.[0],expression))}var ARRAY_INDEX_REGEX=/\[\d+\]/;function isExpressionMatch(expr1,expr2){let isExpr1Indexed=typeof expr1=="string"&&ARRAY_INDEX_REGEX.test(expr1),isExpr2Indexed=typeof expr2=="string"&&ARRAY_INDEX_REGEX.test(expr2);if(isExpr1Indexed!==isExpr2Indexed&&(expr1=expr1?.replace(ARRAY_INDEX_REGEX,""),expr2=expr2?.replace(ARRAY_INDEX_REGEX,"")),expr1===expr2)return!0;if(!expr1||!expr2)return!1;let dot1=expr1.indexOf(".");if(dot1>=0&&expr1.substring(dot1+1)===expr2)return!0;let dot2=expr2.indexOf(".");return dot2>=0&&expr2.substring(dot2+1)===expr1}var import_jsx_runtime45=require("react/jsx-runtime");function FormSection(props){let{debugMode}=(0,import_react29.useContext)(ElementsContext),label;return debugMode&&props.fhirPath?label=`${props.title} - ${props.fhirPath}`:label=props.title,maybeWrapWithTooltip(props?.readonly?READ_ONLY_TOOLTIP_TEXT:void 0,(0,import_jsx_runtime45.jsx)(import_core51.Input.Wrapper,{id:props.htmlFor,label,classNames:{label:props?.readonly?FormSection_default.dimmed:void 0},description:props.description,withAsterisk:props.withAsterisk,error:getErrorsForInput(props.outcome,props.errorExpression??props.htmlFor),"data-testid":props.testId,children:props.children}))}var import_core52=require("@medplum/core");function setPropertyValue(obj,key,propName,elementDefinition,value){let types=elementDefinition.type;if(types.length>1)for(let type of types){let compoundKey=key.replace("[x]",(0,import_core52.capitalize)(type.code));compoundKey in obj&&delete obj[compoundKey]}return obj[propName]=value,obj}function isSupportedProfileStructureDefinition(profile){return!!profile&&!(0,import_core52.isEmpty)(profile.url)&&!(0,import_core52.isEmpty)(profile.name)}var import_core78=require("@mantine/core"),import_core79=require("@medplum/core"),import_react48=require("react");var import_react30=require("react");var import_jsx_runtime46=require("react/jsx-runtime");function CodeableConceptInput(props){let{defaultValue:defaultValue2,onChange,withHelpText,outcome:_outcome,path:_path,valuePath:_valuePath,...rest}=props,[value,setValue]=(0,import_react30.useState)(defaultValue2);function handleChange(newValues){let newConcept=valueSetElementToCodeableConcept(newValues);setValue(newConcept),onChange&&onChange(newConcept)}return(0,import_jsx_runtime46.jsx)(ValueSetAutocomplete,{defaultValue:value&&codeableConceptToValueSetElement(value),onChange:handleChange,withHelpText:withHelpText??!0,...rest})}function codeableConceptToValueSetElement(concept){return concept.coding?.map(c=>({system:c.system,code:c.code,display:c.display}))}function valueSetElementToCodeableConcept(elements){if(elements.length!==0)return{coding:elements.map(e=>({system:e.system,code:e.code,display:e.display}))}}var import_react31=require("react");var import_jsx_runtime47=require("react/jsx-runtime");function CodingInput(props){let{defaultValue:defaultValue2,onChange,withHelpText,...rest}=props,[value,setValue]=(0,import_react31.useState)(defaultValue2);function handleChange(newValues){let newValue=newValues[0],newConcept=newValue&&valueSetElementToCoding(newValue);setValue(newConcept),onChange&&onChange(newConcept)}return(0,import_jsx_runtime47.jsx)(ValueSetAutocomplete,{defaultValue:value&&codingToValueSetElement(value),maxValues:1,onChange:handleChange,withHelpText:withHelpText??!0,...rest})}function codingToValueSetElement(coding){return{system:coding.system,code:coding.code,display:coding.display}}function valueSetElementToCoding(element){return{system:element.system,code:element.code,display:element.display}}var import_core54=require("@mantine/core"),import_react33=require("react");var import_core53=require("@mantine/core"),import_react32=require("react");var import_jsx_runtime48=require("react/jsx-runtime");function ContactPointInput(props){let{path,outcome}=props,{elementsByPath,getExtendedProps}=(0,import_react32.useContext)(ElementsContext),[contactPoint,setContactPoint]=(0,import_react32.useState)(props.defaultValue),ref=(0,import_react32.useRef)();ref.current=contactPoint;let[systemElement,useElement,valueElement]=(0,import_react32.useMemo)(()=>["system","use","value"].map(field=>elementsByPath[path+"."+field]),[elementsByPath,path]),[systemProps,useProps,valueProps]=(0,import_react32.useMemo)(()=>["system","use","value"].map(field=>getExtendedProps(path+"."+field)),[getExtendedProps,path]);function setContactPointWrapper(newValue){newValue&&Object.keys(newValue).length===0&&(newValue=void 0),setContactPoint(newValue),props.onChange&&props.onChange(newValue)}function setSystem(system){let newValue={...ref.current,system};system||delete newValue.system,setContactPointWrapper(newValue)}function setUse(use){let newValue={...ref.current,use};use||delete newValue.use,setContactPointWrapper(newValue)}function setValue(value){let newValue={...ref.current,value};value||delete newValue.value,setContactPointWrapper(newValue)}let errorPath=props.valuePath??path;return(0,import_jsx_runtime48.jsxs)(import_core53.Group,{gap:"xs",grow:!0,wrap:"nowrap",align:"flex-start",children:[(0,import_jsx_runtime48.jsx)(import_core53.NativeSelect,{disabled:props.disabled||systemProps?.readonly,"data-testid":"system",defaultValue:contactPoint?.system,required:(systemElement?.min??0)>0,onChange:e=>setSystem(e.currentTarget.value),data:["","email","phone","fax","pager","sms","other"],error:getErrorsForInput(outcome,errorPath+".system")}),(0,import_jsx_runtime48.jsx)(import_core53.NativeSelect,{disabled:props.disabled||useProps?.readonly,"data-testid":"use",defaultValue:contactPoint?.use,required:(useElement?.min??0)>0,onChange:e=>setUse(e.currentTarget.value),data:["","home","work","temp","old","mobile"],error:getErrorsForInput(outcome,errorPath+".use")}),(0,import_jsx_runtime48.jsx)(import_core53.TextInput,{disabled:props.disabled||valueProps?.readonly,placeholder:"Value",defaultValue:contactPoint?.value,required:(valueElement?.min??0)>0,onChange:e=>setValue(e.currentTarget.value),error:getErrorsForInput(outcome,errorPath+".value")})]})}var import_jsx_runtime49=require("react/jsx-runtime");function ContactDetailInput(props){let[contactPoint,setContactDetail]=(0,import_react33.useState)(props.defaultValue),ref=(0,import_react33.useRef)();ref.current=contactPoint;let{getExtendedProps}=(0,import_react33.useContext)(ElementsContext),[nameProps,telecomProps]=(0,import_react33.useMemo)(()=>["name","telecom"].map(field=>getExtendedProps(props.path+"."+field)),[getExtendedProps,props.path]);function setContactDetailWrapper(newValue){setContactDetail(newValue),props.onChange&&props.onChange(newValue)}function setName(name){let newValue={...ref.current,name};name||delete newValue.name,setContactDetailWrapper(newValue)}function setTelecom(telecom){let newValue={...ref.current,telecom:telecom&&[telecom]};telecom||delete newValue.telecom,setContactDetailWrapper(newValue)}return(0,import_jsx_runtime49.jsxs)(import_core54.Group,{gap:"xs",grow:!0,wrap:"nowrap",children:[(0,import_jsx_runtime49.jsx)(import_core54.TextInput,{disabled:props.disabled||nameProps?.readonly,"data-testid":props.name+"-name",name:props.name+"-name",placeholder:"Name",style:{width:180},defaultValue:contactPoint?.name,onChange:e=>setName(e.currentTarget.value)}),(0,import_jsx_runtime49.jsx)(ContactPointInput,{disabled:props.disabled||telecomProps?.readonly,name:props.name+"-telecom",path:props.path+".telecom",defaultValue:contactPoint?.telecom?.[0],onChange:setTelecom,outcome:props.outcome})]})}var import_core56=require("@mantine/core");var import_core55=require("@medplum/core");function convertIsoToLocal(isoString){if(!isoString)return"";let date=new Date(isoString);return(0,import_core55.isValidDate)(date)?date.toLocaleDateString("sv")+"T"+date.toLocaleTimeString("sv"):""}function convertLocalToIso(localString){if(!localString)return"";let date=new Date(localString);return(0,import_core55.isValidDate)(date)?date.toISOString():""}var import_jsx_runtime50=require("react/jsx-runtime");function DateTimeInput(props){return(0,import_jsx_runtime50.jsx)(import_core56.TextInput,{id:props.name,name:props.name,label:props.label,"data-autofocus":props.autoFocus,"data-testid":props["data-testid"]??props.name,placeholder:props.placeholder,required:props.required,disabled:props.disabled,type:getInputType(),defaultValue:convertIsoToLocal(props.defaultValue),autoFocus:props.autoFocus,error:getErrorsForInput(props.outcome,props.name),onChange:e=>{if(props.onChange){let newValue=e.currentTarget.value;props.onChange(convertLocalToIso(newValue))}}})}function getInputType(){return"datetime-local"}var import_core57=require("@medplum/core");var import_react34=require("react");var import_jsx_runtime51=require("react/jsx-runtime");function ExtensionInput(props){let{propertyType}=props,medplum=b(),profileUrl=(0,import_react34.useMemo)(()=>{if((0,import_core57.isPopulated)(propertyType.profile))return propertyType.profile[0]},[propertyType]),[loadingProfile,setLoadingProfile]=(0,import_react34.useState)(profileUrl!==void 0);return(0,import_react34.useEffect)(()=>{profileUrl&&(setLoadingProfile(!0),medplum.requestProfileSchema(profileUrl).then(()=>setLoadingProfile(!1)).catch(reason=>{setLoadingProfile(!1),console.warn(reason)}))},[medplum,profileUrl]),profileUrl&&(loadingProfile||!(0,import_core57.isProfileLoaded)(profileUrl))?(0,import_jsx_runtime51.jsx)("div",{children:"Loading..."}):(0,import_jsx_runtime51.jsx)(BackboneElementInput,{profileUrl,path:props.path,typeName:"Extension",defaultValue:props.defaultValue,onChange:props.onChange})}var import_core58=require("@mantine/core"),import_react35=require("react");var import_jsx_runtime52=require("react/jsx-runtime");function HumanNameInput(props){let{outcome,path}=props,[value,setValue]=(0,import_react35.useState)(props.defaultValue),{getExtendedProps}=(0,import_react35.useContext)(ElementsContext),[useProps,prefixProps,givenProps,familyProps,suffixProps]=(0,import_react35.useMemo)(()=>["use","prefix","given","family","suffix"].map(field=>getExtendedProps(props.path+"."+field)),[getExtendedProps,props.path]);function setValueWrapper(newValue){setValue(newValue),props.onChange&&props.onChange(newValue)}function setUse(use){setValueWrapper({...value,use:use||void 0})}function setPrefix(prefix){setValueWrapper({...value,prefix:prefix?prefix.split(" "):void 0})}function setGiven(given){setValueWrapper({...value,given:given?given.split(" "):void 0})}function setFamily(family){setValueWrapper({...value,family:family||void 0})}function setSuffix(suffix){setValueWrapper({...value,suffix:suffix?suffix.split(" "):void 0})}let errorPath=props.valuePath??path;return(0,import_jsx_runtime52.jsxs)(import_core58.Group,{gap:"xs",grow:!0,wrap:"nowrap",children:[(0,import_jsx_runtime52.jsx)(import_core58.NativeSelect,{disabled:props.disabled||useProps?.readonly,defaultValue:value?.use,name:props.name+"-use","data-testid":"use",onChange:e=>setUse(e.currentTarget.value),data:["","temp","old","usual","official","nickname","anonymous","maiden"],error:getErrorsForInput(outcome,errorPath+".use")}),(0,import_jsx_runtime52.jsx)(import_core58.TextInput,{disabled:props.disabled||prefixProps?.readonly,placeholder:"Prefix",name:props.name+"-prefix",defaultValue:value?.prefix?.join(" "),onChange:e=>setPrefix(e.currentTarget.value),error:getErrorsForInput(outcome,errorPath+".prefix")}),(0,import_jsx_runtime52.jsx)(import_core58.TextInput,{disabled:props.disabled||givenProps?.readonly,placeholder:"Given",name:props.name+"-given",defaultValue:value?.given?.join(" "),onChange:e=>setGiven(e.currentTarget.value),error:getErrorsForInput(outcome,errorPath+".given")}),(0,import_jsx_runtime52.jsx)(import_core58.TextInput,{disabled:props.disabled||familyProps?.readonly,name:props.name+"-family",placeholder:"Family",defaultValue:value?.family,onChange:e=>setFamily(e.currentTarget.value),error:getErrorsForInput(outcome,errorPath+".family")}),(0,import_jsx_runtime52.jsx)(import_core58.TextInput,{disabled:props.disabled||suffixProps?.readonly,placeholder:"Suffix",name:props.name+"-suffix",defaultValue:value?.suffix?.join(" "),onChange:e=>setSuffix(e.currentTarget.value),error:getErrorsForInput(outcome,errorPath+".suffix")})]})}var import_core59=require("@mantine/core"),import_react36=require("react");var import_jsx_runtime53=require("react/jsx-runtime");function IdentifierInput(props){let[value,setValue]=(0,import_react36.useState)(props.defaultValue),{elementsByPath,getExtendedProps}=(0,import_react36.useContext)(ElementsContext),[systemElement,valueElement]=(0,import_react36.useMemo)(()=>["system","value"].map(field=>elementsByPath[props.path+"."+field]),[elementsByPath,props.path]),[systemProps,valueProps]=(0,import_react36.useMemo)(()=>["system","value"].map(field=>getExtendedProps(props.path+"."+field)),[getExtendedProps,props.path]);function setValueWrapper(newValue){setValue(newValue),props.onChange&&props.onChange(newValue)}let errorPath=props.valuePath??props.path;return(0,import_jsx_runtime53.jsxs)(import_core59.Group,{gap:"xs",grow:!0,wrap:"nowrap",align:"flex-start",children:[(0,import_jsx_runtime53.jsx)(import_core59.TextInput,{disabled:props.disabled||systemProps?.readonly,placeholder:"System",required:(systemElement?.min??0)>0,defaultValue:value?.system,onChange:e=>setValueWrapper({...value,system:e.currentTarget.value}),error:getErrorsForInput(props.outcome,errorPath+".system")}),(0,import_jsx_runtime53.jsx)(import_core59.TextInput,{disabled:props.disabled||valueProps?.readonly,placeholder:"Value",required:(valueElement?.min??0)>0,defaultValue:value?.value,onChange:e=>setValueWrapper({...value,value:e.currentTarget.value}),error:getErrorsForInput(props.outcome,errorPath+".value")})]})}var import_core60=require("@mantine/core");var import_react37=require("react");var import_jsx_runtime54=require("react/jsx-runtime"),data=["USD","EUR","CAD","GBP","AUD"];function MoneyInput(props){let{onChange}=props,[value,setValue]=(0,import_react37.useState)(props.defaultValue),{getExtendedProps}=(0,import_react37.useContext)(ElementsContext),[currencyProps,valueProps]=(0,import_react37.useMemo)(()=>["currency","value"].map(field=>getExtendedProps(props.path+"."+field)),[getExtendedProps,props.path]),setValueWrapper=(0,import_react37.useCallback)(newValue=>{setValue(newValue),onChange&&onChange(newValue)},[onChange]),handleCurrencyChange=(0,import_react37.useCallback)(e=>{setValueWrapper({...value,currency:e.currentTarget.value})},[value,setValueWrapper]),handleValueChange=(0,import_react37.useCallback)(e=>{setValueWrapper({...value,value:e.currentTarget.valueAsNumber})},[value,setValueWrapper]),select=(0,import_jsx_runtime54.jsx)(import_core60.NativeSelect,{disabled:props.disabled||currencyProps?.readonly,defaultValue:value?.currency,data,styles:{input:{fontWeight:500,borderTopLeftRadius:0,borderBottomLeftRadius:0,width:92}},onChange:handleCurrencyChange});return(0,import_jsx_runtime54.jsx)(import_core60.TextInput,{disabled:props.disabled||valueProps?.readonly,type:"number",name:props.name,label:props.label,placeholder:props.placeholder??"Value",defaultValue:value?.value?.toString()??"USD",leftSection:(0,import_jsx_runtime54.jsx)(IconCurrencyDollar,{size:14}),rightSection:select,rightSectionWidth:92,onChange:handleValueChange})}var import_core61=require("@mantine/core"),import_react38=require("react");var import_jsx_runtime55=require("react/jsx-runtime");function PeriodInput(props){let[value,setValue]=(0,import_react38.useState)(props.defaultValue),{getExtendedProps}=(0,import_react38.useContext)(ElementsContext),[startProps,endProps]=(0,import_react38.useMemo)(()=>["start","end"].map(field=>getExtendedProps(props.path+"."+field)),[getExtendedProps,props.path]);function setValueWrapper(newValue){setValue(newValue),props.onChange&&props.onChange(newValue)}return(0,import_jsx_runtime55.jsxs)(import_core61.Group,{gap:"xs",grow:!0,wrap:"nowrap",children:[(0,import_jsx_runtime55.jsx)(DateTimeInput,{disabled:props.disabled||startProps?.readonly,name:props.name+".start",placeholder:"Start",defaultValue:value?.start,onChange:newValue=>setValueWrapper({...value,start:newValue})}),(0,import_jsx_runtime55.jsx)(DateTimeInput,{disabled:props.disabled||endProps?.readonly,name:props.name+".end",placeholder:"End",defaultValue:value?.end,onChange:newValue=>setValueWrapper({...value,end:newValue})})]})}var import_core62=require("@mantine/core"),import_react39=require("react");var import_jsx_runtime56=require("react/jsx-runtime");function QuantityInput(props){let[value,setValue]=(0,import_react39.useState)(props.defaultValue),{getExtendedProps}=(0,import_react39.useContext)(ElementsContext),[comparatorProps,valueProps,unitProps]=(0,import_react39.useMemo)(()=>["comparator","value","unit"].map(field=>getExtendedProps(props.path+"."+field)),[getExtendedProps,props.path]);function setValueWrapper(newValue){setValue(newValue),props.onChange&&props.onChange(newValue)}return(0,import_jsx_runtime56.jsxs)(import_core62.Group,{gap:"xs",grow:!0,wrap:"nowrap",children:[(0,import_jsx_runtime56.jsx)(import_core62.NativeSelect,{disabled:props.disabled||comparatorProps?.readonly,style:{width:80},"data-testid":props.name+"-comparator",defaultValue:value?.comparator,data:["","<","<=",">=",">"],onChange:e=>setValueWrapper({...value,comparator:e.currentTarget.value})}),(0,import_jsx_runtime56.jsx)(import_core62.TextInput,{disabled:props.disabled||valueProps?.readonly,id:props.name,name:props.name,required:props.required,"data-autofocus":props.autoFocus,"data-testid":props.name+"-value",type:"number",placeholder:"Value",defaultValue:value?.value,autoFocus:props.autoFocus,step:"any",onWheel:e=>{props.disableWheel&&e.currentTarget.blur()},onChange:e=>{setValueWrapper({...value,value:tryParseNumber(e.currentTarget.value)})}}),(0,import_jsx_runtime56.jsx)(import_core62.TextInput,{disabled:props.disabled||unitProps?.readonly,placeholder:"Unit","data-testid":props.name+"-unit",defaultValue:value?.unit,onChange:e=>setValueWrapper({...value,unit:e.currentTarget.value})})]})}function tryParseNumber(str){if(str)return parseFloat(str)}var import_core63=require("@mantine/core"),import_react40=require("react");var import_jsx_runtime57=require("react/jsx-runtime");function RangeInput(props){let[value,setValue]=(0,import_react40.useState)(props.defaultValue),{getExtendedProps}=(0,import_react40.useContext)(ElementsContext),[lowProps,highProps]=(0,import_react40.useMemo)(()=>["low","high"].map(field=>getExtendedProps(props.path+"."+field)),[getExtendedProps,props.path]);function setValueWrapper(newValue){setValue(newValue),props.onChange&&props.onChange(newValue)}return(0,import_jsx_runtime57.jsxs)(import_core63.Group,{gap:"xs",grow:!0,wrap:"nowrap",children:[(0,import_jsx_runtime57.jsx)(QuantityInput,{path:props.path+".low",disabled:props.disabled||lowProps?.readonly,name:props.name+"-low",defaultValue:value?.low,onChange:v2=>setValueWrapper({...value,low:v2})}),(0,import_jsx_runtime57.jsx)(QuantityInput,{path:props.path+".high",disabled:props.disabled||highProps?.readonly,name:props.name+"-high",defaultValue:value?.high,onChange:v2=>setValueWrapper({...value,high:v2})})]})}var import_core64=require("@mantine/core"),import_react41=require("react");var import_jsx_runtime58=require("react/jsx-runtime");function RatioInput(props){let[value,setValue]=(0,import_react41.useState)(props.defaultValue),{getExtendedProps}=(0,import_react41.useContext)(ElementsContext),[numeratorProps,denominatorProps]=(0,import_react41.useMemo)(()=>["numerator","denominator"].map(field=>getExtendedProps(props.path+"."+field)),[getExtendedProps,props.path]);function setValueWrapper(newValue){setValue(newValue),props.onChange&&props.onChange(newValue)}return(0,import_jsx_runtime58.jsxs)(import_core64.Group,{gap:"xs",grow:!0,wrap:"nowrap",children:[(0,import_jsx_runtime58.jsx)(QuantityInput,{path:props.path+".numerator",disabled:props.disabled||numeratorProps?.readonly,name:props.name+"-numerator",defaultValue:value?.numerator,onChange:v2=>setValueWrapper({...value,numerator:v2})}),(0,import_jsx_runtime58.jsx)(QuantityInput,{path:props.path+".denominator",disabled:props.disabled||denominatorProps?.readonly,name:props.name+"-denominator",defaultValue:value?.denominator,onChange:v2=>setValueWrapper({...value,denominator:v2})})]})}var import_core67=require("@mantine/core"),import_core68=require("@medplum/core");var import_react43=require("react");var import_core65=require("@mantine/core"),import_core66=require("@medplum/core");var import_react42=require("react");var import_jsx_runtime59=require("react/jsx-runtime"),SEARCH_CODES={Device:"device-name",Observation:"code",Subscription:"criteria",User:"email:contains"},NAME_RESOURCE_TYPES=["AccessPolicy","Account","ActivityDefinition","Bot","CapabilityStatement","CareTeam","ClientApplication","CodeSystem","CompartmentDefinition","ConceptMap","EffectEvidenceSynthesis","Endpoint","EventDefinition","Evidence","EvidenceVariable","ExampleScenario","GraphDefinition","Group","HealthcareService","ImplementationGuide","InsurancePlan","Library","Location","Measure","MedicinalProduct","MessageDefinition","NamingSystem","OperationDefinition","Organization","Patient","Person","PlanDefinition","Practitioner","Project","Questionnaire","RelatedPerson","ResearchDefinition","ResearchElementDefinition","RiskEvidenceSynthesis","SearchParameter","StructureDefinition","StructureMap","TerminologyCapabilities","TestScript","UserConfiguration","ValueSet"];function toOption3(resource){return{value:(0,import_core66.getReferenceString)(resource),label:(0,import_core66.getDisplayString)(resource),resource}}function ResourceInput(props){let medplum=b(),{resourceType,searchCriteria}=props,[outcome,setOutcome]=(0,import_react42.useState)(),defaultValue2=Te(props.defaultValue,setOutcome),ItemComponent3=props.itemComponent??DefaultItemComponent2,onChange=props.onChange,loadValues=(0,import_react42.useCallback)(async(input,signal)=>{let searchCode=getSearchParamForResourceType(resourceType),searchParams=new URLSearchParams({[searchCode]:input??"",_count:"10",...searchCriteria});return await medplum.searchResources(resourceType,searchParams,{signal})},[medplum,resourceType,searchCriteria]),handleChange=(0,import_react42.useCallback)(newResources=>{onChange&&onChange(newResources[0])},[onChange]);return(0,import_core66.isPopulated)(props.defaultValue)&&!outcome&&!defaultValue2?null:(0,import_jsx_runtime59.jsx)(AsyncAutocomplete,{disabled:props.disabled,name:props.name,label:props.label,error:props.error,required:props.required,itemComponent:ItemComponent3,defaultValue:defaultValue2,placeholder:props.placeholder,maxValues:1,toOption:toOption3,loadOptions:loadValues,onChange:handleChange,clearable:!0})}var DefaultItemComponent2=(0,import_react42.forwardRef)(({label,resource,active:_active,...others},ref)=>(0,import_jsx_runtime59.jsx)("div",{ref,...others,children:(0,import_jsx_runtime59.jsxs)(import_core65.Group,{wrap:"nowrap",children:[(0,import_jsx_runtime59.jsx)(ResourceAvatar,{value:resource}),(0,import_jsx_runtime59.jsxs)("div",{children:[(0,import_jsx_runtime59.jsx)(import_core65.Text,{children:label}),(0,import_jsx_runtime59.jsx)(import_core65.Text,{size:"xs",c:"dimmed",children:resource.birthDate||resource.id})]})]})}));function getSearchParamForResourceType(resourceType){return SEARCH_CODES[resourceType]??(NAME_RESOURCE_TYPES.includes(resourceType)?"name":"_id")}var import_jsx_runtime60=require("react/jsx-runtime");function ReferenceInput(props){let{onChange}=props,medplum=b(),[value,setValue]=(0,import_react43.useState)(props.defaultValue),[targetTypes,setTargetTypes]=(0,import_react43.useState)(()=>createTargetTypes(props.targetTypes)),[targetType,setTargetType]=(0,import_react43.useState)(()=>getInitialTargetType(props.defaultValue,targetTypes)),promiseCache=(0,import_react43.useRef)(new import_core68.LRUCache),searchCriteria=(0,import_react43.useMemo)(()=>targetType?.type==="profile"?{...props.searchCriteria,_profile:targetType.value}:props.searchCriteria,[props.searchCriteria,targetType]);(0,import_react43.useEffect)(()=>{let anyToFetch=!1,newTargetTypePromises=targetTypes?.map(tt=>{if(!shouldFetchResourceType(tt))return Promise.resolve(tt);anyToFetch=!0;let cacheKey=tt.value,cached=promiseCache.current.get(cacheKey);if(cached)return cached;let promise=fetchResourceTypeOfProfile(medplum,tt.value).then(profile=>{let newTargetType={...tt};return profile?(0,import_core68.isPopulated)(profile.type)?(newTargetType.resourceType=profile.type,newTargetType.name=profile.name,newTargetType.title=profile.title):(console.error(`StructureDefinition.type missing for ${tt.value}`),newTargetType.error="StructureDefinition.type missing"):(console.error(`StructureDefinition not found for ${tt.value}`),newTargetType.error="StructureDefinition not found"),newTargetType}).catch(reason=>(console.error(reason),{...tt,error:reason})),readablePromise=new import_core68.ReadablePromise(promise);return promiseCache.current.set(cacheKey,readablePromise),readablePromise});!newTargetTypePromises||!anyToFetch||Promise.all(newTargetTypePromises).then(newTargetTypes=>{if(setTargetTypes(newTargetTypes),!targetType)return;let index=newTargetTypes.findIndex(tt=>tt.value===targetType.value||tt.resourceType===targetType.resourceType);if(index===-1){console.debug(`defaultValue had unexpected resourceType: ${targetType.resourceType}`);return}setTargetType(newTargetTypes[index])}).catch(console.error)},[medplum,targetType,targetTypes]);let setValueHelper=(0,import_react43.useCallback)(item=>{let newValue=item?(0,import_core68.createReference)(item):void 0;setValue(newValue),onChange&&onChange(newValue)},[onChange]),typeSelectOptions=(0,import_react43.useMemo)(()=>targetTypes?targetTypes.map(tt=>({value:tt.value,label:tt.type==="profile"?tt.title??tt.name??tt.resourceType??tt.value:tt.value})):[],[targetTypes]);return(0,import_jsx_runtime60.jsxs)(import_core67.Group,{gap:"xs",grow:!0,wrap:"nowrap",children:[targetTypes&&targetTypes.length>1&&(0,import_jsx_runtime60.jsx)(import_core67.NativeSelect,{disabled:props.disabled,"data-autofocus":props.autoFocus,"data-testid":"reference-input-resource-type-select",defaultValue:targetType?.resourceType,autoFocus:props.autoFocus,onChange:e=>{let newValue=e.currentTarget.value,newTargetType=targetTypes.find(tt=>tt.value===newValue);setTargetType(newTargetType)},data:typeSelectOptions}),!targetTypes&&(0,import_jsx_runtime60.jsx)(ResourceTypeInput,{disabled:props.disabled,autoFocus:props.autoFocus,testId:"reference-input-resource-type-input",defaultValue:targetType?.resourceType,onChange:newResourceType=>{setTargetType(newResourceType?{type:"resourceType",value:newResourceType,resourceType:newResourceType}:void 0)},name:props.name+"-resourceType",placeholder:"Resource Type"}),(0,import_jsx_runtime60.jsx)(ResourceInput,{resourceType:targetType?.resourceType,name:props.name+"-id",required:props.required,placeholder:props.placeholder,defaultValue:value,searchCriteria,onChange:setValueHelper,disabled:props.disabled})]})}function createTargetTypes(resourceTypesAndProfileUrls){if(!resourceTypesAndProfileUrls||resourceTypesAndProfileUrls.length===0||resourceTypesAndProfileUrls.length===1&&resourceTypesAndProfileUrls[0]==="Resource")return;let results=[];for(let value of resourceTypesAndProfileUrls)value.includes("/")?results.push({type:"profile",value}):results.push({type:"resourceType",value,resourceType:value});return results}function getInitialTargetType(defaultValue2,targetTypes){let defaultValueResourceType=defaultValue2?.reference?.split("/")[0];if(defaultValueResourceType){let targetType=targetTypes?.find(tt=>tt.resourceType===defaultValueResourceType);return targetType||{type:"resourceType",value:defaultValueResourceType,resourceType:defaultValueResourceType}}if(targetTypes&&targetTypes.length>0)return targetTypes[0]}async function fetchResourceTypeOfProfile(medplum,profileUrl){let profile=(0,import_core68.tryGetProfile)(profileUrl);if(profile)return{type:profile.type,name:profile.name,title:profile.title};let query=`{
66
66
  StructureDefinitionList(url: "${profileUrl}", _sort: "_lastUpdated", _count: 1) {
67
67
  type,
68
68
  name,
@@ -75,7 +75,7 @@
75
75
 
76
76
  @tabler/icons-react/dist/esm/defaultAttributes.mjs:
77
77
  (**
78
- * @license @tabler/icons-react v3.16.0 - MIT
78
+ * @license @tabler/icons-react v3.17.0 - MIT
79
79
  *
80
80
  * This source code is licensed under the MIT license.
81
81
  * See the LICENSE file in the root directory of this source tree.
@@ -83,7 +83,7 @@
83
83
 
84
84
  @tabler/icons-react/dist/esm/createReactComponent.mjs:
85
85
  (**
86
- * @license @tabler/icons-react v3.16.0 - MIT
86
+ * @license @tabler/icons-react v3.17.0 - MIT
87
87
  *
88
88
  * This source code is licensed under the MIT license.
89
89
  * See the LICENSE file in the root directory of this source tree.
@@ -91,7 +91,7 @@
91
91
 
92
92
  @tabler/icons-react/dist/esm/icons/IconAdjustmentsHorizontal.mjs:
93
93
  (**
94
- * @license @tabler/icons-react v3.16.0 - MIT
94
+ * @license @tabler/icons-react v3.17.0 - MIT
95
95
  *
96
96
  * This source code is licensed under the MIT license.
97
97
  * See the LICENSE file in the root directory of this source tree.
@@ -99,7 +99,7 @@
99
99
 
100
100
  @tabler/icons-react/dist/esm/icons/IconAlertCircle.mjs:
101
101
  (**
102
- * @license @tabler/icons-react v3.16.0 - MIT
102
+ * @license @tabler/icons-react v3.17.0 - MIT
103
103
  *
104
104
  * This source code is licensed under the MIT license.
105
105
  * See the LICENSE file in the root directory of this source tree.
@@ -107,7 +107,7 @@
107
107
 
108
108
  @tabler/icons-react/dist/esm/icons/IconArrowDown.mjs:
109
109
  (**
110
- * @license @tabler/icons-react v3.16.0 - MIT
110
+ * @license @tabler/icons-react v3.17.0 - MIT
111
111
  *
112
112
  * This source code is licensed under the MIT license.
113
113
  * See the LICENSE file in the root directory of this source tree.
@@ -115,7 +115,7 @@
115
115
 
116
116
  @tabler/icons-react/dist/esm/icons/IconArrowRight.mjs:
117
117
  (**
118
- * @license @tabler/icons-react v3.16.0 - MIT
118
+ * @license @tabler/icons-react v3.17.0 - MIT
119
119
  *
120
120
  * This source code is licensed under the MIT license.
121
121
  * See the LICENSE file in the root directory of this source tree.
@@ -123,7 +123,7 @@
123
123
 
124
124
  @tabler/icons-react/dist/esm/icons/IconArrowUp.mjs:
125
125
  (**
126
- * @license @tabler/icons-react v3.16.0 - MIT
126
+ * @license @tabler/icons-react v3.17.0 - MIT
127
127
  *
128
128
  * This source code is licensed under the MIT license.
129
129
  * See the LICENSE file in the root directory of this source tree.
@@ -131,7 +131,7 @@
131
131
 
132
132
  @tabler/icons-react/dist/esm/icons/IconBleachOff.mjs:
133
133
  (**
134
- * @license @tabler/icons-react v3.16.0 - MIT
134
+ * @license @tabler/icons-react v3.17.0 - MIT
135
135
  *
136
136
  * This source code is licensed under the MIT license.
137
137
  * See the LICENSE file in the root directory of this source tree.
@@ -139,7 +139,7 @@
139
139
 
140
140
  @tabler/icons-react/dist/esm/icons/IconBleach.mjs:
141
141
  (**
142
- * @license @tabler/icons-react v3.16.0 - MIT
142
+ * @license @tabler/icons-react v3.17.0 - MIT
143
143
  *
144
144
  * This source code is licensed under the MIT license.
145
145
  * See the LICENSE file in the root directory of this source tree.
@@ -147,7 +147,7 @@
147
147
 
148
148
  @tabler/icons-react/dist/esm/icons/IconBoxMultiple.mjs:
149
149
  (**
150
- * @license @tabler/icons-react v3.16.0 - MIT
150
+ * @license @tabler/icons-react v3.17.0 - MIT
151
151
  *
152
152
  * This source code is licensed under the MIT license.
153
153
  * See the LICENSE file in the root directory of this source tree.
@@ -155,7 +155,7 @@
155
155
 
156
156
  @tabler/icons-react/dist/esm/icons/IconBracketsContain.mjs:
157
157
  (**
158
- * @license @tabler/icons-react v3.16.0 - MIT
158
+ * @license @tabler/icons-react v3.17.0 - MIT
159
159
  *
160
160
  * This source code is licensed under the MIT license.
161
161
  * See the LICENSE file in the root directory of this source tree.
@@ -163,7 +163,7 @@
163
163
 
164
164
  @tabler/icons-react/dist/esm/icons/IconBucketOff.mjs:
165
165
  (**
166
- * @license @tabler/icons-react v3.16.0 - MIT
166
+ * @license @tabler/icons-react v3.17.0 - MIT
167
167
  *
168
168
  * This source code is licensed under the MIT license.
169
169
  * See the LICENSE file in the root directory of this source tree.
@@ -171,7 +171,7 @@
171
171
 
172
172
  @tabler/icons-react/dist/esm/icons/IconBucket.mjs:
173
173
  (**
174
- * @license @tabler/icons-react v3.16.0 - MIT
174
+ * @license @tabler/icons-react v3.17.0 - MIT
175
175
  *
176
176
  * This source code is licensed under the MIT license.
177
177
  * See the LICENSE file in the root directory of this source tree.
@@ -179,7 +179,7 @@
179
179
 
180
180
  @tabler/icons-react/dist/esm/icons/IconCalendar.mjs:
181
181
  (**
182
- * @license @tabler/icons-react v3.16.0 - MIT
182
+ * @license @tabler/icons-react v3.17.0 - MIT
183
183
  *
184
184
  * This source code is licensed under the MIT license.
185
185
  * See the LICENSE file in the root directory of this source tree.
@@ -187,7 +187,7 @@
187
187
 
188
188
  @tabler/icons-react/dist/esm/icons/IconCheck.mjs:
189
189
  (**
190
- * @license @tabler/icons-react v3.16.0 - MIT
190
+ * @license @tabler/icons-react v3.17.0 - MIT
191
191
  *
192
192
  * This source code is licensed under the MIT license.
193
193
  * See the LICENSE file in the root directory of this source tree.
@@ -195,7 +195,7 @@
195
195
 
196
196
  @tabler/icons-react/dist/esm/icons/IconCheckbox.mjs:
197
197
  (**
198
- * @license @tabler/icons-react v3.16.0 - MIT
198
+ * @license @tabler/icons-react v3.17.0 - MIT
199
199
  *
200
200
  * This source code is licensed under the MIT license.
201
201
  * See the LICENSE file in the root directory of this source tree.
@@ -203,7 +203,7 @@
203
203
 
204
204
  @tabler/icons-react/dist/esm/icons/IconChevronDown.mjs:
205
205
  (**
206
- * @license @tabler/icons-react v3.16.0 - MIT
206
+ * @license @tabler/icons-react v3.17.0 - MIT
207
207
  *
208
208
  * This source code is licensed under the MIT license.
209
209
  * See the LICENSE file in the root directory of this source tree.
@@ -211,7 +211,7 @@
211
211
 
212
212
  @tabler/icons-react/dist/esm/icons/IconChevronUp.mjs:
213
213
  (**
214
- * @license @tabler/icons-react v3.16.0 - MIT
214
+ * @license @tabler/icons-react v3.17.0 - MIT
215
215
  *
216
216
  * This source code is licensed under the MIT license.
217
217
  * See the LICENSE file in the root directory of this source tree.
@@ -219,7 +219,7 @@
219
219
 
220
220
  @tabler/icons-react/dist/esm/icons/IconCircleMinus.mjs:
221
221
  (**
222
- * @license @tabler/icons-react v3.16.0 - MIT
222
+ * @license @tabler/icons-react v3.17.0 - MIT
223
223
  *
224
224
  * This source code is licensed under the MIT license.
225
225
  * See the LICENSE file in the root directory of this source tree.
@@ -227,7 +227,7 @@
227
227
 
228
228
  @tabler/icons-react/dist/esm/icons/IconCirclePlus.mjs:
229
229
  (**
230
- * @license @tabler/icons-react v3.16.0 - MIT
230
+ * @license @tabler/icons-react v3.17.0 - MIT
231
231
  *
232
232
  * This source code is licensed under the MIT license.
233
233
  * See the LICENSE file in the root directory of this source tree.
@@ -235,7 +235,7 @@
235
235
 
236
236
  @tabler/icons-react/dist/esm/icons/IconCloudUpload.mjs:
237
237
  (**
238
- * @license @tabler/icons-react v3.16.0 - MIT
238
+ * @license @tabler/icons-react v3.17.0 - MIT
239
239
  *
240
240
  * This source code is licensed under the MIT license.
241
241
  * See the LICENSE file in the root directory of this source tree.
@@ -243,7 +243,7 @@
243
243
 
244
244
  @tabler/icons-react/dist/esm/icons/IconColumns.mjs:
245
245
  (**
246
- * @license @tabler/icons-react v3.16.0 - MIT
246
+ * @license @tabler/icons-react v3.17.0 - MIT
247
247
  *
248
248
  * This source code is licensed under the MIT license.
249
249
  * See the LICENSE file in the root directory of this source tree.
@@ -251,7 +251,7 @@
251
251
 
252
252
  @tabler/icons-react/dist/esm/icons/IconCopy.mjs:
253
253
  (**
254
- * @license @tabler/icons-react v3.16.0 - MIT
254
+ * @license @tabler/icons-react v3.17.0 - MIT
255
255
  *
256
256
  * This source code is licensed under the MIT license.
257
257
  * See the LICENSE file in the root directory of this source tree.
@@ -259,7 +259,7 @@
259
259
 
260
260
  @tabler/icons-react/dist/esm/icons/IconCurrencyDollar.mjs:
261
261
  (**
262
- * @license @tabler/icons-react v3.16.0 - MIT
262
+ * @license @tabler/icons-react v3.17.0 - MIT
263
263
  *
264
264
  * This source code is licensed under the MIT license.
265
265
  * See the LICENSE file in the root directory of this source tree.
@@ -267,7 +267,7 @@
267
267
 
268
268
  @tabler/icons-react/dist/esm/icons/IconDots.mjs:
269
269
  (**
270
- * @license @tabler/icons-react v3.16.0 - MIT
270
+ * @license @tabler/icons-react v3.17.0 - MIT
271
271
  *
272
272
  * This source code is licensed under the MIT license.
273
273
  * See the LICENSE file in the root directory of this source tree.
@@ -275,7 +275,7 @@
275
275
 
276
276
  @tabler/icons-react/dist/esm/icons/IconEdit.mjs:
277
277
  (**
278
- * @license @tabler/icons-react v3.16.0 - MIT
278
+ * @license @tabler/icons-react v3.17.0 - MIT
279
279
  *
280
280
  * This source code is licensed under the MIT license.
281
281
  * See the LICENSE file in the root directory of this source tree.
@@ -283,7 +283,7 @@
283
283
 
284
284
  @tabler/icons-react/dist/esm/icons/IconEqualNot.mjs:
285
285
  (**
286
- * @license @tabler/icons-react v3.16.0 - MIT
286
+ * @license @tabler/icons-react v3.17.0 - MIT
287
287
  *
288
288
  * This source code is licensed under the MIT license.
289
289
  * See the LICENSE file in the root directory of this source tree.
@@ -291,7 +291,7 @@
291
291
 
292
292
  @tabler/icons-react/dist/esm/icons/IconEqual.mjs:
293
293
  (**
294
- * @license @tabler/icons-react v3.16.0 - MIT
294
+ * @license @tabler/icons-react v3.17.0 - MIT
295
295
  *
296
296
  * This source code is licensed under the MIT license.
297
297
  * See the LICENSE file in the root directory of this source tree.
@@ -299,7 +299,7 @@
299
299
 
300
300
  @tabler/icons-react/dist/esm/icons/IconFileAlert.mjs:
301
301
  (**
302
- * @license @tabler/icons-react v3.16.0 - MIT
302
+ * @license @tabler/icons-react v3.17.0 - MIT
303
303
  *
304
304
  * This source code is licensed under the MIT license.
305
305
  * See the LICENSE file in the root directory of this source tree.
@@ -307,7 +307,7 @@
307
307
 
308
308
  @tabler/icons-react/dist/esm/icons/IconFilePlus.mjs:
309
309
  (**
310
- * @license @tabler/icons-react v3.16.0 - MIT
310
+ * @license @tabler/icons-react v3.17.0 - MIT
311
311
  *
312
312
  * This source code is licensed under the MIT license.
313
313
  * See the LICENSE file in the root directory of this source tree.
@@ -315,7 +315,7 @@
315
315
 
316
316
  @tabler/icons-react/dist/esm/icons/IconFilter.mjs:
317
317
  (**
318
- * @license @tabler/icons-react v3.16.0 - MIT
318
+ * @license @tabler/icons-react v3.17.0 - MIT
319
319
  *
320
320
  * This source code is licensed under the MIT license.
321
321
  * See the LICENSE file in the root directory of this source tree.
@@ -323,7 +323,7 @@
323
323
 
324
324
  @tabler/icons-react/dist/esm/icons/IconGenderFemale.mjs:
325
325
  (**
326
- * @license @tabler/icons-react v3.16.0 - MIT
326
+ * @license @tabler/icons-react v3.17.0 - MIT
327
327
  *
328
328
  * This source code is licensed under the MIT license.
329
329
  * See the LICENSE file in the root directory of this source tree.
@@ -331,7 +331,7 @@
331
331
 
332
332
  @tabler/icons-react/dist/esm/icons/IconGenderMale.mjs:
333
333
  (**
334
- * @license @tabler/icons-react v3.16.0 - MIT
334
+ * @license @tabler/icons-react v3.17.0 - MIT
335
335
  *
336
336
  * This source code is licensed under the MIT license.
337
337
  * See the LICENSE file in the root directory of this source tree.
@@ -339,7 +339,7 @@
339
339
 
340
340
  @tabler/icons-react/dist/esm/icons/IconLogout.mjs:
341
341
  (**
342
- * @license @tabler/icons-react v3.16.0 - MIT
342
+ * @license @tabler/icons-react v3.17.0 - MIT
343
343
  *
344
344
  * This source code is licensed under the MIT license.
345
345
  * See the LICENSE file in the root directory of this source tree.
@@ -347,7 +347,7 @@
347
347
 
348
348
  @tabler/icons-react/dist/esm/icons/IconMathGreater.mjs:
349
349
  (**
350
- * @license @tabler/icons-react v3.16.0 - MIT
350
+ * @license @tabler/icons-react v3.17.0 - MIT
351
351
  *
352
352
  * This source code is licensed under the MIT license.
353
353
  * See the LICENSE file in the root directory of this source tree.
@@ -355,7 +355,7 @@
355
355
 
356
356
  @tabler/icons-react/dist/esm/icons/IconMathLower.mjs:
357
357
  (**
358
- * @license @tabler/icons-react v3.16.0 - MIT
358
+ * @license @tabler/icons-react v3.17.0 - MIT
359
359
  *
360
360
  * This source code is licensed under the MIT license.
361
361
  * See the LICENSE file in the root directory of this source tree.
@@ -363,7 +363,7 @@
363
363
 
364
364
  @tabler/icons-react/dist/esm/icons/IconMessage.mjs:
365
365
  (**
366
- * @license @tabler/icons-react v3.16.0 - MIT
366
+ * @license @tabler/icons-react v3.17.0 - MIT
367
367
  *
368
368
  * This source code is licensed under the MIT license.
369
369
  * See the LICENSE file in the root directory of this source tree.
@@ -371,7 +371,7 @@
371
371
 
372
372
  @tabler/icons-react/dist/esm/icons/IconPlus.mjs:
373
373
  (**
374
- * @license @tabler/icons-react v3.16.0 - MIT
374
+ * @license @tabler/icons-react v3.17.0 - MIT
375
375
  *
376
376
  * This source code is licensed under the MIT license.
377
377
  * See the LICENSE file in the root directory of this source tree.
@@ -379,7 +379,7 @@
379
379
 
380
380
  @tabler/icons-react/dist/esm/icons/IconRefresh.mjs:
381
381
  (**
382
- * @license @tabler/icons-react v3.16.0 - MIT
382
+ * @license @tabler/icons-react v3.17.0 - MIT
383
383
  *
384
384
  * This source code is licensed under the MIT license.
385
385
  * See the LICENSE file in the root directory of this source tree.
@@ -387,7 +387,7 @@
387
387
 
388
388
  @tabler/icons-react/dist/esm/icons/IconSearch.mjs:
389
389
  (**
390
- * @license @tabler/icons-react v3.16.0 - MIT
390
+ * @license @tabler/icons-react v3.17.0 - MIT
391
391
  *
392
392
  * This source code is licensed under the MIT license.
393
393
  * See the LICENSE file in the root directory of this source tree.
@@ -395,7 +395,7 @@
395
395
 
396
396
  @tabler/icons-react/dist/esm/icons/IconSettings.mjs:
397
397
  (**
398
- * @license @tabler/icons-react v3.16.0 - MIT
398
+ * @license @tabler/icons-react v3.17.0 - MIT
399
399
  *
400
400
  * This source code is licensed under the MIT license.
401
401
  * See the LICENSE file in the root directory of this source tree.
@@ -403,7 +403,7 @@
403
403
 
404
404
  @tabler/icons-react/dist/esm/icons/IconSortAscending.mjs:
405
405
  (**
406
- * @license @tabler/icons-react v3.16.0 - MIT
406
+ * @license @tabler/icons-react v3.17.0 - MIT
407
407
  *
408
408
  * This source code is licensed under the MIT license.
409
409
  * See the LICENSE file in the root directory of this source tree.
@@ -411,7 +411,7 @@
411
411
 
412
412
  @tabler/icons-react/dist/esm/icons/IconSortDescending.mjs:
413
413
  (**
414
- * @license @tabler/icons-react v3.16.0 - MIT
414
+ * @license @tabler/icons-react v3.17.0 - MIT
415
415
  *
416
416
  * This source code is licensed under the MIT license.
417
417
  * See the LICENSE file in the root directory of this source tree.
@@ -419,7 +419,7 @@
419
419
 
420
420
  @tabler/icons-react/dist/esm/icons/IconSquare.mjs:
421
421
  (**
422
- * @license @tabler/icons-react v3.16.0 - MIT
422
+ * @license @tabler/icons-react v3.17.0 - MIT
423
423
  *
424
424
  * This source code is licensed under the MIT license.
425
425
  * See the LICENSE file in the root directory of this source tree.
@@ -427,7 +427,7 @@
427
427
 
428
428
  @tabler/icons-react/dist/esm/icons/IconStethoscope.mjs:
429
429
  (**
430
- * @license @tabler/icons-react v3.16.0 - MIT
430
+ * @license @tabler/icons-react v3.17.0 - MIT
431
431
  *
432
432
  * This source code is licensed under the MIT license.
433
433
  * See the LICENSE file in the root directory of this source tree.
@@ -435,7 +435,7 @@
435
435
 
436
436
  @tabler/icons-react/dist/esm/icons/IconSwitchHorizontal.mjs:
437
437
  (**
438
- * @license @tabler/icons-react v3.16.0 - MIT
438
+ * @license @tabler/icons-react v3.17.0 - MIT
439
439
  *
440
440
  * This source code is licensed under the MIT license.
441
441
  * See the LICENSE file in the root directory of this source tree.
@@ -443,7 +443,7 @@
443
443
 
444
444
  @tabler/icons-react/dist/esm/icons/IconTableExport.mjs:
445
445
  (**
446
- * @license @tabler/icons-react v3.16.0 - MIT
446
+ * @license @tabler/icons-react v3.17.0 - MIT
447
447
  *
448
448
  * This source code is licensed under the MIT license.
449
449
  * See the LICENSE file in the root directory of this source tree.
@@ -451,7 +451,7 @@
451
451
 
452
452
  @tabler/icons-react/dist/esm/icons/IconTrash.mjs:
453
453
  (**
454
- * @license @tabler/icons-react v3.16.0 - MIT
454
+ * @license @tabler/icons-react v3.17.0 - MIT
455
455
  *
456
456
  * This source code is licensed under the MIT license.
457
457
  * See the LICENSE file in the root directory of this source tree.
@@ -459,7 +459,7 @@
459
459
 
460
460
  @tabler/icons-react/dist/esm/icons/IconUserSquare.mjs:
461
461
  (**
462
- * @license @tabler/icons-react v3.16.0 - MIT
462
+ * @license @tabler/icons-react v3.17.0 - MIT
463
463
  *
464
464
  * This source code is licensed under the MIT license.
465
465
  * See the LICENSE file in the root directory of this source tree.
@@ -467,7 +467,7 @@
467
467
 
468
468
  @tabler/icons-react/dist/esm/icons/IconX.mjs:
469
469
  (**
470
- * @license @tabler/icons-react v3.16.0 - MIT
470
+ * @license @tabler/icons-react v3.17.0 - MIT
471
471
  *
472
472
  * This source code is licensed under the MIT license.
473
473
  * See the LICENSE file in the root directory of this source tree.
@@ -475,7 +475,7 @@
475
475
 
476
476
  @tabler/icons-react/dist/esm/tabler-icons-react.mjs:
477
477
  (**
478
- * @license @tabler/icons-react v3.16.0 - MIT
478
+ * @license @tabler/icons-react v3.17.0 - MIT
479
479
  *
480
480
  * This source code is licensed under the MIT license.
481
481
  * See the LICENSE file in the root directory of this source tree.