PageSourceSearch

https://care.soberpedia.ai/assets/MessagingDock-DJtWLjo9.js

js soberpedia.ai collected 2026-10-05 15:08:05 UTC 40,510 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MessageThread-CEHOWd4Q.js","assets/index-DEXJEDAi.js","assets/react-vendor-CU6Sz31W.js","assets/firebase-w6DYUbFN.js","assets/payment-icons-Daq1K3F1.js","assets/index-ClGd-I0y.css","assets/PatientMessageBubble-Bc4kHqR0.js","assets/usePatientTerminology-D5bkkKg2.js","assets/MessageReferenceCard-xR6G19kl.js","assets/patientMessagingOptions-Dc-_9yed.js","assets/pause-COS6hXZe.js","assets/user-round-c4EWOTq5.js","assets/useVisitChartingLauncher-B1f2Z2_Q.js","assets/patient-name-link-BAfQKbEs.js","assets/text-highlight-BFqqfcjs.js","assets/messageSenderAvatar-CGZkJPbI.js","assets/PatientMessagingAvatar-C3F9AEyi.js","assets/patientDocumentsApi-CnQk1h-f.js","assets/patientProfileImagePresentation-2S0zk7yR.js","assets/pin-B5H-Kh6l.js","assets/smile-plus-BGOY06Pg.js","assets/ellipsis-C0FvDuxB.js","assets/message-square-text-CBK4eOxL.js","assets/pencil-CpqYHolO.js","assets/PatientMessageBubble-p4egPoL9.css","assets/useConversationReadReceipts-Br2Tc5Uo.js","assets/prescriptionMessageTemplateVariables-AMxKc8BX.js","assets/modal-form-CqN5DZuv.js","assets/bot-CKyIH0jX.js","assets/list-ordered-GNrnoOhB.js","assets/strikethrough-CiKozLGy.js","assets/code-BEcI87AG.js","assets/conversationPreferences-CoTEWpkl.js","assets/clinicalListQuery-CzryaIFC.js","assets/patientFormSubmissions-QLrv_VPb.js","assets/patientFormSubmissionScopes-Cza2w0ep.js","assets/activityUtils-Bh197QiR.js","assets/patientMessagingScope-DaW-b0v9.js","assets/link-2-a8lhpkQ6.js","assets/renderedRangeScheduler-CrBymY0A.js","assets/useEditorTranscription-CN2PcNng.js","assets/square-D7DkS8S2.js","assets/audio-lines-GJL3_Ka2.js","assets/arrow-up-D6DFVL4j.js","assets/send-horizontal-D2BzseLj.js","assets/conversationDescription-BU6Tmq1N.js","assets/conversationMessagingStatus-D8XRnejx.js","assets/tenantColorRamps-QDc1G_tU.js","assets/archive-restore-1_z2aByp.js","assets/clock-3-31WD3-4z.js","assets/hash-C7GcXMrW.js","assets/useOpenPatientProfile-CASNKG5E.js","assets/index-BSuGcRaZ.js"])))=>i.map(i=>d[i]);
2import{dQ as Ue,cJ as qe,cK as He,an as Le,ao as ge,i as Me,hQ as ot,u as Je,bg as ae,be as dt,b1 as ct,b2 as mt,cW as ut,hR as xt,t as Ce,at as Be,a3 as pt,hS as De,S as ft,ei as gt,hT as ht,cr as bt,hU as Nt,bd as wt,al as yt,aE as jt,hV as kt,hW as Ct,bc as vt,b as W,as as Xe,au as It,fU as St,fT as Mt,bj as Tt,bk as Ut,bl as Pt,c5 as zt}from"./index-DEXJEDAi.js";import{j as t,r as d,d as At,e as Et}from"./react-vendor-CU6Sz31W.js";import{f as Rt,d as Ze,g as Lt}from"./firebase-w6DYUbFN.js";import{f as Te,h as Bt,c as $t,b as $e,e as et}from"./conversationDescription-BU6Tmq1N.js";import{f as _t}from"./patientMessagingScope-DaW-b0v9.js";import{P as tt}from"./PatientMessagingAvatar-C3F9AEyi.js";import{D as Ot}from"./DirectPatientPicker-CtEQzRii.js";import{u as Ft}from"./usePatientTerminology-D5bkkKg2.js";import{U as Re}from"./users-round-D-FMfvEe.js";import{U as ve}from"./user-round-c4EWOTq5.js";import{i as at}from"./conversationMessagingStatus-D8XRnejx.js";import{M as Dt}from"./minus-Du80G9MU.js";import"./payment-icons-Daq1K3F1.js";import"./messageSenderAvatar-CGZkJPbI.js";import"./patientDocumentsApi-CnQk1h-f.js";import"./patientProfileImagePresentation-2S0zk7yR.js";import"./PatientConversationPicker-CZwukVSd.js";const Gt=new Set(["Provider Network Admin","Provider","Provider Delegate"]),Kt=new Set(["Client Admin","Client Staff"]),Vt=new Set(["Business Admin","Business Location Admin","Business Staff","Business Provider"]),Yt=12,Wt=30;function Qt(e,l=250){const[i,s]=d.useState(e);return d.useEffect(()=>{const r=window.setTimeout(()=>s(e),l);return()=>window.clearTimeout(r)},[l,e]),i}function J(e={}){return e.displayName||e.name||e.businessName||"Client"}function ie(e={},l="Contact"){return[e.firstName,e.lastName].filter(Boolean).join(" ")||e.displayName||e.fullName||e.name||e.email||l}function st(e=""){return String(e).split(/\s+/).filter(Boolean).slice(0,2).map(l=>l[0]).join("").toUpperCase()||"?"}function Ie({children:e,color:l="bg-emerald-500"}){return t.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-slate-100 px-1.5 py-0.5 text-3xs font-medium text-content-secondary dark:bg-slate-700",children:[t.jsx("span",{className:`size-1.5 rounded-full ${l}`,"aria-hidden":!0}),e]})}function ze({children:e,color:l=null}){return e?t.jsx("span",{className:"max-w-[10rem] truncate rounded-full border border-transparent px-1.5 py-0.5 text-3xs font-semibold leading-none text-white",style:{backgroundColor:l||"#64748b"},children:e}):null}function qt(){return t.jsx("span",{className:"rounded-full bg-slate-100 px-2 py-0.5 text-3xs font-semibold leading-none text-content-secondary dark:bg-slate-700",children:"Group Chat"})}
2function Ae({options:e,value:l,onChange:i,accentColor:s}){const r=Ue();return t.jsx("div",{className:"relative inline-flex items-center rounded-full bg-slate-100 p-0.5 dark:bg-slate-800",role:"tablist","aria-label":"Message recipient type",children:e.map(n=>{const o=l===n.id;return t.jsxs("button",{type:"button",role:"tab","aria-selected":o,onClick:()=>i(n.id),className:`relative rounded-full px-3 py-1.5 text-xs font-medium transition-colors max-lg:px-2.5 max-lg:py-1 max-lg:text-2xs ${o?"text-white":"text-slate-600 hover:text-slate-900 dark:text-slate-300 dark:hover:text-slate-100"}`,children:[o?t.jsx(ge.span,{layoutId:"messaging-compose-filter-pill",className:"absolute inset-0 rounded-full shadow-sm",style:{backgroundColor:s},transition:r?{duration:0}:{type:"spring",stiffness:480,damping:36,mass:.7},"aria-hidden":!0}):null,t.jsx("span",{className:"relative z-raised",children:n.label})]},n.id)})})}function Ht({avatars:e=[],accentColor:l}){const i=e.slice(0,3);for(;i.length<3;)i.push({label:"Team",color:l});return t.jsx("span",{className:"relative size-9 shrink-0 max-lg:size-8","aria-hidden":!0,children:i.map((s,r)=>t.jsx("span",{className:"absolute flex size-6 items-center justify-center overflow-hidden rounded-full border border-default text-[8px] font-semibold text-white",style:{left:`${r*4}px`,top:`${r*4}px`,zIndex:r+1,backgroundColor:s.color||l},children:s.imageUrl?t.jsx("img",{src:s.imageUrl,alt:"",className:"h-full w-full object-cover"}):st(s.label)},`${s.label||"avatar"}:${r}`))})}function Ge({primary:e,secondaryLabel:l="Network",accentColor:i}){return[{label:(e==null?void 0:e.label)||"Group",color:(e==null?void 0:e.color)||i,imageUrl:(e==null?void 0:e.imageUrl)||null},{label:l,color:i},{label:"Team",color:"#64748b"}]}function X({icon:e,avatar:l=null,patientAvatar:i=null,avatars:s=null,title:r,detail:n,meta:o=null,onClick:m,disabled:b=!1,accentColor:u,rowStyle:x=null}){return t.jsxs("button",{type:"button",disabled:b,onClick:m,className:"flex w-full items-center gap-3 px-4 py-3 text-left hover:bg-slate-50 disabled:cursor-wait disabled:opacity-60 max-lg:gap-2 max-lg:px-3 max-lg:py-2 dark:hover:bg-slate-800/60",style:x||void 0,children:[Array.isArray(s)&&s.length>0?t.jsx(Ht,{avatars:s,accentColor:u}):i?t.jsx(tt,{userId:i.userId,patient:i.patient,name:i.name,className:"size-9 shrink-0 max-lg:size-8",fallbackClassName:"text-xs text-white",accentColor:u,loadDocumentFallbacks:!0}):l?t.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-full border border-default text-xs font-semibold text-white max-lg:size-8",style:{backgroundColor:l.color||u},children:l.imageUrl?t.jsx("img",{src:l.imageUrl,alt:"",className:"h-full w-full object-cover"}):st(l.label)}):t.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-full border border-default bg-slate-100 text-content-secondary max-lg:size-8 dark:bg-slate-800",style:e===Re?{color:u,backgroundColor:`color-mix(in srgb, ${u} 12%, white)`}:void 0,children:t.jsx(e,{className:"size-4","aria-hidden":!0})}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsxs("span",{className:"flex min-w-0 items-center justify-between gap-2",children:[t.jsx("span",{className:"min-w-0 truncate text-sm font-medium text-content-primary max-lg:text-xs",children:r}),o?t.jsx("span",{className:"flex shrink-0 items-center gap-1.5",children:o}):null]}),n?t.jsx("span",{className:"mt-0.5 block truncate text-xs text-content-tertiary max-lg:text-2xs",children:n}):null]})]})}function Jt({query:e,setQuery:l,selected:i,onClearSelected:s,accentColor:r}){const n=d.useRef(null);return t.jsxs("div",{role:"button",tabIndex:0,className:"flex min-h-10 cursor-text items-center gap-2 px-4 py-2 max-lg:gap-1.5 max-lg:px-3",onClick:()=>{var o;return(o=n.current)==null?void 0:o.focus()},onKeyDown:o=>{var m;(o.key==="Enter"||o.key===" ")&&((m=n.current)==null||m.focus())},children:[t.jsx("span",{className:"text-sm text-slate-700 max-lg:shrink-0 max-lg:text-xs dark:text-slate-300",children:"To:"}),i?t.jsxs("span",{className:"inline-flex max-w-[13rem] items-center gap-1.5 rounded-lg px-2.5 py-1 text-sm font-medium text-white max-lg:max-w-[10rem] max-lg:gap-1 max-lg:px-2 max-lg:py-0.5 max-lg:text-xs",style:{backgroundColor:r},children:[t.jsx("span",{className:"truncate",children:i.name}),t.jsx("button",{type:"button",onClick:s,"aria-label":"Clear recipient",children:t.jsx(Be,{className:"size-3.5","aria-hidden":!0})})]}
2):null,t.jsx("input",{ref:n,value:e,onChange:o=>l(o.target.value),className:"min-w-0 flex-1 border-0 bg-transparent p-0 text-sm text-content-primary outline-none ring-0 placeholder:text-slate-400 focus:outline-none focus:ring-0 dark:placeholder:text-slate-500",placeholder:i?"":"Search people","aria-label":"Search message recipients"})]})}function Xt({accentColor:e,onSelectConversation:l,onOpenChange:i}){const{userDoc:s,availableClients:r,clientData:n,businessData:o,providerNetworkBrandingMap:m}=Je(),b=(s==null?void 0:s.userType)||"",u=ae(b,[...Gt]),x=ae(b,[...Kt]),h=Vt.has(b),N=(s==null?void 0:s.businessId)||null,j=(s==null?void 0:s.clientId)||null,{singular:E,plural:k}=Ft(),S=u&&!!(s!=null&&s.providerNetworkId)||x&&!N&&!!j,R=dt(b,"Provider")&&!N,[D,L]=d.useState(""),[f,C]=d.useState(()=>u?"clients":x?"network":"patients"),[v,$]=d.useState(null),[M,K]=d.useState(null),[be,T]=d.useState(null),[Ne,oe]=d.useState([]),[we,V]=d.useState(!1),[O,Z]=d.useState([]),[se,de]=d.useState(!1),[ce,B]=d.useState(null),[U,Y]=d.useState(""),P=Qt(D),I=d.useMemo(()=>u?_t(r||[],s==null?void 0:s.providerNetworkId):[],[r,u,s==null?void 0:s.providerNetworkId]),_=d.useMemo(()=>I.find(a=>a.id===v)||null,[I,v]),ye=d.useMemo(()=>new Map(I.map(a=>[a.id,J(a)])),[I]),me=d.useMemo(()=>new Map(I.map(a=>[a.id,a.accentColor||a.brandColor||e])),[e,I]),ue=d.useMemo(()=>new Map(I.map(a=>[a.id,{label:J(a),color:a.accentColor||a.brandColor||e,imageUrl:Te(a)}])),[e,I]),c=ct(n||{}),w=mt(n||{}).join("|"),g=(n==null?void 0:n.primaryProviderNetwork)||(n==null?void 0:n.providerNetwork)||null,xe=(g==null?void 0:g.displayName)||(g==null?void 0:g.name)||(n==null?void 0:n.primaryProviderNetworkName)||(n==null?void 0:n.providerNetworkName)||null,z=(g==null?void 0:g.accentColor)||null,G=g?Te(g):null,Q=d.useMemo(()=>w.split("|").filter(Boolean).map(a=>{const p=(m==null?void 0:m[a])||null,y=a===c,ke=(p==null?void 0:p.name)||(y?xe:null)||"Provider Network";return{id:a,name:ke,avatar:{label:ke,color:(p==null?void 0:p.accentColor)||(y?z:null)||e,imageUrl:(p==null?void 0:p.iconUrl)||(p==null?void 0:p.logoUrl)||(y?G:null)||null},rowStyle:p!=null&&p.backgroundColor?{backgroundColor:p.backgroundColor}:null}}),[e,w,c,z,G,xe,m]),F=Q.find(a=>a.id===M)||null,q=(F==null?void 0:F.name)||"Provider Network",pe=P.trim().toLowerCase(),ee=pe?Q.filter(a=>[a.name,a.id].some(p=>String(p||"").toLowerCase().includes(pe))):Q,le=d.useMemo(()=>N?[N]:u?v?[v]:I.map(a=>a.id).filter(Boolean):j?[j]:[],[j,u,N,I,v]),te=N?"businessId":"clientId",je=d.useMemo(()=>!u||!v?O:O.filter(a=>a.clientId===v),[u,v,O]),H=d.useMemo(()=>{const a=P.trim().toLowerCase();return a?I.filter(p=>[J(p),p.id].some(y=>String(y||"").toLowerCase().includes(a))):I},[P,I]);d.useEffect(()=>{!u||f!=="clients"||!P.trim()||H.length>0||C("patients")},[P,f,H.length,u]),d.useEffect(()=>{!x&&!h&&!u||f!=="patients"&&!(u&&f==="clientUsers")&&!(x&&f==="network")||T(null)},[f,x,u,h]),d.useEffect(()=>{if(f!=="patients"||le.length===0){oe([]),V(!1);return}let a=!1;return V(!0),ut({entity:"patients",query:P.trim(),tenantFilters:le,tenantField:te,perPage:Yt,page:1,sortField:"sortDisplayName",sortDirection:"asc",includeFacets:!1}).then(p=>{a||oe(Array.isArray(p==null?void 0:p.patients)?p.patients:[])}).catch(()=>{a||oe([])}).finally(()=>{a||V(!1)}),()=>{a=!0}},[P,f,te,le]),d.useEffect(()=>{const a=f==="team"&&S;if(!(a||x&&f==="network"&&M||u&&f==="clientUsers"))return;let y=!1;de(!0),Z([]);const ke=x&&f==="network"&&M;return xt({search:P.trim(),pageSize:Wt,...a?{recipientScope:"team"}:{},...!a&&ke?{providerNetworkId:M}:{}}).then(A=>{if(!y){if((A==null?void 0:A.success)===!1)throw new Error(A.error);a||B((A==null?void 0:A.messagingPolicy)||null),Z(Array.isArray(A==null?void 0:A.recipients)?A.recipients:[])}}).catch(A=>{y||(Z([]),Ce.error((A==null?void 0:A.message)||"Unable to load message recipients."))}).finally(()=>{y||de(!1)}),()=>{y=!0}},[S,P,f,x,u,M]);const ne=d.useCallback((a,p)=>{if(!(a!=null&&a.success)||!a.conversationId)throw new Error((a==null?void 0:a.error)||p);i(!1),l(a.conversationId)},[i,l]);async function it(a){const p=ie(a,"Patient");T({name:p}),Y(`patient:${a.id||a.userId}`);try{ne(await wt(a.id||a.userId),"Unable to open this patient conversation.")}catch(y){T(null),Ce.error((y==null?void 0:y.message)||"Unable to open this patient conversation.")}finally{Y("")}}async function Pe(a){T({name:ie(a,"Contact")}),Y(`staff:${a.id}`);
2try{ne(await Nt(a.id),"Unable to open this staff conversation.")}catch(p){T(null),Ce.error((p==null?void 0:p.message)||"Unable to open this staff conversation.")}finally{Y("")}}async function Fe(a=null){const p=a!=null&&a.id?`client-group:${a.id}`:"network-group";T({name:a?`${J(a)} group`:`${q} group`}),Y(p);try{const y=a?await gt(a.id):await ht(M);ne(y,"Unable to open this group chat.")}catch(y){T(null),Ce.error((y==null?void 0:y.message)||"Unable to open this group chat.")}finally{Y("")}}if(!x&&!h&&!u)return t.jsx("div",{className:"flex h-40 items-center justify-center px-6 text-center max-lg:h-32 max-lg:px-3",children:t.jsx("p",{className:"text-sm text-content-tertiary max-lg:text-xs",children:"New messages are not available for this role."})});const rt=x&&ce&&ce.groupChatEnabled!==!1;return t.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-surface-raised",children:[t.jsxs("div",{className:"flex shrink-0 items-center justify-between px-4 py-2 max-lg:px-3 max-lg:py-1.5",children:[t.jsx("p",{className:"text-base font-semibold text-content-primary max-lg:text-sm",children:"New message"}),t.jsx("button",{type:"button",className:"rounded-full p-1.5 text-content-tertiary hover:bg-slate-100 dark:hover:bg-slate-800",onClick:()=>i(!1),"aria-label":"Close new message",children:t.jsx(Be,{className:"size-5","aria-hidden":!0})})]}),f==="direct"?null:t.jsx(Jt,{query:D,setQuery:L,selected:be,onClearSelected:()=>T(null),accentColor:e}),t.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-y border-slate-100 px-4 py-2 max-lg:gap-1.5 max-lg:px-3 max-lg:py-1.5 max-lg:overflow-x-auto max-lg:[&>*]:shrink-0 dark:border-slate-800",children:[x?t.jsx(Ae,{value:f,onChange:a=>{C(a),a==="network"&&K(null)},accentColor:e,options:[{id:"network",label:"Network"},...S?[{id:"team",label:"Team"}]:[],{id:"patients",label:"Patients"}]}):null,h?t.jsx(Ae,{value:"patients",onChange:()=>C("patients"),accentColor:e,options:[{id:"patients",label:"Patients"}]}):null,u?t.jsx(Ae,{value:f==="clientUsers"?"clients":f,onChange:a=>{if(a==="clients"){C("clients"),$(null);return}C(a)},accentColor:e,options:[{id:"clients",label:"Clients"},...S?[{id:"team",label:"Team"}]:[],{id:"patients",label:"Patients"},...R?[{id:"direct",label:"Direct"}]:[]]}):null]}),t.jsxs("div",{className:"min-h-0 flex-1 divide-y divide-slate-200 overflow-y-auto dark:divide-slate-700",children:[f==="network"?M?t.jsxs(t.Fragment,{children:[t.jsxs("button",{type:"button",onClick:()=>{K(null),L("")},className:"flex w-full items-center gap-2 bg-surface-sunken px-4 py-2 text-left text-xs font-medium text-content-secondary hover:text-slate-900 max-lg:gap-1.5 max-lg:px-3 max-lg:py-1.5 max-lg:text-2xs dark:hover:text-slate-100",children:[t.jsx(pt,{className:"size-4","aria-hidden":!0}),t.jsx("span",{className:"truncate",children:q})]}),rt?t.jsx(X,{icon:Re,avatar:F==null?void 0:F.avatar,title:q,meta:t.jsx(qt,{}),onClick:()=>void Fe(),disabled:!!U,accentColor:e,rowStyle:F==null?void 0:F.rowStyle}):null,se?t.jsx(Se,{}):O.length===0?t.jsx(fe,{label:"No network users are available."}):O.map(a=>t.jsx(X,{icon:ve,title:ie(a,"Provider"),detail:"Direct network message",meta:t.jsx(Ie,{color:"bg-sky-500",children:a.userType||"Provider"}),onClick:()=>void Pe(a),disabled:!!U,accentColor:e},a.id))]}):ee.length===0?t.jsx(fe,{label:P?"No networks match your search.":"No messaging networks are available."}):ee.map(a=>t.jsx(X,{icon:De,avatar:a.avatar,title:a.name,onClick:()=>{Z([]),B(null),K(a.id),L("")},accentColor:e,rowStyle:a.rowStyle},a.id)):null,f==="clients"?I.length===0?t.jsx(fe,{label:"No linked clients available."}):H.map(a=>t.jsx(X,{icon:De,avatars:Ge({primary:ue.get(a.id),accentColor:a.accentColor||a.brandColor||e}),title:t.jsx("span",{className:"inline-flex max-w-full items-center rounded-full px-2 py-0.5 text-xs font-semibold text-white max-lg:text-2xs",style:{backgroundColor:a.accentColor||a.brandColor||e},children:t.jsx("span",{className:"truncate",children:J(a)})}),onClick:()=>{$(a.id),L(""),C("clientUsers")},accentColor:e},a.id)):null,f==="clientUsers"?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"bg-surface-sunken px-4 py-2 text-xs font-medium text-content-secondary max-lg:px-3 max-lg:py-1.5 max-lg:text-2xs",children:_?J(_):"Client"}),_?t.jsx(X,{icon:Re,avatars:Ge({primary:ue.get(_.id),accentColor:_.accentColor||_.brandColor||e}),title:`${J(_)}
2 group chat`,detail:"Shared client and provider-network thread",meta:t.jsxs(t.Fragment,{children:[t.jsx(Ie,{color:"bg-blue-500",children:"Group"}),t.jsx(ze,{color:_.accentColor||_.brandColor||e,children:J(_)})]}),onClick:()=>void Fe(_),disabled:!!U,accentColor:e}):null,se?t.jsx(Se,{}):je.map(a=>t.jsx(X,{icon:ve,title:ie(a,"Client user"),detail:"Direct client message",meta:t.jsxs(t.Fragment,{children:[t.jsx(Ie,{color:"bg-sky-500",children:a.userType||"Client Staff"}),t.jsx(ze,{color:me.get(a.clientId),children:a.clientName||ye.get(a.clientId)})]}),onClick:()=>void Pe(a),disabled:!!U,accentColor:e},a.id))]}):null,f==="team"?se?t.jsx(Se,{}):O.length===0?t.jsx(fe,{label:P?"No teammates match your search.":"No other active teammates are available."}):O.map(a=>t.jsx(X,{icon:ve,title:ie(a,"Teammate"),detail:a.groupLabel||"Your team",meta:t.jsx(Ie,{children:a.userType||"Staff"}),onClick:()=>void Pe(a),disabled:!!U,accentColor:e},a.id)):null,f==="direct"?t.jsx("div",{className:"flex h-full min-h-0 flex-col p-3 max-lg:p-2",children:t.jsx(Ot,{clients:I,onOpened:a=>{i(!1),l(a)},accentColor:e,careSingular:E,carePlural:k})}):null,f==="patients"?we?t.jsx(Se,{}):Ne.length===0?t.jsx(fe,{label:P?"No patients match your search.":`No ${o!=null&&o.name?"business ":""}patients found.`}):Ne.map(a=>{const p=a.id||a.userId,y=ie(a,"Patient");return t.jsx(X,{icon:ve,patientAvatar:{userId:p,patient:a,name:y},title:y,detail:a.email||a.phone||a.phoneNumber||"Patient conversation",meta:u?t.jsx(ze,{color:me.get(a.clientId||a.client),children:ye.get(a.clientId||a.client)}):null,onClick:()=>void it(a),disabled:!!U,accentColor:e},p)}):null]}),U?t.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-t border-slate-100 px-4 py-2 text-xs text-content-tertiary max-lg:gap-1.5 max-lg:px-3 max-lg:py-1.5 max-lg:text-2xs dark:border-slate-800",children:[t.jsx(ft,{size:"sm"}),"Opening conversation"]}):null]})}function Se(){return t.jsx("div",{className:"space-y-1 p-3 max-lg:p-2",role:"status","aria-label":"Loading recipients",children:[0,1,2].map(e=>t.jsxs("div",{className:"flex items-center gap-3 rounded-lg px-1 py-2 max-lg:gap-2 max-lg:py-1.5",children:[t.jsx("div",{className:"size-9 rounded-full bg-slate-100 max-lg:size-8 dark:bg-slate-800"}),t.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[t.jsx("div",{className:"h-3 w-2/5 rounded bg-slate-100 dark:bg-slate-800"}),t.jsx("div",{className:"h-2.5 w-1/3 rounded bg-slate-100 dark:bg-slate-800"})]})]},e))})}function fe({label:e}){return t.jsxs("div",{className:"flex flex-col items-center gap-2 px-6 py-10 text-center max-lg:gap-1.5 max-lg:px-4 max-lg:py-7",children:[t.jsx(bt,{className:"size-5 text-slate-400","aria-hidden":!0}),t.jsx("p",{className:"text-sm text-content-tertiary max-lg:text-xs",children:e})]})}const Ke=d.forwardRef(function({accentColor:l,unreadCount:i,...s},r){const n=i>0?`, ${i} unread`:"";return t.jsxs(Me,{ref:r,type:"button",size:"icon",className:"relative size-12 shrink-0 rounded-full border-0 text-white shadow-lg shadow-slate-900/15 transition-transform hover:brightness-95 active:scale-[0.96] max-lg:size-11",style:{backgroundColor:l},"aria-label":`Start a new message${n}`,"data-testid":"button-messaging-dock-inbox",...s,children:[t.jsx(ot,{className:"size-5","aria-hidden":!0}),i>0?t.jsx("span",{className:"absolute -right-1 -top-1 inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-red-500 px-1 text-3xs font-semibold text-white","aria-hidden":!0,children:i>9?"9+":i}):null]})});function Ve({accentColor:e,isMobileOrTablet:l,onOpenChange:i,onSelectConversation:s,open:r,desktopWindowCount:n=0,unreadCount:o=0}){const m=Ue(),b=r?t.jsx(Xt,{accentColor:e,onSelectConversation:s,onOpenChange:i}):null;return l?t.jsxs(t.Fragment,{children:[t.jsx(Ke,{accentColor:e,unreadCount:o,"aria-expanded":r,onClick:()=>i(!0)}),t.jsx(qe,{open:r,onOpenChange:i,children:t.jsx(He,{side:"bottom",accessibleTitle:"New message",accessibleDescription:"Choose a recipient to start a secure conversation",hideCloseButton:!0,className:"z-50 h-[min(82dvh,42rem)] overflow-hidden rounded-t-xl border-subtle bg-surface-raised p-0",containChildOverlays:!0,"data-testid":"dialog-messaging-dock-inbox",children:b})})]}):t.jsxs(t.Fragment,{children:[t.jsx(Ke,{accentColor:e,unreadCount:o,"aria-expanded":r,onClick:()=>i(!r)}),t.jsx(Le,{initial:!1,children:r?t.jsx(ge.div,{className:"fixed bottom-0 z-[42] h-[min(34rem,100dvh)] w-[min(24rem,calc(100vw-7rem))] overflow-hidden rounded-t-xl rounded-b-none border border-subtle bg-surface-raised shadow-2xl shadow-slate-900/15 will-change-transform",style:{right:`calc(5rem + ${n*22.5}rem)`},initial:m?!1:{opacity:0,y:"100%"}
2,animate:{opacity:1,y:0},exit:m?void 0:{opacity:0,y:"100%"},transition:m?{duration:0}:{duration:.24,ease:[.22,1,.36,1]},role:"dialog","aria-label":"New message","data-testid":"dialog-messaging-dock-inbox",children:b}):null})]})}const _e=new Set(["Provider Network Admin","Provider","Provider Delegate"]),Oe=new Set(["Client Admin","Client Staff"]),Ye=240,Zt=d.lazy(()=>zt(()=>import("./MessageThread-CEHOWd4Q.js").then(e=>e.f),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52])).then(e=>({default:e.MessageThread})));function ea(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(e||"").trim())}function he(e={},l="Contact",i=[]){const s=String((e==null?void 0:e.fullName)||"").trim(),r=[e==null?void 0:e.firstName,e==null?void 0:e.lastName].filter(Boolean).join(" ").trim(),n=String((e==null?void 0:e.name)||"").trim(),o=String((e==null?void 0:e.displayName)||"").trim();return[s,r,n,o,...i].find(m=>m&&!ea(m))||(e==null?void 0:e.email)||s||r||n||o||l}function lt(e,l,i,s="Chat"){var n,o;if(!e)return s;if(Bt(e))return $t(e,{viewerIsClient:ae(i,[...Oe])});if($e(e))return`# ${et({conversation:e,currentUserId:l}).displayName}`;if(e.patientId){const m=e.patient||((n=e.participants)==null?void 0:n[e.patientId]);return he(m,s,[e.patientName])}const r=(o=Object.entries(e.participants||{}).find(([m])=>m!==l))==null?void 0:o[1];return he(r,s)}function ta(e,l,i,s="Chat"){var m,b,u,x,h,N,j;const r=ae(i,[..._e]);if($e(e))return{label:et({conversation:e,currentUserId:l}).displayName,imageUrl:null,color:W};if((e==null?void 0:e.networkScoped)===!0)return r?{label:((m=e.client)==null?void 0:m.name)||e.clientName||"Client",imageUrl:Te(e.client)||e.clientIconUrl||e.clientLogoUrl||null,color:((b=e.client)==null?void 0:b.accentColor)||e.clientAccentColor||W}:{label:((u=e.providerNetwork)==null?void 0:u.displayName)||((x=e.providerNetwork)==null?void 0:x.name)||e.providerNetworkName||"Provider Network",imageUrl:Te(e.providerNetwork)||e.providerNetworkIconUrl||e.providerNetworkLogoUrl||null,color:((h=e.providerNetwork)==null?void 0:h.accentColor)||e.providerNetworkAccentColor||W};const n=e!=null&&e.patientId?e.patient||((N=e.participants)==null?void 0:N[e.patientId]):(j=Object.entries((e==null?void 0:e.participants)||{}).find(([E])=>E!==l))==null?void 0:j[1];return{label:e!=null&&e.patientId?he(n,s,[e.patientName]):he(n,s),imageUrl:(n==null?void 0:n.avatarUrl)||(n==null?void 0:n.photoURL)||(n==null?void 0:n.photoUrl)||(n==null?void 0:n.imageUrl)||null,color:"#2563eb"}}function aa(e,l,i){var b,u,x,h,N,j,E,k,S,R,D,L,f,C,v,$;const s=ae(i,[..._e]),r=lt(e,l,i),n=(e==null?void 0:e.networkScoped)===!0||Array.isArray(e==null?void 0:e.participantIds)&&e.participantIds.length>2;if((e==null?void 0:e.networkScoped)===!0){const M=s?((b=e.client)==null?void 0:b.name)||e.clientName:((u=e.providerNetwork)==null?void 0:u.displayName)||((x=e.providerNetwork)==null?void 0:x.name)||e.providerNetworkName,K=s?((h=e.client)==null?void 0:h.accentColor)||e.clientAccentColor:((N=e.providerNetwork)==null?void 0:N.accentColor)||e.providerNetworkAccentColor;return{name:r,chatType:"Group chat",tenantName:M,tenantColor:K||W,tenantType:s?"client":"network"}}if($e(e))return{name:r,chatType:"Client team channel",tenantName:null,tenantColor:W,tenantType:"client"};if(e!=null&&e.patientId)return{name:r,chatType:"Patient",tenantName:((j=e.client)==null?void 0:j.name)||e.clientName,tenantColor:((E=e.client)==null?void 0:E.accentColor)||e.clientAccentColor||W,tenantType:"client"};const o=(k=Object.entries((e==null?void 0:e.participants)||{}).find(([M])=>M!==l))==null?void 0:k[1],m=(o==null?void 0:o.userType)||(o==null?void 0:o.role)||"Direct message";return e!=null&&e.clientId||e!=null&&e.clientName||(S=e==null?void 0:e.client)!=null&&S.name?{name:r,chatType:n?"Group chat":m,tenantName:((R=e.client)==null?void 0:R.name)||e.clientName,tenantColor:((D=e.client)==null?void 0:D.accentColor)||e.clientAccentColor||W,tenantType:"client"}:e!=null&&e.providerNetworkId||e!=null&&e.providerNetworkName||(L=e==null?void 0:e.providerNetwork)!=null&&L.name||(f=e==null?void 0:e.providerNetwork)!=null&&f.displayName?{name:r,chatType:n?"Group chat":m,tenantName:((C=e.providerNetwork)==null?void 0:C.displayName)||((v=e.providerNetwork)==null?void 0:v.name)||e.providerNetworkName,tenantColor:(($=e.providerNetwork)==null?void 0:$.accentColor)||e.providerNetworkAccentColor||W,tenantType:"network"}:{name:r,chatType:n?"Group chat":m,tenantName:null,tenantColor:"#2563eb"}}
2const sa=300,re=new Map;function Ee(e,l){var r;const i=`${((r=It.currentUser)==null?void 0:r.uid)||""}|${e}/${l}`;let s=re.get(i);if(!s)for(s=Lt(Ze(Xe,e,l)).catch(n=>{throw re.delete(i),n}),re.set(i,s);re.size>sa;)re.delete(re.keys().next().value);return s}function la(e,l){const[i,s]=d.useState({}),r=d.useMemo(()=>JSON.stringify([...new Set(e.filter(Boolean))].sort()),[e]);return d.useEffect(()=>{const n=JSON.parse(r);if(!l||n.length===0){s({});return}const o=new Set(n);s(u=>Object.fromEntries(Object.entries(u).filter(([x])=>o.has(x))));let m=!0;const b=n.map(u=>Rt(Ze(Xe,"Conversations",u),async x=>{if(!m)return;const h=x.exists()?{id:x.id,...x.data()}:null;if(!h){s(L=>({...L,[u]:null}));return}const[N,j,E]=await Promise.all([h.patientId?Ee("Users",h.patientId):null,h.clientId?Ee("Clients",h.clientId):null,h.providerNetworkId?Ee("ProviderNetworks",h.providerNetworkId):null]);if(!m)return;const k=N!=null&&N.exists()?{id:N.id,...N.data()}:null,S=j!=null&&j.exists()?j.data():null,R=E!=null&&E.exists()?E.data():null,D=k?he(k,null,[h.patientName]):null;s(L=>{var f,C,v,$,M;return{...L,[u]:{...h,...k?{patient:k,patientName:D,participants:{...h.participants||{},[h.patientId]:{...((f=h.participants)==null?void 0:f[h.patientId])||{},name:D||((v=(C=h.participants)==null?void 0:C[h.patientId])==null?void 0:v.name),profileImagePath:k.profileImagePath||null,profileImageUrl:k.profileImageUrl||null,avatarUrl:k.avatarUrl||null,photoURL:k.photoURL||null,photoUrl:k.photoUrl||null,imageUrl:k.imageUrl||null}}}:{},...S?{client:{...S,name:S.displayName||S.name,accentColor:(($=S.branding)==null?void 0:$.accentColor)||S.accentColor}}:{},...R?{providerNetwork:{...R,name:R.displayName||R.name,accentColor:((M=R.branding)==null?void 0:M.accentColor)||R.accentColor}}:{}}}})},()=>{s(x=>({...x,[u]:null}))}));return()=>{m=!1,b.forEach(u=>u())}},[r,l]),i}function nt({onMinimize:e,onClose:l}){return t.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[t.jsx(Me,{variant:"ghost",size:"icon",className:"h-8 w-7 rounded-lg px-1 text-content-tertiary transition-transform hover:text-slate-900 active:scale-[0.96] dark:hover:text-slate-100",onClick:e,"aria-label":"Minimize conversation","data-testid":"button-messaging-dock-minimize",children:t.jsx(Dt,{className:"size-4"})}),t.jsx(Me,{variant:"ghost",size:"icon",className:"h-8 w-7 rounded-lg px-1 text-content-tertiary transition-transform hover:text-slate-900 active:scale-[0.96] dark:hover:text-slate-100",onClick:l,"aria-label":"Close conversation","data-testid":"button-messaging-dock-close",children:t.jsx(Be,{className:"size-4"})})]})}function na({loading:e,onMinimize:l,onClose:i}){return t.jsxs("div",{className:"flex h-full flex-col overflow-hidden rounded-t-xl rounded-b-none border border-subtle bg-surface-raised shadow-xl",children:[t.jsxs("div",{className:"flex items-center justify-between border-b border-subtle px-3 py-2 max-lg:px-2.5 max-lg:py-1.5",children:[t.jsx("p",{className:"truncate text-sm font-semibold text-content-primary max-lg:text-xs",children:"Conversation"}),t.jsx(nt,{onMinimize:l,onClose:i})]}),t.jsx("div",{className:"flex flex-1 items-center justify-center px-6 text-center max-lg:px-3",children:t.jsx("p",{className:"text-sm text-content-tertiary max-lg:text-xs",children:e?"Loading conversation…":"This conversation is unavailable."})})]})}function ia({conversation:e,currentUserId:l,viewerUserType:i,unreadCount:s=0,onRestore:r,action:n="Open"}){var N;const o=ta(e,l,i),m=aa(e,l,i),b=Ue(),u=ae(i,[...Oe]),x=!!m.tenantName&&!(u&&m.tenantType==="client"),h=e!=null&&e.patientId&&(e.patient||((N=e.participants)==null?void 0:N[e.patientId]))||null;return t.jsxs(ge.div,{className:"group relative will-change-transform",layout:!b,initial:b?!1:{opacity:0,y:8,scale:.96},animate:{opacity:1,y:0,scale:1},exit:b?void 0:{opacity:0,y:8,scale:.96},whileHover:b?void 0:{y:-2},whileTap:b?void 0:{y:0},transition:b?{duration:0}:{type:"spring",stiffness:520,damping:36},children:[t.jsxs("div",{className:"pointer-events-none absolute right-[calc(100%+0.625rem)] top-1/2 z-raised hidden w-52 -translate-y-1/2 roun
2ded-xl border border-subtle bg-white/95 px-3 py-2 text-left shadow-lg shadow-slate-900/10 group-hover:block group-focus-within:block dark:bg-slate-900/95",children:[t.jsx("p",{className:"truncate text-sm font-semibold text-content-primary",children:m.name}),t.jsxs("div",{className:"mt-1 flex min-w-0 items-center justify-between gap-2",children:[t.jsx("span",{className:"shrink-0 text-xs text-content-tertiary",children:m.chatType}),x?m.tenantType==="network"?t.jsx(St,{primaryColor:m.tenantColor,className:"min-w-0 max-w-[8rem] truncate text-3xs",children:m.tenantName}):t.jsx(Mt,{accentColor:m.tenantColor,className:"min-w-0 max-w-[8rem] truncate text-3xs",children:m.tenantName}):null]})]}),t.jsxs(Me,{variant:"ghost",size:"icon",className:"relative size-12 shrink-0 rounded-full border-0 bg-surface-raised p-0 shadow-md shadow-slate-900/15 hover:bg-white focus-visible:ring-2 focus-visible:ring-offset-2 max-lg:size-10",onClick:r,"aria-label":`${n} conversation with ${o.label}`,title:o.label,"data-testid":"button-messaging-dock-launcher",children:[e!=null&&e.patientId&&!(e!=null&&e.networkScoped)?t.jsx(tt,{userId:e.patientId,patient:h,name:o.label,className:"h-full w-full",fallbackClassName:"text-xs",accentColor:o.color,loadDocumentFallbacks:!at(e)}):t.jsxs(Tt,{className:"h-full w-full",children:[o.imageUrl?t.jsx(Ut,{src:o.imageUrl,alt:""}):null,t.jsx(Pt,{className:"text-xs font-semibold",style:{backgroundColor:o.color,color:"#fff"},children:ra(o.label)})]}),s>0?t.jsx(ge.span,{className:"absolute -right-1.5 -top-1.5 flex h-5 min-w-5 items-center justify-center rounded-full border-2 border-white bg-red-500 px-1 text-3xs font-bold tabular-nums leading-none text-white shadow-sm shadow-red-500/30 dark:border-slate-900",initial:b?!1:{opacity:.75,scale:.72,y:2},animate:{opacity:1,scale:1,y:0},transition:b?{duration:0}:{type:"spring",stiffness:650,damping:28},"aria-label":`${s} unread ${s===1?"message":"messages"}`,children:s>99?"99+":s},Math.min(s,100)):null]})]})}function ra(e=""){return e.split(/\s+/).filter(Boolean).slice(0,2).map(l=>l[0]).join("").toUpperCase()||"?"}function We({windows:e,conversations:l,currentUserId:i,viewerUserType:s,unreadMarkersById:r,onRestore:n}){return e.length===0?null:t.jsx("div",{className:"pointer-events-none fixed bottom-[4.25rem] right-4 z-nav flex max-h-[calc(100dvh-6rem)] flex-col gap-2 overflow-visible max-lg:right-3 max-lg:gap-1.5","data-testid":"section-messaging-dock-minimized",children:t.jsx("div",{className:"pointer-events-auto flex flex-col gap-2 max-lg:gap-1.5",children:t.jsx(Le,{initial:!1,children:e.map(o=>{var m;return t.jsx(ia,{conversation:l[o.conversationId],currentUserId:i,viewerUserType:s,unreadCount:((m=r.get(o.conversationId))==null?void 0:m.unreadMessageCount)||0,onRestore:()=>
2n(o.conversationId),action:"Restore"},o.conversationId)})})})})}function Qe({conversationId:e,conversation:l,currentUserId:i,readOnly:s=!1,onMinimize:r,onClose:n,onPatientClick:o,onUserClick:m}){return l?t.jsx("div",{className:"h-full overflow-hidden rounded-t-xl rounded-b-none border border-subtle bg-surface-raised shadow-xl",children:t.jsx(d.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center text-sm text-content-tertiary max-lg:text-xs",role:"status",children:"Loading conversation…"}),children:t.jsx(Zt,{conversationId:e,conversation:l,currentUserId:i,viewerMode:"tenant",readOnly:s,embedded:!0,compactHeader:!0,showHeaderSearch:!1,showMessageActions:!0,onPatientClick:o,onUserClick:m,showHeaderCallButton:!0,headerActions:t.jsx(nt,{onMinimize:r,onClose:n})})})}):t.jsx(na,{loading:l===void 0,onMinimize:r,onClose:n})}function va(){const e=At(),l=Et(),{branding:i}=yt(),{userDoc:s}=Je(),{isMobileOrTablet:r,width:n}=jt(),o=kt(),m=Ue(),{enabled:b,currentUserId:u,windows:x,mobileActiveConversationId:h,openConversation:N,minimizeConversation:j,restoreConversation:E,closeConversation:k}=Ct(),[S,R]=d.useState(!1),[D,L]=d.useState(()=>new Set),f=d.useRef(new Set),C=d.useRef(new Map),v=x.map(c=>c.conversationId),{markers:$,unreadMessageCount:M}=vt({conversationIds:v,includeRecent:!0,includeSummary:!0,recentLimit:12}),K=d.useMemo(()=>[...$].sort((c,w)=>{var z,G,Q,F,q,pe,ee,le,te,je,H,ne;const g=((G=(z=c.lastMessageAt)==null?void 0:z.toMillis)==null?void 0:G.call(z))??((pe=(q=(F=(Q=c.lastMessageAt)==null?void 0:Q.toDate)==null?void 0:F.call(Q))==null?void 0:q.getTime)==null?void 0:pe.call(q))??new Date(c.lastMessageAt||0).getTime();return(((le=(ee=w.lastMessageAt)==null?void 0:ee.toMillis)==null?void 0:le.call(ee))??((ne=(H=(je=(te=w.lastMessageAt)==null?void 0:te.toDate)==null?void 0:je.call(te))==null?void 0:H.getTime)==null?void 0:ne.call(H))??new Date(w.lastMessageAt||0).getTime())-g}).slice(0,12),[$]),be=d.useMemo(()=>new Map($.map(c=>[c.conversationId,c])),[$]),T=l.pathname.replace(/\/$/,"")==="/messages"&&ae(s==null?void 0:s.userType,[..._e,...Oe]),Ne=d.useMemo(()=>Array.from(new Set([...v,...T?[]:K.map(({conversationId:c})=>c)])),[T,K,v]),oe=(i==null?void 0:i.accentColor)||W,we=(s==null?void 0:s.userType)==="Business Provider Delegate",V=d.useMemo(()=>x.filter(c=>!c.minimized),[x]),O=Math.min(3,Math.max(1,Math.floor((n-264)/344))),Z=d.useMemo(()=>V.slice(-O),[O,V]),se=d.useMemo(()=>[...x.filter(c=>c.minimized),...V.slice(0,-O)],[O,V,x]),de=d.useMemo(()=>se.filter(c=>!D.has(c.conversationId)),[D,se]),ce=d.useMemo(()=>{const c=new Set(x.map(({conversationId:g})=>g)),w=K.filter(({conversationId:g})=>!c.has(g)).map(({conversationId:g})=>({conversationId:g,minimized:!0,automatic:!0})).reverse();return[...de,...w]},[K,de,x]),B=h,U=la(Ne,b),Y=d.useMemo(()=>ce.filter(c=>{if(!c.automatic)return!0;const w=U[c.conversationId];return w!==null&&!at(w)}),[U,ce]);d.useEffect(()=>{const c=f.current,w=new Set(V.map(g=>g.conversationId));x.forEach(g=>{if(!g.minimized||!c.has(g.conversationId))return;L(z=>{if(z.has(g.conversationId))return z;const G=new Set(z);return G.add(g.conversationId),G}),window.clearTimeout(C.current.get(g.conversationId));const xe=window.setTimeout(()=>{L(z=>{if(!z.has(g.conversationId))return z;const G=new Set(z);return G.delete(g.conversationId),G}),C.current.delete(g.conversationId)},Ye);C.current.set(g.conversationId,xe)}),f.current=w},[V,x]),d.useEffect(()=>()=>{C.current.forEach(c=>window.clearTimeout(c)),C.current.clear()},[]);const P=d.useCallback(c=>{if(!c)return;const w=new URLSearchParams(l.search);w.set("patient",c),e({search:`?${w.toString()}`})},[l.search,e]),I=d.useCallback(c=>{if(!c)return;const w=new URLSearchParams(l.search);w.set("user",c),w.delete("user_tab"),e({search:`?${w.toString()}`})},[l.search,e]),_=d.useCallback(c=>{c&&r&&B&&j(B),R(c)},[B,r,j]),ye=d.useCallback(c=>{R(!1),N(c)},[N]),me=d.useCallback(c=>{x.some(w=>w.conversationId===c)?E(c):N(c)},[N,E,x]),ue={accentColor:oe,onOpenChange:_,onSelectConversation:ye,open:S,desktopWindowCount:Z.length,unreadCount:M};if(!b)return null;if(r){const c=B?U[B]:null;return t.jsxs(t.Fragment,{children:[o?null:t.jsxs(t.Fragment,{children:[t.jsx(We,{windows:T?[]:Y,conversations:U,currentUserId:u,viewerUserType:s==null?void 0:s.userType,unreadMarkersById:be,onRestore:me}),t.jsx("div",{hidden:T,className:"pointer-events-auto fixed bottom-4 right-4 z-nav","data-testid":"section-messaging-dock-compose",children:t.jsx(Ve,{...ue,isMobileOrTablet:!0})})]}),t.jsx(qe,{modal:!1,open:!!B,onOpenChange:w=>{!w&&B&&j(B)},children:t.jsx(He,{side:"bottom",accessibleTitle:"Conversation",accessibleDescription:"Secure messaging conversation",hideCloseButton:!0,disableContentMotion:!0,disableOverlayMotion:m,className:"z-40 h-[min(78dvh,42rem)] overflow-hidden rounded-t-xl border-subtle bg-surface-raised p-0",overlayClassName:"z-40","data-testid":"dialog-messaging-dock",children:t.jsx(Qe,{conversationId:B,conversation:c,currentUserId:u,readOnly:we,onMinimize:()=>j(B),onClose:()=>k(B),onPatientClick:P,onUserClick:I})})})]})}return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"pointer-events-none fixed bottom-0 right-20 z-sticky flex min-w-0 max-w-[calc(100vw-5rem)] items-end justify-end","data-testid":"section-messaging-dock-windows",children:t.jsx("div",{className:"pointer-events-none flex min-w-0 items-end gap-2",children:t.jsx(Le,{initial:!1,children:Z.map(c=>t.jsx(ge.div,{className:"pointer-events-auto h-[min(34rem,100dvh)] w-[22rem] shrink-0 will-change-transform",initial:m?!1:{opacity:0,y:"100%"}
2,animate:{opacity:1,y:0},exit:m?void 0:{opacity:0,y:"100%"},transition:m?{duration:0}:{duration:Ye/1e3,ease:[.22,1,.36,1]},role:"region","aria-label":`Messaging window for ${lt(U[c.conversationId],u,s==null?void 0:s.userType)}`,"data-testid":"section-messaging-dock-window",children:t.jsx(Qe,{conversationId:c.conversationId,conversation:U[c.conversationId],currentUserId:u,readOnly:we,onMinimize:()=>j(c.conversationId),onClose:()=>k(c.conversationId),onPatientClick:P,onUserClick:I})},c.conversationId))})})}),t.jsx(We,{windows:T?[]:Y,conversations:U,currentUserId:u,viewerUserType:s==null?void 0:s.userType,unreadMarkersById:be,onRestore:me}),t.jsx("div",{hidden:T,className:"pointer-events-auto fixed bottom-4 right-4 z-nav","data-testid":"section-messaging-dock-compose",children:t.jsx(Ve,{...ue,isMobileOrTablet:!1})})]})}export{va as MessagingDock};

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.