@remit/web-client-dist 0.0.403 → 0.0.404

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 (116) hide show
  1. package/assets/BriefPane-DEA1xakw.js +1 -0
  2. package/assets/{ErrorState-C4QR2OHT.js → ErrorState-Cxt-Ynu5.js} +1 -1
  3. package/assets/FlaggedPane-CWcWu6zq.js +1 -0
  4. package/assets/{FullCompose-CTpFjCtM.js → FullCompose-BvD2Hz0_.js} +1 -1
  5. package/assets/MailListHeader-CyuJdrqg.js +7 -0
  6. package/assets/{MailViewChrome-BZcvy1C_.js → MailViewChrome-DX2epV3R.js} +1 -1
  7. package/assets/MailboxPane-ClQKUPiW.js +1 -0
  8. package/assets/{NavMenuButton-DcnV6Hj5.js → NavMenuButton-ChbGRtp5.js} +1 -1
  9. package/assets/{OnboardingWizard-Dz61uK44.js → OnboardingWizard-BU_mji11.js} +1 -1
  10. package/assets/{OutboxPane-NAu0D-vN.js → OutboxPane-D3bNFTsB.js} +1 -1
  11. package/assets/_mailboxId-C7WRjGbl.js +1 -0
  12. package/assets/_messageId-B44y3Bc9.js +1 -0
  13. package/assets/_messageId-DxVRxybh.js +1 -0
  14. package/assets/_messageId-JUWsb_TU.js +1 -0
  15. package/assets/_outboxMessageId-CTWgaX1u.js +1 -0
  16. package/assets/_threadId-DiTlMLmK.js +1 -0
  17. package/assets/_threadId-bmbC9-QI.js +1 -0
  18. package/assets/_threadId-o-H-Jg2_.js +1 -0
  19. package/assets/{accounts-Bjer_T0C.js → accounts-CXixIelX.js} +1 -1
  20. package/assets/{advanced-10eV5vPf.js → advanced-DMcFlw9k.js} +1 -1
  21. package/assets/{appearance-DmVSvDqw.js → appearance-CWI7d_AE.js} +1 -1
  22. package/assets/{attachment-file-Bjm6lsCc.js → attachment-file-CC7sUq_3.js} +1 -1
  23. package/assets/{avatar-DV1csnvT.js → avatar-Ch-BluEg.js} +1 -1
  24. package/assets/{bottom-sheet-BBgLAlb7.js → bottom-sheet-rtNXU_QA.js} +1 -1
  25. package/assets/{brief-fmvzcuvn.js → brief-BYabPV-y.js} +1 -1
  26. package/assets/brief-DgOZtpST.js +1 -0
  27. package/assets/{browser-ponyfill-IL0YXJKR.js → browser-ponyfill-DU2Y7A0e.js} +1 -1
  28. package/assets/{bug-BjQ-Km4e.js → bug-DE3TgWRx.js} +1 -1
  29. package/assets/{circle-check-CccsDKfb.js → circle-check-CCg9X8h3.js} +1 -1
  30. package/assets/{circle-check-big-BLaZbuG9.js → circle-check-big-DL6yaJ7B.js} +1 -1
  31. package/assets/{circle-help-BJd9ea_a.js → circle-help-BMTpb2T4.js} +1 -1
  32. package/assets/{clock-Cyo25YTD.js → clock-CRiDFg0e.js} +1 -1
  33. package/assets/compose._-_outboxMessageId_-95IeyaNp.js +1 -0
  34. package/assets/compose._-_outboxMessageId_-CB4LoT6K.js +1 -0
  35. package/assets/compose._-_outboxMessageId_-D4G2SovG.js +1 -0
  36. package/assets/compose._-_outboxMessageId_-D4m1_-nR.js +1 -0
  37. package/assets/{confirm-dialog-CQSTQRV2.js → confirm-dialog-sc-zEWxj.js} +1 -1
  38. package/assets/{download-KdO2vtfS.js → download-B5nLiiRy.js} +1 -1
  39. package/assets/{filters-BQtHIEIt.js → filters-Fgd0dMg6.js} +1 -1
  40. package/assets/flagged-CT7GRBpL.js +1 -0
  41. package/assets/{flagged-D8pI5TWD.js → flagged-DZIbRuYM.js} +1 -1
  42. package/assets/{folders-DzKrhOGh.js → folders-DSIv1EdN.js} +1 -1
  43. package/assets/{format-DlutEuGc.js → format-23Av07Go.js} +1 -1
  44. package/assets/{help-copy-B9vfpQrv.js → help-copy-BoyO2Xf8.js} +1 -1
  45. package/assets/index-52lciyqj.js +1 -0
  46. package/assets/index-B44y3Bc9.js +1 -0
  47. package/assets/{index-EM4Uoip4.js → index-CQLHjDPJ.js} +3 -3
  48. package/assets/index-DG-9lbAY.js +1 -0
  49. package/assets/index-Ds3Dhe_m.js +1 -0
  50. package/assets/index-DuoENJdd.js +1 -0
  51. package/assets/index-JUWsb_TU.js +1 -0
  52. package/assets/{index-DQPXHKId.css → index-OWhz0EKb.css} +1 -1
  53. package/assets/{index-CP_u7qA0.js → index-U21Ntcgp.js} +14 -14
  54. package/assets/index-WoxYtNwQ.js +1 -0
  55. package/assets/index-u48XjL7T.js +1 -0
  56. package/assets/{kbd-BaSoxAuP.js → kbd-BW1x90_8.js} +1 -1
  57. package/assets/{labels-O2y4gldY.js → labels-DtEvX-em.js} +1 -1
  58. package/assets/{mail-Czi2Y_GZ.js → mail-DP6MOTXv.js} +1 -1
  59. package/assets/{mail-gESMSqqx.js → mail-Dgdo_4jK.js} +1 -1
  60. package/assets/{menu-xsfahEJ7.js → menu-Bg40gsUW.js} +1 -1
  61. package/assets/{onboarding-CEnH8bth.js → onboarding-Bzp0A5vU.js} +1 -1
  62. package/assets/outbox-DcgYlvD2.js +1 -0
  63. package/assets/{pencil-BXASGhia.js → pencil-DnuUvcLY.js} +1 -1
  64. package/assets/{rich-text-DGY3tZhu.js → rich-text-Bgy85Rld.js} +1 -1
  65. package/assets/{rich-text-spellcheck-worker-provider-DJ4digRi.js → rich-text-spellcheck-worker-provider-Bkw6t6cQ.js} +1 -1
  66. package/assets/{rotate-ccw-D3n8wodI.js → rotate-ccw-CAo4YTva.js} +1 -1
  67. package/assets/{row-actions-P90tXTrG.js → row-actions-Dt4hnGSO.js} +1 -1
  68. package/assets/{search-scope-BQ8HHXSV.js → search-scope-BsXhL0sT.js} +1 -1
  69. package/assets/{search-token-index-CG7hPaco.js → search-token-index-CS3Ahk2_.js} +1 -1
  70. package/assets/{search-view-CNPgAIwM.js → search-view-Cux0U-2s.js} +1 -1
  71. package/assets/{senders-CcBjhLBV.js → senders-DAq8Em3A.js} +1 -1
  72. package/assets/settings-D0vLL1bF.js +1 -0
  73. package/assets/{settings-screen-D-_K_C3M.js → settings-screen-CAsA00tn.js} +1 -1
  74. package/assets/{shield-check-CVmTR1hh.js → shield-check-A3vxhKls.js} +1 -1
  75. package/assets/{suggested-vips-C-kYnJRU.js → suggested-vips-CDSYSOei.js} +1 -1
  76. package/assets/{useDebouncedValue-0nS8-8zw.js → useDebouncedValue-mBr89eBP.js} +1 -1
  77. package/assets/{useFilters-CCgvHNzK.js → useFilters-DmbMApEr.js} +1 -1
  78. package/assets/{useLabels-Bxa6Xpyj.js → useLabels-DiDFA7ER.js} +1 -1
  79. package/assets/{useMediaQuery-kszmEDQl.js → useMediaQuery-1f-g53mH.js} +1 -1
  80. package/assets/{useMessageBodyContent-gWn_VAyS.js → useMessageBodyContent-CK3UpsN8.js} +1 -1
  81. package/assets/{useRefreshControl-CEi6jGL4.js → useRefreshControl-CYQW4IoX.js} +1 -1
  82. package/assets/{useSearchMirror-DjVzjTGW.js → useSearchMirror-Bnf2BrOc.js} +1 -1
  83. package/assets/{useSearchTokenContext-Rec5qr0P.js → useSearchTokenContext-Drg7CMEN.js} +1 -1
  84. package/assets/useSemanticSearch-CZyDfsag.js +1 -0
  85. package/assets/{useSignature-DQ37CqeJ.js → useSignature-Bs9W_jAl.js} +1 -1
  86. package/index.html +2 -2
  87. package/package.json +1 -1
  88. package/assets/BriefPane-R4rcTAO3.js +0 -1
  89. package/assets/FlaggedPane-CzQn701M.js +0 -1
  90. package/assets/MailListHeader-D9UyUWpO.js +0 -7
  91. package/assets/MailboxPane-U1SkJ4BI.js +0 -1
  92. package/assets/_mailboxId-ppTzLsI0.js +0 -1
  93. package/assets/_messageId-4WjOyoww.js +0 -1
  94. package/assets/_messageId-CZYt4DU7.js +0 -1
  95. package/assets/_messageId-hnrVh4pn.js +0 -1
  96. package/assets/_outboxMessageId-Bu7skeag.js +0 -1
  97. package/assets/_threadId-B3mAevNn.js +0 -1
  98. package/assets/_threadId-BJHyXjLW.js +0 -1
  99. package/assets/_threadId-DXzrBvlx.js +0 -1
  100. package/assets/brief-Cr9YlJSF.js +0 -1
  101. package/assets/compose._-_outboxMessageId_-BAb_afcd.js +0 -1
  102. package/assets/compose._-_outboxMessageId_-CLnUkdJ7.js +0 -1
  103. package/assets/compose._-_outboxMessageId_-D_tVDnUF.js +0 -1
  104. package/assets/compose._-_outboxMessageId_-wfhWchvo.js +0 -1
  105. package/assets/flagged-CqBM51xW.js +0 -1
  106. package/assets/index-4WjOyoww.js +0 -1
  107. package/assets/index-Bq2nvB6b.js +0 -1
  108. package/assets/index-CPxKl4U-.js +0 -1
  109. package/assets/index-DU0Ih05G.js +0 -1
  110. package/assets/index-UR3grqCv.js +0 -1
  111. package/assets/index-hnrVh4pn.js +0 -1
  112. package/assets/index-yDlPrIVD.js +0 -1
  113. package/assets/index-zz2iXRjs.js +0 -1
  114. package/assets/outbox-DIxEoc9O.js +0 -1
  115. package/assets/settings-Em9by5Kf.js +0 -1
  116. package/assets/useSemanticSearch-CAmlG47i.js +0 -1
@@ -1 +1 @@
1
- import{c as z,r as j,j as e,b as f,B as i,X as N,at as S}from"./index-CP_u7qA0.js";import{A as w}from"./avatar-DV1csnvT.js";import{M as B}from"./menu-xsfahEJ7.js";import{C as v}from"./circle-help-BJd9ea_a.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 X({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{X as A,F as S,R as a};
1
+ import{c as z,r as j,j as e,b as f,B as i,X as N,at as S}from"./index-U21Ntcgp.js";import{A as w}from"./avatar-Ch-BluEg.js";import{M as B}from"./menu-Bg40gsUW.js";import{C as v}from"./circle-help-BMTpb2T4.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 X({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{X as A,F as S,R as a};
@@ -1 +1 @@
1
- import{c as e}from"./index-CP_u7qA0.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
+ import{c as e}from"./index-U21Ntcgp.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 +1 @@
1
- import{j as t,$ as e}from"./index-CP_u7qA0.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
1
+ import{j as t,$ as e}from"./index-U21Ntcgp.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
@@ -1 +1 @@
1
- import{r as o}from"./index-CP_u7qA0.js";const n=(e,t)=>{const[r,u]=o.useState(e);return o.useEffect(()=>{const s=setTimeout(()=>u(e),t);return()=>clearTimeout(s)},[e,t]),r};export{n as u};
1
+ import{r as o}from"./index-U21Ntcgp.js";const n=(e,t)=>{const[r,u]=o.useState(e);return o.useEffect(()=>{const s=setTimeout(()=>u(e),t);return()=>clearTimeout(s)},[e,t]),r};export{n as u};
@@ -1 +1 @@
1
- import{r as m,a7 as b,dd as E,s as C,de as x,cY as F,df as D,n as M,dg as N,dh as P,di as L,dj as z}from"./index-CP_u7qA0.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"})},O=(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}),Y=({mode:e,ruleScope:t})=>t==="standing"?"standing":t==="until"?"temporary":e==="selected"?"just-these":"all-like-these",G=({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"?O(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}:{}}),T=new Set(["Complete","Failed"]),v=e=>e!==void 0&&T.has(e),w=1e3,J=15e3,_=e=>{const t=Math.max(0,e),r=w*2**t;return Math.min(r,J)},$=(e,t,r)=>{if(e)return{kind:r?"restartFailed":"startFailed",error:e};if(t)return{kind:"statusUnreadable",error:t}},X=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:_(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:$(a.error,n.error,!!l)}},Z=["From","Subject","HasWords","ListId","FromDomain"],k=e=>{const t=e.trim(),r=t.match(/<([^>]+)>/);return(r?r[1]:t).trim().toLowerCase()},ee=(e,t)=>e==="ListId"?k(t):t.trim(),R=e=>e==="all"?"And":"Or",U=(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:R(e.matchOperator),literalClauses:a}},j=e=>e.anchorMessageId!==void 0||!e.literalClauses.some(t=>t.field==="HasWords"),Q=e=>JSON.stringify({anchor:e.anchorMessageId??null,operator:e.matchOperator,clauses:e.literalClauses.map(t=>`${t.field} ${t.value}`)}),te=(e,t)=>{const r=U(e,t);return{...r.anchorMessageId?{anchorMessageId:r.anchorMessageId}:{},matchOperator:r.matchOperator,literalClauses:r.literalClauses,moveMailboxId:e.moveMailboxId,labelId:e.labelId,expiresAt:e.scope==="until"?O(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(F()),{mutateAsync:i}=a,n=Q(t),[s,o]=m.useState(()=>({})),d=m.useRef(t);d.current=t;const l=m.useRef(n),c=j(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:D},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=M(),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=M(),r=b({...z(),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,X 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,G as j,V as k,ee as n,Y as o,O as p,U as r,re as u};
1
+ import{r as m,a7 as b,de as E,s as C,df as x,cZ as F,dg as D,n as M,dh as N,di as P,dj as L,dk as z}from"./index-U21Ntcgp.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"})},O=(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"?O(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}:{}}),T=new Set(["Complete","Failed"]),v=e=>e!==void 0&&T.has(e),w=1e3,k=15e3,J=e=>{const t=Math.max(0,e),r=w*2**t;return Math.min(r,k)},_=(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:_(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(),R=e=>e==="all"?"And":"Or",U=(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:R(e.matchOperator),literalClauses:a}},j=e=>e.anchorMessageId!==void 0||!e.literalClauses.some(t=>t.field==="HasWords"),Q=e=>JSON.stringify({anchor:e.anchorMessageId??null,operator:e.matchOperator,clauses:e.literalClauses.map(t=>`${t.field} ${t.value}`)}),te=(e,t)=>{const r=U(e,t);return{...r.anchorMessageId?{anchorMessageId:r.anchorMessageId}:{},matchOperator:r.matchOperator,literalClauses:r.literalClauses,moveMailboxId:e.moveMailboxId,labelId:e.labelId,expiresAt:e.scope==="until"?O(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(F()),{mutateAsync:i}=a,n=Q(t),[s,o]=m.useState(()=>({})),d=m.useRef(t);d.current=t;const l=m.useRef(n),c=j(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:D},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=M(),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=M(),r=b({...z(),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,O as p,U as r,re as u};
@@ -1 +1 @@
1
- import{s as L,bG as p,n,a7 as l,bH as d,r as o,bI as y,bJ as c,bK as g}from"./index-CP_u7qA0.js";const u=e=>y({path:{accountId:e}}),f=e=>{const s=L({...p({path:{accountId:e??""}}),enabled:!!e});return{labels:s.data?.items??[],isPending:s.isPending,isError:s.isError,error:s.error,refetch:s.refetch}},m=e=>{const s=n(),t=l({...d(),onSuccess:()=>{e&&s.invalidateQueries({queryKey:u(e)})}}),{mutateAsync:r}=t;return{createLabel:o.useCallback((a,i="Default")=>e?r({path:{accountId:e},body:{name:a,color:i}}):Promise.reject(new Error("No account")),[e,r]),isPending:t.isPending,isError:t.isError,error:t.error,reset:t.reset}},h=e=>{const s=n(),t=l({...c(),onSuccess:()=>{e&&s.invalidateQueries({queryKey:u(e)})}}),{mutate:r}=t;return{updateLabel:o.useCallback((a,i)=>{e&&r({path:{accountId:e,labelId:a},body:i})},[e,r]),isPending:t.isPending,updatingLabelId:t.isPending?t.variables?.path.labelId:void 0}},C=e=>{const s=n(),t=l({...g(),onSuccess:()=>{e&&s.invalidateQueries({queryKey:u(e)})}}),{mutate:r}=t;return{deleteLabel:o.useCallback(a=>{e&&r({path:{accountId:e,labelId:a}})},[e,r]),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
+ import{s as L,bJ as p,n,a7 as l,bK as d,r as o,bL as y,bM as c,bN as g}from"./index-U21Ntcgp.js";const u=e=>y({path:{accountId:e}}),f=e=>{const s=L({...p({path:{accountId:e??""}}),enabled:!!e});return{labels:s.data?.items??[],isPending:s.isPending,isError:s.isError,error:s.error,refetch:s.refetch}},m=e=>{const s=n(),t=l({...d(),onSuccess:()=>{e&&s.invalidateQueries({queryKey:u(e)})}}),{mutateAsync:r}=t;return{createLabel:o.useCallback((a,i="Default")=>e?r({path:{accountId:e},body:{name:a,color:i}}):Promise.reject(new Error("No account")),[e,r]),isPending:t.isPending,isError:t.isError,error:t.error,reset:t.reset}},h=e=>{const s=n(),t=l({...c(),onSuccess:()=>{e&&s.invalidateQueries({queryKey:u(e)})}}),{mutate:r}=t;return{updateLabel:o.useCallback((a,i)=>{e&&r({path:{accountId:e,labelId:a},body:i})},[e,r]),isPending:t.isPending,updatingLabelId:t.isPending?t.variables?.path.labelId:void 0}},C=e=>{const s=n(),t=l({...g(),onSuccess:()=>{e&&s.invalidateQueries({queryKey:u(e)})}}),{mutate:r}=t;return{deleteLabel:o.useCallback(a=>{e&&r({path:{accountId:e,labelId:a}})},[e,r]),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 +1 @@
1
- import{r as s}from"./index-CP_u7qA0.js";const r=1024,c=`(min-width: ${r}px) and (not ((orientation: portrait) and (pointer: coarse)))`,d=e=>{const[o,n]=s.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(e).matches);return s.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const t=window.matchMedia(e);n(t.matches);const a=i=>n(i.matches);return t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[e]),o},m=()=>d(c);export{c as D,d as a,m as u};
1
+ import{r as s}from"./index-U21Ntcgp.js";const r=1024,c=`(min-width: ${r}px) and (not ((orientation: portrait) and (pointer: coarse)))`,d=e=>{const[o,n]=s.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(e).matches);return s.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const t=window.matchMedia(e);n(t.matches);const a=i=>n(i.matches);return t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[e]),o},m=()=>d(c);export{c as D,d as a,m as u};
@@ -1 +1 @@
1
- import{G as M,b$ as T,c0 as O,w as f,r as i,c1 as P,m as h,j as W,c2 as Y,c3 as V,W as H,k as z,n as J,s as Z,c4 as ee,c5 as te}from"./index-CP_u7qA0.js";import{u as se}from"./useMediaQuery-kszmEDQl.js";function re(e){const t=M({warn:e?.router===void 0}),s=e?.router||t;return T(s.stores.__store,O(e,s))}function ne(e){const t=M();return T(t.stores.location,O(e,t))}const A="/mail/brief",S="/mail/$mailboxId",v="/mail/outbox",L="/mail/flagged";function oe(e){for(const t of e){if(t.routeId===A)return{list:"brief"};if(t.routeId===L)return{list:"flagged"};if(t.routeId===v)return{list:"outbox"};if(t.routeId===S)return{list:"mailbox",mailboxId:t.params?.mailboxId}}}function Te(e){const t=e.split(/[?#]/)[0].split("/").filter(Boolean);if(t[0]!=="mail")return"";const s=t[1];return s?s==="brief"?A:s==="flagged"?L:s==="outbox"?v:ae(s):""}function Oe(e){if(typeof e!="object"||e===null)return"";const{q:t}=e;return typeof t=="string"?t:""}function ae(e){return`${S}:${e}`}function Pe(e,t){return e===t?!0:e.startsWith(`${t}/`)}function Ae(e){const t=e.split(/[?#]/)[0].split("/").filter(Boolean);return t[0]==="mail"&&t.length>2}function g(){const e=re({select:s=>oe(s.matches)?.list}),t=f({from:"/mail/$mailboxId",shouldThrow:!1});return{list:e,mailboxId:t?.mailboxId}}const k=["intelligence","nav","shortcuts"],ie=["nav","shortcuts"],ue=e=>ie.includes(e),ce=P(k);function x(e){const t=new Set(e.split(",").map(s=>ce.safeParse(s)).filter(s=>s.success).map(s=>s.data));return k.filter(s=>t.has(s))}function $(e){return k.filter(t=>e.includes(t)).join(",")}function Se(){const e=ne({select:t=>$(x(t.hash))});return i.useMemo(()=>x(e),[e])}const le=(e,t)=>!ue(e)&&t;function de(e){return(t="")=>$(x(t).filter(s=>le(s,e)))}function y(){const e=se();return i.useMemo(()=>de(e),[e])}function ve(){const e=h();return i.useCallback(t=>{e({search:!0,hash:$(t),replace:!0,hashScrollIntoView:!1})},[e])}const _="/mail/brief/compose/{-$outboxMessageId}",D="/mail/flagged/compose/{-$outboxMessageId}",B="/mail/outbox/compose/{-$outboxMessageId}",U="/mail/$mailboxId/compose/{-$outboxMessageId}";function F(){const e=f({from:_,shouldThrow:!1}),t=f({from:D,shouldThrow:!1}),s=f({from:B,shouldThrow:!1}),r=f({from:U,shouldThrow:!1});return e??t??s??r}function Le(){return F()!==void 0}function _e(){return F()?.outboxMessageId}function fe(e,t,s){return e==="flagged"?{to:D,params:{outboxMessageId:s}}:e==="outbox"?{to:B,params:{outboxMessageId:s}}:e==="mailbox"&&t?{to:U,params:{mailboxId:t,outboxMessageId:s}}:{to:_,params:{outboxMessageId:s}}}function w(){const e=h(),t=y(),{list:s,mailboxId:r}=g();return i.useCallback((n,o)=>{e({...fe(s,r,n),search:a=>a,hash:o?.keepPanels?!0:t,replace:o?.replace??!1})},[e,t,s,r])}function De(){const e=w();return i.useCallback(()=>e(void 0),[e])}function Be(){const e=w();return i.useCallback(t=>e(t),[e])}function Ue(){const e=w();return i.useCallback(t=>e(t,{replace:!0,keepPanels:!0}),[e])}function Fe(){const e=h(),t=y(),{list:s,mailboxId:r}=g();return i.useCallback(()=>{const n=a=>a,o=t;if(s==="flagged"){e({to:"/mail/flagged",search:n,hash:o});return}if(s==="outbox"){e({to:"/mail/outbox",search:n,hash:o});return}if(s==="mailbox"&&r){e({to:"/mail/$mailboxId",params:{mailboxId:r},search:n,hash:o});return}e({to:"/mail/brief",search:n,hash:o})},[e,t,s,r])}const me=Y(V);function Ne({fragment:e,...t}){const s=y();return W.jsx(me,{...t,hash:e??s})}const he=["reply","reply-all","forward"],pe=P(he),N="/mail/brief/$threadId/$messageId/$mode/{-$outboxMessageId}",K="/mail/flagged/$threadId/$messageId/$mode/{-$outboxMessageId}",q="/mail/$mailboxId/$threadId/$messageId/$mode/{-$outboxMessageId}";function G(){const e=f({from:N,shouldThrow:!1}),t=f({from:K,shouldThrow:!1}),s=f({from:q,shouldThrow:!1});return e??t??s}function C(){const e=G();return i.useMemo(()=>{if(!e)return;const t=pe.safeParse(e.mode);return t.success?{kind:"reply",mode:t.data,threadId:e.threadId,sourceMessageId:e.messageId,outboxMessageId:e.outboxMessageId}:{kind:"unknown",segment:e.mode}},[e])}function Ke(){return C()?.kind==="reply"}function Q(e,t,s,r){return e==="flagged"?{to:K,params:{...s,outboxMessageId:r}}:e==="mailbox"&&t?{to:q,params:{...s,mailboxId:t,outboxMessageId:r}}:{to:N,params:{...s,outboxMessageId:r}}}function ge(e,t){if(e?.kind==="reply"&&e.threadId===t.threadId&&e.sourceMessageId===t.messageId)return e.outboxMessageId}function qe(){const e=h(),t=y(),{list:s,mailboxId:r}=g(),n=C();return i.useCallback(o=>{e({...Q(s,r,o,ge(n,o)),search:a=>a,hash:t})},[e,t,s,r,n])}function Ge(e,t,s){if(!(!t||!s))return r=>e({threadId:t,messageId:s,mode:r})}function Qe(){const e=h(),{list:t,mailboxId:s}=g(),r=C();return i.useCallback(n=>{r?.kind==="reply"&&e({...Q(t,s,{threadId:r.threadId,messageId:r.sourceMessageId,mode:r.mode},n),search:o=>o,hash:!0,replace:!0})},[e,t,s,r])}function Xe(){const e=h(),t=y(),{list:s,mailboxId:r}=g(),n=G();return i.useCallback(()=>{if(!n)return;const o=c=>c,a=t,u={threadId:n.threadId,messageId:n.messageId};if(s==="flagged"){e({to:"/mail/flagged/$threadId/$messageId",params:u,search:o,hash:a});return}if(s==="mailbox"&&r){e({to:"/mail/$mailboxId/$threadId/$messageId",params:{...u,mailboxId:r},search:o,hash:a});return}e({to:"/mail/brief/$threadId/$messageId",params:u,search:o,hash:a})},[e,t,s,r,n])}const ye=e=>{const t=e.filter(n=>!n.isMultipart&&n.disposition!=="attachment"&&n.mediaType==="TEXT"&&n.contentUrl.length>0),s=t.find(n=>n.mediaSubtype.toUpperCase()==="HTML");if(s)return{kind:"html",contentUrl:s.contentUrl};const r=t.find(n=>n.mediaSubtype.toUpperCase()==="PLAIN");return r?{kind:"text",contentUrl:r.contentUrl}:null},R={all:["messages"],detail:e=>[...R.all,"detail",e],body:e=>[...R.detail(e),"body"]};class m extends Error{reason;status;retryAfterSeconds;constructor(t,s,r,n){super(s),this.name="BodyFetchError",this.reason=t,this.status=r,this.retryAfterSeconds=n}}const be=e=>{const t=Number.parseInt(e??"",10);return!Number.isFinite(t)||t<=0?1:Math.min(t,30)},Ie=8,xe="x-remit-403-reason",Re=(e,t)=>{const s=t?.trim()??"";return e===401?"auth":e===403?s.length>0?"auth":"body-missing":e===404?"body-missing":"generic"},ke=(e,t)=>(t??"").toLowerCase().startsWith("text/html")?/<div\s+id=["']root["']/i.test(e):!1,$e=(e,t)=>{const s=(t??"").toLowerCase();return!!(e==="text"&&s.startsWith("text/html"))},we=async(e,t,s=async()=>null)=>{const r={},n=await s();n&&(r.Authorization=`Bearer ${n}`);const o=await te(e,{headers:r});if(o.status===202)throw new m("not-ready","Message body is still syncing",202,be(o.headers.get("Retry-After")));if(!o.ok){const c=o.headers.get(xe),b=Re(o.status,c);throw new m(b,`Failed to load message body (${o.status} ${o.statusText})`,o.status)}const a=o.headers.get("content-type");if($e(t,a))throw new m("content-type-mismatch",`Refusing to render message body — expected ${t}, got Content-Type ${a}`);const u=await o.text();if(ke(u,a))throw new m("spa-shell-leak","Refusing to render message body — response looks like the SPA shell (CloudFront 403/404 fallback leaked through to /content/*)");return u},Ce=async(e,t)=>(t.isRetryAfterNotReady&&await e.refetchDescribeMessage(),e.fetchContent(t.contentUrl,t.kind)),je=({messageId:e,bodyParts:t,enabled:s=!0})=>{const r=t?ye(t):null,n=H(),{getToken:o}=z(),a=i.useRef(null),u=J(),c=i.useRef(!1),b=i.useRef(null),E=e&&r?`${e}:${r.contentUrl}`:null;b.current!==E&&(b.current=E,c.current=!1);const l=Z({queryKey:e?[...R.body(e),r?.contentUrl??null]:["messages","body","noop"],queryFn:()=>{if(!r)throw new Error("No renderable body part");if(!e)throw new Error("No messageId");const p=c.current;return c.current=!1,Ce({fetchContent:(d,j)=>we(d,j,o),refetchDescribeMessage:()=>u.refetchQueries({queryKey:ee({path:{messageId:e}})})},{contentUrl:r.contentUrl,kind:r.kind,isRetryAfterNotReady:p})},enabled:s&&!!e&&!!r,staleTime:300*1e3,gcTime:1800*1e3,retry:(p,d)=>d instanceof m&&d.reason==="not-ready"?p<Ie:p<1,retryDelay:(p,d)=>d instanceof m&&d.reason==="not-ready"?(c.current=!0,(d.retryAfterSeconds??1)*1e3):1e3,meta:{softError:!0}}),I=l.isLoading&&!!r;i.useEffect(()=>{I&&(a.current=performance.now())},[I]),i.useEffect(()=>{l.isSuccess&&a.current!==null&&(n.recordTiming("message.body.load",Math.round(performance.now()-a.current)),a.current=null)},[l.isSuccess,n]);const X=l.data&&r?{kind:r.kind,body:l.data}:void 0;return{picked:r,data:X,isLoading:I,isError:l.isError,error:l.error,refetch:l.refetch}};export{m as B,Ne as N,ne as a,re as b,Oe as c,Se as d,ve as e,Le as f,oe as g,Ke as h,ue as i,Pe as j,_e as k,Ae as l,Te as m,Be as n,y as o,qe as p,je as q,Ge as r,Ue as s,Fe as t,De as u,Qe as v,Xe as w,Re as x,C as y};
1
+ import{G as M,c2 as T,c3 as O,w as f,r as i,c4 as P,m as h,j as W,c5 as Y,c6 as V,W as H,k as z,n as J,s as Z,c7 as ee,c8 as te}from"./index-U21Ntcgp.js";import{u as se}from"./useMediaQuery-1f-g53mH.js";function re(e){const t=M({warn:e?.router===void 0}),s=e?.router||t;return T(s.stores.__store,O(e,s))}function ne(e){const t=M();return T(t.stores.location,O(e,t))}const A="/mail/brief",S="/mail/$mailboxId",v="/mail/outbox",L="/mail/flagged";function oe(e){for(const t of e){if(t.routeId===A)return{list:"brief"};if(t.routeId===L)return{list:"flagged"};if(t.routeId===v)return{list:"outbox"};if(t.routeId===S)return{list:"mailbox",mailboxId:t.params?.mailboxId}}}function Te(e){const t=e.split(/[?#]/)[0].split("/").filter(Boolean);if(t[0]!=="mail")return"";const s=t[1];return s?s==="brief"?A:s==="flagged"?L:s==="outbox"?v:ae(s):""}function Oe(e){if(typeof e!="object"||e===null)return"";const{q:t}=e;return typeof t=="string"?t:""}function ae(e){return`${S}:${e}`}function Pe(e,t){return e===t?!0:e.startsWith(`${t}/`)}function Ae(e){const t=e.split(/[?#]/)[0].split("/").filter(Boolean);return t[0]==="mail"&&t.length>2}function g(){const e=re({select:s=>oe(s.matches)?.list}),t=f({from:"/mail/$mailboxId",shouldThrow:!1});return{list:e,mailboxId:t?.mailboxId}}const k=["intelligence","nav","shortcuts"],ie=["nav","shortcuts"],ue=e=>ie.includes(e),ce=P(k);function x(e){const t=new Set(e.split(",").map(s=>ce.safeParse(s)).filter(s=>s.success).map(s=>s.data));return k.filter(s=>t.has(s))}function w(e){return k.filter(t=>e.includes(t)).join(",")}function Se(){const e=ne({select:t=>w(x(t.hash))});return i.useMemo(()=>x(e),[e])}const le=(e,t)=>!ue(e)&&t;function de(e){return(t="")=>w(x(t).filter(s=>le(s,e)))}function y(){const e=se();return i.useMemo(()=>de(e),[e])}function ve(){const e=h();return i.useCallback(t=>{e({search:!0,hash:w(t),replace:!0,hashScrollIntoView:!1})},[e])}const _="/mail/brief/compose/{-$outboxMessageId}",D="/mail/flagged/compose/{-$outboxMessageId}",B="/mail/outbox/compose/{-$outboxMessageId}",U="/mail/$mailboxId/compose/{-$outboxMessageId}";function F(){const e=f({from:_,shouldThrow:!1}),t=f({from:D,shouldThrow:!1}),s=f({from:B,shouldThrow:!1}),r=f({from:U,shouldThrow:!1});return e??t??s??r}function Le(){return F()!==void 0}function _e(){return F()?.outboxMessageId}function fe(e,t,s){return e==="flagged"?{to:D,params:{outboxMessageId:s}}:e==="outbox"?{to:B,params:{outboxMessageId:s}}:e==="mailbox"&&t?{to:U,params:{mailboxId:t,outboxMessageId:s}}:{to:_,params:{outboxMessageId:s}}}function C(){const e=h(),t=y(),{list:s,mailboxId:r}=g();return i.useCallback((n,o)=>{e({...fe(s,r,n),search:a=>a,hash:o?.keepPanels?!0:t,replace:o?.replace??!1})},[e,t,s,r])}function De(){const e=C();return i.useCallback(()=>e(void 0),[e])}function Be(){const e=C();return i.useCallback(t=>e(t),[e])}function Ue(){const e=C();return i.useCallback(t=>e(t,{replace:!0,keepPanels:!0}),[e])}function Fe(){const e=h(),t=y(),{list:s,mailboxId:r}=g();return i.useCallback(()=>{const n=a=>a,o=t;if(s==="flagged"){e({to:"/mail/flagged",search:n,hash:o});return}if(s==="outbox"){e({to:"/mail/outbox",search:n,hash:o});return}if(s==="mailbox"&&r){e({to:"/mail/$mailboxId",params:{mailboxId:r},search:n,hash:o});return}e({to:"/mail/brief",search:n,hash:o})},[e,t,s,r])}const me=Y(V);function Ne({fragment:e,...t}){const s=y();return W.jsx(me,{...t,hash:e??s})}const he=["reply","reply-all","forward"],pe=P(he),N="/mail/brief/$threadId/$messageId/$mode/{-$outboxMessageId}",K="/mail/flagged/$threadId/$messageId/$mode/{-$outboxMessageId}",q="/mail/$mailboxId/$threadId/$messageId/$mode/{-$outboxMessageId}";function G(){const e=f({from:N,shouldThrow:!1}),t=f({from:K,shouldThrow:!1}),s=f({from:q,shouldThrow:!1});return e??t??s}function $(){const e=G();return i.useMemo(()=>{if(!e)return;const t=pe.safeParse(e.mode);return t.success?{kind:"reply",mode:t.data,threadId:e.threadId,sourceMessageId:e.messageId,outboxMessageId:e.outboxMessageId}:{kind:"unknown",segment:e.mode}},[e])}function Ke(){return $()?.kind==="reply"}function Q(e,t,s,r){return e==="flagged"?{to:K,params:{...s,outboxMessageId:r}}:e==="mailbox"&&t?{to:q,params:{...s,mailboxId:t,outboxMessageId:r}}:{to:N,params:{...s,outboxMessageId:r}}}function ge(e,t){if(e?.kind==="reply"&&e.threadId===t.threadId&&e.sourceMessageId===t.messageId)return e.outboxMessageId}function qe(){const e=h(),t=y(),{list:s,mailboxId:r}=g(),n=$();return i.useCallback(o=>{e({...Q(s,r,o,ge(n,o)),search:a=>a,hash:t})},[e,t,s,r,n])}function Ge(e,t,s){if(!(!t||!s))return r=>e({threadId:t,messageId:s,mode:r})}function Qe(){const e=h(),{list:t,mailboxId:s}=g(),r=$();return i.useCallback(n=>{r?.kind==="reply"&&e({...Q(t,s,{threadId:r.threadId,messageId:r.sourceMessageId,mode:r.mode},n),search:o=>o,hash:!0,replace:!0})},[e,t,s,r])}function Xe(){const e=h(),t=y(),{list:s,mailboxId:r}=g(),n=G();return i.useCallback(()=>{if(!n)return;const o=c=>c,a=t,u={threadId:n.threadId,messageId:n.messageId};if(s==="flagged"){e({to:"/mail/flagged/$threadId/$messageId",params:u,search:o,hash:a});return}if(s==="mailbox"&&r){e({to:"/mail/$mailboxId/$threadId/$messageId",params:{...u,mailboxId:r},search:o,hash:a});return}e({to:"/mail/brief/$threadId/$messageId",params:u,search:o,hash:a})},[e,t,s,r,n])}const ye=e=>{const t=e.filter(n=>!n.isMultipart&&n.disposition!=="attachment"&&n.mediaType==="TEXT"&&n.contentUrl.length>0),s=t.find(n=>n.mediaSubtype.toUpperCase()==="HTML");if(s)return{kind:"html",contentUrl:s.contentUrl};const r=t.find(n=>n.mediaSubtype.toUpperCase()==="PLAIN");return r?{kind:"text",contentUrl:r.contentUrl}:null},R={all:["messages"],detail:e=>[...R.all,"detail",e],body:e=>[...R.detail(e),"body"]};class m extends Error{reason;status;retryAfterSeconds;constructor(t,s,r,n){super(s),this.name="BodyFetchError",this.reason=t,this.status=r,this.retryAfterSeconds=n}}const be=e=>{const t=Number.parseInt(e??"",10);return!Number.isFinite(t)||t<=0?1:Math.min(t,30)},Ie=8,xe="x-remit-403-reason",Re=(e,t)=>{const s=t?.trim()??"";return e===401?"auth":e===403?s.length>0?"auth":"body-missing":e===404?"body-missing":"generic"},ke=(e,t)=>(t??"").toLowerCase().startsWith("text/html")?/<div\s+id=["']root["']/i.test(e):!1,we=(e,t)=>{const s=(t??"").toLowerCase();return!!(e==="text"&&s.startsWith("text/html"))},Ce=async(e,t,s=async()=>null)=>{const r={},n=await s();n&&(r.Authorization=`Bearer ${n}`);const o=await te(e,{headers:r});if(o.status===202)throw new m("not-ready","Message body is still syncing",202,be(o.headers.get("Retry-After")));if(!o.ok){const c=o.headers.get(xe),b=Re(o.status,c);throw new m(b,`Failed to load message body (${o.status} ${o.statusText})`,o.status)}const a=o.headers.get("content-type");if(we(t,a))throw new m("content-type-mismatch",`Refusing to render message body — expected ${t}, got Content-Type ${a}`);const u=await o.text();if(ke(u,a))throw new m("spa-shell-leak","Refusing to render message body — response looks like the SPA shell (CloudFront 403/404 fallback leaked through to /content/*)");return u},$e=async(e,t)=>(t.isRetryAfterNotReady&&await e.refetchDescribeMessage(),e.fetchContent(t.contentUrl,t.kind)),je=({messageId:e,bodyParts:t,enabled:s=!0})=>{const r=t?ye(t):null,n=H(),{getToken:o}=z(),a=i.useRef(null),u=J(),c=i.useRef(!1),b=i.useRef(null),E=e&&r?`${e}:${r.contentUrl}`:null;b.current!==E&&(b.current=E,c.current=!1);const l=Z({queryKey:e?[...R.body(e),r?.contentUrl??null]:["messages","body","noop"],queryFn:()=>{if(!r)throw new Error("No renderable body part");if(!e)throw new Error("No messageId");const p=c.current;return c.current=!1,$e({fetchContent:(d,j)=>Ce(d,j,o),refetchDescribeMessage:()=>u.refetchQueries({queryKey:ee({path:{messageId:e}})})},{contentUrl:r.contentUrl,kind:r.kind,isRetryAfterNotReady:p})},enabled:s&&!!e&&!!r,staleTime:300*1e3,gcTime:1800*1e3,retry:(p,d)=>d instanceof m&&d.reason==="not-ready"?p<Ie:p<1,retryDelay:(p,d)=>d instanceof m&&d.reason==="not-ready"?(c.current=!0,(d.retryAfterSeconds??1)*1e3):1e3,meta:{softError:!0}}),I=l.isLoading&&!!r;i.useEffect(()=>{I&&(a.current=performance.now())},[I]),i.useEffect(()=>{l.isSuccess&&a.current!==null&&(n.recordTiming("message.body.load",Math.round(performance.now()-a.current)),a.current=null)},[l.isSuccess,n]);const X=l.data&&r?{kind:r.kind,body:l.data}:void 0;return{picked:r,data:X,isLoading:I,isError:l.isError,error:l.error,refetch:l.refetch}};export{m as B,Ne as N,ne as a,re as b,Oe as c,Se as d,ve as e,Le as f,oe as g,Ke as h,ue as i,Pe as j,_e as k,Ae as l,Te as m,Be as n,y as o,qe as p,je as q,Ge as r,Ue as s,Fe as t,De as u,Qe as v,Xe as w,Re as x,$ as y};
@@ -1 +1 @@
1
- import{j as E,e as q,b as j,B as D,r as i,ax as R,n as C,l as K,W as A,K as Q,J as $,L as z,N as B}from"./index-CP_u7qA0.js";import{C as G}from"./circle-check-big-BLaZbuG9.js";import{R as H,c as N}from"./search-token-index-CG7hPaco.js";function oe({state:e,onRefresh:t,label:s,errorMessage:a,hasUpdate:n,size:u="sm",className:c}){const o=e==="refreshing",f=e==="error",h=e==="success",g=f?E.jsx(q,{className:"size-4 text-danger"}):h?E.jsx(G,{className:"size-4 text-positive"}):E.jsx(H,{className:j("size-4",o&&"animate-spin")}),y=f?`${s} — failed: ${a??"try again"}`:o?`${s} — refreshing`:h?`${s} — up to date`:n?`${s} — new mail`:s;return E.jsxs("div",{className:"relative inline-flex",children:[E.jsx(D,{variant:"ghost",size:u,icon:g,onClick:t,disabled:o,"aria-label":y,"aria-busy":o||void 0,title:f?a:s,className:c}),e==="idle"&&n&&E.jsx("span",{"aria-hidden":"true",className:"absolute right-1 top-1 size-1.5 rounded-full bg-accent-2"})]})}const W=new Set(["discovering_mailboxes","syncing_inbox","syncing_others"]);function P(e){return!!e&&W.has(e)}const L=3e3,U=L*2,M={syncing:!1,resolved:!1,synced:0,total:0};function ie(e,t){const s=e.join(","),[a,n]=i.useState(!1),[u,c]=i.useState(!1);i.useEffect(()=>{n(!1),c(!1)},[s,t]),i.useEffect(()=>{if(!t)return;const r=setTimeout(()=>c(!0),U);return()=>clearTimeout(r)},[s,t]);const o=N({queries:e.map(r=>({...R({path:{accountId:r}}),enabled:t&&!a,refetchInterval:L,meta:{softError:!0}}))}),f=o.every(r=>r.isSuccess||r.isError),h=o.length===0||f||u;let g=!1,y=0,w=0;for(const r of o)if(P(r.data?.syncPhase)){g=!0;for(const l of r.data?.mailboxes??[])y+=l.messagesSynced,w+=l.messagesTotal}const S=t&&h&&!g;return i.useEffect(()=>{S&&n(!0)},[S]),!t||!h?M:{syncing:g,resolved:!0,synced:y,total:w}}const k=6e4,I=new Set(["sent","drafts","trash","archive"]),v=(e,t)=>{const s=new Map;for(const a of e){const n=t.get(a.mailboxId)?.role;n&&I.has(n)||s.set(a.mailboxId,a.messagesTotal)}return s},J=(e,t)=>{for(const[s,a]of t)if(a>(e.get(s)??0))return!0;return!1},_=i.createContext(null),X=()=>{const e=i.useContext(_);if(!e)throw new Error("useMailFreshness must be used inside <MailFreshnessProvider>");return e};function ce({accountIds:e,children:t}){const s=C(),{resultFolderIndex:a}=K(),n=i.useRef(new Map),u=i.useRef(new Set),[c,o]=i.useState(new Set),f=N({queries:e.map(r=>({...R({path:{accountId:r}}),refetchInterval:k,staleTime:k,meta:{softError:!0}}))}),h=f.map(r=>r.dataUpdatedAt).join(","),g=e.join(",");i.useEffect(()=>{let r=!1;const l=new Set(c);e.forEach((d,x)=>{const p=f[x]?.data;if(!p)return;const m=v(p.mailboxes??[],a);if(!u.current.has(d)){u.current.add(d),n.current.set(d,m);return}if(l.has(d))return;const T=n.current.get(d)??new Map;J(T,m)&&(l.add(d),r=!0)}),r&&o(l)},[g,h]);const y=i.useCallback(r=>r.some(l=>c.has(l)),[c]),w=i.useCallback(r=>{o(l=>{if(r.every(x=>!l.has(x)))return l;const d=new Set(l);for(const x of r)d.delete(x);return d});for(const l of r){const d=s.getQueryData(R({path:{accountId:l}}).queryKey);n.current.set(l,v(d?.mailboxes??[],a)),u.current.add(l)}},[s,a]),S=i.useMemo(()=>({hasNewMail:y,acknowledge:w}),[y,w]);return E.jsx(_.Provider,{value:S,children:t})}const V=2e3,Y=45e3,Z=e=>new Promise(t=>setTimeout(t,e)),b=e=>e instanceof Error&&e.message?e.message:"Something went wrong",ee=e=>{z(e,{softError:!0},"user")&&B(e)},F=e=>e.reduce((t,s)=>Math.max(t,s.lastSyncedAt??0),0),O=(e,t)=>e.fetchQuery({...R({path:{accountId:t}}),staleTime:0}),se=async(e,t,s,a)=>{let n=!1;for(;;){const u=await O(e,t).then(f=>({ok:!0,data:f})).catch(f=>({ok:!1,error:f}));if(!u.ok)return{accountId:t,message:b(u.error)};const{syncPhase:c,mailboxes:o}=u.data;if(P(c))n=!0;else if(n||F(o??[])>s)return c==="error"?{accountId:t,message:"Sync failed for this account"}:void 0;if(Date.now()>=a)return{accountId:t,message:"Refresh is taking longer than usual"};await Z(V)}},te=async(e,t,s,a)=>{const n=await O(e,s).then(o=>({ok:!0,maxLastSynced:F(o.mailboxes??[])})).catch(o=>({ok:!1,error:o}));if(!n.ok)return{accountId:s,enqueued:!1,ok:!1,message:b(n.error)};const u=await $({path:{accountId:s},throwOnError:!0}).then(()=>({ok:!0})).catch(o=>({ok:!1,error:o}));if(!u.ok)return ee(u.error),{accountId:s,enqueued:!1,ok:!1,message:b(u.error)};t.recordEvent("sync.triggered");const c=await se(e,s,n.maxLastSynced,a);return c?{accountId:s,enqueued:!0,ok:!1,message:c.message}:{accountId:s,enqueued:!0,ok:!0}},ue=(e,t={})=>{const s=C(),a=A(),{acknowledge:n}=X(),[u,c]=i.useState("idle"),[o,f]=i.useState(),h=i.useRef(0),g=i.useRef(e);g.current=e;const y=i.useRef(t);y.current=t,i.useEffect(()=>{if(u!=="success")return;const S=setTimeout(()=>c("idle"),2e3);return()=>clearTimeout(S)},[u]);const w=i.useCallback(()=>{const S=g.current;if(S.length===0){c("error"),f("Nothing to refresh yet");return}const r=++h.current;c("refreshing"),f(void 0),(async()=>{const l=Date.now()+Y,d=await Promise.all(S.map(m=>te(s,a,m,l)));if(h.current!==r)return;const x=d.filter(m=>m.enqueued).map(m=>m.accountId);for(const m of x)s.invalidateQueries({queryKey:Q({path:{accountId:m}})});x.length>0&&(y.current.onSettled?.(),n(x));const p=d.filter(m=>!m.ok);p.length===0?c("success"):(c("error"),f(p[0]?.message))})()},[n,s,a]);return{state:u,errorMessage:o,refresh:w}};export{ce as M,oe as R,ue as a,ie as b,P as i,X as u};
1
+ import{j as E,e as q,b as j,B as D,r as i,ax as R,n as C,l as K,W as A,K as Q,J as $,L as z,N as B}from"./index-U21Ntcgp.js";import{C as G}from"./circle-check-big-DL6yaJ7B.js";import{R as H,c as N}from"./search-token-index-CS3Ahk2_.js";function oe({state:e,onRefresh:t,label:s,errorMessage:a,hasUpdate:n,size:u="sm",className:c}){const o=e==="refreshing",f=e==="error",h=e==="success",g=f?E.jsx(q,{className:"size-4 text-danger"}):h?E.jsx(G,{className:"size-4 text-positive"}):E.jsx(H,{className:j("size-4",o&&"animate-spin")}),y=f?`${s} — failed: ${a??"try again"}`:o?`${s} — refreshing`:h?`${s} — up to date`:n?`${s} — new mail`:s;return E.jsxs("div",{className:"relative inline-flex",children:[E.jsx(D,{variant:"ghost",size:u,icon:g,onClick:t,disabled:o,"aria-label":y,"aria-busy":o||void 0,title:f?a:s,className:c}),e==="idle"&&n&&E.jsx("span",{"aria-hidden":"true",className:"absolute right-1 top-1 size-1.5 rounded-full bg-accent-2"})]})}const W=new Set(["discovering_mailboxes","syncing_inbox","syncing_others"]);function P(e){return!!e&&W.has(e)}const L=3e3,U=L*2,M={syncing:!1,resolved:!1,synced:0,total:0};function ie(e,t){const s=e.join(","),[a,n]=i.useState(!1),[u,c]=i.useState(!1);i.useEffect(()=>{n(!1),c(!1)},[s,t]),i.useEffect(()=>{if(!t)return;const r=setTimeout(()=>c(!0),U);return()=>clearTimeout(r)},[s,t]);const o=N({queries:e.map(r=>({...R({path:{accountId:r}}),enabled:t&&!a,refetchInterval:L,meta:{softError:!0}}))}),f=o.every(r=>r.isSuccess||r.isError),h=o.length===0||f||u;let g=!1,y=0,w=0;for(const r of o)if(P(r.data?.syncPhase)){g=!0;for(const l of r.data?.mailboxes??[])y+=l.messagesSynced,w+=l.messagesTotal}const S=t&&h&&!g;return i.useEffect(()=>{S&&n(!0)},[S]),!t||!h?M:{syncing:g,resolved:!0,synced:y,total:w}}const k=6e4,I=new Set(["sent","drafts","trash","archive"]),v=(e,t)=>{const s=new Map;for(const a of e){const n=t.get(a.mailboxId)?.role;n&&I.has(n)||s.set(a.mailboxId,a.messagesTotal)}return s},J=(e,t)=>{for(const[s,a]of t)if(a>(e.get(s)??0))return!0;return!1},_=i.createContext(null),X=()=>{const e=i.useContext(_);if(!e)throw new Error("useMailFreshness must be used inside <MailFreshnessProvider>");return e};function ce({accountIds:e,children:t}){const s=C(),{resultFolderIndex:a}=K(),n=i.useRef(new Map),u=i.useRef(new Set),[c,o]=i.useState(new Set),f=N({queries:e.map(r=>({...R({path:{accountId:r}}),refetchInterval:k,staleTime:k,meta:{softError:!0}}))}),h=f.map(r=>r.dataUpdatedAt).join(","),g=e.join(",");i.useEffect(()=>{let r=!1;const l=new Set(c);e.forEach((d,x)=>{const p=f[x]?.data;if(!p)return;const m=v(p.mailboxes??[],a);if(!u.current.has(d)){u.current.add(d),n.current.set(d,m);return}if(l.has(d))return;const T=n.current.get(d)??new Map;J(T,m)&&(l.add(d),r=!0)}),r&&o(l)},[g,h]);const y=i.useCallback(r=>r.some(l=>c.has(l)),[c]),w=i.useCallback(r=>{o(l=>{if(r.every(x=>!l.has(x)))return l;const d=new Set(l);for(const x of r)d.delete(x);return d});for(const l of r){const d=s.getQueryData(R({path:{accountId:l}}).queryKey);n.current.set(l,v(d?.mailboxes??[],a)),u.current.add(l)}},[s,a]),S=i.useMemo(()=>({hasNewMail:y,acknowledge:w}),[y,w]);return E.jsx(_.Provider,{value:S,children:t})}const V=2e3,Y=45e3,Z=e=>new Promise(t=>setTimeout(t,e)),b=e=>e instanceof Error&&e.message?e.message:"Something went wrong",ee=e=>{z(e,{softError:!0},"user")&&B(e)},F=e=>e.reduce((t,s)=>Math.max(t,s.lastSyncedAt??0),0),O=(e,t)=>e.fetchQuery({...R({path:{accountId:t}}),staleTime:0}),se=async(e,t,s,a)=>{let n=!1;for(;;){const u=await O(e,t).then(f=>({ok:!0,data:f})).catch(f=>({ok:!1,error:f}));if(!u.ok)return{accountId:t,message:b(u.error)};const{syncPhase:c,mailboxes:o}=u.data;if(P(c))n=!0;else if(n||F(o??[])>s)return c==="error"?{accountId:t,message:"Sync failed for this account"}:void 0;if(Date.now()>=a)return{accountId:t,message:"Refresh is taking longer than usual"};await Z(V)}},te=async(e,t,s,a)=>{const n=await O(e,s).then(o=>({ok:!0,maxLastSynced:F(o.mailboxes??[])})).catch(o=>({ok:!1,error:o}));if(!n.ok)return{accountId:s,enqueued:!1,ok:!1,message:b(n.error)};const u=await $({path:{accountId:s},throwOnError:!0}).then(()=>({ok:!0})).catch(o=>({ok:!1,error:o}));if(!u.ok)return ee(u.error),{accountId:s,enqueued:!1,ok:!1,message:b(u.error)};t.recordEvent("sync.triggered");const c=await se(e,s,n.maxLastSynced,a);return c?{accountId:s,enqueued:!0,ok:!1,message:c.message}:{accountId:s,enqueued:!0,ok:!0}},ue=(e,t={})=>{const s=C(),a=A(),{acknowledge:n}=X(),[u,c]=i.useState("idle"),[o,f]=i.useState(),h=i.useRef(0),g=i.useRef(e);g.current=e;const y=i.useRef(t);y.current=t,i.useEffect(()=>{if(u!=="success")return;const S=setTimeout(()=>c("idle"),2e3);return()=>clearTimeout(S)},[u]);const w=i.useCallback(()=>{const S=g.current;if(S.length===0){c("error"),f("Nothing to refresh yet");return}const r=++h.current;c("refreshing"),f(void 0),(async()=>{const l=Date.now()+Y,d=await Promise.all(S.map(m=>te(s,a,m,l)));if(h.current!==r)return;const x=d.filter(m=>m.enqueued).map(m=>m.accountId);for(const m of x)s.invalidateQueries({queryKey:Q({path:{accountId:m}})});x.length>0&&(y.current.onSettled?.(),n(x));const p=d.filter(m=>!m.ok);p.length===0?c("success"):(c("error"),f(p[0]?.message))})()},[n,s,a]);return{state:u,errorMessage:o,refresh:w}};export{ce as M,oe as R,ue as a,ie as b,P as i,X as u};
@@ -1 +1 @@
1
- import{m as v,l as x,r as I}from"./index-CP_u7qA0.js";import{b as p,f as b,h as g,c as Q}from"./useMessageBodyContent-gWn_VAyS.js";import{b as q}from"./search-view-CNPgAIwM.js";function W(a){const t=v(),{searchInput:n,searchQuery:e}=x(),i=p({select:o=>Q(o.location.search)}),u=p({select:o=>o.location.pathname}),h=b(),f=g(),m=h||f,{to:s}=a,r="params"in a?a.params.mailboxId:void 0,l=r?`/mail/${r}`:s;I.useEffect(()=>{if(!q({searchInput:n,committedQuery:e,urlQuery:i,pathname:u,listPath:l}))return;const y=!!e&&i!==e&&!m,c=d=>({...d,q:e||void 0});if(!y){t({to:".",search:c,hash:!0,replace:!0});return}if(s==="/mail/$mailboxId"){if(!r)return;t({to:s,params:{mailboxId:r},search:c,hash:!0,replace:!0});return}t({to:s,search:c,hash:!0,replace:!0})},[n,e,i,t,s,r,l,u,m])}export{W as u};
1
+ import{m as v,l as x,r as I}from"./index-U21Ntcgp.js";import{b as p,f as b,h as g,c as Q}from"./useMessageBodyContent-CK3UpsN8.js";import{b as q}from"./search-view-Cux0U-2s.js";function W(a){const t=v(),{searchInput:n,searchQuery:e}=x(),i=p({select:o=>Q(o.location.search)}),u=p({select:o=>o.location.pathname}),h=b(),f=g(),m=h||f,{to:s}=a,r="params"in a?a.params.mailboxId:void 0,l=r?`/mail/${r}`:s;I.useEffect(()=>{if(!q({searchInput:n,committedQuery:e,urlQuery:i,pathname:u,listPath:l}))return;const y=!!e&&i!==e&&!m,c=d=>({...d,q:e||void 0});if(!y){t({to:".",search:c,hash:!0,replace:!0});return}if(s==="/mail/$mailboxId"){if(!r)return;t({to:s,params:{mailboxId:r},search:c,hash:!0,replace:!0});return}t({to:s,search:c,hash:!0,replace:!0})},[n,e,i,t,s,r,l,u,m])}export{W as u};
@@ -1,4 +1,4 @@
1
- import{c9 as V,r as g,j as a,b,I as Q,n as q,a5 as Y,a7 as X,a8 as Z,c4 as J,bh as ee,k as te,e as se,X as re,br as L,l as ne}from"./index-CP_u7qA0.js";import{K as k}from"./kbd-BaSoxAuP.js";import{B as ae,q as oe,b as ie}from"./useMessageBodyContent-gWn_VAyS.js";import{i as ce}from"./search-scope-BQ8HHXSV.js";const le=(e,t)=>{const r=e==="newsletter"||e==="marketing"||t;return{framed:r,isPlain:!r}},de=()=>`
1
+ import{cc as V,r as g,j as a,b,I as Q,n as q,a5 as Y,a7 as X,a8 as Z,c7 as J,bh as ee,k as te,e as se,X as re,bv as L,l as ne}from"./index-U21Ntcgp.js";import{K as k}from"./kbd-BW1x90_8.js";import{B as ae,q as oe,b as ie}from"./useMessageBodyContent-CK3UpsN8.js";import{i as ce}from"./search-scope-BsXhL0sT.js";const le=(e,t)=>{const r=e==="newsletter"||e==="marketing"||t;return{framed:r,isPlain:!r}},de=()=>`
2
2
  /* Zero the UA default body margin and clamp the document to the iframe width so
3
3
  wide author markup can't push the body (and the page) past the viewport. */
4
4
  html, body {
@@ -0,0 +1 @@
1
+ import{n as M,a5 as C,a7 as E,bs as I,bE as k,r as x,j as d,bF as h,bG as A,bH as j,l as R,s as Q,bI as D,bv as O}from"./index-U21Ntcgp.js";import{P}from"./attachment-file-CC7sUq_3.js";import{E as _,F as z,ao as F,ap as N}from"./MailListHeader-CyuJdrqg.js";import{a as q}from"./useLabels-DiDFA7ER.js";import{b as G}from"./useMessageBodyContent-CK3UpsN8.js";import{n as U}from"./search-query-Cr_ZXBCp.js";import{s as w}from"./search-scope-BsXhL0sT.js";import{u as B,p as H}from"./useSearchTokenContext-Drg7CMEN.js";const K=t=>{const{mailboxId:a,messages:i}=t,l=M(),{pushError:c}=C(),{mutateAsync:n,isPending:s}=E({...k(),onError:(o,u)=>{c({title:u.body.action==="Remove"?"Couldn't remove label":"Couldn't apply label",detail:I(o),error:o})},onSettled:(o,u,m)=>{_(l,z(F(m.body.messageIds??[],i??[],a)))}});return{applyLabel:x.useCallback((o,u,m)=>{o.length!==0&&N(o,p=>n({body:{messageIds:p,labelId:u,action:m}}))},[n]),isPending:s}};function re({accountId:t,mailboxId:a,messageIds:i}){const{labels:l}=q(t),{applyLabel:c}=K({mailboxId:a}),n=x.useMemo(()=>l.map(s=>({key:s.labelId,label:s.name,icon:d.jsx("span",{className:`size-2.5 rounded-full ${A(s.color)?h[s.color]:h.Default}`}),onSelect:()=>c(i,s.labelId,"Apply")})),[l,i,c]);return n.length===0?null:d.jsx(P,{triggerLabel:"Apply label to selected messages",triggerIcon:d.jsx(j,{className:"size-4 text-fg-subtle"}),triggerText:"Apply label",items:n,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 V=20,$=new Set(Object.values(O)),J=t=>t!==void 0&&$.has(t)?t:void 0,W=t=>{if(t.some(a=>a.type==="isUnread"))return!1;if(t.some(a=>a.type==="isRead"))return!0};function ne({mailboxId:t,filterCategory:a}={}){const{searchQuery:i}=R(),l=B(),c=G({select:e=>e.matches}),n=U(i),{freeText:s,tokens:r}=H(n,l),o=s.length>0,u=r.find(e=>e.type==="category"),m=J(a)??u?.category,p=r.some(e=>e.type==="hasAttachment")?!0:void 0,b=r.some(e=>e.type==="isStarred")?!0:void 0,y=W(r),f=r.find(e=>e.type==="after"),g=r.find(e=>e.type==="before"),S=r.find(e=>e.type==="in"),v=w({matches:c,callerMailboxId:t,inTokenMailboxId:S?.mailboxId}),{data:T,isLoading:L}=Q({...D({query:{query:s,mailboxId:v,limit:V,...m!==void 0?{category:m}:{},...p!==void 0?{hasAttachment:p}:{},...b!==void 0?{hasStars:b}:{},...y!==void 0?{isRead:y}:{},...f?{sentDateFrom:f.epochSeconds}:{},...g?{sentDateTo:g.epochSeconds}:{}}}),enabled:o,staleTime:6e4});return{hits:T?.items??[],isLoading:o&&L}}export{re as L,ne as u};
@@ -1 +1 @@
1
- import{n as g,a5 as p,s as f,Q as m,r,a7 as y,a8 as T,V as E,a9 as x}from"./index-CP_u7qA0.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(a=>a.accountId===e);return t?{html:t.signatureHtml??"",plainText:t.signaturePlainText??""}:i},[e,n]),s=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,a)=>{e&&s.mutate({path:{accountId:e},body:{signatureHtml:t,signaturePlainText:a}})},[e,s]);return{signature:l,setSignature:c,isSaving:s.isPending}};export{d as u};
1
+ import{n as g,a5 as p,s as f,Q as m,r,a7 as y,a8 as T,V as E,a9 as x}from"./index-U21Ntcgp.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(a=>a.accountId===e);return t?{html:t.signatureHtml??"",plainText:t.signaturePlainText??""}:i},[e,n]),s=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,a)=>{e&&s.mutate({path:{accountId:e},body:{signatureHtml:t,signaturePlainText:a}})},[e,s]);return{signature:l,setSignature:c,isSaving:s.isPending}};export{d as u};
package/index.html CHANGED
@@ -38,8 +38,8 @@
38
38
  } catch (_) {}
39
39
  })();
40
40
  </script>
41
- <script type="module" crossorigin src="/assets/index-CP_u7qA0.js"></script>
42
- <link rel="stylesheet" crossorigin href="/assets/index-DQPXHKId.css">
41
+ <script type="module" crossorigin src="/assets/index-U21Ntcgp.js"></script>
42
+ <link rel="stylesheet" crossorigin href="/assets/index-OWhz0EKb.css">
43
43
  </head>
44
44
  <body>
45
45
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/web-client-dist",
3
- "version": "0.0.403",
3
+ "version": "0.0.404",
4
4
  "description": "Built Remit web client — static assets and the default runtime config.",
5
5
  "files": [
6
6
  "**/*"
@@ -1 +0,0 @@
1
- import{j as a,af as Xe,S as Ze,bu as es,l as G,bn as ss,m as oe,r as o,s as ae,bv as ne,q as ts,bw as as,bx as ns,by as os,e as we,bz as rs}from"./index-CP_u7qA0.js";import{s as Re,a as is,b as Te,u as ls,p as cs,R as ds}from"./useSearchTokenContext-Rec5qr0P.js";import{a6 as ve,E as ye,a7 as us,a8 as ms,F as fs,a9 as Se,aa as hs,ab as gs,ac as xs,a5 as ps,ad as Is,ae as bs,af as vs,M as ys,ag as Ss,ah as Cs,ai as js,e as ws,v as Rs,aj as Ts,q as Ms,S as ks,I as Fs,N as Ce,L as As,J as Ns,d as Os,X as Bs,Y as Ds,_ as Me,$ as ke,a0 as Ls,a1 as Es,a2 as Ps}from"./MailListHeader-D9UyUWpO.js";import{u as qs,a as zs,R as Qs,i as Hs,b as _s}from"./useRefreshControl-CEi6jGL4.js";import{e as $s,c as Ws,R as Us}from"./search-token-index-CG7hPaco.js";import{a as Vs}from"./useLabels-Bxa6Xpyj.js";import{u as Ys}from"./useMediaQuery-kszmEDQl.js";import{u as Gs,L as Js}from"./useSemanticSearch-CAmlG47i.js";import{w as Ks}from"./wizard-selection-B1bng5Jq.js";import{o as Xs,f as Zs,h as et,p as st,r as tt}from"./useMessageBodyContent-gWn_VAyS.js";function at({sync:e}){return e?a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",role:"status","aria-live":"polite",children:[a.jsx(Xe,{className:"size-8 animate-spin text-fg-subtle","aria-hidden":"true"}),a.jsx("p",{className:"text-sm font-medium text-fg",children:"Still syncing your mail"}),a.jsx("p",{className:"text-xs text-fg-subtle",children:nt(e)})]}):a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",children:[a.jsx(Ze,{className:"size-8 text-fg-subtle","aria-hidden":"true"}),a.jsx("p",{className:"text-sm font-medium text-fg",children:"You're caught up"}),a.jsx("p",{className:"text-xs text-fg-subtle",children:"Nothing needs attention."})]})}function nt({synced:e,total:s}){return s>0?`${e.toLocaleString()} of ${s.toLocaleString()} messages downloaded. This list fills in as they arrive.`:"Downloading your messages. This list fills in as they arrive."}const Fe=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],Ae="category",ot={unclassified:"uncategorized"},$=e=>is(e).map(s=>s.raw),_=e=>e.join(" "),re=e=>{const s=Te(e);if(s)return Fe.find(n=>n.name===s.name&&n.value===s.value.toLowerCase())?.id},ie=e=>{const s=Te(e);if(!s||s.name!==Ae)return;const n=s.value.toLowerCase(),r=ot[n];if(r)return r;if(!(!es(n)||n==="all"))return n},Ne=e=>Fe.find(s=>s.id===e),Oe=e=>Ne(e)!==void 0,rt=e=>{const s=new Set;for(const n of $(e)){const r=re(n);r&&s.add(r)}return s},it=e=>{let s="all";for(const n of $(e)){const r=ie(n);r&&(s=r)}return s},lt=(e,s)=>{const n=Ne(s);if(!n)return;const r=$(e),d=r.filter(l=>re(l)!==s);return d.length<r.length?_(d):_([...r,Re(n.name,n.value)])},ct=(e,s)=>{const n=$(e).filter(r=>!ie(r));return _(s==="all"?n:[...n,Re(Ae,s)])},dt=e=>_($(e).filter(s=>!re(s)&&!ie(s))),Be=e=>e.trim().length>0,ut=e=>{if(!Be(e.query))return e.ownFilters;const s=new Set(rt(e.query));for(const n of e.ownFilters)Oe(n)||s.add(n);return s},mt=e=>Be(e.query)?it(e.query):e.ownCategory,ft=(e,s)=>e.createdAt!==s.createdAt?e.createdAt-s.createdAt:e.accountId.localeCompare(s.accountId),ht=e=>[...e].sort(ft),gt=200,je=()=>a.jsx("div",{className:"animate-pulse",children:Array.from({length:3}).map((e,s)=>a.jsxs("div",{className:"flex items-start gap-3 py-2 pl-5 pr-4 border-b border-line",children:[a.jsx("div",{className:"size-7 rounded-full bg-surface-sunken shrink-0 mt-0.5"}),a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsxs("div",{className:"flex justify-between gap-2",children:[a.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-28"}),a.jsx("div",{className:"h-3 bg-surface-sunken rounded w-12"})]}),a.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-48"}),a.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})]})]},s))}),xt=({accountEmail:e})=>{const s=oe();return a.jsxs("div",{className:"flex items-center gap-2 px-row-inset py-2 border-b border-line bg-danger-soft/40 text-xs text-danger",children:[a.jsx(we,{className:"size-3.5 shrink-0"}),a.jsxs("span",{className:"flex-1 truncate",children:[e," can't connect"]}),a.jsx("button",{type:"button",onClick:()=>s({to:"/settings/accounts"}),className:"shrink-0 underline text-danger hover:opacity-80",children:"Reconnect"})]})},pt=(e,s)=>{if(s.size===0)return{};const n=new Set,r=new Set;for(const l of e)s.has(l.id)&&(l.accountId&&n.add(l.accountId),l.mailboxId&&r.add(l.mailboxId));if(n.size>1)return{restriction:"spansAccounts",moveDisabledHint:"Move only works within one account — clear selection or pick messages from a single account"};const d=n.size===1?[...n][0]:void 0;return r.size>1?{accountId:d,restriction:"spansFolders",moveDisabledHint:`Move only works within one folder — this selection spans ${r.size} folders`}:{accountId:d,mailboxId:r.size===1?[...r][0]:void 0}};function It({header:e,rows:s,wizard:n,children:r}){const{selectedIds:d,selectedCount:l,exitSelection:f,orderedIds:u,allSelected:h,toggleAllLoaded:y}=js(),x=o.useMemo(()=>pt(s,d),[s,d]),{junkMailboxId:p}=ws(x.accountId),{labels:I}=Vs(x.accountId),A=o.useMemo(()=>Array.from(d),[d]),L=o.useMemo(()=>Ks(s,d),[s,d]),m=Rs(p,x.mailboxId),b=o.useMemo(()=>u.length>0?{checked:h,indeterminate:l>0&&!h,onChange:y}:void 0,[u.length,h,l,y]),N=x.moveDisabledHint?{tone:"warning",text:x.moveDisabledHint}:void 0,S=C=>a.jsx(ks,{title:C.title,navSlot:C.navSlot,titleMeta:C.titleMeta,searchSlot:C.searchSlot,searchField:C.searchField,idleSlot:C.makeFilterSlot,count:l,onCancel:f,onDelete:()=>n.start("delete"),onMove:()=>n.start("move"),onOrganize:()=>n.start("organize"),onJunk:m?()=>n.start("junk"):void 0,onMarkRead:()=>n.start("markRead"),overflowSlot:x.accountId&&x.mailboxId&&l>0&&I.length>0?a.jsx(Js,{accountId:x.accountId,mailboxId:x.mailboxId,messageIds:A}):void 0,selectAll:b,notice:N});return a.jsx(Ts,{...e,selectionBar:S,paneOverlay:a.jsx(Ms,{verb:n.verb,accountId:x.accountId,mailboxId:x.mailboxId,selection:L,selectionRestriction:x.restriction,onFinished:f}),children:r})}function bt({accounts:e,selectedMessageId:s,onOpenThread:n,commandsRef:r,onTriageContextChange:d,onDeleteMessages:l}){const{searchQuery:f,searchInput:u,resultFolderIndex:h,onSearchChange:y}=G(),x=ls(),p=Ys(),I=$s(),A=ss(),L=oe(),m=o.useMemo(()=>ht(e.filter(t=>!t.muted?.value)),[e]),[b,N]=o.useState("all"),[S,C]=o.useState("all"),[W,E]=o.useState(new Set),[K,j]=o.useState(!1),P=o.useCallback(t=>{E(i=>{const c=new Set(i);return c.has(t)?c.delete(t):c.add(t),c})},[]),U=o.useCallback(()=>E(new Set),[]),R=u.trim().length>0,w=o.useMemo(()=>ut({query:u,ownFilters:W}),[u,W]),T=o.useMemo(()=>mt({query:u,ownCategory:S}),[u,S]),O=o.useCallback(t=>{if(!R||!Oe(t)){P(t);return}const i=lt(u,t);i!==void 0&&y(i)},[R,u,y,P]),q=o.useCallback(t=>{if(!R){C(t);return}y(ct(u,t))},[R,u,y]),z=o.useCallback(()=>{C("all"),N("all"),U(),R&&y(dt(u))},[R,u,y,U]),{data:B,isLoading:Q,isError:g,refetch:D}=ae({...ne(),staleTime:6e4}),M=Ws({queries:m.map(t=>({...ts({path:{accountId:t.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),V=o.useMemo(()=>{const t=new Map;for(let i=0;i<m.length;i++){const c=m[i].accountId,Ge=(M[i]?.data?.items??[]).reduce((Je,Ke)=>Je+(Ke.unseenCount??0),0);t.set(c,Ge)}return t},[m,M]),Ee=o.useMemo(()=>m.filter((t,i)=>{const c=M[i];return c?.isError?!as(c.error):!1}),[m,M]),{freeText:k,tokens:X}=cs(f.trim().toLowerCase(),x),{data:le,isFetching:Pe}=ae({...ne({query:{query:k,limit:gt}}),enabled:k.length>0,staleTime:3e4}),v=o.useMemo(()=>{const t=ve(B?.items??[]).map(ye);return(k?us(t.filter(c=>ms(c,k)),ve(le?.items??[]).map(ye)):t).filter(c=>(b==="all"||c.accountId===b)&&fs(c,X))},[B,le,b,k,X]),{bodyRows:ce,briefSpamOffer:Z}=o.useMemo(()=>{if(!k)return{bodyRows:v,briefSpamOffer:void 0};const t=v.map(F=>Se(F,h)),{spam:i}=hs(t);if(i.length===0)return{bodyRows:v,briefSpamOffer:void 0};const c=new Set(i.map(F=>F.id));return{bodyRows:v.filter(F=>!c.has(F.id)),briefSpamOffer:gs(t)}},[v,k,h]),de=o.useMemo(()=>xs(ce),[ce]),ue=o.useCallback((t,i)=>{const c=v.find(F=>F.id===t)?.threadId;c&&n?.({threadId:c,messageId:t},i)},[v,n]),qe=o.useCallback(t=>{const i=t.threadId??v.find(c=>c.id===t.id)?.threadId;i&&n?.({threadId:i,messageId:t.id})},[v,n]),ee=o.useMemo(()=>m.length<=1?[]:[{id:"all",label:"All",active:b==="all"},...m.map(t=>({id:t.accountId,label:t.email.split("@")[0]??t.email,count:V.get(t.accountId),active:b===t.accountId}))],[m,V,b]),H=o.useMemo(()=>e.filter(t=>t.muted?.value).length,[e]),ze=o.useMemo(()=>Array.from(V.values()).reduce((t,i)=>t+i,0),[V]),se=o.useMemo(()=>m.map(t=>t.accountId),[m]),{hasNewMail:me}=qs(),{state:fe,errorMessage:he,refresh:ge}=zs(se,{onSettled:()=>D()}),Qe=o.useMemo(()=>a.jsx(Qs,{state:fe,onRefresh:ge,label:"Refresh daily brief",errorMessage:he,hasUpdate:me(se)}),[fe,ge,he,me,se]),te=o.useMemo(()=>v.filter(t=>(T==="all"||t.category===T)&&ns(t,w)).map(t=>Se(t,h)),[v,T,w,h]),{hits:xe,isLoading:He}=Gs(),_e=o.useMemo(()=>{const t=new Map;for(const c of B?.items??[])t.set(c.messageId,c.threadId);const i=te.map(c=>t.get(c.id)).filter(c=>c!=null);return ps(xe,i,h)},[xe,te,B,h]),$e=o.useMemo(()=>{const t=Is(ee.map(i=>({id:i.id,label:i.label,count:i.count,active:i.active})));return{categories:t.categories,filters:t.filters,sources:t.sources,sourcesNote:H>0?`+${H} muted`:void 0,selectedCategory:T,activeFilters:w,expanded:K,onExpandedChange:j,onSelectCategory:i=>q(i),onSelectSource:N,onToggleFilter:i=>O(i),onClear:z}},[ee,H,T,w,K,O,q,z]),pe=de.length===0&&b==="all"&&k.length===0&&X.length===0,We=o.useMemo(()=>m.map(t=>t.accountId),[m]),Ue=o.useMemo(()=>m.some(t=>Hs(t.syncPhase)),[m]),Y=_s(We,pe||Ue),Ie=a.jsxs("div",{className:"h-full overflow-y-auto",children:[a.jsx(je,{}),a.jsx(je,{})]}),be=!Q&&!g&&!pe,Ve=bs({tier:I,hasLiveInput:R,hasCommittedQuery:f.trim().length>0,bodyRendersCommittedResults:!0}),Ye=be?a.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[Z&&a.jsx(vs,{count:Z.count,onScopeToSpam:()=>L({to:"/mail/$mailboxId",params:{mailboxId:Z.mailboxId},search:{q:f||void 0}})}),a.jsx("div",{className:"min-h-0 flex-1",children:a.jsx(os,{sections:de,briefCategory:T,Row:ys,selectedThreadId:s,onSelectThread:ue,onSelectBriefCategory:q,sources:ee,sourcesNote:H>0?`+${H} muted`:void 0,onSelectSource:N,activeFilters:w,onToggleFilter:O,onClearFilters:z})})]}):Q?Ie:g?a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 py-12 text-sm text-fg-muted",children:[a.jsx(we,{className:"size-8 text-danger"}),a.jsx("p",{children:"Couldn't load your messages"}),a.jsxs("button",{type:"button",onClick:()=>D(),className:"flex items-center gap-1 text-accent underline text-xs",children:[a.jsx(Us,{className:"size-3.5"}),"Try again"]})]}):Y.resolved?a.jsx(at,{sync:Y.syncing?{synced:Y.synced,total:Y.total}:void 0}):Ie;return a.jsx(rs,{hasSheet:be&&!Ve,children:a.jsx(Ss,{selectedMessageId:s,rows:v,onOpen:ue,onDeleteMessages:l,onSelectionVerb:A.start,wizardOpen:A.isOpen,commandsRef:r,onTriageContextChange:d,children:a.jsx(It,{wizard:A,header:{title:"Daily brief",unreadCount:ze,footer:p?a.jsx(Cs,{}):void 0,searchFilter:$e,searchResults:te,searchLoading:Q||Pe,relatedResults:_e,relatedLoading:He,onSelectSearchResult:qe,searchResultsInBody:!0,refreshControl:Qe},rows:v,children:a.jsxs("div",{className:"flex h-full flex-col",children:[Ee.map(t=>a.jsx(xt,{accountEmail:t.email,accountId:t.accountId},t.accountId)),a.jsx("div",{className:"min-h-0 flex-1",children:Ye})]})})})})}const De=o.createContext(null);function J(){const e=o.useContext(De);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function vt({thread:e,children:s}){const n=oe(),r=Xs(),{searchInput:d}=G(),l=e?.threadId,f=e?.messageId,{data:u}=ae({...ne(),staleTime:6e4}),h=o.useMemo(()=>u?.items??[],[u]),y=o.useMemo(()=>{if(l)return h.find(g=>g.messageId===f)??h.find(g=>g.threadId===l)},[h,l,f]),x=Fs(l,f),p=y??x,I=f??p?.messageId,A=o.useMemo(()=>{if(l)return{threadId:l,mailboxId:p?.mailboxId??"",subject:p?.subject,messageId:I,authenticity:p?.authenticity}},[l,p,I]),L=o.useCallback((g,D)=>{n({to:"/mail/brief/$threadId/$messageId",params:g,replace:D?.replace,search:M=>({...M,q:d||void 0}),hash:r})},[n,r,d]),m=o.useCallback(()=>{n({to:"/mail/brief",search:g=>g,hash:r})},[n,r]),b=o.useCallback(g=>{I&&g.includes(I)&&m()},[I,m]),N=Ce({thread:p,onAfterOptimisticRemove:b}),S=As(),{deleteMessages:C}=Ns({mailboxId:p?.mailboxId??"",messages:h,onAfterOptimisticRemove:b}),{toggleReadFor:W}=Os({mailboxId:p?.mailboxId??"",messages:h}),E=S.focusedMessageId,j=o.useMemo(()=>h.find(g=>g.messageId===E),[h,E])??p,P=Ce({thread:j}),U=Zs(),R=et(),w=st(),T=o.useMemo(()=>tt(w,l,I),[w,l,I]),O=o.useMemo(()=>{if(j)return g=>w({threadId:j.threadId,messageId:j.messageId,mode:g})},[w,j]),{nextMessageId:q,previousMessageId:z}=Bs({context:S,orderedIds:S.orderedIds,selectedMessageId:I,enabled:!U&&!R,onClose:m,handlers:{reply:()=>O?.("reply"),replyAll:()=>O?.("reply-all"),forward:()=>O?.("forward"),delete:()=>{S.listCommandsRef.current?.requestVerb("delete")||P.deleteThread()},toggleStar:P.toggleStar,toggleRead:()=>{S.listCommandsRef.current?.requestVerb("markRead")||j&&W([j.messageId],!j.isRead)},goFlagged:()=>n({to:"/mail/flagged"}),goSettings:()=>n({to:"/settings"})}}),B=o.useCallback(g=>{if(!g)return;const D=h.find(M=>M.messageId===g);return D?{threadId:D.threadId,messageId:g}:void 0},[h]),Q={selectedMessageId:I,selectedThread:p,conversation:A,onOpenThread:L,onCloseThread:m,nextThread:B(q),previousThread:B(z),actions:N,onReply:T,triage:S,onDeleteMessages:C,handleDeselectIfRemoved:b};return a.jsx(De.Provider,{value:Q,children:s})}function Le(){const{selectedMessageId:e,onOpenThread:s,triage:n,onDeleteMessages:r}=J(),{accounts:d}=G();return a.jsx(bt,{accounts:d,selectedMessageId:e,onOpenThread:s,commandsRef:n.listCommandsRef,onTriageContextChange:n.onTriageContextChange,onDeleteMessages:r})}function yt(){const{conversation:e,selectedThread:s,actions:n,onReply:r,handleDeselectIfRemoved:d}=J(),l=!!e,f=Es(e?.threadId);return a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[a.jsx(Ps,{hasThread:l,intelligenceOpen:f.isShowing,canToggleIntelligence:f.canToggle,onToggleIntelligence:f.toggle,onReply:r?()=>r("reply"):void 0,onReplyAll:r?()=>r("reply-all"):void 0,onForward:r?()=>r("forward"):void 0,onDelete:l?n.deleteThread:void 0,onToggleStar:l?n.toggleStar:void 0,isStarred:n.isStarred,moveContext:l&&n.accountId&&n.mailboxId?{accountId:n.accountId,currentMailboxId:n.mailboxId,onMove:n.moveThread}:void 0}),a.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?a.jsx(Me,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:f.open}):a.jsx(ds,{})})]}),a.jsx(ke,{isOpen:f.drawerOpen,onClose:f.closeDrawer,thread:s,mailboxId:s?.mailboxId,accountId:s?.accountId,onAfterOptimisticRemove:d})]})}function St(){const{selectedThread:e,handleDeselectIfRemoved:s}=J(),{onToggleIntelligence:n}=G();return a.jsx(Ls,{onClose:n,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:s})}function Ct(){const{selectedThread:e,conversation:s,onOpenThread:n,onCloseThread:r,nextThread:d,previousThread:l,handleDeselectIfRemoved:f}=J(),u=Ds(s?.threadId??null);return s?a.jsxs(a.Fragment,{children:[a.jsx(Me,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,authenticity:s.authenticity,onBack:r,onOpenIntelligence:u.toggle,onSwipeNext:d?()=>n(d):void 0,onSwipePrevious:l?()=>n(l):void 0,mobileIntelligenceOpen:u.isOpen}),a.jsx(ke,{isOpen:u.isOpen,onClose:u.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:f})]}):a.jsx("div",{className:"h-full",children:a.jsx(Le,{})})}const Bt=Object.assign(vt,{List:Le,Reading:yt,Intelligence:St,Phone:Ct});export{Bt as B};
@@ -1 +0,0 @@
1
- import{dk as U,r,cD as X,l as H,bn as Y,aF as Z,aG as ee,j as a,m as te}from"./index-CP_u7qA0.js";import{u as se,p as ae,R as re}from"./useSearchTokenContext-Rec5qr0P.js";import{E as ne,a8 as oe,F as de,au as ie,a9 as le,b as ce,M as ue,ag as ge,av as he,ai as me,q as fe,I as Ie,N as V,L as pe,J as xe,d as Te,X as ve,Y as ye,_ as K,$ as W,a0 as be,a1 as Re,a2 as Ce}from"./MailListHeader-D9UyUWpO.js";import{u as Se,b as we,a as je}from"./MailViewChrome-BZcvy1C_.js";import{f as Fe}from"./ErrorState-C4QR2OHT.js";import{u as Me}from"./useMediaQuery-kszmEDQl.js";import{w as Pe}from"./wizard-selection-B1bng5Jq.js";import{o as ke,f as Oe,h as Le,p as Ae,r as Ne}from"./useMessageBodyContent-gWn_VAyS.js";const De=()=>X({query:{starred:!0,order:"desc"}});function _(){const{data:e,isLoading:s,isError:t,error:o,refetch:m,fetchNextPage:d,hasNextPage:l,isFetchingNextPage:c}=Se({queryKey:De(),queryFn:async({pageParam:I})=>{const{data:g}=await U({query:{starred:!0,order:"desc",continuationToken:I},throwOnError:!0});return g},initialPageParam:void 0,getNextPageParam:I=>I.continuationToken,staleTime:6e4});return{threads:r.useMemo(()=>(e?.pages??[]).flatMap(I=>I.items??[]),[e]),isLoading:s,isError:t,error:o,refetch:m,fetchNextPage:d,hasNextPage:l,isFetchingNextPage:c}}const Ee=e=>{const s=new Set;return e.filter(t=>s.has(t.threadId)?!1:(s.add(t.threadId),!0))},Be={unread:e=>!e.isRead,attachment:e=>e.hasAttachment===!0};function qe({rows:e,verb:s}){const{selectedIds:t,exitSelection:o}=me(),m=r.useMemo(()=>Pe(e,t),[e,t]);return a.jsx(fe,{verb:s,selection:m,selectionRestriction:"spansAccounts",onFinished:o})}function ze({selectedMessageId:e,onOpenThread:s,commandsRef:t,onTriageContextChange:o,onDeleteMessages:m}){const{searchQuery:d,resultFolderIndex:l}=H(),c=se(),M=Me(),I=Y(),[g,f]=r.useState("all"),[R,P]=r.useState(new Set),y=r.useCallback(n=>{P(h=>{const p=new Set(h);return p.has(n)?p.delete(n):p.add(n),p})},[]),C=r.useCallback(()=>{f("all"),P(new Set)},[]),{threads:k,isLoading:T,isError:O,error:B,refetch:L,fetchNextPage:Q,hasNextPage:x,isFetchingNextPage:S}=_(),{freeText:b,tokens:A}=ae(d.trim().toLowerCase(),c),u=r.useMemo(()=>{const n=Array.from(R).map(h=>Be[h]).filter(h=>h!=null);return Ee(k).map(ne).filter(h=>(g==="all"||h.category===g)&&n.every(p=>p(h))&&(!b||oe(h,b))&&de(h,A))},[k,g,R,b,A]),w=r.useCallback((n,h)=>{const p=u.find(J=>J.id===n)?.threadId;p&&s?.({threadId:p,messageId:n},h)},[u,s]),j=r.useCallback(n=>{const h=n.threadId??u.find(p=>p.id===n.id)?.threadId;h&&s?.({threadId:h,messageId:n.id})},[u,s]),q=r.useMemo(()=>ie(),[]),z=r.useMemo(()=>u.map(n=>le(n,l)),[u,l]),N=r.useMemo(()=>u.filter(n=>!n.isRead).length,[u]),D=T?"loading":O?"error":u.length===0?"empty":"ready",i=r.useCallback(()=>{const n=Z(ee());window.open(n,"_blank","noopener,noreferrer")},[]),v=ce(),F=a.jsx("div",{className:"flex h-full min-h-0 flex-col",children:a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.jsx("div",{className:"divide-y divide-line",children:u.map(n=>a.jsx(ue,{thread:n,active:n.id===e,onClick:()=>w(n.id)},n.id))}),x?a.jsx("button",{type:"button",className:"w-full py-3 text-sm text-muted hover:text-fg disabled:opacity-50",onClick:()=>Q(),disabled:S,children:S?"Loading…":"Load more"}):null]})});return a.jsx(we,{title:"Starred",unreadCount:N,preset:q,selectedCategory:g,activeFilters:R,onSelectCategory:f,onToggleFilter:y,onClearFilters:C,searchResults:z,searchLoading:T,onSelectSearchResult:j,searchResultsInBody:!0,children:a.jsxs(ge,{selectedMessageId:e,rows:u,onOpen:w,onDeleteMessages:m,onSelectionVerb:I.start,wizardOpen:I.isOpen,commandsRef:t,onTriageContextChange:o,children:[a.jsx(je,{listTitle:"Starred",sections:[{id:"flagged",threads:u}],flatList:!0,hideHeader:!0,listState:v.searchResults?"ready":D,searchQuery:b?d:void 0,errorMessage:O?Fe(B):void 0,onRetry:()=>L(),onReportError:i,selectedThreadId:e,onSelectThread:w,isDesktop:M,selectionBar:a.jsx(he,{title:"Starred"}),listBody:v.searchResults??(D==="ready"?F:void 0)}),a.jsx(qe,{rows:u,verb:I.verb})]})})}const $=r.createContext(null);function E(){const e=r.useContext($);if(!e)throw new Error("FlaggedPane.* must be used inside <FlaggedPane>");return e}function He({thread:e,children:s}){const t=te(),o=ke(),{searchInput:m}=H(),d=e?.threadId,l=e?.messageId,{threads:c}=_(),M=r.useMemo(()=>{if(d)return c.find(i=>i.messageId===l)??c.find(i=>i.threadId===d)},[c,d,l]),I=Ie(d,l),g=M??I,f=l??g?.messageId,R=r.useMemo(()=>{if(d)return{threadId:d,mailboxId:g?.mailboxId??"",subject:g?.subject,messageId:f,authenticity:g?.authenticity}},[d,g,f]),P=r.useCallback((i,v)=>{t({to:"/mail/flagged/$threadId/$messageId",params:i,replace:v?.replace,search:F=>({...F,q:m||void 0}),hash:o})},[t,o,m]),y=r.useCallback(()=>{t({to:"/mail/flagged",search:i=>i,hash:o})},[t,o]),C=r.useCallback(i=>{f&&i.includes(f)&&y()},[f,y]),k=V({thread:g,onAfterOptimisticRemove:C}),T=pe(),{deleteMessages:O}=xe({mailboxId:g?.mailboxId??"",messages:c,onAfterOptimisticRemove:C}),{toggleReadFor:B}=Te({mailboxId:g?.mailboxId??"",messages:c}),L=T.focusedMessageId,x=r.useMemo(()=>c.find(i=>i.messageId===L),[c,L])??g,S=V({thread:x}),b=Oe(),A=Le(),u=Ae(),w=r.useMemo(()=>Ne(u,d,f),[u,d,f]),j=r.useMemo(()=>{if(x)return i=>u({threadId:x.threadId,messageId:x.messageId,mode:i})},[u,x]),{nextMessageId:q,previousMessageId:z}=ve({context:T,orderedIds:T.orderedIds,selectedMessageId:f,enabled:!b&&!A,onClose:y,handlers:{reply:()=>j?.("reply"),replyAll:()=>j?.("reply-all"),forward:()=>j?.("forward"),delete:()=>{T.listCommandsRef.current?.requestVerb("delete")||S.deleteThread()},toggleStar:S.toggleStar,toggleRead:()=>{T.listCommandsRef.current?.requestVerb("markRead")||x&&B([x.messageId],!x.isRead)},goBrief:()=>t({to:"/mail/brief"}),goSettings:()=>t({to:"/settings"})}}),N=r.useCallback(i=>{if(!i)return;const v=c.find(F=>F.messageId===i);return v?{threadId:v.threadId,messageId:i}:void 0},[c]),D={selectedMessageId:f,selectedThread:g,conversation:R,onOpenThread:P,onCloseThread:y,nextThread:N(q),previousThread:N(z),actions:k,onReply:w,triage:T,onDeleteMessages:O,handleDeselectIfRemoved:C};return a.jsx($.Provider,{value:D,children:s})}function G(){const{selectedMessageId:e,onOpenThread:s,triage:t,onDeleteMessages:o}=E();return a.jsx(ze,{selectedMessageId:e,onOpenThread:s,commandsRef:t.listCommandsRef,onTriageContextChange:t.onTriageContextChange,onDeleteMessages:o})}function Qe(){const{conversation:e,selectedThread:s,actions:t,onReply:o,handleDeselectIfRemoved:m}=E(),d=!!e,l=Re(e?.threadId);return a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[a.jsx(Ce,{hasThread:d,intelligenceOpen:l.isShowing,canToggleIntelligence:l.canToggle,onToggleIntelligence:l.toggle,onReply:o?()=>o("reply"):void 0,onReplyAll:o?()=>o("reply-all"):void 0,onForward:o?()=>o("forward"):void 0,onDelete:d?t.deleteThread:void 0,onToggleStar:d?t.toggleStar:void 0,isStarred:t.isStarred,moveContext:d&&t.accountId&&t.mailboxId?{accountId:t.accountId,currentMailboxId:t.mailboxId,onMove:t.moveThread}:void 0}),a.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?a.jsx(K,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:l.open}):a.jsx(re,{})})]}),a.jsx(W,{isOpen:l.drawerOpen,onClose:l.closeDrawer,thread:s,mailboxId:s?.mailboxId,accountId:s?.accountId,onAfterOptimisticRemove:m})]})}function Ve(){const{selectedThread:e,handleDeselectIfRemoved:s}=E(),{onToggleIntelligence:t}=H();return a.jsx(be,{onClose:t,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:s})}function Ke(){const{selectedThread:e,conversation:s,onCloseThread:t,onOpenThread:o,nextThread:m,previousThread:d,handleDeselectIfRemoved:l}=E(),c=ye(s?.threadId??null);return s?a.jsxs(a.Fragment,{children:[a.jsx(K,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,authenticity:s.authenticity,onBack:t,onOpenIntelligence:c.toggle,onSwipeNext:m?()=>o(m):void 0,onSwipePrevious:d?()=>o(d):void 0,mobileIntelligenceOpen:c.isOpen}),a.jsx(W,{isOpen:c.isOpen,onClose:c.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:l})]}):a.jsx("div",{className:"h-full",children:a.jsx(G,{})})}const Ze=Object.assign(He,{List:G,Reading:Qe,Intelligence:Ve,Phone:Ke});export{Ze as F};