@remit/web-client-dist 0.0.481 → 0.0.483

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 (169) hide show
  1. package/assets/BriefPane-D6mVesqu.js +1 -0
  2. package/assets/CalendarShell-CbesY9P5.js +1 -0
  3. package/assets/EmptyState-DYWkEoYy.js +1 -0
  4. package/assets/{ErrorState-CBV6FtSJ.js → ErrorState-CQA1uNfQ.js} +1 -1
  5. package/assets/FlaggedPane-DoeXJfm_.js +1 -0
  6. package/assets/FullCompose-DdXnvGhK.js +1 -0
  7. package/assets/MailListHeader-Dv4RRNrm.js +7 -0
  8. package/assets/MailNav-v3LcAYtx.js +1 -0
  9. package/assets/MailShell-CqyZkGBA.js +1 -0
  10. package/assets/{MailViewChrome-CNywrIYr.js → MailViewChrome-BrAblQ-h.js} +1 -1
  11. package/assets/MailboxPane-B1OopvI6.js +1 -0
  12. package/assets/{NavMenuButton-meKsCAv8.js → NavMenuButton-DsipgLLk.js} +1 -1
  13. package/assets/OnboardingWizard-LMPbQ6jT.js +1 -0
  14. package/assets/OpenCalendarEvent-jziTx8_b.js +1 -0
  15. package/assets/OutboxPane-C5Ns55rS.js +1 -0
  16. package/assets/_calendarObjectId-BwZvTd4q.js +1 -0
  17. package/assets/_mailboxId-r4aTgexi.js +1 -0
  18. package/assets/_messageId-B1vH4rgJ.js +1 -0
  19. package/assets/_messageId-BtEEXwAi.js +1 -0
  20. package/assets/_messageId-Df_PxEto.js +1 -0
  21. package/assets/_outboxMessageId-CxMGfZJP.js +1 -0
  22. package/assets/_recurrenceId-C2heuIxv.js +1 -0
  23. package/assets/_threadId-BCSAHVdO.js +1 -0
  24. package/assets/_threadId-qoVrigtw.js +1 -0
  25. package/assets/_threadId-vleFQxLm.js +1 -0
  26. package/assets/_view._date-kUsauS8B.js +1 -0
  27. package/assets/accounts-Dzj3yoGR.js +1 -0
  28. package/assets/advanced-DUCDPZSq.js +4 -0
  29. package/assets/appearance-BOPQSuz4.js +1 -0
  30. package/assets/{attachment-file-B4nazean.js → attachment-file-DClGI76U.js} +1 -1
  31. package/assets/{avatar-lcZ4TVQd.js → avatar-wLH6-Ayd.js} +1 -1
  32. package/assets/{bottom-sheet-D-zZ-Ztc.js → bottom-sheet-D6dXigqc.js} +1 -1
  33. package/assets/{brief-Cn1i1Vih.js → brief-BVNqThW-.js} +1 -1
  34. package/assets/brief-DZPDGIPc.js +1 -0
  35. package/assets/{browser-ponyfill-DYQZeblA.js → browser-ponyfill-CH8d2KQ8.js} +2 -2
  36. package/assets/{bug-DQdIiRjm.js → bug-C9mbESSL.js} +1 -1
  37. package/assets/calendar-ZcQGYvWc.js +1 -0
  38. package/assets/calendar-_byPswbZ.js +1 -0
  39. package/assets/calendar-days-GutYioyG.js +1 -0
  40. package/assets/card-D55_7IJj.js +1 -0
  41. package/assets/chevron-left-KNAXuraL.js +1 -0
  42. package/assets/{circle-check-big-CyS5sZb6.js → circle-check-big-B1p6oh-i.js} +1 -1
  43. package/assets/circle-check-o0AqGZ-u.js +1 -0
  44. package/assets/{circle-help-DbSK9hyF.js → circle-help-DtvJPapE.js} +1 -1
  45. package/assets/clock-Z-oAijsz.js +1 -0
  46. package/assets/compose._-_outboxMessageId_-5aWrcne1.js +1 -0
  47. package/assets/compose._-_outboxMessageId_-Bi_nmcO4.js +1 -0
  48. package/assets/compose._-_outboxMessageId_-D3DAlT64.js +1 -0
  49. package/assets/compose._-_outboxMessageId_-PDfNjd_n.js +1 -0
  50. package/assets/config-import-CMt0F7iy.js +1 -0
  51. package/assets/{confirm-dialog-BeWZSgTL.js → confirm-dialog-XKVleo_p.js} +1 -1
  52. package/assets/credential-steps-Bhbo8-zA.js +1 -0
  53. package/assets/download-BzIqNtrq.js +1 -0
  54. package/assets/filters-Cp8CCnd5.js +1 -0
  55. package/assets/{flagged-D4rwWprf.js → flagged-CLgTXep4.js} +1 -1
  56. package/assets/flagged-D-ptU5v2.js +1 -0
  57. package/assets/folders-BiY-9lME.js +1 -0
  58. package/assets/{format-Dquh5i8-.js → format-CCaI2KqP.js} +1 -1
  59. package/assets/{help-copy-DryiNLYs.js → help-copy-DawC2xSA.js} +1 -1
  60. package/assets/import-CJAbCD1j.js +1 -0
  61. package/assets/index-BDh85s_o.js +1 -0
  62. package/assets/index-BluhX7J5.js +1 -0
  63. package/assets/index-BqjhYbTK.js +1 -0
  64. package/assets/index-BtEEXwAi.js +1 -0
  65. package/assets/index-CJDhCMZY.js +1 -0
  66. package/assets/index-CeziyGm_.js +1 -0
  67. package/assets/index-CxA7LBuE.js +1 -0
  68. package/assets/index-D8-XdCBI.js +1 -0
  69. package/assets/{index-DNl2PEHq.css → index-DYO-sbPN.css} +1 -1
  70. package/assets/index-Df_PxEto.js +1 -0
  71. package/assets/index-lqmSDAG_.js +1 -0
  72. package/assets/{index-BMM2gkfY.js → index-lxVTsHBH.js} +65 -65
  73. package/assets/{index-znJrox9Y.js → index-y3enq74c.js} +12 -12
  74. package/assets/kbd-Ds8JAL-i.js +1 -0
  75. package/assets/labels-CwARLqAD.js +1 -0
  76. package/assets/mail-Bux3edOt.js +1 -0
  77. package/assets/mail-CSpgLNSC.js +1 -0
  78. package/assets/menu-D6aq1T1f.js +1 -0
  79. package/assets/minus-DW1FraKg.js +1 -0
  80. package/assets/new-DwJ7NLZR.js +1 -0
  81. package/assets/onboarding-0lqsEEMH.js +1 -0
  82. package/assets/onboarding-completion-WuK4B8wi.js +1 -0
  83. package/assets/outbox-4__1O2vy.js +1 -0
  84. package/assets/{pencil-BJbvhQrw.js → pencil-DJPntSjN.js} +1 -1
  85. package/assets/{rich-text-Dyp4iBOD.js → rich-text-Ticmqq6R.js} +15 -15
  86. package/assets/{rich-text-spellcheck-worker-provider-VN94aKh3.js → rich-text-spellcheck-worker-provider-CEjXNkTo.js} +1 -1
  87. package/assets/rotate-ccw-Snzk6-SP.js +1 -0
  88. package/assets/row-actions-BY8sJ70m.js +1 -0
  89. package/assets/search-mirror-CgMxavNa.js +1 -0
  90. package/assets/{search-scope-DTcpOp3S.js → search-scope-B5-OK3Cq.js} +1 -1
  91. package/assets/search-token-index-D1mRODfF.js +1 -0
  92. package/assets/sections-BaNfgGs8.js +1 -0
  93. package/assets/senders-DtfLvp-S.js +1 -0
  94. package/assets/settings-JoaCyeEy.js +1 -0
  95. package/assets/settings-screen-D5PdsyBl.js +1 -0
  96. package/assets/shield-check-Bvnu7s8U.js +1 -0
  97. package/assets/{suggested-vips-CmHb5WaT.js → suggested-vips-W8f9qNN8.js} +1 -1
  98. package/assets/useCalendarData-CBjm4DbE.js +1 -0
  99. package/assets/{useDebouncedValue-DlyzBdqd.js → useDebouncedValue-D4EGUdvx.js} +1 -1
  100. package/assets/useFilters-CW_hrFZo.js +1 -0
  101. package/assets/useLabels-Dlob_XK-.js +1 -0
  102. package/assets/useLayoutTier-Ciq4HlaK.js +1 -0
  103. package/assets/{useMessageBodyContent-DHYriZRr.js → useMessageBodyContent-CUM4C6Cq.js} +1 -1
  104. package/assets/useQueries-CPnZMt_1.js +1 -0
  105. package/assets/useRefreshControl-DiNXvxEh.js +1 -0
  106. package/assets/{useSearchTokenContext-Dpl3C3yN.js → useSearchTokenContext-mRvSGuNd.js} +4 -4
  107. package/assets/useSemanticSearch-DqVnsXbc.js +1 -0
  108. package/assets/useSignature-CrrwTrAx.js +1 -0
  109. package/index.html +2 -2
  110. package/package.json +1 -1
  111. package/assets/BriefPane-BH4C3dLA.js +0 -1
  112. package/assets/FlaggedPane-Bx8o8jcX.js +0 -1
  113. package/assets/FullCompose-DQRblSEf.js +0 -1
  114. package/assets/MailListHeader-BpL0hiB2.js +0 -7
  115. package/assets/MailShell-zSsU-lz6.js +0 -1
  116. package/assets/MailboxPane-CBUf4RMT.js +0 -1
  117. package/assets/OnboardingWizard-CVgzD3hy.js +0 -1
  118. package/assets/OutboxPane-BxAQvF2m.js +0 -1
  119. package/assets/_mailboxId-BjXkByox.js +0 -1
  120. package/assets/_messageId-C3Ex2aTK.js +0 -1
  121. package/assets/_messageId-C_uTJLZJ.js +0 -1
  122. package/assets/_messageId-Cq1MMY1y.js +0 -1
  123. package/assets/_outboxMessageId-yXv0wqF1.js +0 -1
  124. package/assets/_threadId-9F3WBJ7b.js +0 -1
  125. package/assets/_threadId-CHYDYhMA.js +0 -1
  126. package/assets/_threadId-DAypvq_q.js +0 -1
  127. package/assets/accounts-ywyLeeZ4.js +0 -1
  128. package/assets/advanced-BWphupC9.js +0 -4
  129. package/assets/appearance-DIb1edPD.js +0 -1
  130. package/assets/brief-QvkLl3Xq.js +0 -1
  131. package/assets/circle-check-wwq1h3jr.js +0 -1
  132. package/assets/clock-KiLfjGAs.js +0 -1
  133. package/assets/compose._-_outboxMessageId_-B0wVDNtg.js +0 -1
  134. package/assets/compose._-_outboxMessageId_-BgkhRDHR.js +0 -1
  135. package/assets/compose._-_outboxMessageId_-IlQ7bZjJ.js +0 -1
  136. package/assets/compose._-_outboxMessageId_-ckob2lG-.js +0 -1
  137. package/assets/download-CCD9VEcr.js +0 -1
  138. package/assets/filters-DQwnkuFu.js +0 -1
  139. package/assets/flagged-KEPxze7A.js +0 -1
  140. package/assets/folders-DSaMJ8g_.js +0 -1
  141. package/assets/index-B8kF4cHs.js +0 -1
  142. package/assets/index-BwO3HmU5.js +0 -1
  143. package/assets/index-C_uTJLZJ.js +0 -1
  144. package/assets/index-Cq1MMY1y.js +0 -1
  145. package/assets/index-D81-y_-k.js +0 -1
  146. package/assets/index-DMMbHmw7.js +0 -1
  147. package/assets/index-DhPAqRyZ.js +0 -1
  148. package/assets/index-kEVKBUOf.js +0 -1
  149. package/assets/kbd-B-P9r9YU.js +0 -1
  150. package/assets/labels-B09LuD3F.js +0 -1
  151. package/assets/mail-5WLfHo9K.js +0 -1
  152. package/assets/mail-CyEa53oG.js +0 -1
  153. package/assets/menu-Rr3_qIop.js +0 -1
  154. package/assets/onboarding-DD5frk6X.js +0 -1
  155. package/assets/outbox-DR0YZs6I.js +0 -1
  156. package/assets/rotate-ccw-CrVofVFV.js +0 -1
  157. package/assets/row-actions-Bgax_YZA.js +0 -1
  158. package/assets/search-mirror-Lf1ogSTC.js +0 -1
  159. package/assets/search-token-index-BxytxF1H.js +0 -1
  160. package/assets/senders-dS1BVDQU.js +0 -1
  161. package/assets/settings-Cs9rwA_N.js +0 -1
  162. package/assets/settings-screen-D0fhHptg.js +0 -1
  163. package/assets/shield-check-BktB9xgz.js +0 -1
  164. package/assets/useFilters-CJkmZ6i7.js +0 -1
  165. package/assets/useLabels-DL6gxLzs.js +0 -1
  166. package/assets/useQueries-B-aYaD8d.js +0 -1
  167. package/assets/useRefreshControl-DUEqZD7x.js +0 -1
  168. package/assets/useSemanticSearch-DCoRQGtD.js +0 -1
  169. package/assets/useSignature-D4_HRnT6.js +0 -1
@@ -1,4 +0,0 @@
1
- import{c as b,j as e,aA as C,B as r,aL as p,aG as R,aM as B,aN as O,aF as T,ag as u,aO as z,r as m,as as y,aP as g,b as V,z as L,aQ as q,aR as U,D as H,aS as F,aT as S,aU as I,aV as Q,a0 as Y,aW as G,aX as W,aY as Z,a1 as J,aE as K,aI as X}from"./index-BMM2gkfY.js";import{S as ee}from"./settings-screen-D0fhHptg.js";import{B as M}from"./bug-DQdIiRjm.js";import{C as A}from"./circle-check-wwq1h3jr.js";import{f as se}from"./ErrorState-CBV6FtSJ.js";import{u as ae}from"./useQueries-B-aYaD8d.js";import{D as _}from"./download-CCD9VEcr.js";import{R as k}from"./rotate-ccw-CrVofVFV.js";import{C as te}from"./clock-KiLfjGAs.js";import{S as ne}from"./shield-check-BktB9xgz.js";import{b as ie}from"./help-copy-DryiNLYs.js";import"./avatar-lcZ4TVQd.js";import"./menu-Rr3_qIop.js";import"./circle-help-DbSK9hyF.js";import"./kbd-B-P9r9YU.js";const re=b("CloudOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193",key:"yfwify"}],["path",{d:"M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07",key:"jlfiyv"}]]);const le=b("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const v=b("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]),ce={BodyParse:"The message is built in a way Remit could not read."};function oe(s){return ce[s]}function E(s){return s.split(";")[0].trim()}const w=/^[A-Za-z0-9!#$%&'*+._-]+$/,$=/^[A-Za-z0-9!#$%&'*+._-]+\/[A-Za-z0-9!#$%&'*+._-]+$/;function j(s,a){return a.test(s)?`\`${s}\``:`\`${JSON.stringify(s).replace(/`/g,"\\u0060")}\` (malformed)`}function de(s){const a=E(s);return $.test(a)?a:JSON.stringify(a)}const N="_not read_";function me(s){return s.length===0?["(no MIME structure was read)"]:s.map(a=>`${" ".repeat(a.depth)}- ${de(a.contentType)}`)}const xe="_No message content, addresses, subject, attachment names or parser output are included._";function P(s){return{head:[`### Message quarantined at \`${s.failureStage}\``,"",`- **Failure**: \`${s.failureCode}\``,`- **Folder role**: ${s.mailboxRole??"_none appointed_"}`,`- **Failing part**: ${s.failurePartPath==null?"_whole message_":`\`${s.failurePartPath}\``}`,`- **Attempts before quarantine**: ${s.attempts}`,`- **Worker build**: ${s.workerVersion}`,`- **Message-ID hash**: ${s.messageIdHash==null?"_none declared_":`\`${s.messageIdHash}\``}`,"","#### Message shape","",`- **Content-Type**: ${s.contentType==null?N:j(E(s.contentType),$)}`,`- **Content-Transfer-Encoding**: ${s.transferEncoding==null?N:j(s.transferEncoding,w)}`,`- **Charset**: ${s.charset==null?"_not declared_":j(s.charset,w)}`,`- **Size**: ${s.sizeBytes==null?N:`${s.sizeBytes} bytes`}`,"","MIME structure:"].join(`
2
- `),structure:me(s.structure).join(`
3
- `),disclaimer:xe}}function ue(s){const{head:a,structure:t,disclaimer:n}=P(s);return[a,"","```",t,"```","",n].join(`
4
- `)}function he(s){return`Message quarantined: ${s.failureCode} at ${s.failureStage}`}function pe({entry:s,onClose:a,issueUrl:t,onCopy:n}){if(!s)return null;const i=ue(s);return e.jsx(C,{open:!0,onClose:a,title:"Report this message",children:e.jsxs("div",{className:"flex max-h-[80vh] flex-col",children:[e.jsxs("header",{className:"space-y-1 border-b border-line px-4 py-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-fg",children:"Report this message"}),e.jsx("p",{className:"text-xs text-fg-muted",children:"This is everything the report contains. It describes the shape of the message — never its contents, addresses, subject, attachment names, or the parser's own error text."})]}),e.jsx("pre",{className:"flex-1 overflow-auto bg-surface-sunken px-4 py-3 text-2xs leading-relaxed whitespace-pre-wrap text-fg-muted",children:i}),e.jsxs("footer",{className:"flex flex-wrap items-center justify-end gap-2 border-t border-line px-4 py-3",children:[e.jsx(r,{variant:"ghost",size:"sm",onClick:a,children:"Cancel"}),e.jsx(r,{variant:"secondary",size:"sm",icon:e.jsx(le,{className:"size-3.5"}),onClick:()=>n(i),children:"Copy report"}),e.jsx(p,{external:!0,size:"sm",href:t,icon:e.jsx(v,{className:"size-3.5"}),children:"Open on GitHub"})]})]})})}function fe(s){return new Date(s).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}function ge({entry:s,onCutBug:a}){return e.jsxs("li",{className:"flex flex-col gap-2 border-b border-line px-row-inset py-3 last:border-b-0 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"text-sm text-fg",children:oe(s.failureStage)}),e.jsx("p",{className:"truncate text-xs text-fg-muted",title:s.failureMessage,children:s.failureMessage}),e.jsxs("p",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-2xs text-fg-subtle",children:[s.mailboxRole&&e.jsx(R,{tone:"warning",children:B(s.mailboxRole)}),e.jsx("span",{className:"truncate",title:s.mailboxPath,children:O(s.mailboxPath,s.mailboxDelimiter)}),e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{children:`uid ${s.uid}`}),e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{children:fe(s.quarantinedAt)}),s.attempts>1&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{children:`${s.attempts} attempts`})]})]})]}),e.jsx(r,{variant:"secondary",size:"sm",className:"shrink-0",icon:e.jsx(M,{className:"size-3.5"}),onClick:()=>a(s),children:"Cut a bug"})]})}function je({entries:s,onCutBug:a}){return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsx("h2",{className:"text-sm font-semibold text-fg",children:"Messages set aside"}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Mail Remit could not read is set aside here instead of being skipped, so nothing goes missing quietly. The rest of the folder keeps syncing. Recovering a set-aside message is a re-sync, not a per-row action."})]}),s.length===0&&e.jsxs("div",{className:"flex items-center gap-2 rounded-sm border border-line bg-surface px-row-inset py-3",children:[e.jsx(A,{className:"size-4 shrink-0 text-positive","aria-hidden":!0}),e.jsx("p",{className:"text-sm text-fg-muted",children:"Every message has been read successfully. Nothing is set aside."})]}),s.length>1&&e.jsx(T,{tone:"warning",children:e.jsxs("p",{className:"flex items-start gap-2",children:[e.jsx(u,{className:"mt-0.5 size-4 shrink-0","aria-hidden":!0}),e.jsxs("span",{children:[e.jsx("span",{className:"font-semibold",children:`${s.length} messages could not be read.`})," ","More than one means something is wrong with how Remit reads mail, not with the mail. Reporting one of these gets it fixed."]})]})}),s.length>0&&e.jsx("ul",{className:"rounded-sm border border-line bg-surface",children:s.map(t=>e.jsx(ge,{entry:t,onCutBug:a},t.quarantineId))})]})}const Ne=["Remit restarts. Mail stops loading for about a minute and this page will lose its connection while that happens.","Nothing is sent, deleted or moved. Your mail stays at your provider.","If the new version does not come back up, the version you are running now is restored automatically."];function be({open:s,currentVersion:a,release:t,appliesSchemaMigration:n=!1,onClose:i,onConfirm:l}){return s?e.jsx(C,{open:!0,onClose:i,title:`Install Remit ${t.version}`,children:e.jsxs("div",{className:"flex max-h-[80vh] flex-col",children:[e.jsxs("header",{className:"space-y-1 border-b border-line px-4 py-3",children:[e.jsxs("h3",{className:"text-sm font-semibold text-fg",children:["Install Remit ",t.version,"?"]}),e.jsxs("p",{className:"text-xs text-fg-muted",children:["You are on ",a,". ",t.version," was released"," ",z(t.releasedAt),"."]})]}),e.jsxs("div",{className:"flex-1 space-y-3 overflow-auto px-4 py-3",children:[e.jsx("p",{className:"text-sm text-fg-muted",children:t.summary}),e.jsxs("ul",{className:"space-y-2",children:[Ne.map(c=>e.jsxs("li",{className:"flex gap-2 text-sm text-fg-muted",children:[e.jsx("span",{className:"mt-1.5 size-1.5 shrink-0 rounded-full bg-fg-subtle"}),e.jsx("span",{children:c})]},c)),n&&e.jsxs("li",{className:"flex gap-2 text-sm text-fg-muted",children:[e.jsx("span",{className:"mt-1.5 size-1.5 shrink-0 rounded-full bg-fg-subtle"}),e.jsx("span",{children:"This version updates the database while Remit is offline. The step forward cannot be undone by hand, but a failed start is still rolled back to the version and data you have now."})]})]}),e.jsx("p",{className:"text-xs text-fg-subtle",children:"Good moment for this: when you are not waiting on a message."})]}),e.jsxs("footer",{className:"flex flex-wrap items-center justify-end gap-2 border-t border-line px-4 py-3",children:[e.jsx(r,{variant:"ghost",size:"sm",onClick:i,children:"Not now"}),e.jsx(p,{variant:"secondary",size:"sm",external:!0,href:t.releaseNotesUrl,icon:e.jsx(v,{className:"size-3.5"}),children:"Release notes"}),e.jsx(r,{size:"sm",icon:e.jsx(_,{className:"size-3.5"}),onClick:l,children:"Install and restart"})]})]})}):null}function d({children:s,tone:a}){return e.jsx("div",{className:V("rounded-sm border bg-surface px-row-inset py-3",a==="danger"?"border-danger/50":"border-line"),children:s})}function ve({state:s,onCheck:a,onInstall:t,onDismissResult:n,now:i=Date.now()}){const[l,c]=m.useState(null),o=s.status==="checking",x=s.status==="available",h=()=>{if(o){c("Already checking. The result appears here in a moment.");return}c(null),a()},f=()=>{if(!x&&s.status!=="rolledBack"&&s.status!=="abandoned"){c("There is no update to install. Check for updates first — if one is found it appears here.");return}c(null),t()},D=(()=>{switch(s.status){case"upToDate":return e.jsx(d,{children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(A,{className:"size-4 shrink-0 text-positive","aria-hidden":!0}),e.jsxs("p",{className:"text-sm text-fg",children:["Remit ",s.version," is the latest version.",e.jsxs("span",{className:"text-fg-subtle",children:[" ","Checked ",g(s.checkedAt,i),"."]})]})]}),e.jsx(r,{variant:"secondary",size:"sm",className:"shrink-0",onClick:h,children:"Check again"})]})});case"checking":return e.jsx(d,{children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(y,{className:"size-4 shrink-0 animate-spin text-fg-subtle","aria-hidden":!0}),e.jsxs("p",{className:"text-sm text-fg-muted",children:["Looking for a newer version. You are on ",s.version,"."]})]}),e.jsx(r,{variant:"secondary",size:"sm",className:"shrink-0",onClick:h,children:"Check again"})]})});case"neverChecked":return e.jsx(d,{children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[e.jsx(te,{className:"mt-0.5 size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.jsxs("p",{className:"text-sm text-fg-muted",children:["No update check has run yet. Remit checks for updates on its own in the background.",s.lastCheckedAt!==void 0&&e.jsxs("span",{className:"text-fg-subtle",children:[" ","Last checked"," ",g(s.lastCheckedAt,i),"."]})]})]}),e.jsx(r,{variant:"secondary",size:"sm",className:"shrink-0",onClick:h,children:"Check now"})]})});case"checkFailed":return e.jsx(d,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(re,{className:"mt-0.5 size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"text-sm text-fg",children:"Could not reach the update source."}),e.jsx("p",{className:"text-xs text-fg-muted",children:s.reason}),e.jsxs("p",{className:"text-xs text-fg-subtle",children:["You are still on ",s.version," and it keeps working.",s.lastCheckedAt!==void 0&&e.jsxs(e.Fragment,{children:[" ","Last successful check"," ",g(s.lastCheckedAt,i),"."]})]})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(r,{variant:"secondary",size:"sm",onClick:h,children:"Try again"})})]})});case"available":return e.jsx(d,{children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:"text-sm font-semibold text-fg",children:["Remit ",s.release.version]}),e.jsx(R,{tone:"accent",children:"update available"}),e.jsxs("span",{className:"text-2xs text-fg-subtle",children:["released ",z(s.release.releasedAt)," · you are on ",s.version]})]}),e.jsx("p",{className:"text-sm text-fg-muted",children:s.release.summary}),e.jsx("p",{className:"text-xs text-fg-subtle",children:"Installing restarts Remit, so mail stops loading for about a minute. If the new version does not come back up, the one you are running now is restored on its own."}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(r,{size:"sm",icon:e.jsx(_,{className:"size-3.5"}),onClick:f,children:["Install ",s.release.version]}),e.jsx(p,{variant:"secondary",size:"sm",external:!0,href:s.release.releaseNotesUrl,icon:e.jsx(v,{className:"size-3.5"}),children:"Release notes"})]})]})});case"applying":return e.jsx(d,{children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(y,{className:"size-4 shrink-0 animate-spin text-accent-2","aria-hidden":!0}),e.jsxs("p",{className:"text-sm text-fg-muted",children:["Installing Remit ",s.target,". The restart screen has the details."]})]})});case"succeeded":return e.jsx(T,{tone:"success",onDismiss:n,children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"font-semibold",children:["Updated to Remit ",s.version,"."]}),e.jsxs("p",{children:["You were on ",s.previousVersion,"."," ",e.jsx("a",{href:s.releaseNotesUrl,target:"_blank",rel:"noopener noreferrer",className:"underline",children:"See what changed"}),"."]})]})});case"rolledBack":return e.jsx(d,{tone:"danger",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(u,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":!0}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("p",{className:"text-sm font-semibold text-fg",children:["Remit ",s.attemptedVersion," did not start. Remit reports that it put ",s.version," back."]}),e.jsxs("p",{className:"text-sm text-fg-muted",children:["You are running ",s.version," again. A failed update can still have changed things on the way — the log below is the only account of what it got as far as doing."]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-fg-subtle",children:"What Remit reported as the failure"}),e.jsx("code",{className:"block rounded-xs bg-danger-soft px-2 py-1 text-2xs text-danger",children:s.reason})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-fg-subtle",children:"Read the full log before trying again:"}),e.jsx("code",{className:"block rounded-xs bg-surface-sunken px-2 py-1 text-2xs text-fg-muted",children:s.logsCommand})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(r,{variant:"secondary",size:"sm",icon:e.jsx(k,{className:"size-3.5"}),onClick:f,children:["Try ",s.attemptedVersion," again"]}),e.jsxs(r,{variant:"ghost",size:"sm",onClick:n,children:["Stay on ",s.version]})]})]})});case"unreachable":return e.jsx(d,{tone:"danger",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(u,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":!0}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("p",{className:"text-sm font-semibold text-fg",children:["Installing ",s.attemptedVersion," left the server unreachable."]}),e.jsx("p",{className:"text-sm text-fg-muted",children:"Remit has answered again since, but nothing here can say what happened during the silence."})]})]}),e.jsx("code",{className:"block rounded-xs bg-surface-sunken px-2 py-1 text-2xs text-fg-muted",children:s.logsCommand}),e.jsx("div",{className:"flex justify-end",children:e.jsx(r,{variant:"ghost",size:"sm",onClick:n,children:"Dismiss"})})]})});case"rollbackFailed":return e.jsx(d,{tone:"danger",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(u,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":!0}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("p",{className:"text-sm font-semibold text-fg",children:["Remit ",s.attemptedVersion," did not start, and Remit could not put ",s.previousVersion," back."]}),e.jsx("p",{className:"text-sm text-fg-muted",children:"This is the one outcome Remit cannot resolve on its own. The server is in a half-changed state and needs you at a shell. The log below is the only account of where it stopped."})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-fg-subtle",children:"What Remit reported as the failure"}),e.jsx("code",{className:"block rounded-xs bg-danger-soft px-2 py-1 text-2xs text-danger",children:s.reason})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-fg-subtle",children:"Read the full log on the server:"}),e.jsx("code",{className:"block rounded-xs bg-surface-sunken px-2 py-1 text-2xs text-fg-muted",children:s.logsCommand})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(r,{variant:"ghost",size:"sm",onClick:n,children:"Dismiss"})})]})});case"abandoned":return e.jsx(d,{tone:"danger",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(u,{className:"mt-0.5 size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("p",{className:"text-sm font-semibold text-fg",children:["Remit ",s.attemptedVersion," was not installed. Nothing changed."]}),e.jsxs("p",{className:"text-sm text-fg-muted",children:["The update stopped before it altered anything. You are still running ",s.version,"."]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-fg-subtle",children:"What Remit reported"}),e.jsx("code",{className:"block rounded-xs bg-surface-sunken px-2 py-1 text-2xs text-fg-muted",children:s.reason})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-fg-subtle",children:"Read the full log before trying again:"}),e.jsx("code",{className:"block rounded-xs bg-surface-sunken px-2 py-1 text-2xs text-fg-muted",children:s.logsCommand})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(r,{variant:"secondary",size:"sm",icon:e.jsx(k,{className:"size-3.5"}),onClick:f,children:["Try ",s.attemptedVersion," again"]}),e.jsxs(r,{variant:"ghost",size:"sm",onClick:n,children:["Stay on ",s.version]})]})]})});default:return s}})();return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsx("h2",{className:"text-sm font-semibold text-fg",children:"Updates"}),e.jsx("p",{className:"text-xs text-fg-muted",children:"This Remit runs on your own server, so it updates when you say so. Your mail lives at your provider and is never touched by an update."})]}),D,l&&e.jsx("p",{role:"status",className:"text-xs text-fg-muted",children:l})]})}const ye=s=>s.map(a=>q(a.data?.items??[]));function ke(s){const a=ae({queries:s.map(t=>({...L({path:{accountId:t}}),staleTime:1/0})),combine:ye});return m.useMemo(()=>new Map(s.map((t,n)=>[t,a[n]??"/"])),[s,a])}function we(s,a){return{quarantineId:s.quarantineId,accountId:s.accountId,mailboxId:s.mailboxId,uidValidity:s.uidValidity,uid:s.uid,mailboxRole:s.mailboxRole?U[s.mailboxRole]:void 0,mailboxPath:s.mailboxPath,mailboxDelimiter:a,failureStage:s.failureStage,failureCode:s.failureCode,failureMessage:s.failureMessage,failurePartPath:s.failurePartPath,quarantinedAt:s.quarantinedAt,attempts:s.attempts,sizeBytes:s.sizeBytes,contentType:s.contentType,transferEncoding:s.transferEncoding,charset:s.charset,structure:s.structure,messageIdHash:s.messageIdHash,workerVersion:s.workerVersion}}const Ce=[];function Re(s){window.open(s,"_blank","noopener,noreferrer")}function Te(s){return S(I({quarantine:P(s),title:he(s)}))}function ze({error:s}){return e.jsxs("section",{role:"alert",className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold text-fg",children:"Messages set aside"}),e.jsxs("div",{className:"space-y-2 rounded-sm border border-danger/40 bg-danger-soft px-row-inset py-3",children:[e.jsx("p",{className:"text-sm font-medium text-danger",children:"The list of set-aside messages could not be read."}),e.jsx("p",{className:"break-words text-sm text-fg-muted",children:se(s)}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Mail may still have been set aside — this page cannot say either way until it can read the list. Reporting this gets it fixed."}),e.jsx(r,{variant:"secondary",size:"sm",icon:e.jsx(M,{className:"size-3.5"}),onClick:()=>Re(S(I())),children:"Report this"})]})]})}function Se({entries:s,isPending:a,error:t}){const[n,i]=m.useState(null),[l,c]=m.useState(!1);if(a)return e.jsx("p",{className:"animate-pulse text-sm text-fg-subtle",children:"Checking for messages set aside…"});if(t)return e.jsx(ze,{error:t});const o=x=>{navigator.clipboard.writeText(x).then(()=>{c(!1),i(null)},()=>{c(!0),i(null)})};return e.jsxs(e.Fragment,{children:[l&&e.jsx("p",{role:"alert",className:"mb-3 text-sm text-danger",children:"The report was not copied — this browser refused clipboard access. Cut the bug again and use Open on GitHub, which needs no clipboard."}),e.jsx(je,{entries:s,onCutBug:i}),e.jsx(pe,{entry:n,issueUrl:n?Te(n):"",onClose:()=>i(null),onCopy:o})]})}function Ie(){const{data:s,isPending:a,error:t}=H(F()),n=s?.entries??Ce,i=m.useMemo(()=>[...new Set(n.map(o=>o.accountId))],[n]),l=ke(i),c=m.useMemo(()=>n.map(o=>we(o,l.get(o.accountId)??"/")),[n,l]);return e.jsx(Se,{entries:c,isPending:a,error:t})}function Me(){const{surface:s,release:a,currentVersion:t,appliesSchemaMigration:n,onCheck:i,install:l,onDismissResult:c}=Q(),[o,x]=m.useState(!1);return s.status!=="ready"?null:e.jsxs(e.Fragment,{children:[e.jsx(ve,{state:s.section,onCheck:i,onInstall:()=>x(!0),onDismissResult:c}),a&&t&&e.jsx(be,{open:o,currentVersion:t,release:a,appliesSchemaMigration:n,onClose:()=>x(!1),onConfirm:()=>{x(!1),l(a.version)}})]})}function Ae(){return Y().tlsMode!=="internal"?null:e.jsxs("div",{className:"border-t border-line pt-4 mt-4",children:[e.jsx("p",{className:"text-sm font-medium text-fg mb-1",children:"TLS root certificate"}),e.jsx("p",{className:"text-sm text-fg-muted mb-2",children:"This deployment signs its own certificate. Import it into the trust store of each device you browse from, and the browser warning stops for good."}),e.jsx(p,{href:"/tls-root-ca.crt",download:!0,variant:"secondary",size:"sm",icon:e.jsx(ne,{className:"size-3.5"}),children:"Download root certificate"})]})}function _e(s){try{return new Date(s).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return s}}function Ee({sha:s=W,commitUrl:a=G,buildTime:t=Z}){return e.jsxs("p",{className:"text-xs text-fg-subtle",children:["Version"," ",a?e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"font-mono hover:text-fg-muted hover:underline",children:s}):e.jsx("span",{className:"font-mono",children:s})," · ",e.jsxs("span",{children:["Built ",_e(t)]})]})}function Je(){const s=J(),[a,t]=m.useState(!0),n=i=>{const l=X[i];l&&s({to:l})};return e.jsxs(ee,{items:K,activeId:"advanced",title:"Advanced",description:"Notification rules, export, and diagnostics.",help:ie,helpOpen:a,onToggleHelp:()=>t(i=>!i),onSelect:n,onBackToMail:()=>{s({to:"/mail"})},children:[e.jsx(Me,{}),e.jsx(Ie,{}),e.jsx("div",{className:"mt-6 border-t border-line pt-4",children:e.jsx("p",{className:"text-sm text-fg-muted",children:"Notification rules and data export are coming in a future release."})}),e.jsx(Ae,{}),e.jsxs("div",{className:"border-t border-line pt-4 mt-4",children:[e.jsx("p",{className:"text-sm font-medium text-fg mb-1",children:"About"}),e.jsx(Ee,{})]})]})}export{Je as component};
@@ -1 +0,0 @@
1
- import{a1 as x,r as a,aZ as g,j as e,aE as S,a_ as n,aI as y,a$ as T}from"./index-BMM2gkfY.js";import{S as v}from"./settings-screen-D0fhHptg.js";import{c as b}from"./help-copy-DryiNLYs.js";import"./avatar-lcZ4TVQd.js";import"./menu-Rr3_qIop.js";import"./circle-help-DbSK9hyF.js";import"./kbd-B-P9r9YU.js";const o="remit.density";function N(){return typeof localStorage>"u"?"comfortable":localStorage.getItem(o)??"comfortable"}function H(){const s=x(),[i,r]=a.useState(!0),[c,m]=a.useState(N),[p,d]=a.useState(g),h=t=>{m(t),typeof localStorage<"u"&&localStorage.setItem(o,t)},f=t=>{d(t),T(t)},u=t=>{const l=y[t];l&&s({to:l})};return e.jsx(v,{items:S,activeId:"appearance",title:"Appearance",description:"Display density and colour theme — instant-apply.",help:b,helpOpen:i,onToggleHelp:()=>r(t=>!t),onSelect:u,onBackToMail:()=>{s({to:"/mail"})},children:e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:"Density"}),e.jsx(n,{name:"density","aria-label":"Density",value:c,onChange:h,options:[{value:"comfortable",label:"Comfortable"},{value:"compact",label:"Compact"}]}),e.jsx("p",{className:"text-xs text-fg-subtle",children:"Controls the spacing of message rows in the mail list."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:"Theme"}),e.jsx(n,{name:"theme","aria-label":"Theme",value:p,onChange:f,options:[{value:"system",label:"System"},{value:"light",label:"Light"},{value:"dark",label:"Dark"}]}),e.jsx("p",{className:"text-xs text-fg-subtle",children:"Applies immediately. System default follows your OS preference."})]})]})})}export{H as component};
@@ -1 +0,0 @@
1
- import{j as r,a5 as i}from"./index-BMM2gkfY.js";import{a as m}from"./MailShell-zSsU-lz6.js";import{B as o}from"./BriefPane-BH4C3dLA.js";import{f as p}from"./search-token-index-BxytxF1H.js";import{u as e}from"./search-mirror-Lf1ogSTC.js";import"./FullCompose-DQRblSEf.js";import"./ErrorState-CBV6FtSJ.js";import"./index-znJrox9Y.js";import"./useMessageBodyContent-DHYriZRr.js";import"./useSignature-D4_HRnT6.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DlyzBdqd.js";import"./format-Dquh5i8-.js";import"./confirm-dialog-BeWZSgTL.js";import"./useSearchTokenContext-Dpl3C3yN.js";import"./kbd-B-P9r9YU.js";import"./search-scope-DTcpOp3S.js";import"./MailListHeader-BpL0hiB2.js";import"./attachment-file-B4nazean.js";import"./mail-5WLfHo9K.js";import"./avatar-lcZ4TVQd.js";import"./download-CCD9VEcr.js";import"./shield-check-BktB9xgz.js";import"./useFilters-CJkmZ6i7.js";import"./useQueries-B-aYaD8d.js";import"./clock-KiLfjGAs.js";import"./menu-Rr3_qIop.js";import"./useRefreshControl-DUEqZD7x.js";import"./circle-check-big-CyS5sZb6.js";import"./useLabels-DL6gxLzs.js";import"./useSemanticSearch-DCoRQGtD.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-B1bng5Jq.js";function G(){const t=p();return e({to:"/mail/brief"}),r.jsx(o,{thread:t,children:r.jsx(m,{phone:r.jsx(o.Phone,{}),list:r.jsx(o.List,{}),reading:r.jsx(i,{}),intelligence:r.jsx(o.Intelligence,{}),hasThread:!!t})})}export{G as component};
@@ -1 +0,0 @@
1
- import{c}from"./index-BMM2gkfY.js";const r=c("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);export{r as C};
@@ -1 +0,0 @@
1
- import{c}from"./index-BMM2gkfY.js";const o=c("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);export{o as C};
@@ -1 +0,0 @@
1
- import{F as o}from"./FullCompose-DQRblSEf.js";import"./index-BMM2gkfY.js";import"./ErrorState-CBV6FtSJ.js";import"./index-znJrox9Y.js";import"./useMessageBodyContent-DHYriZRr.js";import"./useSignature-D4_HRnT6.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DlyzBdqd.js";import"./format-Dquh5i8-.js";import"./confirm-dialog-BeWZSgTL.js";const c=o;export{c as component};
@@ -1 +0,0 @@
1
- import{F as o}from"./FullCompose-DQRblSEf.js";import"./index-BMM2gkfY.js";import"./ErrorState-CBV6FtSJ.js";import"./index-znJrox9Y.js";import"./useMessageBodyContent-DHYriZRr.js";import"./useSignature-D4_HRnT6.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DlyzBdqd.js";import"./format-Dquh5i8-.js";import"./confirm-dialog-BeWZSgTL.js";const c=o;export{c as component};
@@ -1 +0,0 @@
1
- import{F as o}from"./FullCompose-DQRblSEf.js";import"./index-BMM2gkfY.js";import"./ErrorState-CBV6FtSJ.js";import"./index-znJrox9Y.js";import"./useMessageBodyContent-DHYriZRr.js";import"./useSignature-D4_HRnT6.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DlyzBdqd.js";import"./format-Dquh5i8-.js";import"./confirm-dialog-BeWZSgTL.js";const c=o;export{c as component};
@@ -1 +0,0 @@
1
- import{F as o}from"./FullCompose-DQRblSEf.js";import"./index-BMM2gkfY.js";import"./ErrorState-CBV6FtSJ.js";import"./index-znJrox9Y.js";import"./useMessageBodyContent-DHYriZRr.js";import"./useSignature-D4_HRnT6.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DlyzBdqd.js";import"./format-Dquh5i8-.js";import"./confirm-dialog-BeWZSgTL.js";const c=o;export{c as component};
@@ -1 +0,0 @@
1
- import{c as o}from"./index-BMM2gkfY.js";const a=o("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);export{a as D};
@@ -1 +0,0 @@
1
- import{w as X,ak as Z,b0 as ee,b1 as te,r as x,b2 as se,j as t,b3 as ae,b4 as ie,as as R,B as N,b5 as ne,aA as re,aG as oe,b6 as le,b7 as ce,T as de,D as P,z as me,b8 as ue,G as pe,H as xe,b9 as fe,aQ as he,a1 as ge,a2 as be,aE as ve,aI as ye}from"./index-BMM2gkfY.js";import{S as je}from"./settings-screen-D0fhHptg.js";import{B as Ne}from"./bottom-sheet-D-zZ-Ztc.js";import{u as Ce,a as Se}from"./useLabels-DL6gxLzs.js";import{b as Fe,N as S,p as Ie,u as Me,r as we,a as Ee,S as L,c as Oe,n as De,f as Ae,d as Le,e as ke,g as Te}from"./useFilters-CJkmZ6i7.js";import{C as A}from"./circle-check-wwq1h3jr.js";import{E as z}from"./ErrorState-CBV6FtSJ.js";import"./avatar-lcZ4TVQd.js";import"./menu-Rr3_qIop.js";import"./circle-help-DbSK9hyF.js";const Re=(e,s)=>{const r=X(),i=Z({...te(),onSuccess:()=>{e&&(r.invalidateQueries({queryKey:Fe(e)}),s&&r.invalidateQueries({queryKey:ee({path:{accountId:e,filterId:s}})}))}}),{mutate:c}=i;return{updateFilter:x.useCallback(d=>{!e||!s||c({path:{accountId:e,filterId:s},body:d})},[e,s,c]),isPending:i.isPending,isSuccess:i.isSuccess,isError:i.isError,error:i.error,reset:i.reset}},Pe=(e,s=!1)=>({clauses:e.literalClauses.map((i,c)=>({id:`clause-${c}`,field:i.field,value:i.value})),matchOperator:e.matchOperator==="And"?"all":"any",widen:e.hasAnchor?{anchorCount:1,...s?{inactive:!0}:{}}:void 0,moveMailboxId:e.actionMailboxId!==S?e.actionMailboxId:void 0,labelId:e.actionLabelId!==S?e.actionLabelId:void 0,scope:e.scope==="Temporary"?"until":"standing",until:e.scope==="Temporary"?ze(e.expiresAt):void 0,name:e.name}),ze=e=>{if(!e)return"";const s=Date.parse(e);if(Number.isNaN(s))return"";const r=new Date(s),i=c=>String(c).padStart(2,"0");return`${r.getFullYear()}-${i(r.getMonth()+1)}-${i(r.getDate())}`},k=e=>JSON.stringify({clauses:e.clauses.map(s=>[s.field,s.value]),operator:e.matchOperator,move:e.moveMailboxId??null,label:e.labelId??null,widen:e.widen?e.widen.inactive?"inactive":"active":"none"}),$=(e,s)=>k(e)!==k(s),T=e=>JSON.stringify({scope:e.scope==="until"?"until":"standing",until:e.scope==="until"?e.until??"":""}),_=(e,s)=>T(e)!==T(s),$e=(e,s)=>{const r={},i=(e.name??"").trim();return i!==(s.name??"").trim()&&(r.name=i),$(e,s)&&(r.matchOperator=e.matchOperator==="all"?"And":"Or",r.literalClauses=e.clauses.map(c=>({field:c.field,value:c.value})),r.actionMailboxId=e.moveMailboxId??S,r.actionLabelId=e.labelId??S),_(e,s)&&(r.scope=e.scope==="until"?"Temporary":"Standing",e.scope==="until"&&(r.expiresAt=Ie(e.until??""))),r};function _e({accountId:e,filter:s,folders:r,delimiter:i,labels:c,semanticUnavailable:g=!1,onClose:d}){const f=x.useMemo(()=>Pe(s,g),[s,g]),[n,l]=x.useState(f),[m,u]=x.useState(),[h,v]=x.useState(!1),I=x.useRef(0),{count:C}=Me(e,we(n)),j=Re(e,s.filterId),b=Ee(e),{createFolderIn:F}=se(e),{createLabel:E}=Ce(e),M=async o=>{const a=await E(o);return{id:a.labelId,name:a.name,color:a.color}},p=()=>u({mode:"add",draft:{field:L[0],value:""}}),w=o=>{const a=n.clauses.find(y=>y.id===o);a&&u({mode:"edit",clauseId:o,draft:{field:a.field,value:a.value}})},O=o=>u(a=>a&&{...a,draft:{...a.draft,field:o}}),B=o=>u(a=>a&&{...a,draft:{...a.draft,value:o}}),U=()=>{if(!m)return;const o=m.draft.field,a=De(o,m.draft.value);a!==""&&(l(y=>m.mode==="edit"&&m.clauseId?{...y,clauses:y.clauses.map(D=>D.id===m.clauseId?{id:D.id,field:o,value:a}:D)}:(I.current+=1,{...y,clauses:[...y.clauses,{id:`new-${I.current}`,field:o,value:a}]})),u(void 0))},G=o=>l(a=>({...a,clauses:a.clauses.filter(y=>y.id!==o)})),K=o=>l(a=>({...a,matchOperator:o})),Q=o=>l(a=>({...a,moveMailboxId:o||void 0})),H=o=>l(a=>({...a,labelId:o||void 0})),J=o=>l(a=>({...a,name:o})),V=o=>l(a=>({...a,scope:o,until:o==="until"?a.until:void 0})),q=o=>l(a=>({...a,until:o})),W=()=>{const o=$(n,f)||_(n,f),a=$e(n,f);if(Object.keys(a).length===0){d();return}v(o),j.updateFilter(a)},Y=()=>b.start(Oe(n));return b.isStarting||b.isRunning||b.isDone?t.jsx(Ke,{progress:b.progress,isDone:b.isDone,onClose:d}):j.isPending?t.jsx(Be,{}):j.isError?t.jsx(Qe,{onRetry:j.reset,onClose:d}):j.isSuccess?h?t.jsx(Ge,{preview:ae(C),blocked:C.status!=="ready"||C.stale===!0,onReapply:Y,onClose:d}):t.jsx(Ue,{onClose:d}):t.jsx(ie,{rule:n,folders:r,delimiter:i,labels:c,preview:C,semanticAvailable:!1,clauseFields:L,anchorLocked:!0,clauseEdit:m,onStartAddClause:p,onStartEditClause:w,onRemoveClause:G,onChangeDraftField:O,onChangeDraftValue:B,onSubmitClause:U,onCancelClause:()=>u(void 0),onChangeMatchOperator:K,onChangeMove:Q,onCreateFolder:F,onChangeLabel:H,onCreateLabel:M,onChangeName:J,onChangeScope:V,onChangeUntil:q,onCommit:W,onCancel:d})}function Be(){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[t.jsx(R,{className:"size-8 animate-spin text-accent-2"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Saving changes…"})]})}function Ue({onClose:e}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx(A,{className:"size-8 text-positive"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Filter updated"}),t.jsx(N,{variant:"primary",onClick:e,className:"mt-2",children:"Done"})]})}function Ge({preview:e,blocked:s,onReapply:r,onClose:i}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx(A,{className:"size-8 text-positive"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Rule saved"}),t.jsxs("p",{className:"max-w-xs text-xs text-fg-muted",children:["New mail follows the rule automatically. ",e," — move the mail already in your mailbox too?"]}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsx(N,{variant:"primary",onClick:r,disabled:s,children:"Move existing mail"}),t.jsx(N,{variant:"ghost",onClick:i,children:"Not now"})]})]})}function Ke({progress:e,isDone:s,onClose:r}){const i=e.state==="Failed";return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[s?i?t.jsx("span",{className:"text-sm font-semibold text-danger",children:"Move failed"}):t.jsx(A,{className:"size-8 text-positive"}):t.jsx(R,{className:"size-8 animate-spin text-accent-2"}),!s&&t.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving existing mail…"}),s&&!i&&t.jsxs("div",{className:"text-sm text-fg",children:[t.jsx("p",{className:"font-medium",children:"Done"}),t.jsxs("p",{className:"mt-1 text-xs text-fg-muted",children:[e.appliedCount," of ",e.matchedCount," moved",e.failedCount>0?` · ${e.failedCount} failed`:"","."]})]}),s&&i&&t.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:e.errorMessage||"Something went wrong. Please try again."}),s&&t.jsx(N,{variant:"primary",onClick:r,className:"mt-2",children:"Done"})]})}function Qe({onRetry:e,onClose:s}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx("p",{className:"text-sm font-medium text-danger",children:"Couldn't save changes"}),t.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:"Please try again."}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsx(N,{variant:"primary",onClick:e,children:"Try again"}),t.jsx(N,{variant:"ghost",onClick:s,children:"Not now"})]})]})}function He({accountId:e,filter:s,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d}){const f=ne(),n=t.jsx(_e,{accountId:e,filter:s,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d});return f?t.jsx(re,{open:!0,onClose:d,title:"Filter rule",children:n}):t.jsx(Ne,{open:!0,onClose:d,dismissLabel:"Dismiss filter rule",children:n})}function Je({filters:e,mailboxName:s,labelById:r,onEdit:i,onDelete:c,deletingFilterId:g,semanticUnavailable:d=!1,now:f=Date.now()}){return e.length===0?t.jsx("p",{className:"py-6 text-sm text-fg-muted",children:"No filters yet. Select a few messages in the inbox and choose Organize to make one."}):t.jsx("ul",{className:"divide-y divide-line rounded-md border border-line",children:e.map(n=>{const l=Ae(n,f),m=l==="Expired",u=n.actionMailboxId!==S?s(n.actionMailboxId):void 0,h=n.actionLabelId!==S?r.get(n.actionLabelId):void 0,v=Le(n.expiresAt);return t.jsxs("li",{className:"flex items-start gap-3 px-3 py-2.5",children:[t.jsxs("button",{type:"button",onClick:()=>i(n.filterId),"aria-label":`Edit filter ${n.name}`,className:"min-w-0 flex-1 rounded-sm text-left hover:opacity-80",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:`truncate text-sm font-medium ${m?"text-fg-muted":"text-fg"}`,children:n.name}),t.jsx(oe,{tone:m?"neutral":"positive",dot:!0,children:l})]}),t.jsxs("p",{className:"mt-0.5 text-xs text-fg-subtle",children:[u?`Moves matches to ${u}`:"No move action",n.scope==="Temporary"&&v?m?` · expired ${v}`:` · until ${v}`:n.scope==="Standing"?" · always":""]}),(n.hasAnchor||h)&&t.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[n.hasAnchor&&t.jsx(le,{widen:{anchorCount:1,...d?{inactive:!0}:{}}}),h&&t.jsx(ce,{label:{labelId:h.id,name:h.name,color:h.color}})]})]}),t.jsx(N,{variant:"ghost",size:"sm",icon:t.jsx(de,{className:"size-4 text-danger"}),onClick:()=>c(n.filterId),disabled:g===n.filterId,"aria-label":`Delete filter ${n.name}`})]},n.filterId)})})}const Ve=t.jsxs("div",{className:"space-y-3",children:[t.jsxs("p",{children:["Filters are the standing rules Organize creates. A"," ",t.jsx("strong",{children:"Standing"})," filter keeps working on new mail; a"," ",t.jsx("strong",{children:"Temporary"})," one stops on its own at the date you picked."]}),t.jsx("p",{children:"An expired filter isn't deleted the instant it lapses — it stays here, marked Expired, so you can see what it did and when it stopped."})]});function qe({account:e}){const s=e.accountId,{filters:r,isPending:i,isError:c,error:g,refetch:d}=ke(s),{deleteFilter:f,deletingFilterId:n}=Te(s),[l,m]=x.useState(),{data:u}=P({...me({path:{accountId:s}}),staleTime:1/0}),h=ue(),v=x.useMemo(()=>pe(e.folderAppointments),[e.folderAppointments]),I=x.useCallback(p=>{const w=u?.items.find(O=>O.mailboxId===p);if(w)return xe(w,v.get(p),h)},[u?.items,v,h]),C=x.useMemo(()=>fe({mailboxes:u?.items??[],folderAppointments:e.folderAppointments,translator:h}),[u?.items,e.folderAppointments,h]),j=he(u?.items??[]),{labels:b}=Se(s),F=x.useMemo(()=>b.map(p=>({id:p.labelId,name:p.name,color:p.color})),[b]),E=x.useMemo(()=>new Map(F.map(p=>[p.id,p])),[F]),M=r.find(p=>p.filterId===l);return t.jsxs("section",{className:"space-y-2",children:[t.jsx("h2",{className:"text-sm font-semibold text-fg",children:e.email}),M&&t.jsx(He,{accountId:s,filter:M,folders:C,delimiter:j,labels:F,onClose:()=>m(void 0)}),i?t.jsx("div",{className:"h-16 animate-pulse rounded-md border border-line bg-surface","aria-busy":"true","aria-label":`Loading filters for ${e.email}`}):c?t.jsx(z,{variant:"inline",title:`Couldn't load filters for ${e.email}`,error:g,onRetry:()=>{d()}}):t.jsx(Je,{filters:r,mailboxName:I,labelById:E,onEdit:m,onDelete:f,deletingFilterId:n})]})}function rt(){const e=ge(),[s,r]=x.useState(!0),{data:i,isPending:c,isError:g,error:d,refetch:f}=P(be()),n=l=>{const m=ye[l];m&&e({to:m})};return t.jsx(je,{items:ve,activeId:"filters",title:"Filters",description:"Standing and temporary rules created by Organize, per account.",help:Ve,helpOpen:s,onToggleHelp:()=>r(l=>!l),onSelect:n,onBackToMail:()=>{e({to:"/mail"})},children:c?t.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):g?t.jsx(z,{title:"Couldn't load accounts",error:d,onRetry:()=>{f()}}):i.accounts.length===0?t.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):t.jsx("div",{className:"space-y-8",children:i.accounts.map(l=>t.jsx(qe,{account:l},l.accountId))})})}export{qe as AccountFilters,rt as component};
@@ -1 +0,0 @@
1
- import{j as o,a5 as i}from"./index-BMM2gkfY.js";import{a as m}from"./MailShell-zSsU-lz6.js";import{F as r}from"./FlaggedPane-Bx8o8jcX.js";import{f as p}from"./search-token-index-BxytxF1H.js";import{u as e}from"./search-mirror-Lf1ogSTC.js";import"./FullCompose-DQRblSEf.js";import"./ErrorState-CBV6FtSJ.js";import"./index-znJrox9Y.js";import"./useMessageBodyContent-DHYriZRr.js";import"./useSignature-D4_HRnT6.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DlyzBdqd.js";import"./format-Dquh5i8-.js";import"./confirm-dialog-BeWZSgTL.js";import"./useSearchTokenContext-Dpl3C3yN.js";import"./kbd-B-P9r9YU.js";import"./search-scope-DTcpOp3S.js";import"./MailListHeader-BpL0hiB2.js";import"./attachment-file-B4nazean.js";import"./mail-5WLfHo9K.js";import"./avatar-lcZ4TVQd.js";import"./download-CCD9VEcr.js";import"./shield-check-BktB9xgz.js";import"./useFilters-CJkmZ6i7.js";import"./useQueries-B-aYaD8d.js";import"./clock-KiLfjGAs.js";import"./menu-Rr3_qIop.js";import"./MailViewChrome-CNywrIYr.js";import"./wizard-selection-B1bng5Jq.js";function z(){const t=p();return e({to:"/mail/flagged"}),o.jsx(r,{thread:t,children:o.jsx(m,{phone:o.jsx(r.Phone,{}),list:o.jsx(r.List,{}),reading:o.jsx(i,{}),intelligence:o.jsx(r.Intelligence,{}),hasThread:!!t})})}export{z as component};
@@ -1 +0,0 @@
1
- import{j as e,B as N,T as q,ba as Y,r as c,aA as W,X,aJ as he,aq as Z,F as xe,aN as H,bb as fe,ap as pe,at as ge,aF as L,aM as be,bc as ve,w as J,Z as ee,a6 as se,bd as je,be as ye,aK as Ne,Y as ke,bf as Ce,bg as _,bh as we,bi as Se,bj as te,bk as Me,bl as Q,b2 as ae,b8 as re,b9 as Ie,H as B,G as ne,as as G,bm as V,bn as Ee,ag as De,bo as Ae,a1 as Oe,D as ie,a2 as Te,aE as Re,aI as Fe,z as Pe,ak as U,bp as $e,bq as ze,br as Le,aR as _e,bs as qe,bt as Be}from"./index-BMM2gkfY.js";import{P as Ge}from"./pencil-BJbvhQrw.js";import{S as Ke}from"./settings-screen-D0fhHptg.js";import{E as oe}from"./ErrorState-CBV6FtSJ.js";import"./avatar-lcZ4TVQd.js";import"./menu-Rr3_qIop.js";import"./circle-help-DbSK9hyF.js";const He=({label:s,onRename:t,onDelete:a,deleteBlockedReason:o,renameLabel:m=u=>`Rename ${u}`,deleteLabel:r=u=>`Delete ${u}`})=>{const u=o?`${r(s)} — ${o}`:r(s);return e.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 pr-2",children:[e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(Ge,{className:"size-3.5"}),"aria-label":m(s),onClick:t}),e.jsx("span",{title:o,children:e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(q,{className:"size-3.5"}),"aria-label":u,disabled:o!==void 0,onClick:a})})]})},Qe=({folders:s,onRename:t,onDelete:a,onCreateFolder:o,delimiter:m,labels:r})=>{const u=new Map(s.map(l=>[l.id,l]));return e.jsx(Y,{folders:s,onCreateFolder:o,delimiter:m,labels:{treeAriaLabel:"Your folders",optionLabel:l=>l.label,...r},rowActions:l=>{const i=u.get(l.id);return i?e.jsx(He,{label:i.label,deleteBlockedReason:i.deleteBlockedReason,renameLabel:r?.rename,deleteLabel:r?.remove,onRename:()=>t(i),onDelete:()=>a(i)}):null}})},Ve=({open:s,folderLabel:t,defaultLabel:a,name:o,onNameChange:m,onSubmit:r,onClose:u,pending:l=!1,error:i})=>{const d=c.useId(),g=`Rename ${t}`;return s?e.jsxs(W,{open:s,onClose:u,title:g,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:g}),e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(X,{className:"size-3.5"}),onClick:u,"aria-label":"Cancel"})]}),e.jsxs("div",{className:"space-y-3 px-5 py-4",children:[e.jsxs("div",{children:[e.jsx(he,{htmlFor:d,children:"Folder name"}),e.jsx(Z,{id:d,value:o,placeholder:a,onChange:p=>m(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),r())}})]}),e.jsxs("p",{className:"text-xs text-fg-muted",children:["Shown everywhere in Remit. Leave it blank to use"," ",e.jsx("span",{className:"font-medium text-fg",children:a}),"."]}),i&&e.jsx("p",{className:"text-xs text-danger",role:"alert",children:i})]}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:u,children:"Cancel"}),e.jsx(N,{variant:"primary",size:"sm",onClick:r,disabled:l,children:l?"Saving…":"Save name"})]})]}):null},Ue=["inbox","drafts","sent","archive","junk","trash"],K="",Ye={mailboxId:null,source:"None"};function We(s){const t=s.messageCount===1?"msg":"msgs";return`${H(s.providerPath,s.hierarchyDelimiter)} · ${s.messageCount} ${t}`}const le=s=>`${s} ${s===1?"message":"messages"}`,Xe=(s,t)=>s==="Appointed"?"Chosen by you":s==="Flagged"?`The mail server marks it as ${t}`:s==="Reserved"?"The account's own INBOX":"Matched by name, not confirmed";function Ze({role:s,folders:t,appointment:a,displayName:o,onAppoint:m,onRename:r}){const[u,l]=c.useState(o),i=c.useRef(null),d=c.useRef(!1),g=c.useId(),{mailboxId:p,source:v,staleFolderPath:j}=a,h=t.find(y=>y.mailboxId===p)??null,f=be(s),O=h!=null&&u.trim()!==o.trim();c.useEffect(()=>{!d.current||v==="Proposed"||(d.current=!1,i.current?.focus())},[v]);const I=(()=>{if(v==="None"){const y=s==="trash"?" Deleting mail needs one.":"";return e.jsx("span",{id:g,className:"pl-[7.5rem] text-xs text-fg-muted",children:`Not set — pick the folder this account uses for ${f}.${y}`})}return v==="Stale"||!h?null:e.jsx("span",{id:g,className:"truncate pl-[7.5rem] text-2xs text-fg-subtle",title:h.providerPath,children:`${Xe(v,f)} · ${h.providerPath} · ${le(h.messageCount)}`})})(),w=s==="trash"?" Deleting mail is stopped until you pick another one.":h?` reader is using ${H(h.providerPath,h.hierarchyDelimiter)} instead.`:"",A=`The folder you chose for ${f}${j?` — ${j} —`:""} is gone from the mail server.${w}`;return e.jsxs("div",{className:"flex flex-col gap-1 border-b border-line px-row-inset py-2.5 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"flex w-28 shrink-0 items-center gap-2 text-sm font-medium text-fg",children:[fe(s),f]}),e.jsxs(pe,{ref:i,className:"w-56 shrink-0",value:p??K,"aria-label":`Folder for ${f}`,"aria-describedby":I||v==="Stale"?g:void 0,onChange:y=>m(s,y.target.value===K?null:y.target.value),children:[e.jsx("option",{value:K,children:"None"}),t.map(y=>e.jsx("option",{value:y.mailboxId,children:We(y)},y.mailboxId))]}),v==="Proposed"&&h&&e.jsx(N,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{d.current=!0,m(s,h.mailboxId)},children:`Set as ${f}`}),h&&e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"flex-1",value:u,placeholder:f,"aria-label":`Display name for ${f}`,onChange:y=>l(y.target.value)}),O&&e.jsx(N,{variant:"ghost",size:"sm",className:"shrink-0",icon:e.jsx(ge,{className:"size-4"}),"aria-label":"Save display name",onClick:()=>r(h.mailboxId,u)})]})]}),I,v==="Stale"&&e.jsx(L,{tone:"warning",variant:"soft",className:"ml-[7.5rem]",children:e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{id:g,className:"flex-1",children:A}),e.jsx(N,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>i.current?.focus(),children:"Pick a folder"})]})})]})}function Je(){return e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Each canonical role — Inbox, Drafts, Sent, Archive, Spam, Trash — points at one of your account's real folders. Pick the one that actually holds the mail; the message counts tell real folders from empty look-alikes."}),e.jsx("p",{children:`Appointing a folder to a role here doesn't touch any other role, and doesn't move or rename anything on the server — it just tells Remit which folder to treat as e.g. "Drafts" everywhere (sidebar, unread badges, the compose flow).`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Your folders"})," is the account's real hierarchy. Open a folder to see what's inside it, make a new one where you're looking, and rename or delete any of them from its row."]})]})}function es({accountEmail:s,folders:t,appointments:a,displayNames:o={},onAppoint:m,onRename:r}){const u=new Set(Object.values(a).map(i=>i.mailboxId).filter(i=>i!=null)),l=t.filter(i=>!u.has(i.mailboxId));return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsxs("h2",{className:"text-sm font-semibold text-fg",children:["Folder roles — ",s]}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Each row says where its answer came from — your choice, the mail server's own flag, or a name reader matched."})]}),e.jsx("div",{className:"rounded-sm border border-line bg-surface",children:Ue.map(i=>{const d=a[i]??Ye;return e.jsx(Ze,{role:i,folders:t,appointment:d,displayName:d.mailboxId?o[d.mailboxId]??"":"",onAppoint:m,onRename:r},i)})}),l.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("h3",{className:"text-xs font-medium text-fg-muted",children:"Other folders"}),e.jsx("ul",{className:"rounded-sm border border-line bg-surface",children:l.map(i=>e.jsxs("li",{className:"flex items-center gap-2 border-b border-line px-row-inset py-2 text-sm text-fg last:border-b-0",children:[e.jsx(xe,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate",children:H(i.providerPath,i.hierarchyDelimiter)}),e.jsx("span",{className:"ml-auto shrink-0 text-2xs text-fg-subtle",children:le(i.messageCount)})]},i.mailboxId))})]})]})}const ss=12e4,ts=2e3,as="This folder is no longer in the account's folder list, so nothing was deleted.",ce=(s,t)=>{const a=s.find(o=>o.mailboxId===t);if(!a)throw new Error(as);return a},rs=(s,t)=>ce(s,t).lastSyncedAt??0;async function ns({readMailboxes:s,mailboxId:t,since:a,signal:o,segmentMs:m=ss,pollIntervalMs:r=ts,delay:u=ve,now:l=Date.now}){const i=l()+m;for(;;){o?.throwIfAborted();const d=ce(await s(),t);if((d.lastSyncedAt??0)>a)return{status:"fresh",messageCount:d.messagesTotal};if(l()>=i)return{status:"pending"};await u(r,o)}}const de=50,is=s=>s instanceof Error?s.message:"Something went wrong.",$=s=>s.then(t=>({ok:!0,value:t}),t=>({ok:!1,error:is(t)})),os=async(s,t,a,o)=>{const m=[];let r;for(let u=0;u<de;u+=1){if(o.aborted)return m;const{data:l}=await te({path:{mailboxId:s},query:{order:"desc",continuationToken:r},throwOnError:!0});for(const i of l.items)if(!i.isDeleted&&!t.has(i.messageId)&&!m.includes(i.messageId)&&(m.push(i.messageId),m.length>=a))return m;if(!l.continuationToken)break;r=l.continuationToken}return m},ls=async(s,t)=>{let a=0,o;for(let m=0;m<de;m+=1){if(t.aborted)return a;const{data:r}=await te({path:{mailboxId:s},query:{order:"desc",continuationToken:o},throwOnError:!0});for(const u of r.items)u.isDeleted||(a+=1);if(!r.continuationToken)break;o=r.continuationToken}return a};function cs({accountId:s,mailboxId:t,onDeleted:a}){const o=J(),[m,r]=c.useState("idle"),[u,l]=c.useState(null),[i,d]=c.useState(),[g,p]=c.useState(),v=c.useRef(null),j=c.useRef(void 0),h=c.useCallback(()=>{o.invalidateQueries({queryKey:ee({path:{accountId:s}})}),o.invalidateQueries({queryKey:se()})},[o,s]),f=c.useCallback(async()=>{r("deleting");const k=await $(je({path:{accountId:s,mailboxId:t},throwOnError:!0}));if(!k.ok){d(k.error),r("error");return}h(),r("done"),a()},[s,t,h,a]),O=c.useCallback(()=>ye({path:{accountId:s},throwOnError:!0}).then(({data:k})=>k.items.find(S=>S.mailboxId===t)?.messageCount??0),[s,t]),I=c.useCallback(()=>o.fetchQuery({...Ne({path:{accountId:s}}),staleTime:0}).then(k=>k.mailboxes??[]),[o,s]),w=c.useCallback(async()=>{const k=new AbortController;v.current=k;const{signal:S}=k;r("checking"),d(void 0);const M=j.current!==void 0,C=await $((async()=>(M||(S.throwIfAborted(),j.current=rs(await I(),t),S.throwIfAborted(),p(Date.now()),await ke({path:{accountId:s},throwOnError:!0})),ns({readMailboxes:I,mailboxId:t,since:j.current??0,signal:S})))());return S.aborted?(r("idle"),j.current=void 0,{status:"failed"}):C.ok?C.value.status==="pending"?(r("check-stalled"),{status:"pending"}):(j.current=void 0,C.value.messageCount>0?(r("idle"),h(),{status:"blocked",messageCount:C.value.messageCount}):(await f(),{status:"deleted"})):(j.current=void 0,d(C.error),r("error"),{status:"failed"})},[s,t,I,f,h]),A=c.useCallback(()=>{v.current?.abort()},[]),y=c.useCallback(async k=>{const S=new AbortController;v.current=S;const{signal:M}=S;r("moving"),d(void 0);const C=await $(O());if(M.aborted)return;if(!C.ok){d(C.error),r("error");return}let x=Ce(C.value);l(x);const E=new Set;for(;;){if(M.aborted)return;const n=await $(os(t,E,Me,M));if(M.aborted)return;if(!n.ok){x=_(x,n.error),l(x),d(n.error),r("error");return}const b=n.value;if(b.length===0)break;const T=await $(we({body:{messageIds:b,destinationMailboxId:k},throwOnError:!0}));if(M.aborted)return;if(!T.ok){x=_(x,T.error),l(x),d(T.error),r("error");return}for(const P of b)E.add(P);x=Se(x,b.length),l(x)}const D=await $(ls(t,M));if(!M.aborted){if(!D.ok){x=_(x,D.error),l(x),d(D.error),r("error");return}if(D.value>0){const n=`${D.value} ${D.value===1?"email is":"emails are"} still syncing. Re-open delete to finish removing this folder.`;x=_(x,n),l(x),d(n),r("error"),h();return}await f()}},[t,O,f,h]),R=c.useCallback(()=>{v.current?.abort(),v.current=null,j.current=void 0,r("idle"),l(null),d(void 0),p(void 0)},[]);return{phase:m,progress:u,errorMessage:i,checkStartedAt:g,deleteMailbox:f,deleteIfEmpty:w,moveThenDelete:y,cancel:A,reset:R}}const z=s=>`${s} ${s===1?"email":"emails"}`;function ds({open:s,accountId:t,folder:a,mailboxes:o,appointments:m,onClose:r}){const[u,l]=c.useState(()=>Q(a.messageCount)),[i,d]=c.useState(),[g,p]=c.useState(),{createFolderIn:v}=ae(t),j=re(),{phase:h,progress:f,errorMessage:O,checkStartedAt:I,deleteMailbox:w,deleteIfEmpty:A,moveThenDelete:y,cancel:R,reset:k}=cs({accountId:t,mailboxId:a.mailboxId,onDeleted:r}),[S,M]=c.useState("0:00"),C=h==="checking"||h==="check-stalled";c.useEffect(()=>{if(!C||I===void 0)return;const F=()=>M(Ae(Date.now()-I));F();const ue=setInterval(F,1e3);return()=>clearInterval(ue)},[C,I]),c.useEffect(()=>{s&&(l(Q(a.messageCount)),d(void 0),k())},[s,k]),c.useEffect(()=>{s&&p(void 0)},[s]),c.useEffect(()=>R,[R]);const x=c.useCallback(()=>{R(),r()},[R,r]),E=c.useCallback(async()=>{const F=await A();F.status==="blocked"&&(d(F.messageCount),l("choose-fate"))},[A]),D=c.useMemo(()=>Ie({mailboxes:o,folderAppointments:m,excludeMailboxId:a.mailboxId,translator:j}),[o,m,a.mailboxId,j]),n=D.find(F=>F.id===g),b=c.useMemo(()=>B(a,ne(m).get(a.mailboxId),j),[a,m,j]);if(!s)return null;const T=`Delete ${b}`,P=i??a.messageCount,me=h==="moving"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(G,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving emails…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:f?V(f):"Moved 0 of 0"})]}):h==="checking"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(G,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Checking the folder on the mail server…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:`Waiting ${S}. Nothing is deleted until the server answers.`})]}):h==="check-stalled"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(L,{tone:"warning",variant:"soft",children:`The mail server hasn't reported back on this folder yet — ${S} so far. Nothing has been deleted.`}),e.jsx("p",{className:"text-xs text-fg-muted",children:"A sync covers the whole account, so a busy mailbox can take a while to come round to this folder."}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"}),e.jsx(N,{size:"sm",onClick:()=>E(),children:"Keep waiting"})]})]}):h==="deleting"||h==="done"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(G,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Deleting folder…"})]}):h==="error"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(L,{tone:"danger",variant:"soft",children:O??"Something went wrong. Please try again."}),f&&e.jsxs("p",{className:"text-xs text-fg-muted",children:[V(f),". Already-moved emails stay moved — re-open delete to continue with the rest."]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Close"})})]}):u==="confirm-empty"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:b}),"? This folder is empty and will be removed from the server."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"}),e.jsx(N,{variant:"danger",size:"sm",icon:e.jsx(q,{className:"size-3.5"}),onClick:()=>E(),children:"Delete folder"})]})]}):u==="choose-fate"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:[i!==void 0&&e.jsx(L,{tone:"warning",variant:"soft",children:`This folder is not empty: the mail server reports ${z(i)} in it. Nothing was deleted.`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:b})," holds"," ",z(P),". What should happen to them?"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{type:"button",onClick:()=>l("confirm-delete-all"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(q,{className:"size-4 shrink-0 text-danger"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Delete them with the folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"The emails are removed from the server and can't be recovered."})]})]}),e.jsxs("button",{type:"button",onClick:()=>l("pick-destination"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(Ee,{className:"size-4 shrink-0 text-accent-2"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Move them to another folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"Keep the emails, then delete the emptied folder."})]})]})]})]}),e.jsx("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"})})]}):u==="confirm-delete-all"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:b})," and its"," ",z(P),"? The messages are removed from the server with the folder and can't be recovered."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:()=>l("choose-fate"),children:"Back"}),e.jsx(N,{variant:"danger",size:"sm",icon:e.jsx(q,{className:"size-3.5"}),onClick:()=>w(),children:"Delete folder and emails"})]})]}):e.jsxs("div",{className:"flex h-[26rem] flex-col",children:[e.jsxs("p",{className:"px-5 pt-4 text-sm text-fg-muted",children:["Move the ",z(P)," in"," ",e.jsx("strong",{className:"text-fg",children:b})," to:"]}),e.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:e.jsx(Y,{folders:D,selectedId:g,delimiter:o[0]?.hierarchyDelimiter??"/",onSelect:p,onCreateFolder:v,onCancel:()=>{p(void 0),l("choose-fate")},labels:{filterPlaceholder:"Move emails to…"}})}),n&&e.jsx("footer",{className:"shrink-0 border-t border-line p-2",children:e.jsx(N,{variant:"danger",onClick:()=>y(n.id),className:"h-11 w-full font-semibold",children:e.jsx("span",{className:"truncate",children:`Move ${z(P)} to ${n.label}`})})})]});return e.jsxs(W,{open:s,onClose:x,title:T,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx(De,{className:"size-4 shrink-0 text-danger"}),e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:T}),e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(X,{className:"size-3.5"}),onClick:x,"aria-label":"Cancel"})]}),me]})}function ms({account:s}){const t=J(),a=s.accountId,o=re(),{data:m,isPending:r,isError:u,error:l,refetch:i}=ie(Pe({path:{accountId:a}})),{createFolderIn:d}=ae(a),g=U({...$e(),onSuccess:()=>{t.invalidateQueries({queryKey:se()})}}),p=U({...ze(),onSuccess:()=>{t.invalidateQueries({queryKey:ee({path:{accountId:a}})})}}),[v,j]=c.useState(),[h,f]=c.useState(),[O,I]=c.useState(""),w=c.useMemo(()=>m?.items??[],[m]),A=c.useMemo(()=>ne(s.folderAppointments),[s.folderAppointments]),y=c.useMemo(()=>w.map(n=>({id:n.mailboxId,label:B(n,A.get(n.mailboxId),o),path:n.fullPath,deleteBlockedReason:Le(n,w,s.folderAppointments).message})),[w,A,o,s.folderAppointments]),R=(n,b)=>{g.mutate({path:{accountId:a,role:Be[n]},body:{mailboxId:b}})},k=(n,b)=>{const T=b.trim();p.mutate({path:{accountId:a,mailboxId:n},body:{displayNameOverride:T===""?null:T}})};if(r)return e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":`Loading folders for ${s.email}`});if(u)return e.jsx(oe,{variant:"inline",title:`Couldn't load folders for ${s.email}`,error:l,onRetry:()=>{i()}});const S=w.map(n=>({mailboxId:n.mailboxId,providerPath:n.fullPath,hierarchyDelimiter:n.hierarchyDelimiter,messageCount:n.messageCount})),M={};for(const n of s.folderAppointments){const b=_e[n.role];b&&(M[b]={mailboxId:n.mailboxId??null,source:n.source,staleFolderPath:n.staleAppointmentPath})}const C={};for(const n of w)n.displayNameOverride&&(C[n.mailboxId]=n.displayNameOverride);const x=n=>w.find(b=>b.mailboxId===n),E=x(h),D=x(v);return e.jsxs("div",{className:"space-y-4",children:[(g.isError||p.isError)&&e.jsx(L,{tone:"danger",variant:"soft",children:qe(g.error)?"That folder is still being created on the mail server — wait for it to finish, then try again.":"Couldn't save that change. Please try again."}),e.jsx(es,{accountEmail:s.email,folders:S,appointments:M,displayNames:C,onAppoint:R,onRename:k}),e.jsxs("section",{className:"space-y-1.5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-fg",children:["Your folders — ",s.email]}),e.jsx("div",{className:"flex h-[28rem] flex-col overflow-hidden rounded-sm border border-line bg-surface",children:e.jsx(Qe,{folders:y,delimiter:w[0]?.hierarchyDelimiter??"/",onCreateFolder:d,onRename:n=>{f(n.id),I(x(n.id)?.displayNameOverride?.trim()??"")},onDelete:n=>j(n.id),labels:{treeAriaLabel:`All folders for ${s.email}`}})})]}),E&&e.jsx(Ve,{open:!0,folderLabel:B(E,A.get(E.mailboxId),o),defaultLabel:B({fullPath:E.fullPath,hierarchyDelimiter:E.hierarchyDelimiter},A.get(E.mailboxId),o),name:O,onNameChange:I,pending:p.isPending,error:p.isError?"Couldn't save that name. Please try again.":void 0,onSubmit:()=>{const n=O.trim();p.mutate({path:{accountId:a,mailboxId:E.mailboxId},body:{displayNameOverride:n===""?null:n}},{onSuccess:()=>f(void 0)})},onClose:()=>f(void 0)}),D&&e.jsx(ds,{open:!0,accountId:a,folder:D,mailboxes:w,appointments:s.folderAppointments,onClose:()=>j(void 0)})]})}function vs(){const s=Oe(),[t,a]=c.useState(!0),{data:o,isPending:m,isError:r,error:u,refetch:l}=ie(Te()),i=d=>{const g=Fe[d];g&&s({to:g})};return e.jsx(Ke,{items:Re,activeId:"folders",title:"Folder roles",description:"Appoint which real folder fills each canonical role, per account.",help:e.jsx(Je,{}),helpOpen:t,onToggleHelp:()=>a(d=>!d),onSelect:i,onBackToMail:()=>{s({to:"/mail"})},children:m?e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):r?e.jsx(oe,{title:"Couldn't load accounts",error:u,onRetry:()=>{l()}}):o.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:o.accounts.map(d=>e.jsx(ms,{account:d},d.accountId))})})}export{vs as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-BMM2gkfY.js";import{M as r}from"./MailboxPane-CBUf4RMT.js";import"./useSearchTokenContext-Dpl3C3yN.js";import"./kbd-B-P9r9YU.js";import"./useMessageBodyContent-DHYriZRr.js";import"./search-scope-DTcpOp3S.js";import"./useRefreshControl-DUEqZD7x.js";import"./circle-check-big-CyS5sZb6.js";import"./search-token-index-BxytxF1H.js";import"./useQueries-B-aYaD8d.js";import"./MailListHeader-BpL0hiB2.js";import"./attachment-file-B4nazean.js";import"./mail-5WLfHo9K.js";import"./avatar-lcZ4TVQd.js";import"./index-znJrox9Y.js";import"./useSignature-D4_HRnT6.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DlyzBdqd.js";import"./format-Dquh5i8-.js";import"./ErrorState-CBV6FtSJ.js";import"./download-CCD9VEcr.js";import"./shield-check-BktB9xgz.js";import"./useFilters-CJkmZ6i7.js";import"./confirm-dialog-BeWZSgTL.js";import"./clock-KiLfjGAs.js";import"./menu-Rr3_qIop.js";import"./MailViewChrome-CNywrIYr.js";import"./NavMenuButton-meKsCAv8.js";import"./useLabels-DL6gxLzs.js";import"./useSemanticSearch-DCoRQGtD.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-D-zZ-Ztc.js";import"./circle-help-DbSK9hyF.js";import"./circle-check-wwq1h3jr.js";function G(){return o.jsx(r.Reading,{})}export{G as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-BMM2gkfY.js";import{F as r}from"./FlaggedPane-Bx8o8jcX.js";import"./useSearchTokenContext-Dpl3C3yN.js";import"./kbd-B-P9r9YU.js";import"./useMessageBodyContent-DHYriZRr.js";import"./search-scope-DTcpOp3S.js";import"./MailListHeader-BpL0hiB2.js";import"./search-token-index-BxytxF1H.js";import"./useQueries-B-aYaD8d.js";import"./attachment-file-B4nazean.js";import"./mail-5WLfHo9K.js";import"./avatar-lcZ4TVQd.js";import"./index-znJrox9Y.js";import"./useSignature-D4_HRnT6.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DlyzBdqd.js";import"./format-Dquh5i8-.js";import"./ErrorState-CBV6FtSJ.js";import"./download-CCD9VEcr.js";import"./shield-check-BktB9xgz.js";import"./useFilters-CJkmZ6i7.js";import"./confirm-dialog-BeWZSgTL.js";import"./clock-KiLfjGAs.js";import"./menu-Rr3_qIop.js";import"./MailViewChrome-CNywrIYr.js";import"./wizard-selection-B1bng5Jq.js";function y(){return o.jsx(r.Reading,{})}export{y as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-BMM2gkfY.js";import{F as r}from"./FlaggedPane-Bx8o8jcX.js";import"./useSearchTokenContext-Dpl3C3yN.js";import"./kbd-B-P9r9YU.js";import"./useMessageBodyContent-DHYriZRr.js";import"./search-scope-DTcpOp3S.js";import"./MailListHeader-BpL0hiB2.js";import"./search-token-index-BxytxF1H.js";import"./useQueries-B-aYaD8d.js";import"./attachment-file-B4nazean.js";import"./mail-5WLfHo9K.js";import"./avatar-lcZ4TVQd.js";import"./index-znJrox9Y.js";import"./useSignature-D4_HRnT6.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DlyzBdqd.js";import"./format-Dquh5i8-.js";import"./ErrorState-CBV6FtSJ.js";import"./download-CCD9VEcr.js";import"./shield-check-BktB9xgz.js";import"./useFilters-CJkmZ6i7.js";import"./confirm-dialog-BeWZSgTL.js";import"./clock-KiLfjGAs.js";import"./menu-Rr3_qIop.js";import"./MailViewChrome-CNywrIYr.js";import"./wizard-selection-B1bng5Jq.js";function w(){return o.jsx(r.Reading,{})}export{w as component};
@@ -1 +0,0 @@
1
- import{j as r}from"./index-BMM2gkfY.js";import{B as o}from"./BriefPane-BH4C3dLA.js";import"./useSearchTokenContext-Dpl3C3yN.js";import"./kbd-B-P9r9YU.js";import"./useMessageBodyContent-DHYriZRr.js";import"./search-scope-DTcpOp3S.js";import"./MailListHeader-BpL0hiB2.js";import"./search-token-index-BxytxF1H.js";import"./useQueries-B-aYaD8d.js";import"./attachment-file-B4nazean.js";import"./mail-5WLfHo9K.js";import"./avatar-lcZ4TVQd.js";import"./index-znJrox9Y.js";import"./useSignature-D4_HRnT6.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DlyzBdqd.js";import"./format-Dquh5i8-.js";import"./ErrorState-CBV6FtSJ.js";import"./download-CCD9VEcr.js";import"./shield-check-BktB9xgz.js";import"./useFilters-CJkmZ6i7.js";import"./confirm-dialog-BeWZSgTL.js";import"./clock-KiLfjGAs.js";import"./menu-Rr3_qIop.js";import"./useRefreshControl-DUEqZD7x.js";import"./circle-check-big-CyS5sZb6.js";import"./useLabels-DL6gxLzs.js";import"./useSemanticSearch-DCoRQGtD.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-B1bng5Jq.js";function C(){return r.jsx(o.Reading,{})}export{C as component};
@@ -1 +0,0 @@
1
- import{j as t,ac as o}from"./index-BMM2gkfY.js";const n=()=>t.jsx(o,{to:"/settings/accounts"});export{n as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-BMM2gkfY.js";import{M as i}from"./MailboxPane-CBUf4RMT.js";import"./useSearchTokenContext-Dpl3C3yN.js";import"./kbd-B-P9r9YU.js";import"./useMessageBodyContent-DHYriZRr.js";import"./search-scope-DTcpOp3S.js";import"./useRefreshControl-DUEqZD7x.js";import"./circle-check-big-CyS5sZb6.js";import"./search-token-index-BxytxF1H.js";import"./useQueries-B-aYaD8d.js";import"./MailListHeader-BpL0hiB2.js";import"./attachment-file-B4nazean.js";import"./mail-5WLfHo9K.js";import"./avatar-lcZ4TVQd.js";import"./index-znJrox9Y.js";import"./useSignature-D4_HRnT6.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DlyzBdqd.js";import"./format-Dquh5i8-.js";import"./ErrorState-CBV6FtSJ.js";import"./download-CCD9VEcr.js";import"./shield-check-BktB9xgz.js";import"./useFilters-CJkmZ6i7.js";import"./confirm-dialog-BeWZSgTL.js";import"./clock-KiLfjGAs.js";import"./menu-Rr3_qIop.js";import"./MailViewChrome-CNywrIYr.js";import"./NavMenuButton-meKsCAv8.js";import"./useLabels-DL6gxLzs.js";import"./useSemanticSearch-DCoRQGtD.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-D-zZ-Ztc.js";import"./circle-help-DbSK9hyF.js";import"./circle-check-wwq1h3jr.js";function H(){return o.jsx(i.Reading,{})}export{H as component};
@@ -1 +0,0 @@
1
- import{j as r}from"./index-BMM2gkfY.js";import{B as o}from"./BriefPane-BH4C3dLA.js";import"./useSearchTokenContext-Dpl3C3yN.js";import"./kbd-B-P9r9YU.js";import"./useMessageBodyContent-DHYriZRr.js";import"./search-scope-DTcpOp3S.js";import"./MailListHeader-BpL0hiB2.js";import"./search-token-index-BxytxF1H.js";import"./useQueries-B-aYaD8d.js";import"./attachment-file-B4nazean.js";import"./mail-5WLfHo9K.js";import"./avatar-lcZ4TVQd.js";import"./index-znJrox9Y.js";import"./useSignature-D4_HRnT6.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DlyzBdqd.js";import"./format-Dquh5i8-.js";import"./ErrorState-CBV6FtSJ.js";import"./download-CCD9VEcr.js";import"./shield-check-BktB9xgz.js";import"./useFilters-CJkmZ6i7.js";import"./confirm-dialog-BeWZSgTL.js";import"./clock-KiLfjGAs.js";import"./menu-Rr3_qIop.js";import"./useRefreshControl-DUEqZD7x.js";import"./circle-check-big-CyS5sZb6.js";import"./useLabels-DL6gxLzs.js";import"./useSemanticSearch-DCoRQGtD.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-B1bng5Jq.js";function D(){return r.jsx(o.Reading,{})}export{D as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-BMM2gkfY.js";import{O as t}from"./OutboxPane-BxAQvF2m.js";import"./useSearchTokenContext-Dpl3C3yN.js";import"./kbd-B-P9r9YU.js";import"./useMessageBodyContent-DHYriZRr.js";import"./search-scope-DTcpOp3S.js";import"./circle-check-big-CyS5sZb6.js";import"./clock-KiLfjGAs.js";import"./row-actions-Bgax_YZA.js";import"./rotate-ccw-CrVofVFV.js";import"./NavMenuButton-meKsCAv8.js";import"./menu-Rr3_qIop.js";import"./format-Dquh5i8-.js";import"./outbox-status-BlKn6P0x.js";import"./search-query-Cr_ZXBCp.js";function c(){return o.jsx(t.Reading,{})}export{c as component};
@@ -1 +0,0 @@
1
- import{j as s,b as t}from"./index-BMM2gkfY.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 +0,0 @@
1
- import{r as f,j as e,aq as h,b7 as y,ap as b,bu as g,B as v,T as N,a1 as C,D as L,a2 as I,aE as D,aI as S,aF as E}from"./index-BMM2gkfY.js";import{C as w}from"./confirm-dialog-BeWZSgTL.js";import{S as $}from"./settings-screen-D0fhHptg.js";import{E as j}from"./ErrorState-CBV6FtSJ.js";import{a as T,b as k,c as R,u as O}from"./useLabels-DL6gxLzs.js";import"./avatar-lcZ4TVQd.js";import"./menu-Rr3_qIop.js";import"./circle-help-DbSK9hyF.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(E,{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}=T(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(w,{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 V(){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($,{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{V as component};
@@ -1 +0,0 @@
1
- import{c as e}from"./index-BMM2gkfY.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 +0,0 @@
1
- import{c as A,r as d,u as Pe,j as e,S as Le,a as ge,b as k,C as te,d as se,e as Ae,f as be,F as Te,g as ze,X as ve,T as Fe,O as De,M as _e,A as Be,h as Ke,I as Qe,i as ye,B as D,k as Ve,l as He,m as z,n as qe,o as U,p as ae,q as $e,s as Ue,t as We,v as je,w as Y,x as Se,y as Ge,z as J,D as Ne,E as Ye,G as Je,H as W,J as Xe,N as E,K as Ze,L as et,P as tt,Q as st,R as at,U as nt,V as rt,W as ot,Y as it,Z as lt,_ as ct,$ as ut,a0 as dt,a1 as mt,a2 as xt,a3 as ht,a4 as ft,a5 as pt}from"./index-BMM2gkfY.js";import{B as gt,S as bt,D as vt,a as yt,b as jt,u as St,i as Nt,t as Ct,s as kt,c as wt,K as It,d as Mt,e as Ce,f as Ot,g as Rt,h as Et,j as Pt}from"./search-token-index-BxytxF1H.js";import{u as X,a as Lt}from"./useMessageBodyContent-DHYriZRr.js";import{P as At}from"./pencil-BJbvhQrw.js";import{c as Tt,s as zt,M as Ft}from"./MailShell-zSsU-lz6.js";import{u as Dt,a as _t,R as Bt,s as Kt,i as Qt,H as Vt,M as Ht}from"./useRefreshControl-DUEqZD7x.js";import{M as qt}from"./menu-Rr3_qIop.js";import{B as ke}from"./bug-DQdIiRjm.js";import{A as $t}from"./avatar-lcZ4TVQd.js";import{u as Ut,a as Wt}from"./index-znJrox9Y.js";import{u as Z}from"./useQueries-B-aYaD8d.js";import{i as Gt}from"./outbox-status-BlKn6P0x.js";import{E as Yt}from"./ErrorState-CBV6FtSJ.js";import{K as ne}from"./kbd-B-P9r9YU.js";import{u as Jt}from"./useDebouncedValue-DlyzBdqd.js";import"./search-scope-DTcpOp3S.js";import"./FullCompose-DQRblSEf.js";import"./confirm-dialog-BeWZSgTL.js";import"./circle-check-big-CyS5sZb6.js";import"./useSignature-D4_HRnT6.js";import"./account-form-helpers-DhckT_PN.js";import"./format-Dquh5i8-.js";const Xt=A("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=A("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=A("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=A("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=A("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]",R="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 k("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors",R,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:k("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:k("text-2xs tabular-nums",n?"text-accent-2":"text-fg-subtle"),children:a})]})}function P({icon:t,label:s,count:a,active:n,dimmed:r,indent:o,navId:c,linkComponent:m,ariaLabel:x,title:u,onClick:b}){const p=ss({active:n,dimmed:r,indent:o}),h=e.jsx(as,{icon:t,label:s,count:a,active:n});return c&&m?m({navId:c,className:p,ariaLabel:x??s,title:u,onClick:b,children:h}):e.jsx("button",{type:"button",onClick:b,className:p,"aria-label":x,title:u,children:h})}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(Qe,{className:"size-4"});case"flagged":return e.jsx(ge,{className:"size-4"});case"drafts":return e.jsx(Ke,{className:"size-4"});case"sent":return e.jsx(be,{className:"size-4"});case"archive":return e.jsx(Be,{className:"size-4"});case"all":return e.jsx(_e,{className:"size-4"});case"junk":return e.jsx(De,{className:"size-4"});case"trash":return e.jsx(Fe,{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:k("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",R),children:[e.jsx(ze,{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:k("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",R),children:e.jsx(ve,{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:k("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-accent transition-colors hover:bg-surface",R),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]=d.useState(()=>ce(le,t.id,!0)),[c,m]=d.useState(()=>ce(ie,t.id,!0)),[x,u]=d.useState(!1),b=()=>{o(l=>{const N=!l;return ue(le,t.id,N),N})},p=()=>{m(l=>{const N=!l;return ue(ie,t.id,N),N})},h=t.mailboxes.filter(oe).sort((l,N)=>re[l.role]-re[N.role]),i=t.mailboxes.filter(l=>!oe(l)),g=x||i.length<=$?i:i.slice(0,$),j=i.length-g.length,y=t.status??"ready",S=y==="ready"&&h.length===0&&i.length===0;return e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",onClick:b,"aria-expanded":r,className:k("flex w-full items-center gap-1.5 px-2 pb-1 text-left transition-colors hover:text-fg",R,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:[y==="loading"&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"Loading…"}),y==="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(Ae,{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"})]}),S&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"No mailboxes"}),y==="ready"&&e.jsxs(e.Fragment,{children:[h.map(l=>e.jsx(P,{navId:l.id,linkComponent:n,icon:ns(l.role),label:l.name,ariaLabel:l.name,title:l.fullPath??l.name,count:l.unseen,active:s===l.id,dimmed:t.muted,onClick:()=>a?.(l.id)},l.id)),t.outboxPending!==void 0&&e.jsx(P,{navId:"outbox",linkComponent:n,icon:e.jsx(be,{className:"size-4"}),label:"Outbox",ariaLabel:"Outbox",count:t.outboxPending>0?t.outboxPending:void 0,active:s==="outbox",dimmed:t.muted,onClick:()=>a?.("outbox")}),i.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:p,"aria-expanded":c,className:k("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",R),children:[c?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:i.length})]}),c&&e.jsxs(e.Fragment,{children:[g.map(l=>e.jsx(P,{navId:l.id,linkComponent:n,icon:e.jsx(Te,{className:"size-4"}),label:l.name,ariaLabel:l.name,title:l.fullPath??l.name,count:l.unseen,active:s===l.id,dimmed:t.muted,onClick:()=>a?.(l.id)},l.id)),(j>0||x)&&i.length>$&&e.jsx("button",{type:"button",onClick:()=>u(l=>!l),className:k("ml-7 flex items-center px-2 py-1 text-2xs font-medium text-accent transition-colors hover:underline",R),children:x?"Show less":`Show all (${i.length})`})]})]})]})]})]})}function ls({accounts:t,selectedNavId:s,briefUnseen:a,onSelectNav:n,variant:r="desktop",linkComponent:o,calendarNav:c="hidden",savedSearches:m=[],saveableQuery:x,onSelectSavedSearch:u,onRemoveSavedSearch:b,onSaveCurrentSearch:p}){const h=d.useRef(null);Pe({containerRef:h,itemSelector:ts});const i=r==="drawer",g=e.jsxs("nav",{ref:i?h:void 0,className:i?"px-2 py-2":"flex-1 overflow-y-auto px-2 py-2","aria-label":"Mailboxes",children:[e.jsx(P,{navId:"brief",linkComponent:o,icon:e.jsx(Le,{className:"size-4"}),label:"Daily brief",ariaLabel:"Daily brief",count:a,active:s==="brief",onClick:()=>n?.("brief")}),c==="shown"&&e.jsx(P,{navId:"calendar",linkComponent:o,icon:e.jsx(Zt,{className:"size-4"}),label:"Calendar",ariaLabel:"Calendar",active:s==="calendar",onClick:()=>n?.("calendar")}),e.jsx(P,{navId:"flagged",linkComponent:o,icon:e.jsx(ge,{className:"size-4"}),label:"Starred",ariaLabel:"Starred",active:s==="flagged",onClick:()=>n?.("flagged")}),e.jsx(os,{savedSearches:m,saveableQuery:x,onSelectSavedSearch:u,onRemoveSavedSearch:b,onSaveCurrentSearch:p}),t.length===0?e.jsx("div",{className:"px-2 py-4 text-center text-sm text-fg-muted",children:"No accounts configured"}):t.map(j=>e.jsx(is,{account:j,selectedNavId:s,onSelectNav:n,linkComponent:o},j.id))]});return i?g:e.jsx("aside",{ref:h,className:"flex h-full w-full flex-col bg-surface-sunken",children:g})}function cs({leading:t,search:s,actions:a,className:n}){return e.jsxs("header",{className:k("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=ye();if(!t)return null;const s=t.showNavPane?!t.navCollapsed:!1;return e.jsx(D,{variant:"ghost",size:"sm",icon:e.jsx(qt,{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:c}){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(D,{variant:"ghost",size:"sm",icon:e.jsx(es,{className:"size-4"}),title:r?`Compose (${r})`:"Compose","aria-label":"Compose",onClick:s}),e.jsx(D,{variant:"ghost",size:"sm",icon:e.jsx(ke,{className:"size-4"}),title:"Report a bug","aria-label":"Report a bug",onClick:a}),e.jsx(D,{variant:"ghost",size:"sm",icon:e.jsx(Ie,{className:"size-4"}),title:"Settings","aria-label":"Settings",onClick:n}),o,c]})})}function xs(){const{pathname:t}=Ve(),s=He({from:"/mail/$mailboxId",shouldThrow:!1});return z(t,"/settings")?"settings":z(t,"/mail/outbox")?"outbox":z(t,"/mail/flagged")?"flagged":z(t,"/mail/brief")?"brief":s?.mailboxId??""}function hs(){const t=qe(),s=U({select:u=>ae(u.location.pathname)}),a=U({select:u=>$e(u.location.search)}),[n,r]=d.useState(a),o=Jt(n,200),[c,m]=d.useState(s);if(c!==s){const u=zt(c,s,a);m(s),u!==void 0&&r(u)}const x=d.useCallback(u=>{m(ae(t.state.location.pathname)),r(u)},[t]);return{searchInput:n,committedQuery:Tt(n,o),viewKey:s,setSearchInput:x}}const fs=()=>{const t=X();return Ue()?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(At,{className:"size-6"})})},Me=({children:t})=>{const{Account:s}=We();return e.jsx(s,{children:t})},ps=({email:t,onSignOut:s})=>{const a=t??"Account";return e.jsxs(vt,{trigger:e.jsx($t,{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"]})]})},gs=()=>e.jsx(Me,{children:({email:t,signOut:s})=>e.jsx(ps,{email:t,onSignOut:s})});function bs({accounts:t}){const{searchInput:s,onSearchChange:a,onSearchClear:n,onSearchClearQuery:r,resultFolderIndex:o}=je(),c=Y(),m=Ut(),x=X(),{scope:u,clearScope:b}=St(t),p=u.kind==="scoped"?[{id:u.chip.id,label:u.chip.label,tone:"scope"}]:void 0,h=d.useMemo(()=>t.map(S=>S.accountId),[t]),{hasNewMail:i}=Dt(),{state:g,errorMessage:j,refresh:y}=_t(h,{onSettled:()=>Nt(c,Ct(o.keys()))});return e.jsx(ms,{search:{value:s,scope:u.kind,chips:p,onChange:a,onClear:n,onClearQuery:r,onRemoveChip:b},onCompose:x,onReportBug:Se,onOpenSettings:()=>m("accounts"),composeShortcut:kt("compose"),refreshControl:e.jsx(Bt,{state:g,onRefresh:y,label:"Refresh all accounts",errorMessage:j,hasUpdate:i(h)}),account:e.jsx(gs,{})})}const ee="remit.savedSearches",vs=25;function _(){try{const t=localStorage.getItem(ee);if(!t)return[];const s=JSON.parse(t);return Array.isArray(s)?s.filter(a=>typeof a=="string"):[]}catch{return[]}}function ys(t){const s=t.trim();if(!s)return _();const a=[s,..._().filter(n=>n!==s)].slice(0,vs);try{localStorage.setItem(ee,JSON.stringify(a))}catch{return a}return a}function js(t){const s=_().filter(a=>a!==t);try{localStorage.setItem(ee,JSON.stringify(s))}catch{return s}return s}const de=t=>/^\d/.test(t),Ss=(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 Ns(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,c)=>Ss(W(o,void 0,a),W(c,void 0,a))),{system:n,labels:r}}function Cs(t,s,a){const n=Xe(s)&&t.unseenCount>0;return{id:t.mailboxId,name:W(t,s,a),unseen:n?t.unseenCount:void 0,role:s,fullPath:t.fullPath}}function me({accounts:t,onMailboxSelect:s,variant:a="desktop"}){const n=Y(),r=wt(),o=xs(),{searchInput:c,onSearchChange:m}=je(),[x,u]=d.useState(_),{t:b}=Ge("mail",{useSuspense:!1}),p=d.useCallback((f,C)=>b(f,{defaultValue:C}),[b]),h=Z({queries:t.map(f=>({...J({path:{accountId:f.accountId}}),staleTime:1/0}))}),{data:i}=Ne(Ye()),g=d.useMemo(()=>(i?.items??[]).filter(f=>Gt(f.status)).length,[i?.items]),j=d.useMemo(()=>t.map((f,C)=>{const v=h[C],I=v?.data?.items??[],w=Je(f.folderAppointments),{system:M,labels:V}=Ns(I,w,p),H=v?.isError?"error":v?.isLoading?"loading":"ready";return{id:f.accountId,label:f.email,email:f.email,muted:!!f.muted,outboxPending:g,status:H,onRetry:()=>v?.refetch(),mailboxes:[...M,...V].map(T=>Cs(T,w.get(T.mailboxId),p))}}),[t,h,g,p]),y=f=>{n.invalidateQueries({queryKey:Ze({path:{mailboxId:f},query:{order:"desc"}})})},S=({navId:f,className:C,ariaLabel:v,title:I,children:w,onClick:M})=>f==="brief"?e.jsx(E,{to:"/mail/brief",search:{q:void 0},activeOptions:{includeSearch:!1},onClick:()=>M?.(),className:C,"aria-label":v,title:I,children:w}):f==="outbox"?e.jsx(E,{to:"/mail/outbox",search:{q:void 0},onClick:()=>M?.(),className:C,"aria-label":v,title:I,children:w}):f==="flagged"?e.jsx(E,{to:"/mail/flagged",search:{q:void 0},onClick:()=>M?.(),className:C,"aria-label":v,title:I,children:w}):f==="settings"?e.jsx(E,{to:"/settings/accounts",onClick:()=>M?.(),className:C,"aria-label":v,title:I,children:w}):e.jsx(E,{to:"/mail/$mailboxId",params:{mailboxId:f},search:{q:void 0},onClick:()=>{y(f),M?.()},className:C,"aria-label":v,title:I,children:w}),l=()=>{m(""),s?.()},N=c.trim(),O=N.length>0&&!x.includes(N)?N:void 0,B=d.useCallback(()=>{O&&u(ys(O))},[O]),K=d.useCallback(f=>{u(js(f))},[]),Q=d.useCallback(f=>{m(f),r(f),s?.()},[m,r,s]);return e.jsx(ls,{accounts:j,selectedNavId:o,onSelectNav:l,linkComponent:S,variant:a,savedSearches:x,saveableQuery:O,onSaveCurrentSearch:B,onSelectSavedSearch:Q,onRemoveSavedSearch:K})}function ks(){return e.jsxs("button",{type:"button",onClick:Se,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg",children:[e.jsx(ke,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Report a bug"})]})}function ws({accounts:t,onMailboxSelect:s}){return ye()?.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(E,{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(ks,{}),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 Is=({isOpen:t,onClose:s})=>(et({id:"shortcuts",open:t,answers:{back:s}}),t?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx(tt,{label:"Dismiss keyboard shortcuts",onDismiss:s,className:"backdrop-blur-sm"}),e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Keyboard shortcuts",className:k("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(ve,{className:"size-5"})})]}),e.jsx("div",{className:"grid gap-x-8 gap-y-6 sm:grid-cols-2",children:It.map(a=>e.jsxs("div",{children:[e.jsx("h3",{className:"mb-3 text-sm font-medium text-fg-muted",children:a.title}),e.jsx("div",{className:"space-y-2",children:a.hints.map(n=>e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("span",{className:"text-sm",children:n.description}),e.jsx("span",{className:"flex shrink-0 items-center gap-1",children:n.keys.map((r,o)=>e.jsxs(d.Fragment,{children:[o>0&&n.keys[0]==="g"&&e.jsx("span",{className:"text-2xs text-fg-subtle",children:"then"}),e.jsx(ne,{children:r})]},r))})]},`${n.action}-${n.keys.join("+")}`))})]},a.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 Ms(t){const s=Z({queries:t.map(a=>({...J({path:{accountId:a.accountId}}),staleTime:1/0}))});return d.useMemo(()=>Mt(s.map(a=>a.data?.items??[])),[s])}const Oe="remit:intelligence-open";function Os(){try{return localStorage.getItem(Oe)!=="closed"}catch{return!0}}function Rs(t){try{localStorage.setItem(Oe,t?"open":"closed")}catch{}}function xe({panels:t,prefersOpen:s,isDesktop:a,hasThread:n,raisedFor:r,openMessage:o}){return r!==null&&r===o?!0:t.length>0?t.includes("intelligence"):a&&n&&s}const Es=()=>{const t=Ce(),s=st(),a=at(),n=s.find(nt),r=Ot(),[o,c]=d.useState(Os),m=r?`${r.threadId}/${r.messageId??""}`:null,[x,u]=d.useState(null),b={panels:s,prefersOpen:o,isDesktop:t==="desktop",hasThread:r!==void 0,openMessage:m},p=xe({...b,raisedFor:x}),h=xe({...b,raisedFor:null}),i=d.useCallback((S,l)=>{a([...S?["intelligence"]:[],...l?[l]:[]])},[a]),g=d.useCallback(S=>{i(h,S)},[h,i]),j=d.useCallback(()=>{if(p&&!h){u(null);return}const S=!p;Rs(S),c(S),u(null),i(S,n)},[h,p,n,i]),y=d.useCallback(()=>{u(m)},[m]);return{openOverlay:n,intelligenceOpen:p,showOverlay:g,toggleIntelligence:j,raiseIntelligence:y}},Ps=t=>t.map(s=>s.data?.items??[]);function Ls(t){const s=Z({queries:t.map(a=>({...J({path:{accountId:a.accountId}}),staleTime:1/0})),combine:Ps});return d.useMemo(()=>rt(t.map((a,n)=>({folderAppointments:a.folderAppointments,mailboxes:s[n]??[]}))),[t,s])}var F={exports:{}},he;function As(){if(he)return F.exports;he=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:c}=n;if(!(typeof c=="number"&&c>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${c}\` (${typeof c})`);const m=[],x=s[Symbol.iterator]();let u=!1,b=!1,p=0,h=0;const i=()=>{if(u)return;const g=x.next(),j=h;if(h++,g.done){b=!0,p===0&&r(m);return}p++,Promise.resolve(g.value).then(y=>a(y,j)).then(y=>{m[j]=y,p--,i()},y=>{u=!0,o(y)})};for(let g=0;g<c&&(i(),!b);g++);});return F.exports=t,F.exports.default=t,F.exports}var Ts=As();const zs=ot(Ts),Fs=900*1e3,Ds=30,_s=(t,s)=>{if(!t)return s;const a=Number.parseInt(t,10);return Number.isFinite(a)&&a>0?a:s},Bs=30*1e3,Ks=t=>Math.max(_s(t,Ds)*1e3,Bs),Re=Ks(dt().mailboxPollIntervalSeconds),L=(t=Date.now(),s=Re)=>Qt(t)?Math.min(Vt,s):s,Qs=5,G=new Set,Vs=(t,s,a=Fs)=>t.filter(n=>{const r=n.lastSyncAt;return r==null?!0:s-r>a}).map(n=>n.accountId),Hs=(t,s,a=Re)=>t-s>=a,qs=(t,s)=>t.filter(a=>!s.has(a)),fe=(t,s)=>{if(G.delete(t),ct(s,{softError:!0},"nobody")){ut(s);return}console.warn("[remit] background mailbox sync failed",{accountId:t,error:s})},pe=(t,s)=>it({path:{accountId:t},throwOnError:!0}).then(()=>{s.invalidateQueries({queryKey:lt({path:{accountId:t}})})}),$s=t=>{const s=Y(),a=d.useRef(t);a.current=t;const n=t.map(r=>r.accountId).join(",");d.useEffect(()=>{const r=Date.now(),c=Vs(a.current,r).filter(m=>!G.has(m));if(c.length!==0)for(const m of c)G.add(m),pe(m,s).catch(x=>{fe(m,x)})},[n,s]),d.useEffect(()=>{let r=Date.now(),o;const c=new Set,m=()=>{r=Date.now();const h=qs(a.current.map(i=>i.accountId),c);for(const i of h)c.add(i);zs(h,i=>pe(i,s).catch(g=>{fe(i,g)}).finally(()=>{c.delete(i)}),{concurrency:Qs})},x=()=>{if(document.visibilityState==="visible"){m(),o=setTimeout(x,L());return}},u=()=>{document.visibilityState==="visible"&&Hs(Date.now(),r,L())&&(o!==void 0&&clearTimeout(o),m(),o=setTimeout(x,L()))},b=()=>{document.visibilityState==="visible"&&(o!==void 0&&clearTimeout(o),r=Date.now(),o=setTimeout(x,L()))};o=setTimeout(x,L()),document.addEventListener("visibilitychange",u);const p=Kt(b);return()=>{o!==void 0&&clearTimeout(o),document.removeEventListener("visibilitychange",u),p()}},[n,s])};function fa(){const t=mt(),s=Ce(),a=Pt(s),{openOverlay:n,intelligenceOpen:r,showOverlay:o,toggleIntelligence:c,raiseIntelligence:m}=Es(),x=n==="shortcuts",u=n==="nav",{searchInput:b,committedQuery:p,viewKey:h,setSearchInput:i}=hs(),{data:g,isLoading:j,isError:y,error:S,refetch:l}=Ne({...xt(),staleTime:1/0}),N=!!(g&&(g.accounts?.length??0)===0);d.useEffect(()=>{N&&t({to:"/onboarding",replace:!0})},[N,t]),Wt({enabled:!x,bindings:[{key:"?",action:"help",handler:()=>o("shortcuts"),noModifiers:!1,preventDefault:!0}]});const O=X(),B=Lt(),K=U({select:q=>ht(q.matches)?.list==="mailbox"}),Q=d.useMemo(()=>({compose:O}),[O]);Rt({enabled:!K&&!B,handlers:Q});const f=d.useCallback(()=>{i("")},[i]),C=d.useCallback(()=>{i("")},[i]),v=g?.accounts??[],I=d.useMemo(()=>v.map(q=>q.accountId),[v]),w=Ms(v),M=Ls(v),V=d.useMemo(()=>Et(v),[v]);$s(v);const H=d.useCallback(()=>{n==="nav"&&o(void 0)},[n,o]),T={accounts:v,mailboxNameIndex:w,accountNameIndex:V,resultFolderIndex:M,searchQuery:p,searchInput:b,searchViewKey:h,onSearchChange:i,onSearchClear:f,onSearchClearQuery:C,intelligenceOpen:r,onToggleIntelligence:c,onRaiseIntelligence:m},Ee={isSinglePane:a,isLoading:j||N,intelligenceOpen:r,nav:e.jsx(ws,{accounts:v,onMailboxSelect:H}),topBar:a?void 0:e.jsx(bs,{accounts:v}),overlay:a?e.jsx(fs,{}):void 0,navOpen:u,onOpenNav:()=>o("nav"),onCloseNav:()=>o(void 0)};return e.jsx(ft.Provider,{value:T,children:e.jsxs(Ht,{accountIds:I,children:[y?e.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:e.jsx(Yt,{title:"Couldn't load your account",error:S,onRetry:()=>{l()}})}):e.jsx(Ft,{chrome:Ee,children:e.jsx(pt,{})}),e.jsx(Is,{isOpen:x,onClose:()=>o(void 0)})]})})}export{fa as component,je as useMailContext};
@@ -1 +0,0 @@
1
- import{c as e}from"./index-BMM2gkfY.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 +0,0 @@
1
- import{a6 as n,a7 as r,w as a,r as i,j as s}from"./index-BMM2gkfY.js";import{O as c}from"./OnboardingWizard-CVgzD3hy.js";import"./kbd-B-P9r9YU.js";import"./account-form-helpers-DhckT_PN.js";import"./mail-5WLfHo9K.js";async function m(e){e.recordCompleted(),await e.queryClient.refetchQueries({queryKey:n()}),e.navigateToInbox()}function C(){const e=r(),o=a(),t=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:t})}export{C as component};
@@ -1 +0,0 @@
1
- import{j as o,a5 as i}from"./index-BMM2gkfY.js";import{a as m}from"./MailShell-zSsU-lz6.js";import{u as p,O as t}from"./OutboxPane-BxAQvF2m.js";import{u as s}from"./search-mirror-Lf1ogSTC.js";import"./FullCompose-DQRblSEf.js";import"./ErrorState-CBV6FtSJ.js";import"./index-znJrox9Y.js";import"./useMessageBodyContent-DHYriZRr.js";import"./useSignature-D4_HRnT6.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DlyzBdqd.js";import"./format-Dquh5i8-.js";import"./confirm-dialog-BeWZSgTL.js";import"./useSearchTokenContext-Dpl3C3yN.js";import"./kbd-B-P9r9YU.js";import"./search-scope-DTcpOp3S.js";import"./circle-check-big-CyS5sZb6.js";import"./clock-KiLfjGAs.js";import"./row-actions-Bgax_YZA.js";import"./rotate-ccw-CrVofVFV.js";import"./NavMenuButton-meKsCAv8.js";import"./menu-Rr3_qIop.js";import"./outbox-status-BlKn6P0x.js";import"./search-query-Cr_ZXBCp.js";function q(){const r=p();return s({to:"/mail/outbox"}),o.jsx(t,{outboxMessageId:r,children:o.jsx(m,{phone:o.jsx(t.Phone,{}),list:o.jsx(t.List,{}),reading:o.jsx(i,{})})})}export{q as component};
@@ -1 +0,0 @@
1
- import{c as t}from"./index-BMM2gkfY.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 +0,0 @@
1
- import{r as e,j as l,B as b,b as y,as as x}from"./index-BMM2gkfY.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 +0,0 @@
1
- import{a1 as v,v as x,o as p,a9 as I,r as g,q as Q}from"./index-BMM2gkfY.js";import{b}from"./MailShell-zSsU-lz6.js";import{a as q}from"./useMessageBodyContent-DHYriZRr.js";function W(o){const t=v(),{searchInput:c,searchQuery:e}=x(),i=p({select:a=>Q(a.location.search)}),u=p({select:a=>a.location.pathname}),h=q(),f=I(),m=h||f,{to:s}=o,r="params"in o?o.params.mailboxId:void 0,l=r?`/mail/${r}`:s;g.useEffect(()=>{if(!b({searchInput:c,committedQuery:e,urlQuery:i,pathname:u,listPath:l}))return;const y=!!e&&i!==e&&!m,n=d=>({...d,q:e||void 0});if(!y){t({to:".",search:n,hash:!0,replace:!0});return}if(s==="/mail/$mailboxId"){if(!r)return;t({to:s,params:{mailboxId:r},search:n,hash:!0,replace:!0});return}t({to:s,search:n,hash:!0,replace:!0})},[c,e,i,t,s,r,l,u,m])}export{W as u};
@@ -1 +0,0 @@
1
- import{c as $,r as c,j as h,g as z,b as k,c7 as V,X as G,c8 as q,c9 as X,ca as Y,cb as J,cc as W,l as x,a1 as L,cd as Z,c0 as w,ce as ee,L as te,K as ne,bO as se,cf as re,y as oe,z as K,G as ae,H as ie,v as ce,bz as F,bA as le,cg as M}from"./index-BMM2gkfY.js";import{a as ue,S as de}from"./search-scope-DTcpOp3S.js";import{u as N}from"./useQueries-B-aYaD8d.js";const Ke=$("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 Ne=$("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"}]]),fe=[{action:"focusNext",keys:["j","k"],label:"navigate"},{action:"muteSender",keys:["m"],label:"mute"},{action:"help",keys:["?"],label:"all shortcuts"}];function Ae(e){return fe.filter(t=>e[t.action]!==void 0)}const pe=[{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 he(e){for(const t of pe){const n=t.hints.find(s=>s.action===e);if(n)return n.keys}}function me(e){const t=he(e);return!t||t.length===0?"":t.length===1?t[0]??"":t[0]==="g"?t.join(" then "):t.join("")}function De(e){const t=me(e);return t===""?"":`(${t})`}function ye({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 ge({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 be(e,t){const n=t-1;return n<=0?null:e<n?e:n-1}const xe=e=>e instanceof HTMLElement?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable:!1,ke=({chips:e=[],onRemoveChip:t,value:n,onChange:s,onClear:o,onClearQuery:r,placeholder:i="Search mail...",globalFocusKey:u=!0,showClearButton:p=!0,size:m="sm",inputId:d,suggest:f,className:b})=>{const O=c.useId(),A=d??O,I=c.useRef(null),D=c.useRef([]),R=r??o,[P,C]=c.useState(null),S=c.useRef(void 0),[Q,B]=c.useState(""),T=e.length>0;c.useEffect(()=>{C(a=>a!==null&&a>=e.length?null:a)},[e.length]),c.useEffect(()=>{const a=S.current;if(a!==void 0){if(S.current=void 0,a===null){I.current?.focus();return}D.current[a]?.focus()}});const j=c.useRef(void 0);c.useEffect(()=>{const a=f?.caret;if(!a||a===j.current)return;j.current=a;const l=I.current;!l||l.ownerDocument.activeElement!==l||(l.setSelectionRange(a.cursor,a.cursor),f?.onCaretChange(a.cursor))});const v=a=>{f?.onCaretChange(a.selectionStart??a.value.length)},y=c.useCallback(a=>{C(a),S.current=a},[]),E=c.useCallback(a=>{const l=e[a];l&&t&&(y(be(a,e.length)),B(`${l.label} removed`),t(l.id))},[e,t,y]),H=c.useCallback(()=>{y(null),o()},[o,y]),_=c.useCallback(a=>{const l=a.currentTarget;if(f?.onKeyDown(a))return;const g=ye({key:a.key,shiftKey:a.shiftKey,repeat:a.repeat,caretAtStart:l.selectionStart===0&&l.selectionEnd===0,hasValue:n.length>0,chipCount:e.length});switch(g.type){case"focusChip":a.preventDefault(),y(g.index);return;case"clearQuery":R();return;case"blur":l.blur();return;case"none":return}},[e.length,n,R,y,f]),U=c.useCallback(a=>l=>{const g=ge({key:l.key,repeat:l.repeat,index:a,chipCount:e.length});switch(g.type!=="none"&&l.preventDefault(),g.type){case"removeChip":E(g.index);return;case"focusChip":y(g.index);return;case"focusInput":y(null);return;case"activateChip":return;case"none":return}},[e,E,y]);return c.useEffect(()=>{if(!u)return;const a=l=>{l.key!=="/"||l.metaKey||l.ctrlKey||l.altKey||xe(l.target)||q("focusSearch")||(l.preventDefault(),I.current?.focus())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[u]),h.jsxs("label",{htmlFor:A,className:k("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",b),children:[h.jsx(z,{className:k("shrink-0 text-fg-muted pointer-events-none",m==="lg"?"size-5":"size-4")}),h.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:[T&&h.jsx("div",{role:"grid","aria-label":"Search filters",className:"flex min-w-0 flex-wrap items-center gap-1",children:e.map((a,l)=>h.jsx(V,{ref:g=>{D.current[l]=g},label:a.label,tone:a.tone,focused:P===l,onFocusLabel:()=>C(l),onKeyDown:U(l),onRemove:()=>E(l)},a.id))}),h.jsx("input",{ref:I,id:A,name:"q",type:"text","aria-label":"Search mail",autoComplete:"off",value:n,tabIndex:P===null?0:-1,onChange:a=>{s(a.target.value),v(a.target)},onKeyDown:_,onKeyUp:a=>v(a.currentTarget),onClick:a=>v(a.currentTarget),onFocus:a=>{C(null),f?.onFocusChange?.(!0),v(a.currentTarget)},onBlur:()=>f?.onFocusChange?.(!1),...f?.comboboxProps,placeholder:T?void 0:i,className:"min-w-24 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-muted"})]}),(n||T)&&p&&h.jsx("button",{type:"button",onClick:H,className:"shrink-0 rounded p-0.5 hover:bg-surface-raised transition-colors","aria-label":"Clear search",children:h.jsx(G,{className:k("text-fg-muted",m==="lg"?"size-5":"size-4")})}),h.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:Q})]})},Re=({value:e,onChange:t,onClear:n,onClearQuery:s,chips:o,onRemoveChip:r,placeholder:i="Search mail...",globalFocusKey:u=!0,showClearButton:p=!0,size:m,inputId:d,suggest:f,className:b})=>h.jsx(ke,{value:e,onChange:t,onClear:n,onClearQuery:s,chips:o,onRemoveChip:r,placeholder:i,globalFocusKey:u,showClearButton:p,size:m,inputId:d,suggest:f,className:b});function Pe({handlers:e,enabled:t=!0,target:n,sequenceTimeoutMs:s=1e3}){const o=c.useRef(e);o.current=e;const r=c.useRef(null),i=c.useRef(null);c.useEffect(()=>{if(!t)return;const u=()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)},p=d=>{const f=X({key:d.key,shiftKey:d.shiftKey,metaKey:d.metaKey,ctrlKey:d.ctrlKey,altKey:d.altKey,inEditable:J(d.target),onControl:Y(d.target)},r.current);if(W().length>0){u(),r.current=null;return}if(u(),r.current=f.nextPrefix,f.nextPrefix!==null&&(i.current=setTimeout(()=>{r.current=null,i.current=null},s)),f.action===null||q(f.action)!==null)return;const b=o.current[f.action];b&&(f.preventDefault&&d.preventDefault(),b())},m=n===void 0?window:n;if(m!==null)return m.addEventListener("keydown",p),()=>{m.removeEventListener("keydown",p),u(),r.current=null}},[t,s,n])}function je(){const e=x({from:"/mail/brief/$threadId",shouldThrow:!1}),t=x({from:"/mail/brief/$threadId/$messageId",shouldThrow:!1}),n=x({from:"/mail/flagged/$threadId",shouldThrow:!1}),s=x({from:"/mail/flagged/$threadId/$messageId",shouldThrow:!1}),o=x({from:"/mail/$mailboxId/$threadId",shouldThrow:!1}),r=x({from:"/mail/$mailboxId/$threadId/$messageId",shouldThrow:!1}),i=e?.threadId??n?.threadId??o?.threadId,u=t?.messageId??s?.messageId??r?.messageId;return c.useMemo(()=>i?{threadId:i,messageId:u}:void 0,[i,u])}function Fe(){const e=L(),t=Z(),{list:n,mailboxId:s}=w();return c.useCallback((o,r)=>{const i=r?.query,p={search:d=>i===void 0?d:{...d,q:i||void 0},hash:t,replace:r?.replace??!1};if(n==="flagged"){e({to:"/mail/flagged/$threadId/$messageId",params:o,...p});return}const m=r?.mailboxId??s;if(n==="mailbox"&&m){e({to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:m,...o},...p});return}e({to:"/mail/brief/$threadId/$messageId",params:o,...p})},[e,t,n,s])}function $e(){return ee()}function we(){const e=L();return c.useCallback(t=>{e({to:"/mail/brief",search:{q:t||void 0}})},[e])}function qe(){const e=L();return c.useCallback((t,n)=>{e({to:"/mail/$mailboxId",params:{mailboxId:t},search:{q:n||void 0}})},[e])}const Oe=({trigger:e,children:t,align:n="right"})=>{const[s,o]=c.useState(!1),r=c.useRef(null),i=c.useCallback(u=>{r.current&&!r.current.contains(u.target)&&o(!1)},[]);return te({id:"dropdown-menu",open:s,answers:{back:()=>o(!1)}}),c.useEffect(()=>(s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)),[s,i]),h.jsxs("div",{ref:r,className:"relative",children:[h.jsx("button",{type:"button",onClick:u=>{u.stopPropagation(),o(!s)},className:k("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&&h.jsx("div",{className:k("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})]})},Qe=({onClick:e,disabled:t,destructive:n,children:s})=>h.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t||e()},disabled:t,className:k("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}),Be=()=>h.jsx("div",{className:"my-1 h-px bg-line"}),Ie=e=>typeof e=="object"&&e!==null&&Array.isArray(e.pages),Ce=e=>typeof e=="object"&&e!==null&&Array.isArray(e.items),ve=(e,t)=>e===void 0?e:Ie(e)?{...e,pages:e.pages.map(n=>({...n,items:t(n.items)}))}:Ce(e)?{...e,items:t(e.items)}:e,He=e=>{const t=[];for(const n of new Set(e))t.push(ne({path:{mailboxId:n}})),t.push(se({path:{mailboxId:n}}));return t.push(re()),t},_e=(e,t)=>Promise.all(t.map(n=>e.cancelQueries({queryKey:n}))),Ue=(e,t)=>t.flatMap(n=>e.getQueriesData({queryKey:n})).filter(n=>n[1]!==void 0).map(([n,s])=>({queryKey:n,data:s})),ze=(e,t,n)=>{const s=o=>ve(o,n);for(const o of t)e.setQueriesData({queryKey:o},s)},Ve=(e,t)=>{for(const n of t)e.setQueryData(n.queryKey,n.data)},Ge=(e,t)=>{for(const n of t)e.invalidateQueries({queryKey:n})},Se=({accounts:e})=>{const{list:t,mailboxId:n}=w(),{t:s}=oe("mail",{useSuspense:!1}),o=c.useCallback((i,u)=>s(i,{defaultValue:u}),[s]),r=N({queries:e.map(i=>({...K({path:{accountId:i.accountId}}),staleTime:1/0}))});if(t==="outbox")return"Outbox";if(!n)return null;for(let i=0;i<e.length;i++){const u=r[i]?.data?.items;if(!u)continue;const p=u.find(d=>d.mailboxId===n);if(!p)continue;const m=ae(e[i].folderAppointments);return ie(p,m.get(n),o)}return null},Xe=({accounts:e})=>{const{mailboxId:t}=w(),n=N({queries:e.map(s=>({...K({path:{accountId:s.accountId}}),staleTime:1/0}))});if(!t)return null;for(const s of n){const o=s.data?.items;if(!o)continue;const r=o.find(i=>i.mailboxId===t);if(r)return r.unseenCount}return null},Ye=({accounts:e})=>{const{mailboxId:t}=w(),n=N({queries:e.map(s=>({...K({path:{accountId:s.accountId}}),staleTime:1/0}))});if(!t)return 0;for(const s of n){const o=s.data?.items;if(!o)continue;const r=o.find(i=>i.mailboxId===t);if(r)return r.messageCount}return 0};function Je(e){const t=we(),{searchInput:n}=ce(),s=Se({accounts:e}),o=w(),r=ue(o,s),i=c.useCallback(u=>{u===de&&t(n)},[t,n]);return{scope:r,clearScope:i}}const Te=768,We=e=>e!=="desktop",Ze=()=>{const e=F(`(min-width: ${Te}px)`);return F(le)?"desktop":e?"tablet":"phone"};function et(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 tt(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=M(s).toLowerCase();t.has(o)||t.set(o,s.mailboxId),t.has(r)||t.set(r,s.mailboxId)}return t}function nt(e,t=[]){const n=e.flat().filter(r=>r.fullPath),s=new Map;for(const r of n){const i=M(r).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=M(r),u=s.get(i.toLowerCase())===1,p=t.length>1?o.get(r.accountId):void 0;return{value:u?i:r.fullPath,label:r.displayNameOverride?.trim()||i,...p?{hint:p}:{}}})}function st(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{Ce as A,Ke as B,De as C,Oe as D,nt as E,st as F,Ae as G,pe as K,Ne as R,Re as S,Be as a,Qe as b,we as c,tt as d,Ze as e,je as f,Pe as g,et as h,Ge as i,We as j,Fe as k,$e as l,Se as m,Xe as n,Ye as o,qe as p,fe as q,Ve as r,me as s,He as t,Je as u,_e as v,Ue as w,ze as x,ve as y,Ie as z};
@@ -1 +0,0 @@
1
- import{j as e,b as S,a1 as L,r as c,aE as O,aq as T,g as $,aI as q,D as I,bv as A,w as C,ak as k,bw as M,bx as P,B as N,a as R,by as G,X as Q}from"./index-BMM2gkfY.js";import{K as f}from"./kbd-B-P9r9YU.js";import{S as B,a as E}from"./settings-screen-D0fhHptg.js";import{E as V}from"./ErrorState-CBV6FtSJ.js";import{u as D}from"./useDebouncedValue-DlyzBdqd.js";import{a as K}from"./format-Dquh5i8-.js";import{s as _}from"./help-copy-DryiNLYs.js";import"./avatar-lcZ4TVQd.js";import"./menu-Rr3_qIop.js";import"./circle-help-DbSK9hyF.js";function F({options:t,active:r,onSelect:m}){return e.jsx("div",{role:"tablist",className:S("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(n=>{const d=n.id===r;return e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>m(n.id),className:S("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:n.label}),e.jsx("span",{className:S("text-2xs tabular-nums",d?"text-accent-2":"text-fg-subtle"),children:n.count??"—"})]},n.id)})})}const v={vip:"VIPs",muted:"Muted",blocked:"Blocked"};function H({query:t,onCount:r}){const{data:m,isPending:n,isError:d,error:b}=I(A()),g=C(),i=k({...P(),onSettled:()=>{g.invalidateQueries({queryKey:M()})}}),l=m?.suggestions??[],p=t.trim().toLowerCase(),u=p?l.filter(a=>(a.displayName??"").toLowerCase().includes(p)||a.normalizedEmail.toLowerCase().includes(p)):l;return c.useEffect(()=>{r?.(u.length,l.length)},[r,u.length,l.length]),n?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(f,{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(a=>e.jsx(E,{name:a.displayName??a.normalizedEmail,email:a.normalizedEmail,meta:a.replyCount>0?`${a.inboundCount} received · you replied ${a.replyCount}×`:`${a.inboundCount} received · you've never replied`,trailing:e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(R,{className:"size-3.5"}),"aria-busy":i.isPending,onClick:()=>{i.isPending||i.mutate({path:{addressId:a.addressId},body:{flags:{vip:{value:!0,setAt:Date.now(),setBy:"user"}}}})},children:"Add VIP"})},a.addressId))]})}function U({group:t,query:r,onCount:m}){const n=D(r.trim(),300),d=C(),[b,g]=c.useState(null),i=n.length>=2,l=G({query:{q:n,limit:50}}),{data:p,isPending:u,isError:a,error:j}=I({...l,enabled:i}),x=k({...P(),onSuccess:()=>{d.invalidateQueries({queryKey:l.queryKey})}}),h=(p?.items??[]).filter(s=>t==="muted"?s.flags?.muted?.value??!1:s.flags?.blocked?.value??!1);return c.useEffect(()=>{m?.(i?h.length:0,null)},[m,i,h.length]),i?u?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Searching…"}):a?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Search failed",error:j})}):h.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No ",v[t].toLowerCase()," senders matching “",n,"”."]}):e.jsx(e.Fragment,{children:h.map(s=>{const o=t==="muted"?s.flags?.muted:s.flags?.blocked,y=o?[`${t}`,o.setAt&&K(o.setAt,{month:"short",year:"numeric"})||null,o.reason?`— ${o.reason}`:null].filter(Boolean).join(" "):t,w=x.isPending&&x.variables?.path.addressId===s.addressId,z=x.isError&&b===s.addressId;return e.jsx(E,{name:s.displayName??s.normalizedEmail,email:s.normalizedEmail,danger:t==="blocked",meta:y,trailing:z?e.jsx(N,{variant:"secondary",size:"sm",onClick:()=>{g(s.addressId),x.mutate({path:{addressId:s.addressId},body:{flags:{[t]:null}}})},children:"Retry"}):e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(Q,{className:"size-3.5"}),"aria-busy":w,"aria-label":`Remove ${t} flag`,onClick:()=>{w||(g(s.addressId),x.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(f,{children:"m"})," on any message to mute its sender; ",e.jsx(f,{children:"b"})," to block."]})]})}function re(){const t=L(),[r,m]=c.useState("vip"),[n,d]=c.useState(""),[b,g]=c.useState(!0),[i,l]=c.useState(0),[p,u]=c.useState({vip:0,muted:null,blocked:null}),a=c.useCallback((s,o)=>{l(s),u(y=>({...y,vip:o}))},[]),j=c.useCallback((s,o)=>{l(s),u(y=>({...y,[r]:s}))},[r]),x=p[r],h=s=>{const o=q[s];o&&t({to:o})};return e.jsx(B,{items:O,activeId:"senders",title:"Senders & Rules",description:"Per-sender preferences — set with one key from any message, managed here.",flush:!0,help:_,helpOpen:b,onToggleHelp:()=>g(s=>!s),onSelect:h,onBackToMail:()=>{t({to:"/mail"})},children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col lg:flex-row",children:[e.jsx(F,{active:r,onSelect:s=>{m(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(T,{icon:e.jsx($,{className:"size-4"}),placeholder:`Filter ${v[r].toLowerCase()} by name or address`,className:"h-8 max-w-sm",value:n,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:n,onCount:a}):e.jsx(U,{group:r,query:n,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:x!=null?`${i} of ${x} flagged senders`:`${i} flagged senders`}),e.jsxs("span",{children:[e.jsx(f,{children:"j"})," ",e.jsx(f,{children:"k"})," navigate · ",e.jsx(f,{children:"⌫"})," remove flag"]})]})]})]})})}export{re as component};
@@ -1 +0,0 @@
1
- import{j as t,a5 as o}from"./index-BMM2gkfY.js";const n=()=>t.jsx(o,{});export{n as component};
@@ -1 +0,0 @@
1
- import{c as z,r as j,j as e,b as f,B as i,X as N,aG as S}from"./index-BMM2gkfY.js";import{A as w}from"./avatar-lcZ4TVQd.js";import{M as B}from"./menu-Rr3_qIop.js";import{C as v}from"./circle-help-DbSK9hyF.js";const h=z("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);function F({items:l,activeId:t,title:c,description:n,children:r,help:s,helpOpen:d=!0,flush:o,onSelect:k,onToggleHelp:u,onBackToMail:m}){const[y,x]=j.useState(!1),[b,C]=j.useState(!1),p=!!s&&d,g=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 pt-3 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Settings"}),e.jsx("nav",{className:"flex-1 overflow-y-auto px-2 py-1",children:l.map(a=>e.jsxs("button",{type:"button",onClick:()=>{k?.(a.id),x(!1)},className:f("flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors lg:min-h-0",a.id===t?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg"),children:[a.icon&&e.jsx("span",{className:f("shrink-0",a.id===t?"text-accent-2":"text-fg-subtle"),children:a.icon}),a.label]},a.id))})]});return e.jsxs("div",{className:"safe-area-frame flex h-dvh w-full overflow-hidden bg-canvas font-sans text-fg",children:[e.jsxs("aside",{className:"hidden w-60 shrink-0 flex-col border-r border-line bg-surface-sunken lg:flex",children:[e.jsx("div",{className:"flex h-pane-header shrink-0 items-center border-b border-line px-2",children:e.jsxs("button",{type:"button",onClick:m,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-fg-muted hover:bg-surface hover:text-fg",children:[e.jsx(h,{className:"size-4 text-fg-subtle"}),"Back to mail"]})}),g]}),y&&e.jsxs("div",{className:"fixed inset-0 z-50 flex lg:hidden",children:[e.jsx("button",{type:"button","aria-label":"Close menu",className:"absolute inset-0 bg-canvas/60",onClick:()=>x(!1)}),e.jsxs("aside",{className:"safe-area-frame relative flex w-72 max-w-[85%] flex-col border-r border-line bg-surface-sunken",children:[e.jsxs("div",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-2",children:[e.jsxs("button",{type:"button",onClick:()=>{m?.(),x(!1)},className:"flex items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-fg-muted hover:bg-surface hover:text-fg",children:[e.jsx(h,{className:"size-4 text-fg-subtle"}),"Back to mail"]}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-4"}),onClick:()=>x(!1),"aria-label":"Close menu"})]}),g]})]}),e.jsxs("main",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-3 border-b border-line px-3 lg:px-5",children:[m&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(h,{className:"size-4"}),className:"-ml-1 lg:hidden",onClick:m,"aria-label":"Back to mail"}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(B,{className:"size-4"}),className:"lg:hidden",onClick:()=>x(!0),"aria-label":"Open settings menu"}),e.jsx("h1",{className:"text-md font-semibold text-fg",children:c}),n&&e.jsx("p",{className:"hidden min-w-0 truncate text-xs text-fg-subtle lg:block",children:n}),s&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(v,{className:"size-4"}),className:"ml-auto lg:hidden",onClick:()=>C(a=>!a),"aria-label":"Tips","aria-expanded":b}),s&&!p&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(v,{className:"size-4"}),className:"hidden ml-auto lg:inline-flex",onClick:u,"aria-label":"Show tips"})]}),s&&b&&e.jsx("div",{className:"border-b border-line bg-surface-sunken px-row-inset py-3 text-xs leading-relaxed text-fg-muted lg:hidden",children:s}),o?e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:r}):e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx("div",{className:"max-w-2xl px-3 py-5 lg:px-5",children:e.jsx("div",{className:"space-y-5",children:r})})})]}),p&&e.jsxs("aside",{className:"hidden w-64 shrink-0 flex-col border-l border-line bg-surface-sunken lg:flex",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-row-inset",children:[e.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Tips & tricks"}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-3.5"}),onClick:u,"aria-label":"Collapse tips"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-row-inset py-3 text-xs leading-relaxed text-fg-muted",children:s})]})]})}function R({name:l,email:t,meta:c,caption:n,danger:r,trailing:s}){return e.jsxs("div",{className:"flex items-center gap-3 px-row-inset py-2 hover:bg-surface-sunken",children:[e.jsx("span",{className:f(r&&"rounded-full ring-2 ring-danger/40"),children:e.jsx(w,{name:l,email:t,size:"sm"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-col gap-0 sm:flex-row sm:items-baseline sm:gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium text-fg",children:l}),e.jsx("span",{className:"truncate text-2xs text-fg-subtle",children:t})]}),e.jsxs("div",{className:"text-xs text-fg-subtle",children:[c,n&&e.jsxs("span",{className:"text-fg-muted",children:[" · ",n]})]})]}),s&&e.jsx("div",{className:"shrink-0",children:s})]})}const O={healthy:{tone:"positive",label:"healthy"},error:{tone:"danger",label:"error"},muted:{tone:"neutral",label:"muted"}};function G({label:l,email:t,connector:c,syncLabel:n,state:r,errorDetail:s,trailing:d}){const o=O[r];return e.jsxs("div",{className:f("rounded-sm border border-line bg-surface",r==="muted"&&"opacity-65"),children:[e.jsxs("div",{className:"flex flex-col gap-3 px-row-inset py-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx(w,{name:l,email:t,size:"md"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-fg",children:l}),e.jsx(S,{tone:o.tone,dot:!0,children:o.label})]}),e.jsxs("div",{className:"truncate text-xs text-fg-subtle",children:[t," · ",c," · ",n]})]})]}),d&&e.jsx("div",{className:"shrink-0",children:d})]}),s&&e.jsx("div",{className:"border-t border-line px-row-inset py-2",children:e.jsx("code",{className:"block rounded-xs bg-danger-soft px-2 py-1 text-2xs text-danger",children:s})})]})}export{G as A,F as S,R as a};
@@ -1 +0,0 @@
1
- import{c as e}from"./index-BMM2gkfY.js";const c=e("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);export{c as S};
@@ -1 +0,0 @@
1
- import{r as m,ak as b,dN as E,D as C,dO as x,dw as D,dP as F,w as O,dQ as N,dR as P,dS as L,dT as w}from"./index-BMM2gkfY.js";const B=(e,t)=>{if(e.state==="Expired")return"Expired";if(e.scope!=="Temporary"||!e.expiresAt)return"Active";const r=Date.parse(e.expiresAt);return Number.isNaN(r)?"Active":r<=t?"Expired":"Active"},K=e=>{if(!e)return;const t=Date.parse(e);if(!Number.isNaN(t))return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})},M=(e,t=new Date)=>{if(!e)return;const r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!r)return;const[,a,i,n]=r,s=new Date(Number(a),Number(i)-1,Number(n),23,59,59,0);if(Number.isNaN(s.getTime()))return;const o=-t.getTimezoneOffset(),d=o>=0?"+":"-",l=Math.abs(o),c=String(Math.floor(l/60)).padStart(2,"0"),f=String(l%60).padStart(2,"0"),u=p=>String(p).padStart(2,"0");return`${s.getFullYear()}-${u(s.getMonth()+1)}-${u(s.getDate())}T${u(s.getHours())}:${u(s.getMinutes())}:${u(s.getSeconds())}${d}${c}:${f}`},h="None",V=e=>!e.literalClauses.some(t=>t.field==="HasWords"),y=e=>({...e.anchorMessageId?{anchorMessageId:e.anchorMessageId}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h}),G=({mode:e,ruleScope:t})=>t==="standing"?"standing":t==="until"?"temporary":e==="selected"?"just-these":"all-like-these",X=({mode:e,ruleScope:t,anchorMessageId:r,clauses:a,matchOperator:i,moveMailboxId:n,until:s})=>({...e==="similar"&&r?{anchorMessageId:r}:{},matchOperator:i==="all"?"And":"Or",literalClauses:a.map(o=>({field:o.field,value:o.value})),moveMailboxId:n,expiresAt:t==="until"?M(s??""):void 0}),S=(e,t,r)=>({name:r,scope:t==="standing"?"Standing":"Temporary",...t==="temporary"&&e.expiresAt?{expiresAt:e.expiresAt}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h,...e.anchorMessageId?{anchorMessageId:e.anchorMessageId}:{}}),z=new Set(["Complete","Failed"]),v=e=>e!==void 0&&z.has(e),T=1e3,k=15e3,J=e=>{const t=Math.max(0,e),r=T*2**t;return Math.min(r,k)},R=(e,t,r)=>{if(e)return{kind:r?"restartFailed":"startFailed",error:e};if(t)return{kind:"statusUnreadable",error:t}},Y=e=>{const[t,r]=m.useState(),a=b({...E(),onSuccess:g=>r(g.organizeJobId)}),{mutate:i}=a,n=C({...x({path:{accountId:e??"",organizeJobId:t??""}}),enabled:!!e&&!!t,refetchInterval:g=>{const I=g.state.data?.state;return v(I)?!1:J(g.state.dataUpdateCount)}}),s=m.useCallback(g=>{e&&i({path:{accountId:e},body:y(g)})},[e,i]),{refetch:o}=n,d=m.useCallback(()=>{o()},[o]),l=n.data,c=a.isPending?void 0:l,f=c?.state??a.data?.state,u=v(c?.state),p={state:f,matchedCount:c?.matchedCount??0,appliedCount:c?.appliedCount??0,failedCount:c?.failedCount??0,errorMessage:c?.errorMessage??""};return{start:s,refreshStatus:d,progress:p,isStarting:a.isPending,isRunning:!!t&&!u,isDone:u,failure:R(a.error,n.error,!!l)}},Z=["From","Subject","HasWords","ListId","FromDomain"],_=e=>{const t=e.trim(),r=t.match(/<([^>]+)>/);return(r?r[1]:t).trim().toLowerCase()},ee=(e,t)=>e==="ListId"?_(t):t.trim(),$=e=>e==="all"?"And":"Or",Q=(e,t)=>{const r=e.widen!==void 0&&!e.widen.inactive,a=e.clauses.map(i=>({field:i.field,value:i.value}));return{...r&&t?{anchorMessageId:t}:{},matchOperator:$(e.matchOperator),literalClauses:a}},U=e=>e.anchorMessageId!==void 0||!e.literalClauses.some(t=>t.field==="HasWords"),j=e=>JSON.stringify({anchor:e.anchorMessageId??null,operator:e.matchOperator,clauses:e.literalClauses.map(t=>`${t.field} ${t.value}`)}),te=(e,t)=>{const r=Q(e,t);return{...r.anchorMessageId?{anchorMessageId:r.anchorMessageId}:{},matchOperator:r.matchOperator,literalClauses:r.literalClauses,moveMailboxId:e.moveMailboxId,labelId:e.labelId,expiresAt:e.scope==="until"?M(e.until??""):void 0}},q=(e,t)=>e.error!==void 0&&e.errorSignature===t?{status:"error",reason:e.error}:e.count===void 0?{status:"loading"}:e.previewedSignature===t?{status:"ready",count:e.count}:{status:"ready",count:e.count,stale:!0},H=350,re=(e,t,r)=>{const a=b(D()),{mutateAsync:i}=a,n=j(t),[s,o]=m.useState(()=>({})),d=m.useRef(t);d.current=t;const l=m.useRef(n),c=U(t);return m.useEffect(()=>{if(!e||!c||n===s.previewedSignature||n===s.errorSignature)return;const f=setTimeout(()=>{const u=n;l.current=u,i({path:{accountId:e},body:y({...d.current})}).then(p=>{l.current===u&&o({count:p.matchedCount,matchedIds:p.messageIds,previewedSignature:u})}).catch(p=>{l.current===u&&o(g=>({...g,error:p instanceof Error?p.message:"Couldn't count matches.",errorSignature:u}))})},H);return()=>clearTimeout(f)},[e,c,n,s.previewedSignature,s.errorSignature,i]),c?{count:q(s,n),matchedIds:s.previewedSignature===n?s.matchedIds??[]:[]}:{count:{status:"error",reason:F},matchedIds:[]}},A=e=>P({path:{accountId:e}}),se=e=>{const t=C({...L({path:{accountId:e??""}}),enabled:!!e});return{filters:t.data?.items??[],isPending:t.isPending,isError:t.isError,error:t.error,refetch:t.refetch}},ae=e=>{const t=O(),r=b({...N(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:A(e)})}}),{mutate:a,mutateAsync:i}=r,n=m.useCallback((o,d,l)=>{e&&a({path:{accountId:e},body:S(o,d,l)})},[e,a]),s=m.useCallback(async(o,d,l)=>e?i({path:{accountId:e},body:S(o,d,l)}).then(()=>!0,()=>!1):!1,[e,i]);return{createFilter:n,createFilterAsync:s,isPending:r.isPending,isSuccess:r.isSuccess,isError:r.isError,error:r.error,reset:r.reset}},ne=e=>{const t=O(),r=b({...w(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:A(e)})}}),{mutate:a}=r;return{deleteFilter:m.useCallback(n=>{e&&a({path:{accountId:e,filterId:n}})},[e,a]),isPending:r.isPending,deletingFilterId:r.isPending?r.variables?.path.filterId:void 0}};export{h as N,Z as S,Y as a,A as b,te as c,K as d,se as e,B as f,ne as g,y as h,ae as i,X as j,V as k,ee as n,G as o,M as p,Q as r,re as u};
@@ -1 +0,0 @@
1
- import{D as L,c2 as p,w as n,ak as l,c3 as d,r as o,c4 as c,c5 as y,c6 as g}from"./index-BMM2gkfY.js";const u=e=>c({path:{accountId:e}}),f=e=>{const r=L({...p({path:{accountId:e??""}}),enabled:!!e});return{labels:r.data?.items??[],isPending:r.isPending,isError:r.isError,error:r.error,refetch:r.refetch}},m=e=>{const r=n(),t=l({...d(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutateAsync:s}=t;return{createLabel:o.useCallback((a,i="Default")=>e?s({path:{accountId:e},body:{name:a,color:i}}):Promise.reject(new Error("No account")),[e,s]),isPending:t.isPending,isError:t.isError,error:t.error,reset:t.reset}},h=e=>{const r=n(),t=l({...y(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutate:s}=t;return{updateLabel:o.useCallback((a,i)=>{e&&s({path:{accountId:e,labelId:a},body:i})},[e,s]),isPending:t.isPending,updatingLabelId:t.isPending?t.variables?.path.labelId:void 0}},C=e=>{const r=n(),t=l({...g(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutate:s}=t;return{deleteLabel:o.useCallback(a=>{e&&s({path:{accountId:e,labelId:a}})},[e,s]),isPending:t.isPending,deletingLabelId:t.isPending?t.variables?.path.labelId:void 0}};export{f as a,h as b,C as c,m as u};
@@ -1 +0,0 @@
1
- import{cC as Q,cD as y,cE as w,cF as S,cG as C,w as k,cH as M,cI as q,r as p,cJ as x,cK as H,cL as L,cM as P,cN as v,cO as B,cP as A}from"./index-BMM2gkfY.js";function R(r,e){const s=new Set(e);return r.filter(t=>!s.has(t))}function I(r,e,s){const t=r.slice(0);return t[e]=s,t}var T=class extends Q{#i;#e;#n;#r;#s;#t;#o;#u;#h;#c=[];constructor(r,e,s){super(),this.#i=r,this.#r=s,this.#n=[],this.#s=[],this.#e=[],this.setQueries(e)}onSubscribe(){this.listeners.size===1&&this.#s.forEach(r=>{r.subscribe(e=>{this.#d(r,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#s.forEach(r=>{r.destroy()})}setQueries(r,e){this.#n=r,this.#r=e,y.batch(()=>{const s=this.#s,t=this.#f(this.#n);t.forEach(o=>o.observer.setOptions(o.defaultedQueryOptions));const i=t.map(o=>o.observer),n=i.map(o=>o.getCurrentResult()),u=s.length!==i.length,a=i.some((o,d)=>o!==s[d]),f=u||a,b=f?!0:n.some((o,d)=>{const g=this.#e[d];return!g||!w(o,g)});!f&&!b||(f&&(this.#c=t,this.#s=i),this.#e=n,this.hasListeners()&&(f&&(R(s,i).forEach(o=>{o.destroy()}),R(i,s).forEach(o=>{o.subscribe(d=>{this.#d(o,d)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#s.map(r=>r.getCurrentQuery())}getObservers(){return this.#s}getOptimisticResult(r,e){const s=this.#f(r),t=s.map(n=>n.observer.getOptimisticResult(n.defaultedQueryOptions)),i=s.map(n=>n.defaultedQueryOptions.queryHash);return[t,n=>this.#l(n??t,e,i),()=>this.#a(t,s)]}#a(r,e){return e.map((s,t)=>{const i=r[t];return s.defaultedQueryOptions.notifyOnChangeProps?i:s.observer.trackResult(i,n=>{e.forEach(u=>{u.observer.trackProp(n)})})})}#l(r,e,s){if(e){const t=this.#h,i=s!==void 0&&t!==void 0&&(t.length!==s.length||s.some((n,u)=>n!==t[u]));return(!this.#t||this.#e!==this.#u||i||e!==this.#o)&&(this.#o=e,this.#u=this.#e,s!==void 0&&(this.#h=s),this.#t=S(this.#t,e(r))),this.#t}return r}#b(){return this.#r?.combine!==void 0&&this.#s.some((r,e)=>r.options.suspense&&this.#e[e]?.data===void 0)}#f(r){const e=new Map;this.#s.forEach(t=>{const i=t.options.queryHash;if(!i)return;const n=e.get(i);n?n.push(t):e.set(i,[t])});const s=[];return r.forEach(t=>{const i=this.#i.defaultQueryOptions(t),u=e.get(i.queryHash)?.shift()??new C(this.#i,i);s.push({defaultedQueryOptions:i,observer:u})}),s}#d(r,e){const s=this.#s.indexOf(r);s!==-1&&(this.#e=I(this.#e,s,e),this.#p())}#p(){if(this.hasListeners()){const r=this.#a(this.#e,this.#c),e=this.#b(),s=this.#t,t=e?s:this.#l(r,this.#r?.combine);(e||s!==t)&&y.batch(()=>{this.listeners.forEach(i=>{i(this.#e)})})}}};function D({queries:r,...e},s){const t=k(),i=M(),n=q(),u=p.useMemo(()=>r.map(h=>{const c=t.defaultQueryOptions(h);return c._optimisticResults=i?"isRestoring":"optimistic",c}),[r,t,i]);u.forEach(h=>{x(h);const c=t.getQueryCache().get(h.queryHash);H(h,n,c)}),L(n);const[a]=p.useState(()=>new T(t,u,e)),[f,b,o]=a.getOptimisticResult(u,e.combine),d=!i&&e.subscribed!==!1;p.useSyncExternalStore(p.useCallback(h=>d?a.subscribe(y.batchCalls(h)):P,[a,d]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),p.useEffect(()=>{a.setQueries(u,e)},[u,e,a]);const m=f.some((h,c)=>v(u[c],h))?f.flatMap((h,c)=>{const l=u[c];if(l&&v(l,h)){const E=new C(t,l);return B(l,E,n)}return[]}):[];if(m.length>0)throw Promise.all(m);const O=f.find((h,c)=>{const l=u[c];return l&&A({result:h,errorResetBoundary:n,throwOnError:l.throwOnError,query:t.getQueryCache().get(l.queryHash),suspense:l.suspense})});if(O?.error)throw O.error;return b(o())}export{D as u};
@@ -1 +0,0 @@
1
- import{j as E,e as W,b as Q,B as $,r as o,aK as R,w as N,v as B,a7 as U,Y as z,Z as G,_ as I,$ as X}from"./index-BMM2gkfY.js";import{C as V}from"./circle-check-big-CyS5sZb6.js";import{R as Y,i as Z,t as J}from"./search-token-index-BxytxF1H.js";import{u as L}from"./useQueries-B-aYaD8d.js";function Se({state:e,onRefresh:s,label:t,errorMessage:r,hasUpdate:a,size:u="sm",className:c}){const i=e==="refreshing",n=e==="error",h=e==="success",y=n?E.jsx(W,{className:"size-4 text-danger"}):h?E.jsx(V,{className:"size-4 text-positive"}):E.jsx(Y,{className:Q("size-4",i&&"animate-spin")}),w=n?`${t} — failed: ${r??"try again"}`:i?`${t} — refreshing`:h?`${t} — up to date`:a?`${t} — new mail`:t;return E.jsxs("div",{className:"relative inline-flex",children:[E.jsx($,{variant:"ghost",size:u,icon:y,onClick:s,disabled:i,"aria-label":w,"aria-busy":i||void 0,title:n?r:t,className:c}),e==="idle"&&a&&E.jsx("span",{"aria-hidden":"true",className:"absolute right-1 top-1 size-1.5 rounded-full bg-accent-2"})]})}const ee=new Set(["discovering_mailboxes","syncing_inbox","syncing_others"]);function P(e){return!!e&&ee.has(e)}const F=3e3,te=F*2,T={syncing:!1,resolved:!1,synced:0,total:0};function we(e,s){const t=e.join(","),[r,a]=o.useState(!1),[u,c]=o.useState(!1);o.useEffect(()=>{a(!1),c(!1)},[t,s]),o.useEffect(()=>{if(!s)return;const m=setTimeout(()=>c(!0),te);return()=>clearTimeout(m)},[t,s]);const i=L({queries:e.map(m=>({...R({path:{accountId:m}}),enabled:s&&!r,refetchInterval:F,meta:{softError:!0}}))}),n=i.every(m=>m.isSuccess||m.isError),h=i.length===0||n||u;let y=!1,w=0,S=0;for(const m of i)if(P(m.data?.syncPhase)){y=!0;for(const l of m.data?.mailboxes??[])w+=l.messagesSynced,S+=l.messagesTotal}const x=s&&h&&!y;return o.useEffect(()=>{x&&a(!0)},[x]),!s||!h?T:{syncing:y,resolved:!0,synced:w,total:S}}const se=180*1e3,xe=30*1e3;let q=0;const v=new Set,ne=(e=Date.now())=>{q=e+se;for(const s of v)s()},pe=(e=Date.now())=>e<q,Ee=e=>(v.add(e),()=>{v.delete(e)}),_=6e4,re=new Set(["sent","drafts","trash","archive"]),C=(e,s)=>{const t=new Map;for(const r of e){const a=s.get(r.mailboxId)?.role;a&&re.has(a)||t.set(r.mailboxId,r.messagesTotal)}return t},j=(e,s)=>{const t=[];for(const[r,a]of s)a>(e.get(r)??0)&&t.push(r);return t},oe=(e,s)=>j(e,s).length>0,D=o.createContext(null),ae=()=>{const e=o.useContext(D);if(!e)throw new Error("useMailFreshness must be used inside <MailFreshnessProvider>");return e};function be({accountIds:e,children:s}){const t=N(),{resultFolderIndex:r}=B(),a=o.useRef(new Map),u=o.useRef(new Set),c=o.useRef(new Map),[i,n]=o.useState(new Set),h=L({queries:e.map(l=>({...R({path:{accountId:l}}),refetchInterval:_,staleTime:_,meta:{softError:!0}}))}),y=h.map(l=>l.dataUpdatedAt).join(","),w=e.join(",");o.useEffect(()=>{let l=!1;const f=new Set(i);e.forEach((d,p)=>{const b=h[p]?.data;if(!b)return;const g=C(b.mailboxes??[],r),k=c.current.get(d);if(c.current.set(d,g),k){const A=j(k,g);A.length>0&&Z(t,J(A))}if(!u.current.has(d)){u.current.add(d),a.current.set(d,g);return}if(f.has(d))return;const K=a.current.get(d)??new Map;oe(K,g)&&(f.add(d),l=!0)}),l&&n(f)},[w,y]);const S=o.useCallback(l=>l.some(f=>i.has(f)),[i]),x=o.useCallback(l=>{n(f=>{if(l.every(p=>!f.has(p)))return f;const d=new Set(f);for(const p of l)d.delete(p);return d});for(const f of l){const d=t.getQueryData(R({path:{accountId:f}}).queryKey);a.current.set(f,C(d?.mailboxes??[],r)),u.current.add(f)}},[t,r]),m=o.useMemo(()=>({hasNewMail:S,acknowledge:x}),[S,x]);return E.jsx(D.Provider,{value:m,children:s})}const ie=2e3,ce=45e3,ue=e=>new Promise(s=>setTimeout(s,e)),M=e=>e instanceof Error&&e.message?e.message:"Something went wrong",le=e=>{I(e,{softError:!0},"user")&&X(e)},O=(e,s)=>e.fetchQuery({...R({path:{accountId:s}}),staleTime:0}),H=e=>e.mailboxes?.find(s=>s.fullPath?.toUpperCase()==="INBOX")?.lastSyncedAt??0,fe=async({accountId:e,readStatus:s,baselineLastSyncAt:t,baselineInboxSyncedAt:r=0,onInboxSynced:a,deadline:u,pollMs:c=ie})=>{let i=!1;for(;;){const n=await s().then(S=>({ok:!0,data:S})).catch(S=>({ok:!1,error:S}));if(!n.ok)return{accountId:e,message:M(n.error)};const{syncPhase:h,lastSyncAt:y}=n.data;if((y??0)>t&&!P(h))return h==="error"?{accountId:e,message:"Sync failed for this account"}:void 0;if(!i&&H(n.data)>r&&(i=!0,a?.()),Date.now()>=u)return{accountId:e,message:"Refresh is taking longer than usual"};await ue(c)}},de=async(e,s,t,r,a)=>{const u=await O(e,t).then(n=>({ok:!0,lastSyncAt:n.lastSyncAt??0,inboxSyncedAt:H(n)})).catch(n=>({ok:!1,error:n}));if(!u.ok)return{accountId:t,enqueued:!1,ok:!1,message:M(u.error)};const c=await z({path:{accountId:t},throwOnError:!0}).then(()=>({ok:!0})).catch(n=>({ok:!1,error:n}));if(!c.ok)return le(c.error),{accountId:t,enqueued:!1,ok:!1,message:M(c.error)};s.recordEvent("sync.triggered");const i=await fe({accountId:t,readStatus:()=>O(e,t),baselineLastSyncAt:u.lastSyncAt,baselineInboxSyncedAt:u.inboxSyncedAt,onInboxSynced:()=>a(t),deadline:r});return i?{accountId:t,enqueued:!0,ok:!1,message:i.message}:{accountId:t,enqueued:!0,ok:!0}},Re=(e,s={})=>{const t=N(),r=U(),{acknowledge:a}=ae(),[u,c]=o.useState("idle"),[i,n]=o.useState(),h=o.useRef(0),y=o.useRef(e);y.current=e;const w=o.useRef(s);w.current=s,o.useEffect(()=>{if(u!=="success")return;const x=setTimeout(()=>c("idle"),2e3);return()=>clearTimeout(x)},[u]);const S=o.useCallback(()=>{const x=y.current;if(x.length===0){c("error"),n("Nothing to refresh yet");return}const m=++h.current;c("refreshing"),n(void 0),ne();const l=f=>{h.current===m&&(t.invalidateQueries({queryKey:G({path:{accountId:f}})}),w.current.onSettled?.())};(async()=>{const f=Date.now()+ce,d=await Promise.all(x.map(g=>de(t,r,g,f,l)));if(h.current!==m)return;const p=d.filter(g=>g.enqueued).map(g=>g.accountId);for(const g of p)l(g);p.length>0&&a(p);const b=d.filter(g=>!g.ok);b.length===0?c("success"):(c("error"),n(b[0]?.message))})()},[a,t,r]);return{state:u,errorMessage:i,refresh:S}};export{xe as H,be as M,Se as R,Re as a,P as b,we as c,pe as i,Ee as s,ae as u};
@@ -1 +0,0 @@
1
- import{w as T,ai as I,ak as k,bK as C,bY as A,r as v,j as p,bZ as h,b_ as E,b$ as w,v as D,c0 as j,D as z,c1 as Q,bN as R}from"./index-BMM2gkfY.js";import{P as _}from"./attachment-file-B4nazean.js";import{am as N,an as O}from"./MailListHeader-BpL0hiB2.js";import{i as P,t as q}from"./search-token-index-BxytxF1H.js";import{a as B}from"./useLabels-DL6gxLzs.js";import{n as U}from"./search-query-Cr_ZXBCp.js";import{s as F}from"./search-scope-DTcpOp3S.js";import{u as G,p as H}from"./useSearchTokenContext-Dpl3C3yN.js";const ne=e=>{const t=new Set;for(const a of e)a&&t.add(a);return t.size>1?{accountId:void 0,restriction:"spansAccounts",moveDisabledHint:"Move only works within one account — clear selection or pick messages from a single account"}:{accountId:t.size===1?[...t][0]:void 0,restriction:void 0,moveDisabledHint:void 0}},K=e=>{const{mailboxId:t,messages:a}=e,c=T(),{pushError:l}=I(),{mutateAsync:i,isPending:o}=k({...A(),onError:(n,u)=>{l({title:u.body.action==="Remove"?"Couldn't remove label":"Couldn't apply label",detail:C(n),error:n})},onSettled:(n,u,d)=>{P(c,q(N(d.body.messageIds??[],a??[],t)))}});return{applyLabel:v.useCallback((n,u,d)=>{n.length!==0&&O(n,m=>i({body:{messageIds:m,labelId:u,action:d}}))},[i]),isPending:o}};function re({accountId:e,mailboxId:t,messageIds:a}){const{labels:c}=B(e),{applyLabel:l}=K({mailboxId:t}),i=v.useMemo(()=>c.map(o=>({key:o.labelId,label:o.name,icon:p.jsx("span",{className:`size-2.5 rounded-full ${E(o.color)?h[o.color]:h.Default}`}),onSelect:()=>l(a,o.labelId,"Apply")})),[c,a,l]);return i.length===0?null:p.jsx(_,{triggerLabel:"Apply label to selected messages",triggerIcon:p.jsx(w,{className:"size-4 text-fg-subtle"}),triggerText:"Apply label",items:i,align:"start",nested:!0,touch:!1,triggerClassName:"min-h-11 w-full justify-start gap-3 px-4 py-2.5 text-sm font-normal text-fg"})}const $=20,V=new Set(Object.values(R)),Y=e=>e!==void 0&&V.has(e)?e:void 0,Z=e=>{if(e.some(t=>t.type==="isUnread"))return!1;if(e.some(t=>t.type==="isRead"))return!0};function ie({mailboxId:e,filterCategory:t}={}){const{searchQuery:a}=D(),c=G(),l=j(),i=U(a),{freeText:o,tokens:r}=H(i,c),n=o.length>0,u=r.find(s=>s.type==="category"),d=Y(t)??u?.category,m=r.some(s=>s.type==="hasAttachment")?!0:void 0,b=r.some(s=>s.type==="isStarred")?!0:void 0,f=Z(r),y=r.find(s=>s.type==="after"),g=r.find(s=>s.type==="before"),S=r.find(s=>s.type==="in"),x=F({browsed:l,callerMailboxId:e,inTokenMailboxId:S?.mailboxId}),{data:L,isLoading:M}=z({...Q({query:{query:o,mailboxId:x,limit:$,...d!==void 0?{category:d}:{},...m!==void 0?{hasAttachment:m}:{},...b!==void 0?{hasStars:b}:{},...f!==void 0?{isRead:f}:{},...y?{sentDateFrom:y.epochSeconds}:{},...g?{sentDateTo:g.epochSeconds}:{}}}),enabled:n,staleTime:6e4});return{hits:L?.items??[],isLoading:n&&M}}export{re as L,ne as r,ie as u};
@@ -1 +0,0 @@
1
- import{w as g,ai as p,D as f,a2 as m,r,ak as y,al as T,a6 as E,am as x}from"./index-BMM2gkfY.js";const i={html:"",plainText:""},d=e=>{const u=g(),{pushError:o}=p(),{data:n}=f({...m(),staleTime:1/0}),l=r.useMemo(()=>{if(!e||!n)return i;const t=n.accounts.find(s=>s.accountId===e);return t?{html:t.signatureHtml??"",plainText:t.signaturePlainText??""}:i},[e,n]),a=y({...x(),onSuccess:()=>{u.invalidateQueries({queryKey:E()})},onError:t=>{o(T("Couldn't save signature","The signature wasn't saved.",t))}}),c=r.useCallback((t,s)=>{e&&a.mutate({path:{accountId:e},body:{signatureHtml:t,signaturePlainText:s}})},[e,a]);return{signature:l,setSignature:c,isSaving:a.isPending}};export{d as u};