@remit/web-client-dist 0.0.366 → 0.0.367

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.
Files changed (109) hide show
  1. package/assets/{BriefPane-DUYUTqKq.js → BriefPane-ChGlzzBL.js} +1 -1
  2. package/assets/{ErrorState-BpKY8HhS.js → ErrorState-1eMrB7wr.js} +1 -1
  3. package/assets/{FlaggedPane-DqR6--YK.js → FlaggedPane-Bfq9kjjn.js} +1 -1
  4. package/assets/{FullCompose-CtXVsUsk.js → FullCompose-DqBLukCj.js} +1 -1
  5. package/assets/{MailListHeader-DJzWbkxI.js → MailListHeader-raa9OFwz.js} +1 -1
  6. package/assets/{MailViewChrome-DZ3ZAbwD.js → MailViewChrome-Bl7jWN9W.js} +1 -1
  7. package/assets/{MailboxPane-krcG0X_7.js → MailboxPane-CDs05ZIU.js} +1 -1
  8. package/assets/{NavMenuButton-B14zpx3h.js → NavMenuButton-Clvxx3Ka.js} +1 -1
  9. package/assets/{OnboardingWizard-CbAyE9zs.js → OnboardingWizard-BVl0tlrb.js} +1 -1
  10. package/assets/{OutboxPane-DflPFfkC.js → OutboxPane-Cc2QZBOB.js} +1 -1
  11. package/assets/_mailboxId-CmsnnBoP.js +1 -0
  12. package/assets/_messageId-ClnKkvfk.js +1 -0
  13. package/assets/_messageId-DkYfwtiV.js +1 -0
  14. package/assets/_messageId-P9Fw5s2T.js +1 -0
  15. package/assets/_outboxMessageId-CsGXLMHI.js +1 -0
  16. package/assets/_threadId-5k3ae7AU.js +1 -0
  17. package/assets/_threadId-BZAr8I8v.js +1 -0
  18. package/assets/_threadId-D2kWdawD.js +1 -0
  19. package/assets/{accounts-BzSN90wH.js → accounts-Bz6-COGY.js} +1 -1
  20. package/assets/{advanced-cENce6OC.js → advanced-eDc6TE_4.js} +1 -1
  21. package/assets/{appearance-Kak5YysL.js → appearance-D76zVwjM.js} +1 -1
  22. package/assets/{attachment-file-nv-tem53.js → attachment-file-Dzi65u3g.js} +1 -1
  23. package/assets/{avatar-Biylg9_n.js → avatar-unHAQpba.js} +1 -1
  24. package/assets/{bottom-sheet-Cx-PC5pk.js → bottom-sheet-wto9gHgG.js} +1 -1
  25. package/assets/{brief-DYhBQgcb.js → brief-BiZx4Hd9.js} +1 -1
  26. package/assets/brief-DmkSDnlg.js +1 -0
  27. package/assets/{browser-ponyfill-DvyPu_8v.js → browser-ponyfill-BqL5DZj8.js} +1 -1
  28. package/assets/{bug-BvveLtEk.js → bug-CknNczBN.js} +1 -1
  29. package/assets/{circle-check-TZMAU1ge.js → circle-check-CifXYyxz.js} +1 -1
  30. package/assets/{circle-check-big-Cu3fVTDI.js → circle-check-big-DnLRqLSe.js} +1 -1
  31. package/assets/{circle-help-D0MvxrSS.js → circle-help-C5eVb8S6.js} +1 -1
  32. package/assets/{clock-DaQCYxCs.js → clock-CJ-59Kcv.js} +1 -1
  33. package/assets/compose._-_outboxMessageId_-C2W8YXdb.js +1 -0
  34. package/assets/compose._-_outboxMessageId_-CQw0Lx8n.js +1 -0
  35. package/assets/compose._-_outboxMessageId_-ETU1wi5m.js +1 -0
  36. package/assets/compose._-_outboxMessageId_-u64S0Pun.js +1 -0
  37. package/assets/{confirm-dialog-DUqOAmm6.js → confirm-dialog-D1ytBWGE.js} +1 -1
  38. package/assets/{download-D-wEf7QC.js → download-Dt_VabDf.js} +1 -1
  39. package/assets/{filters-3ffGMZDA.js → filters-D-UCXLO8.js} +1 -1
  40. package/assets/flagged--vtZv4SJ.js +1 -0
  41. package/assets/{flagged-CCLfdOjV.js → flagged-wkIV4iCl.js} +1 -1
  42. package/assets/{folders-BnkYu63l.js → folders-DmBxUTvo.js} +1 -1
  43. package/assets/index-1Rp2Fc2d.js +1 -0
  44. package/assets/{index-ThrvWdKb.js → index-C-FSoKJJ.js} +3 -3
  45. package/assets/index-CPHmDACn.js +1 -0
  46. package/assets/index-Chj55tHl.js +1 -0
  47. package/assets/index-D6rB8N6l.js +1 -0
  48. package/assets/index-DPiJh8p2.js +1 -0
  49. package/assets/index-DbQKvLCR.js +1 -0
  50. package/assets/index-DkYfwtiV.js +1 -0
  51. package/assets/index-P9Fw5s2T.js +1 -0
  52. package/assets/{index-DPwE6tbL.js → index-t5wgPl_5.js} +4 -4
  53. package/assets/{kbd-RjIgfmMM.js → kbd-zFFFLjXS.js} +1 -1
  54. package/assets/{labels-BpnxKkcT.js → labels-C-Am9lfc.js} +1 -1
  55. package/assets/{mail-DBCtDH2_.js → mail-CLU7M6LR.js} +1 -1
  56. package/assets/{mail-C01FVOoR.js → mail-DME48gi9.js} +1 -1
  57. package/assets/{menu-DR6sZz88.js → menu-D0YdtPim.js} +1 -1
  58. package/assets/{move-options-BaITx4zb.js → move-options-D3W-Ns6f.js} +1 -1
  59. package/assets/{onboarding-DKg7G3St.js → onboarding-DaUgSoru.js} +1 -1
  60. package/assets/outbox-BR6HvqUa.js +1 -0
  61. package/assets/{pencil-DC9FTKBN.js → pencil-Bwv2wq3G.js} +1 -1
  62. package/assets/{rich-text-DZcZCgGn.js → rich-text-DysQaLwr.js} +1 -1
  63. package/assets/{rich-text-spellcheck-worker-provider-lyjtUDiq.js → rich-text-spellcheck-worker-provider-CeRXuAD4.js} +1 -1
  64. package/assets/{rotate-ccw-SJbnYAaD.js → rotate-ccw-Cv9Q4bUE.js} +1 -1
  65. package/assets/{row-actions-CyN-JFgh.js → row-actions-D0zOo3Gx.js} +1 -1
  66. package/assets/{search-scope-DeXyVwvq.js → search-scope-Uq2fKL8U.js} +1 -1
  67. package/assets/{search-token-index-B8OGGL_Q.js → search-token-index-BnFXJ2Pi.js} +1 -1
  68. package/assets/{search-view-CKcUDRa7.js → search-view-B4Pm1xiE.js} +1 -1
  69. package/assets/{senders-BWN5sPls.js → senders-Dupaa81o.js} +1 -1
  70. package/assets/{settings-screen-B-0kkf7-.js → settings-screen-DSPGVcfl.js} +1 -1
  71. package/assets/settings-zMTiDeZq.js +1 -0
  72. package/assets/{shield-check-CZqWEFD1.js → shield-check-DkNRbG4w.js} +1 -1
  73. package/assets/{suggested-vips-JWEKOQBa.js → suggested-vips-anCh_Vjf.js} +1 -1
  74. package/assets/{useDebouncedValue-GLgJ6lfP.js → useDebouncedValue-Dp6F7YRV.js} +1 -1
  75. package/assets/{useFilters-Cr5788L3.js → useFilters-Cn6ncruH.js} +1 -1
  76. package/assets/{useLabels-C1yZ5KwG.js → useLabels-DPbinXUF.js} +1 -1
  77. package/assets/{useMediaQuery-Doxj330l.js → useMediaQuery-CJs3FAmb.js} +1 -1
  78. package/assets/{useMessageBodyContent-1bSbTn98.js → useMessageBodyContent-CGB2cPdQ.js} +1 -1
  79. package/assets/{useRefreshControl-DK9d61ZO.js → useRefreshControl-CpZ1zmrP.js} +1 -1
  80. package/assets/{useSearchMirror-DMoiFQnL.js → useSearchMirror-CvGGWSl0.js} +1 -1
  81. package/assets/{useSearchTokenContext-CBEYi9LQ.js → useSearchTokenContext-BKwYmBwt.js} +1 -1
  82. package/assets/{useSemanticSearch-L2JeQq_E.js → useSemanticSearch-Dl-5IjEk.js} +1 -1
  83. package/assets/{useSignature-DUzSLdCk.js → useSignature-C-k9m2Zf.js} +1 -1
  84. package/index.html +1 -1
  85. package/package.json +1 -1
  86. package/assets/_mailboxId-B1Eyk88Q.js +0 -1
  87. package/assets/_messageId-BpH-w5SF.js +0 -1
  88. package/assets/_messageId-D3RPQWsX.js +0 -1
  89. package/assets/_messageId-DiAC9NzW.js +0 -1
  90. package/assets/_outboxMessageId-CD-JJjde.js +0 -1
  91. package/assets/_threadId-B2vJ9pIn.js +0 -1
  92. package/assets/_threadId-BdLQ_gja.js +0 -1
  93. package/assets/_threadId-Blb8ICRa.js +0 -1
  94. package/assets/brief-DA2i9-Hf.js +0 -1
  95. package/assets/compose._-_outboxMessageId_-B3u-ki9U.js +0 -1
  96. package/assets/compose._-_outboxMessageId_-De8Mia5F.js +0 -1
  97. package/assets/compose._-_outboxMessageId_-c4BB1mrN.js +0 -1
  98. package/assets/compose._-_outboxMessageId_-yuVCspZT.js +0 -1
  99. package/assets/flagged-BDKe9L4B.js +0 -1
  100. package/assets/index-B9zHITYN.js +0 -1
  101. package/assets/index-BpH-w5SF.js +0 -1
  102. package/assets/index-CAPSwoDO.js +0 -1
  103. package/assets/index-CBOIa1x8.js +0 -1
  104. package/assets/index-CTV3H7Bc.js +0 -1
  105. package/assets/index-DarLe5DD.js +0 -1
  106. package/assets/index-DiAC9NzW.js +0 -1
  107. package/assets/index-v7xKibbq.js +0 -1
  108. package/assets/outbox-CmaIKWbX.js +0 -1
  109. package/assets/settings-CbQ-MkZr.js +0 -1
@@ -1 +1 @@
1
- import{j as s,b as t}from"./index-DPwE6tbL.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
+ import{j as s,b as t}from"./index-t5wgPl_5.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 f,j as e,ad as h,aT as y,ac as b,b2 as g,B as v,T as N,m as C,s as L,Q as I,ar as D,av as S,as as w}from"./index-DPwE6tbL.js";import{C as E}from"./confirm-dialog-DUqOAmm6.js";import{S as T}from"./settings-screen-B-0kkf7-.js";import{E as j}from"./ErrorState-BpKY8HhS.js";import{a as $,b as k,c as R,u as O}from"./useLabels-C1yZ5KwG.js";import"./avatar-Biylg9_n.js";import"./menu-DR6sZz88.js";import"./circle-help-D0MvxrSS.js";function B({labels:l,onRename:i,onRecolor:n,onDelete:m,deletingLabelId:c}){const[u,r]=f.useState(),[o,d]=f.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}=O(l),[c,u]=f.useState(""),[r,o]=f.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]=f.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(B,{labels:n,onRename:(p,x)=>o(p,{name:x}),onRecolor:(p,x)=>o(p,{color:x}),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 q(){const l=C(),[i,n]=f.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{q as component};
1
+ import{r as f,j as e,ad as h,aT as y,ac as b,b2 as g,B as v,T as N,m as C,s as L,Q as I,ar as D,av as S,as as w}from"./index-t5wgPl_5.js";import{C as E}from"./confirm-dialog-D1ytBWGE.js";import{S as T}from"./settings-screen-DSPGVcfl.js";import{E as j}from"./ErrorState-1eMrB7wr.js";import{a as $,b as k,c as R,u as O}from"./useLabels-DPbinXUF.js";import"./avatar-unHAQpba.js";import"./menu-D0YdtPim.js";import"./circle-help-C5eVb8S6.js";function B({labels:l,onRename:i,onRecolor:n,onDelete:m,deletingLabelId:c}){const[u,r]=f.useState(),[o,d]=f.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}=O(l),[c,u]=f.useState(""),[r,o]=f.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]=f.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(B,{labels:n,onRename:(p,x)=>o(p,{name:x}),onRecolor:(p,x)=>o(p,{color:x}),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 q(){const l=C(),[i,n]=f.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{q as component};
@@ -1 +1 @@
1
- import{c as T,r as l,u as Ke,j as e,S as Ve,a as pe,b as w,C as te,d as se,e as Qe,f as ge,F as qe,g as He,X as be,T as $e,O as Ue,M as We,A as Ge,h as Ye,I as Je,i as ve,B,k as Xe,l as ye,m as G,o as je,n as Se,p as Ze,q as Y,s as Ne,t as et,v as tt,w as st,x as U,y as at,z as nt,D as rt,E as ot,G as it,H as lt,J as ct,K as ut,L as dt,N as mt,P as xt,Q as ht,R as ft,U as pt}from"./index-DPwE6tbL.js";import{B as gt,S as bt,D as vt,a as yt,b as jt,u as St,s as Nt,c as J,K as Ct,d as kt,e as wt,f as It,g as Mt,h as Ot,i as Et}from"./search-token-index-B8OGGL_Q.js";import{u as X,a as Ce,l as Rt,N as L,b as Pt,c as Lt,i as At,d as ae,m as zt,e as Tt,f as Ft}from"./useMessageBodyContent-1bSbTn98.js";import{P as Dt}from"./pencil-DC9FTKBN.js";import{M as _t,s as Bt,c as Kt}from"./search-view-CKcUDRa7.js";import{u as Vt,a as Qt,R as qt,M as Ht}from"./useRefreshControl-DK9d61ZO.js";import{M as $t}from"./menu-DR6sZz88.js";import{B as ke}from"./bug-BvveLtEk.js";import{A as Ut}from"./avatar-Biylg9_n.js";import{i as Wt}from"./outbox-status-CPfNHfUQ.js";import{E as Gt}from"./ErrorState-BpKY8HhS.js";import{K as ne}from"./kbd-RjIgfmMM.js";import{u as Yt}from"./useDebouncedValue-GLgJ6lfP.js";import{u as Jt}from"./index-ThrvWdKb.js";import"./search-scope-DeXyVwvq.js";import"./useMediaQuery-Doxj330l.js";import"./FullCompose-CtXVsUsk.js";import"./confirm-dialog-DUqOAmm6.js";import"./circle-check-big-Cu3fVTDI.js";import"./useSignature-DUzSLdCk.js";import"./account-form-helpers-DhckT_PN.js";const Xt=T("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 Zt=T("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);const we=T("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=T("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 es=T("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"}]]),ts="button:not([disabled]), a[href]",P="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-sunken";function ss({active:t,dimmed:s,indent:a}){return w("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors",P,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 as({icon:t,label:s,count:a,active:n}){return e.jsxs(e.Fragment,{children:[t&&e.jsx("span",{className:w("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:w("text-2xs tabular-nums",n?"text-accent-2":"text-fg-subtle"),children:a})]})}function A({icon:t,label:s,count:a,active:n,dimmed:r,indent:o,navId:i,linkComponent:u,ariaLabel:f,title:g,onClick:p}){const m=ss({active:n,dimmed:r,indent:o}),x=e.jsx(as,{icon:t,label:s,count:a,active:n});return i&&u?u({navId:i,className:m,ariaLabel:f??s,title:g,onClick:p,children:x}):e.jsx("button",{type:"button",onClick:p,className:m,"aria-label":f,title:g,children:x})}const re={inbox:0,flagged:1,drafts:2,sent:3,archive:4,all:5,junk:6,trash:7};function ns(t){switch(t){case"inbox":return e.jsx(Je,{className:"size-4"});case"flagged":return e.jsx(pe,{className:"size-4"});case"drafts":return e.jsx(Ye,{className:"size-4"});case"sent":return e.jsx(ge,{className:"size-4"});case"archive":return e.jsx(Ge,{className:"size-4"});case"all":return e.jsx(We,{className:"size-4"});case"junk":return e.jsx(Ue,{className:"size-4"});case"trash":return e.jsx($e,{className:"size-4"})}}const oe=t=>t.role!=null,$=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 rs({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:w("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",P),children:[e.jsx(He,{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:w("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",P),children:e.jsx(be,{className:"size-3.5"})})]})}function os({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:w("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-accent transition-colors hover:bg-surface",P),children:[e.jsx(Xt,{className:"size-4 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["Save “",s,"”"]})]}),t.map(o=>e.jsx(rs,{query:o,onSelect:()=>a?.(o),onRemove:n?()=>n(o):void 0},o))]})}function is({account:t,selectedNavId:s,onSelectNav:a,linkComponent:n}){const[r,o]=l.useState(()=>ce(le,t.id,!0)),[i,u]=l.useState(()=>ce(ie,t.id,!0)),[f,g]=l.useState(!1),p=()=>{o(c=>{const S=!c;return ue(le,t.id,S),S})},m=()=>{u(c=>{const S=!c;return ue(ie,t.id,S),S})},x=t.mailboxes.filter(oe).sort((c,S)=>re[c.role]-re[S.role]),h=t.mailboxes.filter(c=>!oe(c)),b=f||h.length<=$?h:h.slice(0,$),v=h.length-b.length,j=t.status??"ready",R=j==="ready"&&x.length===0&&h.length===0;return e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",onClick:p,"aria-expanded":r,className:w("flex w-full items-center gap-1.5 px-2 pb-1 text-left transition-colors hover:text-fg",P,t.muted&&"opacity-55"),children:[r?e.jsx(te,{className:"size-3 shrink-0 text-fg-subtle"}):e.jsx(se,{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(gt,{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:[j==="loading"&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"Loading…"}),j==="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(Qe,{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"}),j==="ready"&&e.jsxs(e.Fragment,{children:[x.map(c=>e.jsx(A,{navId:c.id,linkComponent:n,icon:ns(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(A,{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")}),h.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:m,"aria-expanded":i,className:w("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",P),children:[i?e.jsx(te,{className:"size-3 shrink-0"}):e.jsx(se,{className:"size-3 shrink-0"}),e.jsx("span",{className:"flex-1",children:"Folders"}),e.jsx("span",{className:"tabular-nums opacity-70",children:h.length})]}),i&&e.jsxs(e.Fragment,{children:[b.map(c=>e.jsx(A,{navId:c.id,linkComponent:n,icon:e.jsx(qe,{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)),(v>0||f)&&h.length>$&&e.jsx("button",{type:"button",onClick:()=>g(c=>!c),className:w("ml-7 flex items-center px-2 py-1 text-2xs font-medium text-accent transition-colors hover:underline",P),children:f?"Show less":`Show all (${h.length})`})]})]})]})]})]})}function ls({accounts:t,selectedNavId:s,briefUnseen:a,onSelectNav:n,variant:r="desktop",linkComponent:o,calendarNav:i="hidden",savedSearches:u=[],saveableQuery:f,onSelectSavedSearch:g,onRemoveSavedSearch:p,onSaveCurrentSearch:m}){const x=l.useRef(null);Ke({containerRef:x,itemSelector:ts});const h=r==="drawer",b=e.jsxs("nav",{ref:h?x:void 0,className:h?"px-2 py-2":"flex-1 overflow-y-auto px-2 py-2","aria-label":"Mailboxes",children:[e.jsx(A,{navId:"brief",linkComponent:o,icon:e.jsx(Ve,{className:"size-4"}),label:"Daily brief",ariaLabel:"Daily brief",count:a,active:s==="brief",onClick:()=>n?.("brief")}),i==="shown"&&e.jsx(A,{navId:"calendar",linkComponent:o,icon:e.jsx(Zt,{className:"size-4"}),label:"Calendar",ariaLabel:"Calendar",active:s==="calendar",onClick:()=>n?.("calendar")}),e.jsx(A,{navId:"flagged",linkComponent:o,icon:e.jsx(pe,{className:"size-4"}),label:"Starred",ariaLabel:"Starred",active:s==="flagged",onClick:()=>n?.("flagged")}),e.jsx(os,{savedSearches:u,saveableQuery:f,onSelectSavedSearch:g,onRemoveSavedSearch:p,onSaveCurrentSearch:m}),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(is,{account:v,selectedNavId:s,onSelectNav:n,linkComponent:o},v.id))]});return h?b:e.jsx("aside",{ref:x,className:"flex h-full w-full flex-col bg-surface-sunken",children:b})}function cs({leading:t,search:s,actions:a,className:n}){return e.jsxs("header",{className:w("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 us(){const t=ve();if(!t)return null;const s=t.showNavPane?!t.navCollapsed:!1;return e.jsx(B,{variant:"ghost",size:"sm",icon:e.jsx($t,{className:"size-4"}),onClick:t.toggleNav,"aria-label":s?"Hide folders":"Show folders","aria-expanded":s,title:"Folders",className:"shrink-0"})}const ds={global:"Search all mail",pending:"Search mail",scoped:"Search this folder"};function ms({search:t,onCompose:s,onReportBug:a,onOpenSettings:n,composeShortcut:r,refreshControl:o,account:i}){return e.jsx(cs,{leading:e.jsx(us,{}),search:e.jsx(bt,{value:t.value,onChange:t.onChange,onClear:t.onClear,onClearQuery:t.onClearQuery,chips:t.chips,onRemoveChip:t.onRemoveChip,placeholder:ds[t.scope]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(B,{variant:"ghost",size:"sm",icon:e.jsx(es,{className:"size-4"}),title:r?`Compose (${r})`:"Compose","aria-label":"Compose",onClick:s}),e.jsx(B,{variant:"ghost",size:"sm",icon:e.jsx(ke,{className:"size-4"}),title:"Report a bug","aria-label":"Report a bug",onClick:a}),e.jsx(B,{variant:"ghost",size:"sm",icon:e.jsx(Ie,{className:"size-4"}),title:"Settings","aria-label":"Settings",onClick:n}),o,i]})})}const xs=()=>{const t=X(),s=Ce();return Rt(s.pathname)?null:e.jsx("button",{type:"button",onClick:t,"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(Dt,{className:"size-6"})})},Me=({children:t})=>{const{Account:s}=Xe();return e.jsx(s,{children:t})},hs=({email:t,onSignOut:s})=>{const a=t??"Account";return e.jsxs(vt,{trigger:e.jsx(Ut,{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(yt,{})]}),e.jsxs(jt,{onClick:s,children:[e.jsx(we,{className:"size-4"}),"Sign out"]})]})},fs=()=>e.jsx(Me,{children:({email:t,signOut:s})=>e.jsx(hs,{email:t,onSignOut:s})});function ps({accounts:t}){const{searchInput:s,onSearchChange:a,onSearchClear:n,onSearchClearQuery:r}=ye(),o=G(),i=X(),{scope:u,clearScope:f}=St(t),g=u.kind==="scoped"?[{id:u.chip.id,label:u.chip.label,tone:"scope"}]:void 0,p=l.useMemo(()=>t.map(v=>v.accountId),[t]),{hasNewMail:m}=Vt(),{state:x,errorMessage:h,refresh:b}=Qt(p);return e.jsx(ms,{search:{value:s,scope:u.kind,chips:g,onChange:a,onClear:n,onClearQuery:r,onRemoveChip:f},onCompose:i,onReportBug:je,onOpenSettings:()=>o({to:"/settings/accounts"}),composeShortcut:Nt("compose"),refreshControl:e.jsx(qt,{state:x,onRefresh:b,label:"Refresh all accounts",errorMessage:h,hasUpdate:m(p)}),account:e.jsx(fs,{})})}const Z="remit.savedSearches",gs=25;function V(){try{const t=localStorage.getItem(Z);if(!t)return[];const s=JSON.parse(t);return Array.isArray(s)?s.filter(a=>typeof a=="string"):[]}catch{return[]}}function bs(t){const s=t.trim();if(!s)return V();const a=[s,...V().filter(n=>n!==s)].slice(0,gs);try{localStorage.setItem(Z,JSON.stringify(a))}catch{return a}return a}function vs(t){const s=V().filter(a=>a!==t);try{localStorage.setItem(Z,JSON.stringify(s))}catch{return s}return s}const de=t=>/^\d/.test(t),ys=(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 js(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,i)=>ys(U(o,void 0,a),U(i,void 0,a))),{system:n,labels:r}}function Ss(t,s,a){const n=at(s)&&t.unseenCount>0;return{id:t.mailboxId,name:U(t,s,a),unseen:n?t.unseenCount:void 0,role:s,fullPath:t.fullPath}}function Ns(){const t=Ce(),s=st({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=Se(),r=G(),o=Ns(),{searchInput:i,onSearchChange:u}=ye(),[f,g]=l.useState(V),{t:p}=Ze("mail",{useSuspense:!1}),m=l.useCallback((d,k)=>p(d,{defaultValue:k}),[p]),x=J({queries:t.map(d=>({...Y({path:{accountId:d.accountId}}),staleTime:1/0}))}),{data:h}=Ne(et()),b=l.useMemo(()=>(h?.items??[]).filter(d=>Wt(d.status)).length,[h?.items]),v=l.useMemo(()=>t.map((d,k)=>{const N=x[k],E=N?.data?.items??[],C=tt(d.folderAppointments),{system:M,labels:q}=js(E,C,m),H=N?.isError?"error":N?.isLoading?"loading":"ready";return{id:d.accountId,label:d.email,email:d.email,muted:!!d.muted,outboxPending:b,status:H,onRetry:()=>N?.refetch(),mailboxes:[...M,...q].map(D=>Ss(D,C.get(D.mailboxId),m))}}),[t,x,b,m]),j=d=>{n.invalidateQueries({queryKey:nt({path:{mailboxId:d},query:{order:"desc"}})})},R=({navId:d,className:k,ariaLabel:N,title:E,children:C,onClick:M})=>d==="brief"?e.jsx(L,{to:"/mail/brief",search:{q:void 0},activeOptions:{includeSearch:!1},onClick:()=>M?.(),className:k,"aria-label":N,title:E,children:C}):d==="outbox"?e.jsx(L,{to:"/mail/outbox",search:{q:void 0},onClick:()=>M?.(),className:k,"aria-label":N,title:E,children:C}):d==="flagged"?e.jsx(L,{to:"/mail/flagged",search:{q:void 0},onClick:()=>M?.(),className:k,"aria-label":N,title:E,children:C}):d==="settings"?e.jsx(L,{to:"/settings/accounts",onClick:()=>M?.(),className:k,"aria-label":N,title:E,children:C}):e.jsx(L,{to:"/mail/$mailboxId",params:{mailboxId:d},search:{q:void 0},onClick:()=>{j(d),M?.()},className:k,"aria-label":N,title:E,children:C}),c=()=>{u(""),s?.()},S=i.trim(),I=S.length>0&&!f.includes(S)?S:void 0,F=l.useCallback(()=>{I&&g(bs(I))},[I]),Q=l.useCallback(d=>{g(vs(d))},[]),z=l.useCallback(d=>{u(d),r({to:"/mail/brief",search:{q:d}}),s?.()},[u,r,s]);return e.jsx(ls,{accounts:v,selectedNavId:o,onSelectNav:c,linkComponent:R,variant:a,savedSearches:f,saveableQuery:I,onSaveCurrentSearch:F,onSelectSavedSearch:z,onRemoveSavedSearch:Q})}function Cs(){return e.jsxs("button",{type:"button",onClick:je,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 ks({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(L,{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(Cs,{}),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 ws=({isOpen:t,onClose:s})=>{const a=l.useCallback(n=>{n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),n.stopImmediatePropagation(),s())},[s]);return l.useEffect(()=>{if(t)return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[t,a]),t?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx(rt,{label:"Dismiss keyboard shortcuts",onDismiss:s,className:"backdrop-blur-sm"}),e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Keyboard shortcuts",className:w("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:Ct.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,i)=>e.jsxs(l.Fragment,{children:[i>0&&r.keys[0]==="g"&&e.jsx("span",{className:"text-2xs text-fg-subtle",children:"then"}),e.jsx(ne,{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(ne,{children:"Esc"})," to close"]})})]})]}):null};function Is(t){const s=J({queries:t.map(a=>({...Y({path:{accountId:a.accountId}}),staleTime:1/0}))});return l.useMemo(()=>kt(s.map(a=>a.data?.items??[])),[s])}const Ms=t=>t.map(s=>s.data?.items??[]);function Os(t){const s=J({queries:t.map(a=>({...Y({path:{accountId:a.accountId}}),staleTime:1/0})),combine:Ms});return l.useMemo(()=>ot(t.map((a,n)=>({folderAppointments:a.folderAppointments,mailboxes:s[n]??[]}))),[t,s])}var _={exports:{}},xe;function Es(){if(xe)return _.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:i}=n;if(!(typeof i=="number"&&i>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${i}\` (${typeof i})`);const u=[],f=s[Symbol.iterator]();let g=!1,p=!1,m=0,x=0;const h=()=>{if(g)return;const b=f.next(),v=x;if(x++,b.done){p=!0,m===0&&r(u);return}m++,Promise.resolve(b.value).then(j=>a(j,v)).then(j=>{u[v]=j,m--,h()},j=>{g=!0,o(j)})};for(let b=0;b<i&&(h(),!p);b++);});return _.exports=t,_.exports.default=t,_.exports}var Rs=Es();const Ps=it(Rs),Ls=900*1e3,As=300,zs=(t,s)=>{if(!t)return s;const a=Number.parseInt(t,10);return Number.isFinite(a)&&a>0?a:s},Ts=60*1e3,Fs=t=>Math.max(zs(t,As)*1e3,Ts),K=Fs(mt().mailboxPollIntervalSeconds),Ds=5,W=new Set,_s=(t,s,a=Ls)=>t.filter(n=>{const r=n.lastSyncAt;return r==null?!0:s-r>a}).map(n=>n.accountId),Bs=(t,s,a=K)=>t-s>=a,Ks=(t,s)=>t.filter(a=>!s.has(a)),he=(t,s)=>{if(W.delete(t),ut(s,{softError:!0})){dt(s);return}console.warn("[remit] background mailbox sync failed",{accountId:t,error:s})},fe=(t,s)=>lt({path:{accountId:t},throwOnError:!0}).then(()=>{s.invalidateQueries({queryKey:ct({path:{accountId:t}})})}),Vs=t=>{const s=Se(),a=l.useRef(t);a.current=t;const n=t.map(r=>r.accountId).join(",");l.useEffect(()=>{const r=Date.now(),i=_s(a.current,r).filter(u=>!W.has(u));if(i.length!==0)for(const u of i)W.add(u),fe(u,s).catch(f=>{he(u,f)})},[n,s]),l.useEffect(()=>{let r=Date.now(),o;const i=new Set,u=()=>{r=Date.now();const p=Ks(a.current.map(m=>m.accountId),i);for(const m of p)i.add(m);Ps(p,m=>fe(m,s).catch(x=>{he(m,x)}).finally(()=>{i.delete(m)}),{concurrency:Ds})},f=()=>{if(document.visibilityState==="visible"){u(),o=setTimeout(f,K);return}},g=()=>{document.visibilityState==="visible"&&Bs(Date.now(),r)&&(o!==void 0&&clearTimeout(o),u(),o=setTimeout(f,K))};return o=setTimeout(f,K),document.addEventListener("visibilitychange",g),()=>{o!==void 0&&clearTimeout(o),document.removeEventListener("visibilitychange",g)}},[n,s])},Oe="remit:intelligence-open";function Qs(){try{return localStorage.getItem(Oe)!=="closed"}catch{return!0}}function qs(t){try{localStorage.setItem(Oe,t?"open":"closed")}catch{}}function Hs({panels:t,prefersOpen:s,isDesktop:a,hasThread:n}){return t.length>0?t.includes("intelligence"):a&&n&&s}function xa(){const{q:t=""}=xt({from:"/mail"}),s=G(),a=wt(),n=Et(a),r=Pt(),o=Lt(),i=r.find(At),u=i==="shortcuts",f=i==="nav",g=It(),[p,m]=l.useState(Qs),x=Hs({panels:r,prefersOpen:p,isDesktop:a==="desktop",hasThread:g!==void 0}),h=l.useCallback((y,ee)=>{o([...y?["intelligence"]:[],...ee?[ee]:[]])},[o]),b=l.useCallback(y=>{qs(y),m(y),h(y,i)},[i,h]),v=l.useCallback(y=>{h(x,y)},[x,h]),[j,R]=l.useState(t),c=Yt(j,200),S=Kt(j,c),I=ae({select:y=>zt(y.matches)}),[F,Q]=l.useState(I);if(F!==I){const y=Bt(F,I,t);Q(I),y!==void 0&&R(y)}const{data:z,isLoading:d,isError:k,error:N,refetch:E}=Ne({...ht(),staleTime:1/0}),C=!!(z&&(z.accounts?.length??0)===0);l.useEffect(()=>{C&&s({to:"/onboarding",replace:!0})},[C,s]),Jt({enabled:!u,bindings:[{key:"?",handler:()=>v("shortcuts"),noModifiers:!1,preventDefault:!0}]});const M=X(),q=Tt(),H=ae({select:y=>Ft(y.matches)?.list==="mailbox"}),D=l.useMemo(()=>({compose:M}),[M]);Mt({enabled:!H&&!q,handlers:D});const Ee=l.useCallback(y=>{R(y)},[]),Re=l.useCallback(()=>{R("")},[]),Pe=l.useCallback(()=>{R("")},[]),Le=l.useCallback(()=>{b(!x)},[b,x]),O=z?.accounts??[],Ae=l.useMemo(()=>O.map(y=>y.accountId),[O]),ze=Is(O),Te=Os(O),Fe=l.useMemo(()=>Ot(O),[O]);Vs(O);const De=l.useCallback(()=>{i==="nav"&&v(void 0)},[i,v]),_e={accounts:O,mailboxNameIndex:ze,accountNameIndex:Fe,resultFolderIndex:Te,searchQuery:S,searchInput:j,searchViewKey:I,onSearchChange:Ee,onSearchClear:Re,onSearchClearQuery:Pe,intelligenceOpen:x,onToggleIntelligence:Le},Be={isSinglePane:n,isLoading:d||C,intelligenceOpen:x,nav:e.jsx(ks,{accounts:O,onMailboxSelect:De}),topBar:n?void 0:e.jsx(ps,{accounts:O}),overlay:n?e.jsx(xs,{}):void 0,navOpen:f,onOpenNav:()=>v("nav"),onCloseNav:()=>v(void 0)};return e.jsx(ft.Provider,{value:_e,children:e.jsxs(Ht,{accountIds:Ae,children:[k?e.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:e.jsx(Gt,{title:"Couldn't load your account",error:N,onRetry:()=>{E()}})}):e.jsx(_t,{chrome:Be,children:e.jsx(pt,{})}),e.jsx(ws,{isOpen:u,onClose:()=>v(void 0)})]})})}export{xa as component,ye as useMailContext};
1
+ import{c as T,r as l,u as Ke,j as e,S as Ve,a as pe,b as w,C as te,d as se,e as Qe,f as ge,F as qe,g as He,X as be,T as $e,O as Ue,M as We,A as Ge,h as Ye,I as Je,i as ve,B,k as Xe,l as ye,m as G,o as je,n as Se,p as Ze,q as Y,s as Ne,t as et,v as tt,w as st,x as U,y as at,z as nt,D as rt,E as ot,G as it,H as lt,J as ct,K as ut,L as dt,N as mt,P as xt,Q as ht,R as ft,U as pt}from"./index-t5wgPl_5.js";import{B as gt,S as bt,D as vt,a as yt,b as jt,u as St,s as Nt,c as J,K as Ct,d as kt,e as wt,f as It,g as Mt,h as Ot,i as Et}from"./search-token-index-BnFXJ2Pi.js";import{u as X,a as Ce,l as Rt,N as L,b as Pt,c as Lt,i as At,d as ae,m as zt,e as Tt,f as Ft}from"./useMessageBodyContent-CGB2cPdQ.js";import{P as Dt}from"./pencil-Bwv2wq3G.js";import{M as _t,s as Bt,c as Kt}from"./search-view-B4Pm1xiE.js";import{u as Vt,a as Qt,R as qt,M as Ht}from"./useRefreshControl-CpZ1zmrP.js";import{M as $t}from"./menu-D0YdtPim.js";import{B as ke}from"./bug-CknNczBN.js";import{A as Ut}from"./avatar-unHAQpba.js";import{i as Wt}from"./outbox-status-CPfNHfUQ.js";import{E as Gt}from"./ErrorState-1eMrB7wr.js";import{K as ne}from"./kbd-zFFFLjXS.js";import{u as Yt}from"./useDebouncedValue-Dp6F7YRV.js";import{u as Jt}from"./index-C-FSoKJJ.js";import"./search-scope-Uq2fKL8U.js";import"./useMediaQuery-CJs3FAmb.js";import"./FullCompose-DqBLukCj.js";import"./confirm-dialog-D1ytBWGE.js";import"./circle-check-big-DnLRqLSe.js";import"./useSignature-C-k9m2Zf.js";import"./account-form-helpers-DhckT_PN.js";const Xt=T("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 Zt=T("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);const we=T("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=T("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 es=T("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"}]]),ts="button:not([disabled]), a[href]",P="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-sunken";function ss({active:t,dimmed:s,indent:a}){return w("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors",P,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 as({icon:t,label:s,count:a,active:n}){return e.jsxs(e.Fragment,{children:[t&&e.jsx("span",{className:w("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:w("text-2xs tabular-nums",n?"text-accent-2":"text-fg-subtle"),children:a})]})}function A({icon:t,label:s,count:a,active:n,dimmed:r,indent:o,navId:i,linkComponent:u,ariaLabel:f,title:g,onClick:p}){const m=ss({active:n,dimmed:r,indent:o}),x=e.jsx(as,{icon:t,label:s,count:a,active:n});return i&&u?u({navId:i,className:m,ariaLabel:f??s,title:g,onClick:p,children:x}):e.jsx("button",{type:"button",onClick:p,className:m,"aria-label":f,title:g,children:x})}const re={inbox:0,flagged:1,drafts:2,sent:3,archive:4,all:5,junk:6,trash:7};function ns(t){switch(t){case"inbox":return e.jsx(Je,{className:"size-4"});case"flagged":return e.jsx(pe,{className:"size-4"});case"drafts":return e.jsx(Ye,{className:"size-4"});case"sent":return e.jsx(ge,{className:"size-4"});case"archive":return e.jsx(Ge,{className:"size-4"});case"all":return e.jsx(We,{className:"size-4"});case"junk":return e.jsx(Ue,{className:"size-4"});case"trash":return e.jsx($e,{className:"size-4"})}}const oe=t=>t.role!=null,$=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 rs({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:w("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",P),children:[e.jsx(He,{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:w("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",P),children:e.jsx(be,{className:"size-3.5"})})]})}function os({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:w("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-accent transition-colors hover:bg-surface",P),children:[e.jsx(Xt,{className:"size-4 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["Save “",s,"”"]})]}),t.map(o=>e.jsx(rs,{query:o,onSelect:()=>a?.(o),onRemove:n?()=>n(o):void 0},o))]})}function is({account:t,selectedNavId:s,onSelectNav:a,linkComponent:n}){const[r,o]=l.useState(()=>ce(le,t.id,!0)),[i,u]=l.useState(()=>ce(ie,t.id,!0)),[f,g]=l.useState(!1),p=()=>{o(c=>{const S=!c;return ue(le,t.id,S),S})},m=()=>{u(c=>{const S=!c;return ue(ie,t.id,S),S})},x=t.mailboxes.filter(oe).sort((c,S)=>re[c.role]-re[S.role]),h=t.mailboxes.filter(c=>!oe(c)),b=f||h.length<=$?h:h.slice(0,$),v=h.length-b.length,j=t.status??"ready",R=j==="ready"&&x.length===0&&h.length===0;return e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",onClick:p,"aria-expanded":r,className:w("flex w-full items-center gap-1.5 px-2 pb-1 text-left transition-colors hover:text-fg",P,t.muted&&"opacity-55"),children:[r?e.jsx(te,{className:"size-3 shrink-0 text-fg-subtle"}):e.jsx(se,{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(gt,{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:[j==="loading"&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"Loading…"}),j==="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(Qe,{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"}),j==="ready"&&e.jsxs(e.Fragment,{children:[x.map(c=>e.jsx(A,{navId:c.id,linkComponent:n,icon:ns(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(A,{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")}),h.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:m,"aria-expanded":i,className:w("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",P),children:[i?e.jsx(te,{className:"size-3 shrink-0"}):e.jsx(se,{className:"size-3 shrink-0"}),e.jsx("span",{className:"flex-1",children:"Folders"}),e.jsx("span",{className:"tabular-nums opacity-70",children:h.length})]}),i&&e.jsxs(e.Fragment,{children:[b.map(c=>e.jsx(A,{navId:c.id,linkComponent:n,icon:e.jsx(qe,{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)),(v>0||f)&&h.length>$&&e.jsx("button",{type:"button",onClick:()=>g(c=>!c),className:w("ml-7 flex items-center px-2 py-1 text-2xs font-medium text-accent transition-colors hover:underline",P),children:f?"Show less":`Show all (${h.length})`})]})]})]})]})]})}function ls({accounts:t,selectedNavId:s,briefUnseen:a,onSelectNav:n,variant:r="desktop",linkComponent:o,calendarNav:i="hidden",savedSearches:u=[],saveableQuery:f,onSelectSavedSearch:g,onRemoveSavedSearch:p,onSaveCurrentSearch:m}){const x=l.useRef(null);Ke({containerRef:x,itemSelector:ts});const h=r==="drawer",b=e.jsxs("nav",{ref:h?x:void 0,className:h?"px-2 py-2":"flex-1 overflow-y-auto px-2 py-2","aria-label":"Mailboxes",children:[e.jsx(A,{navId:"brief",linkComponent:o,icon:e.jsx(Ve,{className:"size-4"}),label:"Daily brief",ariaLabel:"Daily brief",count:a,active:s==="brief",onClick:()=>n?.("brief")}),i==="shown"&&e.jsx(A,{navId:"calendar",linkComponent:o,icon:e.jsx(Zt,{className:"size-4"}),label:"Calendar",ariaLabel:"Calendar",active:s==="calendar",onClick:()=>n?.("calendar")}),e.jsx(A,{navId:"flagged",linkComponent:o,icon:e.jsx(pe,{className:"size-4"}),label:"Starred",ariaLabel:"Starred",active:s==="flagged",onClick:()=>n?.("flagged")}),e.jsx(os,{savedSearches:u,saveableQuery:f,onSelectSavedSearch:g,onRemoveSavedSearch:p,onSaveCurrentSearch:m}),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(is,{account:v,selectedNavId:s,onSelectNav:n,linkComponent:o},v.id))]});return h?b:e.jsx("aside",{ref:x,className:"flex h-full w-full flex-col bg-surface-sunken",children:b})}function cs({leading:t,search:s,actions:a,className:n}){return e.jsxs("header",{className:w("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 us(){const t=ve();if(!t)return null;const s=t.showNavPane?!t.navCollapsed:!1;return e.jsx(B,{variant:"ghost",size:"sm",icon:e.jsx($t,{className:"size-4"}),onClick:t.toggleNav,"aria-label":s?"Hide folders":"Show folders","aria-expanded":s,title:"Folders",className:"shrink-0"})}const ds={global:"Search all mail",pending:"Search mail",scoped:"Search this folder"};function ms({search:t,onCompose:s,onReportBug:a,onOpenSettings:n,composeShortcut:r,refreshControl:o,account:i}){return e.jsx(cs,{leading:e.jsx(us,{}),search:e.jsx(bt,{value:t.value,onChange:t.onChange,onClear:t.onClear,onClearQuery:t.onClearQuery,chips:t.chips,onRemoveChip:t.onRemoveChip,placeholder:ds[t.scope]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(B,{variant:"ghost",size:"sm",icon:e.jsx(es,{className:"size-4"}),title:r?`Compose (${r})`:"Compose","aria-label":"Compose",onClick:s}),e.jsx(B,{variant:"ghost",size:"sm",icon:e.jsx(ke,{className:"size-4"}),title:"Report a bug","aria-label":"Report a bug",onClick:a}),e.jsx(B,{variant:"ghost",size:"sm",icon:e.jsx(Ie,{className:"size-4"}),title:"Settings","aria-label":"Settings",onClick:n}),o,i]})})}const xs=()=>{const t=X(),s=Ce();return Rt(s.pathname)?null:e.jsx("button",{type:"button",onClick:t,"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(Dt,{className:"size-6"})})},Me=({children:t})=>{const{Account:s}=Xe();return e.jsx(s,{children:t})},hs=({email:t,onSignOut:s})=>{const a=t??"Account";return e.jsxs(vt,{trigger:e.jsx(Ut,{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(yt,{})]}),e.jsxs(jt,{onClick:s,children:[e.jsx(we,{className:"size-4"}),"Sign out"]})]})},fs=()=>e.jsx(Me,{children:({email:t,signOut:s})=>e.jsx(hs,{email:t,onSignOut:s})});function ps({accounts:t}){const{searchInput:s,onSearchChange:a,onSearchClear:n,onSearchClearQuery:r}=ye(),o=G(),i=X(),{scope:u,clearScope:f}=St(t),g=u.kind==="scoped"?[{id:u.chip.id,label:u.chip.label,tone:"scope"}]:void 0,p=l.useMemo(()=>t.map(v=>v.accountId),[t]),{hasNewMail:m}=Vt(),{state:x,errorMessage:h,refresh:b}=Qt(p);return e.jsx(ms,{search:{value:s,scope:u.kind,chips:g,onChange:a,onClear:n,onClearQuery:r,onRemoveChip:f},onCompose:i,onReportBug:je,onOpenSettings:()=>o({to:"/settings/accounts"}),composeShortcut:Nt("compose"),refreshControl:e.jsx(qt,{state:x,onRefresh:b,label:"Refresh all accounts",errorMessage:h,hasUpdate:m(p)}),account:e.jsx(fs,{})})}const Z="remit.savedSearches",gs=25;function V(){try{const t=localStorage.getItem(Z);if(!t)return[];const s=JSON.parse(t);return Array.isArray(s)?s.filter(a=>typeof a=="string"):[]}catch{return[]}}function bs(t){const s=t.trim();if(!s)return V();const a=[s,...V().filter(n=>n!==s)].slice(0,gs);try{localStorage.setItem(Z,JSON.stringify(a))}catch{return a}return a}function vs(t){const s=V().filter(a=>a!==t);try{localStorage.setItem(Z,JSON.stringify(s))}catch{return s}return s}const de=t=>/^\d/.test(t),ys=(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 js(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,i)=>ys(U(o,void 0,a),U(i,void 0,a))),{system:n,labels:r}}function Ss(t,s,a){const n=at(s)&&t.unseenCount>0;return{id:t.mailboxId,name:U(t,s,a),unseen:n?t.unseenCount:void 0,role:s,fullPath:t.fullPath}}function Ns(){const t=Ce(),s=st({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=Se(),r=G(),o=Ns(),{searchInput:i,onSearchChange:u}=ye(),[f,g]=l.useState(V),{t:p}=Ze("mail",{useSuspense:!1}),m=l.useCallback((d,k)=>p(d,{defaultValue:k}),[p]),x=J({queries:t.map(d=>({...Y({path:{accountId:d.accountId}}),staleTime:1/0}))}),{data:h}=Ne(et()),b=l.useMemo(()=>(h?.items??[]).filter(d=>Wt(d.status)).length,[h?.items]),v=l.useMemo(()=>t.map((d,k)=>{const N=x[k],E=N?.data?.items??[],C=tt(d.folderAppointments),{system:M,labels:q}=js(E,C,m),H=N?.isError?"error":N?.isLoading?"loading":"ready";return{id:d.accountId,label:d.email,email:d.email,muted:!!d.muted,outboxPending:b,status:H,onRetry:()=>N?.refetch(),mailboxes:[...M,...q].map(D=>Ss(D,C.get(D.mailboxId),m))}}),[t,x,b,m]),j=d=>{n.invalidateQueries({queryKey:nt({path:{mailboxId:d},query:{order:"desc"}})})},R=({navId:d,className:k,ariaLabel:N,title:E,children:C,onClick:M})=>d==="brief"?e.jsx(L,{to:"/mail/brief",search:{q:void 0},activeOptions:{includeSearch:!1},onClick:()=>M?.(),className:k,"aria-label":N,title:E,children:C}):d==="outbox"?e.jsx(L,{to:"/mail/outbox",search:{q:void 0},onClick:()=>M?.(),className:k,"aria-label":N,title:E,children:C}):d==="flagged"?e.jsx(L,{to:"/mail/flagged",search:{q:void 0},onClick:()=>M?.(),className:k,"aria-label":N,title:E,children:C}):d==="settings"?e.jsx(L,{to:"/settings/accounts",onClick:()=>M?.(),className:k,"aria-label":N,title:E,children:C}):e.jsx(L,{to:"/mail/$mailboxId",params:{mailboxId:d},search:{q:void 0},onClick:()=>{j(d),M?.()},className:k,"aria-label":N,title:E,children:C}),c=()=>{u(""),s?.()},S=i.trim(),I=S.length>0&&!f.includes(S)?S:void 0,F=l.useCallback(()=>{I&&g(bs(I))},[I]),Q=l.useCallback(d=>{g(vs(d))},[]),z=l.useCallback(d=>{u(d),r({to:"/mail/brief",search:{q:d}}),s?.()},[u,r,s]);return e.jsx(ls,{accounts:v,selectedNavId:o,onSelectNav:c,linkComponent:R,variant:a,savedSearches:f,saveableQuery:I,onSaveCurrentSearch:F,onSelectSavedSearch:z,onRemoveSavedSearch:Q})}function Cs(){return e.jsxs("button",{type:"button",onClick:je,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 ks({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(L,{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(Cs,{}),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 ws=({isOpen:t,onClose:s})=>{const a=l.useCallback(n=>{n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),n.stopImmediatePropagation(),s())},[s]);return l.useEffect(()=>{if(t)return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[t,a]),t?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx(rt,{label:"Dismiss keyboard shortcuts",onDismiss:s,className:"backdrop-blur-sm"}),e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Keyboard shortcuts",className:w("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:Ct.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,i)=>e.jsxs(l.Fragment,{children:[i>0&&r.keys[0]==="g"&&e.jsx("span",{className:"text-2xs text-fg-subtle",children:"then"}),e.jsx(ne,{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(ne,{children:"Esc"})," to close"]})})]})]}):null};function Is(t){const s=J({queries:t.map(a=>({...Y({path:{accountId:a.accountId}}),staleTime:1/0}))});return l.useMemo(()=>kt(s.map(a=>a.data?.items??[])),[s])}const Ms=t=>t.map(s=>s.data?.items??[]);function Os(t){const s=J({queries:t.map(a=>({...Y({path:{accountId:a.accountId}}),staleTime:1/0})),combine:Ms});return l.useMemo(()=>ot(t.map((a,n)=>({folderAppointments:a.folderAppointments,mailboxes:s[n]??[]}))),[t,s])}var _={exports:{}},xe;function Es(){if(xe)return _.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:i}=n;if(!(typeof i=="number"&&i>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${i}\` (${typeof i})`);const u=[],f=s[Symbol.iterator]();let g=!1,p=!1,m=0,x=0;const h=()=>{if(g)return;const b=f.next(),v=x;if(x++,b.done){p=!0,m===0&&r(u);return}m++,Promise.resolve(b.value).then(j=>a(j,v)).then(j=>{u[v]=j,m--,h()},j=>{g=!0,o(j)})};for(let b=0;b<i&&(h(),!p);b++);});return _.exports=t,_.exports.default=t,_.exports}var Rs=Es();const Ps=it(Rs),Ls=900*1e3,As=300,zs=(t,s)=>{if(!t)return s;const a=Number.parseInt(t,10);return Number.isFinite(a)&&a>0?a:s},Ts=60*1e3,Fs=t=>Math.max(zs(t,As)*1e3,Ts),K=Fs(mt().mailboxPollIntervalSeconds),Ds=5,W=new Set,_s=(t,s,a=Ls)=>t.filter(n=>{const r=n.lastSyncAt;return r==null?!0:s-r>a}).map(n=>n.accountId),Bs=(t,s,a=K)=>t-s>=a,Ks=(t,s)=>t.filter(a=>!s.has(a)),he=(t,s)=>{if(W.delete(t),ut(s,{softError:!0})){dt(s);return}console.warn("[remit] background mailbox sync failed",{accountId:t,error:s})},fe=(t,s)=>lt({path:{accountId:t},throwOnError:!0}).then(()=>{s.invalidateQueries({queryKey:ct({path:{accountId:t}})})}),Vs=t=>{const s=Se(),a=l.useRef(t);a.current=t;const n=t.map(r=>r.accountId).join(",");l.useEffect(()=>{const r=Date.now(),i=_s(a.current,r).filter(u=>!W.has(u));if(i.length!==0)for(const u of i)W.add(u),fe(u,s).catch(f=>{he(u,f)})},[n,s]),l.useEffect(()=>{let r=Date.now(),o;const i=new Set,u=()=>{r=Date.now();const p=Ks(a.current.map(m=>m.accountId),i);for(const m of p)i.add(m);Ps(p,m=>fe(m,s).catch(x=>{he(m,x)}).finally(()=>{i.delete(m)}),{concurrency:Ds})},f=()=>{if(document.visibilityState==="visible"){u(),o=setTimeout(f,K);return}},g=()=>{document.visibilityState==="visible"&&Bs(Date.now(),r)&&(o!==void 0&&clearTimeout(o),u(),o=setTimeout(f,K))};return o=setTimeout(f,K),document.addEventListener("visibilitychange",g),()=>{o!==void 0&&clearTimeout(o),document.removeEventListener("visibilitychange",g)}},[n,s])},Oe="remit:intelligence-open";function Qs(){try{return localStorage.getItem(Oe)!=="closed"}catch{return!0}}function qs(t){try{localStorage.setItem(Oe,t?"open":"closed")}catch{}}function Hs({panels:t,prefersOpen:s,isDesktop:a,hasThread:n}){return t.length>0?t.includes("intelligence"):a&&n&&s}function xa(){const{q:t=""}=xt({from:"/mail"}),s=G(),a=wt(),n=Et(a),r=Pt(),o=Lt(),i=r.find(At),u=i==="shortcuts",f=i==="nav",g=It(),[p,m]=l.useState(Qs),x=Hs({panels:r,prefersOpen:p,isDesktop:a==="desktop",hasThread:g!==void 0}),h=l.useCallback((y,ee)=>{o([...y?["intelligence"]:[],...ee?[ee]:[]])},[o]),b=l.useCallback(y=>{qs(y),m(y),h(y,i)},[i,h]),v=l.useCallback(y=>{h(x,y)},[x,h]),[j,R]=l.useState(t),c=Yt(j,200),S=Kt(j,c),I=ae({select:y=>zt(y.matches)}),[F,Q]=l.useState(I);if(F!==I){const y=Bt(F,I,t);Q(I),y!==void 0&&R(y)}const{data:z,isLoading:d,isError:k,error:N,refetch:E}=Ne({...ht(),staleTime:1/0}),C=!!(z&&(z.accounts?.length??0)===0);l.useEffect(()=>{C&&s({to:"/onboarding",replace:!0})},[C,s]),Jt({enabled:!u,bindings:[{key:"?",handler:()=>v("shortcuts"),noModifiers:!1,preventDefault:!0}]});const M=X(),q=Tt(),H=ae({select:y=>Ft(y.matches)?.list==="mailbox"}),D=l.useMemo(()=>({compose:M}),[M]);Mt({enabled:!H&&!q,handlers:D});const Ee=l.useCallback(y=>{R(y)},[]),Re=l.useCallback(()=>{R("")},[]),Pe=l.useCallback(()=>{R("")},[]),Le=l.useCallback(()=>{b(!x)},[b,x]),O=z?.accounts??[],Ae=l.useMemo(()=>O.map(y=>y.accountId),[O]),ze=Is(O),Te=Os(O),Fe=l.useMemo(()=>Ot(O),[O]);Vs(O);const De=l.useCallback(()=>{i==="nav"&&v(void 0)},[i,v]),_e={accounts:O,mailboxNameIndex:ze,accountNameIndex:Fe,resultFolderIndex:Te,searchQuery:S,searchInput:j,searchViewKey:I,onSearchChange:Ee,onSearchClear:Re,onSearchClearQuery:Pe,intelligenceOpen:x,onToggleIntelligence:Le},Be={isSinglePane:n,isLoading:d||C,intelligenceOpen:x,nav:e.jsx(ks,{accounts:O,onMailboxSelect:De}),topBar:n?void 0:e.jsx(ps,{accounts:O}),overlay:n?e.jsx(xs,{}):void 0,navOpen:f,onOpenNav:()=>v("nav"),onCloseNav:()=>v(void 0)};return e.jsx(ft.Provider,{value:_e,children:e.jsxs(Ht,{accountIds:Ae,children:[k?e.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:e.jsx(Gt,{title:"Couldn't load your account",error:N,onRetry:()=>{E()}})}):e.jsx(_t,{chrome:Be,children:e.jsx(pt,{})}),e.jsx(ws,{isOpen:u,onClose:()=>v(void 0)})]})})}export{xa as component,ye as useMailContext};
@@ -1 +1 @@
1
- import{c as e}from"./index-DPwE6tbL.js";const a=e("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);export{a as M};
1
+ import{c as e}from"./index-t5wgPl_5.js";const a=e("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);export{a as M};
@@ -1 +1 @@
1
- import{c as e}from"./index-DPwE6tbL.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
+ import{c as e}from"./index-t5wgPl_5.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{n as g,s as C,q as I,a7 as L,J as _,cX as A,r as b,bN as x,p as D,v as E,cY as p,x as N}from"./index-DPwE6tbL.js";import{a as w}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.",Y=(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 k({fetchMailboxes:e,mailboxId:t,signal:a,timeoutMs:o=F,pollIntervalMs:n=R,delay:r=Y,now:l=Date.now}){const s=l()+o;for(;;){a?.throwIfAborted();const c=(await e()).find(u=>u.mailboxId===t);if(c?.syncStatus===w.synced)return c;if(c?.syncStatus===w.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 Z(e){const t=g(),{data:a}=C({...I({path:{accountId:e??""}}),enabled:!!e}),o=L({...A(),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 k({mailboxId:m,signal:c,fetchMailboxes:async()=>(await t.fetchQuery({...I({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}=D("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))},q=(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=q(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 U(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 V=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 V.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?U(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,Z as u};
1
+ import{n as g,s as C,q as I,a7 as L,J as _,cX as A,r as b,bN as x,p as D,v as E,cY as p,x as N}from"./index-t5wgPl_5.js";import{a as w}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.",Y=(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 k({fetchMailboxes:e,mailboxId:t,signal:a,timeoutMs:o=F,pollIntervalMs:n=R,delay:r=Y,now:l=Date.now}){const s=l()+o;for(;;){a?.throwIfAborted();const c=(await e()).find(u=>u.mailboxId===t);if(c?.syncStatus===w.synced)return c;if(c?.syncStatus===w.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 Z(e){const t=g(),{data:a}=C({...I({path:{accountId:e??""}}),enabled:!!e}),o=L({...A(),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 k({mailboxId:m,signal:c,fetchMailboxes:async()=>(await t.fetchQuery({...I({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}=D("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))},q=(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=q(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 U(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 V=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 V.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?U(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,Z as u};
@@ -1 +1 @@
1
- import{V as t,W as r,n as a,r as i,j as s}from"./index-DPwE6tbL.js";import{O as c}from"./OnboardingWizard-CbAyE9zs.js";import"./kbd-RjIgfmMM.js";import"./account-form-helpers-DhckT_PN.js";import"./mail-C01FVOoR.js";async function m(e){e.recordCompleted(),await e.queryClient.refetchQueries({queryKey:t()}),e.navigateToInbox()}function C(){const e=r(),o=a(),n=i.useCallback(l=>{m({queryClient:o,recordCompleted:()=>e.recordEvent("onboarding.completed"),navigateToInbox:()=>{window.location.assign("/mail")}})},[e,o]);return s.jsx(c,{skipWelcome:!1,onComplete:n})}export{C as component};
1
+ import{V as t,W as r,n as a,r as i,j as s}from"./index-t5wgPl_5.js";import{O as c}from"./OnboardingWizard-BVl0tlrb.js";import"./kbd-zFFFLjXS.js";import"./account-form-helpers-DhckT_PN.js";import"./mail-DME48gi9.js";async function m(e){e.recordCompleted(),await e.queryClient.refetchQueries({queryKey:t()}),e.navigateToInbox()}function C(){const e=r(),o=a(),n=i.useCallback(l=>{m({queryClient:o,recordCompleted:()=>e.recordEvent("onboarding.completed"),navigateToInbox:()=>{window.location.assign("/mail")}})},[e,o]);return s.jsx(c,{skipWelcome:!1,onComplete:n})}export{C as component};
@@ -0,0 +1 @@
1
+ import{w as i,j as o,U as m}from"./index-t5wgPl_5.js";import{a as p}from"./search-view-B4Pm1xiE.js";import{O as t}from"./OutboxPane-Cc2QZBOB.js";import{u as s}from"./useSearchMirror-CvGGWSl0.js";import"./useMessageBodyContent-CGB2cPdQ.js";import"./FullCompose-DqBLukCj.js";import"./ErrorState-1eMrB7wr.js";import"./index-C-FSoKJJ.js";import"./useSignature-C-k9m2Zf.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-Dp6F7YRV.js";import"./useMediaQuery-CJs3FAmb.js";import"./confirm-dialog-D1ytBWGE.js";import"./useSearchTokenContext-BKwYmBwt.js";import"./kbd-zFFFLjXS.js";import"./enums-CCxx0t2v.js";import"./search-scope-Uq2fKL8U.js";import"./circle-check-big-DnLRqLSe.js";import"./clock-CJ-59Kcv.js";import"./row-actions-D0zOo3Gx.js";import"./rotate-ccw-Cv9Q4bUE.js";import"./NavMenuButton-Clvxx3Ka.js";import"./menu-D0YdtPim.js";import"./format-De9HZKjg.js";import"./outbox-status-CPfNHfUQ.js";import"./search-query-Cr_ZXBCp.js";function a(){return i({from:"/mail/outbox/draft/$outboxMessageId",shouldThrow:!1})?.outboxMessageId}function k(){const r=a();return s({to:"/mail/outbox"}),o.jsx(t,{outboxMessageId:r,children:o.jsx(p,{phone:o.jsx(t.Phone,{}),list:o.jsx(t.List,{}),reading:o.jsx(m,{})})})}export{k as component};
@@ -1 +1 @@
1
- import{c as a}from"./index-DPwE6tbL.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
+ import{c as a}from"./index-t5wgPl_5.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 Jr,r as O,j as F,B as nf,d6 as ku,b as da,a0 as ho,d7 as Dp,d8 as $p,as as Ap,ba as xu,u as Fp,d9 as zp,e as Op,af as Mp,da as jp}from"./index-DPwE6tbL.js";import{s as ml,c as Cu,a as Rp}from"./index-ThrvWdKb.js";import{C as Pp}from"./confirm-dialog-DUqOAmm6.js";import{a as Lp,D as Ip}from"./useMediaQuery-Doxj330l.js";import{B as Bp}from"./bottom-sheet-Cx-PC5pk.js";import{a as Kp,b as Wp,c as js,f as vu,U as qp}from"./attachment-file-nv-tem53.js";import{o as BC}from"./rich-text-spellcheck-provider-J8m9wz6A.js";import"./useMessageBodyContent-1bSbTn98.js";import"./useSignature-DUzSLdCk.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-GLgJ6lfP.js";const Up=Jr("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 Hp=Jr("BookPlus",[["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);const Jp=Jr("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 Vp=Jr("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 Yp=Jr("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 Xp=Jr("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"}]]),SC={html:"",text:"",formatting:[]},Gp={account:"the account default",detected:"detected from what you wrote",manual:"chosen for this message"},Qp=({language:n,languages:e,source:t,onSelect:r,helpText:o})=>{const[i,s]=O.useState(!1),a=O.useRef(null),l=O.useRef(null),u=O.useRef(null),c=O.useId(),d=O.useCallback(g=>{s(!1),g&&l.current?.focus()},[]);O.useEffect(()=>{if(!i)return;const g=m=>{a.current?.contains(m.target)||s(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[i]),O.useEffect(()=>{if(!i)return;const g=u.current?.querySelector('[aria-checked="true"]'),m=u.current?.querySelector('[role="menuitemradio"]');(g??m)?.focus()},[i]);const f=g=>{if(g.key==="Escape"){g.preventDefault(),d(!0);return}const m=[...u.current?.querySelectorAll('[role="menuitemradio"]')??[]],p=m.indexOf(document.activeElement),y=$p(g.key,p,m.length);y!==null&&(g.preventDefault(),m[y]?.focus())},h=g=>{r(g),d(!0)};return F.jsxs("div",{ref:a,className:"relative",children:[F.jsx(nf,{ref:l,variant:"ghost",size:"md","aria-label":`Message language: ${ho(n)}, ${Gp[t]}`,"aria-haspopup":"menu","aria-expanded":i,"aria-controls":i?c:void 0,onClick:()=>s(g=>!g),"data-testid":"compose-language-chip","data-language":n,"data-language-source":t,className:da("min-h-11 min-w-11 shrink-0 px-2 font-medium",n!==e[0]&&"bg-accent-2-soft text-accent-2"),children:ku(n)}),i&&F.jsxs("div",{ref:u,id:c,role:"menu","aria-label":"Message language",onKeyDown:f,"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=>F.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":g===n,lang:g,onClick:()=>h(g),className:da("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:[ho(g),F.jsx("span",{className:"shrink-0 text-xs text-fg-subtle",children:ku(g)})]},g)),F.jsx("p",{"data-testid":"compose-language-help",className:"border-t border-line px-4 pb-1 pt-2 text-xs text-fg-muted",children:o??Dp(navigator.userAgent)})]})]})},Zp=({mode:n,onToggle:e})=>F.jsx(nf,{variant:"ghost",size:"md","aria-pressed":n==="plain",title:"Plain text",onClick:e,"data-testid":"compose-mode-toggle",className:da("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 o of e)r.append("v",o);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 rf(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);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 et=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,em=et&&"documentMode"in document?document.documentMode:null,Ft=et&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Pt=et&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Fr=!(!et||!("InputEvent"in window)||em)&&"getTargetRanges"in new window.InputEvent("input"),En=et&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,of=et&&/Android/.test(navigator.userAgent),jo=et&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!of,sf=et&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ei=et&&of&&sf,Ro=et&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Ft&&!sf,tm=0,nm=1,rm=2,fa=1,ha=2,ga=4,pa=8,om=16,Rs=32,Ps=64,yl=128,im=1,sm=2,am=3,lm=4,um=5,cm=6,ko=jo||En||Ro?" ":"​",In=`
1
+ import{c as Jr,r as O,j as F,B as nf,d6 as ku,b as da,a0 as ho,d7 as Dp,d8 as $p,as as Ap,ba as xu,u as Fp,d9 as zp,e as Op,af as Mp,da as jp}from"./index-t5wgPl_5.js";import{s as ml,c as Cu,a as Rp}from"./index-C-FSoKJJ.js";import{C as Pp}from"./confirm-dialog-D1ytBWGE.js";import{a as Lp,D as Ip}from"./useMediaQuery-CJs3FAmb.js";import{B as Bp}from"./bottom-sheet-wto9gHgG.js";import{a as Kp,b as Wp,c as js,f as vu,U as qp}from"./attachment-file-Dzi65u3g.js";import{o as BC}from"./rich-text-spellcheck-provider-J8m9wz6A.js";import"./useMessageBodyContent-CGB2cPdQ.js";import"./useSignature-C-k9m2Zf.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-Dp6F7YRV.js";const Up=Jr("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 Hp=Jr("BookPlus",[["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);const Jp=Jr("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 Vp=Jr("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 Yp=Jr("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 Xp=Jr("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"}]]),SC={html:"",text:"",formatting:[]},Gp={account:"the account default",detected:"detected from what you wrote",manual:"chosen for this message"},Qp=({language:n,languages:e,source:t,onSelect:r,helpText:o})=>{const[i,s]=O.useState(!1),a=O.useRef(null),l=O.useRef(null),u=O.useRef(null),c=O.useId(),d=O.useCallback(g=>{s(!1),g&&l.current?.focus()},[]);O.useEffect(()=>{if(!i)return;const g=m=>{a.current?.contains(m.target)||s(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[i]),O.useEffect(()=>{if(!i)return;const g=u.current?.querySelector('[aria-checked="true"]'),m=u.current?.querySelector('[role="menuitemradio"]');(g??m)?.focus()},[i]);const f=g=>{if(g.key==="Escape"){g.preventDefault(),d(!0);return}const m=[...u.current?.querySelectorAll('[role="menuitemradio"]')??[]],p=m.indexOf(document.activeElement),y=$p(g.key,p,m.length);y!==null&&(g.preventDefault(),m[y]?.focus())},h=g=>{r(g),d(!0)};return F.jsxs("div",{ref:a,className:"relative",children:[F.jsx(nf,{ref:l,variant:"ghost",size:"md","aria-label":`Message language: ${ho(n)}, ${Gp[t]}`,"aria-haspopup":"menu","aria-expanded":i,"aria-controls":i?c:void 0,onClick:()=>s(g=>!g),"data-testid":"compose-language-chip","data-language":n,"data-language-source":t,className:da("min-h-11 min-w-11 shrink-0 px-2 font-medium",n!==e[0]&&"bg-accent-2-soft text-accent-2"),children:ku(n)}),i&&F.jsxs("div",{ref:u,id:c,role:"menu","aria-label":"Message language",onKeyDown:f,"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=>F.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":g===n,lang:g,onClick:()=>h(g),className:da("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:[ho(g),F.jsx("span",{className:"shrink-0 text-xs text-fg-subtle",children:ku(g)})]},g)),F.jsx("p",{"data-testid":"compose-language-help",className:"border-t border-line px-4 pb-1 pt-2 text-xs text-fg-muted",children:o??Dp(navigator.userAgent)})]})]})},Zp=({mode:n,onToggle:e})=>F.jsx(nf,{variant:"ghost",size:"md","aria-pressed":n==="plain",title:"Plain text",onClick:e,"data-testid":"compose-mode-toggle",className:da("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 o of e)r.append("v",o);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 rf(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);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 et=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,em=et&&"documentMode"in document?document.documentMode:null,Ft=et&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Pt=et&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Fr=!(!et||!("InputEvent"in window)||em)&&"getTargetRanges"in new window.InputEvent("input"),En=et&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,of=et&&/Android/.test(navigator.userAgent),jo=et&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!of,sf=et&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ei=et&&of&&sf,Ro=et&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Ft&&!sf,tm=0,nm=1,rm=2,fa=1,ha=2,ga=4,pa=8,om=16,Rs=32,Ps=64,yl=128,im=1,sm=2,am=3,lm=4,um=5,cm=6,ko=jo||En||Ro?" ":"​",In=`
2
2
 
3
3
  `,_l=Pt?" ":ko,hn={bold:1,capitalize:1024,code:16,highlight:yl,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},dm={directionless:1,unmergeable:2},Ti={center:2,end:6,justify:4,left:1,right:3,start:5},fm={[sm]:"center",[cm]:"end",[lm]:"justify",[im]:"left",[am]:"right",[um]:"start"},hm={normal:0,segmented:2,token:1},gm={[tm]:"normal",[rm]:"segmented",[nm]:"token"},Su="$config";function wu(){return we()._blockCursorElement}function pm(n){return n!==null&&n.nodeType===1&&n.hasAttribute("data-lexical-slot")}let af=class gi{element;before;after;constructor(e,t,r){this.element=e,this.before=t||null,this.after=r||null}withBefore(e){return new gi(this.element,e,this.after)}withAfter(e){return new gi(this.element,this.before,e)}withElement(e){return this.element===e?this:new gi(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 o=Eu(e,this.element);if(o===null)return"after";const i=Array.prototype.indexOf.call(e.childNodes,o);if(i<0)return"after";if(t===e)return r<=i?"before":"after";const s=Eu(e,t);if(s===null)return"after";const a=Array.prototype.indexOf.call(e.childNodes,s);return a>=0&&a<=i?"before":"after"}getInsertionAnchor(){return this.before}};function Eu(n,e){let t=e;for(;t!==null&&t.parentNode!==n;)t=t.parentNode;return t}let lf=class pi extends af{withBefore(e){return new pi(this.element,e,this.after)}withAfter(e){return new pi(this.element,this.before,e)}withElement(e){return this.element===e?this:new pi(e,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()}getFirstChildAnchor(){let e=super.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;for(;pm(t);)e=t,t=t.nextSibling;const r=e?e.nextSibling:this.element.firstChild;return r!==null&&r===wu()?r:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(this.element.__lexicalLastChildKind=e,e===null)this.removeManagedLineBreak();else{const t=e==="decorator"&&(Ro||En||jo);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,o=this.before,i=ae().createElement("br");if(i.setAttribute("data-lexical-managed-linebreak","true"),r.insertBefore(i,o),e){const s=ae().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,i),r.__lexicalLineBreak=s}else r.__lexicalLineBreak=i}getFirstChildOffset(){const e=this.getFirstChild(),t=this.getInsertionAnchor();let r=0;for(let o=this.element.firstChild;o!==null&&o!==e&&o!==t;o=o.nextSibling)r++;return r}resolveChildIndex(e,t,r,o){if(r===this.element){const l=this.getFirstChildOffset(),u=wu(),c=this.element.childNodes,d=Math.min(o,c.length);let f=0;for(let h=l;h<d;h++)c[h]!==u&&f++;return[e,Math.min(f,e.getChildrenSize())]}const i=Tu(t,r);i.push(o);const s=Tu(t,this.element);let a=e.getIndexWithinParent();for(let l=0;l<s.length;l++){const u=i[l],c=s[l];if(u===void 0||u<c)break;if(u>c){a+=1;break}}return[e.getParentOrThrow(),a]}};function Tu(n,e){const t=[];let r=e;for(;r!==n&&r!==null;r=r.parentNode){let o=0;for(let i=r.previousSibling;i!==null;i=i.previousSibling)o++;t.push(o)}return r!==n&&$(225),t.reverse()}let uf;try{uf="0.49.0+prod.esm"}catch{}const cf=uf??'"<unknown>+source"';let eo=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 Mn=null;function df(n,e=1e3){return n instanceof ma?n.clone():n.size<e?new Map(n):new ma().init(new Map(n),void 0,n.size)}let ma=class ff{_mutable=!1;_old=void 0;_nursery=void 0;_size=0;clone(){return this._mutable=!1,new ff().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===Mn?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,o]of this._nursery)o!==Mn?t.set(r,o):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 o=this.getNursery();return r!==Mn&&r!==void 0||(this._size++,r===Mn&&o.delete(e)),o.set(e,t),this}delete(e){const t=this.has(e);return t&&(this.getNursery().set(e,Mn),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 o=t(e);return this.set(e,o),o}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 o=r[0],i=e?e.get(o):void 0;i!==Mn&&(i!==void 0&&(r[1]=i),yield r)}if(e)for(const r of e)r[1]===Mn||t&&t.has(r[0])||(yield r)}forEach(e,t){t!==void 0&&(e=e.bind(t));for(const[r,o]of this.entries())e(o,r,this)}get[Symbol.toStringTag](){return"GenMap"}[Symbol.iterator](){return this.entries()}};function Ni(n,e,t,r,o,i){if(C(n)){let s=n.getFirstChild();for(;s!==null;){const a=s.__key;s.__parent===e&&((C(s)||dn(s)&&s.__slots!==null)&&Ni(s,a,t,r,o,i),t.has(a)||i.delete(a),o.push(a)),s=s.getNextSibling()}}for(const s of dn(n)&&n.__slots!==null?n.__slots.values():[]){const a=r.get(s);a!==void 0&&Yn(a)&&a.__slotHost===e&&((C(a)||dn(a)&&a.__slots!==null)&&Ni(a,s,t,r,o,i),t.has(s)||i.delete(s),o.push(s))}}let ya=!1,bl=0;function mm(n){bl=n.timeStamp}function Ls(n,e,t){const r=n.nodeName==="BR",o=e.__lexicalLineBreak;return o&&(n===o||r&&n.previousSibling===o)||r&&Xr(n,t)!==void 0}function ym(n,e,t){const r=Pe(gt(t)),o=r&&ft(r,t._rootElement);let i=null,s=null;o!==null&&o.anchorNode===n&&(i=o.anchorOffset,s=o.focusOffset);const a=n.nodeValue;a!==null&&Ll(e,a,i,s,!1)}function _m(n,e,t){if(N(n)){const r=n.anchor.getNode();if(r.is(t)&&n.format!==r.getFormat())return!1}return ht(e)&&t.isAttached()}function bm(n,e,t){for(let r=n;r&&!Lh(r);r=or(r)){const o=Xr(r,e);if(o!==void 0){const i=te(o,t);if(i)return ne(i)||!q(r)?void 0:[r,i]}}}function hf(n,e,t){ya=!0;const r=performance.now()-bl>100;try{wt(n,()=>{const o=z()||(function(d){return d.read("latest",()=>{const f=z();return f!==null?f.clone():null})})(n),i=new Map,s=n._editorState,a=n._blockCursorElement;let l=!1,u="";for(let d=0;d<e.length;d++){const f=e[d],h=f.type,g=f.target,m=bm(g,n,s);if(!m)continue;const[p,y]=m;if(h==="characterData")r&&D(y)&&ht(g)&&_m(o,g,y)&&ym(g,y,n);else if(h==="childList"){l=!0;const _=f.addedNodes;for(let S=0;S<_.length;S++){const x=_[S],w=Sh(x),v=x.parentNode;if(!(v==null||x===a||w!==null||Ls(x,v,n)||n._slotsUsed&&q(x)&&x.hasAttribute("data-lexical-slot")||Lh(x))){if(Pt){const E=(q(x)?x.innerText:null)||x.nodeValue;E&&(u+=E)}v.removeChild(x)}}const b=f.removedNodes,k=b.length;if(k>0){let S=0;for(let x=0;x<k;x++){const w=b[x];(Ls(w,g,n)||a===w)&&(g.appendChild(w),S++)}k!==S&&i.set(p,y)}}}if(i.size>0)for(const[d,f]of i)f.reconcileObservedMutation(d,n);const c=t.takeRecords();if(c.length>0){for(let d=0;d<c.length;d++){const f=c[d],h=f.addedNodes,g=f.target;for(let m=0;m<h.length;m++){const p=h[m],y=p.parentNode;y==null||p.nodeName!=="BR"||Ls(p,g,n)||y.removeChild(p)}}t.takeRecords()}o!==null&&(l&&_e(o),Pt&&$h(n)&&o.insertRawText(u))})}finally{ya=!1}}function gf(n){const e=n._observer;e!==null&&hf(n,e.takeRecords(),e)}function pf(n){(function(e){bl===0&&gt(e).addEventListener("textInput",mm,!0)})(n),n._observer=new MutationObserver((e,t)=>{hf(n,e,t)})}const Nu="latest";let km=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||vm).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function Po(n,e){return new km(n,e)}function Lo(n,e,t=Nu){const r=(t===Nu?n.getLatest():n).__state;return r?r.getValue(e):e.defaultValue}function Cr(n,e,t){let r;if(Ie(),typeof t=="function"){const i=n.getLatest(),s=Lo(i,e);if(r=t(s),e.isEqual(s,r))return i}else r=t;const o=n.getWritable();return yf(o).updateFromKnown(e,r),o}function xm(n){const e=new Map,t=new Set;for(const{ownNodeConfig:r}of Ul(typeof n=="function"?n:n.replace))if(r&&r.stateConfigs)for(const o of r.stateConfigs){let i;"stateConfig"in o?(i=o.stateConfig,o.flat&&t.add(i.key)):i=o,e.set(i.key,i)}return{flatKeys:t,sharedConfigMap:e}}const Du=new Set(["__proto__","constructor","prototype"]);let Cm=class mf{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,r=void 0,o=new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=r,this.knownState=o;const{sharedConfigMap:s}=this.sharedNodeState,a=i!==void 0?i:(function(l,u,c){let d=c.size;if(u)for(const f in u){const h=l.get(f);h&&c.has(h)||d++}return d})(s,r,o);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 o=this.unknownState[e.key];o!==void 0&&(r=e.parse(o)),this.updateFromKnown(e,r)}return r}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const e={...this.unknownState},t={};for(const[r,o]of this.knownState)r.isEqual(o,r.defaultValue)?delete e[r.key]:e[r.key]=r.unparse(o);for(const r of this.sharedNodeState.flatKeys)r in e&&(t[r]=e[r],delete e[r]);return $u(e)&&(t.$=e),t}getWritable(e){if(this.node===e)return this;const{sharedNodeState:t,unknownState:r}=this,o=new Map(this.knownState);return new mf(e,t,(function(i,s,a){let l;if(a)for(const[u,c]of Object.entries(a)){if(Du.has(u))continue;const d=i.get(u);d?s.has(d)||s.set(d,d.parse(c)):(l=l||{},l[u]=c)}return l})(t.sharedConfigMap,o,r),o,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:o,unknownState:i}=this;o.has(e)||i&&r in i||(i&&(delete i[r],this.unknownState=$u(i)),this.size++),o.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,o]of Object.entries(e))this.updateFromUnknown(r,o)}};function yf(n){const e=n.getWritable(),t=e.__state?e.__state.getWritable(e):new Cm(e,_f(e));return e.__state=t,t}function _f(n){return n.__state?n.__state.sharedNodeState:xh(we(),n.getType()).sharedNodeState}function $u(n){if(n)for(const e in n)return n}function vm(n){return n}function Au(n,e,t){for(const[r,o]of e.knownState){if(n.has(r.key))continue;n.add(r.key);const i=t?t.getValue(r):r.defaultValue;if(i!==o&&!r.isEqual(i,o))return!0}return!1}function Fu(n,e,t){const{unknownState:r}=e,o=t?t.unknownState:void 0;if(r){for(const[i,s]of Object.entries(r))if(!n.has(i)&&(n.add(i),s!==(o?o[i]:void 0)))return!0}return!1}function zu(n,e){const t=n.__state;return t&&t.node===n?t.getWritable(e):t}function Ou(n,e){const t=n.__mode,r=n.__format,o=n.__style,i=e.__mode,s=e.__format,a=e.__style,l=n.__state,u=e.__state;return(t===null||t===i)&&(r===null||r===s)&&(o===null||o===a)&&(n.__state===null||l===u||(function(c,d){if(c===d)return!0;const f=new Set;return!(c&&Au(f,c,d)||d&&Au(f,d,c)||c&&Fu(f,c,d)||d&&Fu(f,d,c))})(l,u))}function Mu(n,e){const t=n.mergeWithSibling(e),r=he()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function ju(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(Ou(e,r)){r=Mu(e,r);break}break}e.remove()}for(;(t=r.getNextSibling())!==null&&D(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Ou(r,t)){r=Mu(r,t);break}break}t.remove()}}else r.remove()}function Kt(n){return Ru(n.anchor),Ru(n.focus),n}function Ru(n){for(;n.type==="element";){const e=n.getNode(),t=n.offset;let r,o;if(t===e.getChildrenSize()?(r=e.getChildAtIndex(t-1),o=!0):(r=e.getChildAtIndex(t),o=!1),D(r)){n.set(r.__key,o?r.getTextContentSize():0,"text",!0);break}if(!C(r))break;n.set(r.__key,o?r.getChildrenSize():0,"element",!0)}}const xo=Symbol.for("@lexical/CachedTextSize");function Pu(n,e){return ba.read(()=>{let t=0,r=n;for(let o=0;o<e&&r!==null;o++){const i=zt.get(r);if(i===void 0&&$(345,r),C(i)){const s=De.get(r);if(s!==void 0&&C(s)&&s.__parent!==i.__parent)t+=i.getTextContentSize();else{const a=qn.get(r),l=a&&a.__lexicalTextContent;typeof l!="string"&&$(346,i.getType()),t+=l.length}o<e-1&&!i.isInline()&&(t+=2)}else{const s=i[xo];s===void 0&&$(347,i.getType(),r),t+=s}r=i.__next}return t},{editor:de})}function bf(n){C(n)||n[xo]===void 0&&(n[xo]=D(n)?n.__text.length:n.getTextContentSize())}const Sm=4;let Co,de,vo,oe="",ze=null,Ye=null,qe=null;function Wt(){return{firstTextKey:qe,format:ze,style:Ye}}function Ct(n){n.firstTextKey!==null&&(ze=n.format,Ye=n.style,qe=n.firstTextKey)}function _a(n){if(qe!==null)return;const e=n.__lexicalFirstTextKey;if(e===void 0&&$(348),e===null)return;const t=De.get(e);D(t)&&(ze=t.getFormat(),Ye=t.getStyle(),qe=e)}let ls,go,po,zt,ba,De,qn,ka,So,Un,ln=!1,Di=!1;function xn(n,e){const t=zt.get(n),r=De.has(n);if(e!==null){const o=wa(n);o.parentNode===e&&e.removeChild(o)}if(!r){if(de._keyToDOMMap.delete(n),C(t)){const o=Vi(t,zt);xa(o,0,o.length-1,null)}if(t!==void 0){for(const o of pt(t).values()){const i=va(o);xn(o,null),i!==null&&i.remove()}Il(So,vo,ls,t,"destroyed")}}}function xa(n,e,t,r){for(let o=e;o<=t;++o){const i=n[o];i!==void 0&&xn(i,r)}}function jn(n,e){n.setProperty("text-align",e)}const wm="40px";function kf(n,e){const t=Co.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, ${wm}))`)}function xf(n,e){const t=n.style;e===0?jn(t,""):e===1?jn(t,"left"):e===2?jn(t,"center"):e===3?jn(t,"right"):e===4?jn(t,"justify"):e===5?jn(t,"start"):e===6&&jn(t,"end")}function Ca(n,e){const t=(function(r){const o=r.__dir;if(o!==null)return o;if(Oe(r))return null;const i=r.getParent();return i===null||Se(i)&&i.__dir===null?"auto":null})(e);t!==null?n.dir=t:n.removeAttribute("dir")}function Cf(n){const e=ae().createElement("div");return e.setAttribute("data-lexical-slot",n),e.style.display="none",e}function vf(n,e,t){e||n.contentEditable==="false"?Oy(t,de):t.removeAttribute("contenteditable")}function Lu(n,e,t){const r=oe,o=Wt();oe="";let i="";const s=ne(n);for(const[a,l]of t){const u=Cf(a);vf(e,s,u),e.appendChild(u),oe="";const c=Wt();Cn(l,Dt(n,u,de)),Ct(c),Sf(n,a,e,u),i+=oe}return Ct(o),oe=r,i}function pt(n){return dn(n)&&n.__slots!==null?n.__slots:Kh}function Sf(n,e,t,r){const o=Un.$getSlotTargetElement(n,e,t,de);o!==null&&(r.parentElement!==o&&o.appendChild(r),r.style.display="")}function va(n){const e=qn.get(n);return e!==void 0?e.parentElement:null}function Iu(n,e,t){const r=pt(n),o=pt(e);for(const[c,d]of r)if(!o.has(c)){const f=va(d);xn(d,null),f!==null&&f.remove()}const i=oe,s=Wt();let a="",l=null;const u=ne(e);for(const[c,d]of o){const f=r.get(c);let h=f!==void 0?va(f):null;oe="";const g=Wt();if(h===null){h=Cf(c);let m=null;for(const p of t.children)if(!p.hasAttribute("data-lexical-slot")){m=p;break}t.insertBefore(h,m),Cn(d,Dt(e,h,de))}else f===d?an(d,h):(f!==void 0&&xn(f,h),Cn(d,Dt(e,h,de)));if(Ct(g),vf(t,u,h),Sf(e,c,t,h),a+=oe,h.parentElement===t){const m=l===null?t.firstChild:l.nextSibling;m!==h&&t.insertBefore(h,m),l=h}}return Ct(s),oe=i,a}function Cn(n,e){const t=De.get(n);if(t===void 0&&$(60),e!==null){const o=zt.get(n);if(o!==void 0){const i=qn.get(n);if(i!==void 0){const s=Yn(o)?o.__slotHost:null,a=Yn(t)?t.__slotHost:null,l=o.__parent!==t.__parent||s!==a,u=a!==null&&i.parentElement!==e.element;if(l||u)return e.insertChild(i),an(n,e.element)}}}const r=Un.$createDOM(t,de);if((function(o,i,s){const a=s._keyToDOMMap;wh(i,s,o),a.set(o,i)})(n,r,de),D(t)?r.setAttribute("data-lexical-text","true"):ne(t)&&(r.setAttribute("data-lexical-decorator","true"),Hi(r,{captureSelection:!0})),C(t)){const o=t.__indent,i=t.__size;Ca(r,t),o!==0&&kf(r,o);const s=pt(t),a=s.size>0?Lu(t,r,s):"";if(i===0)r.__lexicalTextContent=a,r.__lexicalFirstTextKey=null,oe+=a,s.size>0&&(r.__lexicalSlotTextLength=a.length);else{const u=oe,c=i-1;if(Sa(Vi(t,De),t,0,c,Dt(t,r,de)),a!==""){const d=r.__lexicalTextContent||"";r.__lexicalTextContent=a+d,oe=u+a+d}s.size>0&&(r.__lexicalSlotTextLength=a.length)}const l=t.__format;l!==0&&xf(r,l),t.isInline()||wf(null,t,r)}else{const o=t.getTextContent();if(ne(t)){const i=t.decorate(de,Co);i!==null&&Ef(n,i),r.contentEditable="false";const s=pt(t);s.size>0&&Lu(t,r,s)}oe+=o}return e!==null&&e.insertChild(r),Un.$decorateDOM(t,null,r,de),bf(t),Il(So,vo,ls,t,"created"),r}function Sa(n,e,t,r,o){const i=oe,s=Wt();oe="",ze=null,Ye=null,qe=null;let a=t;for(;a<=r;++a){const u=Wt();Cn(n[a],o);const c=De.get(n[a]);c!==null&&D(c)?ze===null&&(ze=c.getFormat(),Ye=c.getStyle(),qe=c.__key):C(c)&&a<r&&!c.isInline()&&(oe+=In),Ct(u)}const l=de._keyToDOMMap.get(e.__key);l===void 0&&$(349,e.__key),l.__lexicalTextContent=oe,l.__lexicalFirstTextKey=qe,oe=i+oe,Ct(s)}function wf(n,e,t){const r=Dt(e,t,de),o=r.element.__lexicalLastChildKind??null,i=(function(s,a){if(s){const l=s.__last;if(l){const u=a.get(l);if(u)return We(u)?"line-break":ne(u)&&u.isInline()?"decorator":null}return pt(s).size>0?null:"empty"}return null})(e,De);o!==i&&r.setManagedLineBreak(i)}function Em(n,e,t){var r;ze=null,Ye=null,qe=null,(function(o,i,s){const a=oe,l=o.__size,u=i.__size;oe="";const c=s.element,d=de._keyToDOMMap.get(i.__key);d===void 0&&$(351,i.__key);const f=u-l;if(!ln&&Math.abs(f)<=1&&l>=Sm&&o.__first===i.__first&&(f!==0||!de._cloneNotNeeded.has(o.__key))){const h=d.__lexicalTextContent,g=ka.get(o.__key);if(!ln&&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,S=0;for(;b!==null&&S<_;){if(!y.has(b))return null;k=b;const x=De.get(b);if(x===void 0)return null;b=x.__prev,S++}return S!==_||b!==null&&y.has(b)?null:k})(i,g);if(m!==null){const p=g.size;if(f===0){const y=Pu(m,p);let _=m,b=0;for(;_!==null&&b<p;){const v=De.get(_);if(v===void 0)break;const E=Wt();an(_,c),D(v)&&ze===null&&(ze=v.getFormat(),Ye=v.getStyle(),qe=v.__key),Ct(E),_=v.__next,b++}let k="";for(_=m,b=0;_!==null&&b<p;){const v=De.get(_);if(v===void 0)break;let E;if(C(v)){const A=de._keyToDOMMap.get(_),T=A&&A.__lexicalTextContent;typeof T!="string"&&$(352,v.getType()),E=T}else E=v.getTextContent();k+=E,b<p-1&&C(v)&&!v.isInline()&&(k+=In),_=v.__next,b++}const S=d.__lexicalSlotTextLength||0,x=S>0?h.slice(S):h,w=x.slice(0,x.length-y)+k;return d.__lexicalTextContent=w,oe=a+w,void Bu(i,d,g)}if((function(y,_,b,k,S,x,w,v){if(v!==1&&v!==-1||w!==(v===1?2:1))return!1;const A=w-v;let T=y.__last;for(let re=0;re<A-1;re++){if(T===null)return!1;const $e=zt.get(T);if($e===void 0)return!1;T=$e.__prev}if(T===null)return!1;const M=De.get(x),j=zt.get(T);if(M===void 0||j===void 0||M.__prev!==j.__prev)return!1;const R=[];let B=x;for(let re=0;re<w;re++){if(B===null)return!1;R.push(B);const $e=De.get(B);B=$e?$e.__next:null}const Q=[];B=T;for(let re=0;re<A;re++){if(B===null)return!1;Q.push(B);const $e=zt.get(B);B=$e?$e.__next:null}const ie=new Set(Q),Z=new Set(R),L=[];let P=0,K=0;for(;P<A&&K<w;)if(R[K]===Q[P])L.push({key:R[K],kind:"reconcile"}),P++,K++;else if(Z.has(Q[P])){if(ie.has(R[K]))return!1;L.push({key:R[K],kind:"create",nextIndex:K}),K++}else L.push({key:Q[P],kind:"destroy"}),P++;for(;P<A;)L.push({key:Q[P++],kind:"destroy"});for(;K<w;)L.push({key:R[K],kind:"create",nextIndex:K}),K++;const se=Pu(T,A);for(const re of L){const $e=Wt();if(re.kind==="reconcile")an(re.key,b.element);else if(re.kind==="destroy")xn(re.key,b.element);else{let it=null;for(let nn=re.nextIndex+1;nn<w;nn++){const _n=de._keyToDOMMap.get(R[nn]);if(_n!==void 0){it=_n;break}}Cn(re.key,b.withBefore(it??b.before))}if(re.kind!=="destroy"){const it=De.get(re.key);it&&D(it)&&ze===null&&(ze=it.getFormat(),Ye=it.getStyle(),qe=it.__key)}Ct($e)}let ee="";for(let re=0;re<w;re++){const $e=De.get(R[re]);if($e===void 0)return!1;let it;if(C($e)){const nn=de._keyToDOMMap.get(R[re]),_n=nn&&nn.__lexicalTextContent;typeof _n!="string"&&$(350,$e.getType()),it=_n}else it=$e.getTextContent();ee+=it,re<w-1&&C($e)&&!$e.isInline()&&(ee+=In)}const xe=k.__lexicalSlotTextLength||0,ot=xe>0?S.slice(xe):S;return k.__lexicalTextContent=ot.slice(0,ot.length-se)+ee,!0})(o,0,s,d,h,m,p,f)){const y=d.__lexicalTextContent;return typeof y!="string"&&$(353),oe=a+y,void Bu(i,d,g)}}}if(f===0){let m=o.__first,p=0;for(;m!==null;){const y=De.get(m);if(y===void 0)break;const _=ln||po.has(m)||go.has(m),b=Wt();if(_)an(m,c);else{let k,S;if(C(y)){S=qn.get(m);const x=S&&S.__lexicalTextContent;typeof x!="string"&&$(354,y.getType()),k=x}else k=y.getTextContent();oe+=k,S!==void 0&&_a(S)}D(y)?ze===null&&(ze=y.getFormat(),Ye=y.getStyle(),qe=y.__key):C(y)&&p<u-1&&!y.isInline()&&(oe+=In),Ct(b),m=y.__next,p++}return d.__lexicalTextContent=oe,d.__lexicalFirstTextKey=qe,void(oe=a+oe)}}if(l===1&&u===1){const h=o.__first,g=i.__first;if(h===g)an(h,c);else{const p=wa(h),y=Cn(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 _}xn(h,null)}const m=De.get(g);D(m)&&ze===null&&(ze=m.getFormat(),Ye=m.getStyle(),qe=m.__key)}else{const h=Vi(o,zt),g=Vi(i,De);if(h.length!==l&&$(227),g.length!==u&&$(228),l===0)u!==0&&Sa(g,i,0,u-1,s);else if(u===0){if(l!==0){const m=s.after==null&&s.before==null&&pt(i).size===0&&s.element.__lexicalLineBreak==null;xa(h,0,l-1,m?null:c),m&&(c.textContent="")}}else(function(m,p,y,_,b,k){const S=_-1,x=b-1;let w,v,E=k.getFirstChild(),A=0,T=0;for(;A<=S&&T<=x;){const R=p[A],B=y[T],Q=Wt();if(R===B)E=Is(an(B,k.element)),A++,T++;else{if(v===void 0&&(v=Ku(y,T)),w===void 0)w=Ku(p,A);else if(!w.has(R)){A++,Ct(Q);continue}if(!v.has(R)){E=Is(wa(R)),xn(R,k.element),A++,w.delete(R),Ct(Q);continue}if(w.has(B)){const Z=Pr(de,B);Z!==E&&k.withBefore(E??k.before).insertChild(Z),E=Is(an(B,k.element)),A++,T++}else Cn(B,k.withBefore(E??k.before)),T++}const ie=De.get(B);ie!==null&&D(ie)?ze===null&&(ze=ie.getFormat(),Ye=ie.getStyle(),qe=ie.__key):C(ie)&&T<=x&&!ie.isInline()&&(oe+=In),Ct(Q)}const M=A>S,j=T>x;if(M&&!j){const R=y[x+1],B=R===void 0?null:de.getElementByKey(R);Sa(y,m,T,x,k.withBefore(B??k.before))}else j&&!M&&xa(p,A,S,k.element)})(i,h,g,l,u,s)}d.__lexicalTextContent=oe,d.__lexicalFirstTextKey=qe,oe=a+oe})(n,e,Dt(e,t,de)),Se(e)||(r=e,ze==null||ze===r.__textFormat||Di||r.setTextFormat(ze),(function(o){Ye==null||Ye===o.__textStyle||Di||o.setTextStyle(Ye)})(e))}function Bu(n,e,t){const r=e.__lexicalFirstTextKey;if(r!=null){const o=n.__key;let i=r;for(;i!==null;){const s=De.get(i);if(s===void 0){i=null;break}if(s.__parent===o)break;i=s.__parent}if(i!==null&&!t.has(i)){const s=De.get(r);if(D(s))return ze=s.getFormat(),void(Ye=s.getStyle())}}e.__lexicalFirstTextKey=qe}function an(n,e){const t=zt.get(n);let r=De.get(n);t!==void 0&&r!==void 0||$(61);const o=ln||po.has(n)||go.has(n),i=Pr(de,n);if(t===r&&!o){let s;if(C(t)){const a=i.__lexicalTextContent;typeof a!="string"&&$(355,t.getType()),s=a,_a(i)}else s=t.getTextContent();return oe+=s,i}if(t!==r&&o&&Il(So,vo,ls,r,"updated"),Un.$updateDOM(r,t,i,de)){const s=Cn(n,null);return e===null&&$(62),e.replaceChild(s,i),xn(n,null),s}if(C(t)){C(r)||$(334,n);const s=r.__indent;(ln||s!==t.__indent)&&kf(i,s);const a=r.__format;(ln||a!==t.__format)&&xf(i,a);const l=o&&(pt(r).size>0||pt(t).size>0)?Iu(t,r,i):"";if(o){const u=oe;if(Em(t,r,i),Oe(r)||r.isInline()||wf(0,r,i),l!==""){const c=i.__lexicalTextContent||"";i.__lexicalTextContent=l+c,oe=u+l+c,i.__lexicalSlotTextLength=l.length}else(pt(r).size>0||pt(t).size>0)&&(i.__lexicalSlotTextLength=0)}else{const u=i.__lexicalTextContent;typeof u!="string"&&$(356,t.getType()),oe+=u,_a(i)}if((ln||r.__dir!==t.__dir||r.__parent!==t.__parent)&&(Ca(i,r),Oe(r)&&!ln))for(const u of r.getChildren())C(u)&&Ca(Pr(de,u.getKey()),u)}else{const s=r.getTextContent();if(ne(r)){const a=r.decorate(de,Co);a!==null&&Ef(n,a),o&&(pt(r).size>0||pt(t).size>0)&&Iu(t,r,i)}oe+=s}if(!Di&&Oe(r)){const s=r.getLatest();if(s.__cachedText!==oe){const a=s.getWritable();a.__cachedText=oe,r=a}}return Un.$decorateDOM(r,t,i,de),bf(r),i}function Ef(n,e){let t=de._pendingDecorators;const r=de._decorators;if(t===null){if(r[n]===e)return;t=Eh(de)}t[n]=e}function Is(n){let e=n.nextSibling;return e!==null&&e===de._blockCursorElement&&(e=e.nextSibling),e}function Ku(n,e){const t=new Set;for(let r=e;r<n.length;r++)t.add(n[r]);return t}function Tm(n,e,t,r,o,i){oe="",ze=null,Ye=null,qe=null,ln=r===2,de=t,Co=t._config,Un=t._config.dom||Bi,vo=t._nodes,ls=de._listeners.mutation,go=o,po=i,zt=n._nodeMap,ba=n,De=e._nodeMap,Di=e._readOnly,qn=df(t._keyToDOMMap),ka=(function(){const a=new Map,l=u=>{for(const c of u){const d=De.get(c);if(d===void 0)continue;const f=d.__parent;if(f===null)continue;let h=a.get(f);h===void 0&&(h=new Set,a.set(f,h)),h.add(c)}};return l(go.keys()),l(po),a})();const s=new Map;return So=s,an("root",null),de=void 0,vo=void 0,go=void 0,po=void 0,zt=void 0,ba=void 0,De=void 0,Co=void 0,qn=void 0,ka=void 0,So=void 0,Un=Bi,s}function wa(n){const e=qn.get(n);return e===void 0&&$(75,n),e}function W(n){return{type:n}}const qt=W("SELECTION_CHANGE_COMMAND"),Tf=W("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),us=W("CLICK_COMMAND"),Nf=W("BEFORE_INPUT_COMMAND"),Df=W("INPUT_COMMAND"),$f=W("COMPOSITION_START_COMMAND"),Af=W("COMPOSITION_END_COMMAND"),vn=W("DELETE_CHARACTER_COMMAND"),vr=W("INSERT_LINE_BREAK_COMMAND"),Hn=W("INSERT_PARAGRAPH_COMMAND"),Kn=W("CONTROLLED_TEXT_INSERTION_COMMAND"),Vr=W("PASTE_COMMAND"),mi=W("REMOVE_TEXT_COMMAND"),zr=W("DELETE_WORD_COMMAND"),Or=W("DELETE_LINE_COMMAND"),Ot=W("FORMAT_TEXT_COMMAND"),Nm=W("SET_TEXT_FORMAT_COMMAND"),cs=W("UNDO_COMMAND"),ds=W("REDO_COMMAND"),fs=W("KEYDOWN_COMMAND"),kl=W("KEY_ARROW_RIGHT_COMMAND"),Ff=W("MOVE_TO_END"),xl=W("KEY_ARROW_LEFT_COMMAND"),zf=W("MOVE_TO_START"),Cl=W("KEY_ARROW_UP_COMMAND"),vl=W("KEY_ARROW_DOWN_COMMAND"),$i=W("KEY_ENTER_COMMAND"),Of=W("KEY_SPACE_COMMAND"),hs=W("KEY_BACKSPACE_COMMAND"),Sl=W("KEY_ESCAPE_COMMAND"),wl=W("KEY_DELETE_COMMAND"),El=W("KEY_TAB_COMMAND"),Dm=W("INSERT_TAB_COMMAND"),$m=W("INDENT_CONTENT_COMMAND"),Wu=W("OUTDENT_CONTENT_COMMAND"),Mf=W("DROP_COMMAND"),jf=W("FORMAT_ELEMENT_COMMAND"),Rf=W("DRAGSTART_COMMAND"),Pf=W("DRAGOVER_COMMAND"),Am=W("DRAGEND_COMMAND"),Io=W("COPY_COMMAND"),gs=W("CUT_COMMAND"),Tl=W("SELECT_ALL_COMMAND"),Fm=W("CLEAR_EDITOR_COMMAND"),zm=W("CLEAR_HISTORY_COMMAND"),ao=W("CAN_REDO_COMMAND"),lo=W("CAN_UNDO_COMMAND"),Lf=W("FOCUS_COMMAND"),Om=W("BLUR_COMMAND"),Mm=W("KEY_MODIFIER_COMMAND");function jm(n){const e=new Map;return{dispose(){for(const t of e.values())t.dispose();e.clear()},register(t,r){let o=e.get(t);o===void 0&&(o={dispose:n(t,r),holders:new Set},e.set(t,o));const i=()=>{const s=e.get(t);s&&s.holders.delete(i)&&s.holders.size===0&&(e.delete(t),s.dispose())};return o.holders.add(i),i}}}function mo(n,e,t,r){return n.addEventListener(e,t,r),n.removeEventListener.bind(n,e,t,r)}const rn=Object.freeze({}),Ea=[["keydown",function(n,e){const t=e._inputState;t.lastKeyDownTimeStamp=n.timeStamp,t.lastKeyCode=n.key,n.key!=="Backspace"&&wo(t),!e.isComposing()&&I(e,fs,n)}],["pointerdown",function(n,e){const t=Vn(n),r=n.pointerType;Lt(t)&&r!=="touch"&&r!=="pen"&&n.button===0&&wt(e,()=>{Ji(t,e)||(e._inputState.isSelectionChangeFromMouseDown=!0)})}],["compositionstart",function(n,e){I(e,$f,n)}],["compositionend",function(n,e){const t=e._inputState;Pt?t.compositionPhase="ending-firefox":En||!jo&&!Ro?I(e,Af,n):(t.compositionPhase="ending-safari",t.compositionEndData=n.data)}],["input",function(n,e){n.stopPropagation();const t=e._inputState;wo(t),wt(e,()=>{Wf(n,e)||e.dispatchCommand(Df,n)},{event:n}),t.unprocessedBeforeInputData=null}],["click",function(n,e){wt(e,()=>{const t=z(),r=Pe(gt(e)),o=yt();if(r){if(N(t)){const i=t.anchor,s=i.getNode();i.type==="element"&&i.offset===0&&t.isCollapsed()&&!Oe(s)&&ge().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&o!==null&&t.is(o)&&(r.removeAllRanges(),t.dirty=!0)}else if(n.pointerType==="touch"||n.pointerType==="pen"){const i=ft(r,e._rootElement).anchorNode;(q(i)||ht(i))&&_e(To(o,r,e,n))}}if(Pt&&r!==null&&r.rangeCount===0){const i=e._rootElement;if(i!==null&&n.target===i){const s=n.clientY;let a=i.childNodes.length;for(let u=0;u<i.childNodes.length;u++){const c=i.childNodes[u];if(q(c)){const d=c.getBoundingClientRect();if(s<=(d.top+d.bottom)/2){a=u;break}}}r.setBaseAndExtent(i,a,i,a);const l=To(o,r,e,n);l!==null?_e(l):r.removeAllRanges()}}I(e,us,n)})}],["cut",rn],["copy",rn],["dragstart",rn],["dragover",rn],["dragend",rn],["paste",rn],["focus",rn],["blur",rn],["drop",rn]];Fr&&Ea.push(["beforeinput",(n,e)=>(function(t,r){const o=t.inputType;o==="deleteCompositionText"||Pt&&$h(r)||o!=="insertCompositionText"&&wt(r,()=>{Wf(t,r)||I(r,Nf,t)},{event:t})})(n,e)]);const Ta=new WeakMap,Ai=new WeakMap,Rm=jm(n=>(n.addEventListener("selectionchange",Vu),()=>n.removeEventListener("selectionchange",Vu)));function If(n,e,t,r,o,i){const s=n.anchor,a=n.focus,l=s.getNode(),u=he();let c;if(i!==void 0)c=i;else{const m=Pe(gt(u));c=m!==null?ft(m,u._rootElement):null}const d=c!==null?c.anchorNode:null,f=s.key,h=u.getElementByKey(f),g=t.length;return f!==a.key||!D(l)||(!o&&(!Fr||u._inputState.lastBeforeInputInsertTextTimeStamp<r+50)||l.isDirty()&&g<2||Th(t))&&s.offset!==a.offset&&!l.isComposing()||Et(l)||l.isDirty()&&g>1||(o||!Fr)&&h!==null&&!l.isComposing()&&d!==wn(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=Ki(p);return y===0?!p.canInsertTextBefore()||!_.canInsertTextBefore()&&!p.isComposing()||b||(function(k){const S=k.getPreviousSibling();return(D(S)||C(S)&&S.isInline())&&!S.canInsertTextAfter()})(p):y===p.getTextContentSize()&&(!p.canInsertTextAfter()||!_.canInsertTextAfter()&&!p.isComposing()||b)})(n,l)}function qu(n,e){return ht(n)&&n.nodeValue!==null&&e!==0&&e!==n.nodeValue.length}function Uu(n,e,t){const{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}=ft(n,e._rootElement),a=e._inputState;a.isSelectionChangeFromDOMUpdate&&(a.isSelectionChangeFromDOMUpdate=!1,qu(r,o)&&qu(i,s)&&!a.postDeleteSelectionToRestore)||wt(e,()=>{if(!t)return void _e(null);if(!Wo(e,r,i))return;let l=z();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(),_e(l))}if(a.postDeleteSelectionToRestore=null,N(l)){const u=l.anchor,c=u.getNode();if(l.isCollapsed()){n.type==="Range"&&r===i&&(l.dirty=!0);const d=gt(e).event,f=d?d.timeStamp:performance.now(),{format:h,style:g,offset:m,key:p,timeStamp:y}=a.collapsedSelectionFormat,_=ge(),b=e.isComposing()===!1&&_.getTextContent()==="";if(f<y+200&&u.offset===m&&u.key===p)yi(l,h,g);else if(u.type==="text")D(c)||$(141),Bf(l,c);else if(u.type==="element"&&!b){C(c)||$(259);const k=u.getNode();k.isEmpty()?(function(S,x){const w=x.getTextFormat(),v=x.getTextStyle();yi(S,w,v)})(l,k):yi(l,l.format,"")}}else{const d=u.key,f=l.focus.key,h=l.getNodes(),g=h.length,m=l.isBackward(),p=m?s:o,y=m?o:s,_=m?f:d,b=m?d:f;let k=2047,S=!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)&&(S=!0,k&=w.getFormat(),k===0))break}l.format=S?k:0}}I(e,qt)})}function yi(n,e,t){n.format===e&&n.style===t||(n.format=e,n.style=t,n.dirty=!0)}function Bf(n,e){yi(n,e.getFormat(),e.getStyle())}function Kf(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function Hu(n){const{lastKeyCode:e}=he()._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=z();if(!N(r)||!r.isCollapsed())return;const o=r.anchor.getNode();if(!D(o))return;const{offset:i}=r.anchor;if(o.getTextContentSize()===i){const s=o.getNextSibling();if(t===`
@@ -1 +1 @@
1
- import{db as r,dc as o,dd as a}from"./index-DPwE6tbL.js";import{o as n}from"./rich-text-spellcheck-provider-J8m9wz6A.js";const c=t=>({post:e=>t.postMessage(e),listen:e=>t.addEventListener("message",s=>e(s.data)),fail:e=>t.addEventListener("error",s=>e(s.message)),terminate:()=>t.terminate()}),i=async t=>{const e=r(t);if(!e)return null;const s=new Worker(new URL("/assets/rich-text-spellcheck-worker-pWkhC-WR.js",import.meta.url),{type:"module"});return n(e,o(),c(s),a(e))};export{i as openSpellcheckWorker};
1
+ import{db as r,dc as o,dd as a}from"./index-t5wgPl_5.js";import{o as n}from"./rich-text-spellcheck-provider-J8m9wz6A.js";const c=t=>({post:e=>t.postMessage(e),listen:e=>t.addEventListener("message",s=>e(s.data)),fail:e=>t.addEventListener("error",s=>e(s.message)),terminate:()=>t.terminate()}),i=async t=>{const e=r(t);if(!e)return null;const s=new Worker(new URL("/assets/rich-text-spellcheck-worker-pWkhC-WR.js",import.meta.url),{type:"module"});return n(e,o(),c(s),a(e))};export{i as openSpellcheckWorker};
@@ -1 +1 @@
1
- import{c as t}from"./index-DPwE6tbL.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
+ import{c as t}from"./index-t5wgPl_5.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,af as x}from"./index-DPwE6tbL.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
+ import{r as e,j as l,B as b,b as y,af as x}from"./index-t5wgPl_5.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{f as t}from"./useMessageBodyContent-1bSbTn98.js";const n="search-scope";function r(o){const i=o.trim().replace(/\s+/g," ").toLowerCase();return/\s/.test(i)?`in:"${i}"`:`in:${i}`}function l(o){const i=t(o);return i!==void 0&&i.list!=="brief"}function s(o){const i=t(o);return i?.list==="mailbox"?i.mailboxId:void 0}function a(o){const i=s(o.matches);return i||(l(o.matches)?o.callerMailboxId:o.callerMailboxId??o.inTokenMailboxId)}function u(o,i){const e=t(o);return e?.list==="flagged"?{kind:"scoped",chip:{id:n,label:"is:starred"}}:e?.list==="outbox"?{kind:"scoped",chip:{id:n,label:"in:outbox"}}:e?.list==="mailbox"?i?{kind:"scoped",chip:{id:n,label:r(i)}}:{kind:"pending"}:{kind:"global"}}function d(o,i,e){return i.kind==="global"?{kind:"global"}:t(o)?.list==="flagged"?{kind:"collection"}:{kind:"folder",...e?{role:e}:{}}}export{n as S,u as a,d as b,l as i,s as r,a as s};
1
+ import{f as t}from"./useMessageBodyContent-CGB2cPdQ.js";const n="search-scope";function r(o){const i=o.trim().replace(/\s+/g," ").toLowerCase();return/\s/.test(i)?`in:"${i}"`:`in:${i}`}function l(o){const i=t(o);return i!==void 0&&i.list!=="brief"}function s(o){const i=t(o);return i?.list==="mailbox"?i.mailboxId:void 0}function a(o){const i=s(o.matches);return i||(l(o.matches)?o.callerMailboxId:o.callerMailboxId??o.inTokenMailboxId)}function u(o,i){const e=t(o);return e?.list==="flagged"?{kind:"scoped",chip:{id:n,label:"is:starred"}}:e?.list==="outbox"?{kind:"scoped",chip:{id:n,label:"in:outbox"}}:e?.list==="mailbox"?i?{kind:"scoped",chip:{id:n,label:r(i)}}:{kind:"pending"}:{kind:"global"}}function d(o,i,e){return i.kind==="global"?{kind:"global"}:t(o)?.list==="flagged"?{kind:"collection"}:{kind:"folder",...e?{role:e}:{}}}export{n as S,u as a,d as b,l as i,s as r,a as s};
@@ -1 +1 @@
1
- import{c as Q,r as l,j as g,g as V,b as v,by as W,X as J,bz as X,bA as N,bB as Y,bC as Z,bD as q,n as ee,bE as te,bF as ne,bG as se,bH as re,bI as oe,bJ as ie,bK as K,bL as ae,bM as ce,w as C,p as le,q as B,v as ue,x as fe,m as de,l as he,bN as A}from"./index-DPwE6tbL.js";import{a as pe,d as me}from"./useMessageBodyContent-1bSbTn98.js";import{a as ge,S as ye}from"./search-scope-DeXyVwvq.js";import{a as j,D as be}from"./useMediaQuery-Doxj330l.js";const _e=Q("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 $e=Q("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"}]]),xe=[{action:"focusNext",keys:["j","k"],label:"navigate"},{action:"muteSender",keys:["m"],label:"mute"},{action:"help",keys:["?"],label:"all shortcuts"}];function Ue(e){return xe.filter(t=>e[t.action]!==void 0)}const we=[{title:"Navigation",hints:[{action:"focusNext",keys:["j"],description:"Focus the message below"},{action:"focusPrevious",keys:["k"],description:"Focus the message above"},{action:"focusNext",keys:["↓"],description:"Focus the message below"},{action:"focusPrevious",keys:["↑"],description:"Focus the message above"},{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 ke(e){for(const t of we){const n=t.hints.find(s=>s.action===e);if(n)return n.keys}}function Ce(e){const t=ke(e);return!t||t.length===0?"":t.length===1?t[0]??"":t[0]==="g"?t.join(" then "):t.join("")}function ze(e){const t=Ce(e);return t===""?"":`(${t})`}const E={action:null,nextPrefix:null,preventDefault:!1},ve={b:"goBrief",i:"goInbox",s:"goSent",f:"goFlagged",",":"goSettings"},Se={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 Ee(e,t){const n=e.key.toLowerCase(),s=e.metaKey||e.ctrlKey;if(e.inEditable)return{...E,nextPrefix:t==="g"?null:t};if(e.onControl&&(n==="enter"||n===" "))return{...E,nextPrefix:t==="g"?null:t};if(s&&n==="n")return{action:"compose",nextPrefix:null,preventDefault:!0};if(s&&n==="a")return{action:"selectAll",nextPrefix:null,preventDefault:!0};if(s)return{...E,nextPrefix:t==="g"?null:t};if(n==="escape")return{action:"back",nextPrefix:null,preventDefault:!1};if(t==="g"){const i=ve[n===","?",":n]??null;return{action:i,nextPrefix:null,preventDefault:i!==null}}if(n==="g"&&!e.shiftKey)return{action:null,nextPrefix:"g",preventDefault:!0};if(e.shiftKey){const r=n==="j"||n==="arrowdown";if(r||(n==="k"||n==="arrowup"))return{action:r?"extendSelectDown":"extendSelectUp",nextPrefix:null,preventDefault:!0}}const o=Se[n];if(o){const r=o.requireShift===!0,i=n.length===1&&!/[a-z0-9]/.test(n);return!r&&e.shiftKey&&!i?E:{action:o.action,nextPrefix:null,preventDefault:!0}}return E}function Ie(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable}const Re="data-message-row",Te='button, a[href], summary, [role="button"], [role="menuitem"], [role="tab"], [role="switch"], [role="checkbox"]';function Oe(e){if(!(e instanceof HTMLElement))return!1;const t=e.closest(Te);return t?!t.hasAttribute(Re):!1}function Pe({key:e,shiftKey:t=!1,repeat:n=!1,caretAtStart:s,hasValue:o,chipCount:r}){const i=r-1;return e==="Escape"?o?{type:"clearQuery"}:{type:"blur"}:e==="Tab"&&t?r===0?{type:"none"}:{type:"focusChip",index:i}:e==="Backspace"||e==="ArrowLeft"?!s||r===0?{type:"none"}:n?{type:"none"}:{type:"focusChip",index:i}:{type:"none"}}function Me({key:e,repeat:t=!1,index:n,chipCount:s}){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>=s-1?{type:"focusInput"}:{type:"focusChip",index:n+1}:e==="Enter"||e===" "?{type:"activateChip",index:n}:e==="Escape"?{type:"focusInput"}:{type:"none"}}function De(e,t){const n=t-1;return n<=0?null:e<n?e:n-1}const Ne=e=>e instanceof HTMLElement?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable:!1,Le=({chips:e=[],onRemoveChip:t,value:n,onChange:s,onClear:o,onClearQuery:r,placeholder:i="Search mail...",globalFocusKey:c=!0,showClearButton:f=!0,size:m="sm",inputId:u,suggest:h,className:x})=>{const I=l.useId(),S=u??I,p=l.useRef(null),y=l.useRef([]),b=r??o,[R,T]=l.useState(null),P=l.useRef(void 0),[_,$]=l.useState(""),M=e.length>0;l.useEffect(()=>{T(a=>a!==null&&a>=e.length?null:a)},[e.length]),l.useEffect(()=>{const a=P.current;if(a!==void 0){if(P.current=void 0,a===null){p.current?.focus();return}y.current[a]?.focus()}});const L=l.useRef(void 0);l.useEffect(()=>{const a=h?.caret;if(!a||a===L.current)return;L.current=a;const d=p.current;!d||d.ownerDocument.activeElement!==d||(d.setSelectionRange(a.cursor,a.cursor),h?.onCaretChange(a.cursor))});const O=a=>{h?.onCaretChange(a.selectionStart??a.value.length)},w=l.useCallback(a=>{T(a),P.current=a},[]),D=l.useCallback(a=>{const d=e[a];d&&t&&(w(De(a,e.length)),$(`${d.label} removed`),t(d.id))},[e,t,w]),U=l.useCallback(()=>{w(null),o()},[o,w]),z=l.useCallback(a=>{const d=a.currentTarget;if(h?.onKeyDown(a))return;const k=Pe({key:a.key,shiftKey:a.shiftKey,repeat:a.repeat,caretAtStart:d.selectionStart===0&&d.selectionEnd===0,hasValue:n.length>0,chipCount:e.length});switch(k.type){case"focusChip":a.preventDefault(),w(k.index);return;case"clearQuery":b();return;case"blur":d.blur();return;case"none":return}},[e.length,n,b,w,h]),G=l.useCallback(a=>d=>{const k=Me({key:d.key,repeat:d.repeat,index:a,chipCount:e.length});switch(k.type!=="none"&&d.preventDefault(),k.type){case"removeChip":D(k.index);return;case"focusChip":w(k.index);return;case"focusInput":w(null);return;case"activateChip":return;case"none":return}},[e,D,w]);return l.useEffect(()=>{if(!c)return;const a=d=>{d.key!=="/"||d.metaKey||d.ctrlKey||d.altKey||Ne(d.target)||(d.preventDefault(),p.current?.focus())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[c]),g.jsxs("label",{htmlFor:S,className:v("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",m==="lg"?"rounded-xl px-4 py-2":"rounded-md px-2.5 py-1",x),children:[g.jsx(V,{className:v("shrink-0 text-fg-muted pointer-events-none",m==="lg"?"size-5":"size-4")}),g.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:[M&&g.jsx("div",{role:"grid","aria-label":"Search filters",className:"flex min-w-0 flex-wrap items-center gap-1",children:e.map((a,d)=>g.jsx(W,{ref:k=>{y.current[d]=k},label:a.label,tone:a.tone,focused:R===d,onFocusLabel:()=>T(d),onKeyDown:G(d),onRemove:()=>D(d)},a.id))}),g.jsx("input",{ref:p,id:S,name:"q",type:"text","aria-label":"Search mail",autoComplete:"off",value:n,tabIndex:R===null?0:-1,onChange:a=>{s(a.target.value),O(a.target)},onKeyDown:z,onKeyUp:a=>O(a.currentTarget),onClick:a=>O(a.currentTarget),onFocus:a=>{T(null),h?.onFocusChange?.(!0),O(a.currentTarget)},onBlur:()=>h?.onFocusChange?.(!1),...h?.comboboxProps,placeholder:M?void 0:i,className:"min-w-24 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-muted"})]}),(n||M)&&f&&g.jsx("button",{type:"button",onClick:U,className:"shrink-0 rounded p-0.5 hover:bg-surface-raised transition-colors","aria-label":"Clear search",children:g.jsx(J,{className:v("text-fg-muted",m==="lg"?"size-5":"size-4")})}),g.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:_})]})},Ge=({value:e,onChange:t,onClear:n,onClearQuery:s,chips:o,onRemoveChip:r,placeholder:i="Search mail...",globalFocusKey:c=!0,showClearButton:f=!0,size:m,inputId:u,suggest:h,className:x})=>g.jsx(Le,{value:e,onChange:t,onClear:n,onClearQuery:s,chips:o,onRemoveChip:r,placeholder:i,globalFocusKey:c,showClearButton:f,size:m,inputId:u,suggest:h,className:x});function Ve({handlers:e,enabled:t=!0,target:n,sequenceTimeoutMs:s=1e3}){const o=l.useRef(e);o.current=e;const r=l.useRef(null),i=l.useRef(null);l.useEffect(()=>{if(!t)return;const c=()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)},f=u=>{const h=Ee({key:u.key,shiftKey:u.shiftKey,metaKey:u.metaKey,ctrlKey:u.ctrlKey,altKey:u.altKey,inEditable:Ie(u.target),onControl:Oe(u.target)},r.current);if(c(),r.current=h.nextPrefix,h.nextPrefix!==null&&(i.current=setTimeout(()=>{r.current=null,i.current=null},s)),h.action===null)return;const x=o.current[h.action];x&&(h.preventDefault&&u.preventDefault(),x())},m=n===void 0?window:n;if(m!==null)return m.addEventListener("keydown",f),()=>{m.removeEventListener("keydown",f),c(),r.current=null}},[t,s,n])}function F(e,t){const n=new Set(t);return e.filter(s=>!n.has(s))}function Ke(e,t,n){const s=e.slice(0);return s[t]=n,s}var Ae=class extends X{#r;#e;#o;#s;#t;#n;#i;#a;#c;#l=[];constructor(e,t,n){super(),this.#r=e,this.#s=n,this.#o=[],this.#t=[],this.#e=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(e=>{e.subscribe(t=>{this.#h(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(e=>{e.destroy()})}setQueries(e,t){this.#o=e,this.#s=t,N.batch(()=>{const n=this.#t,s=this.#d(this.#o);s.forEach(u=>u.observer.setOptions(u.defaultedQueryOptions));const o=s.map(u=>u.observer),r=o.map(u=>u.getCurrentResult()),i=n.length!==o.length,c=o.some((u,h)=>u!==n[h]),f=i||c,m=f?!0:r.some((u,h)=>{const x=this.#e[h];return!x||!Y(u,x)});!f&&!m||(f&&(this.#l=s,this.#t=o),this.#e=r,this.hasListeners()&&(f&&(F(n,o).forEach(u=>{u.destroy()}),F(o,n).forEach(u=>{u.subscribe(h=>{this.#h(u,h)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,t){const n=this.#d(e),s=n.map(r=>r.observer.getOptimisticResult(r.defaultedQueryOptions)),o=n.map(r=>r.defaultedQueryOptions.queryHash);return[s,r=>this.#f(r??s,t,o),()=>this.#u(s,n)]}#u(e,t){return t.map((n,s)=>{const o=e[s];return n.defaultedQueryOptions.notifyOnChangeProps?o:n.observer.trackResult(o,r=>{t.forEach(i=>{i.observer.trackProp(r)})})})}#f(e,t,n){if(t){const s=this.#c,o=n!==void 0&&s!==void 0&&(s.length!==n.length||n.some((r,i)=>r!==s[i]));return(!this.#n||this.#e!==this.#a||o||t!==this.#i)&&(this.#i=t,this.#a=this.#e,n!==void 0&&(this.#c=n),this.#n=Z(this.#n,t(e))),this.#n}return e}#m(){return this.#s?.combine!==void 0&&this.#t.some((e,t)=>e.options.suspense&&this.#e[t]?.data===void 0)}#d(e){const t=new Map;this.#t.forEach(s=>{const o=s.options.queryHash;if(!o)return;const r=t.get(o);r?r.push(s):t.set(o,[s])});const n=[];return e.forEach(s=>{const o=this.#r.defaultQueryOptions(s),i=t.get(o.queryHash)?.shift()??new q(this.#r,o);n.push({defaultedQueryOptions:o,observer:i})}),n}#h(e,t){const n=this.#t.indexOf(e);n!==-1&&(this.#e=Ke(this.#e,n,t),this.#p())}#p(){if(this.hasListeners()){const e=this.#u(this.#e,this.#l),t=this.#m(),n=this.#n,s=t?n:this.#f(e,this.#s?.combine);(t||n!==s)&&N.batch(()=>{this.listeners.forEach(o=>{o(this.#e)})})}}};function H({queries:e,...t},n){const s=ee(),o=te(),r=ne(),i=l.useMemo(()=>e.map(p=>{const y=s.defaultQueryOptions(p);return y._optimisticResults=o?"isRestoring":"optimistic",y}),[e,s,o]);i.forEach(p=>{se(p);const y=s.getQueryCache().get(p.queryHash);re(p,r,y)}),oe(r);const[c]=l.useState(()=>new Ae(s,i,t)),[f,m,u]=c.getOptimisticResult(i,t.combine),h=!o&&t.subscribed!==!1;l.useSyncExternalStore(l.useCallback(p=>h?c.subscribe(N.batchCalls(p)):ie,[c,h]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),l.useEffect(()=>{c.setQueries(i,t)},[i,t,c]);const I=f.some((p,y)=>K(i[y],p))?f.flatMap((p,y)=>{const b=i[y];if(b&&K(b,p)){const R=new q(s,b);return ae(b,R,r)}return[]}):[];if(I.length>0)throw Promise.all(I);const S=f.find((p,y)=>{const b=i[y];return b&&ce({result:p,errorResetBoundary:r,throwOnError:b.throwOnError,query:s.getQueryCache().get(b.queryHash),suspense:b.suspense})});if(S?.error)throw S.error;return m(u())}function We(){const e=C({from:"/mail/brief/$threadId",shouldThrow:!1}),t=C({from:"/mail/brief/$threadId/$messageId",shouldThrow:!1}),n=C({from:"/mail/flagged/$threadId",shouldThrow:!1}),s=C({from:"/mail/flagged/$threadId/$messageId",shouldThrow:!1}),o=C({from:"/mail/$mailboxId/$threadId",shouldThrow:!1}),r=C({from:"/mail/$mailboxId/$threadId/$messageId",shouldThrow:!1}),i=e?.threadId??n?.threadId??o?.threadId,c=t?.messageId??s?.messageId??r?.messageId;return l.useMemo(()=>i?{threadId:i,messageId:c}:void 0,[i,c])}const Je=({trigger:e,children:t,align:n="right"})=>{const[s,o]=l.useState(!1),r=l.useRef(null),i=l.useCallback(f=>{r.current&&!r.current.contains(f.target)&&o(!1)},[]),c=l.useCallback(f=>{f.key==="Escape"&&o(!1)},[]);return l.useEffect(()=>(s&&(document.addEventListener("mousedown",i),document.addEventListener("keydown",c)),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("keydown",c)}),[s,i,c]),g.jsxs("div",{ref:r,className:"relative",children:[g.jsx("button",{type:"button",onClick:f=>{f.stopPropagation(),o(!s)},className:v("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}),s&&g.jsx("div",{className:v("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})]})},Xe=({onClick:e,disabled:t,destructive:n,children:s})=>g.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t||e()},disabled:t,className:v("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:s}),Ye=()=>g.jsx("div",{className:"my-1 h-px bg-line"}),je=({accounts:e})=>{const t=C({strict:!1}),n=pe(),s=t.mailboxId,{t:o}=le("mail",{useSuspense:!1}),r=l.useCallback((c,f)=>o(c,{defaultValue:f}),[o]),i=H({queries:e.map(c=>({...B({path:{accountId:c.accountId}}),staleTime:1/0}))});if(n.pathname.startsWith("/mail/outbox"))return"Outbox";if(!s)return null;for(let c=0;c<e.length;c++){const f=i[c]?.data?.items;if(!f)continue;const m=f.find(h=>h.mailboxId===s);if(!m)continue;const u=ue(e[c].folderAppointments);return fe(m,u.get(s),r)}return null},Ze=({accounts:e})=>{const n=C({strict:!1}).mailboxId,s=H({queries:e.map(o=>({...B({path:{accountId:o.accountId}}),staleTime:1/0}))});if(!n)return null;for(const o of s){const r=o.data?.items;if(!r)continue;const i=r.find(c=>c.mailboxId===n);if(i)return i.unseenCount}return null};function et(e){const t=de(),{searchInput:n}=he(),s=je({accounts:e}),o=me({select:c=>c.matches}),r=ge(o,s),i=l.useCallback(c=>{c===ye&&t({to:"/mail/brief",search:{q:n||void 0}})},[t,n]);return{scope:r,clearScope:i}}const Fe=768,tt=e=>e!=="desktop",nt=()=>{const e=j(`(min-width: ${Fe}px)`);return j(be)?"desktop":e?"tablet":"phone"};function st(e){const t=new Map;for(const n of e){const s=n.email.toLowerCase(),o=s.split("@")[0];o&&!t.has(o)&&t.set(o,n.accountId),t.has(s)||t.set(s,n.accountId)}return t}function rt(e){const t=new Map;for(const n of e)for(const s of n){const o=s.fullPath?.toLowerCase();if(!o)continue;const r=o.split("/").pop();t.has(o)||t.set(o,s.mailboxId),r&&!t.has(r)&&t.set(r,s.mailboxId)}return t}function ot(e,t=[]){const n=e.flat().filter(r=>r.fullPath),s=new Map;for(const r of n){const i=A(r.fullPath).toLowerCase();s.set(i,(s.get(i)??0)+1)}const o=new Map(t.map(r=>[r.accountId,r.email]));return n.map(r=>{const i=A(r.fullPath),c=s.get(i.toLowerCase())===1,f=t.length>1?o.get(r.accountId):void 0;return{value:c?i:r.fullPath,label:r.displayNameOverride?.trim()||i,...f?{hint:f}:{}}})}function it(e){const t=new Map;for(const n of e){const s=n.email.toLowerCase().split("@")[0]??"";t.set(s,(t.get(s)??0)+1)}return e.map(n=>{const s=n.email.split("@")[0]??n.email,o=t.get(s.toLowerCase())===1,r=n.displayName?.trim();return{value:o?s:n.email,label:r||n.email,...r?{hint:n.email}:{}}})}export{_e as B,Je as D,we as K,$e as R,Ge as S,Ye as a,Xe as b,H as c,rt as d,nt as e,We as f,Ve as g,st as h,tt as i,je as j,Ze as k,xe as l,Re as m,ot as n,it as o,Ue as p,Ce as s,ze as t,et as u};
1
+ import{c as Q,r as l,j as g,g as V,b as v,by as W,X as J,bz as X,bA as N,bB as Y,bC as Z,bD as q,n as ee,bE as te,bF as ne,bG as se,bH as re,bI as oe,bJ as ie,bK as K,bL as ae,bM as ce,w as C,p as le,q as B,v as ue,x as fe,m as de,l as he,bN as A}from"./index-t5wgPl_5.js";import{a as pe,d as me}from"./useMessageBodyContent-CGB2cPdQ.js";import{a as ge,S as ye}from"./search-scope-Uq2fKL8U.js";import{a as j,D as be}from"./useMediaQuery-CJs3FAmb.js";const _e=Q("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 $e=Q("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"}]]),xe=[{action:"focusNext",keys:["j","k"],label:"navigate"},{action:"muteSender",keys:["m"],label:"mute"},{action:"help",keys:["?"],label:"all shortcuts"}];function Ue(e){return xe.filter(t=>e[t.action]!==void 0)}const we=[{title:"Navigation",hints:[{action:"focusNext",keys:["j"],description:"Focus the message below"},{action:"focusPrevious",keys:["k"],description:"Focus the message above"},{action:"focusNext",keys:["↓"],description:"Focus the message below"},{action:"focusPrevious",keys:["↑"],description:"Focus the message above"},{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 ke(e){for(const t of we){const n=t.hints.find(s=>s.action===e);if(n)return n.keys}}function Ce(e){const t=ke(e);return!t||t.length===0?"":t.length===1?t[0]??"":t[0]==="g"?t.join(" then "):t.join("")}function ze(e){const t=Ce(e);return t===""?"":`(${t})`}const E={action:null,nextPrefix:null,preventDefault:!1},ve={b:"goBrief",i:"goInbox",s:"goSent",f:"goFlagged",",":"goSettings"},Se={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 Ee(e,t){const n=e.key.toLowerCase(),s=e.metaKey||e.ctrlKey;if(e.inEditable)return{...E,nextPrefix:t==="g"?null:t};if(e.onControl&&(n==="enter"||n===" "))return{...E,nextPrefix:t==="g"?null:t};if(s&&n==="n")return{action:"compose",nextPrefix:null,preventDefault:!0};if(s&&n==="a")return{action:"selectAll",nextPrefix:null,preventDefault:!0};if(s)return{...E,nextPrefix:t==="g"?null:t};if(n==="escape")return{action:"back",nextPrefix:null,preventDefault:!1};if(t==="g"){const i=ve[n===","?",":n]??null;return{action:i,nextPrefix:null,preventDefault:i!==null}}if(n==="g"&&!e.shiftKey)return{action:null,nextPrefix:"g",preventDefault:!0};if(e.shiftKey){const r=n==="j"||n==="arrowdown";if(r||(n==="k"||n==="arrowup"))return{action:r?"extendSelectDown":"extendSelectUp",nextPrefix:null,preventDefault:!0}}const o=Se[n];if(o){const r=o.requireShift===!0,i=n.length===1&&!/[a-z0-9]/.test(n);return!r&&e.shiftKey&&!i?E:{action:o.action,nextPrefix:null,preventDefault:!0}}return E}function Ie(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable}const Re="data-message-row",Te='button, a[href], summary, [role="button"], [role="menuitem"], [role="tab"], [role="switch"], [role="checkbox"]';function Oe(e){if(!(e instanceof HTMLElement))return!1;const t=e.closest(Te);return t?!t.hasAttribute(Re):!1}function Pe({key:e,shiftKey:t=!1,repeat:n=!1,caretAtStart:s,hasValue:o,chipCount:r}){const i=r-1;return e==="Escape"?o?{type:"clearQuery"}:{type:"blur"}:e==="Tab"&&t?r===0?{type:"none"}:{type:"focusChip",index:i}:e==="Backspace"||e==="ArrowLeft"?!s||r===0?{type:"none"}:n?{type:"none"}:{type:"focusChip",index:i}:{type:"none"}}function Me({key:e,repeat:t=!1,index:n,chipCount:s}){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>=s-1?{type:"focusInput"}:{type:"focusChip",index:n+1}:e==="Enter"||e===" "?{type:"activateChip",index:n}:e==="Escape"?{type:"focusInput"}:{type:"none"}}function De(e,t){const n=t-1;return n<=0?null:e<n?e:n-1}const Ne=e=>e instanceof HTMLElement?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable:!1,Le=({chips:e=[],onRemoveChip:t,value:n,onChange:s,onClear:o,onClearQuery:r,placeholder:i="Search mail...",globalFocusKey:c=!0,showClearButton:f=!0,size:m="sm",inputId:u,suggest:h,className:x})=>{const I=l.useId(),S=u??I,p=l.useRef(null),y=l.useRef([]),b=r??o,[R,T]=l.useState(null),P=l.useRef(void 0),[_,$]=l.useState(""),M=e.length>0;l.useEffect(()=>{T(a=>a!==null&&a>=e.length?null:a)},[e.length]),l.useEffect(()=>{const a=P.current;if(a!==void 0){if(P.current=void 0,a===null){p.current?.focus();return}y.current[a]?.focus()}});const L=l.useRef(void 0);l.useEffect(()=>{const a=h?.caret;if(!a||a===L.current)return;L.current=a;const d=p.current;!d||d.ownerDocument.activeElement!==d||(d.setSelectionRange(a.cursor,a.cursor),h?.onCaretChange(a.cursor))});const O=a=>{h?.onCaretChange(a.selectionStart??a.value.length)},w=l.useCallback(a=>{T(a),P.current=a},[]),D=l.useCallback(a=>{const d=e[a];d&&t&&(w(De(a,e.length)),$(`${d.label} removed`),t(d.id))},[e,t,w]),U=l.useCallback(()=>{w(null),o()},[o,w]),z=l.useCallback(a=>{const d=a.currentTarget;if(h?.onKeyDown(a))return;const k=Pe({key:a.key,shiftKey:a.shiftKey,repeat:a.repeat,caretAtStart:d.selectionStart===0&&d.selectionEnd===0,hasValue:n.length>0,chipCount:e.length});switch(k.type){case"focusChip":a.preventDefault(),w(k.index);return;case"clearQuery":b();return;case"blur":d.blur();return;case"none":return}},[e.length,n,b,w,h]),G=l.useCallback(a=>d=>{const k=Me({key:d.key,repeat:d.repeat,index:a,chipCount:e.length});switch(k.type!=="none"&&d.preventDefault(),k.type){case"removeChip":D(k.index);return;case"focusChip":w(k.index);return;case"focusInput":w(null);return;case"activateChip":return;case"none":return}},[e,D,w]);return l.useEffect(()=>{if(!c)return;const a=d=>{d.key!=="/"||d.metaKey||d.ctrlKey||d.altKey||Ne(d.target)||(d.preventDefault(),p.current?.focus())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[c]),g.jsxs("label",{htmlFor:S,className:v("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",m==="lg"?"rounded-xl px-4 py-2":"rounded-md px-2.5 py-1",x),children:[g.jsx(V,{className:v("shrink-0 text-fg-muted pointer-events-none",m==="lg"?"size-5":"size-4")}),g.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:[M&&g.jsx("div",{role:"grid","aria-label":"Search filters",className:"flex min-w-0 flex-wrap items-center gap-1",children:e.map((a,d)=>g.jsx(W,{ref:k=>{y.current[d]=k},label:a.label,tone:a.tone,focused:R===d,onFocusLabel:()=>T(d),onKeyDown:G(d),onRemove:()=>D(d)},a.id))}),g.jsx("input",{ref:p,id:S,name:"q",type:"text","aria-label":"Search mail",autoComplete:"off",value:n,tabIndex:R===null?0:-1,onChange:a=>{s(a.target.value),O(a.target)},onKeyDown:z,onKeyUp:a=>O(a.currentTarget),onClick:a=>O(a.currentTarget),onFocus:a=>{T(null),h?.onFocusChange?.(!0),O(a.currentTarget)},onBlur:()=>h?.onFocusChange?.(!1),...h?.comboboxProps,placeholder:M?void 0:i,className:"min-w-24 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-muted"})]}),(n||M)&&f&&g.jsx("button",{type:"button",onClick:U,className:"shrink-0 rounded p-0.5 hover:bg-surface-raised transition-colors","aria-label":"Clear search",children:g.jsx(J,{className:v("text-fg-muted",m==="lg"?"size-5":"size-4")})}),g.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:_})]})},Ge=({value:e,onChange:t,onClear:n,onClearQuery:s,chips:o,onRemoveChip:r,placeholder:i="Search mail...",globalFocusKey:c=!0,showClearButton:f=!0,size:m,inputId:u,suggest:h,className:x})=>g.jsx(Le,{value:e,onChange:t,onClear:n,onClearQuery:s,chips:o,onRemoveChip:r,placeholder:i,globalFocusKey:c,showClearButton:f,size:m,inputId:u,suggest:h,className:x});function Ve({handlers:e,enabled:t=!0,target:n,sequenceTimeoutMs:s=1e3}){const o=l.useRef(e);o.current=e;const r=l.useRef(null),i=l.useRef(null);l.useEffect(()=>{if(!t)return;const c=()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)},f=u=>{const h=Ee({key:u.key,shiftKey:u.shiftKey,metaKey:u.metaKey,ctrlKey:u.ctrlKey,altKey:u.altKey,inEditable:Ie(u.target),onControl:Oe(u.target)},r.current);if(c(),r.current=h.nextPrefix,h.nextPrefix!==null&&(i.current=setTimeout(()=>{r.current=null,i.current=null},s)),h.action===null)return;const x=o.current[h.action];x&&(h.preventDefault&&u.preventDefault(),x())},m=n===void 0?window:n;if(m!==null)return m.addEventListener("keydown",f),()=>{m.removeEventListener("keydown",f),c(),r.current=null}},[t,s,n])}function F(e,t){const n=new Set(t);return e.filter(s=>!n.has(s))}function Ke(e,t,n){const s=e.slice(0);return s[t]=n,s}var Ae=class extends X{#r;#e;#o;#s;#t;#n;#i;#a;#c;#l=[];constructor(e,t,n){super(),this.#r=e,this.#s=n,this.#o=[],this.#t=[],this.#e=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(e=>{e.subscribe(t=>{this.#h(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(e=>{e.destroy()})}setQueries(e,t){this.#o=e,this.#s=t,N.batch(()=>{const n=this.#t,s=this.#d(this.#o);s.forEach(u=>u.observer.setOptions(u.defaultedQueryOptions));const o=s.map(u=>u.observer),r=o.map(u=>u.getCurrentResult()),i=n.length!==o.length,c=o.some((u,h)=>u!==n[h]),f=i||c,m=f?!0:r.some((u,h)=>{const x=this.#e[h];return!x||!Y(u,x)});!f&&!m||(f&&(this.#l=s,this.#t=o),this.#e=r,this.hasListeners()&&(f&&(F(n,o).forEach(u=>{u.destroy()}),F(o,n).forEach(u=>{u.subscribe(h=>{this.#h(u,h)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,t){const n=this.#d(e),s=n.map(r=>r.observer.getOptimisticResult(r.defaultedQueryOptions)),o=n.map(r=>r.defaultedQueryOptions.queryHash);return[s,r=>this.#f(r??s,t,o),()=>this.#u(s,n)]}#u(e,t){return t.map((n,s)=>{const o=e[s];return n.defaultedQueryOptions.notifyOnChangeProps?o:n.observer.trackResult(o,r=>{t.forEach(i=>{i.observer.trackProp(r)})})})}#f(e,t,n){if(t){const s=this.#c,o=n!==void 0&&s!==void 0&&(s.length!==n.length||n.some((r,i)=>r!==s[i]));return(!this.#n||this.#e!==this.#a||o||t!==this.#i)&&(this.#i=t,this.#a=this.#e,n!==void 0&&(this.#c=n),this.#n=Z(this.#n,t(e))),this.#n}return e}#m(){return this.#s?.combine!==void 0&&this.#t.some((e,t)=>e.options.suspense&&this.#e[t]?.data===void 0)}#d(e){const t=new Map;this.#t.forEach(s=>{const o=s.options.queryHash;if(!o)return;const r=t.get(o);r?r.push(s):t.set(o,[s])});const n=[];return e.forEach(s=>{const o=this.#r.defaultQueryOptions(s),i=t.get(o.queryHash)?.shift()??new q(this.#r,o);n.push({defaultedQueryOptions:o,observer:i})}),n}#h(e,t){const n=this.#t.indexOf(e);n!==-1&&(this.#e=Ke(this.#e,n,t),this.#p())}#p(){if(this.hasListeners()){const e=this.#u(this.#e,this.#l),t=this.#m(),n=this.#n,s=t?n:this.#f(e,this.#s?.combine);(t||n!==s)&&N.batch(()=>{this.listeners.forEach(o=>{o(this.#e)})})}}};function H({queries:e,...t},n){const s=ee(),o=te(),r=ne(),i=l.useMemo(()=>e.map(p=>{const y=s.defaultQueryOptions(p);return y._optimisticResults=o?"isRestoring":"optimistic",y}),[e,s,o]);i.forEach(p=>{se(p);const y=s.getQueryCache().get(p.queryHash);re(p,r,y)}),oe(r);const[c]=l.useState(()=>new Ae(s,i,t)),[f,m,u]=c.getOptimisticResult(i,t.combine),h=!o&&t.subscribed!==!1;l.useSyncExternalStore(l.useCallback(p=>h?c.subscribe(N.batchCalls(p)):ie,[c,h]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),l.useEffect(()=>{c.setQueries(i,t)},[i,t,c]);const I=f.some((p,y)=>K(i[y],p))?f.flatMap((p,y)=>{const b=i[y];if(b&&K(b,p)){const R=new q(s,b);return ae(b,R,r)}return[]}):[];if(I.length>0)throw Promise.all(I);const S=f.find((p,y)=>{const b=i[y];return b&&ce({result:p,errorResetBoundary:r,throwOnError:b.throwOnError,query:s.getQueryCache().get(b.queryHash),suspense:b.suspense})});if(S?.error)throw S.error;return m(u())}function We(){const e=C({from:"/mail/brief/$threadId",shouldThrow:!1}),t=C({from:"/mail/brief/$threadId/$messageId",shouldThrow:!1}),n=C({from:"/mail/flagged/$threadId",shouldThrow:!1}),s=C({from:"/mail/flagged/$threadId/$messageId",shouldThrow:!1}),o=C({from:"/mail/$mailboxId/$threadId",shouldThrow:!1}),r=C({from:"/mail/$mailboxId/$threadId/$messageId",shouldThrow:!1}),i=e?.threadId??n?.threadId??o?.threadId,c=t?.messageId??s?.messageId??r?.messageId;return l.useMemo(()=>i?{threadId:i,messageId:c}:void 0,[i,c])}const Je=({trigger:e,children:t,align:n="right"})=>{const[s,o]=l.useState(!1),r=l.useRef(null),i=l.useCallback(f=>{r.current&&!r.current.contains(f.target)&&o(!1)},[]),c=l.useCallback(f=>{f.key==="Escape"&&o(!1)},[]);return l.useEffect(()=>(s&&(document.addEventListener("mousedown",i),document.addEventListener("keydown",c)),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("keydown",c)}),[s,i,c]),g.jsxs("div",{ref:r,className:"relative",children:[g.jsx("button",{type:"button",onClick:f=>{f.stopPropagation(),o(!s)},className:v("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}),s&&g.jsx("div",{className:v("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})]})},Xe=({onClick:e,disabled:t,destructive:n,children:s})=>g.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t||e()},disabled:t,className:v("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:s}),Ye=()=>g.jsx("div",{className:"my-1 h-px bg-line"}),je=({accounts:e})=>{const t=C({strict:!1}),n=pe(),s=t.mailboxId,{t:o}=le("mail",{useSuspense:!1}),r=l.useCallback((c,f)=>o(c,{defaultValue:f}),[o]),i=H({queries:e.map(c=>({...B({path:{accountId:c.accountId}}),staleTime:1/0}))});if(n.pathname.startsWith("/mail/outbox"))return"Outbox";if(!s)return null;for(let c=0;c<e.length;c++){const f=i[c]?.data?.items;if(!f)continue;const m=f.find(h=>h.mailboxId===s);if(!m)continue;const u=ue(e[c].folderAppointments);return fe(m,u.get(s),r)}return null},Ze=({accounts:e})=>{const n=C({strict:!1}).mailboxId,s=H({queries:e.map(o=>({...B({path:{accountId:o.accountId}}),staleTime:1/0}))});if(!n)return null;for(const o of s){const r=o.data?.items;if(!r)continue;const i=r.find(c=>c.mailboxId===n);if(i)return i.unseenCount}return null};function et(e){const t=de(),{searchInput:n}=he(),s=je({accounts:e}),o=me({select:c=>c.matches}),r=ge(o,s),i=l.useCallback(c=>{c===ye&&t({to:"/mail/brief",search:{q:n||void 0}})},[t,n]);return{scope:r,clearScope:i}}const Fe=768,tt=e=>e!=="desktop",nt=()=>{const e=j(`(min-width: ${Fe}px)`);return j(be)?"desktop":e?"tablet":"phone"};function st(e){const t=new Map;for(const n of e){const s=n.email.toLowerCase(),o=s.split("@")[0];o&&!t.has(o)&&t.set(o,n.accountId),t.has(s)||t.set(s,n.accountId)}return t}function rt(e){const t=new Map;for(const n of e)for(const s of n){const o=s.fullPath?.toLowerCase();if(!o)continue;const r=o.split("/").pop();t.has(o)||t.set(o,s.mailboxId),r&&!t.has(r)&&t.set(r,s.mailboxId)}return t}function ot(e,t=[]){const n=e.flat().filter(r=>r.fullPath),s=new Map;for(const r of n){const i=A(r.fullPath).toLowerCase();s.set(i,(s.get(i)??0)+1)}const o=new Map(t.map(r=>[r.accountId,r.email]));return n.map(r=>{const i=A(r.fullPath),c=s.get(i.toLowerCase())===1,f=t.length>1?o.get(r.accountId):void 0;return{value:c?i:r.fullPath,label:r.displayNameOverride?.trim()||i,...f?{hint:f}:{}}})}function it(e){const t=new Map;for(const n of e){const s=n.email.toLowerCase().split("@")[0]??"";t.set(s,(t.get(s)??0)+1)}return e.map(n=>{const s=n.email.split("@")[0]??n.email,o=t.get(s.toLowerCase())===1,r=n.displayName?.trim();return{value:o?s:n.email,label:r||n.email,...r?{hint:n.email}:{}}})}export{_e as B,Je as D,we as K,$e as R,Ge as S,Ye as a,Xe as b,H as c,rt as d,nt as e,We as f,Ve as g,st as h,tt as i,je as j,Ze as k,xe as l,Re as m,ot as n,it as o,Ue as p,Ce as s,ze as t,et as u};
@@ -1 +1 @@
1
- import{r as u,j as s,Z as l,_ as p}from"./index-DPwE6tbL.js";import{F as v}from"./FullCompose-CtXVsUsk.js";import{e as x,h}from"./useMessageBodyContent-1bSbTn98.js";const c=u.createContext(null),S=({chrome:o,children:n})=>s.jsx(c.Provider,{value:o,children:n});function d({phone:o,list:n,reading:r,intelligence:t,hasThread:a=!1}){const e=u.useContext(c),f=x();if(!e)return s.jsx(l,{});const i={nav:e.nav,overlay:e.overlay,skeleton:s.jsx(l,{}),isLoading:e.isLoading,navOpen:e.navOpen,onOpenNav:e.onOpenNav,onCloseNav:e.onCloseNav};return e.isSinglePane?s.jsx(p,{...i,list:f?s.jsx(v,{}):o,intelligenceOpen:e.intelligenceOpen}):s.jsx(p,{...i,topBar:e.topBar,list:n,reading:r,intelligence:t,intelligenceOpen:e.intelligenceOpen,hasThread:a})}function j(o,n,r){if(o!==n)return r}function C(o,n){return o===""?"":n}function M({searchInput:o,committedQuery:n,urlQuery:r,pathname:t,listPath:a}){return!h(t,a)||n!==o?!1:n!==r}export{S as M,d as a,M as b,C as c,j as s};
1
+ import{r as u,j as s,Z as l,_ as p}from"./index-t5wgPl_5.js";import{F as v}from"./FullCompose-DqBLukCj.js";import{e as x,h}from"./useMessageBodyContent-CGB2cPdQ.js";const c=u.createContext(null),S=({chrome:o,children:n})=>s.jsx(c.Provider,{value:o,children:n});function d({phone:o,list:n,reading:r,intelligence:t,hasThread:a=!1}){const e=u.useContext(c),f=x();if(!e)return s.jsx(l,{});const i={nav:e.nav,overlay:e.overlay,skeleton:s.jsx(l,{}),isLoading:e.isLoading,navOpen:e.navOpen,onOpenNav:e.onOpenNav,onCloseNav:e.onCloseNav};return e.isSinglePane?s.jsx(p,{...i,list:f?s.jsx(v,{}):o,intelligenceOpen:e.intelligenceOpen}):s.jsx(p,{...i,topBar:e.topBar,list:n,reading:r,intelligence:t,intelligenceOpen:e.intelligenceOpen,hasThread:a})}function j(o,n,r){if(o!==n)return r}function C(o,n){return o===""?"":n}function M({searchInput:o,committedQuery:n,urlQuery:r,pathname:t,listPath:a}){return!h(t,a)||n!==o?!1:n!==r}export{S as M,d as a,M as b,C as c,j as s};
@@ -1 +1 @@
1
- import{j as e,b as N,m as z,r as c,ar as L,ad as O,g as $,av as q,s as I,b3 as A,n as k,a7 as C,b4 as M,b5 as P,B as S,a as R,b6 as B,X as G}from"./index-DPwE6tbL.js";import{K as m}from"./kbd-RjIgfmMM.js";import{S as Q,a as E}from"./settings-screen-B-0kkf7-.js";import{E as V}from"./ErrorState-BpKY8HhS.js";import{u as K}from"./useDebouncedValue-GLgJ6lfP.js";import{a as _}from"./format-De9HZKjg.js";import"./avatar-Biylg9_n.js";import"./menu-DR6sZz88.js";import"./circle-help-D0MvxrSS.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(R,{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=B({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=q[s];o&&t({to:o})};return e.jsx(Q,{items:L,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(O,{icon:e.jsx($,{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};
1
+ import{j as e,b as N,m as z,r as c,ar as L,ad as O,g as $,av as q,s as I,b3 as A,n as k,a7 as C,b4 as M,b5 as P,B as S,a as R,b6 as B,X as G}from"./index-t5wgPl_5.js";import{K as m}from"./kbd-zFFFLjXS.js";import{S as Q,a as E}from"./settings-screen-DSPGVcfl.js";import{E as V}from"./ErrorState-1eMrB7wr.js";import{u as K}from"./useDebouncedValue-Dp6F7YRV.js";import{a as _}from"./format-De9HZKjg.js";import"./avatar-unHAQpba.js";import"./menu-D0YdtPim.js";import"./circle-help-C5eVb8S6.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(R,{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=B({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=q[s];o&&t({to:o})};return e.jsx(Q,{items:L,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(O,{icon:e.jsx($,{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};