@remit/web-client-dist 0.0.552 → 0.0.554
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-KLlpL-7H.js → BriefPane-DBCL717F.js} +1 -1
- package/assets/{CalendarComposePane-CsWkzDBi.js → CalendarComposePane-PI8kOE2z.js} +1 -1
- package/assets/{CalendarComposeSeed-udz8ANMw.js → CalendarComposeSeed-D1_fV6jC.js} +1 -1
- package/assets/{CalendarShell-WswEc33Y.js → CalendarShell-covO2OG2.js} +1 -1
- package/assets/{EmptyState-D8775COI.js → EmptyState-Lid0f7pw.js} +1 -1
- package/assets/{ErrorState-BUi73q43.js → ErrorState-1AEFpVV9.js} +1 -1
- package/assets/{FlaggedPane-DeZhlWFy.js → FlaggedPane-DMQLRHsY.js} +1 -1
- package/assets/{FullCompose-C8dlsR-Q.js → FullCompose-DpRKig4Y.js} +1 -1
- package/assets/{MailListHeader-BJX8BuyA.js → MailListHeader-BcoBd9rJ.js} +1 -1
- package/assets/{MailNav-DpCROJMP.js → MailNav-D7mUELnZ.js} +1 -1
- package/assets/{MailShell-CMOL8AKI.js → MailShell-I-okrL27.js} +1 -1
- package/assets/{MailViewChrome-CaqCUxFx.js → MailViewChrome-BQhkNcYQ.js} +1 -1
- package/assets/{MailboxPane-BgjcYu1t.js → MailboxPane-Fuv5K7gr.js} +1 -1
- package/assets/{NavMenuButton-CVdc16Vd.js → NavMenuButton-ConMnR9q.js} +1 -1
- package/assets/{OnboardingWizard-BJ_im7-I.js → OnboardingWizard-DYXq3mAL.js} +1 -1
- package/assets/{OpenCalendarEvent-BGfbdWGu.js → OpenCalendarEvent-C_s8p7f1.js} +1 -1
- package/assets/{OutboxPane-Dd-mfB0h.js → OutboxPane-CuCGEEjI.js} +1 -1
- package/assets/_calendarObjectId-DBz0O-Kf.js +1 -0
- package/assets/_mailboxId-DM24NRbb.js +1 -0
- package/assets/_messageId-CIACTHif.js +1 -0
- package/assets/_messageId-CmkKhQXx.js +1 -0
- package/assets/_messageId-DWKpZtdf.js +1 -0
- package/assets/_outboxMessageId-CAHB_g-i.js +1 -0
- package/assets/_recurrenceId-CGb4bCZ1.js +1 -0
- package/assets/_threadId-1EJoGcWl.js +1 -0
- package/assets/_threadId-90EeTX71.js +1 -0
- package/assets/_threadId-CG3toZ0E.js +1 -0
- package/assets/{_view._date-ByRpWyOf.js → _view._date-B1ykuxxQ.js} +1 -1
- package/assets/{accounts-rX_ZGBrU.js → accounts-CcHS46av.js} +1 -1
- package/assets/{advanced--feucAHp.js → advanced-Cuevy6B1.js} +1 -1
- package/assets/{appearance-BzFLOBIM.js → appearance-CbfXH4mb.js} +1 -1
- package/assets/{attachment-file-B5mkzgR1.js → attachment-file-B2UKsV5r.js} +1 -1
- package/assets/{attendee-row-BeKlhe0A.js → attendee-row-DOf4ELr4.js} +1 -1
- package/assets/{avatar-Dso3OQH7.js → avatar-DTVmcxcO.js} +1 -1
- package/assets/{bottom-sheet-BX-sJ8v6.js → bottom-sheet-DjH39AOw.js} +1 -1
- package/assets/{brief-BqBII2NQ.js → brief-CSLv59zN.js} +1 -1
- package/assets/brief-D6kbfLeo.js +1 -0
- package/assets/{browser-ponyfill-h0JbYDKj.js → browser-ponyfill-BLd7KUJk.js} +1 -1
- package/assets/{bug-B-341whi.js → bug-CjKnpWcM.js} +1 -1
- package/assets/{calendar-CkW9BQ4L.js → calendar-BP1OTpOR.js} +1 -1
- package/assets/{calendar-color-BG7928-_.js → calendar-color-CUVJPwWZ.js} +1 -1
- package/assets/{calendar-event-chip-CoD7r2-a.js → calendar-event-chip-DgEDU3zQ.js} +1 -1
- package/assets/{calendars-DCTcgC1a.js → calendars-D9uCLlvR.js} +1 -1
- package/assets/{card-CPhaopb5.js → card-DV4eeYu9.js} +1 -1
- package/assets/chevron-left-DNbu4pjA.js +1 -0
- package/assets/{circle-check-CLuBMQlt.js → circle-check-DZFVocRs.js} +1 -1
- package/assets/{circle-check-big-C-MjzzMN.js → circle-check-big-Cy6G2Ron.js} +1 -1
- package/assets/{circle-help-DpcwUo3O.js → circle-help-B0-Zl4Fb.js} +1 -1
- package/assets/{clock-DycMqInq.js → clock-CvfP2vCf.js} +1 -1
- package/assets/compose._-_outboxMessageId_-5xacVsVg.js +1 -0
- package/assets/compose._-_outboxMessageId_-ChWPCIC-.js +1 -0
- package/assets/compose._-_outboxMessageId_-CwsrnOXs.js +1 -0
- package/assets/compose._-_outboxMessageId_-RCfHvqmb.js +1 -0
- package/assets/{config-import-CUYN2G7f.js → config-import-DS8-ZFIV.js} +1 -1
- package/assets/{confirm-dialog-C_t09Gva.js → confirm-dialog-D73kfago.js} +1 -1
- package/assets/{copy-DXbRkbsg.js → copy-qZMfxjuy.js} +1 -1
- package/assets/{credential-steps-BPMPrFp_.js → credential-steps-DShvsMfV.js} +1 -1
- package/assets/{download-9A_DQZED.js → download-DnRyHHzH.js} +1 -1
- package/assets/{file-json-DhoZdq39.js → file-json-DZWFVI19.js} +1 -1
- package/assets/{filters-BsLKH-KQ.js → filters-BULzkf8W.js} +1 -1
- package/assets/flagged-BQo7mGYq.js +1 -0
- package/assets/{flagged-CG6WICxW.js → flagged-C6dWqFVv.js} +1 -1
- package/assets/{folders-D0x6C1Ck.js → folders-BPaWxe1M.js} +1 -1
- package/assets/{format-C58wplMJ.js → format-C4quyWkL.js} +1 -1
- package/assets/{help-copy-BuBfUFvN.js → help-copy-BHB8xX9T.js} +1 -1
- package/assets/{import-BnuIvvYO.js → import-DmNgjDAj.js} +1 -1
- package/assets/index-BXaD01mY.js +1 -0
- package/assets/index-C24QBJPn.js +1 -0
- package/assets/{index-_JBKtYXu.js → index-CerSmEHP.js} +4 -4
- package/assets/index-ClUCSSYb.js +1 -0
- package/assets/index-DPZVxdmV.js +1 -0
- package/assets/index-DV-4D5Wk.js +1 -0
- package/assets/index-DWKpZtdf.js +1 -0
- package/assets/{index-DoJ8vs9_.js → index-DcP9T46-.js} +1 -1
- package/assets/{index-CAWCA7kp.js → index-DoR-Emr2.js} +4 -4
- package/assets/index-_8IKuQQK.js +1 -0
- package/assets/index-cabAtRDz.js +1 -0
- package/assets/index-xUFa13qB.js +1 -0
- package/assets/{kbd-CUNCsdLt.js → kbd-ByOT_79e.js} +1 -1
- package/assets/{labels-BY9SfPtP.js → labels-BOAIhH8k.js} +1 -1
- package/assets/{mail-B73P70rO.js → mail-BCrpelR0.js} +1 -1
- package/assets/{mail-CArT0__I.js → mail-D1irOTYN.js} +1 -1
- package/assets/{map-pin-CEP5uZHA.js → map-pin-DkZcTvpk.js} +1 -1
- package/assets/{menu-CyMA8ejK.js → menu-DDlTUM4q.js} +1 -1
- package/assets/{new-RJZncfFf.js → new-BqAZx4OJ.js} +1 -1
- package/assets/onboarding-BuoV8Vny.js +1 -0
- package/assets/{onboarding-completion-FFjKdakA.js → onboarding-completion-N1IL1SOV.js} +1 -1
- package/assets/outbox-DEYZbhpV.js +1 -0
- package/assets/{pencil-C8wWVDp1.js → pencil-qmP85-yp.js} +1 -1
- package/assets/{refresh-cw-Mvz24VPI.js → refresh-cw-C7SXfZwg.js} +1 -1
- package/assets/{rich-text-D67UO7zJ.js → rich-text-8iJT0xTo.js} +1 -1
- package/assets/{rich-text-spellcheck-worker-provider-DKCw8H_J.js → rich-text-spellcheck-worker-provider-CB4ZEn8f.js} +1 -1
- package/assets/{rotate-ccw-ByXIAEyt.js → rotate-ccw-D2T8klE4.js} +1 -1
- package/assets/{roving-focus-R7ZTRnKj.js → roving-focus-CIEZcQt8.js} +1 -1
- package/assets/{row-actions-BsCd_UKz.js → row-actions-C43CxrJy.js} +1 -1
- package/assets/{search-mirror-CJOCjfkC.js → search-mirror-RfszZC8o.js} +1 -1
- package/assets/{search-token-index-U-0PE-Ox.js → search-token-index-C7yiTbjS.js} +1 -1
- package/assets/{sections-Bz1Hz1WB.js → sections-C3f119Qp.js} +1 -1
- package/assets/{senders-CRjKU72H.js → senders-BOo1No5m.js} +1 -1
- package/assets/settings-Cwk31Oal.js +1 -0
- package/assets/{settings-screen-BmT3r6tg.js → settings-screen-DJLhdh5G.js} +1 -1
- package/assets/{shield-check-WkiJUavf.js → shield-check-DDMn9XEz.js} +1 -1
- package/assets/{suggested-vips-DLM7277B.js → suggested-vips-BYKrMNav.js} +1 -1
- package/assets/{useCalendarData-CxT_7y0k.js → useCalendarData-Bhp4uw4W.js} +1 -1
- package/assets/{useCalendars-dRe0PNET.js → useCalendars-DbaB4Co9.js} +1 -1
- package/assets/{useDebouncedValue-DYu0unJr.js → useDebouncedValue-D6bTZtg_.js} +1 -1
- package/assets/{useFilters-BDQsNdKM.js → useFilters-CVCfjrGd.js} +1 -1
- package/assets/{useLabels-DIvHKWeo.js → useLabels-Ddwxl5fU.js} +1 -1
- package/assets/{useLayoutTier-D1c62D6O.js → useLayoutTier-r3F9HmT3.js} +1 -1
- package/assets/{useMessageBodyContent-ChO4c73P.js → useMessageBodyContent-BDww0y-S.js} +1 -1
- package/assets/{useQueries-DNMW1lkL.js → useQueries-Dr3bjsuu.js} +1 -1
- package/assets/{useRefreshControl-hwJW949Z.js → useRefreshControl-2fCG36Yb.js} +1 -1
- package/assets/{useResultFolderIndex-C-1ZYMvt.js → useResultFolderIndex-DsR1L5y3.js} +1 -1
- package/assets/{useSearchTokenContext-Du649zXC.js → useSearchTokenContext-BQfR3lc9.js} +1 -1
- package/assets/{useSemanticSearch-Dkvkustt.js → useSemanticSearch-5Y5Jgkc8.js} +1 -1
- package/assets/{useSignature-CkDxKXxk.js → useSignature-aLNxMOAG.js} +1 -1
- package/assets/{window-CT3glB3e.js → window-5V8GE5pm.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/_calendarObjectId-BI57QUkI.js +0 -1
- package/assets/_mailboxId-B2c8yk-P.js +0 -1
- package/assets/_messageId-BiRjaSGS.js +0 -1
- package/assets/_messageId-CfZiEhfq.js +0 -1
- package/assets/_messageId-DRWKKgAe.js +0 -1
- package/assets/_outboxMessageId-DHeCkE_E.js +0 -1
- package/assets/_recurrenceId-CZXJ1ipm.js +0 -1
- package/assets/_threadId-BpHQ4umN.js +0 -1
- package/assets/_threadId-CG2H5qxG.js +0 -1
- package/assets/_threadId-DZe74h9F.js +0 -1
- package/assets/brief-1BFpZzpI.js +0 -1
- package/assets/chevron-left-C0OrzYvI.js +0 -1
- package/assets/compose._-_outboxMessageId_-BKdOnGgE.js +0 -1
- package/assets/compose._-_outboxMessageId_-C5J40rof.js +0 -1
- package/assets/compose._-_outboxMessageId_-CHg6RCur.js +0 -1
- package/assets/compose._-_outboxMessageId_-CecgSs9p.js +0 -1
- package/assets/flagged-Be5oNxz8.js +0 -1
- package/assets/index-CBQb_AiQ.js +0 -1
- package/assets/index-Cg9FFpxv.js +0 -1
- package/assets/index-D4oNqihE.js +0 -1
- package/assets/index-DCnzuDfm.js +0 -1
- package/assets/index-DRWKKgAe.js +0 -1
- package/assets/index-DnQf9APo.js +0 -1
- package/assets/index-DnzPPKUB.js +0 -1
- package/assets/index-Dst_2SBO.js +0 -1
- package/assets/index-ipkUvHk0.js +0 -1
- package/assets/onboarding-aoafNXL7.js +0 -1
- package/assets/outbox-BF-J9hLg.js +0 -1
- package/assets/settings-DptY6F_3.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r,L as Tt,T as wt,ea as _e,eb as ue,ch as me,r as n,c as Qe,C as J,bh as Rt,cL as Mt,G as jt,dy as kt,ec as Et,Z as ze,dU as At,ed as Ft,ai as Ot,cS as Nt,cT as Bt}from"./index-_JBKtYXu.js";import{g as Ge,e as Lt,f as He,u as qt,p as Pt,R as Dt}from"./useSearchTokenContext-Du649zXC.js";import{ac as _t,G as Qt,I as zt,ap as Gt,aq as Ht,ar as Kt,as as Ut,at as Wt,au as Fe,av as Yt,aw as $t,ax as Vt,ab as Zt,ay as Jt,az as Xt,aA as es,aj as ts,M as ss,aB as os,ak as rs,aC as ns,aD as as,e as is,w as cs,am as ls,s as ds,S as us,O as ms,T as Oe,R as fs,P as hs,d as gs,a0 as ps,a1 as xs,a3 as Ke,a4 as Ue,a5 as Is,a6 as ys,a7 as bs}from"./MailListHeader-BJX8BuyA.js";import{u as vs,a as Ss,R as Cs,b as Ts,c as ws}from"./useRefreshControl-hwJW949Z.js";import{u as fe}from"./useQueries-DNMW1lkL.js";import{t as Rs,u as Ms,r as js,L as ks}from"./useSemanticSearch-Dkvkustt.js";import{a as Es}from"./useLabels-DIvHKWeo.js";import{u as As,b as Fs}from"./useLayoutTier-D1c62D6O.js";import{d as Os,w as Ns}from"./wizard-selection-DxUM65kM.js";import{u as We}from"./sections-Bz1Hz1WB.js";import{R as Bs}from"./refresh-cw-Mvz24VPI.js";import{a as Ls}from"./useMessageBodyContent-ChO4c73P.js";import{g as qs,h as Ps}from"./search-token-index-U-0PE-Ox.js";function Ds({sync:e}){return e?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",role:"status","aria-live":"polite",children:[r.jsx(Tt,{className:"size-8 animate-spin text-fg-subtle","aria-hidden":"true"}),r.jsx("p",{className:"text-sm font-medium text-fg",children:"Still syncing your mail"}),r.jsx("p",{className:"text-xs text-fg-subtle",children:_s(e)})]}):r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",children:[r.jsx(wt,{className:"size-8 text-fg-subtle","aria-hidden":"true"}),r.jsx("p",{className:"text-sm font-medium text-fg",children:"You're caught up"}),r.jsx("p",{className:"text-xs text-fg-subtle",children:"Nothing needs attention."})]})}function _s({synced:e,total:t}){return t>0?`${e.toLocaleString()} of ${t.toLocaleString()} messages downloaded. This list fills in as they arrive.`:"Downloading your messages. This list fills in as they arrive."}const Ye=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],$e="category",Qs={unclassified:"uncategorized"},G=e=>Lt(e).map(t=>t.raw),z=e=>e.join(" "),he=e=>{const t=He(e);if(t)return Ye.find(o=>o.name===t.name&&o.value===t.value.toLowerCase())?.id},ge=e=>{const t=He(e);if(!t||t.name!==$e)return;const o=t.value.toLowerCase(),a=Qs[o];if(a)return a;if(!(!_e(o)||o==="all"))return o},Ve=e=>Ye.find(t=>t.id===e),Ze=e=>Ve(e)!==void 0,zs=e=>{const t=new Set;for(const o of G(e)){const a=he(o);a&&t.add(a)}return t},Gs=e=>{let t="all";for(const o of G(e)){const a=ge(o);a&&(t=a)}return t},Hs=(e,t)=>{const o=Ve(t);if(!o)return;const a=G(e),c=a.filter(d=>he(d)!==t);return c.length<a.length?z(c):z([...a,Ge(o.name,o.value)])},Ks=(e,t)=>{const o=G(e).filter(a=>!ge(a));return z(t==="all"?o:[...o,Ge($e,t)])},Us=e=>z(G(e).filter(t=>!he(t)&&!ge(t))),Je=e=>e.trim().length>0,Ne=e=>{if(!Je(e.query))return e.ownFilters;const t=new Set(zs(e.query));for(const o of e.ownFilters)Ze(o)||t.add(o);return t},Be=e=>Je(e.query)?Gs(e.query):e.ownCategory,Le=6e4,Ws=3e4,Ys={kind:"unknown"},qe=e=>(t,o)=>_t(o?.queryKey,e)?t:void 0,$s=(e,t,o)=>({...e,category:[t],limit:o,order:"desc"}),Vs=(e,t)=>({...e,category:[t],order:"desc",count:!0,results:!1}),Pe=(e,t)=>({category:[t],...e.unread!==void 0?{unread:e.unread}:{},...e.starred!==void 0?{starred:e.starred}:{},...e.attachments!==void 0?{attachments:e.attachments}:{}});function Zs({categories:e,criteria:t,limit:o,counted:a}){const c=fe({queries:e.map(m=>{const f=$s(t,m,o),g=Pe(t,m);return{queryKey:me({query:f}),queryFn:async()=>{const{data:T}=await ue({query:f,throwOnError:!0});return T},placeholderData:qe(g),staleTime:Le}})}),d=fe({queries:e.map(m=>{const f=Vs(t,m),g=Pe(t,m);return{queryKey:me({query:f}),queryFn:async()=>{const{data:T}=await ue({query:f,throwOnError:!0});return T},enabled:a,placeholderData:qe(g),staleTime:Le}})}),l=n.useMemo(()=>e.map((m,f)=>{const g=c[f],T=d[f],I=g?.data?.items??[];return{category:m,rows:I,atCap:I.length>=o,total:a?Rs(T?.data?.count):Ys,loading:g?.isPending??!0,failed:g?.isError??!1,retry:()=>{g?.refetch(),a&&T?.refetch()}}}),[e,c,d,a,o]),u=n.useCallback(()=>{for(const m of c)m.refetch();for(const m of d)m.refetch()},[c,d]);return{sections:l,isLoading:c.length>0&&c.every(m=>m.isPending),isError:c.length>0&&c.every(m=>m.isError),refetch:u}}function Js(e,t,o){const a={...e,limit:t,order:"desc"},{data:c,isLoading:d,isError:l,refetch:u}=Qe({queryKey:me({query:a}),queryFn:async()=>{const{data:f}=await ue({query:a,throwOnError:!0});return f},enabled:o,staleTime:Ws});return{rows:n.useMemo(()=>o?c?.items??[]:[],[c,o]),isLoading:o&&d,isError:o&&l,refetch:n.useCallback(()=>{u()},[u])}}const Xs=(e,t)=>e.createdAt!==t.createdAt?e.createdAt-t.createdAt:e.accountId.localeCompare(t.accountId),eo=e=>[...e].sort(Xs),to=["category","unread","starred","attachments"],Xe=["contacts","today"],so=e=>new Set(Xe.filter(t=>e.has(t))),oo=(e,t,o)=>{const a=Qt({category:e,attributes:t}),{params:c,residual:d}=zt(o,a,to),l={...c,...a},u={};return l.unread!==void 0&&(u.unread=l.unread),l.starred!==void 0&&(u.starred=l.starred),l.attachments!==void 0&&(u.attachments=l.attachments),{criteria:u,residual:d}},ro=({residual:e,attributes:t,accountScoped:o})=>e.length===0&&!o&&!Xe.some(a=>t.has(a)),no=50,ao=200,io=[],De=()=>r.jsx("div",{className:"animate-pulse",children:Array.from({length:3}).map((e,t)=>r.jsxs("div",{className:"flex items-start gap-3 py-2 pl-5 pr-4 border-b border-line",children:[r.jsx("div",{className:"size-7 rounded-full bg-surface-sunken shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1 space-y-1.5",children:[r.jsxs("div",{className:"flex justify-between gap-2",children:[r.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-28"}),r.jsx("div",{className:"h-3 bg-surface-sunken rounded w-12"})]}),r.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-48"}),r.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})]})]},t))}),co=({accountEmail:e})=>{const t=We();return r.jsxs("div",{className:"flex items-center gap-2 px-row-inset py-2 border-b border-line bg-danger-soft/40 text-xs text-danger",children:[r.jsx(ze,{className:"size-3.5 shrink-0"}),r.jsxs("span",{className:"flex-1 truncate",children:[e," can't connect"]}),r.jsx("button",{type:"button",onClick:()=>t("accounts"),className:"shrink-0 underline text-danger hover:opacity-80",children:"Reconnect"})]})},lo=(e,t)=>{if(t.size===0)return{};const o=e.filter(d=>t.has(d.id)),a=js(o.map(d=>d.accountId));if(a.restriction)return a;const c=new Set;for(const d of o)d.mailboxId&&c.add(d.mailboxId);return c.size>1?{accountId:a.accountId,restriction:"spansFolders",moveDisabledHint:`Move only works within one folder — this selection spans ${c.size} folders`}:{accountId:a.accountId,mailboxId:c.size===1?[...c][0]:void 0}};function uo({header:e,rows:t,wizard:o,children:a}){const{selectedIds:c,selectedCount:d,exitSelection:l,orderedIds:u,allSelected:m,toggleAllLoaded:f}=as(),g=n.useMemo(()=>lo(t,c),[t,c]),{junkMailboxId:T}=is(g.accountId),{labels:I}=Es(g.accountId),b=n.useMemo(()=>Array.from(c),[c]),B=n.useMemo(()=>Ns(t,c),[t,c]),p=cs(T,g.mailboxId),v=n.useMemo(()=>u.length>0?{checked:m,indeterminate:d>0&&!m,onChange:f}:void 0,[u.length,m,d,f]),F=g.moveDisabledHint?{tone:"warning",text:g.moveDisabledHint}:void 0,S=R=>r.jsx(us,{title:R.title,navSlot:R.navSlot,titleMeta:R.titleMeta,searchSlot:R.searchSlot,searchField:R.searchField,idleSlot:R.makeFilterSlot,count:d,onCancel:l,onDelete:()=>o.start("delete"),onMove:()=>o.start("move"),onOrganize:()=>o.start("organize"),onJunk:p?()=>o.start("junk"):void 0,onMarkRead:()=>o.start("markRead"),overflowSlot:g.accountId&&g.mailboxId&&d>0&&I.length>0?r.jsx(ks,{accountId:g.accountId,mailboxId:g.mailboxId,messageIds:b}):void 0,selectAll:v,notice:F});return r.jsx(ls,{...e,selectionBar:S,paneOverlay:r.jsx(ds,{verb:o.verb,accountId:g.accountId,mailboxId:g.mailboxId,selection:B,selectionRestriction:g.restriction,onFinished:l}),children:a})}function mo({accounts:e,selectedMessageId:t,onOpenThread:o,commandsRef:a,onTriageContextChange:c,onDeleteMessages:d}){const{searchQuery:l,searchInput:u,resultFolderIndex:m,onSearchChange:f}=J(),g=qt(),T=Rt(),I=As(),b=Mt(),B=Fs(),p=n.useMemo(()=>eo(e.filter(s=>!s.muted?.value)),[e]),[v,F]=n.useState("all"),[S,R]=n.useState("all"),[O,L]=n.useState(new Set),[ee,M]=n.useState(!1),q=n.useCallback(s=>{L(i=>{const h=new Set(i);return h.has(s)?h.delete(s):h.add(s),h})},[]),H=n.useCallback(()=>L(new Set),[]),E=u.trim().length>0,{freeText:j,tokens:P}=Pt(l.trim().toLowerCase(),g),y=j.length>0,D=n.useMemo(()=>Ne({query:u,ownFilters:O}),[u,O]),_=n.useMemo(()=>Be({query:u,ownCategory:S}),[u,S]),A=n.useMemo(()=>Ne({query:l,ownFilters:O}),[l,O]),C=n.useMemo(()=>Be({query:l,ownCategory:S}),[l,S]),x=n.useCallback(s=>{if(!E||!Ze(s)){q(s);return}const i=Hs(u,s);i!==void 0&&f(i)},[E,u,f,q]),k=n.useCallback(s=>{if(!E){R(s);return}f(Ks(u,s))},[E,u,f]),te=n.useMemo(()=>C==="all"&&!y?s=>{_e(s)&&k(s)}:void 0,[C,y,k]),se=n.useCallback(()=>{R("all"),F("all"),H(),E&&f(Us(u))},[E,u,f,H]),K=fe({queries:p.map(s=>({...jt({path:{accountId:s.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),U=n.useMemo(()=>{const s=new Map;for(let i=0;i<p.length;i++){const h=p[i].accountId,vt=(K[i]?.data?.items??[]).reduce((St,Ct)=>St+(Ct.unseenCount??0),0);s.set(h,vt)}return s},[p,K]),st=n.useMemo(()=>p.filter((s,i)=>{const h=K[i];return h?.isError?!kt(h.error):!1}),[p,K]),{criteria:oe,residual:re}=n.useMemo(()=>oo(C,A,P),[C,A,P]),ot=n.useMemo(()=>C==="all"?[...Gt]:[C],[C]),rt=n.useMemo(()=>({...oe,query:j,...C==="all"?{}:{category:[C]}}),[oe,j,C]),nt=ro({residual:re,attributes:A,accountScoped:v!=="all"}),{sections:W,isLoading:at,isError:it,refetch:pe}=Zs({categories:y?io:ot,criteria:oe,limit:C==="all"?ns:no,counted:nt}),{rows:xe,isLoading:ct,isError:lt,refetch:Ie}=Js(rt,ao,y),ne=y?ct:at,ye=y?lt:it,be=n.useCallback(()=>{if(y){Ie();return}pe()},[y,Ie,pe]),ve=n.useMemo(()=>so(A),[A]),Y=n.useCallback(s=>Os(Ht(s)).map(Kt).filter(i=>(v==="all"||i.accountId===v)&&Et(i,ve)&&Ut(i,re)),[v,ve,re]),$=n.useMemo(()=>W.map(s=>({category:s.category,total:Wt(s.total,s.rows),atCap:s.atCap,loading:s.loading,failed:s.failed,rows:Y(s.rows)})),[W,Y]),V=n.useMemo(()=>Y(xe),[xe,Y]),dt=n.useCallback(s=>{W.find(i=>i.category===s)?.retry()},[W]),w=n.useMemo(()=>y?V:$.flatMap(s=>s.rows),[y,V,$]),{spamIds:ae,briefSpamOffer:ie}=n.useMemo(()=>{const s={spamIds:void 0,briefSpamOffer:void 0};if(!j)return s;const i=w.map(N=>Fe(N,m)),{spam:h}=Yt(i);return h.length===0?s:{spamIds:new Set(h.map(N=>N.id)),briefSpamOffer:$t(i)}},[w,j,m]),Se=n.useMemo(()=>{const s=i=>ae===void 0?i:i.filter(h=>!ae.has(h.id));return y?[{id:"matches",threads:s(V)}]:Vt($.map(i=>({...i,rows:s(i.rows)})))},[y,V,$,ae]),Ce=n.useCallback((s,i)=>{const h=w.find(N=>N.id===s)?.threadId;h&&o?.({threadId:h,messageId:s},i)},[w,o]),ut=n.useCallback(s=>{const i=s.threadId??w.find(h=>h.id===s.id)?.threadId;i&&o?.({threadId:i,messageId:s.id})},[w,o]),ce=n.useMemo(()=>p.length<=1?[]:[{id:"all",label:"All",active:v==="all"},...p.map(s=>({id:s.accountId,label:s.email.split("@")[0]??s.email,count:U.get(s.accountId),active:v===s.accountId}))],[p,U,v]),Q=n.useMemo(()=>e.filter(s=>s.muted?.value).length,[e]),mt=n.useMemo(()=>Array.from(U.values()).reduce((s,i)=>s+i,0),[U]),le=n.useMemo(()=>p.map(s=>s.accountId),[p]),{hasNewMail:Te}=vs(),{state:we,errorMessage:Re,refresh:Me}=Ss(le,{onSettled:()=>be()}),ft=n.useMemo(()=>r.jsx(Cs,{state:we,onRefresh:Me,label:"Refresh daily brief",errorMessage:Re,hasUpdate:Te(le)}),[we,Me,Re,Te,le]),de=n.useMemo(()=>w.map(s=>Fe(s,m)),[w,m]),{hits:je,isLoading:ht}=Ms(),gt=n.useMemo(()=>{const s=new Map(w.map(h=>[h.id,h.threadId])),i=de.map(h=>s.get(h.id)).filter(h=>h!=null);return Zt(je,i,m)},[je,de,w,m]),pt=n.useMemo(()=>{const s=Jt(ce.map(i=>({id:i.id,label:i.label,count:i.count,active:i.active})));return{categories:s.categories,filters:s.filters,sources:s.sources,sourcesNote:Q>0?`+${Q} muted`:void 0,selectedCategory:_,activeFilters:D,expanded:ee,onExpandedChange:M,onSelectCategory:i=>k(i),onSelectSource:F,onToggleFilter:i=>x(i),onClear:se}},[ce,Q,_,D,ee,x,k,se]),ke=Se.length===0&&v==="all"&&j.length===0&&P.length===0,xt=n.useMemo(()=>p.map(s=>s.accountId),[p]),It=n.useMemo(()=>p.some(s=>Ts(s.syncPhase)),[p]),Z=ws(xt,ke||It),Ee=r.jsxs("div",{className:"h-full overflow-y-auto",children:[r.jsx(De,{}),r.jsx(De,{})]}),Ae=!ne&&!ye&&!ke,yt=Xt({tier:I,hasLiveInput:E,hasCommittedQuery:l.trim().length>0,bodyRendersCommittedResults:!0}),bt=Ae?r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[ie&&r.jsx(es,{count:ie.count,onScopeToSpam:()=>B(ie.mailboxId,l)}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(ts,{sections:Se,briefCategory:_,Row:ss,selectedThreadId:t,onSelectThread:Ce,onShowAllSection:te,onRetrySection:dt,flat:y,onSelectBriefCategory:k,sources:ce,sourcesNote:Q>0?`+${Q} muted`:void 0,onSelectSource:F,activeFilters:D,onToggleFilter:x,onClearFilters:se})})]}):ne?Ee:ye?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 py-12 text-sm text-fg-muted",children:[r.jsx(ze,{className:"size-8 text-danger"}),r.jsx("p",{children:"Couldn't load your messages"}),r.jsxs("button",{type:"button",onClick:()=>be(),className:"flex items-center gap-1 text-accent underline text-xs",children:[r.jsx(Bs,{className:"size-3.5"}),"Try again"]})]}):Z.resolved?r.jsx(Ds,{sync:Z.syncing?{synced:Z.synced,total:Z.total}:void 0}):Ee;return r.jsx(At,{hasSheet:Ae&&!yt,children:r.jsx(os,{selectedMessageId:t,rows:w,onOpen:Ce,onDeleteMessages:d,onSelectionVerb:b.start,commandsRef:a,onTriageContextChange:c,children:r.jsx(uo,{wizard:b,header:{title:"Daily brief",unreadCount:mt,footer:T?r.jsx(rs,{}):void 0,searchFilter:pt,searchResults:de,searchLoading:ne,relatedResults:gt,relatedLoading:ht,onSelectSearchResult:ut,searchResultsInBody:!0,refreshControl:ft},rows:w,children:r.jsxs("div",{className:"flex h-full flex-col",children:[st.map(s=>r.jsx(co,{accountEmail:s.email,accountId:s.accountId},s.accountId)),r.jsx("div",{className:"min-h-0 flex-1",children:bt})]})})})})}const et=n.createContext(null);function X(){const e=n.useContext(et);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function fo({thread:e,children:t}){const o=qs(),a=Ps(),c=We(),{searchInput:d}=J(),l=e?.threadId,u=e?.messageId,{data:m}=Qe({...Ft(),staleTime:6e4}),f=n.useMemo(()=>m?.items??[],[m]),g=n.useMemo(()=>{if(l)return f.find(x=>x.messageId===u)??f.find(x=>x.threadId===l)},[f,l,u]),T=ms(l,u),I=g??T,b=u??I?.messageId,B=n.useMemo(()=>{if(l)return{threadId:l,mailboxId:I?.mailboxId??"",subject:I?.subject,messageId:b,authenticity:I?.authenticity}},[l,I,b]),p=n.useCallback((x,k)=>{o(x,{replace:k?.replace,query:d})},[o,d]),v=n.useCallback(x=>{b&&x.includes(b)&&a()},[b,a]),F=Oe({thread:I,isOpen:!0,onAfterOptimisticRemove:v}),S=fs(),{deleteMessages:R}=hs({mailboxId:I?.mailboxId??"",messages:f,onAfterOptimisticRemove:v}),{toggleReadFor:O}=gs({mailboxId:I?.mailboxId??"",messages:f}),L=S.focusedMessageId,M=n.useMemo(()=>f.find(x=>x.messageId===L),[f,L])??I,q=Oe({thread:M,isOpen:M?.messageId===b}),H=Ls(),E=Ot(),j=Nt(),P=n.useMemo(()=>Bt(j,l,b),[j,l,b]),y=n.useMemo(()=>{if(M)return x=>j({threadId:M.threadId,messageId:M.messageId,mode:x})},[j,M]),{nextMessageId:D,previousMessageId:_}=ps({context:S,orderedIds:S.orderedIds,selectedMessageId:b,enabled:!H&&!E,hasOpenThread:l!==void 0,onClose:a,handlers:{reply:()=>y?.("reply"),replyAll:()=>y?.("reply-all"),forward:()=>y?.("forward"),delete:()=>{S.listCommandsRef.current?.requestVerb("delete")||q.deleteThread()},toggleStar:q.toggleStar,toggleRead:()=>{S.listCommandsRef.current?.requestVerb("markRead")||M&&O([M.messageId],!M.isRead)},goFlagged:()=>c("flagged"),goSettings:()=>c("settings")}}),A=n.useCallback(x=>{if(!x)return;const k=f.find(te=>te.messageId===x);return k?{threadId:k.threadId,messageId:x}:void 0},[f]),C={selectedMessageId:b,selectedThread:I,conversation:B,onOpenThread:p,onCloseThread:a,nextThread:A(D),previousThread:A(_),actions:F,onReply:P,triage:S,onDeleteMessages:R,handleDeselectIfRemoved:v};return r.jsx(et.Provider,{value:C,children:t})}function tt(){const{selectedMessageId:e,onOpenThread:t,triage:o,onDeleteMessages:a}=X(),{accounts:c}=J();return r.jsx(mo,{accounts:c,selectedMessageId:e,onOpenThread:t,commandsRef:o.listCommandsRef,onTriageContextChange:o.onTriageContextChange,onDeleteMessages:a})}function ho(){const{conversation:e,selectedThread:t,actions:o,onReply:a,handleDeselectIfRemoved:c}=X(),d=!!e,l=ys(e?.threadId);return r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[r.jsx(bs,{hasThread:d,intelligenceOpen:l.isShowing,canToggleIntelligence:l.canToggle,onToggleIntelligence:l.toggle,onReply:a?()=>a("reply"):void 0,onReplyAll:a?()=>a("reply-all"):void 0,onForward:a?()=>a("forward"):void 0,onDelete:d?o.deleteThread:void 0,onToggleStar:d?o.toggleStar:void 0,isStarred:o.isStarred,moveContext:d&&o.accountId&&o.mailboxId?{accountId:o.accountId,currentMailboxId:o.mailboxId,onMove:o.moveThread}:void 0}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?r.jsx(Ke,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:l.open,listOnScreen:!0}):r.jsx(Dt,{})})]}),r.jsx(Ue,{isOpen:l.drawerOpen,onClose:l.closeDrawer,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:c})]})}function go(){const{selectedThread:e,handleDeselectIfRemoved:t}=X(),{onToggleIntelligence:o}=J();return r.jsx(Is,{onClose:o,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function po(){const{selectedThread:e,conversation:t,onOpenThread:o,onCloseThread:a,nextThread:c,previousThread:d,handleDeselectIfRemoved:l}=X(),u=xs(t?.threadId??null);return t?r.jsxs(r.Fragment,{children:[r.jsx(Ke,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:a,onOpenIntelligence:u.toggle,onSwipeNext:c?()=>o(c):void 0,onSwipePrevious:d?()=>o(d):void 0,mobileIntelligenceOpen:u.isOpen}),r.jsx(Ue,{isOpen:u.isOpen,onClose:u.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:l})]}):r.jsx("div",{className:"h-full",children:r.jsx(tt,{})})}const Eo=Object.assign(fo,{List:tt,Reading:ho,Intelligence:go,Phone:po});export{Eo as B};
|
|
1
|
+
import{j as r,L as Tt,T as wt,ea as _e,eb as ue,ch as me,r as n,c as Qe,C as J,bh as Rt,cL as Mt,G as jt,dy as kt,ec as Et,Z as ze,dU as At,ed as Ft,ai as Ot,cS as Nt,cT as Bt}from"./index-CerSmEHP.js";import{g as Ge,e as Lt,f as He,u as qt,p as Pt,R as Dt}from"./useSearchTokenContext-BQfR3lc9.js";import{ac as _t,G as Qt,I as zt,ap as Gt,aq as Ht,ar as Kt,as as Ut,at as Wt,au as Fe,av as Yt,aw as $t,ax as Vt,ab as Zt,ay as Jt,az as Xt,aA as es,aj as ts,M as ss,aB as os,ak as rs,aC as ns,aD as as,e as is,w as cs,am as ls,s as ds,S as us,O as ms,T as Oe,R as fs,P as hs,d as gs,a0 as ps,a1 as xs,a3 as Ke,a4 as Ue,a5 as Is,a6 as ys,a7 as bs}from"./MailListHeader-BcoBd9rJ.js";import{u as vs,a as Ss,R as Cs,b as Ts,c as ws}from"./useRefreshControl-2fCG36Yb.js";import{u as fe}from"./useQueries-Dr3bjsuu.js";import{t as Rs,u as Ms,r as js,L as ks}from"./useSemanticSearch-5Y5Jgkc8.js";import{a as Es}from"./useLabels-Ddwxl5fU.js";import{u as As,b as Fs}from"./useLayoutTier-r3F9HmT3.js";import{d as Os,w as Ns}from"./wizard-selection-DxUM65kM.js";import{u as We}from"./sections-C3f119Qp.js";import{R as Bs}from"./refresh-cw-C7SXfZwg.js";import{a as Ls}from"./useMessageBodyContent-BDww0y-S.js";import{g as qs,h as Ps}from"./search-token-index-C7yiTbjS.js";function Ds({sync:e}){return e?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",role:"status","aria-live":"polite",children:[r.jsx(Tt,{className:"size-8 animate-spin text-fg-subtle","aria-hidden":"true"}),r.jsx("p",{className:"text-sm font-medium text-fg",children:"Still syncing your mail"}),r.jsx("p",{className:"text-xs text-fg-subtle",children:_s(e)})]}):r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",children:[r.jsx(wt,{className:"size-8 text-fg-subtle","aria-hidden":"true"}),r.jsx("p",{className:"text-sm font-medium text-fg",children:"You're caught up"}),r.jsx("p",{className:"text-xs text-fg-subtle",children:"Nothing needs attention."})]})}function _s({synced:e,total:t}){return t>0?`${e.toLocaleString()} of ${t.toLocaleString()} messages downloaded. This list fills in as they arrive.`:"Downloading your messages. This list fills in as they arrive."}const Ye=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],$e="category",Qs={unclassified:"uncategorized"},G=e=>Lt(e).map(t=>t.raw),z=e=>e.join(" "),he=e=>{const t=He(e);if(t)return Ye.find(o=>o.name===t.name&&o.value===t.value.toLowerCase())?.id},ge=e=>{const t=He(e);if(!t||t.name!==$e)return;const o=t.value.toLowerCase(),a=Qs[o];if(a)return a;if(!(!_e(o)||o==="all"))return o},Ve=e=>Ye.find(t=>t.id===e),Ze=e=>Ve(e)!==void 0,zs=e=>{const t=new Set;for(const o of G(e)){const a=he(o);a&&t.add(a)}return t},Gs=e=>{let t="all";for(const o of G(e)){const a=ge(o);a&&(t=a)}return t},Hs=(e,t)=>{const o=Ve(t);if(!o)return;const a=G(e),c=a.filter(d=>he(d)!==t);return c.length<a.length?z(c):z([...a,Ge(o.name,o.value)])},Ks=(e,t)=>{const o=G(e).filter(a=>!ge(a));return z(t==="all"?o:[...o,Ge($e,t)])},Us=e=>z(G(e).filter(t=>!he(t)&&!ge(t))),Je=e=>e.trim().length>0,Ne=e=>{if(!Je(e.query))return e.ownFilters;const t=new Set(zs(e.query));for(const o of e.ownFilters)Ze(o)||t.add(o);return t},Be=e=>Je(e.query)?Gs(e.query):e.ownCategory,Le=6e4,Ws=3e4,Ys={kind:"unknown"},qe=e=>(t,o)=>_t(o?.queryKey,e)?t:void 0,$s=(e,t,o)=>({...e,category:[t],limit:o,order:"desc"}),Vs=(e,t)=>({...e,category:[t],order:"desc",count:!0,results:!1}),Pe=(e,t)=>({category:[t],...e.unread!==void 0?{unread:e.unread}:{},...e.starred!==void 0?{starred:e.starred}:{},...e.attachments!==void 0?{attachments:e.attachments}:{}});function Zs({categories:e,criteria:t,limit:o,counted:a}){const c=fe({queries:e.map(m=>{const f=$s(t,m,o),g=Pe(t,m);return{queryKey:me({query:f}),queryFn:async()=>{const{data:T}=await ue({query:f,throwOnError:!0});return T},placeholderData:qe(g),staleTime:Le}})}),d=fe({queries:e.map(m=>{const f=Vs(t,m),g=Pe(t,m);return{queryKey:me({query:f}),queryFn:async()=>{const{data:T}=await ue({query:f,throwOnError:!0});return T},enabled:a,placeholderData:qe(g),staleTime:Le}})}),l=n.useMemo(()=>e.map((m,f)=>{const g=c[f],T=d[f],I=g?.data?.items??[];return{category:m,rows:I,atCap:I.length>=o,total:a?Rs(T?.data?.count):Ys,loading:g?.isPending??!0,failed:g?.isError??!1,retry:()=>{g?.refetch(),a&&T?.refetch()}}}),[e,c,d,a,o]),u=n.useCallback(()=>{for(const m of c)m.refetch();for(const m of d)m.refetch()},[c,d]);return{sections:l,isLoading:c.length>0&&c.every(m=>m.isPending),isError:c.length>0&&c.every(m=>m.isError),refetch:u}}function Js(e,t,o){const a={...e,limit:t,order:"desc"},{data:c,isLoading:d,isError:l,refetch:u}=Qe({queryKey:me({query:a}),queryFn:async()=>{const{data:f}=await ue({query:a,throwOnError:!0});return f},enabled:o,staleTime:Ws});return{rows:n.useMemo(()=>o?c?.items??[]:[],[c,o]),isLoading:o&&d,isError:o&&l,refetch:n.useCallback(()=>{u()},[u])}}const Xs=(e,t)=>e.createdAt!==t.createdAt?e.createdAt-t.createdAt:e.accountId.localeCompare(t.accountId),eo=e=>[...e].sort(Xs),to=["category","unread","starred","attachments"],Xe=["contacts","today"],so=e=>new Set(Xe.filter(t=>e.has(t))),oo=(e,t,o)=>{const a=Qt({category:e,attributes:t}),{params:c,residual:d}=zt(o,a,to),l={...c,...a},u={};return l.unread!==void 0&&(u.unread=l.unread),l.starred!==void 0&&(u.starred=l.starred),l.attachments!==void 0&&(u.attachments=l.attachments),{criteria:u,residual:d}},ro=({residual:e,attributes:t,accountScoped:o})=>e.length===0&&!o&&!Xe.some(a=>t.has(a)),no=50,ao=200,io=[],De=()=>r.jsx("div",{className:"animate-pulse",children:Array.from({length:3}).map((e,t)=>r.jsxs("div",{className:"flex items-start gap-3 py-2 pl-5 pr-4 border-b border-line",children:[r.jsx("div",{className:"size-7 rounded-full bg-surface-sunken shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1 space-y-1.5",children:[r.jsxs("div",{className:"flex justify-between gap-2",children:[r.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-28"}),r.jsx("div",{className:"h-3 bg-surface-sunken rounded w-12"})]}),r.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-48"}),r.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})]})]},t))}),co=({accountEmail:e})=>{const t=We();return r.jsxs("div",{className:"flex items-center gap-2 px-row-inset py-2 border-b border-line bg-danger-soft/40 text-xs text-danger",children:[r.jsx(ze,{className:"size-3.5 shrink-0"}),r.jsxs("span",{className:"flex-1 truncate",children:[e," can't connect"]}),r.jsx("button",{type:"button",onClick:()=>t("accounts"),className:"shrink-0 underline text-danger hover:opacity-80",children:"Reconnect"})]})},lo=(e,t)=>{if(t.size===0)return{};const o=e.filter(d=>t.has(d.id)),a=js(o.map(d=>d.accountId));if(a.restriction)return a;const c=new Set;for(const d of o)d.mailboxId&&c.add(d.mailboxId);return c.size>1?{accountId:a.accountId,restriction:"spansFolders",moveDisabledHint:`Move only works within one folder — this selection spans ${c.size} folders`}:{accountId:a.accountId,mailboxId:c.size===1?[...c][0]:void 0}};function uo({header:e,rows:t,wizard:o,children:a}){const{selectedIds:c,selectedCount:d,exitSelection:l,orderedIds:u,allSelected:m,toggleAllLoaded:f}=as(),g=n.useMemo(()=>lo(t,c),[t,c]),{junkMailboxId:T}=is(g.accountId),{labels:I}=Es(g.accountId),b=n.useMemo(()=>Array.from(c),[c]),B=n.useMemo(()=>Ns(t,c),[t,c]),p=cs(T,g.mailboxId),v=n.useMemo(()=>u.length>0?{checked:m,indeterminate:d>0&&!m,onChange:f}:void 0,[u.length,m,d,f]),F=g.moveDisabledHint?{tone:"warning",text:g.moveDisabledHint}:void 0,S=R=>r.jsx(us,{title:R.title,navSlot:R.navSlot,titleMeta:R.titleMeta,searchSlot:R.searchSlot,searchField:R.searchField,idleSlot:R.makeFilterSlot,count:d,onCancel:l,onDelete:()=>o.start("delete"),onMove:()=>o.start("move"),onOrganize:()=>o.start("organize"),onJunk:p?()=>o.start("junk"):void 0,onMarkRead:()=>o.start("markRead"),overflowSlot:g.accountId&&g.mailboxId&&d>0&&I.length>0?r.jsx(ks,{accountId:g.accountId,mailboxId:g.mailboxId,messageIds:b}):void 0,selectAll:v,notice:F});return r.jsx(ls,{...e,selectionBar:S,paneOverlay:r.jsx(ds,{verb:o.verb,accountId:g.accountId,mailboxId:g.mailboxId,selection:B,selectionRestriction:g.restriction,onFinished:l}),children:a})}function mo({accounts:e,selectedMessageId:t,onOpenThread:o,commandsRef:a,onTriageContextChange:c,onDeleteMessages:d}){const{searchQuery:l,searchInput:u,resultFolderIndex:m,onSearchChange:f}=J(),g=qt(),T=Rt(),I=As(),b=Mt(),B=Fs(),p=n.useMemo(()=>eo(e.filter(s=>!s.muted?.value)),[e]),[v,F]=n.useState("all"),[S,R]=n.useState("all"),[O,L]=n.useState(new Set),[ee,M]=n.useState(!1),q=n.useCallback(s=>{L(i=>{const h=new Set(i);return h.has(s)?h.delete(s):h.add(s),h})},[]),H=n.useCallback(()=>L(new Set),[]),E=u.trim().length>0,{freeText:j,tokens:P}=Pt(l.trim().toLowerCase(),g),y=j.length>0,D=n.useMemo(()=>Ne({query:u,ownFilters:O}),[u,O]),_=n.useMemo(()=>Be({query:u,ownCategory:S}),[u,S]),A=n.useMemo(()=>Ne({query:l,ownFilters:O}),[l,O]),C=n.useMemo(()=>Be({query:l,ownCategory:S}),[l,S]),x=n.useCallback(s=>{if(!E||!Ze(s)){q(s);return}const i=Hs(u,s);i!==void 0&&f(i)},[E,u,f,q]),k=n.useCallback(s=>{if(!E){R(s);return}f(Ks(u,s))},[E,u,f]),te=n.useMemo(()=>C==="all"&&!y?s=>{_e(s)&&k(s)}:void 0,[C,y,k]),se=n.useCallback(()=>{R("all"),F("all"),H(),E&&f(Us(u))},[E,u,f,H]),K=fe({queries:p.map(s=>({...jt({path:{accountId:s.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),U=n.useMemo(()=>{const s=new Map;for(let i=0;i<p.length;i++){const h=p[i].accountId,vt=(K[i]?.data?.items??[]).reduce((St,Ct)=>St+(Ct.unseenCount??0),0);s.set(h,vt)}return s},[p,K]),st=n.useMemo(()=>p.filter((s,i)=>{const h=K[i];return h?.isError?!kt(h.error):!1}),[p,K]),{criteria:oe,residual:re}=n.useMemo(()=>oo(C,A,P),[C,A,P]),ot=n.useMemo(()=>C==="all"?[...Gt]:[C],[C]),rt=n.useMemo(()=>({...oe,query:j,...C==="all"?{}:{category:[C]}}),[oe,j,C]),nt=ro({residual:re,attributes:A,accountScoped:v!=="all"}),{sections:W,isLoading:at,isError:it,refetch:pe}=Zs({categories:y?io:ot,criteria:oe,limit:C==="all"?ns:no,counted:nt}),{rows:xe,isLoading:ct,isError:lt,refetch:Ie}=Js(rt,ao,y),ne=y?ct:at,ye=y?lt:it,be=n.useCallback(()=>{if(y){Ie();return}pe()},[y,Ie,pe]),ve=n.useMemo(()=>so(A),[A]),Y=n.useCallback(s=>Os(Ht(s)).map(Kt).filter(i=>(v==="all"||i.accountId===v)&&Et(i,ve)&&Ut(i,re)),[v,ve,re]),$=n.useMemo(()=>W.map(s=>({category:s.category,total:Wt(s.total,s.rows),atCap:s.atCap,loading:s.loading,failed:s.failed,rows:Y(s.rows)})),[W,Y]),V=n.useMemo(()=>Y(xe),[xe,Y]),dt=n.useCallback(s=>{W.find(i=>i.category===s)?.retry()},[W]),w=n.useMemo(()=>y?V:$.flatMap(s=>s.rows),[y,V,$]),{spamIds:ae,briefSpamOffer:ie}=n.useMemo(()=>{const s={spamIds:void 0,briefSpamOffer:void 0};if(!j)return s;const i=w.map(N=>Fe(N,m)),{spam:h}=Yt(i);return h.length===0?s:{spamIds:new Set(h.map(N=>N.id)),briefSpamOffer:$t(i)}},[w,j,m]),Se=n.useMemo(()=>{const s=i=>ae===void 0?i:i.filter(h=>!ae.has(h.id));return y?[{id:"matches",threads:s(V)}]:Vt($.map(i=>({...i,rows:s(i.rows)})))},[y,V,$,ae]),Ce=n.useCallback((s,i)=>{const h=w.find(N=>N.id===s)?.threadId;h&&o?.({threadId:h,messageId:s},i)},[w,o]),ut=n.useCallback(s=>{const i=s.threadId??w.find(h=>h.id===s.id)?.threadId;i&&o?.({threadId:i,messageId:s.id})},[w,o]),ce=n.useMemo(()=>p.length<=1?[]:[{id:"all",label:"All",active:v==="all"},...p.map(s=>({id:s.accountId,label:s.email.split("@")[0]??s.email,count:U.get(s.accountId),active:v===s.accountId}))],[p,U,v]),Q=n.useMemo(()=>e.filter(s=>s.muted?.value).length,[e]),mt=n.useMemo(()=>Array.from(U.values()).reduce((s,i)=>s+i,0),[U]),le=n.useMemo(()=>p.map(s=>s.accountId),[p]),{hasNewMail:Te}=vs(),{state:we,errorMessage:Re,refresh:Me}=Ss(le,{onSettled:()=>be()}),ft=n.useMemo(()=>r.jsx(Cs,{state:we,onRefresh:Me,label:"Refresh daily brief",errorMessage:Re,hasUpdate:Te(le)}),[we,Me,Re,Te,le]),de=n.useMemo(()=>w.map(s=>Fe(s,m)),[w,m]),{hits:je,isLoading:ht}=Ms(),gt=n.useMemo(()=>{const s=new Map(w.map(h=>[h.id,h.threadId])),i=de.map(h=>s.get(h.id)).filter(h=>h!=null);return Zt(je,i,m)},[je,de,w,m]),pt=n.useMemo(()=>{const s=Jt(ce.map(i=>({id:i.id,label:i.label,count:i.count,active:i.active})));return{categories:s.categories,filters:s.filters,sources:s.sources,sourcesNote:Q>0?`+${Q} muted`:void 0,selectedCategory:_,activeFilters:D,expanded:ee,onExpandedChange:M,onSelectCategory:i=>k(i),onSelectSource:F,onToggleFilter:i=>x(i),onClear:se}},[ce,Q,_,D,ee,x,k,se]),ke=Se.length===0&&v==="all"&&j.length===0&&P.length===0,xt=n.useMemo(()=>p.map(s=>s.accountId),[p]),It=n.useMemo(()=>p.some(s=>Ts(s.syncPhase)),[p]),Z=ws(xt,ke||It),Ee=r.jsxs("div",{className:"h-full overflow-y-auto",children:[r.jsx(De,{}),r.jsx(De,{})]}),Ae=!ne&&!ye&&!ke,yt=Xt({tier:I,hasLiveInput:E,hasCommittedQuery:l.trim().length>0,bodyRendersCommittedResults:!0}),bt=Ae?r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[ie&&r.jsx(es,{count:ie.count,onScopeToSpam:()=>B(ie.mailboxId,l)}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(ts,{sections:Se,briefCategory:_,Row:ss,selectedThreadId:t,onSelectThread:Ce,onShowAllSection:te,onRetrySection:dt,flat:y,onSelectBriefCategory:k,sources:ce,sourcesNote:Q>0?`+${Q} muted`:void 0,onSelectSource:F,activeFilters:D,onToggleFilter:x,onClearFilters:se})})]}):ne?Ee:ye?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 py-12 text-sm text-fg-muted",children:[r.jsx(ze,{className:"size-8 text-danger"}),r.jsx("p",{children:"Couldn't load your messages"}),r.jsxs("button",{type:"button",onClick:()=>be(),className:"flex items-center gap-1 text-accent underline text-xs",children:[r.jsx(Bs,{className:"size-3.5"}),"Try again"]})]}):Z.resolved?r.jsx(Ds,{sync:Z.syncing?{synced:Z.synced,total:Z.total}:void 0}):Ee;return r.jsx(At,{hasSheet:Ae&&!yt,children:r.jsx(os,{selectedMessageId:t,rows:w,onOpen:Ce,onDeleteMessages:d,onSelectionVerb:b.start,commandsRef:a,onTriageContextChange:c,children:r.jsx(uo,{wizard:b,header:{title:"Daily brief",unreadCount:mt,footer:T?r.jsx(rs,{}):void 0,searchFilter:pt,searchResults:de,searchLoading:ne,relatedResults:gt,relatedLoading:ht,onSelectSearchResult:ut,searchResultsInBody:!0,refreshControl:ft},rows:w,children:r.jsxs("div",{className:"flex h-full flex-col",children:[st.map(s=>r.jsx(co,{accountEmail:s.email,accountId:s.accountId},s.accountId)),r.jsx("div",{className:"min-h-0 flex-1",children:bt})]})})})})}const et=n.createContext(null);function X(){const e=n.useContext(et);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function fo({thread:e,children:t}){const o=qs(),a=Ps(),c=We(),{searchInput:d}=J(),l=e?.threadId,u=e?.messageId,{data:m}=Qe({...Ft(),staleTime:6e4}),f=n.useMemo(()=>m?.items??[],[m]),g=n.useMemo(()=>{if(l)return f.find(x=>x.messageId===u)??f.find(x=>x.threadId===l)},[f,l,u]),T=ms(l,u),I=g??T,b=u??I?.messageId,B=n.useMemo(()=>{if(l)return{threadId:l,mailboxId:I?.mailboxId??"",subject:I?.subject,messageId:b,authenticity:I?.authenticity}},[l,I,b]),p=n.useCallback((x,k)=>{o(x,{replace:k?.replace,query:d})},[o,d]),v=n.useCallback(x=>{b&&x.includes(b)&&a()},[b,a]),F=Oe({thread:I,isOpen:!0,onAfterOptimisticRemove:v}),S=fs(),{deleteMessages:R}=hs({mailboxId:I?.mailboxId??"",messages:f,onAfterOptimisticRemove:v}),{toggleReadFor:O}=gs({mailboxId:I?.mailboxId??"",messages:f}),L=S.focusedMessageId,M=n.useMemo(()=>f.find(x=>x.messageId===L),[f,L])??I,q=Oe({thread:M,isOpen:M?.messageId===b}),H=Ls(),E=Ot(),j=Nt(),P=n.useMemo(()=>Bt(j,l,b),[j,l,b]),y=n.useMemo(()=>{if(M)return x=>j({threadId:M.threadId,messageId:M.messageId,mode:x})},[j,M]),{nextMessageId:D,previousMessageId:_}=ps({context:S,orderedIds:S.orderedIds,selectedMessageId:b,enabled:!H&&!E,hasOpenThread:l!==void 0,onClose:a,handlers:{reply:()=>y?.("reply"),replyAll:()=>y?.("reply-all"),forward:()=>y?.("forward"),delete:()=>{S.listCommandsRef.current?.requestVerb("delete")||q.deleteThread()},toggleStar:q.toggleStar,toggleRead:()=>{S.listCommandsRef.current?.requestVerb("markRead")||M&&O([M.messageId],!M.isRead)},goFlagged:()=>c("flagged"),goSettings:()=>c("settings")}}),A=n.useCallback(x=>{if(!x)return;const k=f.find(te=>te.messageId===x);return k?{threadId:k.threadId,messageId:x}:void 0},[f]),C={selectedMessageId:b,selectedThread:I,conversation:B,onOpenThread:p,onCloseThread:a,nextThread:A(D),previousThread:A(_),actions:F,onReply:P,triage:S,onDeleteMessages:R,handleDeselectIfRemoved:v};return r.jsx(et.Provider,{value:C,children:t})}function tt(){const{selectedMessageId:e,onOpenThread:t,triage:o,onDeleteMessages:a}=X(),{accounts:c}=J();return r.jsx(mo,{accounts:c,selectedMessageId:e,onOpenThread:t,commandsRef:o.listCommandsRef,onTriageContextChange:o.onTriageContextChange,onDeleteMessages:a})}function ho(){const{conversation:e,selectedThread:t,actions:o,onReply:a,handleDeselectIfRemoved:c}=X(),d=!!e,l=ys(e?.threadId);return r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[r.jsx(bs,{hasThread:d,intelligenceOpen:l.isShowing,canToggleIntelligence:l.canToggle,onToggleIntelligence:l.toggle,onReply:a?()=>a("reply"):void 0,onReplyAll:a?()=>a("reply-all"):void 0,onForward:a?()=>a("forward"):void 0,onDelete:d?o.deleteThread:void 0,onToggleStar:d?o.toggleStar:void 0,isStarred:o.isStarred,moveContext:d&&o.accountId&&o.mailboxId?{accountId:o.accountId,currentMailboxId:o.mailboxId,onMove:o.moveThread}:void 0}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?r.jsx(Ke,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:l.open,listOnScreen:!0}):r.jsx(Dt,{})})]}),r.jsx(Ue,{isOpen:l.drawerOpen,onClose:l.closeDrawer,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:c})]})}function go(){const{selectedThread:e,handleDeselectIfRemoved:t}=X(),{onToggleIntelligence:o}=J();return r.jsx(Is,{onClose:o,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function po(){const{selectedThread:e,conversation:t,onOpenThread:o,onCloseThread:a,nextThread:c,previousThread:d,handleDeselectIfRemoved:l}=X(),u=xs(t?.threadId??null);return t?r.jsxs(r.Fragment,{children:[r.jsx(Ke,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:a,onOpenIntelligence:u.toggle,onSwipeNext:c?()=>o(c):void 0,onSwipePrevious:d?()=>o(d):void 0,mobileIntelligenceOpen:u.isOpen}),r.jsx(Ue,{isOpen:u.isOpen,onClose:u.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:l})]}):r.jsx("div",{className:"h-full",children:r.jsx(tt,{})})}const Eo=Object.assign(fo,{List:tt,Reading:ho,Intelligence:go,Phone:po});export{Eo as B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ee,i as _}from"./window-CT3glB3e.js";import{j as n,f as j,t as d,W as te,Y as ne,ax as f,r as p,aw as ae,X as se,i as T,ej as re,ek as ie,el as le,h as oe,s as ce,b0 as de,Z as ue}from"./index-_JBKtYXu.js";import{f as me}from"./ErrorState-BUi73q43.js";import{R as z,c as he}from"./calendar-color-BG7928-_.js";const xe=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],pe=["January","February","March","April","May","June","July","August","September","October","November","December"],fe=["first","second","third","fourth","last"],A="";function ye(e,t){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return[];const[a,s,i]=e.split("-").map(Number),r=new Date(Date.UTC(a,s-1,i)),l=xe[r.getUTCDay()],o=fe[Math.min(Math.floor((i-1)/7),4)],c=t===""?"":`, ${t}`,y=r.getUTCDay()>=1&&r.getUTCDay()<=5;return[`Every day${c}`,...y?[`Every weekday${c}`]:[],`Every week on ${l}${c}`,`Every month on the ${o} ${l}${c}`,`Every year on ${i} ${pe[s-1]}${c}`]}const ve="w-full rounded-md border border-line bg-surface-sunken px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus-visible:border-line-strong focus-visible:ring-2 focus-visible:ring-ring/30",u=({draft:e,onChange:t},a,s)=>t({...e,[a]:s});function x({label:e,children:t}){return n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:e}),t]})}function ge({draft:e,onChange:t,layout:a="compact",touch:s}){const i=a==="pane";return n.jsx(f,{value:e.title,placeholder:"Title","aria-label":"Title",onChange:r=>u({draft:e,onChange:t},"title",r.target.value),className:d(i?"text-lg font-medium":"text-md font-medium",i?"h-11":s?"min-h-11":"")})}function H(e){return e.allDay||e.startTime===""||e.endTime===""?!1:e.endTime<e.startTime}function be({draft:e,onChange:t,touch:a}){const s=a?"min-h-11":"",i=H(e),r=p.useId();return n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx(f,{type:"date",value:e.date,"aria-label":"Date",onChange:l=>u({draft:e,onChange:t},"date",l.target.value),className:d("w-40",s)}),e.allDay?n.jsx("span",{className:"text-sm text-fg-muted",children:"All day"}):n.jsxs(n.Fragment,{children:[n.jsx(f,{type:"time",value:e.startTime,"aria-label":"Start time",max:e.endTime===""?void 0:e.endTime,"aria-invalid":i,"aria-describedby":i?r:void 0,onChange:l=>u({draft:e,onChange:t},"startTime",l.target.value),className:d("w-28",s,i&&"border-danger/60")}),n.jsx("span",{className:"text-sm text-fg-subtle",children:"to"}),n.jsx(f,{type:"time",value:e.endTime,"aria-label":"End time",min:e.startTime===""?void 0:e.startTime,"aria-invalid":i,"aria-describedby":i?r:void 0,onChange:l=>u({draft:e,onChange:t},"endTime",l.target.value),className:d("w-28",s,i&&"border-danger/60")})]}),n.jsxs("label",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[n.jsx("input",{type:"checkbox",checked:e.allDay,onChange:l=>u({draft:e,onChange:t},"allDay",l.target.checked),className:"size-4 accent-current"}),"All day"]})]}),i&&n.jsxs("p",{id:r,className:"text-xs text-danger",role:"alert",children:["Ends before it starts. Move the end past ",e.startTime,", or start earlier."]})]})}function Ee({draft:e,onChange:t,calendars:a,touch:s}){return n.jsx(Ae,{calendars:a,value:e.calendarId,onChange:i=>u({draft:e,onChange:t},"calendarId",i),touch:s})}function Ne({draft:e,onChange:t,touch:a,repeatEditable:s=!0,onCustom:i}){return s?n.jsx(ke,{value:e.repeat,date:e.date,startTime:e.startTime,onChange:r=>u({draft:e,onChange:t},"repeat",r),onCustom:i,className:a?"min-h-11":""}):n.jsxs("p",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[n.jsx(z,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.repeat===A?"Does not repeat":e.repeat]})}function je({draft:e,onChange:t,touch:a}){return n.jsx(f,{value:e.location,placeholder:"Location","aria-label":"Location",onChange:s=>u({draft:e,onChange:t},"location",s.target.value),className:a?"min-h-11":""})}function Te({draft:e,onChange:t,touch:a}){return n.jsx(f,{value:e.guests,placeholder:"Guests, comma separated","aria-label":"Guests",onChange:s=>u({draft:e,onChange:t},"guests",s.target.value),className:a?"min-h-11":""})}function Ce({draft:e,onChange:t,layout:a="compact"}){return n.jsx("textarea",{value:e.notes,placeholder:"Notes","aria-label":"Notes",onChange:s=>u({draft:e,onChange:t},"notes",s.target.value),rows:a==="pane"?6:3,className:ve})}function De({draft:e,onChange:t,calendars:a,layout:s="compact",expanded:i=!1,onToggleExpanded:r,onSave:l,onCancel:o,onDelete:c,saveLabel:y="Add",header:g,repeatEditable:b=!0,guestsEditable:w=!1,calendarEditable:I=!0,onCustomRepeat:X,touch:m,className:M}){const v=s==="pane",h={draft:e,onChange:t,layout:s,touch:m},S=n.jsx(ge,{...h}),$=n.jsx(be,{...h}),R=n.jsx(Ee,{...h,calendars:a}),F=n.jsx(Ne,{...h,repeatEditable:b,onCustom:X}),Y=n.jsx(je,{...h}),L=n.jsx(Te,{...h}),W=n.jsx(Ce,{...h}),P=n.jsxs("div",{className:d("flex items-center gap-2",v?"pt-2":"pt-1"),children:[n.jsx(j,{variant:"primary",size:m||v?"md":"sm",onClick:l,disabled:H(e),className:m?"min-h-11 flex-1":"",children:y}),n.jsx(j,{variant:"ghost",size:m||v?"md":"sm",onClick:o,className:m?"min-h-11":"",children:"Cancel"}),c&&n.jsx(j,{variant:"ghost",size:m||v?"md":"sm",onClick:c,className:d("ml-auto text-danger",m&&"min-h-11"),children:"Delete"})]});if(v)return n.jsxs("div",{className:d("flex flex-col gap-5",M),children:[g,n.jsx(x,{label:"Title",children:S}),n.jsx(x,{label:"When",children:$}),I&&n.jsx(x,{label:"Calendar",children:R}),n.jsx(x,{label:"Repeat",children:F}),n.jsx(x,{label:"Location",children:Y}),w&&n.jsx(x,{label:"Guests",children:L}),n.jsx(x,{label:"Notes",children:W}),P]});const Z=r!==void 0&&!i;return n.jsxs("div",{className:d("flex flex-col gap-3",M),children:[g,S,$,I&&R,r&&n.jsxs("button",{type:"button",onClick:r,"aria-expanded":i,className:d("flex items-center gap-1 self-start rounded-sm text-xs font-medium text-fg-muted outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",m&&"min-h-11"),children:[i?n.jsx(te,{className:"size-3.5"}):n.jsx(ne,{className:"size-3.5"}),i?"Fewer details":"More details"]}),!Z&&n.jsxs("div",{className:"flex flex-col gap-2 border-t border-line pt-3",children:[Y,w&&L,F,W]}),P]})}const U="__custom__";function ke({value:e,date:t,startTime:a,onChange:s,onCustom:i,className:r}){const l=ye(t,a),o=e===A||l.includes(e)?l:[e,...l];return n.jsxs(ae,{icon:n.jsx(z,{className:"size-4"}),"aria-label":"Repeat",value:e,onChange:c=>{if(c.target.value===U){i?.();return}s(c.target.value)},className:r,children:[n.jsx("option",{value:A,children:"Does not repeat"}),o.map(c=>n.jsx("option",{value:c,children:c},c)),i&&n.jsx("option",{value:U,children:"Custom…"})]})}function Ae({calendars:e,value:t,onChange:a,touch:s}){const i=p.useId();return n.jsxs("fieldset",{className:"flex flex-wrap gap-1.5",children:[n.jsx("legend",{className:"sr-only",children:"Calendar"}),e.map(r=>{const l=he(r.color),o=r.id===t;return n.jsxs("label",{className:d("inline-flex cursor-pointer items-center gap-1.5 rounded-full border px-2.5 text-xs transition-colors","has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring",s?"min-h-11":"h-7",o?d(l.soft,l.text,l.border):"border-line text-fg-muted hover:bg-surface-sunken"),children:[n.jsx("input",{type:"radio",name:i,value:r.id,checked:o,onChange:()=>a(r.id),className:"sr-only"}),n.jsx("span",{className:d("size-2 rounded-full",l.solid)}),r.name]},r.id)})]})}function Oe({title:e,subtitle:t,onClose:a,children:s,className:i}){return n.jsxs("section",{className:d("flex h-full w-full flex-col bg-surface",i),children:[n.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[n.jsx("h2",{className:"shrink-0 text-xs font-medium text-fg",children:e}),t!==void 0&&t!==""&&n.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-fg-muted",children:t}),n.jsx("button",{type:"button","aria-label":"Close editor",onClick:a,className:"ml-auto flex size-7 shrink-0 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",children:n.jsx(se,{className:"size-4"})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-row-inset py-5",children:n.jsx("div",{className:"mx-auto w-full max-w-2xl",children:s})})]})}const E=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],N=["SU","MO","TU","WE","TH","FR","SA"],Q=["January","February","March","April","May","June","July","August","September","October","November","December"],K=["first","second","third","fourth","last"],G=[1,2,3,4,-1],J="MO,TU,WE,TH,FR",we=e=>e.replace(/,\s*\d{2}:\d{2}$/,"").trim();function O(e){const t=we(e);if(t==="")return"";if(t==="Every day")return"FREQ=DAILY";if(t==="Every weekday")return`FREQ=WEEKLY;BYDAY=${J}`;const a=t.match(/^Every week on (\w+)$/);if(a){const r=E.indexOf(a[1]);return r===-1?void 0:`FREQ=WEEKLY;BYDAY=${N[r]}`}const s=t.match(/^Every month on the (\w+) (\w+)$/);if(s){const r=K.indexOf(s[1]),l=E.indexOf(s[2]);return r===-1||l===-1?void 0:`FREQ=MONTHLY;BYDAY=${G[r]}${N[l]}`}const i=t.match(/^Every year on (\d{1,2}) (\w+)$/);if(i){const r=Q.indexOf(i[2]);return r===-1?void 0:`FREQ=YEARLY;BYMONTH=${r+1};BYMONTHDAY=${Number(i[1])}`}}const Ie=e=>e===""?"":`, ${e}`;function We(e,t){const a=new Map(e.split(";").map(l=>l.split("=")).filter(l=>l.length===2).map(([l,o])=>[l.toUpperCase(),o.toUpperCase()])),s=Ie(t),i=a.get("FREQ"),r=a.get("BYDAY");if(!(a.has("INTERVAL")&&a.get("INTERVAL")!=="1")&&!(a.has("UNTIL")||a.has("COUNT"))){if(i==="DAILY")return`Every day${s}`;if(i==="WEEKLY"){if(r===void 0)return;if(r===J)return`Every weekday${s}`;const l=N.indexOf(r);return l===-1?void 0:`Every week on ${E[l]}${s}`}if(i==="MONTHLY"){const l=r?.match(/^(-?\d)([A-Z]{2})$/);if(!l)return;const o=G.indexOf(Number(l[1])),c=N.indexOf(l[2]);return o===-1||c===-1?void 0:`Every month on the ${K[o]} ${E[c]}${s}`}if(i==="YEARLY"){const l=Number(a.get("BYMONTH")),o=Number(a.get("BYMONTHDAY"));return!l||!o||l>12?void 0:`Every year on ${o} ${Q[l-1]}${s}`}}}function Pe(e,t){return{title:"",date:e,startTime:"09:00",endTime:"10:00",allDay:!1,calendarId:t,location:"",guests:"",notes:"",repeat:""}}function _e(e,t){return{title:e.title,date:e.start.slice(0,10),startTime:e.allDay?"":e.start.slice(11,16),endTime:e.allDay?"":e.end.slice(11,16),allDay:e.allDay,calendarId:e.calendarId,location:t.location,guests:"",notes:t.notes,repeat:t.repeat}}function q(e,t){return e.allDay?{start:e.date,end:ee(e.date,1)}:{start:_(e.date,e.startTime,t),end:_(e.date,e.endTime,t)}}function V(e,t){return e.title.trim()===""?"Give the event a title before saving it.":e.date===""?"Pick the day the event is on.":e.calendarId===""?"Pick the calendar to save the event in.":!e.allDay&&(e.startTime===""||e.endTime==="")?"Set a start and an end time, or mark the event all day.":!e.allDay&&e.endTime<=e.startTime?"The end time is not after the start time. Move one of them.":t&&O(e.repeat)===void 0?"This calendar can't store that repeat rule. Pick one of the offered rules, or turn the repeat off.":""}function Ue(e,t){const a=V(e,!0);if(a!=="")return{ok:!1,problem:a};const{start:s,end:i}=q(e,t);return{ok:!0,input:{calendarId:e.calendarId,summary:e.title.trim(),description:e.notes,location:e.location,start:s,end:i,allDay:e.allDay,...t===""?{}:{timeZone:t},recurrenceRule:O(e.repeat)??""}}}function Be(e,t,a){const s=t.repeat!==e.repeat,i=V(t,s);if(i!=="")return{ok:!1,problem:i};const r={};if(t.title.trim()!==e.title.trim()&&(r.summary=t.title.trim()),t.location!==e.location&&(r.location=t.location),t.notes!==e.notes&&(r.description=t.notes),t.date!==e.date||t.startTime!==e.startTime||t.endTime!==e.endTime||t.allDay!==e.allDay){const{start:o,end:c}=q(t,a);r.start=o,r.end=c,r.allDay=t.allDay,a!==""&&(r.timeZone=a)}return s&&(r.recurrenceRule=O(t.repeat)??""),{ok:!0,patch:r}}const C=ce(400,404,412),Me=new Set(["calendarEventOperationsListCalendarEvents","calendarEventDetailOperationsGetCalendarEvent","calendarFreeBusyOperationsListCalendarFreeBusy"]),D={kind:"written"},k=e=>de(e)===412?{kind:"conflict"}:{kind:"refused",message:me(e)},Se={this:"This",following:"Following",all:"All"};function $e(){const e=oe();return p.useCallback(()=>{e.invalidateQueries({predicate:t=>{const a=t.queryKey[0];if(typeof a!="object"||a===null)return!1;const s=a._id;return typeof s=="string"&&Me.has(s)}})},[e])}const B=({scope:e,recurrenceId:t})=>e===void 0||e==="all"?{}:{scope:Se[e],recurrenceId:t};function ze(){const e=$e(),t=T({...re(),meta:C,onSuccess:e}),a=T({...ie(),meta:C,onSuccess:e}),s=T({...le(),meta:C,onSuccess:e}),i=p.useCallback(o=>t.mutateAsync({body:o}).then(()=>D).catch(k),[t]),r=p.useCallback((o,c)=>a.mutateAsync({path:{calendarObjectId:o.calendarObjectId},query:{calendarId:o.calendarId,...B(o)},headers:{"If-Match":o.etag},body:c}).then(()=>D).catch(k),[a]),l=p.useCallback(o=>s.mutateAsync({path:{calendarObjectId:o.calendarObjectId},query:{calendarId:o.calendarId,...B(o)},headers:{"If-Match":o.etag}}).then(()=>D).catch(k),[s]);return p.useMemo(()=>({createEvent:i,updateEvent:r,deleteEvent:l,isWriting:t.isPending||a.isPending||s.isPending}),[i,r,l,t.isPending,a.isPending,s.isPending])}function He({title:e,subtitle:t,calendars:a,draft:s,onChange:i,problem:r,saveLabel:l,isSaving:o,repeatEditable:c=!0,calendarEditable:y=!0,onSave:g,onCancel:b}){return n.jsx(Oe,{title:e,subtitle:t,onClose:b,children:n.jsx(De,{draft:s,onChange:i,calendars:a,layout:"pane",repeatEditable:c,calendarEditable:y,saveLabel:o?"Saving…":l,onSave:g,onCancel:b,header:r===""?void 0:n.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[n.jsx(ue,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":"true"}),n.jsx("p",{className:"min-w-0 flex-1 break-words text-fg",children:r})]})})})}export{He as C,Ue as c,_e as d,Pe as e,Be as p,We as t,ze as u};
|
|
1
|
+
import{a as ee,i as _}from"./window-5V8GE5pm.js";import{j as n,f as j,t as d,W as te,Y as ne,ax as f,r as p,aw as ae,X as se,i as T,ej as re,ek as ie,el as le,h as oe,s as ce,b0 as de,Z as ue}from"./index-CerSmEHP.js";import{f as me}from"./ErrorState-1AEFpVV9.js";import{R as z,c as he}from"./calendar-color-CUVJPwWZ.js";const xe=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],pe=["January","February","March","April","May","June","July","August","September","October","November","December"],fe=["first","second","third","fourth","last"],A="";function ye(e,t){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return[];const[a,s,i]=e.split("-").map(Number),r=new Date(Date.UTC(a,s-1,i)),l=xe[r.getUTCDay()],o=fe[Math.min(Math.floor((i-1)/7),4)],c=t===""?"":`, ${t}`,y=r.getUTCDay()>=1&&r.getUTCDay()<=5;return[`Every day${c}`,...y?[`Every weekday${c}`]:[],`Every week on ${l}${c}`,`Every month on the ${o} ${l}${c}`,`Every year on ${i} ${pe[s-1]}${c}`]}const ve="w-full rounded-md border border-line bg-surface-sunken px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus-visible:border-line-strong focus-visible:ring-2 focus-visible:ring-ring/30",u=({draft:e,onChange:t},a,s)=>t({...e,[a]:s});function x({label:e,children:t}){return n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:e}),t]})}function ge({draft:e,onChange:t,layout:a="compact",touch:s}){const i=a==="pane";return n.jsx(f,{value:e.title,placeholder:"Title","aria-label":"Title",onChange:r=>u({draft:e,onChange:t},"title",r.target.value),className:d(i?"text-lg font-medium":"text-md font-medium",i?"h-11":s?"min-h-11":"")})}function H(e){return e.allDay||e.startTime===""||e.endTime===""?!1:e.endTime<e.startTime}function be({draft:e,onChange:t,touch:a}){const s=a?"min-h-11":"",i=H(e),r=p.useId();return n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx(f,{type:"date",value:e.date,"aria-label":"Date",onChange:l=>u({draft:e,onChange:t},"date",l.target.value),className:d("w-40",s)}),e.allDay?n.jsx("span",{className:"text-sm text-fg-muted",children:"All day"}):n.jsxs(n.Fragment,{children:[n.jsx(f,{type:"time",value:e.startTime,"aria-label":"Start time",max:e.endTime===""?void 0:e.endTime,"aria-invalid":i,"aria-describedby":i?r:void 0,onChange:l=>u({draft:e,onChange:t},"startTime",l.target.value),className:d("w-28",s,i&&"border-danger/60")}),n.jsx("span",{className:"text-sm text-fg-subtle",children:"to"}),n.jsx(f,{type:"time",value:e.endTime,"aria-label":"End time",min:e.startTime===""?void 0:e.startTime,"aria-invalid":i,"aria-describedby":i?r:void 0,onChange:l=>u({draft:e,onChange:t},"endTime",l.target.value),className:d("w-28",s,i&&"border-danger/60")})]}),n.jsxs("label",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[n.jsx("input",{type:"checkbox",checked:e.allDay,onChange:l=>u({draft:e,onChange:t},"allDay",l.target.checked),className:"size-4 accent-current"}),"All day"]})]}),i&&n.jsxs("p",{id:r,className:"text-xs text-danger",role:"alert",children:["Ends before it starts. Move the end past ",e.startTime,", or start earlier."]})]})}function Ee({draft:e,onChange:t,calendars:a,touch:s}){return n.jsx(Ae,{calendars:a,value:e.calendarId,onChange:i=>u({draft:e,onChange:t},"calendarId",i),touch:s})}function Ne({draft:e,onChange:t,touch:a,repeatEditable:s=!0,onCustom:i}){return s?n.jsx(ke,{value:e.repeat,date:e.date,startTime:e.startTime,onChange:r=>u({draft:e,onChange:t},"repeat",r),onCustom:i,className:a?"min-h-11":""}):n.jsxs("p",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[n.jsx(z,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.repeat===A?"Does not repeat":e.repeat]})}function je({draft:e,onChange:t,touch:a}){return n.jsx(f,{value:e.location,placeholder:"Location","aria-label":"Location",onChange:s=>u({draft:e,onChange:t},"location",s.target.value),className:a?"min-h-11":""})}function Te({draft:e,onChange:t,touch:a}){return n.jsx(f,{value:e.guests,placeholder:"Guests, comma separated","aria-label":"Guests",onChange:s=>u({draft:e,onChange:t},"guests",s.target.value),className:a?"min-h-11":""})}function Ce({draft:e,onChange:t,layout:a="compact"}){return n.jsx("textarea",{value:e.notes,placeholder:"Notes","aria-label":"Notes",onChange:s=>u({draft:e,onChange:t},"notes",s.target.value),rows:a==="pane"?6:3,className:ve})}function De({draft:e,onChange:t,calendars:a,layout:s="compact",expanded:i=!1,onToggleExpanded:r,onSave:l,onCancel:o,onDelete:c,saveLabel:y="Add",header:g,repeatEditable:b=!0,guestsEditable:w=!1,calendarEditable:I=!0,onCustomRepeat:X,touch:m,className:M}){const v=s==="pane",h={draft:e,onChange:t,layout:s,touch:m},S=n.jsx(ge,{...h}),$=n.jsx(be,{...h}),R=n.jsx(Ee,{...h,calendars:a}),F=n.jsx(Ne,{...h,repeatEditable:b,onCustom:X}),Y=n.jsx(je,{...h}),L=n.jsx(Te,{...h}),W=n.jsx(Ce,{...h}),P=n.jsxs("div",{className:d("flex items-center gap-2",v?"pt-2":"pt-1"),children:[n.jsx(j,{variant:"primary",size:m||v?"md":"sm",onClick:l,disabled:H(e),className:m?"min-h-11 flex-1":"",children:y}),n.jsx(j,{variant:"ghost",size:m||v?"md":"sm",onClick:o,className:m?"min-h-11":"",children:"Cancel"}),c&&n.jsx(j,{variant:"ghost",size:m||v?"md":"sm",onClick:c,className:d("ml-auto text-danger",m&&"min-h-11"),children:"Delete"})]});if(v)return n.jsxs("div",{className:d("flex flex-col gap-5",M),children:[g,n.jsx(x,{label:"Title",children:S}),n.jsx(x,{label:"When",children:$}),I&&n.jsx(x,{label:"Calendar",children:R}),n.jsx(x,{label:"Repeat",children:F}),n.jsx(x,{label:"Location",children:Y}),w&&n.jsx(x,{label:"Guests",children:L}),n.jsx(x,{label:"Notes",children:W}),P]});const Z=r!==void 0&&!i;return n.jsxs("div",{className:d("flex flex-col gap-3",M),children:[g,S,$,I&&R,r&&n.jsxs("button",{type:"button",onClick:r,"aria-expanded":i,className:d("flex items-center gap-1 self-start rounded-sm text-xs font-medium text-fg-muted outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",m&&"min-h-11"),children:[i?n.jsx(te,{className:"size-3.5"}):n.jsx(ne,{className:"size-3.5"}),i?"Fewer details":"More details"]}),!Z&&n.jsxs("div",{className:"flex flex-col gap-2 border-t border-line pt-3",children:[Y,w&&L,F,W]}),P]})}const U="__custom__";function ke({value:e,date:t,startTime:a,onChange:s,onCustom:i,className:r}){const l=ye(t,a),o=e===A||l.includes(e)?l:[e,...l];return n.jsxs(ae,{icon:n.jsx(z,{className:"size-4"}),"aria-label":"Repeat",value:e,onChange:c=>{if(c.target.value===U){i?.();return}s(c.target.value)},className:r,children:[n.jsx("option",{value:A,children:"Does not repeat"}),o.map(c=>n.jsx("option",{value:c,children:c},c)),i&&n.jsx("option",{value:U,children:"Custom…"})]})}function Ae({calendars:e,value:t,onChange:a,touch:s}){const i=p.useId();return n.jsxs("fieldset",{className:"flex flex-wrap gap-1.5",children:[n.jsx("legend",{className:"sr-only",children:"Calendar"}),e.map(r=>{const l=he(r.color),o=r.id===t;return n.jsxs("label",{className:d("inline-flex cursor-pointer items-center gap-1.5 rounded-full border px-2.5 text-xs transition-colors","has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring",s?"min-h-11":"h-7",o?d(l.soft,l.text,l.border):"border-line text-fg-muted hover:bg-surface-sunken"),children:[n.jsx("input",{type:"radio",name:i,value:r.id,checked:o,onChange:()=>a(r.id),className:"sr-only"}),n.jsx("span",{className:d("size-2 rounded-full",l.solid)}),r.name]},r.id)})]})}function Oe({title:e,subtitle:t,onClose:a,children:s,className:i}){return n.jsxs("section",{className:d("flex h-full w-full flex-col bg-surface",i),children:[n.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[n.jsx("h2",{className:"shrink-0 text-xs font-medium text-fg",children:e}),t!==void 0&&t!==""&&n.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-fg-muted",children:t}),n.jsx("button",{type:"button","aria-label":"Close editor",onClick:a,className:"ml-auto flex size-7 shrink-0 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",children:n.jsx(se,{className:"size-4"})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-row-inset py-5",children:n.jsx("div",{className:"mx-auto w-full max-w-2xl",children:s})})]})}const E=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],N=["SU","MO","TU","WE","TH","FR","SA"],Q=["January","February","March","April","May","June","July","August","September","October","November","December"],K=["first","second","third","fourth","last"],G=[1,2,3,4,-1],J="MO,TU,WE,TH,FR",we=e=>e.replace(/,\s*\d{2}:\d{2}$/,"").trim();function O(e){const t=we(e);if(t==="")return"";if(t==="Every day")return"FREQ=DAILY";if(t==="Every weekday")return`FREQ=WEEKLY;BYDAY=${J}`;const a=t.match(/^Every week on (\w+)$/);if(a){const r=E.indexOf(a[1]);return r===-1?void 0:`FREQ=WEEKLY;BYDAY=${N[r]}`}const s=t.match(/^Every month on the (\w+) (\w+)$/);if(s){const r=K.indexOf(s[1]),l=E.indexOf(s[2]);return r===-1||l===-1?void 0:`FREQ=MONTHLY;BYDAY=${G[r]}${N[l]}`}const i=t.match(/^Every year on (\d{1,2}) (\w+)$/);if(i){const r=Q.indexOf(i[2]);return r===-1?void 0:`FREQ=YEARLY;BYMONTH=${r+1};BYMONTHDAY=${Number(i[1])}`}}const Ie=e=>e===""?"":`, ${e}`;function We(e,t){const a=new Map(e.split(";").map(l=>l.split("=")).filter(l=>l.length===2).map(([l,o])=>[l.toUpperCase(),o.toUpperCase()])),s=Ie(t),i=a.get("FREQ"),r=a.get("BYDAY");if(!(a.has("INTERVAL")&&a.get("INTERVAL")!=="1")&&!(a.has("UNTIL")||a.has("COUNT"))){if(i==="DAILY")return`Every day${s}`;if(i==="WEEKLY"){if(r===void 0)return;if(r===J)return`Every weekday${s}`;const l=N.indexOf(r);return l===-1?void 0:`Every week on ${E[l]}${s}`}if(i==="MONTHLY"){const l=r?.match(/^(-?\d)([A-Z]{2})$/);if(!l)return;const o=G.indexOf(Number(l[1])),c=N.indexOf(l[2]);return o===-1||c===-1?void 0:`Every month on the ${K[o]} ${E[c]}${s}`}if(i==="YEARLY"){const l=Number(a.get("BYMONTH")),o=Number(a.get("BYMONTHDAY"));return!l||!o||l>12?void 0:`Every year on ${o} ${Q[l-1]}${s}`}}}function Pe(e,t){return{title:"",date:e,startTime:"09:00",endTime:"10:00",allDay:!1,calendarId:t,location:"",guests:"",notes:"",repeat:""}}function _e(e,t){return{title:e.title,date:e.start.slice(0,10),startTime:e.allDay?"":e.start.slice(11,16),endTime:e.allDay?"":e.end.slice(11,16),allDay:e.allDay,calendarId:e.calendarId,location:t.location,guests:"",notes:t.notes,repeat:t.repeat}}function q(e,t){return e.allDay?{start:e.date,end:ee(e.date,1)}:{start:_(e.date,e.startTime,t),end:_(e.date,e.endTime,t)}}function V(e,t){return e.title.trim()===""?"Give the event a title before saving it.":e.date===""?"Pick the day the event is on.":e.calendarId===""?"Pick the calendar to save the event in.":!e.allDay&&(e.startTime===""||e.endTime==="")?"Set a start and an end time, or mark the event all day.":!e.allDay&&e.endTime<=e.startTime?"The end time is not after the start time. Move one of them.":t&&O(e.repeat)===void 0?"This calendar can't store that repeat rule. Pick one of the offered rules, or turn the repeat off.":""}function Ue(e,t){const a=V(e,!0);if(a!=="")return{ok:!1,problem:a};const{start:s,end:i}=q(e,t);return{ok:!0,input:{calendarId:e.calendarId,summary:e.title.trim(),description:e.notes,location:e.location,start:s,end:i,allDay:e.allDay,...t===""?{}:{timeZone:t},recurrenceRule:O(e.repeat)??""}}}function Be(e,t,a){const s=t.repeat!==e.repeat,i=V(t,s);if(i!=="")return{ok:!1,problem:i};const r={};if(t.title.trim()!==e.title.trim()&&(r.summary=t.title.trim()),t.location!==e.location&&(r.location=t.location),t.notes!==e.notes&&(r.description=t.notes),t.date!==e.date||t.startTime!==e.startTime||t.endTime!==e.endTime||t.allDay!==e.allDay){const{start:o,end:c}=q(t,a);r.start=o,r.end=c,r.allDay=t.allDay,a!==""&&(r.timeZone=a)}return s&&(r.recurrenceRule=O(t.repeat)??""),{ok:!0,patch:r}}const C=ce(400,404,412),Me=new Set(["calendarEventOperationsListCalendarEvents","calendarEventDetailOperationsGetCalendarEvent","calendarFreeBusyOperationsListCalendarFreeBusy"]),D={kind:"written"},k=e=>de(e)===412?{kind:"conflict"}:{kind:"refused",message:me(e)},Se={this:"This",following:"Following",all:"All"};function $e(){const e=oe();return p.useCallback(()=>{e.invalidateQueries({predicate:t=>{const a=t.queryKey[0];if(typeof a!="object"||a===null)return!1;const s=a._id;return typeof s=="string"&&Me.has(s)}})},[e])}const B=({scope:e,recurrenceId:t})=>e===void 0||e==="all"?{}:{scope:Se[e],recurrenceId:t};function ze(){const e=$e(),t=T({...re(),meta:C,onSuccess:e}),a=T({...ie(),meta:C,onSuccess:e}),s=T({...le(),meta:C,onSuccess:e}),i=p.useCallback(o=>t.mutateAsync({body:o}).then(()=>D).catch(k),[t]),r=p.useCallback((o,c)=>a.mutateAsync({path:{calendarObjectId:o.calendarObjectId},query:{calendarId:o.calendarId,...B(o)},headers:{"If-Match":o.etag},body:c}).then(()=>D).catch(k),[a]),l=p.useCallback(o=>s.mutateAsync({path:{calendarObjectId:o.calendarObjectId},query:{calendarId:o.calendarId,...B(o)},headers:{"If-Match":o.etag}}).then(()=>D).catch(k),[s]);return p.useMemo(()=>({createEvent:i,updateEvent:r,deleteEvent:l,isWriting:t.isPending||a.isPending||s.isPending}),[i,r,l,t.isPending,a.isPending,s.isPending])}function He({title:e,subtitle:t,calendars:a,draft:s,onChange:i,problem:r,saveLabel:l,isSaving:o,repeatEditable:c=!0,calendarEditable:y=!0,onSave:g,onCancel:b}){return n.jsx(Oe,{title:e,subtitle:t,onClose:b,children:n.jsx(De,{draft:s,onChange:i,calendars:a,layout:"pane",repeatEditable:c,calendarEditable:y,saveLabel:o?"Saving…":l,onSave:g,onCancel:b,header:r===""?void 0:n.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[n.jsx(ue,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":"true"}),n.jsx("p",{className:"min-w-0 flex-1 break-words text-fg",children:r})]})})})}export{He as C,Ue as c,_e as d,Pe as e,Be as p,We as t,ze as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,r as e}from"./index-
|
|
1
|
+
import{j as t,r as e}from"./index-CerSmEHP.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,aj as l,ak as o}from"./index-
|
|
1
|
+
import{r,j as n,aj as l,ak as o}from"./index-CerSmEHP.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-CerSmEHP.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,Z as r}from"./index-
|
|
1
|
+
import{j as t,Z as r}from"./index-CerSmEHP.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{eb as _,r as n,ch as z,c as Y,C as V,bh as ge,cL as he,aW as me,aX as pe,j as r,ai as fe,cS as Ie,cT as xe}from"./index-
|
|
1
|
+
import{eb as _,r as n,ch as z,c as Y,C as V,bh as ge,cL as he,aW as me,aX as pe,j as r,ai as fe,cS as Ie,cT as xe}from"./index-CerSmEHP.js";import{u as Te,p as X,R as ye}from"./useSearchTokenContext-BQfR3lc9.js";import{G as be,I as ve,ar as Z,aE as Se,aF as Ce,as as Re,aG as we,au as Fe,b as Me,M as je,aB as Oe,aH as Pe,aD as ke,s as Le,O as Ae,T as J,R as Ee,P as Ne,d as qe,a0 as De,a1 as Be,a3 as $,a4 as ee,a5 as Qe,a6 as Ge,a7 as He}from"./MailListHeader-BcoBd9rJ.js";import{u as Ke,l as _e,b as ze,a as Ve}from"./MailViewChrome-BQhkNcYQ.js";import{f as We}from"./ErrorState-1AEFpVV9.js";import{d as K,w as Ue}from"./wizard-selection-DxUM65kM.js";import{a as Xe}from"./useMessageBodyContent-BDww0y-S.js";import{g as Ze,h as Je}from"./search-token-index-C7yiTbjS.js";import{u as Ye}from"./sections-C3f119Qp.js";const q=e=>({...e,starred:!0,order:"desc"}),$e=(e={})=>z({query:q(e)});function te(e={}){const{data:t,isLoading:s,isError:a,error:c,refetch:l,fetchNextPage:i,hasNextPage:g,isFetchingNextPage:h}=Ke({queryKey:$e(e),queryFn:async({pageParam:I})=>{const{data:u}=await _({query:{...q(e),continuationToken:I},throwOnError:!0});return u},initialPageParam:void 0,getNextPageParam:I=>I.continuationToken,staleTime:6e4});return{threads:n.useMemo(()=>(t?.pages??[]).flatMap(I=>I.items??[]),[t]),isLoading:s,isError:a,error:c,refetch:l,fetchNextPage:i,hasNextPage:g,isFetchingNextPage:h}}function et(e,t){const s=e.query??"",a={...q(e),limit:t},{data:c}=Y({queryKey:z({query:a}),queryFn:async()=>{const{data:l}=await _({query:a,throwOnError:!0});return l},enabled:s.length>0,staleTime:3e4});return n.useMemo(()=>c?.items??[],[c])}function tt(e={}){const t={...q(e),unread:!0,count:!0,results:!1},{data:s}=Y({queryKey:z({query:t}),queryFn:async()=>{const{data:a}=await _({query:t,throwOnError:!0});return a},staleTime:6e4});return s?.count}const st=["category","unread","starred","attachments"],at=(e,t)=>{const s=be(e),{params:a,residual:c}=ve(t,{...s,starred:!0},st);return{criteria:{...a,...s},residual:c}},rt=200;function ot({rows:e,verb:t}){const{selectedIds:s,exitSelection:a}=ke(),c=n.useMemo(()=>Ue(e,s),[e,s]);return r.jsx(Le,{verb:t,selection:c,selectionRestriction:"spansAccounts",onFinished:a})}function nt({selectedMessageId:e,onOpenThread:t,commandsRef:s,onTriageContextChange:a,onDeleteMessages:c}){const{searchQuery:l,resultFolderIndex:i,onSearchClearQuery:g}=V(),h=Te(),P=ge(),I=he(),[u,m]=n.useState("all"),[S,k]=n.useState(new Set),R=n.useCallback(d=>{k(b=>{const f=new Set(b);return f.has(d)?f.delete(d):f.add(d),f})},[]),w=n.useCallback(()=>{m("all"),k(new Set)},[]),T=n.useCallback(()=>{w(),g()},[w,g]),{freeText:x,tokens:C}=X(l.trim().toLowerCase(),h),L=X(l.trim(),h).freeText,{criteria:F,residual:p}=n.useMemo(()=>at({category:u,attributes:S},C),[u,S,C]),M=n.useMemo(()=>x?{...F,query:x}:F,[F,x]),{threads:A,isLoading:E,isError:v,error:B,refetch:j,fetchNextPage:Q,hasNextPage:G,isFetchingNextPage:O}=te(F),N=et(M,rt),o=n.useMemo(()=>{const d=K(A).map(Z),b=x?Se(d.filter(f=>Ce(f,x)),K(N).map(Z)):d;return K(b).filter(f=>Re(f,p))},[A,N,x,p]),y=n.useCallback((d,b)=>{const f=o.find(ue=>ue.id===d)?.threadId;f&&t?.({threadId:f,messageId:d},b)},[o,t]),H=n.useCallback(d=>{const b=d.threadId??o.find(f=>f.id===d.id)?.threadId;b&&t?.({threadId:b,messageId:d.id})},[o,t]),re=n.useMemo(()=>we(),[]),oe=n.useMemo(()=>o.map(d=>Fe(d,i)),[o,i]),ne=tt(M)??null,ie=n.useMemo(()=>C.filter(d=>d.type!=="isStarred"),[C]),de=_e({chips:{category:u,attributes:S},tokens:ie,reach:p.length>0||x?"loaded-pages":"whole-folder",onClear:T}),W=E?"loading":v?"error":o.length===0?"empty":"ready",ce=n.useCallback(()=>{const d=me(pe());window.open(d,"_blank","noopener,noreferrer")},[]),U=Me(),le=r.jsx("div",{className:"flex h-full min-h-0 flex-col",children:r.jsxs("div",{className:"flex-1 overflow-y-auto",children:[r.jsx("div",{className:"divide-y divide-line",children:o.map(d=>r.jsx(je,{thread:d,active:d.id===e,onClick:()=>y(d.id)},d.id))}),G?r.jsx("button",{type:"button",className:"w-full py-3 text-sm text-muted hover:text-fg disabled:opacity-50",onClick:()=>Q(),disabled:O,children:O?"Loading…":"Load more"}):null]})});return r.jsx(ze,{title:"Starred",unreadCount:ne,preset:re,selectedCategory:u,activeFilters:S,onSelectCategory:m,onToggleFilter:R,onClearFilters:w,searchResults:oe,searchLoading:E,onSelectSearchResult:H,searchResultsInBody:!0,children:r.jsxs(Oe,{selectedMessageId:e,rows:o,onOpen:y,onDeleteMessages:c,onSelectionVerb:I.start,commandsRef:s,onTriageContextChange:a,children:[r.jsx(Ve,{listTitle:"Starred",sections:[{id:"flagged",threads:o}],flatList:!0,hideHeader:!0,listState:U.searchResults?"ready":W,listFilter:de,listScopeLabel:"Starred",searchQuery:L||void 0,errorMessage:v?We(B):void 0,onRetry:()=>j(),onReportError:ce,selectedThreadId:e,onSelectThread:y,isDesktop:P,selectionBar:r.jsx(Pe,{title:"Starred"}),listBody:U.searchResults??(W==="ready"?le:void 0)}),r.jsx(ot,{rows:o,verb:I.verb})]})})}const se=n.createContext(null);function D(){const e=n.useContext(se);if(!e)throw new Error("FlaggedPane.* must be used inside <FlaggedPane>");return e}function it({thread:e,children:t}){const s=Ze(),a=Je(),c=Ye(),{searchInput:l}=V(),i=e?.threadId,g=e?.messageId,{threads:h}=te(),P=n.useMemo(()=>{if(i)return h.find(o=>o.messageId===g)??h.find(o=>o.threadId===i)},[h,i,g]),I=Ae(i,g),u=P??I,m=g??u?.messageId,S=n.useMemo(()=>{if(i)return{threadId:i,mailboxId:u?.mailboxId??"",subject:u?.subject,messageId:m,authenticity:u?.authenticity}},[i,u,m]),k=n.useCallback((o,y)=>{s(o,{replace:y?.replace,query:l})},[s,l]),R=n.useCallback(o=>{m&&o.includes(m)&&a()},[m,a]),w=J({thread:u,isOpen:!0,onAfterOptimisticRemove:R}),T=Ee(),{deleteMessages:x}=Ne({mailboxId:u?.mailboxId??"",messages:h,onAfterOptimisticRemove:R}),{toggleReadFor:C}=qe({mailboxId:u?.mailboxId??"",messages:h}),L=T.focusedMessageId,p=n.useMemo(()=>h.find(o=>o.messageId===L),[h,L])??u,M=J({thread:p,isOpen:p?.messageId===m}),A=Xe(),E=fe(),v=Ie(),B=n.useMemo(()=>xe(v,i,m),[v,i,m]),j=n.useMemo(()=>{if(p)return o=>v({threadId:p.threadId,messageId:p.messageId,mode:o})},[v,p]),{nextMessageId:Q,previousMessageId:G}=De({context:T,orderedIds:T.orderedIds,selectedMessageId:m,enabled:!A&&!E,hasOpenThread:i!==void 0,onClose:a,handlers:{reply:()=>j?.("reply"),replyAll:()=>j?.("reply-all"),forward:()=>j?.("forward"),delete:()=>{T.listCommandsRef.current?.requestVerb("delete")||M.deleteThread()},toggleStar:M.toggleStar,toggleRead:()=>{T.listCommandsRef.current?.requestVerb("markRead")||p&&C([p.messageId],!p.isRead)},goBrief:()=>c("brief"),goSettings:()=>c("settings")}}),O=n.useCallback(o=>{if(!o)return;const y=h.find(H=>H.messageId===o);return y?{threadId:y.threadId,messageId:o}:void 0},[h]),N={selectedMessageId:m,selectedThread:u,conversation:S,onOpenThread:k,onCloseThread:a,nextThread:O(Q),previousThread:O(G),actions:w,onReply:B,triage:T,onDeleteMessages:x,handleDeselectIfRemoved:R};return r.jsx(se.Provider,{value:N,children:t})}function ae(){const{selectedMessageId:e,onOpenThread:t,triage:s,onDeleteMessages:a}=D();return r.jsx(nt,{selectedMessageId:e,onOpenThread:t,commandsRef:s.listCommandsRef,onTriageContextChange:s.onTriageContextChange,onDeleteMessages:a})}function dt(){const{conversation:e,selectedThread:t,actions:s,onReply:a,handleDeselectIfRemoved:c}=D(),l=!!e,i=Ge(e?.threadId);return r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[r.jsx(He,{hasThread:l,intelligenceOpen:i.isShowing,canToggleIntelligence:i.canToggle,onToggleIntelligence:i.toggle,onReply:a?()=>a("reply"):void 0,onReplyAll:a?()=>a("reply-all"):void 0,onForward:a?()=>a("forward"):void 0,onDelete:l?s.deleteThread:void 0,onToggleStar:l?s.toggleStar:void 0,isStarred:s.isStarred,moveContext:l&&s.accountId&&s.mailboxId?{accountId:s.accountId,currentMailboxId:s.mailboxId,onMove:s.moveThread}:void 0}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?r.jsx($,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:i.open,listOnScreen:!0}):r.jsx(ye,{})})]}),r.jsx(ee,{isOpen:i.drawerOpen,onClose:i.closeDrawer,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:c})]})}function ct(){const{selectedThread:e,handleDeselectIfRemoved:t}=D(),{onToggleIntelligence:s}=V();return r.jsx(Qe,{onClose:s,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function lt(){const{selectedThread:e,conversation:t,onCloseThread:s,onOpenThread:a,nextThread:c,previousThread:l,handleDeselectIfRemoved:i}=D(),g=Be(t?.threadId??null);return t?r.jsxs(r.Fragment,{children:[r.jsx($,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:s,onOpenIntelligence:g.toggle,onSwipeNext:c?()=>a(c):void 0,onSwipePrevious:l?()=>a(l):void 0,mobileIntelligenceOpen:g.isOpen}),r.jsx(ee,{isOpen:g.isOpen,onClose:g.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:i})]}):r.jsx("div",{className:"h-full",children:r.jsx(ae,{})})}const yt=Object.assign(it,{List:ae,Reading:dt,Intelligence:ct,Phone:lt});export{yt as F};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,c as f,d as m,E as N,j as e,bh as E,X as w}from"./index-
|
|
1
|
+
import{r as n,c as f,d as m,E as N,j as e,bh as E,X as w}from"./index-CerSmEHP.js";import{E as u}from"./ErrorState-1AEFpVV9.js";import{D as r,C as x,u as k}from"./index-DoR-Emr2.js";import{c as p,d as h,e as b}from"./useMessageBodyContent-BDww0y-S.js";import{C as S}from"./confirm-dialog-D73kfago.js";const C=t=>t?"Draft":"New Message",I=()=>{const t=n.useRef(!1);return n.useCallback(()=>{const s=document.querySelector("[data-subject-field]")?.value??"",o=(document.querySelector('[data-testid="compose-body"]')?.textContent??"").replace(/--\s*/g,"").trim();return t.current=s.trim().length>0||o.length>0,t.current},[])},O=()=>{const t=p(),i=h(),s=b(),a=I(),[l,o]=n.useState(!1),{isError:d,error:c,refetch:g}=f({...m(),staleTime:1/0}),j=n.useCallback(D=>{D||(a()?o(!0):s())},[s,a]),y=n.useCallback(()=>{o(!1),s()},[s]),v=n.useCallback(()=>{o(!1)},[]);return N({id:"mobile-compose",open:!0}),e.jsxs(r.Root,{open:!0,onOpenChange:j,children:[e.jsxs(r.Portal,{children:[e.jsx(r.Overlay,{className:"fixed inset-0 z-40 bg-black/40"}),e.jsxs(r.Content,{className:"fixed inset-x-0 bottom-0 z-50 flex flex-col rounded-t-lg bg-canvas pb-[env(safe-area-inset-bottom,0px)]",style:{height:"95dvh"},children:[e.jsx(r.Handle,{className:"mx-auto mt-2 mb-1 h-1.5 w-12 rounded-full bg-fg-muted/30"}),e.jsx(r.Title,{className:"px-4 py-2 text-base font-semibold border-b border-line",children:C(t)}),d?e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(u,{title:"Couldn't load compose",error:c,onRetry:()=>{g()}})}):e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(x,{mode:"new",outboxMessageId:t,onDraftCreated:i,onClose:s})})]})]}),e.jsx(S,{isOpen:l,title:"Discard draft?",description:"Your message has unsaved content. Are you sure you want to discard it?",confirmLabel:"Discard",cancelLabel:"Keep editing",destructive:!0,onConfirm:y,onCancel:v})]})},q=()=>{const t=p(),i=h(),s=b(),a=E(),{isError:l,error:o,refetch:d}=f({...m(),staleTime:1/0});if(k({bindings:[{key:"Escape",handler:s,preventDefault:!0}]}),!a)return e.jsx(O,{});const c=e.jsxs("header",{className:"flex items-center justify-between gap-2 px-4 py-3 border-b border-line shrink-0",children:[e.jsx("div",{className:"flex items-center gap-2 min-w-0",children:e.jsx("h2",{className:"text-lg font-semibold truncate",children:C(t)})}),e.jsx("button",{type:"button",onClick:s,className:"p-2 rounded-md hover:bg-surface-raised transition-colors min-h-11 min-w-11 inline-flex items-center justify-center","aria-label":"Close",children:e.jsx(w,{className:"size-5"})})]});return l?e.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[c,e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(u,{title:"Couldn't load compose",error:o,onRetry:()=>{d()}})})]}):e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-canvas",children:[c,e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(x,{mode:"new",outboxMessageId:t,onDraftCreated:i,onClose:s})})]})};export{q as F};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aq as Ns,cV as Br,r as c,e as se,j as s,W as ze,Y as Cs,az as Ze,t as M,ap as Yn,a5 as Kr,f as K,X as _e,a1 as bt,T as Ue,cW as Xn,aK as Hr,U as qr,b4 as Qr,g as we,cX as Ss,V as et,cY as Gr,cZ as Wr,c_ as Vr,c$ as Yr,d0 as Xr,d1 as Jn,d2 as Zn,bj as Jr,d3 as Zr,d4 as ea,bA as Ts,d5 as eo,d6 as ta,aG as to,L as sa,Z as so,d7 as no,B as na,d8 as ao,d9 as ro,da as oo,db as io,dc as lo,w as co,c as J,d as tt,G as vt,dd as uo,de as fo,df as Ut,h as le,ar as ye,i as me,M as st,cy as Me,dg as Bt,b8 as mo,dh as Ae,di as po,dj as en,dk as ho,dl as go,dm as xo,b1 as bo,ci as vo,dn as yo,cN as Is,cO as aa,s as ko,dp as jo,bh as Es,bk as ra,be as oa,bl as ia,bm as la,E as Rs,bn as wo,aW as ca,aX as da,cD as No,dq as Co,a9 as ua,cC as So,dr as To,ds as Io,dt as Eo,du as Ro,dv as fa,dw as Mo,cS as Ao,bL as Ms,dx as $o,dy as tn,dz as Lo,dA as ns,dB as Po,bK as Do,P as Fo,q as Oo,af as ma,F as zo,cR as sn,bu as _o,dC as Uo,dD as Bo,at as nn,cQ as Ko,dE as Ho,ag as qo,cg as Qo,ch as Go,dF as Wo,C as Kt,dG as Vo,dH as Yo,dI as an,dJ as Xo,dK as Jo,dL as Zo,dM as ei,v as pa,cU as Te,dN as As,dO as ti,cj as si,ce as ni,dP as ai,dQ as rn,a0 as ri,ck as oi}from"./index-_JBKtYXu.js";import{u as ii,L as li,a as ci}from"./roving-focus-R7ZTRnKj.js";import{m as di,S as ha,i as Ne,t as Ce,r as yt,n as kt,o as jt,p as wt,q as ui,h as fi,d as mi,D as pi,b as At,a as hi,v as gi,w as xi,x as dt,e as bi,y as vi,z as yi,u as ki}from"./search-token-index-U-0PE-Ox.js";import{K as ji}from"./kbd-CUNCsdLt.js";import{P as ga,f as wi,U as Ni,a as Ci,E as Si,s as Ti}from"./attachment-file-B5mkzgR1.js";import{M as xa}from"./mail-B73P70rO.js";import{A as pt}from"./avatar-Dso3OQH7.js";import{M as Ii,a as Ei,b as ba,c as Ri,s as va,d as ya,e as Mi,f as Ai,S as on,g as ka,u as ja,p as $i,r as Li}from"./useSearchTokenContext-Du649zXC.js";import{C as Pi,D as Ye,u as Di}from"./index-CAWCA7kp.js";import{E as wa}from"./EmptyState-D8775COI.js";import{E as Oe}from"./ErrorState-BUi73q43.js";import{a as Na,c as nt,b as Fi,g as Oi,e as Be,h as zi,d as _i}from"./format-C58wplMJ.js";import{D as Ui}from"./download-9A_DQZED.js";import{g as Bi}from"./useMessageBodyContent-ChO4c73P.js";import{C as Ki}from"./calendar-event-chip-CoD7r2-a.js";import{c as Hi}from"./calendar-color-BG7928-_.js";import{R as qi,M as Qi}from"./attendee-row-BeKlhe0A.js";import{C as Ca}from"./clock-DycMqInq.js";import{M as Gi,G as Wi}from"./map-pin-CEP5uZHA.js";import{B as Vi,b as Yi,u as Xi,i as Ji}from"./useLayoutTier-D1c62D6O.js";import{S as Zi,C as Sa}from"./shield-check-WkiJUavf.js";import{u as Ta}from"./useDebouncedValue-DYu0unJr.js";import{h as ln,u as el,a as tl,i as sl,n as nl,o as al,j as rl,k as ol,S as il}from"./useFilters-BDQsNdKM.js";import{u as $s}from"./useQueries-DNMW1lkL.js";import{C as $t}from"./confirm-dialog-C_t09Gva.js";import{r as ll,a as cl}from"./search-scope-B5-OK3Cq.js";import{M as dl}from"./menu-CyMA8ejK.js";function ht(e){if(ul())e.focus({preventScroll:!0});else{let t=fl(e);e.focus(),ml(t)}}let Lt=null;function ul(){if(Lt==null){Lt=!1;try{document.createElement("div").focus({get preventScroll(){return Lt=!0,!0}})}catch{}}return Lt}function fl(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 ml(e){for(let{element:t,scrollTop:n,scrollLeft:a}of e)t.scrollTop=n,t.scrollLeft=a}const Ee=e=>e?.ownerDocument??document,Re=e=>e&&"window"in e&&e.window===e?e:Ee(e).defaultView||window;function pl(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function hl(e){return pl(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let gl=!1;function Ia(){return gl}function be(e,t){if(!Ia())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:hl(n)?n=n.host:n=n.parentNode}return!1}function ee(e){if(Ia()&&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 xl=typeof Element<"u"&&"checkVisibility"in Element.prototype;function bl(e){const t=Re(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}=Re(e);let{display:i,visibility:l}=o(e);r=i!=="none"&&l!=="hidden"&&l!=="collapse"}return r}function vl(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 Ea(e,t){return xl?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):e.nodeName!=="#comment"&&bl(e)&&vl(e,t)&&(!e.parentElement||Ea(e.parentElement,e))}const Ra=["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"],yl=Ra.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";Ra.push('[tabindex]:not([tabindex="-1"]):not([disabled])');function kl(e,t){return e.matches(yl)&&!jl(e)&&(t?.skipVisibilityCheck||Ea(e))}function jl(e){let t=e;for(;t!=null;){if(t instanceof Re(t).HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}const Ls=typeof document<"u"?Ns.useLayoutEffect:()=>{};function wl(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Nl(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Cl(e){for(;e&&!kl(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=Re(e),n=t.document.activeElement;if(!n||n===e)return;let a=!1,r=g=>{(ee(g)===n||a)&&g.stopImmediatePropagation()},o=g=>{(ee(g)===n||a)&&(g.stopImmediatePropagation(),!e&&!a&&(a=!0,ht(n),d()))},i=g=>{(ee(g)===e||a)&&g.stopImmediatePropagation()},l=g=>{(ee(g)===e||a)&&(g.stopImmediatePropagation(),a||(a=!0,ht(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 Ht(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 Ps(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}function $e(e){let t=null;return()=>(t==null&&(t=e()),t)}const Ot=$e(function(){return Ps(/^Mac/i)}),Sl=$e(function(){return Ps(/^iPhone/i)}),Ma=$e(function(){return Ps(/^iPad/i)||Ot()&&navigator.maxTouchPoints>1}),Aa=$e(function(){return Sl()||Ma()}),Tl=$e(function(){return Ht(/AppleWebKit/i)&&!Il()}),Il=$e(function(){return Ht(/Chrome/i)}),$a=$e(function(){return Ht(/Android/i)}),El=$e(function(){return Ht(/Firefox/i)});function Rl(e){return e.pointerType===""&&e.isTrusted?!0:$a()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Ml(e){return!$a()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"}function gt(e,t,n=!0){let{metaKey:a,ctrlKey:r,altKey:o,shiftKey:i}=t;El()&&window.event?.type?.startsWith("key")&&e.target==="_blank"&&(Ot()?a=!0:r=!0);let l=Tl()&&Ot()&&!Ma()?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});gt.isOpening=n,ht(e),e.dispatchEvent(l),gt.isOpening=!1}gt.isOpening=!1;let Ie=new Map,ps=new Set;function cn(){if(typeof window>"u")return;function e(a){return"propertyName"in a}let t=a=>{let r=ee(a);if(!e(a)||!r)return;let o=Ie.get(r);o||(o=new Set,Ie.set(r,o),r.addEventListener("transitioncancel",n,{once:!0})),o.add(a.propertyName)},n=a=>{let r=ee(a);if(!e(a)||!r)return;let o=Ie.get(r);if(o&&(o.delete(a.propertyName),o.size===0&&(r.removeEventListener("transitioncancel",n),Ie.delete(r)),Ie.size===0)){for(let i of ps)i();ps.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",n)}typeof document<"u"&&(document.readyState!=="loading"?cn():document.addEventListener("DOMContentLoaded",cn));function Al(){for(const[e]of Ie)"isConnected"in e&&!e.isConnected&&Ie.delete(e)}function $l(e){requestAnimationFrame(()=>{Al(),Ie.size===0?e():ps.add(e)})}function La(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}let hs=new Map;typeof FinalizationRegistry<"u"&&new FinalizationRegistry(e=>{hs.delete(e)});function Ll(e,t){if(e===t)return e;let n=hs.get(e);if(n)return n.forEach(r=>r.current=t),t;let a=hs.get(t);return a?(a.forEach(r=>r.current=e),e):t}function Pl(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1;const a=e.map(r=>{const o=dn(r,t);return n||=typeof o=="function",o});if(n)return()=>{a.forEach((r,o)=>{typeof r=="function"?r():dn(e[o],null)})}}}function dn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Nt(...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]=La(o,i):(r==="className"||r==="UNSAFE_className")&&typeof o=="string"&&typeof i=="string"?t[r]=Br(o,i):r==="id"&&o&&i?t.id=Ll(o,i):r==="ref"&&o&&i?t.ref=Pl(o,i):t[r]=i!==void 0?i:o}}return t}function Dl(e,t){Ls(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}const Fl=Ns.useInsertionEffect??Ls;function as(e){const t=c.useRef(null);return Fl(()=>{t.current=e},[e]),c.useCallback((...n)=>{const a=t.current;return a?.(...n)},[])}let Xe="default",gs="",Ft=new WeakMap;function Ol(e){if(Aa()){if(Xe==="default"){const t=Ee(e);gs=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect="none"}Xe="disabled"}else if(e instanceof HTMLElement||e instanceof SVGElement){let t="userSelect"in e.style?"userSelect":"webkitUserSelect";Ft.set(e,e.style[t]),e.style[t]="none"}}function un(e){if(Aa()){if(Xe!=="disabled")return;Xe="restoring",setTimeout(()=>{$l(()=>{if(Xe==="restoring"){const t=Ee(e);t.documentElement.style.webkitUserSelect==="none"&&(t.documentElement.style.webkitUserSelect=gs||""),gs="",Xe="default"}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&Ft.has(e)){let t=Ft.get(e),n="userSelect"in e.style?"userSelect":"webkitUserSelect";e.style[n]==="none"&&(e.style[n]=t),e.getAttribute("style")===""&&e.removeAttribute("style"),Ft.delete(e)}}function fn(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let rs=new WeakMap;function zl(e){let t=e??(typeof document<"u"?document:void 0);if(!t)return fn(t);if(rs.has(t))return rs.get(t);let n=t.querySelector('meta[property="csp-nonce"]'),a=n&&n instanceof Re(n).HTMLMetaElement&&(n.nonce||n.content)||fn(t)||void 0;return a!==void 0&&rs.set(t,a),a}const Pa=Ns.createContext({register:()=>{}});Pa.displayName="PressResponderContext";function Da(){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 _l(e){let t=c.useContext(Pa);if(t){let{register:n,ref:a,...r}=t;e=Nt(r,e),n()}return Dl(t,e.ref),e}class Pt{#e;constructor(t,n,a,r){this.#e=!0;const i=(r?.target??a.currentTarget)?.getBoundingClientRect();let l,d=0,x,g=null;a.clientX!=null&&a.clientY!=null&&(x=a.clientX,g=a.clientY),i&&(x!=null&&g!=null?(l=x-i.left,d=g-i.top):(l=i.width/2,d=i.height/2)),this.type=t,this.pointerType=n,this.target=a.currentTarget,this.shiftKey=a.shiftKey,this.metaKey=a.metaKey,this.ctrlKey=a.ctrlKey,this.altKey=a.altKey,this.x=l,this.y=d,this.key=a.key}continuePropagation(){this.#e=!1}get shouldStopPropagation(){return this.#e}}const mn=Symbol("linkClicked"),pn="react-aria-pressable-style",hn="data-react-aria-pressable";function Ul(e){let{onPress:t,onPressChange:n,onPressStart:a,onPressEnd:r,onPressUp:o,onClick:i,isDisabled:l,isPressed:d,preventFocusOnPress:x,shouldCancelOnPointerExit:g,allowTextSelectionOnPress:v,ref:m,...b}=_l(e),[f,u]=c.useState(!1),h=c.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:p,removeAllGlobalListeners:j}=Da(),y=c.useCallback((w,R)=>{let P=h.current;if(l||P.didFirePressStart)return!1;let N=!0;if(P.isTriggeringEvent=!0,a){let $=new Pt("pressstart",R,w);a($),N=$.shouldStopPropagation}return n&&n(!0),P.isTriggeringEvent=!1,P.didFirePressStart=!0,u(!0),N},[l,a,n]),k=c.useCallback((w,R,P=!0)=>{let N=h.current;if(!N.didFirePressStart)return!1;N.didFirePressStart=!1,N.isTriggeringEvent=!0;let $=!0;if(r){let C=new Pt("pressend",R,w);r(C),$=C.shouldStopPropagation}if(n&&n(!1),u(!1),t&&P&&!l){let C=new Pt("press",R,w);t(C),$&&=C.shouldStopPropagation}return N.isTriggeringEvent=!1,$},[l,r,n,t]),S=as(k),E=c.useCallback((w,R)=>{let P=h.current;if(l)return!1;if(o){P.isTriggeringEvent=!0;let N=new Pt("pressup",R,w);return o(N),P.isTriggeringEvent=!1,N.shouldStopPropagation}return!0},[l,o]),A=as(E),O=c.useCallback(w=>{let R=h.current;if(R.isPressed&&R.target){R.didFirePressStart&&R.pointerType!=null&&k(De(R.target,w),R.pointerType,!1),R.isPressed=!1,R.isOverTarget=!1,R.activePointerId=null,R.pointerType=null,j(),v||un(R.target);for(let P of R.disposables)P();R.disposables=[]}},[v,j,k]),F=as(O);c.useEffect(()=>{l&&h.current.isPressed&&F({currentTarget:h.current.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})},[l]);let L=c.useCallback(w=>{g&&O(w)},[g,O]),z=c.useCallback(w=>{l||i?.(w)},[l,i]),I=c.useCallback((w,R)=>{if(!l&&i){let P=new MouseEvent("click",w);Nl(P,R),i(wl(P))}},[l,i]),_=c.useMemo(()=>{let w=h.current,R={onKeyDown(N){if(os(N.nativeEvent,N.currentTarget)&&be(N.currentTarget,ee(N))){gn(ee(N),N.key)&&N.preventDefault();let $=!0;!w.isPressed&&!N.repeat&&(w.target=N.currentTarget,w.isPressed=!0,w.pointerType="keyboard",$=y(N,"keyboard"));let C=N.currentTarget,B=U=>{os(U,C)&&!U.repeat&&be(C,ee(U))&&w.target&&A(De(w.target,U),"keyboard")};p(Ee(N.currentTarget),"keyup",La(B,P),!0),$&&N.stopPropagation(),N.metaKey&&Ot()&&w.metaKeyEvents?.set(N.key,N.nativeEvent)}else N.key==="Meta"&&(w.metaKeyEvents=new Map)},onClick(N){if(!(N&&!be(N.currentTarget,ee(N)))&&N&&N.button===0&&!w.isTriggeringEvent&&!gt.isOpening){let $=!0;if(l&&N.preventDefault(),!w.ignoreEmulatedMouseEvents&&!w.isPressed&&(w.pointerType==="virtual"||Rl(N.nativeEvent))){let C=y(N,"virtual"),B=A(N,"virtual"),U=S(N,"virtual");z(N),$=C&&B&&U}else if(w.isPressed&&w.pointerType!=="keyboard"){let C=w.pointerType||N.nativeEvent.pointerType||"virtual",B=A(De(N.currentTarget,N),C),U=S(De(N.currentTarget,N),C,!0);$=B&&U,w.isOverTarget=!1,z(N),F(N)}w.ignoreEmulatedMouseEvents=!1,$&&N.stopPropagation()}}},P=N=>{if(w.isPressed&&w.target&&os(N,w.target)){gn(ee(N),N.key)&&N.preventDefault();let $=ee(N),C=be(w.target,$);S(De(w.target,N),"keyboard",C),C&&I(N,w.target),j(),N.key!=="Enter"&&Ds(w.target)&&be(w.target,$)&&!N[mn]&&(N[mn]=!0,gt(w.target,N,!1)),w.isPressed=!1,w.metaKeyEvents?.delete(N.key)}else if(N.key==="Meta"&&w.metaKeyEvents?.size){let $=w.metaKeyEvents;w.metaKeyEvents=void 0;for(let C of $.values())w.target?.dispatchEvent(new KeyboardEvent("keyup",C))}};if(typeof PointerEvent<"u"){R.onPointerDown=C=>{if(C.button!==0||!be(C.currentTarget,ee(C)))return;if(Ml(C.nativeEvent)){w.pointerType="virtual";return}w.pointerType=C.pointerType;let B=!0;if(!w.isPressed){w.isPressed=!0,w.isOverTarget=!0,w.activePointerId=C.pointerId,w.target=C.currentTarget,v||Ol(w.target),B=y(C,w.pointerType);let U=ee(C);"releasePointerCapture"in U&&("hasPointerCapture"in U?U.hasPointerCapture(C.pointerId)&&U.releasePointerCapture(C.pointerId):U.releasePointerCapture(C.pointerId)),p(Ee(C.currentTarget),"pointerup",N,!1),p(Ee(C.currentTarget),"pointercancel",$,!1)}B&&C.stopPropagation()},R.onMouseDown=C=>{if(be(C.currentTarget,ee(C))&&C.button===0){if(x){let B=Cl(C.target);B&&w.disposables.push(B)}C.stopPropagation()}},R.onPointerUp=C=>{!be(C.currentTarget,ee(C))||w.pointerType==="virtual"||C.button===0&&!w.isPressed&&A(C,w.pointerType||C.pointerType)},R.onPointerEnter=C=>{C.pointerId===w.activePointerId&&w.target&&!w.isOverTarget&&w.pointerType!=null&&(w.isOverTarget=!0,y(De(w.target,C),w.pointerType))},R.onPointerLeave=C=>{C.pointerId===w.activePointerId&&w.target&&w.isOverTarget&&w.pointerType!=null&&(w.isOverTarget=!1,S(De(w.target,C),w.pointerType,!1),L(C))};let N=C=>{if(C.pointerId===w.activePointerId&&w.isPressed&&C.button===0&&w.target){if(be(w.target,ee(C))&&w.pointerType!=null){let B=!1,U=setTimeout(()=>{w.isPressed&&w.target instanceof HTMLElement&&(B?F(C):(ht(w.target),w.target.click()))},80);p(C.currentTarget,"click",()=>B=!0,!0),w.disposables.push(()=>clearTimeout(U))}else F(C);w.isOverTarget=!1}},$=C=>{F(C)};R.onDragStart=C=>{be(C.currentTarget,ee(C))&&F(C)}}return R},[p,l,x,j,v,L,y,z,I]);return c.useEffect(()=>{if(!m)return;const w=Ee(m.current);if(!w||!w.head||w.getElementById(pn))return;const R=w.createElement("style");R.id=pn;let P=zl(w);P&&(R.nonce=P),R.textContent=`
|
|
1
|
+
import{aq as Ns,cV as Br,r as c,e as se,j as s,W as ze,Y as Cs,az as Ze,t as M,ap as Yn,a5 as Kr,f as K,X as _e,a1 as bt,T as Ue,cW as Xn,aK as Hr,U as qr,b4 as Qr,g as we,cX as Ss,V as et,cY as Gr,cZ as Wr,c_ as Vr,c$ as Yr,d0 as Xr,d1 as Jn,d2 as Zn,bj as Jr,d3 as Zr,d4 as ea,bA as Ts,d5 as eo,d6 as ta,aG as to,L as sa,Z as so,d7 as no,B as na,d8 as ao,d9 as ro,da as oo,db as io,dc as lo,w as co,c as J,d as tt,G as vt,dd as uo,de as fo,df as Ut,h as le,ar as ye,i as me,M as st,cy as Me,dg as Bt,b8 as mo,dh as Ae,di as po,dj as en,dk as ho,dl as go,dm as xo,b1 as bo,ci as vo,dn as yo,cN as Is,cO as aa,s as ko,dp as jo,bh as Es,bk as ra,be as oa,bl as ia,bm as la,E as Rs,bn as wo,aW as ca,aX as da,cD as No,dq as Co,a9 as ua,cC as So,dr as To,ds as Io,dt as Eo,du as Ro,dv as fa,dw as Mo,cS as Ao,bL as Ms,dx as $o,dy as tn,dz as Lo,dA as ns,dB as Po,bK as Do,P as Fo,q as Oo,af as ma,F as zo,cR as sn,bu as _o,dC as Uo,dD as Bo,at as nn,cQ as Ko,dE as Ho,ag as qo,cg as Qo,ch as Go,dF as Wo,C as Kt,dG as Vo,dH as Yo,dI as an,dJ as Xo,dK as Jo,dL as Zo,dM as ei,v as pa,cU as Te,dN as As,dO as ti,cj as si,ce as ni,dP as ai,dQ as rn,a0 as ri,ck as oi}from"./index-CerSmEHP.js";import{u as ii,L as li,a as ci}from"./roving-focus-CIEZcQt8.js";import{m as di,S as ha,i as Ne,t as Ce,r as yt,n as kt,o as jt,p as wt,q as ui,h as fi,d as mi,D as pi,b as At,a as hi,v as gi,w as xi,x as dt,e as bi,y as vi,z as yi,u as ki}from"./search-token-index-C7yiTbjS.js";import{K as ji}from"./kbd-ByOT_79e.js";import{P as ga,f as wi,U as Ni,a as Ci,E as Si,s as Ti}from"./attachment-file-B2UKsV5r.js";import{M as xa}from"./mail-BCrpelR0.js";import{A as pt}from"./avatar-DTVmcxcO.js";import{M as Ii,a as Ei,b as ba,c as Ri,s as va,d as ya,e as Mi,f as Ai,S as on,g as ka,u as ja,p as $i,r as Li}from"./useSearchTokenContext-BQfR3lc9.js";import{C as Pi,D as Ye,u as Di}from"./index-DoR-Emr2.js";import{E as wa}from"./EmptyState-Lid0f7pw.js";import{E as Oe}from"./ErrorState-1AEFpVV9.js";import{a as Na,c as nt,b as Fi,g as Oi,e as Be,h as zi,d as _i}from"./format-C4quyWkL.js";import{D as Ui}from"./download-DnRyHHzH.js";import{g as Bi}from"./useMessageBodyContent-BDww0y-S.js";import{C as Ki}from"./calendar-event-chip-DgEDU3zQ.js";import{c as Hi}from"./calendar-color-CUVJPwWZ.js";import{R as qi,M as Qi}from"./attendee-row-DOf4ELr4.js";import{C as Ca}from"./clock-CvfP2vCf.js";import{M as Gi,G as Wi}from"./map-pin-DkZcTvpk.js";import{B as Vi,b as Yi,u as Xi,i as Ji}from"./useLayoutTier-r3F9HmT3.js";import{S as Zi,C as Sa}from"./shield-check-DDMn9XEz.js";import{u as Ta}from"./useDebouncedValue-D6bTZtg_.js";import{h as ln,u as el,a as tl,i as sl,n as nl,o as al,j as rl,k as ol,S as il}from"./useFilters-CVCfjrGd.js";import{u as $s}from"./useQueries-Dr3bjsuu.js";import{C as $t}from"./confirm-dialog-D73kfago.js";import{r as ll,a as cl}from"./search-scope-B5-OK3Cq.js";import{M as dl}from"./menu-DDlTUM4q.js";function ht(e){if(ul())e.focus({preventScroll:!0});else{let t=fl(e);e.focus(),ml(t)}}let Lt=null;function ul(){if(Lt==null){Lt=!1;try{document.createElement("div").focus({get preventScroll(){return Lt=!0,!0}})}catch{}}return Lt}function fl(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 ml(e){for(let{element:t,scrollTop:n,scrollLeft:a}of e)t.scrollTop=n,t.scrollLeft=a}const Ee=e=>e?.ownerDocument??document,Re=e=>e&&"window"in e&&e.window===e?e:Ee(e).defaultView||window;function pl(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function hl(e){return pl(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let gl=!1;function Ia(){return gl}function be(e,t){if(!Ia())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:hl(n)?n=n.host:n=n.parentNode}return!1}function ee(e){if(Ia()&&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 xl=typeof Element<"u"&&"checkVisibility"in Element.prototype;function bl(e){const t=Re(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}=Re(e);let{display:i,visibility:l}=o(e);r=i!=="none"&&l!=="hidden"&&l!=="collapse"}return r}function vl(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 Ea(e,t){return xl?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):e.nodeName!=="#comment"&&bl(e)&&vl(e,t)&&(!e.parentElement||Ea(e.parentElement,e))}const Ra=["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"],yl=Ra.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";Ra.push('[tabindex]:not([tabindex="-1"]):not([disabled])');function kl(e,t){return e.matches(yl)&&!jl(e)&&(t?.skipVisibilityCheck||Ea(e))}function jl(e){let t=e;for(;t!=null;){if(t instanceof Re(t).HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}const Ls=typeof document<"u"?Ns.useLayoutEffect:()=>{};function wl(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Nl(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Cl(e){for(;e&&!kl(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=Re(e),n=t.document.activeElement;if(!n||n===e)return;let a=!1,r=g=>{(ee(g)===n||a)&&g.stopImmediatePropagation()},o=g=>{(ee(g)===n||a)&&(g.stopImmediatePropagation(),!e&&!a&&(a=!0,ht(n),d()))},i=g=>{(ee(g)===e||a)&&g.stopImmediatePropagation()},l=g=>{(ee(g)===e||a)&&(g.stopImmediatePropagation(),a||(a=!0,ht(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 Ht(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 Ps(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}function $e(e){let t=null;return()=>(t==null&&(t=e()),t)}const Ot=$e(function(){return Ps(/^Mac/i)}),Sl=$e(function(){return Ps(/^iPhone/i)}),Ma=$e(function(){return Ps(/^iPad/i)||Ot()&&navigator.maxTouchPoints>1}),Aa=$e(function(){return Sl()||Ma()}),Tl=$e(function(){return Ht(/AppleWebKit/i)&&!Il()}),Il=$e(function(){return Ht(/Chrome/i)}),$a=$e(function(){return Ht(/Android/i)}),El=$e(function(){return Ht(/Firefox/i)});function Rl(e){return e.pointerType===""&&e.isTrusted?!0:$a()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Ml(e){return!$a()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"}function gt(e,t,n=!0){let{metaKey:a,ctrlKey:r,altKey:o,shiftKey:i}=t;El()&&window.event?.type?.startsWith("key")&&e.target==="_blank"&&(Ot()?a=!0:r=!0);let l=Tl()&&Ot()&&!Ma()?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});gt.isOpening=n,ht(e),e.dispatchEvent(l),gt.isOpening=!1}gt.isOpening=!1;let Ie=new Map,ps=new Set;function cn(){if(typeof window>"u")return;function e(a){return"propertyName"in a}let t=a=>{let r=ee(a);if(!e(a)||!r)return;let o=Ie.get(r);o||(o=new Set,Ie.set(r,o),r.addEventListener("transitioncancel",n,{once:!0})),o.add(a.propertyName)},n=a=>{let r=ee(a);if(!e(a)||!r)return;let o=Ie.get(r);if(o&&(o.delete(a.propertyName),o.size===0&&(r.removeEventListener("transitioncancel",n),Ie.delete(r)),Ie.size===0)){for(let i of ps)i();ps.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",n)}typeof document<"u"&&(document.readyState!=="loading"?cn():document.addEventListener("DOMContentLoaded",cn));function Al(){for(const[e]of Ie)"isConnected"in e&&!e.isConnected&&Ie.delete(e)}function $l(e){requestAnimationFrame(()=>{Al(),Ie.size===0?e():ps.add(e)})}function La(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}let hs=new Map;typeof FinalizationRegistry<"u"&&new FinalizationRegistry(e=>{hs.delete(e)});function Ll(e,t){if(e===t)return e;let n=hs.get(e);if(n)return n.forEach(r=>r.current=t),t;let a=hs.get(t);return a?(a.forEach(r=>r.current=e),e):t}function Pl(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1;const a=e.map(r=>{const o=dn(r,t);return n||=typeof o=="function",o});if(n)return()=>{a.forEach((r,o)=>{typeof r=="function"?r():dn(e[o],null)})}}}function dn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Nt(...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]=La(o,i):(r==="className"||r==="UNSAFE_className")&&typeof o=="string"&&typeof i=="string"?t[r]=Br(o,i):r==="id"&&o&&i?t.id=Ll(o,i):r==="ref"&&o&&i?t.ref=Pl(o,i):t[r]=i!==void 0?i:o}}return t}function Dl(e,t){Ls(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}const Fl=Ns.useInsertionEffect??Ls;function as(e){const t=c.useRef(null);return Fl(()=>{t.current=e},[e]),c.useCallback((...n)=>{const a=t.current;return a?.(...n)},[])}let Xe="default",gs="",Ft=new WeakMap;function Ol(e){if(Aa()){if(Xe==="default"){const t=Ee(e);gs=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect="none"}Xe="disabled"}else if(e instanceof HTMLElement||e instanceof SVGElement){let t="userSelect"in e.style?"userSelect":"webkitUserSelect";Ft.set(e,e.style[t]),e.style[t]="none"}}function un(e){if(Aa()){if(Xe!=="disabled")return;Xe="restoring",setTimeout(()=>{$l(()=>{if(Xe==="restoring"){const t=Ee(e);t.documentElement.style.webkitUserSelect==="none"&&(t.documentElement.style.webkitUserSelect=gs||""),gs="",Xe="default"}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&Ft.has(e)){let t=Ft.get(e),n="userSelect"in e.style?"userSelect":"webkitUserSelect";e.style[n]==="none"&&(e.style[n]=t),e.getAttribute("style")===""&&e.removeAttribute("style"),Ft.delete(e)}}function fn(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let rs=new WeakMap;function zl(e){let t=e??(typeof document<"u"?document:void 0);if(!t)return fn(t);if(rs.has(t))return rs.get(t);let n=t.querySelector('meta[property="csp-nonce"]'),a=n&&n instanceof Re(n).HTMLMetaElement&&(n.nonce||n.content)||fn(t)||void 0;return a!==void 0&&rs.set(t,a),a}const Pa=Ns.createContext({register:()=>{}});Pa.displayName="PressResponderContext";function Da(){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 _l(e){let t=c.useContext(Pa);if(t){let{register:n,ref:a,...r}=t;e=Nt(r,e),n()}return Dl(t,e.ref),e}class Pt{#e;constructor(t,n,a,r){this.#e=!0;const i=(r?.target??a.currentTarget)?.getBoundingClientRect();let l,d=0,x,g=null;a.clientX!=null&&a.clientY!=null&&(x=a.clientX,g=a.clientY),i&&(x!=null&&g!=null?(l=x-i.left,d=g-i.top):(l=i.width/2,d=i.height/2)),this.type=t,this.pointerType=n,this.target=a.currentTarget,this.shiftKey=a.shiftKey,this.metaKey=a.metaKey,this.ctrlKey=a.ctrlKey,this.altKey=a.altKey,this.x=l,this.y=d,this.key=a.key}continuePropagation(){this.#e=!1}get shouldStopPropagation(){return this.#e}}const mn=Symbol("linkClicked"),pn="react-aria-pressable-style",hn="data-react-aria-pressable";function Ul(e){let{onPress:t,onPressChange:n,onPressStart:a,onPressEnd:r,onPressUp:o,onClick:i,isDisabled:l,isPressed:d,preventFocusOnPress:x,shouldCancelOnPointerExit:g,allowTextSelectionOnPress:v,ref:m,...b}=_l(e),[f,u]=c.useState(!1),h=c.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:p,removeAllGlobalListeners:j}=Da(),y=c.useCallback((w,R)=>{let P=h.current;if(l||P.didFirePressStart)return!1;let N=!0;if(P.isTriggeringEvent=!0,a){let $=new Pt("pressstart",R,w);a($),N=$.shouldStopPropagation}return n&&n(!0),P.isTriggeringEvent=!1,P.didFirePressStart=!0,u(!0),N},[l,a,n]),k=c.useCallback((w,R,P=!0)=>{let N=h.current;if(!N.didFirePressStart)return!1;N.didFirePressStart=!1,N.isTriggeringEvent=!0;let $=!0;if(r){let C=new Pt("pressend",R,w);r(C),$=C.shouldStopPropagation}if(n&&n(!1),u(!1),t&&P&&!l){let C=new Pt("press",R,w);t(C),$&&=C.shouldStopPropagation}return N.isTriggeringEvent=!1,$},[l,r,n,t]),S=as(k),E=c.useCallback((w,R)=>{let P=h.current;if(l)return!1;if(o){P.isTriggeringEvent=!0;let N=new Pt("pressup",R,w);return o(N),P.isTriggeringEvent=!1,N.shouldStopPropagation}return!0},[l,o]),A=as(E),O=c.useCallback(w=>{let R=h.current;if(R.isPressed&&R.target){R.didFirePressStart&&R.pointerType!=null&&k(De(R.target,w),R.pointerType,!1),R.isPressed=!1,R.isOverTarget=!1,R.activePointerId=null,R.pointerType=null,j(),v||un(R.target);for(let P of R.disposables)P();R.disposables=[]}},[v,j,k]),F=as(O);c.useEffect(()=>{l&&h.current.isPressed&&F({currentTarget:h.current.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})},[l]);let L=c.useCallback(w=>{g&&O(w)},[g,O]),z=c.useCallback(w=>{l||i?.(w)},[l,i]),I=c.useCallback((w,R)=>{if(!l&&i){let P=new MouseEvent("click",w);Nl(P,R),i(wl(P))}},[l,i]),_=c.useMemo(()=>{let w=h.current,R={onKeyDown(N){if(os(N.nativeEvent,N.currentTarget)&&be(N.currentTarget,ee(N))){gn(ee(N),N.key)&&N.preventDefault();let $=!0;!w.isPressed&&!N.repeat&&(w.target=N.currentTarget,w.isPressed=!0,w.pointerType="keyboard",$=y(N,"keyboard"));let C=N.currentTarget,B=U=>{os(U,C)&&!U.repeat&&be(C,ee(U))&&w.target&&A(De(w.target,U),"keyboard")};p(Ee(N.currentTarget),"keyup",La(B,P),!0),$&&N.stopPropagation(),N.metaKey&&Ot()&&w.metaKeyEvents?.set(N.key,N.nativeEvent)}else N.key==="Meta"&&(w.metaKeyEvents=new Map)},onClick(N){if(!(N&&!be(N.currentTarget,ee(N)))&&N&&N.button===0&&!w.isTriggeringEvent&&!gt.isOpening){let $=!0;if(l&&N.preventDefault(),!w.ignoreEmulatedMouseEvents&&!w.isPressed&&(w.pointerType==="virtual"||Rl(N.nativeEvent))){let C=y(N,"virtual"),B=A(N,"virtual"),U=S(N,"virtual");z(N),$=C&&B&&U}else if(w.isPressed&&w.pointerType!=="keyboard"){let C=w.pointerType||N.nativeEvent.pointerType||"virtual",B=A(De(N.currentTarget,N),C),U=S(De(N.currentTarget,N),C,!0);$=B&&U,w.isOverTarget=!1,z(N),F(N)}w.ignoreEmulatedMouseEvents=!1,$&&N.stopPropagation()}}},P=N=>{if(w.isPressed&&w.target&&os(N,w.target)){gn(ee(N),N.key)&&N.preventDefault();let $=ee(N),C=be(w.target,$);S(De(w.target,N),"keyboard",C),C&&I(N,w.target),j(),N.key!=="Enter"&&Ds(w.target)&&be(w.target,$)&&!N[mn]&&(N[mn]=!0,gt(w.target,N,!1)),w.isPressed=!1,w.metaKeyEvents?.delete(N.key)}else if(N.key==="Meta"&&w.metaKeyEvents?.size){let $=w.metaKeyEvents;w.metaKeyEvents=void 0;for(let C of $.values())w.target?.dispatchEvent(new KeyboardEvent("keyup",C))}};if(typeof PointerEvent<"u"){R.onPointerDown=C=>{if(C.button!==0||!be(C.currentTarget,ee(C)))return;if(Ml(C.nativeEvent)){w.pointerType="virtual";return}w.pointerType=C.pointerType;let B=!0;if(!w.isPressed){w.isPressed=!0,w.isOverTarget=!0,w.activePointerId=C.pointerId,w.target=C.currentTarget,v||Ol(w.target),B=y(C,w.pointerType);let U=ee(C);"releasePointerCapture"in U&&("hasPointerCapture"in U?U.hasPointerCapture(C.pointerId)&&U.releasePointerCapture(C.pointerId):U.releasePointerCapture(C.pointerId)),p(Ee(C.currentTarget),"pointerup",N,!1),p(Ee(C.currentTarget),"pointercancel",$,!1)}B&&C.stopPropagation()},R.onMouseDown=C=>{if(be(C.currentTarget,ee(C))&&C.button===0){if(x){let B=Cl(C.target);B&&w.disposables.push(B)}C.stopPropagation()}},R.onPointerUp=C=>{!be(C.currentTarget,ee(C))||w.pointerType==="virtual"||C.button===0&&!w.isPressed&&A(C,w.pointerType||C.pointerType)},R.onPointerEnter=C=>{C.pointerId===w.activePointerId&&w.target&&!w.isOverTarget&&w.pointerType!=null&&(w.isOverTarget=!0,y(De(w.target,C),w.pointerType))},R.onPointerLeave=C=>{C.pointerId===w.activePointerId&&w.target&&w.isOverTarget&&w.pointerType!=null&&(w.isOverTarget=!1,S(De(w.target,C),w.pointerType,!1),L(C))};let N=C=>{if(C.pointerId===w.activePointerId&&w.isPressed&&C.button===0&&w.target){if(be(w.target,ee(C))&&w.pointerType!=null){let B=!1,U=setTimeout(()=>{w.isPressed&&w.target instanceof HTMLElement&&(B?F(C):(ht(w.target),w.target.click()))},80);p(C.currentTarget,"click",()=>B=!0,!0),w.disposables.push(()=>clearTimeout(U))}else F(C);w.isOverTarget=!1}},$=C=>{F(C)};R.onDragStart=C=>{be(C.currentTarget,ee(C))&&F(C)}}return R},[p,l,x,j,v,L,y,z,I]);return c.useEffect(()=>{if(!m)return;const w=Ee(m.current);if(!w||!w.head||w.getElementById(pn))return;const R=w.createElement("style");R.id=pn;let P=zl(w);P&&(R.nonce=P),R.textContent=`
|
|
2
2
|
@layer {
|
|
3
3
|
[${hn}] {
|
|
4
4
|
touch-action: pan-x pan-y pinch-zoom;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as D,r as h,j as e,T as ae,U as ne,V as G,t as N,W as T,Y as V,Z as re,_ as J,$ as ie,a0 as le,X as oe,a1 as ce,a2 as ue,a3 as de,a4 as xe,a5 as fe,I as me,a6 as he,a7 as ge,a8 as I,a9 as pe,h as be,C as ve,aa as je,G as ye,c as Ne,ab as Se,ac as ke,ad as M,ae as Ce,af as w,ag as we,D as Oe,v as ze}from"./index-_JBKtYXu.js";import{u as Re}from"./roving-focus-R7ZTRnKj.js";import{B as Ae,a as Ie}from"./useLayoutTier-D1c62D6O.js";import{u as Ee}from"./useQueries-DNMW1lkL.js";import{i as Le}from"./outbox-status-BlKn6P0x.js";import{B as Fe}from"./bug-B-341whi.js";const Pe=D("BookmarkPlus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"12",x2:"12",y1:"7",y2:"13",key:"1cppfj"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);const Me=D("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);const De=D("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),_e="button:not([disabled]), a[href]",O="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-sunken";function Be({active:s,dimmed:t,indent:a}){return N("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors",O,a&&"pl-7",s?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg",t&&"opacity-55")}function Te({icon:s,label:t,count:a,active:n}){return e.jsxs(e.Fragment,{children:[s&&e.jsx("span",{className:N("shrink-0",n?"text-accent-2":"text-fg-subtle"),children:s}),e.jsx("span",{className:"flex-1 truncate",children:t}),a!=null&&a>0&&e.jsx("span",{className:N("text-2xs tabular-nums",n?"text-accent-2":"text-fg-subtle"),children:a})]})}function A({icon:s,label:t,count:a,active:n,dimmed:o,indent:l,navId:u,linkComponent:g,ariaLabel:x,title:v,onClick:j}){const p=Be({active:n,dimmed:o,indent:l}),d=e.jsx(Te,{icon:s,label:t,count:a,active:n});return u&&g?g({navId:u,className:p,ariaLabel:x??t,title:v,onClick:j,children:d}):e.jsx("button",{type:"button",onClick:j,className:p,"aria-label":x,title:v,children:d})}const q={inbox:0,flagged:1,drafts:2,sent:3,archive:4,all:5,junk:6,trash:7};function Ve(s){switch(s){case"inbox":return e.jsx(me,{className:"size-4"});case"flagged":return e.jsx(G,{className:"size-4"});case"drafts":return e.jsx(fe,{className:"size-4"});case"sent":return e.jsx(J,{className:"size-4"});case"archive":return e.jsx(xe,{className:"size-4"});case"all":return e.jsx(de,{className:"size-4"});case"junk":return e.jsx(ue,{className:"size-4"});case"trash":return e.jsx(ce,{className:"size-4"})}}const K=s=>s.role!=null,P=8,Q="remit.nav.folders.open.",$="remit.nav.account.open.";function H(s,t,a){if(typeof localStorage>"u")return a;const n=localStorage.getItem(s+t);return n===null?a:n!=="0"}function U(s,t,a){typeof localStorage>"u"||localStorage.setItem(s+t,a?"1":"0")}function qe({query:s,onSelect:t,onRemove:a}){return e.jsxs("div",{className:"group flex w-full items-center gap-1 rounded-md pr-1 hover:bg-surface",children:[e.jsxs("button",{type:"button",onClick:t,className:N("flex min-w-0 flex-1 items-center gap-2 px-2 py-1 text-left text-sm text-fg-muted transition-colors hover:text-fg",O),children:[e.jsx(le,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:s})]}),a&&e.jsx("button",{type:"button",onClick:a,"aria-label":`Remove saved search: ${s}`,className:N("shrink-0 rounded-full p-1 text-fg-subtle opacity-0 transition-opacity hover:bg-surface-sunken hover:text-fg group-hover:opacity-100 focus-visible:opacity-100",O),children:e.jsx(oe,{className:"size-3.5"})})]})}function Ke({savedSearches:s,saveableQuery:t,onSelectSavedSearch:a,onRemoveSavedSearch:n,onSaveCurrentSearch:o}){return s.length===0&&!t?null:e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"px-2 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Saved searches"}),t&&e.jsxs("button",{type:"button",onClick:o,className:N("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-accent transition-colors hover:bg-surface",O),children:[e.jsx(Pe,{className:"size-4 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["Save “",t,"”"]})]}),s.map(l=>e.jsx(qe,{query:l,onSelect:()=>a?.(l),onRemove:n?()=>n(l):void 0},l))]})}function Qe({account:s,selectedNavId:t,onSelectNav:a,linkComponent:n}){const[o,l]=h.useState(()=>H($,s.id,!0)),[u,g]=h.useState(()=>H(Q,s.id,!0)),[x,v]=h.useState(!1),j=()=>{l(r=>{const f=!r;return U($,s.id,f),f})},p=()=>{g(r=>{const f=!r;return U(Q,s.id,f),f})},d=s.mailboxes.filter(K).sort((r,f)=>q[r.role]-q[f.role]),c=s.mailboxes.filter(r=>!K(r)),S=x||c.length<=P?c:c.slice(0,P),z=c.length-S.length,R=s.status??"ready",F=R==="ready"&&d.length===0&&c.length===0;return e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",onClick:j,"aria-expanded":o,className:N("flex w-full items-center gap-1.5 px-2 pb-1 text-left transition-colors hover:text-fg",O,s.muted&&"opacity-55"),children:[o?e.jsx(T,{className:"size-3 shrink-0 text-fg-subtle"}):e.jsx(V,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:s.label}),s.muted&&e.jsxs(e.Fragment,{children:[e.jsx(Ae,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:"muted"})]})]}),o&&e.jsxs(e.Fragment,{children:[R==="loading"&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"Loading…"}),R==="error"&&e.jsxs("div",{role:"alert",className:"mx-2 my-1 flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-2 py-1.5 text-sm",children:[e.jsx(re,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("p",{className:"font-medium text-danger",children:"Couldn't load mailboxes"})}),s.onRetry&&e.jsx("button",{type:"button",onClick:s.onRetry,className:"shrink-0 text-sm font-medium text-accent hover:underline",children:"Retry"})]}),F&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"No mailboxes"}),R==="ready"&&e.jsxs(e.Fragment,{children:[d.map(r=>e.jsx(A,{navId:r.id,linkComponent:n,icon:Ve(r.role),label:r.name,ariaLabel:r.name,title:r.fullPath??r.name,count:r.unseen,active:t===r.id,dimmed:s.muted,onClick:()=>a?.(r.id)},r.id)),s.outboxPending!==void 0&&e.jsx(A,{navId:"outbox",linkComponent:n,icon:e.jsx(J,{className:"size-4"}),label:"Outbox",ariaLabel:"Outbox",count:s.outboxPending>0?s.outboxPending:void 0,active:t==="outbox",dimmed:s.muted,onClick:()=>a?.("outbox")}),c.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:p,"aria-expanded":u,className:N("mt-1 flex w-full items-center gap-1 px-2 py-1 text-left text-2xs font-semibold uppercase tracking-wider text-fg-subtle transition-colors hover:text-fg",O),children:[u?e.jsx(T,{className:"size-3 shrink-0"}):e.jsx(V,{className:"size-3 shrink-0"}),e.jsx("span",{className:"flex-1",children:"Folders"}),e.jsx("span",{className:"tabular-nums opacity-70",children:c.length})]}),u&&e.jsxs(e.Fragment,{children:[S.map(r=>e.jsx(A,{navId:r.id,linkComponent:n,icon:e.jsx(ie,{className:"size-4"}),label:r.name,ariaLabel:r.name,title:r.fullPath??r.name,count:r.unseen,active:t===r.id,dimmed:s.muted,onClick:()=>a?.(r.id)},r.id)),(z>0||x)&&c.length>P&&e.jsx("button",{type:"button",onClick:()=>v(r=>!r),className:N("ml-7 flex items-center px-2 py-1 text-2xs font-medium text-accent transition-colors hover:underline",O),children:x?"Show less":`Show all (${c.length})`})]})]})]})]})]})}function $e({accounts:s,selectedNavId:t,briefUnseen:a,onSelectNav:n,variant:o="desktop",linkComponent:l,calendarNav:u="hidden",savedSearches:g=[],saveableQuery:x,onSelectSavedSearch:v,onRemoveSavedSearch:j,onSaveCurrentSearch:p}){const d=h.useRef(null);Re({containerRef:d,itemSelector:_e});const c=o==="drawer",S=e.jsxs("nav",{ref:c?d:void 0,className:c?"px-2 py-2":"flex-1 overflow-y-auto px-2 py-2","aria-label":"Mailboxes",children:[e.jsx(A,{navId:"brief",linkComponent:l,icon:e.jsx(ae,{className:"size-4"}),label:"Daily brief",ariaLabel:"Daily brief",count:a,active:t==="brief",onClick:()=>n?.("brief")}),u==="shown"&&e.jsx(A,{navId:"calendar",linkComponent:l,icon:e.jsx(ne,{className:"size-4"}),label:"Calendar",ariaLabel:"Calendar",active:t==="calendar",onClick:()=>n?.("calendar")}),e.jsx(A,{navId:"flagged",linkComponent:l,icon:e.jsx(G,{className:"size-4"}),label:"Starred",ariaLabel:"Starred",active:t==="flagged",onClick:()=>n?.("flagged")}),e.jsx(Ke,{savedSearches:g,saveableQuery:x,onSelectSavedSearch:v,onRemoveSavedSearch:j,onSaveCurrentSearch:p}),s.length===0?e.jsx("div",{className:"px-2 py-4 text-center text-sm text-fg-muted",children:"No accounts configured"}):s.map(z=>e.jsx(Qe,{account:z,selectedNavId:t,onSelectNav:n,linkComponent:l},z.id))]});return c?S:e.jsx("aside",{ref:d,className:"flex h-full w-full flex-col bg-surface-sunken",children:S})}function He(){const{pathname:s}=he(),t=ge({from:"/mail/$mailboxId",shouldThrow:!1});return I(s,"/settings")?"settings":I(s,"/calendar")?"calendar":I(s,"/mail/outbox")?"outbox":I(s,"/mail/flagged")?"flagged":I(s,"/mail/brief")?"brief":t?.mailboxId??""}const Ue=({children:s})=>{const{Account:t}=pe();return e.jsx(t,{children:s})},_="remit.savedSearches",We=25;function L(){try{const s=localStorage.getItem(_);if(!s)return[];const t=JSON.parse(s);return Array.isArray(t)?t.filter(a=>typeof a=="string"):[]}catch{return[]}}function Ye(s){const t=s.trim();if(!t)return L();const a=[t,...L().filter(n=>n!==t)].slice(0,We);try{localStorage.setItem(_,JSON.stringify(a))}catch{return a}return a}function Ge(s){const t=L().filter(a=>a!==s);try{localStorage.setItem(_,JSON.stringify(t))}catch{return t}return t}const W=s=>/^\d/.test(s),Je=(s,t)=>{const a=W(s),n=W(t);return a&&!n?-1:!a&&n?1:s.localeCompare(t,void 0,{sensitivity:"base",numeric:!0})};function Xe(s,t,a){const n=[],o=[];for(const l of s)t.has(l.mailboxId)?n.push(l):o.push(l);return o.sort((l,u)=>Je(M(l,void 0,a),M(u,void 0,a))),{system:n,labels:o}}function Ze(s,t,a){const n=Ce(t)&&s.unseenCount>0;return{id:s.mailboxId,name:M(s,t,a),unseen:n?s.unseenCount:void 0,role:t,fullPath:s.fullPath}}function Y({accounts:s,onMailboxSelect:t,variant:a="desktop"}){const n=be(),o=Ie(),l=He(),{searchInput:u,onSearchChange:g}=ve(),[x,v]=h.useState(L),{t:j}=je("mail",{useSuspense:!1}),p=h.useCallback((i,b)=>j(i,{defaultValue:b}),[j]),d=Ee({queries:s.map(i=>({...ye({path:{accountId:i.accountId}}),staleTime:1/0}))}),{data:c}=Ne(Se()),S=h.useMemo(()=>(c?.items??[]).filter(i=>Le(i.status)).length,[c?.items]),z=h.useMemo(()=>s.map((i,b)=>{const m=d[b],k=m?.data?.items??[],y=ke(i.folderAppointments),{system:C,labels:se}=Xe(k,y,p),te=m?.isError?"error":m?.isLoading?"loading":"ready";return{id:i.accountId,label:i.email,email:i.email,muted:!!i.muted,outboxPending:S,status:te,onRetry:()=>m?.refetch(),mailboxes:[...C,...se].map(B=>Ze(B,y.get(B.mailboxId),p))}}),[s,d,S,p]),R=i=>{n.invalidateQueries({queryKey:we({path:{mailboxId:i},query:{order:"desc"}})})},F=({navId:i,className:b,ariaLabel:m,title:k,children:y,onClick:C})=>i==="brief"?e.jsx(w,{to:"/mail/brief",search:{q:void 0},activeOptions:{includeSearch:!1},onClick:()=>C?.(),className:b,"aria-label":m,title:k,children:y}):i==="calendar"?e.jsx(w,{to:"/calendar",onClick:()=>C?.(),className:b,"aria-label":m,title:k,children:y}):i==="outbox"?e.jsx(w,{to:"/mail/outbox",search:{q:void 0},onClick:()=>C?.(),className:b,"aria-label":m,title:k,children:y}):i==="flagged"?e.jsx(w,{to:"/mail/flagged",search:{q:void 0},onClick:()=>C?.(),className:b,"aria-label":m,title:k,children:y}):i==="settings"?e.jsx(w,{to:"/settings/accounts",onClick:()=>C?.(),className:b,"aria-label":m,title:k,children:y}):e.jsx(w,{to:"/mail/$mailboxId",params:{mailboxId:i},search:{q:void 0},onClick:()=>{R(i),C?.()},className:b,"aria-label":m,title:k,children:y}),r=()=>{g(""),t?.()},f=u.trim(),E=f.length>0&&!x.includes(f)?f:void 0,X=h.useCallback(()=>{E&&v(Ye(E))},[E]),Z=h.useCallback(i=>{v(Ge(i))},[]),ee=h.useCallback(i=>{g(i),o(i),t?.()},[g,o,t]);return e.jsx($e,{accounts:z,selectedNavId:l,onSelectNav:r,linkComponent:F,calendarNav:"shown",variant:a,savedSearches:x,saveableQuery:E,onSaveCurrentSearch:X,onSelectSavedSearch:ee,onRemoveSavedSearch:Z})}function es(){return e.jsxs("button",{type:"button",onClick:Oe,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg",children:[e.jsx(Fe,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Report a bug"})]})}function ls({accounts:s,onMailboxSelect:t}){return ze()?.showNavPane??!0?e.jsx(Y,{accounts:s}):e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(Y,{accounts:s,onMailboxSelect:t,variant:"drawer"})}),e.jsxs("div",{className:"border-t border-line px-2 py-2",children:[e.jsxs(w,{to:"/settings/accounts",onClick:t,children:[e.jsx(De,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Settings"})]}),e.jsx(es,{}),e.jsx(Ue,{children:({signOut:o})=>e.jsxs("button",{type:"button",onClick:()=>{t?.(),o()},className:"flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg","data-testid":"sign-out-button",children:[e.jsx(Me,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Sign out"})]})})]})]})}export{Ue as A,Me as L,ls as M,De as S};
|
|
1
|
+
import{e as D,r as h,j as e,T as ae,U as ne,V as G,t as N,W as T,Y as V,Z as re,_ as J,$ as ie,a0 as le,X as oe,a1 as ce,a2 as ue,a3 as de,a4 as xe,a5 as fe,I as me,a6 as he,a7 as ge,a8 as I,a9 as pe,h as be,C as ve,aa as je,G as ye,c as Ne,ab as Se,ac as ke,ad as M,ae as Ce,af as w,ag as we,D as Oe,v as ze}from"./index-CerSmEHP.js";import{u as Re}from"./roving-focus-CIEZcQt8.js";import{B as Ae,a as Ie}from"./useLayoutTier-r3F9HmT3.js";import{u as Ee}from"./useQueries-Dr3bjsuu.js";import{i as Le}from"./outbox-status-BlKn6P0x.js";import{B as Fe}from"./bug-CjKnpWcM.js";const Pe=D("BookmarkPlus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"12",x2:"12",y1:"7",y2:"13",key:"1cppfj"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);const Me=D("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);const De=D("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),_e="button:not([disabled]), a[href]",O="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-sunken";function Be({active:s,dimmed:t,indent:a}){return N("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors",O,a&&"pl-7",s?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg",t&&"opacity-55")}function Te({icon:s,label:t,count:a,active:n}){return e.jsxs(e.Fragment,{children:[s&&e.jsx("span",{className:N("shrink-0",n?"text-accent-2":"text-fg-subtle"),children:s}),e.jsx("span",{className:"flex-1 truncate",children:t}),a!=null&&a>0&&e.jsx("span",{className:N("text-2xs tabular-nums",n?"text-accent-2":"text-fg-subtle"),children:a})]})}function A({icon:s,label:t,count:a,active:n,dimmed:o,indent:l,navId:u,linkComponent:g,ariaLabel:x,title:v,onClick:j}){const p=Be({active:n,dimmed:o,indent:l}),d=e.jsx(Te,{icon:s,label:t,count:a,active:n});return u&&g?g({navId:u,className:p,ariaLabel:x??t,title:v,onClick:j,children:d}):e.jsx("button",{type:"button",onClick:j,className:p,"aria-label":x,title:v,children:d})}const q={inbox:0,flagged:1,drafts:2,sent:3,archive:4,all:5,junk:6,trash:7};function Ve(s){switch(s){case"inbox":return e.jsx(me,{className:"size-4"});case"flagged":return e.jsx(G,{className:"size-4"});case"drafts":return e.jsx(fe,{className:"size-4"});case"sent":return e.jsx(J,{className:"size-4"});case"archive":return e.jsx(xe,{className:"size-4"});case"all":return e.jsx(de,{className:"size-4"});case"junk":return e.jsx(ue,{className:"size-4"});case"trash":return e.jsx(ce,{className:"size-4"})}}const K=s=>s.role!=null,P=8,Q="remit.nav.folders.open.",$="remit.nav.account.open.";function H(s,t,a){if(typeof localStorage>"u")return a;const n=localStorage.getItem(s+t);return n===null?a:n!=="0"}function U(s,t,a){typeof localStorage>"u"||localStorage.setItem(s+t,a?"1":"0")}function qe({query:s,onSelect:t,onRemove:a}){return e.jsxs("div",{className:"group flex w-full items-center gap-1 rounded-md pr-1 hover:bg-surface",children:[e.jsxs("button",{type:"button",onClick:t,className:N("flex min-w-0 flex-1 items-center gap-2 px-2 py-1 text-left text-sm text-fg-muted transition-colors hover:text-fg",O),children:[e.jsx(le,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:s})]}),a&&e.jsx("button",{type:"button",onClick:a,"aria-label":`Remove saved search: ${s}`,className:N("shrink-0 rounded-full p-1 text-fg-subtle opacity-0 transition-opacity hover:bg-surface-sunken hover:text-fg group-hover:opacity-100 focus-visible:opacity-100",O),children:e.jsx(oe,{className:"size-3.5"})})]})}function Ke({savedSearches:s,saveableQuery:t,onSelectSavedSearch:a,onRemoveSavedSearch:n,onSaveCurrentSearch:o}){return s.length===0&&!t?null:e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"px-2 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Saved searches"}),t&&e.jsxs("button",{type:"button",onClick:o,className:N("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-accent transition-colors hover:bg-surface",O),children:[e.jsx(Pe,{className:"size-4 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["Save “",t,"”"]})]}),s.map(l=>e.jsx(qe,{query:l,onSelect:()=>a?.(l),onRemove:n?()=>n(l):void 0},l))]})}function Qe({account:s,selectedNavId:t,onSelectNav:a,linkComponent:n}){const[o,l]=h.useState(()=>H($,s.id,!0)),[u,g]=h.useState(()=>H(Q,s.id,!0)),[x,v]=h.useState(!1),j=()=>{l(r=>{const f=!r;return U($,s.id,f),f})},p=()=>{g(r=>{const f=!r;return U(Q,s.id,f),f})},d=s.mailboxes.filter(K).sort((r,f)=>q[r.role]-q[f.role]),c=s.mailboxes.filter(r=>!K(r)),S=x||c.length<=P?c:c.slice(0,P),z=c.length-S.length,R=s.status??"ready",F=R==="ready"&&d.length===0&&c.length===0;return e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",onClick:j,"aria-expanded":o,className:N("flex w-full items-center gap-1.5 px-2 pb-1 text-left transition-colors hover:text-fg",O,s.muted&&"opacity-55"),children:[o?e.jsx(T,{className:"size-3 shrink-0 text-fg-subtle"}):e.jsx(V,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:s.label}),s.muted&&e.jsxs(e.Fragment,{children:[e.jsx(Ae,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:"muted"})]})]}),o&&e.jsxs(e.Fragment,{children:[R==="loading"&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"Loading…"}),R==="error"&&e.jsxs("div",{role:"alert",className:"mx-2 my-1 flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-2 py-1.5 text-sm",children:[e.jsx(re,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("p",{className:"font-medium text-danger",children:"Couldn't load mailboxes"})}),s.onRetry&&e.jsx("button",{type:"button",onClick:s.onRetry,className:"shrink-0 text-sm font-medium text-accent hover:underline",children:"Retry"})]}),F&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"No mailboxes"}),R==="ready"&&e.jsxs(e.Fragment,{children:[d.map(r=>e.jsx(A,{navId:r.id,linkComponent:n,icon:Ve(r.role),label:r.name,ariaLabel:r.name,title:r.fullPath??r.name,count:r.unseen,active:t===r.id,dimmed:s.muted,onClick:()=>a?.(r.id)},r.id)),s.outboxPending!==void 0&&e.jsx(A,{navId:"outbox",linkComponent:n,icon:e.jsx(J,{className:"size-4"}),label:"Outbox",ariaLabel:"Outbox",count:s.outboxPending>0?s.outboxPending:void 0,active:t==="outbox",dimmed:s.muted,onClick:()=>a?.("outbox")}),c.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:p,"aria-expanded":u,className:N("mt-1 flex w-full items-center gap-1 px-2 py-1 text-left text-2xs font-semibold uppercase tracking-wider text-fg-subtle transition-colors hover:text-fg",O),children:[u?e.jsx(T,{className:"size-3 shrink-0"}):e.jsx(V,{className:"size-3 shrink-0"}),e.jsx("span",{className:"flex-1",children:"Folders"}),e.jsx("span",{className:"tabular-nums opacity-70",children:c.length})]}),u&&e.jsxs(e.Fragment,{children:[S.map(r=>e.jsx(A,{navId:r.id,linkComponent:n,icon:e.jsx(ie,{className:"size-4"}),label:r.name,ariaLabel:r.name,title:r.fullPath??r.name,count:r.unseen,active:t===r.id,dimmed:s.muted,onClick:()=>a?.(r.id)},r.id)),(z>0||x)&&c.length>P&&e.jsx("button",{type:"button",onClick:()=>v(r=>!r),className:N("ml-7 flex items-center px-2 py-1 text-2xs font-medium text-accent transition-colors hover:underline",O),children:x?"Show less":`Show all (${c.length})`})]})]})]})]})]})}function $e({accounts:s,selectedNavId:t,briefUnseen:a,onSelectNav:n,variant:o="desktop",linkComponent:l,calendarNav:u="hidden",savedSearches:g=[],saveableQuery:x,onSelectSavedSearch:v,onRemoveSavedSearch:j,onSaveCurrentSearch:p}){const d=h.useRef(null);Re({containerRef:d,itemSelector:_e});const c=o==="drawer",S=e.jsxs("nav",{ref:c?d:void 0,className:c?"px-2 py-2":"flex-1 overflow-y-auto px-2 py-2","aria-label":"Mailboxes",children:[e.jsx(A,{navId:"brief",linkComponent:l,icon:e.jsx(ae,{className:"size-4"}),label:"Daily brief",ariaLabel:"Daily brief",count:a,active:t==="brief",onClick:()=>n?.("brief")}),u==="shown"&&e.jsx(A,{navId:"calendar",linkComponent:l,icon:e.jsx(ne,{className:"size-4"}),label:"Calendar",ariaLabel:"Calendar",active:t==="calendar",onClick:()=>n?.("calendar")}),e.jsx(A,{navId:"flagged",linkComponent:l,icon:e.jsx(G,{className:"size-4"}),label:"Starred",ariaLabel:"Starred",active:t==="flagged",onClick:()=>n?.("flagged")}),e.jsx(Ke,{savedSearches:g,saveableQuery:x,onSelectSavedSearch:v,onRemoveSavedSearch:j,onSaveCurrentSearch:p}),s.length===0?e.jsx("div",{className:"px-2 py-4 text-center text-sm text-fg-muted",children:"No accounts configured"}):s.map(z=>e.jsx(Qe,{account:z,selectedNavId:t,onSelectNav:n,linkComponent:l},z.id))]});return c?S:e.jsx("aside",{ref:d,className:"flex h-full w-full flex-col bg-surface-sunken",children:S})}function He(){const{pathname:s}=he(),t=ge({from:"/mail/$mailboxId",shouldThrow:!1});return I(s,"/settings")?"settings":I(s,"/calendar")?"calendar":I(s,"/mail/outbox")?"outbox":I(s,"/mail/flagged")?"flagged":I(s,"/mail/brief")?"brief":t?.mailboxId??""}const Ue=({children:s})=>{const{Account:t}=pe();return e.jsx(t,{children:s})},_="remit.savedSearches",We=25;function L(){try{const s=localStorage.getItem(_);if(!s)return[];const t=JSON.parse(s);return Array.isArray(t)?t.filter(a=>typeof a=="string"):[]}catch{return[]}}function Ye(s){const t=s.trim();if(!t)return L();const a=[t,...L().filter(n=>n!==t)].slice(0,We);try{localStorage.setItem(_,JSON.stringify(a))}catch{return a}return a}function Ge(s){const t=L().filter(a=>a!==s);try{localStorage.setItem(_,JSON.stringify(t))}catch{return t}return t}const W=s=>/^\d/.test(s),Je=(s,t)=>{const a=W(s),n=W(t);return a&&!n?-1:!a&&n?1:s.localeCompare(t,void 0,{sensitivity:"base",numeric:!0})};function Xe(s,t,a){const n=[],o=[];for(const l of s)t.has(l.mailboxId)?n.push(l):o.push(l);return o.sort((l,u)=>Je(M(l,void 0,a),M(u,void 0,a))),{system:n,labels:o}}function Ze(s,t,a){const n=Ce(t)&&s.unseenCount>0;return{id:s.mailboxId,name:M(s,t,a),unseen:n?s.unseenCount:void 0,role:t,fullPath:s.fullPath}}function Y({accounts:s,onMailboxSelect:t,variant:a="desktop"}){const n=be(),o=Ie(),l=He(),{searchInput:u,onSearchChange:g}=ve(),[x,v]=h.useState(L),{t:j}=je("mail",{useSuspense:!1}),p=h.useCallback((i,b)=>j(i,{defaultValue:b}),[j]),d=Ee({queries:s.map(i=>({...ye({path:{accountId:i.accountId}}),staleTime:1/0}))}),{data:c}=Ne(Se()),S=h.useMemo(()=>(c?.items??[]).filter(i=>Le(i.status)).length,[c?.items]),z=h.useMemo(()=>s.map((i,b)=>{const m=d[b],k=m?.data?.items??[],y=ke(i.folderAppointments),{system:C,labels:se}=Xe(k,y,p),te=m?.isError?"error":m?.isLoading?"loading":"ready";return{id:i.accountId,label:i.email,email:i.email,muted:!!i.muted,outboxPending:S,status:te,onRetry:()=>m?.refetch(),mailboxes:[...C,...se].map(B=>Ze(B,y.get(B.mailboxId),p))}}),[s,d,S,p]),R=i=>{n.invalidateQueries({queryKey:we({path:{mailboxId:i},query:{order:"desc"}})})},F=({navId:i,className:b,ariaLabel:m,title:k,children:y,onClick:C})=>i==="brief"?e.jsx(w,{to:"/mail/brief",search:{q:void 0},activeOptions:{includeSearch:!1},onClick:()=>C?.(),className:b,"aria-label":m,title:k,children:y}):i==="calendar"?e.jsx(w,{to:"/calendar",onClick:()=>C?.(),className:b,"aria-label":m,title:k,children:y}):i==="outbox"?e.jsx(w,{to:"/mail/outbox",search:{q:void 0},onClick:()=>C?.(),className:b,"aria-label":m,title:k,children:y}):i==="flagged"?e.jsx(w,{to:"/mail/flagged",search:{q:void 0},onClick:()=>C?.(),className:b,"aria-label":m,title:k,children:y}):i==="settings"?e.jsx(w,{to:"/settings/accounts",onClick:()=>C?.(),className:b,"aria-label":m,title:k,children:y}):e.jsx(w,{to:"/mail/$mailboxId",params:{mailboxId:i},search:{q:void 0},onClick:()=>{R(i),C?.()},className:b,"aria-label":m,title:k,children:y}),r=()=>{g(""),t?.()},f=u.trim(),E=f.length>0&&!x.includes(f)?f:void 0,X=h.useCallback(()=>{E&&v(Ye(E))},[E]),Z=h.useCallback(i=>{v(Ge(i))},[]),ee=h.useCallback(i=>{g(i),o(i),t?.()},[g,o,t]);return e.jsx($e,{accounts:z,selectedNavId:l,onSelectNav:r,linkComponent:F,calendarNav:"shown",variant:a,savedSearches:x,saveableQuery:E,onSaveCurrentSearch:X,onSelectSavedSearch:ee,onRemoveSavedSearch:Z})}function es(){return e.jsxs("button",{type:"button",onClick:Oe,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg",children:[e.jsx(Fe,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Report a bug"})]})}function ls({accounts:s,onMailboxSelect:t}){return ze()?.showNavPane??!0?e.jsx(Y,{accounts:s}):e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(Y,{accounts:s,onMailboxSelect:t,variant:"drawer"})}),e.jsxs("div",{className:"border-t border-line px-2 py-2",children:[e.jsxs(w,{to:"/settings/accounts",onClick:t,children:[e.jsx(De,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Settings"})]}),e.jsx(es,{}),e.jsx(Ue,{children:({signOut:o})=>e.jsxs("button",{type:"button",onClick:()=>{t?.(),o()},className:"flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg","data-testid":"sign-out-button",children:[e.jsx(Me,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Sign out"})]})})]})]})}export{Ue as A,Me as L,ls as M,De as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a8 as v,j as s,r as u,aj as l,ak as p}from"./index-
|
|
1
|
+
import{a8 as v,j as s,r as u,aj as l,ak as p}from"./index-CerSmEHP.js";import{F as x}from"./FullCompose-DpRKig4Y.js";import{a as m}from"./useMessageBodyContent-BDww0y-S.js";function O(o,n,r){if(o!==n)return r}function S(o,n){return o===""?"":n}function d({searchInput:o,committedQuery:n,urlQuery:r,pathname:t,listPath:a}){return!v(t,a)||n!==o?!1:n!==r}const c=u.createContext(null),C=({chrome:o,children:n})=>s.jsx(c.Provider,{value:o,children:n});function M({phone:o,list:n,reading:r,intelligence:t,hasThread:a=!1}){const e=u.useContext(c),f=m();if(!e)return s.jsx(l,{});const i={nav:e.nav,overlay:e.overlay,skeleton:s.jsx(l,{}),isLoading:e.isLoading,navOpen:e.navOpen,onOpenNav:e.onOpenNav,onCloseNav:e.onCloseNav};return e.isSinglePane?s.jsx(p,{...i,list:f?s.jsx(x,{}):o,intelligenceOpen:e.intelligenceOpen}):s.jsx(p,{...i,topBar:e.topBar,list:n,reading:r,intelligence:t,intelligenceOpen:e.intelligenceOpen,hasThread:a})}export{C as M,M as a,d as b,S as c,O as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s,L as le,f as $,Z as ue,r as g,t as K,az as de,a1 as fe,c$ as me,bZ as xe,dR as ge,dS as he,dT as pe,C as be,dU as ve,d1 as je}from"./index-_JBKtYXu.js";import{m as we,A as Ne}from"./search-token-index-U-0PE-Ox.js";import{u as ye,L as Q}from"./roving-focus-R7ZTRnKj.js";import{ad as Pe,ae as Re,c as Ce,a as G,af as Se,v as Ee,ag as Me,ah as ke,ai as Te,aj as Ie,ak as Le,al as ee,am as ze}from"./MailListHeader-BJX8BuyA.js";import{A as Ae}from"./avatar-Dso3OQH7.js";import{M as Oe}from"./mail-B73P70rO.js";import{R as De}from"./refresh-cw-Mvz24VPI.js";import{M as $e}from"./menu-CyMA8ejK.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(Z,{children:[s.jsx("p",{className:"font-medium text-fg",children:Ue(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(Z,{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 Ue(e,t,n){return n?`No results for “${n}” in ${e}`:t?`No ${e} in ${t}`:`No ${e}`}function Z({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 Be({message:e="Something went wrong loading this mailbox.",onRetry:t,onReport:n}){return s.jsx("div",{className:"flex h-full flex-1 items-center justify-center p-4",children:s.jsxs("div",{role:"alert",className:"flex max-w-sm flex-col items-center justify-center gap-3 text-center",children:[s.jsx(ue,{className:"size-8 text-danger","aria-hidden":"true"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-danger",children:"Couldn't load messages"}),s.jsx("p",{className:"mt-1 break-words text-sm text-fg-muted",children:e})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[t&&s.jsx($,{variant:"secondary",size:"sm",onClick:t,children:"Retry"}),n&&s.jsx($,{variant:"ghost",size:"sm",onClick:n,children:"Report a problem"})]})]})})}const I=72,q=10,We=I/2,V="__swipeableRowAxisCancel";function J(e){return e==="leading"?I:e==="trailing"?-I:0}function Ye(e){return e>=I/2?"leading":e<=-I/2?"trailing":"none"}function Ke({thread:e,selectionMode:t,checked:n,active:u,peek:f,onPeek:c,onToggleCheck:p,onLongPress:w,onOpen:b,onAct:v}){const x=g.useRef(null),[j,h]=g.useState(null),{longPressProps:P}=Pe({onLongPress:w,isDisabled:t,accessibilityDescription:"Select message"}),S=i=>{const o=new PointerEvent("pointercancel",{bubbles:!0});o[V]=!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)>q&&Math.abs(M)>Math.abs(m)?o.axis="vertical":Math.abs(m)>q&&Math.abs(m)>Math.abs(M)&&(o.axis="horizontal",i.currentTarget.setPointerCapture(i.pointerId))),o.axis==="none")return;const L=o.axis==="horizontal"?Math.abs(m):Math.abs(M);if(!o.escaped&&L>We&&(o.escaped=!0,S(i)),o.axis!=="horizontal")return;const F=J(f),H=Math.max(-I,Math.min(I,F+m));h(H)},onPointerUp:i=>{const o=x.current;x.current=null;const m=j;if(h(null),!!o){if(o.axis!=="none"&&!o.escaped&&S(i),o.axis==="horizontal"){m!==null&&c(Ye(m));return}if(o.axis!=="vertical"){if(t){p();return}if(f!=="none"){c("none");return}b()}}},onPointerCancel:i=>{i.nativeEvent[V]||(x.current=null,h(null))}}),d=j??J(f),y=d>0?"leading":d<0?"trailing":"none",R=K("relative touch-pan-y bg-surface","select-none",Ce({active:n||u})),A={transform:d!==0?`translateX(${d}px)`:void 0,transition:j===null?"transform 150ms ease":"none",minHeight:44},_=!e.isRead,T=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:T,onPointerMove:T,onPointerUp:T,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 T=S==="compact"?ke:Te,O=g.useRef(null),i=g.useRef(null),o=me(d);ye({containerRef:O,itemSelector:Q,enabled:!o});const m=o?d.focusedId:void 0,M=o?m??n[0]?.threads[0]?.id:void 0,L=g.useCallback(a=>M===void 0?void 0:a===M?0:-1,[M]);g.useEffect(()=>{if(m===void 0)return;const a=i.current;if(!a)return;const l=a.querySelector(`${Q}[data-message-id="${m}"]`);!l||l===a.ownerDocument.activeElement||l.focus({preventScroll:!1})},[m]),g.useEffect(()=>{if(!o)return;const a=i.current;if(!a)return;const l=a.ownerDocument.activeElement;l!==null&&l!==a.ownerDocument.body||a.focus({preventScroll:!0})},[o]);const F=!C&&!u&&c==="ready",[H,W]=g.useState(!1),ae=k==="peek-trailing"?"trailing":k==="peek-leading"?"leading":void 0,re=()=>{W(!0),setTimeout(()=>W(!1),1400)},D=r?.selectedIds??Ge,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]),U=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:B})=>s.jsx(T,{thread:a,active:l,focused:a.id===m,tabIndex:L(a.id),selection:X(a.id),onClick:ce=>{U(a.id,ce)||B?.()}}),[T,X,U,m,L]);return s.jsxs("section",{ref:a=>{i.current=a,d?.ref(a)},tabIndex:o?-1:void 0,className:"relative flex h-full w-full flex-col bg-surface outline-none",children:[y??(_?null:s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[E&&s.jsx($,{variant:"ghost",size:"sm",icon:s.jsx($e,{className:"size-4"}),onClick:E,"aria-label":"Open folders",className:"-ml-1 shrink-0"}),s.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:e}),t&&s.jsx("span",{className:"shrink-0 text-2xs text-fg-subtle",children:t})]})),c==="loading"?s.jsx("div",{className:"flex-1 overflow-y-auto",children:s.jsx(_e,{})}):c==="empty"?s.jsx(Fe,{filter:w,scopeLabel:b,searchQuery:p}):c==="error"?s.jsx(Be,{message:v,onRetry:x,onReport:j}):u&&h?s.jsx(Ie,{...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(T,{thread:l,active:l.id===P,focused:l.id===m,tabIndex:L(l.id),selection:X(l.id),onClick:B=>{U(l.id,B)||N?.(l.id)}},l.id))})]},a.id))})),C&&s.jsx(Le,{hints:d?Ne(d.handlers):we}),R]})}var Ze=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,Ze)}const se={dimension:"read",position:"pre",text:"unread"},qe={dimension:"read",position:"pre",text:"read"},te={dimension:"starred",position:"pre",text:"starred"},ne={dimension:"attachment",position:"post",text:"with an attachment"},Ve=[["unread",se],["flagged",te],["attachment",ne]],Je=e=>{switch(e.type){case"category":return{dimension:"category",position:"pre",text:ee(e.category)??e.value};case"isUnread":return se;case"isRead":return qe;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 Ve)e.attributes.has(c)&&u(p);for(const c of t)u(Je(c));return[...n.values()]},ss=(e,t)=>{const n=es(e,t);if(n.length===0)return;const u=f=>n.filter(c=>c.position===f).map(c=>c.text);return[...u("pre"),"mail",...u("post")].join(" ")},ms=({chips:e,tokens:t,reach:n,onClear:u})=>{const f=ss(e,t);if(f)return{label:f,reach:n,onClear:u}};function xs({title:e,unreadCount:t,preset:n,selectedCategory:u,activeFilters:f,onSelectCategory:c,onToggleFilter:p,onSelectSource:w,onClearFilters:b,children:v,footer:x,searchResults:j,searchLoading:h,relatedResults:P,relatedLoading:S,onSelectSearchResult:N,searchResultsLabel:E,relatedResultsLabel:C,searchResultsInBody:k,refreshControl:r}){const{searchInput:d}=be(),y=d.trim().length>0,R={categories:n.categories,filters:n.filters,sources:n.sources,selectedCategory:u,activeFilters:f,onSelectCategory:c,onSelectSource:w,onToggleFilter:p,onClear:b};return s.jsx(ve,{hasSheet:!y,children:s.jsx(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 $,Z as ue,r as g,t as K,az as de,a1 as fe,c$ as me,bZ as xe,dR as ge,dS as he,dT as pe,C as be,dU as ve,d1 as je}from"./index-CerSmEHP.js";import{m as we,A as Ne}from"./search-token-index-C7yiTbjS.js";import{u as ye,L as Q}from"./roving-focus-CIEZcQt8.js";import{ad as Pe,ae as Re,c as Ce,a as G,af as Se,v as Ee,ag as Me,ah as ke,ai as Te,aj as Ie,ak as Le,al as ee,am as ze}from"./MailListHeader-BcoBd9rJ.js";import{A as Ae}from"./avatar-DTVmcxcO.js";import{M as Oe}from"./mail-BCrpelR0.js";import{R as De}from"./refresh-cw-C7SXfZwg.js";import{M as $e}from"./menu-DDlTUM4q.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(Z,{children:[s.jsx("p",{className:"font-medium text-fg",children:Ue(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(Z,{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 Ue(e,t,n){return n?`No results for “${n}” in ${e}`:t?`No ${e} in ${t}`:`No ${e}`}function Z({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 Be({message:e="Something went wrong loading this mailbox.",onRetry:t,onReport:n}){return s.jsx("div",{className:"flex h-full flex-1 items-center justify-center p-4",children:s.jsxs("div",{role:"alert",className:"flex max-w-sm flex-col items-center justify-center gap-3 text-center",children:[s.jsx(ue,{className:"size-8 text-danger","aria-hidden":"true"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-danger",children:"Couldn't load messages"}),s.jsx("p",{className:"mt-1 break-words text-sm text-fg-muted",children:e})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[t&&s.jsx($,{variant:"secondary",size:"sm",onClick:t,children:"Retry"}),n&&s.jsx($,{variant:"ghost",size:"sm",onClick:n,children:"Report a problem"})]})]})})}const I=72,q=10,We=I/2,V="__swipeableRowAxisCancel";function J(e){return e==="leading"?I:e==="trailing"?-I:0}function Ye(e){return e>=I/2?"leading":e<=-I/2?"trailing":"none"}function Ke({thread:e,selectionMode:t,checked:n,active:u,peek:f,onPeek:c,onToggleCheck:p,onLongPress:w,onOpen:b,onAct:v}){const x=g.useRef(null),[j,h]=g.useState(null),{longPressProps:P}=Pe({onLongPress:w,isDisabled:t,accessibilityDescription:"Select message"}),S=i=>{const o=new PointerEvent("pointercancel",{bubbles:!0});o[V]=!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)>q&&Math.abs(M)>Math.abs(m)?o.axis="vertical":Math.abs(m)>q&&Math.abs(m)>Math.abs(M)&&(o.axis="horizontal",i.currentTarget.setPointerCapture(i.pointerId))),o.axis==="none")return;const L=o.axis==="horizontal"?Math.abs(m):Math.abs(M);if(!o.escaped&&L>We&&(o.escaped=!0,S(i)),o.axis!=="horizontal")return;const F=J(f),H=Math.max(-I,Math.min(I,F+m));h(H)},onPointerUp:i=>{const o=x.current;x.current=null;const m=j;if(h(null),!!o){if(o.axis!=="none"&&!o.escaped&&S(i),o.axis==="horizontal"){m!==null&&c(Ye(m));return}if(o.axis!=="vertical"){if(t){p();return}if(f!=="none"){c("none");return}b()}}},onPointerCancel:i=>{i.nativeEvent[V]||(x.current=null,h(null))}}),d=j??J(f),y=d>0?"leading":d<0?"trailing":"none",R=K("relative touch-pan-y bg-surface","select-none",Ce({active:n||u})),A={transform:d!==0?`translateX(${d}px)`:void 0,transition:j===null?"transform 150ms ease":"none",minHeight:44},_=!e.isRead,T=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:T,onPointerMove:T,onPointerUp:T,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 T=S==="compact"?ke:Te,O=g.useRef(null),i=g.useRef(null),o=me(d);ye({containerRef:O,itemSelector:Q,enabled:!o});const m=o?d.focusedId:void 0,M=o?m??n[0]?.threads[0]?.id:void 0,L=g.useCallback(a=>M===void 0?void 0:a===M?0:-1,[M]);g.useEffect(()=>{if(m===void 0)return;const a=i.current;if(!a)return;const l=a.querySelector(`${Q}[data-message-id="${m}"]`);!l||l===a.ownerDocument.activeElement||l.focus({preventScroll:!1})},[m]),g.useEffect(()=>{if(!o)return;const a=i.current;if(!a)return;const l=a.ownerDocument.activeElement;l!==null&&l!==a.ownerDocument.body||a.focus({preventScroll:!0})},[o]);const F=!C&&!u&&c==="ready",[H,W]=g.useState(!1),ae=k==="peek-trailing"?"trailing":k==="peek-leading"?"leading":void 0,re=()=>{W(!0),setTimeout(()=>W(!1),1400)},D=r?.selectedIds??Ge,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]),U=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:B})=>s.jsx(T,{thread:a,active:l,focused:a.id===m,tabIndex:L(a.id),selection:X(a.id),onClick:ce=>{U(a.id,ce)||B?.()}}),[T,X,U,m,L]);return s.jsxs("section",{ref:a=>{i.current=a,d?.ref(a)},tabIndex:o?-1:void 0,className:"relative flex h-full w-full flex-col bg-surface outline-none",children:[y??(_?null:s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[E&&s.jsx($,{variant:"ghost",size:"sm",icon:s.jsx($e,{className:"size-4"}),onClick:E,"aria-label":"Open folders",className:"-ml-1 shrink-0"}),s.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:e}),t&&s.jsx("span",{className:"shrink-0 text-2xs text-fg-subtle",children:t})]})),c==="loading"?s.jsx("div",{className:"flex-1 overflow-y-auto",children:s.jsx(_e,{})}):c==="empty"?s.jsx(Fe,{filter:w,scopeLabel:b,searchQuery:p}):c==="error"?s.jsx(Be,{message:v,onRetry:x,onReport:j}):u&&h?s.jsx(Ie,{...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(T,{thread:l,active:l.id===P,focused:l.id===m,tabIndex:L(l.id),selection:X(l.id),onClick:B=>{U(l.id,B)||N?.(l.id)}},l.id))})]},a.id))})),C&&s.jsx(Le,{hints:d?Ne(d.handlers):we}),R]})}var Ze=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,Ze)}const se={dimension:"read",position:"pre",text:"unread"},qe={dimension:"read",position:"pre",text:"read"},te={dimension:"starred",position:"pre",text:"starred"},ne={dimension:"attachment",position:"post",text:"with an attachment"},Ve=[["unread",se],["flagged",te],["attachment",ne]],Je=e=>{switch(e.type){case"category":return{dimension:"category",position:"pre",text:ee(e.category)??e.value};case"isUnread":return se;case"isRead":return qe;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 Ve)e.attributes.has(c)&&u(p);for(const c of t)u(Je(c));return[...n.values()]},ss=(e,t)=>{const n=es(e,t);if(n.length===0)return;const u=f=>n.filter(c=>c.position===f).map(c=>c.text);return[...u("pre"),"mail",...u("post")].join(" ")},ms=({chips:e,tokens:t,reach:n,onClear:u})=>{const f=ss(e,t);if(f)return{label:f,reach:n,onClear:u}};function xs({title:e,unreadCount:t,preset:n,selectedCategory:u,activeFilters:f,onSelectCategory:c,onToggleFilter:p,onSelectSource:w,onClearFilters:b,children:v,footer:x,searchResults:j,searchLoading:h,relatedResults:P,relatedLoading:S,onSelectSearchResult:N,searchResultsLabel:E,relatedResultsLabel:C,searchResultsInBody:k,refreshControl:r}){const{searchInput:d}=be(),y=d.trim().length>0,R={categories:n.categories,filters:n.filters,sources:n.sources,selectedCategory:u,activeFilters:f,onSelectCategory:c,onSelectSource:w,onToggleFilter:p,onClear:b};return s.jsx(ve,{hasSheet:!y,children:s.jsx(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};
|