@remit/web-client-dist 0.0.564 → 0.0.565
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-DojIZDdy.js → BriefPane-N-87abDV.js} +1 -1
- package/assets/{CalendarComposePane-B3fOrTrG.js → CalendarComposePane-B1OtHmjw.js} +1 -1
- package/assets/{CalendarComposeSeed-DNwuCKpr.js → CalendarComposeSeed-CWQIfrzF.js} +1 -1
- package/assets/{CalendarShell-CGVvcfrA.js → CalendarShell-DrwutrJj.js} +1 -1
- package/assets/{EmptyState-BTKm9F6Q.js → EmptyState-CQv38K8z.js} +1 -1
- package/assets/{ErrorState-jZhKH-Aj.js → ErrorState-CXIFiCFp.js} +1 -1
- package/assets/{FlaggedPane-Gh0sDSpK.js → FlaggedPane-SpnJDtCz.js} +1 -1
- package/assets/{FullCompose-AEoBq77L.js → FullCompose-h9vQVOim.js} +1 -1
- package/assets/{MailListHeader-CP5Mrq7I.js → MailListHeader-NDI2LHme.js} +1 -1
- package/assets/{MailNav-_b1NBnYa.js → MailNav-U8jAkpv8.js} +1 -1
- package/assets/{MailShell-DX1zBcaU.js → MailShell-CCKA_lbv.js} +1 -1
- package/assets/{MailViewChrome-WyEJa7LW.js → MailViewChrome-CRBr_sF1.js} +1 -1
- package/assets/{MailboxPane-B0QAN8MQ.js → MailboxPane-C9bC_e2s.js} +1 -1
- package/assets/{NavMenuButton-CgziJeDD.js → NavMenuButton-BsoArJej.js} +1 -1
- package/assets/{OnboardingWizard-Cq8ycceQ.js → OnboardingWizard-DHMzlXS2.js} +1 -1
- package/assets/{OpenCalendarEvent-CWAwJawV.js → OpenCalendarEvent-dIT0TAYx.js} +1 -1
- package/assets/{OutboxPane-CQ3uaHpb.js → OutboxPane--OFifJG6.js} +1 -1
- package/assets/_calendarObjectId-CdfD13t5.js +1 -0
- package/assets/_mailboxId-CE-kh9j6.js +1 -0
- package/assets/_messageId-CSlN0zqD.js +1 -0
- package/assets/_messageId-C_pbpv44.js +1 -0
- package/assets/_messageId-CqT3hRDW.js +1 -0
- package/assets/_outboxMessageId-BhoQPEF-.js +1 -0
- package/assets/_recurrenceId-D_Gjsnoc.js +1 -0
- package/assets/_threadId-Cm79s-iw.js +1 -0
- package/assets/_threadId-DNZeLHVs.js +1 -0
- package/assets/_threadId-DZgojfo1.js +1 -0
- package/assets/{_view._date-CzvdNpZJ.js → _view._date-Bt8vXEBx.js} +1 -1
- package/assets/{accounts-BZE9IR6B.js → accounts-C4pea3fW.js} +1 -1
- package/assets/{advanced-D2ikJQGg.js → advanced-B4Hnak86.js} +1 -1
- package/assets/{appearance-DsXwlVTk.js → appearance-8UdpL1LI.js} +1 -1
- package/assets/{attachment-file-BRLoj6sG.js → attachment-file-CVx5-2tG.js} +1 -1
- package/assets/{attendee-row-OHoLTo23.js → attendee-row-B__RNuS2.js} +1 -1
- package/assets/{avatar-BuUa_-Ae.js → avatar-CWLq4Fxm.js} +1 -1
- package/assets/{bottom-sheet-BUcSDGQJ.js → bottom-sheet-BWGFkWnz.js} +1 -1
- package/assets/brief-1CZdKndM.js +1 -0
- package/assets/{brief--NWfZGeB.js → brief-BdlHcxBW.js} +1 -1
- package/assets/{browser-ponyfill-C1Yxcmyx.js → browser-ponyfill-DzGvrpXI.js} +1 -1
- package/assets/{bug-C0Ms2LYI.js → bug-RVEeyd-5.js} +1 -1
- package/assets/{calendar-Bx2owKH5.js → calendar-SSTa-J8m.js} +1 -1
- package/assets/{calendar-color-PMGOIawE.js → calendar-color-BQIBbIZI.js} +1 -1
- package/assets/{calendar-event-chip-CX0GIGM0.js → calendar-event-chip-gQ9wSVIt.js} +1 -1
- package/assets/{calendars-CJ1pdgeL.js → calendars-esIRydDc.js} +1 -1
- package/assets/{card-Drp0FnU2.js → card-B41Uiy5L.js} +1 -1
- package/assets/chevron-left-Dbo3pC_s.js +1 -0
- package/assets/{circle-check-8G_6IWKh.js → circle-check-C6IvO25u.js} +1 -1
- package/assets/{circle-check-big-CVRDL2A5.js → circle-check-big-C9d05J_3.js} +1 -1
- package/assets/{circle-help-Ck_g9Pip.js → circle-help-D8T3bBkE.js} +1 -1
- package/assets/{clock-KUoHWkrr.js → clock-CB2fZ36m.js} +1 -1
- package/assets/compose._-_outboxMessageId_-BE3UI54J.js +1 -0
- package/assets/compose._-_outboxMessageId_-BqfD0bp9.js +1 -0
- package/assets/compose._-_outboxMessageId_-D516kAIk.js +1 -0
- package/assets/compose._-_outboxMessageId_-DIWna2Oj.js +1 -0
- package/assets/{config-import-DJqfxqLZ.js → config-import-AXK7G8n7.js} +1 -1
- package/assets/{confirm-dialog-BVXTDPyQ.js → confirm-dialog-ByIuSOmS.js} +1 -1
- package/assets/{copy-D_J7-xdX.js → copy-BGN7y46x.js} +1 -1
- package/assets/{credential-steps-CuyQQqOh.js → credential-steps-XsRlqXVI.js} +1 -1
- package/assets/{download-cdI2QZPl.js → download-B85AK7YQ.js} +1 -1
- package/assets/{file-json-CxdRqoDn.js → file-json-DPkh3mV5.js} +1 -1
- package/assets/{filters-CVrzif88.js → filters-iiJcJVFg.js} +1 -1
- package/assets/flagged-CX-NtlEC.js +1 -0
- package/assets/{flagged-CaNZehgH.js → flagged-D0093_sN.js} +1 -1
- package/assets/{folders-D6pNCcVN.js → folders-xQ6c6gv2.js} +1 -1
- package/assets/{format-bkonYesy.js → format-DODyYau7.js} +1 -1
- package/assets/{help-copy-CbN-pFZa.js → help-copy-Dl3Nw2dV.js} +1 -1
- package/assets/{import-CmBHI3PY.js → import-Xmgx6Zco.js} +1 -1
- package/assets/index-BKC2w03Q.js +1 -0
- package/assets/index-BX2zs_nB.js +1 -0
- package/assets/index-BbqJMdMv.js +1 -0
- package/assets/index-BzY9gUHt.js +1 -0
- package/assets/{index-BsL3dqbS.js → index-CjaOLUk5.js} +4 -4
- package/assets/index-CqT3hRDW.js +1 -0
- package/assets/{index-qHz-C81K.js → index-DANlMcpj.js} +1 -1
- package/assets/index-DPOkqeLd.js +1 -0
- package/assets/index-DUinc6Hq.js +1 -0
- package/assets/{index-BSMLcnNv.js → index-DaE4Ytea.js} +4 -4
- package/assets/index-EasTCPJ-.js +1 -0
- package/assets/index-je-HB-Km.js +1 -0
- package/assets/{kbd-MeQzj_AS.js → kbd-DUf8TYSh.js} +1 -1
- package/assets/{labels-DIjqFgrM.js → labels-h0iFMann.js} +1 -1
- package/assets/{mail-DNGMGkWt.js → mail-BTl6kjT2.js} +1 -1
- package/assets/{mail-zfMejK7g.js → mail-CYJ32Az9.js} +1 -1
- package/assets/{map-pin-DHhEILKJ.js → map-pin-CjhMoM7f.js} +1 -1
- package/assets/{menu-D4SB6ohG.js → menu-Bn2nArxC.js} +1 -1
- package/assets/{new-CEVTgWfF.js → new-DXIg16Ux.js} +1 -1
- package/assets/onboarding-Dx1Gb0jB.js +1 -0
- package/assets/{onboarding-completion-Dr1hm10w.js → onboarding-completion-5TM7XMZD.js} +1 -1
- package/assets/outbox-C-cO9YG6.js +1 -0
- package/assets/{pencil-BSemJDIl.js → pencil-DVDxbPwO.js} +1 -1
- package/assets/{refresh-cw-Bdx0EEOe.js → refresh-cw-D2US4SLy.js} +1 -1
- package/assets/{rich-text-C_I7yglD.js → rich-text-BrV7Eme_.js} +1 -1
- package/assets/{rich-text-spellcheck-worker-provider-fakJuGkh.js → rich-text-spellcheck-worker-provider-DsArBIc9.js} +1 -1
- package/assets/{rotate-ccw-rjesddf9.js → rotate-ccw-vhf2j-j8.js} +1 -1
- package/assets/{roving-focus-JRZm8Nsl.js → roving-focus-CZcayiPM.js} +1 -1
- package/assets/{row-actions-BAj0uoQs.js → row-actions-CQgc_GXe.js} +1 -1
- package/assets/{search-mirror-CD8ms6aC.js → search-mirror-B6nnTjYK.js} +1 -1
- package/assets/{search-token-index-srRTXc29.js → search-token-index-BgcD8qG8.js} +1 -1
- package/assets/{sections-B3k1IUqe.js → sections-BTfp1UaK.js} +1 -1
- package/assets/{senders-BorZpOXg.js → senders-Clfkf4GF.js} +1 -1
- package/assets/settings-DL4PpHLk.js +1 -0
- package/assets/{settings-screen-CX00GQZz.js → settings-screen-Cvt_L0WK.js} +1 -1
- package/assets/{shield-check-B34-2hLP.js → shield-check-BGjBAfG6.js} +1 -1
- package/assets/{suggested-vips-C60kF2rS.js → suggested-vips-B2zeeLbs.js} +1 -1
- package/assets/{useCalendarData-BtwJetQk.js → useCalendarData-rnmcq4Bt.js} +1 -1
- package/assets/{useCalendars-D7gapaJ1.js → useCalendars-B9rVuyMt.js} +1 -1
- package/assets/{useDebouncedValue--1NwWG_J.js → useDebouncedValue-Bx1ysP_7.js} +1 -1
- package/assets/{useFilters-BYL5dTX8.js → useFilters-BwWGufAN.js} +1 -1
- package/assets/{useLabels-BTBI_l7Q.js → useLabels-C4WZaUZZ.js} +1 -1
- package/assets/{useLayoutTier-C5sdkyR7.js → useLayoutTier-Q5StPSkt.js} +1 -1
- package/assets/{useMessageBodyContent-BuyQJK-3.js → useMessageBodyContent-CaHQbZhe.js} +1 -1
- package/assets/{useQueries-hzIIiVUF.js → useQueries-BviBmJi1.js} +1 -1
- package/assets/{useRefreshControl-D15eEjeE.js → useRefreshControl-Dzs-d9AF.js} +1 -1
- package/assets/{useResultFolderIndex-DfM23jXb.js → useResultFolderIndex-DDWjIyol.js} +1 -1
- package/assets/{useSearchTokenContext-BOZY3WZQ.js → useSearchTokenContext-VwtQ9Oed.js} +1 -1
- package/assets/{useSemanticSearch-DT9Nt957.js → useSemanticSearch-DM9v9ozo.js} +1 -1
- package/assets/{useSignature-B3bSZUlR.js → useSignature-Dfdm5oHP.js} +1 -1
- package/assets/{window-ZjseaC3I.js → window-DGvdrRej.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/_calendarObjectId-CCinxQsA.js +0 -1
- package/assets/_mailboxId-BLTbspU-.js +0 -1
- package/assets/_messageId-BdFNsbyK.js +0 -1
- package/assets/_messageId-DGh1GohX.js +0 -1
- package/assets/_messageId-Rx6VPRb8.js +0 -1
- package/assets/_outboxMessageId-Ds-AxAdc.js +0 -1
- package/assets/_recurrenceId-CnuWP_v3.js +0 -1
- package/assets/_threadId-14e9BvEq.js +0 -1
- package/assets/_threadId-CaHK3QT7.js +0 -1
- package/assets/_threadId-zRV3tTyF.js +0 -1
- package/assets/brief-BzLBKBJb.js +0 -1
- package/assets/chevron-left-BW6j5W1b.js +0 -1
- package/assets/compose._-_outboxMessageId_-BT5t9O9p.js +0 -1
- package/assets/compose._-_outboxMessageId_-DVisJU-4.js +0 -1
- package/assets/compose._-_outboxMessageId_-PDyjMj_y.js +0 -1
- package/assets/compose._-_outboxMessageId_-kk1Oxbpv.js +0 -1
- package/assets/flagged-DgBi4zNy.js +0 -1
- package/assets/index-B5pFel5d.js +0 -1
- package/assets/index-BeGGBd6V.js +0 -1
- package/assets/index-CRC7JV7N.js +0 -1
- package/assets/index-CdtVuvhW.js +0 -1
- package/assets/index-CwgKXaQc.js +0 -1
- package/assets/index-CyAwBGa1.js +0 -1
- package/assets/index-DGh1GohX.js +0 -1
- package/assets/index-DIINe8ie.js +0 -1
- package/assets/index-aVEEHAqm.js +0 -1
- package/assets/onboarding-CHzcHHo-.js +0 -1
- package/assets/outbox-BQPbQr6w.js +0 -1
- package/assets/settings-BV8meyD4.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r,L as Tt,U as wt,ee as _e,ef as ue,ci as me,r as n,c as Qe,C as J,bi as Rt,cM as Mt,H as jt,dB as kt,eg as Et,_ as ze,dZ as At,eh as Ft,aj as Ot,cT as Nt,cU as Bt}from"./index-BSMLcnNv.js";import{g as He,e as Lt,f as Ge,u as qt,p as Pt,R as Dt}from"./useSearchTokenContext-BOZY3WZQ.js";import{ac as _t,G as Qt,I as zt,ap as Ht,aq as Gt,ar as Ut,as as Kt,at as Wt,au as Fe,av as Yt,aw as $t,ax as Vt,ab as Zt,ay as Jt,az as Xt,aA as es,aj as ts,M as ss,aB as os,ak as rs,aC as ns,aD as as,e as is,w as cs,am as ls,s as ds,S as us,O as ms,T as Oe,R as fs,P as hs,d as gs,a0 as ps,a1 as xs,a3 as Ue,a4 as Ke,a5 as Is,a6 as ys,a7 as vs}from"./MailListHeader-CP5Mrq7I.js";import{u as bs,a as Ss,R as Cs,b as Ts,c as ws}from"./useRefreshControl-D15eEjeE.js";import{u as fe}from"./useQueries-hzIIiVUF.js";import{t as Rs,u as Ms,r as js,L as ks}from"./useSemanticSearch-DT9Nt957.js";import{a as Es}from"./useLabels-BTBI_l7Q.js";import{u as As,b as Fs}from"./useLayoutTier-C5sdkyR7.js";import{d as Os,w as Ns}from"./wizard-selection-DxUM65kM.js";import{u as We}from"./sections-B3k1IUqe.js";import{R as Bs}from"./refresh-cw-Bdx0EEOe.js";import{a as Ls}from"./useMessageBodyContent-BuyQJK-3.js";import{g as qs,h as Ps}from"./search-token-index-srRTXc29.js";function Ds({sync:e}){return e?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",role:"status","aria-live":"polite",children:[r.jsx(Tt,{className:"size-8 animate-spin text-fg-subtle","aria-hidden":"true"}),r.jsx("p",{className:"text-sm font-medium text-fg",children:"Still syncing your mail"}),r.jsx("p",{className:"text-xs text-fg-subtle",children:_s(e)})]}):r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",children:[r.jsx(wt,{className:"size-8 text-fg-subtle","aria-hidden":"true"}),r.jsx("p",{className:"text-sm font-medium text-fg",children:"You're caught up"}),r.jsx("p",{className:"text-xs text-fg-subtle",children:"Nothing needs attention."})]})}function _s({synced:e,total:t}){return t>0?`${e.toLocaleString()} of ${t.toLocaleString()} messages downloaded. This list fills in as they arrive.`:"Downloading your messages. This list fills in as they arrive."}const Ye=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],$e="category",Qs={unclassified:"uncategorized"},H=e=>Lt(e).map(t=>t.raw),z=e=>e.join(" "),he=e=>{const t=Ge(e);if(t)return Ye.find(o=>o.name===t.name&&o.value===t.value.toLowerCase())?.id},ge=e=>{const t=Ge(e);if(!t||t.name!==$e)return;const o=t.value.toLowerCase(),a=Qs[o];if(a)return a;if(!(!_e(o)||o==="all"))return o},Ve=e=>Ye.find(t=>t.id===e),Ze=e=>Ve(e)!==void 0,zs=e=>{const t=new Set;for(const o of H(e)){const a=he(o);a&&t.add(a)}return t},Hs=e=>{let t="all";for(const o of H(e)){const a=ge(o);a&&(t=a)}return t},Gs=(e,t)=>{const o=Ve(t);if(!o)return;const a=H(e),c=a.filter(d=>he(d)!==t);return c.length<a.length?z(c):z([...a,He(o.name,o.value)])},Us=(e,t)=>{const o=H(e).filter(a=>!ge(a));return z(t==="all"?o:[...o,He($e,t)])},Ks=e=>z(H(e).filter(t=>!he(t)&&!ge(t))),Je=e=>e.trim().length>0,Ne=e=>{if(!Je(e.query))return e.ownFilters;const t=new Set(zs(e.query));for(const o of e.ownFilters)Ze(o)||t.add(o);return t},Be=e=>Je(e.query)?Hs(e.query):e.ownCategory,Le=6e4,Ws=3e4,Ys={kind:"unknown"},qe=e=>(t,o)=>_t(o?.queryKey,e)?t:void 0,$s=(e,t,o)=>({...e,category:[t],limit:o,order:"desc"}),Vs=(e,t)=>({...e,category:[t],order:"desc",count:!0,results:!1}),Pe=(e,t)=>({category:[t],...e.unread!==void 0?{unread:e.unread}:{},...e.starred!==void 0?{starred:e.starred}:{},...e.attachments!==void 0?{attachments:e.attachments}:{}});function Zs({categories:e,criteria:t,limit:o,counted:a}){const c=fe({queries:e.map(m=>{const f=$s(t,m,o),g=Pe(t,m);return{queryKey:me({query:f}),queryFn:async()=>{const{data:T}=await ue({query:f,throwOnError:!0});return T},placeholderData:qe(g),staleTime:Le}})}),d=fe({queries:e.map(m=>{const f=Vs(t,m),g=Pe(t,m);return{queryKey:me({query:f}),queryFn:async()=>{const{data:T}=await ue({query:f,throwOnError:!0});return T},enabled:a,placeholderData:qe(g),staleTime:Le}})}),l=n.useMemo(()=>e.map((m,f)=>{const g=c[f],T=d[f],I=g?.data?.items??[];return{category:m,rows:I,atCap:I.length>=o,total:a?Rs(T?.data?.count):Ys,loading:g?.isPending??!0,failed:g?.isError??!1,retry:()=>{g?.refetch(),a&&T?.refetch()}}}),[e,c,d,a,o]),u=n.useCallback(()=>{for(const m of c)m.refetch();for(const m of d)m.refetch()},[c,d]);return{sections:l,isLoading:c.length>0&&c.every(m=>m.isPending),isError:c.length>0&&c.every(m=>m.isError),refetch:u}}function Js(e,t,o){const a={...e,limit:t,order:"desc"},{data:c,isLoading:d,isError:l,refetch:u}=Qe({queryKey:me({query:a}),queryFn:async()=>{const{data:f}=await ue({query:a,throwOnError:!0});return f},enabled:o,staleTime:Ws});return{rows:n.useMemo(()=>o?c?.items??[]:[],[c,o]),isLoading:o&&d,isError:o&&l,refetch:n.useCallback(()=>{u()},[u])}}const Xs=(e,t)=>e.createdAt!==t.createdAt?e.createdAt-t.createdAt:e.accountId.localeCompare(t.accountId),eo=e=>[...e].sort(Xs),to=["category","unread","starred","attachments"],Xe=["contacts","today"],so=e=>new Set(Xe.filter(t=>e.has(t))),oo=(e,t,o)=>{const a=Qt({category:e,attributes:t}),{params:c,residual:d}=zt(o,a,to),l={...c,...a},u={};return l.unread!==void 0&&(u.unread=l.unread),l.starred!==void 0&&(u.starred=l.starred),l.attachments!==void 0&&(u.attachments=l.attachments),{criteria:u,residual:d}},ro=({residual:e,attributes:t,accountScoped:o})=>e.length===0&&!o&&!Xe.some(a=>t.has(a)),no=50,ao=200,io=[],De=()=>r.jsx("div",{className:"animate-pulse",children:Array.from({length:3}).map((e,t)=>r.jsxs("div",{className:"flex items-start gap-3 py-2 pl-5 pr-4 border-b border-line",children:[r.jsx("div",{className:"size-7 rounded-full bg-surface-sunken shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1 space-y-1.5",children:[r.jsxs("div",{className:"flex justify-between gap-2",children:[r.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-28"}),r.jsx("div",{className:"h-3 bg-surface-sunken rounded w-12"})]}),r.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-48"}),r.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})]})]},t))}),co=({accountEmail:e})=>{const t=We();return r.jsxs("div",{className:"flex items-center gap-2 px-row-inset py-2 border-b border-line bg-danger-soft/40 text-xs text-danger",children:[r.jsx(ze,{className:"size-3.5 shrink-0"}),r.jsxs("span",{className:"flex-1 truncate",children:[e," can't connect"]}),r.jsx("button",{type:"button",onClick:()=>t("accounts"),className:"shrink-0 underline text-danger hover:opacity-80",children:"Reconnect"})]})},lo=(e,t)=>{if(t.size===0)return{};const o=e.filter(d=>t.has(d.id)),a=js(o.map(d=>d.accountId));if(a.restriction)return a;const c=new Set;for(const d of o)d.mailboxId&&c.add(d.mailboxId);return c.size>1?{accountId:a.accountId,restriction:"spansFolders",moveDisabledHint:`Move only works within one folder — this selection spans ${c.size} folders`}:{accountId:a.accountId,mailboxId:c.size===1?[...c][0]:void 0}};function uo({header:e,rows:t,wizard:o,children:a}){const{selectedIds:c,selectedCount:d,exitSelection:l,orderedIds:u,allSelected:m,toggleAllLoaded:f}=as(),g=n.useMemo(()=>lo(t,c),[t,c]),{junkMailboxId:T}=is(g.accountId),{labels:I}=Es(g.accountId),v=n.useMemo(()=>Array.from(c),[c]),B=n.useMemo(()=>Ns(t,c),[t,c]),p=cs(T,g.mailboxId),b=n.useMemo(()=>u.length>0?{checked:m,indeterminate:d>0&&!m,onChange:f}:void 0,[u.length,m,d,f]),F=g.moveDisabledHint?{tone:"warning",text:g.moveDisabledHint}:void 0,S=R=>r.jsx(us,{title:R.title,navSlot:R.navSlot,titleMeta:R.titleMeta,searchSlot:R.searchSlot,searchField:R.searchField,idleSlot:R.makeFilterSlot,count:d,onCancel:l,onDelete:()=>o.start("delete"),onMove:()=>o.start("move"),onOrganize:()=>o.start("organize"),onJunk:p?()=>o.start("junk"):void 0,onMarkRead:()=>o.start("markRead"),overflowSlot:g.accountId&&g.mailboxId&&d>0&&I.length>0?r.jsx(ks,{accountId:g.accountId,mailboxId:g.mailboxId,messageIds:v}):void 0,selectAll:b,notice:F});return r.jsx(ls,{...e,selectionBar:S,paneOverlay:r.jsx(ds,{verb:o.verb,accountId:g.accountId,mailboxId:g.mailboxId,selection:B,selectionRestriction:g.restriction,onFinished:l}),children:a})}function mo({accounts:e,selectedMessageId:t,onOpenThread:o,commandsRef:a,onTriageContextChange:c,onDeleteMessages:d}){const{searchQuery:l,searchInput:u,resultFolderIndex:m,onSearchChange:f}=J(),g=qt(),T=Rt(),I=As(),v=Mt(),B=Fs(),p=n.useMemo(()=>eo(e.filter(s=>!s.muted?.value)),[e]),[b,F]=n.useState("all"),[S,R]=n.useState("all"),[O,L]=n.useState(new Set),[ee,M]=n.useState(!1),q=n.useCallback(s=>{L(i=>{const h=new Set(i);return h.has(s)?h.delete(s):h.add(s),h})},[]),G=n.useCallback(()=>L(new Set),[]),E=u.trim().length>0,{freeText:j,tokens:P}=Pt(l.trim().toLowerCase(),g),y=j.length>0,D=n.useMemo(()=>Ne({query:u,ownFilters:O}),[u,O]),_=n.useMemo(()=>Be({query:u,ownCategory:S}),[u,S]),A=n.useMemo(()=>Ne({query:l,ownFilters:O}),[l,O]),C=n.useMemo(()=>Be({query:l,ownCategory:S}),[l,S]),x=n.useCallback(s=>{if(!E||!Ze(s)){q(s);return}const i=Gs(u,s);i!==void 0&&f(i)},[E,u,f,q]),k=n.useCallback(s=>{if(!E){R(s);return}f(Us(u,s))},[E,u,f]),te=n.useMemo(()=>C==="all"&&!y?s=>{_e(s)&&k(s)}:void 0,[C,y,k]),se=n.useCallback(()=>{R("all"),F("all"),G(),E&&f(Ks(u))},[E,u,f,G]),U=fe({queries:p.map(s=>({...jt({path:{accountId:s.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),K=n.useMemo(()=>{const s=new Map;for(let i=0;i<p.length;i++){const h=p[i].accountId,bt=(U[i]?.data?.items??[]).reduce((St,Ct)=>St+(Ct.unseenCount??0),0);s.set(h,bt)}return s},[p,U]),st=n.useMemo(()=>p.filter((s,i)=>{const h=U[i];return h?.isError?!kt(h.error):!1}),[p,U]),{criteria:oe,residual:re}=n.useMemo(()=>oo(C,A,P),[C,A,P]),ot=n.useMemo(()=>C==="all"?[...Ht]:[C],[C]),rt=n.useMemo(()=>({...oe,query:j,...C==="all"?{}:{category:[C]}}),[oe,j,C]),nt=ro({residual:re,attributes:A,accountScoped:b!=="all"}),{sections:W,isLoading:at,isError:it,refetch:pe}=Zs({categories:y?io:ot,criteria:oe,limit:C==="all"?ns:no,counted:nt}),{rows:xe,isLoading:ct,isError:lt,refetch:Ie}=Js(rt,ao,y),ne=y?ct:at,ye=y?lt:it,ve=n.useCallback(()=>{if(y){Ie();return}pe()},[y,Ie,pe]),be=n.useMemo(()=>so(A),[A]),Y=n.useCallback(s=>Os(Gt(s)).map(Ut).filter(i=>(b==="all"||i.accountId===b)&&Et(i,be)&&Kt(i,re)),[b,be,re]),$=n.useMemo(()=>W.map(s=>({category:s.category,total:Wt(s.total,s.rows),atCap:s.atCap,loading:s.loading,failed:s.failed,rows:Y(s.rows)})),[W,Y]),V=n.useMemo(()=>Y(xe),[xe,Y]),dt=n.useCallback(s=>{W.find(i=>i.category===s)?.retry()},[W]),w=n.useMemo(()=>y?V:$.flatMap(s=>s.rows),[y,V,$]),{spamIds:ae,briefSpamOffer:ie}=n.useMemo(()=>{const s={spamIds:void 0,briefSpamOffer:void 0};if(!j)return s;const i=w.map(N=>Fe(N,m)),{spam:h}=Yt(i);return h.length===0?s:{spamIds:new Set(h.map(N=>N.id)),briefSpamOffer:$t(i)}},[w,j,m]),Se=n.useMemo(()=>{const s=i=>ae===void 0?i:i.filter(h=>!ae.has(h.id));return y?[{id:"matches",threads:s(V)}]:Vt($.map(i=>({...i,rows:s(i.rows)})))},[y,V,$,ae]),Ce=n.useCallback((s,i)=>{const h=w.find(N=>N.id===s)?.threadId;h&&o?.({threadId:h,messageId:s},i)},[w,o]),ut=n.useCallback(s=>{const i=s.threadId??w.find(h=>h.id===s.id)?.threadId;i&&o?.({threadId:i,messageId:s.id})},[w,o]),ce=n.useMemo(()=>p.length<=1?[]:[{id:"all",label:"All",active:b==="all"},...p.map(s=>({id:s.accountId,label:s.email.split("@")[0]??s.email,count:K.get(s.accountId),active:b===s.accountId}))],[p,K,b]),Q=n.useMemo(()=>e.filter(s=>s.muted?.value).length,[e]),mt=n.useMemo(()=>Array.from(K.values()).reduce((s,i)=>s+i,0),[K]),le=n.useMemo(()=>p.map(s=>s.accountId),[p]),{hasNewMail:Te}=bs(),{state:we,errorMessage:Re,refresh:Me}=Ss(le,{onSettled:()=>ve()}),ft=n.useMemo(()=>r.jsx(Cs,{state:we,onRefresh:Me,label:"Refresh daily brief",errorMessage:Re,hasUpdate:Te(le)}),[we,Me,Re,Te,le]),de=n.useMemo(()=>w.map(s=>Fe(s,m)),[w,m]),{hits:je,isLoading:ht}=Ms(),gt=n.useMemo(()=>{const s=new Map(w.map(h=>[h.id,h.threadId])),i=de.map(h=>s.get(h.id)).filter(h=>h!=null);return Zt(je,i,m)},[je,de,w,m]),pt=n.useMemo(()=>{const s=Jt(ce.map(i=>({id:i.id,label:i.label,count:i.count,active:i.active})));return{categories:s.categories,filters:s.filters,sources:s.sources,sourcesNote:Q>0?`+${Q} muted`:void 0,selectedCategory:_,activeFilters:D,expanded:ee,onExpandedChange:M,onSelectCategory:i=>k(i),onSelectSource:F,onToggleFilter:i=>x(i),onClear:se}},[ce,Q,_,D,ee,x,k,se]),ke=Se.length===0&&b==="all"&&j.length===0&&P.length===0,xt=n.useMemo(()=>p.map(s=>s.accountId),[p]),It=n.useMemo(()=>p.some(s=>Ts(s.syncPhase)),[p]),Z=ws(xt,ke||It),Ee=r.jsxs("div",{className:"h-full overflow-y-auto",children:[r.jsx(De,{}),r.jsx(De,{})]}),Ae=!ne&&!ye&&!ke,yt=Xt({tier:I,hasLiveInput:E,hasCommittedQuery:l.trim().length>0,bodyRendersCommittedResults:!0}),vt=Ae?r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[ie&&r.jsx(es,{count:ie.count,onScopeToSpam:()=>B(ie.mailboxId,l)}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(ts,{sections:Se,briefCategory:_,Row:ss,selectedThreadId:t,onSelectThread:Ce,onShowAllSection:te,onRetrySection:dt,flat:y,onSelectBriefCategory:k,sources:ce,sourcesNote:Q>0?`+${Q} muted`:void 0,onSelectSource:F,activeFilters:D,onToggleFilter:x,onClearFilters:se})})]}):ne?Ee:ye?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 py-12 text-sm text-fg-muted",children:[r.jsx(ze,{className:"size-8 text-danger"}),r.jsx("p",{children:"Couldn't load your messages"}),r.jsxs("button",{type:"button",onClick:()=>ve(),className:"flex items-center gap-1 text-accent underline text-xs",children:[r.jsx(Bs,{className:"size-3.5"}),"Try again"]})]}):Z.resolved?r.jsx(Ds,{sync:Z.syncing?{synced:Z.synced,total:Z.total}:void 0}):Ee;return r.jsx(At,{hasSheet:Ae&&!yt,children:r.jsx(os,{selectedMessageId:t,rows:w,onOpen:Ce,onDeleteMessages:d,onSelectionVerb:v.start,commandsRef:a,onTriageContextChange:c,children:r.jsx(uo,{wizard:v,header:{title:"Daily brief",unreadCount:mt,footer:T?r.jsx(rs,{}):void 0,searchFilter:pt,searchResults:de,searchLoading:ne,relatedResults:gt,relatedLoading:ht,onSelectSearchResult:ut,searchResultsInBody:!0,refreshControl:ft},rows:w,children:r.jsxs("div",{className:"flex h-full flex-col",children:[st.map(s=>r.jsx(co,{accountEmail:s.email,accountId:s.accountId},s.accountId)),r.jsx("div",{className:"min-h-0 flex-1",children:vt})]})})})})}const et=n.createContext(null);function X(){const e=n.useContext(et);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function fo({thread:e,children:t}){const o=qs(),a=Ps(),c=We(),{searchInput:d}=J(),l=e?.threadId,u=e?.messageId,{data:m}=Qe({...Ft(),staleTime:6e4}),f=n.useMemo(()=>m?.items??[],[m]),g=n.useMemo(()=>{if(l)return f.find(x=>x.messageId===u)??f.find(x=>x.threadId===l)},[f,l,u]),T=ms(l,u),I=g??T,v=u??I?.messageId,B=n.useMemo(()=>{if(l)return{threadId:l,mailboxId:I?.mailboxId??"",subject:I?.subject,messageId:v,authenticity:I?.authenticity}},[l,I,v]),p=n.useCallback((x,k)=>{o(x,{replace:k?.replace,query:d})},[o,d]),b=n.useCallback(x=>{v&&x.includes(v)&&a()},[v,a]),F=Oe({thread:I,isOpen:!0,onAfterOptimisticRemove:b}),S=fs(),{deleteMessages:R}=hs({mailboxId:I?.mailboxId??"",messages:f,onAfterOptimisticRemove:b}),{toggleReadFor:O}=gs({mailboxId:I?.mailboxId??"",messages:f}),L=S.focusedMessageId,M=n.useMemo(()=>f.find(x=>x.messageId===L),[f,L])??I,q=Oe({thread:M,isOpen:M?.messageId===v}),G=Ls(),E=Ot(),j=Nt(),P=n.useMemo(()=>Bt(j,l,v),[j,l,v]),y=n.useMemo(()=>{if(M)return x=>j({threadId:M.threadId,messageId:M.messageId,mode:x})},[j,M]),{nextMessageId:D,previousMessageId:_}=ps({context:S,orderedIds:S.orderedIds,selectedMessageId:v,enabled:!G&&!E,hasOpenThread:l!==void 0,onClose:a,handlers:{reply:()=>y?.("reply"),replyAll:()=>y?.("reply-all"),forward:()=>y?.("forward"),delete:()=>{S.listCommandsRef.current?.requestVerb("delete")||q.deleteThread()},toggleStar:q.toggleStar,toggleRead:()=>{S.listCommandsRef.current?.requestVerb("markRead")||M&&O([M.messageId],!M.isRead)},goFlagged:()=>c("flagged"),goSettings:()=>c("settings")}}),A=n.useCallback(x=>{if(!x)return;const k=f.find(te=>te.messageId===x);return k?{threadId:k.threadId,messageId:x}:void 0},[f]),C={selectedMessageId:v,selectedThread:I,conversation:B,onOpenThread:p,onCloseThread:a,nextThread:A(D),previousThread:A(_),actions:F,onReply:P,triage:S,onDeleteMessages:R,handleDeselectIfRemoved:b};return r.jsx(et.Provider,{value:C,children:t})}function tt(){const{selectedMessageId:e,onOpenThread:t,triage:o,onDeleteMessages:a}=X(),{accounts:c}=J();return r.jsx(mo,{accounts:c,selectedMessageId:e,onOpenThread:t,commandsRef:o.listCommandsRef,onTriageContextChange:o.onTriageContextChange,onDeleteMessages:a})}function ho(){const{conversation:e,selectedThread:t,actions:o,onReply:a,handleDeselectIfRemoved:c}=X(),d=!!e,l=ys(e?.threadId);return r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[r.jsx(vs,{hasThread:d,intelligenceOpen:l.isShowing,canToggleIntelligence:l.canToggle,onToggleIntelligence:l.toggle,onReply:a?()=>a("reply"):void 0,onReplyAll:a?()=>a("reply-all"):void 0,onForward:a?()=>a("forward"):void 0,onDelete:d?o.deleteThread:void 0,onToggleStar:d?o.toggleStar:void 0,isStarred:o.isStarred,moveContext:d&&o.accountId&&o.mailboxId?{accountId:o.accountId,currentMailboxId:o.mailboxId,onMove:o.moveThread}:void 0}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?r.jsx(Ue,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:l.open,listOnScreen:!0}):r.jsx(Dt,{})})]}),r.jsx(Ke,{isOpen:l.drawerOpen,onClose:l.closeDrawer,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:c})]})}function go(){const{selectedThread:e,handleDeselectIfRemoved:t}=X(),{onToggleIntelligence:o}=J();return r.jsx(Is,{onClose:o,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function po(){const{selectedThread:e,conversation:t,onOpenThread:o,onCloseThread:a,nextThread:c,previousThread:d,handleDeselectIfRemoved:l}=X(),u=xs(t?.threadId??null);return t?r.jsxs(r.Fragment,{children:[r.jsx(Ue,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:a,onOpenIntelligence:u.toggle,onSwipeNext:c?()=>o(c):void 0,onSwipePrevious:d?()=>o(d):void 0,mobileIntelligenceOpen:u.isOpen}),r.jsx(Ke,{isOpen:u.isOpen,onClose:u.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:l})]}):r.jsx("div",{className:"h-full",children:r.jsx(tt,{})})}const Eo=Object.assign(fo,{List:tt,Reading:ho,Intelligence:go,Phone:po});export{Eo as B};
|
|
1
|
+
import{j as r,L as Tt,U as wt,ee as _e,ef as ue,ci as me,r as n,c as Qe,C as J,bi as Rt,cM as Mt,H as jt,dB as kt,eg as Et,_ as ze,dZ as At,eh as Ft,aj as Ot,cT as Nt,cU as Bt}from"./index-DaE4Ytea.js";import{g as He,e as Lt,f as Ge,u as qt,p as Pt,R as Dt}from"./useSearchTokenContext-VwtQ9Oed.js";import{ac as _t,G as Qt,I as zt,ap as Ht,aq as Gt,ar as Ut,as as Kt,at as Wt,au as Fe,av as Yt,aw as $t,ax as Vt,ab as Zt,ay as Jt,az as Xt,aA as es,aj as ts,M as ss,aB as os,ak as rs,aC as ns,aD as as,e as is,w as cs,am as ls,s as ds,S as us,O as ms,T as Oe,R as fs,P as hs,d as gs,a0 as ps,a1 as xs,a3 as Ue,a4 as Ke,a5 as Is,a6 as ys,a7 as vs}from"./MailListHeader-NDI2LHme.js";import{u as bs,a as Ss,R as Cs,b as Ts,c as ws}from"./useRefreshControl-Dzs-d9AF.js";import{u as fe}from"./useQueries-BviBmJi1.js";import{t as Rs,u as Ms,r as js,L as ks}from"./useSemanticSearch-DM9v9ozo.js";import{a as Es}from"./useLabels-C4WZaUZZ.js";import{u as As,b as Fs}from"./useLayoutTier-Q5StPSkt.js";import{d as Os,w as Ns}from"./wizard-selection-DxUM65kM.js";import{u as We}from"./sections-BTfp1UaK.js";import{R as Bs}from"./refresh-cw-D2US4SLy.js";import{a as Ls}from"./useMessageBodyContent-CaHQbZhe.js";import{g as qs,h as Ps}from"./search-token-index-BgcD8qG8.js";function Ds({sync:e}){return e?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",role:"status","aria-live":"polite",children:[r.jsx(Tt,{className:"size-8 animate-spin text-fg-subtle","aria-hidden":"true"}),r.jsx("p",{className:"text-sm font-medium text-fg",children:"Still syncing your mail"}),r.jsx("p",{className:"text-xs text-fg-subtle",children:_s(e)})]}):r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",children:[r.jsx(wt,{className:"size-8 text-fg-subtle","aria-hidden":"true"}),r.jsx("p",{className:"text-sm font-medium text-fg",children:"You're caught up"}),r.jsx("p",{className:"text-xs text-fg-subtle",children:"Nothing needs attention."})]})}function _s({synced:e,total:t}){return t>0?`${e.toLocaleString()} of ${t.toLocaleString()} messages downloaded. This list fills in as they arrive.`:"Downloading your messages. This list fills in as they arrive."}const Ye=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],$e="category",Qs={unclassified:"uncategorized"},H=e=>Lt(e).map(t=>t.raw),z=e=>e.join(" "),he=e=>{const t=Ge(e);if(t)return Ye.find(o=>o.name===t.name&&o.value===t.value.toLowerCase())?.id},ge=e=>{const t=Ge(e);if(!t||t.name!==$e)return;const o=t.value.toLowerCase(),a=Qs[o];if(a)return a;if(!(!_e(o)||o==="all"))return o},Ve=e=>Ye.find(t=>t.id===e),Ze=e=>Ve(e)!==void 0,zs=e=>{const t=new Set;for(const o of H(e)){const a=he(o);a&&t.add(a)}return t},Hs=e=>{let t="all";for(const o of H(e)){const a=ge(o);a&&(t=a)}return t},Gs=(e,t)=>{const o=Ve(t);if(!o)return;const a=H(e),c=a.filter(d=>he(d)!==t);return c.length<a.length?z(c):z([...a,He(o.name,o.value)])},Us=(e,t)=>{const o=H(e).filter(a=>!ge(a));return z(t==="all"?o:[...o,He($e,t)])},Ks=e=>z(H(e).filter(t=>!he(t)&&!ge(t))),Je=e=>e.trim().length>0,Ne=e=>{if(!Je(e.query))return e.ownFilters;const t=new Set(zs(e.query));for(const o of e.ownFilters)Ze(o)||t.add(o);return t},Be=e=>Je(e.query)?Hs(e.query):e.ownCategory,Le=6e4,Ws=3e4,Ys={kind:"unknown"},qe=e=>(t,o)=>_t(o?.queryKey,e)?t:void 0,$s=(e,t,o)=>({...e,category:[t],limit:o,order:"desc"}),Vs=(e,t)=>({...e,category:[t],order:"desc",count:!0,results:!1}),Pe=(e,t)=>({category:[t],...e.unread!==void 0?{unread:e.unread}:{},...e.starred!==void 0?{starred:e.starred}:{},...e.attachments!==void 0?{attachments:e.attachments}:{}});function Zs({categories:e,criteria:t,limit:o,counted:a}){const c=fe({queries:e.map(m=>{const f=$s(t,m,o),g=Pe(t,m);return{queryKey:me({query:f}),queryFn:async()=>{const{data:T}=await ue({query:f,throwOnError:!0});return T},placeholderData:qe(g),staleTime:Le}})}),d=fe({queries:e.map(m=>{const f=Vs(t,m),g=Pe(t,m);return{queryKey:me({query:f}),queryFn:async()=>{const{data:T}=await ue({query:f,throwOnError:!0});return T},enabled:a,placeholderData:qe(g),staleTime:Le}})}),l=n.useMemo(()=>e.map((m,f)=>{const g=c[f],T=d[f],I=g?.data?.items??[];return{category:m,rows:I,atCap:I.length>=o,total:a?Rs(T?.data?.count):Ys,loading:g?.isPending??!0,failed:g?.isError??!1,retry:()=>{g?.refetch(),a&&T?.refetch()}}}),[e,c,d,a,o]),u=n.useCallback(()=>{for(const m of c)m.refetch();for(const m of d)m.refetch()},[c,d]);return{sections:l,isLoading:c.length>0&&c.every(m=>m.isPending),isError:c.length>0&&c.every(m=>m.isError),refetch:u}}function Js(e,t,o){const a={...e,limit:t,order:"desc"},{data:c,isLoading:d,isError:l,refetch:u}=Qe({queryKey:me({query:a}),queryFn:async()=>{const{data:f}=await ue({query:a,throwOnError:!0});return f},enabled:o,staleTime:Ws});return{rows:n.useMemo(()=>o?c?.items??[]:[],[c,o]),isLoading:o&&d,isError:o&&l,refetch:n.useCallback(()=>{u()},[u])}}const Xs=(e,t)=>e.createdAt!==t.createdAt?e.createdAt-t.createdAt:e.accountId.localeCompare(t.accountId),eo=e=>[...e].sort(Xs),to=["category","unread","starred","attachments"],Xe=["contacts","today"],so=e=>new Set(Xe.filter(t=>e.has(t))),oo=(e,t,o)=>{const a=Qt({category:e,attributes:t}),{params:c,residual:d}=zt(o,a,to),l={...c,...a},u={};return l.unread!==void 0&&(u.unread=l.unread),l.starred!==void 0&&(u.starred=l.starred),l.attachments!==void 0&&(u.attachments=l.attachments),{criteria:u,residual:d}},ro=({residual:e,attributes:t,accountScoped:o})=>e.length===0&&!o&&!Xe.some(a=>t.has(a)),no=50,ao=200,io=[],De=()=>r.jsx("div",{className:"animate-pulse",children:Array.from({length:3}).map((e,t)=>r.jsxs("div",{className:"flex items-start gap-3 py-2 pl-5 pr-4 border-b border-line",children:[r.jsx("div",{className:"size-7 rounded-full bg-surface-sunken shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1 space-y-1.5",children:[r.jsxs("div",{className:"flex justify-between gap-2",children:[r.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-28"}),r.jsx("div",{className:"h-3 bg-surface-sunken rounded w-12"})]}),r.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-48"}),r.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})]})]},t))}),co=({accountEmail:e})=>{const t=We();return r.jsxs("div",{className:"flex items-center gap-2 px-row-inset py-2 border-b border-line bg-danger-soft/40 text-xs text-danger",children:[r.jsx(ze,{className:"size-3.5 shrink-0"}),r.jsxs("span",{className:"flex-1 truncate",children:[e," can't connect"]}),r.jsx("button",{type:"button",onClick:()=>t("accounts"),className:"shrink-0 underline text-danger hover:opacity-80",children:"Reconnect"})]})},lo=(e,t)=>{if(t.size===0)return{};const o=e.filter(d=>t.has(d.id)),a=js(o.map(d=>d.accountId));if(a.restriction)return a;const c=new Set;for(const d of o)d.mailboxId&&c.add(d.mailboxId);return c.size>1?{accountId:a.accountId,restriction:"spansFolders",moveDisabledHint:`Move only works within one folder — this selection spans ${c.size} folders`}:{accountId:a.accountId,mailboxId:c.size===1?[...c][0]:void 0}};function uo({header:e,rows:t,wizard:o,children:a}){const{selectedIds:c,selectedCount:d,exitSelection:l,orderedIds:u,allSelected:m,toggleAllLoaded:f}=as(),g=n.useMemo(()=>lo(t,c),[t,c]),{junkMailboxId:T}=is(g.accountId),{labels:I}=Es(g.accountId),v=n.useMemo(()=>Array.from(c),[c]),B=n.useMemo(()=>Ns(t,c),[t,c]),p=cs(T,g.mailboxId),b=n.useMemo(()=>u.length>0?{checked:m,indeterminate:d>0&&!m,onChange:f}:void 0,[u.length,m,d,f]),F=g.moveDisabledHint?{tone:"warning",text:g.moveDisabledHint}:void 0,S=R=>r.jsx(us,{title:R.title,navSlot:R.navSlot,titleMeta:R.titleMeta,searchSlot:R.searchSlot,searchField:R.searchField,idleSlot:R.makeFilterSlot,count:d,onCancel:l,onDelete:()=>o.start("delete"),onMove:()=>o.start("move"),onOrganize:()=>o.start("organize"),onJunk:p?()=>o.start("junk"):void 0,onMarkRead:()=>o.start("markRead"),overflowSlot:g.accountId&&g.mailboxId&&d>0&&I.length>0?r.jsx(ks,{accountId:g.accountId,mailboxId:g.mailboxId,messageIds:v}):void 0,selectAll:b,notice:F});return r.jsx(ls,{...e,selectionBar:S,paneOverlay:r.jsx(ds,{verb:o.verb,accountId:g.accountId,mailboxId:g.mailboxId,selection:B,selectionRestriction:g.restriction,onFinished:l}),children:a})}function mo({accounts:e,selectedMessageId:t,onOpenThread:o,commandsRef:a,onTriageContextChange:c,onDeleteMessages:d}){const{searchQuery:l,searchInput:u,resultFolderIndex:m,onSearchChange:f}=J(),g=qt(),T=Rt(),I=As(),v=Mt(),B=Fs(),p=n.useMemo(()=>eo(e.filter(s=>!s.muted?.value)),[e]),[b,F]=n.useState("all"),[S,R]=n.useState("all"),[O,L]=n.useState(new Set),[ee,M]=n.useState(!1),q=n.useCallback(s=>{L(i=>{const h=new Set(i);return h.has(s)?h.delete(s):h.add(s),h})},[]),G=n.useCallback(()=>L(new Set),[]),E=u.trim().length>0,{freeText:j,tokens:P}=Pt(l.trim().toLowerCase(),g),y=j.length>0,D=n.useMemo(()=>Ne({query:u,ownFilters:O}),[u,O]),_=n.useMemo(()=>Be({query:u,ownCategory:S}),[u,S]),A=n.useMemo(()=>Ne({query:l,ownFilters:O}),[l,O]),C=n.useMemo(()=>Be({query:l,ownCategory:S}),[l,S]),x=n.useCallback(s=>{if(!E||!Ze(s)){q(s);return}const i=Gs(u,s);i!==void 0&&f(i)},[E,u,f,q]),k=n.useCallback(s=>{if(!E){R(s);return}f(Us(u,s))},[E,u,f]),te=n.useMemo(()=>C==="all"&&!y?s=>{_e(s)&&k(s)}:void 0,[C,y,k]),se=n.useCallback(()=>{R("all"),F("all"),G(),E&&f(Ks(u))},[E,u,f,G]),U=fe({queries:p.map(s=>({...jt({path:{accountId:s.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),K=n.useMemo(()=>{const s=new Map;for(let i=0;i<p.length;i++){const h=p[i].accountId,bt=(U[i]?.data?.items??[]).reduce((St,Ct)=>St+(Ct.unseenCount??0),0);s.set(h,bt)}return s},[p,U]),st=n.useMemo(()=>p.filter((s,i)=>{const h=U[i];return h?.isError?!kt(h.error):!1}),[p,U]),{criteria:oe,residual:re}=n.useMemo(()=>oo(C,A,P),[C,A,P]),ot=n.useMemo(()=>C==="all"?[...Ht]:[C],[C]),rt=n.useMemo(()=>({...oe,query:j,...C==="all"?{}:{category:[C]}}),[oe,j,C]),nt=ro({residual:re,attributes:A,accountScoped:b!=="all"}),{sections:W,isLoading:at,isError:it,refetch:pe}=Zs({categories:y?io:ot,criteria:oe,limit:C==="all"?ns:no,counted:nt}),{rows:xe,isLoading:ct,isError:lt,refetch:Ie}=Js(rt,ao,y),ne=y?ct:at,ye=y?lt:it,ve=n.useCallback(()=>{if(y){Ie();return}pe()},[y,Ie,pe]),be=n.useMemo(()=>so(A),[A]),Y=n.useCallback(s=>Os(Gt(s)).map(Ut).filter(i=>(b==="all"||i.accountId===b)&&Et(i,be)&&Kt(i,re)),[b,be,re]),$=n.useMemo(()=>W.map(s=>({category:s.category,total:Wt(s.total,s.rows),atCap:s.atCap,loading:s.loading,failed:s.failed,rows:Y(s.rows)})),[W,Y]),V=n.useMemo(()=>Y(xe),[xe,Y]),dt=n.useCallback(s=>{W.find(i=>i.category===s)?.retry()},[W]),w=n.useMemo(()=>y?V:$.flatMap(s=>s.rows),[y,V,$]),{spamIds:ae,briefSpamOffer:ie}=n.useMemo(()=>{const s={spamIds:void 0,briefSpamOffer:void 0};if(!j)return s;const i=w.map(N=>Fe(N,m)),{spam:h}=Yt(i);return h.length===0?s:{spamIds:new Set(h.map(N=>N.id)),briefSpamOffer:$t(i)}},[w,j,m]),Se=n.useMemo(()=>{const s=i=>ae===void 0?i:i.filter(h=>!ae.has(h.id));return y?[{id:"matches",threads:s(V)}]:Vt($.map(i=>({...i,rows:s(i.rows)})))},[y,V,$,ae]),Ce=n.useCallback((s,i)=>{const h=w.find(N=>N.id===s)?.threadId;h&&o?.({threadId:h,messageId:s},i)},[w,o]),ut=n.useCallback(s=>{const i=s.threadId??w.find(h=>h.id===s.id)?.threadId;i&&o?.({threadId:i,messageId:s.id})},[w,o]),ce=n.useMemo(()=>p.length<=1?[]:[{id:"all",label:"All",active:b==="all"},...p.map(s=>({id:s.accountId,label:s.email.split("@")[0]??s.email,count:K.get(s.accountId),active:b===s.accountId}))],[p,K,b]),Q=n.useMemo(()=>e.filter(s=>s.muted?.value).length,[e]),mt=n.useMemo(()=>Array.from(K.values()).reduce((s,i)=>s+i,0),[K]),le=n.useMemo(()=>p.map(s=>s.accountId),[p]),{hasNewMail:Te}=bs(),{state:we,errorMessage:Re,refresh:Me}=Ss(le,{onSettled:()=>ve()}),ft=n.useMemo(()=>r.jsx(Cs,{state:we,onRefresh:Me,label:"Refresh daily brief",errorMessage:Re,hasUpdate:Te(le)}),[we,Me,Re,Te,le]),de=n.useMemo(()=>w.map(s=>Fe(s,m)),[w,m]),{hits:je,isLoading:ht}=Ms(),gt=n.useMemo(()=>{const s=new Map(w.map(h=>[h.id,h.threadId])),i=de.map(h=>s.get(h.id)).filter(h=>h!=null);return Zt(je,i,m)},[je,de,w,m]),pt=n.useMemo(()=>{const s=Jt(ce.map(i=>({id:i.id,label:i.label,count:i.count,active:i.active})));return{categories:s.categories,filters:s.filters,sources:s.sources,sourcesNote:Q>0?`+${Q} muted`:void 0,selectedCategory:_,activeFilters:D,expanded:ee,onExpandedChange:M,onSelectCategory:i=>k(i),onSelectSource:F,onToggleFilter:i=>x(i),onClear:se}},[ce,Q,_,D,ee,x,k,se]),ke=Se.length===0&&b==="all"&&j.length===0&&P.length===0,xt=n.useMemo(()=>p.map(s=>s.accountId),[p]),It=n.useMemo(()=>p.some(s=>Ts(s.syncPhase)),[p]),Z=ws(xt,ke||It),Ee=r.jsxs("div",{className:"h-full overflow-y-auto",children:[r.jsx(De,{}),r.jsx(De,{})]}),Ae=!ne&&!ye&&!ke,yt=Xt({tier:I,hasLiveInput:E,hasCommittedQuery:l.trim().length>0,bodyRendersCommittedResults:!0}),vt=Ae?r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[ie&&r.jsx(es,{count:ie.count,onScopeToSpam:()=>B(ie.mailboxId,l)}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(ts,{sections:Se,briefCategory:_,Row:ss,selectedThreadId:t,onSelectThread:Ce,onShowAllSection:te,onRetrySection:dt,flat:y,onSelectBriefCategory:k,sources:ce,sourcesNote:Q>0?`+${Q} muted`:void 0,onSelectSource:F,activeFilters:D,onToggleFilter:x,onClearFilters:se})})]}):ne?Ee:ye?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 py-12 text-sm text-fg-muted",children:[r.jsx(ze,{className:"size-8 text-danger"}),r.jsx("p",{children:"Couldn't load your messages"}),r.jsxs("button",{type:"button",onClick:()=>ve(),className:"flex items-center gap-1 text-accent underline text-xs",children:[r.jsx(Bs,{className:"size-3.5"}),"Try again"]})]}):Z.resolved?r.jsx(Ds,{sync:Z.syncing?{synced:Z.synced,total:Z.total}:void 0}):Ee;return r.jsx(At,{hasSheet:Ae&&!yt,children:r.jsx(os,{selectedMessageId:t,rows:w,onOpen:Ce,onDeleteMessages:d,onSelectionVerb:v.start,commandsRef:a,onTriageContextChange:c,children:r.jsx(uo,{wizard:v,header:{title:"Daily brief",unreadCount:mt,footer:T?r.jsx(rs,{}):void 0,searchFilter:pt,searchResults:de,searchLoading:ne,relatedResults:gt,relatedLoading:ht,onSelectSearchResult:ut,searchResultsInBody:!0,refreshControl:ft},rows:w,children:r.jsxs("div",{className:"flex h-full flex-col",children:[st.map(s=>r.jsx(co,{accountEmail:s.email,accountId:s.accountId},s.accountId)),r.jsx("div",{className:"min-h-0 flex-1",children:vt})]})})})})}const et=n.createContext(null);function X(){const e=n.useContext(et);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function fo({thread:e,children:t}){const o=qs(),a=Ps(),c=We(),{searchInput:d}=J(),l=e?.threadId,u=e?.messageId,{data:m}=Qe({...Ft(),staleTime:6e4}),f=n.useMemo(()=>m?.items??[],[m]),g=n.useMemo(()=>{if(l)return f.find(x=>x.messageId===u)??f.find(x=>x.threadId===l)},[f,l,u]),T=ms(l,u),I=g??T,v=u??I?.messageId,B=n.useMemo(()=>{if(l)return{threadId:l,mailboxId:I?.mailboxId??"",subject:I?.subject,messageId:v,authenticity:I?.authenticity}},[l,I,v]),p=n.useCallback((x,k)=>{o(x,{replace:k?.replace,query:d})},[o,d]),b=n.useCallback(x=>{v&&x.includes(v)&&a()},[v,a]),F=Oe({thread:I,isOpen:!0,onAfterOptimisticRemove:b}),S=fs(),{deleteMessages:R}=hs({mailboxId:I?.mailboxId??"",messages:f,onAfterOptimisticRemove:b}),{toggleReadFor:O}=gs({mailboxId:I?.mailboxId??"",messages:f}),L=S.focusedMessageId,M=n.useMemo(()=>f.find(x=>x.messageId===L),[f,L])??I,q=Oe({thread:M,isOpen:M?.messageId===v}),G=Ls(),E=Ot(),j=Nt(),P=n.useMemo(()=>Bt(j,l,v),[j,l,v]),y=n.useMemo(()=>{if(M)return x=>j({threadId:M.threadId,messageId:M.messageId,mode:x})},[j,M]),{nextMessageId:D,previousMessageId:_}=ps({context:S,orderedIds:S.orderedIds,selectedMessageId:v,enabled:!G&&!E,hasOpenThread:l!==void 0,onClose:a,handlers:{reply:()=>y?.("reply"),replyAll:()=>y?.("reply-all"),forward:()=>y?.("forward"),delete:()=>{S.listCommandsRef.current?.requestVerb("delete")||q.deleteThread()},toggleStar:q.toggleStar,toggleRead:()=>{S.listCommandsRef.current?.requestVerb("markRead")||M&&O([M.messageId],!M.isRead)},goFlagged:()=>c("flagged"),goSettings:()=>c("settings")}}),A=n.useCallback(x=>{if(!x)return;const k=f.find(te=>te.messageId===x);return k?{threadId:k.threadId,messageId:x}:void 0},[f]),C={selectedMessageId:v,selectedThread:I,conversation:B,onOpenThread:p,onCloseThread:a,nextThread:A(D),previousThread:A(_),actions:F,onReply:P,triage:S,onDeleteMessages:R,handleDeselectIfRemoved:b};return r.jsx(et.Provider,{value:C,children:t})}function tt(){const{selectedMessageId:e,onOpenThread:t,triage:o,onDeleteMessages:a}=X(),{accounts:c}=J();return r.jsx(mo,{accounts:c,selectedMessageId:e,onOpenThread:t,commandsRef:o.listCommandsRef,onTriageContextChange:o.onTriageContextChange,onDeleteMessages:a})}function ho(){const{conversation:e,selectedThread:t,actions:o,onReply:a,handleDeselectIfRemoved:c}=X(),d=!!e,l=ys(e?.threadId);return r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[r.jsx(vs,{hasThread:d,intelligenceOpen:l.isShowing,canToggleIntelligence:l.canToggle,onToggleIntelligence:l.toggle,onReply:a?()=>a("reply"):void 0,onReplyAll:a?()=>a("reply-all"):void 0,onForward:a?()=>a("forward"):void 0,onDelete:d?o.deleteThread:void 0,onToggleStar:d?o.toggleStar:void 0,isStarred:o.isStarred,moveContext:d&&o.accountId&&o.mailboxId?{accountId:o.accountId,currentMailboxId:o.mailboxId,onMove:o.moveThread}:void 0}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?r.jsx(Ue,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:l.open,listOnScreen:!0}):r.jsx(Dt,{})})]}),r.jsx(Ke,{isOpen:l.drawerOpen,onClose:l.closeDrawer,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:c})]})}function go(){const{selectedThread:e,handleDeselectIfRemoved:t}=X(),{onToggleIntelligence:o}=J();return r.jsx(Is,{onClose:o,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function po(){const{selectedThread:e,conversation:t,onOpenThread:o,onCloseThread:a,nextThread:c,previousThread:d,handleDeselectIfRemoved:l}=X(),u=xs(t?.threadId??null);return t?r.jsxs(r.Fragment,{children:[r.jsx(Ue,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:a,onOpenIntelligence:u.toggle,onSwipeNext:c?()=>o(c):void 0,onSwipePrevious:d?()=>o(d):void 0,mobileIntelligenceOpen:u.isOpen}),r.jsx(Ke,{isOpen:u.isOpen,onClose:u.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:l})]}):r.jsx("div",{className:"h-full",children:r.jsx(tt,{})})}const Eo=Object.assign(fo,{List:tt,Reading:ho,Intelligence:go,Phone:po});export{Eo as B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ee,i as _}from"./window-ZjseaC3I.js";import{j as n,f as j,t as d,Y as te,Z as ne,ay as f,r as p,ax as ae,X as se,i as T,en as re,eo as ie,ep as le,h as oe,s as ce,b1 as de,_ as ue}from"./index-BSMLcnNv.js";import{f as me}from"./ErrorState-jZhKH-Aj.js";import{R as z,c as he}from"./calendar-color-PMGOIawE.js";const xe=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],pe=["January","February","March","April","May","June","July","August","September","October","November","December"],fe=["first","second","third","fourth","last"],A="";function ye(e,t){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return[];const[a,s,i]=e.split("-").map(Number),r=new Date(Date.UTC(a,s-1,i)),l=xe[r.getUTCDay()],o=fe[Math.min(Math.floor((i-1)/7),4)],c=t===""?"":`, ${t}`,y=r.getUTCDay()>=1&&r.getUTCDay()<=5;return[`Every day${c}`,...y?[`Every weekday${c}`]:[],`Every week on ${l}${c}`,`Every month on the ${o} ${l}${c}`,`Every year on ${i} ${pe[s-1]}${c}`]}const ve="w-full rounded-md border border-line bg-surface-sunken px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus-visible:border-line-strong focus-visible:ring-2 focus-visible:ring-ring/30",u=({draft:e,onChange:t},a,s)=>t({...e,[a]:s});function x({label:e,children:t}){return n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:e}),t]})}function ge({draft:e,onChange:t,layout:a="compact",touch:s}){const i=a==="pane";return n.jsx(f,{value:e.title,placeholder:"Title","aria-label":"Title",onChange:r=>u({draft:e,onChange:t},"title",r.target.value),className:d(i?"text-lg font-medium":"text-md font-medium",i?"h-11":s?"min-h-11":"")})}function H(e){return e.allDay||e.startTime===""||e.endTime===""?!1:e.endTime<e.startTime}function be({draft:e,onChange:t,touch:a}){const s=a?"min-h-11":"",i=H(e),r=p.useId();return n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx(f,{type:"date",value:e.date,"aria-label":"Date",onChange:l=>u({draft:e,onChange:t},"date",l.target.value),className:d("w-40",s)}),e.allDay?n.jsx("span",{className:"text-sm text-fg-muted",children:"All day"}):n.jsxs(n.Fragment,{children:[n.jsx(f,{type:"time",value:e.startTime,"aria-label":"Start time",max:e.endTime===""?void 0:e.endTime,"aria-invalid":i,"aria-describedby":i?r:void 0,onChange:l=>u({draft:e,onChange:t},"startTime",l.target.value),className:d("w-28",s,i&&"border-danger/60")}),n.jsx("span",{className:"text-sm text-fg-subtle",children:"to"}),n.jsx(f,{type:"time",value:e.endTime,"aria-label":"End time",min:e.startTime===""?void 0:e.startTime,"aria-invalid":i,"aria-describedby":i?r:void 0,onChange:l=>u({draft:e,onChange:t},"endTime",l.target.value),className:d("w-28",s,i&&"border-danger/60")})]}),n.jsxs("label",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[n.jsx("input",{type:"checkbox",checked:e.allDay,onChange:l=>u({draft:e,onChange:t},"allDay",l.target.checked),className:"size-4 accent-current"}),"All day"]})]}),i&&n.jsxs("p",{id:r,className:"text-xs text-danger",role:"alert",children:["Ends before it starts. Move the end past ",e.startTime,", or start earlier."]})]})}function Ee({draft:e,onChange:t,calendars:a,touch:s}){return n.jsx(Ae,{calendars:a,value:e.calendarId,onChange:i=>u({draft:e,onChange:t},"calendarId",i),touch:s})}function Ne({draft:e,onChange:t,touch:a,repeatEditable:s=!0,onCustom:i}){return s?n.jsx(ke,{value:e.repeat,date:e.date,startTime:e.startTime,onChange:r=>u({draft:e,onChange:t},"repeat",r),onCustom:i,className:a?"min-h-11":""}):n.jsxs("p",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[n.jsx(z,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.repeat===A?"Does not repeat":e.repeat]})}function je({draft:e,onChange:t,touch:a}){return n.jsx(f,{value:e.location,placeholder:"Location","aria-label":"Location",onChange:s=>u({draft:e,onChange:t},"location",s.target.value),className:a?"min-h-11":""})}function Te({draft:e,onChange:t,touch:a}){return n.jsx(f,{value:e.guests,placeholder:"Guests, comma separated","aria-label":"Guests",onChange:s=>u({draft:e,onChange:t},"guests",s.target.value),className:a?"min-h-11":""})}function Ce({draft:e,onChange:t,layout:a="compact"}){return n.jsx("textarea",{value:e.notes,placeholder:"Notes","aria-label":"Notes",onChange:s=>u({draft:e,onChange:t},"notes",s.target.value),rows:a==="pane"?6:3,className:ve})}function De({draft:e,onChange:t,calendars:a,layout:s="compact",expanded:i=!1,onToggleExpanded:r,onSave:l,onCancel:o,onDelete:c,saveLabel:y="Add",header:g,repeatEditable:b=!0,guestsEditable:I=!1,calendarEditable:M=!0,onCustomRepeat:X,touch:m,className:w}){const v=s==="pane",h={draft:e,onChange:t,layout:s,touch:m},S=n.jsx(ge,{...h}),$=n.jsx(be,{...h}),R=n.jsx(Ee,{...h,calendars:a}),F=n.jsx(Ne,{...h,repeatEditable:b,onCustom:X}),Y=n.jsx(je,{...h}),L=n.jsx(Te,{...h}),P=n.jsx(Ce,{...h}),W=n.jsxs("div",{className:d("flex items-center gap-2",v?"pt-2":"pt-1"),children:[n.jsx(j,{variant:"primary",size:m||v?"md":"sm",onClick:l,disabled:H(e),className:m?"min-h-11 flex-1":"",children:y}),n.jsx(j,{variant:"ghost",size:m||v?"md":"sm",onClick:o,className:m?"min-h-11":"",children:"Cancel"}),c&&n.jsx(j,{variant:"ghost",size:m||v?"md":"sm",onClick:c,className:d("ml-auto text-danger",m&&"min-h-11"),children:"Delete"})]});if(v)return n.jsxs("div",{className:d("flex flex-col gap-5",w),children:[g,n.jsx(x,{label:"Title",children:S}),n.jsx(x,{label:"When",children:$}),M&&n.jsx(x,{label:"Calendar",children:R}),n.jsx(x,{label:"Repeat",children:F}),n.jsx(x,{label:"Location",children:Y}),I&&n.jsx(x,{label:"Guests",children:L}),n.jsx(x,{label:"Notes",children:P}),W]});const Z=r!==void 0&&!i;return n.jsxs("div",{className:d("flex flex-col gap-3",w),children:[g,S,$,M&&R,r&&n.jsxs("button",{type:"button",onClick:r,"aria-expanded":i,className:d("flex items-center gap-1 self-start rounded-sm text-xs font-medium text-fg-muted outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",m&&"min-h-11"),children:[i?n.jsx(te,{className:"size-3.5"}):n.jsx(ne,{className:"size-3.5"}),i?"Fewer details":"More details"]}),!Z&&n.jsxs("div",{className:"flex flex-col gap-2 border-t border-line pt-3",children:[Y,I&&L,F,P]}),W]})}const U="__custom__";function ke({value:e,date:t,startTime:a,onChange:s,onCustom:i,className:r}){const l=ye(t,a),o=e===A||l.includes(e)?l:[e,...l];return n.jsxs(ae,{icon:n.jsx(z,{className:"size-4"}),"aria-label":"Repeat",value:e,onChange:c=>{if(c.target.value===U){i?.();return}s(c.target.value)},className:r,children:[n.jsx("option",{value:A,children:"Does not repeat"}),o.map(c=>n.jsx("option",{value:c,children:c},c)),i&&n.jsx("option",{value:U,children:"Custom…"})]})}function Ae({calendars:e,value:t,onChange:a,touch:s}){const i=p.useId();return n.jsxs("fieldset",{className:"flex flex-wrap gap-1.5",children:[n.jsx("legend",{className:"sr-only",children:"Calendar"}),e.map(r=>{const l=he(r.color),o=r.id===t;return n.jsxs("label",{className:d("inline-flex cursor-pointer items-center gap-1.5 rounded-full border px-2.5 text-xs transition-colors","has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring",s?"min-h-11":"h-7",o?d(l.soft,l.text,l.border):"border-line text-fg-muted hover:bg-surface-sunken"),children:[n.jsx("input",{type:"radio",name:i,value:r.id,checked:o,onChange:()=>a(r.id),className:"sr-only"}),n.jsx("span",{className:d("size-2 rounded-full",l.solid)}),r.name]},r.id)})]})}function Oe({title:e,subtitle:t,onClose:a,children:s,className:i}){return n.jsxs("section",{className:d("flex h-full w-full flex-col bg-surface",i),children:[n.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[n.jsx("h2",{className:"shrink-0 text-xs font-medium text-fg",children:e}),t!==void 0&&t!==""&&n.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-fg-muted",children:t}),n.jsx("button",{type:"button","aria-label":"Close editor",onClick:a,className:"ml-auto flex size-7 shrink-0 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",children:n.jsx(se,{className:"size-4"})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-row-inset py-5",children:n.jsx("div",{className:"mx-auto w-full max-w-2xl",children:s})})]})}const E=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],N=["SU","MO","TU","WE","TH","FR","SA"],Q=["January","February","March","April","May","June","July","August","September","October","November","December"],K=["first","second","third","fourth","last"],G=[1,2,3,4,-1],J="MO,TU,WE,TH,FR",Ie=e=>e.replace(/,\s*\d{2}:\d{2}$/,"").trim();function O(e){const t=Ie(e);if(t==="")return"";if(t==="Every day")return"FREQ=DAILY";if(t==="Every weekday")return`FREQ=WEEKLY;BYDAY=${J}`;const a=t.match(/^Every week on (\w+)$/);if(a){const r=E.indexOf(a[1]);return r===-1?void 0:`FREQ=WEEKLY;BYDAY=${N[r]}`}const s=t.match(/^Every month on the (\w+) (\w+)$/);if(s){const r=K.indexOf(s[1]),l=E.indexOf(s[2]);return r===-1||l===-1?void 0:`FREQ=MONTHLY;BYDAY=${G[r]}${N[l]}`}const i=t.match(/^Every year on (\d{1,2}) (\w+)$/);if(i){const r=Q.indexOf(i[2]);return r===-1?void 0:`FREQ=YEARLY;BYMONTH=${r+1};BYMONTHDAY=${Number(i[1])}`}}const Me=e=>e===""?"":`, ${e}`;function Pe(e,t){const a=new Map(e.split(";").map(l=>l.split("=")).filter(l=>l.length===2).map(([l,o])=>[l.toUpperCase(),o.toUpperCase()])),s=Me(t),i=a.get("FREQ"),r=a.get("BYDAY");if(!(a.has("INTERVAL")&&a.get("INTERVAL")!=="1")&&!(a.has("UNTIL")||a.has("COUNT"))){if(i==="DAILY")return`Every day${s}`;if(i==="WEEKLY"){if(r===void 0)return;if(r===J)return`Every weekday${s}`;const l=N.indexOf(r);return l===-1?void 0:`Every week on ${E[l]}${s}`}if(i==="MONTHLY"){const l=r?.match(/^(-?\d)([A-Z]{2})$/);if(!l)return;const o=G.indexOf(Number(l[1])),c=N.indexOf(l[2]);return o===-1||c===-1?void 0:`Every month on the ${K[o]} ${E[c]}${s}`}if(i==="YEARLY"){const l=Number(a.get("BYMONTH")),o=Number(a.get("BYMONTHDAY"));return!l||!o||l>12?void 0:`Every year on ${o} ${Q[l-1]}${s}`}}}function We(e,t){return{title:"",date:e,startTime:"09:00",endTime:"10:00",allDay:!1,calendarId:t,location:"",guests:"",notes:"",repeat:""}}function _e(e,t){return{title:e.title,date:e.start.slice(0,10),startTime:e.allDay?"":e.start.slice(11,16),endTime:e.allDay?"":e.end.slice(11,16),allDay:e.allDay,calendarId:e.calendarId,location:t.location,guests:"",notes:t.notes,repeat:t.repeat}}function q(e,t){return e.allDay?{start:e.date,end:ee(e.date,1)}:{start:_(e.date,e.startTime,t),end:_(e.date,e.endTime,t)}}function V(e,t){return e.title.trim()===""?"Give the event a title before saving it.":e.date===""?"Pick the day the event is on.":e.calendarId===""?"Pick the calendar to save the event in.":!e.allDay&&(e.startTime===""||e.endTime==="")?"Set a start and an end time, or mark the event all day.":!e.allDay&&e.endTime<=e.startTime?"The end time is not after the start time. Move one of them.":t&&O(e.repeat)===void 0?"This calendar can't store that repeat rule. Pick one of the offered rules, or turn the repeat off.":""}function Ue(e,t){const a=V(e,!0);if(a!=="")return{ok:!1,problem:a};const{start:s,end:i}=q(e,t);return{ok:!0,input:{calendarId:e.calendarId,summary:e.title.trim(),description:e.notes,location:e.location,start:s,end:i,allDay:e.allDay,...t===""?{}:{timeZone:t},recurrenceRule:O(e.repeat)??""}}}function Be(e,t,a){const s=t.repeat!==e.repeat,i=V(t,s);if(i!=="")return{ok:!1,problem:i};const r={};if(t.title.trim()!==e.title.trim()&&(r.summary=t.title.trim()),t.location!==e.location&&(r.location=t.location),t.notes!==e.notes&&(r.description=t.notes),t.date!==e.date||t.startTime!==e.startTime||t.endTime!==e.endTime||t.allDay!==e.allDay){const{start:o,end:c}=q(t,a);r.start=o,r.end=c,r.allDay=t.allDay,a!==""&&(r.timeZone=a)}return s&&(r.recurrenceRule=O(t.repeat)??""),{ok:!0,patch:r}}const C=ce(400,404,412),we=new Set(["calendarEventOperationsListCalendarEvents","calendarEventDetailOperationsGetCalendarEvent","calendarFreeBusyOperationsListCalendarFreeBusy"]),D={kind:"written"},k=e=>de(e)===412?{kind:"conflict"}:{kind:"refused",message:me(e)},Se={this:"This",following:"Following",all:"All"};function $e(){const e=oe();return p.useCallback(()=>{e.invalidateQueries({predicate:t=>{const a=t.queryKey[0];if(typeof a!="object"||a===null)return!1;const s=a._id;return typeof s=="string"&&we.has(s)}})},[e])}const B=({scope:e,recurrenceId:t})=>e===void 0||e==="all"?{}:{scope:Se[e],recurrenceId:t};function ze(){const e=$e(),t=T({...re(),meta:C,onSuccess:e}),a=T({...ie(),meta:C,onSuccess:e}),s=T({...le(),meta:C,onSuccess:e}),i=p.useCallback(o=>t.mutateAsync({body:o}).then(()=>D).catch(k),[t]),r=p.useCallback((o,c)=>a.mutateAsync({path:{calendarObjectId:o.calendarObjectId},query:{calendarId:o.calendarId,...B(o)},headers:{"If-Match":o.etag},body:c}).then(()=>D).catch(k),[a]),l=p.useCallback(o=>s.mutateAsync({path:{calendarObjectId:o.calendarObjectId},query:{calendarId:o.calendarId,...B(o)},headers:{"If-Match":o.etag}}).then(()=>D).catch(k),[s]);return p.useMemo(()=>({createEvent:i,updateEvent:r,deleteEvent:l,isWriting:t.isPending||a.isPending||s.isPending}),[i,r,l,t.isPending,a.isPending,s.isPending])}function He({title:e,subtitle:t,calendars:a,draft:s,onChange:i,problem:r,saveLabel:l,isSaving:o,repeatEditable:c=!0,calendarEditable:y=!0,onSave:g,onCancel:b}){return n.jsx(Oe,{title:e,subtitle:t,onClose:b,children:n.jsx(De,{draft:s,onChange:i,calendars:a,layout:"pane",repeatEditable:c,calendarEditable:y,saveLabel:o?"Saving…":l,onSave:g,onCancel:b,header:r===""?void 0:n.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[n.jsx(ue,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":"true"}),n.jsx("p",{className:"min-w-0 flex-1 break-words text-fg",children:r})]})})})}export{He as C,Ue as c,_e as d,We as e,Be as p,Pe as t,ze as u};
|
|
1
|
+
import{a as ee,i as _}from"./window-DGvdrRej.js";import{j as n,f as j,t as d,Y as te,Z as ne,ay as f,r as p,ax as ae,X as se,i as T,en as re,eo as ie,ep as le,h as oe,s as ce,b1 as de,_ as ue}from"./index-DaE4Ytea.js";import{f as me}from"./ErrorState-CXIFiCFp.js";import{R as z,c as he}from"./calendar-color-BQIBbIZI.js";const xe=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],pe=["January","February","March","April","May","June","July","August","September","October","November","December"],fe=["first","second","third","fourth","last"],A="";function ye(e,t){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return[];const[a,s,i]=e.split("-").map(Number),r=new Date(Date.UTC(a,s-1,i)),l=xe[r.getUTCDay()],o=fe[Math.min(Math.floor((i-1)/7),4)],c=t===""?"":`, ${t}`,y=r.getUTCDay()>=1&&r.getUTCDay()<=5;return[`Every day${c}`,...y?[`Every weekday${c}`]:[],`Every week on ${l}${c}`,`Every month on the ${o} ${l}${c}`,`Every year on ${i} ${pe[s-1]}${c}`]}const ve="w-full rounded-md border border-line bg-surface-sunken px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus-visible:border-line-strong focus-visible:ring-2 focus-visible:ring-ring/30",u=({draft:e,onChange:t},a,s)=>t({...e,[a]:s});function x({label:e,children:t}){return n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:e}),t]})}function ge({draft:e,onChange:t,layout:a="compact",touch:s}){const i=a==="pane";return n.jsx(f,{value:e.title,placeholder:"Title","aria-label":"Title",onChange:r=>u({draft:e,onChange:t},"title",r.target.value),className:d(i?"text-lg font-medium":"text-md font-medium",i?"h-11":s?"min-h-11":"")})}function H(e){return e.allDay||e.startTime===""||e.endTime===""?!1:e.endTime<e.startTime}function be({draft:e,onChange:t,touch:a}){const s=a?"min-h-11":"",i=H(e),r=p.useId();return n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx(f,{type:"date",value:e.date,"aria-label":"Date",onChange:l=>u({draft:e,onChange:t},"date",l.target.value),className:d("w-40",s)}),e.allDay?n.jsx("span",{className:"text-sm text-fg-muted",children:"All day"}):n.jsxs(n.Fragment,{children:[n.jsx(f,{type:"time",value:e.startTime,"aria-label":"Start time",max:e.endTime===""?void 0:e.endTime,"aria-invalid":i,"aria-describedby":i?r:void 0,onChange:l=>u({draft:e,onChange:t},"startTime",l.target.value),className:d("w-28",s,i&&"border-danger/60")}),n.jsx("span",{className:"text-sm text-fg-subtle",children:"to"}),n.jsx(f,{type:"time",value:e.endTime,"aria-label":"End time",min:e.startTime===""?void 0:e.startTime,"aria-invalid":i,"aria-describedby":i?r:void 0,onChange:l=>u({draft:e,onChange:t},"endTime",l.target.value),className:d("w-28",s,i&&"border-danger/60")})]}),n.jsxs("label",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[n.jsx("input",{type:"checkbox",checked:e.allDay,onChange:l=>u({draft:e,onChange:t},"allDay",l.target.checked),className:"size-4 accent-current"}),"All day"]})]}),i&&n.jsxs("p",{id:r,className:"text-xs text-danger",role:"alert",children:["Ends before it starts. Move the end past ",e.startTime,", or start earlier."]})]})}function Ee({draft:e,onChange:t,calendars:a,touch:s}){return n.jsx(Ae,{calendars:a,value:e.calendarId,onChange:i=>u({draft:e,onChange:t},"calendarId",i),touch:s})}function Ne({draft:e,onChange:t,touch:a,repeatEditable:s=!0,onCustom:i}){return s?n.jsx(ke,{value:e.repeat,date:e.date,startTime:e.startTime,onChange:r=>u({draft:e,onChange:t},"repeat",r),onCustom:i,className:a?"min-h-11":""}):n.jsxs("p",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[n.jsx(z,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.repeat===A?"Does not repeat":e.repeat]})}function je({draft:e,onChange:t,touch:a}){return n.jsx(f,{value:e.location,placeholder:"Location","aria-label":"Location",onChange:s=>u({draft:e,onChange:t},"location",s.target.value),className:a?"min-h-11":""})}function Te({draft:e,onChange:t,touch:a}){return n.jsx(f,{value:e.guests,placeholder:"Guests, comma separated","aria-label":"Guests",onChange:s=>u({draft:e,onChange:t},"guests",s.target.value),className:a?"min-h-11":""})}function Ce({draft:e,onChange:t,layout:a="compact"}){return n.jsx("textarea",{value:e.notes,placeholder:"Notes","aria-label":"Notes",onChange:s=>u({draft:e,onChange:t},"notes",s.target.value),rows:a==="pane"?6:3,className:ve})}function De({draft:e,onChange:t,calendars:a,layout:s="compact",expanded:i=!1,onToggleExpanded:r,onSave:l,onCancel:o,onDelete:c,saveLabel:y="Add",header:g,repeatEditable:b=!0,guestsEditable:I=!1,calendarEditable:M=!0,onCustomRepeat:X,touch:m,className:w}){const v=s==="pane",h={draft:e,onChange:t,layout:s,touch:m},S=n.jsx(ge,{...h}),$=n.jsx(be,{...h}),R=n.jsx(Ee,{...h,calendars:a}),F=n.jsx(Ne,{...h,repeatEditable:b,onCustom:X}),Y=n.jsx(je,{...h}),L=n.jsx(Te,{...h}),P=n.jsx(Ce,{...h}),W=n.jsxs("div",{className:d("flex items-center gap-2",v?"pt-2":"pt-1"),children:[n.jsx(j,{variant:"primary",size:m||v?"md":"sm",onClick:l,disabled:H(e),className:m?"min-h-11 flex-1":"",children:y}),n.jsx(j,{variant:"ghost",size:m||v?"md":"sm",onClick:o,className:m?"min-h-11":"",children:"Cancel"}),c&&n.jsx(j,{variant:"ghost",size:m||v?"md":"sm",onClick:c,className:d("ml-auto text-danger",m&&"min-h-11"),children:"Delete"})]});if(v)return n.jsxs("div",{className:d("flex flex-col gap-5",w),children:[g,n.jsx(x,{label:"Title",children:S}),n.jsx(x,{label:"When",children:$}),M&&n.jsx(x,{label:"Calendar",children:R}),n.jsx(x,{label:"Repeat",children:F}),n.jsx(x,{label:"Location",children:Y}),I&&n.jsx(x,{label:"Guests",children:L}),n.jsx(x,{label:"Notes",children:P}),W]});const Z=r!==void 0&&!i;return n.jsxs("div",{className:d("flex flex-col gap-3",w),children:[g,S,$,M&&R,r&&n.jsxs("button",{type:"button",onClick:r,"aria-expanded":i,className:d("flex items-center gap-1 self-start rounded-sm text-xs font-medium text-fg-muted outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",m&&"min-h-11"),children:[i?n.jsx(te,{className:"size-3.5"}):n.jsx(ne,{className:"size-3.5"}),i?"Fewer details":"More details"]}),!Z&&n.jsxs("div",{className:"flex flex-col gap-2 border-t border-line pt-3",children:[Y,I&&L,F,P]}),W]})}const U="__custom__";function ke({value:e,date:t,startTime:a,onChange:s,onCustom:i,className:r}){const l=ye(t,a),o=e===A||l.includes(e)?l:[e,...l];return n.jsxs(ae,{icon:n.jsx(z,{className:"size-4"}),"aria-label":"Repeat",value:e,onChange:c=>{if(c.target.value===U){i?.();return}s(c.target.value)},className:r,children:[n.jsx("option",{value:A,children:"Does not repeat"}),o.map(c=>n.jsx("option",{value:c,children:c},c)),i&&n.jsx("option",{value:U,children:"Custom…"})]})}function Ae({calendars:e,value:t,onChange:a,touch:s}){const i=p.useId();return n.jsxs("fieldset",{className:"flex flex-wrap gap-1.5",children:[n.jsx("legend",{className:"sr-only",children:"Calendar"}),e.map(r=>{const l=he(r.color),o=r.id===t;return n.jsxs("label",{className:d("inline-flex cursor-pointer items-center gap-1.5 rounded-full border px-2.5 text-xs transition-colors","has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring",s?"min-h-11":"h-7",o?d(l.soft,l.text,l.border):"border-line text-fg-muted hover:bg-surface-sunken"),children:[n.jsx("input",{type:"radio",name:i,value:r.id,checked:o,onChange:()=>a(r.id),className:"sr-only"}),n.jsx("span",{className:d("size-2 rounded-full",l.solid)}),r.name]},r.id)})]})}function Oe({title:e,subtitle:t,onClose:a,children:s,className:i}){return n.jsxs("section",{className:d("flex h-full w-full flex-col bg-surface",i),children:[n.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[n.jsx("h2",{className:"shrink-0 text-xs font-medium text-fg",children:e}),t!==void 0&&t!==""&&n.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-fg-muted",children:t}),n.jsx("button",{type:"button","aria-label":"Close editor",onClick:a,className:"ml-auto flex size-7 shrink-0 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",children:n.jsx(se,{className:"size-4"})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-row-inset py-5",children:n.jsx("div",{className:"mx-auto w-full max-w-2xl",children:s})})]})}const E=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],N=["SU","MO","TU","WE","TH","FR","SA"],Q=["January","February","March","April","May","June","July","August","September","October","November","December"],K=["first","second","third","fourth","last"],G=[1,2,3,4,-1],J="MO,TU,WE,TH,FR",Ie=e=>e.replace(/,\s*\d{2}:\d{2}$/,"").trim();function O(e){const t=Ie(e);if(t==="")return"";if(t==="Every day")return"FREQ=DAILY";if(t==="Every weekday")return`FREQ=WEEKLY;BYDAY=${J}`;const a=t.match(/^Every week on (\w+)$/);if(a){const r=E.indexOf(a[1]);return r===-1?void 0:`FREQ=WEEKLY;BYDAY=${N[r]}`}const s=t.match(/^Every month on the (\w+) (\w+)$/);if(s){const r=K.indexOf(s[1]),l=E.indexOf(s[2]);return r===-1||l===-1?void 0:`FREQ=MONTHLY;BYDAY=${G[r]}${N[l]}`}const i=t.match(/^Every year on (\d{1,2}) (\w+)$/);if(i){const r=Q.indexOf(i[2]);return r===-1?void 0:`FREQ=YEARLY;BYMONTH=${r+1};BYMONTHDAY=${Number(i[1])}`}}const Me=e=>e===""?"":`, ${e}`;function Pe(e,t){const a=new Map(e.split(";").map(l=>l.split("=")).filter(l=>l.length===2).map(([l,o])=>[l.toUpperCase(),o.toUpperCase()])),s=Me(t),i=a.get("FREQ"),r=a.get("BYDAY");if(!(a.has("INTERVAL")&&a.get("INTERVAL")!=="1")&&!(a.has("UNTIL")||a.has("COUNT"))){if(i==="DAILY")return`Every day${s}`;if(i==="WEEKLY"){if(r===void 0)return;if(r===J)return`Every weekday${s}`;const l=N.indexOf(r);return l===-1?void 0:`Every week on ${E[l]}${s}`}if(i==="MONTHLY"){const l=r?.match(/^(-?\d)([A-Z]{2})$/);if(!l)return;const o=G.indexOf(Number(l[1])),c=N.indexOf(l[2]);return o===-1||c===-1?void 0:`Every month on the ${K[o]} ${E[c]}${s}`}if(i==="YEARLY"){const l=Number(a.get("BYMONTH")),o=Number(a.get("BYMONTHDAY"));return!l||!o||l>12?void 0:`Every year on ${o} ${Q[l-1]}${s}`}}}function We(e,t){return{title:"",date:e,startTime:"09:00",endTime:"10:00",allDay:!1,calendarId:t,location:"",guests:"",notes:"",repeat:""}}function _e(e,t){return{title:e.title,date:e.start.slice(0,10),startTime:e.allDay?"":e.start.slice(11,16),endTime:e.allDay?"":e.end.slice(11,16),allDay:e.allDay,calendarId:e.calendarId,location:t.location,guests:"",notes:t.notes,repeat:t.repeat}}function q(e,t){return e.allDay?{start:e.date,end:ee(e.date,1)}:{start:_(e.date,e.startTime,t),end:_(e.date,e.endTime,t)}}function V(e,t){return e.title.trim()===""?"Give the event a title before saving it.":e.date===""?"Pick the day the event is on.":e.calendarId===""?"Pick the calendar to save the event in.":!e.allDay&&(e.startTime===""||e.endTime==="")?"Set a start and an end time, or mark the event all day.":!e.allDay&&e.endTime<=e.startTime?"The end time is not after the start time. Move one of them.":t&&O(e.repeat)===void 0?"This calendar can't store that repeat rule. Pick one of the offered rules, or turn the repeat off.":""}function Ue(e,t){const a=V(e,!0);if(a!=="")return{ok:!1,problem:a};const{start:s,end:i}=q(e,t);return{ok:!0,input:{calendarId:e.calendarId,summary:e.title.trim(),description:e.notes,location:e.location,start:s,end:i,allDay:e.allDay,...t===""?{}:{timeZone:t},recurrenceRule:O(e.repeat)??""}}}function Be(e,t,a){const s=t.repeat!==e.repeat,i=V(t,s);if(i!=="")return{ok:!1,problem:i};const r={};if(t.title.trim()!==e.title.trim()&&(r.summary=t.title.trim()),t.location!==e.location&&(r.location=t.location),t.notes!==e.notes&&(r.description=t.notes),t.date!==e.date||t.startTime!==e.startTime||t.endTime!==e.endTime||t.allDay!==e.allDay){const{start:o,end:c}=q(t,a);r.start=o,r.end=c,r.allDay=t.allDay,a!==""&&(r.timeZone=a)}return s&&(r.recurrenceRule=O(t.repeat)??""),{ok:!0,patch:r}}const C=ce(400,404,412),we=new Set(["calendarEventOperationsListCalendarEvents","calendarEventDetailOperationsGetCalendarEvent","calendarFreeBusyOperationsListCalendarFreeBusy"]),D={kind:"written"},k=e=>de(e)===412?{kind:"conflict"}:{kind:"refused",message:me(e)},Se={this:"This",following:"Following",all:"All"};function $e(){const e=oe();return p.useCallback(()=>{e.invalidateQueries({predicate:t=>{const a=t.queryKey[0];if(typeof a!="object"||a===null)return!1;const s=a._id;return typeof s=="string"&&we.has(s)}})},[e])}const B=({scope:e,recurrenceId:t})=>e===void 0||e==="all"?{}:{scope:Se[e],recurrenceId:t};function ze(){const e=$e(),t=T({...re(),meta:C,onSuccess:e}),a=T({...ie(),meta:C,onSuccess:e}),s=T({...le(),meta:C,onSuccess:e}),i=p.useCallback(o=>t.mutateAsync({body:o}).then(()=>D).catch(k),[t]),r=p.useCallback((o,c)=>a.mutateAsync({path:{calendarObjectId:o.calendarObjectId},query:{calendarId:o.calendarId,...B(o)},headers:{"If-Match":o.etag},body:c}).then(()=>D).catch(k),[a]),l=p.useCallback(o=>s.mutateAsync({path:{calendarObjectId:o.calendarObjectId},query:{calendarId:o.calendarId,...B(o)},headers:{"If-Match":o.etag}}).then(()=>D).catch(k),[s]);return p.useMemo(()=>({createEvent:i,updateEvent:r,deleteEvent:l,isWriting:t.isPending||a.isPending||s.isPending}),[i,r,l,t.isPending,a.isPending,s.isPending])}function He({title:e,subtitle:t,calendars:a,draft:s,onChange:i,problem:r,saveLabel:l,isSaving:o,repeatEditable:c=!0,calendarEditable:y=!0,onSave:g,onCancel:b}){return n.jsx(Oe,{title:e,subtitle:t,onClose:b,children:n.jsx(De,{draft:s,onChange:i,calendars:a,layout:"pane",repeatEditable:c,calendarEditable:y,saveLabel:o?"Saving…":l,onSave:g,onCancel:b,header:r===""?void 0:n.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[n.jsx(ue,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":"true"}),n.jsx("p",{className:"min-w-0 flex-1 break-words text-fg",children:r})]})})})}export{He as C,Ue as c,_e as d,We as e,Be as p,Pe as t,ze as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,r as e}from"./index-
|
|
1
|
+
import{j as t,r as e}from"./index-DaE4Ytea.js";const o=e.createContext(void 0),C=({pick:s,children:r})=>t.jsx(o.Provider,{value:s,children:r}),d=()=>e.useContext(o);export{C,d as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,j as n,ak as l,al as o}from"./index-
|
|
1
|
+
import{r,j as n,ak as l,al as o}from"./index-DaE4Ytea.js";const i=r.createContext(null),v=({chrome:s,children:a})=>n.jsx(i.Provider,{value:s,children:a});function C({workspace:s,reading:a,hasOpenEvent:x}){const e=r.useContext(i);if(!e)return n.jsx(l,{});const t={nav:e.nav,skeleton:n.jsx(l,{}),isLoading:e.isLoading,navOpen:e.navOpen,onOpenNav:e.onOpenNav,onCloseNav:e.onCloseNav,listBias:"list"};return e.isSinglePane?n.jsx(o,{...t,list:x?a:s}):n.jsx(o,{...t,list:s,reading:a})}export{v as C,C as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./index-
|
|
1
|
+
import{j as e}from"./index-DaE4Ytea.js";const x=({message:s,icon:t})=>e.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[t&&e.jsx("div",{className:"mb-4 text-fg-muted",children:t}),e.jsx("p",{className:"text-fg-muted",children:s})]});export{x as E};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,_ as r}from"./index-
|
|
1
|
+
import{j as t,_ as r}from"./index-DaE4Ytea.js";const d=e=>e instanceof Error?e.message:typeof e=="string"?e:typeof e=="object"&&e!==null&&"message"in e&&typeof e.message=="string"?e.message:"An unexpected error occurred",l=({title:e="Couldn't load content",error:a,onRetry:s,variant:i="block"})=>{const n=d(a);return i==="inline"?t.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[t.jsx(r,{className:"size-4 shrink-0 text-danger mt-0.5","aria-hidden":"true"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"font-medium text-danger",children:e}),t.jsx("p",{className:"text-fg-muted mt-0.5 break-words",children:n})]}),s&&t.jsx("button",{type:"button",onClick:s,className:"shrink-0 text-sm font-medium text-accent hover:underline",children:"Retry"})]}):t.jsxs("div",{role:"alert",className:"flex flex-col items-center justify-center gap-3 p-8 text-center",children:[t.jsx(r,{className:"size-8 text-danger","aria-hidden":"true"}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-danger",children:e}),t.jsx("p",{className:"text-sm text-fg-muted mt-1 break-words",children:n})]}),s&&t.jsx("button",{type:"button",onClick:s,className:"inline-flex items-center rounded-md border border-line bg-canvas px-4 py-2 text-sm font-medium hover:bg-surface-raised transition-colors",children:"Retry"})]})};export{l as E,d as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ef as _,r as n,ci as z,c as J,C as V,bi as ge,cM as he,aX as me,aY as fe,j as r,aj as pe,cT as Ie,cU as xe}from"./index-
|
|
1
|
+
import{ef as _,r as n,ci as z,c as J,C as V,bi as ge,cM as he,aX as me,aY as fe,j as r,aj as pe,cT as Ie,cU as xe}from"./index-DaE4Ytea.js";import{u as Te,p as X,R as ye}from"./useSearchTokenContext-VwtQ9Oed.js";import{G as be,I as ve,ar as Y,aE as Se,aF as Ce,as as Re,aG as we,au as Fe,b as Me,M as je,aB as Oe,aH as Pe,aD as ke,s as Le,O as Ae,T as Z,R as Ee,P as Ne,d as qe,a0 as De,a1 as Be,a3 as $,a4 as ee,a5 as Qe,a6 as Ge,a7 as He}from"./MailListHeader-NDI2LHme.js";import{u as Ke,l as _e,b as ze,a as Ve}from"./MailViewChrome-CRBr_sF1.js";import{f as Ue}from"./ErrorState-CXIFiCFp.js";import{d as K,w as We}from"./wizard-selection-DxUM65kM.js";import{a as Xe}from"./useMessageBodyContent-CaHQbZhe.js";import{g as Ye,h as Ze}from"./search-token-index-BgcD8qG8.js";import{u as Je}from"./sections-BTfp1UaK.js";const q=e=>({...e,starred:!0,order:"desc"}),$e=(e={})=>z({query:q(e)});function te(e={}){const{data:t,isLoading:s,isError:a,error:c,refetch:l,fetchNextPage:i,hasNextPage:g,isFetchingNextPage:h}=Ke({queryKey:$e(e),queryFn:async({pageParam:I})=>{const{data:u}=await _({query:{...q(e),continuationToken:I},throwOnError:!0});return u},initialPageParam:void 0,getNextPageParam:I=>I.continuationToken,staleTime:6e4});return{threads:n.useMemo(()=>(t?.pages??[]).flatMap(I=>I.items??[]),[t]),isLoading:s,isError:a,error:c,refetch:l,fetchNextPage:i,hasNextPage:g,isFetchingNextPage:h}}function et(e,t){const s=e.query??"",a={...q(e),limit:t},{data:c}=J({queryKey:z({query:a}),queryFn:async()=>{const{data:l}=await _({query:a,throwOnError:!0});return l},enabled:s.length>0,staleTime:3e4});return n.useMemo(()=>c?.items??[],[c])}function tt(e={}){const t={...q(e),unread:!0,count:!0,results:!1},{data:s}=J({queryKey:z({query:t}),queryFn:async()=>{const{data:a}=await _({query:t,throwOnError:!0});return a},staleTime:6e4});return s?.count}const st=["category","unread","starred","attachments"],at=(e,t)=>{const s=be(e),{params:a,residual:c}=ve(t,{...s,starred:!0},st);return{criteria:{...a,...s},residual:c}},rt=200;function ot({rows:e,verb:t}){const{selectedIds:s,exitSelection:a}=ke(),c=n.useMemo(()=>We(e,s),[e,s]);return r.jsx(Le,{verb:t,selection:c,selectionRestriction:"spansAccounts",onFinished:a})}function nt({selectedMessageId:e,onOpenThread:t,commandsRef:s,onTriageContextChange:a,onDeleteMessages:c}){const{searchQuery:l,resultFolderIndex:i,onSearchClearQuery:g}=V(),h=Te(),P=ge(),I=he(),[u,m]=n.useState("all"),[S,k]=n.useState(new Set),R=n.useCallback(d=>{k(b=>{const p=new Set(b);return p.has(d)?p.delete(d):p.add(d),p})},[]),w=n.useCallback(()=>{m("all"),k(new Set)},[]),T=n.useCallback(()=>{w(),g()},[w,g]),{freeText:x,tokens:C}=X(l.trim().toLowerCase(),h),L=X(l.trim(),h).freeText,{criteria:F,residual:f}=n.useMemo(()=>at({category:u,attributes:S},C),[u,S,C]),M=n.useMemo(()=>x?{...F,query:x}:F,[F,x]),{threads:A,isLoading:E,isError:v,error:B,refetch:j,fetchNextPage:Q,hasNextPage:G,isFetchingNextPage:O}=te(F),N=et(M,rt),o=n.useMemo(()=>{const d=K(A).map(Y),b=x?Se(d.filter(p=>Ce(p,x)),K(N).map(Y)):d;return K(b).filter(p=>Re(p,f))},[A,N,x,f]),y=n.useCallback((d,b)=>{const p=o.find(ue=>ue.id===d)?.threadId;p&&t?.({threadId:p,messageId:d},b)},[o,t]),H=n.useCallback(d=>{const b=d.threadId??o.find(p=>p.id===d.id)?.threadId;b&&t?.({threadId:b,messageId:d.id})},[o,t]),re=n.useMemo(()=>we(),[]),oe=n.useMemo(()=>o.map(d=>Fe(d,i)),[o,i]),ne=tt(M)??null,ie=n.useMemo(()=>C.filter(d=>d.type!=="isStarred"),[C]),de=_e({chips:{category:u,attributes:S},tokens:ie,reach:f.length>0||x?"loaded-pages":"whole-folder",onClear:T}),U=E?"loading":v?"error":o.length===0?"empty":"ready",ce=n.useCallback(()=>{const d=me(fe());window.open(d,"_blank","noopener,noreferrer")},[]),W=Me(),le=r.jsx("div",{className:"flex h-full min-h-0 flex-col",children:r.jsxs("div",{className:"flex-1 overflow-y-auto",children:[r.jsx("div",{className:"divide-y divide-line",children:o.map(d=>r.jsx(je,{thread:d,active:d.id===e,onClick:()=>y(d.id)},d.id))}),G?r.jsx("button",{type:"button",className:"w-full py-3 text-sm text-muted hover:text-fg disabled:opacity-50",onClick:()=>Q(),disabled:O,children:O?"Loading…":"Load more"}):null]})});return r.jsx(ze,{title:"Starred",unreadCount:ne,preset:re,selectedCategory:u,activeFilters:S,onSelectCategory:m,onToggleFilter:R,onClearFilters:w,searchResults:oe,searchLoading:E,onSelectSearchResult:H,searchResultsInBody:!0,children:r.jsxs(Oe,{selectedMessageId:e,rows:o,onOpen:y,onDeleteMessages:c,onSelectionVerb:I.start,commandsRef:s,onTriageContextChange:a,children:[r.jsx(Ve,{listTitle:"Starred",sections:[{id:"flagged",threads:o}],flatList:!0,hideHeader:!0,listState:W.searchResults?"ready":U,listFilter:de,listScopeLabel:"Starred",searchQuery:L||void 0,errorMessage:v?Ue(B):void 0,onRetry:()=>j(),onReportError:ce,selectedThreadId:e,onSelectThread:y,isDesktop:P,selectionBar:r.jsx(Pe,{title:"Starred"}),listBody:W.searchResults??(U==="ready"?le:void 0)}),r.jsx(ot,{rows:o,verb:I.verb})]})})}const se=n.createContext(null);function D(){const e=n.useContext(se);if(!e)throw new Error("FlaggedPane.* must be used inside <FlaggedPane>");return e}function it({thread:e,children:t}){const s=Ye(),a=Ze(),c=Je(),{searchInput:l}=V(),i=e?.threadId,g=e?.messageId,{threads:h}=te(),P=n.useMemo(()=>{if(i)return h.find(o=>o.messageId===g)??h.find(o=>o.threadId===i)},[h,i,g]),I=Ae(i,g),u=P??I,m=g??u?.messageId,S=n.useMemo(()=>{if(i)return{threadId:i,mailboxId:u?.mailboxId??"",subject:u?.subject,messageId:m,authenticity:u?.authenticity}},[i,u,m]),k=n.useCallback((o,y)=>{s(o,{replace:y?.replace,query:l})},[s,l]),R=n.useCallback(o=>{m&&o.includes(m)&&a()},[m,a]),w=Z({thread:u,isOpen:!0,onAfterOptimisticRemove:R}),T=Ee(),{deleteMessages:x}=Ne({mailboxId:u?.mailboxId??"",messages:h,onAfterOptimisticRemove:R}),{toggleReadFor:C}=qe({mailboxId:u?.mailboxId??"",messages:h}),L=T.focusedMessageId,f=n.useMemo(()=>h.find(o=>o.messageId===L),[h,L])??u,M=Z({thread:f,isOpen:f?.messageId===m}),A=Xe(),E=pe(),v=Ie(),B=n.useMemo(()=>xe(v,i,m),[v,i,m]),j=n.useMemo(()=>{if(f)return o=>v({threadId:f.threadId,messageId:f.messageId,mode:o})},[v,f]),{nextMessageId:Q,previousMessageId:G}=De({context:T,orderedIds:T.orderedIds,selectedMessageId:m,enabled:!A&&!E,hasOpenThread:i!==void 0,onClose:a,handlers:{reply:()=>j?.("reply"),replyAll:()=>j?.("reply-all"),forward:()=>j?.("forward"),delete:()=>{T.listCommandsRef.current?.requestVerb("delete")||M.deleteThread()},toggleStar:M.toggleStar,toggleRead:()=>{T.listCommandsRef.current?.requestVerb("markRead")||f&&C([f.messageId],!f.isRead)},goBrief:()=>c("brief"),goSettings:()=>c("settings")}}),O=n.useCallback(o=>{if(!o)return;const y=h.find(H=>H.messageId===o);return y?{threadId:y.threadId,messageId:o}:void 0},[h]),N={selectedMessageId:m,selectedThread:u,conversation:S,onOpenThread:k,onCloseThread:a,nextThread:O(Q),previousThread:O(G),actions:w,onReply:B,triage:T,onDeleteMessages:x,handleDeselectIfRemoved:R};return r.jsx(se.Provider,{value:N,children:t})}function ae(){const{selectedMessageId:e,onOpenThread:t,triage:s,onDeleteMessages:a}=D();return r.jsx(nt,{selectedMessageId:e,onOpenThread:t,commandsRef:s.listCommandsRef,onTriageContextChange:s.onTriageContextChange,onDeleteMessages:a})}function dt(){const{conversation:e,selectedThread:t,actions:s,onReply:a,handleDeselectIfRemoved:c}=D(),l=!!e,i=Ge(e?.threadId);return r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[r.jsx(He,{hasThread:l,intelligenceOpen:i.isShowing,canToggleIntelligence:i.canToggle,onToggleIntelligence:i.toggle,onReply:a?()=>a("reply"):void 0,onReplyAll:a?()=>a("reply-all"):void 0,onForward:a?()=>a("forward"):void 0,onDelete:l?s.deleteThread:void 0,onToggleStar:l?s.toggleStar:void 0,isStarred:s.isStarred,moveContext:l&&s.accountId&&s.mailboxId?{accountId:s.accountId,currentMailboxId:s.mailboxId,onMove:s.moveThread}:void 0}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?r.jsx($,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:i.open,listOnScreen:!0}):r.jsx(ye,{})})]}),r.jsx(ee,{isOpen:i.drawerOpen,onClose:i.closeDrawer,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:c})]})}function ct(){const{selectedThread:e,handleDeselectIfRemoved:t}=D(),{onToggleIntelligence:s}=V();return r.jsx(Qe,{onClose:s,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function lt(){const{selectedThread:e,conversation:t,onCloseThread:s,onOpenThread:a,nextThread:c,previousThread:l,handleDeselectIfRemoved:i}=D(),g=Be(t?.threadId??null);return t?r.jsxs(r.Fragment,{children:[r.jsx($,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:s,onOpenIntelligence:g.toggle,onSwipeNext:c?()=>a(c):void 0,onSwipePrevious:l?()=>a(l):void 0,mobileIntelligenceOpen:g.isOpen}),r.jsx(ee,{isOpen:g.isOpen,onClose:g.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:i})]}):r.jsx("div",{className:"h-full",children:r.jsx(ae,{})})}const yt=Object.assign(it,{List:ae,Reading:dt,Intelligence:ct,Phone:lt});export{yt as F};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,c as f,d as m,E as N,j as e,bi as E,X as w}from"./index-
|
|
1
|
+
import{r as n,c as f,d as m,E as N,j as e,bi as E,X as w}from"./index-DaE4Ytea.js";import{E as u}from"./ErrorState-CXIFiCFp.js";import{D as r,C as x,u as k}from"./index-CjaOLUk5.js";import{c as p,d as h,e as b}from"./useMessageBodyContent-CaHQbZhe.js";import{C as S}from"./confirm-dialog-ByIuSOmS.js";const C=t=>t?"Draft":"New Message",I=()=>{const t=n.useRef(!1);return n.useCallback(()=>{const s=document.querySelector("[data-subject-field]")?.value??"",o=(document.querySelector('[data-testid="compose-body"]')?.textContent??"").replace(/--\s*/g,"").trim();return t.current=s.trim().length>0||o.length>0,t.current},[])},O=()=>{const t=p(),i=h(),s=b(),a=I(),[l,o]=n.useState(!1),{isError:d,error:c,refetch:g}=f({...m(),staleTime:1/0}),j=n.useCallback(D=>{D||(a()?o(!0):s())},[s,a]),y=n.useCallback(()=>{o(!1),s()},[s]),v=n.useCallback(()=>{o(!1)},[]);return N({id:"mobile-compose",open:!0}),e.jsxs(r.Root,{open:!0,onOpenChange:j,children:[e.jsxs(r.Portal,{children:[e.jsx(r.Overlay,{className:"fixed inset-0 z-40 bg-black/40"}),e.jsxs(r.Content,{className:"fixed inset-x-0 bottom-0 z-50 flex flex-col rounded-t-lg bg-canvas pb-[env(safe-area-inset-bottom,0px)]",style:{height:"95dvh"},children:[e.jsx(r.Handle,{className:"mx-auto mt-2 mb-1 h-1.5 w-12 rounded-full bg-fg-muted/30"}),e.jsx(r.Title,{className:"px-4 py-2 text-base font-semibold border-b border-line",children:C(t)}),d?e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(u,{title:"Couldn't load compose",error:c,onRetry:()=>{g()}})}):e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(x,{mode:"new",outboxMessageId:t,onDraftCreated:i,onClose:s})})]})]}),e.jsx(S,{isOpen:l,title:"Discard draft?",description:"Your message has unsaved content. Are you sure you want to discard it?",confirmLabel:"Discard",cancelLabel:"Keep editing",destructive:!0,onConfirm:y,onCancel:v})]})},q=()=>{const t=p(),i=h(),s=b(),a=E(),{isError:l,error:o,refetch:d}=f({...m(),staleTime:1/0});if(k({bindings:[{key:"Escape",handler:s,preventDefault:!0}]}),!a)return e.jsx(O,{});const c=e.jsxs("header",{className:"flex items-center justify-between gap-2 px-4 py-3 border-b border-line shrink-0",children:[e.jsx("div",{className:"flex items-center gap-2 min-w-0",children:e.jsx("h2",{className:"text-lg font-semibold truncate",children:C(t)})}),e.jsx("button",{type:"button",onClick:s,className:"p-2 rounded-md hover:bg-surface-raised transition-colors min-h-11 min-w-11 inline-flex items-center justify-center","aria-label":"Close",children:e.jsx(w,{className:"size-5"})})]});return l?e.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[c,e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(u,{title:"Couldn't load compose",error:o,onRetry:()=>{d()}})})]}):e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-canvas",children:[c,e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(x,{mode:"new",outboxMessageId:t,onDraftCreated:i,onClose:s})})]})};export{q as F};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ar as Rs,cX as qr,r as c,e as ne,j as s,Y as ze,Z as Es,aA as Ye,t as M,aq as Zn,a6 as Qr,f as K,X as _e,a2 as kt,U as Ue,cY as ea,aL as Gr,V as Wr,b5 as Vr,g as Ne,cW as Ht,cZ as ta,W as Xe,c_ as Yr,c$ as Xr,d0 as Jr,d1 as Zr,d2 as sa,d3 as na,d4 as qt,d5 as eo,bk as to,d6 as so,d7 as aa,bB as Ms,d8 as no,d9 as ra,aH as ao,L as oa,_ as ro,da as oo,B as ia,db as io,dc as lo,dd as co,de as uo,df as fo,w as mo,c as J,d as Je,H as jt,dg as po,dh as ho,di as Qt,h as ce,as as ye,i as pe,N as Ze,cz as Me,dj as Gt,b9 as go,dk as Ae,dl as xo,dm as an,dn as bo,s as la,dp as vo,dq as yo,dr as ko,b2 as jo,cj as wo,cO as As,cP as ca,ds as No,bi as $s,bl as da,bf as ua,bm as fa,bn as ma,E as Ls,bo as Co,aX as pa,aY as ha,cE as So,dt as To,aa as ga,cD as Io,du as Ro,dv as Eo,dw as Mo,dx as Ao,dy as xa,dz as $o,cT as Lo,F as ba,bM as Ps,dA as Po,dB as rn,dC as va,dD as os,dE as Do,bL as Fo,Q as Oo,q as zo,ag as ya,G as _o,dF as Uo,cS as on,bv as Bo,dG as Ko,dH as Ho,au as ln,cR as qo,dI as Qo,ah as Go,ch as Wo,ci as Vo,dJ as Yo,C as wt,dK as Xo,dL as Jo,dM as cn,dN as Zo,dO as ei,dP as ti,dQ as si,v as ka,cV as ni,dR as Ds,dS as ai,dT as ri,ck as oi,cf as ii,dU as li,a1 as ci,dV as ja,cl as di}from"./index-BSMLcnNv.js";import{u as ui,L as fi,a as mi}from"./roving-focus-JRZm8Nsl.js";import{m as pi,S as wa,i as Ce,t as Se,r as Nt,n as Ct,o as St,p as Tt,q as hi,h as gi,d as xi,D as bi,b as Pt,a as vi,v as yi,w as ki,x as ft,e as ji,y as wi,z as Ni,u as Ci}from"./search-token-index-srRTXc29.js";import{K as Si}from"./kbd-MeQzj_AS.js";import{P as Na,f as Ti,U as Ii,a as Ri,E as Ei,s as Mi}from"./attachment-file-BRLoj6sG.js";import{M as Ca}from"./mail-zfMejK7g.js";import{A as xt}from"./avatar-BuUa_-Ae.js";import{M as Ai,a as $i,b as Sa,c as Li,s as Ta,d as Ia,e as Pi,f as Di,S as dn,g as Ra,u as Ea,p as Fi,r as Oi}from"./useSearchTokenContext-BOZY3WZQ.js";import{C as zi,D as Ge,u as _i}from"./index-BsL3dqbS.js";import{E as Ma}from"./EmptyState-BTKm9F6Q.js";import{E as Oe}from"./ErrorState-jZhKH-Aj.js";import{a as Aa,c as et,b as Ui,g as Bi,e as Be,h as Ki,d as Hi}from"./format-bkonYesy.js";import{D as qi}from"./download-cdI2QZPl.js";import{g as Qi}from"./useMessageBodyContent-BuyQJK-3.js";import{C as Gi}from"./calendar-event-chip-CX0GIGM0.js";import{c as Wi}from"./calendar-color-PMGOIawE.js";import{R as Vi,M as Yi}from"./attendee-row-OHoLTo23.js";import{C as $a}from"./clock-KUoHWkrr.js";import{M as Xi,G as Ji}from"./map-pin-DHhEILKJ.js";import{B as Zi,b as el,u as tl,i as sl}from"./useLayoutTier-C5sdkyR7.js";import{S as nl,C as La}from"./shield-check-B34-2hLP.js";import{u as Pa}from"./useDebouncedValue--1NwWG_J.js";import{h as un,u as al,a as rl,i as ol,n as il,o as ll,j as cl,k as dl,S as ul}from"./useFilters-BYL5dTX8.js";import{u as Fs}from"./useQueries-hzIIiVUF.js";import{C as Dt}from"./confirm-dialog-BVXTDPyQ.js";import{r as fl,a as ml}from"./search-scope-B5-OK3Cq.js";import{M as pl}from"./menu-D4SB6ohG.js";function bt(e){if(hl())e.focus({preventScroll:!0});else{let t=gl(e);e.focus(),xl(t)}}let Ft=null;function hl(){if(Ft==null){Ft=!1;try{document.createElement("div").focus({get preventScroll(){return Ft=!0,!0}})}catch{}}return Ft}function gl(e){let t=e.parentNode,n=[],a=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==a;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return a instanceof HTMLElement&&n.push({element:a,scrollTop:a.scrollTop,scrollLeft:a.scrollLeft}),n}function xl(e){for(let{element:t,scrollTop:n,scrollLeft:a}of e)t.scrollTop=n,t.scrollLeft=a}const Re=e=>e?.ownerDocument??document,Ee=e=>e&&"window"in e&&e.window===e?e:Re(e).defaultView||window;function bl(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function vl(e){return bl(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let yl=!1;function Da(){return yl}function be(e,t){if(!Da())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:vl(n)?n=n.host:n=n.parentNode}return!1}function te(e){if(Da()&&e.target instanceof Element&&e.target.shadowRoot){if("composedPath"in e)return e.composedPath()[0]??null;if("composedPath"in e.nativeEvent)return e.nativeEvent.composedPath()[0]??null}return e.target}const kl=typeof Element<"u"&&"checkVisibility"in Element.prototype;function jl(e){const t=Ee(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:n,visibility:a}=e.style,r=n!=="none"&&a!=="hidden"&&a!=="collapse";if(r){const{getComputedStyle:o}=Ee(e);let{display:i,visibility:l}=o(e);r=i!=="none"&&l!=="hidden"&&l!=="collapse"}return r}function wl(e,t){return!e.hasAttribute("hidden")&&!e.hasAttribute("data-react-aria-prevent-focus")&&(e.nodeName==="DETAILS"&&t&&t.nodeName!=="SUMMARY"?e.hasAttribute("open"):!0)}function Fa(e,t){return kl?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):e.nodeName!=="#comment"&&jl(e)&&wl(e,t)&&(!e.parentElement||Fa(e.parentElement,e))}const Oa=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable^="false"])',"permission"],Nl=Oa.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";Oa.push('[tabindex]:not([tabindex="-1"]):not([disabled])');function Cl(e,t){return e.matches(Nl)&&!Sl(e)&&(t?.skipVisibilityCheck||Fa(e))}function Sl(e){let t=e;for(;t!=null;){if(t instanceof Ee(t).HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}const Os=typeof document<"u"?Rs.useLayoutEffect:()=>{};function Tl(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Il(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Rl(e){for(;e&&!Cl(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=Ee(e),n=t.document.activeElement;if(!n||n===e)return;let a=!1,r=g=>{(te(g)===n||a)&&g.stopImmediatePropagation()},o=g=>{(te(g)===n||a)&&(g.stopImmediatePropagation(),!e&&!a&&(a=!0,bt(n),d()))},i=g=>{(te(g)===e||a)&&g.stopImmediatePropagation()},l=g=>{(te(g)===e||a)&&(g.stopImmediatePropagation(),a||(a=!0,bt(n),d()))};t.addEventListener("blur",r,!0),t.addEventListener("focusout",o,!0),t.addEventListener("focusin",l,!0),t.addEventListener("focus",i,!0);let d=()=>{cancelAnimationFrame(x),t.removeEventListener("blur",r,!0),t.removeEventListener("focusout",o,!0),t.removeEventListener("focusin",l,!0),t.removeEventListener("focus",i,!0),a=!1},x=requestAnimationFrame(d);return d}function Wt(e){if(typeof window>"u"||window.navigator==null)return!1;let t=window.navigator.userAgentData?.brands;return Array.isArray(t)&&t.some(n=>e.test(n.brand))||e.test(window.navigator.userAgent)}function zs(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}function $e(e){let t=null;return()=>(t==null&&(t=e()),t)}const Ut=$e(function(){return zs(/^Mac/i)}),El=$e(function(){return zs(/^iPhone/i)}),za=$e(function(){return zs(/^iPad/i)||Ut()&&navigator.maxTouchPoints>1}),_a=$e(function(){return El()||za()}),Ml=$e(function(){return Wt(/AppleWebKit/i)&&!Al()}),Al=$e(function(){return Wt(/Chrome/i)}),Ua=$e(function(){return Wt(/Android/i)}),$l=$e(function(){return Wt(/Firefox/i)});function Ll(e){return e.pointerType===""&&e.isTrusted?!0:Ua()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Pl(e){return!Ua()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"}function vt(e,t,n=!0){let{metaKey:a,ctrlKey:r,altKey:o,shiftKey:i}=t;$l()&&window.event?.type?.startsWith("key")&&e.target==="_blank"&&(Ut()?a=!0:r=!0);let l=Ml()&&Ut()&&!za()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:a,ctrlKey:r,altKey:o,shiftKey:i}):new MouseEvent("click",{metaKey:a,ctrlKey:r,altKey:o,shiftKey:i,detail:1,bubbles:!0,cancelable:!0});vt.isOpening=n,bt(e),e.dispatchEvent(l),vt.isOpening=!1}vt.isOpening=!1;let Ie=new Map,xs=new Set;function fn(){if(typeof window>"u")return;function e(a){return"propertyName"in a}let t=a=>{let r=te(a);if(!e(a)||!r)return;let o=Ie.get(r);o||(o=new Set,Ie.set(r,o),r.addEventListener("transitioncancel",n,{once:!0})),o.add(a.propertyName)},n=a=>{let r=te(a);if(!e(a)||!r)return;let o=Ie.get(r);if(o&&(o.delete(a.propertyName),o.size===0&&(r.removeEventListener("transitioncancel",n),Ie.delete(r)),Ie.size===0)){for(let i of xs)i();xs.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",n)}typeof document<"u"&&(document.readyState!=="loading"?fn():document.addEventListener("DOMContentLoaded",fn));function Dl(){for(const[e]of Ie)"isConnected"in e&&!e.isConnected&&Ie.delete(e)}function Fl(e){requestAnimationFrame(()=>{Dl(),Ie.size===0?e():xs.add(e)})}function Ba(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}let bs=new Map;typeof FinalizationRegistry<"u"&&new FinalizationRegistry(e=>{bs.delete(e)});function Ol(e,t){if(e===t)return e;let n=bs.get(e);if(n)return n.forEach(r=>r.current=t),t;let a=bs.get(t);return a?(a.forEach(r=>r.current=e),e):t}function zl(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1;const a=e.map(r=>{const o=mn(r,t);return n||=typeof o=="function",o});if(n)return()=>{a.forEach((r,o)=>{typeof r=="function"?r():mn(e[o],null)})}}}function mn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function It(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let a=e[n];for(let r in a){let o=t[r],i=a[r];typeof o=="function"&&typeof i=="function"&&r[0]==="o"&&r[1]==="n"&&r.charCodeAt(2)>=65&&r.charCodeAt(2)<=90?t[r]=Ba(o,i):(r==="className"||r==="UNSAFE_className")&&typeof o=="string"&&typeof i=="string"?t[r]=qr(o,i):r==="id"&&o&&i?t.id=Ol(o,i):r==="ref"&&o&&i?t.ref=zl(o,i):t[r]=i!==void 0?i:o}}return t}function _l(e,t){Os(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}const Ul=Rs.useInsertionEffect??Os;function is(e){const t=c.useRef(null);return Ul(()=>{t.current=e},[e]),c.useCallback((...n)=>{const a=t.current;return a?.(...n)},[])}let We="default",vs="",_t=new WeakMap;function Bl(e){if(_a()){if(We==="default"){const t=Re(e);vs=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect="none"}We="disabled"}else if(e instanceof HTMLElement||e instanceof SVGElement){let t="userSelect"in e.style?"userSelect":"webkitUserSelect";_t.set(e,e.style[t]),e.style[t]="none"}}function pn(e){if(_a()){if(We!=="disabled")return;We="restoring",setTimeout(()=>{Fl(()=>{if(We==="restoring"){const t=Re(e);t.documentElement.style.webkitUserSelect==="none"&&(t.documentElement.style.webkitUserSelect=vs||""),vs="",We="default"}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&_t.has(e)){let t=_t.get(e),n="userSelect"in e.style?"userSelect":"webkitUserSelect";e.style[n]==="none"&&(e.style[n]=t),e.getAttribute("style")===""&&e.removeAttribute("style"),_t.delete(e)}}function hn(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let ls=new WeakMap;function Kl(e){let t=e??(typeof document<"u"?document:void 0);if(!t)return hn(t);if(ls.has(t))return ls.get(t);let n=t.querySelector('meta[property="csp-nonce"]'),a=n&&n instanceof Ee(n).HTMLMetaElement&&(n.nonce||n.content)||hn(t)||void 0;return a!==void 0&&ls.set(t,a),a}const Ka=Rs.createContext({register:()=>{}});Ka.displayName="PressResponderContext";function Ha(){let e=c.useRef(new Map),t=c.useCallback((r,o,i,l)=>{let d=l?.once?(...x)=>{e.current.delete(i),i(...x)}:i;e.current.set(i,{type:o,eventTarget:r,fn:d,options:l}),r.addEventListener(o,d,l)},[]),n=c.useCallback((r,o,i,l)=>{let d=e.current.get(i)?.fn||i;r.removeEventListener(o,d,l),e.current.delete(i)},[]),a=c.useCallback(()=>{e.current.forEach((r,o)=>{n(r.eventTarget,r.type,o,r.options)})},[n]);return c.useEffect(()=>a,[a]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:a}}function Hl(e){let t=c.useContext(Ka);if(t){let{register:n,ref:a,...r}=t;e=It(r,e),n()}return _l(t,e.ref),e}class Ot{#e;constructor(t,n,a,r){this.#e=!0;const i=(r?.target??a.currentTarget)?.getBoundingClientRect();let l,d=0,x,g=null;a.clientX!=null&&a.clientY!=null&&(x=a.clientX,g=a.clientY),i&&(x!=null&&g!=null?(l=x-i.left,d=g-i.top):(l=i.width/2,d=i.height/2)),this.type=t,this.pointerType=n,this.target=a.currentTarget,this.shiftKey=a.shiftKey,this.metaKey=a.metaKey,this.ctrlKey=a.ctrlKey,this.altKey=a.altKey,this.x=l,this.y=d,this.key=a.key}continuePropagation(){this.#e=!1}get shouldStopPropagation(){return this.#e}}const gn=Symbol("linkClicked"),xn="react-aria-pressable-style",bn="data-react-aria-pressable";function ql(e){let{onPress:t,onPressChange:n,onPressStart:a,onPressEnd:r,onPressUp:o,onClick:i,isDisabled:l,isPressed:d,preventFocusOnPress:x,shouldCancelOnPointerExit:g,allowTextSelectionOnPress:v,ref:m,...b}=Hl(e),[f,u]=c.useState(!1),h=c.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:p,removeAllGlobalListeners:w}=Ha(),y=c.useCallback((j,E)=>{let O=h.current;if(l||O.didFirePressStart)return!1;let N=!0;if(O.isTriggeringEvent=!0,a){let A=new Ot("pressstart",E,j);a(A),N=A.shouldStopPropagation}return n&&n(!0),O.isTriggeringEvent=!1,O.didFirePressStart=!0,u(!0),N},[l,a,n]),k=c.useCallback((j,E,O=!0)=>{let N=h.current;if(!N.didFirePressStart)return!1;N.didFirePressStart=!1,N.isTriggeringEvent=!0;let A=!0;if(r){let C=new Ot("pressend",E,j);r(C),A=C.shouldStopPropagation}if(n&&n(!1),u(!1),t&&O&&!l){let C=new Ot("press",E,j);t(C),A&&=C.shouldStopPropagation}return N.isTriggeringEvent=!1,A},[l,r,n,t]),S=is(k),R=c.useCallback((j,E)=>{let O=h.current;if(l)return!1;if(o){O.isTriggeringEvent=!0;let N=new Ot("pressup",E,j);return o(N),O.isTriggeringEvent=!1,N.shouldStopPropagation}return!0},[l,o]),$=is(R),D=c.useCallback(j=>{let E=h.current;if(E.isPressed&&E.target){E.didFirePressStart&&E.pointerType!=null&&k(Fe(E.target,j),E.pointerType,!1),E.isPressed=!1,E.isOverTarget=!1,E.activePointerId=null,E.pointerType=null,w(),v||pn(E.target);for(let O of E.disposables)O();E.disposables=[]}},[v,w,k]),P=is(D);c.useEffect(()=>{l&&h.current.isPressed&&P({currentTarget:h.current.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})},[l]);let L=c.useCallback(j=>{g&&D(j)},[g,D]),I=c.useCallback(j=>{l||i?.(j)},[l,i]),F=c.useCallback((j,E)=>{if(!l&&i){let O=new MouseEvent("click",j);Il(O,E),i(Tl(O))}},[l,i]),_=c.useMemo(()=>{let j=h.current,E={onKeyDown(N){if(cs(N.nativeEvent,N.currentTarget)&&be(N.currentTarget,te(N))){vn(te(N),N.key)&&N.preventDefault();let A=!0;!j.isPressed&&!N.repeat&&(j.target=N.currentTarget,j.isPressed=!0,j.pointerType="keyboard",A=y(N,"keyboard"));let C=N.currentTarget,B=U=>{cs(U,C)&&!U.repeat&&be(C,te(U))&&j.target&&$(Fe(j.target,U),"keyboard")};p(Re(N.currentTarget),"keyup",Ba(B,O),!0),A&&N.stopPropagation(),N.metaKey&&Ut()&&j.metaKeyEvents?.set(N.key,N.nativeEvent)}else N.key==="Meta"&&(j.metaKeyEvents=new Map)},onClick(N){if(!(N&&!be(N.currentTarget,te(N)))&&N&&N.button===0&&!j.isTriggeringEvent&&!vt.isOpening){let A=!0;if(l&&N.preventDefault(),!j.ignoreEmulatedMouseEvents&&!j.isPressed&&(j.pointerType==="virtual"||Ll(N.nativeEvent))){let C=y(N,"virtual"),B=$(N,"virtual"),U=S(N,"virtual");I(N),A=C&&B&&U}else if(j.isPressed&&j.pointerType!=="keyboard"){let C=j.pointerType||N.nativeEvent.pointerType||"virtual",B=$(Fe(N.currentTarget,N),C),U=S(Fe(N.currentTarget,N),C,!0);A=B&&U,j.isOverTarget=!1,I(N),P(N)}j.ignoreEmulatedMouseEvents=!1,A&&N.stopPropagation()}}},O=N=>{if(j.isPressed&&j.target&&cs(N,j.target)){vn(te(N),N.key)&&N.preventDefault();let A=te(N),C=be(j.target,A);S(Fe(j.target,N),"keyboard",C),C&&F(N,j.target),w(),N.key!=="Enter"&&_s(j.target)&&be(j.target,A)&&!N[gn]&&(N[gn]=!0,vt(j.target,N,!1)),j.isPressed=!1,j.metaKeyEvents?.delete(N.key)}else if(N.key==="Meta"&&j.metaKeyEvents?.size){let A=j.metaKeyEvents;j.metaKeyEvents=void 0;for(let C of A.values())j.target?.dispatchEvent(new KeyboardEvent("keyup",C))}};if(typeof PointerEvent<"u"){E.onPointerDown=C=>{if(C.button!==0||!be(C.currentTarget,te(C)))return;if(Pl(C.nativeEvent)){j.pointerType="virtual";return}j.pointerType=C.pointerType;let B=!0;if(!j.isPressed){j.isPressed=!0,j.isOverTarget=!0,j.activePointerId=C.pointerId,j.target=C.currentTarget,v||Bl(j.target),B=y(C,j.pointerType);let U=te(C);"releasePointerCapture"in U&&("hasPointerCapture"in U?U.hasPointerCapture(C.pointerId)&&U.releasePointerCapture(C.pointerId):U.releasePointerCapture(C.pointerId)),p(Re(C.currentTarget),"pointerup",N,!1),p(Re(C.currentTarget),"pointercancel",A,!1)}B&&C.stopPropagation()},E.onMouseDown=C=>{if(be(C.currentTarget,te(C))&&C.button===0){if(x){let B=Rl(C.target);B&&j.disposables.push(B)}C.stopPropagation()}},E.onPointerUp=C=>{!be(C.currentTarget,te(C))||j.pointerType==="virtual"||C.button===0&&!j.isPressed&&$(C,j.pointerType||C.pointerType)},E.onPointerEnter=C=>{C.pointerId===j.activePointerId&&j.target&&!j.isOverTarget&&j.pointerType!=null&&(j.isOverTarget=!0,y(Fe(j.target,C),j.pointerType))},E.onPointerLeave=C=>{C.pointerId===j.activePointerId&&j.target&&j.isOverTarget&&j.pointerType!=null&&(j.isOverTarget=!1,S(Fe(j.target,C),j.pointerType,!1),L(C))};let N=C=>{if(C.pointerId===j.activePointerId&&j.isPressed&&C.button===0&&j.target){if(be(j.target,te(C))&&j.pointerType!=null){let B=!1,U=setTimeout(()=>{j.isPressed&&j.target instanceof HTMLElement&&(B?P(C):(bt(j.target),j.target.click()))},80);p(C.currentTarget,"click",()=>B=!0,!0),j.disposables.push(()=>clearTimeout(U))}else P(C);j.isOverTarget=!1}},A=C=>{P(C)};E.onDragStart=C=>{be(C.currentTarget,te(C))&&P(C)}}return E},[p,l,x,w,v,L,y,I,F]);return c.useEffect(()=>{if(!m)return;const j=Re(m.current);if(!j||!j.head||j.getElementById(xn))return;const E=j.createElement("style");E.id=xn;let O=Kl(j);O&&(E.nonce=O),E.textContent=`
|
|
1
|
+
import{ar as Rs,cX as qr,r as c,e as ne,j as s,Y as ze,Z as Es,aA as Ye,t as M,aq as Zn,a6 as Qr,f as K,X as _e,a2 as kt,U as Ue,cY as ea,aL as Gr,V as Wr,b5 as Vr,g as Ne,cW as Ht,cZ as ta,W as Xe,c_ as Yr,c$ as Xr,d0 as Jr,d1 as Zr,d2 as sa,d3 as na,d4 as qt,d5 as eo,bk as to,d6 as so,d7 as aa,bB as Ms,d8 as no,d9 as ra,aH as ao,L as oa,_ as ro,da as oo,B as ia,db as io,dc as lo,dd as co,de as uo,df as fo,w as mo,c as J,d as Je,H as jt,dg as po,dh as ho,di as Qt,h as ce,as as ye,i as pe,N as Ze,cz as Me,dj as Gt,b9 as go,dk as Ae,dl as xo,dm as an,dn as bo,s as la,dp as vo,dq as yo,dr as ko,b2 as jo,cj as wo,cO as As,cP as ca,ds as No,bi as $s,bl as da,bf as ua,bm as fa,bn as ma,E as Ls,bo as Co,aX as pa,aY as ha,cE as So,dt as To,aa as ga,cD as Io,du as Ro,dv as Eo,dw as Mo,dx as Ao,dy as xa,dz as $o,cT as Lo,F as ba,bM as Ps,dA as Po,dB as rn,dC as va,dD as os,dE as Do,bL as Fo,Q as Oo,q as zo,ag as ya,G as _o,dF as Uo,cS as on,bv as Bo,dG as Ko,dH as Ho,au as ln,cR as qo,dI as Qo,ah as Go,ch as Wo,ci as Vo,dJ as Yo,C as wt,dK as Xo,dL as Jo,dM as cn,dN as Zo,dO as ei,dP as ti,dQ as si,v as ka,cV as ni,dR as Ds,dS as ai,dT as ri,ck as oi,cf as ii,dU as li,a1 as ci,dV as ja,cl as di}from"./index-DaE4Ytea.js";import{u as ui,L as fi,a as mi}from"./roving-focus-CZcayiPM.js";import{m as pi,S as wa,i as Ce,t as Se,r as Nt,n as Ct,o as St,p as Tt,q as hi,h as gi,d as xi,D as bi,b as Pt,a as vi,v as yi,w as ki,x as ft,e as ji,y as wi,z as Ni,u as Ci}from"./search-token-index-BgcD8qG8.js";import{K as Si}from"./kbd-DUf8TYSh.js";import{P as Na,f as Ti,U as Ii,a as Ri,E as Ei,s as Mi}from"./attachment-file-CVx5-2tG.js";import{M as Ca}from"./mail-CYJ32Az9.js";import{A as xt}from"./avatar-CWLq4Fxm.js";import{M as Ai,a as $i,b as Sa,c as Li,s as Ta,d as Ia,e as Pi,f as Di,S as dn,g as Ra,u as Ea,p as Fi,r as Oi}from"./useSearchTokenContext-VwtQ9Oed.js";import{C as zi,D as Ge,u as _i}from"./index-CjaOLUk5.js";import{E as Ma}from"./EmptyState-CQv38K8z.js";import{E as Oe}from"./ErrorState-CXIFiCFp.js";import{a as Aa,c as et,b as Ui,g as Bi,e as Be,h as Ki,d as Hi}from"./format-DODyYau7.js";import{D as qi}from"./download-B85AK7YQ.js";import{g as Qi}from"./useMessageBodyContent-CaHQbZhe.js";import{C as Gi}from"./calendar-event-chip-gQ9wSVIt.js";import{c as Wi}from"./calendar-color-BQIBbIZI.js";import{R as Vi,M as Yi}from"./attendee-row-B__RNuS2.js";import{C as $a}from"./clock-CB2fZ36m.js";import{M as Xi,G as Ji}from"./map-pin-CjhMoM7f.js";import{B as Zi,b as el,u as tl,i as sl}from"./useLayoutTier-Q5StPSkt.js";import{S as nl,C as La}from"./shield-check-BGjBAfG6.js";import{u as Pa}from"./useDebouncedValue-Bx1ysP_7.js";import{h as un,u as al,a as rl,i as ol,n as il,o as ll,j as cl,k as dl,S as ul}from"./useFilters-BwWGufAN.js";import{u as Fs}from"./useQueries-BviBmJi1.js";import{C as Dt}from"./confirm-dialog-ByIuSOmS.js";import{r as fl,a as ml}from"./search-scope-B5-OK3Cq.js";import{M as pl}from"./menu-Bn2nArxC.js";function bt(e){if(hl())e.focus({preventScroll:!0});else{let t=gl(e);e.focus(),xl(t)}}let Ft=null;function hl(){if(Ft==null){Ft=!1;try{document.createElement("div").focus({get preventScroll(){return Ft=!0,!0}})}catch{}}return Ft}function gl(e){let t=e.parentNode,n=[],a=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==a;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return a instanceof HTMLElement&&n.push({element:a,scrollTop:a.scrollTop,scrollLeft:a.scrollLeft}),n}function xl(e){for(let{element:t,scrollTop:n,scrollLeft:a}of e)t.scrollTop=n,t.scrollLeft=a}const Re=e=>e?.ownerDocument??document,Ee=e=>e&&"window"in e&&e.window===e?e:Re(e).defaultView||window;function bl(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function vl(e){return bl(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let yl=!1;function Da(){return yl}function be(e,t){if(!Da())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:vl(n)?n=n.host:n=n.parentNode}return!1}function te(e){if(Da()&&e.target instanceof Element&&e.target.shadowRoot){if("composedPath"in e)return e.composedPath()[0]??null;if("composedPath"in e.nativeEvent)return e.nativeEvent.composedPath()[0]??null}return e.target}const kl=typeof Element<"u"&&"checkVisibility"in Element.prototype;function jl(e){const t=Ee(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:n,visibility:a}=e.style,r=n!=="none"&&a!=="hidden"&&a!=="collapse";if(r){const{getComputedStyle:o}=Ee(e);let{display:i,visibility:l}=o(e);r=i!=="none"&&l!=="hidden"&&l!=="collapse"}return r}function wl(e,t){return!e.hasAttribute("hidden")&&!e.hasAttribute("data-react-aria-prevent-focus")&&(e.nodeName==="DETAILS"&&t&&t.nodeName!=="SUMMARY"?e.hasAttribute("open"):!0)}function Fa(e,t){return kl?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):e.nodeName!=="#comment"&&jl(e)&&wl(e,t)&&(!e.parentElement||Fa(e.parentElement,e))}const Oa=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable^="false"])',"permission"],Nl=Oa.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";Oa.push('[tabindex]:not([tabindex="-1"]):not([disabled])');function Cl(e,t){return e.matches(Nl)&&!Sl(e)&&(t?.skipVisibilityCheck||Fa(e))}function Sl(e){let t=e;for(;t!=null;){if(t instanceof Ee(t).HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}const Os=typeof document<"u"?Rs.useLayoutEffect:()=>{};function Tl(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Il(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Rl(e){for(;e&&!Cl(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=Ee(e),n=t.document.activeElement;if(!n||n===e)return;let a=!1,r=g=>{(te(g)===n||a)&&g.stopImmediatePropagation()},o=g=>{(te(g)===n||a)&&(g.stopImmediatePropagation(),!e&&!a&&(a=!0,bt(n),d()))},i=g=>{(te(g)===e||a)&&g.stopImmediatePropagation()},l=g=>{(te(g)===e||a)&&(g.stopImmediatePropagation(),a||(a=!0,bt(n),d()))};t.addEventListener("blur",r,!0),t.addEventListener("focusout",o,!0),t.addEventListener("focusin",l,!0),t.addEventListener("focus",i,!0);let d=()=>{cancelAnimationFrame(x),t.removeEventListener("blur",r,!0),t.removeEventListener("focusout",o,!0),t.removeEventListener("focusin",l,!0),t.removeEventListener("focus",i,!0),a=!1},x=requestAnimationFrame(d);return d}function Wt(e){if(typeof window>"u"||window.navigator==null)return!1;let t=window.navigator.userAgentData?.brands;return Array.isArray(t)&&t.some(n=>e.test(n.brand))||e.test(window.navigator.userAgent)}function zs(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}function $e(e){let t=null;return()=>(t==null&&(t=e()),t)}const Ut=$e(function(){return zs(/^Mac/i)}),El=$e(function(){return zs(/^iPhone/i)}),za=$e(function(){return zs(/^iPad/i)||Ut()&&navigator.maxTouchPoints>1}),_a=$e(function(){return El()||za()}),Ml=$e(function(){return Wt(/AppleWebKit/i)&&!Al()}),Al=$e(function(){return Wt(/Chrome/i)}),Ua=$e(function(){return Wt(/Android/i)}),$l=$e(function(){return Wt(/Firefox/i)});function Ll(e){return e.pointerType===""&&e.isTrusted?!0:Ua()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Pl(e){return!Ua()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"}function vt(e,t,n=!0){let{metaKey:a,ctrlKey:r,altKey:o,shiftKey:i}=t;$l()&&window.event?.type?.startsWith("key")&&e.target==="_blank"&&(Ut()?a=!0:r=!0);let l=Ml()&&Ut()&&!za()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:a,ctrlKey:r,altKey:o,shiftKey:i}):new MouseEvent("click",{metaKey:a,ctrlKey:r,altKey:o,shiftKey:i,detail:1,bubbles:!0,cancelable:!0});vt.isOpening=n,bt(e),e.dispatchEvent(l),vt.isOpening=!1}vt.isOpening=!1;let Ie=new Map,xs=new Set;function fn(){if(typeof window>"u")return;function e(a){return"propertyName"in a}let t=a=>{let r=te(a);if(!e(a)||!r)return;let o=Ie.get(r);o||(o=new Set,Ie.set(r,o),r.addEventListener("transitioncancel",n,{once:!0})),o.add(a.propertyName)},n=a=>{let r=te(a);if(!e(a)||!r)return;let o=Ie.get(r);if(o&&(o.delete(a.propertyName),o.size===0&&(r.removeEventListener("transitioncancel",n),Ie.delete(r)),Ie.size===0)){for(let i of xs)i();xs.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",n)}typeof document<"u"&&(document.readyState!=="loading"?fn():document.addEventListener("DOMContentLoaded",fn));function Dl(){for(const[e]of Ie)"isConnected"in e&&!e.isConnected&&Ie.delete(e)}function Fl(e){requestAnimationFrame(()=>{Dl(),Ie.size===0?e():xs.add(e)})}function Ba(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}let bs=new Map;typeof FinalizationRegistry<"u"&&new FinalizationRegistry(e=>{bs.delete(e)});function Ol(e,t){if(e===t)return e;let n=bs.get(e);if(n)return n.forEach(r=>r.current=t),t;let a=bs.get(t);return a?(a.forEach(r=>r.current=e),e):t}function zl(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1;const a=e.map(r=>{const o=mn(r,t);return n||=typeof o=="function",o});if(n)return()=>{a.forEach((r,o)=>{typeof r=="function"?r():mn(e[o],null)})}}}function mn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function It(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let a=e[n];for(let r in a){let o=t[r],i=a[r];typeof o=="function"&&typeof i=="function"&&r[0]==="o"&&r[1]==="n"&&r.charCodeAt(2)>=65&&r.charCodeAt(2)<=90?t[r]=Ba(o,i):(r==="className"||r==="UNSAFE_className")&&typeof o=="string"&&typeof i=="string"?t[r]=qr(o,i):r==="id"&&o&&i?t.id=Ol(o,i):r==="ref"&&o&&i?t.ref=zl(o,i):t[r]=i!==void 0?i:o}}return t}function _l(e,t){Os(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}const Ul=Rs.useInsertionEffect??Os;function is(e){const t=c.useRef(null);return Ul(()=>{t.current=e},[e]),c.useCallback((...n)=>{const a=t.current;return a?.(...n)},[])}let We="default",vs="",_t=new WeakMap;function Bl(e){if(_a()){if(We==="default"){const t=Re(e);vs=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect="none"}We="disabled"}else if(e instanceof HTMLElement||e instanceof SVGElement){let t="userSelect"in e.style?"userSelect":"webkitUserSelect";_t.set(e,e.style[t]),e.style[t]="none"}}function pn(e){if(_a()){if(We!=="disabled")return;We="restoring",setTimeout(()=>{Fl(()=>{if(We==="restoring"){const t=Re(e);t.documentElement.style.webkitUserSelect==="none"&&(t.documentElement.style.webkitUserSelect=vs||""),vs="",We="default"}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&_t.has(e)){let t=_t.get(e),n="userSelect"in e.style?"userSelect":"webkitUserSelect";e.style[n]==="none"&&(e.style[n]=t),e.getAttribute("style")===""&&e.removeAttribute("style"),_t.delete(e)}}function hn(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let ls=new WeakMap;function Kl(e){let t=e??(typeof document<"u"?document:void 0);if(!t)return hn(t);if(ls.has(t))return ls.get(t);let n=t.querySelector('meta[property="csp-nonce"]'),a=n&&n instanceof Ee(n).HTMLMetaElement&&(n.nonce||n.content)||hn(t)||void 0;return a!==void 0&&ls.set(t,a),a}const Ka=Rs.createContext({register:()=>{}});Ka.displayName="PressResponderContext";function Ha(){let e=c.useRef(new Map),t=c.useCallback((r,o,i,l)=>{let d=l?.once?(...x)=>{e.current.delete(i),i(...x)}:i;e.current.set(i,{type:o,eventTarget:r,fn:d,options:l}),r.addEventListener(o,d,l)},[]),n=c.useCallback((r,o,i,l)=>{let d=e.current.get(i)?.fn||i;r.removeEventListener(o,d,l),e.current.delete(i)},[]),a=c.useCallback(()=>{e.current.forEach((r,o)=>{n(r.eventTarget,r.type,o,r.options)})},[n]);return c.useEffect(()=>a,[a]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:a}}function Hl(e){let t=c.useContext(Ka);if(t){let{register:n,ref:a,...r}=t;e=It(r,e),n()}return _l(t,e.ref),e}class Ot{#e;constructor(t,n,a,r){this.#e=!0;const i=(r?.target??a.currentTarget)?.getBoundingClientRect();let l,d=0,x,g=null;a.clientX!=null&&a.clientY!=null&&(x=a.clientX,g=a.clientY),i&&(x!=null&&g!=null?(l=x-i.left,d=g-i.top):(l=i.width/2,d=i.height/2)),this.type=t,this.pointerType=n,this.target=a.currentTarget,this.shiftKey=a.shiftKey,this.metaKey=a.metaKey,this.ctrlKey=a.ctrlKey,this.altKey=a.altKey,this.x=l,this.y=d,this.key=a.key}continuePropagation(){this.#e=!1}get shouldStopPropagation(){return this.#e}}const gn=Symbol("linkClicked"),xn="react-aria-pressable-style",bn="data-react-aria-pressable";function ql(e){let{onPress:t,onPressChange:n,onPressStart:a,onPressEnd:r,onPressUp:o,onClick:i,isDisabled:l,isPressed:d,preventFocusOnPress:x,shouldCancelOnPointerExit:g,allowTextSelectionOnPress:v,ref:m,...b}=Hl(e),[f,u]=c.useState(!1),h=c.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:p,removeAllGlobalListeners:w}=Ha(),y=c.useCallback((j,E)=>{let O=h.current;if(l||O.didFirePressStart)return!1;let N=!0;if(O.isTriggeringEvent=!0,a){let A=new Ot("pressstart",E,j);a(A),N=A.shouldStopPropagation}return n&&n(!0),O.isTriggeringEvent=!1,O.didFirePressStart=!0,u(!0),N},[l,a,n]),k=c.useCallback((j,E,O=!0)=>{let N=h.current;if(!N.didFirePressStart)return!1;N.didFirePressStart=!1,N.isTriggeringEvent=!0;let A=!0;if(r){let C=new Ot("pressend",E,j);r(C),A=C.shouldStopPropagation}if(n&&n(!1),u(!1),t&&O&&!l){let C=new Ot("press",E,j);t(C),A&&=C.shouldStopPropagation}return N.isTriggeringEvent=!1,A},[l,r,n,t]),S=is(k),R=c.useCallback((j,E)=>{let O=h.current;if(l)return!1;if(o){O.isTriggeringEvent=!0;let N=new Ot("pressup",E,j);return o(N),O.isTriggeringEvent=!1,N.shouldStopPropagation}return!0},[l,o]),$=is(R),D=c.useCallback(j=>{let E=h.current;if(E.isPressed&&E.target){E.didFirePressStart&&E.pointerType!=null&&k(Fe(E.target,j),E.pointerType,!1),E.isPressed=!1,E.isOverTarget=!1,E.activePointerId=null,E.pointerType=null,w(),v||pn(E.target);for(let O of E.disposables)O();E.disposables=[]}},[v,w,k]),P=is(D);c.useEffect(()=>{l&&h.current.isPressed&&P({currentTarget:h.current.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})},[l]);let L=c.useCallback(j=>{g&&D(j)},[g,D]),I=c.useCallback(j=>{l||i?.(j)},[l,i]),F=c.useCallback((j,E)=>{if(!l&&i){let O=new MouseEvent("click",j);Il(O,E),i(Tl(O))}},[l,i]),_=c.useMemo(()=>{let j=h.current,E={onKeyDown(N){if(cs(N.nativeEvent,N.currentTarget)&&be(N.currentTarget,te(N))){vn(te(N),N.key)&&N.preventDefault();let A=!0;!j.isPressed&&!N.repeat&&(j.target=N.currentTarget,j.isPressed=!0,j.pointerType="keyboard",A=y(N,"keyboard"));let C=N.currentTarget,B=U=>{cs(U,C)&&!U.repeat&&be(C,te(U))&&j.target&&$(Fe(j.target,U),"keyboard")};p(Re(N.currentTarget),"keyup",Ba(B,O),!0),A&&N.stopPropagation(),N.metaKey&&Ut()&&j.metaKeyEvents?.set(N.key,N.nativeEvent)}else N.key==="Meta"&&(j.metaKeyEvents=new Map)},onClick(N){if(!(N&&!be(N.currentTarget,te(N)))&&N&&N.button===0&&!j.isTriggeringEvent&&!vt.isOpening){let A=!0;if(l&&N.preventDefault(),!j.ignoreEmulatedMouseEvents&&!j.isPressed&&(j.pointerType==="virtual"||Ll(N.nativeEvent))){let C=y(N,"virtual"),B=$(N,"virtual"),U=S(N,"virtual");I(N),A=C&&B&&U}else if(j.isPressed&&j.pointerType!=="keyboard"){let C=j.pointerType||N.nativeEvent.pointerType||"virtual",B=$(Fe(N.currentTarget,N),C),U=S(Fe(N.currentTarget,N),C,!0);A=B&&U,j.isOverTarget=!1,I(N),P(N)}j.ignoreEmulatedMouseEvents=!1,A&&N.stopPropagation()}}},O=N=>{if(j.isPressed&&j.target&&cs(N,j.target)){vn(te(N),N.key)&&N.preventDefault();let A=te(N),C=be(j.target,A);S(Fe(j.target,N),"keyboard",C),C&&F(N,j.target),w(),N.key!=="Enter"&&_s(j.target)&&be(j.target,A)&&!N[gn]&&(N[gn]=!0,vt(j.target,N,!1)),j.isPressed=!1,j.metaKeyEvents?.delete(N.key)}else if(N.key==="Meta"&&j.metaKeyEvents?.size){let A=j.metaKeyEvents;j.metaKeyEvents=void 0;for(let C of A.values())j.target?.dispatchEvent(new KeyboardEvent("keyup",C))}};if(typeof PointerEvent<"u"){E.onPointerDown=C=>{if(C.button!==0||!be(C.currentTarget,te(C)))return;if(Pl(C.nativeEvent)){j.pointerType="virtual";return}j.pointerType=C.pointerType;let B=!0;if(!j.isPressed){j.isPressed=!0,j.isOverTarget=!0,j.activePointerId=C.pointerId,j.target=C.currentTarget,v||Bl(j.target),B=y(C,j.pointerType);let U=te(C);"releasePointerCapture"in U&&("hasPointerCapture"in U?U.hasPointerCapture(C.pointerId)&&U.releasePointerCapture(C.pointerId):U.releasePointerCapture(C.pointerId)),p(Re(C.currentTarget),"pointerup",N,!1),p(Re(C.currentTarget),"pointercancel",A,!1)}B&&C.stopPropagation()},E.onMouseDown=C=>{if(be(C.currentTarget,te(C))&&C.button===0){if(x){let B=Rl(C.target);B&&j.disposables.push(B)}C.stopPropagation()}},E.onPointerUp=C=>{!be(C.currentTarget,te(C))||j.pointerType==="virtual"||C.button===0&&!j.isPressed&&$(C,j.pointerType||C.pointerType)},E.onPointerEnter=C=>{C.pointerId===j.activePointerId&&j.target&&!j.isOverTarget&&j.pointerType!=null&&(j.isOverTarget=!0,y(Fe(j.target,C),j.pointerType))},E.onPointerLeave=C=>{C.pointerId===j.activePointerId&&j.target&&j.isOverTarget&&j.pointerType!=null&&(j.isOverTarget=!1,S(Fe(j.target,C),j.pointerType,!1),L(C))};let N=C=>{if(C.pointerId===j.activePointerId&&j.isPressed&&C.button===0&&j.target){if(be(j.target,te(C))&&j.pointerType!=null){let B=!1,U=setTimeout(()=>{j.isPressed&&j.target instanceof HTMLElement&&(B?P(C):(bt(j.target),j.target.click()))},80);p(C.currentTarget,"click",()=>B=!0,!0),j.disposables.push(()=>clearTimeout(U))}else P(C);j.isOverTarget=!1}},A=C=>{P(C)};E.onDragStart=C=>{be(C.currentTarget,te(C))&&P(C)}}return E},[p,l,x,w,v,L,y,I,F]);return c.useEffect(()=>{if(!m)return;const j=Re(m.current);if(!j||!j.head||j.getElementById(xn))return;const E=j.createElement("style");E.id=xn;let O=Kl(j);O&&(E.nonce=O),E.textContent=`
|
|
2
2
|
@layer {
|
|
3
3
|
[${bn}] {
|
|
4
4
|
touch-action: pan-x pan-y pinch-zoom;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as D,r as h,j as e,U as ae,V as ne,W as J,t as N,Y as T,Z as V,_ as re,$ as G,a0 as ie,a1 as le,X as oe,a2 as ce,a3 as ue,a4 as de,a5 as xe,a6 as fe,I as me,a7 as he,a8 as ge,a9 as I,aa as pe,h as be,C as ve,ab as je,H as ye,c as Ne,ac as Se,ad as ke,ae as M,af as Ce,ag as w,ah as we,D as Oe,v as ze}from"./index-BSMLcnNv.js";import{u as Re}from"./roving-focus-JRZm8Nsl.js";import{B as Ae,a as Ie}from"./useLayoutTier-C5sdkyR7.js";import{u as Ee}from"./useQueries-hzIIiVUF.js";import{i as Le}from"./outbox-status-BlKn6P0x.js";import{B as Fe}from"./bug-C0Ms2LYI.js";const Pe=D("BookmarkPlus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"12",x2:"12",y1:"7",y2:"13",key:"1cppfj"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);const Me=D("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);const De=D("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),_e="button:not([disabled]), a[href]",O="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-sunken";function Be({active:s,dimmed:t,indent:a}){return N("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors",O,a&&"pl-7",s?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg",t&&"opacity-55")}function Te({icon:s,label:t,count:a,active:n}){return e.jsxs(e.Fragment,{children:[s&&e.jsx("span",{className:N("shrink-0",n?"text-accent-2":"text-fg-subtle"),children:s}),e.jsx("span",{className:"flex-1 truncate",children:t}),a!=null&&a>0&&e.jsx("span",{className:N("text-2xs tabular-nums",n?"text-accent-2":"text-fg-subtle"),children:a})]})}function A({icon:s,label:t,count:a,active:n,dimmed:o,indent:l,navId:u,linkComponent:g,ariaLabel:x,title:v,onClick:j}){const p=Be({active:n,dimmed:o,indent:l}),d=e.jsx(Te,{icon:s,label:t,count:a,active:n});return u&&g?g({navId:u,className:p,ariaLabel:x??t,title:v,onClick:j,children:d}):e.jsx("button",{type:"button",onClick:j,className:p,"aria-label":x,title:v,children:d})}const q={inbox:0,flagged:1,drafts:2,sent:3,archive:4,all:5,junk:6,trash:7};function Ve(s){switch(s){case"inbox":return e.jsx(me,{className:"size-4"});case"flagged":return e.jsx(J,{className:"size-4"});case"drafts":return e.jsx(fe,{className:"size-4"});case"sent":return e.jsx(G,{className:"size-4"});case"archive":return e.jsx(xe,{className:"size-4"});case"all":return e.jsx(de,{className:"size-4"});case"junk":return e.jsx(ue,{className:"size-4"});case"trash":return e.jsx(ce,{className:"size-4"})}}const H=s=>s.role!=null,P=8,K="remit.nav.folders.open.",Q="remit.nav.account.open.";function $(s,t,a){if(typeof localStorage>"u")return a;const n=localStorage.getItem(s+t);return n===null?a:n!=="0"}function U(s,t,a){typeof localStorage>"u"||localStorage.setItem(s+t,a?"1":"0")}function qe({query:s,onSelect:t,onRemove:a}){return e.jsxs("div",{className:"group flex w-full items-center gap-1 rounded-md pr-1 hover:bg-surface",children:[e.jsxs("button",{type:"button",onClick:t,className:N("flex min-w-0 flex-1 items-center gap-2 px-2 py-1 text-left text-sm text-fg-muted transition-colors hover:text-fg",O),children:[e.jsx(le,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:s})]}),a&&e.jsx("button",{type:"button",onClick:a,"aria-label":`Remove saved search: ${s}`,className:N("shrink-0 rounded-full p-1 text-fg-subtle opacity-0 transition-opacity hover:bg-surface-sunken hover:text-fg group-hover:opacity-100 focus-visible:opacity-100",O),children:e.jsx(oe,{className:"size-3.5"})})]})}function He({savedSearches:s,saveableQuery:t,onSelectSavedSearch:a,onRemoveSavedSearch:n,onSaveCurrentSearch:o}){return s.length===0&&!t?null:e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"px-2 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Saved searches"}),t&&e.jsxs("button",{type:"button",onClick:o,className:N("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-accent transition-colors hover:bg-surface",O),children:[e.jsx(Pe,{className:"size-4 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["Save “",t,"”"]})]}),s.map(l=>e.jsx(qe,{query:l,onSelect:()=>a?.(l),onRemove:n?()=>n(l):void 0},l))]})}function Ke({account:s,selectedNavId:t,onSelectNav:a,linkComponent:n}){const[o,l]=h.useState(()=>$(Q,s.id,!0)),[u,g]=h.useState(()=>$(K,s.id,!0)),[x,v]=h.useState(!1),j=()=>{l(r=>{const f=!r;return U(Q,s.id,f),f})},p=()=>{g(r=>{const f=!r;return U(K,s.id,f),f})},d=s.mailboxes.filter(H).sort((r,f)=>q[r.role]-q[f.role]),c=s.mailboxes.filter(r=>!H(r)),S=x||c.length<=P?c:c.slice(0,P),z=c.length-S.length,R=s.status??"ready",F=R==="ready"&&d.length===0&&c.length===0;return e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",onClick:j,"aria-expanded":o,className:N("flex w-full items-center gap-1.5 px-2 pb-1 text-left transition-colors hover:text-fg",O,s.muted&&"opacity-55"),children:[o?e.jsx(T,{className:"size-3 shrink-0 text-fg-subtle"}):e.jsx(V,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:s.label}),s.muted&&e.jsxs(e.Fragment,{children:[e.jsx(Ae,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:"muted"})]})]}),o&&e.jsxs(e.Fragment,{children:[R==="loading"&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"Loading…"}),R==="error"&&e.jsxs("div",{role:"alert",className:"mx-2 my-1 flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-2 py-1.5 text-sm",children:[e.jsx(re,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("p",{className:"font-medium text-danger",children:"Couldn't load mailboxes"})}),s.onRetry&&e.jsx("button",{type:"button",onClick:s.onRetry,className:"shrink-0 text-sm font-medium text-accent hover:underline",children:"Retry"})]}),F&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"No mailboxes"}),R==="ready"&&e.jsxs(e.Fragment,{children:[d.map(r=>e.jsx(A,{navId:r.id,linkComponent:n,icon:Ve(r.role),label:r.name,ariaLabel:r.name,title:r.fullPath??r.name,count:r.unseen,active:t===r.id,dimmed:s.muted,onClick:()=>a?.(r.id)},r.id)),s.outboxPending!==void 0&&e.jsx(A,{navId:"outbox",linkComponent:n,icon:e.jsx(G,{className:"size-4"}),label:"Outbox",ariaLabel:"Outbox",count:s.outboxPending>0?s.outboxPending:void 0,active:t==="outbox",dimmed:s.muted,onClick:()=>a?.("outbox")}),c.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:p,"aria-expanded":u,className:N("mt-1 flex w-full items-center gap-1 px-2 py-1 text-left text-2xs font-semibold uppercase tracking-wider text-fg-subtle transition-colors hover:text-fg",O),children:[u?e.jsx(T,{className:"size-3 shrink-0"}):e.jsx(V,{className:"size-3 shrink-0"}),e.jsx("span",{className:"flex-1",children:"Folders"}),e.jsx("span",{className:"tabular-nums opacity-70",children:c.length})]}),u&&e.jsxs(e.Fragment,{children:[S.map(r=>e.jsx(A,{navId:r.id,linkComponent:n,icon:e.jsx(ie,{className:"size-4"}),label:r.name,ariaLabel:r.name,title:r.fullPath??r.name,count:r.unseen,active:t===r.id,dimmed:s.muted,onClick:()=>a?.(r.id)},r.id)),(z>0||x)&&c.length>P&&e.jsx("button",{type:"button",onClick:()=>v(r=>!r),className:N("ml-7 flex items-center px-2 py-1 text-2xs font-medium text-accent transition-colors hover:underline",O),children:x?"Show less":`Show all (${c.length})`})]})]})]})]})]})}function Qe({accounts:s,selectedNavId:t,briefUnseen:a,onSelectNav:n,variant:o="desktop",linkComponent:l,calendarNav:u="hidden",savedSearches:g=[],saveableQuery:x,onSelectSavedSearch:v,onRemoveSavedSearch:j,onSaveCurrentSearch:p}){const d=h.useRef(null);Re({containerRef:d,itemSelector:_e});const c=o==="drawer",S=e.jsxs("nav",{ref:c?d:void 0,className:c?"px-2 py-2":"flex-1 overflow-y-auto px-2 py-2","aria-label":"Mailboxes",children:[e.jsx(A,{navId:"brief",linkComponent:l,icon:e.jsx(ae,{className:"size-4"}),label:"Daily brief",ariaLabel:"Daily brief",count:a,active:t==="brief",onClick:()=>n?.("brief")}),u==="shown"&&e.jsx(A,{navId:"calendar",linkComponent:l,icon:e.jsx(ne,{className:"size-4"}),label:"Calendar",ariaLabel:"Calendar",active:t==="calendar",onClick:()=>n?.("calendar")}),e.jsx(A,{navId:"flagged",linkComponent:l,icon:e.jsx(J,{className:"size-4"}),label:"Starred",ariaLabel:"Starred",active:t==="flagged",onClick:()=>n?.("flagged")}),e.jsx(He,{savedSearches:g,saveableQuery:x,onSelectSavedSearch:v,onRemoveSavedSearch:j,onSaveCurrentSearch:p}),s.length===0?e.jsx("div",{className:"px-2 py-4 text-center text-sm text-fg-muted",children:"No accounts configured"}):s.map(z=>e.jsx(Ke,{account:z,selectedNavId:t,onSelectNav:n,linkComponent:l},z.id))]});return c?S:e.jsx("aside",{ref:d,className:"flex h-full w-full flex-col bg-surface-sunken",children:S})}function $e(){const{pathname:s}=he(),t=ge({from:"/mail/$mailboxId",shouldThrow:!1});return I(s,"/settings")?"settings":I(s,"/calendar")?"calendar":I(s,"/mail/outbox")?"outbox":I(s,"/mail/flagged")?"flagged":I(s,"/mail/brief")?"brief":t?.mailboxId??""}const Ue=({children:s})=>{const{Account:t}=pe();return e.jsx(t,{children:s})},_="remit.savedSearches",We=25;function L(){try{const s=localStorage.getItem(_);if(!s)return[];const t=JSON.parse(s);return Array.isArray(t)?t.filter(a=>typeof a=="string"):[]}catch{return[]}}function Ye(s){const t=s.trim();if(!t)return L();const a=[t,...L().filter(n=>n!==t)].slice(0,We);try{localStorage.setItem(_,JSON.stringify(a))}catch{return a}return a}function Je(s){const t=L().filter(a=>a!==s);try{localStorage.setItem(_,JSON.stringify(t))}catch{return t}return t}const W=s=>/^\d/.test(s),Ge=(s,t)=>{const a=W(s),n=W(t);return a&&!n?-1:!a&&n?1:s.localeCompare(t,void 0,{sensitivity:"base",numeric:!0})};function Xe(s,t,a){const n=[],o=[];for(const l of s)t.has(l.mailboxId)?n.push(l):o.push(l);return o.sort((l,u)=>Ge(M(l,void 0,a),M(u,void 0,a))),{system:n,labels:o}}function Ze(s,t,a){const n=Ce(t)&&s.unseenCount>0;return{id:s.mailboxId,name:M(s,t,a),unseen:n?s.unseenCount:void 0,role:t,fullPath:s.fullPath}}function Y({accounts:s,onMailboxSelect:t,variant:a="desktop"}){const n=be(),o=Ie(),l=$e(),{searchInput:u,onSearchChange:g}=ve(),[x,v]=h.useState(L),{t:j}=je("mail",{useSuspense:!1}),p=h.useCallback((i,b)=>j(i,{defaultValue:b}),[j]),d=Ee({queries:s.map(i=>({...ye({path:{accountId:i.accountId}}),staleTime:1/0}))}),{data:c}=Ne(Se()),S=h.useMemo(()=>(c?.items??[]).filter(i=>Le(i.status)).length,[c?.items]),z=h.useMemo(()=>s.map((i,b)=>{const m=d[b],k=m?.data?.items??[],y=ke(i.folderAppointments),{system:C,labels:se}=Xe(k,y,p),te=m?.isError?"error":m?.isLoading?"loading":"ready";return{id:i.accountId,label:i.email,email:i.email,muted:!!i.muted,outboxPending:S,status:te,onRetry:()=>m?.refetch(),mailboxes:[...C,...se].map(B=>Ze(B,y.get(B.mailboxId),p))}}),[s,d,S,p]),R=i=>{n.invalidateQueries({queryKey:we({path:{mailboxId:i},query:{order:"desc"}})})},F=({navId:i,className:b,ariaLabel:m,title:k,children:y,onClick:C})=>i==="brief"?e.jsx(w,{to:"/mail/brief",search:{q:void 0},activeOptions:{includeSearch:!1},onClick:()=>C?.(),className:b,"aria-label":m,title:k,children:y}):i==="calendar"?e.jsx(w,{to:"/calendar",onClick:()=>C?.(),className:b,"aria-label":m,title:k,children:y}):i==="outbox"?e.jsx(w,{to:"/mail/outbox",search:{q:void 0},onClick:()=>C?.(),className:b,"aria-label":m,title:k,children:y}):i==="flagged"?e.jsx(w,{to:"/mail/flagged",search:{q:void 0},onClick:()=>C?.(),className:b,"aria-label":m,title:k,children:y}):i==="settings"?e.jsx(w,{to:"/settings/accounts",onClick:()=>C?.(),className:b,"aria-label":m,title:k,children:y}):e.jsx(w,{to:"/mail/$mailboxId",params:{mailboxId:i},search:{q:void 0},onClick:()=>{R(i),C?.()},className:b,"aria-label":m,title:k,children:y}),r=()=>{g(""),t?.()},f=u.trim(),E=f.length>0&&!x.includes(f)?f:void 0,X=h.useCallback(()=>{E&&v(Ye(E))},[E]),Z=h.useCallback(i=>{v(Je(i))},[]),ee=h.useCallback(i=>{g(i),o(i),t?.()},[g,o,t]);return e.jsx(Qe,{accounts:z,selectedNavId:l,onSelectNav:r,linkComponent:F,calendarNav:"shown",variant:a,savedSearches:x,saveableQuery:E,onSaveCurrentSearch:X,onSelectSavedSearch:ee,onRemoveSavedSearch:Z})}function es(){return e.jsxs("button",{type:"button",onClick:Oe,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg",children:[e.jsx(Fe,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Report a bug"})]})}function ls({accounts:s,onMailboxSelect:t}){return ze()?.showNavPane??!0?e.jsx(Y,{accounts:s}):e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(Y,{accounts:s,onMailboxSelect:t,variant:"drawer"})}),e.jsxs("div",{className:"border-t border-line px-2 py-2",children:[e.jsxs(w,{to:"/settings/accounts",onClick:t,children:[e.jsx(De,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Settings"})]}),e.jsx(es,{}),e.jsx(Ue,{children:({signOut:o})=>e.jsxs("button",{type:"button",onClick:()=>{t?.(),o()},className:"flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg","data-testid":"sign-out-button",children:[e.jsx(Me,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Sign out"})]})})]})]})}export{Ue as A,Me as L,ls as M,De as S};
|
|
1
|
+
import{e as D,r as h,j as e,U as ae,V as ne,W as J,t as N,Y as T,Z as V,_ as re,$ as G,a0 as ie,a1 as le,X as oe,a2 as ce,a3 as ue,a4 as de,a5 as xe,a6 as fe,I as me,a7 as he,a8 as ge,a9 as I,aa as pe,h as be,C as ve,ab as je,H as ye,c as Ne,ac as Se,ad as ke,ae as M,af as Ce,ag as w,ah as we,D as Oe,v as ze}from"./index-DaE4Ytea.js";import{u as Re}from"./roving-focus-CZcayiPM.js";import{B as Ae,a as Ie}from"./useLayoutTier-Q5StPSkt.js";import{u as Ee}from"./useQueries-BviBmJi1.js";import{i as Le}from"./outbox-status-BlKn6P0x.js";import{B as Fe}from"./bug-RVEeyd-5.js";const Pe=D("BookmarkPlus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"12",x2:"12",y1:"7",y2:"13",key:"1cppfj"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);const Me=D("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);const De=D("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),_e="button:not([disabled]), a[href]",O="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-sunken";function Be({active:s,dimmed:t,indent:a}){return N("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors",O,a&&"pl-7",s?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg",t&&"opacity-55")}function Te({icon:s,label:t,count:a,active:n}){return e.jsxs(e.Fragment,{children:[s&&e.jsx("span",{className:N("shrink-0",n?"text-accent-2":"text-fg-subtle"),children:s}),e.jsx("span",{className:"flex-1 truncate",children:t}),a!=null&&a>0&&e.jsx("span",{className:N("text-2xs tabular-nums",n?"text-accent-2":"text-fg-subtle"),children:a})]})}function A({icon:s,label:t,count:a,active:n,dimmed:o,indent:l,navId:u,linkComponent:g,ariaLabel:x,title:v,onClick:j}){const p=Be({active:n,dimmed:o,indent:l}),d=e.jsx(Te,{icon:s,label:t,count:a,active:n});return u&&g?g({navId:u,className:p,ariaLabel:x??t,title:v,onClick:j,children:d}):e.jsx("button",{type:"button",onClick:j,className:p,"aria-label":x,title:v,children:d})}const q={inbox:0,flagged:1,drafts:2,sent:3,archive:4,all:5,junk:6,trash:7};function Ve(s){switch(s){case"inbox":return e.jsx(me,{className:"size-4"});case"flagged":return e.jsx(J,{className:"size-4"});case"drafts":return e.jsx(fe,{className:"size-4"});case"sent":return e.jsx(G,{className:"size-4"});case"archive":return e.jsx(xe,{className:"size-4"});case"all":return e.jsx(de,{className:"size-4"});case"junk":return e.jsx(ue,{className:"size-4"});case"trash":return e.jsx(ce,{className:"size-4"})}}const H=s=>s.role!=null,P=8,K="remit.nav.folders.open.",Q="remit.nav.account.open.";function $(s,t,a){if(typeof localStorage>"u")return a;const n=localStorage.getItem(s+t);return n===null?a:n!=="0"}function U(s,t,a){typeof localStorage>"u"||localStorage.setItem(s+t,a?"1":"0")}function qe({query:s,onSelect:t,onRemove:a}){return e.jsxs("div",{className:"group flex w-full items-center gap-1 rounded-md pr-1 hover:bg-surface",children:[e.jsxs("button",{type:"button",onClick:t,className:N("flex min-w-0 flex-1 items-center gap-2 px-2 py-1 text-left text-sm text-fg-muted transition-colors hover:text-fg",O),children:[e.jsx(le,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:s})]}),a&&e.jsx("button",{type:"button",onClick:a,"aria-label":`Remove saved search: ${s}`,className:N("shrink-0 rounded-full p-1 text-fg-subtle opacity-0 transition-opacity hover:bg-surface-sunken hover:text-fg group-hover:opacity-100 focus-visible:opacity-100",O),children:e.jsx(oe,{className:"size-3.5"})})]})}function He({savedSearches:s,saveableQuery:t,onSelectSavedSearch:a,onRemoveSavedSearch:n,onSaveCurrentSearch:o}){return s.length===0&&!t?null:e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"px-2 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Saved searches"}),t&&e.jsxs("button",{type:"button",onClick:o,className:N("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-accent transition-colors hover:bg-surface",O),children:[e.jsx(Pe,{className:"size-4 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["Save “",t,"”"]})]}),s.map(l=>e.jsx(qe,{query:l,onSelect:()=>a?.(l),onRemove:n?()=>n(l):void 0},l))]})}function Ke({account:s,selectedNavId:t,onSelectNav:a,linkComponent:n}){const[o,l]=h.useState(()=>$(Q,s.id,!0)),[u,g]=h.useState(()=>$(K,s.id,!0)),[x,v]=h.useState(!1),j=()=>{l(r=>{const f=!r;return U(Q,s.id,f),f})},p=()=>{g(r=>{const f=!r;return U(K,s.id,f),f})},d=s.mailboxes.filter(H).sort((r,f)=>q[r.role]-q[f.role]),c=s.mailboxes.filter(r=>!H(r)),S=x||c.length<=P?c:c.slice(0,P),z=c.length-S.length,R=s.status??"ready",F=R==="ready"&&d.length===0&&c.length===0;return e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",onClick:j,"aria-expanded":o,className:N("flex w-full items-center gap-1.5 px-2 pb-1 text-left transition-colors hover:text-fg",O,s.muted&&"opacity-55"),children:[o?e.jsx(T,{className:"size-3 shrink-0 text-fg-subtle"}):e.jsx(V,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:s.label}),s.muted&&e.jsxs(e.Fragment,{children:[e.jsx(Ae,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:"muted"})]})]}),o&&e.jsxs(e.Fragment,{children:[R==="loading"&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"Loading…"}),R==="error"&&e.jsxs("div",{role:"alert",className:"mx-2 my-1 flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-2 py-1.5 text-sm",children:[e.jsx(re,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("p",{className:"font-medium text-danger",children:"Couldn't load mailboxes"})}),s.onRetry&&e.jsx("button",{type:"button",onClick:s.onRetry,className:"shrink-0 text-sm font-medium text-accent hover:underline",children:"Retry"})]}),F&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"No mailboxes"}),R==="ready"&&e.jsxs(e.Fragment,{children:[d.map(r=>e.jsx(A,{navId:r.id,linkComponent:n,icon:Ve(r.role),label:r.name,ariaLabel:r.name,title:r.fullPath??r.name,count:r.unseen,active:t===r.id,dimmed:s.muted,onClick:()=>a?.(r.id)},r.id)),s.outboxPending!==void 0&&e.jsx(A,{navId:"outbox",linkComponent:n,icon:e.jsx(G,{className:"size-4"}),label:"Outbox",ariaLabel:"Outbox",count:s.outboxPending>0?s.outboxPending:void 0,active:t==="outbox",dimmed:s.muted,onClick:()=>a?.("outbox")}),c.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:p,"aria-expanded":u,className:N("mt-1 flex w-full items-center gap-1 px-2 py-1 text-left text-2xs font-semibold uppercase tracking-wider text-fg-subtle transition-colors hover:text-fg",O),children:[u?e.jsx(T,{className:"size-3 shrink-0"}):e.jsx(V,{className:"size-3 shrink-0"}),e.jsx("span",{className:"flex-1",children:"Folders"}),e.jsx("span",{className:"tabular-nums opacity-70",children:c.length})]}),u&&e.jsxs(e.Fragment,{children:[S.map(r=>e.jsx(A,{navId:r.id,linkComponent:n,icon:e.jsx(ie,{className:"size-4"}),label:r.name,ariaLabel:r.name,title:r.fullPath??r.name,count:r.unseen,active:t===r.id,dimmed:s.muted,onClick:()=>a?.(r.id)},r.id)),(z>0||x)&&c.length>P&&e.jsx("button",{type:"button",onClick:()=>v(r=>!r),className:N("ml-7 flex items-center px-2 py-1 text-2xs font-medium text-accent transition-colors hover:underline",O),children:x?"Show less":`Show all (${c.length})`})]})]})]})]})]})}function Qe({accounts:s,selectedNavId:t,briefUnseen:a,onSelectNav:n,variant:o="desktop",linkComponent:l,calendarNav:u="hidden",savedSearches:g=[],saveableQuery:x,onSelectSavedSearch:v,onRemoveSavedSearch:j,onSaveCurrentSearch:p}){const d=h.useRef(null);Re({containerRef:d,itemSelector:_e});const c=o==="drawer",S=e.jsxs("nav",{ref:c?d:void 0,className:c?"px-2 py-2":"flex-1 overflow-y-auto px-2 py-2","aria-label":"Mailboxes",children:[e.jsx(A,{navId:"brief",linkComponent:l,icon:e.jsx(ae,{className:"size-4"}),label:"Daily brief",ariaLabel:"Daily brief",count:a,active:t==="brief",onClick:()=>n?.("brief")}),u==="shown"&&e.jsx(A,{navId:"calendar",linkComponent:l,icon:e.jsx(ne,{className:"size-4"}),label:"Calendar",ariaLabel:"Calendar",active:t==="calendar",onClick:()=>n?.("calendar")}),e.jsx(A,{navId:"flagged",linkComponent:l,icon:e.jsx(J,{className:"size-4"}),label:"Starred",ariaLabel:"Starred",active:t==="flagged",onClick:()=>n?.("flagged")}),e.jsx(He,{savedSearches:g,saveableQuery:x,onSelectSavedSearch:v,onRemoveSavedSearch:j,onSaveCurrentSearch:p}),s.length===0?e.jsx("div",{className:"px-2 py-4 text-center text-sm text-fg-muted",children:"No accounts configured"}):s.map(z=>e.jsx(Ke,{account:z,selectedNavId:t,onSelectNav:n,linkComponent:l},z.id))]});return c?S:e.jsx("aside",{ref:d,className:"flex h-full w-full flex-col bg-surface-sunken",children:S})}function $e(){const{pathname:s}=he(),t=ge({from:"/mail/$mailboxId",shouldThrow:!1});return I(s,"/settings")?"settings":I(s,"/calendar")?"calendar":I(s,"/mail/outbox")?"outbox":I(s,"/mail/flagged")?"flagged":I(s,"/mail/brief")?"brief":t?.mailboxId??""}const Ue=({children:s})=>{const{Account:t}=pe();return e.jsx(t,{children:s})},_="remit.savedSearches",We=25;function L(){try{const s=localStorage.getItem(_);if(!s)return[];const t=JSON.parse(s);return Array.isArray(t)?t.filter(a=>typeof a=="string"):[]}catch{return[]}}function Ye(s){const t=s.trim();if(!t)return L();const a=[t,...L().filter(n=>n!==t)].slice(0,We);try{localStorage.setItem(_,JSON.stringify(a))}catch{return a}return a}function Je(s){const t=L().filter(a=>a!==s);try{localStorage.setItem(_,JSON.stringify(t))}catch{return t}return t}const W=s=>/^\d/.test(s),Ge=(s,t)=>{const a=W(s),n=W(t);return a&&!n?-1:!a&&n?1:s.localeCompare(t,void 0,{sensitivity:"base",numeric:!0})};function Xe(s,t,a){const n=[],o=[];for(const l of s)t.has(l.mailboxId)?n.push(l):o.push(l);return o.sort((l,u)=>Ge(M(l,void 0,a),M(u,void 0,a))),{system:n,labels:o}}function Ze(s,t,a){const n=Ce(t)&&s.unseenCount>0;return{id:s.mailboxId,name:M(s,t,a),unseen:n?s.unseenCount:void 0,role:t,fullPath:s.fullPath}}function Y({accounts:s,onMailboxSelect:t,variant:a="desktop"}){const n=be(),o=Ie(),l=$e(),{searchInput:u,onSearchChange:g}=ve(),[x,v]=h.useState(L),{t:j}=je("mail",{useSuspense:!1}),p=h.useCallback((i,b)=>j(i,{defaultValue:b}),[j]),d=Ee({queries:s.map(i=>({...ye({path:{accountId:i.accountId}}),staleTime:1/0}))}),{data:c}=Ne(Se()),S=h.useMemo(()=>(c?.items??[]).filter(i=>Le(i.status)).length,[c?.items]),z=h.useMemo(()=>s.map((i,b)=>{const m=d[b],k=m?.data?.items??[],y=ke(i.folderAppointments),{system:C,labels:se}=Xe(k,y,p),te=m?.isError?"error":m?.isLoading?"loading":"ready";return{id:i.accountId,label:i.email,email:i.email,muted:!!i.muted,outboxPending:S,status:te,onRetry:()=>m?.refetch(),mailboxes:[...C,...se].map(B=>Ze(B,y.get(B.mailboxId),p))}}),[s,d,S,p]),R=i=>{n.invalidateQueries({queryKey:we({path:{mailboxId:i},query:{order:"desc"}})})},F=({navId:i,className:b,ariaLabel:m,title:k,children:y,onClick:C})=>i==="brief"?e.jsx(w,{to:"/mail/brief",search:{q:void 0},activeOptions:{includeSearch:!1},onClick:()=>C?.(),className:b,"aria-label":m,title:k,children:y}):i==="calendar"?e.jsx(w,{to:"/calendar",onClick:()=>C?.(),className:b,"aria-label":m,title:k,children:y}):i==="outbox"?e.jsx(w,{to:"/mail/outbox",search:{q:void 0},onClick:()=>C?.(),className:b,"aria-label":m,title:k,children:y}):i==="flagged"?e.jsx(w,{to:"/mail/flagged",search:{q:void 0},onClick:()=>C?.(),className:b,"aria-label":m,title:k,children:y}):i==="settings"?e.jsx(w,{to:"/settings/accounts",onClick:()=>C?.(),className:b,"aria-label":m,title:k,children:y}):e.jsx(w,{to:"/mail/$mailboxId",params:{mailboxId:i},search:{q:void 0},onClick:()=>{R(i),C?.()},className:b,"aria-label":m,title:k,children:y}),r=()=>{g(""),t?.()},f=u.trim(),E=f.length>0&&!x.includes(f)?f:void 0,X=h.useCallback(()=>{E&&v(Ye(E))},[E]),Z=h.useCallback(i=>{v(Je(i))},[]),ee=h.useCallback(i=>{g(i),o(i),t?.()},[g,o,t]);return e.jsx(Qe,{accounts:z,selectedNavId:l,onSelectNav:r,linkComponent:F,calendarNav:"shown",variant:a,savedSearches:x,saveableQuery:E,onSaveCurrentSearch:X,onSelectSavedSearch:ee,onRemoveSavedSearch:Z})}function es(){return e.jsxs("button",{type:"button",onClick:Oe,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg",children:[e.jsx(Fe,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Report a bug"})]})}function ls({accounts:s,onMailboxSelect:t}){return ze()?.showNavPane??!0?e.jsx(Y,{accounts:s}):e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(Y,{accounts:s,onMailboxSelect:t,variant:"drawer"})}),e.jsxs("div",{className:"border-t border-line px-2 py-2",children:[e.jsxs(w,{to:"/settings/accounts",onClick:t,children:[e.jsx(De,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Settings"})]}),e.jsx(es,{}),e.jsx(Ue,{children:({signOut:o})=>e.jsxs("button",{type:"button",onClick:()=>{t?.(),o()},className:"flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg","data-testid":"sign-out-button",children:[e.jsx(Me,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Sign out"})]})})]})]})}export{Ue as A,Me as L,ls as M,De as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a9 as v,j as s,r as u,ak as l,al as p}from"./index-
|
|
1
|
+
import{a9 as v,j as s,r as u,ak as l,al as p}from"./index-DaE4Ytea.js";import{F as x}from"./FullCompose-h9vQVOim.js";import{a as m}from"./useMessageBodyContent-CaHQbZhe.js";function S(o,n,r){if(o!==n)return r}function d(o,n){return o===""?"":n}function j({searchInput:o,committedQuery:n,urlQuery:r,pathname:t,listPath:a}){return!v(t,a)||n!==o?!1:n!==r}const c=u.createContext(null),C=({chrome:o,children:n})=>s.jsx(c.Provider,{value:o,children:n});function M({phone:o,list:n,reading:r,intelligence:t,hasThread:a=!1}){const e=u.useContext(c),f=m();if(!e)return s.jsx(l,{});const i={nav:e.nav,overlay:e.overlay,skeleton:s.jsx(l,{}),isLoading:e.isLoading,navOpen:e.navOpen,onOpenNav:e.onOpenNav,onCloseNav:e.onCloseNav};return e.isSinglePane?s.jsx(p,{...i,list:f?s.jsx(x,{}):o,intelligenceOpen:e.intelligenceOpen}):s.jsx(p,{...i,topBar:e.topBar,list:n,reading:r,intelligence:t,intelligenceOpen:e.intelligenceOpen,hasThread:a})}export{C as M,M as a,j as b,d as c,S as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s,L as le,f as _,_ as ue,r as g,t as K,aA as de,a2 as fe,d1 as me,b_ as xe,dW as ge,dX as he,dY as pe,C as be,dZ as ve,d2 as je}from"./index-BSMLcnNv.js";import{m as we,A as Ne}from"./search-token-index-srRTXc29.js";import{u as ye,L as Q}from"./roving-focus-JRZm8Nsl.js";import{ad as Pe,ae as Re,c as Ce,a as G,af as Se,v as Ee,ag as Me,ah as ke,ai as Ae,aj as Ie,ak as Le,al as ee,am as Te}from"./MailListHeader-CP5Mrq7I.js";import{A as ze}from"./avatar-BuUa_-Ae.js";import{M as Oe}from"./mail-zfMejK7g.js";import{R as De}from"./refresh-cw-Bdx0EEOe.js";import{M as _e}from"./menu-D4SB6ohG.js";function $e(){return s.jsx("div",{className:"space-y-0",role:"status","aria-busy":"true","aria-label":"Loading messages",children:Array.from({length:8}).map((e,t)=>s.jsxs("div",{className:"animate-pulse border-b border-line px-3 py-2",children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[s.jsx("div",{className:"h-4 w-32 rounded bg-surface-sunken"}),s.jsx("div",{className:"h-3 w-16 rounded bg-surface-sunken"})]}),s.jsx("div",{className:"mb-2 h-4 w-48 rounded bg-surface-sunken"}),s.jsx("div",{className:"h-3 w-full rounded bg-surface-sunken"})]},t))})}function Fe({filter:e,scopeLabel:t,searchQuery:n}){const u=n?.trim();return e?s.jsxs(q,{children:[s.jsx("p",{className:"font-medium text-fg",children:Be(e.label,t,u)}),s.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:He[e.reach]}),s.jsx(_,{variant:"secondary",size:"sm",className:"mt-4",onClick:e.onClear,children:"Clear filter"})]}):s.jsx(q,{children:s.jsx("p",{className:"text-fg-muted",children:Xe(u,t)})})}const He={"whole-folder":"Every message in this folder was checked.","loaded-pages":"Only the messages loaded so far were checked."};function Xe(e,t){return e?"No messages match your search":t?`No messages in ${t}`:"No messages in this mailbox"}function Be(e,t,n){return n?`No results for “${n}” in ${e}`:t?`No ${e} in ${t}`:`No ${e}`}function q({children:e}){return s.jsx("div",{className:"flex h-full flex-1 items-center justify-center",children:s.jsx("div",{className:"flex max-w-sm flex-col items-center justify-center p-8 text-center",children:e})})}function us(){return s.jsxs("div",{className:"flex items-center justify-center gap-2 py-4 text-sm text-fg-muted",role:"status","aria-live":"polite",children:[s.jsx(le,{className:"size-4 animate-spin","aria-hidden":"true"}),s.jsx("span",{children:"Loading more…"})]})}function Ue({message:e="Something went wrong loading this mailbox.",onRetry:t,onReport:n}){return s.jsx("div",{className:"flex h-full flex-1 items-center justify-center p-4",children:s.jsxs("div",{role:"alert",className:"flex max-w-sm flex-col items-center justify-center gap-3 text-center",children:[s.jsx(ue,{className:"size-8 text-danger","aria-hidden":"true"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-danger",children:"Couldn't load messages"}),s.jsx("p",{className:"mt-1 break-words text-sm text-fg-muted",children:e})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[t&&s.jsx(_,{variant:"secondary",size:"sm",onClick:t,children:"Retry"}),n&&s.jsx(_,{variant:"ghost",size:"sm",onClick:n,children:"Report a problem"})]})]})})}const I=72,V=10,We=I/2,Z="__swipeableRowAxisCancel";function J(e){return e==="leading"?I:e==="trailing"?-I:0}function Ye(e){return e>=I/2?"leading":e<=-I/2?"trailing":"none"}function Ke({thread:e,selectionMode:t,checked:n,active:u,peek:f,onPeek:c,onToggleCheck:p,onLongPress:w,onOpen:b,onAct:v}){const x=g.useRef(null),[j,h]=g.useState(null),{longPressProps:P}=Pe({onLongPress:w,isDisabled:t,accessibilityDescription:"Select message"}),S=i=>{const o=new PointerEvent("pointercancel",{bubbles:!0});o[Z]=!0,i.currentTarget.dispatchEvent(o)},r=Re(P,{onPointerDown:i=>{x.current={startX:i.clientX,startY:i.clientY,axis:"none",escaped:!1}},onPointerMove:i=>{if(t)return;const o=x.current;if(!o)return;const m=i.clientX-o.startX,M=i.clientY-o.startY;if(o.axis==="none"&&(Math.abs(M)>V&&Math.abs(M)>Math.abs(m)?o.axis="vertical":Math.abs(m)>V&&Math.abs(m)>Math.abs(M)&&(o.axis="horizontal",i.currentTarget.setPointerCapture(i.pointerId))),o.axis==="none")return;const L=o.axis==="horizontal"?Math.abs(m):Math.abs(M);if(!o.escaped&&L>We&&(o.escaped=!0,S(i)),o.axis!=="horizontal")return;const F=J(f),H=Math.max(-I,Math.min(I,F+m));h(H)},onPointerUp:i=>{const o=x.current;x.current=null;const m=j;if(h(null),!!o){if(o.axis!=="none"&&!o.escaped&&S(i),o.axis==="horizontal"){m!==null&&c(Ye(m));return}if(o.axis!=="vertical"){if(t){p();return}if(f!=="none"){c("none");return}b()}}},onPointerCancel:i=>{i.nativeEvent[Z]||(x.current=null,h(null))}}),d=j??J(f),y=d>0?"leading":d<0?"trailing":"none",R=K("relative touch-pan-y bg-surface","select-none",Ce({active:n||u})),z={transform:d!==0?`translateX(${d}px)`:void 0,transition:j===null?"transform 150ms ease":"none",minHeight:44},$=!e.isRead,A=i=>i.stopPropagation(),O=t?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:K("inline-flex size-7 shrink-0 items-center justify-center rounded-full border",n?"border-accent bg-accent text-accent-fg":"border-line-strong bg-canvas"),children:n&&s.jsx(de,{className:"size-3.5"})}),s.jsx(G,{thread:e})]}):s.jsxs(s.Fragment,{children:[$&&s.jsx("span",{className:"absolute left-1.5 top-1/2 size-1.5 -translate-y-1/2 rounded-full bg-accent"}),s.jsx("span",{role:"checkbox",tabIndex:0,"aria-checked":n,"aria-label":`Select message from ${e.fromName}`,onPointerDown:A,onPointerMove:A,onPointerUp:A,onClick:i=>{i.preventDefault(),i.stopPropagation(),w()},onKeyDown:i=>{i.key!=="Enter"&&i.key!==" "||(i.preventDefault(),i.stopPropagation(),w())},className:"-m-2 inline-flex size-11 shrink-0 items-center justify-center rounded-full",children:s.jsx(ze,{name:e.fromName,email:e.fromEmail,size:"sm"})}),s.jsx(G,{thread:e})]});return s.jsxs("div",{className:"relative overflow-hidden",children:[y==="leading"&&s.jsx("button",{type:"button",onClick:()=>v("leading"),"aria-label":e.isRead?"Mark as unread":"Mark as read",className:"absolute inset-y-0 left-0 flex items-center justify-start bg-accent-2 px-6 text-accent-fg",children:e.isRead?s.jsx(Oe,{className:"size-6"}):s.jsx(Se,{className:"size-6"})}),y==="trailing"&&s.jsx("button",{type:"button",onClick:()=>v("trailing"),"aria-label":"Delete message",className:"absolute inset-y-0 right-0 flex items-center justify-end bg-danger px-6 text-canvas",children:s.jsx(fe,{className:"size-6"})}),s.jsx("button",{type:"button",role:t?"checkbox":void 0,"aria-checked":t?n:void 0,"data-message-row":!0,"data-message-id":e.id,...r,className:R,style:z,children:O})]})}function Qe({sections:e,selectedThreadId:t,selectionMode:n,checkedIds:u,initialPeek:f,onToggleCheck:c,onEnterSelection:p,onOpenThread:w,onRefresh:b,refreshing:v,busy:x=!1}){const[j,h]=g.useState(new Set),[P,S]=g.useState(new Map),N=e.flatMap(r=>r.threads).filter(r=>!j.has(r.id)).map(r=>{const d=P.get(r.id);return d===void 0?r:{...r,isRead:d}}),[E,C]=g.useState(f&&f!=="none"&&N[1]?{id:N[1].id,side:f}:null),k=(r,d)=>{if(d==="trailing")h(y=>new Set(y).add(r));else{const y=N.find(R=>R.id===r);S(R=>new Map(R).set(r,!y?.isRead))}C(null)};return s.jsxs("div",{className:"flex-1 overflow-y-auto",children:[v&&s.jsxs("div",{className:"flex items-center justify-center gap-2 border-b border-line py-3 text-fg-muted",children:[s.jsx(De,{className:"size-4 animate-spin"}),s.jsx("span",{className:"text-xs",children:"Checking for new mail…"})]}),s.jsx("div",{className:"divide-y divide-line",children:N.map(r=>s.jsx("div",{className:x?"pointer-events-none opacity-50":void 0,children:s.jsx(Ke,{thread:r,selectionMode:n,checked:u.has(r.id),active:r.id===t,peek:E?.id===r.id?E.side:"none",onPeek:d=>C(d==="none"?null:{id:r.id,side:d}),onToggleCheck:()=>c(r.id),onLongPress:()=>p(r.id),onOpen:()=>w(r.id),onAct:d=>k(r.id,d)})},r.id))}),!n&&!v&&!x&&s.jsx("button",{type:"button",onClick:b,className:"w-full border-t border-line py-2 text-center text-2xs text-fg-subtle transition-colors hover:bg-surface-sunken",children:"Pull to refresh"})]})}const Ge=new Set;function ds({listTitle:e,listMeta:t,sections:n,briefFilters:u,flatList:f,listState:c="ready",searchQuery:p,listFilter:w,listScopeLabel:b,errorMessage:v,onRetry:x,onReportError:j,briefFilter:h,selectedThreadId:P,density:S="comfortable",onSelectThread:N,onOpenNav:E,isDesktop:C,initialTouchState:k,selection:r,keyboard:d,selectionBar:y,paneOverlay:R,listBody:z,hideHeader:$=!1}){const A=S==="compact"?ke:Ae,O=g.useRef(null),i=g.useRef(null),o=me(d);ye({containerRef:O,itemSelector:Q,enabled:!o});const m=o?d.focusedId:void 0,M=o?m??n[0]?.threads[0]?.id:void 0,L=g.useCallback(a=>M===void 0?void 0:a===M?0:-1,[M]);g.useEffect(()=>{if(m===void 0)return;const a=i.current;if(!a)return;const l=a.querySelector(`${Q}[data-message-id="${m}"]`);!l||l===a.ownerDocument.activeElement||l.focus({preventScroll:!1})},[m]),g.useEffect(()=>{if(!o)return;const a=i.current;if(!a)return;const l=a.ownerDocument.activeElement;l!==null&&l!==a.ownerDocument.body||a.focus({preventScroll:!0})},[o]);const F=!C&&!u&&c==="ready",[H,W]=g.useState(!1),ae=k==="peek-trailing"?"trailing":k==="peek-leading"?"leading":void 0,re=()=>{W(!0),setTimeout(()=>W(!1),1400)},D=r?.selectedIds??Ge,T=r?.onToggle,Y=r?.onRowSelect,ie=Ee(D.size,C),X=g.useCallback(a=>{if(T)return{checked:D.has(a),onToggle:l=>{l.preventDefault(),l.stopPropagation(),T(a)}}},[D,T]),B=g.useCallback((a,l)=>Y?.(a,Me(l))?(l.preventDefault(),l.shiftKey&&window.getSelection()?.removeAllRanges(),!0):!1,[Y]),oe=g.useCallback(({thread:a,active:l,onClick:U})=>s.jsx(A,{thread:a,active:l,focused:a.id===m,tabIndex:L(a.id),selection:X(a.id),onClick:ce=>{B(a.id,ce)||U?.()}}),[A,X,B,m,L]);return s.jsxs("section",{ref:a=>{i.current=a,d?.ref(a)},tabIndex:o?-1:void 0,className:"relative flex h-full w-full flex-col bg-surface outline-none",children:[y??($?null:s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[E&&s.jsx(_,{variant:"ghost",size:"sm",icon:s.jsx(_e,{className:"size-4"}),onClick:E,"aria-label":"Open folders",className:"-ml-1 shrink-0"}),s.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:e}),t&&s.jsx("span",{className:"shrink-0 text-2xs text-fg-subtle",children:t})]})),c==="loading"?s.jsx("div",{className:"flex-1 overflow-y-auto",children:s.jsx($e,{})}):c==="empty"?s.jsx(Fe,{filter:w,scopeLabel:b,searchQuery:p}):c==="error"?s.jsx(Ue,{message:v,onRetry:x,onReport:j}):u&&h?s.jsx(Ie,{...h,sections:n,selectedThreadId:P,Row:oe,keyboard:d,onSelectThread:N}):z??(F?s.jsx(Qe,{sections:n,selectedThreadId:P,selectionMode:ie,checkedIds:D,initialPeek:ae,onToggleCheck:a=>T?.(a),onEnterSelection:a=>T?.(a),onOpenThread:a=>N?.(a),onRefresh:re,refreshing:H}):s.jsx("div",{ref:O,className:"flex-1 overflow-y-auto",children:n.map(a=>s.jsxs("div",{children:[!f&&a.label&&s.jsxs("div",{className:"sticky top-0 flex h-section-row items-center justify-between border-b border-line bg-surface-sunken px-row-inset",children:[s.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:a.label}),s.jsx("span",{className:"text-2xs text-fg-subtle tabular-nums",children:a.threads.length})]}),s.jsx("div",{className:"divide-y divide-line",children:a.threads.map(l=>s.jsx(A,{thread:l,active:l.id===P,focused:l.id===m,tabIndex:L(l.id),selection:X(l.id),onClick:U=>{B(l.id,U)||N?.(l.id)}},l.id))})]},a.id))})),C&&s.jsx(Le,{hints:d?Ne(d.handlers):we}),R]})}var qe=class extends xe{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:n}=e,u=super.createResult(e,t),{isFetching:f,isRefetching:c,isError:p,isRefetchError:w}=u,b=n.fetchMeta?.fetchMore?.direction,v=p&&b==="forward",x=f&&b==="forward",j=p&&b==="backward",h=f&&b==="backward";return{...u,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:he(t,n.data),hasPreviousPage:ge(t,n.data),isFetchNextPageError:v,isFetchingNextPage:x,isFetchPreviousPageError:j,isFetchingPreviousPage:h,isRefetchError:w&&!v&&!j,isRefetching:c&&!x&&!h}}};function fs(e,t){return pe(e,qe)}const se={dimension:"read",position:"pre",text:"unread"},Ve={dimension:"read",position:"pre",text:"read"},te={dimension:"starred",position:"pre",text:"starred"},ne={dimension:"attachment",position:"post",text:"with an attachment"},Ze=[["unread",se],["flagged",te],["attachment",ne]],Je=e=>{switch(e.type){case"category":return{dimension:"category",position:"pre",text:ee(e.category)??e.value};case"isUnread":return se;case"isRead":return Ve;case"isStarred":return te;case"hasAttachment":return ne;case"from":return{dimension:e.raw,position:"post",text:`from ${e.value}`};case"subject":return{dimension:e.raw,position:"post",text:`about “${e.value}”`};case"before":return{dimension:e.raw,position:"post",text:`sent before ${e.value}`};case"after":return{dimension:e.raw,position:"post",text:`sent on or after ${e.value}`};case"in":return{dimension:e.raw,position:"post",text:`in ${e.value}`};case"account":return{dimension:e.raw,position:"post",text:`in the ${e.value} account`}}},es=(e,t)=>{const n=new Map,u=c=>{n.has(c.dimension)||n.set(c.dimension,c)},f=ee(e.category);f&&u({dimension:"category",position:"pre",text:f});for(const[c,p]of Ze)e.attributes.has(c)&&u(p);for(const c of t)u(Je(c));return[...n.values()]},ss=(e,t)=>{const n=es(e,t);if(n.length===0)return;const u=f=>n.filter(c=>c.position===f).map(c=>c.text);return[...u("pre"),"mail",...u("post")].join(" ")},ms=({chips:e,tokens:t,reach:n,onClear:u})=>{const f=ss(e,t);if(f)return{label:f,reach:n,onClear:u}};function xs({title:e,unreadCount:t,preset:n,selectedCategory:u,activeFilters:f,onSelectCategory:c,onToggleFilter:p,onSelectSource:w,onClearFilters:b,children:v,footer:x,searchResults:j,searchLoading:h,relatedResults:P,relatedLoading:S,onSelectSearchResult:N,searchResultsLabel:E,relatedResultsLabel:C,searchResultsInBody:k,refreshControl:r}){const{searchInput:d}=be(),y=d.trim().length>0,R={categories:n.categories,filters:n.filters,sources:n.sources,selectedCategory:u,activeFilters:f,onSelectCategory:c,onSelectSource:w,onToggleFilter:p,onClear:b};return s.jsx(ve,{hasSheet:!y,children:s.jsx(Te,{title:e,unreadCount:t,footer:x,searchFilter:R,searchResults:j,searchLoading:h,relatedResults:P,relatedLoading:S,onSelectSearchResult:N,searchResultsLabel:E,relatedResultsLabel:C,searchResultsInBody:k,refreshControl:r,children:s.jsx(je,{...R,hideChrome:y,children:v})})})}export{us as M,Ke as S,ds as a,xs as b,ms as l,fs as u};
|
|
1
|
+
import{j as s,L as le,f as _,_ as ue,r as g,t as K,aA as de,a2 as fe,d1 as me,b_ as xe,dW as ge,dX as he,dY as pe,C as be,dZ as ve,d2 as je}from"./index-DaE4Ytea.js";import{m as we,A as Ne}from"./search-token-index-BgcD8qG8.js";import{u as ye,L as Q}from"./roving-focus-CZcayiPM.js";import{ad as Pe,ae as Re,c as Ce,a as G,af as Se,v as Ee,ag as Me,ah as ke,ai as Ae,aj as Ie,ak as Le,al as ee,am as Te}from"./MailListHeader-NDI2LHme.js";import{A as ze}from"./avatar-CWLq4Fxm.js";import{M as Oe}from"./mail-CYJ32Az9.js";import{R as De}from"./refresh-cw-D2US4SLy.js";import{M as _e}from"./menu-Bn2nArxC.js";function $e(){return s.jsx("div",{className:"space-y-0",role:"status","aria-busy":"true","aria-label":"Loading messages",children:Array.from({length:8}).map((e,t)=>s.jsxs("div",{className:"animate-pulse border-b border-line px-3 py-2",children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[s.jsx("div",{className:"h-4 w-32 rounded bg-surface-sunken"}),s.jsx("div",{className:"h-3 w-16 rounded bg-surface-sunken"})]}),s.jsx("div",{className:"mb-2 h-4 w-48 rounded bg-surface-sunken"}),s.jsx("div",{className:"h-3 w-full rounded bg-surface-sunken"})]},t))})}function Fe({filter:e,scopeLabel:t,searchQuery:n}){const u=n?.trim();return e?s.jsxs(q,{children:[s.jsx("p",{className:"font-medium text-fg",children:Be(e.label,t,u)}),s.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:He[e.reach]}),s.jsx(_,{variant:"secondary",size:"sm",className:"mt-4",onClick:e.onClear,children:"Clear filter"})]}):s.jsx(q,{children:s.jsx("p",{className:"text-fg-muted",children:Xe(u,t)})})}const He={"whole-folder":"Every message in this folder was checked.","loaded-pages":"Only the messages loaded so far were checked."};function Xe(e,t){return e?"No messages match your search":t?`No messages in ${t}`:"No messages in this mailbox"}function Be(e,t,n){return n?`No results for “${n}” in ${e}`:t?`No ${e} in ${t}`:`No ${e}`}function q({children:e}){return s.jsx("div",{className:"flex h-full flex-1 items-center justify-center",children:s.jsx("div",{className:"flex max-w-sm flex-col items-center justify-center p-8 text-center",children:e})})}function us(){return s.jsxs("div",{className:"flex items-center justify-center gap-2 py-4 text-sm text-fg-muted",role:"status","aria-live":"polite",children:[s.jsx(le,{className:"size-4 animate-spin","aria-hidden":"true"}),s.jsx("span",{children:"Loading more…"})]})}function Ue({message:e="Something went wrong loading this mailbox.",onRetry:t,onReport:n}){return s.jsx("div",{className:"flex h-full flex-1 items-center justify-center p-4",children:s.jsxs("div",{role:"alert",className:"flex max-w-sm flex-col items-center justify-center gap-3 text-center",children:[s.jsx(ue,{className:"size-8 text-danger","aria-hidden":"true"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-danger",children:"Couldn't load messages"}),s.jsx("p",{className:"mt-1 break-words text-sm text-fg-muted",children:e})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[t&&s.jsx(_,{variant:"secondary",size:"sm",onClick:t,children:"Retry"}),n&&s.jsx(_,{variant:"ghost",size:"sm",onClick:n,children:"Report a problem"})]})]})})}const I=72,V=10,We=I/2,Z="__swipeableRowAxisCancel";function J(e){return e==="leading"?I:e==="trailing"?-I:0}function Ye(e){return e>=I/2?"leading":e<=-I/2?"trailing":"none"}function Ke({thread:e,selectionMode:t,checked:n,active:u,peek:f,onPeek:c,onToggleCheck:p,onLongPress:w,onOpen:b,onAct:v}){const x=g.useRef(null),[j,h]=g.useState(null),{longPressProps:P}=Pe({onLongPress:w,isDisabled:t,accessibilityDescription:"Select message"}),S=i=>{const o=new PointerEvent("pointercancel",{bubbles:!0});o[Z]=!0,i.currentTarget.dispatchEvent(o)},r=Re(P,{onPointerDown:i=>{x.current={startX:i.clientX,startY:i.clientY,axis:"none",escaped:!1}},onPointerMove:i=>{if(t)return;const o=x.current;if(!o)return;const m=i.clientX-o.startX,M=i.clientY-o.startY;if(o.axis==="none"&&(Math.abs(M)>V&&Math.abs(M)>Math.abs(m)?o.axis="vertical":Math.abs(m)>V&&Math.abs(m)>Math.abs(M)&&(o.axis="horizontal",i.currentTarget.setPointerCapture(i.pointerId))),o.axis==="none")return;const L=o.axis==="horizontal"?Math.abs(m):Math.abs(M);if(!o.escaped&&L>We&&(o.escaped=!0,S(i)),o.axis!=="horizontal")return;const F=J(f),H=Math.max(-I,Math.min(I,F+m));h(H)},onPointerUp:i=>{const o=x.current;x.current=null;const m=j;if(h(null),!!o){if(o.axis!=="none"&&!o.escaped&&S(i),o.axis==="horizontal"){m!==null&&c(Ye(m));return}if(o.axis!=="vertical"){if(t){p();return}if(f!=="none"){c("none");return}b()}}},onPointerCancel:i=>{i.nativeEvent[Z]||(x.current=null,h(null))}}),d=j??J(f),y=d>0?"leading":d<0?"trailing":"none",R=K("relative touch-pan-y bg-surface","select-none",Ce({active:n||u})),z={transform:d!==0?`translateX(${d}px)`:void 0,transition:j===null?"transform 150ms ease":"none",minHeight:44},$=!e.isRead,A=i=>i.stopPropagation(),O=t?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:K("inline-flex size-7 shrink-0 items-center justify-center rounded-full border",n?"border-accent bg-accent text-accent-fg":"border-line-strong bg-canvas"),children:n&&s.jsx(de,{className:"size-3.5"})}),s.jsx(G,{thread:e})]}):s.jsxs(s.Fragment,{children:[$&&s.jsx("span",{className:"absolute left-1.5 top-1/2 size-1.5 -translate-y-1/2 rounded-full bg-accent"}),s.jsx("span",{role:"checkbox",tabIndex:0,"aria-checked":n,"aria-label":`Select message from ${e.fromName}`,onPointerDown:A,onPointerMove:A,onPointerUp:A,onClick:i=>{i.preventDefault(),i.stopPropagation(),w()},onKeyDown:i=>{i.key!=="Enter"&&i.key!==" "||(i.preventDefault(),i.stopPropagation(),w())},className:"-m-2 inline-flex size-11 shrink-0 items-center justify-center rounded-full",children:s.jsx(ze,{name:e.fromName,email:e.fromEmail,size:"sm"})}),s.jsx(G,{thread:e})]});return s.jsxs("div",{className:"relative overflow-hidden",children:[y==="leading"&&s.jsx("button",{type:"button",onClick:()=>v("leading"),"aria-label":e.isRead?"Mark as unread":"Mark as read",className:"absolute inset-y-0 left-0 flex items-center justify-start bg-accent-2 px-6 text-accent-fg",children:e.isRead?s.jsx(Oe,{className:"size-6"}):s.jsx(Se,{className:"size-6"})}),y==="trailing"&&s.jsx("button",{type:"button",onClick:()=>v("trailing"),"aria-label":"Delete message",className:"absolute inset-y-0 right-0 flex items-center justify-end bg-danger px-6 text-canvas",children:s.jsx(fe,{className:"size-6"})}),s.jsx("button",{type:"button",role:t?"checkbox":void 0,"aria-checked":t?n:void 0,"data-message-row":!0,"data-message-id":e.id,...r,className:R,style:z,children:O})]})}function Qe({sections:e,selectedThreadId:t,selectionMode:n,checkedIds:u,initialPeek:f,onToggleCheck:c,onEnterSelection:p,onOpenThread:w,onRefresh:b,refreshing:v,busy:x=!1}){const[j,h]=g.useState(new Set),[P,S]=g.useState(new Map),N=e.flatMap(r=>r.threads).filter(r=>!j.has(r.id)).map(r=>{const d=P.get(r.id);return d===void 0?r:{...r,isRead:d}}),[E,C]=g.useState(f&&f!=="none"&&N[1]?{id:N[1].id,side:f}:null),k=(r,d)=>{if(d==="trailing")h(y=>new Set(y).add(r));else{const y=N.find(R=>R.id===r);S(R=>new Map(R).set(r,!y?.isRead))}C(null)};return s.jsxs("div",{className:"flex-1 overflow-y-auto",children:[v&&s.jsxs("div",{className:"flex items-center justify-center gap-2 border-b border-line py-3 text-fg-muted",children:[s.jsx(De,{className:"size-4 animate-spin"}),s.jsx("span",{className:"text-xs",children:"Checking for new mail…"})]}),s.jsx("div",{className:"divide-y divide-line",children:N.map(r=>s.jsx("div",{className:x?"pointer-events-none opacity-50":void 0,children:s.jsx(Ke,{thread:r,selectionMode:n,checked:u.has(r.id),active:r.id===t,peek:E?.id===r.id?E.side:"none",onPeek:d=>C(d==="none"?null:{id:r.id,side:d}),onToggleCheck:()=>c(r.id),onLongPress:()=>p(r.id),onOpen:()=>w(r.id),onAct:d=>k(r.id,d)})},r.id))}),!n&&!v&&!x&&s.jsx("button",{type:"button",onClick:b,className:"w-full border-t border-line py-2 text-center text-2xs text-fg-subtle transition-colors hover:bg-surface-sunken",children:"Pull to refresh"})]})}const Ge=new Set;function ds({listTitle:e,listMeta:t,sections:n,briefFilters:u,flatList:f,listState:c="ready",searchQuery:p,listFilter:w,listScopeLabel:b,errorMessage:v,onRetry:x,onReportError:j,briefFilter:h,selectedThreadId:P,density:S="comfortable",onSelectThread:N,onOpenNav:E,isDesktop:C,initialTouchState:k,selection:r,keyboard:d,selectionBar:y,paneOverlay:R,listBody:z,hideHeader:$=!1}){const A=S==="compact"?ke:Ae,O=g.useRef(null),i=g.useRef(null),o=me(d);ye({containerRef:O,itemSelector:Q,enabled:!o});const m=o?d.focusedId:void 0,M=o?m??n[0]?.threads[0]?.id:void 0,L=g.useCallback(a=>M===void 0?void 0:a===M?0:-1,[M]);g.useEffect(()=>{if(m===void 0)return;const a=i.current;if(!a)return;const l=a.querySelector(`${Q}[data-message-id="${m}"]`);!l||l===a.ownerDocument.activeElement||l.focus({preventScroll:!1})},[m]),g.useEffect(()=>{if(!o)return;const a=i.current;if(!a)return;const l=a.ownerDocument.activeElement;l!==null&&l!==a.ownerDocument.body||a.focus({preventScroll:!0})},[o]);const F=!C&&!u&&c==="ready",[H,W]=g.useState(!1),ae=k==="peek-trailing"?"trailing":k==="peek-leading"?"leading":void 0,re=()=>{W(!0),setTimeout(()=>W(!1),1400)},D=r?.selectedIds??Ge,T=r?.onToggle,Y=r?.onRowSelect,ie=Ee(D.size,C),X=g.useCallback(a=>{if(T)return{checked:D.has(a),onToggle:l=>{l.preventDefault(),l.stopPropagation(),T(a)}}},[D,T]),B=g.useCallback((a,l)=>Y?.(a,Me(l))?(l.preventDefault(),l.shiftKey&&window.getSelection()?.removeAllRanges(),!0):!1,[Y]),oe=g.useCallback(({thread:a,active:l,onClick:U})=>s.jsx(A,{thread:a,active:l,focused:a.id===m,tabIndex:L(a.id),selection:X(a.id),onClick:ce=>{B(a.id,ce)||U?.()}}),[A,X,B,m,L]);return s.jsxs("section",{ref:a=>{i.current=a,d?.ref(a)},tabIndex:o?-1:void 0,className:"relative flex h-full w-full flex-col bg-surface outline-none",children:[y??($?null:s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[E&&s.jsx(_,{variant:"ghost",size:"sm",icon:s.jsx(_e,{className:"size-4"}),onClick:E,"aria-label":"Open folders",className:"-ml-1 shrink-0"}),s.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:e}),t&&s.jsx("span",{className:"shrink-0 text-2xs text-fg-subtle",children:t})]})),c==="loading"?s.jsx("div",{className:"flex-1 overflow-y-auto",children:s.jsx($e,{})}):c==="empty"?s.jsx(Fe,{filter:w,scopeLabel:b,searchQuery:p}):c==="error"?s.jsx(Ue,{message:v,onRetry:x,onReport:j}):u&&h?s.jsx(Ie,{...h,sections:n,selectedThreadId:P,Row:oe,keyboard:d,onSelectThread:N}):z??(F?s.jsx(Qe,{sections:n,selectedThreadId:P,selectionMode:ie,checkedIds:D,initialPeek:ae,onToggleCheck:a=>T?.(a),onEnterSelection:a=>T?.(a),onOpenThread:a=>N?.(a),onRefresh:re,refreshing:H}):s.jsx("div",{ref:O,className:"flex-1 overflow-y-auto",children:n.map(a=>s.jsxs("div",{children:[!f&&a.label&&s.jsxs("div",{className:"sticky top-0 flex h-section-row items-center justify-between border-b border-line bg-surface-sunken px-row-inset",children:[s.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:a.label}),s.jsx("span",{className:"text-2xs text-fg-subtle tabular-nums",children:a.threads.length})]}),s.jsx("div",{className:"divide-y divide-line",children:a.threads.map(l=>s.jsx(A,{thread:l,active:l.id===P,focused:l.id===m,tabIndex:L(l.id),selection:X(l.id),onClick:U=>{B(l.id,U)||N?.(l.id)}},l.id))})]},a.id))})),C&&s.jsx(Le,{hints:d?Ne(d.handlers):we}),R]})}var qe=class extends xe{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:n}=e,u=super.createResult(e,t),{isFetching:f,isRefetching:c,isError:p,isRefetchError:w}=u,b=n.fetchMeta?.fetchMore?.direction,v=p&&b==="forward",x=f&&b==="forward",j=p&&b==="backward",h=f&&b==="backward";return{...u,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:he(t,n.data),hasPreviousPage:ge(t,n.data),isFetchNextPageError:v,isFetchingNextPage:x,isFetchPreviousPageError:j,isFetchingPreviousPage:h,isRefetchError:w&&!v&&!j,isRefetching:c&&!x&&!h}}};function fs(e,t){return pe(e,qe)}const se={dimension:"read",position:"pre",text:"unread"},Ve={dimension:"read",position:"pre",text:"read"},te={dimension:"starred",position:"pre",text:"starred"},ne={dimension:"attachment",position:"post",text:"with an attachment"},Ze=[["unread",se],["flagged",te],["attachment",ne]],Je=e=>{switch(e.type){case"category":return{dimension:"category",position:"pre",text:ee(e.category)??e.value};case"isUnread":return se;case"isRead":return Ve;case"isStarred":return te;case"hasAttachment":return ne;case"from":return{dimension:e.raw,position:"post",text:`from ${e.value}`};case"subject":return{dimension:e.raw,position:"post",text:`about “${e.value}”`};case"before":return{dimension:e.raw,position:"post",text:`sent before ${e.value}`};case"after":return{dimension:e.raw,position:"post",text:`sent on or after ${e.value}`};case"in":return{dimension:e.raw,position:"post",text:`in ${e.value}`};case"account":return{dimension:e.raw,position:"post",text:`in the ${e.value} account`}}},es=(e,t)=>{const n=new Map,u=c=>{n.has(c.dimension)||n.set(c.dimension,c)},f=ee(e.category);f&&u({dimension:"category",position:"pre",text:f});for(const[c,p]of Ze)e.attributes.has(c)&&u(p);for(const c of t)u(Je(c));return[...n.values()]},ss=(e,t)=>{const n=es(e,t);if(n.length===0)return;const u=f=>n.filter(c=>c.position===f).map(c=>c.text);return[...u("pre"),"mail",...u("post")].join(" ")},ms=({chips:e,tokens:t,reach:n,onClear:u})=>{const f=ss(e,t);if(f)return{label:f,reach:n,onClear:u}};function xs({title:e,unreadCount:t,preset:n,selectedCategory:u,activeFilters:f,onSelectCategory:c,onToggleFilter:p,onSelectSource:w,onClearFilters:b,children:v,footer:x,searchResults:j,searchLoading:h,relatedResults:P,relatedLoading:S,onSelectSearchResult:N,searchResultsLabel:E,relatedResultsLabel:C,searchResultsInBody:k,refreshControl:r}){const{searchInput:d}=be(),y=d.trim().length>0,R={categories:n.categories,filters:n.filters,sources:n.sources,selectedCategory:u,activeFilters:f,onSelectCategory:c,onSelectSource:w,onToggleFilter:p,onClear:b};return s.jsx(ve,{hasSheet:!y,children:s.jsx(Te,{title:e,unreadCount:t,footer:x,searchFilter:R,searchResults:j,searchLoading:h,relatedResults:P,relatedLoading:S,onSelectSearchResult:N,searchResultsLabel:E,relatedResultsLabel:C,searchResultsInBody:k,refreshControl:r,children:s.jsx(je,{...R,hideChrome:y,children:v})})})}export{us as M,Ke as S,ds as a,xs as b,ms as l,fs as u};
|