@remit/web-client-dist 0.0.693 → 0.0.695
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/BriefPane-BJLNB-w7.js +1 -0
- package/assets/{CalendarEventEditor-ByaBmUP7.js → CalendarEventEditor-MMNLFvjJ.js} +1 -1
- package/assets/{CalendarEventPopup-NPO2QK5a.js → CalendarEventPopup-DVJ9DC_Y.js} +1 -1
- package/assets/{CalendarLoadFailed-MMfmxIOT.js → CalendarLoadFailed-uHGxFBGx.js} +1 -1
- package/assets/{CalendarQuickCreate-BhMEUw9n.js → CalendarQuickCreate-CzJ4lehP.js} +1 -1
- package/assets/{CalendarSession-B8ChEcvA.js → CalendarSession-BVuy8A2H.js} +1 -1
- package/assets/CollectionPane-RUuB6sFo.js +1 -0
- package/assets/{DesktopChrome-Ut5v-Z4q.js → DesktopChrome-Ct-IB4ks.js} +1 -1
- package/assets/{DropdownMenu-DeSAAnwz.js → DropdownMenu-CTCHgh4X.js} +1 -1
- package/assets/{EmptyState-nnSadc_r.js → EmptyState-CN-AyHj-.js} +1 -1
- package/assets/{ErrorState-DMaeeewe.js → ErrorState-Bk3DwNvd.js} +1 -1
- package/assets/{FullCompose-DktaLciC.js → FullCompose-BWiLy3Vm.js} +1 -1
- package/assets/{LabelApplyTrigger-ez73tEPG.js → LabelApplyTrigger-52QGuTLD.js} +1 -1
- package/assets/{MailShell-BpzbpiB4.js → MailShell-DAqGpnce.js} +1 -1
- package/assets/{MailViewChrome-C8hjtsK2.js → MailViewChrome-BDymWKX9.js} +1 -1
- package/assets/MailboxPane-DUI-sxQF.js +135 -0
- package/assets/{MessageBody-D4k3ez4t.js → MessageBody-BeciCqb_.js} +4 -4
- package/assets/MessageToolbar-BYhqv9RG.js +1 -0
- package/assets/{NavMenuButton-Du6gwKpU.js → NavMenuButton-A6v6v8tE.js} +1 -1
- package/assets/{OnboardingWizard-DE2nyJkH.js → OnboardingWizard-CIneAccs.js} +1 -1
- package/assets/OutboxPane-InUnHiNC.js +1 -0
- package/assets/{ReportLink-zQuTfqJn.js → ReportLink-q8WFRQli.js} +1 -1
- package/assets/_calendarObjectId-B3IHxxnZ.js +1 -0
- package/assets/_labelId-BX1_9FW3.js +1 -0
- package/assets/_mailboxId-BKCf6hRR.js +1 -0
- package/assets/_messageId-DGc5xyqH.js +1 -0
- package/assets/_messageId-ODP9L5rG.js +1 -0
- package/assets/_messageId-_9l1GYCG.js +1 -0
- package/assets/_messageId-t0gwqxwG.js +1 -0
- package/assets/_outboxMessageId-DGFiVWCU.js +1 -0
- package/assets/_recurrenceId-yqFEhvsn.js +1 -0
- package/assets/_slotId-Cf-NASLE.js +1 -0
- package/assets/_threadId-Bvd5G-pJ.js +1 -0
- package/assets/_threadId-BwJQjORR.js +1 -0
- package/assets/_threadId-CFLbzDUi.js +1 -0
- package/assets/_threadId-Dj29QtLs.js +1 -0
- package/assets/{_view._date-BEWywi53.js → _view._date-dARprXsM.js} +1 -1
- package/assets/{account-service-status-BUrjl90m.js → account-service-status-DexPoUiT.js} +1 -1
- package/assets/{accounts-BKuizqtY.js → accounts-DPvTdrTr.js} +1 -1
- package/assets/advanced-CDr_JOXg.js +1 -0
- package/assets/{agenda-time-TSGSlLRN.js → agenda-time-BcOiQ5_R.js} +1 -1
- package/assets/{app-chrome-a0-5AITB.js → app-chrome-6ZXmy5H4.js} +1 -1
- package/assets/{appearance-N8-8YrHT.js → appearance-BQZnBlkc.js} +1 -1
- package/assets/{avatar-DgKc162N.js → avatar-B_QEsxCw.js} +1 -1
- package/assets/{badge-JIJtKd2K.js → badge-CeCxCmzS.js} +1 -1
- package/assets/{bottom-sheet-6SRJicmu.js → bottom-sheet-DWqGf7I3.js} +1 -1
- package/assets/{brief-xjy0DnZr.js → brief-B7EfkUB4.js} +1 -1
- package/assets/brief-NsiukvBp.js +1 -0
- package/assets/{calendar-Di5oc2bm.js → calendar-CJGXdypt.js} +1 -1
- package/assets/{calendar-D_6yFuPu.js → calendar-DxjT7IrR.js} +1 -1
- package/assets/{calendar-event-popup-ShfopMbU.js → calendar-event-popup-y4Z860B0.js} +1 -1
- package/assets/{calendar-event-sidebar-73r7iWYB.js → calendar-event-sidebar-BaAGgT2x.js} +1 -1
- package/assets/{calendar-failure-note-ue_eGWKG.js → calendar-failure-note-CJvPzX2o.js} +1 -1
- package/assets/{calendar-guests-BwFd8bsh.js → calendar-guests-DeRthr7k.js} +1 -1
- package/assets/{calendar-suggestion-CmlMj01X.js → calendar-suggestion-BulekNHV.js} +1 -1
- package/assets/{calendars-Zl5qFuho.js → calendars-D-Use38B.js} +1 -1
- package/assets/{card-CpdfeZg0.js → card-0Dzt3Scs.js} +1 -1
- package/assets/{checkbox-C3sJmmOb.js → checkbox-DIKh2-eX.js} +1 -1
- package/assets/{chevron-down-BjVAPUIZ.js → chevron-down-BnC2m4J6.js} +1 -1
- package/assets/{chevron-left-CPIlsz08.js → chevron-left-CNQ3caMn.js} +1 -1
- package/assets/{circle-check-CIFCh3Pe.js → circle-check-CTlM3FQo.js} +1 -1
- package/assets/{circle-check-big-reCDNK7n.js → circle-check-big-DCVJA_H0.js} +1 -1
- package/assets/{circle-question-mark-CcoXqBlZ.js → circle-question-mark-CpApZe3H.js} +1 -1
- package/assets/classification-C7_2tIfb.js +1 -0
- package/assets/{clock-BvslxjM5.js → clock-CTlZVcLb.js} +1 -1
- package/assets/cloud-off-CtJJ9OTh.js +1 -0
- package/assets/compose._-_outboxMessageId_-BT2RKEAF.js +1 -0
- package/assets/compose._-_outboxMessageId_-B_NGqkpg.js +1 -0
- package/assets/compose._-_outboxMessageId_-CCPr3GjM.js +1 -0
- package/assets/compose._-_outboxMessageId_-CFBNHbeY.js +1 -0
- package/assets/compose._-_outboxMessageId_-Cw-Zq1kx.js +1 -0
- package/assets/{config-import-04fOLGAf.js → config-import-CHZ9oJuF.js} +1 -1
- package/assets/{confirm-dialog-CyYTO5x5.js → confirm-dialog-Cc446-7C.js} +1 -1
- package/assets/{copy-DhCC4a-G.js → copy-jXKvwaUz.js} +1 -1
- package/assets/{credential-steps-CDQpL_Qv.js → credential-steps-yT5IXLY8.js} +1 -1
- package/assets/{download-DPsR-mx8.js → download-CyhaY4zL.js} +1 -1
- package/assets/{draft-DCLq6qco.js → draft-C1ufEqDz.js} +1 -1
- package/assets/edit-BGhTeEac.js +1 -0
- package/assets/edit-CeXJ3wiI.js +1 -0
- package/assets/{external-link-BsGep1V-.js → external-link-1TiTglgB.js} +1 -1
- package/assets/{file-braces-CplGXMNS.js → file-braces-CXZUVCry.js} +1 -1
- package/assets/filters-CR0iG1ow.js +1 -0
- package/assets/flagged-B4N5fCui.js +1 -0
- package/assets/{flagged-BIfTM0zc.js → flagged-DuEE_WUV.js} +1 -1
- package/assets/{folder-input-DiXjxyWE.js → folder-input-kcvJkrLj.js} +1 -1
- package/assets/{folders-DQc8V606.js → folders-6mmHeM8E.js} +1 -1
- package/assets/{help-copy-DZY11DWz.js → help-copy-CIhcXCo3.js} +1 -1
- package/assets/{import-BFpbM0fn.js → import-76KXkdMq.js} +1 -1
- package/assets/index-5PtybTMj.js +1 -0
- package/assets/index-B-gNDz7v.js +1 -0
- package/assets/index-B1AltYi_.js +1 -0
- package/assets/index-BX5kv92z.js +1 -0
- package/assets/index-CzMYehsR.js +1 -0
- package/assets/{index-DjD_uOHk.css → index-DS2W4dIw.css} +1 -1
- package/assets/index-DT4iQTvg.js +1 -0
- package/assets/index-DZ4zN_a2.js +1 -0
- package/assets/index-Xq-TD3Lr.js +1 -0
- package/assets/index-eKzwYumy.js +1 -0
- package/assets/index-ehMMhnu5.js +1 -0
- package/assets/{index-Ch9-pOcE.js → index-iXcp-mGT.js} +10 -10
- package/assets/index-rui9BQ_f.js +1 -0
- package/assets/index-t0gwqxwG.js +1 -0
- package/assets/index-yeSesYv-.js +213 -0
- package/assets/{kbd-87RT_Nj_.js → kbd-BVK8yKhS.js} +1 -1
- package/assets/{label-chip-DMq-zsvm.js → label-chip-CrQMhpJe.js} +1 -1
- package/assets/{labels-ra9ROlwe.js → labels-CaXUAL8B.js} +1 -1
- package/assets/{mail-Bd3Nb9N7.js → mail-CLkdzm71.js} +1 -1
- package/assets/mail-CiuTTyMm.js +1 -0
- package/assets/{menu-DPaXdm-B.js → menu-Cn2tY52U.js} +1 -1
- package/assets/{nav-link-DbsxgxMR.js → nav-link-BvlYCbp-.js} +1 -1
- package/assets/new-ZEuIlDnl.js +1 -0
- package/assets/onboarding-bCsMaIPY.js +1 -0
- package/assets/{onboarding-completion-YPHv2tnn.js → onboarding-completion-CJl9zKMA.js} +1 -1
- package/assets/outbox-BthyAXQ5.js +1 -0
- package/assets/{pencil-CUjJNGXo.js → pencil-A679n1yJ.js} +1 -1
- package/assets/{people-Dj45Sj6w.js → people-C5ni4bV_.js} +1 -1
- package/assets/{plus-DEbDoPs_.js → plus-D9A6i0pi.js} +1 -1
- package/assets/{popover-menu-mRa93JRF.js → popover-menu-wrc2e8Vk.js} +1 -1
- package/assets/{refresh-cw-CRjuvR6N.js → refresh-cw-BRmmCn_2.js} +1 -1
- package/assets/{reply-D62C8M_H.js → reply-DL5kkaJs.js} +1 -1
- package/assets/{rich-text-DuAbH45K.js → rich-text-EZFEOU8t.js} +1 -1
- package/assets/{rich-text-spellcheck-worker-provider-D7WsKeGh.js → rich-text-spellcheck-worker-provider-NOmoFs4G.js} +1 -1
- package/assets/{rotate-ccw-nJVUfniy.js → rotate-ccw-C2NtRHS-.js} +1 -1
- package/assets/{roving-focus-CSY9NYZu.js → roving-focus-CSq3MPWi.js} +1 -1
- package/assets/{row-actions-DQQOtYGX.js → row-actions-Cthc4RCY.js} +1 -1
- package/assets/{search-mirror-BXJ0y1kD.js → search-mirror-CCAs_ZWe.js} +1 -1
- package/assets/{search-scope-B_8aEz2h.js → search-scope-DaiXqXNv.js} +1 -1
- package/assets/{search-token-index-oQMvIa8e.js → search-token-index-VBBiMTaA.js} +1 -1
- package/assets/{sections-CNfPMOAR.js → sections-uFHlOXiA.js} +1 -1
- package/assets/{segmented-control-C-RwTZ8I.js → segmented-control-DNxc5Ghi.js} +1 -1
- package/assets/{select-TMp5ih6Q.js → select-B9t8348S.js} +1 -1
- package/assets/senders-uBzIqu95.js +1 -0
- package/assets/settings-BLs90wKU.js +1 -0
- package/assets/{settings-screen-DfxQ6K4C.js → settings-screen-CafoSGzb.js} +1 -1
- package/assets/shield-check-BdZGtm0z.js +1 -0
- package/assets/spam-DKjh33Xi.js +1 -0
- package/assets/{suggest-list-D8Ma2KQS.js → suggest-list-Do7i1-gb.js} +1 -1
- package/assets/{suggested-vips-D-q4Ski_.js → suggested-vips-C-je5foZ.js} +1 -1
- package/assets/suggestion._suggestionId-DF2BM_zX.js +1 -0
- package/assets/{switch-DJaDWP2C.js → switch-1RDXcNo-.js} +1 -1
- package/assets/{task._calendarTaskId-BDTL-x3M.js → task._calendarTaskId-B7k5whQt.js} +1 -1
- package/assets/{undo-2-YQhybyJt.js → undo-2-B-b8_FeJ.js} +1 -1
- package/assets/{useCalendarData-DcKv8J39.js → useCalendarData-BcNSn1yP.js} +1 -1
- package/assets/{useCalendarScheduling-BNESC6Sx.js → useCalendarScheduling-Dfk1b293.js} +1 -1
- package/assets/{useCalendarSuggestions-asjHDP2Q.js → useCalendarSuggestions-D_tk6nh4.js} +1 -1
- package/assets/{useCalendarTasks-DvRUJS7T.js → useCalendarTasks-CX2Wh1Fn.js} +1 -1
- package/assets/useClassificationSettings-Bi0m63-O.js +1 -0
- package/assets/{useDebouncedValue-Ci-c9u_d.js → useDebouncedValue-AWe2Zncy.js} +1 -1
- package/assets/{useFilters-zI-LLBh6.js → useFilters-Bp1QgyWU.js} +1 -1
- package/assets/useJunkMailboxIds-CWScvBHw.js +1 -0
- package/assets/useLabels-CGE9kc74.js +1 -0
- package/assets/{useLayoutTier-MVSmVZp-.js → useLayoutTier-D5MoTNho.js} +1 -1
- package/assets/{useMediaQuery-DyVqQyw1.js → useMediaQuery-Bf7zukl9.js} +1 -1
- package/assets/{useMessageBodyContent-Am5kUaI9.js → useMessageBodyContent-BxjoKGiE.js} +1 -1
- package/assets/{useQueries-DSE4jlRt.js → useQueries-Dj93detX.js} +1 -1
- package/assets/{useRefreshControl-Ck0n6NLI.js → useRefreshControl-DCFTdDZz.js} +1 -1
- package/assets/{useResultFolderIndex-Rs6vWQYC.js → useResultFolderIndex-DAcbTt0T.js} +1 -1
- package/assets/useSignature-CA8ypw7f.js +1 -0
- package/assets/{warnings-CyUEYIiz.js → warnings-C-blkf-m.js} +3 -3
- package/index.html +2 -2
- package/package.json +1 -1
- package/assets/BriefPane-yrb4BVCw.js +0 -1
- package/assets/CollectionPane-CxujucTw.js +0 -1
- package/assets/MailboxPane-B7qGrdvh.js +0 -135
- package/assets/MessageToolbar-BUDWthZC.js +0 -1
- package/assets/OutboxPane-DPSNZUuT.js +0 -1
- package/assets/_calendarObjectId-CEpV_AQA.js +0 -1
- package/assets/_labelId-DABFD4PZ.js +0 -1
- package/assets/_mailboxId-BRoS8Mwj.js +0 -1
- package/assets/_messageId-BTtnQ0o_.js +0 -1
- package/assets/_messageId-C0UBmFqw.js +0 -1
- package/assets/_messageId-DxeGB2Ak.js +0 -1
- package/assets/_messageId-UxNdXfkW.js +0 -1
- package/assets/_outboxMessageId-buKygU4B.js +0 -1
- package/assets/_recurrenceId-6oeOt-u4.js +0 -1
- package/assets/_slotId-F8i3-z-s.js +0 -1
- package/assets/_threadId-BxgdFrfy.js +0 -1
- package/assets/_threadId-CiXEbmEZ.js +0 -1
- package/assets/_threadId-DClgthvx.js +0 -1
- package/assets/_threadId-Dtgsuh5z.js +0 -1
- package/assets/advanced-DJpNc3kM.js +0 -1
- package/assets/brief-B2lB0FJy.js +0 -1
- package/assets/classification-B4oAmRL8.js +0 -1
- package/assets/compose._-_outboxMessageId_-BBirD1SC.js +0 -1
- package/assets/compose._-_outboxMessageId_-BXrZc_aU.js +0 -1
- package/assets/compose._-_outboxMessageId_-B_bwVs79.js +0 -1
- package/assets/compose._-_outboxMessageId_-CZX2i0CY.js +0 -1
- package/assets/compose._-_outboxMessageId_-HahCa7sA.js +0 -1
- package/assets/edit-BRJX6z-q.js +0 -1
- package/assets/edit-C3-Hl_Ov.js +0 -1
- package/assets/filters-BdDuzTmL.js +0 -1
- package/assets/flagged-BH8Kawij.js +0 -1
- package/assets/index-BG0V0va3.js +0 -1
- package/assets/index-BHkrM-Kn.js +0 -1
- package/assets/index-BTtnQ0o_.js +0 -1
- package/assets/index-BUGqdwU9.js +0 -1
- package/assets/index-C3cMdadO.js +0 -1
- package/assets/index-Cu349H81.js +0 -1
- package/assets/index-DTrFBojr.js +0 -213
- package/assets/index-DU8baGSk.js +0 -1
- package/assets/index-DdvMNVJS.js +0 -1
- package/assets/index-UxNdXfkW.js +0 -1
- package/assets/index-cDwHPIf0.js +0 -1
- package/assets/index-hxyTtlVC.js +0 -1
- package/assets/index-muoe1j5g.js +0 -1
- package/assets/mail-DZQ29OS_.js +0 -1
- package/assets/new-CcqLVf2J.js +0 -1
- package/assets/onboarding-CJFUg80G.js +0 -1
- package/assets/outbox-D-d3HzZr.js +0 -1
- package/assets/senders-Bb7Q_eFp.js +0 -1
- package/assets/settings-BIc36rPe.js +0 -1
- package/assets/shield-check-BEVo2ulB.js +0 -1
- package/assets/suggestion._suggestionId-B5pkmBKQ.js +0 -1
- package/assets/useLabels-CaeBr4vJ.js +0 -1
- package/assets/useSignature-D7iBQ4gs.js +0 -1
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import{j as i,bX as Fs,aj as q,r as c,d as xt,B as ne,S as Ds,p as Ae,x as Ls,ba as Ps,e as Rt,an as Qt,db as Bs,k as $s,f as Mt,U as Ws,V as Ks,a4 as Jt,dc as qs,cC as Vs,s as Hs,dd as Us,a as vt,de as At,df as Nt,c2 as et,Z as Qs,dg as Js,cM as Ys,I as Gs,H as Xs,T as Yt,dh as Zs,di as Gt,ci as en,dj as Xt,dk as tn,dl as sn,dm as nn,dn as on,dp as rn,az as ln,aA as an,dq as cn,dr as un,ds as dn,l as Ot,i as hn,bf as fn,Y as mn,bg as gn,bh as pn,P as Zt,a1 as xn,dt as vn,bt as bn}from"./index-yeSesYv-.js";import{S as Sn,M as yn,a as Cn,u as wn,l as Tn,b as In}from"./MailViewChrome-BDymWKX9.js";import{u as es,r as kn,a as zt,C as ts,c as ss,j as En,M as jn,t as ns,b as Rn,d as Mn,e as os,f as rs,g as An,h as Nn,i as On,n as zn,k as _n,S as Fn,l as Dn,D as Ln,m as Pn,o as Bn,p as is,q as $n,s as Wn,v as Kn,w as qn,x as Vn,y as Hn,z as Un,A as Qn,B as Jn,E as Yn,F as Gn,G as Xn,H as Wt,I as Kt,J as Zn,K as eo,L as to,N as so,O as no,P as oo,Q as ro,R as io,T as lo,U as ao,V as co,W as _t,X as uo,Y as ls,Z as as,_ as cs,$ as ho,a0 as fo,a1 as mo,a2 as go,a3 as po,a4 as xo,a5 as vo}from"./MessageToolbar-BYhqv9RG.js";import{e as tt,f as bo,g as So,h as yo,i as Co}from"./search-token-index-VBBiMTaA.js";import{u as wo}from"./useLayoutTier-D5MoTNho.js";import{u as To,a as Io,R as ko}from"./useRefreshControl-DCFTdDZz.js";import{t as Eo,L as jo,r as Ro,s as Mo}from"./LabelApplyTrigger-52QGuTLD.js";import{u as Ao,p as qt,R as No}from"./MessageBody-BeciCqb_.js";import{P as Oo,N as zo,n as _o}from"./NavMenuButton-A6v6v8tE.js";import"./nav-link-BvlYCbp-.js";import{d as Fo,g as Do,a as Lo,u as Po}from"./useMessageBodyContent-BxjoKGiE.js";import{f as Bo,r as $o,g as Wo}from"./reply-DL5kkaJs.js";import{u as Ko}from"./sections-uFHlOXiA.js";import{A as Ft}from"./avatar-B_QEsxCw.js";import{C as qo}from"./confirm-dialog-Cc446-7C.js";import{f as Vo}from"./calendar-CJGXdypt.js";import{u as Ho}from"./useJunkMailboxIds-CWScvBHw.js";import{u as Uo}from"./useLabels-CGE9kc74.js";import{a as Qo,D as Jo,u as Yo}from"./useMediaQuery-Bf7zukl9.js";import{f as Go}from"./ErrorState-Bk3DwNvd.js";import{S as bt}from"./shield-check-BdZGtm0z.js";import{B as Xo}from"./bottom-sheet-DWqGf7I3.js";import{B as us}from"./badge-CeCxCmzS.js";import{C as ds}from"./checkbox-DIKh2-eX.js";import{C as Zo}from"./chevron-down-BnC2m4J6.js";import{C as er}from"./circle-question-mark-CpApZe3H.js";import{C as tr}from"./circle-check-CTlM3FQo.js";const sr=e=>e.toLocaleString(),nr=(e,o)=>{if(e.kind==="unknown")return`Results for “${o}”`;const t=e.value===1?"result":"results";return`${sr(e.value)} ${t} for “${o}”`};function or({query:e,count:o}){return i.jsxs("div",{className:"flex items-center gap-2 border-b border-line bg-surface-sunken/30 px-3 py-2",children:[i.jsx(Fs,{className:"size-4 text-fg-muted","aria-hidden":"true"}),i.jsx("span",{className:"text-sm text-fg-muted",children:nr(o,e)})]})}var Ze;(function(e){e[e.UP=-1]="UP",e[e.DOWN=1]="DOWN"})(Ze||(Ze={}));function rr(e){var o=getComputedStyle(e).overflowY;return e===document.scrollingElement&&o==="visible"?!0:!(o!=="scroll"&&o!=="auto")}function ir(e,o){if(!rr(e))return!1;if(o===Ze.DOWN){var t=e.scrollTop+e.clientHeight;return t<e.scrollHeight}if(o===Ze.UP)return e.scrollTop>0;throw new Error("unsupported direction")}function hs(e,o){return ir(e,o)?!0:e.parentElement==null?!1:hs(e.parentElement,o)}function fs(e,o){o===void 0&&(o={});var t=o.insertAt;if(!(!e||typeof document>"u")){var s=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t==="top"&&s.firstChild?s.insertBefore(n,s.firstChild):s.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}var lr=`.lds-ellipsis {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
position: relative;
|
|
4
|
+
width: 64px;
|
|
5
|
+
height: 64px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.lds-ellipsis div {
|
|
9
|
+
position: absolute;
|
|
10
|
+
top: 27px;
|
|
11
|
+
width: 11px;
|
|
12
|
+
height: 11px;
|
|
13
|
+
border-radius: 50%;
|
|
14
|
+
background: rgb(54, 54, 54);
|
|
15
|
+
animation-timing-function: cubic-bezier(0, 1, 1, 0);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.lds-ellipsis div:nth-child(1) {
|
|
19
|
+
left: 6px;
|
|
20
|
+
animation: lds-ellipsis1 0.6s infinite;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.lds-ellipsis div:nth-child(2) {
|
|
24
|
+
left: 6px;
|
|
25
|
+
animation: lds-ellipsis2 0.6s infinite;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.lds-ellipsis div:nth-child(3) {
|
|
29
|
+
left: 26px;
|
|
30
|
+
animation: lds-ellipsis2 0.6s infinite;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.lds-ellipsis div:nth-child(4) {
|
|
34
|
+
left: 45px;
|
|
35
|
+
animation: lds-ellipsis3 0.6s infinite;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@keyframes lds-ellipsis1 {
|
|
39
|
+
0% {
|
|
40
|
+
transform: scale(0);
|
|
41
|
+
}
|
|
42
|
+
100% {
|
|
43
|
+
transform: scale(1);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
@keyframes lds-ellipsis3 {
|
|
47
|
+
0% {
|
|
48
|
+
transform: scale(1);
|
|
49
|
+
}
|
|
50
|
+
100% {
|
|
51
|
+
transform: scale(0);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
@keyframes lds-ellipsis2 {
|
|
55
|
+
0% {
|
|
56
|
+
transform: translate(0, 0);
|
|
57
|
+
}
|
|
58
|
+
100% {
|
|
59
|
+
transform: translate(19px, 0);
|
|
60
|
+
}
|
|
61
|
+
}`;fs(lr);var ar=function(){return q.createElement("div",{className:"lds-ellipsis"},q.createElement("div",null),q.createElement("div",null),q.createElement("div",null),q.createElement("div",null))},cr=function(){return q.createElement("div",null,q.createElement("p",null,"↧ pull to refresh ↧"))},ur=`.ptr,
|
|
62
|
+
.ptr__children {
|
|
63
|
+
height: 100%;
|
|
64
|
+
width: 100%;
|
|
65
|
+
overflow: hidden;
|
|
66
|
+
-webkit-overflow-scrolling: touch;
|
|
67
|
+
position: relative;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.ptr.ptr--fetch-more-treshold-breached .ptr__fetch-more {
|
|
71
|
+
display: block;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.ptr__fetch-more {
|
|
75
|
+
display: none;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Pull down transition
|
|
80
|
+
*/
|
|
81
|
+
.ptr__children,
|
|
82
|
+
.ptr__pull-down {
|
|
83
|
+
transition: transform 0.2s cubic-bezier(0, 0, 0.31, 1);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.ptr__pull-down {
|
|
87
|
+
position: absolute;
|
|
88
|
+
overflow: hidden;
|
|
89
|
+
left: 0;
|
|
90
|
+
right: 0;
|
|
91
|
+
top: 0;
|
|
92
|
+
visibility: hidden;
|
|
93
|
+
}
|
|
94
|
+
.ptr__pull-down > div {
|
|
95
|
+
display: none;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.ptr--dragging {
|
|
99
|
+
/**
|
|
100
|
+
* Hide PullMore content is treshold breached
|
|
101
|
+
*/
|
|
102
|
+
}
|
|
103
|
+
.ptr--dragging.ptr--pull-down-treshold-breached .ptr__pull-down--pull-more {
|
|
104
|
+
display: none;
|
|
105
|
+
}
|
|
106
|
+
.ptr--dragging {
|
|
107
|
+
/**
|
|
108
|
+
* Otherwize, display content
|
|
109
|
+
*/
|
|
110
|
+
}
|
|
111
|
+
.ptr--dragging .ptr__pull-down--pull-more {
|
|
112
|
+
display: block;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.ptr--pull-down-treshold-breached {
|
|
116
|
+
/**
|
|
117
|
+
* Force opacity to 1 is pull down trashold breached
|
|
118
|
+
*/
|
|
119
|
+
}
|
|
120
|
+
.ptr--pull-down-treshold-breached .ptr__pull-down {
|
|
121
|
+
opacity: 1 !important;
|
|
122
|
+
}
|
|
123
|
+
.ptr--pull-down-treshold-breached {
|
|
124
|
+
/**
|
|
125
|
+
* And display loader
|
|
126
|
+
*/
|
|
127
|
+
}
|
|
128
|
+
.ptr--pull-down-treshold-breached .ptr__pull-down--loading {
|
|
129
|
+
display: block;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.ptr__loader {
|
|
133
|
+
margin: 0 auto;
|
|
134
|
+
text-align: center;
|
|
135
|
+
}`;fs(ur);var dr=function(e){var o=e.isPullable,t=o===void 0?!0:o,s=e.canFetchMore,n=s===void 0?!1:s,r=e.onRefresh,a=e.onFetchMore,l=e.refreshingContent,u=l===void 0?q.createElement(ar,null):l,d=e.pullingContent,h=d===void 0?q.createElement(cr,null):d,g=e.children,m=e.pullDownThreshold,v=m===void 0?67:m,b=e.fetchMoreThreshold,S=b===void 0?100:b,y=e.maxPullDownDistance,p=y===void 0?95:y,x=e.resistance,E=x===void 0?1:x,T=e.backgroundColor,I=e.className,O=I===void 0?"":I,R=c.useRef(null),A=c.useRef(null),P=c.useRef(null),G=c.useRef(null),N=!1,V=!1,_=!1,F=0,ee=0;c.useEffect(function(){if(!(!t||!A||!A.current)){var j=A.current;return j.addEventListener("touchstart",B,{passive:!0}),j.addEventListener("mousedown",B),j.addEventListener("touchmove",de,{passive:!1}),j.addEventListener("mousemove",de),window.addEventListener("scroll",se),j.addEventListener("touchend",M),j.addEventListener("mouseup",M),document.body.addEventListener("mouseleave",M),function(){j.removeEventListener("touchstart",B),j.removeEventListener("mousedown",B),j.removeEventListener("touchmove",de),j.removeEventListener("mousemove",de),window.removeEventListener("scroll",se),j.removeEventListener("touchend",M),j.removeEventListener("mouseup",M),document.body.removeEventListener("mouseleave",M)}}},[g,t,r,v,p,n,S]),c.useEffect(function(){var j;if(!((j=R)===null||j===void 0)&&j.current){var U=R.current.classList.contains("ptr--fetch-more-treshold-breached");U||n&&ue()<S&&a&&(R.current.classList.add("ptr--fetch-more-treshold-breached"),V=!0,a().then(H).catch(H))}},[n,g]);var ue=function(){if(!A||!A.current)return-1;var j=window.scrollY,U=A.current.scrollHeight;return U-j-window.innerHeight},H=function(){requestAnimationFrame(function(){A.current&&(A.current.style.overflowX="hidden",A.current.style.overflowY="auto",A.current.style.transform="unset"),P.current&&(P.current.style.opacity="0"),R.current&&(R.current.classList.remove("ptr--pull-down-treshold-breached"),R.current.classList.remove("ptr--dragging"),R.current.classList.remove("ptr--fetch-more-treshold-breached")),N&&(N=!1),V&&(V=!1)})},B=function(j){_=!1,j instanceof MouseEvent&&(F=j.pageY),window.TouchEvent&&j instanceof TouchEvent&&(F=j.touches[0].pageY),ee=F,!(j.type==="touchstart"&&hs(j.target,Ze.UP))&&(A.current.getBoundingClientRect().top<0||(_=!0))},de=function(j){if(_){if(window.TouchEvent&&j instanceof TouchEvent?ee=j.touches[0].pageY:ee=j.pageY,R.current.classList.add("ptr--dragging"),ee<F){_=!1;return}j.cancelable&&j.preventDefault();var U=Math.min((ee-F)/E,p);U>=v&&(_=!0,N=!0,R.current.classList.remove("ptr--dragging"),R.current.classList.add("ptr--pull-down-treshold-breached")),!(U>=p)&&(P.current.style.opacity=(U/65).toString(),A.current.style.overflow="visible",A.current.style.transform="translate(0px, "+U+"px)",P.current.style.visibility="visible")}},se=function(j){V||n&&ue()<S&&a&&(V=!0,R.current.classList.add("ptr--fetch-more-treshold-breached"),a().then(H).catch(H))},M=function(){if(_=!1,F=0,ee=0,!N){P.current&&(P.current.style.visibility="hidden"),H();return}A.current&&(A.current.style.overflow="visible",A.current.style.transform="translate(0px, "+v+"px)"),r().then(H).catch(H)};return q.createElement("div",{className:"ptr "+O,style:{backgroundColor:T},ref:R},q.createElement("div",{className:"ptr__pull-down",ref:P},q.createElement("div",{className:"ptr__loader ptr__pull-down--loading"},u),q.createElement("div",{className:"ptr__pull-down--pull-more"},h)),q.createElement("div",{className:"ptr__children",ref:A},g,q.createElement("div",{className:"ptr__fetch-more",ref:G},q.createElement("div",{className:"ptr__loader ptr__fetch-more--loading"},u))))};const hr=({children:e,onRefresh:o,isRefreshing:t})=>Qo(Jo)?e:i.jsx(dr,{onRefresh:o,isPullable:!t,children:e}),fr=e=>e===1?"message":"messages";function mr({count:e,onReview:o,onDismiss:t,actionLabel:s="Review & rescue"}){return i.jsx(xt,{tone:"info",variant:"soft",onDismiss:t,children:i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("p",{className:"flex items-start gap-2 text-sm text-fg",children:[i.jsx(bt,{className:"mt-0.5 size-4 shrink-0 text-positive","aria-hidden":!0}),i.jsxs("span",{children:[i.jsx("span",{className:"font-semibold text-fg",children:`${e} ${fr(e)} here`})," ","may not be spam — they're from senders we can verify."]})]}),i.jsx(ne,{variant:"primary",size:"sm",onClick:o,className:"self-start",children:s})]})})}const gr=(e,o)=>e==="vip"?"vip":e==="unknown"&&o==="md"?"unknown-pill":"hidden",ms=({senderTrust:e,size:o="sm",className:t})=>{const s=gr(e,o);return s==="vip"?i.jsx(Ds,{className:Ae("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"?i.jsx("span",{className:Ae("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 pr({candidate:e,selected:o,onToggle:t,hideSender:s=!1}){const{senderName:n,senderAddress:r,subject:a,snippet:l,trustReason:u,trustSubReason:d,senderTrust:h}=e;return i.jsxs("label",{className:Ae("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:[i.jsx(ds,{className:"mt-0.5",checked:o,onChange:t,"aria-label":`${o?"Deselect":"Select"} ${s?a:`message from ${n}`}`}),!s&&i.jsx(Ft,{name:n,email:r,size:"sm"}),i.jsxs("span",{className:"min-w-0 flex-1",children:[!s&&i.jsxs("span",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"truncate text-sm font-medium text-fg",children:n}),h&&i.jsx(ms,{senderTrust:h,size:"sm"}),i.jsx("span",{className:"truncate text-2xs text-fg-subtle",children:r})]}),i.jsx("span",{className:"block truncate text-sm text-fg-muted",children:a}),i.jsx("span",{className:"block line-clamp-1 text-xs text-fg-subtle",children:l}),!s&&i.jsxs("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:[i.jsxs(us,{tone:"positive",children:[i.jsx(bt,{className:"size-3","aria-hidden":!0}),u]}),i.jsx("span",{className:"text-2xs text-fg-subtle",children:d})]})]})]})}const xr=e=>{const o=new Map,t=[];for(const s of e){const n=(s.senderAddress||s.senderName).toLowerCase(),r=o.get(n);if(r){r.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)},vr=(e,o)=>{const t=e.messages.filter(s=>o.has(s.id)).length;return t===0?"none":t===e.messages.length?"all":"some"},Vt=e=>e===1?"message":"messages";function br({group:e,selected:o,onToggleGroup:t,onToggleMessage:s}){const[n,r]=c.useState(!1),a=vr(e,o),l=e.messages.length,u=n?Zo:Ls;return i.jsxs("div",{className:Ae(a!=="none"?"bg-positive/10":"bg-surface"),children:[i.jsxs("div",{className:"flex w-full items-start gap-3 px-3 py-2.5",children:[i.jsx(ds,{className:"mt-0.5",checked:a==="all",indeterminate:a==="some",onChange:()=>t(e,a!=="all"),"aria-label":`${a==="all"?"Deselect":"Select"} all ${l} ${Vt(l)} from ${e.senderName}`}),i.jsx(Ft,{name:e.senderName,email:e.senderAddress,size:"sm"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"truncate text-sm font-medium text-fg",children:e.senderName}),e.senderTrust&&i.jsx(ms,{senderTrust:e.senderTrust,size:"sm"}),i.jsx("span",{className:"truncate text-2xs text-fg-subtle",children:e.senderAddress})]}),i.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:[i.jsxs(us,{tone:"positive",children:[i.jsx(bt,{className:"size-3","aria-hidden":!0}),e.trustReason]}),i.jsx("span",{className:"text-2xs text-fg-subtle",children:e.trustSubReason})]})]}),i.jsxs("button",{type:"button",onClick:()=>r(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:[`${l} ${Vt(l)}`,i.jsx(u,{className:"size-3.5","aria-hidden":!0})]})]}),n&&i.jsx("div",{className:"divide-y divide-line border-t border-line",children:e.messages.map(d=>i.jsx(pr,{candidate:d,selected:o.has(d.id),onToggle:()=>s(d.id),hideSender:!0},d.id))})]})}const Dt=e=>e===1?"message":"messages",Sr=(e,o)=>`Moves ${e===1?"this message":`these ${e} ${Dt(e)}`} out of Spam to ${o} now. Nothing later.`,jt=(e,o)=>e.find(t=>t.id===o)?.label??"Inbox";function yr(){return i.jsx(xt,{tone:"info",variant:"soft",children:i.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 Cr({candidates:e,selected:o,onToggle:t,onToggleGroup:s,onSelectAll:n,onSelectNone:r,onContinue:a,onCancel:l}){const[u,d]=c.useState(!1),h=o.size,g=c.useMemo(()=>xr(e),[e]);return i.jsxs("div",{className:"flex min-h-0 flex-col",children:[i.jsxs("div",{className:"px-row-inset pb-2 pt-1",children:[i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsxs("h2",{className:"flex items-center gap-2 text-sm font-semibold text-fg",children:[i.jsx(bt,{className:"size-4 text-positive","aria-hidden":!0}),"Rescue from Spam"]}),i.jsx(ne,{variant:"ghost",size:"sm",icon:i.jsx(er,{className:"size-3.5"}),onClick:()=>d(m=>!m),className:"-mr-1.5 -mt-0.5",children:"Why these?"})]}),i.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&&i.jsx("div",{className:"mt-2",children:i.jsx(yr,{})})]}),i.jsxs("div",{className:"flex items-center justify-between px-row-inset pb-1.5",children:[i.jsx("span",{className:"text-2xs font-medium text-fg-muted",children:`${h} of ${e.length} selected · ${g.length} ${g.length===1?"sender":"senders"}`}),i.jsxs("span",{className:"flex gap-1",children:[i.jsx(ne,{variant:"ghost",size:"sm",onClick:n,children:"Select all"}),i.jsx(ne,{variant:"ghost",size:"sm",onClick:r,children:"Select none"})]})]}),i.jsx("div",{className:"min-h-0 flex-1 divide-y divide-line overflow-y-auto border-y border-line",children:g.map(m=>i.jsx(br,{group:m,selected:o,onToggleGroup:s,onToggleMessage:t},m.key))}),i.jsxs("div",{className:"space-y-2 border-t border-line bg-surface px-row-inset py-3",children:[i.jsx(ne,{variant:"primary",onClick:a,className:"h-11 w-full font-semibold",children:`Continue with ${h} ${Dt(h)}`}),i.jsx(ne,{variant:"ghost",onClick:l,className:"h-11 w-full",children:"Cancel"})]})]})}function wr({count:e,folders:o,delimiter:t,destination:s,onPick:n,onMove:r,onBack:a}){const[l,u]=c.useState(!1);return i.jsxs("div",{className:"flex min-h-0 flex-col",children:[i.jsxs("div",{className:"px-row-inset pb-2 pt-1",children:[i.jsx("h2",{className:"text-sm font-semibold text-fg",children:"Where should they go?"}),i.jsx("p",{className:"mt-1 text-2xs text-fg-subtle",children:"Pick a folder, then we move them out of Spam."})]}),i.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto px-row-inset py-2",children:l?i.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden rounded-xl border border-line bg-surface",children:i.jsx(Ps,{folders:o,selectedId:s,delimiter:t,onSelect:n,onCancel:()=>u(!1)})}):i.jsxs("div",{className:"rounded-xl border border-line bg-surface-sunken p-3",children:[i.jsx("p",{className:"text-2xs text-fg-subtle",children:"Destination"}),i.jsx("p",{className:"mt-0.5 text-sm font-medium text-fg",children:jt(o,s)}),i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>u(!0),className:"mt-2 px-0",children:"Move to a different folder"})]})}),i.jsxs("div",{className:"space-y-2 border-t border-line bg-surface px-row-inset py-3",children:[i.jsx("p",{className:"text-2xs text-fg-subtle",children:Sr(e,jt(o,s))}),i.jsx(ne,{variant:"primary",onClick:r,className:"h-11 w-full font-semibold",children:`Move ${e} out of Spam`}),i.jsx(ne,{variant:"ghost",onClick:a,className:"h-11 w-full",children:"Back"})]})]})}function Tr({count:e,destinationLabel:o,onClose:t}){return i.jsxs("div",{className:"flex min-h-0 flex-col",children:[i.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 px-row-inset py-10 text-center",children:[i.jsx(tr,{className:"size-10 text-positive","aria-hidden":!0}),i.jsx("p",{className:"text-base font-semibold text-fg",children:`Moved ${e} ${Dt(e)} out of Spam.`}),i.jsx("p",{className:"text-2xs text-fg-subtle",children:`You'll find them in ${o}.`})]}),i.jsx("div",{className:"border-t border-line bg-surface px-row-inset py-3",children:i.jsx(ne,{variant:"primary",onClick:t,className:"h-11 w-full font-semibold",children:"Done"})})]})}function Ir({open:e,candidates:o,defaultDestinationId:t,availableFolders:s,delimiter:n,onConfirmMove:r,onCancel:a}){const[l,u]=c.useState("review"),[d,h]=c.useState(()=>e?new Set(o.map(T=>T.id)):new Set),[g,m]=c.useState(t),[v,b]=c.useState(0),S=c.useRef(!1);c.useEffect(()=>{e&&!S.current&&(u("review"),h(new Set(o.map(T=>T.id))),m(t),b(0)),S.current=e},[e,o,t]);const y=d.size,p=T=>{h(I=>{const O=new Set(I);return O.has(T)?O.delete(T):O.add(T),O})},x=(T,I)=>{h(O=>{const R=new Set(O);for(const A of T.messages)I?R.add(A.id):R.delete(A.id);return R})},E=()=>{const T=Array.from(d);b(T.length),r(T,g),u("done")};return i.jsxs(Xo,{open:e,onClose:a,label:"Rescue from spam",dismissLabel:"Close rescue",children:[l==="review"&&i.jsx(Cr,{candidates:o,selected:d,onToggle:p,onToggleGroup:x,onSelectAll:()=>h(new Set(o.map(T=>T.id))),onSelectNone:()=>h(new Set),onContinue:()=>u("destination"),onCancel:a}),l==="destination"&&i.jsx(wr,{count:y,folders:s,delimiter:n,destination:g,onPick:m,onMove:E,onBack:()=>u("review")}),l==="done"&&i.jsx(Tr,{count:v,destinationLabel:jt(s,g),onClose:a})]})}const kr=(e,o,t,s)=>`${e??""}|${o}|${t??""}|${s??""}`,Er=({accountId:e,mailboxId:o})=>{const t=Rt(),{pushError:s}=Qt(),{requestAppointment:n}=Bs(),{trashByAccount:r}=es(),a=e?r.get(e):void 0,l=kr(e,o,a?.mailboxId,a?.source),[u,d]=c.useState({scope:l});u.scope!==l&&d({scope:l});const h=u.scope===l?u:void 0,g=c.useCallback(()=>t.getQueryData($s())?.accounts.find(I=>I.accountId===e)?.folderAppointments.find(I=>I.role==="Trash")?.mailboxId??o,[t,e,o]),m=c.useRef(void 0),{mutateAsync:v,isPending:b}=Mt({...Us(),meta:Hs(409),onMutate:()=>(m.current=l,{scope:l,listMailboxId:g()}),onSuccess:(x,E,T)=>{T.scope===l&&d({scope:l,deletedCount:x.deletedCount})},onError:(x,E,T)=>{const I=qs(x);if(!I){s({title:"Couldn't empty Trash",detail:Vs(x),error:x});return}T?.scope===l&&d({scope:l,refusal:I})},onSettled:(x,E,T,I)=>{m.current===I?.scope&&(m.current=void 0),Ws(t,Ks([I?.listMailboxId??o])),e&&t.invalidateQueries({queryKey:Jt({path:{accountId:e}})})}}),S=c.useCallback(()=>e?(d({scope:l}),v({path:{accountId:e}}).then(()=>{},()=>{})):Promise.resolve(),[e,l,v]),y=c.useCallback(()=>{S()},[S]),p=c.useCallback(()=>{const x=h?.refusal;x&&n({accountId:x.accountId,role:x.role,reason:x.reason,action:{kind:"emptyTrash"},onAppointed:S})},[h,n,S]);return{emptyTrash:y,isEmptying:b&&m.current===l,deletedCount:h?.deletedCount,refusal:h?.refusal,repair:p}},jr="We can verify this sender";function Rr(e){const o={mailboxId:e??""},t={senderTrust:["vip","wellknown"],dkimMismatch:!1,results:!0,limit:500},{data:s}=vt({queryKey:At({path:o,query:t}),queryFn:async()=>{const r=[];let a;do{const{data:l}=await Nt({path:o,query:{...t,continuationToken:a},throwOnError:!0});r.push(...l.items??[]),a=l.continuationToken}while(a);return{items:r}},enabled:!!e,staleTime:6e4});return{candidates:(s?.items??[]).map(r=>({id:r.messageId,senderName:r.fromName||r.fromEmail||"Unknown sender",senderAddress:r.fromEmail??"",subject:r.subject||"(no subject)",snippet:r.snippet??"",trustReason:jr,trustSubReason:kn(r.senderTrust),senderTrust:r.senderTrust}))}}const Mr=6e4,Ar=({mailboxId:e,criteria:o,enabled:t})=>{const s={...o,count:!0,results:!1},{data:n}=vt({queryKey:At({path:{mailboxId:e},query:s}),queryFn:async()=>{const{data:r}=await Nt({path:{mailboxId:e},query:s,throwOnError:!0});return r},enabled:t,staleTime:Mr});return t?Eo(n?.count):{kind:"unknown"}},Nr=e=>{const o=new Set,t=[];for(const s of e)o.has(s.threadMessageId)||(o.add(s.threadMessageId),t.push(s));return t};function Or(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:et(e.updatedAt),isRead:!0}}function zr(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:et(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0,...zt(e)}}function _r({outboxMessages:e,accountId:o,imapThreads:t}){const s=e.filter(a=>a.status==="draft"&&a.accountId===o).map(Or),n=t.map(zr),r=[];return s.length>0&&r.push({id:"remit-drafts",label:"Not yet sent (Remit)",threads:s}),n.length>0&&r.push({id:"imap-drafts",label:"On the server",threads:n}),r}const Fr=({label:e,count:o})=>i.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:[i.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:e}),i.jsx("span",{className:"text-2xs text-fg-subtle tabular-nums",children:o})]}),Dr=({row:e,isSelected:o,onOpen:t,onDelete:s,isDeleting:n})=>i.jsxs("button",{type:"button",onClick:()=>t(e.id),className:Ae("group",ss({active:o})),children:[i.jsx(Xs,{className:"size-7 shrink-0 text-fg-muted mt-0.5"}),i.jsx(ts,{thread:e}),i.jsx("div",{className:"flex items-center gap-1 shrink-0",children:i.jsx("button",{type:"button",onClick:r=>{r.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:i.jsx(Yt,{className:"size-3.5"})})})]}),Lr=({row:e,isSelected:o,onOpen:t})=>{const s=!e.isRead;return i.jsxs("button",{type:"button",onClick:()=>t(e.id),className:Ae("group",ss({active:o})),children:[s&&i.jsx("span",{className:"absolute left-1.5 top-1/2 size-1.5 -translate-y-1/2 rounded-full bg-accent"}),i.jsx(Ft,{name:e.fromName,email:e.fromEmail,size:"sm"}),i.jsx(ts,{thread:e})]})};function Pr({accountId:e,selectedMessageId:o,imapThreads:t,title:s,unreadCount:n}){const r=Fo(),a=Do(),l=tt(),u=Rt(),{data:d}=vt(Qs()),h=c.useMemo(()=>_r({outboxMessages:d?.items??[],accountId:e,imapThreads:t}),[d?.items,e,t]),g=Mt({...Ys(),onSuccess:()=>{u.invalidateQueries({queryKey:Js()})}}),m=S=>{g.mutate({path:{outboxMessageId:S}})},v=S=>{const y=t.find(p=>p.messageId===S)?.threadId;y&&l({threadId:y,messageId:S})},b=h.length===0;return i.jsxs("section",{className:"flex h-full w-full flex-col bg-surface",children:[i.jsx(Oo,{title:s,leading:i.jsx(zo,{}),children:(n??0)>0&&i.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle tabular-nums",children:[n," unread"]})}),i.jsx("div",{className:"flex-1 overflow-y-auto",children:b?i.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-center px-4",children:[i.jsx(Gs,{className:"size-8 text-fg-subtle"}),i.jsx("p",{className:"text-sm font-medium text-fg",children:"No drafts"}),i.jsx("p",{className:"text-xs text-fg-subtle",children:"Messages you start composing will appear here."})]}):h.map(S=>i.jsxs("div",{children:[S.label&&i.jsx(Fr,{label:S.label,count:S.threads.length}),i.jsx("div",{className:"divide-y divide-line",children:S.threads.map(y=>S.id==="remit-drafts"?i.jsx(Dr,{row:y,isSelected:y.id===r,onOpen:a,onDelete:m,isDeleting:g.isPending},y.id):i.jsx(Lr,{row:y,isSelected:y.id===o,onOpen:v},y.id))})]},S.id))})]})}const gs=e=>e===1?"1 message":`${Gt(e)} messages`,Br=e=>({title:"Empty Trash?",description:`${gs(e)} ${e===1?"is":"are"} erased from the mail server and cannot be restored.`,confirmLabel:"Empty Trash"}),$r=(e,o={})=>{const{trashFolderLabel:t,staleFolderLabel:s}=o;if(e==="unconfirmed"){const n=Zs(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 Wr({messageCount:e,isEmptying:o,deletedCount:t,refusalReason:s,trashFolderLabel:n,staleFolderLabel:r,onEmpty:a,onRepair:l,children:u}){const[d,h]=c.useState(!1);if(e<1&&s===void 0&&t===void 0)return i.jsx(i.Fragment,{children:u});const g=s?$r(s,{trashFolderLabel:n,staleFolderLabel:r}):void 0,m=Br(e);return i.jsxs("div",{className:"relative flex h-full min-h-0 flex-col",children:[i.jsx("div",{className:"shrink-0 px-row-inset pt-2",children:i.jsxs("div",{className:"flex flex-col gap-2 rounded-md border border-line px-3 py-2",children:[i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[t!==void 0&&i.jsx("p",{className:"mr-auto text-2xs text-fg-subtle",role:"status",children:`${gs(t)} erased from the mail server.`}),i.jsx(ne,{variant:"ghost",size:"sm",icon:i.jsx(Yt,{className:"size-3.5","aria-hidden":!0}),disabled:o||e<1,"aria-busy":o,onClick:()=>h(!0),children:o?"Emptying…":"Empty Trash"})]}),g&&i.jsx(xt,{tone:"warning",variant:"soft",children:i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("p",{className:"font-semibold text-fg",children:g.headline}),i.jsx("p",{className:"text-sm",children:g.body}),i.jsx(ne,{variant:"primary",size:"sm",className:"self-start",onClick:l,children:g.actionLabel})]})})]})}),i.jsx("div",{className:"min-h-0 flex-1",children:u}),i.jsx(qo,{isOpen:d,title:m.title,description:m.description,confirmLabel:m.confirmLabel,destructive:!0,onConfirm:()=>{h(!1),a()},onCancel:()=>h(!1)})]})}function Kr(e,o,t){const s=new Array(e);return new Proxy(s,{get(n,r,a){if(typeof r=="string"){const l=r.charCodeAt(0);if(l>=48&&l<=57){const u=+r;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(r==="length")return e}return Reflect.get(n,r,a)}})}function Pe(e,o,t){let s=t.initialDeps??[],n,r=!0;function a(){const l=e();return(l.length!==s.length||l.some((d,h)=>s[h]!==d))&&(s=l,n=o(...l),t?.onChange&&!(r&&t.skipInitialOnChange)&&t.onChange(n),r=!1),n}return a.updateDeps=l=>{s=l},a}function Ht(e,o){if(e===void 0)throw new Error("Unexpected undefined");return e}const qr=(e,o)=>Math.abs(e-o)<1.01,Vr=(e,o,t)=>{let s;return function(...n){e.clearTimeout(s),s=e.setTimeout(()=>o.apply(this,n),t)}};let Xe;const kt=()=>{if(Xe!==void 0)return Xe;if(typeof navigator>"u")return Xe=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Xe=!0;const e=navigator.maxTouchPoints;return Xe=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Ut=e=>{const{offsetWidth:o,offsetHeight:t}=e;return{width:o,height:t}},Hr=e=>e,Ur=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 r=0;r<s;r++)n[r]=o+r;return n},Qr=(e,o)=>{const t=e.scrollElement;if(!t)return;const s=e.targetWindow;if(!s)return;const n=a=>{const{width:l,height:u}=a;o({width:Math.round(l),height:Math.round(u)})};if(n(Ut(t)),!s.ResizeObserver)return()=>{};const r=new s.ResizeObserver(a=>{const l=()=>{const u=a[0];if(u?.borderBoxSize){const d=u.borderBoxSize[0];if(d){n({width:d.inlineSize,height:d.blockSize});return}}n(Ut(t))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return r.observe(t,{box:"border-box"}),()=>{r.unobserve(t)}},pt={passive:!0},Jr=typeof window>"u"?!0:"onscrollend"in window,Yr=(e,o,t)=>{const s=e.scrollElement;if(!s)return;const n=e.targetWindow;if(!n)return;const r=e.options.useScrollendEvent&&Jr;let a=0;const l=r?null:Vr(n,()=>o(a,!1),e.options.isScrollingResetDelay),u=g=>()=>{a=t(s),l?.(),o(a,g)},d=u(!0),h=u(!1);return s.addEventListener("scroll",d,pt),r&&s.addEventListener("scrollend",h,pt),()=>{s.removeEventListener("scroll",d),r&&s.removeEventListener("scrollend",h)}},Gr=(e,o)=>Yr(e,o,t=>{const{horizontal:s,isRtl:n}=e.options;return s?t.scrollLeft*(n&&-1||1):t.scrollTop}),Xr=(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),r=t.itemSizeCache.get(n);if(r!==void 0)return r}return e[t.options.horizontal?"offsetWidth":"offsetHeight"]},Zr=(e,{adjustments:o=0,behavior:t},s)=>{var n,r;(r=(n=s.scrollElement)==null?void 0:n.scrollTo)==null||r.call(n,{[s.options.horizontal?"left":"top"]:e+o,behavior:t})},ei=Zr;class ti{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(r=>{const a=()=>{const l=r.target,u=this.indexFromElement(l);if(!l.isConnected){this.observer.unobserve(l);for(const[d,h]of this.elementsCache)if(h===l){this.elementsCache.delete(d);break}return}this.shouldMeasureDuringScroll(u)&&this.resizeItem(u,this.options.measureElement(l,r,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var n;(n=s())==null||n.disconnect(),t=null},observe:n=>{var r;return(r=s())==null?void 0:r.observe(n,{box:"border-box"})},unobserve:n=>{var r;return(r=s())==null?void 0:r.unobserve(n)}}})(),this.range=null,this.setOptions=t=>{var s,n;const r={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Hr,rangeExtractor:Ur,onChange:()=>{},measureElement:Xr,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 v=t[m];v!==void 0&&(r[m]=v)}const a=this.options;let l=null,u=null,d=!1;if(a!==void 0&&a.enabled&&r.enabled&&r.anchorTo==="end"&&this.scrollElement!==null){const m=a.count,v=r.count,b=this.getMeasurements(),S=m>0?((s=b[0])==null?void 0:s.key)??a.getItemKey(0):null,y=m>0?((n=b[m-1])==null?void 0:n.key)??a.getItemKey(m-1):null;if(v!==m||m>0&&v>0&&(r.getItemKey(0)!==S||r.getItemKey(v-1)!==y)){d=!0;const E=m>0?this.getVirtualItemForOffset(this.getScrollOffset())??b[0]:null;E&&(l=[E.key,this.getScrollOffset()-E.start]);const T=r.followOnAppend===!0?"auto":r.followOnAppend||null;T&&v>m&&this.isAtEnd(a.scrollEndThreshold)&&(m===0||r.getItemKey(v-1)!==y)&&(u=T)}}this.options=r,d&&(this.pendingMin=0,this.itemSizeCacheVersion++);let h=!1,g=0;if(l&&this.scrollOffset!==null){const[m,v]=l,b=this.getMeasurements(),{count:S,getItemKey:y}=this.options;let p=0;for(;p<S&&y(p)!==m;)p++;if(p<S){const x=b[p];if(x){const E=x.start+v;E!==this.scrollOffset&&(g=E-this.scrollOffset,this.scrollOffset=E,h=!0)}}}(h||u)&&(this.pendingScrollAnchor=[h?l[0]:null,h?l[1]:0,u,g])},this.notify=t=>{var s,n;(n=(s=this.options).onChange)==null||n.call(s,this,t)},this.maybeNotify=Pe(()=>(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(r=>{this.observer.observe(r)}),this.unsubs.push(this.options.observeElementRect(this,r=>{this.scrollRect=r,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(r,a)=>{if(a&&this._intendedScrollOffset===null&&r===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(r-this._intendedScrollOffset)<1.5&&(r=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;const l=this.getScrollOffset();this.scrollDirection=a?l===r?this.scrollDirection:l<r?"forward":"backward":null,this.scrollOffset=r,this.isScrolling=a,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const r=this.scrollElement,a=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},l=()=>{this._iosTouching=!1,!(!kt()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};r.addEventListener("touchstart",a,pt),r.addEventListener("touchend",l,pt),this.unsubs.push(()=>{r.removeEventListener("touchstart",a),r.removeEventListener("touchend",l),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[r,a,l,u]=n;r!==null&&!l&&(kt()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?u!==0&&(this._iosDeferredAdjustment+=u):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),l&&this.scrollToEnd({behavior:l})}},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=Pe(()=>[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,r,a,l,u,d)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMin=null,{count:t,paddingStart:s,scrollMargin:n,getItemKey:r,enabled:a,lanes:l,laneAssignmentMode:u,gap:d}),{key:!1}),this.getMeasurements=Pe(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:t,paddingStart:s,scrollMargin:n,getItemKey:r,enabled:a,lanes:l,laneAssignmentMode:u,gap:d},h)=>{const g=this.itemSizeCache;if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const p of this.laneAssignments.keys())p>=t&&this.laneAssignments.delete(p);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(p=>{this.itemSizeCache.set(p.key,p.size)}));const m=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1),l===1){const p=t*2;let x=this._flatMeasurements;if(!x||x.length<p){const I=new Float64Array(p);x&&m>0&&I.set(x.subarray(0,m*2)),x=I,this._flatMeasurements=x}let E;if(m===0)E=s+n;else{const I=m-1;E=x[I*2]+x[I*2+1]+d}for(let I=m;I<t;I++){const O=r(I),R=g.get(O),A=typeof R=="number"?R:this.options.estimateSize(I);x[I*2]=E,x[I*2+1]=A,E+=A+d}const T=Kr(t,x,r);return this.measurementsCache=T,T}const v=this.measurementsCache.slice(0,m),b=new Array(l).fill(void 0),S=new Float64Array(l);let y=0;for(let p=0;p<m;p++){const x=v[p];x&&(b[x.lane]===void 0&&y++,b[x.lane]=p,S[x.lane]=x.end)}for(let p=m;p<t;p++){const x=r(p),E=this.laneAssignments.get(p);let T,I;const O=u==="estimate"||g.has(x);if(E!==void 0&&this.options.lanes>1){T=E;const G=b[T],N=G!==void 0?v[G]:void 0;I=N?N.end+d:s+n}else if(y===l){let G=0,N=S[0],V=b[0];for(let _=1;_<l;_++){const F=S[_];(F<N||F===N&&b[_]<V)&&(G=_,N=F,V=b[_])}T=G,I=N+d,O&&this.laneAssignments.set(p,T)}else T=p%this.options.lanes,I=s+n,O&&this.laneAssignments.set(p,T);const R=g.get(x),A=typeof R=="number"?R:this.options.estimateSize(p),P=I+A;v[p]={index:p,start:I,size:A,end:P,key:x,lane:T},b[T]===void 0&&y++,b[T]=p,S[T]=P}return this.measurementsCache=v,v},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Pe(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,s,n,r)=>t.length===0||s===0?(this.range=null,null):(this.range=ni(t,s,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Pe(()=>{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,r,a)=>r===null||a===null?[]:t({startIndex:r,endIndex:a,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 r=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,n-r),l=Math.min(this.options.count-1,n+r);return t>=a&&t<=l}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((a,l)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(l))});return}const s=this.indexFromElement(t),n=this.options.getItemKey(s),r=this.elementsCache.get(n);r!==t&&(r&&this.observer.unobserve(r),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,r;if(t<0||t>=this.options.count)return;let a,l,u;const d=this._flatMeasurements;if(this.options.lanes===1&&d!==null)u=this.options.getItemKey(t),l=d[t*2],a=d[t*2+1];else{const m=this.measurementsCache[t];if(!m)return;u=m.key,l=m.start,a=m.size}const h=this.itemSizeCache.get(u)??a,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,v=m?this.getTotalSize():0,b=((r=this.scrollState)==null?void 0:r.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t]??{index:t,key:u,start:l,size:a,end:l+a,lane:0},g,this):l<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()-v):b&&this.applyScrollAdjustment(g),this.notify(!1)}},this.getVirtualItems=Pe(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,s)=>{const n=[];for(let r=0,a=t.length;r<a;r++){const l=t[r],u=s[l];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,r=this.options.lanes===1&&n!=null,a=ps(0,s.length-1,r?l=>n[l*2]:l=>Ht(s[l]).start,t);return Ht(s[a])},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 r=this.getSize(),a=this.getScrollOffset();s==="auto"&&(s=t>=a+r?"end":"start"),s==="center"?t+=(n-r)/2:s==="end"&&(t-=r);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,t),0)},this.getOffsetForIndex=(t,s="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const n=this.getSize(),r=this.getScrollOffset(),a=this.measurementsCache[t];if(!a)return;if(s==="auto")if(a.end>=r+n-this.options.scrollPaddingEnd)s="end";else if(a.start<=r+this.options.scrollPaddingStart)s="start";else return[r,s];if(s==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),s];const l=s==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,s,a.size),s]},this.scrollToOffset=(t,{align:s="start",behavior:n="auto"}={})=>{const r=this.getOffsetForAlignment(t,s),a=this.now();this.scrollState={index:null,align:s,behavior:n,startedAt:a,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{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 r=this.getOffsetForIndex(t,s);if(!r)return;const[a,l]=r,u=this.now();this.scrollState={index:t,align:l,behavior:n,startedAt:u,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:s="auto"}={})=>{const n=this.getScrollOffset()+t,r=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:r,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 r=s.length-1,a=this._flatMeasurements;a!=null?n=a[r*2]+a[r*2+1]:n=((t=s[r])==null?void 0:t.end)??0}else{const r=Array(this.options.lanes).fill(null);let a=s.length-1;for(;a>=0&&r.some(l=>l===null);){const l=s[a];r[l.lane]===null&&(r[l.lane]=l.end),a--}n=Math.max(...r.filter(l=>l!==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,r=1,a=n!==this.scrollState.lastTargetOffset;if(!a&&qr(n,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=r){this.getScrollOffset()!==n&&this._scrollToOffset(n,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,a){const l=this.getSize()||600,u=Math.abs(n-this.getScrollOffset()),d=this.scrollState.behavior==="smooth"&&u>l;this.scrollState.lastTargetOffset=n,d||(this.scrollState.behavior="auto"),this._scrollToOffset(n,{adjustments:void 0,behavior:d?"smooth":"auto"})}this.scheduleScrollReconcile()}}const ps=(e,o,t,s)=>{for(;e<=o;){const n=(e+o)/2|0,r=t(n);if(r<s)e=n+1;else if(r>s)o=n-1;else return n}return e>0?e-1:0};function si(e,o,t){let s=0;for(;s<=o;){const n=(s+o)/2|0,r=e[n*2];if(r<t)s=n+1;else if(r>t)o=n-1;else return n}return s>0?s-1:0}function ni(e,o,t,s,n){const r=e.length-1;if(e.length<=s)return{startIndex:0,endIndex:r};if(s===1&&n!==null){const d=si(n,r,t);let h=d;const g=t+o;for(;h<r&&n[h*2]+n[h*2+1]<g;)h++;return{startIndex:d,endIndex:h}}let l=ps(0,r,d=>e[d].start,t),u=l;if(s===1)for(;u<r&&e[u].end<t+o;)u++;else if(s>1){const d=Array(s).fill(0);for(;u<r&&d.some(g=>g<t+o);){const g=e[u];d[g.lane]=g.end,u++}const h=Array(s).fill(t+o);for(;l>=0&&h.some(g=>g>=t);){const g=e[l];h[g.lane]=g.start,l--}l=Math.max(0,l-l%s),u=Math.min(r,u+(s-1-u%s))}return{startIndex:l,endIndex:u}}const Et=typeof document<"u"?c.useLayoutEffect:c.useEffect;function oi({useFlushSync:e=!0,directDomUpdates:o=!1,directDomUpdatesMode:t="transform",...s}){const n=c.useReducer(d=>d+1,0)[1],r=c.useRef({enabled:o,mode:t,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});r.current.enabled=o,r.current.mode=t;const a=d=>{const h=r.current;if(!h.enabled||!h.container)return;const g=d.getTotalSize();if(g!==h.lastSize){h.lastSize=g;const p=d.options.horizontal?"width":"height";h.container.style[p]=`${g}px`}const m=!!d.options.horizontal,v=h.mode==="transform",b=m?"left":"top",S=d.options.scrollMargin,y=d.getVirtualItems();for(const p of y){const x=p.start-S,E=d.elementsCache.get(p.key);E&&h.lastPositions.get(E)!==x&&(h.lastPositions.set(E,x),v?E.style.transform=m?`translate3d(${x}px, 0, 0)`:`translate3d(0, ${x}px, 0)`:E.style[b]=`${x}px`)}},l={...s,onChange:(d,h)=>{var g;const m=r.current;let v=!0;if(m.enabled){a(d);const b=d.range,S=m.prevRange;v=!S||S.isScrolling!==d.isScrolling||S.startIndex!==b?.startIndex||S.endIndex!==b?.endIndex,v&&(m.prevRange=b?{startIndex:b.startIndex,endIndex:b.endIndex,isScrolling:d.isScrolling}:null)}v&&(e&&h?en.flushSync(n):n()),(g=s.onChange)==null||g.call(s,d,h)}},[u]=c.useState(()=>{const d=new ti(l);return Object.assign(d,{containerRef:h=>{const g=r.current;if(g.container=h,g.lastSize=null,h&&g.enabled){const m=d.getTotalSize();g.lastSize=m;const v=d.options.horizontal?"width":"height";h.style[v]=`${m}px`}}})});return u.setOptions(l),Et(()=>u._didMount(),[]),Et(()=>u._willUpdate()),Et(()=>{a(u)}),u}function ri(e){return oi({observeElementRect:Qr,observeElementOffset:Gr,scrollToFn:ei,...e})}const Lt=e=>e.query?`matching "${e.query}"`:e.from?`from "${e.from}"`:"matching your search",ii=e=>`Select all ${Lt(e)}`,li=(e,o)=>`All ${Gt(o)} ${Lt(e)} selected`,ai=({verb:e,confirmingDelete:o,hasSelection:t,junkMailboxId:s,currentMailboxId:n,deletableMessageId:r})=>{if(o)return{kind:"withheld"};if(e==="junk"){const a=En(s,n);if(a!==void 0)return{kind:"unavailable",reason:a}}return t?{kind:"openWizard"}:e!=="delete"||r===void 0?{kind:"declined"}:{kind:"confirmDelete",messageId:r}},ci=(e,o,t)=>e==="BACK"&&o&&t===void 0,ui=(e,o,t)=>({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:et(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0,trust:e.senderTrust,category:ns(e.category),messageCount:t,spam:Xt(e,o),labels:e.labels,...zt(e)}),di=({thread:e,mailboxId:o,junkMailboxIds:t,isSelected:s,isFocused:n,isTabStop:r,onFocusRow:a,isChecked:l,onToggleCheck:u,onRowSelect:d,messageCount:h,isMultiSelectMode:g,onLongPress:m,isDesktop:v,density:b})=>i.jsx(jn,{thread:ui(e,t,h),link:{mailboxId:o,threadId:e.threadId},inListbox:!0,active:s,focused:n,isTabStop:r,density:b,isDesktop:v,onFocusRow:a,selection:{isChecked:l,onToggleCheck:u,onRowSelect:d,isMultiSelectMode:g,onLongPress:m}}),hi=c.memo(di),fi=(e,o)=>({id:e.messageId,accountId:e.accountId,fromName:e.fromName??e.fromEmail??"Unknown",fromEmail:e.fromEmail??"",subject:e.subject??"(No subject)",snippet:e.snippet??"",timeLabel:et(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0,trust:e.senderTrust,category:ns(e.category),spam:Xt(e,o),...zt(e)}),mi=({thread:e,mailboxId:o,junkMailboxIds:t,isSelected:s,isFocused:n,isTabStop:r,onFocusRow:a,isChecked:l,onToggleCheck:u,onRowSelect:d,isMultiSelectMode:h,onLongPress:g,isDesktop:m,onDelete:v,onToggleRead:b,density:S})=>{const[y,p]=c.useState("none"),x=tt(),E=c.useCallback(A=>{navigator.vibrate?.(10),A==="trailing"?v(e.messageId):b(e.messageId,e.isRead),p("none")},[v,b,e.messageId,e.isRead]),T=c.useCallback(()=>{g(e.messageId)},[g,e.messageId]),I=c.useCallback(()=>{u(e.messageId)},[u,e.messageId]),O=c.useCallback(()=>{x({threadId:e.threadId,messageId:e.messageId})},[x,e.threadId,e.messageId]),R=Rn(e.messageId,d);return m||h?i.jsx(hi,{thread:e,mailboxId:o,junkMailboxIds:t,isSelected:s,isFocused:n,isTabStop:r,onFocusRow:a,isChecked:l,onToggleCheck:u,onRowSelect:d,isMultiSelectMode:h,onLongPress:g,isDesktop:m,density:S}):i.jsx("div",{role:"presentation",onPointerDownCapture:R.onMouseDown,onClickCapture:R.claimClick,onContextMenu:R.onContextMenu,children:i.jsx(Sn,{thread:fi(e,t),selectionMode:!1,checked:!1,active:s,peek:y,onPeek:p,onToggleCheck:I,onLongPress:T,onOpen:O,onAct:E})})},gi=72,pi=32,xi=5,xs="remit:list-density",vi=()=>{try{const e=localStorage.getItem(xs);if(e==="compact"||e==="comfortable")return e}catch{}return"comfortable"},bi=(e,o,t)=>Ro(e.filter(s=>o.has(s.messageId)).map(s=>s.accountId??t)).moveDisabledHint,Si=({mailboxId:e,threads:o,selectedMessageId:t,isLoading:s,isError:n=!1,error:r,onRetry:a,searchQuery:l,searchPredicate:u,resultCount:d={kind:"unknown"},onDeleteMessages:h,isDeleting:g=!1,isMoving:m=!1,onLoadMore:v,hasMore:b=!1,isLoadingMore:S=!1,accountId:y,listTitle:p,listMeta:x,listFilter:E,listSearchText:T,listScopeLabel:I,onTriageContextChange:O,commandsRef:R,hideHeader:A=!1})=>{const P=c.useRef(null),G=tt(),N=Yo(),V=tn(),{verb:_,start:F,startFromSearch:ee}=V,ue=sn(),H=!!l?.trim(),B=Mn(),{labels:de}=Uo(y),{pushError:se}=Qt(),[M,j]=c.useState(t),[U,ke]=c.useState(),L=c.useCallback(f=>{ke(C=>C===f?C:void 0),j(f)},[]),[oe,Be]=c.useState(vi),Q=c.useCallback(()=>{Be(f=>{const C=f==="comfortable"?"compact":"comfortable";try{localStorage.setItem(xs,C)}catch{}return C})},[]),{toggleReadFor:Ee}=os({mailboxId:e}),{junkMailboxId:be}=rs(y),Se=is(be,e),Ne=c.useMemo(()=>[{accountId:y,mailboxId:e}],[y,e]),{outcome:he,staleFolderLabel:$e,guessedMailboxId:We}=An(Ne),{selectedIds:D,selectedCount:$,hasSelection:re,isSelected:ie,toggle:le,select:ae,clearSelection:je,selectRange:ye,setAnchor:Oe,selectAll:Ke,toggleAll:fe,intersectWith:st}=Nn(),qe=Bn($,N),[Ce,z]=c.useState(null),nt=c.useCallback((f,C,ve)=>{const Z=nn(f,C,ve,he);Z&&se(Z)},[se,he]),Re=H&&!!u,ot=`${e}|${JSON.stringify(u??{})}`,k=On({mailboxId:e,mailboxLabel:p,accountId:y,enabled:Re,predicateKey:ot,searchQuery:u??{},reportEnding:nt}),rt=k.phase.kind,Ve=k.clear,K=c.useCallback(()=>{rt==="escalated"&&Ve(),je()},[je,Ve,rt]),[it,me]=c.useState(null),we=c.useRef(null),ge=c.useRef(!1),ze=c.useRef(null),Me=!s&&o.length>0,pe=ri({count:o.length,getScrollElement:()=>P.current,estimateSize:()=>oe==="compact"?pi:gi,overscan:xi}),He=t?o.findIndex(f=>f.messageId===t):-1,J=M?o.findIndex(f=>f.messageId===M):-1,ce=c.useCallback(f=>{if(f<0||f>=o.length)return;const C=o[f];if(qe){le(C.messageId);return}we.current=C.messageId,ge.current=!1,ke(C.messageId),j(C.messageId)},[o,qe,le]),_e=c.useCallback(()=>{if(o.length===0)return;const f=J<0?0:Math.min(J+1,o.length-1);ce(f)},[o.length,J,ce]),lt=c.useCallback(()=>{if(o.length===0)return;const f=J<=0?0:J-1;ce(f)},[o.length,J,ce]),Ue=c.useCallback(()=>ce(0),[ce]),Qe=c.useCallback(()=>ce(o.length-1),[ce,o.length]),Te=c.useCallback(()=>{M&&le(M)},[M,le]),W=c.useMemo(()=>o.map(f=>f.messageId),[o]),Fe=c.useMemo(()=>{const f=[];for(const C of o)D.has(C.messageId)&&f.push({id:C.messageId,sender:C.fromName??C.fromEmail??"Unknown",email:C.fromEmail??"",subject:C.subject??"(No subject)",date:et(C.sentDate),accountId:y,mailboxId:C.mailboxId});return f},[o,D,y]),at=on(),ct=Ho(),yt=at?()=>at.checkAgain(o.filter(f=>D.has(f.messageId)).map(f=>dn(f,ct)),{panel:!0}):void 0,Ie=c.useCallback((f,C)=>C.shiftKey?(ye(W,f,M),!0):C.metaKey||C.ctrlKey?(le(f),!0):(K(),Oe(f),!1),[W,M,ye,le,K,Oe]),ut=c.useCallback(f=>{!h||f.length===0||(ze.current=M??null,z(f))},[h,M]),De=c.useCallback(f=>{const C=zn(W,M,f);C!==void 0&&(ye(W,C),we.current=C,ge.current=!1,ke(void 0),j(C))},[W,M,ye]),dt=c.useCallback(()=>De(-1),[De]),ht=c.useCallback(()=>De(1),[De]),ft=c.useCallback(()=>{W.length>0&&Ke(W)},[W,Ke]),mt=c.useCallback(f=>{const C=ai({verb:f,confirmingDelete:Ce!==null,hasSelection:re,junkMailboxId:be,currentMailboxId:e,deletableMessageId:h?M:void 0});return C.kind==="openWizard"?(F(f),!0):C.kind==="confirmDelete"?(ut([C.messageId]),!0):C.kind==="unavailable"?(se({severity:"warning",title:C.reason}),!0):C.kind==="withheld"},[Ce,h,re,be,e,F,M,ut,se]),xe=c.useCallback((f,C)=>{const ve=o.find(Z=>Z.messageId===f)?.threadId;ve&&G({threadId:ve,messageId:f},{replace:C?.replace})},[G,o]),Je=c.useCallback(()=>{M&&xe(M)},[M,xe]),Le=c.useRef(void 0),Ct=c.useCallback(f=>{Le.current=f,xe(f,{replace:!0})},[xe]);_n({keyboardFocusedMessageId:U,openMessageId:t,enabled:N&&$===0,open:Ct});const Ye=k.phase.kind==="escalated"?{scope:Lt(u??{}),total:k.phase.total,searchQuery:u??{},run:(f,C)=>k.runAction(f,void 0,C),stop:k.stop}:void 0,wt=c.useCallback(f=>{if(f.length===0){z(null);return}const C=new Set(f),ve=o.findIndex(te=>C.has(te.messageId));let Z;for(let te=ve+1;te<o.length;te++)if(!C.has(o[te].messageId)){Z=o[te].messageId;break}if(Z===void 0){for(let te=ve-1;te>=0;te--)if(!C.has(o[te].messageId)){Z=o[te].messageId;break}}h?.(f),K(),ze.current=null,z(null),Z!==void 0&&(we.current=Z,ge.current=!1,L(Z),N&&xe(Z,{replace:!0})),N||me(rn("delete",f.length,he))},[o,h,K,xe,N,L,he]),gt=c.useCallback(()=>{const f=ze.current;ze.current=null,z(null),f!==null&&(we.current=f,ge.current=!1,L(f))},[L]),Ge=c.useMemo(()=>bi(o,D,y),[y,D,o]),w=c.useCallback(()=>{if(Ye){ee();return}F("organize")},[Ye,ee,F]),X=c.useCallback(f=>{h?.([f])},[h]),Y=c.useCallback((f,C)=>{Ee([f],!C)},[Ee]),Ss=c.useCallback(f=>{N||ae(f)},[N,ae]),ys=c.useCallback(()=>{if(k.isRunning||k.phase.kind==="counting"){k.stop();return}K()},[k,K]),Cs=c.useCallback(()=>{k.clear()},[k]);c.useEffect(()=>{if(ge.current||!N&&t)return;const f=J>=0?J:He;f>=0&&pe.scrollToIndex(f,{align:"auto"})},[J,He,pe,N,t]),c.useEffect(()=>{if(!t)return;const f=Le.current===t;Le.current=void 0,!f&&(ge.current=!1,L(t))},[t,L]),c.useEffect(()=>{M&&(o.some(f=>f.messageId===M)||L(o[0]?.messageId))},[o,M,L]),c.useEffect(()=>{O?.({focusedMessageId:M,selectedIds:Array.from(D),hasList:Me})},[M,D,Me,O]);const Pt=c.useRef(O);Pt.current=O,c.useEffect(()=>()=>Pt.current?.({focusedMessageId:void 0,selectedIds:[],hasList:!1}),[]),c.useEffect(()=>{k.phase.kind!=="idle"||k.isRunning||st(o.map(f=>f.messageId))},[o,st,k.phase,k.isRunning]);const Bt=c.useRef(e);c.useEffect(()=>{Bt.current!==e&&(Bt.current=e,K())},[e,K]),Vo({shouldBlockFn:({action:f})=>ci(f,re,ue)?(K(),!0):!1,enableBeforeUnload:!1,disabled:!re||ue!==void 0}),c.useEffect(()=>{const f=P.current;if(!f||!b||!v)return;const C=()=>{if(S)return;const{scrollTop:ve,scrollHeight:Z,clientHeight:te}=f;ve+te>=Z-200&&v()};return f.addEventListener("scroll",C,{passive:!0}),C(),()=>f.removeEventListener("scroll",C)},[b,S,v]),c.useEffect(()=>{const f=we.current;if(!f)return;const C=P.current?.querySelector(`[data-message-id="${f}"]`);C&&(we.current=null,C.focus({preventScroll:!0}))}),c.useEffect(()=>{if(R){if(!Me){R.current=null;return}return R.current={focusNext:_e,focusPrevious:lt,focusFirst:Ue,focusLast:Qe,openFocused:Je,toggleSelect:Te,extendSelectDown:ht,extendSelectUp:dt,selectAll:ft,clearSelection:()=>re?(K(),!0):!1,requestVerb:mt,toggleDensity:Q},()=>{R.current=null}}},[R,Me,_e,lt,Ue,Qe,Je,Te,ht,dt,ft,re,K,mt,Q]);const $t=s?"loading":n?"error":o.length===0?"empty":"ready",ws=n?Go(r):void 0,Ts=c.useCallback(()=>{const f=ln(an());window.open(f,"_blank","noopener,noreferrer")},[]),Is=[{id:"inbox",threads:[]}],Tt=W.length>0&&W.every(f=>D.has(f)),ks=Re&&b&&Tt&&!g&&!m&&k.phase.kind==="idle"&&!k.isRunning,Es=g||m||k.isRunning,It=k.phase.kind==="escalated"?k.phase.total:k.progress?k.progress.total:$,js=k.runningAction?cn(k.runningAction.kind,k.progress?.done??0,k.progress?.total??It):k.phase.kind==="counting"?"Counting matches…":k.phase.kind==="escalated"?li(u??{},k.phase.total):void 0,Rs=k.phase.kind!=="escalated"&&W.length>0?{checked:Tt,indeterminate:$>0&&!Tt,onChange:()=>fe(W)}:void 0,Ms=k.runningAction?{value:k.progress?.done??0,max:k.progress?.total??It,tone:un(k.runningAction.kind)}:void 0,As=(k.isRunning||k.phase.kind==="counting"?{tone:"info",text:"",action:{label:"Stop",onClick:k.stop}}:k.phase.kind==="escalated"?{tone:"info",text:"",action:{label:"Clear selection",onClick:Cs}}:ks?{tone:"info",text:"",action:{label:ii(u??{}),onClick:k.escalate}}:void 0)??(Ge?{tone:"warning",text:Ge}:void 0),Ns=i.jsx(Fn,{title:B.title||p,navSlot:B.navSlot,titleMeta:B.titleMeta,searchSlot:B.searchSlot,searchField:B.searchField,idleSlot:B.makeFilterSlot,count:It,onCancel:ys,onDelete:()=>F("delete"),onMove:()=>F("move"),onOrganize:w,onJunk:Se?()=>F("junk"):void 0,onMarkRead:()=>F("markRead"),onCheckAgain:yt,overflowSlot:y&&e&&$>0&&de.length>0?i.jsx(jo,{accountId:y,mailboxId:e,messageIds:Array.from(D)}):void 0,isBusy:Es,isCounting:k.phase.kind==="counting",selectAll:Rs,statusLabel:js,progress:Ms,notice:As}),Os=Dn(W,M),zs=c.useCallback(f=>{ge.current=!0,L(f)},[L]),_s=i.jsxs(i.Fragment,{children:[H&&l&&i.jsx(or,{query:l,count:d}),i.jsxs("div",{ref:P,role:"listbox","aria-multiselectable":!0,"aria-label":p,className:"flex-1 overflow-y-auto",children:[i.jsx("div",{role:"presentation",className:"relative w-full",style:{height:`${pe.getTotalSize()}px`},children:pe.getVirtualItems().map(f=>{const C=o[f.index];return i.jsx("div",{role:"presentation","data-index":f.index,ref:pe.measureElement,className:Ae("absolute left-0 top-0 w-full border-b border-line",k.isRunning&&"pointer-events-none opacity-50"),style:{transform:`translateY(${f.start}px)`},children:i.jsx(mi,{thread:C,mailboxId:e,junkMailboxIds:ct,isSelected:t===C.messageId,isFocused:M===C.messageId,isTabStop:Os===C.messageId,onFocusRow:zs,isChecked:ie(C.messageId),onToggleCheck:le,onRowSelect:Ie,isMultiSelectMode:qe,onLongPress:Ss,isDesktop:N,onDelete:X,onToggleRead:Y,density:oe})},f.key)})}),S&&i.jsx(yn,{})]})]});return i.jsxs(i.Fragment,{children:[it&&!N&&i.jsx(xt,{tone:"success",variant:"soft",className:"m-2 rounded-md",onDismiss:()=>me(null),children:it}),i.jsx(Cn,{listTitle:p,listMeta:x,sections:Is,flatList:!0,listState:B.searchResults?"ready":$t,searchQuery:T,listFilter:E,listScopeLabel:I,errorMessage:ws,onRetry:a,onReportError:Ts,density:oe,selectedThreadId:t,onSelectThread:f=>xe(f),isDesktop:N,hideHeader:A,selectionBar:Ns,listBody:B.searchResults??($t==="ready"?_s:void 0)}),i.jsx(Ln,{isOpen:Ce!==null,messageIds:Ce??[],outcome:he,accountId:y,trashFolderLabel:p,staleFolderLabel:$e,guessedMailboxId:We,isDeleting:g,onConfirm:wt,onCancel:gt}),i.jsx(Pn,{verb:_,accountId:y,mailboxId:e,mailboxLabel:p,selection:Fe,selectionRestriction:Ge?"spansAccounts":void 0,escalated:Ye,escalatedProgress:k.progress,onFinished:K,onRunEnded:nt})]})},yi=e=>Jt({path:{accountId:e}}),Ci=e=>{const o=Rt(),t=Ot(),s=Mt({...hn(),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}},wi=({accountId:e,children:o})=>{const{triggerAsync:t,isPending:s}=Ci(e);return i.jsx(hr,{onRefresh:t,isRefreshing:s,children:o})};function Ti({accountId:e,currentMailboxId:o,candidates:t,onMove:s,children:n}){const[r,a]=c.useState(!1),l=Ot(),u=fn(),{inboxMailboxId:d}=$n(e),h=Wn(e),{data:g}=vt({...mn({path:{accountId:e}}),staleTime:1/0}),m=c.useMemo(()=>gn({mailboxes:g?.items??[],folderAppointments:h,currentMailboxId:o,translator:u}),[g?.items,h,o,u]),v=c.useMemo(()=>d||(m.find(x=>x.label.toLowerCase()==="inbox")?.id??m.find(x=>!x.isCurrent)?.id??""),[d,m]),b=c.useRef(!1);c.useEffect(()=>{b.current||(b.current=!0,Kn(l,t.length))},[l,t.length]);const S=c.useCallback(()=>{qn(l,t.length),a(!0)},[l,t.length]),y=c.useCallback((p,x)=>{Vn(l,{selected:p.length,total:t.length,toInbox:x===d}),s(p,x)},[l,t.length,d,s]);return i.jsxs("div",{className:"relative flex h-full min-h-0 flex-col",children:[i.jsx("div",{className:"shrink-0 px-row-inset pt-2",children:i.jsx(mr,{count:t.length,onReview:S})}),i.jsx("div",{className:"min-h-0 flex-1",children:n}),i.jsx(Ir,{open:r,candidates:t,defaultDestinationId:v,availableFolders:m,delimiter:pn(g?.items??[]),onConfirmMove:y,onCancel:()=>a(!1)})]})}const Ii=50,vs=c.createContext(null);function St(){const e=c.useContext(vs);if(!e)throw new Error("MailboxPane.* must be used inside <MailboxPane>");return e}function ki({mailboxId:e,thread:o,children:t}){const s=tt(),n=bo(),r=Ko(),a=o?.threadId,l=o?.messageId,u=Ot(),{accounts:d,searchQuery:h,onToggleIntelligence:g,onSearchClearQuery:m}=Zt(),v=Ao(),b=_o(h),S=b.length>0,{freeText:y,tokens:p}=qt(b,v),x=qt(h.trim(),v).freeText,[E,T]=c.useState("all"),[I,O]=c.useState(new Set),R=c.useMemo(()=>({category:E,attributes:I}),[E,I]),A=c.useMemo(()=>Hn(R),[R]),P=S||Un(R),{params:G,residual:N}=Qn(p,A),V={order:"desc",...y?{query:y}:{},...G,...A},_={...V,limit:Ii},F={category:_.category,unread:_.unread,starred:_.starred,attachments:_.attachments},ee=P?At({path:{mailboxId:e},query:_}):xn({path:{mailboxId:e},query:{order:"desc"}}),{data:ue,isLoading:H,isError:B,error:de,refetch:se,fetchNextPage:M,hasNextPage:j,isFetchingNextPage:U}=wn({queryKey:ee,queryFn:async({pageParam:w})=>{if(P){const{data:Y}=await Nt({path:{mailboxId:e},query:{..._,continuationToken:w},throwOnError:!0});return Y}const{data:X}=await bn({path:{mailboxId:e},query:{order:"desc",continuationToken:w},throwOnError:!0});return X},initialPageParam:void 0,getNextPageParam:w=>w.continuationToken,placeholderData:(w,X)=>vo(X?.queryKey,F)?w:void 0}),ke=Ar({mailboxId:e,criteria:V,enabled:Mo({hasSearchQuery:S,freeText:y,residualTokenCount:N.length})}),{accountId:L,isLoading:oe}=Jn(e),Be=So({accounts:d}),Q=Yn(Nr(ue?.pages.flatMap(w=>w.items??[])??[]),N,L),Ee=c.useCallback(w=>{T(w)},[]),be=c.useCallback(w=>{O(X=>{const Y=new Set(X);return Y.has(w)?Y.delete(w):Y.add(w),Y})},[]),Se=c.useCallback(()=>{T("all"),O(new Set)},[]),Ne=c.useCallback(()=>{Se(),m()},[Se,m]),he=Tn({chips:R,tokens:p,reach:N.length>0?"loaded-pages":Gn(_),onClear:Ne}),$e=a?Q.find(w=>w.messageId===l)??Q.find(w=>w.threadId===a):void 0,We=Xn(a,l),D=$e??We,$=l??D?.messageId,re=c.useMemo(()=>{if(a)return{threadId:a,mailboxId:D?.mailboxId??e,subject:D?.subject,messageId:$,row:D}},[a,D,$,e]),ie=c.useCallback(w=>{$&&w.includes($)&&n()},[$,n]),{deleteMessages:le,isPending:ae}=Wt({mailboxId:e,onAfterOptimisticRemove:ie}),{moveMessages:je,isPending:ye}=Kt({mailboxId:e,accountId:L,onAfterOptimisticRemove:ie}),Oe=c.useRef(null),Ke=Zn(),{listCommandsRef:fe,onTriageContextChange:st,focusedMessageId:qe,selectedIds:Ce}=Ke,z=Q.find(w=>w.messageId===qe)??D,nt=yo({accounts:d})??null,Re=eo({thread:D,isOpen:!0,mailboxId:e,accountId:L,onAfterOptimisticRemove:ie}),{draftsMailboxId:ot}=to(L),k=ot!==void 0&&ot===e,{archiveMailboxId:rt}=so(L),Ve=no(),K=Bo(),it=c.useMemo(()=>$o(K,a,$),[K,a,$]),me=c.useMemo(()=>{if(z)return w=>K({threadId:z.threadId,messageId:z.messageId,mode:w})},[K,z]),we=Lo(),ge=Wo(),ze=Po(),Me=c.useCallback(w=>w?Ve(w):[],[Ve]),{toggleStar:pe}=oo({threadId:z?.threadId??"",mailboxId:e}),{toggleReadFor:He}=os({mailboxId:e,accountId:L}),{junkMailboxId:J}=rs(L),ce=J!=null&&J===e,_e=is(J,e),{candidates:lt}=Rr(ce?J:void 0),{moveMessages:Ue}=Kt({mailboxId:e,threadId:z?.threadId,accountId:L,onAfterOptimisticRemove:ie}),{deleteMessages:Qe}=Wt({mailboxId:e,threadId:z?.threadId,onAfterOptimisticRemove:ie}),{addressId:Te,address:W}=ro(z),{updateFlags:Fe}=io({addressId:Te,senderEmail:z?.fromEmail??void 0}),at=c.useCallback(()=>me?.("reply"),[me]),ct=c.useCallback(()=>me?.("reply-all"),[me]),yt=c.useCallback(()=>me?.("forward"),[me]),Ie=c.useCallback(()=>Me(z),[Me,z]),ut=c.useCallback(()=>{if(fe.current?.requestVerb("delete"))return;const w=Ie();w.length>0&&Qe(w)},[fe,Ie,Qe]),De=c.useCallback(()=>{if(fe.current?.requestVerb("junk")||!_e)return;const w=Ie();w.length!==0&&(lo(u,{count:w.length,senderTrust:z?.senderTrust??"unknown",wasRescuable:z?ao(z):!1}),Ue(w,_e))},[fe,_e,Ie,Ue,u,z]),dt=c.useCallback(()=>{if(Ce.length>0){const w=!(z?.hasStars??!1),X=new Set(Ce);for(const Y of Q)X.has(Y.messageId)&&Y.hasStars!==w&&pe(Y.messageId,Y.hasStars);return}z&&pe(z.messageId,z.hasStars)},[Ce,Q,z,pe]),ht=c.useCallback(()=>{if(fe.current?.requestVerb("markRead"))return;const w=Ie();if(w.length===0)return;const X=!(z?.isRead??!1);He(w,X)},[fe,Ie,z,He]),ft=c.useCallback(()=>{if(!Te)return;const w=W?.flags?.muted?.value!==!0;Fe({muted:{value:w}})},[Te,W,Fe]),mt=c.useCallback(()=>{if(!Te)return;const w=W?.flags?.vip?.value!==!0;Fe({vip:{value:w}})},[Te,W,Fe]),xe=c.useCallback(()=>{Oe.current?.open()},[]),Je=k?"drafts":rt===e?"archive":J===e?"junk":"inbox",Le=c.useRef("");c.useEffect(()=>{const w=Le.current;Le.current=b,b.length>0&&w.length===0&&u.recordEvent("search.submitted",{mailboxType:Je})},[b,Je,u]);const{goBack:Ct,nextMessageId:Ye,previousMessageId:wt}=co({context:Ke,orderedIds:Q.map(w=>w.messageId),selectedMessageId:$,enabled:!we&&!ge,hasOpenThread:a!==void 0,onClose:n,handlers:{reply:at,replyAll:ct,forward:yt,delete:ut,toggleStar:dt,toggleRead:ht,muteSender:ft,blockSender:D?xe:void 0,vipSender:mt,markJunk:De,toggleIntelligence:D?()=>Oe.current?.toggle():void 0,compose:ze,goBrief:()=>r("brief"),goInbox:()=>r("brief"),goSent:()=>r("brief"),goFlagged:()=>r("flagged"),goSettings:()=>r("settings")}}),gt=w=>{if(!w)return;const X=Q.find(Y=>Y.messageId===w);return X?{threadId:X.threadId,messageId:w}:void 0},Ge={mailboxId:e,selectedMessageId:$,selectedThread:D,conversation:re,onOpenThread:s,threads:Q,isLoading:H,isError:B,error:de,mailboxAccountId:L,mailboxAccountLoading:oe,mailboxName:Be,unreadCount:nt,isDraftsMailbox:k,isSpamFolder:ce,rescueCandidates:lt,filterCategory:E,filterAttributes:I,onSelectFilterCategory:Ee,onToggleFilterAttribute:be,onClearFilters:Se,listFilter:he,listSearchText:x||void 0,onToggleIntelligence:g,intelligenceRef:Oe,handleDeselectIfRemoved:ie,searchPredicate:S&&N.length===0?_:void 0,resultCount:ke,onDeleteMessages:le,onMoveMessages:je,isDeleting:ae,isMoving:ye,onLoadMore:M,hasMore:j,isLoadingMore:U,onTriageContextChange:st,listCommandsRef:fe,onRetry:()=>se(),onReply:it,onToolbarDelete:Re.deleteThread,onToolbarStar:Re.toggleStar,isStarred:Re.isStarred,onToolbarMove:Re.moveThread,onBack:Ct,nextThread:gt(Ye),previousThread:gt(wt)};return i.jsx(vs.Provider,{value:Ge,children:t})}function bs(){const{mailboxId:e,selectedMessageId:o,threads:t,isLoading:s,isError:n,error:r,onDeleteMessages:a,onMoveMessages:l,isDeleting:u,isMoving:d,onLoadMore:h,hasMore:g,isLoadingMore:m,mailboxAccountId:v,mailboxName:b,unreadCount:S,isDraftsMailbox:y,isSpamFolder:p,rescueCandidates:x,onTriageContextChange:E,listCommandsRef:T,onRetry:I,filterCategory:O,filterAttributes:R,onSelectFilterCategory:A,onToggleFilterAttribute:P,onClearFilters:G,listFilter:N,listSearchText:V,searchPredicate:_,resultCount:F}=St(),{searchQuery:ee,searchInput:ue,accounts:H,resultFolderIndex:B}=Zt(),de=wo(),se=tt(),M=b??"Inbox",j=c.useMemo(()=>go(),[]),{trashMailboxId:U}=po(v),ke=Co({accounts:H}),{trashByAccount:L}=es(),oe=Er({accountId:v,mailboxId:e}),Be=U!=null&&U===e,Q=c.useMemo(()=>v?[v]:[],[v]),{hasNewMail:Ee}=To(),{state:be,errorMessage:Se,refresh:Ne}=Io(Q,{onSettled:I}),he=c.useMemo(()=>i.jsx(ko,{state:be,onRefresh:Ne,label:`Refresh ${M}`,errorMessage:Se,hasUpdate:Ee(Q)}),[be,Ne,M,Se,Ee,Q]),$e=c.useMemo(()=>t.map(ae=>xo(ae,B)),[t,B]),We=c.useCallback(ae=>{const je=ae.threadId??t.find(ye=>ye.messageId===ae.id)?.threadId;je&&se({threadId:je,messageId:ae.id},{mailboxId:ae.mailboxId??e,query:ue})},[e,se,ue,t]);if(y&&v)return i.jsx(Pr,{accountId:v,selectedMessageId:o,imapThreads:t,title:b??"Drafts",unreadCount:S??void 0});const D=i.jsx(Si,{mailboxId:e,threads:t,selectedMessageId:o,isLoading:s,isError:n,error:r,onRetry:I,searchQuery:ee,searchPredicate:_,resultCount:F,onDeleteMessages:a,isDeleting:u,isMoving:d,onLoadMore:h,hasMore:g,isLoadingMore:m,accountId:v,listTitle:M,listFilter:N,listSearchText:V,listScopeLabel:M,hideHeader:!0,onTriageContextChange:E,commandsRef:T}),$=H[0]?.accountId,re=de==="phone"&&$?i.jsx(wi,{accountId:$,children:D}):D,ie=p&&x.length>0&&v?i.jsx(Ti,{accountId:v,currentMailboxId:e,candidates:x,onMove:l,children:re}):re,le=Be?i.jsx(Wr,{messageCount:ke,isEmptying:oe.isEmptying,deletedCount:oe.deletedCount,refusalReason:oe.refusal?.reason,trashFolderLabel:b??void 0,staleFolderLabel:v?L.get(v)?.staleFolderPath:void 0,onEmpty:oe.emptyTrash,onRepair:oe.repair,children:ie}):ie;return i.jsx(In,{title:M,unreadCount:S,preset:j,selectedCategory:O,activeFilters:R,onSelectCategory:A,onToggleFilter:P,onClearFilters:G,searchResults:$e,searchLoading:s,onSelectSearchResult:We,searchResultsInBody:!0,refreshControl:he,children:le})}function Ei(){const e=_t(),{mailboxId:o,mailboxAccountId:t,mailboxAccountLoading:s,selectedThread:n,conversation:r,onReply:a,onToolbarDelete:l,onToolbarStar:u,isStarred:d,onToolbarMove:h,handleDeselectIfRemoved:g,intelligenceRef:m,onOpenThread:v,isSpamFolder:b}=St(),S=!!r,y=fo(r?.threadId);ls(m,y);const p=c.useRef(null),{railFits:x,openRail:E}=y,T=n!==void 0&&vn(n,b);c.useEffect(()=>{if(!x)return;const O=n?.messageId??null;O&&p.current!==O&&T&&(p.current=O,E())},[x,E,n?.messageId,T]);const I=r?i.jsx(as,{threadId:r.threadId,mailboxId:r.mailboxId,subject:r.subject,selectedMessageId:r.messageId,spamRow:r.row,onOpenIntelligence:y.open,listOnScreen:!0}):i.jsx(No,{});return i.jsxs(i.Fragment,{children:[i.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[i.jsx(mo,{hasThread:S,messageId:r?.messageId,intelligenceOpen:y.isShowing,canToggleIntelligence:y.canToggle,onToggleIntelligence:y.toggle,onReply:a?()=>a("reply"):void 0,onReplyAll:a?()=>a("reply-all"):void 0,onForward:a?()=>a("forward"):void 0,onDelete:S?l:void 0,onToggleStar:S?u:void 0,isStarred:d,moveContext:S&&t?{accountId:t,currentMailboxId:o,onMove:h}:void 0,moveContextLoading:s}),i.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:I})]}),i.jsx(cs,{isOpen:y.drawerOpen,onClose:y.closeDrawer,thread:n,accountId:t,onAfterOptimisticRemove:g,onReplyWithText:e,onOpenThread:v})]})}function ji(){const e=_t(),{mailboxAccountId:o,selectedThread:t,onToggleIntelligence:s,handleDeselectIfRemoved:n,onOpenThread:r}=St();return i.jsx(ho,{onClose:s,thread:t,accountId:o,onAfterOptimisticRemove:n,onReplyWithText:e,onOpenThread:r})}function Ri(){const e=_t(),{mailboxAccountId:o,selectedThread:t,conversation:s,onOpenThread:n,onBack:r,nextThread:a,previousThread:l,handleDeselectIfRemoved:u,intelligenceRef:d}=St(),h=uo(s?.threadId??null);return ls(d,h),s?i.jsxs(i.Fragment,{children:[i.jsx(as,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,spamRow:s.row,onBack:r,onOpenIntelligence:h.toggle,onSwipeNext:a?()=>n(a):void 0,onSwipePrevious:l?()=>n(l):void 0,mobileIntelligenceOpen:h.isOpen}),i.jsx(cs,{isOpen:h.isOpen,onClose:h.close,thread:t,accountId:o,onAfterOptimisticRemove:u,onReplyWithText:e,onOpenThread:n})]}):i.jsx(bs,{})}const rl=Object.assign(ki,{List:bs,Reading:Ei,Intelligence:ji,Phone:Ri});export{rl as M};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as Ve,ag as z,r as b,j as l,p as C,I as He,J as We,dV as ye,e as Ge,ak as Ye,f as Xe,al as qe,cE as Qe,bW as Ze,a7 as Je,v as et,X as tt}from"./index-DTrFBojr.js";import{K as U}from"./kbd-87RT_Nj_.js";import{i as st}from"./search-scope-B_8aEz2h.js";import"./nav-link-DbsxgxMR.js";import{d as rt}from"./reply-D62C8M_H.js";import{p as nt,B as ot,b as it}from"./useMessageBodyContent-Am5kUaI9.js";const q=[{category:"personal",label:"Personal",tone:"accent",section:1},{category:"uncategorized",label:"Unclassified",tone:"neutral",section:8},{category:"transactional",label:"Transactional",tone:"positive",section:2},{category:"newsletter",label:"Newsletter",tone:"neutral",section:3},{category:"marketing",label:"Marketing",tone:"neutral",section:4},{category:"social",label:"Social",tone:"warning",section:5},{category:"automated",label:"Automated",tone:"neutral",section:6},{category:"coldOutreach",label:"Cold outreach",tone:"neutral",section:7}],_r=[...q].sort((t,e)=>t.section-e.section).map(t=>t.category),ve=t=>Object.fromEntries(q.map(e=>[e.category,t(e)])),Q=ve(t=>t.label),at=ve(t=>t.tone),xr=t=>!t||t==="personal"?null:Q[t];function ct(t){return Object.hasOwn(at,t)}function Er(t){return t==="all"||ct(t)}const kr=[{id:"all",label:"All",tone:"neutral"},...q.map(t=>({id:t.category,label:t.label,tone:t.tone}))];const we={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};we.node;const Sr=Ve(we);function lt(t,e,s){return Math.max(e,Math.min(t,s))}const v={toVector(t,e){return t===void 0&&(t=e),Array.isArray(t)?t:[t,t]},add(t,e){return[t[0]+e[0],t[1]+e[1]]},sub(t,e){return[t[0]-e[0],t[1]-e[1]]},addTo(t,e){t[0]+=e[0],t[1]+=e[1]},subTo(t,e){t[0]-=e[0],t[1]-=e[1]}};function Z(t,e,s){return e===0||Math.abs(e)===1/0?Math.pow(t,s*5):t*e*s/(e+s*t)}function J(t,e,s,r=.15){return r===0?lt(t,e,s):t<e?-Z(e-t,s-e,r)+e:t>s?+Z(t-s,s-e,r)+s:t}function ut(t,[e,s],[r,n]){const[[o,i],[c,u]]=t;return[J(e,o,i,r),J(s,c,u,n)]}function dt(t,e){if(typeof t!="object"||t===null)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ft(t){var e=dt(t,"string");return typeof e=="symbol"?e:String(e)}function x(t,e,s){return e=ft(e),e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function ee(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function m(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?ee(Object(s),!0).forEach(function(r){x(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):ee(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}const _e={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function te(t){return t?t[0].toUpperCase()+t.slice(1):""}const ht=["enter","leave"];function pt(t=!1,e){return t&&!ht.includes(e)}function mt(t,e="",s=!1){const r=_e[t],n=r&&r[e]||e;return"on"+te(t)+te(n)+(pt(s,n)?"Capture":"")}const gt=["gotpointercapture","lostpointercapture"];function bt(t){let e=t.substring(2).toLowerCase();const s=!!~e.indexOf("passive");s&&(e=e.replace("passive",""));const r=gt.includes(e)?"capturecapture":"capture",n=!!~e.indexOf(r);return n&&(e=e.replace("capture","")),{device:e,capture:n,passive:s}}function yt(t,e=""){const s=_e[t],r=s&&s[e]||e;return t+r}function K(t){return"touches"in t}function xe(t){return K(t)?"touch":"pointerType"in t?t.pointerType:"mouse"}function vt(t){return Array.from(t.touches).filter(e=>{var s,r;return e.target===t.currentTarget||((s=t.currentTarget)===null||s===void 0||(r=s.contains)===null||r===void 0?void 0:r.call(s,e.target))})}function wt(t){return t.type==="touchend"||t.type==="touchcancel"?t.changedTouches:t.targetTouches}function Ee(t){return K(t)?wt(t)[0]:t}function _t(t){return vt(t).map(e=>e.identifier)}function F(t){const e=Ee(t);return K(t)?e.identifier:e.pointerId}function se(t){const e=Ee(t);return[e.clientX,e.clientY]}function xt(t){const e={};if("buttons"in t&&(e.buttons=t.buttons),"shiftKey"in t){const{shiftKey:s,altKey:r,metaKey:n,ctrlKey:o}=t;Object.assign(e,{shiftKey:s,altKey:r,metaKey:n,ctrlKey:o})}return e}function B(t,...e){return typeof t=="function"?t(...e):t}function Et(){}function kt(...t){return t.length===0?Et:t.length===1?t[0]:function(){let e;for(const s of t)e=s.apply(this,arguments)||e;return e}}function re(t,e){return Object.assign({},e,t||{})}const St=32;class At{constructor(e,s,r){this.ctrl=e,this.args=s,this.key=r,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:s,ingKey:r,args:n}=this;s[r]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=n,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const s=this.state,r=this.config;s._active||(this.reset(),this.computeInitial(),s._active=!0,s.target=e.target,s.currentTarget=e.currentTarget,s.lastOffset=r.from?B(r.from,s):s.offset,s.offset=s.lastOffset,s.startTime=s.timeStamp=e.timeStamp)}computeValues(e){const s=this.state;s._values=e,s.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:s,config:r,shared:n}=this;s.args=this.args;let o=0;if(e&&(s.event=e,r.preventDefault&&e.cancelable&&s.event.preventDefault(),s.type=e.type,n.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,n.locked=!!document.pointerLockElement,Object.assign(n,xt(e)),n.down=n.pressed=n.buttons%2===1||n.touches>0,o=e.timeStamp-s.timeStamp,s.timeStamp=e.timeStamp,s.elapsedTime=s.timeStamp-s.startTime),s._active){const g=s._delta.map(Math.abs);v.addTo(s._distance,g)}this.axisIntent&&this.axisIntent(e);const[i,c]=s._movement,[u,d]=r.threshold,{_step:a,values:f}=s;if(r.hasCustomTransform?(a[0]===!1&&(a[0]=Math.abs(i)>=u&&f[0]),a[1]===!1&&(a[1]=Math.abs(c)>=d&&f[1])):(a[0]===!1&&(a[0]=Math.abs(i)>=u&&Math.sign(i)*u),a[1]===!1&&(a[1]=Math.abs(c)>=d&&Math.sign(c)*d)),s.intentional=a[0]!==!1||a[1]!==!1,!s.intentional)return;const h=[0,0];if(r.hasCustomTransform){const[g,O]=f;h[0]=a[0]!==!1?g-a[0]:0,h[1]=a[1]!==!1?O-a[1]:0}else h[0]=a[0]!==!1?i-a[0]:0,h[1]=a[1]!==!1?c-a[1]:0;this.restrictToAxis&&!s._blocked&&this.restrictToAxis(h);const E=s.offset,y=s._active&&!s._blocked||s.active;y&&(s.first=s._active&&!s.active,s.last=!s._active&&s.active,s.active=n[this.ingKey]=s._active,e&&(s.first&&("bounds"in r&&(s._bounds=B(r.bounds,s)),this.setup&&this.setup()),s.movement=h,this.computeOffset()));const[k,_]=s.offset,[[w,A],[T,D]]=s._bounds;s.overflow=[k<w?-1:k>A?1:0,_<T?-1:_>D?1:0],s._movementBound[0]=s.overflow[0]?s._movementBound[0]===!1?s._movement[0]:s._movementBound[0]:!1,s._movementBound[1]=s.overflow[1]?s._movementBound[1]===!1?s._movement[1]:s._movementBound[1]:!1;const p=s._active?r.rubberband||[0,0]:[0,0];if(s.offset=ut(s._bounds,s.offset,p),s.delta=v.sub(s.offset,E),this.computeMovement(),y&&(!s.last||o>St)){s.delta=v.sub(s.offset,E);const g=s.delta.map(Math.abs);v.addTo(s.distance,g),s.direction=s.delta.map(Math.sign),s._direction=s._delta.map(Math.sign),!s.first&&o>0&&(s.velocity=[g[0]/o,g[1]/o],s.timeDelta=o)}}emit(){const e=this.state,s=this.shared,r=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!r.triggerAllEvents)return;const n=this.handler(m(m(m({},s),e),{},{[this.aliasKey]:e.values}));n!==void 0&&(e.memo=n)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function Tt([t,e],s){const r=Math.abs(t),n=Math.abs(e);if(r>n&&r>s)return"x";if(n>r&&n>s)return"y"}class Ct extends At{constructor(...e){super(...e),x(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=v.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=v.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const s=this.state,r=this.config;if(!s.axis&&e){const n=typeof r.axisThreshold=="object"?r.axisThreshold[xe(e)]:r.axisThreshold;s.axis=Tt(s._movement,n)}s._blocked=(r.lockDirection||!!r.axis)&&!s.axis||!!r.axis&&r.axis!==s.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const Ot=t=>t,ne=.15,ke={enabled(t=!0){return t},eventOptions(t,e,s){return m(m({},s.shared.eventOptions),t)},preventDefault(t=!1){return t},triggerAllEvents(t=!1){return t},rubberband(t=0){switch(t){case!0:return[ne,ne];case!1:return[0,0];default:return v.toVector(t)}},from(t){if(typeof t=="function")return t;if(t!=null)return v.toVector(t)},transform(t,e,s){const r=t||s.shared.transform;return this.hasCustomTransform=!!r,r||Ot},threshold(t){return v.toVector(t,0)}},Dt=0,j=m(m({},ke),{},{axis(t,e,{axis:s}){if(this.lockDirection=s==="lock",!this.lockDirection)return s},axisThreshold(t=Dt){return t},bounds(t={}){if(typeof t=="function")return o=>j.bounds(t(o));if("current"in t)return()=>t.current;if(typeof HTMLElement=="function"&&t instanceof HTMLElement)return t;const{left:e=-1/0,right:s=1/0,top:r=-1/0,bottom:n=1/0}=t;return[[e,s],[r,n]]}}),oe={ArrowRight:(t,e=1)=>[t*e,0],ArrowLeft:(t,e=1)=>[-1*t*e,0],ArrowUp:(t,e=1)=>[0,-1*t*e],ArrowDown:(t,e=1)=>[0,t*e]};class It extends Ct{constructor(...e){super(...e),x(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const s=e._bounds.getBoundingClientRect(),r=e.currentTarget.getBoundingClientRect(),n={left:s.left-r.left+e.offset[0],right:s.right-r.right+e.offset[0],top:s.top-r.top+e.offset[1],bottom:s.bottom-r.bottom+e.offset[1]};e._bounds=j.bounds(n)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const s=this.config,r=this.state;if(e.buttons!=null&&(Array.isArray(s.pointerButtons)?!s.pointerButtons.includes(e.buttons):s.pointerButtons!==-1&&s.pointerButtons!==e.buttons))return;const n=this.ctrl.setEventIds(e);s.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(n&&n.size>1&&r._pointerActive)&&(this.start(e),this.setupPointer(e),r._pointerId=F(e),r._pointerActive=!0,this.computeValues(se(e)),this.computeInitial(),s.preventScrollAxis&&xe(e)!=="mouse"?(r._active=!1,this.setupScrollPrevention(e)):s.delay>0?(this.setupDelayTrigger(e),s.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const s=this.state;s._active=!0,s._preventScroll=!0,s._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const s=this.state,r=this.config;if(!s._pointerActive)return;const n=F(e);if(s._pointerId!==void 0&&n!==s._pointerId)return;const o=se(e);if(document.pointerLockElement===e.target?s._delta=[e.movementX,e.movementY]:(s._delta=v.sub(o,s._values),this.computeValues(o)),v.addTo(s._movement,s._delta),this.compute(e),s._delayed&&s.intentional){this.timeoutStore.remove("dragDelay"),s.active=!1,this.startPointerDrag(e);return}if(r.preventScrollAxis&&!s._preventScroll)if(s.axis)if(s.axis===r.preventScrollAxis||r.preventScrollAxis==="xy"){s._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const s=this.state,r=this.config;if(!s._active||!s._pointerActive)return;const n=F(e);if(s._pointerId!==void 0&&n!==s._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[o,i]=s._distance;if(s.tap=o<=r.tapsThreshold&&i<=r.tapsThreshold,s.tap&&r.filterTaps)s._force=!0;else{const[c,u]=s._delta,[d,a]=s._movement,[f,h]=r.swipe.velocity,[E,y]=r.swipe.distance,k=r.swipe.duration;if(s.elapsedTime<k){const _=Math.abs(c/s.timeDelta),w=Math.abs(u/s.timeDelta);_>f&&Math.abs(d)>E&&(s.swipe[0]=Math.sign(c)),w>h&&Math.abs(a)>y&&(s.swipe[1]=Math.sign(u))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const s=this.config,r=s.device;s.pointerLock&&e.currentTarget.requestPointerLock(),s.pointerCapture||(this.eventStore.add(this.sharedConfig.window,r,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,jt(e);const s=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",s),this.eventStore.add(this.sharedConfig.window,"touch","cancel",s),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const s=oe[e.key];if(s){const r=this.state,n=e.shiftKey?10:e.altKey?.1:1;this.start(e),r._delta=s(this.config.keyboardDisplacement,n),r._keyboardActive=!0,v.addTo(r._movement,r._delta),this.compute(e),this.emit()}}keyUp(e){e.key in oe&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const s=this.config.device;e(s,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(s,"change",this.pointerMove.bind(this)),e(s,"end",this.pointerUp.bind(this)),e(s,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function jt(t){"persist"in t&&typeof t.persist=="function"&&t.persist()}const P=typeof window<"u"&&window.document&&window.document.createElement;function Se(){return P&&"ontouchstart"in window}function Pt(){return Se()||P&&window.navigator.maxTouchPoints>1}function Lt(){return P&&"onpointerdown"in window}function Nt(){return P&&"exitPointerLock"in window.document}function Mt(){try{return"constructor"in GestureEvent}catch{return!1}}const S={isBrowser:P,gesture:Mt(),touch:Se(),touchscreen:Pt(),pointer:Lt(),pointerLock:Nt()},Rt=250,Bt=180,$t=.5,Kt=50,zt=250,Ut=10,ie={mouse:0,touch:0,pen:8},Ft=m(m({},j),{},{device(t,e,{pointer:{touch:s=!1,lock:r=!1,mouse:n=!1}={}}){return this.pointerLock=r&&S.pointerLock,S.touch&&s?"touch":this.pointerLock?"mouse":S.pointer&&!n?"pointer":S.touch?"touch":"mouse"},preventScrollAxis(t,e,{preventScroll:s}){if(this.preventScrollDelay=typeof s=="number"?s:s||s===void 0&&t?Rt:void 0,!(!S.touchscreen||s===!1))return t||(s!==void 0?"y":void 0)},pointerCapture(t,e,{pointer:{capture:s=!0,buttons:r=1,keys:n=!0}={}}){return this.pointerButtons=r,this.keys=n,!this.pointerLock&&this.device==="pointer"&&s},threshold(t,e,{filterTaps:s=!1,tapsThreshold:r=3,axis:n=void 0}){const o=v.toVector(t,s?r:n?1:0);return this.filterTaps=s,this.tapsThreshold=r,o},swipe({velocity:t=$t,distance:e=Kt,duration:s=zt}={}){return{velocity:this.transform(v.toVector(t)),distance:this.transform(v.toVector(e)),duration:s}},delay(t=0){switch(t){case!0:return Bt;case!1:return 0;default:return t}},axisThreshold(t){return t?m(m({},ie),t):ie},keyboardDisplacement(t=Ut){return t}});m(m({},ke),{},{device(t,e,{shared:s,pointer:{touch:r=!1}={}}){if(s.target&&!S.touch&&S.gesture)return"gesture";if(S.touch&&r)return"touch";if(S.touchscreen){if(S.pointer)return"pointer";if(S.touch)return"touch"}},bounds(t,e,{scaleBounds:s={},angleBounds:r={}}){const n=i=>{const c=re(B(s,i),{min:-1/0,max:1/0});return[c.min,c.max]},o=i=>{const c=re(B(r,i),{min:-1/0,max:1/0});return[c.min,c.max]};return typeof s!="function"&&typeof r!="function"?[n(),o()]:i=>[n(i),o(i)]},threshold(t,e,s){return this.lockDirection=s.axis==="lock",v.toVector(t,this.lockDirection?[.1,3]:0)},modifierKey(t){return t===void 0?"ctrlKey":t},pinchOnWheel(t=!0){return t}});m(m({},j),{},{mouseOnly:(t=!0)=>t});m(m({},j),{},{mouseOnly:(t=!0)=>t});const Ae=new Map,W=new Map;function Te(t){Ae.set(t.key,t.engine),W.set(t.key,t.resolver)}const Ce={key:"drag",engine:It,resolver:Ft};function Vt(t,e){if(t==null)return{};var s={},r=Object.keys(t),n,o;for(o=0;o<r.length;o++)n=r[o],!(e.indexOf(n)>=0)&&(s[n]=t[n]);return s}function Ht(t,e){if(t==null)return{};var s=Vt(t,e),r,n;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(s[r]=t[r])}return s}const Wt={target(t){if(t)return()=>"current"in t?t.current:t},enabled(t=!0){return t},window(t=S.isBrowser?window:void 0){return t},eventOptions({passive:t=!0,capture:e=!1}={}){return{passive:t,capture:e}},transform(t){return t}},Gt=["target","eventOptions","window","enabled","transform"];function R(t={},e){const s={};for(const[r,n]of Object.entries(e))switch(typeof n){case"function":s[r]=n.call(s,t[r],r,t);break;case"object":s[r]=R(t[r],n);break;case"boolean":n&&(s[r]=t[r]);break}return s}function Yt(t,e,s={}){const r=t,{target:n,eventOptions:o,window:i,enabled:c,transform:u}=r,d=Ht(r,Gt);if(s.shared=R({target:n,eventOptions:o,window:i,enabled:c,transform:u},Wt),e){const a=W.get(e);s[e]=R(m({shared:s.shared},d),a)}else for(const a in d){const f=W.get(a);f&&(s[a]=R(m({shared:s.shared},d[a]),f))}return s}class Oe{constructor(e,s){x(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=s}add(e,s,r,n,o){const i=this._listeners,c=yt(s,r),u=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},d=m(m({},u),o);e.addEventListener(c,n,d);const a=()=>{e.removeEventListener(c,n,d),i.delete(a)};return i.add(a),a}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class Xt{constructor(){x(this,"_timeouts",new Map)}add(e,s,r=140,...n){this.remove(e),this._timeouts.set(e,window.setTimeout(s,r,...n))}remove(e){const s=this._timeouts.get(e);s&&window.clearTimeout(s)}clean(){this._timeouts.forEach(e=>{window.clearTimeout(e)}),this._timeouts.clear()}}class De{constructor(e){x(this,"gestures",new Set),x(this,"_targetEventStore",new Oe(this)),x(this,"gestureEventStores",{}),x(this,"gestureTimeoutStores",{}),x(this,"handlers",{}),x(this,"config",{}),x(this,"pointerIds",new Set),x(this,"touchIds",new Set),x(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),qt(this,e)}setEventIds(e){if(K(e))return this.touchIds=new Set(_t(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,s){this.handlers=e,this.nativeHandlers=s}applyConfig(e,s){this.config=Yt(e,s,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const s=this.config.shared,r={};let n;if(!(s.target&&(n=s.target(),!n))){if(s.enabled){for(const i of this.gestures){const c=this.config[i],u=ae(r,c.eventOptions,!!n);if(c.enabled){const d=Ae.get(i);new d(this,e,i).bind(u)}}const o=ae(r,s.eventOptions,!!n);for(const i in this.nativeHandlers)o(i,"",c=>this.nativeHandlers[i](m(m({},this.state.shared),{},{event:c,args:e})),void 0,!0)}for(const o in r)r[o]=kt(...r[o]);if(!n)return r;for(const o in r){const{device:i,capture:c,passive:u}=bt(o);this._targetEventStore.add(n,i,"",r[o],{capture:c,passive:u})}}}}function I(t,e){t.gestures.add(e),t.gestureEventStores[e]=new Oe(t,e),t.gestureTimeoutStores[e]=new Xt}function qt(t,e){e.drag&&I(t,"drag"),e.wheel&&I(t,"wheel"),e.scroll&&I(t,"scroll"),e.move&&I(t,"move"),e.pinch&&I(t,"pinch"),e.hover&&I(t,"hover")}const ae=(t,e,s)=>(r,n,o,i={},c=!1)=>{var u,d;const a=(u=i.capture)!==null&&u!==void 0?u:e.capture,f=(d=i.passive)!==null&&d!==void 0?d:e.passive;let h=c?r:mt(r,n,a);s&&f&&(h+="Passive"),t[h]=t[h]||[],t[h].push(o)};function Qt(t,e){if(typeof t!="object"||t===null)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Zt(t){var e=Qt(t,"string");return typeof e=="symbol"?e:String(e)}function Jt(t,e,s){return e=Zt(e),e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function ce(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function M(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?ce(Object(s),!0).forEach(function(r){Jt(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):ce(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}class es{constructor(e,s,r,n,o){this._target=e,this._gestureKey=n,this._ctrl=new De(s),this._ctrl.applyHandlers(s,o),this._ctrl.applyConfig(M(M({},r),{},{target:e}),n),this._ctrl.effect()}destroy(){this._ctrl.clean()}setConfig(e){this._ctrl.clean(),this._ctrl.applyConfig(M(M({},e),{},{target:this._target}),this._gestureKey),this._ctrl.effect()}}const ts=function(e,s,r){return Te(Ce),new es(e,{drag:s},r||{},"drag")},V=10,Ie={axisThreshold:{mouse:V,touch:V,pen:V},swipe:{distance:60,velocity:.3,duration:600},pointer:{keys:!1,capture:!1}};function ss(t,e={},s,r){const n=z.useMemo(()=>new De(t),[]);if(n.applyHandlers(t,r),n.applyConfig(e,s),z.useEffect(n.effect.bind(n)),z.useEffect(()=>n.clean.bind(n),[]),e.target===void 0)return n.bind.bind(n)}function rs(t,e){return Te(Ce),ss({drag:t},e||{},"drag")}const G="remit:swipe",ns=b.createContext(!1),os=1.01,je=t=>{const{event:e}=t;if("pointerType"in e&&e.pointerType!=="touch"||e.type!=="pointerup")return null;const s=t.swipe[0];return s<0?"left":s>0?"right":null},Pe=t=>{const e=window.visualViewport;return e?.addEventListener("resize",t),()=>e?.removeEventListener("resize",t)},Le=()=>(window.visualViewport?.scale??1)>os,Ar=({onSwipeLeft:t,onSwipeRight:e})=>{const s=b.useRef(null),r=t!==void 0||e!==void 0,n=b.useSyncExternalStore(Pe,Le,()=>!1),o=c=>{c==="left"&&t?.(),c==="right"&&e?.()},i=rs(c=>o(je(c)),{...Ie,axis:"x",enabled:r&&!n});return b.useEffect(()=>{const c=s.current;if(!c||!r||n)return;const u=d=>{if(!(d instanceof CustomEvent))return;const{detail:a}=d;(a==="left"||a==="right")&&o(a)};return c.addEventListener(G,u),()=>c.removeEventListener(G,u)}),{ref:s,bind:i,touchAction:r&&!n?"pan-y pinch-zoom":"auto",enabled:r}},is='"Geist Variable", "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',$={light:{fg:"oklch(0.3 0.025 235)",canvas:"oklch(0.96 0.015 90)",accent:"oklch(0.55 0.14 150)"},dark:{fg:"oklch(0.88 0.02 90)",canvas:"oklch(0.22 0.025 220)",accent:"oklch(0.78 0.16 150)"}},as={background:!1,spacing:!1},cs="16px",ls=()=>`html{padding:0}body{padding:${cs};box-sizing:border-box}`,us=()=>"html{overflow:hidden}body{overflow-x:auto}",ds=/prefers-color-scheme\s*:\s*dark|color-scheme\s*:\s*[^;}"']*\bdark\b/i,fs='<meta name="viewport" content="width=device-width, initial-scale=1">',hs=t=>{const e=t?$.dark:$.light;return`
|
|
1
|
+
import{b as Ve,aj as z,r as b,j as l,p as C,I as He,P as Ge,eo as ye,e as We,an as Ye,f as Xe,ao as qe,cT as Qe,bT as Ze,aa as Je,y as et,X as tt}from"./index-yeSesYv-.js";import{K as U}from"./kbd-BVK8yKhS.js";import{i as st}from"./search-scope-DaiXqXNv.js";import"./nav-link-BvlYCbp-.js";import{d as rt}from"./reply-DL5kkaJs.js";import{p as nt,B as ot,b as it}from"./useMessageBodyContent-BxjoKGiE.js";const q=[{category:"personal",label:"Personal",tone:"accent",section:1},{category:"uncategorized",label:"Unclassified",tone:"neutral",section:8},{category:"transactional",label:"Transactional",tone:"positive",section:2},{category:"newsletter",label:"Newsletter",tone:"neutral",section:3},{category:"marketing",label:"Marketing",tone:"neutral",section:4},{category:"social",label:"Social",tone:"warning",section:5},{category:"automated",label:"Automated",tone:"neutral",section:6},{category:"coldOutreach",label:"Cold outreach",tone:"neutral",section:7}],_r=[...q].sort((t,e)=>t.section-e.section).map(t=>t.category),ve=t=>Object.fromEntries(q.map(e=>[e.category,t(e)])),Q=ve(t=>t.label),at=ve(t=>t.tone),xr=t=>!t||t==="personal"?null:Q[t];function ct(t){return Object.hasOwn(at,t)}function Er(t){return t==="all"||ct(t)}const Sr=[{id:"all",label:"All",tone:"neutral"},...q.map(t=>({id:t.category,label:t.label,tone:t.tone}))];const we={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};we.node;const kr=Ve(we);function lt(t,e,s){return Math.max(e,Math.min(t,s))}const v={toVector(t,e){return t===void 0&&(t=e),Array.isArray(t)?t:[t,t]},add(t,e){return[t[0]+e[0],t[1]+e[1]]},sub(t,e){return[t[0]-e[0],t[1]-e[1]]},addTo(t,e){t[0]+=e[0],t[1]+=e[1]},subTo(t,e){t[0]-=e[0],t[1]-=e[1]}};function Z(t,e,s){return e===0||Math.abs(e)===1/0?Math.pow(t,s*5):t*e*s/(e+s*t)}function J(t,e,s,r=.15){return r===0?lt(t,e,s):t<e?-Z(e-t,s-e,r)+e:t>s?+Z(t-s,s-e,r)+s:t}function ut(t,[e,s],[r,n]){const[[o,i],[c,u]]=t;return[J(e,o,i,r),J(s,c,u,n)]}function dt(t,e){if(typeof t!="object"||t===null)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ft(t){var e=dt(t,"string");return typeof e=="symbol"?e:String(e)}function x(t,e,s){return e=ft(e),e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function ee(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function m(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?ee(Object(s),!0).forEach(function(r){x(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):ee(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}const _e={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function te(t){return t?t[0].toUpperCase()+t.slice(1):""}const ht=["enter","leave"];function pt(t=!1,e){return t&&!ht.includes(e)}function mt(t,e="",s=!1){const r=_e[t],n=r&&r[e]||e;return"on"+te(t)+te(n)+(pt(s,n)?"Capture":"")}const gt=["gotpointercapture","lostpointercapture"];function bt(t){let e=t.substring(2).toLowerCase();const s=!!~e.indexOf("passive");s&&(e=e.replace("passive",""));const r=gt.includes(e)?"capturecapture":"capture",n=!!~e.indexOf(r);return n&&(e=e.replace("capture","")),{device:e,capture:n,passive:s}}function yt(t,e=""){const s=_e[t],r=s&&s[e]||e;return t+r}function K(t){return"touches"in t}function xe(t){return K(t)?"touch":"pointerType"in t?t.pointerType:"mouse"}function vt(t){return Array.from(t.touches).filter(e=>{var s,r;return e.target===t.currentTarget||((s=t.currentTarget)===null||s===void 0||(r=s.contains)===null||r===void 0?void 0:r.call(s,e.target))})}function wt(t){return t.type==="touchend"||t.type==="touchcancel"?t.changedTouches:t.targetTouches}function Ee(t){return K(t)?wt(t)[0]:t}function _t(t){return vt(t).map(e=>e.identifier)}function F(t){const e=Ee(t);return K(t)?e.identifier:e.pointerId}function se(t){const e=Ee(t);return[e.clientX,e.clientY]}function xt(t){const e={};if("buttons"in t&&(e.buttons=t.buttons),"shiftKey"in t){const{shiftKey:s,altKey:r,metaKey:n,ctrlKey:o}=t;Object.assign(e,{shiftKey:s,altKey:r,metaKey:n,ctrlKey:o})}return e}function B(t,...e){return typeof t=="function"?t(...e):t}function Et(){}function St(...t){return t.length===0?Et:t.length===1?t[0]:function(){let e;for(const s of t)e=s.apply(this,arguments)||e;return e}}function re(t,e){return Object.assign({},e,t||{})}const kt=32;class Tt{constructor(e,s,r){this.ctrl=e,this.args=s,this.key=r,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:s,ingKey:r,args:n}=this;s[r]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=n,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const s=this.state,r=this.config;s._active||(this.reset(),this.computeInitial(),s._active=!0,s.target=e.target,s.currentTarget=e.currentTarget,s.lastOffset=r.from?B(r.from,s):s.offset,s.offset=s.lastOffset,s.startTime=s.timeStamp=e.timeStamp)}computeValues(e){const s=this.state;s._values=e,s.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:s,config:r,shared:n}=this;s.args=this.args;let o=0;if(e&&(s.event=e,r.preventDefault&&e.cancelable&&s.event.preventDefault(),s.type=e.type,n.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,n.locked=!!document.pointerLockElement,Object.assign(n,xt(e)),n.down=n.pressed=n.buttons%2===1||n.touches>0,o=e.timeStamp-s.timeStamp,s.timeStamp=e.timeStamp,s.elapsedTime=s.timeStamp-s.startTime),s._active){const g=s._delta.map(Math.abs);v.addTo(s._distance,g)}this.axisIntent&&this.axisIntent(e);const[i,c]=s._movement,[u,d]=r.threshold,{_step:a,values:f}=s;if(r.hasCustomTransform?(a[0]===!1&&(a[0]=Math.abs(i)>=u&&f[0]),a[1]===!1&&(a[1]=Math.abs(c)>=d&&f[1])):(a[0]===!1&&(a[0]=Math.abs(i)>=u&&Math.sign(i)*u),a[1]===!1&&(a[1]=Math.abs(c)>=d&&Math.sign(c)*d)),s.intentional=a[0]!==!1||a[1]!==!1,!s.intentional)return;const h=[0,0];if(r.hasCustomTransform){const[g,O]=f;h[0]=a[0]!==!1?g-a[0]:0,h[1]=a[1]!==!1?O-a[1]:0}else h[0]=a[0]!==!1?i-a[0]:0,h[1]=a[1]!==!1?c-a[1]:0;this.restrictToAxis&&!s._blocked&&this.restrictToAxis(h);const E=s.offset,y=s._active&&!s._blocked||s.active;y&&(s.first=s._active&&!s.active,s.last=!s._active&&s.active,s.active=n[this.ingKey]=s._active,e&&(s.first&&("bounds"in r&&(s._bounds=B(r.bounds,s)),this.setup&&this.setup()),s.movement=h,this.computeOffset()));const[S,_]=s.offset,[[w,T],[A,D]]=s._bounds;s.overflow=[S<w?-1:S>T?1:0,_<A?-1:_>D?1:0],s._movementBound[0]=s.overflow[0]?s._movementBound[0]===!1?s._movement[0]:s._movementBound[0]:!1,s._movementBound[1]=s.overflow[1]?s._movementBound[1]===!1?s._movement[1]:s._movementBound[1]:!1;const p=s._active?r.rubberband||[0,0]:[0,0];if(s.offset=ut(s._bounds,s.offset,p),s.delta=v.sub(s.offset,E),this.computeMovement(),y&&(!s.last||o>kt)){s.delta=v.sub(s.offset,E);const g=s.delta.map(Math.abs);v.addTo(s.distance,g),s.direction=s.delta.map(Math.sign),s._direction=s._delta.map(Math.sign),!s.first&&o>0&&(s.velocity=[g[0]/o,g[1]/o],s.timeDelta=o)}}emit(){const e=this.state,s=this.shared,r=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!r.triggerAllEvents)return;const n=this.handler(m(m(m({},s),e),{},{[this.aliasKey]:e.values}));n!==void 0&&(e.memo=n)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function At([t,e],s){const r=Math.abs(t),n=Math.abs(e);if(r>n&&r>s)return"x";if(n>r&&n>s)return"y"}class Ct extends Tt{constructor(...e){super(...e),x(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=v.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=v.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const s=this.state,r=this.config;if(!s.axis&&e){const n=typeof r.axisThreshold=="object"?r.axisThreshold[xe(e)]:r.axisThreshold;s.axis=At(s._movement,n)}s._blocked=(r.lockDirection||!!r.axis)&&!s.axis||!!r.axis&&r.axis!==s.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const Ot=t=>t,ne=.15,Se={enabled(t=!0){return t},eventOptions(t,e,s){return m(m({},s.shared.eventOptions),t)},preventDefault(t=!1){return t},triggerAllEvents(t=!1){return t},rubberband(t=0){switch(t){case!0:return[ne,ne];case!1:return[0,0];default:return v.toVector(t)}},from(t){if(typeof t=="function")return t;if(t!=null)return v.toVector(t)},transform(t,e,s){const r=t||s.shared.transform;return this.hasCustomTransform=!!r,r||Ot},threshold(t){return v.toVector(t,0)}},Dt=0,j=m(m({},Se),{},{axis(t,e,{axis:s}){if(this.lockDirection=s==="lock",!this.lockDirection)return s},axisThreshold(t=Dt){return t},bounds(t={}){if(typeof t=="function")return o=>j.bounds(t(o));if("current"in t)return()=>t.current;if(typeof HTMLElement=="function"&&t instanceof HTMLElement)return t;const{left:e=-1/0,right:s=1/0,top:r=-1/0,bottom:n=1/0}=t;return[[e,s],[r,n]]}}),oe={ArrowRight:(t,e=1)=>[t*e,0],ArrowLeft:(t,e=1)=>[-1*t*e,0],ArrowUp:(t,e=1)=>[0,-1*t*e],ArrowDown:(t,e=1)=>[0,t*e]};class It extends Ct{constructor(...e){super(...e),x(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const s=e._bounds.getBoundingClientRect(),r=e.currentTarget.getBoundingClientRect(),n={left:s.left-r.left+e.offset[0],right:s.right-r.right+e.offset[0],top:s.top-r.top+e.offset[1],bottom:s.bottom-r.bottom+e.offset[1]};e._bounds=j.bounds(n)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const s=this.config,r=this.state;if(e.buttons!=null&&(Array.isArray(s.pointerButtons)?!s.pointerButtons.includes(e.buttons):s.pointerButtons!==-1&&s.pointerButtons!==e.buttons))return;const n=this.ctrl.setEventIds(e);s.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(n&&n.size>1&&r._pointerActive)&&(this.start(e),this.setupPointer(e),r._pointerId=F(e),r._pointerActive=!0,this.computeValues(se(e)),this.computeInitial(),s.preventScrollAxis&&xe(e)!=="mouse"?(r._active=!1,this.setupScrollPrevention(e)):s.delay>0?(this.setupDelayTrigger(e),s.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const s=this.state;s._active=!0,s._preventScroll=!0,s._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const s=this.state,r=this.config;if(!s._pointerActive)return;const n=F(e);if(s._pointerId!==void 0&&n!==s._pointerId)return;const o=se(e);if(document.pointerLockElement===e.target?s._delta=[e.movementX,e.movementY]:(s._delta=v.sub(o,s._values),this.computeValues(o)),v.addTo(s._movement,s._delta),this.compute(e),s._delayed&&s.intentional){this.timeoutStore.remove("dragDelay"),s.active=!1,this.startPointerDrag(e);return}if(r.preventScrollAxis&&!s._preventScroll)if(s.axis)if(s.axis===r.preventScrollAxis||r.preventScrollAxis==="xy"){s._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const s=this.state,r=this.config;if(!s._active||!s._pointerActive)return;const n=F(e);if(s._pointerId!==void 0&&n!==s._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[o,i]=s._distance;if(s.tap=o<=r.tapsThreshold&&i<=r.tapsThreshold,s.tap&&r.filterTaps)s._force=!0;else{const[c,u]=s._delta,[d,a]=s._movement,[f,h]=r.swipe.velocity,[E,y]=r.swipe.distance,S=r.swipe.duration;if(s.elapsedTime<S){const _=Math.abs(c/s.timeDelta),w=Math.abs(u/s.timeDelta);_>f&&Math.abs(d)>E&&(s.swipe[0]=Math.sign(c)),w>h&&Math.abs(a)>y&&(s.swipe[1]=Math.sign(u))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const s=this.config,r=s.device;s.pointerLock&&e.currentTarget.requestPointerLock(),s.pointerCapture||(this.eventStore.add(this.sharedConfig.window,r,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,jt(e);const s=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",s),this.eventStore.add(this.sharedConfig.window,"touch","cancel",s),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const s=oe[e.key];if(s){const r=this.state,n=e.shiftKey?10:e.altKey?.1:1;this.start(e),r._delta=s(this.config.keyboardDisplacement,n),r._keyboardActive=!0,v.addTo(r._movement,r._delta),this.compute(e),this.emit()}}keyUp(e){e.key in oe&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const s=this.config.device;e(s,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(s,"change",this.pointerMove.bind(this)),e(s,"end",this.pointerUp.bind(this)),e(s,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function jt(t){"persist"in t&&typeof t.persist=="function"&&t.persist()}const P=typeof window<"u"&&window.document&&window.document.createElement;function ke(){return P&&"ontouchstart"in window}function Pt(){return ke()||P&&window.navigator.maxTouchPoints>1}function Lt(){return P&&"onpointerdown"in window}function Nt(){return P&&"exitPointerLock"in window.document}function Mt(){try{return"constructor"in GestureEvent}catch{return!1}}const k={isBrowser:P,gesture:Mt(),touch:ke(),touchscreen:Pt(),pointer:Lt(),pointerLock:Nt()},Rt=250,Bt=180,$t=.5,Kt=50,zt=250,Ut=10,ie={mouse:0,touch:0,pen:8},Ft=m(m({},j),{},{device(t,e,{pointer:{touch:s=!1,lock:r=!1,mouse:n=!1}={}}){return this.pointerLock=r&&k.pointerLock,k.touch&&s?"touch":this.pointerLock?"mouse":k.pointer&&!n?"pointer":k.touch?"touch":"mouse"},preventScrollAxis(t,e,{preventScroll:s}){if(this.preventScrollDelay=typeof s=="number"?s:s||s===void 0&&t?Rt:void 0,!(!k.touchscreen||s===!1))return t||(s!==void 0?"y":void 0)},pointerCapture(t,e,{pointer:{capture:s=!0,buttons:r=1,keys:n=!0}={}}){return this.pointerButtons=r,this.keys=n,!this.pointerLock&&this.device==="pointer"&&s},threshold(t,e,{filterTaps:s=!1,tapsThreshold:r=3,axis:n=void 0}){const o=v.toVector(t,s?r:n?1:0);return this.filterTaps=s,this.tapsThreshold=r,o},swipe({velocity:t=$t,distance:e=Kt,duration:s=zt}={}){return{velocity:this.transform(v.toVector(t)),distance:this.transform(v.toVector(e)),duration:s}},delay(t=0){switch(t){case!0:return Bt;case!1:return 0;default:return t}},axisThreshold(t){return t?m(m({},ie),t):ie},keyboardDisplacement(t=Ut){return t}});m(m({},Se),{},{device(t,e,{shared:s,pointer:{touch:r=!1}={}}){if(s.target&&!k.touch&&k.gesture)return"gesture";if(k.touch&&r)return"touch";if(k.touchscreen){if(k.pointer)return"pointer";if(k.touch)return"touch"}},bounds(t,e,{scaleBounds:s={},angleBounds:r={}}){const n=i=>{const c=re(B(s,i),{min:-1/0,max:1/0});return[c.min,c.max]},o=i=>{const c=re(B(r,i),{min:-1/0,max:1/0});return[c.min,c.max]};return typeof s!="function"&&typeof r!="function"?[n(),o()]:i=>[n(i),o(i)]},threshold(t,e,s){return this.lockDirection=s.axis==="lock",v.toVector(t,this.lockDirection?[.1,3]:0)},modifierKey(t){return t===void 0?"ctrlKey":t},pinchOnWheel(t=!0){return t}});m(m({},j),{},{mouseOnly:(t=!0)=>t});m(m({},j),{},{mouseOnly:(t=!0)=>t});const Te=new Map,G=new Map;function Ae(t){Te.set(t.key,t.engine),G.set(t.key,t.resolver)}const Ce={key:"drag",engine:It,resolver:Ft};function Vt(t,e){if(t==null)return{};var s={},r=Object.keys(t),n,o;for(o=0;o<r.length;o++)n=r[o],!(e.indexOf(n)>=0)&&(s[n]=t[n]);return s}function Ht(t,e){if(t==null)return{};var s=Vt(t,e),r,n;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(s[r]=t[r])}return s}const Gt={target(t){if(t)return()=>"current"in t?t.current:t},enabled(t=!0){return t},window(t=k.isBrowser?window:void 0){return t},eventOptions({passive:t=!0,capture:e=!1}={}){return{passive:t,capture:e}},transform(t){return t}},Wt=["target","eventOptions","window","enabled","transform"];function R(t={},e){const s={};for(const[r,n]of Object.entries(e))switch(typeof n){case"function":s[r]=n.call(s,t[r],r,t);break;case"object":s[r]=R(t[r],n);break;case"boolean":n&&(s[r]=t[r]);break}return s}function Yt(t,e,s={}){const r=t,{target:n,eventOptions:o,window:i,enabled:c,transform:u}=r,d=Ht(r,Wt);if(s.shared=R({target:n,eventOptions:o,window:i,enabled:c,transform:u},Gt),e){const a=G.get(e);s[e]=R(m({shared:s.shared},d),a)}else for(const a in d){const f=G.get(a);f&&(s[a]=R(m({shared:s.shared},d[a]),f))}return s}class Oe{constructor(e,s){x(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=s}add(e,s,r,n,o){const i=this._listeners,c=yt(s,r),u=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},d=m(m({},u),o);e.addEventListener(c,n,d);const a=()=>{e.removeEventListener(c,n,d),i.delete(a)};return i.add(a),a}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class Xt{constructor(){x(this,"_timeouts",new Map)}add(e,s,r=140,...n){this.remove(e),this._timeouts.set(e,window.setTimeout(s,r,...n))}remove(e){const s=this._timeouts.get(e);s&&window.clearTimeout(s)}clean(){this._timeouts.forEach(e=>{window.clearTimeout(e)}),this._timeouts.clear()}}class De{constructor(e){x(this,"gestures",new Set),x(this,"_targetEventStore",new Oe(this)),x(this,"gestureEventStores",{}),x(this,"gestureTimeoutStores",{}),x(this,"handlers",{}),x(this,"config",{}),x(this,"pointerIds",new Set),x(this,"touchIds",new Set),x(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),qt(this,e)}setEventIds(e){if(K(e))return this.touchIds=new Set(_t(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,s){this.handlers=e,this.nativeHandlers=s}applyConfig(e,s){this.config=Yt(e,s,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const s=this.config.shared,r={};let n;if(!(s.target&&(n=s.target(),!n))){if(s.enabled){for(const i of this.gestures){const c=this.config[i],u=ae(r,c.eventOptions,!!n);if(c.enabled){const d=Te.get(i);new d(this,e,i).bind(u)}}const o=ae(r,s.eventOptions,!!n);for(const i in this.nativeHandlers)o(i,"",c=>this.nativeHandlers[i](m(m({},this.state.shared),{},{event:c,args:e})),void 0,!0)}for(const o in r)r[o]=St(...r[o]);if(!n)return r;for(const o in r){const{device:i,capture:c,passive:u}=bt(o);this._targetEventStore.add(n,i,"",r[o],{capture:c,passive:u})}}}}function I(t,e){t.gestures.add(e),t.gestureEventStores[e]=new Oe(t,e),t.gestureTimeoutStores[e]=new Xt}function qt(t,e){e.drag&&I(t,"drag"),e.wheel&&I(t,"wheel"),e.scroll&&I(t,"scroll"),e.move&&I(t,"move"),e.pinch&&I(t,"pinch"),e.hover&&I(t,"hover")}const ae=(t,e,s)=>(r,n,o,i={},c=!1)=>{var u,d;const a=(u=i.capture)!==null&&u!==void 0?u:e.capture,f=(d=i.passive)!==null&&d!==void 0?d:e.passive;let h=c?r:mt(r,n,a);s&&f&&(h+="Passive"),t[h]=t[h]||[],t[h].push(o)};function Qt(t,e){if(typeof t!="object"||t===null)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Zt(t){var e=Qt(t,"string");return typeof e=="symbol"?e:String(e)}function Jt(t,e,s){return e=Zt(e),e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function ce(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function M(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?ce(Object(s),!0).forEach(function(r){Jt(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):ce(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}class es{constructor(e,s,r,n,o){this._target=e,this._gestureKey=n,this._ctrl=new De(s),this._ctrl.applyHandlers(s,o),this._ctrl.applyConfig(M(M({},r),{},{target:e}),n),this._ctrl.effect()}destroy(){this._ctrl.clean()}setConfig(e){this._ctrl.clean(),this._ctrl.applyConfig(M(M({},e),{},{target:this._target}),this._gestureKey),this._ctrl.effect()}}const ts=function(e,s,r){return Ae(Ce),new es(e,{drag:s},r||{},"drag")},V=10,Ie={axisThreshold:{mouse:V,touch:V,pen:V},swipe:{distance:60,velocity:.3,duration:600},pointer:{keys:!1,capture:!1}};function ss(t,e={},s,r){const n=z.useMemo(()=>new De(t),[]);if(n.applyHandlers(t,r),n.applyConfig(e,s),z.useEffect(n.effect.bind(n)),z.useEffect(()=>n.clean.bind(n),[]),e.target===void 0)return n.bind.bind(n)}function rs(t,e){return Ae(Ce),ss({drag:t},e||{},"drag")}const W="remit:swipe",ns=b.createContext(!1),os=1.01,je=t=>{const{event:e}=t;if("pointerType"in e&&e.pointerType!=="touch"||e.type!=="pointerup")return null;const s=t.swipe[0];return s<0?"left":s>0?"right":null},Pe=t=>{const e=window.visualViewport;return e?.addEventListener("resize",t),()=>e?.removeEventListener("resize",t)},Le=()=>(window.visualViewport?.scale??1)>os,Tr=({onSwipeLeft:t,onSwipeRight:e})=>{const s=b.useRef(null),r=t!==void 0||e!==void 0,n=b.useSyncExternalStore(Pe,Le,()=>!1),o=c=>{c==="left"&&t?.(),c==="right"&&e?.()},i=rs(c=>o(je(c)),{...Ie,axis:"x",enabled:r&&!n});return b.useEffect(()=>{const c=s.current;if(!c||!r||n)return;const u=d=>{if(!(d instanceof CustomEvent))return;const{detail:a}=d;(a==="left"||a==="right")&&o(a)};return c.addEventListener(W,u),()=>c.removeEventListener(W,u)}),{ref:s,bind:i,touchAction:r&&!n?"pan-y pinch-zoom":"auto",enabled:r}},is='"Geist Variable", "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',$={light:{fg:"oklch(0.3 0.025 235)",canvas:"oklch(0.96 0.015 90)",accent:"oklch(0.55 0.14 150)"},dark:{fg:"oklch(0.88 0.02 90)",canvas:"oklch(0.22 0.025 220)",accent:"oklch(0.78 0.16 150)"}},as={background:!1,spacing:!1},cs="16px",ls=()=>`html{padding:0}body{padding:${cs};box-sizing:border-box}`,us=()=>"html{overflow:hidden}body{overflow-x:auto}",ds=/prefers-color-scheme\s*:\s*dark|color-scheme\s*:\s*[^;}"']*\bdark\b/i,fs='<meta name="viewport" content="width=device-width, initial-scale=1">',hs=t=>{const e=t?$.dark:$.light;return`
|
|
2
2
|
/* Plain-email base: UI font-stack + theme-aware colors (#424) */
|
|
3
3
|
html, body {
|
|
4
4
|
font-family: ${is};
|
|
@@ -19,7 +19,7 @@ a, a:visited {
|
|
|
19
19
|
color: ${e.accent} !important;
|
|
20
20
|
text-decoration: underline;
|
|
21
21
|
}
|
|
22
|
-
`},Y="invert(0.92) hue-rotate(180deg)",le=`img,picture,video,svg,canvas,[style*='background-image'],[background]{filter:${Y}}`,ps=(t,e,s)=>{const r=t?$.dark.canvas:$.light.canvas;return s?t?e?`html,body{margin:0;background-color:${r};color-scheme:dark light}`:`html{margin:0;background-color:#ffffff;filter:${Y}}body{margin:0}${le}`:"html,body{margin:0;background-color:#ffffff;color-scheme:light}":t?e?`html,body{margin:0;background-color:${r};color-scheme:dark light}`:`html{margin:0;background-color:${r}}body{margin:0;filter:${Y}}${le}`:`html,body{margin:0;background-color:${r};color-scheme:light}`},ms=(t,e,s,r=as)=>{const n=e==="plain"?hs(s):ps(s,ds.test(t),r.background),o=r.spacing?"":ls();return`${fs}<style>${n}</style>${t}<style>${us()}${o}</style>`},ue=5e4,gs="allow-same-origin allow-popups allow-popups-to-escape-sandbox",de=(t,e,s)=>Math.min(Math.ceil(Math.max(t,e)),s),X=.5,fe=(t,e)=>e>0&&t>e+1?Math.max(e/t,X):1,bs=["box-sizing","width","max-width","transform","transform-origin","margin-bottom","overflow-x"],ys=t=>{for(const i of bs)t.style.removeProperty(i);const e=t.clientWidth,s=t.scrollWidth;if(fe(s,e)===1)return 1;const r=(i,c)=>t.style.setProperty(i,c,"important");r("box-sizing","border-box"),r("max-width","none"),r("width",`${s}px`);const n=Math.max(s,t.scrollWidth),o=fe(n,e);return o>X?r("overflow-x","visible"):r("width",`${e/X}px`),r("transform-origin","0 0"),r("transform",`scale(${o})`),r("margin-bottom",`${-t.offsetHeight*(1-o)}px`),o},vs=new Set(["Enter","Escape","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"]),ws=t=>t===" "?!1:t.length===1?!0:vs.has(t),H=t=>{if(t.metaKey||t.ctrlKey||t.altKey||!ws(t.key))return;const e=t.currentTarget??t.target,s=e?.defaultView?.parent;!s||s===e?.defaultView||s.dispatchEvent(new KeyboardEvent("keydown",{key:t.key,code:t.code,shiftKey:t.shiftKey,bubbles:!0,cancelable:!0}))},he=({html:t,variant:e="framed",isDark:s=!1,declares:r,className:n})=>{const o=b.useRef(null),[i,c]=b.useState(0),u=b.useContext(ns),d=b.useMemo(()=>ms(t,e,s,r),[t,e,s,r]);return b.useEffect(()=>{const a=o.current;if(!a)return;const f=()=>{const p=a.contentDocument;if(!p?.body)return;
|
|
22
|
+
`},Y="invert(0.92) hue-rotate(180deg)",le=`img,picture,video,svg,canvas,[style*='background-image'],[background]{filter:${Y}}`,ps=(t,e,s)=>{const r=t?$.dark.canvas:$.light.canvas;return s?t?e?`html,body{margin:0;background-color:${r};color-scheme:dark light}`:`html{margin:0;background-color:#ffffff;filter:${Y}}body{margin:0}${le}`:"html,body{margin:0;background-color:#ffffff;color-scheme:light}":t?e?`html,body{margin:0;background-color:${r};color-scheme:dark light}`:`html{margin:0;background-color:${r}}body{margin:0;filter:${Y}}${le}`:`html,body{margin:0;background-color:${r};color-scheme:light}`},ms=(t,e,s,r=as)=>{const n=e==="plain"?hs(s):ps(s,ds.test(t),r.background),o=r.spacing?"":ls();return`${fs}<style>${n}</style>${t}<style>${us()}${o}</style>`},ue=5e4,gs="allow-same-origin allow-popups allow-popups-to-escape-sandbox",de=(t,e,s)=>Math.min(Math.ceil(Math.max(t,e)),s),X=.5,fe=(t,e)=>e>0&&t>e+1?Math.max(e/t,X):1,bs=["box-sizing","width","max-width","transform","transform-origin","margin-bottom","overflow-x"],ys=t=>{for(const i of bs)t.style.removeProperty(i);const e=t.clientWidth,s=t.scrollWidth;if(fe(s,e)===1)return 1;const r=(i,c)=>t.style.setProperty(i,c,"important");r("box-sizing","border-box"),r("max-width","none"),r("width",`${s}px`);const n=Math.max(s,t.scrollWidth),o=fe(n,e);return o>X?r("overflow-x","visible"):r("width",`${e/X}px`),r("transform-origin","0 0"),r("transform",`scale(${o})`),r("margin-bottom",`${-t.offsetHeight*(1-o)}px`),o},vs=new Set(["Enter","Escape","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"]),ws=t=>t===" "?!1:t.length===1?!0:vs.has(t),H=t=>{if(t.metaKey||t.ctrlKey||t.altKey||!ws(t.key))return;const e=t.currentTarget??t.target,s=e?.defaultView?.parent;!s||s===e?.defaultView||s.dispatchEvent(new KeyboardEvent("keydown",{key:t.key,code:t.code,shiftKey:t.shiftKey,bubbles:!0,cancelable:!0}))},he=({html:t,variant:e="framed",isDark:s=!1,declares:r,className:n})=>{const o=b.useRef(null),[i,c]=b.useState(0),u=b.useContext(ns),d=b.useMemo(()=>ms(t,e,s,r),[t,e,s,r]);return b.useEffect(()=>{const a=o.current;if(!a)return;const f=()=>{const p=a.contentDocument;if(!p?.body)return;S();const g=p.documentElement,L=ys(p.body)<1?de(p.body.getBoundingClientRect().height,0,ue):de(p.body.scrollHeight,g?.scrollHeight??0,ue);c(N=>N===L?N:L)};let h=0;const E=()=>{cancelAnimationFrame(h),h=requestAnimationFrame(f)},y=p=>{const g=p.documentElement;return Le()||g.scrollWidth>g.clientWidth+1},S=()=>{const p=a.contentDocument;if(!u||!p?.body)return;const g=y(p)?"auto":"pan-y pinch-zoom";p.documentElement.style.touchAction=g,p.body.style.touchAction=g};let _,w,T;const A=u?Pe(S):void 0,D=()=>{f(),_?.disconnect(),_=void 0,w?.removeEventListener("keydown",H),w?.removeEventListener("load",f,!0),w=void 0,T?.destroy(),T=void 0;const p=a.contentDocument;p?.body&&(S(),u&&(T=new ts(p.documentElement,g=>{const O=je(g);O&&a.dispatchEvent(new CustomEvent(W,{bubbles:!0,detail:O}))},{...Ie,axis:"x",window:p.defaultView??void 0})),_=new ResizeObserver(E),_.observe(p.body),p.documentElement&&_.observe(p.documentElement),p.addEventListener("load",f,!0),p.fonts?.ready.then(f),p.addEventListener("keydown",H),w=p)};return a.addEventListener("load",D),()=>{a.removeEventListener("load",D),w?.removeEventListener("keydown",H),w?.removeEventListener("load",f,!0),_?.disconnect(),T?.destroy(),A?.(),cancelAnimationFrame(h)}},[u]),l.jsx("iframe",{ref:o,title:"Email content",sandbox:gs,srcDoc:d,className:n,style:{width:"100%",border:"none",display:"block",height:i===0?"1px":`${i}px`,colorScheme:"normal"}})},_s=(t,e)=>{const r=t==="newsletter"||t==="marketing"||e;return{framed:r,isPlain:!r}},xs=()=>`
|
|
23
23
|
/* Zero the UA default body margin and clamp the document to the iframe width so
|
|
24
24
|
wide author markup can't push the body (and the page) past the viewport. */
|
|
25
25
|
html, body {
|
|
@@ -74,11 +74,11 @@ pre, code {
|
|
|
74
74
|
:is(pre, code, pre *, code *):is([nowrap], [style*="nowrap" i]) {
|
|
75
75
|
white-space: pre-wrap !important;
|
|
76
76
|
}
|
|
77
|
-
`,Es=t=>{const e=new Map;for(const s of t){if(!s.contentId||s.contentUrl.length===0)continue;const r=s.contentId.replace(/^<|>$/g,"");e.set(r,s.contentUrl)}return s=>e.get(s.replace(/^<|>$/g,""))},
|
|
77
|
+
`,Es=t=>{const e=new Map;for(const s of t){if(!s.contentId||s.contentUrl.length===0)continue;const r=s.contentId.replace(/^<|>$/g,"");e.set(r,s.contentUrl)}return s=>e.get(s.replace(/^<|>$/g,""))},Ss=/^(none|transparent|inherit|initial|unset)\s*$/i,Ne=t=>{const e=[],s=/<style[^>]*>([\s\S]*?)<\/style>/gi;let r;for(r=s.exec(t);r!==null;)e.push(r[1]),r=s.exec(t);return e},ks=t=>{const e=/background(?:-color)?\s*:\s*([^;}\n]+)/gi;let s;for(s=e.exec(t);s!==null;){const r=s[1].trim();if(!Ss.test(r))return!0;s=e.exec(t)}return!1},Ts=t=>{if(/\bstyle\s*=\s*["'][^"']*background/i.test(t)||/\bbgcolor\s*=/i.test(t))return!0;for(const e of Ne(t))if(ks(e))return!0;return!1},As=new Set(["auto","none","initial","inherit","unset","revert","revert-layer"]),Cs=new RegExp(`(?<![-\\w])(?:padding|margin)(?:-(top|right|bottom|left|block|inline)(?:-(?:start|end))?)?\\s*:\\s*([^;}"']+)`,"gi"),Os=new Set(["top","bottom","block"]),Me=t=>t.replace(/\/\*[\s\S]*?\*\//g,""),pe=t=>{const e=t.toLowerCase();if(!e||As.has(e)||e.startsWith("-"))return!1;const s=/^\+?(\d*\.?\d+)[a-z%]*$/.exec(e);return s?Number.parseFloat(s[1])!==0:!0},Ds=t=>{const e=t.split(/\s+/).filter(Boolean);return e.length<2?e:e.length<4?[e[1]]:[e[1],e[3]]},Is=(t,e)=>{if(t&&Os.has(t))return!1;const s=e.replace(/!\s*important/gi,"").trim();return s?t?s.split(/\s+/).some(pe):Ds(s).some(pe):!1},me=t=>{for(const e of Me(t).matchAll(Cs))if(Is(e[1],e[2]))return!0;return!1},Re=new Set(["blockquote"]),js=t=>t.replace(/<!--[\s\S]*?-->/g,""),Ps=t=>{const e=[],s=/<([a-zA-Z][\w:-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,r=/\bstyle\s*=\s*(?:"([^"]*)"|'([^']*)')/gi;for(const[,n,o]of t.matchAll(s))for(const i of o.matchAll(r))e.push({tag:n.toLowerCase(),style:i[1]??i[2]??""});return e},Ls=t=>[...Me(t).matchAll(/([^{}]*)\{([^{}]*)\}/g)].map(e=>({selector:e[1].trim(),body:e[2]})),Ns=t=>{const e=t.trim().split(/[\s>+~]+/).pop()??"";return(/^[a-zA-Z][\w-]*/.exec(e)?.[0]??"").toLowerCase()},Ms=t=>t.split(",").every(e=>Re.has(Ns(e))),Rs=t=>{const e=Ne(t),s=js(t);if(/\bcellpadding\s*=\s*["']?(?!0["'\s>])\d/i.test(s))return!0;for(const{tag:r,style:n}of Ps(s))if(!Re.has(r)&&me(n))return!0;for(const r of e)for(const n of Ls(r))if(!Ms(n.selector)&&me(n.body))return!0;return!1},Bs=["script","iframe","object","embed","form","input","button","textarea","select","meta","link","base"],$s=["onerror","onload","onclick","onmouseover","onmouseout","onfocus","onblur","onsubmit","onkeydown","onkeyup","formaction","xlink:href","data-bind"],Ks="data:image/svg+xml,"+encodeURIComponent(`
|
|
78
78
|
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100">
|
|
79
79
|
<rect fill="#f0f0f0" width="100" height="100"/>
|
|
80
80
|
<text x="50" y="50" text-anchor="middle" dy=".3em" fill="#999" font-size="12">
|
|
81
81
|
Image blocked
|
|
82
82
|
</text>
|
|
83
83
|
</svg>
|
|
84
|
-
`),zs=t=>t.replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),Us=t=>t.replace(/@import[^;]*;/gi,"/* @import blocked */").replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),Fs=(t={})=>{const e=nt(),s={FORBID_TAGS:Bs,FORBID_ATTR:$s,ALLOW_DATA_ATTR:!1,ALLOW_UNKNOWN_PROTOCOLS:!1};return e.addHook("afterSanitizeAttributes",r=>{if(t.allowExternalImages||(r.tagName==="IMG"&&r.removeAttribute("srcset"),r.tagName==="SOURCE"&&(r.removeAttribute("srcset"),r.removeAttribute("src")),r.tagName==="VIDEO"&&r.removeAttribute("poster")),r.tagName==="IMG"){const n=r.getAttribute("src")||"";if(n.startsWith("data:"))return;if(n.startsWith("cid:")){const i=n.slice(4).replace(/^<|>$/g,""),c=t.resolveCid?.(i);c&&(r.setAttribute("src",c),r.classList.add("inline-content"));return}t.allowExternalImages||(r.setAttribute("data-blocked-src",n),r.setAttribute("src",Ks),r.setAttribute("alt","[Blocked image]"),r.classList.add("blocked-image"))}if(r.tagName==="A"){const n=r.getAttribute("href")||"";if(/^(javascript|data):/i.test(n)){r.removeAttribute("href");return}r.setAttribute("target","_blank"),r.setAttribute("rel","noopener noreferrer nofollow"),r.classList.add("external-link")}if(r.hasAttribute("style")){const n=r.getAttribute("style")||"";r.setAttribute("style",zs(n))}}),e.addHook("uponSanitizeElement",(r,n)=>{if(n.tagName==="style"){const o=r.textContent||"";r.textContent=Us(o)}}),r=>{const n=As(r),o=Rs(r),i=e.sanitize(r,s);return{html:`<style>${xs()}</style>${i}`,hasAuthorBackground:n,hasAuthorSpacing:o}}},ge=()=>l.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),Tr=({className:t,children:e})=>l.jsx("div",{className:C("[&_.message-body-frame]:-mx-2 lg:[&_.message-body-frame]:-mx-4",t),children:e}),Vs=({html:t,text:e,isDark:s=!1,category:r,allowImages:n=!1,resolveCid:o,className:i,renderBlockedNotice:c})=>{const u=b.useMemo(()=>!t||typeof document>"u"?null:Fs({allowExternalImages:n,resolveCid:o})(t),[t,n,o]),d=u?.html??null,{framed:a,isPlain:f}=_s(r,u?.hasAuthorBackground??!1),h=b.useMemo(()=>({background:u?.hasAuthorBackground??!1,spacing:u?.hasAuthorSpacing??!1}),[u?.hasAuthorBackground,u?.hasAuthorSpacing]),E=b.useMemo(()=>!d||n?0:(d.match(/data-blocked-src/g)||[]).length,[d,n]);return!d&&!e?l.jsx("div",{className:C("message-body",i),children:l.jsx(ge,{})}):l.jsxs("div",{className:C("message-body",i),children:[E>0&&l.jsx("div",{children:c?.(E)}),d?l.jsx("div",{className:"message-body-frame",children:a?l.jsx("div",{className:"w-full max-w-full",children:l.jsx(he,{html:d,variant:"framed",isDark:s,declares:h})}):l.jsx("div",{className:"max-w-full lg:max-w-2xl",children:l.jsx(he,{html:d,variant:f?"plain":"framed",isDark:s,declares:h})})}):e?l.jsx("pre",{className:"email-text whitespace-pre-wrap text-sm leading-relaxed",children:e}):l.jsx(ge,{})]})};function Cr({message:t="Select a thread to read",icon:e,showHints:s=!0,className:r}){return l.jsxs("div",{className:C("flex flex-1 flex-col items-center justify-center text-center",r),children:[e??l.jsx(He,{className:"size-10 text-fg-subtle"}),l.jsx("p",{className:"mt-3 text-sm text-fg-muted",children:t}),s&&l.jsxs("p",{className:"text-2xs text-fg-subtle",children:[l.jsx(U,{children:"j"})," / ",l.jsx(U,{children:"k"})," to move, ",l.jsx(U,{children:"Enter"})," to open"]})]})}function Be(t){const e=[];let s=-1,r=!1;for(let n=0;n<t.length;n++){const o=t[n];if(o==='"'){r=!r,s<0&&(s=n);continue}if(!r&&/\s/.test(o)){s>=0&&e.push({raw:t.slice(s,n),start:s,end:n}),s=-1;continue}s<0&&(s=n)}return s>=0&&e.push({raw:t.slice(s),start:s,end:t.length}),e}const Hs=t=>{if(!t.startsWith('"'))return t;const e=t.slice(1);return e.endsWith('"')?e.slice(0,-1):e};function Ws(t){const e=t.indexOf(":");if(e<=0)return;const s=t.slice(e+1);return{name:t.slice(0,e).toLowerCase(),value:Hs(s),rawValue:s}}const Gs=t=>/[\s"]/.test(t),Ys=t=>Gs(t)?`"${t.replace(/"/g,"")}"`:t,Or=(t,e)=>`${t}:${Ys(e)}`;function Dr(){const{mailboxNameIndex:t,accountNameIndex:e}=We(),s=rt();return{...st(s)?{}:{mailboxesByName:t},accountsByName:e}}const Xs=Object.values(ye).map(t=>({value:t,label:Q[t]})),qs={unclassified:"uncategorized"},Qs=[{name:"from",label:"Sender",values:"contact"},{name:"subject",label:"Subject",values:"text"},{name:"category",label:"Category",values:"fixed",options:Xs},{name:"is",label:"State",values:"fixed",options:[{value:"unread",label:"Unread"},{value:"read",label:"Read"},{value:"starred",label:"Starred"}]},{name:"has",label:"Contents",values:"fixed",options:[{value:"attachment",label:"Has attachment"}]},{name:"in",label:"Folder",values:"mailbox"},{name:"account",label:"Account",values:"account"},{name:"after",label:"Sent on or after",values:"date"},{name:"before",label:"Sent before",values:"date"}],Zs=new Map(Qs.map(t=>[t.name,t])),Ir=t=>Zs.get(t.toLowerCase()),Js=/^\d{4}-\d{2}-\d{2}$/;function er(t,e,s){if(!Js.test(s))return;const r=Date.parse(`${s}T00:00:00Z`);if(!Number.isNaN(r))return{type:t,raw:e,value:s,epochSeconds:Math.floor(r/1e3)}}function tr(t){const e=t.toLowerCase(),s=qs[e];return s||Object.values(ye).find(n=>n.toLowerCase()===e)}function sr(t,e){switch(e.toLowerCase()){case"unread":return{type:"isUnread",raw:t};case"read":return{type:"isRead",raw:t};case"starred":case"flagged":return{type:"isStarred",raw:t};default:return}}function rr(t,e){const s=Ws(t);if(!s||s.value.length===0)return;const{name:r,value:n}=s;switch(r){case"from":return{type:"from",raw:t,value:n};case"subject":return{type:"subject",raw:t,value:n};case"category":{const o=tr(n);return o?{type:"category",raw:t,value:n,category:o}:void 0}case"is":return sr(t,n);case"has":return n.toLowerCase()==="attachment"?{type:"hasAttachment",raw:t}:void 0;case"before":case"after":return er(r,t,n);case"in":{const o=e.mailboxesByName?.get(n.toLowerCase());return o?{type:"in",raw:t,value:n,mailboxId:o}:void 0}case"account":{const o=e.accountsByName?.get(n.toLowerCase());return o?{type:"account",raw:t,value:n,accountId:o}:void 0}default:return}}function jr(t,e={}){const s=[],r=[];for(const n of Be(t)){const o=rr(n.raw,e);o?s.push(o):r.push(n.raw)}return{freeText:r.join(" "),tokens:s}}function Pr(t,e){return Be(t).filter(s=>s.raw!==e.raw).map(s=>s.raw).join(" ")}function Lr(t){switch(t.type){case"from":return`From: ${t.value}`;case"subject":return`Subject: ${t.value}`;case"category":return`Category: ${Q[t.category]}`;case"hasAttachment":return"Has attachment";case"isUnread":return"Unread";case"isRead":return"Read";case"isStarred":return"Starred";case"before":return`Before ${t.value}`;case"after":return`After ${t.value}`;case"in":return`In: ${t.value}`;case"account":return`Account: ${t.value}`}}const $e=(t,e=Date.now())=>({value:t,setAt:e}),nr=(t,e,s,r)=>{if(t.addressId!==e)return t;const n={...t.flags??{}};return s?n.trusted=$e(!0,r):delete n.trusted,{...t,flags:n}},or=(t,e,s,r)=>{const n=o=>o.map(i=>nr(i,e,s,r));return{...t,envelope:{...t.envelope,from:n(t.envelope.from),to:n(t.envelope.to),cc:n(t.envelope.cc),bcc:n(t.envelope.bcc),replyTo:n(t.envelope.replyTo)}}},ir=({messageId:t})=>{const e=Ge(),{pushError:s}=Ye(),{mutate:r,isPending:n,error:o,reset:i}=Xe({...Ze(),onMutate:async u=>{const d=u.path.addressId,f=u.body.flags?.trusted?.value===!0,h=Qe({path:{messageId:t}});await e.cancelQueries({queryKey:h});const E=e.getQueriesData({queryKey:h}).filter(y=>y[1]!==void 0).map(([y,k])=>({queryKey:y,data:k}));return e.setQueriesData({queryKey:h},y=>y&&or(y,d,f)),{describePrefix:h,previous:E}},onError:(u,d,a)=>{if(a)for(const f of a.previous)e.setQueryData(f.queryKey,f.data);s(qe("Couldn't trust sender","The change wasn't saved.",u))},onSettled:(u,d,a,f)=>{f&&e.invalidateQueries({queryKey:f.describePrefix})}});return{toggleTrusted:(u,d)=>{r({path:{addressId:u},body:{flags:{trusted:$e(!d)}}})},isPending:n,error:o,reset:i}},ar=()=>{const[t,e]=b.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark"));return b.useEffect(()=>{const s=document.documentElement,r=new MutationObserver(()=>{e(s.classList.contains("dark"))});return r.observe(s,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),t},cr=(t,e)=>{const s=`${t} image${t>1?"s":""}`;return e?`${s} hidden — you blocked this sender`:`${s} blocked for privacy`},lr=({blockedImageCount:t,canAlwaysTrust:e,isTrustPending:s,isSenderBlocked:r,onLoadOnce:n,onAlwaysTrust:o})=>l.jsxs("div",{"data-testid":"blocked-images-notice",className:"mb-3 flex items-center justify-between rounded-md bg-surface-sunken/50 px-3 py-2 text-sm",children:[l.jsx("span",{className:"text-fg-muted",children:cr(t,r)}),!r&&l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("button",{type:"button",onClick:n,className:"text-accent hover:underline",children:"Load once"}),e&&l.jsx("button",{type:"button",onClick:o,"aria-busy":s,className:"text-accent hover:underline aria-busy:opacity-50",children:s?"Trusting…":"Always trust"})]})]}),ur=(t,e)=>{switch(t){case"auth":return{title:"Your session expired",detail:"Sign in again to reload the message body. Other parts of the app may also stop responding until you do."};case"body-missing":return{title:"Message body is missing in storage",detail:"A sync failure may have left this message without its body bytes. Contact support, or run the reconcile script to refetch from the upstream IMAP server."};case"content-type-mismatch":return{title:"Couldn't load message body",detail:"The server returned an unexpected content type for this part. The message body has not been rendered to keep you safe."};case"spa-shell-leak":return{title:"Couldn't load message body",detail:"The server returned the app shell instead of the message body. This is an infrastructure bug — please report it."};case"not-ready":return{title:"Message body is still syncing",detail:"This message's body hasn't finished downloading from the mail server yet. It should appear shortly — reopen the message to try again."};default:return{title:"Couldn't load message body",detail:e}}},dr=t=>t instanceof ot?t.reason:"generic",fr=t=>t instanceof Error?t.message:typeof t=="string"?t:"An unexpected error occurred while loading the message body.",hr=({error:t,onRetry:e})=>{const s=dr(t),r=fr(t),{title:n,detail:o}=ur(s,r),[i,c]=b.useState(!1),{Account:u}=Je();return i?null:l.jsxs("div",{role:"alert","data-testid":"message-body-error-banner","data-reason":s,className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[l.jsx(et,{className:"size-4 shrink-0 text-danger mt-0.5","aria-hidden":"true"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"font-medium text-danger",children:n}),l.jsx("p",{className:"text-fg-muted mt-1 break-words",children:o})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[s==="auth"&&l.jsx(u,{children:({signOut:d})=>l.jsx("button",{type:"button",onClick:()=>d(),className:"text-sm font-medium text-accent hover:underline",children:"Sign in again"})}),e&&l.jsx("button",{type:"button",onClick:e,className:"text-sm font-medium text-accent hover:underline",children:"Retry"}),l.jsx("button",{type:"button",onClick:()=>c(!0),"aria-label":"Dismiss message body error",className:"rounded-md p-1 text-fg-muted hover:bg-surface-raised hover:text-fg transition-colors",children:l.jsx(tt,{className:"size-4","aria-hidden":"true"})})]})]})},pr=()=>l.jsxs("div",{className:"animate-pulse space-y-2",role:"status","aria-label":"Loading message body",children:[l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-11/12"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-5/6"})]}),be=()=>l.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),Nr=({bodyParts:t,html:e,text:s,isTrusted:r=!1,isBlocked:n=!1,messageId:o,fromAddressId:i,category:c,className:u})=>{const[d,a]=b.useState(!1),[f,h]=b.useState(o);f!==o&&(h(o),a(!1));const E=!n&&(r||d),y=ar(),{toggleTrusted:k,isPending:_}=ir({messageId:o??""}),w=!!t&&t.length>0,{picked:A,data:T,isLoading:D,isError:p,error:g,refetch:O}=it({messageId:o,bodyParts:t,enabled:w}),L=b.useMemo(()=>Es(t??[]),[t]),N=w&&T?.kind==="html"?T.body:e,Ke=w&&T?.kind==="text"?T.body:s;if(w){if(D)return l.jsx("div",{className:C("message-body",u),children:l.jsx(pr,{})});if(p)return l.jsx("div",{className:C("message-body",u),children:l.jsx(hr,{error:g,onRetry:()=>O()})});if(!A)return l.jsx("div",{className:C("message-body",u),children:l.jsx(be,{})})}else if(!e&&!s)return l.jsx("div",{className:C("message-body",u),children:l.jsx(be,{})});const ze=!!(i&&o),Ue=()=>{!i||_||(a(!0),k(i,!1))};return l.jsx(Vs,{className:u,html:N,text:Ke,isDark:y,category:c,allowImages:E,resolveCid:L,renderBlockedNotice:Fe=>l.jsx(lr,{blockedImageCount:Fe,canAlwaysTrust:ze,isTrustPending:_,isSenderBlocked:n,onLoadOnce:()=>a(!0),onAlwaysTrust:Ue})})};export{Sr as A,_r as C,Tr as M,Cr as R,Ie as S,rs as a,V as b,kr as c,Q as d,at as e,Vs as f,xr as g,Ar as h,ns as i,ct as j,ir as k,Nr as l,q as m,Be as n,Ws as o,jr as p,Qs as q,Or as r,Ir as s,Lr as t,Dr as u,Pr as v,Er as w};
|
|
84
|
+
`),zs=t=>t.replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),Us=t=>t.replace(/@import[^;]*;/gi,"/* @import blocked */").replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),Fs=(t={})=>{const e=nt(),s={FORBID_TAGS:Bs,FORBID_ATTR:$s,ALLOW_DATA_ATTR:!1,ALLOW_UNKNOWN_PROTOCOLS:!1};return e.addHook("afterSanitizeAttributes",r=>{if(t.allowExternalImages||(r.tagName==="IMG"&&r.removeAttribute("srcset"),r.tagName==="SOURCE"&&(r.removeAttribute("srcset"),r.removeAttribute("src")),r.tagName==="VIDEO"&&r.removeAttribute("poster")),r.tagName==="IMG"){const n=r.getAttribute("src")||"";if(n.startsWith("data:"))return;if(n.startsWith("cid:")){const i=n.slice(4).replace(/^<|>$/g,""),c=t.resolveCid?.(i);c&&(r.setAttribute("src",c),r.classList.add("inline-content"));return}t.allowExternalImages||(r.setAttribute("data-blocked-src",n),r.setAttribute("src",Ks),r.setAttribute("alt","[Blocked image]"),r.classList.add("blocked-image"))}if(r.tagName==="A"){const n=r.getAttribute("href")||"";if(/^(javascript|data):/i.test(n)){r.removeAttribute("href");return}r.setAttribute("target","_blank"),r.setAttribute("rel","noopener noreferrer nofollow"),r.classList.add("external-link")}if(r.hasAttribute("style")){const n=r.getAttribute("style")||"";r.setAttribute("style",zs(n))}}),e.addHook("uponSanitizeElement",(r,n)=>{if(n.tagName==="style"){const o=r.textContent||"";r.textContent=Us(o)}}),r=>{const n=Ts(r),o=Rs(r),i=e.sanitize(r,s);return{html:`<style>${xs()}</style>${i}`,hasAuthorBackground:n,hasAuthorSpacing:o}}},ge=()=>l.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),Ar=({className:t,children:e})=>l.jsx("div",{className:C("[&_.message-body-frame]:-mx-2 lg:[&_.message-body-frame]:-mx-4",t),children:e}),Vs=({html:t,text:e,isDark:s=!1,category:r,allowImages:n=!1,resolveCid:o,className:i,renderBlockedNotice:c})=>{const u=b.useMemo(()=>!t||typeof document>"u"?null:Fs({allowExternalImages:n,resolveCid:o})(t),[t,n,o]),d=u?.html??null,{framed:a,isPlain:f}=_s(r,u?.hasAuthorBackground??!1),h=b.useMemo(()=>({background:u?.hasAuthorBackground??!1,spacing:u?.hasAuthorSpacing??!1}),[u?.hasAuthorBackground,u?.hasAuthorSpacing]),E=b.useMemo(()=>!d||n?0:(d.match(/data-blocked-src/g)||[]).length,[d,n]);return!d&&!e?l.jsx("div",{className:C("message-body",i),children:l.jsx(ge,{})}):l.jsxs("div",{className:C("message-body",i),children:[E>0&&l.jsx("div",{children:c?.(E)}),d?l.jsx("div",{className:"message-body-frame",children:a?l.jsx("div",{className:"w-full max-w-full",children:l.jsx(he,{html:d,variant:"framed",isDark:s,declares:h})}):l.jsx("div",{className:"max-w-full lg:max-w-2xl",children:l.jsx(he,{html:d,variant:f?"plain":"framed",isDark:s,declares:h})})}):e?l.jsx("pre",{className:"email-text whitespace-pre-wrap text-sm leading-relaxed",children:e}):l.jsx(ge,{})]})};function Cr({message:t="Select a thread to read",icon:e,showHints:s=!0,className:r}){return l.jsxs("div",{className:C("flex flex-1 flex-col items-center justify-center text-center",r),children:[e??l.jsx(He,{className:"size-10 text-fg-subtle"}),l.jsx("p",{className:"mt-3 text-sm text-fg-muted",children:t}),s&&l.jsxs("p",{className:"text-2xs text-fg-subtle",children:[l.jsx(U,{children:"j"})," / ",l.jsx(U,{children:"k"})," to move, ",l.jsx(U,{children:"Enter"})," to open"]})]})}function Be(t){const e=[];let s=-1,r=!1;for(let n=0;n<t.length;n++){const o=t[n];if(o==='"'){r=!r,s<0&&(s=n);continue}if(!r&&/\s/.test(o)){s>=0&&e.push({raw:t.slice(s,n),start:s,end:n}),s=-1;continue}s<0&&(s=n)}return s>=0&&e.push({raw:t.slice(s),start:s,end:t.length}),e}const Hs=t=>{if(!t.startsWith('"'))return t;const e=t.slice(1);return e.endsWith('"')?e.slice(0,-1):e};function Gs(t){const e=t.indexOf(":");if(e<=0)return;const s=t.slice(e+1);return{name:t.slice(0,e).toLowerCase(),value:Hs(s),rawValue:s}}const Ws=t=>/[\s"]/.test(t),Ys=t=>Ws(t)?`"${t.replace(/"/g,"")}"`:t,Or=(t,e)=>`${t}:${Ys(e)}`;function Dr(){const{mailboxNameIndex:t,accountNameIndex:e}=Ge(),s=rt();return{...st(s)?{}:{mailboxesByName:t},accountsByName:e}}const Xs=Object.values(ye).map(t=>({value:t,label:Q[t]})),qs={unclassified:"uncategorized"},Qs=[{name:"from",label:"Sender",values:"contact"},{name:"subject",label:"Subject",values:"text"},{name:"category",label:"Category",values:"fixed",options:Xs},{name:"is",label:"State",values:"fixed",options:[{value:"unread",label:"Unread"},{value:"read",label:"Read"},{value:"starred",label:"Starred"}]},{name:"has",label:"Contents",values:"fixed",options:[{value:"attachment",label:"Has attachment"}]},{name:"in",label:"Folder",values:"mailbox"},{name:"account",label:"Account",values:"account"},{name:"after",label:"Sent on or after",values:"date"},{name:"before",label:"Sent before",values:"date"}],Zs=new Map(Qs.map(t=>[t.name,t])),Ir=t=>Zs.get(t.toLowerCase()),Js=/^\d{4}-\d{2}-\d{2}$/;function er(t,e,s){if(!Js.test(s))return;const r=Date.parse(`${s}T00:00:00Z`);if(!Number.isNaN(r))return{type:t,raw:e,value:s,epochSeconds:Math.floor(r/1e3)}}function tr(t){const e=t.toLowerCase(),s=qs[e];return s||Object.values(ye).find(n=>n.toLowerCase()===e)}function sr(t,e){switch(e.toLowerCase()){case"unread":return{type:"isUnread",raw:t};case"read":return{type:"isRead",raw:t};case"starred":case"flagged":return{type:"isStarred",raw:t};default:return}}function rr(t,e){const s=Gs(t);if(!s||s.value.length===0)return;const{name:r,value:n}=s;switch(r){case"from":return{type:"from",raw:t,value:n};case"subject":return{type:"subject",raw:t,value:n};case"category":{const o=tr(n);return o?{type:"category",raw:t,value:n,category:o}:void 0}case"is":return sr(t,n);case"has":return n.toLowerCase()==="attachment"?{type:"hasAttachment",raw:t}:void 0;case"before":case"after":return er(r,t,n);case"in":{const o=e.mailboxesByName?.get(n.toLowerCase());return o?{type:"in",raw:t,value:n,mailboxId:o}:void 0}case"account":{const o=e.accountsByName?.get(n.toLowerCase());return o?{type:"account",raw:t,value:n,accountId:o}:void 0}default:return}}function jr(t,e={}){const s=[],r=[];for(const n of Be(t)){const o=rr(n.raw,e);o?s.push(o):r.push(n.raw)}return{freeText:r.join(" "),tokens:s}}function Pr(t,e){return Be(t).filter(s=>s.raw!==e.raw).map(s=>s.raw).join(" ")}function Lr(t){switch(t.type){case"from":return`From: ${t.value}`;case"subject":return`Subject: ${t.value}`;case"category":return`Category: ${Q[t.category]}`;case"hasAttachment":return"Has attachment";case"isUnread":return"Unread";case"isRead":return"Read";case"isStarred":return"Starred";case"before":return`Before ${t.value}`;case"after":return`After ${t.value}`;case"in":return`In: ${t.value}`;case"account":return`Account: ${t.value}`}}const $e=(t,e=Date.now())=>({value:t,setAt:e}),nr=(t,e,s,r)=>{if(t.addressId!==e)return t;const n={...t.flags??{}};return s?n.trusted=$e(!0,r):delete n.trusted,{...t,flags:n}},or=(t,e,s,r)=>{const n=o=>o.map(i=>nr(i,e,s,r));return{...t,envelope:{...t.envelope,from:n(t.envelope.from),to:n(t.envelope.to),cc:n(t.envelope.cc),bcc:n(t.envelope.bcc),replyTo:n(t.envelope.replyTo)}}},ir=({messageId:t})=>{const e=We(),{pushError:s}=Ye(),{mutate:r,isPending:n,error:o,reset:i}=Xe({...Ze(),onMutate:async u=>{const d=u.path.addressId,f=u.body.flags?.trusted?.value===!0,h=Qe({path:{messageId:t}});await e.cancelQueries({queryKey:h});const E=e.getQueriesData({queryKey:h}).filter(y=>y[1]!==void 0).map(([y,S])=>({queryKey:y,data:S}));return e.setQueriesData({queryKey:h},y=>y&&or(y,d,f)),{describePrefix:h,previous:E}},onError:(u,d,a)=>{if(a)for(const f of a.previous)e.setQueryData(f.queryKey,f.data);s(qe("Couldn't trust sender","The change wasn't saved.",u))},onSettled:(u,d,a,f)=>{f&&e.invalidateQueries({queryKey:f.describePrefix})}});return{toggleTrusted:(u,d)=>{r({path:{addressId:u},body:{flags:{trusted:$e(!d)}}})},isPending:n,error:o,reset:i}},ar=()=>{const[t,e]=b.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark"));return b.useEffect(()=>{const s=document.documentElement,r=new MutationObserver(()=>{e(s.classList.contains("dark"))});return r.observe(s,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),t},cr=(t,e)=>{const s=`${t} image${t>1?"s":""}`;return e?`${s} hidden — you blocked this sender`:`${s} blocked for privacy`},lr=({blockedImageCount:t,canAlwaysTrust:e,isTrustPending:s,isSenderBlocked:r,onLoadOnce:n,onAlwaysTrust:o})=>l.jsxs("div",{"data-testid":"blocked-images-notice",className:"mb-3 flex items-center justify-between rounded-md bg-surface-sunken/50 px-3 py-2 text-sm",children:[l.jsx("span",{className:"text-fg-muted",children:cr(t,r)}),!r&&l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("button",{type:"button",onClick:n,className:"text-accent hover:underline",children:"Load once"}),e&&l.jsx("button",{type:"button",onClick:o,"aria-busy":s,className:"text-accent hover:underline aria-busy:opacity-50",children:s?"Trusting…":"Always trust"})]})]}),ur=(t,e)=>{switch(t){case"auth":return{title:"Your session expired",detail:"Sign in again to reload the message body. Other parts of the app may also stop responding until you do."};case"body-missing":return{title:"Message body is missing in storage",detail:"A sync failure may have left this message without its body bytes. Contact support, or run the reconcile script to refetch from the upstream IMAP server."};case"content-type-mismatch":return{title:"Couldn't load message body",detail:"The server returned an unexpected content type for this part. The message body has not been rendered to keep you safe."};case"spa-shell-leak":return{title:"Couldn't load message body",detail:"The server returned the app shell instead of the message body. This is an infrastructure bug — please report it."};case"not-ready":return{title:"Message body is still syncing",detail:"This message's body hasn't finished downloading from the mail server yet. It should appear shortly — reopen the message to try again."};default:return{title:"Couldn't load message body",detail:e}}},dr=t=>t instanceof ot?t.reason:"generic",fr=t=>t instanceof Error?t.message:typeof t=="string"?t:"An unexpected error occurred while loading the message body.",hr=({error:t,onRetry:e})=>{const s=dr(t),r=fr(t),{title:n,detail:o}=ur(s,r),[i,c]=b.useState(!1),{Account:u}=Je();return i?null:l.jsxs("div",{role:"alert","data-testid":"message-body-error-banner","data-reason":s,className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[l.jsx(et,{className:"size-4 shrink-0 text-danger mt-0.5","aria-hidden":"true"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"font-medium text-danger",children:n}),l.jsx("p",{className:"text-fg-muted mt-1 break-words",children:o})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[s==="auth"&&l.jsx(u,{children:({signOut:d})=>l.jsx("button",{type:"button",onClick:()=>d(),className:"text-sm font-medium text-accent hover:underline",children:"Sign in again"})}),e&&l.jsx("button",{type:"button",onClick:e,className:"text-sm font-medium text-accent hover:underline",children:"Retry"}),l.jsx("button",{type:"button",onClick:()=>c(!0),"aria-label":"Dismiss message body error",className:"rounded-md p-1 text-fg-muted hover:bg-surface-raised hover:text-fg transition-colors",children:l.jsx(tt,{className:"size-4","aria-hidden":"true"})})]})]})},pr=()=>l.jsxs("div",{className:"animate-pulse space-y-2",role:"status","aria-label":"Loading message body",children:[l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-11/12"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-5/6"})]}),be=()=>l.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),Nr=({bodyParts:t,html:e,text:s,isTrusted:r=!1,isBlocked:n=!1,messageId:o,fromAddressId:i,category:c,className:u})=>{const[d,a]=b.useState(!1),[f,h]=b.useState(o);f!==o&&(h(o),a(!1));const E=!n&&(r||d),y=ar(),{toggleTrusted:S,isPending:_}=ir({messageId:o??""}),w=!!t&&t.length>0,{picked:T,data:A,isLoading:D,isError:p,error:g,refetch:O}=it({messageId:o,bodyParts:t,enabled:w}),L=b.useMemo(()=>Es(t??[]),[t]),N=w&&A?.kind==="html"?A.body:e,Ke=w&&A?.kind==="text"?A.body:s;if(w){if(D)return l.jsx("div",{className:C("message-body",u),children:l.jsx(pr,{})});if(p)return l.jsx("div",{className:C("message-body",u),children:l.jsx(hr,{error:g,onRetry:()=>O()})});if(!T)return l.jsx("div",{className:C("message-body",u),children:l.jsx(be,{})})}else if(!e&&!s)return l.jsx("div",{className:C("message-body",u),children:l.jsx(be,{})});const ze=!!(i&&o),Ue=()=>{!i||_||(a(!0),S(i,!1))};return l.jsx(Vs,{className:u,html:N,text:Ke,isDark:y,category:c,allowImages:E,resolveCid:L,renderBlockedNotice:Fe=>l.jsx(lr,{blockedImageCount:Fe,canAlwaysTrust:ze,isTrustPending:_,isSenderBlocked:n,onLoadOnce:()=>a(!0),onAlwaysTrust:Ue})})};export{kr as A,_r as C,Ar as M,Cr as R,Ie as S,rs as a,V as b,Sr as c,Q as d,at as e,Vs as f,xr as g,Tr as h,ns as i,ct as j,ir as k,Nr as l,q as m,Be as n,Gs as o,jr as p,Qs as q,Or as r,Ir as s,Lr as t,Dr as u,Pr as v,Er as w};
|