@remit/web-client-dist 0.0.505 → 0.0.506
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-CwV_QERU.js → BriefPane-B4csHYew.js} +1 -1
- package/assets/{CalendarComposePane-CmHf4mLg.js → CalendarComposePane-B6lpcOv6.js} +1 -1
- package/assets/{CalendarComposeSeed-B2uKXsU-.js → CalendarComposeSeed-0SOVCTqg.js} +1 -1
- package/assets/{CalendarShell-Cyt0QivV.js → CalendarShell-BDFOb4OM.js} +1 -1
- package/assets/{EmptyState-Bzu7cB4A.js → EmptyState-C-Uaku0a.js} +1 -1
- package/assets/{ErrorState-DryJcc3L.js → ErrorState-C0vtUYlV.js} +1 -1
- package/assets/{FlaggedPane-C2DANFWb.js → FlaggedPane-C_YjFOKV.js} +1 -1
- package/assets/{FullCompose-QcSpwDjN.js → FullCompose-DLZy2ADz.js} +1 -1
- package/assets/MailListHeader-CccAOMaF.js +7 -0
- package/assets/{MailNav-vVZwBECH.js → MailNav-CRf8dgsS.js} +1 -1
- package/assets/{MailShell-DPmaQObG.js → MailShell-D-umIjF8.js} +1 -1
- package/assets/{MailViewChrome-GX1QMfcl.js → MailViewChrome-BWWmtlJR.js} +1 -1
- package/assets/MailboxPane-B5AD2Eoi.js +1 -0
- package/assets/{NavMenuButton-BQ6HWNSV.js → NavMenuButton-DeZy-Zu2.js} +1 -1
- package/assets/{OnboardingWizard-yU198-Ji.js → OnboardingWizard-BSquDiwj.js} +1 -1
- package/assets/{OpenCalendarEvent-BnzRw8Nu.js → OpenCalendarEvent-BFSkPf3D.js} +1 -1
- package/assets/{OutboxPane-BfinOqJb.js → OutboxPane-omnqDCZ4.js} +1 -1
- package/assets/_calendarObjectId-BgWmvhC5.js +1 -0
- package/assets/_mailboxId-CsYMpIDz.js +1 -0
- package/assets/_messageId-DncrfRUi.js +1 -0
- package/assets/_messageId-DvahnObf.js +1 -0
- package/assets/_messageId-xE0w9U14.js +1 -0
- package/assets/_outboxMessageId-CInEW2EI.js +1 -0
- package/assets/_recurrenceId-zp8FtBBo.js +1 -0
- package/assets/_threadId-B_tuoKRP.js +1 -0
- package/assets/_threadId-DZcv4pNq.js +1 -0
- package/assets/_threadId-x8WIoYXk.js +1 -0
- package/assets/{_view._date-Us0_1Uah.js → _view._date-DNHpErLm.js} +1 -1
- package/assets/{accounts-ddj94OrU.js → accounts-CifLqlZv.js} +1 -1
- package/assets/advanced-CPTzZZct.js +4 -0
- package/assets/{appearance-CaiDPGFn.js → appearance-DAtFkZBy.js} +1 -1
- package/assets/{attachment-file-JPgSnk-B.js → attachment-file-vco0o51M.js} +1 -1
- package/assets/{attendee-row-819P35ci.js → attendee-row-C2Utg6MN.js} +1 -1
- package/assets/{avatar-DVQL7gNE.js → avatar-D_M8nzbN.js} +1 -1
- package/assets/{bottom-sheet-BU6Ex9hD.js → bottom-sheet-ZafO8jUz.js} +1 -1
- package/assets/{brief-DacQHIEL.js → brief-BDWb3M6F.js} +1 -1
- package/assets/brief-DmIWv7Sl.js +1 -0
- package/assets/{browser-ponyfill-BT5yYuNk.js → browser-ponyfill-5XRYQJtN.js} +1 -1
- package/assets/{bug-DFLhL9u7.js → bug-7tZvHbu1.js} +1 -1
- package/assets/{calendar-C7uu3p3d.js → calendar-DupYkYSP.js} +1 -1
- package/assets/{calendar-color-DaFDa92m.js → calendar-color-BTyDZYAJ.js} +1 -1
- package/assets/{calendar-event-chip-C7WALOu_.js → calendar-event-chip-DetoqSiz.js} +1 -1
- package/assets/{calendars-BW6i1t1h.js → calendars-DuWBPwDM.js} +1 -1
- package/assets/{card-Cbe42Nm_.js → card-BXvQ-xeV.js} +1 -1
- package/assets/chevron-left-3ysgJKV_.js +1 -0
- package/assets/{circle-check-B2SOhBLi.js → circle-check-BckOkdDE.js} +1 -1
- package/assets/{circle-check-big-B71QCndN.js → circle-check-big-LHqneBUQ.js} +1 -1
- package/assets/{circle-help-DzEWy09a.js → circle-help-CEGF57z6.js} +1 -1
- package/assets/{clock-Dr27yplU.js → clock-k7SYZCqI.js} +1 -1
- package/assets/compose._-_outboxMessageId_-BuMK9AcB.js +1 -0
- package/assets/compose._-_outboxMessageId_-DV35h1OB.js +1 -0
- package/assets/compose._-_outboxMessageId_-TlVJFz-w.js +1 -0
- package/assets/compose._-_outboxMessageId_-Y8fDbKYx.js +1 -0
- package/assets/{config-import-BOsE7281.js → config-import-CXaVVcYs.js} +1 -1
- package/assets/{confirm-dialog-D1Z8lP_5.js → confirm-dialog-CCA1Gau9.js} +1 -1
- package/assets/{copy-fDp3MIUq.js → copy-CJsyblYB.js} +1 -1
- package/assets/{credential-steps-D4IewL9J.js → credential-steps-lz8K6IJX.js} +1 -1
- package/assets/{download-CNwO_hle.js → download-BRQ9Shk5.js} +1 -1
- package/assets/{file-json-BMjQCHTH.js → file-json-Wp9p4G3r.js} +1 -1
- package/assets/{filters-DB--nabK.js → filters-C2zQE_3e.js} +1 -1
- package/assets/flagged-CO3pAs9c.js +1 -0
- package/assets/{flagged-MBKYYPqi.js → flagged-DkvKWjo8.js} +1 -1
- package/assets/folders-H4hEoenJ.js +1 -0
- package/assets/{format-1ywn__NA.js → format-CCmnN7HA.js} +1 -1
- package/assets/{help-copy-RlS75KwM.js → help-copy-DdfejbRq.js} +1 -1
- package/assets/{import-BECOrIVT.js → import-0ijHzMOr.js} +1 -1
- package/assets/index-0NUcpaiu.js +1 -0
- package/assets/index-9D1ELSjB.js +1 -0
- package/assets/index-BiSHmkAj.js +1 -0
- package/assets/index-CThtUZvS.js +55 -0
- package/assets/index-CWrtho0O.js +1 -0
- package/assets/{index-CiGlLB-Q.js → index-Cn6SxNcd.js} +61 -61
- package/assets/{index-C_QrqDZt.js → index-DSNVu0Go.js} +1 -1
- package/assets/index-D_8xyDn_.js +1 -0
- package/assets/index-DlWWPw3u.js +1 -0
- package/assets/index-DvahnObf.js +1 -0
- package/assets/index-_E3J4Xiy.js +1 -0
- package/assets/index-xE0w9U14.js +1 -0
- package/assets/{kbd-CWltqL4I.js → kbd-CemCJfRv.js} +1 -1
- package/assets/{labels-DpU-0wg1.js → labels-C801KtXz.js} +1 -1
- package/assets/{mail-Z9lLcnXl.js → mail-BShI0zU_.js} +1 -1
- package/assets/{mail-CmOZy_ab.js → mail-CO5Buwgj.js} +1 -1
- package/assets/{map-pin-CdF9yS8_.js → map-pin-CObvWXUW.js} +1 -1
- package/assets/{menu-CJUUwkl-.js → menu-DOCxVCbE.js} +1 -1
- package/assets/{new-BH_TqfUh.js → new-CwgzbaYW.js} +1 -1
- package/assets/onboarding-KnjT5VL3.js +1 -0
- package/assets/{onboarding-completion-Er7GP_aA.js → onboarding-completion-DKFcH2IK.js} +1 -1
- package/assets/outbox-LQvL6LLE.js +1 -0
- package/assets/{pencil-XV0cyuxP.js → pencil-yco_wOBC.js} +1 -1
- package/assets/{refresh-cw-BywiJYGJ.js → refresh-cw-cZBDyryI.js} +1 -1
- package/assets/{rich-text-C-oIDaYw.js → rich-text-EdwD0SBH.js} +1 -1
- package/assets/{rich-text-spellcheck-worker-provider-CueWtcyI.js → rich-text-spellcheck-worker-provider-DX37b1hv.js} +1 -1
- package/assets/{rotate-ccw-Dj9rQIcI.js → rotate-ccw-86gUoxRm.js} +1 -1
- package/assets/{row-actions-Cy8AdlX1.js → row-actions-Bh8CJfvr.js} +1 -1
- package/assets/{search-mirror-19tETPGa.js → search-mirror-CvKUdI3N.js} +1 -1
- package/assets/{search-token-index--_Yaw1JT.js → search-token-index-DqHw1eQq.js} +1 -1
- package/assets/{sections-N5AHkNWd.js → sections-B2Y54ii6.js} +1 -1
- package/assets/{senders-BMXe1LK2.js → senders-CytNqwEu.js} +1 -1
- package/assets/settings-DGsVsgZv.js +1 -0
- package/assets/{settings-screen-BVxSRYil.js → settings-screen-Bn9otQLz.js} +1 -1
- package/assets/{shield-check-Bb89-hnj.js → shield-check-BtmBvyE7.js} +1 -1
- package/assets/{suggested-vips-JPzpR3JW.js → suggested-vips-BlKUUDkm.js} +1 -1
- package/assets/{useCalendarData-Dgi_LbTF.js → useCalendarData-DuzpHlSg.js} +1 -1
- package/assets/{useCalendars-DL8ceq5a.js → useCalendars-wIHJFyDY.js} +1 -1
- package/assets/{useDebouncedValue-DhsoNveS.js → useDebouncedValue-dy2vzUO0.js} +1 -1
- package/assets/{useFilters-DFHZOQUs.js → useFilters-BWhPcAz-.js} +1 -1
- package/assets/{useLabels-CnbxO3Rn.js → useLabels-DWLKJ3Br.js} +1 -1
- package/assets/{useLayoutTier-DhsTOgzf.js → useLayoutTier-BiiPj1WH.js} +1 -1
- package/assets/useMessageBodyContent-CBvbULm9.js +1 -0
- package/assets/{useQueries-5UKmESBx.js → useQueries-BDPIiJxI.js} +1 -1
- package/assets/{useRefreshControl-ORmLq6k-.js → useRefreshControl-DrptFIOM.js} +1 -1
- package/assets/{useResultFolderIndex-BkHmREnc.js → useResultFolderIndex-DrW4fRep.js} +1 -1
- package/assets/{useSearchTokenContext-Ujq8R6T0.js → useSearchTokenContext-CmyrHkaQ.js} +1 -1
- package/assets/{useSemanticSearch-Bp1CnU53.js → useSemanticSearch-DdYIYMwb.js} +1 -1
- package/assets/{useSignature-CBWAU9NS.js → useSignature-DFSZDQz0.js} +1 -1
- package/assets/{window-hi7bKcsY.js → window-Bk4_63IA.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/MailListHeader-BpHJurnU.js +0 -7
- package/assets/MailboxPane-qwmpIRkg.js +0 -1
- package/assets/_calendarObjectId-DsjIjCCS.js +0 -1
- package/assets/_mailboxId-CGwqx--L.js +0 -1
- package/assets/_messageId-BV7cNlWq.js +0 -1
- package/assets/_messageId-C1w05qiV.js +0 -1
- package/assets/_messageId-DGJhI6hR.js +0 -1
- package/assets/_outboxMessageId-CBBUUuYi.js +0 -1
- package/assets/_recurrenceId-CG5C4Vhu.js +0 -1
- package/assets/_threadId-BOD2bqsI.js +0 -1
- package/assets/_threadId-C9Op59ve.js +0 -1
- package/assets/_threadId-CCJ0UVtG.js +0 -1
- package/assets/advanced-Cv9ctICn.js +0 -4
- package/assets/brief-BZzYcxpw.js +0 -1
- package/assets/chevron-left-ByoFHayz.js +0 -1
- package/assets/compose._-_outboxMessageId_-B9gOYvsk.js +0 -1
- package/assets/compose._-_outboxMessageId_-BEQufRU5.js +0 -1
- package/assets/compose._-_outboxMessageId_-ClL_W4Ah.js +0 -1
- package/assets/compose._-_outboxMessageId_-DQCDLUM1.js +0 -1
- package/assets/flagged-CB_4krzD.js +0 -1
- package/assets/folders-Bs3UdK64.js +0 -1
- package/assets/index-BJF4yYcO.js +0 -1
- package/assets/index-BKmQNnWU.js +0 -55
- package/assets/index-BV7cNlWq.js +0 -1
- package/assets/index-BfrpYNBB.js +0 -1
- package/assets/index-Cevaslue.js +0 -1
- package/assets/index-Cx5qNhSu.js +0 -1
- package/assets/index-CzwLAsqC.js +0 -1
- package/assets/index-DGJhI6hR.js +0 -1
- package/assets/index-DiXUfH0B.js +0 -1
- package/assets/index-bbbyGFjC.js +0 -1
- package/assets/onboarding-gP-gNSQX.js +0 -1
- package/assets/outbox-cWWiZX8o.js +0 -1
- package/assets/settings-DB3vterP.js +0 -1
- package/assets/useMessageBodyContent-DNKN2wNp.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bU as js,bV as Ts,j as r,cK as ws,B as dt,f as te,U as ks,t as Ee,g as Pt,r as c,Y as Ms,Z as Rs,bo as Es,h as It,c as jt,ac as As,i as Tt,cL as Os,cB as Ns,I as zs,a6 as Fs,a2 as Bt,bO as Ds,bi as Ls,cM as _s,cN as Ps,as as $t,aX as Bs,aY as $s,a1 as Ws,q as wt,m as Vs,M as Wt,bl as Ks,G as Hs,bm as qs,bn as Us,cO as Qs,o as Js,cP as Gs,cz as Ys,cQ as Xs,cR as Zs,cS as en,C as Vt,ch as tn,ah as sn,cT as nn,cU as on,aj as rn,cV as an,bx as ln}from"./index-CiGlLB-Q.js";import{u as cn,p as dn,R as un}from"./useSearchTokenContext-Ujq8R6T0.js";import{u as hn,a as fn,R as mn}from"./useRefreshControl-ORmLq6k-.js";import{C as Kt,a as Ht,c as qt,j as gn,M as pn,t as Ut,u as xn,b as bn,d as Qt,e as Jt,f as vn,g as Sn,h as yn,r as Cn,n as In,i as jn,k as Tn,l as wn,m as kn,o as Mn,S as Rn,p as En,D as An,q as On,s as Nn,v as Gt,w as zn,x as Fn,y as Dn,z as Ln,A as _n,B as Yt,E as Pn,F as Bn,G as $n,H as Wn,I as Vn,J as Kn,K as Nt,L as zt,N as Hn,O as qn,P as Un,Q as Qn,R as Jn,T as Gn,U as Yn,V as Xn,W as Zn,X as eo,Y as to,Z as so,_ as Xt,$ as Zt,a0 as es,a1 as no,a2 as oo,a3 as io,a4 as ts,a5 as ro,a6 as ao,a7 as lo}from"./MailListHeader-BpHJurnU.js";import{S as co,M as uo,a as ho,u as fo,b as mo}from"./MailViewChrome-GX1QMfcl.js";import{A as kt}from"./avatar-DVQL7gNE.js";import{c as Qe,d as go,e as ss}from"./format-1ywn__NA.js";import{c as po,f as xo,a as bo,u as vo}from"./useMessageBodyContent-DNKN2wNp.js";import{g as Je,i as So,t as yo,h as Co,j as Io,k as jo,l as To}from"./search-token-index--_Yaw1JT.js";import{N as wo}from"./NavMenuButton-BQ6HWNSV.js";import{C as ko}from"./confirm-dialog-D1Z8lP_5.js";import{f as Mo}from"./ErrorState-DryJcc3L.js";import{a as Ro}from"./useLabels-CnbxO3Rn.js";import{L as Eo,r as Ao,u as Oo}from"./useSemanticSearch-Bp1CnU53.js";import{S as ut}from"./shield-check-Bb89-hnj.js";import{B as No}from"./bottom-sheet-BU6Ex9hD.js";import{C as zo}from"./circle-help-DzEWy09a.js";import{C as Fo}from"./circle-check-B2SOhBLi.js";import{u as Do}from"./useLayoutTier-DhsTOgzf.js";import{n as Lo}from"./search-query-Cr_ZXBCp.js";import{u as _o}from"./sections-N5AHkNWd.js";const Po=({children:e,onRefresh:n,isRefreshing:t})=>js(Ts)?e:r.jsx(ws,{onRefresh:n,isPullable:!t,children:e}),Bo=e=>e===1?"message":"messages";function $o({count:e,onReview:n,onDismiss:t,actionLabel:s="Review & rescue"}){return r.jsx(dt,{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(ut,{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} ${Bo(e)} here`})," ","may not be spam — they're from senders we can verify."]})]}),r.jsx(te,{variant:"primary",size:"sm",onClick:n,className:"self-start",children:s})]})})}const Wo=(e,n)=>e==="vip"?"vip":e==="unknown"&&n==="md"?"unknown-pill":"hidden",ns=({senderTrust:e,size:n="sm",className:t})=>{const s=Wo(e,n);return s==="vip"?r.jsx(ks,{className:Ee("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:Ee("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 Vo({candidate:e,selected:n,onToggle:t,hideSender:s=!1}){const{senderName:o,senderAddress:i,subject:l,snippet:a,trustReason:d,trustSubReason:u,senderTrust:h}=e;return r.jsxs("label",{className:Ee("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(Kt,{className:"mt-0.5",checked:n,onChange:t,"aria-label":`${n?"Deselect":"Select"} ${s?l:`message from ${o}`}`}),!s&&r.jsx(kt,{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}),h&&r.jsx(ns,{senderTrust:h,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:l}),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(Pt,{tone:"positive",children:[r.jsx(ut,{className:"size-3","aria-hidden":!0}),d]}),r.jsx("span",{className:"text-2xs text-fg-subtle",children:u})]})]})]})}const Ko=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)},Ho=(e,n)=>{const t=e.messages.filter(s=>n.has(s.id)).length;return t===0?"none":t===e.messages.length?"all":"some"},Ft=e=>e===1?"message":"messages";function qo({group:e,selected:n,onToggleGroup:t,onToggleMessage:s}){const[o,i]=c.useState(!1),l=Ho(e,n),a=e.messages.length,d=o?Ms:Rs;return r.jsxs("div",{className:Ee(l!=="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(Kt,{className:"mt-0.5",checked:l==="all",indeterminate:l==="some",onChange:()=>t(e,l!=="all"),"aria-label":`${l==="all"?"Deselect":"Select"} all ${a} ${Ft(a)} from ${e.senderName}`}),r.jsx(kt,{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(ns,{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(Pt,{tone:"positive",children:[r.jsx(ut,{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} ${Ft(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(Vo,{candidate:u,selected:n.has(u.id),onToggle:()=>s(u.id),hideSender:!0},u.id))})]})}const Mt=e=>e===1?"message":"messages",Uo=(e,n)=>`Moves ${e===1?"this message":`these ${e} ${Mt(e)}`} out of Spam to ${n} now. Nothing later.`,Ct=(e,n)=>e.find(t=>t.id===n)?.label??"Inbox";function Qo(){return r.jsx(dt,{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 Jo({candidates:e,selected:n,onToggle:t,onToggleGroup:s,onSelectAll:o,onSelectNone:i,onContinue:l,onCancel:a}){const[d,u]=c.useState(!1),h=n.size,g=c.useMemo(()=>Ko(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(ut,{className:"size-4 text-positive","aria-hidden":!0}),"Rescue from Spam"]}),r.jsx(te,{variant:"ghost",size:"sm",icon:r.jsx(zo,{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(Qo,{})})]}),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:`${h} of ${e.length} selected · ${g.length} ${g.length===1?"sender":"senders"}`}),r.jsxs("span",{className:"flex gap-1",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:o,children:"Select all"}),r.jsx(te,{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(qo,{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(te,{variant:"primary",onClick:l,className:"h-11 w-full font-semibold",children:`Continue with ${h} ${Mt(h)}`}),r.jsx(te,{variant:"ghost",onClick:a,className:"h-11 w-full",children:"Cancel"})]})]})}function Go({count:e,folders:n,delimiter:t,destination:s,onPick:o,onMove:i,onBack:l}){const[a,d]=c.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(Es,{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:Ct(n,s)}),r.jsx(te,{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:Uo(e,Ct(n,s))}),r.jsx(te,{variant:"primary",onClick:i,className:"h-11 w-full font-semibold",children:`Move ${e} out of Spam`}),r.jsx(te,{variant:"ghost",onClick:l,className:"h-11 w-full",children:"Back"})]})]})}function Yo({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(Fo,{className:"size-10 text-positive","aria-hidden":!0}),r.jsx("p",{className:"text-base font-semibold text-fg",children:`Moved ${e} ${Mt(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(te,{variant:"primary",onClick:t,className:"h-11 w-full font-semibold",children:"Done"})})]})}function Xo({open:e,candidates:n,defaultDestinationId:t,availableFolders:s,delimiter:o,onConfirmMove:i,onCancel:l}){const[a,d]=c.useState("review"),[u,h]=c.useState(()=>e?new Set(n.map(I=>I.id)):new Set),[g,m]=c.useState(t),[p,C]=c.useState(0),b=c.useRef(!1);c.useEffect(()=>{e&&!b.current&&(d("review"),h(new Set(n.map(I=>I.id))),m(t),C(0)),b.current=e},[e,n,t]);const w=u.size,v=I=>{h(j=>{const E=new Set(j);return E.has(I)?E.delete(I):E.add(I),E})},x=(I,j)=>{h(E=>{const A=new Set(E);for(const L of I.messages)j?A.add(L.id):A.delete(L.id);return A})},k=()=>{const I=Array.from(u);C(I.length),i(I,g),d("done")};return r.jsxs(No,{open:e,onClose:l,dismissLabel:"Close rescue",children:[a==="review"&&r.jsx(Jo,{candidates:n,selected:u,onToggle:v,onToggleGroup:x,onSelectAll:()=>h(new Set(n.map(I=>I.id))),onSelectNone:()=>h(new Set),onContinue:()=>d("destination"),onCancel:l}),a==="destination"&&r.jsx(Go,{count:w,folders:s,delimiter:o,destination:g,onPick:m,onMove:k,onBack:()=>d("review")}),a==="done"&&r.jsx(Yo,{count:p,destinationLabel:Ct(s,g),onClose:l})]})}function Zo(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:Qe(e.updatedAt),isRead:!0}}function ei(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:Qe(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0}}function ti({outboxMessages:e,accountId:n,imapThreads:t}){const s=e.filter(l=>l.status==="draft"&&l.accountId===n).map(Zo),o=t.map(ei),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 si=({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})]}),ni=({row:e,isSelected:n,onOpen:t,onDelete:s,isDeleting:o})=>r.jsxs("button",{type:"button",onClick:()=>t(e.id),className:Ee("group",qt({active:n})),children:[r.jsx(Fs,{className:"size-7 shrink-0 text-fg-muted mt-0.5"}),r.jsx(Ht,{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(Bt,{className:"size-3.5"})})})]}),oi=({row:e,isSelected:n,onOpen:t})=>{const s=!e.isRead;return r.jsxs("button",{type:"button",onClick:()=>t(e.id),className:Ee("group",qt({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(kt,{name:e.fromName,email:e.fromEmail,size:"sm"}),r.jsx(Ht,{thread:e})]})};function ii({accountId:e,selectedMessageId:n,imapThreads:t,title:s,unreadCount:o}){const i=po(),l=xo(),a=Je(),d=It(),{data:u}=jt(As()),h=c.useMemo(()=>ti({outboxMessages:u?.items??[],accountId:e,imapThreads:t}),[u?.items,e,t]),g=Tt({...Ns(),onSuccess:()=>{d.invalidateQueries({queryKey:Os()})}}),m=b=>{g.mutate({path:{outboxMessageId:b}})},p=b=>{const w=t.find(v=>v.messageId===b)?.threadId;w&&a({threadId:w,messageId:b})},C=h.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(wo,{}),r.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:s}),(o??0)>0&&r.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle tabular-nums",children:[o," unread"]})]}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:C?r.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-center px-4",children:[r.jsx(zs,{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."})]}):h.map(b=>r.jsxs("div",{children:[b.label&&r.jsx(si,{label:b.label,count:b.threads.length}),r.jsx("div",{className:"divide-y divide-line",children:b.threads.map(w=>b.id==="remit-drafts"?r.jsx(ni,{row:w,isSelected:w.id===i,onOpen:l,onDelete:m,isDeleting:g.isPending},w.id):r.jsx(oi,{row:w,isSelected:w.id===n,onOpen:p},w.id))})]},b.id))})]})}const os=e=>e===1?"1 message":`${ss(e)} messages`,ri=e=>({title:"Empty Trash?",description:`${os(e)} ${e===1?"is":"are"} erased from the mail server and cannot be restored.`,confirmLabel:"Empty Trash"}),ai=(e,n={})=>{const{trashFolderLabel:t,staleFolderLabel:s}=n;if(e==="unconfirmed"){const o=go(0,"unconfirmed",{trashFolderLabel:t});return{headline:o.title,body:o.description,actionLabel:o.confirmLabel}}return e==="stale"?{headline:"Nothing was emptied.",body:s?`The folder you chose for Trash — ${s} — is gone from the mail server.`:"The folder you chose for Trash is gone from the mail server.",actionLabel:"Pick another folder"}:{headline:"Nothing was emptied.",body:"No folder on this account is set as Trash.",actionLabel:"Pick a folder"}};function li({messageCount:e,isEmptying:n,deletedCount:t,refusalReason:s,trashFolderLabel:o,staleFolderLabel:i,onEmpty:l,onRepair:a,children:d}){const[u,h]=c.useState(!1);if(e<1&&s===void 0&&t===void 0)return r.jsx(r.Fragment,{children:d});const g=s?ai(s,{trashFolderLabel:o,staleFolderLabel:i}):void 0,m=ri(e);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.jsxs("div",{className:"flex flex-col gap-2 rounded-md border border-line px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[t!==void 0&&r.jsx("p",{className:"mr-auto text-2xs text-fg-subtle",role:"status",children:`${os(t)} erased from the mail server.`}),r.jsx(te,{variant:"ghost",size:"sm",icon:r.jsx(Bt,{className:"size-3.5","aria-hidden":!0}),disabled:n||e<1,"aria-busy":n,onClick:()=>h(!0),children:n?"Emptying…":"Empty Trash"})]}),g&&r.jsx(dt,{tone:"warning",variant:"soft",children:r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx("p",{className:"font-semibold text-fg",children:g.headline}),r.jsx("p",{className:"text-sm",children:g.body}),r.jsx(te,{variant:"primary",size:"sm",className:"self-start",onClick:a,children:g.actionLabel})]})})]})}),r.jsx("div",{className:"min-h-0 flex-1",children:d}),r.jsx(ko,{isOpen:u,title:m.title,description:m.description,confirmLabel:m.confirmLabel,destructive:!0,onConfirm:()=>{h(!1),l()},onCancel:()=>h(!1)})]})}function ci(e,n,t){const s=new Array(e);return new Proxy(s,{get(o,i,l){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 h=n[d*2];u=o[d]={index:d,key:t(d),start:h,size:n[d*2+1],end:h+n[d*2+1],lane:0}}return u}}if(i==="length")return e}return Reflect.get(o,i,l)}})}function _e(e,n,t){let s=t.initialDeps??[],o,i=!0;function l(){const a=e();return(a.length!==s.length||a.some((u,h)=>s[h]!==u))&&(s=a,o=n(...a),t?.onChange&&!(i&&t.skipInitialOnChange)&&t.onChange(o),i=!1),o}return l.updateDeps=a=>{s=a},l}function Dt(e,n){if(e===void 0)throw new Error("Unexpected undefined");return e}const di=(e,n)=>Math.abs(e-n)<1.01,ui=(e,n,t)=>{let s;return function(...o){e.clearTimeout(s),s=e.setTimeout(()=>n.apply(this,o),t)}};let Ue;const St=()=>{if(Ue!==void 0)return Ue;if(typeof navigator>"u")return Ue=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Ue=!0;const e=navigator.maxTouchPoints;return Ue=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Lt=e=>{const{offsetWidth:n,offsetHeight:t}=e;return{width:n,height:t}},hi=e=>e,fi=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},mi=(e,n)=>{const t=e.scrollElement;if(!t)return;const s=e.targetWindow;if(!s)return;const o=l=>{const{width:a,height:d}=l;n({width:Math.round(a),height:Math.round(d)})};if(o(Lt(t)),!s.ResizeObserver)return()=>{};const i=new s.ResizeObserver(l=>{const a=()=>{const d=l[0];if(d?.borderBoxSize){const u=d.borderBoxSize[0];if(u){o({width:u.inlineSize,height:u.blockSize});return}}o(Lt(t))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(t,{box:"border-box"}),()=>{i.unobserve(t)}},ct={passive:!0},gi=typeof window>"u"?!0:"onscrollend"in window,pi=(e,n,t)=>{const s=e.scrollElement;if(!s)return;const o=e.targetWindow;if(!o)return;const i=e.options.useScrollendEvent&&gi;let l=0;const a=i?null:ui(o,()=>n(l,!1),e.options.isScrollingResetDelay),d=g=>()=>{l=t(s),a?.(),n(l,g)},u=d(!0),h=d(!1);return s.addEventListener("scroll",u,ct),i&&s.addEventListener("scrollend",h,ct),()=>{s.removeEventListener("scroll",u),i&&s.removeEventListener("scrollend",h)}},xi=(e,n)=>pi(e,n,t=>{const{horizontal:s,isRtl:o}=e.options;return s?t.scrollLeft*(o&&-1||1):t.scrollTop}),bi=(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"]},vi=(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})},Si=vi;class yi{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 l=()=>{const a=i.target,d=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[u,h]of this.elementsCache)if(h===a){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(d)&&this.resizeItem(d,this.options.measureElement(a,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()})}));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:hi,rangeExtractor:fi,onChange:()=>{},measureElement:bi,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 p=t[m];p!==void 0&&(i[m]=p)}const l=this.options;let a=null,d=null,u=!1;if(l!==void 0&&l.enabled&&i.enabled&&i.anchorTo==="end"&&this.scrollElement!==null){const m=l.count,p=i.count,C=this.getMeasurements(),b=m>0?((s=C[0])==null?void 0:s.key)??l.getItemKey(0):null,w=m>0?((o=C[m-1])==null?void 0:o.key)??l.getItemKey(m-1):null;if(p!==m||m>0&&p>0&&(i.getItemKey(0)!==b||i.getItemKey(p-1)!==w)){u=!0;const k=m>0?this.getVirtualItemForOffset(this.getScrollOffset())??C[0]:null;k&&(a=[k.key,this.getScrollOffset()-k.start]);const I=i.followOnAppend===!0?"auto":i.followOnAppend||null;I&&p>m&&this.isAtEnd(l.scrollEndThreshold)&&(m===0||i.getItemKey(p-1)!==w)&&(d=I)}}this.options=i,u&&(this.pendingMin=0,this.itemSizeCacheVersion++);let h=!1,g=0;if(a&&this.scrollOffset!==null){const[m,p]=a,C=this.getMeasurements(),{count:b,getItemKey:w}=this.options;let v=0;for(;v<b&&w(v)!==m;)v++;if(v<b){const x=C[v];if(x){const k=x.start+p;k!==this.scrollOffset&&(g=k-this.scrollOffset,this.scrollOffset=k,h=!0)}}}(h||d)&&(this.pendingScrollAnchor=[h?a[0]:null,h?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,l)=>{if(l&&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=l?a===i?this.scrollDirection:a<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=l,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const i=this.scrollElement,l=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},a=()=>{this._iosTouching=!1,!(!St()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",l,ct),i.addEventListener("touchend",a,ct),this.unsubs.push(()=>{i.removeEventListener("touchstart",l),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,l,a,d]=o;i!==null&&!a&&(St()&&(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,l,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:l,lanes:a,laneAssignmentMode:d,gap:u}),{key:!1}),this.getMeasurements=_e(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:t,paddingStart:s,scrollMargin:o,getItemKey:i,enabled:l,lanes:a,laneAssignmentMode:d,gap:u},h)=>{const g=this.itemSizeCache;if(!l)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const v of this.laneAssignments.keys())v>=t&&this.laneAssignments.delete(v);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(v=>{this.itemSizeCache.set(v.key,v.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 v=t*2;let x=this._flatMeasurements;if(!x||x.length<v){const j=new Float64Array(v);x&&m>0&&j.set(x.subarray(0,m*2)),x=j,this._flatMeasurements=x}let k;if(m===0)k=s+o;else{const j=m-1;k=x[j*2]+x[j*2+1]+u}for(let j=m;j<t;j++){const E=i(j),A=g.get(E),L=typeof A=="number"?A:this.options.estimateSize(j);x[j*2]=k,x[j*2+1]=L,k+=L+u}const I=ci(t,x,i);return this.measurementsCache=I,I}const p=this.measurementsCache.slice(0,m),C=new Array(a).fill(void 0),b=new Float64Array(a);let w=0;for(let v=0;v<m;v++){const x=p[v];x&&(C[x.lane]===void 0&&w++,C[x.lane]=v,b[x.lane]=x.end)}for(let v=m;v<t;v++){const x=i(v),k=this.laneAssignments.get(v);let I,j;const E=d==="estimate"||g.has(x);if(k!==void 0&&this.options.lanes>1){I=k;const F=C[I],J=F!==void 0?p[F]:void 0;j=J?J.end+u:s+o}else if(w===a){let F=0,J=b[0],_=C[0];for(let G=1;G<a;G++){const se=b[G];(se<J||se===J&&C[G]<_)&&(F=G,J=se,_=C[G])}I=F,j=J+u,E&&this.laneAssignments.set(v,I)}else I=v%this.options.lanes,j=s+o,E&&this.laneAssignments.set(v,I);const A=g.get(x),L=typeof A=="number"?A:this.options.estimateSize(v),O=j+L;p[v]={index:v,start:j,size:L,end:O,key:x,lane:I},C[I]===void 0&&w++,C[I]=v,b[I]=O}return this.measurementsCache=p,p},{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=Ii(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,l)=>i===null||l===null?[]:t({startIndex:i,endIndex:l,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)),l=Math.max(0,o-i),a=Math.min(this.options.count-1,o+i);return t>=l&&t<=a}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((l,a)=>{l.isConnected||(this.observer.unobserve(l),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 l,a,d;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)d=this.options.getItemKey(t),a=u[t*2],l=u[t*2+1];else{const m=this.measurementsCache[t];if(!m)return;d=m.key,a=m.start,l=m.size}const h=this.itemSizeCache.get(d)??l,g=s-h;if(g!==0){const m=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=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:l,end:a+l,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()-p):C&&this.applyScrollAdjustment(g),this.notify(!1)}},this.getVirtualItems=_e(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,s)=>{const o=[];for(let i=0,l=t.length;i<l;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,l=is(0,s.length-1,i?a=>o[a*2]:a=>Dt(s[a]).start,t);return Dt(s[l])},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(),l=this.getScrollOffset();s==="auto"&&(s=t>=l+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(),l=this.measurementsCache[t];if(!l)return;if(s==="auto")if(l.end>=i+o-this.options.scrollPaddingEnd)s="end";else if(l.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"?l.end+this.options.scrollPaddingEnd:l.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,s,l.size),s]},this.scrollToOffset=(t,{align:s="start",behavior:o="auto"}={})=>{const i=this.getOffsetForAlignment(t,s),l=this.now();this.scrollState={index:null,align:s,behavior:o,startedAt:l,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[l,a]=i,d=this.now();this.scrollState={index:t,align:a,behavior:o,startedAt:d,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{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,l=this._flatMeasurements;l!=null?o=l[i*2]+l[i*2+1]:o=((t=s[i])==null?void 0:t.end)??0}else{const i=Array(this.options.lanes).fill(null);let l=s.length-1;for(;l>=0&&i.some(a=>a===null);){const a=s[l];i[a.lane]===null&&(i[a.lane]=a.end),l--}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&&(St()&&(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,l=o!==this.scrollState.lastTargetOffset;if(!l&&di(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,l){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 is=(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 Ci(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 Ii(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=Ci(o,i,t);let h=u;const g=t+n;for(;h<i&&o[h*2]+o[h*2+1]<g;)h++;return{startIndex:u,endIndex:h}}let a=is(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 h=Array(s).fill(t+n);for(;a>=0&&h.some(g=>g>=t);){const g=e[a];h[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 yt=typeof document<"u"?c.useLayoutEffect:c.useEffect;function ji({useFlushSync:e=!0,directDomUpdates:n=!1,directDomUpdatesMode:t="transform",...s}){const o=c.useReducer(u=>u+1,0)[1],i=c.useRef({enabled:n,mode:t,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});i.current.enabled=n,i.current.mode=t;const l=u=>{const h=i.current;if(!h.enabled||!h.container)return;const g=u.getTotalSize();if(g!==h.lastSize){h.lastSize=g;const v=u.options.horizontal?"width":"height";h.container.style[v]=`${g}px`}const m=!!u.options.horizontal,p=h.mode==="transform",C=m?"left":"top",b=u.options.scrollMargin,w=u.getVirtualItems();for(const v of w){const x=v.start-b,k=u.elementsCache.get(v.key);k&&h.lastPositions.get(k)!==x&&(h.lastPositions.set(k,x),p?k.style.transform=m?`translate3d(${x}px, 0, 0)`:`translate3d(0, ${x}px, 0)`:k.style[C]=`${x}px`)}},a={...s,onChange:(u,h)=>{var g;const m=i.current;let p=!0;if(m.enabled){l(u);const C=u.range,b=m.prevRange;p=!b||b.isScrolling!==u.isScrolling||b.startIndex!==C?.startIndex||b.endIndex!==C?.endIndex,p&&(m.prevRange=C?{startIndex:C.startIndex,endIndex:C.endIndex,isScrolling:u.isScrolling}:null)}p&&(e&&h?Ds.flushSync(o):o()),(g=s.onChange)==null||g.call(s,u,h)}},[d]=c.useState(()=>{const u=new yi(a);return Object.assign(u,{containerRef:h=>{const g=i.current;if(g.container=h,g.lastSize=null,h&&g.enabled){const m=u.getTotalSize();g.lastSize=m;const p=u.options.horizontal?"width":"height";h.style[p]=`${m}px`}}})});return d.setOptions(a),yt(()=>d._didMount(),[]),yt(()=>d._willUpdate()),yt(()=>{l(d)}),d}function Ti(e){return ji({observeElementRect:mi,observeElementOffset:xi,scrollToFn:Si,...e})}const Rt=e=>e.query?`matching "${e.query}"`:e.from?`from "${e.from}"`:"matching your search",wi=e=>`Select all ${Rt(e)}`,ki=(e,n)=>`All ${ss(n)} ${Rt(e)} selected`,Mi=({verb:e,confirmingDelete:n,hasSelection:t,junkMailboxId:s,currentMailboxId:o,deletableMessageId:i})=>{if(n)return{kind:"withheld"};if(e==="junk"){const l=gn(s,o);if(l!==void 0)return{kind:"unavailable",reason:l}}return t?{kind:"openWizard"}:e!=="delete"||i===void 0?{kind:"declined"}:{kind:"confirmDelete",messageId:i}},Ri=(e,n,t)=>e==="BACK"&&n&&t===void 0,Ei=(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:Qe(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0,trust:e.senderTrust,category:Ut(e.category),messageCount:n,suspicious:e.authenticity?.dkimMismatch===!0,labels:e.labels}),Ai=({thread:e,mailboxId:n,isSelected:t,isFocused:s,isTabStop:o,onFocusRow:i,isChecked:l,onToggleCheck:a,onRowSelect:d,messageCount:u,isMultiSelectMode:h,onLongPress:g,isDesktop:m,density:p})=>r.jsx(pn,{thread:Ei(e,u),link:{mailboxId:n,threadId:e.threadId},inListbox:!0,active:t,focused:s,isTabStop:o,density:p,isDesktop:m,onFocusRow:i,selection:{isChecked:l,onToggleCheck:a,onRowSelect:d,isMultiSelectMode:h,onLongPress:g}}),Oi=c.memo(Ai),Ni=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:Qe(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0,trust:e.senderTrust,category:Ut(e.category),suspicious:n}},zi=({thread:e,mailboxId:n,isSelected:t,isFocused:s,isTabStop:o,onFocusRow:i,isChecked:l,onToggleCheck:a,onRowSelect:d,isMultiSelectMode:u,onLongPress:h,isDesktop:g,onDelete:m,onToggleRead:p,density:C})=>{const[b,w]=c.useState("none"),v=Je(),x=c.useCallback(A=>{navigator.vibrate?.(10),A==="trailing"?m(e.messageId):p(e.messageId,e.isRead),w("none")},[m,p,e.messageId,e.isRead]),k=c.useCallback(()=>{h(e.messageId)},[h,e.messageId]),I=c.useCallback(()=>{a(e.messageId)},[a,e.messageId]),j=c.useCallback(()=>{v({threadId:e.threadId,messageId:e.messageId})},[v,e.threadId,e.messageId]),E=xn(e.messageId,d);return g||u?r.jsx(Oi,{thread:e,mailboxId:n,isSelected:t,isFocused:s,isTabStop:o,onFocusRow:i,isChecked:l,onToggleCheck:a,onRowSelect:d,isMultiSelectMode:u,onLongPress:h,isDesktop:g,density:C}):r.jsx("div",{role:"presentation",onPointerDownCapture:E.onMouseDown,onClickCapture:E.claimClick,onContextMenu:E.onContextMenu,children:r.jsx(co,{thread:Ni(e),selectionMode:!1,checked:!1,active:t,peek:b,onPeek:w,onToggleCheck:I,onLongPress:k,onOpen:j,onAct:x})})},Fi=72,Di=32,Li=5,rs="remit:list-density",_i=()=>{try{const e=localStorage.getItem(rs);if(e==="compact"||e==="comfortable")return e}catch{}return"comfortable"},Pi=({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(Ws,{className:"size-4 text-fg-muted"}),r.jsxs("span",{className:"text-sm text-fg-muted",children:["Results for “",e,"”"]})]}),Bi=(e,n,t)=>Ao(e.filter(s=>n.has(s.messageId)).map(s=>s.accountId??t)).moveDisabledHint,$i=({mailboxId:e,threads:n,selectedMessageId:t,isLoading:s,isError:o=!1,error:i,onRetry:l,searchQuery:a,searchPredicate:d,onDeleteMessages:u,isDeleting:h=!1,isMoving:g=!1,onLoadMore:m,hasMore:p=!1,isLoadingMore:C=!1,accountId:b,listTitle:w,listMeta:v,listFilter:x,listScopeLabel:k,onTriageContextChange:I,commandsRef:j,hideHeader:E=!1})=>{const A=c.useRef(null),L=Je(),O=Ls(),F=_s(),{verb:J,start:_,startFromSearch:G}=F,se=Ps(),pe=!!a?.trim(),P=bn(),{labels:Pe}=Ro(b),{pushError:ae}=$t(),[M,Ce]=c.useState(t),[W,Ie]=c.useState(),V=c.useCallback(f=>{Ie(S=>S===f?S:void 0),Ce(f)},[]),[D,Be]=c.useState(_i),xe=c.useCallback(()=>{Be(f=>{const S=f==="comfortable"?"compact":"comfortable";try{localStorage.setItem(rs,S)}catch{}return S})},[]),{toggleReadFor:be}=Qt({mailboxId:e}),{junkMailboxId:le}=Jt(b),Ae=Gt(le,e),Oe=c.useMemo(()=>[{accountId:b,mailboxId:e}],[b,e]),{outcome:ce,staleFolderLabel:K,guessedMailboxId:H}=vn(Oe),{selectedIds:Z,selectedCount:q,hasSelection:oe,isSelected:Ne,toggle:ee,select:je,clearSelection:de,selectRange:ue,setAnchor:N,selectAll:Te,toggleAll:$e,intersectWith:ze}=Sn(),R=Nn(q,O),[Fe,he]=c.useState(null),We=pe&&!!d,Ge=`${e}|${JSON.stringify(d??{})}`,T=yn({mailboxId:e,accountId:b,enabled:We,predicateKey:Ge,searchQuery:d??{}}),Ye=c.useCallback((f,S,ge)=>{const Q=Cn(f,S,ge,ce);Q&&ae(Q)},[ae,ce]),we=T.phase.kind,Xe=T.clear,z=c.useCallback(()=>{we==="escalated"&&Xe(),de()},[de,Xe,we]),[Ze,et]=c.useState(null),ve=c.useRef(null),ie=c.useRef(!1),Se=c.useRef(null),ke=!s&&n.length>0,ne=Ti({count:n.length,getScrollElement:()=>A.current,estimateSize:()=>D==="compact"?Di:Fi,overscan:Li}),Ve=t?n.findIndex(f=>f.messageId===t):-1,Y=M?n.findIndex(f=>f.messageId===M):-1,re=c.useCallback(f=>{if(f<0||f>=n.length)return;const S=n[f];if(R){ee(S.messageId);return}ve.current=S.messageId,ie.current=!1,Ie(S.messageId),Ce(S.messageId)},[n,R,ee]),Ke=c.useCallback(()=>{if(n.length===0)return;const f=Y<0?0:Math.min(Y+1,n.length-1);re(f)},[n.length,Y,re]),He=c.useCallback(()=>{if(n.length===0)return;const f=Y<=0?0:Y-1;re(f)},[n.length,Y,re]),ye=c.useCallback(()=>re(0),[re]),Me=c.useCallback(()=>re(n.length-1),[re,n.length]),Re=c.useCallback(()=>{M&&ee(M)},[M,ee]),B=c.useMemo(()=>n.map(f=>f.messageId),[n]),ft=c.useMemo(()=>{const f=[];for(const S of n)Z.has(S.messageId)&&f.push({id:S.messageId,sender:S.fromName??S.fromEmail??"Unknown",email:S.fromEmail??"",subject:S.subject??"(No subject)",date:Qe(S.sentDate),accountId:b});return f},[n,Z,b]),mt=c.useCallback((f,S)=>S.shiftKey?(ue(B,f,M),!0):S.metaKey||S.ctrlKey?(ee(f),!0):(z(),N(f),!1),[B,M,ue,ee,z,N]),fe=c.useCallback(f=>{!u||f.length===0||(Se.current=M??null,he(f))},[u,M]),De=c.useCallback(f=>{const S=In(B,M,f);S!==void 0&&(ue(B,S),ve.current=S,ie.current=!1,Ie(void 0),Ce(S))},[B,M,ue]),tt=c.useCallback(()=>De(-1),[De]),st=c.useCallback(()=>De(1),[De]),nt=c.useCallback(()=>{B.length>0&&Te(B)},[B,Te]),ot=c.useCallback(f=>{const S=Mi({verb:f,confirmingDelete:Fe!==null,hasSelection:oe,junkMailboxId:le,currentMailboxId:e,deletableMessageId:u?M:void 0});return S.kind==="openWizard"?(_(f),!0):S.kind==="confirmDelete"?(fe([S.messageId]),!0):S.kind==="unavailable"?(ae({severity:"warning",title:S.reason}),!0):S.kind==="withheld"},[Fe,u,oe,le,e,_,M,fe,ae]),me=c.useCallback((f,S)=>{const ge=n.find(Q=>Q.messageId===f)?.threadId;ge&&L({threadId:ge,messageId:f},{replace:S?.replace})},[L,n]),it=c.useCallback(()=>{M&&me(M)},[M,me]),rt=c.useCallback(f=>me(f,{replace:!0}),[me]);jn({keyboardFocusedMessageId:W,openMessageId:t,enabled:O&&q===0,open:rt});const Le=T.phase.kind==="escalated"?{scope:Rt(d??{}),total:T.phase.total,searchQuery:d??{},run:f=>T.runAction(f),stop:T.stop}:void 0,gt=c.useCallback(f=>{if(f.length===0){he(null);return}const S=new Set(f),ge=n.findIndex(X=>S.has(X.messageId));let Q;for(let X=ge+1;X<n.length;X++)if(!S.has(n[X].messageId)){Q=n[X].messageId;break}if(Q===void 0){for(let X=ge-1;X>=0;X--)if(!S.has(n[X].messageId)){Q=n[X].messageId;break}}u?.(f),z(),Se.current=null,he(null),Q!==void 0&&(ve.current=Q,ie.current=!1,V(Q),O&&me(Q,{replace:!0})),O||et(Tn("delete",f.length,ce))},[n,u,z,me,O,V,ce]),pt=c.useCallback(()=>{const f=Se.current;Se.current=null,he(null),f!==null&&(ve.current=f,ie.current=!1,V(f))},[V]),qe=c.useMemo(()=>Bi(n,Z,b),[b,Z,n]),at=c.useCallback(()=>{if(Le){G();return}_("organize")},[Le,G,_]),xt=c.useCallback(f=>{u?.([f])},[u]),y=c.useCallback((f,S)=>{be([f],!S)},[be]),U=c.useCallback(f=>{O||je(f)},[O,je]),$=c.useCallback(()=>{if(T.isRunning||T.phase.kind==="counting"){T.stop();return}z()},[T,z]),ds=c.useCallback(()=>{T.clear()},[T]);c.useEffect(()=>{if(ie.current||!O&&t)return;const f=Y>=0?Y:Ve;f>=0&&ne.scrollToIndex(f,{align:"auto"})},[Y,Ve,ne,O,t]),c.useEffect(()=>{t&&(ie.current=!1,V(t))},[t,V]),c.useEffect(()=>{M&&(n.some(f=>f.messageId===M)||V(n[0]?.messageId))},[n,M,V]),c.useEffect(()=>{I?.({focusedMessageId:M,selectedIds:Array.from(Z),hasList:ke})},[M,Z,ke,I]);const Et=c.useRef(I);Et.current=I,c.useEffect(()=>()=>Et.current?.({focusedMessageId:void 0,selectedIds:[],hasList:!1}),[]),c.useEffect(()=>{T.phase.kind!=="idle"||T.isRunning||ze(n.map(f=>f.messageId))},[n,ze,T.phase,T.isRunning]);const At=c.useRef(e);c.useEffect(()=>{At.current!==e&&(At.current=e,z())},[e,z]),wn({shouldBlockFn:({action:f})=>Ri(f,oe,se)?(z(),!0):!1,enableBeforeUnload:!1,disabled:!oe||se!==void 0}),c.useEffect(()=>{const f=A.current;if(!f||!p||!m)return;const S=()=>{if(C)return;const{scrollTop:ge,scrollHeight:Q,clientHeight:X}=f;ge+X>=Q-200&&m()};return f.addEventListener("scroll",S,{passive:!0}),S(),()=>f.removeEventListener("scroll",S)},[p,C,m]),c.useEffect(()=>{const f=ve.current;if(!f)return;const S=A.current?.querySelector(`[data-message-id="${f}"]`);S&&(ve.current=null,S.focus({preventScroll:!0}))}),c.useEffect(()=>{if(j){if(!ke){j.current=null;return}return j.current={focusNext:Ke,focusPrevious:He,focusFirst:ye,focusLast:Me,openFocused:it,toggleSelect:Re,extendSelectDown:st,extendSelectUp:tt,selectAll:nt,clearSelection:()=>oe?(z(),!0):!1,requestVerb:ot,toggleDensity:xe},()=>{j.current=null}}},[j,ke,Ke,He,ye,Me,it,Re,st,tt,nt,oe,z,ot,xe]);const Ot=s?"loading":o?"error":n.length===0?"empty":"ready",us=o?Mo(i):void 0,hs=c.useCallback(()=>{const f=Bs($s());window.open(f,"_blank","noopener,noreferrer")},[]),fs=[{id:"inbox",threads:[]}],bt=B.length>0&&B.every(f=>Z.has(f)),ms=We&&p&&bt&&!h&&!g&&T.phase.kind==="idle"&&!T.isRunning,gs=h||g||T.isRunning,vt=T.phase.kind==="escalated"?T.phase.total:q,ps=T.runningAction?kn(T.runningAction.kind,T.progress?.done??0,T.progress?.total??vt):T.phase.kind==="counting"?"Counting matches…":T.phase.kind==="escalated"?ki(d??{},T.phase.total):void 0,xs=T.phase.kind!=="escalated"&&B.length>0?{checked:bt,indeterminate:q>0&&!bt,onChange:()=>$e(B)}:void 0,bs=T.runningAction?{value:T.progress?.done??0,max:T.progress?.total??vt,tone:Mn(T.runningAction.kind)}:void 0,vs=(T.phase.kind==="counting"?{tone:"info",text:"",action:{label:"Stop",onClick:T.stop}}:T.phase.kind==="escalated"&&!T.isRunning?{tone:"info",text:"",action:{label:"Clear selection",onClick:ds}}:ms?{tone:"info",text:"",action:{label:wi(d??{}),onClick:T.escalate}}:void 0)??(qe?{tone:"warning",text:qe}:void 0),Ss=r.jsx(Rn,{title:P.title||w,navSlot:P.navSlot,titleMeta:P.titleMeta,searchSlot:P.searchSlot,searchField:P.searchField,idleSlot:P.makeFilterSlot,count:vt,onCancel:$,onDelete:()=>_("delete"),onMove:()=>_("move"),onOrganize:at,onJunk:Ae?()=>_("junk"):void 0,onMarkRead:()=>_("markRead"),overflowSlot:b&&e&&q>0&&Pe.length>0?r.jsx(Eo,{accountId:b,mailboxId:e,messageIds:Array.from(Z)}):void 0,isBusy:gs,isCounting:T.phase.kind==="counting",selectAll:xs,statusLabel:ps,progress:bs,notice:vs}),ys=En(B,M),Cs=c.useCallback(f=>{ie.current=!0,V(f)},[V]),Is=r.jsxs(r.Fragment,{children:[pe&&a&&r.jsx(Pi,{query:a}),r.jsxs("div",{ref:A,role:"listbox","aria-multiselectable":!0,"aria-label":w,className:"flex-1 overflow-y-auto",children:[r.jsx("div",{role:"presentation",className:"relative w-full",style:{height:`${ne.getTotalSize()}px`},children:ne.getVirtualItems().map(f=>{const S=n[f.index];return r.jsx("div",{role:"presentation","data-index":f.index,ref:ne.measureElement,className:Ee("absolute left-0 top-0 w-full border-b border-line",T.isRunning&&"pointer-events-none opacity-50"),style:{transform:`translateY(${f.start}px)`},children:r.jsx(zi,{thread:S,mailboxId:e,isSelected:t===S.messageId,isFocused:M===S.messageId,isTabStop:ys===S.messageId,onFocusRow:Cs,isChecked:Ne(S.messageId),onToggleCheck:ee,onRowSelect:mt,isMultiSelectMode:R,onLongPress:U,isDesktop:O,onDelete:xt,onToggleRead:y,density:D})},f.key)})}),C&&r.jsx(uo,{})]})]});return r.jsxs(r.Fragment,{children:[Ze&&!O&&r.jsx(dt,{tone:"success",variant:"soft",className:"m-2 rounded-md",onDismiss:()=>et(null),children:Ze}),r.jsx(ho,{listTitle:w,listMeta:v,sections:fs,flatList:!0,listState:P.searchResults?"ready":Ot,searchQuery:pe?a:void 0,listFilter:x,listScopeLabel:k,errorMessage:us,onRetry:l,onReportError:hs,density:D,selectedThreadId:t,onSelectThread:f=>me(f),isDesktop:O,hideHeader:E,selectionBar:Ss,listBody:P.searchResults??(Ot==="ready"?Is:void 0)}),r.jsx(An,{isOpen:Fe!==null,messageIds:Fe??[],outcome:ce,accountId:b,trashFolderLabel:w,staleFolderLabel:K,guessedMailboxId:H,isDeleting:h,onConfirm:gt,onCancel:pt}),r.jsx(On,{verb:J,accountId:b,mailboxId:e,selection:ft,selectionRestriction:qe?"spansAccounts":void 0,escalated:Le,escalatedProgress:T.progress,onFinished:z,onRunEnded:Ye})]})},Wi=e=>Wt({path:{accountId:e}}),Vi=e=>{const n=It(),t=wt(),s=Tt({...Vs(),onSuccess:()=>{t.recordEvent("sync.triggered"),n.invalidateQueries({queryKey:Wi(e)})}});return{trigger:()=>{s.mutate({path:{accountId:e}})},triggerAsync:()=>s.mutateAsync({path:{accountId:e}}),isPending:s.isPending,error:s.error,reset:s.reset}},Ki=({accountId:e,children:n})=>{const{triggerAsync:t,isPending:s}=Vi(e);return r.jsx(Po,{onRefresh:t,isRefreshing:s,children:n})};function Hi({accountId:e,currentMailboxId:n,candidates:t,onMove:s,children:o}){const[i,l]=c.useState(!1),a=wt(),d=Ks(),{inboxMailboxId:u}=zn(e),h=Fn(e),{data:g}=jt({...Hs({path:{accountId:e}}),staleTime:1/0}),m=c.useMemo(()=>qs({mailboxes:g?.items??[],folderAppointments:h,currentMailboxId:n,translator:d}),[g?.items,h,n,d]),p=c.useMemo(()=>u||(m.find(x=>x.label.toLowerCase()==="inbox")?.id??m.find(x=>!x.isCurrent)?.id??""),[u,m]),C=c.useRef(!1);c.useEffect(()=>{C.current||(C.current=!0,Dn(a,t.length))},[a,t.length]);const b=c.useCallback(()=>{Ln(a,t.length),l(!0)},[a,t.length]),w=c.useCallback((v,x)=>{_n(a,{selected:v.length,total:t.length,toInbox:x===u}),s(v,x)},[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($o,{count:t.length,onReview:b})}),r.jsx("div",{className:"min-h-0 flex-1",children:o}),r.jsx(Xo,{open:i,candidates:t,defaultDestinationId:p,availableFolders:m,delimiter:Us(g?.items??[]),onConfirmMove:w,onCancel:()=>l(!1)})]})}const qi=(e,n,t,s)=>`${e??""}|${n}|${t??""}|${s??""}`,Ui=({accountId:e,mailboxId:n})=>{const t=It(),{pushError:s}=$t(),{requestAppointment:o}=Qs(),{trashByAccount:i}=Yt(),l=e?i.get(e):void 0,a=qi(e,n,l?.mailboxId,l?.source),[d,u]=c.useState({scope:a});d.scope!==a&&u({scope:a});const h=d.scope===a?d:void 0,g=c.useCallback(()=>t.getQueryData(Js())?.accounts.find(j=>j.accountId===e)?.folderAppointments.find(j=>j.role==="Trash")?.mailboxId??n,[t,e,n]),m=c.useRef(void 0),{mutateAsync:p,isPending:C}=Tt({...Xs(),onMutate:()=>(m.current=a,{scope:a,listMailboxId:g()}),onSuccess:(x,k,I)=>{I.scope===a&&u({scope:a,deletedCount:x.deletedCount})},onError:(x,k,I)=>{const j=Gs(x);if(!j){s({title:"Couldn't empty Trash",detail:Ys(x),error:x});return}I?.scope===a&&u({scope:a,refusal:j})},onSettled:(x,k,I,j)=>{m.current===j?.scope&&(m.current=void 0),So(t,yo([j?.listMailboxId??n])),e&&t.invalidateQueries({queryKey:Wt({path:{accountId:e}})})}}),b=c.useCallback(()=>e?(u({scope:a}),p({path:{accountId:e}}).then(()=>{},()=>{})):Promise.resolve(),[e,a,p]),w=c.useCallback(()=>{b()},[b]),v=c.useCallback(()=>{const x=h?.refusal;x&&o({accountId:x.accountId,role:x.role,reason:x.reason,action:{kind:"emptyTrash"},onAppointed:b})},[h,o,b]);return{emptyTrash:w,isEmptying:C&&m.current===a,deletedCount:h?.deletedCount,refusal:h?.refusal,repair:v}},Qi="We can verify this sender";function Ji(e){const{data:n}=jt({...Zs({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:Qi,trustSubReason:Pn(s.senderTrust),senderTrust:s.senderTrust}))}}const Gi=e=>{const n=new Set,t=[];for(const s of e)n.has(s.threadMessageId)||(n.add(s.threadMessageId),t.push(s));return t},Yi={unread:"unread",flagged:"starred",attachment:"attachments"},Xi=new Set(Object.values(en)),as=e=>Xi.has(e),Zi=e=>as(e.category)||e.attributes.size>0,er=e=>{const n={};as(e.category)&&(n.category=[e.category]);for(const t of e.attributes){const s=Yi[t];s&&(n[s]=!0)}return n},tr=e=>(e.senderTrust?.length??0)>0||e.dkimMismatch!==void 0?"loaded-pages":"whole-folder",sr=["category","unread","starred","attachments"],_t=e=>JSON.stringify(sr.map(n=>e?.[n]??null)),nr=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},or=(e,n)=>{const t=nr(e);return t?_t(t)===_t(n):!1},lt=e=>e[0],ir=e=>{const n=lt(e.filter(a=>a.type==="from").map(a=>a.value)),t=lt(e.filter(a=>a.type==="subject").map(a=>a.value)),s=lt(e.filter(a=>a.type==="category").map(a=>a.category)),o=lt(e.filter(a=>a.type==="isUnread"||a.type==="isRead").map(a=>a.type==="isUnread")),i=e.some(a=>a.type==="isStarred")?!0:void 0,l=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}:{},...l!==void 0?{attachments:l}:{}}},rr=(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 ar(e,n={}){const t=ir(e),s={...t,...n};return{params:t,residual:e.filter(o=>!rr(s,o))}}function lr(e,n,t){if(n.length===0)return e;const s=[...n];return e.filter(o=>{const i=Bn(o);return $n({...i,accountId:i.accountId??t},s)})}const cr=50,dr=new Map(ts().categories.filter(e=>e.id!=="all").map(e=>[e.id,e.label])),ls=c.createContext(null);function ht(){const e=c.useContext(ls);if(!e)throw new Error("MailboxPane.* must be used inside <MailboxPane>");return e}function ur({mailboxId:e,thread:n,children:t}){const s=Je(),o=Co(),i=_o(),l=n?.threadId,a=n?.messageId,d=wt(),{accounts:u,searchQuery:h,onToggleIntelligence:g}=Vt(),m=cn(),p=Lo(h),C=p.length>0,{freeText:b,tokens:w}=dn(p,m),[v,x]=c.useState("all"),[k,I]=c.useState(new Set),j=c.useMemo(()=>({category:v,attributes:k}),[v,k]),E=c.useMemo(()=>er(j),[j]),A=C||Zi(j),{params:L,residual:O}=ar(w,E),F={order:"desc",limit:cr,...b?{query:b}:{},...L,...E},J={category:F.category,unread:F.unread,starred:F.starred,attachments:F.attachments},_=A?tn({path:{mailboxId:e},query:F}):sn({path:{mailboxId:e},query:{order:"desc"}}),{data:G,isLoading:se,isError:pe,error:P,refetch:Pe,fetchNextPage:ae,hasNextPage:M,isFetchingNextPage:Ce}=fo({queryKey:_,queryFn:async({pageParam:y})=>{if(A){const{data:$}=await an({path:{mailboxId:e},query:{...F,continuationToken:y},throwOnError:!0});return $}const{data:U}=await ln({path:{mailboxId:e},query:{order:"desc",continuationToken:y},throwOnError:!0});return U},initialPageParam:void 0,getNextPageParam:y=>y.continuationToken,placeholderData:(y,U)=>or(U?.queryKey,J)?y:void 0}),{accountId:W,isLoading:Ie}=Wn(e),V=Io({accounts:u}),D=lr(Vn(Gi(G?.pages.flatMap(y=>y.items??[])??[])),O,W),Be=c.useCallback(y=>{x(y)},[]),xe=c.useCallback(y=>{I(U=>{const $=new Set(U);return $.has(y)?$.delete(y):$.add(y),$})},[]),be=c.useCallback(()=>{x("all"),I(new Set)},[]),le=dr.get(v),Ae=le?{label:le,reach:O.length>0?"loaded-pages":tr(F),onClear:be}:void 0,Oe=l?D.find(y=>y.messageId===a)??D.find(y=>y.threadId===l):void 0,ce=Kn(l,a),K=Oe??ce,H=a??K?.messageId,Z=c.useMemo(()=>{if(l)return{threadId:l,mailboxId:K?.mailboxId??e,subject:K?.subject,messageId:H,authenticity:K?.authenticity}},[l,K,H,e]),q=c.useCallback(y=>{H&&y.includes(H)&&o()},[H,o]),{deleteMessages:oe,isPending:Ne}=Nt({mailboxId:e,onAfterOptimisticRemove:q}),{moveMessages:ee,isPending:je}=zt({mailboxId:e,accountId:W,onAfterOptimisticRemove:q}),de=c.useRef(null),ue=Hn(),{listCommandsRef:N,onTriageContextChange:Te,focusedMessageId:$e,selectedIds:ze}=ue,R=D.find(y=>y.messageId===$e)??K,Fe=jo({accounts:u})??0,he=qn({thread:K,isOpen:!0,mailboxId:e,accountId:W,onAfterOptimisticRemove:q}),{draftsMailboxId:We}=Un(W),Ge=We!==void 0&&We===e,{archiveMailboxId:T}=Qn(W),Ye=Jn(),we=nn(),Xe=c.useMemo(()=>on(we,l,H),[we,l,H]),z=c.useMemo(()=>{if(R)return y=>we({threadId:R.threadId,messageId:R.messageId,mode:y})},[we,R]),Ze=bo(),et=rn(),ve=vo(),ie=c.useCallback(y=>y?Ye(y):[],[Ye]),{toggleStar:Se}=Gn({threadId:R?.threadId??"",mailboxId:e}),{toggleReadFor:ke}=Qt({mailboxId:e,accountId:W}),{junkMailboxId:ne}=Jt(W),Ve=ne!=null&&ne===e,Y=Gt(ne,e),{candidates:re}=Ji(Ve?ne:void 0),{moveMessages:Ke}=zt({mailboxId:e,threadId:R?.threadId,accountId:W,onAfterOptimisticRemove:q}),{deleteMessages:He}=Nt({mailboxId:e,threadId:R?.threadId,onAfterOptimisticRemove:q}),{addressId:ye,address:Me}=Yn(R),{updateFlags:Re}=Xn({addressId:ye,senderEmail:R?.fromEmail??void 0}),B=c.useCallback(()=>z?.("reply"),[z]),ft=c.useCallback(()=>z?.("reply-all"),[z]),mt=c.useCallback(()=>z?.("forward"),[z]),fe=c.useCallback(()=>ie(R),[ie,R]),De=c.useCallback(()=>{if(N.current?.requestVerb("delete"))return;const y=fe();y.length>0&&He(y)},[N,fe,He]),tt=c.useCallback(()=>{if(N.current?.requestVerb("junk")||!Y)return;const y=fe();y.length!==0&&(Zn(d,{count:y.length,senderTrust:R?.senderTrust??"unknown",wasRescuable:R?eo(R):!1}),Ke(y,Y))},[N,Y,fe,Ke,d,R]),st=c.useCallback(()=>{if(ze.length>0){const y=!(R?.hasStars??!1),U=new Set(ze);for(const $ of D)U.has($.messageId)&&$.hasStars!==y&&Se($.messageId,$.hasStars);return}R&&Se(R.messageId,R.hasStars)},[ze,D,R,Se]),nt=c.useCallback(()=>{if(N.current?.requestVerb("markRead"))return;const y=fe();if(y.length===0)return;const U=!(R?.isRead??!1);ke(y,U)},[N,fe,R,ke]),ot=c.useCallback(()=>{if(!ye)return;const y=Me?.flags?.muted?.value!==!0;Re({muted:{value:y}})},[ye,Me,Re]),me=c.useCallback(()=>{if(!ye)return;const y=Me?.flags?.vip?.value!==!0;Re({vip:{value:y}})},[ye,Me,Re]),it=c.useCallback(()=>{de.current?.open()},[]),rt=Ge?"drafts":T===e?"archive":ne===e?"junk":"inbox",Le=c.useRef("");c.useEffect(()=>{const y=Le.current;Le.current=p,p.length>0&&y.length===0&&d.recordEvent("search.submitted",{mailboxType:rt})},[p,rt,d]);const{goBack:gt,nextMessageId:pt,previousMessageId:qe}=to({context:ue,orderedIds:D.map(y=>y.messageId),selectedMessageId:H,enabled:!Ze&&!et,hasOpenThread:l!==void 0,onClose:o,handlers:{reply:B,replyAll:ft,forward:mt,delete:De,toggleStar:st,toggleRead:nt,muteSender:ot,blockSender:K?it:void 0,vipSender:me,markJunk:tt,toggleIntelligence:K?()=>de.current?.toggle():void 0,compose:ve,goBrief:()=>i("brief"),goInbox:()=>i("brief"),goSent:()=>i("brief"),goFlagged:()=>i("flagged"),goSettings:()=>i("settings")}}),at=y=>{if(!y)return;const U=D.find($=>$.messageId===y);return U?{threadId:U.threadId,messageId:y}:void 0},xt={mailboxId:e,selectedMessageId:H,selectedThread:K,conversation:Z,onOpenThread:s,threads:D,isLoading:se,isError:pe,error:P,mailboxAccountId:W,mailboxAccountLoading:Ie,mailboxName:V,unreadCount:Fe,isDraftsMailbox:Ge,isSpamFolder:Ve,rescueCandidates:re,filterCategory:v,filterAttributes:k,onSelectFilterCategory:Be,onToggleFilterAttribute:xe,onClearFilters:be,listFilter:Ae,onToggleIntelligence:g,intelligenceRef:de,handleDeselectIfRemoved:q,searchPredicate:C&&O.length===0?F:void 0,onDeleteMessages:oe,onMoveMessages:ee,isDeleting:Ne,isMoving:je,onLoadMore:ae,hasMore:M,isLoadingMore:Ce,onTriageContextChange:Te,listCommandsRef:N,onRetry:()=>Pe(),onReply:Xe,onToolbarDelete:he.deleteThread,onToolbarStar:he.toggleStar,isStarred:he.isStarred,onToolbarMove:he.moveThread,onBack:gt,nextThread:at(pt),previousThread:at(qe)};return r.jsx(ls.Provider,{value:xt,children:t})}function cs(){const{mailboxId:e,selectedMessageId:n,threads:t,isLoading:s,isError:o,error:i,onDeleteMessages:l,onMoveMessages:a,isDeleting:d,isMoving:u,onLoadMore:h,hasMore:g,isLoadingMore:m,mailboxAccountId:p,mailboxName:C,unreadCount:b,isDraftsMailbox:w,isSpamFolder:v,rescueCandidates:x,onTriageContextChange:k,listCommandsRef:I,onRetry:j,filterCategory:E,filterAttributes:A,onSelectFilterCategory:L,onToggleFilterAttribute:O,onClearFilters:F,listFilter:J,searchPredicate:_}=ht(),{searchQuery:G,searchInput:se,accounts:pe,resultFolderIndex:P}=Vt(),Pe=Do(),ae=Je(),M=C??"Inbox",Ce=c.useMemo(()=>ts(),[]),{trashMailboxId:W}=ro(p),Ie=To({accounts:pe}),{trashByAccount:V}=Yt(),D=Ui({accountId:p,mailboxId:e}),Be=W!=null&&W===e,xe=c.useMemo(()=>p?[p]:[],[p]),{hasNewMail:be}=hn(),{state:le,errorMessage:Ae,refresh:Oe}=fn(xe,{onSettled:j}),ce=c.useMemo(()=>r.jsx(mn,{state:le,onRefresh:Oe,label:`Refresh ${M}`,errorMessage:Ae,hasUpdate:be(xe)}),[le,Oe,M,Ae,be,xe]),K=c.useMemo(()=>t.map(N=>ao(N,P)),[t,P]),{hits:H,isLoading:Z}=Oo({mailboxId:e,filterCategory:E}),q=c.useMemo(()=>lo(H,t.map(N=>N.threadId),P),[H,t,P]),oe=c.useCallback(N=>{const Te=N.threadId??t.find($e=>$e.messageId===N.id)?.threadId;Te&&ae({threadId:Te,messageId:N.id},{mailboxId:N.mailboxId??e,query:se})},[e,ae,se,t]);if(w&&p)return r.jsx(ii,{accountId:p,selectedMessageId:n,imapThreads:t,title:C??"Drafts",unreadCount:b??void 0});const Ne=r.jsx($i,{mailboxId:e,threads:t,selectedMessageId:n,isLoading:s,isError:o,error:i,onRetry:j,searchQuery:G,searchPredicate:_,onDeleteMessages:l,isDeleting:d,isMoving:u,onLoadMore:h,hasMore:g,isLoadingMore:m,accountId:p,listTitle:M,listFilter:J,listScopeLabel:M,hideHeader:!0,onTriageContextChange:k,commandsRef:I}),ee=pe[0]?.accountId,je=Pe==="phone"&&ee?r.jsx(Ki,{accountId:ee,children:Ne}):Ne,de=v&&x.length>0&&p?r.jsx(Hi,{accountId:p,currentMailboxId:e,candidates:x,onMove:a,children:je}):je,ue=Be?r.jsx(li,{messageCount:Ie,isEmptying:D.isEmptying,deletedCount:D.deletedCount,refusalReason:D.refusal?.reason,trashFolderLabel:C??void 0,staleFolderLabel:p?V.get(p)?.staleFolderPath:void 0,onEmpty:D.emptyTrash,onRepair:D.repair,children:de}):de;return r.jsx(mo,{title:M,unreadCount:b,preset:Ce,selectedCategory:E,activeFilters:A,onSelectCategory:L,onToggleFilter:O,onClearFilters:F,searchResults:K,searchLoading:s,relatedResults:q,relatedLoading:Z,onSelectSearchResult:oe,searchResultsInBody:!0,refreshControl:ce,children:ue})}function hr(){const{mailboxId:e,mailboxAccountId:n,mailboxAccountLoading:t,selectedThread:s,conversation:o,onReply:i,onToolbarDelete:l,onToolbarStar:a,isStarred:d,onToolbarMove:u,handleDeselectIfRemoved:h,intelligenceRef:g}=ht(),m=!!o,p=oo(o?.threadId);Xt(g,p);const C=c.useRef(null),{railFits:b,openRail:w}=p;c.useEffect(()=>{if(!b)return;const x=s?.messageId??null;x&&C.current!==x&&s?.authenticity?.dkimMismatch&&(C.current=x,w())},[b,w,s?.messageId,s?.authenticity?.dkimMismatch]);const v=o?r.jsx(Zt,{threadId:o.threadId,mailboxId:o.mailboxId,subject:o.subject,selectedMessageId:o.messageId,authenticity:o.authenticity,onOpenIntelligence:p.open,listOnScreen:!0}):r.jsx(un,{});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(io,{hasThread:m,messageId:o?.messageId,intelligenceOpen:p.isShowing,canToggleIntelligence:p.canToggle,onToggleIntelligence:p.toggle,onReply:i?()=>i("reply"):void 0,onReplyAll:i?()=>i("reply-all"):void 0,onForward:i?()=>i("forward"):void 0,onDelete:m?l:void 0,onToggleStar:m?a:void 0,isStarred:d,moveContext:m&&n?{accountId:n,currentMailboxId:e,onMove:u}:void 0,moveContextLoading:t}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:v})]}),r.jsx(es,{isOpen:p.drawerOpen,onClose:p.closeDrawer,thread:s,mailboxId:e,accountId:n,onAfterOptimisticRemove:h})]})}function fr(){const{mailboxId:e,mailboxAccountId:n,selectedThread:t,onToggleIntelligence:s,handleDeselectIfRemoved:o}=ht();return r.jsx(no,{onClose:s,thread:t,mailboxId:e,accountId:n,onAfterOptimisticRemove:o})}function mr(){const{mailboxId:e,mailboxAccountId:n,selectedThread:t,conversation:s,onOpenThread:o,onBack:i,nextThread:l,previousThread:a,handleDeselectIfRemoved:d,intelligenceRef:u}=ht(),h=so(s?.threadId??null);return Xt(u,h),s?r.jsxs(r.Fragment,{children:[r.jsx(Zt,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,authenticity:s.authenticity,onBack:i,onOpenIntelligence:h.toggle,onSwipeNext:l?()=>o(l):void 0,onSwipePrevious:a?()=>o(a):void 0,mobileIntelligenceOpen:h.isOpen}),r.jsx(es,{isOpen:h.isOpen,onClose:h.close,thread:t,mailboxId:e,accountId:n,onAfterOptimisticRemove:d})]}):r.jsx(cs,{})}const _r=Object.assign(ur,{List:cs,Reading:hr,Intelligence:fr,Phone:mr});export{_r as M};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{O as o}from"./index-CiGlLB-Q.js";const n=o;export{n as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ai as m,j as o,O as p}from"./index-CiGlLB-Q.js";import{a}from"./MailShell-DPmaQObG.js";import{M as r}from"./MailboxPane-qwmpIRkg.js";import{d as e}from"./search-token-index--_Yaw1JT.js";import{u as s}from"./search-mirror-19tETPGa.js";import"./FullCompose-QcSpwDjN.js";import"./ErrorState-DryJcc3L.js";import"./index-BKmQNnWU.js";import"./useMessageBodyContent-DNKN2wNp.js";import"./useSignature-CBWAU9NS.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DhsoNveS.js";import"./sections-N5AHkNWd.js";import"./format-1ywn__NA.js";import"./confirm-dialog-D1Z8lP_5.js";import"./useSearchTokenContext-Ujq8R6T0.js";import"./kbd-CWltqL4I.js";import"./search-scope-B5-OK3Cq.js";import"./useRefreshControl-ORmLq6k-.js";import"./circle-check-big-B71QCndN.js";import"./refresh-cw-BywiJYGJ.js";import"./useQueries-5UKmESBx.js";import"./MailListHeader-BpHJurnU.js";import"./attachment-file-JPgSnk-B.js";import"./mail-CmOZy_ab.js";import"./avatar-DVQL7gNE.js";import"./EmptyState-Bzu7cB4A.js";import"./download-CNwO_hle.js";import"./calendar-event-chip-C7WALOu_.js";import"./calendar-color-DaFDa92m.js";import"./map-pin-CdF9yS8_.js";import"./attendee-row-819P35ci.js";import"./clock-Dr27yplU.js";import"./useLayoutTier-DhsTOgzf.js";import"./shield-check-Bb89-hnj.js";import"./useFilters-DFHZOQUs.js";import"./menu-CJUUwkl-.js";import"./MailViewChrome-GX1QMfcl.js";import"./NavMenuButton-BQ6HWNSV.js";import"./useLabels-CnbxO3Rn.js";import"./useSemanticSearch-Bp1CnU53.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-BU6Ex9hD.js";import"./circle-help-DzEWy09a.js";import"./circle-check-B2SOhBLi.js";function oo(){const{mailboxId:t}=m.useParams(),i=e();return s({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{oo as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-CiGlLB-Q.js";import{F as r}from"./FlaggedPane-C2DANFWb.js";import"./useSearchTokenContext-Ujq8R6T0.js";import"./kbd-CWltqL4I.js";import"./useMessageBodyContent-DNKN2wNp.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-BpHJurnU.js";import"./search-token-index--_Yaw1JT.js";import"./useLayoutTier-DhsTOgzf.js";import"./useQueries-5UKmESBx.js";import"./attachment-file-JPgSnk-B.js";import"./mail-CmOZy_ab.js";import"./avatar-DVQL7gNE.js";import"./index-BKmQNnWU.js";import"./useSignature-CBWAU9NS.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DhsoNveS.js";import"./sections-N5AHkNWd.js";import"./format-1ywn__NA.js";import"./EmptyState-Bzu7cB4A.js";import"./ErrorState-DryJcc3L.js";import"./download-CNwO_hle.js";import"./calendar-event-chip-C7WALOu_.js";import"./calendar-color-DaFDa92m.js";import"./map-pin-CdF9yS8_.js";import"./attendee-row-819P35ci.js";import"./clock-Dr27yplU.js";import"./shield-check-Bb89-hnj.js";import"./useFilters-DFHZOQUs.js";import"./confirm-dialog-D1Z8lP_5.js";import"./menu-CJUUwkl-.js";import"./MailViewChrome-GX1QMfcl.js";import"./refresh-cw-BywiJYGJ.js";import"./wizard-selection-B1bng5Jq.js";function H(){return o.jsx(r.Reading,{})}export{H as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-CiGlLB-Q.js";import{M as r}from"./MailboxPane-qwmpIRkg.js";import"./useSearchTokenContext-Ujq8R6T0.js";import"./kbd-CWltqL4I.js";import"./useMessageBodyContent-DNKN2wNp.js";import"./search-scope-B5-OK3Cq.js";import"./useRefreshControl-ORmLq6k-.js";import"./circle-check-big-B71QCndN.js";import"./refresh-cw-BywiJYGJ.js";import"./useQueries-5UKmESBx.js";import"./search-token-index--_Yaw1JT.js";import"./useLayoutTier-DhsTOgzf.js";import"./MailListHeader-BpHJurnU.js";import"./attachment-file-JPgSnk-B.js";import"./mail-CmOZy_ab.js";import"./avatar-DVQL7gNE.js";import"./index-BKmQNnWU.js";import"./useSignature-CBWAU9NS.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DhsoNveS.js";import"./sections-N5AHkNWd.js";import"./format-1ywn__NA.js";import"./EmptyState-Bzu7cB4A.js";import"./ErrorState-DryJcc3L.js";import"./download-CNwO_hle.js";import"./calendar-event-chip-C7WALOu_.js";import"./calendar-color-DaFDa92m.js";import"./map-pin-CdF9yS8_.js";import"./attendee-row-819P35ci.js";import"./clock-Dr27yplU.js";import"./shield-check-Bb89-hnj.js";import"./useFilters-DFHZOQUs.js";import"./confirm-dialog-D1Z8lP_5.js";import"./menu-CJUUwkl-.js";import"./MailViewChrome-GX1QMfcl.js";import"./NavMenuButton-BQ6HWNSV.js";import"./useLabels-CnbxO3Rn.js";import"./useSemanticSearch-Bp1CnU53.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-BU6Ex9hD.js";import"./circle-help-DzEWy09a.js";import"./circle-check-B2SOhBLi.js";function S(){return o.jsx(r.Reading,{})}export{S as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./index-CiGlLB-Q.js";import{B as o}from"./BriefPane-CwV_QERU.js";import"./useSearchTokenContext-Ujq8R6T0.js";import"./kbd-CWltqL4I.js";import"./useMessageBodyContent-DNKN2wNp.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-BpHJurnU.js";import"./search-token-index--_Yaw1JT.js";import"./useLayoutTier-DhsTOgzf.js";import"./useQueries-5UKmESBx.js";import"./attachment-file-JPgSnk-B.js";import"./mail-CmOZy_ab.js";import"./avatar-DVQL7gNE.js";import"./index-BKmQNnWU.js";import"./useSignature-CBWAU9NS.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DhsoNveS.js";import"./sections-N5AHkNWd.js";import"./format-1ywn__NA.js";import"./EmptyState-Bzu7cB4A.js";import"./ErrorState-DryJcc3L.js";import"./download-CNwO_hle.js";import"./calendar-event-chip-C7WALOu_.js";import"./calendar-color-DaFDa92m.js";import"./map-pin-CdF9yS8_.js";import"./attendee-row-819P35ci.js";import"./clock-Dr27yplU.js";import"./shield-check-Bb89-hnj.js";import"./useFilters-DFHZOQUs.js";import"./confirm-dialog-D1Z8lP_5.js";import"./menu-CJUUwkl-.js";import"./useRefreshControl-ORmLq6k-.js";import"./circle-check-big-B71QCndN.js";import"./refresh-cw-BywiJYGJ.js";import"./useLabels-CnbxO3Rn.js";import"./useSemanticSearch-Bp1CnU53.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-B1bng5Jq.js";function L(){return r.jsx(o.Reading,{})}export{L as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-CiGlLB-Q.js";import{O as t}from"./OutboxPane-BfinOqJb.js";import"./useSearchTokenContext-Ujq8R6T0.js";import"./kbd-CWltqL4I.js";import"./useMessageBodyContent-DNKN2wNp.js";import"./search-scope-B5-OK3Cq.js";import"./circle-check-big-B71QCndN.js";import"./clock-Dr27yplU.js";import"./row-actions-Cy8AdlX1.js";import"./rotate-ccw-Dj9rQIcI.js";import"./NavMenuButton-BQ6HWNSV.js";import"./menu-CJUUwkl-.js";import"./format-1ywn__NA.js";import"./outbox-status-BlKn6P0x.js";import"./search-query-Cr_ZXBCp.js";function P(){return o.jsx(t.Reading,{})}export{P as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{em as o,j as m}from"./index-CiGlLB-Q.js";import{O as e}from"./OpenCalendarEvent-BnzRw8Nu.js";import"./CalendarComposePane-CmHf4mLg.js";import"./window-hi7bKcsY.js";import"./ErrorState-DryJcc3L.js";import"./calendar-color-DaFDa92m.js";import"./attendee-row-819P35ci.js";import"./avatar-DVQL7gNE.js";import"./clock-Dr27yplU.js";import"./map-pin-CdF9yS8_.js";import"./mail-CmOZy_ab.js";import"./pencil-XV0cyuxP.js";import"./useCalendars-DL8ceq5a.js";import"./useCalendarData-Dgi_LbTF.js";import"./useQueries-5UKmESBx.js";function E(){const{calendarObjectId:r,recurrenceId:t}=o.useParams();return m.jsx(e,{calendarObjectId:r,recurrenceId:t})}export{E as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{O as o}from"./index-CiGlLB-Q.js";const n=o;export{n as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{O as o}from"./index-CiGlLB-Q.js";const n=o;export{n as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{O as o}from"./index-CiGlLB-Q.js";const n=o;export{n as component};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{e as T,j as e,aH as z,f as l,aP as p,g as v,aQ as D,aR as L,B as S,aq as h,aS as I,r as m,L as b,aT as g,t as q,h as V,aU as U,aV as F,c as w,aW as H,d as Q,aX as A,aY as _,aZ as Y,Q as G,a_ as J,a$ as W,b0 as Z,u as K,aK as X,aM as ee}from"./index-CiGlLB-Q.js";import{S as se}from"./settings-screen-BVxSRYil.js";import{e as te}from"./config-import-BOsE7281.js";import{u as ae}from"./sections-N5AHkNWd.js";import{C as ne,a as re,b as ie,c as le}from"./card-Cbe42Nm_.js";import{D as y}from"./download-CNwO_hle.js";import{F as oe}from"./file-json-BMjQCHTH.js";import{C as ce}from"./copy-fDp3MIUq.js";import{B as E}from"./bug-DFLhL9u7.js";import{C as M}from"./circle-check-B2SOhBLi.js";import{f as de}from"./ErrorState-DryJcc3L.js";import{u as me}from"./useResultFolderIndex-BkHmREnc.js";import{R as C}from"./rotate-ccw-Dj9rQIcI.js";import{C as xe}from"./clock-Dr27yplU.js";import{S as he}from"./shield-check-Bb89-hnj.js";import{b as ue}from"./help-copy-RlS75KwM.js";import"./avatar-DVQL7gNE.js";import"./chevron-left-ByoFHayz.js";import"./menu-CJUUwkl-.js";import"./circle-help-DzEWy09a.js";import"./useQueries-5UKmESBx.js";import"./kbd-CWltqL4I.js";const pe=T("CloudOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193",key:"yfwify"}],["path",{d:"M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07",key:"jlfiyv"}]]);const k=T("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]),fe={BodyParse:"The message is built in a way Remit could not read."};function ge(s){return fe[s]}function P(s){return s.split(";")[0].trim()}const R=/^[A-Za-z0-9!#$%&'*+._-]+$/,$=/^[A-Za-z0-9!#$%&'*+._-]+\/[A-Za-z0-9!#$%&'*+._-]+$/;function j(s,t){return t.test(s)?`\`${s}\``:`\`${JSON.stringify(s).replace(/`/g,"\\u0060")}\` (malformed)`}function je(s){const t=P(s);return $.test(t)?t:JSON.stringify(t)}const N="_not read_";function Ne(s){return s.length===0?["(no MIME structure was read)"]:s.map(t=>`${" ".repeat(t.depth)}- ${je(t.contentType)}`)}const be="_No message content, addresses, subject, attachment names or parser output are included._";function O(s){return{head:[`### Message quarantined at \`${s.failureStage}\``,"",`- **Failure**: \`${s.failureCode}\``,`- **Folder role**: ${s.mailboxRole??"_none appointed_"}`,`- **Failing part**: ${s.failurePartPath==null?"_whole message_":`\`${s.failurePartPath}\``}`,`- **Attempts before quarantine**: ${s.attempts}`,`- **Worker build**: ${s.workerVersion}`,`- **Message-ID hash**: ${s.messageIdHash==null?"_none declared_":`\`${s.messageIdHash}\``}`,"","#### Message shape","",`- **Content-Type**: ${s.contentType==null?N:j(P(s.contentType),$)}`,`- **Content-Transfer-Encoding**: ${s.transferEncoding==null?N:j(s.transferEncoding,R)}`,`- **Charset**: ${s.charset==null?"_not declared_":j(s.charset,R)}`,`- **Size**: ${s.sizeBytes==null?N:`${s.sizeBytes} bytes`}`,"","MIME structure:"].join(`
|
|
2
|
-
`),structure:Ne(s.structure).join(`
|
|
3
|
-
`),disclaimer:be}}function ve(s){const{head:t,structure:a,disclaimer:n}=O(s);return[t,"","```",a,"```","",n].join(`
|
|
4
|
-
`)}function ye(s){return`Message quarantined: ${s.failureCode} at ${s.failureStage}`}function ke({entry:s,onClose:t,issueUrl:a,onCopy:n}){if(!s)return null;const r=ve(s);return e.jsx(z,{open:!0,onClose:t,title:"Report this message",children:e.jsxs("div",{className:"flex max-h-[80vh] flex-col",children:[e.jsxs("header",{className:"space-y-1 border-b border-line px-4 py-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-fg",children:"Report this message"}),e.jsx("p",{className:"text-xs text-fg-muted",children:"This is everything the report contains. It describes the shape of the message — never its contents, addresses, subject, attachment names, or the parser's own error text."})]}),e.jsx("pre",{className:"flex-1 overflow-auto bg-surface-sunken px-4 py-3 text-2xs leading-relaxed whitespace-pre-wrap text-fg-muted",children:r}),e.jsxs("footer",{className:"flex flex-wrap items-center justify-end gap-2 border-t border-line px-4 py-3",children:[e.jsx(l,{variant:"ghost",size:"sm",onClick:t,children:"Cancel"}),e.jsx(l,{variant:"secondary",size:"sm",icon:e.jsx(ce,{className:"size-3.5"}),onClick:()=>n(r),children:"Copy report"}),e.jsx(p,{external:!0,size:"sm",href:a,icon:e.jsx(k,{className:"size-3.5"}),children:"Open on GitHub"})]})]})})}function we(s){return new Date(s).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}function Ce({entry:s,onCutBug:t}){return e.jsxs("li",{className:"flex flex-col gap-2 border-b border-line px-row-inset py-3 last:border-b-0 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"text-sm text-fg",children:ge(s.failureStage)}),e.jsx("p",{className:"truncate text-xs text-fg-muted",title:s.failureMessage,children:s.failureMessage}),e.jsxs("p",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-2xs text-fg-subtle",children:[s.mailboxRole&&e.jsx(v,{tone:"warning",children:D(s.mailboxRole)}),e.jsx("span",{className:"truncate",title:s.mailboxPath,children:L(s.mailboxPath,s.mailboxDelimiter)}),e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{children:`uid ${s.uid}`}),e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{children:we(s.quarantinedAt)}),s.attempts>1&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{children:`${s.attempts} attempts`})]})]})]}),e.jsx(l,{variant:"secondary",size:"sm",className:"shrink-0",icon:e.jsx(E,{className:"size-3.5"}),onClick:()=>t(s),children:"Cut a bug"})]})}function Re({entries:s,onCutBug:t}){return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsx("h2",{className:"text-sm font-semibold text-fg",children:"Messages set aside"}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Mail Remit could not read is set aside here instead of being skipped, so nothing goes missing quietly. The rest of the folder keeps syncing. Recovering a set-aside message is a re-sync, not a per-row action."})]}),s.length===0&&e.jsxs("div",{className:"flex items-center gap-2 rounded-sm border border-line bg-surface px-row-inset py-3",children:[e.jsx(M,{className:"size-4 shrink-0 text-positive","aria-hidden":!0}),e.jsx("p",{className:"text-sm text-fg-muted",children:"Every message has been read successfully. Nothing is set aside."})]}),s.length>1&&e.jsx(S,{tone:"warning",children:e.jsxs("p",{className:"flex items-start gap-2",children:[e.jsx(h,{className:"mt-0.5 size-4 shrink-0","aria-hidden":!0}),e.jsxs("span",{children:[e.jsx("span",{className:"font-semibold",children:`${s.length} messages could not be read.`})," ","More than one means something is wrong with how Remit reads mail, not with the mail. Reporting one of these gets it fixed."]})]})}),s.length>0&&e.jsx("ul",{className:"rounded-sm border border-line bg-surface",children:s.map(a=>e.jsx(Ce,{entry:a,onCutBug:t},a.quarantineId))})]})}const Te=["Remit restarts. Mail stops loading for about a minute and this page will lose its connection while that happens.","Nothing is sent, deleted or moved. Your mail stays at your provider.","If the new version does not come back up, the version you are running now is restored automatically."];function ze({open:s,currentVersion:t,release:a,appliesSchemaMigration:n=!1,onClose:r,onConfirm:i}){return s?e.jsx(z,{open:!0,onClose:r,title:`Install Remit ${a.version}`,children:e.jsxs("div",{className:"flex max-h-[80vh] flex-col",children:[e.jsxs("header",{className:"space-y-1 border-b border-line px-4 py-3",children:[e.jsxs("h3",{className:"text-sm font-semibold text-fg",children:["Install Remit ",a.version,"?"]}),e.jsxs("p",{className:"text-xs text-fg-muted",children:["You are on ",t,". ",a.version," was released"," ",I(a.releasedAt),"."]})]}),e.jsxs("div",{className:"flex-1 space-y-3 overflow-auto px-4 py-3",children:[e.jsx("p",{className:"text-sm text-fg-muted",children:a.summary}),e.jsxs("ul",{className:"space-y-2",children:[Te.map(o=>e.jsxs("li",{className:"flex gap-2 text-sm text-fg-muted",children:[e.jsx("span",{className:"mt-1.5 size-1.5 shrink-0 rounded-full bg-fg-subtle"}),e.jsx("span",{children:o})]},o)),n&&e.jsxs("li",{className:"flex gap-2 text-sm text-fg-muted",children:[e.jsx("span",{className:"mt-1.5 size-1.5 shrink-0 rounded-full bg-fg-subtle"}),e.jsx("span",{children:"This version updates the database while Remit is offline. The step forward cannot be undone by hand, but a failed start is still rolled back to the version and data you have now."})]})]}),e.jsx("p",{className:"text-xs text-fg-subtle",children:"Good moment for this: when you are not waiting on a message."})]}),e.jsxs("footer",{className:"flex flex-wrap items-center justify-end gap-2 border-t border-line px-4 py-3",children:[e.jsx(l,{variant:"ghost",size:"sm",onClick:r,children:"Not now"}),e.jsx(p,{variant:"secondary",size:"sm",external:!0,href:a.releaseNotesUrl,icon:e.jsx(k,{className:"size-3.5"}),children:"Release notes"}),e.jsx(l,{size:"sm",icon:e.jsx(y,{className:"size-3.5"}),onClick:i,children:"Install and restart"})]})]})}):null}function d({children:s,tone:t}){return e.jsx("div",{className:q("rounded-sm border bg-surface px-row-inset py-3",t==="danger"?"border-danger/50":"border-line"),children:s})}function Se({state:s,onCheck:t,onInstall:a,onDismissResult:n,now:r=Date.now()}){const[i,o]=m.useState(null),x=s.status==="checking",c=s.status==="available",u=()=>{if(x){o("Already checking. The result appears here in a moment.");return}o(null),t()},f=()=>{if(!c&&s.status!=="rolledBack"&&s.status!=="abandoned"){o("There is no update to install. Check for updates first — if one is found it appears here.");return}o(null),a()},B=(()=>{switch(s.status){case"upToDate":return e.jsx(d,{children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(M,{className:"size-4 shrink-0 text-positive","aria-hidden":!0}),e.jsxs("p",{className:"text-sm text-fg",children:["Remit ",s.version," is the latest version.",e.jsxs("span",{className:"text-fg-subtle",children:[" ","Checked ",g(s.checkedAt,r),"."]})]})]}),e.jsx(l,{variant:"secondary",size:"sm",className:"shrink-0",onClick:u,children:"Check again"})]})});case"checking":return e.jsx(d,{children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(b,{className:"size-4 shrink-0 animate-spin text-fg-subtle","aria-hidden":!0}),e.jsxs("p",{className:"text-sm text-fg-muted",children:["Looking for a newer version. You are on ",s.version,"."]})]}),e.jsx(l,{variant:"secondary",size:"sm",className:"shrink-0",onClick:u,children:"Check again"})]})});case"neverChecked":return e.jsx(d,{children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[e.jsx(xe,{className:"mt-0.5 size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.jsxs("p",{className:"text-sm text-fg-muted",children:["No update check has run yet. Remit checks for updates on its own in the background.",s.lastCheckedAt!==void 0&&e.jsxs("span",{className:"text-fg-subtle",children:[" ","Last checked"," ",g(s.lastCheckedAt,r),"."]})]})]}),e.jsx(l,{variant:"secondary",size:"sm",className:"shrink-0",onClick:u,children:"Check now"})]})});case"checkFailed":return e.jsx(d,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(pe,{className:"mt-0.5 size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"text-sm text-fg",children:"Could not reach the update source."}),e.jsx("p",{className:"text-xs text-fg-muted",children:s.reason}),e.jsxs("p",{className:"text-xs text-fg-subtle",children:["You are still on ",s.version," and it keeps working.",s.lastCheckedAt!==void 0&&e.jsxs(e.Fragment,{children:[" ","Last successful check"," ",g(s.lastCheckedAt,r),"."]})]})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(l,{variant:"secondary",size:"sm",onClick:u,children:"Try again"})})]})});case"available":return e.jsx(d,{children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:"text-sm font-semibold text-fg",children:["Remit ",s.release.version]}),e.jsx(v,{tone:"accent",children:"update available"}),e.jsxs("span",{className:"text-2xs text-fg-subtle",children:["released ",I(s.release.releasedAt)," · you are on ",s.version]})]}),e.jsx("p",{className:"text-sm text-fg-muted",children:s.release.summary}),e.jsx("p",{className:"text-xs text-fg-subtle",children:"Installing restarts Remit, so mail stops loading for about a minute. If the new version does not come back up, the one you are running now is restored on its own."}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(l,{size:"sm",icon:e.jsx(y,{className:"size-3.5"}),onClick:f,children:["Install ",s.release.version]}),e.jsx(p,{variant:"secondary",size:"sm",external:!0,href:s.release.releaseNotesUrl,icon:e.jsx(k,{className:"size-3.5"}),children:"Release notes"})]})]})});case"applying":return e.jsx(d,{children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(b,{className:"size-4 shrink-0 animate-spin text-accent-2","aria-hidden":!0}),e.jsxs("p",{className:"text-sm text-fg-muted",children:["Installing Remit ",s.target,". The restart screen has the details."]})]})});case"succeeded":return e.jsx(S,{tone:"success",onDismiss:n,children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"font-semibold",children:["Updated to Remit ",s.version,"."]}),e.jsxs("p",{children:["You were on ",s.previousVersion,"."," ",e.jsx("a",{href:s.releaseNotesUrl,target:"_blank",rel:"noopener noreferrer",className:"underline",children:"See what changed"}),"."]})]})});case"rolledBack":return e.jsx(d,{tone:"danger",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(h,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":!0}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("p",{className:"text-sm font-semibold text-fg",children:["Remit ",s.attemptedVersion," did not start. Remit reports that it put ",s.version," back."]}),e.jsxs("p",{className:"text-sm text-fg-muted",children:["You are running ",s.version," again. A failed update can still have changed things on the way — the log below is the only account of what it got as far as doing."]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-fg-subtle",children:"What Remit reported as the failure"}),e.jsx("code",{className:"block rounded-xs bg-danger-soft px-2 py-1 text-2xs text-danger",children:s.reason})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-fg-subtle",children:"Read the full log before trying again:"}),e.jsx("code",{className:"block rounded-xs bg-surface-sunken px-2 py-1 text-2xs text-fg-muted",children:s.logsCommand})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(l,{variant:"secondary",size:"sm",icon:e.jsx(C,{className:"size-3.5"}),onClick:f,children:["Try ",s.attemptedVersion," again"]}),e.jsxs(l,{variant:"ghost",size:"sm",onClick:n,children:["Stay on ",s.version]})]})]})});case"unreachable":return e.jsx(d,{tone:"danger",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(h,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":!0}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("p",{className:"text-sm font-semibold text-fg",children:["Installing ",s.attemptedVersion," left the server unreachable."]}),e.jsx("p",{className:"text-sm text-fg-muted",children:"Remit has answered again since, but nothing here can say what happened during the silence."})]})]}),e.jsx("code",{className:"block rounded-xs bg-surface-sunken px-2 py-1 text-2xs text-fg-muted",children:s.logsCommand}),e.jsx("div",{className:"flex justify-end",children:e.jsx(l,{variant:"ghost",size:"sm",onClick:n,children:"Dismiss"})})]})});case"rollbackFailed":return e.jsx(d,{tone:"danger",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(h,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":!0}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("p",{className:"text-sm font-semibold text-fg",children:["Remit ",s.attemptedVersion," did not start, and Remit could not put ",s.previousVersion," back."]}),e.jsx("p",{className:"text-sm text-fg-muted",children:"This is the one outcome Remit cannot resolve on its own. The server is in a half-changed state and needs you at a shell. The log below is the only account of where it stopped."})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-fg-subtle",children:"What Remit reported as the failure"}),e.jsx("code",{className:"block rounded-xs bg-danger-soft px-2 py-1 text-2xs text-danger",children:s.reason})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-fg-subtle",children:"Read the full log on the server:"}),e.jsx("code",{className:"block rounded-xs bg-surface-sunken px-2 py-1 text-2xs text-fg-muted",children:s.logsCommand})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(l,{variant:"ghost",size:"sm",onClick:n,children:"Dismiss"})})]})});case"abandoned":return e.jsx(d,{tone:"danger",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(h,{className:"mt-0.5 size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("p",{className:"text-sm font-semibold text-fg",children:["Remit ",s.attemptedVersion," was not installed. Nothing changed."]}),e.jsxs("p",{className:"text-sm text-fg-muted",children:["The update stopped before it altered anything. You are still running ",s.version,"."]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-fg-subtle",children:"What Remit reported"}),e.jsx("code",{className:"block rounded-xs bg-surface-sunken px-2 py-1 text-2xs text-fg-muted",children:s.reason})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-fg-subtle",children:"Read the full log before trying again:"}),e.jsx("code",{className:"block rounded-xs bg-surface-sunken px-2 py-1 text-2xs text-fg-muted",children:s.logsCommand})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(l,{variant:"secondary",size:"sm",icon:e.jsx(C,{className:"size-3.5"}),onClick:f,children:["Try ",s.attemptedVersion," again"]}),e.jsxs(l,{variant:"ghost",size:"sm",onClick:n,children:["Stay on ",s.version]})]})]})});default:return s}})();return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsx("h2",{className:"text-sm font-semibold text-fg",children:"Updates"}),e.jsx("p",{className:"text-xs text-fg-muted",children:"This Remit runs on your own server, so it updates when you say so. Your mail lives at your provider and is never touched by an update."})]}),B,i&&e.jsx("p",{role:"status",className:"text-xs text-fg-muted",children:i})]})}function Ie({fileName:s,state:t="ready",error:a,onDownload:n,onImport:r}){const i=t==="downloading";return e.jsxs(ne,{className:"max-w-xl",children:[e.jsx(re,{children:e.jsx(ie,{children:"Configuration file"})}),e.jsxs(le,{children:[e.jsx("p",{className:"text-sm text-fg-muted",children:"One versioned JSON document carrying every setting this instance holds: accounts and their servers, folder roles, rules, labels, flagged senders and appearance. No passwords and no OAuth tokens — you sign in again wherever you import it."}),t==="failed"&&e.jsxs("div",{className:"mt-3 space-y-2 rounded-sm border border-danger/40 bg-danger-soft px-3 py-2.5",children:[e.jsx("p",{className:"text-sm font-medium text-danger",children:"The config file could not be written."}),e.jsxs("p",{className:"text-xs text-fg-muted",children:["Nothing was downloaded. Try again — if it keeps failing, use"," ",e.jsx("code",{className:"rounded bg-surface-sunken px-1 py-0.5",children:"remit config save"})," ","on the host in the meantime."]}),a&&e.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:a})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[e.jsx(l,{variant:"secondary",size:"sm",disabled:i,icon:i?e.jsx(b,{className:"size-3.5 animate-spin"}):e.jsx(y,{className:"size-3.5"}),onClick:n,children:i?"Preparing…":`Download ${s}`}),e.jsx(v,{tone:"neutral",children:"no passwords"})]}),e.jsxs("p",{className:"mt-3 text-2xs text-fg-subtle",children:["On the host, the same file comes from"," ",e.jsxs("code",{className:"rounded bg-surface-sunken px-1 py-0.5",children:["remit config save ~/",s]}),"."]}),e.jsxs("div",{className:"mt-5 border-t border-line pt-4",children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:"Import a config file"}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:"Read a file from another Reader into this one. It shows what will change before anything is written, and asks for each account's credentials afterwards."}),e.jsx(l,{className:"mt-3",variant:"secondary",size:"sm",icon:e.jsx(oe,{className:"size-3.5"}),onClick:r,children:"Import a config file"})]})]})]})}const Ae=(s,t)=>{const a=URL.createObjectURL(new Blob([JSON.stringify(t,null,2)],{type:"application/json"})),n=document.createElement("a");n.href=a,n.download=s,n.click(),URL.revokeObjectURL(a)};function _e(){const s=V(),t=ae(),[a,n]=m.useState("ready"),[r,i]=m.useState(void 0),o=te(new Date),x=()=>{a!=="downloading"&&(n("downloading"),i(void 0),s.fetchQuery(U()).then(c=>{Ae(o,c.document),n("ready")}).catch(c=>{n("failed"),i(c instanceof Error?c.message:"GET /config/export did not answer with a configuration.")}))};return e.jsx(Ie,{fileName:o,state:a,error:r,onDownload:x,onImport:()=>t("importConfig")})}function Ee(s,t){return{quarantineId:s.quarantineId,accountId:s.accountId,mailboxId:s.mailboxId,uidValidity:s.uidValidity,uid:s.uid,mailboxRole:s.mailboxRole?F[s.mailboxRole]:void 0,mailboxPath:s.mailboxPath,mailboxDelimiter:t,failureStage:s.failureStage,failureCode:s.failureCode,failureMessage:s.failureMessage,failurePartPath:s.failurePartPath,quarantinedAt:s.quarantinedAt,attempts:s.attempts,sizeBytes:s.sizeBytes,contentType:s.contentType,transferEncoding:s.transferEncoding,charset:s.charset,structure:s.structure,messageIdHash:s.messageIdHash,workerVersion:s.workerVersion}}const Me=[];function Pe(s){window.open(s,"_blank","noopener,noreferrer")}function $e(s){return A(_({quarantine:O(s),title:ye(s)}))}function Oe({error:s}){return e.jsxs("section",{role:"alert",className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold text-fg",children:"Messages set aside"}),e.jsxs("div",{className:"space-y-2 rounded-sm border border-danger/40 bg-danger-soft px-row-inset py-3",children:[e.jsx("p",{className:"text-sm font-medium text-danger",children:"The list of set-aside messages could not be read."}),e.jsx("p",{className:"break-words text-sm text-fg-muted",children:de(s)}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Mail may still have been set aside — this page cannot say either way until it can read the list. Reporting this gets it fixed."}),e.jsx(l,{variant:"secondary",size:"sm",icon:e.jsx(E,{className:"size-3.5"}),onClick:()=>Pe(A(_())),children:"Report this"})]})]})}function Be({entries:s,isPending:t,error:a}){const[n,r]=m.useState(null),[i,o]=m.useState(!1);if(t)return e.jsx("p",{className:"animate-pulse text-sm text-fg-subtle",children:"Checking for messages set aside…"});if(a)return e.jsx(Oe,{error:a});const x=c=>{navigator.clipboard.writeText(c).then(()=>{o(!1),r(null)},()=>{o(!0),r(null)})};return e.jsxs(e.Fragment,{children:[i&&e.jsx("p",{role:"alert",className:"mb-3 text-sm text-danger",children:"The report was not copied — this browser refused clipboard access. Cut the bug again and use Open on GitHub, which needs no clipboard."}),e.jsx(Re,{entries:s,onCutBug:r}),e.jsx(ke,{entry:n,issueUrl:n?$e(n):"",onClose:()=>r(null),onCopy:x})]})}function De(s,t){return s.get(t)?.hierarchyDelimiter??""}function Le(){const s=w(H()),t=w(Q()),a=m.useMemo(()=>t.data?.accounts??[],[t.data]),n=me(a),r=s.data?.entries??Me,i=m.useMemo(()=>r.map(o=>Ee(o,De(n.index,o.mailboxId))),[r,n.index]);return e.jsx(Be,{entries:i,isPending:s.isPending||t.isPending||n.isPending,error:s.error??t.error??n.error})}function qe(){const{surface:s,release:t,currentVersion:a,appliesSchemaMigration:n,onCheck:r,install:i,onDismissResult:o}=Y(),[x,c]=m.useState(!1);return s.status!=="ready"?null:e.jsxs(e.Fragment,{children:[e.jsx(Se,{state:s.section,onCheck:r,onInstall:()=>c(!0),onDismissResult:o}),t&&a&&e.jsx(ze,{open:x,currentVersion:a,release:t,appliesSchemaMigration:n,onClose:()=>c(!1),onConfirm:()=>{c(!1),i(t.version)}})]})}function Ve(){return G().tlsMode!=="internal"?null:e.jsxs("div",{className:"border-t border-line pt-4 mt-4",children:[e.jsx("p",{className:"text-sm font-medium text-fg mb-1",children:"TLS root certificate"}),e.jsx("p",{className:"text-sm text-fg-muted mb-2",children:"This deployment signs its own certificate. Import it into the trust store of each device you browse from, and the browser warning stops for good."}),e.jsx(p,{href:"/tls-root-ca.crt",download:!0,variant:"secondary",size:"sm",icon:e.jsx(he,{className:"size-3.5"}),children:"Download root certificate"})]})}function Ue(s){try{return new Date(s).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return s}}function Fe({sha:s=W,commitUrl:t=J,buildTime:a=Z}){return e.jsxs("p",{className:"text-xs text-fg-subtle",children:["Version"," ",t?e.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"font-mono hover:text-fg-muted hover:underline",children:s}):e.jsx("span",{className:"font-mono",children:s})," · ",e.jsxs("span",{children:["Built ",Ue(a)]})]})}function us(){const s=K(),[t,a]=m.useState(!0),n=r=>{const i=ee[r];i&&s({to:i})};return e.jsxs(se,{items:X,activeId:"advanced",title:"Advanced",description:"Notification rules, export, and diagnostics.",help:ue,helpOpen:t,onToggleHelp:()=>a(r=>!r),onSelect:n,onBackToMail:()=>{s({to:"/mail"})},children:[e.jsx(qe,{}),e.jsx(Le,{}),e.jsx("div",{className:"mt-6 border-t border-line pt-4",children:e.jsx(_e,{})}),e.jsx("div",{className:"mt-6 border-t border-line pt-4",children:e.jsx("p",{className:"text-sm text-fg-muted",children:"Notification rules are coming in a future release."})}),e.jsx(Ve,{}),e.jsxs("div",{className:"border-t border-line pt-4 mt-4",children:[e.jsx("p",{className:"text-sm font-medium text-fg mb-1",children:"About"}),e.jsx(Fe,{})]})]})}export{us as component};
|
package/assets/brief-BZzYcxpw.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r,O as i}from"./index-CiGlLB-Q.js";import{a as m}from"./MailShell-DPmaQObG.js";import{B as o}from"./BriefPane-CwV_QERU.js";import{d as p}from"./search-token-index--_Yaw1JT.js";import{u as e}from"./search-mirror-19tETPGa.js";import"./FullCompose-QcSpwDjN.js";import"./ErrorState-DryJcc3L.js";import"./index-BKmQNnWU.js";import"./useMessageBodyContent-DNKN2wNp.js";import"./useSignature-CBWAU9NS.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DhsoNveS.js";import"./sections-N5AHkNWd.js";import"./format-1ywn__NA.js";import"./confirm-dialog-D1Z8lP_5.js";import"./useSearchTokenContext-Ujq8R6T0.js";import"./kbd-CWltqL4I.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-BpHJurnU.js";import"./attachment-file-JPgSnk-B.js";import"./mail-CmOZy_ab.js";import"./avatar-DVQL7gNE.js";import"./EmptyState-Bzu7cB4A.js";import"./download-CNwO_hle.js";import"./calendar-event-chip-C7WALOu_.js";import"./calendar-color-DaFDa92m.js";import"./map-pin-CdF9yS8_.js";import"./attendee-row-819P35ci.js";import"./clock-Dr27yplU.js";import"./useLayoutTier-DhsTOgzf.js";import"./shield-check-Bb89-hnj.js";import"./useFilters-DFHZOQUs.js";import"./useQueries-5UKmESBx.js";import"./menu-CJUUwkl-.js";import"./useRefreshControl-ORmLq6k-.js";import"./circle-check-big-B71QCndN.js";import"./refresh-cw-BywiJYGJ.js";import"./useLabels-CnbxO3Rn.js";import"./useSemanticSearch-Bp1CnU53.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-B1bng5Jq.js";function W(){const t=p();return e({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{W as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{e}from"./index-CiGlLB-Q.js";const t=e("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);export{t as C};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{F as o}from"./FullCompose-QcSpwDjN.js";import"./index-CiGlLB-Q.js";import"./ErrorState-DryJcc3L.js";import"./index-BKmQNnWU.js";import"./useMessageBodyContent-DNKN2wNp.js";import"./useSignature-CBWAU9NS.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DhsoNveS.js";import"./sections-N5AHkNWd.js";import"./format-1ywn__NA.js";import"./confirm-dialog-D1Z8lP_5.js";const C=o;export{C as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{F as o}from"./FullCompose-QcSpwDjN.js";import"./index-CiGlLB-Q.js";import"./ErrorState-DryJcc3L.js";import"./index-BKmQNnWU.js";import"./useMessageBodyContent-DNKN2wNp.js";import"./useSignature-CBWAU9NS.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DhsoNveS.js";import"./sections-N5AHkNWd.js";import"./format-1ywn__NA.js";import"./confirm-dialog-D1Z8lP_5.js";const C=o;export{C as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{F as o}from"./FullCompose-QcSpwDjN.js";import"./index-CiGlLB-Q.js";import"./ErrorState-DryJcc3L.js";import"./index-BKmQNnWU.js";import"./useMessageBodyContent-DNKN2wNp.js";import"./useSignature-CBWAU9NS.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DhsoNveS.js";import"./sections-N5AHkNWd.js";import"./format-1ywn__NA.js";import"./confirm-dialog-D1Z8lP_5.js";const C=o;export{C as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{F as o}from"./FullCompose-QcSpwDjN.js";import"./index-CiGlLB-Q.js";import"./ErrorState-DryJcc3L.js";import"./index-BKmQNnWU.js";import"./useMessageBodyContent-DNKN2wNp.js";import"./useSignature-CBWAU9NS.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DhsoNveS.js";import"./sections-N5AHkNWd.js";import"./format-1ywn__NA.js";import"./confirm-dialog-D1Z8lP_5.js";const C=o;export{C as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o,O as i}from"./index-CiGlLB-Q.js";import{a as m}from"./MailShell-DPmaQObG.js";import{F as r}from"./FlaggedPane-C2DANFWb.js";import{d as p}from"./search-token-index--_Yaw1JT.js";import{u as e}from"./search-mirror-19tETPGa.js";import"./FullCompose-QcSpwDjN.js";import"./ErrorState-DryJcc3L.js";import"./index-BKmQNnWU.js";import"./useMessageBodyContent-DNKN2wNp.js";import"./useSignature-CBWAU9NS.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DhsoNveS.js";import"./sections-N5AHkNWd.js";import"./format-1ywn__NA.js";import"./confirm-dialog-D1Z8lP_5.js";import"./useSearchTokenContext-Ujq8R6T0.js";import"./kbd-CWltqL4I.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-BpHJurnU.js";import"./attachment-file-JPgSnk-B.js";import"./mail-CmOZy_ab.js";import"./avatar-DVQL7gNE.js";import"./EmptyState-Bzu7cB4A.js";import"./download-CNwO_hle.js";import"./calendar-event-chip-C7WALOu_.js";import"./calendar-color-DaFDa92m.js";import"./map-pin-CdF9yS8_.js";import"./attendee-row-819P35ci.js";import"./clock-Dr27yplU.js";import"./useLayoutTier-DhsTOgzf.js";import"./shield-check-Bb89-hnj.js";import"./useFilters-DFHZOQUs.js";import"./useQueries-5UKmESBx.js";import"./menu-CJUUwkl-.js";import"./MailViewChrome-GX1QMfcl.js";import"./refresh-cw-BywiJYGJ.js";import"./wizard-selection-B1bng5Jq.js";function N(){const t=p();return e({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{N as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,f as N,a2 as B,bo as Y,r as c,aH as W,X,aO as he,ay as Z,a0 as xe,aR as H,bp as fe,ax as pe,aA as ge,B as L,aQ as be,bq as ve,h as J,M as ee,o as se,br as ye,bs as je,aN as Ne,K as ke,bt as Ce,bu as _,bv as we,bw as Se,bx as te,by as Me,bz as Q,bf as ae,bl as re,bm as Ie,ae as G,ad as ne,L as K,bA as V,bB as Ee,aq as Ae,bC as De,u as Oe,c as ie,d as Te,aK as Re,aM as Fe,G as Pe,i as U,bD as $e,bE as ze,bF as Le,aV as _e,bG as Be,bH as Ge}from"./index-CiGlLB-Q.js";import{P as Ke}from"./pencil-XV0cyuxP.js";import{S as qe}from"./settings-screen-BVxSRYil.js";import{E as oe}from"./ErrorState-DryJcc3L.js";import"./avatar-DVQL7gNE.js";import"./chevron-left-ByoFHayz.js";import"./menu-CJUUwkl-.js";import"./circle-help-DzEWy09a.js";const He=({label:s,onRename:t,onDelete:a,deleteBlockedReason:o,renameLabel:m=u=>`Rename ${u}`,deleteLabel:r=u=>`Delete ${u}`})=>{const u=o?`${r(s)} — ${o}`:r(s);return e.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 pr-2",children:[e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(Ke,{className:"size-3.5"}),"aria-label":m(s),onClick:t}),e.jsx("span",{title:o,children:e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(B,{className:"size-3.5"}),"aria-label":u,disabled:o!==void 0,onClick:a})})]})},Qe=({folders:s,onRename:t,onDelete:a,onCreateFolder:o,delimiter:m,labels:r})=>{const u=new Map(s.map(l=>[l.id,l]));return e.jsx(Y,{folders:s,onCreateFolder:o,delimiter:m,labels:{treeAriaLabel:"Your folders",optionLabel:l=>l.label,...r},rowActions:l=>{const i=u.get(l.id);return i?e.jsx(He,{label:i.label,deleteBlockedReason:i.deleteBlockedReason,renameLabel:r?.rename,deleteLabel:r?.remove,onRename:()=>t(i),onDelete:()=>a(i)}):null}})},Ve=({open:s,folderLabel:t,defaultLabel:a,name:o,onNameChange:m,onSubmit:r,onClose:u,pending:l=!1,error:i})=>{const d=c.useId(),g=`Rename ${t}`;return s?e.jsxs(W,{open:s,onClose:u,title:g,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:g}),e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(X,{className:"size-3.5"}),onClick:u,"aria-label":"Cancel"})]}),e.jsxs("div",{className:"space-y-3 px-5 py-4",children:[e.jsxs("div",{children:[e.jsx(he,{htmlFor:d,children:"Folder name"}),e.jsx(Z,{id:d,value:o,placeholder:a,onChange:p=>m(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),r())}})]}),e.jsxs("p",{className:"text-xs text-fg-muted",children:["Shown everywhere in Remit. Leave it blank to use"," ",e.jsx("span",{className:"font-medium text-fg",children:a}),"."]}),i&&e.jsx("p",{className:"text-xs text-danger",role:"alert",children:i})]}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:u,children:"Cancel"}),e.jsx(N,{variant:"primary",size:"sm",onClick:r,disabled:l,children:l?"Saving…":"Save name"})]})]}):null},Ue=["inbox","drafts","sent","archive","junk","trash"],q="",Ye={mailboxId:null,source:"None"};function We(s){const t=s.messageCount===1?"msg":"msgs";return`${H(s.providerPath,s.hierarchyDelimiter)} · ${s.messageCount} ${t}`}const le=s=>`${s} ${s===1?"message":"messages"}`,Xe=(s,t)=>s==="Appointed"?"Chosen by you":s==="Flagged"?`The mail server marks it as ${t}`:s==="Reserved"?"The account's own INBOX":"Matched by name, not confirmed";function Ze({role:s,folders:t,appointment:a,displayName:o,onAppoint:m,onRename:r}){const[u,l]=c.useState(o),i=c.useRef(null),d=c.useRef(!1),g=c.useId(),{mailboxId:p,source:v,staleFolderPath:y}=a,h=t.find(j=>j.mailboxId===p)??null,f=be(s),O=h!=null&&u.trim()!==o.trim();c.useEffect(()=>{!d.current||v==="Proposed"||(d.current=!1,i.current?.focus())},[v]);const I=(()=>{if(v==="None"){const j=s==="trash"?" Deleting mail needs one.":"";return e.jsx("span",{id:g,className:"pl-[7.5rem] text-xs text-fg-muted",children:`Not set — pick the folder this account uses for ${f}.${j}`})}return v==="Stale"||!h?null:e.jsx("span",{id:g,className:"truncate pl-[7.5rem] text-2xs text-fg-subtle",title:h.providerPath,children:`${Xe(v,f)} · ${h.providerPath} · ${le(h.messageCount)}`})})(),w=s==="trash"?" Deleting mail is stopped until you pick another one.":h?` reader is using ${H(h.providerPath,h.hierarchyDelimiter)} instead.`:"",D=`The folder you chose for ${f}${y?` — ${y} —`:""} is gone from the mail server.${w}`;return e.jsxs("div",{className:"flex flex-col gap-1 border-b border-line px-row-inset py-2.5 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"flex w-28 shrink-0 items-center gap-2 text-sm font-medium text-fg",children:[fe(s),f]}),e.jsxs(pe,{ref:i,className:"w-56 shrink-0",value:p??q,"aria-label":`Folder for ${f}`,"aria-describedby":I||v==="Stale"?g:void 0,onChange:j=>m(s,j.target.value===q?null:j.target.value),children:[e.jsx("option",{value:q,children:"None"}),t.map(j=>e.jsx("option",{value:j.mailboxId,children:We(j)},j.mailboxId))]}),v==="Proposed"&&h&&e.jsx(N,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{d.current=!0,m(s,h.mailboxId)},children:`Set as ${f}`}),h&&e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"flex-1",value:u,placeholder:f,"aria-label":`Display name for ${f}`,onChange:j=>l(j.target.value)}),O&&e.jsx(N,{variant:"ghost",size:"sm",className:"shrink-0",icon:e.jsx(ge,{className:"size-4"}),"aria-label":"Save display name",onClick:()=>r(h.mailboxId,u)})]})]}),I,v==="Stale"&&e.jsx(L,{tone:"warning",variant:"soft",className:"ml-[7.5rem]",children:e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{id:g,className:"flex-1",children:D}),e.jsx(N,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>i.current?.focus(),children:"Pick a folder"})]})})]})}function Je(){return e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Each canonical role — Inbox, Drafts, Sent, Archive, Spam, Trash — points at one of your account's real folders. Pick the one that actually holds the mail; the message counts tell real folders from empty look-alikes."}),e.jsx("p",{children:`Appointing a folder to a role here doesn't touch any other role, and doesn't move or rename anything on the server — it just tells Remit which folder to treat as e.g. "Drafts" everywhere (sidebar, unread badges, the compose flow).`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Your folders"})," is the account's real hierarchy. Open a folder to see what's inside it, make a new one where you're looking, and rename or delete any of them from its row."]})]})}function es({accountEmail:s,folders:t,appointments:a,displayNames:o={},onAppoint:m,onRename:r}){const u=new Set(Object.values(a).map(i=>i.mailboxId).filter(i=>i!=null)),l=t.filter(i=>!u.has(i.mailboxId));return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsxs("h2",{className:"text-sm font-semibold text-fg",children:["Folder roles — ",s]}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Each row says where its answer came from — your choice, the mail server's own flag, or a name reader matched."})]}),e.jsx("div",{className:"rounded-sm border border-line bg-surface",children:Ue.map(i=>{const d=a[i]??Ye;return e.jsx(Ze,{role:i,folders:t,appointment:d,displayName:d.mailboxId?o[d.mailboxId]??"":"",onAppoint:m,onRename:r},i)})}),l.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("h3",{className:"text-xs font-medium text-fg-muted",children:"Other folders"}),e.jsx("ul",{className:"rounded-sm border border-line bg-surface",children:l.map(i=>e.jsxs("li",{className:"flex items-center gap-2 border-b border-line px-row-inset py-2 text-sm text-fg last:border-b-0",children:[e.jsx(xe,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate",children:H(i.providerPath,i.hierarchyDelimiter)}),e.jsx("span",{className:"ml-auto shrink-0 text-2xs text-fg-subtle",children:le(i.messageCount)})]},i.mailboxId))})]})]})}const ss=12e4,ts=2e3,as="This folder is no longer in the account's folder list, so nothing was deleted.",ce=(s,t)=>{const a=s.find(o=>o.mailboxId===t);if(!a)throw new Error(as);return a},rs=(s,t)=>ce(s,t).lastSyncedAt??0;async function ns({readMailboxes:s,mailboxId:t,since:a,signal:o,segmentMs:m=ss,pollIntervalMs:r=ts,delay:u=ve,now:l=Date.now}){const i=l()+m;for(;;){o?.throwIfAborted();const d=ce(await s(),t);if((d.lastSyncedAt??0)>a)return{status:"fresh",messageCount:d.messagesTotal};if(l()>=i)return{status:"pending"};await u(r,o)}}const de=50,is=s=>s instanceof Error?s.message:"Something went wrong.",$=s=>s.then(t=>({ok:!0,value:t}),t=>({ok:!1,error:is(t)})),os=async(s,t,a,o)=>{const m=[];let r;for(let u=0;u<de;u+=1){if(o.aborted)return m;const{data:l}=await te({path:{mailboxId:s},query:{order:"desc",continuationToken:r},throwOnError:!0});for(const i of l.items)if(!i.isDeleted&&!t.has(i.messageId)&&!m.includes(i.messageId)&&(m.push(i.messageId),m.length>=a))return m;if(!l.continuationToken)break;r=l.continuationToken}return m},ls=async(s,t)=>{let a=0,o;for(let m=0;m<de;m+=1){if(t.aborted)return a;const{data:r}=await te({path:{mailboxId:s},query:{order:"desc",continuationToken:o},throwOnError:!0});for(const u of r.items)u.isDeleted||(a+=1);if(!r.continuationToken)break;o=r.continuationToken}return a};function cs({accountId:s,mailboxId:t,onDeleted:a}){const o=J(),[m,r]=c.useState("idle"),[u,l]=c.useState(null),[i,d]=c.useState(),[g,p]=c.useState(),v=c.useRef(null),y=c.useRef(void 0),h=c.useCallback(()=>{o.invalidateQueries({queryKey:ee({path:{accountId:s}})}),o.invalidateQueries({queryKey:se()})},[o,s]),f=c.useCallback(async()=>{r("deleting");const k=await $(ye({path:{accountId:s,mailboxId:t},throwOnError:!0}));if(!k.ok){d(k.error),r("error");return}h(),r("done"),a()},[s,t,h,a]),O=c.useCallback(()=>je({path:{accountId:s},throwOnError:!0}).then(({data:k})=>k.items.find(S=>S.mailboxId===t)?.messageCount??0),[s,t]),I=c.useCallback(()=>o.fetchQuery({...Ne({path:{accountId:s}}),staleTime:0}).then(k=>k.mailboxes??[]),[o,s]),w=c.useCallback(async()=>{const k=new AbortController;v.current=k;const{signal:S}=k;r("checking"),d(void 0);const M=y.current!==void 0,C=await $((async()=>(M||(S.throwIfAborted(),y.current=rs(await I(),t),S.throwIfAborted(),p(Date.now()),await ke({path:{accountId:s},throwOnError:!0})),ns({readMailboxes:I,mailboxId:t,since:y.current??0,signal:S})))());return S.aborted?(r("idle"),y.current=void 0,{status:"failed"}):C.ok?C.value.status==="pending"?(r("check-stalled"),{status:"pending"}):(y.current=void 0,C.value.messageCount>0?(r("idle"),h(),{status:"blocked",messageCount:C.value.messageCount}):(await f(),{status:"deleted"})):(y.current=void 0,d(C.error),r("error"),{status:"failed"})},[s,t,I,f,h]),D=c.useCallback(()=>{v.current?.abort()},[]),j=c.useCallback(async k=>{const S=new AbortController;v.current=S;const{signal:M}=S;r("moving"),d(void 0);const C=await $(O());if(M.aborted)return;if(!C.ok){d(C.error),r("error");return}let x=Ce(C.value);l(x);const E=new Set;for(;;){if(M.aborted)return;const n=await $(os(t,E,Me,M));if(M.aborted)return;if(!n.ok){x=_(x,n.error),l(x),d(n.error),r("error");return}const b=n.value;if(b.length===0)break;const T=await $(we({body:{messageIds:b,destinationMailboxId:k},throwOnError:!0}));if(M.aborted)return;if(!T.ok){x=_(x,T.error),l(x),d(T.error),r("error");return}for(const P of b)E.add(P);x=Se(x,b.length),l(x)}const A=await $(ls(t,M));if(!M.aborted){if(!A.ok){x=_(x,A.error),l(x),d(A.error),r("error");return}if(A.value>0){const n=`${A.value} ${A.value===1?"email is":"emails are"} still syncing. Re-open delete to finish removing this folder.`;x=_(x,n),l(x),d(n),r("error"),h();return}await f()}},[t,O,f,h]),R=c.useCallback(()=>{v.current?.abort(),v.current=null,y.current=void 0,r("idle"),l(null),d(void 0),p(void 0)},[]);return{phase:m,progress:u,errorMessage:i,checkStartedAt:g,deleteMailbox:f,deleteIfEmpty:w,moveThenDelete:j,cancel:D,reset:R}}const z=s=>`${s} ${s===1?"email":"emails"}`;function ds({open:s,accountId:t,folder:a,mailboxes:o,appointments:m,onClose:r}){const[u,l]=c.useState(()=>Q(a.messageCount)),[i,d]=c.useState(),[g,p]=c.useState(),{createFolderIn:v}=ae(t),y=re(),{phase:h,progress:f,errorMessage:O,checkStartedAt:I,deleteMailbox:w,deleteIfEmpty:D,moveThenDelete:j,cancel:R,reset:k}=cs({accountId:t,mailboxId:a.mailboxId,onDeleted:r}),[S,M]=c.useState("0:00"),C=h==="checking"||h==="check-stalled";c.useEffect(()=>{if(!C||I===void 0)return;const F=()=>M(De(Date.now()-I));F();const ue=setInterval(F,1e3);return()=>clearInterval(ue)},[C,I]),c.useEffect(()=>{s&&(l(Q(a.messageCount)),d(void 0),k())},[s,k]),c.useEffect(()=>{s&&p(void 0)},[s]),c.useEffect(()=>R,[R]);const x=c.useCallback(()=>{R(),r()},[R,r]),E=c.useCallback(async()=>{const F=await D();F.status==="blocked"&&(d(F.messageCount),l("choose-fate"))},[D]),A=c.useMemo(()=>Ie({mailboxes:o,folderAppointments:m,excludeMailboxId:a.mailboxId,translator:y}),[o,m,a.mailboxId,y]),n=A.find(F=>F.id===g),b=c.useMemo(()=>G(a,ne(m).get(a.mailboxId),y),[a,m,y]);if(!s)return null;const T=`Delete ${b}`,P=i??a.messageCount,me=h==="moving"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(K,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving emails…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:f?V(f):"Moved 0 of 0"})]}):h==="checking"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(K,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Checking the folder on the mail server…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:`Waiting ${S}. Nothing is deleted until the server answers.`})]}):h==="check-stalled"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(L,{tone:"warning",variant:"soft",children:`The mail server hasn't reported back on this folder yet — ${S} so far. Nothing has been deleted.`}),e.jsx("p",{className:"text-xs text-fg-muted",children:"A sync covers the whole account, so a busy mailbox can take a while to come round to this folder."}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"}),e.jsx(N,{size:"sm",onClick:()=>E(),children:"Keep waiting"})]})]}):h==="deleting"||h==="done"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(K,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Deleting folder…"})]}):h==="error"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(L,{tone:"danger",variant:"soft",children:O??"Something went wrong. Please try again."}),f&&e.jsxs("p",{className:"text-xs text-fg-muted",children:[V(f),". Already-moved emails stay moved — re-open delete to continue with the rest."]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Close"})})]}):u==="confirm-empty"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:b}),"? This folder is empty and will be removed from the server."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"}),e.jsx(N,{variant:"danger",size:"sm",icon:e.jsx(B,{className:"size-3.5"}),onClick:()=>E(),children:"Delete folder"})]})]}):u==="choose-fate"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:[i!==void 0&&e.jsx(L,{tone:"warning",variant:"soft",children:`This folder is not empty: the mail server reports ${z(i)} in it. Nothing was deleted.`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:b})," holds"," ",z(P),". What should happen to them?"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{type:"button",onClick:()=>l("confirm-delete-all"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(B,{className:"size-4 shrink-0 text-danger"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Delete them with the folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"The emails are removed from the server and can't be recovered."})]})]}),e.jsxs("button",{type:"button",onClick:()=>l("pick-destination"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(Ee,{className:"size-4 shrink-0 text-accent-2"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Move them to another folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"Keep the emails, then delete the emptied folder."})]})]})]})]}),e.jsx("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"})})]}):u==="confirm-delete-all"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:b})," and its"," ",z(P),"? The messages are removed from the server with the folder and can't be recovered."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:()=>l("choose-fate"),children:"Back"}),e.jsx(N,{variant:"danger",size:"sm",icon:e.jsx(B,{className:"size-3.5"}),onClick:()=>w(),children:"Delete folder and emails"})]})]}):e.jsxs("div",{className:"flex h-[26rem] flex-col",children:[e.jsxs("p",{className:"px-5 pt-4 text-sm text-fg-muted",children:["Move the ",z(P)," in"," ",e.jsx("strong",{className:"text-fg",children:b})," to:"]}),e.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:e.jsx(Y,{folders:A,selectedId:g,delimiter:o[0]?.hierarchyDelimiter??"/",onSelect:p,onCreateFolder:v,onCancel:()=>{p(void 0),l("choose-fate")},labels:{filterPlaceholder:"Move emails to…"}})}),n&&e.jsx("footer",{className:"shrink-0 border-t border-line p-2",children:e.jsx(N,{variant:"danger",onClick:()=>j(n.id),className:"h-11 w-full font-semibold",children:e.jsx("span",{className:"truncate",children:`Move ${z(P)} to ${n.label}`})})})]});return e.jsxs(W,{open:s,onClose:x,title:T,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx(Ae,{className:"size-4 shrink-0 text-danger"}),e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:T}),e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(X,{className:"size-3.5"}),onClick:x,"aria-label":"Cancel"})]}),me]})}function ms({account:s}){const t=J(),a=s.accountId,o=re(),{data:m,isPending:r,isError:u,error:l,refetch:i}=ie(Pe({path:{accountId:a}})),{createFolderIn:d}=ae(a),g=U({...$e(),onSuccess:()=>{t.invalidateQueries({queryKey:se()})}}),p=U({...ze(),onSuccess:()=>{t.invalidateQueries({queryKey:ee({path:{accountId:a}})})}}),[v,y]=c.useState(),[h,f]=c.useState(),[O,I]=c.useState(""),w=c.useMemo(()=>m?.items??[],[m]),D=c.useMemo(()=>ne(s.folderAppointments),[s.folderAppointments]),j=c.useMemo(()=>w.map(n=>({id:n.mailboxId,label:G(n,D.get(n.mailboxId),o),path:n.fullPath,deleteBlockedReason:Le(n,w,s.folderAppointments).message})),[w,D,o,s.folderAppointments]),R=(n,b)=>{g.mutate({path:{accountId:a,role:Ge[n]},body:{mailboxId:b}})},k=(n,b)=>{const T=b.trim();p.mutate({path:{accountId:a,mailboxId:n},body:{displayNameOverride:T===""?null:T}})};if(r)return e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":`Loading folders for ${s.email}`});if(u)return e.jsx(oe,{variant:"inline",title:`Couldn't load folders for ${s.email}`,error:l,onRetry:()=>{i()}});const S=w.map(n=>({mailboxId:n.mailboxId,providerPath:n.fullPath,hierarchyDelimiter:n.hierarchyDelimiter,messageCount:n.messageCount})),M={};for(const n of s.folderAppointments){const b=_e[n.role];b&&(M[b]={mailboxId:n.mailboxId??null,source:n.source,staleFolderPath:n.staleAppointmentPath})}const C={};for(const n of w)n.displayNameOverride&&(C[n.mailboxId]=n.displayNameOverride);const x=n=>w.find(b=>b.mailboxId===n),E=x(h),A=x(v);return e.jsxs("div",{className:"space-y-4",children:[(g.isError||p.isError)&&e.jsx(L,{tone:"danger",variant:"soft",children:Be(g.error)?"That folder is still being created on the mail server — wait for it to finish, then try again.":"Couldn't save that change. Please try again."}),e.jsx(es,{accountEmail:s.email,folders:S,appointments:M,displayNames:C,onAppoint:R,onRename:k}),e.jsxs("section",{className:"space-y-1.5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-fg",children:["Your folders — ",s.email]}),e.jsx("div",{className:"flex h-[28rem] flex-col overflow-hidden rounded-sm border border-line bg-surface",children:e.jsx(Qe,{folders:j,delimiter:w[0]?.hierarchyDelimiter??"/",onCreateFolder:d,onRename:n=>{f(n.id),I(x(n.id)?.displayNameOverride?.trim()??"")},onDelete:n=>y(n.id),labels:{treeAriaLabel:`All folders for ${s.email}`}})})]}),E&&e.jsx(Ve,{open:!0,folderLabel:G(E,D.get(E.mailboxId),o),defaultLabel:G({fullPath:E.fullPath,hierarchyDelimiter:E.hierarchyDelimiter},D.get(E.mailboxId),o),name:O,onNameChange:I,pending:p.isPending,error:p.isError?"Couldn't save that name. Please try again.":void 0,onSubmit:()=>{const n=O.trim();p.mutate({path:{accountId:a,mailboxId:E.mailboxId},body:{displayNameOverride:n===""?null:n}},{onSuccess:()=>f(void 0)})},onClose:()=>f(void 0)}),A&&e.jsx(ds,{open:!0,accountId:a,folder:A,mailboxes:w,appointments:s.folderAppointments,onClose:()=>y(void 0)})]})}function ys(){const s=Oe(),[t,a]=c.useState(!0),{data:o,isPending:m,isError:r,error:u,refetch:l}=ie(Te()),i=d=>{const g=Fe[d];g&&s({to:g})};return e.jsx(qe,{items:Re,activeId:"folders",title:"Folder roles",description:"Appoint which real folder fills each canonical role, per account.",help:e.jsx(Je,{}),helpOpen:t,onToggleHelp:()=>a(d=>!d),onSelect:i,onBackToMail:()=>{s({to:"/mail"})},children:m?e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):r?e.jsx(oe,{title:"Couldn't load accounts",error:u,onRetry:()=>{l()}}):o.accounts.length===0?e.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):e.jsx("div",{className:"space-y-8",children:o.accounts.map(d=>e.jsx(ms,{account:d},d.accountId))})})}export{ys as component};
|
package/assets/index-BJF4yYcO.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-CiGlLB-Q.js";import{F as r}from"./FlaggedPane-C2DANFWb.js";import"./useSearchTokenContext-Ujq8R6T0.js";import"./kbd-CWltqL4I.js";import"./useMessageBodyContent-DNKN2wNp.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-BpHJurnU.js";import"./search-token-index--_Yaw1JT.js";import"./useLayoutTier-DhsTOgzf.js";import"./useQueries-5UKmESBx.js";import"./attachment-file-JPgSnk-B.js";import"./mail-CmOZy_ab.js";import"./avatar-DVQL7gNE.js";import"./index-BKmQNnWU.js";import"./useSignature-CBWAU9NS.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DhsoNveS.js";import"./sections-N5AHkNWd.js";import"./format-1ywn__NA.js";import"./EmptyState-Bzu7cB4A.js";import"./ErrorState-DryJcc3L.js";import"./download-CNwO_hle.js";import"./calendar-event-chip-C7WALOu_.js";import"./calendar-color-DaFDa92m.js";import"./map-pin-CdF9yS8_.js";import"./attendee-row-819P35ci.js";import"./clock-Dr27yplU.js";import"./shield-check-Bb89-hnj.js";import"./useFilters-DFHZOQUs.js";import"./confirm-dialog-D1Z8lP_5.js";import"./menu-CJUUwkl-.js";import"./MailViewChrome-GX1QMfcl.js";import"./refresh-cw-BywiJYGJ.js";import"./wizard-selection-B1bng5Jq.js";function I(){return o.jsx(r.Reading,{})}export{I as component};
|