1import{bu as G,bz as X,aU as J,r as x,cj as F,j as e,a7 as s,I as o,iX as Z,dg as y,a_ as R,bQ as U,aw as ee,an as B,iY as O,ce as te,b8 as b}from"./index-BB9zIF0e.js";import{u as ie,a as oe,b as se,C as ne,B as re,c as ae,d as le,P as de,e as ce,O as me,f as pe,g as xe,h as ue}from"./CopilotCallDetailsView-NljT5YnO.js";import{L as he}from"./LoadingContainer--kk_UIel.js";import{aD as _,ak as fe,A as ge,D as T}from"./RootRoute.app-L3TaSlVb.js";import{u as ye}from"./ScriptUtils-Bup7X2Om.js";import"./KeyboardArrowDown-CLBvn_-u.js";import"./ChatPanel-DlrwUpqh.js";import"./dropdown-menu-DzZ8egTM.js";import"./useCallPlayback-NAQdWjI8.js";import"./Add-CKUE0xUV.js";import"./FormControlLabel-BFRZTghq.js";import"./CallChat-DcJhKbFq.js";import"./alert-dialog-D3CcRw3a.js";import"./PlayArrow-C15e9tiW.js";import"./Grid-CNox8AfI.js";import"./CodeEditor-D2ai3Smk.js";import"./SimpleSelect-DJPL2ndE.js";import"./Link-D0kJiXvC.js";import"./Slider-BCPBlpel.js";import"./LanguageTypes-B_iKtSAt.js";import"./switch-DFTrMl4D.js";import"./CallSettingsApi-BsebCS0R.js";import"./label-Ddj_7XnV.js";import"./PatientRecordCard-BxgFKMFv.js";import"./DemoPatientApi-DqvVgYqu.js";import"./BarShortDetailsEntry-C62EpU_F.js";import"./AgentUtils-njy3Sx04.js";import"./CallDialerSetup-CC6nQy-T.js";import"./LinearProgress-BuKEurAE.js";import"./CallDevConfigViewer--VwypO6F.js";import"./CallErrorDialog-D9oqVVuq.js";import"./scriptLabelUtils-BE3VwbCi.js";import"./ActionButton-MAZAsZ58.js";import"./react-hotkeys-hook.esm-DH3789-y.js";import"./CardContent-9ktYs0gW.js";import"./Warning--pz-2WJh.js";import"./AudioPlayer-_aCt-pRS.js";import"./index-D7DospT7.js";import"./FormInputMultipleChoice-Cg8L1Vuf.js";import"./FormInputSlider-DbLXNK1W.js";import"./FormInputSingleChoice-CZi0L2oL.js";import"./RadioGroup-ChUbcXFz.js";import"./Radio-UDRpwIhD.js";import"./FormGroup-Cv3PpDNK.js";import"./TodoConstants-Vp9-MydI.js";import"./Check-XYfpT9Ht.js";import"./DateTimeCell-D_1my2JB.js";import"./Close-BpL-wsGk.js";import"./ClickToEditPopover-OYZzE8u5.js";import"./DatePicker-BdDGlWjn.js";import"./TodoUtils-CPkLOVpM.js";import"./CallSummarySummary-BxGomIuH.js";import"./SubSectionHeader-DwM4f5sr.js";import"./SnowyParrotSimBadge-Bav9AEI1.js";import"./FormInputSelect-BjFrtQ1H.js";import"./Switch-BfFRshBv.js";import"./FormInputDateTime-BfYW3JF0.js";import"./ClickToEditAutocomplete-D5tUqcSz.js";import"./ComplexTable-BO32xBXG.js";import"./useProps-C-9XgY24.js";import"./AppRoutes-1UIil-69.js";import"./CareLocationDropdown-DK8BVYFQ.js";import"./ScriptDropdown-CXjq0sHG.js";import"./DataTable-JcitkL_J.js";import"./useCallManager-Dixsyquf.js";import"./RequireValidCallId-CiFrEaDa.js";import"./SearchScriptDropdown-DeFFCxH4.js";import"./EditOutlined-W3cjA5yM.js";import"./ExpandLess-BD_hcQNB.js";import"./OpenInNew-B6jFXBGU.js";import"./useTranscriptSettings-5ERdZTfU.js";import"./AudioPlayerFloating-CusDL9Oz.js";import"./CallDevSettingsCard-KTezdmWk.js";import"./Download-BNw9wDJn.js";import"./BulkActionBar-BjQrFr9j.js";import"./CallRatingCard-AsHUQXXO.js";import"./SectionHeader-C0ot8i4_.js";import"./FormInputCodeEditor-Bx_4RcjH.js";import"./card-D-oqxT5d.js";import"./UserDropdown-oX1KfMny.js";import"./FilterDropdown-C9FJwqbS.js";import"./LanguageDropdown-CHhcaOhq.js";import"./LongTextCell-Ds9gqgjl.js";import"./usePersistentState-80HDcyUo.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[a]="a1bf2969-4afa-4ee5-8cef-9273ae2d325c",n._sentryDebugIdIdentifier="sentry-dbid-a1bf2969-4afa-4ee5-8cef-9273ae2d325c")}catch{}})();const be=n=>{if(!n)return"N/A";const a=n.split("-");return a.length!==3?n:`${a[1]}/${a[2]}/${a[0]}`},k=()=>{var z,M,N,L;const{patientId:n}=G(),a=_(),p=X(),{data:t,isLoading:Q}=ie(n),u=ye(),d=J("md"),{isMaintenanceMode:q}=fe(),[j,m]=x.useState(null),[r,h]=x.useState(null),[V]=x.useState([]),[$,f]=x.useState(""),[g,H]=x.useState(""),[S,C]=x.useState(""),[D,I]=x.useState(""),[P]=F(),K=P.get("devMode")==="true",w=oe({onSuccess:()=>{f(""),m("success"),p.invalidateQueries({queryKey:["copilotPatientCalls",t==null?void 0:t.patientId]})},onError:i=>{var E,W;console.error("Error scheduling call:",i);const v=((W=(E=i==null?void 0:i.response)==null?void 0:E.data)==null?void 0:W.errorMessage)||(i==null?void 0:i.message);f(v||"Failed to schedule call. Please try again.")}}),{mutate:Y,isPending:A}=se({onSuccess:()=>{p.invalidateQueries({queryKey:["copilotPatient",t==null?void 0:t.patientId]}),C("Phone number updated successfully!"),I(""),setTimeout(()=>C(""),3e3)},onError:i=>{console.error("Phone update error:",i),I((i==null?void 0:i.message)||"Failed to update phone number"),C(""),setTimeout(()=>I(""),5e3)}});if(!a)return e.jsx(s,{sx:{p:4,height:"100vh",display:"flex",justifyContent:"center"},children:e.jsx(o,{variant:"h6",color:"text.primary",textAlign:"center",children:"You do not have access to this page."})});if(Q)return e.jsx(he,{sx:{height:"100vh"}});const c=Z(t,u);t!=null&&t.patientId||y;const l={customerPatientId:(t==null?void 0:t.patientCustomerId)||y,name:c,initials:((M=(z=c==null?void 0:c.split(" "))==null?void 0:z[0])==null?void 0:M[0])+((N=c==null?void 0:c.split(" "))!=null&&N[1]?c.split(" ")[1][0]:""),dateOfBirth:u?be(t==null?void 0:t.dateOfBirth):y,gender:t==null?void 0:t.gender,diagnosis:((L=t==null?void 0:t.conditions)==null?void 0:L.join(", "))||"N/A",admissionLocation:(t==null?void 0:t.admissionLocation)||"N/A",patientLocation:(t==null?void 0:t.admissionLocation)||"N/A",breadcrumbLabel:c};if(!t){const i=!!P.get("iss");return e.jsx(s,{sx:{p:4,height:"100vh",display:"flex",justifyContent:"center"},children:i?e.jsx(R,{severity:"warning",sx:{alignSelf:"flex-start"},children:"The patient is not in the system. Please validate and update all the patient information, including phone numbers. If this issue persists, contact your system administrator."}):e.jsx(o,{variant:"h6",color:"text.primary",textAlign:"center",children:"Patient not found."})})}return e.jsxs(U,{fullWidth:!0,sx:{maxWidth:1280,width:"100%",margin:"0 auto"},children:[e.jsx(ne,{}),e.jsxs(s,{sx:{display:"flex",flexDirection:d?"column":"row",gap:d?2:0,justifyContent:d?"center":"space-between",alignItems:"center",mb:4},children:[e.jsxs(s,{sx:{display:"flex",flexDirection:"row",gap:2,width:"100%",pr:2,justifyContent:d?"center":"space-between",alignItems:"center",flexWrap:"wrap"},children:[e.jsx(re,{items:[{label:"Patient List"},{label:l.breadcrumbLabel||"Patient",isCurrent:!0}]}),K&&u&&e.jsxs(s,{children:[e.jsx(o,{variant:"body2",sx:{fontSize:"1rem",color:"grey"},children:"Patient Phone Number"}),e.jsxs(s,{sx:{display:"flex",gap:1},children:[e.jsx(ee,{size:"small",value:g,onChange:i=>H(i.target.value),placeholder:"e.g., 404-567-8901",sx:{flex:1}}),e.jsx(B,{variant:"contained",size:"small",disabled:A||!g,onClick:()=>{t!=null&&t.patientId&&g&&Y({patientId:t.patientId,params:{phoneNumber:g}})},children:A?"Updating...":"Update"})]}),S&&e.jsx(o,{variant:"body2",sx:{color:"success.main",fontSize:"0.875rem"},children:S}),D&&e.jsx(o,{variant:"body2",sx:{color:"error.main",fontSize:"0.875rem"},children:D})]})]}),e.jsx(B,{variant:"contained",color:"primary",sx:{color:"white",minWidth:d?"100%":130,padding:1},onClick:()=>m("callDetails"),disabled:!!(t!=null&&t.doNotCall)||q===!0,children:"Order AI Call"})]}),e.jsx(s,{sx:{backgroundColor:"white.main",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",borderRadius:2},children:e.jsxs(s,{sx:{display:"flex",gap:2,px:2,py:3,flexDirection:d?"column":"row"},children:[e.jsxs(s,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:2,flex:1},children:[e.jsx(ge,{sx:{width:60,height:60,color:"black",backgroundColor:"grey.300",textAlign:"center",fontSize:"1.2rem",fontWeight:"bold"},children:l.initials}),e.jsxs(s,{sx:{display:"flex",flexDirection:"column",gap:0},children:[e.jsx(o,{variant:"h6",sx:{fontSize:"1.25rem",fontWeight:"bold"},children:l.name}),e.jsxs(o,{variant:"body2",sx:{fontSize:"1rem",color:"grey"},children:["Patient ID: ",l.customerPatientId]}),e.jsxs(o,{variant:"body2",sx:{fontSize:"1rem",color:"grey"},children:["Admission Location: ",l.admissionLocation]})]})]}),e.jsx(T,{orientation:d?"horizontal":"vertical",flexItem:!0}),e.jsxs(s,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",gap:0,flex:1},children:[e.jsxs(s,{sx:{display:"flex",flexDirection:"row"},children:[e.jsx(o,{variant:"body2",sx:{fontSize:"1rem",color:"grey",flex:1},children:"DOB"}),e.jsx(o,{variant:"body1",sx:{fontSize:"1rem",fontWeight:"500",flex:3},children:l.dateOfBirth})]}),e.jsxs(s,{sx:{display:"flex",flexDirection:"row"},children:[e.jsx(o,{variant:"body2",sx:{fontSize:"1rem",color:"grey",flex:1},children:"Gender"}),e.jsx(o,{variant:"body1",sx:{fontSize:"1rem",fontWeight:"500",flex:3},children:l.gender})]}),e.jsxs(s,{sx:{display:"flex",flexDirection:"row"},children:[e.jsx(o,{variant:"body2",sx:{fontSize:"1rem",color:"grey",flex:1},children:"Diagnosis"}),e.jsx(o,{variant:"body1",sx:{fontSize:"1rem",fontWeight:"500",flex:3},children:l.diagnosis})]})]}),e.jsx(T,{orientation:d?"horizontal":"vertical",flexItem:!0}),e.jsxs(s,{sx:{display:"flex",flexDirection:"column",gap:.5,flex:1},children:[e.jsxs(s,{sx:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center"},children:[e.jsx(o,{variant:"body2",sx:{fontSize:"1rem",color:"grey",flex:1},children:"Patient location"}),e.jsx(o,{variant:"body1",sx:{fontSize:"1rem",fontWeight:"500",flex:d?3:2},children:l.patientLocation})]}),e.jsxs(s,{sx:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"flex-start"},children:[e.jsx(o,{variant:"body2",sx:{fontSize:"1rem",color:"grey",flex:1},children:"Phone number"}),e.jsx(s,{sx:{flex:d?3:2},children:u?t!=null&&t.phoneNumbers&&t.phoneNumbers.length>0?t.phoneNumbers.map((i,v)=>e.jsxs(o,{variant:"body1",sx:{fontSize:"1rem",fontWeight:"500"},children:[O(i.number),i.type?` (${i.type})`:""]},v)):e.jsx(o,{variant:"body1",sx:{fontSize:"1rem",fontWeight:"500"},children:t!=null&&t.phoneNumber?O(t.phoneNumber):"N/A"}):e.jsx(o,{variant:"body1",sx:{fontSize:"1rem",fontWeight:"500"},children:y})})]})]})]})}),e.jsx(ae,{patientId:t.patientId,localScheduledCalls:V,sx:{mt:4}}),e.jsx(le,{patientId:t.patientId}),e.jsx(de,{patientId:t.patientId,containerSx:{mt:4,flex:1,backgroundColor:"white.main",borderRadius:2,width:"100%",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",p:2}}),e.jsx(ce,{patientId:t.patientId,sx:{mt:4,mb:4,backgroundColor:"white.main",p:2,boxShadow:"0 2px 8px rgba(0,0,0,0.1)",borderRadius:2}}),e.jsx(me,{open:j==="callDetails",onClose:()=>{m(null),h(null)},patientId:t.patientId,patientName:l.name||"",onConfirm:i=>{h(i),m("confirm")},initialFormData:r}),r&&e.jsx(pe,{open:j==="confirm",onClose:()=>{m(null),h(null),f("")},formData:r,patientName:l.name||"",onEdit:()=>{m("callDetails"),f("")},onSubmit:()=>{if(!(t!=null&&t.patientId)||!r)return;const i=r.scheduledDate.hour(r.scheduledTime.hour()).minute(r.scheduledTime.minute()).second(0);w.mutate({patientId:t.patientId,params:{scriptId:r.purposeOfCallScriptId,agentId:r.purposeOfCallAgentId,scheduledFor:i.toISOString(),phoneNumber:r.patientNumber||void 0,smsNotificationPreludeMinutes:r.sendPreCallSms?r.smsLeadTimeMinutes:null}})},errorMessage:$,isSubmitting:w.isPending}),e.jsx(xe,{open:j==="success",onClose:()=>m(null),onContinue:()=>{m(null),h(null),p.invalidateQueries({queryKey:["copilotPatientCalls",t.patientId]})}})]})},je=()=>{const n=_(),[a]=F(),p=a.get("patient_error");return n?e.jsxs(U,{fullWidth:!0,sx:{maxWidth:1280,width:"100%",margin:"0 auto"},children:[e.jsx(o,{variant:"h5",color:"text.primary",textAlign:"left",sx:{mb:4},children:"Copilot App"}),p&&e.jsx(R,{severity:"warning",sx:{mb:3,justifyContent:"center",textAlign:"center"},children:p})]}):e.jsx(s,{sx:{p:4,height:"100vh",display:"flex",justifyContent:"center"},children:e.jsx(o,{variant:"h6",color:"text.primary",textAlign:"center",children:"You do not have access to this page."})})},Xt=()=>e.jsxs(te,{children:[e.jsx(b,{path:"/",element:e.jsx(je,{})}),e.jsx(b,{path:"/:patientId",element:e.jsx(k,{})}),e.jsx(b,{path:"/patient/:patientId",element:e.jsx(k,{})}),e.jsx(b,{path:"/call/:callId",element:e.jsx(ue,{})})]});
1export{Xt as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.