@remit/web-client-dist 0.0.347 → 0.0.349
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.
- package/assets/BriefPane-BfuwvROx.js +1 -0
- package/assets/{ErrorState-DUgckKDx.js → ErrorState-DlHdbl1h.js} +1 -1
- package/assets/FlaggedPane-DXXvbNMD.js +1 -0
- package/assets/MailListHeader-BFBjOnAW.js +52 -0
- package/assets/{MailViewChrome-CChh5YGY.js → MailViewChrome-XjLFqRLL.js} +1 -1
- package/assets/MailboxPane-BwHG9r2e.js +1 -0
- package/assets/{NavMenuButton-BhD3j6Q3.js → NavMenuButton-D_W6DXrb.js} +1 -1
- package/assets/{OnboardingWizard-I51NAOI2.js → OnboardingWizard-D8Zk-VXt.js} +1 -1
- package/assets/OutboxPane-D2d4W5AT.js +1 -0
- package/assets/_mailboxId-DstK-xUR.js +1 -0
- package/assets/_messageId-CLaETLs-.js +1 -0
- package/assets/_messageId-DRTBuwn5.js +1 -0
- package/assets/_messageId-DmZCgc4u.js +1 -0
- package/assets/_outboxMessageId-DSVc6DQy.js +1 -0
- package/assets/_threadId-DiPJwQ2o.js +1 -0
- package/assets/_threadId-Djs3CNia.js +1 -0
- package/assets/_threadId-DtfbogPc.js +1 -0
- package/assets/{account-form-helpers-C48ralIn.js → account-form-helpers-CwJTqJha.js} +1 -1
- package/assets/{accounts-B0CbtGL3.js → accounts-sOzFT-mC.js} +1 -1
- package/assets/{advanced-sLyRwcIz.js → advanced-MP09rSMr.js} +1 -1
- package/assets/{appearance-BR1x2-tj.js → appearance-DHJRN3ld.js} +1 -1
- package/assets/{avatar-DIgxxjJo.js → avatar-D3R75Qgk.js} +1 -1
- package/assets/{bottom-sheet-BChq8GeA.js → bottom-sheet-BKnsFMEf.js} +1 -1
- package/assets/brief-C5lHNp6b.js +1 -0
- package/assets/{brief-C209zbh0.js → brief-DqILJyQz.js} +1 -1
- package/assets/{browser-ponyfill-DFNFNEmG.js → browser-ponyfill-CTm-DR6u.js} +1 -1
- package/assets/{bug-CARa4BW2.js → bug-C2LRkTHS.js} +1 -1
- package/assets/{circle-check-KZs1xW98.js → circle-check-C1n1yijO.js} +1 -1
- package/assets/{circle-check-big-B_JaD3Sd.js → circle-check-big-BmnT3rLr.js} +1 -1
- package/assets/{circle-help-CYbymNEq.js → circle-help-BJLBqOAA.js} +1 -1
- package/assets/{clock-B4cFFCTA.js → clock-BNqM2h_T.js} +1 -1
- package/assets/{confirm-dialog-CJ9HhvTw.js → confirm-dialog-C1Q_9oNl.js} +1 -1
- package/assets/{download-BzZgIdQm.js → download-aqyrBjOU.js} +1 -1
- package/assets/{filters-ZLAyhjl9.js → filters-y-tc_bzr.js} +1 -1
- package/assets/{flagged-Dp5r6hZL.js → flagged-D6yLzY2X.js} +1 -1
- package/assets/flagged-DsEl2-dg.js +1 -0
- package/assets/{folders-CtmAeP3l.js → folders-KxXDRobS.js} +1 -1
- package/assets/index-Bmrb3uML.js +1 -0
- package/assets/index-C8bsgH_w.js +1 -0
- package/assets/index-CcuWjbLO.js +1 -0
- package/assets/index-Cf7AKvjm.js +1 -0
- package/assets/{index-Dz5Qyak4.js → index-DKG1l4OE.js} +4 -4
- package/assets/index-DRTBuwn5.js +1 -0
- package/assets/index-DhwJT0Xk.js +1 -0
- package/assets/index-DmZCgc4u.js +1 -0
- package/assets/index-WhbhbXhS.js +1 -0
- package/assets/{kbd-Bvbu8R4A.js → kbd-CnUDSPH5.js} +1 -1
- package/assets/{labels-CidmMOEG.js → labels-BmRFi78i.js} +1 -1
- package/assets/mail-CK2ZaY0m.js +1 -0
- package/assets/{menu-BtgYxp2K.js → menu-DdqPoHXZ.js} +1 -1
- package/assets/{move-options-vvEZxrXg.js → move-options-DXhjey10.js} +1 -1
- package/assets/nav-link-BTQmJNls.js +1 -0
- package/assets/{onboarding-DHZfVOmW.js → onboarding-AkJlSpsK.js} +1 -1
- package/assets/outbox-CYHiwpl8.js +1 -0
- package/assets/{pencil-Bx0MbZnz.js → pencil-DFHNbAYX.js} +1 -1
- package/assets/{rich-text-Dltfnun1.js → rich-text-CBLH_ljE.js} +2 -2
- package/assets/{rich-text-spellcheck-worker-provider-gpL_e8Lc.js → rich-text-spellcheck-worker-provider-8XL6BOiI.js} +1 -1
- package/assets/{rotate-ccw-h15XAO1t.js → rotate-ccw-CYszpTkF.js} +1 -1
- package/assets/{row-actions-CmfExpmx.js → row-actions-DjIKrPVk.js} +1 -1
- package/assets/search-token-index-D13ogntK.js +1 -0
- package/assets/{search-view-Ddk04xwo.js → search-view-B5prVpGW.js} +1 -1
- package/assets/{senders-BZcm5VQi.js → senders-BFXe7Id6.js} +1 -1
- package/assets/settings-DSF3NSGu.js +1 -0
- package/assets/{settings-screen-BtPxdO6Y.js → settings-screen-BgOpI_Lx.js} +1 -1
- package/assets/{shield-check-VtnsP_QR.js → shield-check-BBp9gzDX.js} +1 -1
- package/assets/{suggested-vips-5wKl0blM.js → suggested-vips-DFwiEmrP.js} +1 -1
- package/assets/{use-match-media-BSj_MlsI.js → use-match-media-C1DFe6n_.js} +1 -1
- package/assets/{useDebouncedValue-CW8js2xx.js → useDebouncedValue-BazHTAhQ.js} +1 -1
- package/assets/{useFilters-YnuG5yKw.js → useFilters-DBElfc_V.js} +1 -1
- package/assets/{useLabels-DR8CZ_pi.js → useLabels-CZdQ7rFS.js} +1 -1
- package/assets/{useRefreshControl-B4VEe-8O.js → useRefreshControl-DN40VgNE.js} +1 -1
- package/assets/useSearchMirror-CiaVi7jg.js +1 -0
- package/assets/{useSearchTokenContext-4dsgVPv9.js → useSearchTokenContext-BNRIlJev.js} +1 -1
- package/assets/useSemanticSearch-BHpjDfP4.js +1 -0
- package/assets/{useSignature-Cgb8x2A1.js → useSignature-BaYkV0lH.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/BriefPane-Cv6V98kK.js +0 -1
- package/assets/FlaggedPane-B1ZaTYX6.js +0 -1
- package/assets/MailListHeader-CjWw8PVT.js +0 -52
- package/assets/MailboxPane-CX39NKSW.js +0 -1
- package/assets/OutboxPane-D644CAzB.js +0 -1
- package/assets/_mailboxId-BgTWwASF.js +0 -1
- package/assets/_messageId-BzMiohkw.js +0 -1
- package/assets/_messageId-D3kom_w5.js +0 -1
- package/assets/_messageId-DikeY30y.js +0 -1
- package/assets/_outboxMessageId-CHoGc8o1.js +0 -1
- package/assets/_threadId-BxknsMEz.js +0 -1
- package/assets/_threadId-C4ggczjA.js +0 -1
- package/assets/_threadId-COZYPHyV.js +0 -1
- package/assets/brief-CRRHnwLW.js +0 -1
- package/assets/flagged-CL3DI6wM.js +0 -1
- package/assets/index--WOliKqi.js +0 -1
- package/assets/index-BzMiohkw.js +0 -1
- package/assets/index-ChN8WSHb.js +0 -1
- package/assets/index-D3kom_w5.js +0 -1
- package/assets/index-DM8qsDHp.js +0 -1
- package/assets/index-Dy2broY0.js +0 -1
- package/assets/index-FdIYPgjj.js +0 -1
- package/assets/index-QN16iBGo.js +0 -1
- package/assets/intelligence-pref-C6lFpj6U.js +0 -1
- package/assets/mail-CK0mlH09.js +0 -1
- package/assets/nav-link-DyM-GREt.js +0 -1
- package/assets/outbox-DAJ4ANF8.js +0 -1
- package/assets/search-scope-5OC8b_q5.js +0 -1
- package/assets/search-token-index-Cp2XNfYr.js +0 -1
- package/assets/settings-NrN2M0OL.js +0 -1
- package/assets/useSearchMirror-wZyUq8Ug.js +0 -1
- package/assets/useSemanticSearch-2KSWUDT_.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r,bf as Rs,aA as _t,B as fe,S as Es,b as Be,aB as Xt,r as l,C as Os,d as As,b0 as Ns,k as vt,x as tt,Z as Zt,X as zs,p as st,s as Lt,y as Ds,af as Pt,bg as es,bh as ts,I as Fs,h as _s,T as Ls,bi as Ps,bj as $s,bk as Bs,ad as ss,aN as Ws,aO as Ks,K as Vs,g as qs,a2 as $t,bl as Hs,Q as Us,w as Qs,bm as Js,o as ns,bn as Gs,H as Ys,ag as Xs,i as Zs,bo as en,b5 as tn}from"./index-Dz5Qyak4.js";import{u as sn,p as nn,R as on}from"./useSearchTokenContext-4dsgVPv9.js";import{u as rn,a as an,R as ln}from"./useRefreshControl-B4VEe-8O.js";import{C as os,D as Pe,a as is,b as rs,c as as,j as cn,M as dn,t as ls,d as un,e as hn,f as cs,g as ds,h as fn,i as mn,k as gn,l as pn,m as qt,n as xn,o as bn,p as vn,q as Sn,r as yn,S as Cn,s as In,v as wn,w as jn,x as us,y as kn,z as Mn,A as Tn,B as Rn,E as En,F as On,G as An,H as Nn,I as zn,J as Dn,K as Fn,L as Ht,N as Ut,O as _n,P as Ln,Q as Pn,R as $n,T as Bn,U as Wn,V as Kn,W as Vn,X as qn,Y as Hn,Z as Un,_ as hs,$ as fs,a0 as Bt,a1 as Qn,a2 as ms,a3 as Jn,a4 as Gn}from"./MailListHeader-CjWw8PVT.js";import{S as Yn,M as Xn,a as Zn,u as eo,b as to}from"./MailViewChrome-CChh5YGY.js";import{E as gs,f as so}from"./ErrorState-DUgckKDx.js";import{d as ps}from"./useFilters-YnuG5yKw.js";import{C as xs}from"./confirm-dialog-CJ9HhvTw.js";import{A as Wt}from"./avatar-DIgxxjJo.js";import{b as nt,c as no,d as oo}from"./format-De9HZKjg.js";import{N as io}from"./NavMenuButton-BhD3j6Q3.js";import{a as ro}from"./useLabels-DR8CZ_pi.js";import{L as ao,u as lo}from"./useSemanticSearch-2KSWUDT_.js";import{u as co,D as uo}from"./use-match-media-BSj_MlsI.js";import{S as St}from"./shield-check-VtnsP_QR.js";import{B as ho}from"./bottom-sheet-BChq8GeA.js";import{C as fo}from"./circle-help-CYbymNEq.js";import{C as mo}from"./circle-check-KZs1xW98.js";import{a as go,b as po,f as xo}from"./move-options-vvEZxrXg.js";import{d as bs,h as bo,j as vo,e as So}from"./search-token-index-Cp2XNfYr.js";import{M as yo}from"./enums-CCxx0t2v.js";import{r as Co}from"./intelligence-pref-C6lFpj6U.js";import{n as Io}from"./search-query-Cr_ZXBCp.js";const wo=({children:e,onRefresh:n,isRefreshing:t})=>co(uo)?e:r.jsx(Rs,{onRefresh:n,isPullable:!t,children:e}),jo=e=>e===1?"message":"messages";function ko({count:e,onReview:n,onDismiss:t,actionLabel:s="Review & rescue"}){return r.jsx(_t,{tone:"info",variant:"soft",onDismiss:t,children:r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs("p",{className:"flex items-start gap-2 text-sm text-fg",children:[r.jsx(St,{className:"mt-0.5 size-4 shrink-0 text-positive","aria-hidden":!0}),r.jsxs("span",{children:[r.jsx("span",{className:"font-semibold text-fg",children:`${e} ${jo(e)} here`})," ","may not be spam — they're from senders we can verify."]})]}),r.jsx(fe,{variant:"primary",size:"sm",onClick:n,className:"self-start",children:s})]})})}const Mo=(e,n)=>e==="vip"?"vip":e==="unknown"&&n==="md"?"unknown-pill":"hidden",vs=({senderTrust:e,size:n="sm",className:t})=>{const s=Mo(e,n);return s==="vip"?r.jsx(Es,{className:Be("text-warning shrink-0",n==="sm"&&"size-3.5",n==="md"&&"size-4",t),"aria-label":"VIP sender","data-testid":"sender-trust-vip"}):s==="unknown-pill"?r.jsx("span",{className:Be("inline-flex items-center rounded border border-dashed border-fg-subtle/40 font-medium uppercase tracking-wide text-fg-muted/80 shrink-0","px-2 py-0.5 text-xs",t),title:"First message from this sender","aria-label":"First message from this sender","data-testid":"sender-trust-unknown",children:"new"}):null};function To({candidate:e,selected:n,onToggle:t,hideSender:s=!1}){const{senderName:o,senderAddress:i,subject:c,snippet:a,trustReason:d,trustSubReason:u,senderTrust:f}=e;return r.jsxs("label",{className:Be("flex w-full cursor-pointer items-start gap-3 px-3 py-2.5 text-left transition-colors",s&&"pl-11",n?"bg-positive/10":"bg-surface hover:bg-surface-sunken"),children:[r.jsx(os,{className:"mt-0.5",checked:n,onChange:t,"aria-label":`${n?"Deselect":"Select"} ${s?c:`message from ${o}`}`}),!s&&r.jsx(Wt,{name:o,email:i,size:"sm"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[!s&&r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"truncate text-sm font-medium text-fg",children:o}),f&&r.jsx(vs,{senderTrust:f,size:"sm"}),r.jsx("span",{className:"truncate text-2xs text-fg-subtle",children:i})]}),r.jsx("span",{className:"block truncate text-sm text-fg-muted",children:c}),r.jsx("span",{className:"block line-clamp-1 text-xs text-fg-subtle",children:a}),!s&&r.jsxs("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:[r.jsxs(Xt,{tone:"positive",children:[r.jsx(St,{className:"size-3","aria-hidden":!0}),d]}),r.jsx("span",{className:"text-2xs text-fg-subtle",children:u})]})]})]})}const Ro=e=>{const n=new Map,t=[];for(const s of e){const o=(s.senderAddress||s.senderName).toLowerCase(),i=n.get(o);if(i){i.messages.push(s);continue}n.set(o,{key:o,senderName:s.senderName,senderAddress:s.senderAddress,trustReason:s.trustReason,trustSubReason:s.trustSubReason,senderTrust:s.senderTrust,messages:[s]}),t.push(o)}return t.map(s=>n.get(s)).sort((s,o)=>o.messages.length-s.messages.length)},Eo=(e,n)=>{const t=e.messages.filter(s=>n.has(s.id)).length;return t===0?"none":t===e.messages.length?"all":"some"},Qt=e=>e===1?"message":"messages";function Oo({group:e,selected:n,onToggleGroup:t,onToggleMessage:s}){const[o,i]=l.useState(!1),c=Eo(e,n),a=e.messages.length,d=o?Os:As;return r.jsxs("div",{className:Be(c!=="none"?"bg-positive/10":"bg-surface"),children:[r.jsxs("div",{className:"flex w-full items-start gap-3 px-3 py-2.5",children:[r.jsx(os,{className:"mt-0.5",checked:c==="all",indeterminate:c==="some",onChange:()=>t(e,c!=="all"),"aria-label":`${c==="all"?"Deselect":"Select"} all ${a} ${Qt(a)} from ${e.senderName}`}),r.jsx(Wt,{name:e.senderName,email:e.senderAddress,size:"sm"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"truncate text-sm font-medium text-fg",children:e.senderName}),e.senderTrust&&r.jsx(vs,{senderTrust:e.senderTrust,size:"sm"}),r.jsx("span",{className:"truncate text-2xs text-fg-subtle",children:e.senderAddress})]}),r.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:[r.jsxs(Xt,{tone:"positive",children:[r.jsx(St,{className:"size-3","aria-hidden":!0}),e.trustReason]}),r.jsx("span",{className:"text-2xs text-fg-subtle",children:e.trustSubReason})]})]}),r.jsxs("button",{type:"button",onClick:()=>i(u=>!u),"aria-expanded":o,className:"flex shrink-0 items-center gap-1 rounded-md px-1.5 py-1 text-2xs text-fg-muted transition-colors hover:bg-surface-sunken hover:text-fg",children:[`${a} ${Qt(a)}`,r.jsx(d,{className:"size-3.5","aria-hidden":!0})]})]}),o&&r.jsx("div",{className:"divide-y divide-line border-t border-line",children:e.messages.map(u=>r.jsx(To,{candidate:u,selected:n.has(u.id),onToggle:()=>s(u.id),hideSender:!0},u.id))})]})}const Kt=e=>e===1?"message":"messages",Ao=(e,n)=>`Moves ${e===1?"this message":`these ${e} ${Kt(e)}`} out of Spam to ${n} now. Nothing later.`,Ft=(e,n)=>e.find(t=>t.id===n)?.label??"Inbox";function No(){return r.jsx(_t,{tone:"info",variant:"soft",children:r.jsx("p",{className:"text-2xs text-fg-muted",children:"We list a message here only when we can confirm the sender is who they say — usually someone you've emailed before, write to often, or a service that consistently checks out. We never guess from words in the subject. Anything we can't confirm stays in Spam."})})}function zo({candidates:e,selected:n,onToggle:t,onToggleGroup:s,onSelectAll:o,onSelectNone:i,onContinue:c,onCancel:a}){const[d,u]=l.useState(!1),f=n.size,g=l.useMemo(()=>Ro(e),[e]);return r.jsxs("div",{className:"flex min-h-0 flex-col",children:[r.jsxs("div",{className:"px-row-inset pb-2 pt-1",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("h2",{className:"flex items-center gap-2 text-sm font-semibold text-fg",children:[r.jsx(St,{className:"size-4 text-positive","aria-hidden":!0}),"Rescue from Spam"]}),r.jsx(fe,{variant:"ghost",size:"sm",icon:r.jsx(fo,{className:"size-3.5"}),onClick:()=>u(m=>!m),className:"-mr-1.5 -mt-0.5",children:"Why these?"})]}),r.jsx("p",{className:"mt-1 text-2xs text-fg-subtle",children:"These look safe — from senders we can verify. Uncheck any sender that belongs in Spam, or open a sender to pick individual messages."}),d&&r.jsx("div",{className:"mt-2",children:r.jsx(No,{})})]}),r.jsxs("div",{className:"flex items-center justify-between px-row-inset pb-1.5",children:[r.jsx("span",{className:"text-2xs font-medium text-fg-muted",children:`${f} of ${e.length} selected · ${g.length} ${g.length===1?"sender":"senders"}`}),r.jsxs("span",{className:"flex gap-1",children:[r.jsx(fe,{variant:"ghost",size:"sm",onClick:o,children:"Select all"}),r.jsx(fe,{variant:"ghost",size:"sm",onClick:i,children:"Select none"})]})]}),r.jsx("div",{className:"min-h-0 flex-1 divide-y divide-line overflow-y-auto border-y border-line",children:g.map(m=>r.jsx(Oo,{group:m,selected:n,onToggleGroup:s,onToggleMessage:t},m.key))}),r.jsxs("div",{className:"space-y-2 border-t border-line bg-surface px-row-inset py-3",children:[r.jsx(fe,{variant:"primary",onClick:c,className:"h-11 w-full font-semibold",children:`Continue with ${f} ${Kt(f)}`}),r.jsx(fe,{variant:"ghost",onClick:a,className:"h-11 w-full",children:"Cancel"})]})]})}function Do({count:e,folders:n,delimiter:t,destination:s,onPick:o,onMove:i,onBack:c}){const[a,d]=l.useState(!1);return r.jsxs("div",{className:"flex min-h-0 flex-col",children:[r.jsxs("div",{className:"px-row-inset pb-2 pt-1",children:[r.jsx("h2",{className:"text-sm font-semibold text-fg",children:"Where should they go?"}),r.jsx("p",{className:"mt-1 text-2xs text-fg-subtle",children:"Pick a folder, then we move them out of Spam."})]}),r.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto px-row-inset py-2",children:a?r.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden rounded-xl border border-line bg-surface",children:r.jsx(Ns,{folders:n,selectedId:s,delimiter:t,onSelect:o,onCancel:()=>d(!1)})}):r.jsxs("div",{className:"rounded-xl border border-line bg-surface-sunken p-3",children:[r.jsx("p",{className:"text-2xs text-fg-subtle",children:"Destination"}),r.jsx("p",{className:"mt-0.5 text-sm font-medium text-fg",children:Ft(n,s)}),r.jsx(fe,{variant:"ghost",size:"sm",onClick:()=>d(!0),className:"mt-2 px-0",children:"Move to a different folder"})]})}),r.jsxs("div",{className:"space-y-2 border-t border-line bg-surface px-row-inset py-3",children:[r.jsx("p",{className:"text-2xs text-fg-subtle",children:Ao(e,Ft(n,s))}),r.jsx(fe,{variant:"primary",onClick:i,className:"h-11 w-full font-semibold",children:`Move ${e} out of Spam`}),r.jsx(fe,{variant:"ghost",onClick:c,className:"h-11 w-full",children:"Back"})]})]})}function Fo({count:e,destinationLabel:n,onClose:t}){return r.jsxs("div",{className:"flex min-h-0 flex-col",children:[r.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 px-row-inset py-10 text-center",children:[r.jsx(mo,{className:"size-10 text-positive","aria-hidden":!0}),r.jsx("p",{className:"text-base font-semibold text-fg",children:`Moved ${e} ${Kt(e)} out of Spam.`}),r.jsx("p",{className:"text-2xs text-fg-subtle",children:`You'll find them in ${n}.`})]}),r.jsx("div",{className:"border-t border-line bg-surface px-row-inset py-3",children:r.jsx(fe,{variant:"primary",onClick:t,className:"h-11 w-full font-semibold",children:"Done"})})]})}function _o({open:e,candidates:n,defaultDestinationId:t,availableFolders:s,delimiter:o,onConfirmMove:i,onCancel:c}){const[a,d]=l.useState("review"),[u,f]=l.useState(()=>e?new Set(n.map(I=>I.id)):new Set),[g,m]=l.useState(t),[S,C]=l.useState(0),j=l.useRef(!1);l.useEffect(()=>{e&&!j.current&&(d("review"),f(new Set(n.map(I=>I.id))),m(t),C(0)),j.current=e},[e,n,t]);const T=u.size,x=I=>{f(k=>{const R=new Set(k);return R.has(I)?R.delete(I):R.add(I),R})},b=(I,k)=>{f(R=>{const E=new Set(R);for(const _ of I.messages)k?E.add(_.id):E.delete(_.id);return E})},y=()=>{const I=Array.from(u);C(I.length),i(I,g),d("done")};return r.jsxs(ho,{open:e,onClose:c,dismissLabel:"Close rescue",children:[a==="review"&&r.jsx(zo,{candidates:n,selected:u,onToggle:x,onToggleGroup:b,onSelectAll:()=>f(new Set(n.map(I=>I.id))),onSelectNone:()=>f(new Set),onContinue:()=>d("destination"),onCancel:c}),a==="destination"&&r.jsx(Do,{count:T,folders:s,delimiter:o,destination:g,onPick:m,onMove:y,onBack:()=>d("review")}),a==="done"&&r.jsx(Fo,{count:S,destinationLabel:Ft(s,g),onClose:c})]})}const Lo={reply:"Reply",reply_all:"Reply All",forward:"Forward",new:"New Message"},Po=()=>{const e=l.useRef(!1);return l.useCallback(()=>{const t=document.querySelector("[data-subject-field]")?.value??"",i=(document.querySelector('[data-testid="compose-body"]')?.textContent??"").replace(/--\s*/g,"").trim();return e.current=t.trim().length>0||i.length>0,e.current},[])},$o=()=>{const{state:e,closeCompose:n}=vt(),t=Po(),[s,o]=l.useState(!1),{isError:i,error:c,refetch:a}=tt({...Zt(),staleTime:1/0}),d=l.useCallback(m=>{m||(t()?o(!0):n())},[n,t]),u=l.useCallback(()=>{o(!1),n()},[n]),f=l.useCallback(()=>{o(!1)},[]);if(!e.isOpen)return null;const g=Lo[e.mode]??"New Message";return r.jsxs(Pe.Root,{open:e.isOpen,onOpenChange:d,children:[r.jsxs(Pe.Portal,{children:[r.jsx(Pe.Overlay,{className:"fixed inset-0 z-40 bg-black/40"}),r.jsxs(Pe.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:[r.jsx(Pe.Handle,{className:"mx-auto mt-2 mb-1 h-1.5 w-12 rounded-full bg-fg-muted/30"}),r.jsx(Pe.Title,{className:"px-4 py-2 text-base font-semibold border-b border-line",children:g}),i?r.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:r.jsx(gs,{title:"Couldn't load compose",error:c,onRetry:()=>{a()}})}):r.jsx("div",{className:"flex-1 overflow-hidden",children:r.jsx(is,{mode:e.mode,account:e.account,sourceMessage:e.sourceMessage,onClose:n})})]})]}),r.jsx(xs,{isOpen:s,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:u,onCancel:f})]})},Bo={reply:"Reply",reply_all:"Reply All",forward:"Forward",new:"New Message"},Ss=()=>{const{state:e,closeCompose:n}=vt(),t=ps(),{isError:s,error:o,refetch:i}=tt({...Zt(),staleTime:1/0});if(!t)return r.jsx($o,{});if(!e.isOpen)return null;const c=Bo[e.mode]??"New Message",a=r.jsxs("header",{className:"flex items-center justify-between gap-2 px-4 py-3 border-b border-line shrink-0",children:[r.jsx("div",{className:"flex items-center gap-2 min-w-0",children:r.jsx("h2",{className:"text-lg font-semibold truncate",children:c})}),r.jsx("button",{type:"button",onClick:n,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:r.jsx(zs,{className:"size-5"})})]});return s?r.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[a,r.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:r.jsx(gs,{title:"Couldn't load compose",error:o,onRetry:()=>{i()}})})]}):r.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-canvas",children:[a,r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:r.jsx(is,{mode:e.mode,account:e.account,sourceMessage:e.sourceMessage,onClose:n},e.outboxMessageId??"new")})]})};function Wo(e){const n=e.toAddresses.join(", ");return{id:e.outboxMessageId,accountId:e.accountId,fromName:e.fromName??e.fromAddress??"Me",fromEmail:e.fromAddress??"",subject:e.subject??"(No subject)",snippet:n?`To: ${n}`:"(No recipients)",timeLabel:nt(e.updatedAt),isRead:!0}}function Ko(e){return{id:e.messageId,accountId:e.accountId,fromName:e.fromName??e.fromEmail??"Unknown",fromEmail:e.fromEmail??"",subject:e.subject??"(No subject)",snippet:e.snippet??"",timeLabel:nt(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0}}function Vo({outboxMessages:e,accountId:n,imapThreads:t}){const s=e.filter(c=>c.status==="draft"&&c.accountId===n).map(Wo),o=t.map(Ko),i=[];return s.length>0&&i.push({id:"remit-drafts",label:"Not yet sent (Remit)",threads:s}),o.length>0&&i.push({id:"imap-drafts",label:"On the server",threads:o}),i}const qo=({label:e,count:n})=>r.jsxs("div",{className:"sticky top-0 z-10 flex items-baseline justify-between border-b border-line bg-surface-sunken px-row-inset py-1",children:[r.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:e}),r.jsx("span",{className:"text-2xs text-fg-subtle tabular-nums",children:n})]}),Ho=({row:e,isSelected:n,onOpen:t,onDelete:s,isDeleting:o})=>r.jsxs("button",{type:"button",onClick:()=>t(e.id),className:Be("group",as({active:n})),children:[r.jsx(_s,{className:"size-7 shrink-0 text-fg-muted mt-0.5"}),r.jsx(rs,{thread:e}),r.jsx("div",{className:"flex items-center gap-1 shrink-0",children:r.jsx("button",{type:"button",onClick:i=>{i.stopPropagation(),s(e.id)},disabled:o,className:"p-1.5 rounded-md text-fg-muted hover:text-danger hover:bg-surface-raised transition-colors opacity-0 group-hover:opacity-100 focus:opacity-100",title:"Delete draft",children:r.jsx(Ls,{className:"size-3.5"})})})]}),Uo=({row:e,isSelected:n,onOpen:t})=>{const s=!e.isRead;return r.jsxs("button",{type:"button",onClick:()=>t(e.id),className:Be("group",as({active:n})),children:[s&&r.jsx("span",{className:"absolute left-1.5 top-1/2 size-1.5 -translate-y-1/2 rounded-full bg-accent"}),r.jsx(Wt,{name:e.fromName,email:e.fromEmail,size:"sm"}),r.jsx(rs,{thread:e})]})};function Qo({mailboxId:e,accountId:n,selectedMessageId:t,imapThreads:s,title:o,unreadCount:i}){const{openCompose:c,state:a}=vt(),d=st(),u=Lt(),{data:f}=tt(Ds()),g=l.useMemo(()=>Vo({outboxMessages:f?.items??[],accountId:n,imapThreads:s}),[f?.items,n,s]),m=Pt({...ts(),onSuccess:()=>{u.invalidateQueries({queryKey:es()})}}),S=x=>{m.mutate({path:{outboxMessageId:x}})},C=x=>{c({mode:"new",outboxMessageId:x})},j=x=>{const b=s.find(y=>y.messageId===x)?.threadId;b&&d({to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:e,threadId:b,messageId:x},search:y=>y})},T=g.length===0;return r.jsxs("section",{className:"flex h-full w-full flex-col bg-surface",children:[r.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[r.jsx(io,{}),r.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:o}),(i??0)>0&&r.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle tabular-nums",children:[i," unread"]})]}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:T?r.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-center px-4",children:[r.jsx(Fs,{className:"size-8 text-fg-subtle"}),r.jsx("p",{className:"text-sm font-medium text-fg",children:"No drafts"}),r.jsx("p",{className:"text-xs text-fg-subtle",children:"Messages you start composing will appear here."})]}):g.map(x=>r.jsxs("div",{children:[x.label&&r.jsx(qo,{label:x.label,count:x.threads.length}),r.jsx("div",{className:"divide-y divide-line",children:x.threads.map(b=>x.id==="remit-drafts"?r.jsx(Ho,{row:b,isSelected:a.isOpen&&b.id===a.outboxMessageId,onOpen:C,onDelete:S,isDeleting:m.isPending},b.id):r.jsx(Uo,{row:b,isSelected:b.id===t,onOpen:j},b.id))})]},x.id))})]})}function Jo(e,n,t){const s=new Array(e);return new Proxy(s,{get(o,i,c){if(typeof i=="string"){const a=i.charCodeAt(0);if(a>=48&&a<=57){const d=+i;if(Number.isInteger(d)&&d>=0&&d<e){let u=o[d];if(!u){const f=n[d*2];u=o[d]={index:d,key:t(d),start:f,size:n[d*2+1],end:f+n[d*2+1],lane:0}}return u}}if(i==="length")return e}return Reflect.get(o,i,c)}})}function $e(e,n,t){let s=t.initialDeps??[],o,i=!0;function c(){const a=e();return(a.length!==s.length||a.some((u,f)=>s[f]!==u))&&(s=a,o=n(...a),t?.onChange&&!(i&&t.skipInitialOnChange)&&t.onChange(o),i=!1),o}return c.updateDeps=a=>{s=a},c}function Jt(e,n){if(e===void 0)throw new Error("Unexpected undefined");return e}const Go=(e,n)=>Math.abs(e-n)<1.01,Yo=(e,n,t)=>{let s;return function(...o){e.clearTimeout(s),s=e.setTimeout(()=>n.apply(this,o),t)}};let et;const zt=()=>{if(et!==void 0)return et;if(typeof navigator>"u")return et=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return et=!0;const e=navigator.maxTouchPoints;return et=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Gt=e=>{const{offsetWidth:n,offsetHeight:t}=e;return{width:n,height:t}},Xo=e=>e,Zo=e=>{const n=Math.max(e.startIndex-e.overscan,0),s=Math.min(e.endIndex+e.overscan,e.count-1)-n+1,o=new Array(s);for(let i=0;i<s;i++)o[i]=n+i;return o},ei=(e,n)=>{const t=e.scrollElement;if(!t)return;const s=e.targetWindow;if(!s)return;const o=c=>{const{width:a,height:d}=c;n({width:Math.round(a),height:Math.round(d)})};if(o(Gt(t)),!s.ResizeObserver)return()=>{};const i=new s.ResizeObserver(c=>{const a=()=>{const d=c[0];if(d?.borderBoxSize){const u=d.borderBoxSize[0];if(u){o({width:u.inlineSize,height:u.blockSize});return}}o(Gt(t))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(t,{box:"border-box"}),()=>{i.unobserve(t)}},bt={passive:!0},ti=typeof window>"u"?!0:"onscrollend"in window,si=(e,n,t)=>{const s=e.scrollElement;if(!s)return;const o=e.targetWindow;if(!o)return;const i=e.options.useScrollendEvent&&ti;let c=0;const a=i?null:Yo(o,()=>n(c,!1),e.options.isScrollingResetDelay),d=g=>()=>{c=t(s),a?.(),n(c,g)},u=d(!0),f=d(!1);return s.addEventListener("scroll",u,bt),i&&s.addEventListener("scrollend",f,bt),()=>{s.removeEventListener("scroll",u),i&&s.removeEventListener("scrollend",f)}},ni=(e,n)=>si(e,n,t=>{const{horizontal:s,isRtl:o}=e.options;return s?t.scrollLeft*(o&&-1||1):t.scrollTop}),oi=(e,n,t)=>{if(t.options.useCachedMeasurements){const s=t.indexFromElement(e),o=t.options.getItemKey(s);return t.itemSizeCache.get(o)??t.options.estimateSize(s)}if(n?.borderBoxSize){const s=n.borderBoxSize[0];if(s)return Math.round(s[t.options.horizontal?"inlineSize":"blockSize"])}if(!n){const s=t.indexFromElement(e),o=t.options.getItemKey(s),i=t.itemSizeCache.get(o);if(i!==void 0)return i}return e[t.options.horizontal?"offsetWidth":"offsetHeight"]},ii=(e,{adjustments:n=0,behavior:t},s)=>{var o,i;(i=(o=s.scrollElement)==null?void 0:o.scrollTo)==null||i.call(o,{[s.options.horizontal?"left":"top"]:e+n,behavior:t})},ri=ii;class ai{constructor(n){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var t,s,o;return((o=(s=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:s.now)==null?void 0:o.call(s))??Date.now()},this.observer=(()=>{let t=null;const s=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(o=>{o.forEach(i=>{const c=()=>{const a=i.target,d=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[u,f]of this.elementsCache)if(f===a){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(d)&&this.resizeItem(d,this.options.measureElement(a,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()})}));return{disconnect:()=>{var o;(o=s())==null||o.disconnect(),t=null},observe:o=>{var i;return(i=s())==null?void 0:i.observe(o,{box:"border-box"})},unobserve:o=>{var i;return(i=s())==null?void 0:i.unobserve(o)}}})(),this.range=null,this.setOptions=t=>{var s,o;const i={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Xo,rangeExtractor:Zo,onChange:()=>{},measureElement:oi,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const m in t){const S=t[m];S!==void 0&&(i[m]=S)}const c=this.options;let a=null,d=null,u=!1;if(c!==void 0&&c.enabled&&i.enabled&&i.anchorTo==="end"&&this.scrollElement!==null){const m=c.count,S=i.count,C=this.getMeasurements(),j=m>0?((s=C[0])==null?void 0:s.key)??c.getItemKey(0):null,T=m>0?((o=C[m-1])==null?void 0:o.key)??c.getItemKey(m-1):null;if(S!==m||m>0&&S>0&&(i.getItemKey(0)!==j||i.getItemKey(S-1)!==T)){u=!0;const y=m>0?this.getVirtualItemForOffset(this.getScrollOffset())??C[0]:null;y&&(a=[y.key,this.getScrollOffset()-y.start]);const I=i.followOnAppend===!0?"auto":i.followOnAppend||null;I&&S>m&&this.isAtEnd(c.scrollEndThreshold)&&(m===0||i.getItemKey(S-1)!==T)&&(d=I)}}this.options=i,u&&(this.pendingMin=0,this.itemSizeCacheVersion++);let f=!1,g=0;if(a&&this.scrollOffset!==null){const[m,S]=a,C=this.getMeasurements(),{count:j,getItemKey:T}=this.options;let x=0;for(;x<j&&T(x)!==m;)x++;if(x<j){const b=C[x];if(b){const y=b.start+S;y!==this.scrollOffset&&(g=y-this.scrollOffset,this.scrollOffset=y,f=!0)}}}(f||d)&&(this.pendingScrollAnchor=[f?a[0]:null,f?a[1]:0,d,g])},this.notify=t=>{var s,o;(o=(s=this.options).onChange)==null||o.call(s,this,t)},this.maybeNotify=$e(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}if(this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,c)=>{if(c&&this._intendedScrollOffset===null&&i===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(i-this._intendedScrollOffset)<1.5&&(i=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;const a=this.getScrollOffset();this.scrollDirection=c?a===i?this.scrollDirection:a<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=c,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const i=this.scrollElement,c=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},a=()=>{this._iosTouching=!1,!(!zt()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",c,bt),i.addEventListener("touchend",a,bt),this.unsubs.push(()=>{i.removeEventListener("touchstart",c),i.removeEventListener("touchend",a),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const o=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,o&&this.scrollElement&&this.options.enabled){const[i,c,a,d]=o;i!==null&&!a&&(zt()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?d!==0&&(this._iosDeferredAdjustment+=d):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),a&&this.scrollToEnd({behavior:a})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const t=this.getScrollOffset(),s=this.getMaxScrollOffset();if(t<0||t>s)return;const o=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(t,{adjustments:this.scrollAdjustments+=o,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=$e(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(t,s,o,i,c,a,d,u)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:t,paddingStart:s,scrollMargin:o,getItemKey:i,enabled:c,lanes:a,laneAssignmentMode:d,gap:u}),{key:!1}),this.getMeasurements=$e(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:t,paddingStart:s,scrollMargin:o,getItemKey:i,enabled:c,lanes:a,laneAssignmentMode:d,gap:u},f)=>{const g=this.itemSizeCache;if(!c)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const x of this.laneAssignments.keys())x>=t&&this.laneAssignments.delete(x);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(x=>{this.itemSizeCache.set(x.key,x.size)}));const m=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1),a===1){const x=t*2;let b=this._flatMeasurements;if(!b||b.length<x){const k=new Float64Array(x);b&&m>0&&k.set(b.subarray(0,m*2)),b=k,this._flatMeasurements=b}let y;if(m===0)y=s+o;else{const k=m-1;y=b[k*2]+b[k*2+1]+u}for(let k=m;k<t;k++){const R=i(k),E=g.get(R),_=typeof E=="number"?E:this.options.estimateSize(k);b[k*2]=y,b[k*2+1]=_,y+=_+u}const I=Jo(t,b,i);return this.measurementsCache=I,I}const S=this.measurementsCache.slice(0,m),C=new Array(a).fill(void 0),j=new Float64Array(a);let T=0;for(let x=0;x<m;x++){const b=S[x];b&&(C[b.lane]===void 0&&T++,C[b.lane]=x,j[b.lane]=b.end)}for(let x=m;x<t;x++){const b=i(x),y=this.laneAssignments.get(x);let I,k;const R=d==="estimate"||g.has(b);if(y!==void 0&&this.options.lanes>1){I=y;const W=C[I],$=W!==void 0?S[W]:void 0;k=$?$.end+u:s+o}else if(T===a){let W=0,$=j[0],N=C[0];for(let K=1;K<a;K++){const se=j[K];(se<$||se===$&&C[K]<N)&&(W=K,$=se,N=C[K])}I=W,k=$+u,R&&this.laneAssignments.set(x,I)}else I=x%this.options.lanes,k=s+o,R&&this.laneAssignments.set(x,I);const E=g.get(b),_=typeof E=="number"?E:this.options.estimateSize(x),D=k+_;S[x]={index:x,start:k,size:_,end:D,key:b,lane:I},C[I]===void 0&&T++,C[I]=x,j[I]=D}return this.measurementsCache=S,S},{key:!1,debug:()=>this.options.debug}),this.calculateRange=$e(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,s,o,i)=>t.length===0||s===0?(this.range=null,null):(this.range=ci(t,s,o,i,i===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=$e(()=>{let t=null,s=null;const o=this.calculateRange();return o&&(t=o.startIndex,s=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,s]},(t,s,o,i,c)=>i===null||c===null?[]:t({startIndex:i,endIndex:c,overscan:s,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const s=this.options.indexAttribute,o=t.getAttribute(s);return o?parseInt(o,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(o!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),c=Math.max(0,o-i),a=Math.min(this.options.count-1,o+i);return t>=c&&t<=a}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((c,a)=>{c.isConnected||(this.observer.unobserve(c),this.elementsCache.delete(a))});return}const s=this.indexFromElement(t),o=this.options.getItemKey(s),i=this.elementsCache.get(o);i!==t&&(i&&this.observer.unobserve(i),this.observer.observe(t),this.elementsCache.set(o,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,s)=>{var o,i;if(t<0||t>=this.options.count)return;let c,a,d;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)d=this.options.getItemKey(t),a=u[t*2],c=u[t*2+1];else{const m=this.measurementsCache[t];if(!m)return;d=m.key,a=m.start,c=m.size}const f=this.itemSizeCache.get(d)??c,g=s-f;if(g!==0){const m=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,S=m?this.getTotalSize():0,C=((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t]??{index:t,key:d,start:a,size:c,end:a+c,lane:0},g,this):a<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(d)||this.scrollDirection!=="backward"));(this.pendingMin===null||t<this.pendingMin)&&(this.pendingMin=t),this.itemSizeCache.set(d,s),this.itemSizeCacheVersion++,m?this.applyScrollAdjustment(this.getTotalSize()-S):C&&this.applyScrollAdjustment(g),this.notify(!1)}},this.getVirtualItems=$e(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,s)=>{const o=[];for(let i=0,c=t.length;i<c;i++){const a=t[i],d=s[a];o.push(d)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const s=this.getMeasurements();if(s.length===0)return;const o=this._flatMeasurements,i=this.options.lanes===1&&o!=null,c=ys(0,s.length-1,i?a=>o[a*2]:a=>Jt(s[a]).start,t);return Jt(s[c])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(t=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=t,this.getOffsetForAlignment=(t,s,o=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),c=this.getScrollOffset();s==="auto"&&(s=t>=c+i?"end":"start"),s==="center"?t+=(o-i)/2:s==="end"&&(t-=i);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,t),0)},this.getOffsetForIndex=(t,s="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const o=this.getSize(),i=this.getScrollOffset(),c=this.measurementsCache[t];if(!c)return;if(s==="auto")if(c.end>=i+o-this.options.scrollPaddingEnd)s="end";else if(c.start<=i+this.options.scrollPaddingStart)s="start";else return[i,s];if(s==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),s];const a=s==="end"?c.end+this.options.scrollPaddingEnd:c.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,s,c.size),s]},this.scrollToOffset=(t,{align:s="start",behavior:o="auto"}={})=>{const i=this.getOffsetForAlignment(t,s),c=this.now();this.scrollState={index:null,align:s,behavior:o,startedAt:c,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:s="auto",behavior:o="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const i=this.getOffsetForIndex(t,s);if(!i)return;const[c,a]=i,d=this.now();this.scrollState={index:t,align:a,behavior:o,startedAt:d,lastTargetOffset:c,stableFrames:0},this._scrollToOffset(c,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:s="auto"}={})=>{const o=this.getScrollOffset()+t,i=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:i,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:t="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:t});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:t})},this.getTotalSize=()=>{var t;const s=this.getMeasurements();let o;if(s.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){const i=s.length-1,c=this._flatMeasurements;c!=null?o=c[i*2]+c[i*2+1]:o=((t=s[i])==null?void 0:t.end)??0}else{const i=Array(this.options.lanes).fill(null);let c=s.length-1;for(;c>=0&&i.some(a=>a===null);){const a=s[c];i[a.lane]===null&&(i[a.lane]=a.end),c--}o=Math.max(...i.filter(a=>a!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const t=[];if(this.itemSizeCache.size===0)return t;const s=this.getMeasurements();for(const o of s)o&&this.itemSizeCache.has(o.key)&&t.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return t},this._scrollToOffset=(t,{adjustments:s,behavior:o})=>{this._intendedScrollOffset=t+(s??0),this.options.scrollToFn(t,{behavior:o,adjustments:s},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(n)}applyScrollAdjustment(n,t){n!==0&&(zt()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=n:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=n,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=s?s[0]:this.scrollState.lastTargetOffset,i=1,c=o!==this.scrollState.lastTargetOffset;if(!c&&Go(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.getScrollOffset()!==o&&this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,c){const a=this.getSize()||600,d=Math.abs(o-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&d>a;this.scrollState.lastTargetOffset=o,u||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const ys=(e,n,t,s)=>{for(;e<=n;){const o=(e+n)/2|0,i=t(o);if(i<s)e=o+1;else if(i>s)n=o-1;else return o}return e>0?e-1:0};function li(e,n,t){let s=0;for(;s<=n;){const o=(s+n)/2|0,i=e[o*2];if(i<t)s=o+1;else if(i>t)n=o-1;else return o}return s>0?s-1:0}function ci(e,n,t,s,o){const i=e.length-1;if(e.length<=s)return{startIndex:0,endIndex:i};if(s===1&&o!==null){const u=li(o,i,t);let f=u;const g=t+n;for(;f<i&&o[f*2]+o[f*2+1]<g;)f++;return{startIndex:u,endIndex:f}}let a=ys(0,i,u=>e[u].start,t),d=a;if(s===1)for(;d<i&&e[d].end<t+n;)d++;else if(s>1){const u=Array(s).fill(0);for(;d<i&&u.some(g=>g<t+n);){const g=e[d];u[g.lane]=g.end,d++}const f=Array(s).fill(t+n);for(;a>=0&&f.some(g=>g>=t);){const g=e[a];f[g.lane]=g.start,a--}a=Math.max(0,a-a%s),d=Math.min(i,d+(s-1-d%s))}return{startIndex:a,endIndex:d}}const Dt=typeof document<"u"?l.useLayoutEffect:l.useEffect;function di({useFlushSync:e=!0,directDomUpdates:n=!1,directDomUpdatesMode:t="transform",...s}){const o=l.useReducer(u=>u+1,0)[1],i=l.useRef({enabled:n,mode:t,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});i.current.enabled=n,i.current.mode=t;const c=u=>{const f=i.current;if(!f.enabled||!f.container)return;const g=u.getTotalSize();if(g!==f.lastSize){f.lastSize=g;const x=u.options.horizontal?"width":"height";f.container.style[x]=`${g}px`}const m=!!u.options.horizontal,S=f.mode==="transform",C=m?"left":"top",j=u.options.scrollMargin,T=u.getVirtualItems();for(const x of T){const b=x.start-j,y=u.elementsCache.get(x.key);y&&f.lastPositions.get(y)!==b&&(f.lastPositions.set(y,b),S?y.style.transform=m?`translate3d(${b}px, 0, 0)`:`translate3d(0, ${b}px, 0)`:y.style[C]=`${b}px`)}},a={...s,onChange:(u,f)=>{var g;const m=i.current;let S=!0;if(m.enabled){c(u);const C=u.range,j=m.prevRange;S=!j||j.isScrolling!==u.isScrolling||j.startIndex!==C?.startIndex||j.endIndex!==C?.endIndex,S&&(m.prevRange=C?{startIndex:C.startIndex,endIndex:C.endIndex,isScrolling:u.isScrolling}:null)}S&&(e&&f?Ps.flushSync(o):o()),(g=s.onChange)==null||g.call(s,u,f)}},[d]=l.useState(()=>{const u=new ai(a);return Object.assign(u,{containerRef:f=>{const g=i.current;if(g.container=f,g.lastSize=null,f&&g.enabled){const m=u.getTotalSize();g.lastSize=m;const S=u.options.horizontal?"width":"height";f.style[S]=`${m}px`}}})});return d.setOptions(a),Dt(()=>d._didMount(),[]),Dt(()=>d._willUpdate()),Dt(()=>{c(d)}),d}function ui(e){return di({observeElementRect:ei,observeElementOffset:ni,scrollToFn:ri,...e})}const Vt=e=>e.query?`matching "${e.query}"`:e.from?`from "${e.from}"`:"matching your search",hi=e=>`Select all ${Vt(e)}`,fi=(e,n)=>`All ${no(n)} ${Vt(e)} selected`,mi=({verb:e,confirmingDelete:n,hasSelection:t,junkMailboxId:s,currentMailboxId:o,deletableMessageId:i})=>{if(n)return{kind:"withheld"};if(e==="junk"){const c=cn(s,o);if(c!==void 0)return{kind:"unavailable",reason:c}}return t?{kind:"openWizard"}:e!=="delete"||i===void 0?{kind:"declined"}:{kind:"confirmDelete",messageId:i}},gi=(e,n,t)=>e==="BACK"&&n&&t===void 0,pi=(e,n)=>({id:e.messageId,accountId:e.accountId,mailboxId:e.mailboxId,threadId:e.threadId,fromName:e.fromName??e.fromEmail??"Unknown",fromEmail:e.fromEmail??"",subject:e.subject??"(No subject)",snippet:e.snippet??"",timeLabel:nt(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0,trust:e.senderTrust,category:ls(e.category),messageCount:n,suspicious:e.authenticity?.dkimMismatch===!0,labels:e.labels}),xi=({thread:e,mailboxId:n,isSelected:t,isFocused:s,isTabStop:o,onFocusRow:i,isChecked:c,onToggleCheck:a,onRowSelect:d,messageCount:u,isMultiSelectMode:f,onLongPress:g,isDesktop:m,density:S})=>r.jsx(dn,{thread:pi(e,u),link:{mailboxId:n,threadId:e.threadId},inListbox:!0,active:t,focused:s,isTabStop:o,density:S,isDesktop:m,onFocusRow:i,selection:{isChecked:c,onToggleCheck:a,onRowSelect:d,isMultiSelectMode:f,onLongPress:g}}),bi=l.memo(xi),vi=e=>{const n=e.authenticity?.dkimMismatch===!0;return{id:e.messageId,accountId:e.accountId,fromName:e.fromName??e.fromEmail??"Unknown",fromEmail:e.fromEmail??"",subject:e.subject??"(No subject)",snippet:e.snippet??"",timeLabel:nt(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0,trust:e.senderTrust,category:ls(e.category),suspicious:n}},Si=({thread:e,mailboxId:n,isSelected:t,isFocused:s,isTabStop:o,onFocusRow:i,isChecked:c,onToggleCheck:a,onRowSelect:d,isMultiSelectMode:u,onLongPress:f,isDesktop:g,onDelete:m,onToggleRead:S,density:C})=>{const[j,T]=l.useState("none"),x=st(),b=l.useCallback(E=>{navigator.vibrate?.(10),E==="trailing"?m(e.messageId):S(e.messageId,e.isRead),T("none")},[m,S,e.messageId,e.isRead]),y=l.useCallback(()=>{f(e.messageId)},[f,e.messageId]),I=l.useCallback(()=>{a(e.messageId)},[a,e.messageId]),k=l.useCallback(()=>{x({to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:n,threadId:e.threadId,messageId:e.messageId},search:E=>E})},[x,n,e.threadId,e.messageId]),R=un(e.messageId,d);return g||u?r.jsx(bi,{thread:e,mailboxId:n,isSelected:t,isFocused:s,isTabStop:o,onFocusRow:i,isChecked:c,onToggleCheck:a,onRowSelect:d,isMultiSelectMode:u,onLongPress:f,isDesktop:g,density:C}):r.jsx("div",{role:"presentation",onPointerDownCapture:R.onMouseDown,onClickCapture:R.claimClick,onContextMenu:R.onContextMenu,children:r.jsx(Yn,{thread:vi(e),selectionMode:!1,checked:!1,active:t,peek:j,onPeek:T,onToggleCheck:I,onLongPress:y,onOpen:k,onAct:b})})},yi=72,Ci=32,Ii=5,Cs="remit:list-density",wi=()=>{try{const e=localStorage.getItem(Cs);if(e==="compact"||e==="comfortable")return e}catch{}return"comfortable"},ji=({query:e})=>r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-line bg-surface-sunken/30",children:[r.jsx(qs,{className:"size-4 text-fg-muted"}),r.jsxs("span",{className:"text-sm text-fg-muted",children:["Results for “",e,"”"]})]}),ki=({mailboxId:e,threads:n,selectedMessageId:t,isLoading:s,isError:o=!1,error:i,onRetry:c,searchQuery:a,searchPredicate:d,onDeleteMessages:u,isDeleting:f=!1,isMoving:g=!1,onLoadMore:m,hasMore:S=!1,isLoadingMore:C=!1,accountId:j,listTitle:T,listMeta:x,listFilter:b,listScopeLabel:y,onTriageContextChange:I,commandsRef:k,hideHeader:R=!1})=>{const E=l.useRef(null),_=st(),D=ps(),W=$s(),{verb:$,start:N,startFromSearch:K}=W,se=Bs(),Ie=!!a?.trim(),V=hn(),{labels:We}=ro(j),{pushError:le}=ss(),[M,we]=l.useState(t),[je,pe]=l.useState(),z=l.useCallback(h=>{pe(v=>v===h?v:void 0),we(h)},[]),[xe,q]=l.useState(wi),Ee=l.useCallback(()=>{q(h=>{const v=h==="comfortable"?"compact":"comfortable";try{localStorage.setItem(Cs,v)}catch{}return v})},[]),{toggleReadFor:Oe}=cs({mailboxId:e}),{junkMailboxId:me}=ds(j),Ae=us(me,e),{selectedIds:ee,selectedCount:ne,hasSelection:oe,isSelected:O,toggle:A,select:Ne,clearSelection:H,selectRange:ie,setAnchor:J,selectAll:ot,toggleAll:Ct,intersectWith:it}=fn(),Ke=jn(ne,D),[re,te]=l.useState(null),rt=Ie&&!!d,ke=`${e}|${JSON.stringify(d??{})}`,w=mn({mailboxId:e,accountId:j,enabled:rt,predicateKey:ke,searchQuery:d??{}}),F=l.useCallback((h,v,Y)=>{if(Y.error===void 0){if(Y.cancelled){le({severity:"warning",title:pn(Y.done),detail:gn(h,Y.done,v)});return}le({severity:"info",title:qt(h,Y.done)})}},[le]),Ve=w.phase.kind,qe=w.clear,Q=l.useCallback(()=>{Ve==="escalated"&&qe(),H()},[H,qe,Ve]),[He,at]=l.useState(null),G=l.useRef(null),ce=l.useRef(!1),be=l.useRef(null),ze=!s&&n.length>0,Ue=re!==null,L=ui({count:n.length,getScrollElement:()=>E.current,estimateSize:()=>xe==="compact"?Ci:yi,overscan:Ii}),lt=t?n.findIndex(h=>h.messageId===t):-1,ae=M?n.findIndex(h=>h.messageId===M):-1,de=l.useCallback(h=>{if(h<0||h>=n.length)return;const v=n[h];if(Ke){A(v.messageId);return}G.current=v.messageId,ce.current=!1,pe(v.messageId),we(v.messageId)},[n,Ke,A]),ue=l.useCallback(()=>{if(n.length===0)return;const h=ae<0?0:Math.min(ae+1,n.length-1);de(h)},[n.length,ae,de]),Qe=l.useCallback(()=>{if(n.length===0)return;const h=ae<=0?0:ae-1;de(h)},[n.length,ae,de]),ge=l.useCallback(()=>de(0),[de]),ct=l.useCallback(()=>de(n.length-1),[de,n.length]),Je=l.useCallback(()=>{M&&A(M)},[M,A]),B=l.useMemo(()=>n.map(h=>h.messageId),[n]),It=l.useMemo(()=>{const h=[];for(const v of n)ee.has(v.messageId)&&h.push({id:v.messageId,sender:v.fromName??v.fromEmail??"Unknown",email:v.fromEmail??"",subject:v.subject??"(No subject)",date:nt(v.sentDate)});return h},[n,ee]),dt=l.useCallback((h,v)=>v.shiftKey?(ie(B,h,M),!0):v.metaKey||v.ctrlKey?(A(h),!0):(Q(),J(h),!1),[B,M,ie,A,Q,J]),De=l.useCallback(h=>{!u||h.length===0||(be.current=M??null,te(h))},[u,M]),Me=l.useCallback(h=>{const v=xn(B,M,h);v!==void 0&&(ie(B,v),G.current=v,ce.current=!1,pe(void 0),we(v))},[B,M,ie]),ve=l.useCallback(()=>Me(-1),[Me]),Ge=l.useCallback(()=>Me(1),[Me]),Fe=l.useCallback(()=>{B.length>0&&ot(B)},[B,ot]),ut=l.useCallback(h=>{const v=mi({verb:h,confirmingDelete:re!==null,hasSelection:oe,junkMailboxId:me,currentMailboxId:e,deletableMessageId:u?M:void 0});return v.kind==="openWizard"?(N(h),!0):v.kind==="confirmDelete"?(De([v.messageId]),!0):v.kind==="unavailable"?(le({severity:"warning",title:v.reason}),!0):v.kind==="withheld"},[re,u,oe,me,e,N,M,De,le]),he=l.useCallback((h,v)=>{const Y=n.find(X=>X.messageId===h)?.threadId;Y&&_({to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:e,threadId:Y,messageId:h},search:X=>X,replace:v?.replace})},[_,e,n]),Ye=l.useCallback(()=>{M&&he(M)},[M,he]),Te=l.useCallback(h=>he(h,{replace:!0}),[he]);bn({keyboardFocusedMessageId:je,openMessageId:t,enabled:D&&ne===0,open:Te});const Se=w.phase.kind==="escalated"?{scope:Vt(d??{}),total:w.phase.total,searchQuery:d??{},run:h=>w.runAction(h),stop:w.stop}:void 0,_e=l.useCallback(()=>{if(!re)return;const h=re;if(h.length===0){te(null);return}const v=new Set(h),Y=n.findIndex(Z=>v.has(Z.messageId));let X;for(let Z=Y+1;Z<n.length;Z++)if(!v.has(n[Z].messageId)){X=n[Z].messageId;break}if(X===void 0){for(let Z=Y-1;Z>=0;Z--)if(!v.has(n[Z].messageId)){X=n[Z].messageId;break}}u?.(h),Q(),be.current=null,te(null),X!==void 0&&(G.current=X,ce.current=!1,z(X),D&&he(X,{replace:!0})),D||at(qt("delete",h.length))},[re,n,u,Q,he,D,z]),ye=l.useCallback(()=>{const h=be.current;be.current=null,te(null),h!==null&&(G.current=h,ce.current=!1,z(h))},[z]),Xe=l.useMemo(()=>{if(ne===0)return;const h=new Set;for(const v of n)ee.has(v.messageId)&&h.add(v.accountConfigId);if(h.size>1)return"Move only works within one account — clear selection or pick messages from a single account"},[ne,ee,n]),wt=l.useCallback(()=>{if(Se){K();return}N("organize")},[Se,K,N]),jt=l.useCallback(h=>{u?.([h])},[u]),Ce=l.useCallback((h,v)=>{Oe([h],!v)},[Oe]),kt=l.useCallback(h=>{D||Ne(h)},[D,Ne]),Mt=l.useCallback(()=>{if(w.isRunning||w.phase.kind==="counting"){w.stop();return}Q()},[w,Q]),Tt=l.useCallback(()=>{w.clear()},[w]);l.useEffect(()=>{if(ce.current||!D&&t)return;const h=ae>=0?ae:lt;h>=0&&L.scrollToIndex(h,{align:"auto"})},[ae,lt,L,D,t]),l.useEffect(()=>{t&&(ce.current=!1,z(t))},[t,z]),l.useEffect(()=>{M&&(n.some(h=>h.messageId===M)||z(n[0]?.messageId))},[n,M,z]),l.useEffect(()=>{I?.({focusedMessageId:M,selectedIds:Array.from(ee),hasList:ze,blocksKeyboard:Ue||W.isOpen})},[M,ee,ze,Ue,W.isOpen,I]);const ht=l.useRef(I);ht.current=I,l.useEffect(()=>()=>ht.current?.({focusedMessageId:void 0,selectedIds:[],hasList:!1,blocksKeyboard:!1}),[]),l.useEffect(()=>{w.phase.kind!=="idle"||w.isRunning||it(n.map(h=>h.messageId))},[n,it,w.phase,w.isRunning]);const ft=l.useRef(e);l.useEffect(()=>{ft.current!==e&&(ft.current=e,Q())},[e,Q]),vn({shouldBlockFn:({action:h})=>gi(h,oe,se)?(Q(),!0):!1,enableBeforeUnload:!1,disabled:!oe||se!==void 0}),l.useEffect(()=>{const h=E.current;if(!h||!S||!m)return;const v=()=>{if(C)return;const{scrollTop:Y,scrollHeight:X,clientHeight:Z}=h;Y+Z>=X-200&&m()};return h.addEventListener("scroll",v,{passive:!0}),v(),()=>h.removeEventListener("scroll",v)},[S,C,m]),l.useEffect(()=>{const h=G.current;if(!h)return;const v=E.current?.querySelector(`[data-message-id="${h}"]`);v&&(G.current=null,v.focus({preventScroll:!0}))}),l.useEffect(()=>{if(k){if(!ze){k.current=null;return}return k.current={focusNext:ue,focusPrevious:Qe,focusFirst:ge,focusLast:ct,openFocused:Ye,toggleSelect:Je,extendSelectDown:Ge,extendSelectUp:ve,selectAll:Fe,clearSelection:()=>oe?(Q(),!0):!1,requestVerb:ut,toggleDensity:Ee},()=>{k.current=null}}},[k,ze,ue,Qe,ge,ct,Ye,Je,Ge,ve,Fe,oe,Q,ut,Ee]);const mt=s?"loading":o?"error":n.length===0?"empty":"ready",Rt=o?so(i):void 0,Re=l.useCallback(()=>{const h=Ws(Ks());window.open(h,"_blank","noopener,noreferrer")},[]),gt=[{id:"inbox",threads:[]}],Le=B.length>0&&B.every(h=>ee.has(h)),Et=rt&&S&&Le&&!f&&!g&&w.phase.kind==="idle"&&!w.isRunning,Ot=f||g||w.isRunning,Ze=w.phase.kind==="escalated"?w.phase.total:ne,At=w.runningAction?Sn(w.runningAction.kind,w.progress?.done??0,w.progress?.total??Ze):w.phase.kind==="counting"?"Counting matches…":w.phase.kind==="escalated"?fi(d??{},w.phase.total):void 0,pt=w.phase.kind!=="escalated"&&B.length>0?{checked:Le,indeterminate:ne>0&&!Le,onChange:()=>Ct(B)}:void 0,Nt=w.runningAction?{value:w.progress?.done??0,max:w.progress?.total??Ze,tone:yn(w.runningAction.kind)}:void 0,P=(w.phase.kind==="counting"?{tone:"info",text:"",action:{label:"Stop",onClick:w.stop}}:w.phase.kind==="escalated"&&!w.isRunning?{tone:"info",text:"",action:{label:"Clear selection",onClick:Tt}}:Et?{tone:"info",text:"",action:{label:hi(d??{}),onClick:w.escalate}}:void 0)??(Xe?{tone:"warning",text:Xe}:void 0),U=r.jsx(Cn,{title:V.title||T,navSlot:V.navSlot,titleMeta:V.titleMeta,searchSlot:V.searchSlot,searchField:V.searchField,idleSlot:V.makeFilterSlot,count:Ze,onCancel:Mt,onDelete:()=>N("delete"),onMove:()=>N("move"),onOrganize:wt,onJunk:Ae?()=>N("junk"):void 0,onMarkRead:()=>N("markRead"),overflowSlot:j&&e&&ne>0&&We.length>0?r.jsx(ao,{accountId:j,mailboxId:e,messageIds:Array.from(ee)}):void 0,isBusy:Ot,isCounting:w.phase.kind==="counting",selectAll:pt,statusLabel:At,progress:Nt,notice:P}),ks=In(B,M),Ms=l.useCallback(h=>{ce.current=!0,z(h)},[z]),Ts=r.jsxs(r.Fragment,{children:[Ie&&a&&r.jsx(ji,{query:a}),r.jsxs("div",{ref:E,role:"listbox","aria-multiselectable":!0,"aria-label":T,className:"flex-1 overflow-y-auto",children:[r.jsx("div",{role:"presentation",className:"relative w-full",style:{height:`${L.getTotalSize()}px`},children:L.getVirtualItems().map(h=>{const v=n[h.index];return r.jsx("div",{role:"presentation","data-index":h.index,ref:L.measureElement,className:Vs("absolute left-0 top-0 w-full border-b border-line",w.isRunning&&"pointer-events-none opacity-50"),style:{transform:`translateY(${h.start}px)`},children:r.jsx(Si,{thread:v,mailboxId:e,isSelected:t===v.messageId,isFocused:M===v.messageId,isTabStop:ks===v.messageId,onFocusRow:Ms,isChecked:O(v.messageId),onToggleCheck:A,onRowSelect:dt,isMultiSelectMode:Ke,onLongPress:kt,isDesktop:D,onDelete:jt,onToggleRead:Ce,density:xe})},h.key)})}),C&&r.jsx(Xn,{})]})]});return r.jsxs(r.Fragment,{children:[He&&!D&&r.jsx(_t,{tone:"success",variant:"soft",className:"m-2 rounded-md",onDismiss:()=>at(null),children:He}),r.jsx(Zn,{listTitle:T,listMeta:x,sections:gt,flatList:!0,listState:V.searchResults?"ready":mt,searchQuery:Ie?a:void 0,listFilter:b,listScopeLabel:y,errorMessage:Rt,onRetry:c,onReportError:Re,density:xe,selectedThreadId:t,onSelectThread:h=>he(h),isDesktop:D,hideHeader:R,selectionBar:U,listBody:V.searchResults??(mt==="ready"?Ts:void 0)}),r.jsx(xs,{isOpen:re!==null,title:oo(re?.length??0),description:"You can restore them from Trash later.",confirmLabel:"Move to Trash",destructive:!0,isBusy:f,onConfirm:_e,onCancel:ye}),r.jsx(wn,{verb:$,accountId:j,mailboxId:e,selection:It,crossAccount:Xe!==void 0,escalated:Se,escalatedProgress:w.progress,onFinished:Q,onRunEnded:F})]})},Mi=e=>Us({path:{accountId:e}}),Ti=e=>{const n=Lt(),t=$t(),s=Pt({...Hs(),onSuccess:()=>{t.recordEvent("sync.triggered"),n.invalidateQueries({queryKey:Mi(e)})}});return{trigger:()=>{s.mutate({path:{accountId:e}})},triggerAsync:()=>s.mutateAsync({path:{accountId:e}}),isPending:s.isPending,error:s.error,reset:s.reset}},Ri=({accountId:e,children:n})=>{const{triggerAsync:t,isPending:s}=Ti(e);return r.jsx(wo,{onRefresh:t,isRefreshing:s,children:n})};function Ei({accountId:e,currentMailboxId:n,candidates:t,onMove:s,children:o}){const[i,c]=l.useState(!1),a=$t(),d=go(),{inboxMailboxId:u}=kn(e),f=Mn(e),{data:g}=tt({...Qs({path:{accountId:e}}),staleTime:1/0}),m=l.useMemo(()=>po({mailboxes:g?.items??[],folderAppointments:f,currentMailboxId:n,translator:d}),[g?.items,f,n,d]),S=l.useMemo(()=>u||(m.find(b=>b.label.toLowerCase()==="inbox")?.id??m.find(b=>!b.isCurrent)?.id??""),[u,m]),C=l.useRef(!1);l.useEffect(()=>{C.current||(C.current=!0,Tn(a,t.length))},[a,t.length]);const j=l.useCallback(()=>{Rn(a,t.length),c(!0)},[a,t.length]),T=l.useCallback((x,b)=>{En(a,{selected:x.length,total:t.length,toInbox:b===u}),s(x,b)},[a,t.length,u,s]);return r.jsxs("div",{className:"relative flex h-full min-h-0 flex-col",children:[r.jsx("div",{className:"shrink-0 px-row-inset pt-2",children:r.jsx(ko,{count:t.length,onReview:j})}),r.jsx("div",{className:"min-h-0 flex-1",children:o}),r.jsx(_o,{open:i,candidates:t,defaultDestinationId:S,availableFolders:m,delimiter:xo(g?.items??[]),onConfirmMove:T,onCancel:()=>c(!1)})]})}const Oi="We can verify this sender";function Ai(e){const{data:n}=tt({...Js({path:{mailboxId:e??""},query:{senderTrust:["vip","wellknown"],dkimMismatch:!1,results:!0,limit:500}}),enabled:!!e,staleTime:6e4});return{candidates:(n?.items??[]).map(s=>({id:s.messageId,senderName:s.fromName||s.fromEmail||"Unknown sender",senderAddress:s.fromEmail??"",subject:s.subject||"(no subject)",snippet:s.snippet??"",trustReason:Oi,trustSubReason:On(s.senderTrust),senderTrust:s.senderTrust}))}}const Ni=e=>{const n=new Set,t=[];for(const s of e)n.has(s.threadMessageId)||(n.add(s.threadMessageId),t.push(s));return t},zi={unread:"unread",flagged:"starred",attachment:"attachments"},Di=new Set(Object.values(yo)),Is=e=>Di.has(e),Fi=e=>Is(e.category)||e.attributes.size>0,_i=e=>{const n={};Is(e.category)&&(n.category=[e.category]);for(const t of e.attributes){const s=zi[t];s&&(n[s]=!0)}return n},Li=e=>(e.senderTrust?.length??0)>0||e.dkimMismatch!==void 0?"loaded-pages":"whole-folder",Pi=["category","unread","starred","attachments"],Yt=e=>JSON.stringify(Pi.map(n=>e?.[n]??null)),$i=e=>{if(!Array.isArray(e))return;const[n]=e;if(typeof n!="object"||n===null)return;const t=n.query;if(!(typeof t!="object"||t===null))return t},Bi=(e,n)=>{const t=$i(e);return t?Yt(t)===Yt(n):!1},xt=e=>e[0],Wi=e=>{const n=xt(e.filter(a=>a.type==="from").map(a=>a.value)),t=xt(e.filter(a=>a.type==="subject").map(a=>a.value)),s=xt(e.filter(a=>a.type==="category").map(a=>a.category)),o=xt(e.filter(a=>a.type==="isUnread"||a.type==="isRead").map(a=>a.type==="isUnread")),i=e.some(a=>a.type==="isStarred")?!0:void 0,c=e.some(a=>a.type==="hasAttachment")?!0:void 0;return{...n!==void 0?{from:n}:{},...t!==void 0?{subject:t}:{},...s!==void 0?{category:[s]}:{},...o!==void 0?{unread:o}:{},...i!==void 0?{starred:i}:{},...c!==void 0?{attachments:c}:{}}},Ki=(e,n)=>{switch(n.type){case"from":return e.from?.toLowerCase()===n.value.toLowerCase();case"subject":return e.subject?.toLowerCase()===n.value.toLowerCase();case"category":return e.category?.length===1&&e.category[0]===n.category;case"isUnread":return e.unread===!0;case"isRead":return e.unread===!1;case"isStarred":return e.starred===!0;case"hasAttachment":return e.attachments===!0;case"before":case"after":case"in":case"account":return!1}};function Vi(e,n={}){const t=Wi(e),s={...t,...n};return{params:t,residual:e.filter(o=>!Ki(s,o))}}function qi(e,n,t){if(n.length===0)return e;const s=[...n];return e.filter(o=>{const i=An(o);return Nn({...i,accountId:i.accountId??t},s)})}const Hi=50,Ui=new Map(ms().categories.filter(e=>e.id!=="all").map(e=>[e.id,e.label])),ws=l.createContext(null);function yt(){const e=l.useContext(ws);if(!e)throw new Error("MailboxPane.* must be used inside <MailboxPane>");return e}function Qi({mailboxId:e,thread:n,children:t}){const s=st(),o=n?.threadId,i=n?.messageId,a=bs()==="desktop",d=$t(),{accounts:u,searchQuery:f,intelligenceOpen:g,onToggleIntelligence:m,onSetIntelligenceOpen:S}=ns(),C=sn(),j=Io(f),T=j.length>0,{freeText:x,tokens:b}=nn(j,C),[y,I]=l.useState("all"),[k,R]=l.useState(new Set),E=l.useMemo(()=>({category:y,attributes:k}),[y,k]),_=l.useMemo(()=>_i(E),[E]),D=T||Fi(E),{params:W,residual:$}=Vi(b,_),N={order:"desc",limit:Hi,...x?{query:x}:{},...W,..._},K={category:N.category,unread:N.unread,starred:N.starred,attachments:N.attachments},se=D?Gs({path:{mailboxId:e},query:N}):Ys({path:{mailboxId:e},query:{order:"desc"}}),{data:Ie,isLoading:V,isError:We,error:le,refetch:M,fetchNextPage:we,hasNextPage:je,isFetchingNextPage:pe}=eo({queryKey:se,queryFn:async({pageParam:p})=>{if(D){const{data:U}=await en({path:{mailboxId:e},query:{...N,continuationToken:p},throwOnError:!0});return U}const{data:P}=await tn({path:{mailboxId:e},query:{order:"desc",continuationToken:p},throwOnError:!0});return P},initialPageParam:void 0,getNextPageParam:p=>p.continuationToken,placeholderData:(p,P)=>Bi(P?.queryKey,K)?p:void 0}),{accountId:z}=zn(e),xe=bo({accounts:u}),q=qi(Dn(Ni(Ie?.pages.flatMap(p=>p.items??[])??[])),$,z),Ee=l.useCallback(p=>{I(p)},[]),Oe=l.useCallback(p=>{R(P=>{const U=new Set(P);return U.has(p)?U.delete(p):U.add(p),U})},[]),me=l.useCallback(()=>{I("all"),R(new Set)},[]),Ae=Ui.get(y),ee=Ae?{label:Ae,reach:$.length>0?"loaded-pages":Li(N),onClear:me}:void 0,ne=o?q.find(p=>p.messageId===i)??q.find(p=>p.threadId===o):void 0,oe=Fn(o,i),O=ne??oe,A=i??O?.messageId,Ne=l.useMemo(()=>{if(o)return{threadId:o,mailboxId:O?.mailboxId??e,subject:O?.subject,messageId:A,authenticity:O?.authenticity}},[o,O,A,e]),H=l.useCallback(()=>{s({to:"/mail/$mailboxId",params:{mailboxId:e},search:p=>p})},[e,s]),ie=l.useCallback(p=>{s({to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:e,...p},search:P=>P})},[e,s]),J=l.useCallback(p=>{A&&p.includes(A)&&H()},[A,H]),{deleteMessages:ot,isPending:Ct}=Ht({mailboxId:e,onAfterOptimisticRemove:J}),{moveMessages:it,isPending:Ke}=Ut({mailboxId:e,accountId:z,onAfterOptimisticRemove:J}),re=_n(),{listCommandsRef:te,onTriageContextChange:rt,focusedMessageId:ke,selectedIds:w}=re,F=q.find(p=>p.messageId===ke)??O,Ve=l.useRef(null);l.useEffect(()=>{const p=O?.messageId??null;p&&Ve.current!==p&&O?.authenticity?.dkimMismatch&&(Ve.current=p,g||m())},[O?.messageId,O?.authenticity?.dkimMismatch,g,m]);const qe=l.useRef(!1);l.useEffect(()=>{qe.current||a&&O?.messageId&&(qe.current=!0,Co()&&!g&&S(!0))},[a,O?.messageId,g,S]);const Q=vo({accounts:u})??0,He=Lt(),{pushError:at}=ss(),G=Ln({thread:O,mailboxId:e,accountId:z,onAfterOptimisticRemove:J}),{draftsMailboxId:ce}=Pn(z),be=ce!==void 0&&ce===e,{archiveMailboxId:ze}=$n(z),Ue=Bn(),{requestCompose:L}=G,lt=l.useCallback(()=>{L("reply")},[L]),ae=l.useCallback(()=>{L("reply_all")},[L]),de=l.useCallback(()=>{L("forward")},[L]),{state:ue,openCompose:Qe,closeCompose:ge}=vt(),ct=l.useCallback(()=>{Qe({mode:"new"})},[Qe]),Je=l.useRef(A);l.useEffect(()=>{const p=Je.current;Je.current=A,!(!A||A===p)&&ge()},[A,ge]);const B=Pt({...ts(),onError:p=>{at(Xs("Couldn't discard draft","The draft wasn't deleted.",p))}}),It=l.useCallback(()=>{const p=ue.outboxMessageId;p&&(B.mutate({path:{outboxMessageId:p}}),He.invalidateQueries({queryKey:es()}),ge())},[ue.outboxMessageId,B,He,ge]),dt=l.useCallback(p=>p?Ue(p):[],[Ue]),{toggleStar:De}=Wn({threadId:F?.threadId??"",mailboxId:e}),{toggleReadFor:Me}=cs({mailboxId:e,accountId:z}),{junkMailboxId:ve}=ds(z),Ge=ve!=null&&ve===e,Fe=us(ve,e),{candidates:ut}=Ai(Ge?ve:void 0),{moveMessages:he}=Ut({mailboxId:e,threadId:F?.threadId,accountId:z,onAfterOptimisticRemove:J}),{deleteMessages:Ye}=Ht({mailboxId:e,threadId:F?.threadId,onAfterOptimisticRemove:J}),{addressId:Te,address:Se}=Kn(F),{updateFlags:_e}=Vn({addressId:Te,senderEmail:F?.fromEmail??void 0}),ye=l.useCallback(()=>{if(A||!ke)return!1;const p=q.find(P=>P.messageId===ke);return p?(ie({threadId:p.threadId,messageId:ke}),!0):!1},[A,ke,q,ie]),Xe=l.useCallback(()=>{ye()||O&&L("reply")},[ye,O,L]),wt=l.useCallback(()=>{ye()||O&&L("reply_all")},[ye,O,L]),jt=l.useCallback(()=>{ye()||O&&L("forward")},[ye,O,L]),Ce=l.useCallback(()=>dt(F),[dt,F]),kt=l.useCallback(()=>{if(te.current?.requestVerb("delete"))return;const p=Ce();p.length>0&&Ye(p)},[te,Ce,Ye]),Mt=l.useCallback(()=>{if(te.current?.requestVerb("junk")||!Fe)return;const p=Ce();p.length!==0&&(qn(d,{count:p.length,senderTrust:F?.senderTrust??"unknown",wasRescuable:F?Hn(F):!1}),he(p,Fe))},[te,Fe,Ce,he,d,F]),Tt=l.useCallback(()=>{if(w.length>0){const p=!(F?.hasStars??!1),P=new Set(w);for(const U of q)P.has(U.messageId)&&U.hasStars!==p&&De(U.messageId,U.hasStars);return}F&&De(F.messageId,F.hasStars)},[w,q,F,De]),ht=l.useCallback(()=>{if(te.current?.requestVerb("markRead"))return;const p=Ce();if(p.length===0)return;const P=!(F?.isRead??!1);Me(p,P)},[te,Ce,F,Me]),ft=l.useCallback(()=>{if(!Te)return;const p=Se?.flags?.muted?.value!==!0;_e({muted:{value:p}})},[Te,Se,_e]),mt=l.useCallback(()=>{if(!Te)return;const p=Se?.flags?.vip?.value!==!0;_e({vip:{value:p}})},[Te,Se,_e]),Rt=l.useCallback(()=>{g||m()},[g,m]),Re=l.useCallback(p=>{s({to:p})},[s]),gt=be?"drafts":ze===e?"archive":ve===e?"junk":"inbox",Le=l.useRef("");l.useEffect(()=>{const p=Le.current;Le.current=j,j.length>0&&p.length===0&&d.recordEvent("search.submitted",{mailboxType:gt})},[j,gt,d]);const Et=be&&ue.isOpen&&!!ue.outboxMessageId&&!O,{goBack:Ot,nextMessageId:Ze,previousMessageId:At}=Un({context:re,orderedIds:q.map(p=>p.messageId),selectedMessageId:A,enabled:!ue.isOpen,onClose:H,handlers:{reply:Xe,replyAll:wt,forward:jt,delete:kt,toggleStar:Tt,toggleRead:ht,muteSender:ft,blockSender:Rt,vipSender:mt,markJunk:Mt,toggleIntelligence:O?m:void 0,compose:ct,goBrief:()=>Re("/mail/brief"),goInbox:()=>Re("/mail/brief"),goSent:()=>Re("/mail/brief"),goFlagged:()=>Re("/mail/flagged"),goSettings:()=>Re("/settings")}});So({enabled:ue.isOpen,bindings:[{key:"Escape",handler:ge,preventDefault:!0}]});const pt=p=>{if(!p)return;const P=q.find(U=>U.messageId===p);return P?{threadId:P.threadId,messageId:p}:void 0},Nt={mailboxId:e,selectedMessageId:A,selectedThread:O,conversation:Ne,onOpenThread:ie,threads:q,isLoading:V,isError:We,error:le,mailboxAccountId:z,mailboxName:xe,unreadCount:Q,isDraftsMailbox:be,isSpamFolder:Ge,rescueCandidates:ut,filterCategory:y,filterAttributes:k,onSelectFilterCategory:Ee,onToggleFilterAttribute:Oe,onClearFilters:me,listFilter:ee,intelligenceOpen:g,onToggleIntelligence:m,handleDeselectIfRemoved:J,searchPredicate:T&&$.length===0?N:void 0,onDeleteMessages:ot,onMoveMessages:it,isDeleting:Ct,isMoving:Ke,onLoadMore:we,hasMore:je,isLoadingMore:pe,onTriageContextChange:rt,listCommandsRef:te,onRetry:()=>M(),toolbarComposeRequest:G.composeRequest,onToolbarReply:lt,onToolbarReplyAll:ae,onToolbarForward:de,onClearComposeRequest:G.clearComposeRequest,onToolbarDelete:G.deleteThread,onToolbarStar:G.toggleStar,onToolbarDiscardDraft:It,onToolbarMove:G.moveThread,composeState:ue,closeCompose:ge,hasRemitDraftOpen:Et,onBack:Ot,nextThread:pt(Ze),previousThread:pt(At)};return r.jsx(ws.Provider,{value:Nt,children:t})}function js(){const{mailboxId:e,selectedMessageId:n,threads:t,isLoading:s,isError:o,error:i,onDeleteMessages:c,onMoveMessages:a,isDeleting:d,isMoving:u,onLoadMore:f,hasMore:g,isLoadingMore:m,mailboxAccountId:S,mailboxName:C,unreadCount:j,isDraftsMailbox:T,isSpamFolder:x,rescueCandidates:b,onTriageContextChange:y,listCommandsRef:I,onRetry:k,filterCategory:R,filterAttributes:E,onSelectFilterCategory:_,onToggleFilterAttribute:D,onClearFilters:W,listFilter:$,searchPredicate:N}=yt(),{searchQuery:K,searchInput:se,accounts:Ie,resultFolderIndex:V}=ns(),We=bs(),le=st(),M=C??"Inbox",we=l.useMemo(()=>ms(),[]),je=l.useMemo(()=>S?[S]:[],[S]),{hasNewMail:pe}=rn(),{state:z,errorMessage:xe,refresh:q}=an(je,{onSettled:k}),Ee=l.useMemo(()=>r.jsx(ln,{state:z,onRefresh:q,label:`Refresh ${M}`,errorMessage:xe,hasUpdate:pe(je)}),[z,q,M,xe,pe,je]),Oe=l.useMemo(()=>t.map(H=>Jn(H,V)),[t,V]),{hits:me,isLoading:Ae}=lo({mailboxId:e,filterCategory:R}),ee=l.useMemo(()=>Gn(me,t.map(H=>H.threadId),V),[me,t,V]),ne=l.useCallback(H=>{const ie=H.threadId??t.find(J=>J.messageId===H.id)?.threadId;ie&&le({to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:H.mailboxId??e,threadId:ie,messageId:H.id},search:J=>({...J,q:se||void 0})})},[e,le,se,t]);if(T&&S)return r.jsx(Qo,{mailboxId:e,accountId:S,selectedMessageId:n,imapThreads:t,title:C??"Drafts",unreadCount:j??void 0});const oe=r.jsx(ki,{mailboxId:e,threads:t,selectedMessageId:n,isLoading:s,isError:o,error:i,onRetry:k,searchQuery:K,searchPredicate:N,onDeleteMessages:c,isDeleting:d,isMoving:u,onLoadMore:f,hasMore:g,isLoadingMore:m,accountId:S,listTitle:M,listFilter:$,listScopeLabel:M,hideHeader:!0,onTriageContextChange:y,commandsRef:I}),O=Ie[0]?.accountId,A=We==="phone"&&O?r.jsx(Ri,{accountId:O,children:oe}):oe,Ne=x&&b.length>0&&S?r.jsx(Ei,{accountId:S,currentMailboxId:e,candidates:b,onMove:a,children:A}):A;return r.jsx(to,{title:M,unreadCount:j,preset:we,selectedCategory:R,activeFilters:E,onSelectCategory:_,onToggleFilter:D,onClearFilters:W,searchResults:Oe,searchLoading:s,relatedResults:ee,relatedLoading:Ae,onSelectSearchResult:ne,searchResultsInBody:!0,refreshControl:Ee,children:Ne})}function Ji(){const{mailboxId:e,mailboxAccountId:n,selectedThread:t,conversation:s,hasRemitDraftOpen:o,intelligenceOpen:i,onToggleIntelligence:c,toolbarComposeRequest:a,onToolbarReply:d,onToolbarReplyAll:u,onToolbarForward:f,onClearComposeRequest:g,onToolbarDelete:m,onToolbarStar:S,onToolbarDiscardDraft:C,onToolbarMove:j,composeState:T,handleDeselectIfRemoved:x}=yt(),b=Zs()?.showIntelligencePane??!1,y=!!s,[I,k]=l.useState(null),R=s?.threadId??null,E=!b&&R!==null&&I===R,_=l.useCallback(()=>k(null),[]),D=l.useCallback(()=>k(R),[R]),W=b?c:D,$=l.useCallback(()=>{if(b){c();return}k(E?null:R)},[b,c,E,R]),N=y&&(b?i:E),K=T.isOpen&&!s?r.jsx(Ss,{}):s?r.jsx(hs,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,authenticity:s.authenticity,onOpenIntelligence:s.authenticity?.dkimMismatch?W:void 0,composeRequest:a,onComposeClose:g}):r.jsx(on,{});return r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[r.jsx(Qn,{hasThread:y,intelligenceOpen:N,canToggleIntelligence:y,onToggleIntelligence:$,onReply:y?d:void 0,onReplyAll:y?u:void 0,onForward:y?f:void 0,canDelete:y||o,onDelete:y?m:o?C:void 0,onToggleStar:y?S:void 0,isStarred:t?.hasStars,moveContext:y&&n?{accountId:n,currentMailboxId:e,onMove:j}:void 0}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:K})]}),r.jsx(fs,{isOpen:E,onClose:_,ariaLabel:"Message details",side:"right",children:r.jsx(Bt,{onClose:_,thread:t,mailboxId:e,accountId:n,hideCloseButton:!0,onAfterOptimisticRemove:x})})]})}function Gi(){const{mailboxId:e,mailboxAccountId:n,selectedThread:t,onToggleIntelligence:s,handleDeselectIfRemoved:o}=yt();return r.jsx(Bt,{onClose:s,thread:t,mailboxId:e,accountId:n,onAfterOptimisticRemove:o})}function Yi(){const{mailboxId:e,mailboxAccountId:n,selectedThread:t,conversation:s,onOpenThread:o,intelligenceOpen:i,onToggleIntelligence:c,onBack:a,nextThread:d,previousThread:u,composeState:f,handleDeselectIfRemoved:g}=yt();return s?r.jsxs(r.Fragment,{children:[r.jsx(hs,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,authenticity:s.authenticity,onBack:a,onOpenIntelligence:c,onSwipeNext:d?()=>o(d):void 0,onSwipePrevious:u?()=>o(u):void 0,mobileIntelligenceOpen:i}),r.jsx(fs,{isOpen:i,onClose:c,ariaLabel:"Message details",side:"right",children:r.jsx(Bt,{onClose:c,thread:t,mailboxId:e,accountId:n,hideCloseButton:!0,onAfterOptimisticRemove:g})})]}):f.isOpen?r.jsx("div",{className:"h-full",children:r.jsx(Ss,{})}):r.jsx(js,{})}const Cr=Object.assign(Qi,{List:js,Reading:Ji,Intelligence:Gi,Phone:Yi});export{Cr as M};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ab as C,e as w,an as k,j as s,b,bR as q,T as H,f as S,p as K,x as W,y as G,o as J,r as m,u as R,bJ as A,bU as V,K as N,s as X,k as Y,ad as Z,bg as ee,af as v,ag as y,cf as se,bh as te}from"./index-Dz5Qyak4.js";import{u as ne,p as ae,R as p,g as oe}from"./useSearchTokenContext-4dsgVPv9.js";import{C as I}from"./circle-check-big-B_JaD3Sd.js";import{C as T}from"./clock-B4cFFCTA.js";import{R as re}from"./row-actions-CmfExpmx.js";import{R as ie}from"./rotate-ccw-h15XAO1t.js";import{N as E}from"./NavMenuButton-BhD3j6Q3.js";import{a as g,t as le}from"./format-De9HZKjg.js";import{i as ce,a as L}from"./outbox-status-CPfNHfUQ.js";import{n as de}from"./search-query-Cr_ZXBCp.js";const ue={queued:{icon:T,label:"Queued",className:"text-warning"},sending:{icon:k,label:"Sending…",className:"text-accent-2",spin:!0},sent:{icon:I,label:"Sent",className:"text-positive"},failed:{icon:w,label:"Failed",className:"text-danger"},blocked:{icon:C,label:"Blocked",className:"text-warning"}};function M({status:e,iconOnly:n,className:a}){const t=ue[e],o=t.icon;return s.jsxs("span",{className:b("inline-flex items-center gap-1.5 text-xs font-medium",t.className,a),children:[s.jsx(o,{className:b("size-4",t.spin&&"animate-spin")}),!n&&t.label]})}const xe=(e,n)=>n?"bg-accent-2-soft":e==="failed"?"bg-danger-soft":e==="blocked"?"bg-warning/10":"";function me({recipients:e,subject:n,time:a,status:t,error:o,selected:i,onSelect:c,onRetry:r,retrying:d,onEdit:l,onDelete:f,deleting:u}){const h=t==="failed"||t==="blocked";return s.jsxs("div",{className:b("flex items-start gap-3 border-b border-line px-4 py-3 transition-colors hover:bg-surface-raised",xe(t,i)),children:[s.jsxs("button",{type:"button",...q,onClick:c,className:"flex flex-1 min-w-0 items-start gap-3 text-left",children:[s.jsx("div",{className:"mt-0.5 shrink-0",children:s.jsx(M,{status:t,iconOnly:!0})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"truncate text-sm font-medium",children:e}),s.jsx("span",{className:"shrink-0 text-xs text-fg-muted",children:a})]}),s.jsx("div",{className:"truncate text-sm",children:n||"No subject"}),s.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[s.jsx(M,{status:t}),o&&s.jsxs("span",{className:"truncate text-xs text-fg-muted",children:["— ",o]})]})]})]}),h&&s.jsx("div",{className:"shrink-0",children:s.jsx(re,{actions:[...t==="failed"&&r?[{label:"Retry sending",iconOnly:!0,icon:s.jsx(ie,{className:"size-3.5"}),busy:d,onClick:r}]:[],{label:"Edit as draft",iconOnly:!0,icon:s.jsx(S,{className:"size-3.5"}),onClick:l}],destructive:{label:"Delete message",iconOnly:!0,icon:s.jsx(H,{className:"size-3.5"}),busy:u,confirm:{prompt:"Delete this message?",confirmLabel:"Delete"},onClick:f}})})]})}function fe(e,n){const a=n.trim().toLowerCase();if(a.length===0)return!0;const t=[e.subject,e.fromAddress,e.fromName,...e.toAddresses??[],...e.ccAddresses??[]].filter(o=>typeof o=="string").join(" ").toLowerCase();return a.split(/\s+/).every(o=>o.length===0||t.includes(o))}function he(e){return e.tokens.length>0&&e.freeText.trim().length===0}const Q={queued:{icon:T,label:"Queued",className:"text-warning"},sending:{icon:k,label:"Sending…",className:"text-accent-2"},sent:{icon:I,label:"Sent",className:"text-positive"},failed:{icon:w,label:"Failed",className:"text-danger"},blocked:{icon:C,label:"Blocked",className:"text-warning"}},be=e=>le(e).toDateString()===new Date().toDateString()?g(e,{hour:"numeric",minute:"2-digit"}):g(e,{month:"short",day:"numeric"}),O=e=>g(e,{dateStyle:"medium",timeStyle:"short"}),ge=e=>{const n=e.toAddresses??[];return n.length===0?"No recipients":n.length===1?n[0]:`${n[0]} +${n.length-1}`},D=(e,n)=>n?"The outbox cannot filter on those terms":e?"No matching outbox messages":"No outbox messages",P=m.createContext(null);function j(){const e=m.useContext(P);if(!e)throw new Error("OutboxPane.* must be used inside <OutboxPane>");return e}function pe({outboxMessageId:e,children:n}){const a=K(),{data:t,isLoading:o}=W(G()),{searchQuery:i}=J(),c=ne(),r=de(i),d=ae(r,c),l=r.length>0,f=he(d),u=m.useMemo(()=>f?[]:(t?.items??[]).filter(x=>ce(x.status)).filter(x=>fe(x,d.freeText)),[t,d.freeText,f]),h=m.useMemo(()=>u.find(x=>x.outboxMessageId===e),[u,e]),F=m.useCallback(x=>{a({to:"/mail/outbox/draft/$outboxMessageId",params:{outboxMessageId:x},search:_=>_})},[a]),$=m.useCallback(()=>{a({to:"/mail/outbox",search:x=>x})},[a]),U={messages:u,hasQuery:l,unsupportedQuery:f,isLoading:o,selectedMessageId:e,selectedMessage:h,onOpenMessage:F,onCloseMessage:$};return s.jsx(P.Provider,{value:U,children:n})}function B({message:e,isSelected:n,onSelect:a}){const t=X(),{openCompose:o}=Y(),{pushError:i}=Z(),c=m.useCallback(()=>{t.invalidateQueries({queryKey:ee()})},[t]),r=v({...se(),onSuccess:c,onError:u=>{i(y("Couldn't resend message","The message wasn't sent.",u))}}),d=v({...te(),onSuccess:c,onError:u=>{i(y("Couldn't delete message","The message wasn't deleted.",u))}}),l=e.status;if(!Q[l])return null;const f=L(e.status);return s.jsx(me,{recipients:ge(e),subject:e.subject||"",time:be(e.sentAt??e.updatedAt),status:l,error:f?e.lastError??void 0:void 0,selected:n,onSelect:a,onRetry:l==="failed"?()=>r.mutate({path:{outboxMessageId:e.outboxMessageId}}):void 0,retrying:r.isPending,onEdit:()=>o({mode:"new",outboxMessageId:e.outboxMessageId}),onDelete:()=>d.mutate({path:{outboxMessageId:e.outboxMessageId}}),deleting:d.isPending})}function z({message:e,onBack:n}){const a=e.status,t=Q[a],o=t?.icon??S,i=e.sentAt?O(e.sentAt):O(e.updatedAt);return s.jsxs("div",{className:"h-full overflow-y-auto bg-canvas",children:[s.jsxs("div",{className:"border-b border-line p-4",children:[n&&s.jsxs("button",{type:"button",onClick:n,className:"mb-3 inline-flex items-center gap-1 text-sm text-fg-muted hover:text-fg",children:[s.jsx(V,{className:"size-4"}),s.jsx("span",{children:"Back"})]}),s.jsx("h1",{className:"text-xl font-semibold mb-3",children:e.subject||"(No subject)"}),s.jsxs("div",{className:"space-y-1 text-sm",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"From:"}),s.jsx("span",{className:"text-fg",children:e.fromName?`${e.fromName} <${e.fromAddress}>`:e.fromAddress})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"To:"}),s.jsx("span",{className:"text-fg",children:(e.toAddresses??[]).join(", ")})]}),e.ccAddresses&&e.ccAddresses.length>0&&s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"Cc:"}),s.jsx("span",{className:"text-fg",children:e.ccAddresses.join(", ")})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"Date:"}),s.jsx("span",{className:"text-fg",children:i})]}),t&&s.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[s.jsx(o,{className:N("size-4",t.className,a==="sending"&&"animate-spin")}),s.jsx("span",{className:N("text-xs font-medium",t.className),children:t.label}),L(e.status)&&e.lastError&&s.jsxs("span",{className:"text-xs text-fg-muted",children:["— ",e.lastError]})]})]})]}),s.jsx("div",{className:"p-4",children:s.jsx(oe,{html:e.htmlBody,text:e.textBody})})]})}function je(){const{messages:e,hasQuery:n,unsupportedQuery:a,isLoading:t,selectedMessageId:o,onOpenMessage:i}=j(),c=m.useRef(null);return R({containerRef:c,itemSelector:A}),t?s.jsx("div",{className:"flex h-full items-center justify-center bg-canvas",children:s.jsx("span",{className:"text-fg-muted",children:"Loading..."})}):e.length===0?s.jsx("div",{className:"flex h-full bg-surface",children:s.jsx(p,{message:D(n,a),showHints:!1})}):s.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[s.jsx(E,{}),s.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:"Outbox"}),s.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:[e.length," ",e.length===1?"message":"messages"]})]}),s.jsx("div",{ref:c,className:"flex-1 overflow-y-auto",children:e.map(r=>s.jsx(B,{message:r,isSelected:o===r.outboxMessageId,onSelect:()=>i(r.outboxMessageId)},r.outboxMessageId))})]})}function Ne(){const{selectedMessage:e}=j();return s.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[s.jsx("header",{className:"flex h-pane-header shrink-0 items-center border-b border-line px-3"}),s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?s.jsx(z,{message:e}):s.jsx(p,{message:"Select a message to read",showHints:!1})})]})}function ve(){const{messages:e,hasQuery:n,unsupportedQuery:a,isLoading:t,selectedMessageId:o,selectedMessage:i,onOpenMessage:c,onCloseMessage:r}=j(),d=m.useRef(null);return R({containerRef:d,itemSelector:A}),t?s.jsx("div",{className:"flex h-full items-center justify-center bg-canvas",children:s.jsx("span",{className:"text-fg-muted",children:"Loading..."})}):i?s.jsx(z,{message:i,onBack:r}):e.length===0?s.jsx("div",{className:"flex h-full bg-surface",children:s.jsx(p,{message:D(n,a),showHints:!1})}):s.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[s.jsx(E,{}),s.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:"Outbox"}),s.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:[e.length," ",e.length===1?"message":"messages"]})]}),s.jsx("div",{ref:d,className:"flex-1 overflow-y-auto",children:e.map(l=>s.jsx(B,{message:l,isSelected:o===l.outboxMessageId,onSelect:()=>c(l.outboxMessageId)},l.outboxMessageId))})]})}const Te=Object.assign(pe,{List:je,Reading:Ne,Phone:ve});export{Te as O};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a3 as m,j as o,a0 as p}from"./index-Dz5Qyak4.js";import{a}from"./search-view-Ddk04xwo.js";import{M as r}from"./MailboxPane-CX39NKSW.js";import{u as e}from"./useSearchMirror-wZyUq8Ug.js";import"./nav-link-DyM-GREt.js";import{u as s}from"./MailListHeader-CjWw8PVT.js";import"./useSearchTokenContext-4dsgVPv9.js";import"./kbd-Bvbu8R4A.js";import"./enums-CCxx0t2v.js";import"./search-scope-5OC8b_q5.js";import"./useRefreshControl-B4VEe-8O.js";import"./circle-check-big-B_JaD3Sd.js";import"./search-token-index-Cp2XNfYr.js";import"./use-match-media-BSj_MlsI.js";import"./MailViewChrome-CChh5YGY.js";import"./avatar-DIgxxjJo.js";import"./account-form-helpers-C48ralIn.js";import"./menu-BtgYxp2K.js";import"./ErrorState-DUgckKDx.js";import"./useFilters-YnuG5yKw.js";import"./confirm-dialog-CJ9HhvTw.js";import"./format-De9HZKjg.js";import"./NavMenuButton-BhD3j6Q3.js";import"./useLabels-DR8CZ_pi.js";import"./useSemanticSearch-2KSWUDT_.js";import"./search-query-Cr_ZXBCp.js";import"./shield-check-VtnsP_QR.js";import"./bottom-sheet-BChq8GeA.js";import"./circle-help-CYbymNEq.js";import"./circle-check-KZs1xW98.js";import"./move-options-vvEZxrXg.js";import"./intelligence-pref-C6lFpj6U.js";import"./useSignature-Cgb8x2A1.js";import"./useDebouncedValue-CW8js2xx.js";import"./download-BzZgIdQm.js";import"./clock-B4cFFCTA.js";function N(){const{mailboxId:t}=m.useParams(),i=s();return e({to:"/mail/$mailboxId",params:{mailboxId:t}}),o.jsx(r,{mailboxId:t,thread:i,children:o.jsx(a,{phone:o.jsx(r.Phone,{}),list:o.jsx(r.List,{}),reading:o.jsx(p,{}),intelligence:o.jsx(r.Intelligence,{}),hasThread:!!i})})}export{N as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-Dz5Qyak4.js";import{F as r}from"./FlaggedPane-B1ZaTYX6.js";import"./useSearchTokenContext-4dsgVPv9.js";import"./kbd-Bvbu8R4A.js";import"./enums-CCxx0t2v.js";import"./search-scope-5OC8b_q5.js";import"./MailListHeader-CjWw8PVT.js";import"./search-token-index-Cp2XNfYr.js";import"./use-match-media-BSj_MlsI.js";import"./account-form-helpers-C48ralIn.js";import"./avatar-DIgxxjJo.js";import"./useSignature-Cgb8x2A1.js";import"./useDebouncedValue-CW8js2xx.js";import"./useFilters-YnuG5yKw.js";import"./ErrorState-DUgckKDx.js";import"./format-De9HZKjg.js";import"./nav-link-DyM-GREt.js";import"./download-BzZgIdQm.js";import"./shield-check-VtnsP_QR.js";import"./move-options-vvEZxrXg.js";import"./confirm-dialog-CJ9HhvTw.js";import"./clock-B4cFFCTA.js";import"./menu-BtgYxp2K.js";import"./MailViewChrome-CChh5YGY.js";function q(){return o.jsx(r.Reading,{})}export{q as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./index-Dz5Qyak4.js";import{B as o}from"./BriefPane-Cv6V98kK.js";import"./useSearchTokenContext-4dsgVPv9.js";import"./kbd-Bvbu8R4A.js";import"./enums-CCxx0t2v.js";import"./search-scope-5OC8b_q5.js";import"./MailListHeader-CjWw8PVT.js";import"./search-token-index-Cp2XNfYr.js";import"./use-match-media-BSj_MlsI.js";import"./account-form-helpers-C48ralIn.js";import"./avatar-DIgxxjJo.js";import"./useSignature-Cgb8x2A1.js";import"./useDebouncedValue-CW8js2xx.js";import"./useFilters-YnuG5yKw.js";import"./ErrorState-DUgckKDx.js";import"./format-De9HZKjg.js";import"./nav-link-DyM-GREt.js";import"./download-BzZgIdQm.js";import"./shield-check-VtnsP_QR.js";import"./move-options-vvEZxrXg.js";import"./confirm-dialog-CJ9HhvTw.js";import"./clock-B4cFFCTA.js";import"./menu-BtgYxp2K.js";import"./useRefreshControl-B4VEe-8O.js";import"./circle-check-big-B_JaD3Sd.js";import"./useLabels-DR8CZ_pi.js";import"./useSemanticSearch-2KSWUDT_.js";import"./search-query-Cr_ZXBCp.js";function z(){return r.jsx(o.Reading,{})}export{z as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-Dz5Qyak4.js";import{M as r}from"./MailboxPane-CX39NKSW.js";import"./useSearchTokenContext-4dsgVPv9.js";import"./kbd-Bvbu8R4A.js";import"./enums-CCxx0t2v.js";import"./search-scope-5OC8b_q5.js";import"./useRefreshControl-B4VEe-8O.js";import"./circle-check-big-B_JaD3Sd.js";import"./search-token-index-Cp2XNfYr.js";import"./use-match-media-BSj_MlsI.js";import"./MailListHeader-CjWw8PVT.js";import"./account-form-helpers-C48ralIn.js";import"./avatar-DIgxxjJo.js";import"./useSignature-Cgb8x2A1.js";import"./useDebouncedValue-CW8js2xx.js";import"./useFilters-YnuG5yKw.js";import"./ErrorState-DUgckKDx.js";import"./format-De9HZKjg.js";import"./nav-link-DyM-GREt.js";import"./download-BzZgIdQm.js";import"./shield-check-VtnsP_QR.js";import"./move-options-vvEZxrXg.js";import"./confirm-dialog-CJ9HhvTw.js";import"./clock-B4cFFCTA.js";import"./menu-BtgYxp2K.js";import"./MailViewChrome-CChh5YGY.js";import"./NavMenuButton-BhD3j6Q3.js";import"./useLabels-DR8CZ_pi.js";import"./useSemanticSearch-2KSWUDT_.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-BChq8GeA.js";import"./circle-help-CYbymNEq.js";import"./circle-check-KZs1xW98.js";import"./intelligence-pref-C6lFpj6U.js";function H(){return o.jsx(r.Reading,{})}export{H as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-Dz5Qyak4.js";import{O as t}from"./OutboxPane-D644CAzB.js";import"./useSearchTokenContext-4dsgVPv9.js";import"./kbd-Bvbu8R4A.js";import"./enums-CCxx0t2v.js";import"./search-scope-5OC8b_q5.js";import"./circle-check-big-B_JaD3Sd.js";import"./clock-B4cFFCTA.js";import"./row-actions-CmfExpmx.js";import"./rotate-ccw-h15XAO1t.js";import"./NavMenuButton-BhD3j6Q3.js";import"./menu-BtgYxp2K.js";import"./format-De9HZKjg.js";import"./outbox-status-CPfNHfUQ.js";import"./search-query-Cr_ZXBCp.js";function P(){return o.jsx(t.Reading,{})}export{P as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a0 as o}from"./index-Dz5Qyak4.js";const n=o;export{n as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a0 as o}from"./index-Dz5Qyak4.js";const n=o;export{n as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a0 as o}from"./index-Dz5Qyak4.js";const n=o;export{n as component};
|
package/assets/brief-CRRHnwLW.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r,a0 as i}from"./index-Dz5Qyak4.js";import{a as m}from"./search-view-Ddk04xwo.js";import{B as o}from"./BriefPane-Cv6V98kK.js";import{u as p}from"./useSearchMirror-wZyUq8Ug.js";import"./nav-link-DyM-GREt.js";import{u as e}from"./MailListHeader-CjWw8PVT.js";import"./useSearchTokenContext-4dsgVPv9.js";import"./kbd-Bvbu8R4A.js";import"./enums-CCxx0t2v.js";import"./search-scope-5OC8b_q5.js";import"./useRefreshControl-B4VEe-8O.js";import"./circle-check-big-B_JaD3Sd.js";import"./search-token-index-Cp2XNfYr.js";import"./use-match-media-BSj_MlsI.js";import"./useLabels-DR8CZ_pi.js";import"./useFilters-YnuG5yKw.js";import"./useSemanticSearch-2KSWUDT_.js";import"./search-query-Cr_ZXBCp.js";import"./account-form-helpers-C48ralIn.js";import"./avatar-DIgxxjJo.js";import"./useSignature-Cgb8x2A1.js";import"./useDebouncedValue-CW8js2xx.js";import"./ErrorState-DUgckKDx.js";import"./format-De9HZKjg.js";import"./download-BzZgIdQm.js";import"./shield-check-VtnsP_QR.js";import"./move-options-vvEZxrXg.js";import"./confirm-dialog-CJ9HhvTw.js";import"./clock-B4cFFCTA.js";import"./menu-BtgYxp2K.js";function C(){const t=e();return p({to:"/mail/brief"}),r.jsx(o,{thread:t,children:r.jsx(m,{phone:r.jsx(o.Phone,{}),list:r.jsx(o.List,{}),reading:r.jsx(i,{}),intelligence:r.jsx(o.Intelligence,{}),hasThread:!!t})})}export{C as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o,a0 as i}from"./index-Dz5Qyak4.js";import{a as m}from"./search-view-Ddk04xwo.js";import{F as r}from"./FlaggedPane-B1ZaTYX6.js";import{u as p}from"./useSearchMirror-wZyUq8Ug.js";import"./nav-link-DyM-GREt.js";import{u as e}from"./MailListHeader-CjWw8PVT.js";import"./useSearchTokenContext-4dsgVPv9.js";import"./kbd-Bvbu8R4A.js";import"./enums-CCxx0t2v.js";import"./search-scope-5OC8b_q5.js";import"./MailViewChrome-CChh5YGY.js";import"./search-token-index-Cp2XNfYr.js";import"./use-match-media-BSj_MlsI.js";import"./avatar-DIgxxjJo.js";import"./account-form-helpers-C48ralIn.js";import"./menu-BtgYxp2K.js";import"./ErrorState-DUgckKDx.js";import"./useFilters-YnuG5yKw.js";import"./useSignature-Cgb8x2A1.js";import"./useDebouncedValue-CW8js2xx.js";import"./format-De9HZKjg.js";import"./download-BzZgIdQm.js";import"./shield-check-VtnsP_QR.js";import"./move-options-vvEZxrXg.js";import"./confirm-dialog-CJ9HhvTw.js";import"./clock-B4cFFCTA.js";function q(){const t=e();return p({to:"/mail/flagged"}),o.jsx(r,{thread:t,children:o.jsx(m,{phone:o.jsx(r.Phone,{}),list:o.jsx(r.List,{}),reading:o.jsx(i,{}),intelligence:o.jsx(r.Intelligence,{}),hasThread:!!t})})}export{q as component};
|
package/assets/index--WOliKqi.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-Dz5Qyak4.js";import{M as r}from"./MailboxPane-CX39NKSW.js";import"./useSearchTokenContext-4dsgVPv9.js";import"./kbd-Bvbu8R4A.js";import"./enums-CCxx0t2v.js";import"./search-scope-5OC8b_q5.js";import"./useRefreshControl-B4VEe-8O.js";import"./circle-check-big-B_JaD3Sd.js";import"./search-token-index-Cp2XNfYr.js";import"./use-match-media-BSj_MlsI.js";import"./MailListHeader-CjWw8PVT.js";import"./account-form-helpers-C48ralIn.js";import"./avatar-DIgxxjJo.js";import"./useSignature-Cgb8x2A1.js";import"./useDebouncedValue-CW8js2xx.js";import"./useFilters-YnuG5yKw.js";import"./ErrorState-DUgckKDx.js";import"./format-De9HZKjg.js";import"./nav-link-DyM-GREt.js";import"./download-BzZgIdQm.js";import"./shield-check-VtnsP_QR.js";import"./move-options-vvEZxrXg.js";import"./confirm-dialog-CJ9HhvTw.js";import"./clock-B4cFFCTA.js";import"./menu-BtgYxp2K.js";import"./MailViewChrome-CChh5YGY.js";import"./NavMenuButton-BhD3j6Q3.js";import"./useLabels-DR8CZ_pi.js";import"./useSemanticSearch-2KSWUDT_.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-BChq8GeA.js";import"./circle-help-CYbymNEq.js";import"./circle-check-KZs1xW98.js";import"./intelligence-pref-C6lFpj6U.js";function G(){return o.jsx(r.Reading,{})}export{G as component};
|
package/assets/index-BzMiohkw.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-Dz5Qyak4.js";import{F as r}from"./FlaggedPane-B1ZaTYX6.js";import"./useSearchTokenContext-4dsgVPv9.js";import"./kbd-Bvbu8R4A.js";import"./enums-CCxx0t2v.js";import"./search-scope-5OC8b_q5.js";import"./MailListHeader-CjWw8PVT.js";import"./search-token-index-Cp2XNfYr.js";import"./use-match-media-BSj_MlsI.js";import"./account-form-helpers-C48ralIn.js";import"./avatar-DIgxxjJo.js";import"./useSignature-Cgb8x2A1.js";import"./useDebouncedValue-CW8js2xx.js";import"./useFilters-YnuG5yKw.js";import"./ErrorState-DUgckKDx.js";import"./format-De9HZKjg.js";import"./nav-link-DyM-GREt.js";import"./download-BzZgIdQm.js";import"./shield-check-VtnsP_QR.js";import"./move-options-vvEZxrXg.js";import"./confirm-dialog-CJ9HhvTw.js";import"./clock-B4cFFCTA.js";import"./menu-BtgYxp2K.js";import"./MailViewChrome-CChh5YGY.js";function q(){return o.jsx(r.Reading,{})}export{q as component};
|
package/assets/index-ChN8WSHb.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-Dz5Qyak4.js";import{O as t}from"./OutboxPane-D644CAzB.js";import"./useSearchTokenContext-4dsgVPv9.js";import"./kbd-Bvbu8R4A.js";import"./enums-CCxx0t2v.js";import"./search-scope-5OC8b_q5.js";import"./circle-check-big-B_JaD3Sd.js";import"./clock-B4cFFCTA.js";import"./row-actions-CmfExpmx.js";import"./rotate-ccw-h15XAO1t.js";import"./NavMenuButton-BhD3j6Q3.js";import"./menu-BtgYxp2K.js";import"./format-De9HZKjg.js";import"./outbox-status-CPfNHfUQ.js";import"./search-query-Cr_ZXBCp.js";function c(){return o.jsx(t.Reading,{})}export{c as component};
|
package/assets/index-D3kom_w5.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./index-Dz5Qyak4.js";import{B as o}from"./BriefPane-Cv6V98kK.js";import"./useSearchTokenContext-4dsgVPv9.js";import"./kbd-Bvbu8R4A.js";import"./enums-CCxx0t2v.js";import"./search-scope-5OC8b_q5.js";import"./MailListHeader-CjWw8PVT.js";import"./search-token-index-Cp2XNfYr.js";import"./use-match-media-BSj_MlsI.js";import"./account-form-helpers-C48ralIn.js";import"./avatar-DIgxxjJo.js";import"./useSignature-Cgb8x2A1.js";import"./useDebouncedValue-CW8js2xx.js";import"./useFilters-YnuG5yKw.js";import"./ErrorState-DUgckKDx.js";import"./format-De9HZKjg.js";import"./nav-link-DyM-GREt.js";import"./download-BzZgIdQm.js";import"./shield-check-VtnsP_QR.js";import"./move-options-vvEZxrXg.js";import"./confirm-dialog-CJ9HhvTw.js";import"./clock-B4cFFCTA.js";import"./menu-BtgYxp2K.js";import"./useRefreshControl-B4VEe-8O.js";import"./circle-check-big-B_JaD3Sd.js";import"./useLabels-DR8CZ_pi.js";import"./useSemanticSearch-2KSWUDT_.js";import"./search-query-Cr_ZXBCp.js";function z(){return r.jsx(o.Reading,{})}export{z as component};
|
package/assets/index-DM8qsDHp.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t,a7 as o}from"./index-Dz5Qyak4.js";const n=()=>t.jsx(o,{to:"/settings/accounts"});export{n as component};
|
package/assets/index-Dy2broY0.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-Dz5Qyak4.js";import{F as r}from"./FlaggedPane-B1ZaTYX6.js";import"./useSearchTokenContext-4dsgVPv9.js";import"./kbd-Bvbu8R4A.js";import"./enums-CCxx0t2v.js";import"./search-scope-5OC8b_q5.js";import"./MailListHeader-CjWw8PVT.js";import"./search-token-index-Cp2XNfYr.js";import"./use-match-media-BSj_MlsI.js";import"./account-form-helpers-C48ralIn.js";import"./avatar-DIgxxjJo.js";import"./useSignature-Cgb8x2A1.js";import"./useDebouncedValue-CW8js2xx.js";import"./useFilters-YnuG5yKw.js";import"./ErrorState-DUgckKDx.js";import"./format-De9HZKjg.js";import"./nav-link-DyM-GREt.js";import"./download-BzZgIdQm.js";import"./shield-check-VtnsP_QR.js";import"./move-options-vvEZxrXg.js";import"./confirm-dialog-CJ9HhvTw.js";import"./clock-B4cFFCTA.js";import"./menu-BtgYxp2K.js";import"./MailViewChrome-CChh5YGY.js";function v(){return o.jsx(r.Reading,{})}export{v as component};
|
package/assets/index-FdIYPgjj.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-Dz5Qyak4.js";import{M as i}from"./MailboxPane-CX39NKSW.js";import"./useSearchTokenContext-4dsgVPv9.js";import"./kbd-Bvbu8R4A.js";import"./enums-CCxx0t2v.js";import"./search-scope-5OC8b_q5.js";import"./useRefreshControl-B4VEe-8O.js";import"./circle-check-big-B_JaD3Sd.js";import"./search-token-index-Cp2XNfYr.js";import"./use-match-media-BSj_MlsI.js";import"./MailListHeader-CjWw8PVT.js";import"./account-form-helpers-C48ralIn.js";import"./avatar-DIgxxjJo.js";import"./useSignature-Cgb8x2A1.js";import"./useDebouncedValue-CW8js2xx.js";import"./useFilters-YnuG5yKw.js";import"./ErrorState-DUgckKDx.js";import"./format-De9HZKjg.js";import"./nav-link-DyM-GREt.js";import"./download-BzZgIdQm.js";import"./shield-check-VtnsP_QR.js";import"./move-options-vvEZxrXg.js";import"./confirm-dialog-CJ9HhvTw.js";import"./clock-B4cFFCTA.js";import"./menu-BtgYxp2K.js";import"./MailViewChrome-CChh5YGY.js";import"./NavMenuButton-BhD3j6Q3.js";import"./useLabels-DR8CZ_pi.js";import"./useSemanticSearch-2KSWUDT_.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-BChq8GeA.js";import"./circle-help-CYbymNEq.js";import"./circle-check-KZs1xW98.js";import"./intelligence-pref-C6lFpj6U.js";function H(){return o.jsx(i.Reading,{})}export{H as component};
|
package/assets/index-QN16iBGo.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./index-Dz5Qyak4.js";import{B as o}from"./BriefPane-Cv6V98kK.js";import"./useSearchTokenContext-4dsgVPv9.js";import"./kbd-Bvbu8R4A.js";import"./enums-CCxx0t2v.js";import"./search-scope-5OC8b_q5.js";import"./MailListHeader-CjWw8PVT.js";import"./search-token-index-Cp2XNfYr.js";import"./use-match-media-BSj_MlsI.js";import"./account-form-helpers-C48ralIn.js";import"./avatar-DIgxxjJo.js";import"./useSignature-Cgb8x2A1.js";import"./useDebouncedValue-CW8js2xx.js";import"./useFilters-YnuG5yKw.js";import"./ErrorState-DUgckKDx.js";import"./format-De9HZKjg.js";import"./nav-link-DyM-GREt.js";import"./download-BzZgIdQm.js";import"./shield-check-VtnsP_QR.js";import"./move-options-vvEZxrXg.js";import"./confirm-dialog-CJ9HhvTw.js";import"./clock-B4cFFCTA.js";import"./menu-BtgYxp2K.js";import"./useRefreshControl-B4VEe-8O.js";import"./circle-check-big-B_JaD3Sd.js";import"./useLabels-DR8CZ_pi.js";import"./useSemanticSearch-2KSWUDT_.js";import"./search-query-Cr_ZXBCp.js";function A(){return r.jsx(o.Reading,{})}export{A as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e="remit:intelligence-open";function r(){try{return localStorage.getItem(e)!=="closed"}catch{return!0}}function n(t){try{localStorage.setItem(e,t?"open":"closed")}catch{}}export{r,n as w};
|
package/assets/mail-CK0mlH09.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as z,r as i,u as ze,j as e,S as De,a as pe,b as I,C as ee,d as te,e as Fe,f as ge,F as Te,g as _e,X as be,T as Be,O as Ke,M as Ve,A as Qe,h as qe,I as He,i as ve,B as T,k as U,l as ye,m as $e,n as We,o as je,p as Y,q as Se,s as Ne,t as Ue,v as G,w as J,x as Ce,y as Ye,z as Ge,D as Je,E as $,G as Xe,H as Ze,J as et,K as tt,L as st,N as at,P as nt,Q as rt,R as ot,U as it,V as lt,W as ct,Y as ut,Z as dt,_ as mt,$ as xt,a0 as ht}from"./index-Dz5Qyak4.js";import{B as ft,S as pt,D as gt,a as bt,b as vt,u as yt,s as jt,K as St,c as Nt,d as Ct,e as kt,f as wt,g as It,i as Mt}from"./search-token-index-Cp2XNfYr.js";import{u as se}from"./search-scope-5OC8b_q5.js";import{P as Et}from"./pencil-Bx0MbZnz.js";import{M as Ot,s as Rt,c as At}from"./search-view-Ddk04xwo.js";import{u as Lt,a as Pt,R as zt,M as Dt}from"./useRefreshControl-B4VEe-8O.js";import{M as Ft}from"./menu-BtgYxp2K.js";import{B as ke}from"./bug-CARa4BW2.js";import{A as Tt}from"./avatar-DIgxxjJo.js";import{i as _t}from"./outbox-status-CPfNHfUQ.js";import{N as L}from"./nav-link-DyM-GREt.js";import{E as Bt}from"./ErrorState-DUgckKDx.js";import{K as ae}from"./kbd-Bvbu8R4A.js";import{u as Kt}from"./useDebouncedValue-CW8js2xx.js";import{w as ne}from"./intelligence-pref-C6lFpj6U.js";import"./use-match-media-BSj_MlsI.js";import"./circle-check-big-B_JaD3Sd.js";const Vt=z("BookmarkPlus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"12",x2:"12",y1:"7",y2:"13",key:"1cppfj"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);const Qt=z("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);const we=z("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);const Ie=z("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const qt=z("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]),Ht="button:not([disabled]), a[href]",O="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-sunken";function $t({active:t,dimmed:s,indent:a}){return I("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors",O,a&&"pl-7",t?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg",s&&"opacity-55")}function Wt({icon:t,label:s,count:a,active:n}){return e.jsxs(e.Fragment,{children:[t&&e.jsx("span",{className:I("shrink-0",n?"text-accent-2":"text-fg-subtle"),children:t}),e.jsx("span",{className:"flex-1 truncate",children:s}),a!=null&&a>0&&e.jsx("span",{className:I("text-2xs tabular-nums",n?"text-accent-2":"text-fg-subtle"),children:a})]})}function P({icon:t,label:s,count:a,active:n,dimmed:r,indent:o,navId:l,linkComponent:m,ariaLabel:x,title:p,onClick:b}){const u=$t({active:n,dimmed:r,indent:o}),h=e.jsx(Wt,{icon:t,label:s,count:a,active:n});return l&&m?m({navId:l,className:u,ariaLabel:x??s,title:p,onClick:b,children:h}):e.jsx("button",{type:"button",onClick:b,className:u,"aria-label":x,title:p,children:h})}const re={inbox:0,flagged:1,drafts:2,sent:3,archive:4,all:5,junk:6,trash:7};function Ut(t){switch(t){case"inbox":return e.jsx(He,{className:"size-4"});case"flagged":return e.jsx(pe,{className:"size-4"});case"drafts":return e.jsx(qe,{className:"size-4"});case"sent":return e.jsx(ge,{className:"size-4"});case"archive":return e.jsx(Qe,{className:"size-4"});case"all":return e.jsx(Ve,{className:"size-4"});case"junk":return e.jsx(Ke,{className:"size-4"});case"trash":return e.jsx(Be,{className:"size-4"})}}const oe=t=>t.role!=null,H=8,ie="remit.nav.folders.open.",le="remit.nav.account.open.";function ce(t,s,a){if(typeof localStorage>"u")return a;const n=localStorage.getItem(t+s);return n===null?a:n!=="0"}function ue(t,s,a){typeof localStorage>"u"||localStorage.setItem(t+s,a?"1":"0")}function Yt({query:t,onSelect:s,onRemove:a}){return e.jsxs("div",{className:"group flex w-full items-center gap-1 rounded-md pr-1 hover:bg-surface",children:[e.jsxs("button",{type:"button",onClick:s,className:I("flex min-w-0 flex-1 items-center gap-2 px-2 py-1 text-left text-sm text-fg-muted transition-colors hover:text-fg",O),children:[e.jsx(_e,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t})]}),a&&e.jsx("button",{type:"button",onClick:a,"aria-label":`Remove saved search: ${t}`,className:I("shrink-0 rounded-full p-1 text-fg-subtle opacity-0 transition-opacity hover:bg-surface-sunken hover:text-fg group-hover:opacity-100 focus-visible:opacity-100",O),children:e.jsx(be,{className:"size-3.5"})})]})}function Gt({savedSearches:t,saveableQuery:s,onSelectSavedSearch:a,onRemoveSavedSearch:n,onSaveCurrentSearch:r}){return t.length===0&&!s?null:e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"px-2 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Saved searches"}),s&&e.jsxs("button",{type:"button",onClick:r,className:I("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-accent transition-colors hover:bg-surface",O),children:[e.jsx(Vt,{className:"size-4 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["Save “",s,"”"]})]}),t.map(o=>e.jsx(Yt,{query:o,onSelect:()=>a?.(o),onRemove:n?()=>n(o):void 0},o))]})}function Jt({account:t,selectedNavId:s,onSelectNav:a,linkComponent:n}){const[r,o]=i.useState(()=>ce(le,t.id,!0)),[l,m]=i.useState(()=>ce(ie,t.id,!0)),[x,p]=i.useState(!1),b=()=>{o(c=>{const y=!c;return ue(le,t.id,y),y})},u=()=>{m(c=>{const y=!c;return ue(ie,t.id,y),y})},h=t.mailboxes.filter(oe).sort((c,y)=>re[c.role]-re[y.role]),f=t.mailboxes.filter(c=>!oe(c)),v=x||f.length<=H?f:f.slice(0,H),S=f.length-v.length,g=t.status??"ready",R=g==="ready"&&h.length===0&&f.length===0;return e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",onClick:b,"aria-expanded":r,className:I("flex w-full items-center gap-1.5 px-2 pb-1 text-left transition-colors hover:text-fg",O,t.muted&&"opacity-55"),children:[r?e.jsx(ee,{className:"size-3 shrink-0 text-fg-subtle"}):e.jsx(te,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:t.label}),t.muted&&e.jsxs(e.Fragment,{children:[e.jsx(ft,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:"muted"})]})]}),r&&e.jsxs(e.Fragment,{children:[g==="loading"&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"Loading…"}),g==="error"&&e.jsxs("div",{role:"alert",className:"mx-2 my-1 flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-2 py-1.5 text-sm",children:[e.jsx(Fe,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("p",{className:"font-medium text-danger",children:"Couldn't load mailboxes"})}),t.onRetry&&e.jsx("button",{type:"button",onClick:t.onRetry,className:"shrink-0 text-sm font-medium text-accent hover:underline",children:"Retry"})]}),R&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"No mailboxes"}),g==="ready"&&e.jsxs(e.Fragment,{children:[h.map(c=>e.jsx(P,{navId:c.id,linkComponent:n,icon:Ut(c.role),label:c.name,ariaLabel:c.name,title:c.fullPath??c.name,count:c.unseen,active:s===c.id,dimmed:t.muted,onClick:()=>a?.(c.id)},c.id)),t.outboxPending!==void 0&&e.jsx(P,{navId:"outbox",linkComponent:n,icon:e.jsx(ge,{className:"size-4"}),label:"Outbox",ariaLabel:"Outbox",count:t.outboxPending>0?t.outboxPending:void 0,active:s==="outbox",dimmed:t.muted,onClick:()=>a?.("outbox")}),f.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:u,"aria-expanded":l,className:I("mt-1 flex w-full items-center gap-1 px-2 py-1 text-left text-2xs font-semibold uppercase tracking-wider text-fg-subtle transition-colors hover:text-fg",O),children:[l?e.jsx(ee,{className:"size-3 shrink-0"}):e.jsx(te,{className:"size-3 shrink-0"}),e.jsx("span",{className:"flex-1",children:"Folders"}),e.jsx("span",{className:"tabular-nums opacity-70",children:f.length})]}),l&&e.jsxs(e.Fragment,{children:[v.map(c=>e.jsx(P,{navId:c.id,linkComponent:n,icon:e.jsx(Te,{className:"size-4"}),label:c.name,ariaLabel:c.name,title:c.fullPath??c.name,count:c.unseen,active:s===c.id,dimmed:t.muted,onClick:()=>a?.(c.id)},c.id)),(S>0||x)&&f.length>H&&e.jsx("button",{type:"button",onClick:()=>p(c=>!c),className:I("ml-7 flex items-center px-2 py-1 text-2xs font-medium text-accent transition-colors hover:underline",O),children:x?"Show less":`Show all (${f.length})`})]})]})]})]})]})}function Xt({accounts:t,selectedNavId:s,briefUnseen:a,onSelectNav:n,variant:r="desktop",linkComponent:o,calendarNav:l="hidden",savedSearches:m=[],saveableQuery:x,onSelectSavedSearch:p,onRemoveSavedSearch:b,onSaveCurrentSearch:u}){const h=i.useRef(null);ze({containerRef:h,itemSelector:Ht});const f=r==="drawer",v=e.jsxs("nav",{ref:f?h:void 0,className:f?"px-2 py-2":"flex-1 overflow-y-auto px-2 py-2","aria-label":"Mailboxes",children:[e.jsx(P,{navId:"brief",linkComponent:o,icon:e.jsx(De,{className:"size-4"}),label:"Daily brief",ariaLabel:"Daily brief",count:a,active:s==="brief",onClick:()=>n?.("brief")}),l==="shown"&&e.jsx(P,{navId:"calendar",linkComponent:o,icon:e.jsx(Qt,{className:"size-4"}),label:"Calendar",ariaLabel:"Calendar",active:s==="calendar",onClick:()=>n?.("calendar")}),e.jsx(P,{navId:"flagged",linkComponent:o,icon:e.jsx(pe,{className:"size-4"}),label:"Starred",ariaLabel:"Starred",active:s==="flagged",onClick:()=>n?.("flagged")}),e.jsx(Gt,{savedSearches:m,saveableQuery:x,onSelectSavedSearch:p,onRemoveSavedSearch:b,onSaveCurrentSearch:u}),t.length===0?e.jsx("div",{className:"px-2 py-4 text-center text-sm text-fg-muted",children:"No accounts configured"}):t.map(S=>e.jsx(Jt,{account:S,selectedNavId:s,onSelectNav:n,linkComponent:o},S.id))]});return f?v:e.jsx("aside",{ref:h,className:"flex h-full w-full flex-col bg-surface-sunken",children:v})}function Zt({leading:t,search:s,actions:a,className:n}){return e.jsxs("header",{className:I("flex min-h-pane-header w-full shrink-0 items-center gap-2 border-b border-line bg-canvas px-row-inset py-1",n),children:[t&&e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:t}),e.jsx("div",{className:"flex min-w-0 flex-1 justify-start",children:e.jsx("div",{className:"w-full max-w-xs transition-[max-width] duration-150 ease-out focus-within:max-w-lg",children:s})}),a&&e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:a})]})}function es(){const t=ve();if(!t)return null;const s=t.showNavPane?!t.navCollapsed:!1;return e.jsx(T,{variant:"ghost",size:"sm",icon:e.jsx(Ft,{className:"size-4"}),onClick:t.toggleNav,"aria-label":s?"Hide folders":"Show folders","aria-expanded":s,title:"Folders",className:"shrink-0"})}const ts={global:"Search all mail",pending:"Search mail",scoped:"Search this folder"};function ss({search:t,onCompose:s,onReportBug:a,onOpenSettings:n,composeShortcut:r,refreshControl:o,account:l}){return e.jsx(Zt,{leading:e.jsx(es,{}),search:e.jsx(pt,{value:t.value,onChange:t.onChange,onClear:t.onClear,onClearQuery:t.onClearQuery,chips:t.chips,onRemoveChip:t.onRemoveChip,placeholder:ts[t.scope]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(T,{variant:"ghost",size:"sm",icon:e.jsx(qt,{className:"size-4"}),title:r?`Compose (${r})`:"Compose","aria-label":"Compose",onClick:s}),e.jsx(T,{variant:"ghost",size:"sm",icon:e.jsx(ke,{className:"size-4"}),title:"Report a bug","aria-label":"Report a bug",onClick:a}),e.jsx(T,{variant:"ghost",size:"sm",icon:e.jsx(Ie,{className:"size-4"}),title:"Settings","aria-label":"Settings",onClick:n}),o,l]})})}const as=()=>{const{state:t,openCompose:s}=U(),a=ye(),n=i.useCallback(()=>{s({mode:"new"})},[s]),r=$e(a.pathname);return!a.pathname.startsWith("/mail")||t.isOpen||r?null:e.jsx("button",{type:"button",onClick:n,"aria-label":"Compose new message",className:"lg:hidden fixed right-4 z-30 h-14 w-14 rounded-full bg-accent text-accent-fg shadow-lg flex items-center justify-center hover:opacity-90 active:scale-95 transition-all",style:{bottom:"calc(env(safe-area-inset-bottom, 0) + 1rem)"},children:e.jsx(Et,{className:"size-6"})})},Me=({children:t})=>{const{Account:s}=We();return e.jsx(s,{children:t})},ns=({email:t,onSignOut:s})=>{const a=t??"Account";return e.jsxs(gt,{trigger:e.jsx(Tt,{name:a,email:t??void 0,size:"sm"}),align:"right",children:[t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 py-2 text-xs text-fg-muted truncate",title:t,"data-testid":"account-menu-email",children:t}),e.jsx(bt,{})]}),e.jsxs(vt,{onClick:s,children:[e.jsx(we,{className:"size-4"}),"Sign out"]})]})},rs=()=>e.jsx(Me,{children:({email:t,signOut:s})=>e.jsx(ns,{email:t,onSignOut:s})});function os({accounts:t}){const{searchInput:s,onSearchChange:a,onSearchClear:n,onSearchClearQuery:r}=je(),o=Y(),{openCompose:l}=U(),m=i.useCallback(()=>{l({mode:"new"})},[l]),{scope:x,clearScope:p}=yt(t),b=x.kind==="scoped"?[{id:x.chip.id,label:x.chip.label,tone:"scope"}]:void 0,u=i.useMemo(()=>t.map(g=>g.accountId),[t]),{hasNewMail:h}=Lt(),{state:f,errorMessage:v,refresh:S}=Pt(u);return e.jsx(ss,{search:{value:s,scope:x.kind,chips:b,onChange:a,onClear:n,onClearQuery:r,onRemoveChip:p},onCompose:m,onReportBug:Se,onOpenSettings:()=>o({to:"/settings/accounts"}),composeShortcut:jt("compose"),refreshControl:e.jsx(zt,{state:f,onRefresh:S,label:"Refresh all accounts",errorMessage:v,hasUpdate:h(u)}),account:e.jsx(rs,{})})}const X="remit.savedSearches",is=25;function B(){try{const t=localStorage.getItem(X);if(!t)return[];const s=JSON.parse(t);return Array.isArray(s)?s.filter(a=>typeof a=="string"):[]}catch{return[]}}function ls(t){const s=t.trim();if(!s)return B();const a=[s,...B().filter(n=>n!==s)].slice(0,is);try{localStorage.setItem(X,JSON.stringify(a))}catch{return a}return a}function cs(t){const s=B().filter(a=>a!==t);try{localStorage.setItem(X,JSON.stringify(s))}catch{return s}return s}const de=t=>/^\d/.test(t),us=(t,s)=>{const a=de(t),n=de(s);return a&&!n?-1:!a&&n?1:t.localeCompare(s,void 0,{sensitivity:"base",numeric:!0})};function ds(t,s,a){const n=[],r=[];for(const o of t)s.has(o.mailboxId)?n.push(o):r.push(o);return r.sort((o,l)=>us($(o,void 0,a),$(l,void 0,a))),{system:n,labels:r}}function ms(t,s,a){const n=Xe(s)&&t.unseenCount>0;return{id:t.mailboxId,name:$(t,s,a),unseen:n?t.unseenCount:void 0,role:s,fullPath:t.fullPath}}function xs(){const t=ye(),s=Je({strict:!1});return t.pathname.startsWith("/settings")?"settings":t.pathname.startsWith("/mail/outbox")?"outbox":t.pathname.startsWith("/mail/flagged")?"flagged":t.pathname.startsWith("/mail/brief")?"brief":s.mailboxId?s.mailboxId:""}function me({accounts:t,onMailboxSelect:s,variant:a="desktop"}){const n=Ne(),r=Y(),o=xs(),{searchInput:l,onSearchChange:m}=je(),[x,p]=i.useState(B),{t:b}=Ue("mail",{useSuspense:!1}),u=i.useCallback((d,N)=>b(d,{defaultValue:N}),[b]),h=G({queries:t.map(d=>({...J({path:{accountId:d.accountId}}),staleTime:1/0}))}),{data:f}=Ce(Ye()),v=i.useMemo(()=>(f?.items??[]).filter(d=>_t(d.status)).length,[f?.items]),S=i.useMemo(()=>t.map((d,N)=>{const C=h[N],M=C?.data?.items??[],w=Ge(d.folderAppointments),{system:E,labels:q}=ds(M,w,u),k=C?.isError?"error":C?.isLoading?"loading":"ready";return{id:d.accountId,label:d.email,email:d.email,muted:!!d.muted,outboxPending:v,status:k,onRetry:()=>C?.refetch(),mailboxes:[...E,...q].map(D=>ms(D,w.get(D.mailboxId),u))}}),[t,h,v,u]),g=d=>{n.invalidateQueries({queryKey:Ze({path:{mailboxId:d},query:{order:"desc"}})})},R=({navId:d,className:N,ariaLabel:C,title:M,children:w,onClick:E})=>d==="brief"?e.jsx(L,{to:"/mail/brief",search:{q:void 0},activeOptions:{includeSearch:!1},onClick:()=>E?.(),className:N,"aria-label":C,title:M,children:w}):d==="outbox"?e.jsx(L,{to:"/mail/outbox",search:{q:void 0},onClick:()=>E?.(),className:N,"aria-label":C,title:M,children:w}):d==="flagged"?e.jsx(L,{to:"/mail/flagged",search:{q:void 0},onClick:()=>E?.(),className:N,"aria-label":C,title:M,children:w}):d==="settings"?e.jsx(L,{to:"/settings/accounts",onClick:()=>E?.(),className:N,"aria-label":C,title:M,children:w}):e.jsx(L,{to:"/mail/$mailboxId",params:{mailboxId:d},search:{q:void 0},onClick:()=>{g(d),E?.()},className:N,"aria-label":C,title:M,children:w}),c=()=>{m(""),s?.()},y=l.trim(),A=y.length>0&&!x.includes(y)?y:void 0,K=i.useCallback(()=>{A&&p(ls(A))},[A]),V=i.useCallback(d=>{p(cs(d))},[]),Q=i.useCallback(d=>{m(d),r({to:"/mail/brief",search:{q:d}}),s?.()},[m,r,s]);return e.jsx(Xt,{accounts:S,selectedNavId:o,onSelectNav:c,linkComponent:R,variant:a,savedSearches:x,saveableQuery:A,onSaveCurrentSearch:K,onSelectSavedSearch:Q,onRemoveSavedSearch:V})}function hs(){return e.jsxs("button",{type:"button",onClick:Se,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg",children:[e.jsx(ke,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Report a bug"})]})}function fs({accounts:t,onMailboxSelect:s}){return ve()?.showNavPane??!0?e.jsx(me,{accounts:t}):e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(me,{accounts:t,onMailboxSelect:s,variant:"drawer"})}),e.jsxs("div",{className:"border-t border-line px-2 py-2",children:[e.jsxs(L,{to:"/settings/accounts",onClick:s,children:[e.jsx(Ie,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Settings"})]}),e.jsx(hs,{}),e.jsx(Me,{children:({signOut:r})=>e.jsxs("button",{type:"button",onClick:()=>{s?.(),r()},className:"flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg","data-testid":"sign-out-button",children:[e.jsx(we,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Sign out"})]})})]})]})}const ps=({isOpen:t,onClose:s})=>{const a=i.useCallback(n=>{n.key==="Escape"&&(n.preventDefault(),s())},[s]);return i.useEffect(()=>{if(t)return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[t,a]),t?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx(et,{label:"Dismiss keyboard shortcuts",onDismiss:s,className:"backdrop-blur-sm"}),e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Keyboard shortcuts",className:tt("relative z-10 max-h-[85vh] w-full max-w-2xl overflow-y-auto","rounded-lg border border-line bg-surface shadow-lg","p-6"),children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Keyboard shortcuts"}),e.jsx("button",{type:"button",onClick:s,className:"p-1 text-fg-muted transition-colors hover:text-fg","aria-label":"Close",children:e.jsx(be,{className:"size-5"})})]}),e.jsx("div",{className:"grid gap-x-8 gap-y-6 sm:grid-cols-2",children:St.map(n=>e.jsxs("div",{children:[e.jsx("h3",{className:"mb-3 text-sm font-medium text-fg-muted",children:n.title}),e.jsx("div",{className:"space-y-2",children:n.hints.map(r=>e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("span",{className:"text-sm",children:r.description}),e.jsx("span",{className:"flex shrink-0 items-center gap-1",children:r.keys.map((o,l)=>e.jsxs(i.Fragment,{children:[l>0&&r.keys[0]==="g"&&e.jsx("span",{className:"text-2xs text-fg-subtle",children:"then"}),e.jsx(ae,{children:o})]},o))})]},`${r.action}-${r.keys.join("+")}`))})]},n.title))}),e.jsx("div",{className:"mt-6 border-t border-line pt-4",children:e.jsxs("p",{className:"text-center text-xs text-fg-muted",children:["Press ",e.jsx(ae,{children:"Esc"})," to close"]})})]})]}):null};function gs(t){const s=G({queries:t.map(a=>({...J({path:{accountId:a.accountId}}),staleTime:1/0}))});return i.useMemo(()=>Nt(s.map(a=>a.data?.items??[])),[s])}const bs=t=>t.map(s=>s.data?.items??[]);function vs(t){const s=G({queries:t.map(a=>({...J({path:{accountId:a.accountId}}),staleTime:1/0})),combine:bs});return i.useMemo(()=>st(t.map((a,n)=>({folderAppointments:a.folderAppointments,mailboxes:s[n]??[]}))),[t,s])}var F={exports:{}},xe;function ys(){if(xe)return F.exports;xe=1;const t=(s,a,n)=>new Promise((r,o)=>{if(n=Object.assign({concurrency:1/0},n),typeof a!="function")throw new TypeError("Mapper function is required");const{concurrency:l}=n;if(!(typeof l=="number"&&l>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${l}\` (${typeof l})`);const m=[],x=s[Symbol.iterator]();let p=!1,b=!1,u=0,h=0;const f=()=>{if(p)return;const v=x.next(),S=h;if(h++,v.done){b=!0,u===0&&r(m);return}u++,Promise.resolve(v.value).then(g=>a(g,S)).then(g=>{m[S]=g,u--,f()},g=>{p=!0,o(g)})};for(let v=0;v<l&&(f(),!b);v++);});return F.exports=t,F.exports.default=t,F.exports}var js=ys();const Ss=at(js),Ns=900*1e3,Cs=300,ks=(t,s)=>{if(!t)return s;const a=Number.parseInt(t,10);return Number.isFinite(a)&&a>0?a:s},ws=60*1e3,Is=t=>Math.max(ks(t,Cs)*1e3,ws),_=Is(lt().mailboxPollIntervalSeconds),Ms=5,W=new Set,Es=(t,s,a=Ns)=>t.filter(n=>{const r=n.lastSyncAt;return r==null?!0:s-r>a}).map(n=>n.accountId),Os=(t,s,a=_)=>t-s>=a,Rs=(t,s)=>t.filter(a=>!s.has(a)),he=(t,s)=>{if(W.delete(t),ot(s,{softError:!0})){it(s);return}console.warn("[remit] background mailbox sync failed",{accountId:t,error:s})},fe=(t,s)=>nt({path:{accountId:t},throwOnError:!0}).then(()=>{s.invalidateQueries({queryKey:rt({path:{accountId:t}})})}),As=t=>{const s=Ne(),a=i.useRef(t);a.current=t;const n=t.map(r=>r.accountId).join(",");i.useEffect(()=>{const r=Date.now(),l=Es(a.current,r).filter(m=>!W.has(m));if(l.length!==0)for(const m of l)W.add(m),fe(m,s).catch(x=>{he(m,x)})},[n,s]),i.useEffect(()=>{let r=Date.now(),o;const l=new Set,m=()=>{r=Date.now();const b=Rs(a.current.map(u=>u.accountId),l);for(const u of b)l.add(u);Ss(b,u=>fe(u,s).catch(h=>{he(u,h)}).finally(()=>{l.delete(u)}),{concurrency:Ms})},x=()=>{if(document.visibilityState==="visible"){m(),o=setTimeout(x,_);return}},p=()=>{document.visibilityState==="visible"&&Os(Date.now(),r)&&(o!==void 0&&clearTimeout(o),m(),o=setTimeout(x,_))};return o=setTimeout(x,_),document.addEventListener("visibilitychange",p),()=>{o!==void 0&&clearTimeout(o),document.removeEventListener("visibilitychange",p)}},[n,s])};function Gs(){const{q:t=""}=ct({from:"/mail"}),s=Y(),a=Ct(),n=Mt(a),[r,o]=i.useState(!1),[l,m]=i.useState(!1),[x,p]=i.useState(!1),b=i.useCallback(j=>{p(j),ne(j)},[]),[u,h]=i.useState(t),f=Kt(u,200),v=At(u,f),S=se({select:j=>j.location.pathname}),g=se({select:j=>ut(j.matches)}),[R,c]=i.useState(g);if(R!==g){const j=Rt(R,g,t);c(g),j!==void 0&&h(j)}const{data:y,isLoading:A,isError:K,error:V,refetch:Q}=Ce({...dt(),staleTime:1/0}),d=!!(y&&(y.accounts?.length??0)===0);i.useEffect(()=>{d&&s({to:"/onboarding",replace:!0})},[d,s]),kt({enabled:!r,bindings:[{key:"?",handler:()=>o(!0),noModifiers:!1,preventDefault:!0}]});const{openCompose:N}=U(),C=i.useMemo(()=>({compose:()=>N({mode:"new"})}),[N]);wt({enabled:!mt(S),handlers:C});const M=i.useCallback(j=>{h(j)},[]),w=i.useCallback(()=>{h("")},[]),E=i.useCallback(()=>{h("")},[]),q=i.useCallback(()=>{p(j=>{const Z=!j;return ne(Z),Z})},[]),k=y?.accounts??[],D=i.useMemo(()=>k.map(j=>j.accountId),[k]),Ee=gs(k),Oe=vs(k),Re=i.useMemo(()=>It(k),[k]);As(k);const Ae=i.useCallback(()=>{m(!1)},[]),Le={accounts:k,mailboxNameIndex:Ee,accountNameIndex:Re,resultFolderIndex:Oe,searchQuery:v,searchInput:u,searchViewKey:g,onSearchChange:M,onSearchClear:w,onSearchClearQuery:E,intelligenceOpen:x,onToggleIntelligence:q,onSetIntelligenceOpen:b},Pe={isSinglePane:n,isLoading:A||d,intelligenceOpen:x,nav:e.jsx(fs,{accounts:k,onMailboxSelect:Ae}),topBar:n?void 0:e.jsx(os,{accounts:k}),overlay:n?e.jsx(as,{}):void 0,navOpen:l,onOpenNav:()=>m(!0),onCloseNav:()=>m(!1)};return e.jsx(xt.Provider,{value:Le,children:e.jsxs(Dt,{accountIds:D,children:[K?e.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:e.jsx(Bt,{title:"Couldn't load your account",error:V,onRetry:()=>{Q()}})}):e.jsx(Ot,{chrome:Pe,children:e.jsx(ht,{})}),e.jsx(ps,{isOpen:r,onClose:()=>o(!1)})]})})}export{Gs as component,je as useMailContext};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{cO as s,j as t,cP as a,cQ as r}from"./index-Dz5Qyak4.js";const c=["intelligence","nav","shortcuts","filters"];s(c);const i=a(r);function u({fragment:n,...e}){return t.jsx(i,{...e,hash:n})}export{u as N};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{D as s,j as o,a0 as i}from"./index-Dz5Qyak4.js";import{a as m}from"./search-view-Ddk04xwo.js";import{O as t}from"./OutboxPane-D644CAzB.js";import{u as a}from"./useSearchMirror-wZyUq8Ug.js";import"./nav-link-DyM-GREt.js";import"./useSearchTokenContext-4dsgVPv9.js";import"./kbd-Bvbu8R4A.js";import"./enums-CCxx0t2v.js";import"./search-scope-5OC8b_q5.js";import"./circle-check-big-B_JaD3Sd.js";import"./clock-B4cFFCTA.js";import"./row-actions-CmfExpmx.js";import"./rotate-ccw-h15XAO1t.js";import"./NavMenuButton-BhD3j6Q3.js";import"./menu-BtgYxp2K.js";import"./format-De9HZKjg.js";import"./outbox-status-CPfNHfUQ.js";import"./search-query-Cr_ZXBCp.js";function e(){return s({from:"/mail/outbox/draft/$outboxMessageId",shouldThrow:!1})?.outboxMessageId}function S(){const r=e();return a({to:"/mail/outbox"}),o.jsx(t,{outboxMessageId:r,children:o.jsx(m,{phone:o.jsx(t.Phone,{}),list:o.jsx(t.List,{}),reading:o.jsx(i,{})})})}export{S as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c9 as n,c_ as s,c$ as u,d0 as r}from"./index-Dz5Qyak4.js";function f(e){const t=n({warn:e?.router===void 0}),o=e?.router||t;return s(o.stores.__store,u(e,o))}const i="search-scope";function c(e){const t=e.trim().replace(/\s+/g," ").toLowerCase();return/\s/.test(t)?`in:"${t}"`:`in:${t}`}function a(e){const t=r(e);return t!==void 0&&t.list!=="brief"}function l(e){const t=r(e);return t?.list==="mailbox"?t.mailboxId:void 0}function b(e){const t=l(e.matches);return t||(a(e.matches)?e.callerMailboxId:e.callerMailboxId??e.inTokenMailboxId)}function p(e,t){const o=r(e);return o?.list==="flagged"?{kind:"scoped",chip:{id:i,label:"is:starred"}}:o?.list==="outbox"?{kind:"scoped",chip:{id:i,label:"in:outbox"}}:o?.list==="mailbox"?t?{kind:"scoped",chip:{id:i,label:c(t)}}:{kind:"pending"}:{kind:"global"}}function x(e,t,o){return t.kind==="global"?{kind:"global"}:r(e)?.list==="flagged"?{kind:"collection"}:{kind:"folder",...o?{role:o}:{}}}export{i as S,x as a,p as b,a as i,l as r,b as s,f as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as A,r as u,j as m,g as V,b as I,cN as z,X as G,K as N,D as j,l as $,t as X,v as F,w as q,z as W,E as J,p as Y,o as Z,co as R}from"./index-Dz5Qyak4.js";import{u as ee,b as te,S as ne}from"./search-scope-5OC8b_q5.js";import{u as L,D as oe}from"./use-match-media-BSj_MlsI.js";const ve=A("BellOff",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]);const Ie=A("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),re=[{action:"focusNext",keys:["j","k"],label:"navigate"},{action:"muteSender",keys:["m"],label:"mute"},{action:"help",keys:["?"],label:"all shortcuts"}];function Ne(e){return re.filter(t=>e[t.action]!==void 0)}const se=[{title:"Navigation",hints:[{action:"focusNext",keys:["j"],description:"Focus the message below"},{action:"focusPrevious",keys:["k"],description:"Focus the message above"},{action:"focusNext",keys:["↓"],description:"Focus the message below"},{action:"focusPrevious",keys:["↑"],description:"Focus the message above"},{action:"focusFirst",keys:["Home"],description:"Focus first"},{action:"focusLast",keys:["End"],description:"Focus last"},{action:"openFocused",keys:["Enter"],description:"Open focused thread"},{action:"back",keys:["Esc"],description:"Back / close overlay"}]},{title:"Selection",hints:[{action:"toggleSelect",keys:["x"],description:"Toggle select"},{action:"toggleSelect",keys:["Space"],description:"Toggle select"},{action:"extendSelectDown",keys:["Shift","j"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","k"],description:"Extend selection up"},{action:"extendSelectDown",keys:["Shift","↓"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","↑"],description:"Extend selection up"},{action:"selectAll",keys:["⌘","A"],description:"Select all"}]},{title:"Actions",hints:[{action:"reply",keys:["r"],description:"Reply"},{action:"replyAll",keys:["a"],description:"Reply all"},{action:"forward",keys:["f"],description:"Forward"},{action:"delete",keys:["#"],description:"Delete"},{action:"toggleStar",keys:["s"],description:"Star / unstar"},{action:"toggleRead",keys:["u"],description:"Toggle read / unread"}]},{title:"Sender",hints:[{action:"muteSender",keys:["m"],description:"Mute sender"},{action:"blockSender",keys:["b"],description:"Block sender"},{action:"vipSender",keys:["v"],description:"VIP sender"},{action:"markJunk",keys:["!"],description:"Mark junk"}]},{title:"Go to",hints:[{action:"goBrief",keys:["g","b"],description:"Daily brief"},{action:"goInbox",keys:["g","i"],description:"Inbox"},{action:"goSent",keys:["g","s"],description:"Sent"},{action:"goFlagged",keys:["g","f"],description:"Starred"},{action:"goSettings",keys:["g",","],description:"Settings"}]},{title:"View & global",hints:[{action:"toggleIntelligence",keys:["i"],description:"Toggle intelligence"},{action:"toggleDensity",keys:["d"],description:"Toggle density"},{action:"focusSearch",keys:["/"],description:"Focus search"},{action:"compose",keys:["c"],description:"Compose"},{action:"compose",keys:["⌘","N"],description:"Compose"},{action:"help",keys:["?"],description:"Shortcut help"}]}];function ie(e){for(const t of se){const n=t.hints.find(r=>r.action===e);if(n)return n.keys}}function ae(e){const t=ie(e);return!t||t.length===0?"":t.length===1?t[0]??"":t[0]==="g"?t.join(" then "):t.join("")}function Te(e){const t=ae(e);return t===""?"":`(${t})`}const b={action:null,nextPrefix:null,preventDefault:!1},ce={b:"goBrief",i:"goInbox",s:"goSent",f:"goFlagged",",":"goSettings"},le={j:{action:"focusNext"},k:{action:"focusPrevious"},arrowdown:{action:"focusNext"},arrowup:{action:"focusPrevious"},home:{action:"focusFirst"},end:{action:"focusLast"},enter:{action:"openFocused"}," ":{action:"toggleSelect"},delete:{action:"delete"},backspace:{action:"delete"},u:{action:"toggleRead"},x:{action:"toggleSelect"},r:{action:"reply"},a:{action:"replyAll"},f:{action:"forward"},"#":{action:"delete"},s:{action:"toggleStar"},m:{action:"muteSender"},b:{action:"blockSender"},v:{action:"vipSender"},"!":{action:"markJunk"},i:{action:"toggleIntelligence"},d:{action:"toggleDensity"},"/":{action:"focusSearch"},c:{action:"compose"},"?":{action:"help"}};function ue(e,t){const n=e.key.toLowerCase(),r=e.metaKey||e.ctrlKey;if(e.inEditable)return{...b,nextPrefix:t==="g"?null:t};if(e.onControl&&(n==="enter"||n===" "))return{...b,nextPrefix:t==="g"?null:t};if(r&&n==="n")return{action:"compose",nextPrefix:null,preventDefault:!0};if(r&&n==="a")return{action:"selectAll",nextPrefix:null,preventDefault:!0};if(r)return{...b,nextPrefix:t==="g"?null:t};if(n==="escape")return{action:"back",nextPrefix:null,preventDefault:!1};if(t==="g"){const a=ce[n===","?",":n]??null;return{action:a,nextPrefix:null,preventDefault:a!==null}}if(n==="g"&&!e.shiftKey)return{action:null,nextPrefix:"g",preventDefault:!0};if(e.shiftKey){const s=n==="j"||n==="arrowdown";if(s||(n==="k"||n==="arrowup"))return{action:s?"extendSelectDown":"extendSelectUp",nextPrefix:null,preventDefault:!0}}const o=le[n];if(o){const s=o.requireShift===!0,a=n.length===1&&!/[a-z0-9]/.test(n);return!s&&e.shiftKey&&!a?b:{action:o.action,nextPrefix:null,preventDefault:!0}}return b}function fe(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable}const de="data-message-row",pe='button, a[href], summary, [role="button"], [role="menuitem"], [role="tab"], [role="switch"], [role="checkbox"]';function me(e){if(!(e instanceof HTMLElement))return!1;const t=e.closest(pe);return t?!t.hasAttribute(de):!1}function he({key:e,shiftKey:t=!1,repeat:n=!1,caretAtStart:r,hasValue:o,chipCount:s}){const a=s-1;return e==="Escape"?o?{type:"clearQuery"}:{type:"blur"}:e==="Tab"&&t?s===0?{type:"none"}:{type:"focusChip",index:a}:e==="Backspace"||e==="ArrowLeft"?!r||s===0?{type:"none"}:n?{type:"none"}:{type:"focusChip",index:a}:{type:"none"}}function ye({key:e,repeat:t=!1,index:n,chipCount:r}){return e==="Backspace"||e==="Delete"?t?{type:"none"}:{type:"removeChip",index:n}:e==="ArrowLeft"?n===0?{type:"none"}:{type:"focusChip",index:n-1}:e==="ArrowRight"?n>=r-1?{type:"focusInput"}:{type:"focusChip",index:n+1}:e==="Enter"||e===" "?{type:"activateChip",index:n}:e==="Escape"?{type:"focusInput"}:{type:"none"}}function ge(e,t){const n=t-1;return n<=0?null:e<n?e:n-1}const xe=e=>e instanceof HTMLElement?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable:!1,be=({chips:e=[],onRemoveChip:t,value:n,onChange:r,onClear:o,onClearQuery:s,placeholder:a="Search mail...",globalFocusKey:c=!0,showClearButton:f=!0,size:h="sm",inputId:p,suggest:d,className:x})=>{const O=u.useId(),T=p??O,k=u.useRef(null),D=u.useRef([]),P=s??o,[K,w]=u.useState(null),C=u.useRef(void 0),[B,H]=u.useState(""),E=e.length>0;u.useEffect(()=>{w(i=>i!==null&&i>=e.length?null:i)},[e.length]),u.useEffect(()=>{const i=C.current;if(i!==void 0){if(C.current=void 0,i===null){k.current?.focus();return}D.current[i]?.focus()}});const M=u.useRef(void 0);u.useEffect(()=>{const i=d?.caret;if(!i||i===M.current)return;M.current=i;const l=k.current;!l||l.ownerDocument.activeElement!==l||(l.setSelectionRange(i.cursor,i.cursor),d?.onCaretChange(i.cursor))});const S=i=>{d?.onCaretChange(i.selectionStart??i.value.length)},y=u.useCallback(i=>{w(i),C.current=i},[]),v=u.useCallback(i=>{const l=e[i];l&&t&&(y(ge(i,e.length)),H(`${l.label} removed`),t(l.id))},[e,t,y]),_=u.useCallback(()=>{y(null),o()},[o,y]),U=u.useCallback(i=>{const l=i.currentTarget;if(d?.onKeyDown(i))return;const g=he({key:i.key,shiftKey:i.shiftKey,repeat:i.repeat,caretAtStart:l.selectionStart===0&&l.selectionEnd===0,hasValue:n.length>0,chipCount:e.length});switch(g.type){case"focusChip":i.preventDefault(),y(g.index);return;case"clearQuery":P();return;case"blur":l.blur();return;case"none":return}},[e.length,n,P,y,d]),Q=u.useCallback(i=>l=>{const g=ye({key:l.key,repeat:l.repeat,index:i,chipCount:e.length});switch(g.type!=="none"&&l.preventDefault(),g.type){case"removeChip":v(g.index);return;case"focusChip":y(g.index);return;case"focusInput":y(null);return;case"activateChip":return;case"none":return}},[e,v,y]);return u.useEffect(()=>{if(!c)return;const i=l=>{l.key!=="/"||l.metaKey||l.ctrlKey||l.altKey||xe(l.target)||(l.preventDefault(),k.current?.focus())};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[c]),m.jsxs("label",{htmlFor:T,className:I("flex w-full items-center gap-1.5 text-sm","bg-surface-sunken/50 border border-transparent","focus-within:bg-canvas focus-within:border-line focus-within:ring-2 focus-within:ring-ring","transition-colors",h==="lg"?"rounded-xl px-4 py-2":"rounded-md px-2.5 py-1",x),children:[m.jsx(V,{className:I("shrink-0 text-fg-muted pointer-events-none",h==="lg"?"size-5":"size-4")}),m.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:[E&&m.jsx("div",{role:"grid","aria-label":"Search filters",className:"flex min-w-0 flex-wrap items-center gap-1",children:e.map((i,l)=>m.jsx(z,{ref:g=>{D.current[l]=g},label:i.label,tone:i.tone,focused:K===l,onFocusLabel:()=>w(l),onKeyDown:Q(l),onRemove:()=>v(l)},i.id))}),m.jsx("input",{ref:k,id:T,name:"q",type:"text","aria-label":"Search mail",autoComplete:"off",value:n,tabIndex:K===null?0:-1,onChange:i=>{r(i.target.value),S(i.target)},onKeyDown:U,onKeyUp:i=>S(i.currentTarget),onClick:i=>S(i.currentTarget),onFocus:i=>{w(null),d?.onFocusChange?.(!0),S(i.currentTarget)},onBlur:()=>d?.onFocusChange?.(!1),...d?.comboboxProps,placeholder:E?void 0:a,className:"min-w-24 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-muted"})]}),(n||E)&&f&&m.jsx("button",{type:"button",onClick:_,className:"shrink-0 rounded p-0.5 hover:bg-surface-raised transition-colors","aria-label":"Clear search",children:m.jsx(G,{className:I("text-fg-muted",h==="lg"?"size-5":"size-4")})}),m.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:B})]})},De=({value:e,onChange:t,onClear:n,onClearQuery:r,chips:o,onRemoveChip:s,placeholder:a="Search mail...",globalFocusKey:c=!0,showClearButton:f=!0,size:h,inputId:p,suggest:d,className:x})=>m.jsx(be,{value:e,onChange:t,onClear:n,onClearQuery:r,chips:o,onRemoveChip:s,placeholder:a,globalFocusKey:c,showClearButton:f,size:h,inputId:p,suggest:d,className:x});function Pe({handlers:e,enabled:t=!0,target:n,sequenceTimeoutMs:r=1e3}){const o=u.useRef(e);o.current=e;const s=u.useRef(null),a=u.useRef(null);u.useEffect(()=>{if(!t)return;const c=()=>{a.current!==null&&(clearTimeout(a.current),a.current=null)},f=p=>{const d=ue({key:p.key,shiftKey:p.shiftKey,metaKey:p.metaKey,ctrlKey:p.ctrlKey,altKey:p.altKey,inEditable:fe(p.target),onControl:me(p.target)},s.current);if(c(),s.current=d.nextPrefix,d.nextPrefix!==null&&(a.current=setTimeout(()=>{s.current=null,a.current=null},r)),d.action===null)return;const x=o.current[d.action];x&&(d.preventDefault&&p.preventDefault(),x())},h=n===void 0?window:n;if(h!==null)return h.addEventListener("keydown",f),()=>{h.removeEventListener("keydown",f),c(),s.current=null}},[t,r,n])}const Ke=({trigger:e,children:t,align:n="right"})=>{const[r,o]=u.useState(!1),s=u.useRef(null),a=u.useCallback(f=>{s.current&&!s.current.contains(f.target)&&o(!1)},[]),c=u.useCallback(f=>{f.key==="Escape"&&o(!1)},[]);return u.useEffect(()=>(r&&(document.addEventListener("mousedown",a),document.addEventListener("keydown",c)),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",c)}),[r,a,c]),m.jsxs("div",{ref:s,className:"relative",children:[m.jsx("button",{type:"button",onClick:f=>{f.stopPropagation(),o(!r)},className:N("p-1.5 min-h-11 min-w-11 inline-flex items-center justify-center rounded-md transition-colors","hover:bg-surface-raised text-fg-muted hover:text-fg"),children:e}),r&&m.jsx("div",{className:N("absolute z-50 mt-1 min-w-[180px] py-1","bg-surface border border-line rounded-md shadow-lg",n==="right"?"right-0":"left-0"),children:t})]})},Me=({onClick:e,disabled:t,destructive:n,children:r})=>m.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t||e()},disabled:t,className:N("w-full px-3 py-2 text-left text-sm transition-colors","flex items-center gap-2",t&&"opacity-50 cursor-not-allowed",!t&&"hover:bg-surface-raised",n&&"text-danger hover:text-danger"),children:r}),Re=()=>m.jsx("div",{className:"my-1 h-px bg-line"}),ke=({accounts:e})=>{const t=j({strict:!1}),n=$(),r=t.mailboxId,{t:o}=X("mail",{useSuspense:!1}),s=u.useCallback((c,f)=>o(c,{defaultValue:f}),[o]),a=F({queries:e.map(c=>({...q({path:{accountId:c.accountId}}),staleTime:1/0}))});if(n.pathname.startsWith("/mail/outbox"))return"Outbox";if(!r)return null;for(let c=0;c<e.length;c++){const f=a[c]?.data?.items;if(!f)continue;const h=f.find(d=>d.mailboxId===r);if(!h)continue;const p=W(e[c].folderAppointments);return J(h,p.get(r),s)}return null},Le=({accounts:e})=>{const n=j({strict:!1}).mailboxId,r=F({queries:e.map(o=>({...q({path:{accountId:o.accountId}}),staleTime:1/0}))});if(!n)return null;for(const o of r){const s=o.data?.items;if(!s)continue;const a=s.find(c=>c.mailboxId===n);if(a)return a.unseenCount}return null};function Ae(e){const t=Y(),{searchInput:n}=Z(),r=ke({accounts:e}),o=ee({select:c=>c.matches}),s=te(o,r),a=u.useCallback(c=>{c===ne&&t({to:"/mail/brief",search:{q:n||void 0}})},[t,n]);return{scope:s,clearScope:a}}const je=({enabled:e=!0,bindings:t,capture:n=!1})=>{const r=u.useCallback(o=>{const s=o.target;if(!(s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.isContentEditable))for(const a of t){if(!(o.key.toLowerCase()===a.key.toLowerCase())||a.requireShift!==void 0&&a.requireShift!==o.shiftKey)continue;const f=o.ctrlKey||o.metaKey;if(a.requireMeta!==void 0){if(a.requireMeta!==f)continue}else{const h=a.noModifiers??!0,p=f||o.altKey||a.requireShift===void 0&&o.shiftKey;if(h&&p)continue}a.preventDefault&&o.preventDefault(),a.stopPropagation&&(o.stopPropagation(),o.stopImmediatePropagation()),a.handler(o);return}},[t]);u.useEffect(()=>{if(e)return window.addEventListener("keydown",r,n),()=>window.removeEventListener("keydown",r,n)},[e,r,n])},we=768,Fe=e=>e!=="desktop",qe=()=>{const e=L(`(min-width: ${we}px)`);return L(oe)?"desktop":e?"tablet":"phone"};function Oe(e){const t=new Map;for(const n of e){const r=n.email.toLowerCase(),o=r.split("@")[0];o&&!t.has(o)&&t.set(o,n.accountId),t.has(r)||t.set(r,n.accountId)}return t}function Be(e){const t=new Map;for(const n of e)for(const r of n){const o=r.fullPath?.toLowerCase();if(!o)continue;const s=o.split("/").pop();t.has(o)||t.set(o,r.mailboxId),s&&!t.has(s)&&t.set(s,r.mailboxId)}return t}function He(e,t=[]){const n=e.flat().filter(s=>s.fullPath),r=new Map;for(const s of n){const a=R(s.fullPath).toLowerCase();r.set(a,(r.get(a)??0)+1)}const o=new Map(t.map(s=>[s.accountId,s.email]));return n.map(s=>{const a=R(s.fullPath),c=r.get(a.toLowerCase())===1,f=t.length>1?o.get(s.accountId):void 0;return{value:c?a:s.fullPath,label:s.displayNameOverride?.trim()||a,...f?{hint:f}:{}}})}function _e(e){const t=new Map;for(const n of e){const r=n.email.toLowerCase().split("@")[0]??"";t.set(r,(t.get(r)??0)+1)}return e.map(n=>{const r=n.email.split("@")[0]??n.email,o=t.get(r.toLowerCase())===1,s=n.displayName?.trim();return{value:o?r:n.email,label:s||n.email,...s?{hint:n.email}:{}}})}export{ve as B,Ke as D,se as K,Ie as R,De as S,Re as a,Me as b,Be as c,qe as d,je as e,Pe as f,Oe as g,ke as h,Fe as i,Le as j,re as k,Ne as l,de as m,He as n,_e as o,ae as s,Te as t,Ae as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t,a0 as o}from"./index-Dz5Qyak4.js";const n=()=>t.jsx(o,{});export{n as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{p as y,o as d,W as x,r as p}from"./index-Dz5Qyak4.js";import{u as Q}from"./search-scope-5OC8b_q5.js";import{b as v}from"./search-view-Ddk04xwo.js";function M(o){const a=y(),{searchInput:c,searchQuery:r}=d(),{q:i=""}=x({from:"/mail"}),n=Q({select:l=>l.location.pathname}),s=p.useRef(i);s.current=i;const{to:e}=o,t="params"in o?o.params.mailboxId:void 0,m=t?`/mail/${t}`:e;p.useEffect(()=>{if(!v({searchInput:c,committedQuery:r,urlQuery:s.current,pathname:n,listPath:m}))return;const f=!!r&&s.current!==r,u=h=>({...h,q:r||void 0});if(!f){a({to:".",search:u,replace:!0});return}if(e==="/mail/$mailboxId"){if(!t)return;a({to:e,params:{mailboxId:t},search:u,replace:!0});return}a({to:e,search:u,replace:!0})},[c,r,a,e,t,m,n])}export{M as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as L,ad as C,af as k,bv as I,bw as A,r as x,j as p,bx as h,by as E,bz as j,o as R,x as Q,bA as z}from"./index-Dz5Qyak4.js";import{aj as D,ak as O,al as _,am as N,an as P}from"./MailListHeader-CjWw8PVT.js";import{a as q}from"./useLabels-DR8CZ_pi.js";import{M as w}from"./enums-CCxx0t2v.js";import{u as U,s as B}from"./search-scope-5OC8b_q5.js";import{n as F}from"./search-query-Cr_ZXBCp.js";import{u as G,p as K}from"./useSearchTokenContext-4dsgVPv9.js";const V=t=>{const{mailboxId:s,messages:i}=t,l=L(),{pushError:c}=C(),{mutateAsync:r,isPending:a}=k({...A(),onError:(o,u)=>{c({title:u.body.action==="Remove"?"Couldn't remove label":"Couldn't apply label",detail:I(o),error:o})},onSettled:(o,u,m)=>{D(l,O(_(m.body.messageIds??[],i??[],s)))}});return{applyLabel:x.useCallback((o,u,m)=>{o.length!==0&&N(o,d=>r({body:{messageIds:d,labelId:u,action:m}}))},[r]),isPending:a}};function oe({accountId:t,mailboxId:s,messageIds:i}){const{labels:l}=q(t),{applyLabel:c}=V({mailboxId:s}),r=x.useMemo(()=>l.map(a=>({key:a.labelId,label:a.name,icon:p.jsx("span",{className:`size-2.5 rounded-full ${E(a.color)?h[a.color]:h.Default}`}),onSelect:()=>c(i,a.labelId,"Apply")})),[l,i,c]);return r.length===0?null:p.jsx(P,{triggerLabel:"Apply label to selected messages",triggerIcon:p.jsx(j,{className:"size-4 text-fg-subtle"}),triggerText:"Apply label",items:r,align:"start",nested:!0,touch:!1,triggerClassName:"min-h-11 w-full justify-start gap-3 px-4 py-2.5 text-sm font-normal text-fg"})}const $=20,H=new Set(Object.values(w)),J=t=>t!==void 0&&H.has(t)?t:void 0,W=t=>{if(t.some(s=>s.type==="isUnread"))return!1;if(t.some(s=>s.type==="isRead"))return!0};function ne({mailboxId:t,filterCategory:s}={}){const{searchQuery:i}=R(),l=G(),c=U({select:e=>e.matches}),r=F(i),{freeText:a,tokens:n}=K(r,l),o=a.length>0,u=n.find(e=>e.type==="category"),m=J(s)??u?.category,d=n.some(e=>e.type==="hasAttachment")?!0:void 0,y=n.some(e=>e.type==="isStarred")?!0:void 0,b=W(n),f=n.find(e=>e.type==="after"),g=n.find(e=>e.type==="before"),S=n.find(e=>e.type==="in"),v=B({matches:c,callerMailboxId:t,inTokenMailboxId:S?.mailboxId}),{data:M,isLoading:T}=Q({...z({query:{query:a,mailboxId:v,limit:$,...m!==void 0?{category:m}:{},...d!==void 0?{hasAttachment:d}:{},...y!==void 0?{hasStars:y}:{},...b!==void 0?{isRead:b}:{},...f?{sentDateFrom:f.epochSeconds}:{},...g?{sentDateTo:g.epochSeconds}:{}}}),enabled:o,staleTime:6e4});return{hits:M?.items??[],isLoading:o&&T}}export{oe as L,ne as u};
|