@remit/web-client-dist 0.0.684 → 0.0.686

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 (189) hide show
  1. package/assets/{BriefPane-DKV1iFiW.js → BriefPane-DbPnsOco.js} +1 -1
  2. package/assets/{CalendarEventEditor-BVJVcn8c.js → CalendarEventEditor-CGrl9NkK.js} +1 -1
  3. package/assets/{CalendarEventPopup-BY5hHIwf.js → CalendarEventPopup-DSoQ-1wk.js} +1 -1
  4. package/assets/{CalendarLoadFailed-CFhSME4B.js → CalendarLoadFailed-ClpqypbH.js} +1 -1
  5. package/assets/{CalendarQuickCreate-AsCrUcAa.js → CalendarQuickCreate-CaYUiVR8.js} +1 -1
  6. package/assets/{CalendarSession-DRZ92kL4.js → CalendarSession-Ql7K56YK.js} +1 -1
  7. package/assets/{DesktopChrome-C8Sk2ut7.js → DesktopChrome-e0x9SkC0.js} +1 -1
  8. package/assets/{DropdownMenu-DB36Lfi7.js → DropdownMenu-DusMkzz6.js} +1 -1
  9. package/assets/{EmptyState-DjjWzqfi.js → EmptyState-BjhPv2hS.js} +1 -1
  10. package/assets/{ErrorState-k3wt6L_r.js → ErrorState-nIG-x-Zh.js} +1 -1
  11. package/assets/FlaggedPane-CcaZOeS-.js +1 -0
  12. package/assets/{FullCompose-Um26w7lB.js → FullCompose-D5JLo7Rb.js} +1 -1
  13. package/assets/{LabelApplyTrigger-BYIdJG0t.js → LabelApplyTrigger-CUfdoyOX.js} +1 -1
  14. package/assets/{MailShell-Dy-TBL0C.js → MailShell-DIZSKkXP.js} +1 -1
  15. package/assets/{MailViewChrome-DbIMXxXm.js → MailViewChrome-B22GO2ZU.js} +1 -1
  16. package/assets/MailboxPane-ikbl6KSS.js +135 -0
  17. package/assets/{MessageBody-CQSDERa-.js → MessageBody-DbkrLz4x.js} +4 -4
  18. package/assets/{MessageToolbar-DBu6zN25.js → MessageToolbar-D-FLeer4.js} +1 -1
  19. package/assets/{NavMenuButton-DwbUNWYU.js → NavMenuButton-C78wt6tT.js} +1 -1
  20. package/assets/{OnboardingWizard-G419TXSu.js → OnboardingWizard-B7BpPMJF.js} +1 -1
  21. package/assets/OutboxPane-Ch6JqV2D.js +1 -0
  22. package/assets/{ReportLink-By19dSP-.js → ReportLink-BTuMtEGU.js} +1 -1
  23. package/assets/_calendarObjectId-CNeye1nX.js +1 -0
  24. package/assets/_mailboxId-CINQfps_.js +1 -0
  25. package/assets/_messageId-D0UOksYx.js +1 -0
  26. package/assets/_messageId-OM56_7mN.js +1 -0
  27. package/assets/_messageId-VtS9XL2y.js +1 -0
  28. package/assets/_outboxMessageId-B0eJRNrJ.js +1 -0
  29. package/assets/_recurrenceId-CwEJEhKM.js +1 -0
  30. package/assets/{_slotId-B0VWha3i.js → _slotId-CukLHO14.js} +1 -1
  31. package/assets/_threadId-BvpkdG2H.js +1 -0
  32. package/assets/_threadId-CEIXKQzn.js +1 -0
  33. package/assets/_threadId-H3F-Cx53.js +1 -0
  34. package/assets/{_view._date-9VfJM2qY.js → _view._date-BhRGXGQG.js} +1 -1
  35. package/assets/{account-service-status-CADf5pX0.js → account-service-status-2nmShluv.js} +1 -1
  36. package/assets/{accounts-CrGdo3ni.js → accounts-B_pt4l15.js} +1 -1
  37. package/assets/{advanced-CHxdFeri.js → advanced-DzS_Bhbq.js} +1 -1
  38. package/assets/{agenda-time-0kHgN1IS.js → agenda-time-Bt4BEp3g.js} +1 -1
  39. package/assets/{app-chrome-tFbuBSBl.js → app-chrome-CbZgCDW_.js} +1 -1
  40. package/assets/{appearance-CmzgZOVO.js → appearance-D6Q4ETnm.js} +1 -1
  41. package/assets/{avatar-BmY6XepY.js → avatar-CQq2GZz9.js} +1 -1
  42. package/assets/{badge-DNMAx4D3.js → badge-BVw5vgFN.js} +1 -1
  43. package/assets/{bottom-sheet-C2SG5YmN.js → bottom-sheet-C81CIc2R.js} +1 -1
  44. package/assets/{brief-DJx3XIOx.js → brief-CGFThfPb.js} +1 -1
  45. package/assets/brief-CGmiPbD7.js +1 -0
  46. package/assets/{calendar-exLBND8p.js → calendar-Ddji3ram.js} +1 -1
  47. package/assets/{calendar-DzAewYd3.js → calendar-SMIdRsx9.js} +1 -1
  48. package/assets/{calendar-event-popup-BX4yyqgU.js → calendar-event-popup-DqvJLPWt.js} +1 -1
  49. package/assets/{calendar-event-sidebar-DG9W-BJ-.js → calendar-event-sidebar-CGPuc517.js} +1 -1
  50. package/assets/{calendar-failure-note-4QbINaXF.js → calendar-failure-note-4qETx8lD.js} +1 -1
  51. package/assets/{calendar-guests-C7ZBcQWB.js → calendar-guests-Dt2cjTqc.js} +1 -1
  52. package/assets/{calendar-suggestion-wnuXxa-h.js → calendar-suggestion-BZ4IIHBe.js} +1 -1
  53. package/assets/{calendars-XiQ85lmu.js → calendars-U4lDveGO.js} +1 -1
  54. package/assets/{card-C42r2UXP.js → card-kzE1rw9u.js} +1 -1
  55. package/assets/{checkbox-CjhlhVd0.js → checkbox-BILwOn1g.js} +1 -1
  56. package/assets/chevron-down-TeH9o9Q-.js +1 -0
  57. package/assets/chevron-left-DUh7xA0y.js +1 -0
  58. package/assets/{circle-check-B9p7FADR.js → circle-check-CBDdVMl8.js} +1 -1
  59. package/assets/{circle-check-big-BTaxDmjy.js → circle-check-big-DlhpMe5P.js} +1 -1
  60. package/assets/{circle-help-B5aCQkW2.js → circle-help-CP1s-Yi3.js} +1 -1
  61. package/assets/classification-DF13x4GV.js +1 -0
  62. package/assets/{clock-CqDLo2F2.js → clock-CLvsvjcH.js} +1 -1
  63. package/assets/compose._-_outboxMessageId_-3OLQ2cbN.js +1 -0
  64. package/assets/compose._-_outboxMessageId_-BYGqO75X.js +1 -0
  65. package/assets/compose._-_outboxMessageId_-Cc0PpaH6.js +1 -0
  66. package/assets/compose._-_outboxMessageId_-SAeViPeG.js +1 -0
  67. package/assets/{config-import-9beahVan.js → config-import-BRacJ1y6.js} +1 -1
  68. package/assets/{confirm-dialog-By4KyYtA.js → confirm-dialog-B0MVMPmn.js} +1 -1
  69. package/assets/{copy-BYqJcNuv.js → copy-DMRh3Rb2.js} +1 -1
  70. package/assets/{credential-steps-ioVIFoHi.js → credential-steps-4YQ5eJjl.js} +1 -1
  71. package/assets/{download-DHu_VILi.js → download-WnSzcn6T.js} +1 -1
  72. package/assets/{draft-DBSWcwcO.js → draft-0DDwY2Pw.js} +1 -1
  73. package/assets/edit-B4dfxZaW.js +1 -0
  74. package/assets/edit-BU8CFYW0.js +1 -0
  75. package/assets/{external-link-CbBMj0Z_.js → external-link-B_11YPnQ.js} +1 -1
  76. package/assets/{file-json-DbQ50vT6.js → file-json-D4Uv97RH.js} +1 -1
  77. package/assets/filters-BWFo6zj7.js +1 -0
  78. package/assets/flagged-BQl5KVuF.js +1 -0
  79. package/assets/{flagged-DCJxt3_p.js → flagged-C_307aIb.js} +1 -1
  80. package/assets/{folder-input-F5BBuwYo.js → folder-input-DjY4GpKG.js} +1 -1
  81. package/assets/{folders-CboZBGx6.js → folders-D7JFBgPP.js} +1 -1
  82. package/assets/{help-copy-UAU_hrL0.js → help-copy-bU0rZqtx.js} +1 -1
  83. package/assets/{import-BsVMIlh9.js → import-CyBIMXQK.js} +1 -1
  84. package/assets/index-6cMF4pO8.js +1 -0
  85. package/assets/index-B0m7QGSS.js +1 -0
  86. package/assets/{index-CjLIM85N.js → index-BZ4sAts4.js} +3 -3
  87. package/assets/index-CH48-R4X.js +1 -0
  88. package/assets/index-CjLHI6va.js +1 -0
  89. package/assets/{index-C8_kRlZw.js → index-CrUfJlwk.js} +4 -4
  90. package/assets/index-D-NR3LoA.js +1 -0
  91. package/assets/index-D0UOksYx.js +1 -0
  92. package/assets/index-D1_eaXw-.js +1 -0
  93. package/assets/index-OM56_7mN.js +1 -0
  94. package/assets/index-VtS9XL2y.js +1 -0
  95. package/assets/index-ksP05uVF.js +1 -0
  96. package/assets/{kbd-CMsSty4m.js → kbd-5V1_yqOW.js} +1 -1
  97. package/assets/{label-chip-Dy8yMiFM.js → label-chip-BBPaslky.js} +1 -1
  98. package/assets/{labels-Dn7EENvK.js → labels-xO9yj2bw.js} +1 -1
  99. package/assets/{mail-BYU-RvAA.js → mail-CRvRtCed.js} +1 -1
  100. package/assets/{mail-ERxPLc6T.js → mail-DcTEJ5uO.js} +1 -1
  101. package/assets/{menu-S5zj22BN.js → menu-DXmZUEBa.js} +1 -1
  102. package/assets/{nav-link-BJFBTF93.js → nav-link-BvBkmH1H.js} +1 -1
  103. package/assets/new-kYNP_cv-.js +1 -0
  104. package/assets/onboarding-CFIwco02.js +1 -0
  105. package/assets/{onboarding-completion-BGw_CF3C.js → onboarding-completion-CK2mHfmP.js} +1 -1
  106. package/assets/outbox-DgFmUFU6.js +1 -0
  107. package/assets/{pencil-DhM7psiB.js → pencil-Py3MXttE.js} +1 -1
  108. package/assets/{people-CJWst29Y.js → people-CxpFEQpi.js} +1 -1
  109. package/assets/{plus-CWdC1Tqr.js → plus-5sFyaPZh.js} +1 -1
  110. package/assets/{popover-menu-vk6Zc0z7.js → popover-menu-uIVgxYG_.js} +1 -1
  111. package/assets/{refresh-cw-B_uXAs1Z.js → refresh-cw-Dar0XAdp.js} +1 -1
  112. package/assets/{reply-jAIguvVh.js → reply-D8bLYzum.js} +1 -1
  113. package/assets/{rich-text-BNKeOthA.js → rich-text-B2jeK_lt.js} +1 -1
  114. package/assets/{rich-text-spellcheck-worker-provider-Cpg7LbTE.js → rich-text-spellcheck-worker-provider-D1J3yZU8.js} +1 -1
  115. package/assets/{rotate-ccw-BO87SEMT.js → rotate-ccw-CSByuoeY.js} +1 -1
  116. package/assets/{roving-focus-DxrxBKOA.js → roving-focus-1m_wY9_4.js} +1 -1
  117. package/assets/{row-actions-B2Y3De5s.js → row-actions-CB2wYT6g.js} +1 -1
  118. package/assets/{search-mirror-aqcvRPsg.js → search-mirror-CFL35Bis.js} +1 -1
  119. package/assets/{search-scope-m65PO2OM.js → search-scope-BR87UqJt.js} +1 -1
  120. package/assets/{search-token-index-BV0MxVc4.js → search-token-index-CoqsoQJZ.js} +1 -1
  121. package/assets/{sections-1CLsW1zC.js → sections-B9pteMHc.js} +1 -1
  122. package/assets/{segmented-control-D85OUPJd.js → segmented-control-CVMDr-Je.js} +1 -1
  123. package/assets/{select-BccK4I_R.js → select-DXHN14lo.js} +1 -1
  124. package/assets/{senders-NrVp71W0.js → senders-CXpJyu9L.js} +1 -1
  125. package/assets/settings-B2MbfPot.js +1 -0
  126. package/assets/{settings-screen-B0brDUWW.js → settings-screen-C8kBB2kR.js} +1 -1
  127. package/assets/{shield-check-nCSxAGzG.js → shield-check-Fest6_gL.js} +1 -1
  128. package/assets/{suggest-list-CGKa8tfA.js → suggest-list-CUEgGZt_.js} +1 -1
  129. package/assets/{suggested-vips-D9HP0DVS.js → suggested-vips-CiTGLmJd.js} +1 -1
  130. package/assets/{suggestion._suggestionId-DYsuCqNh.js → suggestion._suggestionId-BMRKFgLt.js} +1 -1
  131. package/assets/{switch-BDBBnLpE.js → switch-xqSp-gFV.js} +1 -1
  132. package/assets/{task._calendarTaskId-DXwhwAoI.js → task._calendarTaskId-AbdgpKo5.js} +1 -1
  133. package/assets/{undo-2-DzniM_WO.js → undo-2-IdsgUvVv.js} +1 -1
  134. package/assets/{useCalendarData-CiACY6bV.js → useCalendarData-BKkQY_vQ.js} +1 -1
  135. package/assets/{useCalendarScheduling-Brb1S1QL.js → useCalendarScheduling-D_qd-mRK.js} +1 -1
  136. package/assets/{useCalendarSuggestions-9OSR5bVj.js → useCalendarSuggestions-D58tKJtx.js} +1 -1
  137. package/assets/{useCalendarTasks-DZa9ySo0.js → useCalendarTasks-DLNYnUeu.js} +1 -1
  138. package/assets/{useDebouncedValue-m2WIWKGa.js → useDebouncedValue-CMBraotV.js} +1 -1
  139. package/assets/{useFilters-C1uvJ4Ho.js → useFilters-28pRmQGT.js} +1 -1
  140. package/assets/{useLabels-BvI8jwIJ.js → useLabels-CGCEGKuz.js} +1 -1
  141. package/assets/{useLayoutTier-CL2fFLId.js → useLayoutTier-CnmLTkLg.js} +1 -1
  142. package/assets/{useMediaQuery-Ct2USFCe.js → useMediaQuery-D3m_n689.js} +1 -1
  143. package/assets/{useMessageBodyContent-MKSJN2kk.js → useMessageBodyContent-dd-lowbx.js} +1 -1
  144. package/assets/{useQueries-DiYEl2LH.js → useQueries-B-X1sW9_.js} +1 -1
  145. package/assets/{useRefreshControl-guVLGaLs.js → useRefreshControl-DbHCcSXX.js} +1 -1
  146. package/assets/{useResultFolderIndex--Vh1kDTt.js → useResultFolderIndex-BvBtm4F3.js} +1 -1
  147. package/assets/{useSignature-Ck8XWicp.js → useSignature-CQZ_Ke3T.js} +1 -1
  148. package/assets/{warnings-CC5t4Lye.js → warnings-bjC-sL2O.js} +3 -3
  149. package/index.html +1 -1
  150. package/package.json +1 -1
  151. package/assets/FlaggedPane-BKSCs9yQ.js +0 -1
  152. package/assets/MailboxPane-DE0MG44k.js +0 -135
  153. package/assets/OutboxPane-CijiwhdB.js +0 -1
  154. package/assets/_calendarObjectId-fr_DOSB5.js +0 -1
  155. package/assets/_mailboxId-rxS0aTPA.js +0 -1
  156. package/assets/_messageId-Dd8DtbFX.js +0 -1
  157. package/assets/_messageId-MltBMuB2.js +0 -1
  158. package/assets/_messageId-OX5-naZB.js +0 -1
  159. package/assets/_outboxMessageId-CR43Ykvj.js +0 -1
  160. package/assets/_recurrenceId-5xRvoQr3.js +0 -1
  161. package/assets/_threadId-PVllb6ST.js +0 -1
  162. package/assets/_threadId-QNe6ZU7G.js +0 -1
  163. package/assets/_threadId-kRDsdwV9.js +0 -1
  164. package/assets/brief-CDD1sD46.js +0 -1
  165. package/assets/chevron-down-DCUrV3H_.js +0 -1
  166. package/assets/chevron-left-Br4HtAWp.js +0 -1
  167. package/assets/classification-BQpRhmik.js +0 -1
  168. package/assets/compose._-_outboxMessageId_-0TViPHVJ.js +0 -1
  169. package/assets/compose._-_outboxMessageId_-12b-uBgV.js +0 -1
  170. package/assets/compose._-_outboxMessageId_-B3fhCxCx.js +0 -1
  171. package/assets/compose._-_outboxMessageId_-Bfz6_gPW.js +0 -1
  172. package/assets/edit-CDsGkq55.js +0 -1
  173. package/assets/edit-J4rkAx6h.js +0 -1
  174. package/assets/filters-CZ386C51.js +0 -1
  175. package/assets/flagged-C-zdu9Ko.js +0 -1
  176. package/assets/index-BBSi34NI.js +0 -1
  177. package/assets/index-BXFzm6T3.js +0 -1
  178. package/assets/index-DVR7EF8n.js +0 -1
  179. package/assets/index-DXkPJvhA.js +0 -1
  180. package/assets/index-DYGeUOj0.js +0 -1
  181. package/assets/index-Dd8DtbFX.js +0 -1
  182. package/assets/index-DfDT80hv.js +0 -1
  183. package/assets/index-MltBMuB2.js +0 -1
  184. package/assets/index-OX5-naZB.js +0 -1
  185. package/assets/index-vUwnX4dj.js +0 -1
  186. package/assets/new-apNYVdcM.js +0 -1
  187. package/assets/onboarding-BuXQ-yrG.js +0 -1
  188. package/assets/outbox-BZL_g_gu.js +0 -1
  189. package/assets/settings-ohqabhz3.js +0 -1
@@ -0,0 +1,135 @@
1
+ import{j as i,bU as Ns,ag as V,r as c,d as gt,B as ne,S as Os,p as Ae,t as _s,bc as zs,e as Mt,ak as Qt,cR as Fs,k as Ds,f as Rt,P as Ls,Q as Ps,a1 as Jt,cS as Bs,ck as $s,s as Ws,cT as Ks,a as pt,cU as At,cV as Nt,cW as Ze,V as Vs,cX as qs,cv as Hs,I as Us,z as Qs,T as Yt,cY as Js,cZ as Gt,c0 as Ys,c_ as Gs,c$ as Xs,d0 as Zs,d1 as en,aw as tn,ax as sn,d2 as nn,d3 as on,l as Ot,i as rn,bh as ln,U as an,bi as cn,bj as un,J as Xt,_ as dn,bu as hn}from"./index-BZ4sAts4.js";import{S as fn,M as mn,a as gn,u as pn,l as xn,b as vn}from"./MailViewChrome-B22GO2ZU.js";import{u as Zt,r as bn,a as _t,C as es,c as ts,j as Sn,M as yn,t as ss,b as Cn,d as wn,e as ns,f as os,g as Tn,h as In,i as kn,n as En,k as jn,S as Mn,l as Rn,D as An,m as Nn,o as On,p as rs,q as _n,s as zn,v as Fn,w as Dn,x as Ln,y as Pn,z as Bn,A as $n,B as Wn,E as Kn,F as Vn,G as qn,H as Wt,I as Kt,J as Hn,K as Un,L as Qn,N as Jn,O as Yn,P as Gn,Q as Xn,R as Zn,T as eo,U as to,V as so,W as zt,X as no,Y as is,Z as ls,_ as as,$ as oo,a0 as ro,a1 as io,a2 as lo,a3 as ao,a4 as co,a5 as uo}from"./MessageToolbar-D-FLeer4.js";import{e as et,f as ho,g as fo,h as mo,i as go}from"./search-token-index-CoqsoQJZ.js";import{u as po}from"./useLayoutTier-CnmLTkLg.js";import{u as xo,a as vo,R as bo}from"./useRefreshControl-DbHCcSXX.js";import{t as So,L as yo,r as Co,s as wo}from"./LabelApplyTrigger-CUfdoyOX.js";import{u as To,p as Vt,R as Io}from"./MessageBody-DbkrLz4x.js";import{P as ko,N as Eo,n as jo}from"./NavMenuButton-C78wt6tT.js";import"./nav-link-BvBkmH1H.js";import{d as Mo,g as Ro,a as Ao,u as No}from"./useMessageBodyContent-dd-lowbx.js";import{g as Oo,r as _o,d as zo}from"./reply-D8bLYzum.js";import{u as Fo}from"./sections-B9pteMHc.js";import{A as Ft}from"./avatar-CQq2GZz9.js";import{C as Do}from"./confirm-dialog-B0MVMPmn.js";import{f as Lo}from"./calendar-SMIdRsx9.js";import{a as Po}from"./useLabels-CGCEGKuz.js";import{a as Bo,D as $o,u as Wo}from"./useMediaQuery-D3m_n689.js";import{f as Ko}from"./ErrorState-nIG-x-Zh.js";import{S as xt}from"./shield-check-Fest6_gL.js";import{B as Vo}from"./bottom-sheet-C81CIc2R.js";import{B as cs}from"./badge-BVw5vgFN.js";import{C as us}from"./checkbox-BILwOn1g.js";import{C as qo}from"./chevron-down-TeH9o9Q-.js";import{C as Ho}from"./circle-help-CP1s-Yi3.js";import{C as Uo}from"./circle-check-CBDdVMl8.js";const Qo=e=>e.toLocaleString(),Jo=(e,o)=>{if(e.kind==="unknown")return`Results for “${o}”`;const t=e.value===1?"result":"results";return`${Qo(e.value)} ${t} for “${o}”`};function Yo({query:e,count:o}){return i.jsxs("div",{className:"flex items-center gap-2 border-b border-line bg-surface-sunken/30 px-3 py-2",children:[i.jsx(Ns,{className:"size-4 text-fg-muted","aria-hidden":"true"}),i.jsx("span",{className:"text-sm text-fg-muted",children:Jo(o,e)})]})}var Xe;(function(e){e[e.UP=-1]="UP",e[e.DOWN=1]="DOWN"})(Xe||(Xe={}));function Go(e){var o=getComputedStyle(e).overflowY;return e===document.scrollingElement&&o==="visible"?!0:!(o!=="scroll"&&o!=="auto")}function Xo(e,o){if(!Go(e))return!1;if(o===Xe.DOWN){var t=e.scrollTop+e.clientHeight;return t<e.scrollHeight}if(o===Xe.UP)return e.scrollTop>0;throw new Error("unsupported direction")}function ds(e,o){return Xo(e,o)?!0:e.parentElement==null?!1:ds(e.parentElement,o)}function hs(e,o){o===void 0&&(o={});var t=o.insertAt;if(!(!e||typeof document>"u")){var s=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t==="top"&&s.firstChild?s.insertBefore(n,s.firstChild):s.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}var Zo=`.lds-ellipsis {
2
+ display: inline-block;
3
+ position: relative;
4
+ width: 64px;
5
+ height: 64px;
6
+ }
7
+
8
+ .lds-ellipsis div {
9
+ position: absolute;
10
+ top: 27px;
11
+ width: 11px;
12
+ height: 11px;
13
+ border-radius: 50%;
14
+ background: rgb(54, 54, 54);
15
+ animation-timing-function: cubic-bezier(0, 1, 1, 0);
16
+ }
17
+
18
+ .lds-ellipsis div:nth-child(1) {
19
+ left: 6px;
20
+ animation: lds-ellipsis1 0.6s infinite;
21
+ }
22
+
23
+ .lds-ellipsis div:nth-child(2) {
24
+ left: 6px;
25
+ animation: lds-ellipsis2 0.6s infinite;
26
+ }
27
+
28
+ .lds-ellipsis div:nth-child(3) {
29
+ left: 26px;
30
+ animation: lds-ellipsis2 0.6s infinite;
31
+ }
32
+
33
+ .lds-ellipsis div:nth-child(4) {
34
+ left: 45px;
35
+ animation: lds-ellipsis3 0.6s infinite;
36
+ }
37
+
38
+ @keyframes lds-ellipsis1 {
39
+ 0% {
40
+ transform: scale(0);
41
+ }
42
+ 100% {
43
+ transform: scale(1);
44
+ }
45
+ }
46
+ @keyframes lds-ellipsis3 {
47
+ 0% {
48
+ transform: scale(1);
49
+ }
50
+ 100% {
51
+ transform: scale(0);
52
+ }
53
+ }
54
+ @keyframes lds-ellipsis2 {
55
+ 0% {
56
+ transform: translate(0, 0);
57
+ }
58
+ 100% {
59
+ transform: translate(19px, 0);
60
+ }
61
+ }`;hs(Zo);var er=function(){return V.createElement("div",{className:"lds-ellipsis"},V.createElement("div",null),V.createElement("div",null),V.createElement("div",null),V.createElement("div",null))},tr=function(){return V.createElement("div",null,V.createElement("p",null,"↧  pull to refresh  ↧"))},sr=`.ptr,
62
+ .ptr__children {
63
+ height: 100%;
64
+ width: 100%;
65
+ overflow: hidden;
66
+ -webkit-overflow-scrolling: touch;
67
+ position: relative;
68
+ }
69
+
70
+ .ptr.ptr--fetch-more-treshold-breached .ptr__fetch-more {
71
+ display: block;
72
+ }
73
+
74
+ .ptr__fetch-more {
75
+ display: none;
76
+ }
77
+
78
+ /**
79
+ * Pull down transition
80
+ */
81
+ .ptr__children,
82
+ .ptr__pull-down {
83
+ transition: transform 0.2s cubic-bezier(0, 0, 0.31, 1);
84
+ }
85
+
86
+ .ptr__pull-down {
87
+ position: absolute;
88
+ overflow: hidden;
89
+ left: 0;
90
+ right: 0;
91
+ top: 0;
92
+ visibility: hidden;
93
+ }
94
+ .ptr__pull-down > div {
95
+ display: none;
96
+ }
97
+
98
+ .ptr--dragging {
99
+ /**
100
+ * Hide PullMore content is treshold breached
101
+ */
102
+ }
103
+ .ptr--dragging.ptr--pull-down-treshold-breached .ptr__pull-down--pull-more {
104
+ display: none;
105
+ }
106
+ .ptr--dragging {
107
+ /**
108
+ * Otherwize, display content
109
+ */
110
+ }
111
+ .ptr--dragging .ptr__pull-down--pull-more {
112
+ display: block;
113
+ }
114
+
115
+ .ptr--pull-down-treshold-breached {
116
+ /**
117
+ * Force opacity to 1 is pull down trashold breached
118
+ */
119
+ }
120
+ .ptr--pull-down-treshold-breached .ptr__pull-down {
121
+ opacity: 1 !important;
122
+ }
123
+ .ptr--pull-down-treshold-breached {
124
+ /**
125
+ * And display loader
126
+ */
127
+ }
128
+ .ptr--pull-down-treshold-breached .ptr__pull-down--loading {
129
+ display: block;
130
+ }
131
+
132
+ .ptr__loader {
133
+ margin: 0 auto;
134
+ text-align: center;
135
+ }`;hs(sr);var nr=function(e){var o=e.isPullable,t=o===void 0?!0:o,s=e.canFetchMore,n=s===void 0?!1:s,r=e.onRefresh,a=e.onFetchMore,l=e.refreshingContent,u=l===void 0?V.createElement(er,null):l,d=e.pullingContent,h=d===void 0?V.createElement(tr,null):d,g=e.children,m=e.pullDownThreshold,v=m===void 0?67:m,S=e.fetchMoreThreshold,b=S===void 0?100:S,C=e.maxPullDownDistance,p=C===void 0?95:C,x=e.resistance,E=x===void 0?1:x,T=e.backgroundColor,I=e.className,O=I===void 0?"":I,R=c.useRef(null),A=c.useRef(null),P=c.useRef(null),G=c.useRef(null),N=!1,q=!1,z=!1,F=0,ee=0;c.useEffect(function(){if(!(!t||!A||!A.current)){var j=A.current;return j.addEventListener("touchstart",B,{passive:!0}),j.addEventListener("mousedown",B),j.addEventListener("touchmove",de,{passive:!1}),j.addEventListener("mousemove",de),window.addEventListener("scroll",se),j.addEventListener("touchend",M),j.addEventListener("mouseup",M),document.body.addEventListener("mouseleave",M),function(){j.removeEventListener("touchstart",B),j.removeEventListener("mousedown",B),j.removeEventListener("touchmove",de),j.removeEventListener("mousemove",de),window.removeEventListener("scroll",se),j.removeEventListener("touchend",M),j.removeEventListener("mouseup",M),document.body.removeEventListener("mouseleave",M)}}},[g,t,r,v,p,n,b]),c.useEffect(function(){var j;if(!((j=R)===null||j===void 0)&&j.current){var U=R.current.classList.contains("ptr--fetch-more-treshold-breached");U||n&&ue()<b&&a&&(R.current.classList.add("ptr--fetch-more-treshold-breached"),q=!0,a().then(H).catch(H))}},[n,g]);var ue=function(){if(!A||!A.current)return-1;var j=window.scrollY,U=A.current.scrollHeight;return U-j-window.innerHeight},H=function(){requestAnimationFrame(function(){A.current&&(A.current.style.overflowX="hidden",A.current.style.overflowY="auto",A.current.style.transform="unset"),P.current&&(P.current.style.opacity="0"),R.current&&(R.current.classList.remove("ptr--pull-down-treshold-breached"),R.current.classList.remove("ptr--dragging"),R.current.classList.remove("ptr--fetch-more-treshold-breached")),N&&(N=!1),q&&(q=!1)})},B=function(j){z=!1,j instanceof MouseEvent&&(F=j.pageY),window.TouchEvent&&j instanceof TouchEvent&&(F=j.touches[0].pageY),ee=F,!(j.type==="touchstart"&&ds(j.target,Xe.UP))&&(A.current.getBoundingClientRect().top<0||(z=!0))},de=function(j){if(z){if(window.TouchEvent&&j instanceof TouchEvent?ee=j.touches[0].pageY:ee=j.pageY,R.current.classList.add("ptr--dragging"),ee<F){z=!1;return}j.cancelable&&j.preventDefault();var U=Math.min((ee-F)/E,p);U>=v&&(z=!0,N=!0,R.current.classList.remove("ptr--dragging"),R.current.classList.add("ptr--pull-down-treshold-breached")),!(U>=p)&&(P.current.style.opacity=(U/65).toString(),A.current.style.overflow="visible",A.current.style.transform="translate(0px, "+U+"px)",P.current.style.visibility="visible")}},se=function(j){q||n&&ue()<b&&a&&(q=!0,R.current.classList.add("ptr--fetch-more-treshold-breached"),a().then(H).catch(H))},M=function(){if(z=!1,F=0,ee=0,!N){P.current&&(P.current.style.visibility="hidden"),H();return}A.current&&(A.current.style.overflow="visible",A.current.style.transform="translate(0px, "+v+"px)"),r().then(H).catch(H)};return V.createElement("div",{className:"ptr "+O,style:{backgroundColor:T},ref:R},V.createElement("div",{className:"ptr__pull-down",ref:P},V.createElement("div",{className:"ptr__loader ptr__pull-down--loading"},u),V.createElement("div",{className:"ptr__pull-down--pull-more"},h)),V.createElement("div",{className:"ptr__children",ref:A},g,V.createElement("div",{className:"ptr__fetch-more",ref:G},V.createElement("div",{className:"ptr__loader ptr__fetch-more--loading"},u))))};const or=({children:e,onRefresh:o,isRefreshing:t})=>Bo($o)?e:i.jsx(nr,{onRefresh:o,isPullable:!t,children:e}),rr=e=>e===1?"message":"messages";function ir({count:e,onReview:o,onDismiss:t,actionLabel:s="Review & rescue"}){return i.jsx(gt,{tone:"info",variant:"soft",onDismiss:t,children:i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("p",{className:"flex items-start gap-2 text-sm text-fg",children:[i.jsx(xt,{className:"mt-0.5 size-4 shrink-0 text-positive","aria-hidden":!0}),i.jsxs("span",{children:[i.jsx("span",{className:"font-semibold text-fg",children:`${e} ${rr(e)} here`})," ","may not be spam — they're from senders we can verify."]})]}),i.jsx(ne,{variant:"primary",size:"sm",onClick:o,className:"self-start",children:s})]})})}const lr=(e,o)=>e==="vip"?"vip":e==="unknown"&&o==="md"?"unknown-pill":"hidden",fs=({senderTrust:e,size:o="sm",className:t})=>{const s=lr(e,o);return s==="vip"?i.jsx(Os,{className:Ae("text-warning shrink-0",o==="sm"&&"size-3.5",o==="md"&&"size-4",t),"aria-label":"VIP sender","data-testid":"sender-trust-vip"}):s==="unknown-pill"?i.jsx("span",{className:Ae("inline-flex items-center rounded border border-dashed border-fg-subtle/40 font-medium uppercase tracking-wide text-fg-muted/80 shrink-0","px-2 py-0.5 text-xs",t),title:"First message from this sender","aria-label":"First message from this sender","data-testid":"sender-trust-unknown",children:"new"}):null};function ar({candidate:e,selected:o,onToggle:t,hideSender:s=!1}){const{senderName:n,senderAddress:r,subject:a,snippet:l,trustReason:u,trustSubReason:d,senderTrust:h}=e;return i.jsxs("label",{className:Ae("flex w-full cursor-pointer items-start gap-3 px-3 py-2.5 text-left transition-colors",s&&"pl-11",o?"bg-positive/10":"bg-surface hover:bg-surface-sunken"),children:[i.jsx(us,{className:"mt-0.5",checked:o,onChange:t,"aria-label":`${o?"Deselect":"Select"} ${s?a:`message from ${n}`}`}),!s&&i.jsx(Ft,{name:n,email:r,size:"sm"}),i.jsxs("span",{className:"min-w-0 flex-1",children:[!s&&i.jsxs("span",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"truncate text-sm font-medium text-fg",children:n}),h&&i.jsx(fs,{senderTrust:h,size:"sm"}),i.jsx("span",{className:"truncate text-2xs text-fg-subtle",children:r})]}),i.jsx("span",{className:"block truncate text-sm text-fg-muted",children:a}),i.jsx("span",{className:"block line-clamp-1 text-xs text-fg-subtle",children:l}),!s&&i.jsxs("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:[i.jsxs(cs,{tone:"positive",children:[i.jsx(xt,{className:"size-3","aria-hidden":!0}),u]}),i.jsx("span",{className:"text-2xs text-fg-subtle",children:d})]})]})]})}const cr=e=>{const o=new Map,t=[];for(const s of e){const n=(s.senderAddress||s.senderName).toLowerCase(),r=o.get(n);if(r){r.messages.push(s);continue}o.set(n,{key:n,senderName:s.senderName,senderAddress:s.senderAddress,trustReason:s.trustReason,trustSubReason:s.trustSubReason,senderTrust:s.senderTrust,messages:[s]}),t.push(n)}return t.map(s=>o.get(s)).sort((s,n)=>n.messages.length-s.messages.length)},ur=(e,o)=>{const t=e.messages.filter(s=>o.has(s.id)).length;return t===0?"none":t===e.messages.length?"all":"some"},qt=e=>e===1?"message":"messages";function dr({group:e,selected:o,onToggleGroup:t,onToggleMessage:s}){const[n,r]=c.useState(!1),a=ur(e,o),l=e.messages.length,u=n?qo:_s;return i.jsxs("div",{className:Ae(a!=="none"?"bg-positive/10":"bg-surface"),children:[i.jsxs("div",{className:"flex w-full items-start gap-3 px-3 py-2.5",children:[i.jsx(us,{className:"mt-0.5",checked:a==="all",indeterminate:a==="some",onChange:()=>t(e,a!=="all"),"aria-label":`${a==="all"?"Deselect":"Select"} all ${l} ${qt(l)} from ${e.senderName}`}),i.jsx(Ft,{name:e.senderName,email:e.senderAddress,size:"sm"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"truncate text-sm font-medium text-fg",children:e.senderName}),e.senderTrust&&i.jsx(fs,{senderTrust:e.senderTrust,size:"sm"}),i.jsx("span",{className:"truncate text-2xs text-fg-subtle",children:e.senderAddress})]}),i.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:[i.jsxs(cs,{tone:"positive",children:[i.jsx(xt,{className:"size-3","aria-hidden":!0}),e.trustReason]}),i.jsx("span",{className:"text-2xs text-fg-subtle",children:e.trustSubReason})]})]}),i.jsxs("button",{type:"button",onClick:()=>r(d=>!d),"aria-expanded":n,className:"flex shrink-0 items-center gap-1 rounded-md px-1.5 py-1 text-2xs text-fg-muted transition-colors hover:bg-surface-sunken hover:text-fg",children:[`${l} ${qt(l)}`,i.jsx(u,{className:"size-3.5","aria-hidden":!0})]})]}),n&&i.jsx("div",{className:"divide-y divide-line border-t border-line",children:e.messages.map(d=>i.jsx(ar,{candidate:d,selected:o.has(d.id),onToggle:()=>s(d.id),hideSender:!0},d.id))})]})}const Dt=e=>e===1?"message":"messages",hr=(e,o)=>`Moves ${e===1?"this message":`these ${e} ${Dt(e)}`} out of Spam to ${o} now. Nothing later.`,jt=(e,o)=>e.find(t=>t.id===o)?.label??"Inbox";function fr(){return i.jsx(gt,{tone:"info",variant:"soft",children:i.jsx("p",{className:"text-2xs text-fg-muted",children:"We list a message here only when we can confirm the sender is who they say — usually someone you've emailed before, write to often, or a service that consistently checks out. We never guess from words in the subject. Anything we can't confirm stays in Spam."})})}function mr({candidates:e,selected:o,onToggle:t,onToggleGroup:s,onSelectAll:n,onSelectNone:r,onContinue:a,onCancel:l}){const[u,d]=c.useState(!1),h=o.size,g=c.useMemo(()=>cr(e),[e]);return i.jsxs("div",{className:"flex min-h-0 flex-col",children:[i.jsxs("div",{className:"px-row-inset pb-2 pt-1",children:[i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsxs("h2",{className:"flex items-center gap-2 text-sm font-semibold text-fg",children:[i.jsx(xt,{className:"size-4 text-positive","aria-hidden":!0}),"Rescue from Spam"]}),i.jsx(ne,{variant:"ghost",size:"sm",icon:i.jsx(Ho,{className:"size-3.5"}),onClick:()=>d(m=>!m),className:"-mr-1.5 -mt-0.5",children:"Why these?"})]}),i.jsx("p",{className:"mt-1 text-2xs text-fg-subtle",children:"These look safe — from senders we can verify. Uncheck any sender that belongs in Spam, or open a sender to pick individual messages."}),u&&i.jsx("div",{className:"mt-2",children:i.jsx(fr,{})})]}),i.jsxs("div",{className:"flex items-center justify-between px-row-inset pb-1.5",children:[i.jsx("span",{className:"text-2xs font-medium text-fg-muted",children:`${h} of ${e.length} selected · ${g.length} ${g.length===1?"sender":"senders"}`}),i.jsxs("span",{className:"flex gap-1",children:[i.jsx(ne,{variant:"ghost",size:"sm",onClick:n,children:"Select all"}),i.jsx(ne,{variant:"ghost",size:"sm",onClick:r,children:"Select none"})]})]}),i.jsx("div",{className:"min-h-0 flex-1 divide-y divide-line overflow-y-auto border-y border-line",children:g.map(m=>i.jsx(dr,{group:m,selected:o,onToggleGroup:s,onToggleMessage:t},m.key))}),i.jsxs("div",{className:"space-y-2 border-t border-line bg-surface px-row-inset py-3",children:[i.jsx(ne,{variant:"primary",onClick:a,className:"h-11 w-full font-semibold",children:`Continue with ${h} ${Dt(h)}`}),i.jsx(ne,{variant:"ghost",onClick:l,className:"h-11 w-full",children:"Cancel"})]})]})}function gr({count:e,folders:o,delimiter:t,destination:s,onPick:n,onMove:r,onBack:a}){const[l,u]=c.useState(!1);return i.jsxs("div",{className:"flex min-h-0 flex-col",children:[i.jsxs("div",{className:"px-row-inset pb-2 pt-1",children:[i.jsx("h2",{className:"text-sm font-semibold text-fg",children:"Where should they go?"}),i.jsx("p",{className:"mt-1 text-2xs text-fg-subtle",children:"Pick a folder, then we move them out of Spam."})]}),i.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto px-row-inset py-2",children:l?i.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden rounded-xl border border-line bg-surface",children:i.jsx(zs,{folders:o,selectedId:s,delimiter:t,onSelect:n,onCancel:()=>u(!1)})}):i.jsxs("div",{className:"rounded-xl border border-line bg-surface-sunken p-3",children:[i.jsx("p",{className:"text-2xs text-fg-subtle",children:"Destination"}),i.jsx("p",{className:"mt-0.5 text-sm font-medium text-fg",children:jt(o,s)}),i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>u(!0),className:"mt-2 px-0",children:"Move to a different folder"})]})}),i.jsxs("div",{className:"space-y-2 border-t border-line bg-surface px-row-inset py-3",children:[i.jsx("p",{className:"text-2xs text-fg-subtle",children:hr(e,jt(o,s))}),i.jsx(ne,{variant:"primary",onClick:r,className:"h-11 w-full font-semibold",children:`Move ${e} out of Spam`}),i.jsx(ne,{variant:"ghost",onClick:a,className:"h-11 w-full",children:"Back"})]})]})}function pr({count:e,destinationLabel:o,onClose:t}){return i.jsxs("div",{className:"flex min-h-0 flex-col",children:[i.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 px-row-inset py-10 text-center",children:[i.jsx(Uo,{className:"size-10 text-positive","aria-hidden":!0}),i.jsx("p",{className:"text-base font-semibold text-fg",children:`Moved ${e} ${Dt(e)} out of Spam.`}),i.jsx("p",{className:"text-2xs text-fg-subtle",children:`You'll find them in ${o}.`})]}),i.jsx("div",{className:"border-t border-line bg-surface px-row-inset py-3",children:i.jsx(ne,{variant:"primary",onClick:t,className:"h-11 w-full font-semibold",children:"Done"})})]})}function xr({open:e,candidates:o,defaultDestinationId:t,availableFolders:s,delimiter:n,onConfirmMove:r,onCancel:a}){const[l,u]=c.useState("review"),[d,h]=c.useState(()=>e?new Set(o.map(T=>T.id)):new Set),[g,m]=c.useState(t),[v,S]=c.useState(0),b=c.useRef(!1);c.useEffect(()=>{e&&!b.current&&(u("review"),h(new Set(o.map(T=>T.id))),m(t),S(0)),b.current=e},[e,o,t]);const C=d.size,p=T=>{h(I=>{const O=new Set(I);return O.has(T)?O.delete(T):O.add(T),O})},x=(T,I)=>{h(O=>{const R=new Set(O);for(const A of T.messages)I?R.add(A.id):R.delete(A.id);return R})},E=()=>{const T=Array.from(d);S(T.length),r(T,g),u("done")};return i.jsxs(Vo,{open:e,onClose:a,label:"Rescue from spam",dismissLabel:"Close rescue",children:[l==="review"&&i.jsx(mr,{candidates:o,selected:d,onToggle:p,onToggleGroup:x,onSelectAll:()=>h(new Set(o.map(T=>T.id))),onSelectNone:()=>h(new Set),onContinue:()=>u("destination"),onCancel:a}),l==="destination"&&i.jsx(gr,{count:C,folders:s,delimiter:n,destination:g,onPick:m,onMove:E,onBack:()=>u("review")}),l==="done"&&i.jsx(pr,{count:v,destinationLabel:jt(s,g),onClose:a})]})}const vr=(e,o,t,s)=>`${e??""}|${o}|${t??""}|${s??""}`,br=({accountId:e,mailboxId:o})=>{const t=Mt(),{pushError:s}=Qt(),{requestAppointment:n}=Fs(),{trashByAccount:r}=Zt(),a=e?r.get(e):void 0,l=vr(e,o,a?.mailboxId,a?.source),[u,d]=c.useState({scope:l});u.scope!==l&&d({scope:l});const h=u.scope===l?u:void 0,g=c.useCallback(()=>t.getQueryData(Ds())?.accounts.find(I=>I.accountId===e)?.folderAppointments.find(I=>I.role==="Trash")?.mailboxId??o,[t,e,o]),m=c.useRef(void 0),{mutateAsync:v,isPending:S}=Rt({...Ks(),meta:Ws(409),onMutate:()=>(m.current=l,{scope:l,listMailboxId:g()}),onSuccess:(x,E,T)=>{T.scope===l&&d({scope:l,deletedCount:x.deletedCount})},onError:(x,E,T)=>{const I=Bs(x);if(!I){s({title:"Couldn't empty Trash",detail:$s(x),error:x});return}T?.scope===l&&d({scope:l,refusal:I})},onSettled:(x,E,T,I)=>{m.current===I?.scope&&(m.current=void 0),Ls(t,Ps([I?.listMailboxId??o])),e&&t.invalidateQueries({queryKey:Jt({path:{accountId:e}})})}}),b=c.useCallback(()=>e?(d({scope:l}),v({path:{accountId:e}}).then(()=>{},()=>{})):Promise.resolve(),[e,l,v]),C=c.useCallback(()=>{b()},[b]),p=c.useCallback(()=>{const x=h?.refusal;x&&n({accountId:x.accountId,role:x.role,reason:x.reason,action:{kind:"emptyTrash"},onAppointed:b})},[h,n,b]);return{emptyTrash:C,isEmptying:S&&m.current===l,deletedCount:h?.deletedCount,refusal:h?.refusal,repair:p}},Sr="We can verify this sender";function yr(e){const o={mailboxId:e??""},t={senderTrust:["vip","wellknown"],dkimMismatch:!1,results:!0,limit:500},{data:s}=pt({queryKey:At({path:o,query:t}),queryFn:async()=>{const r=[];let a;do{const{data:l}=await Nt({path:o,query:{...t,continuationToken:a},throwOnError:!0});r.push(...l.items??[]),a=l.continuationToken}while(a);return{items:r}},enabled:!!e,staleTime:6e4});return{candidates:(s?.items??[]).map(r=>({id:r.messageId,senderName:r.fromName||r.fromEmail||"Unknown sender",senderAddress:r.fromEmail??"",subject:r.subject||"(no subject)",snippet:r.snippet??"",trustReason:Sr,trustSubReason:bn(r.senderTrust),senderTrust:r.senderTrust}))}}const Cr=6e4,wr=({mailboxId:e,criteria:o,enabled:t})=>{const s={...o,count:!0,results:!1},{data:n}=pt({queryKey:At({path:{mailboxId:e},query:s}),queryFn:async()=>{const{data:r}=await Nt({path:{mailboxId:e},query:s,throwOnError:!0});return r},enabled:t,staleTime:Cr});return t?So(n?.count):{kind:"unknown"}},Tr=e=>{const o=new Set,t=[];for(const s of e)o.has(s.threadMessageId)||(o.add(s.threadMessageId),t.push(s));return t};function Ir(e){const o=e.toAddresses.join(", ");return{id:e.outboxMessageId,accountId:e.accountId,fromName:e.fromName??e.fromAddress??"Me",fromEmail:e.fromAddress??"",subject:e.subject??"(No subject)",snippet:o?`To: ${o}`:"(No recipients)",timeLabel:Ze(e.updatedAt),isRead:!0}}function kr(e){return{id:e.messageId,accountId:e.accountId,fromName:e.fromName??e.fromEmail??"Unknown",fromEmail:e.fromEmail??"",subject:e.subject??"(No subject)",snippet:e.snippet??"",timeLabel:Ze(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0,..._t(e)}}function Er({outboxMessages:e,accountId:o,imapThreads:t}){const s=e.filter(a=>a.status==="draft"&&a.accountId===o).map(Ir),n=t.map(kr),r=[];return s.length>0&&r.push({id:"remit-drafts",label:"Not yet sent (Remit)",threads:s}),n.length>0&&r.push({id:"imap-drafts",label:"On the server",threads:n}),r}const jr=({label:e,count:o})=>i.jsxs("div",{className:"sticky top-0 z-10 flex items-baseline justify-between border-b border-line bg-surface-sunken px-row-inset py-1",children:[i.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:e}),i.jsx("span",{className:"text-2xs text-fg-subtle tabular-nums",children:o})]}),Mr=({row:e,isSelected:o,onOpen:t,onDelete:s,isDeleting:n})=>i.jsxs("button",{type:"button",onClick:()=>t(e.id),className:Ae("group",ts({active:o})),children:[i.jsx(Qs,{className:"size-7 shrink-0 text-fg-muted mt-0.5"}),i.jsx(es,{thread:e}),i.jsx("div",{className:"flex items-center gap-1 shrink-0",children:i.jsx("button",{type:"button",onClick:r=>{r.stopPropagation(),s(e.id)},disabled:n,className:"p-1.5 rounded-md text-fg-muted hover:text-danger hover:bg-surface-raised transition-colors opacity-0 group-hover:opacity-100 focus:opacity-100",title:"Delete draft",children:i.jsx(Yt,{className:"size-3.5"})})})]}),Rr=({row:e,isSelected:o,onOpen:t})=>{const s=!e.isRead;return i.jsxs("button",{type:"button",onClick:()=>t(e.id),className:Ae("group",ts({active:o})),children:[s&&i.jsx("span",{className:"absolute left-1.5 top-1/2 size-1.5 -translate-y-1/2 rounded-full bg-accent"}),i.jsx(Ft,{name:e.fromName,email:e.fromEmail,size:"sm"}),i.jsx(es,{thread:e})]})};function Ar({accountId:e,selectedMessageId:o,imapThreads:t,title:s,unreadCount:n}){const r=Mo(),a=Ro(),l=et(),u=Mt(),{data:d}=pt(Vs()),h=c.useMemo(()=>Er({outboxMessages:d?.items??[],accountId:e,imapThreads:t}),[d?.items,e,t]),g=Rt({...Hs(),onSuccess:()=>{u.invalidateQueries({queryKey:qs()})}}),m=b=>{g.mutate({path:{outboxMessageId:b}})},v=b=>{const C=t.find(p=>p.messageId===b)?.threadId;C&&l({threadId:C,messageId:b})},S=h.length===0;return i.jsxs("section",{className:"flex h-full w-full flex-col bg-surface",children:[i.jsx(ko,{title:s,leading:i.jsx(Eo,{}),children:(n??0)>0&&i.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle tabular-nums",children:[n," unread"]})}),i.jsx("div",{className:"flex-1 overflow-y-auto",children:S?i.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-center px-4",children:[i.jsx(Us,{className:"size-8 text-fg-subtle"}),i.jsx("p",{className:"text-sm font-medium text-fg",children:"No drafts"}),i.jsx("p",{className:"text-xs text-fg-subtle",children:"Messages you start composing will appear here."})]}):h.map(b=>i.jsxs("div",{children:[b.label&&i.jsx(jr,{label:b.label,count:b.threads.length}),i.jsx("div",{className:"divide-y divide-line",children:b.threads.map(C=>b.id==="remit-drafts"?i.jsx(Mr,{row:C,isSelected:C.id===r,onOpen:a,onDelete:m,isDeleting:g.isPending},C.id):i.jsx(Rr,{row:C,isSelected:C.id===o,onOpen:v},C.id))})]},b.id))})]})}const ms=e=>e===1?"1 message":`${Gt(e)} messages`,Nr=e=>({title:"Empty Trash?",description:`${ms(e)} ${e===1?"is":"are"} erased from the mail server and cannot be restored.`,confirmLabel:"Empty Trash"}),Or=(e,o={})=>{const{trashFolderLabel:t,staleFolderLabel:s}=o;if(e==="unconfirmed"){const n=Js(0,"unconfirmed",{trashFolderLabel:t});return{headline:n.title,body:n.description,actionLabel:n.confirmLabel}}return e==="stale"?{headline:"Nothing was emptied.",body:s?`The folder you chose for Trash — ${s} — is gone from the mail server.`:"The folder you chose for Trash is gone from the mail server.",actionLabel:"Pick another folder"}:{headline:"Nothing was emptied.",body:"No folder on this account is set as Trash.",actionLabel:"Pick a folder"}};function _r({messageCount:e,isEmptying:o,deletedCount:t,refusalReason:s,trashFolderLabel:n,staleFolderLabel:r,onEmpty:a,onRepair:l,children:u}){const[d,h]=c.useState(!1);if(e<1&&s===void 0&&t===void 0)return i.jsx(i.Fragment,{children:u});const g=s?Or(s,{trashFolderLabel:n,staleFolderLabel:r}):void 0,m=Nr(e);return i.jsxs("div",{className:"relative flex h-full min-h-0 flex-col",children:[i.jsx("div",{className:"shrink-0 px-row-inset pt-2",children:i.jsxs("div",{className:"flex flex-col gap-2 rounded-md border border-line px-3 py-2",children:[i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[t!==void 0&&i.jsx("p",{className:"mr-auto text-2xs text-fg-subtle",role:"status",children:`${ms(t)} erased from the mail server.`}),i.jsx(ne,{variant:"ghost",size:"sm",icon:i.jsx(Yt,{className:"size-3.5","aria-hidden":!0}),disabled:o||e<1,"aria-busy":o,onClick:()=>h(!0),children:o?"Emptying…":"Empty Trash"})]}),g&&i.jsx(gt,{tone:"warning",variant:"soft",children:i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("p",{className:"font-semibold text-fg",children:g.headline}),i.jsx("p",{className:"text-sm",children:g.body}),i.jsx(ne,{variant:"primary",size:"sm",className:"self-start",onClick:l,children:g.actionLabel})]})})]})}),i.jsx("div",{className:"min-h-0 flex-1",children:u}),i.jsx(Do,{isOpen:d,title:m.title,description:m.description,confirmLabel:m.confirmLabel,destructive:!0,onConfirm:()=>{h(!1),a()},onCancel:()=>h(!1)})]})}function zr(e,o,t){const s=new Array(e);return new Proxy(s,{get(n,r,a){if(typeof r=="string"){const l=r.charCodeAt(0);if(l>=48&&l<=57){const u=+r;if(Number.isInteger(u)&&u>=0&&u<e){let d=n[u];if(!d){const h=o[u*2];d=n[u]={index:u,key:t(u),start:h,size:o[u*2+1],end:h+o[u*2+1],lane:0}}return d}}if(r==="length")return e}return Reflect.get(n,r,a)}})}function Pe(e,o,t){let s=t.initialDeps??[],n,r=!0;function a(){const l=e();return(l.length!==s.length||l.some((d,h)=>s[h]!==d))&&(s=l,n=o(...l),t?.onChange&&!(r&&t.skipInitialOnChange)&&t.onChange(n),r=!1),n}return a.updateDeps=l=>{s=l},a}function Ht(e,o){if(e===void 0)throw new Error("Unexpected undefined");return e}const Fr=(e,o)=>Math.abs(e-o)<1.01,Dr=(e,o,t)=>{let s;return function(...n){e.clearTimeout(s),s=e.setTimeout(()=>o.apply(this,n),t)}};let Ge;const kt=()=>{if(Ge!==void 0)return Ge;if(typeof navigator>"u")return Ge=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Ge=!0;const e=navigator.maxTouchPoints;return Ge=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Ut=e=>{const{offsetWidth:o,offsetHeight:t}=e;return{width:o,height:t}},Lr=e=>e,Pr=e=>{const o=Math.max(e.startIndex-e.overscan,0),s=Math.min(e.endIndex+e.overscan,e.count-1)-o+1,n=new Array(s);for(let r=0;r<s;r++)n[r]=o+r;return n},Br=(e,o)=>{const t=e.scrollElement;if(!t)return;const s=e.targetWindow;if(!s)return;const n=a=>{const{width:l,height:u}=a;o({width:Math.round(l),height:Math.round(u)})};if(n(Ut(t)),!s.ResizeObserver)return()=>{};const r=new s.ResizeObserver(a=>{const l=()=>{const u=a[0];if(u?.borderBoxSize){const d=u.borderBoxSize[0];if(d){n({width:d.inlineSize,height:d.blockSize});return}}n(Ut(t))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return r.observe(t,{box:"border-box"}),()=>{r.unobserve(t)}},mt={passive:!0},$r=typeof window>"u"?!0:"onscrollend"in window,Wr=(e,o,t)=>{const s=e.scrollElement;if(!s)return;const n=e.targetWindow;if(!n)return;const r=e.options.useScrollendEvent&&$r;let a=0;const l=r?null:Dr(n,()=>o(a,!1),e.options.isScrollingResetDelay),u=g=>()=>{a=t(s),l?.(),o(a,g)},d=u(!0),h=u(!1);return s.addEventListener("scroll",d,mt),r&&s.addEventListener("scrollend",h,mt),()=>{s.removeEventListener("scroll",d),r&&s.removeEventListener("scrollend",h)}},Kr=(e,o)=>Wr(e,o,t=>{const{horizontal:s,isRtl:n}=e.options;return s?t.scrollLeft*(n&&-1||1):t.scrollTop}),Vr=(e,o,t)=>{if(t.options.useCachedMeasurements){const s=t.indexFromElement(e),n=t.options.getItemKey(s);return t.itemSizeCache.get(n)??t.options.estimateSize(s)}if(o?.borderBoxSize){const s=o.borderBoxSize[0];if(s)return Math.round(s[t.options.horizontal?"inlineSize":"blockSize"])}if(!o){const s=t.indexFromElement(e),n=t.options.getItemKey(s),r=t.itemSizeCache.get(n);if(r!==void 0)return r}return e[t.options.horizontal?"offsetWidth":"offsetHeight"]},qr=(e,{adjustments:o=0,behavior:t},s)=>{var n,r;(r=(n=s.scrollElement)==null?void 0:n.scrollTo)==null||r.call(n,{[s.options.horizontal?"left":"top"]:e+o,behavior:t})},Hr=qr;class Ur{constructor(o){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var t,s,n;return((n=(s=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:s.now)==null?void 0:n.call(s))??Date.now()},this.observer=(()=>{let t=null;const s=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(n=>{n.forEach(r=>{const a=()=>{const l=r.target,u=this.indexFromElement(l);if(!l.isConnected){this.observer.unobserve(l);for(const[d,h]of this.elementsCache)if(h===l){this.elementsCache.delete(d);break}return}this.shouldMeasureDuringScroll(u)&&this.resizeItem(u,this.options.measureElement(l,r,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var n;(n=s())==null||n.disconnect(),t=null},observe:n=>{var r;return(r=s())==null?void 0:r.observe(n,{box:"border-box"})},unobserve:n=>{var r;return(r=s())==null?void 0:r.unobserve(n)}}})(),this.range=null,this.setOptions=t=>{var s,n;const r={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Lr,rangeExtractor:Pr,onChange:()=>{},measureElement:Vr,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const m in t){const v=t[m];v!==void 0&&(r[m]=v)}const a=this.options;let l=null,u=null,d=!1;if(a!==void 0&&a.enabled&&r.enabled&&r.anchorTo==="end"&&this.scrollElement!==null){const m=a.count,v=r.count,S=this.getMeasurements(),b=m>0?((s=S[0])==null?void 0:s.key)??a.getItemKey(0):null,C=m>0?((n=S[m-1])==null?void 0:n.key)??a.getItemKey(m-1):null;if(v!==m||m>0&&v>0&&(r.getItemKey(0)!==b||r.getItemKey(v-1)!==C)){d=!0;const E=m>0?this.getVirtualItemForOffset(this.getScrollOffset())??S[0]:null;E&&(l=[E.key,this.getScrollOffset()-E.start]);const T=r.followOnAppend===!0?"auto":r.followOnAppend||null;T&&v>m&&this.isAtEnd(a.scrollEndThreshold)&&(m===0||r.getItemKey(v-1)!==C)&&(u=T)}}this.options=r,d&&(this.pendingMin=0,this.itemSizeCacheVersion++);let h=!1,g=0;if(l&&this.scrollOffset!==null){const[m,v]=l,S=this.getMeasurements(),{count:b,getItemKey:C}=this.options;let p=0;for(;p<b&&C(p)!==m;)p++;if(p<b){const x=S[p];if(x){const E=x.start+v;E!==this.scrollOffset&&(g=E-this.scrollOffset,this.scrollOffset=E,h=!0)}}}(h||u)&&(this.pendingScrollAnchor=[h?l[0]:null,h?l[1]:0,u,g])},this.notify=t=>{var s,n;(n=(s=this.options).onChange)==null||n.call(s,this,t)},this.maybeNotify=Pe(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}if(this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(r=>{this.observer.observe(r)}),this.unsubs.push(this.options.observeElementRect(this,r=>{this.scrollRect=r,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(r,a)=>{if(a&&this._intendedScrollOffset===null&&r===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(r-this._intendedScrollOffset)<1.5&&(r=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;const l=this.getScrollOffset();this.scrollDirection=a?l===r?this.scrollDirection:l<r?"forward":"backward":null,this.scrollOffset=r,this.isScrolling=a,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const r=this.scrollElement,a=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},l=()=>{this._iosTouching=!1,!(!kt()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};r.addEventListener("touchstart",a,mt),r.addEventListener("touchend",l,mt),this.unsubs.push(()=>{r.removeEventListener("touchstart",a),r.removeEventListener("touchend",l),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const n=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,n&&this.scrollElement&&this.options.enabled){const[r,a,l,u]=n;r!==null&&!l&&(kt()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?u!==0&&(this._iosDeferredAdjustment+=u):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),l&&this.scrollToEnd({behavior:l})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const t=this.getScrollOffset(),s=this.getMaxScrollOffset();if(t<0||t>s)return;const n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(t,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=Pe(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(t,s,n,r,a,l,u,d)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMin=null,{count:t,paddingStart:s,scrollMargin:n,getItemKey:r,enabled:a,lanes:l,laneAssignmentMode:u,gap:d}),{key:!1}),this.getMeasurements=Pe(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:t,paddingStart:s,scrollMargin:n,getItemKey:r,enabled:a,lanes:l,laneAssignmentMode:u,gap:d},h)=>{const g=this.itemSizeCache;if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const p of this.laneAssignments.keys())p>=t&&this.laneAssignments.delete(p);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(p=>{this.itemSizeCache.set(p.key,p.size)}));const m=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1),l===1){const p=t*2;let x=this._flatMeasurements;if(!x||x.length<p){const I=new Float64Array(p);x&&m>0&&I.set(x.subarray(0,m*2)),x=I,this._flatMeasurements=x}let E;if(m===0)E=s+n;else{const I=m-1;E=x[I*2]+x[I*2+1]+d}for(let I=m;I<t;I++){const O=r(I),R=g.get(O),A=typeof R=="number"?R:this.options.estimateSize(I);x[I*2]=E,x[I*2+1]=A,E+=A+d}const T=zr(t,x,r);return this.measurementsCache=T,T}const v=this.measurementsCache.slice(0,m),S=new Array(l).fill(void 0),b=new Float64Array(l);let C=0;for(let p=0;p<m;p++){const x=v[p];x&&(S[x.lane]===void 0&&C++,S[x.lane]=p,b[x.lane]=x.end)}for(let p=m;p<t;p++){const x=r(p),E=this.laneAssignments.get(p);let T,I;const O=u==="estimate"||g.has(x);if(E!==void 0&&this.options.lanes>1){T=E;const G=S[T],N=G!==void 0?v[G]:void 0;I=N?N.end+d:s+n}else if(C===l){let G=0,N=b[0],q=S[0];for(let z=1;z<l;z++){const F=b[z];(F<N||F===N&&S[z]<q)&&(G=z,N=F,q=S[z])}T=G,I=N+d,O&&this.laneAssignments.set(p,T)}else T=p%this.options.lanes,I=s+n,O&&this.laneAssignments.set(p,T);const R=g.get(x),A=typeof R=="number"?R:this.options.estimateSize(p),P=I+A;v[p]={index:p,start:I,size:A,end:P,key:x,lane:T},S[T]===void 0&&C++,S[T]=p,b[T]=P}return this.measurementsCache=v,v},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Pe(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,s,n,r)=>t.length===0||s===0?(this.range=null,null):(this.range=Jr(t,s,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Pe(()=>{let t=null,s=null;const n=this.calculateRange();return n&&(t=n.startIndex,s=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,s]},(t,s,n,r,a)=>r===null||a===null?[]:t({startIndex:r,endIndex:a,overscan:s,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const s=this.options.indexAttribute,n=t.getAttribute(s);return n?parseInt(n,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const n=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(n!==void 0&&this.range){const r=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,n-r),l=Math.min(this.options.count-1,n+r);return t>=a&&t<=l}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((a,l)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(l))});return}const s=this.indexFromElement(t),n=this.options.getItemKey(s),r=this.elementsCache.get(n);r!==t&&(r&&this.observer.unobserve(r),this.observer.observe(t),this.elementsCache.set(n,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,s)=>{var n,r;if(t<0||t>=this.options.count)return;let a,l,u;const d=this._flatMeasurements;if(this.options.lanes===1&&d!==null)u=this.options.getItemKey(t),l=d[t*2],a=d[t*2+1];else{const m=this.measurementsCache[t];if(!m)return;u=m.key,l=m.start,a=m.size}const h=this.itemSizeCache.get(u)??a,g=s-h;if(g!==0){const m=this.options.anchorTo==="end"&&((n=this.scrollState)==null?void 0:n.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,v=m?this.getTotalSize():0,S=((r=this.scrollState)==null?void 0:r.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t]??{index:t,key:u,start:l,size:a,end:l+a,lane:0},g,this):l<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(u)||this.scrollDirection!=="backward"));(this.pendingMin===null||t<this.pendingMin)&&(this.pendingMin=t),this.itemSizeCache.set(u,s),this.itemSizeCacheVersion++,m?this.applyScrollAdjustment(this.getTotalSize()-v):S&&this.applyScrollAdjustment(g),this.notify(!1)}},this.getVirtualItems=Pe(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,s)=>{const n=[];for(let r=0,a=t.length;r<a;r++){const l=t[r],u=s[l];n.push(u)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const s=this.getMeasurements();if(s.length===0)return;const n=this._flatMeasurements,r=this.options.lanes===1&&n!=null,a=gs(0,s.length-1,r?l=>n[l*2]:l=>Ht(s[l]).start,t);return Ht(s[a])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(t=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=t,this.getOffsetForAlignment=(t,s,n=0)=>{if(!this.scrollElement)return 0;const r=this.getSize(),a=this.getScrollOffset();s==="auto"&&(s=t>=a+r?"end":"start"),s==="center"?t+=(n-r)/2:s==="end"&&(t-=r);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,t),0)},this.getOffsetForIndex=(t,s="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const n=this.getSize(),r=this.getScrollOffset(),a=this.measurementsCache[t];if(!a)return;if(s==="auto")if(a.end>=r+n-this.options.scrollPaddingEnd)s="end";else if(a.start<=r+this.options.scrollPaddingStart)s="start";else return[r,s];if(s==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),s];const l=s==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,s,a.size),s]},this.scrollToOffset=(t,{align:s="start",behavior:n="auto"}={})=>{const r=this.getOffsetForAlignment(t,s),a=this.now();this.scrollState={index:null,align:s,behavior:n,startedAt:a,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:s="auto",behavior:n="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const r=this.getOffsetForIndex(t,s);if(!r)return;const[a,l]=r,u=this.now();this.scrollState={index:t,align:l,behavior:n,startedAt:u,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:s="auto"}={})=>{const n=this.getScrollOffset()+t,r=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:t="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:t});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:t})},this.getTotalSize=()=>{var t;const s=this.getMeasurements();let n;if(s.length===0)n=this.options.paddingStart;else if(this.options.lanes===1){const r=s.length-1,a=this._flatMeasurements;a!=null?n=a[r*2]+a[r*2+1]:n=((t=s[r])==null?void 0:t.end)??0}else{const r=Array(this.options.lanes).fill(null);let a=s.length-1;for(;a>=0&&r.some(l=>l===null);){const l=s[a];r[l.lane]===null&&(r[l.lane]=l.end),a--}n=Math.max(...r.filter(l=>l!==null))}return Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const t=[];if(this.itemSizeCache.size===0)return t;const s=this.getMeasurements();for(const n of s)n&&this.itemSizeCache.has(n.key)&&t.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return t},this._scrollToOffset=(t,{adjustments:s,behavior:n})=>{this._intendedScrollOffset=t+(s??0),this.options.scrollToFn(t,{behavior:n,adjustments:s},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(o)}applyScrollAdjustment(o,t){o!==0&&(kt()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=o:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=o,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,n=s?s[0]:this.scrollState.lastTargetOffset,r=1,a=n!==this.scrollState.lastTargetOffset;if(!a&&Fr(n,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=r){this.getScrollOffset()!==n&&this._scrollToOffset(n,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,a){const l=this.getSize()||600,u=Math.abs(n-this.getScrollOffset()),d=this.scrollState.behavior==="smooth"&&u>l;this.scrollState.lastTargetOffset=n,d||(this.scrollState.behavior="auto"),this._scrollToOffset(n,{adjustments:void 0,behavior:d?"smooth":"auto"})}this.scheduleScrollReconcile()}}const gs=(e,o,t,s)=>{for(;e<=o;){const n=(e+o)/2|0,r=t(n);if(r<s)e=n+1;else if(r>s)o=n-1;else return n}return e>0?e-1:0};function Qr(e,o,t){let s=0;for(;s<=o;){const n=(s+o)/2|0,r=e[n*2];if(r<t)s=n+1;else if(r>t)o=n-1;else return n}return s>0?s-1:0}function Jr(e,o,t,s,n){const r=e.length-1;if(e.length<=s)return{startIndex:0,endIndex:r};if(s===1&&n!==null){const d=Qr(n,r,t);let h=d;const g=t+o;for(;h<r&&n[h*2]+n[h*2+1]<g;)h++;return{startIndex:d,endIndex:h}}let l=gs(0,r,d=>e[d].start,t),u=l;if(s===1)for(;u<r&&e[u].end<t+o;)u++;else if(s>1){const d=Array(s).fill(0);for(;u<r&&d.some(g=>g<t+o);){const g=e[u];d[g.lane]=g.end,u++}const h=Array(s).fill(t+o);for(;l>=0&&h.some(g=>g>=t);){const g=e[l];h[g.lane]=g.start,l--}l=Math.max(0,l-l%s),u=Math.min(r,u+(s-1-u%s))}return{startIndex:l,endIndex:u}}const Et=typeof document<"u"?c.useLayoutEffect:c.useEffect;function Yr({useFlushSync:e=!0,directDomUpdates:o=!1,directDomUpdatesMode:t="transform",...s}){const n=c.useReducer(d=>d+1,0)[1],r=c.useRef({enabled:o,mode:t,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});r.current.enabled=o,r.current.mode=t;const a=d=>{const h=r.current;if(!h.enabled||!h.container)return;const g=d.getTotalSize();if(g!==h.lastSize){h.lastSize=g;const p=d.options.horizontal?"width":"height";h.container.style[p]=`${g}px`}const m=!!d.options.horizontal,v=h.mode==="transform",S=m?"left":"top",b=d.options.scrollMargin,C=d.getVirtualItems();for(const p of C){const x=p.start-b,E=d.elementsCache.get(p.key);E&&h.lastPositions.get(E)!==x&&(h.lastPositions.set(E,x),v?E.style.transform=m?`translate3d(${x}px, 0, 0)`:`translate3d(0, ${x}px, 0)`:E.style[S]=`${x}px`)}},l={...s,onChange:(d,h)=>{var g;const m=r.current;let v=!0;if(m.enabled){a(d);const S=d.range,b=m.prevRange;v=!b||b.isScrolling!==d.isScrolling||b.startIndex!==S?.startIndex||b.endIndex!==S?.endIndex,v&&(m.prevRange=S?{startIndex:S.startIndex,endIndex:S.endIndex,isScrolling:d.isScrolling}:null)}v&&(e&&h?Ys.flushSync(n):n()),(g=s.onChange)==null||g.call(s,d,h)}},[u]=c.useState(()=>{const d=new Ur(l);return Object.assign(d,{containerRef:h=>{const g=r.current;if(g.container=h,g.lastSize=null,h&&g.enabled){const m=d.getTotalSize();g.lastSize=m;const v=d.options.horizontal?"width":"height";h.style[v]=`${m}px`}}})});return u.setOptions(l),Et(()=>u._didMount(),[]),Et(()=>u._willUpdate()),Et(()=>{a(u)}),u}function Gr(e){return Yr({observeElementRect:Br,observeElementOffset:Kr,scrollToFn:Hr,...e})}const Lt=e=>e.query?`matching "${e.query}"`:e.from?`from "${e.from}"`:"matching your search",Xr=e=>`Select all ${Lt(e)}`,Zr=(e,o)=>`All ${Gt(o)} ${Lt(e)} selected`,ei=({verb:e,confirmingDelete:o,hasSelection:t,junkMailboxId:s,currentMailboxId:n,deletableMessageId:r})=>{if(o)return{kind:"withheld"};if(e==="junk"){const a=Sn(s,n);if(a!==void 0)return{kind:"unavailable",reason:a}}return t?{kind:"openWizard"}:e!=="delete"||r===void 0?{kind:"declined"}:{kind:"confirmDelete",messageId:r}},ti=(e,o,t)=>e==="BACK"&&o&&t===void 0,si=(e,o)=>({id:e.messageId,accountId:e.accountId,mailboxId:e.mailboxId,threadId:e.threadId,fromName:e.fromName??e.fromEmail??"Unknown",fromEmail:e.fromEmail??"",subject:e.subject??"(No subject)",snippet:e.snippet??"",timeLabel:Ze(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0,trust:e.senderTrust,category:ss(e.category),messageCount:o,suspicious:e.authenticity?.dkimMismatch===!0,labels:e.labels,..._t(e)}),ni=({thread:e,mailboxId:o,isSelected:t,isFocused:s,isTabStop:n,onFocusRow:r,isChecked:a,onToggleCheck:l,onRowSelect:u,messageCount:d,isMultiSelectMode:h,onLongPress:g,isDesktop:m,density:v})=>i.jsx(yn,{thread:si(e,d),link:{mailboxId:o,threadId:e.threadId},inListbox:!0,active:t,focused:s,isTabStop:n,density:v,isDesktop:m,onFocusRow:r,selection:{isChecked:a,onToggleCheck:l,onRowSelect:u,isMultiSelectMode:h,onLongPress:g}}),oi=c.memo(ni),ri=e=>{const o=e.authenticity?.dkimMismatch===!0;return{id:e.messageId,accountId:e.accountId,fromName:e.fromName??e.fromEmail??"Unknown",fromEmail:e.fromEmail??"",subject:e.subject??"(No subject)",snippet:e.snippet??"",timeLabel:Ze(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0,trust:e.senderTrust,category:ss(e.category),suspicious:o,..._t(e)}},ii=({thread:e,mailboxId:o,isSelected:t,isFocused:s,isTabStop:n,onFocusRow:r,isChecked:a,onToggleCheck:l,onRowSelect:u,isMultiSelectMode:d,onLongPress:h,isDesktop:g,onDelete:m,onToggleRead:v,density:S})=>{const[b,C]=c.useState("none"),p=et(),x=c.useCallback(R=>{navigator.vibrate?.(10),R==="trailing"?m(e.messageId):v(e.messageId,e.isRead),C("none")},[m,v,e.messageId,e.isRead]),E=c.useCallback(()=>{h(e.messageId)},[h,e.messageId]),T=c.useCallback(()=>{l(e.messageId)},[l,e.messageId]),I=c.useCallback(()=>{p({threadId:e.threadId,messageId:e.messageId})},[p,e.threadId,e.messageId]),O=Cn(e.messageId,u);return g||d?i.jsx(oi,{thread:e,mailboxId:o,isSelected:t,isFocused:s,isTabStop:n,onFocusRow:r,isChecked:a,onToggleCheck:l,onRowSelect:u,isMultiSelectMode:d,onLongPress:h,isDesktop:g,density:S}):i.jsx("div",{role:"presentation",onPointerDownCapture:O.onMouseDown,onClickCapture:O.claimClick,onContextMenu:O.onContextMenu,children:i.jsx(fn,{thread:ri(e),selectionMode:!1,checked:!1,active:t,peek:b,onPeek:C,onToggleCheck:T,onLongPress:E,onOpen:I,onAct:x})})},li=72,ai=32,ci=5,ps="remit:list-density",ui=()=>{try{const e=localStorage.getItem(ps);if(e==="compact"||e==="comfortable")return e}catch{}return"comfortable"},di=(e,o,t)=>Co(e.filter(s=>o.has(s.messageId)).map(s=>s.accountId??t)).moveDisabledHint,hi=({mailboxId:e,threads:o,selectedMessageId:t,isLoading:s,isError:n=!1,error:r,onRetry:a,searchQuery:l,searchPredicate:u,resultCount:d={kind:"unknown"},onDeleteMessages:h,isDeleting:g=!1,isMoving:m=!1,onLoadMore:v,hasMore:S=!1,isLoadingMore:b=!1,accountId:C,listTitle:p,listMeta:x,listFilter:E,listSearchText:T,listScopeLabel:I,onTriageContextChange:O,commandsRef:R,hideHeader:A=!1})=>{const P=c.useRef(null),G=et(),N=Wo(),q=Gs(),{verb:z,start:F,startFromSearch:ee}=q,ue=Xs(),H=!!l?.trim(),B=wn(),{labels:de}=Po(C),{pushError:se}=Qt(),[M,j]=c.useState(t),[U,ke]=c.useState(),D=c.useCallback(f=>{ke(y=>y===f?y:void 0),j(f)},[]),[oe,Be]=c.useState(ui),Q=c.useCallback(()=>{Be(f=>{const y=f==="comfortable"?"compact":"comfortable";try{localStorage.setItem(ps,y)}catch{}return y})},[]),{toggleReadFor:Ee}=ns({mailboxId:e}),{junkMailboxId:Se}=os(C),ye=rs(Se,e),Ne=c.useMemo(()=>[{accountId:C,mailboxId:e}],[C,e]),{outcome:he,staleFolderLabel:$e,guessedMailboxId:We}=Tn(Ne),{selectedIds:L,selectedCount:$,hasSelection:re,isSelected:ie,toggle:le,select:ae,clearSelection:je,selectRange:Ce,setAnchor:Oe,selectAll:Ke,toggleAll:fe,intersectWith:tt}=In(),Ve=On($,N),[we,_]=c.useState(null),st=c.useCallback((f,y,be)=>{const Z=Zs(f,y,be,he);Z&&se(Z)},[se,he]),Me=H&&!!u,nt=`${e}|${JSON.stringify(u??{})}`,k=kn({mailboxId:e,mailboxLabel:p,accountId:C,enabled:Me,predicateKey:nt,searchQuery:u??{},reportEnding:st}),ot=k.phase.kind,qe=k.clear,K=c.useCallback(()=>{ot==="escalated"&&qe(),je()},[je,qe,ot]),[rt,me]=c.useState(null),Te=c.useRef(null),ge=c.useRef(!1),_e=c.useRef(null),Re=!s&&o.length>0,pe=Gr({count:o.length,getScrollElement:()=>P.current,estimateSize:()=>oe==="compact"?ai:li,overscan:ci}),He=t?o.findIndex(f=>f.messageId===t):-1,J=M?o.findIndex(f=>f.messageId===M):-1,ce=c.useCallback(f=>{if(f<0||f>=o.length)return;const y=o[f];if(Ve){le(y.messageId);return}Te.current=y.messageId,ge.current=!1,ke(y.messageId),j(y.messageId)},[o,Ve,le]),ze=c.useCallback(()=>{if(o.length===0)return;const f=J<0?0:Math.min(J+1,o.length-1);ce(f)},[o.length,J,ce]),it=c.useCallback(()=>{if(o.length===0)return;const f=J<=0?0:J-1;ce(f)},[o.length,J,ce]),Ue=c.useCallback(()=>ce(0),[ce]),Qe=c.useCallback(()=>ce(o.length-1),[ce,o.length]),Ie=c.useCallback(()=>{M&&le(M)},[M,le]),W=c.useMemo(()=>o.map(f=>f.messageId),[o]),Fe=c.useMemo(()=>{const f=[];for(const y of o)L.has(y.messageId)&&f.push({id:y.messageId,sender:y.fromName??y.fromEmail??"Unknown",email:y.fromEmail??"",subject:y.subject??"(No subject)",date:Ze(y.sentDate),accountId:C,mailboxId:y.mailboxId});return f},[o,L,C]),bt=c.useCallback((f,y)=>y.shiftKey?(Ce(W,f,M),!0):y.metaKey||y.ctrlKey?(le(f),!0):(K(),Oe(f),!1),[W,M,Ce,le,K,Oe]),lt=c.useCallback(f=>{!h||f.length===0||(_e.current=M??null,_(f))},[h,M]),De=c.useCallback(f=>{const y=En(W,M,f);y!==void 0&&(Ce(W,y),Te.current=y,ge.current=!1,ke(void 0),j(y))},[W,M,Ce]),xe=c.useCallback(()=>De(-1),[De]),at=c.useCallback(()=>De(1),[De]),ct=c.useCallback(()=>{W.length>0&&Ke(W)},[W,Ke]),ut=c.useCallback(f=>{const y=ei({verb:f,confirmingDelete:we!==null,hasSelection:re,junkMailboxId:Se,currentMailboxId:e,deletableMessageId:h?M:void 0});return y.kind==="openWizard"?(F(f),!0):y.kind==="confirmDelete"?(lt([y.messageId]),!0):y.kind==="unavailable"?(se({severity:"warning",title:y.reason}),!0):y.kind==="withheld"},[we,h,re,Se,e,F,M,lt,se]),ve=c.useCallback((f,y)=>{const be=o.find(Z=>Z.messageId===f)?.threadId;be&&G({threadId:be,messageId:f},{replace:y?.replace})},[G,o]),dt=c.useCallback(()=>{M&&ve(M)},[M,ve]),Je=c.useRef(void 0),St=c.useCallback(f=>{Je.current=f,ve(f,{replace:!0})},[ve]);jn({keyboardFocusedMessageId:U,openMessageId:t,enabled:N&&$===0,open:St});const Le=k.phase.kind==="escalated"?{scope:Lt(u??{}),total:k.phase.total,searchQuery:u??{},run:(f,y)=>k.runAction(f,void 0,y),stop:k.stop}:void 0,ht=c.useCallback(f=>{if(f.length===0){_(null);return}const y=new Set(f),be=o.findIndex(te=>y.has(te.messageId));let Z;for(let te=be+1;te<o.length;te++)if(!y.has(o[te].messageId)){Z=o[te].messageId;break}if(Z===void 0){for(let te=be-1;te>=0;te--)if(!y.has(o[te].messageId)){Z=o[te].messageId;break}}h?.(f),K(),_e.current=null,_(null),Z!==void 0&&(Te.current=Z,ge.current=!1,D(Z),N&&ve(Z,{replace:!0})),N||me(en("delete",f.length,he))},[o,h,K,ve,N,D,he]),yt=c.useCallback(()=>{const f=_e.current;_e.current=null,_(null),f!==null&&(Te.current=f,ge.current=!1,D(f))},[D]),Ye=c.useMemo(()=>di(o,L,C),[C,L,o]),Ct=c.useCallback(()=>{if(Le){ee();return}F("organize")},[Le,ee,F]),ft=c.useCallback(f=>{h?.([f])},[h]),wt=c.useCallback((f,y)=>{Ee([f],!y)},[Ee]),w=c.useCallback(f=>{N||ae(f)},[N,ae]),X=c.useCallback(()=>{if(k.isRunning||k.phase.kind==="counting"){k.stop();return}K()},[k,K]),Y=c.useCallback(()=>{k.clear()},[k]);c.useEffect(()=>{if(ge.current||!N&&t)return;const f=J>=0?J:He;f>=0&&pe.scrollToIndex(f,{align:"auto"})},[J,He,pe,N,t]),c.useEffect(()=>{if(!t)return;const f=Je.current===t;Je.current=void 0,!f&&(ge.current=!1,D(t))},[t,D]),c.useEffect(()=>{M&&(o.some(f=>f.messageId===M)||D(o[0]?.messageId))},[o,M,D]),c.useEffect(()=>{O?.({focusedMessageId:M,selectedIds:Array.from(L),hasList:Re})},[M,L,Re,O]);const Pt=c.useRef(O);Pt.current=O,c.useEffect(()=>()=>Pt.current?.({focusedMessageId:void 0,selectedIds:[],hasList:!1}),[]),c.useEffect(()=>{k.phase.kind!=="idle"||k.isRunning||tt(o.map(f=>f.messageId))},[o,tt,k.phase,k.isRunning]);const Bt=c.useRef(e);c.useEffect(()=>{Bt.current!==e&&(Bt.current=e,K())},[e,K]),Lo({shouldBlockFn:({action:f})=>ti(f,re,ue)?(K(),!0):!1,enableBeforeUnload:!1,disabled:!re||ue!==void 0}),c.useEffect(()=>{const f=P.current;if(!f||!S||!v)return;const y=()=>{if(b)return;const{scrollTop:be,scrollHeight:Z,clientHeight:te}=f;be+te>=Z-200&&v()};return f.addEventListener("scroll",y,{passive:!0}),y(),()=>f.removeEventListener("scroll",y)},[S,b,v]),c.useEffect(()=>{const f=Te.current;if(!f)return;const y=P.current?.querySelector(`[data-message-id="${f}"]`);y&&(Te.current=null,y.focus({preventScroll:!0}))}),c.useEffect(()=>{if(R){if(!Re){R.current=null;return}return R.current={focusNext:ze,focusPrevious:it,focusFirst:Ue,focusLast:Qe,openFocused:dt,toggleSelect:Ie,extendSelectDown:at,extendSelectUp:xe,selectAll:ct,clearSelection:()=>re?(K(),!0):!1,requestVerb:ut,toggleDensity:Q},()=>{R.current=null}}},[R,Re,ze,it,Ue,Qe,dt,Ie,at,xe,ct,re,K,ut,Q]);const $t=s?"loading":n?"error":o.length===0?"empty":"ready",bs=n?Ko(r):void 0,Ss=c.useCallback(()=>{const f=tn(sn());window.open(f,"_blank","noopener,noreferrer")},[]),ys=[{id:"inbox",threads:[]}],Tt=W.length>0&&W.every(f=>L.has(f)),Cs=Me&&S&&Tt&&!g&&!m&&k.phase.kind==="idle"&&!k.isRunning,ws=g||m||k.isRunning,It=k.phase.kind==="escalated"?k.phase.total:k.progress?k.progress.total:$,Ts=k.runningAction?nn(k.runningAction.kind,k.progress?.done??0,k.progress?.total??It):k.phase.kind==="counting"?"Counting matches…":k.phase.kind==="escalated"?Zr(u??{},k.phase.total):void 0,Is=k.phase.kind!=="escalated"&&W.length>0?{checked:Tt,indeterminate:$>0&&!Tt,onChange:()=>fe(W)}:void 0,ks=k.runningAction?{value:k.progress?.done??0,max:k.progress?.total??It,tone:on(k.runningAction.kind)}:void 0,Es=(k.isRunning||k.phase.kind==="counting"?{tone:"info",text:"",action:{label:"Stop",onClick:k.stop}}:k.phase.kind==="escalated"?{tone:"info",text:"",action:{label:"Clear selection",onClick:Y}}:Cs?{tone:"info",text:"",action:{label:Xr(u??{}),onClick:k.escalate}}:void 0)??(Ye?{tone:"warning",text:Ye}:void 0),js=i.jsx(Mn,{title:B.title||p,navSlot:B.navSlot,titleMeta:B.titleMeta,searchSlot:B.searchSlot,searchField:B.searchField,idleSlot:B.makeFilterSlot,count:It,onCancel:X,onDelete:()=>F("delete"),onMove:()=>F("move"),onOrganize:Ct,onJunk:ye?()=>F("junk"):void 0,onMarkRead:()=>F("markRead"),overflowSlot:C&&e&&$>0&&de.length>0?i.jsx(yo,{accountId:C,mailboxId:e,messageIds:Array.from(L)}):void 0,isBusy:ws,isCounting:k.phase.kind==="counting",selectAll:Is,statusLabel:Ts,progress:ks,notice:Es}),Ms=Rn(W,M),Rs=c.useCallback(f=>{ge.current=!0,D(f)},[D]),As=i.jsxs(i.Fragment,{children:[H&&l&&i.jsx(Yo,{query:l,count:d}),i.jsxs("div",{ref:P,role:"listbox","aria-multiselectable":!0,"aria-label":p,className:"flex-1 overflow-y-auto",children:[i.jsx("div",{role:"presentation",className:"relative w-full",style:{height:`${pe.getTotalSize()}px`},children:pe.getVirtualItems().map(f=>{const y=o[f.index];return i.jsx("div",{role:"presentation","data-index":f.index,ref:pe.measureElement,className:Ae("absolute left-0 top-0 w-full border-b border-line",k.isRunning&&"pointer-events-none opacity-50"),style:{transform:`translateY(${f.start}px)`},children:i.jsx(ii,{thread:y,mailboxId:e,isSelected:t===y.messageId,isFocused:M===y.messageId,isTabStop:Ms===y.messageId,onFocusRow:Rs,isChecked:ie(y.messageId),onToggleCheck:le,onRowSelect:bt,isMultiSelectMode:Ve,onLongPress:w,isDesktop:N,onDelete:ft,onToggleRead:wt,density:oe})},f.key)})}),b&&i.jsx(mn,{})]})]});return i.jsxs(i.Fragment,{children:[rt&&!N&&i.jsx(gt,{tone:"success",variant:"soft",className:"m-2 rounded-md",onDismiss:()=>me(null),children:rt}),i.jsx(gn,{listTitle:p,listMeta:x,sections:ys,flatList:!0,listState:B.searchResults?"ready":$t,searchQuery:T,listFilter:E,listScopeLabel:I,errorMessage:bs,onRetry:a,onReportError:Ss,density:oe,selectedThreadId:t,onSelectThread:f=>ve(f),isDesktop:N,hideHeader:A,selectionBar:js,listBody:B.searchResults??($t==="ready"?As:void 0)}),i.jsx(An,{isOpen:we!==null,messageIds:we??[],outcome:he,accountId:C,trashFolderLabel:p,staleFolderLabel:$e,guessedMailboxId:We,isDeleting:g,onConfirm:ht,onCancel:yt}),i.jsx(Nn,{verb:z,accountId:C,mailboxId:e,mailboxLabel:p,selection:Fe,selectionRestriction:Ye?"spansAccounts":void 0,escalated:Le,escalatedProgress:k.progress,onFinished:K,onRunEnded:st})]})},fi=e=>Jt({path:{accountId:e}}),mi=e=>{const o=Mt(),t=Ot(),s=Rt({...rn(),onSuccess:()=>{t.recordEvent("sync.triggered"),o.invalidateQueries({queryKey:fi(e)})}});return{trigger:()=>{s.mutate({path:{accountId:e}})},triggerAsync:()=>s.mutateAsync({path:{accountId:e}}),isPending:s.isPending,error:s.error,reset:s.reset}},gi=({accountId:e,children:o})=>{const{triggerAsync:t,isPending:s}=mi(e);return i.jsx(or,{onRefresh:t,isRefreshing:s,children:o})};function pi({accountId:e,currentMailboxId:o,candidates:t,onMove:s,children:n}){const[r,a]=c.useState(!1),l=Ot(),u=ln(),{inboxMailboxId:d}=_n(e),h=zn(e),{data:g}=pt({...an({path:{accountId:e}}),staleTime:1/0}),m=c.useMemo(()=>cn({mailboxes:g?.items??[],folderAppointments:h,currentMailboxId:o,translator:u}),[g?.items,h,o,u]),v=c.useMemo(()=>d||(m.find(x=>x.label.toLowerCase()==="inbox")?.id??m.find(x=>!x.isCurrent)?.id??""),[d,m]),S=c.useRef(!1);c.useEffect(()=>{S.current||(S.current=!0,Fn(l,t.length))},[l,t.length]);const b=c.useCallback(()=>{Dn(l,t.length),a(!0)},[l,t.length]),C=c.useCallback((p,x)=>{Ln(l,{selected:p.length,total:t.length,toInbox:x===d}),s(p,x)},[l,t.length,d,s]);return i.jsxs("div",{className:"relative flex h-full min-h-0 flex-col",children:[i.jsx("div",{className:"shrink-0 px-row-inset pt-2",children:i.jsx(ir,{count:t.length,onReview:b})}),i.jsx("div",{className:"min-h-0 flex-1",children:n}),i.jsx(xr,{open:r,candidates:t,defaultDestinationId:v,availableFolders:m,delimiter:un(g?.items??[]),onConfirmMove:C,onCancel:()=>a(!1)})]})}const xi=50,xs=c.createContext(null);function vt(){const e=c.useContext(xs);if(!e)throw new Error("MailboxPane.* must be used inside <MailboxPane>");return e}function vi({mailboxId:e,thread:o,children:t}){const s=et(),n=ho(),r=Fo(),a=o?.threadId,l=o?.messageId,u=Ot(),{accounts:d,searchQuery:h,onToggleIntelligence:g,onSearchClearQuery:m}=Xt(),v=To(),S=jo(h),b=S.length>0,{freeText:C,tokens:p}=Vt(S,v),x=Vt(h.trim(),v).freeText,[E,T]=c.useState("all"),[I,O]=c.useState(new Set),R=c.useMemo(()=>({category:E,attributes:I}),[E,I]),A=c.useMemo(()=>Pn(R),[R]),P=b||Bn(R),{params:G,residual:N}=$n(p,A),q={order:"desc",...C?{query:C}:{},...G,...A},z={...q,limit:xi},F={category:z.category,unread:z.unread,starred:z.starred,attachments:z.attachments},ee=P?At({path:{mailboxId:e},query:z}):dn({path:{mailboxId:e},query:{order:"desc"}}),{data:ue,isLoading:H,isError:B,error:de,refetch:se,fetchNextPage:M,hasNextPage:j,isFetchingNextPage:U}=pn({queryKey:ee,queryFn:async({pageParam:w})=>{if(P){const{data:Y}=await Nt({path:{mailboxId:e},query:{...z,continuationToken:w},throwOnError:!0});return Y}const{data:X}=await hn({path:{mailboxId:e},query:{order:"desc",continuationToken:w},throwOnError:!0});return X},initialPageParam:void 0,getNextPageParam:w=>w.continuationToken,placeholderData:(w,X)=>uo(X?.queryKey,F)?w:void 0}),ke=wr({mailboxId:e,criteria:q,enabled:wo({hasSearchQuery:b,freeText:C,residualTokenCount:N.length})}),{accountId:D,isLoading:oe}=Wn(e),Be=fo({accounts:d}),Q=Kn(Tr(ue?.pages.flatMap(w=>w.items??[])??[]),N,D),Ee=c.useCallback(w=>{T(w)},[]),Se=c.useCallback(w=>{O(X=>{const Y=new Set(X);return Y.has(w)?Y.delete(w):Y.add(w),Y})},[]),ye=c.useCallback(()=>{T("all"),O(new Set)},[]),Ne=c.useCallback(()=>{ye(),m()},[ye,m]),he=xn({chips:R,tokens:p,reach:N.length>0?"loaded-pages":Vn(z),onClear:Ne}),$e=a?Q.find(w=>w.messageId===l)??Q.find(w=>w.threadId===a):void 0,We=qn(a,l),L=$e??We,$=l??L?.messageId,re=c.useMemo(()=>{if(a)return{threadId:a,mailboxId:L?.mailboxId??e,subject:L?.subject,messageId:$,authenticity:L?.authenticity}},[a,L,$,e]),ie=c.useCallback(w=>{$&&w.includes($)&&n()},[$,n]),{deleteMessages:le,isPending:ae}=Wt({mailboxId:e,onAfterOptimisticRemove:ie}),{moveMessages:je,isPending:Ce}=Kt({mailboxId:e,accountId:D,onAfterOptimisticRemove:ie}),Oe=c.useRef(null),Ke=Hn(),{listCommandsRef:fe,onTriageContextChange:tt,focusedMessageId:Ve,selectedIds:we}=Ke,_=Q.find(w=>w.messageId===Ve)??L,st=mo({accounts:d})??null,Me=Un({thread:L,isOpen:!0,mailboxId:e,accountId:D,onAfterOptimisticRemove:ie}),{draftsMailboxId:nt}=Qn(D),k=nt!==void 0&&nt===e,{archiveMailboxId:ot}=Jn(D),qe=Yn(),K=Oo(),rt=c.useMemo(()=>_o(K,a,$),[K,a,$]),me=c.useMemo(()=>{if(_)return w=>K({threadId:_.threadId,messageId:_.messageId,mode:w})},[K,_]),Te=Ao(),ge=zo(),_e=No(),Re=c.useCallback(w=>w?qe(w):[],[qe]),{toggleStar:pe}=Gn({threadId:_?.threadId??"",mailboxId:e}),{toggleReadFor:He}=ns({mailboxId:e,accountId:D}),{junkMailboxId:J}=os(D),ce=J!=null&&J===e,ze=rs(J,e),{candidates:it}=yr(ce?J:void 0),{moveMessages:Ue}=Kt({mailboxId:e,threadId:_?.threadId,accountId:D,onAfterOptimisticRemove:ie}),{deleteMessages:Qe}=Wt({mailboxId:e,threadId:_?.threadId,onAfterOptimisticRemove:ie}),{addressId:Ie,address:W}=Xn(_),{updateFlags:Fe}=Zn({addressId:Ie,senderEmail:_?.fromEmail??void 0}),bt=c.useCallback(()=>me?.("reply"),[me]),lt=c.useCallback(()=>me?.("reply-all"),[me]),De=c.useCallback(()=>me?.("forward"),[me]),xe=c.useCallback(()=>Re(_),[Re,_]),at=c.useCallback(()=>{if(fe.current?.requestVerb("delete"))return;const w=xe();w.length>0&&Qe(w)},[fe,xe,Qe]),ct=c.useCallback(()=>{if(fe.current?.requestVerb("junk")||!ze)return;const w=xe();w.length!==0&&(eo(u,{count:w.length,senderTrust:_?.senderTrust??"unknown",wasRescuable:_?to(_):!1}),Ue(w,ze))},[fe,ze,xe,Ue,u,_]),ut=c.useCallback(()=>{if(we.length>0){const w=!(_?.hasStars??!1),X=new Set(we);for(const Y of Q)X.has(Y.messageId)&&Y.hasStars!==w&&pe(Y.messageId,Y.hasStars);return}_&&pe(_.messageId,_.hasStars)},[we,Q,_,pe]),ve=c.useCallback(()=>{if(fe.current?.requestVerb("markRead"))return;const w=xe();if(w.length===0)return;const X=!(_?.isRead??!1);He(w,X)},[fe,xe,_,He]),dt=c.useCallback(()=>{if(!Ie)return;const w=W?.flags?.muted?.value!==!0;Fe({muted:{value:w}})},[Ie,W,Fe]),Je=c.useCallback(()=>{if(!Ie)return;const w=W?.flags?.vip?.value!==!0;Fe({vip:{value:w}})},[Ie,W,Fe]),St=c.useCallback(()=>{Oe.current?.open()},[]),Le=k?"drafts":ot===e?"archive":J===e?"junk":"inbox",ht=c.useRef("");c.useEffect(()=>{const w=ht.current;ht.current=S,S.length>0&&w.length===0&&u.recordEvent("search.submitted",{mailboxType:Le})},[S,Le,u]);const{goBack:yt,nextMessageId:Ye,previousMessageId:Ct}=so({context:Ke,orderedIds:Q.map(w=>w.messageId),selectedMessageId:$,enabled:!Te&&!ge,hasOpenThread:a!==void 0,onClose:n,handlers:{reply:bt,replyAll:lt,forward:De,delete:at,toggleStar:ut,toggleRead:ve,muteSender:dt,blockSender:L?St:void 0,vipSender:Je,markJunk:ct,toggleIntelligence:L?()=>Oe.current?.toggle():void 0,compose:_e,goBrief:()=>r("brief"),goInbox:()=>r("brief"),goSent:()=>r("brief"),goFlagged:()=>r("flagged"),goSettings:()=>r("settings")}}),ft=w=>{if(!w)return;const X=Q.find(Y=>Y.messageId===w);return X?{threadId:X.threadId,messageId:w}:void 0},wt={mailboxId:e,selectedMessageId:$,selectedThread:L,conversation:re,onOpenThread:s,threads:Q,isLoading:H,isError:B,error:de,mailboxAccountId:D,mailboxAccountLoading:oe,mailboxName:Be,unreadCount:st,isDraftsMailbox:k,isSpamFolder:ce,rescueCandidates:it,filterCategory:E,filterAttributes:I,onSelectFilterCategory:Ee,onToggleFilterAttribute:Se,onClearFilters:ye,listFilter:he,listSearchText:x||void 0,onToggleIntelligence:g,intelligenceRef:Oe,handleDeselectIfRemoved:ie,searchPredicate:b&&N.length===0?z:void 0,resultCount:ke,onDeleteMessages:le,onMoveMessages:je,isDeleting:ae,isMoving:Ce,onLoadMore:M,hasMore:j,isLoadingMore:U,onTriageContextChange:tt,listCommandsRef:fe,onRetry:()=>se(),onReply:rt,onToolbarDelete:Me.deleteThread,onToolbarStar:Me.toggleStar,isStarred:Me.isStarred,onToolbarMove:Me.moveThread,onBack:yt,nextThread:ft(Ye),previousThread:ft(Ct)};return i.jsx(xs.Provider,{value:wt,children:t})}function vs(){const{mailboxId:e,selectedMessageId:o,threads:t,isLoading:s,isError:n,error:r,onDeleteMessages:a,onMoveMessages:l,isDeleting:u,isMoving:d,onLoadMore:h,hasMore:g,isLoadingMore:m,mailboxAccountId:v,mailboxName:S,unreadCount:b,isDraftsMailbox:C,isSpamFolder:p,rescueCandidates:x,onTriageContextChange:E,listCommandsRef:T,onRetry:I,filterCategory:O,filterAttributes:R,onSelectFilterCategory:A,onToggleFilterAttribute:P,onClearFilters:G,listFilter:N,listSearchText:q,searchPredicate:z,resultCount:F}=vt(),{searchQuery:ee,searchInput:ue,accounts:H,resultFolderIndex:B}=Xt(),de=po(),se=et(),M=S??"Inbox",j=c.useMemo(()=>lo(),[]),{trashMailboxId:U}=ao(v),ke=go({accounts:H}),{trashByAccount:D}=Zt(),oe=br({accountId:v,mailboxId:e}),Be=U!=null&&U===e,Q=c.useMemo(()=>v?[v]:[],[v]),{hasNewMail:Ee}=xo(),{state:Se,errorMessage:ye,refresh:Ne}=vo(Q,{onSettled:I}),he=c.useMemo(()=>i.jsx(bo,{state:Se,onRefresh:Ne,label:`Refresh ${M}`,errorMessage:ye,hasUpdate:Ee(Q)}),[Se,Ne,M,ye,Ee,Q]),$e=c.useMemo(()=>t.map(ae=>co(ae,B)),[t,B]),We=c.useCallback(ae=>{const je=ae.threadId??t.find(Ce=>Ce.messageId===ae.id)?.threadId;je&&se({threadId:je,messageId:ae.id},{mailboxId:ae.mailboxId??e,query:ue})},[e,se,ue,t]);if(C&&v)return i.jsx(Ar,{accountId:v,selectedMessageId:o,imapThreads:t,title:S??"Drafts",unreadCount:b??void 0});const L=i.jsx(hi,{mailboxId:e,threads:t,selectedMessageId:o,isLoading:s,isError:n,error:r,onRetry:I,searchQuery:ee,searchPredicate:z,resultCount:F,onDeleteMessages:a,isDeleting:u,isMoving:d,onLoadMore:h,hasMore:g,isLoadingMore:m,accountId:v,listTitle:M,listFilter:N,listSearchText:q,listScopeLabel:M,hideHeader:!0,onTriageContextChange:E,commandsRef:T}),$=H[0]?.accountId,re=de==="phone"&&$?i.jsx(gi,{accountId:$,children:L}):L,ie=p&&x.length>0&&v?i.jsx(pi,{accountId:v,currentMailboxId:e,candidates:x,onMove:l,children:re}):re,le=Be?i.jsx(_r,{messageCount:ke,isEmptying:oe.isEmptying,deletedCount:oe.deletedCount,refusalReason:oe.refusal?.reason,trashFolderLabel:S??void 0,staleFolderLabel:v?D.get(v)?.staleFolderPath:void 0,onEmpty:oe.emptyTrash,onRepair:oe.repair,children:ie}):ie;return i.jsx(vn,{title:M,unreadCount:b,preset:j,selectedCategory:O,activeFilters:R,onSelectCategory:A,onToggleFilter:P,onClearFilters:G,searchResults:$e,searchLoading:s,onSelectSearchResult:We,searchResultsInBody:!0,refreshControl:he,children:le})}function bi(){const e=zt(),{mailboxId:o,mailboxAccountId:t,mailboxAccountLoading:s,selectedThread:n,conversation:r,onReply:a,onToolbarDelete:l,onToolbarStar:u,isStarred:d,onToolbarMove:h,handleDeselectIfRemoved:g,intelligenceRef:m,onOpenThread:v}=vt(),S=!!r,b=ro(r?.threadId);is(m,b);const C=c.useRef(null),{railFits:p,openRail:x}=b;c.useEffect(()=>{if(!p)return;const T=n?.messageId??null;T&&C.current!==T&&n?.authenticity?.dkimMismatch&&(C.current=T,x())},[p,x,n?.messageId,n?.authenticity?.dkimMismatch]);const E=r?i.jsx(ls,{threadId:r.threadId,mailboxId:r.mailboxId,subject:r.subject,selectedMessageId:r.messageId,authenticity:r.authenticity,onOpenIntelligence:b.open,listOnScreen:!0}):i.jsx(Io,{});return i.jsxs(i.Fragment,{children:[i.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[i.jsx(io,{hasThread:S,messageId:r?.messageId,intelligenceOpen:b.isShowing,canToggleIntelligence:b.canToggle,onToggleIntelligence:b.toggle,onReply:a?()=>a("reply"):void 0,onReplyAll:a?()=>a("reply-all"):void 0,onForward:a?()=>a("forward"):void 0,onDelete:S?l:void 0,onToggleStar:S?u:void 0,isStarred:d,moveContext:S&&t?{accountId:t,currentMailboxId:o,onMove:h}:void 0,moveContextLoading:s}),i.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:E})]}),i.jsx(as,{isOpen:b.drawerOpen,onClose:b.closeDrawer,thread:n,accountId:t,onAfterOptimisticRemove:g,onReplyWithText:e,onOpenThread:v})]})}function Si(){const e=zt(),{mailboxAccountId:o,selectedThread:t,onToggleIntelligence:s,handleDeselectIfRemoved:n,onOpenThread:r}=vt();return i.jsx(oo,{onClose:s,thread:t,accountId:o,onAfterOptimisticRemove:n,onReplyWithText:e,onOpenThread:r})}function yi(){const e=zt(),{mailboxAccountId:o,selectedThread:t,conversation:s,onOpenThread:n,onBack:r,nextThread:a,previousThread:l,handleDeselectIfRemoved:u,intelligenceRef:d}=vt(),h=no(s?.threadId??null);return is(d,h),s?i.jsxs(i.Fragment,{children:[i.jsx(ls,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,authenticity:s.authenticity,onBack:r,onOpenIntelligence:h.toggle,onSwipeNext:a?()=>n(a):void 0,onSwipePrevious:l?()=>n(l):void 0,mobileIntelligenceOpen:h.isOpen}),i.jsx(as,{isOpen:h.isOpen,onClose:h.close,thread:t,accountId:o,onAfterOptimisticRemove:u,onReplyWithText:e,onOpenThread:n})]}):i.jsx(vs,{})}const Yi=Object.assign(vi,{List:vs,Reading:bi,Intelligence:Si,Phone:yi});export{Yi as M};
@@ -1,4 +1,4 @@
1
- import{b as Fe,ag as z,r as b,j as l,p as C,I as Ve,J as He,dN as ye,e as Ge,ak as We,f as Ye,al as Xe,cC as qe,bS as Qe,a7 as Ze,v as Je,X as et}from"./index-CjLIM85N.js";import{K as U}from"./kbd-CMsSty4m.js";import{i as tt}from"./search-scope-m65PO2OM.js";import"./nav-link-BJFBTF93.js";import{e as st}from"./reply-jAIguvVh.js";import{p as rt,B as nt,b as ot}from"./useMessageBodyContent-MKSJN2kk.js";const q=[{category:"personal",label:"Personal",tone:"accent",section:1},{category:"uncategorized",label:"Unclassified",tone:"neutral",section:7},{category:"transactional",label:"Transactional",tone:"positive",section:2},{category:"newsletter",label:"Newsletter",tone:"neutral",section:3},{category:"marketing",label:"Marketing",tone:"neutral",section:4},{category:"social",label:"Social",tone:"warning",section:5},{category:"automated",label:"Automated",tone:"neutral",section:6}],wr=[...q].sort((t,e)=>t.section-e.section).map(t=>t.category),ve=t=>Object.fromEntries(q.map(e=>[e.category,t(e)])),Q=ve(t=>t.label),it=ve(t=>t.tone),_r=t=>!t||t==="personal"?null:Q[t];function at(t){return Object.hasOwn(it,t)}function xr(t){return t==="all"||at(t)}const Er=[{id:"all",label:"All",tone:"neutral"},...q.map(t=>({id:t.category,label:t.label,tone:t.tone}))];const Sr=Fe("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);function ct(t,e,s){return Math.max(e,Math.min(t,s))}const v={toVector(t,e){return t===void 0&&(t=e),Array.isArray(t)?t:[t,t]},add(t,e){return[t[0]+e[0],t[1]+e[1]]},sub(t,e){return[t[0]-e[0],t[1]-e[1]]},addTo(t,e){t[0]+=e[0],t[1]+=e[1]},subTo(t,e){t[0]-=e[0],t[1]-=e[1]}};function Z(t,e,s){return e===0||Math.abs(e)===1/0?Math.pow(t,s*5):t*e*s/(e+s*t)}function J(t,e,s,r=.15){return r===0?ct(t,e,s):t<e?-Z(e-t,s-e,r)+e:t>s?+Z(t-s,s-e,r)+s:t}function lt(t,[e,s],[r,n]){const[[o,i],[c,u]]=t;return[J(e,o,i,r),J(s,c,u,n)]}function ut(t,e){if(typeof t!="object"||t===null)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function dt(t){var e=ut(t,"string");return typeof e=="symbol"?e:String(e)}function x(t,e,s){return e=dt(e),e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function ee(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function m(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?ee(Object(s),!0).forEach(function(r){x(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):ee(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}const we={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function te(t){return t?t[0].toUpperCase()+t.slice(1):""}const ft=["enter","leave"];function ht(t=!1,e){return t&&!ft.includes(e)}function pt(t,e="",s=!1){const r=we[t],n=r&&r[e]||e;return"on"+te(t)+te(n)+(ht(s,n)?"Capture":"")}const mt=["gotpointercapture","lostpointercapture"];function gt(t){let e=t.substring(2).toLowerCase();const s=!!~e.indexOf("passive");s&&(e=e.replace("passive",""));const r=mt.includes(e)?"capturecapture":"capture",n=!!~e.indexOf(r);return n&&(e=e.replace("capture","")),{device:e,capture:n,passive:s}}function bt(t,e=""){const s=we[t],r=s&&s[e]||e;return t+r}function K(t){return"touches"in t}function _e(t){return K(t)?"touch":"pointerType"in t?t.pointerType:"mouse"}function yt(t){return Array.from(t.touches).filter(e=>{var s,r;return e.target===t.currentTarget||((s=t.currentTarget)===null||s===void 0||(r=s.contains)===null||r===void 0?void 0:r.call(s,e.target))})}function vt(t){return t.type==="touchend"||t.type==="touchcancel"?t.changedTouches:t.targetTouches}function xe(t){return K(t)?vt(t)[0]:t}function wt(t){return yt(t).map(e=>e.identifier)}function F(t){const e=xe(t);return K(t)?e.identifier:e.pointerId}function se(t){const e=xe(t);return[e.clientX,e.clientY]}function _t(t){const e={};if("buttons"in t&&(e.buttons=t.buttons),"shiftKey"in t){const{shiftKey:s,altKey:r,metaKey:n,ctrlKey:o}=t;Object.assign(e,{shiftKey:s,altKey:r,metaKey:n,ctrlKey:o})}return e}function B(t,...e){return typeof t=="function"?t(...e):t}function xt(){}function Et(...t){return t.length===0?xt:t.length===1?t[0]:function(){let e;for(const s of t)e=s.apply(this,arguments)||e;return e}}function re(t,e){return Object.assign({},e,t||{})}const St=32;class kt{constructor(e,s,r){this.ctrl=e,this.args=s,this.key=r,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:s,ingKey:r,args:n}=this;s[r]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=n,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const s=this.state,r=this.config;s._active||(this.reset(),this.computeInitial(),s._active=!0,s.target=e.target,s.currentTarget=e.currentTarget,s.lastOffset=r.from?B(r.from,s):s.offset,s.offset=s.lastOffset,s.startTime=s.timeStamp=e.timeStamp)}computeValues(e){const s=this.state;s._values=e,s.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:s,config:r,shared:n}=this;s.args=this.args;let o=0;if(e&&(s.event=e,r.preventDefault&&e.cancelable&&s.event.preventDefault(),s.type=e.type,n.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,n.locked=!!document.pointerLockElement,Object.assign(n,_t(e)),n.down=n.pressed=n.buttons%2===1||n.touches>0,o=e.timeStamp-s.timeStamp,s.timeStamp=e.timeStamp,s.elapsedTime=s.timeStamp-s.startTime),s._active){const g=s._delta.map(Math.abs);v.addTo(s._distance,g)}this.axisIntent&&this.axisIntent(e);const[i,c]=s._movement,[u,d]=r.threshold,{_step:a,values:f}=s;if(r.hasCustomTransform?(a[0]===!1&&(a[0]=Math.abs(i)>=u&&f[0]),a[1]===!1&&(a[1]=Math.abs(c)>=d&&f[1])):(a[0]===!1&&(a[0]=Math.abs(i)>=u&&Math.sign(i)*u),a[1]===!1&&(a[1]=Math.abs(c)>=d&&Math.sign(c)*d)),s.intentional=a[0]!==!1||a[1]!==!1,!s.intentional)return;const h=[0,0];if(r.hasCustomTransform){const[g,O]=f;h[0]=a[0]!==!1?g-a[0]:0,h[1]=a[1]!==!1?O-a[1]:0}else h[0]=a[0]!==!1?i-a[0]:0,h[1]=a[1]!==!1?c-a[1]:0;this.restrictToAxis&&!s._blocked&&this.restrictToAxis(h);const E=s.offset,y=s._active&&!s._blocked||s.active;y&&(s.first=s._active&&!s.active,s.last=!s._active&&s.active,s.active=n[this.ingKey]=s._active,e&&(s.first&&("bounds"in r&&(s._bounds=B(r.bounds,s)),this.setup&&this.setup()),s.movement=h,this.computeOffset()));const[S,_]=s.offset,[[w,A],[T,D]]=s._bounds;s.overflow=[S<w?-1:S>A?1:0,_<T?-1:_>D?1:0],s._movementBound[0]=s.overflow[0]?s._movementBound[0]===!1?s._movement[0]:s._movementBound[0]:!1,s._movementBound[1]=s.overflow[1]?s._movementBound[1]===!1?s._movement[1]:s._movementBound[1]:!1;const p=s._active?r.rubberband||[0,0]:[0,0];if(s.offset=lt(s._bounds,s.offset,p),s.delta=v.sub(s.offset,E),this.computeMovement(),y&&(!s.last||o>St)){s.delta=v.sub(s.offset,E);const g=s.delta.map(Math.abs);v.addTo(s.distance,g),s.direction=s.delta.map(Math.sign),s._direction=s._delta.map(Math.sign),!s.first&&o>0&&(s.velocity=[g[0]/o,g[1]/o],s.timeDelta=o)}}emit(){const e=this.state,s=this.shared,r=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!r.triggerAllEvents)return;const n=this.handler(m(m(m({},s),e),{},{[this.aliasKey]:e.values}));n!==void 0&&(e.memo=n)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function At([t,e],s){const r=Math.abs(t),n=Math.abs(e);if(r>n&&r>s)return"x";if(n>r&&n>s)return"y"}class Tt extends kt{constructor(...e){super(...e),x(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=v.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=v.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const s=this.state,r=this.config;if(!s.axis&&e){const n=typeof r.axisThreshold=="object"?r.axisThreshold[_e(e)]:r.axisThreshold;s.axis=At(s._movement,n)}s._blocked=(r.lockDirection||!!r.axis)&&!s.axis||!!r.axis&&r.axis!==s.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const Ct=t=>t,ne=.15,Ee={enabled(t=!0){return t},eventOptions(t,e,s){return m(m({},s.shared.eventOptions),t)},preventDefault(t=!1){return t},triggerAllEvents(t=!1){return t},rubberband(t=0){switch(t){case!0:return[ne,ne];case!1:return[0,0];default:return v.toVector(t)}},from(t){if(typeof t=="function")return t;if(t!=null)return v.toVector(t)},transform(t,e,s){const r=t||s.shared.transform;return this.hasCustomTransform=!!r,r||Ct},threshold(t){return v.toVector(t,0)}},Ot=0,j=m(m({},Ee),{},{axis(t,e,{axis:s}){if(this.lockDirection=s==="lock",!this.lockDirection)return s},axisThreshold(t=Ot){return t},bounds(t={}){if(typeof t=="function")return o=>j.bounds(t(o));if("current"in t)return()=>t.current;if(typeof HTMLElement=="function"&&t instanceof HTMLElement)return t;const{left:e=-1/0,right:s=1/0,top:r=-1/0,bottom:n=1/0}=t;return[[e,s],[r,n]]}}),oe={ArrowRight:(t,e=1)=>[t*e,0],ArrowLeft:(t,e=1)=>[-1*t*e,0],ArrowUp:(t,e=1)=>[0,-1*t*e],ArrowDown:(t,e=1)=>[0,t*e]};class Dt extends Tt{constructor(...e){super(...e),x(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const s=e._bounds.getBoundingClientRect(),r=e.currentTarget.getBoundingClientRect(),n={left:s.left-r.left+e.offset[0],right:s.right-r.right+e.offset[0],top:s.top-r.top+e.offset[1],bottom:s.bottom-r.bottom+e.offset[1]};e._bounds=j.bounds(n)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const s=this.config,r=this.state;if(e.buttons!=null&&(Array.isArray(s.pointerButtons)?!s.pointerButtons.includes(e.buttons):s.pointerButtons!==-1&&s.pointerButtons!==e.buttons))return;const n=this.ctrl.setEventIds(e);s.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(n&&n.size>1&&r._pointerActive)&&(this.start(e),this.setupPointer(e),r._pointerId=F(e),r._pointerActive=!0,this.computeValues(se(e)),this.computeInitial(),s.preventScrollAxis&&_e(e)!=="mouse"?(r._active=!1,this.setupScrollPrevention(e)):s.delay>0?(this.setupDelayTrigger(e),s.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const s=this.state;s._active=!0,s._preventScroll=!0,s._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const s=this.state,r=this.config;if(!s._pointerActive)return;const n=F(e);if(s._pointerId!==void 0&&n!==s._pointerId)return;const o=se(e);if(document.pointerLockElement===e.target?s._delta=[e.movementX,e.movementY]:(s._delta=v.sub(o,s._values),this.computeValues(o)),v.addTo(s._movement,s._delta),this.compute(e),s._delayed&&s.intentional){this.timeoutStore.remove("dragDelay"),s.active=!1,this.startPointerDrag(e);return}if(r.preventScrollAxis&&!s._preventScroll)if(s.axis)if(s.axis===r.preventScrollAxis||r.preventScrollAxis==="xy"){s._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const s=this.state,r=this.config;if(!s._active||!s._pointerActive)return;const n=F(e);if(s._pointerId!==void 0&&n!==s._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[o,i]=s._distance;if(s.tap=o<=r.tapsThreshold&&i<=r.tapsThreshold,s.tap&&r.filterTaps)s._force=!0;else{const[c,u]=s._delta,[d,a]=s._movement,[f,h]=r.swipe.velocity,[E,y]=r.swipe.distance,S=r.swipe.duration;if(s.elapsedTime<S){const _=Math.abs(c/s.timeDelta),w=Math.abs(u/s.timeDelta);_>f&&Math.abs(d)>E&&(s.swipe[0]=Math.sign(c)),w>h&&Math.abs(a)>y&&(s.swipe[1]=Math.sign(u))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const s=this.config,r=s.device;s.pointerLock&&e.currentTarget.requestPointerLock(),s.pointerCapture||(this.eventStore.add(this.sharedConfig.window,r,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,It(e);const s=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",s),this.eventStore.add(this.sharedConfig.window,"touch","cancel",s),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const s=oe[e.key];if(s){const r=this.state,n=e.shiftKey?10:e.altKey?.1:1;this.start(e),r._delta=s(this.config.keyboardDisplacement,n),r._keyboardActive=!0,v.addTo(r._movement,r._delta),this.compute(e),this.emit()}}keyUp(e){e.key in oe&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const s=this.config.device;e(s,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(s,"change",this.pointerMove.bind(this)),e(s,"end",this.pointerUp.bind(this)),e(s,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function It(t){"persist"in t&&typeof t.persist=="function"&&t.persist()}const P=typeof window<"u"&&window.document&&window.document.createElement;function Se(){return P&&"ontouchstart"in window}function jt(){return Se()||P&&window.navigator.maxTouchPoints>1}function Pt(){return P&&"onpointerdown"in window}function Lt(){return P&&"exitPointerLock"in window.document}function Nt(){try{return"constructor"in GestureEvent}catch{return!1}}const k={isBrowser:P,gesture:Nt(),touch:Se(),touchscreen:jt(),pointer:Pt(),pointerLock:Lt()},Mt=250,Rt=180,Bt=.5,$t=50,Kt=250,zt=10,ie={mouse:0,touch:0,pen:8},Ut=m(m({},j),{},{device(t,e,{pointer:{touch:s=!1,lock:r=!1,mouse:n=!1}={}}){return this.pointerLock=r&&k.pointerLock,k.touch&&s?"touch":this.pointerLock?"mouse":k.pointer&&!n?"pointer":k.touch?"touch":"mouse"},preventScrollAxis(t,e,{preventScroll:s}){if(this.preventScrollDelay=typeof s=="number"?s:s||s===void 0&&t?Mt:void 0,!(!k.touchscreen||s===!1))return t||(s!==void 0?"y":void 0)},pointerCapture(t,e,{pointer:{capture:s=!0,buttons:r=1,keys:n=!0}={}}){return this.pointerButtons=r,this.keys=n,!this.pointerLock&&this.device==="pointer"&&s},threshold(t,e,{filterTaps:s=!1,tapsThreshold:r=3,axis:n=void 0}){const o=v.toVector(t,s?r:n?1:0);return this.filterTaps=s,this.tapsThreshold=r,o},swipe({velocity:t=Bt,distance:e=$t,duration:s=Kt}={}){return{velocity:this.transform(v.toVector(t)),distance:this.transform(v.toVector(e)),duration:s}},delay(t=0){switch(t){case!0:return Rt;case!1:return 0;default:return t}},axisThreshold(t){return t?m(m({},ie),t):ie},keyboardDisplacement(t=zt){return t}});m(m({},Ee),{},{device(t,e,{shared:s,pointer:{touch:r=!1}={}}){if(s.target&&!k.touch&&k.gesture)return"gesture";if(k.touch&&r)return"touch";if(k.touchscreen){if(k.pointer)return"pointer";if(k.touch)return"touch"}},bounds(t,e,{scaleBounds:s={},angleBounds:r={}}){const n=i=>{const c=re(B(s,i),{min:-1/0,max:1/0});return[c.min,c.max]},o=i=>{const c=re(B(r,i),{min:-1/0,max:1/0});return[c.min,c.max]};return typeof s!="function"&&typeof r!="function"?[n(),o()]:i=>[n(i),o(i)]},threshold(t,e,s){return this.lockDirection=s.axis==="lock",v.toVector(t,this.lockDirection?[.1,3]:0)},modifierKey(t){return t===void 0?"ctrlKey":t},pinchOnWheel(t=!0){return t}});m(m({},j),{},{mouseOnly:(t=!0)=>t});m(m({},j),{},{mouseOnly:(t=!0)=>t});const ke=new Map,G=new Map;function Ae(t){ke.set(t.key,t.engine),G.set(t.key,t.resolver)}const Te={key:"drag",engine:Dt,resolver:Ut};function Ft(t,e){if(t==null)return{};var s={},r=Object.keys(t),n,o;for(o=0;o<r.length;o++)n=r[o],!(e.indexOf(n)>=0)&&(s[n]=t[n]);return s}function Vt(t,e){if(t==null)return{};var s=Ft(t,e),r,n;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(s[r]=t[r])}return s}const Ht={target(t){if(t)return()=>"current"in t?t.current:t},enabled(t=!0){return t},window(t=k.isBrowser?window:void 0){return t},eventOptions({passive:t=!0,capture:e=!1}={}){return{passive:t,capture:e}},transform(t){return t}},Gt=["target","eventOptions","window","enabled","transform"];function R(t={},e){const s={};for(const[r,n]of Object.entries(e))switch(typeof n){case"function":s[r]=n.call(s,t[r],r,t);break;case"object":s[r]=R(t[r],n);break;case"boolean":n&&(s[r]=t[r]);break}return s}function Wt(t,e,s={}){const r=t,{target:n,eventOptions:o,window:i,enabled:c,transform:u}=r,d=Vt(r,Gt);if(s.shared=R({target:n,eventOptions:o,window:i,enabled:c,transform:u},Ht),e){const a=G.get(e);s[e]=R(m({shared:s.shared},d),a)}else for(const a in d){const f=G.get(a);f&&(s[a]=R(m({shared:s.shared},d[a]),f))}return s}class Ce{constructor(e,s){x(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=s}add(e,s,r,n,o){const i=this._listeners,c=bt(s,r),u=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},d=m(m({},u),o);e.addEventListener(c,n,d);const a=()=>{e.removeEventListener(c,n,d),i.delete(a)};return i.add(a),a}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class Yt{constructor(){x(this,"_timeouts",new Map)}add(e,s,r=140,...n){this.remove(e),this._timeouts.set(e,window.setTimeout(s,r,...n))}remove(e){const s=this._timeouts.get(e);s&&window.clearTimeout(s)}clean(){this._timeouts.forEach(e=>{window.clearTimeout(e)}),this._timeouts.clear()}}class Oe{constructor(e){x(this,"gestures",new Set),x(this,"_targetEventStore",new Ce(this)),x(this,"gestureEventStores",{}),x(this,"gestureTimeoutStores",{}),x(this,"handlers",{}),x(this,"config",{}),x(this,"pointerIds",new Set),x(this,"touchIds",new Set),x(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),Xt(this,e)}setEventIds(e){if(K(e))return this.touchIds=new Set(wt(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,s){this.handlers=e,this.nativeHandlers=s}applyConfig(e,s){this.config=Wt(e,s,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const s=this.config.shared,r={};let n;if(!(s.target&&(n=s.target(),!n))){if(s.enabled){for(const i of this.gestures){const c=this.config[i],u=ae(r,c.eventOptions,!!n);if(c.enabled){const d=ke.get(i);new d(this,e,i).bind(u)}}const o=ae(r,s.eventOptions,!!n);for(const i in this.nativeHandlers)o(i,"",c=>this.nativeHandlers[i](m(m({},this.state.shared),{},{event:c,args:e})),void 0,!0)}for(const o in r)r[o]=Et(...r[o]);if(!n)return r;for(const o in r){const{device:i,capture:c,passive:u}=gt(o);this._targetEventStore.add(n,i,"",r[o],{capture:c,passive:u})}}}}function I(t,e){t.gestures.add(e),t.gestureEventStores[e]=new Ce(t,e),t.gestureTimeoutStores[e]=new Yt}function Xt(t,e){e.drag&&I(t,"drag"),e.wheel&&I(t,"wheel"),e.scroll&&I(t,"scroll"),e.move&&I(t,"move"),e.pinch&&I(t,"pinch"),e.hover&&I(t,"hover")}const ae=(t,e,s)=>(r,n,o,i={},c=!1)=>{var u,d;const a=(u=i.capture)!==null&&u!==void 0?u:e.capture,f=(d=i.passive)!==null&&d!==void 0?d:e.passive;let h=c?r:pt(r,n,a);s&&f&&(h+="Passive"),t[h]=t[h]||[],t[h].push(o)};function qt(t,e){if(typeof t!="object"||t===null)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Qt(t){var e=qt(t,"string");return typeof e=="symbol"?e:String(e)}function Zt(t,e,s){return e=Qt(e),e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function ce(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function M(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?ce(Object(s),!0).forEach(function(r){Zt(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):ce(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}class Jt{constructor(e,s,r,n,o){this._target=e,this._gestureKey=n,this._ctrl=new Oe(s),this._ctrl.applyHandlers(s,o),this._ctrl.applyConfig(M(M({},r),{},{target:e}),n),this._ctrl.effect()}destroy(){this._ctrl.clean()}setConfig(e){this._ctrl.clean(),this._ctrl.applyConfig(M(M({},e),{},{target:this._target}),this._gestureKey),this._ctrl.effect()}}const es=function(e,s,r){return Ae(Te),new Jt(e,{drag:s},r||{},"drag")},V=10,De={axisThreshold:{mouse:V,touch:V,pen:V},swipe:{distance:60,velocity:.3,duration:600},pointer:{keys:!1,capture:!1}};function ts(t,e={},s,r){const n=z.useMemo(()=>new Oe(t),[]);if(n.applyHandlers(t,r),n.applyConfig(e,s),z.useEffect(n.effect.bind(n)),z.useEffect(()=>n.clean.bind(n),[]),e.target===void 0)return n.bind.bind(n)}function ss(t,e){return Ae(Te),ts({drag:t},e||{},"drag")}const W="remit:swipe",rs=b.createContext(!1),ns=1.01,Ie=t=>{const{event:e}=t;if("pointerType"in e&&e.pointerType!=="touch"||e.type!=="pointerup")return null;const s=t.swipe[0];return s<0?"left":s>0?"right":null},je=t=>{const e=window.visualViewport;return e?.addEventListener("resize",t),()=>e?.removeEventListener("resize",t)},Pe=()=>(window.visualViewport?.scale??1)>ns,kr=({onSwipeLeft:t,onSwipeRight:e})=>{const s=b.useRef(null),r=t!==void 0||e!==void 0,n=b.useSyncExternalStore(je,Pe,()=>!1),o=c=>{c==="left"&&t?.(),c==="right"&&e?.()},i=ss(c=>o(Ie(c)),{...De,axis:"x",enabled:r&&!n});return b.useEffect(()=>{const c=s.current;if(!c||!r||n)return;const u=d=>{if(!(d instanceof CustomEvent))return;const{detail:a}=d;(a==="left"||a==="right")&&o(a)};return c.addEventListener(W,u),()=>c.removeEventListener(W,u)}),{ref:s,bind:i,touchAction:r&&!n?"pan-y pinch-zoom":"auto",enabled:r}},os='"Geist Variable", "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',$={light:{fg:"oklch(0.3 0.025 235)",canvas:"oklch(0.96 0.015 90)",accent:"oklch(0.55 0.14 150)"},dark:{fg:"oklch(0.88 0.02 90)",canvas:"oklch(0.22 0.025 220)",accent:"oklch(0.78 0.16 150)"}},is={background:!1,spacing:!1},as="16px",cs=()=>`html{padding:0}body{padding:${as};box-sizing:border-box}`,ls=()=>"html{overflow:hidden}body{overflow-x:auto}",us=/prefers-color-scheme\s*:\s*dark|color-scheme\s*:\s*[^;}"']*\bdark\b/i,ds='<meta name="viewport" content="width=device-width, initial-scale=1">',fs=t=>{const e=t?$.dark:$.light;return`
1
+ import{b as Fe,ag as z,r as b,j as l,p as C,I as Ve,J as He,dM as ye,e as Ge,ak as We,f as Ye,al as Xe,cC as qe,bT as Qe,a7 as Ze,v as Je,X as et}from"./index-BZ4sAts4.js";import{K as U}from"./kbd-5V1_yqOW.js";import{i as tt}from"./search-scope-BR87UqJt.js";import"./nav-link-BvBkmH1H.js";import{e as st}from"./reply-D8bLYzum.js";import{p as rt,B as nt,b as ot}from"./useMessageBodyContent-dd-lowbx.js";const q=[{category:"personal",label:"Personal",tone:"accent",section:1},{category:"uncategorized",label:"Unclassified",tone:"neutral",section:7},{category:"transactional",label:"Transactional",tone:"positive",section:2},{category:"newsletter",label:"Newsletter",tone:"neutral",section:3},{category:"marketing",label:"Marketing",tone:"neutral",section:4},{category:"social",label:"Social",tone:"warning",section:5},{category:"automated",label:"Automated",tone:"neutral",section:6}],wr=[...q].sort((t,e)=>t.section-e.section).map(t=>t.category),ve=t=>Object.fromEntries(q.map(e=>[e.category,t(e)])),Q=ve(t=>t.label),it=ve(t=>t.tone),_r=t=>!t||t==="personal"?null:Q[t];function at(t){return Object.hasOwn(it,t)}function xr(t){return t==="all"||at(t)}const Er=[{id:"all",label:"All",tone:"neutral"},...q.map(t=>({id:t.category,label:t.label,tone:t.tone}))];const kr=Fe("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);function ct(t,e,s){return Math.max(e,Math.min(t,s))}const v={toVector(t,e){return t===void 0&&(t=e),Array.isArray(t)?t:[t,t]},add(t,e){return[t[0]+e[0],t[1]+e[1]]},sub(t,e){return[t[0]-e[0],t[1]-e[1]]},addTo(t,e){t[0]+=e[0],t[1]+=e[1]},subTo(t,e){t[0]-=e[0],t[1]-=e[1]}};function Z(t,e,s){return e===0||Math.abs(e)===1/0?Math.pow(t,s*5):t*e*s/(e+s*t)}function J(t,e,s,r=.15){return r===0?ct(t,e,s):t<e?-Z(e-t,s-e,r)+e:t>s?+Z(t-s,s-e,r)+s:t}function lt(t,[e,s],[r,n]){const[[o,i],[c,u]]=t;return[J(e,o,i,r),J(s,c,u,n)]}function ut(t,e){if(typeof t!="object"||t===null)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function dt(t){var e=ut(t,"string");return typeof e=="symbol"?e:String(e)}function x(t,e,s){return e=dt(e),e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function ee(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function m(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?ee(Object(s),!0).forEach(function(r){x(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):ee(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}const we={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function te(t){return t?t[0].toUpperCase()+t.slice(1):""}const ft=["enter","leave"];function ht(t=!1,e){return t&&!ft.includes(e)}function pt(t,e="",s=!1){const r=we[t],n=r&&r[e]||e;return"on"+te(t)+te(n)+(ht(s,n)?"Capture":"")}const mt=["gotpointercapture","lostpointercapture"];function gt(t){let e=t.substring(2).toLowerCase();const s=!!~e.indexOf("passive");s&&(e=e.replace("passive",""));const r=mt.includes(e)?"capturecapture":"capture",n=!!~e.indexOf(r);return n&&(e=e.replace("capture","")),{device:e,capture:n,passive:s}}function bt(t,e=""){const s=we[t],r=s&&s[e]||e;return t+r}function K(t){return"touches"in t}function _e(t){return K(t)?"touch":"pointerType"in t?t.pointerType:"mouse"}function yt(t){return Array.from(t.touches).filter(e=>{var s,r;return e.target===t.currentTarget||((s=t.currentTarget)===null||s===void 0||(r=s.contains)===null||r===void 0?void 0:r.call(s,e.target))})}function vt(t){return t.type==="touchend"||t.type==="touchcancel"?t.changedTouches:t.targetTouches}function xe(t){return K(t)?vt(t)[0]:t}function wt(t){return yt(t).map(e=>e.identifier)}function F(t){const e=xe(t);return K(t)?e.identifier:e.pointerId}function se(t){const e=xe(t);return[e.clientX,e.clientY]}function _t(t){const e={};if("buttons"in t&&(e.buttons=t.buttons),"shiftKey"in t){const{shiftKey:s,altKey:r,metaKey:n,ctrlKey:o}=t;Object.assign(e,{shiftKey:s,altKey:r,metaKey:n,ctrlKey:o})}return e}function B(t,...e){return typeof t=="function"?t(...e):t}function xt(){}function Et(...t){return t.length===0?xt:t.length===1?t[0]:function(){let e;for(const s of t)e=s.apply(this,arguments)||e;return e}}function re(t,e){return Object.assign({},e,t||{})}const kt=32;class St{constructor(e,s,r){this.ctrl=e,this.args=s,this.key=r,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:s,ingKey:r,args:n}=this;s[r]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=n,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const s=this.state,r=this.config;s._active||(this.reset(),this.computeInitial(),s._active=!0,s.target=e.target,s.currentTarget=e.currentTarget,s.lastOffset=r.from?B(r.from,s):s.offset,s.offset=s.lastOffset,s.startTime=s.timeStamp=e.timeStamp)}computeValues(e){const s=this.state;s._values=e,s.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:s,config:r,shared:n}=this;s.args=this.args;let o=0;if(e&&(s.event=e,r.preventDefault&&e.cancelable&&s.event.preventDefault(),s.type=e.type,n.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,n.locked=!!document.pointerLockElement,Object.assign(n,_t(e)),n.down=n.pressed=n.buttons%2===1||n.touches>0,o=e.timeStamp-s.timeStamp,s.timeStamp=e.timeStamp,s.elapsedTime=s.timeStamp-s.startTime),s._active){const g=s._delta.map(Math.abs);v.addTo(s._distance,g)}this.axisIntent&&this.axisIntent(e);const[i,c]=s._movement,[u,d]=r.threshold,{_step:a,values:f}=s;if(r.hasCustomTransform?(a[0]===!1&&(a[0]=Math.abs(i)>=u&&f[0]),a[1]===!1&&(a[1]=Math.abs(c)>=d&&f[1])):(a[0]===!1&&(a[0]=Math.abs(i)>=u&&Math.sign(i)*u),a[1]===!1&&(a[1]=Math.abs(c)>=d&&Math.sign(c)*d)),s.intentional=a[0]!==!1||a[1]!==!1,!s.intentional)return;const h=[0,0];if(r.hasCustomTransform){const[g,O]=f;h[0]=a[0]!==!1?g-a[0]:0,h[1]=a[1]!==!1?O-a[1]:0}else h[0]=a[0]!==!1?i-a[0]:0,h[1]=a[1]!==!1?c-a[1]:0;this.restrictToAxis&&!s._blocked&&this.restrictToAxis(h);const E=s.offset,y=s._active&&!s._blocked||s.active;y&&(s.first=s._active&&!s.active,s.last=!s._active&&s.active,s.active=n[this.ingKey]=s._active,e&&(s.first&&("bounds"in r&&(s._bounds=B(r.bounds,s)),this.setup&&this.setup()),s.movement=h,this.computeOffset()));const[k,_]=s.offset,[[w,A],[T,D]]=s._bounds;s.overflow=[k<w?-1:k>A?1:0,_<T?-1:_>D?1:0],s._movementBound[0]=s.overflow[0]?s._movementBound[0]===!1?s._movement[0]:s._movementBound[0]:!1,s._movementBound[1]=s.overflow[1]?s._movementBound[1]===!1?s._movement[1]:s._movementBound[1]:!1;const p=s._active?r.rubberband||[0,0]:[0,0];if(s.offset=lt(s._bounds,s.offset,p),s.delta=v.sub(s.offset,E),this.computeMovement(),y&&(!s.last||o>kt)){s.delta=v.sub(s.offset,E);const g=s.delta.map(Math.abs);v.addTo(s.distance,g),s.direction=s.delta.map(Math.sign),s._direction=s._delta.map(Math.sign),!s.first&&o>0&&(s.velocity=[g[0]/o,g[1]/o],s.timeDelta=o)}}emit(){const e=this.state,s=this.shared,r=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!r.triggerAllEvents)return;const n=this.handler(m(m(m({},s),e),{},{[this.aliasKey]:e.values}));n!==void 0&&(e.memo=n)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function At([t,e],s){const r=Math.abs(t),n=Math.abs(e);if(r>n&&r>s)return"x";if(n>r&&n>s)return"y"}class Tt extends St{constructor(...e){super(...e),x(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=v.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=v.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const s=this.state,r=this.config;if(!s.axis&&e){const n=typeof r.axisThreshold=="object"?r.axisThreshold[_e(e)]:r.axisThreshold;s.axis=At(s._movement,n)}s._blocked=(r.lockDirection||!!r.axis)&&!s.axis||!!r.axis&&r.axis!==s.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const Ct=t=>t,ne=.15,Ee={enabled(t=!0){return t},eventOptions(t,e,s){return m(m({},s.shared.eventOptions),t)},preventDefault(t=!1){return t},triggerAllEvents(t=!1){return t},rubberband(t=0){switch(t){case!0:return[ne,ne];case!1:return[0,0];default:return v.toVector(t)}},from(t){if(typeof t=="function")return t;if(t!=null)return v.toVector(t)},transform(t,e,s){const r=t||s.shared.transform;return this.hasCustomTransform=!!r,r||Ct},threshold(t){return v.toVector(t,0)}},Ot=0,j=m(m({},Ee),{},{axis(t,e,{axis:s}){if(this.lockDirection=s==="lock",!this.lockDirection)return s},axisThreshold(t=Ot){return t},bounds(t={}){if(typeof t=="function")return o=>j.bounds(t(o));if("current"in t)return()=>t.current;if(typeof HTMLElement=="function"&&t instanceof HTMLElement)return t;const{left:e=-1/0,right:s=1/0,top:r=-1/0,bottom:n=1/0}=t;return[[e,s],[r,n]]}}),oe={ArrowRight:(t,e=1)=>[t*e,0],ArrowLeft:(t,e=1)=>[-1*t*e,0],ArrowUp:(t,e=1)=>[0,-1*t*e],ArrowDown:(t,e=1)=>[0,t*e]};class Dt extends Tt{constructor(...e){super(...e),x(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const s=e._bounds.getBoundingClientRect(),r=e.currentTarget.getBoundingClientRect(),n={left:s.left-r.left+e.offset[0],right:s.right-r.right+e.offset[0],top:s.top-r.top+e.offset[1],bottom:s.bottom-r.bottom+e.offset[1]};e._bounds=j.bounds(n)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const s=this.config,r=this.state;if(e.buttons!=null&&(Array.isArray(s.pointerButtons)?!s.pointerButtons.includes(e.buttons):s.pointerButtons!==-1&&s.pointerButtons!==e.buttons))return;const n=this.ctrl.setEventIds(e);s.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(n&&n.size>1&&r._pointerActive)&&(this.start(e),this.setupPointer(e),r._pointerId=F(e),r._pointerActive=!0,this.computeValues(se(e)),this.computeInitial(),s.preventScrollAxis&&_e(e)!=="mouse"?(r._active=!1,this.setupScrollPrevention(e)):s.delay>0?(this.setupDelayTrigger(e),s.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const s=this.state;s._active=!0,s._preventScroll=!0,s._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const s=this.state,r=this.config;if(!s._pointerActive)return;const n=F(e);if(s._pointerId!==void 0&&n!==s._pointerId)return;const o=se(e);if(document.pointerLockElement===e.target?s._delta=[e.movementX,e.movementY]:(s._delta=v.sub(o,s._values),this.computeValues(o)),v.addTo(s._movement,s._delta),this.compute(e),s._delayed&&s.intentional){this.timeoutStore.remove("dragDelay"),s.active=!1,this.startPointerDrag(e);return}if(r.preventScrollAxis&&!s._preventScroll)if(s.axis)if(s.axis===r.preventScrollAxis||r.preventScrollAxis==="xy"){s._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const s=this.state,r=this.config;if(!s._active||!s._pointerActive)return;const n=F(e);if(s._pointerId!==void 0&&n!==s._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[o,i]=s._distance;if(s.tap=o<=r.tapsThreshold&&i<=r.tapsThreshold,s.tap&&r.filterTaps)s._force=!0;else{const[c,u]=s._delta,[d,a]=s._movement,[f,h]=r.swipe.velocity,[E,y]=r.swipe.distance,k=r.swipe.duration;if(s.elapsedTime<k){const _=Math.abs(c/s.timeDelta),w=Math.abs(u/s.timeDelta);_>f&&Math.abs(d)>E&&(s.swipe[0]=Math.sign(c)),w>h&&Math.abs(a)>y&&(s.swipe[1]=Math.sign(u))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const s=this.config,r=s.device;s.pointerLock&&e.currentTarget.requestPointerLock(),s.pointerCapture||(this.eventStore.add(this.sharedConfig.window,r,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,It(e);const s=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",s),this.eventStore.add(this.sharedConfig.window,"touch","cancel",s),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const s=oe[e.key];if(s){const r=this.state,n=e.shiftKey?10:e.altKey?.1:1;this.start(e),r._delta=s(this.config.keyboardDisplacement,n),r._keyboardActive=!0,v.addTo(r._movement,r._delta),this.compute(e),this.emit()}}keyUp(e){e.key in oe&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const s=this.config.device;e(s,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(s,"change",this.pointerMove.bind(this)),e(s,"end",this.pointerUp.bind(this)),e(s,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function It(t){"persist"in t&&typeof t.persist=="function"&&t.persist()}const P=typeof window<"u"&&window.document&&window.document.createElement;function ke(){return P&&"ontouchstart"in window}function jt(){return ke()||P&&window.navigator.maxTouchPoints>1}function Pt(){return P&&"onpointerdown"in window}function Lt(){return P&&"exitPointerLock"in window.document}function Nt(){try{return"constructor"in GestureEvent}catch{return!1}}const S={isBrowser:P,gesture:Nt(),touch:ke(),touchscreen:jt(),pointer:Pt(),pointerLock:Lt()},Mt=250,Rt=180,Bt=.5,$t=50,Kt=250,zt=10,ie={mouse:0,touch:0,pen:8},Ut=m(m({},j),{},{device(t,e,{pointer:{touch:s=!1,lock:r=!1,mouse:n=!1}={}}){return this.pointerLock=r&&S.pointerLock,S.touch&&s?"touch":this.pointerLock?"mouse":S.pointer&&!n?"pointer":S.touch?"touch":"mouse"},preventScrollAxis(t,e,{preventScroll:s}){if(this.preventScrollDelay=typeof s=="number"?s:s||s===void 0&&t?Mt:void 0,!(!S.touchscreen||s===!1))return t||(s!==void 0?"y":void 0)},pointerCapture(t,e,{pointer:{capture:s=!0,buttons:r=1,keys:n=!0}={}}){return this.pointerButtons=r,this.keys=n,!this.pointerLock&&this.device==="pointer"&&s},threshold(t,e,{filterTaps:s=!1,tapsThreshold:r=3,axis:n=void 0}){const o=v.toVector(t,s?r:n?1:0);return this.filterTaps=s,this.tapsThreshold=r,o},swipe({velocity:t=Bt,distance:e=$t,duration:s=Kt}={}){return{velocity:this.transform(v.toVector(t)),distance:this.transform(v.toVector(e)),duration:s}},delay(t=0){switch(t){case!0:return Rt;case!1:return 0;default:return t}},axisThreshold(t){return t?m(m({},ie),t):ie},keyboardDisplacement(t=zt){return t}});m(m({},Ee),{},{device(t,e,{shared:s,pointer:{touch:r=!1}={}}){if(s.target&&!S.touch&&S.gesture)return"gesture";if(S.touch&&r)return"touch";if(S.touchscreen){if(S.pointer)return"pointer";if(S.touch)return"touch"}},bounds(t,e,{scaleBounds:s={},angleBounds:r={}}){const n=i=>{const c=re(B(s,i),{min:-1/0,max:1/0});return[c.min,c.max]},o=i=>{const c=re(B(r,i),{min:-1/0,max:1/0});return[c.min,c.max]};return typeof s!="function"&&typeof r!="function"?[n(),o()]:i=>[n(i),o(i)]},threshold(t,e,s){return this.lockDirection=s.axis==="lock",v.toVector(t,this.lockDirection?[.1,3]:0)},modifierKey(t){return t===void 0?"ctrlKey":t},pinchOnWheel(t=!0){return t}});m(m({},j),{},{mouseOnly:(t=!0)=>t});m(m({},j),{},{mouseOnly:(t=!0)=>t});const Se=new Map,G=new Map;function Ae(t){Se.set(t.key,t.engine),G.set(t.key,t.resolver)}const Te={key:"drag",engine:Dt,resolver:Ut};function Ft(t,e){if(t==null)return{};var s={},r=Object.keys(t),n,o;for(o=0;o<r.length;o++)n=r[o],!(e.indexOf(n)>=0)&&(s[n]=t[n]);return s}function Vt(t,e){if(t==null)return{};var s=Ft(t,e),r,n;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(s[r]=t[r])}return s}const Ht={target(t){if(t)return()=>"current"in t?t.current:t},enabled(t=!0){return t},window(t=S.isBrowser?window:void 0){return t},eventOptions({passive:t=!0,capture:e=!1}={}){return{passive:t,capture:e}},transform(t){return t}},Gt=["target","eventOptions","window","enabled","transform"];function R(t={},e){const s={};for(const[r,n]of Object.entries(e))switch(typeof n){case"function":s[r]=n.call(s,t[r],r,t);break;case"object":s[r]=R(t[r],n);break;case"boolean":n&&(s[r]=t[r]);break}return s}function Wt(t,e,s={}){const r=t,{target:n,eventOptions:o,window:i,enabled:c,transform:u}=r,d=Vt(r,Gt);if(s.shared=R({target:n,eventOptions:o,window:i,enabled:c,transform:u},Ht),e){const a=G.get(e);s[e]=R(m({shared:s.shared},d),a)}else for(const a in d){const f=G.get(a);f&&(s[a]=R(m({shared:s.shared},d[a]),f))}return s}class Ce{constructor(e,s){x(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=s}add(e,s,r,n,o){const i=this._listeners,c=bt(s,r),u=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},d=m(m({},u),o);e.addEventListener(c,n,d);const a=()=>{e.removeEventListener(c,n,d),i.delete(a)};return i.add(a),a}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class Yt{constructor(){x(this,"_timeouts",new Map)}add(e,s,r=140,...n){this.remove(e),this._timeouts.set(e,window.setTimeout(s,r,...n))}remove(e){const s=this._timeouts.get(e);s&&window.clearTimeout(s)}clean(){this._timeouts.forEach(e=>{window.clearTimeout(e)}),this._timeouts.clear()}}class Oe{constructor(e){x(this,"gestures",new Set),x(this,"_targetEventStore",new Ce(this)),x(this,"gestureEventStores",{}),x(this,"gestureTimeoutStores",{}),x(this,"handlers",{}),x(this,"config",{}),x(this,"pointerIds",new Set),x(this,"touchIds",new Set),x(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),Xt(this,e)}setEventIds(e){if(K(e))return this.touchIds=new Set(wt(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,s){this.handlers=e,this.nativeHandlers=s}applyConfig(e,s){this.config=Wt(e,s,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const s=this.config.shared,r={};let n;if(!(s.target&&(n=s.target(),!n))){if(s.enabled){for(const i of this.gestures){const c=this.config[i],u=ae(r,c.eventOptions,!!n);if(c.enabled){const d=Se.get(i);new d(this,e,i).bind(u)}}const o=ae(r,s.eventOptions,!!n);for(const i in this.nativeHandlers)o(i,"",c=>this.nativeHandlers[i](m(m({},this.state.shared),{},{event:c,args:e})),void 0,!0)}for(const o in r)r[o]=Et(...r[o]);if(!n)return r;for(const o in r){const{device:i,capture:c,passive:u}=gt(o);this._targetEventStore.add(n,i,"",r[o],{capture:c,passive:u})}}}}function I(t,e){t.gestures.add(e),t.gestureEventStores[e]=new Ce(t,e),t.gestureTimeoutStores[e]=new Yt}function Xt(t,e){e.drag&&I(t,"drag"),e.wheel&&I(t,"wheel"),e.scroll&&I(t,"scroll"),e.move&&I(t,"move"),e.pinch&&I(t,"pinch"),e.hover&&I(t,"hover")}const ae=(t,e,s)=>(r,n,o,i={},c=!1)=>{var u,d;const a=(u=i.capture)!==null&&u!==void 0?u:e.capture,f=(d=i.passive)!==null&&d!==void 0?d:e.passive;let h=c?r:pt(r,n,a);s&&f&&(h+="Passive"),t[h]=t[h]||[],t[h].push(o)};function qt(t,e){if(typeof t!="object"||t===null)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Qt(t){var e=qt(t,"string");return typeof e=="symbol"?e:String(e)}function Zt(t,e,s){return e=Qt(e),e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function ce(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function M(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?ce(Object(s),!0).forEach(function(r){Zt(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):ce(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}class Jt{constructor(e,s,r,n,o){this._target=e,this._gestureKey=n,this._ctrl=new Oe(s),this._ctrl.applyHandlers(s,o),this._ctrl.applyConfig(M(M({},r),{},{target:e}),n),this._ctrl.effect()}destroy(){this._ctrl.clean()}setConfig(e){this._ctrl.clean(),this._ctrl.applyConfig(M(M({},e),{},{target:this._target}),this._gestureKey),this._ctrl.effect()}}const es=function(e,s,r){return Ae(Te),new Jt(e,{drag:s},r||{},"drag")},V=10,De={axisThreshold:{mouse:V,touch:V,pen:V},swipe:{distance:60,velocity:.3,duration:600},pointer:{keys:!1,capture:!1}};function ts(t,e={},s,r){const n=z.useMemo(()=>new Oe(t),[]);if(n.applyHandlers(t,r),n.applyConfig(e,s),z.useEffect(n.effect.bind(n)),z.useEffect(()=>n.clean.bind(n),[]),e.target===void 0)return n.bind.bind(n)}function ss(t,e){return Ae(Te),ts({drag:t},e||{},"drag")}const W="remit:swipe",rs=b.createContext(!1),ns=1.01,Ie=t=>{const{event:e}=t;if("pointerType"in e&&e.pointerType!=="touch"||e.type!=="pointerup")return null;const s=t.swipe[0];return s<0?"left":s>0?"right":null},je=t=>{const e=window.visualViewport;return e?.addEventListener("resize",t),()=>e?.removeEventListener("resize",t)},Pe=()=>(window.visualViewport?.scale??1)>ns,Sr=({onSwipeLeft:t,onSwipeRight:e})=>{const s=b.useRef(null),r=t!==void 0||e!==void 0,n=b.useSyncExternalStore(je,Pe,()=>!1),o=c=>{c==="left"&&t?.(),c==="right"&&e?.()},i=ss(c=>o(Ie(c)),{...De,axis:"x",enabled:r&&!n});return b.useEffect(()=>{const c=s.current;if(!c||!r||n)return;const u=d=>{if(!(d instanceof CustomEvent))return;const{detail:a}=d;(a==="left"||a==="right")&&o(a)};return c.addEventListener(W,u),()=>c.removeEventListener(W,u)}),{ref:s,bind:i,touchAction:r&&!n?"pan-y pinch-zoom":"auto",enabled:r}},os='"Geist Variable", "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',$={light:{fg:"oklch(0.3 0.025 235)",canvas:"oklch(0.96 0.015 90)",accent:"oklch(0.55 0.14 150)"},dark:{fg:"oklch(0.88 0.02 90)",canvas:"oklch(0.22 0.025 220)",accent:"oklch(0.78 0.16 150)"}},is={background:!1,spacing:!1},as="16px",cs=()=>`html{padding:0}body{padding:${as};box-sizing:border-box}`,ls=()=>"html{overflow:hidden}body{overflow-x:auto}",us=/prefers-color-scheme\s*:\s*dark|color-scheme\s*:\s*[^;}"']*\bdark\b/i,ds='<meta name="viewport" content="width=device-width, initial-scale=1">',fs=t=>{const e=t?$.dark:$.light;return`
2
2
  /* Plain-email base: UI font-stack + theme-aware colors (#424) */
3
3
  html, body {
4
4
  font-family: ${os};
@@ -19,7 +19,7 @@ a, a:visited {
19
19
  color: ${e.accent} !important;
20
20
  text-decoration: underline;
21
21
  }
22
- `},Y="invert(0.92) hue-rotate(180deg)",le=`img,picture,video,svg,canvas,[style*='background-image'],[background]{filter:${Y}}`,hs=(t,e,s)=>{const r=t?$.dark.canvas:$.light.canvas;return s?t?e?`html,body{margin:0;background-color:${r};color-scheme:dark light}`:`html{margin:0;background-color:#ffffff;filter:${Y}}body{margin:0}${le}`:"html,body{margin:0;background-color:#ffffff;color-scheme:light}":t?e?`html,body{margin:0;background-color:${r};color-scheme:dark light}`:`html{margin:0;background-color:${r}}body{margin:0;filter:${Y}}${le}`:`html,body{margin:0;background-color:${r};color-scheme:light}`},ps=(t,e,s,r=is)=>{const n=e==="plain"?fs(s):hs(s,us.test(t),r.background),o=r.spacing?"":cs();return`${ds}<style>${n}</style>${t}<style>${ls()}${o}</style>`},ue=5e4,ms="allow-same-origin allow-popups allow-popups-to-escape-sandbox",de=(t,e,s)=>Math.min(Math.ceil(Math.max(t,e)),s),X=.5,fe=(t,e)=>e>0&&t>e+1?Math.max(e/t,X):1,gs=["box-sizing","width","max-width","transform","transform-origin","margin-bottom","overflow-x"],bs=t=>{for(const i of gs)t.style.removeProperty(i);const e=t.clientWidth,s=t.scrollWidth;if(fe(s,e)===1)return 1;const r=(i,c)=>t.style.setProperty(i,c,"important");r("box-sizing","border-box"),r("max-width","none"),r("width",`${s}px`);const n=Math.max(s,t.scrollWidth),o=fe(n,e);return o>X?r("overflow-x","visible"):r("width",`${e/X}px`),r("transform-origin","0 0"),r("transform",`scale(${o})`),r("margin-bottom",`${-t.offsetHeight*(1-o)}px`),o},ys=new Set(["Enter","Escape","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"]),vs=t=>t===" "?!1:t.length===1?!0:ys.has(t),H=t=>{if(t.metaKey||t.ctrlKey||t.altKey||!vs(t.key))return;const e=t.currentTarget??t.target,s=e?.defaultView?.parent;!s||s===e?.defaultView||s.dispatchEvent(new KeyboardEvent("keydown",{key:t.key,code:t.code,shiftKey:t.shiftKey,bubbles:!0,cancelable:!0}))},he=({html:t,variant:e="framed",isDark:s=!1,declares:r,className:n})=>{const o=b.useRef(null),[i,c]=b.useState(0),u=b.useContext(rs),d=b.useMemo(()=>ps(t,e,s,r),[t,e,s,r]);return b.useEffect(()=>{const a=o.current;if(!a)return;const f=()=>{const p=a.contentDocument;if(!p?.body)return;S();const g=p.documentElement,L=bs(p.body)<1?de(p.body.getBoundingClientRect().height,0,ue):de(p.body.scrollHeight,g?.scrollHeight??0,ue);c(N=>N===L?N:L)};let h=0;const E=()=>{cancelAnimationFrame(h),h=requestAnimationFrame(f)},y=p=>{const g=p.documentElement;return Pe()||g.scrollWidth>g.clientWidth+1},S=()=>{const p=a.contentDocument;if(!u||!p?.body)return;const g=y(p)?"auto":"pan-y pinch-zoom";p.documentElement.style.touchAction=g,p.body.style.touchAction=g};let _,w,A;const T=u?je(S):void 0,D=()=>{f(),_?.disconnect(),_=void 0,w?.removeEventListener("keydown",H),w?.removeEventListener("load",f,!0),w=void 0,A?.destroy(),A=void 0;const p=a.contentDocument;p?.body&&(S(),u&&(A=new es(p.documentElement,g=>{const O=Ie(g);O&&a.dispatchEvent(new CustomEvent(W,{bubbles:!0,detail:O}))},{...De,axis:"x",window:p.defaultView??void 0})),_=new ResizeObserver(E),_.observe(p.body),p.documentElement&&_.observe(p.documentElement),p.addEventListener("load",f,!0),p.fonts?.ready.then(f),p.addEventListener("keydown",H),w=p)};return a.addEventListener("load",D),()=>{a.removeEventListener("load",D),w?.removeEventListener("keydown",H),w?.removeEventListener("load",f,!0),_?.disconnect(),A?.destroy(),T?.(),cancelAnimationFrame(h)}},[u]),l.jsx("iframe",{ref:o,title:"Email content",sandbox:ms,srcDoc:d,className:n,style:{width:"100%",border:"none",display:"block",height:i===0?"1px":`${i}px`,colorScheme:"normal"}})},ws=(t,e)=>{const r=t==="newsletter"||t==="marketing"||e;return{framed:r,isPlain:!r}},_s=()=>`
22
+ `},Y="invert(0.92) hue-rotate(180deg)",le=`img,picture,video,svg,canvas,[style*='background-image'],[background]{filter:${Y}}`,hs=(t,e,s)=>{const r=t?$.dark.canvas:$.light.canvas;return s?t?e?`html,body{margin:0;background-color:${r};color-scheme:dark light}`:`html{margin:0;background-color:#ffffff;filter:${Y}}body{margin:0}${le}`:"html,body{margin:0;background-color:#ffffff;color-scheme:light}":t?e?`html,body{margin:0;background-color:${r};color-scheme:dark light}`:`html{margin:0;background-color:${r}}body{margin:0;filter:${Y}}${le}`:`html,body{margin:0;background-color:${r};color-scheme:light}`},ps=(t,e,s,r=is)=>{const n=e==="plain"?fs(s):hs(s,us.test(t),r.background),o=r.spacing?"":cs();return`${ds}<style>${n}</style>${t}<style>${ls()}${o}</style>`},ue=5e4,ms="allow-same-origin allow-popups allow-popups-to-escape-sandbox",de=(t,e,s)=>Math.min(Math.ceil(Math.max(t,e)),s),X=.5,fe=(t,e)=>e>0&&t>e+1?Math.max(e/t,X):1,gs=["box-sizing","width","max-width","transform","transform-origin","margin-bottom","overflow-x"],bs=t=>{for(const i of gs)t.style.removeProperty(i);const e=t.clientWidth,s=t.scrollWidth;if(fe(s,e)===1)return 1;const r=(i,c)=>t.style.setProperty(i,c,"important");r("box-sizing","border-box"),r("max-width","none"),r("width",`${s}px`);const n=Math.max(s,t.scrollWidth),o=fe(n,e);return o>X?r("overflow-x","visible"):r("width",`${e/X}px`),r("transform-origin","0 0"),r("transform",`scale(${o})`),r("margin-bottom",`${-t.offsetHeight*(1-o)}px`),o},ys=new Set(["Enter","Escape","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"]),vs=t=>t===" "?!1:t.length===1?!0:ys.has(t),H=t=>{if(t.metaKey||t.ctrlKey||t.altKey||!vs(t.key))return;const e=t.currentTarget??t.target,s=e?.defaultView?.parent;!s||s===e?.defaultView||s.dispatchEvent(new KeyboardEvent("keydown",{key:t.key,code:t.code,shiftKey:t.shiftKey,bubbles:!0,cancelable:!0}))},he=({html:t,variant:e="framed",isDark:s=!1,declares:r,className:n})=>{const o=b.useRef(null),[i,c]=b.useState(0),u=b.useContext(rs),d=b.useMemo(()=>ps(t,e,s,r),[t,e,s,r]);return b.useEffect(()=>{const a=o.current;if(!a)return;const f=()=>{const p=a.contentDocument;if(!p?.body)return;k();const g=p.documentElement,L=bs(p.body)<1?de(p.body.getBoundingClientRect().height,0,ue):de(p.body.scrollHeight,g?.scrollHeight??0,ue);c(N=>N===L?N:L)};let h=0;const E=()=>{cancelAnimationFrame(h),h=requestAnimationFrame(f)},y=p=>{const g=p.documentElement;return Pe()||g.scrollWidth>g.clientWidth+1},k=()=>{const p=a.contentDocument;if(!u||!p?.body)return;const g=y(p)?"auto":"pan-y pinch-zoom";p.documentElement.style.touchAction=g,p.body.style.touchAction=g};let _,w,A;const T=u?je(k):void 0,D=()=>{f(),_?.disconnect(),_=void 0,w?.removeEventListener("keydown",H),w?.removeEventListener("load",f,!0),w=void 0,A?.destroy(),A=void 0;const p=a.contentDocument;p?.body&&(k(),u&&(A=new es(p.documentElement,g=>{const O=Ie(g);O&&a.dispatchEvent(new CustomEvent(W,{bubbles:!0,detail:O}))},{...De,axis:"x",window:p.defaultView??void 0})),_=new ResizeObserver(E),_.observe(p.body),p.documentElement&&_.observe(p.documentElement),p.addEventListener("load",f,!0),p.fonts?.ready.then(f),p.addEventListener("keydown",H),w=p)};return a.addEventListener("load",D),()=>{a.removeEventListener("load",D),w?.removeEventListener("keydown",H),w?.removeEventListener("load",f,!0),_?.disconnect(),A?.destroy(),T?.(),cancelAnimationFrame(h)}},[u]),l.jsx("iframe",{ref:o,title:"Email content",sandbox:ms,srcDoc:d,className:n,style:{width:"100%",border:"none",display:"block",height:i===0?"1px":`${i}px`,colorScheme:"normal"}})},ws=(t,e)=>{const r=t==="newsletter"||t==="marketing"||e;return{framed:r,isPlain:!r}},_s=()=>`
23
23
  /* Zero the UA default body margin and clamp the document to the iframe width so
24
24
  wide author markup can't push the body (and the page) past the viewport. */
25
25
  html, body {
@@ -74,11 +74,11 @@ pre, code {
74
74
  :is(pre, code, pre *, code *):is([nowrap], [style*="nowrap" i]) {
75
75
  white-space: pre-wrap !important;
76
76
  }
77
- `,xs=t=>{const e=new Map;for(const s of t){if(!s.contentId||s.contentUrl.length===0)continue;const r=s.contentId.replace(/^<|>$/g,"");e.set(r,s.contentUrl)}return s=>e.get(s.replace(/^<|>$/g,""))},Es=/^(none|transparent|inherit|initial|unset)\s*$/i,Le=t=>{const e=[],s=/<style[^>]*>([\s\S]*?)<\/style>/gi;let r;for(r=s.exec(t);r!==null;)e.push(r[1]),r=s.exec(t);return e},Ss=t=>{const e=/background(?:-color)?\s*:\s*([^;}\n]+)/gi;let s;for(s=e.exec(t);s!==null;){const r=s[1].trim();if(!Es.test(r))return!0;s=e.exec(t)}return!1},ks=t=>{if(/\bstyle\s*=\s*["'][^"']*background/i.test(t)||/\bbgcolor\s*=/i.test(t))return!0;for(const e of Le(t))if(Ss(e))return!0;return!1},As=new Set(["auto","none","initial","inherit","unset","revert","revert-layer"]),Ts=new RegExp(`(?<![-\\w])(?:padding|margin)(?:-(top|right|bottom|left|block|inline)(?:-(?:start|end))?)?\\s*:\\s*([^;}"']+)`,"gi"),Cs=new Set(["top","bottom","block"]),Ne=t=>t.replace(/\/\*[\s\S]*?\*\//g,""),pe=t=>{const e=t.toLowerCase();if(!e||As.has(e)||e.startsWith("-"))return!1;const s=/^\+?(\d*\.?\d+)[a-z%]*$/.exec(e);return s?Number.parseFloat(s[1])!==0:!0},Os=t=>{const e=t.split(/\s+/).filter(Boolean);return e.length<2?e:e.length<4?[e[1]]:[e[1],e[3]]},Ds=(t,e)=>{if(t&&Cs.has(t))return!1;const s=e.replace(/!\s*important/gi,"").trim();return s?t?s.split(/\s+/).some(pe):Os(s).some(pe):!1},me=t=>{for(const e of Ne(t).matchAll(Ts))if(Ds(e[1],e[2]))return!0;return!1},Me=new Set(["blockquote"]),Is=t=>t.replace(/<!--[\s\S]*?-->/g,""),js=t=>{const e=[],s=/<([a-zA-Z][\w:-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,r=/\bstyle\s*=\s*(?:"([^"]*)"|'([^']*)')/gi;for(const[,n,o]of t.matchAll(s))for(const i of o.matchAll(r))e.push({tag:n.toLowerCase(),style:i[1]??i[2]??""});return e},Ps=t=>[...Ne(t).matchAll(/([^{}]*)\{([^{}]*)\}/g)].map(e=>({selector:e[1].trim(),body:e[2]})),Ls=t=>{const e=t.trim().split(/[\s>+~]+/).pop()??"";return(/^[a-zA-Z][\w-]*/.exec(e)?.[0]??"").toLowerCase()},Ns=t=>t.split(",").every(e=>Me.has(Ls(e))),Ms=t=>{const e=Le(t),s=Is(t);if(/\bcellpadding\s*=\s*["']?(?!0["'\s>])\d/i.test(s))return!0;for(const{tag:r,style:n}of js(s))if(!Me.has(r)&&me(n))return!0;for(const r of e)for(const n of Ps(r))if(!Ns(n.selector)&&me(n.body))return!0;return!1},Rs=["script","iframe","object","embed","form","input","button","textarea","select","meta","link","base"],Bs=["onerror","onload","onclick","onmouseover","onmouseout","onfocus","onblur","onsubmit","onkeydown","onkeyup","formaction","xlink:href","data-bind"],$s="data:image/svg+xml,"+encodeURIComponent(`
77
+ `,xs=t=>{const e=new Map;for(const s of t){if(!s.contentId||s.contentUrl.length===0)continue;const r=s.contentId.replace(/^<|>$/g,"");e.set(r,s.contentUrl)}return s=>e.get(s.replace(/^<|>$/g,""))},Es=/^(none|transparent|inherit|initial|unset)\s*$/i,Le=t=>{const e=[],s=/<style[^>]*>([\s\S]*?)<\/style>/gi;let r;for(r=s.exec(t);r!==null;)e.push(r[1]),r=s.exec(t);return e},ks=t=>{const e=/background(?:-color)?\s*:\s*([^;}\n]+)/gi;let s;for(s=e.exec(t);s!==null;){const r=s[1].trim();if(!Es.test(r))return!0;s=e.exec(t)}return!1},Ss=t=>{if(/\bstyle\s*=\s*["'][^"']*background/i.test(t)||/\bbgcolor\s*=/i.test(t))return!0;for(const e of Le(t))if(ks(e))return!0;return!1},As=new Set(["auto","none","initial","inherit","unset","revert","revert-layer"]),Ts=new RegExp(`(?<![-\\w])(?:padding|margin)(?:-(top|right|bottom|left|block|inline)(?:-(?:start|end))?)?\\s*:\\s*([^;}"']+)`,"gi"),Cs=new Set(["top","bottom","block"]),Ne=t=>t.replace(/\/\*[\s\S]*?\*\//g,""),pe=t=>{const e=t.toLowerCase();if(!e||As.has(e)||e.startsWith("-"))return!1;const s=/^\+?(\d*\.?\d+)[a-z%]*$/.exec(e);return s?Number.parseFloat(s[1])!==0:!0},Os=t=>{const e=t.split(/\s+/).filter(Boolean);return e.length<2?e:e.length<4?[e[1]]:[e[1],e[3]]},Ds=(t,e)=>{if(t&&Cs.has(t))return!1;const s=e.replace(/!\s*important/gi,"").trim();return s?t?s.split(/\s+/).some(pe):Os(s).some(pe):!1},me=t=>{for(const e of Ne(t).matchAll(Ts))if(Ds(e[1],e[2]))return!0;return!1},Me=new Set(["blockquote"]),Is=t=>t.replace(/<!--[\s\S]*?-->/g,""),js=t=>{const e=[],s=/<([a-zA-Z][\w:-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,r=/\bstyle\s*=\s*(?:"([^"]*)"|'([^']*)')/gi;for(const[,n,o]of t.matchAll(s))for(const i of o.matchAll(r))e.push({tag:n.toLowerCase(),style:i[1]??i[2]??""});return e},Ps=t=>[...Ne(t).matchAll(/([^{}]*)\{([^{}]*)\}/g)].map(e=>({selector:e[1].trim(),body:e[2]})),Ls=t=>{const e=t.trim().split(/[\s>+~]+/).pop()??"";return(/^[a-zA-Z][\w-]*/.exec(e)?.[0]??"").toLowerCase()},Ns=t=>t.split(",").every(e=>Me.has(Ls(e))),Ms=t=>{const e=Le(t),s=Is(t);if(/\bcellpadding\s*=\s*["']?(?!0["'\s>])\d/i.test(s))return!0;for(const{tag:r,style:n}of js(s))if(!Me.has(r)&&me(n))return!0;for(const r of e)for(const n of Ps(r))if(!Ns(n.selector)&&me(n.body))return!0;return!1},Rs=["script","iframe","object","embed","form","input","button","textarea","select","meta","link","base"],Bs=["onerror","onload","onclick","onmouseover","onmouseout","onfocus","onblur","onsubmit","onkeydown","onkeyup","formaction","xlink:href","data-bind"],$s="data:image/svg+xml,"+encodeURIComponent(`
78
78
  <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100">
79
79
  <rect fill="#f0f0f0" width="100" height="100"/>
80
80
  <text x="50" y="50" text-anchor="middle" dy=".3em" fill="#999" font-size="12">
81
81
  Image blocked
82
82
  </text>
83
83
  </svg>
84
- `),Ks=t=>t.replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),zs=t=>t.replace(/@import[^;]*;/gi,"/* @import blocked */").replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),Us=(t={})=>{const e=rt(),s={FORBID_TAGS:Rs,FORBID_ATTR:Bs,ALLOW_DATA_ATTR:!1,ALLOW_UNKNOWN_PROTOCOLS:!1};return e.addHook("afterSanitizeAttributes",r=>{if(t.allowExternalImages||(r.tagName==="IMG"&&r.removeAttribute("srcset"),r.tagName==="SOURCE"&&(r.removeAttribute("srcset"),r.removeAttribute("src")),r.tagName==="VIDEO"&&r.removeAttribute("poster")),r.tagName==="IMG"){const n=r.getAttribute("src")||"";if(n.startsWith("data:"))return;if(n.startsWith("cid:")){const i=n.slice(4).replace(/^<|>$/g,""),c=t.resolveCid?.(i);c&&(r.setAttribute("src",c),r.classList.add("inline-content"));return}t.allowExternalImages||(r.setAttribute("data-blocked-src",n),r.setAttribute("src",$s),r.setAttribute("alt","[Blocked image]"),r.classList.add("blocked-image"))}if(r.tagName==="A"){const n=r.getAttribute("href")||"";if(/^(javascript|data):/i.test(n)){r.removeAttribute("href");return}r.setAttribute("target","_blank"),r.setAttribute("rel","noopener noreferrer nofollow"),r.classList.add("external-link")}if(r.hasAttribute("style")){const n=r.getAttribute("style")||"";r.setAttribute("style",Ks(n))}}),e.addHook("uponSanitizeElement",(r,n)=>{if(n.tagName==="style"){const o=r.textContent||"";r.textContent=zs(o)}}),r=>{const n=ks(r),o=Ms(r),i=e.sanitize(r,s);return{html:`<style>${_s()}</style>${i}`,hasAuthorBackground:n,hasAuthorSpacing:o}}},ge=()=>l.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),Ar=({className:t,children:e})=>l.jsx("div",{className:C("[&_.message-body-frame]:-mx-2 lg:[&_.message-body-frame]:-mx-4",t),children:e}),Fs=({html:t,text:e,isDark:s=!1,category:r,allowImages:n=!1,resolveCid:o,className:i,renderBlockedNotice:c})=>{const u=b.useMemo(()=>!t||typeof document>"u"?null:Us({allowExternalImages:n,resolveCid:o})(t),[t,n,o]),d=u?.html??null,{framed:a,isPlain:f}=ws(r,u?.hasAuthorBackground??!1),h=b.useMemo(()=>({background:u?.hasAuthorBackground??!1,spacing:u?.hasAuthorSpacing??!1}),[u?.hasAuthorBackground,u?.hasAuthorSpacing]),E=b.useMemo(()=>!d||n?0:(d.match(/data-blocked-src/g)||[]).length,[d,n]);return!d&&!e?l.jsx("div",{className:C("message-body",i),children:l.jsx(ge,{})}):l.jsxs("div",{className:C("message-body",i),children:[E>0&&l.jsx("div",{children:c?.(E)}),d?l.jsx("div",{className:"message-body-frame",children:a?l.jsx("div",{className:"w-full max-w-full",children:l.jsx(he,{html:d,variant:"framed",isDark:s,declares:h})}):l.jsx("div",{className:"max-w-full lg:max-w-2xl",children:l.jsx(he,{html:d,variant:f?"plain":"framed",isDark:s,declares:h})})}):e?l.jsx("pre",{className:"email-text whitespace-pre-wrap text-sm leading-relaxed",children:e}):l.jsx(ge,{})]})};function Tr({message:t="Select a thread to read",icon:e,showHints:s=!0,className:r}){return l.jsxs("div",{className:C("flex flex-1 flex-col items-center justify-center text-center",r),children:[e??l.jsx(Ve,{className:"size-10 text-fg-subtle"}),l.jsx("p",{className:"mt-3 text-sm text-fg-muted",children:t}),s&&l.jsxs("p",{className:"text-2xs text-fg-subtle",children:[l.jsx(U,{children:"j"})," / ",l.jsx(U,{children:"k"})," to move, ",l.jsx(U,{children:"Enter"})," to open"]})]})}function Re(t){const e=[];let s=-1,r=!1;for(let n=0;n<t.length;n++){const o=t[n];if(o==='"'){r=!r,s<0&&(s=n);continue}if(!r&&/\s/.test(o)){s>=0&&e.push({raw:t.slice(s,n),start:s,end:n}),s=-1;continue}s<0&&(s=n)}return s>=0&&e.push({raw:t.slice(s),start:s,end:t.length}),e}const Vs=t=>{if(!t.startsWith('"'))return t;const e=t.slice(1);return e.endsWith('"')?e.slice(0,-1):e};function Hs(t){const e=t.indexOf(":");if(e<=0)return;const s=t.slice(e+1);return{name:t.slice(0,e).toLowerCase(),value:Vs(s),rawValue:s}}const Gs=t=>/[\s"]/.test(t),Ws=t=>Gs(t)?`"${t.replace(/"/g,"")}"`:t,Cr=(t,e)=>`${t}:${Ws(e)}`;function Or(){const{mailboxNameIndex:t,accountNameIndex:e}=He(),s=st();return{...tt(s)?{}:{mailboxesByName:t},accountsByName:e}}const Ys=Object.values(ye).map(t=>({value:t,label:Q[t]})),Xs={unclassified:"uncategorized"},qs=[{name:"from",label:"Sender",values:"contact"},{name:"subject",label:"Subject",values:"text"},{name:"category",label:"Category",values:"fixed",options:Ys},{name:"is",label:"State",values:"fixed",options:[{value:"unread",label:"Unread"},{value:"read",label:"Read"},{value:"starred",label:"Starred"}]},{name:"has",label:"Contents",values:"fixed",options:[{value:"attachment",label:"Has attachment"}]},{name:"in",label:"Folder",values:"mailbox"},{name:"account",label:"Account",values:"account"},{name:"after",label:"Sent on or after",values:"date"},{name:"before",label:"Sent before",values:"date"}],Qs=new Map(qs.map(t=>[t.name,t])),Dr=t=>Qs.get(t.toLowerCase()),Zs=/^\d{4}-\d{2}-\d{2}$/;function Js(t,e,s){if(!Zs.test(s))return;const r=Date.parse(`${s}T00:00:00Z`);if(!Number.isNaN(r))return{type:t,raw:e,value:s,epochSeconds:Math.floor(r/1e3)}}function er(t){const e=t.toLowerCase(),s=Xs[e];return s||Object.values(ye).find(n=>n===e)}function tr(t,e){switch(e.toLowerCase()){case"unread":return{type:"isUnread",raw:t};case"read":return{type:"isRead",raw:t};case"starred":case"flagged":return{type:"isStarred",raw:t};default:return}}function sr(t,e){const s=Hs(t);if(!s||s.value.length===0)return;const{name:r,value:n}=s;switch(r){case"from":return{type:"from",raw:t,value:n};case"subject":return{type:"subject",raw:t,value:n};case"category":{const o=er(n);return o?{type:"category",raw:t,value:n,category:o}:void 0}case"is":return tr(t,n);case"has":return n.toLowerCase()==="attachment"?{type:"hasAttachment",raw:t}:void 0;case"before":case"after":return Js(r,t,n);case"in":{const o=e.mailboxesByName?.get(n.toLowerCase());return o?{type:"in",raw:t,value:n,mailboxId:o}:void 0}case"account":{const o=e.accountsByName?.get(n.toLowerCase());return o?{type:"account",raw:t,value:n,accountId:o}:void 0}default:return}}function Ir(t,e={}){const s=[],r=[];for(const n of Re(t)){const o=sr(n.raw,e);o?s.push(o):r.push(n.raw)}return{freeText:r.join(" "),tokens:s}}function jr(t,e){return Re(t).filter(s=>s.raw!==e.raw).map(s=>s.raw).join(" ")}function Pr(t){switch(t.type){case"from":return`From: ${t.value}`;case"subject":return`Subject: ${t.value}`;case"category":return`Category: ${Q[t.category]}`;case"hasAttachment":return"Has attachment";case"isUnread":return"Unread";case"isRead":return"Read";case"isStarred":return"Starred";case"before":return`Before ${t.value}`;case"after":return`After ${t.value}`;case"in":return`In: ${t.value}`;case"account":return`Account: ${t.value}`}}const Be=(t,e=Date.now())=>({value:t,setAt:e}),rr=(t,e,s,r)=>{if(t.addressId!==e)return t;const n={...t.flags??{}};return s?n.trusted=Be(!0,r):delete n.trusted,{...t,flags:n}},nr=(t,e,s,r)=>{const n=o=>o.map(i=>rr(i,e,s,r));return{...t,envelope:{...t.envelope,from:n(t.envelope.from),to:n(t.envelope.to),cc:n(t.envelope.cc),bcc:n(t.envelope.bcc),replyTo:n(t.envelope.replyTo)}}},or=({messageId:t})=>{const e=Ge(),{pushError:s}=We(),{mutate:r,isPending:n,error:o,reset:i}=Ye({...Qe(),onMutate:async u=>{const d=u.path.addressId,f=u.body.flags?.trusted?.value===!0,h=qe({path:{messageId:t}});await e.cancelQueries({queryKey:h});const E=e.getQueriesData({queryKey:h}).filter(y=>y[1]!==void 0).map(([y,S])=>({queryKey:y,data:S}));return e.setQueriesData({queryKey:h},y=>y&&nr(y,d,f)),{describePrefix:h,previous:E}},onError:(u,d,a)=>{if(a)for(const f of a.previous)e.setQueryData(f.queryKey,f.data);s(Xe("Couldn't trust sender","The change wasn't saved.",u))},onSettled:(u,d,a,f)=>{f&&e.invalidateQueries({queryKey:f.describePrefix})}});return{toggleTrusted:(u,d)=>{r({path:{addressId:u},body:{flags:{trusted:Be(!d)}}})},isPending:n,error:o,reset:i}},ir=()=>{const[t,e]=b.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark"));return b.useEffect(()=>{const s=document.documentElement,r=new MutationObserver(()=>{e(s.classList.contains("dark"))});return r.observe(s,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),t},ar=(t,e)=>{const s=`${t} image${t>1?"s":""}`;return e?`${s} hidden — you blocked this sender`:`${s} blocked for privacy`},cr=({blockedImageCount:t,canAlwaysTrust:e,isTrustPending:s,isSenderBlocked:r,onLoadOnce:n,onAlwaysTrust:o})=>l.jsxs("div",{"data-testid":"blocked-images-notice",className:"mb-3 flex items-center justify-between rounded-md bg-surface-sunken/50 px-3 py-2 text-sm",children:[l.jsx("span",{className:"text-fg-muted",children:ar(t,r)}),!r&&l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("button",{type:"button",onClick:n,className:"text-accent hover:underline",children:"Load once"}),e&&l.jsx("button",{type:"button",onClick:o,"aria-busy":s,className:"text-accent hover:underline aria-busy:opacity-50",children:s?"Trusting…":"Always trust"})]})]}),lr=(t,e)=>{switch(t){case"auth":return{title:"Your session expired",detail:"Sign in again to reload the message body. Other parts of the app may also stop responding until you do."};case"body-missing":return{title:"Message body is missing in storage",detail:"A sync failure may have left this message without its body bytes. Contact support, or run the reconcile script to refetch from the upstream IMAP server."};case"content-type-mismatch":return{title:"Couldn't load message body",detail:"The server returned an unexpected content type for this part. The message body has not been rendered to keep you safe."};case"spa-shell-leak":return{title:"Couldn't load message body",detail:"The server returned the app shell instead of the message body. This is an infrastructure bug — please report it."};case"not-ready":return{title:"Message body is still syncing",detail:"This message's body hasn't finished downloading from the mail server yet. It should appear shortly — reopen the message to try again."};default:return{title:"Couldn't load message body",detail:e}}},ur=t=>t instanceof nt?t.reason:"generic",dr=t=>t instanceof Error?t.message:typeof t=="string"?t:"An unexpected error occurred while loading the message body.",fr=({error:t,onRetry:e})=>{const s=ur(t),r=dr(t),{title:n,detail:o}=lr(s,r),[i,c]=b.useState(!1),{Account:u}=Ze();return i?null:l.jsxs("div",{role:"alert","data-testid":"message-body-error-banner","data-reason":s,className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[l.jsx(Je,{className:"size-4 shrink-0 text-danger mt-0.5","aria-hidden":"true"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"font-medium text-danger",children:n}),l.jsx("p",{className:"text-fg-muted mt-1 break-words",children:o})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[s==="auth"&&l.jsx(u,{children:({signOut:d})=>l.jsx("button",{type:"button",onClick:()=>d(),className:"text-sm font-medium text-accent hover:underline",children:"Sign in again"})}),e&&l.jsx("button",{type:"button",onClick:e,className:"text-sm font-medium text-accent hover:underline",children:"Retry"}),l.jsx("button",{type:"button",onClick:()=>c(!0),"aria-label":"Dismiss message body error",className:"rounded-md p-1 text-fg-muted hover:bg-surface-raised hover:text-fg transition-colors",children:l.jsx(et,{className:"size-4","aria-hidden":"true"})})]})]})},hr=()=>l.jsxs("div",{className:"animate-pulse space-y-2",role:"status","aria-label":"Loading message body",children:[l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-11/12"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-5/6"})]}),be=()=>l.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),Lr=({bodyParts:t,html:e,text:s,isTrusted:r=!1,isBlocked:n=!1,messageId:o,fromAddressId:i,category:c,className:u})=>{const[d,a]=b.useState(!1),[f,h]=b.useState(o);f!==o&&(h(o),a(!1));const E=!n&&(r||d),y=ir(),{toggleTrusted:S,isPending:_}=or({messageId:o??""}),w=!!t&&t.length>0,{picked:A,data:T,isLoading:D,isError:p,error:g,refetch:O}=ot({messageId:o,bodyParts:t,enabled:w}),L=b.useMemo(()=>xs(t??[]),[t]),N=w&&T?.kind==="html"?T.body:e,$e=w&&T?.kind==="text"?T.body:s;if(w){if(D)return l.jsx("div",{className:C("message-body",u),children:l.jsx(hr,{})});if(p)return l.jsx("div",{className:C("message-body",u),children:l.jsx(fr,{error:g,onRetry:()=>O()})});if(!A)return l.jsx("div",{className:C("message-body",u),children:l.jsx(be,{})})}else if(!e&&!s)return l.jsx("div",{className:C("message-body",u),children:l.jsx(be,{})});const Ke=!!(i&&o),ze=()=>{!i||_||(a(!0),S(i,!1))};return l.jsx(Fs,{className:u,html:N,text:$e,isDark:y,category:c,allowImages:E,resolveCid:L,renderBlockedNotice:Ue=>l.jsx(cr,{blockedImageCount:Ue,canAlwaysTrust:Ke,isTrustPending:_,isSenderBlocked:n,onLoadOnce:()=>a(!0),onAlwaysTrust:ze})})};export{Sr as A,wr as C,Ar as M,Tr as R,De as S,ss as a,V as b,Er as c,Q as d,it as e,Fs as f,_r as g,kr as h,rs as i,at as j,or as k,Lr as l,q as m,Re as n,Hs as o,Ir as p,qs as q,Cr as r,Dr as s,Pr as t,Or as u,jr as v,xr as w};
84
+ `),Ks=t=>t.replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),zs=t=>t.replace(/@import[^;]*;/gi,"/* @import blocked */").replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),Us=(t={})=>{const e=rt(),s={FORBID_TAGS:Rs,FORBID_ATTR:Bs,ALLOW_DATA_ATTR:!1,ALLOW_UNKNOWN_PROTOCOLS:!1};return e.addHook("afterSanitizeAttributes",r=>{if(t.allowExternalImages||(r.tagName==="IMG"&&r.removeAttribute("srcset"),r.tagName==="SOURCE"&&(r.removeAttribute("srcset"),r.removeAttribute("src")),r.tagName==="VIDEO"&&r.removeAttribute("poster")),r.tagName==="IMG"){const n=r.getAttribute("src")||"";if(n.startsWith("data:"))return;if(n.startsWith("cid:")){const i=n.slice(4).replace(/^<|>$/g,""),c=t.resolveCid?.(i);c&&(r.setAttribute("src",c),r.classList.add("inline-content"));return}t.allowExternalImages||(r.setAttribute("data-blocked-src",n),r.setAttribute("src",$s),r.setAttribute("alt","[Blocked image]"),r.classList.add("blocked-image"))}if(r.tagName==="A"){const n=r.getAttribute("href")||"";if(/^(javascript|data):/i.test(n)){r.removeAttribute("href");return}r.setAttribute("target","_blank"),r.setAttribute("rel","noopener noreferrer nofollow"),r.classList.add("external-link")}if(r.hasAttribute("style")){const n=r.getAttribute("style")||"";r.setAttribute("style",Ks(n))}}),e.addHook("uponSanitizeElement",(r,n)=>{if(n.tagName==="style"){const o=r.textContent||"";r.textContent=zs(o)}}),r=>{const n=Ss(r),o=Ms(r),i=e.sanitize(r,s);return{html:`<style>${_s()}</style>${i}`,hasAuthorBackground:n,hasAuthorSpacing:o}}},ge=()=>l.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),Ar=({className:t,children:e})=>l.jsx("div",{className:C("[&_.message-body-frame]:-mx-2 lg:[&_.message-body-frame]:-mx-4",t),children:e}),Fs=({html:t,text:e,isDark:s=!1,category:r,allowImages:n=!1,resolveCid:o,className:i,renderBlockedNotice:c})=>{const u=b.useMemo(()=>!t||typeof document>"u"?null:Us({allowExternalImages:n,resolveCid:o})(t),[t,n,o]),d=u?.html??null,{framed:a,isPlain:f}=ws(r,u?.hasAuthorBackground??!1),h=b.useMemo(()=>({background:u?.hasAuthorBackground??!1,spacing:u?.hasAuthorSpacing??!1}),[u?.hasAuthorBackground,u?.hasAuthorSpacing]),E=b.useMemo(()=>!d||n?0:(d.match(/data-blocked-src/g)||[]).length,[d,n]);return!d&&!e?l.jsx("div",{className:C("message-body",i),children:l.jsx(ge,{})}):l.jsxs("div",{className:C("message-body",i),children:[E>0&&l.jsx("div",{children:c?.(E)}),d?l.jsx("div",{className:"message-body-frame",children:a?l.jsx("div",{className:"w-full max-w-full",children:l.jsx(he,{html:d,variant:"framed",isDark:s,declares:h})}):l.jsx("div",{className:"max-w-full lg:max-w-2xl",children:l.jsx(he,{html:d,variant:f?"plain":"framed",isDark:s,declares:h})})}):e?l.jsx("pre",{className:"email-text whitespace-pre-wrap text-sm leading-relaxed",children:e}):l.jsx(ge,{})]})};function Tr({message:t="Select a thread to read",icon:e,showHints:s=!0,className:r}){return l.jsxs("div",{className:C("flex flex-1 flex-col items-center justify-center text-center",r),children:[e??l.jsx(Ve,{className:"size-10 text-fg-subtle"}),l.jsx("p",{className:"mt-3 text-sm text-fg-muted",children:t}),s&&l.jsxs("p",{className:"text-2xs text-fg-subtle",children:[l.jsx(U,{children:"j"})," / ",l.jsx(U,{children:"k"})," to move, ",l.jsx(U,{children:"Enter"})," to open"]})]})}function Re(t){const e=[];let s=-1,r=!1;for(let n=0;n<t.length;n++){const o=t[n];if(o==='"'){r=!r,s<0&&(s=n);continue}if(!r&&/\s/.test(o)){s>=0&&e.push({raw:t.slice(s,n),start:s,end:n}),s=-1;continue}s<0&&(s=n)}return s>=0&&e.push({raw:t.slice(s),start:s,end:t.length}),e}const Vs=t=>{if(!t.startsWith('"'))return t;const e=t.slice(1);return e.endsWith('"')?e.slice(0,-1):e};function Hs(t){const e=t.indexOf(":");if(e<=0)return;const s=t.slice(e+1);return{name:t.slice(0,e).toLowerCase(),value:Vs(s),rawValue:s}}const Gs=t=>/[\s"]/.test(t),Ws=t=>Gs(t)?`"${t.replace(/"/g,"")}"`:t,Cr=(t,e)=>`${t}:${Ws(e)}`;function Or(){const{mailboxNameIndex:t,accountNameIndex:e}=He(),s=st();return{...tt(s)?{}:{mailboxesByName:t},accountsByName:e}}const Ys=Object.values(ye).map(t=>({value:t,label:Q[t]})),Xs={unclassified:"uncategorized"},qs=[{name:"from",label:"Sender",values:"contact"},{name:"subject",label:"Subject",values:"text"},{name:"category",label:"Category",values:"fixed",options:Ys},{name:"is",label:"State",values:"fixed",options:[{value:"unread",label:"Unread"},{value:"read",label:"Read"},{value:"starred",label:"Starred"}]},{name:"has",label:"Contents",values:"fixed",options:[{value:"attachment",label:"Has attachment"}]},{name:"in",label:"Folder",values:"mailbox"},{name:"account",label:"Account",values:"account"},{name:"after",label:"Sent on or after",values:"date"},{name:"before",label:"Sent before",values:"date"}],Qs=new Map(qs.map(t=>[t.name,t])),Dr=t=>Qs.get(t.toLowerCase()),Zs=/^\d{4}-\d{2}-\d{2}$/;function Js(t,e,s){if(!Zs.test(s))return;const r=Date.parse(`${s}T00:00:00Z`);if(!Number.isNaN(r))return{type:t,raw:e,value:s,epochSeconds:Math.floor(r/1e3)}}function er(t){const e=t.toLowerCase(),s=Xs[e];return s||Object.values(ye).find(n=>n===e)}function tr(t,e){switch(e.toLowerCase()){case"unread":return{type:"isUnread",raw:t};case"read":return{type:"isRead",raw:t};case"starred":case"flagged":return{type:"isStarred",raw:t};default:return}}function sr(t,e){const s=Hs(t);if(!s||s.value.length===0)return;const{name:r,value:n}=s;switch(r){case"from":return{type:"from",raw:t,value:n};case"subject":return{type:"subject",raw:t,value:n};case"category":{const o=er(n);return o?{type:"category",raw:t,value:n,category:o}:void 0}case"is":return tr(t,n);case"has":return n.toLowerCase()==="attachment"?{type:"hasAttachment",raw:t}:void 0;case"before":case"after":return Js(r,t,n);case"in":{const o=e.mailboxesByName?.get(n.toLowerCase());return o?{type:"in",raw:t,value:n,mailboxId:o}:void 0}case"account":{const o=e.accountsByName?.get(n.toLowerCase());return o?{type:"account",raw:t,value:n,accountId:o}:void 0}default:return}}function Ir(t,e={}){const s=[],r=[];for(const n of Re(t)){const o=sr(n.raw,e);o?s.push(o):r.push(n.raw)}return{freeText:r.join(" "),tokens:s}}function jr(t,e){return Re(t).filter(s=>s.raw!==e.raw).map(s=>s.raw).join(" ")}function Pr(t){switch(t.type){case"from":return`From: ${t.value}`;case"subject":return`Subject: ${t.value}`;case"category":return`Category: ${Q[t.category]}`;case"hasAttachment":return"Has attachment";case"isUnread":return"Unread";case"isRead":return"Read";case"isStarred":return"Starred";case"before":return`Before ${t.value}`;case"after":return`After ${t.value}`;case"in":return`In: ${t.value}`;case"account":return`Account: ${t.value}`}}const Be=(t,e=Date.now())=>({value:t,setAt:e}),rr=(t,e,s,r)=>{if(t.addressId!==e)return t;const n={...t.flags??{}};return s?n.trusted=Be(!0,r):delete n.trusted,{...t,flags:n}},nr=(t,e,s,r)=>{const n=o=>o.map(i=>rr(i,e,s,r));return{...t,envelope:{...t.envelope,from:n(t.envelope.from),to:n(t.envelope.to),cc:n(t.envelope.cc),bcc:n(t.envelope.bcc),replyTo:n(t.envelope.replyTo)}}},or=({messageId:t})=>{const e=Ge(),{pushError:s}=We(),{mutate:r,isPending:n,error:o,reset:i}=Ye({...Qe(),onMutate:async u=>{const d=u.path.addressId,f=u.body.flags?.trusted?.value===!0,h=qe({path:{messageId:t}});await e.cancelQueries({queryKey:h});const E=e.getQueriesData({queryKey:h}).filter(y=>y[1]!==void 0).map(([y,k])=>({queryKey:y,data:k}));return e.setQueriesData({queryKey:h},y=>y&&nr(y,d,f)),{describePrefix:h,previous:E}},onError:(u,d,a)=>{if(a)for(const f of a.previous)e.setQueryData(f.queryKey,f.data);s(Xe("Couldn't trust sender","The change wasn't saved.",u))},onSettled:(u,d,a,f)=>{f&&e.invalidateQueries({queryKey:f.describePrefix})}});return{toggleTrusted:(u,d)=>{r({path:{addressId:u},body:{flags:{trusted:Be(!d)}}})},isPending:n,error:o,reset:i}},ir=()=>{const[t,e]=b.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark"));return b.useEffect(()=>{const s=document.documentElement,r=new MutationObserver(()=>{e(s.classList.contains("dark"))});return r.observe(s,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),t},ar=(t,e)=>{const s=`${t} image${t>1?"s":""}`;return e?`${s} hidden — you blocked this sender`:`${s} blocked for privacy`},cr=({blockedImageCount:t,canAlwaysTrust:e,isTrustPending:s,isSenderBlocked:r,onLoadOnce:n,onAlwaysTrust:o})=>l.jsxs("div",{"data-testid":"blocked-images-notice",className:"mb-3 flex items-center justify-between rounded-md bg-surface-sunken/50 px-3 py-2 text-sm",children:[l.jsx("span",{className:"text-fg-muted",children:ar(t,r)}),!r&&l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("button",{type:"button",onClick:n,className:"text-accent hover:underline",children:"Load once"}),e&&l.jsx("button",{type:"button",onClick:o,"aria-busy":s,className:"text-accent hover:underline aria-busy:opacity-50",children:s?"Trusting…":"Always trust"})]})]}),lr=(t,e)=>{switch(t){case"auth":return{title:"Your session expired",detail:"Sign in again to reload the message body. Other parts of the app may also stop responding until you do."};case"body-missing":return{title:"Message body is missing in storage",detail:"A sync failure may have left this message without its body bytes. Contact support, or run the reconcile script to refetch from the upstream IMAP server."};case"content-type-mismatch":return{title:"Couldn't load message body",detail:"The server returned an unexpected content type for this part. The message body has not been rendered to keep you safe."};case"spa-shell-leak":return{title:"Couldn't load message body",detail:"The server returned the app shell instead of the message body. This is an infrastructure bug — please report it."};case"not-ready":return{title:"Message body is still syncing",detail:"This message's body hasn't finished downloading from the mail server yet. It should appear shortly — reopen the message to try again."};default:return{title:"Couldn't load message body",detail:e}}},ur=t=>t instanceof nt?t.reason:"generic",dr=t=>t instanceof Error?t.message:typeof t=="string"?t:"An unexpected error occurred while loading the message body.",fr=({error:t,onRetry:e})=>{const s=ur(t),r=dr(t),{title:n,detail:o}=lr(s,r),[i,c]=b.useState(!1),{Account:u}=Ze();return i?null:l.jsxs("div",{role:"alert","data-testid":"message-body-error-banner","data-reason":s,className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[l.jsx(Je,{className:"size-4 shrink-0 text-danger mt-0.5","aria-hidden":"true"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"font-medium text-danger",children:n}),l.jsx("p",{className:"text-fg-muted mt-1 break-words",children:o})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[s==="auth"&&l.jsx(u,{children:({signOut:d})=>l.jsx("button",{type:"button",onClick:()=>d(),className:"text-sm font-medium text-accent hover:underline",children:"Sign in again"})}),e&&l.jsx("button",{type:"button",onClick:e,className:"text-sm font-medium text-accent hover:underline",children:"Retry"}),l.jsx("button",{type:"button",onClick:()=>c(!0),"aria-label":"Dismiss message body error",className:"rounded-md p-1 text-fg-muted hover:bg-surface-raised hover:text-fg transition-colors",children:l.jsx(et,{className:"size-4","aria-hidden":"true"})})]})]})},hr=()=>l.jsxs("div",{className:"animate-pulse space-y-2",role:"status","aria-label":"Loading message body",children:[l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-11/12"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-5/6"})]}),be=()=>l.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),Lr=({bodyParts:t,html:e,text:s,isTrusted:r=!1,isBlocked:n=!1,messageId:o,fromAddressId:i,category:c,className:u})=>{const[d,a]=b.useState(!1),[f,h]=b.useState(o);f!==o&&(h(o),a(!1));const E=!n&&(r||d),y=ir(),{toggleTrusted:k,isPending:_}=or({messageId:o??""}),w=!!t&&t.length>0,{picked:A,data:T,isLoading:D,isError:p,error:g,refetch:O}=ot({messageId:o,bodyParts:t,enabled:w}),L=b.useMemo(()=>xs(t??[]),[t]),N=w&&T?.kind==="html"?T.body:e,$e=w&&T?.kind==="text"?T.body:s;if(w){if(D)return l.jsx("div",{className:C("message-body",u),children:l.jsx(hr,{})});if(p)return l.jsx("div",{className:C("message-body",u),children:l.jsx(fr,{error:g,onRetry:()=>O()})});if(!A)return l.jsx("div",{className:C("message-body",u),children:l.jsx(be,{})})}else if(!e&&!s)return l.jsx("div",{className:C("message-body",u),children:l.jsx(be,{})});const Ke=!!(i&&o),ze=()=>{!i||_||(a(!0),k(i,!1))};return l.jsx(Fs,{className:u,html:N,text:$e,isDark:y,category:c,allowImages:E,resolveCid:L,renderBlockedNotice:Ue=>l.jsx(cr,{blockedImageCount:Ue,canAlwaysTrust:Ke,isTrustPending:_,isSenderBlocked:n,onLoadOnce:()=>a(!0),onAlwaysTrust:ze})})};export{kr as A,wr as C,Ar as M,Tr as R,De as S,ss as a,V as b,Er as c,Q as d,it as e,Fs as f,_r as g,Sr as h,rs as i,at as j,or as k,Lr as l,q as m,Re as n,Hs as o,Ir as p,qs as q,Cr as r,Dr as s,Pr as t,Or as u,jr as v,xr as w};