@remit/web-client-dist 0.0.320 → 0.0.321
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-BS_sjLMu.js → BriefPane-BvS6OY3_.js} +1 -1
- package/assets/{ErrorState-B8aDk7g6.js → ErrorState-By22X09V.js} +1 -1
- package/assets/{FlaggedPane-BTxopCc_.js → FlaggedPane-COtoIxw_.js} +1 -1
- package/assets/MailListHeader-CzkFVHra.js +52 -0
- package/assets/{MailViewChrome-Cdqxq6aL.js → MailViewChrome-_M0MZo3I.js} +1 -1
- package/assets/{MailboxPane-BXczZoOZ.js → MailboxPane-DxXhzeri.js} +1 -1
- package/assets/{NavMenuButton-Ci1ya9SI.js → NavMenuButton-DmFeFE-H.js} +1 -1
- package/assets/{OnboardingWizard-Dm6_GSUZ.js → OnboardingWizard-KL6He6rZ.js} +1 -1
- package/assets/{OutboxPane-CQ2k5MFj.js → OutboxPane-BTeGPBk1.js} +1 -1
- package/assets/_mailboxId-CNHu38xX.js +1 -0
- package/assets/_messageId-D_A2HKiL.js +1 -0
- package/assets/_threadId-BVUvwFWI.js +1 -0
- package/assets/{account-form-helpers-DkTf60Ei.js → account-form-helpers-DgsG82nf.js} +1 -1
- package/assets/{accounts-BlvNNgL6.js → accounts-DPg0TXKK.js} +1 -1
- package/assets/{advanced-MgHLeGQ6.js → advanced-BcHKt9Ee.js} +1 -1
- package/assets/{appearance-D4HR-VGt.js → appearance-BTcWKzSp.js} +1 -1
- package/assets/{avatar-vIu1rKIk.js → avatar-B5Xfa_Aj.js} +1 -1
- package/assets/{bottom-sheet-nMowEQNf.js → bottom-sheet-CWKDKUBi.js} +1 -1
- package/assets/{brief-C4s8eKrN.js → brief-B121wlDA.js} +1 -1
- package/assets/brief-BaArslj1.js +1 -0
- package/assets/{browser-ponyfill-C-emAD8o.js → browser-ponyfill-Dnwm2Nul.js} +2 -2
- package/assets/{circle-check-CX5KFJZR.js → circle-check-D_nZdueG.js} +1 -1
- package/assets/{circle-check-big-D_R6-Ck3.js → circle-check-big-Dm9DZK8n.js} +1 -1
- package/assets/{circle-help-XhS4cPys.js → circle-help-BGR1fVqk.js} +1 -1
- package/assets/{clock-BXOXx_w7.js → clock-LgAy7KhC.js} +1 -1
- package/assets/{confirm-dialog-BAvPnWMV.js → confirm-dialog-d8zs8D-F.js} +1 -1
- package/assets/{download-V1r4rjrp.js → download-FAYYcvQP.js} +1 -1
- package/assets/{filters-B6iLQblX.js → filters-DTju1R14.js} +1 -1
- package/assets/flagged-BU2-QoPm.js +1 -0
- package/assets/{flagged-DlrMTRYl.js → flagged-BoYv9IB6.js} +1 -1
- package/assets/{folders-CFXhKU2K.js → folders-BfrtWUpW.js} +1 -1
- package/assets/{index-DTvNcUjW.js → index-3eAE16lF.js} +45 -45
- package/assets/index-BJYlc6-u.js +1 -0
- package/assets/index-BLqvw8Q9.js +1 -0
- package/assets/index-C-5LrpJf.js +1 -0
- package/assets/index-C6qTCMjJ.js +1 -0
- package/assets/index-CLxW3Goq.js +1 -0
- package/assets/index-D_A2HKiL.js +1 -0
- package/assets/{kbd-D0Ql6OUU.js → kbd-BVVVI8MK.js} +1 -1
- package/assets/{labels-CDD_I0Ec.js → labels-BjFJ4XU1.js} +1 -1
- package/assets/{mail-8YgrQhDi.js → mail-C8sEJWa1.js} +1 -1
- package/assets/{menu-CycP4O-F.js → menu-B3HPQBVa.js} +1 -1
- package/assets/{move-options-BvTgHYOR.js → move-options-s_k2CE-Q.js} +1 -1
- package/assets/{onboarding-CnxSvHNm.js → onboarding-BxbMIMO7.js} +1 -1
- package/assets/outbox-D7_yfM4h.js +1 -0
- package/assets/{pencil-DGrsgleB.js → pencil-6AbAHB79.js} +1 -1
- package/assets/{rich-text-Ca9Yectf.js → rich-text-BA11pr6t.js} +1 -1
- package/assets/{rotate-ccw-CGBOTwtR.js → rotate-ccw-CgMVBPU0.js} +1 -1
- package/assets/{row-actions-jaw0Enq3.js → row-actions-Cfzm03L2.js} +1 -1
- package/assets/{search-scope-BISSOSj6.js → search-scope-Bcn1kzwd.js} +1 -1
- package/assets/{search-token-index-TLbnLJHt.js → search-token-index-XT09xk5-.js} +1 -1
- package/assets/{search-view-Ck0UiXQG.js → search-view-BtUa3wf0.js} +1 -1
- package/assets/{senders-BOSNZ0ID.js → senders-DsoPkIii.js} +1 -1
- package/assets/settings-6lKvObGd.js +1 -0
- package/assets/{settings-screen-B5nzeeiR.js → settings-screen-jzEUDPFx.js} +1 -1
- package/assets/{shield-check-Q1R8q0QC.js → shield-check-Dq-7lUbt.js} +1 -1
- package/assets/{suggested-vips-BHGm6NaH.js → suggested-vips-9VOMpahq.js} +1 -1
- package/assets/{useDebouncedValue-HsyuDdy4.js → useDebouncedValue-nan84ZZT.js} +1 -1
- package/assets/{useFilters-C7ZDlBZ5.js → useFilters-laocR3nD.js} +1 -1
- package/assets/{useLabels-CfCxozW7.js → useLabels-Bzefby_I.js} +1 -1
- package/assets/{useMediaQuery-CYQ86-Hp.js → useMediaQuery-vS62WMhd.js} +1 -1
- package/assets/{useRefreshControl-BkUCSRPw.js → useRefreshControl-DivGdE-V.js} +1 -1
- package/assets/{useSearchMirror-fpavjLqz.js → useSearchMirror-BJ2isjrf.js} +1 -1
- package/assets/{useSearchTokenContext-vMiM5NGz.js → useSearchTokenContext-DKU_0B8G.js} +1 -1
- package/assets/{useSemanticSearch-DYOve1Sx.js → useSemanticSearch-Br2klJqm.js} +1 -1
- package/assets/{useSignature-DMZlK0E7.js → useSignature-DEHQxXCm.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/MailListHeader-C5GXuv0B.js +0 -52
- package/assets/_mailboxId-BcLkIXnT.js +0 -1
- package/assets/_messageId-CW-l8lwu.js +0 -1
- package/assets/_threadId-BSSYhk6m.js +0 -1
- package/assets/brief-BOc93HHa.js +0 -1
- package/assets/flagged-BRf4C6Jm.js +0 -1
- package/assets/index-BZ0lcS82.js +0 -1
- package/assets/index-C1oAlEVH.js +0 -1
- package/assets/index-CW-l8lwu.js +0 -1
- package/assets/index-CrfrP4z6.js +0 -1
- package/assets/index-DY3AIEwU.js +0 -1
- package/assets/index-DcK3AadA.js +0 -1
- package/assets/outbox-BvkPgA2N.js +0 -1
- package/assets/settings-DStszAye.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./index-3eAE16lF.js";import{F as r}from"./FlaggedPane-COtoIxw_.js";import"./useSearchTokenContext-DKU_0B8G.js";import"./kbd-BVVVI8MK.js";import"./enums-CCxx0t2v.js";import"./search-scope-Bcn1kzwd.js";import"./MailListHeader-CzkFVHra.js";import"./search-token-index-XT09xk5-.js";import"./useMediaQuery-vS62WMhd.js";import"./account-form-helpers-DgsG82nf.js";import"./avatar-B5Xfa_Aj.js";import"./useSignature-DEHQxXCm.js";import"./useDebouncedValue-nan84ZZT.js";import"./ErrorState-By22X09V.js";import"./format-De9HZKjg.js";import"./download-FAYYcvQP.js";import"./shield-check-Dq-7lUbt.js";import"./move-options-s_k2CE-Q.js";import"./useFilters-laocR3nD.js";import"./confirm-dialog-d8zs8D-F.js";import"./clock-LgAy7KhC.js";import"./menu-B3HPQBVa.js";import"./MailViewChrome-_M0MZo3I.js";function q(){return o.jsx(r.Reading,{})}export{q as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./index-3eAE16lF.js";import{M as i}from"./MailboxPane-DxXhzeri.js";import"./useSearchTokenContext-DKU_0B8G.js";import"./kbd-BVVVI8MK.js";import"./enums-CCxx0t2v.js";import"./search-scope-Bcn1kzwd.js";import"./useRefreshControl-DivGdE-V.js";import"./circle-check-big-Dm9DZK8n.js";import"./search-token-index-XT09xk5-.js";import"./useMediaQuery-vS62WMhd.js";import"./MailListHeader-CzkFVHra.js";import"./account-form-helpers-DgsG82nf.js";import"./avatar-B5Xfa_Aj.js";import"./useSignature-DEHQxXCm.js";import"./useDebouncedValue-nan84ZZT.js";import"./ErrorState-By22X09V.js";import"./format-De9HZKjg.js";import"./download-FAYYcvQP.js";import"./shield-check-Dq-7lUbt.js";import"./move-options-s_k2CE-Q.js";import"./useFilters-laocR3nD.js";import"./confirm-dialog-d8zs8D-F.js";import"./clock-LgAy7KhC.js";import"./menu-B3HPQBVa.js";import"./MailViewChrome-_M0MZo3I.js";import"./NavMenuButton-DmFeFE-H.js";import"./useLabels-Bzefby_I.js";import"./useSemanticSearch-Br2klJqm.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-CWKDKUBi.js";import"./circle-help-BGR1fVqk.js";import"./circle-check-D_nZdueG.js";import"./intelligence-pref-C6lFpj6U.js";function G(){return o.jsx(i.Reading,{})}export{G as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as r}from"./index-3eAE16lF.js";import{B as o}from"./BriefPane-BvS6OY3_.js";import"./useSearchTokenContext-DKU_0B8G.js";import"./kbd-BVVVI8MK.js";import"./enums-CCxx0t2v.js";import"./search-scope-Bcn1kzwd.js";import"./MailListHeader-CzkFVHra.js";import"./search-token-index-XT09xk5-.js";import"./useMediaQuery-vS62WMhd.js";import"./account-form-helpers-DgsG82nf.js";import"./avatar-B5Xfa_Aj.js";import"./useSignature-DEHQxXCm.js";import"./useDebouncedValue-nan84ZZT.js";import"./ErrorState-By22X09V.js";import"./format-De9HZKjg.js";import"./download-FAYYcvQP.js";import"./shield-check-Dq-7lUbt.js";import"./move-options-s_k2CE-Q.js";import"./useFilters-laocR3nD.js";import"./confirm-dialog-d8zs8D-F.js";import"./clock-LgAy7KhC.js";import"./menu-B3HPQBVa.js";import"./useRefreshControl-DivGdE-V.js";import"./circle-check-big-Dm9DZK8n.js";import"./useLabels-Bzefby_I.js";import"./useSemanticSearch-Br2klJqm.js";import"./search-query-Cr_ZXBCp.js";function z(){return r.jsx(o.Reading,{})}export{z as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,a5 as o}from"./index-3eAE16lF.js";const n=()=>t.jsx(o,{to:"/settings/accounts"});export{n as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./index-3eAE16lF.js";import{O as t}from"./OutboxPane-BTeGPBk1.js";import"./useSearchTokenContext-DKU_0B8G.js";import"./kbd-BVVVI8MK.js";import"./enums-CCxx0t2v.js";import"./search-scope-Bcn1kzwd.js";import"./circle-check-big-Dm9DZK8n.js";import"./clock-LgAy7KhC.js";import"./row-actions-Cfzm03L2.js";import"./rotate-ccw-CgMVBPU0.js";import"./NavMenuButton-DmFeFE-H.js";import"./menu-B3HPQBVa.js";import"./format-De9HZKjg.js";import"./outbox-status-CPfNHfUQ.js";import"./search-query-Cr_ZXBCp.js";function c(){return o.jsx(t.Reading,{})}export{c as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as r}from"./index-3eAE16lF.js";import{B as o}from"./BriefPane-BvS6OY3_.js";import"./useSearchTokenContext-DKU_0B8G.js";import"./kbd-BVVVI8MK.js";import"./enums-CCxx0t2v.js";import"./search-scope-Bcn1kzwd.js";import"./MailListHeader-CzkFVHra.js";import"./search-token-index-XT09xk5-.js";import"./useMediaQuery-vS62WMhd.js";import"./account-form-helpers-DgsG82nf.js";import"./avatar-B5Xfa_Aj.js";import"./useSignature-DEHQxXCm.js";import"./useDebouncedValue-nan84ZZT.js";import"./ErrorState-By22X09V.js";import"./format-De9HZKjg.js";import"./download-FAYYcvQP.js";import"./shield-check-Dq-7lUbt.js";import"./move-options-s_k2CE-Q.js";import"./useFilters-laocR3nD.js";import"./confirm-dialog-d8zs8D-F.js";import"./clock-LgAy7KhC.js";import"./menu-B3HPQBVa.js";import"./useRefreshControl-DivGdE-V.js";import"./circle-check-big-Dm9DZK8n.js";import"./useLabels-Bzefby_I.js";import"./useSemanticSearch-Br2klJqm.js";import"./search-query-Cr_ZXBCp.js";function y(){return r.jsx(o.Reading,{})}export{y as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s,b as t}from"./index-
|
|
1
|
+
import{j as s,b as t}from"./index-3eAE16lF.js";function x({className:e,...n}){return s.jsx("kbd",{className:t("inline-flex h-4 min-w-4 items-center justify-center rounded-xs border border-line bg-surface-sunken px-1 font-sans text-2xs text-fg-muted",e),...n})}export{x as K};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as x,j as e,aj as h,aT as y,ai as b,b5 as g,B as v,T as N,o as C,w as L,W as I,ax as D,aB as S,ay as w}from"./index-
|
|
1
|
+
import{r as x,j as e,aj as h,aT as y,ai as b,b5 as g,B as v,T as N,o as C,w as L,W as I,ax as D,aB as S,ay as w}from"./index-3eAE16lF.js";import{C as E}from"./confirm-dialog-d8zs8D-F.js";import{S as T}from"./settings-screen-jzEUDPFx.js";import{E as j}from"./ErrorState-By22X09V.js";import{a as $,b as k,c as R,u as B}from"./useLabels-Bzefby_I.js";import"./avatar-B5Xfa_Aj.js";import"./menu-B3HPQBVa.js";import"./circle-help-BGR1fVqk.js";function O({labels:l,onRename:i,onRecolor:n,onDelete:m,deletingLabelId:c}){const[u,r]=x.useState(),[o,d]=x.useState("");if(l.length===0)return e.jsx("p",{className:"py-6 text-sm text-fg-muted",children:"No labels yet. Create one below, then use it in a filter or apply it to mail directly."});const t=a=>{const s=o.trim();s!==""&&i(a,s),r(void 0)};return e.jsx("ul",{className:"divide-y divide-line rounded-md border border-line",children:l.map(a=>e.jsxs("li",{className:"flex items-center gap-3 px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[u===a.labelId?e.jsx(h,{autoFocus:!0,value:o,onChange:s=>d(s.target.value),onBlur:()=>t(a.labelId),onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),t(a.labelId)),s.key==="Escape"&&(s.preventDefault(),r(void 0))},"aria-label":`Rename label ${a.name}`}):e.jsx("button",{type:"button",onClick:()=>{r(a.labelId),d(a.name)},"aria-label":`Rename label ${a.name}`,className:"flex items-center gap-2 rounded-sm text-left hover:opacity-80",children:e.jsx(y,{label:a})}),e.jsx("p",{className:"mt-0.5 text-xs text-fg-subtle",children:a.filterCount===0?"Not used in any filter":`Used in ${a.filterCount} ${a.filterCount===1?"filter":"filters"}`})]}),e.jsx(b,{"aria-label":`Color for ${a.name}`,value:a.color,onChange:s=>n(a.labelId,s.target.value),className:"w-28 shrink-0",children:g.map(s=>e.jsx("option",{value:s,children:s},s))}),e.jsx(v,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-4 text-danger"}),onClick:()=>m(a),disabled:c===a.labelId,"aria-label":`Delete label ${a.name}`})]},a.labelId))})}const P=(l,i)=>{if(i===0)return{title:`Delete the "${l}" label?`};const n=i===1?"filter":"filters";return{title:`Delete the "${l}" label?`,description:`This also deletes ${i} ${n} that ${i===1?"applies":"apply"} it — they can't be recovered.`}},_=e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Labels mark mail without moving it — a message can carry any number of them alongside whichever folder it lives in."}),e.jsx("p",{children:"Use a label in a filter's action to have new (and existing) mail label itself automatically, or apply one to a selection directly from the mailbox."}),e.jsx("p",{children:"Deleting a label removes it from every message, and deletes every filter that applies it — the confirmation names how many."})]});function H({accountId:l}){const{createLabel:i,isPending:n,isError:m}=B(l),[c,u]=x.useState(""),[r,o]=x.useState("Default"),d=()=>{const t=c.trim();t!==""&&i(t,r).then(()=>{u(""),o("Default")})};return e.jsxs("div",{className:"space-y-2 rounded-sm border border-line bg-surface p-3",children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:"New label"}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-end",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Name"}),e.jsx(h,{value:c,onChange:t=>u(t.target.value),placeholder:"e.g. Receipts","aria-label":"Label name",onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),d())}})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Color"}),e.jsx(b,{value:r,onChange:t=>o(t.target.value),"aria-label":"Label color",className:"w-28",children:g.map(t=>e.jsx("option",{value:t,children:t},t))})]}),e.jsx(v,{variant:"primary",onClick:d,disabled:n||c.trim()==="",children:n?"Creating…":"Create label"})]}),m&&e.jsx(w,{tone:"danger",variant:"soft",children:"Couldn't create that label. Please try again."})]})}function A({account:l}){const i=l.accountId,{labels:n,isPending:m,isError:c,error:u,refetch:r}=$(i),{updateLabel:o}=k(i),{deleteLabel:d,deletingLabelId:t}=R(i),[a,s]=x.useState();return e.jsxs("section",{className:"space-y-2",children:[e.jsx("h2",{className:"text-sm font-semibold text-fg",children:l.email}),m?e.jsx("div",{className:"h-16 animate-pulse rounded-md border border-line bg-surface","aria-busy":"true","aria-label":`Loading labels for ${l.email}`}):c?e.jsx(j,{variant:"inline",title:`Couldn't load labels for ${l.email}`,error:u,onRetry:()=>{r()}}):e.jsx(O,{labels:n,onRename:(p,f)=>o(p,{name:f}),onRecolor:(p,f)=>o(p,{color:f}),onDelete:s,deletingLabelId:t}),e.jsx(H,{accountId:i}),a&&(()=>{const p=P(a.name,a.filterCount);return e.jsx(E,{isOpen:!0,title:p.title,description:p.description,confirmLabel:"Delete label",destructive:!0,isBusy:t===a.labelId,onConfirm:()=>{d(a.labelId),s(void 0)},onCancel:()=>s(void 0)})})()]})}function W(){const l=C(),[i,n]=x.useState(!0),{data:m,isPending:c,isError:u,error:r,refetch:o}=L(I()),d=t=>{const a=S[t];a&&l({to:a})};return e.jsx(T,{items:D,activeId:"labels",title:"Labels",description:"Mark mail without moving it, per account.",help:_,helpOpen:i,onToggleHelp:()=>n(t=>!t),onSelect:d,onBackToMail:()=>{l({to:"/mail"})},children:c?e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):u?e.jsx(j,{title:"Couldn't load accounts",error:r,onRetry:()=>{o()}}):m.accounts.length===0?e.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):e.jsx("div",{className:"space-y-8",children:m.accounts.map(t=>e.jsx(A,{account:t},t.accountId))})})}export{W as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as L,r as i,u as Le,j as e,S as Fe,a as pe,b as I,C as ee,d as te,e as Te,f as ge,F as De,g as Be,X as be,T as _e,O as Ke,M as Ve,A as qe,h as Qe,I as He,i as ve,B as D,k as U,l as ye,m as $e,n as je,o as Y,p as Se,q as Ne,s as We,t as G,v as J,w as Ce,x as Ue,y as Ye,z as Ge,D as $,E as Je,G as Xe,H as Ze,J as et,K as tt,L as st,N as at,P as nt,Q as rt,R as ot,U as it,V as lt,W as ct,Y as ut,Z as dt,_ as mt}from"./index-DTvNcUjW.js";import{B as xt,S as ht,D as ft,a as pt,b as gt,u as bt,s as vt,N as P,K as yt,c as jt,d as St,e as Nt,f as Ct,g as kt,i as wt}from"./search-token-index-TLbnLJHt.js";import{l as It,u as se,m as Mt}from"./search-scope-BISSOSj6.js";import{P as Ot}from"./pencil-DGrsgleB.js";import{M as Et,s as Rt,c as At}from"./search-view-Ck0UiXQG.js";import{u as Pt,a as zt,R as Lt,M as Ft}from"./useRefreshControl-BkUCSRPw.js";import{M as Tt}from"./menu-CycP4O-F.js";import{A as Dt}from"./avatar-vIu1rKIk.js";import{i as Bt}from"./outbox-status-CPfNHfUQ.js";import{E as _t}from"./ErrorState-B8aDk7g6.js";import{K as ae}from"./kbd-D0Ql6OUU.js";import{u as Kt}from"./useDebouncedValue-HsyuDdy4.js";import{w as ne}from"./intelligence-pref-C6lFpj6U.js";import"./useMediaQuery-CYQ86-Hp.js";import"./circle-check-big-D_R6-Ck3.js";const Vt=L("BookmarkPlus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"12",x2:"12",y1:"7",y2:"13",key:"1cppfj"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);const ke=L("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);const we=L("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);const Ie=L("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const qt=L("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]),Qt="button:not([disabled]), a[href]",E="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-sunken";function Ht({active:t,dimmed:s,indent:a}){return I("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors",E,a&&"pl-7",t?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg",s&&"opacity-55")}function $t({icon:t,label:s,count:a,active:n}){return e.jsxs(e.Fragment,{children:[t&&e.jsx("span",{className:I("shrink-0",n?"text-accent-2":"text-fg-subtle"),children:t}),e.jsx("span",{className:"flex-1 truncate",children:s}),a!=null&&a>0&&e.jsx("span",{className:I("text-2xs tabular-nums",n?"text-accent-2":"text-fg-subtle"),children:a})]})}function z({icon:t,label:s,count:a,active:n,dimmed:r,indent:o,navId:l,linkComponent:m,ariaLabel:x,title:p,onClick:b}){const u=Ht({active:n,dimmed:r,indent:o}),h=e.jsx($t,{icon:t,label:s,count:a,active:n});return l&&m?m({navId:l,className:u,ariaLabel:x??s,title:p,onClick:b,children:h}):e.jsx("button",{type:"button",onClick:b,className:u,"aria-label":x,title:p,children:h})}const re={inbox:0,flagged:1,drafts:2,sent:3,archive:4,all:5,junk:6,trash:7};function Wt(t){switch(t){case"inbox":return e.jsx(He,{className:"size-4"});case"flagged":return e.jsx(pe,{className:"size-4"});case"drafts":return e.jsx(Qe,{className:"size-4"});case"sent":return e.jsx(ge,{className:"size-4"});case"archive":return e.jsx(qe,{className:"size-4"});case"all":return e.jsx(Ve,{className:"size-4"});case"junk":return e.jsx(Ke,{className:"size-4"});case"trash":return e.jsx(_e,{className:"size-4"})}}const oe=t=>t.role!=null,H=8,ie="remit.nav.folders.open.",le="remit.nav.account.open.";function ce(t,s,a){if(typeof localStorage>"u")return a;const n=localStorage.getItem(t+s);return n===null?a:n!=="0"}function ue(t,s,a){typeof localStorage>"u"||localStorage.setItem(t+s,a?"1":"0")}function Ut({query:t,onSelect:s,onRemove:a}){return e.jsxs("div",{className:"group flex w-full items-center gap-1 rounded-md pr-1 hover:bg-surface",children:[e.jsxs("button",{type:"button",onClick:s,className:I("flex min-w-0 flex-1 items-center gap-2 px-2 py-1 text-left text-sm text-fg-muted transition-colors hover:text-fg",E),children:[e.jsx(Be,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t})]}),a&&e.jsx("button",{type:"button",onClick:a,"aria-label":`Remove saved search: ${t}`,className:I("shrink-0 rounded-full p-1 text-fg-subtle opacity-0 transition-opacity hover:bg-surface-sunken hover:text-fg group-hover:opacity-100 focus-visible:opacity-100",E),children:e.jsx(be,{className:"size-3.5"})})]})}function Yt({savedSearches:t,saveableQuery:s,onSelectSavedSearch:a,onRemoveSavedSearch:n,onSaveCurrentSearch:r}){return t.length===0&&!s?null:e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"px-2 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Saved searches"}),s&&e.jsxs("button",{type:"button",onClick:r,className:I("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-accent transition-colors hover:bg-surface",E),children:[e.jsx(Vt,{className:"size-4 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["Save “",s,"”"]})]}),t.map(o=>e.jsx(Ut,{query:o,onSelect:()=>a?.(o),onRemove:n?()=>n(o):void 0},o))]})}function Gt({account:t,selectedNavId:s,onSelectNav:a,linkComponent:n}){const[r,o]=i.useState(()=>ce(le,t.id,!0)),[l,m]=i.useState(()=>ce(ie,t.id,!0)),[x,p]=i.useState(!1),b=()=>{o(c=>{const y=!c;return ue(le,t.id,y),y})},u=()=>{m(c=>{const y=!c;return ue(ie,t.id,y),y})},h=t.mailboxes.filter(oe).sort((c,y)=>re[c.role]-re[y.role]),f=t.mailboxes.filter(c=>!oe(c)),v=x||f.length<=H?f:f.slice(0,H),k=f.length-v.length,g=t.status??"ready",R=g==="ready"&&h.length===0&&f.length===0;return e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",onClick:b,"aria-expanded":r,className:I("flex w-full items-center gap-1.5 px-2 pb-1 text-left transition-colors hover:text-fg",E,t.muted&&"opacity-55"),children:[r?e.jsx(ee,{className:"size-3 shrink-0 text-fg-subtle"}):e.jsx(te,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:t.label}),t.muted&&e.jsxs(e.Fragment,{children:[e.jsx(xt,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:"muted"})]})]}),r&&e.jsxs(e.Fragment,{children:[g==="loading"&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"Loading…"}),g==="error"&&e.jsxs("div",{role:"alert",className:"mx-2 my-1 flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-2 py-1.5 text-sm",children:[e.jsx(Te,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("p",{className:"font-medium text-danger",children:"Couldn't load mailboxes"})}),t.onRetry&&e.jsx("button",{type:"button",onClick:t.onRetry,className:"shrink-0 text-sm font-medium text-accent hover:underline",children:"Retry"})]}),R&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"No mailboxes"}),g==="ready"&&e.jsxs(e.Fragment,{children:[h.map(c=>e.jsx(z,{navId:c.id,linkComponent:n,icon:Wt(c.role),label:c.name,ariaLabel:c.name,title:c.fullPath??c.name,count:c.unseen,active:s===c.id,dimmed:t.muted,onClick:()=>a?.(c.id)},c.id)),t.outboxPending!==void 0&&e.jsx(z,{navId:"outbox",linkComponent:n,icon:e.jsx(ge,{className:"size-4"}),label:"Outbox",ariaLabel:"Outbox",count:t.outboxPending>0?t.outboxPending:void 0,active:s==="outbox",dimmed:t.muted,onClick:()=>a?.("outbox")}),f.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:u,"aria-expanded":l,className:I("mt-1 flex w-full items-center gap-1 px-2 py-1 text-left text-2xs font-semibold uppercase tracking-wider text-fg-subtle transition-colors hover:text-fg",E),children:[l?e.jsx(ee,{className:"size-3 shrink-0"}):e.jsx(te,{className:"size-3 shrink-0"}),e.jsx("span",{className:"flex-1",children:"Folders"}),e.jsx("span",{className:"tabular-nums opacity-70",children:f.length})]}),l&&e.jsxs(e.Fragment,{children:[v.map(c=>e.jsx(z,{navId:c.id,linkComponent:n,icon:e.jsx(De,{className:"size-4"}),label:c.name,ariaLabel:c.name,title:c.fullPath??c.name,count:c.unseen,active:s===c.id,dimmed:t.muted,onClick:()=>a?.(c.id)},c.id)),(k>0||x)&&f.length>H&&e.jsx("button",{type:"button",onClick:()=>p(c=>!c),className:I("ml-7 flex items-center px-2 py-1 text-2xs font-medium text-accent transition-colors hover:underline",E),children:x?"Show less":`Show all (${f.length})`})]})]})]})]})]})}function Jt({accounts:t,selectedNavId:s,briefUnseen:a,onSelectNav:n,variant:r="desktop",linkComponent:o,savedSearches:l=[],saveableQuery:m,onSelectSavedSearch:x,onRemoveSavedSearch:p,onSaveCurrentSearch:b}){const u=i.useRef(null);Le({containerRef:u,itemSelector:Qt});const h=r==="drawer",f=e.jsxs("nav",{ref:h?u:void 0,className:h?"px-2 py-2":"flex-1 overflow-y-auto px-2 py-2","aria-label":"Mailboxes",children:[e.jsx(z,{navId:"brief",linkComponent:o,icon:e.jsx(Fe,{className:"size-4"}),label:"Daily brief",ariaLabel:"Daily brief",count:a,active:s==="brief",onClick:()=>n?.("brief")}),e.jsx(z,{navId:"flagged",linkComponent:o,icon:e.jsx(pe,{className:"size-4"}),label:"Starred",ariaLabel:"Starred",active:s==="flagged",onClick:()=>n?.("flagged")}),e.jsx(Yt,{savedSearches:l,saveableQuery:m,onSelectSavedSearch:x,onRemoveSavedSearch:p,onSaveCurrentSearch:b}),t.length===0?e.jsx("div",{className:"px-2 py-4 text-center text-sm text-fg-muted",children:"No accounts configured"}):t.map(v=>e.jsx(Gt,{account:v,selectedNavId:s,onSelectNav:n,linkComponent:o},v.id))]});return h?f:e.jsx("aside",{ref:u,className:"flex h-full w-full flex-col bg-surface-sunken",children:f})}function Xt({leading:t,search:s,actions:a,className:n}){return e.jsxs("header",{className:I("flex min-h-pane-header w-full shrink-0 items-center gap-2 border-b border-line bg-canvas px-row-inset py-1",n),children:[t&&e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:t}),e.jsx("div",{className:"flex min-w-0 flex-1 justify-start",children:e.jsx("div",{className:"w-full max-w-xs transition-[max-width] duration-150 ease-out focus-within:max-w-lg",children:s})}),a&&e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:a})]})}function Zt(){const t=ve();if(!t)return null;const s=t.showNavPane?!t.navCollapsed:!1;return e.jsx(D,{variant:"ghost",size:"sm",icon:e.jsx(Tt,{className:"size-4"}),onClick:t.toggleNav,"aria-label":s?"Hide folders":"Show folders","aria-expanded":s,title:"Folders",className:"shrink-0"})}const es={global:"Search all mail",pending:"Search mail",scoped:"Search this folder"};function ts({search:t,onCompose:s,onReportBug:a,onOpenSettings:n,composeShortcut:r,refreshControl:o,account:l}){return e.jsx(Xt,{leading:e.jsx(Zt,{}),search:e.jsx(ht,{value:t.value,onChange:t.onChange,onClear:t.onClear,onClearQuery:t.onClearQuery,chips:t.chips,onRemoveChip:t.onRemoveChip,placeholder:es[t.scope]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(D,{variant:"ghost",size:"sm",icon:e.jsx(qt,{className:"size-4"}),title:r?`Compose (${r})`:"Compose","aria-label":"Compose",onClick:s}),e.jsx(D,{variant:"ghost",size:"sm",icon:e.jsx(ke,{className:"size-4"}),title:"Report a bug","aria-label":"Report a bug",onClick:a}),e.jsx(D,{variant:"ghost",size:"sm",icon:e.jsx(Ie,{className:"size-4"}),title:"Settings","aria-label":"Settings",onClick:n}),o,l]})})}const ss=()=>{const{state:t,openCompose:s}=U(),a=ye(),n=i.useCallback(()=>{s({mode:"new"})},[s]),o=!!a.search?.selectedMessageId||It(a.pathname);return!a.pathname.startsWith("/mail")||t.isOpen||o?null:e.jsx("button",{type:"button",onClick:n,"aria-label":"Compose new message",className:"lg:hidden fixed right-4 z-30 h-14 w-14 rounded-full bg-accent text-accent-fg shadow-lg flex items-center justify-center hover:opacity-90 active:scale-95 transition-all",style:{bottom:"calc(env(safe-area-inset-bottom, 0) + 1rem)"},children:e.jsx(Ot,{className:"size-6"})})},Me=({children:t})=>{const{Account:s}=$e();return e.jsx(s,{children:t})},as=({email:t,onSignOut:s})=>{const a=t??"Account";return e.jsxs(ft,{trigger:e.jsx(Dt,{name:a,email:t??void 0,size:"sm"}),align:"right",children:[t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 py-2 text-xs text-fg-muted truncate",title:t,"data-testid":"account-menu-email",children:t}),e.jsx(pt,{})]}),e.jsxs(gt,{onClick:s,children:[e.jsx(we,{className:"size-4"}),"Sign out"]})]})},ns=()=>e.jsx(Me,{children:({email:t,signOut:s})=>e.jsx(as,{email:t,onSignOut:s})});function rs({accounts:t}){const{searchInput:s,onSearchChange:a,onSearchClear:n,onSearchClearQuery:r}=je(),o=Y(),{openCompose:l}=U(),m=i.useCallback(()=>{l({mode:"new"})},[l]),{scope:x,clearScope:p}=bt(t),b=x.kind==="scoped"?[{id:x.chip.id,label:x.chip.label,tone:"scope"}]:void 0,u=i.useMemo(()=>t.map(g=>g.accountId),[t]),{hasNewMail:h}=Pt(),{state:f,errorMessage:v,refresh:k}=zt(u);return e.jsx(ts,{search:{value:s,scope:x.kind,chips:b,onChange:a,onClear:n,onClearQuery:r,onRemoveChip:p},onCompose:m,onReportBug:Se,onOpenSettings:()=>o({to:"/settings/accounts"}),composeShortcut:vt("compose"),refreshControl:e.jsx(Lt,{state:f,onRefresh:k,label:"Refresh all accounts",errorMessage:v,hasUpdate:h(u)}),account:e.jsx(ns,{})})}const X="remit.savedSearches",os=25;function _(){try{const t=localStorage.getItem(X);if(!t)return[];const s=JSON.parse(t);return Array.isArray(s)?s.filter(a=>typeof a=="string"):[]}catch{return[]}}function is(t){const s=t.trim();if(!s)return _();const a=[s,..._().filter(n=>n!==s)].slice(0,os);try{localStorage.setItem(X,JSON.stringify(a))}catch{return a}return a}function ls(t){const s=_().filter(a=>a!==t);try{localStorage.setItem(X,JSON.stringify(s))}catch{return s}return s}const de=t=>/^\d/.test(t),cs=(t,s)=>{const a=de(t),n=de(s);return a&&!n?-1:!a&&n?1:t.localeCompare(s,void 0,{sensitivity:"base",numeric:!0})};function us(t,s,a){const n=[],r=[];for(const o of t)s.has(o.mailboxId)?n.push(o):r.push(o);return r.sort((o,l)=>cs($(o,void 0,a),$(l,void 0,a))),{system:n,labels:r}}function ds(t,s,a){const n=Je(s)&&t.unseenCount>0;return{id:t.mailboxId,name:$(t,s,a),unseen:n?t.unseenCount:void 0,role:s,fullPath:t.fullPath}}function ms(){const t=ye(),s=Ge({strict:!1});return t.pathname.startsWith("/settings")?"settings":t.pathname.startsWith("/mail/outbox")?"outbox":t.pathname.startsWith("/mail/flagged")?"flagged":t.pathname.startsWith("/mail/brief")?"brief":s.mailboxId?s.mailboxId:""}function me({accounts:t,onMailboxSelect:s,variant:a="desktop"}){const n=Ne(),r=Y(),o=ms(),{searchInput:l,onSearchChange:m}=je(),[x,p]=i.useState(_),{t:b}=We("mail",{useSuspense:!1}),u=i.useCallback((d,S)=>b(d,{defaultValue:S}),[b]),h=G({queries:t.map(d=>({...J({path:{accountId:d.accountId}}),staleTime:1/0}))}),{data:f}=Ce(Ue()),v=i.useMemo(()=>(f?.items??[]).filter(d=>Bt(d.status)).length,[f?.items]),k=i.useMemo(()=>t.map((d,S)=>{const N=h[S],M=N?.data?.items??[],w=Ye(d.folderAppointments),{system:O,labels:Q}=us(M,w,u),C=N?.isError?"error":N?.isLoading?"loading":"ready";return{id:d.accountId,label:d.email,email:d.email,muted:!!d.muted,outboxPending:v,status:C,onRetry:()=>N?.refetch(),mailboxes:[...O,...Q].map(F=>ds(F,w.get(F.mailboxId),u))}}),[t,h,v,u]),g=d=>{n.invalidateQueries({queryKey:Xe({path:{mailboxId:d},query:{order:"desc"}})})},R=({navId:d,className:S,ariaLabel:N,title:M,children:w,onClick:O})=>d==="brief"?e.jsx(P,{to:"/mail/brief",search:{q:void 0},activeOptions:{includeSearch:!1},onClick:()=>O?.(),className:S,"aria-label":N,title:M,children:w}):d==="outbox"?e.jsx(P,{to:"/mail/outbox",search:{q:void 0,selectedOutboxMessageId:void 0},onClick:()=>O?.(),className:S,"aria-label":N,title:M,children:w}):d==="flagged"?e.jsx(P,{to:"/mail/flagged",search:{q:void 0,selectedMessageId:void 0},onClick:()=>O?.(),className:S,"aria-label":N,title:M,children:w}):d==="settings"?e.jsx(P,{to:"/settings/accounts",onClick:()=>O?.(),className:S,"aria-label":N,title:M,children:w}):e.jsx(P,{to:"/mail/$mailboxId",params:{mailboxId:d},search:{q:void 0,selectedMessageId:void 0},onClick:()=>{g(d),O?.()},className:S,"aria-label":N,title:M,children:w}),c=()=>{m(""),s?.()},y=l.trim(),A=y.length>0&&!x.includes(y)?y:void 0,K=i.useCallback(()=>{A&&p(is(A))},[A]),V=i.useCallback(d=>{p(ls(d))},[]),q=i.useCallback(d=>{m(d),r({to:"/mail/brief",search:{q:d}}),s?.()},[m,r,s]);return e.jsx(Jt,{accounts:k,selectedNavId:o,onSelectNav:c,linkComponent:R,variant:a,savedSearches:x,saveableQuery:A,onSaveCurrentSearch:K,onSelectSavedSearch:q,onRemoveSavedSearch:V})}function xs(){return e.jsxs("button",{type:"button",onClick:Se,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg",children:[e.jsx(ke,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Report a bug"})]})}function hs({accounts:t,onMailboxSelect:s}){return ve()?.showNavPane??!0?e.jsx(me,{accounts:t}):e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(me,{accounts:t,onMailboxSelect:s,variant:"drawer"})}),e.jsxs("div",{className:"border-t border-line px-2 py-2",children:[e.jsxs(P,{to:"/settings/accounts",onClick:s,children:[e.jsx(Ie,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Settings"})]}),e.jsx(xs,{}),e.jsx(Me,{children:({signOut:r})=>e.jsxs("button",{type:"button",onClick:()=>{s?.(),r()},className:"flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg","data-testid":"sign-out-button",children:[e.jsx(we,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Sign out"})]})})]})]})}const fs=({isOpen:t,onClose:s})=>{const a=i.useCallback(n=>{n.key==="Escape"&&(n.preventDefault(),s())},[s]);return i.useEffect(()=>{if(t)return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[t,a]),t?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx(Ze,{label:"Dismiss keyboard shortcuts",onDismiss:s,className:"backdrop-blur-sm"}),e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Keyboard shortcuts",className:et("relative z-10 max-h-[85vh] w-full max-w-2xl overflow-y-auto","rounded-lg border border-line bg-surface shadow-lg","p-6"),children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Keyboard shortcuts"}),e.jsx("button",{type:"button",onClick:s,className:"p-1 text-fg-muted transition-colors hover:text-fg","aria-label":"Close",children:e.jsx(be,{className:"size-5"})})]}),e.jsx("div",{className:"grid gap-x-8 gap-y-6 sm:grid-cols-2",children:yt.map(n=>e.jsxs("div",{children:[e.jsx("h3",{className:"mb-3 text-sm font-medium text-fg-muted",children:n.title}),e.jsx("div",{className:"space-y-2",children:n.hints.map(r=>e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("span",{className:"text-sm",children:r.description}),e.jsx("span",{className:"flex shrink-0 items-center gap-1",children:r.keys.map((o,l)=>e.jsxs(i.Fragment,{children:[l>0&&r.keys[0]==="g"&&e.jsx("span",{className:"text-2xs text-fg-subtle",children:"then"}),e.jsx(ae,{children:o})]},o))})]},`${r.action}-${r.keys.join("+")}`))})]},n.title))}),e.jsx("div",{className:"mt-6 border-t border-line pt-4",children:e.jsxs("p",{className:"text-center text-xs text-fg-muted",children:["Press ",e.jsx(ae,{children:"Esc"})," to close"]})})]})]}):null};function ps(t){const s=G({queries:t.map(a=>({...J({path:{accountId:a.accountId}}),staleTime:1/0}))});return i.useMemo(()=>jt(s.map(a=>a.data?.items??[])),[s])}const gs=t=>t.map(s=>s.data?.items??[]);function bs(t){const s=G({queries:t.map(a=>({...J({path:{accountId:a.accountId}}),staleTime:1/0})),combine:gs});return i.useMemo(()=>tt(t.map((a,n)=>({folderAppointments:a.folderAppointments,mailboxes:s[n]??[]}))),[t,s])}var T={exports:{}},xe;function vs(){if(xe)return T.exports;xe=1;const t=(s,a,n)=>new Promise((r,o)=>{if(n=Object.assign({concurrency:1/0},n),typeof a!="function")throw new TypeError("Mapper function is required");const{concurrency:l}=n;if(!(typeof l=="number"&&l>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${l}\` (${typeof l})`);const m=[],x=s[Symbol.iterator]();let p=!1,b=!1,u=0,h=0;const f=()=>{if(p)return;const v=x.next(),k=h;if(h++,v.done){b=!0,u===0&&r(m);return}u++,Promise.resolve(v.value).then(g=>a(g,k)).then(g=>{m[k]=g,u--,f()},g=>{p=!0,o(g)})};for(let v=0;v<l&&(f(),!b);v++);});return T.exports=t,T.exports.default=t,T.exports}var ys=vs();const js=st(ys),Ss=900*1e3,Ns=300,Cs=(t,s)=>{if(!t)return s;const a=Number.parseInt(t,10);return Number.isFinite(a)&&a>0?a:s},ks=60*1e3,ws=t=>Math.max(Cs(t,Ns)*1e3,ks),B=ws(it().mailboxPollIntervalSeconds),Is=5,W=new Set,Ms=(t,s,a=Ss)=>t.filter(n=>{const r=n.lastSyncAt;return r==null?!0:s-r>a}).map(n=>n.accountId),Os=(t,s,a=B)=>t-s>=a,Es=(t,s)=>t.filter(a=>!s.has(a)),he=(t,s)=>{if(W.delete(t),rt(s,{softError:!0})){ot(s);return}console.warn("[remit] background mailbox sync failed",{accountId:t,error:s})},fe=(t,s)=>at({path:{accountId:t},throwOnError:!0}).then(()=>{s.invalidateQueries({queryKey:nt({path:{accountId:t}})})}),Rs=t=>{const s=Ne(),a=i.useRef(t);a.current=t;const n=t.map(r=>r.accountId).join(",");i.useEffect(()=>{const r=Date.now(),l=Ms(a.current,r).filter(m=>!W.has(m));if(l.length!==0)for(const m of l)W.add(m),fe(m,s).catch(x=>{he(m,x)})},[n,s]),i.useEffect(()=>{let r=Date.now(),o;const l=new Set,m=()=>{r=Date.now();const b=Es(a.current.map(u=>u.accountId),l);for(const u of b)l.add(u);js(b,u=>fe(u,s).catch(h=>{he(u,h)}).finally(()=>{l.delete(u)}),{concurrency:Is})},x=()=>{if(document.visibilityState==="visible"){m(),o=setTimeout(x,B);return}},p=()=>{document.visibilityState==="visible"&&Os(Date.now(),r)&&(o!==void 0&&clearTimeout(o),m(),o=setTimeout(x,B))};return o=setTimeout(x,B),document.addEventListener("visibilitychange",p),()=>{o!==void 0&&clearTimeout(o),document.removeEventListener("visibilitychange",p)}},[n,s])};function Ws(){const{q:t=""}=lt({from:"/mail"}),s=Y(),a=St(),n=wt(a),[r,o]=i.useState(!1),[l,m]=i.useState(!1),[x,p]=i.useState(!1),b=i.useCallback(j=>{p(j),ne(j)},[]),[u,h]=i.useState(t),f=Kt(u,200),v=At(u,f),k=se({select:j=>j.location.pathname}),g=se({select:j=>Mt(j.matches)}),[R,c]=i.useState(g);if(R!==g){const j=Rt(R,g,t);c(g),j!==void 0&&h(j)}const{data:y,isLoading:A,isError:K,error:V,refetch:q}=Ce({...ct(),staleTime:1/0}),d=!!(y&&(y.accounts?.length??0)===0);i.useEffect(()=>{d&&s({to:"/onboarding",replace:!0})},[d,s]),Nt({enabled:!r,bindings:[{key:"?",handler:()=>o(!0),noModifiers:!1,preventDefault:!0}]});const{openCompose:S}=U(),N=i.useMemo(()=>({compose:()=>S({mode:"new"})}),[S]);Ct({enabled:!ut(k),handlers:N});const M=i.useCallback(j=>{h(j)},[]),w=i.useCallback(()=>{h("")},[]),O=i.useCallback(()=>{h("")},[]),Q=i.useCallback(()=>{p(j=>{const Z=!j;return ne(Z),Z})},[]),C=y?.accounts??[],F=i.useMemo(()=>C.map(j=>j.accountId),[C]),Oe=ps(C),Ee=bs(C),Re=i.useMemo(()=>kt(C),[C]);Rs(C);const Ae=i.useCallback(()=>{m(!1)},[]),Pe={accounts:C,mailboxNameIndex:Oe,accountNameIndex:Re,resultFolderIndex:Ee,searchQuery:v,searchInput:u,searchViewKey:g,onSearchChange:M,onSearchClear:w,onSearchClearQuery:O,intelligenceOpen:x,onToggleIntelligence:Q,onSetIntelligenceOpen:b},ze={isSinglePane:n,isLoading:A||d,intelligenceOpen:x,nav:e.jsx(hs,{accounts:C,onMailboxSelect:Ae}),topBar:n?void 0:e.jsx(rs,{accounts:C}),overlay:n?e.jsx(ss,{}):void 0,navOpen:l,onOpenNav:()=>m(!0),onCloseNav:()=>m(!1)};return e.jsx(dt.Provider,{value:Pe,children:e.jsxs(Ft,{accountIds:F,children:[K?e.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:e.jsx(_t,{title:"Couldn't load your account",error:V,onRetry:()=>{q()}})}):e.jsx(Et,{chrome:ze,children:e.jsx(mt,{})}),e.jsx(fs,{isOpen:r,onClose:()=>o(!1)})]})})}export{Ws as component,je as useMailContext};
|
|
1
|
+
import{c as L,r as i,u as Le,j as e,S as Fe,a as pe,b as I,C as ee,d as te,e as Te,f as ge,F as De,g as Be,X as be,T as _e,O as Ke,M as Ve,A as qe,h as Qe,I as He,i as ve,B as D,k as U,l as ye,m as $e,n as je,o as Y,p as Se,q as Ne,s as We,t as G,v as J,w as Ce,x as Ue,y as Ye,z as Ge,D as $,E as Je,G as Xe,H as Ze,J as et,K as tt,L as st,N as at,P as nt,Q as rt,R as ot,U as it,V as lt,W as ct,Y as ut,Z as dt,_ as mt}from"./index-3eAE16lF.js";import{B as xt,S as ht,D as ft,a as pt,b as gt,u as bt,s as vt,N as P,K as yt,c as jt,d as St,e as Nt,f as Ct,g as kt,i as wt}from"./search-token-index-XT09xk5-.js";import{l as It,u as se,m as Mt}from"./search-scope-Bcn1kzwd.js";import{P as Ot}from"./pencil-6AbAHB79.js";import{M as Et,s as Rt,c as At}from"./search-view-BtUa3wf0.js";import{u as Pt,a as zt,R as Lt,M as Ft}from"./useRefreshControl-DivGdE-V.js";import{M as Tt}from"./menu-B3HPQBVa.js";import{A as Dt}from"./avatar-B5Xfa_Aj.js";import{i as Bt}from"./outbox-status-CPfNHfUQ.js";import{E as _t}from"./ErrorState-By22X09V.js";import{K as ae}from"./kbd-BVVVI8MK.js";import{u as Kt}from"./useDebouncedValue-nan84ZZT.js";import{w as ne}from"./intelligence-pref-C6lFpj6U.js";import"./useMediaQuery-vS62WMhd.js";import"./circle-check-big-Dm9DZK8n.js";const Vt=L("BookmarkPlus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"12",x2:"12",y1:"7",y2:"13",key:"1cppfj"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);const ke=L("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);const we=L("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);const Ie=L("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const qt=L("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]),Qt="button:not([disabled]), a[href]",E="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-sunken";function Ht({active:t,dimmed:s,indent:a}){return I("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors",E,a&&"pl-7",t?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg",s&&"opacity-55")}function $t({icon:t,label:s,count:a,active:n}){return e.jsxs(e.Fragment,{children:[t&&e.jsx("span",{className:I("shrink-0",n?"text-accent-2":"text-fg-subtle"),children:t}),e.jsx("span",{className:"flex-1 truncate",children:s}),a!=null&&a>0&&e.jsx("span",{className:I("text-2xs tabular-nums",n?"text-accent-2":"text-fg-subtle"),children:a})]})}function z({icon:t,label:s,count:a,active:n,dimmed:r,indent:o,navId:l,linkComponent:m,ariaLabel:x,title:p,onClick:b}){const u=Ht({active:n,dimmed:r,indent:o}),h=e.jsx($t,{icon:t,label:s,count:a,active:n});return l&&m?m({navId:l,className:u,ariaLabel:x??s,title:p,onClick:b,children:h}):e.jsx("button",{type:"button",onClick:b,className:u,"aria-label":x,title:p,children:h})}const re={inbox:0,flagged:1,drafts:2,sent:3,archive:4,all:5,junk:6,trash:7};function Wt(t){switch(t){case"inbox":return e.jsx(He,{className:"size-4"});case"flagged":return e.jsx(pe,{className:"size-4"});case"drafts":return e.jsx(Qe,{className:"size-4"});case"sent":return e.jsx(ge,{className:"size-4"});case"archive":return e.jsx(qe,{className:"size-4"});case"all":return e.jsx(Ve,{className:"size-4"});case"junk":return e.jsx(Ke,{className:"size-4"});case"trash":return e.jsx(_e,{className:"size-4"})}}const oe=t=>t.role!=null,H=8,ie="remit.nav.folders.open.",le="remit.nav.account.open.";function ce(t,s,a){if(typeof localStorage>"u")return a;const n=localStorage.getItem(t+s);return n===null?a:n!=="0"}function ue(t,s,a){typeof localStorage>"u"||localStorage.setItem(t+s,a?"1":"0")}function Ut({query:t,onSelect:s,onRemove:a}){return e.jsxs("div",{className:"group flex w-full items-center gap-1 rounded-md pr-1 hover:bg-surface",children:[e.jsxs("button",{type:"button",onClick:s,className:I("flex min-w-0 flex-1 items-center gap-2 px-2 py-1 text-left text-sm text-fg-muted transition-colors hover:text-fg",E),children:[e.jsx(Be,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t})]}),a&&e.jsx("button",{type:"button",onClick:a,"aria-label":`Remove saved search: ${t}`,className:I("shrink-0 rounded-full p-1 text-fg-subtle opacity-0 transition-opacity hover:bg-surface-sunken hover:text-fg group-hover:opacity-100 focus-visible:opacity-100",E),children:e.jsx(be,{className:"size-3.5"})})]})}function Yt({savedSearches:t,saveableQuery:s,onSelectSavedSearch:a,onRemoveSavedSearch:n,onSaveCurrentSearch:r}){return t.length===0&&!s?null:e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"px-2 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Saved searches"}),s&&e.jsxs("button",{type:"button",onClick:r,className:I("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-accent transition-colors hover:bg-surface",E),children:[e.jsx(Vt,{className:"size-4 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["Save “",s,"”"]})]}),t.map(o=>e.jsx(Ut,{query:o,onSelect:()=>a?.(o),onRemove:n?()=>n(o):void 0},o))]})}function Gt({account:t,selectedNavId:s,onSelectNav:a,linkComponent:n}){const[r,o]=i.useState(()=>ce(le,t.id,!0)),[l,m]=i.useState(()=>ce(ie,t.id,!0)),[x,p]=i.useState(!1),b=()=>{o(c=>{const y=!c;return ue(le,t.id,y),y})},u=()=>{m(c=>{const y=!c;return ue(ie,t.id,y),y})},h=t.mailboxes.filter(oe).sort((c,y)=>re[c.role]-re[y.role]),f=t.mailboxes.filter(c=>!oe(c)),v=x||f.length<=H?f:f.slice(0,H),k=f.length-v.length,g=t.status??"ready",R=g==="ready"&&h.length===0&&f.length===0;return e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",onClick:b,"aria-expanded":r,className:I("flex w-full items-center gap-1.5 px-2 pb-1 text-left transition-colors hover:text-fg",E,t.muted&&"opacity-55"),children:[r?e.jsx(ee,{className:"size-3 shrink-0 text-fg-subtle"}):e.jsx(te,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:t.label}),t.muted&&e.jsxs(e.Fragment,{children:[e.jsx(xt,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:"muted"})]})]}),r&&e.jsxs(e.Fragment,{children:[g==="loading"&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"Loading…"}),g==="error"&&e.jsxs("div",{role:"alert",className:"mx-2 my-1 flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-2 py-1.5 text-sm",children:[e.jsx(Te,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("p",{className:"font-medium text-danger",children:"Couldn't load mailboxes"})}),t.onRetry&&e.jsx("button",{type:"button",onClick:t.onRetry,className:"shrink-0 text-sm font-medium text-accent hover:underline",children:"Retry"})]}),R&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"No mailboxes"}),g==="ready"&&e.jsxs(e.Fragment,{children:[h.map(c=>e.jsx(z,{navId:c.id,linkComponent:n,icon:Wt(c.role),label:c.name,ariaLabel:c.name,title:c.fullPath??c.name,count:c.unseen,active:s===c.id,dimmed:t.muted,onClick:()=>a?.(c.id)},c.id)),t.outboxPending!==void 0&&e.jsx(z,{navId:"outbox",linkComponent:n,icon:e.jsx(ge,{className:"size-4"}),label:"Outbox",ariaLabel:"Outbox",count:t.outboxPending>0?t.outboxPending:void 0,active:s==="outbox",dimmed:t.muted,onClick:()=>a?.("outbox")}),f.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:u,"aria-expanded":l,className:I("mt-1 flex w-full items-center gap-1 px-2 py-1 text-left text-2xs font-semibold uppercase tracking-wider text-fg-subtle transition-colors hover:text-fg",E),children:[l?e.jsx(ee,{className:"size-3 shrink-0"}):e.jsx(te,{className:"size-3 shrink-0"}),e.jsx("span",{className:"flex-1",children:"Folders"}),e.jsx("span",{className:"tabular-nums opacity-70",children:f.length})]}),l&&e.jsxs(e.Fragment,{children:[v.map(c=>e.jsx(z,{navId:c.id,linkComponent:n,icon:e.jsx(De,{className:"size-4"}),label:c.name,ariaLabel:c.name,title:c.fullPath??c.name,count:c.unseen,active:s===c.id,dimmed:t.muted,onClick:()=>a?.(c.id)},c.id)),(k>0||x)&&f.length>H&&e.jsx("button",{type:"button",onClick:()=>p(c=>!c),className:I("ml-7 flex items-center px-2 py-1 text-2xs font-medium text-accent transition-colors hover:underline",E),children:x?"Show less":`Show all (${f.length})`})]})]})]})]})]})}function Jt({accounts:t,selectedNavId:s,briefUnseen:a,onSelectNav:n,variant:r="desktop",linkComponent:o,savedSearches:l=[],saveableQuery:m,onSelectSavedSearch:x,onRemoveSavedSearch:p,onSaveCurrentSearch:b}){const u=i.useRef(null);Le({containerRef:u,itemSelector:Qt});const h=r==="drawer",f=e.jsxs("nav",{ref:h?u:void 0,className:h?"px-2 py-2":"flex-1 overflow-y-auto px-2 py-2","aria-label":"Mailboxes",children:[e.jsx(z,{navId:"brief",linkComponent:o,icon:e.jsx(Fe,{className:"size-4"}),label:"Daily brief",ariaLabel:"Daily brief",count:a,active:s==="brief",onClick:()=>n?.("brief")}),e.jsx(z,{navId:"flagged",linkComponent:o,icon:e.jsx(pe,{className:"size-4"}),label:"Starred",ariaLabel:"Starred",active:s==="flagged",onClick:()=>n?.("flagged")}),e.jsx(Yt,{savedSearches:l,saveableQuery:m,onSelectSavedSearch:x,onRemoveSavedSearch:p,onSaveCurrentSearch:b}),t.length===0?e.jsx("div",{className:"px-2 py-4 text-center text-sm text-fg-muted",children:"No accounts configured"}):t.map(v=>e.jsx(Gt,{account:v,selectedNavId:s,onSelectNav:n,linkComponent:o},v.id))]});return h?f:e.jsx("aside",{ref:u,className:"flex h-full w-full flex-col bg-surface-sunken",children:f})}function Xt({leading:t,search:s,actions:a,className:n}){return e.jsxs("header",{className:I("flex min-h-pane-header w-full shrink-0 items-center gap-2 border-b border-line bg-canvas px-row-inset py-1",n),children:[t&&e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:t}),e.jsx("div",{className:"flex min-w-0 flex-1 justify-start",children:e.jsx("div",{className:"w-full max-w-xs transition-[max-width] duration-150 ease-out focus-within:max-w-lg",children:s})}),a&&e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:a})]})}function Zt(){const t=ve();if(!t)return null;const s=t.showNavPane?!t.navCollapsed:!1;return e.jsx(D,{variant:"ghost",size:"sm",icon:e.jsx(Tt,{className:"size-4"}),onClick:t.toggleNav,"aria-label":s?"Hide folders":"Show folders","aria-expanded":s,title:"Folders",className:"shrink-0"})}const es={global:"Search all mail",pending:"Search mail",scoped:"Search this folder"};function ts({search:t,onCompose:s,onReportBug:a,onOpenSettings:n,composeShortcut:r,refreshControl:o,account:l}){return e.jsx(Xt,{leading:e.jsx(Zt,{}),search:e.jsx(ht,{value:t.value,onChange:t.onChange,onClear:t.onClear,onClearQuery:t.onClearQuery,chips:t.chips,onRemoveChip:t.onRemoveChip,placeholder:es[t.scope]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(D,{variant:"ghost",size:"sm",icon:e.jsx(qt,{className:"size-4"}),title:r?`Compose (${r})`:"Compose","aria-label":"Compose",onClick:s}),e.jsx(D,{variant:"ghost",size:"sm",icon:e.jsx(ke,{className:"size-4"}),title:"Report a bug","aria-label":"Report a bug",onClick:a}),e.jsx(D,{variant:"ghost",size:"sm",icon:e.jsx(Ie,{className:"size-4"}),title:"Settings","aria-label":"Settings",onClick:n}),o,l]})})}const ss=()=>{const{state:t,openCompose:s}=U(),a=ye(),n=i.useCallback(()=>{s({mode:"new"})},[s]),o=!!a.search?.selectedMessageId||It(a.pathname);return!a.pathname.startsWith("/mail")||t.isOpen||o?null:e.jsx("button",{type:"button",onClick:n,"aria-label":"Compose new message",className:"lg:hidden fixed right-4 z-30 h-14 w-14 rounded-full bg-accent text-accent-fg shadow-lg flex items-center justify-center hover:opacity-90 active:scale-95 transition-all",style:{bottom:"calc(env(safe-area-inset-bottom, 0) + 1rem)"},children:e.jsx(Ot,{className:"size-6"})})},Me=({children:t})=>{const{Account:s}=$e();return e.jsx(s,{children:t})},as=({email:t,onSignOut:s})=>{const a=t??"Account";return e.jsxs(ft,{trigger:e.jsx(Dt,{name:a,email:t??void 0,size:"sm"}),align:"right",children:[t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 py-2 text-xs text-fg-muted truncate",title:t,"data-testid":"account-menu-email",children:t}),e.jsx(pt,{})]}),e.jsxs(gt,{onClick:s,children:[e.jsx(we,{className:"size-4"}),"Sign out"]})]})},ns=()=>e.jsx(Me,{children:({email:t,signOut:s})=>e.jsx(as,{email:t,onSignOut:s})});function rs({accounts:t}){const{searchInput:s,onSearchChange:a,onSearchClear:n,onSearchClearQuery:r}=je(),o=Y(),{openCompose:l}=U(),m=i.useCallback(()=>{l({mode:"new"})},[l]),{scope:x,clearScope:p}=bt(t),b=x.kind==="scoped"?[{id:x.chip.id,label:x.chip.label,tone:"scope"}]:void 0,u=i.useMemo(()=>t.map(g=>g.accountId),[t]),{hasNewMail:h}=Pt(),{state:f,errorMessage:v,refresh:k}=zt(u);return e.jsx(ts,{search:{value:s,scope:x.kind,chips:b,onChange:a,onClear:n,onClearQuery:r,onRemoveChip:p},onCompose:m,onReportBug:Se,onOpenSettings:()=>o({to:"/settings/accounts"}),composeShortcut:vt("compose"),refreshControl:e.jsx(Lt,{state:f,onRefresh:k,label:"Refresh all accounts",errorMessage:v,hasUpdate:h(u)}),account:e.jsx(ns,{})})}const X="remit.savedSearches",os=25;function _(){try{const t=localStorage.getItem(X);if(!t)return[];const s=JSON.parse(t);return Array.isArray(s)?s.filter(a=>typeof a=="string"):[]}catch{return[]}}function is(t){const s=t.trim();if(!s)return _();const a=[s,..._().filter(n=>n!==s)].slice(0,os);try{localStorage.setItem(X,JSON.stringify(a))}catch{return a}return a}function ls(t){const s=_().filter(a=>a!==t);try{localStorage.setItem(X,JSON.stringify(s))}catch{return s}return s}const de=t=>/^\d/.test(t),cs=(t,s)=>{const a=de(t),n=de(s);return a&&!n?-1:!a&&n?1:t.localeCompare(s,void 0,{sensitivity:"base",numeric:!0})};function us(t,s,a){const n=[],r=[];for(const o of t)s.has(o.mailboxId)?n.push(o):r.push(o);return r.sort((o,l)=>cs($(o,void 0,a),$(l,void 0,a))),{system:n,labels:r}}function ds(t,s,a){const n=Je(s)&&t.unseenCount>0;return{id:t.mailboxId,name:$(t,s,a),unseen:n?t.unseenCount:void 0,role:s,fullPath:t.fullPath}}function ms(){const t=ye(),s=Ge({strict:!1});return t.pathname.startsWith("/settings")?"settings":t.pathname.startsWith("/mail/outbox")?"outbox":t.pathname.startsWith("/mail/flagged")?"flagged":t.pathname.startsWith("/mail/brief")?"brief":s.mailboxId?s.mailboxId:""}function me({accounts:t,onMailboxSelect:s,variant:a="desktop"}){const n=Ne(),r=Y(),o=ms(),{searchInput:l,onSearchChange:m}=je(),[x,p]=i.useState(_),{t:b}=We("mail",{useSuspense:!1}),u=i.useCallback((d,S)=>b(d,{defaultValue:S}),[b]),h=G({queries:t.map(d=>({...J({path:{accountId:d.accountId}}),staleTime:1/0}))}),{data:f}=Ce(Ue()),v=i.useMemo(()=>(f?.items??[]).filter(d=>Bt(d.status)).length,[f?.items]),k=i.useMemo(()=>t.map((d,S)=>{const N=h[S],M=N?.data?.items??[],w=Ye(d.folderAppointments),{system:O,labels:Q}=us(M,w,u),C=N?.isError?"error":N?.isLoading?"loading":"ready";return{id:d.accountId,label:d.email,email:d.email,muted:!!d.muted,outboxPending:v,status:C,onRetry:()=>N?.refetch(),mailboxes:[...O,...Q].map(F=>ds(F,w.get(F.mailboxId),u))}}),[t,h,v,u]),g=d=>{n.invalidateQueries({queryKey:Xe({path:{mailboxId:d},query:{order:"desc"}})})},R=({navId:d,className:S,ariaLabel:N,title:M,children:w,onClick:O})=>d==="brief"?e.jsx(P,{to:"/mail/brief",search:{q:void 0},activeOptions:{includeSearch:!1},onClick:()=>O?.(),className:S,"aria-label":N,title:M,children:w}):d==="outbox"?e.jsx(P,{to:"/mail/outbox",search:{q:void 0,selectedOutboxMessageId:void 0},onClick:()=>O?.(),className:S,"aria-label":N,title:M,children:w}):d==="flagged"?e.jsx(P,{to:"/mail/flagged",search:{q:void 0,selectedMessageId:void 0},onClick:()=>O?.(),className:S,"aria-label":N,title:M,children:w}):d==="settings"?e.jsx(P,{to:"/settings/accounts",onClick:()=>O?.(),className:S,"aria-label":N,title:M,children:w}):e.jsx(P,{to:"/mail/$mailboxId",params:{mailboxId:d},search:{q:void 0,selectedMessageId:void 0},onClick:()=>{g(d),O?.()},className:S,"aria-label":N,title:M,children:w}),c=()=>{m(""),s?.()},y=l.trim(),A=y.length>0&&!x.includes(y)?y:void 0,K=i.useCallback(()=>{A&&p(is(A))},[A]),V=i.useCallback(d=>{p(ls(d))},[]),q=i.useCallback(d=>{m(d),r({to:"/mail/brief",search:{q:d}}),s?.()},[m,r,s]);return e.jsx(Jt,{accounts:k,selectedNavId:o,onSelectNav:c,linkComponent:R,variant:a,savedSearches:x,saveableQuery:A,onSaveCurrentSearch:K,onSelectSavedSearch:q,onRemoveSavedSearch:V})}function xs(){return e.jsxs("button",{type:"button",onClick:Se,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg",children:[e.jsx(ke,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Report a bug"})]})}function hs({accounts:t,onMailboxSelect:s}){return ve()?.showNavPane??!0?e.jsx(me,{accounts:t}):e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(me,{accounts:t,onMailboxSelect:s,variant:"drawer"})}),e.jsxs("div",{className:"border-t border-line px-2 py-2",children:[e.jsxs(P,{to:"/settings/accounts",onClick:s,children:[e.jsx(Ie,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Settings"})]}),e.jsx(xs,{}),e.jsx(Me,{children:({signOut:r})=>e.jsxs("button",{type:"button",onClick:()=>{s?.(),r()},className:"flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg","data-testid":"sign-out-button",children:[e.jsx(we,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Sign out"})]})})]})]})}const fs=({isOpen:t,onClose:s})=>{const a=i.useCallback(n=>{n.key==="Escape"&&(n.preventDefault(),s())},[s]);return i.useEffect(()=>{if(t)return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[t,a]),t?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx(Ze,{label:"Dismiss keyboard shortcuts",onDismiss:s,className:"backdrop-blur-sm"}),e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Keyboard shortcuts",className:et("relative z-10 max-h-[85vh] w-full max-w-2xl overflow-y-auto","rounded-lg border border-line bg-surface shadow-lg","p-6"),children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Keyboard shortcuts"}),e.jsx("button",{type:"button",onClick:s,className:"p-1 text-fg-muted transition-colors hover:text-fg","aria-label":"Close",children:e.jsx(be,{className:"size-5"})})]}),e.jsx("div",{className:"grid gap-x-8 gap-y-6 sm:grid-cols-2",children:yt.map(n=>e.jsxs("div",{children:[e.jsx("h3",{className:"mb-3 text-sm font-medium text-fg-muted",children:n.title}),e.jsx("div",{className:"space-y-2",children:n.hints.map(r=>e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("span",{className:"text-sm",children:r.description}),e.jsx("span",{className:"flex shrink-0 items-center gap-1",children:r.keys.map((o,l)=>e.jsxs(i.Fragment,{children:[l>0&&r.keys[0]==="g"&&e.jsx("span",{className:"text-2xs text-fg-subtle",children:"then"}),e.jsx(ae,{children:o})]},o))})]},`${r.action}-${r.keys.join("+")}`))})]},n.title))}),e.jsx("div",{className:"mt-6 border-t border-line pt-4",children:e.jsxs("p",{className:"text-center text-xs text-fg-muted",children:["Press ",e.jsx(ae,{children:"Esc"})," to close"]})})]})]}):null};function ps(t){const s=G({queries:t.map(a=>({...J({path:{accountId:a.accountId}}),staleTime:1/0}))});return i.useMemo(()=>jt(s.map(a=>a.data?.items??[])),[s])}const gs=t=>t.map(s=>s.data?.items??[]);function bs(t){const s=G({queries:t.map(a=>({...J({path:{accountId:a.accountId}}),staleTime:1/0})),combine:gs});return i.useMemo(()=>tt(t.map((a,n)=>({folderAppointments:a.folderAppointments,mailboxes:s[n]??[]}))),[t,s])}var T={exports:{}},xe;function vs(){if(xe)return T.exports;xe=1;const t=(s,a,n)=>new Promise((r,o)=>{if(n=Object.assign({concurrency:1/0},n),typeof a!="function")throw new TypeError("Mapper function is required");const{concurrency:l}=n;if(!(typeof l=="number"&&l>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${l}\` (${typeof l})`);const m=[],x=s[Symbol.iterator]();let p=!1,b=!1,u=0,h=0;const f=()=>{if(p)return;const v=x.next(),k=h;if(h++,v.done){b=!0,u===0&&r(m);return}u++,Promise.resolve(v.value).then(g=>a(g,k)).then(g=>{m[k]=g,u--,f()},g=>{p=!0,o(g)})};for(let v=0;v<l&&(f(),!b);v++);});return T.exports=t,T.exports.default=t,T.exports}var ys=vs();const js=st(ys),Ss=900*1e3,Ns=300,Cs=(t,s)=>{if(!t)return s;const a=Number.parseInt(t,10);return Number.isFinite(a)&&a>0?a:s},ks=60*1e3,ws=t=>Math.max(Cs(t,Ns)*1e3,ks),B=ws(it().mailboxPollIntervalSeconds),Is=5,W=new Set,Ms=(t,s,a=Ss)=>t.filter(n=>{const r=n.lastSyncAt;return r==null?!0:s-r>a}).map(n=>n.accountId),Os=(t,s,a=B)=>t-s>=a,Es=(t,s)=>t.filter(a=>!s.has(a)),he=(t,s)=>{if(W.delete(t),rt(s,{softError:!0})){ot(s);return}console.warn("[remit] background mailbox sync failed",{accountId:t,error:s})},fe=(t,s)=>at({path:{accountId:t},throwOnError:!0}).then(()=>{s.invalidateQueries({queryKey:nt({path:{accountId:t}})})}),Rs=t=>{const s=Ne(),a=i.useRef(t);a.current=t;const n=t.map(r=>r.accountId).join(",");i.useEffect(()=>{const r=Date.now(),l=Ms(a.current,r).filter(m=>!W.has(m));if(l.length!==0)for(const m of l)W.add(m),fe(m,s).catch(x=>{he(m,x)})},[n,s]),i.useEffect(()=>{let r=Date.now(),o;const l=new Set,m=()=>{r=Date.now();const b=Es(a.current.map(u=>u.accountId),l);for(const u of b)l.add(u);js(b,u=>fe(u,s).catch(h=>{he(u,h)}).finally(()=>{l.delete(u)}),{concurrency:Is})},x=()=>{if(document.visibilityState==="visible"){m(),o=setTimeout(x,B);return}},p=()=>{document.visibilityState==="visible"&&Os(Date.now(),r)&&(o!==void 0&&clearTimeout(o),m(),o=setTimeout(x,B))};return o=setTimeout(x,B),document.addEventListener("visibilitychange",p),()=>{o!==void 0&&clearTimeout(o),document.removeEventListener("visibilitychange",p)}},[n,s])};function Ws(){const{q:t=""}=lt({from:"/mail"}),s=Y(),a=St(),n=wt(a),[r,o]=i.useState(!1),[l,m]=i.useState(!1),[x,p]=i.useState(!1),b=i.useCallback(j=>{p(j),ne(j)},[]),[u,h]=i.useState(t),f=Kt(u,200),v=At(u,f),k=se({select:j=>j.location.pathname}),g=se({select:j=>Mt(j.matches)}),[R,c]=i.useState(g);if(R!==g){const j=Rt(R,g,t);c(g),j!==void 0&&h(j)}const{data:y,isLoading:A,isError:K,error:V,refetch:q}=Ce({...ct(),staleTime:1/0}),d=!!(y&&(y.accounts?.length??0)===0);i.useEffect(()=>{d&&s({to:"/onboarding",replace:!0})},[d,s]),Nt({enabled:!r,bindings:[{key:"?",handler:()=>o(!0),noModifiers:!1,preventDefault:!0}]});const{openCompose:S}=U(),N=i.useMemo(()=>({compose:()=>S({mode:"new"})}),[S]);Ct({enabled:!ut(k),handlers:N});const M=i.useCallback(j=>{h(j)},[]),w=i.useCallback(()=>{h("")},[]),O=i.useCallback(()=>{h("")},[]),Q=i.useCallback(()=>{p(j=>{const Z=!j;return ne(Z),Z})},[]),C=y?.accounts??[],F=i.useMemo(()=>C.map(j=>j.accountId),[C]),Oe=ps(C),Ee=bs(C),Re=i.useMemo(()=>kt(C),[C]);Rs(C);const Ae=i.useCallback(()=>{m(!1)},[]),Pe={accounts:C,mailboxNameIndex:Oe,accountNameIndex:Re,resultFolderIndex:Ee,searchQuery:v,searchInput:u,searchViewKey:g,onSearchChange:M,onSearchClear:w,onSearchClearQuery:O,intelligenceOpen:x,onToggleIntelligence:Q,onSetIntelligenceOpen:b},ze={isSinglePane:n,isLoading:A||d,intelligenceOpen:x,nav:e.jsx(hs,{accounts:C,onMailboxSelect:Ae}),topBar:n?void 0:e.jsx(rs,{accounts:C}),overlay:n?e.jsx(ss,{}):void 0,navOpen:l,onOpenNav:()=>m(!0),onCloseNav:()=>m(!1)};return e.jsx(dt.Provider,{value:Pe,children:e.jsxs(Ft,{accountIds:F,children:[K?e.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:e.jsx(_t,{title:"Couldn't load your account",error:V,onRetry:()=>{q()}})}):e.jsx(Et,{chrome:ze,children:e.jsx(mt,{})}),e.jsx(fs,{isOpen:r,onClose:()=>o(!1)})]})})}export{Ws as component,je as useMailContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"./index-
|
|
1
|
+
import{c as e}from"./index-3eAE16lF.js";const n=e("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);export{n as M};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{q as g,w as C,v as w,ad as L,P as _,
|
|
1
|
+
import{q as g,w as C,v as w,ad as L,P as _,cV as D,r as b,cm as x,s as A,y as E,cW as p,D as N}from"./index-3eAE16lF.js";import{a as I}from"./enums-CCxx0t2v.js";const F=3e4,R=1e3,$="The folder couldn't be created on the mail server. Please try again.",B="The folder was created but the mail server hasn't confirmed it yet, so nothing was attached to it. It's in your folder list — try again in a moment.",k=(e,t)=>new Promise((a,o)=>{if(t?.aborted){o(t.reason);return}const n=setTimeout(()=>{t?.removeEventListener("abort",r),a()},e),r=()=>{clearTimeout(n),o(t?.reason)};t?.addEventListener("abort",r,{once:!0})});async function Y({fetchMailboxes:e,mailboxId:t,signal:a,timeoutMs:o=F,pollIntervalMs:n=R,delay:r=k,now:l=Date.now}){const s=l()+o;for(;;){a?.throwIfAborted();const c=(await e()).find(u=>u.mailboxId===t);if(c?.syncStatus===I.synced)return c;if(c?.syncStatus===I.failed)throw new Error($);if(l()>=s)throw new Error(B);await r(n,a)}}function S(e,t){const a=e.trim();return t?`${t.fullPath}${t.hierarchyDelimiter}${a}`:a}const P=(e,t)=>{const a=e.split(t);return a[0]?.toLowerCase()==="inbox"&&(a[0]="INBOX"),a.join(t)};function X({name:e,delimiter:t,parent:a,existingPaths:o}){const n=e.trim();if(n==="")return"Enter a folder name.";if(n.includes(t))return`A folder name can't contain "${t}".`;const r=P(S(n,a),t);if(o.some(s=>P(s,t)===r))return"A folder with that name already exists."}function j(e){const t=g(),{data:a}=C({...w({path:{accountId:e??""}}),enabled:!!e}),o=L({...D(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:_({path:{accountId:e}})})}}),n=b.useRef(new Map),r=b.useCallback(async(s,i,c)=>{if(!e)throw new Error("No account to create the folder in. Pick messages from a single account first.");const u=a?.items??[],d=i?u.find(h=>h.fullPath===i):void 0;if(i&&!d)throw new Error(`Couldn't find the folder "${i}" to create this one inside.`);const y=d?{fullPath:d.fullPath,hierarchyDelimiter:d.hierarchyDelimiter}:void 0,f=S(s,y);let m=n.current.get(f);if(!m){const h=y?.hierarchyDelimiter??u[0]?.hierarchyDelimiter??"/",v=X({name:s,delimiter:h,parent:y,existingPaths:u.map(T=>T.fullPath)});if(v)throw new Error(v);m=(await o.mutateAsync({path:{accountId:e},body:{fullPath:f,namespaceType:"personal"}})).mailboxId,n.current.set(f,m)}const M=await Y({mailboxId:m,signal:c,fetchMailboxes:async()=>(await t.fetchQuery({...w({path:{accountId:e}}),staleTime:0})).items??[]});return n.current.delete(f),{id:M.mailboxId,label:x(M.fullPath),path:M.fullPath}},[o,e,a,t]);return{createFolder:b.useCallback((s,i)=>r(s,"",i),[r]),createFolderIn:r,mutation:o}}const J=()=>{const{t:e}=A("mail",{useSuspense:!1});return b.useCallback((t,a)=>e(t,{defaultValue:a}),[e])},ee=100,Q=e=>e.trim().toLowerCase()==="inbox",z=(e,t)=>{const a=`${e.fullPath}${e.hierarchyDelimiter}`;return t.some(o=>o.mailboxId!==e.mailboxId&&o.fullPath.startsWith(a))},V=(e,t)=>t.find(a=>a.mailboxId!=null&&a.mailboxId===e)?.role;function te(e,t,a){if(Q(e.fullPath))return{deletable:!1,reason:"inbox",message:"The inbox can't be deleted."};const o=V(e.mailboxId,a);return o?{deletable:!1,reason:"role",message:`This folder is your ${o} folder. Reassign that role before deleting it.`}:z(e,t)?{deletable:!1,reason:"children",message:"This folder has subfolders. Delete them first."}:{deletable:!0}}function q(e,t){return e.filter(a=>a.mailboxId!==t)}function ae(e){return{total:e,moved:0,phase:e===0?"moved":"moving"}}function oe(e,t){if(e.phase!=="moving")return e;const a=Math.min(e.total,e.moved+Math.max(0,t));return{...e,moved:a,phase:a>=e.total?"moved":"moving"}}function ne(e,t){return{...e,phase:"failed",error:t}}function re(e){return`Moved ${e.moved} of ${e.total}`}function ie(e){return e>0?"choose-fate":"confirm-empty"}const U=new Set(["outbox","postvak uit","boîte d'envoi","postausgang","buzón de salida","posta in uscita","送信トレイ","送件匣","发件箱","skrzynka nadawcza"]),G=e=>{const t=x(e.fullPath).trim().toLowerCase();return U.has(t)},O=p.length,K=(e,t)=>{const a=E(t);return[...e.filter(n=>{const r=a.get(n.mailboxId);return r==="drafts"||r==="sent"?!1:!G(n)})].sort((n,r)=>{const l=a.has(n.mailboxId)?p.indexOf(a.get(n.mailboxId)??"inbox"):O,s=a.has(r.mailboxId)?p.indexOf(a.get(r.mailboxId)??"inbox"):O;return l!==s?l-s:x(n.fullPath).localeCompare(x(r.fullPath),void 0,{sensitivity:"base",numeric:!0})})},se=e=>e[0]?.hierarchyDelimiter??"/",le=({mailboxes:e,folderAppointments:t,currentMailboxId:a,excludeMailboxId:o,translator:n})=>{const r=K(e,t),l=E(t);return(o?q(r,o):r).map(i=>({id:i.mailboxId,label:N(i,l.get(i.mailboxId),n),path:i.fullPath,isCurrent:i.mailboxId===a}))};export{ee as M,J as a,le as b,ae as c,ne as d,oe as e,se as f,te as g,ie as i,re as m,j as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as t,a0 as r,q as a,r as i,j as s}from"./index-
|
|
1
|
+
import{$ as t,a0 as r,q as a,r as i,j as s}from"./index-3eAE16lF.js";import{O as c}from"./OnboardingWizard-KL6He6rZ.js";import"./kbd-BVVVI8MK.js";import"./account-form-helpers-DgsG82nf.js";async function l(e){e.recordCompleted(),await e.queryClient.refetchQueries({queryKey:t()}),e.navigateToInbox()}function y(){const e=r(),o=a(),n=i.useCallback(m=>{l({queryClient:o,recordCompleted:()=>e.recordEvent("onboarding.completed"),navigateToInbox:()=>{window.location.assign("/mail")}})},[e,o]);return s.jsx(c,{skipWelcome:!1,onComplete:n})}export{y as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o,_ as r}from"./index-3eAE16lF.js";import{a as i}from"./search-view-BtUa3wf0.js";import{O as t}from"./OutboxPane-BTeGPBk1.js";import{u as m}from"./useSearchMirror-BJ2isjrf.js";import"./search-scope-Bcn1kzwd.js";import"./useSearchTokenContext-DKU_0B8G.js";import"./kbd-BVVVI8MK.js";import"./enums-CCxx0t2v.js";import"./circle-check-big-Dm9DZK8n.js";import"./clock-LgAy7KhC.js";import"./row-actions-Cfzm03L2.js";import"./rotate-ccw-CgMVBPU0.js";import"./NavMenuButton-DmFeFE-H.js";import"./menu-B3HPQBVa.js";import"./format-De9HZKjg.js";import"./outbox-status-CPfNHfUQ.js";import"./search-query-Cr_ZXBCp.js";function P(){return m({to:"/mail/outbox"}),o.jsx(t,{children:o.jsx(i,{phone:o.jsx(t.Phone,{}),list:o.jsx(t.List,{}),reading:o.jsx(r,{})})})}export{P as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a}from"./index-
|
|
1
|
+
import{c as a}from"./index-3eAE16lF.js";const c=a("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);export{c as P};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as wi,r as z,j as M,B as Mf,
|
|
1
|
+
import{c as wi,r as z,j as M,B as Mf,c_ as ru,b as Gs,a6 as iu,c$ as tp,d0 as np,ay as rp,bd as ou,d1 as ip}from"./index-3eAE16lF.js";import{au as tl,av as op,aw as su,ax as sp}from"./MailListHeader-CzkFVHra.js";import{ay as iC}from"./MailListHeader-CzkFVHra.js";import{C as ap}from"./confirm-dialog-d8zs8D-F.js";import"./search-token-index-XT09xk5-.js";import"./search-scope-Bcn1kzwd.js";import"./useMediaQuery-vS62WMhd.js";import"./kbd-BVVVI8MK.js";import"./account-form-helpers-DgsG82nf.js";import"./avatar-B5Xfa_Aj.js";import"./useSearchTokenContext-DKU_0B8G.js";import"./enums-CCxx0t2v.js";import"./useSignature-DEHQxXCm.js";import"./useDebouncedValue-nan84ZZT.js";import"./ErrorState-By22X09V.js";import"./format-De9HZKjg.js";import"./download-FAYYcvQP.js";import"./shield-check-Dq-7lUbt.js";import"./move-options-s_k2CE-Q.js";import"./useFilters-laocR3nD.js";import"./clock-LgAy7KhC.js";import"./menu-B3HPQBVa.js";const lp=wi("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);const up=wi("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);const cp=wi("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);const fp=wi("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);const dp=wi("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]),hp={account:"the account default",detected:"detected from what you wrote",manual:"chosen for this message"},gp=({language:n,languages:e,source:t,onSelect:r,helpText:i})=>{const[o,s]=z.useState(!1),a=z.useRef(null),l=z.useRef(null),u=z.useRef(null),c=z.useId(),f=z.useCallback(g=>{s(!1),g&&l.current?.focus()},[]);z.useEffect(()=>{if(!o)return;const g=m=>{a.current?.contains(m.target)||s(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),z.useEffect(()=>{if(!o)return;const g=u.current?.querySelector('[aria-checked="true"]'),m=u.current?.querySelector('[role="menuitemradio"]');(g??m)?.focus()},[o]);const d=g=>{if(g.key==="Escape"){g.preventDefault(),f(!0);return}const m=[...u.current?.querySelectorAll('[role="menuitemradio"]')??[]],p=m.indexOf(document.activeElement),y=np(g.key,p,m.length);y!==null&&(g.preventDefault(),m[y]?.focus())},h=g=>{r(g),f(!0)};return M.jsxs("div",{ref:a,className:"relative",children:[M.jsx(Mf,{ref:l,variant:"ghost",size:"md","aria-label":`Message language: ${iu(n)}, ${hp[t]}`,"aria-haspopup":"menu","aria-expanded":o,"aria-controls":o?c:void 0,onClick:()=>s(g=>!g),"data-testid":"compose-language-chip","data-language":n,"data-language-source":t,className:Gs("min-h-11 min-w-11 shrink-0 px-2 font-medium",n!==e[0]&&"bg-accent-2-soft text-accent-2"),children:ru(n)}),o&&M.jsxs("div",{ref:u,id:c,role:"menu","aria-label":"Message language",onKeyDown:d,"data-testid":"compose-language-menu",className:"absolute right-0 top-full z-50 mt-1 flex max-h-[60dvh] min-w-56 flex-col overflow-y-auto overscroll-contain rounded-md border border-line bg-surface py-1 shadow-lg",children:[e.map(g=>M.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":g===n,lang:g,onClick:()=>h(g),className:Gs("flex min-h-11 items-center justify-between gap-3 px-4 py-2.5 text-left text-sm text-fg transition-colors hover:bg-surface-sunken",g===n&&"bg-accent-2-soft"),children:[iu(g),M.jsx("span",{className:"shrink-0 text-xs text-fg-subtle",children:ru(g)})]},g)),M.jsx("p",{"data-testid":"compose-language-help",className:"border-t border-line px-4 pb-1 pt-2 text-xs text-fg-muted",children:i??tp(navigator.userAgent)})]})]})},pp=({mode:n,onToggle:e})=>M.jsx(Mf,{variant:"ghost",size:"md","aria-pressed":n==="plain",title:"Plain text",onClick:e,"data-testid":"compose-mode-toggle",className:Gs("min-h-11 shrink-0",n==="plain"&&"bg-accent-2-soft text-accent-2"),children:"Plain text"});function $(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function jf(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);t.search=r.toString(),console.warn(`Minified Lexical warning #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const Ve=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,mp=Ve&&"documentMode"in document?document.documentMode:null,St=Ve&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),$t=Ve&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),vr=!(!Ve||!("InputEvent"in window)||mp)&&"getTargetRanges"in new window.InputEvent("input"),mn=Ve&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Rf=Ve&&/Android/.test(navigator.userAgent),Ei=Ve&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!Rf,Pf=Ve&&/^(?=.*Chrome).*/i.test(navigator.userAgent),po=Ve&&Rf&&Pf,Ti=Ve&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&St&&!Pf,yp=0,_p=1,bp=2,Zs=1,Qs=2,ea=4,ta=8,kp=16,Ss=32,ws=64,nl=128,xp=1,Cp=2,vp=3,Sp=4,wp=5,Ep=6,ui=Ei||mn||Ti?" ":"",$n=`
|
|
2
2
|
|
|
3
3
|
`,rl=$t?" ":ui,rn={bold:1,capitalize:1024,code:16,highlight:nl,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Tp={directionless:1,unmergeable:2},mo={center:2,end:6,justify:4,left:1,right:3,start:5},Np={[Cp]:"center",[Ep]:"end",[Sp]:"justify",[xp]:"left",[vp]:"right",[wp]:"start"},Dp={normal:0,segmented:2,token:1},$p={[yp]:"normal",[bp]:"segmented",[_p]:"token"},au="$config";function lu(){return Ce()._blockCursorElement}function Fp(n){return n!==null&&n.nodeType===1&&n.hasAttribute("data-lexical-slot")}let If=class no{element;before;after;constructor(e,t,r){this.element=e,this.before=t||null,this.after=r||null}withBefore(e){return new no(this.element,e,this.after)}withAfter(e){return new no(this.element,this.before,e)}withElement(e){return this.element===e?this:new no(e,this.before,this.after)}insertChild(e){const t=this.getInsertionAnchor();return t!==null&&t.parentElement!==this.element&&$(357),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&$(358),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&$(359),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;return t===this.getInsertionAnchor()?null:t}getFirstChildAnchor(){return this.after}resolveLeafPosition(e,t,r){if(this.element===e)return t===e&&r===0?"before":"after";const i=uu(e,this.element);if(i===null)return"after";const o=Array.prototype.indexOf.call(e.childNodes,i);if(o<0)return"after";if(t===e)return r<=o?"before":"after";const s=uu(e,t);if(s===null)return"after";const a=Array.prototype.indexOf.call(e.childNodes,s);return a>=0&&a<=o?"before":"after"}getInsertionAnchor(){return this.before}};function uu(n,e){let t=e;for(;t!==null&&t.parentNode!==n;)t=t.parentNode;return t}let Lf=class ro extends If{withBefore(e){return new ro(this.element,e,this.after)}withAfter(e){return new ro(this.element,this.before,e)}withElement(e){return this.element===e?this:new ro(e,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()}getFirstChildAnchor(){let e=super.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;for(;Fp(t);)e=t,t=t.nextSibling;const r=e?e.nextSibling:this.element.firstChild;return r!==null&&r===lu()?r:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(this.element.__lexicalLastChildKind=e,e===null)this.removeManagedLineBreak();else{const t=e==="decorator"&&(Ti||mn||Ei);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,r=e.nodeName==="IMG"?e.nextSibling:null;r&&t.removeChild(r),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===(t.nodeName==="IMG"))return;this.removeManagedLineBreak()}const r=this.element,i=this.before,o=te().createElement("br");if(o.setAttribute("data-lexical-managed-linebreak","true"),r.insertBefore(o,i),e){const s=te().createElement("img");s.setAttribute("data-lexical-managed-linebreak","true"),s.style.setProperty("display","inline","important"),s.style.setProperty("border","0px","important"),s.style.setProperty("margin","0px","important"),s.alt="",r.insertBefore(s,o),r.__lexicalLineBreak=s}else r.__lexicalLineBreak=o}getFirstChildOffset(){const e=this.getFirstChild(),t=this.getInsertionAnchor();let r=0;for(let i=this.element.firstChild;i!==null&&i!==e&&i!==t;i=i.nextSibling)r++;return r}resolveChildIndex(e,t,r,i){if(r===this.element){const l=this.getFirstChildOffset(),u=lu(),c=this.element.childNodes,f=Math.min(i,c.length);let d=0;for(let h=l;h<f;h++)c[h]!==u&&d++;return[e,Math.min(d,e.getChildrenSize())]}const o=cu(t,r);o.push(i);const s=cu(t,this.element);let a=e.getIndexWithinParent();for(let l=0;l<s.length;l++){const u=o[l],c=s[l];if(u===void 0||u<c)break;if(u>c){a+=1;break}}return[e.getParentOrThrow(),a]}};function cu(n,e){const t=[];let r=e;for(;r!==n&&r!==null;r=r.parentNode){let i=0;for(let o=r.previousSibling;o!==null;o=o.previousSibling)i++;t.push(i)}return r!==n&&$(225),t.reverse()}let Bf;try{Bf="0.49.0+prod.esm"}catch{}const Kf=Bf??'"<unknown>+source"';let Ur=class{_front=new Set;_back=new Set;_cache;get size(){return this._front.size+this._back.size}addBack(e){return delete this._cache,this._front.has(e)||this._back.add(e),this}addFront(e){return delete this._cache,this._back.has(e)||this._front.add(e),this}delete(e){return delete this._cache,this._front.delete(e)||this._back.delete(e)}toArray(){const e=Array.from(this._front).reverse();for(const t of this._back)e.push(t);return e}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}};const wn=null;function Wf(n,e=1e3){return n instanceof na?n.clone():n.size<e?new Map(n):new na().init(new Map(n),void 0,n.size)}let na=class qf{_mutable=!1;_old=void 0;_nursery=void 0;_size=0;clone(){return this._mutable=!1,new qf().init(this._old,this._nursery,this._size)}init(e,t,r){return this._old=e,this._nursery=t,this._size=r,this}get size(){return this._size}has(e){return this.get(e)!==void 0}getWithTombstone(e){const t=this._nursery&&this._nursery.get(e);return t!==void 0?t:this._old&&this._old.get(e)}get(e){const t=this.getWithTombstone(e);return t===wn?void 0:t}shouldCompact(){return this._nursery!==void 0&&2*this._nursery.size>this._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(e=!1){if(this._nursery&&this._nursery.size>0&&(e||this.shouldCompact())){const t=new Map(this._old);for(const[r,i]of this._nursery)i!==wn?t.set(r,i):t.delete(r);this._old=t,this._nursery=void 0}return this._mutable=!1,this}set(e,t){const r=this.getWithTombstone(e);if(r===t)return this;const i=this.getNursery();return r!==wn&&r!==void 0||(this._size++,r===wn&&i.delete(e)),i.set(e,t),this}delete(e){const t=this.has(e);return t&&(this.getNursery().set(e,wn),this._size--),t}getOrInsert(e,t){const r=this.get(e);return r!==void 0?r:(this.set(e,t),t)}getOrInsertComputed(e,t){const r=this.get(e);if(r!==void 0)return r;const i=t(e);return this.set(e,i),i}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(const e of this.entries())yield e[0]}*values(){for(const e of this.entries())yield e[1]}*entries(){const e=this._nursery,t=this._old;if(t)for(const r of t){const i=r[0],o=e?e.get(i):void 0;o!==wn&&(o!==void 0&&(r[1]=o),yield r)}if(e)for(const r of e)r[1]===wn||t&&t.has(r[0])||(yield r)}forEach(e,t){t!==void 0&&(e=e.bind(t));for(const[r,i]of this.entries())e(i,r,this)}get[Symbol.toStringTag](){return"GenMap"}[Symbol.iterator](){return this.entries()}};function yo(n,e,t,r,i,o){if(S(n)){let s=n.getFirstChild();for(;s!==null;){const a=s.__key;s.__parent===e&&((S(s)||tn(s)&&s.__slots!==null)&&yo(s,a,t,r,i,o),t.has(a)||o.delete(a),i.push(a)),s=s.getNextSibling()}}for(const s of tn(n)&&n.__slots!==null?n.__slots.values():[]){const a=r.get(s);a!==void 0&&In(a)&&a.__slotHost===e&&((S(a)||tn(a)&&a.__slots!==null)&&yo(a,s,t,r,i,o),t.has(s)||o.delete(s),i.push(s))}}let ra=!1,il=0;function Ap(n){il=n.timeStamp}function Es(n,e,t){const r=n.nodeName==="BR",i=e.__lexicalLineBreak;return i&&(n===i||r&&n.previousSibling===i)||r&&Lr(n,t)!==void 0}function zp(n,e,t){const r=Oe(st(t)),i=r&&it(r,t._rootElement);let o=null,s=null;i!==null&&i.anchorNode===n&&(o=i.anchorOffset,s=i.focusOffset);const a=n.nodeValue;a!==null&&wl(e,a,o,s,!1)}function Op(n,e,t){if(N(n)){const r=n.anchor.getNode();if(r.is(t)&&n.format!==r.getFormat())return!1}return ot(e)&&t.isAttached()}function Mp(n,e,t){for(let r=n;r&&!mh(r);r=Vn(r)){const i=Lr(r,e);if(i!==void 0){const o=ee(i,t);if(o)return Z(o)||!K(r)?void 0:[r,o]}}}function Uf(n,e,t){ra=!0;const r=performance.now()-il>100;try{yt(n,()=>{const i=A()||(function(f){return f.read("latest",()=>{const d=A();return d!==null?d.clone():null})})(n),o=new Map,s=n._editorState,a=n._blockCursorElement;let l=!1,u="";for(let f=0;f<e.length;f++){const d=e[f],h=d.type,g=d.target,m=Mp(g,n,s);if(!m)continue;const[p,y]=m;if(h==="characterData")r&&D(y)&&ot(g)&&Op(i,g,y)&&zp(g,y,n);else if(h==="childList"){l=!0;const _=d.addedNodes;for(let C=0;C<_.length;C++){const x=_[C],w=th(x),v=x.parentNode;if(!(v==null||x===a||w!==null||Es(x,v,n)||n._slotsUsed&&K(x)&&x.hasAttribute("data-lexical-slot")||mh(x))){if($t){const E=(K(x)?x.innerText:null)||x.nodeValue;E&&(u+=E)}v.removeChild(x)}}const b=d.removedNodes,k=b.length;if(k>0){let C=0;for(let x=0;x<k;x++){const w=b[x];(Es(w,g,n)||a===w)&&(g.appendChild(w),C++)}k!==C&&o.set(p,y)}}}if(o.size>0)for(const[f,d]of o)d.reconcileObservedMutation(f,n);const c=t.takeRecords();if(c.length>0){for(let f=0;f<c.length;f++){const d=c[f],h=d.addedNodes,g=d.target;for(let m=0;m<h.length;m++){const p=h[m],y=p.parentNode;y==null||p.nodeName!=="BR"||Es(p,g,n)||y.removeChild(p)}}t.takeRecords()}i!==null&&(l&&me(i),$t&&ah(n)&&i.insertRawText(u))})}finally{ra=!1}}function Hf(n){const e=n._observer;e!==null&&Uf(n,e.takeRecords(),e)}function Jf(n){(function(e){il===0&&st(e).addEventListener("textInput",Ap,!0)})(n),n._observer=new MutationObserver((e,t)=>{Uf(n,e,t)})}const fu="latest";let jp=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||Ip).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function Ni(n,e){return new jp(n,e)}function Di(n,e,t=fu){const r=(t===fu?n.getLatest():n).__state;return r?r.getValue(e):e.defaultValue}function hr(n,e,t){let r;if(Me(),typeof t=="function"){const o=n.getLatest(),s=Di(o,e);if(r=t(s),e.isEqual(s,r))return o}else r=t;const i=n.getWritable();return Yf(i).updateFromKnown(e,r),i}function Rp(n){const e=new Map,t=new Set;for(const{ownNodeConfig:r}of Fl(typeof n=="function"?n:n.replace))if(r&&r.stateConfigs)for(const i of r.stateConfigs){let o;"stateConfig"in i?(o=i.stateConfig,i.flat&&t.add(o.key)):o=i,e.set(o.key,o)}return{flatKeys:t,sharedConfigMap:e}}const du=new Set(["__proto__","constructor","prototype"]);let Pp=class Vf{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,r=void 0,i=new Map,o=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=r,this.knownState=i;const{sharedConfigMap:s}=this.sharedNodeState,a=o!==void 0?o:(function(l,u,c){let f=c.size;if(u)for(const d in u){const h=l.get(d);h&&c.has(h)||f++}return f})(s,r,i);this.size=a}getValue(e){const t=this.knownState.get(e);if(t!==void 0)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let r=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){const i=this.unknownState[e.key];i!==void 0&&(r=e.parse(i)),this.updateFromKnown(e,r)}return r}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const e={...this.unknownState},t={};for(const[r,i]of this.knownState)r.isEqual(i,r.defaultValue)?delete e[r.key]:e[r.key]=r.unparse(i);for(const r of this.sharedNodeState.flatKeys)r in e&&(t[r]=e[r],delete e[r]);return hu(e)&&(t.$=e),t}getWritable(e){if(this.node===e)return this;const{sharedNodeState:t,unknownState:r}=this,i=new Map(this.knownState);return new Vf(e,t,(function(o,s,a){let l;if(a)for(const[u,c]of Object.entries(a)){if(du.has(u))continue;const f=o.get(u);f?s.has(f)||s.set(f,f.parse(c)):(l=l||{},l[u]=c)}return l})(t.sharedConfigMap,i,r),i,this.size)}resetOnCopyNode(){for(const e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){const r=e.key;this.sharedNodeState.sharedConfigMap.set(r,e);const{knownState:i,unknownState:o}=this;i.has(e)||o&&r in o||(o&&(delete o[r],this.unknownState=hu(o)),this.size++),i.set(e,t)}updateFromUnknown(e,t){if(du.has(e))return;const r=this.sharedNodeState.sharedConfigMap.get(e);r?this.updateFromKnown(r,r.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){const{knownState:t}=this;for(const r of t.keys())t.set(r,r.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(const[r,i]of Object.entries(e))this.updateFromUnknown(r,i)}};function Yf(n){const e=n.getWritable(),t=e.__state?e.__state.getWritable(e):new Pp(e,Xf(e));return e.__state=t,t}function Xf(n){return n.__state?n.__state.sharedNodeState:Zd(Ce(),n.getType()).sharedNodeState}function hu(n){if(n)for(const e in n)return n}function Ip(n){return n}function gu(n,e,t){for(const[r,i]of e.knownState){if(n.has(r.key))continue;n.add(r.key);const o=t?t.getValue(r):r.defaultValue;if(o!==i&&!r.isEqual(o,i))return!0}return!1}function pu(n,e,t){const{unknownState:r}=e,i=t?t.unknownState:void 0;if(r){for(const[o,s]of Object.entries(r))if(!n.has(o)&&(n.add(o),s!==(i?i[o]:void 0)))return!0}return!1}function mu(n,e){const t=n.__state;return t&&t.node===n?t.getWritable(e):t}function yu(n,e){const t=n.__mode,r=n.__format,i=n.__style,o=e.__mode,s=e.__format,a=e.__style,l=n.__state,u=e.__state;return(t===null||t===o)&&(r===null||r===s)&&(i===null||i===a)&&(n.__state===null||l===u||(function(c,f){if(c===f)return!0;const d=new Set;return!(c&&gu(d,c,f)||f&&gu(d,f,c)||c&&pu(d,c,f)||f&&pu(d,f,c))})(l,u))}function _u(n,e){const t=n.mergeWithSibling(e),r=fe()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function bu(n){let e,t,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(e=r.getPreviousSibling())!==null&&D(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(yu(e,r)){r=_u(e,r);break}break}e.remove()}for(;(t=r.getNextSibling())!==null&&D(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(yu(r,t)){r=_u(r,t);break}break}t.remove()}}else r.remove()}function Ot(n){return ku(n.anchor),ku(n.focus),n}function ku(n){for(;n.type==="element";){const e=n.getNode(),t=n.offset;let r,i;if(t===e.getChildrenSize()?(r=e.getChildAtIndex(t-1),i=!0):(r=e.getChildAtIndex(t),i=!1),D(r)){n.set(r.__key,i?r.getTextContentSize():0,"text",!0);break}if(!S(r))break;n.set(r.__key,i?r.getChildrenSize():0,"element",!0)}}const ci=Symbol.for("@lexical/CachedTextSize");function xu(n,e){return oa.read(()=>{let t=0,r=n;for(let i=0;i<e&&r!==null;i++){const o=wt.get(r);if(o===void 0&&$(345,r),S(o)){const s=Se.get(r);if(s!==void 0&&S(s)&&s.__parent!==o.__parent)t+=o.getTextContentSize();else{const a=On.get(r),l=a&&a.__lexicalTextContent;typeof l!="string"&&$(346,o.getType()),t+=l.length}i<e-1&&!o.isInline()&&(t+=2)}else{const s=o[ci];s===void 0&&$(347,o.getType(),r),t+=s}r=o.__next}return t},{editor:ue})}function Gf(n){S(n)||n[ci]===void 0&&(n[ci]=D(n)?n.__text.length:n.getTextContentSize())}const Lp=4;let fi,ue,di,Q="",Te=null,qe=null,Ie=null;function Mt(){return{firstTextKey:Ie,format:Te,style:qe}}function ht(n){n.firstTextKey!==null&&(Te=n.format,qe=n.style,Ie=n.firstTextKey)}function ia(n){if(Ie!==null)return;const e=n.__lexicalFirstTextKey;if(e===void 0&&$(348),e===null)return;const t=Se.get(e);D(t)&&(Te=t.getFormat(),qe=t.getStyle(),Ie=e)}let Go,ri,ii,wt,oa,Se,On,sa,hi,Mn,Zt=!1,_o=!1;function fn(n,e){const t=wt.get(n),r=Se.has(n);if(e!==null){const i=fa(n);i.parentNode===e&&e.removeChild(i)}if(!r){if(ue._keyToDOMMap.delete(n),S(t)){const i=Ro(t,wt);aa(i,0,i.length-1,null)}if(t!==void 0){for(const i of at(t).values()){const o=ua(i);fn(i,null),o!==null&&o.remove()}El(hi,di,Go,t,"destroyed")}}}function aa(n,e,t,r){for(let i=e;i<=t;++i){const o=n[i];o!==void 0&&fn(o,r)}}function En(n,e){n.setProperty("text-align",e)}const Bp="40px";function Zf(n,e){const t=fi.theme.indent;if(typeof t=="string"){const r=n.classList.contains(t);e>0&&!r?n.classList.add(t):e<1&&r&&n.classList.remove(t)}n.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * var(--lexical-indent-base-value, ${Bp}))`)}function Qf(n,e){const t=n.style;e===0?En(t,""):e===1?En(t,"left"):e===2?En(t,"center"):e===3?En(t,"right"):e===4?En(t,"justify"):e===5?En(t,"start"):e===6&&En(t,"end")}function la(n,e){const t=(function(r){const i=r.__dir;if(i!==null)return i;if(Ne(r))return null;const o=r.getParent();return o===null||xe(o)&&o.__dir===null?"auto":null})(e);t!==null?n.dir=t:n.removeAttribute("dir")}function ed(n){const e=te().createElement("div");return e.setAttribute("data-lexical-slot",n),e.style.display="none",e}function td(n,e,t){e||n.contentEditable==="false"?Gm(t,ue):t.removeAttribute("contenteditable")}function Cu(n,e,t){const r=Q,i=Mt();Q="";let o="";const s=Z(n);for(const[a,l]of t){const u=ed(a);td(e,s,u),e.appendChild(u),Q="";const c=Mt();dn(l,xt(n,u,ue)),ht(c),nd(n,a,e,u),o+=Q}return ht(i),Q=r,o}function at(n){return tn(n)&&n.__slots!==null?n.__slots:bh}function nd(n,e,t,r){const i=Mn.$getSlotTargetElement(n,e,t,ue);i!==null&&(r.parentElement!==i&&i.appendChild(r),r.style.display="")}function ua(n){const e=On.get(n);return e!==void 0?e.parentElement:null}function vu(n,e,t){const r=at(n),i=at(e);for(const[c,f]of r)if(!i.has(c)){const d=ua(f);fn(f,null),d!==null&&d.remove()}const o=Q,s=Mt();let a="",l=null;const u=Z(e);for(const[c,f]of i){const d=r.get(c);let h=d!==void 0?ua(d):null;Q="";const g=Mt();if(h===null){h=ed(c);let m=null;for(const p of t.children)if(!p.hasAttribute("data-lexical-slot")){m=p;break}t.insertBefore(h,m),dn(f,xt(e,h,ue))}else d===f?Gt(f,h):(d!==void 0&&fn(d,h),dn(f,xt(e,h,ue)));if(ht(g),td(t,u,h),nd(e,c,t,h),a+=Q,h.parentElement===t){const m=l===null?t.firstChild:l.nextSibling;m!==h&&t.insertBefore(h,m),l=h}}return ht(s),Q=o,a}function dn(n,e){const t=Se.get(n);if(t===void 0&&$(60),e!==null){const i=wt.get(n);if(i!==void 0){const o=On.get(n);if(o!==void 0){const s=In(i)?i.__slotHost:null,a=In(t)?t.__slotHost:null,l=i.__parent!==t.__parent||s!==a,u=a!==null&&o.parentElement!==e.element;if(l||u)return e.insertChild(o),Gt(n,e.element)}}}const r=Mn.$createDOM(t,ue);if((function(i,o,s){const a=s._keyToDOMMap;nh(o,s,i),a.set(i,o)})(n,r,ue),D(t)?r.setAttribute("data-lexical-text","true"):Z(t)&&(r.setAttribute("data-lexical-decorator","true"),Mo(r,{captureSelection:!0})),S(t)){const i=t.__indent,o=t.__size;la(r,t),i!==0&&Zf(r,i);const s=at(t),a=s.size>0?Cu(t,r,s):"";if(o===0)r.__lexicalTextContent=a,r.__lexicalFirstTextKey=null,Q+=a,s.size>0&&(r.__lexicalSlotTextLength=a.length);else{const u=Q,c=o-1;if(ca(Ro(t,Se),t,0,c,xt(t,r,ue)),a!==""){const f=r.__lexicalTextContent||"";r.__lexicalTextContent=a+f,Q=u+a+f}s.size>0&&(r.__lexicalSlotTextLength=a.length)}const l=t.__format;l!==0&&Qf(r,l),t.isInline()||rd(null,t,r)}else{const i=t.getTextContent();if(Z(t)){const o=t.decorate(ue,fi);o!==null&&id(n,o),r.contentEditable="false";const s=at(t);s.size>0&&Cu(t,r,s)}Q+=i}return e!==null&&e.insertChild(r),Mn.$decorateDOM(t,null,r,ue),Gf(t),El(hi,di,Go,t,"created"),r}function ca(n,e,t,r,i){const o=Q,s=Mt();Q="",Te=null,qe=null,Ie=null;let a=t;for(;a<=r;++a){const u=Mt();dn(n[a],i);const c=Se.get(n[a]);c!==null&&D(c)?Te===null&&(Te=c.getFormat(),qe=c.getStyle(),Ie=c.__key):S(c)&&a<r&&!c.isInline()&&(Q+=$n),ht(u)}const l=ue._keyToDOMMap.get(e.__key);l===void 0&&$(349,e.__key),l.__lexicalTextContent=Q,l.__lexicalFirstTextKey=Ie,Q=o+Q,ht(s)}function rd(n,e,t){const r=xt(e,t,ue),i=r.element.__lexicalLastChildKind??null,o=(function(s,a){if(s){const l=s.__last;if(l){const u=a.get(l);if(u)return Pe(u)?"line-break":Z(u)&&u.isInline()?"decorator":null}return at(s).size>0?null:"empty"}return null})(e,Se);i!==o&&r.setManagedLineBreak(o)}function Kp(n,e,t){var r;Te=null,qe=null,Ie=null,(function(i,o,s){const a=Q,l=i.__size,u=o.__size;Q="";const c=s.element,f=ue._keyToDOMMap.get(o.__key);f===void 0&&$(351,o.__key);const d=u-l;if(!Zt&&Math.abs(d)<=1&&l>=Lp&&i.__first===o.__first&&(d!==0||!ue._cloneNotNeeded.has(i.__key))){const h=f.__lexicalTextContent,g=sa.get(i.__key);if(!Zt&&typeof h=="string"&&g!==void 0){const m=(function(p,y){const _=y.size;if(_===0||_>=p.__size)return null;let b=p.__last,k=null,C=0;for(;b!==null&&C<_;){if(!y.has(b))return null;k=b;const x=Se.get(b);if(x===void 0)return null;b=x.__prev,C++}return C!==_||b!==null&&y.has(b)?null:k})(o,g);if(m!==null){const p=g.size;if(d===0){const y=xu(m,p);let _=m,b=0;for(;_!==null&&b<p;){const v=Se.get(_);if(v===void 0)break;const E=Mt();Gt(_,c),D(v)&&Te===null&&(Te=v.getFormat(),qe=v.getStyle(),Ie=v.__key),ht(E),_=v.__next,b++}let k="";for(_=m,b=0;_!==null&&b<p;){const v=Se.get(_);if(v===void 0)break;let E;if(S(v)){const F=ue._keyToDOMMap.get(_),T=F&&F.__lexicalTextContent;typeof T!="string"&&$(352,v.getType()),E=T}else E=v.getTextContent();k+=E,b<p-1&&S(v)&&!v.isInline()&&(k+=$n),_=v.__next,b++}const C=f.__lexicalSlotTextLength||0,x=C>0?h.slice(C):h,w=x.slice(0,x.length-y)+k;return f.__lexicalTextContent=w,Q=a+w,void Su(o,f,g)}if((function(y,_,b,k,C,x,w,v){if(v!==1&&v!==-1||w!==(v===1?2:1))return!1;const F=w-v;let T=y.__last;for(let ae=0;ae<F-1;ae++){if(T===null)return!1;const Ae=wt.get(T);if(Ae===void 0)return!1;T=Ae.__prev}if(T===null)return!1;const O=Se.get(x),R=wt.get(T);if(O===void 0||R===void 0||O.__prev!==R.__prev)return!1;const L=[];let J=x;for(let ae=0;ae<w;ae++){if(J===null)return!1;L.push(J);const Ae=Se.get(J);J=Ae?Ae.__next:null}const ne=[];J=T;for(let ae=0;ae<F;ae++){if(J===null)return!1;ne.push(J);const Ae=wt.get(J);J=Ae?Ae.__next:null}const oe=new Set(ne),X=new Set(L),I=[];let P=0,W=0;for(;P<F&&W<w;)if(L[W]===ne[P])I.push({key:L[W],kind:"reconcile"}),P++,W++;else if(X.has(ne[P])){if(oe.has(L[W]))return!1;I.push({key:L[W],kind:"create",nextIndex:W}),W++}else I.push({key:ne[P],kind:"destroy"}),P++;for(;P<F;)I.push({key:ne[P++],kind:"destroy"});for(;W<w;)I.push({key:L[W],kind:"create",nextIndex:W}),W++;const ce=xu(T,F);for(const ae of I){const Ae=Mt();if(ae.kind==="reconcile")Gt(ae.key,b.element);else if(ae.kind==="destroy")fn(ae.key,b.element);else{let ft=null;for(let Zn=ae.nextIndex+1;Zn<w;Zn++){const qr=ue._keyToDOMMap.get(L[Zn]);if(qr!==void 0){ft=qr;break}}dn(ae.key,b.withBefore(ft??b.before))}if(ae.kind!=="destroy"){const ft=Se.get(ae.key);ft&&D(ft)&&Te===null&&(Te=ft.getFormat(),qe=ft.getStyle(),Ie=ft.__key)}ht(Ae)}let se="";for(let ae=0;ae<w;ae++){const Ae=Se.get(L[ae]);if(Ae===void 0)return!1;let ft;if(S(Ae)){const Zn=ue._keyToDOMMap.get(L[ae]),qr=Zn&&Zn.__lexicalTextContent;typeof qr!="string"&&$(350,Ae.getType()),ft=qr}else ft=Ae.getTextContent();se+=ft,ae<w-1&&S(Ae)&&!Ae.isInline()&&(se+=$n)}const Fe=k.__lexicalSlotTextLength||0,ct=Fe>0?C.slice(Fe):C;return k.__lexicalTextContent=ct.slice(0,ct.length-ce)+se,!0})(i,0,s,f,h,m,p,d)){const y=f.__lexicalTextContent;return typeof y!="string"&&$(353),Q=a+y,void Su(o,f,g)}}}if(d===0){let m=i.__first,p=0;for(;m!==null;){const y=Se.get(m);if(y===void 0)break;const _=Zt||ii.has(m)||ri.has(m),b=Mt();if(_)Gt(m,c);else{let k,C;if(S(y)){C=On.get(m);const x=C&&C.__lexicalTextContent;typeof x!="string"&&$(354,y.getType()),k=x}else k=y.getTextContent();Q+=k,C!==void 0&&ia(C)}D(y)?Te===null&&(Te=y.getFormat(),qe=y.getStyle(),Ie=y.__key):S(y)&&p<u-1&&!y.isInline()&&(Q+=$n),ht(b),m=y.__next,p++}return f.__lexicalTextContent=Q,f.__lexicalFirstTextKey=Ie,void(Q=a+Q)}}if(l===1&&u===1){const h=i.__first,g=o.__first;if(h===g)Gt(h,c);else{const p=fa(h),y=dn(g,null);try{p.parentNode===c?c.replaceChild(y,p):s.insertChild(y)}catch(_){if(typeof _=="object"&&_!=null){const b=`${_.toString()} Parent: ${c.tagName}, new child: {tag: ${y.tagName} key: ${g}}, old child: {tag: ${p.tagName}, key: ${h}}.`;throw new Error(b)}throw _}fn(h,null)}const m=Se.get(g);D(m)&&Te===null&&(Te=m.getFormat(),qe=m.getStyle(),Ie=m.__key)}else{const h=Ro(i,wt),g=Ro(o,Se);if(h.length!==l&&$(227),g.length!==u&&$(228),l===0)u!==0&&ca(g,o,0,u-1,s);else if(u===0){if(l!==0){const m=s.after==null&&s.before==null&&at(o).size===0&&s.element.__lexicalLineBreak==null;aa(h,0,l-1,m?null:c),m&&(c.textContent="")}}else(function(m,p,y,_,b,k){const C=_-1,x=b-1;let w,v,E=k.getFirstChild(),F=0,T=0;for(;F<=C&&T<=x;){const L=p[F],J=y[T],ne=Mt();if(L===J)E=Ts(Gt(J,k.element)),F++,T++;else{if(v===void 0&&(v=wu(y,T)),w===void 0)w=wu(p,F);else if(!w.has(L)){F++,ht(ne);continue}if(!v.has(L)){E=Ts(fa(L)),fn(L,k.element),F++,w.delete(L),ht(ne);continue}if(w.has(J)){const X=Dr(ue,J);X!==E&&k.withBefore(E??k.before).insertChild(X),E=Ts(Gt(J,k.element)),F++,T++}else dn(J,k.withBefore(E??k.before)),T++}const oe=Se.get(J);oe!==null&&D(oe)?Te===null&&(Te=oe.getFormat(),qe=oe.getStyle(),Ie=oe.__key):S(oe)&&T<=x&&!oe.isInline()&&(Q+=$n),ht(ne)}const O=F>C,R=T>x;if(O&&!R){const L=y[x+1],J=L===void 0?null:ue.getElementByKey(L);ca(y,m,T,x,k.withBefore(J??k.before))}else R&&!O&&aa(p,F,C,k.element)})(o,h,g,l,u,s)}f.__lexicalTextContent=Q,f.__lexicalFirstTextKey=Ie,Q=a+Q})(n,e,xt(e,t,ue)),xe(e)||(r=e,Te==null||Te===r.__textFormat||_o||r.setTextFormat(Te),(function(i){qe==null||qe===i.__textStyle||_o||i.setTextStyle(qe)})(e))}function Su(n,e,t){const r=e.__lexicalFirstTextKey;if(r!=null){const i=n.__key;let o=r;for(;o!==null;){const s=Se.get(o);if(s===void 0){o=null;break}if(s.__parent===i)break;o=s.__parent}if(o!==null&&!t.has(o)){const s=Se.get(r);if(D(s))return Te=s.getFormat(),void(qe=s.getStyle())}}e.__lexicalFirstTextKey=Ie}function Gt(n,e){const t=wt.get(n);let r=Se.get(n);t!==void 0&&r!==void 0||$(61);const i=Zt||ii.has(n)||ri.has(n),o=Dr(ue,n);if(t===r&&!i){let s;if(S(t)){const a=o.__lexicalTextContent;typeof a!="string"&&$(355,t.getType()),s=a,ia(o)}else s=t.getTextContent();return Q+=s,o}if(t!==r&&i&&El(hi,di,Go,r,"updated"),Mn.$updateDOM(r,t,o,ue)){const s=dn(n,null);return e===null&&$(62),e.replaceChild(s,o),fn(n,null),s}if(S(t)){S(r)||$(334,n);const s=r.__indent;(Zt||s!==t.__indent)&&Zf(o,s);const a=r.__format;(Zt||a!==t.__format)&&Qf(o,a);const l=i&&(at(r).size>0||at(t).size>0)?vu(t,r,o):"";if(i){const u=Q;if(Kp(t,r,o),Ne(r)||r.isInline()||rd(0,r,o),l!==""){const c=o.__lexicalTextContent||"";o.__lexicalTextContent=l+c,Q=u+l+c,o.__lexicalSlotTextLength=l.length}else(at(r).size>0||at(t).size>0)&&(o.__lexicalSlotTextLength=0)}else{const u=o.__lexicalTextContent;typeof u!="string"&&$(356,t.getType()),Q+=u,ia(o)}if((Zt||r.__dir!==t.__dir||r.__parent!==t.__parent)&&(la(o,r),Ne(r)&&!Zt))for(const u of r.getChildren())S(u)&&la(Dr(ue,u.getKey()),u)}else{const s=r.getTextContent();if(Z(r)){const a=r.decorate(ue,fi);a!==null&&id(n,a),i&&(at(r).size>0||at(t).size>0)&&vu(t,r,o)}Q+=s}if(!_o&&Ne(r)){const s=r.getLatest();if(s.__cachedText!==Q){const a=s.getWritable();a.__cachedText=Q,r=a}}return Mn.$decorateDOM(r,t,o,ue),Gf(r),o}function id(n,e){let t=ue._pendingDecorators;const r=ue._decorators;if(t===null){if(r[n]===e)return;t=rh(ue)}t[n]=e}function Ts(n){let e=n.nextSibling;return e!==null&&e===ue._blockCursorElement&&(e=e.nextSibling),e}function wu(n,e){const t=new Set;for(let r=e;r<n.length;r++)t.add(n[r]);return t}function Wp(n,e,t,r,i,o){Q="",Te=null,qe=null,Ie=null,Zt=r===2,ue=t,fi=t._config,Mn=t._config.dom||$o,di=t._nodes,Go=ue._listeners.mutation,ri=i,ii=o,wt=n._nodeMap,oa=n,Se=e._nodeMap,_o=e._readOnly,On=Wf(t._keyToDOMMap),sa=(function(){const a=new Map,l=u=>{for(const c of u){const f=Se.get(c);if(f===void 0)continue;const d=f.__parent;if(d===null)continue;let h=a.get(d);h===void 0&&(h=new Set,a.set(d,h)),h.add(c)}};return l(ri.keys()),l(ii),a})();const s=new Map;return hi=s,Gt("root",null),ue=void 0,di=void 0,ri=void 0,ii=void 0,wt=void 0,oa=void 0,Se=void 0,fi=void 0,On=void 0,sa=void 0,hi=void 0,Mn=$o,s}function fa(n){const e=On.get(n);return e===void 0&&$(75,n),e}function B(n){return{type:n}}const jt=B("SELECTION_CHANGE_COMMAND"),od=B("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),Zo=B("CLICK_COMMAND"),sd=B("BEFORE_INPUT_COMMAND"),ad=B("INPUT_COMMAND"),ld=B("COMPOSITION_START_COMMAND"),ud=B("COMPOSITION_END_COMMAND"),hn=B("DELETE_CHARACTER_COMMAND"),gr=B("INSERT_LINE_BREAK_COMMAND"),jn=B("INSERT_PARAGRAPH_COMMAND"),An=B("CONTROLLED_TEXT_INSERTION_COMMAND"),Pr=B("PASTE_COMMAND"),io=B("REMOVE_TEXT_COMMAND"),Sr=B("DELETE_WORD_COMMAND"),wr=B("DELETE_LINE_COMMAND"),Et=B("FORMAT_TEXT_COMMAND"),qp=B("SET_TEXT_FORMAT_COMMAND"),Qo=B("UNDO_COMMAND"),es=B("REDO_COMMAND"),ol=B("KEYDOWN_COMMAND"),sl=B("KEY_ARROW_RIGHT_COMMAND"),cd=B("MOVE_TO_END"),al=B("KEY_ARROW_LEFT_COMMAND"),fd=B("MOVE_TO_START"),ll=B("KEY_ARROW_UP_COMMAND"),ul=B("KEY_ARROW_DOWN_COMMAND"),bo=B("KEY_ENTER_COMMAND"),dd=B("KEY_SPACE_COMMAND"),ts=B("KEY_BACKSPACE_COMMAND"),cl=B("KEY_ESCAPE_COMMAND"),fl=B("KEY_DELETE_COMMAND"),dl=B("KEY_TAB_COMMAND"),Up=B("INSERT_TAB_COMMAND"),Hp=B("INDENT_CONTENT_COMMAND"),Eu=B("OUTDENT_CONTENT_COMMAND"),hd=B("DROP_COMMAND"),gd=B("FORMAT_ELEMENT_COMMAND"),pd=B("DRAGSTART_COMMAND"),md=B("DRAGOVER_COMMAND"),Jp=B("DRAGEND_COMMAND"),$i=B("COPY_COMMAND"),ns=B("CUT_COMMAND"),hl=B("SELECT_ALL_COMMAND"),Vp=B("CLEAR_EDITOR_COMMAND"),Yp=B("CLEAR_HISTORY_COMMAND"),Zr=B("CAN_REDO_COMMAND"),Qr=B("CAN_UNDO_COMMAND"),yd=B("FOCUS_COMMAND"),Xp=B("BLUR_COMMAND"),Gp=B("KEY_MODIFIER_COMMAND");function Zp(n){const e=new Map;return{dispose(){for(const t of e.values())t.dispose();e.clear()},register(t,r){let i=e.get(t);i===void 0&&(i={dispose:n(t,r),holders:new Set},e.set(t,i));const o=()=>{const s=e.get(t);s&&s.holders.delete(o)&&s.holders.size===0&&(e.delete(t),s.dispose())};return i.holders.add(o),o}}}function oi(n,e,t,r){return n.addEventListener(e,t,r),n.removeEventListener.bind(n,e,t,r)}const Vt=Object.freeze({}),da=[["keydown",function(n,e){const t=e._inputState;t.lastKeyDownTimeStamp=n.timeStamp,t.lastKeyCode=n.key,n.key!=="Backspace"&&gi(t),!e.isComposing()&&j(e,ol,n)}],["pointerdown",function(n,e){const t=Pn(n),r=n.pointerType;Ft(t)&&r!=="touch"&&r!=="pen"&&n.button===0&&yt(e,()=>{jo(t,e)||(e._inputState.isSelectionChangeFromMouseDown=!0)})}],["compositionstart",function(n,e){j(e,ld,n)}],["compositionend",function(n,e){const t=e._inputState;$t?t.compositionPhase="ending-firefox":mn||!Ei&&!Ti?j(e,ud,n):(t.compositionPhase="ending-safari",t.compositionEndData=n.data)}],["input",function(n,e){n.stopPropagation();const t=e._inputState;gi(t),yt(e,()=>{xd(n,e)||e.dispatchCommand(ad,n)},{event:n}),t.unprocessedBeforeInputData=null}],["click",function(n,e){yt(e,()=>{const t=A(),r=Oe(st(e)),i=lt();if(r){if(N(t)){const o=t.anchor,s=o.getNode();o.type==="element"&&o.offset===0&&t.isCollapsed()&&!Ne(s)&&de().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&i!==null&&t.is(i)&&(r.removeAllRanges(),t.dirty=!0)}else if(n.pointerType==="touch"||n.pointerType==="pen"){const o=it(r,e._rootElement).anchorNode;(K(o)||ot(o))&&me(mi(i,r,e,n))}}if($t&&r!==null&&r.rangeCount===0){const o=e._rootElement;if(o!==null&&n.target===o){const s=n.clientY;let a=o.childNodes.length;for(let u=0;u<o.childNodes.length;u++){const c=o.childNodes[u];if(K(c)){const f=c.getBoundingClientRect();if(s<=(f.top+f.bottom)/2){a=u;break}}}r.setBaseAndExtent(o,a,o,a);const l=mi(i,r,e,n);l!==null?me(l):r.removeAllRanges()}}j(e,Zo,n)})}],["cut",Vt],["copy",Vt],["dragstart",Vt],["dragover",Vt],["dragend",Vt],["paste",Vt],["focus",Vt],["blur",Vt],["drop",Vt]];vr&&da.push(["beforeinput",(n,e)=>(function(t,r){const i=t.inputType;i==="deleteCompositionText"||$t&&ah(r)||i!=="insertCompositionText"&&yt(r,()=>{xd(t,r)||j(r,sd,t)},{event:t})})(n,e)]);const ha=new WeakMap,ko=new WeakMap,Qp=Zp(n=>(n.addEventListener("selectionchange",Fu),()=>n.removeEventListener("selectionchange",Fu)));function _d(n,e,t,r,i,o){const s=n.anchor,a=n.focus,l=s.getNode(),u=fe();let c;if(o!==void 0)c=o;else{const m=Oe(st(u));c=m!==null?it(m,u._rootElement):null}const f=c!==null?c.anchorNode:null,d=s.key,h=u.getElementByKey(d),g=t.length;return d!==a.key||!D(l)||(!i&&(!vr||u._inputState.lastBeforeInputInsertTextTimeStamp<r+50)||l.isDirty()&&g<2||ih(t))&&s.offset!==a.offset&&!l.isComposing()||_t(l)||l.isDirty()&&g>1||(i||!vr)&&h!==null&&!l.isComposing()&&f!==pn(l,h,u)||c!==null&&e!==null&&(!e.collapsed||e.startContainer!==c.anchorNode||e.startOffset!==c.anchorOffset)||!l.isComposing()&&(l.getFormat()!==n.format||l.getStyle()!==n.style)||(function(m,p){if(p.isSegmented())return!0;if(!m.isCollapsed())return!1;const y=m.anchor.offset,_=p.getParentOrThrow(),b=Fo(p);return y===0?!p.canInsertTextBefore()||!_.canInsertTextBefore()&&!p.isComposing()||b||(function(k){const C=k.getPreviousSibling();return(D(C)||S(C)&&C.isInline())&&!C.canInsertTextAfter()})(p):y===p.getTextContentSize()&&(!p.canInsertTextAfter()||!_.canInsertTextAfter()&&!p.isComposing()||b)})(n,l)}function Tu(n,e){return ot(n)&&n.nodeValue!==null&&e!==0&&e!==n.nodeValue.length}function Nu(n,e,t){const{anchorNode:r,anchorOffset:i,focusNode:o,focusOffset:s}=it(n,e._rootElement),a=e._inputState;a.isSelectionChangeFromDOMUpdate&&(a.isSelectionChangeFromDOMUpdate=!1,Tu(r,i)&&Tu(o,s)&&!a.postDeleteSelectionToRestore)||yt(e,()=>{if(!t)return void me(null);if(!zi(e,r,o))return;let l=A();if(a.postDeleteSelectionToRestore&&N(l)&&l.isCollapsed()){const u=l.anchor,c=a.postDeleteSelectionToRestore.anchor;(u.key===c.key&&u.offset===c.offset+1||u.offset===1&&c.getNode().is(u.getNode().getPreviousSibling()))&&(l=a.postDeleteSelectionToRestore.clone(),me(l))}if(a.postDeleteSelectionToRestore=null,N(l)){const u=l.anchor,c=u.getNode();if(l.isCollapsed()){n.type==="Range"&&r===o&&(l.dirty=!0);const f=st(e).event,d=f?f.timeStamp:performance.now(),{format:h,style:g,offset:m,key:p,timeStamp:y}=a.collapsedSelectionFormat,_=de(),b=e.isComposing()===!1&&_.getTextContent()==="";if(d<y+200&&u.offset===m&&u.key===p)oo(l,h,g);else if(u.type==="text")D(c)||$(141),bd(l,c);else if(u.type==="element"&&!b){S(c)||$(259);const k=u.getNode();k.isEmpty()?(function(C,x){const w=x.getTextFormat(),v=x.getTextStyle();oo(C,w,v)})(l,k):oo(l,l.format,"")}}else{const f=u.key,d=l.focus.key,h=l.getNodes(),g=h.length,m=l.isBackward(),p=m?s:i,y=m?i:s,_=m?d:f,b=m?f:d;let k=2047,C=!1;for(let x=0;x<g;x++){const w=h[x],v=w.getTextContentSize();if(D(w)&&v!==0&&!(x===0&&w.__key===_&&p===v||x===g-1&&w.__key===b&&y===0)&&(C=!0,k&=w.getFormat(),k===0))break}l.format=C?k:0}}j(e,jt)})}function oo(n,e,t){n.format===e&&n.style===t||(n.format=e,n.style=t,n.dirty=!0)}function bd(n,e){oo(n,e.getFormat(),e.getStyle())}function kd(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function Du(n){const{lastKeyCode:e}=fe()._inputState;if(n==null||n.length<=1||e==null)return;const t=e.length===1?e:e==="Enter"?`
|
|
4
4
|
`:e==="Tab"?" ":null;if(!t)return;const r=A();if(!N(r)||!r.isCollapsed())return;const i=r.anchor.getNode();if(!D(i))return;const{offset:o}=r.anchor;if(i.getTextContentSize()===o){const s=i.getNextSibling();if(t===`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as t}from"./index-
|
|
1
|
+
import{c as t}from"./index-3eAE16lF.js";const e=t("RotateCcw",[["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"}]]);export{e as R};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,j as l,B as b,b as y,al as x}from"./index-
|
|
1
|
+
import{r as e,j as l,B as b,b as y,al as x}from"./index-3eAE16lF.js";const i=()=>l.jsx(x,{className:"size-3.5 animate-spin"}),m=(s,n)=>n?l.jsx("span",{className:"sr-only",children:s}):s;function p({actions:s=[],destructive:n,className:o}){const[f,r]=e.useState(!1);return f&&n?.confirm?l.jsxs("div",{className:y("flex items-center gap-2",o),children:[l.jsx("span",{className:"text-xs text-fg-muted",children:n.confirm.prompt}),l.jsx(b,{variant:"secondary",size:"sm",onClick:()=>r(!1),children:n.confirm.cancelLabel??"Cancel"}),l.jsx(b,{variant:"danger",size:"sm","aria-busy":n.busy,icon:n.busy?i():void 0,onClick:()=>{n.busy||n.onClick()},children:n.busy?n.busyLabel??"Working…":n.confirm.confirmLabel??n.label})]}):l.jsxs("div",{className:y("flex items-center gap-2",o),children:[s.map(a=>l.jsx(b,{variant:a.variant??"ghost",size:"sm","aria-busy":a.busy,"aria-label":a.iconOnly?a.label:void 0,icon:a.busy?i():a.icon,onClick:()=>{a.busy||a.onClick()},children:a.busy&&a.busyLabel?a.busyLabel:m(a.label,a.iconOnly)},a.label)),n&&l.jsx(b,{variant:"ghost",size:"sm","aria-busy":n.busy,"aria-label":n.iconOnly?n.label:void 0,icon:n.busy?i():n.icon,onClick:()=>{if(!n.busy){if(n.confirm){r(!0);return}n.onClick()}},children:n.busy&&n.busyLabel?n.busyLabel:m(n.label,n.iconOnly)})]})}export{p as R};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c8 as a,
|
|
1
|
+
import{c8 as a,cX as c,cY as d}from"./index-3eAE16lF.js";function p(e){const t=a({warn:e?.router===void 0}),o=e?.router||t;return c(o.stores.__store,d(e,o))}const n="/mail/brief",s="/mail/$mailboxId",u="/mail/outbox",l="/mail/flagged";function i(e){for(const t of e){if(t.routeId===n)return{list:"brief"};if(t.routeId===l)return{list:"flagged"};if(t.routeId===u)return{list:"outbox"};if(t.routeId===s)return{list:"mailbox",mailboxId:t.params?.mailboxId}}}function _(e){const t=i(e);if(!t)return"";switch(t.list){case"mailbox":return t.mailboxId?f(t.mailboxId):"";case"flagged":return l;case"outbox":return u;case"brief":return n}}function f(e){return`${s}:${e}`}function g(e,t){return e===t?!0:e.startsWith(`${t}/`)}function R(e){const t=e.split(/[?#]/)[0].split("/").filter(Boolean);return t[0]==="mail"&&t.length>2}const r="search-scope";function b(e){const t=e.trim().replace(/\s+/g," ").toLowerCase();return/\s/.test(t)?`in:"${t}"`:`in:${t}`}function m(e){const t=i(e);return t!==void 0&&t.list!=="brief"}function I(e){const t=i(e);return t?.list==="mailbox"?t.mailboxId:void 0}function M(e){const t=I(e.matches);return t||(m(e.matches)?e.callerMailboxId:e.callerMailboxId??e.inTokenMailboxId)}function S(e,t){const o=i(e);return o?.list==="flagged"?{kind:"scoped",chip:{id:r,label:"is:starred"}}:o?.list==="outbox"?{kind:"scoped",chip:{id:r,label:"in:outbox"}}:o?.list==="mailbox"?t?{kind:"scoped",chip:{id:r,label:b(t)}}:{kind:"pending"}:{kind:"global"}}function h(e,t,o){return t.kind==="global"?{kind:"global"}:i(e)?.list==="flagged"?{kind:"collection"}:{kind:"folder",...o?{role:o}:{}}}export{r as S,g as a,h as b,S as c,m as i,R as l,_ as m,I as r,M as s,p as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as A,r as u,j as m,g as V,b as I,cJ as z,X as G,J as N,z as j,l as $,s as J,t as F,v as q,y as X,D as W,o as Y,n as Z,cK as ee,cL as te,cM as ne,cm as M}from"./index-DTvNcUjW.js";import{u as oe,c as re,S as se}from"./search-scope-BISSOSj6.js";import{a as R,D as ie}from"./useMediaQuery-CYQ86-Hp.js";const Pe=A("BellOff",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]);const Ke=A("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),ae=[{action:"focusNext",keys:["j","k"],label:"navigate"},{action:"muteSender",keys:["m"],label:"mute"},{action:"help",keys:["?"],label:"all shortcuts"}];function Le(e){return ae.filter(t=>e[t.action]!==void 0)}const ce=[{title:"Navigation",hints:[{action:"focusNext",keys:["j"],description:"Focus next message"},{action:"focusPrevious",keys:["k"],description:"Focus previous message"},{action:"focusNext",keys:["↓"],description:"Focus next message"},{action:"focusPrevious",keys:["↑"],description:"Focus previous message"},{action:"focusFirst",keys:["Home"],description:"Focus first"},{action:"focusLast",keys:["End"],description:"Focus last"},{action:"openFocused",keys:["Enter"],description:"Open focused thread"},{action:"back",keys:["Esc"],description:"Back / close overlay"}]},{title:"Selection",hints:[{action:"toggleSelect",keys:["x"],description:"Toggle select"},{action:"toggleSelect",keys:["Space"],description:"Toggle select"},{action:"extendSelectDown",keys:["Shift","j"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","k"],description:"Extend selection up"},{action:"extendSelectDown",keys:["Shift","↓"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","↑"],description:"Extend selection up"},{action:"selectAll",keys:["⌘","A"],description:"Select all"}]},{title:"Actions",hints:[{action:"reply",keys:["r"],description:"Reply"},{action:"replyAll",keys:["a"],description:"Reply all"},{action:"forward",keys:["f"],description:"Forward"},{action:"delete",keys:["#"],description:"Delete"},{action:"toggleStar",keys:["s"],description:"Star / unstar"},{action:"toggleRead",keys:["u"],description:"Toggle read / unread"}]},{title:"Sender",hints:[{action:"muteSender",keys:["m"],description:"Mute sender"},{action:"blockSender",keys:["b"],description:"Block sender"},{action:"vipSender",keys:["v"],description:"VIP sender"},{action:"markJunk",keys:["!"],description:"Mark junk"}]},{title:"Go to",hints:[{action:"goBrief",keys:["g","b"],description:"Daily brief"},{action:"goInbox",keys:["g","i"],description:"Inbox"},{action:"goSent",keys:["g","s"],description:"Sent"},{action:"goFlagged",keys:["g","f"],description:"Starred"},{action:"goSettings",keys:["g",","],description:"Settings"}]},{title:"View & global",hints:[{action:"toggleIntelligence",keys:["i"],description:"Toggle intelligence"},{action:"toggleDensity",keys:["d"],description:"Toggle density"},{action:"focusSearch",keys:["/"],description:"Focus search"},{action:"compose",keys:["c"],description:"Compose"},{action:"compose",keys:["⌘","N"],description:"Compose"},{action:"help",keys:["?"],description:"Shortcut help"}]}];function le(e){for(const t of ce){const n=t.hints.find(r=>r.action===e);if(n)return n.keys}}function ue(e){const t=le(e);return!t||t.length===0?"":t.length===1?t[0]??"":t[0]==="g"?t.join(" then "):t.join("")}function Me(e){const t=ue(e);return t===""?"":`(${t})`}const b={action:null,nextPrefix:null,preventDefault:!1},fe={b:"goBrief",i:"goInbox",s:"goSent",f:"goFlagged",",":"goSettings"},de={j:{action:"focusNext"},k:{action:"focusPrevious"},arrowdown:{action:"focusNext"},arrowup:{action:"focusPrevious"},home:{action:"focusFirst"},end:{action:"focusLast"},enter:{action:"openFocused"}," ":{action:"toggleSelect"},delete:{action:"delete"},backspace:{action:"delete"},u:{action:"toggleRead"},x:{action:"toggleSelect"},r:{action:"reply"},a:{action:"replyAll"},f:{action:"forward"},"#":{action:"delete"},s:{action:"toggleStar"},m:{action:"muteSender"},b:{action:"blockSender"},v:{action:"vipSender"},"!":{action:"markJunk"},i:{action:"toggleIntelligence"},d:{action:"toggleDensity"},"/":{action:"focusSearch"},c:{action:"compose"},"?":{action:"help"}};function pe(e,t){const n=e.key.toLowerCase(),r=e.metaKey||e.ctrlKey;if(e.inEditable)return{...b,nextPrefix:t==="g"?null:t};if(e.onControl&&(n==="enter"||n===" "))return{...b,nextPrefix:t==="g"?null:t};if(r&&n==="n")return{action:"compose",nextPrefix:null,preventDefault:!0};if(r&&n==="a")return{action:"selectAll",nextPrefix:null,preventDefault:!0};if(r)return{...b,nextPrefix:t==="g"?null:t};if(n==="escape")return{action:"back",nextPrefix:null,preventDefault:!1};if(t==="g"){const a=fe[n===","?",":n]??null;return{action:a,nextPrefix:null,preventDefault:a!==null}}if(n==="g"&&!e.shiftKey)return{action:null,nextPrefix:"g",preventDefault:!0};if(e.shiftKey){const s=n==="j"||n==="arrowdown";if(s||(n==="k"||n==="arrowup"))return{action:s?"extendSelectDown":"extendSelectUp",nextPrefix:null,preventDefault:!0}}const o=de[n];if(o){const s=o.requireShift===!0,a=n.length===1&&!/[a-z0-9]/.test(n);return!s&&e.shiftKey&&!a?b:{action:o.action,nextPrefix:null,preventDefault:!0}}return b}function me(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable}const he="data-message-row",ye='button, a[href], summary, [role="button"], [role="menuitem"], [role="tab"], [role="switch"], [role="checkbox"]';function ge(e){if(!(e instanceof HTMLElement))return!1;const t=e.closest(ye);return t?!t.hasAttribute(he):!1}function xe({key:e,shiftKey:t=!1,repeat:n=!1,caretAtStart:r,hasValue:o,chipCount:s}){const a=s-1;return e==="Escape"?o?{type:"clearQuery"}:{type:"blur"}:e==="Tab"&&t?s===0?{type:"none"}:{type:"focusChip",index:a}:e==="Backspace"||e==="ArrowLeft"?!r||s===0?{type:"none"}:n?{type:"none"}:{type:"focusChip",index:a}:{type:"none"}}function be({key:e,repeat:t=!1,index:n,chipCount:r}){return e==="Backspace"||e==="Delete"?t?{type:"none"}:{type:"removeChip",index:n}:e==="ArrowLeft"?n===0?{type:"none"}:{type:"focusChip",index:n-1}:e==="ArrowRight"?n>=r-1?{type:"focusInput"}:{type:"focusChip",index:n+1}:e==="Enter"||e===" "?{type:"activateChip",index:n}:e==="Escape"?{type:"focusInput"}:{type:"none"}}function ke(e,t){const n=t-1;return n<=0?null:e<n?e:n-1}const we=e=>e instanceof HTMLElement?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable:!1,Se=({chips:e=[],onRemoveChip:t,value:n,onChange:r,onClear:o,onClearQuery:s,placeholder:a="Search mail...",globalFocusKey:c=!0,showClearButton:f=!0,size:h="sm",inputId:p,suggest:d,className:x})=>{const O=u.useId(),T=p??O,k=u.useRef(null),D=u.useRef([]),P=s??o,[K,w]=u.useState(null),C=u.useRef(void 0),[B,H]=u.useState(""),v=e.length>0;u.useEffect(()=>{w(i=>i!==null&&i>=e.length?null:i)},[e.length]),u.useEffect(()=>{const i=C.current;if(i!==void 0){if(C.current=void 0,i===null){k.current?.focus();return}D.current[i]?.focus()}});const L=u.useRef(void 0);u.useEffect(()=>{const i=d?.caret;if(!i||i===L.current)return;L.current=i;const l=k.current;!l||l.ownerDocument.activeElement!==l||(l.setSelectionRange(i.cursor,i.cursor),d?.onCaretChange(i.cursor))});const S=i=>{d?.onCaretChange(i.selectionStart??i.value.length)},y=u.useCallback(i=>{w(i),C.current=i},[]),E=u.useCallback(i=>{const l=e[i];l&&t&&(y(ke(i,e.length)),H(`${l.label} removed`),t(l.id))},[e,t,y]),_=u.useCallback(()=>{y(null),o()},[o,y]),U=u.useCallback(i=>{const l=i.currentTarget;if(d?.onKeyDown(i))return;const g=xe({key:i.key,shiftKey:i.shiftKey,repeat:i.repeat,caretAtStart:l.selectionStart===0&&l.selectionEnd===0,hasValue:n.length>0,chipCount:e.length});switch(g.type){case"focusChip":i.preventDefault(),y(g.index);return;case"clearQuery":P();return;case"blur":l.blur();return;case"none":return}},[e.length,n,P,y,d]),Q=u.useCallback(i=>l=>{const g=be({key:l.key,repeat:l.repeat,index:i,chipCount:e.length});switch(g.type!=="none"&&l.preventDefault(),g.type){case"removeChip":E(g.index);return;case"focusChip":y(g.index);return;case"focusInput":y(null);return;case"activateChip":return;case"none":return}},[e,E,y]);return u.useEffect(()=>{if(!c)return;const i=l=>{l.key!=="/"||l.metaKey||l.ctrlKey||l.altKey||we(l.target)||(l.preventDefault(),k.current?.focus())};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[c]),m.jsxs("label",{htmlFor:T,className:I("flex w-full items-center gap-1.5 text-sm","bg-surface-sunken/50 border border-transparent","focus-within:bg-canvas focus-within:border-line focus-within:ring-2 focus-within:ring-ring","transition-colors",h==="lg"?"rounded-xl px-4 py-2":"rounded-md px-2.5 py-1",x),children:[m.jsx(V,{className:I("shrink-0 text-fg-muted pointer-events-none",h==="lg"?"size-5":"size-4")}),m.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:[v&&m.jsx("div",{role:"grid","aria-label":"Search filters",className:"flex min-w-0 flex-wrap items-center gap-1",children:e.map((i,l)=>m.jsx(z,{ref:g=>{D.current[l]=g},label:i.label,tone:i.tone,focused:K===l,onFocusLabel:()=>w(l),onKeyDown:Q(l),onRemove:()=>E(l)},i.id))}),m.jsx("input",{ref:k,id:T,name:"q",type:"text","aria-label":"Search mail",autoComplete:"off",value:n,tabIndex:K===null?0:-1,onChange:i=>{r(i.target.value),S(i.target)},onKeyDown:U,onKeyUp:i=>S(i.currentTarget),onClick:i=>S(i.currentTarget),onFocus:i=>{w(null),d?.onFocusChange?.(!0),S(i.currentTarget)},onBlur:()=>d?.onFocusChange?.(!1),...d?.comboboxProps,placeholder:v?void 0:a,className:"min-w-24 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-muted"})]}),(n||v)&&f&&m.jsx("button",{type:"button",onClick:_,className:"shrink-0 rounded p-0.5 hover:bg-surface-raised transition-colors","aria-label":"Clear search",children:m.jsx(G,{className:I("text-fg-muted",h==="lg"?"size-5":"size-4")})}),m.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:B})]})},Re=({value:e,onChange:t,onClear:n,onClearQuery:r,chips:o,onRemoveChip:s,placeholder:a="Search mail...",globalFocusKey:c=!0,showClearButton:f=!0,size:h,inputId:p,suggest:d,className:x})=>m.jsx(Se,{value:e,onChange:t,onClear:n,onClearQuery:r,chips:o,onRemoveChip:s,placeholder:a,globalFocusKey:c,showClearButton:f,size:h,inputId:p,suggest:d,className:x});function Ae({handlers:e,enabled:t=!0,target:n,sequenceTimeoutMs:r=1e3}){const o=u.useRef(e);o.current=e;const s=u.useRef(null),a=u.useRef(null);u.useEffect(()=>{if(!t)return;const c=()=>{a.current!==null&&(clearTimeout(a.current),a.current=null)},f=p=>{const d=pe({key:p.key,shiftKey:p.shiftKey,metaKey:p.metaKey,ctrlKey:p.ctrlKey,altKey:p.altKey,inEditable:me(p.target),onControl:ge(p.target)},s.current);if(c(),s.current=d.nextPrefix,d.nextPrefix!==null&&(a.current=setTimeout(()=>{s.current=null,a.current=null},r)),d.action===null)return;const x=o.current[d.action];x&&(d.preventDefault&&p.preventDefault(),x())},h=n===void 0?window:n;if(h!==null)return h.addEventListener("keydown",f),()=>{h.removeEventListener("keydown",f),c(),s.current=null}},[t,r,n])}const je=({trigger:e,children:t,align:n="right"})=>{const[r,o]=u.useState(!1),s=u.useRef(null),a=u.useCallback(f=>{s.current&&!s.current.contains(f.target)&&o(!1)},[]),c=u.useCallback(f=>{f.key==="Escape"&&o(!1)},[]);return u.useEffect(()=>(r&&(document.addEventListener("mousedown",a),document.addEventListener("keydown",c)),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",c)}),[r,a,c]),m.jsxs("div",{ref:s,className:"relative",children:[m.jsx("button",{type:"button",onClick:f=>{f.stopPropagation(),o(!r)},className:N("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}),r&&m.jsx("div",{className:N("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})]})},Fe=({onClick:e,disabled:t,destructive:n,children:r})=>m.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t||e()},disabled:t,className:N("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:r}),qe=()=>m.jsx("div",{className:"my-1 h-px bg-line"}),Ce=({accounts:e})=>{const t=j({strict:!1}),n=$(),r=t.mailboxId,{t:o}=J("mail",{useSuspense:!1}),s=u.useCallback((c,f)=>o(c,{defaultValue:f}),[o]),a=F({queries:e.map(c=>({...q({path:{accountId:c.accountId}}),staleTime:1/0}))});if(n.pathname.startsWith("/mail/outbox"))return"Outbox";if(!r)return null;for(let c=0;c<e.length;c++){const f=a[c]?.data?.items;if(!f)continue;const h=f.find(d=>d.mailboxId===r);if(!h)continue;const p=X(e[c].folderAppointments);return W(h,p.get(r),s)}return null},Oe=({accounts:e})=>{const n=j({strict:!1}).mailboxId,r=F({queries:e.map(o=>({...q({path:{accountId:o.accountId}}),staleTime:1/0}))});if(!n)return null;for(const o of r){const s=o.data?.items;if(!s)continue;const a=s.find(c=>c.mailboxId===n);if(a)return a.unseenCount}return null};function Be(e){const t=Y(),{searchInput:n}=Z(),r=Ce({accounts:e}),o=oe({select:c=>c.matches}),s=re(o,r),a=u.useCallback(c=>{c===se&&t({to:"/mail/brief",search:{q:n||void 0}})},[t,n]);return{scope:s,clearScope:a}}const ve=["intelligence","nav","shortcuts","filters"];ee(ve);const Ee=te(ne);function He({fragment:e,...t}){return m.jsx(Ee,{...t,hash:e})}const _e=({enabled:e=!0,bindings:t,capture:n=!1})=>{const r=u.useCallback(o=>{const s=o.target;if(!(s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.isContentEditable))for(const a of t){if(!(o.key.toLowerCase()===a.key.toLowerCase())||a.requireShift!==void 0&&a.requireShift!==o.shiftKey)continue;const f=o.ctrlKey||o.metaKey;if(a.requireMeta!==void 0){if(a.requireMeta!==f)continue}else{const h=a.noModifiers??!0,p=f||o.altKey||a.requireShift===void 0&&o.shiftKey;if(h&&p)continue}a.preventDefault&&o.preventDefault(),a.stopPropagation&&(o.stopPropagation(),o.stopImmediatePropagation()),a.handler(o);return}},[t]);u.useEffect(()=>{if(e)return window.addEventListener("keydown",r,n),()=>window.removeEventListener("keydown",r,n)},[e,r,n])},Ie=768,Ue=e=>e!=="desktop",Qe=()=>{const e=R(`(min-width: ${Ie}px)`);return R(ie)?"desktop":e?"tablet":"phone"};function Ve(e){const t=new Map;for(const n of e){const r=n.email.toLowerCase(),o=r.split("@")[0];o&&!t.has(o)&&t.set(o,n.accountId),t.has(r)||t.set(r,n.accountId)}return t}function ze(e){const t=new Map;for(const n of e)for(const r of n){const o=r.fullPath?.toLowerCase();if(!o)continue;const s=o.split("/").pop();t.has(o)||t.set(o,r.mailboxId),s&&!t.has(s)&&t.set(s,r.mailboxId)}return t}function Ge(e,t=[]){const n=e.flat().filter(s=>s.fullPath),r=new Map;for(const s of n){const a=M(s.fullPath).toLowerCase();r.set(a,(r.get(a)??0)+1)}const o=new Map(t.map(s=>[s.accountId,s.email]));return n.map(s=>{const a=M(s.fullPath),c=r.get(a.toLowerCase())===1,f=t.length>1?o.get(s.accountId):void 0;return{value:c?a:s.fullPath,label:s.displayNameOverride?.trim()||a,...f?{hint:f}:{}}})}function $e(e){const t=new Map;for(const n of e){const r=n.email.toLowerCase().split("@")[0]??"";t.set(r,(t.get(r)??0)+1)}return e.map(n=>{const r=n.email.split("@")[0]??n.email,o=t.get(r.toLowerCase())===1,s=n.displayName?.trim();return{value:o?r:n.email,label:s||n.email,...s?{hint:n.email}:{}}})}export{Pe as B,je as D,ce as K,He as N,Ke as R,Re as S,qe as a,Fe as b,ze as c,Qe as d,_e as e,Ae as f,Ve as g,Ce as h,Ue as i,Oe as j,ae as k,Le as l,he as m,Ge as n,$e as o,ue as s,Me as t,Be as u};
|
|
1
|
+
import{c as A,r as u,j as m,g as V,b as I,cK as z,X as G,J as N,z as j,l as $,s as X,t as F,v as q,y as J,D as W,o as Y,n as Z,cL as ee,cM as te,cN as ne,cm as M}from"./index-3eAE16lF.js";import{u as oe,c as re,S as se}from"./search-scope-Bcn1kzwd.js";import{a as R,D as ie}from"./useMediaQuery-vS62WMhd.js";const Pe=A("BellOff",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]);const Ke=A("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),ae=[{action:"focusNext",keys:["j","k"],label:"navigate"},{action:"muteSender",keys:["m"],label:"mute"},{action:"help",keys:["?"],label:"all shortcuts"}];function Le(e){return ae.filter(t=>e[t.action]!==void 0)}const ce=[{title:"Navigation",hints:[{action:"focusNext",keys:["j"],description:"Focus next message"},{action:"focusPrevious",keys:["k"],description:"Focus previous message"},{action:"focusNext",keys:["↓"],description:"Focus next message"},{action:"focusPrevious",keys:["↑"],description:"Focus previous message"},{action:"focusFirst",keys:["Home"],description:"Focus first"},{action:"focusLast",keys:["End"],description:"Focus last"},{action:"openFocused",keys:["Enter"],description:"Open focused thread"},{action:"back",keys:["Esc"],description:"Back / close overlay"}]},{title:"Selection",hints:[{action:"toggleSelect",keys:["x"],description:"Toggle select"},{action:"toggleSelect",keys:["Space"],description:"Toggle select"},{action:"extendSelectDown",keys:["Shift","j"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","k"],description:"Extend selection up"},{action:"extendSelectDown",keys:["Shift","↓"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","↑"],description:"Extend selection up"},{action:"selectAll",keys:["⌘","A"],description:"Select all"}]},{title:"Actions",hints:[{action:"reply",keys:["r"],description:"Reply"},{action:"replyAll",keys:["a"],description:"Reply all"},{action:"forward",keys:["f"],description:"Forward"},{action:"delete",keys:["#"],description:"Delete"},{action:"toggleStar",keys:["s"],description:"Star / unstar"},{action:"toggleRead",keys:["u"],description:"Toggle read / unread"}]},{title:"Sender",hints:[{action:"muteSender",keys:["m"],description:"Mute sender"},{action:"blockSender",keys:["b"],description:"Block sender"},{action:"vipSender",keys:["v"],description:"VIP sender"},{action:"markJunk",keys:["!"],description:"Mark junk"}]},{title:"Go to",hints:[{action:"goBrief",keys:["g","b"],description:"Daily brief"},{action:"goInbox",keys:["g","i"],description:"Inbox"},{action:"goSent",keys:["g","s"],description:"Sent"},{action:"goFlagged",keys:["g","f"],description:"Starred"},{action:"goSettings",keys:["g",","],description:"Settings"}]},{title:"View & global",hints:[{action:"toggleIntelligence",keys:["i"],description:"Toggle intelligence"},{action:"toggleDensity",keys:["d"],description:"Toggle density"},{action:"focusSearch",keys:["/"],description:"Focus search"},{action:"compose",keys:["c"],description:"Compose"},{action:"compose",keys:["⌘","N"],description:"Compose"},{action:"help",keys:["?"],description:"Shortcut help"}]}];function le(e){for(const t of ce){const n=t.hints.find(r=>r.action===e);if(n)return n.keys}}function ue(e){const t=le(e);return!t||t.length===0?"":t.length===1?t[0]??"":t[0]==="g"?t.join(" then "):t.join("")}function Me(e){const t=ue(e);return t===""?"":`(${t})`}const b={action:null,nextPrefix:null,preventDefault:!1},fe={b:"goBrief",i:"goInbox",s:"goSent",f:"goFlagged",",":"goSettings"},de={j:{action:"focusNext"},k:{action:"focusPrevious"},arrowdown:{action:"focusNext"},arrowup:{action:"focusPrevious"},home:{action:"focusFirst"},end:{action:"focusLast"},enter:{action:"openFocused"}," ":{action:"toggleSelect"},delete:{action:"delete"},backspace:{action:"delete"},u:{action:"toggleRead"},x:{action:"toggleSelect"},r:{action:"reply"},a:{action:"replyAll"},f:{action:"forward"},"#":{action:"delete"},s:{action:"toggleStar"},m:{action:"muteSender"},b:{action:"blockSender"},v:{action:"vipSender"},"!":{action:"markJunk"},i:{action:"toggleIntelligence"},d:{action:"toggleDensity"},"/":{action:"focusSearch"},c:{action:"compose"},"?":{action:"help"}};function pe(e,t){const n=e.key.toLowerCase(),r=e.metaKey||e.ctrlKey;if(e.inEditable)return{...b,nextPrefix:t==="g"?null:t};if(e.onControl&&(n==="enter"||n===" "))return{...b,nextPrefix:t==="g"?null:t};if(r&&n==="n")return{action:"compose",nextPrefix:null,preventDefault:!0};if(r&&n==="a")return{action:"selectAll",nextPrefix:null,preventDefault:!0};if(r)return{...b,nextPrefix:t==="g"?null:t};if(n==="escape")return{action:"back",nextPrefix:null,preventDefault:!1};if(t==="g"){const a=fe[n===","?",":n]??null;return{action:a,nextPrefix:null,preventDefault:a!==null}}if(n==="g"&&!e.shiftKey)return{action:null,nextPrefix:"g",preventDefault:!0};if(e.shiftKey){const s=n==="j"||n==="arrowdown";if(s||(n==="k"||n==="arrowup"))return{action:s?"extendSelectDown":"extendSelectUp",nextPrefix:null,preventDefault:!0}}const o=de[n];if(o){const s=o.requireShift===!0,a=n.length===1&&!/[a-z0-9]/.test(n);return!s&&e.shiftKey&&!a?b:{action:o.action,nextPrefix:null,preventDefault:!0}}return b}function me(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable}const he="data-message-row",ye='button, a[href], summary, [role="button"], [role="menuitem"], [role="tab"], [role="switch"], [role="checkbox"]';function ge(e){if(!(e instanceof HTMLElement))return!1;const t=e.closest(ye);return t?!t.hasAttribute(he):!1}function xe({key:e,shiftKey:t=!1,repeat:n=!1,caretAtStart:r,hasValue:o,chipCount:s}){const a=s-1;return e==="Escape"?o?{type:"clearQuery"}:{type:"blur"}:e==="Tab"&&t?s===0?{type:"none"}:{type:"focusChip",index:a}:e==="Backspace"||e==="ArrowLeft"?!r||s===0?{type:"none"}:n?{type:"none"}:{type:"focusChip",index:a}:{type:"none"}}function be({key:e,repeat:t=!1,index:n,chipCount:r}){return e==="Backspace"||e==="Delete"?t?{type:"none"}:{type:"removeChip",index:n}:e==="ArrowLeft"?n===0?{type:"none"}:{type:"focusChip",index:n-1}:e==="ArrowRight"?n>=r-1?{type:"focusInput"}:{type:"focusChip",index:n+1}:e==="Enter"||e===" "?{type:"activateChip",index:n}:e==="Escape"?{type:"focusInput"}:{type:"none"}}function ke(e,t){const n=t-1;return n<=0?null:e<n?e:n-1}const we=e=>e instanceof HTMLElement?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable:!1,Se=({chips:e=[],onRemoveChip:t,value:n,onChange:r,onClear:o,onClearQuery:s,placeholder:a="Search mail...",globalFocusKey:c=!0,showClearButton:f=!0,size:h="sm",inputId:p,suggest:d,className:x})=>{const O=u.useId(),T=p??O,k=u.useRef(null),D=u.useRef([]),P=s??o,[K,w]=u.useState(null),C=u.useRef(void 0),[B,H]=u.useState(""),v=e.length>0;u.useEffect(()=>{w(i=>i!==null&&i>=e.length?null:i)},[e.length]),u.useEffect(()=>{const i=C.current;if(i!==void 0){if(C.current=void 0,i===null){k.current?.focus();return}D.current[i]?.focus()}});const L=u.useRef(void 0);u.useEffect(()=>{const i=d?.caret;if(!i||i===L.current)return;L.current=i;const l=k.current;!l||l.ownerDocument.activeElement!==l||(l.setSelectionRange(i.cursor,i.cursor),d?.onCaretChange(i.cursor))});const S=i=>{d?.onCaretChange(i.selectionStart??i.value.length)},y=u.useCallback(i=>{w(i),C.current=i},[]),E=u.useCallback(i=>{const l=e[i];l&&t&&(y(ke(i,e.length)),H(`${l.label} removed`),t(l.id))},[e,t,y]),_=u.useCallback(()=>{y(null),o()},[o,y]),U=u.useCallback(i=>{const l=i.currentTarget;if(d?.onKeyDown(i))return;const g=xe({key:i.key,shiftKey:i.shiftKey,repeat:i.repeat,caretAtStart:l.selectionStart===0&&l.selectionEnd===0,hasValue:n.length>0,chipCount:e.length});switch(g.type){case"focusChip":i.preventDefault(),y(g.index);return;case"clearQuery":P();return;case"blur":l.blur();return;case"none":return}},[e.length,n,P,y,d]),Q=u.useCallback(i=>l=>{const g=be({key:l.key,repeat:l.repeat,index:i,chipCount:e.length});switch(g.type!=="none"&&l.preventDefault(),g.type){case"removeChip":E(g.index);return;case"focusChip":y(g.index);return;case"focusInput":y(null);return;case"activateChip":return;case"none":return}},[e,E,y]);return u.useEffect(()=>{if(!c)return;const i=l=>{l.key!=="/"||l.metaKey||l.ctrlKey||l.altKey||we(l.target)||(l.preventDefault(),k.current?.focus())};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[c]),m.jsxs("label",{htmlFor:T,className:I("flex w-full items-center gap-1.5 text-sm","bg-surface-sunken/50 border border-transparent","focus-within:bg-canvas focus-within:border-line focus-within:ring-2 focus-within:ring-ring","transition-colors",h==="lg"?"rounded-xl px-4 py-2":"rounded-md px-2.5 py-1",x),children:[m.jsx(V,{className:I("shrink-0 text-fg-muted pointer-events-none",h==="lg"?"size-5":"size-4")}),m.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:[v&&m.jsx("div",{role:"grid","aria-label":"Search filters",className:"flex min-w-0 flex-wrap items-center gap-1",children:e.map((i,l)=>m.jsx(z,{ref:g=>{D.current[l]=g},label:i.label,tone:i.tone,focused:K===l,onFocusLabel:()=>w(l),onKeyDown:Q(l),onRemove:()=>E(l)},i.id))}),m.jsx("input",{ref:k,id:T,name:"q",type:"text","aria-label":"Search mail",autoComplete:"off",value:n,tabIndex:K===null?0:-1,onChange:i=>{r(i.target.value),S(i.target)},onKeyDown:U,onKeyUp:i=>S(i.currentTarget),onClick:i=>S(i.currentTarget),onFocus:i=>{w(null),d?.onFocusChange?.(!0),S(i.currentTarget)},onBlur:()=>d?.onFocusChange?.(!1),...d?.comboboxProps,placeholder:v?void 0:a,className:"min-w-24 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-muted"})]}),(n||v)&&f&&m.jsx("button",{type:"button",onClick:_,className:"shrink-0 rounded p-0.5 hover:bg-surface-raised transition-colors","aria-label":"Clear search",children:m.jsx(G,{className:I("text-fg-muted",h==="lg"?"size-5":"size-4")})}),m.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:B})]})},Re=({value:e,onChange:t,onClear:n,onClearQuery:r,chips:o,onRemoveChip:s,placeholder:a="Search mail...",globalFocusKey:c=!0,showClearButton:f=!0,size:h,inputId:p,suggest:d,className:x})=>m.jsx(Se,{value:e,onChange:t,onClear:n,onClearQuery:r,chips:o,onRemoveChip:s,placeholder:a,globalFocusKey:c,showClearButton:f,size:h,inputId:p,suggest:d,className:x});function Ae({handlers:e,enabled:t=!0,target:n,sequenceTimeoutMs:r=1e3}){const o=u.useRef(e);o.current=e;const s=u.useRef(null),a=u.useRef(null);u.useEffect(()=>{if(!t)return;const c=()=>{a.current!==null&&(clearTimeout(a.current),a.current=null)},f=p=>{const d=pe({key:p.key,shiftKey:p.shiftKey,metaKey:p.metaKey,ctrlKey:p.ctrlKey,altKey:p.altKey,inEditable:me(p.target),onControl:ge(p.target)},s.current);if(c(),s.current=d.nextPrefix,d.nextPrefix!==null&&(a.current=setTimeout(()=>{s.current=null,a.current=null},r)),d.action===null)return;const x=o.current[d.action];x&&(d.preventDefault&&p.preventDefault(),x())},h=n===void 0?window:n;if(h!==null)return h.addEventListener("keydown",f),()=>{h.removeEventListener("keydown",f),c(),s.current=null}},[t,r,n])}const je=({trigger:e,children:t,align:n="right"})=>{const[r,o]=u.useState(!1),s=u.useRef(null),a=u.useCallback(f=>{s.current&&!s.current.contains(f.target)&&o(!1)},[]),c=u.useCallback(f=>{f.key==="Escape"&&o(!1)},[]);return u.useEffect(()=>(r&&(document.addEventListener("mousedown",a),document.addEventListener("keydown",c)),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",c)}),[r,a,c]),m.jsxs("div",{ref:s,className:"relative",children:[m.jsx("button",{type:"button",onClick:f=>{f.stopPropagation(),o(!r)},className:N("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}),r&&m.jsx("div",{className:N("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})]})},Fe=({onClick:e,disabled:t,destructive:n,children:r})=>m.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t||e()},disabled:t,className:N("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:r}),qe=()=>m.jsx("div",{className:"my-1 h-px bg-line"}),Ce=({accounts:e})=>{const t=j({strict:!1}),n=$(),r=t.mailboxId,{t:o}=X("mail",{useSuspense:!1}),s=u.useCallback((c,f)=>o(c,{defaultValue:f}),[o]),a=F({queries:e.map(c=>({...q({path:{accountId:c.accountId}}),staleTime:1/0}))});if(n.pathname.startsWith("/mail/outbox"))return"Outbox";if(!r)return null;for(let c=0;c<e.length;c++){const f=a[c]?.data?.items;if(!f)continue;const h=f.find(d=>d.mailboxId===r);if(!h)continue;const p=J(e[c].folderAppointments);return W(h,p.get(r),s)}return null},Oe=({accounts:e})=>{const n=j({strict:!1}).mailboxId,r=F({queries:e.map(o=>({...q({path:{accountId:o.accountId}}),staleTime:1/0}))});if(!n)return null;for(const o of r){const s=o.data?.items;if(!s)continue;const a=s.find(c=>c.mailboxId===n);if(a)return a.unseenCount}return null};function Be(e){const t=Y(),{searchInput:n}=Z(),r=Ce({accounts:e}),o=oe({select:c=>c.matches}),s=re(o,r),a=u.useCallback(c=>{c===se&&t({to:"/mail/brief",search:{q:n||void 0}})},[t,n]);return{scope:s,clearScope:a}}const ve=["intelligence","nav","shortcuts","filters"];ee(ve);const Ee=te(ne);function He({fragment:e,...t}){return m.jsx(Ee,{...t,hash:e})}const _e=({enabled:e=!0,bindings:t,capture:n=!1})=>{const r=u.useCallback(o=>{const s=o.target;if(!(s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.isContentEditable))for(const a of t){if(!(o.key.toLowerCase()===a.key.toLowerCase())||a.requireShift!==void 0&&a.requireShift!==o.shiftKey)continue;const f=o.ctrlKey||o.metaKey;if(a.requireMeta!==void 0){if(a.requireMeta!==f)continue}else{const h=a.noModifiers??!0,p=f||o.altKey||a.requireShift===void 0&&o.shiftKey;if(h&&p)continue}a.preventDefault&&o.preventDefault(),a.stopPropagation&&(o.stopPropagation(),o.stopImmediatePropagation()),a.handler(o);return}},[t]);u.useEffect(()=>{if(e)return window.addEventListener("keydown",r,n),()=>window.removeEventListener("keydown",r,n)},[e,r,n])},Ie=768,Ue=e=>e!=="desktop",Qe=()=>{const e=R(`(min-width: ${Ie}px)`);return R(ie)?"desktop":e?"tablet":"phone"};function Ve(e){const t=new Map;for(const n of e){const r=n.email.toLowerCase(),o=r.split("@")[0];o&&!t.has(o)&&t.set(o,n.accountId),t.has(r)||t.set(r,n.accountId)}return t}function ze(e){const t=new Map;for(const n of e)for(const r of n){const o=r.fullPath?.toLowerCase();if(!o)continue;const s=o.split("/").pop();t.has(o)||t.set(o,r.mailboxId),s&&!t.has(s)&&t.set(s,r.mailboxId)}return t}function Ge(e,t=[]){const n=e.flat().filter(s=>s.fullPath),r=new Map;for(const s of n){const a=M(s.fullPath).toLowerCase();r.set(a,(r.get(a)??0)+1)}const o=new Map(t.map(s=>[s.accountId,s.email]));return n.map(s=>{const a=M(s.fullPath),c=r.get(a.toLowerCase())===1,f=t.length>1?o.get(s.accountId):void 0;return{value:c?a:s.fullPath,label:s.displayNameOverride?.trim()||a,...f?{hint:f}:{}}})}function $e(e){const t=new Map;for(const n of e){const r=n.email.toLowerCase().split("@")[0]??"";t.set(r,(t.get(r)??0)+1)}return e.map(n=>{const r=n.email.split("@")[0]??n.email,o=t.get(r.toLowerCase())===1,s=n.displayName?.trim();return{value:o?r:n.email,label:s||n.email,...s?{hint:n.email}:{}}})}export{Pe as B,je as D,ce as K,He as N,Ke as R,Re as S,qe as a,Fe as b,ze as c,Qe as d,_e as e,Ae as f,Ve as g,Ce as h,Ue as i,Oe as j,ae as k,Le as l,he as m,Ge as n,$e as o,ue as s,Me as t,Be as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as u,j as a,a3 as i,a4 as p}from"./index-
|
|
1
|
+
import{r as u,j as a,a3 as i,a4 as p}from"./index-3eAE16lF.js";import{a as f}from"./search-scope-Bcn1kzwd.js";const c=u.createContext(null),h=({chrome:r,children:n})=>a.jsx(c.Provider,{value:r,children:n});function O({phone:r,list:n,reading:t,intelligence:o,hasThread:s=!1}){const e=u.useContext(c);if(!e)return a.jsx(i,{});const l={nav:e.nav,overlay:e.overlay,skeleton:a.jsx(i,{}),isLoading:e.isLoading,navOpen:e.navOpen,onOpenNav:e.onOpenNav,onCloseNav:e.onCloseNav};return e.isSinglePane?a.jsx(p,{...l,list:r,intelligenceOpen:e.intelligenceOpen}):a.jsx(p,{...l,topBar:e.topBar,list:n,reading:t,intelligence:o,intelligenceOpen:e.intelligenceOpen,hasThread:s})}function S(r,n,t){if(r!==n)return t}function d(r,n){return r===""?"":n}function g({searchInput:r,committedQuery:n,urlQuery:t,pathname:o,listPath:s}){return!f(o,s)||n!==r?!1:n!==t}export{h as M,O as a,g as b,d as c,S as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,b as N,o as z,r as c,ax as q,aj as L,g as O,aB as $,w as I,b6 as A,q as k,ad as C,b7 as M,b8 as P,B as S,a as B,b9 as R,X as G}from"./index-
|
|
1
|
+
import{j as e,b as N,o as z,r as c,ax as q,aj as L,g as O,aB as $,w as I,b6 as A,q as k,ad as C,b7 as M,b8 as P,B as S,a as B,b9 as R,X as G}from"./index-3eAE16lF.js";import{K as m}from"./kbd-BVVVI8MK.js";import{S as Q,a as E}from"./settings-screen-jzEUDPFx.js";import{E as V}from"./ErrorState-By22X09V.js";import{u as K}from"./useDebouncedValue-nan84ZZT.js";import{a as _}from"./format-De9HZKjg.js";import"./avatar-B5Xfa_Aj.js";import"./menu-B3HPQBVa.js";import"./circle-help-BGR1fVqk.js";function D({options:t,active:r,onSelect:x}){return e.jsx("div",{role:"tablist",className:N("flex shrink-0 gap-1 overflow-x-auto border-b border-line p-2","lg:w-44 lg:flex-col lg:gap-0 lg:overflow-visible lg:border-r lg:border-b-0 lg:py-2 lg:pr-2 lg:pl-3"),children:t.map(a=>{const d=a.id===r;return e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>x(a.id),className:N("flex min-h-11 shrink-0 items-center gap-2 rounded-md px-3 text-left text-sm transition-colors lg:min-h-0 lg:px-2 lg:py-1",d?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface-sunken hover:text-fg"),children:[e.jsx("span",{className:"flex-1 truncate",children:a.label}),e.jsx("span",{className:N("text-2xs tabular-nums",d?"text-accent-2":"text-fg-subtle"),children:a.count??"—"})]},a.id)})})}const v={vip:"VIPs",muted:"Muted",blocked:"Blocked"},F=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"VIP"})," senders get priority surface in the daily brief and notification escalation, even when an account is quiet."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Muted"})," senders never notify and stay out of the brief. Their mail still syncs and stays searchable."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Blocked"})," senders never load images and go straight to junk."]}),e.jsxs("p",{children:["Tip: flag from the keyboard on any message — ",e.jsx(m,{children:"v"})," VIP,"," ",e.jsx(m,{children:"m"})," mute, ",e.jsx(m,{children:"b"})," block. Every rule an automation creates shows up here and can be removed."]})]});function H({query:t,onCount:r}){const{data:x,isPending:a,isError:d,error:b}=I(A()),h=k(),i=C({...P(),onSettled:()=>{h.invalidateQueries({queryKey:M()})}}),l=x?.suggestions??[],p=t.trim().toLowerCase(),u=p?l.filter(n=>(n.displayName??"").toLowerCase().includes(p)||n.normalizedEmail.toLowerCase().includes(p)):l;return c.useEffect(()=>{r?.(u.length,l.length)},[r,u.length,l.length]),a?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Loading VIP suggestions…"}):d?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Couldn't load VIP suggestions",error:b})}):l.length===0?e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIP suggestions yet. As you reply to senders, they'll appear here. Press ",e.jsx(m,{children:"v"})," on any message to promote a sender to VIP."]}):u.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIPs match “",t,"”."]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-row-inset py-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Suggested — promote to VIP"}),u.map(n=>e.jsx(E,{name:n.displayName??n.normalizedEmail,email:n.normalizedEmail,meta:n.replyCount>0?`${n.inboundCount} received · you replied ${n.replyCount}×`:`${n.inboundCount} received · you've never replied`,trailing:e.jsx(S,{variant:"ghost",size:"sm",icon:e.jsx(B,{className:"size-3.5"}),"aria-busy":i.isPending,onClick:()=>{i.isPending||i.mutate({path:{addressId:n.addressId},body:{flags:{vip:{value:!0,setAt:Date.now(),setBy:"user"}}}})},children:"Add VIP"})},n.addressId))]})}function U({group:t,query:r,onCount:x}){const a=K(r.trim(),300),d=k(),[b,h]=c.useState(null),i=a.length>=2,l=R({query:{q:a,limit:50}}),{data:p,isPending:u,isError:n,error:j}=I({...l,enabled:i}),g=C({...P(),onSuccess:()=>{d.invalidateQueries({queryKey:l.queryKey})}}),f=(p?.items??[]).filter(s=>t==="muted"?s.flags?.muted?.value??!1:s.flags?.blocked?.value??!1);return c.useEffect(()=>{x?.(i?f.length:0,null)},[x,i,f.length]),i?u?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Searching…"}):n?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Search failed",error:j})}):f.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No ",v[t].toLowerCase()," senders matching “",a,"”."]}):e.jsx(e.Fragment,{children:f.map(s=>{const o=t==="muted"?s.flags?.muted:s.flags?.blocked,y=o?[`${t}`,o.setAt&&_(o.setAt,{month:"short",year:"numeric"})||null,o.reason?`— ${o.reason}`:null].filter(Boolean).join(" "):t,w=g.isPending&&g.variables?.path.addressId===s.addressId,T=g.isError&&b===s.addressId;return e.jsx(E,{name:s.displayName??s.normalizedEmail,email:s.normalizedEmail,danger:t==="blocked",meta:y,trailing:T?e.jsx(S,{variant:"secondary",size:"sm",onClick:()=>{h(s.addressId),g.mutate({path:{addressId:s.addressId},body:{flags:{[t]:null}}})},children:"Retry"}):e.jsx(S,{variant:"ghost",size:"sm",icon:e.jsx(G,{className:"size-3.5"}),"aria-busy":w,"aria-label":`Remove ${t} flag`,onClick:()=>{w||(h(s.addressId),g.mutate({path:{addressId:s.addressId},body:{flags:{[t]:null}}}))}})},s.addressId)})}):e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle space-y-2",children:[e.jsxs("p",{children:["Type 2+ characters to search ",v[t].toLowerCase()," ","senders by name or address."]}),e.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Note: a dedicated flagged-address list endpoint is in the backlog. Press ",e.jsx(m,{children:"m"})," on any message to mute its sender; ",e.jsx(m,{children:"b"})," to block."]})]})}function ae(){const t=z(),[r,x]=c.useState("vip"),[a,d]=c.useState(""),[b,h]=c.useState(!0),[i,l]=c.useState(0),[p,u]=c.useState({vip:0,muted:null,blocked:null}),n=c.useCallback((s,o)=>{l(s),u(y=>({...y,vip:o}))},[]),j=c.useCallback((s,o)=>{l(s),u(y=>({...y,[r]:s}))},[r]),g=p[r],f=s=>{const o=$[s];o&&t({to:o})};return e.jsx(Q,{items:q,activeId:"senders",title:"Senders & Rules",description:"Per-sender preferences — set with one key from any message, managed here.",flush:!0,help:F,helpOpen:b,onToggleHelp:()=>h(s=>!s),onSelect:f,onBackToMail:()=>{t({to:"/mail"})},children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col lg:flex-row",children:[e.jsx(D,{active:r,onSelect:s=>{x(s),d("")},options:["vip","muted","blocked"].map(s=>({id:s,label:v[s],count:p[s]}))}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("div",{className:"border-b border-line px-row-inset py-2",children:e.jsx(L,{icon:e.jsx(O,{className:"size-4"}),placeholder:`Filter ${v[r].toLowerCase()} by name or address`,className:"h-8 max-w-sm",value:a,onChange:s=>d(s.target.value)})}),e.jsx("div",{className:"min-h-0 flex-1 divide-y divide-line overflow-y-auto",children:r==="vip"?e.jsx(H,{query:a,onCount:n}):e.jsx(U,{group:r,query:a,onCount:j})}),e.jsxs("footer",{className:"flex items-center justify-between border-t border-line px-row-inset py-1 text-2xs text-fg-subtle",children:[e.jsx("span",{children:g!=null?`${i} of ${g} flagged senders`:`${i} flagged senders`}),e.jsxs("span",{children:[e.jsx(m,{children:"j"})," ",e.jsx(m,{children:"k"})," navigate · ",e.jsx(m,{children:"⌫"})," remove flag"]})]})]})]})})}export{ae as component};
|