PageSourceSearch

https://consult.cybersight.org/assets/app.program-cases.view._caseId-g_AZB1oG.js

js cybersight.org collected 2026-10-02 14:34:30 UTC 32,819 bytes, 1 lines download raw bytes

1import{j as a}from"./index-lW7MqCyN.js";import{c as H,d as j,$ as A,S as L,m as Fe,e as xe,G as z,B as M,b as U,a2 as Ze,A as $,u as Oe}from"./theme-Ce8xCkb7.js";import{B as Te}from"./Badge-BXItphMH.js";import{fZ as et,v as tt,S as Ne,cU as st,d4 as Me,I as $e,d as qe,f_ as at,cf as it,dx as rt,q as nt,J as ot,ac as lt,f$ as ct,cM as mt,V as dt,g0 as ht,g1 as ut,g2 as pt,as as ft}from"./App-DQIwwYVa.js";import{D as be}from"./Divider-f5ukR8Ml.js";import{G as Be}from"./Grid-5Mv8biJU.js";import{S as gt}from"./SimpleGrid-BkK93pVX.js";import{T as De}from"./ThemeIcon-DE5CGRPC.js";import{h as _t,i as bt,R as xt,A as jt,L as yt,c as St,P as wt,d as vt,C as Ct,e as kt,U as Pt,f as At}from"./CaseContributorPanel-IK7t3Fjl.js";import{T as He}from"./Tooltip-CqmIZI5q.js";import{r as q}from"./index-Br3WYbhx.js";import{i as P}from"./index-DtckaTlL.js";import{i as It}from"./richText-Du2ZRjfT.js";import{a as zt}from"./RichTextEditor-Cw8oJ6Of.js";import{I as Et}from"./IconPaperclip-CduK4iHf.js";import{I as Tt}from"./IconSend-CuNL8SI_.js";import{M as Ee,P as Lt,C as Rt,A as Dt,a as Ft,R as Bt}from"./ClinicalAssessment-DxfTNAAg.js";import{u as Ut,C as Ot,a as Nt,M as Mt}from"./CaseParticipants-CoSX05mF.js";import{g as Ie,P as $t}from"./programReviewLabels-DeBmtQBi.js";import{I as Ue}from"./IconQuestionMark-FeIYPjtl.js";import{l as qt}from"./logger-BurX3xQf.js";import{t as ze}from"./utils-CPVUM2mr.js";import{I as Ht}from"./IconClock-UGt3nQvi.js";import{I as Yt}from"./IconRefresh-CHpBRbsg.js";import"./dayjs.min-BHSzQo0G.js";import{u as Gt}from"./useSingleAttachmentPreview-Tb2UPl9C.js";import{I as Wt}from"./IconFileTypePdf-D-OPLs-w.js";import{I as Qt}from"./IconEye-Cc0RWy1v.js";import{I as Vt}from"./IconHistory-BuF9uAjH.js";import"./sentry-C4BBnxBC.js";import"./get-base-value-D5RcUDt1.js";import"./Avatar-DQCCVSYC.js";import"./IconEdit-CRu-XwtX.js";import"./index-BsI9Gry6.js";import"./LoadingOverlay-CO3boA_Q.js";import"./use-disclosure-Bp1m-tGS.js";import"./SharedUploadingCard-DZ2qCEEh.js";import"./utils-DP4HxtZ2.js";import"./IconTextPlus-CaAYmbDN.js";import"./IconVideo-CKtnNZ8M.js";import"./IconPhoto-BsGL6sgA.js";import"./Image-D5GoyCPs.js";import"./IconTrash-C_0Klp_s.js";import"./IconUpload-WGSZtvYD.js";import"./caseStatusLabels-CLa-E6HT.js";import"./Textarea-C2QZaUeg.js";import"./case-reassignment-CEVfZ8Gd.js";import"./IconArchive-uC4_m4Qt.js";import"./IconMessages-CrlWnQyV.js";import"./IconClipboardCheck-Znsq_KE7.js";import"./IconMessageCircle-i1KGTcr9.js";import"./IconCircleX-DDGiFVAo.js";import"./IconListDetails-CQwhlu66.js";import"./IconUserCheck-CR4C55Kw.js";import"./IconUserPlus-ChHrhtki.js";import"./IconRobot-MFK623s5.js";import"./IconPencil-tCQLOFCo.js";import"./IconLanguage-DzSJvJH4.js";import"./Radio-C_zxw5mf.js";import"./InlineInput-D-tJmH-x.js";import"./RadioIcon-CAskpz1X.js";import"./IconLockOpen-CP96Eb1D.js";import"./IconMessageDots-D4EgpEAt.js";import"./clamp-DOn_7Ggn.js";import"./IconCircleCheck-7L6eKFKX.js";import"./IconStar-Cyjy3ZQg.js";import"./ColorPicker-Bst9jbZF.js";import"./Accordion-vOrCliLc.js";import"./get-safe-id-8kx1SmEa.js";import"./AccordionChevron-BnIOBqm0.js";import"./create-scoped-keydown-handler-CR2BWr_1.js";import"./Collapse-8q3oq3ql.js";import"./use-debounced-value-CdyiNp1Q.js";import"./IconDashboard-BKERs5KN.js";import"./IconArrowRight-DT9xiEPO.js";import"./IconUser-C4HIIYIx.js";import"./IconStethoscope-BUGJZz5l.js";import"./IconSparkles-x3fXIXeS.js";import"./IconDownload-CLlLE3Dq.js";import"./ConnectionStatusIndicator-DnJzrjNs.js";import"./IconCircleCheckFilled-CU2DHDZy.js";import"./Switch-CABL31o5.js";import"./PrismGazeGrid-1cxOkVEm.js";import"./useIsMobile-DuP2an6-.js";import"./AspectRatio-BhWqUR72.js";import"./utils-B2l81QMr.js";import"./countryUtils-BfcrcuYg.js";import"./relativeTime-DKkl_Ely.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"[email protected]"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="db40f7c5-3427-45d6-952b-e0afc8bc3fea",e._sentryDebugIdIdentifier="sentry-dbid-db40f7c5-3427-45d6-952b-e0afc8bc3fea")}catch{}})();function Jt(e){const t=H.c(30),{caseData:r,caseId:i,canPost:n}=e,l=r.post_op_update_status==="awaiting"||r.post_op_update_status==="provided",{data:h,isLoading:o,isError:c,isFetching:g,refetch:u}=et(i,l),f=tt().session?.user?.id??"";if(!l)return null;const d=!!r.is_user_mentee,_=!!r.post_op_update_is_open,p=d&&n&&_;let x;t[0]===Symbol.for("react.memo_cache_sentinel")?(x=a.jsx(xe,{order:4,children:a.jsx(A,{id:"yt/f9R"})}),t[0]=x):x=t[0];let m;t[1]!==p?(m=p&&a.jsx(j,{size:"sm",c:"dimmed",children:a.jsx(A,{id:"EBtG+7"})}),t[1]=p,t[2]=m):m=t[2];let w;t[3]!==c||t[4]!==g||t[5]!==u?(w=c&&a.jsxs(z,{gap:"sm",children:[a.jsx(j,{size:"sm",c:"red",children:a.jsx(A,{id:"qEdc3N"})}),a.jsx(M,{size:"xs",variant:"light",loading:g,onClick:()=>u(),children:a.jsx(A,{id:"KDw4GX"})})]}),t[3]=c,t[4]=g,t[5]=u,t[6]=w):w=t[6];let v;t[7]!==f||t[8]!==p||t[9]!==r.guest_mentors||t[10]!==r.mentee||t[11]!==r.mentor||t[12]!==i||t[13]!==c||t[14]!==o||t[15]!==h?(v=o?a.jsx(Ne,{height:60,radius:"sm"}):!h||h.length===0?!h||c||p?null:a.jsx(j,{size:"sm",c:"dimmed",children:a.jsx(A,{id:"FhsRwJ"})}):a.jsx(L,{gap:"md",children:h.map((S,E)=>a.jsxs(Fe,{children:[a.jsx(_t,{message:S.message,entry_creator:S.user??null,timestamp:S.created_at??"",mentor:r.mentor,mentee:r.mentee,activeUserId:f,attachments:S.attachments||[],communicationId:S.id,caseId:i,editedAt:S.edited_at,isEdited:S.is_edited,messageLanguage:S.message_language,viewerLanguage:S.viewer_language,canTranslate:S.can_translate,isUserMessage:S.user?.id===f,guestMentors:r.guest_mentors}),E<h.length-1&&a.jsx(be,{mt:"md"})]},S.id||E))}),t[7]=f,t[8]=p,t[9]=r.guest_mentors,t[10]=r.mentee,t[11]=r.mentor,t[12]=i,t[13]=c,t[14]=o,t[15]=h,t[16
1]=v):v=t[16];let b;t[17]!==r.status||t[18]!==_||t[19]!==d?(b=d&&_&&r.status==="closed"&&a.jsx(j,{size:"sm",c:"dimmed",children:a.jsx(A,{id:"YJhkat"})}),t[17]=r.status,t[18]=_,t[19]=d,t[20]=b):b=t[20];let y;t[21]!==p||t[22]!==i?(y=p&&a.jsx(Xt,{caseId:i},i),t[21]=p,t[22]=i,t[23]=y):y=t[23];let C;return t[24]!==m||t[25]!==w||t[26]!==v||t[27]!==b||t[28]!==y?(C=a.jsx(U,{shadow:"sm",padding:"md",radius:"md",withBorder:!0,children:a.jsxs(L,{gap:"md","data-testid":"post-op-update-section",children:[x,m,w,v,b,y]})}),t[24]=m,t[25]=w,t[26]=v,t[27]=b,t[28]=y,t[29]=C):C=t[29],C}function Xt(e){const t=H.c(48),{caseId:r}=e,[i,n]=q.useState("");let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=[],t[0]=l):l=t[0];const[h,o]=q.useState(l),[c,g]=q.useState(!1),[u,s]=q.useState(!1),{mutate:f,isPending:d}=st();let _;t[1]!==h||t[2]!==i?(_=It(i)&&h.length===0,t[1]=h,t[2]=i,t[3]=_):_=t[3];const p=_;let x;t[4]!==f||t[5]!==h||t[6]!==r||t[7]!==p||t[8]!==d||t[9]!==u||t[10]!==i?(x=()=>{p||d||u||f({id:r,message:i,attachmentIds:h.map(Zt),type:"program-case",communicationType:Me.POST_OP_UPDATE},{onSuccess:()=>{n(""),o([]),g(!1)}})},t[4]=f,t[5]=h,t[6]=r,t[7]=p,t[8]=d,t[9]=u,t[10]=i,t[11]=x):x=t[11];const m=x;let w,v;t[12]===Symbol.for("react.memo_cache_sentinel")?(w=P._({id:"yt/f9R"}),v=P._({id:"yt/f9R"}),t[12]=w,t[13]=v):(w=t[12],v=t[13]);let b;t[14]!==d||t[15]!==i?(b=a.jsx(zt,{value:i,onChange:n,placeholder:w,ariaLabel:v,variant:"compact",minHeight:100,disabled:d}),t[14]=d,t[15]=i,t[16]=b):b=t[16];let y;t[17]!==r||t[18]!==d||t[19]!==c?(y=c&&a.jsx(bt,{caseId:r,onAttachmentsChange:o,onUploadingChange:s,disabled:d}),t[17]=r,t[18]=d,t[19]=c,t[20]=y):y=t[20];let C;t[21]!==c?(C=c?a.jsx(A,{id:"TFmQbP"}):a.jsx(A,{id:"6ypvQp"}),t[21]=c,t[22]=C):C=t[22];let S;t[23]!==c?(S=c?P._({id:"TFmQbP"}):P._({id:"6ypvQp"}),t[23]=c,t[24]=S):S=t[24];let E;t[25]===Symbol.for("react.memo_cache_sentinel")?(E=()=>g(Kt),t[25]=E):E=t[25];let I;t[26]!==c?(I=c?a.jsx($e,{size:18}):a.jsx(Et,{size:18}),t[26]=c,t[27]=I):I=t[27];let k;t[28]!==d||t[29]!==I||t[30]!==S?(k=a.jsx(Ze,{size:"lg",variant:"outline","aria-label":S,onClick:E,disabled:d,children:I}),t[28]=d,t[29]=I,t[30]=S,t[31]=k):k=t[31];let T;t[32]!==k||t[33]!==C?(T=a.jsx(He,{label:C,withArrow:!0,children:k}),t[32]=k,t[33]=C,t[34]=T):T=t[34];let F;t[35]===Symbol.for("react.memo_cache_sentinel")?(F=a.jsx(Tt,{size:16}),t[35]=F):F=t[35];const O=p||d||u;let N;t[36]===Symbol.for("react.memo_cache_sentinel")?(N=a.jsx(A,{id:"hQRttt"}),t[36]=N):N=t[36];let R;t[37]!==m||t[38]!==d||t[39]!==O?(R=a.jsx(M,{leftSection:F,onClick:m,disabled:O,loading:d,children:N}),t[37]=m,t[38]=d,t[39]=O,t[40]=R):R=t[40];let B;t[41]!==T||t[42]!==R?(B=a.jsxs(z,{justify:"flex-end",gap:"xs",mt:"sm",children:[T,R]}),t[41]=T,t[42]=R,t[43]=B):B=t[43];let D;return t[44]!==B||t[45]!==b||t[46]!==y?(D=a.jsxs(Fe,{children:[b,y,B]}),t[44]=B,t[45]=b,t[46]=y,t[47]=D):D=t[47],D}function Kt(e){return!e}function Zt(e){return e.id}const es=e=>{switch(e){case Ee.GREEN:return{icon:qe,color:"#51cf66",bgColor:"#e6fcf5",label:Ie(P,e),description:P._(P._({id:"vrAdYD"}))};case Ee.YELLOW:return{icon:Ue,color:"#ffd43b",bgColor:"#fffbeb",label:Ie(P,e),description:P._({id:"/V/3xM"})};case Ee.RED:return{icon:$e,color:"#ff6b6b",bgColor:"#ffeaea",label:Ie(P,e),description:P._(P._({id:"jhucGq"}))};default:return{icon:Ue,color:"#adb5bd",bgColor:"#f8f9fa",label:Ie(P,e),description:P._({id:"w8gjSJ"})}}},ts=e=>{switch(e){case 1:return P._({id:"CB/NpV"});case 2:return P._({id:"W/Elkg"});case 3:return P._({id:"O9jVbx"});default:return P._({id:"tZJRb5"})}};function ss(e){const t=H.c(30),{mentorRatingColor:r,mentorPriorityRating:i}=e;let n;t[0]!==r?(n=es(r),t[0]=r,t[1]=n):n=t[1];const l=n;let h;t[2]!==l.bgColor?(h={backgroundColor:l.bgColor},t[2]=l.bgColor,t[3]=h):h=t[3];let o;t[4]===Symbol.for("react.memo_cache_sentinel")?(o={borderRadius:"50%",marginTop:"2px",flexShrink:0},t[4]=o):o=t[4];let c;t[5]!==l.color?(c=a.jsx(Fe,{w:16,h:16,bg:l.color,style:o}),t[5]=l.color,t[6]=c):c=t[6];let g;t[7]===Symbol.for("react.memo_cache_sentinel")?(g={flex:1},t[7]=g):g=t[7];let u;t[8]!==l.color?(u={color:l.color},t[8]=l.color,t[9]=u):u=t[9];let s;t[10]!==l.label||t[11]!==u?(s=a.jsx(j,{fw:600,size:"sm",style:u,children:l.label}),t[10]=l.label,t[11]=u,t[12]=s):s=t[12];let f;t[13]!==l.description?(f=a.jsx(j,{size:"sm",c:"dimmed",children:l.description}),t[13]=l.description,t[14]=f):f=t[14];let d;t[15]!==s||t[16]!==f?(d=a.jsxs("div",{children:[s,f]}),t[15]=s,t[16]=f,t[17]=d):d=t[17];let _;t[18]!==i||t[19]!==r?(_=i&&r!==Ee.RED&&a.jsx(Te,{variant:"outline",size:"sm",children:ts(i)}),t[18]=i,t[19]=r,t[20]=_):_=t[20];let p;t[21]!==_||t[22]!==d?(p=a.jsx("div",{style:g,children:a.jsxs(z,{justify:"space-between",align:"flex-start",children:[d,_]})}),t[21]=_,t[22]=d,t[23]=p):p=t[23];let x;t[24]!==p||t[25]!==c?(x=a.jsx(L,{gap:"sm",children:a.jsxs(z,{align:"flex-start",ga
1p:"md",children:[c,p]})}),t[24]=p,t[25]=c,t[26]=x):x=t[26];let m;return t[27]!==x||t[28]!==h?(m=a.jsx(U,{withBorder:!0,padding:"md",radius:"md",style:h,children:x}),t[27]=x,t[28]=h,t[29]=m):m=t[29],m}function as(e){switch(e.sync_status){case"not_applicable":return{color:"gray",label:"Shareable does not apply to this case",icon:"clock"};case"not_exported":return{color:"yellow",label:"Case not found in Shareable",icon:"warning"};case"exported_unverified":return{color:"blue",label:"Case found in Shareable",icon:"check"};case"in_sync":return{color:"green",label:"Case found in the expected Shareable week",icon:"check"};case"different":return{color:"orange",label:"Shareable case needs attention",icon:"warning"};case"unavailable":return{color:"red",label:"Could not check Shareable",icon:"warning"}}}function is(e){const t=H.c(3),{icon:r}=e;if(r==="check"){let n;return t[0]===Symbol.for("react.memo_cache_sentinel")?(n=a.jsx(qe,{size:"1rem"}),t[0]=n):n=t[0],n}if(r==="warning"){let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=a.jsx(it,{size:"1rem"}),t[1]=n):n=t[1],n}let i;return t[2]===Symbol.for("react.memo_cache_sentinel")?(i=a.jsx(Ht,{size:"1rem"}),t[2]=i):i=t[2],i}function rs(e){const t=e.toLowerCase();return["complete","completed","closed"].includes(t)?"green":["failed","error"].includes(t)?"red":["registered","pending","open"].includes(t)?"yellow":"blue"}function ns(e){return{case_has_no_program:"The case is not assigned to a program.",program_type_not_mapped:"The program type is not configured for Shareable.",vendor_lookup_failed:null,mrn_not_found_after_successful_lookup:null,program_week_differs:null,registered_without_shareable_case_id:"The case is registered but has no completed Shareable case ID.",shareable_case_not_completed:"Shareable has not marked this case completed yet.",completed_case_details_unavailable:"The case was found, but the completed report could not be checked.",completed_shareable_case_missing_case_id:"Shareable marks this case complete but did not return the case ID needed to fetch its report.",completed_report_available_content_not_comparable:"A completed Shareable report is available to fetch."}[e]??null}function os(e){return e==="program_week"?"Program week":"Other Shareable detail"}function ls(e){const t=new Set(e.map(r=>r==="program_week"?"program_week":"other"));return Array.from(t,os)}function cs(e,t){const r=e.sync_diff?.[t];if(!r||typeof r!="object")return null;const i="local"in r?r.local:void 0,n="shareable"in r?r.shareable:void 0,l=h=>h==null||typeof h=="string"||typeof h=="number";return!l(i)||!l(n)?null:t==="program_week"?`Program week: Consult ${String(i??"not set")}; Shareable ${String(n??"not set")}.`:null}function ms(e){const t=H.c(31),{caseId:r,onOpenProgramWorkflow:i}=e,[n,l]=q.useState(!1);let h;t[0]!==n?(h={enabled:n},t[0]=n,t[1]=h):h=t[1];const{data:o,isLoading:c,isFetching:g,error:u,refetch:s}=at(r,h);let f,d;t[2]!==r||t[3]!==u||t[4]!==n?(f=()=>{!n||!u||qt.error("Failed to check Shareable case status",u,{caseId:r})},d=[r,u,n],t[2]=r,t[3]=u,t[4]=n,t[5]=f,t[6]=d):(f=t[5],d=t[6]),q.useEffect(f,d);let _;t[7]!==n||t[8]!==s?(_=()=>{if(!n){l(!0);return}s()},t[7]=n,t[8]=s,t[9]=_):_=t[9];const p=_;let x;t[10]!==o?(x=o?as(o):null,t[10]=o,t[11]=x):x=t[11];const m=x;let w;if(t[12]!==o||t[13]!==u||t[14]!==p||t[15]!==n||t[16]!==g||t[17]!==c||t[18]!==i||t[19]!==m){const v=o?ls(o.differing_fields):[];let b;t[21]!==o?(b=o?.status_reason?ns(o.status_reason):null,t[21]=o,t[22]=b):b=t[22];const y=b;let C;t[23]===Symbol.for("react.memo_cache_sentinel")?(C=a.jsx(Yt,{size:16}),t[23]=C):C=t[23];const S=c||g,E=n?"Check this case again":"Check this case in Shareable";let I;t[24]!==p||t[25]!==E||t[26]!==S?(I=a.jsx(He,{label:"Performs a live read-only lookup. It does not send this case or fetch a report.",children:a.jsx(M,{leftSection:C,onClick:p,loading:S,variant:"default",size:"sm",children:E})}),t[24]=p,t[25]=E,t[26]=S,t[27]=I):I=t[27];let k;t[28]!==u||t[29]!==n?(k=n&&u&&a.jsx($,{color:"red",title:"Could not check Shareable",mt:"md",style:{width:"100%"},children:"No conclusion was drawn because the live Shareable lookup failed. Try again."}),t[28]=u,t[29]=n,t[30]=k):k=t[30],w=a.jsxs(a.Fragment,{children:[I,k,n&&!u&&o&&m&&a.jsxs(L,{gap:"xs",mt:"md",style:{width:"100%"},children:[a.jsxs(z,{justify:"space-between",children:[a.jsx(j,{size:"sm",fw:500,children:"Consult case status:"}),a.jsx(Te,{color:"blue",children:o.local_status})]}),a.jsxs(z,{justify:"space-between",children:[a.jsx(j,{size:"sm",fw:500,children:"Last changed in Consult:"}),a.jsx(j,{size:"xs",c:"dimmed",children:ze(o.local_last_modified)})]}),o.last_export&&a.jsxs(z,{justify:"space-between",children:[a.jsx(j,{size:"sm",fw:500,children:"Last sent to Shareable:"}),a.jsx(j,{size:"xs",c:"dimmed",children:ze(o.last_export)})]}),o.last_import&&a.jsxs(z,{justify:"space-between",children:[a.jsx(j,{size:"sm",fw:500,children:"Last report fetched from Shareable:"}),a.jsx(j,{size:"xs",c:"dimmed",children:ze(o.last_import)})]}
1),a.jsx($,{color:m.color,icon:a.jsx(is,{icon:m.icon}),title:"Live Shareable check",children:a.jsxs(L,{gap:"xs",children:[a.jsxs(z,{justify:"space-between",children:[a.jsx(j,{size:"sm",children:m.label}),o.shareable_status&&a.jsxs(Te,{color:rs(o.shareable_status),children:["Shareable case: ",o.shareable_status]})]}),y&&a.jsx(j,{size:"xs",c:"dimmed",children:y}),o.shareable_last_updated&&a.jsxs(j,{size:"xs",c:"dimmed",children:["Last updated on Shareable: ",ze(o.shareable_last_updated)]}),v.length>0&&a.jsxs($,{color:"yellow",mt:"xs",children:[a.jsx(j,{size:"sm",fw:500,mb:"xs",children:"Fields needing attention:"}),a.jsx(j,{size:"xs",c:"dimmed",children:o.differing_fields.map(T=>cs(o,T)).filter(ds).join(" ")||v.join(", ")})]}),o.sync_status==="not_exported"&&i&&a.jsxs(L,{gap:4,children:[a.jsx(j,{size:"xs",children:"Send the case from the program Shareable workflow, then check again."}),a.jsx(M,{size:"xs",variant:"light",onClick:i,children:"Open program Shareable workflow"})]})]})})]})]}),t[12]=o,t[13]=u,t[14]=p,t[15]=n,t[16]=g,t[17]=c,t[18]=i,t[19]=m,t[20]=w}else w=t[20];return w}function ds(e){return!!e}function hs(e){return e?.trim()||"Years"}function us({age:e,ageUnit:t,patientBirthYear:r,patientBirthMonth:i,patientBirthDay:n,patientMonthsOld:l,createdAt:h}){if(typeof e=="number"&&Number.isFinite(e)&&e>0)return{value:e,unit:hs(t)};if(typeof l=="number"&&Number.isFinite(l)&&l>=0)return{value:l,unit:"Months"};if(!r||!h)return null;const o=new Date(h);if(Number.isNaN(o.getTime()))return null;const c=o.getUTCFullYear(),g=o.getUTCMonth()+1,u=o.getUTCDate(),s=c-r;if(s<0)return null;if(i&&i>=1&&i<=12){let f=s*12+(g-i);return n&&n>=1&&u<n&&(f-=1),f<0?null:f<24?{value:f,unit:"Months"}:{value:Math.floor(f/12),unit:"Years"}}return{value:s,unit:"Years"}}function ps(e){const t=H.c(28),{attachment:r}=e,{i18n:i}=Oe(),n=q.useId();let l;t[0]!==r.created_at||t[1]!==i?(l=i.date(new Date(r.created_at),{dateStyle:"medium"}),t[0]=r.created_at,t[1]=i,t[2]=l):l=t[2];const h=l,{openAttachmentPreview:o,attachmentPreviewModal:c}=Gt(r);let g;t[3]===Symbol.for("react.memo_cache_sentinel")?(g=a.jsx(De,{variant:"light",color:"blue",size:"lg",radius:"xl",children:a.jsx(Wt,{size:"1.25rem","aria-hidden":!0})}),t[3]=g):g=t[3];let u;t[4]===Symbol.for("react.memo_cache_sentinel")?(u={minWidth:0},t[4]=u):u=t[4];let s;t[5]===Symbol.for("react.memo_cache_sentinel")?(s=a.jsx(A,{id:"XrLmKg"}),t[5]=s):s=t[5];let f;t[6]!==n?(f=a.jsx(xe,{id:n,order:5,size:"sm",children:s}),t[6]=n,t[7]=f):f=t[7];let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=a.jsx(j,{size:"sm",c:"dimmed",children:a.jsx(A,{id:"2vN2gr"})}),t[8]=d):d=t[8];let _;t[9]!==r.created_at||t[10]!==h?(_=a.jsx(j,{component:"time",dateTime:r.created_at,size:"xs",c:"dimmed",fw:500,children:h}),t[9]=r.created_at,t[10]=h,t[11]=_):_=t[11];let p;t[12]!==f||t[13]!==_?(p=a.jsxs(z,{align:"flex-start",wrap:"nowrap",children:[g,a.jsxs(L,{gap:2,style:u,children:[f,d,_]})]}),t[12]=f,t[13]=_,t[14]=p):p=t[14];let x;t[15]===Symbol.for("react.memo_cache_sentinel")?(x=a.jsx(Qt,{size:16,"aria-hidden":!0}),t[15]=x):x=t[15];let m;t[16]===Symbol.for("react.memo_cache_sentinel")?(m=a.jsx(A,{id:"rdUucN"}),t[16]=m):m=t[16];let w;t[17]!==o?(w=a.jsx(M,{variant:"light",color:"blue",fullWidth:!0,leftSection:x,onClick:o,children:m}),t[17]=o,t[18]=w):w=t[18];let v;t[19]!==w||t[20]!==p?(v=a.jsxs(L,{h:"100%",justify:"space-between",gap:"md",children:[p,w]}),t[19]=w,t[20]=p,t[21]=v):v=t[21];let b;t[22]!==n||t[23]!==v?(b=a.jsx(U,{component:"section","aria-labelledby":n,withBorder:!0,padding:"md",radius:"md",h:"100%",bg:"blue.0",children:v}),t[22]=n,t[23]=v,t[24]=b):b=t[24];let y;return t[25]!==c||t[26]!==b?(y=a.jsxs(a.Fragment,{children:[b,c]}),t[25]=c,t[26]=b,t[27]=y):y=t[27],y}function fs(){const e=H.c(166),{i18n:t}=Oe();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={from:"/app/program-cases/view/$caseId"},e[0]=r):r=e[0];const{caseId:i}=rt(r);Ut(i);const n=nt(),{data:l,isLoading:h}=ot(),{isFeatureEnabled:o,isLoading:c,isError:g,refetch:u}=lt();if(!i)throw new Error("Case ID is required");const{data:s,isLoading:f}=ct(i),d=f,_=!h&&!d&&!!s&&l?.id===s.mentor?.id,p=!d&&!!s&&s.status!=="closed";let x;e[1]!==l?.permissions?(x=l?.permissions?.includes("admin")??!1,e[1]=l?.permissions,e[2]=x):x=e[2];const m=x,w=!h&&m&&!!i;let v;e[3]!==w?(v={enabled:w},e[3]=w,e[4]=v):v=e[4];const b=mt(i,v);if(d||h||!s){let Ae;return e[5]===Symbol.for("react.memo_cache_sentinel")?(Ae=a.jsx(Nt,{}),e[5]=Ae):Ae=e[5],Ae}const y=s.program_id??s.program?.id;let C;e[6]!==c||e[7]!==g||e[8]!==o?(C=!c&&!g&&o("SHAREABLE_ENABLED"),e[6]=c,e[7]=g,e[8]=o,e[9]=C):C=e[9];const S=C,E=!!(s.has_shareable_pdf||s.program?.shareable_synced_revision!=null||s.program?.shareable_synced_active!=null||s.program?.shareable_sync_pending);let I;e[10]!==s.attachments?(I=s.attachments?.find(bs),e[10]=s.attachments,e[11]=I):I=e[11];const k=I;let T;e[12]!==s.mentor_rating_color||e[13]!==s.status?(T=$t.has(s.status)&&!!s.mentor_rating_color,e[12]=s.mentor_rating_color,e[13]=s.status,e[14]=T):T=e[14];const F=T;let O;e[15]===Symbol.for("react.memo_cache_sentinel")?(O=["pending","open","closed","void"],e[15]=O):O=e[15];const N=O.includes(s.status);let R;e[16]!==l?.permissions||e[17]!==s.is_user_guest_mentor||e[18]!==s.is_user_mentee||e[19]!==s.is_user_mentor||e[20]!==s.status||e[21]!==m?(R=["open","pending"].includes(s.status)&&(l?.permissions?.includes("consult")??!1)&&!!(m||s.is_user_mentor||s.is_user_mentee||s.is_user_guest_mentor),e[16]=l?.permissions,e[17]=s.is_user_guest_mentor,e[18]=s.is_user_mentee,e[19]=s.is_user_mentor,e[20]=s.status,e[21]=m,e[22]=R):R=e[22];const B=R;let D;e[23]!==s.communications?(D=s.communications||[],e[23]=s.communications,e[24]=D):D=e[24];let je;
1e[25]!==D?(je=D.filter(_s),e[25]=D,e[26]=je):je=e[26];const Y=je;let ye;e[27]!==l?.permissions||e[28]!==s.is_user_mentee||e[29]!==s.status?(ye=s.status==="open"&&(l?.permissions?.includes("consult")??!1)&&!!s.is_user_mentee,e[27]=l?.permissions,e[28]=s.is_user_mentee,e[29]=s.status,e[30]=ye):ye=e[30];const Le=ye;let Se;e[31]!==s.age||e[32]!==s.age_unit||e[33]!==s.created_at||e[34]!==s.patient_birth_day||e[35]!==s.patient_birth_month||e[36]!==s.patient_birth_year||e[37]!==s.patient_months_old?(Se=us({age:s.age,ageUnit:s.age_unit,patientBirthYear:s.patient_birth_year,patientBirthMonth:s.patient_birth_month,patientBirthDay:s.patient_birth_day,patientMonthsOld:s.patient_months_old,createdAt:s.created_at}),e[31]=s.age,e[32]=s.age_unit,e[33]=s.created_at,e[34]=s.patient_birth_day,e[35]=s.patient_birth_month,e[36]=s.patient_birth_year,e[37]=s.patient_months_old,e[38]=Se):Se=e[38];const Re=Se;let we;e[39]===Symbol.for("react.memo_cache_sentinel")?(we={base:"md",sm:"xl"},e[39]=we):we=e[39];let ve;e[40]===Symbol.for("react.memo_cache_sentinel")?(ve=a.jsx(xe,{order:2,mb:"lg",children:a.jsx(A,{id:"laQvrw"})}),e[40]=ve):ve=e[40];const Ye=Y.length;let G;e[41]!==B||e[42]!==i||e[43]!==s||e[44]!==Y||e[45]!==N?(G=N?a.jsx(Ct,{caseData:s,communications:Y,caseId:i,isLoading:!1,isCaseOpen:B,communicationType:"program-case"}):void 0,e[41]=B,e[42]=i,e[43]=s,e[44]=Y,e[45]=N,e[46]=G):G=e[46];let W,Q;e[47]!==s?(W=a.jsx(kt,{caseData:s}),Q=a.jsx(Pt,{caseData:s}),e[47]=s,e[48]=W,e[49]=Q):(W=e[48],Q=e[49]);let V;e[50]!==s||e[51]!==m?(V=s.status==="closed"&&!m&&(s.is_user_mentor||s.is_user_mentee)&&a.jsx(z,{mt:"md",children:a.jsx(xt,{caseData:s})}),e[50]=s,e[51]=m,e[52]=V):V=e[52];let J;e[53]!==c||e[54]!==i||e[55]!==s||e[56]!==g||e[57]!==m||e[58]!==o||e[59]!==n||e[60]!==E||e[61]!==u||e[62]!==S||e[63]!==y?(J=m&&a.jsxs(a.Fragment,{children:[a.jsx(be,{my:"md"}),a.jsxs(jt,{caseData:s,children:[!c&&!g&&o("SHAREABLE_ENABLED")&&s.program?.shareable_required===!0&&a.jsx(ms,{caseId:i,onOpenProgramWorkflow:y?()=>n({to:"/app/admin/programs/$programId",params:{programId:y}}):void 0}),c&&s.program?.shareable_required===!0&&a.jsx($,{color:"blue",title:"Checking Shareable availability",children:"Consult is checking whether a live Shareable case lookup is available on this server."}),!c&&!g&&!o("SHAREABLE_ENABLED")&&s.program?.shareable_required===!0&&a.jsx($,{color:"gray",title:"Shareable is disabled on this server",children:"This case belongs to a Shareable program, but this server cannot perform a live check, send cases, or fetch completed reports. Contact an administrator."}),g&&s.program?.shareable_required===!0&&a.jsx($,{color:"red",title:"Could not load Shareable availability",children:a.jsxs(L,{gap:"xs",children:[a.jsx(j,{size:"sm",children:"No Shareable check is available until Consult can verify the server configuration."}),a.jsx(M,{size:"xs",variant:"light",color:"red",onClick:()=>u(),children:"Check server configuration again"})]})}),s.program?.shareable_required===!1&&E&&a.jsx($,{color:"gray",title:"Shareable is off for new activity",children:a.jsxs(L,{gap:"xs",children:[a.jsx(j,{size:"sm",children:s.has_shareable_pdf?a.jsx(a.Fragment,{children:"This case already has a completed Shareable PDF. New manual sends and live case checks are off for this program."}):a.jsx(a.Fragment,{children:"This program has prior Shareable activity, so this case may still be waiting for a completed PDF. New manual sends and live case checks are off."})}),S?a.jsx(j,{size:"sm",children:"Open the program workflow to see whether manual or background report recovery is available on this server."}):a.jsxs(a.Fragment,{children:[a.jsx(j,{size:"sm",children:"Prior Shareable history and any stored PDF remain preserved. Manual report recovery is unavailable until Shareable is enabled and its availability can be verified on this server."}),g&&a.jsx(M,{size:"xs",variant:"light",color:"red",onClick:()=>u(),children:"Check server configuration again"})]}),S&&y&&a.jsx(M,{size:"xs",variant:"light",onClick:()=>n({to:"/app/admin/programs/$programId",params:{programId:y}}),children:"Open program report recovery"})]})})]})]}),e[53]=c,e[54]=i,e[55]=s,e[56]=g,e[57]=m,e[58]=o,e[59]=n,e[60]=E,e[61]=u,e[62]=S,e[63]=y,e[64]=J):J=e[64];let Ce;e[65]===Symbol.for("react.memo_cache_sentinel")?(Ce=a.jsx(be,{my:"md"}),e[65]=Ce):Ce=e[65];let X;e[66]!==s.guest_mentors||e[67]!==s.mentee||e[68]!==s.mentee_organization||e[69]!==s.mentor?(X=a.jsx(Ot,{mentee:s.mentee,menteeOrganization:s.mentee_organization,mentor:s.mentor,guestMentors:s.guest_mentors}),e[66]=s.guest_mentors,e[67]=s.mentee,e[68]=s.mentee_organization,e[69]=s.mentor,e[70]=X):X=e[70];let K;e[71]!==s.id_legacy||e[72]!==m?(K=a.jsx(yt,{legacyId:s.id_legacy,isAdmin:m}),e[71]=s.id_legacy,e[72]=m,e[73]=K):K=e[73];let Z;e[74]!==s.mentor_priority_rating||e[75]!==s.mentor_rating_color||e[76]!==s.program||e[77]!==s.program_week||e[78]!==k||e[79]!==F?(Z=s.program&&a.jsxs(a.Fragment,{children:[a.jsx(be,{my:"md"}),a.jsxs(z,{mb:"sm",children:[a.jsx(De,{variant:"light",size:"lg",color:"grape",children:a.jsx(dt,{size:"1.4rem"})}),a.jsx(xe,{order:4,children:a.jsx(A,{id:"l79DF/"})})]}),a.jsxs(L,{gap:"xs",children:[a.jsxs(z,{children:[a.jsx(j,{fw:500,children:a.jsx(A,{id:"1CPdIg"})}),a.jsx(j,{children:s.program.name})]}),s.program_week&&a.jsxs(z,{children:[a.jsx(j,{fw:500,children:a.jsx(A,{id:"qLBZ1c"})}),a.jsx(Te,{variant:"filled",children:s.program_week})]}),s.program.location&&a.jsxs(z,{children:[a.jsx(j,{fw:500,children:a.jsx(A,{id:"P2tpOX"})}),a.jsxs(j,{children:[s.program.location,", ",s.program.city]})]}),(F||k)&&a.jsxs(a.Fragment,{children:[a.jsx(be,{my:"sm"}),a.jsxs(gt,{cols:{base:1,md:F&&k?2:1},spacing:"md",children:[F&&s.mentor_rating_color&&a.jsx(ss,{mentorRatingColor:s.mentor_rating_color,mentorPriorityRating:s.mentor_priority_rating}),k&&a.jsx(ps,{attachment:k})]})]})]})]}),e[74]=s.mentor_priority_rating,e[75]=s.mentor_rating_color,e[76]=s.program,e[77]=s.program_week,e[78]=k,e[79]=F,e[80]=Z):Z=e[80];let ke;e[81]===Symbol.for("react.memo_cache_sentinel")?(ke=a.jsx(be,{my:"md"}),e[81]=ke):ke=e[81];const Ge=s.history,We=s.age,Qe=s.age_unit,Ve=s.patient_first_name,Je=s.patient_last_name,Xe=s.patient_city,Ke=s.patient_birth_year;let ee;e[82]!==t?(ee=t._({id:"Fpaow5"}),e[82]=t,e[83]=ee):ee=e[83];let te;e[84]!==t?(te=t._({id:"M8er/5"}),e[84]=t,e[85]=te):te=e[85];let se;e[86]!==t?(se=t._({id:"WiHo0m"}),e[86]=t,e[87]=se):se=e[87];let ae;e[88]!==t?(ae=t._({id:"+v9QK4"}),e[88]=t,e[89]=ae):ae=e[89];let ie;e[90]!==ee||e[91]!==te||e[92]!==se||e[93]!==ae?(ie={group:ee,name:te,city:se,birthYear:ae},e[90]=ee,e[91]=te,e[92]=se,e[93]=ae,e[94]=ie):ie=e[94];let re;e[95]!==s.age||e[96]!==s.age_unit||e[97]!==s.gender||e[98]!==s.history||e[99]!==s.id||e[100]!==s.is_user_mentee||e[101]!==s.mentee_content_can_translate||e[102]!==s.mentee_content_language||e[103]!==s.patient_birth_year||e[104]!==s.patient_city||e[105]!==s.patient_first_name||e[106]!==s.patient_last_name||e[107]!==s.viewer_language||e[108]!==Re||e[109]!==ie?(re=a.jsx(Lt,{history:Ge,age:We,ageUnit:Qe,programAge:Re,patientFirstName:Ve,patientLastName:Je,patientCity:Xe,patientBirthYear:Ke,patientDemographicsLabels:ie,gender:s.gender,caseId:s.id,isUserMentee:s.is_user_mentee,menteeContentLanguage:s.mentee_content_language,viewerLanguage:s.viewer_language,menteeContentCanTranslate:s.mentee_content_can_translate}),e[95]=s.age,e[96]=s.age_unit,e[97]=s.gender,e[98]=s.history,e[99]=s.id,e[100]=s.is_user_mentee,e[101]=s.mentee_content_can_translate,e[102]=s.mentee_content_language,e[103]=s.patient_birth_year,e[104]=s.patient_city,e[105]=s.patient_first_name,e[106]=s.patient_last_name,e[107]=s.viewer_language,e[108]=Re,e[109]=ie,e[110]=re):re=e[110];let ne;e[111]!==W||e[112]!==Q||e[113]!==V||e[114]!==J||e[115]!==X||e[116]!==K||e[117]!==Z||e[118]!==re?(ne=a.jsxs(U,{shadow:"sm",padding:"md",radius:"md",withBorder:!0,children:[W,Q,V,J,Ce,X,K,Z,ke,re]}),e[111]=W,e[112]=Q,e[113]=V,e[114]=J,e[115]=X,e[116]=K,e[117]=Z,e[118]=re,e[119]=ne):ne=e[119];let oe;e[120]!==s.clinical_details?(oe=a.jsx(U,{shadow:"sm",padding:"md",radius:"md",withBorder:!0,children:a.jsx(Rt,{clinicalDetails:s.
1clinical_details})}),e[120]=s.clinical_details,e[121]=oe):oe=e[121];let le;e[122]!==s.attachments?(le=s.attachments||[],e[122]=s.attachments,e[123]=le):le=e[123];let ce;e[124]!==le?(ce=a.jsx(U,{shadow:"sm",padding:"md",radius:"md",withBorder:!0,children:a.jsx(Mt,{attachments:le,isLoading:!1})}),e[124]=le,e[125]=ce):ce=e[125];let me;e[126]!==s?(me=a.jsx(U,{shadow:"sm",padding:"md",radius:"md",withBorder:!0,children:a.jsx(Bt,{caseData:s,isLoading:!1,caseType:"program"})}),e[126]=s,e[127]=me):me=e[127];let de;e[128]!==Le||e[129]!==i||e[130]!==s?(de=a.jsx(Jt,{caseData:s,caseId:i,canPost:Le}),e[128]=Le,e[129]=i,e[130]=s,e[131]=de):de=e[131];let he;e[132]!==Y.length||e[133]!==G||e[134]!==ne||e[135]!==oe||e[136]!==ce||e[137]!==me||e[138]!==de?(he=a.jsxs(At,{communicationsCount:Ye,communications:G,children:[ne,oe,ce,me,de]}),e[132]=Y.length,e[133]=G,e[134]=ne,e[135]=oe,e[136]=ce,e[137]=me,e[138]=de,e[139]=he):he=e[139];let ue;e[140]!==i||e[141]!==s.ai_status||e[142]!==s.attachments||e[143]!==s.id_legacy?(ue=!s.id_legacy&&a.jsx(Dt,{caseId:i,hasAiAttachments:(s.attachments||[]).some(gs),aiStatus:s.ai_status,queryNamespace:"program-case",attachments:s.attachments||[],getAiStatusFn:pt,getAiReportFn:ut,getAiOutcomesFn:ht}),e[140]=i,e[141]=s.ai_status,e[142]=s.attachments,e[143]=s.id_legacy,e[144]=ue):ue=e[144];let pe;e[145]!==s?(pe=(s.id_legacy||s.legacy_ai_report||(s.ai_status??"").startsWith("failed")&&s.ai_status!=="failed_report")&&a.jsx(Ft,{caseData:s,attachments:s.attachments||[]}),e[145]=s,e[146]=pe):pe=e[146];let fe;e[147]!==s||e[148]!==p||e[149]!==_?(fe=s.status==="closed"&&a.jsx(Be,{mt:"lg",align:"flex-start",children:a.jsx(Be.Col,{span:{base:12,md:6},children:a.jsx(U,{shadow:"sm",padding:"md",radius:"md",withBorder:!0,children:a.jsx(St,{caseData:s,isMentor:_,isCaseOpen:p,caseType:"program"})})})}),e[147]=s,e[148]=p,e[149]=_,e[150]=fe):fe=e[150];let ge;e[151]!==i||e[152]!==s.communications||e[153]!==s.is_private||e[154]!==s.status?(ge=s.status==="closed"&&!s.is_private&&a.jsx(U,{shadow:"sm",padding:"md",radius:"md",withBorder:!0,mt:"lg",children:a.jsx(wt,{caseId:i,caseType:"program-case",communications:s.communications||[],isClosed:s.status==="closed",isPublic:!s.is_private,isLoading:!1})}),e[151]=i,e[152]=s.communications,e[153]=s.is_private,e[154]=s.status,e[155]=ge):ge=e[155];let _e;e[156]!==b||e[157]!==m?(_e=m&&a.jsx(U,{shadow:"sm",padding:"md",radius:"md",withBorder:!0,mt:"lg",mb:"lg",children:a.jsxs(L,{children:[a.jsxs(z,{children:[a.jsx(De,{variant:"light",size:"lg",children:a.jsx(Vt,{size:"1.4rem"})}),a.jsx(xe,{order:4,children:"Case History (Admin View)"})]}),b.isLoading&&a.jsx(Ne,{height:100}),b.isError&&a.jsx(j,{c:"red",children:"Error loading case history."}),b.isSuccess&&a.jsx(vt,{updates:b.data||[]})]})}),e[156]=b,e[157]=m,e[158]=_e):_e=e[158];let Pe;return e[159]!==he||e[160]!==ue||e[161]!==pe||e[162]!==fe||e[163]!==ge||e[164]!==_e?(Pe=a.jsxs(ft,{fluid:!0,px:we,children:[ve,he,ue,pe,fe,ge,_e]}),e[159]=he,e[160]=ue,e[161]=pe,e[162]=fe,e[163]=ge,e[164]=_e,e[165]=Pe):Pe=e[165],Pe}function gs(e){return e.attachment_purpose==="ai"}function _s(e){return e.communication_type!==Me.POST_OP_UPDATE}function bs(e){return e.attachment_purpose==="shareable_report"}const Za=fs;export{Za as component};

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.