@remit/web-client-dist 0.0.647 → 0.0.648
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-DDI-uJGj.js → BriefPane-6SeduuWz.js} +1 -1
- package/assets/{CalendarComposePane-DNi6A7t1.js → CalendarComposePane-Cw5GmsCb.js} +1 -1
- package/assets/{CalendarComposeSeed-C5-aKiBn.js → CalendarComposeSeed-BYQID6Zq.js} +1 -1
- package/assets/{CalendarShell-Chi7zUPT.js → CalendarShell-D-QilRHB.js} +1 -1
- package/assets/{EmptyState-C4dAZQdY.js → EmptyState-B0e0Fyab.js} +1 -1
- package/assets/{ErrorState-C5skYR61.js → ErrorState-BvRoI00P.js} +1 -1
- package/assets/{FlaggedPane-D4slfql7.js → FlaggedPane-CqU4A5n1.js} +1 -1
- package/assets/{FullCompose-Y4MrfaVg.js → FullCompose-CO9Qd5cw.js} +1 -1
- package/assets/{MailListHeader-B16BkNe9.js → MailListHeader-U5Wr2TGm.js} +1 -1
- package/assets/{MailNav-el9V6UqM.js → MailNav-Bu6T-RaV.js} +1 -1
- package/assets/{MailShell-DhPWfi3t.js → MailShell-Bk32z8li.js} +1 -1
- package/assets/{MailViewChrome-CsBvfZQm.js → MailViewChrome-C2SUa5Zc.js} +1 -1
- package/assets/{MailboxPane-QsATKo-j.js → MailboxPane-CakLdj2O.js} +1 -1
- package/assets/{NavMenuButton-Dfvy_7Dm.js → NavMenuButton-zGIUjuCz.js} +1 -1
- package/assets/{OnboardingWizard-Czdora7x.js → OnboardingWizard-C1MwyxbF.js} +1 -1
- package/assets/{OpenCalendarEvent-Ctpns2Bw.js → OpenCalendarEvent-XlgqQLYu.js} +1 -1
- package/assets/{OutboxPane-BTkQnlX4.js → OutboxPane-34kWcbQ8.js} +1 -1
- package/assets/_calendarObjectId-BMa2-zqs.js +1 -0
- package/assets/_mailboxId-C7sJGa3E.js +1 -0
- package/assets/_messageId-C1bvBcA_.js +1 -0
- package/assets/_messageId-CAZx46CE.js +1 -0
- package/assets/_messageId-KMwf3aVi.js +1 -0
- package/assets/_outboxMessageId-DMqKmP4p.js +1 -0
- package/assets/_recurrenceId-DWxk61ua.js +1 -0
- package/assets/_threadId-BFvPyxvk.js +1 -0
- package/assets/_threadId-Cn9s33oU.js +1 -0
- package/assets/_threadId-hnMswDzn.js +1 -0
- package/assets/{_view._date-DmO9W4Hp.js → _view._date-BpO0DQMt.js} +1 -1
- package/assets/{accounts-jhHMZURR.js → accounts-Db5HLljt.js} +1 -1
- package/assets/{advanced-DxWwIIqu.js → advanced-CDcsqqfJ.js} +1 -1
- package/assets/{appearance-URdQXm0J.js → appearance-BN2ymT0f.js} +1 -1
- package/assets/{attendee-row-CzLRuZkS.js → attendee-row-B17fnTlq.js} +1 -1
- package/assets/{avatar-DReNujdD.js → avatar-CVy1NIOI.js} +1 -1
- package/assets/{bell-off-BO2gV0YK.js → bell-off-C6pIOJuw.js} +1 -1
- package/assets/{bottom-sheet-CneWkZHd.js → bottom-sheet-fFpTIBl3.js} +1 -1
- package/assets/{brief-B6cgf0is.js → brief-BvhcczD6.js} +1 -1
- package/assets/brief-CwZYdqT4.js +1 -0
- package/assets/{browser-ponyfill-CkapmCFO.js → browser-ponyfill-C6LUxBR9.js} +1 -1
- package/assets/{bug-Dobgqhnx.js → bug-C0o6sVq8.js} +1 -1
- package/assets/{calendar-DeN02NaA.js → calendar--_kN4V0u.js} +1 -1
- package/assets/{calendar-clash-strip-QFFUz8UQ.js → calendar-clash-strip-Bm-MYQet.js} +1 -1
- package/assets/{calendar-format-CkNnvhu8.js → calendar-format-DeXXPgld.js} +1 -1
- package/assets/{calendar-report-BC1ZSJs6.js → calendar-report-DJ8H5rPt.js} +1 -1
- package/assets/{calendar-suggestion-B0HwdBJl.js → calendar-suggestion-BdENUHgp.js} +1 -1
- package/assets/{calendars-CjelSz63.js → calendars-C9FpsmHu.js} +1 -1
- package/assets/{card-dsNrYMSh.js → card-D5-QETHZ.js} +1 -1
- package/assets/{checkbox-1ELJWaiG.js → checkbox-DHX4RXRp.js} +1 -1
- package/assets/chevron-left-dJxdLFYn.js +1 -0
- package/assets/{circle-check-DLz6TIwf.js → circle-check-DnfNFifm.js} +1 -1
- package/assets/{circle-check-big-BwbzDWkH.js → circle-check-big-C-z_fIR2.js} +1 -1
- package/assets/{circle-help-nKRkRrxf.js → circle-help-B0j9iMea.js} +1 -1
- package/assets/{clock-Dceh-vYk.js → clock-WYPpiy7W.js} +1 -1
- package/assets/compose._-_outboxMessageId_-011ajlS-.js +1 -0
- package/assets/compose._-_outboxMessageId_-BB0997HI.js +1 -0
- package/assets/compose._-_outboxMessageId_-BlrwashK.js +1 -0
- package/assets/compose._-_outboxMessageId_-CR73ieY-.js +1 -0
- package/assets/{config-import-h2hBuwyg.js → config-import-BhzjBZHn.js} +1 -1
- package/assets/{confirm-dialog-B9rqkVa0.js → confirm-dialog-C86T_96x.js} +1 -1
- package/assets/{copy-j7JY0yjD.js → copy-BHWk39AO.js} +1 -1
- package/assets/{credential-steps-BmhbQESa.js → credential-steps-BocZzgRx.js} +1 -1
- package/assets/{download-CupaMHIk.js → download-BDUsG8uv.js} +1 -1
- package/assets/{file-json-GbedUr-6.js → file-json-CH3D4V9l.js} +1 -1
- package/assets/{filters-DhRkHr08.js → filters-P8AdjJhc.js} +1 -1
- package/assets/flagged-DDIJoBUx.js +1 -0
- package/assets/{flagged-BP66dE4t.js → flagged-r9rvSSKu.js} +1 -1
- package/assets/{folders-BQMyDjrZ.js → folders-FHpyokiL.js} +1 -1
- package/assets/{help-copy-CFsq9avW.js → help-copy-0l4D28qZ.js} +1 -1
- package/assets/{import-DlHB05YV.js → import-DOeRnZWh.js} +1 -1
- package/assets/index-BYFVPCSW.js +1 -0
- package/assets/{index-DfBSCm9a.js → index-BmphFwUI.js} +1 -1
- package/assets/index-BwJgsyEU.js +1 -0
- package/assets/index-C1bvBcA_.js +1 -0
- package/assets/index-CQ_R_yZ3.js +1 -0
- package/assets/index-D6fi4rKR.js +1 -0
- package/assets/index-DNmgLR8G.js +1 -0
- package/assets/index-KMwf3aVi.js +1 -0
- package/assets/index-TcQLNyzX.js +1 -0
- package/assets/index-cx55C5bq.js +1 -0
- package/assets/{index-CwWM67NV.js → index-sX1xY_ye.js} +4 -4
- package/assets/{index-BMs6sEa1.js → index-tC8B4Qkq.js} +4 -4
- package/assets/{kbd-D4cak2_L.js → kbd-C2HaWlmQ.js} +1 -1
- package/assets/{labels-9o3eXnqe.js → labels-D0EN6mY_.js} +1 -1
- package/assets/{mail-rYx209u6.js → mail-Ce5BEspm.js} +1 -1
- package/assets/{mail-BeRy62_C.js → mail-Cyr1NbkS.js} +1 -1
- package/assets/{map-pin-K36ow_bB.js → map-pin-DRN0BhjA.js} +1 -1
- package/assets/{menu-Ii2_MgiT.js → menu-CQspPBY1.js} +1 -1
- package/assets/minus-DIJTpiGn.js +1 -0
- package/assets/{new-DLgcoEaw.js → new-CCLchdvs.js} +1 -1
- package/assets/{onboarding-completion-HrHZge56.js → onboarding-completion-BxtUqUSR.js} +1 -1
- package/assets/onboarding-k_b7HtSB.js +1 -0
- package/assets/outbox-RK4noyR-.js +1 -0
- package/assets/{pane-header-1GoJOJ7m.js → pane-header-B5zvb4Lq.js} +1 -1
- package/assets/{pencil-pXW5MHhB.js → pencil-nDRamPGy.js} +1 -1
- package/assets/{popover-menu-BFjAfpYc.js → popover-menu-6EW5dPCf.js} +1 -1
- package/assets/{refresh-cw-T_cDgxoQ.js → refresh-cw-5WZnJ3vE.js} +1 -1
- package/assets/{rich-text-CVsZU2-1.js → rich-text-BVh3MilZ.js} +1 -1
- package/assets/{rich-text-spellcheck-worker-provider-CtfwhR7A.js → rich-text-spellcheck-worker-provider-Bhe6nYv5.js} +1 -1
- package/assets/{rotate-ccw-Crpb5XKQ.js → rotate-ccw-DD52wAh_.js} +1 -1
- package/assets/{roving-focus-CaY933ER.js → roving-focus-CPkr5FTJ.js} +1 -1
- package/assets/{row-actions-Cf9tj2oq.js → row-actions-odmLDYb6.js} +1 -1
- package/assets/{search-mirror-BCkfyqeh.js → search-mirror-AfArrCF4.js} +1 -1
- package/assets/{search-token-index-B30iFwVb.js → search-token-index-zzFp1OWm.js} +1 -1
- package/assets/{sections-BA0vGpLD.js → sections-CNH_hutr.js} +1 -1
- package/assets/{senders-DtGMptu_.js → senders-B4kKJcVc.js} +1 -1
- package/assets/settings-C-J1_Lo2.js +1 -0
- package/assets/{settings-screen-DR2XUwwh.js → settings-screen-af78w2mN.js} +1 -1
- package/assets/{shield-check-CWzcz6KV.js → shield-check-Dv9973Ie.js} +1 -1
- package/assets/{suggested-vips-DTLRAZLM.js → suggested-vips-CJKiDyjS.js} +1 -1
- package/assets/{suggestion._suggestionId--Fjakgzu.js → suggestion._suggestionId-BFPn70Ft.js} +1 -1
- package/assets/{undo-2-_UReZR98.js → undo-2-DgvBsOEv.js} +1 -1
- package/assets/{useCalendarData-BCmWqTxE.js → useCalendarData-DRO3xOST.js} +1 -1
- package/assets/{useCalendarFreeBusy-CsesAFnS.js → useCalendarFreeBusy-gIly18MB.js} +1 -1
- package/assets/{useCalendarWrites-DZ39ckys.js → useCalendarWrites-BjpSgweR.js} +1 -1
- package/assets/{useCalendars-Drw3pPJl.js → useCalendars-Q4eHkTES.js} +1 -1
- package/assets/{useDebouncedValue-B9f7KFpF.js → useDebouncedValue-s8y_FI-2.js} +1 -1
- package/assets/{useFilters-CsNg6ABa.js → useFilters-CqBmHL-q.js} +1 -1
- package/assets/{useLabels-B83QXWey.js → useLabels-D-8squEI.js} +1 -1
- package/assets/{useLayoutTier-Cy2CvC24.js → useLayoutTier-CmvG4PY1.js} +1 -1
- package/assets/{useMessageBodyContent-BjLhGd0E.js → useMessageBodyContent-hPuofJUT.js} +1 -1
- package/assets/{useQueries-CJO85Tgo.js → useQueries-Yk6rRJaD.js} +1 -1
- package/assets/{useRefreshControl-yGPoq9tM.js → useRefreshControl-H0TU9ViP.js} +1 -1
- package/assets/{useResultFolderIndex-TGbz0SlB.js → useResultFolderIndex-DBl3mV9T.js} +1 -1
- package/assets/{useSearchTokenContext-zqAAXPsY.js → useSearchTokenContext-D5JEnGSM.js} +1 -1
- package/assets/{useSemanticSearch-qS8Gn92L.js → useSemanticSearch-B-Yc7Fw6.js} +1 -1
- package/assets/{useSignature-C3rVCKG4.js → useSignature-CTFhZvTT.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/_calendarObjectId-Bmc_s_sr.js +0 -1
- package/assets/_mailboxId-LSeKi85I.js +0 -1
- package/assets/_messageId-BMSeWS8P.js +0 -1
- package/assets/_messageId-Ct6MMT0b.js +0 -1
- package/assets/_messageId-u3ABuOi3.js +0 -1
- package/assets/_outboxMessageId-B6NVBE7b.js +0 -1
- package/assets/_recurrenceId-Dj0eDAxP.js +0 -1
- package/assets/_threadId-C5kC04mC.js +0 -1
- package/assets/_threadId-fXGqYP5s.js +0 -1
- package/assets/_threadId-mgs0lP2k.js +0 -1
- package/assets/brief-D0osiLTl.js +0 -1
- package/assets/chevron-left-DI6K9zJp.js +0 -1
- package/assets/compose._-_outboxMessageId_-BdT6ygHe.js +0 -1
- package/assets/compose._-_outboxMessageId_-Cq6zz8v3.js +0 -1
- package/assets/compose._-_outboxMessageId_-_2ByIPQK.js +0 -1
- package/assets/compose._-_outboxMessageId_-oaTJ2rX6.js +0 -1
- package/assets/flagged-BMef2m0l.js +0 -1
- package/assets/index-7v0uUHbC.js +0 -1
- package/assets/index-BQG7ael2.js +0 -1
- package/assets/index-B_WyUga3.js +0 -1
- package/assets/index-Ct6MMT0b.js +0 -1
- package/assets/index-DFmlJXLM.js +0 -1
- package/assets/index-DIKznAHS.js +0 -1
- package/assets/index-DhdKuAuL.js +0 -1
- package/assets/index-jhrsG6JV.js +0 -1
- package/assets/index-u3ABuOi3.js +0 -1
- package/assets/minus-ChPZzeni.js +0 -1
- package/assets/onboarding-42_ADK4v.js +0 -1
- package/assets/outbox-D1l0fp9B.js +0 -1
- package/assets/settings-pKUQkaCM.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r,L as Et,W as Ot,eP as $e,eQ as ne,e2 as re,r as a,c as Ye,C as ie,bq as Ft,cU as At,K as Nt,dU as Bt,eR as Lt,eS as qt,a0 as Ve,el as Pt,eT as Dt,ak as _t,d4 as Qt,d5 as zt}from"./index-CwWM67NV.js";import{g as Je,e as Wt,f as Ze,u as Ht,p as Ut,R as Kt}from"./useSearchTokenContext-zqAAXPsY.js";import{a8 as Gt,z as $t,B as Yt,ak as Vt,al as Jt,am as Zt,an as _e,ao as Xt,ap as es,a7 as ts,aq as ss,ar as os,as as ns,af as rs,M as as,at as is,ag as cs,au as ls,av as ds,d as us,o as fs,ai as ms,l as hs,S as gs,I as ps,N as Qe,L as xs,J as Is,b as ys,X as vs,Y as Ie,Z as bs,$ as Xe,a0 as et,a1 as Ss,a2 as Ts,a3 as Cs}from"./MailListHeader-B16BkNe9.js";import{u as ws,a as Rs,R as Ms,b as js,c as ks}from"./useRefreshControl-yGPoq9tM.js";import{u as ae}from"./useQueries-CJO85Tgo.js";import{t as tt,s as Es,u as Os,r as Fs,L as As}from"./useSemanticSearch-qS8Gn92L.js";import{a as Ns}from"./useLabels-B83QXWey.js";import{u as Bs}from"./useLayoutTier-Cy2CvC24.js";import{d as Ls,w as qs}from"./wizard-selection-zWa1qc6-.js";import{m as Ps,e as Ds,f as _s}from"./search-token-index-B30iFwVb.js";import{u as st}from"./sections-BA0vGpLD.js";import{R as Qs}from"./refresh-cw-T_cDgxoQ.js";import{a as zs}from"./useMessageBodyContent-BjLhGd0E.js";function Ws({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(Et,{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:Hs(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(Ot,{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 Hs({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 ot=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],nt="category",Us={unclassified:"uncategorized"},H=e=>Wt(e).map(t=>t.raw),W=e=>e.join(" "),ye=e=>{const t=Ze(e);if(t)return ot.find(s=>s.name===t.name&&s.value===t.value.toLowerCase())?.id},ve=e=>{const t=Ze(e);if(!t||t.name!==nt)return;const s=t.value.toLowerCase(),n=Us[s];if(n)return n;if(!(!$e(s)||s==="all"))return s},rt=e=>ot.find(t=>t.id===e),at=e=>rt(e)!==void 0,Ks=e=>{const t=new Set;for(const s of H(e)){const n=ye(s);n&&t.add(n)}return t},Gs=e=>{let t="all";for(const s of H(e)){const n=ve(s);n&&(t=n)}return t},$s=(e,t)=>{const s=rt(t);if(!s)return;const n=H(e),i=n.filter(d=>ye(d)!==t);return i.length<n.length?W(i):W([...n,Je(s.name,s.value)])},Ys=(e,t)=>{const s=H(e).filter(n=>!ve(n));return W(t==="all"?s:[...s,Je(nt,t)])},Vs=e=>W(H(e).filter(t=>!ye(t)&&!ve(t))),it=e=>e.trim().length>0,ze=e=>{if(!it(e.query))return e.ownFilters;const t=new Set(Ks(e.query));for(const s of e.ownFilters)at(s)||t.add(s);return t},We=e=>it(e.query)?Gs(e.query):e.ownCategory,He=6e4,Js=3e4,Zs={kind:"unknown"},Ue=e=>(t,s)=>Gt(s?.queryKey,e)?t:void 0,Xs=(e,t,s)=>({...e,category:[t],limit:s,order:"desc"}),eo=(e,t)=>({...e,category:[t],order:"desc",count:!0,results:!1}),Ke=(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}:{},...e.accountId!==void 0?{accountId:e.accountId}:{},...e.muted!==void 0?{muted:e.muted}:{}});function to({categories:e,criteria:t,limit:s,counted:n}){const i=ae({queries:e.map(c=>{const h=Xs(t,c,s),f=Ke(t,c);return{queryKey:re({query:h}),queryFn:async()=>{const{data:v}=await ne({query:h,throwOnError:!0});return v},placeholderData:Ue(f),staleTime:He}})}),d=ae({queries:e.map(c=>{const h=eo(t,c),f=Ke(t,c);return{queryKey:re({query:h}),queryFn:async()=>{const{data:v}=await ne({query:h,throwOnError:!0});return v},enabled:n,placeholderData:Ue(f),staleTime:He}})}),m=a.useMemo(()=>e.map((c,h)=>{const f=i[h],v=d[h],p=f?.data?.items??[];return{category:c,rows:p,atCap:p.length>=s,total:n?tt(v?.data?.count):Zs,loading:f?.isPending??!0,failed:f?.isError??!1,retry:()=>{f?.refetch(),n&&v?.refetch()}}}),[e,i,d,n,s]),l=a.useCallback(()=>{for(const c of i)c.refetch();for(const c of d)c.refetch()},[i,d]);return{sections:m,isLoading:i.length>0&&i.every(c=>c.isPending),isError:i.length>0&&i.every(c=>c.isError),refetch:l}}function so(e,t,s){const n={...e,limit:t,order:"desc"},{data:i,isLoading:d,isError:m,refetch:l}=Ye({queryKey:re({query:n}),queryFn:async()=>{const{data:h}=await ne({query:n,throwOnError:!0});return h},enabled:s,staleTime:Js});return{rows:a.useMemo(()=>s?i?.items??[]:[],[i,s]),isLoading:s&&d,isError:s&&m,refetch:a.useCallback(()=>{l()},[l])}}const oo=3e4,no={kind:"unknown"},ro=(e,t)=>({...e,mailboxId:t,order:"desc",count:!0,results:!1});function ao({criteria:e,junkMailboxIds:t,enabled:s}){const n=ae({queries:t.map(i=>{const d=ro(e,i);return{queryKey:re({query:d}),queryFn:async()=>{const{data:m}=await ne({query:d,throwOnError:!0});return m},enabled:s,staleTime:oo}})});return a.useMemo(()=>t.map((i,d)=>({mailboxId:i,count:s?tt(n[d]?.data?.count):no,failed:s?n[d]?.isError??!1:!1})),[t,n,s])}const io=(e,t)=>e.createdAt!==t.createdAt?e.createdAt-t.createdAt:e.accountId.localeCompare(t.accountId),co=e=>[...e].sort(io),lo=["from","subject","category","unread","starred","attachments"],ct=["contacts","today"],uo=e=>new Set(ct.filter(t=>e.has(t))),fo=(e,t,s,n)=>{const i=$t({category:e,attributes:t}),{params:d,residual:m}=Yt(s,i,lo),l={...d,...i},c={muted:!1};return l.from!==void 0&&(c.from=l.from),l.subject!==void 0&&(c.subject=l.subject),l.unread!==void 0&&(c.unread=l.unread),l.starred!==void 0&&(c.starred=l.starred),l.attachments!==void 0&&(c.attachments=l.attachments),n!==void 0&&(c.accountId=n),{criteria:c,residual:m}},mo=({residual:e,attributes:t})=>e.length===0&&!ct.some(s=>t.has(s)),se=e=>e.count.kind==="exact"&&e.count.value>0?3:e.pageRows>0?2:e.count.kind==="unknown"?1:0,oe=e=>e.count.kind==="exact"?e.count.value:0,ho=(e,t)=>se(e)!==se(t)?se(e)>se(t):oe(e)!==oe(t)?oe(e)>oe(t):e.pageRows>t.pageRows;function go(e,{pageRowsByMailbox:t}){const s=e.map(f=>({...f,pageRows:t.get(f.mailboxId)??0}));for(const[f,v]of t)v<=0||s.some(p=>p.mailboxId===f)||s.push({mailboxId:f,count:{kind:"unknown"},failed:!1,pageRows:v});const n=s[0];if(!n)return;let i=0,d=!0,m=n;for(const f of s)f.count.kind==="unknown"?d=!1:i+=f.count.value,ho(f,m)&&(m=f);const l=s.some(f=>f.pageRows>0),c=s.some(f=>f.failed);if(i===0&&!l&&(d||!c))return;const h=d&&i===0&&l;return{mailboxId:m.mailboxId,count:d&&!h?{kind:"exact",value:i}:{kind:"unknown"}}}const po=50,xo=200,Io=[],Ge=()=>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))}),yo=({accountEmail:e})=>{const t=st();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(Ve,{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"})]})},vo=(e,t)=>{if(t.size===0)return{};const s=e.filter(d=>t.has(d.id)),n=Fs(s.map(d=>d.accountId));if(n.restriction)return n;const i=new Set;for(const d of s)d.mailboxId&&i.add(d.mailboxId);return i.size>1?{accountId:n.accountId,restriction:"spansFolders",moveDisabledHint:`Move only works within one folder — this selection spans ${i.size} folders`}:{accountId:n.accountId,mailboxId:i.size===1?[...i][0]:void 0}};function bo({header:e,rows:t,wizard:s,children:n}){const{selectedIds:i,selectedCount:d,exitSelection:m,orderedIds:l,allSelected:c,toggleAllLoaded:h}=ds(),f=a.useMemo(()=>vo(t,i),[t,i]),{junkMailboxId:v}=us(f.accountId),{labels:p}=Ns(f.accountId),b=a.useMemo(()=>Array.from(i),[i]),L=a.useMemo(()=>qs(t,i),[t,i]),x=fs(v,f.mailboxId),S=a.useMemo(()=>l.length>0?{checked:c,indeterminate:d>0&&!c,onChange:h}:void 0,[l.length,c,d,h]),A=f.moveDisabledHint?{tone:"warning",text:f.moveDisabledHint}:void 0,T=M=>r.jsx(gs,{title:M.title,navSlot:M.navSlot,titleMeta:M.titleMeta,searchSlot:M.searchSlot,searchField:M.searchField,idleSlot:M.makeFilterSlot,count:d,onCancel:m,onDelete:()=>s.start("delete"),onMove:()=>s.start("move"),onOrganize:()=>s.start("organize"),onJunk:x?()=>s.start("junk"):void 0,onMarkRead:()=>s.start("markRead"),overflowSlot:f.accountId&&f.mailboxId&&d>0&&p.length>0?r.jsx(As,{accountId:f.accountId,mailboxId:f.mailboxId,messageIds:b}):void 0,selectAll:S,notice:A});return r.jsx(ms,{...e,selectionBar:T,paneOverlay:r.jsx(hs,{verb:s.verb,accountId:f.accountId,mailboxId:f.mailboxId,selection:L,selectionRestriction:f.restriction,onFinished:m}),children:n})}function So({accounts:e,selectedMessageId:t,onOpenThread:s,commandsRef:n,onTriageContextChange:i,onDeleteMessages:d}){const{searchQuery:m,searchInput:l,resultFolderIndex:c,onSearchChange:h}=ie(),f=Ht(),v=Ft(),p=Bs(),b=At(),L=Ps(),x=a.useMemo(()=>co(e.filter(o=>!o.muted?.value)),[e]),[S,A]=a.useState("all"),[T,M]=a.useState("all"),[N,q]=a.useState(new Set),[le,j]=a.useState(!1),P=a.useCallback(o=>{q(u=>{const g=new Set(u);return g.has(o)?g.delete(o):g.add(o),g})},[]),U=a.useCallback(()=>q(new Set),[]),E=l.trim().length>0,{freeText:w,tokens:D}=Ut(m.trim().toLowerCase(),f),y=w.length>0,_=a.useMemo(()=>ze({query:l,ownFilters:N}),[l,N]),Q=a.useMemo(()=>We({query:l,ownCategory:T}),[l,T]),F=a.useMemo(()=>ze({query:m,ownFilters:N}),[m,N]),C=a.useMemo(()=>We({query:m,ownCategory:T}),[m,T]),I=a.useCallback(o=>{if(!E||!at(o)){P(o);return}const u=$s(l,o);u!==void 0&&h(u)},[E,l,h,P]),k=a.useCallback(o=>{if(!E){M(o);return}h(Ys(l,o))},[E,l,h]),de=a.useMemo(()=>C==="all"&&!y?o=>{$e(o)&&k(o)}:void 0,[C,y,k]),ue=a.useCallback(()=>{M("all"),A("all"),U(),E&&h(Vs(l))},[E,l,h,U]),K=ae({queries:x.map(o=>({...Nt({path:{accountId:o.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),G=a.useMemo(()=>{const o=new Map;for(let u=0;u<x.length;u++){const g=x[u].accountId,te=(K[u]?.data?.items??[]).reduce((O,kt)=>O+(kt.unseenCount??0),0);o.set(g,te)}return o},[x,K]),ut=a.useMemo(()=>x.filter((o,u)=>{const g=K[u];return g?.isError?!Bt(g.error):!1}),[x,K]),{criteria:fe,residual:$}=a.useMemo(()=>fo(C,F,D,S==="all"?void 0:S),[C,F,D,S]),ft=a.useMemo(()=>C==="all"?[...Vt]:[C],[C]),be=a.useMemo(()=>({...fe,query:w,...C==="all"?{}:{category:[C]}}),[fe,w,C]),Se=mo({residual:$,attributes:F}),{sections:Y,isLoading:mt,isError:ht,refetch:Te}=to({categories:y?Io:ft,criteria:fe,limit:C==="all"?ls:po,counted:Se}),{rows:Ce,isLoading:gt,isError:pt,refetch:we}=so(be,xo,y),me=y?gt:mt,Re=y?pt:ht,Me=a.useCallback(()=>{if(y){we();return}Te()},[y,we,Te]),je=a.useMemo(()=>uo(F),[F]),V=a.useCallback(o=>Ls(o).map(Jt).filter(u=>Lt(u,je)&&Zt(u,$)),[je,$]),J=a.useMemo(()=>Y.map(o=>({category:o.category,total:o.total,atCap:o.atCap,loading:o.loading,failed:o.failed,rows:V(o.rows)})),[Y,V]),Z=a.useMemo(()=>V(Ce),[Ce,V]),xt=a.useCallback(o=>{Y.find(u=>u.category===o)?.retry()},[Y]),R=a.useMemo(()=>y?Z:J.flatMap(o=>o.rows),[y,Z,J]),It=a.useMemo(()=>qt(c),[c]),ke=ao({criteria:be,junkMailboxIds:It,enabled:Se&&Es({hasSearchQuery:y,freeText:w,residualTokenCount:$.length})}),{spamIds:he,briefSpamOffer:X}=a.useMemo(()=>{const o={spamIds:void 0,briefSpamOffer:void 0};if(!w)return o;const u=R.map(O=>_e(O,c)),{spam:g}=Xt(u),B=new Map;for(const O of g)O.mailboxId&&B.set(O.mailboxId,(B.get(O.mailboxId)??0)+1);const te=go(ke,{pageRowsByMailbox:B});return g.length===0&&!te?o:{spamIds:g.length>0?new Set(g.map(O=>O.id)):void 0,briefSpamOffer:te}},[R,w,c,ke]),Ee=a.useMemo(()=>{const o=u=>he===void 0?u:u.filter(g=>!he.has(g.id));return y?[{id:"matches",threads:o(Z)}]:es(J.map(u=>({...u,rows:o(u.rows)})))},[y,Z,J,he]),Oe=a.useCallback((o,u)=>{const g=R.find(B=>B.id===o)?.threadId;g&&s?.({threadId:g,messageId:o},u)},[R,s]),yt=a.useCallback(o=>{const u=o.threadId??R.find(g=>g.id===o.id)?.threadId;u&&s?.({threadId:u,messageId:o.id})},[R,s]),ge=a.useMemo(()=>x.length<=1?[]:[{id:"all",label:"All",active:S==="all"},...x.map(o=>({id:o.accountId,label:o.email.split("@")[0]??o.email,count:G.get(o.accountId),active:S===o.accountId}))],[x,G,S]),z=a.useMemo(()=>e.filter(o=>o.muted?.value).length,[e]),vt=a.useMemo(()=>Array.from(G.values()).reduce((o,u)=>o+u,0),[G]),pe=a.useMemo(()=>x.map(o=>o.accountId),[x]),{hasNewMail:Fe}=ws(),{state:Ae,errorMessage:Ne,refresh:Be}=Rs(pe,{onSettled:()=>Me()}),bt=a.useMemo(()=>r.jsx(Ms,{state:Ae,onRefresh:Be,label:"Refresh daily brief",errorMessage:Ne,hasUpdate:Fe(pe)}),[Ae,Be,Ne,Fe,pe]),xe=a.useMemo(()=>R.map(o=>_e(o,c)),[R,c]),{hits:Le,isLoading:St}=Os(),Tt=a.useMemo(()=>{const o=new Map(R.map(g=>[g.id,g.threadId])),u=xe.map(g=>o.get(g.id)).filter(g=>g!=null);return ts(Le,u,c)},[Le,xe,R,c]),Ct=a.useMemo(()=>{const o=ss(ge.map(u=>({id:u.id,label:u.label,count:u.count,active:u.active})));return{categories:o.categories,filters:o.filters,sources:o.sources,sourcesNote:z>0?`+${z} muted`:void 0,selectedCategory:Q,activeFilters:_,expanded:le,onExpandedChange:j,onSelectCategory:u=>k(u),onSelectSource:A,onToggleFilter:u=>I(u),onClear:ue}},[ge,z,Q,_,le,I,k,ue]),qe=Ee.length===0&&S==="all"&&w.length===0&&D.length===0,wt=a.useMemo(()=>x.map(o=>o.accountId),[x]),Rt=a.useMemo(()=>x.some(o=>js(o.syncPhase)),[x]),ee=ks(wt,qe||Rt),Pe=r.jsxs("div",{className:"h-full overflow-y-auto",children:[r.jsx(Ge,{}),r.jsx(Ge,{})]}),De=!me&&!Re&&!qe,Mt=os({tier:p,hasLiveInput:E,hasCommittedQuery:m.trim().length>0,bodyRendersCommittedResults:!0}),jt=De?r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[X&&r.jsx(ns,{count:X.count,onScopeToSpam:()=>L(X.mailboxId,m)}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(rs,{sections:Ee,briefCategory:Q,Row:as,selectedThreadId:t,onSelectThread:Oe,onShowAllSection:de,onRetrySection:xt,flat:y,onSelectBriefCategory:k,sources:ge,sourcesNote:z>0?`+${z} muted`:void 0,onSelectSource:A,activeFilters:_,onToggleFilter:I,onClearFilters:ue})})]}):me?Pe:Re?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(Ve,{className:"size-8 text-danger"}),r.jsx("p",{children:"Couldn't load your messages"}),r.jsxs("button",{type:"button",onClick:()=>Me(),className:"flex items-center gap-1 text-accent underline text-xs",children:[r.jsx(Qs,{className:"size-3.5"}),"Try again"]})]}):ee.resolved?r.jsx(Ws,{sync:ee.syncing?{synced:ee.synced,total:ee.total}:void 0}):Pe;return r.jsx(Pt,{hasSheet:De&&!Mt,children:r.jsx(is,{selectedMessageId:t,rows:R,onOpen:Oe,onDeleteMessages:d,onSelectionVerb:b.start,commandsRef:n,onTriageContextChange:i,children:r.jsx(bo,{wizard:b,header:{title:"Daily brief",unreadCount:vt,footer:v?r.jsx(cs,{}):void 0,searchFilter:Ct,searchResults:xe,searchLoading:me,relatedResults:Tt,relatedLoading:St,onSelectSearchResult:yt,spamOffer:X,searchResultsInBody:!0,refreshControl:bt},rows:R,children:r.jsxs("div",{className:"flex h-full flex-col",children:[ut.map(o=>r.jsx(yo,{accountEmail:o.email,accountId:o.accountId},o.accountId)),r.jsx("div",{className:"min-h-0 flex-1",children:jt})]})})})})}const lt=a.createContext(null);function ce(){const e=a.useContext(lt);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function To({thread:e,children:t}){const s=Ds(),n=_s(),i=st(),{searchInput:d}=ie(),m=e?.threadId,l=e?.messageId,{data:c}=Ye({...Dt(),staleTime:6e4}),h=a.useMemo(()=>c?.items??[],[c]),f=a.useMemo(()=>{if(m)return h.find(I=>I.messageId===l)??h.find(I=>I.threadId===m)},[h,m,l]),v=ps(m,l),p=f??v,b=l??p?.messageId,L=a.useMemo(()=>{if(m)return{threadId:m,mailboxId:p?.mailboxId??"",subject:p?.subject,messageId:b,authenticity:p?.authenticity}},[m,p,b]),x=a.useCallback((I,k)=>{s(I,{replace:k?.replace,query:d})},[s,d]),S=a.useCallback(I=>{b&&I.includes(b)&&n()},[b,n]),A=Qe({thread:p,isOpen:!0,onAfterOptimisticRemove:S}),T=xs(),{deleteMessages:M}=Is({mailboxId:p?.mailboxId??"",messages:h,onAfterOptimisticRemove:S}),{toggleReadFor:N}=ys({mailboxId:p?.mailboxId??"",messages:h}),q=T.focusedMessageId,j=a.useMemo(()=>h.find(I=>I.messageId===q),[h,q])??p,P=Qe({thread:j,isOpen:j?.messageId===b}),U=zs(),E=_t(),w=Qt(),D=a.useMemo(()=>zt(w,m,b),[w,m,b]),y=a.useMemo(()=>{if(j)return I=>w({threadId:j.threadId,messageId:j.messageId,mode:I})},[w,j]),{nextMessageId:_,previousMessageId:Q}=vs({context:T,orderedIds:T.orderedIds,selectedMessageId:b,enabled:!U&&!E,hasOpenThread:m!==void 0,onClose:n,handlers:{reply:()=>y?.("reply"),replyAll:()=>y?.("reply-all"),forward:()=>y?.("forward"),delete:()=>{T.listCommandsRef.current?.requestVerb("delete")||P.deleteThread()},toggleStar:P.toggleStar,toggleRead:()=>{T.listCommandsRef.current?.requestVerb("markRead")||j&&N([j.messageId],!j.isRead)},goFlagged:()=>i("flagged"),goSettings:()=>i("settings")}}),F=a.useCallback(I=>{if(!I)return;const k=h.find(de=>de.messageId===I);return k?{threadId:k.threadId,messageId:I}:void 0},[h]),C={selectedMessageId:b,selectedThread:p,conversation:L,onOpenThread:x,onCloseThread:n,nextThread:F(_),previousThread:F(Q),actions:A,onReply:D,triage:T,onDeleteMessages:M,handleDeselectIfRemoved:S};return r.jsx(lt.Provider,{value:C,children:t})}function dt(){const{selectedMessageId:e,onOpenThread:t,triage:s,onDeleteMessages:n}=ce(),{accounts:i}=ie();return r.jsx(So,{accounts:i,selectedMessageId:e,onOpenThread:t,commandsRef:s.listCommandsRef,onTriageContextChange:s.onTriageContextChange,onDeleteMessages:n})}function Co(){const e=Ie(),{conversation:t,selectedThread:s,actions:n,onReply:i,handleDeselectIfRemoved:d,onOpenThread:m}=ce(),l=!!t,c=Ts(t?.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(Cs,{hasThread:l,intelligenceOpen:c.isShowing,canToggleIntelligence:c.canToggle,onToggleIntelligence:c.toggle,onReply:i?()=>i("reply"):void 0,onReplyAll:i?()=>i("reply-all"):void 0,onForward:i?()=>i("forward"):void 0,onDelete:l?n.deleteThread:void 0,onToggleStar:l?n.toggleStar:void 0,isStarred:n.isStarred,moveContext:l&&n.accountId&&n.mailboxId?{accountId:n.accountId,currentMailboxId:n.mailboxId,onMove:n.moveThread}:void 0}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:t?r.jsx(Xe,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onOpenIntelligence:c.open,listOnScreen:!0}):r.jsx(Kt,{})})]}),r.jsx(et,{isOpen:c.drawerOpen,onClose:c.closeDrawer,thread:s,mailboxId:s?.mailboxId,accountId:s?.accountId,onAfterOptimisticRemove:d,onReplyWithText:e,onOpenThread:m})]})}function wo(){const e=Ie(),{selectedThread:t,handleDeselectIfRemoved:s,onOpenThread:n}=ce(),{onToggleIntelligence:i}=ie();return r.jsx(Ss,{onClose:i,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:s,onReplyWithText:e,onOpenThread:n})}function Ro(){const e=Ie(),{selectedThread:t,conversation:s,onOpenThread:n,onCloseThread:i,nextThread:d,previousThread:m,handleDeselectIfRemoved:l}=ce(),c=bs(s?.threadId??null);return s?r.jsxs(r.Fragment,{children:[r.jsx(Xe,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,authenticity:s.authenticity,onBack:i,onOpenIntelligence:c.toggle,onSwipeNext:d?()=>n(d):void 0,onSwipePrevious:m?()=>n(m):void 0,mobileIntelligenceOpen:c.isOpen}),r.jsx(et,{isOpen:c.isOpen,onClose:c.close,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:l,onReplyWithText:e,onOpenThread:n})]}):r.jsx("div",{className:"h-full",children:r.jsx(dt,{})})}const _o=Object.assign(To,{List:dt,Reading:Co,Intelligence:wo,Phone:Ro});export{_o as B};
|
|
1
|
+
import{j as r,L as Et,W as Ot,eP as $e,eQ as ne,e2 as re,r as a,c as Ye,C as ie,bq as Ft,cU as At,K as Nt,dU as Bt,eR as Lt,eS as qt,a0 as Ve,el as Pt,eT as Dt,ak as _t,d4 as Qt,d5 as zt}from"./index-sX1xY_ye.js";import{g as Je,e as Wt,f as Ze,u as Ht,p as Ut,R as Kt}from"./useSearchTokenContext-D5JEnGSM.js";import{a8 as Gt,z as $t,B as Yt,ak as Vt,al as Jt,am as Zt,an as _e,ao as Xt,ap as es,a7 as ts,aq as ss,ar as os,as as ns,af as rs,M as as,at as is,ag as cs,au as ls,av as ds,d as us,o as fs,ai as ms,l as hs,S as gs,I as ps,N as Qe,L as xs,J as Is,b as ys,X as vs,Y as Ie,Z as bs,$ as Xe,a0 as et,a1 as Ss,a2 as Ts,a3 as Cs}from"./MailListHeader-U5Wr2TGm.js";import{u as ws,a as Rs,R as Ms,b as js,c as ks}from"./useRefreshControl-H0TU9ViP.js";import{u as ae}from"./useQueries-Yk6rRJaD.js";import{t as tt,s as Es,u as Os,r as Fs,L as As}from"./useSemanticSearch-B-Yc7Fw6.js";import{a as Ns}from"./useLabels-D-8squEI.js";import{u as Bs}from"./useLayoutTier-CmvG4PY1.js";import{d as Ls,w as qs}from"./wizard-selection-zWa1qc6-.js";import{m as Ps,e as Ds,f as _s}from"./search-token-index-zzFp1OWm.js";import{u as st}from"./sections-CNH_hutr.js";import{R as Qs}from"./refresh-cw-5WZnJ3vE.js";import{a as zs}from"./useMessageBodyContent-hPuofJUT.js";function Ws({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(Et,{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:Hs(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(Ot,{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 Hs({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 ot=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],nt="category",Us={unclassified:"uncategorized"},H=e=>Wt(e).map(t=>t.raw),W=e=>e.join(" "),ye=e=>{const t=Ze(e);if(t)return ot.find(s=>s.name===t.name&&s.value===t.value.toLowerCase())?.id},ve=e=>{const t=Ze(e);if(!t||t.name!==nt)return;const s=t.value.toLowerCase(),n=Us[s];if(n)return n;if(!(!$e(s)||s==="all"))return s},rt=e=>ot.find(t=>t.id===e),at=e=>rt(e)!==void 0,Ks=e=>{const t=new Set;for(const s of H(e)){const n=ye(s);n&&t.add(n)}return t},Gs=e=>{let t="all";for(const s of H(e)){const n=ve(s);n&&(t=n)}return t},$s=(e,t)=>{const s=rt(t);if(!s)return;const n=H(e),i=n.filter(d=>ye(d)!==t);return i.length<n.length?W(i):W([...n,Je(s.name,s.value)])},Ys=(e,t)=>{const s=H(e).filter(n=>!ve(n));return W(t==="all"?s:[...s,Je(nt,t)])},Vs=e=>W(H(e).filter(t=>!ye(t)&&!ve(t))),it=e=>e.trim().length>0,ze=e=>{if(!it(e.query))return e.ownFilters;const t=new Set(Ks(e.query));for(const s of e.ownFilters)at(s)||t.add(s);return t},We=e=>it(e.query)?Gs(e.query):e.ownCategory,He=6e4,Js=3e4,Zs={kind:"unknown"},Ue=e=>(t,s)=>Gt(s?.queryKey,e)?t:void 0,Xs=(e,t,s)=>({...e,category:[t],limit:s,order:"desc"}),eo=(e,t)=>({...e,category:[t],order:"desc",count:!0,results:!1}),Ke=(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}:{},...e.accountId!==void 0?{accountId:e.accountId}:{},...e.muted!==void 0?{muted:e.muted}:{}});function to({categories:e,criteria:t,limit:s,counted:n}){const i=ae({queries:e.map(c=>{const h=Xs(t,c,s),f=Ke(t,c);return{queryKey:re({query:h}),queryFn:async()=>{const{data:v}=await ne({query:h,throwOnError:!0});return v},placeholderData:Ue(f),staleTime:He}})}),d=ae({queries:e.map(c=>{const h=eo(t,c),f=Ke(t,c);return{queryKey:re({query:h}),queryFn:async()=>{const{data:v}=await ne({query:h,throwOnError:!0});return v},enabled:n,placeholderData:Ue(f),staleTime:He}})}),m=a.useMemo(()=>e.map((c,h)=>{const f=i[h],v=d[h],p=f?.data?.items??[];return{category:c,rows:p,atCap:p.length>=s,total:n?tt(v?.data?.count):Zs,loading:f?.isPending??!0,failed:f?.isError??!1,retry:()=>{f?.refetch(),n&&v?.refetch()}}}),[e,i,d,n,s]),l=a.useCallback(()=>{for(const c of i)c.refetch();for(const c of d)c.refetch()},[i,d]);return{sections:m,isLoading:i.length>0&&i.every(c=>c.isPending),isError:i.length>0&&i.every(c=>c.isError),refetch:l}}function so(e,t,s){const n={...e,limit:t,order:"desc"},{data:i,isLoading:d,isError:m,refetch:l}=Ye({queryKey:re({query:n}),queryFn:async()=>{const{data:h}=await ne({query:n,throwOnError:!0});return h},enabled:s,staleTime:Js});return{rows:a.useMemo(()=>s?i?.items??[]:[],[i,s]),isLoading:s&&d,isError:s&&m,refetch:a.useCallback(()=>{l()},[l])}}const oo=3e4,no={kind:"unknown"},ro=(e,t)=>({...e,mailboxId:t,order:"desc",count:!0,results:!1});function ao({criteria:e,junkMailboxIds:t,enabled:s}){const n=ae({queries:t.map(i=>{const d=ro(e,i);return{queryKey:re({query:d}),queryFn:async()=>{const{data:m}=await ne({query:d,throwOnError:!0});return m},enabled:s,staleTime:oo}})});return a.useMemo(()=>t.map((i,d)=>({mailboxId:i,count:s?tt(n[d]?.data?.count):no,failed:s?n[d]?.isError??!1:!1})),[t,n,s])}const io=(e,t)=>e.createdAt!==t.createdAt?e.createdAt-t.createdAt:e.accountId.localeCompare(t.accountId),co=e=>[...e].sort(io),lo=["from","subject","category","unread","starred","attachments"],ct=["contacts","today"],uo=e=>new Set(ct.filter(t=>e.has(t))),fo=(e,t,s,n)=>{const i=$t({category:e,attributes:t}),{params:d,residual:m}=Yt(s,i,lo),l={...d,...i},c={muted:!1};return l.from!==void 0&&(c.from=l.from),l.subject!==void 0&&(c.subject=l.subject),l.unread!==void 0&&(c.unread=l.unread),l.starred!==void 0&&(c.starred=l.starred),l.attachments!==void 0&&(c.attachments=l.attachments),n!==void 0&&(c.accountId=n),{criteria:c,residual:m}},mo=({residual:e,attributes:t})=>e.length===0&&!ct.some(s=>t.has(s)),se=e=>e.count.kind==="exact"&&e.count.value>0?3:e.pageRows>0?2:e.count.kind==="unknown"?1:0,oe=e=>e.count.kind==="exact"?e.count.value:0,ho=(e,t)=>se(e)!==se(t)?se(e)>se(t):oe(e)!==oe(t)?oe(e)>oe(t):e.pageRows>t.pageRows;function go(e,{pageRowsByMailbox:t}){const s=e.map(f=>({...f,pageRows:t.get(f.mailboxId)??0}));for(const[f,v]of t)v<=0||s.some(p=>p.mailboxId===f)||s.push({mailboxId:f,count:{kind:"unknown"},failed:!1,pageRows:v});const n=s[0];if(!n)return;let i=0,d=!0,m=n;for(const f of s)f.count.kind==="unknown"?d=!1:i+=f.count.value,ho(f,m)&&(m=f);const l=s.some(f=>f.pageRows>0),c=s.some(f=>f.failed);if(i===0&&!l&&(d||!c))return;const h=d&&i===0&&l;return{mailboxId:m.mailboxId,count:d&&!h?{kind:"exact",value:i}:{kind:"unknown"}}}const po=50,xo=200,Io=[],Ge=()=>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))}),yo=({accountEmail:e})=>{const t=st();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(Ve,{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"})]})},vo=(e,t)=>{if(t.size===0)return{};const s=e.filter(d=>t.has(d.id)),n=Fs(s.map(d=>d.accountId));if(n.restriction)return n;const i=new Set;for(const d of s)d.mailboxId&&i.add(d.mailboxId);return i.size>1?{accountId:n.accountId,restriction:"spansFolders",moveDisabledHint:`Move only works within one folder — this selection spans ${i.size} folders`}:{accountId:n.accountId,mailboxId:i.size===1?[...i][0]:void 0}};function bo({header:e,rows:t,wizard:s,children:n}){const{selectedIds:i,selectedCount:d,exitSelection:m,orderedIds:l,allSelected:c,toggleAllLoaded:h}=ds(),f=a.useMemo(()=>vo(t,i),[t,i]),{junkMailboxId:v}=us(f.accountId),{labels:p}=Ns(f.accountId),b=a.useMemo(()=>Array.from(i),[i]),L=a.useMemo(()=>qs(t,i),[t,i]),x=fs(v,f.mailboxId),S=a.useMemo(()=>l.length>0?{checked:c,indeterminate:d>0&&!c,onChange:h}:void 0,[l.length,c,d,h]),A=f.moveDisabledHint?{tone:"warning",text:f.moveDisabledHint}:void 0,T=M=>r.jsx(gs,{title:M.title,navSlot:M.navSlot,titleMeta:M.titleMeta,searchSlot:M.searchSlot,searchField:M.searchField,idleSlot:M.makeFilterSlot,count:d,onCancel:m,onDelete:()=>s.start("delete"),onMove:()=>s.start("move"),onOrganize:()=>s.start("organize"),onJunk:x?()=>s.start("junk"):void 0,onMarkRead:()=>s.start("markRead"),overflowSlot:f.accountId&&f.mailboxId&&d>0&&p.length>0?r.jsx(As,{accountId:f.accountId,mailboxId:f.mailboxId,messageIds:b}):void 0,selectAll:S,notice:A});return r.jsx(ms,{...e,selectionBar:T,paneOverlay:r.jsx(hs,{verb:s.verb,accountId:f.accountId,mailboxId:f.mailboxId,selection:L,selectionRestriction:f.restriction,onFinished:m}),children:n})}function So({accounts:e,selectedMessageId:t,onOpenThread:s,commandsRef:n,onTriageContextChange:i,onDeleteMessages:d}){const{searchQuery:m,searchInput:l,resultFolderIndex:c,onSearchChange:h}=ie(),f=Ht(),v=Ft(),p=Bs(),b=At(),L=Ps(),x=a.useMemo(()=>co(e.filter(o=>!o.muted?.value)),[e]),[S,A]=a.useState("all"),[T,M]=a.useState("all"),[N,q]=a.useState(new Set),[le,j]=a.useState(!1),P=a.useCallback(o=>{q(u=>{const g=new Set(u);return g.has(o)?g.delete(o):g.add(o),g})},[]),U=a.useCallback(()=>q(new Set),[]),E=l.trim().length>0,{freeText:w,tokens:D}=Ut(m.trim().toLowerCase(),f),y=w.length>0,_=a.useMemo(()=>ze({query:l,ownFilters:N}),[l,N]),Q=a.useMemo(()=>We({query:l,ownCategory:T}),[l,T]),F=a.useMemo(()=>ze({query:m,ownFilters:N}),[m,N]),C=a.useMemo(()=>We({query:m,ownCategory:T}),[m,T]),I=a.useCallback(o=>{if(!E||!at(o)){P(o);return}const u=$s(l,o);u!==void 0&&h(u)},[E,l,h,P]),k=a.useCallback(o=>{if(!E){M(o);return}h(Ys(l,o))},[E,l,h]),de=a.useMemo(()=>C==="all"&&!y?o=>{$e(o)&&k(o)}:void 0,[C,y,k]),ue=a.useCallback(()=>{M("all"),A("all"),U(),E&&h(Vs(l))},[E,l,h,U]),K=ae({queries:x.map(o=>({...Nt({path:{accountId:o.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),G=a.useMemo(()=>{const o=new Map;for(let u=0;u<x.length;u++){const g=x[u].accountId,te=(K[u]?.data?.items??[]).reduce((O,kt)=>O+(kt.unseenCount??0),0);o.set(g,te)}return o},[x,K]),ut=a.useMemo(()=>x.filter((o,u)=>{const g=K[u];return g?.isError?!Bt(g.error):!1}),[x,K]),{criteria:fe,residual:$}=a.useMemo(()=>fo(C,F,D,S==="all"?void 0:S),[C,F,D,S]),ft=a.useMemo(()=>C==="all"?[...Vt]:[C],[C]),be=a.useMemo(()=>({...fe,query:w,...C==="all"?{}:{category:[C]}}),[fe,w,C]),Se=mo({residual:$,attributes:F}),{sections:Y,isLoading:mt,isError:ht,refetch:Te}=to({categories:y?Io:ft,criteria:fe,limit:C==="all"?ls:po,counted:Se}),{rows:Ce,isLoading:gt,isError:pt,refetch:we}=so(be,xo,y),me=y?gt:mt,Re=y?pt:ht,Me=a.useCallback(()=>{if(y){we();return}Te()},[y,we,Te]),je=a.useMemo(()=>uo(F),[F]),V=a.useCallback(o=>Ls(o).map(Jt).filter(u=>Lt(u,je)&&Zt(u,$)),[je,$]),J=a.useMemo(()=>Y.map(o=>({category:o.category,total:o.total,atCap:o.atCap,loading:o.loading,failed:o.failed,rows:V(o.rows)})),[Y,V]),Z=a.useMemo(()=>V(Ce),[Ce,V]),xt=a.useCallback(o=>{Y.find(u=>u.category===o)?.retry()},[Y]),R=a.useMemo(()=>y?Z:J.flatMap(o=>o.rows),[y,Z,J]),It=a.useMemo(()=>qt(c),[c]),ke=ao({criteria:be,junkMailboxIds:It,enabled:Se&&Es({hasSearchQuery:y,freeText:w,residualTokenCount:$.length})}),{spamIds:he,briefSpamOffer:X}=a.useMemo(()=>{const o={spamIds:void 0,briefSpamOffer:void 0};if(!w)return o;const u=R.map(O=>_e(O,c)),{spam:g}=Xt(u),B=new Map;for(const O of g)O.mailboxId&&B.set(O.mailboxId,(B.get(O.mailboxId)??0)+1);const te=go(ke,{pageRowsByMailbox:B});return g.length===0&&!te?o:{spamIds:g.length>0?new Set(g.map(O=>O.id)):void 0,briefSpamOffer:te}},[R,w,c,ke]),Ee=a.useMemo(()=>{const o=u=>he===void 0?u:u.filter(g=>!he.has(g.id));return y?[{id:"matches",threads:o(Z)}]:es(J.map(u=>({...u,rows:o(u.rows)})))},[y,Z,J,he]),Oe=a.useCallback((o,u)=>{const g=R.find(B=>B.id===o)?.threadId;g&&s?.({threadId:g,messageId:o},u)},[R,s]),yt=a.useCallback(o=>{const u=o.threadId??R.find(g=>g.id===o.id)?.threadId;u&&s?.({threadId:u,messageId:o.id})},[R,s]),ge=a.useMemo(()=>x.length<=1?[]:[{id:"all",label:"All",active:S==="all"},...x.map(o=>({id:o.accountId,label:o.email.split("@")[0]??o.email,count:G.get(o.accountId),active:S===o.accountId}))],[x,G,S]),z=a.useMemo(()=>e.filter(o=>o.muted?.value).length,[e]),vt=a.useMemo(()=>Array.from(G.values()).reduce((o,u)=>o+u,0),[G]),pe=a.useMemo(()=>x.map(o=>o.accountId),[x]),{hasNewMail:Fe}=ws(),{state:Ae,errorMessage:Ne,refresh:Be}=Rs(pe,{onSettled:()=>Me()}),bt=a.useMemo(()=>r.jsx(Ms,{state:Ae,onRefresh:Be,label:"Refresh daily brief",errorMessage:Ne,hasUpdate:Fe(pe)}),[Ae,Be,Ne,Fe,pe]),xe=a.useMemo(()=>R.map(o=>_e(o,c)),[R,c]),{hits:Le,isLoading:St}=Os(),Tt=a.useMemo(()=>{const o=new Map(R.map(g=>[g.id,g.threadId])),u=xe.map(g=>o.get(g.id)).filter(g=>g!=null);return ts(Le,u,c)},[Le,xe,R,c]),Ct=a.useMemo(()=>{const o=ss(ge.map(u=>({id:u.id,label:u.label,count:u.count,active:u.active})));return{categories:o.categories,filters:o.filters,sources:o.sources,sourcesNote:z>0?`+${z} muted`:void 0,selectedCategory:Q,activeFilters:_,expanded:le,onExpandedChange:j,onSelectCategory:u=>k(u),onSelectSource:A,onToggleFilter:u=>I(u),onClear:ue}},[ge,z,Q,_,le,I,k,ue]),qe=Ee.length===0&&S==="all"&&w.length===0&&D.length===0,wt=a.useMemo(()=>x.map(o=>o.accountId),[x]),Rt=a.useMemo(()=>x.some(o=>js(o.syncPhase)),[x]),ee=ks(wt,qe||Rt),Pe=r.jsxs("div",{className:"h-full overflow-y-auto",children:[r.jsx(Ge,{}),r.jsx(Ge,{})]}),De=!me&&!Re&&!qe,Mt=os({tier:p,hasLiveInput:E,hasCommittedQuery:m.trim().length>0,bodyRendersCommittedResults:!0}),jt=De?r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[X&&r.jsx(ns,{count:X.count,onScopeToSpam:()=>L(X.mailboxId,m)}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(rs,{sections:Ee,briefCategory:Q,Row:as,selectedThreadId:t,onSelectThread:Oe,onShowAllSection:de,onRetrySection:xt,flat:y,onSelectBriefCategory:k,sources:ge,sourcesNote:z>0?`+${z} muted`:void 0,onSelectSource:A,activeFilters:_,onToggleFilter:I,onClearFilters:ue})})]}):me?Pe:Re?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(Ve,{className:"size-8 text-danger"}),r.jsx("p",{children:"Couldn't load your messages"}),r.jsxs("button",{type:"button",onClick:()=>Me(),className:"flex items-center gap-1 text-accent underline text-xs",children:[r.jsx(Qs,{className:"size-3.5"}),"Try again"]})]}):ee.resolved?r.jsx(Ws,{sync:ee.syncing?{synced:ee.synced,total:ee.total}:void 0}):Pe;return r.jsx(Pt,{hasSheet:De&&!Mt,children:r.jsx(is,{selectedMessageId:t,rows:R,onOpen:Oe,onDeleteMessages:d,onSelectionVerb:b.start,commandsRef:n,onTriageContextChange:i,children:r.jsx(bo,{wizard:b,header:{title:"Daily brief",unreadCount:vt,footer:v?r.jsx(cs,{}):void 0,searchFilter:Ct,searchResults:xe,searchLoading:me,relatedResults:Tt,relatedLoading:St,onSelectSearchResult:yt,spamOffer:X,searchResultsInBody:!0,refreshControl:bt},rows:R,children:r.jsxs("div",{className:"flex h-full flex-col",children:[ut.map(o=>r.jsx(yo,{accountEmail:o.email,accountId:o.accountId},o.accountId)),r.jsx("div",{className:"min-h-0 flex-1",children:jt})]})})})})}const lt=a.createContext(null);function ce(){const e=a.useContext(lt);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function To({thread:e,children:t}){const s=Ds(),n=_s(),i=st(),{searchInput:d}=ie(),m=e?.threadId,l=e?.messageId,{data:c}=Ye({...Dt(),staleTime:6e4}),h=a.useMemo(()=>c?.items??[],[c]),f=a.useMemo(()=>{if(m)return h.find(I=>I.messageId===l)??h.find(I=>I.threadId===m)},[h,m,l]),v=ps(m,l),p=f??v,b=l??p?.messageId,L=a.useMemo(()=>{if(m)return{threadId:m,mailboxId:p?.mailboxId??"",subject:p?.subject,messageId:b,authenticity:p?.authenticity}},[m,p,b]),x=a.useCallback((I,k)=>{s(I,{replace:k?.replace,query:d})},[s,d]),S=a.useCallback(I=>{b&&I.includes(b)&&n()},[b,n]),A=Qe({thread:p,isOpen:!0,onAfterOptimisticRemove:S}),T=xs(),{deleteMessages:M}=Is({mailboxId:p?.mailboxId??"",messages:h,onAfterOptimisticRemove:S}),{toggleReadFor:N}=ys({mailboxId:p?.mailboxId??"",messages:h}),q=T.focusedMessageId,j=a.useMemo(()=>h.find(I=>I.messageId===q),[h,q])??p,P=Qe({thread:j,isOpen:j?.messageId===b}),U=zs(),E=_t(),w=Qt(),D=a.useMemo(()=>zt(w,m,b),[w,m,b]),y=a.useMemo(()=>{if(j)return I=>w({threadId:j.threadId,messageId:j.messageId,mode:I})},[w,j]),{nextMessageId:_,previousMessageId:Q}=vs({context:T,orderedIds:T.orderedIds,selectedMessageId:b,enabled:!U&&!E,hasOpenThread:m!==void 0,onClose:n,handlers:{reply:()=>y?.("reply"),replyAll:()=>y?.("reply-all"),forward:()=>y?.("forward"),delete:()=>{T.listCommandsRef.current?.requestVerb("delete")||P.deleteThread()},toggleStar:P.toggleStar,toggleRead:()=>{T.listCommandsRef.current?.requestVerb("markRead")||j&&N([j.messageId],!j.isRead)},goFlagged:()=>i("flagged"),goSettings:()=>i("settings")}}),F=a.useCallback(I=>{if(!I)return;const k=h.find(de=>de.messageId===I);return k?{threadId:k.threadId,messageId:I}:void 0},[h]),C={selectedMessageId:b,selectedThread:p,conversation:L,onOpenThread:x,onCloseThread:n,nextThread:F(_),previousThread:F(Q),actions:A,onReply:D,triage:T,onDeleteMessages:M,handleDeselectIfRemoved:S};return r.jsx(lt.Provider,{value:C,children:t})}function dt(){const{selectedMessageId:e,onOpenThread:t,triage:s,onDeleteMessages:n}=ce(),{accounts:i}=ie();return r.jsx(So,{accounts:i,selectedMessageId:e,onOpenThread:t,commandsRef:s.listCommandsRef,onTriageContextChange:s.onTriageContextChange,onDeleteMessages:n})}function Co(){const e=Ie(),{conversation:t,selectedThread:s,actions:n,onReply:i,handleDeselectIfRemoved:d,onOpenThread:m}=ce(),l=!!t,c=Ts(t?.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(Cs,{hasThread:l,intelligenceOpen:c.isShowing,canToggleIntelligence:c.canToggle,onToggleIntelligence:c.toggle,onReply:i?()=>i("reply"):void 0,onReplyAll:i?()=>i("reply-all"):void 0,onForward:i?()=>i("forward"):void 0,onDelete:l?n.deleteThread:void 0,onToggleStar:l?n.toggleStar:void 0,isStarred:n.isStarred,moveContext:l&&n.accountId&&n.mailboxId?{accountId:n.accountId,currentMailboxId:n.mailboxId,onMove:n.moveThread}:void 0}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:t?r.jsx(Xe,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onOpenIntelligence:c.open,listOnScreen:!0}):r.jsx(Kt,{})})]}),r.jsx(et,{isOpen:c.drawerOpen,onClose:c.closeDrawer,thread:s,mailboxId:s?.mailboxId,accountId:s?.accountId,onAfterOptimisticRemove:d,onReplyWithText:e,onOpenThread:m})]})}function wo(){const e=Ie(),{selectedThread:t,handleDeselectIfRemoved:s,onOpenThread:n}=ce(),{onToggleIntelligence:i}=ie();return r.jsx(Ss,{onClose:i,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:s,onReplyWithText:e,onOpenThread:n})}function Ro(){const e=Ie(),{selectedThread:t,conversation:s,onOpenThread:n,onCloseThread:i,nextThread:d,previousThread:m,handleDeselectIfRemoved:l}=ce(),c=bs(s?.threadId??null);return s?r.jsxs(r.Fragment,{children:[r.jsx(Xe,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,authenticity:s.authenticity,onBack:i,onOpenIntelligence:c.toggle,onSwipeNext:d?()=>n(d):void 0,onSwipePrevious:m?()=>n(m):void 0,mobileIntelligenceOpen:c.isOpen}),r.jsx(et,{isOpen:c.isOpen,onClose:c.close,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:l,onReplyWithText:e,onOpenThread:n})]}):r.jsx("div",{className:"h-full",children:r.jsx(dt,{})})}const _o=Object.assign(To,{List:dt,Reading:Co,Intelligence:wo,Phone:Ro});export{_o as B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as n,f as C,t as m,_ as X,$ as ee,az as N,r as w,ay as te,X as ne,ar as se,a0 as ae}from"./index-CwWM67NV.js";import{R as _,k as $,J as ie,c as re,K as oe,x as le,L as ce,G as de}from"./calendar-format-CkNnvhu8.js";import{e as ue,g as j,h as me,u as he,b as U,d as xe,i as pe,t as ye,U as ve}from"./useCalendars-Drw3pPJl.js";import{C as ge}from"./calendar-clash-strip-QFFUz8UQ.js";const De=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Ne=["January","February","March","April","May","June","July","August","September","October","November","December"],Te=["first","second","third","fourth","last"],k="";function fe(e,t){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return[];const[s,a,r]=e.split("-").map(Number),o=new Date(Date.UTC(s,a-1,r)),i=De[o.getUTCDay()],c=Te[Math.min(Math.floor((r-1)/7),4)],l=t===""?"":`, ${t}`,d=o.getUTCDay()>=1&&o.getUTCDay()<=5;return[`Every day${l}`,...d?[`Every weekday${l}`]:[],`Every week on ${i}${l}`,`Every month on the ${c} ${i}${l}`,`Every year on ${r} ${Ne[a-1]}${l}`]}const be="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",p=({draft:e,onChange:t},s,a)=>t({...e,[s]:a});function D({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 je({draft:e,onChange:t,layout:s="compact",touch:a}){const r=s==="pane";return n.jsx(N,{value:e.title,placeholder:"Title","aria-label":"Title",onChange:o=>p({draft:e,onChange:t},"title",o.target.value),className:m(r?"text-lg font-medium":"text-md font-medium",r?"h-11":a?"min-h-11":"")})}function P(e){return e.date===""||e.endDate===""?!1:e.allDay?e.endDate<e.date:e.startTime===""||e.endTime===""?!1:`${e.endDate}T${e.endTime}`<`${e.date}T${e.startTime}`}function Ee(e,t){return t===""?{...e,date:t}:e.endDate===""?{...e,date:t,endDate:t}:e.date===""?{...e,date:t}:{...e,date:t,endDate:$(t,ie(e.date,e.endDate))}}function Ce(e,t){const s=e.date!==""&&e.endDate===$(e.date,1)&&e.startTime!==""&&e.endTime!==""&&e.endTime<e.startTime;return t&&s?{...e,allDay:t,endDate:e.date}:!t&&e.date!==""&&e.endDate===e.date&&e.startTime!==""&&e.endTime!==""&&e.endTime<e.startTime?{...e,allDay:t,endDate:$(e.date,1)}:{...e,allDay:t}}function $e({draft:e,onChange:t,touch:s}){const a=s?"min-h-11":"",r=P(e),o=w.useId(),i={"aria-invalid":r,"aria-describedby":r?o:void 0},c=m("w-40",a,r&&"border-danger/60"),l=m("w-28",a,r&&"border-danger/60");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(N,{type:"date",value:e.date,"aria-label":"Date",...i,onChange:d=>t(Ee(e,d.target.value)),className:c}),!e.allDay&&n.jsx(N,{type:"time",value:e.startTime,"aria-label":"Start time",...i,onChange:d=>p({draft:e,onChange:t},"startTime",d.target.value),className:l}),n.jsx("span",{className:"text-sm text-fg-subtle",children:"to"}),n.jsx(N,{type:"date",value:e.endDate,"aria-label":"End date",min:e.date===""?void 0:e.date,...i,onChange:d=>p({draft:e,onChange:t},"endDate",d.target.value),className:c}),!e.allDay&&n.jsx(N,{type:"time",value:e.endTime,"aria-label":"End time",...i,onChange:d=>p({draft:e,onChange:t},"endTime",d.target.value),className:l}),n.jsxs("label",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[n.jsx("input",{type:"checkbox",checked:e.allDay,onChange:d=>t(Ce(e,d.target.checked)),className:"size-4 accent-current"}),"All day"]})]}),r&&n.jsx("p",{id:o,className:"text-xs text-danger",role:"alert",children:e.allDay?`Ends before it starts. Move the end to ${e.date} or later.`:`Ends before it starts. Move the end past ${e.date} ${e.startTime}, or start earlier.`})]})}function ke({draft:e,onChange:t,calendars:s,touch:a}){return n.jsx(Fe,{calendars:s,value:e.calendarId,onChange:r=>p({draft:e,onChange:t},"calendarId",r),touch:a})}function we({draft:e,onChange:t,touch:s,repeatEditable:a=!0,onCustom:r}){return a?n.jsx(Re,{value:e.repeat,date:e.date,startTime:e.startTime,onChange:o=>p({draft:e,onChange:t},"repeat",o),onCustom:r,className:s?"min-h-11":""}):n.jsxs("p",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[n.jsx(_,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.repeat===k?"Does not repeat":e.repeat]})}function Ye({draft:e,onChange:t,touch:s}){return n.jsx(N,{value:e.location,placeholder:"Location","aria-label":"Location",onChange:a=>p({draft:e,onChange:t},"location",a.target.value),className:s?"min-h-11":""})}function Ae({draft:e,onChange:t,touch:s}){return n.jsx(N,{value:e.guests,placeholder:"Guests, comma separated","aria-label":"Guests",onChange:a=>p({draft:e,onChange:t},"guests",a.target.value),className:s?"min-h-11":""})}function Oe({draft:e,onChange:t,layout:s="compact"}){return n.jsx("textarea",{value:e.notes,placeholder:"Notes","aria-label":"Notes",onChange:a=>p({draft:e,onChange:t},"notes",a.target.value),rows:s==="pane"?6:3,className:be})}function Me({draft:e,onChange:t,calendars:s,layout:a="compact",expanded:r=!1,onToggleExpanded:o,onSave:i,onCancel:c,onDelete:l,saveLabel:d="Add",header:h,repeatEditable:u=!0,guestsEditable:x=!1,calendarEditable:y=!0,onCustomRepeat:b,touch:v,className:A}){const f=a==="pane",g={draft:e,onChange:t,layout:a,touch:v},O=n.jsx(je,{...g}),M=n.jsx($e,{...g}),R=n.jsx(ke,{...g,calendars:s}),F=n.jsx(we,{...g,repeatEditable:u,onCustom:b}),S=n.jsx(Ye,{...g}),I=n.jsx(Ae,{...g}),L=n.jsx(Oe,{...g}),B=n.jsxs("div",{className:m("flex items-center gap-2",f?"pt-2":"pt-1"),children:[n.jsx(C,{variant:"primary",size:v||f?"md":"sm",onClick:i,disabled:P(e),className:v?"min-h-11 flex-1":"",children:d}),n.jsx(C,{variant:"ghost",size:v||f?"md":"sm",onClick:c,className:v?"min-h-11":"",children:"Cancel"}),l&&n.jsx(C,{variant:"ghost",size:v||f?"md":"sm",onClick:l,className:m("ml-auto text-danger",v&&"min-h-11"),children:"Delete"})]});if(f)return n.jsxs("div",{className:m("flex flex-col gap-5",A),children:[h,n.jsx(D,{label:"Title",children:O}),n.jsx(D,{label:"When",children:M}),y&&n.jsx(D,{label:"Calendar",children:R}),n.jsx(D,{label:"Repeat",children:F}),n.jsx(D,{label:"Location",children:S}),x&&n.jsx(D,{label:"Guests",children:I}),n.jsx(D,{label:"Notes",children:L}),B]});const q=o!==void 0&&!r;return n.jsxs("div",{className:m("flex flex-col gap-3",A),children:[h,O,M,y&&R,o&&n.jsxs("button",{type:"button",onClick:o,"aria-expanded":r,className:m("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",v&&"min-h-11"),children:[r?n.jsx(X,{className:"size-3.5"}):n.jsx(ee,{className:"size-3.5"}),r?"Fewer details":"More details"]}),!q&&n.jsxs("div",{className:"flex flex-col gap-2 border-t border-line pt-3",children:[S,x&&I,F,L]}),B]})}const W="__custom__";function Re({value:e,date:t,startTime:s,onChange:a,onCustom:r,className:o}){const i=fe(t,s),c=e===k||i.includes(e)?i:[e,...i];return n.jsxs(te,{icon:n.jsx(_,{className:"size-4"}),"aria-label":"Repeat",value:e,onChange:l=>{if(l.target.value===W){r?.();return}a(l.target.value)},className:o,children:[n.jsx("option",{value:k,children:"Does not repeat"}),c.map(l=>n.jsx("option",{value:l,children:l},l)),r&&n.jsx("option",{value:W,children:"Custom…"})]})}function Fe({calendars:e,value:t,onChange:s,touch:a}){const r=w.useId();return n.jsxs("fieldset",{className:"flex flex-wrap gap-1.5",children:[n.jsx("legend",{className:"sr-only",children:"Calendar"}),e.map(o=>{const i=re(o.color),c=o.id===t;return n.jsxs("label",{className:m("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",a?"min-h-11":"h-7",c?m(i.soft,i.text,i.border):"border-line text-fg-muted hover:bg-surface-sunken"),children:[n.jsx("input",{type:"radio",name:r,value:o.id,checked:c,onChange:()=>s(o.id),className:"sr-only"}),n.jsx("span",{className:m("size-2 rounded-full",i.solid)}),o.name]},o.id)})]})}function Se({title:e,subtitle:t,onClose:s,children:a,className:r}){return n.jsxs("section",{className:m("flex h-full w-full flex-col bg-surface",r),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:s,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(ne,{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:a})})]})}const E=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],T=["SU","MO","TU","WE","TH","FR","SA"],z=["January","February","March","April","May","June","July","August","September","October","November","December"],Z=["first","second","third","fourth","last"],Y=[1,2,3,4,-1],J="MO,TU,WE,TH,FR",Ie=e=>e.replace(/,\s*\d{2}:\d{2}$/,"").trim();function K(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 s=t.match(/^Every week on (\w+)$/);if(s){const o=E.indexOf(s[1]);return o===-1?void 0:`FREQ=WEEKLY;BYDAY=${T[o]}`}const a=t.match(/^Every month on the (\w+) (\w+)$/);if(a){const o=Z.indexOf(a[1]),i=E.indexOf(a[2]);return o===-1||i===-1?void 0:`FREQ=MONTHLY;BYDAY=${Y[o]}${T[i]}`}const r=t.match(/^Every year on (\d{1,2}) (\w+)$/);if(r){const o=z.indexOf(r[2]);return o===-1?void 0:`FREQ=YEARLY;BYMONTH=${o+1};BYMONTHDAY=${Number(r[1])}`}}const Le=e=>e===""?"":`, ${e}`;function Ze(e,t){const s=new Map(e.split(";").map(i=>i.split("=")).filter(i=>i.length===2).map(([i,c])=>[i.toUpperCase(),c.toUpperCase()])),a=Le(t),r=s.get("FREQ"),o=s.get("BYDAY");if(!(s.has("INTERVAL")&&s.get("INTERVAL")!=="1")&&!(s.has("UNTIL")||s.has("COUNT"))){if(r==="DAILY")return`Every day${a}`;if(r==="WEEKLY"){if(o===void 0)return;if(o===J)return`Every weekday${a}`;const i=T.indexOf(o);return i===-1?void 0:`Every week on ${E[i]}${a}`}if(r==="MONTHLY"){const i=o?.match(/^(-?\d)([A-Z]{2})$/);if(!i)return;const c=Y.indexOf(Number(i[1])),l=T.indexOf(i[2]);return c===-1||l===-1?void 0:`Every month on the ${Z[c]} ${E[l]}${a}`}if(r==="YEARLY"){const i=Number(s.get("BYMONTH")),c=Number(s.get("BYMONTHDAY"));return!i||!c||i>12?void 0:`Every year on ${c} ${z[i-1]}${a}`}}}const H=e=>Date.parse(`${e}T00:00:00Z`)/864e5;function Be(e,t,s){const a=H(s)-H(t);if(e===""||a===0||Number.isNaN(a))return e;const[r,o,i]=s.split("-").map(Number),c=new Date(Date.UTC(r,o-1,i)).getUTCDay(),l=/FREQ=(\w+)/i.exec(e)?.[1]?.toUpperCase();return e.split(";").map(d=>{const[h,u=""]=d.split("="),x=h.toUpperCase();return x==="BYDAY"&&l==="MONTHLY"?`BYDAY=${Y[Math.min(Math.floor((i-1)/7),4)]}${T[c]}`:x==="BYDAY"?`BYDAY=${u.split(",").map(y=>{const b=T.indexOf(y.toUpperCase());return b===-1?y:T[(b+a+7)%7]}).join(",")}`:x==="BYMONTH"?`BYMONTH=${o}`:x==="BYMONTHDAY"?`BYMONTHDAY=${i}`:d}).join(";")}function Je(e,t){return{title:"",date:e,startTime:"09:00",endDate:e,endTime:"10:00",allDay:!1,calendarId:t,location:"",guests:"",notes:"",repeat:""}}function Ke(e,t){return{title:e.title,date:e.start.slice(0,10),startTime:e.allDay?"":e.start.slice(11,16),endDate:oe(e),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:ue(e.endDate,1)}:{start:j(e.date,e.startTime,t),end:j(e.endDate,e.endTime,t)}}function G(e,t,s){const a=K(e.repeat)??"",r=e.allDay?e.date:me(t,s.anchor===""?"UTC":s.anchor).slice(0,10);return Be(a,e.date,r)}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.endDate===""?"Pick the day the event ends 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.endDate<e.date?"The last day is before the first. Move one of them.":!e.allDay&&`${e.endDate}T${e.endTime}`<=`${e.date}T${e.startTime}`?"The end is not after the start. Move one of them.":t&&K(e.repeat)===void 0?"This calendar can't store that repeat rule. Pick one of the offered rules, or turn the repeat off.":""}function Qe(e,t){const s=V(e,!0);if(s!=="")return{ok:!1,problem:s};const{start:a,end:r}=Q(e,t.clock);return{ok:!0,input:{calendarId:e.calendarId,summary:e.title.trim(),description:e.notes,location:e.location,start:a,end:r,allDay:e.allDay,...t.anchor===""?{}:{timeZone:t.anchor},recurrenceRule:G(e,a,t)}}}function Ge(e,t,s){const a=t.repeat!==e.repeat,o=t.allDay!==e.allDay||t.date!==e.date||t.startTime!==e.startTime,i=o||t.endDate!==e.endDate||t.endTime!==e.endTime,c=V(t,a);if(c!=="")return{ok:!1,problem:c};const l={};t.title.trim()!==e.title.trim()&&(l.summary=t.title.trim()),t.location!==e.location&&(l.location=t.location),t.notes!==e.notes&&(l.description=t.notes);const{start:d,end:h}=Q(t,s.clock);return o&&(l.start=d),i&&(l.end=h,l.allDay=t.allDay,s.anchor!==""&&(l.timeZone=s.anchor)),a&&(l.recurrenceRule=G(t,d,s)),{ok:!0,patch:l}}const Ue=[],We={from:"",to:""};function Ve(e,t=""){const{timeZoneByCalendarId:s}=he(),a=e.date!==""&&!e.allDay&&e.endDate!==""&&e.startTime!==""&&e.endTime!==""&&`${e.endDate}T${e.endTime}`>`${e.date}T${e.startTime}`,{instances:r,isLoading:o,error:i}=le({...a?{from:U("week",e.date).from,to:U("week",e.endDate).to}:We,calendarIds:Ue,enabled:a}),c=xe();return w.useMemo(()=>{if(!a||o||i)return;const l=j(e.date,e.startTime,c),d=j(e.endDate,e.endTime,c),h=r.filter(u=>pe(u)&&u.calendarObjectId!==t).map(u=>ye(u,s[u.calendarId]??ve,c));return ce({start:l,end:d},h).map(u=>({id:u.id,label:`${u.title}, ${de(u)}`}))},[a,o,i,e.date,e.endDate,e.startTime,e.endTime,c,r,t,s])}function qe({title:e,subtitle:t,notice:s="",calendars:a,draft:r,onChange:o,problem:i,saveLabel:c,isSaving:l,repeatEditable:d=!0,calendarEditable:h=!0,clashes:u,onSave:x,onCancel:y}){return n.jsx(Se,{title:e,subtitle:t,onClose:y,children:n.jsx(Me,{draft:r,onChange:o,calendars:a,layout:"pane",repeatEditable:d,calendarEditable:h,saveLabel:l?"Saving…":c,onSave:x,onCancel:y,header:i===""&&s===""&&u===void 0?void 0:n.jsxs("div",{className:"space-y-2",children:[s!==""&&n.jsxs("p",{className:"flex items-start gap-2 rounded-md border border-warning/40 bg-warning-soft px-3 py-2 text-sm text-fg",children:[n.jsx(se,{className:"mt-0.5 size-4 shrink-0 text-warning","aria-hidden":"true"}),n.jsx("span",{className:"min-w-0 flex-1 break-words",children:s})]}),i!==""&&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(ae,{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:i})]}),u!==void 0&&n.jsx(ge,{clashes:u,clearText:"Nothing else is booked at this time."})]})})})}export{qe as C,Se as E,Q as a,Qe as c,Ke as d,Je as e,Be as m,Ge as p,Ze as t,Ve as u};
|
|
1
|
+
import{j as n,f as C,t as m,_ as X,$ as ee,az as N,r as w,ay as te,X as ne,ar as se,a0 as ae}from"./index-sX1xY_ye.js";import{R as _,k as $,J as ie,c as re,K as oe,x as le,L as ce,G as de}from"./calendar-format-DeXXPgld.js";import{e as ue,g as j,h as me,u as he,b as U,d as xe,i as pe,t as ye,U as ve}from"./useCalendars-Q4eHkTES.js";import{C as ge}from"./calendar-clash-strip-Bm-MYQet.js";const De=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Ne=["January","February","March","April","May","June","July","August","September","October","November","December"],Te=["first","second","third","fourth","last"],k="";function fe(e,t){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return[];const[s,a,r]=e.split("-").map(Number),o=new Date(Date.UTC(s,a-1,r)),i=De[o.getUTCDay()],c=Te[Math.min(Math.floor((r-1)/7),4)],l=t===""?"":`, ${t}`,d=o.getUTCDay()>=1&&o.getUTCDay()<=5;return[`Every day${l}`,...d?[`Every weekday${l}`]:[],`Every week on ${i}${l}`,`Every month on the ${c} ${i}${l}`,`Every year on ${r} ${Ne[a-1]}${l}`]}const be="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",p=({draft:e,onChange:t},s,a)=>t({...e,[s]:a});function D({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 je({draft:e,onChange:t,layout:s="compact",touch:a}){const r=s==="pane";return n.jsx(N,{value:e.title,placeholder:"Title","aria-label":"Title",onChange:o=>p({draft:e,onChange:t},"title",o.target.value),className:m(r?"text-lg font-medium":"text-md font-medium",r?"h-11":a?"min-h-11":"")})}function P(e){return e.date===""||e.endDate===""?!1:e.allDay?e.endDate<e.date:e.startTime===""||e.endTime===""?!1:`${e.endDate}T${e.endTime}`<`${e.date}T${e.startTime}`}function Ee(e,t){return t===""?{...e,date:t}:e.endDate===""?{...e,date:t,endDate:t}:e.date===""?{...e,date:t}:{...e,date:t,endDate:$(t,ie(e.date,e.endDate))}}function Ce(e,t){const s=e.date!==""&&e.endDate===$(e.date,1)&&e.startTime!==""&&e.endTime!==""&&e.endTime<e.startTime;return t&&s?{...e,allDay:t,endDate:e.date}:!t&&e.date!==""&&e.endDate===e.date&&e.startTime!==""&&e.endTime!==""&&e.endTime<e.startTime?{...e,allDay:t,endDate:$(e.date,1)}:{...e,allDay:t}}function $e({draft:e,onChange:t,touch:s}){const a=s?"min-h-11":"",r=P(e),o=w.useId(),i={"aria-invalid":r,"aria-describedby":r?o:void 0},c=m("w-40",a,r&&"border-danger/60"),l=m("w-28",a,r&&"border-danger/60");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(N,{type:"date",value:e.date,"aria-label":"Date",...i,onChange:d=>t(Ee(e,d.target.value)),className:c}),!e.allDay&&n.jsx(N,{type:"time",value:e.startTime,"aria-label":"Start time",...i,onChange:d=>p({draft:e,onChange:t},"startTime",d.target.value),className:l}),n.jsx("span",{className:"text-sm text-fg-subtle",children:"to"}),n.jsx(N,{type:"date",value:e.endDate,"aria-label":"End date",min:e.date===""?void 0:e.date,...i,onChange:d=>p({draft:e,onChange:t},"endDate",d.target.value),className:c}),!e.allDay&&n.jsx(N,{type:"time",value:e.endTime,"aria-label":"End time",...i,onChange:d=>p({draft:e,onChange:t},"endTime",d.target.value),className:l}),n.jsxs("label",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[n.jsx("input",{type:"checkbox",checked:e.allDay,onChange:d=>t(Ce(e,d.target.checked)),className:"size-4 accent-current"}),"All day"]})]}),r&&n.jsx("p",{id:o,className:"text-xs text-danger",role:"alert",children:e.allDay?`Ends before it starts. Move the end to ${e.date} or later.`:`Ends before it starts. Move the end past ${e.date} ${e.startTime}, or start earlier.`})]})}function ke({draft:e,onChange:t,calendars:s,touch:a}){return n.jsx(Fe,{calendars:s,value:e.calendarId,onChange:r=>p({draft:e,onChange:t},"calendarId",r),touch:a})}function we({draft:e,onChange:t,touch:s,repeatEditable:a=!0,onCustom:r}){return a?n.jsx(Re,{value:e.repeat,date:e.date,startTime:e.startTime,onChange:o=>p({draft:e,onChange:t},"repeat",o),onCustom:r,className:s?"min-h-11":""}):n.jsxs("p",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[n.jsx(_,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.repeat===k?"Does not repeat":e.repeat]})}function Ye({draft:e,onChange:t,touch:s}){return n.jsx(N,{value:e.location,placeholder:"Location","aria-label":"Location",onChange:a=>p({draft:e,onChange:t},"location",a.target.value),className:s?"min-h-11":""})}function Ae({draft:e,onChange:t,touch:s}){return n.jsx(N,{value:e.guests,placeholder:"Guests, comma separated","aria-label":"Guests",onChange:a=>p({draft:e,onChange:t},"guests",a.target.value),className:s?"min-h-11":""})}function Oe({draft:e,onChange:t,layout:s="compact"}){return n.jsx("textarea",{value:e.notes,placeholder:"Notes","aria-label":"Notes",onChange:a=>p({draft:e,onChange:t},"notes",a.target.value),rows:s==="pane"?6:3,className:be})}function Me({draft:e,onChange:t,calendars:s,layout:a="compact",expanded:r=!1,onToggleExpanded:o,onSave:i,onCancel:c,onDelete:l,saveLabel:d="Add",header:h,repeatEditable:u=!0,guestsEditable:x=!1,calendarEditable:y=!0,onCustomRepeat:b,touch:v,className:A}){const f=a==="pane",g={draft:e,onChange:t,layout:a,touch:v},O=n.jsx(je,{...g}),M=n.jsx($e,{...g}),R=n.jsx(ke,{...g,calendars:s}),F=n.jsx(we,{...g,repeatEditable:u,onCustom:b}),S=n.jsx(Ye,{...g}),I=n.jsx(Ae,{...g}),L=n.jsx(Oe,{...g}),B=n.jsxs("div",{className:m("flex items-center gap-2",f?"pt-2":"pt-1"),children:[n.jsx(C,{variant:"primary",size:v||f?"md":"sm",onClick:i,disabled:P(e),className:v?"min-h-11 flex-1":"",children:d}),n.jsx(C,{variant:"ghost",size:v||f?"md":"sm",onClick:c,className:v?"min-h-11":"",children:"Cancel"}),l&&n.jsx(C,{variant:"ghost",size:v||f?"md":"sm",onClick:l,className:m("ml-auto text-danger",v&&"min-h-11"),children:"Delete"})]});if(f)return n.jsxs("div",{className:m("flex flex-col gap-5",A),children:[h,n.jsx(D,{label:"Title",children:O}),n.jsx(D,{label:"When",children:M}),y&&n.jsx(D,{label:"Calendar",children:R}),n.jsx(D,{label:"Repeat",children:F}),n.jsx(D,{label:"Location",children:S}),x&&n.jsx(D,{label:"Guests",children:I}),n.jsx(D,{label:"Notes",children:L}),B]});const q=o!==void 0&&!r;return n.jsxs("div",{className:m("flex flex-col gap-3",A),children:[h,O,M,y&&R,o&&n.jsxs("button",{type:"button",onClick:o,"aria-expanded":r,className:m("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",v&&"min-h-11"),children:[r?n.jsx(X,{className:"size-3.5"}):n.jsx(ee,{className:"size-3.5"}),r?"Fewer details":"More details"]}),!q&&n.jsxs("div",{className:"flex flex-col gap-2 border-t border-line pt-3",children:[S,x&&I,F,L]}),B]})}const W="__custom__";function Re({value:e,date:t,startTime:s,onChange:a,onCustom:r,className:o}){const i=fe(t,s),c=e===k||i.includes(e)?i:[e,...i];return n.jsxs(te,{icon:n.jsx(_,{className:"size-4"}),"aria-label":"Repeat",value:e,onChange:l=>{if(l.target.value===W){r?.();return}a(l.target.value)},className:o,children:[n.jsx("option",{value:k,children:"Does not repeat"}),c.map(l=>n.jsx("option",{value:l,children:l},l)),r&&n.jsx("option",{value:W,children:"Custom…"})]})}function Fe({calendars:e,value:t,onChange:s,touch:a}){const r=w.useId();return n.jsxs("fieldset",{className:"flex flex-wrap gap-1.5",children:[n.jsx("legend",{className:"sr-only",children:"Calendar"}),e.map(o=>{const i=re(o.color),c=o.id===t;return n.jsxs("label",{className:m("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",a?"min-h-11":"h-7",c?m(i.soft,i.text,i.border):"border-line text-fg-muted hover:bg-surface-sunken"),children:[n.jsx("input",{type:"radio",name:r,value:o.id,checked:c,onChange:()=>s(o.id),className:"sr-only"}),n.jsx("span",{className:m("size-2 rounded-full",i.solid)}),o.name]},o.id)})]})}function Se({title:e,subtitle:t,onClose:s,children:a,className:r}){return n.jsxs("section",{className:m("flex h-full w-full flex-col bg-surface",r),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:s,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(ne,{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:a})})]})}const E=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],T=["SU","MO","TU","WE","TH","FR","SA"],z=["January","February","March","April","May","June","July","August","September","October","November","December"],Z=["first","second","third","fourth","last"],Y=[1,2,3,4,-1],J="MO,TU,WE,TH,FR",Ie=e=>e.replace(/,\s*\d{2}:\d{2}$/,"").trim();function K(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 s=t.match(/^Every week on (\w+)$/);if(s){const o=E.indexOf(s[1]);return o===-1?void 0:`FREQ=WEEKLY;BYDAY=${T[o]}`}const a=t.match(/^Every month on the (\w+) (\w+)$/);if(a){const o=Z.indexOf(a[1]),i=E.indexOf(a[2]);return o===-1||i===-1?void 0:`FREQ=MONTHLY;BYDAY=${Y[o]}${T[i]}`}const r=t.match(/^Every year on (\d{1,2}) (\w+)$/);if(r){const o=z.indexOf(r[2]);return o===-1?void 0:`FREQ=YEARLY;BYMONTH=${o+1};BYMONTHDAY=${Number(r[1])}`}}const Le=e=>e===""?"":`, ${e}`;function Ze(e,t){const s=new Map(e.split(";").map(i=>i.split("=")).filter(i=>i.length===2).map(([i,c])=>[i.toUpperCase(),c.toUpperCase()])),a=Le(t),r=s.get("FREQ"),o=s.get("BYDAY");if(!(s.has("INTERVAL")&&s.get("INTERVAL")!=="1")&&!(s.has("UNTIL")||s.has("COUNT"))){if(r==="DAILY")return`Every day${a}`;if(r==="WEEKLY"){if(o===void 0)return;if(o===J)return`Every weekday${a}`;const i=T.indexOf(o);return i===-1?void 0:`Every week on ${E[i]}${a}`}if(r==="MONTHLY"){const i=o?.match(/^(-?\d)([A-Z]{2})$/);if(!i)return;const c=Y.indexOf(Number(i[1])),l=T.indexOf(i[2]);return c===-1||l===-1?void 0:`Every month on the ${Z[c]} ${E[l]}${a}`}if(r==="YEARLY"){const i=Number(s.get("BYMONTH")),c=Number(s.get("BYMONTHDAY"));return!i||!c||i>12?void 0:`Every year on ${c} ${z[i-1]}${a}`}}}const H=e=>Date.parse(`${e}T00:00:00Z`)/864e5;function Be(e,t,s){const a=H(s)-H(t);if(e===""||a===0||Number.isNaN(a))return e;const[r,o,i]=s.split("-").map(Number),c=new Date(Date.UTC(r,o-1,i)).getUTCDay(),l=/FREQ=(\w+)/i.exec(e)?.[1]?.toUpperCase();return e.split(";").map(d=>{const[h,u=""]=d.split("="),x=h.toUpperCase();return x==="BYDAY"&&l==="MONTHLY"?`BYDAY=${Y[Math.min(Math.floor((i-1)/7),4)]}${T[c]}`:x==="BYDAY"?`BYDAY=${u.split(",").map(y=>{const b=T.indexOf(y.toUpperCase());return b===-1?y:T[(b+a+7)%7]}).join(",")}`:x==="BYMONTH"?`BYMONTH=${o}`:x==="BYMONTHDAY"?`BYMONTHDAY=${i}`:d}).join(";")}function Je(e,t){return{title:"",date:e,startTime:"09:00",endDate:e,endTime:"10:00",allDay:!1,calendarId:t,location:"",guests:"",notes:"",repeat:""}}function Ke(e,t){return{title:e.title,date:e.start.slice(0,10),startTime:e.allDay?"":e.start.slice(11,16),endDate:oe(e),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:ue(e.endDate,1)}:{start:j(e.date,e.startTime,t),end:j(e.endDate,e.endTime,t)}}function G(e,t,s){const a=K(e.repeat)??"",r=e.allDay?e.date:me(t,s.anchor===""?"UTC":s.anchor).slice(0,10);return Be(a,e.date,r)}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.endDate===""?"Pick the day the event ends 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.endDate<e.date?"The last day is before the first. Move one of them.":!e.allDay&&`${e.endDate}T${e.endTime}`<=`${e.date}T${e.startTime}`?"The end is not after the start. Move one of them.":t&&K(e.repeat)===void 0?"This calendar can't store that repeat rule. Pick one of the offered rules, or turn the repeat off.":""}function Qe(e,t){const s=V(e,!0);if(s!=="")return{ok:!1,problem:s};const{start:a,end:r}=Q(e,t.clock);return{ok:!0,input:{calendarId:e.calendarId,summary:e.title.trim(),description:e.notes,location:e.location,start:a,end:r,allDay:e.allDay,...t.anchor===""?{}:{timeZone:t.anchor},recurrenceRule:G(e,a,t)}}}function Ge(e,t,s){const a=t.repeat!==e.repeat,o=t.allDay!==e.allDay||t.date!==e.date||t.startTime!==e.startTime,i=o||t.endDate!==e.endDate||t.endTime!==e.endTime,c=V(t,a);if(c!=="")return{ok:!1,problem:c};const l={};t.title.trim()!==e.title.trim()&&(l.summary=t.title.trim()),t.location!==e.location&&(l.location=t.location),t.notes!==e.notes&&(l.description=t.notes);const{start:d,end:h}=Q(t,s.clock);return o&&(l.start=d),i&&(l.end=h,l.allDay=t.allDay,s.anchor!==""&&(l.timeZone=s.anchor)),a&&(l.recurrenceRule=G(t,d,s)),{ok:!0,patch:l}}const Ue=[],We={from:"",to:""};function Ve(e,t=""){const{timeZoneByCalendarId:s}=he(),a=e.date!==""&&!e.allDay&&e.endDate!==""&&e.startTime!==""&&e.endTime!==""&&`${e.endDate}T${e.endTime}`>`${e.date}T${e.startTime}`,{instances:r,isLoading:o,error:i}=le({...a?{from:U("week",e.date).from,to:U("week",e.endDate).to}:We,calendarIds:Ue,enabled:a}),c=xe();return w.useMemo(()=>{if(!a||o||i)return;const l=j(e.date,e.startTime,c),d=j(e.endDate,e.endTime,c),h=r.filter(u=>pe(u)&&u.calendarObjectId!==t).map(u=>ye(u,s[u.calendarId]??ve,c));return ce({start:l,end:d},h).map(u=>({id:u.id,label:`${u.title}, ${de(u)}`}))},[a,o,i,e.date,e.endDate,e.startTime,e.endTime,c,r,t,s])}function qe({title:e,subtitle:t,notice:s="",calendars:a,draft:r,onChange:o,problem:i,saveLabel:c,isSaving:l,repeatEditable:d=!0,calendarEditable:h=!0,clashes:u,onSave:x,onCancel:y}){return n.jsx(Se,{title:e,subtitle:t,onClose:y,children:n.jsx(Me,{draft:r,onChange:o,calendars:a,layout:"pane",repeatEditable:d,calendarEditable:h,saveLabel:l?"Saving…":c,onSave:x,onCancel:y,header:i===""&&s===""&&u===void 0?void 0:n.jsxs("div",{className:"space-y-2",children:[s!==""&&n.jsxs("p",{className:"flex items-start gap-2 rounded-md border border-warning/40 bg-warning-soft px-3 py-2 text-sm text-fg",children:[n.jsx(se,{className:"mt-0.5 size-4 shrink-0 text-warning","aria-hidden":"true"}),n.jsx("span",{className:"min-w-0 flex-1 break-words",children:s})]}),i!==""&&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(ae,{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:i})]}),u!==void 0&&n.jsx(ge,{clashes:u,clearText:"Nothing else is booked at this time."})]})})})}export{qe as C,Se as E,Q as a,Qe as c,Ke as d,Je as e,Be as m,Ge as p,Ze as t,Ve as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,r as e}from"./index-
|
|
1
|
+
import{j as t,r as e}from"./index-sX1xY_ye.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,al as l,am as o}from"./index-
|
|
1
|
+
import{r,j as n,al as l,am as o}from"./index-sX1xY_ye.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-sX1xY_ye.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,a0 as r}from"./index-
|
|
1
|
+
import{j as t,a0 as r}from"./index-sX1xY_ye.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{eQ as J,r as n,e2 as X,c as le,C as z,bq as ce,cU as ue,aH as ge,aI as he,j as r,ak as me,d4 as pe,d5 as fe}from"./index-
|
|
1
|
+
import{eQ as J,r as n,e2 as X,c as le,C as z,bq as ce,cU as ue,aH as ge,aI as he,j as r,ak as me,d4 as pe,d5 as fe}from"./index-sX1xY_ye.js";import{u as xe,p as U,R as Ie}from"./useSearchTokenContext-D5JEnGSM.js";import{z as Te,B as ye,al as be,am as ve,aw as Re,an as Ce,a as Se,M as we,at as je,ax as Fe,av as Me,l as Oe,I as ke,N as _,L as Pe,J as Le,b as Ne,X as Ae,Y as H,Z as De,$ as Y,a0 as Z,a1 as qe,a2 as Ee,a3 as Be}from"./MailListHeader-U5Wr2TGm.js";import{u as We,l as Qe,b as ze,a as He}from"./MailViewChrome-C2SUa5Zc.js";import{f as Ke}from"./ErrorState-BvRoI00P.js";import{d as Ve,w as Ge}from"./wizard-selection-zWa1qc6-.js";import{a as Ue}from"./useMessageBodyContent-hPuofJUT.js";import{e as _e,f as Je}from"./search-token-index-zzFp1OWm.js";import{u as Xe}from"./sections-CNH_hutr.js";const K=t=>({...t,starred:!0,order:"desc"}),Ye=(t={})=>X({query:K(t)});function $(t={}){const{data:e,isLoading:s,isError:a,error:i,refetch:f,fetchNextPage:l,hasNextPage:g,isFetchingNextPage:o}=We({queryKey:Ye(t),queryFn:async({pageParam:x})=>{const{data:u}=await J({query:{...K(t),continuationToken:x},throwOnError:!0});return u},initialPageParam:void 0,getNextPageParam:x=>x.continuationToken,staleTime:6e4});return{threads:n.useMemo(()=>(e?.pages??[]).flatMap(x=>x.items??[]),[e]),isLoading:s,isError:a,error:i,refetch:f,fetchNextPage:l,hasNextPage:g,isFetchingNextPage:o}}function Ze(t={}){const e={...K(t),unread:!0,count:!0,results:!1},{data:s}=le({queryKey:X({query:e}),queryFn:async()=>{const{data:a}=await J({query:e,throwOnError:!0});return a},staleTime:6e4});return s?.count}const $e=["from","subject","category","unread","starred","attachments"],et=(t,e)=>{const s=Te(t),{params:a,residual:i}=ye(e,{...s,starred:!0},$e);return{criteria:{...a,...s},residual:i}};function tt({rows:t,verb:e}){const{selectedIds:s,exitSelection:a}=Me(),i=n.useMemo(()=>Ge(t,s),[t,s]);return r.jsx(Oe,{verb:e,selection:i,selectionRestriction:"spansAccounts",onFinished:a})}function st({selectedMessageId:t,onOpenThread:e,commandsRef:s,onTriageContextChange:a,onDeleteMessages:i}){const{searchQuery:f,resultFolderIndex:l,onSearchClearQuery:g}=z(),o=xe(),k=ce(),x=ue(),[u,h]=n.useState("all"),[b,P]=n.useState(new Set),S=n.useCallback(d=>{P(C=>{const I=new Set(C);return I.has(d)?I.delete(d):I.add(d),I})},[]),w=n.useCallback(()=>{h("all"),P(new Set)},[]),T=n.useCallback(()=>{w(),g()},[w,g]),{freeText:j,tokens:v}=U(f.trim().toLowerCase(),o),L=U(f.trim(),o).freeText,{criteria:N,residual:m}=n.useMemo(()=>et({category:u,attributes:b},v),[u,b,v]),F=n.useMemo(()=>j?{...N,query:j}:N,[N,j]),{threads:A,isLoading:D,isError:y,error:E,refetch:M,fetchNextPage:B,hasNextPage:W,isFetchingNextPage:O}=$(F),p=n.useMemo(()=>Ve(A).map(be).filter(d=>ve(d,m)),[A,m]),c=n.useCallback((d,C)=>{const I=p.find(de=>de.id===d)?.threadId;I&&e?.({threadId:I,messageId:d},C)},[p,e]),R=n.useCallback(d=>{const C=d.threadId??p.find(I=>I.id===d.id)?.threadId;C&&e?.({threadId:C,messageId:d.id})},[p,e]),Q=n.useMemo(()=>Re(),[]),se=n.useMemo(()=>p.map(d=>Ce(d,l)),[p,l]),ae=Ze(F)??null,re=n.useMemo(()=>v.filter(d=>d.type!=="isStarred"),[v]),oe=Qe({chips:{category:u,attributes:b},tokens:re,reach:m.length>0?"loaded-pages":"whole-folder",onClear:T}),V=D?"loading":y?"error":p.length===0?"empty":"ready",ne=n.useCallback(()=>{const d=ge(he());window.open(d,"_blank","noopener,noreferrer")},[]),G=Se(),ie=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:p.map(d=>r.jsx(we,{thread:d,active:d.id===t,onClick:()=>c(d.id)},d.id))}),W?r.jsx("button",{type:"button",className:"w-full py-3 text-sm text-muted hover:text-fg disabled:opacity-50",onClick:()=>B(),disabled:O,children:O?"Loading…":"Load more"}):null]})});return r.jsx(ze,{title:"Starred",unreadCount:ae,preset:Q,selectedCategory:u,activeFilters:b,onSelectCategory:h,onToggleFilter:S,onClearFilters:w,searchResults:se,searchLoading:D,onSelectSearchResult:R,searchResultsInBody:!0,children:r.jsxs(je,{selectedMessageId:t,rows:p,onOpen:c,onDeleteMessages:i,onSelectionVerb:x.start,commandsRef:s,onTriageContextChange:a,children:[r.jsx(He,{listTitle:"Starred",sections:[{id:"flagged",threads:p}],flatList:!0,hideHeader:!0,listState:G.searchResults?"ready":V,listFilter:oe,listScopeLabel:"Starred",searchQuery:L||void 0,errorMessage:y?Ke(E):void 0,onRetry:()=>M(),onReportError:ne,selectedThreadId:t,onSelectThread:c,isDesktop:k,selectionBar:r.jsx(Fe,{title:"Starred"}),listBody:G.searchResults??(V==="ready"?ie:void 0)}),r.jsx(tt,{rows:p,verb:x.verb})]})})}const ee=n.createContext(null);function q(){const t=n.useContext(ee);if(!t)throw new Error("FlaggedPane.* must be used inside <FlaggedPane>");return t}function at({thread:t,children:e}){const s=_e(),a=Je(),i=Xe(),{searchInput:f}=z(),l=t?.threadId,g=t?.messageId,{threads:o}=$(),k=n.useMemo(()=>{if(l)return o.find(c=>c.messageId===g)??o.find(c=>c.threadId===l)},[o,l,g]),x=ke(l,g),u=k??x,h=g??u?.messageId,b=n.useMemo(()=>{if(l)return{threadId:l,mailboxId:u?.mailboxId??"",subject:u?.subject,messageId:h,authenticity:u?.authenticity}},[l,u,h]),P=n.useCallback((c,R)=>{s(c,{replace:R?.replace,query:f})},[s,f]),S=n.useCallback(c=>{h&&c.includes(h)&&a()},[h,a]),w=_({thread:u,isOpen:!0,onAfterOptimisticRemove:S}),T=Pe(),{deleteMessages:j}=Le({mailboxId:u?.mailboxId??"",messages:o,onAfterOptimisticRemove:S}),{toggleReadFor:v}=Ne({mailboxId:u?.mailboxId??"",messages:o}),L=T.focusedMessageId,m=n.useMemo(()=>o.find(c=>c.messageId===L),[o,L])??u,F=_({thread:m,isOpen:m?.messageId===h}),A=Ue(),D=me(),y=pe(),E=n.useMemo(()=>fe(y,l,h),[y,l,h]),M=n.useMemo(()=>{if(m)return c=>y({threadId:m.threadId,messageId:m.messageId,mode:c})},[y,m]),{nextMessageId:B,previousMessageId:W}=Ae({context:T,orderedIds:T.orderedIds,selectedMessageId:h,enabled:!A&&!D,hasOpenThread:l!==void 0,onClose:a,handlers:{reply:()=>M?.("reply"),replyAll:()=>M?.("reply-all"),forward:()=>M?.("forward"),delete:()=>{T.listCommandsRef.current?.requestVerb("delete")||F.deleteThread()},toggleStar:F.toggleStar,toggleRead:()=>{T.listCommandsRef.current?.requestVerb("markRead")||m&&v([m.messageId],!m.isRead)},goBrief:()=>i("brief"),goSettings:()=>i("settings")}}),O=n.useCallback(c=>{if(!c)return;const R=o.find(Q=>Q.messageId===c);return R?{threadId:R.threadId,messageId:c}:void 0},[o]),p={selectedMessageId:h,selectedThread:u,conversation:b,onOpenThread:P,onCloseThread:a,nextThread:O(B),previousThread:O(W),actions:w,onReply:E,triage:T,onDeleteMessages:j,handleDeselectIfRemoved:S};return r.jsx(ee.Provider,{value:p,children:e})}function te(){const{selectedMessageId:t,onOpenThread:e,triage:s,onDeleteMessages:a}=q();return r.jsx(st,{selectedMessageId:t,onOpenThread:e,commandsRef:s.listCommandsRef,onTriageContextChange:s.onTriageContextChange,onDeleteMessages:a})}function rt(){const t=H(),{conversation:e,selectedThread:s,actions:a,onReply:i,handleDeselectIfRemoved:f,onOpenThread:l}=q(),g=!!e,o=Ee(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(Be,{hasThread:g,intelligenceOpen:o.isShowing,canToggleIntelligence:o.canToggle,onToggleIntelligence:o.toggle,onReply:i?()=>i("reply"):void 0,onReplyAll:i?()=>i("reply-all"):void 0,onForward:i?()=>i("forward"):void 0,onDelete:g?a.deleteThread:void 0,onToggleStar:g?a.toggleStar:void 0,isStarred:a.isStarred,moveContext:g&&a.accountId&&a.mailboxId?{accountId:a.accountId,currentMailboxId:a.mailboxId,onMove:a.moveThread}:void 0}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?r.jsx(Y,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:o.open,listOnScreen:!0}):r.jsx(Ie,{})})]}),r.jsx(Z,{isOpen:o.drawerOpen,onClose:o.closeDrawer,thread:s,mailboxId:s?.mailboxId,accountId:s?.accountId,onAfterOptimisticRemove:f,onReplyWithText:t,onOpenThread:l})]})}function ot(){const t=H(),{selectedThread:e,handleDeselectIfRemoved:s,onOpenThread:a}=q(),{onToggleIntelligence:i}=z();return r.jsx(qe,{onClose:i,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:s,onReplyWithText:t,onOpenThread:a})}function nt(){const t=H(),{selectedThread:e,conversation:s,onCloseThread:a,onOpenThread:i,nextThread:f,previousThread:l,handleDeselectIfRemoved:g}=q(),o=De(s?.threadId??null);return s?r.jsxs(r.Fragment,{children:[r.jsx(Y,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,authenticity:s.authenticity,onBack:a,onOpenIntelligence:o.toggle,onSwipeNext:f?()=>i(f):void 0,onSwipePrevious:l?()=>i(l):void 0,mobileIntelligenceOpen:o.isOpen}),r.jsx(Z,{isOpen:o.isOpen,onClose:o.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:g,onReplyWithText:t,onOpenThread:i})]}):r.jsx("div",{className:"h-full",children:r.jsx(te,{})})}const ft=Object.assign(at,{List:te,Reading:rt,Intelligence:ot,Phone:nt});export{ft as F};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,c as f,d as m,G as N,j as e,bq as w,X as E}from"./index-
|
|
1
|
+
import{r as n,c as f,d as m,G as N,j as e,bq as w,X as E}from"./index-sX1xY_ye.js";import{E as u}from"./ErrorState-BvRoI00P.js";import{D as r,C as x,u as k}from"./index-tC8B4Qkq.js";import{d as p,e as h,f as b}from"./useMessageBodyContent-hPuofJUT.js";import{C as S}from"./confirm-dialog-C86T_96x.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})]})},F=()=>{const t=p(),i=h(),s=b(),a=w(),{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(E,{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{F};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{as as Ps,d8 as Hr,r as c,e as ue,j as s,_ as Ke,$ as Fs,L as oa,t as F,a0 as qr,g as Ce,d9 as Qr,da as ia,db as la,dc as Wt,a7 as Wr,f as W,X as Xe,a3 as vt,aB as Gt,Y as Gr,b9 as Vr,d7 as Vt,dd as ca,Z as et,de as Yr,df as Jr,dg as Xr,W as Ze,dh as da,bJ as Ds,di as Zr,bs as eo,dj as to,dk as so,dl as ua,aM as no,dm as ao,B as fa,dn as ro,dp as oo,dq as io,dr as lo,ds as co,dt as uo,w as fo,cH as ma,d4 as pa,c as se,d as tt,K as yt,du as mo,dv as po,dw as Yt,h as me,at as ye,i as ge,E as Re,F as Ee,Q as kt,cy as Me,dx as Jt,dy as pt,aJ as ho,dz as jt,dA as Ae,dB as Ct,dC as wt,dD as Nt,dE as go,dF as xo,dG as cn,cF as bo,s as ha,dH as vo,dI as yo,dJ as ko,b6 as jo,cp as Co,G as Xt,c_ as ga,c$ as wo,dK as No,bq as Os,bt as xa,bn as ba,bu as va,bv as ya,bw as So,dL as Io,ab as ka,cO as To,dM as ht,dN as Ro,aH as Eo,aI as Mo,dO as Ao,bf as ja,dP as Lo,dQ as Ca,dR as $o,H as wa,dS as Po,bR as zs,dT as Fo,cQ as st,dU as dn,dV as Na,bT as Do,dW as ps,dX as Oo,bS as zo,S as _o,q as Uo,ah as Sa,J as Bo,dY as Ko,dZ as Ho,d_ as qo,d3 as un,bD as Qo,d$ as Wo,e0 as Go,av as Vo,cS as Yo,d1 as Jo,e1 as Xo,ai as Zo,d2 as ei,e2 as ti,e3 as si,e4 as ni,e5 as ai,C as St,e6 as ri,e7 as oi,e8 as fn,e9 as ii,ea as li,eb as ci,ec as di,v as Ia,d6 as ui,ed as _s,ee as fi,ef as mi,cq as pi,cn as hi,eg as gi,bU as xi,eh as Ta,cr as bi}from"./index-CwWM67NV.js";import{u as vi,L as yi,a as ki}from"./roving-focus-CaY933ER.js";import{j as ji,S as Ra,f as Ci,a as wi,t as ut,c as Ni,k as Si,l as Ii,m as Ti,u as Ri}from"./search-token-index-B30iFwVb.js";import{K as Ei}from"./kbd-D4cak2_L.js";import{c as Ea,P as Mi,E as Ai}from"./popover-menu-BFjAfpYc.js";import{M as Li}from"./mail-BeRy62_C.js";import{A as gt}from"./avatar-DReNujdD.js";import{M as $i,a as Pi,b as Ma,c as Fi,s as Aa,d as La,e as Di,f as Oi,S as mn,g as $a,u as Pa,p as zi,r as _i}from"./useSearchTokenContext-zqAAXPsY.js";import{P as Zt,f as Ui,C as Bi,D as Ve,s as Ki,a as Hi,e as pn,b as qi,c as Qi,d as Wi,g as hn,i as Gi,u as Vi}from"./index-BMs6sEa1.js";import{E as Fa}from"./EmptyState-C4dAZQdY.js";import{E as Be}from"./ErrorState-C5skYR61.js";import{U as Yi}from"./undo-2-_UReZR98.js";import{D as Ji}from"./download-CupaMHIk.js";import{s as Xi,b as Zi,Z as el,E as tl,C as sl,e as nl,u as al,d as rl}from"./useCalendarFreeBusy-CsesAFnS.js";import{C as ws,m as ol,j as il,n as ll,o as gn,k as xn,p as cl,s as bn,q as dl,v as ul,t as fl,x as ml}from"./calendar-suggestion-B0HwdBJl.js";import{c as pl,t as hl,v as gl,x as xl,y as bl,z as vn}from"./calendar-format-CkNnvhu8.js";import{R as vl}from"./attendee-row-CzLRuZkS.js";import{C as yl}from"./calendar-clash-strip-QFFUz8UQ.js";import{C as Da}from"./clock-Dceh-vYk.js";import{M as kl}from"./map-pin-K36ow_bB.js";import{B as Oa}from"./bell-off-BO2gV0YK.js";import{S as jl,C as za}from"./shield-check-CWzcz6KV.js";import{u as Cl,a as wl,i as Nl,t as Sl,d as Il,r as Tl}from"./useCalendars-Drw3pPJl.js";import{c as Rl}from"./calendar-report-BC1ZSJs6.js";import{u as _a}from"./useDebouncedValue-B9f7KFpF.js";import{j as yn,u as El,a as Ml,k as Al,n as Ll,o as $l,l as Pl,S as Fl}from"./useFilters-CsNg6ABa.js";import{u as Us}from"./useQueries-CJO85Tgo.js";import{C as Dl}from"./checkbox-1ELJWaiG.js";import{C as $t}from"./confirm-dialog-B9rqkVa0.js";import{u as Ol,i as zl}from"./useLayoutTier-Cy2CvC24.js";import{r as _l,a as Ul}from"./search-scope-B5-OK3Cq.js";import{M as Bl}from"./menu-Ii2_MgiT.js";function xt(e){if(Kl())e.focus({preventScroll:!0});else{let t=Hl(e);e.focus(),ql(t)}}let Pt=null;function Kl(){if(Pt==null){Pt=!1;try{document.createElement("div").focus({get preventScroll(){return Pt=!0,!0}})}catch{}}return Pt}function Hl(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 ql(e){for(let{element:t,scrollTop:n,scrollLeft:a}of e)t.scrollTop=n,t.scrollLeft=a}const Ie=e=>e?.ownerDocument??document,Te=e=>e&&"window"in e&&e.window===e?e:Ie(e).defaultView||window;function Ql(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function Wl(e){return Ql(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let Gl=!1;function Ua(){return Gl}function be(e,t){if(!Ua())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:Wl(n)?n=n.host:n=n.parentNode}return!1}function ae(e){if(Ua()&&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 Vl=typeof Element<"u"&&"checkVisibility"in Element.prototype;function Yl(e){const t=Te(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}=Te(e);let{display:i,visibility:l}=o(e);r=i!=="none"&&l!=="hidden"&&l!=="collapse"}return r}function Jl(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 Ba(e,t){return Vl?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):e.nodeName!=="#comment"&&Yl(e)&&Jl(e,t)&&(!e.parentElement||Ba(e.parentElement,e))}const Ka=["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"],Xl=Ka.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";Ka.push('[tabindex]:not([tabindex="-1"]):not([disabled])');function Zl(e,t){return e.matches(Xl)&&!ec(e)&&(t?.skipVisibilityCheck||Ba(e))}function ec(e){let t=e;for(;t!=null;){if(t instanceof Te(t).HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}const Bs=typeof document<"u"?Ps.useLayoutEffect:()=>{};function tc(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function sc(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function nc(e){for(;e&&!Zl(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=Te(e),n=t.document.activeElement;if(!n||n===e)return;let a=!1,r=h=>{(ae(h)===n||a)&&h.stopImmediatePropagation()},o=h=>{(ae(h)===n||a)&&(h.stopImmediatePropagation(),!e&&!a&&(a=!0,xt(n),d()))},i=h=>{(ae(h)===e||a)&&h.stopImmediatePropagation()},l=h=>{(ae(h)===e||a)&&(h.stopImmediatePropagation(),a||(a=!0,xt(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 es(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 Ks(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}function Le(e){let t=null;return()=>(t==null&&(t=e()),t)}const Kt=Le(function(){return Ks(/^Mac/i)}),ac=Le(function(){return Ks(/^iPhone/i)}),Ha=Le(function(){return Ks(/^iPad/i)||Kt()&&navigator.maxTouchPoints>1}),qa=Le(function(){return ac()||Ha()}),rc=Le(function(){return es(/AppleWebKit/i)&&!oc()}),oc=Le(function(){return es(/Chrome/i)}),Qa=Le(function(){return es(/Android/i)}),ic=Le(function(){return es(/Firefox/i)});function lc(e){return e.pointerType===""&&e.isTrusted?!0:Qa()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function cc(e){return!Qa()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"}function bt(e,t,n=!0){let{metaKey:a,ctrlKey:r,altKey:o,shiftKey:i}=t;ic()&&window.event?.type?.startsWith("key")&&e.target==="_blank"&&(Kt()?a=!0:r=!0);let l=rc()&&Kt()&&!Ha()?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});bt.isOpening=n,xt(e),e.dispatchEvent(l),bt.isOpening=!1}bt.isOpening=!1;let Se=new Map,Ns=new Set;function kn(){if(typeof window>"u")return;function e(a){return"propertyName"in a}let t=a=>{let r=ae(a);if(!e(a)||!r)return;let o=Se.get(r);o||(o=new Set,Se.set(r,o),r.addEventListener("transitioncancel",n,{once:!0})),o.add(a.propertyName)},n=a=>{let r=ae(a);if(!e(a)||!r)return;let o=Se.get(r);if(o&&(o.delete(a.propertyName),o.size===0&&(r.removeEventListener("transitioncancel",n),Se.delete(r)),Se.size===0)){for(let i of Ns)i();Ns.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",n)}typeof document<"u"&&(document.readyState!=="loading"?kn():document.addEventListener("DOMContentLoaded",kn));function dc(){for(const[e]of Se)"isConnected"in e&&!e.isConnected&&Se.delete(e)}function uc(e){requestAnimationFrame(()=>{dc(),Se.size===0?e():Ns.add(e)})}function Wa(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}let Ss=new Map;typeof FinalizationRegistry<"u"&&new FinalizationRegistry(e=>{Ss.delete(e)});function fc(e,t){if(e===t)return e;let n=Ss.get(e);if(n)return n.forEach(r=>r.current=t),t;let a=Ss.get(t);return a?(a.forEach(r=>r.current=e),e):t}function mc(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1;const a=e.map(r=>{const o=jn(r,t);return n||=typeof o=="function",o});if(n)return()=>{a.forEach((r,o)=>{typeof r=="function"?r():jn(e[o],null)})}}}function jn(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]=Wa(o,i):(r==="className"||r==="UNSAFE_className")&&typeof o=="string"&&typeof i=="string"?t[r]=Hr(o,i):r==="id"&&o&&i?t.id=fc(o,i):r==="ref"&&o&&i?t.ref=mc(o,i):t[r]=i!==void 0?i:o}}return t}function pc(e,t){Bs(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}const hc=Ps.useInsertionEffect??Bs;function hs(e){const t=c.useRef(null);return hc(()=>{t.current=e},[e]),c.useCallback((...n)=>{const a=t.current;return a?.(...n)},[])}let Ye="default",Is="",Bt=new WeakMap;function gc(e){if(qa()){if(Ye==="default"){const t=Ie(e);Is=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect="none"}Ye="disabled"}else if(e instanceof HTMLElement||e instanceof SVGElement){let t="userSelect"in e.style?"userSelect":"webkitUserSelect";Bt.set(e,e.style[t]),e.style[t]="none"}}function Cn(e){if(qa()){if(Ye!=="disabled")return;Ye="restoring",setTimeout(()=>{uc(()=>{if(Ye==="restoring"){const t=Ie(e);t.documentElement.style.webkitUserSelect==="none"&&(t.documentElement.style.webkitUserSelect=Is||""),Is="",Ye="default"}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&Bt.has(e)){let t=Bt.get(e),n="userSelect"in e.style?"userSelect":"webkitUserSelect";e.style[n]==="none"&&(e.style[n]=t),e.getAttribute("style")===""&&e.removeAttribute("style"),Bt.delete(e)}}function wn(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let gs=new WeakMap;function xc(e){let t=e??(typeof document<"u"?document:void 0);if(!t)return wn(t);if(gs.has(t))return gs.get(t);let n=t.querySelector('meta[property="csp-nonce"]'),a=n&&n instanceof Te(n).HTMLMetaElement&&(n.nonce||n.content)||wn(t)||void 0;return a!==void 0&&gs.set(t,a),a}const Ga=Ps.createContext({register:()=>{}});Ga.displayName="PressResponderContext";function Va(){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 bc(e){let t=c.useContext(Ga);if(t){let{register:n,ref:a,...r}=t;e=It(r,e),n()}return pc(t,e.ref),e}class Ft{#e;constructor(t,n,a,r){this.#e=!0;const i=(r?.target??a.currentTarget)?.getBoundingClientRect();let l,d=0,x,h=null;a.clientX!=null&&a.clientY!=null&&(x=a.clientX,h=a.clientY),i&&(x!=null&&h!=null?(l=x-i.left,d=h-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 Nn=Symbol("linkClicked"),Sn="react-aria-pressable-style",In="data-react-aria-pressable";function vc(e){let{onPress:t,onPressChange:n,onPressStart:a,onPressEnd:r,onPressUp:o,onClick:i,isDisabled:l,isPressed:d,preventFocusOnPress:x,shouldCancelOnPointerExit:h,allowTextSelectionOnPress:y,ref:m,...b}=bc(e),[p,f]=c.useState(!1),u=c.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:v,removeAllGlobalListeners:k}=Va(),g=c.useCallback((C,M)=>{let O=u.current;if(l||O.didFirePressStart)return!1;let w=!0;if(O.isTriggeringEvent=!0,a){let $=new Ft("pressstart",M,C);a($),w=$.shouldStopPropagation}return n&&n(!0),O.isTriggeringEvent=!1,O.didFirePressStart=!0,f(!0),w},[l,a,n]),j=c.useCallback((C,M,O=!0)=>{let w=u.current;if(!w.didFirePressStart)return!1;w.didFirePressStart=!1,w.isTriggeringEvent=!0;let $=!0;if(r){let S=new Ft("pressend",M,C);r(S),$=S.shouldStopPropagation}if(n&&n(!1),f(!1),t&&O&&!l){let S=new Ft("press",M,C);t(S),$&&=S.shouldStopPropagation}return w.isTriggeringEvent=!1,$},[l,r,n,t]),N=hs(j),R=c.useCallback((C,M)=>{let O=u.current;if(l)return!1;if(o){O.isTriggeringEvent=!0;let w=new Ft("pressup",M,C);return o(w),O.isTriggeringEvent=!1,w.shouldStopPropagation}return!0},[l,o]),A=hs(R),T=c.useCallback(C=>{let M=u.current;if(M.isPressed&&M.target){M.didFirePressStart&&M.pointerType!=null&&j(Ue(M.target,C),M.pointerType,!1),M.isPressed=!1,M.isOverTarget=!1,M.activePointerId=null,M.pointerType=null,k(),y||Cn(M.target);for(let O of M.disposables)O();M.disposables=[]}},[y,k,j]),I=hs(T);c.useEffect(()=>{l&&u.current.isPressed&&I({currentTarget:u.current.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})},[l]);let D=c.useCallback(C=>{h&&T(C)},[h,T]),L=c.useCallback(C=>{l||i?.(C)},[l,i]),H=c.useCallback((C,M)=>{if(!l&&i){let O=new MouseEvent("click",C);sc(O,M),i(tc(O))}},[l,i]),z=c.useMemo(()=>{let C=u.current,M={onKeyDown(w){if(xs(w.nativeEvent,w.currentTarget)&&be(w.currentTarget,ae(w))){Tn(ae(w),w.key)&&w.preventDefault();let $=!0;!C.isPressed&&!w.repeat&&(C.target=w.currentTarget,C.isPressed=!0,C.pointerType="keyboard",$=g(w,"keyboard"));let S=w.currentTarget,K=B=>{xs(B,S)&&!B.repeat&&be(S,ae(B))&&C.target&&A(Ue(C.target,B),"keyboard")};v(Ie(w.currentTarget),"keyup",Wa(K,O),!0),$&&w.stopPropagation(),w.metaKey&&Kt()&&C.metaKeyEvents?.set(w.key,w.nativeEvent)}else w.key==="Meta"&&(C.metaKeyEvents=new Map)},onClick(w){if(!(w&&!be(w.currentTarget,ae(w)))&&w&&w.button===0&&!C.isTriggeringEvent&&!bt.isOpening){let $=!0;if(l&&w.preventDefault(),!C.ignoreEmulatedMouseEvents&&!C.isPressed&&(C.pointerType==="virtual"||lc(w.nativeEvent))){let S=g(w,"virtual"),K=A(w,"virtual"),B=N(w,"virtual");L(w),$=S&&K&&B}else if(C.isPressed&&C.pointerType!=="keyboard"){let S=C.pointerType||w.nativeEvent.pointerType||"virtual",K=A(Ue(w.currentTarget,w),S),B=N(Ue(w.currentTarget,w),S,!0);$=K&&B,C.isOverTarget=!1,L(w),I(w)}C.ignoreEmulatedMouseEvents=!1,$&&w.stopPropagation()}}},O=w=>{if(C.isPressed&&C.target&&xs(w,C.target)){Tn(ae(w),w.key)&&w.preventDefault();let $=ae(w),S=be(C.target,$);N(Ue(C.target,w),"keyboard",S),S&&H(w,C.target),k(),w.key!=="Enter"&&Hs(C.target)&&be(C.target,$)&&!w[Nn]&&(w[Nn]=!0,bt(C.target,w,!1)),C.isPressed=!1,C.metaKeyEvents?.delete(w.key)}else if(w.key==="Meta"&&C.metaKeyEvents?.size){let $=C.metaKeyEvents;C.metaKeyEvents=void 0;for(let S of $.values())C.target?.dispatchEvent(new KeyboardEvent("keyup",S))}};if(typeof PointerEvent<"u"){M.onPointerDown=S=>{if(S.button!==0||!be(S.currentTarget,ae(S)))return;if(cc(S.nativeEvent)){C.pointerType="virtual";return}C.pointerType=S.pointerType;let K=!0;if(!C.isPressed){C.isPressed=!0,C.isOverTarget=!0,C.activePointerId=S.pointerId,C.target=S.currentTarget,y||gc(C.target),K=g(S,C.pointerType);let B=ae(S);"releasePointerCapture"in B&&("hasPointerCapture"in B?B.hasPointerCapture(S.pointerId)&&B.releasePointerCapture(S.pointerId):B.releasePointerCapture(S.pointerId)),v(Ie(S.currentTarget),"pointerup",w,!1),v(Ie(S.currentTarget),"pointercancel",$,!1)}K&&S.stopPropagation()},M.onMouseDown=S=>{if(be(S.currentTarget,ae(S))&&S.button===0){if(x){let K=nc(S.target);K&&C.disposables.push(K)}S.stopPropagation()}},M.onPointerUp=S=>{!be(S.currentTarget,ae(S))||C.pointerType==="virtual"||S.button===0&&!C.isPressed&&A(S,C.pointerType||S.pointerType)},M.onPointerEnter=S=>{S.pointerId===C.activePointerId&&C.target&&!C.isOverTarget&&C.pointerType!=null&&(C.isOverTarget=!0,g(Ue(C.target,S),C.pointerType))},M.onPointerLeave=S=>{S.pointerId===C.activePointerId&&C.target&&C.isOverTarget&&C.pointerType!=null&&(C.isOverTarget=!1,N(Ue(C.target,S),C.pointerType,!1),D(S))};let w=S=>{if(S.pointerId===C.activePointerId&&C.isPressed&&S.button===0&&C.target){if(be(C.target,ae(S))&&C.pointerType!=null){let K=!1,B=setTimeout(()=>{C.isPressed&&C.target instanceof HTMLElement&&(K?I(S):(xt(C.target),C.target.click()))},80);v(S.currentTarget,"click",()=>K=!0,!0),C.disposables.push(()=>clearTimeout(B))}else I(S);C.isOverTarget=!1}},$=S=>{I(S)};M.onDragStart=S=>{be(S.currentTarget,ae(S))&&I(S)}}return M},[v,l,x,k,y,D,g,L,H]);return c.useEffect(()=>{if(!m)return;const C=Ie(m.current);if(!C||!C.head||C.getElementById(Sn))return;const M=C.createElement("style");M.id=Sn;let O=xc(C);O&&(M.nonce=O),M.textContent=`
|
|
1
|
+
import{as as Ps,d8 as Hr,r as c,e as ue,j as s,_ as Ke,$ as Fs,L as oa,t as F,a0 as qr,g as Ce,d9 as Qr,da as ia,db as la,dc as Wt,a7 as Wr,f as W,X as Xe,a3 as vt,aB as Gt,Y as Gr,b9 as Vr,d7 as Vt,dd as ca,Z as et,de as Yr,df as Jr,dg as Xr,W as Ze,dh as da,bJ as Ds,di as Zr,bs as eo,dj as to,dk as so,dl as ua,aM as no,dm as ao,B as fa,dn as ro,dp as oo,dq as io,dr as lo,ds as co,dt as uo,w as fo,cH as ma,d4 as pa,c as se,d as tt,K as yt,du as mo,dv as po,dw as Yt,h as me,at as ye,i as ge,E as Re,F as Ee,Q as kt,cy as Me,dx as Jt,dy as pt,aJ as ho,dz as jt,dA as Ae,dB as Ct,dC as wt,dD as Nt,dE as go,dF as xo,dG as cn,cF as bo,s as ha,dH as vo,dI as yo,dJ as ko,b6 as jo,cp as Co,G as Xt,c_ as ga,c$ as wo,dK as No,bq as Os,bt as xa,bn as ba,bu as va,bv as ya,bw as So,dL as Io,ab as ka,cO as To,dM as ht,dN as Ro,aH as Eo,aI as Mo,dO as Ao,bf as ja,dP as Lo,dQ as Ca,dR as $o,H as wa,dS as Po,bR as zs,dT as Fo,cQ as st,dU as dn,dV as Na,bT as Do,dW as ps,dX as Oo,bS as zo,S as _o,q as Uo,ah as Sa,J as Bo,dY as Ko,dZ as Ho,d_ as qo,d3 as un,bD as Qo,d$ as Wo,e0 as Go,av as Vo,cS as Yo,d1 as Jo,e1 as Xo,ai as Zo,d2 as ei,e2 as ti,e3 as si,e4 as ni,e5 as ai,C as St,e6 as ri,e7 as oi,e8 as fn,e9 as ii,ea as li,eb as ci,ec as di,v as Ia,d6 as ui,ed as _s,ee as fi,ef as mi,cq as pi,cn as hi,eg as gi,bU as xi,eh as Ta,cr as bi}from"./index-sX1xY_ye.js";import{u as vi,L as yi,a as ki}from"./roving-focus-CPkr5FTJ.js";import{j as ji,S as Ra,f as Ci,a as wi,t as ut,c as Ni,k as Si,l as Ii,m as Ti,u as Ri}from"./search-token-index-zzFp1OWm.js";import{K as Ei}from"./kbd-C2HaWlmQ.js";import{c as Ea,P as Mi,E as Ai}from"./popover-menu-6EW5dPCf.js";import{M as Li}from"./mail-Cyr1NbkS.js";import{A as gt}from"./avatar-CVy1NIOI.js";import{M as $i,a as Pi,b as Ma,c as Fi,s as Aa,d as La,e as Di,f as Oi,S as mn,g as $a,u as Pa,p as zi,r as _i}from"./useSearchTokenContext-D5JEnGSM.js";import{P as Zt,f as Ui,C as Bi,D as Ve,s as Ki,a as Hi,e as pn,b as qi,c as Qi,d as Wi,g as hn,i as Gi,u as Vi}from"./index-tC8B4Qkq.js";import{E as Fa}from"./EmptyState-B0e0Fyab.js";import{E as Be}from"./ErrorState-BvRoI00P.js";import{U as Yi}from"./undo-2-DgvBsOEv.js";import{D as Ji}from"./download-BDUsG8uv.js";import{s as Xi,b as Zi,Z as el,E as tl,C as sl,e as nl,u as al,d as rl}from"./useCalendarFreeBusy-gIly18MB.js";import{C as ws,m as ol,j as il,n as ll,o as gn,k as xn,p as cl,s as bn,q as dl,v as ul,t as fl,x as ml}from"./calendar-suggestion-BdENUHgp.js";import{c as pl,t as hl,v as gl,x as xl,y as bl,z as vn}from"./calendar-format-DeXXPgld.js";import{R as vl}from"./attendee-row-B17fnTlq.js";import{C as yl}from"./calendar-clash-strip-Bm-MYQet.js";import{C as Da}from"./clock-WYPpiy7W.js";import{M as kl}from"./map-pin-DRN0BhjA.js";import{B as Oa}from"./bell-off-C6pIOJuw.js";import{S as jl,C as za}from"./shield-check-Dv9973Ie.js";import{u as Cl,a as wl,i as Nl,t as Sl,d as Il,r as Tl}from"./useCalendars-Q4eHkTES.js";import{c as Rl}from"./calendar-report-DJ8H5rPt.js";import{u as _a}from"./useDebouncedValue-s8y_FI-2.js";import{j as yn,u as El,a as Ml,k as Al,n as Ll,o as $l,l as Pl,S as Fl}from"./useFilters-CqBmHL-q.js";import{u as Us}from"./useQueries-Yk6rRJaD.js";import{C as Dl}from"./checkbox-DHX4RXRp.js";import{C as $t}from"./confirm-dialog-C86T_96x.js";import{u as Ol,i as zl}from"./useLayoutTier-CmvG4PY1.js";import{r as _l,a as Ul}from"./search-scope-B5-OK3Cq.js";import{M as Bl}from"./menu-CQspPBY1.js";function xt(e){if(Kl())e.focus({preventScroll:!0});else{let t=Hl(e);e.focus(),ql(t)}}let Pt=null;function Kl(){if(Pt==null){Pt=!1;try{document.createElement("div").focus({get preventScroll(){return Pt=!0,!0}})}catch{}}return Pt}function Hl(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 ql(e){for(let{element:t,scrollTop:n,scrollLeft:a}of e)t.scrollTop=n,t.scrollLeft=a}const Ie=e=>e?.ownerDocument??document,Te=e=>e&&"window"in e&&e.window===e?e:Ie(e).defaultView||window;function Ql(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function Wl(e){return Ql(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let Gl=!1;function Ua(){return Gl}function be(e,t){if(!Ua())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:Wl(n)?n=n.host:n=n.parentNode}return!1}function ae(e){if(Ua()&&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 Vl=typeof Element<"u"&&"checkVisibility"in Element.prototype;function Yl(e){const t=Te(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}=Te(e);let{display:i,visibility:l}=o(e);r=i!=="none"&&l!=="hidden"&&l!=="collapse"}return r}function Jl(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 Ba(e,t){return Vl?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):e.nodeName!=="#comment"&&Yl(e)&&Jl(e,t)&&(!e.parentElement||Ba(e.parentElement,e))}const Ka=["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"],Xl=Ka.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";Ka.push('[tabindex]:not([tabindex="-1"]):not([disabled])');function Zl(e,t){return e.matches(Xl)&&!ec(e)&&(t?.skipVisibilityCheck||Ba(e))}function ec(e){let t=e;for(;t!=null;){if(t instanceof Te(t).HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}const Bs=typeof document<"u"?Ps.useLayoutEffect:()=>{};function tc(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function sc(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function nc(e){for(;e&&!Zl(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=Te(e),n=t.document.activeElement;if(!n||n===e)return;let a=!1,r=h=>{(ae(h)===n||a)&&h.stopImmediatePropagation()},o=h=>{(ae(h)===n||a)&&(h.stopImmediatePropagation(),!e&&!a&&(a=!0,xt(n),d()))},i=h=>{(ae(h)===e||a)&&h.stopImmediatePropagation()},l=h=>{(ae(h)===e||a)&&(h.stopImmediatePropagation(),a||(a=!0,xt(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 es(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 Ks(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}function Le(e){let t=null;return()=>(t==null&&(t=e()),t)}const Kt=Le(function(){return Ks(/^Mac/i)}),ac=Le(function(){return Ks(/^iPhone/i)}),Ha=Le(function(){return Ks(/^iPad/i)||Kt()&&navigator.maxTouchPoints>1}),qa=Le(function(){return ac()||Ha()}),rc=Le(function(){return es(/AppleWebKit/i)&&!oc()}),oc=Le(function(){return es(/Chrome/i)}),Qa=Le(function(){return es(/Android/i)}),ic=Le(function(){return es(/Firefox/i)});function lc(e){return e.pointerType===""&&e.isTrusted?!0:Qa()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function cc(e){return!Qa()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"}function bt(e,t,n=!0){let{metaKey:a,ctrlKey:r,altKey:o,shiftKey:i}=t;ic()&&window.event?.type?.startsWith("key")&&e.target==="_blank"&&(Kt()?a=!0:r=!0);let l=rc()&&Kt()&&!Ha()?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});bt.isOpening=n,xt(e),e.dispatchEvent(l),bt.isOpening=!1}bt.isOpening=!1;let Se=new Map,Ns=new Set;function kn(){if(typeof window>"u")return;function e(a){return"propertyName"in a}let t=a=>{let r=ae(a);if(!e(a)||!r)return;let o=Se.get(r);o||(o=new Set,Se.set(r,o),r.addEventListener("transitioncancel",n,{once:!0})),o.add(a.propertyName)},n=a=>{let r=ae(a);if(!e(a)||!r)return;let o=Se.get(r);if(o&&(o.delete(a.propertyName),o.size===0&&(r.removeEventListener("transitioncancel",n),Se.delete(r)),Se.size===0)){for(let i of Ns)i();Ns.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",n)}typeof document<"u"&&(document.readyState!=="loading"?kn():document.addEventListener("DOMContentLoaded",kn));function dc(){for(const[e]of Se)"isConnected"in e&&!e.isConnected&&Se.delete(e)}function uc(e){requestAnimationFrame(()=>{dc(),Se.size===0?e():Ns.add(e)})}function Wa(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}let Ss=new Map;typeof FinalizationRegistry<"u"&&new FinalizationRegistry(e=>{Ss.delete(e)});function fc(e,t){if(e===t)return e;let n=Ss.get(e);if(n)return n.forEach(r=>r.current=t),t;let a=Ss.get(t);return a?(a.forEach(r=>r.current=e),e):t}function mc(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1;const a=e.map(r=>{const o=jn(r,t);return n||=typeof o=="function",o});if(n)return()=>{a.forEach((r,o)=>{typeof r=="function"?r():jn(e[o],null)})}}}function jn(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]=Wa(o,i):(r==="className"||r==="UNSAFE_className")&&typeof o=="string"&&typeof i=="string"?t[r]=Hr(o,i):r==="id"&&o&&i?t.id=fc(o,i):r==="ref"&&o&&i?t.ref=mc(o,i):t[r]=i!==void 0?i:o}}return t}function pc(e,t){Bs(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}const hc=Ps.useInsertionEffect??Bs;function hs(e){const t=c.useRef(null);return hc(()=>{t.current=e},[e]),c.useCallback((...n)=>{const a=t.current;return a?.(...n)},[])}let Ye="default",Is="",Bt=new WeakMap;function gc(e){if(qa()){if(Ye==="default"){const t=Ie(e);Is=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect="none"}Ye="disabled"}else if(e instanceof HTMLElement||e instanceof SVGElement){let t="userSelect"in e.style?"userSelect":"webkitUserSelect";Bt.set(e,e.style[t]),e.style[t]="none"}}function Cn(e){if(qa()){if(Ye!=="disabled")return;Ye="restoring",setTimeout(()=>{uc(()=>{if(Ye==="restoring"){const t=Ie(e);t.documentElement.style.webkitUserSelect==="none"&&(t.documentElement.style.webkitUserSelect=Is||""),Is="",Ye="default"}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&Bt.has(e)){let t=Bt.get(e),n="userSelect"in e.style?"userSelect":"webkitUserSelect";e.style[n]==="none"&&(e.style[n]=t),e.getAttribute("style")===""&&e.removeAttribute("style"),Bt.delete(e)}}function wn(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let gs=new WeakMap;function xc(e){let t=e??(typeof document<"u"?document:void 0);if(!t)return wn(t);if(gs.has(t))return gs.get(t);let n=t.querySelector('meta[property="csp-nonce"]'),a=n&&n instanceof Te(n).HTMLMetaElement&&(n.nonce||n.content)||wn(t)||void 0;return a!==void 0&&gs.set(t,a),a}const Ga=Ps.createContext({register:()=>{}});Ga.displayName="PressResponderContext";function Va(){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 bc(e){let t=c.useContext(Ga);if(t){let{register:n,ref:a,...r}=t;e=It(r,e),n()}return pc(t,e.ref),e}class Ft{#e;constructor(t,n,a,r){this.#e=!0;const i=(r?.target??a.currentTarget)?.getBoundingClientRect();let l,d=0,x,h=null;a.clientX!=null&&a.clientY!=null&&(x=a.clientX,h=a.clientY),i&&(x!=null&&h!=null?(l=x-i.left,d=h-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 Nn=Symbol("linkClicked"),Sn="react-aria-pressable-style",In="data-react-aria-pressable";function vc(e){let{onPress:t,onPressChange:n,onPressStart:a,onPressEnd:r,onPressUp:o,onClick:i,isDisabled:l,isPressed:d,preventFocusOnPress:x,shouldCancelOnPointerExit:h,allowTextSelectionOnPress:y,ref:m,...b}=bc(e),[p,f]=c.useState(!1),u=c.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:v,removeAllGlobalListeners:k}=Va(),g=c.useCallback((C,M)=>{let O=u.current;if(l||O.didFirePressStart)return!1;let w=!0;if(O.isTriggeringEvent=!0,a){let $=new Ft("pressstart",M,C);a($),w=$.shouldStopPropagation}return n&&n(!0),O.isTriggeringEvent=!1,O.didFirePressStart=!0,f(!0),w},[l,a,n]),j=c.useCallback((C,M,O=!0)=>{let w=u.current;if(!w.didFirePressStart)return!1;w.didFirePressStart=!1,w.isTriggeringEvent=!0;let $=!0;if(r){let S=new Ft("pressend",M,C);r(S),$=S.shouldStopPropagation}if(n&&n(!1),f(!1),t&&O&&!l){let S=new Ft("press",M,C);t(S),$&&=S.shouldStopPropagation}return w.isTriggeringEvent=!1,$},[l,r,n,t]),N=hs(j),R=c.useCallback((C,M)=>{let O=u.current;if(l)return!1;if(o){O.isTriggeringEvent=!0;let w=new Ft("pressup",M,C);return o(w),O.isTriggeringEvent=!1,w.shouldStopPropagation}return!0},[l,o]),A=hs(R),T=c.useCallback(C=>{let M=u.current;if(M.isPressed&&M.target){M.didFirePressStart&&M.pointerType!=null&&j(Ue(M.target,C),M.pointerType,!1),M.isPressed=!1,M.isOverTarget=!1,M.activePointerId=null,M.pointerType=null,k(),y||Cn(M.target);for(let O of M.disposables)O();M.disposables=[]}},[y,k,j]),I=hs(T);c.useEffect(()=>{l&&u.current.isPressed&&I({currentTarget:u.current.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})},[l]);let D=c.useCallback(C=>{h&&T(C)},[h,T]),L=c.useCallback(C=>{l||i?.(C)},[l,i]),H=c.useCallback((C,M)=>{if(!l&&i){let O=new MouseEvent("click",C);sc(O,M),i(tc(O))}},[l,i]),z=c.useMemo(()=>{let C=u.current,M={onKeyDown(w){if(xs(w.nativeEvent,w.currentTarget)&&be(w.currentTarget,ae(w))){Tn(ae(w),w.key)&&w.preventDefault();let $=!0;!C.isPressed&&!w.repeat&&(C.target=w.currentTarget,C.isPressed=!0,C.pointerType="keyboard",$=g(w,"keyboard"));let S=w.currentTarget,K=B=>{xs(B,S)&&!B.repeat&&be(S,ae(B))&&C.target&&A(Ue(C.target,B),"keyboard")};v(Ie(w.currentTarget),"keyup",Wa(K,O),!0),$&&w.stopPropagation(),w.metaKey&&Kt()&&C.metaKeyEvents?.set(w.key,w.nativeEvent)}else w.key==="Meta"&&(C.metaKeyEvents=new Map)},onClick(w){if(!(w&&!be(w.currentTarget,ae(w)))&&w&&w.button===0&&!C.isTriggeringEvent&&!bt.isOpening){let $=!0;if(l&&w.preventDefault(),!C.ignoreEmulatedMouseEvents&&!C.isPressed&&(C.pointerType==="virtual"||lc(w.nativeEvent))){let S=g(w,"virtual"),K=A(w,"virtual"),B=N(w,"virtual");L(w),$=S&&K&&B}else if(C.isPressed&&C.pointerType!=="keyboard"){let S=C.pointerType||w.nativeEvent.pointerType||"virtual",K=A(Ue(w.currentTarget,w),S),B=N(Ue(w.currentTarget,w),S,!0);$=K&&B,C.isOverTarget=!1,L(w),I(w)}C.ignoreEmulatedMouseEvents=!1,$&&w.stopPropagation()}}},O=w=>{if(C.isPressed&&C.target&&xs(w,C.target)){Tn(ae(w),w.key)&&w.preventDefault();let $=ae(w),S=be(C.target,$);N(Ue(C.target,w),"keyboard",S),S&&H(w,C.target),k(),w.key!=="Enter"&&Hs(C.target)&&be(C.target,$)&&!w[Nn]&&(w[Nn]=!0,bt(C.target,w,!1)),C.isPressed=!1,C.metaKeyEvents?.delete(w.key)}else if(w.key==="Meta"&&C.metaKeyEvents?.size){let $=C.metaKeyEvents;C.metaKeyEvents=void 0;for(let S of $.values())C.target?.dispatchEvent(new KeyboardEvent("keyup",S))}};if(typeof PointerEvent<"u"){M.onPointerDown=S=>{if(S.button!==0||!be(S.currentTarget,ae(S)))return;if(cc(S.nativeEvent)){C.pointerType="virtual";return}C.pointerType=S.pointerType;let K=!0;if(!C.isPressed){C.isPressed=!0,C.isOverTarget=!0,C.activePointerId=S.pointerId,C.target=S.currentTarget,y||gc(C.target),K=g(S,C.pointerType);let B=ae(S);"releasePointerCapture"in B&&("hasPointerCapture"in B?B.hasPointerCapture(S.pointerId)&&B.releasePointerCapture(S.pointerId):B.releasePointerCapture(S.pointerId)),v(Ie(S.currentTarget),"pointerup",w,!1),v(Ie(S.currentTarget),"pointercancel",$,!1)}K&&S.stopPropagation()},M.onMouseDown=S=>{if(be(S.currentTarget,ae(S))&&S.button===0){if(x){let K=nc(S.target);K&&C.disposables.push(K)}S.stopPropagation()}},M.onPointerUp=S=>{!be(S.currentTarget,ae(S))||C.pointerType==="virtual"||S.button===0&&!C.isPressed&&A(S,C.pointerType||S.pointerType)},M.onPointerEnter=S=>{S.pointerId===C.activePointerId&&C.target&&!C.isOverTarget&&C.pointerType!=null&&(C.isOverTarget=!0,g(Ue(C.target,S),C.pointerType))},M.onPointerLeave=S=>{S.pointerId===C.activePointerId&&C.target&&C.isOverTarget&&C.pointerType!=null&&(C.isOverTarget=!1,N(Ue(C.target,S),C.pointerType,!1),D(S))};let w=S=>{if(S.pointerId===C.activePointerId&&C.isPressed&&S.button===0&&C.target){if(be(C.target,ae(S))&&C.pointerType!=null){let K=!1,B=setTimeout(()=>{C.isPressed&&C.target instanceof HTMLElement&&(K?I(S):(xt(C.target),C.target.click()))},80);v(S.currentTarget,"click",()=>K=!0,!0),C.disposables.push(()=>clearTimeout(B))}else I(S);C.isOverTarget=!1}},$=S=>{I(S)};M.onDragStart=S=>{be(S.currentTarget,ae(S))&&I(S)}}return M},[v,l,x,k,y,D,g,L,H]);return c.useEffect(()=>{if(!m)return;const C=Ie(m.current);if(!C||!C.head||C.getElementById(Sn))return;const M=C.createElement("style");M.id=Sn;let O=xc(C);O&&(M.nonce=O),M.textContent=`
|
|
2
2
|
@layer {
|
|
3
3
|
[${In}] {
|
|
4
4
|
touch-action: pan-x pan-y pinch-zoom;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as L,r as N,j as e,W,Y as H,Z as $,_ as A,$ as I,t as C,a0 as Q,a1 as V,a2 as Y,a3 as G,a4 as Z,a5 as J,a6 as X,a7 as ee,I as se,a8 as te,a9 as ae,aa as S,ab as ne,h as re,C as ie,ac as le,K as oe,c as ce,ad as ue,ae as de,af as R,ag as xe,ah as v,ai as fe,D as me,v as he}from"./index-CwWM67NV.js";import{u as ge}from"./roving-focus-CaY933ER.js";import{B as pe}from"./bell-off-BO2gV0YK.js";import{u as be}from"./useQueries-CJO85Tgo.js";import{f as je}from"./folder-failure-CqkVSsrb.js";import{i as ye}from"./outbox-status-BlKn6P0x.js";import{B as ve}from"./bug-Dobgqhnx.js";const Ne=L("CirclePause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);const ke=L("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 Ce=L("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"}]]),Oe={Mail:"mail sync off"},Se="button:not([disabled]), a[href]",w="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-sunken";function we({active:s,dimmed:a,indent:n}){return C("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors",w,n&&"pl-7",s?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg",a&&"opacity-55")}function ze({icon:s,label:a,count:n,active:r,failure:o}){return e.jsxs(e.Fragment,{children:[s&&e.jsx("span",{className:C("shrink-0",r?"text-accent-2":"text-fg-subtle"),children:s}),e.jsx("span",{className:"flex-1 truncate",children:a}),o&&e.jsx(Q,{className:"size-3.5 shrink-0 text-danger","aria-hidden":"true"}),n!=null&&n>0&&e.jsx("span",{className:C("text-2xs tabular-nums",r?"text-accent-2":"text-fg-subtle"),children:n})]})}function O({icon:s,label:a,count:n,active:r,dimmed:o,indent:c,navId:f,linkComponent:g,ariaLabel:m,title:p,failure:d,onClick:k}){const j=we({active:r,dimmed:o,indent:c}),x=e.jsx(ze,{icon:s,label:a,count:n,active:r,failure:d}),y=m??a,i=d?`${y} — ${d}`:y,l=d?`${p??a} — ${d}`:p;return f&&g?g({navId:f,className:j,ariaLabel:i,title:l,onClick:k,children:x}):e.jsx("button",{type:"button",onClick:k,className:j,"aria-label":d?i:m,title:l,children:x})}const M={inbox:0,flagged:1,drafts:2,sent:3,archive:4,all:5,junk:6,trash:7};function Re(s){switch(s){case"inbox":return e.jsx(se,{className:"size-4"});case"flagged":return e.jsx($,{className:"size-4"});case"drafts":return e.jsx(ee,{className:"size-4"});case"sent":return e.jsx(V,{className:"size-4"});case"archive":return e.jsx(X,{className:"size-4"});case"all":return e.jsx(J,{className:"size-4"});case"junk":return e.jsx(Z,{className:"size-4"});case"trash":return e.jsx(G,{className:"size-4"})}}const E=s=>s.role!=null,z=8,P="remit.nav.folders.open.",_="remit.nav.account.open.";function D(s,a,n){if(typeof localStorage>"u")return n;const r=localStorage.getItem(s+a);return r===null?n:r!=="0"}function B(s,a,n){typeof localStorage>"u"||localStorage.setItem(s+a,n?"1":"0")}function Le({account:s,selectedNavId:a,onSelectNav:n,linkComponent:r}){const[o,c]=N.useState(()=>D(_,s.id,!0)),[f,g]=N.useState(()=>D(P,s.id,!0)),[m,p]=N.useState(!1),d=()=>{c(t=>{const u=!t;return B(_,s.id,u),u})},k=()=>{g(t=>{const u=!t;return B(P,s.id,u),u})},j=s.mailboxes.filter(E).sort((t,u)=>M[t.role]-M[u.role]),x=s.mailboxes.filter(t=>!E(t)),y=m||x.length<=z?x:x.slice(0,z),i=x.length-y.length,l=s.status??"ready",h=s.syncedServices!==void 0&&!s.syncedServices.includes("Mail"),b=l==="ready"&&j.length===0&&x.length===0;return e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",onClick:d,"aria-expanded":o,className:C("flex w-full items-center gap-1.5 px-2 pb-1 text-left transition-colors hover:text-fg",w,s.muted&&"opacity-55"),children:[o?e.jsx(A,{className:"size-3 shrink-0 text-fg-subtle"}):e.jsx(I,{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(pe,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:"muted"})]}),h&&e.jsxs(e.Fragment,{children:[e.jsx(Ne,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:Oe.Mail})]})]}),o&&e.jsxs(e.Fragment,{children:[l==="loading"&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"Loading…"}),l==="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(Q,{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"})]}),b&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"No mailboxes"}),l==="ready"&&e.jsxs(e.Fragment,{children:[j.map(t=>e.jsx(O,{navId:t.id,linkComponent:r,icon:Re(t.role),label:t.name,ariaLabel:t.name,title:t.fullPath??t.name,failure:t.failure,count:t.unseen,active:a===t.id,dimmed:s.muted,onClick:()=>n?.(t.id)},t.id)),s.outboxPending!==void 0&&e.jsx(O,{navId:"outbox",linkComponent:r,icon:e.jsx(V,{className:"size-4"}),label:"Outbox",ariaLabel:"Outbox",count:s.outboxPending>0?s.outboxPending:void 0,active:a==="outbox",dimmed:s.muted,onClick:()=>n?.("outbox")}),x.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:k,"aria-expanded":f,className:C("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",w),children:[f?e.jsx(A,{className:"size-3 shrink-0"}):e.jsx(I,{className:"size-3 shrink-0"}),e.jsx("span",{className:"flex-1",children:"Folders"}),e.jsx("span",{className:"tabular-nums opacity-70",children:x.length})]}),f&&e.jsxs(e.Fragment,{children:[y.map(t=>e.jsx(O,{navId:t.id,linkComponent:r,icon:e.jsx(Y,{className:"size-4"}),label:t.name,ariaLabel:t.name,title:t.fullPath??t.name,failure:t.failure,count:t.unseen,active:a===t.id,dimmed:s.muted,onClick:()=>n?.(t.id)},t.id)),(i>0||m)&&x.length>z&&e.jsx("button",{type:"button",onClick:()=>p(t=>!t),className:C("ml-7 flex items-center px-2 py-1 text-2xs font-medium text-accent transition-colors hover:underline",w),children:m?"Show less":`Show all (${x.length})`})]})]})]})]})]})}function Fe({accounts:s,selectedNavId:a,briefUnseen:n,onSelectNav:r,variant:o="desktop",linkComponent:c,calendarNav:f="hidden"}){const g=N.useRef(null);ge({containerRef:g,itemSelector:Se});const m=o==="drawer",p=e.jsxs("nav",{ref:m?g:void 0,className:m?"px-2 py-2":"flex-1 overflow-y-auto px-2 py-2","aria-label":"Mailboxes",children:[e.jsx(O,{navId:"brief",linkComponent:c,icon:e.jsx(W,{className:"size-4"}),label:"Daily brief",ariaLabel:"Daily brief",count:n,active:a==="brief",onClick:()=>r?.("brief")}),f==="shown"&&e.jsx(O,{navId:"calendar",linkComponent:c,icon:e.jsx(H,{className:"size-4"}),label:"Calendar",ariaLabel:"Calendar",active:a==="calendar",onClick:()=>r?.("calendar")}),e.jsx(O,{navId:"flagged",linkComponent:c,icon:e.jsx($,{className:"size-4"}),label:"Starred",ariaLabel:"Starred",active:a==="flagged",onClick:()=>r?.("flagged")}),s.length===0?e.jsx("div",{className:"px-2 py-4 text-center text-sm text-fg-muted",children:"No accounts configured"}):s.map(d=>e.jsx(Le,{account:d,selectedNavId:a,onSelectNav:r,linkComponent:c},d.id))]});return m?p:e.jsx("aside",{ref:g,className:"flex h-full w-full flex-col bg-surface-sunken",children:p})}function Ae(){const{pathname:s}=te(),a=ae({from:"/mail/$mailboxId",shouldThrow:!1});return S(s,"/settings")?"settings":S(s,"/calendar")?"calendar":S(s,"/mail/outbox")?"outbox":S(s,"/mail/flagged")?"flagged":S(s,"/mail/brief")?"brief":a?.mailboxId??""}const Ie=({children:s})=>{const{Account:a}=ne();return e.jsx(a,{children:s})},T=s=>/^\d/.test(s),Me=(s,a)=>{const n=T(s),r=T(a);return n&&!r?-1:!n&&r?1:s.localeCompare(a,void 0,{sensitivity:"base",numeric:!0})};function Ee(s,a,n){const r=[],o=[];for(const c of s)a.has(c.mailboxId)?r.push(c):o.push(c);return o.sort((c,f)=>Me(R(c,void 0,n),R(f,void 0,n))),{system:r,labels:o}}function Pe(s,a,n){const r=xe(a)&&s.unseenCount>0;return{id:s.mailboxId,name:R(s,a,n),unseen:r?s.unseenCount:void 0,role:a,fullPath:s.fullPath,failure:je(s)}}function q({accounts:s,onMailboxSelect:a,variant:n="desktop"}){const r=re(),o=Ae(),{onSearchChange:c}=ie(),{t:f}=le("mail",{useSuspense:!1}),g=N.useCallback((i,l)=>f(i,{defaultValue:l}),[f]),m=be({queries:s.map(i=>({...oe({path:{accountId:i.accountId}}),staleTime:1/0}))}),{data:p}=ce(ue()),d=N.useMemo(()=>(p?.items??[]).filter(i=>ye(i.status)).length,[p?.items]),k=N.useMemo(()=>s.map((i,l)=>{const h=m[l],b=h?.data?.items??[],t=de(i.folderAppointments),{system:u,labels:K}=Ee(b,t,g),U=h?.isError?"error":h?.isLoading?"loading":"ready";return{id:i.accountId,label:i.email,email:i.email,muted:!!i.muted,outboxPending:d,status:U,onRetry:()=>h?.refetch(),mailboxes:[...u,...K].map(F=>Pe(F,t.get(F.mailboxId),g))}}),[s,m,d,g]),j=i=>{r.invalidateQueries({queryKey:fe({path:{mailboxId:i},query:{order:"desc"}})})},x=({navId:i,className:l,ariaLabel:h,title:b,children:t,onClick:u})=>i==="brief"?e.jsx(v,{to:"/mail/brief",search:{q:void 0},activeOptions:{includeSearch:!1},onClick:()=>u?.(),className:l,"aria-label":h,title:b,children:t}):i==="calendar"?e.jsx(v,{to:"/calendar",onClick:()=>u?.(),className:l,"aria-label":h,title:b,children:t}):i==="outbox"?e.jsx(v,{to:"/mail/outbox",search:{q:void 0},onClick:()=>u?.(),className:l,"aria-label":h,title:b,children:t}):i==="flagged"?e.jsx(v,{to:"/mail/flagged",search:{q:void 0},onClick:()=>u?.(),className:l,"aria-label":h,title:b,children:t}):i==="settings"?e.jsx(v,{to:"/settings/accounts",onClick:()=>u?.(),className:l,"aria-label":h,title:b,children:t}):e.jsx(v,{to:"/mail/$mailboxId",params:{mailboxId:i},search:{q:void 0},onClick:()=>{j(i),u?.()},className:l,"aria-label":h,title:b,children:t}),y=()=>{c(""),a?.()};return e.jsx(Fe,{accounts:k,selectedNavId:o,onSelectNav:y,linkComponent:x,calendarNav:"shown",variant:n})}function _e(){return e.jsxs("button",{type:"button",onClick:me,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(ve,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Report a bug"})]})}function Ke({accounts:s,onMailboxSelect:a}){return he()?.showNavPane??!0?e.jsx(q,{accounts:s}):e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(q,{accounts:s,onMailboxSelect:a,variant:"drawer"})}),e.jsxs("div",{className:"border-t border-line px-2 py-2",children:[e.jsxs(v,{to:"/settings/accounts",onClick:a,children:[e.jsx(Ce,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Settings"})]}),e.jsx(_e,{}),e.jsx(Ie,{children:({signOut:o})=>e.jsxs("button",{type:"button",onClick:()=>{a?.(),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(ke,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Sign out"})]})})]})]})}export{Ie as A,ke as L,Ke as M,Ce as S};
|
|
1
|
+
import{e as L,r as N,j as e,W,Y as H,Z as $,_ as A,$ as I,t as C,a0 as Q,a1 as V,a2 as Y,a3 as G,a4 as Z,a5 as J,a6 as X,a7 as ee,I as se,a8 as te,a9 as ae,aa as S,ab as ne,h as re,C as ie,ac as le,K as oe,c as ce,ad as ue,ae as de,af as R,ag as xe,ah as v,ai as fe,D as me,v as he}from"./index-sX1xY_ye.js";import{u as ge}from"./roving-focus-CPkr5FTJ.js";import{B as pe}from"./bell-off-C6pIOJuw.js";import{u as be}from"./useQueries-Yk6rRJaD.js";import{f as je}from"./folder-failure-CqkVSsrb.js";import{i as ye}from"./outbox-status-BlKn6P0x.js";import{B as ve}from"./bug-C0o6sVq8.js";const Ne=L("CirclePause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);const ke=L("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 Ce=L("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"}]]),Oe={Mail:"mail sync off"},Se="button:not([disabled]), a[href]",w="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-sunken";function we({active:s,dimmed:a,indent:n}){return C("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors",w,n&&"pl-7",s?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg",a&&"opacity-55")}function ze({icon:s,label:a,count:n,active:r,failure:o}){return e.jsxs(e.Fragment,{children:[s&&e.jsx("span",{className:C("shrink-0",r?"text-accent-2":"text-fg-subtle"),children:s}),e.jsx("span",{className:"flex-1 truncate",children:a}),o&&e.jsx(Q,{className:"size-3.5 shrink-0 text-danger","aria-hidden":"true"}),n!=null&&n>0&&e.jsx("span",{className:C("text-2xs tabular-nums",r?"text-accent-2":"text-fg-subtle"),children:n})]})}function O({icon:s,label:a,count:n,active:r,dimmed:o,indent:c,navId:f,linkComponent:g,ariaLabel:m,title:p,failure:d,onClick:k}){const j=we({active:r,dimmed:o,indent:c}),x=e.jsx(ze,{icon:s,label:a,count:n,active:r,failure:d}),y=m??a,i=d?`${y} — ${d}`:y,l=d?`${p??a} — ${d}`:p;return f&&g?g({navId:f,className:j,ariaLabel:i,title:l,onClick:k,children:x}):e.jsx("button",{type:"button",onClick:k,className:j,"aria-label":d?i:m,title:l,children:x})}const M={inbox:0,flagged:1,drafts:2,sent:3,archive:4,all:5,junk:6,trash:7};function Re(s){switch(s){case"inbox":return e.jsx(se,{className:"size-4"});case"flagged":return e.jsx($,{className:"size-4"});case"drafts":return e.jsx(ee,{className:"size-4"});case"sent":return e.jsx(V,{className:"size-4"});case"archive":return e.jsx(X,{className:"size-4"});case"all":return e.jsx(J,{className:"size-4"});case"junk":return e.jsx(Z,{className:"size-4"});case"trash":return e.jsx(G,{className:"size-4"})}}const E=s=>s.role!=null,z=8,P="remit.nav.folders.open.",_="remit.nav.account.open.";function D(s,a,n){if(typeof localStorage>"u")return n;const r=localStorage.getItem(s+a);return r===null?n:r!=="0"}function B(s,a,n){typeof localStorage>"u"||localStorage.setItem(s+a,n?"1":"0")}function Le({account:s,selectedNavId:a,onSelectNav:n,linkComponent:r}){const[o,c]=N.useState(()=>D(_,s.id,!0)),[f,g]=N.useState(()=>D(P,s.id,!0)),[m,p]=N.useState(!1),d=()=>{c(t=>{const u=!t;return B(_,s.id,u),u})},k=()=>{g(t=>{const u=!t;return B(P,s.id,u),u})},j=s.mailboxes.filter(E).sort((t,u)=>M[t.role]-M[u.role]),x=s.mailboxes.filter(t=>!E(t)),y=m||x.length<=z?x:x.slice(0,z),i=x.length-y.length,l=s.status??"ready",h=s.syncedServices!==void 0&&!s.syncedServices.includes("Mail"),b=l==="ready"&&j.length===0&&x.length===0;return e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",onClick:d,"aria-expanded":o,className:C("flex w-full items-center gap-1.5 px-2 pb-1 text-left transition-colors hover:text-fg",w,s.muted&&"opacity-55"),children:[o?e.jsx(A,{className:"size-3 shrink-0 text-fg-subtle"}):e.jsx(I,{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(pe,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:"muted"})]}),h&&e.jsxs(e.Fragment,{children:[e.jsx(Ne,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:Oe.Mail})]})]}),o&&e.jsxs(e.Fragment,{children:[l==="loading"&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"Loading…"}),l==="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(Q,{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"})]}),b&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"No mailboxes"}),l==="ready"&&e.jsxs(e.Fragment,{children:[j.map(t=>e.jsx(O,{navId:t.id,linkComponent:r,icon:Re(t.role),label:t.name,ariaLabel:t.name,title:t.fullPath??t.name,failure:t.failure,count:t.unseen,active:a===t.id,dimmed:s.muted,onClick:()=>n?.(t.id)},t.id)),s.outboxPending!==void 0&&e.jsx(O,{navId:"outbox",linkComponent:r,icon:e.jsx(V,{className:"size-4"}),label:"Outbox",ariaLabel:"Outbox",count:s.outboxPending>0?s.outboxPending:void 0,active:a==="outbox",dimmed:s.muted,onClick:()=>n?.("outbox")}),x.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:k,"aria-expanded":f,className:C("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",w),children:[f?e.jsx(A,{className:"size-3 shrink-0"}):e.jsx(I,{className:"size-3 shrink-0"}),e.jsx("span",{className:"flex-1",children:"Folders"}),e.jsx("span",{className:"tabular-nums opacity-70",children:x.length})]}),f&&e.jsxs(e.Fragment,{children:[y.map(t=>e.jsx(O,{navId:t.id,linkComponent:r,icon:e.jsx(Y,{className:"size-4"}),label:t.name,ariaLabel:t.name,title:t.fullPath??t.name,failure:t.failure,count:t.unseen,active:a===t.id,dimmed:s.muted,onClick:()=>n?.(t.id)},t.id)),(i>0||m)&&x.length>z&&e.jsx("button",{type:"button",onClick:()=>p(t=>!t),className:C("ml-7 flex items-center px-2 py-1 text-2xs font-medium text-accent transition-colors hover:underline",w),children:m?"Show less":`Show all (${x.length})`})]})]})]})]})]})}function Fe({accounts:s,selectedNavId:a,briefUnseen:n,onSelectNav:r,variant:o="desktop",linkComponent:c,calendarNav:f="hidden"}){const g=N.useRef(null);ge({containerRef:g,itemSelector:Se});const m=o==="drawer",p=e.jsxs("nav",{ref:m?g:void 0,className:m?"px-2 py-2":"flex-1 overflow-y-auto px-2 py-2","aria-label":"Mailboxes",children:[e.jsx(O,{navId:"brief",linkComponent:c,icon:e.jsx(W,{className:"size-4"}),label:"Daily brief",ariaLabel:"Daily brief",count:n,active:a==="brief",onClick:()=>r?.("brief")}),f==="shown"&&e.jsx(O,{navId:"calendar",linkComponent:c,icon:e.jsx(H,{className:"size-4"}),label:"Calendar",ariaLabel:"Calendar",active:a==="calendar",onClick:()=>r?.("calendar")}),e.jsx(O,{navId:"flagged",linkComponent:c,icon:e.jsx($,{className:"size-4"}),label:"Starred",ariaLabel:"Starred",active:a==="flagged",onClick:()=>r?.("flagged")}),s.length===0?e.jsx("div",{className:"px-2 py-4 text-center text-sm text-fg-muted",children:"No accounts configured"}):s.map(d=>e.jsx(Le,{account:d,selectedNavId:a,onSelectNav:r,linkComponent:c},d.id))]});return m?p:e.jsx("aside",{ref:g,className:"flex h-full w-full flex-col bg-surface-sunken",children:p})}function Ae(){const{pathname:s}=te(),a=ae({from:"/mail/$mailboxId",shouldThrow:!1});return S(s,"/settings")?"settings":S(s,"/calendar")?"calendar":S(s,"/mail/outbox")?"outbox":S(s,"/mail/flagged")?"flagged":S(s,"/mail/brief")?"brief":a?.mailboxId??""}const Ie=({children:s})=>{const{Account:a}=ne();return e.jsx(a,{children:s})},T=s=>/^\d/.test(s),Me=(s,a)=>{const n=T(s),r=T(a);return n&&!r?-1:!n&&r?1:s.localeCompare(a,void 0,{sensitivity:"base",numeric:!0})};function Ee(s,a,n){const r=[],o=[];for(const c of s)a.has(c.mailboxId)?r.push(c):o.push(c);return o.sort((c,f)=>Me(R(c,void 0,n),R(f,void 0,n))),{system:r,labels:o}}function Pe(s,a,n){const r=xe(a)&&s.unseenCount>0;return{id:s.mailboxId,name:R(s,a,n),unseen:r?s.unseenCount:void 0,role:a,fullPath:s.fullPath,failure:je(s)}}function q({accounts:s,onMailboxSelect:a,variant:n="desktop"}){const r=re(),o=Ae(),{onSearchChange:c}=ie(),{t:f}=le("mail",{useSuspense:!1}),g=N.useCallback((i,l)=>f(i,{defaultValue:l}),[f]),m=be({queries:s.map(i=>({...oe({path:{accountId:i.accountId}}),staleTime:1/0}))}),{data:p}=ce(ue()),d=N.useMemo(()=>(p?.items??[]).filter(i=>ye(i.status)).length,[p?.items]),k=N.useMemo(()=>s.map((i,l)=>{const h=m[l],b=h?.data?.items??[],t=de(i.folderAppointments),{system:u,labels:K}=Ee(b,t,g),U=h?.isError?"error":h?.isLoading?"loading":"ready";return{id:i.accountId,label:i.email,email:i.email,muted:!!i.muted,outboxPending:d,status:U,onRetry:()=>h?.refetch(),mailboxes:[...u,...K].map(F=>Pe(F,t.get(F.mailboxId),g))}}),[s,m,d,g]),j=i=>{r.invalidateQueries({queryKey:fe({path:{mailboxId:i},query:{order:"desc"}})})},x=({navId:i,className:l,ariaLabel:h,title:b,children:t,onClick:u})=>i==="brief"?e.jsx(v,{to:"/mail/brief",search:{q:void 0},activeOptions:{includeSearch:!1},onClick:()=>u?.(),className:l,"aria-label":h,title:b,children:t}):i==="calendar"?e.jsx(v,{to:"/calendar",onClick:()=>u?.(),className:l,"aria-label":h,title:b,children:t}):i==="outbox"?e.jsx(v,{to:"/mail/outbox",search:{q:void 0},onClick:()=>u?.(),className:l,"aria-label":h,title:b,children:t}):i==="flagged"?e.jsx(v,{to:"/mail/flagged",search:{q:void 0},onClick:()=>u?.(),className:l,"aria-label":h,title:b,children:t}):i==="settings"?e.jsx(v,{to:"/settings/accounts",onClick:()=>u?.(),className:l,"aria-label":h,title:b,children:t}):e.jsx(v,{to:"/mail/$mailboxId",params:{mailboxId:i},search:{q:void 0},onClick:()=>{j(i),u?.()},className:l,"aria-label":h,title:b,children:t}),y=()=>{c(""),a?.()};return e.jsx(Fe,{accounts:k,selectedNavId:o,onSelectNav:y,linkComponent:x,calendarNav:"shown",variant:n})}function _e(){return e.jsxs("button",{type:"button",onClick:me,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(ve,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Report a bug"})]})}function Ke({accounts:s,onMailboxSelect:a}){return he()?.showNavPane??!0?e.jsx(q,{accounts:s}):e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(q,{accounts:s,onMailboxSelect:a,variant:"drawer"})}),e.jsxs("div",{className:"border-t border-line px-2 py-2",children:[e.jsxs(v,{to:"/settings/accounts",onClick:a,children:[e.jsx(Ce,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Settings"})]}),e.jsx(_e,{}),e.jsx(Ie,{children:({signOut:o})=>e.jsxs("button",{type:"button",onClick:()=>{a?.(),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(ke,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Sign out"})]})})]})]})}export{Ie as A,ke as L,Ke as M,Ce as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aa as v,j as s,r as u,al as l,am as p}from"./index-
|
|
1
|
+
import{aa as v,j as s,r as u,al as l,am as p}from"./index-sX1xY_ye.js";import{F as x}from"./FullCompose-CO9Qd5cw.js";import{a as m}from"./useMessageBodyContent-hPuofJUT.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:a,listPath:t}){return!v(a,t)||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:a,hasThread:t=!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:a,intelligenceOpen:e.intelligenceOpen,hasThread:t})}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 $,a0 as ue,r as g,t as K,aB as de,a3 as fe,d9 as me,c6 as xe,ei as ge,ej as he,ek as pe,C as be,el as ve,da as je}from"./index-CwWM67NV.js";import{j as we,n as Ne}from"./search-token-index-B30iFwVb.js";import{u as ye,L as Q}from"./roving-focus-CaY933ER.js";import{a9 as Pe,aa as Re,c as Ce,C as G,ab as Se,m as Ee,ac as Me,ad as ke,ae as Ie,af as Le,ag as Te,ah as ee,ai as ze}from"./MailListHeader-B16BkNe9.js";import{A as Ae}from"./avatar-DReNujdD.js";import{M as Oe}from"./mail-BeRy62_C.js";import{R as De}from"./refresh-cw-T_cDgxoQ.js";import{M as $e}from"./menu-Ii2_MgiT.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 L=72,V=10,We=L/2,J="__swipeableRowAxisCancel";function Z(e){return e==="leading"?L:e==="trailing"?-L:0}function Ye(e){return e>=L/2?"leading":e<=-L/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[J]=!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 T=o.axis==="horizontal"?Math.abs(m):Math.abs(M);if(!o.escaped&&T>We&&(o.escaped=!0,S(i)),o.axis!=="horizontal")return;const F=Z(f),H=Math.max(-L,Math.min(L,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[J]||(x.current=null,h(null))}}),d=j??Z(f),y=d>0?"leading":d<0?"trailing":"none",R=K("relative touch-pan-y bg-surface","select-none",Ce({active:n||u})),A={transform:d!==0?`translateX(${d}px)`:void 0,transition:j===null?"transform 150ms ease":"none",minHeight:44},_=!e.isRead,I=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:I,onPointerMove:I,onPointerUp:I,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(Ae,{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:A,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:A,hideHeader:_=!1}){const I=S==="compact"?ke:Ie,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,T=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,z=r?.onToggle,Y=r?.onRowSelect,ie=Ee(D.size,C),X=g.useCallback(a=>{if(z)return{checked:D.has(a),onToggle:l=>{l.preventDefault(),l.stopPropagation(),z(a)}}},[D,z]),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(I,{thread:a,active:l,focused:a.id===m,tabIndex:T(a.id),selection:X(a.id),onClick:ce=>{B(a.id,ce)||U?.()}}),[I,X,B,m,T]);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(Le,{...h,sections:n,selectedThreadId:P,Row:oe,keyboard:d,onSelectThread:N}):A??(F?s.jsx(Qe,{sections:n,selectedThreadId:P,selectionMode:ie,checkedIds:D,initialPeek:ae,onToggleCheck:a=>z?.(a),onEnterSelection:a=>z?.(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(I,{thread:l,active:l.id===P,focused:l.id===m,tabIndex:T(l.id),selection:X(l.id),onClick:U=>{B(l.id,U)||N?.(l.id)}},l.id))})]},a.id))})),C&&s.jsx(Te,{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"},Je=[["unread",se],["flagged",te],["attachment",ne]],Ze=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 Je)e.attributes.has(c)&&u(p);for(const c of t)u(Ze(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(ze,{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 $,a0 as ue,r as g,t as K,aB as de,a3 as fe,d9 as me,c6 as xe,ei as ge,ej as he,ek as pe,C as be,el as ve,da as je}from"./index-sX1xY_ye.js";import{j as we,n as Ne}from"./search-token-index-zzFp1OWm.js";import{u as ye,L as Q}from"./roving-focus-CPkr5FTJ.js";import{a9 as Pe,aa as Re,c as Ce,C as G,ab as Se,m as Ee,ac as Me,ad as ke,ae as Ie,af as Le,ag as Te,ah as ee,ai as ze}from"./MailListHeader-U5Wr2TGm.js";import{A as Ae}from"./avatar-CVy1NIOI.js";import{M as Oe}from"./mail-Cyr1NbkS.js";import{R as De}from"./refresh-cw-5WZnJ3vE.js";import{M as $e}from"./menu-CQspPBY1.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 L=72,V=10,We=L/2,J="__swipeableRowAxisCancel";function Z(e){return e==="leading"?L:e==="trailing"?-L:0}function Ye(e){return e>=L/2?"leading":e<=-L/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[J]=!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 T=o.axis==="horizontal"?Math.abs(m):Math.abs(M);if(!o.escaped&&T>We&&(o.escaped=!0,S(i)),o.axis!=="horizontal")return;const F=Z(f),H=Math.max(-L,Math.min(L,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[J]||(x.current=null,h(null))}}),d=j??Z(f),y=d>0?"leading":d<0?"trailing":"none",R=K("relative touch-pan-y bg-surface","select-none",Ce({active:n||u})),A={transform:d!==0?`translateX(${d}px)`:void 0,transition:j===null?"transform 150ms ease":"none",minHeight:44},_=!e.isRead,I=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:I,onPointerMove:I,onPointerUp:I,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(Ae,{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:A,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:A,hideHeader:_=!1}){const I=S==="compact"?ke:Ie,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,T=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,z=r?.onToggle,Y=r?.onRowSelect,ie=Ee(D.size,C),X=g.useCallback(a=>{if(z)return{checked:D.has(a),onToggle:l=>{l.preventDefault(),l.stopPropagation(),z(a)}}},[D,z]),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(I,{thread:a,active:l,focused:a.id===m,tabIndex:T(a.id),selection:X(a.id),onClick:ce=>{B(a.id,ce)||U?.()}}),[I,X,B,m,T]);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(Le,{...h,sections:n,selectedThreadId:P,Row:oe,keyboard:d,onSelectThread:N}):A??(F?s.jsx(Qe,{sections:n,selectedThreadId:P,selectionMode:ie,checkedIds:D,initialPeek:ae,onToggleCheck:a=>z?.(a),onEnterSelection:a=>z?.(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(I,{thread:l,active:l.id===P,focused:l.id===m,tabIndex:T(l.id),selection:X(l.id),onClick:U=>{B(l.id,U)||N?.(l.id)}},l.id))})]},a.id))})),C&&s.jsx(Te,{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"},Je=[["unread",se],["flagged",te],["attachment",ne]],Ze=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 Je)e.attributes.has(c)&&u(p);for(const c of t)u(Ze(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(ze,{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};
|