@remit/web-client-dist 0.0.550 → 0.0.552

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/assets/{BriefPane-DxnNoP6a.js → BriefPane-KLlpL-7H.js} +1 -1
  2. package/assets/{CalendarComposePane-CAOF-nPv.js → CalendarComposePane-CsWkzDBi.js} +1 -1
  3. package/assets/{CalendarComposeSeed-BQbfPaqp.js → CalendarComposeSeed-udz8ANMw.js} +1 -1
  4. package/assets/{CalendarShell-DpbQU5xG.js → CalendarShell-WswEc33Y.js} +1 -1
  5. package/assets/{EmptyState-C3n18O-8.js → EmptyState-D8775COI.js} +1 -1
  6. package/assets/{ErrorState-waTZEVlb.js → ErrorState-BUi73q43.js} +1 -1
  7. package/assets/{FlaggedPane-DwuX-FGR.js → FlaggedPane-DeZhlWFy.js} +1 -1
  8. package/assets/{FullCompose-B_mSC1Rm.js → FullCompose-C8dlsR-Q.js} +1 -1
  9. package/assets/{MailListHeader-Dwc-CFkI.js → MailListHeader-BJX8BuyA.js} +1 -1
  10. package/assets/{MailNav-DVbvZNp7.js → MailNav-DpCROJMP.js} +1 -1
  11. package/assets/{MailShell-DIHk0EtZ.js → MailShell-CMOL8AKI.js} +1 -1
  12. package/assets/{MailViewChrome-C_Gdc8bR.js → MailViewChrome-CaqCUxFx.js} +1 -1
  13. package/assets/MailboxPane-BgjcYu1t.js +1 -0
  14. package/assets/{NavMenuButton-r1Fm79xW.js → NavMenuButton-CVdc16Vd.js} +1 -1
  15. package/assets/{OnboardingWizard-DuJEUOLt.js → OnboardingWizard-BJ_im7-I.js} +1 -1
  16. package/assets/{OpenCalendarEvent-Cjxcwj3W.js → OpenCalendarEvent-BGfbdWGu.js} +1 -1
  17. package/assets/{OutboxPane-u83fdkiE.js → OutboxPane-Dd-mfB0h.js} +1 -1
  18. package/assets/_calendarObjectId-BI57QUkI.js +1 -0
  19. package/assets/_mailboxId-B2c8yk-P.js +1 -0
  20. package/assets/_messageId-BiRjaSGS.js +1 -0
  21. package/assets/_messageId-CfZiEhfq.js +1 -0
  22. package/assets/_messageId-DRWKKgAe.js +1 -0
  23. package/assets/_outboxMessageId-DHeCkE_E.js +1 -0
  24. package/assets/_recurrenceId-CZXJ1ipm.js +1 -0
  25. package/assets/_threadId-BpHQ4umN.js +1 -0
  26. package/assets/_threadId-CG2H5qxG.js +1 -0
  27. package/assets/_threadId-DZe74h9F.js +1 -0
  28. package/assets/{_view._date-BW7m2UUO.js → _view._date-ByRpWyOf.js} +1 -1
  29. package/assets/{accounts-CbzWeGqe.js → accounts-rX_ZGBrU.js} +1 -1
  30. package/assets/{advanced-DjTGDp1B.js → advanced--feucAHp.js} +1 -1
  31. package/assets/{appearance-B0x1WJZk.js → appearance-BzFLOBIM.js} +1 -1
  32. package/assets/{attachment-file-C_subxto.js → attachment-file-B5mkzgR1.js} +1 -1
  33. package/assets/{attendee-row-9sT7DjwF.js → attendee-row-BeKlhe0A.js} +1 -1
  34. package/assets/{avatar-BrdmrrTM.js → avatar-Dso3OQH7.js} +1 -1
  35. package/assets/bottom-sheet-BX-sJ8v6.js +1 -0
  36. package/assets/brief-1BFpZzpI.js +1 -0
  37. package/assets/{brief-C8SHGfDI.js → brief-BqBII2NQ.js} +1 -1
  38. package/assets/{browser-ponyfill-CMK_6O3Q.js → browser-ponyfill-h0JbYDKj.js} +1 -1
  39. package/assets/{bug-DNNKDHev.js → bug-B-341whi.js} +1 -1
  40. package/assets/{calendar-C6tEGEY1.js → calendar-CkW9BQ4L.js} +1 -1
  41. package/assets/{calendar-color-DMot25jS.js → calendar-color-BG7928-_.js} +1 -1
  42. package/assets/{calendar-event-chip-DV7VrNqC.js → calendar-event-chip-CoD7r2-a.js} +1 -1
  43. package/assets/{calendars-DtL0c4T9.js → calendars-DCTcgC1a.js} +1 -1
  44. package/assets/{card-Bbnjrfwy.js → card-CPhaopb5.js} +1 -1
  45. package/assets/chevron-left-C0OrzYvI.js +1 -0
  46. package/assets/{circle-check-CO95-FPW.js → circle-check-CLuBMQlt.js} +1 -1
  47. package/assets/{circle-check-big-DEmZetXy.js → circle-check-big-C-MjzzMN.js} +1 -1
  48. package/assets/{circle-help-EVff0LUn.js → circle-help-DpcwUo3O.js} +1 -1
  49. package/assets/{clock-DUYaqtJD.js → clock-DycMqInq.js} +1 -1
  50. package/assets/compose._-_outboxMessageId_-BKdOnGgE.js +1 -0
  51. package/assets/compose._-_outboxMessageId_-C5J40rof.js +1 -0
  52. package/assets/compose._-_outboxMessageId_-CHg6RCur.js +1 -0
  53. package/assets/compose._-_outboxMessageId_-CecgSs9p.js +1 -0
  54. package/assets/{config-import-W4GeV-m8.js → config-import-CUYN2G7f.js} +1 -1
  55. package/assets/{confirm-dialog-BFQr1kaP.js → confirm-dialog-C_t09Gva.js} +1 -1
  56. package/assets/{copy-DnpxVQkU.js → copy-DXbRkbsg.js} +1 -1
  57. package/assets/{credential-steps-CgdDYYxA.js → credential-steps-BPMPrFp_.js} +1 -1
  58. package/assets/{download-IdmPeqMJ.js → download-9A_DQZED.js} +1 -1
  59. package/assets/{file-json-CV0PVp51.js → file-json-DhoZdq39.js} +1 -1
  60. package/assets/{filters-Nt0IbhkL.js → filters-BsLKH-KQ.js} +1 -1
  61. package/assets/flagged-Be5oNxz8.js +1 -0
  62. package/assets/{flagged-Dq8258Ff.js → flagged-CG6WICxW.js} +1 -1
  63. package/assets/{folders-qQtUB6QD.js → folders-D0x6C1Ck.js} +1 -1
  64. package/assets/{format-Cv0v2QYw.js → format-C58wplMJ.js} +1 -1
  65. package/assets/{help-copy-DcoSaq-y.js → help-copy-BuBfUFvN.js} +1 -1
  66. package/assets/{import-DKYmCutH.js → import-BnuIvvYO.js} +1 -1
  67. package/assets/{index-DxmGE3m0.js → index-CAWCA7kp.js} +4 -4
  68. package/assets/index-CBQb_AiQ.js +1 -0
  69. package/assets/index-Cg9FFpxv.js +1 -0
  70. package/assets/index-D4oNqihE.js +1 -0
  71. package/assets/index-DCnzuDfm.js +1 -0
  72. package/assets/index-DRWKKgAe.js +1 -0
  73. package/assets/index-DnQf9APo.js +1 -0
  74. package/assets/index-DnzPPKUB.js +1 -0
  75. package/assets/{index-Dx0dKUBY.js → index-DoJ8vs9_.js} +1 -1
  76. package/assets/index-Dst_2SBO.js +1 -0
  77. package/assets/{index-Bp69o_hx.js → index-_JBKtYXu.js} +52 -52
  78. package/assets/index-ipkUvHk0.js +1 -0
  79. package/assets/{kbd-Dlyb756r.js → kbd-CUNCsdLt.js} +1 -1
  80. package/assets/{labels-CD95hJ3m.js → labels-BY9SfPtP.js} +1 -1
  81. package/assets/{mail-Az7LNkPT.js → mail-B73P70rO.js} +1 -1
  82. package/assets/{mail-C-vHQPUd.js → mail-CArT0__I.js} +1 -1
  83. package/assets/{map-pin-sKE11Ose.js → map-pin-CEP5uZHA.js} +1 -1
  84. package/assets/{menu-BFlsiQIN.js → menu-CyMA8ejK.js} +1 -1
  85. package/assets/{new-CzmnDZEZ.js → new-RJZncfFf.js} +1 -1
  86. package/assets/onboarding-aoafNXL7.js +1 -0
  87. package/assets/{onboarding-completion-2NaCd5nw.js → onboarding-completion-FFjKdakA.js} +1 -1
  88. package/assets/outbox-BF-J9hLg.js +1 -0
  89. package/assets/{pencil-D2kQNShx.js → pencil-C8wWVDp1.js} +1 -1
  90. package/assets/{refresh-cw-D1EHQAQk.js → refresh-cw-Mvz24VPI.js} +1 -1
  91. package/assets/{rich-text-BMx2DEPU.js → rich-text-D67UO7zJ.js} +2 -2
  92. package/assets/{rich-text-spellcheck-worker-provider-c3Qx_xOM.js → rich-text-spellcheck-worker-provider-DKCw8H_J.js} +1 -1
  93. package/assets/{rotate-ccw-BKXu5q3v.js → rotate-ccw-ByXIAEyt.js} +1 -1
  94. package/assets/{roving-focus-DQHWPAVb.js → roving-focus-R7ZTRnKj.js} +1 -1
  95. package/assets/{row-actions-KXYdPyQc.js → row-actions-BsCd_UKz.js} +1 -1
  96. package/assets/{search-mirror-Bb2WesIz.js → search-mirror-CJOCjfkC.js} +1 -1
  97. package/assets/{search-token-index-CiYTZY4U.js → search-token-index-U-0PE-Ox.js} +1 -1
  98. package/assets/{sections-Ds8T4WGv.js → sections-Bz1Hz1WB.js} +1 -1
  99. package/assets/{senders-BiLMrBit.js → senders-CRjKU72H.js} +1 -1
  100. package/assets/settings-DptY6F_3.js +1 -0
  101. package/assets/{settings-screen-RL84VvHJ.js → settings-screen-BmT3r6tg.js} +1 -1
  102. package/assets/{shield-check-BnavN1HV.js → shield-check-WkiJUavf.js} +1 -1
  103. package/assets/{suggested-vips-DsCqsoDt.js → suggested-vips-DLM7277B.js} +1 -1
  104. package/assets/{useCalendarData-B5J45tWv.js → useCalendarData-CxT_7y0k.js} +1 -1
  105. package/assets/{useCalendars-zHPvsPN-.js → useCalendars-dRe0PNET.js} +1 -1
  106. package/assets/{useDebouncedValue-DjKhDws_.js → useDebouncedValue-DYu0unJr.js} +1 -1
  107. package/assets/{useFilters-JZzi-OuL.js → useFilters-BDQsNdKM.js} +1 -1
  108. package/assets/{useLabels-PUdXuz7u.js → useLabels-DIvHKWeo.js} +1 -1
  109. package/assets/{useLayoutTier-DMB1Eh-w.js → useLayoutTier-D1c62D6O.js} +1 -1
  110. package/assets/{useMessageBodyContent-BAOiu5RU.js → useMessageBodyContent-ChO4c73P.js} +1 -1
  111. package/assets/{useQueries-CgkkspjR.js → useQueries-DNMW1lkL.js} +1 -1
  112. package/assets/{useRefreshControl-tx1oKfsp.js → useRefreshControl-hwJW949Z.js} +1 -1
  113. package/assets/{useResultFolderIndex-DY_o6Qse.js → useResultFolderIndex-C-1ZYMvt.js} +1 -1
  114. package/assets/{useSearchTokenContext-Bt8He2xM.js → useSearchTokenContext-Du649zXC.js} +1 -1
  115. package/assets/{useSemanticSearch-BMLe92eM.js → useSemanticSearch-Dkvkustt.js} +1 -1
  116. package/assets/{useSignature-Dtdki29s.js → useSignature-CkDxKXxk.js} +1 -1
  117. package/assets/{window-Wb6AhZ1T.js → window-CT3glB3e.js} +1 -1
  118. package/index.html +1 -1
  119. package/package.json +1 -1
  120. package/assets/MailboxPane-DW5d6LOg.js +0 -1
  121. package/assets/_calendarObjectId-f7asmO2F.js +0 -1
  122. package/assets/_mailboxId-d6LGf4_v.js +0 -1
  123. package/assets/_messageId-45Vhchlh.js +0 -1
  124. package/assets/_messageId-B0sUIDac.js +0 -1
  125. package/assets/_messageId-BdIoxkjt.js +0 -1
  126. package/assets/_outboxMessageId-3NOfRyUG.js +0 -1
  127. package/assets/_recurrenceId-CZ-RU_6D.js +0 -1
  128. package/assets/_threadId-BFqKN57y.js +0 -1
  129. package/assets/_threadId-BuZ-Pk9V.js +0 -1
  130. package/assets/_threadId-ZYznJBMI.js +0 -1
  131. package/assets/bottom-sheet-DULe1n8g.js +0 -1
  132. package/assets/brief-K4zweAIj.js +0 -1
  133. package/assets/chevron-left-DeM1PsCb.js +0 -1
  134. package/assets/compose._-_outboxMessageId_-CLKO0YhT.js +0 -1
  135. package/assets/compose._-_outboxMessageId_-CUS6wPlR.js +0 -1
  136. package/assets/compose._-_outboxMessageId_-DGkbQ1bW.js +0 -1
  137. package/assets/compose._-_outboxMessageId_-aM0vETym.js +0 -1
  138. package/assets/flagged-C4KaPbUm.js +0 -1
  139. package/assets/index-45Vhchlh.js +0 -1
  140. package/assets/index-4pBfeicI.js +0 -1
  141. package/assets/index-B8hA_E28.js +0 -1
  142. package/assets/index-BBrdcGEd.js +0 -1
  143. package/assets/index-BQmVSdwl.js +0 -1
  144. package/assets/index-BiSSWJKx.js +0 -1
  145. package/assets/index-CPhKZAxD.js +0 -1
  146. package/assets/index-CczPjshz.js +0 -1
  147. package/assets/index-DZCUAk3p.js +0 -1
  148. package/assets/onboarding-Cxvcf0Qu.js +0 -1
  149. package/assets/outbox-D6SWYkZH.js +0 -1
  150. package/assets/settings-JOgkRPQH.js +0 -1
@@ -0,0 +1 @@
1
+ import{j as r,a0 as ws,bT as js,bU as Ms,cJ as Rs,B as ft,f as X,T as Es,t as Me,g as Wt,r as c,W as Os,Y as As,bn as Ns,h as jt,c as mt,ab as zs,i as Mt,cK as Fs,cA as Ds,I as _s,a5 as Ls,a1 as Kt,bN as Ps,bh as $s,cL as Bs,cM as Ws,ar as Vt,aW as Ks,aX as Vs,q as Rt,m as qs,M as qt,bk as Hs,G as Qs,bl as Us,bm as Js,cN as Gs,o as Ys,cO as Xs,cy as Zs,s as en,cP as tn,cQ as sn,cg as Ht,cR as Qt,C as Ut,ag as nn,cS as on,cT as rn,ai as an,bw as ln}from"./index-_JBKtYXu.js";import{u as cn,p as Dt,R as un}from"./useSearchTokenContext-Du649zXC.js";import{u as dn,a as hn,R as fn}from"./useRefreshControl-hwJW949Z.js";import{C as Jt,r as Et,a as Gt,c as Yt,j as mn,M as gn,t as Xt,u as pn,b as xn,d as Zt,e as es,f as bn,g as vn,h as Sn,i as yn,n as Cn,k as In,l as kn,m as Tn,o as wn,p as jn,S as Mn,q as Rn,D as En,s as On,v as An,w as ts,x as Nn,y as zn,z as Fn,A as Dn,B as _n,E as ss,F as Ln,G as Pn,H as $n,I as Bn,J as Wn,K as Kn,L as Vn,N as qn,O as Hn,P as _t,Q as Lt,R as Qn,T as Un,U as Jn,V as Gn,W as Yn,X as Xn,Y as Zn,Z as eo,_ as to,$ as so,a0 as no,a1 as oo,a2 as ns,a3 as os,a4 as is,a5 as io,a6 as ro,a7 as ao,a8 as lo,a9 as co,aa as uo,ab as ho,ac as fo}from"./MailListHeader-BJX8BuyA.js";import{S as mo,M as go,a as po,u as xo,l as bo,b as vo}from"./MailViewChrome-CaqCUxFx.js";import{A as Ot}from"./avatar-Dso3OQH7.js";import{c as Ge,d as So,e as rs}from"./format-C58wplMJ.js";import{c as yo,f as Co,a as Io,u as ko}from"./useMessageBodyContent-ChO4c73P.js";import{g as Ye,i as To,t as wo,h as jo,j as Mo,k as Ro,l as Eo}from"./search-token-index-U-0PE-Ox.js";import{N as Oo}from"./NavMenuButton-CVdc16Vd.js";import{C as Ao}from"./confirm-dialog-C_t09Gva.js";import{f as No}from"./ErrorState-BUi73q43.js";import{a as zo}from"./useLabels-DIvHKWeo.js";import{L as Fo,r as Do,t as _o,s as Lo,u as Po}from"./useSemanticSearch-Dkvkustt.js";import{S as gt}from"./shield-check-WkiJUavf.js";import{B as $o}from"./bottom-sheet-BX-sJ8v6.js";import{C as Bo}from"./circle-help-DpcwUo3O.js";import{C as Wo}from"./circle-check-CLuBMQlt.js";import{u as Ko}from"./useLayoutTier-D1c62D6O.js";import{n as Vo}from"./search-query-Cr_ZXBCp.js";import{u as qo}from"./sections-Bz1Hz1WB.js";const Ho=e=>e.toLocaleString(),Qo=(e,o)=>{if(e.kind==="unknown")return`Results for “${o}”`;const t=e.value===1?"result":"results";return`${Ho(e.value)} ${t} for “${o}”`};function Uo({query:e,count:o}){return r.jsxs("div",{className:"flex items-center gap-2 border-b border-line bg-surface-sunken/30 px-3 py-2",children:[r.jsx(ws,{className:"size-4 text-fg-muted","aria-hidden":"true"}),r.jsx("span",{className:"text-sm text-fg-muted",children:Qo(o,e)})]})}const Jo=({children:e,onRefresh:o,isRefreshing:t})=>js(Ms)?e:r.jsx(Rs,{onRefresh:o,isPullable:!t,children:e}),Go=e=>e===1?"message":"messages";function Yo({count:e,onReview:o,onDismiss:t,actionLabel:s="Review & rescue"}){return r.jsx(ft,{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(gt,{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} ${Go(e)} here`})," ","may not be spam — they're from senders we can verify."]})]}),r.jsx(X,{variant:"primary",size:"sm",onClick:o,className:"self-start",children:s})]})})}const Xo=(e,o)=>e==="vip"?"vip":e==="unknown"&&o==="md"?"unknown-pill":"hidden",as=({senderTrust:e,size:o="sm",className:t})=>{const s=Xo(e,o);return s==="vip"?r.jsx(Es,{className:Me("text-warning shrink-0",o==="sm"&&"size-3.5",o==="md"&&"size-4",t),"aria-label":"VIP sender","data-testid":"sender-trust-vip"}):s==="unknown-pill"?r.jsx("span",{className:Me("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 Zo({candidate:e,selected:o,onToggle:t,hideSender:s=!1}){const{senderName:n,senderAddress:i,subject:l,snippet:a,trustReason:u,trustSubReason:d,senderTrust:h}=e;return r.jsxs("label",{className:Me("flex w-full cursor-pointer items-start gap-3 px-3 py-2.5 text-left transition-colors",s&&"pl-11",o?"bg-positive/10":"bg-surface hover:bg-surface-sunken"),children:[r.jsx(Jt,{className:"mt-0.5",checked:o,onChange:t,"aria-label":`${o?"Deselect":"Select"} ${s?l:`message from ${n}`}`}),!s&&r.jsx(Ot,{name:n,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:n}),h&&r.jsx(as,{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(Wt,{tone:"positive",children:[r.jsx(gt,{className:"size-3","aria-hidden":!0}),u]}),r.jsx("span",{className:"text-2xs text-fg-subtle",children:d})]})]})]})}const ei=e=>{const o=new Map,t=[];for(const s of e){const n=(s.senderAddress||s.senderName).toLowerCase(),i=o.get(n);if(i){i.messages.push(s);continue}o.set(n,{key:n,senderName:s.senderName,senderAddress:s.senderAddress,trustReason:s.trustReason,trustSubReason:s.trustSubReason,senderTrust:s.senderTrust,messages:[s]}),t.push(n)}return t.map(s=>o.get(s)).sort((s,n)=>n.messages.length-s.messages.length)},ti=(e,o)=>{const t=e.messages.filter(s=>o.has(s.id)).length;return t===0?"none":t===e.messages.length?"all":"some"},Pt=e=>e===1?"message":"messages";function si({group:e,selected:o,onToggleGroup:t,onToggleMessage:s}){const[n,i]=c.useState(!1),l=ti(e,o),a=e.messages.length,u=n?Os:As;return r.jsxs("div",{className:Me(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(Jt,{className:"mt-0.5",checked:l==="all",indeterminate:l==="some",onChange:()=>t(e,l!=="all"),"aria-label":`${l==="all"?"Deselect":"Select"} all ${a} ${Pt(a)} from ${e.senderName}`}),r.jsx(Ot,{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(as,{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(Wt,{tone:"positive",children:[r.jsx(gt,{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(d=>!d),"aria-expanded":n,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} ${Pt(a)}`,r.jsx(u,{className:"size-3.5","aria-hidden":!0})]})]}),n&&r.jsx("div",{className:"divide-y divide-line border-t border-line",children:e.messages.map(d=>r.jsx(Zo,{candidate:d,selected:o.has(d.id),onToggle:()=>s(d.id),hideSender:!0},d.id))})]})}const At=e=>e===1?"message":"messages",ni=(e,o)=>`Moves ${e===1?"this message":`these ${e} ${At(e)}`} out of Spam to ${o} now. Nothing later.`,wt=(e,o)=>e.find(t=>t.id===o)?.label??"Inbox";function oi(){return r.jsx(ft,{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 ii({candidates:e,selected:o,onToggle:t,onToggleGroup:s,onSelectAll:n,onSelectNone:i,onContinue:l,onCancel:a}){const[u,d]=c.useState(!1),h=o.size,g=c.useMemo(()=>ei(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(gt,{className:"size-4 text-positive","aria-hidden":!0}),"Rescue from Spam"]}),r.jsx(X,{variant:"ghost",size:"sm",icon:r.jsx(Bo,{className:"size-3.5"}),onClick:()=>d(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."}),u&&r.jsx("div",{className:"mt-2",children:r.jsx(oi,{})})]}),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(X,{variant:"ghost",size:"sm",onClick:n,children:"Select all"}),r.jsx(X,{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(si,{group:m,selected:o,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(X,{variant:"primary",onClick:l,className:"h-11 w-full font-semibold",children:`Continue with ${h} ${At(h)}`}),r.jsx(X,{variant:"ghost",onClick:a,className:"h-11 w-full",children:"Cancel"})]})]})}function ri({count:e,folders:o,delimiter:t,destination:s,onPick:n,onMove:i,onBack:l}){const[a,u]=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(Ns,{folders:o,selectedId:s,delimiter:t,onSelect:n,onCancel:()=>u(!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:wt(o,s)}),r.jsx(X,{variant:"ghost",size:"sm",onClick:()=>u(!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:ni(e,wt(o,s))}),r.jsx(X,{variant:"primary",onClick:i,className:"h-11 w-full font-semibold",children:`Move ${e} out of Spam`}),r.jsx(X,{variant:"ghost",onClick:l,className:"h-11 w-full",children:"Back"})]})]})}function ai({count:e,destinationLabel:o,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(Wo,{className:"size-10 text-positive","aria-hidden":!0}),r.jsx("p",{className:"text-base font-semibold text-fg",children:`Moved ${e} ${At(e)} out of Spam.`}),r.jsx("p",{className:"text-2xs text-fg-subtle",children:`You'll find them in ${o}.`})]}),r.jsx("div",{className:"border-t border-line bg-surface px-row-inset py-3",children:r.jsx(X,{variant:"primary",onClick:t,className:"h-11 w-full font-semibold",children:"Done"})})]})}function li({open:e,candidates:o,defaultDestinationId:t,availableFolders:s,delimiter:n,onConfirmMove:i,onCancel:l}){const[a,u]=c.useState("review"),[d,h]=c.useState(()=>e?new Set(o.map(k=>k.id)):new Set),[g,m]=c.useState(t),[p,S]=c.useState(0),y=c.useRef(!1);c.useEffect(()=>{e&&!y.current&&(u("review"),h(new Set(o.map(k=>k.id))),m(t),S(0)),y.current=e},[e,o,t]);const I=d.size,b=k=>{h(w=>{const O=new Set(w);return O.has(k)?O.delete(k):O.add(k),O})},x=(k,w)=>{h(O=>{const A=new Set(O);for(const B of k.messages)w?A.add(B.id):A.delete(B.id);return A})},j=()=>{const k=Array.from(d);S(k.length),i(k,g),u("done")};return r.jsxs($o,{open:e,onClose:l,label:"Rescue from spam",dismissLabel:"Close rescue",children:[a==="review"&&r.jsx(ii,{candidates:o,selected:d,onToggle:b,onToggleGroup:x,onSelectAll:()=>h(new Set(o.map(k=>k.id))),onSelectNone:()=>h(new Set),onContinue:()=>u("destination"),onCancel:l}),a==="destination"&&r.jsx(ri,{count:I,folders:s,delimiter:n,destination:g,onPick:m,onMove:j,onBack:()=>u("review")}),a==="done"&&r.jsx(ai,{count:p,destinationLabel:wt(s,g),onClose:l})]})}function ci(e){const o=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:o?`To: ${o}`:"(No recipients)",timeLabel:Ge(e.updatedAt),isRead:!0}}function ui(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:Ge(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0,...Et(e)}}function di({outboxMessages:e,accountId:o,imapThreads:t}){const s=e.filter(l=>l.status==="draft"&&l.accountId===o).map(ci),n=t.map(ui),i=[];return s.length>0&&i.push({id:"remit-drafts",label:"Not yet sent (Remit)",threads:s}),n.length>0&&i.push({id:"imap-drafts",label:"On the server",threads:n}),i}const hi=({label:e,count:o})=>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:o})]}),fi=({row:e,isSelected:o,onOpen:t,onDelete:s,isDeleting:n})=>r.jsxs("button",{type:"button",onClick:()=>t(e.id),className:Me("group",Yt({active:o})),children:[r.jsx(Ls,{className:"size-7 shrink-0 text-fg-muted mt-0.5"}),r.jsx(Gt,{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:n,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(Kt,{className:"size-3.5"})})})]}),mi=({row:e,isSelected:o,onOpen:t})=>{const s=!e.isRead;return r.jsxs("button",{type:"button",onClick:()=>t(e.id),className:Me("group",Yt({active:o})),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(Ot,{name:e.fromName,email:e.fromEmail,size:"sm"}),r.jsx(Gt,{thread:e})]})};function gi({accountId:e,selectedMessageId:o,imapThreads:t,title:s,unreadCount:n}){const i=yo(),l=Co(),a=Ye(),u=jt(),{data:d}=mt(zs()),h=c.useMemo(()=>di({outboxMessages:d?.items??[],accountId:e,imapThreads:t}),[d?.items,e,t]),g=Mt({...Ds(),onSuccess:()=>{u.invalidateQueries({queryKey:Fs()})}}),m=y=>{g.mutate({path:{outboxMessageId:y}})},p=y=>{const I=t.find(b=>b.messageId===y)?.threadId;I&&a({threadId:I,messageId:y})},S=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(Oo,{}),r.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:s}),(n??0)>0&&r.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle tabular-nums",children:[n," unread"]})]}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:S?r.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-center px-4",children:[r.jsx(_s,{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(y=>r.jsxs("div",{children:[y.label&&r.jsx(hi,{label:y.label,count:y.threads.length}),r.jsx("div",{className:"divide-y divide-line",children:y.threads.map(I=>y.id==="remit-drafts"?r.jsx(fi,{row:I,isSelected:I.id===i,onOpen:l,onDelete:m,isDeleting:g.isPending},I.id):r.jsx(mi,{row:I,isSelected:I.id===o,onOpen:p},I.id))})]},y.id))})]})}const ls=e=>e===1?"1 message":`${rs(e)} messages`,pi=e=>({title:"Empty Trash?",description:`${ls(e)} ${e===1?"is":"are"} erased from the mail server and cannot be restored.`,confirmLabel:"Empty Trash"}),xi=(e,o={})=>{const{trashFolderLabel:t,staleFolderLabel:s}=o;if(e==="unconfirmed"){const n=So(0,"unconfirmed",{trashFolderLabel:t});return{headline:n.title,body:n.description,actionLabel:n.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 bi({messageCount:e,isEmptying:o,deletedCount:t,refusalReason:s,trashFolderLabel:n,staleFolderLabel:i,onEmpty:l,onRepair:a,children:u}){const[d,h]=c.useState(!1);if(e<1&&s===void 0&&t===void 0)return r.jsx(r.Fragment,{children:u});const g=s?xi(s,{trashFolderLabel:n,staleFolderLabel:i}):void 0,m=pi(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:`${ls(t)} erased from the mail server.`}),r.jsx(X,{variant:"ghost",size:"sm",icon:r.jsx(Kt,{className:"size-3.5","aria-hidden":!0}),disabled:o||e<1,"aria-busy":o,onClick:()=>h(!0),children:o?"Emptying…":"Empty Trash"})]}),g&&r.jsx(ft,{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(X,{variant:"primary",size:"sm",className:"self-start",onClick:a,children:g.actionLabel})]})})]})}),r.jsx("div",{className:"min-h-0 flex-1",children:u}),r.jsx(Ao,{isOpen:d,title:m.title,description:m.description,confirmLabel:m.confirmLabel,destructive:!0,onConfirm:()=>{h(!1),l()},onCancel:()=>h(!1)})]})}function vi(e,o,t){const s=new Array(e);return new Proxy(s,{get(n,i,l){if(typeof i=="string"){const a=i.charCodeAt(0);if(a>=48&&a<=57){const u=+i;if(Number.isInteger(u)&&u>=0&&u<e){let d=n[u];if(!d){const h=o[u*2];d=n[u]={index:u,key:t(u),start:h,size:o[u*2+1],end:h+o[u*2+1],lane:0}}return d}}if(i==="length")return e}return Reflect.get(n,i,l)}})}function Le(e,o,t){let s=t.initialDeps??[],n,i=!0;function l(){const a=e();return(a.length!==s.length||a.some((d,h)=>s[h]!==d))&&(s=a,n=o(...a),t?.onChange&&!(i&&t.skipInitialOnChange)&&t.onChange(n),i=!1),n}return l.updateDeps=a=>{s=a},l}function $t(e,o){if(e===void 0)throw new Error("Unexpected undefined");return e}const Si=(e,o)=>Math.abs(e-o)<1.01,yi=(e,o,t)=>{let s;return function(...n){e.clearTimeout(s),s=e.setTimeout(()=>o.apply(this,n),t)}};let Je;const kt=()=>{if(Je!==void 0)return Je;if(typeof navigator>"u")return Je=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Je=!0;const e=navigator.maxTouchPoints;return Je=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Bt=e=>{const{offsetWidth:o,offsetHeight:t}=e;return{width:o,height:t}},Ci=e=>e,Ii=e=>{const o=Math.max(e.startIndex-e.overscan,0),s=Math.min(e.endIndex+e.overscan,e.count-1)-o+1,n=new Array(s);for(let i=0;i<s;i++)n[i]=o+i;return n},ki=(e,o)=>{const t=e.scrollElement;if(!t)return;const s=e.targetWindow;if(!s)return;const n=l=>{const{width:a,height:u}=l;o({width:Math.round(a),height:Math.round(u)})};if(n(Bt(t)),!s.ResizeObserver)return()=>{};const i=new s.ResizeObserver(l=>{const a=()=>{const u=l[0];if(u?.borderBoxSize){const d=u.borderBoxSize[0];if(d){n({width:d.inlineSize,height:d.blockSize});return}}n(Bt(t))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(t,{box:"border-box"}),()=>{i.unobserve(t)}},ht={passive:!0},Ti=typeof window>"u"?!0:"onscrollend"in window,wi=(e,o,t)=>{const s=e.scrollElement;if(!s)return;const n=e.targetWindow;if(!n)return;const i=e.options.useScrollendEvent&&Ti;let l=0;const a=i?null:yi(n,()=>o(l,!1),e.options.isScrollingResetDelay),u=g=>()=>{l=t(s),a?.(),o(l,g)},d=u(!0),h=u(!1);return s.addEventListener("scroll",d,ht),i&&s.addEventListener("scrollend",h,ht),()=>{s.removeEventListener("scroll",d),i&&s.removeEventListener("scrollend",h)}},ji=(e,o)=>wi(e,o,t=>{const{horizontal:s,isRtl:n}=e.options;return s?t.scrollLeft*(n&&-1||1):t.scrollTop}),Mi=(e,o,t)=>{if(t.options.useCachedMeasurements){const s=t.indexFromElement(e),n=t.options.getItemKey(s);return t.itemSizeCache.get(n)??t.options.estimateSize(s)}if(o?.borderBoxSize){const s=o.borderBoxSize[0];if(s)return Math.round(s[t.options.horizontal?"inlineSize":"blockSize"])}if(!o){const s=t.indexFromElement(e),n=t.options.getItemKey(s),i=t.itemSizeCache.get(n);if(i!==void 0)return i}return e[t.options.horizontal?"offsetWidth":"offsetHeight"]},Ri=(e,{adjustments:o=0,behavior:t},s)=>{var n,i;(i=(n=s.scrollElement)==null?void 0:n.scrollTo)==null||i.call(n,{[s.options.horizontal?"left":"top"]:e+o,behavior:t})},Ei=Ri;class Oi{constructor(o){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,n;return((n=(s=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:s.now)==null?void 0:n.call(s))??Date.now()},this.observer=(()=>{let t=null;const s=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(n=>{n.forEach(i=>{const l=()=>{const a=i.target,u=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[d,h]of this.elementsCache)if(h===a){this.elementsCache.delete(d);break}return}this.shouldMeasureDuringScroll(u)&&this.resizeItem(u,this.options.measureElement(a,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()})}));return{disconnect:()=>{var n;(n=s())==null||n.disconnect(),t=null},observe:n=>{var i;return(i=s())==null?void 0:i.observe(n,{box:"border-box"})},unobserve:n=>{var i;return(i=s())==null?void 0:i.unobserve(n)}}})(),this.range=null,this.setOptions=t=>{var s,n;const i={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Ci,rangeExtractor:Ii,onChange:()=>{},measureElement:Mi,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,u=null,d=!1;if(l!==void 0&&l.enabled&&i.enabled&&i.anchorTo==="end"&&this.scrollElement!==null){const m=l.count,p=i.count,S=this.getMeasurements(),y=m>0?((s=S[0])==null?void 0:s.key)??l.getItemKey(0):null,I=m>0?((n=S[m-1])==null?void 0:n.key)??l.getItemKey(m-1):null;if(p!==m||m>0&&p>0&&(i.getItemKey(0)!==y||i.getItemKey(p-1)!==I)){d=!0;const j=m>0?this.getVirtualItemForOffset(this.getScrollOffset())??S[0]:null;j&&(a=[j.key,this.getScrollOffset()-j.start]);const k=i.followOnAppend===!0?"auto":i.followOnAppend||null;k&&p>m&&this.isAtEnd(l.scrollEndThreshold)&&(m===0||i.getItemKey(p-1)!==I)&&(u=k)}}this.options=i,d&&(this.pendingMin=0,this.itemSizeCacheVersion++);let h=!1,g=0;if(a&&this.scrollOffset!==null){const[m,p]=a,S=this.getMeasurements(),{count:y,getItemKey:I}=this.options;let b=0;for(;b<y&&I(b)!==m;)b++;if(b<y){const x=S[b];if(x){const j=x.start+p;j!==this.scrollOffset&&(g=j-this.scrollOffset,this.scrollOffset=j,h=!0)}}}(h||u)&&(this.pendingScrollAnchor=[h?a[0]:null,h?a[1]:0,u,g])},this.notify=t=>{var s,n;(n=(s=this.options).onChange)==null||n.call(s,this,t)},this.maybeNotify=Le(()=>(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,!(!kt()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",l,ht),i.addEventListener("touchend",a,ht),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 n=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,n&&this.scrollElement&&this.options.enabled){const[i,l,a,u]=n;i!==null&&!a&&(kt()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?u!==0&&(this._iosDeferredAdjustment+=u):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 n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(t,{adjustments:this.scrollAdjustments+=n,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=Le(()=>[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,n,i,l,a,u,d)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:t,paddingStart:s,scrollMargin:n,getItemKey:i,enabled:l,lanes:a,laneAssignmentMode:u,gap:d}),{key:!1}),this.getMeasurements=Le(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:t,paddingStart:s,scrollMargin:n,getItemKey:i,enabled:l,lanes:a,laneAssignmentMode:u,gap:d},h)=>{const g=this.itemSizeCache;if(!l)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const b of this.laneAssignments.keys())b>=t&&this.laneAssignments.delete(b);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(b=>{this.itemSizeCache.set(b.key,b.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 b=t*2;let x=this._flatMeasurements;if(!x||x.length<b){const w=new Float64Array(b);x&&m>0&&w.set(x.subarray(0,m*2)),x=w,this._flatMeasurements=x}let j;if(m===0)j=s+n;else{const w=m-1;j=x[w*2]+x[w*2+1]+d}for(let w=m;w<t;w++){const O=i(w),A=g.get(O),B=typeof A=="number"?A:this.options.estimateSize(w);x[w*2]=j,x[w*2+1]=B,j+=B+d}const k=vi(t,x,i);return this.measurementsCache=k,k}const p=this.measurementsCache.slice(0,m),S=new Array(a).fill(void 0),y=new Float64Array(a);let I=0;for(let b=0;b<m;b++){const x=p[b];x&&(S[x.lane]===void 0&&I++,S[x.lane]=b,y[x.lane]=x.end)}for(let b=m;b<t;b++){const x=i(b),j=this.laneAssignments.get(b);let k,w;const O=u==="estimate"||g.has(x);if(j!==void 0&&this.options.lanes>1){k=j;const G=S[k],R=G!==void 0?p[G]:void 0;w=R?R.end+d:s+n}else if(I===a){let G=0,R=y[0],oe=S[0];for(let F=1;F<a;F++){const P=y[F];(P<R||P===R&&S[F]<oe)&&(G=F,R=P,oe=S[F])}k=G,w=R+d,O&&this.laneAssignments.set(b,k)}else k=b%this.options.lanes,w=s+n,O&&this.laneAssignments.set(b,k);const A=g.get(x),B=typeof A=="number"?A:this.options.estimateSize(b),J=w+B;p[b]={index:b,start:w,size:B,end:J,key:x,lane:k},S[k]===void 0&&I++,S[k]=b,y[k]=J}return this.measurementsCache=p,p},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Le(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,s,n,i)=>t.length===0||s===0?(this.range=null,null):(this.range=Ni(t,s,n,i,i===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Le(()=>{let t=null,s=null;const n=this.calculateRange();return n&&(t=n.startIndex,s=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,s]},(t,s,n,i,l)=>i===null||l===null?[]:t({startIndex:i,endIndex:l,overscan:s,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const s=this.options.indexAttribute,n=t.getAttribute(s);return n?parseInt(n,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 n=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(n!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),l=Math.max(0,n-i),a=Math.min(this.options.count-1,n+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),n=this.options.getItemKey(s),i=this.elementsCache.get(n);i!==t&&(i&&this.observer.unobserve(i),this.observer.observe(t),this.elementsCache.set(n,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,s)=>{var n,i;if(t<0||t>=this.options.count)return;let l,a,u;const d=this._flatMeasurements;if(this.options.lanes===1&&d!==null)u=this.options.getItemKey(t),a=d[t*2],l=d[t*2+1];else{const m=this.measurementsCache[t];if(!m)return;u=m.key,a=m.start,l=m.size}const h=this.itemSizeCache.get(u)??l,g=s-h;if(g!==0){const m=this.options.anchorTo==="end"&&((n=this.scrollState)==null?void 0:n.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=m?this.getTotalSize():0,S=((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t]??{index:t,key:u,start:a,size:l,end:a+l,lane:0},g,this):a<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(u)||this.scrollDirection!=="backward"));(this.pendingMin===null||t<this.pendingMin)&&(this.pendingMin=t),this.itemSizeCache.set(u,s),this.itemSizeCacheVersion++,m?this.applyScrollAdjustment(this.getTotalSize()-p):S&&this.applyScrollAdjustment(g),this.notify(!1)}},this.getVirtualItems=Le(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,s)=>{const n=[];for(let i=0,l=t.length;i<l;i++){const a=t[i],u=s[a];n.push(u)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const s=this.getMeasurements();if(s.length===0)return;const n=this._flatMeasurements,i=this.options.lanes===1&&n!=null,l=cs(0,s.length-1,i?a=>n[a*2]:a=>$t(s[a]).start,t);return $t(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,n=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),l=this.getScrollOffset();s==="auto"&&(s=t>=l+i?"end":"start"),s==="center"?t+=(n-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 n=this.getSize(),i=this.getScrollOffset(),l=this.measurementsCache[t];if(!l)return;if(s==="auto")if(l.end>=i+n-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:n="auto"}={})=>{const i=this.getOffsetForAlignment(t,s),l=this.now();this.scrollState={index:null,align:s,behavior:n,startedAt:l,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:s="auto",behavior:n="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,u=this.now();this.scrollState={index:t,align:a,behavior:n,startedAt:u,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:s="auto"}={})=>{const n=this.getScrollOffset()+t,i=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:i,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{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 n;if(s.length===0)n=this.options.paddingStart;else if(this.options.lanes===1){const i=s.length-1,l=this._flatMeasurements;l!=null?n=l[i*2]+l[i*2+1]:n=((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--}n=Math.max(...i.filter(a=>a!==null))}return Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const t=[];if(this.itemSizeCache.size===0)return t;const s=this.getMeasurements();for(const n of s)n&&this.itemSizeCache.has(n.key)&&t.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return t},this._scrollToOffset=(t,{adjustments:s,behavior:n})=>{this._intendedScrollOffset=t+(s??0),this.options.scrollToFn(t,{behavior:n,adjustments:s},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(o)}applyScrollAdjustment(o,t){o!==0&&(kt()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=o:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=o,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,n=s?s[0]:this.scrollState.lastTargetOffset,i=1,l=n!==this.scrollState.lastTargetOffset;if(!l&&Si(n,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.getScrollOffset()!==n&&this._scrollToOffset(n,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,l){const a=this.getSize()||600,u=Math.abs(n-this.getScrollOffset()),d=this.scrollState.behavior==="smooth"&&u>a;this.scrollState.lastTargetOffset=n,d||(this.scrollState.behavior="auto"),this._scrollToOffset(n,{adjustments:void 0,behavior:d?"smooth":"auto"})}this.scheduleScrollReconcile()}}const cs=(e,o,t,s)=>{for(;e<=o;){const n=(e+o)/2|0,i=t(n);if(i<s)e=n+1;else if(i>s)o=n-1;else return n}return e>0?e-1:0};function Ai(e,o,t){let s=0;for(;s<=o;){const n=(s+o)/2|0,i=e[n*2];if(i<t)s=n+1;else if(i>t)o=n-1;else return n}return s>0?s-1:0}function Ni(e,o,t,s,n){const i=e.length-1;if(e.length<=s)return{startIndex:0,endIndex:i};if(s===1&&n!==null){const d=Ai(n,i,t);let h=d;const g=t+o;for(;h<i&&n[h*2]+n[h*2+1]<g;)h++;return{startIndex:d,endIndex:h}}let a=cs(0,i,d=>e[d].start,t),u=a;if(s===1)for(;u<i&&e[u].end<t+o;)u++;else if(s>1){const d=Array(s).fill(0);for(;u<i&&d.some(g=>g<t+o);){const g=e[u];d[g.lane]=g.end,u++}const h=Array(s).fill(t+o);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),u=Math.min(i,u+(s-1-u%s))}return{startIndex:a,endIndex:u}}const Tt=typeof document<"u"?c.useLayoutEffect:c.useEffect;function zi({useFlushSync:e=!0,directDomUpdates:o=!1,directDomUpdatesMode:t="transform",...s}){const n=c.useReducer(d=>d+1,0)[1],i=c.useRef({enabled:o,mode:t,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});i.current.enabled=o,i.current.mode=t;const l=d=>{const h=i.current;if(!h.enabled||!h.container)return;const g=d.getTotalSize();if(g!==h.lastSize){h.lastSize=g;const b=d.options.horizontal?"width":"height";h.container.style[b]=`${g}px`}const m=!!d.options.horizontal,p=h.mode==="transform",S=m?"left":"top",y=d.options.scrollMargin,I=d.getVirtualItems();for(const b of I){const x=b.start-y,j=d.elementsCache.get(b.key);j&&h.lastPositions.get(j)!==x&&(h.lastPositions.set(j,x),p?j.style.transform=m?`translate3d(${x}px, 0, 0)`:`translate3d(0, ${x}px, 0)`:j.style[S]=`${x}px`)}},a={...s,onChange:(d,h)=>{var g;const m=i.current;let p=!0;if(m.enabled){l(d);const S=d.range,y=m.prevRange;p=!y||y.isScrolling!==d.isScrolling||y.startIndex!==S?.startIndex||y.endIndex!==S?.endIndex,p&&(m.prevRange=S?{startIndex:S.startIndex,endIndex:S.endIndex,isScrolling:d.isScrolling}:null)}p&&(e&&h?Ps.flushSync(n):n()),(g=s.onChange)==null||g.call(s,d,h)}},[u]=c.useState(()=>{const d=new Oi(a);return Object.assign(d,{containerRef:h=>{const g=i.current;if(g.container=h,g.lastSize=null,h&&g.enabled){const m=d.getTotalSize();g.lastSize=m;const p=d.options.horizontal?"width":"height";h.style[p]=`${m}px`}}})});return u.setOptions(a),Tt(()=>u._didMount(),[]),Tt(()=>u._willUpdate()),Tt(()=>{l(u)}),u}function Fi(e){return zi({observeElementRect:ki,observeElementOffset:ji,scrollToFn:Ei,...e})}const Nt=e=>e.query?`matching "${e.query}"`:e.from?`from "${e.from}"`:"matching your search",Di=e=>`Select all ${Nt(e)}`,_i=(e,o)=>`All ${rs(o)} ${Nt(e)} selected`,Li=({verb:e,confirmingDelete:o,hasSelection:t,junkMailboxId:s,currentMailboxId:n,deletableMessageId:i})=>{if(o)return{kind:"withheld"};if(e==="junk"){const l=mn(s,n);if(l!==void 0)return{kind:"unavailable",reason:l}}return t?{kind:"openWizard"}:e!=="delete"||i===void 0?{kind:"declined"}:{kind:"confirmDelete",messageId:i}},Pi=(e,o,t)=>e==="BACK"&&o&&t===void 0,$i=(e,o)=>({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:Ge(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0,trust:e.senderTrust,category:Xt(e.category),messageCount:o,suspicious:e.authenticity?.dkimMismatch===!0,labels:e.labels,...Et(e)}),Bi=({thread:e,mailboxId:o,isSelected:t,isFocused:s,isTabStop:n,onFocusRow:i,isChecked:l,onToggleCheck:a,onRowSelect:u,messageCount:d,isMultiSelectMode:h,onLongPress:g,isDesktop:m,density:p})=>r.jsx(gn,{thread:$i(e,d),link:{mailboxId:o,threadId:e.threadId},inListbox:!0,active:t,focused:s,isTabStop:n,density:p,isDesktop:m,onFocusRow:i,selection:{isChecked:l,onToggleCheck:a,onRowSelect:u,isMultiSelectMode:h,onLongPress:g}}),Wi=c.memo(Bi),Ki=e=>{const o=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:Ge(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0,trust:e.senderTrust,category:Xt(e.category),suspicious:o,...Et(e)}},Vi=({thread:e,mailboxId:o,isSelected:t,isFocused:s,isTabStop:n,onFocusRow:i,isChecked:l,onToggleCheck:a,onRowSelect:u,isMultiSelectMode:d,onLongPress:h,isDesktop:g,onDelete:m,onToggleRead:p,density:S})=>{const[y,I]=c.useState("none"),b=Ye(),x=c.useCallback(A=>{navigator.vibrate?.(10),A==="trailing"?m(e.messageId):p(e.messageId,e.isRead),I("none")},[m,p,e.messageId,e.isRead]),j=c.useCallback(()=>{h(e.messageId)},[h,e.messageId]),k=c.useCallback(()=>{a(e.messageId)},[a,e.messageId]),w=c.useCallback(()=>{b({threadId:e.threadId,messageId:e.messageId})},[b,e.threadId,e.messageId]),O=pn(e.messageId,u);return g||d?r.jsx(Wi,{thread:e,mailboxId:o,isSelected:t,isFocused:s,isTabStop:n,onFocusRow:i,isChecked:l,onToggleCheck:a,onRowSelect:u,isMultiSelectMode:d,onLongPress:h,isDesktop:g,density:S}):r.jsx("div",{role:"presentation",onPointerDownCapture:O.onMouseDown,onClickCapture:O.claimClick,onContextMenu:O.onContextMenu,children:r.jsx(mo,{thread:Ki(e),selectionMode:!1,checked:!1,active:t,peek:y,onPeek:I,onToggleCheck:k,onLongPress:j,onOpen:w,onAct:x})})},qi=72,Hi=32,Qi=5,us="remit:list-density",Ui=()=>{try{const e=localStorage.getItem(us);if(e==="compact"||e==="comfortable")return e}catch{}return"comfortable"},Ji=(e,o,t)=>Do(e.filter(s=>o.has(s.messageId)).map(s=>s.accountId??t)).moveDisabledHint,Gi=({mailboxId:e,threads:o,selectedMessageId:t,isLoading:s,isError:n=!1,error:i,onRetry:l,searchQuery:a,searchPredicate:u,resultCount:d={kind:"unknown"},onDeleteMessages:h,isDeleting:g=!1,isMoving:m=!1,onLoadMore:p,hasMore:S=!1,isLoadingMore:y=!1,accountId:I,listTitle:b,listMeta:x,listFilter:j,listSearchText:k,listScopeLabel:w,onTriageContextChange:O,commandsRef:A,hideHeader:B=!1})=>{const J=c.useRef(null),G=Ye(),R=$s(),oe=Bs(),{verb:F,start:P,startFromSearch:Re}=oe,Se=Ws(),ye=!!a?.trim(),W=xn(),{labels:Pe}=zo(I),{pushError:ie}=Vt(),[M,Ce]=c.useState(t),[Ee,Ie]=c.useState(),N=c.useCallback(f=>{Ie(v=>v===f?v:void 0),Ce(f)},[]),[Z,$e]=c.useState(Ui),K=c.useCallback(()=>{$e(f=>{const v=f==="comfortable"?"compact":"comfortable";try{localStorage.setItem(us,v)}catch{}return v})},[]),{toggleReadFor:ke}=Zt({mailboxId:e}),{junkMailboxId:fe}=es(I),me=ts(fe,e),Oe=c.useMemo(()=>[{accountId:I,mailboxId:e}],[I,e]),{outcome:re,staleFolderLabel:Be,guessedMailboxId:Ae}=bn(Oe),{selectedIds:z,selectedCount:_,hasSelection:ne,isSelected:ee,toggle:Y,select:Te,clearSelection:we,selectRange:ge,setAnchor:V,selectAll:pe,toggleAll:te,intersectWith:Xe}=vn(),We=An(_,R),[xe,E]=c.useState(null),Ze=ye&&!!u,Ne=`${e}|${JSON.stringify(u??{})}`,T=Sn({mailboxId:e,accountId:I,enabled:Ze,predicateKey:Ne,searchQuery:u??{}}),et=c.useCallback((f,v,he)=>{const Q=yn(f,v,he,re);Q&&ie(Q)},[ie,re]),tt=T.phase.kind,Ke=T.clear,L=c.useCallback(()=>{tt==="escalated"&&Ke(),we()},[we,Ke,tt]),[st,ae]=c.useState(null),be=c.useRef(null),le=c.useRef(!1),ze=c.useRef(null),je=!s&&o.length>0,ce=Fi({count:o.length,getScrollElement:()=>J.current,estimateSize:()=>Z==="compact"?Hi:qi,overscan:Qi}),Ve=t?o.findIndex(f=>f.messageId===t):-1,q=M?o.findIndex(f=>f.messageId===M):-1,se=c.useCallback(f=>{if(f<0||f>=o.length)return;const v=o[f];if(We){Y(v.messageId);return}be.current=v.messageId,le.current=!1,Ie(v.messageId),Ce(v.messageId)},[o,We,Y]),Fe=c.useCallback(()=>{if(o.length===0)return;const f=q<0?0:Math.min(q+1,o.length-1);se(f)},[o.length,q,se]),nt=c.useCallback(()=>{if(o.length===0)return;const f=q<=0?0:q-1;se(f)},[o.length,q,se]),qe=c.useCallback(()=>se(0),[se]),He=c.useCallback(()=>se(o.length-1),[se,o.length]),ve=c.useCallback(()=>{M&&Y(M)},[M,Y]),D=c.useMemo(()=>o.map(f=>f.messageId),[o]),De=c.useMemo(()=>{const f=[];for(const v of o)z.has(v.messageId)&&f.push({id:v.messageId,sender:v.fromName??v.fromEmail??"Unknown",email:v.fromEmail??"",subject:v.subject??"(No subject)",date:Ge(v.sentDate),accountId:I});return f},[o,z,I]),xt=c.useCallback((f,v)=>v.shiftKey?(ge(D,f,M),!0):v.metaKey||v.ctrlKey?(Y(f),!0):(L(),V(f),!1),[D,M,ge,Y,L,V]),ot=c.useCallback(f=>{!h||f.length===0||(ze.current=M??null,E(f))},[h,M]),_e=c.useCallback(f=>{const v=Cn(D,M,f);v!==void 0&&(ge(D,v),be.current=v,le.current=!1,Ie(void 0),Ce(v))},[D,M,ge]),ue=c.useCallback(()=>_e(-1),[_e]),it=c.useCallback(()=>_e(1),[_e]),rt=c.useCallback(()=>{D.length>0&&pe(D)},[D,pe]),at=c.useCallback(f=>{const v=Li({verb:f,confirmingDelete:xe!==null,hasSelection:ne,junkMailboxId:fe,currentMailboxId:e,deletableMessageId:h?M:void 0});return v.kind==="openWizard"?(P(f),!0):v.kind==="confirmDelete"?(ot([v.messageId]),!0):v.kind==="unavailable"?(ie({severity:"warning",title:v.reason}),!0):v.kind==="withheld"},[xe,h,ne,fe,e,P,M,ot,ie]),de=c.useCallback((f,v)=>{const he=o.find(Q=>Q.messageId===f)?.threadId;he&&G({threadId:he,messageId:f},{replace:v?.replace})},[G,o]),lt=c.useCallback(()=>{M&&de(M)},[M,de]),bt=c.useCallback(f=>de(f,{replace:!0}),[de]);In({keyboardFocusedMessageId:Ee,openMessageId:t,enabled:R&&_===0,open:bt});const Qe=T.phase.kind==="escalated"?{scope:Nt(u??{}),total:T.phase.total,searchQuery:u??{},run:f=>T.runAction(f),stop:T.stop}:void 0,ct=c.useCallback(f=>{if(f.length===0){E(null);return}const v=new Set(f),he=o.findIndex(U=>v.has(U.messageId));let Q;for(let U=he+1;U<o.length;U++)if(!v.has(o[U].messageId)){Q=o[U].messageId;break}if(Q===void 0){for(let U=he-1;U>=0;U--)if(!v.has(o[U].messageId)){Q=o[U].messageId;break}}h?.(f),L(),ze.current=null,E(null),Q!==void 0&&(be.current=Q,le.current=!1,N(Q),R&&de(Q,{replace:!0})),R||ae(kn("delete",f.length,re))},[o,h,L,de,R,N,re]),ut=c.useCallback(()=>{const f=ze.current;ze.current=null,E(null),f!==null&&(be.current=f,le.current=!1,N(f))},[N]),Ue=c.useMemo(()=>Ji(o,z,I),[I,z,o]),vt=c.useCallback(()=>{if(Qe){Re();return}P("organize")},[Qe,Re,P]),St=c.useCallback(f=>{h?.([f])},[h]),dt=c.useCallback((f,v)=>{ke([f],!v)},[ke]),yt=c.useCallback(f=>{R||Te(f)},[R,Te]),C=c.useCallback(()=>{if(T.isRunning||T.phase.kind==="counting"){T.stop();return}L()},[T,L]),H=c.useCallback(()=>{T.clear()},[T]);c.useEffect(()=>{if(le.current||!R&&t)return;const f=q>=0?q:Ve;f>=0&&ce.scrollToIndex(f,{align:"auto"})},[q,Ve,ce,R,t]),c.useEffect(()=>{t&&(le.current=!1,N(t))},[t,N]),c.useEffect(()=>{M&&(o.some(f=>f.messageId===M)||N(o[0]?.messageId))},[o,M,N]),c.useEffect(()=>{O?.({focusedMessageId:M,selectedIds:Array.from(z),hasList:je})},[M,z,je,O]);const $=c.useRef(O);$.current=O,c.useEffect(()=>()=>$.current?.({focusedMessageId:void 0,selectedIds:[],hasList:!1}),[]),c.useEffect(()=>{T.phase.kind!=="idle"||T.isRunning||Xe(o.map(f=>f.messageId))},[o,Xe,T.phase,T.isRunning]);const zt=c.useRef(e);c.useEffect(()=>{zt.current!==e&&(zt.current=e,L())},[e,L]),Tn({shouldBlockFn:({action:f})=>Pi(f,ne,Se)?(L(),!0):!1,enableBeforeUnload:!1,disabled:!ne||Se!==void 0}),c.useEffect(()=>{const f=J.current;if(!f||!S||!p)return;const v=()=>{if(y)return;const{scrollTop:he,scrollHeight:Q,clientHeight:U}=f;he+U>=Q-200&&p()};return f.addEventListener("scroll",v,{passive:!0}),v(),()=>f.removeEventListener("scroll",v)},[S,y,p]),c.useEffect(()=>{const f=be.current;if(!f)return;const v=J.current?.querySelector(`[data-message-id="${f}"]`);v&&(be.current=null,v.focus({preventScroll:!0}))}),c.useEffect(()=>{if(A){if(!je){A.current=null;return}return A.current={focusNext:Fe,focusPrevious:nt,focusFirst:qe,focusLast:He,openFocused:lt,toggleSelect:ve,extendSelectDown:it,extendSelectUp:ue,selectAll:rt,clearSelection:()=>ne?(L(),!0):!1,requestVerb:at,toggleDensity:K},()=>{A.current=null}}},[A,je,Fe,nt,qe,He,lt,ve,it,ue,rt,ne,L,at,K]);const Ft=s?"loading":n?"error":o.length===0?"empty":"ready",fs=n?No(i):void 0,ms=c.useCallback(()=>{const f=Ks(Vs());window.open(f,"_blank","noopener,noreferrer")},[]),gs=[{id:"inbox",threads:[]}],Ct=D.length>0&&D.every(f=>z.has(f)),ps=Ze&&S&&Ct&&!g&&!m&&T.phase.kind==="idle"&&!T.isRunning,xs=g||m||T.isRunning,It=T.phase.kind==="escalated"?T.phase.total:_,bs=T.runningAction?wn(T.runningAction.kind,T.progress?.done??0,T.progress?.total??It):T.phase.kind==="counting"?"Counting matches…":T.phase.kind==="escalated"?_i(u??{},T.phase.total):void 0,vs=T.phase.kind!=="escalated"&&D.length>0?{checked:Ct,indeterminate:_>0&&!Ct,onChange:()=>te(D)}:void 0,Ss=T.runningAction?{value:T.progress?.done??0,max:T.progress?.total??It,tone:jn(T.runningAction.kind)}:void 0,ys=(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:H}}:ps?{tone:"info",text:"",action:{label:Di(u??{}),onClick:T.escalate}}:void 0)??(Ue?{tone:"warning",text:Ue}:void 0),Cs=r.jsx(Mn,{title:W.title||b,navSlot:W.navSlot,titleMeta:W.titleMeta,searchSlot:W.searchSlot,searchField:W.searchField,idleSlot:W.makeFilterSlot,count:It,onCancel:C,onDelete:()=>P("delete"),onMove:()=>P("move"),onOrganize:vt,onJunk:me?()=>P("junk"):void 0,onMarkRead:()=>P("markRead"),overflowSlot:I&&e&&_>0&&Pe.length>0?r.jsx(Fo,{accountId:I,mailboxId:e,messageIds:Array.from(z)}):void 0,isBusy:xs,isCounting:T.phase.kind==="counting",selectAll:vs,statusLabel:bs,progress:Ss,notice:ys}),Is=Rn(D,M),ks=c.useCallback(f=>{le.current=!0,N(f)},[N]),Ts=r.jsxs(r.Fragment,{children:[ye&&a&&r.jsx(Uo,{query:a,count:d}),r.jsxs("div",{ref:J,role:"listbox","aria-multiselectable":!0,"aria-label":b,className:"flex-1 overflow-y-auto",children:[r.jsx("div",{role:"presentation",className:"relative w-full",style:{height:`${ce.getTotalSize()}px`},children:ce.getVirtualItems().map(f=>{const v=o[f.index];return r.jsx("div",{role:"presentation","data-index":f.index,ref:ce.measureElement,className:Me("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(Vi,{thread:v,mailboxId:e,isSelected:t===v.messageId,isFocused:M===v.messageId,isTabStop:Is===v.messageId,onFocusRow:ks,isChecked:ee(v.messageId),onToggleCheck:Y,onRowSelect:xt,isMultiSelectMode:We,onLongPress:yt,isDesktop:R,onDelete:St,onToggleRead:dt,density:Z})},f.key)})}),y&&r.jsx(go,{})]})]});return r.jsxs(r.Fragment,{children:[st&&!R&&r.jsx(ft,{tone:"success",variant:"soft",className:"m-2 rounded-md",onDismiss:()=>ae(null),children:st}),r.jsx(po,{listTitle:b,listMeta:x,sections:gs,flatList:!0,listState:W.searchResults?"ready":Ft,searchQuery:k,listFilter:j,listScopeLabel:w,errorMessage:fs,onRetry:l,onReportError:ms,density:Z,selectedThreadId:t,onSelectThread:f=>de(f),isDesktop:R,hideHeader:B,selectionBar:Cs,listBody:W.searchResults??(Ft==="ready"?Ts:void 0)}),r.jsx(En,{isOpen:xe!==null,messageIds:xe??[],outcome:re,accountId:I,trashFolderLabel:b,staleFolderLabel:Be,guessedMailboxId:Ae,isDeleting:g,onConfirm:ct,onCancel:ut}),r.jsx(On,{verb:F,accountId:I,mailboxId:e,selection:De,selectionRestriction:Ue?"spansAccounts":void 0,escalated:Qe,escalatedProgress:T.progress,onFinished:L,onRunEnded:et})]})},Yi=e=>qt({path:{accountId:e}}),Xi=e=>{const o=jt(),t=Rt(),s=Mt({...qs(),onSuccess:()=>{t.recordEvent("sync.triggered"),o.invalidateQueries({queryKey:Yi(e)})}});return{trigger:()=>{s.mutate({path:{accountId:e}})},triggerAsync:()=>s.mutateAsync({path:{accountId:e}}),isPending:s.isPending,error:s.error,reset:s.reset}},Zi=({accountId:e,children:o})=>{const{triggerAsync:t,isPending:s}=Xi(e);return r.jsx(Jo,{onRefresh:t,isRefreshing:s,children:o})};function er({accountId:e,currentMailboxId:o,candidates:t,onMove:s,children:n}){const[i,l]=c.useState(!1),a=Rt(),u=Hs(),{inboxMailboxId:d}=Nn(e),h=zn(e),{data:g}=mt({...Qs({path:{accountId:e}}),staleTime:1/0}),m=c.useMemo(()=>Us({mailboxes:g?.items??[],folderAppointments:h,currentMailboxId:o,translator:u}),[g?.items,h,o,u]),p=c.useMemo(()=>d||(m.find(x=>x.label.toLowerCase()==="inbox")?.id??m.find(x=>!x.isCurrent)?.id??""),[d,m]),S=c.useRef(!1);c.useEffect(()=>{S.current||(S.current=!0,Fn(a,t.length))},[a,t.length]);const y=c.useCallback(()=>{Dn(a,t.length),l(!0)},[a,t.length]),I=c.useCallback((b,x)=>{_n(a,{selected:b.length,total:t.length,toInbox:x===d}),s(b,x)},[a,t.length,d,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(Yo,{count:t.length,onReview:y})}),r.jsx("div",{className:"min-h-0 flex-1",children:n}),r.jsx(li,{open:i,candidates:t,defaultDestinationId:p,availableFolders:m,delimiter:Js(g?.items??[]),onConfirmMove:I,onCancel:()=>l(!1)})]})}const tr=(e,o,t,s)=>`${e??""}|${o}|${t??""}|${s??""}`,sr=({accountId:e,mailboxId:o})=>{const t=jt(),{pushError:s}=Vt(),{requestAppointment:n}=Gs(),{trashByAccount:i}=ss(),l=e?i.get(e):void 0,a=tr(e,o,l?.mailboxId,l?.source),[u,d]=c.useState({scope:a});u.scope!==a&&d({scope:a});const h=u.scope===a?u:void 0,g=c.useCallback(()=>t.getQueryData(Ys())?.accounts.find(w=>w.accountId===e)?.folderAppointments.find(w=>w.role==="Trash")?.mailboxId??o,[t,e,o]),m=c.useRef(void 0),{mutateAsync:p,isPending:S}=Mt({...tn(),meta:en(409),onMutate:()=>(m.current=a,{scope:a,listMailboxId:g()}),onSuccess:(x,j,k)=>{k.scope===a&&d({scope:a,deletedCount:x.deletedCount})},onError:(x,j,k)=>{const w=Xs(x);if(!w){s({title:"Couldn't empty Trash",detail:Zs(x),error:x});return}k?.scope===a&&d({scope:a,refusal:w})},onSettled:(x,j,k,w)=>{m.current===w?.scope&&(m.current=void 0),To(t,wo([w?.listMailboxId??o])),e&&t.invalidateQueries({queryKey:qt({path:{accountId:e}})})}}),y=c.useCallback(()=>e?(d({scope:a}),p({path:{accountId:e}}).then(()=>{},()=>{})):Promise.resolve(),[e,a,p]),I=c.useCallback(()=>{y()},[y]),b=c.useCallback(()=>{const x=h?.refusal;x&&n({accountId:x.accountId,role:x.role,reason:x.reason,action:{kind:"emptyTrash"},onAppointed:y})},[h,n,y]);return{emptyTrash:I,isEmptying:S&&m.current===a,deletedCount:h?.deletedCount,refusal:h?.refusal,repair:b}},nr="We can verify this sender";function or(e){const{data:o}=mt({...sn({path:{mailboxId:e??""},query:{senderTrust:["vip","wellknown"],dkimMismatch:!1,results:!0,limit:500}}),enabled:!!e,staleTime:6e4});return{candidates:(o?.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:nr,trustSubReason:Ln(s.senderTrust),senderTrust:s.senderTrust}))}}const ir=6e4,rr=({mailboxId:e,criteria:o,enabled:t})=>{const s={...o,count:!0,results:!1},{data:n}=mt({queryKey:Ht({path:{mailboxId:e},query:s}),queryFn:async()=>{const{data:i}=await Qt({path:{mailboxId:e},query:s,throwOnError:!0});return i},enabled:t,staleTime:ir});return t?_o(n?.count):{kind:"unknown"}},ar=e=>{const o=new Set,t=[];for(const s of e)o.has(s.threadMessageId)||(o.add(s.threadMessageId),t.push(s));return t},lr=50,ds=c.createContext(null);function pt(){const e=c.useContext(ds);if(!e)throw new Error("MailboxPane.* must be used inside <MailboxPane>");return e}function cr({mailboxId:e,thread:o,children:t}){const s=Ye(),n=jo(),i=qo(),l=o?.threadId,a=o?.messageId,u=Rt(),{accounts:d,searchQuery:h,onToggleIntelligence:g,onSearchClearQuery:m}=Ut(),p=cn(),S=Vo(h),y=S.length>0,{freeText:I,tokens:b}=Dt(S,p),x=Dt(h.trim(),p).freeText,[j,k]=c.useState("all"),[w,O]=c.useState(new Set),A=c.useMemo(()=>({category:j,attributes:w}),[j,w]),B=c.useMemo(()=>Pn(A),[A]),J=y||$n(A),{params:G,residual:R}=Bn(b,B),oe={order:"desc",...I?{query:I}:{},...G,...B},F={...oe,limit:lr},P={category:F.category,unread:F.unread,starred:F.starred,attachments:F.attachments},Re=J?Ht({path:{mailboxId:e},query:F}):nn({path:{mailboxId:e},query:{order:"desc"}}),{data:Se,isLoading:ye,isError:W,error:Pe,refetch:ie,fetchNextPage:M,hasNextPage:Ce,isFetchingNextPage:Ee}=xo({queryKey:Re,queryFn:async({pageParam:C})=>{if(J){const{data:$}=await Qt({path:{mailboxId:e},query:{...F,continuationToken:C},throwOnError:!0});return $}const{data:H}=await ln({path:{mailboxId:e},query:{order:"desc",continuationToken:C},throwOnError:!0});return H},initialPageParam:void 0,getNextPageParam:C=>C.continuationToken,placeholderData:(C,H)=>fo(H?.queryKey,P)?C:void 0}),Ie=rr({mailboxId:e,criteria:oe,enabled:Lo({hasSearchQuery:y,freeText:I,residualTokenCount:R.length})}),{accountId:N,isLoading:Z}=Wn(e),$e=Mo({accounts:d}),K=Kn(Vn(ar(Se?.pages.flatMap(C=>C.items??[])??[])),R,N),ke=c.useCallback(C=>{k(C)},[]),fe=c.useCallback(C=>{O(H=>{const $=new Set(H);return $.has(C)?$.delete(C):$.add(C),$})},[]),me=c.useCallback(()=>{k("all"),O(new Set)},[]),Oe=c.useCallback(()=>{me(),m()},[me,m]),re=bo({chips:A,tokens:b,reach:R.length>0?"loaded-pages":qn(F),onClear:Oe}),Be=l?K.find(C=>C.messageId===a)??K.find(C=>C.threadId===l):void 0,Ae=Hn(l,a),z=Be??Ae,_=a??z?.messageId,ne=c.useMemo(()=>{if(l)return{threadId:l,mailboxId:z?.mailboxId??e,subject:z?.subject,messageId:_,authenticity:z?.authenticity}},[l,z,_,e]),ee=c.useCallback(C=>{_&&C.includes(_)&&n()},[_,n]),{deleteMessages:Y,isPending:Te}=_t({mailboxId:e,onAfterOptimisticRemove:ee}),{moveMessages:we,isPending:ge}=Lt({mailboxId:e,accountId:N,onAfterOptimisticRemove:ee}),V=c.useRef(null),pe=Qn(),{listCommandsRef:te,onTriageContextChange:Xe,focusedMessageId:We,selectedIds:xe}=pe,E=K.find(C=>C.messageId===We)??z,Ze=Ro({accounts:d})??null,Ne=Un({thread:z,isOpen:!0,mailboxId:e,accountId:N,onAfterOptimisticRemove:ee}),{draftsMailboxId:T}=Jn(N),et=T!==void 0&&T===e,{archiveMailboxId:tt}=Gn(N),Ke=Yn(),L=on(),st=c.useMemo(()=>rn(L,l,_),[L,l,_]),ae=c.useMemo(()=>{if(E)return C=>L({threadId:E.threadId,messageId:E.messageId,mode:C})},[L,E]),be=Io(),le=an(),ze=ko(),je=c.useCallback(C=>C?Ke(C):[],[Ke]),{toggleStar:ce}=Xn({threadId:E?.threadId??"",mailboxId:e}),{toggleReadFor:Ve}=Zt({mailboxId:e,accountId:N}),{junkMailboxId:q}=es(N),se=q!=null&&q===e,Fe=ts(q,e),{candidates:nt}=or(se?q:void 0),{moveMessages:qe}=Lt({mailboxId:e,threadId:E?.threadId,accountId:N,onAfterOptimisticRemove:ee}),{deleteMessages:He}=_t({mailboxId:e,threadId:E?.threadId,onAfterOptimisticRemove:ee}),{addressId:ve,address:D}=Zn(E),{updateFlags:De}=eo({addressId:ve,senderEmail:E?.fromEmail??void 0}),xt=c.useCallback(()=>ae?.("reply"),[ae]),ot=c.useCallback(()=>ae?.("reply-all"),[ae]),_e=c.useCallback(()=>ae?.("forward"),[ae]),ue=c.useCallback(()=>je(E),[je,E]),it=c.useCallback(()=>{if(te.current?.requestVerb("delete"))return;const C=ue();C.length>0&&He(C)},[te,ue,He]),rt=c.useCallback(()=>{if(te.current?.requestVerb("junk")||!Fe)return;const C=ue();C.length!==0&&(to(u,{count:C.length,senderTrust:E?.senderTrust??"unknown",wasRescuable:E?so(E):!1}),qe(C,Fe))},[te,Fe,ue,qe,u,E]),at=c.useCallback(()=>{if(xe.length>0){const C=!(E?.hasStars??!1),H=new Set(xe);for(const $ of K)H.has($.messageId)&&$.hasStars!==C&&ce($.messageId,$.hasStars);return}E&&ce(E.messageId,E.hasStars)},[xe,K,E,ce]),de=c.useCallback(()=>{if(te.current?.requestVerb("markRead"))return;const C=ue();if(C.length===0)return;const H=!(E?.isRead??!1);Ve(C,H)},[te,ue,E,Ve]),lt=c.useCallback(()=>{if(!ve)return;const C=D?.flags?.muted?.value!==!0;De({muted:{value:C}})},[ve,D,De]),bt=c.useCallback(()=>{if(!ve)return;const C=D?.flags?.vip?.value!==!0;De({vip:{value:C}})},[ve,D,De]),Qe=c.useCallback(()=>{V.current?.open()},[]),ct=et?"drafts":tt===e?"archive":q===e?"junk":"inbox",ut=c.useRef("");c.useEffect(()=>{const C=ut.current;ut.current=S,S.length>0&&C.length===0&&u.recordEvent("search.submitted",{mailboxType:ct})},[S,ct,u]);const{goBack:Ue,nextMessageId:vt,previousMessageId:St}=no({context:pe,orderedIds:K.map(C=>C.messageId),selectedMessageId:_,enabled:!be&&!le,hasOpenThread:l!==void 0,onClose:n,handlers:{reply:xt,replyAll:ot,forward:_e,delete:it,toggleStar:at,toggleRead:de,muteSender:lt,blockSender:z?Qe:void 0,vipSender:bt,markJunk:rt,toggleIntelligence:z?()=>V.current?.toggle():void 0,compose:ze,goBrief:()=>i("brief"),goInbox:()=>i("brief"),goSent:()=>i("brief"),goFlagged:()=>i("flagged"),goSettings:()=>i("settings")}}),dt=C=>{if(!C)return;const H=K.find($=>$.messageId===C);return H?{threadId:H.threadId,messageId:C}:void 0},yt={mailboxId:e,selectedMessageId:_,selectedThread:z,conversation:ne,onOpenThread:s,threads:K,isLoading:ye,isError:W,error:Pe,mailboxAccountId:N,mailboxAccountLoading:Z,mailboxName:$e,unreadCount:Ze,isDraftsMailbox:et,isSpamFolder:se,rescueCandidates:nt,filterCategory:j,filterAttributes:w,onSelectFilterCategory:ke,onToggleFilterAttribute:fe,onClearFilters:me,listFilter:re,listSearchText:x||void 0,onToggleIntelligence:g,intelligenceRef:V,handleDeselectIfRemoved:ee,searchPredicate:y&&R.length===0?F:void 0,resultCount:Ie,onDeleteMessages:Y,onMoveMessages:we,isDeleting:Te,isMoving:ge,onLoadMore:M,hasMore:Ce,isLoadingMore:Ee,onTriageContextChange:Xe,listCommandsRef:te,onRetry:()=>ie(),onReply:st,onToolbarDelete:Ne.deleteThread,onToolbarStar:Ne.toggleStar,isStarred:Ne.isStarred,onToolbarMove:Ne.moveThread,onBack:Ue,nextThread:dt(vt),previousThread:dt(St)};return r.jsx(ds.Provider,{value:yt,children:t})}function hs(){const{mailboxId:e,selectedMessageId:o,threads:t,isLoading:s,isError:n,error:i,onDeleteMessages:l,onMoveMessages:a,isDeleting:u,isMoving:d,onLoadMore:h,hasMore:g,isLoadingMore:m,mailboxAccountId:p,mailboxName:S,unreadCount:y,isDraftsMailbox:I,isSpamFolder:b,rescueCandidates:x,onTriageContextChange:j,listCommandsRef:k,onRetry:w,filterCategory:O,filterAttributes:A,onSelectFilterCategory:B,onToggleFilterAttribute:J,onClearFilters:G,listFilter:R,listSearchText:oe,searchPredicate:F,resultCount:P}=pt(),{searchQuery:Re,searchInput:Se,accounts:ye,resultFolderIndex:W}=Ut(),Pe=Ko(),ie=Ye(),M=S??"Inbox",Ce=c.useMemo(()=>lo(),[]),{trashMailboxId:Ee}=co(p),Ie=Eo({accounts:ye}),{trashByAccount:N}=ss(),Z=sr({accountId:p,mailboxId:e}),$e=Ee!=null&&Ee===e,K=c.useMemo(()=>p?[p]:[],[p]),{hasNewMail:ke}=dn(),{state:fe,errorMessage:me,refresh:Oe}=hn(K,{onSettled:w}),re=c.useMemo(()=>r.jsx(fn,{state:fe,onRefresh:Oe,label:`Refresh ${M}`,errorMessage:me,hasUpdate:ke(K)}),[fe,Oe,M,me,ke,K]),Be=c.useMemo(()=>t.map(V=>uo(V,W)),[t,W]),{hits:Ae,isLoading:z}=Po({mailboxId:e,filterCategory:O}),_=c.useMemo(()=>ho(Ae,t.map(V=>V.threadId),W),[Ae,t,W]),ne=c.useCallback(V=>{const pe=V.threadId??t.find(te=>te.messageId===V.id)?.threadId;pe&&ie({threadId:pe,messageId:V.id},{mailboxId:V.mailboxId??e,query:Se})},[e,ie,Se,t]);if(I&&p)return r.jsx(gi,{accountId:p,selectedMessageId:o,imapThreads:t,title:S??"Drafts",unreadCount:y??void 0});const ee=r.jsx(Gi,{mailboxId:e,threads:t,selectedMessageId:o,isLoading:s,isError:n,error:i,onRetry:w,searchQuery:Re,searchPredicate:F,resultCount:P,onDeleteMessages:l,isDeleting:u,isMoving:d,onLoadMore:h,hasMore:g,isLoadingMore:m,accountId:p,listTitle:M,listFilter:R,listSearchText:oe,listScopeLabel:M,hideHeader:!0,onTriageContextChange:j,commandsRef:k}),Y=ye[0]?.accountId,Te=Pe==="phone"&&Y?r.jsx(Zi,{accountId:Y,children:ee}):ee,we=b&&x.length>0&&p?r.jsx(er,{accountId:p,currentMailboxId:e,candidates:x,onMove:a,children:Te}):Te,ge=$e?r.jsx(bi,{messageCount:Ie,isEmptying:Z.isEmptying,deletedCount:Z.deletedCount,refusalReason:Z.refusal?.reason,trashFolderLabel:S??void 0,staleFolderLabel:p?N.get(p)?.staleFolderPath:void 0,onEmpty:Z.emptyTrash,onRepair:Z.repair,children:we}):we;return r.jsx(vo,{title:M,unreadCount:y,preset:Ce,selectedCategory:O,activeFilters:A,onSelectCategory:B,onToggleFilter:J,onClearFilters:G,searchResults:Be,searchLoading:s,relatedResults:_,relatedLoading:z,onSelectSearchResult:ne,searchResultsInBody:!0,refreshControl:re,children:ge})}function ur(){const{mailboxId:e,mailboxAccountId:o,mailboxAccountLoading:t,selectedThread:s,conversation:n,onReply:i,onToolbarDelete:l,onToolbarStar:a,isStarred:u,onToolbarMove:d,handleDeselectIfRemoved:h,intelligenceRef:g}=pt(),m=!!n,p=ro(n?.threadId);ns(g,p);const S=c.useRef(null),{railFits:y,openRail:I}=p;c.useEffect(()=>{if(!y)return;const x=s?.messageId??null;x&&S.current!==x&&s?.authenticity?.dkimMismatch&&(S.current=x,I())},[y,I,s?.messageId,s?.authenticity?.dkimMismatch]);const b=n?r.jsx(os,{threadId:n.threadId,mailboxId:n.mailboxId,subject:n.subject,selectedMessageId:n.messageId,authenticity:n.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(ao,{hasThread:m,messageId:n?.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:u,moveContext:m&&o?{accountId:o,currentMailboxId:e,onMove:d}:void 0,moveContextLoading:t}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:b})]}),r.jsx(is,{isOpen:p.drawerOpen,onClose:p.closeDrawer,thread:s,mailboxId:e,accountId:o,onAfterOptimisticRemove:h})]})}function dr(){const{mailboxId:e,mailboxAccountId:o,selectedThread:t,onToggleIntelligence:s,handleDeselectIfRemoved:n}=pt();return r.jsx(io,{onClose:s,thread:t,mailboxId:e,accountId:o,onAfterOptimisticRemove:n})}function hr(){const{mailboxId:e,mailboxAccountId:o,selectedThread:t,conversation:s,onOpenThread:n,onBack:i,nextThread:l,previousThread:a,handleDeselectIfRemoved:u,intelligenceRef:d}=pt(),h=oo(s?.threadId??null);return ns(d,h),s?r.jsxs(r.Fragment,{children:[r.jsx(os,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,authenticity:s.authenticity,onBack:i,onOpenIntelligence:h.toggle,onSwipeNext:l?()=>n(l):void 0,onSwipePrevious:a?()=>n(a):void 0,mobileIntelligenceOpen:h.isOpen}),r.jsx(is,{isOpen:h.isOpen,onClose:h.close,thread:t,mailboxId:e,accountId:o,onAfterOptimisticRemove:u})]}):r.jsx(hs,{})}const Dr=Object.assign(cr,{List:hs,Reading:ur,Intelligence:dr,Phone:hr});export{Dr as M};
@@ -1 +1 @@
1
- import{v as n,j as a,f as o}from"./index-Bp69o_hx.js";import{M as e}from"./menu-BFlsiQIN.js";function i(){const s=n();return!s||s.showNavPane?null:a.jsx(o,{variant:"ghost",size:"sm",icon:a.jsx(e,{className:"size-4"}),onClick:s.openNav,"aria-label":"Open folders",className:"-ml-1 shrink-0"})}export{i as N};
1
+ import{v as n,j as a,f as o}from"./index-_JBKtYXu.js";import{M as e}from"./menu-CyMA8ejK.js";function i(){const s=n();return!s||s.showNavPane?null:a.jsx(o,{variant:"ghost",size:"sm",icon:a.jsx(e,{className:"size-4"}),onClick:s.openNav,"aria-label":"Open folders",className:"-ml-1 shrink-0"})}export{i as N};
@@ -1 +1 @@
1
- import{e as ie,r as t,j as e,h as ce,i as Z,o as le,av as de,c as q,aM as K,d as ee,f as k,L as _,B as H,aN as G,aw as ue,ax as $,n as me,I as pe}from"./index-Bp69o_hx.js";import{K as he}from"./kbd-Dlyb756r.js";import{c as fe,d as xe,s as U,W as L,C as D,g as ye,e as X,f as ge,h as ve,b as Se,R as be,a as W,S as je}from"./credential-steps-CgdDYYxA.js";import{c as we}from"./account-form-helpers-DhckT_PN.js";import{M as Ce}from"./mail-Az7LNkPT.js";import{F as ke}from"./file-json-CV0PVp51.js";const Q=ie("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]),te=[{id:"icloud",label:"iCloud",username:"full-email",imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},passwordHelp:{text:"iCloud requires an app-specific password, not your Apple ID password. Generate one under Sign-In & Security → App-Specific Passwords.",url:"https://support.apple.com/en-us/102654"}},{id:"yahoo",label:"Yahoo",username:"full-email",imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},passwordHelp:{text:"Yahoo requires an app password, not your login password. Generate one under Account Security.",url:"https://help.yahoo.com/kb/generate-manage-third-party-passwords-sln15241.html"}},{id:"aol",label:"AOL",username:"full-email",imap:{host:"imap.aol.com",port:993,security:"tls"},smtp:{host:"smtp.aol.com",port:465,security:"tls"},passwordHelp:{text:"AOL requires an app password, not your login password. Generate one under Account Security.",url:"https://login.aol.com/account/security"}},{id:"fastmail",label:"Fastmail",username:"full-email",imap:{host:"imap.fastmail.com",port:993,security:"tls"},smtp:{host:"smtp.fastmail.com",port:465,security:"tls"},passwordHelp:{text:"Fastmail requires an app password, not your login password. Create one under Settings → Privacy & Security → App passwords.",url:"https://www.fastmail.help/hc/en-us/articles/360058752854"}}];function Y(a){return te.find(d=>d.id===a)}const Ee={"icloud.com":"icloud","me.com":"icloud","mac.com":"icloud","yahoo.com":"yahoo","yahoo.co.uk":"yahoo","ymail.com":"yahoo","aol.com":"aol","fastmail.com":"fastmail","fastmail.fm":"fastmail"};function Ne(a){const d=a.indexOf("@");if(d===-1)return"";const c=a.slice(d+1).toLowerCase();return Ee[c]??""}const T=["Connector","Address","Servers","Credentials","Test","Sync"],A={connector:0,address:1,servers:2,credentials:3,test:4,sync:5},V={host:"",port:993,security:"tls"},J={host:"",port:587,security:"starttls"};function Pe({onStart:a,onImportConfig:d}){return t.useEffect(()=>{const c=p=>{p.key==="Enter"&&a()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[a]),e.jsx(L,{steps:T,activeStep:0,hideSteps:!0,title:"Welcome to Remit",subtitle:d?"Set up your first account, or bring the settings from another Reader.":"One inbox for all your mail, with context about every message.",footer:e.jsxs(e.Fragment,{children:[d?e.jsx(k,{variant:"secondary",icon:e.jsx(ke,{className:"size-4"}),onClick:d,children:"Import a config file"}):e.jsxs("span",{className:"text-2xs text-fg-subtle",children:[e.jsx(he,{children:"Enter"})," to continue"]}),e.jsx(k,{variant:"primary",onClick:a,children:"Add your first account"})]}),children:e.jsxs("div",{className:"flex flex-col items-start py-5",children:[e.jsx("span",{className:"flex size-14 items-center justify-center rounded-md bg-accent-soft",children:e.jsx(Ce,{className:"size-7 text-accent"})}),e.jsx("p",{className:"mt-5 max-w-sm text-sm leading-relaxed text-fg-muted",children:"Remit syncs your existing mailboxes and tells you who is really writing to you — sender history, authenticity checks, and similar messages, right next to every email."}),d&&e.jsx("p",{className:"mt-3 max-w-sm text-sm leading-relaxed text-fg-muted",children:"A config file carries your accounts, folder roles, rules, flagged senders and appearance from another Reader. It never carries passwords, so you sign in again here."})]})})}function Te({onContinue:a,onMicrosoft:d,onBack:c,showBack:p}){const[h,o]=t.useState("imap");t.useEffect(()=>{const y=i=>{i.key==="Enter"&&(h==="microsoft"?d():a()),i.key==="Escape"&&c()};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[a,d,c,h]);const n=()=>{h==="microsoft"?d():a()};return e.jsx(L,{steps:T,activeStep:A.connector,title:"How does this account connect?",subtitle:"Choose a sign-in method. IMAP works with any provider.",footer:e.jsxs(e.Fragment,{children:[p?e.jsx(k,{variant:"ghost",onClick:c,children:"Back"}):e.jsx("span",{}),e.jsx(k,{variant:"primary",onClick:n,children:h==="microsoft"?"Continue with Microsoft":"Continue with IMAP"})]}),children:e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[e.jsx(W,{name:"IMAP / SMTP",description:"Any mail provider — Fastmail, iCloud, your own server.",icon:e.jsx(je,{className:"size-5"}),selected:h==="imap",onSelect:()=>o("imap")}),e.jsx(W,{name:"Gmail",description:"Sign in with Google. No app passwords.",icon:e.jsx(Q,{className:"size-5"}),comingSoon:!0}),e.jsx(W,{name:"Outlook / Microsoft 365",description:"Sign in with Microsoft. Works with Outlook.com and work accounts.",icon:e.jsx(pe,{className:"size-5"}),selected:h==="microsoft",onSelect:()=>o("microsoft")})]})})}function Ae({onBack:a,onConnected:d}){const[c,p]=t.useState(""),[h,o]=t.useState(null),[n,y]=t.useState(!1),[i,g]=t.useState(!1),v=t.useRef(!0);t.useEffect(()=>(v.current=!0,()=>{v.current=!1}),[]);const E=t.useRef(new Set),{refetch:w}=q(ee()),j=Se(r=>{if(g(!1),r==="stalled"){y(!1),o(be);return}w().then(({data:u,isError:N})=>{if(!v.current)return;if(N||!u){o("Couldn't check whether the sign-in finished. Open Settings › Accounts to see whether the account is connected.");return}o(null);const C=u.accounts.find(P=>!E.current.has(P.accountId));C&&d(C.accountId)})}),S=Z({...me(),onSuccess:r=>{v.current&&(j(),y(!0),window.location.assign(r.authorizationUrl))},onError:r=>{g(!1),o(r instanceof Error?r.message:"Failed to start sign-in")}}),l=i||S.isPending,f=()=>{l||(o(null),g(!0),w().then(({data:r,isError:u})=>{if(v.current){if(u||!r){g(!1),o("Couldn't read this instance's accounts, so sign-in can't be tracked. Check your connection and try again.");return}E.current=new Set(r.accounts.map(N=>N.accountId)),S.mutate({body:{email:c.trim()||void 0}})}}))},x=t.useRef(f);return x.current=f,t.useEffect(()=>{const r=u=>{u.key==="Enter"&&x.current(),u.key==="Escape"&&a()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[a]),e.jsx(L,{steps:T,activeStep:A.connector,title:"Sign in with Microsoft",subtitle:"You'll be redirected to Microsoft to sign in securely.",footer:e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"ghost",onClick:a,children:"Back"}),e.jsx(k,{variant:"primary",onClick:f,disabled:l,icon:l?e.jsx(_,{className:"size-4 animate-spin"}):void 0,children:l?"Redirecting…":n?"Start over":"Sign in with Microsoft"})]}),children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(G,{htmlFor:"microsoft-email",children:"Email address (optional)"}),e.jsx($,{id:"microsoft-email",icon:e.jsx(Q,{className:"size-4"}),placeholder:"you@outlook.com",value:c,onChange:r=>p(r.target.value),type:"email",autoComplete:"email"}),e.jsx("p",{className:"mt-1.5 text-2xs text-fg-subtle",children:"Pre-fills the Microsoft sign-in form. Leave blank to choose on the Microsoft page."})]}),n&&e.jsx(H,{tone:"info",children:"Waiting for Microsoft. Finish signing in — this window carries on the moment the account is connected, wherever you finished."}),h&&e.jsx(H,{tone:"danger",children:h})]})})}function Me({initialEmail:a,initialDisplayName:d,onContinue:c,onBack:p}){const[h,o]=t.useState(a),[n,y]=t.useState(d),[i,g]=t.useState(!1),[v,E]=t.useState(""),[w,j]=t.useState(null),S=t.useCallback(async()=>{const l=h.trim();if(!l.includes("@")||!l.includes(".")){j("Enter a valid email address.");return}j(null),g(!0),E(ge(l));try{const f=await ve(l);c(l,n.trim(),f)}finally{g(!1)}},[h,n,c]);return t.useEffect(()=>{const l=f=>{f.key==="Enter"&&!i&&S(),f.key==="Escape"&&p()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[S,i,p]),e.jsx(L,{steps:T,activeStep:A.address,title:"What's the email address?",subtitle:"We'll detect the server settings for you.",footer:e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"ghost",onClick:p,children:"Back"}),e.jsx(k,{variant:"primary",disabled:i,onClick:()=>{S()},children:"Continue"})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(G,{htmlFor:"onboarding-email",children:"Email address"}),e.jsx($,{id:"onboarding-email",icon:e.jsx(Q,{className:"size-4"}),placeholder:"you@example.com",value:h,onChange:l=>{o(l.target.value),j(null)},type:"email",autoComplete:"email"})]}),e.jsxs("div",{children:[e.jsx(G,{htmlFor:"onboarding-display-name",children:"Display name (optional)"}),e.jsx($,{id:"onboarding-display-name",placeholder:"Alice",value:n,onChange:l=>y(l.target.value)}),e.jsx("p",{className:"mt-1.5 text-2xs text-fg-subtle",children:"What to call this account in Remit. Leave blank to use a name derived from the address."})]}),i&&e.jsxs("div",{className:"mt-3 flex items-center gap-2 text-xs text-fg-muted",children:[e.jsx(_,{className:"size-3.5 animate-spin text-accent"}),v]}),w&&!i&&e.jsx("div",{className:"mt-3",children:e.jsx(H,{tone:"danger",children:w})})]})})}function Ie({email:a,imapConfig:d,smtpConfig:c,discovered:p,onContinue:h,onBack:o,onChange:n}){const[y,i]=t.useState(d),[g,v]=t.useState(c),[E,w]=t.useState(()=>Ne(a)),[j,S]=t.useState(!1),[l,f]=t.useState(null),x=Y(E),r=x!==void 0&&!j,u=t.useCallback(m=>{w(m),S(!1),f(null);const s=Y(m);s&&(i({host:s.imap.host,port:s.imap.port,security:s.imap.security}),v({host:s.smtp.host,port:s.smtp.port,security:s.smtp.security}))},[]);t.useEffect(()=>{n(y,g)},[y,g,n]);const N=y.host.trim()!=="",C=t.useCallback(()=>{if(!N){f("Enter the IMAP host.");return}f(null),h()},[N,h]);t.useEffect(()=>{const m=s=>{s.key==="Enter"&&C(),s.key==="Escape"&&o()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[C,o]);const P=a.split("@")[1]??"your domain",F=x?"Pick your provider to fill in the right settings — or choose Custom to enter them by hand.":p?"Found via autodiscovery — adjust anything that looks off.":`We couldn't detect settings for ${P} — enter them manually.`,M=r?{label:"preset",tone:"neutral"}:!x&&p?{label:"detected",tone:"positive"}:void 0,I=x?.passwordHelp.url??ye(a);return e.jsx(L,{steps:T,activeStep:A.servers,title:"Confirm server settings",subtitle:F,footer:e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"ghost",onClick:o,children:"Back"}),e.jsx(k,{variant:"primary",onClick:C,children:"Continue"})]}),children:e.jsxs("div",{className:"space-y-5",children:[l&&e.jsx(H,{tone:"danger",children:l}),e.jsxs("div",{children:[e.jsx(G,{htmlFor:"provider-select",children:"Provider"}),e.jsxs(ue,{id:"provider-select",value:E,onChange:m=>u(m.target.value),children:[e.jsx("option",{value:"",children:"Custom / other"}),te.map(m=>e.jsx("option",{value:m.id,children:m.label},m.id))]}),x&&e.jsx("p",{className:"mt-1 text-2xs text-fg-subtle",children:r?e.jsxs(e.Fragment,{children:["Server settings are pre-filled for ",x.label," and locked."," ",e.jsx("button",{type:"button",className:"text-accent underline",onClick:()=>S(!0),children:"Advanced"})," ","lets you edit them by hand."]}):e.jsxs(e.Fragment,{children:["Editing ",x.label,"'s settings by hand."]})})]}),e.jsx(X,{legend:"IMAP — incoming",badge:M,readOnly:r,host:y.host,port:String(y.port),security:y.security,hostPlaceholder:"imap.example.com",portPlaceholder:"993",onHostChange:m=>{i(s=>({...s,host:m})),f(null)},onPortChange:m=>i(s=>({...s,port:Number(m)})),onSecurityChange:m=>i(s=>({...s,security:m}))}),e.jsx("p",{className:"text-2xs text-fg-subtle",children:"Sending (SMTP) is optional — leave it blank to set up a receive-only account and add sending later in Settings."}),e.jsx(X,{legend:"SMTP — outgoing (optional)",badge:M,readOnly:r,host:g.host,port:String(g.port),security:g.security,hostPlaceholder:"smtp.example.com",portPlaceholder:"587",onHostChange:m=>{v(s=>({...s,host:m})),f(null)},onPortChange:m=>v(s=>({...s,port:Number(m)})),onSecurityChange:m=>v(s=>({...s,security:m}))}),x&&e.jsxs("p",{className:"text-2xs text-fg-subtle",children:[x.passwordHelp.text," ",I&&e.jsx("a",{href:I,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"Get an app password"})]})]})})}const Le=2e4;function Fe({email:a,displayName:d,imapConfig:c,smtpConfig:p,username:h,password:o,onGoToInbox:n}){const y=ce(),[i,g]=t.useState(null),[v,E]=t.useState(null),w=t.useRef(!1),j=U(c.security),S=U(p.security),l=Z({...de(),onSuccess:b=>{g(b.accountId),y.invalidateQueries({queryKey:le()})},onError:b=>{E(b instanceof Error?b.message:"Failed to create account")}});t.useEffect(()=>{if(w.current)return;w.current=!0;const b=p.host.trim()!=="",R=we({imapHost:c.host,smtpHost:p.host,smtpPort:p.port}),O=b?R??{smtpHost:p.host,smtpPort:p.port,smtpTls:S.tls,smtpStartTls:S.startTls}:null;l.mutate({body:{email:a,displayName:d||void 0,username:h!==a?h:void 0,password:o,imapHost:c.host,imapPort:c.port,imapTls:j.tls,imapStartTls:j.startTls,smtpHost:O?.smtpHost||void 0,smtpPort:O?.smtpPort||void 0,smtpTls:O?.smtpTls??!1,smtpStartTls:O?.smtpStartTls??!1}})},[]);const{data:f,isError:x}=q({...K({path:{accountId:i??""}}),enabled:!!i,refetchInterval:b=>{const R=b.state.data?.syncPhase;return R==="complete"||R==="error"?!1:2e3}}),r=f?.syncPhase==="error",{data:u}=q({...ee(),enabled:!!i&&r}),N=u?.accounts.find(b=>b.accountId===i)?.lastError,C=f?.mailboxes.find(b=>b.fullPath==="INBOX"||b.fullPath==="Inbox"),P=f?.mailboxCountTotal??0,F=f?.mailboxCountSynced??0,M=C?.messagesTotal??0,I=C?.messagesSynced??0,m=M>0?I/M:0,s=f?.syncPhase,se=r?"failed":s==="idle"||s===void 0||s==="discovering_mailboxes"?"running":P>0?"ok":"running",z=r?"failed":!s||s==="idle"||s==="discovering_mailboxes"?"pending":s==="syncing_inbox"||s==="syncing_others"?"running":"ok",B=r?"failed":!s||s==="idle"||s==="discovering_mailboxes"||s==="syncing_inbox"?"pending":s==="syncing_others"?"running":"ok",ne=I>0||C?.phase==="complete"||s==="complete"||r,[ae,oe]=t.useState(!1);t.useEffect(()=>{if(!i)return;const b=setTimeout(()=>oe(!0),Le);return()=>clearTimeout(b)},[i]);const re=!!i&&(ne||x||ae);return v?e.jsx(L,{steps:T,activeStep:A.sync,title:"Couldn't create account",subtitle:"Something went wrong saving your account.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{}),e.jsx(k,{variant:"primary",onClick:()=>{w.current=!1,E(null),l.mutate({body:{email:a,displayName:d||void 0,username:h!==a?h:void 0,password:o,imapHost:c.host,imapPort:c.port,imapTls:j.tls,imapStartTls:j.startTls,smtpHost:p.host||void 0,smtpPort:p.port||void 0,smtpTls:S.tls,smtpStartTls:S.startTls}})},children:"Retry"})]}),children:e.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:v})}):e.jsx(L,{steps:T,activeStep:A.sync,title:`Syncing ${a}`,subtitle:"Newest mail first — you can start reading right away.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:"Sync continues in the background"}),re?e.jsx(k,{variant:"primary",onClick:()=>i&&n(i),children:"Go to inbox"}):e.jsx(k,{variant:"primary",disabled:!0,icon:e.jsx(_,{className:"size-3.5 animate-spin"}),children:"Getting your mail…"})]}),children:l.isPending?e.jsxs("div",{className:"flex items-center gap-2 py-4 text-sm text-fg-muted",children:[e.jsx(_,{className:"size-4 animate-spin text-accent"}),"Creating your account…"]}):e.jsxs("div",{className:"space-y-3",children:[M>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-baseline justify-between text-xs",children:[e.jsx("span",{className:"font-medium text-fg",children:"INBOX"}),e.jsxs("span",{className:"text-fg-subtle tabular-nums",children:[I.toLocaleString()," / ",M.toLocaleString()," ","messages"]})]}),e.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-surface-sunken",children:e.jsx("div",{className:"h-full rounded-full bg-accent transition-all duration-500",style:{width:`${Math.max(2,m*100)}%`}})})]}),e.jsxs("div",{className:"divide-y divide-line",children:[e.jsx(D,{label:"Mailboxes discovered",detail:P>0?`${P} mailbox${P===1?"":"es"} found`:"Discovering…",state:se}),e.jsx(D,{label:"INBOX",detail:z==="ok"?`${I.toLocaleString()} messages synced`:z==="running"?"Syncing newest first…":"Queued",state:z}),F>1||s==="syncing_others"||s==="complete"?e.jsx(D,{label:"Other mailboxes",detail:B==="ok"?`${F-1} mailboxes synced`:B==="running"?"Syncing…":"Queued",state:B}):null]}),r&&e.jsxs("div",{className:"mt-2 space-y-2",children:[e.jsxs("p",{className:"text-xs text-danger",children:["Sync stalled. The account is still active —"," ",e.jsx("button",{type:"button",className:"underline",onClick:()=>{y.invalidateQueries({queryKey:K({path:{accountId:i??""}}).queryKey})},children:"retry"})]}),N&&e.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:N})]})]})})}function Be({skipWelcome:a=!1,onComplete:d,onCancel:c,onImportConfig:p}){const[h,o]=t.useState(a?"connector":"welcome"),[n,y]=t.useState({email:"",displayName:"",imapConfig:V,smtpConfig:J,username:"",password:"",discoveryResult:null,discovered:!1,createdAccountId:null}),i=t.useCallback(()=>o("connector"),[]),g=t.useCallback(()=>o("address"),[]),v=t.useCallback(()=>o("microsoft-email"),[]),E=t.useCallback(()=>{a?c?.():o("welcome")},[a,c]),w=t.useCallback((x,r,u)=>{let N=V,C=J,P=!1;u&&(P=u.source!=="heuristic",N={host:u.imap.host,port:u.imap.port,security:u.imap.security},C={host:u.smtp.host,port:u.smtp.port,security:u.smtp.security}),y(F=>({...F,email:x,displayName:r,imapConfig:N,smtpConfig:C,discoveryResult:u,discovered:P,username:x})),o("servers")},[]),j=t.useCallback((x,r)=>{y(u=>({...u,imapConfig:x,smtpConfig:r}))},[]),S=t.useCallback((x,r)=>{y(u=>({...u,username:x,password:r}))},[]),l=t.useCallback(()=>o("sync"),[]),f=t.useCallback(x=>{d(x)},[d]);switch(h){case"welcome":return e.jsx(Pe,{onStart:i,onImportConfig:p});case"connector":return e.jsx(Te,{onContinue:g,onMicrosoft:v,onBack:E,showBack:!a});case"microsoft-email":return e.jsx(Ae,{onBack:()=>o("connector"),onConnected:f});case"address":return e.jsx(Me,{initialEmail:n.email,initialDisplayName:n.displayName,onContinue:w,onBack:()=>o("connector")});case"servers":return e.jsx(Ie,{email:n.email,imapConfig:n.imapConfig,smtpConfig:n.smtpConfig,discovered:n.discovered,onContinue:()=>o("credentials"),onBack:()=>o("address"),onChange:j});case"credentials":return e.jsx(xe,{steps:T,activeStep:A.credentials,title:`Sign in to ${n.email.split("@")[1]||"your mail server"}`,subtitle:"Many providers require an app password instead of your normal one.",email:n.email,username:n.username,password:n.password,onContinue:()=>o("test"),onBack:()=>o("servers"),onChange:S});case"test":return e.jsx(fe,{steps:T,activeStep:A.test,email:n.email,imapConfig:n.imapConfig,smtpConfig:n.smtpConfig,username:n.username,password:n.password,onSuccess:l,onBackToCredentials:()=>o("credentials"),onBackToServers:()=>o("servers")});case"sync":return e.jsx(Fe,{email:n.email,displayName:n.displayName,imapConfig:n.imapConfig,smtpConfig:n.smtpConfig,username:n.username,password:n.password,onGoToInbox:f})}}export{Be as O,te as P,Y as g};
1
+ import{e as ie,r as t,j as e,h as ce,i as Z,o as le,av as de,c as q,aM as K,d as ee,f as k,L as _,B as H,aN as G,aw as ue,ax as $,n as me,I as pe}from"./index-_JBKtYXu.js";import{K as he}from"./kbd-CUNCsdLt.js";import{c as fe,d as xe,s as U,W as L,C as D,g as ye,e as X,f as ge,h as ve,b as Se,R as be,a as W,S as je}from"./credential-steps-BPMPrFp_.js";import{c as we}from"./account-form-helpers-DhckT_PN.js";import{M as Ce}from"./mail-B73P70rO.js";import{F as ke}from"./file-json-DhoZdq39.js";const Q=ie("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]),te=[{id:"icloud",label:"iCloud",username:"full-email",imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},passwordHelp:{text:"iCloud requires an app-specific password, not your Apple ID password. Generate one under Sign-In & Security → App-Specific Passwords.",url:"https://support.apple.com/en-us/102654"}},{id:"yahoo",label:"Yahoo",username:"full-email",imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},passwordHelp:{text:"Yahoo requires an app password, not your login password. Generate one under Account Security.",url:"https://help.yahoo.com/kb/generate-manage-third-party-passwords-sln15241.html"}},{id:"aol",label:"AOL",username:"full-email",imap:{host:"imap.aol.com",port:993,security:"tls"},smtp:{host:"smtp.aol.com",port:465,security:"tls"},passwordHelp:{text:"AOL requires an app password, not your login password. Generate one under Account Security.",url:"https://login.aol.com/account/security"}},{id:"fastmail",label:"Fastmail",username:"full-email",imap:{host:"imap.fastmail.com",port:993,security:"tls"},smtp:{host:"smtp.fastmail.com",port:465,security:"tls"},passwordHelp:{text:"Fastmail requires an app password, not your login password. Create one under Settings → Privacy & Security → App passwords.",url:"https://www.fastmail.help/hc/en-us/articles/360058752854"}}];function Y(a){return te.find(d=>d.id===a)}const Ee={"icloud.com":"icloud","me.com":"icloud","mac.com":"icloud","yahoo.com":"yahoo","yahoo.co.uk":"yahoo","ymail.com":"yahoo","aol.com":"aol","fastmail.com":"fastmail","fastmail.fm":"fastmail"};function Ne(a){const d=a.indexOf("@");if(d===-1)return"";const c=a.slice(d+1).toLowerCase();return Ee[c]??""}const T=["Connector","Address","Servers","Credentials","Test","Sync"],A={connector:0,address:1,servers:2,credentials:3,test:4,sync:5},V={host:"",port:993,security:"tls"},J={host:"",port:587,security:"starttls"};function Pe({onStart:a,onImportConfig:d}){return t.useEffect(()=>{const c=p=>{p.key==="Enter"&&a()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[a]),e.jsx(L,{steps:T,activeStep:0,hideSteps:!0,title:"Welcome to Remit",subtitle:d?"Set up your first account, or bring the settings from another Reader.":"One inbox for all your mail, with context about every message.",footer:e.jsxs(e.Fragment,{children:[d?e.jsx(k,{variant:"secondary",icon:e.jsx(ke,{className:"size-4"}),onClick:d,children:"Import a config file"}):e.jsxs("span",{className:"text-2xs text-fg-subtle",children:[e.jsx(he,{children:"Enter"})," to continue"]}),e.jsx(k,{variant:"primary",onClick:a,children:"Add your first account"})]}),children:e.jsxs("div",{className:"flex flex-col items-start py-5",children:[e.jsx("span",{className:"flex size-14 items-center justify-center rounded-md bg-accent-soft",children:e.jsx(Ce,{className:"size-7 text-accent"})}),e.jsx("p",{className:"mt-5 max-w-sm text-sm leading-relaxed text-fg-muted",children:"Remit syncs your existing mailboxes and tells you who is really writing to you — sender history, authenticity checks, and similar messages, right next to every email."}),d&&e.jsx("p",{className:"mt-3 max-w-sm text-sm leading-relaxed text-fg-muted",children:"A config file carries your accounts, folder roles, rules, flagged senders and appearance from another Reader. It never carries passwords, so you sign in again here."})]})})}function Te({onContinue:a,onMicrosoft:d,onBack:c,showBack:p}){const[h,o]=t.useState("imap");t.useEffect(()=>{const y=i=>{i.key==="Enter"&&(h==="microsoft"?d():a()),i.key==="Escape"&&c()};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[a,d,c,h]);const n=()=>{h==="microsoft"?d():a()};return e.jsx(L,{steps:T,activeStep:A.connector,title:"How does this account connect?",subtitle:"Choose a sign-in method. IMAP works with any provider.",footer:e.jsxs(e.Fragment,{children:[p?e.jsx(k,{variant:"ghost",onClick:c,children:"Back"}):e.jsx("span",{}),e.jsx(k,{variant:"primary",onClick:n,children:h==="microsoft"?"Continue with Microsoft":"Continue with IMAP"})]}),children:e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[e.jsx(W,{name:"IMAP / SMTP",description:"Any mail provider — Fastmail, iCloud, your own server.",icon:e.jsx(je,{className:"size-5"}),selected:h==="imap",onSelect:()=>o("imap")}),e.jsx(W,{name:"Gmail",description:"Sign in with Google. No app passwords.",icon:e.jsx(Q,{className:"size-5"}),comingSoon:!0}),e.jsx(W,{name:"Outlook / Microsoft 365",description:"Sign in with Microsoft. Works with Outlook.com and work accounts.",icon:e.jsx(pe,{className:"size-5"}),selected:h==="microsoft",onSelect:()=>o("microsoft")})]})})}function Ae({onBack:a,onConnected:d}){const[c,p]=t.useState(""),[h,o]=t.useState(null),[n,y]=t.useState(!1),[i,g]=t.useState(!1),v=t.useRef(!0);t.useEffect(()=>(v.current=!0,()=>{v.current=!1}),[]);const E=t.useRef(new Set),{refetch:w}=q(ee()),j=Se(r=>{if(g(!1),r==="stalled"){y(!1),o(be);return}w().then(({data:u,isError:N})=>{if(!v.current)return;if(N||!u){o("Couldn't check whether the sign-in finished. Open Settings › Accounts to see whether the account is connected.");return}o(null);const C=u.accounts.find(P=>!E.current.has(P.accountId));C&&d(C.accountId)})}),S=Z({...me(),onSuccess:r=>{v.current&&(j(),y(!0),window.location.assign(r.authorizationUrl))},onError:r=>{g(!1),o(r instanceof Error?r.message:"Failed to start sign-in")}}),l=i||S.isPending,f=()=>{l||(o(null),g(!0),w().then(({data:r,isError:u})=>{if(v.current){if(u||!r){g(!1),o("Couldn't read this instance's accounts, so sign-in can't be tracked. Check your connection and try again.");return}E.current=new Set(r.accounts.map(N=>N.accountId)),S.mutate({body:{email:c.trim()||void 0}})}}))},x=t.useRef(f);return x.current=f,t.useEffect(()=>{const r=u=>{u.key==="Enter"&&x.current(),u.key==="Escape"&&a()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[a]),e.jsx(L,{steps:T,activeStep:A.connector,title:"Sign in with Microsoft",subtitle:"You'll be redirected to Microsoft to sign in securely.",footer:e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"ghost",onClick:a,children:"Back"}),e.jsx(k,{variant:"primary",onClick:f,disabled:l,icon:l?e.jsx(_,{className:"size-4 animate-spin"}):void 0,children:l?"Redirecting…":n?"Start over":"Sign in with Microsoft"})]}),children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(G,{htmlFor:"microsoft-email",children:"Email address (optional)"}),e.jsx($,{id:"microsoft-email",icon:e.jsx(Q,{className:"size-4"}),placeholder:"you@outlook.com",value:c,onChange:r=>p(r.target.value),type:"email",autoComplete:"email"}),e.jsx("p",{className:"mt-1.5 text-2xs text-fg-subtle",children:"Pre-fills the Microsoft sign-in form. Leave blank to choose on the Microsoft page."})]}),n&&e.jsx(H,{tone:"info",children:"Waiting for Microsoft. Finish signing in — this window carries on the moment the account is connected, wherever you finished."}),h&&e.jsx(H,{tone:"danger",children:h})]})})}function Me({initialEmail:a,initialDisplayName:d,onContinue:c,onBack:p}){const[h,o]=t.useState(a),[n,y]=t.useState(d),[i,g]=t.useState(!1),[v,E]=t.useState(""),[w,j]=t.useState(null),S=t.useCallback(async()=>{const l=h.trim();if(!l.includes("@")||!l.includes(".")){j("Enter a valid email address.");return}j(null),g(!0),E(ge(l));try{const f=await ve(l);c(l,n.trim(),f)}finally{g(!1)}},[h,n,c]);return t.useEffect(()=>{const l=f=>{f.key==="Enter"&&!i&&S(),f.key==="Escape"&&p()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[S,i,p]),e.jsx(L,{steps:T,activeStep:A.address,title:"What's the email address?",subtitle:"We'll detect the server settings for you.",footer:e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"ghost",onClick:p,children:"Back"}),e.jsx(k,{variant:"primary",disabled:i,onClick:()=>{S()},children:"Continue"})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(G,{htmlFor:"onboarding-email",children:"Email address"}),e.jsx($,{id:"onboarding-email",icon:e.jsx(Q,{className:"size-4"}),placeholder:"you@example.com",value:h,onChange:l=>{o(l.target.value),j(null)},type:"email",autoComplete:"email"})]}),e.jsxs("div",{children:[e.jsx(G,{htmlFor:"onboarding-display-name",children:"Display name (optional)"}),e.jsx($,{id:"onboarding-display-name",placeholder:"Alice",value:n,onChange:l=>y(l.target.value)}),e.jsx("p",{className:"mt-1.5 text-2xs text-fg-subtle",children:"What to call this account in Remit. Leave blank to use a name derived from the address."})]}),i&&e.jsxs("div",{className:"mt-3 flex items-center gap-2 text-xs text-fg-muted",children:[e.jsx(_,{className:"size-3.5 animate-spin text-accent"}),v]}),w&&!i&&e.jsx("div",{className:"mt-3",children:e.jsx(H,{tone:"danger",children:w})})]})})}function Ie({email:a,imapConfig:d,smtpConfig:c,discovered:p,onContinue:h,onBack:o,onChange:n}){const[y,i]=t.useState(d),[g,v]=t.useState(c),[E,w]=t.useState(()=>Ne(a)),[j,S]=t.useState(!1),[l,f]=t.useState(null),x=Y(E),r=x!==void 0&&!j,u=t.useCallback(m=>{w(m),S(!1),f(null);const s=Y(m);s&&(i({host:s.imap.host,port:s.imap.port,security:s.imap.security}),v({host:s.smtp.host,port:s.smtp.port,security:s.smtp.security}))},[]);t.useEffect(()=>{n(y,g)},[y,g,n]);const N=y.host.trim()!=="",C=t.useCallback(()=>{if(!N){f("Enter the IMAP host.");return}f(null),h()},[N,h]);t.useEffect(()=>{const m=s=>{s.key==="Enter"&&C(),s.key==="Escape"&&o()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[C,o]);const P=a.split("@")[1]??"your domain",F=x?"Pick your provider to fill in the right settings — or choose Custom to enter them by hand.":p?"Found via autodiscovery — adjust anything that looks off.":`We couldn't detect settings for ${P} — enter them manually.`,M=r?{label:"preset",tone:"neutral"}:!x&&p?{label:"detected",tone:"positive"}:void 0,I=x?.passwordHelp.url??ye(a);return e.jsx(L,{steps:T,activeStep:A.servers,title:"Confirm server settings",subtitle:F,footer:e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"ghost",onClick:o,children:"Back"}),e.jsx(k,{variant:"primary",onClick:C,children:"Continue"})]}),children:e.jsxs("div",{className:"space-y-5",children:[l&&e.jsx(H,{tone:"danger",children:l}),e.jsxs("div",{children:[e.jsx(G,{htmlFor:"provider-select",children:"Provider"}),e.jsxs(ue,{id:"provider-select",value:E,onChange:m=>u(m.target.value),children:[e.jsx("option",{value:"",children:"Custom / other"}),te.map(m=>e.jsx("option",{value:m.id,children:m.label},m.id))]}),x&&e.jsx("p",{className:"mt-1 text-2xs text-fg-subtle",children:r?e.jsxs(e.Fragment,{children:["Server settings are pre-filled for ",x.label," and locked."," ",e.jsx("button",{type:"button",className:"text-accent underline",onClick:()=>S(!0),children:"Advanced"})," ","lets you edit them by hand."]}):e.jsxs(e.Fragment,{children:["Editing ",x.label,"'s settings by hand."]})})]}),e.jsx(X,{legend:"IMAP — incoming",badge:M,readOnly:r,host:y.host,port:String(y.port),security:y.security,hostPlaceholder:"imap.example.com",portPlaceholder:"993",onHostChange:m=>{i(s=>({...s,host:m})),f(null)},onPortChange:m=>i(s=>({...s,port:Number(m)})),onSecurityChange:m=>i(s=>({...s,security:m}))}),e.jsx("p",{className:"text-2xs text-fg-subtle",children:"Sending (SMTP) is optional — leave it blank to set up a receive-only account and add sending later in Settings."}),e.jsx(X,{legend:"SMTP — outgoing (optional)",badge:M,readOnly:r,host:g.host,port:String(g.port),security:g.security,hostPlaceholder:"smtp.example.com",portPlaceholder:"587",onHostChange:m=>{v(s=>({...s,host:m})),f(null)},onPortChange:m=>v(s=>({...s,port:Number(m)})),onSecurityChange:m=>v(s=>({...s,security:m}))}),x&&e.jsxs("p",{className:"text-2xs text-fg-subtle",children:[x.passwordHelp.text," ",I&&e.jsx("a",{href:I,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"Get an app password"})]})]})})}const Le=2e4;function Fe({email:a,displayName:d,imapConfig:c,smtpConfig:p,username:h,password:o,onGoToInbox:n}){const y=ce(),[i,g]=t.useState(null),[v,E]=t.useState(null),w=t.useRef(!1),j=U(c.security),S=U(p.security),l=Z({...de(),onSuccess:b=>{g(b.accountId),y.invalidateQueries({queryKey:le()})},onError:b=>{E(b instanceof Error?b.message:"Failed to create account")}});t.useEffect(()=>{if(w.current)return;w.current=!0;const b=p.host.trim()!=="",R=we({imapHost:c.host,smtpHost:p.host,smtpPort:p.port}),O=b?R??{smtpHost:p.host,smtpPort:p.port,smtpTls:S.tls,smtpStartTls:S.startTls}:null;l.mutate({body:{email:a,displayName:d||void 0,username:h!==a?h:void 0,password:o,imapHost:c.host,imapPort:c.port,imapTls:j.tls,imapStartTls:j.startTls,smtpHost:O?.smtpHost||void 0,smtpPort:O?.smtpPort||void 0,smtpTls:O?.smtpTls??!1,smtpStartTls:O?.smtpStartTls??!1}})},[]);const{data:f,isError:x}=q({...K({path:{accountId:i??""}}),enabled:!!i,refetchInterval:b=>{const R=b.state.data?.syncPhase;return R==="complete"||R==="error"?!1:2e3}}),r=f?.syncPhase==="error",{data:u}=q({...ee(),enabled:!!i&&r}),N=u?.accounts.find(b=>b.accountId===i)?.lastError,C=f?.mailboxes.find(b=>b.fullPath==="INBOX"||b.fullPath==="Inbox"),P=f?.mailboxCountTotal??0,F=f?.mailboxCountSynced??0,M=C?.messagesTotal??0,I=C?.messagesSynced??0,m=M>0?I/M:0,s=f?.syncPhase,se=r?"failed":s==="idle"||s===void 0||s==="discovering_mailboxes"?"running":P>0?"ok":"running",z=r?"failed":!s||s==="idle"||s==="discovering_mailboxes"?"pending":s==="syncing_inbox"||s==="syncing_others"?"running":"ok",B=r?"failed":!s||s==="idle"||s==="discovering_mailboxes"||s==="syncing_inbox"?"pending":s==="syncing_others"?"running":"ok",ne=I>0||C?.phase==="complete"||s==="complete"||r,[ae,oe]=t.useState(!1);t.useEffect(()=>{if(!i)return;const b=setTimeout(()=>oe(!0),Le);return()=>clearTimeout(b)},[i]);const re=!!i&&(ne||x||ae);return v?e.jsx(L,{steps:T,activeStep:A.sync,title:"Couldn't create account",subtitle:"Something went wrong saving your account.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{}),e.jsx(k,{variant:"primary",onClick:()=>{w.current=!1,E(null),l.mutate({body:{email:a,displayName:d||void 0,username:h!==a?h:void 0,password:o,imapHost:c.host,imapPort:c.port,imapTls:j.tls,imapStartTls:j.startTls,smtpHost:p.host||void 0,smtpPort:p.port||void 0,smtpTls:S.tls,smtpStartTls:S.startTls}})},children:"Retry"})]}),children:e.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:v})}):e.jsx(L,{steps:T,activeStep:A.sync,title:`Syncing ${a}`,subtitle:"Newest mail first — you can start reading right away.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:"Sync continues in the background"}),re?e.jsx(k,{variant:"primary",onClick:()=>i&&n(i),children:"Go to inbox"}):e.jsx(k,{variant:"primary",disabled:!0,icon:e.jsx(_,{className:"size-3.5 animate-spin"}),children:"Getting your mail…"})]}),children:l.isPending?e.jsxs("div",{className:"flex items-center gap-2 py-4 text-sm text-fg-muted",children:[e.jsx(_,{className:"size-4 animate-spin text-accent"}),"Creating your account…"]}):e.jsxs("div",{className:"space-y-3",children:[M>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-baseline justify-between text-xs",children:[e.jsx("span",{className:"font-medium text-fg",children:"INBOX"}),e.jsxs("span",{className:"text-fg-subtle tabular-nums",children:[I.toLocaleString()," / ",M.toLocaleString()," ","messages"]})]}),e.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-surface-sunken",children:e.jsx("div",{className:"h-full rounded-full bg-accent transition-all duration-500",style:{width:`${Math.max(2,m*100)}%`}})})]}),e.jsxs("div",{className:"divide-y divide-line",children:[e.jsx(D,{label:"Mailboxes discovered",detail:P>0?`${P} mailbox${P===1?"":"es"} found`:"Discovering…",state:se}),e.jsx(D,{label:"INBOX",detail:z==="ok"?`${I.toLocaleString()} messages synced`:z==="running"?"Syncing newest first…":"Queued",state:z}),F>1||s==="syncing_others"||s==="complete"?e.jsx(D,{label:"Other mailboxes",detail:B==="ok"?`${F-1} mailboxes synced`:B==="running"?"Syncing…":"Queued",state:B}):null]}),r&&e.jsxs("div",{className:"mt-2 space-y-2",children:[e.jsxs("p",{className:"text-xs text-danger",children:["Sync stalled. The account is still active —"," ",e.jsx("button",{type:"button",className:"underline",onClick:()=>{y.invalidateQueries({queryKey:K({path:{accountId:i??""}}).queryKey})},children:"retry"})]}),N&&e.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:N})]})]})})}function Be({skipWelcome:a=!1,onComplete:d,onCancel:c,onImportConfig:p}){const[h,o]=t.useState(a?"connector":"welcome"),[n,y]=t.useState({email:"",displayName:"",imapConfig:V,smtpConfig:J,username:"",password:"",discoveryResult:null,discovered:!1,createdAccountId:null}),i=t.useCallback(()=>o("connector"),[]),g=t.useCallback(()=>o("address"),[]),v=t.useCallback(()=>o("microsoft-email"),[]),E=t.useCallback(()=>{a?c?.():o("welcome")},[a,c]),w=t.useCallback((x,r,u)=>{let N=V,C=J,P=!1;u&&(P=u.source!=="heuristic",N={host:u.imap.host,port:u.imap.port,security:u.imap.security},C={host:u.smtp.host,port:u.smtp.port,security:u.smtp.security}),y(F=>({...F,email:x,displayName:r,imapConfig:N,smtpConfig:C,discoveryResult:u,discovered:P,username:x})),o("servers")},[]),j=t.useCallback((x,r)=>{y(u=>({...u,imapConfig:x,smtpConfig:r}))},[]),S=t.useCallback((x,r)=>{y(u=>({...u,username:x,password:r}))},[]),l=t.useCallback(()=>o("sync"),[]),f=t.useCallback(x=>{d(x)},[d]);switch(h){case"welcome":return e.jsx(Pe,{onStart:i,onImportConfig:p});case"connector":return e.jsx(Te,{onContinue:g,onMicrosoft:v,onBack:E,showBack:!a});case"microsoft-email":return e.jsx(Ae,{onBack:()=>o("connector"),onConnected:f});case"address":return e.jsx(Me,{initialEmail:n.email,initialDisplayName:n.displayName,onContinue:w,onBack:()=>o("connector")});case"servers":return e.jsx(Ie,{email:n.email,imapConfig:n.imapConfig,smtpConfig:n.smtpConfig,discovered:n.discovered,onContinue:()=>o("credentials"),onBack:()=>o("address"),onChange:j});case"credentials":return e.jsx(xe,{steps:T,activeStep:A.credentials,title:`Sign in to ${n.email.split("@")[1]||"your mail server"}`,subtitle:"Many providers require an app password instead of your normal one.",email:n.email,username:n.username,password:n.password,onContinue:()=>o("test"),onBack:()=>o("servers"),onChange:S});case"test":return e.jsx(fe,{steps:T,activeStep:A.test,email:n.email,imapConfig:n.imapConfig,smtpConfig:n.smtpConfig,username:n.username,password:n.password,onSuccess:l,onBackToCredentials:()=>o("credentials"),onBackToServers:()=>o("servers")});case"sync":return e.jsx(Fe,{email:n.email,displayName:n.displayName,imapConfig:n.imapConfig,smtpConfig:n.smtpConfig,username:n.username,password:n.password,onGoToInbox:f})}}export{Be as O,te as P,Y as g};
@@ -1,2 +1,2 @@
1
- import{j as e,t as h,f as S,a1 as _,X as K,c as Q,em as V,s as X,U as H,Z as J,r as C}from"./index-Bp69o_hx.js";import{u as ee,t as se,C as te,d as ae,p as ne}from"./CalendarComposePane-CAOF-nPv.js";import{c as re,R as ie}from"./calendar-color-DMot25jS.js";import{R as oe,A as le}from"./attendee-row-9sT7DjwF.js";import{C as ce}from"./clock-DUYaqtJD.js";import{G as Z,M as de}from"./map-pin-sKE11Ose.js";import{M as xe}from"./mail-Az7LNkPT.js";import{P as me}from"./pencil-D2kQNShx.js";import{u as fe,c as ue,U as he}from"./useCalendars-zHPvsPN-.js";import{c as pe}from"./useCalendarData-B5J45tWv.js";import{u as ge,b as ve}from"./window-Wb6AhZ1T.js";function v({icon:s,children:t}){return e.jsxs("div",{className:"flex items-start gap-2.5 py-1",children:[e.jsx("span",{className:"mt-0.5 shrink-0 text-fg-subtle",children:s}),e.jsx("div",{className:"min-w-0 flex-1 text-sm text-fg",children:t})]})}function be({event:s,calendar:t,whenText:n,onEdit:a,onDelete:o,onOpenThread:l,onClose:c,activeAttendee:x="",onActivateAttendee:b,renderAttendeeContext:k,touch:E=!1,chrome:D="header",className:r}){const R=re(t.color),d=e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-xl font-semibold text-fg",children:s.title}),e.jsxs("div",{className:"mt-3 flex flex-col border-b border-line pb-3",children:[e.jsx(v,{icon:e.jsx(ce,{className:"size-4"}),children:e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[n,s.attendees.length>0&&e.jsx(oe,{rsvp:s.myRsvp})]})}),s.zoneCertainty==="ambiguous"?e.jsx(v,{icon:e.jsx(Z,{className:"size-4 text-warning"}),children:e.jsx("span",{className:"text-warning",children:"The mail said a time but never a zone. Shown in your own; confirm before you travel for it."})}):s.timeZone!==""&&e.jsx(v,{icon:e.jsx(Z,{className:"size-4"}),children:s.timeZone}),s.recurrenceRule!==""&&e.jsx(v,{icon:e.jsx(ie,{className:"size-4"}),children:e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[s.recurrenceRule,s.seriesException&&e.jsx("span",{className:"rounded-xs bg-warning-soft px-1.5 py-0.5 text-2xs text-warning",children:"Moved out of the series"})]})}),s.location!==""&&e.jsx(v,{icon:e.jsx(de,{className:"size-4"}),children:s.location})]}),s.threadId!==""&&l&&e.jsxs("button",{type:"button",onClick:l,className:"mt-3 flex w-full items-center gap-2.5 rounded-md border border-line bg-surface-sunken px-3 py-2 text-left outline-none hover:border-line-strong focus-visible:ring-2 focus-visible:ring-ring",children:[e.jsx(xe,{className:"size-4 shrink-0 text-accent-2"}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-2xs uppercase tracking-wider text-fg-subtle",children:"From this thread"}),e.jsx("span",{className:"block truncate text-sm text-fg",children:s.threadSubject})]})]}),s.attendees.length>0&&e.jsx(le,{attendees:s.attendees,activeEmail:x,onActivate:b,renderContext:k,touch:E,className:"mt-3"}),s.notes!==""&&e.jsx("p",{className:"mt-3 whitespace-pre-wrap text-sm text-fg-muted",children:s.notes})]});return D==="bare"?e.jsx("div",{className:h("flex flex-col",r),children:d}):e.jsxs("article",{className:h("flex h-full w-full flex-col bg-surface",r),children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[e.jsx("span",{className:h("size-2.5 shrink-0 rounded-full",R.solid)}),e.jsxs("span",{className:"min-w-0 flex-1 truncate text-xs text-fg-muted",children:[t.name," · ",t.accountLabel]}),a&&e.jsx(S,{variant:"ghost",size:"sm",icon:e.jsx(me,{className:"size-3.5"}),onClick:a,children:"Edit"}),o&&e.jsx(S,{variant:"ghost",size:"sm",icon:e.jsx(_,{className:"size-3.5"}),onClick:o,className:"text-danger",children:"Delete"}),c&&e.jsx("button",{type:"button","aria-label":"Close event",onClick:c,className:"flex size-7 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",children:e.jsx(K,{className:"size-4"})})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-row-inset py-3",children:d})]})}const je=[{scope:"this",label:"This event",note:"Leaves the rest of the series alone"},{scope:"following",label:"This and everything after",note:"Splits the series here"},{scope:"all",label:"The whole series",note:"Rewrites the rule itself"}];function Ne({title:s,ruleText:t,instanceText:n,onChoose:a,onCancel:o,touch:l,className:c}){return e.jsxs("div",{className:h("flex flex-col gap-3",c),children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-md font-semibold text-fg",children:[s," repeats"]}),e.jsx("p",{className:"text-xs text-fg-muted",children:t}),e.jsxs("p",{className:"text-xs text-fg-subtle",children:["You clicked ",n,"."]})]}),e.jsx("p",{className:"text-sm text-fg",children:"What should the change apply to?"}),e.jsx("div",{className:"flex flex-col gap-1.5",children:je.map(x=>e.jsxs("button",{type:"button",onClick:()=>a(x.scope),className:h("flex flex-col rounded-md border border-line bg-surface px-3 py-2 text-left outline-none transition-colors hover:border-line-strong hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",l&&"min-h-11 justify-center"),children:[e.jsx("span",{className:"text-sm font-medium text-fg",children:x.label}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:x.note})]},x.scope))}),e.jsx(S,{variant:"ghost",size:l?"md":"sm",onClick:o,className:h("self-start",l&&"min-h-11"),children:"Cancel"})]})}const we=s=>s.replace(/\r?\n[ \t]/g,""),B=s=>s.replace(/\\n/gi,`
1
+ import{j as e,t as h,f as S,a1 as _,X as K,c as Q,en as V,s as X,U as H,Z as J,r as C}from"./index-_JBKtYXu.js";import{u as ee,t as se,C as te,d as ae,p as ne}from"./CalendarComposePane-CsWkzDBi.js";import{c as re,R as ie}from"./calendar-color-BG7928-_.js";import{R as oe,A as le}from"./attendee-row-BeKlhe0A.js";import{C as ce}from"./clock-DycMqInq.js";import{G as Z,M as de}from"./map-pin-CEP5uZHA.js";import{M as xe}from"./mail-B73P70rO.js";import{P as me}from"./pencil-C8wWVDp1.js";import{u as fe,c as ue,U as he}from"./useCalendars-dRe0PNET.js";import{c as pe}from"./useCalendarData-CxT_7y0k.js";import{u as ge,b as ve}from"./window-CT3glB3e.js";function v({icon:s,children:t}){return e.jsxs("div",{className:"flex items-start gap-2.5 py-1",children:[e.jsx("span",{className:"mt-0.5 shrink-0 text-fg-subtle",children:s}),e.jsx("div",{className:"min-w-0 flex-1 text-sm text-fg",children:t})]})}function be({event:s,calendar:t,whenText:n,onEdit:a,onDelete:o,onOpenThread:l,onClose:c,activeAttendee:x="",onActivateAttendee:b,renderAttendeeContext:k,touch:E=!1,chrome:D="header",className:r}){const R=re(t.color),d=e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-xl font-semibold text-fg",children:s.title}),e.jsxs("div",{className:"mt-3 flex flex-col border-b border-line pb-3",children:[e.jsx(v,{icon:e.jsx(ce,{className:"size-4"}),children:e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[n,s.attendees.length>0&&e.jsx(oe,{rsvp:s.myRsvp})]})}),s.zoneCertainty==="ambiguous"?e.jsx(v,{icon:e.jsx(Z,{className:"size-4 text-warning"}),children:e.jsx("span",{className:"text-warning",children:"The mail said a time but never a zone. Shown in your own; confirm before you travel for it."})}):s.timeZone!==""&&e.jsx(v,{icon:e.jsx(Z,{className:"size-4"}),children:s.timeZone}),s.recurrenceRule!==""&&e.jsx(v,{icon:e.jsx(ie,{className:"size-4"}),children:e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[s.recurrenceRule,s.seriesException&&e.jsx("span",{className:"rounded-xs bg-warning-soft px-1.5 py-0.5 text-2xs text-warning",children:"Moved out of the series"})]})}),s.location!==""&&e.jsx(v,{icon:e.jsx(de,{className:"size-4"}),children:s.location})]}),s.threadId!==""&&l&&e.jsxs("button",{type:"button",onClick:l,className:"mt-3 flex w-full items-center gap-2.5 rounded-md border border-line bg-surface-sunken px-3 py-2 text-left outline-none hover:border-line-strong focus-visible:ring-2 focus-visible:ring-ring",children:[e.jsx(xe,{className:"size-4 shrink-0 text-accent-2"}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-2xs uppercase tracking-wider text-fg-subtle",children:"From this thread"}),e.jsx("span",{className:"block truncate text-sm text-fg",children:s.threadSubject})]})]}),s.attendees.length>0&&e.jsx(le,{attendees:s.attendees,activeEmail:x,onActivate:b,renderContext:k,touch:E,className:"mt-3"}),s.notes!==""&&e.jsx("p",{className:"mt-3 whitespace-pre-wrap text-sm text-fg-muted",children:s.notes})]});return D==="bare"?e.jsx("div",{className:h("flex flex-col",r),children:d}):e.jsxs("article",{className:h("flex h-full w-full flex-col bg-surface",r),children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[e.jsx("span",{className:h("size-2.5 shrink-0 rounded-full",R.solid)}),e.jsxs("span",{className:"min-w-0 flex-1 truncate text-xs text-fg-muted",children:[t.name," · ",t.accountLabel]}),a&&e.jsx(S,{variant:"ghost",size:"sm",icon:e.jsx(me,{className:"size-3.5"}),onClick:a,children:"Edit"}),o&&e.jsx(S,{variant:"ghost",size:"sm",icon:e.jsx(_,{className:"size-3.5"}),onClick:o,className:"text-danger",children:"Delete"}),c&&e.jsx("button",{type:"button","aria-label":"Close event",onClick:c,className:"flex size-7 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",children:e.jsx(K,{className:"size-4"})})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-row-inset py-3",children:d})]})}const je=[{scope:"this",label:"This event",note:"Leaves the rest of the series alone"},{scope:"following",label:"This and everything after",note:"Splits the series here"},{scope:"all",label:"The whole series",note:"Rewrites the rule itself"}];function Ne({title:s,ruleText:t,instanceText:n,onChoose:a,onCancel:o,touch:l,className:c}){return e.jsxs("div",{className:h("flex flex-col gap-3",c),children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-md font-semibold text-fg",children:[s," repeats"]}),e.jsx("p",{className:"text-xs text-fg-muted",children:t}),e.jsxs("p",{className:"text-xs text-fg-subtle",children:["You clicked ",n,"."]})]}),e.jsx("p",{className:"text-sm text-fg",children:"What should the change apply to?"}),e.jsx("div",{className:"flex flex-col gap-1.5",children:je.map(x=>e.jsxs("button",{type:"button",onClick:()=>a(x.scope),className:h("flex flex-col rounded-md border border-line bg-surface px-3 py-2 text-left outline-none transition-colors hover:border-line-strong hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",l&&"min-h-11 justify-center"),children:[e.jsx("span",{className:"text-sm font-medium text-fg",children:x.label}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:x.note})]},x.scope))}),e.jsx(S,{variant:"ghost",size:l?"md":"sm",onClick:o,className:h("self-start",l&&"min-h-11"),children:"Cancel"})]})}const we=s=>s.replace(/\r?\n[ \t]/g,""),B=s=>s.replace(/\\n/gi,`
2
2
  `).replace(/\\,/g,",").replace(/\\;/g,";").replace(/\\\\/g,"\\");function Ce(s,t){let n=!1;for(let a=t.length;a<s.length;a+=1){const o=s[a];if(a===t.length&&o!==";"&&o!==":")return;if(o==='"'){n=!n;continue}if(!n&&o===":")return s.slice(a+1).trim()}}function A(s,t){for(const n of we(s).split(/\r?\n/)){if(!n.startsWith(t))continue;const a=Ce(n,t);if(a!==void 0)return a}return""}const ye=s=>A(s,"RRULE"),ke=s=>({location:B(A(s,"LOCATION")),description:B(A(s,"DESCRIPTION"))}),Ee=X(404);function De(s,t){const{data:n,isLoading:a,error:o,refetch:l}=Q({...V({path:{calendarObjectId:s},query:{calendarId:t}}),meta:Ee,enabled:s!==""&&t!==""});return{resource:n,isLoading:a,error:o,refetch:()=>{l()}}}const z=new Intl.DateTimeFormat(void 0,{weekday:"short",day:"numeric",month:"long"}),y=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1});function G(s){const t=new Date(s.start),n=new Date(s.end),a=z.format(t);return s.allDay?`${a}, all day`:z.format(n)===a?`${a}, ${y.format(t)} – ${y.format(n)}`:`${a}, ${y.format(t)} – ${z.format(n)}, ${y.format(n)}`}function Re({event:s,calendar:t,isOccurrence:n,problem:a="",onEdit:o,onDelete:l,onClose:c}){return!s||!t?e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 bg-surface p-8 text-center",children:[e.jsx(H,{className:"size-8 text-fg-subtle","aria-hidden":"true"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"That event isn't on this week"}),e.jsx("p",{className:"max-w-xs text-sm text-fg-muted",children:"The address names an event the calendar doesn't have here."}),e.jsx("button",{type:"button",onClick:c,className:"rounded-md border border-line px-2.5 py-1 text-sm font-medium text-fg outline-none hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",children:"Back to the calendar"})]}):e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-surface",children:[n&&e.jsx("p",{className:"shrink-0 border-b border-line bg-surface-sunken px-row-inset py-1.5 text-2xs uppercase tracking-wider text-fg-subtle",children:"One occurrence of a repeating event"}),a!==""&&e.jsxs("div",{role:"alert",className:"flex shrink-0 items-start gap-2 border-b border-danger/40 bg-danger-soft px-row-inset py-2 text-sm",children:[e.jsx(J,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":"true"}),e.jsx("p",{className:"min-w-0 flex-1 break-words text-fg",children:a})]}),e.jsx(be,{event:s,calendar:t,whenText:G(s),onEdit:o,onDelete:l,onClose:c,className:"min-h-0 flex-1"})]})}const Te="This event changed somewhere else — over CalDAV, or in another tab. Nothing was saved. Close it and open it again to see the version that's stored now.";function We({calendarObjectId:s,recurrenceId:t}){const{view:n,date:a,calendarIds:o}=ge(),{events:l}=pe({view:n,date:a,calendarIds:o}),{calendars:c,timeZoneByCalendarId:x}=fe(),{closeEvent:b}=ve(),{updateEvent:k,deleteEvent:E,isWriting:D}=ee(),r=l.find(i=>i.id===ue(s,t??"")),R=c.find(i=>i.id===r?.calendarId),{resource:d}=De(s,r?.calendarId??""),[I,p]=C.useState(void 0),[f,T]=C.useState(void 0),[u,j]=C.useState(void 0),[L,g]=C.useState(""),N=d?ke(d.icalData):void 0,F=d?ye(d.icalData):"",q=r&&!r.allDay?r.start.slice(11,16):"",w=F===""?"":se(F,q)??"Repeats",O=r!==void 0&&r.seriesId!==""&&t!==void 0&&t!=="",P=r!==void 0&&d!==void 0,$=(i,m)=>{if(i.kind==="written"){g(""),m();return}g(i.kind==="conflict"?Te:i.message)},M=i=>({calendarObjectId:s,calendarId:r?.calendarId??"",recurrenceId:t??"",scope:i,etag:d?.etag??""}),U=i=>{if(!r)return;const m=ae(r,{repeat:w,location:N?.location??"",notes:N?.description??""});p(void 0),T({before:m,scope:i}),j(m),g("")},W=i=>{p(void 0),E(M(i)).then(m=>$(m,b))},Y=()=>{if(!f||!u)return;const i=ne(f.before,u,x[u.calendarId]??he);if(!i.ok){g(i.problem);return}k(M(f.scope),i.patch).then(m=>$(m,()=>{T(void 0),j(void 0)}))};return I!==void 0&&r?e.jsx("div",{className:"flex h-full flex-col justify-center bg-surface px-row-inset",children:e.jsx(Ne,{className:"mx-auto w-full max-w-md",title:r.title,ruleText:w===""?"It repeats":w,instanceText:G(r),onChoose:I==="edit"?U:W,onCancel:()=>p(void 0)})}):f&&u?e.jsx(te,{title:"Edit event",subtitle:f.scope==="this"?"This occurrence only":u.date,calendars:c,draft:u,onChange:j,problem:L,saveLabel:"Save",isSaving:D,repeatEditable:f.scope===void 0||f.scope==="all",calendarEditable:!1,onSave:Y,onCancel:()=>{T(void 0),j(void 0),g("")}}):e.jsx(Re,{event:r&&{...r,location:N?.location??"",notes:N?.description??"",recurrenceRule:w},calendar:R,isOccurrence:t!==void 0,problem:L,onEdit:P?()=>O?p("edit"):U(void 0):void 0,onDelete:P?()=>O?p("delete"):W(void 0):void 0,onClose:b})}export{We as O};
@@ -1 +1 @@
1
- import{ap as g,Z as w,L as C,j as s,t as b,a1 as $,_ as S,a7 as _,u as q,cd as H,r as x,cf as K,c as U,ab as W,C as G,d6 as Z,h as J,ar as V,cK as X,i as v,at as y,cz as Y,cA as ee}from"./index-Bp69o_hx.js";import{a as se,u as k,L as R}from"./roving-focus-DQHWPAVb.js";import{u as te,p as ne,R as j,c as ae}from"./useSearchTokenContext-Bt8He2xM.js";import{C as I}from"./circle-check-big-DEmZetXy.js";import{C as A}from"./clock-DUYaqtJD.js";import{R as oe}from"./row-actions-KXYdPyQc.js";import{R as re}from"./rotate-ccw-BKXu5q3v.js";import{N as D}from"./NavMenuButton-r1Fm79xW.js";import{b as p,t as ie}from"./format-Cv0v2QYw.js";import{i as le,s as L}from"./outbox-status-BlKn6P0x.js";import{n as ce}from"./search-query-Cr_ZXBCp.js";import{f as de}from"./useMessageBodyContent-BAOiu5RU.js";const ue={queued:{icon:A,label:"Queued",className:"text-warning"},sending:{icon:C,label:"Sending…",className:"text-accent-2",spin:!0},sent:{icon:I,label:"Sent",className:"text-positive"},unfiled:{icon:g,label:"Sent, not filed",className:"text-warning"},failed:{icon:w,label:"Failed",className:"text-danger"},blocked:{icon:g,label:"Blocked",className:"text-warning"}};function O({status:e,iconOnly:n,className:a}){const t=ue[e],o=t.icon;return s.jsxs("span",{className:b("inline-flex items-center gap-1.5 text-xs font-medium",t.className,a),children:[s.jsx(o,{className:b("size-4",t.spin&&"animate-spin")}),!n&&t.label]})}const xe=(e,n)=>n?"bg-accent-2-soft":e==="failed"?"bg-danger-soft":e==="blocked"||e==="unfiled"?"bg-warning/10":"";function fe({recipients:e,subject:n,time:a,status:t,error:o,selected:l,onSelect:c,onRetry:r,retrying:d,onEdit:i,onDelete:f,deleting:u}){const m=t==="failed"||t==="blocked"||t==="unfiled";return s.jsxs("div",{className:b("flex items-start gap-3 border-b border-line px-4 py-3 transition-colors hover:bg-surface-raised",xe(t,l)),children:[s.jsxs("button",{type:"button",...se,onClick:c,className:"flex flex-1 min-w-0 items-start gap-3 text-left",children:[s.jsx("div",{className:"mt-0.5 shrink-0",children:s.jsx(O,{status:t,iconOnly:!0})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"truncate text-sm font-medium",children:e}),s.jsx("span",{className:"shrink-0 text-xs text-fg-muted",children:a})]}),s.jsx("div",{className:"truncate text-sm",children:n||"No subject"}),s.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[s.jsx(O,{status:t}),o&&s.jsxs("span",{className:"truncate text-xs text-fg-muted",children:["— ",o]})]})]})]}),m&&s.jsx("div",{className:"shrink-0",children:s.jsx(oe,{actions:[...t==="failed"&&r?[{label:"Retry sending",iconOnly:!0,icon:s.jsx(re,{className:"size-3.5"}),busy:d,onClick:r}]:[],...t==="unfiled"?[]:[{label:"Edit as draft",iconOnly:!0,icon:s.jsx(S,{className:"size-3.5"}),onClick:i}]],destructive:{label:"Delete message",iconOnly:!0,icon:s.jsx($,{className:"size-3.5"}),busy:u,confirm:{prompt:"Delete this message?",confirmLabel:"Delete"},onClick:f}})})]})}function Qe(){return _({from:"/mail/outbox/draft/$outboxMessageId",shouldThrow:!1})?.outboxMessageId}function me(){const e=q(),n=H();return x.useCallback(a=>{e({to:"/mail/outbox/draft/$outboxMessageId",params:{outboxMessageId:a},search:t=>t,hash:n})},[e,n])}function he(){return K()}function be(e,n){const a=n.trim().toLowerCase();if(a.length===0)return!0;const t=[e.subject,e.fromAddress,e.fromName,...e.toAddresses??[],...e.ccAddresses??[]].filter(o=>typeof o=="string").join(" ").toLowerCase();return a.split(/\s+/).every(o=>o.length===0||t.includes(o))}function ge(e){return e.tokens.length>0&&e.freeText.trim().length===0}const T={queued:{icon:A,label:"Queued",className:"text-warning"},sending:{icon:C,label:"Sending…",className:"text-accent-2"},sent:{icon:I,label:"Sent",className:"text-positive"},unfiled:{icon:g,label:"Sent, not filed",className:"text-warning"},failed:{icon:w,label:"Failed",className:"text-danger"},blocked:{icon:g,label:"Blocked",className:"text-warning"}},pe=e=>ie(e).toDateString()===new Date().toDateString()?p(e,{hour:"numeric",minute:"2-digit"}):p(e,{month:"short",day:"numeric"}),M=e=>p(e,{dateStyle:"medium",timeStyle:"short"}),je=e=>{const n=e.toAddresses??[];return n.length===0?"No recipients":n.length===1?n[0]:`${n[0]} +${n.length-1}`},E=(e,n)=>n?"The outbox cannot filter on those terms":e?"No matching outbox messages":"No outbox messages",Q=x.createContext(null);function N(){const e=x.useContext(Q);if(!e)throw new Error("OutboxPane.* must be used inside <OutboxPane>");return e}function Ne({outboxMessageId:e,children:n}){const a=me(),t=he(),{data:o,isLoading:l}=U(W()),{searchQuery:c}=G(),r=te(),d=ce(c),i=ne(d,r),f=d.length>0,u=ge(i),m=x.useMemo(()=>u?[]:(o?.items??[]).filter(h=>le(h.status)).filter(h=>be(h,i.freeText)),[o,i.freeText,u]),z=x.useMemo(()=>m.find(h=>h.outboxMessageId===e),[m,e]),F={messages:m,hasQuery:f,unsupportedQuery:u,isLoading:l,selectedMessageId:e,selectedMessage:z,onOpenMessage:a,onCloseMessage:t};return s.jsx(Q.Provider,{value:F,children:n})}function P({message:e,isSelected:n,onSelect:a}){const t=J(),o=de(),{pushError:l}=V(),c=x.useCallback(()=>{t.invalidateQueries({queryKey:X()})},[t]),r=v({...Y(),onSuccess:c,onError:u=>{l(y("Couldn't resend message","The message wasn't sent.",u))}}),d=v({...ee(),onSuccess:c,onError:u=>{l(y("Couldn't delete message","The message wasn't deleted.",u))}}),i=e.status;if(!T[i])return null;const f=L(e.status);return s.jsx(fe,{recipients:je(e),subject:e.subject||"",time:pe(e.sentAt??e.updatedAt),status:i,error:f?e.lastError??void 0:void 0,selected:n,onSelect:a,onRetry:i==="failed"?()=>r.mutate({path:{outboxMessageId:e.outboxMessageId}}):void 0,retrying:r.isPending,onEdit:()=>o(e.outboxMessageId),onDelete:()=>d.mutate({path:{outboxMessageId:e.outboxMessageId}}),deleting:d.isPending})}function B({message:e,onBack:n}){const a=e.status,t=T[a],o=t?.icon??S,l=e.sentAt?M(e.sentAt):M(e.updatedAt);return s.jsxs("div",{className:"h-full overflow-y-auto bg-canvas",children:[s.jsxs("div",{className:"border-b border-line p-4",children:[n&&s.jsxs("button",{type:"button",onClick:n,className:"mb-3 inline-flex items-center gap-1 text-sm text-fg-muted hover:text-fg",children:[s.jsx(Z,{className:"size-4"}),s.jsx("span",{children:"Back"})]}),s.jsx("h1",{className:"text-xl font-semibold mb-3",children:e.subject||"(No subject)"}),s.jsxs("div",{className:"space-y-1 text-sm",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"From:"}),s.jsx("span",{className:"text-fg",children:e.fromName?`${e.fromName} <${e.fromAddress}>`:e.fromAddress})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"To:"}),s.jsx("span",{className:"text-fg",children:(e.toAddresses??[]).join(", ")})]}),e.ccAddresses&&e.ccAddresses.length>0&&s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"Cc:"}),s.jsx("span",{className:"text-fg",children:e.ccAddresses.join(", ")})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"Date:"}),s.jsx("span",{className:"text-fg",children:l})]}),t&&s.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[s.jsx(o,{className:b("size-4",t.className,a==="sending"&&"animate-spin")}),s.jsx("span",{className:b("text-xs font-medium",t.className),children:t.label}),L(e.status)&&e.lastError&&s.jsxs("span",{className:"text-xs text-fg-muted",children:["— ",e.lastError]})]})]})]}),s.jsx("div",{className:"p-4",children:s.jsx(ae,{html:e.htmlBody,text:e.textBody})})]})}function ve(){const{messages:e,hasQuery:n,unsupportedQuery:a,isLoading:t,selectedMessageId:o,onOpenMessage:l}=N(),c=x.useRef(null);return k({containerRef:c,itemSelector:R}),t?s.jsx("div",{className:"flex h-full items-center justify-center bg-canvas",children:s.jsx("span",{className:"text-fg-muted",children:"Loading..."})}):e.length===0?s.jsx("div",{className:"flex h-full bg-surface",children:s.jsx(j,{message:E(n,a),showHints:!1})}):s.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[s.jsx(D,{}),s.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:"Outbox"}),s.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:[e.length," ",e.length===1?"message":"messages"]})]}),s.jsx("div",{ref:c,className:"flex-1 overflow-y-auto",children:e.map(r=>s.jsx(P,{message:r,isSelected:o===r.outboxMessageId,onSelect:()=>l(r.outboxMessageId)},r.outboxMessageId))})]})}function ye(){const{selectedMessage:e}=N();return s.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[s.jsx("header",{className:"flex h-pane-header shrink-0 items-center border-b border-line px-3"}),s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?s.jsx(B,{message:e}):s.jsx(j,{message:"Select a message to read",showHints:!1})})]})}function Oe(){const{messages:e,hasQuery:n,unsupportedQuery:a,isLoading:t,selectedMessageId:o,selectedMessage:l,onOpenMessage:c,onCloseMessage:r}=N(),d=x.useRef(null);return k({containerRef:d,itemSelector:R}),t?s.jsx("div",{className:"flex h-full items-center justify-center bg-canvas",children:s.jsx("span",{className:"text-fg-muted",children:"Loading..."})}):l?s.jsx(B,{message:l,onBack:r}):e.length===0?s.jsx("div",{className:"flex h-full bg-surface",children:s.jsx(j,{message:E(n,a),showHints:!1})}):s.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[s.jsx(D,{}),s.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:"Outbox"}),s.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:[e.length," ",e.length===1?"message":"messages"]})]}),s.jsx("div",{ref:d,className:"flex-1 overflow-y-auto",children:e.map(i=>s.jsx(P,{message:i,isSelected:o===i.outboxMessageId,onSelect:()=>c(i.outboxMessageId)},i.outboxMessageId))})]})}const Pe=Object.assign(Ne,{List:ve,Reading:ye,Phone:Oe});export{Pe as O,Qe as u};
1
+ import{ap as g,Z as w,L as C,j as s,t as b,a1 as $,_ as S,a7 as _,u as q,cd as H,r as x,cf as K,c as U,ab as W,C as G,d6 as Z,h as J,ar as V,cK as X,i as v,at as y,cz as Y,cA as ee}from"./index-_JBKtYXu.js";import{a as se,u as k,L as R}from"./roving-focus-R7ZTRnKj.js";import{u as te,p as ne,R as j,c as ae}from"./useSearchTokenContext-Du649zXC.js";import{C as I}from"./circle-check-big-C-MjzzMN.js";import{C as A}from"./clock-DycMqInq.js";import{R as oe}from"./row-actions-BsCd_UKz.js";import{R as re}from"./rotate-ccw-ByXIAEyt.js";import{N as D}from"./NavMenuButton-CVdc16Vd.js";import{b as p,t as ie}from"./format-C58wplMJ.js";import{i as le,s as L}from"./outbox-status-BlKn6P0x.js";import{n as ce}from"./search-query-Cr_ZXBCp.js";import{f as de}from"./useMessageBodyContent-ChO4c73P.js";const ue={queued:{icon:A,label:"Queued",className:"text-warning"},sending:{icon:C,label:"Sending…",className:"text-accent-2",spin:!0},sent:{icon:I,label:"Sent",className:"text-positive"},unfiled:{icon:g,label:"Sent, not filed",className:"text-warning"},failed:{icon:w,label:"Failed",className:"text-danger"},blocked:{icon:g,label:"Blocked",className:"text-warning"}};function O({status:e,iconOnly:n,className:a}){const t=ue[e],o=t.icon;return s.jsxs("span",{className:b("inline-flex items-center gap-1.5 text-xs font-medium",t.className,a),children:[s.jsx(o,{className:b("size-4",t.spin&&"animate-spin")}),!n&&t.label]})}const xe=(e,n)=>n?"bg-accent-2-soft":e==="failed"?"bg-danger-soft":e==="blocked"||e==="unfiled"?"bg-warning/10":"";function fe({recipients:e,subject:n,time:a,status:t,error:o,selected:l,onSelect:c,onRetry:r,retrying:d,onEdit:i,onDelete:f,deleting:u}){const m=t==="failed"||t==="blocked"||t==="unfiled";return s.jsxs("div",{className:b("flex items-start gap-3 border-b border-line px-4 py-3 transition-colors hover:bg-surface-raised",xe(t,l)),children:[s.jsxs("button",{type:"button",...se,onClick:c,className:"flex flex-1 min-w-0 items-start gap-3 text-left",children:[s.jsx("div",{className:"mt-0.5 shrink-0",children:s.jsx(O,{status:t,iconOnly:!0})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"truncate text-sm font-medium",children:e}),s.jsx("span",{className:"shrink-0 text-xs text-fg-muted",children:a})]}),s.jsx("div",{className:"truncate text-sm",children:n||"No subject"}),s.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[s.jsx(O,{status:t}),o&&s.jsxs("span",{className:"truncate text-xs text-fg-muted",children:["— ",o]})]})]})]}),m&&s.jsx("div",{className:"shrink-0",children:s.jsx(oe,{actions:[...t==="failed"&&r?[{label:"Retry sending",iconOnly:!0,icon:s.jsx(re,{className:"size-3.5"}),busy:d,onClick:r}]:[],...t==="unfiled"?[]:[{label:"Edit as draft",iconOnly:!0,icon:s.jsx(S,{className:"size-3.5"}),onClick:i}]],destructive:{label:"Delete message",iconOnly:!0,icon:s.jsx($,{className:"size-3.5"}),busy:u,confirm:{prompt:"Delete this message?",confirmLabel:"Delete"},onClick:f}})})]})}function Qe(){return _({from:"/mail/outbox/draft/$outboxMessageId",shouldThrow:!1})?.outboxMessageId}function me(){const e=q(),n=H();return x.useCallback(a=>{e({to:"/mail/outbox/draft/$outboxMessageId",params:{outboxMessageId:a},search:t=>t,hash:n})},[e,n])}function he(){return K()}function be(e,n){const a=n.trim().toLowerCase();if(a.length===0)return!0;const t=[e.subject,e.fromAddress,e.fromName,...e.toAddresses??[],...e.ccAddresses??[]].filter(o=>typeof o=="string").join(" ").toLowerCase();return a.split(/\s+/).every(o=>o.length===0||t.includes(o))}function ge(e){return e.tokens.length>0&&e.freeText.trim().length===0}const T={queued:{icon:A,label:"Queued",className:"text-warning"},sending:{icon:C,label:"Sending…",className:"text-accent-2"},sent:{icon:I,label:"Sent",className:"text-positive"},unfiled:{icon:g,label:"Sent, not filed",className:"text-warning"},failed:{icon:w,label:"Failed",className:"text-danger"},blocked:{icon:g,label:"Blocked",className:"text-warning"}},pe=e=>ie(e).toDateString()===new Date().toDateString()?p(e,{hour:"numeric",minute:"2-digit"}):p(e,{month:"short",day:"numeric"}),M=e=>p(e,{dateStyle:"medium",timeStyle:"short"}),je=e=>{const n=e.toAddresses??[];return n.length===0?"No recipients":n.length===1?n[0]:`${n[0]} +${n.length-1}`},E=(e,n)=>n?"The outbox cannot filter on those terms":e?"No matching outbox messages":"No outbox messages",Q=x.createContext(null);function N(){const e=x.useContext(Q);if(!e)throw new Error("OutboxPane.* must be used inside <OutboxPane>");return e}function Ne({outboxMessageId:e,children:n}){const a=me(),t=he(),{data:o,isLoading:l}=U(W()),{searchQuery:c}=G(),r=te(),d=ce(c),i=ne(d,r),f=d.length>0,u=ge(i),m=x.useMemo(()=>u?[]:(o?.items??[]).filter(h=>le(h.status)).filter(h=>be(h,i.freeText)),[o,i.freeText,u]),z=x.useMemo(()=>m.find(h=>h.outboxMessageId===e),[m,e]),F={messages:m,hasQuery:f,unsupportedQuery:u,isLoading:l,selectedMessageId:e,selectedMessage:z,onOpenMessage:a,onCloseMessage:t};return s.jsx(Q.Provider,{value:F,children:n})}function P({message:e,isSelected:n,onSelect:a}){const t=J(),o=de(),{pushError:l}=V(),c=x.useCallback(()=>{t.invalidateQueries({queryKey:X()})},[t]),r=v({...Y(),onSuccess:c,onError:u=>{l(y("Couldn't resend message","The message wasn't sent.",u))}}),d=v({...ee(),onSuccess:c,onError:u=>{l(y("Couldn't delete message","The message wasn't deleted.",u))}}),i=e.status;if(!T[i])return null;const f=L(e.status);return s.jsx(fe,{recipients:je(e),subject:e.subject||"",time:pe(e.sentAt??e.updatedAt),status:i,error:f?e.lastError??void 0:void 0,selected:n,onSelect:a,onRetry:i==="failed"?()=>r.mutate({path:{outboxMessageId:e.outboxMessageId}}):void 0,retrying:r.isPending,onEdit:()=>o(e.outboxMessageId),onDelete:()=>d.mutate({path:{outboxMessageId:e.outboxMessageId}}),deleting:d.isPending})}function B({message:e,onBack:n}){const a=e.status,t=T[a],o=t?.icon??S,l=e.sentAt?M(e.sentAt):M(e.updatedAt);return s.jsxs("div",{className:"h-full overflow-y-auto bg-canvas",children:[s.jsxs("div",{className:"border-b border-line p-4",children:[n&&s.jsxs("button",{type:"button",onClick:n,className:"mb-3 inline-flex items-center gap-1 text-sm text-fg-muted hover:text-fg",children:[s.jsx(Z,{className:"size-4"}),s.jsx("span",{children:"Back"})]}),s.jsx("h1",{className:"text-xl font-semibold mb-3",children:e.subject||"(No subject)"}),s.jsxs("div",{className:"space-y-1 text-sm",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"From:"}),s.jsx("span",{className:"text-fg",children:e.fromName?`${e.fromName} <${e.fromAddress}>`:e.fromAddress})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"To:"}),s.jsx("span",{className:"text-fg",children:(e.toAddresses??[]).join(", ")})]}),e.ccAddresses&&e.ccAddresses.length>0&&s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"Cc:"}),s.jsx("span",{className:"text-fg",children:e.ccAddresses.join(", ")})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"Date:"}),s.jsx("span",{className:"text-fg",children:l})]}),t&&s.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[s.jsx(o,{className:b("size-4",t.className,a==="sending"&&"animate-spin")}),s.jsx("span",{className:b("text-xs font-medium",t.className),children:t.label}),L(e.status)&&e.lastError&&s.jsxs("span",{className:"text-xs text-fg-muted",children:["— ",e.lastError]})]})]})]}),s.jsx("div",{className:"p-4",children:s.jsx(ae,{html:e.htmlBody,text:e.textBody})})]})}function ve(){const{messages:e,hasQuery:n,unsupportedQuery:a,isLoading:t,selectedMessageId:o,onOpenMessage:l}=N(),c=x.useRef(null);return k({containerRef:c,itemSelector:R}),t?s.jsx("div",{className:"flex h-full items-center justify-center bg-canvas",children:s.jsx("span",{className:"text-fg-muted",children:"Loading..."})}):e.length===0?s.jsx("div",{className:"flex h-full bg-surface",children:s.jsx(j,{message:E(n,a),showHints:!1})}):s.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[s.jsx(D,{}),s.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:"Outbox"}),s.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:[e.length," ",e.length===1?"message":"messages"]})]}),s.jsx("div",{ref:c,className:"flex-1 overflow-y-auto",children:e.map(r=>s.jsx(P,{message:r,isSelected:o===r.outboxMessageId,onSelect:()=>l(r.outboxMessageId)},r.outboxMessageId))})]})}function ye(){const{selectedMessage:e}=N();return s.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[s.jsx("header",{className:"flex h-pane-header shrink-0 items-center border-b border-line px-3"}),s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?s.jsx(B,{message:e}):s.jsx(j,{message:"Select a message to read",showHints:!1})})]})}function Oe(){const{messages:e,hasQuery:n,unsupportedQuery:a,isLoading:t,selectedMessageId:o,selectedMessage:l,onOpenMessage:c,onCloseMessage:r}=N(),d=x.useRef(null);return k({containerRef:d,itemSelector:R}),t?s.jsx("div",{className:"flex h-full items-center justify-center bg-canvas",children:s.jsx("span",{className:"text-fg-muted",children:"Loading..."})}):l?s.jsx(B,{message:l,onBack:r}):e.length===0?s.jsx("div",{className:"flex h-full bg-surface",children:s.jsx(j,{message:E(n,a),showHints:!1})}):s.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[s.jsx(D,{}),s.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:"Outbox"}),s.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:[e.length," ",e.length===1?"message":"messages"]})]}),s.jsx("div",{ref:d,className:"flex-1 overflow-y-auto",children:e.map(i=>s.jsx(P,{message:i,isSelected:o===i.outboxMessageId,onSelect:()=>c(i.outboxMessageId)},i.outboxMessageId))})]})}const Pe=Object.assign(Ne,{List:ve,Reading:ye,Phone:Oe});export{Pe as O,Qe as u};
@@ -0,0 +1 @@
1
+ import{O as o}from"./index-_JBKtYXu.js";const n=o;export{n as component};
@@ -0,0 +1 @@
1
+ import{ah as m,j as o,O as p}from"./index-_JBKtYXu.js";import{a}from"./MailShell-CMOL8AKI.js";import{M as r}from"./MailboxPane-BgjcYu1t.js";import{d as e}from"./search-token-index-U-0PE-Ox.js";import{u as s}from"./search-mirror-CJOCjfkC.js";import"./FullCompose-C8dlsR-Q.js";import"./ErrorState-BUi73q43.js";import"./index-CAWCA7kp.js";import"./useMessageBodyContent-ChO4c73P.js";import"./useSignature-CkDxKXxk.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DYu0unJr.js";import"./sections-Bz1Hz1WB.js";import"./format-C58wplMJ.js";import"./confirm-dialog-C_t09Gva.js";import"./useSearchTokenContext-Du649zXC.js";import"./kbd-CUNCsdLt.js";import"./search-scope-B5-OK3Cq.js";import"./useRefreshControl-hwJW949Z.js";import"./circle-check-big-C-MjzzMN.js";import"./refresh-cw-Mvz24VPI.js";import"./useQueries-DNMW1lkL.js";import"./MailListHeader-BJX8BuyA.js";import"./roving-focus-R7ZTRnKj.js";import"./attachment-file-B5mkzgR1.js";import"./mail-B73P70rO.js";import"./avatar-Dso3OQH7.js";import"./EmptyState-D8775COI.js";import"./download-9A_DQZED.js";import"./calendar-event-chip-CoD7r2-a.js";import"./calendar-color-BG7928-_.js";import"./map-pin-CEP5uZHA.js";import"./attendee-row-BeKlhe0A.js";import"./clock-DycMqInq.js";import"./useLayoutTier-D1c62D6O.js";import"./shield-check-WkiJUavf.js";import"./useFilters-BDQsNdKM.js";import"./menu-CyMA8ejK.js";import"./MailViewChrome-CaqCUxFx.js";import"./NavMenuButton-CVdc16Vd.js";import"./useLabels-DIvHKWeo.js";import"./useSemanticSearch-Dkvkustt.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-BX-sJ8v6.js";import"./circle-help-DpcwUo3O.js";import"./circle-check-CLuBMQlt.js";function ro(){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{ro as component};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-_JBKtYXu.js";import{M as r}from"./MailboxPane-BgjcYu1t.js";import"./useSearchTokenContext-Du649zXC.js";import"./kbd-CUNCsdLt.js";import"./useMessageBodyContent-ChO4c73P.js";import"./search-scope-B5-OK3Cq.js";import"./useRefreshControl-hwJW949Z.js";import"./circle-check-big-C-MjzzMN.js";import"./refresh-cw-Mvz24VPI.js";import"./useQueries-DNMW1lkL.js";import"./search-token-index-U-0PE-Ox.js";import"./useLayoutTier-D1c62D6O.js";import"./MailListHeader-BJX8BuyA.js";import"./roving-focus-R7ZTRnKj.js";import"./attachment-file-B5mkzgR1.js";import"./mail-B73P70rO.js";import"./avatar-Dso3OQH7.js";import"./index-CAWCA7kp.js";import"./useSignature-CkDxKXxk.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DYu0unJr.js";import"./sections-Bz1Hz1WB.js";import"./format-C58wplMJ.js";import"./EmptyState-D8775COI.js";import"./ErrorState-BUi73q43.js";import"./download-9A_DQZED.js";import"./calendar-event-chip-CoD7r2-a.js";import"./calendar-color-BG7928-_.js";import"./map-pin-CEP5uZHA.js";import"./attendee-row-BeKlhe0A.js";import"./clock-DycMqInq.js";import"./shield-check-WkiJUavf.js";import"./useFilters-BDQsNdKM.js";import"./confirm-dialog-C_t09Gva.js";import"./menu-CyMA8ejK.js";import"./MailViewChrome-CaqCUxFx.js";import"./NavMenuButton-CVdc16Vd.js";import"./useLabels-DIvHKWeo.js";import"./useSemanticSearch-Dkvkustt.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-BX-sJ8v6.js";import"./circle-help-DpcwUo3O.js";import"./circle-check-CLuBMQlt.js";function T(){return o.jsx(r.Reading,{})}export{T as component};
@@ -0,0 +1 @@
1
+ import{j as r}from"./index-_JBKtYXu.js";import{B as o}from"./BriefPane-KLlpL-7H.js";import"./useSearchTokenContext-Du649zXC.js";import"./kbd-CUNCsdLt.js";import"./useMessageBodyContent-ChO4c73P.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-BJX8BuyA.js";import"./roving-focus-R7ZTRnKj.js";import"./search-token-index-U-0PE-Ox.js";import"./useLayoutTier-D1c62D6O.js";import"./useQueries-DNMW1lkL.js";import"./attachment-file-B5mkzgR1.js";import"./mail-B73P70rO.js";import"./avatar-Dso3OQH7.js";import"./index-CAWCA7kp.js";import"./useSignature-CkDxKXxk.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DYu0unJr.js";import"./sections-Bz1Hz1WB.js";import"./format-C58wplMJ.js";import"./EmptyState-D8775COI.js";import"./ErrorState-BUi73q43.js";import"./download-9A_DQZED.js";import"./calendar-event-chip-CoD7r2-a.js";import"./calendar-color-BG7928-_.js";import"./map-pin-CEP5uZHA.js";import"./attendee-row-BeKlhe0A.js";import"./clock-DycMqInq.js";import"./shield-check-WkiJUavf.js";import"./useFilters-BDQsNdKM.js";import"./confirm-dialog-C_t09Gva.js";import"./menu-CyMA8ejK.js";import"./useRefreshControl-hwJW949Z.js";import"./circle-check-big-C-MjzzMN.js";import"./refresh-cw-Mvz24VPI.js";import"./useSemanticSearch-Dkvkustt.js";import"./useLabels-DIvHKWeo.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-DxUM65kM.js";function N(){return r.jsx(o.Reading,{})}export{N as component};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-_JBKtYXu.js";import{F as r}from"./FlaggedPane-DeZhlWFy.js";import"./useSearchTokenContext-Du649zXC.js";import"./kbd-CUNCsdLt.js";import"./useMessageBodyContent-ChO4c73P.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-BJX8BuyA.js";import"./roving-focus-R7ZTRnKj.js";import"./search-token-index-U-0PE-Ox.js";import"./useLayoutTier-D1c62D6O.js";import"./useQueries-DNMW1lkL.js";import"./attachment-file-B5mkzgR1.js";import"./mail-B73P70rO.js";import"./avatar-Dso3OQH7.js";import"./index-CAWCA7kp.js";import"./useSignature-CkDxKXxk.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DYu0unJr.js";import"./sections-Bz1Hz1WB.js";import"./format-C58wplMJ.js";import"./EmptyState-D8775COI.js";import"./ErrorState-BUi73q43.js";import"./download-9A_DQZED.js";import"./calendar-event-chip-CoD7r2-a.js";import"./calendar-color-BG7928-_.js";import"./map-pin-CEP5uZHA.js";import"./attendee-row-BeKlhe0A.js";import"./clock-DycMqInq.js";import"./shield-check-WkiJUavf.js";import"./useFilters-BDQsNdKM.js";import"./confirm-dialog-C_t09Gva.js";import"./menu-CyMA8ejK.js";import"./MailViewChrome-CaqCUxFx.js";import"./refresh-cw-Mvz24VPI.js";import"./wizard-selection-DxUM65kM.js";function I(){return o.jsx(r.Reading,{})}export{I as component};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-_JBKtYXu.js";import{O as t}from"./OutboxPane-Dd-mfB0h.js";import"./roving-focus-R7ZTRnKj.js";import"./useSearchTokenContext-Du649zXC.js";import"./kbd-CUNCsdLt.js";import"./useMessageBodyContent-ChO4c73P.js";import"./search-scope-B5-OK3Cq.js";import"./circle-check-big-C-MjzzMN.js";import"./clock-DycMqInq.js";import"./row-actions-BsCd_UKz.js";import"./rotate-ccw-ByXIAEyt.js";import"./NavMenuButton-CVdc16Vd.js";import"./menu-CyMA8ejK.js";import"./format-C58wplMJ.js";import"./outbox-status-BlKn6P0x.js";import"./search-query-Cr_ZXBCp.js";function R(){return o.jsx(t.Reading,{})}export{R as component};
@@ -0,0 +1 @@
1
+ import{eo as t,j as m}from"./index-_JBKtYXu.js";import{O as e}from"./OpenCalendarEvent-BGfbdWGu.js";import"./CalendarComposePane-CsWkzDBi.js";import"./window-CT3glB3e.js";import"./ErrorState-BUi73q43.js";import"./calendar-color-BG7928-_.js";import"./attendee-row-BeKlhe0A.js";import"./avatar-Dso3OQH7.js";import"./clock-DycMqInq.js";import"./map-pin-CEP5uZHA.js";import"./mail-B73P70rO.js";import"./pencil-C8wWVDp1.js";import"./useCalendars-dRe0PNET.js";import"./useCalendarData-CxT_7y0k.js";import"./useQueries-DNMW1lkL.js";function E(){const{calendarObjectId:r,recurrenceId:o}=t.useParams();return m.jsx(e,{calendarObjectId:r,recurrenceId:o})}export{E as component};
@@ -0,0 +1 @@
1
+ import{O as o}from"./index-_JBKtYXu.js";const n=o;export{n as component};
@@ -0,0 +1 @@
1
+ import{O as o}from"./index-_JBKtYXu.js";const n=o;export{n as component};
@@ -0,0 +1 @@
1
+ import{O as o}from"./index-_JBKtYXu.js";const n=o;export{n as component};