@remit/web-client-dist 0.0.495 → 0.0.497
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-BEMpREbM.js → BriefPane-C1YHZUAd.js} +1 -1
- package/assets/{CalendarComposePane-B8RIG3G1.js → CalendarComposePane-VeLWQkta.js} +1 -1
- package/assets/{CalendarComposeSeed-DKiVztER.js → CalendarComposeSeed-675yfCbg.js} +1 -1
- package/assets/{CalendarShell-CPdIENU0.js → CalendarShell-xNMmpbgB.js} +1 -1
- package/assets/{EmptyState-ByZPPoBW.js → EmptyState-CegqC3j2.js} +1 -1
- package/assets/{ErrorState-BdpB-2BQ.js → ErrorState-BGolGYcc.js} +1 -1
- package/assets/{FlaggedPane-DgGAJWxG.js → FlaggedPane-DaORUctH.js} +1 -1
- package/assets/{FullCompose-w8QBwa1F.js → FullCompose-DqLTXvyP.js} +1 -1
- package/assets/{MailListHeader-DpqTxu9Y.js → MailListHeader-Dhgkq9td.js} +1 -1
- package/assets/{MailNav-B_HG7DOH.js → MailNav-BPZ--2Zq.js} +1 -1
- package/assets/{MailShell-DoajaymZ.js → MailShell-Cd-aCKBf.js} +1 -1
- package/assets/{MailViewChrome-BoZny5Ug.js → MailViewChrome-J4bT_B41.js} +1 -1
- package/assets/{MailboxPane-55oYauzw.js → MailboxPane-dSxHZfJq.js} +1 -1
- package/assets/{NavMenuButton-eChrqIjJ.js → NavMenuButton-CqSZuMpN.js} +1 -1
- package/assets/{OnboardingWizard-Cnq-2-am.js → OnboardingWizard-bzjJS9rU.js} +1 -1
- package/assets/{OpenCalendarEvent-D8vDrPlh.js → OpenCalendarEvent-DHCCZvs1.js} +1 -1
- package/assets/{OutboxPane-YAn3UaxA.js → OutboxPane-BFHcQFSQ.js} +1 -1
- package/assets/_calendarObjectId-DB4s52e7.js +1 -0
- package/assets/_mailboxId-_UuyonBt.js +1 -0
- package/assets/_messageId-C2mL362O.js +1 -0
- package/assets/_messageId-DoUX-Wpm.js +1 -0
- package/assets/_messageId-QtN4lnMz.js +1 -0
- package/assets/_outboxMessageId-u04H30d0.js +1 -0
- package/assets/_recurrenceId-p4xgYlsW.js +1 -0
- package/assets/_threadId-B52u4ZGm.js +1 -0
- package/assets/_threadId-DyxmoTSp.js +1 -0
- package/assets/_threadId-NYak8BAJ.js +1 -0
- package/assets/{_view._date-6Wdiax9r.js → _view._date-CNtQuag8.js} +1 -1
- package/assets/{accounts-B7WcpGKX.js → accounts-BFZIBw9t.js} +1 -1
- package/assets/{advanced-Bh1WCftW.js → advanced-DHRgNnGq.js} +1 -1
- package/assets/{appearance-Ux2-yIoq.js → appearance--2gV-DqW.js} +1 -1
- package/assets/{attachment-file-D0HDeXxM.js → attachment-file-QQZovKAl.js} +1 -1
- package/assets/{avatar-CRolAGMx.js → avatar-klLMB_Me.js} +1 -1
- package/assets/{bottom-sheet-DscANK9c.js → bottom-sheet-CRsV78aJ.js} +1 -1
- package/assets/brief-CK2Ag4aM.js +1 -0
- package/assets/{brief-CnKOJ14k.js → brief-pxbBSjyV.js} +1 -1
- package/assets/{browser-ponyfill-Q866M4Nr.js → browser-ponyfill-rQg15kf2.js} +1 -1
- package/assets/{bug-pEghc6tg.js → bug-ECDjr3jW.js} +1 -1
- package/assets/{calendar-Rv-lEWWe.js → calendar-YiaPuzno.js} +1 -1
- package/assets/{calendar-days-BJ_20Jyk.js → calendar-days-oK-1rKbM.js} +1 -1
- package/assets/{card-CcIkIugx.js → card-GNRohr9F.js} +1 -1
- package/assets/chevron-left-CK510N2A.js +1 -0
- package/assets/{circle-check-j3ftvpbW.js → circle-check-D_bOnWVf.js} +1 -1
- package/assets/{circle-check-big-C-VUNWnE.js → circle-check-big-CvyTX3eu.js} +1 -1
- package/assets/{circle-help-CwU6dZTm.js → circle-help-rRKfilDF.js} +1 -1
- package/assets/{clock-WuXeJWU-.js → clock-CV2mIEQ0.js} +1 -1
- package/assets/compose._-_outboxMessageId_-BhZ6kS29.js +1 -0
- package/assets/compose._-_outboxMessageId_-CF-uuezv.js +1 -0
- package/assets/compose._-_outboxMessageId_-CmYl260X.js +1 -0
- package/assets/compose._-_outboxMessageId_-D-vZ8Vfz.js +1 -0
- package/assets/{config-import-BE0ryw-i.js → config-import-s1ErxyaK.js} +1 -1
- package/assets/{confirm-dialog-BHPwL2Mu.js → confirm-dialog-PyqpaetG.js} +1 -1
- package/assets/{credential-steps-DNS1SWlp.js → credential-steps-BiPyTE8I.js} +1 -1
- package/assets/{download-N8RxH0I6.js → download-DdbznPAS.js} +1 -1
- package/assets/{filters-Ct4TImnH.js → filters-SuJREA5G.js} +1 -1
- package/assets/flagged-BnnTqpKk.js +1 -0
- package/assets/{flagged-DhiVOrbH.js → flagged-DPX_qlUe.js} +1 -1
- package/assets/{folders-CQJZVAEw.js → folders-qoxhQhfr.js} +1 -1
- package/assets/{format-B_FD2e8R.js → format-RgJz8yFq.js} +1 -1
- package/assets/{help-copy-CG_2LyCi.js → help-copy-DdhDXdzQ.js} +1 -1
- package/assets/{import-kmOabCNM.js → import-B0ywsXJp.js} +1 -1
- package/assets/index-3Cm_Sair.js +1 -0
- package/assets/{index-BQWnqT7l.js → index-8Di8quRN.js} +1 -1
- package/assets/index-BU1mrVnk.js +1 -0
- package/assets/index-BdhP6zUj.js +1 -0
- package/assets/index-C61kVhwz.js +1 -0
- package/assets/index-DFBSDyEq.js +1 -0
- package/assets/{index-BoxiBjE8.js → index-DMZ8-zZM.js} +4 -4
- package/assets/index-DZxBsRSE.js +1 -0
- package/assets/index-DoUX-Wpm.js +1 -0
- package/assets/index-QtN4lnMz.js +1 -0
- package/assets/{index-tORYm1g3.js → index-RbY7Dn0X.js} +4 -4
- package/assets/index-RlCFATZr.js +1 -0
- package/assets/{kbd-CQfGa1PF.js → kbd-BV5q0Za-.js} +1 -1
- package/assets/{labels-DmoFn23z.js → labels-Dgk62TQB.js} +1 -1
- package/assets/{mail-zh2SRy5b.js → mail-Bff0HSL7.js} +1 -1
- package/assets/{mail-DzgLd5ht.js → mail-C2pH_nIp.js} +1 -1
- package/assets/{menu-DN5zpA0a.js → menu-DqCvhoo6.js} +1 -1
- package/assets/minus-DTWvP8bv.js +1 -0
- package/assets/{new-SbqXSShl.js → new-zGcaCoRf.js} +1 -1
- package/assets/onboarding-DN1fXIpr.js +1 -0
- package/assets/{onboarding-completion-bJbWoJKX.js → onboarding-completion-0kUxmKoQ.js} +1 -1
- package/assets/outbox-CuXqTLiE.js +1 -0
- package/assets/{pencil-BxMsOZ8c.js → pencil-D2wigVut.js} +1 -1
- package/assets/{rich-text-BHpf3a14.js → rich-text-DJZuCFUV.js} +1 -1
- package/assets/{rich-text-spellcheck-worker-provider-BO9xn8gr.js → rich-text-spellcheck-worker-provider-CJdp1lGc.js} +1 -1
- package/assets/{rotate-ccw-Cs1JQfpJ.js → rotate-ccw-BRLfH-fd.js} +1 -1
- package/assets/{row-actions-DPIYaysg.js → row-actions-DO7n5J0t.js} +1 -1
- package/assets/{search-mirror-2weR7Ba_.js → search-mirror-NOSJLcGR.js} +1 -1
- package/assets/{search-token-index-D-gWPAEk.js → search-token-index-BQBAjCB1.js} +1 -1
- package/assets/{sections-COsJpcXX.js → sections-DVKafU2-.js} +1 -1
- package/assets/{senders-3doDrsut.js → senders-BAu3RfQ0.js} +1 -1
- package/assets/settings-BbKjeZZu.js +1 -0
- package/assets/{settings-screen-4RhR5454.js → settings-screen-BZEszQ1s.js} +1 -1
- package/assets/{shield-check-CDbh7UQQ.js → shield-check-BM5CxZVS.js} +1 -1
- package/assets/{suggested-vips-BlaOLYOc.js → suggested-vips-9wJhynOD.js} +1 -1
- package/assets/{useCalendarData-B5kQq5mg.js → useCalendarData-C2e-a6YP.js} +1 -1
- package/assets/{useCalendars-CuuHCvAe.js → useCalendars-BruqGaWc.js} +1 -1
- package/assets/{useDebouncedValue-ATwGPcJy.js → useDebouncedValue-BBOZojyy.js} +1 -1
- package/assets/{useFilters-BcjDJmnI.js → useFilters-D8luT8sB.js} +1 -1
- package/assets/{useLabels-DXK6wqpQ.js → useLabels-DbWrQIbS.js} +1 -1
- package/assets/{useLayoutTier-B31omesr.js → useLayoutTier-DKpSXts5.js} +1 -1
- package/assets/{useMessageBodyContent-Dgv5wWIW.js → useMessageBodyContent-DxQjkGza.js} +1 -1
- package/assets/{useQueries-CYk5lp9G.js → useQueries-Baii11SK.js} +1 -1
- package/assets/{useRefreshControl-Ek98Uvm0.js → useRefreshControl-DKnu6drF.js} +1 -1
- package/assets/{useSearchTokenContext-BKuymkTr.js → useSearchTokenContext-DohJINg2.js} +1 -1
- package/assets/{useSemanticSearch-BK5kVsoj.js → useSemanticSearch-DfxdKsNk.js} +1 -1
- package/assets/{useSignature-D5Vdi95d.js → useSignature-At1N2nkq.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/_calendarObjectId-BuG_Ye1C.js +0 -1
- package/assets/_mailboxId-YH1qdozC.js +0 -1
- package/assets/_messageId-DT8AInZs.js +0 -1
- package/assets/_messageId-Drx2zgqi.js +0 -1
- package/assets/_messageId-wkdIQ55g.js +0 -1
- package/assets/_outboxMessageId-BH_mWFfT.js +0 -1
- package/assets/_recurrenceId-BpO2J3MQ.js +0 -1
- package/assets/_threadId-BBYabMdf.js +0 -1
- package/assets/_threadId-DgIn0EPf.js +0 -1
- package/assets/_threadId-pMNs7I9p.js +0 -1
- package/assets/brief-BSuLtYRH.js +0 -1
- package/assets/chevron-left-Ga46zxOJ.js +0 -1
- package/assets/compose._-_outboxMessageId_-BmHcjRV_.js +0 -1
- package/assets/compose._-_outboxMessageId_-CBakJ-28.js +0 -1
- package/assets/compose._-_outboxMessageId_-CQmLLJ1w.js +0 -1
- package/assets/compose._-_outboxMessageId_-Cy_n6EHj.js +0 -1
- package/assets/flagged-Br3BjTTD.js +0 -1
- package/assets/index-BwMp4ajK.js +0 -1
- package/assets/index-Cv2GSA9r.js +0 -1
- package/assets/index-DPkvu_tH.js +0 -1
- package/assets/index-DdfFHYoN.js +0 -1
- package/assets/index-Dlf2Mkch.js +0 -1
- package/assets/index-Drx2zgqi.js +0 -1
- package/assets/index-bKs-2H7O.js +0 -1
- package/assets/index-th64R5dx.js +0 -1
- package/assets/index-wkdIQ55g.js +0 -1
- package/assets/minus-cjwKQEGX.js +0 -1
- package/assets/onboarding-C1GknuLf.js +0 -1
- package/assets/outbox-WWgW5q0K.js +0 -1
- package/assets/settings-C4nobC4_.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as o,L as Ze,V as Xe,e0 as et,C as Y,bc as tt,cH as st,r as a,c as oe,e1 as ne,G as ot,dm as nt,e2 as at,dH as rt,_ as Te,dL as it,aj as ct,cO as lt,cP as dt}from"./index-BoxiBjE8.js";import{g as je,e as ut,f as Re,u as mt,p as ft,R as ht}from"./useSearchTokenContext-BKuymkTr.js";import{ai as be,F as ve,aj as gt,ak as xt,G as pt,al as ye,am as It,an as bt,ao as vt,a7 as yt,ap as St,aq as Ct,ar as Tt,M as jt,as as Rt,ae as wt,at as Mt,e as kt,v as Ft,af as Ot,q as At,S as Nt,J as Bt,O as Se,N as Lt,K as Dt,d as Et,Y as Pt,Z as qt,$ as we,a0 as Me,a1 as zt,a2 as Ht,a3 as Qt}from"./MailListHeader-DpqTxu9Y.js";import{u as _t,a as Gt,R as $t,b as Vt,c as Wt}from"./useRefreshControl-Ek98Uvm0.js";import{u as Ut}from"./useQueries-CYk5lp9G.js";import{a as Yt}from"./useLabels-DXK6wqpQ.js";import{u as Jt,b as Kt}from"./useLayoutTier-B31omesr.js";import{u as Zt,r as Xt,L as es}from"./useSemanticSearch-BK5kVsoj.js";import{w as ts}from"./wizard-selection-B1bng5Jq.js";import{u as ke}from"./sections-COsJpcXX.js";import{R as ss,g as os,h as ns}from"./search-token-index-D-gWPAEk.js";import{a as as}from"./useMessageBodyContent-Dgv5wWIW.js";function rs({sync:e}){return e?o.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:[o.jsx(Ze,{className:"size-8 animate-spin text-fg-subtle","aria-hidden":"true"}),o.jsx("p",{className:"text-sm font-medium text-fg",children:"Still syncing your mail"}),o.jsx("p",{className:"text-xs text-fg-subtle",children:is(e)})]}):o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",children:[o.jsx(Xe,{className:"size-8 text-fg-subtle","aria-hidden":"true"}),o.jsx("p",{className:"text-sm font-medium text-fg",children:"You're caught up"}),o.jsx("p",{className:"text-xs text-fg-subtle",children:"Nothing needs attention."})]})}function is({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 Fe=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],Oe="category",cs={unclassified:"uncategorized"},G=e=>ut(e).map(t=>t.raw),_=e=>e.join(" "),ae=e=>{const t=Re(e);if(t)return Fe.find(n=>n.name===t.name&&n.value===t.value.toLowerCase())?.id},re=e=>{const t=Re(e);if(!t||t.name!==Oe)return;const n=t.value.toLowerCase(),r=cs[n];if(r)return r;if(!(!et(n)||n==="all"))return n},Ae=e=>Fe.find(t=>t.id===e),Ne=e=>Ae(e)!==void 0,ls=e=>{const t=new Set;for(const n of G(e)){const r=ae(n);r&&t.add(r)}return t},ds=e=>{let t="all";for(const n of G(e)){const r=re(n);r&&(t=r)}return t},us=(e,t)=>{const n=Ae(t);if(!n)return;const r=G(e),l=r.filter(d=>ae(d)!==t);return l.length<r.length?_(l):_([...r,je(n.name,n.value)])},ms=(e,t)=>{const n=G(e).filter(r=>!re(r));return _(t==="all"?n:[...n,je(Oe,t)])},fs=e=>_(G(e).filter(t=>!ae(t)&&!re(t))),Be=e=>e.trim().length>0,hs=e=>{if(!Be(e.query))return e.ownFilters;const t=new Set(ls(e.query));for(const n of e.ownFilters)Ne(n)||t.add(n);return t},gs=e=>Be(e.query)?ds(e.query):e.ownCategory,xs=(e,t)=>e.createdAt!==t.createdAt?e.createdAt-t.createdAt:e.accountId.localeCompare(t.accountId),ps=e=>[...e].sort(xs),Is=200,Ce=()=>o.jsx("div",{className:"animate-pulse",children:Array.from({length:3}).map((e,t)=>o.jsxs("div",{className:"flex items-start gap-3 py-2 pl-5 pr-4 border-b border-line",children:[o.jsx("div",{className:"size-7 rounded-full bg-surface-sunken shrink-0 mt-0.5"}),o.jsxs("div",{className:"flex-1 space-y-1.5",children:[o.jsxs("div",{className:"flex justify-between gap-2",children:[o.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-28"}),o.jsx("div",{className:"h-3 bg-surface-sunken rounded w-12"})]}),o.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-48"}),o.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})]})]},t))}),bs=({accountEmail:e})=>{const t=ke();return o.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:[o.jsx(Te,{className:"size-3.5 shrink-0"}),o.jsxs("span",{className:"flex-1 truncate",children:[e," can't connect"]}),o.jsx("button",{type:"button",onClick:()=>t("accounts"),className:"shrink-0 underline text-danger hover:opacity-80",children:"Reconnect"})]})},vs=(e,t)=>{if(t.size===0)return{};const n=e.filter(d=>t.has(d.id)),r=Xt(n.map(d=>d.accountId));if(r.restriction)return r;const l=new Set;for(const d of n)d.mailboxId&&l.add(d.mailboxId);return l.size>1?{accountId:r.accountId,restriction:"spansFolders",moveDisabledHint:`Move only works within one folder — this selection spans ${l.size} folders`}:{accountId:r.accountId,mailboxId:l.size===1?[...l][0]:void 0}};function ys({header:e,rows:t,wizard:n,children:r}){const{selectedIds:l,selectedCount:d,exitSelection:u,orderedIds:m,allSelected:b,toggleAllLoaded:f}=Mt(),x=a.useMemo(()=>vs(t,l),[t,l]),{junkMailboxId:L}=kt(x.accountId),{labels:I}=Yt(x.accountId),p=a.useMemo(()=>Array.from(l),[l]),D=a.useMemo(()=>ts(t,l),[t,l]),h=Ft(L,x.mailboxId),v=a.useMemo(()=>m.length>0?{checked:b,indeterminate:d>0&&!b,onChange:f}:void 0,[m.length,b,d,f]),F=x.moveDisabledHint?{tone:"warning",text:x.moveDisabledHint}:void 0,S=C=>o.jsx(Nt,{title:C.title,navSlot:C.navSlot,titleMeta:C.titleMeta,searchSlot:C.searchSlot,searchField:C.searchField,idleSlot:C.makeFilterSlot,count:d,onCancel:u,onDelete:()=>n.start("delete"),onMove:()=>n.start("move"),onOrganize:()=>n.start("organize"),onJunk:h?()=>n.start("junk"):void 0,onMarkRead:()=>n.start("markRead"),overflowSlot:x.accountId&&x.mailboxId&&d>0&&I.length>0?o.jsx(es,{accountId:x.accountId,mailboxId:x.mailboxId,messageIds:p}):void 0,selectAll:v,notice:F});return o.jsx(Ot,{...e,selectionBar:S,paneOverlay:o.jsx(At,{verb:n.verb,accountId:x.accountId,mailboxId:x.mailboxId,selection:D,selectionRestriction:x.restriction,onFinished:u}),children:r})}function Ss({accounts:e,selectedMessageId:t,onOpenThread:n,commandsRef:r,onTriageContextChange:l,onDeleteMessages:d}){const{searchQuery:u,searchInput:m,resultFolderIndex:b,onSearchChange:f}=Y(),x=mt(),L=tt(),I=Jt(),p=st(),D=Kt(),h=a.useMemo(()=>ps(e.filter(s=>!s.muted?.value)),[e]),[v,F]=a.useState("all"),[S,C]=a.useState("all"),[$,E]=a.useState(new Set),[K,T]=a.useState(!1),P=a.useCallback(s=>{E(i=>{const c=new Set(i);return c.has(s)?c.delete(s):c.add(s),c})},[]),V=a.useCallback(()=>E(new Set),[]),R=m.trim().length>0,j=a.useMemo(()=>hs({query:m,ownFilters:$}),[m,$]),w=a.useMemo(()=>gs({query:m,ownCategory:S}),[m,S]),O=a.useCallback(s=>{if(!R||!Ne(s)){P(s);return}const i=us(m,s);i!==void 0&&f(i)},[R,m,f,P]),q=a.useCallback(s=>{if(!R){C(s);return}f(ms(m,s))},[R,m,f]),z=a.useCallback(()=>{C("all"),F("all"),V(),R&&f(fs(m))},[R,m,f,V]),{data:A,isLoading:H,isError:g,refetch:N}=oe({...ne(),staleTime:6e4}),B=Ut({queries:h.map(s=>({...ot({path:{accountId:s.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),W=a.useMemo(()=>{const s=new Map;for(let i=0;i<h.length;i++){const c=h[i].accountId,Ye=(B[i]?.data?.items??[]).reduce((Je,Ke)=>Je+(Ke.unseenCount??0),0);s.set(c,Ye)}return s},[h,B]),Ee=a.useMemo(()=>h.filter((s,i)=>{const c=B[i];return c?.isError?!nt(c.error):!1}),[h,B]),{freeText:M,tokens:Z}=ft(u.trim().toLowerCase(),x),{data:ie,isFetching:Pe}=oe({...ne({query:{query:M,limit:Is}}),enabled:M.length>0,staleTime:3e4}),y=a.useMemo(()=>{const s=be(A?.items??[]).map(ve);return(M?gt(s.filter(c=>xt(c,M)),be(ie?.items??[]).map(ve)):s).filter(c=>(v==="all"||c.accountId===v)&&pt(c,Z))},[A,ie,v,M,Z]),{bodyRows:ce,briefSpamOffer:X}=a.useMemo(()=>{if(!M)return{bodyRows:y,briefSpamOffer:void 0};const s=y.map(k=>ye(k,b)),{spam:i}=It(s);if(i.length===0)return{bodyRows:y,briefSpamOffer:void 0};const c=new Set(i.map(k=>k.id));return{bodyRows:y.filter(k=>!c.has(k.id)),briefSpamOffer:bt(s)}},[y,M,b]),le=a.useMemo(()=>vt(ce),[ce]),de=a.useCallback((s,i)=>{const c=y.find(k=>k.id===s)?.threadId;c&&n?.({threadId:c,messageId:s},i)},[y,n]),qe=a.useCallback(s=>{const i=s.threadId??y.find(c=>c.id===s.id)?.threadId;i&&n?.({threadId:i,messageId:s.id})},[y,n]),ee=a.useMemo(()=>h.length<=1?[]:[{id:"all",label:"All",active:v==="all"},...h.map(s=>({id:s.accountId,label:s.email.split("@")[0]??s.email,count:W.get(s.accountId),active:v===s.accountId}))],[h,W,v]),Q=a.useMemo(()=>e.filter(s=>s.muted?.value).length,[e]),ze=a.useMemo(()=>Array.from(W.values()).reduce((s,i)=>s+i,0),[W]),te=a.useMemo(()=>h.map(s=>s.accountId),[h]),{hasNewMail:ue}=_t(),{state:me,errorMessage:fe,refresh:he}=Gt(te,{onSettled:()=>N()}),He=a.useMemo(()=>o.jsx($t,{state:me,onRefresh:he,label:"Refresh daily brief",errorMessage:fe,hasUpdate:ue(te)}),[me,he,fe,ue,te]),se=a.useMemo(()=>y.filter(s=>(w==="all"||s.category===w)&&at(s,j)).map(s=>ye(s,b)),[y,w,j,b]),{hits:ge,isLoading:Qe}=Zt(),_e=a.useMemo(()=>{const s=new Map;for(const c of A?.items??[])s.set(c.messageId,c.threadId);const i=se.map(c=>s.get(c.id)).filter(c=>c!=null);return yt(ge,i,b)},[ge,se,A,b]),Ge=a.useMemo(()=>{const s=St(ee.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:w,activeFilters:j,expanded:K,onExpandedChange:T,onSelectCategory:i=>q(i),onSelectSource:F,onToggleFilter:i=>O(i),onClear:z}},[ee,Q,w,j,K,O,q,z]),xe=le.length===0&&v==="all"&&M.length===0&&Z.length===0,$e=a.useMemo(()=>h.map(s=>s.accountId),[h]),Ve=a.useMemo(()=>h.some(s=>Vt(s.syncPhase)),[h]),U=Wt($e,xe||Ve),pe=o.jsxs("div",{className:"h-full overflow-y-auto",children:[o.jsx(Ce,{}),o.jsx(Ce,{})]}),Ie=!H&&!g&&!xe,We=Ct({tier:I,hasLiveInput:R,hasCommittedQuery:u.trim().length>0,bodyRendersCommittedResults:!0}),Ue=Ie?o.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[X&&o.jsx(Tt,{count:X.count,onScopeToSpam:()=>D(X.mailboxId,u)}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(rt,{sections:le,briefCategory:w,Row:jt,selectedThreadId:t,onSelectThread:de,onSelectBriefCategory:q,sources:ee,sourcesNote:Q>0?`+${Q} muted`:void 0,onSelectSource:F,activeFilters:j,onToggleFilter:O,onClearFilters:z})})]}):H?pe:g?o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 py-12 text-sm text-fg-muted",children:[o.jsx(Te,{className:"size-8 text-danger"}),o.jsx("p",{children:"Couldn't load your messages"}),o.jsxs("button",{type:"button",onClick:()=>N(),className:"flex items-center gap-1 text-accent underline text-xs",children:[o.jsx(ss,{className:"size-3.5"}),"Try again"]})]}):U.resolved?o.jsx(rs,{sync:U.syncing?{synced:U.synced,total:U.total}:void 0}):pe;return o.jsx(it,{hasSheet:Ie&&!We,children:o.jsx(Rt,{selectedMessageId:t,rows:y,onOpen:de,onDeleteMessages:d,onSelectionVerb:p.start,commandsRef:r,onTriageContextChange:l,children:o.jsx(ys,{wizard:p,header:{title:"Daily brief",unreadCount:ze,footer:L?o.jsx(wt,{}):void 0,searchFilter:Ge,searchResults:se,searchLoading:H||Pe,relatedResults:_e,relatedLoading:Qe,onSelectSearchResult:qe,searchResultsInBody:!0,refreshControl:He},rows:y,children:o.jsxs("div",{className:"flex h-full flex-col",children:[Ee.map(s=>o.jsx(bs,{accountEmail:s.email,accountId:s.accountId},s.accountId)),o.jsx("div",{className:"min-h-0 flex-1",children:Ue})]})})})})}const Le=a.createContext(null);function J(){const e=a.useContext(Le);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function Cs({thread:e,children:t}){const n=os(),r=ns(),l=ke(),{searchInput:d}=Y(),u=e?.threadId,m=e?.messageId,{data:b}=oe({...ne(),staleTime:6e4}),f=a.useMemo(()=>b?.items??[],[b]),x=a.useMemo(()=>{if(u)return f.find(g=>g.messageId===m)??f.find(g=>g.threadId===u)},[f,u,m]),L=Bt(u,m),I=x??L,p=m??I?.messageId,D=a.useMemo(()=>{if(u)return{threadId:u,mailboxId:I?.mailboxId??"",subject:I?.subject,messageId:p,authenticity:I?.authenticity}},[u,I,p]),h=a.useCallback((g,N)=>{n(g,{replace:N?.replace,query:d})},[n,d]),v=a.useCallback(g=>{p&&g.includes(p)&&r()},[p,r]),F=Se({thread:I,isOpen:!0,onAfterOptimisticRemove:v}),S=Lt(),{deleteMessages:C}=Dt({mailboxId:I?.mailboxId??"",messages:f,onAfterOptimisticRemove:v}),{toggleReadFor:$}=Et({mailboxId:I?.mailboxId??"",messages:f}),E=S.focusedMessageId,T=a.useMemo(()=>f.find(g=>g.messageId===E),[f,E])??I,P=Se({thread:T,isOpen:T?.messageId===p}),V=as(),R=ct(),j=lt(),w=a.useMemo(()=>dt(j,u,p),[j,u,p]),O=a.useMemo(()=>{if(T)return g=>j({threadId:T.threadId,messageId:T.messageId,mode:g})},[j,T]),{nextMessageId:q,previousMessageId:z}=Pt({context:S,orderedIds:S.orderedIds,selectedMessageId:p,enabled:!V&&!R,hasOpenThread:u!==void 0,onClose:r,handlers:{reply:()=>O?.("reply"),replyAll:()=>O?.("reply-all"),forward:()=>O?.("forward"),delete:()=>{S.listCommandsRef.current?.requestVerb("delete")||P.deleteThread()},toggleStar:P.toggleStar,toggleRead:()=>{S.listCommandsRef.current?.requestVerb("markRead")||T&&$([T.messageId],!T.isRead)},goFlagged:()=>l("flagged"),goSettings:()=>l("settings")}}),A=a.useCallback(g=>{if(!g)return;const N=f.find(B=>B.messageId===g);return N?{threadId:N.threadId,messageId:g}:void 0},[f]),H={selectedMessageId:p,selectedThread:I,conversation:D,onOpenThread:h,onCloseThread:r,nextThread:A(q),previousThread:A(z),actions:F,onReply:w,triage:S,onDeleteMessages:C,handleDeselectIfRemoved:v};return o.jsx(Le.Provider,{value:H,children:t})}function De(){const{selectedMessageId:e,onOpenThread:t,triage:n,onDeleteMessages:r}=J(),{accounts:l}=Y();return o.jsx(Ss,{accounts:l,selectedMessageId:e,onOpenThread:t,commandsRef:n.listCommandsRef,onTriageContextChange:n.onTriageContextChange,onDeleteMessages:r})}function Ts(){const{conversation:e,selectedThread:t,actions:n,onReply:r,handleDeselectIfRemoved:l}=J(),d=!!e,u=Ht(e?.threadId);return o.jsxs(o.Fragment,{children:[o.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[o.jsx(Qt,{hasThread:d,intelligenceOpen:u.isShowing,canToggleIntelligence:u.canToggle,onToggleIntelligence:u.toggle,onReply:r?()=>r("reply"):void 0,onReplyAll:r?()=>r("reply-all"):void 0,onForward:r?()=>r("forward"):void 0,onDelete:d?n.deleteThread:void 0,onToggleStar:d?n.toggleStar:void 0,isStarred:n.isStarred,moveContext:d&&n.accountId&&n.mailboxId?{accountId:n.accountId,currentMailboxId:n.mailboxId,onMove:n.moveThread}:void 0}),o.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?o.jsx(we,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:u.open,listOnScreen:!0}):o.jsx(ht,{})})]}),o.jsx(Me,{isOpen:u.drawerOpen,onClose:u.closeDrawer,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:l})]})}function js(){const{selectedThread:e,handleDeselectIfRemoved:t}=J(),{onToggleIntelligence:n}=Y();return o.jsx(zt,{onClose:n,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function Rs(){const{selectedThread:e,conversation:t,onOpenThread:n,onCloseThread:r,nextThread:l,previousThread:d,handleDeselectIfRemoved:u}=J(),m=qt(t?.threadId??null);return t?o.jsxs(o.Fragment,{children:[o.jsx(we,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:r,onOpenIntelligence:m.toggle,onSwipeNext:l?()=>n(l):void 0,onSwipePrevious:d?()=>n(d):void 0,mobileIntelligenceOpen:m.isOpen}),o.jsx(Me,{isOpen:m.isOpen,onClose:m.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:u})]}):o.jsx("div",{className:"h-full",children:o.jsx(De,{})})}const qs=Object.assign(Cs,{List:De,Reading:Ts,Intelligence:js,Phone:Rs});export{qs as B};
|
|
1
|
+
import{j as o,L as Ze,V as Xe,e0 as et,C as Y,bc as tt,cH as st,r as a,c as oe,e1 as ne,G as ot,dm as nt,e2 as at,dH as rt,_ as Te,dL as it,aj as ct,cO as lt,cP as dt}from"./index-DMZ8-zZM.js";import{g as je,e as ut,f as Re,u as mt,p as ft,R as ht}from"./useSearchTokenContext-DohJINg2.js";import{ai as be,F as ve,aj as gt,ak as xt,G as pt,al as ye,am as It,an as bt,ao as vt,a7 as yt,ap as St,aq as Ct,ar as Tt,M as jt,as as Rt,ae as wt,at as Mt,e as kt,v as Ft,af as Ot,q as At,S as Nt,J as Bt,O as Se,N as Lt,K as Dt,d as Et,Y as Pt,Z as qt,$ as we,a0 as Me,a1 as zt,a2 as Ht,a3 as Qt}from"./MailListHeader-Dhgkq9td.js";import{u as _t,a as Gt,R as $t,b as Vt,c as Wt}from"./useRefreshControl-DKnu6drF.js";import{u as Ut}from"./useQueries-Baii11SK.js";import{a as Yt}from"./useLabels-DbWrQIbS.js";import{u as Jt,b as Kt}from"./useLayoutTier-DKpSXts5.js";import{u as Zt,r as Xt,L as es}from"./useSemanticSearch-DfxdKsNk.js";import{w as ts}from"./wizard-selection-B1bng5Jq.js";import{u as ke}from"./sections-DVKafU2-.js";import{R as ss,g as os,h as ns}from"./search-token-index-BQBAjCB1.js";import{a as as}from"./useMessageBodyContent-DxQjkGza.js";function rs({sync:e}){return e?o.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:[o.jsx(Ze,{className:"size-8 animate-spin text-fg-subtle","aria-hidden":"true"}),o.jsx("p",{className:"text-sm font-medium text-fg",children:"Still syncing your mail"}),o.jsx("p",{className:"text-xs text-fg-subtle",children:is(e)})]}):o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",children:[o.jsx(Xe,{className:"size-8 text-fg-subtle","aria-hidden":"true"}),o.jsx("p",{className:"text-sm font-medium text-fg",children:"You're caught up"}),o.jsx("p",{className:"text-xs text-fg-subtle",children:"Nothing needs attention."})]})}function is({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 Fe=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],Oe="category",cs={unclassified:"uncategorized"},G=e=>ut(e).map(t=>t.raw),_=e=>e.join(" "),ae=e=>{const t=Re(e);if(t)return Fe.find(n=>n.name===t.name&&n.value===t.value.toLowerCase())?.id},re=e=>{const t=Re(e);if(!t||t.name!==Oe)return;const n=t.value.toLowerCase(),r=cs[n];if(r)return r;if(!(!et(n)||n==="all"))return n},Ae=e=>Fe.find(t=>t.id===e),Ne=e=>Ae(e)!==void 0,ls=e=>{const t=new Set;for(const n of G(e)){const r=ae(n);r&&t.add(r)}return t},ds=e=>{let t="all";for(const n of G(e)){const r=re(n);r&&(t=r)}return t},us=(e,t)=>{const n=Ae(t);if(!n)return;const r=G(e),l=r.filter(d=>ae(d)!==t);return l.length<r.length?_(l):_([...r,je(n.name,n.value)])},ms=(e,t)=>{const n=G(e).filter(r=>!re(r));return _(t==="all"?n:[...n,je(Oe,t)])},fs=e=>_(G(e).filter(t=>!ae(t)&&!re(t))),Be=e=>e.trim().length>0,hs=e=>{if(!Be(e.query))return e.ownFilters;const t=new Set(ls(e.query));for(const n of e.ownFilters)Ne(n)||t.add(n);return t},gs=e=>Be(e.query)?ds(e.query):e.ownCategory,xs=(e,t)=>e.createdAt!==t.createdAt?e.createdAt-t.createdAt:e.accountId.localeCompare(t.accountId),ps=e=>[...e].sort(xs),Is=200,Ce=()=>o.jsx("div",{className:"animate-pulse",children:Array.from({length:3}).map((e,t)=>o.jsxs("div",{className:"flex items-start gap-3 py-2 pl-5 pr-4 border-b border-line",children:[o.jsx("div",{className:"size-7 rounded-full bg-surface-sunken shrink-0 mt-0.5"}),o.jsxs("div",{className:"flex-1 space-y-1.5",children:[o.jsxs("div",{className:"flex justify-between gap-2",children:[o.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-28"}),o.jsx("div",{className:"h-3 bg-surface-sunken rounded w-12"})]}),o.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-48"}),o.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})]})]},t))}),bs=({accountEmail:e})=>{const t=ke();return o.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:[o.jsx(Te,{className:"size-3.5 shrink-0"}),o.jsxs("span",{className:"flex-1 truncate",children:[e," can't connect"]}),o.jsx("button",{type:"button",onClick:()=>t("accounts"),className:"shrink-0 underline text-danger hover:opacity-80",children:"Reconnect"})]})},vs=(e,t)=>{if(t.size===0)return{};const n=e.filter(d=>t.has(d.id)),r=Xt(n.map(d=>d.accountId));if(r.restriction)return r;const l=new Set;for(const d of n)d.mailboxId&&l.add(d.mailboxId);return l.size>1?{accountId:r.accountId,restriction:"spansFolders",moveDisabledHint:`Move only works within one folder — this selection spans ${l.size} folders`}:{accountId:r.accountId,mailboxId:l.size===1?[...l][0]:void 0}};function ys({header:e,rows:t,wizard:n,children:r}){const{selectedIds:l,selectedCount:d,exitSelection:u,orderedIds:m,allSelected:b,toggleAllLoaded:f}=Mt(),x=a.useMemo(()=>vs(t,l),[t,l]),{junkMailboxId:L}=kt(x.accountId),{labels:I}=Yt(x.accountId),p=a.useMemo(()=>Array.from(l),[l]),D=a.useMemo(()=>ts(t,l),[t,l]),h=Ft(L,x.mailboxId),v=a.useMemo(()=>m.length>0?{checked:b,indeterminate:d>0&&!b,onChange:f}:void 0,[m.length,b,d,f]),F=x.moveDisabledHint?{tone:"warning",text:x.moveDisabledHint}:void 0,S=C=>o.jsx(Nt,{title:C.title,navSlot:C.navSlot,titleMeta:C.titleMeta,searchSlot:C.searchSlot,searchField:C.searchField,idleSlot:C.makeFilterSlot,count:d,onCancel:u,onDelete:()=>n.start("delete"),onMove:()=>n.start("move"),onOrganize:()=>n.start("organize"),onJunk:h?()=>n.start("junk"):void 0,onMarkRead:()=>n.start("markRead"),overflowSlot:x.accountId&&x.mailboxId&&d>0&&I.length>0?o.jsx(es,{accountId:x.accountId,mailboxId:x.mailboxId,messageIds:p}):void 0,selectAll:v,notice:F});return o.jsx(Ot,{...e,selectionBar:S,paneOverlay:o.jsx(At,{verb:n.verb,accountId:x.accountId,mailboxId:x.mailboxId,selection:D,selectionRestriction:x.restriction,onFinished:u}),children:r})}function Ss({accounts:e,selectedMessageId:t,onOpenThread:n,commandsRef:r,onTriageContextChange:l,onDeleteMessages:d}){const{searchQuery:u,searchInput:m,resultFolderIndex:b,onSearchChange:f}=Y(),x=mt(),L=tt(),I=Jt(),p=st(),D=Kt(),h=a.useMemo(()=>ps(e.filter(s=>!s.muted?.value)),[e]),[v,F]=a.useState("all"),[S,C]=a.useState("all"),[$,E]=a.useState(new Set),[K,T]=a.useState(!1),P=a.useCallback(s=>{E(i=>{const c=new Set(i);return c.has(s)?c.delete(s):c.add(s),c})},[]),V=a.useCallback(()=>E(new Set),[]),R=m.trim().length>0,j=a.useMemo(()=>hs({query:m,ownFilters:$}),[m,$]),w=a.useMemo(()=>gs({query:m,ownCategory:S}),[m,S]),O=a.useCallback(s=>{if(!R||!Ne(s)){P(s);return}const i=us(m,s);i!==void 0&&f(i)},[R,m,f,P]),q=a.useCallback(s=>{if(!R){C(s);return}f(ms(m,s))},[R,m,f]),z=a.useCallback(()=>{C("all"),F("all"),V(),R&&f(fs(m))},[R,m,f,V]),{data:A,isLoading:H,isError:g,refetch:N}=oe({...ne(),staleTime:6e4}),B=Ut({queries:h.map(s=>({...ot({path:{accountId:s.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),W=a.useMemo(()=>{const s=new Map;for(let i=0;i<h.length;i++){const c=h[i].accountId,Ye=(B[i]?.data?.items??[]).reduce((Je,Ke)=>Je+(Ke.unseenCount??0),0);s.set(c,Ye)}return s},[h,B]),Ee=a.useMemo(()=>h.filter((s,i)=>{const c=B[i];return c?.isError?!nt(c.error):!1}),[h,B]),{freeText:M,tokens:Z}=ft(u.trim().toLowerCase(),x),{data:ie,isFetching:Pe}=oe({...ne({query:{query:M,limit:Is}}),enabled:M.length>0,staleTime:3e4}),y=a.useMemo(()=>{const s=be(A?.items??[]).map(ve);return(M?gt(s.filter(c=>xt(c,M)),be(ie?.items??[]).map(ve)):s).filter(c=>(v==="all"||c.accountId===v)&&pt(c,Z))},[A,ie,v,M,Z]),{bodyRows:ce,briefSpamOffer:X}=a.useMemo(()=>{if(!M)return{bodyRows:y,briefSpamOffer:void 0};const s=y.map(k=>ye(k,b)),{spam:i}=It(s);if(i.length===0)return{bodyRows:y,briefSpamOffer:void 0};const c=new Set(i.map(k=>k.id));return{bodyRows:y.filter(k=>!c.has(k.id)),briefSpamOffer:bt(s)}},[y,M,b]),le=a.useMemo(()=>vt(ce),[ce]),de=a.useCallback((s,i)=>{const c=y.find(k=>k.id===s)?.threadId;c&&n?.({threadId:c,messageId:s},i)},[y,n]),qe=a.useCallback(s=>{const i=s.threadId??y.find(c=>c.id===s.id)?.threadId;i&&n?.({threadId:i,messageId:s.id})},[y,n]),ee=a.useMemo(()=>h.length<=1?[]:[{id:"all",label:"All",active:v==="all"},...h.map(s=>({id:s.accountId,label:s.email.split("@")[0]??s.email,count:W.get(s.accountId),active:v===s.accountId}))],[h,W,v]),Q=a.useMemo(()=>e.filter(s=>s.muted?.value).length,[e]),ze=a.useMemo(()=>Array.from(W.values()).reduce((s,i)=>s+i,0),[W]),te=a.useMemo(()=>h.map(s=>s.accountId),[h]),{hasNewMail:ue}=_t(),{state:me,errorMessage:fe,refresh:he}=Gt(te,{onSettled:()=>N()}),He=a.useMemo(()=>o.jsx($t,{state:me,onRefresh:he,label:"Refresh daily brief",errorMessage:fe,hasUpdate:ue(te)}),[me,he,fe,ue,te]),se=a.useMemo(()=>y.filter(s=>(w==="all"||s.category===w)&&at(s,j)).map(s=>ye(s,b)),[y,w,j,b]),{hits:ge,isLoading:Qe}=Zt(),_e=a.useMemo(()=>{const s=new Map;for(const c of A?.items??[])s.set(c.messageId,c.threadId);const i=se.map(c=>s.get(c.id)).filter(c=>c!=null);return yt(ge,i,b)},[ge,se,A,b]),Ge=a.useMemo(()=>{const s=St(ee.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:w,activeFilters:j,expanded:K,onExpandedChange:T,onSelectCategory:i=>q(i),onSelectSource:F,onToggleFilter:i=>O(i),onClear:z}},[ee,Q,w,j,K,O,q,z]),xe=le.length===0&&v==="all"&&M.length===0&&Z.length===0,$e=a.useMemo(()=>h.map(s=>s.accountId),[h]),Ve=a.useMemo(()=>h.some(s=>Vt(s.syncPhase)),[h]),U=Wt($e,xe||Ve),pe=o.jsxs("div",{className:"h-full overflow-y-auto",children:[o.jsx(Ce,{}),o.jsx(Ce,{})]}),Ie=!H&&!g&&!xe,We=Ct({tier:I,hasLiveInput:R,hasCommittedQuery:u.trim().length>0,bodyRendersCommittedResults:!0}),Ue=Ie?o.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[X&&o.jsx(Tt,{count:X.count,onScopeToSpam:()=>D(X.mailboxId,u)}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(rt,{sections:le,briefCategory:w,Row:jt,selectedThreadId:t,onSelectThread:de,onSelectBriefCategory:q,sources:ee,sourcesNote:Q>0?`+${Q} muted`:void 0,onSelectSource:F,activeFilters:j,onToggleFilter:O,onClearFilters:z})})]}):H?pe:g?o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 py-12 text-sm text-fg-muted",children:[o.jsx(Te,{className:"size-8 text-danger"}),o.jsx("p",{children:"Couldn't load your messages"}),o.jsxs("button",{type:"button",onClick:()=>N(),className:"flex items-center gap-1 text-accent underline text-xs",children:[o.jsx(ss,{className:"size-3.5"}),"Try again"]})]}):U.resolved?o.jsx(rs,{sync:U.syncing?{synced:U.synced,total:U.total}:void 0}):pe;return o.jsx(it,{hasSheet:Ie&&!We,children:o.jsx(Rt,{selectedMessageId:t,rows:y,onOpen:de,onDeleteMessages:d,onSelectionVerb:p.start,commandsRef:r,onTriageContextChange:l,children:o.jsx(ys,{wizard:p,header:{title:"Daily brief",unreadCount:ze,footer:L?o.jsx(wt,{}):void 0,searchFilter:Ge,searchResults:se,searchLoading:H||Pe,relatedResults:_e,relatedLoading:Qe,onSelectSearchResult:qe,searchResultsInBody:!0,refreshControl:He},rows:y,children:o.jsxs("div",{className:"flex h-full flex-col",children:[Ee.map(s=>o.jsx(bs,{accountEmail:s.email,accountId:s.accountId},s.accountId)),o.jsx("div",{className:"min-h-0 flex-1",children:Ue})]})})})})}const Le=a.createContext(null);function J(){const e=a.useContext(Le);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function Cs({thread:e,children:t}){const n=os(),r=ns(),l=ke(),{searchInput:d}=Y(),u=e?.threadId,m=e?.messageId,{data:b}=oe({...ne(),staleTime:6e4}),f=a.useMemo(()=>b?.items??[],[b]),x=a.useMemo(()=>{if(u)return f.find(g=>g.messageId===m)??f.find(g=>g.threadId===u)},[f,u,m]),L=Bt(u,m),I=x??L,p=m??I?.messageId,D=a.useMemo(()=>{if(u)return{threadId:u,mailboxId:I?.mailboxId??"",subject:I?.subject,messageId:p,authenticity:I?.authenticity}},[u,I,p]),h=a.useCallback((g,N)=>{n(g,{replace:N?.replace,query:d})},[n,d]),v=a.useCallback(g=>{p&&g.includes(p)&&r()},[p,r]),F=Se({thread:I,isOpen:!0,onAfterOptimisticRemove:v}),S=Lt(),{deleteMessages:C}=Dt({mailboxId:I?.mailboxId??"",messages:f,onAfterOptimisticRemove:v}),{toggleReadFor:$}=Et({mailboxId:I?.mailboxId??"",messages:f}),E=S.focusedMessageId,T=a.useMemo(()=>f.find(g=>g.messageId===E),[f,E])??I,P=Se({thread:T,isOpen:T?.messageId===p}),V=as(),R=ct(),j=lt(),w=a.useMemo(()=>dt(j,u,p),[j,u,p]),O=a.useMemo(()=>{if(T)return g=>j({threadId:T.threadId,messageId:T.messageId,mode:g})},[j,T]),{nextMessageId:q,previousMessageId:z}=Pt({context:S,orderedIds:S.orderedIds,selectedMessageId:p,enabled:!V&&!R,hasOpenThread:u!==void 0,onClose:r,handlers:{reply:()=>O?.("reply"),replyAll:()=>O?.("reply-all"),forward:()=>O?.("forward"),delete:()=>{S.listCommandsRef.current?.requestVerb("delete")||P.deleteThread()},toggleStar:P.toggleStar,toggleRead:()=>{S.listCommandsRef.current?.requestVerb("markRead")||T&&$([T.messageId],!T.isRead)},goFlagged:()=>l("flagged"),goSettings:()=>l("settings")}}),A=a.useCallback(g=>{if(!g)return;const N=f.find(B=>B.messageId===g);return N?{threadId:N.threadId,messageId:g}:void 0},[f]),H={selectedMessageId:p,selectedThread:I,conversation:D,onOpenThread:h,onCloseThread:r,nextThread:A(q),previousThread:A(z),actions:F,onReply:w,triage:S,onDeleteMessages:C,handleDeselectIfRemoved:v};return o.jsx(Le.Provider,{value:H,children:t})}function De(){const{selectedMessageId:e,onOpenThread:t,triage:n,onDeleteMessages:r}=J(),{accounts:l}=Y();return o.jsx(Ss,{accounts:l,selectedMessageId:e,onOpenThread:t,commandsRef:n.listCommandsRef,onTriageContextChange:n.onTriageContextChange,onDeleteMessages:r})}function Ts(){const{conversation:e,selectedThread:t,actions:n,onReply:r,handleDeselectIfRemoved:l}=J(),d=!!e,u=Ht(e?.threadId);return o.jsxs(o.Fragment,{children:[o.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[o.jsx(Qt,{hasThread:d,intelligenceOpen:u.isShowing,canToggleIntelligence:u.canToggle,onToggleIntelligence:u.toggle,onReply:r?()=>r("reply"):void 0,onReplyAll:r?()=>r("reply-all"):void 0,onForward:r?()=>r("forward"):void 0,onDelete:d?n.deleteThread:void 0,onToggleStar:d?n.toggleStar:void 0,isStarred:n.isStarred,moveContext:d&&n.accountId&&n.mailboxId?{accountId:n.accountId,currentMailboxId:n.mailboxId,onMove:n.moveThread}:void 0}),o.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?o.jsx(we,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:u.open,listOnScreen:!0}):o.jsx(ht,{})})]}),o.jsx(Me,{isOpen:u.drawerOpen,onClose:u.closeDrawer,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:l})]})}function js(){const{selectedThread:e,handleDeselectIfRemoved:t}=J(),{onToggleIntelligence:n}=Y();return o.jsx(zt,{onClose:n,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function Rs(){const{selectedThread:e,conversation:t,onOpenThread:n,onCloseThread:r,nextThread:l,previousThread:d,handleDeselectIfRemoved:u}=J(),m=qt(t?.threadId??null);return t?o.jsxs(o.Fragment,{children:[o.jsx(we,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:r,onOpenIntelligence:m.toggle,onSwipeNext:l?()=>n(l):void 0,onSwipePrevious:d?()=>n(d):void 0,mobileIntelligenceOpen:m.isOpen}),o.jsx(Me,{isOpen:m.isOpen,onClose:m.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:u})]}):o.jsx("div",{className:"h-full",children:o.jsx(De,{})})}const qs=Object.assign(Cs,{List:De,Reading:Ts,Intelligence:js,Phone:Rs});export{qs as B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as z,c as ee,a as te,k as _}from"./useCalendars-CuuHCvAe.js";import{j as n,f as j,t as d,Y as ne,Z as ae,ay as y,r as p,ax as se,X as re,i as T,e9 as ie,ea as le,eb as oe,h as ce,s as de,b2 as ue,_ as me}from"./index-BoxiBjE8.js";import{f as he}from"./ErrorState-BdpB-2BQ.js";const xe=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],pe=["January","February","March","April","May","June","July","August","September","October","November","December"],ye=["first","second","third","fourth","last"],A="";function fe(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=ye[Math.min(Math.floor((i-1)/7),4)],c=t===""?"":`, ${t}`,f=r.getUTCDay()>=1&&r.getUTCDay()<=5;return[`Every day${c}`,...f?[`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(y,{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(y,{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(y,{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(y,{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(y,{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(y,{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:f="Add",header:g,repeatEditable:b=!0,guestsEditable:I=!1,calendarEditable:M=!0,onCustomRepeat:X,touch:m,className:w}){const v=s==="pane",h={draft:e,onChange:t,layout:s,touch:m},S=n.jsx(ge,{...h}),$=n.jsx(be,{...h}),R=n.jsx(Ee,{...h,calendars:a}),F=n.jsx(Ne,{...h,repeatEditable:b,onCustom:X}),Y=n.jsx(je,{...h}),L=n.jsx(Te,{...h}),P=n.jsx(Ce,{...h}),W=n.jsxs("div",{className:d("flex items-center gap-2",v?"pt-2":"pt-1"),children:[n.jsx(j,{variant:"primary",size:m||v?"md":"sm",onClick:l,disabled:H(e),className:m?"min-h-11 flex-1":"",children:f}),n.jsx(j,{variant:"ghost",size:m||v?"md":"sm",onClick:o,className:m?"min-h-11":"",children:"Cancel"}),c&&n.jsx(j,{variant:"ghost",size:m||v?"md":"sm",onClick:c,className:d("ml-auto text-danger",m&&"min-h-11"),children:"Delete"})]});if(v)return n.jsxs("div",{className:d("flex flex-col gap-5",w),children:[g,n.jsx(x,{label:"Title",children:S}),n.jsx(x,{label:"When",children:$}),M&&n.jsx(x,{label:"Calendar",children:R}),n.jsx(x,{label:"Repeat",children:F}),n.jsx(x,{label:"Location",children:Y}),I&&n.jsx(x,{label:"Guests",children:L}),n.jsx(x,{label:"Notes",children:P}),W]});const Z=r!==void 0&&!i;return n.jsxs("div",{className:d("flex flex-col gap-3",w),children:[g,S,$,M&&R,r&&n.jsxs("button",{type:"button",onClick:r,"aria-expanded":i,className:d("flex items-center gap-1 self-start rounded-sm text-xs font-medium text-fg-muted outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",m&&"min-h-11"),children:[i?n.jsx(ne,{className:"size-3.5"}):n.jsx(ae,{className:"size-3.5"}),i?"Fewer details":"More details"]}),!Z&&n.jsxs("div",{className:"flex flex-col gap-2 border-t border-line pt-3",children:[Y,I&&L,F,P]}),W]})}const U="__custom__";function ke({value:e,date:t,startTime:a,onChange:s,onCustom:i,className:r}){const l=fe(t,a),o=e===A||l.includes(e)?l:[e,...l];return n.jsxs(se,{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=ee(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(re,{className:"size-4"})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-row-inset py-5",children:n.jsx("div",{className:"mx-auto w-full max-w-2xl",children:s})})]})}const E=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],N=["SU","MO","TU","WE","TH","FR","SA"],Q=["January","February","March","April","May","June","July","August","September","October","November","December"],K=["first","second","third","fourth","last"],G=[1,2,3,4,-1],J="MO,TU,WE,TH,FR",Ie=e=>e.replace(/,\s*\d{2}:\d{2}$/,"").trim();function O(e){const t=Ie(e);if(t==="")return"";if(t==="Every day")return"FREQ=DAILY";if(t==="Every weekday")return`FREQ=WEEKLY;BYDAY=${J}`;const a=t.match(/^Every week on (\w+)$/);if(a){const r=E.indexOf(a[1]);return r===-1?void 0:`FREQ=WEEKLY;BYDAY=${N[r]}`}const s=t.match(/^Every month on the (\w+) (\w+)$/);if(s){const r=K.indexOf(s[1]),l=E.indexOf(s[2]);return r===-1||l===-1?void 0:`FREQ=MONTHLY;BYDAY=${G[r]}${N[l]}`}const i=t.match(/^Every year on (\d{1,2}) (\w+)$/);if(i){const r=Q.indexOf(i[2]);return r===-1?void 0:`FREQ=YEARLY;BYMONTH=${r+1};BYMONTHDAY=${Number(i[1])}`}}const Me=e=>e===""?"":`, ${e}`;function Le(e,t){const a=new Map(e.split(";").map(l=>l.split("=")).filter(l=>l.length===2).map(([l,o])=>[l.toUpperCase(),o.toUpperCase()])),s=Me(t),i=a.get("FREQ"),r=a.get("BYDAY");if(!(a.has("INTERVAL")&&a.get("INTERVAL")!=="1")&&!(a.has("UNTIL")||a.has("COUNT"))){if(i==="DAILY")return`Every day${s}`;if(i==="WEEKLY"){if(r===void 0)return;if(r===J)return`Every weekday${s}`;const l=N.indexOf(r);return l===-1?void 0:`Every week on ${E[l]}${s}`}if(i==="MONTHLY"){const l=r?.match(/^(-?\d)([A-Z]{2})$/);if(!l)return;const o=G.indexOf(Number(l[1])),c=N.indexOf(l[2]);return o===-1||c===-1?void 0:`Every month on the ${K[o]} ${E[c]}${s}`}if(i==="YEARLY"){const l=Number(a.get("BYMONTH")),o=Number(a.get("BYMONTHDAY"));return!l||!o||l>12?void 0:`Every year on ${o} ${Q[l-1]}${s}`}}}function Pe(e,t){return{title:"",date:e,startTime:"09:00",endTime:"10:00",allDay:!1,calendarId:t,location:"",guests:"",notes:"",repeat:""}}function We(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:te(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 _e(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 Ue(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=de(400,404,412),we=new Set(["calendarEventOperationsListCalendarEvents","calendarEventDetailOperationsGetCalendarEvent","calendarFreeBusyOperationsListCalendarFreeBusy"]),D={kind:"written"},k=e=>ue(e)===412?{kind:"conflict"}:{kind:"refused",message:he(e)},Se={this:"This",following:"Following",all:"All"};function $e(){const e=ce();return p.useCallback(()=>{e.invalidateQueries({predicate:t=>{const a=t.queryKey[0];if(typeof a!="object"||a===null)return!1;const s=a._id;return typeof s=="string"&&we.has(s)}})},[e])}const B=({scope:e,recurrenceId:t})=>e===void 0||e==="all"?{}:{scope:Se[e],recurrenceId:t};function Be(){const e=$e(),t=T({...ie(),meta:C,onSuccess:e}),a=T({...le(),meta:C,onSuccess:e}),s=T({...oe(),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 ze({title:e,subtitle:t,calendars:a,draft:s,onChange:i,problem:r,saveLabel:l,isSaving:o,repeatEditable:c=!0,calendarEditable:f=!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:f,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(me,{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{ze as C,_e as c,We as d,Pe as e,Ue as p,Le as t,Be as u};
|
|
1
|
+
import{R as z,c as ee,a as te,k as _}from"./useCalendars-BruqGaWc.js";import{j as n,f as j,t as d,Y as ne,Z as ae,ay as y,r as p,ax as se,X as re,i as T,e9 as ie,ea as le,eb as oe,h as ce,s as de,b2 as ue,_ as me}from"./index-DMZ8-zZM.js";import{f as he}from"./ErrorState-BGolGYcc.js";const xe=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],pe=["January","February","March","April","May","June","July","August","September","October","November","December"],ye=["first","second","third","fourth","last"],A="";function fe(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=ye[Math.min(Math.floor((i-1)/7),4)],c=t===""?"":`, ${t}`,f=r.getUTCDay()>=1&&r.getUTCDay()<=5;return[`Every day${c}`,...f?[`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(y,{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(y,{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(y,{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(y,{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(y,{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(y,{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:f="Add",header:g,repeatEditable:b=!0,guestsEditable:I=!1,calendarEditable:M=!0,onCustomRepeat:X,touch:m,className:w}){const v=s==="pane",h={draft:e,onChange:t,layout:s,touch:m},S=n.jsx(ge,{...h}),$=n.jsx(be,{...h}),R=n.jsx(Ee,{...h,calendars:a}),F=n.jsx(Ne,{...h,repeatEditable:b,onCustom:X}),Y=n.jsx(je,{...h}),L=n.jsx(Te,{...h}),P=n.jsx(Ce,{...h}),W=n.jsxs("div",{className:d("flex items-center gap-2",v?"pt-2":"pt-1"),children:[n.jsx(j,{variant:"primary",size:m||v?"md":"sm",onClick:l,disabled:H(e),className:m?"min-h-11 flex-1":"",children:f}),n.jsx(j,{variant:"ghost",size:m||v?"md":"sm",onClick:o,className:m?"min-h-11":"",children:"Cancel"}),c&&n.jsx(j,{variant:"ghost",size:m||v?"md":"sm",onClick:c,className:d("ml-auto text-danger",m&&"min-h-11"),children:"Delete"})]});if(v)return n.jsxs("div",{className:d("flex flex-col gap-5",w),children:[g,n.jsx(x,{label:"Title",children:S}),n.jsx(x,{label:"When",children:$}),M&&n.jsx(x,{label:"Calendar",children:R}),n.jsx(x,{label:"Repeat",children:F}),n.jsx(x,{label:"Location",children:Y}),I&&n.jsx(x,{label:"Guests",children:L}),n.jsx(x,{label:"Notes",children:P}),W]});const Z=r!==void 0&&!i;return n.jsxs("div",{className:d("flex flex-col gap-3",w),children:[g,S,$,M&&R,r&&n.jsxs("button",{type:"button",onClick:r,"aria-expanded":i,className:d("flex items-center gap-1 self-start rounded-sm text-xs font-medium text-fg-muted outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",m&&"min-h-11"),children:[i?n.jsx(ne,{className:"size-3.5"}):n.jsx(ae,{className:"size-3.5"}),i?"Fewer details":"More details"]}),!Z&&n.jsxs("div",{className:"flex flex-col gap-2 border-t border-line pt-3",children:[Y,I&&L,F,P]}),W]})}const U="__custom__";function ke({value:e,date:t,startTime:a,onChange:s,onCustom:i,className:r}){const l=fe(t,a),o=e===A||l.includes(e)?l:[e,...l];return n.jsxs(se,{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=ee(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(re,{className:"size-4"})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-row-inset py-5",children:n.jsx("div",{className:"mx-auto w-full max-w-2xl",children:s})})]})}const E=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],N=["SU","MO","TU","WE","TH","FR","SA"],Q=["January","February","March","April","May","June","July","August","September","October","November","December"],K=["first","second","third","fourth","last"],G=[1,2,3,4,-1],J="MO,TU,WE,TH,FR",Ie=e=>e.replace(/,\s*\d{2}:\d{2}$/,"").trim();function O(e){const t=Ie(e);if(t==="")return"";if(t==="Every day")return"FREQ=DAILY";if(t==="Every weekday")return`FREQ=WEEKLY;BYDAY=${J}`;const a=t.match(/^Every week on (\w+)$/);if(a){const r=E.indexOf(a[1]);return r===-1?void 0:`FREQ=WEEKLY;BYDAY=${N[r]}`}const s=t.match(/^Every month on the (\w+) (\w+)$/);if(s){const r=K.indexOf(s[1]),l=E.indexOf(s[2]);return r===-1||l===-1?void 0:`FREQ=MONTHLY;BYDAY=${G[r]}${N[l]}`}const i=t.match(/^Every year on (\d{1,2}) (\w+)$/);if(i){const r=Q.indexOf(i[2]);return r===-1?void 0:`FREQ=YEARLY;BYMONTH=${r+1};BYMONTHDAY=${Number(i[1])}`}}const Me=e=>e===""?"":`, ${e}`;function Le(e,t){const a=new Map(e.split(";").map(l=>l.split("=")).filter(l=>l.length===2).map(([l,o])=>[l.toUpperCase(),o.toUpperCase()])),s=Me(t),i=a.get("FREQ"),r=a.get("BYDAY");if(!(a.has("INTERVAL")&&a.get("INTERVAL")!=="1")&&!(a.has("UNTIL")||a.has("COUNT"))){if(i==="DAILY")return`Every day${s}`;if(i==="WEEKLY"){if(r===void 0)return;if(r===J)return`Every weekday${s}`;const l=N.indexOf(r);return l===-1?void 0:`Every week on ${E[l]}${s}`}if(i==="MONTHLY"){const l=r?.match(/^(-?\d)([A-Z]{2})$/);if(!l)return;const o=G.indexOf(Number(l[1])),c=N.indexOf(l[2]);return o===-1||c===-1?void 0:`Every month on the ${K[o]} ${E[c]}${s}`}if(i==="YEARLY"){const l=Number(a.get("BYMONTH")),o=Number(a.get("BYMONTHDAY"));return!l||!o||l>12?void 0:`Every year on ${o} ${Q[l-1]}${s}`}}}function Pe(e,t){return{title:"",date:e,startTime:"09:00",endTime:"10:00",allDay:!1,calendarId:t,location:"",guests:"",notes:"",repeat:""}}function We(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:te(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 _e(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 Ue(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=de(400,404,412),we=new Set(["calendarEventOperationsListCalendarEvents","calendarEventDetailOperationsGetCalendarEvent","calendarFreeBusyOperationsListCalendarFreeBusy"]),D={kind:"written"},k=e=>ue(e)===412?{kind:"conflict"}:{kind:"refused",message:he(e)},Se={this:"This",following:"Following",all:"All"};function $e(){const e=ce();return p.useCallback(()=>{e.invalidateQueries({predicate:t=>{const a=t.queryKey[0];if(typeof a!="object"||a===null)return!1;const s=a._id;return typeof s=="string"&&we.has(s)}})},[e])}const B=({scope:e,recurrenceId:t})=>e===void 0||e==="all"?{}:{scope:Se[e],recurrenceId:t};function Be(){const e=$e(),t=T({...ie(),meta:C,onSuccess:e}),a=T({...le(),meta:C,onSuccess:e}),s=T({...oe(),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 ze({title:e,subtitle:t,calendars:a,draft:s,onChange:i,problem:r,saveLabel:l,isSaving:o,repeatEditable:c=!0,calendarEditable:f=!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:f,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(me,{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{ze as C,_e as c,We as d,Pe as e,Ue as p,Le as t,Be as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,r as e}from"./index-
|
|
1
|
+
import{j as t,r as e}from"./index-DMZ8-zZM.js";const o=e.createContext(void 0),C=({pick:s,children:r})=>t.jsx(o.Provider,{value:s,children:r}),d=()=>e.useContext(o);export{C,d as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,j as n,ak as l,al as o}from"./index-
|
|
1
|
+
import{r,j as n,ak as l,al as o}from"./index-DMZ8-zZM.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-DMZ8-zZM.js";const x=({message:s,icon:t})=>e.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[t&&e.jsx("div",{className:"mb-4 text-fg-muted",children:t}),e.jsx("p",{className:"text-fg-muted",children:s})]});export{x as E};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,_ as r}from"./index-
|
|
1
|
+
import{j as t,_ as r}from"./index-DMZ8-zZM.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{e3 as J,r as n,cb as U,C as z,bc as $,cH as X,aY as ee,aZ as te,j as a,aj as se,cO as ae,cP as re}from"./index-
|
|
1
|
+
import{e3 as J,r as n,cb as U,C as z,bc as $,cH as X,aY as ee,aZ as te,j as a,aj as se,cO as ae,cP as re}from"./index-DMZ8-zZM.js";import{u as oe,p as ne,R as de}from"./useSearchTokenContext-DohJINg2.js";import{F as ie,ak as le,G as ce,au as ue,al as ge,b as he,M as me,as as fe,av as Ie,at as pe,q as xe,J as Te,O as V,N as ye,K as ve,d as be,Y as Re,Z as Ce,$ as K,a0 as G,a1 as Se,a2 as we,a3 as je}from"./MailListHeader-Dhgkq9td.js";import{u as Fe,b as Me,a as Oe}from"./MailViewChrome-J4bT_B41.js";import{f as Pe}from"./ErrorState-BGolGYcc.js";import{w as ke}from"./wizard-selection-B1bng5Jq.js";import{a as Le}from"./useMessageBodyContent-DxQjkGza.js";import{g as Ae,h as Ne}from"./search-token-index-BQBAjCB1.js";import{u as De}from"./sections-DVKafU2-.js";const Ee=()=>U({query:{starred:!0,order:"desc"}});function W(){const{data:e,isLoading:t,isError:s,error:d,refetch:h,fetchNextPage:c,hasNextPage:r,isFetchingNextPage:m}=Fe({queryKey:Ee(),queryFn:async({pageParam:T})=>{const{data:v}=await J({query:{starred:!0,order:"desc",continuationToken:T},throwOnError:!0});return v},initialPageParam:void 0,getNextPageParam:T=>T.continuationToken,staleTime:6e4});return{threads:n.useMemo(()=>(e?.pages??[]).flatMap(T=>T.items??[]),[e]),isLoading:t,isError:s,error:d,refetch:h,fetchNextPage:c,hasNextPage:r,isFetchingNextPage:m}}const Be=e=>{const t=new Set;return e.filter(s=>t.has(s.threadId)?!1:(t.add(s.threadId),!0))},qe={unread:e=>!e.isRead,attachment:e=>e.hasAttachment===!0};function He({rows:e,verb:t}){const{selectedIds:s,exitSelection:d}=pe(),h=n.useMemo(()=>ke(e,s),[e,s]);return a.jsx(xe,{verb:t,selection:h,selectionRestriction:"spansAccounts",onFinished:d})}function ze({selectedMessageId:e,onOpenThread:t,commandsRef:s,onTriageContextChange:d,onDeleteMessages:h}){const{searchQuery:c,resultFolderIndex:r}=z(),m=oe(),I=$(),T=X(),[v,f]=n.useState("all"),[g,F]=n.useState(new Set),D=n.useCallback(o=>{F(u=>{const x=new Set(u);return x.has(o)?x.delete(o):x.add(o),x})},[]),C=n.useCallback(()=>{f("all"),F(new Set)},[]),{threads:M,isLoading:y,isError:O,error:E,refetch:P,fetchNextPage:Q,hasNextPage:p,isFetchingNextPage:S}=W(),{freeText:R,tokens:k}=ne(c.trim().toLowerCase(),m),i=n.useMemo(()=>{const o=Array.from(g).map(u=>qe[u]).filter(u=>u!=null);return Be(M).map(ie).filter(u=>(v==="all"||u.category===v)&&o.every(x=>x(u))&&(!R||le(u,R))&&ce(u,k))},[M,v,g,R,k]),w=n.useCallback((o,u)=>{const x=i.find(_=>_.id===o)?.threadId;x&&t?.({threadId:x,messageId:o},u)},[i,t]),j=n.useCallback(o=>{const u=o.threadId??i.find(x=>x.id===o.id)?.threadId;u&&t?.({threadId:u,messageId:o.id})},[i,t]),B=n.useMemo(()=>ue(),[]),q=n.useMemo(()=>i.map(o=>ge(o,r)),[i,r]),L=n.useMemo(()=>i.filter(o=>!o.isRead).length,[i]),A=y?"loading":O?"error":i.length===0?"empty":"ready",l=n.useCallback(()=>{const o=ee(te());window.open(o,"_blank","noopener,noreferrer")},[]),b=he(),H=a.jsx("div",{className:"flex h-full min-h-0 flex-col",children:a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.jsx("div",{className:"divide-y divide-line",children:i.map(o=>a.jsx(me,{thread:o,active:o.id===e,onClick:()=>w(o.id)},o.id))}),p?a.jsx("button",{type:"button",className:"w-full py-3 text-sm text-muted hover:text-fg disabled:opacity-50",onClick:()=>Q(),disabled:S,children:S?"Loading…":"Load more"}):null]})});return a.jsx(Me,{title:"Starred",unreadCount:L,preset:B,selectedCategory:v,activeFilters:g,onSelectCategory:f,onToggleFilter:D,onClearFilters:C,searchResults:q,searchLoading:y,onSelectSearchResult:j,searchResultsInBody:!0,children:a.jsxs(fe,{selectedMessageId:e,rows:i,onOpen:w,onDeleteMessages:h,onSelectionVerb:T.start,commandsRef:s,onTriageContextChange:d,children:[a.jsx(Oe,{listTitle:"Starred",sections:[{id:"flagged",threads:i}],flatList:!0,hideHeader:!0,listState:b.searchResults?"ready":A,searchQuery:R?c:void 0,errorMessage:O?Pe(E):void 0,onRetry:()=>P(),onReportError:l,selectedThreadId:e,onSelectThread:w,isDesktop:I,selectionBar:a.jsx(Ie,{title:"Starred"}),listBody:b.searchResults??(A==="ready"?H:void 0)}),a.jsx(He,{rows:i,verb:T.verb})]})})}const Y=n.createContext(null);function N(){const e=n.useContext(Y);if(!e)throw new Error("FlaggedPane.* must be used inside <FlaggedPane>");return e}function Qe({thread:e,children:t}){const s=Ae(),d=Ne(),h=De(),{searchInput:c}=z(),r=e?.threadId,m=e?.messageId,{threads:I}=W(),T=n.useMemo(()=>{if(r)return I.find(l=>l.messageId===m)??I.find(l=>l.threadId===r)},[I,r,m]),v=Te(r,m),f=T??v,g=m??f?.messageId,F=n.useMemo(()=>{if(r)return{threadId:r,mailboxId:f?.mailboxId??"",subject:f?.subject,messageId:g,authenticity:f?.authenticity}},[r,f,g]),D=n.useCallback((l,b)=>{s(l,{replace:b?.replace,query:c})},[s,c]),C=n.useCallback(l=>{g&&l.includes(g)&&d()},[g,d]),M=V({thread:f,isOpen:!0,onAfterOptimisticRemove:C}),y=ye(),{deleteMessages:O}=ve({mailboxId:f?.mailboxId??"",messages:I,onAfterOptimisticRemove:C}),{toggleReadFor:E}=be({mailboxId:f?.mailboxId??"",messages:I}),P=y.focusedMessageId,p=n.useMemo(()=>I.find(l=>l.messageId===P),[I,P])??f,S=V({thread:p,isOpen:p?.messageId===g}),R=Le(),k=se(),i=ae(),w=n.useMemo(()=>re(i,r,g),[i,r,g]),j=n.useMemo(()=>{if(p)return l=>i({threadId:p.threadId,messageId:p.messageId,mode:l})},[i,p]),{nextMessageId:B,previousMessageId:q}=Re({context:y,orderedIds:y.orderedIds,selectedMessageId:g,enabled:!R&&!k,hasOpenThread:r!==void 0,onClose:d,handlers:{reply:()=>j?.("reply"),replyAll:()=>j?.("reply-all"),forward:()=>j?.("forward"),delete:()=>{y.listCommandsRef.current?.requestVerb("delete")||S.deleteThread()},toggleStar:S.toggleStar,toggleRead:()=>{y.listCommandsRef.current?.requestVerb("markRead")||p&&E([p.messageId],!p.isRead)},goBrief:()=>h("brief"),goSettings:()=>h("settings")}}),L=n.useCallback(l=>{if(!l)return;const b=I.find(H=>H.messageId===l);return b?{threadId:b.threadId,messageId:l}:void 0},[I]),A={selectedMessageId:g,selectedThread:f,conversation:F,onOpenThread:D,onCloseThread:d,nextThread:L(B),previousThread:L(q),actions:M,onReply:w,triage:y,onDeleteMessages:O,handleDeselectIfRemoved:C};return a.jsx(Y.Provider,{value:A,children:t})}function Z(){const{selectedMessageId:e,onOpenThread:t,triage:s,onDeleteMessages:d}=N();return a.jsx(ze,{selectedMessageId:e,onOpenThread:t,commandsRef:s.listCommandsRef,onTriageContextChange:s.onTriageContextChange,onDeleteMessages:d})}function Ve(){const{conversation:e,selectedThread:t,actions:s,onReply:d,handleDeselectIfRemoved:h}=N(),c=!!e,r=we(e?.threadId);return a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[a.jsx(je,{hasThread:c,intelligenceOpen:r.isShowing,canToggleIntelligence:r.canToggle,onToggleIntelligence:r.toggle,onReply:d?()=>d("reply"):void 0,onReplyAll:d?()=>d("reply-all"):void 0,onForward:d?()=>d("forward"):void 0,onDelete:c?s.deleteThread:void 0,onToggleStar:c?s.toggleStar:void 0,isStarred:s.isStarred,moveContext:c&&s.accountId&&s.mailboxId?{accountId:s.accountId,currentMailboxId:s.mailboxId,onMove:s.moveThread}:void 0}),a.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?a.jsx(K,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:r.open,listOnScreen:!0}):a.jsx(de,{})})]}),a.jsx(G,{isOpen:r.drawerOpen,onClose:r.closeDrawer,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:h})]})}function Ke(){const{selectedThread:e,handleDeselectIfRemoved:t}=N(),{onToggleIntelligence:s}=z();return a.jsx(Se,{onClose:s,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function Ge(){const{selectedThread:e,conversation:t,onCloseThread:s,onOpenThread:d,nextThread:h,previousThread:c,handleDeselectIfRemoved:r}=N(),m=Ce(t?.threadId??null);return t?a.jsxs(a.Fragment,{children:[a.jsx(K,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:s,onOpenIntelligence:m.toggle,onSwipeNext:h?()=>d(h):void 0,onSwipePrevious:c?()=>d(c):void 0,mobileIntelligenceOpen:m.isOpen}),a.jsx(G,{isOpen:m.isOpen,onClose:m.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:r})]}):a.jsx("div",{className:"h-full",children:a.jsx(Z,{})})}const tt=Object.assign(Qe,{List:Z,Reading:Ve,Intelligence:Ke,Phone:Ge});export{tt as F};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,c as f,d as m,E as N,j as e,bc as E,X as w}from"./index-
|
|
1
|
+
import{r as n,c as f,d as m,E as N,j as e,bc as E,X as w}from"./index-DMZ8-zZM.js";import{E as u}from"./ErrorState-BGolGYcc.js";import{D as r,C as x,u as k}from"./index-RbY7Dn0X.js";import{c as p,d as h,e as b}from"./useMessageBodyContent-DxQjkGza.js";import{C as S}from"./confirm-dialog-PyqpaetG.js";const C=t=>t?"Draft":"New Message",I=()=>{const t=n.useRef(!1);return n.useCallback(()=>{const s=document.querySelector("[data-subject-field]")?.value??"",o=(document.querySelector('[data-testid="compose-body"]')?.textContent??"").replace(/--\s*/g,"").trim();return t.current=s.trim().length>0||o.length>0,t.current},[])},O=()=>{const t=p(),i=h(),s=b(),a=I(),[l,o]=n.useState(!1),{isError:d,error:c,refetch:g}=f({...m(),staleTime:1/0}),j=n.useCallback(D=>{D||(a()?o(!0):s())},[s,a]),y=n.useCallback(()=>{o(!1),s()},[s]),v=n.useCallback(()=>{o(!1)},[]);return N({id:"mobile-compose",open:!0}),e.jsxs(r.Root,{open:!0,onOpenChange:j,children:[e.jsxs(r.Portal,{children:[e.jsx(r.Overlay,{className:"fixed inset-0 z-40 bg-black/40"}),e.jsxs(r.Content,{className:"fixed inset-x-0 bottom-0 z-50 flex flex-col rounded-t-lg bg-canvas pb-[env(safe-area-inset-bottom,0px)]",style:{height:"95dvh"},children:[e.jsx(r.Handle,{className:"mx-auto mt-2 mb-1 h-1.5 w-12 rounded-full bg-fg-muted/30"}),e.jsx(r.Title,{className:"px-4 py-2 text-base font-semibold border-b border-line",children:C(t)}),d?e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(u,{title:"Couldn't load compose",error:c,onRetry:()=>{g()}})}):e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(x,{mode:"new",outboxMessageId:t,onDraftCreated:i,onClose:s})})]})]}),e.jsx(S,{isOpen:l,title:"Discard draft?",description:"Your message has unsaved content. Are you sure you want to discard it?",confirmLabel:"Discard",cancelLabel:"Keep editing",destructive:!0,onConfirm:y,onCancel:v})]})},q=()=>{const t=p(),i=h(),s=b(),a=E(),{isError:l,error:o,refetch:d}=f({...m(),staleTime:1/0});if(k({bindings:[{key:"Escape",handler:s,preventDefault:!0}]}),!a)return e.jsx(O,{});const c=e.jsxs("header",{className:"flex items-center justify-between gap-2 px-4 py-3 border-b border-line shrink-0",children:[e.jsx("div",{className:"flex items-center gap-2 min-w-0",children:e.jsx("h2",{className:"text-lg font-semibold truncate",children:C(t)})}),e.jsx("button",{type:"button",onClick:s,className:"p-2 rounded-md hover:bg-surface-raised transition-colors min-h-11 min-w-11 inline-flex items-center justify-center","aria-label":"Close",children:e.jsx(w,{className:"size-5"})})]});return l?e.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[c,e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(u,{title:"Couldn't load compose",error:o,onRetry:()=>{d()}})})]}):e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-canvas",children:[c,e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(x,{mode:"new",outboxMessageId:t,onDraftCreated:i,onClose:s})})]})};export{q as F};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ar as ys,cR as xr,r as l,e as de,j as a,Y as ft,Z as Bn,f as V,X as Dt,g as Ie,cS as Kn,t as _,W as Je,V as Ye,be as vr,cT as yr,cU as kr,aA as Ft,a2 as Ot,cV as qn,bu as ks,cW as wr,cX as Qn,aH as jr,L as Hn,_ as Cr,cY as Sr,B as Gn,cZ as Nr,c_ as Tr,c$ as Ir,d0 as Er,d1 as Rr,d2 as Mr,d3 as Ar,d4 as $r,w as Lr,c as ee,d as bt,G as xt,d5 as Pr,d6 as Dr,d7 as zt,h as ie,as as xe,i as me,N as Xe,cu as Re,d8 as _t,cl as Fr,d9 as Me,da as Or,db as Ws,dc as zr,dd as _r,de as Ur,b3 as Br,cc as Kr,cJ as ws,cK as Vn,df as qr,bc as js,ab as Qr,bf as Wn,b9 as Yn,bg as Jn,aV as Xn,E as Cs,bh as Hr,aY as Gr,aZ as Vr,cz as Wr,dg as Yr,aa as Zn,cy as Jr,dh as Xr,di as Zr,dj as ea,dk as eo,cO as to,bF as Ss,dl as so,dm as Ys,dn as no,dp as es,dq as ao,bE as ro,Q as oo,q as io,ag as ta,F as lo,cQ as Js,bo as co,dr as uo,ds as fo,au as Xs,cM as mo,dt as po,ah as ho,ca as go,cb as bo,du as xo,C as Ut,dv as vo,dw as yo,dx as Zs,dy as ko,dz as wo,dA as jo,v as sa,dB as Ns,cN as ke,dC as Co,cd as So,c8 as No,dD as To,dE as en,a1 as Io,ce as Eo}from"./index-BoxiBjE8.js";import{m as Ro,S as na,i as we,t as je,r as vt,n as yt,o as kt,p as wt,q as Mo,h as Ao,d as $o,D as Lo,b as It,a as Po,v as Do,w as Fo,x as lt,e as Oo,y as zo,z as _o,u as Uo}from"./search-token-index-D-gWPAEk.js";import{K as Bo}from"./kbd-CQfGa1PF.js";import{P as aa,f as Ko,U as qo,a as Qo,E as Ho,s as Go}from"./attachment-file-D0HDeXxM.js";import{M as Vo}from"./mail-zh2SRy5b.js";import{A as mt}from"./avatar-CRolAGMx.js";import{M as Wo,a as Yo,b as ra,c as Jo,s as oa,d as ia,e as Xo,f as Zo,S as tn,g as la,u as ca,p as ei,r as ti}from"./useSearchTokenContext-BKuymkTr.js";import{C as si,D as He,u as ni}from"./index-tORYm1g3.js";import{E as da}from"./EmptyState-ByZPPoBW.js";import{E as Oe}from"./ErrorState-BdpB-2BQ.js";import{e as ua,b as Ze,a as ai,g as ri,c as ze,h as oi,d as ii}from"./format-B_FD2e8R.js";import{D as li}from"./download-N8RxH0I6.js";import{g as ci}from"./useMessageBodyContent-Dgv5wWIW.js";import{B as di,b as ui,u as fi,i as mi}from"./useLayoutTier-B31omesr.js";import{S as pi}from"./shield-check-CDbh7UQQ.js";import{u as fa}from"./useDebouncedValue-ATwGPcJy.js";import{h as sn,u as hi,a as gi,i as bi,n as xi,o as vi,j as yi,k as ki,S as wi}from"./useFilters-BcjDJmnI.js";import{u as Ts}from"./useQueries-CYk5lp9G.js";import{M as ji}from"./minus-cjwKQEGX.js";import{C as Et}from"./confirm-dialog-BHPwL2Mu.js";import{C as Ci}from"./clock-WuXeJWU-.js";import{r as Si,a as Ni}from"./search-scope-B5-OK3Cq.js";import{M as Ti}from"./menu-DN5zpA0a.js";function pt(e){if(Ii())e.focus({preventScroll:!0});else{let t=Ei(e);e.focus(),Ri(t)}}let Rt=null;function Ii(){if(Rt==null){Rt=!1;try{document.createElement("div").focus({get preventScroll(){return Rt=!0,!0}})}catch{}}return Rt}function Ei(e){let t=e.parentNode,s=[],n=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==n;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&s.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return n instanceof HTMLElement&&s.push({element:n,scrollTop:n.scrollTop,scrollLeft:n.scrollLeft}),s}function Ri(e){for(let{element:t,scrollTop:s,scrollLeft:n}of e)t.scrollTop=s,t.scrollLeft=n}const Te=e=>e?.ownerDocument??document,Ee=e=>e&&"window"in e&&e.window===e?e:Te(e).defaultView||window;function Mi(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function Ai(e){return Mi(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let $i=!1;function ma(){return $i}function be(e,t){if(!ma())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let s=t;for(;s!==null;){if(s===e)return!0;s.tagName==="SLOT"&&s.assignedSlot?s=s.assignedSlot.parentNode:Ai(s)?s=s.host:s=s.parentNode}return!1}function Z(e){if(ma()&&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 Li=typeof Element<"u"&&"checkVisibility"in Element.prototype;function Pi(e){const t=Ee(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:s,visibility:n}=e.style,r=s!=="none"&&n!=="hidden"&&n!=="collapse";if(r){const{getComputedStyle:o}=Ee(e);let{display:i,visibility:c}=o(e);r=i!=="none"&&c!=="hidden"&&c!=="collapse"}return r}function Di(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 pa(e,t){return Li?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):e.nodeName!=="#comment"&&Pi(e)&&Di(e,t)&&(!e.parentElement||pa(e.parentElement,e))}const ha=["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"],Fi=ha.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";ha.push('[tabindex]:not([tabindex="-1"]):not([disabled])');function Oi(e,t){return e.matches(Fi)&&!zi(e)&&(t?.skipVisibilityCheck||pa(e))}function zi(e){let t=e;for(;t!=null;){if(t instanceof Ee(t).HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}const Is=typeof document<"u"?ys.useLayoutEffect:()=>{};function _i(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Ui(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Bi(e){for(;e&&!Oi(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=Ee(e),s=t.document.activeElement;if(!s||s===e)return;let n=!1,r=g=>{(Z(g)===s||n)&&g.stopImmediatePropagation()},o=g=>{(Z(g)===s||n)&&(g.stopImmediatePropagation(),!e&&!n&&(n=!0,pt(s),d()))},i=g=>{(Z(g)===e||n)&&g.stopImmediatePropagation()},c=g=>{(Z(g)===e||n)&&(g.stopImmediatePropagation(),n||(n=!0,pt(s),d()))};t.addEventListener("blur",r,!0),t.addEventListener("focusout",o,!0),t.addEventListener("focusin",c,!0),t.addEventListener("focus",i,!0);let d=()=>{cancelAnimationFrame(b),t.removeEventListener("blur",r,!0),t.removeEventListener("focusout",o,!0),t.removeEventListener("focusin",c,!0),t.removeEventListener("focus",i,!0),n=!1},b=requestAnimationFrame(d);return d}function Bt(e){if(typeof window>"u"||window.navigator==null)return!1;let t=window.navigator.userAgentData?.brands;return Array.isArray(t)&&t.some(s=>e.test(s.brand))||e.test(window.navigator.userAgent)}function Es(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}function Ae(e){let t=null;return()=>(t==null&&(t=e()),t)}const $t=Ae(function(){return Es(/^Mac/i)}),Ki=Ae(function(){return Es(/^iPhone/i)}),ga=Ae(function(){return Es(/^iPad/i)||$t()&&navigator.maxTouchPoints>1}),ba=Ae(function(){return Ki()||ga()}),qi=Ae(function(){return Bt(/AppleWebKit/i)&&!Qi()}),Qi=Ae(function(){return Bt(/Chrome/i)}),xa=Ae(function(){return Bt(/Android/i)}),Hi=Ae(function(){return Bt(/Firefox/i)});function Gi(e){return e.pointerType===""&&e.isTrusted?!0:xa()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Vi(e){return!xa()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"}function ht(e,t,s=!0){let{metaKey:n,ctrlKey:r,altKey:o,shiftKey:i}=t;Hi()&&window.event?.type?.startsWith("key")&&e.target==="_blank"&&($t()?n=!0:r=!0);let c=qi()&&$t()&&!ga()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:n,ctrlKey:r,altKey:o,shiftKey:i}):new MouseEvent("click",{metaKey:n,ctrlKey:r,altKey:o,shiftKey:i,detail:1,bubbles:!0,cancelable:!0});ht.isOpening=s,pt(e),e.dispatchEvent(c),ht.isOpening=!1}ht.isOpening=!1;let Ne=new Map,ds=new Set;function nn(){if(typeof window>"u")return;function e(n){return"propertyName"in n}let t=n=>{let r=Z(n);if(!e(n)||!r)return;let o=Ne.get(r);o||(o=new Set,Ne.set(r,o),r.addEventListener("transitioncancel",s,{once:!0})),o.add(n.propertyName)},s=n=>{let r=Z(n);if(!e(n)||!r)return;let o=Ne.get(r);if(o&&(o.delete(n.propertyName),o.size===0&&(r.removeEventListener("transitioncancel",s),Ne.delete(r)),Ne.size===0)){for(let i of ds)i();ds.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",s)}typeof document<"u"&&(document.readyState!=="loading"?nn():document.addEventListener("DOMContentLoaded",nn));function Wi(){for(const[e]of Ne)"isConnected"in e&&!e.isConnected&&Ne.delete(e)}function Yi(e){requestAnimationFrame(()=>{Wi(),Ne.size===0?e():ds.add(e)})}function va(...e){return(...t)=>{for(let s of e)typeof s=="function"&&s(...t)}}let us=new Map;typeof FinalizationRegistry<"u"&&new FinalizationRegistry(e=>{us.delete(e)});function Ji(e,t){if(e===t)return e;let s=us.get(e);if(s)return s.forEach(r=>r.current=t),t;let n=us.get(t);return n?(n.forEach(r=>r.current=e),e):t}function Xi(...e){return e.length===1&&e[0]?e[0]:t=>{let s=!1;const n=e.map(r=>{const o=an(r,t);return s||=typeof o=="function",o});if(s)return()=>{n.forEach((r,o)=>{typeof r=="function"?r():an(e[o],null)})}}}function an(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function jt(...e){let t={...e[0]};for(let s=1;s<e.length;s++){let n=e[s];for(let r in n){let o=t[r],i=n[r];typeof o=="function"&&typeof i=="function"&&r[0]==="o"&&r[1]==="n"&&r.charCodeAt(2)>=65&&r.charCodeAt(2)<=90?t[r]=va(o,i):(r==="className"||r==="UNSAFE_className")&&typeof o=="string"&&typeof i=="string"?t[r]=xr(o,i):r==="id"&&o&&i?t.id=Ji(o,i):r==="ref"&&o&&i?t.ref=Xi(o,i):t[r]=i!==void 0?i:o}}return t}function Zi(e,t){Is(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}const el=ys.useInsertionEffect??Is;function ts(e){const t=l.useRef(null);return el(()=>{t.current=e},[e]),l.useCallback((...s)=>{const n=t.current;return n?.(...s)},[])}let Ve="default",fs="",At=new WeakMap;function tl(e){if(ba()){if(Ve==="default"){const t=Te(e);fs=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect="none"}Ve="disabled"}else if(e instanceof HTMLElement||e instanceof SVGElement){let t="userSelect"in e.style?"userSelect":"webkitUserSelect";At.set(e,e.style[t]),e.style[t]="none"}}function rn(e){if(ba()){if(Ve!=="disabled")return;Ve="restoring",setTimeout(()=>{Yi(()=>{if(Ve==="restoring"){const t=Te(e);t.documentElement.style.webkitUserSelect==="none"&&(t.documentElement.style.webkitUserSelect=fs||""),fs="",Ve="default"}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&At.has(e)){let t=At.get(e),s="userSelect"in e.style?"userSelect":"webkitUserSelect";e.style[s]==="none"&&(e.style[s]=t),e.getAttribute("style")===""&&e.removeAttribute("style"),At.delete(e)}}function on(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let ss=new WeakMap;function sl(e){let t=e??(typeof document<"u"?document:void 0);if(!t)return on(t);if(ss.has(t))return ss.get(t);let s=t.querySelector('meta[property="csp-nonce"]'),n=s&&s instanceof Ee(s).HTMLMetaElement&&(s.nonce||s.content)||on(t)||void 0;return n!==void 0&&ss.set(t,n),n}const ya=ys.createContext({register:()=>{}});ya.displayName="PressResponderContext";function ka(){let e=l.useRef(new Map),t=l.useCallback((r,o,i,c)=>{let d=c?.once?(...b)=>{e.current.delete(i),i(...b)}:i;e.current.set(i,{type:o,eventTarget:r,fn:d,options:c}),r.addEventListener(o,d,c)},[]),s=l.useCallback((r,o,i,c)=>{let d=e.current.get(i)?.fn||i;r.removeEventListener(o,d,c),e.current.delete(i)},[]),n=l.useCallback(()=>{e.current.forEach((r,o)=>{s(r.eventTarget,r.type,o,r.options)})},[s]);return l.useEffect(()=>n,[n]),{addGlobalListener:t,removeGlobalListener:s,removeAllGlobalListeners:n}}function nl(e){let t=l.useContext(ya);if(t){let{register:s,ref:n,...r}=t;e=jt(r,e),s()}return Zi(t,e.ref),e}class Mt{#e;constructor(t,s,n,r){this.#e=!0;const i=(r?.target??n.currentTarget)?.getBoundingClientRect();let c,d=0,b,g=null;n.clientX!=null&&n.clientY!=null&&(b=n.clientX,g=n.clientY),i&&(b!=null&&g!=null?(c=b-i.left,d=g-i.top):(c=i.width/2,d=i.height/2)),this.type=t,this.pointerType=s,this.target=n.currentTarget,this.shiftKey=n.shiftKey,this.metaKey=n.metaKey,this.ctrlKey=n.ctrlKey,this.altKey=n.altKey,this.x=c,this.y=d,this.key=n.key}continuePropagation(){this.#e=!1}get shouldStopPropagation(){return this.#e}}const ln=Symbol("linkClicked"),cn="react-aria-pressable-style",dn="data-react-aria-pressable";function al(e){let{onPress:t,onPressChange:s,onPressStart:n,onPressEnd:r,onPressUp:o,onClick:i,isDisabled:c,isPressed:d,preventFocusOnPress:b,shouldCancelOnPointerExit:g,allowTextSelectionOnPress:v,ref:p,...x}=nl(e),[f,u]=l.useState(!1),m=l.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:h,removeAllGlobalListeners:S}=ka(),y=l.useCallback((k,I)=>{let R=m.current;if(c||R.didFirePressStart)return!1;let j=!0;if(R.isTriggeringEvent=!0,n){let M=new Mt("pressstart",I,k);n(M),j=M.shouldStopPropagation}return s&&s(!0),R.isTriggeringEvent=!1,R.didFirePressStart=!0,u(!0),j},[c,n,s]),w=l.useCallback((k,I,R=!0)=>{let j=m.current;if(!j.didFirePressStart)return!1;j.didFirePressStart=!1,j.isTriggeringEvent=!0;let M=!0;if(r){let C=new Mt("pressend",I,k);r(C),M=C.shouldStopPropagation}if(s&&s(!1),u(!1),t&&R&&!c){let C=new Mt("press",I,k);t(C),M&&=C.shouldStopPropagation}return j.isTriggeringEvent=!1,M},[c,r,s,t]),N=ts(w),E=l.useCallback((k,I)=>{let R=m.current;if(c)return!1;if(o){R.isTriggeringEvent=!0;let j=new Mt("pressup",I,k);return o(j),R.isTriggeringEvent=!1,j.shouldStopPropagation}return!0},[c,o]),P=ts(E),z=l.useCallback(k=>{let I=m.current;if(I.isPressed&&I.target){I.didFirePressStart&&I.pointerType!=null&&w(De(I.target,k),I.pointerType,!1),I.isPressed=!1,I.isOverTarget=!1,I.activePointerId=null,I.pointerType=null,S(),v||rn(I.target);for(let R of I.disposables)R();I.disposables=[]}},[v,S,w]),U=ts(z);l.useEffect(()=>{c&&m.current.isPressed&&U({currentTarget:m.current.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})},[c]);let L=l.useCallback(k=>{g&&z(k)},[g,z]),D=l.useCallback(k=>{c||i?.(k)},[c,i]),F=l.useCallback((k,I)=>{if(!c&&i){let R=new MouseEvent("click",k);Ui(R,I),i(_i(R))}},[c,i]),O=l.useMemo(()=>{let k=m.current,I={onKeyDown(j){if(ns(j.nativeEvent,j.currentTarget)&&be(j.currentTarget,Z(j))){un(Z(j),j.key)&&j.preventDefault();let M=!0;!k.isPressed&&!j.repeat&&(k.target=j.currentTarget,k.isPressed=!0,k.pointerType="keyboard",M=y(j,"keyboard"));let C=j.currentTarget,K=$=>{ns($,C)&&!$.repeat&&be(C,Z($))&&k.target&&P(De(k.target,$),"keyboard")};h(Te(j.currentTarget),"keyup",va(K,R),!0),M&&j.stopPropagation(),j.metaKey&&$t()&&k.metaKeyEvents?.set(j.key,j.nativeEvent)}else j.key==="Meta"&&(k.metaKeyEvents=new Map)},onClick(j){if(!(j&&!be(j.currentTarget,Z(j)))&&j&&j.button===0&&!k.isTriggeringEvent&&!ht.isOpening){let M=!0;if(c&&j.preventDefault(),!k.ignoreEmulatedMouseEvents&&!k.isPressed&&(k.pointerType==="virtual"||Gi(j.nativeEvent))){let C=y(j,"virtual"),K=P(j,"virtual"),$=N(j,"virtual");D(j),M=C&&K&&$}else if(k.isPressed&&k.pointerType!=="keyboard"){let C=k.pointerType||j.nativeEvent.pointerType||"virtual",K=P(De(j.currentTarget,j),C),$=N(De(j.currentTarget,j),C,!0);M=K&&$,k.isOverTarget=!1,D(j),U(j)}k.ignoreEmulatedMouseEvents=!1,M&&j.stopPropagation()}}},R=j=>{if(k.isPressed&&k.target&&ns(j,k.target)){un(Z(j),j.key)&&j.preventDefault();let M=Z(j),C=be(k.target,M);N(De(k.target,j),"keyboard",C),C&&F(j,k.target),S(),j.key!=="Enter"&&Rs(k.target)&&be(k.target,M)&&!j[ln]&&(j[ln]=!0,ht(k.target,j,!1)),k.isPressed=!1,k.metaKeyEvents?.delete(j.key)}else if(j.key==="Meta"&&k.metaKeyEvents?.size){let M=k.metaKeyEvents;k.metaKeyEvents=void 0;for(let C of M.values())k.target?.dispatchEvent(new KeyboardEvent("keyup",C))}};if(typeof PointerEvent<"u"){I.onPointerDown=C=>{if(C.button!==0||!be(C.currentTarget,Z(C)))return;if(Vi(C.nativeEvent)){k.pointerType="virtual";return}k.pointerType=C.pointerType;let K=!0;if(!k.isPressed){k.isPressed=!0,k.isOverTarget=!0,k.activePointerId=C.pointerId,k.target=C.currentTarget,v||tl(k.target),K=y(C,k.pointerType);let $=Z(C);"releasePointerCapture"in $&&("hasPointerCapture"in $?$.hasPointerCapture(C.pointerId)&&$.releasePointerCapture(C.pointerId):$.releasePointerCapture(C.pointerId)),h(Te(C.currentTarget),"pointerup",j,!1),h(Te(C.currentTarget),"pointercancel",M,!1)}K&&C.stopPropagation()},I.onMouseDown=C=>{if(be(C.currentTarget,Z(C))&&C.button===0){if(b){let K=Bi(C.target);K&&k.disposables.push(K)}C.stopPropagation()}},I.onPointerUp=C=>{!be(C.currentTarget,Z(C))||k.pointerType==="virtual"||C.button===0&&!k.isPressed&&P(C,k.pointerType||C.pointerType)},I.onPointerEnter=C=>{C.pointerId===k.activePointerId&&k.target&&!k.isOverTarget&&k.pointerType!=null&&(k.isOverTarget=!0,y(De(k.target,C),k.pointerType))},I.onPointerLeave=C=>{C.pointerId===k.activePointerId&&k.target&&k.isOverTarget&&k.pointerType!=null&&(k.isOverTarget=!1,N(De(k.target,C),k.pointerType,!1),L(C))};let j=C=>{if(C.pointerId===k.activePointerId&&k.isPressed&&C.button===0&&k.target){if(be(k.target,Z(C))&&k.pointerType!=null){let K=!1,$=setTimeout(()=>{k.isPressed&&k.target instanceof HTMLElement&&(K?U(C):(pt(k.target),k.target.click()))},80);h(C.currentTarget,"click",()=>K=!0,!0),k.disposables.push(()=>clearTimeout($))}else U(C);k.isOverTarget=!1}},M=C=>{U(C)};I.onDragStart=C=>{be(C.currentTarget,Z(C))&&U(C)}}return I},[h,c,b,S,v,L,y,D,F]);return l.useEffect(()=>{if(!p)return;const k=Te(p.current);if(!k||!k.head||k.getElementById(cn))return;const I=k.createElement("style");I.id=cn;let R=sl(k);R&&(I.nonce=R),I.textContent=`
|
|
1
|
+
import{ar as ys,cR as xr,r as l,e as de,j as a,Y as ft,Z as Bn,f as V,X as Dt,g as Ie,cS as Kn,t as _,W as Je,V as Ye,be as vr,cT as yr,cU as kr,aA as Ft,a2 as Ot,cV as qn,bu as ks,cW as wr,cX as Qn,aH as jr,L as Hn,_ as Cr,cY as Sr,B as Gn,cZ as Nr,c_ as Tr,c$ as Ir,d0 as Er,d1 as Rr,d2 as Mr,d3 as Ar,d4 as $r,w as Lr,c as ee,d as bt,G as xt,d5 as Pr,d6 as Dr,d7 as zt,h as ie,as as xe,i as me,N as Xe,cu as Re,d8 as _t,cl as Fr,d9 as Me,da as Or,db as Ws,dc as zr,dd as _r,de as Ur,b3 as Br,cc as Kr,cJ as ws,cK as Vn,df as qr,bc as js,ab as Qr,bf as Wn,b9 as Yn,bg as Jn,aV as Xn,E as Cs,bh as Hr,aY as Gr,aZ as Vr,cz as Wr,dg as Yr,aa as Zn,cy as Jr,dh as Xr,di as Zr,dj as ea,dk as eo,cO as to,bF as Ss,dl as so,dm as Ys,dn as no,dp as es,dq as ao,bE as ro,Q as oo,q as io,ag as ta,F as lo,cQ as Js,bo as co,dr as uo,ds as fo,au as Xs,cM as mo,dt as po,ah as ho,ca as go,cb as bo,du as xo,C as Ut,dv as vo,dw as yo,dx as Zs,dy as ko,dz as wo,dA as jo,v as sa,dB as Ns,cN as ke,dC as Co,cd as So,c8 as No,dD as To,dE as en,a1 as Io,ce as Eo}from"./index-DMZ8-zZM.js";import{m as Ro,S as na,i as we,t as je,r as vt,n as yt,o as kt,p as wt,q as Mo,h as Ao,d as $o,D as Lo,b as It,a as Po,v as Do,w as Fo,x as lt,e as Oo,y as zo,z as _o,u as Uo}from"./search-token-index-BQBAjCB1.js";import{K as Bo}from"./kbd-BV5q0Za-.js";import{P as aa,f as Ko,U as qo,a as Qo,E as Ho,s as Go}from"./attachment-file-QQZovKAl.js";import{M as Vo}from"./mail-Bff0HSL7.js";import{A as mt}from"./avatar-klLMB_Me.js";import{M as Wo,a as Yo,b as ra,c as Jo,s as oa,d as ia,e as Xo,f as Zo,S as tn,g as la,u as ca,p as ei,r as ti}from"./useSearchTokenContext-DohJINg2.js";import{C as si,D as He,u as ni}from"./index-RbY7Dn0X.js";import{E as da}from"./EmptyState-CegqC3j2.js";import{E as Oe}from"./ErrorState-BGolGYcc.js";import{e as ua,b as Ze,a as ai,g as ri,c as ze,h as oi,d as ii}from"./format-RgJz8yFq.js";import{D as li}from"./download-DdbznPAS.js";import{g as ci}from"./useMessageBodyContent-DxQjkGza.js";import{B as di,b as ui,u as fi,i as mi}from"./useLayoutTier-DKpSXts5.js";import{S as pi}from"./shield-check-BM5CxZVS.js";import{u as fa}from"./useDebouncedValue-BBOZojyy.js";import{h as sn,u as hi,a as gi,i as bi,n as xi,o as vi,j as yi,k as ki,S as wi}from"./useFilters-D8luT8sB.js";import{u as Ts}from"./useQueries-Baii11SK.js";import{M as ji}from"./minus-DTWvP8bv.js";import{C as Et}from"./confirm-dialog-PyqpaetG.js";import{C as Ci}from"./clock-CV2mIEQ0.js";import{r as Si,a as Ni}from"./search-scope-B5-OK3Cq.js";import{M as Ti}from"./menu-DqCvhoo6.js";function pt(e){if(Ii())e.focus({preventScroll:!0});else{let t=Ei(e);e.focus(),Ri(t)}}let Rt=null;function Ii(){if(Rt==null){Rt=!1;try{document.createElement("div").focus({get preventScroll(){return Rt=!0,!0}})}catch{}}return Rt}function Ei(e){let t=e.parentNode,s=[],n=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==n;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&s.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return n instanceof HTMLElement&&s.push({element:n,scrollTop:n.scrollTop,scrollLeft:n.scrollLeft}),s}function Ri(e){for(let{element:t,scrollTop:s,scrollLeft:n}of e)t.scrollTop=s,t.scrollLeft=n}const Te=e=>e?.ownerDocument??document,Ee=e=>e&&"window"in e&&e.window===e?e:Te(e).defaultView||window;function Mi(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function Ai(e){return Mi(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let $i=!1;function ma(){return $i}function be(e,t){if(!ma())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let s=t;for(;s!==null;){if(s===e)return!0;s.tagName==="SLOT"&&s.assignedSlot?s=s.assignedSlot.parentNode:Ai(s)?s=s.host:s=s.parentNode}return!1}function Z(e){if(ma()&&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 Li=typeof Element<"u"&&"checkVisibility"in Element.prototype;function Pi(e){const t=Ee(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:s,visibility:n}=e.style,r=s!=="none"&&n!=="hidden"&&n!=="collapse";if(r){const{getComputedStyle:o}=Ee(e);let{display:i,visibility:c}=o(e);r=i!=="none"&&c!=="hidden"&&c!=="collapse"}return r}function Di(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 pa(e,t){return Li?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):e.nodeName!=="#comment"&&Pi(e)&&Di(e,t)&&(!e.parentElement||pa(e.parentElement,e))}const ha=["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"],Fi=ha.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";ha.push('[tabindex]:not([tabindex="-1"]):not([disabled])');function Oi(e,t){return e.matches(Fi)&&!zi(e)&&(t?.skipVisibilityCheck||pa(e))}function zi(e){let t=e;for(;t!=null;){if(t instanceof Ee(t).HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}const Is=typeof document<"u"?ys.useLayoutEffect:()=>{};function _i(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Ui(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Bi(e){for(;e&&!Oi(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=Ee(e),s=t.document.activeElement;if(!s||s===e)return;let n=!1,r=g=>{(Z(g)===s||n)&&g.stopImmediatePropagation()},o=g=>{(Z(g)===s||n)&&(g.stopImmediatePropagation(),!e&&!n&&(n=!0,pt(s),d()))},i=g=>{(Z(g)===e||n)&&g.stopImmediatePropagation()},c=g=>{(Z(g)===e||n)&&(g.stopImmediatePropagation(),n||(n=!0,pt(s),d()))};t.addEventListener("blur",r,!0),t.addEventListener("focusout",o,!0),t.addEventListener("focusin",c,!0),t.addEventListener("focus",i,!0);let d=()=>{cancelAnimationFrame(b),t.removeEventListener("blur",r,!0),t.removeEventListener("focusout",o,!0),t.removeEventListener("focusin",c,!0),t.removeEventListener("focus",i,!0),n=!1},b=requestAnimationFrame(d);return d}function Bt(e){if(typeof window>"u"||window.navigator==null)return!1;let t=window.navigator.userAgentData?.brands;return Array.isArray(t)&&t.some(s=>e.test(s.brand))||e.test(window.navigator.userAgent)}function Es(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}function Ae(e){let t=null;return()=>(t==null&&(t=e()),t)}const $t=Ae(function(){return Es(/^Mac/i)}),Ki=Ae(function(){return Es(/^iPhone/i)}),ga=Ae(function(){return Es(/^iPad/i)||$t()&&navigator.maxTouchPoints>1}),ba=Ae(function(){return Ki()||ga()}),qi=Ae(function(){return Bt(/AppleWebKit/i)&&!Qi()}),Qi=Ae(function(){return Bt(/Chrome/i)}),xa=Ae(function(){return Bt(/Android/i)}),Hi=Ae(function(){return Bt(/Firefox/i)});function Gi(e){return e.pointerType===""&&e.isTrusted?!0:xa()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Vi(e){return!xa()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"}function ht(e,t,s=!0){let{metaKey:n,ctrlKey:r,altKey:o,shiftKey:i}=t;Hi()&&window.event?.type?.startsWith("key")&&e.target==="_blank"&&($t()?n=!0:r=!0);let c=qi()&&$t()&&!ga()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:n,ctrlKey:r,altKey:o,shiftKey:i}):new MouseEvent("click",{metaKey:n,ctrlKey:r,altKey:o,shiftKey:i,detail:1,bubbles:!0,cancelable:!0});ht.isOpening=s,pt(e),e.dispatchEvent(c),ht.isOpening=!1}ht.isOpening=!1;let Ne=new Map,ds=new Set;function nn(){if(typeof window>"u")return;function e(n){return"propertyName"in n}let t=n=>{let r=Z(n);if(!e(n)||!r)return;let o=Ne.get(r);o||(o=new Set,Ne.set(r,o),r.addEventListener("transitioncancel",s,{once:!0})),o.add(n.propertyName)},s=n=>{let r=Z(n);if(!e(n)||!r)return;let o=Ne.get(r);if(o&&(o.delete(n.propertyName),o.size===0&&(r.removeEventListener("transitioncancel",s),Ne.delete(r)),Ne.size===0)){for(let i of ds)i();ds.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",s)}typeof document<"u"&&(document.readyState!=="loading"?nn():document.addEventListener("DOMContentLoaded",nn));function Wi(){for(const[e]of Ne)"isConnected"in e&&!e.isConnected&&Ne.delete(e)}function Yi(e){requestAnimationFrame(()=>{Wi(),Ne.size===0?e():ds.add(e)})}function va(...e){return(...t)=>{for(let s of e)typeof s=="function"&&s(...t)}}let us=new Map;typeof FinalizationRegistry<"u"&&new FinalizationRegistry(e=>{us.delete(e)});function Ji(e,t){if(e===t)return e;let s=us.get(e);if(s)return s.forEach(r=>r.current=t),t;let n=us.get(t);return n?(n.forEach(r=>r.current=e),e):t}function Xi(...e){return e.length===1&&e[0]?e[0]:t=>{let s=!1;const n=e.map(r=>{const o=an(r,t);return s||=typeof o=="function",o});if(s)return()=>{n.forEach((r,o)=>{typeof r=="function"?r():an(e[o],null)})}}}function an(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function jt(...e){let t={...e[0]};for(let s=1;s<e.length;s++){let n=e[s];for(let r in n){let o=t[r],i=n[r];typeof o=="function"&&typeof i=="function"&&r[0]==="o"&&r[1]==="n"&&r.charCodeAt(2)>=65&&r.charCodeAt(2)<=90?t[r]=va(o,i):(r==="className"||r==="UNSAFE_className")&&typeof o=="string"&&typeof i=="string"?t[r]=xr(o,i):r==="id"&&o&&i?t.id=Ji(o,i):r==="ref"&&o&&i?t.ref=Xi(o,i):t[r]=i!==void 0?i:o}}return t}function Zi(e,t){Is(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}const el=ys.useInsertionEffect??Is;function ts(e){const t=l.useRef(null);return el(()=>{t.current=e},[e]),l.useCallback((...s)=>{const n=t.current;return n?.(...s)},[])}let Ve="default",fs="",At=new WeakMap;function tl(e){if(ba()){if(Ve==="default"){const t=Te(e);fs=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect="none"}Ve="disabled"}else if(e instanceof HTMLElement||e instanceof SVGElement){let t="userSelect"in e.style?"userSelect":"webkitUserSelect";At.set(e,e.style[t]),e.style[t]="none"}}function rn(e){if(ba()){if(Ve!=="disabled")return;Ve="restoring",setTimeout(()=>{Yi(()=>{if(Ve==="restoring"){const t=Te(e);t.documentElement.style.webkitUserSelect==="none"&&(t.documentElement.style.webkitUserSelect=fs||""),fs="",Ve="default"}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&At.has(e)){let t=At.get(e),s="userSelect"in e.style?"userSelect":"webkitUserSelect";e.style[s]==="none"&&(e.style[s]=t),e.getAttribute("style")===""&&e.removeAttribute("style"),At.delete(e)}}function on(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let ss=new WeakMap;function sl(e){let t=e??(typeof document<"u"?document:void 0);if(!t)return on(t);if(ss.has(t))return ss.get(t);let s=t.querySelector('meta[property="csp-nonce"]'),n=s&&s instanceof Ee(s).HTMLMetaElement&&(s.nonce||s.content)||on(t)||void 0;return n!==void 0&&ss.set(t,n),n}const ya=ys.createContext({register:()=>{}});ya.displayName="PressResponderContext";function ka(){let e=l.useRef(new Map),t=l.useCallback((r,o,i,c)=>{let d=c?.once?(...b)=>{e.current.delete(i),i(...b)}:i;e.current.set(i,{type:o,eventTarget:r,fn:d,options:c}),r.addEventListener(o,d,c)},[]),s=l.useCallback((r,o,i,c)=>{let d=e.current.get(i)?.fn||i;r.removeEventListener(o,d,c),e.current.delete(i)},[]),n=l.useCallback(()=>{e.current.forEach((r,o)=>{s(r.eventTarget,r.type,o,r.options)})},[s]);return l.useEffect(()=>n,[n]),{addGlobalListener:t,removeGlobalListener:s,removeAllGlobalListeners:n}}function nl(e){let t=l.useContext(ya);if(t){let{register:s,ref:n,...r}=t;e=jt(r,e),s()}return Zi(t,e.ref),e}class Mt{#e;constructor(t,s,n,r){this.#e=!0;const i=(r?.target??n.currentTarget)?.getBoundingClientRect();let c,d=0,b,g=null;n.clientX!=null&&n.clientY!=null&&(b=n.clientX,g=n.clientY),i&&(b!=null&&g!=null?(c=b-i.left,d=g-i.top):(c=i.width/2,d=i.height/2)),this.type=t,this.pointerType=s,this.target=n.currentTarget,this.shiftKey=n.shiftKey,this.metaKey=n.metaKey,this.ctrlKey=n.ctrlKey,this.altKey=n.altKey,this.x=c,this.y=d,this.key=n.key}continuePropagation(){this.#e=!1}get shouldStopPropagation(){return this.#e}}const ln=Symbol("linkClicked"),cn="react-aria-pressable-style",dn="data-react-aria-pressable";function al(e){let{onPress:t,onPressChange:s,onPressStart:n,onPressEnd:r,onPressUp:o,onClick:i,isDisabled:c,isPressed:d,preventFocusOnPress:b,shouldCancelOnPointerExit:g,allowTextSelectionOnPress:v,ref:p,...x}=nl(e),[f,u]=l.useState(!1),m=l.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:h,removeAllGlobalListeners:S}=ka(),y=l.useCallback((k,I)=>{let R=m.current;if(c||R.didFirePressStart)return!1;let j=!0;if(R.isTriggeringEvent=!0,n){let M=new Mt("pressstart",I,k);n(M),j=M.shouldStopPropagation}return s&&s(!0),R.isTriggeringEvent=!1,R.didFirePressStart=!0,u(!0),j},[c,n,s]),w=l.useCallback((k,I,R=!0)=>{let j=m.current;if(!j.didFirePressStart)return!1;j.didFirePressStart=!1,j.isTriggeringEvent=!0;let M=!0;if(r){let C=new Mt("pressend",I,k);r(C),M=C.shouldStopPropagation}if(s&&s(!1),u(!1),t&&R&&!c){let C=new Mt("press",I,k);t(C),M&&=C.shouldStopPropagation}return j.isTriggeringEvent=!1,M},[c,r,s,t]),N=ts(w),E=l.useCallback((k,I)=>{let R=m.current;if(c)return!1;if(o){R.isTriggeringEvent=!0;let j=new Mt("pressup",I,k);return o(j),R.isTriggeringEvent=!1,j.shouldStopPropagation}return!0},[c,o]),P=ts(E),z=l.useCallback(k=>{let I=m.current;if(I.isPressed&&I.target){I.didFirePressStart&&I.pointerType!=null&&w(De(I.target,k),I.pointerType,!1),I.isPressed=!1,I.isOverTarget=!1,I.activePointerId=null,I.pointerType=null,S(),v||rn(I.target);for(let R of I.disposables)R();I.disposables=[]}},[v,S,w]),U=ts(z);l.useEffect(()=>{c&&m.current.isPressed&&U({currentTarget:m.current.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})},[c]);let L=l.useCallback(k=>{g&&z(k)},[g,z]),D=l.useCallback(k=>{c||i?.(k)},[c,i]),F=l.useCallback((k,I)=>{if(!c&&i){let R=new MouseEvent("click",k);Ui(R,I),i(_i(R))}},[c,i]),O=l.useMemo(()=>{let k=m.current,I={onKeyDown(j){if(ns(j.nativeEvent,j.currentTarget)&&be(j.currentTarget,Z(j))){un(Z(j),j.key)&&j.preventDefault();let M=!0;!k.isPressed&&!j.repeat&&(k.target=j.currentTarget,k.isPressed=!0,k.pointerType="keyboard",M=y(j,"keyboard"));let C=j.currentTarget,K=$=>{ns($,C)&&!$.repeat&&be(C,Z($))&&k.target&&P(De(k.target,$),"keyboard")};h(Te(j.currentTarget),"keyup",va(K,R),!0),M&&j.stopPropagation(),j.metaKey&&$t()&&k.metaKeyEvents?.set(j.key,j.nativeEvent)}else j.key==="Meta"&&(k.metaKeyEvents=new Map)},onClick(j){if(!(j&&!be(j.currentTarget,Z(j)))&&j&&j.button===0&&!k.isTriggeringEvent&&!ht.isOpening){let M=!0;if(c&&j.preventDefault(),!k.ignoreEmulatedMouseEvents&&!k.isPressed&&(k.pointerType==="virtual"||Gi(j.nativeEvent))){let C=y(j,"virtual"),K=P(j,"virtual"),$=N(j,"virtual");D(j),M=C&&K&&$}else if(k.isPressed&&k.pointerType!=="keyboard"){let C=k.pointerType||j.nativeEvent.pointerType||"virtual",K=P(De(j.currentTarget,j),C),$=N(De(j.currentTarget,j),C,!0);M=K&&$,k.isOverTarget=!1,D(j),U(j)}k.ignoreEmulatedMouseEvents=!1,M&&j.stopPropagation()}}},R=j=>{if(k.isPressed&&k.target&&ns(j,k.target)){un(Z(j),j.key)&&j.preventDefault();let M=Z(j),C=be(k.target,M);N(De(k.target,j),"keyboard",C),C&&F(j,k.target),S(),j.key!=="Enter"&&Rs(k.target)&&be(k.target,M)&&!j[ln]&&(j[ln]=!0,ht(k.target,j,!1)),k.isPressed=!1,k.metaKeyEvents?.delete(j.key)}else if(j.key==="Meta"&&k.metaKeyEvents?.size){let M=k.metaKeyEvents;k.metaKeyEvents=void 0;for(let C of M.values())k.target?.dispatchEvent(new KeyboardEvent("keyup",C))}};if(typeof PointerEvent<"u"){I.onPointerDown=C=>{if(C.button!==0||!be(C.currentTarget,Z(C)))return;if(Vi(C.nativeEvent)){k.pointerType="virtual";return}k.pointerType=C.pointerType;let K=!0;if(!k.isPressed){k.isPressed=!0,k.isOverTarget=!0,k.activePointerId=C.pointerId,k.target=C.currentTarget,v||tl(k.target),K=y(C,k.pointerType);let $=Z(C);"releasePointerCapture"in $&&("hasPointerCapture"in $?$.hasPointerCapture(C.pointerId)&&$.releasePointerCapture(C.pointerId):$.releasePointerCapture(C.pointerId)),h(Te(C.currentTarget),"pointerup",j,!1),h(Te(C.currentTarget),"pointercancel",M,!1)}K&&C.stopPropagation()},I.onMouseDown=C=>{if(be(C.currentTarget,Z(C))&&C.button===0){if(b){let K=Bi(C.target);K&&k.disposables.push(K)}C.stopPropagation()}},I.onPointerUp=C=>{!be(C.currentTarget,Z(C))||k.pointerType==="virtual"||C.button===0&&!k.isPressed&&P(C,k.pointerType||C.pointerType)},I.onPointerEnter=C=>{C.pointerId===k.activePointerId&&k.target&&!k.isOverTarget&&k.pointerType!=null&&(k.isOverTarget=!0,y(De(k.target,C),k.pointerType))},I.onPointerLeave=C=>{C.pointerId===k.activePointerId&&k.target&&k.isOverTarget&&k.pointerType!=null&&(k.isOverTarget=!1,N(De(k.target,C),k.pointerType,!1),L(C))};let j=C=>{if(C.pointerId===k.activePointerId&&k.isPressed&&C.button===0&&k.target){if(be(k.target,Z(C))&&k.pointerType!=null){let K=!1,$=setTimeout(()=>{k.isPressed&&k.target instanceof HTMLElement&&(K?U(C):(pt(k.target),k.target.click()))},80);h(C.currentTarget,"click",()=>K=!0,!0),k.disposables.push(()=>clearTimeout($))}else U(C);k.isOverTarget=!1}},M=C=>{U(C)};I.onDragStart=C=>{be(C.currentTarget,Z(C))&&U(C)}}return I},[h,c,b,S,v,L,y,D,F]);return l.useEffect(()=>{if(!p)return;const k=Te(p.current);if(!k||!k.head||k.getElementById(cn))return;const I=k.createElement("style");I.id=cn;let R=sl(k);R&&(I.nonce=R),I.textContent=`
|
|
2
2
|
@layer {
|
|
3
3
|
[${dn}] {
|
|
4
4
|
touch-action: pan-x pan-y pinch-zoom;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as D,r as h,U as ae,j as e,V as ne,W as G,t as N,Y as T,Z as V,_ as re,$ as J,a0 as ie,a1 as le,X as oe,a2 as ce,a3 as ue,a4 as de,a5 as xe,a6 as fe,I as me,a7 as he,a8 as ge,a9 as I,aa as pe,h as be,C as ve,ab as je,G as ye,c as Ne,ac as Se,ad as ke,ae as M,af as Ce,ag as w,ah as we,D as Oe,v as ze}from"./index-BoxiBjE8.js";import{C as Re}from"./calendar-days-BJ_20Jyk.js";import{B as Ae,a as Ie}from"./useLayoutTier-B31omesr.js";import{u as Ee}from"./useQueries-CYk5lp9G.js";import{i as Le}from"./outbox-status-BlKn6P0x.js";import{B as Fe}from"./bug-pEghc6tg.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);ae({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(ne,{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(Re,{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,U as ae,j as e,V as ne,W as G,t as N,Y as T,Z as V,_ as re,$ as J,a0 as ie,a1 as le,X as oe,a2 as ce,a3 as ue,a4 as de,a5 as xe,a6 as fe,I as me,a7 as he,a8 as ge,a9 as I,aa as pe,h as be,C as ve,ab as je,G as ye,c as Ne,ac as Se,ad as ke,ae as M,af as Ce,ag as w,ah as we,D as Oe,v as ze}from"./index-DMZ8-zZM.js";import{C as Re}from"./calendar-days-oK-1rKbM.js";import{B as Ae,a as Ie}from"./useLayoutTier-DKpSXts5.js";import{u as Ee}from"./useQueries-Baii11SK.js";import{i as Le}from"./outbox-status-BlKn6P0x.js";import{B as Fe}from"./bug-ECDjr3jW.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);ae({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(ne,{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(Re,{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{a9 as v,j as s,r as u,ak as l,al as p}from"./index-
|
|
1
|
+
import{a9 as v,j as s,r as u,ak as l,al as p}from"./index-DMZ8-zZM.js";import{F as x}from"./FullCompose-DqLTXvyP.js";import{a as m}from"./useMessageBodyContent-DxQjkGza.js";function S(o,n,r){if(o!==n)return r}function d(o,n){return o===""?"":n}function j({searchInput:o,committedQuery:n,urlQuery:r,pathname:t,listPath:a}){return!v(t,a)||n!==o?!1:n!==r}const c=u.createContext(null),C=({chrome:o,children:n})=>s.jsx(c.Provider,{value:o,children:n});function M({phone:o,list:n,reading:r,intelligence:t,hasThread:a=!1}){const e=u.useContext(c),f=m();if(!e)return s.jsx(l,{});const i={nav:e.nav,overlay:e.overlay,skeleton:s.jsx(l,{}),isLoading:e.isLoading,navOpen:e.navOpen,onOpenNav:e.onOpenNav,onCloseNav:e.onCloseNav};return e.isSinglePane?s.jsx(p,{...i,list:f?s.jsx(x,{}):o,intelligenceOpen:e.intelligenceOpen}):s.jsx(p,{...i,topBar:e.topBar,list:n,reading:r,intelligence:t,intelligenceOpen:e.intelligenceOpen,hasThread:a})}export{C as M,M as a,j as b,d as c,S as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,L as re,f as A,_ as ie,r as x,t as Q,aA as oe,a2 as ce,dF as le,U as de,dG as U,dH as ue,bT as fe,dI as me,dJ as xe,dK as ge,C as he,dL as pe,d1 as be}from"./index-BoxiBjE8.js";import{R as ve,m as je,A as we}from"./search-token-index-D-gWPAEk.js";import{a8 as Ne,a9 as ye,c as Pe,a as G,aa as Ce,s as Re,ab as ke,ac as Se,ad as Me,ae as Ee,af as Ie}from"./MailListHeader-DpqTxu9Y.js";import{A as ze}from"./avatar-CRolAGMx.js";import{M as Oe}from"./mail-zh2SRy5b.js";import{M as Le}from"./menu-DN5zpA0a.js";function _e(){return e.jsx("div",{className:"space-y-0",role:"status","aria-busy":"true","aria-label":"Loading messages",children:Array.from({length:8}).map((s,n)=>e.jsxs("div",{className:"animate-pulse border-b border-line px-3 py-2",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx("div",{className:"h-4 w-32 rounded bg-surface-sunken"}),e.jsx("div",{className:"h-3 w-16 rounded bg-surface-sunken"})]}),e.jsx("div",{className:"mb-2 h-4 w-48 rounded bg-surface-sunken"}),e.jsx("div",{className:"h-3 w-full rounded bg-surface-sunken"})]},n))})}function De({filter:s,scopeLabel:n,searchQuery:r}){const f=r?.trim();return s?e.jsxs(q,{children:[e.jsx("p",{className:"font-medium text-fg",children:Fe(s.label,n,f)}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:Te[s.reach]}),e.jsx(A,{variant:"secondary",size:"sm",className:"mt-4",onClick:s.onClear,children:"Clear filter"})]}):e.jsx(q,{children:e.jsx("p",{className:"text-fg-muted",children:Ae(f,n)})})}const Te={"whole-folder":"Every message in this folder was checked.","loaded-pages":"Only the messages loaded so far were checked."};function Ae(s,n){return s?"No messages match your search":n?`No messages in ${n}`:"No messages in this mailbox"}function Fe(s,n,r){return r?`No results for “${r}” in ${s}`:n?`No ${s} mail in ${n}`:`No ${s} mail`}function q({children:s}){return e.jsx("div",{className:"flex h-full flex-1 items-center justify-center",children:e.jsx("div",{className:"flex max-w-sm flex-col items-center justify-center p-8 text-center",children:s})})}function Ze(){return e.jsxs("div",{className:"flex items-center justify-center gap-2 py-4 text-sm text-fg-muted",role:"status","aria-live":"polite",children:[e.jsx(re,{className:"size-4 animate-spin","aria-hidden":"true"}),e.jsx("span",{children:"Loading more…"})]})}function $e({message:s="Something went wrong loading this mailbox.",onRetry:n,onReport:r}){return e.jsx("div",{className:"flex h-full flex-1 items-center justify-center p-4",children:e.jsxs("div",{role:"alert",className:"flex max-w-sm flex-col items-center justify-center gap-3 text-center",children:[e.jsx(ie,{className:"size-8 text-danger","aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-danger",children:"Couldn't load messages"}),e.jsx("p",{className:"mt-1 break-words text-sm text-fg-muted",children:s})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[n&&e.jsx(A,{variant:"secondary",size:"sm",onClick:n,children:"Retry"}),r&&e.jsx(A,{variant:"ghost",size:"sm",onClick:r,children:"Report a problem"})]})]})})}const z=72,J=10,He=z/2,V="__swipeableRowAxisCancel";function Z(s){return s==="leading"?z:s==="trailing"?-z:0}function Xe(s){return s>=z/2?"leading":s<=-z/2?"trailing":"none"}function Be({thread:s,selectionMode:n,checked:r,active:f,peek:m,onPeek:g,onToggleCheck:y,onLongPress:j,onOpen:h,onAct:p}){const u=x.useRef(null),[b,v]=x.useState(null),{longPressProps:P}=Ne({onLongPress:j,isDisabled:n,accessibilityDescription:"Select message"}),k=i=>{const o=new PointerEvent("pointercancel",{bubbles:!0});o[V]=!0,i.currentTarget.dispatchEvent(o)},a=ye(P,{onPointerDown:i=>{u.current={startX:i.clientX,startY:i.clientY,axis:"none",escaped:!1}},onPointerMove:i=>{if(n)return;const o=u.current;if(!o)return;const d=i.clientX-o.startX,M=i.clientY-o.startY;if(o.axis==="none"&&(Math.abs(M)>J&&Math.abs(M)>Math.abs(d)?o.axis="vertical":Math.abs(d)>J&&Math.abs(d)>Math.abs(M)&&(o.axis="horizontal",i.currentTarget.setPointerCapture(i.pointerId))),o.axis==="none")return;const O=o.axis==="horizontal"?Math.abs(d):Math.abs(M);if(!o.escaped&&O>He&&(o.escaped=!0,k(i)),o.axis!=="horizontal")return;const $=Z(m),H=Math.max(-z,Math.min(z,$+d));v(H)},onPointerUp:i=>{const o=u.current;u.current=null;const d=b;if(v(null),!!o){if(o.axis!=="none"&&!o.escaped&&k(i),o.axis==="horizontal"){d!==null&&g(Xe(d));return}if(o.axis!=="vertical"){if(n){y();return}if(m!=="none"){g("none");return}h()}}},onPointerCancel:i=>{i.nativeEvent[V]||(u.current=null,v(null))}}),l=b??Z(m),N=l>0?"leading":l<0?"trailing":"none",C=Q("relative touch-pan-y bg-surface","select-none",Pe({active:r||f})),_={transform:l!==0?`translateX(${l}px)`:void 0,transition:b===null?"transform 150ms ease":"none",minHeight:44},F=!s.isRead,I=i=>i.stopPropagation(),D=n?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:Q("inline-flex size-7 shrink-0 items-center justify-center rounded-full border",r?"border-accent bg-accent text-accent-fg":"border-line-strong bg-canvas"),children:r&&e.jsx(oe,{className:"size-3.5"})}),e.jsx(G,{thread:s})]}):e.jsxs(e.Fragment,{children:[F&&e.jsx("span",{className:"absolute left-1.5 top-1/2 size-1.5 -translate-y-1/2 rounded-full bg-accent"}),e.jsx("span",{role:"checkbox",tabIndex:0,"aria-checked":r,"aria-label":`Select message from ${s.fromName}`,onPointerDown:I,onPointerMove:I,onPointerUp:I,onClick:i=>{i.preventDefault(),i.stopPropagation(),j()},onKeyDown:i=>{i.key!=="Enter"&&i.key!==" "||(i.preventDefault(),i.stopPropagation(),j())},className:"-m-2 inline-flex size-11 shrink-0 items-center justify-center rounded-full",children:e.jsx(ze,{name:s.fromName,email:s.fromEmail,size:"sm"})}),e.jsx(G,{thread:s})]});return e.jsxs("div",{className:"relative overflow-hidden",children:[N==="leading"&&e.jsx("button",{type:"button",onClick:()=>p("leading"),"aria-label":s.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:s.isRead?e.jsx(Oe,{className:"size-6"}):e.jsx(Ce,{className:"size-6"})}),N==="trailing"&&e.jsx("button",{type:"button",onClick:()=>p("trailing"),"aria-label":"Delete message",className:"absolute inset-y-0 right-0 flex items-center justify-end bg-danger px-6 text-canvas",children:e.jsx(ce,{className:"size-6"})}),e.jsx("button",{type:"button",role:n?"checkbox":void 0,"aria-checked":n?r:void 0,"data-message-row":!0,"data-message-id":s.id,...a,className:C,style:_,children:D})]})}function Ke({sections:s,selectedThreadId:n,selectionMode:r,checkedIds:f,initialPeek:m,onToggleCheck:g,onEnterSelection:y,onOpenThread:j,onRefresh:h,refreshing:p,busy:u=!1}){const[b,v]=x.useState(new Set),[P,k]=x.useState(new Map),w=s.flatMap(a=>a.threads).filter(a=>!b.has(a.id)).map(a=>{const l=P.get(a.id);return l===void 0?a:{...a,isRead:l}}),[S,R]=x.useState(m&&m!=="none"&&w[1]?{id:w[1].id,side:m}:null),E=(a,l)=>{if(l==="trailing")v(N=>new Set(N).add(a));else{const N=w.find(C=>C.id===a);k(C=>new Map(C).set(a,!N?.isRead))}R(null)};return e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[p&&e.jsxs("div",{className:"flex items-center justify-center gap-2 border-b border-line py-3 text-fg-muted",children:[e.jsx(ve,{className:"size-4 animate-spin"}),e.jsx("span",{className:"text-xs",children:"Checking for new mail…"})]}),e.jsx("div",{className:"divide-y divide-line",children:w.map(a=>e.jsx("div",{className:u?"pointer-events-none opacity-50":void 0,children:e.jsx(Be,{thread:a,selectionMode:r,checked:f.has(a.id),active:a.id===n,peek:S?.id===a.id?S.side:"none",onPeek:l=>R(l==="none"?null:{id:a.id,side:l}),onToggleCheck:()=>g(a.id),onLongPress:()=>y(a.id),onOpen:()=>j(a.id),onAct:l=>E(a.id,l)})},a.id))}),!r&&!p&&!u&&e.jsx("button",{type:"button",onClick:h,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 We=new Set;function es({listTitle:s,listMeta:n,sections:r,briefFilters:f,flatList:m,listState:g="ready",searchQuery:y,listFilter:j,listScopeLabel:h,errorMessage:p,onRetry:u,onReportError:b,briefFilter:v,selectedThreadId:P,density:k="comfortable",onSelectThread:w,onOpenNav:S,isDesktop:R,initialTouchState:E,selection:a,keyboard:l,selectionBar:N,paneOverlay:C,listBody:_,hideHeader:F=!1}){const I=k==="compact"?Se:Me,D=x.useRef(null),i=x.useRef(null),o=le(l);de({containerRef:D,itemSelector:U,enabled:!o});const d=o?l.focusedId:void 0,M=o?d??r[0]?.threads[0]?.id:void 0,O=x.useCallback(t=>M===void 0?void 0:t===M?0:-1,[M]);x.useEffect(()=>{if(d===void 0)return;const t=i.current;if(!t)return;const c=t.querySelector(`${U}[data-message-id="${d}"]`);!c||c===t.ownerDocument.activeElement||c.focus({preventScroll:!1})},[d]),x.useEffect(()=>{if(!o)return;const t=i.current;if(!t)return;const c=t.ownerDocument.activeElement;c!==null&&c!==t.ownerDocument.body||t.focus({preventScroll:!0})},[o]);const $=!R&&!f&&g==="ready",[H,W]=x.useState(!1),ee=E==="peek-trailing"?"trailing":E==="peek-leading"?"leading":void 0,se=()=>{W(!0),setTimeout(()=>W(!1),1400)},T=a?.selectedIds??We,L=a?.onToggle,Y=a?.onRowSelect,te=Re(T.size,R),X=x.useCallback(t=>{if(L)return{checked:T.has(t),onToggle:c=>{c.preventDefault(),c.stopPropagation(),L(t)}}},[T,L]),B=x.useCallback((t,c)=>Y?.(t,ke(c))?(c.preventDefault(),c.shiftKey&&window.getSelection()?.removeAllRanges(),!0):!1,[Y]),ne=x.useCallback(({thread:t,active:c,onClick:K})=>e.jsx(I,{thread:t,active:c,focused:t.id===d,tabIndex:O(t.id),selection:X(t.id),onClick:ae=>{B(t.id,ae)||K?.()}}),[I,X,B,d,O]);return e.jsxs("section",{ref:t=>{i.current=t,l?.ref(t)},tabIndex:o?-1:void 0,className:"relative flex h-full w-full flex-col bg-surface outline-none",children:[N??(F?null:e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[S&&e.jsx(A,{variant:"ghost",size:"sm",icon:e.jsx(Le,{className:"size-4"}),onClick:S,"aria-label":"Open folders",className:"-ml-1 shrink-0"}),e.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:s}),n&&e.jsx("span",{className:"shrink-0 text-2xs text-fg-subtle",children:n})]})),g==="loading"?e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(_e,{})}):g==="empty"?e.jsx(De,{filter:j,scopeLabel:h,searchQuery:y}):g==="error"?e.jsx($e,{message:p,onRetry:u,onReport:b}):f?e.jsx(ue,{...v??{},sections:r,selectedThreadId:P,Row:ne,keyboard:l,onSelectThread:w}):_??($?e.jsx(Ke,{sections:r,selectedThreadId:P,selectionMode:te,checkedIds:T,initialPeek:ee,onToggleCheck:t=>L?.(t),onEnterSelection:t=>L?.(t),onOpenThread:t=>w?.(t),onRefresh:se,refreshing:H}):e.jsx("div",{ref:D,className:"flex-1 overflow-y-auto",children:r.map(t=>e.jsxs("div",{children:[!m&&t.label&&e.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:[e.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:t.label}),e.jsx("span",{className:"text-2xs text-fg-subtle tabular-nums",children:t.threads.length})]}),e.jsx("div",{className:"divide-y divide-line",children:t.threads.map(c=>e.jsx(I,{thread:c,active:c.id===P,focused:c.id===d,tabIndex:O(c.id),selection:X(c.id),onClick:K=>{B(c.id,K)||w?.(c.id)}},c.id))})]},t.id))})),R&&e.jsx(Ee,{hints:l?we(l.handlers):je}),C]})}var Ye=class extends fe{constructor(s,n){super(s,n)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(s){s._type="infinite",super.setOptions(s)}getOptimisticResult(s){return s._type="infinite",super.getOptimisticResult(s)}fetchNextPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"backward"}}})}createResult(s,n){const{state:r}=s,f=super.createResult(s,n),{isFetching:m,isRefetching:g,isError:y,isRefetchError:j}=f,h=r.fetchMeta?.fetchMore?.direction,p=y&&h==="forward",u=m&&h==="forward",b=y&&h==="backward",v=m&&h==="backward";return{...f,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:xe(n,r.data),hasPreviousPage:me(n,r.data),isFetchNextPageError:p,isFetchingNextPage:u,isFetchPreviousPageError:b,isFetchingPreviousPage:v,isRefetchError:j&&!p&&!b,isRefetching:g&&!u&&!v}}};function ss(s,n){return ge(s,Ye)}function ts({title:s,unreadCount:n,preset:r,selectedCategory:f,activeFilters:m,onSelectCategory:g,onToggleFilter:y,onSelectSource:j,onClearFilters:h,children:p,footer:u,searchResults:b,searchLoading:v,relatedResults:P,relatedLoading:k,onSelectSearchResult:w,searchResultsLabel:S,relatedResultsLabel:R,searchResultsInBody:E,refreshControl:a}){const{searchInput:l}=he(),N=l.trim().length>0,C={categories:r.categories,filters:r.filters,sources:r.sources,selectedCategory:f,activeFilters:m,onSelectCategory:g,onSelectSource:j,onToggleFilter:y,onClear:h};return e.jsx(pe,{hasSheet:!N,children:e.jsx(Ie,{title:s,unreadCount:n,footer:u,searchFilter:C,searchResults:b,searchLoading:v,relatedResults:P,relatedLoading:k,onSelectSearchResult:w,searchResultsLabel:S,relatedResultsLabel:R,searchResultsInBody:E,refreshControl:a,children:e.jsx(be,{...C,hideChrome:N,children:p})})})}export{Ze as M,Be as S,es as a,ts as b,ss as u};
|
|
1
|
+
import{j as e,L as re,f as A,_ as ie,r as x,t as Q,aA as oe,a2 as ce,dF as le,U as de,dG as U,dH as ue,bT as fe,dI as me,dJ as xe,dK as ge,C as he,dL as pe,d1 as be}from"./index-DMZ8-zZM.js";import{R as ve,m as je,A as we}from"./search-token-index-BQBAjCB1.js";import{a8 as Ne,a9 as ye,c as Pe,a as G,aa as Ce,s as Re,ab as ke,ac as Se,ad as Me,ae as Ee,af as Ie}from"./MailListHeader-Dhgkq9td.js";import{A as ze}from"./avatar-klLMB_Me.js";import{M as Oe}from"./mail-Bff0HSL7.js";import{M as Le}from"./menu-DqCvhoo6.js";function _e(){return e.jsx("div",{className:"space-y-0",role:"status","aria-busy":"true","aria-label":"Loading messages",children:Array.from({length:8}).map((s,n)=>e.jsxs("div",{className:"animate-pulse border-b border-line px-3 py-2",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx("div",{className:"h-4 w-32 rounded bg-surface-sunken"}),e.jsx("div",{className:"h-3 w-16 rounded bg-surface-sunken"})]}),e.jsx("div",{className:"mb-2 h-4 w-48 rounded bg-surface-sunken"}),e.jsx("div",{className:"h-3 w-full rounded bg-surface-sunken"})]},n))})}function De({filter:s,scopeLabel:n,searchQuery:r}){const f=r?.trim();return s?e.jsxs(q,{children:[e.jsx("p",{className:"font-medium text-fg",children:Fe(s.label,n,f)}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:Te[s.reach]}),e.jsx(A,{variant:"secondary",size:"sm",className:"mt-4",onClick:s.onClear,children:"Clear filter"})]}):e.jsx(q,{children:e.jsx("p",{className:"text-fg-muted",children:Ae(f,n)})})}const Te={"whole-folder":"Every message in this folder was checked.","loaded-pages":"Only the messages loaded so far were checked."};function Ae(s,n){return s?"No messages match your search":n?`No messages in ${n}`:"No messages in this mailbox"}function Fe(s,n,r){return r?`No results for “${r}” in ${s}`:n?`No ${s} mail in ${n}`:`No ${s} mail`}function q({children:s}){return e.jsx("div",{className:"flex h-full flex-1 items-center justify-center",children:e.jsx("div",{className:"flex max-w-sm flex-col items-center justify-center p-8 text-center",children:s})})}function Ze(){return e.jsxs("div",{className:"flex items-center justify-center gap-2 py-4 text-sm text-fg-muted",role:"status","aria-live":"polite",children:[e.jsx(re,{className:"size-4 animate-spin","aria-hidden":"true"}),e.jsx("span",{children:"Loading more…"})]})}function $e({message:s="Something went wrong loading this mailbox.",onRetry:n,onReport:r}){return e.jsx("div",{className:"flex h-full flex-1 items-center justify-center p-4",children:e.jsxs("div",{role:"alert",className:"flex max-w-sm flex-col items-center justify-center gap-3 text-center",children:[e.jsx(ie,{className:"size-8 text-danger","aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-danger",children:"Couldn't load messages"}),e.jsx("p",{className:"mt-1 break-words text-sm text-fg-muted",children:s})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[n&&e.jsx(A,{variant:"secondary",size:"sm",onClick:n,children:"Retry"}),r&&e.jsx(A,{variant:"ghost",size:"sm",onClick:r,children:"Report a problem"})]})]})})}const z=72,J=10,He=z/2,V="__swipeableRowAxisCancel";function Z(s){return s==="leading"?z:s==="trailing"?-z:0}function Xe(s){return s>=z/2?"leading":s<=-z/2?"trailing":"none"}function Be({thread:s,selectionMode:n,checked:r,active:f,peek:m,onPeek:g,onToggleCheck:y,onLongPress:j,onOpen:h,onAct:p}){const u=x.useRef(null),[b,v]=x.useState(null),{longPressProps:P}=Ne({onLongPress:j,isDisabled:n,accessibilityDescription:"Select message"}),k=i=>{const o=new PointerEvent("pointercancel",{bubbles:!0});o[V]=!0,i.currentTarget.dispatchEvent(o)},a=ye(P,{onPointerDown:i=>{u.current={startX:i.clientX,startY:i.clientY,axis:"none",escaped:!1}},onPointerMove:i=>{if(n)return;const o=u.current;if(!o)return;const d=i.clientX-o.startX,M=i.clientY-o.startY;if(o.axis==="none"&&(Math.abs(M)>J&&Math.abs(M)>Math.abs(d)?o.axis="vertical":Math.abs(d)>J&&Math.abs(d)>Math.abs(M)&&(o.axis="horizontal",i.currentTarget.setPointerCapture(i.pointerId))),o.axis==="none")return;const O=o.axis==="horizontal"?Math.abs(d):Math.abs(M);if(!o.escaped&&O>He&&(o.escaped=!0,k(i)),o.axis!=="horizontal")return;const $=Z(m),H=Math.max(-z,Math.min(z,$+d));v(H)},onPointerUp:i=>{const o=u.current;u.current=null;const d=b;if(v(null),!!o){if(o.axis!=="none"&&!o.escaped&&k(i),o.axis==="horizontal"){d!==null&&g(Xe(d));return}if(o.axis!=="vertical"){if(n){y();return}if(m!=="none"){g("none");return}h()}}},onPointerCancel:i=>{i.nativeEvent[V]||(u.current=null,v(null))}}),l=b??Z(m),N=l>0?"leading":l<0?"trailing":"none",C=Q("relative touch-pan-y bg-surface","select-none",Pe({active:r||f})),_={transform:l!==0?`translateX(${l}px)`:void 0,transition:b===null?"transform 150ms ease":"none",minHeight:44},F=!s.isRead,I=i=>i.stopPropagation(),D=n?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:Q("inline-flex size-7 shrink-0 items-center justify-center rounded-full border",r?"border-accent bg-accent text-accent-fg":"border-line-strong bg-canvas"),children:r&&e.jsx(oe,{className:"size-3.5"})}),e.jsx(G,{thread:s})]}):e.jsxs(e.Fragment,{children:[F&&e.jsx("span",{className:"absolute left-1.5 top-1/2 size-1.5 -translate-y-1/2 rounded-full bg-accent"}),e.jsx("span",{role:"checkbox",tabIndex:0,"aria-checked":r,"aria-label":`Select message from ${s.fromName}`,onPointerDown:I,onPointerMove:I,onPointerUp:I,onClick:i=>{i.preventDefault(),i.stopPropagation(),j()},onKeyDown:i=>{i.key!=="Enter"&&i.key!==" "||(i.preventDefault(),i.stopPropagation(),j())},className:"-m-2 inline-flex size-11 shrink-0 items-center justify-center rounded-full",children:e.jsx(ze,{name:s.fromName,email:s.fromEmail,size:"sm"})}),e.jsx(G,{thread:s})]});return e.jsxs("div",{className:"relative overflow-hidden",children:[N==="leading"&&e.jsx("button",{type:"button",onClick:()=>p("leading"),"aria-label":s.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:s.isRead?e.jsx(Oe,{className:"size-6"}):e.jsx(Ce,{className:"size-6"})}),N==="trailing"&&e.jsx("button",{type:"button",onClick:()=>p("trailing"),"aria-label":"Delete message",className:"absolute inset-y-0 right-0 flex items-center justify-end bg-danger px-6 text-canvas",children:e.jsx(ce,{className:"size-6"})}),e.jsx("button",{type:"button",role:n?"checkbox":void 0,"aria-checked":n?r:void 0,"data-message-row":!0,"data-message-id":s.id,...a,className:C,style:_,children:D})]})}function Ke({sections:s,selectedThreadId:n,selectionMode:r,checkedIds:f,initialPeek:m,onToggleCheck:g,onEnterSelection:y,onOpenThread:j,onRefresh:h,refreshing:p,busy:u=!1}){const[b,v]=x.useState(new Set),[P,k]=x.useState(new Map),w=s.flatMap(a=>a.threads).filter(a=>!b.has(a.id)).map(a=>{const l=P.get(a.id);return l===void 0?a:{...a,isRead:l}}),[S,R]=x.useState(m&&m!=="none"&&w[1]?{id:w[1].id,side:m}:null),E=(a,l)=>{if(l==="trailing")v(N=>new Set(N).add(a));else{const N=w.find(C=>C.id===a);k(C=>new Map(C).set(a,!N?.isRead))}R(null)};return e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[p&&e.jsxs("div",{className:"flex items-center justify-center gap-2 border-b border-line py-3 text-fg-muted",children:[e.jsx(ve,{className:"size-4 animate-spin"}),e.jsx("span",{className:"text-xs",children:"Checking for new mail…"})]}),e.jsx("div",{className:"divide-y divide-line",children:w.map(a=>e.jsx("div",{className:u?"pointer-events-none opacity-50":void 0,children:e.jsx(Be,{thread:a,selectionMode:r,checked:f.has(a.id),active:a.id===n,peek:S?.id===a.id?S.side:"none",onPeek:l=>R(l==="none"?null:{id:a.id,side:l}),onToggleCheck:()=>g(a.id),onLongPress:()=>y(a.id),onOpen:()=>j(a.id),onAct:l=>E(a.id,l)})},a.id))}),!r&&!p&&!u&&e.jsx("button",{type:"button",onClick:h,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 We=new Set;function es({listTitle:s,listMeta:n,sections:r,briefFilters:f,flatList:m,listState:g="ready",searchQuery:y,listFilter:j,listScopeLabel:h,errorMessage:p,onRetry:u,onReportError:b,briefFilter:v,selectedThreadId:P,density:k="comfortable",onSelectThread:w,onOpenNav:S,isDesktop:R,initialTouchState:E,selection:a,keyboard:l,selectionBar:N,paneOverlay:C,listBody:_,hideHeader:F=!1}){const I=k==="compact"?Se:Me,D=x.useRef(null),i=x.useRef(null),o=le(l);de({containerRef:D,itemSelector:U,enabled:!o});const d=o?l.focusedId:void 0,M=o?d??r[0]?.threads[0]?.id:void 0,O=x.useCallback(t=>M===void 0?void 0:t===M?0:-1,[M]);x.useEffect(()=>{if(d===void 0)return;const t=i.current;if(!t)return;const c=t.querySelector(`${U}[data-message-id="${d}"]`);!c||c===t.ownerDocument.activeElement||c.focus({preventScroll:!1})},[d]),x.useEffect(()=>{if(!o)return;const t=i.current;if(!t)return;const c=t.ownerDocument.activeElement;c!==null&&c!==t.ownerDocument.body||t.focus({preventScroll:!0})},[o]);const $=!R&&!f&&g==="ready",[H,W]=x.useState(!1),ee=E==="peek-trailing"?"trailing":E==="peek-leading"?"leading":void 0,se=()=>{W(!0),setTimeout(()=>W(!1),1400)},T=a?.selectedIds??We,L=a?.onToggle,Y=a?.onRowSelect,te=Re(T.size,R),X=x.useCallback(t=>{if(L)return{checked:T.has(t),onToggle:c=>{c.preventDefault(),c.stopPropagation(),L(t)}}},[T,L]),B=x.useCallback((t,c)=>Y?.(t,ke(c))?(c.preventDefault(),c.shiftKey&&window.getSelection()?.removeAllRanges(),!0):!1,[Y]),ne=x.useCallback(({thread:t,active:c,onClick:K})=>e.jsx(I,{thread:t,active:c,focused:t.id===d,tabIndex:O(t.id),selection:X(t.id),onClick:ae=>{B(t.id,ae)||K?.()}}),[I,X,B,d,O]);return e.jsxs("section",{ref:t=>{i.current=t,l?.ref(t)},tabIndex:o?-1:void 0,className:"relative flex h-full w-full flex-col bg-surface outline-none",children:[N??(F?null:e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[S&&e.jsx(A,{variant:"ghost",size:"sm",icon:e.jsx(Le,{className:"size-4"}),onClick:S,"aria-label":"Open folders",className:"-ml-1 shrink-0"}),e.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:s}),n&&e.jsx("span",{className:"shrink-0 text-2xs text-fg-subtle",children:n})]})),g==="loading"?e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(_e,{})}):g==="empty"?e.jsx(De,{filter:j,scopeLabel:h,searchQuery:y}):g==="error"?e.jsx($e,{message:p,onRetry:u,onReport:b}):f?e.jsx(ue,{...v??{},sections:r,selectedThreadId:P,Row:ne,keyboard:l,onSelectThread:w}):_??($?e.jsx(Ke,{sections:r,selectedThreadId:P,selectionMode:te,checkedIds:T,initialPeek:ee,onToggleCheck:t=>L?.(t),onEnterSelection:t=>L?.(t),onOpenThread:t=>w?.(t),onRefresh:se,refreshing:H}):e.jsx("div",{ref:D,className:"flex-1 overflow-y-auto",children:r.map(t=>e.jsxs("div",{children:[!m&&t.label&&e.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:[e.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:t.label}),e.jsx("span",{className:"text-2xs text-fg-subtle tabular-nums",children:t.threads.length})]}),e.jsx("div",{className:"divide-y divide-line",children:t.threads.map(c=>e.jsx(I,{thread:c,active:c.id===P,focused:c.id===d,tabIndex:O(c.id),selection:X(c.id),onClick:K=>{B(c.id,K)||w?.(c.id)}},c.id))})]},t.id))})),R&&e.jsx(Ee,{hints:l?we(l.handlers):je}),C]})}var Ye=class extends fe{constructor(s,n){super(s,n)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(s){s._type="infinite",super.setOptions(s)}getOptimisticResult(s){return s._type="infinite",super.getOptimisticResult(s)}fetchNextPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"backward"}}})}createResult(s,n){const{state:r}=s,f=super.createResult(s,n),{isFetching:m,isRefetching:g,isError:y,isRefetchError:j}=f,h=r.fetchMeta?.fetchMore?.direction,p=y&&h==="forward",u=m&&h==="forward",b=y&&h==="backward",v=m&&h==="backward";return{...f,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:xe(n,r.data),hasPreviousPage:me(n,r.data),isFetchNextPageError:p,isFetchingNextPage:u,isFetchPreviousPageError:b,isFetchingPreviousPage:v,isRefetchError:j&&!p&&!b,isRefetching:g&&!u&&!v}}};function ss(s,n){return ge(s,Ye)}function ts({title:s,unreadCount:n,preset:r,selectedCategory:f,activeFilters:m,onSelectCategory:g,onToggleFilter:y,onSelectSource:j,onClearFilters:h,children:p,footer:u,searchResults:b,searchLoading:v,relatedResults:P,relatedLoading:k,onSelectSearchResult:w,searchResultsLabel:S,relatedResultsLabel:R,searchResultsInBody:E,refreshControl:a}){const{searchInput:l}=he(),N=l.trim().length>0,C={categories:r.categories,filters:r.filters,sources:r.sources,selectedCategory:f,activeFilters:m,onSelectCategory:g,onSelectSource:j,onToggleFilter:y,onClear:h};return e.jsx(pe,{hasSheet:!N,children:e.jsx(Ie,{title:s,unreadCount:n,footer:u,searchFilter:C,searchResults:b,searchLoading:v,relatedResults:P,relatedLoading:k,onSelectSearchResult:w,searchResultsLabel:S,relatedResultsLabel:R,searchResultsInBody:E,refreshControl:a,children:e.jsx(be,{...C,hideChrome:N,children:p})})})}export{Ze as M,Be as S,es as a,ts as b,ss as u};
|