@remit/web-client-dist 0.0.425 → 0.0.427

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.
Files changed (109) hide show
  1. package/assets/{BriefPane-Bb3FW4sA.js → BriefPane-ChEbSMGP.js} +1 -1
  2. package/assets/{ErrorState-CVMn7G7v.js → ErrorState-Ws9Z0fI_.js} +1 -1
  3. package/assets/{FlaggedPane-D3Cn-ODh.js → FlaggedPane-DZ9jLP-d.js} +1 -1
  4. package/assets/{FullCompose-nRLhoppF.js → FullCompose-Dc4-If6R.js} +1 -1
  5. package/assets/{MailListHeader-BicBoJT1.js → MailListHeader-B9vO8fqH.js} +2 -2
  6. package/assets/{MailViewChrome-B2qYsu8W.js → MailViewChrome-C7Id56Ny.js} +1 -1
  7. package/assets/{MailboxPane-CHDXSkT8.js → MailboxPane-Bu0_IYWM.js} +1 -1
  8. package/assets/{NavMenuButton-DJu1kfuB.js → NavMenuButton-BcqODuEd.js} +1 -1
  9. package/assets/{OnboardingWizard-Dra9SukW.js → OnboardingWizard-tY8vpnCv.js} +1 -1
  10. package/assets/{OutboxPane-1TXHUSJT.js → OutboxPane-Cd4tJpl0.js} +1 -1
  11. package/assets/_mailboxId-dU4H0AN9.js +1 -0
  12. package/assets/_messageId-CTgEnmtM.js +1 -0
  13. package/assets/_messageId-DCJbqxEk.js +1 -0
  14. package/assets/_messageId-DUX30A6Y.js +1 -0
  15. package/assets/_outboxMessageId-CiHhV-Yj.js +1 -0
  16. package/assets/_threadId-1NzAK4iY.js +1 -0
  17. package/assets/_threadId-DqXza0Du.js +1 -0
  18. package/assets/_threadId-R_V3bAlO.js +1 -0
  19. package/assets/{accounts-CoOmmruy.js → accounts-DlTUrH3V.js} +1 -1
  20. package/assets/{advanced-BIAPdb4r.js → advanced-Dw-wsK5U.js} +1 -1
  21. package/assets/{appearance-DbB6azHY.js → appearance-BUoaNx3t.js} +1 -1
  22. package/assets/{attachment-file-CHw7FrMy.js → attachment-file-D2wuknKq.js} +1 -1
  23. package/assets/{avatar-DB3_gN5F.js → avatar-CvCVi3F9.js} +1 -1
  24. package/assets/{bottom-sheet-8kmsdWna.js → bottom-sheet-Bof5NPqf.js} +1 -1
  25. package/assets/{brief-Bd2iOyne.js → brief-CZOGgeVH.js} +1 -1
  26. package/assets/brief-DGAOeQdW.js +1 -0
  27. package/assets/{browser-ponyfill-DfyYUPX-.js → browser-ponyfill-Dvm9tXLa.js} +1 -1
  28. package/assets/{bug-DNmVlBTg.js → bug-BHLCg0Ji.js} +1 -1
  29. package/assets/{circle-check-DsFX1pig.js → circle-check-BOHoppHs.js} +1 -1
  30. package/assets/{circle-check-big-BlKKkcu_.js → circle-check-big-BKpjINgN.js} +1 -1
  31. package/assets/{circle-help-lBEoV745.js → circle-help-Cw9vIhaj.js} +1 -1
  32. package/assets/{clock-CelGygfB.js → clock-eaUrEZh3.js} +1 -1
  33. package/assets/compose._-_outboxMessageId_-BJFtKEIo.js +1 -0
  34. package/assets/compose._-_outboxMessageId_-ByHrB5wW.js +1 -0
  35. package/assets/compose._-_outboxMessageId_-DBrWN_mQ.js +1 -0
  36. package/assets/compose._-_outboxMessageId_-Xvop5g6F.js +1 -0
  37. package/assets/{confirm-dialog--58F53XC.js → confirm-dialog-007Povhq.js} +1 -1
  38. package/assets/{download-tJ33vqPf.js → download-L7TAGjcT.js} +1 -1
  39. package/assets/{filters-Cl4HpbHE.js → filters-BSAjH538.js} +1 -1
  40. package/assets/flagged-B6CZYSBK.js +1 -0
  41. package/assets/{flagged-CGDOp4jN.js → flagged-Dpa1oNld.js} +1 -1
  42. package/assets/{folders-Bw4wcmLE.js → folders-Ch9mngfY.js} +1 -1
  43. package/assets/{help-copy-BRSvFGyN.js → help-copy-CHMOAa54.js} +1 -1
  44. package/assets/index-B9Y4Ktcc.js +1 -0
  45. package/assets/{index-BEGxV6sD.js → index-BQTgnFU2.js} +4 -4
  46. package/assets/index-BsdV-1tl.js +1 -0
  47. package/assets/index-BtL0yPFO.js +1 -0
  48. package/assets/{index-t0zHcrCE.js → index-C4YPHP48.js} +3 -3
  49. package/assets/index-CTgEnmtM.js +1 -0
  50. package/assets/index-CbNeZplB.js +1 -0
  51. package/assets/index-CzrP7CHx.js +1 -0
  52. package/assets/index-DUX30A6Y.js +1 -0
  53. package/assets/index-Dbp1yAxw.js +1 -0
  54. package/assets/{kbd-nihjJHao.js → kbd-6Q4PA1CK.js} +1 -1
  55. package/assets/{labels-C9bPpU0m.js → labels-C2OiNUkg.js} +1 -1
  56. package/assets/{mail-CYwj77o7.js → mail-3ysdr_UV.js} +1 -1
  57. package/assets/{mail-mRgQcaMs.js → mail-CVppWr2e.js} +1 -1
  58. package/assets/{menu-4YwjQgDW.js → menu-BPCaZ391.js} +1 -1
  59. package/assets/{onboarding-CqgIU5tV.js → onboarding-CSic18s9.js} +1 -1
  60. package/assets/outbox-BtflsbYT.js +1 -0
  61. package/assets/{pencil-Cbre9fN3.js → pencil-CGRYJ2HA.js} +1 -1
  62. package/assets/{rich-text-Dx4wkjH7.js → rich-text-CTCzqAZV.js} +1 -1
  63. package/assets/{rich-text-spellcheck-worker-provider-C1QEpOVp.js → rich-text-spellcheck-worker-provider-BDAX6zj1.js} +1 -1
  64. package/assets/{rotate-ccw-DMacTwO1.js → rotate-ccw-Ctsa6iVn.js} +1 -1
  65. package/assets/{row-actions-QSe7tEyZ.js → row-actions-DQugjqmq.js} +1 -1
  66. package/assets/{search-scope-BYI7Zflh.js → search-scope-CVzGDF_4.js} +1 -1
  67. package/assets/{search-token-index-BntL5--E.js → search-token-index-C_566xlt.js} +1 -1
  68. package/assets/{search-view-C11dDMxY.js → search-view-D_ZqPNzH.js} +1 -1
  69. package/assets/{senders-30l2JXvD.js → senders-BgE6PkRz.js} +1 -1
  70. package/assets/settings-VG4DU0In.js +1 -0
  71. package/assets/{settings-screen-2Kx8qmnA.js → settings-screen-BQniXREi.js} +1 -1
  72. package/assets/{shield-check-CN0DW77g.js → shield-check-CkZ3bUEI.js} +1 -1
  73. package/assets/{suggested-vips-4i61SvB_.js → suggested-vips-rnLJj6Mu.js} +1 -1
  74. package/assets/{useDebouncedValue-CbSLiw8I.js → useDebouncedValue-TwIik-Bi.js} +1 -1
  75. package/assets/{useFilters-CMg1SXFf.js → useFilters-Vl02Feaa.js} +1 -1
  76. package/assets/{useLabels-kBdvYDkb.js → useLabels-Bl4H_oW2.js} +1 -1
  77. package/assets/{useMediaQuery-Q90E6l1J.js → useMediaQuery-D1S3QsF0.js} +1 -1
  78. package/assets/{useMessageBodyContent-istNARxX.js → useMessageBodyContent-PBQCTZnz.js} +1 -1
  79. package/assets/{useRefreshControl-C4XVstSt.js → useRefreshControl-CItUGjsW.js} +1 -1
  80. package/assets/{useSearchMirror-BT_Py8D1.js → useSearchMirror-Bc0QfWX3.js} +1 -1
  81. package/assets/{useSearchTokenContext-Gm3tselb.js → useSearchTokenContext-C-H1Y09b.js} +1 -1
  82. package/assets/{useSemanticSearch-Bwxnonb7.js → useSemanticSearch-CDYV0k01.js} +1 -1
  83. package/assets/{useSignature-BK5jw0y8.js → useSignature-BVhhHKWK.js} +1 -1
  84. package/index.html +1 -1
  85. package/package.json +1 -1
  86. package/assets/_mailboxId-CqTkPUhs.js +0 -1
  87. package/assets/_messageId-B75OcYS_.js +0 -1
  88. package/assets/_messageId-CT4HNYp1.js +0 -1
  89. package/assets/_messageId-DNdi5325.js +0 -1
  90. package/assets/_outboxMessageId-Dd3DNAYN.js +0 -1
  91. package/assets/_threadId-BKBf7vKZ.js +0 -1
  92. package/assets/_threadId-Bzj7TMJe.js +0 -1
  93. package/assets/_threadId-CAI-nO7w.js +0 -1
  94. package/assets/brief-BM0k1dtC.js +0 -1
  95. package/assets/compose._-_outboxMessageId_-Bz7qtmu8.js +0 -1
  96. package/assets/compose._-_outboxMessageId_-CNHdLX0q.js +0 -1
  97. package/assets/compose._-_outboxMessageId_-CuPEk9Sc.js +0 -1
  98. package/assets/compose._-_outboxMessageId_-wYzZVXzm.js +0 -1
  99. package/assets/flagged-lcTL3153.js +0 -1
  100. package/assets/index-B-h9nvKT.js +0 -1
  101. package/assets/index-B75OcYS_.js +0 -1
  102. package/assets/index-BlEWEQ71.js +0 -1
  103. package/assets/index-BmivlMNy.js +0 -1
  104. package/assets/index-DNdi5325.js +0 -1
  105. package/assets/index-Kur8ZtAW.js +0 -1
  106. package/assets/index-iw9graqT.js +0 -1
  107. package/assets/index-v_x_RLHD.js +0 -1
  108. package/assets/outbox-BllzR8ED.js +0 -1
  109. package/assets/settings-D0U2xGQ2.js +0 -1
@@ -1 +1 @@
1
- import{j as a,af as Ze,S as Xe,bB as et,l as Y,bq as tt,m as oe,r as o,s as ae,bC as ne,q as st,bD as at,bE as nt,bF as ot,e as Re,bG as rt}from"./index-BEGxV6sD.js";import{s as Te,a as it,b as we,u as lt,p as ct,R as dt}from"./useSearchTokenContext-Gm3tselb.js";import{aa as ve,H as ye,ab as ut,ac as mt,I as ft,ad as Se,ae as ht,af as gt,ag as xt,a9 as pt,ah as It,ai as bt,aj as vt,M as yt,ak as St,al as Ct,am as jt,e as Rt,v as Tt,an as wt,q as Mt,S as kt,L as Ft,Q as Ce,P as At,N as Nt,d as Ot,_ as Bt,$ as Dt,a1 as Me,a2 as ke,a3 as Lt,a4 as Et,a5 as Pt}from"./MailListHeader-BicBoJT1.js";import{u as qt,a as zt,R as Qt,i as Ht,b as _t}from"./useRefreshControl-C4XVstSt.js";import{e as $t,c as Wt,R as Gt}from"./search-token-index-BntL5--E.js";import{a as Ut}from"./useLabels-kBdvYDkb.js";import{u as Vt}from"./useMediaQuery-Q90E6l1J.js";import{u as Yt,r as Jt,L as Kt}from"./useSemanticSearch-Bwxnonb7.js";import{w as Zt}from"./wizard-selection-B1bng5Jq.js";import{o as Xt,f as es,h as ts,p as ss,r as as}from"./useMessageBodyContent-istNARxX.js";function ns({sync:e}){return e?a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",role:"status","aria-live":"polite",children:[a.jsx(Ze,{className:"size-8 animate-spin text-fg-subtle","aria-hidden":"true"}),a.jsx("p",{className:"text-sm font-medium text-fg",children:"Still syncing your mail"}),a.jsx("p",{className:"text-xs text-fg-subtle",children:os(e)})]}):a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",children:[a.jsx(Xe,{className:"size-8 text-fg-subtle","aria-hidden":"true"}),a.jsx("p",{className:"text-sm font-medium text-fg",children:"You're caught up"}),a.jsx("p",{className:"text-xs text-fg-subtle",children:"Nothing needs attention."})]})}function os({synced:e,total:t}){return t>0?`${e.toLocaleString()} of ${t.toLocaleString()} messages downloaded. This list fills in as they arrive.`:"Downloading your messages. This list fills in as they arrive."}const Fe=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],Ae="category",rs={unclassified:"uncategorized"},$=e=>it(e).map(t=>t.raw),_=e=>e.join(" "),re=e=>{const t=we(e);if(t)return Fe.find(n=>n.name===t.name&&n.value===t.value.toLowerCase())?.id},ie=e=>{const t=we(e);if(!t||t.name!==Ae)return;const n=t.value.toLowerCase(),r=rs[n];if(r)return r;if(!(!et(n)||n==="all"))return n},Ne=e=>Fe.find(t=>t.id===e),Oe=e=>Ne(e)!==void 0,is=e=>{const t=new Set;for(const n of $(e)){const r=re(n);r&&t.add(r)}return t},ls=e=>{let t="all";for(const n of $(e)){const r=ie(n);r&&(t=r)}return t},cs=(e,t)=>{const n=Ne(t);if(!n)return;const r=$(e),d=r.filter(i=>re(i)!==t);return d.length<r.length?_(d):_([...r,Te(n.name,n.value)])},ds=(e,t)=>{const n=$(e).filter(r=>!ie(r));return _(t==="all"?n:[...n,Te(Ae,t)])},us=e=>_($(e).filter(t=>!re(t)&&!ie(t))),Be=e=>e.trim().length>0,ms=e=>{if(!Be(e.query))return e.ownFilters;const t=new Set(is(e.query));for(const n of e.ownFilters)Oe(n)||t.add(n);return t},fs=e=>Be(e.query)?ls(e.query):e.ownCategory,hs=(e,t)=>e.createdAt!==t.createdAt?e.createdAt-t.createdAt:e.accountId.localeCompare(t.accountId),gs=e=>[...e].sort(hs),xs=200,je=()=>a.jsx("div",{className:"animate-pulse",children:Array.from({length:3}).map((e,t)=>a.jsxs("div",{className:"flex items-start gap-3 py-2 pl-5 pr-4 border-b border-line",children:[a.jsx("div",{className:"size-7 rounded-full bg-surface-sunken shrink-0 mt-0.5"}),a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsxs("div",{className:"flex justify-between gap-2",children:[a.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-28"}),a.jsx("div",{className:"h-3 bg-surface-sunken rounded w-12"})]}),a.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-48"}),a.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})]})]},t))}),ps=({accountEmail:e})=>{const t=oe();return a.jsxs("div",{className:"flex items-center gap-2 px-row-inset py-2 border-b border-line bg-danger-soft/40 text-xs text-danger",children:[a.jsx(Re,{className:"size-3.5 shrink-0"}),a.jsxs("span",{className:"flex-1 truncate",children:[e," can't connect"]}),a.jsx("button",{type:"button",onClick:()=>t({to:"/settings/accounts"}),className:"shrink-0 underline text-danger hover:opacity-80",children:"Reconnect"})]})},Is=(e,t)=>{if(t.size===0)return{};const n=e.filter(i=>t.has(i.id)),r=Jt(n.map(i=>i.accountId));if(r.restriction)return r;const d=new Set;for(const i of n)i.mailboxId&&d.add(i.mailboxId);return d.size>1?{accountId:r.accountId,restriction:"spansFolders",moveDisabledHint:`Move only works within one folder — this selection spans ${d.size} folders`}:{accountId:r.accountId,mailboxId:d.size===1?[...d][0]:void 0}};function bs({header:e,rows:t,wizard:n,children:r}){const{selectedIds:d,selectedCount:i,exitSelection:f,orderedIds:u,allSelected:h,toggleAllLoaded:y}=jt(),x=o.useMemo(()=>Is(t,d),[t,d]),{junkMailboxId:p}=Rt(x.accountId),{labels:I}=Ut(x.accountId),A=o.useMemo(()=>Array.from(d),[d]),L=o.useMemo(()=>Zt(t,d),[t,d]),m=Tt(p,x.mailboxId),b=o.useMemo(()=>u.length>0?{checked:h,indeterminate:i>0&&!h,onChange:y}:void 0,[u.length,h,i,y]),N=x.moveDisabledHint?{tone:"warning",text:x.moveDisabledHint}:void 0,S=C=>a.jsx(kt,{title:C.title,navSlot:C.navSlot,titleMeta:C.titleMeta,searchSlot:C.searchSlot,searchField:C.searchField,idleSlot:C.makeFilterSlot,count:i,onCancel:f,onDelete:()=>n.start("delete"),onMove:()=>n.start("move"),onOrganize:()=>n.start("organize"),onJunk:m?()=>n.start("junk"):void 0,onMarkRead:()=>n.start("markRead"),overflowSlot:x.accountId&&x.mailboxId&&i>0&&I.length>0?a.jsx(Kt,{accountId:x.accountId,mailboxId:x.mailboxId,messageIds:A}):void 0,selectAll:b,notice:N});return a.jsx(wt,{...e,selectionBar:S,paneOverlay:a.jsx(Mt,{verb:n.verb,accountId:x.accountId,mailboxId:x.mailboxId,selection:L,selectionRestriction:x.restriction,onFinished:f}),children:r})}function vs({accounts:e,selectedMessageId:t,onOpenThread:n,commandsRef:r,onTriageContextChange:d,onDeleteMessages:i}){const{searchQuery:f,searchInput:u,resultFolderIndex:h,onSearchChange:y}=Y(),x=lt(),p=Vt(),I=$t(),A=tt(),L=oe(),m=o.useMemo(()=>gs(e.filter(s=>!s.muted?.value)),[e]),[b,N]=o.useState("all"),[S,C]=o.useState("all"),[W,E]=o.useState(new Set),[K,j]=o.useState(!1),P=o.useCallback(s=>{E(l=>{const c=new Set(l);return c.has(s)?c.delete(s):c.add(s),c})},[]),G=o.useCallback(()=>E(new Set),[]),T=u.trim().length>0,R=o.useMemo(()=>ms({query:u,ownFilters:W}),[u,W]),w=o.useMemo(()=>fs({query:u,ownCategory:S}),[u,S]),O=o.useCallback(s=>{if(!T||!Oe(s)){P(s);return}const l=cs(u,s);l!==void 0&&y(l)},[T,u,y,P]),q=o.useCallback(s=>{if(!T){C(s);return}y(ds(u,s))},[T,u,y]),z=o.useCallback(()=>{C("all"),N("all"),G(),T&&y(us(u))},[T,u,y,G]),{data:B,isLoading:Q,isError:g,refetch:D}=ae({...ne(),staleTime:6e4}),M=Wt({queries:m.map(s=>({...st({path:{accountId:s.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),U=o.useMemo(()=>{const s=new Map;for(let l=0;l<m.length;l++){const c=m[l].accountId,Ye=(M[l]?.data?.items??[]).reduce((Je,Ke)=>Je+(Ke.unseenCount??0),0);s.set(c,Ye)}return s},[m,M]),Ee=o.useMemo(()=>m.filter((s,l)=>{const c=M[l];return c?.isError?!at(c.error):!1}),[m,M]),{freeText:k,tokens:Z}=ct(f.trim().toLowerCase(),x),{data:le,isFetching:Pe}=ae({...ne({query:{query:k,limit:xs}}),enabled:k.length>0,staleTime:3e4}),v=o.useMemo(()=>{const s=ve(B?.items??[]).map(ye);return(k?ut(s.filter(c=>mt(c,k)),ve(le?.items??[]).map(ye)):s).filter(c=>(b==="all"||c.accountId===b)&&ft(c,Z))},[B,le,b,k,Z]),{bodyRows:ce,briefSpamOffer:X}=o.useMemo(()=>{if(!k)return{bodyRows:v,briefSpamOffer:void 0};const s=v.map(F=>Se(F,h)),{spam:l}=ht(s);if(l.length===0)return{bodyRows:v,briefSpamOffer:void 0};const c=new Set(l.map(F=>F.id));return{bodyRows:v.filter(F=>!c.has(F.id)),briefSpamOffer:gt(s)}},[v,k,h]),de=o.useMemo(()=>xt(ce),[ce]),ue=o.useCallback((s,l)=>{const c=v.find(F=>F.id===s)?.threadId;c&&n?.({threadId:c,messageId:s},l)},[v,n]),qe=o.useCallback(s=>{const l=s.threadId??v.find(c=>c.id===s.id)?.threadId;l&&n?.({threadId:l,messageId:s.id})},[v,n]),ee=o.useMemo(()=>m.length<=1?[]:[{id:"all",label:"All",active:b==="all"},...m.map(s=>({id:s.accountId,label:s.email.split("@")[0]??s.email,count:U.get(s.accountId),active:b===s.accountId}))],[m,U,b]),H=o.useMemo(()=>e.filter(s=>s.muted?.value).length,[e]),ze=o.useMemo(()=>Array.from(U.values()).reduce((s,l)=>s+l,0),[U]),te=o.useMemo(()=>m.map(s=>s.accountId),[m]),{hasNewMail:me}=qt(),{state:fe,errorMessage:he,refresh:ge}=zt(te,{onSettled:()=>D()}),Qe=o.useMemo(()=>a.jsx(Qt,{state:fe,onRefresh:ge,label:"Refresh daily brief",errorMessage:he,hasUpdate:me(te)}),[fe,ge,he,me,te]),se=o.useMemo(()=>v.filter(s=>(w==="all"||s.category===w)&&nt(s,R)).map(s=>Se(s,h)),[v,w,R,h]),{hits:xe,isLoading:He}=Yt(),_e=o.useMemo(()=>{const s=new Map;for(const c of B?.items??[])s.set(c.messageId,c.threadId);const l=se.map(c=>s.get(c.id)).filter(c=>c!=null);return pt(xe,l,h)},[xe,se,B,h]),$e=o.useMemo(()=>{const s=It(ee.map(l=>({id:l.id,label:l.label,count:l.count,active:l.active})));return{categories:s.categories,filters:s.filters,sources:s.sources,sourcesNote:H>0?`+${H} muted`:void 0,selectedCategory:w,activeFilters:R,expanded:K,onExpandedChange:j,onSelectCategory:l=>q(l),onSelectSource:N,onToggleFilter:l=>O(l),onClear:z}},[ee,H,w,R,K,O,q,z]),pe=de.length===0&&b==="all"&&k.length===0&&Z.length===0,We=o.useMemo(()=>m.map(s=>s.accountId),[m]),Ge=o.useMemo(()=>m.some(s=>Ht(s.syncPhase)),[m]),V=_t(We,pe||Ge),Ie=a.jsxs("div",{className:"h-full overflow-y-auto",children:[a.jsx(je,{}),a.jsx(je,{})]}),be=!Q&&!g&&!pe,Ue=bt({tier:I,hasLiveInput:T,hasCommittedQuery:f.trim().length>0,bodyRendersCommittedResults:!0}),Ve=be?a.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[X&&a.jsx(vt,{count:X.count,onScopeToSpam:()=>L({to:"/mail/$mailboxId",params:{mailboxId:X.mailboxId},search:{q:f||void 0}})}),a.jsx("div",{className:"min-h-0 flex-1",children:a.jsx(ot,{sections:de,briefCategory:w,Row:yt,selectedThreadId:t,onSelectThread:ue,onSelectBriefCategory:q,sources:ee,sourcesNote:H>0?`+${H} muted`:void 0,onSelectSource:N,activeFilters:R,onToggleFilter:O,onClearFilters:z})})]}):Q?Ie:g?a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 py-12 text-sm text-fg-muted",children:[a.jsx(Re,{className:"size-8 text-danger"}),a.jsx("p",{children:"Couldn't load your messages"}),a.jsxs("button",{type:"button",onClick:()=>D(),className:"flex items-center gap-1 text-accent underline text-xs",children:[a.jsx(Gt,{className:"size-3.5"}),"Try again"]})]}):V.resolved?a.jsx(ns,{sync:V.syncing?{synced:V.synced,total:V.total}:void 0}):Ie;return a.jsx(rt,{hasSheet:be&&!Ue,children:a.jsx(St,{selectedMessageId:t,rows:v,onOpen:ue,onDeleteMessages:i,onSelectionVerb:A.start,wizardOpen:A.isOpen,commandsRef:r,onTriageContextChange:d,children:a.jsx(bs,{wizard:A,header:{title:"Daily brief",unreadCount:ze,footer:p?a.jsx(Ct,{}):void 0,searchFilter:$e,searchResults:se,searchLoading:Q||Pe,relatedResults:_e,relatedLoading:He,onSelectSearchResult:qe,searchResultsInBody:!0,refreshControl:Qe},rows:v,children:a.jsxs("div",{className:"flex h-full flex-col",children:[Ee.map(s=>a.jsx(ps,{accountEmail:s.email,accountId:s.accountId},s.accountId)),a.jsx("div",{className:"min-h-0 flex-1",children:Ve})]})})})})}const De=o.createContext(null);function J(){const e=o.useContext(De);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function ys({thread:e,children:t}){const n=oe(),r=Xt(),{searchInput:d}=Y(),i=e?.threadId,f=e?.messageId,{data:u}=ae({...ne(),staleTime:6e4}),h=o.useMemo(()=>u?.items??[],[u]),y=o.useMemo(()=>{if(i)return h.find(g=>g.messageId===f)??h.find(g=>g.threadId===i)},[h,i,f]),x=Ft(i,f),p=y??x,I=f??p?.messageId,A=o.useMemo(()=>{if(i)return{threadId:i,mailboxId:p?.mailboxId??"",subject:p?.subject,messageId:I,authenticity:p?.authenticity}},[i,p,I]),L=o.useCallback((g,D)=>{n({to:"/mail/brief/$threadId/$messageId",params:g,replace:D?.replace,search:M=>({...M,q:d||void 0}),hash:r})},[n,r,d]),m=o.useCallback(()=>{n({to:"/mail/brief",search:g=>g,hash:r})},[n,r]),b=o.useCallback(g=>{I&&g.includes(I)&&m()},[I,m]),N=Ce({thread:p,onAfterOptimisticRemove:b}),S=At(),{deleteMessages:C}=Nt({mailboxId:p?.mailboxId??"",messages:h,onAfterOptimisticRemove:b}),{toggleReadFor:W}=Ot({mailboxId:p?.mailboxId??"",messages:h}),E=S.focusedMessageId,j=o.useMemo(()=>h.find(g=>g.messageId===E),[h,E])??p,P=Ce({thread:j}),G=es(),T=ts(),R=ss(),w=o.useMemo(()=>as(R,i,I),[R,i,I]),O=o.useMemo(()=>{if(j)return g=>R({threadId:j.threadId,messageId:j.messageId,mode:g})},[R,j]),{nextMessageId:q,previousMessageId:z}=Bt({context:S,orderedIds:S.orderedIds,selectedMessageId:I,enabled:!G&&!T,onClose:m,handlers:{reply:()=>O?.("reply"),replyAll:()=>O?.("reply-all"),forward:()=>O?.("forward"),delete:()=>{S.listCommandsRef.current?.requestVerb("delete")||P.deleteThread()},toggleStar:P.toggleStar,toggleRead:()=>{S.listCommandsRef.current?.requestVerb("markRead")||j&&W([j.messageId],!j.isRead)},goFlagged:()=>n({to:"/mail/flagged"}),goSettings:()=>n({to:"/settings"})}}),B=o.useCallback(g=>{if(!g)return;const D=h.find(M=>M.messageId===g);return D?{threadId:D.threadId,messageId:g}:void 0},[h]),Q={selectedMessageId:I,selectedThread:p,conversation:A,onOpenThread:L,onCloseThread:m,nextThread:B(q),previousThread:B(z),actions:N,onReply:w,triage:S,onDeleteMessages:C,handleDeselectIfRemoved:b};return a.jsx(De.Provider,{value:Q,children:t})}function Le(){const{selectedMessageId:e,onOpenThread:t,triage:n,onDeleteMessages:r}=J(),{accounts:d}=Y();return a.jsx(vs,{accounts:d,selectedMessageId:e,onOpenThread:t,commandsRef:n.listCommandsRef,onTriageContextChange:n.onTriageContextChange,onDeleteMessages:r})}function Ss(){const{conversation:e,selectedThread:t,actions:n,onReply:r,handleDeselectIfRemoved:d}=J(),i=!!e,f=Et(e?.threadId);return a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[a.jsx(Pt,{hasThread:i,intelligenceOpen:f.isShowing,canToggleIntelligence:f.canToggle,onToggleIntelligence:f.toggle,onReply:r?()=>r("reply"):void 0,onReplyAll:r?()=>r("reply-all"):void 0,onForward:r?()=>r("forward"):void 0,onDelete:i?n.deleteThread:void 0,onToggleStar:i?n.toggleStar:void 0,isStarred:n.isStarred,moveContext:i&&n.accountId&&n.mailboxId?{accountId:n.accountId,currentMailboxId:n.mailboxId,onMove:n.moveThread}:void 0}),a.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?a.jsx(Me,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:f.open}):a.jsx(dt,{})})]}),a.jsx(ke,{isOpen:f.drawerOpen,onClose:f.closeDrawer,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:d})]})}function Cs(){const{selectedThread:e,handleDeselectIfRemoved:t}=J(),{onToggleIntelligence:n}=Y();return a.jsx(Lt,{onClose:n,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function js(){const{selectedThread:e,conversation:t,onOpenThread:n,onCloseThread:r,nextThread:d,previousThread:i,handleDeselectIfRemoved:f}=J(),u=Dt(t?.threadId??null);return t?a.jsxs(a.Fragment,{children:[a.jsx(Me,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:r,onOpenIntelligence:u.toggle,onSwipeNext:d?()=>n(d):void 0,onSwipePrevious:i?()=>n(i):void 0,mobileIntelligenceOpen:u.isOpen}),a.jsx(ke,{isOpen:u.isOpen,onClose:u.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:f})]}):a.jsx("div",{className:"h-full",children:a.jsx(Le,{})})}const Ds=Object.assign(ys,{List:Le,Reading:Ss,Intelligence:Cs,Phone:js});export{Ds as B};
1
+ import{j as a,af as Ze,S as Xe,bB as et,l as Y,bq as tt,m as oe,r as o,s as ae,bC as ne,q as st,bD as at,bE as nt,bF as ot,e as Re,bG as rt}from"./index-BQTgnFU2.js";import{s as Te,a as it,b as we,u as lt,p as ct,R as dt}from"./useSearchTokenContext-C-H1Y09b.js";import{aa as ve,H as ye,ab as ut,ac as mt,I as ft,ad as Se,ae as ht,af as gt,ag as xt,a9 as pt,ah as It,ai as bt,aj as vt,M as yt,ak as St,al as Ct,am as jt,e as Rt,v as Tt,an as wt,q as Mt,S as kt,L as Ft,Q as Ce,P as At,N as Nt,d as Ot,_ as Bt,$ as Dt,a1 as Me,a2 as ke,a3 as Lt,a4 as Et,a5 as Pt}from"./MailListHeader-B9vO8fqH.js";import{u as qt,a as zt,R as Qt,i as Ht,b as _t}from"./useRefreshControl-CItUGjsW.js";import{e as $t,c as Wt,R as Gt}from"./search-token-index-C_566xlt.js";import{a as Ut}from"./useLabels-Bl4H_oW2.js";import{u as Vt}from"./useMediaQuery-D1S3QsF0.js";import{u as Yt,r as Jt,L as Kt}from"./useSemanticSearch-CDYV0k01.js";import{w as Zt}from"./wizard-selection-B1bng5Jq.js";import{o as Xt,f as es,h as ts,p as ss,r as as}from"./useMessageBodyContent-PBQCTZnz.js";function ns({sync:e}){return e?a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",role:"status","aria-live":"polite",children:[a.jsx(Ze,{className:"size-8 animate-spin text-fg-subtle","aria-hidden":"true"}),a.jsx("p",{className:"text-sm font-medium text-fg",children:"Still syncing your mail"}),a.jsx("p",{className:"text-xs text-fg-subtle",children:os(e)})]}):a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",children:[a.jsx(Xe,{className:"size-8 text-fg-subtle","aria-hidden":"true"}),a.jsx("p",{className:"text-sm font-medium text-fg",children:"You're caught up"}),a.jsx("p",{className:"text-xs text-fg-subtle",children:"Nothing needs attention."})]})}function os({synced:e,total:t}){return t>0?`${e.toLocaleString()} of ${t.toLocaleString()} messages downloaded. This list fills in as they arrive.`:"Downloading your messages. This list fills in as they arrive."}const Fe=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],Ae="category",rs={unclassified:"uncategorized"},$=e=>it(e).map(t=>t.raw),_=e=>e.join(" "),re=e=>{const t=we(e);if(t)return Fe.find(n=>n.name===t.name&&n.value===t.value.toLowerCase())?.id},ie=e=>{const t=we(e);if(!t||t.name!==Ae)return;const n=t.value.toLowerCase(),r=rs[n];if(r)return r;if(!(!et(n)||n==="all"))return n},Ne=e=>Fe.find(t=>t.id===e),Oe=e=>Ne(e)!==void 0,is=e=>{const t=new Set;for(const n of $(e)){const r=re(n);r&&t.add(r)}return t},ls=e=>{let t="all";for(const n of $(e)){const r=ie(n);r&&(t=r)}return t},cs=(e,t)=>{const n=Ne(t);if(!n)return;const r=$(e),d=r.filter(i=>re(i)!==t);return d.length<r.length?_(d):_([...r,Te(n.name,n.value)])},ds=(e,t)=>{const n=$(e).filter(r=>!ie(r));return _(t==="all"?n:[...n,Te(Ae,t)])},us=e=>_($(e).filter(t=>!re(t)&&!ie(t))),Be=e=>e.trim().length>0,ms=e=>{if(!Be(e.query))return e.ownFilters;const t=new Set(is(e.query));for(const n of e.ownFilters)Oe(n)||t.add(n);return t},fs=e=>Be(e.query)?ls(e.query):e.ownCategory,hs=(e,t)=>e.createdAt!==t.createdAt?e.createdAt-t.createdAt:e.accountId.localeCompare(t.accountId),gs=e=>[...e].sort(hs),xs=200,je=()=>a.jsx("div",{className:"animate-pulse",children:Array.from({length:3}).map((e,t)=>a.jsxs("div",{className:"flex items-start gap-3 py-2 pl-5 pr-4 border-b border-line",children:[a.jsx("div",{className:"size-7 rounded-full bg-surface-sunken shrink-0 mt-0.5"}),a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsxs("div",{className:"flex justify-between gap-2",children:[a.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-28"}),a.jsx("div",{className:"h-3 bg-surface-sunken rounded w-12"})]}),a.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-48"}),a.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})]})]},t))}),ps=({accountEmail:e})=>{const t=oe();return a.jsxs("div",{className:"flex items-center gap-2 px-row-inset py-2 border-b border-line bg-danger-soft/40 text-xs text-danger",children:[a.jsx(Re,{className:"size-3.5 shrink-0"}),a.jsxs("span",{className:"flex-1 truncate",children:[e," can't connect"]}),a.jsx("button",{type:"button",onClick:()=>t({to:"/settings/accounts"}),className:"shrink-0 underline text-danger hover:opacity-80",children:"Reconnect"})]})},Is=(e,t)=>{if(t.size===0)return{};const n=e.filter(i=>t.has(i.id)),r=Jt(n.map(i=>i.accountId));if(r.restriction)return r;const d=new Set;for(const i of n)i.mailboxId&&d.add(i.mailboxId);return d.size>1?{accountId:r.accountId,restriction:"spansFolders",moveDisabledHint:`Move only works within one folder — this selection spans ${d.size} folders`}:{accountId:r.accountId,mailboxId:d.size===1?[...d][0]:void 0}};function bs({header:e,rows:t,wizard:n,children:r}){const{selectedIds:d,selectedCount:i,exitSelection:f,orderedIds:u,allSelected:h,toggleAllLoaded:y}=jt(),x=o.useMemo(()=>Is(t,d),[t,d]),{junkMailboxId:p}=Rt(x.accountId),{labels:I}=Ut(x.accountId),A=o.useMemo(()=>Array.from(d),[d]),L=o.useMemo(()=>Zt(t,d),[t,d]),m=Tt(p,x.mailboxId),b=o.useMemo(()=>u.length>0?{checked:h,indeterminate:i>0&&!h,onChange:y}:void 0,[u.length,h,i,y]),N=x.moveDisabledHint?{tone:"warning",text:x.moveDisabledHint}:void 0,S=C=>a.jsx(kt,{title:C.title,navSlot:C.navSlot,titleMeta:C.titleMeta,searchSlot:C.searchSlot,searchField:C.searchField,idleSlot:C.makeFilterSlot,count:i,onCancel:f,onDelete:()=>n.start("delete"),onMove:()=>n.start("move"),onOrganize:()=>n.start("organize"),onJunk:m?()=>n.start("junk"):void 0,onMarkRead:()=>n.start("markRead"),overflowSlot:x.accountId&&x.mailboxId&&i>0&&I.length>0?a.jsx(Kt,{accountId:x.accountId,mailboxId:x.mailboxId,messageIds:A}):void 0,selectAll:b,notice:N});return a.jsx(wt,{...e,selectionBar:S,paneOverlay:a.jsx(Mt,{verb:n.verb,accountId:x.accountId,mailboxId:x.mailboxId,selection:L,selectionRestriction:x.restriction,onFinished:f}),children:r})}function vs({accounts:e,selectedMessageId:t,onOpenThread:n,commandsRef:r,onTriageContextChange:d,onDeleteMessages:i}){const{searchQuery:f,searchInput:u,resultFolderIndex:h,onSearchChange:y}=Y(),x=lt(),p=Vt(),I=$t(),A=tt(),L=oe(),m=o.useMemo(()=>gs(e.filter(s=>!s.muted?.value)),[e]),[b,N]=o.useState("all"),[S,C]=o.useState("all"),[W,E]=o.useState(new Set),[K,j]=o.useState(!1),P=o.useCallback(s=>{E(l=>{const c=new Set(l);return c.has(s)?c.delete(s):c.add(s),c})},[]),G=o.useCallback(()=>E(new Set),[]),T=u.trim().length>0,R=o.useMemo(()=>ms({query:u,ownFilters:W}),[u,W]),w=o.useMemo(()=>fs({query:u,ownCategory:S}),[u,S]),O=o.useCallback(s=>{if(!T||!Oe(s)){P(s);return}const l=cs(u,s);l!==void 0&&y(l)},[T,u,y,P]),q=o.useCallback(s=>{if(!T){C(s);return}y(ds(u,s))},[T,u,y]),z=o.useCallback(()=>{C("all"),N("all"),G(),T&&y(us(u))},[T,u,y,G]),{data:B,isLoading:Q,isError:g,refetch:D}=ae({...ne(),staleTime:6e4}),M=Wt({queries:m.map(s=>({...st({path:{accountId:s.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),U=o.useMemo(()=>{const s=new Map;for(let l=0;l<m.length;l++){const c=m[l].accountId,Ye=(M[l]?.data?.items??[]).reduce((Je,Ke)=>Je+(Ke.unseenCount??0),0);s.set(c,Ye)}return s},[m,M]),Ee=o.useMemo(()=>m.filter((s,l)=>{const c=M[l];return c?.isError?!at(c.error):!1}),[m,M]),{freeText:k,tokens:Z}=ct(f.trim().toLowerCase(),x),{data:le,isFetching:Pe}=ae({...ne({query:{query:k,limit:xs}}),enabled:k.length>0,staleTime:3e4}),v=o.useMemo(()=>{const s=ve(B?.items??[]).map(ye);return(k?ut(s.filter(c=>mt(c,k)),ve(le?.items??[]).map(ye)):s).filter(c=>(b==="all"||c.accountId===b)&&ft(c,Z))},[B,le,b,k,Z]),{bodyRows:ce,briefSpamOffer:X}=o.useMemo(()=>{if(!k)return{bodyRows:v,briefSpamOffer:void 0};const s=v.map(F=>Se(F,h)),{spam:l}=ht(s);if(l.length===0)return{bodyRows:v,briefSpamOffer:void 0};const c=new Set(l.map(F=>F.id));return{bodyRows:v.filter(F=>!c.has(F.id)),briefSpamOffer:gt(s)}},[v,k,h]),de=o.useMemo(()=>xt(ce),[ce]),ue=o.useCallback((s,l)=>{const c=v.find(F=>F.id===s)?.threadId;c&&n?.({threadId:c,messageId:s},l)},[v,n]),qe=o.useCallback(s=>{const l=s.threadId??v.find(c=>c.id===s.id)?.threadId;l&&n?.({threadId:l,messageId:s.id})},[v,n]),ee=o.useMemo(()=>m.length<=1?[]:[{id:"all",label:"All",active:b==="all"},...m.map(s=>({id:s.accountId,label:s.email.split("@")[0]??s.email,count:U.get(s.accountId),active:b===s.accountId}))],[m,U,b]),H=o.useMemo(()=>e.filter(s=>s.muted?.value).length,[e]),ze=o.useMemo(()=>Array.from(U.values()).reduce((s,l)=>s+l,0),[U]),te=o.useMemo(()=>m.map(s=>s.accountId),[m]),{hasNewMail:me}=qt(),{state:fe,errorMessage:he,refresh:ge}=zt(te,{onSettled:()=>D()}),Qe=o.useMemo(()=>a.jsx(Qt,{state:fe,onRefresh:ge,label:"Refresh daily brief",errorMessage:he,hasUpdate:me(te)}),[fe,ge,he,me,te]),se=o.useMemo(()=>v.filter(s=>(w==="all"||s.category===w)&&nt(s,R)).map(s=>Se(s,h)),[v,w,R,h]),{hits:xe,isLoading:He}=Yt(),_e=o.useMemo(()=>{const s=new Map;for(const c of B?.items??[])s.set(c.messageId,c.threadId);const l=se.map(c=>s.get(c.id)).filter(c=>c!=null);return pt(xe,l,h)},[xe,se,B,h]),$e=o.useMemo(()=>{const s=It(ee.map(l=>({id:l.id,label:l.label,count:l.count,active:l.active})));return{categories:s.categories,filters:s.filters,sources:s.sources,sourcesNote:H>0?`+${H} muted`:void 0,selectedCategory:w,activeFilters:R,expanded:K,onExpandedChange:j,onSelectCategory:l=>q(l),onSelectSource:N,onToggleFilter:l=>O(l),onClear:z}},[ee,H,w,R,K,O,q,z]),pe=de.length===0&&b==="all"&&k.length===0&&Z.length===0,We=o.useMemo(()=>m.map(s=>s.accountId),[m]),Ge=o.useMemo(()=>m.some(s=>Ht(s.syncPhase)),[m]),V=_t(We,pe||Ge),Ie=a.jsxs("div",{className:"h-full overflow-y-auto",children:[a.jsx(je,{}),a.jsx(je,{})]}),be=!Q&&!g&&!pe,Ue=bt({tier:I,hasLiveInput:T,hasCommittedQuery:f.trim().length>0,bodyRendersCommittedResults:!0}),Ve=be?a.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[X&&a.jsx(vt,{count:X.count,onScopeToSpam:()=>L({to:"/mail/$mailboxId",params:{mailboxId:X.mailboxId},search:{q:f||void 0}})}),a.jsx("div",{className:"min-h-0 flex-1",children:a.jsx(ot,{sections:de,briefCategory:w,Row:yt,selectedThreadId:t,onSelectThread:ue,onSelectBriefCategory:q,sources:ee,sourcesNote:H>0?`+${H} muted`:void 0,onSelectSource:N,activeFilters:R,onToggleFilter:O,onClearFilters:z})})]}):Q?Ie:g?a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 py-12 text-sm text-fg-muted",children:[a.jsx(Re,{className:"size-8 text-danger"}),a.jsx("p",{children:"Couldn't load your messages"}),a.jsxs("button",{type:"button",onClick:()=>D(),className:"flex items-center gap-1 text-accent underline text-xs",children:[a.jsx(Gt,{className:"size-3.5"}),"Try again"]})]}):V.resolved?a.jsx(ns,{sync:V.syncing?{synced:V.synced,total:V.total}:void 0}):Ie;return a.jsx(rt,{hasSheet:be&&!Ue,children:a.jsx(St,{selectedMessageId:t,rows:v,onOpen:ue,onDeleteMessages:i,onSelectionVerb:A.start,wizardOpen:A.isOpen,commandsRef:r,onTriageContextChange:d,children:a.jsx(bs,{wizard:A,header:{title:"Daily brief",unreadCount:ze,footer:p?a.jsx(Ct,{}):void 0,searchFilter:$e,searchResults:se,searchLoading:Q||Pe,relatedResults:_e,relatedLoading:He,onSelectSearchResult:qe,searchResultsInBody:!0,refreshControl:Qe},rows:v,children:a.jsxs("div",{className:"flex h-full flex-col",children:[Ee.map(s=>a.jsx(ps,{accountEmail:s.email,accountId:s.accountId},s.accountId)),a.jsx("div",{className:"min-h-0 flex-1",children:Ve})]})})})})}const De=o.createContext(null);function J(){const e=o.useContext(De);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function ys({thread:e,children:t}){const n=oe(),r=Xt(),{searchInput:d}=Y(),i=e?.threadId,f=e?.messageId,{data:u}=ae({...ne(),staleTime:6e4}),h=o.useMemo(()=>u?.items??[],[u]),y=o.useMemo(()=>{if(i)return h.find(g=>g.messageId===f)??h.find(g=>g.threadId===i)},[h,i,f]),x=Ft(i,f),p=y??x,I=f??p?.messageId,A=o.useMemo(()=>{if(i)return{threadId:i,mailboxId:p?.mailboxId??"",subject:p?.subject,messageId:I,authenticity:p?.authenticity}},[i,p,I]),L=o.useCallback((g,D)=>{n({to:"/mail/brief/$threadId/$messageId",params:g,replace:D?.replace,search:M=>({...M,q:d||void 0}),hash:r})},[n,r,d]),m=o.useCallback(()=>{n({to:"/mail/brief",search:g=>g,hash:r})},[n,r]),b=o.useCallback(g=>{I&&g.includes(I)&&m()},[I,m]),N=Ce({thread:p,onAfterOptimisticRemove:b}),S=At(),{deleteMessages:C}=Nt({mailboxId:p?.mailboxId??"",messages:h,onAfterOptimisticRemove:b}),{toggleReadFor:W}=Ot({mailboxId:p?.mailboxId??"",messages:h}),E=S.focusedMessageId,j=o.useMemo(()=>h.find(g=>g.messageId===E),[h,E])??p,P=Ce({thread:j}),G=es(),T=ts(),R=ss(),w=o.useMemo(()=>as(R,i,I),[R,i,I]),O=o.useMemo(()=>{if(j)return g=>R({threadId:j.threadId,messageId:j.messageId,mode:g})},[R,j]),{nextMessageId:q,previousMessageId:z}=Bt({context:S,orderedIds:S.orderedIds,selectedMessageId:I,enabled:!G&&!T,onClose:m,handlers:{reply:()=>O?.("reply"),replyAll:()=>O?.("reply-all"),forward:()=>O?.("forward"),delete:()=>{S.listCommandsRef.current?.requestVerb("delete")||P.deleteThread()},toggleStar:P.toggleStar,toggleRead:()=>{S.listCommandsRef.current?.requestVerb("markRead")||j&&W([j.messageId],!j.isRead)},goFlagged:()=>n({to:"/mail/flagged"}),goSettings:()=>n({to:"/settings"})}}),B=o.useCallback(g=>{if(!g)return;const D=h.find(M=>M.messageId===g);return D?{threadId:D.threadId,messageId:g}:void 0},[h]),Q={selectedMessageId:I,selectedThread:p,conversation:A,onOpenThread:L,onCloseThread:m,nextThread:B(q),previousThread:B(z),actions:N,onReply:w,triage:S,onDeleteMessages:C,handleDeselectIfRemoved:b};return a.jsx(De.Provider,{value:Q,children:t})}function Le(){const{selectedMessageId:e,onOpenThread:t,triage:n,onDeleteMessages:r}=J(),{accounts:d}=Y();return a.jsx(vs,{accounts:d,selectedMessageId:e,onOpenThread:t,commandsRef:n.listCommandsRef,onTriageContextChange:n.onTriageContextChange,onDeleteMessages:r})}function Ss(){const{conversation:e,selectedThread:t,actions:n,onReply:r,handleDeselectIfRemoved:d}=J(),i=!!e,f=Et(e?.threadId);return a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[a.jsx(Pt,{hasThread:i,intelligenceOpen:f.isShowing,canToggleIntelligence:f.canToggle,onToggleIntelligence:f.toggle,onReply:r?()=>r("reply"):void 0,onReplyAll:r?()=>r("reply-all"):void 0,onForward:r?()=>r("forward"):void 0,onDelete:i?n.deleteThread:void 0,onToggleStar:i?n.toggleStar:void 0,isStarred:n.isStarred,moveContext:i&&n.accountId&&n.mailboxId?{accountId:n.accountId,currentMailboxId:n.mailboxId,onMove:n.moveThread}:void 0}),a.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?a.jsx(Me,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:f.open}):a.jsx(dt,{})})]}),a.jsx(ke,{isOpen:f.drawerOpen,onClose:f.closeDrawer,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:d})]})}function Cs(){const{selectedThread:e,handleDeselectIfRemoved:t}=J(),{onToggleIntelligence:n}=Y();return a.jsx(Lt,{onClose:n,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function js(){const{selectedThread:e,conversation:t,onOpenThread:n,onCloseThread:r,nextThread:d,previousThread:i,handleDeselectIfRemoved:f}=J(),u=Dt(t?.threadId??null);return t?a.jsxs(a.Fragment,{children:[a.jsx(Me,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:r,onOpenIntelligence:u.toggle,onSwipeNext:d?()=>n(d):void 0,onSwipePrevious:i?()=>n(i):void 0,mobileIntelligenceOpen:u.isOpen}),a.jsx(ke,{isOpen:u.isOpen,onClose:u.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:f})]}):a.jsx("div",{className:"h-full",children:a.jsx(Le,{})})}const Ds=Object.assign(ys,{List:Le,Reading:Ss,Intelligence:Cs,Phone:js});export{Ds as B};
@@ -1 +1 @@
1
- import{j as t,e as r}from"./index-BEGxV6sD.js";const d=e=>e instanceof Error?e.message:typeof e=="string"?e:typeof e=="object"&&e!==null&&"message"in e&&typeof e.message=="string"?e.message:"An unexpected error occurred",l=({title:e="Couldn't load content",error:a,onRetry:s,variant:i="block"})=>{const n=d(a);return i==="inline"?t.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[t.jsx(r,{className:"size-4 shrink-0 text-danger mt-0.5","aria-hidden":"true"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"font-medium text-danger",children:e}),t.jsx("p",{className:"text-fg-muted mt-0.5 break-words",children:n})]}),s&&t.jsx("button",{type:"button",onClick:s,className:"shrink-0 text-sm font-medium text-accent hover:underline",children:"Retry"})]}):t.jsxs("div",{role:"alert",className:"flex flex-col items-center justify-center gap-3 p-8 text-center",children:[t.jsx(r,{className:"size-8 text-danger","aria-hidden":"true"}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-danger",children:e}),t.jsx("p",{className:"text-sm text-fg-muted mt-1 break-words",children:n})]}),s&&t.jsx("button",{type:"button",onClick:s,className:"inline-flex items-center rounded-md border border-line bg-canvas px-4 py-2 text-sm font-medium hover:bg-surface-raised transition-colors",children:"Retry"})]})};export{l as E,d as f};
1
+ import{j as t,e as r}from"./index-BQTgnFU2.js";const d=e=>e instanceof Error?e.message:typeof e=="string"?e:typeof e=="object"&&e!==null&&"message"in e&&typeof e.message=="string"?e.message:"An unexpected error occurred",l=({title:e="Couldn't load content",error:a,onRetry:s,variant:i="block"})=>{const n=d(a);return i==="inline"?t.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[t.jsx(r,{className:"size-4 shrink-0 text-danger mt-0.5","aria-hidden":"true"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"font-medium text-danger",children:e}),t.jsx("p",{className:"text-fg-muted mt-0.5 break-words",children:n})]}),s&&t.jsx("button",{type:"button",onClick:s,className:"shrink-0 text-sm font-medium text-accent hover:underline",children:"Retry"})]}):t.jsxs("div",{role:"alert",className:"flex flex-col items-center justify-center gap-3 p-8 text-center",children:[t.jsx(r,{className:"size-8 text-danger","aria-hidden":"true"}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-danger",children:e}),t.jsx("p",{className:"text-sm text-fg-muted mt-1 break-words",children:n})]}),s&&t.jsx("button",{type:"button",onClick:s,className:"inline-flex items-center rounded-md border border-line bg-canvas px-4 py-2 text-sm font-medium hover:bg-surface-raised transition-colors",children:"Retry"})]})};export{l as E,d as f};
@@ -1 +1 @@
1
- import{dr as J,r,cL as X,l as H,bq as Y,aF as Z,aG as ee,j as a,m as te}from"./index-BEGxV6sD.js";import{u as se,p as ae,R as re}from"./useSearchTokenContext-Gm3tselb.js";import{H as oe,ac as ne,I as de,aw as ie,ad as le,b as ce,M as ue,ak as ge,ax as he,am as me,q as fe,L as Ie,Q as V,P as pe,N as xe,d as Te,_ as ve,$ as ye,a1 as K,a2 as W,a3 as be,a4 as Re,a5 as Ce}from"./MailListHeader-BicBoJT1.js";import{u as we,b as Se,a as je}from"./MailViewChrome-B2qYsu8W.js";import{f as Fe}from"./ErrorState-CVMn7G7v.js";import{u as Me}from"./useMediaQuery-Q90E6l1J.js";import{w as Pe}from"./wizard-selection-B1bng5Jq.js";import{o as ke,f as Oe,h as Le,p as Ae,r as Ne}from"./useMessageBodyContent-istNARxX.js";const De=()=>X({query:{starred:!0,order:"desc"}});function _(){const{data:e,isLoading:s,isError:t,error:n,refetch:m,fetchNextPage:d,hasNextPage:l,isFetchingNextPage:c}=we({queryKey:De(),queryFn:async({pageParam:I})=>{const{data:g}=await J({query:{starred:!0,order:"desc",continuationToken:I},throwOnError:!0});return g},initialPageParam:void 0,getNextPageParam:I=>I.continuationToken,staleTime:6e4});return{threads:r.useMemo(()=>(e?.pages??[]).flatMap(I=>I.items??[]),[e]),isLoading:s,isError:t,error:n,refetch:m,fetchNextPage:d,hasNextPage:l,isFetchingNextPage:c}}const Ee=e=>{const s=new Set;return e.filter(t=>s.has(t.threadId)?!1:(s.add(t.threadId),!0))},qe={unread:e=>!e.isRead,attachment:e=>e.hasAttachment===!0};function Be({rows:e,verb:s}){const{selectedIds:t,exitSelection:n}=me(),m=r.useMemo(()=>Pe(e,t),[e,t]);return a.jsx(fe,{verb:s,selection:m,selectionRestriction:"spansAccounts",onFinished:n})}function ze({selectedMessageId:e,onOpenThread:s,commandsRef:t,onTriageContextChange:n,onDeleteMessages:m}){const{searchQuery:d,resultFolderIndex:l}=H(),c=se(),M=Me(),I=Y(),[g,f]=r.useState("all"),[R,P]=r.useState(new Set),y=r.useCallback(o=>{P(h=>{const p=new Set(h);return p.has(o)?p.delete(o):p.add(o),p})},[]),C=r.useCallback(()=>{f("all"),P(new Set)},[]),{threads:k,isLoading:T,isError:O,error:q,refetch:L,fetchNextPage:Q,hasNextPage:x,isFetchingNextPage:w}=_(),{freeText:b,tokens:A}=ae(d.trim().toLowerCase(),c),u=r.useMemo(()=>{const o=Array.from(R).map(h=>qe[h]).filter(h=>h!=null);return Ee(k).map(oe).filter(h=>(g==="all"||h.category===g)&&o.every(p=>p(h))&&(!b||ne(h,b))&&de(h,A))},[k,g,R,b,A]),S=r.useCallback((o,h)=>{const p=u.find(U=>U.id===o)?.threadId;p&&s?.({threadId:p,messageId:o},h)},[u,s]),j=r.useCallback(o=>{const h=o.threadId??u.find(p=>p.id===o.id)?.threadId;h&&s?.({threadId:h,messageId:o.id})},[u,s]),B=r.useMemo(()=>ie(),[]),z=r.useMemo(()=>u.map(o=>le(o,l)),[u,l]),N=r.useMemo(()=>u.filter(o=>!o.isRead).length,[u]),D=T?"loading":O?"error":u.length===0?"empty":"ready",i=r.useCallback(()=>{const o=Z(ee());window.open(o,"_blank","noopener,noreferrer")},[]),v=ce(),F=a.jsx("div",{className:"flex h-full min-h-0 flex-col",children:a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.jsx("div",{className:"divide-y divide-line",children:u.map(o=>a.jsx(ue,{thread:o,active:o.id===e,onClick:()=>S(o.id)},o.id))}),x?a.jsx("button",{type:"button",className:"w-full py-3 text-sm text-muted hover:text-fg disabled:opacity-50",onClick:()=>Q(),disabled:w,children:w?"Loading…":"Load more"}):null]})});return a.jsx(Se,{title:"Starred",unreadCount:N,preset:B,selectedCategory:g,activeFilters:R,onSelectCategory:f,onToggleFilter:y,onClearFilters:C,searchResults:z,searchLoading:T,onSelectSearchResult:j,searchResultsInBody:!0,children:a.jsxs(ge,{selectedMessageId:e,rows:u,onOpen:S,onDeleteMessages:m,onSelectionVerb:I.start,wizardOpen:I.isOpen,commandsRef:t,onTriageContextChange:n,children:[a.jsx(je,{listTitle:"Starred",sections:[{id:"flagged",threads:u}],flatList:!0,hideHeader:!0,listState:v.searchResults?"ready":D,searchQuery:b?d:void 0,errorMessage:O?Fe(q):void 0,onRetry:()=>L(),onReportError:i,selectedThreadId:e,onSelectThread:S,isDesktop:M,selectionBar:a.jsx(he,{title:"Starred"}),listBody:v.searchResults??(D==="ready"?F:void 0)}),a.jsx(Be,{rows:u,verb:I.verb})]})})}const $=r.createContext(null);function E(){const e=r.useContext($);if(!e)throw new Error("FlaggedPane.* must be used inside <FlaggedPane>");return e}function He({thread:e,children:s}){const t=te(),n=ke(),{searchInput:m}=H(),d=e?.threadId,l=e?.messageId,{threads:c}=_(),M=r.useMemo(()=>{if(d)return c.find(i=>i.messageId===l)??c.find(i=>i.threadId===d)},[c,d,l]),I=Ie(d,l),g=M??I,f=l??g?.messageId,R=r.useMemo(()=>{if(d)return{threadId:d,mailboxId:g?.mailboxId??"",subject:g?.subject,messageId:f,authenticity:g?.authenticity}},[d,g,f]),P=r.useCallback((i,v)=>{t({to:"/mail/flagged/$threadId/$messageId",params:i,replace:v?.replace,search:F=>({...F,q:m||void 0}),hash:n})},[t,n,m]),y=r.useCallback(()=>{t({to:"/mail/flagged",search:i=>i,hash:n})},[t,n]),C=r.useCallback(i=>{f&&i.includes(f)&&y()},[f,y]),k=V({thread:g,onAfterOptimisticRemove:C}),T=pe(),{deleteMessages:O}=xe({mailboxId:g?.mailboxId??"",messages:c,onAfterOptimisticRemove:C}),{toggleReadFor:q}=Te({mailboxId:g?.mailboxId??"",messages:c}),L=T.focusedMessageId,x=r.useMemo(()=>c.find(i=>i.messageId===L),[c,L])??g,w=V({thread:x}),b=Oe(),A=Le(),u=Ae(),S=r.useMemo(()=>Ne(u,d,f),[u,d,f]),j=r.useMemo(()=>{if(x)return i=>u({threadId:x.threadId,messageId:x.messageId,mode:i})},[u,x]),{nextMessageId:B,previousMessageId:z}=ve({context:T,orderedIds:T.orderedIds,selectedMessageId:f,enabled:!b&&!A,onClose:y,handlers:{reply:()=>j?.("reply"),replyAll:()=>j?.("reply-all"),forward:()=>j?.("forward"),delete:()=>{T.listCommandsRef.current?.requestVerb("delete")||w.deleteThread()},toggleStar:w.toggleStar,toggleRead:()=>{T.listCommandsRef.current?.requestVerb("markRead")||x&&q([x.messageId],!x.isRead)},goBrief:()=>t({to:"/mail/brief"}),goSettings:()=>t({to:"/settings"})}}),N=r.useCallback(i=>{if(!i)return;const v=c.find(F=>F.messageId===i);return v?{threadId:v.threadId,messageId:i}:void 0},[c]),D={selectedMessageId:f,selectedThread:g,conversation:R,onOpenThread:P,onCloseThread:y,nextThread:N(B),previousThread:N(z),actions:k,onReply:S,triage:T,onDeleteMessages:O,handleDeselectIfRemoved:C};return a.jsx($.Provider,{value:D,children:s})}function G(){const{selectedMessageId:e,onOpenThread:s,triage:t,onDeleteMessages:n}=E();return a.jsx(ze,{selectedMessageId:e,onOpenThread:s,commandsRef:t.listCommandsRef,onTriageContextChange:t.onTriageContextChange,onDeleteMessages:n})}function Qe(){const{conversation:e,selectedThread:s,actions:t,onReply:n,handleDeselectIfRemoved:m}=E(),d=!!e,l=Re(e?.threadId);return a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[a.jsx(Ce,{hasThread:d,intelligenceOpen:l.isShowing,canToggleIntelligence:l.canToggle,onToggleIntelligence:l.toggle,onReply:n?()=>n("reply"):void 0,onReplyAll:n?()=>n("reply-all"):void 0,onForward:n?()=>n("forward"):void 0,onDelete:d?t.deleteThread:void 0,onToggleStar:d?t.toggleStar:void 0,isStarred:t.isStarred,moveContext:d&&t.accountId&&t.mailboxId?{accountId:t.accountId,currentMailboxId:t.mailboxId,onMove:t.moveThread}:void 0}),a.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?a.jsx(K,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:l.open}):a.jsx(re,{})})]}),a.jsx(W,{isOpen:l.drawerOpen,onClose:l.closeDrawer,thread:s,mailboxId:s?.mailboxId,accountId:s?.accountId,onAfterOptimisticRemove:m})]})}function Ve(){const{selectedThread:e,handleDeselectIfRemoved:s}=E(),{onToggleIntelligence:t}=H();return a.jsx(be,{onClose:t,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:s})}function Ke(){const{selectedThread:e,conversation:s,onCloseThread:t,onOpenThread:n,nextThread:m,previousThread:d,handleDeselectIfRemoved:l}=E(),c=ye(s?.threadId??null);return s?a.jsxs(a.Fragment,{children:[a.jsx(K,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,authenticity:s.authenticity,onBack:t,onOpenIntelligence:c.toggle,onSwipeNext:m?()=>n(m):void 0,onSwipePrevious:d?()=>n(d):void 0,mobileIntelligenceOpen:c.isOpen}),a.jsx(W,{isOpen:c.isOpen,onClose:c.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:l})]}):a.jsx("div",{className:"h-full",children:a.jsx(G,{})})}const Ze=Object.assign(He,{List:G,Reading:Qe,Intelligence:Ve,Phone:Ke});export{Ze as F};
1
+ import{dr as J,r,cL as X,l as H,bq as Y,aF as Z,aG as ee,j as a,m as te}from"./index-BQTgnFU2.js";import{u as se,p as ae,R as re}from"./useSearchTokenContext-C-H1Y09b.js";import{H as oe,ac as ne,I as de,aw as ie,ad as le,b as ce,M as ue,ak as ge,ax as he,am as me,q as fe,L as Ie,Q as V,P as pe,N as xe,d as Te,_ as ve,$ as ye,a1 as K,a2 as W,a3 as be,a4 as Re,a5 as Ce}from"./MailListHeader-B9vO8fqH.js";import{u as we,b as Se,a as je}from"./MailViewChrome-C7Id56Ny.js";import{f as Fe}from"./ErrorState-Ws9Z0fI_.js";import{u as Me}from"./useMediaQuery-D1S3QsF0.js";import{w as Pe}from"./wizard-selection-B1bng5Jq.js";import{o as ke,f as Oe,h as Le,p as Ae,r as Ne}from"./useMessageBodyContent-PBQCTZnz.js";const De=()=>X({query:{starred:!0,order:"desc"}});function _(){const{data:e,isLoading:s,isError:t,error:n,refetch:m,fetchNextPage:d,hasNextPage:l,isFetchingNextPage:c}=we({queryKey:De(),queryFn:async({pageParam:I})=>{const{data:g}=await J({query:{starred:!0,order:"desc",continuationToken:I},throwOnError:!0});return g},initialPageParam:void 0,getNextPageParam:I=>I.continuationToken,staleTime:6e4});return{threads:r.useMemo(()=>(e?.pages??[]).flatMap(I=>I.items??[]),[e]),isLoading:s,isError:t,error:n,refetch:m,fetchNextPage:d,hasNextPage:l,isFetchingNextPage:c}}const Ee=e=>{const s=new Set;return e.filter(t=>s.has(t.threadId)?!1:(s.add(t.threadId),!0))},qe={unread:e=>!e.isRead,attachment:e=>e.hasAttachment===!0};function Be({rows:e,verb:s}){const{selectedIds:t,exitSelection:n}=me(),m=r.useMemo(()=>Pe(e,t),[e,t]);return a.jsx(fe,{verb:s,selection:m,selectionRestriction:"spansAccounts",onFinished:n})}function ze({selectedMessageId:e,onOpenThread:s,commandsRef:t,onTriageContextChange:n,onDeleteMessages:m}){const{searchQuery:d,resultFolderIndex:l}=H(),c=se(),M=Me(),I=Y(),[g,f]=r.useState("all"),[R,P]=r.useState(new Set),y=r.useCallback(o=>{P(h=>{const p=new Set(h);return p.has(o)?p.delete(o):p.add(o),p})},[]),C=r.useCallback(()=>{f("all"),P(new Set)},[]),{threads:k,isLoading:T,isError:O,error:q,refetch:L,fetchNextPage:Q,hasNextPage:x,isFetchingNextPage:w}=_(),{freeText:b,tokens:A}=ae(d.trim().toLowerCase(),c),u=r.useMemo(()=>{const o=Array.from(R).map(h=>qe[h]).filter(h=>h!=null);return Ee(k).map(oe).filter(h=>(g==="all"||h.category===g)&&o.every(p=>p(h))&&(!b||ne(h,b))&&de(h,A))},[k,g,R,b,A]),S=r.useCallback((o,h)=>{const p=u.find(U=>U.id===o)?.threadId;p&&s?.({threadId:p,messageId:o},h)},[u,s]),j=r.useCallback(o=>{const h=o.threadId??u.find(p=>p.id===o.id)?.threadId;h&&s?.({threadId:h,messageId:o.id})},[u,s]),B=r.useMemo(()=>ie(),[]),z=r.useMemo(()=>u.map(o=>le(o,l)),[u,l]),N=r.useMemo(()=>u.filter(o=>!o.isRead).length,[u]),D=T?"loading":O?"error":u.length===0?"empty":"ready",i=r.useCallback(()=>{const o=Z(ee());window.open(o,"_blank","noopener,noreferrer")},[]),v=ce(),F=a.jsx("div",{className:"flex h-full min-h-0 flex-col",children:a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.jsx("div",{className:"divide-y divide-line",children:u.map(o=>a.jsx(ue,{thread:o,active:o.id===e,onClick:()=>S(o.id)},o.id))}),x?a.jsx("button",{type:"button",className:"w-full py-3 text-sm text-muted hover:text-fg disabled:opacity-50",onClick:()=>Q(),disabled:w,children:w?"Loading…":"Load more"}):null]})});return a.jsx(Se,{title:"Starred",unreadCount:N,preset:B,selectedCategory:g,activeFilters:R,onSelectCategory:f,onToggleFilter:y,onClearFilters:C,searchResults:z,searchLoading:T,onSelectSearchResult:j,searchResultsInBody:!0,children:a.jsxs(ge,{selectedMessageId:e,rows:u,onOpen:S,onDeleteMessages:m,onSelectionVerb:I.start,wizardOpen:I.isOpen,commandsRef:t,onTriageContextChange:n,children:[a.jsx(je,{listTitle:"Starred",sections:[{id:"flagged",threads:u}],flatList:!0,hideHeader:!0,listState:v.searchResults?"ready":D,searchQuery:b?d:void 0,errorMessage:O?Fe(q):void 0,onRetry:()=>L(),onReportError:i,selectedThreadId:e,onSelectThread:S,isDesktop:M,selectionBar:a.jsx(he,{title:"Starred"}),listBody:v.searchResults??(D==="ready"?F:void 0)}),a.jsx(Be,{rows:u,verb:I.verb})]})})}const $=r.createContext(null);function E(){const e=r.useContext($);if(!e)throw new Error("FlaggedPane.* must be used inside <FlaggedPane>");return e}function He({thread:e,children:s}){const t=te(),n=ke(),{searchInput:m}=H(),d=e?.threadId,l=e?.messageId,{threads:c}=_(),M=r.useMemo(()=>{if(d)return c.find(i=>i.messageId===l)??c.find(i=>i.threadId===d)},[c,d,l]),I=Ie(d,l),g=M??I,f=l??g?.messageId,R=r.useMemo(()=>{if(d)return{threadId:d,mailboxId:g?.mailboxId??"",subject:g?.subject,messageId:f,authenticity:g?.authenticity}},[d,g,f]),P=r.useCallback((i,v)=>{t({to:"/mail/flagged/$threadId/$messageId",params:i,replace:v?.replace,search:F=>({...F,q:m||void 0}),hash:n})},[t,n,m]),y=r.useCallback(()=>{t({to:"/mail/flagged",search:i=>i,hash:n})},[t,n]),C=r.useCallback(i=>{f&&i.includes(f)&&y()},[f,y]),k=V({thread:g,onAfterOptimisticRemove:C}),T=pe(),{deleteMessages:O}=xe({mailboxId:g?.mailboxId??"",messages:c,onAfterOptimisticRemove:C}),{toggleReadFor:q}=Te({mailboxId:g?.mailboxId??"",messages:c}),L=T.focusedMessageId,x=r.useMemo(()=>c.find(i=>i.messageId===L),[c,L])??g,w=V({thread:x}),b=Oe(),A=Le(),u=Ae(),S=r.useMemo(()=>Ne(u,d,f),[u,d,f]),j=r.useMemo(()=>{if(x)return i=>u({threadId:x.threadId,messageId:x.messageId,mode:i})},[u,x]),{nextMessageId:B,previousMessageId:z}=ve({context:T,orderedIds:T.orderedIds,selectedMessageId:f,enabled:!b&&!A,onClose:y,handlers:{reply:()=>j?.("reply"),replyAll:()=>j?.("reply-all"),forward:()=>j?.("forward"),delete:()=>{T.listCommandsRef.current?.requestVerb("delete")||w.deleteThread()},toggleStar:w.toggleStar,toggleRead:()=>{T.listCommandsRef.current?.requestVerb("markRead")||x&&q([x.messageId],!x.isRead)},goBrief:()=>t({to:"/mail/brief"}),goSettings:()=>t({to:"/settings"})}}),N=r.useCallback(i=>{if(!i)return;const v=c.find(F=>F.messageId===i);return v?{threadId:v.threadId,messageId:i}:void 0},[c]),D={selectedMessageId:f,selectedThread:g,conversation:R,onOpenThread:P,onCloseThread:y,nextThread:N(B),previousThread:N(z),actions:k,onReply:S,triage:T,onDeleteMessages:O,handleDeselectIfRemoved:C};return a.jsx($.Provider,{value:D,children:s})}function G(){const{selectedMessageId:e,onOpenThread:s,triage:t,onDeleteMessages:n}=E();return a.jsx(ze,{selectedMessageId:e,onOpenThread:s,commandsRef:t.listCommandsRef,onTriageContextChange:t.onTriageContextChange,onDeleteMessages:n})}function Qe(){const{conversation:e,selectedThread:s,actions:t,onReply:n,handleDeselectIfRemoved:m}=E(),d=!!e,l=Re(e?.threadId);return a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[a.jsx(Ce,{hasThread:d,intelligenceOpen:l.isShowing,canToggleIntelligence:l.canToggle,onToggleIntelligence:l.toggle,onReply:n?()=>n("reply"):void 0,onReplyAll:n?()=>n("reply-all"):void 0,onForward:n?()=>n("forward"):void 0,onDelete:d?t.deleteThread:void 0,onToggleStar:d?t.toggleStar:void 0,isStarred:t.isStarred,moveContext:d&&t.accountId&&t.mailboxId?{accountId:t.accountId,currentMailboxId:t.mailboxId,onMove:t.moveThread}:void 0}),a.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?a.jsx(K,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:l.open}):a.jsx(re,{})})]}),a.jsx(W,{isOpen:l.drawerOpen,onClose:l.closeDrawer,thread:s,mailboxId:s?.mailboxId,accountId:s?.accountId,onAfterOptimisticRemove:m})]})}function Ve(){const{selectedThread:e,handleDeselectIfRemoved:s}=E(),{onToggleIntelligence:t}=H();return a.jsx(be,{onClose:t,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:s})}function Ke(){const{selectedThread:e,conversation:s,onCloseThread:t,onOpenThread:n,nextThread:m,previousThread:d,handleDeselectIfRemoved:l}=E(),c=ye(s?.threadId??null);return s?a.jsxs(a.Fragment,{children:[a.jsx(K,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,authenticity:s.authenticity,onBack:t,onOpenIntelligence:c.toggle,onSwipeNext:m?()=>n(m):void 0,onSwipePrevious:d?()=>n(d):void 0,mobileIntelligenceOpen:c.isOpen}),a.jsx(W,{isOpen:c.isOpen,onClose:c.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:l})]}):a.jsx("div",{className:"h-full",children:a.jsx(G,{})})}const Ze=Object.assign(He,{List:G,Reading:Qe,Intelligence:Ve,Phone:Ke});export{Ze as F};
@@ -1 +1 @@
1
- import{r as n,s as f,Q as m,j as e,X as N}from"./index-BEGxV6sD.js";import{E as u}from"./ErrorState-CVMn7G7v.js";import{D as r,C as x,u as k}from"./index-t0zHcrCE.js";import{u as w}from"./useMediaQuery-Q90E6l1J.js";import{k as p,s as h,t as C}from"./useMessageBodyContent-istNARxX.js";import{C as E}from"./confirm-dialog--58F53XC.js";const b=t=>t?"Draft":"New Message",I=()=>{const t=n.useRef(!1);return n.useCallback(()=>{const s=document.querySelector("[data-subject-field]")?.value??"",o=(document.querySelector('[data-testid="compose-body"]')?.textContent??"").replace(/--\s*/g,"").trim();return t.current=s.trim().length>0||o.length>0,t.current},[])},S=()=>{const t=p(),i=h(),s=C(),a=I(),[l,o]=n.useState(!1),{isError:d,error:c,refetch:g}=f({...m(),staleTime:1/0}),j=n.useCallback(D=>{D||(a()?o(!0):s())},[s,a]),y=n.useCallback(()=>{o(!1),s()},[s]),v=n.useCallback(()=>{o(!1)},[]);return e.jsxs(r.Root,{open:!0,onOpenChange:j,children:[e.jsxs(r.Portal,{children:[e.jsx(r.Overlay,{className:"fixed inset-0 z-40 bg-black/40"}),e.jsxs(r.Content,{className:"fixed inset-x-0 bottom-0 z-50 flex flex-col rounded-t-lg bg-canvas pb-[env(safe-area-inset-bottom,0px)]",style:{height:"95dvh"},children:[e.jsx(r.Handle,{className:"mx-auto mt-2 mb-1 h-1.5 w-12 rounded-full bg-fg-muted/30"}),e.jsx(r.Title,{className:"px-4 py-2 text-base font-semibold border-b border-line",children:b(t)}),d?e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(u,{title:"Couldn't load compose",error:c,onRetry:()=>{g()}})}):e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(x,{mode:"new",outboxMessageId:t,onDraftCreated:i,onClose:s})})]})]}),e.jsx(E,{isOpen:l,title:"Discard draft?",description:"Your message has unsaved content. Are you sure you want to discard it?",confirmLabel:"Discard",cancelLabel:"Keep editing",destructive:!0,onConfirm:y,onCancel:v})]})},q=()=>{const t=p(),i=h(),s=C(),a=w(),{isError:l,error:o,refetch:d}=f({...m(),staleTime:1/0});if(k({bindings:[{key:"Escape",handler:s,preventDefault:!0}]}),!a)return e.jsx(S,{});const c=e.jsxs("header",{className:"flex items-center justify-between gap-2 px-4 py-3 border-b border-line shrink-0",children:[e.jsx("div",{className:"flex items-center gap-2 min-w-0",children:e.jsx("h2",{className:"text-lg font-semibold truncate",children:b(t)})}),e.jsx("button",{type:"button",onClick:s,className:"p-2 rounded-md hover:bg-surface-raised transition-colors min-h-11 min-w-11 inline-flex items-center justify-center","aria-label":"Close",children:e.jsx(N,{className:"size-5"})})]});return l?e.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[c,e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(u,{title:"Couldn't load compose",error:o,onRetry:()=>{d()}})})]}):e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-canvas",children:[c,e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(x,{mode:"new",outboxMessageId:t,onDraftCreated:i,onClose:s})})]})};export{q as F};
1
+ import{r as n,s as f,Q as m,j as e,X as N}from"./index-BQTgnFU2.js";import{E as u}from"./ErrorState-Ws9Z0fI_.js";import{D as r,C as x,u as k}from"./index-C4YPHP48.js";import{u as w}from"./useMediaQuery-D1S3QsF0.js";import{k as p,s as h,t as C}from"./useMessageBodyContent-PBQCTZnz.js";import{C as E}from"./confirm-dialog-007Povhq.js";const b=t=>t?"Draft":"New Message",I=()=>{const t=n.useRef(!1);return n.useCallback(()=>{const s=document.querySelector("[data-subject-field]")?.value??"",o=(document.querySelector('[data-testid="compose-body"]')?.textContent??"").replace(/--\s*/g,"").trim();return t.current=s.trim().length>0||o.length>0,t.current},[])},S=()=>{const t=p(),i=h(),s=C(),a=I(),[l,o]=n.useState(!1),{isError:d,error:c,refetch:g}=f({...m(),staleTime:1/0}),j=n.useCallback(D=>{D||(a()?o(!0):s())},[s,a]),y=n.useCallback(()=>{o(!1),s()},[s]),v=n.useCallback(()=>{o(!1)},[]);return e.jsxs(r.Root,{open:!0,onOpenChange:j,children:[e.jsxs(r.Portal,{children:[e.jsx(r.Overlay,{className:"fixed inset-0 z-40 bg-black/40"}),e.jsxs(r.Content,{className:"fixed inset-x-0 bottom-0 z-50 flex flex-col rounded-t-lg bg-canvas pb-[env(safe-area-inset-bottom,0px)]",style:{height:"95dvh"},children:[e.jsx(r.Handle,{className:"mx-auto mt-2 mb-1 h-1.5 w-12 rounded-full bg-fg-muted/30"}),e.jsx(r.Title,{className:"px-4 py-2 text-base font-semibold border-b border-line",children:b(t)}),d?e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(u,{title:"Couldn't load compose",error:c,onRetry:()=>{g()}})}):e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(x,{mode:"new",outboxMessageId:t,onDraftCreated:i,onClose:s})})]})]}),e.jsx(E,{isOpen:l,title:"Discard draft?",description:"Your message has unsaved content. Are you sure you want to discard it?",confirmLabel:"Discard",cancelLabel:"Keep editing",destructive:!0,onConfirm:y,onCancel:v})]})},q=()=>{const t=p(),i=h(),s=C(),a=w(),{isError:l,error:o,refetch:d}=f({...m(),staleTime:1/0});if(k({bindings:[{key:"Escape",handler:s,preventDefault:!0}]}),!a)return e.jsx(S,{});const c=e.jsxs("header",{className:"flex items-center justify-between gap-2 px-4 py-3 border-b border-line shrink-0",children:[e.jsx("div",{className:"flex items-center gap-2 min-w-0",children:e.jsx("h2",{className:"text-lg font-semibold truncate",children:b(t)})}),e.jsx("button",{type:"button",onClick:s,className:"p-2 rounded-md hover:bg-surface-raised transition-colors min-h-11 min-w-11 inline-flex items-center justify-center","aria-label":"Close",children:e.jsx(N,{className:"size-5"})})]});return l?e.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[c,e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(u,{title:"Couldn't load compose",error:o,onRetry:()=>{d()}})})]}):e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-canvas",children:[c,e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(x,{mode:"new",outboxMessageId:t,onDraftCreated:i,onClose:s})})]})};export{q as F};