@remit/web-client-dist 0.0.640 → 0.0.641
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-CgrYQK-q.js → BriefPane-D1p8nleB.js} +1 -1
- package/assets/{CalendarComposePane-BP11q0VZ.js → CalendarComposePane-FU6MwnAy.js} +1 -1
- package/assets/{CalendarComposeSeed-DUfbysaw.js → CalendarComposeSeed-Ddue6yGg.js} +1 -1
- package/assets/{CalendarShell-Bj_LREI1.js → CalendarShell-ay8jVvby.js} +1 -1
- package/assets/{EmptyState-BxCn_noW.js → EmptyState-DxT13qcR.js} +1 -1
- package/assets/{ErrorState-4mTTo1i7.js → ErrorState-CHxEHbvf.js} +1 -1
- package/assets/{FlaggedPane-BMEsB4gM.js → FlaggedPane-CJ__xJpf.js} +1 -1
- package/assets/{FullCompose-DzwWI0uW.js → FullCompose-DkV5Z3KV.js} +1 -1
- package/assets/MailListHeader-BZRxmnIb.js +7 -0
- package/assets/{MailNav-DX4y10RQ.js → MailNav-DBY9OW6Y.js} +1 -1
- package/assets/{MailShell--j4aRxeO.js → MailShell-LEDBmXGr.js} +1 -1
- package/assets/{MailViewChrome-DbNhYfPK.js → MailViewChrome-7gtXtr7X.js} +1 -1
- package/assets/{MailboxPane-DLYLIJW2.js → MailboxPane-sccwyPwa.js} +1 -1
- package/assets/{NavMenuButton-BQ6HpwiL.js → NavMenuButton-C3UDJB1v.js} +1 -1
- package/assets/{OnboardingWizard-B0YApTeh.js → OnboardingWizard-DWrpEauO.js} +1 -1
- package/assets/{OpenCalendarEvent-B57LCOm6.js → OpenCalendarEvent-B1DYETG7.js} +1 -1
- package/assets/{OutboxPane-Qy6KcYt8.js → OutboxPane-oxeCJEiZ.js} +1 -1
- package/assets/_calendarObjectId-DpUi-YzJ.js +1 -0
- package/assets/_mailboxId-DW6pvCIw.js +1 -0
- package/assets/_messageId-BAQFECvK.js +1 -0
- package/assets/_messageId-BVnDwNl2.js +1 -0
- package/assets/_messageId-Bvuxe_8r.js +1 -0
- package/assets/_outboxMessageId-BjD8wilW.js +1 -0
- package/assets/_recurrenceId-DBx4vqgw.js +1 -0
- package/assets/_threadId-B5nqfV-L.js +1 -0
- package/assets/_threadId-CazI55hb.js +1 -0
- package/assets/_threadId-DUn5RY_Y.js +1 -0
- package/assets/{_view._date-Cbnxxwbp.js → _view._date-Bpb6TKNU.js} +1 -1
- package/assets/{accounts-BaE8hZhU.js → accounts-D080vGx7.js} +1 -1
- package/assets/{advanced-BQXKMb3X.js → advanced-CkUEORb7.js} +1 -1
- package/assets/{appearance-CwI3gcef.js → appearance-C7pPonlu.js} +1 -1
- package/assets/{attendee-row-ChVyXD3x.js → attendee-row-t7d1gEVn.js} +1 -1
- package/assets/{avatar-DMG2etHF.js → avatar-C2R7xqlA.js} +1 -1
- package/assets/{bell-off-DRmJ5yyg.js → bell-off-CD1iuAQA.js} +1 -1
- package/assets/{bottom-sheet-DzCXRkg4.js → bottom-sheet-DZ2d0h_L.js} +1 -1
- package/assets/{brief-C1UwUHr6.js → brief-BVo4rf_J.js} +1 -1
- package/assets/brief-CH-e1O9N.js +1 -0
- package/assets/{browser-ponyfill-C_k48VV5.js → browser-ponyfill-BdQcytd0.js} +1 -1
- package/assets/{bug-D5uDhePM.js → bug-DI9j6s_O.js} +1 -1
- package/assets/{calendar-CRzCOwSW.js → calendar-0_V8JbUq.js} +1 -1
- package/assets/{calendar-clash-strip-xpMaDxF1.js → calendar-clash-strip-AV6ir0kb.js} +1 -1
- package/assets/{calendar-format-pxTaaUQD.js → calendar-format-CyOmp12n.js} +1 -1
- package/assets/{calendar-report-7qxgvnEi.js → calendar-report-rx459ZNk.js} +1 -1
- package/assets/{calendar-suggestion-CDJ7NeZD.js → calendar-suggestion-OndzGSan.js} +1 -1
- package/assets/{calendars-DfmRSs04.js → calendars-Dav4B8o3.js} +1 -1
- package/assets/{card-CFk-99cG.js → card-hG_Il7pd.js} +1 -1
- package/assets/{checkbox-72qUZj4h.js → checkbox-B_JY_6mN.js} +1 -1
- package/assets/chevron-left-D3r7M2xH.js +1 -0
- package/assets/{circle-check-BZ8xIrjW.js → circle-check-Cmp8Rqlz.js} +1 -1
- package/assets/{circle-check-big-B1_wSShn.js → circle-check-big-B9Ca4u10.js} +1 -1
- package/assets/{circle-help-Cx3QyYDY.js → circle-help-Cmc2Km1C.js} +1 -1
- package/assets/{clock-DNac4DPY.js → clock-DC78l7yK.js} +1 -1
- package/assets/compose._-_outboxMessageId_-Bt9J2-qp.js +1 -0
- package/assets/compose._-_outboxMessageId_-C1FaW9o1.js +1 -0
- package/assets/compose._-_outboxMessageId_-D5zB1ABW.js +1 -0
- package/assets/compose._-_outboxMessageId_-R5L6KgB1.js +1 -0
- package/assets/{config-import-eDZocezs.js → config-import-hoC0Y2SG.js} +1 -1
- package/assets/{confirm-dialog-BeqneGTk.js → confirm-dialog-CCDHX_6Q.js} +1 -1
- package/assets/{copy-B0qVbOM9.js → copy-B0aWQGDa.js} +1 -1
- package/assets/{credential-steps-R8s_QCuM.js → credential-steps-uXZK9Zmr.js} +1 -1
- package/assets/{download-CagrzNeA.js → download-D3fQ48lB.js} +1 -1
- package/assets/{file-json-BcrryOS3.js → file-json-CCQAXfEc.js} +1 -1
- package/assets/{filters-jl_hLr_U.js → filters-DjsJshjt.js} +1 -1
- package/assets/{flagged-DTiPrMfI.js → flagged-DU9q4oil.js} +1 -1
- package/assets/flagged-Q3VMHIjI.js +1 -0
- package/assets/{folders-J7OKnN3G.js → folders-EdBrFHzG.js} +1 -1
- package/assets/{help-copy-SecmNzX3.js → help-copy-BFATWnBQ.js} +1 -1
- package/assets/{import-C1v0ygtj.js → import-wN7xkLN8.js} +1 -1
- package/assets/index-B3qUW5A0.js +1 -0
- package/assets/index-BAQFECvK.js +1 -0
- package/assets/index-BUYR1pAl.js +1 -0
- package/assets/index-Bvuxe_8r.js +1 -0
- package/assets/{index-BOf0CjTQ.css → index-C5Dozv2m.css} +1 -1
- package/assets/index-CxIBpGfW.js +1 -0
- package/assets/index-D9CK5EEZ.js +1 -0
- package/assets/index-DE-NAKWZ.js +57 -0
- package/assets/index-DFpWp13S.js +1 -0
- package/assets/{index-CEPt7qyx.js → index-DKo99WG1.js} +4 -4
- package/assets/{index-BkN-0Ojw.js → index-DY5mGxwG.js} +1 -1
- package/assets/index-EsGaYQlh.js +1 -0
- package/assets/index-p4X-Ys_z.js +1 -0
- package/assets/{kbd-DARC33aW.js → kbd-xYIrsDlz.js} +1 -1
- package/assets/{labels-M5x4eh_h.js → labels-CToNdujY.js} +1 -1
- package/assets/{mail-C3p0gwLh.js → mail-CFqLOB4w.js} +1 -1
- package/assets/{mail-BtoYtCIx.js → mail-DxfGucaQ.js} +1 -1
- package/assets/{menu-DgePuI44.js → menu-u9D-cJXQ.js} +1 -1
- package/assets/minus-Bnr4gKCE.js +1 -0
- package/assets/{new-BbRHlPvO.js → new-DarKu0Ji.js} +1 -1
- package/assets/onboarding-DRQo7PkQ.js +1 -0
- package/assets/{onboarding-completion-CYOfO9ha.js → onboarding-completion-DK9cy93Q.js} +1 -1
- package/assets/outbox-BJK9d-c1.js +1 -0
- package/assets/{pane-header-DbMugl_W.js → pane-header-DmEVnHem.js} +1 -1
- package/assets/{pencil-CuzrXP0x.js → pencil-hPJlTnvS.js} +1 -1
- package/assets/{popover-menu-lD6vWVLi.js → popover-menu-BDeljNyh.js} +1 -1
- package/assets/{refresh-cw-DpoU5Ymm.js → refresh-cw-DNbEUXcm.js} +1 -1
- package/assets/rich-text-CQJUj3SY.js +30 -0
- package/assets/{rich-text-spellcheck-worker-provider-CJdqNjuf.js → rich-text-spellcheck-worker-provider-YjewF802.js} +1 -1
- package/assets/{rotate-ccw-DQ3ge9ht.js → rotate-ccw-DFe52ITT.js} +1 -1
- package/assets/{roving-focus-DaOEU3XN.js → roving-focus-DWecg5C9.js} +1 -1
- package/assets/{row-actions-DjboMNPd.js → row-actions-Cp8U_ugi.js} +1 -1
- package/assets/{search-mirror-AZ09oaZ-.js → search-mirror-CjZ7cATA.js} +1 -1
- package/assets/{search-token-index-g9u-Yoz1.js → search-token-index-DL0AoAlj.js} +1 -1
- package/assets/{sections-HGyDVW8E.js → sections-DDBMQxXz.js} +1 -1
- package/assets/{senders-BoRXr1nj.js → senders-Di3Hbnh-.js} +1 -1
- package/assets/settings-CFMotOQ7.js +1 -0
- package/assets/{settings-screen-Itr1mBYp.js → settings-screen-v6xny9wU.js} +1 -1
- package/assets/{shield-check-EAw6gej8.js → shield-check-BgoZBruM.js} +1 -1
- package/assets/{suggested-vips-CfWY9dNp.js → suggested-vips-C6Pc81iu.js} +1 -1
- package/assets/{undo-2-DlzJI2Fz.js → undo-2-nUyUEATC.js} +1 -1
- package/assets/{useCalendarData-Bb3qmi9r.js → useCalendarData-4YBnFK2x.js} +1 -1
- package/assets/{useCalendarWrites-DS7CUivn.js → useCalendarWrites-qcdW_JmG.js} +1 -1
- package/assets/{useCalendars-CC6_02zt.js → useCalendars-sfh2BICi.js} +1 -1
- package/assets/{useDebouncedValue-B2mvBjFc.js → useDebouncedValue-Bq8RVLfv.js} +1 -1
- package/assets/{useFilters-CNZftL2x.js → useFilters-zXsB3pIM.js} +1 -1
- package/assets/{useLabels-60oKTMmI.js → useLabels-xQerI8AK.js} +1 -1
- package/assets/{useLayoutTier-DL8wqvev.js → useLayoutTier-C1kzvb61.js} +1 -1
- package/assets/{useMessageBodyContent-BPfgRb0y.js → useMessageBodyContent-BRyDdu_J.js} +1 -1
- package/assets/{useQueries-71fTePBw.js → useQueries-CY9FUcC8.js} +1 -1
- package/assets/{useRefreshControl-BEmUdva7.js → useRefreshControl-DKJ_Eyfn.js} +1 -1
- package/assets/{useResultFolderIndex-BNjWdD7c.js → useResultFolderIndex-BFXa90Ay.js} +1 -1
- package/assets/{useSearchTokenContext-DV1a2Ept.js → useSearchTokenContext-C0_GGpQj.js} +2 -2
- package/assets/{useSemanticSearch-_DIS3Eh-.js → useSemanticSearch-lVNhyaIe.js} +1 -1
- package/assets/{useSignature-rBm8HWB-.js → useSignature-CR4J3Q1V.js} +1 -1
- package/index.html +2 -2
- package/package.json +1 -1
- package/assets/MailListHeader-DApFSHSe.js +0 -7
- package/assets/_calendarObjectId-B6msFclO.js +0 -1
- package/assets/_mailboxId-BKsvFkDT.js +0 -1
- package/assets/_messageId--QFHVZeX.js +0 -1
- package/assets/_messageId-CSK8QfH1.js +0 -1
- package/assets/_messageId-CiFmGZ0f.js +0 -1
- package/assets/_outboxMessageId-BZXG5CKm.js +0 -1
- package/assets/_recurrenceId-BSJWpfQb.js +0 -1
- package/assets/_threadId-CpJXk-A9.js +0 -1
- package/assets/_threadId-D8tk8Jw6.js +0 -1
- package/assets/_threadId-YWPslA3L.js +0 -1
- package/assets/brief-_1FM8dkv.js +0 -1
- package/assets/chevron-left-BzUq7_B-.js +0 -1
- package/assets/compose._-_outboxMessageId_-B1dVCQ25.js +0 -1
- package/assets/compose._-_outboxMessageId_-BdDNHGoF.js +0 -1
- package/assets/compose._-_outboxMessageId_-Cl-G4mar.js +0 -1
- package/assets/compose._-_outboxMessageId_-MUk1rihG.js +0 -1
- package/assets/flagged-B4wTZoV0.js +0 -1
- package/assets/index-7hLku8jr.js +0 -1
- package/assets/index-8DMbZlDw.js +0 -1
- package/assets/index-BKoW03Wz.js +0 -1
- package/assets/index-BiaeJPNN.js +0 -1
- package/assets/index-CSK8QfH1.js +0 -1
- package/assets/index-CiFmGZ0f.js +0 -1
- package/assets/index-DEFPaYEl.js +0 -1
- package/assets/index-DFu_Q1as.js +0 -1
- package/assets/index-DnKCHbFt.js +0 -57
- package/assets/index-XAfC_xEu.js +0 -1
- package/assets/minus-Bwn9p369.js +0 -1
- package/assets/onboarding-Cs8J_UtY.js +0 -1
- package/assets/outbox-1Vt69iIw.js +0 -1
- package/assets/rich-text-DWhtn_Gj.js +0 -30
- package/assets/settings-BNfgj2nx.js +0 -1
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{as as Ps,d8 as Br,r as c,e as fe,j as s,_ as Ke,$ as Ds,L as na,t as P,a0 as Kr,g as we,d9 as Hr,da as aa,db as ra,dc as Wt,a7 as qr,f as H,X as Xe,a3 as vt,aB as Gt,Y as Qr,b9 as Wr,d7 as Vt,dd as oa,Z as et,de as Gr,df as Vr,dg as Yr,W as Ze,dh as ia,bJ as Fs,di as Jr,bs as Xr,dj as Zr,dk as eo,dl as la,aM as to,dm as so,B as ca,dn as no,dp as ao,dq as ro,dr as oo,ds as io,dt as lo,w as co,cG as da,d4 as ua,c as ne,d as tt,K as yt,du as uo,dv as fo,dw as Yt,h as he,at as ve,i as ge,E as Re,F as Ee,Q as kt,cy as Me,dx as Jt,dy as pt,aJ as mo,dz as jt,dA as Ae,dB as wt,dC as Ct,dD as Nt,dE as po,dF as ho,dG as on,cE as go,s as fa,dH as xo,dI as bo,dJ as vo,b6 as yo,cp as ko,G as Xt,c_ as ma,c$ as jo,dK as wo,bq as Os,bt as pa,bn as ha,bu as ga,bv as xa,bw as Co,aH as ba,aI as va,cO as No,dL as So,ab as ya,cN as Io,dM as ht,dN as To,dO as Ro,bf as ka,dP as Eo,dQ as ja,dR as Mo,H as wa,bR as zs,dS as Ao,cQ as st,dT as ln,dU as Ca,bT as $o,dV as ms,dW as Lo,bS as Po,S as Do,q as Fo,ah as Na,J as Oo,dX as zo,dY as _o,dZ as Uo,d3 as cn,bD as Bo,d_ as Ko,d$ as Ho,av as qo,cS as Qo,d1 as Wo,e0 as Go,ai as Vo,d2 as Yo,e1 as Jo,e2 as Xo,e3 as Zo,e4 as ei,C as St,e5 as ti,e6 as si,e7 as dn,e8 as ni,e9 as ai,ea as ri,eb as oi,v as Sa,d6 as ii,ec as _s,ed as li,ee as ci,cq as di,cn as ui,ef as fi,bU as mi,eg as Ia,cr as pi}from"./index-CEPt7qyx.js";import{u as hi,L as gi,a as xi}from"./roving-focus-DaOEU3XN.js";import{j as bi,S as Ta,f as vi,a as yi,t as dt,c as ki,k as ji,l as wi,m as Ci,u as Ni}from"./search-token-index-g9u-Yoz1.js";import{K as Si}from"./kbd-DARC33aW.js";import{c as Ra,P as Ii,E as Ti}from"./popover-menu-lD6vWVLi.js";import{M as Ri}from"./mail-BtoYtCIx.js";import{A as gt}from"./avatar-DMG2etHF.js";import{M as Ei,a as Mi,b as Ea,c as Ai,s as Ma,d as Aa,e as $i,f as Li,S as un,g as $a,u as La,p as Pi,r as Di}from"./useSearchTokenContext-DV1a2Ept.js";import{P as Zt,f as Fi,C as Oi,D as Ve,s as zi,u as _i}from"./index-DnKCHbFt.js";import{E as Pa}from"./EmptyState-BxCn_noW.js";import{E as Be}from"./ErrorState-4mTTo1i7.js";import{U as Ui}from"./undo-2-DlzJI2Fz.js";import{D as Bi}from"./download-CagrzNeA.js";import{g as Ki}from"./useMessageBodyContent-BPfgRb0y.js";import{m as ws,s as Hi,n as qi,Z as Qi,E as Wi,C as Gi,y as Vi,x as Yi,p as Ji,z as Xi,A as fn,B as Zi,u as el,D as tl,q as mn,F as sl,G as nl,t as al,H as rl,v as ol}from"./calendar-suggestion-CDJ7NeZD.js";import{c as il,t as ll,v as cl,x as dl,y as pn}from"./calendar-format-pxTaaUQD.js";import{R as ul}from"./attendee-row-ChVyXD3x.js";import{C as fl}from"./calendar-clash-strip-xpMaDxF1.js";import{C as Da}from"./clock-DNac4DPY.js";import{M as ml,c as pl}from"./calendar-report-7qxgvnEi.js";import{B as Fa}from"./bell-off-DRmJ5yyg.js";import{S as hl,C as Oa}from"./shield-check-EAw6gej8.js";import{u as gl,a as xl,i as bl,t as vl,d as yl,r as kl}from"./useCalendars-CC6_02zt.js";import{u as za}from"./useDebouncedValue-B2mvBjFc.js";import{j as hn,u as jl,a as wl,k as Cl,n as Nl,o as Sl,l as Il,m as Tl,S as Rl}from"./useFilters-CNZftL2x.js";import{u as Us}from"./useQueries-71fTePBw.js";import{C as El}from"./checkbox-72qUZj4h.js";import{C as Pt}from"./confirm-dialog-BeqneGTk.js";import{u as Ml,i as Al}from"./useLayoutTier-DL8wqvev.js";import{r as $l,a as Ll}from"./search-scope-B5-OK3Cq.js";import{M as Pl}from"./menu-DgePuI44.js";function xt(e){if(Dl())e.focus({preventScroll:!0});else{let t=Fl(e);e.focus(),Ol(t)}}let Dt=null;function Dl(){if(Dt==null){Dt=!1;try{document.createElement("div").focus({get preventScroll(){return Dt=!0,!0}})}catch{}}return Dt}function Fl(e){let t=e.parentNode,n=[],a=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==a;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return a instanceof HTMLElement&&n.push({element:a,scrollTop:a.scrollTop,scrollLeft:a.scrollLeft}),n}function Ol(e){for(let{element:t,scrollTop:n,scrollLeft:a}of e)t.scrollTop=n,t.scrollLeft=a}const Ie=e=>e?.ownerDocument??document,Te=e=>e&&"window"in e&&e.window===e?e:Ie(e).defaultView||window;function zl(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function _l(e){return zl(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let Ul=!1;function _a(){return Ul}function xe(e,t){if(!_a())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:_l(n)?n=n.host:n=n.parentNode}return!1}function ae(e){if(_a()&&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 Bl=typeof Element<"u"&&"checkVisibility"in Element.prototype;function Kl(e){const t=Te(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:n,visibility:a}=e.style,r=n!=="none"&&a!=="hidden"&&a!=="collapse";if(r){const{getComputedStyle:o}=Te(e);let{display:i,visibility:l}=o(e);r=i!=="none"&&l!=="hidden"&&l!=="collapse"}return r}function Hl(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 Ua(e,t){return Bl?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):e.nodeName!=="#comment"&&Kl(e)&&Hl(e,t)&&(!e.parentElement||Ua(e.parentElement,e))}const Ba=["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"],ql=Ba.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";Ba.push('[tabindex]:not([tabindex="-1"]):not([disabled])');function Ql(e,t){return e.matches(ql)&&!Wl(e)&&(t?.skipVisibilityCheck||Ua(e))}function Wl(e){let t=e;for(;t!=null;){if(t instanceof Te(t).HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}const Bs=typeof document<"u"?Ps.useLayoutEffect:()=>{};function Gl(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Vl(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Yl(e){for(;e&&!Ql(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=Te(e),n=t.document.activeElement;if(!n||n===e)return;let a=!1,r=g=>{(ae(g)===n||a)&&g.stopImmediatePropagation()},o=g=>{(ae(g)===n||a)&&(g.stopImmediatePropagation(),!e&&!a&&(a=!0,xt(n),u()))},i=g=>{(ae(g)===e||a)&&g.stopImmediatePropagation()},l=g=>{(ae(g)===e||a)&&(g.stopImmediatePropagation(),a||(a=!0,xt(n),u()))};t.addEventListener("blur",r,!0),t.addEventListener("focusout",o,!0),t.addEventListener("focusin",l,!0),t.addEventListener("focus",i,!0);let u=()=>{cancelAnimationFrame(x),t.removeEventListener("blur",r,!0),t.removeEventListener("focusout",o,!0),t.removeEventListener("focusin",l,!0),t.removeEventListener("focus",i,!0),a=!1},x=requestAnimationFrame(u);return u}function es(e){if(typeof window>"u"||window.navigator==null)return!1;let t=window.navigator.userAgentData?.brands;return Array.isArray(t)&&t.some(n=>e.test(n.brand))||e.test(window.navigator.userAgent)}function Ks(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}function $e(e){let t=null;return()=>(t==null&&(t=e()),t)}const Kt=$e(function(){return Ks(/^Mac/i)}),Jl=$e(function(){return Ks(/^iPhone/i)}),Ka=$e(function(){return Ks(/^iPad/i)||Kt()&&navigator.maxTouchPoints>1}),Ha=$e(function(){return Jl()||Ka()}),Xl=$e(function(){return es(/AppleWebKit/i)&&!Zl()}),Zl=$e(function(){return es(/Chrome/i)}),qa=$e(function(){return es(/Android/i)}),ec=$e(function(){return es(/Firefox/i)});function tc(e){return e.pointerType===""&&e.isTrusted?!0:qa()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function sc(e){return!qa()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"}function bt(e,t,n=!0){let{metaKey:a,ctrlKey:r,altKey:o,shiftKey:i}=t;ec()&&window.event?.type?.startsWith("key")&&e.target==="_blank"&&(Kt()?a=!0:r=!0);let l=Xl()&&Kt()&&!Ka()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:a,ctrlKey:r,altKey:o,shiftKey:i}):new MouseEvent("click",{metaKey:a,ctrlKey:r,altKey:o,shiftKey:i,detail:1,bubbles:!0,cancelable:!0});bt.isOpening=n,xt(e),e.dispatchEvent(l),bt.isOpening=!1}bt.isOpening=!1;let Se=new Map,Cs=new Set;function gn(){if(typeof window>"u")return;function e(a){return"propertyName"in a}let t=a=>{let r=ae(a);if(!e(a)||!r)return;let o=Se.get(r);o||(o=new Set,Se.set(r,o),r.addEventListener("transitioncancel",n,{once:!0})),o.add(a.propertyName)},n=a=>{let r=ae(a);if(!e(a)||!r)return;let o=Se.get(r);if(o&&(o.delete(a.propertyName),o.size===0&&(r.removeEventListener("transitioncancel",n),Se.delete(r)),Se.size===0)){for(let i of Cs)i();Cs.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",n)}typeof document<"u"&&(document.readyState!=="loading"?gn():document.addEventListener("DOMContentLoaded",gn));function nc(){for(const[e]of Se)"isConnected"in e&&!e.isConnected&&Se.delete(e)}function ac(e){requestAnimationFrame(()=>{nc(),Se.size===0?e():Cs.add(e)})}function Qa(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}let Ns=new Map;typeof FinalizationRegistry<"u"&&new FinalizationRegistry(e=>{Ns.delete(e)});function rc(e,t){if(e===t)return e;let n=Ns.get(e);if(n)return n.forEach(r=>r.current=t),t;let a=Ns.get(t);return a?(a.forEach(r=>r.current=e),e):t}function oc(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1;const a=e.map(r=>{const o=xn(r,t);return n||=typeof o=="function",o});if(n)return()=>{a.forEach((r,o)=>{typeof r=="function"?r():xn(e[o],null)})}}}function xn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function It(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let a=e[n];for(let r in a){let o=t[r],i=a[r];typeof o=="function"&&typeof i=="function"&&r[0]==="o"&&r[1]==="n"&&r.charCodeAt(2)>=65&&r.charCodeAt(2)<=90?t[r]=Qa(o,i):(r==="className"||r==="UNSAFE_className")&&typeof o=="string"&&typeof i=="string"?t[r]=Br(o,i):r==="id"&&o&&i?t.id=rc(o,i):r==="ref"&&o&&i?t.ref=oc(o,i):t[r]=i!==void 0?i:o}}return t}function ic(e,t){Bs(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}const lc=Ps.useInsertionEffect??Bs;function ps(e){const t=c.useRef(null);return lc(()=>{t.current=e},[e]),c.useCallback((...n)=>{const a=t.current;return a?.(...n)},[])}let Ye="default",Ss="",Bt=new WeakMap;function cc(e){if(Ha()){if(Ye==="default"){const t=Ie(e);Ss=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect="none"}Ye="disabled"}else if(e instanceof HTMLElement||e instanceof SVGElement){let t="userSelect"in e.style?"userSelect":"webkitUserSelect";Bt.set(e,e.style[t]),e.style[t]="none"}}function bn(e){if(Ha()){if(Ye!=="disabled")return;Ye="restoring",setTimeout(()=>{ac(()=>{if(Ye==="restoring"){const t=Ie(e);t.documentElement.style.webkitUserSelect==="none"&&(t.documentElement.style.webkitUserSelect=Ss||""),Ss="",Ye="default"}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&Bt.has(e)){let t=Bt.get(e),n="userSelect"in e.style?"userSelect":"webkitUserSelect";e.style[n]==="none"&&(e.style[n]=t),e.getAttribute("style")===""&&e.removeAttribute("style"),Bt.delete(e)}}function vn(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let hs=new WeakMap;function dc(e){let t=e??(typeof document<"u"?document:void 0);if(!t)return vn(t);if(hs.has(t))return hs.get(t);let n=t.querySelector('meta[property="csp-nonce"]'),a=n&&n instanceof Te(n).HTMLMetaElement&&(n.nonce||n.content)||vn(t)||void 0;return a!==void 0&&hs.set(t,a),a}const Wa=Ps.createContext({register:()=>{}});Wa.displayName="PressResponderContext";function Ga(){let e=c.useRef(new Map),t=c.useCallback((r,o,i,l)=>{let u=l?.once?(...x)=>{e.current.delete(i),i(...x)}:i;e.current.set(i,{type:o,eventTarget:r,fn:u,options:l}),r.addEventListener(o,u,l)},[]),n=c.useCallback((r,o,i,l)=>{let u=e.current.get(i)?.fn||i;r.removeEventListener(o,u,l),e.current.delete(i)},[]),a=c.useCallback(()=>{e.current.forEach((r,o)=>{n(r.eventTarget,r.type,o,r.options)})},[n]);return c.useEffect(()=>a,[a]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:a}}function uc(e){let t=c.useContext(Wa);if(t){let{register:n,ref:a,...r}=t;e=It(r,e),n()}return ic(t,e.ref),e}class Ft{#e;constructor(t,n,a,r){this.#e=!0;const i=(r?.target??a.currentTarget)?.getBoundingClientRect();let l,u=0,x,g=null;a.clientX!=null&&a.clientY!=null&&(x=a.clientX,g=a.clientY),i&&(x!=null&&g!=null?(l=x-i.left,u=g-i.top):(l=i.width/2,u=i.height/2)),this.type=t,this.pointerType=n,this.target=a.currentTarget,this.shiftKey=a.shiftKey,this.metaKey=a.metaKey,this.ctrlKey=a.ctrlKey,this.altKey=a.altKey,this.x=l,this.y=u,this.key=a.key}continuePropagation(){this.#e=!1}get shouldStopPropagation(){return this.#e}}const yn=Symbol("linkClicked"),kn="react-aria-pressable-style",jn="data-react-aria-pressable";function fc(e){let{onPress:t,onPressChange:n,onPressStart:a,onPressEnd:r,onPressUp:o,onClick:i,isDisabled:l,isPressed:u,preventFocusOnPress:x,shouldCancelOnPointerExit:g,allowTextSelectionOnPress:y,ref:f,...v}=uc(e),[p,m]=c.useState(!1),d=c.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:b,removeAllGlobalListeners:k}=Ga(),h=c.useCallback((w,R)=>{let O=d.current;if(l||O.didFirePressStart)return!1;let C=!0;if(O.isTriggeringEvent=!0,a){let L=new Ft("pressstart",R,w);a(L),C=L.shouldStopPropagation}return n&&n(!0),O.isTriggeringEvent=!1,O.didFirePressStart=!0,m(!0),C},[l,a,n]),j=c.useCallback((w,R,O=!0)=>{let C=d.current;if(!C.didFirePressStart)return!1;C.didFirePressStart=!1,C.isTriggeringEvent=!0;let L=!0;if(r){let N=new Ft("pressend",R,w);r(N),L=N.shouldStopPropagation}if(n&&n(!1),m(!1),t&&O&&!l){let N=new Ft("press",R,w);t(N),L&&=N.shouldStopPropagation}return C.isTriggeringEvent=!1,L},[l,r,n,t]),S=ps(j),I=c.useCallback((w,R)=>{let O=d.current;if(l)return!1;if(o){O.isTriggeringEvent=!0;let C=new Ft("pressup",R,w);return o(C),O.isTriggeringEvent=!1,C.shouldStopPropagation}return!0},[l,o]),A=ps(I),M=c.useCallback(w=>{let R=d.current;if(R.isPressed&&R.target){R.didFirePressStart&&R.pointerType!=null&&j(Ue(R.target,w),R.pointerType,!1),R.isPressed=!1,R.isOverTarget=!1,R.activePointerId=null,R.pointerType=null,k(),y||bn(R.target);for(let O of R.disposables)O();R.disposables=[]}},[y,k,j]),T=ps(M);c.useEffect(()=>{l&&d.current.isPressed&&T({currentTarget:d.current.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})},[l]);let D=c.useCallback(w=>{g&&M(w)},[g,M]),$=c.useCallback(w=>{l||i?.(w)},[l,i]),K=c.useCallback((w,R)=>{if(!l&&i){let O=new MouseEvent("click",w);Vl(O,R),i(Gl(O))}},[l,i]),_=c.useMemo(()=>{let w=d.current,R={onKeyDown(C){if(gs(C.nativeEvent,C.currentTarget)&&xe(C.currentTarget,ae(C))){wn(ae(C),C.key)&&C.preventDefault();let L=!0;!w.isPressed&&!C.repeat&&(w.target=C.currentTarget,w.isPressed=!0,w.pointerType="keyboard",L=h(C,"keyboard"));let N=C.currentTarget,B=z=>{gs(z,N)&&!z.repeat&&xe(N,ae(z))&&w.target&&A(Ue(w.target,z),"keyboard")};b(Ie(C.currentTarget),"keyup",Qa(B,O),!0),L&&C.stopPropagation(),C.metaKey&&Kt()&&w.metaKeyEvents?.set(C.key,C.nativeEvent)}else C.key==="Meta"&&(w.metaKeyEvents=new Map)},onClick(C){if(!(C&&!xe(C.currentTarget,ae(C)))&&C&&C.button===0&&!w.isTriggeringEvent&&!bt.isOpening){let L=!0;if(l&&C.preventDefault(),!w.ignoreEmulatedMouseEvents&&!w.isPressed&&(w.pointerType==="virtual"||tc(C.nativeEvent))){let N=h(C,"virtual"),B=A(C,"virtual"),z=S(C,"virtual");$(C),L=N&&B&&z}else if(w.isPressed&&w.pointerType!=="keyboard"){let N=w.pointerType||C.nativeEvent.pointerType||"virtual",B=A(Ue(C.currentTarget,C),N),z=S(Ue(C.currentTarget,C),N,!0);L=B&&z,w.isOverTarget=!1,$(C),T(C)}w.ignoreEmulatedMouseEvents=!1,L&&C.stopPropagation()}}},O=C=>{if(w.isPressed&&w.target&&gs(C,w.target)){wn(ae(C),C.key)&&C.preventDefault();let L=ae(C),N=xe(w.target,L);S(Ue(w.target,C),"keyboard",N),N&&K(C,w.target),k(),C.key!=="Enter"&&Hs(w.target)&&xe(w.target,L)&&!C[yn]&&(C[yn]=!0,bt(w.target,C,!1)),w.isPressed=!1,w.metaKeyEvents?.delete(C.key)}else if(C.key==="Meta"&&w.metaKeyEvents?.size){let L=w.metaKeyEvents;w.metaKeyEvents=void 0;for(let N of L.values())w.target?.dispatchEvent(new KeyboardEvent("keyup",N))}};if(typeof PointerEvent<"u"){R.onPointerDown=N=>{if(N.button!==0||!xe(N.currentTarget,ae(N)))return;if(sc(N.nativeEvent)){w.pointerType="virtual";return}w.pointerType=N.pointerType;let B=!0;if(!w.isPressed){w.isPressed=!0,w.isOverTarget=!0,w.activePointerId=N.pointerId,w.target=N.currentTarget,y||cc(w.target),B=h(N,w.pointerType);let z=ae(N);"releasePointerCapture"in z&&("hasPointerCapture"in z?z.hasPointerCapture(N.pointerId)&&z.releasePointerCapture(N.pointerId):z.releasePointerCapture(N.pointerId)),b(Ie(N.currentTarget),"pointerup",C,!1),b(Ie(N.currentTarget),"pointercancel",L,!1)}B&&N.stopPropagation()},R.onMouseDown=N=>{if(xe(N.currentTarget,ae(N))&&N.button===0){if(x){let B=Yl(N.target);B&&w.disposables.push(B)}N.stopPropagation()}},R.onPointerUp=N=>{!xe(N.currentTarget,ae(N))||w.pointerType==="virtual"||N.button===0&&!w.isPressed&&A(N,w.pointerType||N.pointerType)},R.onPointerEnter=N=>{N.pointerId===w.activePointerId&&w.target&&!w.isOverTarget&&w.pointerType!=null&&(w.isOverTarget=!0,h(Ue(w.target,N),w.pointerType))},R.onPointerLeave=N=>{N.pointerId===w.activePointerId&&w.target&&w.isOverTarget&&w.pointerType!=null&&(w.isOverTarget=!1,S(Ue(w.target,N),w.pointerType,!1),D(N))};let C=N=>{if(N.pointerId===w.activePointerId&&w.isPressed&&N.button===0&&w.target){if(xe(w.target,ae(N))&&w.pointerType!=null){let B=!1,z=setTimeout(()=>{w.isPressed&&w.target instanceof HTMLElement&&(B?T(N):(xt(w.target),w.target.click()))},80);b(N.currentTarget,"click",()=>B=!0,!0),w.disposables.push(()=>clearTimeout(z))}else T(N);w.isOverTarget=!1}},L=N=>{T(N)};R.onDragStart=N=>{xe(N.currentTarget,ae(N))&&T(N)}}return R},[b,l,x,k,y,D,h,$,K]);return c.useEffect(()=>{if(!f)return;const w=Ie(f.current);if(!w||!w.head||w.getElementById(kn))return;const R=w.createElement("style");R.id=kn;let O=dc(w);O&&(R.nonce=O),R.textContent=`
|
|
2
|
-
@layer {
|
|
3
|
-
[${jn}] {
|
|
4
|
-
touch-action: pan-x pan-y pinch-zoom;
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
`.trim(),w.head.prepend(R)},[f]),c.useEffect(()=>{let w=d.current;return()=>{y||bn(w.target??void 0);for(let R of w.disposables)R();w.disposables=[]}},[y]),{isPressed:u||p,pressProps:It(v,_,{[jn]:!0})}}function Hs(e){return e.tagName==="A"&&e.hasAttribute("href")}function gs(e,t){const{key:n,code:a}=e,r=t,o=r.getAttribute("role");return(n==="Enter"||n===" "||n==="Spacebar"||a==="Space")&&!(r instanceof Te(r).HTMLInputElement&&!Va(r,n)||r instanceof Te(r).HTMLTextAreaElement||r.isContentEditable)&&!((o==="link"||!o&&Hs(r))&&n!=="Enter")}function Ue(e,t){let n=t.clientX,a=t.clientY;return{currentTarget:e,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,altKey:t.altKey,clientX:n,clientY:a,key:t.key}}function mc(e){return e instanceof HTMLInputElement?!1:e instanceof HTMLButtonElement?e.type!=="submit"&&e.type!=="reset":!Hs(e)}function wn(e,t){return e instanceof HTMLInputElement?!Va(e,t):mc(e)}const pc=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Va(e,t){return e.type==="checkbox"||e.type==="radio"?t===" ":pc.has(e.type)}let hc=0;const xs=new Map;function gc(e){let[t,n]=c.useState();return Bs(()=>{if(!e)return;let a=xs.get(e);if(a)n(a.element.id);else{let r=`react-aria-description-${hc++}`;n(r);let o=document.createElement("div");o.id=r,o.style.display="none",o.textContent=e,document.body.appendChild(o),a={refCount:0,element:o},xs.set(e,a)}return a.refCount++,()=>{a&&--a.refCount===0&&(a.element.remove(),xs.delete(e))}},[e]),{"aria-describedby":e?t:void 0}}const xc=500;function bc(e){let{isDisabled:t,onLongPressStart:n,onLongPressEnd:a,onLongPress:r,threshold:o=xc,accessibilityDescription:i}=e;const l=c.useRef(void 0);let{addGlobalListener:u,removeGlobalListener:x}=Ga(),{pressProps:g}=fc({isDisabled:t,onPressStart(f){if(f.continuePropagation(),(f.pointerType==="mouse"||f.pointerType==="touch")&&(n&&n({...f,type:"longpressstart"}),l.current=setTimeout(()=>{f.target.dispatchEvent(new PointerEvent("pointercancel",{bubbles:!0})),Ie(f.target).activeElement!==f.target&&xt(f.target),r&&r({...f,type:"longpress"}),l.current=void 0},o),f.pointerType==="touch")){let v=m=>{m.preventDefault()},p=Te(f.target);u(f.target,"contextmenu",v,{once:!0}),u(p,"pointerup",()=>{setTimeout(()=>{x(f.target,"contextmenu",v)},30)},{once:!0})}},onPressEnd(f){l.current&&clearTimeout(l.current),a&&(f.pointerType==="mouse"||f.pointerType==="touch")&&a({...f,type:"longpressend"})}}),y=gc(r&&!t?i:void 0);return{longPressProps:It(g,y)}}const ts=fe("BadgeCheck",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const vc=fe("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);const yc=fe("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);const Ya=fe("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const Ja=fe("Forward",[["polyline",{points:"15 17 20 12 15 7",key:"1w3sku"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]]);const kc=fe("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);const jc=fe("MailCheck",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);const qs=fe("MailOpen",[["path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z",key:"1jhwl8"}],["path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10",key:"1qfld7"}]]);const Xa=fe("ReplyAll",[["polyline",{points:"7 17 2 12 7 7",key:"t83bqg"}],["polyline",{points:"12 17 7 12 12 7",key:"1g4ajm"}],["path",{d:"M22 18v-2a4 4 0 0 0-4-4H7",key:"1fcyog"}]]);const Qs=fe("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);const nt=fe("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);const wc=fe("ShieldQuestion",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const Cc=fe("ShieldX",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);const Nc=fe("TextSearch",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M10 12H3",key:"1ulcyk"}],["path",{d:"M10 18H3",key:"13769t"}],["circle",{cx:"17",cy:"15",r:"3",key:"1upz2a"}],["path",{d:"m21 19-1.9-1.9",key:"dwi7p8"}]]),Sc=({address:e,showTrustedBadge:t=!1})=>{const n=t?s.jsx(ts,{className:"inline-block size-4 ml-1 -mt-0.5 text-positive","aria-label":"Trusted sender","data-testid":"trusted-sender-badge"}):null;return e.displayName?s.jsxs("span",{children:[s.jsx("span",{className:"text-fg",children:e.displayName}),s.jsxs("span",{className:"text-fg-muted",children:[" ","<",e.normalizedEmail,">"]}),n]}):s.jsxs("span",{className:"text-fg",children:[e.normalizedEmail,n]})},Ic=({label:e,addresses:t,showTrustedBadge:n=!1})=>{const[a,r]=c.useState(!1);if(t.length===0)return null;const o=t.length>3,i=l=>{const u=n&&l.flags?.trusted?.value===!0;return s.jsx(Sc,{address:l,showTrustedBadge:u})};return s.jsxs("div",{className:"flex gap-2 text-sm",children:[s.jsxs("span",{className:"text-fg-muted shrink-0 w-12",children:[e,":"]}),s.jsx("div",{className:"flex-1 min-w-0",children:a?s.jsx("div",{className:"flex flex-wrap gap-1",children:t.map((l,u)=>s.jsxs("span",{children:[i(l),u<t.length-1&&", "]},u))}):s.jsx("div",{className:"truncate",children:t.map((l,u)=>s.jsxs("span",{children:[i(l),u<t.length-1&&", "]},u))})}),o&&s.jsx("button",{type:"button",onClick:l=>{l.stopPropagation(),r(!a)},className:"shrink-0 text-fg-muted hover:text-fg transition-colors","aria-label":a?"Collapse":"Expand",children:a?s.jsx(Ke,{className:"h-4 w-4"}):s.jsx(Ds,{className:"h-4 w-4"})})]})};function Tc({state:e,onRetry:t}){return s.jsxs("div",{role:"alert","data-testid":"attachment-error",className:"flex items-start gap-2 border-t border-danger/30 bg-danger-soft px-2 py-2 text-xs",children:[s.jsx(Kr,{className:"mt-0.5 size-3.5 shrink-0 text-danger","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"font-medium text-danger",children:e.title}),s.jsx("p",{className:"mt-0.5 text-fg-muted",children:e.detail})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[s.jsx("button",{type:"button",onClick:t,className:"font-medium text-accent hover:underline",children:"Try again"}),e.reportUrl&&s.jsx("a",{href:e.reportUrl,target:"_blank",rel:"noreferrer",className:"font-medium text-accent hover:underline",children:"Report this"})]})]})}function Rc({attachments:e,onDownload:t,hasUnlistedAttachment:n=!1,className:a}){return e.length===0&&!n?null:s.jsxs("section",{"aria-label":"Attachments","data-testid":"attachment-list",className:P("space-y-1.5",a),children:[s.jsxs("h3",{className:"flex items-center gap-1.5 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:[s.jsx(Zt,{className:"size-3","aria-hidden":!0}),e.length===0?"Attachment":e.length===1?"1 attachment":`${e.length} attachments`]}),e.length>0&&s.jsx("ul",{className:"overflow-hidden rounded-sm border border-line bg-surface",children:e.map(r=>{const o=r.download.status==="downloading";return s.jsxs("li",{className:"border-t border-line first:border-t-0",children:[s.jsxs("button",{type:"button",onClick:()=>t(r.attachmentId),disabled:o,"data-testid":"attachment-download","aria-label":`Download ${r.filename}`,className:"flex w-full items-center gap-2 px-2 py-2 text-left transition-colors hover:bg-surface-sunken disabled:cursor-progress disabled:opacity-60",children:[s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("bdi",{className:"block truncate text-sm text-fg",title:r.filename,children:r.filename}),s.jsxs("span",{className:"block truncate text-2xs text-fg-subtle",children:[r.typeLabel," ·"," ",Fi(r.sizeOctets)]})]}),o?s.jsx(na,{className:"size-4 shrink-0 animate-spin text-fg-subtle","aria-hidden":!0}):s.jsx(Bi,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0})]}),r.download.status==="failed"&&s.jsx(Tc,{state:r.download,onRetry:()=>t(r.attachmentId)})]},r.attachmentId)})}),n&&s.jsx("p",{role:"alert","data-testid":"attachment-unlisted",className:"rounded-sm border border-line bg-surface px-2 py-2 text-xs text-fg-muted",children:"The mail server says this message carries an attachment, but none of its parts describe one. Re-sync the account from Settings; if the attachment still does not appear, the message is worth reporting."})]})}function Ec({label:e,onUndo:t,undoLabel:n="Undo",filtersHref:a,className:r}){return s.jsxs(we,{tone:"accent",className:P("py-1 text-xs",r),children:[s.jsx(Ui,{className:"size-3.5 shrink-0","aria-hidden":!0}),s.jsx("span",{children:e}),t&&s.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t()},className:"font-semibold underline decoration-dotted underline-offset-2 hover:decoration-solid",children:n}),a&&s.jsx("a",{href:a,onClick:o=>{o.stopPropagation()},className:"font-semibold underline decoration-dotted underline-offset-2 hover:decoration-solid",children:"Manage filter"})]})}const Cn=10,Mc={kind:"unknown"},bs=e=>e.toLocaleString();function Ac({section:e,Row:t,selectedThreadId:n,initialExpanded:a=!1,initialCollapsed:r=!1,onShowAll:o,onRetry:i,onSelectThread:l}){const[u,x]=c.useState(a),[g,y]=c.useState(r),f=e.threads,v=e.loading===!0,p=e.error===!0,m=f.length>Cn,b=!u&&m?f.slice(0,Cn):f,k=e.total??Mc,h=k.kind==="exact"&&(f.length>0||v)&&!p?bs(k.value):void 0,j=k.kind==="exact"?k.value>b.length:e.atCap===!0,S=o!==void 0&&b.length>0&&j?k.kind==="exact"?`Show all ${bs(k.value)}`:"Show all":void 0,I=f.length-b.length;return s.jsxs("div",{children:[e.label&&s.jsxs("button",{type:"button","data-section-header":"","aria-expanded":!g,onClick:()=>y(A=>!A),className:"sticky top-0 z-10 flex h-section-row w-full items-center gap-1.5 border-b border-line bg-surface-sunken px-row-inset text-left outline-none transition-colors hover:bg-surface focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",children:[s.jsx("span",{className:"flex-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:e.label}),h!==void 0&&s.jsx("span",{className:"text-2xs text-fg-subtle tabular-nums",children:h}),s.jsx(Ke,{className:P("size-3 shrink-0 text-fg-subtle transition-transform duration-200",g?"rotate-0":"rotate-180")})]}),!g&&s.jsxs(s.Fragment,{children:[f.length===0?p?s.jsxs("div",{className:"flex flex-col items-center gap-1 border-b border-line px-row-inset py-4 text-center text-2xs text-danger",children:[s.jsx("span",{children:`Couldn't load ${e.label??"these messages"}`}),i&&s.jsx("button",{type:"button",onClick:i,className:"font-medium text-accent underline outline-none focus-visible:ring-2 focus-visible:ring-ring",children:"Try again"})]}):v?s.jsx("div",{className:"animate-pulse divide-y divide-line",children:[0,1,2].map(A=>s.jsx("div",{className:"px-row-inset py-3",children:s.jsx("div",{className:"h-3 w-2/3 rounded bg-surface-sunken"})},A))}):s.jsx("p",{className:"border-b border-line px-row-inset py-4 text-center text-2xs text-fg-subtle",children:e.label?`No ${e.label} mail in this brief.`:"No mail in this brief."}):s.jsx("div",{className:"divide-y divide-line",children:b.map(A=>s.jsx(t,{thread:A,active:A.id===n,onClick:()=>l?.(A.id)},A.id))}),S!==void 0?s.jsxs("button",{type:"button",onClick:o,className:"flex w-full items-center justify-center border-b border-line px-row-inset py-1.5 text-2xs font-medium text-accent outline-none transition-colors hover:bg-surface focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",children:[S,s.jsx(Ds,{className:"ml-1 size-3"})]}):m&&s.jsxs("button",{type:"button",onClick:()=>x(A=>!A),className:"flex w-full items-center justify-center border-b border-line px-row-inset py-1.5 text-2xs font-medium text-accent outline-none transition-colors hover:bg-surface focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",children:[u?"Show less":`Show ${bs(I)} more`,!u&&s.jsx(Ke,{className:"ml-1 size-3"})]})]})]})}function zp({sections:e,briefCategory:t="all",selectedThreadId:n,Row:a,keyboard:r,onSelectThread:o,onShowAllSection:i,onRetrySection:l,flat:u=!1,onSelectBriefCategory:x,sources:g,sourcesNote:y,onSelectSource:f,activeFilters:v,onToggleFilter:p,onClearFilters:m,hideChrome:d,defaultExpanded:b=!1}){const[k,h]=c.useState(b),j=c.useRef(null);hi({containerRef:j,itemSelector:gi,enabled:!Hr(r)});const S=!u&&(t==="all"||e.some($=>$.total!==void 0)),I=e.filter($=>$.threads.length>0||$.total!==void 0||$.loading===!0||$.error===!0),A=e.flatMap($=>$.threads),M=ra,T=S?I.length===0:A.length===0,D=s.jsxs("div",{ref:j,children:[S?I.map($=>s.jsx(Ac,{section:$,Row:a,selectedThreadId:n,onSelectThread:o,onShowAll:i?()=>i($.id):void 0,onRetry:l?()=>l($.id):void 0},$.id)):s.jsx("div",{className:"divide-y divide-line",children:A.map($=>s.jsx(a,{thread:$,active:$.id===n,onClick:()=>o?.($.id)},$.id))}),T&&s.jsx("div",{className:"px-row-inset py-6 text-center text-2xs text-fg-subtle",children:"No threads match these filters."})]});return s.jsx(aa,{categories:[...Wt],filters:M,sources:g,sourcesNote:y,selectedCategory:t,activeFilters:v,expanded:k,onExpandedChange:h,onSelectCategory:$=>x?.($),onSelectSource:f,onToggleFilter:$=>p($),onClear:m,hideChrome:d,children:D})}const $c={ics:"Attached invitation",markup:"Structured markup",pattern:"Read from the words"},Lc={ics:qr,markup:yc,pattern:Nc},Pc={ics:"border-positive/50 text-positive",markup:"border-accent-2/50 text-accent-2",pattern:"border-warning/50 text-warning"};function Dc({method:e,className:t}){const n=Lc[e];return s.jsxs("span",{className:P("inline-flex items-center gap-1 rounded-sm border px-1.5 py-0.5 text-2xs font-medium",Pc[e],t),children:[s.jsx(n,{className:"size-3","aria-hidden":!0}),$c[e]]})}const Fc=["accepted","tentative","declined","noReply"],Oc={accepted:"coming",tentative:"maybe",declined:"not coming",noReply:"no reply"};function zc({invite:e,whenText:t,calendarName:n,color:a,clashes:r,rsvp:o,onAdd:i,onTentative:l,onDecline:u,onReopen:x,onOfferOtherTimes:g,mute:y,onRemove:f,onOpenNewer:v,guests:p,busy:m=!1,failure:d="",reportHref:b,addBlocked:k,touch:h,className:j}){const S=il(a),I=e.state==="superseded"||e.state==="cancelled",A=e.proposed.attendees,M=Fc.map(T=>({state:T,count:A.filter(D=>D.rsvp===T).length})).filter(T=>T.count>0).map(T=>`${T.count} ${Oc[T.state]}`).join(" · ");return s.jsxs("section",{className:P("flex flex-col gap-3 rounded-lg border border-line bg-surface-raised p-3",j),children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:P("size-2.5 shrink-0 rounded-full",S.solid)}),s.jsxs("span",{className:"min-w-0 flex-1 truncate text-2xs uppercase tracking-wider text-fg-subtle",children:["Invitation from ",e.organizerName," · ",n]}),s.jsx(Dc,{method:e.method})]}),s.jsxs("div",{className:P(I&&"opacity-60"),children:[s.jsx("h3",{className:"text-md font-semibold text-fg",children:e.proposed.title}),s.jsxs("p",{className:"mt-1 flex items-center gap-2 text-sm text-fg",children:[s.jsx(Da,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),t]}),e.proposed.location!==""&&s.jsxs("p",{className:"mt-1 flex items-center gap-2 text-sm text-fg-muted",children:[s.jsx(ml,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.proposed.location]})]}),e.state==="superseded"&&s.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-warning/40 bg-warning-soft p-2",children:[s.jsx(kc,{className:"mt-0.5 size-4 shrink-0 text-warning","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"text-xs font-semibold text-warning",children:[e.organizerName," has sent a newer version of this."]}),s.jsxs("p",{className:"mt-1 text-xs text-fg",children:["This one is revision ",e.sequence," and is out of date. The newer message carries the one to answer."]}),v&&s.jsx(H,{variant:"secondary",size:h?"md":"sm",onClick:v,className:P("mt-2",h&&"min-h-11"),children:"Open the newer invitation"})]})]}),e.state==="cancelled"&&s.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft p-2",children:[s.jsx(Xe,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"text-xs font-semibold text-danger",children:[e.organizerName," cancelled this."]}),s.jsx("p",{className:"mt-1 text-xs text-fg",children:"It is still on your calendar. Nothing comes off it until you say so."}),f&&s.jsxs("div",{className:P("mt-2 flex gap-2",h&&"flex-wrap"),children:[s.jsx(H,{variant:"primary",size:h?"md":"sm",icon:s.jsx(vt,{className:"size-3.5"}),onClick:f,disabled:m||k!==void 0,className:P(h&&"min-h-11 flex-1"),children:"Remove from calendar"}),x&&s.jsx(H,{variant:"secondary",size:h?"md":"sm",onClick:x,disabled:m,className:P(h&&"min-h-11 flex-1"),children:"Keep it"})]})]})]}),!I&&s.jsx(fl,{clashes:r}),p??(A.length>0&&s.jsxs("p",{className:"text-2xs uppercase tracking-wider text-fg-subtle",children:[A.length," guests",M===""?"":` · ${M}`]})),d!==""&&s.jsx(ws,{text:d,reportHref:b}),k!==void 0&&s.jsx("div",{className:"rounded-md border border-warning/40 bg-warning-soft p-2 text-xs text-fg",children:k}),!I&&(o==="noReply"?s.jsxs("div",{className:"flex flex-col gap-2 border-t border-line pt-3",children:[s.jsxs("div",{className:P("flex gap-2",h&&"flex-wrap"),children:[s.jsx(H,{variant:"primary",size:h?"md":"sm",icon:s.jsx(vc,{className:"size-3.5"}),onClick:i,disabled:m||k!==void 0,className:P(h&&"min-h-11 flex-1"),children:"Add to calendar"}),l&&s.jsx(H,{variant:"secondary",size:h?"md":"sm",onClick:l,disabled:m||k!==void 0,className:P(h&&"min-h-11 flex-1"),children:"Maybe"}),s.jsx(H,{variant:"secondary",size:h?"md":"sm",icon:s.jsx(Xe,{className:"size-3.5"}),onClick:u,disabled:m,className:P(h&&"min-h-11 flex-1"),children:"Decline"})]}),s.jsx(H,{variant:"ghost",size:h?"md":"sm",onClick:g,className:P("self-start",h&&"min-h-11 w-full"),children:"Offer other times"}),y&&s.jsx(H,{variant:"ghost",size:h?"md":"sm",icon:s.jsx(Fa,{className:"size-3.5"}),onClick:y.onMute,disabled:m,className:P("self-start",h&&"min-h-11 w-full"),children:`Stop offering invitations from ${y.sender}`}),s.jsxs("p",{className:"text-2xs text-fg-subtle",children:[e.organizerName," is not notified. Reader writes this to your calendar and sends no reply — tell them in the thread."]})]}):s.jsxs("div",{className:"flex flex-col gap-2 border-t border-line pt-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-fg",children:[o==="declined"?"You declined":"On your calendar",s.jsx(ul,{rsvp:o})]}),x&&s.jsx(H,{variant:"ghost",size:h?"md":"sm",onClick:x,disabled:m,className:h?"min-h-11":"",children:"Change"}),o==="declined"&&s.jsx(H,{variant:"secondary",size:h?"md":"sm",onClick:g,className:h?"min-h-11":"",children:"Offer other times"})]}),s.jsxs("p",{className:"flex items-start gap-1.5 text-2xs text-fg-subtle",children:[s.jsx(Gt,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),e.organizerName," was not notified."]})]}))]})}function _c({slots:e,picked:t,onToggle:n,emptyText:a="Nothing free that day at this length.",touch:r,scroll:o,className:i}){return e.length===0?s.jsx("p",{className:P("text-xs text-fg-muted",i),children:a}):s.jsx("div",{className:P("flex gap-2",o?"overflow-x-auto pb-1":"flex-wrap",i),children:e.map(l=>{const u=t.has(l.startTime);return s.jsxs("button",{type:"button","aria-pressed":u,onClick:()=>n(l),className:P("shrink-0 rounded-md border px-2 text-xs tabular-nums outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",r?"min-h-11 px-3":"h-7",u?"border-accent bg-accent-soft font-semibold text-accent":"border-line bg-surface text-fg-muted hover:border-line-strong hover:text-fg"),children:[l.startTime," – ",l.endTime]},l.startTime)})})}function be({label:e,children:t,className:n}){return s.jsxs("section",{className:P("border-b border-line px-row-inset py-3",n),children:[s.jsx("h3",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:e}),s.jsx("div",{className:"mt-2",children:t})]})}function Uc({data:e,actions:t,selectedEventId:n="",touch:a,className:r}){const{invite:o,prose:i,suggestions:l,day:u,dayLabel:x,suggestionsBusy:g=!1,failure:y="",suggestionsFailure:f="",reportHref:v,addBlocked:p}=e,{onReviewSuggestion:m,onOpenThread:d}=t,[b,k]=c.useState({}),h=l[0],j=h===void 0?"":b[h.suggestion.id]??"",S=h===void 0?void 0:Hi(h.suggestion,j),I=new Set(i?.picked??[]);return y===""&&o===void 0&&i===void 0&&l.length===0&&u.length===0?s.jsxs("div",{className:P("flex flex-1 flex-col items-center justify-center gap-2 px-row-inset py-10 text-center",r),children:[s.jsx(Qr,{className:"size-6 text-fg-subtle","aria-hidden":!0}),s.jsx("p",{className:"text-sm text-fg-muted",children:"Nothing in this message is about a time."}),s.jsx("p",{className:"text-2xs text-fg-subtle",children:"An invitation, a booking or a thread proposing hours would show up here, with the day it lands on."})]}):s.jsxs("div",{className:P("flex flex-col",r),children:[y!==""&&s.jsx(ws,{text:y,reportHref:v,className:"mx-row-inset mt-3"}),o&&s.jsx(be,{label:"Invitation",children:s.jsx(zc,{invite:o.invite,whenText:o.whenText,calendarName:o.calendarName,color:o.color,clashes:o.clashes,rsvp:o.rsvp,busy:o.busy,failure:o.failure,reportHref:o.reportHref,addBlocked:o.addBlocked,mute:t.onMuteInvite&&o.sender?{sender:o.sender,onMute:t.onMuteInvite}:void 0,onAdd:t.onAddInvite,onTentative:t.onTentativeInvite,onDecline:t.onDeclineInvite,onReopen:t.onReopenInvite,onOfferOtherTimes:t.onOfferOtherTimes,onRemove:t.onRemoveInvite,onOpenNewer:t.onOpenNewerInvite,touch:a})}),i&&s.jsxs(be,{label:i.proposals.length>0?`Times named · ${i.dayLabel}`:`Other times · ${i.dayLabel}`,children:[s.jsx("ul",{className:P("flex flex-col gap-1",i.proposals.length===0&&"hidden"),children:i.proposals.map(M=>s.jsxs("li",{className:"flex items-baseline gap-2 text-xs",children:[s.jsx("span",{className:"w-24 shrink-0 truncate tabular-nums text-fg",children:M.phrase}),M.clashTitle===""?s.jsx("span",{className:"min-w-0 flex-1 truncate text-positive",children:"Nothing booked"}):s.jsxs("span",{className:"min-w-0 flex-1 truncate text-danger",children:[M.clashTitle," is already there"]})]},M.id))}),s.jsx("p",{className:"mt-3 pb-1.5 text-2xs uppercase tracking-wider text-fg-subtle",children:"Free, half an hour each"}),s.jsx(_c,{slots:i.slots,picked:I,onToggle:t.onToggleSlot,touch:a,scroll:!0}),t.onReplyWithSlots?s.jsxs("div",{className:"mt-2 flex flex-col gap-1.5",children:[s.jsx(H,{variant:"secondary",size:a?"md":"sm",icon:s.jsx(Qs,{className:"size-3.5"}),onClick:t.onReplyWithSlots,disabled:I.size===0,className:P("self-start",a&&"min-h-11"),children:"Reply with these times"}),s.jsx("p",{className:"text-2xs text-fg-subtle",children:"Picked slots go into the reply as plain text. Nothing is booked."})]}):s.jsx("p",{className:"mt-1.5 text-2xs text-fg-subtle",children:"Picked slots go into the reply as plain text. Nothing is booked."})]}),l.length>0&&s.jsxs(be,{label:"Read out of this thread",children:[s.jsx(qi,{hasCard:h!==void 0,remaining:l.length,blocked:S!==void 0&&!S.settled,blockedReason:Qi,onConfirm:()=>{h&&S?.settled&&p===void 0&&t.onAddSuggestion(h.suggestion.id,S.timeZone)},onReject:()=>{h&&t.onDismissSuggestion(h.suggestion.id)},children:h&&s.jsx(Wi,{suggestion:h.suggestion,whenText:h.whenText,addLabel:"Add to calendar",zoneChoice:j,onZoneChoice:M=>k(T=>({...T,[h.suggestion.id]:M})),onAdd:M=>t.onAddSuggestion(h.suggestion.id,M),onReview:m&&(M=>m(h.suggestion.id,M)),onDismiss:()=>t.onDismissSuggestion(h.suggestion.id),onOpenThread:d&&(()=>d(h.suggestion.threadId)),busy:g,addBlocked:p!==void 0,touch:a})}),p!==void 0&&s.jsx("div",{className:"mt-2 rounded-md border border-warning/40 bg-warning-soft p-2 text-xs text-fg",children:p}),f!==""&&s.jsx(ws,{text:f,reportHref:v,className:"mt-2"}),s.jsx("p",{className:"mt-2 text-2xs text-fg-subtle",children:"None of this is on your calendar, and none of it will be until you say so."})]}),u.length>0&&s.jsx(be,{label:x,className:"border-b-0",children:s.jsx("ul",{className:"flex flex-col gap-1",children:u.map(M=>s.jsx("li",{children:s.jsx(Gi,{title:M.event.title,timeText:M.timeText,color:M.color,layout:"row",density:"compact",rsvp:M.event.myRsvp,status:M.event.status,hasThread:M.event.threadId!=="",isRecurring:M.event.recurrenceRule!=="",zoneCertainty:M.event.zoneCertainty,selected:M.event.id===n,onClick:()=>t.onSelectEvent(M.event.id)})},M.event.id))})})]})}const Bc=[{value:"sender",label:"Sender"},{value:"calendar",label:"Calendar"}],Kc={unknown:{label:"Unknown sender",tone:"neutral"},wellknown:{label:"Known sender",tone:"positive"},vip:{label:"VIP",tone:"accent"}};function Hc({sender:e}){const t=Kc[e.trust],n=e.inboundCount==null?null:(e.replyCount??0)>0?`${e.inboundCount} received · you replied ${e.replyCount}×`:`${e.inboundCount} received · you've never replied`;return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(gt,{name:e.name,email:e.email,size:"md"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"truncate text-sm font-semibold text-fg",children:e.name}),s.jsx("div",{className:"truncate text-2xs text-fg-subtle",children:e.email})]})]}),s.jsx("div",{className:"mt-2 flex items-center gap-2",children:e.addressUnverified?s.jsx(we,{tone:"danger",dot:!0,children:"Address couldn't be verified"}):s.jsx(we,{tone:t.tone,dot:!0,children:t.label})}),s.jsxs("p",{className:"mt-2 text-xs text-fg-muted",children:["First seen ",e.firstSeenLabel,n?` · ${n}`:""]})]})}function qc({auth:e,onShowSimilar:t}){if(e.verdict==="aligned")return s.jsxs("div",{className:"flex items-start gap-2 text-xs text-fg-muted",children:[s.jsx(hl,{className:"mt-0.5 size-3.5 shrink-0 text-positive"}),s.jsx("span",{children:e.summary})]});if(e.verdict==="caution")return s.jsxs("div",{className:"flex items-start gap-2 rounded-md bg-warning/10 p-3 text-warning",children:[s.jsx(wc,{className:"mt-0.5 size-4 shrink-0"}),s.jsx("p",{className:"text-xs leading-relaxed",children:e.summary})]});const n=e.addressUnreadable?"This sender can't be verified":"This message may be impersonating someone";return s.jsxs("div",{className:"rounded-md bg-danger-soft p-3",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(nt,{className:"mt-0.5 size-4 shrink-0 text-danger"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-danger",children:n}),s.jsx("p",{className:"mt-1 text-xs leading-relaxed text-fg",children:e.summary}),!e.addressUnreadable&&e.dkimDomain&&s.jsxs("p",{className:"mt-1 text-2xs text-fg-muted",children:["Sent from"," ",s.jsx("code",{className:"rounded bg-surface px-1 py-0.5",children:e.dkimDomain}),", claims to be"," ",s.jsx("code",{className:"rounded bg-surface px-1 py-0.5",children:e.fromDomain})]})]})]}),e.similarCount!=null&&e.similarCount>0&&s.jsxs(H,{variant:"secondary",size:"sm",className:"mt-2 w-full border-danger/30 text-danger hover:bg-danger-soft",onClick:t,children:[e.similarCount," similar messages"]})]})}function Ot({icon:e,label:t,active:n,danger:a,onClick:r,pending:o}){const i=r===void 0||o===!0;return s.jsxs("button",{type:"button",onClick:r,disabled:i,className:P("flex items-center gap-2 rounded-md border px-2 py-1 text-xs transition-colors",n?"border-accent-2 bg-accent-2-soft text-accent-2":"border-line text-fg-muted hover:border-line-strong hover:text-fg",a&&!n&&"text-danger hover:bg-danger-soft",i&&"cursor-not-allowed opacity-50 hover:border-line"),children:[e,t]})}const Qc={sender:"matched: sender",recipient:"matched: recipient",subject:"matched: subject",attachment:"matched: attachment",body:"matched: body",entities:"matched: entities"};function Za({data:e,onClose:t,onShowSimilar:n,actions:a,similarState:r="ready",similarLinkComponent:o,className:i,hideCloseButton:l=!1,reportSpamPending:u=!1,notSpamPending:x=!1,calendar:g,tab:y,onTabChange:f,defaultTab:v="sender",touch:p}){const{sender:m,authenticity:d,category:b,flags:k={},similar:h}=e,[j,S]=c.useState(v),I=c.useId(),A=y??j,M=g!==void 0&&A==="calendar"?g:void 0;return s.jsxs("aside",{className:P("flex w-76 shrink-0 flex-col overflow-y-auto border-l border-line bg-surface",i),children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-row-inset",children:[s.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Intelligence"}),!l&&s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(Xe,{className:"size-3.5"}),onClick:t,"aria-label":"Collapse intelligence sidebar"})]}),g&&s.jsx("div",{className:"flex shrink-0 justify-center border-b border-line px-row-inset py-2",children:s.jsx(Wr,{name:I,"aria-label":"What this panel is showing",size:"sm",options:Bc,value:A,onChange:T=>{y===void 0&&S(T),f?.(T)}})}),M&&s.jsx(Uc,{data:M.data,actions:M.actions,selectedEventId:M.selectedEventId,touch:p}),M===void 0&&s.jsxs(s.Fragment,{children:[s.jsx(be,{label:"Sender",children:s.jsx(Hc,{sender:m})}),s.jsx(be,{label:"Authenticity",children:s.jsx(qc,{auth:d,onShowSimilar:n})}),s.jsx(be,{label:"Category",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(we,{tone:oa[b.value],children:Vt[b.value]}),b.overridden&&s.jsx("span",{className:"text-2xs text-fg-subtle",children:"your override"}),s.jsx("button",{type:"button",className:P("ml-auto text-2xs text-accent hover:underline",!a?.onReclassify&&"cursor-not-allowed opacity-50 hover:no-underline"),disabled:!a?.onReclassify,onClick:a?.onReclassify,children:"reclassify"})]})}),s.jsxs(be,{label:"Quick actions",children:[s.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[s.jsx(Ot,{icon:s.jsx(et,{className:"size-3.5"}),label:"VIP",active:k.vip,onClick:a?.onToggleVip}),s.jsx(Ot,{icon:s.jsx(Fa,{className:"size-3.5"}),label:"Mute",active:k.muted,onClick:a?.onToggleMute}),a?.onNotSpam&&s.jsx(Ot,{icon:s.jsx(jc,{className:"size-3.5"}),label:x?"Undoing…":"Not spam",active:!0,onClick:a.onNotSpam,pending:x}),a?.onReportSpam&&s.jsx(Ot,{icon:s.jsx(Cc,{className:"size-3.5"}),label:u?"Reporting…":"Report spam",danger:!0,onClick:a.onReportSpam,pending:u})]}),a?.onNotSpam&&s.jsx("p",{className:"mt-1.5 text-2xs text-fg-subtle",children:"You reported this message as spam"})]}),(r!=="ready"||h.length>0)&&s.jsx(be,{label:"Similar messages",children:r==="loading"?s.jsx("div",{className:"animate-pulse space-y-2",children:Array.from({length:3}).map((T,D)=>s.jsxs("div",{className:"space-y-1",children:[s.jsx("div",{className:"h-3 w-3/4 rounded bg-surface-sunken"}),s.jsx("div",{className:"h-2.5 w-1/2 rounded bg-surface-sunken"})]},D))}):r==="error"?s.jsx("p",{className:"text-xs text-fg-subtle",children:"Similarity search unavailable"}):r==="off"?s.jsxs("div",{className:"space-y-1.5 text-xs text-fg-subtle",children:[s.jsx("p",{className:"text-fg-muted",children:Gr}),s.jsx("p",{children:Vr}),s.jsxs("p",{children:["Run"," ",s.jsx("code",{className:"rounded bg-surface-sunken px-1 py-px text-2xs text-fg-muted",children:Yr})," ","on the server."]})]}):s.jsx("ul",{className:"-mx-1 space-y-1",children:h.map(T=>{const D="block w-full rounded-md px-1 py-1 text-left hover:bg-surface-sunken",$=`Open message from ${T.fromName||"unknown sender"}: ${T.subject}`,K=s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[s.jsx("span",{className:"truncate text-xs font-medium text-fg",children:T.fromName}),s.jsx("span",{className:"shrink-0 text-2xs text-fg-subtle tabular-nums",children:T.timeLabel})]}),s.jsx("div",{className:"truncate text-xs text-fg-muted",children:T.subject}),s.jsx("span",{className:"mt-1 inline-block rounded-full bg-surface-sunken px-1.5 py-px text-2xs text-fg-subtle",children:Qc[T.matched]})]});return s.jsx("li",{children:o?o({mailboxId:T.mailboxId,threadId:T.threadId,messageId:T.id,className:D,ariaLabel:$,children:K}):s.jsx("div",{className:D,children:K})},T.id)})})}),s.jsx(be,{label:"Coming soon",className:"border-b-0 opacity-70",children:s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-dashed border-line p-2",children:[s.jsx(Ze,{className:"mt-0.5 size-3.5 shrink-0 text-fg-subtle"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-xs font-medium text-fg-muted",children:"Suggested actions"}),s.jsx("div",{className:"text-2xs text-fg-subtle",children:'"Create a filter for messages like this" — on-device model'})]})]}),s.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-dashed border-line p-2",children:[s.jsx(Ze,{className:"mt-0.5 size-3.5 shrink-0 text-fg-subtle"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-xs font-medium text-fg-muted",children:"Thread summary"}),s.jsx("div",{className:"text-2xs text-fg-subtle",children:"One-paragraph digest — Bedrock"})]})]})]})})]})]})}function Wc({open:e=!1,enabled:t=!0,onToggle:n,className:a}){return s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(ia,{className:"size-4"}),title:"Intelligence","aria-label":e?"Hide intelligence sidebar":"Show intelligence sidebar","aria-pressed":e,disabled:!t,onClick:n,className:P(e&&"bg-accent-2-soft text-accent-2",a)})}function _p({hints:e=bi,className:t}){return e.length===0?null:s.jsx("footer",{className:P("flex items-center gap-2 border-t border-line px-row-inset py-1 text-2xs text-fg-subtle",t),children:e.map(n=>s.jsx(Gc,{hint:n},n.label))})}function Gc({hint:e}){return s.jsxs("span",{className:"flex items-center gap-1",children:[e.keys.map(t=>s.jsx(Si,{children:t},t)),s.jsx("span",{children:e.label})]})}function Vc({hasThread:e,onUnavailable:t,unavailableHint:n,isStarred:a,showTriage:r=!0,onReply:o,onReplyAll:i,onForward:l,onDelete:u,onToggleStar:x,moveSlot:g,onMove:y,replyTitle:f="Reply (r)",replyAllTitle:v="Reply all (a)",forwardTitle:p="Forward (f)",deleteTitle:m="Move to Trash (#)",flagTitle:d="Star (s)",children:b,className:k}){const h=(j,S)=>()=>{if(!e||!S){t?.(j);return}S()};return s.jsxs("div",{className:"relative",children:[s.jsxs("header",{className:P("flex h-pane-header shrink-0 items-center gap-1 border-b border-line bg-surface px-3",k),children:[s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(Qs,{className:"size-4"}),title:f,"aria-label":"Reply",onClick:h("reply",o)}),s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(Xa,{className:"size-4"}),title:v,"aria-label":"Reply all",onClick:h("replyAll",i)}),s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(Ja,{className:"size-4"}),title:p,"aria-label":"Forward",onClick:h("forward",l)}),r&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"mx-1 h-4 w-px bg-line","aria-hidden":!0}),s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(vt,{className:"size-4"}),title:m,"aria-label":"Move to Trash",onClick:h("delete",u)}),g??s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(Fs,{className:"size-4"}),title:"Move to mailbox","aria-label":"Move to mailbox",onClick:h("move",y)}),s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(et,{className:P("size-4",a&&"fill-warning text-warning")}),title:d,"aria-label":"Star","aria-pressed":a,onClick:h("flag",x)})]}),s.jsx("div",{className:"flex-1"}),b]}),n&&s.jsx("p",{role:"status",className:"border-b border-line bg-surface-sunken px-3 py-1 text-2xs text-fg-subtle",children:n})]})}const Is=e=>({shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey}),Nn=e=>e.shiftKey||e.metaKey||e.ctrlKey,Yc=e=>e.shiftKey?"range":e.metaKey||e.ctrlKey?"toggle":"open",Jc=(e,t)=>!t&&e>0,Xc=(e,t,n)=>{const a=e.indexOf(n);if(a===-1)return[];const r=t===void 0?-1:e.indexOf(t);if(r===-1)return[n];const o=Math.min(r,a),i=Math.max(r,a);return e.slice(o,i+1)},Zc=(e,t,n,a)=>t!==void 0&&e.includes(t)?t:n!==void 0&&e.includes(n)?n:a,ed=(e,t)=>{const n=new Set(t),a=new Set;for(const r of e)n.has(r)&&a.add(r);return a},td=(e,t,n)=>{if(e.length===0)return;const a=t===void 0?-1:e.indexOf(t);if(a===-1)return n>0?e[0]:e[e.length-1];const r=Math.min(Math.max(a+n,0),e.length-1);return e[r]},sd=e=>{const[t,n]=c.useState(()=>new Set(e?.initialSelectedIds)),[a,r]=c.useState(void 0),o=c.useCallback(m=>t.has(m),[t]),i=c.useCallback(m=>{r(m),n(d=>{const b=new Set(d);return b.has(m)?b.delete(m):b.add(m),b})},[]),l=c.useCallback(m=>{r(m),n(d=>{if(d.has(m))return d;const b=new Set(d);return b.add(m),b})},[]),u=c.useCallback(m=>{n(d=>{if(!d.has(m))return d;const b=new Set(d);return b.delete(m),b})},[]),x=c.useCallback(m=>{n(new Set(m))},[]),g=c.useCallback(()=>{r(void 0),n(new Set)},[]),y=c.useCallback(m=>{n(d=>m.every(k=>d.has(k))?new Set:new Set(m))},[]),f=c.useCallback(m=>{r(m)},[]),v=c.useCallback(m=>{n(d=>{if(d.size===0)return d;const b=ed(d,m);return b.size===d.size?d:b})},[]),p=c.useCallback((m,d,b)=>{const k=Zc(m,a,b,d);n(h=>{const j=Xc(m,k,d);if(j.length===0)return h;const S=new Set(h);for(const I of j)S.add(I);return S}),r(k)},[a]);return{selectedIds:t,selectedCount:t.size,hasSelection:t.size>0,isSelected:o,toggle:i,select:l,deselect:u,selectAll:x,clearSelection:g,toggleAll:y,selectRange:p,setAnchor:f,anchorId:a,intersectWith:v}},Ht={delete_failed:{label:"Not deleted",title:"This message was not deleted",detail:"Remit removed it here first, then refused to finish the delete on the mail server — most often because the Trash folder it was headed for is not there any more. The message is back in this folder because that is where the server still has it.",retryLabel:"Delete again",retryPendingLabel:"Deleting…"},move_failed:{label:"Not moved",title:"This message was not moved",detail:"Remit filed it here first, then could not finish the move on the mail server and stopped trying. The message is back in this folder because that is where the server still has it. The folder you picked is not recorded, so moving it again means choosing one.",retryLabel:"Move again",retryPendingLabel:"Moving…"}};function er({settlement:e,className:t}){const n=Ht[e];return s.jsxs(we,{tone:"danger",className:P("shrink-0",t),title:n.title,"data-settlement":e,children:[s.jsx(Oa,{className:"size-3 shrink-0","aria-hidden":!0}),s.jsx("span",{children:n.label})]})}function nd({settlement:e,onRetry:t,action:n,retryPending:a,reportHref:r,className:o}){const i=Ht[e];return s.jsxs("div",{role:"alert","data-testid":"message-settlement-notice","data-settlement":e,className:P("flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",o),children:[s.jsx(Oa,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"font-medium text-danger",children:i.title}),s.jsx("p",{className:"mt-1 break-words text-fg-muted",children:i.detail}),s.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-3",children:[n,t&&s.jsx("button",{type:"button",onClick:t,disabled:a,className:"font-medium text-accent hover:underline disabled:opacity-50",children:a?i.retryPendingLabel:i.retryLabel}),r&&s.jsx("a",{href:r,target:"_blank",rel:"noreferrer",className:"font-medium text-accent hover:underline",children:"Report an issue"})]})]})]})}const tr="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",sr=({active:e,focused:t})=>P("relative flex h-8 w-full items-center gap-2 px-row-inset text-left",tr,e?"bg-accent-2-soft":t?"bg-surface-sunken":"hover:bg-surface-sunken",t&&!e&&"before:absolute before:inset-y-0 before:left-0 before:w-0.5 before:bg-accent-2"),Ws=({active:e,focused:t})=>P("relative flex w-full items-start gap-3 py-2 pl-5 pr-row-inset text-left transition-colors",tr,e?"bg-accent-2-soft":t?"bg-surface-sunken":"hover:bg-surface-sunken",t&&!e&&"before:absolute before:inset-y-0 before:left-0 before:w-0.5 before:bg-accent-2");function nr({thread:e}){const t=!e.isRead;return s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"flex w-4 shrink-0 items-center justify-center",children:e.suspicious?s.jsx(nt,{className:"size-3.5 text-danger"}):e.starred?s.jsx(et,{className:"size-3 fill-warning text-warning"}):t?s.jsx("span",{className:"size-1.5 rounded-full bg-accent"}):null}),s.jsx("span",{className:P("w-36 shrink-0 truncate text-xs",t?"font-semibold text-fg":"text-fg-muted"),children:e.fromName}),s.jsxs("span",{className:"min-w-0 flex-1 truncate text-xs",children:[s.jsx("span",{className:P(t?"font-medium text-fg":"text-fg-muted"),children:e.subject}),s.jsxs("span",{className:"text-fg-subtle",children:[" — ",e.snippet]})]}),e.hasAttachment&&s.jsx(Zt,{className:"size-3 shrink-0 text-fg-subtle",role:"img","aria-label":"Has an attachment"}),e.settlement&&s.jsx(er,{settlement:e.settlement}),s.jsx("span",{className:"w-11 shrink-0 text-right text-2xs text-fg-subtle tabular-nums",children:e.timeLabel})]})}function Sn(e,t){const n=t?.trim();if(!n)return e;const a=e.toLowerCase(),r=n.toLowerCase(),o=[];let i=0,l=a.indexOf(r,i),u=0;for(;l!==-1;)l>i&&o.push(e.slice(i,l)),o.push(s.jsx("mark",{className:"bg-transparent font-semibold text-fg",children:e.slice(l,l+r.length)},u++)),i=l+r.length,l=a.indexOf(r,i);return i<e.length&&o.push(e.slice(i)),o}function ad({thread:e,badge:t,highlightQuery:n}){const a=!e.isRead;return s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsxs("span",{className:"flex items-baseline justify-between gap-2",children:[s.jsxs("span",{className:P("flex min-w-0 items-center gap-1.5 truncate text-sm",a?"font-semibold text-fg":"font-medium text-fg-muted"),children:[e.trust==="vip"&&s.jsx("span",{className:"size-1.5 shrink-0 rounded-full bg-accent-2"}),s.jsx("span",{className:"truncate",children:e.fromName}),e.messageCount!=null&&e.messageCount>1&&s.jsx("span",{className:"shrink-0 text-2xs font-normal text-fg-subtle",children:e.messageCount})]}),s.jsx("span",{className:"shrink-0 text-2xs text-fg-subtle tabular-nums",children:e.timeLabel})]}),s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:P("truncate text-sm",a?"text-fg":"text-fg-muted"),children:Sn(e.subject,n)}),e.suspicious&&s.jsx(nt,{className:"size-3.5 shrink-0 text-danger"}),e.starred&&s.jsx(et,{className:"size-3 shrink-0 fill-warning text-warning"}),e.hasAttachment&&s.jsx(Zt,{className:"size-3 shrink-0 text-fg-subtle",role:"img","aria-label":"Has an attachment"})]}),s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"line-clamp-1 min-w-0 flex-1 text-xs text-fg-subtle",children:Sn(e.snippet,n)}),e.category&&e.category!=="personal"&&s.jsx(we,{tone:oa[e.category],className:"shrink-0",children:Jr(e.category)}),e.labels?.map(r=>s.jsx(Xr,{label:r,className:"max-w-20"},r.labelId)),e.settlement&&s.jsx(er,{settlement:e.settlement}),t]})]})}function rd({thread:e,selection:t}){if(!t)return s.jsx(gt,{name:e.fromName,email:e.fromEmail,size:"sm"});const{checked:n,alwaysVisible:a}=t;return s.jsxs("span",{className:"relative size-7 shrink-0",children:[s.jsx(gt,{name:e.fromName,email:e.fromEmail,size:"sm",className:P("absolute inset-0 transition-opacity sm:group-hover:opacity-0",(n||a)&&"opacity-0")}),s.jsx("span",{role:"button",tabIndex:-1,onClick:t.onToggle,onKeyDown:r=>{r.key!=="Enter"&&r.key!==" "||(r.preventDefault(),r.stopPropagation(),t.onToggle(r))},className:P("absolute inset-0 size-7 items-center justify-center rounded-full border transition-opacity",a?"flex":"hidden sm:flex",n?"bg-accent border-accent text-accent-fg opacity-100":a?"border-fg-subtle/40 bg-canvas opacity-100":"border-fg-subtle/40 bg-canvas opacity-0 group-hover:opacity-100"),"aria-label":n?"Deselect message":"Select message",children:n&&s.jsx(Gt,{className:"size-3"})})]})}function Gs({thread:e,selection:t,badge:n,highlightQuery:a}){const r=!e.isRead;return s.jsxs(s.Fragment,{children:[r&&s.jsx("span",{className:"absolute left-1.5 top-1/2 size-1.5 -translate-y-1/2 rounded-full bg-accent"}),s.jsx(rd,{thread:e,selection:t}),s.jsx(ad,{thread:e,badge:n,highlightQuery:a})]})}const ar=e=>({...xi,[Zr]:"","data-message-id":e.id});function Up({thread:e,active:t,focused:n,tabIndex:a,onClick:r}){return s.jsx("button",{type:"button",...ar(e),tabIndex:a,onClick:r,className:sr({active:t,focused:n}),children:s.jsx(nr,{thread:e})})}function Bp({thread:e,active:t,focused:n,tabIndex:a,selection:r,onClick:o}){return s.jsx("button",{type:"button",...ar(e),tabIndex:a,onClick:o,className:P("group",Ws({active:t,focused:n})),children:s.jsx(Gs,{thread:e,selection:r})})}let Je;const od=5e3;function rr(e){e.preventDefault(),qt()}function qt(){Je!==void 0&&(clearTimeout(Je),Je=void 0,document.removeEventListener("contextmenu",rr,!0),document.removeEventListener("pointerup",qt,!0))}function id(){Je===void 0?(document.addEventListener("contextmenu",rr,!0),document.addEventListener("pointerup",qt,!0)):clearTimeout(Je),Je=setTimeout(qt,od)}function ld({onLongPress:e,isDisabled:t,delayMs:n=500,accessibilityDescription:a}){const{longPressProps:r}=bc({isDisabled:t,threshold:n,accessibilityDescription:a,onLongPress:e}),o=c.useCallback(i=>{i.pointerType!=="touch"&&i.pointerType!=="pen"||id()},[]);return{longPressProps:It(r,{onPointerDown:o})}}const ut="min-h-11 min-w-11 px-0";function or({hasThread:e,onReply:t,onReplyAll:n,onForward:a,isStarred:r,onToggleStar:o,onDelete:i,isRead:l,onToggleRead:u,moveSlot:x,overflowItems:g=[],onUnavailable:y,unavailableHint:f,className:v}){const p=(d,b)=>()=>{if(!e){y?.(d);return}b?.()},m=u?[{key:"toggle-read",label:l?"Mark as unread":"Mark as read",icon:l?s.jsx(Ri,{className:"size-4"}):s.jsx(qs,{className:"size-4"}),onSelect:p("toggleRead",u)}]:[];return s.jsxs("div",{className:P("relative",v),children:[s.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-0.5 bg-canvas px-1",children:[t&&s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(Qs,{className:"size-5"}),onClick:p("reply",t),"aria-label":"Reply",title:"Reply",className:ut}),n&&s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(Xa,{className:"size-5"}),onClick:p("replyAll",n),"aria-label":"Reply all",title:"Reply all",className:ut}),a&&s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(Ja,{className:"size-5"}),onClick:p("forward",a),"aria-label":"Forward",title:"Forward",className:ut}),s.jsx("div",{className:"flex-1"}),o&&s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(et,{className:P("size-5",r&&"fill-warning text-warning")}),onClick:p("star",o),"aria-label":r?"Unstar":"Star","aria-pressed":r,title:r?"Unstar":"Star",className:ut}),x,i&&s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(vt,{className:"size-5"}),onClick:p("delete",i),"aria-label":"Move to Trash",title:"Move to Trash",className:ut}),s.jsx(Ra,{triggerLabel:"More actions",items:[...m,...g]})]}),!e&&f&&s.jsx("p",{role:"status",className:"bg-surface-sunken px-3 py-1 text-2xs text-fg-subtle",children:f})]})}function ir({message:e,onClick:t,isFocused:n,isUnread:a,trailing:r}){const o=s.jsxs(s.Fragment,{children:[s.jsx(Ds,{className:"size-3.5 shrink-0 text-fg-subtle"}),s.jsxs("div",{className:"relative shrink-0",children:[s.jsx(gt,{name:e.fromName,email:e.fromEmail,size:"md"}),a&&s.jsx("span",{className:"absolute -top-0.5 -right-0.5 size-2 rounded-full border border-canvas bg-accent"})]}),s.jsx("span",{className:P("w-36 shrink-0 truncate text-sm",a?"font-semibold text-fg":"font-medium text-fg-muted"),children:e.fromName}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-fg-subtle",children:e.snippet}),r??s.jsx("span",{className:"shrink-0 text-2xs text-fg-subtle tabular-nums",children:e.dateLabel})]}),i=P("group flex h-section-row w-full items-center gap-3 border-b border-line px-2 text-left transition-colors hover:bg-surface-sunken lg:px-4",n&&"bg-surface-sunken ring-1 ring-inset ring-accent/30");return t?s.jsx("div",{role:"button",tabIndex:0,"aria-expanded":!1,onClick:t,onKeyDown:l=>{eo(l)&&(l.preventDefault(),t())},className:P(i,"cursor-pointer"),children:o}):s.jsx("div",{className:i,children:o})}function lr({message:e,warning:t,onHeaderClick:n,isFocused:a,senderBadge:r,trailing:o,to:i,indicators:l,actionMenu:u,actionBar:x,body:g}){const y=s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[s.jsxs("span",{className:"text-sm font-semibold text-fg",children:[e.fromName,r]}),o??s.jsx("span",{className:"text-2xs text-fg-subtle",children:e.dateLabel})]}),s.jsx("div",{className:"text-xs text-fg-subtle",children:e.fromEmail}),i!==null&&s.jsx("div",{className:"text-xs text-fg-subtle",children:i??s.jsxs(s.Fragment,{children:["to ",e.toLabel]})})]});return s.jsxs("div",{className:"px-2 py-3 lg:px-4",children:[s.jsxs("div",{className:P("-mx-2 -my-1 flex items-start gap-3 rounded-sm px-2 py-1",a&&"ring-1 ring-inset ring-accent/30"),children:[n?s.jsx("button",{type:"button",onClick:n,"aria-expanded":!0,"aria-label":"Collapse message",className:"mt-1 shrink-0 text-fg-subtle transition-colors hover:text-fg",children:s.jsx(Ke,{className:"size-3.5"})}):s.jsx(Ke,{className:"mt-1 size-3.5 shrink-0 text-fg-subtle"}),s.jsx(gt,{name:e.fromName,email:e.fromEmail,size:"md"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[n?s.jsx("button",{type:"button",onClick:n,className:"w-full text-left",children:y}):y,l]}),u&&s.jsx("div",{className:"shrink-0",children:u})]}),t&&s.jsxs("div",{className:"mt-3 flex items-start gap-3 rounded-md bg-danger-soft p-3",children:[s.jsx(nt,{className:"mt-0.5 size-4 shrink-0 text-danger"}),s.jsxs("div",{className:"text-sm text-fg",children:[s.jsx("span",{className:"font-semibold text-danger",children:"Caution: "}),t," ",s.jsx("button",{type:"button",className:"text-accent underline",children:"Why?"})]})]}),x&&s.jsx("div",{className:"mt-3 -mx-2 lg:-mx-4",children:x}),s.jsx(Ei,{children:g??s.jsx(Mi,{className:"mt-3",html:e.bodyHtml,category:e.framed?"newsletter":"personal",allowImages:!0})})]})}function cd({thread:e,onBack:t,intelligence:n,intelligenceOpen:a,onToggleIntelligence:r,actions:o,children:i,touchHandlers:l}){const[u,x]=c.useState(!1),g=r!==void 0,y=g?a??!1:u,f=!!n||g,v=()=>{if(g){r?.();return}x(m=>!m)},p=()=>{if(g){y&&r?.();return}x(!1)};return s.jsxs("article",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line bg-surface px-row-inset",children:[s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(la,{className:"size-4"}),onClick:t,"aria-label":"Back to messages",className:"-ml-1 shrink-0"}),s.jsx("h2",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:e.subject}),f&&s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(ia,{className:"size-4"}),onClick:v,"aria-label":y?"Hide intelligence panel":"Show intelligence panel","aria-pressed":y,title:"Intelligence",className:P("shrink-0",y&&"bg-accent-2-soft text-accent-2")})]}),s.jsx("div",{className:"flex-1 overflow-y-auto",style:l?{touchAction:"pan-y"}:void 0,...l,children:i??[...e.messages].reverse().map(m=>{const d=b=>b?()=>b(m.id):void 0;return m.expanded?s.jsx(lr,{message:m,warning:e.warning,onHeaderClick:d(o?.onToggleExpand),actionBar:s.jsx(or,{hasThread:!0,onReply:d(o?.onReply),onReplyAll:d(o?.onReplyAll),onForward:d(o?.onForward),onToggleStar:d(o?.onToggleStar),onDelete:d(o?.onDelete),onToggleRead:d(o?.onToggleRead),moveSlot:o?.moveSlot?.(m.id)})},m.id):s.jsx(ir,{message:m,onClick:d(o?.onToggleExpand)},m.id)})}),n&&!g&&s.jsx(to,{open:y,onClose:p,title:"Intelligence",anchor:"right",className:"p-0",children:s.jsx(Za,{data:n,onClose:p,className:"h-full w-full border-l-0"})})]})}function dd(e){return{id:e.id,fromName:e.sender,fromEmail:e.senderEmail??e.sender,subject:e.subject,snippet:e.snippet,timeLabel:e.date,isRead:!e.unread,starred:e.flagged,...e.mailboxId?{mailboxId:e.mailboxId}:{}}}function ud({result:e,onClick:t,query:n,showFolder:a=!0}){const r=a&&e.folder?so(e.folder):void 0;return s.jsx("button",{type:"button",onClick:t,className:P("group",Ws({}),"border-b border-line"),children:s.jsx(Gs,{thread:dd(e),highlightQuery:n,badge:s.jsxs(s.Fragment,{children:[r&&s.jsx(we,{tone:"neutral",className:"shrink-0",children:r}),e.category&&s.jsx(we,{tone:e.category.tone??"neutral",className:"shrink-0",children:e.category.label}),e.matchedChunkLabel&&s.jsx(we,{tone:"neutral",className:"shrink-0",children:`matched: ${e.matchedChunkLabel}`}),e.score!=null&&s.jsx("span",{className:"shrink-0 text-2xs text-fg-subtle tabular-nums",children:e.score.toFixed(2)})]})})})}const fd=e=>e===1?"result":"results";function md({count:e,onScopeToSpam:t}){return s.jsx(ca,{tone:"info",variant:"soft",className:"items-center justify-between gap-3 rounded-none border-b border-line",children:s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx("p",{className:"min-w-0 text-xs text-fg-muted",children:e.kind==="exact"?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"font-semibold text-fg tabular-nums",children:e.value.toLocaleString()})," ",`${fd(e.value)} from Spam`]}):"Results from Spam"}),s.jsx(H,{variant:"ghost",size:"sm",onClick:t,className:"shrink-0 text-accent",children:"Go to Spam"})]})})}const In=6,pd={kind:"global"},Tn={kind:"unknown"},hd=e=>e.kind==="folder"&&e.role==="junk",gd=e=>e.folder?.role==="junk";function xd(e){const t=[],n=[];for(const a of e)gd(a)?n.push(a):t.push(a);return{kept:t,spam:n}}function cr({onClick:e,blockedReason:t}){const n=c.useId(),[a,r]=c.useState(!1);return s.jsxs("div",{className:"border-b border-line px-row-inset py-1.5",children:[s.jsxs("button",{type:"button",onClick:()=>{if(t){r(!0);return}e()},"aria-describedby":t?n:void 0,className:P("flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-left text-xs font-medium transition-colors",t?"text-fg-subtle opacity-55":"text-accent hover:bg-surface-sunken"),children:[s.jsx(no,{className:"size-3.5 shrink-0","aria-hidden":"true"}),s.jsx("span",{children:"Make this a filter"})]}),t&&s.jsx(ao,{id:n,reason:t,nudged:a,className:"px-2 pt-1 text-2xs text-warning"})]})}function bd({section:e,query:t,onSelectResult:n,showFolder:a}){const[r,o]=c.useState(e.initialCollapsed??!1),[i,l]=c.useState(!1),u=e.results.length>In,g=!i&&u?e.results.slice(0,In):e.results,y=e.results.length-g.length;return s.jsxs("div",{children:[s.jsxs("button",{type:"button","aria-expanded":!r,onClick:()=>o(f=>!f),className:"sticky top-0 z-10 flex h-section-row w-full items-center gap-1.5 border-b border-line bg-surface-sunken px-row-inset text-left transition-colors hover:bg-surface",children:[s.jsx("span",{className:"flex-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:e.label}),s.jsx("span",{className:"text-2xs text-fg-subtle tabular-nums",children:e.results.length}),s.jsx(Ke,{className:P("size-3 shrink-0 text-fg-subtle transition-transform duration-200",r?"rotate-0":"rotate-180")})]}),!r&&s.jsxs(s.Fragment,{children:[g.map(f=>s.jsx(ud,{result:f,query:t,showFolder:a,onClick:n?()=>n(f):void 0},f.id)),u&&s.jsxs("button",{type:"button",onClick:()=>l(f=>!f),className:"flex w-full items-center justify-center border-b border-line px-row-inset py-1.5 text-2xs font-medium text-accent transition-colors hover:bg-surface",children:[i?"Show less":`Show ${y} more`,!i&&s.jsx(Ke,{className:"ml-1 size-3"})]})]})]})}function dr({value:e,recentSearches:t,onPickRecent:n,sections:a,loading:r,onSelectResult:o,tokens:i,scope:l=pd,makeFilter:u}){if(!(e.trim().length>0))return t&&t.length>0?s.jsxs("div",{className:"flex flex-col",children:[s.jsx("h3",{className:"px-row-inset pb-1 pt-3 text-2xs font-semibold uppercase tracking-wide text-fg-subtle",children:"Recent searches"}),t.map(T=>s.jsxs("button",{type:"button",onClick:()=>n?.(T),className:"flex w-full items-center gap-2.5 border-b border-line px-row-inset py-2.5 text-left transition-colors hover:bg-surface-sunken",children:[s.jsx(Da,{className:"size-4 shrink-0 text-fg-subtle"}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-fg-muted",children:T})]},T))]}):s.jsx("p",{className:"px-row-inset py-6 text-center text-sm text-fg-subtle",children:"Search across your mail by sender, subject or words in the message."});const g=i&&i.length>0&&s.jsx(ro,{tokens:i}),y=u&&s.jsx(cr,{...u});if(r)return s.jsxs("div",{className:"flex flex-col",children:[y,g,s.jsx("div",{className:"flex flex-col gap-3 px-row-inset py-4",children:[0,1,2,3].map(T=>s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx("div",{className:"h-3 w-1/3 animate-pulse rounded bg-surface-sunken"}),s.jsx("div",{className:"h-3 w-2/3 animate-pulse rounded bg-surface-sunken"}),s.jsx("div",{className:"h-2.5 w-1/2 animate-pulse rounded bg-surface-sunken"})]},T))})]});const f=l.kind==="global",v=hd(l)||l.kind==="collection",p=f||l.kind==="collection",m=(a??[]).map(T=>{if(v)return{section:T,spam:[]};const{kept:D,spam:$}=xd(T.results);return{section:{...T,results:D},spam:$}}),d=m.map(T=>T.section),b=m.reduce((T,D)=>T+D.spam.length,0),h=(l.kind==="global"?l.spamCount:void 0)??Tn,j=b>0||h.kind==="exact"&&h.value>0,I=h.kind==="exact"&&h.value===0&&b>0?Tn:h,A=l.kind==="global"&&j&&l.onScopeToSpam!==void 0?s.jsx(md,{count:I,onScopeToSpam:l.onScopeToSpam}):void 0;return d.some(T=>T.results.length>0)?s.jsxs("div",{className:"flex flex-col",children:[y,g,A,d.filter(T=>T.results.length>0).map(T=>s.jsx(bd,{section:T,query:e,showFolder:p,onSelectResult:o},T.id))]}):s.jsxs("div",{className:"flex flex-col",children:[y,g,A,s.jsxs("div",{className:"px-row-inset py-10 text-center",children:[s.jsxs("p",{className:"text-sm font-medium text-fg",children:["No matches for “",e,"”"]}),s.jsx("p",{className:"mt-1 text-xs text-fg-subtle",children:"Try a different word, or adjust the filters above."})]})]})}function vd({value:e,onChange:t,onClear:n,onCancel:a,filter:r,recentSearches:o,onPickRecent:i,sections:l,loading:u,onSelectResult:x,tokens:g,chips:y,onRemoveChip:f,scope:v,makeFilter:p,suggest:m,suggestList:d}){const b=s.jsx(dr,{value:e,recentSearches:o,onPickRecent:i,sections:l,loading:u,onSelectResult:x,tokens:g,scope:v,makeFilter:p});return s.jsxs("article",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line bg-surface px-row-inset",children:[s.jsx("div",{className:"min-w-0 flex-1",children:s.jsx(Ta,{value:e,onChange:t,onClear:n,chips:y,onRemoveChip:f,globalFocusKey:!1,showClearButton:!1,suggest:m})}),s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(Xe,{className:"size-4"}),onClick:a,"aria-label":"Clear and close search",className:"-mr-1 shrink-0"})]}),d,r&&e.trim().length===0?s.jsx(oo,{children:s.jsx(aa,{...r,children:b})}):s.jsx("div",{className:"flex-1 overflow-y-auto",children:b})]})}const Rn=e=>e.toLocaleString();function En({selectAll:e,selecting:t,className:n}){return s.jsx(El,{className:n,checked:e.checked,indeterminate:e.indeterminate,onChange:e.onChange,label:s.jsx("span",{className:"font-medium text-accent",children:e.checked&&t?"Deselect all":"Select all"})})}function yd({title:e,count:t,onCancel:n,onDelete:a,onMove:r,onOrganize:o,onJunk:i,onMarkRead:l,navSlot:u,titleMeta:x,searchSlot:g,searchField:y,idleSlot:f,overflowSlot:v,isBusy:p=!1,isCounting:m=!1,selectAll:d,statusLabel:b,progress:k,notice:h}){const j=t>0||m,S=d?.checked?`All ${Rn(t)} loaded selected`:`${Rn(t)} ${t===1?"message":"messages"} selected`,I=[];return i&&!p&&!m&&I.push({key:"junk",label:"Junk",icon:s.jsx(nt,{className:"size-4"}),onSelect:i}),l&&!p&&!m&&I.push({key:"mark-read",label:"Mark read",icon:s.jsx(qs,{className:"size-4"}),onSelect:l}),s.jsxs("header",{"data-selection-bar":"",className:"flex shrink-0 flex-col border-b border-line bg-surface-sunken",children:[s.jsxs("div",{"data-selection-bar-row":"actions",className:"flex h-pane-header items-center gap-1 px-row-inset",children:[j?s.jsx(H,{variant:"ghost",size:"touch",icon:s.jsx(la,{className:"size-5"}),onClick:n,"aria-label":"Cancel selection",className:"-ml-2 shrink-0"}):u,d&&s.jsx(En,{selectAll:d,selecting:j,className:"hidden shrink-0 pr-2 md:flex"}),j?s.jsx("span",{"data-selection-count":"",className:"min-w-0 flex-1 truncate px-1 text-sm font-medium text-fg",role:"status","aria-live":"polite",children:b??S}):y?s.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-1",children:y}):s.jsxs(s.Fragment,{children:[s.jsx("h1",{className:"min-w-0 flex-1 truncate px-1 text-sm font-semibold text-fg",children:e}),x,g]}),j&&!m&&s.jsxs(s.Fragment,{children:[s.jsx(H,{variant:"ghost",size:"touch",icon:p?s.jsx(na,{className:"size-5 animate-spin"}):s.jsx(vt,{className:"size-5 text-danger"}),onClick:p?void 0:a,"aria-label":"Move selected messages to Trash","aria-busy":p||void 0,className:"shrink-0"}),!p&&r&&s.jsx(H,{variant:"ghost",size:"touch",icon:s.jsx(Fs,{className:"size-5"}),onClick:r,"aria-label":"Move selected messages",className:"shrink-0"}),!p&&o&&s.jsx(H,{variant:"ghost",size:"touch",icon:s.jsx(Ze,{className:"size-5"}),onClick:o,"aria-label":"Organize selected messages",className:"shrink-0"})]}),j&&s.jsx(Ra,{triggerLabel:"More actions",items:I,className:"shrink-0",children:!p&&!m&&v})]}),!j&&f,j&&d&&s.jsx("div",{"data-selection-bar-row":"select-all",className:"px-row-inset pb-2 md:hidden",children:s.jsx(En,{selectAll:d,selecting:j,className:"w-full"})}),k&&s.jsx("div",{className:"px-row-inset pb-2",children:s.jsx(io,{value:k.value,max:k.max,tone:k.tone})}),h&&s.jsx(ca,{"data-selection-notice":"",tone:h.tone,variant:"soft",role:"status","aria-live":"polite",className:"mx-row-inset mb-2",children:s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.text&&s.jsx("span",{children:h.text}),h.action&&s.jsx(H,{variant:"ghost",size:"md",onClick:h.action.onClick,className:"-my-1 min-h-11 shrink-0",children:h.action.label})]})})]})}const ur={id:"unread",label:"Unread"},kd={id:"flagged",label:"Starred"},fr={id:"attachment",label:"Has attachment"};function jd(e){if(!(e.length<=1))return e.map(t=>({id:t.id,label:t.label,count:t.count,active:t.active}))}function Kp(e=[]){return{categories:[...Wt],filters:ra,sources:jd(e)}}function Hp(){return{categories:[...Wt],filters:[ur,kd,fr]}}function qp(){return{categories:[...Wt],filters:[ur,fr]}}function wd(e,t){return e.endsWith(t)?e.length===t.length||e[e.length-t.length-1]===".":!1}function Cd(e,t){const n=e.length-t.length-2,a=e.lastIndexOf(".",n);return a===-1?e:e.slice(a+1)}function Nd(e,t,n){if(n.validHosts!==null){const r=n.validHosts;for(const o of r)if(wd(t,o))return o}let a=0;if(t.startsWith("."))for(;a<t.length&&t[a]===".";)a+=1;return e.length===t.length-a?null:Cd(t,e)}const vs=/[\t\n\r]/g;let Ts=!1;function Mn(e){return e>=97&&e<=122||e>=48&&e<=57||e>127||e>=65&&e<=90||e===45||e===95}function An(e,t,n){const a=n-t,r=e.charCodeAt(t)|32;if(a===2)return r===119&&(e.charCodeAt(t+1)|32)===115?1:0;if(a===3){const o=e.charCodeAt(t+1)|32,i=e.charCodeAt(t+2)|32;return r===119&&o===115&&i===115||r===102&&o===116&&i===112?1:0}else if(a===4){const o=e.charCodeAt(t+1)|32,i=e.charCodeAt(t+2)|32,l=e.charCodeAt(t+3)|32;return r===104&&o===116&&i===116&&l===112?1:r===102&&o===105&&i===108&&l===101?2:0}else if(a===5)return r===104&&(e.charCodeAt(t+1)|32)===116&&(e.charCodeAt(t+2)|32)===116&&(e.charCodeAt(t+3)|32)===112&&(e.charCodeAt(t+4)|32)===115?1:0;return 0}function mt(e,t,n=!1){let a=0,r=e.length,o=!1,i=!1;if(Ts=!1,!t){if(e.startsWith("data:"))return null;for(;a<e.length&&e.charCodeAt(a)<=32;)a+=1;for(;r>a+1&&e.charCodeAt(r-1)<=32;)r-=1;if(e.charCodeAt(a)===47&&e.charCodeAt(a+1)===47)a+=2;else{const d=e.indexOf(":/",a);if(d!==-1){const b=An(e,a,d);if(b===1)for(i=!0,a=d+2;e.charCodeAt(a)===47||e.charCodeAt(a)===92;)a+=1;else if(b===2){i=!0,a=d+1;let k=0;for(;(e.charCodeAt(a)===47||e.charCodeAt(a)===92)&&k<2;)a+=1,k+=1;if(k<2)return null}else{for(let k=a;k<d;k+=1){const h=e.charCodeAt(k)|32;if(!(h>=97&&h<=122||h>=48&&h<=57||h===46||h===45||h===43)){const j=e.charCodeAt(k);return j===9||j===10||j===13?mt(e.replace(vs,""),t,n):null}}if(e.charCodeAt(d+2)===47)a=d+3;else return null}}else if(e.charCodeAt(a)!==91){let b=-1;for(let k=a;k<r;k+=1){const h=e.charCodeAt(k);if(h===9||h===10||h===13)return mt(e.replace(vs,""),t,n);if(h===58){b=k;break}if(h===47||h===92||h===63||h===35)break}if(b!==-1){let k=!1;for(let h=b+1;h<r;h+=1){const j=e.charCodeAt(h);if(j===47||j===92||j===63||j===35)break;if(j===64){k=!0;break}}if(!k){let h=!0,j=b+1;for(;j<r;j+=1){const S=e.charCodeAt(j);if(S===47||S===92||S===63||S===35)break;if(S<48||S>57){h=!1;break}}if(j===b+1&&(h=!1),!h){const S=An(e,a,b);if(S===0){let I=!1;for(let A=b+1;A<r;A+=1){const M=e.charCodeAt(A);if(M===47||M===92||M===63||M===35)break;if(M===58){I=!0;break}}if(!I)return null}else if(i=!0,a=b+1,S===2){let I=0;for(;(e.charCodeAt(a)===47||e.charCodeAt(a)===92)&&I<2;)a+=1,I+=1;if(I<2)return null}else for(;e.charCodeAt(a)===47||e.charCodeAt(a)===92;)a+=1}}}}}let u=-1,x=-1,g=-1,y=-1,f=!1,v=n,p=a-1,m=-1;if(n&&a<r){const d=e.charCodeAt(a);(!(Mn(d)||d===46||d===95)||d===45)&&(v=!1)}for(let d=a;d<r;d+=1){const b=e.charCodeAt(d);if(b<64)if(b===47||b===35||b===63){r=d;break}else b===58?(y===-1&&(y=d),g=d):b===9||b===10||b===13?f=!0:n&&(b===46?((d-p>64||m===46||m===45)&&(v=!1),p=d):(b<48||b>57)&&(b!==45||m===46)&&(v=!1));else if(i&&b===92){r=d;break}else b===64?(u=d,y=-1):b===93?x=d:b>=65&&b<=90?o=!0:n&&!Mn(b)&&(v=!1);n&&(m=b)}if(f)return mt(e.replace(vs,""),t,n);if(u!==-1&&u>=a&&u<r&&(a=u+1),e.charCodeAt(a)===91)return x!==-1?e.slice(a+1,x).toLowerCase():null;if(g!==-1&&g>a&&g<r&&y===g&&(r=g),a>=r)return null;n&&v&&u===-1&&g===-1&&x===-1&&e.charCodeAt(r-1)!==46&&r-a<=255&&r-p-1<=63&&m!==45&&(Ts=!0)}for(;r>a+1&&e.charCodeAt(r-1)===46;)r-=1;const l=a!==0||r!==e.length?e.slice(a,r):e;return o?l.toLowerCase():l}function Sd(e){if(e.length<7||e.length>15)return!1;let t=0;for(let n=0;n<e.length;n+=1){const a=e.charCodeAt(n);if(a===46)t+=1;else if(a<48||a>57)return!1}return t===3&&e.charCodeAt(0)!==46&&e.charCodeAt(e.length-1)!==46}function Id(e){if(e.length<3)return!1;let t=e.startsWith("[")?1:0,n=e.length;if(e[n-1]==="]"&&(n-=1),n-t>39)return!1;let a=!1;for(;t<n;t+=1){const r=e.charCodeAt(t);if(r===58)a=!0;else if(!(r>=48&&r<=57||r>=97&&r<=102||r>=65&&r<=70))return!1}return a}function Td(e){return Id(e)||Sd(e)}function $n(e){return e>=97&&e<=122||e>=48&&e<=57||e>127}function Ln(e){if(e.length>255||e.length===0||!$n(e.charCodeAt(0))&&e.charCodeAt(0)!==46&&e.charCodeAt(0)!==95)return!1;let t=-1,n=-1;const a=e.length;for(let r=0;r<a;r+=1){const o=e.charCodeAt(r);if(o===46){if(r-t>64||n===46||n===45)return!1;t=r}else if(!($n(o)||o===45||o===95)||o===45&&n===46)return!1;n=o}return a-t-1<=63&&n!==45}function Rd({allowIcannDomains:e=!0,allowPrivateDomains:t=!1,detectIp:n=!0,detectSpecialUse:a=!1,extractHostname:r=!0,mixedInputs:o=!0,validHosts:i=null,validateHostname:l=!0}){return{allowIcannDomains:e,allowPrivateDomains:t,detectIp:n,detectSpecialUse:a,extractHostname:r,mixedInputs:o,validHosts:i,validateHostname:l}}const Ed=Rd({});function Md(e){return Ed}function Ad(){return{domain:null,domainWithoutSuffix:null,hostname:null,isIcann:null,isIp:null,isPrivate:null,isSpecialUse:null,publicSuffix:null,subdomain:null}}function $d(e){e.domain=null,e.domainWithoutSuffix=null,e.hostname=null,e.isIcann=null,e.isIp=null,e.isPrivate=null,e.isSpecialUse=null,e.publicSuffix=null,e.subdomain=null}function Ld(e,t,n,a,r){const o=Md();if(typeof e!="string")return r;let i=!1;return o.extractHostname?o.mixedInputs?(i=Ln(e),r.hostname=mt(e,i,o.validateHostname)):r.hostname=mt(e,!1,o.validateHostname):r.hostname=e,o.detectIp&&r.hostname!==null&&(r.isIp=Td(r.hostname),r.isIp)?r:o.validateHostname&&o.extractHostname&&r.hostname!==null&&!(i&&r.hostname===e)&&!Ts&&!Ln(r.hostname)?(r.hostname=null,r):(r.hostname===null||(n(r.hostname,o,r),r.publicSuffix===null)||(r.domain=Nd(r.publicSuffix,r.hostname,o)),r)}const Pn=Ad();function Pd(e,t){return $d(Pn),Ld(e,3,lo,t,Pn).domain}const ss=e=>{const t=new Set,n=[];for(const a of e){const r=a.trim();if(r==="")continue;const o=r.toLowerCase();t.has(o)||(t.add(o),n.push(r))}return n},Dd=e=>{const t=e.lastIndexOf("@");return t>=0?e.slice(t+1):e},mr=e=>Pd(Dd(e.trim())),Fd=e=>{const t=ss(e);if(t.length<2)return null;let n=null;for(const a of t){const r=mr(a);if(r===null)return null;if(n===null)n=r;else if(n!==r)return null}return n},Od=e=>{const t=Fd(e);return t!==null?[{field:"FromDomain",value:t}]:ss(e).map(n=>({field:"From",value:n}))},zd=e=>{const t=new Map;for(const r of e){const o=r.normalizedEmail.trim().toLowerCase();if(o==="")continue;const i=t.get(o);i?i.count+=1:t.set(o,{sender:r,count:1})}let n,a=0;for(const{sender:r,count:o}of t.values())o<=a||(n=r,a=o);return n},pr=e=>e.displayName?.trim()||e.normalizedEmail,_d=/^\s*(?:(?:re|aw|fwd?|vs|sv|antw|res|enc|tr)\s*(?:\[\d+\])?\s*:|\[[^\]]{1,32}\])\s*/i,Ud=e=>{let t=e.replace(/\s+/g," ").trim();for(;;){const n=t.replace(_d,"");if(n===t)return t.trim();t=n}},Bd=new Set(["a","an","and","are","as","at","be","by","for","from","has","have","in","is","it","me","my","new","of","on","or","our","the","this","to","was","we","with","you","your"]),Kd=3,ys=e=>e.split(" ").filter(t=>t!==""),Dn=e=>e.length===0||e.join(" ").length<Kd?!1:e.some(t=>!Bd.has(t.toLowerCase())),Hd=(e,t)=>e.findIndex((n,a)=>t.every((r,o)=>e[a+o]?.toLowerCase()===r.toLowerCase())),qd=e=>{const t=e.map(Ud).filter(o=>o!=="");if(t.length===0)return;const[n,...a]=t;if(a.length===0)return Dn(ys(n))?n:void 0;const r=ys(n);for(let o=r.length;o>0;o-=1)for(let i=0;i+o<=r.length;i+=1){const l=r.slice(i,i+o);if(Dn(l)&&a.every(u=>Hd(ys(u),l)>=0))return l.join(" ")}},Vs=(e,t)=>{const n=Od(e);if(ss(e).length===1||n.length===1&&n[0].field==="FromDomain")return n;const a=qd(t);return a!==void 0?[{field:"Subject",value:a}]:n},Qd=({match:e,sender:t,folder:n})=>{const a=e??t;return a?n?`${a} → ${n}`:e?`Mail matching ${e}`:`Mail from ${a}`:n?`Mail to ${n}`:""},Wd=e=>e.clauses.length>0,Gd=e=>({scopedOutFolder:e.scopedOut?.label,droppedFacets:e.droppedFacets.map(t=>t.label),droppedSemantic:e.droppedSemantic}),Vd=({orderedIds:e,isDesktop:t,initialFocusedId:n,initialSelectedIds:a,onExitSelection:r})=>{const[o,i]=c.useState(n),[l,u]=c.useState(),x=c.useCallback(C=>{u(L=>L===C?L:void 0),i(C)},[]),g=sd({initialSelectedIds:a}),{selectedCount:y,toggle:f,clearSelection:v,selectRange:p,setAnchor:m,selectAll:d}=g,b=Jc(y,t),k=c.useRef(null),h=c.useRef(!1),j=c.useCallback(()=>{r?.(),v()},[v,r]),S=c.useMemo(()=>o?e.indexOf(o):-1,[e,o]),I=c.useCallback(C=>{if(C<0||C>=e.length)return;const L=e[C];if(b){f(L);return}k.current=L,h.current=!1,u(L),i(L)},[e,b,f]),A=c.useCallback(()=>{e.length!==0&&I(S<0?0:Math.min(S+1,e.length-1))},[e.length,S,I]),M=c.useCallback(()=>{e.length!==0&&I(S<=0?0:S-1)},[e.length,S,I]),T=c.useCallback(()=>I(0),[I]),D=c.useCallback(()=>I(e.length-1),[I,e.length]),$=c.useCallback(()=>{o&&f(o)},[o,f]),K=c.useCallback((C,L)=>{const N=Yc(L);return N==="range"?(p(e,C,o),!0):N==="toggle"?(f(C),!0):(j(),m(C),!1)},[e,o,p,f,j,m]),_=c.useCallback(C=>{const L=td(e,o,C);L!==void 0&&(p(e,L),k.current=L,h.current=!1,u(void 0),i(L))},[e,o,p]),w=c.useCallback(()=>_(-1),[_]),R=c.useCallback(()=>_(1),[_]),O=c.useCallback(()=>{e.length>0&&d(e)},[e,d]);return{focusedMessageId:o,setFocusedMessageId:x,keyboardFocusedMessageId:l,focusIndex:S,pendingDomFocusRef:k,cursorMovedByPointerRef:h,selection:g,isMultiSelectMode:b,exitSelection:j,moveFocusToIndex:I,focusNext:A,focusPrevious:M,focusFirst:T,focusLast:D,toggleFocusedSelection:$,extendRangeUp:w,extendRangeDown:R,selectAllLoaded:O,handleRowSelect:K}};function Yd(e,t){if(e===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if("shouldBlockFn"in e)return e;if(typeof e=="function")return{shouldBlockFn:async()=>await e(),enableBeforeUnload:!0,withResolver:!1};const n=!!(e.condition??!0),a=e.blockerFn;return{shouldBlockFn:async()=>n&&a!==void 0?await a():n,enableBeforeUnload:n,withResolver:a===void 0}}function Jd(e,t){const{shouldBlockFn:n,enableBeforeUnload:a=!0,disabled:r=!1,withResolver:o=!1}=Yd(e),i=co(),{history:l}=i,[u,x]=c.useState({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return c.useEffect(()=>{const g=async y=>{function f(b){const k=i.parseLocation(b),h=i.getMatchedRoutes(k.pathname);return h.foundRoute===void 0?{routeId:"__notFound__",fullPath:k.pathname,pathname:k.pathname,params:h.routeParams,search:i.options.parseSearch(b.search)}:{routeId:h.foundRoute.id,fullPath:h.foundRoute.fullPath,pathname:k.pathname,params:h.routeParams,search:i.options.parseSearch(b.search)}}const v=f(y.currentLocation),p=f(y.nextLocation);if(v.routeId==="__notFound__"&&p.routeId!=="__notFound__")return!1;const m=await n({action:y.action,current:v,next:p});if(!o)return m;if(!m)return!1;const d=await new Promise(b=>{x({status:"blocked",current:v,next:p,action:y.action,proceed:()=>b(!1),reset:()=>b(!0)})});return x({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),d};return r?void 0:l.block({blockerFn:g,enableBeforeUnload:a})},[n,a,r,o,l,i]),u}function Qp(){const{insertIntoOpenReply:e}=da(),t=ua();return c.useCallback((n,a)=>{e(n.messageId,a)||t({...n,mode:"reply"},{body:a})},[e,t])}const ns=e=>{const{data:t,isLoading:n}=ne({...tt(),staleTime:1/0,enabled:!!e}),a=c.useMemo(()=>(t?.accounts??[]).map(l=>l.accountId),[t?.accounts]),r=Us({queries:a.map(l=>({...yt({path:{accountId:l}}),staleTime:1/0,enabled:!!e}))}),o=n||r.some(l=>l.isLoading);return{accountId:c.useMemo(()=>{if(e){for(let l=0;l<a.length;l++)if((r[l].data?.items??[]).some(g=>g.mailboxId===e))return a[l]}},[e,a,r]),isLoading:o}},Xd=({surface:e})=>{const t=uo(),n=fo(),{registerOpenReply:a}=da(),[r,o]=c.useState(),i=c.useCallback(f=>o(v=>({version:(v?.version??0)+1,text:f})),[]),l=e.sourceMessageId;c.useEffect(()=>a(l,i),[l,i,a]);const{data:u}=ne({...Yt({path:{messageId:e.sourceMessageId}})}),{data:x}=ne({...tt(),staleTime:1/0}),{accountId:g}=ns(u?.message.mailboxId),y=x?.accounts?.find(f=>f.accountId===g);return s.jsx("div",{className:"border-b border-line bg-canvas",children:s.jsx(Oi,{layout:"flow",mode:e.mode,account:y,sourceMessage:u,outboxMessageId:e.outboxMessageId,seed:e.seed,insertion:r,onDraftCreated:t,onClose:n},e.sourceMessageId)})},Zd=3e3,eu=(e,t,n)=>{if(e.length===0)return()=>{};const a=setTimeout(()=>n(e),t);return()=>clearTimeout(a)},Ys=(e,t,n)=>{const a=new Map(t.map(o=>[o.messageId,o.mailboxId])),r=new Set;for(const o of e)r.add(a.get(o)??n);return[...r]},Qt=(e,t,n)=>e.map(a=>t.has(a.messageId)?{...a,isRead:n}:a),tu=(e,t,n,a)=>e.filter(r=>!r.isRead&&t.has(r.threadMessageId)&&!n.has(r.messageId)&&!a.has(r.messageId)).map(r=>r.messageId),su=({messages:e,expandedIds:t,threadId:n,mailboxId:a,accountId:r})=>{const o=he(),{pushError:i}=ve(),l=c.useRef(new Set),u=c.useRef(new Set),{mutate:x}=ge({...Jt(),meta:mo,onMutate:async f=>{const v=new Set(f.body.messageIds??[]),p=f.body.isRead??!0,m=Ae({path:{threadId:n}}),d=Ee(Ys(v,e,a));await Promise.all([o.cancelQueries({queryKey:m}),wt(o,d)]);const b=o.getQueriesData({queryKey:m}).filter(h=>h[1]!==void 0).map(([h,j])=>({queryKey:h,data:j})),k=Ct(o,d);return o.setQueriesData({queryKey:m},h=>h&&{...h,items:Qt(h.items,v,p)}),Nt(o,d,h=>Qt(h,v,p)),{threadMessagesPrefix:m,listPrefixes:d,previousThreadMessages:b,previousThreadsList:k}},onSuccess:(f,v)=>{const p=v.body.messageIds??[];for(const m of p)l.current.add(m),u.current.delete(m)},onError:(f,v,p)=>{const m=v.body.messageIds??[];for(const b of m)u.current.delete(b);if(p){for(const b of p.previousThreadMessages)o.setQueryData(b.queryKey,b.data);jt(o,p.previousThreadsList)}const d=v.body.isRead??!0;i({title:d?"Couldn't mark as read":"Couldn't mark as unread",detail:Me(f),error:f})},onSettled:(f,v,p,m)=>{m&&(o.invalidateQueries({queryKey:m.threadMessagesPrefix}),Re(o,m.listPrefixes),r&&o.invalidateQueries({queryKey:kt({path:{accountId:r}})}))}}),g=c.useCallback(f=>{const v=f.filter(p=>!l.current.has(p)&&!u.current.has(p));if(v.length!==0){for(const p of v)u.current.add(p);x({body:{messageIds:v,isRead:!0}})}},[x]),y=c.useMemo(()=>tu(e,t,l.current,u.current),[e,t]);c.useEffect(()=>eu(y,Zd,g),[y,g]),c.useEffect(()=>{l.current.clear(),u.current.clear()},[n])},Wp=e=>{const{mailboxId:t,accountId:n,messages:a}=e,r=he(),{pushError:o}=ve(),{mutateAsync:i,isPending:l}=ge({...Jt(),onError:(x,g)=>{const y=g.body.isRead??!0;o({title:y?"Couldn't mark as read":"Couldn't mark as unread",detail:Me(x),error:x})},onSettled:(x,g,y)=>{Re(r,Ee(Ys(y.body.messageIds??[],a??[],t))),n&&r.invalidateQueries({queryKey:kt({path:{accountId:n}})})}});return{toggleReadFor:c.useCallback((x,g)=>{x.length!==0&&pt(x,y=>i({body:{messageIds:y,isRead:g}}))},[i]),isPending:l}},nu=60,au=1.5,ru=(e,t,n)=>{const a=Math.abs(e),r=Math.abs(t);return a<n?{direction:null}:a<r*au?{direction:null}:{direction:e<0?"left":"right"}},ou=({onSwipeLeft:e,onSwipeRight:t,thresholdPx:n=nu})=>{const a=c.useRef(null),r=c.useCallback(u=>{if(u.pointerType==="mouse"){a.current=null;return}a.current={x:u.clientX,y:u.clientY}},[]),o=c.useCallback(()=>{},[]),i=c.useCallback(u=>{const x=a.current;if(a.current=null,!x)return;const{direction:g}=ru(u.clientX-x.x,u.clientY-x.y,n);g==="left"&&e?.(),g==="right"&&t?.()},[e,t,n]),l=c.useCallback(()=>{a.current=null},[]);return{handlers:{onPointerDown:r,onPointerMove:o,onPointerUp:i,onPointerCancel:l}}},iu=(e,t,n)=>t?.find(a=>a.messageId===e)?.mailboxId??n,Fn=(e,t,n)=>e.map(a=>a.messageId===t?{...a,hasStars:n}:a),hr=({threadId:e,mailboxId:t,messages:n})=>{const a=he(),{pushError:r}=ve(),{mutate:o,isPending:i,variables:l}=ge({...ho(),onMutate:async x=>{const g=x.path.messageId,y=x.body.isStarred??!1,f=Ae({path:{threadId:e}}),v=Ee([iu(g,n,t)]);await Promise.all([a.cancelQueries({queryKey:f}),wt(a,v)]);const p=a.getQueriesData({queryKey:f}).filter(d=>d[1]!==void 0).map(([d,b])=>({queryKey:d,data:b})),m=Ct(a,v);return a.setQueriesData({queryKey:f},d=>po(d,b=>Fn(b,g,y))),Nt(a,v,d=>Fn(d,g,y)),{threadMessagesPrefix:f,listPrefixes:v,previousThreadMessages:p,previousThreadsList:m}},onError:(x,g,y)=>{if(y){for(const v of y.previousThreadMessages)a.setQueryData(v.queryKey,v.data);jt(a,y.previousThreadsList)}const f=g.body.isStarred??!1;r({title:f?"Couldn't star message":"Couldn't unstar message",detail:Me(x),error:x})},onSettled:(x,g,y,f)=>{f&&(a.invalidateQueries({queryKey:f.threadMessagesPrefix}),Re(a,f.listPrefixes))}});return{toggleStar:(x,g)=>{o({path:{messageId:x},body:{isStarred:!g}})},isPending:i,pendingMessageId:i?l?.path.messageId:void 0}};function On({authenticity:e,onOpenIntelligence:t}){return e.dkimMismatch?s.jsxs("div",{className:"flex items-start gap-2 rounded-none border-b border-danger/20 bg-danger-soft px-5 py-2.5 text-sm",children:[s.jsx(nt,{className:"mt-0.5 size-4 shrink-0 text-danger"}),s.jsxs("p",{className:"flex-1 leading-snug text-fg",children:["This message claims to be from"," ",s.jsx("span",{className:"font-semibold",children:e.fromDomain})," but was sent",e.dkimDomain?` via ${e.dkimDomain}`:" from a different domain","."," ",t&&s.jsx("button",{type:"button",onClick:t,className:"font-medium text-danger hover:underline",children:"Why?"})]})]}):null}function gr(e){return e===void 0?"uncategorized":e}const lu={inbox:"Inbox",junk:"Junk"},Js=e=>e.destinationMailboxId!==void 0,cu=(e,t)=>{if(Js(e))return`Moved from ${t??"another folder"} by Remit`;const n=e.fromPlacement??"";return`Moved from ${lu[n]??"another folder"} by Remit`},du=(e,t)=>{if(e===on.MoveToInbox)return t.inboxMailboxId;if(e===on.MoveToJunk)return t.junkMailboxId},uu=(e,t,n)=>{if(!e||!t)return!1;const a=Js(e)?e.destinationMailboxId:du(e.action,n);return a!==void 0&&a===t},fu="Reported as spam",mu=(e,t)=>{if(e){if(Js(e))return e.fromMailboxId;if(e.fromPlacement==="inbox")return t.inboxMailboxId;if(e.fromPlacement==="junk")return t.junkMailboxId}},Tt=(e,t)=>{const{data:n,isLoading:a}=ne({...tt(),staleTime:1/0,enabled:!!e});return{mailboxId:c.useMemo(()=>e?n?.accounts.find(i=>i.accountId===e)?.folderAppointments.find(i=>i.role===t)?.mailboxId:void 0,[n,e,t]),isLoading:a}},Gp=e=>{const{mailboxId:t,isLoading:n}=Tt(e,"Archive");return{archiveMailboxId:t,isLoading:n}},Vp=e=>{const{mailboxId:t,isLoading:n}=Tt(e,"Drafts");return{draftsMailboxId:t,isLoading:n}},pu=e=>{const{mailboxId:t,isLoading:n}=Tt(e,"Inbox");return{inboxMailboxId:t,isLoading:n}},xr=e=>{const{mailboxId:t,isLoading:n}=Tt(e,"Junk");return{junkMailboxId:t,isLoading:n}},Yp=e=>{const{mailboxId:t,isLoading:n}=Tt(e,"Trash");return{trashMailboxId:t,isLoading:n}},hu=()=>{const{data:e,isError:t}=ne({...tt(),staleTime:1/0});return{trashByAccount:c.useMemo(()=>{const a=new Map;for(const r of e?.accounts??[]){const o=r.folderAppointments.find(i=>i.role==="Trash");a.set(r.accountId,{mailboxId:o?.mailboxId,source:o?.source??"None",staleFolderPath:o?.staleAppointmentPath})}return a},[e]),hasAppointments:e!==void 0,isError:t}},br=e=>{const{data:t}=ne({...tt(),staleTime:1/0,enabled:!!e});return c.useMemo(()=>t?.accounts.find(n=>n.accountId===e)?.folderAppointments??[],[t,e])},gu=new Set(["in_flight"]),zn=(e,t)=>{const n=e?.[t];return typeof n=="string"?n:void 0},vr=e=>{const t=go(e);if(t?.code!=="message_placement_unsettled")return;const{details:n}=t;if(!n)return;const a=zn(n,"reason"),r=zn(n,"messageId");if(!(!a||!gu.has(a)||!r))return{reason:a,messageId:r}},yr=(e,t,n)=>({severity:"warning",title:t>1?`Couldn't ${n} ${t} messages yet`:`Couldn't ${n} this message yet`,detail:"It is still being moved on the mail server. Try again in a moment."}),_n=(e,t)=>e.filter(n=>!t.has(n.messageId)),Rt=({mailboxId:e,threadId:t,accountId:n,onAfterOptimisticRemove:a})=>{const r=he(),{pushError:o}=ve(),{mutateAsync:i,isPending:l,isError:u}=ge({...xo(),meta:fa(409),onMutate:async g=>{const y=new Set(g.body.messageIds??[]),f=t?Ae({path:{threadId:t}}):[],v=Ee([e,g.body.destinationMailboxId]);await Promise.all([...t?[r.cancelQueries({queryKey:f})]:[],wt(r,v)]);const p=t?r.getQueriesData({queryKey:f}).filter(d=>d[1]!==void 0).map(([d,b])=>({queryKey:d,data:b})):[],m=Ct(r,v);return t&&r.setQueriesData({queryKey:f},d=>d&&{...d,items:_n(d.items,y)}),Nt(r,v,d=>_n(d,y)),a?.(Array.from(y)),{threadMessagesPrefix:f,listPrefixes:v,previousThreadMessages:p,previousThreadsList:m}},onError:(g,y,f)=>{if(f){for(const m of f.previousThreadMessages)r.setQueryData(m.queryKey,m.data);jt(r,f.previousThreadsList)}const v=y.body.messageIds?.length??0,p=vr(g);if(p){o(yr(p,v,"move"));return}o({title:v>1?`Couldn't move ${v} messages`:"Couldn't move this message",detail:Me(g),error:g})},onSettled:(g,y,f,v)=>{v&&(t&&r.invalidateQueries({queryKey:v.threadMessagesPrefix}),Re(r,v.listPrefixes),n&&r.invalidateQueries({queryKey:kt({path:{accountId:n}})}))}});return{moveMessages:c.useCallback((g,y)=>{g.length!==0&&pt(g,f=>i({body:{messageIds:f,destinationMailboxId:y}}))},[i]),isPending:l,isError:u}},xu="This message could not be processed. Please try again. If it keeps failing, report it.",bu=(e,t)=>e.replace(`Message ${t}'s`,"This message's"),Un=e=>{if(e.failureCount===0)return;const t=e.failures?.[0],n=t?.reason??xu,a=t?bu(n,t.messageId):n;throw new yo(a,422)};function kr({mailboxId:e,threadId:t,accountId:n,onAfterOptimisticRemove:a}){const r=he(),{pushError:o}=ve(),i=Ee([e]),l=t?Ae({path:{threadId:t}}):[],u=()=>{t&&r.invalidateQueries({queryKey:l}),Re(r,i),n&&r.invalidateQueries({queryKey:kt({path:{accountId:n}})})},x=()=>(m,d)=>{u(),a?.(d.body.messageIds)},g=m=>(d,b)=>{o({title:m(b.body.messageIds.length),detail:Me(d),error:d})},y=ge({mutationFn:async m=>{const{data:d}=await bo({...m,throwOnError:!0});return Un(d),d},meta:{softError:!0},onSuccess:x(),onError:g(m=>m>1?`Couldn't report ${m} messages as spam`:"Couldn't report this message as spam")}),f=ge({mutationFn:async m=>{const{data:d}=await vo({...m,throwOnError:!0});return Un(d),d},meta:{softError:!0},onSuccess:x(),onError:g(m=>m>1?`Couldn't undo the spam report for ${m} messages`:"Couldn't undo the spam report")}),v=c.useCallback(m=>{m.length!==0&&pt(m,d=>y.mutateAsync({body:{messageIds:d}}))},[y.mutateAsync]),p=c.useCallback(m=>{m.length!==0&&pt(m,d=>f.mutateAsync({body:{messageIds:d}}))},[f.mutateAsync]);return{reportSpam:v,notSpam:p,isReporting:y.isPending,isRestoring:f.isPending}}const vu=({accountId:e,messageId:t,threadId:n,mailboxId:a,autoMoved:r,spamReport:o})=>{const{inboxMailboxId:i}=pu(e),{junkMailboxId:l}=xr(e),{moveMessages:u,isPending:x}=Rt({mailboxId:a,threadId:n,accountId:e}),{notSpam:g,isRestoring:y}=kr({mailboxId:a,threadId:n,accountId:e}),{data:f}=ne({...yt({path:{accountId:e??""}}),staleTime:1/0,enabled:!!e&&r?.fromMailboxId!==void 0}),v={inboxMailboxId:i,junkMailboxId:l},p=mu(r,v),m=c.useCallback(()=>{p&&u([t],p)},[u,t,p]),d=c.useCallback(()=>{g([t])},[g,t]);if(o)return{show:!0,label:fu,onUndo:d,isUndoing:y};if(!uu(r,a,v)||!r)return{show:!1,label:"",isUndoing:!1};const k=r.fromMailboxId?f?.items.filter(h=>h.mailboxId===r.fromMailboxId).map(h=>ko(h))[0]:void 0;return{show:!0,label:cu(r,k),onUndo:p?m:void 0,isUndoing:x,...r.filterId?{filtersHref:"/settings/filters"}:{}}};function yu({accountId:e,messageId:t,threadId:n,mailboxId:a,autoMoved:r,spamReport:o}){const i=vu({accountId:e,messageId:t,threadId:n,mailboxId:a,autoMoved:r,spamReport:o});return i.show?s.jsx(Ec,{label:i.label,onUndo:i.onUndo,undoLabel:i.isUndoing?"Undoing…":"Undo",filtersHref:i.filtersHref}):null}const ku=({trigger:e,children:t,align:n="right"})=>{const[a,r]=c.useState(!1),o=c.useRef(null),i=c.useCallback(l=>{o.current&&!o.current.contains(l.target)&&r(!1)},[]);return Xt({id:"dropdown-menu",open:a,answers:{back:()=>r(!1)}}),c.useEffect(()=>(a&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)),[a,i]),s.jsxs("div",{ref:o,className:"relative",children:[s.jsx("button",{type:"button",onClick:l=>{l.stopPropagation(),r(!a)},className:P("p-1.5 min-h-11 min-w-11 inline-flex items-center justify-center rounded-md transition-colors","hover:bg-surface-raised text-fg-muted hover:text-fg"),children:e}),a&&s.jsx("div",{className:P("absolute z-50 mt-1 min-w-[180px] py-1","bg-surface border border-line rounded-md shadow-lg",n==="right"?"right-0":"left-0"),children:t})]})},zt=({onClick:e,disabled:t,destructive:n,children:a})=>s.jsx("button",{type:"button",onClick:r=>{r.stopPropagation(),t||e()},disabled:t,className:P("w-full px-3 py-2 text-left text-sm transition-colors","flex items-center gap-2",t&&"opacity-50 cursor-not-allowed",!t&&"hover:bg-surface-raised",n&&"text-danger hover:text-danger"),children:a}),ju=()=>s.jsx("div",{className:"my-1 h-px bg-line"}),Bn=(e,t)=>e.filter(n=>!t.has(n.messageId)),Jp=e=>e.filter(t=>t.isDeleted!==!0),as=({mailboxId:e,threadId:t,accountId:n,messages:a,onAfterOptimisticRemove:r})=>{const o=he(),{pushError:i}=ve(),{requestAppointment:l}=ma(),u=c.useRef([]),x=c.useRef(async()=>{}),{mutateAsync:g,isPending:y}=ge({...wo(),meta:fa(409),onMutate:async p=>{const m=new Set(p.body.messageIds??[]),d=t?Ae({path:{threadId:t}}):[],b=Ee(Ys(m,a??[],e));await Promise.all([o.cancelQueries({queryKey:d}),wt(o,b)]);const k=t?o.getQueriesData({queryKey:d}).filter(j=>j[1]!==void 0).map(([j,S])=>({queryKey:j,data:S})):[],h=Ct(o,b);return t&&o.setQueriesData({queryKey:d},j=>j&&{...j,items:Bn(j.items,m)}),Nt(o,b,j=>Bn(j,m)),r?.(Array.from(m)),{threadMessagesPrefix:d,listPrefixes:b,previousThreadMessages:k,previousThreadsList:h}},onSuccess:(p,m)=>{const d=p?.failureCount??0;if(d===0)return;const b=m.body.messageIds?.length??0;i({severity:"warning",title:d>1?`Couldn't delete ${d} of ${b} messages yet`:"Couldn't delete this message yet",detail:"Something else moved it while the delete was being prepared. It is back where it now sits — try again."})},onError:(p,m,d)=>{if(d){for(const j of d.previousThreadMessages)o.setQueryData(j.queryKey,j.data);jt(o,d.previousThreadsList)}const b=jo(p);if(b){const j=u.current;l({accountId:b.accountId,role:b.role,reason:b.reason,action:{kind:"delete",count:j.length},onAppointed:()=>x.current(j)});return}const k=m.body.messageIds?.length??0,h=vr(p);if(h){i(yr(h,k,"delete"));return}i({title:k>1?`Couldn't delete ${k} messages`:"Couldn't delete this message",detail:Me(p),error:p})},onSettled:(p,m,d,b)=>{b&&(t&&o.invalidateQueries({queryKey:b.threadMessagesPrefix}),Re(o,b.listPrefixes),n&&o.invalidateQueries({queryKey:kt({path:{accountId:n}})}))}}),f=c.useCallback(p=>pt(p,m=>g({body:{messageIds:m}})),[g]);return c.useEffect(()=>{x.current=f},[f]),{deleteMessages:c.useCallback(p=>{p.length!==0&&(u.current=p,f(p))},[f]),isPending:y}},jr="inline-flex items-center justify-center transition-colors",wu=P(jr,"min-h-11 min-w-11 rounded hover:bg-surface-raised"),Cu=P(jr,"min-h-11 gap-1.5 px-3 rounded text-sm font-medium hover:bg-surface-raised"),rs=({accountId:e,currentMailboxId:t,onMove:n,disabled:a=!1,disabledHint:r,variant:o="icon-only",label:i,defaultOpen:l=!1})=>{const[u,x]=c.useState(l),[g,y]=c.useState(),f=Os(),v=c.useRef(null),p=c.useRef(null),m=c.useRef(null),d=i??"Move to folder",b=c.useId(),k=pa(),{data:h,isLoading:j,isError:S,error:I,refetch:A}=ne({...yt({path:{accountId:e}}),staleTime:1/0,enabled:u}),M=br(e),{createFolderIn:T}=ha(e),D=c.useMemo(()=>ga({mailboxes:h?.items??[],folderAppointments:M,currentMailboxId:t,translator:k}),[h?.items,M,t,k]),$=xa(h?.items??[]),K=D.find(B=>B.id===g),_=c.useCallback(()=>{x(!1),y(void 0);const B=document.activeElement;B&&p.current?.contains(B)&&m.current?.focus()},[]),w=c.useCallback(()=>{K&&(_(),n(K.id))},[K,_,n]);Xt({id:"move-to",open:u,answers:{back:_}}),c.useEffect(()=>{if(!u||!f)return;const B=z=>{const W=z.target;v.current?.contains(W)||p.current?.contains(W)||_()};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[u,f,_]);const R=()=>v.current?.getBoundingClientRect()??null,O=a||!!r,C=s.jsxs("button",{type:"button",ref:m,onClick:B=>{B.stopPropagation(),!O&&x(z=>!z)},"aria-label":d,"aria-haspopup":f?"tree":"dialog","aria-expanded":u,"aria-controls":u?b:void 0,title:r,className:o==="icon-only"?wu:Cu,children:[s.jsx(Fs,{className:o==="icon-only"?"size-5":"size-4"}),o==="compact"&&s.jsx("span",{className:"hidden sm:inline",children:"Move"})]}),L=j?s.jsx("div",{className:"px-3 py-5 text-sm text-fg-muted",children:"Loading folders…"}):S?s.jsx("div",{className:"p-3",children:s.jsx(Be,{variant:"inline",title:"Couldn't load folders",error:I,onRetry:()=>A()})}):s.jsx(Co,{folders:D,selectedId:g,delimiter:$,onSelect:y,onCreateFolder:T,onCancel:_,autoFocusFilter:f,labels:{filterPlaceholder:"Filter folders…",filterAriaLabel:"Filter folders"}}),N=K&&s.jsx("div",{className:"shrink-0 border-t border-line p-2",children:s.jsx(H,{variant:"primary",onClick:w,className:"h-11 w-full font-semibold",children:`Move to ${K.label}`})});return f?s.jsxs("div",{ref:v,className:"relative inline-block",children:[C,s.jsx(Ii,{open:u,align:"end",panelRef:p,getAnchor:R,children:s.jsxs("div",{id:b,ref:p,className:P("w-72 max-h-96 flex flex-col","bg-surface border border-line rounded-md shadow-lg"),children:[L,N]})})]}):s.jsxs(s.Fragment,{children:[C,s.jsx(Ve.Root,{open:u,onOpenChange:B=>B?x(!0):_(),children:s.jsxs(Ve.Portal,{children:[s.jsx(Ve.Overlay,{className:"fixed inset-0 z-40 bg-black/40"}),s.jsxs(Ve.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:{maxHeight:"85dvh"},id:b,children:[s.jsx(Ve.Handle,{className:"mx-auto mt-2 mb-1 h-1.5 w-12 rounded-full bg-fg-subtle/30"}),s.jsx(Ve.Title,{className:"px-4 py-2 text-base font-semibold border-b border-line",children:"Move to folder"}),s.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:L}),N]})]})})]})},Nu=({messageId:e,threadId:t,mailboxId:n,isRead:a,accountId:r,fromAddressId:o,isTrusted:i=!1,showRaw:l=!1,onToggleRaw:u})=>{const x=he(),g=vi(),{pushError:y}=ve(),f=yi()?.messageId,{mutate:v,isPending:p}=ge({...Jt(),onMutate:async R=>{const O=R.body.isRead??!0,C=new Set(R.body.messageIds??[]),L=Ae({path:{threadId:t}}),N=Ee([n]);await Promise.all([x.cancelQueries({queryKey:L}),wt(x,N)]);const B=x.getQueriesData({queryKey:L}).filter(W=>W[1]!==void 0).map(([W,X])=>({queryKey:W,data:X})),z=Ct(x,N);return x.setQueriesData({queryKey:L},W=>W&&{...W,items:Qt(W.items,C,O)}),Nt(x,N,W=>Qt(W,C,O)),{threadMessagesPrefix:L,listPrefixes:N,previousThreadMessages:B,previousThreadsList:z}},onError:(R,O,C)=>{if(C){for(const N of C.previousThreadMessages)x.setQueryData(N.queryKey,N.data);jt(x,C.previousThreadsList)}const L=O.body.isRead??!0;y({title:L?"Couldn't mark as read":"Couldn't mark as unread",detail:Me(R),error:R})},onSettled:(R,O,C,L)=>{L&&(x.invalidateQueries({queryKey:L.threadMessagesPrefix}),Re(x,L.listPrefixes))}}),m=c.useCallback(R=>{f&&R.includes(f)&&g()},[f,g]),{deleteMessages:d,isPending:b}=as({mailboxId:n,threadId:t,onAfterOptimisticRemove:m}),{moveMessages:k,isPending:h}=Rt({mailboxId:n,threadId:t,accountId:r,onAfterOptimisticRemove:m}),{toggleTrusted:j,isPending:S,error:I,reset:A}=Ea({messageId:e}),M=()=>{v({body:{messageIds:[e],isRead:!1}})},T=()=>{d([e])},D=()=>{o&&j(o,i)},$=p||b||h||S,K=$||!o,_=c.useCallback(R=>{k([e],R)},[k,e]),w=o?void 0:"Sender has no parseable address";return s.jsxs("div",{className:"flex flex-col items-end gap-1",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[r&&s.jsx(rs,{accountId:r,currentMailboxId:n,onMove:_,disabled:$,label:"Move this message"}),s.jsxs(ku,{trigger:s.jsx(Ti,{className:"size-4"}),children:[s.jsxs(zt,{onClick:D,disabled:K,children:[i?s.jsx(ts,{className:"size-4 text-positive"}):s.jsx(Gt,{className:"size-4 opacity-0"}),s.jsx("span",{title:w,children:"Trusted sender"})]}),a&&s.jsxs(zt,{onClick:M,disabled:$,children:[s.jsx(qs,{className:"size-4"}),"Mark as unread"]}),u&&s.jsxs(zt,{onClick:u,children:[s.jsx(Ya,{className:"size-4"}),l?"Show formatted":"Show raw email"]}),s.jsx(ju,{}),s.jsxs(zt,{onClick:T,disabled:$,destructive:!0,children:[s.jsx(vt,{className:"size-4"}),"Delete"]})]})]}),I&&s.jsx("div",{className:"w-64",children:s.jsx(Be,{variant:"inline",title:"Couldn't update trust",error:I,onRetry:()=>{A(),D()}})})]})},Su=e=>e==="link-expired"||e==="not-ready";class Rs extends Error{reason;status;constructor(t,n,a){super(n),this.name="AttachmentFetchError",this.reason=t,this.status=a}}const Iu="x-remit-403-reason",Tu="expired",Ru=(e,t)=>{if(t?.trim()===Tu)return"link-expired";const n=Ki(e,t);return n==="auth"?"auth":n==="body-missing"?"missing":"generic"},Eu=300*1e3,Kn=async(e,t)=>{const n={},a=await t();a&&(n.Authorization=`Bearer ${a}`);const r=await No(e,{headers:n,signal:AbortSignal.timeout(Eu)});if(r.status===202)throw new Rs("not-ready","Attachment is still being fetched from the mail server",202);if(!r.ok)throw new Rs(Ru(r.status,r.headers.get(Iu)),`Failed to download attachment (${r.status} ${r.statusText})`,r.status);return r.blob()},Mu=(e,t,n)=>{switch(e){case"auth":return{title:"Your session expired",detail:`Sign in again, then download ${t} once more. Other parts of the app may also stop responding until you do.`};case"link-expired":return{title:"This download link expired and could not be renewed",detail:`Reload the page, then download ${t} again. If that keeps failing, this is worth reporting.`};case"missing":return{title:"This attachment is missing from storage",detail:"Remit has the message but not the file. Re-sync the account from Settings, then try again."};case"not-ready":return{title:"Still fetching this attachment",detail:"Remit is downloading it from the mail server now. Try again in a few seconds."};default:return{title:"Couldn't download this attachment",detail:n}}},Hn=e=>e instanceof Rs?e.reason:"generic",Au=e=>e instanceof Error?e.message:typeof e=="string"?e:"An unexpected error occurred while downloading this attachment.",$u=(e,t,n)=>{if(e!=="auth")return ba(va({title:`Bug: attachment download failed (${e})`,errorMessage:`Downloading "${t}" failed: ${n}`}))},Lu=(e,t)=>{const n=URL.createObjectURL(e),a=document.createElement("a");a.href=n,a.download=t,a.rel="noopener",document.body.append(a),a.click(),a.remove(),setTimeout(()=>URL.revokeObjectURL(n),0)},Pu=e=>{const t=e.toUpperCase();return t==="OCTET-STREAM"?"FILE":t},Du=e=>{const t=e.toLowerCase().replace(/[^a-z0-9]/g,"");return t.length>0?`attachment.${t}`:"attachment"},qn=e=>e.filter(t=>!t.isMultipart&&t.disposition===So.Attachment&&t.contentUrl.length>0).map(t=>({bodyPartId:t.bodyPartId,filename:zi(t.dispositionFilename??"",Du(t.mediaSubtype)),typeLabel:Pu(t.mediaSubtype),sizeOctets:t.sizeOctets,contentUrl:t.contentUrl})),Qn={status:"idle"},Fu=({messageId:e,bodyParts:t,hasAttachment:n=!1,className:a})=>{const{getToken:r}=ya(),o=he(),[i,l]=c.useState({}),u=c.useMemo(()=>qn(t??[]),[t]),x=Io({path:{messageId:e}}),g=p=>Kn(p.contentUrl,r).catch(m=>{if(!Su(Hn(m)))throw m;return o.refetchQueries({queryKey:x}).then(()=>{const d=o.getQueryData(x),b=d?qn(d.bodyParts).find(k=>k.bodyPartId===p.bodyPartId):void 0;return Kn(b?.contentUrl??p.contentUrl,r)})}),y=(p,m)=>l(d=>({...d,[p]:m})),f=p=>{const m=u.find(d=>d.bodyPartId===p);if(!m)throw new Error(`No attachment part ${p} on message ${e}`);y(p,{status:"downloading"}),g(m).then(d=>{Lu(d,m.filename),y(p,Qn)}).catch(d=>{const b=Hn(d),k=Au(d),{title:h,detail:j}=Mu(b,m.filename,k);y(p,{status:"failed",title:h,detail:j,reportUrl:$u(b,m.filename,k)})})},v=n&&t!==void 0&&u.length===0;return s.jsx(Rc,{className:a,attachments:u.map(p=>({attachmentId:p.bodyPartId,filename:p.filename,typeLabel:p.typeLabel,sizeOctets:p.sizeOctets,download:i[p.bodyPartId]??Qn})),onDownload:f,hasUnlistedAttachment:v})},wr=e=>e.syncStatus===To.abandoned?e.abandonedMutation:ht.none;function Ou({threadMessage:e,accountId:t,className:n}){const a=wr(e),r=a===ht.delete?"delete_failed":a===ht.move?"move_failed":void 0,{accountId:o}=ns(r==="move_failed"&&!t?e.mailboxId:void 0),i=t??o,{deleteMessages:l,isPending:u}=as({mailboxId:e.mailboxId,threadId:e.threadId,accountId:i,messages:[e]}),{moveMessages:x,isPending:g}=Rt({mailboxId:e.mailboxId,threadId:e.threadId,accountId:i}),y=c.useCallback(()=>{l([e.messageId])},[l,e.messageId]),f=c.useCallback(p=>{x([e.messageId],p)},[x,e.messageId]),v=c.useMemo(()=>r?ba(va({title:Ht[r].title,errorMessage:`Message ${e.messageId}: status=${e.status} syncStatus=${e.syncStatus} abandonedMutation=${e.abandonedMutation}`})):void 0,[r,e.messageId,e.status,e.syncStatus,e.abandonedMutation]);return r?s.jsx(nd,{settlement:r,onRetry:r==="delete_failed"?y:void 0,action:r==="move_failed"&&i?s.jsx(rs,{accountId:i,currentMailboxId:e.mailboxId,onMove:f,disabled:g,variant:"compact",label:Ht.move_failed.retryLabel}):void 0,retryPending:r==="delete_failed"?u:g,reportHref:v,className:n}):null}const zu=({messageId:e,threadId:t,mailboxId:n,accountId:a,isRead:r,isStarred:o,onToggleStar:i,fromAddressId:l,isTrusted:u,showRaw:x,onToggleRaw:g,onReply:y,onReplyAll:f,onForward:v})=>{const p=he(),{deleteMessages:m}=as({mailboxId:n,threadId:t}),{moveMessages:d}=Rt({mailboxId:n,threadId:t,accountId:a}),{toggleTrusted:b}=Ea({messageId:e}),{mutate:k}=ge({...Jt(),onSettled:()=>{p.invalidateQueries({queryKey:Ae({path:{threadId:t}})}),Re(p,Ee([n]))}}),h=c.useCallback(A=>{d([e],A)},[d,e]),j=c.useCallback(()=>{m([e])},[m,e]),S=c.useCallback(()=>{k({body:{messageIds:[e],isRead:!r}})},[k,e,r]),I=[];return l&&I.push({key:"trusted",label:u?"Trusted sender":"Mark sender trusted",icon:u?s.jsx(ts,{className:"size-4 text-positive"}):s.jsx(Gt,{className:"size-4"}),onSelect:()=>b(l,u)}),g&&I.push({key:"raw",label:x?"Show formatted":"Show raw email",icon:s.jsx(Ya,{className:"size-4"}),onSelect:g}),s.jsx(or,{hasThread:!0,onReply:y,onReplyAll:f,onForward:v,isStarred:o,onToggleStar:i,onDelete:j,isRead:r,onToggleRead:S,overflowItems:I,moveSlot:a?s.jsx(rs,{accountId:a,currentMailboxId:n,onMove:h,label:"Move this message"}):void 0})},_u=()=>s.jsxs("div",{className:"animate-pulse space-y-2",role:"status","aria-label":"Loading raw email",children:[s.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),s.jsx("div",{className:"h-4 bg-surface-sunken rounded w-11/12"}),s.jsx("div",{className:"h-4 bg-surface-sunken rounded w-5/6"}),s.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}),Uu=({messageId:e,enabled:t=!0})=>{const{data:n,isLoading:a,isError:r,error:o,refetch:i}=ne({...Ro({path:{messageId:e}}),enabled:t});if(a)return s.jsx("div",{className:"message-body",children:s.jsx(_u,{})});if(r)return s.jsx("div",{className:"message-body",children:s.jsx(Be,{variant:"inline",title:"Couldn't load the raw email",error:o,onRetry:()=>i()})});const l=n?.raw??"";return l===""?s.jsx("div",{className:"message-body",children:s.jsx("p",{className:"text-fg-muted text-sm italic",children:"No raw source available for this message."})}):s.jsx("div",{className:"message-body",children:s.jsx("pre",{className:"email-text whitespace-pre-wrap break-words text-sm leading-relaxed bg-surface-sunken rounded-md p-3 max-h-[32rem] overflow-auto",children:l})})},Bu=()=>s.jsx(ts,{className:"inline-block size-4 ml-1 -mt-0.5 text-positive align-middle","aria-label":"Trusted sender","data-testid":"trusted-sender-badge"}),Cr=(e,t)=>({id:e.messageId,fromName:e.fromName??e.fromEmail??"?",fromEmail:e.fromEmail??"",toLabel:"",dateLabel:t,snippet:e.snippet||"",bodyHtml:""}),Nr=({isStarred:e,onToggleStar:t,isStarPending:n,hoverReveal:a})=>s.jsx("button",{type:"button",onClick:r=>{r.stopPropagation(),t()},disabled:n,"aria-label":e?"Remove star":"Add star",className:P("shrink-0 p-0.5 rounded transition-colors",e?"text-warning":P("text-fg-subtle hover:text-warning",a&&"opacity-0 group-hover:opacity-100 focus:opacity-100"),n&&"opacity-50"),children:s.jsx(et,{className:P("size-3.5",e&&"fill-current")})}),Ku=({threadMessage:e,isFocused:t,onToggle:n,onToggleStar:a,isStarPending:r})=>{const o=ka(e.sentDate,"datetime"),i=Cr(e,o);return s.jsx(ir,{message:i,onClick:n,isFocused:t,isUnread:!e.isRead,trailing:s.jsxs(s.Fragment,{children:[e.hasAttachment&&s.jsx(Zt,{className:"size-3 shrink-0 text-fg-subtle",role:"img","aria-label":"Has an attachment"}),s.jsx(Nr,{isStarred:e.hasStars,onToggleStar:a,isStarPending:r,hoverReveal:!0}),s.jsx("span",{"data-testid":"message-date",className:"shrink-0 text-2xs text-fg-subtle tabular-nums",children:o})]})})},Hu=({threadMessage:e,messageData:t,isLoading:n,isError:a,error:r,onRetry:o,isFocused:i,onToggle:l,onToggleStar:u,isStarPending:x,accountId:g,showRaw:y,onToggleRaw:f,mobile:v,onReply:p,onReplyAll:m,onForward:d})=>{const b=ka(e.sentDate,"long"),k=!e.isRead,h=t?.envelope.from[0]?.flags?.trusted?.value===!0,j=t?.envelope.from[0]?.flags?.blocked?.value===!0,S=t?.envelope.from[0]?.addressId,I=Cr(e,b),A=e.autoMoved||e.spamReport?s.jsx(yu,{accountId:g,messageId:e.messageId,threadId:e.threadId,mailboxId:e.mailboxId,autoMoved:e.autoMoved,spamReport:e.spamReport}):null;return s.jsx(lr,{message:I,isFocused:v?!1:i,onHeaderClick:l,senderBadge:h&&!j?s.jsx(Bu,{}):void 0,trailing:s.jsx("span",{"data-testid":"message-date",className:"text-2xs text-fg-subtle",children:b}),to:t?s.jsx(Ic,{label:"To",addresses:t.envelope.to}):null,indicators:A||!v?s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mt-0.5",children:[A,!v&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex items-center justify-end gap-1",children:s.jsx(Nr,{isStarred:e.hasStars,onToggleStar:u,isStarPending:x})}),k&&s.jsx("span",{className:"size-1.5 rounded-full bg-accent","aria-label":"Unread"})]})]}):void 0,actionMenu:v?void 0:s.jsx(Nu,{messageId:e.messageId,threadId:e.threadId,mailboxId:e.mailboxId,isRead:e.isRead,accountId:g,fromAddressId:S,isTrusted:h,showRaw:y,onToggleRaw:f}),actionBar:v?s.jsx(zu,{messageId:e.messageId,threadId:e.threadId,mailboxId:e.mailboxId,accountId:g,isRead:e.isRead,isStarred:e.hasStars,onToggleStar:u,fromAddressId:S,isTrusted:h,showRaw:y,onToggleRaw:f,onReply:p,onReplyAll:m,onForward:d}):void 0,body:s.jsxs(s.Fragment,{children:[s.jsx(Ou,{threadMessage:e,accountId:g,className:"mt-3"}),n?s.jsxs("div",{className:"mt-3 animate-pulse space-y-2",children:[s.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),s.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"}),s.jsx("div",{className:"h-4 bg-surface-sunken rounded w-1/2"})]}):a&&Eo(r)?s.jsx("div",{className:"mt-3",children:s.jsx(Pa,{message:"This message has been deleted"})}):a?s.jsx("div",{className:"mt-3",children:s.jsx(Be,{variant:"inline",title:"Couldn't load this message",error:r,onRetry:o})}):y?s.jsx("div",{className:"mt-3",children:s.jsx(Uu,{messageId:e.messageId})}):s.jsxs("div",{className:"mt-3",children:[s.jsx(Ai,{bodyParts:t?.bodyParts,messageId:e.messageId,fromAddressId:t?.envelope.from[0]?.addressId,isTrusted:h,isBlocked:j,category:gr(e.category)}),s.jsx(Fu,{messageId:e.messageId,bodyParts:t?.bodyParts,hasAttachment:e.hasAttachment,className:"mt-4"})]})]})})},qu=({threadMessage:e,isExpanded:t,isFocused:n,onToggle:a,onToggleStar:r,isStarPending:o,accountId:i,mobile:l,onReply:u,onReplyAll:x,onForward:g})=>{const[y,f]=c.useState(!1),{data:v,isLoading:p,isError:m,error:d,refetch:b}=ne({...Yt({path:{messageId:e.messageId}}),enabled:t,meta:{softError:!0}});return t?s.jsx(Hu,{threadMessage:e,messageData:v,isLoading:p,isError:m,error:d,onRetry:()=>b(),isFocused:n,onToggle:a,onToggleStar:r,isStarPending:o,accountId:i,showRaw:y,onToggleRaw:()=>f(k=>!k),mobile:l,onReply:u,onReplyAll:x,onForward:g}):s.jsx(Ku,{threadMessage:e,isFocused:n,onToggle:a,onToggleStar:r,isStarPending:o})},Qu=()=>s.jsxs("div",{className:"animate-pulse p-4",children:[s.jsx("div",{className:"h-6 bg-surface-sunken rounded w-3/4 mb-5"}),s.jsx("div",{className:"space-y-4",children:Array.from({length:2}).map((e,t)=>s.jsxs("div",{className:"flex gap-3 py-3",children:[s.jsx("div",{className:"size-10 bg-surface-sunken rounded-full shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"h-4 bg-surface-sunken rounded w-32 mb-2"}),s.jsx("div",{className:"h-3 bg-surface-sunken rounded w-48"})]})]},t))})]}),Xp=({threadId:e,mailboxId:t,subject:n,selectedMessageId:a,authenticity:r,onOpenIntelligence:o,onBack:i,onSwipeNext:l,onSwipePrevious:u,mobileIntelligenceOpen:x,listOnScreen:g=!1})=>{const y=Os(),{handlers:f}=ou({onSwipeLeft:l,onSwipeRight:u}),{accountId:v}=ns(t),{data:p,isLoading:m,isError:d,error:b,refetch:k}=ne({...ja({path:{threadId:e}})}),h=c.useMemo(()=>p?.items??[],[p?.items]),j=h[h.length-1],S=c.useMemo(()=>[...h].reverse(),[h]),I=c.useRef(new Map),[A,M]=c.useState(new Set),[T,D]=c.useState(null),[$,K]=c.useState(0);c.useEffect(()=>{if(h.length>0&&e!==T){D(e);const Q=new Set([h[h.length-1].threadMessageId]);if(a){const G=h.find(re=>re.messageId===a);G&&Q.add(G.threadMessageId)}M(Q),K(0)}},[e,h,T,a]);const _=c.useCallback(Q=>{M(G=>{const re=new Set(G);return re.has(Q)?re.delete(Q):re.add(Q),re})},[]),w=c.useCallback(Q=>{const G=S[Q];if(!G)return;I.current.get(G.threadMessageId)?.scrollIntoView({behavior:"smooth",block:"nearest"})},[S]),R=c.useCallback(()=>{if(S.length===0)return;const Q=Math.min($+1,S.length-1);K(Q),w(Q)},[S.length,$,w]),O=c.useCallback(()=>{if(S.length===0)return;const Q=Math.max($-1,0);K(Q),w(Q)},[S.length,$,w]),C=c.useCallback(()=>{const Q=S[$];Q&&_(Q.threadMessageId)},[S,$,_]);su({messages:h,expandedIds:A,threadId:e,mailboxId:t,accountId:v});const{toggleStar:L,isPending:N,pendingMessageId:B}=hr({threadId:e,mailboxId:t,messages:h}),z=Mo(),W=ua(),X=a??j?.messageId,Y=c.useCallback((Q,G)=>{G&&W({threadId:e,messageId:G,mode:Q})},[W,e]),oe=c.useCallback(()=>Y("reply",X),[Y,X]),Z=c.useCallback(()=>Y("reply-all",X),[Y,X]),ie=c.useCallback(()=>Y("forward",X),[Y,X]),se=c.useRef(null),F=z?.kind==="reply"?`${z.mode}:${z.sourceMessageId}`:void 0;if(c.useEffect(()=>{F&&se.current?.scrollIntoView({behavior:"smooth",block:"start"})},[F]),_i({enabled:!m&&h.length>0&&z===void 0,bindings:[...g?[]:[{key:"j",action:"focusNext",handler:R,preventDefault:!0},{key:"ArrowDown",action:"focusNext",handler:R,preventDefault:!0},{key:"k",action:"focusPrevious",handler:O,preventDefault:!0},{key:"ArrowUp",action:"focusPrevious",handler:O,preventDefault:!0},{key:"Enter",action:"openFocused",handler:C,preventDefault:!0},{key:"o",action:"openFocused",handler:C,preventDefault:!0}],{key:"r",action:"reply",handler:oe,preventDefault:!0},{key:"R",action:"replyAll",handler:Z,noModifiers:!1,preventDefault:!0},{key:"f",action:"forward",handler:ie,preventDefault:!0}]}),m)return s.jsx(Qu,{});if(d)return s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsx(Be,{title:z?"Couldn't load this conversation, so there is nothing to answer":"Couldn't load this conversation",error:b,onRetry:()=>k()})});if(h.length===0)return s.jsx("div",{className:"flex h-full items-center justify-center p-4",children:z?s.jsx(Be,{variant:"inline",title:"There is nothing here to answer",error:"This conversation has no messages left. Another mail client may have moved or deleted them."}):s.jsx(Pa,{message:"No messages in this thread"})});const ee=n||h[0]?.subject||"(No subject)",le=h.length,me=Q=>s.jsx("div",{"data-testid":"conversation-messages",children:S.map((G,re)=>s.jsx("div",{ref:ye=>{ye&&I.current.set(G.threadMessageId,ye)},children:s.jsx(qu,{threadMessage:G,isExpanded:A.has(G.threadMessageId),isFocused:re===$,onToggle:()=>_(G.threadMessageId),onToggleStar:()=>L(G.messageId,G.hasStars),isStarPending:N&&B===G.messageId,accountId:v,mobile:Q,onReply:Q?()=>Y("reply",G.messageId):void 0,onReplyAll:Q?()=>Y("reply-all",G.messageId):void 0,onForward:Q?()=>Y("forward",G.messageId):void 0})},G.threadMessageId))}),q=z&&s.jsx("div",{ref:se,children:z.kind==="reply"?s.jsx(Xd,{surface:z}):s.jsx("div",{className:"border-b border-line bg-canvas p-4",children:s.jsx(Be,{variant:"inline",title:"That is not a way to answer a message",error:`"${z.segment}" is not reply, reply-all or forward.`})})}),ce=s.jsxs("header",{className:"border-b border-line px-5 pt-5 pb-3",children:[s.jsx("h1",{className:"max-w-2xl text-lg font-semibold leading-snug text-fg",children:ee}),s.jsxs("p",{className:"mt-1 text-2xs text-fg-subtle",children:[le," ",le===1?"message":"messages"]})]});return y?s.jsxs("article",{className:"h-full flex flex-col",children:[ce,r?.dkimMismatch&&s.jsx(On,{authenticity:r,onOpenIntelligence:o}),s.jsxs("div",{className:"min-h-0 flex-1 overflow-auto",children:[q,me(!1)]})]}):s.jsxs(cd,{thread:{subject:ee,messages:[]},onBack:i??(()=>{}),intelligenceOpen:x,onToggleIntelligence:o,touchHandlers:f,children:[r?.dkimMismatch&&s.jsx(On,{authenticity:r,onOpenIntelligence:o}),q,me(!0)]})},Wu=e=>{switch(wr(e)){case ht.delete:return{settlement:"delete_failed"};case ht.move:return{settlement:"move_failed"};default:return{}}},Gu=({isOpen:e,onClose:t,children:n,ariaLabel:a="Navigation",side:r="left",widthClassName:o="w-[80vw] max-w-[320px]",answers:i})=>{const l=c.useRef(null);if(Xt({id:"drawer",open:e,answers:{back:t,...i}}),wa(l,e),c.useEffect(()=>{if(!e)return;const x=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=x}},[e]),!e)return null;const u=r==="left"?"left-0 border-r animate-in slide-in-from-left duration-150":"right-0 border-l animate-in slide-in-from-right duration-150";return s.jsxs("div",{className:"fixed inset-0 z-50",role:"dialog","aria-modal":"true","aria-label":a,children:[s.jsx("button",{type:"button","aria-label":"Close menu",onClick:t,className:"absolute inset-0 bg-black/40 animate-in fade-in duration-150 cursor-default"}),s.jsxs("div",{ref:l,tabIndex:-1,className:P("safe-area-frame absolute top-0 bottom-0 bg-canvas border-line shadow-xl flex flex-col",o,u),children:[s.jsx("div",{className:"flex items-center justify-end h-12 px-2 border-b border-line shrink-0",children:s.jsx("button",{type:"button",onClick:t,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 menu",children:s.jsx(Xe,{className:"size-5"})})}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:n})]})]})},_t=e=>({messageId:e,tab:void 0,offering:!1,picked:[],answering:"",failure:{suggestionId:"",text:""}}),Vu=(e,t)=>{const n=+(t.state==="Pending")-+(e.state==="Pending");return n!==0?n:t.sequence-e.sequence},Yu=(e,t)=>t.kind==="refused"?`Couldn't ${e}: ${t.message} Try again, or answer from your calendar app.`:"";function Ju(e,t){const n=e.messageId,{suggestions:a,isLoading:r,error:o}=Vi(n),i=gl(),{calendars:l,defaultCalendarId:u,colorByCalendarId:x,timeZoneByCalendarId:g}=i,y=Yi(i),f=Ji(),v=ll(),[p,m]=c.useState(()=>_t(n)),d=p.messageId===n?p:_t(n),b=c.useRef(n);b.current=n;const k=F=>{b.current===n&&m(ee=>({...ee.messageId===n?ee:_t(n),...F}))},h=c.useMemo(()=>a.filter(Xi).filter(F=>fn(F)!==void 0).sort(Vu)[0],[a]),j=a.filter(F=>F!==h&&F.state==="Pending"),S=h??j[0],I=S?Zi(S):"",A=xl(I===""?"1970-01-01":I,1),M=cl({...A,calendarIds:[],enabled:I!==""}),T=el(I===""?[]:[A]),D={threadId:e.threadId,threadSubject:e.subject??"",calendarId:u},$=e.fromName??e.fromEmail??"",K=pl(d.failure.text||"the invitations in a message could not be read"),_=ol(y,K),w=(F,ee,le)=>{k({answering:F,failure:{suggestionId:F,text:""}}),le().then(me=>k({answering:"",failure:{suggestionId:F,text:Yu(ee,me)}}))},R=h?.suggestionId??"",O=d.failure.suggestionId===R?d.failure.text:"",C=d.failure.suggestionId===R?"":d.failure.text,L=h?fn(h):void 0,N=h&&L?{invite:sl(h,L.state,{...D,senderName:$}),whenText:mn(h),calendarName:l.find(F=>F.id===u)?.name??"Calendar",color:x[u]??"cal-1",clashes:L.state==="pending"?tl({start:h.dtStart,end:h.dtEnd},T.spans):[],rsvp:L.rsvp,busy:d.answering===h.suggestionId,failure:O,reportHref:K,addBlocked:_,sender:$}:void 0,B=I===""?[]:nl(I,T.spans),z=M.instances.filter(bl).filter(F=>!F.allDay).sort((F,ee)=>F.start.localeCompare(ee.start)).map(F=>({event:vl(F,g[F.calendarId]??"",yl()),timeText:dl(F.start),color:x[F.calendarId]??"cal-1"})),W=j.map(F=>({suggestion:al(F,{...D,sender:$}),whenText:mn(F)})),X=o===null?"":"Couldn't read the invitations in this message. Reopen it to try again.",Y=h?.method==="Cancel",oe=I===""?"":rl(I,B,d.picked),Z={onAddInvite:()=>w(R,"add this to your calendar",()=>f.accept(R,u)),onTentativeInvite:Y?void 0:()=>w(R,"add this as a maybe",()=>f.tentative(R,u)),onDeclineInvite:()=>w(R,"decline this",()=>f.decline(R)),onMuteInvite:()=>w(R,"stop these invitations",()=>f.dismiss(R,!0)),onRemoveInvite:Y?()=>w(R,"take this off your calendar",()=>f.accept(R,u)):void 0,onReopenInvite:Y?()=>w(R,"keep this on your calendar",()=>f.dismiss(R,!1)):void 0,onOfferOtherTimes:()=>k({offering:!0}),onToggleSlot:F=>k({picked:d.picked.includes(F.startTime)?d.picked.filter(ee=>ee!==F.startTime):[...d.picked,F.startTime]}),onReplyWithSlots:t?()=>t({threadId:e.threadId,messageId:n},oe):void 0,onAddSuggestion:F=>w(F,"add this to your calendar",()=>f.accept(F,u)),onDismissSuggestion:F=>w(F,"dismiss this",()=>f.dismiss(F,!1)),onSelectEvent:F=>{const{calendarObjectId:ee,recurrenceId:le}=kl(F);v(I,ee,le)}},ie=N!==void 0||W.length>0||o!==null,se=d.tab!==void 0;return c.useEffect(()=>{r||se||m(F=>F.messageId===n&&F.tab!==void 0?F:{...F.messageId===n?F:_t(n),tab:ie?"calendar":"sender"})},[r,se,ie,n]),{surface:{data:{invite:N,prose:d.offering&&I!==""?{dayLabel:pn(I),proposals:[],slots:B,picked:d.picked}:void 0,suggestions:W,day:z,dayLabel:I===""?"":pn(I),suggestionsBusy:d.answering!==""&&!N?.busy,failure:X,suggestionsFailure:C,reportHref:K,addBlocked:_},actions:Z},tab:d.tab??"sender",onTabChange:F=>k({tab:F})}}const Sr=()=>{const{data:e}=ne({...tt(),staleTime:1/0});return e?.semanticSearchEnabled},Xu=10,Ir=e=>({q:e?.toLowerCase()??"",limit:Xu}),Zu=(e,t)=>{if(!t)return;const n=t.toLowerCase();return e?.find(a=>a.normalizedEmail===n)};function ef(e){const t=new Date(e),n=new Date;return t.toDateString()===n.toDateString()?"today":$o(t,{month:"short",year:"numeric"})}function Tr(e){if(!e)return!0;const[,t]=e.split("@");return t?!t.includes("."):!0}const tf="We can't verify the sender of this email, which could mean it's from an insecure source.",sf="We couldn't read this sender's address, so we can't confirm who really sent this message.";function nf(e,t){const n=e.category??"personal";return{value:Ca(n)?n:"uncategorized",overridden:t?.flags?.category?.value!=null&&t.flags.category.value!==e.category}}function af(e,t){return{name:e.fromName??e.fromEmail??"Unknown",email:e.fromEmail??"",trust:e.senderTrust,firstSeenLabel:t?ef(t.createdAt):"unknown",inboundCount:t?.inboundCount,replyCount:t?.replyCount,addressUnverified:Tr(e.fromEmail)}}function rf(e){return e?.flags?{vip:e.flags.vip?.value===!0,muted:e.flags.muted?.value===!0,blocked:e.flags.blocked?.value===!0}:{}}function Wn(e){if(e.fromName&&e.fromName!==e.fromEmail)return e.fromName}function of(e){return e.length===1?e[0]:`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function lf(e,t){const n=[],a=e.displayNameCorrespondence;t&&(a===ms.Unrelated?n.push(`The name it shows, "${t}", has nothing to do with ${e.fromDomain}.`):a===ms.Lookalike?n.push(`The name it shows, "${t}", only looks like ${e.fromDomain}.`):a===ms.ForeignAddress&&n.push(`The name it shows, "${t}", is an address ${e.fromDomain} cannot send from.`));const r=cf(e.offDomainLinkDomains);return r.length>0&&n.push(`Its links go to ${of(r.slice(0,3))}.`),n}function cf(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}function df(e,t){const n=t>0?t:void 0;if(Tr(e.fromEmail))return{verdict:"mismatch",fromDomain:"",addressUnreadable:!0,summary:sf,similarCount:n};const a=e.authenticity;if(!a)return{verdict:"caution",fromDomain:e.fromEmail?.split("@")[1]??"",summary:tf};if(!a.dkimMismatch){const x=Wn(e),g=lf(a,x);return g.length>0?{verdict:"caution",fromDomain:a.fromDomain,dkimDomain:a.dkimDomain,claimedBrand:x,summary:g.join(" ")}:{verdict:"aligned",fromDomain:a.fromDomain,dkimDomain:a.dkimDomain,summary:a.dkimDomain?`This message was signed by ${a.dkimDomain}.`:"Nothing looks unusual about this sender."}}const r=a.fromDomain,o=a.dkimDomain,i=Wn(e),l=o?`it was actually sent from ${o}`:"its signature failed to verify",u=i?`The display name claims "${i}", but ${l}${o?` — not ${r}`:""}. Real senders use their own address.`:`This message claims to be from ${r}, but ${l}.`;return{verdict:"mismatch",fromDomain:r,dkimDomain:o,claimedBrand:i,summary:u,similarCount:n}}function uf(e,t){const n=e?.fromEmail??null,a=e?.subject??"",{data:r,error:o}=ne({...zs({query:Ir(n??void 0)}),enabled:!!n,staleTime:3e4}),i=Zu(r?.items,n??void 0),l=Sr(),u=[a,n].filter(Boolean).join(" "),{data:x,isLoading:g,error:y}=ne({...Ao({query:{query:u,limit:5}}),enabled:!!(e&&u.length>3)&&l===!0,staleTime:6e4,retry:1});return{data:c.useMemo(()=>{if(!e)return null;const v=(x?.items??[]).filter(k=>k.messageId!==e.messageId).map(k=>({id:k.messageId,threadId:k.threadId,mailboxId:t!=null&&k.mailboxIds.includes(t)?t:k.mailboxIds[0]??"",fromName:k.fromName??"",subject:k.subject??"(No subject)",timeLabel:k.sentDate!=null?st(k.sentDate*1e3):"",matched:k.matchedChunkType})),p=af(e,i),m=df(e,v.length),d=nf(e,i),b=rf(i);return{sender:p,authenticity:m,category:d,flags:b,similar:v}},[e,i,x,t]),isSimilarLoading:g,similarError:y,similarErrorIsFatal:ln(y),semanticEnabled:l,addressErrorIsFatal:ln(o),addressId:i?.addressId,address:i}}function ff(e,t,n=[]){const a={...e??{}};for(const[r,o]of Object.entries(t))o==null?delete a[r]:a[r]={...o,setAt:o.setAt??Date.now()};for(const r of n)delete a[r];return a}function mf({addressId:e,senderEmail:t}){const n=he(),{pushError:a}=ve(),r=Lo({query:Ir(t)}),{mutate:o,isPending:i}=ge({...Po(),onMutate:async g=>{const y=g.body.flags??{},f=g.body.clearFlags??[];await n.cancelQueries({queryKey:r});const v=n.getQueryData(r);return n.setQueryData(r,p=>p&&{...p,items:p.items.map(m=>m.addressId===g.path.addressId?{...m,flags:ff(m.flags,y,f)}:m)}),{previous:v}},onError:(g,y,f)=>{f?.previous!==void 0&&n.setQueryData(r,f.previous),a({title:"Couldn't update sender preference",detail:Me(g),error:g})},onSettled:()=>{n.invalidateQueries({queryKey:r})}}),l=c.useCallback(g=>{if(!e){Do(new Error(`Quick action fired but the sender's address record did not resolve (sender: ${t??"unknown"}). This should never happen — the address row exists.`));return}o({path:{addressId:e},body:g})},[e,o,t]),u=c.useCallback(g=>l({flags:g}),[l]),x=c.useCallback(g=>l({clearFlags:g}),[l]);return{updateFlags:u,clearFlags:x,isPending:i}}const Zp=e=>e==="vip"?"A sender you know":e==="wellknown"?"You've emailed them before":"Passed authentication",pf=e=>e.senderTrust!=="vip"&&e.senderTrust!=="wellknown"?!1:e.authenticity?.dkimMismatch!==!0;function eh(e,t){e.recordEvent("rescue.candidates_surfaced",{count:String(t)})}function th(e,t){e.recordEvent("rescue.flow_opened",{count:String(t)})}function sh(e,t){e.recordEvent("rescue.committed",{selected:String(t.selected),total:String(t.total),destination:t.toInbox?"inbox":"other"})}function hf(e,t){e.recordEvent("rescue.sent_to_junk",{count:String(t.count),senderTrust:t.senderTrust,wasRescuable:String(t.wasRescuable)})}const gf=e=>e!=="uncategorized",xf=zo.map(e=>e.category).filter(gf),bf=e=>e.spamReport?"notSpam":"reportSpam",vf=e=>{const{similarError:t,similarErrorIsFatal:n,isSimilarLoading:a,semanticEnabled:r}=e;return r===!1?"off":t&&!n?"error":a?"loading":"ready"};function yf(){return s.jsxs("aside",{className:"flex h-full w-full flex-col bg-surface-sunken",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-1.5 border-b border-line px-row-inset",children:[s.jsx(Ze,{className:"size-3.5 text-fg-subtle"}),s.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Intelligence"})]}),s.jsxs("div",{className:"flex-1 animate-pulse space-y-4 p-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"h-2.5 rounded bg-surface w-1/4"}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("div",{className:"size-10 rounded-full bg-surface shrink-0"}),s.jsxs("div",{className:"flex-1 space-y-1.5",children:[s.jsx("div",{className:"h-3 rounded bg-surface w-3/4"}),s.jsx("div",{className:"h-2.5 rounded bg-surface w-1/2"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"h-2.5 rounded bg-surface w-1/4"}),s.jsx("div",{className:"h-8 rounded bg-surface"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"h-2.5 rounded bg-surface w-1/4"}),s.jsx("div",{className:"flex gap-1.5 flex-wrap",children:Array.from({length:5}).map((e,t)=>s.jsx("div",{className:"h-6 w-16 rounded bg-surface"},t))})]})]})]})}function kf({isOpen:e,current:t,hasOverride:n,onSelect:a,onClear:r,onCancel:o}){const i=c.useRef(null);return wa(i,e),e?s.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[s.jsx(Oo,{label:"Dismiss reclassify sender",onDismiss:o,className:"backdrop-blur-sm"}),s.jsxs("div",{ref:i,role:"dialog","aria-modal":"true","aria-label":"Reclassify sender",tabIndex:-1,className:"relative z-10 w-full max-w-sm rounded-sm border border-line bg-surface p-6 shadow-lg",children:[s.jsx("h2",{className:"text-lg font-semibold",children:"Reclassify this sender"}),s.jsx("p",{className:"mt-2 text-sm text-fg-muted",children:"Set a category override for future messages from this sender."}),s.jsxs("div",{className:"mt-4 flex flex-col gap-1",children:[xf.map(l=>s.jsxs("button",{type:"button",onClick:()=>a(l),className:`flex min-h-11 items-center justify-between rounded px-3 text-left text-sm transition-colors hover:bg-surface-raised ${l===t?"font-semibold text-accent":"text-fg"}`,children:[Vt[l],l===t&&s.jsx("span",{className:"text-2xs text-fg-subtle",children:"current"})]},l)),n&&s.jsx("button",{type:"button",onClick:r,className:"mt-1 flex min-h-11 items-center rounded border-t border-line px-3 text-left text-sm text-fg transition-colors hover:bg-surface-raised",children:"Remove override — classify automatically again"})]}),s.jsx("div",{className:"mt-6 flex justify-end",children:s.jsx("button",{type:"button",onClick:o,className:"inline-flex min-h-11 items-center justify-center rounded border border-line px-4 text-sm font-medium transition-colors hover:bg-surface-raised",children:"Cancel"})})]})]}):null}function jf({thread:e,onClose:t,mailboxId:n,accountId:a,hideCloseButton:r,onAfterOptimisticRemove:o,onReplyWithText:i}){const{data:l,address:u,addressId:x,isSimilarLoading:g,similarError:y,similarErrorIsFatal:f,semanticEnabled:v}=uf(e,n),p=Ju(e,i),[m,d]=c.useState(!1),b=e.fromEmail??void 0,{updateFlags:k,clearFlags:h}=mf({addressId:x,senderEmail:b}),{reportSpam:j,notSpam:S,isReporting:I,isRestoring:A}=kr({mailboxId:e.mailboxId,threadId:e.threadId,accountId:a,onAfterOptimisticRemove:o}),M=Fo(),T=bf(e),D=c.useCallback(()=>{S([e.messageId])},[S,e.messageId]),$=c.useCallback(()=>{hf(M,{count:1,senderTrust:e.senderTrust,wasRescuable:pf(e)}),j([e.messageId])},[j,e,M]),K=c.useCallback(()=>{},[]),_=c.useCallback(()=>{const z=l?.flags?.vip!==!0;k({vip:{value:z}})},[l?.flags?.vip,k]),w=c.useCallback(()=>{const z=l?.flags?.muted!==!0;k({muted:{value:z}})},[l?.flags?.muted,k]),R=c.useCallback(z=>{d(!1),k({category:{value:z}})},[k]),O=c.useCallback(()=>{d(!1),h(["category"])},[h]),C=x!==void 0,L={onToggleVip:C?_:void 0,onToggleMute:C?w:void 0,onReclassify:C?()=>d(!0):void 0,onNotSpam:T==="notSpam"?D:void 0,onReportSpam:T==="reportSpam"?$:void 0},N=({mailboxId:z,threadId:W,messageId:X,className:Y,ariaLabel:oe,children:Z})=>s.jsx(Na,{to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:z,threadId:W,messageId:X},search:ie=>ie,variant:"row",className:Y,"aria-label":oe,children:Z});if(!l)return s.jsx(yf,{});const B=vf({similarError:y,similarErrorIsFatal:f,isSimilarLoading:g,semanticEnabled:v});return s.jsxs(s.Fragment,{children:[s.jsx(Za,{data:l,calendar:p.surface,tab:p.tab,onTabChange:p.onTabChange,onClose:t,hideCloseButton:r,onShowSimilar:K,actions:L,similarState:B,similarLinkComponent:N,reportSpamPending:I,notSpamPending:A,className:"border-l-0 h-full w-full"}),s.jsx(kf,{isOpen:m,current:l.category.value,hasOverride:u?.flags?.category?.value!=null,onSelect:R,onClear:O,onCancel:()=>d(!1)})]})}const wf=({onClose:e,thread:t,mailboxId:n,accountId:a,hideCloseButton:r,onAfterOptimisticRemove:o,onReplyWithText:i})=>t?s.jsx(jf,{thread:t,onClose:e,mailboxId:n,accountId:a,hideCloseButton:r,onAfterOptimisticRemove:o,onReplyWithText:i}):s.jsxs("aside",{className:"flex h-full w-full flex-col bg-surface-sunken",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-1.5 border-b border-line px-row-inset",children:[s.jsx(Ze,{className:"size-3.5 text-fg-subtle"}),s.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Intelligence"})]}),s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center px-row-inset text-center",children:[s.jsx(Ze,{className:"size-8 text-fg-subtle"}),s.jsx("p",{className:"mt-3 text-sm text-fg-muted",children:"Intelligence"}),s.jsx("p",{className:"mt-1 text-2xs text-fg-subtle",children:"Sender trust, authenticity and similar messages will appear here."})]})]});function nh({isOpen:e,onClose:t,thread:n,mailboxId:a,accountId:r,onAfterOptimisticRemove:o,onReplyWithText:i}){return s.jsx(Gu,{isOpen:e,onClose:t,ariaLabel:"Message details",side:"right",answers:{toggleIntelligence:t},children:s.jsx(wf,{onClose:t,thread:n,mailboxId:a,accountId:r,hideCloseButton:!0,onAfterOptimisticRemove:o,onReplyWithText:i})})}const Cf=e=>{const{trashByAccount:t,hasAppointments:n,isError:a}=hu();return c.useMemo(()=>{const r=_o({targets:e,trashByAccount:t,hasAppointments:n,isError:a}),o=i=>i.accountId?t.get(i.accountId):void 0;return{outcome:r,staleFolderLabel:e.map(o).find(i=>i?.source==="Stale")?.staleFolderPath,guessedMailboxId:r==="unconfirmed"?e.find(i=>o(i)?.mailboxId===i.mailboxId)?.mailboxId:void 0}},[e,t,n,a])},Nf=100,Sf=({mailboxId:e,mailboxLabel:t,accountId:n,enabled:a,predicateKey:r,searchQuery:o,reportEnding:i})=>{const[l,u]=c.useState({kind:"idle"}),x=c.useRef(void 0),{run:g,start:y,stop:f}=Uo(),{pushError:v}=ve(),p=g?.mailboxId===e?g:void 0,m=p!==void 0,d=c.useRef(!1);d.current=m,c.useEffect(()=>{x.current?.abort(),u({kind:"idle"})},[a,r]);const b=c.useRef(o);b.current=o;const k=c.useCallback(T=>async(D,$)=>{const{data:K}=await cn({path:{mailboxId:e},query:{...T,continuationToken:D,limit:Nf},signal:$,throwOnError:!0});return{ids:(K.items??[]).map(_=>_.messageId),continuationToken:K.continuationToken}},[e]),h=c.useCallback(async T=>{const{data:D}=await cn({path:{mailboxId:e},query:{...b.current,count:!0,results:!1},signal:T,throwOnError:!0});if(D.count===void 0)throw new Error("the search returned no count for the selection");return D.count},[e]),j=c.useCallback(T=>async(D,$)=>{if(T.kind==="move"){const{data:_}=await Bo({body:{messageIds:D,destinationMailboxId:T.destinationMailboxId},signal:$,throwOnError:!0});return _}if(T.kind==="markRead"){const{data:_}=await Ko({body:{messageIds:D,isRead:!0},signal:$,throwOnError:!0});return _}const{data:K}=await Ho({body:{messageIds:D},signal:$,throwOnError:!0});return K},[]),S=c.useCallback(()=>{const T=new AbortController;x.current=T,u({kind:"counting"}),h(T.signal).then(D=>{if(T.signal.aborted){u({kind:"idle"});return}u({kind:"escalated",total:D})},D=>{if(T.signal.aborted){u({kind:"idle"});return}v(qo("Couldn't count matching messages","The count didn't finish.",D)),u({kind:"idle"})})},[h,v]),I=c.useCallback(()=>{x.current?.abort(),d.current&&f(e)},[f,e]),A=c.useCallback(()=>{d.current||(x.current?.abort(),u({kind:"idle"}))},[]),M=c.useCallback(async(T,D,$)=>{const K=D?.length??(l.kind==="escalated"?l.total:0),_=D!==void 0?{kind:"targets",targets:D}:{kind:"predicate",fetchPage:k(b.current)},w=await y({action:T,mailboxId:e,mailboxLabel:t,accountId:n,matched:K,source:_,applyBatch:j(T),reportEnding:i,claimEnding:$});return w.kind==="ran"&&u({kind:"idle"}),w},[j,k,l,e,t,n,i,y]);return{phase:l,escalate:S,stop:I,clear:A,isRunning:m,runningAction:p?.action,progress:p?.progress,runAction:M}},If=120,Tf=({keyboardFocusedMessageId:e,openMessageId:t,enabled:n,open:a,delayMs:r=If})=>{const o=c.useRef(a);o.current=a;const i=c.useRef(void 0);c.useEffect(()=>{const l=e;if(!n){i.current=l;return}if(l===void 0||l===t)return;if(l===i.current){i.current=void 0;return}const u=setTimeout(()=>o.current(l),r);return()=>clearTimeout(u)},[n,e,t,r])},Rr="This account has no Junk folder appointed, so there is nowhere to file these. Appoint one under Settings › Folder roles.",Rf="These are already in Junk, so there is nowhere to file them.",Ef=(e,t)=>e!==void 0&&e!==t?e:void 0,ah=(e,t)=>{if(Ef(e,t)===void 0)return e===void 0?Rr:Rf};function Mf(e,t){if(e.length!==0)return t!==void 0&&e.includes(t)?t:e[0]}const Af={title:"",navSlot:null,titleMeta:null,searchSlot:null,searchField:null,searchResults:null,makeFilterSlot:null},Es=c.createContext(Af),$f=()=>c.useContext(Es),Lf=({isOpen:e,messageIds:t,outcome:n,accountId:a,trashFolderLabel:r,staleFolderLabel:o,guessedMailboxId:i,isDeleting:l=!1,onConfirm:u,onCancel:x})=>{const{Account:g}=ya(),{requestAppointment:y}=ma(),f=t.length,v=()=>u([...t]),p=Qo(f,n,{trashFolderLabel:r,staleFolderLabel:o});if(n==="noTrash"||n==="staleTrash"||n==="unconfirmed"){const m=n==="noTrash"?"none":n==="staleTrash"?"stale":"unconfirmed";return s.jsx(Pt,{isOpen:e,...p,onConfirm:()=>{if(!a)return v();const d=[...t];x(),y({accountId:a,role:"Trash",reason:m,action:{kind:"delete",count:f},staleFolderLabel:o,trashFolderLabel:r,guessedMailboxId:i,onAppointed:async()=>u(d)})},onCancel:x})}return n==="unavailable"?s.jsx(g,{fallback:s.jsx(Pt,{isOpen:e,...p,confirmLabel:"Reload reader",onConfirm:()=>window.location.reload(),onCancel:x}),children:({signOut:m})=>s.jsx(Pt,{isOpen:e,...p,onConfirm:()=>m(),onCancel:x})}):s.jsx(Pt,{isOpen:e,...p,destructive:!0,isBusy:l||n==="unknown",onConfirm:v,onCancel:x})},Er=8,Mr=e=>e==="From"||e==="FromDomain",Pf=e=>({value:e.email,label:e.displayName??e.email,...e.displayName?{hint:e.email}:{},...e.fromSelection?{source:"selected"}:{}}),Df=e=>{const t=mr(e.email);if(t!==null)return{value:t,...e.fromSelection?{source:"selected"}:{}}},Ff=(e,t)=>e.value.toLowerCase().includes(t)||(e.label??"").toLowerCase().includes(t),Of=(e,t,n)=>{if(!Mr(e))return[];const a=t.trim().toLowerCase(),r=new Set,o=[];for(const i of n){if(i.email.trim()==="")continue;const l=e==="From"?Pf(i):Df(i);if(!l)continue;const u=l.value.toLowerCase();if(!(u===""||r.has(u))&&(r.add(u),u!==a&&!(a!==""&&!Ff(l,a))&&(o.push(l),o.length===Er)))break}return o},zf=250,_f=2,Uf=(e,t,n)=>{const a=t.trim(),r=za(a,zf),o=e!==void 0&&Mr(e),{data:i}=ne({...zs({query:{q:r,limit:Er}}),enabled:o&&r.length>=_f});if(!o||e===void 0)return[];const l=[...n.map(u=>({email:u,fromSelection:!0})),...(i?.items??[]).map(u=>({email:u.normalizedEmail,...u.displayName?{displayName:u.displayName}:{}}))];return Of(e,a,l)},Ar=12,Bf=e=>{const{envelope:t}=e,n=t.from[0];return{id:t.messageId,sender:n?pr({normalizedEmail:n.normalizedEmail,displayName:n.displayName}):"Unknown",subject:t.subject??"(No subject)",date:st(t.date)}},Kf=(e,t)=>{const n=e!==void 0&&t!==void 0,{data:a,isLoading:r}=ne({...Wo({path:{mailboxId:e??""},query:{...t,limit:Ar}}),enabled:n,staleTime:3e4});return{messages:(a?.items??[]).map(Hf),isPending:n&&r}},Hf=e=>({id:e.messageId,sender:e.fromName||e.fromEmail||"Unknown",subject:e.subject??"(No subject)",date:st(e.sentDate)}),qf=e=>Us({queries:e.slice(0,Ar).map(t=>({...Yt({path:{messageId:t}}),staleTime:Number.POSITIVE_INFINITY})),combine:t=>({messages:t.map(n=>n.data).filter(n=>n!==void 0).map(Bf),isPending:t.some(n=>n.isPending)})}),Qf=(e,t)=>({matchOperator:"Or",literalClauses:Vs(e,t)}),Wf=(e,t,n,a)=>{const r=ge(Go()),{mutate:o,reset:i}=r,[l,u]=c.useState(!1),x=c.useMemo(()=>ss(n),[n]),g=c.useMemo(()=>Vs(x,a),[x,a]),y=c.useCallback(()=>{!e||!t||(u(!1),o({path:{accountId:e},body:hn({anchorMessageId:t,matchOperator:"And",literalClauses:[]})}))},[e,t,o]),f=c.useCallback(()=>{u(!1),i()},[i]),v=r.data,p=v?.semanticUnavailable===!0&&!l&&g.length>0;c.useEffect(()=>{!p||!e||(u(!0),o({path:{accountId:e},body:hn(Qf(x,a))}))},[p,e,x,a,o]);const m=l||(v?.semanticUnavailable??!1),d=r.isPending||p,b=l?{matchOperator:"Or",literalClauses:g}:{...t?{anchorMessageId:t}:{},matchOperator:"And",literalClauses:[]};return{preview:y,reset:f,matchedCount:d?void 0:v?.matchedCount,messageIds:d?void 0:v?.messageIds,semanticUnavailable:m,senderFallback:l,senders:x,matchPredicate:b,isPending:d,isError:r.isError,error:r.error}},Gf=()=>[Vo({path:{mailboxId:""}}),Yo({path:{mailboxId:""}}),Jo()].map(e=>[{_id:e[0]._id}]),Vf=e=>Xo(e)?e.pages:Zo(e)?[e]:[],Yf=e=>typeof e=="object"&&e!==null&&typeof e.messageId=="string",Jf=(e,t)=>{const n=new Set(t),a=new Map;for(const r of e)for(const o of Vf(r))for(const i of o.items){if(!Yf(i)||!n.has(i.messageId))continue;const l=i.subject?.trim();l&&a.set(i.messageId,l)}return t.map(r=>a.get(r)).filter(r=>r!==void 0)},Xf=e=>{const t=he(),n=e.join("\0");return c.useMemo(()=>{const a=Gf().flatMap(r=>t.getQueriesData({queryKey:r}).map(([,o])=>o));return Jf(a,e)},[t,n])},Zf=new Set(["hasAttachment","isUnread","isRead","isStarred","category","before","after"]),em=e=>Zf.has(e),tm=(e,{searchHadSemanticReach:t})=>{const n=[],a=[];let r,o;for(const u of e.tokens){if(u.type==="from"){n.push({field:"From",value:u.value});continue}if(u.type==="subject"){n.push({field:"Subject",value:u.value});continue}if(u.type==="in"){r={mailboxId:u.mailboxId,label:u.value};continue}if(u.type==="account"){o=u.accountId;continue}em(u.type)&&a.push({type:u.type,label:Ma(u)})}const i=e.freeText.trim(),l=i.length>0;return l&&n.push({field:"HasWords",value:i}),{clauses:n,matchOperator:"all",scopedOut:r,droppedFacets:a,targetAccountId:o,keptTerms:l,droppedSemantic:l&&t}},sm=(e,t,n)=>e.targetAccountId??t??n[0]?.accountId,Ms=c.createContext(void 0),nm=()=>c.useContext(Ms),Gn={matched:0,applied:0,failed:0,failedIds:[]},am=({matched:e,outcome:t,failureReason:n,progressDone:a})=>{if(n!==void 0)return{...Gn,state:"commitFailed",failureReason:n};if(!t)return{state:"backApplyRunning",matched:Math.max(e,a),applied:a,failed:0,failedIds:[]};if(!t.cancelled&&t.error===void 0)return{state:"backApplyComplete",matched:Math.max(e,t.done),applied:t.done,failed:0,failedIds:[]};if(!t.cancelled&&t.done===0)return{...Gn,state:"commitFailed"};const r=t.failedIds.length>0?t.failedIds.length:Math.max(e-t.done,1);return{state:"runStopped",matched:Math.max(e,t.done),applied:t.done,failed:r,failedIds:t.failedIds}},rm=({failure:e,isStarting:t,isRunning:n,isDone:a,failedCount:r,ruleSaved:o})=>e?.kind==="restartFailed"?"backApplyRestartFailed":e?.kind==="startFailed"?o?"backApplyStartFailed":"commitFailed":a?r>0?"backApplyFailed":"backApplyComplete":e?.kind==="statusUnreadable"?"statusUnknown":t||n?"backApplyRunning":"saving",om=e=>{if(e.runState==="statusUnknown")return{kind:"refreshStatus"};if(e.isEscalated)return{kind:"rerunEscalated"};if(e.committedScope==="standing"||e.committedScope==="temporary")return e.createFilterFailed?{kind:"resetAndResend"}:e.backApplyPending?{kind:"startBackApply"}:{kind:"waitOnJob"};if(e.committedScope==="all-like-these"&&e.widenRunsAsJob)return{kind:"resend"};const t=new Set(e.failedIds);return{kind:"rerunBulk",targets:t.size>0?e.sent.filter(n=>t.has(n.id)):e.sent}},im=e=>e!==void 0&&e.outcome===void 0&&e.failureReason===void 0,lm=(e,t)=>{if(e){e.stop();return}t()},cm=(e,t)=>e==="run"?t.dismiss:t.cancel,dm={clauses:[],matchOperator:"any"},um={clauses:[],matchOperator:"all",droppedFacets:[],keptTerms:!1,droppedSemantic:!1},fm=[],mm=(e,t,n)=>({verb:"organize",accountId:sm(e,t.accountId,n),selection:fm,selectionRestriction:void 0,escalated:void 0,searchConversion:e}),ft={state:"saving",matched:0,applied:0,failed:0,failures:[]},Vn=(e,t)=>e.map((n,a)=>({...n,id:`${t}-${a}`})),Yn=(e,t,n)=>{if(e==="delete")return{kind:"delete"};if(e==="markRead")return{kind:"markRead"};const a=e==="junk"?n:t;return a?{kind:"move",destinationMailboxId:a}:void 0},ks=e=>e==="move"||e==="junk"||e==="organize",Jn=e=>e==="junk"?Rr:"No destination was chosen, so there is nowhere to file these. Go back and pick a folder.";function pm({verb:e,accountId:t,mailboxId:n,mailboxLabel:a,selection:r,selectionRestriction:o,escalated:i,escalatedProgress:l,searchConversion:u,onFinished:x,onRunEnded:g,step:y,goToStep:f,goBack:v,closeWizard:p}){const[m]=c.useState(()=>u),[d]=c.useState(()=>i),b=m!==void 0,[k,h]=c.useState(b?"properties":"selected"),j=d?"escalated":k,[S,I]=c.useState(()=>m?{clauses:Vn(m.clauses,"search"),matchOperator:m.matchOperator}:dm),[A,M]=c.useState(void 0),[T,D]=c.useState(void 0),[$,K]=c.useState(!1),[_,w]=c.useState(void 0),[R,O]=c.useState(void 0),[C,L]=c.useState(),N=c.useRef(!1),B=c.useMemo(()=>r.map(E=>E.id),[r]),z=c.useMemo(()=>r.map(E=>({id:E.id,accountId:E.accountId})),[r]),W=c.useMemo(()=>r.map(E=>E.email).filter(Boolean),[r]),X=B[0],Y=Xf(B),{junkMailboxId:oe}=xr(t),Z=Wf(d?void 0:t,X,W,Y),{preview:ie}=Z;c.useEffect(()=>{ie()},[ie]);const se=j==="similar"||j==="properties",F=c.useMemo(()=>({matchOperator:S.matchOperator==="all"?"And":"Or",literalClauses:S.clauses.map(E=>({field:E.field,value:E.value}))}),[S.clauses,S.matchOperator]),ee=j==="similar"?Z.matchPredicate:F,{count:le,matchedIds:me}=jl(se?t:void 0,ee),q=qf(se?me:[]),ce=Kf(d?n:void 0,d?.searchQuery),Q=d?{status:"ready",count:d.total}:se?le:{status:"ready",count:r.length},{data:G}=ne({...yt({path:{accountId:t??""}}),enabled:!!t,staleTime:Number.POSITIVE_INFINITY}),re=br(t),ye=pa(),Le=c.useMemo(()=>ga({mailboxes:G?.items??[],folderAppointments:re,currentMailboxId:n,translator:ye}),[G?.items,re,n,ye]),{createFolderIn:at}=ha(t),os=Le.find(E=>E.id===S.moveMailboxId)?.label,He=zd(r.map(E=>({normalizedEmail:E.email,displayName:E.sender}))),rt=Qd({match:j==="properties"&&S.clauses[0]?.value.trim()||void 0,sender:He?pr(He):void 0,folder:os}),V=c.useMemo(()=>({...S,name:S.name??rt}),[S,rt]),Et=Uf(A?.draft.field,A?.draft.value??"",W),Pe=c.useRef(void 0),Ce=c.useCallback(E=>{Pe.current?.(),Pe.current=E},[]);c.useEffect(()=>()=>{Pe.current?.(),Pe.current=void 0},[]);const pe=wl(t),ke=Cl(t),qe=Sf({mailboxId:n??"",mailboxLabel:a,accountId:t,enabled:!1,predicateKey:"selection-wizard",searchQuery:{},reportEnding:g}),{runAction:Qe}=qe,de=si({verb:e,mode:j,scope:S.scope,fromSearch:b}),te=de[dn(de,y)],De=ni(t,o),Fe=ai(j,De),Ne=(E=>{if(E==="folder")return De.destination;if(E==="rule")return V.scope==="standing"||V.scope==="until"?Fe:void 0})(te)??ri(te,V,Q),Oe=c.useCallback(()=>Vn(Vs(W,Y),"seed"),[W,Y]),Mt=c.useCallback(E=>{h(E),I(U=>({...U,widen:E==="similar"&&X?{anchorCount:Math.max(r.length,1)}:void 0,...E==="properties"&&U.clauses.length===0?{clauses:Oe()}:{}}))},[X,r.length,Oe]),We=c.useCallback(()=>{K(!0),h("properties"),I(E=>({...E,widen:void 0,clauses:Oe(),matchOperator:"any"})),f("properties")},[Oe,f]),ze=Sr()===!1,Ge=ze||Z.semanticUnavailable||Z.isError;c.useEffect(()=>{te==="match"&&(j!=="similar"||!Ge||$||We())},[te,j,Ge,$,We]);const At=c.useCallback(()=>{M({mode:"add",draft:{field:"From",value:""}})},[]),ot=c.useCallback(E=>{const U=S.clauses.find(J=>J.id===E);U&&M({mode:"edit",clauseId:E,draft:{field:U.field,value:U.value}})},[S.clauses]),it=c.useCallback(E=>{I(U=>({...U,clauses:U.clauses.filter(J=>J.id!==E)}))},[]),lt=c.useCallback(E=>{M(U=>U&&{...U,draft:E})},[]),ue=c.useCallback(()=>{M(E=>{if(!E)return;const U=Nl(E.draft.field,E.draft.value),J={...E.draft,value:U};I(ct=>({...ct,clauses:E.clauseId?ct.clauses.map(fs=>fs.id===E.clauseId?{...fs,...J}:fs):[...ct.clauses,{id:crypto.randomUUID(),...J}]}))})},[]),je=c.useCallback(()=>{if(Ne){D(te);return}D(void 0);const E=de[dn(de,te)+1];E&&f(E)},[Ne,te,de,f]),ls=c.useCallback(async E=>{const U=Yn(e,V.moveMailboxId,oe);if(!U){O({matched:E.length,sent:E,failureReason:Jn(e)});return}O({matched:E.length,sent:E});const J=await Qe(U,E,Ce);O({matched:E.length,sent:E,outcome:J.kind==="ran"?J.outcome:void 0,failureReason:J.kind==="refused"?J.reason:void 0})},[e,V.moveMailboxId,oe,Qe,Ce]),cs=c.useCallback(async()=>{if(!d)return;const E=Yn(e,V.moveMailboxId,oe);if(!E){O({matched:d.total,sent:[],failureReason:Jn(e)});return}O({matched:d.total,sent:[]});const U=await d.run(E,Ce);O({matched:d.total,sent:[],outcome:U.kind==="ran"?U.outcome:void 0,failureReason:U.kind==="refused"?U.reason:void 0})},[d,e,V.moveMailboxId,oe,Ce]),{start:$t}=pe,{createFilterAsync:en}=ke,Lt=c.useCallback(()=>{if(d){cs();return}const E=Sl({mode:k,ruleScope:V.scope}),U=Il({mode:k,ruleScope:V.scope,anchorMessageId:X,clauses:V.clauses,matchOperator:V.matchOperator,moveMailboxId:V.moveMailboxId,until:V.until});if(w(E),E==="standing"||E==="temporary"){const J=Tl(U)?U:void 0;L(J),en(U,E,(V.name??"").trim()).then(ct=>{ct&&J&&$t(J)});return}if(E==="all-like-these"&&ks(e)){$t(U);return}ls(E==="just-these"?z:me.map(J=>({id:J,accountId:t})))},[d,cs,k,V,X,e,t,z,me,en,$t,ls]),Or=c.useCallback(()=>{if(Ne){D(te);return}N.current||(N.current=!0,f("run"),Lt())},[Ne,te,f,Lt]),tn=c.useCallback(E=>{const U=pe.progress,J=rm({failure:pe.failure,isStarting:pe.isStarting,isRunning:pe.isRunning,isDone:pe.isDone,failedCount:U.failedCount,ruleSaved:E});return J==="saving"||J==="commitFailed"||J==="backApplyStartFailed"?{...ft,state:J}:{state:J,matched:U.matchedCount,applied:U.appliedCount,failed:J==="backApplyFailed"||J==="backApplyRestartFailed"?U.failedCount:0,failures:[]}},[pe]),sn=c.useMemo(()=>{const E=new Map;for(const U of[...r,...q.messages,...ce.messages])E.set(U.id,U);return E},[r,q.messages,ce.messages]),nn=d?l:qe.progress,an=c.useCallback(()=>{if(!R)return ft;const E=am({matched:R.matched,outcome:R.outcome,failureReason:R.failureReason,progressDone:nn?.done??0});return{state:E.state,matched:E.matched,applied:E.applied,failed:E.failed,failures:E.failedIds.map(U=>sn.get(U)).filter(U=>U!==void 0),failureReason:E.failureReason}},[R,nn,sn]),_e=d?an():_==="standing"||_==="temporary"?ke.isError?{...ft,state:"commitFailed"}:ke.isSuccess?C?tn(!0):{...ft,state:"filterSaved"}:ft:_==="all-like-these"&&ks(e)?tn(!1):an(),zr=()=>{const E=om({runState:_e.state,isEscalated:d!==void 0,committedScope:_,createFilterFailed:ke.isError,backApplyPending:C!==void 0,widenRunsAsJob:ks(e),failedIds:R?.outcome?.failedIds??[],sent:R?.sent??z});switch(E.kind){case"refreshStatus":pe.refreshStatus();return;case"rerunEscalated":cs();return;case"resetAndResend":ke.reset(),Lt();return;case"resend":Lt();return;case"startBackApply":C&&$t(C);return;case"waitOnJob":return;case"rerunBulk":ls(E.targets);return}},_r=c.useCallback(()=>{p(de,te)},[p,de,te]),ds=c.useCallback(()=>{p(de,te),x()},[p,de,te,x]),{stop:rn}=qe,Ur=c.useCallback(()=>{lm(d,rn)},[d,rn]);Jd({shouldBlockFn:({action:E})=>E!=="BACK"?!1:(ds(),!0),enableBeforeUnload:!1,disabled:te!=="run"});const us={messages:d?ce.messages:se?q.messages:r,count:Q,label:j==="selected"?"Your selection":"A sample of what matches",emptyReason:j==="similar"&&Ge?"notIndexed":"noMatch",loading:d?ce.isPending:se&&(Q.status==="loading"||q.isPending)};return s.jsx(oi,{verb:e,steps:de,step:te,blockedReason:Ne,nudged:T===te,onBack:v,onExit:cm(te,{dismiss:ds,cancel:_r}),onContinue:je,onCommit:Or,match:{selectedCount:r.length,mode:j,accountId:De.accountId,onModeChange:Mt,semanticUnavailable:Ge,semanticOff:ze,semanticErrorDetail:Z.error instanceof Error?Z.error.message:void 0,semanticFallbackTaken:$,onSemanticFallback:We,escalatedScope:d?.scope,sample:us},properties:{clauses:V.clauses,matchOperator:V.matchOperator,onMatchOperatorChange:E=>I(U=>({...U,matchOperator:E})),clauseEdit:A,onStartAddClause:At,onStartEditClause:ot,onRemoveClause:it,onChangeDraft:lt,onSubmitClause:ue,onCancelClause:()=>M(void 0),clauseFields:Rl,clauseSuggestions:Et,conversionNotice:m?Gd(m):void 0,semanticFallbackTaken:$,sample:{...us,label:"What this matches"}},folder:{folders:Le,mailboxId:V.moveMailboxId,delimiter:xa(G?.items??[]),onSelect:E=>I(U=>({...U,moveMailboxId:E})),onCreateFolder:t?at:void 0,restriction:De.destination},rule:{draft:V,onScopeChange:E=>I(U=>({...U,scope:E})),onUntilChange:E=>I(U=>({...U,until:E})),restriction:Fe},name:{name:V.name??"",onNameChange:E=>I(U=>({...U,name:E})),nudged:T===te},review:{verb:e,mode:j,selectedCount:r.length,clauses:V.clauses,matchOperator:V.matchOperator,folder:os,scope:V.scope,until:V.until,ruleName:de.includes("name")?V.name:void 0,escalatedScope:d?.scope,sample:us},run:{state:_e.state,verb:e,scope:V.scope,matched:_e.matched,applied:_e.applied,failedCount:_e.failed,failures:_e.failures,failureReason:_e.failureReason,onRetry:zr,onDismiss:ds,onCancelRun:im(R)?Ur:void 0}})}function rh(e){const t=ei()==="search",n=nm(),{accounts:a}=St(),{step:r,goToStep:o,goBack:i,closeWizard:l}=ti(t?"properties":"match");if(Xt({id:"selection-wizard",open:r!==void 0}),!r)return null;const u=t?n??um:void 0;return s.jsx(pm,{...e,...u?mm(u,e,a):{},step:r,goToStep:o,goBack:i,closeWizard:l})}const hm=[],Xs=c.createContext(null),gm=e=>{const t=c.useContext(Xs);return t?t.rowInteraction(e):null},xm=()=>{const e=c.useContext(Xs);if(!e)throw new Error("useThreadListSelection must be used inside <ThreadListInteraction>");return e},bm="[data-message-id]",vm=e=>Array.from(e.querySelectorAll(bm)).map(t=>t.dataset.messageId).filter(t=>t!==void 0),ym=(e,t)=>e.length===t.length&&e.every((n,a)=>n===t[a]),km=e=>{const[t,n]=c.useState([]);return c.useEffect(()=>{const a=e.current;if(!a)return;const r=()=>{const i=vm(a);n(l=>ym(l,i)?l:i)};r();const o=new MutationObserver(r);return o.observe(a,{childList:!0,subtree:!0}),()=>o.disconnect()},[e]),t};function oh({selectedMessageId:e,rows:t,onOpen:n,onDeleteMessages:a,onSelectionVerb:r,isDeleting:o=!1,commandsRef:i,onTriageContextChange:l,children:u}){const x=Os(),{pushError:g}=ve(),y=c.useRef(null),f=km(y),v=Vd({orderedIds:f,isDesktop:x,initialFocusedId:e}),{focusedMessageId:p,setFocusedMessageId:m,pendingDomFocusRef:d,cursorMovedByPointerRef:b,selection:k,isMultiSelectMode:h,exitSelection:j,handleRowSelect:S}=v,{selectedIds:I,selectedCount:A,isSelected:M,toggle:T,select:D,toggleAll:$}=k,K=f.length>0&&f.every(q=>I.has(q)),_=c.useCallback(()=>{f.length>0&&$(f)},[f,$]),{intersectWith:w}=k;c.useEffect(()=>{w(f)},[w,f]),c.useEffect(()=>{const q=d.current;q!==null&&(d.current=null,y.current?.querySelector(`[data-message-id="${q}"]`)?.focus())});const R=c.useCallback(q=>{b.current=!0,m(q)},[b,m]),O=c.useCallback(q=>{x||D(q)},[x,D]),C=c.useCallback(()=>{p&&n(p)},[p,n]),L=c.useCallback(q=>n(q,{replace:!0}),[n]);Tf({keyboardFocusedMessageId:v.keyboardFocusedMessageId,openMessageId:e,enabled:x&&A===0,open:L});const[N,B]=c.useState(null),{outcome:z,staleFolderLabel:W,guessedMailboxId:X}=Cf(N?.targets??hm),Y=c.useCallback(q=>{if(N!==null)return!0;if(A>0)return r(q),!0;if(q!=="delete"||!p)return!1;const ce=t.find(Q=>Q.id===p);return!ce?.mailboxId||!ce.accountId?(g({title:"Couldn't delete this message",detail:"This list has lost track of which account and folder it is in, so reader can't tell whether deleting it would move it to Trash or erase it. Nothing was deleted.",action:{label:"Reload the list",href:window.location.href}}),!0):(B({ids:[p],targets:[{accountId:ce.accountId,mailboxId:ce.mailboxId}]}),!0)},[N,A,r,p,t,g]),oe=c.useCallback(q=>{q.length!==0&&(a(q),B(null),j())},[a,j]),Z=c.useCallback(()=>B(null),[]),ie=c.useCallback(()=>A===0?!1:(j(),!0),[A,j]),se=f.length>0;c.useEffect(()=>{if(i){if(!se){i.current=null;return}return i.current={focusNext:v.focusNext,focusPrevious:v.focusPrevious,focusFirst:v.focusFirst,focusLast:v.focusLast,openFocused:C,toggleSelect:v.toggleFocusedSelection,extendSelectDown:v.extendRangeDown,extendSelectUp:v.extendRangeUp,selectAll:v.selectAllLoaded,clearSelection:ie,requestVerb:Y,toggleDensity:()=>{}},()=>{i.current=null}}},[i,se,v.focusNext,v.focusPrevious,v.focusFirst,v.focusLast,v.toggleFocusedSelection,v.extendRangeDown,v.extendRangeUp,v.selectAllLoaded,C,ie,Y]);const F=c.useMemo(()=>Array.from(I),[I]),ee=N!==null;c.useEffect(()=>{l?.({focusedMessageId:p,selectedIds:F,orderedIds:f,hasList:se})},[l,p,F,f,se]);const le=Mf(f,p),me=c.useMemo(()=>({selectedIds:I,selectedCount:A,exitSelection:j,startSelectionVerb:r,orderedIds:f,allSelected:K,toggleAllLoaded:_,rowInteraction:q=>({focused:q===p,isTabStop:q===le,isDesktop:x,onFocusRow:R,selection:{isChecked:M(q),onToggleCheck:T,onRowSelect:S,isMultiSelectMode:h,onLongPress:O}})}),[I,A,j,r,f,K,_,p,le,x,R,M,T,S,h,O]);return s.jsxs(Xs.Provider,{value:me,children:[s.jsx("div",{ref:y,className:"contents",children:u}),s.jsx(Lf,{isOpen:ee,messageIds:N?.ids??[],outcome:z,accountId:N?.targets[0]?.accountId,staleFolderLabel:W,guessedMailboxId:X,isDeleting:o,onConfirm:oe,onCancel:Z})]})}function ih({title:e,isDeleting:t}){const n=$f(),{selectedCount:a,exitSelection:r,startSelectionVerb:o,orderedIds:i,allSelected:l,toggleAllLoaded:u}=xm();return s.jsx(yd,{title:n.title||e,navSlot:n.navSlot,titleMeta:n.titleMeta,searchSlot:n.searchSlot,searchField:n.searchField,idleSlot:n.makeFilterSlot,count:a,onCancel:r,onDelete:()=>o("delete"),onMarkRead:()=>o("markRead"),isBusy:t,selectAll:i.length>0?{checked:l,indeterminate:a>0&&!l,onChange:u}:void 0})}const js=e=>{e.preventDefault(),e.stopPropagation()},jm=(e,t)=>{const n=c.useRef(!1),a=c.useCallback(i=>{if(n.current=!1,i.button!==0)return;const l=Is(i);Nn(l)&&t?.(e,l)&&(js(i),n.current=!0,i.currentTarget.focus(),l.shiftKey&&window.getSelection()?.removeAllRanges())},[t,e]),r=c.useCallback(i=>{!i.ctrlKey||!t||i.preventDefault()},[t]),o=c.useCallback(i=>{if(n.current)return n.current=!1,js(i),!0;const l=Is(i);return!Nn(l)||!t?.(e,l)?!1:(js(i),l.shiftKey&&window.getSelection()?.removeAllRanges(),!0)},[t,e]);return{onMouseDown:a,onContextMenu:r,claimClick:o}},wm=({thread:e,active:t=!1,focused:n,isTabStop:a,density:r="comfortable",isDesktop:o,badge:i,selection:l,inListbox:u=!1,link:x,onClick:g,onFocusRow:y})=>{const f=he(),v=e.id,p=gm(v),m=n??p?.focused??!1,d=a??p?.isTabStop??!1,b=l??p?.selection,k=y??p?.onFocusRow,h=o??p?.isDesktop??!0,j=b?.isChecked??!1,S=b?.isMultiSelectMode??!1,I=b?.onToggleCheck,A=b?.onRowSelect,M=b?.onLongPress,T=c.useCallback(N=>{N.preventDefault(),N.stopPropagation(),I?.(v)},[I,v]),D=jm(v,A),$=c.useCallback(N=>{if(!D.claimClick(N)){if(!h){if(S){N.preventDefault(),N.stopPropagation(),I?.(v);return}g?.();return}A?.(v,Is(N)),g?.()}},[D,h,S,I,A,g,v]),K=c.useCallback(()=>{M?.(v)},[M,v]),{longPressProps:_}=ld({onLongPress:K,accessibilityDescription:j?"Deselect message":"Select message"}),w=c.useCallback(()=>{f.prefetchQuery(Yt({path:{messageId:v}}))},[f,v]),R=c.useCallback(()=>{w(),k?.(v)},[w,k,v]),O=It({"data-list-row":"","data-message-row":!0,"data-message-id":v,...u?{role:"option","aria-selected":j}:{},tabIndex:d?0:-1,onClick:$,onMouseDown:D.onMouseDown,onContextMenu:D.onContextMenu,onMouseEnter:w,onFocus:R},h||!b?{}:_),C=P(r==="compact"?sr({active:t,focused:m}):P("group",Ws({active:t,focused:m})),"outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-inset",j&&"bg-accent-soft",!h&&"min-h-11 select-none [-webkit-touch-callout:none]"),L=r==="compact"?s.jsx(nr,{thread:e}):s.jsx(Gs,{thread:e,badge:i,selection:b?{checked:j,alwaysVisible:S,onToggle:T}:void 0});return x===void 0?s.jsx("button",{type:"button",...O,className:C,children:L}):s.jsx(Na,{to:"/mail/$mailboxId/$threadId/$messageId",params:{...x,messageId:v},search:N=>N,variant:"row",...O,className:C,children:L})},lh=c.memo(wm),Cm="Open a message first",Nm="This conversation hasn't loaded yet",Sm="The mailbox list hasn't loaded yet",Im="Couldn't find this mailbox's account — reload to try again",Tm={reply:"Reply",replyAll:"Reply all",forward:"Forward",delete:"Move to Trash",move:"Move to mailbox",flag:"Star"},ch=({hasThread:e,messageId:t,intelligenceOpen:n,canToggleIntelligence:a,onToggleIntelligence:r,onReply:o,onReplyAll:i,onForward:l,onDelete:u,onToggleStar:x,isStarred:g,moveContext:y,moveContextLoading:f})=>{const[v,p]=c.useState(null),m=t??null,d=M=>e?M==="move"?y?null:f?Sm:Im:{reply:o,replyAll:i,forward:l,delete:u,flag:x}[M]?null:Nm:Cm,b=v&&v.messageId===m?v:null,k=b?d(b.action):null,h=b?.action==="move"&&b.overThread&&!!y,j=k??(b&&!h?`${Tm[b.action]} is ready — press it again`:null),S=M=>p({action:M,messageId:m,overThread:e}),I=M=>()=>S(M),A=(M,T)=>T?()=>{p(null),T()}:I(M);return s.jsx(Vc,{hasThread:e,isStarred:g,onUnavailable:S,unavailableHint:j,replyTitle:`Reply ${dt("reply")}`,replyAllTitle:`Reply all ${dt("replyAll")}`,forwardTitle:`Forward ${dt("forward")}`,deleteTitle:`Move to Trash ${dt("delete")}`,flagTitle:`Star ${dt("toggleStar")}`,onReply:A("reply",o),onReplyAll:A("replyAll",i),onForward:A("forward",l),onDelete:A("delete",u),onToggleStar:A("flag",x),onMove:I("move"),moveSlot:y?s.jsx(rs,{accountId:y.accountId,currentMailboxId:y.currentMailboxId,onMove:y.onMove,label:"Move to mailbox",defaultOpen:h}):void 0,children:s.jsx(Wc,{open:n,enabled:a,onToggle:r})})};function Rm(e){const[t,n]=c.useState(null);t!==null&&t!==e&&n(null);const a=e!==null&&t===e,r=c.useCallback(()=>n(null),[]),o=c.useCallback(()=>n(e),[e]),i=c.useCallback(()=>n(a?null:e),[a,e]);return{isOpen:a,open:o,close:r,toggle:i}}const dh=e=>{const{intelligenceOpen:t,onToggleIntelligence:n,onRaiseIntelligence:a}=St(),r=Sa()?.showIntelligencePane??!1,o=e??null,i=Rm(o),l=!r&&i.isOpen,{open:u,toggle:x}=i,g=c.useCallback(()=>{if(r){n();return}x()},[r,n,x]),y=c.useCallback(()=>{!r||t||a()},[r,t,a]),f=c.useCallback(()=>{if(!r){u();return}y()},[r,u,y]);return{canToggle:o!==null,isShowing:o!==null&&(r?t:l),toggle:g,open:f,drawerOpen:l,closeDrawer:i.close,railFits:r,openRail:y}},uh=(e,{toggle:t,open:n})=>{c.useEffect(()=>(e.current={toggle:t,open:n},()=>{e.current=null}),[e,t,n])},Em=()=>{const e=he();return c.useCallback(t=>{const n=Ae({path:{threadId:t.threadId}}),r=e.getQueriesData({queryKey:n}).flatMap(([,o])=>o?.items.map(i=>i.messageId)??[]);return r.length>0?r:[t.messageId]},[e])},Mm=[],$r=e=>{const{data:t}=ne({...ja({path:{threadId:e??""}}),enabled:!!e});return t?.items??Mm},fh=(e,t)=>{const n=$r(e),a=t?n.find(o=>o.messageId===t):void 0,r=n.length>0?n[n.length-1]:void 0;return a??r},mh=({thread:e,isOpen:t=!1,mailboxId:n,accountId:a,onAfterOptimisticRemove:r})=>{const o=n??e?.mailboxId,i=a??e?.accountId,{accountId:l}=ns(i?void 0:o),u=i??l,x=Em(),{deleteMessages:g}=as({mailboxId:o??"",threadId:e?.threadId,accountId:u,onAfterOptimisticRemove:r}),{moveMessages:y}=Rt({mailboxId:o??"",threadId:e?.threadId,accountId:u,onAfterOptimisticRemove:r}),f=$r(t?e?.threadId:void 0),p=f.find(h=>h.messageId===e?.messageId)?.hasStars??e?.hasStars,{toggleStar:m}=hr({threadId:e?.threadId??"",mailboxId:o??"",messages:f}),d=c.useCallback(()=>{e&&g(x(e))},[e,x,g]),b=c.useCallback(h=>{e&&y(x(e),h)},[e,x,y]),k=c.useCallback(()=>{e&&m(e.messageId,p??!1)},[e,p,m]);return{mailboxId:o,accountId:u,isStarred:p,deleteThread:d,moveThread:b,toggleStar:k}},Xn=(e,t,n)=>{if(!t)return null;const a=e.indexOf(t);if(a===-1)return null;const r=n==="next"?a+1:a-1;return r<0||r>=e.length?null:e[r]},ph=()=>{const[e,t]=c.useState(void 0),[n,a]=c.useState([]),[r,o]=c.useState([]),i=c.useRef(null),[l,u]=c.useState(!1),x=c.useCallback(g=>{t(g.focusedMessageId),a(g.selectedIds),g.orderedIds&&o(g.orderedIds),u(g.hasList)},[]);return{listCommandsRef:i,onTriageContextChange:x,focusedMessageId:e,selectedIds:n,orderedIds:r,hasList:l}},hh=({context:e,orderedIds:t,selectedMessageId:n,enabled:a=!0,onClose:r,handlers:o,hasOpenThread:i=!1})=>{const{listCommandsRef:l,hasList:u}=e,x=c.useCallback(()=>{l.current?.clearSelection()||n&&r()},[l,n,r]),{reply:g,replyAll:y,forward:f,...v}=o;return ki({enabled:a,handlers:{...u?{focusNext:()=>l.current?.focusNext(),focusPrevious:()=>l.current?.focusPrevious(),focusFirst:()=>l.current?.focusFirst(),focusLast:()=>l.current?.focusLast(),openFocused:()=>l.current?.openFocused(),toggleSelect:()=>l.current?.toggleSelect(),extendSelectDown:()=>l.current?.extendSelectDown(),extendSelectUp:()=>l.current?.extendSelectUp(),selectAll:()=>l.current?.selectAll(),toggleDensity:()=>l.current?.toggleDensity()}:{},back:x,...v,...i?{}:{reply:g,replyAll:y,forward:f}}}),{goBack:x,nextMessageId:Xn(t,n,"next")??void 0,previousMessageId:Xn(t,n,"previous")??void 0}},Am={unread:"unread",flagged:"starred",attachment:"attachments"},$m=new Set(Object.values(ii)),Lr=e=>$m.has(e),gh=e=>Lr(e.category)||e.attributes.size>0,xh=e=>{const t={};Lr(e.category)&&(t.category=[e.category]);for(const n of e.attributes){const a=Am[n];a&&(t[a]=!0)}return t},bh=e=>(e.senderTrust?.length??0)>0||e.dkimMismatch!==void 0?"loaded-pages":"whole-folder",Lm=["category","unread","starred","attachments","accountId","muted"],Zn=e=>JSON.stringify(Lm.map(t=>e?.[t]??null)),Pm=e=>{if(!Array.isArray(e))return;const[t]=e;if(typeof t!="object"||t===null)return;const n=t.query;if(!(typeof n!="object"||n===null))return n},vh=(e,t)=>{const n=Pm(e);return n?Zn(n)===Zn(t):!1},yh=e=>Ca(e)?Vt[e]:void 0,Dm={sender:"sender",recipient:"recipient",subject:"subject",attachment:"attachment",body:"body",entities:"entities"};function Fm(e){return Dm[e]??e}function kh(e,t){const{folder:n}=_s(t,[e.mailboxId]);return{id:e.messageId,sender:e.fromName??e.fromEmail??"Unknown",...e.fromEmail?{senderEmail:e.fromEmail}:{},subject:e.subject??"(No subject)",snippet:e.snippet??"",date:st(e.sentDate),unread:!e.isRead,flagged:e.hasStars===!0,threadId:e.threadId,mailboxId:e.mailboxId,...n?{folder:n}:{}}}function jh(e,t){const{folder:n}=_s(t,e.mailboxId?[e.mailboxId]:[]);return{id:e.id,sender:e.fromName,...e.fromEmail?{senderEmail:e.fromEmail}:{},subject:e.subject,snippet:e.snippet,date:e.timeLabel,unread:!e.isRead,flagged:e.starred===!0,...e.threadId?{threadId:e.threadId}:{},...e.mailboxId?{mailboxId:e.mailboxId}:{},...n?{folder:n}:{}}}function Om(e,t){const{mailboxId:n,folder:a}=_s(t,e.mailboxIds);return{id:e.messageId,sender:e.fromName??"Unknown",subject:e.subject??"(No subject)",snippet:"",date:e.sentDate!=null?st(e.sentDate*1e3):"",threadId:e.threadId,matchedChunkLabel:Fm(e.matchedChunkType),score:e.score,...n?{mailboxId:n}:{},...a?{folder:a}:{}}}function wh(e,t,n){const a=new Set(t),r=[];for(const o of[...e].sort((i,l)=>l.score-i.score))a.has(o.threadId)||(a.add(o.threadId),r.push(Om(o,n)));return r}function zm(e){const t=e.authenticity?.dkimMismatch===!0;return{id:e.messageId,accountId:e.accountId,mailboxId:e.mailboxId,threadId:e.threadId,fromName:e.fromName??e.fromEmail??"Unknown",fromEmail:e.fromEmail??"",subject:e.subject??"(No subject)",snippet:e.snippet??"",timeLabel:st(e.sentDate),sentDate:e.sentDate,isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0,trust:e.senderTrust,category:gr(e.category),suspicious:t,...Wu(e)}}const _m=li;function Ch(e){const t=new Map(e.map(a=>[a.category,a])),n=[];for(const a of _m){const r=t.get(a);!r||!(r.loading||r.failed||r.rows.length>0||r.total.kind==="exact"&&r.total.value>0)||n.push({id:a,label:Vt[a],threads:r.rows,total:r.total,atCap:r.atCap,loading:r.loading,error:r.failed})}return n}function Um(e,t){return t.every(n=>{switch(n.type){case"from":{const a=n.value.toLowerCase();return e.fromEmail.toLowerCase().includes(a)||e.fromName.toLowerCase().includes(a)}case"subject":return e.subject.toLowerCase().includes(n.value.toLowerCase());case"category":return(e.category??"uncategorized")===n.category;case"hasAttachment":return e.hasAttachment===!0;case"isUnread":return!e.isRead;case"isRead":return e.isRead===!0;case"isStarred":return e.starred===!0;case"after":return e.sentDate!=null&&e.sentDate>=n.epochSeconds*1e3;case"before":return e.sentDate!=null&&e.sentDate<n.epochSeconds*1e3;case"in":return e.mailboxId===n.mailboxId;case"account":return e.accountId===n.accountId;default:return!1}})}const Bm=["from","subject","category","unread","starred","attachments"],Ut=e=>e[0],Km=e=>{const t=Ut(e.filter(l=>l.type==="from").map(l=>l.value)),n=Ut(e.filter(l=>l.type==="subject").map(l=>l.value)),a=Ut(e.filter(l=>l.type==="category").map(l=>l.category)),r=Ut(e.filter(l=>l.type==="isUnread"||l.type==="isRead").map(l=>l.type==="isUnread")),o=e.some(l=>l.type==="isStarred")?!0:void 0,i=e.some(l=>l.type==="hasAttachment")?!0:void 0;return{...t!==void 0?{from:t}:{},...n!==void 0?{subject:n}:{},...a!==void 0?{category:[a]}:{},...r!==void 0?{unread:r}:{},...o!==void 0?{starred:o}:{},...i!==void 0?{attachments:i}:{}}},Hm=(e,t)=>{switch(t.type){case"from":return e.from?.toLowerCase()===t.value.toLowerCase();case"subject":return e.subject?.toLowerCase()===t.value.toLowerCase();case"category":return e.category?.length===1&&e.category[0]===t.category;case"isUnread":return e.unread===!0;case"isRead":return e.unread===!1;case"isStarred":return e.starred===!0;case"hasAttachment":return e.attachments===!0;case"before":case"after":case"in":case"account":return!1}},ea=(e,t)=>Object.fromEntries(Object.entries(e).filter(([n])=>t.includes(n)));function Nh(e,t={},n=Bm){const a=ea(Km(e),n),r={...a,...ea(t,n)};return{params:a,residual:e.filter(o=>!Hm(r,o))}}function Sh(e,t,n){if(t.length===0)return e;const a=[...t];return e.filter(r=>{const o=zm(r);return Um({...o,accountId:o.accountId??n},a)})}const Pr=8;function Zs(e,t){const n=Math.max(0,Math.min(t,e.length)),a=$i(e).find(o=>n>=o.start&&n<=o.end);if(!a)return{start:n,end:n,raw:""};const r=Li(a.raw);return r?{start:a.start,end:a.end,raw:a.raw,name:r.name,value:r.value}:{start:a.start,end:a.end,raw:a.raw}}function qm(e,t){const n=Zs(e,t);if(n.name===void 0)return{kind:"token",query:n.raw};const a=Aa(n.name);if(a)return{kind:"value",token:a.name,source:a.values,query:n.value??""}}const Qm={mailbox:"mailboxes",account:"accounts",contact:"contacts"},Wm=(e,t)=>{if(e.values==="fixed")return e.options??[];const n=Qm[e.values];return n?t[n]??[]:[]},Gm=(e,t)=>{if(t==="")return 1;const n=e.toLowerCase();return n.startsWith(t)?0:n.includes(t)?1:-1},As=(e,...t)=>{let n=-1;for(const a of t){if(a===void 0)continue;const r=Gm(a,e);r<0||(n<0||r<n)&&(n=r)}return n},Dr=e=>{const t=new Set;return e.filter(n=>n.rank>=0).sort((n,a)=>n.rank-a.rank).filter(n=>{const a=n.suggestion.value.toLowerCase();return t.has(a)?!1:(t.add(a),!0)}).slice(0,Pr).map(n=>n.suggestion)},ta=e=>({value:`${e.name}:`,label:`${e.name}:`,hint:e.label});function Vm(e){const t=e.trim().toLowerCase();if(t==="")return un.map(ta);const n=[];for(const a of un)if(n.push({rank:As(t,`${a.name}:`,a.label),suggestion:ta(a)}),a.values==="fixed")for(const r of a.options??[]){const o=$a(a.name,r.value);n.push({rank:As(t,o,r.label),suggestion:{value:o,label:r.label??o,hint:o}})}return Dr(n)}function Ym(e,t,n){const a=t.trim().toLowerCase(),r=Wm(e,n).map(o=>({rank:As(a,o.value,o.label),suggestion:{value:$a(e.name,o.value),label:o.label??o.value,...o.hint?{hint:o.hint}:{}}}));return Dr(r)}function Jm(e,t,n={}){const a=Zs(e,t);if(a.name===void 0)return Vm(a.raw);const r=Aa(a.name);return r?Ym(r,a.value??"",n):[]}function Xm(e,t,n){const a=Zs(e,t),r=!n.value.endsWith(":"),o=/\s/.test(e.slice(a.end,a.end+1)),i=r&&!o?`${n.value} `:n.value;return{query:e.slice(0,a.start)+i+e.slice(a.end),cursor:a.start+i.length+(r&&o?1:0)}}const Zm=e=>({value:e.normalizedEmail,...e.displayName?{label:e.displayName,hint:e.normalizedEmail}:{}}),ep=250,tp=2;function sp({query:e,cursor:t,enabled:n}){const{accounts:a}=St(),{mailboxesByName:r}=La(),o=r!==void 0,i=n?qm(e,t):void 0,l=i?.source==="contact"?i.query.trim():"",u=za(l,ep),{data:x}=ne({...zs({query:{q:u,limit:Pr}}),enabled:u.length>=tp}),g=Us({queries:a.map(p=>({...yt({path:{accountId:p.accountId}}),staleTime:1/0}))}),y=c.useMemo(()=>o?ji(g.map(p=>p.data?.items??[]),a):[],[o,g,a]),f=c.useMemo(()=>wi(a),[a]),v=c.useMemo(()=>(x?.items??[]).map(Zm),[x]);return c.useMemo(()=>{if(!n)return[];const p=Jm(e,t,{mailboxes:y,accounts:f,contacts:v});return o?p:p.filter(m=>m.value!=="in:")},[n,e,t,y,f,v,o])}const Fr="remit.recentSearches",np=5;function $s(){try{const e=localStorage.getItem(Fr);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function sa(e){const t=e.trim();if(!t)return $s();const n=[t,...$s().filter(a=>a!==t)].slice(0,np);try{localStorage.setItem(Fr,JSON.stringify(n))}catch{return n}return n}const ap=e=>e.tier!=="phone"&&e.hasLiveInput&&!(e.bodyRendersCommittedResults&&e.hasCommittedQuery),Ls=c.createContext(null);function rp(){const e=c.useContext(Ls),{searchInput:t,onSearchChange:n,onSearchClear:a}=St();if(!e)throw new Error("ListHeaderSearchField rendered outside MailListHeader's HeaderSearchContext provider");return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"min-w-0 flex-1",children:s.jsx(Ta,{value:t,onChange:n,onClear:a,globalFocusKey:!1,showClearButton:!1,suggest:e.suggest})}),s.jsx(H,{variant:"ghost",size:"touch",icon:s.jsx(Xe,{className:"size-5"}),onClick:e.onClose,"aria-label":"Close search",className:"shrink-0"}),s.jsx(Ia,{})]})}function Ih({title:e,unreadCount:t,children:n,selectionBar:a,paneOverlay:r,footer:o,searchFilter:i,searchResults:l,searchLoading:u,relatedResults:x,relatedLoading:g,onSelectSearchResult:y,searchResultsLabel:f="Top matches",relatedResultsLabel:v="Related",searchResultsInBody:p=!1,spamOffer:m,refreshControl:d}){const{accounts:b,resultFolderIndex:k,searchQuery:h,searchInput:j,onSearchChange:S,onSearchClear:I,searchViewKey:A}=St(),M=La(),T=Ci(),D=Sa(),$=Ml(),[K,_]=c.useState(!1),[w,R]=c.useState($s),O=ci(),C=c.useRef(A);c.useEffect(()=>{C.current!==A&&(C.current=A,_(!1))},[A]);const[L,N]=c.useState(0),[B,z]=c.useState(!1),[W,X]=c.useState(void 0),Y=sp({query:j,cursor:L,enabled:B&&j.trim().length>0}),oe=c.useCallback(ue=>{const je=Xm(j,L,ue);S(je.query),X({cursor:je.cursor})},[j,L,S]),Z=di({count:Y.length,onAccept:ue=>{const je=Y[ue];je&&oe(je)}}),{comboboxProps:ie,handleKeyDown:se}=Z,F=c.useMemo(()=>({comboboxProps:ie,onKeyDown:se,onCaretChange:N,onFocusChange:z,...W?{caret:W}:{}}),[ie,se,W]),ee=c.useCallback(()=>{I(),_(!1)},[I]),le=c.useMemo(()=>({suggest:F,onClose:ee}),[F,ee]),me=Z.open?s.jsx(pi,{id:Z.listId,suggestions:Y,activeIndex:Z.activeIndex,optionId:Z.optionId,onPick:oe,onHighlight:Z.setActiveIndex,label:"Search suggestions",className:"mx-row-inset mt-1 shrink-0"}):null,q=j.trim().length>0,{mailboxesByName:ce,accountsByName:Q}=M,G=c.useMemo(()=>Pi(j,{mailboxesByName:ce,accountsByName:Q}),[j,ce,Q]),re=c.useMemo(()=>G.tokens.map(ue=>({label:Ma(ue),onRemove:()=>S(Di(j,ue))})),[G,j,S]),ye=c.useMemo(()=>l??[],[l]),Le=c.useMemo(()=>x??[],[x]),at=c.useMemo(()=>q?[{id:"top",label:f,results:ye},{id:"related",label:v,results:Le}]:[],[q,f,v,ye,Le]),He=!(ye.length+Le.length>0)&&(u===!0||g===!0),{scope:rt}=Ni(b),V=ui(),Et=$l(V),Pe=Et?k.get(Et)?.role:void 0,Ce=c.useMemo(()=>Ll(V,rt,Pe),[V,rt,Pe]),pe=Ce.kind==="global"?m:void 0,ke=c.useMemo(()=>pe?{kind:"global",spamCount:pe.count,onScopeToSpam:()=>T(pe.mailboxId,h)}:Ce,[pe,Ce,T,h]),qe=Le.length>0,Qe=c.useMemo(()=>tm(G,{searchHadSemanticReach:qe}),[G,qe]),de=q?Qe:void 0,te=c.useCallback(()=>{_(!1),O("properties","search")},[O]),De=Wd(Qe)?void 0:fi(Qe.droppedFacets.map(ue=>ue.label)),Fe=c.useMemo(()=>q?{onClick:te,blockedReason:De}:void 0,[q,De,te]),is=c.useMemo(()=>Fe?s.jsx(cr,{...Fe}):null,[Fe]),Ne=ap({tier:$,hasLiveInput:q,hasCommittedQuery:h.trim().length>0,bodyRendersCommittedResults:p}),Oe=c.useCallback(ue=>{R(sa(j)),y?.(ue)},[j,y]),Mt=c.useMemo(()=>s.jsx(dr,{value:j,sections:at,loading:He,onSelectResult:Oe,tokens:re,scope:ke}),[j,at,He,Oe,re,ke]),We=a===void 0,ze=c.useMemo(()=>Ne?s.jsx("div",{className:"h-full overflow-y-auto",children:Mt}):null,[Ne,Mt]),Ge=ze&&!We?ze:n,At=ze&&We?ze:null,ot=Al($),it=ot&&(K||q),lt=c.useMemo(()=>({title:e,searchResults:At,makeFilterSlot:is,navSlot:D&&!D.showNavPane&&s.jsx(H,{variant:"ghost",size:"touch",icon:s.jsx(Pl,{className:"size-5"}),onClick:()=>D.openNav(),"aria-label":"Menu",className:"-ml-2 shrink-0"}),titleMeta:s.jsxs(s.Fragment,{children:[t===null?null:s.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:[t.toLocaleString()," unread"]}),s.jsx(Ia,{}),d]}),searchSlot:ot&&!it&&s.jsx(H,{variant:"ghost",size:"touch",icon:s.jsx(mi,{className:"size-5"}),onClick:()=>_(!0),"aria-label":"Search",className:"shrink-0"}),searchField:it&&s.jsx(rp,{})}),[e,t,D,ot,it,At,is,d]);if($==="phone"&&K){const ue=je=>{R(sa(j)),_(!1),y?.(je)};return s.jsx(Ls.Provider,{value:le,children:s.jsx(Ms.Provider,{value:de,children:s.jsxs(Es.Provider,{value:lt,children:[s.jsx(vd,{value:j,onChange:S,onClear:I,onCancel:()=>{_(!1),I()},filter:i,recentSearches:w,onPickRecent:S,makeFilter:Fe,sections:at,loading:He,onSelectResult:ue,tokens:re,scope:ke,suggest:F,suggestList:me}),r]})})})}return s.jsx(Ls.Provider,{value:le,children:s.jsx(Ms.Provider,{value:de,children:s.jsx(Es.Provider,{value:lt,children:s.jsxs("section",{className:"relative flex h-full w-full flex-col bg-surface",children:[a?.(lt),me,s.jsx("div",{className:"min-h-0 flex-1",children:Ge}),o,r]})})})})}export{Xp as $,gh as A,Nh as B,ad as C,Lf as D,ns as E,Sh as F,Jp as G,bh as H,fh as I,as as J,Rt as K,ph as L,lh as M,mh as N,Vp as O,Gp as P,Em as Q,hr as R,yd as S,uf as T,mf as U,hf as V,pf as W,hh as X,Qp as Y,Rm as Z,uh as _,$f as a,nh as a0,wf as a1,dh as a2,ch as a3,Hp as a4,Yp as a5,kh as a6,wh as a7,vh as a8,ld as a9,It as aa,qs as ab,Is as ac,Up as ad,Bp as ae,zp as af,_p as ag,yh as ah,Ih as ai,Ys as aj,_m as ak,zm as al,Um as am,jh as an,xd as ao,Ch as ap,Kp as aq,ap as ar,md as as,oh as at,Cn as au,xm as av,qp as aw,ih as ax,Wp as b,Ws as c,xr as d,Cf as e,sd as f,Sf as g,Tf as h,Jd as i,ah as j,Mf as k,rh as l,Jc as m,td as n,Ef as o,pu as p,br as q,Wu as r,eh as s,gr as t,jm as u,th as v,sh as w,hu as x,Zp as y,xh as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{O as o}from"./index-CEPt7qyx.js";const n=o;export{n as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aj as m,j as o,O as p}from"./index-CEPt7qyx.js";import{a}from"./MailShell--j4aRxeO.js";import{M as r}from"./MailboxPane-DLYLIJW2.js";import{a as e}from"./search-token-index-g9u-Yoz1.js";import{u as s}from"./search-mirror-AZ09oaZ-.js";import"./FullCompose-DzwWI0uW.js";import"./ErrorState-4mTTo1i7.js";import"./index-DnKCHbFt.js";import"./useMessageBodyContent-BPfgRb0y.js";import"./useSignature-rBm8HWB-.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-B2mvBjFc.js";import"./sections-HGyDVW8E.js";import"./confirm-dialog-BeqneGTk.js";import"./useSearchTokenContext-DV1a2Ept.js";import"./kbd-DARC33aW.js";import"./search-scope-B5-OK3Cq.js";import"./useRefreshControl-BEmUdva7.js";import"./circle-check-big-B1_wSShn.js";import"./refresh-cw-DpoU5Ymm.js";import"./useQueries-71fTePBw.js";import"./MailListHeader-DApFSHSe.js";import"./roving-focus-DaOEU3XN.js";import"./popover-menu-lD6vWVLi.js";import"./mail-BtoYtCIx.js";import"./avatar-DMG2etHF.js";import"./EmptyState-BxCn_noW.js";import"./undo-2-DlzJI2Fz.js";import"./download-CagrzNeA.js";import"./calendar-suggestion-CDJ7NeZD.js";import"./calendar-format-pxTaaUQD.js";import"./useCalendars-CC6_02zt.js";import"./calendar-report-7qxgvnEi.js";import"./attendee-row-ChVyXD3x.js";import"./minus-Bwn9p369.js";import"./clock-DNac4DPY.js";import"./calendar-clash-strip-xpMaDxF1.js";import"./bell-off-DRmJ5yyg.js";import"./shield-check-EAw6gej8.js";import"./useFilters-CNZftL2x.js";import"./checkbox-72qUZj4h.js";import"./useLayoutTier-DL8wqvev.js";import"./menu-DgePuI44.js";import"./MailViewChrome-DbNhYfPK.js";import"./pane-header-DbMugl_W.js";import"./NavMenuButton-BQ6HpwiL.js";import"./useLabels-60oKTMmI.js";import"./useSemanticSearch-_DIS3Eh-.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-DzCXRkg4.js";import"./circle-help-Cx3QyYDY.js";import"./circle-check-BZ8xIrjW.js";function eo(){const{mailboxId:t}=m.useParams(),i=e();return s({to:"/mail/$mailboxId",params:{mailboxId:t}}),o.jsx(r,{mailboxId:t,thread:i,children:o.jsx(a,{phone:o.jsx(r.Phone,{}),list:o.jsx(r.List,{}),reading:o.jsx(p,{}),intelligence:o.jsx(r.Intelligence,{}),hasThread:!!i})})}export{eo as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-CEPt7qyx.js";import{F as r}from"./FlaggedPane-BMEsB4gM.js";import"./useSearchTokenContext-DV1a2Ept.js";import"./kbd-DARC33aW.js";import"./useMessageBodyContent-BPfgRb0y.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-DApFSHSe.js";import"./roving-focus-DaOEU3XN.js";import"./search-token-index-g9u-Yoz1.js";import"./useQueries-71fTePBw.js";import"./popover-menu-lD6vWVLi.js";import"./mail-BtoYtCIx.js";import"./avatar-DMG2etHF.js";import"./index-DnKCHbFt.js";import"./useSignature-rBm8HWB-.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-B2mvBjFc.js";import"./sections-HGyDVW8E.js";import"./EmptyState-BxCn_noW.js";import"./ErrorState-4mTTo1i7.js";import"./undo-2-DlzJI2Fz.js";import"./download-CagrzNeA.js";import"./calendar-suggestion-CDJ7NeZD.js";import"./calendar-format-pxTaaUQD.js";import"./useCalendars-CC6_02zt.js";import"./calendar-report-7qxgvnEi.js";import"./attendee-row-ChVyXD3x.js";import"./minus-Bwn9p369.js";import"./clock-DNac4DPY.js";import"./calendar-clash-strip-xpMaDxF1.js";import"./bell-off-DRmJ5yyg.js";import"./shield-check-EAw6gej8.js";import"./useFilters-CNZftL2x.js";import"./checkbox-72qUZj4h.js";import"./confirm-dialog-BeqneGTk.js";import"./useLayoutTier-DL8wqvev.js";import"./menu-DgePuI44.js";import"./MailViewChrome-DbNhYfPK.js";import"./refresh-cw-DpoU5Ymm.js";import"./wizard-selection-DxUM65kM.js";function O(){return o.jsx(r.Reading,{})}export{O as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./index-CEPt7qyx.js";import{B as o}from"./BriefPane-CgrYQK-q.js";import"./useSearchTokenContext-DV1a2Ept.js";import"./kbd-DARC33aW.js";import"./useMessageBodyContent-BPfgRb0y.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-DApFSHSe.js";import"./roving-focus-DaOEU3XN.js";import"./search-token-index-g9u-Yoz1.js";import"./useQueries-71fTePBw.js";import"./popover-menu-lD6vWVLi.js";import"./mail-BtoYtCIx.js";import"./avatar-DMG2etHF.js";import"./index-DnKCHbFt.js";import"./useSignature-rBm8HWB-.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-B2mvBjFc.js";import"./sections-HGyDVW8E.js";import"./EmptyState-BxCn_noW.js";import"./ErrorState-4mTTo1i7.js";import"./undo-2-DlzJI2Fz.js";import"./download-CagrzNeA.js";import"./calendar-suggestion-CDJ7NeZD.js";import"./calendar-format-pxTaaUQD.js";import"./useCalendars-CC6_02zt.js";import"./calendar-report-7qxgvnEi.js";import"./attendee-row-ChVyXD3x.js";import"./minus-Bwn9p369.js";import"./clock-DNac4DPY.js";import"./calendar-clash-strip-xpMaDxF1.js";import"./bell-off-DRmJ5yyg.js";import"./shield-check-EAw6gej8.js";import"./useFilters-CNZftL2x.js";import"./checkbox-72qUZj4h.js";import"./confirm-dialog-BeqneGTk.js";import"./useLayoutTier-DL8wqvev.js";import"./menu-DgePuI44.js";import"./useRefreshControl-BEmUdva7.js";import"./circle-check-big-B1_wSShn.js";import"./refresh-cw-DpoU5Ymm.js";import"./useSemanticSearch-_DIS3Eh-.js";import"./useLabels-60oKTMmI.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-DxUM65kM.js";function U(){return r.jsx(o.Reading,{})}export{U as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-CEPt7qyx.js";import{M as r}from"./MailboxPane-DLYLIJW2.js";import"./useSearchTokenContext-DV1a2Ept.js";import"./kbd-DARC33aW.js";import"./useMessageBodyContent-BPfgRb0y.js";import"./search-scope-B5-OK3Cq.js";import"./useRefreshControl-BEmUdva7.js";import"./circle-check-big-B1_wSShn.js";import"./refresh-cw-DpoU5Ymm.js";import"./useQueries-71fTePBw.js";import"./MailListHeader-DApFSHSe.js";import"./roving-focus-DaOEU3XN.js";import"./search-token-index-g9u-Yoz1.js";import"./popover-menu-lD6vWVLi.js";import"./mail-BtoYtCIx.js";import"./avatar-DMG2etHF.js";import"./index-DnKCHbFt.js";import"./useSignature-rBm8HWB-.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-B2mvBjFc.js";import"./sections-HGyDVW8E.js";import"./EmptyState-BxCn_noW.js";import"./ErrorState-4mTTo1i7.js";import"./undo-2-DlzJI2Fz.js";import"./download-CagrzNeA.js";import"./calendar-suggestion-CDJ7NeZD.js";import"./calendar-format-pxTaaUQD.js";import"./useCalendars-CC6_02zt.js";import"./calendar-report-7qxgvnEi.js";import"./attendee-row-ChVyXD3x.js";import"./minus-Bwn9p369.js";import"./clock-DNac4DPY.js";import"./calendar-clash-strip-xpMaDxF1.js";import"./bell-off-DRmJ5yyg.js";import"./shield-check-EAw6gej8.js";import"./useFilters-CNZftL2x.js";import"./checkbox-72qUZj4h.js";import"./confirm-dialog-BeqneGTk.js";import"./useLayoutTier-DL8wqvev.js";import"./menu-DgePuI44.js";import"./MailViewChrome-DbNhYfPK.js";import"./pane-header-DbMugl_W.js";import"./NavMenuButton-BQ6HpwiL.js";import"./useLabels-60oKTMmI.js";import"./useSemanticSearch-_DIS3Eh-.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-DzCXRkg4.js";import"./circle-help-Cx3QyYDY.js";import"./circle-check-BZ8xIrjW.js";function Z(){return o.jsx(r.Reading,{})}export{Z as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-CEPt7qyx.js";import{O as t}from"./OutboxPane-Qy6KcYt8.js";import"./roving-focus-DaOEU3XN.js";import"./useSearchTokenContext-DV1a2Ept.js";import"./kbd-DARC33aW.js";import"./useMessageBodyContent-BPfgRb0y.js";import"./search-scope-B5-OK3Cq.js";import"./circle-check-big-B1_wSShn.js";import"./clock-DNac4DPY.js";import"./row-actions-DjboMNPd.js";import"./rotate-ccw-DQ3ge9ht.js";import"./pane-header-DbMugl_W.js";import"./NavMenuButton-BQ6HpwiL.js";import"./menu-DgePuI44.js";import"./outbox-status-BlKn6P0x.js";import"./search-query-Cr_ZXBCp.js";function R(){return o.jsx(t.Reading,{})}export{R as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{eX as o,j as m}from"./index-CEPt7qyx.js";import{O as p}from"./OpenCalendarEvent-B57LCOm6.js";import"./CalendarComposePane-BP11q0VZ.js";import"./calendar-format-pxTaaUQD.js";import"./useQueries-71fTePBw.js";import"./useCalendars-CC6_02zt.js";import"./calendar-clash-strip-xpMaDxF1.js";import"./attendee-row-ChVyXD3x.js";import"./avatar-DMG2etHF.js";import"./minus-Bwn9p369.js";import"./clock-DNac4DPY.js";import"./calendar-report-7qxgvnEi.js";import"./mail-BtoYtCIx.js";import"./pencil-CuzrXP0x.js";import"./useCalendarWrites-DS7CUivn.js";import"./ErrorState-4mTTo1i7.js";import"./useCalendarData-Bb3qmi9r.js";import"./calendar-subscription-B-aAc2Gy.js";function v(){const{calendarObjectId:r,recurrenceId:t}=o.useParams();return m.jsx(p,{calendarObjectId:r,recurrenceId:t})}export{v as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{O as o}from"./index-CEPt7qyx.js";const n=o;export{n as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{O as o}from"./index-CEPt7qyx.js";const n=o;export{n as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{O as o}from"./index-CEPt7qyx.js";const n=o;export{n as component};
|
package/assets/brief-_1FM8dkv.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r,O as i}from"./index-CEPt7qyx.js";import{a as m}from"./MailShell--j4aRxeO.js";import{B as o}from"./BriefPane-CgrYQK-q.js";import{a as p}from"./search-token-index-g9u-Yoz1.js";import{u as e}from"./search-mirror-AZ09oaZ-.js";import"./FullCompose-DzwWI0uW.js";import"./ErrorState-4mTTo1i7.js";import"./index-DnKCHbFt.js";import"./useMessageBodyContent-BPfgRb0y.js";import"./useSignature-rBm8HWB-.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-B2mvBjFc.js";import"./sections-HGyDVW8E.js";import"./confirm-dialog-BeqneGTk.js";import"./useSearchTokenContext-DV1a2Ept.js";import"./kbd-DARC33aW.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-DApFSHSe.js";import"./roving-focus-DaOEU3XN.js";import"./popover-menu-lD6vWVLi.js";import"./mail-BtoYtCIx.js";import"./avatar-DMG2etHF.js";import"./EmptyState-BxCn_noW.js";import"./undo-2-DlzJI2Fz.js";import"./download-CagrzNeA.js";import"./calendar-suggestion-CDJ7NeZD.js";import"./calendar-format-pxTaaUQD.js";import"./useQueries-71fTePBw.js";import"./useCalendars-CC6_02zt.js";import"./calendar-report-7qxgvnEi.js";import"./attendee-row-ChVyXD3x.js";import"./minus-Bwn9p369.js";import"./clock-DNac4DPY.js";import"./calendar-clash-strip-xpMaDxF1.js";import"./bell-off-DRmJ5yyg.js";import"./shield-check-EAw6gej8.js";import"./useFilters-CNZftL2x.js";import"./checkbox-72qUZj4h.js";import"./useLayoutTier-DL8wqvev.js";import"./menu-DgePuI44.js";import"./useRefreshControl-BEmUdva7.js";import"./circle-check-big-B1_wSShn.js";import"./refresh-cw-DpoU5Ymm.js";import"./useSemanticSearch-_DIS3Eh-.js";import"./useLabels-60oKTMmI.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-DxUM65kM.js";function rr(){const t=p();return e({to:"/mail/brief"}),r.jsx(o,{thread:t,children:r.jsx(m,{phone:r.jsx(o.Phone,{}),list:r.jsx(o.List,{}),reading:r.jsx(i,{}),intelligence:r.jsx(o.Intelligence,{}),hasThread:!!t})})}export{rr as component};
|