@remit/web-client-dist 0.0.685 → 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 (186) hide show
  1. package/assets/{BriefPane-BfKwBxLe.js → BriefPane-DbPnsOco.js} +1 -1
  2. package/assets/{CalendarEventEditor-Bsugk6rT.js → CalendarEventEditor-CGrl9NkK.js} +1 -1
  3. package/assets/{CalendarEventPopup-C-BVvxfV.js → CalendarEventPopup-DSoQ-1wk.js} +1 -1
  4. package/assets/{CalendarLoadFailed-DcrF_lyr.js → CalendarLoadFailed-ClpqypbH.js} +1 -1
  5. package/assets/{CalendarQuickCreate-_ki0X3rq.js → CalendarQuickCreate-CaYUiVR8.js} +1 -1
  6. package/assets/{CalendarSession-CK-EC1yK.js → CalendarSession-Ql7K56YK.js} +1 -1
  7. package/assets/{DesktopChrome-BfOVbUXt.js → DesktopChrome-e0x9SkC0.js} +1 -1
  8. package/assets/{DropdownMenu-B4qvRStt.js → DropdownMenu-DusMkzz6.js} +1 -1
  9. package/assets/{EmptyState-BYR2eIr2.js → EmptyState-BjhPv2hS.js} +1 -1
  10. package/assets/{ErrorState-BXxvOnci.js → ErrorState-nIG-x-Zh.js} +1 -1
  11. package/assets/FlaggedPane-CcaZOeS-.js +1 -0
  12. package/assets/{FullCompose-DEhDpjci.js → FullCompose-D5JLo7Rb.js} +1 -1
  13. package/assets/{LabelApplyTrigger-C4ode0Y9.js → LabelApplyTrigger-CUfdoyOX.js} +1 -1
  14. package/assets/{MailShell-DvQDMygz.js → MailShell-DIZSKkXP.js} +1 -1
  15. package/assets/{MailViewChrome-D66Dcy3c.js → MailViewChrome-B22GO2ZU.js} +1 -1
  16. package/assets/MailboxPane-ikbl6KSS.js +135 -0
  17. package/assets/{MessageBody-CDTfM1lc.js → MessageBody-DbkrLz4x.js} +1 -1
  18. package/assets/{MessageToolbar-BW852rJj.js → MessageToolbar-D-FLeer4.js} +1 -1
  19. package/assets/{NavMenuButton-BZWw6TBA.js → NavMenuButton-C78wt6tT.js} +1 -1
  20. package/assets/{OnboardingWizard-Bppp1CPR.js → OnboardingWizard-B7BpPMJF.js} +1 -1
  21. package/assets/{OutboxPane-B_ihIEGn.js → OutboxPane-Ch6JqV2D.js} +1 -1
  22. package/assets/{ReportLink-CwxUgr_7.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-D9HVYRDd.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-DCmCYHjG.js → _view._date-BhRGXGQG.js} +1 -1
  35. package/assets/{account-service-status-D-hGpg9e.js → account-service-status-2nmShluv.js} +1 -1
  36. package/assets/{accounts-BcJ04H8d.js → accounts-B_pt4l15.js} +1 -1
  37. package/assets/{advanced-DnA-3VCS.js → advanced-DzS_Bhbq.js} +1 -1
  38. package/assets/{agenda-time-O7rJVIvd.js → agenda-time-Bt4BEp3g.js} +1 -1
  39. package/assets/{app-chrome-DvUymvcE.js → app-chrome-CbZgCDW_.js} +1 -1
  40. package/assets/{appearance-CypE55tV.js → appearance-D6Q4ETnm.js} +1 -1
  41. package/assets/{avatar-BgqBWztU.js → avatar-CQq2GZz9.js} +1 -1
  42. package/assets/{badge-CfQoDkmE.js → badge-BVw5vgFN.js} +1 -1
  43. package/assets/{bottom-sheet-Dhk1Aqz2.js → bottom-sheet-C81CIc2R.js} +1 -1
  44. package/assets/{brief-DgC2R0u5.js → brief-CGFThfPb.js} +1 -1
  45. package/assets/brief-CGmiPbD7.js +1 -0
  46. package/assets/{calendar-Ix1rbLDg.js → calendar-Ddji3ram.js} +1 -1
  47. package/assets/{calendar-BJu4Vl-g.js → calendar-SMIdRsx9.js} +1 -1
  48. package/assets/{calendar-event-popup-B4-Dpgb6.js → calendar-event-popup-DqvJLPWt.js} +1 -1
  49. package/assets/{calendar-event-sidebar-DZum-8WN.js → calendar-event-sidebar-CGPuc517.js} +1 -1
  50. package/assets/{calendar-failure-note-DK-uzvky.js → calendar-failure-note-4qETx8lD.js} +1 -1
  51. package/assets/{calendar-guests-Diti9JO5.js → calendar-guests-Dt2cjTqc.js} +1 -1
  52. package/assets/{calendar-suggestion-C8kx9fKn.js → calendar-suggestion-BZ4IIHBe.js} +1 -1
  53. package/assets/{calendars-ne1Oj2RW.js → calendars-U4lDveGO.js} +1 -1
  54. package/assets/{card-B-YLocTg.js → card-kzE1rw9u.js} +1 -1
  55. package/assets/{checkbox-DL0pObJW.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-OUBTwy71.js → circle-check-CBDdVMl8.js} +1 -1
  59. package/assets/{circle-check-big-Czqmzl9y.js → circle-check-big-DlhpMe5P.js} +1 -1
  60. package/assets/{circle-help-DJ-Mtycd.js → circle-help-CP1s-Yi3.js} +1 -1
  61. package/assets/{classification-DLUltDdR.js → classification-DF13x4GV.js} +1 -1
  62. package/assets/{clock-Bw2dEIoB.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-B6tjROvg.js → config-import-BRacJ1y6.js} +1 -1
  68. package/assets/{confirm-dialog-sa45Xnmn.js → confirm-dialog-B0MVMPmn.js} +1 -1
  69. package/assets/{copy-9W6V4dQI.js → copy-DMRh3Rb2.js} +1 -1
  70. package/assets/{credential-steps-P9fRg1pE.js → credential-steps-4YQ5eJjl.js} +1 -1
  71. package/assets/{download-O3cdl6IV.js → download-WnSzcn6T.js} +1 -1
  72. package/assets/{draft-QkjvtbSZ.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-BYIIFw9_.js → external-link-B_11YPnQ.js} +1 -1
  76. package/assets/{file-json-vVOzTp-u.js → file-json-D4Uv97RH.js} +1 -1
  77. package/assets/{filters-DohRSViK.js → filters-BWFo6zj7.js} +1 -1
  78. package/assets/flagged-BQl5KVuF.js +1 -0
  79. package/assets/{flagged-BHlMmpp_.js → flagged-C_307aIb.js} +1 -1
  80. package/assets/{folder-input-hVRteCio.js → folder-input-DjY4GpKG.js} +1 -1
  81. package/assets/{folders-BFfd-sur.js → folders-D7JFBgPP.js} +1 -1
  82. package/assets/{help-copy-_K3IfQdg.js → help-copy-bU0rZqtx.js} +1 -1
  83. package/assets/{import-ByOg30ul.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-Bn8n_AsE.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-k6LzEquX.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-PiHV4odS.js → kbd-5V1_yqOW.js} +1 -1
  97. package/assets/{label-chip-BnNtXrWd.js → label-chip-BBPaslky.js} +1 -1
  98. package/assets/{labels-BQe-BkCj.js → labels-xO9yj2bw.js} +1 -1
  99. package/assets/{mail-CPplAOgE.js → mail-CRvRtCed.js} +1 -1
  100. package/assets/{mail-BFIBAL7w.js → mail-DcTEJ5uO.js} +1 -1
  101. package/assets/{menu-znX-3dzE.js → menu-DXmZUEBa.js} +1 -1
  102. package/assets/{nav-link-CtuHya9S.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-CKAiaYkS.js → onboarding-completion-CK2mHfmP.js} +1 -1
  106. package/assets/outbox-DgFmUFU6.js +1 -0
  107. package/assets/{pencil-DA21sF5f.js → pencil-Py3MXttE.js} +1 -1
  108. package/assets/{people-BQjKSotc.js → people-CxpFEQpi.js} +1 -1
  109. package/assets/{plus-6ss9YFRF.js → plus-5sFyaPZh.js} +1 -1
  110. package/assets/{popover-menu-iCbmrU-E.js → popover-menu-uIVgxYG_.js} +1 -1
  111. package/assets/{refresh-cw-CUyjBEl4.js → refresh-cw-Dar0XAdp.js} +1 -1
  112. package/assets/{reply-DmpF7cgR.js → reply-D8bLYzum.js} +1 -1
  113. package/assets/{rich-text-Cppy56p_.js → rich-text-B2jeK_lt.js} +1 -1
  114. package/assets/{rich-text-spellcheck-worker-provider-Bk2_kAe9.js → rich-text-spellcheck-worker-provider-D1J3yZU8.js} +1 -1
  115. package/assets/{rotate-ccw-Dtkxt0CH.js → rotate-ccw-CSByuoeY.js} +1 -1
  116. package/assets/{roving-focus-CzX6YmR4.js → roving-focus-1m_wY9_4.js} +1 -1
  117. package/assets/{row-actions-Cn7bQ_Ks.js → row-actions-CB2wYT6g.js} +1 -1
  118. package/assets/{search-mirror-BSzHMUcd.js → search-mirror-CFL35Bis.js} +1 -1
  119. package/assets/{search-scope-Cl87snrn.js → search-scope-BR87UqJt.js} +1 -1
  120. package/assets/{search-token-index-BSaB7qLo.js → search-token-index-CoqsoQJZ.js} +1 -1
  121. package/assets/{sections-DwdsQ0ad.js → sections-B9pteMHc.js} +1 -1
  122. package/assets/{segmented-control-68-bWTGV.js → segmented-control-CVMDr-Je.js} +1 -1
  123. package/assets/{select-Cc2Vc4qL.js → select-DXHN14lo.js} +1 -1
  124. package/assets/{senders-DwOfiVHu.js → senders-CXpJyu9L.js} +1 -1
  125. package/assets/settings-B2MbfPot.js +1 -0
  126. package/assets/{settings-screen-IjQOks0s.js → settings-screen-C8kBB2kR.js} +1 -1
  127. package/assets/{shield-check-jkVgxi6o.js → shield-check-Fest6_gL.js} +1 -1
  128. package/assets/{suggest-list-FaY4DThZ.js → suggest-list-CUEgGZt_.js} +1 -1
  129. package/assets/{suggested-vips-BLlvjvH5.js → suggested-vips-CiTGLmJd.js} +1 -1
  130. package/assets/{suggestion._suggestionId-CL7hLrk-.js → suggestion._suggestionId-BMRKFgLt.js} +1 -1
  131. package/assets/{switch-a7x-CFTd.js → switch-xqSp-gFV.js} +1 -1
  132. package/assets/{task._calendarTaskId-CkPsJj-a.js → task._calendarTaskId-AbdgpKo5.js} +1 -1
  133. package/assets/{undo-2-CnxBm8gd.js → undo-2-IdsgUvVv.js} +1 -1
  134. package/assets/{useCalendarData-RUYA8D_t.js → useCalendarData-BKkQY_vQ.js} +1 -1
  135. package/assets/{useCalendarScheduling-CO3VOpcB.js → useCalendarScheduling-D_qd-mRK.js} +1 -1
  136. package/assets/{useCalendarSuggestions-Bb4PGHae.js → useCalendarSuggestions-D58tKJtx.js} +1 -1
  137. package/assets/{useCalendarTasks-RmI_Ij1j.js → useCalendarTasks-DLNYnUeu.js} +1 -1
  138. package/assets/{useDebouncedValue-I0sDLoIF.js → useDebouncedValue-CMBraotV.js} +1 -1
  139. package/assets/{useFilters-DT8SxgF4.js → useFilters-28pRmQGT.js} +1 -1
  140. package/assets/{useLabels-DO4UWjpG.js → useLabels-CGCEGKuz.js} +1 -1
  141. package/assets/{useLayoutTier-Cn3SwiV2.js → useLayoutTier-CnmLTkLg.js} +1 -1
  142. package/assets/{useMediaQuery-C00TiD5k.js → useMediaQuery-D3m_n689.js} +1 -1
  143. package/assets/{useMessageBodyContent-lqVkO1fM.js → useMessageBodyContent-dd-lowbx.js} +1 -1
  144. package/assets/{useQueries-Bs7-L_2j.js → useQueries-B-X1sW9_.js} +1 -1
  145. package/assets/{useRefreshControl-Bt-oDRnY.js → useRefreshControl-DbHCcSXX.js} +1 -1
  146. package/assets/{useResultFolderIndex-CALTzfWS.js → useResultFolderIndex-BvBtm4F3.js} +1 -1
  147. package/assets/{useSignature-DRFIcifS.js → useSignature-CQZ_Ke3T.js} +1 -1
  148. package/assets/{warnings-ClaUoDQx.js → warnings-bjC-sL2O.js} +1 -1
  149. package/index.html +1 -1
  150. package/package.json +1 -1
  151. package/assets/FlaggedPane-F0FM2UJN.js +0 -1
  152. package/assets/MailboxPane-BDYnlpr2.js +0 -135
  153. package/assets/_calendarObjectId-CSwodc6y.js +0 -1
  154. package/assets/_mailboxId-BlTWUSb1.js +0 -1
  155. package/assets/_messageId-BaqNxGqi.js +0 -1
  156. package/assets/_messageId-DNtVsPPW.js +0 -1
  157. package/assets/_messageId-ciVFKEzn.js +0 -1
  158. package/assets/_outboxMessageId-LLqtF8cH.js +0 -1
  159. package/assets/_recurrenceId-G4qPwsrp.js +0 -1
  160. package/assets/_threadId-BAVZ7S8M.js +0 -1
  161. package/assets/_threadId-DL34NZT4.js +0 -1
  162. package/assets/_threadId-qmAQ7RKu.js +0 -1
  163. package/assets/brief-DcbZ7jHO.js +0 -1
  164. package/assets/chevron-down-BWbeCM3N.js +0 -1
  165. package/assets/chevron-left-CliOUq1O.js +0 -1
  166. package/assets/compose._-_outboxMessageId_-CAx_e1OV.js +0 -1
  167. package/assets/compose._-_outboxMessageId_-CnWaV_IX.js +0 -1
  168. package/assets/compose._-_outboxMessageId_-Dmj8hyvT.js +0 -1
  169. package/assets/compose._-_outboxMessageId_-z980Xa6X.js +0 -1
  170. package/assets/edit-B31QMGS3.js +0 -1
  171. package/assets/edit-DjkZZFBG.js +0 -1
  172. package/assets/flagged-DIi4rqg8.js +0 -1
  173. package/assets/index-BIhlBhBD.js +0 -1
  174. package/assets/index-BaqNxGqi.js +0 -1
  175. package/assets/index-C53Z5hF_.js +0 -1
  176. package/assets/index-CRnDeQMw.js +0 -1
  177. package/assets/index-CzbtDE1H.js +0 -1
  178. package/assets/index-DNtVsPPW.js +0 -1
  179. package/assets/index-DR2Joq7n.js +0 -1
  180. package/assets/index-DbyBl7Lq.js +0 -1
  181. package/assets/index-cVALleyU.js +0 -1
  182. package/assets/index-ciVFKEzn.js +0 -1
  183. package/assets/new-psckzAFd.js +0 -1
  184. package/assets/onboarding-B_l5ow67.js +0 -1
  185. package/assets/outbox-BTiQbMrW.js +0 -1
  186. package/assets/settings-BdeAbD2h.js +0 -1
@@ -1 +1 @@
1
- import{b as G,r as l,j as d,p as y,X as R,bU as Q,cj as D,cx as J,cy as X,cz as Y,cA as W,G as k,u as j,R as Z,U as M,W as ee,Y as te,J as ne,cB as E}from"./index-Bn8n_AsE.js";import{e as I,f as re}from"./reply-DmpF7cgR.js";import{c as se}from"./nav-link-CtuHya9S.js";import{s as oe,S as ae}from"./search-scope-Cl87snrn.js";import{u as K}from"./useQueries-Bs7-L_2j.js";const Se=G("BellOff",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]),ie=[{action:"focusNext",keys:["j","k"],label:"navigate"},{action:"muteSender",keys:["m"],label:"mute"},{action:"help",keys:["?"],label:"all shortcuts"}];function ve(e){return ie.filter(t=>e[t.action]!==void 0)}const ce=[{title:"Navigation",hints:[{action:"focusNext",keys:["j"],description:"Focus the message below"},{action:"focusPrevious",keys:["k"],description:"Focus the message above"},{action:"focusNext",keys:["↓"],description:"Focus the message below"},{action:"focusPrevious",keys:["↑"],description:"Focus the message above"},{action:"focusFirst",keys:["Home"],description:"Focus first"},{action:"focusLast",keys:["End"],description:"Focus last"},{action:"openFocused",keys:["Enter"],description:"Open focused thread"},{action:"back",keys:["Esc"],description:"Back / close overlay"}]},{title:"Selection",hints:[{action:"toggleSelect",keys:["x"],description:"Toggle select"},{action:"toggleSelect",keys:["Space"],description:"Toggle select"},{action:"extendSelectDown",keys:["Shift","j"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","k"],description:"Extend selection up"},{action:"extendSelectDown",keys:["Shift","↓"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","↑"],description:"Extend selection up"},{action:"selectAll",keys:["⌘","A"],description:"Select all"}]},{title:"Actions",hints:[{action:"reply",keys:["r"],description:"Reply"},{action:"replyAll",keys:["a"],description:"Reply all"},{action:"forward",keys:["f"],description:"Forward"},{action:"delete",keys:["#"],description:"Delete"},{action:"toggleStar",keys:["s"],description:"Star / unstar"},{action:"toggleRead",keys:["u"],description:"Toggle read / unread"}]},{title:"Sender",hints:[{action:"muteSender",keys:["m"],description:"Mute sender"},{action:"blockSender",keys:["b"],description:"Block sender"},{action:"vipSender",keys:["v"],description:"VIP sender"},{action:"markJunk",keys:["!"],description:"Mark junk"}]},{title:"Go to",hints:[{action:"goBrief",keys:["g","b"],description:"Daily brief"},{action:"goInbox",keys:["g","i"],description:"Inbox"},{action:"goSent",keys:["g","s"],description:"Sent"},{action:"goFlagged",keys:["g","f"],description:"Starred"},{action:"goSettings",keys:["g",","],description:"Settings"}]},{title:"View & global",hints:[{action:"toggleIntelligence",keys:["i"],description:"Toggle intelligence"},{action:"toggleDensity",keys:["d"],description:"Toggle density"},{action:"focusSearch",keys:["/"],description:"Focus search"},{action:"compose",keys:["c"],description:"Compose"},{action:"compose",keys:["⌘","N"],description:"Compose"},{action:"help",keys:["?"],description:"Shortcut help"}]}];function le(e){for(const t of ce){const n=t.hints.find(r=>r.action===e);if(n)return n.keys}}function ue(e){const t=le(e);return!t||t.length===0?"":t.length===1?t[0]??"":t[0]==="g"?t.join(" then "):t.join("")}function Te(e){const t=ue(e);return t===""?"":`(${t})`}function de({key:e,shiftKey:t=!1,repeat:n=!1,caretAtStart:r,hasValue:i,chipCount:s}){const a=s-1;return e==="Escape"?i?{type:"clearQuery"}:{type:"blur"}:e==="Tab"&&t?s===0?{type:"none"}:{type:"focusChip",index:a}:e==="Backspace"||e==="ArrowLeft"?!r||s===0?{type:"none"}:n?{type:"none"}:{type:"focusChip",index:a}:{type:"none"}}function fe({key:e,repeat:t=!1,index:n,chipCount:r}){return e==="Backspace"||e==="Delete"?t?{type:"none"}:{type:"removeChip",index:n}:e==="ArrowLeft"?n===0?{type:"none"}:{type:"focusChip",index:n-1}:e==="ArrowRight"?n>=r-1?{type:"focusInput"}:{type:"focusChip",index:n+1}:e==="Enter"||e===" "?{type:"activateChip",index:n}:e==="Escape"?{type:"focusInput"}:{type:"none"}}function pe(e,t){const n=t-1;return n<=0?null:e<n?e:n-1}const q={filter:"border-line bg-surface-sunken text-fg-muted",scope:"border-accent-2/40 bg-accent-2-soft text-accent-2"},me=({label:e,onRemove:t,tone:n="filter",className:r})=>d.jsxs("span",{className:y("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-2xs",q[n],r),children:[d.jsx("span",{children:e}),d.jsx("button",{type:"button",onClick:t,className:"shrink-0 rounded-full p-0.5 hover:bg-fg-muted/20 transition-colors","aria-label":`Remove filter: ${e}`,children:d.jsx(R,{className:"size-3"})})]}),B=l.forwardRef(({label:e,onRemove:t,onActivate:n,tone:r="filter",focused:i=!1,onKeyDown:s,onFocusLabel:a,className:u},f)=>d.jsxs("span",{role:"row",tabIndex:-1,className:y("inline-flex max-w-48 items-center gap-1 rounded-full border px-2 py-0.5 text-2xs transition-colors",q[r],i&&"ring-2 ring-ring",u),children:[d.jsx("button",{ref:f,type:"button",role:"gridcell",tabIndex:i?0:-1,onClick:n,onFocus:a,onKeyDown:s,className:y("block min-w-0 max-w-full truncate rounded-full outline-none",n?"cursor-pointer":"cursor-default"),children:e}),d.jsx("button",{type:"button",role:"gridcell",tabIndex:-1,onClick:t,className:"block shrink-0 rounded-full p-0.5 transition-colors hover:bg-fg-muted/20","aria-label":`Remove filter: ${e}`,children:d.jsx(R,{className:"size-3"})})]}));B.displayName="SearchChipRow";const Ne=({tokens:e,className:t})=>e.length===0?null:d.jsx("div",{className:y("flex flex-wrap items-center gap-1.5 border-b border-line bg-surface px-row-inset py-1.5",t),children:e.map(n=>d.jsx(me,{label:n.label,onRemove:n.onRemove},n.label))}),he=e=>e instanceof HTMLElement?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable:!1,ge=({chips:e=[],onRemoveChip:t,value:n,onChange:r,onClear:i,onClearQuery:s,placeholder:a="Search mail...",globalFocusKey:u=!0,showClearButton:f=!0,size:h="sm",inputId:p,suggest:m,className:x})=>{const O=l.useId(),F=p??O,w=l.useRef(null),$=l.useRef([]),A=s??i,[P,C]=l.useState(null),v=l.useRef(void 0),[H,U]=l.useState(""),T=e.length>0;l.useEffect(()=>{C(o=>o!==null&&o>=e.length?null:o)},[e.length]),l.useEffect(()=>{const o=v.current;if(o!==void 0){if(v.current=void 0,o===null){w.current?.focus();return}$.current[o]?.focus()}});const L=l.useRef(void 0);l.useEffect(()=>{const o=m?.caret;if(!o||o===L.current)return;L.current=o;const c=w.current;!c||c.ownerDocument.activeElement!==c||(c.setSelectionRange(o.cursor,o.cursor),m?.onCaretChange(o.cursor))});const S=o=>{m?.onCaretChange(o.selectionStart??o.value.length)},g=l.useCallback(o=>{C(o),v.current=o},[]),N=l.useCallback(o=>{const c=e[o];c&&t&&(g(pe(o,e.length)),U(`${c.label} removed`),t(c.id))},[e,t,g]),V=l.useCallback(()=>{g(null),i()},[i,g]),z=l.useCallback(o=>{const c=o.currentTarget;if(m?.onKeyDown(o))return;const b=de({key:o.key,shiftKey:o.shiftKey,repeat:o.repeat,caretAtStart:c.selectionStart===0&&c.selectionEnd===0,hasValue:n.length>0,chipCount:e.length});switch(b.type){case"focusChip":o.preventDefault(),g(b.index);return;case"clearQuery":A();return;case"blur":c.blur();return;case"none":return}},[e.length,n,A,g,m]),_=l.useCallback(o=>c=>{const b=fe({key:c.key,repeat:c.repeat,index:o,chipCount:e.length});switch(b.type!=="none"&&c.preventDefault(),b.type){case"removeChip":N(b.index);return;case"focusChip":g(b.index);return;case"focusInput":g(null);return;case"activateChip":return;case"none":return}},[e,N,g]);return l.useEffect(()=>{if(!u)return;const o=c=>{c.key!=="/"||c.metaKey||c.ctrlKey||c.altKey||he(c.target)||D("focusSearch")||(c.preventDefault(),w.current?.focus())};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[u]),d.jsxs("label",{htmlFor:F,className:y("flex w-full items-center gap-1.5 text-sm","bg-surface-sunken/50 border border-transparent","focus-within:bg-canvas focus-within:border-line focus-within:ring-2 focus-within:ring-ring","transition-colors",h==="lg"?"rounded-xl px-4 py-2":"rounded-md px-2.5 py-1",x),children:[d.jsx(Q,{className:y("shrink-0 text-fg-muted pointer-events-none",h==="lg"?"size-5":"size-4")}),d.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:[T&&d.jsx("div",{role:"grid","aria-label":"Search filters",className:"flex min-w-0 flex-wrap items-center gap-1",children:e.map((o,c)=>d.jsx(B,{ref:b=>{$.current[c]=b},label:o.label,tone:o.tone,focused:P===c,onFocusLabel:()=>C(c),onKeyDown:_(c),onRemove:()=>N(c)},o.id))}),d.jsx("input",{ref:w,id:F,name:"q",type:"text","aria-label":"Search mail",autoComplete:"off",value:n,tabIndex:P===null?0:-1,onChange:o=>{r(o.target.value),S(o.target)},onKeyDown:z,onKeyUp:o=>S(o.currentTarget),onClick:o=>S(o.currentTarget),onFocus:o=>{C(null),m?.onFocusChange?.(!0),S(o.currentTarget)},onBlur:()=>m?.onFocusChange?.(!1),...m?.comboboxProps,placeholder:T?void 0:a,className:"min-w-24 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-muted"})]}),(n||T)&&f&&d.jsx("button",{type:"button",onClick:V,className:"shrink-0 rounded p-0.5 hover:bg-surface-raised transition-colors","aria-label":"Clear search",children:d.jsx(R,{className:y("text-fg-muted",h==="lg"?"size-5":"size-4")})}),d.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:H})]})},Ee=({value:e,onChange:t,onClear:n,onClearQuery:r,chips:i,onRemoveChip:s,placeholder:a="Search mail...",globalFocusKey:u=!0,showClearButton:f=!0,size:h,inputId:p,suggest:m,className:x})=>d.jsx(ge,{value:e,onChange:t,onClear:n,onClearQuery:r,chips:i,onRemoveChip:s,placeholder:a,globalFocusKey:u,showClearButton:f,size:h,inputId:p,suggest:m,className:x});function Re({handlers:e,enabled:t=!0,target:n,sequenceTimeoutMs:r=1e3}){const i=l.useRef(e);i.current=e;const s=l.useRef(null),a=l.useRef(null);l.useEffect(()=>{if(!t)return;const u=()=>{a.current!==null&&(clearTimeout(a.current),a.current=null)},f=p=>{const m=J({key:p.key,shiftKey:p.shiftKey,metaKey:p.metaKey,ctrlKey:p.ctrlKey,altKey:p.altKey,inEditable:Y(p.target),onControl:X(p.target)},s.current);if(W().length>0){u(),s.current=null;return}if(u(),s.current=m.nextPrefix,m.nextPrefix!==null&&(a.current=setTimeout(()=>{s.current=null,a.current=null},r)),m.action===null||D(m.action)!==null)return;const x=i.current[m.action];x&&(m.preventDefault&&p.preventDefault(),x())},h=n===void 0?window:n;if(h!==null)return h.addEventListener("keydown",f),()=>{h.removeEventListener("keydown",f),u(),s.current=null}},[t,r,n])}function je(){const e=k({from:"/mail/brief/$threadId",shouldThrow:!1}),t=k({from:"/mail/brief/$threadId/$messageId",shouldThrow:!1}),n=k({from:"/mail/flagged/$threadId",shouldThrow:!1}),r=k({from:"/mail/flagged/$threadId/$messageId",shouldThrow:!1}),i=k({from:"/mail/$mailboxId/$threadId",shouldThrow:!1}),s=k({from:"/mail/$mailboxId/$threadId/$messageId",shouldThrow:!1}),a=e?.threadId??n?.threadId??i?.threadId,u=t?.messageId??r?.messageId??s?.messageId;return l.useMemo(()=>a?{threadId:a,messageId:u}:void 0,[a,u])}function Me(){const e=j(),t=se(),{list:n,mailboxId:r}=I();return l.useCallback((i,s)=>{const a=s?.query,f={search:p=>a===void 0?p:{...p,q:a||void 0},hash:t,replace:s?.replace??!1};if(n==="flagged"){e({to:"/mail/flagged/$threadId/$messageId",params:i,...f});return}const h=s?.mailboxId??r;if(n==="mailbox"&&h){e({to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:h,...i},...f});return}e({to:"/mail/brief/$threadId/$messageId",params:i,...f})},[e,t,n,r])}function Ke(){return re()}function be(){const e=j();return l.useCallback(t=>{e({to:"/mail/brief",search:{q:t||void 0}})},[e])}function Fe(){const e=j();return l.useCallback((t,n)=>{e({to:"/mail/$mailboxId",params:{mailboxId:t},search:{q:n||void 0}})},[e])}const ye=({accounts:e})=>{const{list:t,mailboxId:n}=I(),{t:r}=Z("mail",{useSuspense:!1}),i=l.useCallback((a,u)=>r(a,{defaultValue:u}),[r]),s=K({queries:e.map(a=>({...M({path:{accountId:a.accountId}}),staleTime:1/0}))});if(t==="outbox")return"Outbox";if(!n)return null;for(let a=0;a<e.length;a++){const u=s[a]?.data?.items;if(!u)continue;const f=u.find(p=>p.mailboxId===n);if(!f)continue;const h=ee(e[a].folderAppointments);return te(f,h.get(n),i)}return null},$e=({accounts:e})=>{const{mailboxId:t}=I(),n=K({queries:e.map(r=>({...M({path:{accountId:r.accountId}}),staleTime:1/0}))});if(!t)return null;for(const r of n){const i=r.data?.items;if(!i)continue;const s=i.find(a=>a.mailboxId===t);if(s)return s.unseenCount}return null},Ae=({accounts:e})=>{const{mailboxId:t}=I(),n=K({queries:e.map(r=>({...M({path:{accountId:r.accountId}}),staleTime:1/0}))});if(!t)return 0;for(const r of n){const i=r.data?.items;if(!i)continue;const s=i.find(a=>a.mailboxId===t);if(s)return s.messageCount}return 0};function Pe(e){const t=be(),{searchInput:n}=ne(),r=ye({accounts:e}),i=I(),s=l.useMemo(()=>oe(i,r),[i,r]),a=l.useCallback(u=>{u===ae&&t(n)},[t,n]);return{scope:s,clearScope:a}}function Le(e){const t=new Map;for(const n of e){const r=n.email.toLowerCase(),i=r.split("@")[0];i&&!t.has(i)&&t.set(i,n.accountId),t.has(r)||t.set(r,n.accountId)}return t}function De(e){const t=new Map;for(const n of e)for(const r of n){const i=r.fullPath?.toLowerCase();if(!i)continue;const s=E(r).toLowerCase();t.has(i)||t.set(i,r.mailboxId),t.has(s)||t.set(s,r.mailboxId)}return t}function qe(e,t=[]){const n=e.flat().filter(s=>s.fullPath),r=new Map;for(const s of n){const a=E(s).toLowerCase();r.set(a,(r.get(a)??0)+1)}const i=new Map(t.map(s=>[s.accountId,s.email]));return n.map(s=>{const a=E(s),u=r.get(a.toLowerCase())===1,f=t.length>1?i.get(s.accountId):void 0;return{value:u?a:s.fullPath,label:s.displayNameOverride?.trim()||a,...f?{hint:f}:{}}})}function Be(e){const t=new Map;for(const n of e){const r=n.email.toLowerCase().split("@")[0]??"";t.set(r,(t.get(r)??0)+1)}return e.map(n=>{const r=n.email.split("@")[0]??n.email,i=t.get(r.toLowerCase())===1,s=n.displayName?.trim();return{value:i?r:n.email,label:s||n.email,...s?{hint:n.email}:{}}})}export{Se as B,ce as K,Ee as S,je as a,De as b,Re as c,Le as d,Me as e,Ke as f,ye as g,$e as h,Ae as i,ie as j,ve as k,Ne as l,qe as m,Be as n,Fe as o,ue as s,Te as t,Pe as u};
1
+ import{b as G,r as l,j as d,p as y,X as R,bU as Q,cj as D,cx as J,cy as X,cz as Y,cA as W,G as k,u as j,R as Z,U as M,W as ee,Y as te,J as ne,cB as E}from"./index-BZ4sAts4.js";import{e as I,f as re}from"./reply-D8bLYzum.js";import{c as se}from"./nav-link-BvBkmH1H.js";import{s as oe,S as ae}from"./search-scope-BR87UqJt.js";import{u as K}from"./useQueries-B-X1sW9_.js";const Se=G("BellOff",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]),ie=[{action:"focusNext",keys:["j","k"],label:"navigate"},{action:"muteSender",keys:["m"],label:"mute"},{action:"help",keys:["?"],label:"all shortcuts"}];function ve(e){return ie.filter(t=>e[t.action]!==void 0)}const ce=[{title:"Navigation",hints:[{action:"focusNext",keys:["j"],description:"Focus the message below"},{action:"focusPrevious",keys:["k"],description:"Focus the message above"},{action:"focusNext",keys:["↓"],description:"Focus the message below"},{action:"focusPrevious",keys:["↑"],description:"Focus the message above"},{action:"focusFirst",keys:["Home"],description:"Focus first"},{action:"focusLast",keys:["End"],description:"Focus last"},{action:"openFocused",keys:["Enter"],description:"Open focused thread"},{action:"back",keys:["Esc"],description:"Back / close overlay"}]},{title:"Selection",hints:[{action:"toggleSelect",keys:["x"],description:"Toggle select"},{action:"toggleSelect",keys:["Space"],description:"Toggle select"},{action:"extendSelectDown",keys:["Shift","j"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","k"],description:"Extend selection up"},{action:"extendSelectDown",keys:["Shift","↓"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","↑"],description:"Extend selection up"},{action:"selectAll",keys:["⌘","A"],description:"Select all"}]},{title:"Actions",hints:[{action:"reply",keys:["r"],description:"Reply"},{action:"replyAll",keys:["a"],description:"Reply all"},{action:"forward",keys:["f"],description:"Forward"},{action:"delete",keys:["#"],description:"Delete"},{action:"toggleStar",keys:["s"],description:"Star / unstar"},{action:"toggleRead",keys:["u"],description:"Toggle read / unread"}]},{title:"Sender",hints:[{action:"muteSender",keys:["m"],description:"Mute sender"},{action:"blockSender",keys:["b"],description:"Block sender"},{action:"vipSender",keys:["v"],description:"VIP sender"},{action:"markJunk",keys:["!"],description:"Mark junk"}]},{title:"Go to",hints:[{action:"goBrief",keys:["g","b"],description:"Daily brief"},{action:"goInbox",keys:["g","i"],description:"Inbox"},{action:"goSent",keys:["g","s"],description:"Sent"},{action:"goFlagged",keys:["g","f"],description:"Starred"},{action:"goSettings",keys:["g",","],description:"Settings"}]},{title:"View & global",hints:[{action:"toggleIntelligence",keys:["i"],description:"Toggle intelligence"},{action:"toggleDensity",keys:["d"],description:"Toggle density"},{action:"focusSearch",keys:["/"],description:"Focus search"},{action:"compose",keys:["c"],description:"Compose"},{action:"compose",keys:["⌘","N"],description:"Compose"},{action:"help",keys:["?"],description:"Shortcut help"}]}];function le(e){for(const t of ce){const n=t.hints.find(r=>r.action===e);if(n)return n.keys}}function ue(e){const t=le(e);return!t||t.length===0?"":t.length===1?t[0]??"":t[0]==="g"?t.join(" then "):t.join("")}function Te(e){const t=ue(e);return t===""?"":`(${t})`}function de({key:e,shiftKey:t=!1,repeat:n=!1,caretAtStart:r,hasValue:i,chipCount:s}){const a=s-1;return e==="Escape"?i?{type:"clearQuery"}:{type:"blur"}:e==="Tab"&&t?s===0?{type:"none"}:{type:"focusChip",index:a}:e==="Backspace"||e==="ArrowLeft"?!r||s===0?{type:"none"}:n?{type:"none"}:{type:"focusChip",index:a}:{type:"none"}}function fe({key:e,repeat:t=!1,index:n,chipCount:r}){return e==="Backspace"||e==="Delete"?t?{type:"none"}:{type:"removeChip",index:n}:e==="ArrowLeft"?n===0?{type:"none"}:{type:"focusChip",index:n-1}:e==="ArrowRight"?n>=r-1?{type:"focusInput"}:{type:"focusChip",index:n+1}:e==="Enter"||e===" "?{type:"activateChip",index:n}:e==="Escape"?{type:"focusInput"}:{type:"none"}}function pe(e,t){const n=t-1;return n<=0?null:e<n?e:n-1}const q={filter:"border-line bg-surface-sunken text-fg-muted",scope:"border-accent-2/40 bg-accent-2-soft text-accent-2"},me=({label:e,onRemove:t,tone:n="filter",className:r})=>d.jsxs("span",{className:y("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-2xs",q[n],r),children:[d.jsx("span",{children:e}),d.jsx("button",{type:"button",onClick:t,className:"shrink-0 rounded-full p-0.5 hover:bg-fg-muted/20 transition-colors","aria-label":`Remove filter: ${e}`,children:d.jsx(R,{className:"size-3"})})]}),B=l.forwardRef(({label:e,onRemove:t,onActivate:n,tone:r="filter",focused:i=!1,onKeyDown:s,onFocusLabel:a,className:u},f)=>d.jsxs("span",{role:"row",tabIndex:-1,className:y("inline-flex max-w-48 items-center gap-1 rounded-full border px-2 py-0.5 text-2xs transition-colors",q[r],i&&"ring-2 ring-ring",u),children:[d.jsx("button",{ref:f,type:"button",role:"gridcell",tabIndex:i?0:-1,onClick:n,onFocus:a,onKeyDown:s,className:y("block min-w-0 max-w-full truncate rounded-full outline-none",n?"cursor-pointer":"cursor-default"),children:e}),d.jsx("button",{type:"button",role:"gridcell",tabIndex:-1,onClick:t,className:"block shrink-0 rounded-full p-0.5 transition-colors hover:bg-fg-muted/20","aria-label":`Remove filter: ${e}`,children:d.jsx(R,{className:"size-3"})})]}));B.displayName="SearchChipRow";const Ne=({tokens:e,className:t})=>e.length===0?null:d.jsx("div",{className:y("flex flex-wrap items-center gap-1.5 border-b border-line bg-surface px-row-inset py-1.5",t),children:e.map(n=>d.jsx(me,{label:n.label,onRemove:n.onRemove},n.label))}),he=e=>e instanceof HTMLElement?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable:!1,ge=({chips:e=[],onRemoveChip:t,value:n,onChange:r,onClear:i,onClearQuery:s,placeholder:a="Search mail...",globalFocusKey:u=!0,showClearButton:f=!0,size:h="sm",inputId:p,suggest:m,className:x})=>{const O=l.useId(),F=p??O,w=l.useRef(null),$=l.useRef([]),A=s??i,[P,C]=l.useState(null),v=l.useRef(void 0),[H,U]=l.useState(""),T=e.length>0;l.useEffect(()=>{C(o=>o!==null&&o>=e.length?null:o)},[e.length]),l.useEffect(()=>{const o=v.current;if(o!==void 0){if(v.current=void 0,o===null){w.current?.focus();return}$.current[o]?.focus()}});const L=l.useRef(void 0);l.useEffect(()=>{const o=m?.caret;if(!o||o===L.current)return;L.current=o;const c=w.current;!c||c.ownerDocument.activeElement!==c||(c.setSelectionRange(o.cursor,o.cursor),m?.onCaretChange(o.cursor))});const S=o=>{m?.onCaretChange(o.selectionStart??o.value.length)},g=l.useCallback(o=>{C(o),v.current=o},[]),N=l.useCallback(o=>{const c=e[o];c&&t&&(g(pe(o,e.length)),U(`${c.label} removed`),t(c.id))},[e,t,g]),V=l.useCallback(()=>{g(null),i()},[i,g]),z=l.useCallback(o=>{const c=o.currentTarget;if(m?.onKeyDown(o))return;const b=de({key:o.key,shiftKey:o.shiftKey,repeat:o.repeat,caretAtStart:c.selectionStart===0&&c.selectionEnd===0,hasValue:n.length>0,chipCount:e.length});switch(b.type){case"focusChip":o.preventDefault(),g(b.index);return;case"clearQuery":A();return;case"blur":c.blur();return;case"none":return}},[e.length,n,A,g,m]),_=l.useCallback(o=>c=>{const b=fe({key:c.key,repeat:c.repeat,index:o,chipCount:e.length});switch(b.type!=="none"&&c.preventDefault(),b.type){case"removeChip":N(b.index);return;case"focusChip":g(b.index);return;case"focusInput":g(null);return;case"activateChip":return;case"none":return}},[e,N,g]);return l.useEffect(()=>{if(!u)return;const o=c=>{c.key!=="/"||c.metaKey||c.ctrlKey||c.altKey||he(c.target)||D("focusSearch")||(c.preventDefault(),w.current?.focus())};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[u]),d.jsxs("label",{htmlFor:F,className:y("flex w-full items-center gap-1.5 text-sm","bg-surface-sunken/50 border border-transparent","focus-within:bg-canvas focus-within:border-line focus-within:ring-2 focus-within:ring-ring","transition-colors",h==="lg"?"rounded-xl px-4 py-2":"rounded-md px-2.5 py-1",x),children:[d.jsx(Q,{className:y("shrink-0 text-fg-muted pointer-events-none",h==="lg"?"size-5":"size-4")}),d.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:[T&&d.jsx("div",{role:"grid","aria-label":"Search filters",className:"flex min-w-0 flex-wrap items-center gap-1",children:e.map((o,c)=>d.jsx(B,{ref:b=>{$.current[c]=b},label:o.label,tone:o.tone,focused:P===c,onFocusLabel:()=>C(c),onKeyDown:_(c),onRemove:()=>N(c)},o.id))}),d.jsx("input",{ref:w,id:F,name:"q",type:"text","aria-label":"Search mail",autoComplete:"off",value:n,tabIndex:P===null?0:-1,onChange:o=>{r(o.target.value),S(o.target)},onKeyDown:z,onKeyUp:o=>S(o.currentTarget),onClick:o=>S(o.currentTarget),onFocus:o=>{C(null),m?.onFocusChange?.(!0),S(o.currentTarget)},onBlur:()=>m?.onFocusChange?.(!1),...m?.comboboxProps,placeholder:T?void 0:a,className:"min-w-24 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-muted"})]}),(n||T)&&f&&d.jsx("button",{type:"button",onClick:V,className:"shrink-0 rounded p-0.5 hover:bg-surface-raised transition-colors","aria-label":"Clear search",children:d.jsx(R,{className:y("text-fg-muted",h==="lg"?"size-5":"size-4")})}),d.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:H})]})},Ee=({value:e,onChange:t,onClear:n,onClearQuery:r,chips:i,onRemoveChip:s,placeholder:a="Search mail...",globalFocusKey:u=!0,showClearButton:f=!0,size:h,inputId:p,suggest:m,className:x})=>d.jsx(ge,{value:e,onChange:t,onClear:n,onClearQuery:r,chips:i,onRemoveChip:s,placeholder:a,globalFocusKey:u,showClearButton:f,size:h,inputId:p,suggest:m,className:x});function Re({handlers:e,enabled:t=!0,target:n,sequenceTimeoutMs:r=1e3}){const i=l.useRef(e);i.current=e;const s=l.useRef(null),a=l.useRef(null);l.useEffect(()=>{if(!t)return;const u=()=>{a.current!==null&&(clearTimeout(a.current),a.current=null)},f=p=>{const m=J({key:p.key,shiftKey:p.shiftKey,metaKey:p.metaKey,ctrlKey:p.ctrlKey,altKey:p.altKey,inEditable:Y(p.target),onControl:X(p.target)},s.current);if(W().length>0){u(),s.current=null;return}if(u(),s.current=m.nextPrefix,m.nextPrefix!==null&&(a.current=setTimeout(()=>{s.current=null,a.current=null},r)),m.action===null||D(m.action)!==null)return;const x=i.current[m.action];x&&(m.preventDefault&&p.preventDefault(),x())},h=n===void 0?window:n;if(h!==null)return h.addEventListener("keydown",f),()=>{h.removeEventListener("keydown",f),u(),s.current=null}},[t,r,n])}function je(){const e=k({from:"/mail/brief/$threadId",shouldThrow:!1}),t=k({from:"/mail/brief/$threadId/$messageId",shouldThrow:!1}),n=k({from:"/mail/flagged/$threadId",shouldThrow:!1}),r=k({from:"/mail/flagged/$threadId/$messageId",shouldThrow:!1}),i=k({from:"/mail/$mailboxId/$threadId",shouldThrow:!1}),s=k({from:"/mail/$mailboxId/$threadId/$messageId",shouldThrow:!1}),a=e?.threadId??n?.threadId??i?.threadId,u=t?.messageId??r?.messageId??s?.messageId;return l.useMemo(()=>a?{threadId:a,messageId:u}:void 0,[a,u])}function Me(){const e=j(),t=se(),{list:n,mailboxId:r}=I();return l.useCallback((i,s)=>{const a=s?.query,f={search:p=>a===void 0?p:{...p,q:a||void 0},hash:t,replace:s?.replace??!1};if(n==="flagged"){e({to:"/mail/flagged/$threadId/$messageId",params:i,...f});return}const h=s?.mailboxId??r;if(n==="mailbox"&&h){e({to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:h,...i},...f});return}e({to:"/mail/brief/$threadId/$messageId",params:i,...f})},[e,t,n,r])}function Ke(){return re()}function be(){const e=j();return l.useCallback(t=>{e({to:"/mail/brief",search:{q:t||void 0}})},[e])}function Fe(){const e=j();return l.useCallback((t,n)=>{e({to:"/mail/$mailboxId",params:{mailboxId:t},search:{q:n||void 0}})},[e])}const ye=({accounts:e})=>{const{list:t,mailboxId:n}=I(),{t:r}=Z("mail",{useSuspense:!1}),i=l.useCallback((a,u)=>r(a,{defaultValue:u}),[r]),s=K({queries:e.map(a=>({...M({path:{accountId:a.accountId}}),staleTime:1/0}))});if(t==="outbox")return"Outbox";if(!n)return null;for(let a=0;a<e.length;a++){const u=s[a]?.data?.items;if(!u)continue;const f=u.find(p=>p.mailboxId===n);if(!f)continue;const h=ee(e[a].folderAppointments);return te(f,h.get(n),i)}return null},$e=({accounts:e})=>{const{mailboxId:t}=I(),n=K({queries:e.map(r=>({...M({path:{accountId:r.accountId}}),staleTime:1/0}))});if(!t)return null;for(const r of n){const i=r.data?.items;if(!i)continue;const s=i.find(a=>a.mailboxId===t);if(s)return s.unseenCount}return null},Ae=({accounts:e})=>{const{mailboxId:t}=I(),n=K({queries:e.map(r=>({...M({path:{accountId:r.accountId}}),staleTime:1/0}))});if(!t)return 0;for(const r of n){const i=r.data?.items;if(!i)continue;const s=i.find(a=>a.mailboxId===t);if(s)return s.messageCount}return 0};function Pe(e){const t=be(),{searchInput:n}=ne(),r=ye({accounts:e}),i=I(),s=l.useMemo(()=>oe(i,r),[i,r]),a=l.useCallback(u=>{u===ae&&t(n)},[t,n]);return{scope:s,clearScope:a}}function Le(e){const t=new Map;for(const n of e){const r=n.email.toLowerCase(),i=r.split("@")[0];i&&!t.has(i)&&t.set(i,n.accountId),t.has(r)||t.set(r,n.accountId)}return t}function De(e){const t=new Map;for(const n of e)for(const r of n){const i=r.fullPath?.toLowerCase();if(!i)continue;const s=E(r).toLowerCase();t.has(i)||t.set(i,r.mailboxId),t.has(s)||t.set(s,r.mailboxId)}return t}function qe(e,t=[]){const n=e.flat().filter(s=>s.fullPath),r=new Map;for(const s of n){const a=E(s).toLowerCase();r.set(a,(r.get(a)??0)+1)}const i=new Map(t.map(s=>[s.accountId,s.email]));return n.map(s=>{const a=E(s),u=r.get(a.toLowerCase())===1,f=t.length>1?i.get(s.accountId):void 0;return{value:u?a:s.fullPath,label:s.displayNameOverride?.trim()||a,...f?{hint:f}:{}}})}function Be(e){const t=new Map;for(const n of e){const r=n.email.toLowerCase().split("@")[0]??"";t.set(r,(t.get(r)??0)+1)}return e.map(n=>{const r=n.email.split("@")[0]??n.email,i=t.get(r.toLowerCase())===1,s=n.displayName?.trim();return{value:i?r:n.email,label:s||n.email,...s?{hint:n.email}:{}}})}export{Se as B,ce as K,Ee as S,je as a,De as b,Re as c,Le as d,Me as e,Ke as f,ye as g,$e as h,Ae as i,ie as j,ve as k,Ne as l,qe as m,Be as n,Fe as o,ue as s,Te as t,Pe as u};
@@ -1 +1 @@
1
- import{u as e,r as o}from"./index-Bn8n_AsE.js";const n={brief:"/mail/brief",flagged:"/mail/flagged",outbox:"/mail/outbox",settings:"/settings",accounts:"/settings/accounts",importConfig:"/import"};function i(){const t=e();return o.useCallback(s=>{t({to:n[s]})},[t])}function c(){const t=e();return o.useCallback(s=>{t({to:"/settings/accounts",search:{editAccountId:s,focusSmtp:!0}})},[t])}function u(){const t=e();return o.useCallback(s=>{t({to:"/settings/$slotId",params:{slotId:s}})},[t])}export{u as a,c as b,i as u};
1
+ import{u as e,r as o}from"./index-BZ4sAts4.js";const n={brief:"/mail/brief",flagged:"/mail/flagged",outbox:"/mail/outbox",settings:"/settings",accounts:"/settings/accounts",importConfig:"/import"};function i(){const t=e();return o.useCallback(s=>{t({to:n[s]})},[t])}function c(){const t=e();return o.useCallback(s=>{t({to:"/settings/accounts",search:{editAccountId:s,focusSmtp:!0}})},[t])}function u(){const t=e();return o.useCallback(s=>{t({to:"/settings/$slotId",params:{slotId:s}})},[t])}export{u as a,c as b,i as u};
@@ -1 +1 @@
1
- import{j as a,p as x}from"./index-Bn8n_AsE.js";const f={sm:"min-h-9 px-3 text-xs",md:"min-h-11 px-4 text-sm"};function h({name:l,options:r,value:s,onChange:d,size:i="md","aria-label":o}){const c=r.findIndex(e=>e.value===s);return a.jsx("div",{role:"radiogroup","aria-label":o,className:"inline-flex rounded-md border border-line bg-surface-sunken p-0.5",children:r.map((e,n)=>{const t=e.value===s,u=!t&&n<r.length-1&&c!==n+1;return a.jsxs("label",{className:x("relative flex cursor-pointer items-center justify-center rounded-[5px] font-medium transition-colors",f[i],t?"bg-surface text-fg shadow":"text-fg-muted hover:text-fg",u&&"after:pointer-events-none after:absolute after:right-0 after:top-1/4 after:h-1/2 after:w-px after:bg-line"),children:[a.jsx("input",{type:"radio",name:l,value:e.value,checked:t,onChange:()=>d(e.value),className:"sr-only"}),e.label]},e.value)})})}export{h as S};
1
+ import{j as a,p as x}from"./index-BZ4sAts4.js";const f={sm:"min-h-9 px-3 text-xs",md:"min-h-11 px-4 text-sm"};function h({name:l,options:r,value:s,onChange:d,size:i="md","aria-label":o}){const c=r.findIndex(e=>e.value===s);return a.jsx("div",{role:"radiogroup","aria-label":o,className:"inline-flex rounded-md border border-line bg-surface-sunken p-0.5",children:r.map((e,n)=>{const t=e.value===s,u=!t&&n<r.length-1&&c!==n+1;return a.jsxs("label",{className:x("relative flex cursor-pointer items-center justify-center rounded-[5px] font-medium transition-colors",f[i],t?"bg-surface text-fg shadow":"text-fg-muted hover:text-fg",u&&"after:pointer-events-none after:absolute after:right-0 after:top-1/4 after:h-1/2 after:w-px after:bg-line"),children:[a.jsx("input",{type:"radio",name:l,value:e.value,checked:t,onChange:()=>d(e.value),className:"sr-only"}),e.label]},e.value)})})}export{h as S};
@@ -1 +1 @@
1
- import{j as e,p as o}from"./index-Bn8n_AsE.js";import{C as a}from"./chevron-down-BWbeCM3N.js";function p({icon:n,className:s,children:t,ref:r,...i}){return e.jsxs("div",{className:o("relative flex h-9 items-center gap-2 rounded-md border border-line bg-surface-sunken pl-3 text-sm","focus-within:border-line-strong focus-within:ring-2 focus-within:ring-ring/30 transition-colors",s),children:[n&&e.jsx("span",{className:"shrink-0 text-fg-subtle",children:n}),e.jsx("select",{ref:r,className:"min-w-0 flex-1 appearance-none bg-transparent py-0 pr-8 text-fg outline-none",...i,children:t}),e.jsx(a,{className:"pointer-events-none absolute right-2.5 size-4 text-fg-subtle"})]})}export{p as S};
1
+ import{j as e,p as o}from"./index-BZ4sAts4.js";import{C as a}from"./chevron-down-TeH9o9Q-.js";function p({icon:n,className:s,children:t,ref:r,...i}){return e.jsxs("div",{className:o("relative flex h-9 items-center gap-2 rounded-md border border-line bg-surface-sunken pl-3 text-sm","focus-within:border-line-strong focus-within:ring-2 focus-within:ring-ring/30 transition-colors",s),children:[n&&e.jsx("span",{className:"shrink-0 text-fg-subtle",children:n}),e.jsx("select",{ref:r,className:"min-w-0 flex-1 appearance-none bg-transparent py-0 pr-8 text-fg outline-none",...i,children:t}),e.jsx(a,{className:"pointer-events-none absolute right-2.5 size-4 text-fg-subtle"})]})}export{p as S};
@@ -1 +1 @@
1
- import{j as e,p as w,e as I,r as o,bS as L,a as C,f as k,bT as P,b1 as O,B as N,X as $,u as q,ac as A,ao as R,bU as M,bV as Q,bW as B,q as D}from"./index-Bn8n_AsE.js";import{u as K}from"./useDebouncedValue-I0sDLoIF.js";import{a as F}from"./sections-DwdsQ0ad.js";import{s as G}from"./help-copy-_K3IfQdg.js";import{K as y}from"./kbd-PiHV4odS.js";import{E}from"./ErrorState-BXxvOnci.js";import{a as V,S as T}from"./settings-screen-IjQOks0s.js";import"./avatar-BgqBWztU.js";import"./badge-CfQoDkmE.js";import"./chevron-left-CliOUq1O.js";import"./menu-znX-3dzE.js";import"./circle-help-DJ-Mtycd.js";function H({options:a,active:u,onSelect:m}){return e.jsx("div",{role:"tablist",className:w("flex shrink-0 gap-1 overflow-x-auto border-b border-line p-2","lg:w-44 lg:flex-col lg:gap-0 lg:overflow-visible lg:border-r lg:border-b-0 lg:py-2 lg:pr-2 lg:pl-3"),children:a.map(t=>{const d=t.id===u;return e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>m(t.id),className:w("flex min-h-11 shrink-0 items-center gap-2 rounded-md px-3 text-left text-sm transition-colors lg:min-h-0 lg:px-2 lg:py-1",d?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface-sunken hover:text-fg"),children:[e.jsx("span",{className:"flex-1 truncate",children:t.label}),e.jsx("span",{className:w("text-2xs tabular-nums",d?"text-accent-2":"text-fg-subtle"),children:t.count??"—"})]},t.id)})})}const S={vip:"VIPs",muted:"Muted",blocked:"Blocked"};function U({query:a,onCount:u}){const{data:m,isPending:t,isError:d,error:x}=C(Q()),g=I(),i=k({...P(),onSettled:()=>{g.invalidateQueries({queryKey:B()})}}),l=m?.suggestions??[],p=a.trim().toLowerCase(),c=p?l.filter(r=>(r.displayName??"").toLowerCase().includes(p)||r.normalizedEmail.toLowerCase().includes(p)):l;return o.useEffect(()=>{u?.(c.length,l.length)},[u,c.length,l.length]),t?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Loading VIP suggestions…"}):d?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(E,{variant:"inline",title:"Couldn't load VIP suggestions",error:x})}):l.length===0?e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIP suggestions yet. As you reply to senders, they'll appear here. Press ",e.jsx(y,{children:"v"})," on any message to promote a sender to VIP."]}):c.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIPs match “",a,"”."]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-row-inset py-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Suggested — promote to VIP"}),c.map(r=>e.jsx(V,{name:r.displayName??r.normalizedEmail,email:r.normalizedEmail,meta:r.replyCount>0?`${r.inboundCount} received · you replied ${r.replyCount}×`:`${r.inboundCount} received · you've never replied`,trailing:e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(D,{className:"size-3.5"}),"aria-busy":i.isPending,onClick:()=>{i.isPending||i.mutate({path:{addressId:r.addressId},body:{flags:{vip:{value:!0,setAt:Date.now(),setBy:"user"}}}})},children:"Add VIP"})},r.addressId))]})}function W({group:a,query:u,onCount:m}){const t=K(u.trim(),300),d=I(),[x,g]=o.useState(null),i=t.length>=2,l=L({query:{q:t,limit:50}}),{data:p,isPending:c,isError:r,error:v}=C({...l,enabled:i}),f=k({...P(),onSuccess:()=>{d.invalidateQueries({queryKey:l.queryKey})}}),h=(p?.items??[]).filter(n=>a==="muted"?n.flags?.muted?.value??!1:n.flags?.blocked?.value??!1);return o.useEffect(()=>{m?.(i?h.length:0,null)},[m,i,h.length]),i?c?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Searching…"}):r?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(E,{variant:"inline",title:"Search failed",error:v})}):h.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No ",S[a].toLowerCase()," senders matching “",t,"”."]}):e.jsx(e.Fragment,{children:h.map(n=>{const s=a==="muted"?n.flags?.muted:n.flags?.blocked,j=s?[`${a}`,s.setAt&&O(s.setAt,{month:"short",year:"numeric"})||null,s.reason?`— ${s.reason}`:null].filter(Boolean).join(" "):a,b=f.isPending&&f.variables?.path.addressId===n.addressId,z=f.isError&&x===n.addressId;return e.jsx(V,{name:n.displayName??n.normalizedEmail,email:n.normalizedEmail,danger:a==="blocked",meta:j,trailing:z?e.jsx(N,{variant:"secondary",size:"sm",onClick:()=>{g(n.addressId),f.mutate({path:{addressId:n.addressId},body:{flags:{[a]:{value:!1,setAt:Date.now()}}}})},children:"Retry"}):e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx($,{className:"size-3.5"}),"aria-busy":b,"aria-label":`Remove ${a} flag`,onClick:()=>{b||(g(n.addressId),f.mutate({path:{addressId:n.addressId},body:{flags:{[a]:{value:!1,setAt:Date.now()}}}}))}})},n.addressId)})}):e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle space-y-2",children:[e.jsxs("p",{children:["Type 2+ characters to search ",S[a].toLowerCase()," ","senders by name or address."]}),e.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Note: a dedicated flagged-address list endpoint is in the backlog. Press ",e.jsx(y,{children:"m"})," on any message to mute its sender; ",e.jsx(y,{children:"b"})," to block."]})]})}function le(){const a=q(),u=A(),m=F(),[t,d]=o.useState("vip"),[x,g]=o.useState(""),[i,l]=o.useState(!0),[p,c]=o.useState(0),[r,v]=o.useState({vip:0,muted:null,blocked:null}),f=o.useCallback((s,j)=>{c(s),v(b=>({...b,vip:j}))},[]),h=o.useCallback((s,j)=>{c(s),v(b=>({...b,[t]:s}))},[t]),n=r[t];return e.jsx(T,{items:u,activeId:"senders",title:"Senders & Rules",description:"Per-sender preferences — set with one key from any message, managed here.",flush:!0,help:G,helpOpen:i,onToggleHelp:()=>l(s=>!s),onSelect:m,onBackToMail:()=>{a({to:"/mail"})},children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col lg:flex-row",children:[e.jsx(H,{active:t,onSelect:s=>{d(s),g("")},options:["vip","muted","blocked"].map(s=>({id:s,label:S[s],count:r[s]}))}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("div",{className:"border-b border-line px-row-inset py-2",children:e.jsx(R,{icon:e.jsx(M,{className:"size-4"}),placeholder:`Filter ${S[t].toLowerCase()} by name or address`,className:"h-8 max-w-sm",value:x,onChange:s=>g(s.target.value)})}),e.jsx("div",{className:"min-h-0 flex-1 divide-y divide-line overflow-y-auto",children:t==="vip"?e.jsx(U,{query:x,onCount:f}):e.jsx(W,{group:t,query:x,onCount:h})}),e.jsxs("footer",{className:"flex items-center justify-between border-t border-line px-row-inset py-1 text-2xs text-fg-subtle",children:[e.jsx("span",{children:n!=null?`${p} of ${n} flagged senders`:`${p} flagged senders`}),e.jsxs("span",{children:[e.jsx(y,{children:"j"})," ",e.jsx(y,{children:"k"})," navigate · ",e.jsx(y,{children:"⌫"})," remove flag"]})]})]})]})})}export{W as SearchGroupPane,le as component};
1
+ import{j as e,p as w,e as I,r as o,bS as L,a as C,f as k,bT as P,b1 as O,B as N,X as $,u as q,ac as A,ao as R,bU as M,bV as Q,bW as B,q as D}from"./index-BZ4sAts4.js";import{u as K}from"./useDebouncedValue-CMBraotV.js";import{a as F}from"./sections-B9pteMHc.js";import{s as G}from"./help-copy-bU0rZqtx.js";import{K as y}from"./kbd-5V1_yqOW.js";import{E}from"./ErrorState-nIG-x-Zh.js";import{a as V,S as T}from"./settings-screen-C8kBB2kR.js";import"./avatar-CQq2GZz9.js";import"./badge-BVw5vgFN.js";import"./chevron-left-DUh7xA0y.js";import"./menu-DXmZUEBa.js";import"./circle-help-CP1s-Yi3.js";function H({options:a,active:u,onSelect:m}){return e.jsx("div",{role:"tablist",className:w("flex shrink-0 gap-1 overflow-x-auto border-b border-line p-2","lg:w-44 lg:flex-col lg:gap-0 lg:overflow-visible lg:border-r lg:border-b-0 lg:py-2 lg:pr-2 lg:pl-3"),children:a.map(t=>{const d=t.id===u;return e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>m(t.id),className:w("flex min-h-11 shrink-0 items-center gap-2 rounded-md px-3 text-left text-sm transition-colors lg:min-h-0 lg:px-2 lg:py-1",d?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface-sunken hover:text-fg"),children:[e.jsx("span",{className:"flex-1 truncate",children:t.label}),e.jsx("span",{className:w("text-2xs tabular-nums",d?"text-accent-2":"text-fg-subtle"),children:t.count??"—"})]},t.id)})})}const S={vip:"VIPs",muted:"Muted",blocked:"Blocked"};function U({query:a,onCount:u}){const{data:m,isPending:t,isError:d,error:x}=C(Q()),g=I(),i=k({...P(),onSettled:()=>{g.invalidateQueries({queryKey:B()})}}),l=m?.suggestions??[],p=a.trim().toLowerCase(),c=p?l.filter(r=>(r.displayName??"").toLowerCase().includes(p)||r.normalizedEmail.toLowerCase().includes(p)):l;return o.useEffect(()=>{u?.(c.length,l.length)},[u,c.length,l.length]),t?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Loading VIP suggestions…"}):d?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(E,{variant:"inline",title:"Couldn't load VIP suggestions",error:x})}):l.length===0?e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIP suggestions yet. As you reply to senders, they'll appear here. Press ",e.jsx(y,{children:"v"})," on any message to promote a sender to VIP."]}):c.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIPs match “",a,"”."]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-row-inset py-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Suggested — promote to VIP"}),c.map(r=>e.jsx(V,{name:r.displayName??r.normalizedEmail,email:r.normalizedEmail,meta:r.replyCount>0?`${r.inboundCount} received · you replied ${r.replyCount}×`:`${r.inboundCount} received · you've never replied`,trailing:e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(D,{className:"size-3.5"}),"aria-busy":i.isPending,onClick:()=>{i.isPending||i.mutate({path:{addressId:r.addressId},body:{flags:{vip:{value:!0,setAt:Date.now(),setBy:"user"}}}})},children:"Add VIP"})},r.addressId))]})}function W({group:a,query:u,onCount:m}){const t=K(u.trim(),300),d=I(),[x,g]=o.useState(null),i=t.length>=2,l=L({query:{q:t,limit:50}}),{data:p,isPending:c,isError:r,error:v}=C({...l,enabled:i}),f=k({...P(),onSuccess:()=>{d.invalidateQueries({queryKey:l.queryKey})}}),h=(p?.items??[]).filter(n=>a==="muted"?n.flags?.muted?.value??!1:n.flags?.blocked?.value??!1);return o.useEffect(()=>{m?.(i?h.length:0,null)},[m,i,h.length]),i?c?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Searching…"}):r?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(E,{variant:"inline",title:"Search failed",error:v})}):h.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No ",S[a].toLowerCase()," senders matching “",t,"”."]}):e.jsx(e.Fragment,{children:h.map(n=>{const s=a==="muted"?n.flags?.muted:n.flags?.blocked,j=s?[`${a}`,s.setAt&&O(s.setAt,{month:"short",year:"numeric"})||null,s.reason?`— ${s.reason}`:null].filter(Boolean).join(" "):a,b=f.isPending&&f.variables?.path.addressId===n.addressId,z=f.isError&&x===n.addressId;return e.jsx(V,{name:n.displayName??n.normalizedEmail,email:n.normalizedEmail,danger:a==="blocked",meta:j,trailing:z?e.jsx(N,{variant:"secondary",size:"sm",onClick:()=>{g(n.addressId),f.mutate({path:{addressId:n.addressId},body:{flags:{[a]:{value:!1,setAt:Date.now()}}}})},children:"Retry"}):e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx($,{className:"size-3.5"}),"aria-busy":b,"aria-label":`Remove ${a} flag`,onClick:()=>{b||(g(n.addressId),f.mutate({path:{addressId:n.addressId},body:{flags:{[a]:{value:!1,setAt:Date.now()}}}}))}})},n.addressId)})}):e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle space-y-2",children:[e.jsxs("p",{children:["Type 2+ characters to search ",S[a].toLowerCase()," ","senders by name or address."]}),e.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Note: a dedicated flagged-address list endpoint is in the backlog. Press ",e.jsx(y,{children:"m"})," on any message to mute its sender; ",e.jsx(y,{children:"b"})," to block."]})]})}function le(){const a=q(),u=A(),m=F(),[t,d]=o.useState("vip"),[x,g]=o.useState(""),[i,l]=o.useState(!0),[p,c]=o.useState(0),[r,v]=o.useState({vip:0,muted:null,blocked:null}),f=o.useCallback((s,j)=>{c(s),v(b=>({...b,vip:j}))},[]),h=o.useCallback((s,j)=>{c(s),v(b=>({...b,[t]:s}))},[t]),n=r[t];return e.jsx(T,{items:u,activeId:"senders",title:"Senders & Rules",description:"Per-sender preferences — set with one key from any message, managed here.",flush:!0,help:G,helpOpen:i,onToggleHelp:()=>l(s=>!s),onSelect:m,onBackToMail:()=>{a({to:"/mail"})},children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col lg:flex-row",children:[e.jsx(H,{active:t,onSelect:s=>{d(s),g("")},options:["vip","muted","blocked"].map(s=>({id:s,label:S[s],count:r[s]}))}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("div",{className:"border-b border-line px-row-inset py-2",children:e.jsx(R,{icon:e.jsx(M,{className:"size-4"}),placeholder:`Filter ${S[t].toLowerCase()} by name or address`,className:"h-8 max-w-sm",value:x,onChange:s=>g(s.target.value)})}),e.jsx("div",{className:"min-h-0 flex-1 divide-y divide-line overflow-y-auto",children:t==="vip"?e.jsx(U,{query:x,onCount:f}):e.jsx(W,{group:t,query:x,onCount:h})}),e.jsxs("footer",{className:"flex items-center justify-between border-t border-line px-row-inset py-1 text-2xs text-fg-subtle",children:[e.jsx("span",{children:n!=null?`${p} of ${n} flagged senders`:`${p} flagged senders`}),e.jsxs("span",{children:[e.jsx(y,{children:"j"})," ",e.jsx(y,{children:"k"})," navigate · ",e.jsx(y,{children:"⌫"})," remove flag"]})]})]})]})})}export{W as SearchGroupPane,le as component};
@@ -0,0 +1 @@
1
+ import{j as t,O as o}from"./index-BZ4sAts4.js";const n=()=>t.jsx(o,{});export{n as component};
@@ -1 +1 @@
1
- import{r as j,j as e,p as f,B as i,X as N}from"./index-Bn8n_AsE.js";import{A as w}from"./avatar-BgqBWztU.js";import{B as z}from"./badge-CfQoDkmE.js";import{C as h}from"./chevron-left-CliOUq1O.js";import{M as S}from"./menu-znX-3dzE.js";import{C as v}from"./circle-help-DJ-Mtycd.js";function L({items:l,activeId:t,title:x,description:n,children:r,help:s,helpOpen:d=!0,flush:o,onSelect:k,onToggleHelp:u,onBackToMail:m}){const[y,c]=j.useState(!1),[p,C]=j.useState(!1),b=!!s&&d,g=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 pt-3 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Settings"}),e.jsx("nav",{className:"flex-1 overflow-y-auto px-2 py-1",children:l.map(a=>e.jsxs("button",{type:"button",onClick:()=>{k?.(a.id),c(!1)},className:f("flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors lg:min-h-0",a.id===t?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg"),children:[a.icon&&e.jsx("span",{className:f("shrink-0",a.id===t?"text-accent-2":"text-fg-subtle"),children:a.icon}),a.label]},a.id))})]});return e.jsxs("div",{className:"safe-area-frame flex h-dvh w-full overflow-hidden bg-canvas font-sans text-fg",children:[e.jsxs("aside",{className:"hidden w-60 shrink-0 flex-col border-r border-line bg-surface-sunken lg:flex",children:[e.jsx("div",{className:"flex h-pane-header shrink-0 items-center border-b border-line px-2",children:e.jsxs("button",{type:"button",onClick:m,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-fg-muted hover:bg-surface hover:text-fg",children:[e.jsx(h,{className:"size-4 text-fg-subtle"}),"Back to mail"]})}),g]}),y&&e.jsxs("div",{className:"fixed inset-0 z-50 flex lg:hidden",children:[e.jsx("button",{type:"button","aria-label":"Close menu",className:"absolute inset-0 bg-canvas/60",onClick:()=>c(!1)}),e.jsxs("aside",{className:"safe-area-frame relative flex w-72 max-w-[85%] flex-col border-r border-line bg-surface-sunken",children:[e.jsxs("div",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-2",children:[e.jsxs("button",{type:"button",onClick:()=>{m?.(),c(!1)},className:"flex items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-fg-muted hover:bg-surface hover:text-fg",children:[e.jsx(h,{className:"size-4 text-fg-subtle"}),"Back to mail"]}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-4"}),onClick:()=>c(!1),"aria-label":"Close menu"})]}),g]})]}),e.jsxs("main",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-3 border-b border-line px-3 lg:px-5",children:[m&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(h,{className:"size-4"}),className:"-ml-1 lg:hidden",onClick:m,"aria-label":"Back to mail"}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(S,{className:"size-4"}),className:"lg:hidden",onClick:()=>c(!0),"aria-label":"Open settings menu"}),e.jsx("h1",{className:"text-md font-semibold text-fg",children:x}),n&&e.jsx("p",{className:"hidden min-w-0 truncate text-xs text-fg-subtle lg:block",children:n}),s&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(v,{className:"size-4"}),className:"ml-auto lg:hidden",onClick:()=>C(a=>!a),"aria-label":"Tips","aria-expanded":p}),s&&!b&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(v,{className:"size-4"}),className:"hidden ml-auto lg:inline-flex",onClick:u,"aria-label":"Show tips"})]}),s&&p&&e.jsx("div",{className:"border-b border-line bg-surface-sunken px-row-inset py-3 text-xs leading-relaxed text-fg-muted lg:hidden",children:s}),o?e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:r}):e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx("div",{className:"max-w-2xl px-3 py-5 lg:px-5",children:e.jsx("div",{className:"space-y-5",children:r})})})]}),b&&e.jsxs("aside",{className:"hidden w-64 shrink-0 flex-col border-l border-line bg-surface-sunken lg:flex",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-row-inset",children:[e.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Tips & tricks"}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-3.5"}),onClick:u,"aria-label":"Collapse tips"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-row-inset py-3 text-xs leading-relaxed text-fg-muted",children:s})]})]})}function X({name:l,email:t,meta:x,caption:n,danger:r,trailing:s}){return e.jsxs("div",{className:"flex items-center gap-3 px-row-inset py-2 hover:bg-surface-sunken",children:[e.jsx("span",{className:f(r&&"rounded-full ring-2 ring-danger/40"),children:e.jsx(w,{name:l,email:t,size:"sm"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-col gap-0 sm:flex-row sm:items-baseline sm:gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium text-fg",children:l}),e.jsx("span",{className:"truncate text-2xs text-fg-subtle",children:t})]}),e.jsxs("div",{className:"text-xs text-fg-subtle",children:[x,n&&e.jsxs("span",{className:"text-fg-muted",children:[" · ",n]})]})]}),s&&e.jsx("div",{className:"shrink-0",children:s})]})}const B={healthy:{tone:"positive",label:"healthy"},error:{tone:"danger",label:"error"},muted:{tone:"neutral",label:"muted"}};function q({label:l,email:t,connector:x,syncLabel:n,state:r,errorDetail:s,trailing:d}){const o=B[r];return e.jsxs("div",{className:f("rounded-sm border border-line bg-surface",r==="muted"&&"opacity-65"),children:[e.jsxs("div",{className:"flex flex-col gap-3 px-row-inset py-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx(w,{name:l,email:t,size:"md"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-fg",children:l}),e.jsx(z,{tone:o.tone,dot:!0,children:o.label})]}),e.jsxs("div",{className:"truncate text-xs text-fg-subtle",children:[t," · ",x," · ",n]})]})]}),d&&e.jsx("div",{className:"shrink-0",children:d})]}),s&&e.jsx("div",{className:"border-t border-line px-row-inset py-2",children:e.jsx("code",{className:"block rounded-xs bg-danger-soft px-2 py-1 text-2xs text-danger",children:s})})]})}export{q as A,L as S,X as a};
1
+ import{r as j,j as e,p as f,B as i,X as N}from"./index-BZ4sAts4.js";import{A as w}from"./avatar-CQq2GZz9.js";import{B as z}from"./badge-BVw5vgFN.js";import{C as h}from"./chevron-left-DUh7xA0y.js";import{M as S}from"./menu-DXmZUEBa.js";import{C as v}from"./circle-help-CP1s-Yi3.js";function L({items:l,activeId:t,title:x,description:n,children:r,help:s,helpOpen:d=!0,flush:o,onSelect:k,onToggleHelp:u,onBackToMail:m}){const[y,c]=j.useState(!1),[p,C]=j.useState(!1),b=!!s&&d,g=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 pt-3 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Settings"}),e.jsx("nav",{className:"flex-1 overflow-y-auto px-2 py-1",children:l.map(a=>e.jsxs("button",{type:"button",onClick:()=>{k?.(a.id),c(!1)},className:f("flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors lg:min-h-0",a.id===t?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg"),children:[a.icon&&e.jsx("span",{className:f("shrink-0",a.id===t?"text-accent-2":"text-fg-subtle"),children:a.icon}),a.label]},a.id))})]});return e.jsxs("div",{className:"safe-area-frame flex h-dvh w-full overflow-hidden bg-canvas font-sans text-fg",children:[e.jsxs("aside",{className:"hidden w-60 shrink-0 flex-col border-r border-line bg-surface-sunken lg:flex",children:[e.jsx("div",{className:"flex h-pane-header shrink-0 items-center border-b border-line px-2",children:e.jsxs("button",{type:"button",onClick:m,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-fg-muted hover:bg-surface hover:text-fg",children:[e.jsx(h,{className:"size-4 text-fg-subtle"}),"Back to mail"]})}),g]}),y&&e.jsxs("div",{className:"fixed inset-0 z-50 flex lg:hidden",children:[e.jsx("button",{type:"button","aria-label":"Close menu",className:"absolute inset-0 bg-canvas/60",onClick:()=>c(!1)}),e.jsxs("aside",{className:"safe-area-frame relative flex w-72 max-w-[85%] flex-col border-r border-line bg-surface-sunken",children:[e.jsxs("div",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-2",children:[e.jsxs("button",{type:"button",onClick:()=>{m?.(),c(!1)},className:"flex items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-fg-muted hover:bg-surface hover:text-fg",children:[e.jsx(h,{className:"size-4 text-fg-subtle"}),"Back to mail"]}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-4"}),onClick:()=>c(!1),"aria-label":"Close menu"})]}),g]})]}),e.jsxs("main",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-3 border-b border-line px-3 lg:px-5",children:[m&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(h,{className:"size-4"}),className:"-ml-1 lg:hidden",onClick:m,"aria-label":"Back to mail"}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(S,{className:"size-4"}),className:"lg:hidden",onClick:()=>c(!0),"aria-label":"Open settings menu"}),e.jsx("h1",{className:"text-md font-semibold text-fg",children:x}),n&&e.jsx("p",{className:"hidden min-w-0 truncate text-xs text-fg-subtle lg:block",children:n}),s&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(v,{className:"size-4"}),className:"ml-auto lg:hidden",onClick:()=>C(a=>!a),"aria-label":"Tips","aria-expanded":p}),s&&!b&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(v,{className:"size-4"}),className:"hidden ml-auto lg:inline-flex",onClick:u,"aria-label":"Show tips"})]}),s&&p&&e.jsx("div",{className:"border-b border-line bg-surface-sunken px-row-inset py-3 text-xs leading-relaxed text-fg-muted lg:hidden",children:s}),o?e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:r}):e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx("div",{className:"max-w-2xl px-3 py-5 lg:px-5",children:e.jsx("div",{className:"space-y-5",children:r})})})]}),b&&e.jsxs("aside",{className:"hidden w-64 shrink-0 flex-col border-l border-line bg-surface-sunken lg:flex",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-row-inset",children:[e.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Tips & tricks"}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-3.5"}),onClick:u,"aria-label":"Collapse tips"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-row-inset py-3 text-xs leading-relaxed text-fg-muted",children:s})]})]})}function X({name:l,email:t,meta:x,caption:n,danger:r,trailing:s}){return e.jsxs("div",{className:"flex items-center gap-3 px-row-inset py-2 hover:bg-surface-sunken",children:[e.jsx("span",{className:f(r&&"rounded-full ring-2 ring-danger/40"),children:e.jsx(w,{name:l,email:t,size:"sm"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-col gap-0 sm:flex-row sm:items-baseline sm:gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium text-fg",children:l}),e.jsx("span",{className:"truncate text-2xs text-fg-subtle",children:t})]}),e.jsxs("div",{className:"text-xs text-fg-subtle",children:[x,n&&e.jsxs("span",{className:"text-fg-muted",children:[" · ",n]})]})]}),s&&e.jsx("div",{className:"shrink-0",children:s})]})}const B={healthy:{tone:"positive",label:"healthy"},error:{tone:"danger",label:"error"},muted:{tone:"neutral",label:"muted"}};function q({label:l,email:t,connector:x,syncLabel:n,state:r,errorDetail:s,trailing:d}){const o=B[r];return e.jsxs("div",{className:f("rounded-sm border border-line bg-surface",r==="muted"&&"opacity-65"),children:[e.jsxs("div",{className:"flex flex-col gap-3 px-row-inset py-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx(w,{name:l,email:t,size:"md"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-fg",children:l}),e.jsx(z,{tone:o.tone,dot:!0,children:o.label})]}),e.jsxs("div",{className:"truncate text-xs text-fg-subtle",children:[t," · ",x," · ",n]})]})]}),d&&e.jsx("div",{className:"shrink-0",children:d})]}),s&&e.jsx("div",{className:"border-t border-line px-row-inset py-2",children:e.jsx("code",{className:"block rounded-xs bg-danger-soft px-2 py-1 text-2xs text-danger",children:s})})]})}export{q as A,L as S,X as a};
@@ -1 +1 @@
1
- import{b as e}from"./index-Bn8n_AsE.js";const d=e("CloudOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193",key:"yfwify"}],["path",{d:"M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07",key:"jlfiyv"}]]);const h=e("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);export{d as C,h as S};
1
+ import{b as e}from"./index-BZ4sAts4.js";const d=e("CloudOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193",key:"yfwify"}],["path",{d:"M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07",key:"jlfiyv"}]]);const h=e("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);export{d as C,h as S};
@@ -1 +1 @@
1
- import{r as s,j as x,p as b}from"./index-Bn8n_AsE.js";const v={type:"none"};function I(e){if(!e.open||e.count<=0)return v;if(e.key==="ArrowDown"){const t=e.activeIndex+1;return{type:"move",index:t>=e.count?0:t}}if(e.key==="ArrowUp"){const t=e.activeIndex-1;return{type:"move",index:t<0?e.count-1:t}}return e.key==="Escape"?{type:"dismiss"}:(e.key==="Enter"||(e.acceptKeys??[]).includes(e.key))&&e.activeIndex>=0&&e.activeIndex<e.count?{type:"accept",index:e.activeIndex}:v}function j({count:e,onAccept:a,acceptKeys:t}){const[m,i]=s.useState(!1),[c,u]=s.useState(-1),p=s.useId().replace(/[^a-zA-Z0-9_-]/g,""),n=`suggest-${p}`,r=s.useCallback(f=>`suggest-${p}-option-${f}`,[p]);s.useEffect(()=>{u(-1),i(!1)},[e]);const o=e>0&&!m,y=s.useRef({open:o,count:e,activeIndex:c,acceptKeys:t,onAccept:a});y.current={open:o,count:e,activeIndex:c,acceptKeys:t,onAccept:a};const h=s.useCallback(f=>{const d=y.current,l=I({key:f.key,open:d.open,count:d.count,activeIndex:d.activeIndex,acceptKeys:d.acceptKeys});return l.type==="none"?!1:(f.preventDefault(),l.type==="move"&&u(l.index),l.type==="dismiss"&&i(!0),l.type==="accept"&&d.onAccept(l.index),!0)},[]),k=s.useMemo(()=>({role:"combobox","aria-expanded":o,"aria-controls":n,"aria-autocomplete":"list",...c>=0?{"aria-activedescendant":r(c)}:{},...o?{"data-escape-owner":""}:{}}),[o,n,c,r]);return{open:o,activeIndex:c,setActiveIndex:u,dismiss:s.useCallback(()=>i(!0),[]),reopen:s.useCallback(()=>i(!1),[]),handleKeyDown:h,listId:n,optionId:r,comboboxProps:k}}function E({id:e,suggestions:a,activeIndex:t,optionId:m,onPick:i,onHighlight:c,label:u,className:p}){return a.length===0?null:x.jsx("div",{id:e,role:"listbox","aria-label":u,className:b("max-h-44 overflow-y-auto rounded-md border border-line bg-surface py-1 shadow-sm",p),children:a.map((n,r)=>x.jsxs("div",{id:m(r),role:"option",tabIndex:-1,"aria-selected":r===t,className:b("flex cursor-pointer items-baseline gap-2 px-3 py-2 text-sm text-fg",r===t&&"bg-accent-2-soft"),onMouseDown:o=>{o.preventDefault(),i(n)},onMouseEnter:()=>c(r),children:[x.jsx("span",{className:"min-w-0 flex-1 truncate",children:n.label??n.value}),n.hint&&x.jsx("span",{className:"shrink-0 truncate text-2xs text-fg-subtle",children:n.hint}),n.source&&x.jsx("span",{className:"shrink-0 text-2xs text-fg-subtle",children:n.source})]},n.value))})}export{E as S,j as u};
1
+ import{r as s,j as x,p as b}from"./index-BZ4sAts4.js";const v={type:"none"};function I(e){if(!e.open||e.count<=0)return v;if(e.key==="ArrowDown"){const t=e.activeIndex+1;return{type:"move",index:t>=e.count?0:t}}if(e.key==="ArrowUp"){const t=e.activeIndex-1;return{type:"move",index:t<0?e.count-1:t}}return e.key==="Escape"?{type:"dismiss"}:(e.key==="Enter"||(e.acceptKeys??[]).includes(e.key))&&e.activeIndex>=0&&e.activeIndex<e.count?{type:"accept",index:e.activeIndex}:v}function j({count:e,onAccept:a,acceptKeys:t}){const[m,i]=s.useState(!1),[c,u]=s.useState(-1),p=s.useId().replace(/[^a-zA-Z0-9_-]/g,""),n=`suggest-${p}`,r=s.useCallback(f=>`suggest-${p}-option-${f}`,[p]);s.useEffect(()=>{u(-1),i(!1)},[e]);const o=e>0&&!m,y=s.useRef({open:o,count:e,activeIndex:c,acceptKeys:t,onAccept:a});y.current={open:o,count:e,activeIndex:c,acceptKeys:t,onAccept:a};const h=s.useCallback(f=>{const d=y.current,l=I({key:f.key,open:d.open,count:d.count,activeIndex:d.activeIndex,acceptKeys:d.acceptKeys});return l.type==="none"?!1:(f.preventDefault(),l.type==="move"&&u(l.index),l.type==="dismiss"&&i(!0),l.type==="accept"&&d.onAccept(l.index),!0)},[]),k=s.useMemo(()=>({role:"combobox","aria-expanded":o,"aria-controls":n,"aria-autocomplete":"list",...c>=0?{"aria-activedescendant":r(c)}:{},...o?{"data-escape-owner":""}:{}}),[o,n,c,r]);return{open:o,activeIndex:c,setActiveIndex:u,dismiss:s.useCallback(()=>i(!0),[]),reopen:s.useCallback(()=>i(!1),[]),handleKeyDown:h,listId:n,optionId:r,comboboxProps:k}}function E({id:e,suggestions:a,activeIndex:t,optionId:m,onPick:i,onHighlight:c,label:u,className:p}){return a.length===0?null:x.jsx("div",{id:e,role:"listbox","aria-label":u,className:b("max-h-44 overflow-y-auto rounded-md border border-line bg-surface py-1 shadow-sm",p),children:a.map((n,r)=>x.jsxs("div",{id:m(r),role:"option",tabIndex:-1,"aria-selected":r===t,className:b("flex cursor-pointer items-baseline gap-2 px-3 py-2 text-sm text-fg",r===t&&"bg-accent-2-soft"),onMouseDown:o=>{o.preventDefault(),i(n)},onMouseEnter:()=>c(r),children:[x.jsx("span",{className:"min-w-0 flex-1 truncate",children:n.label??n.value}),n.hint&&x.jsx("span",{className:"shrink-0 truncate text-2xs text-fg-subtle",children:n.hint}),n.source&&x.jsx("span",{className:"shrink-0 text-2xs text-fg-subtle",children:n.source})]},n.value))})}export{E as S,j as u};
@@ -1 +1 @@
1
- import{j as t,aa as e}from"./index-Bn8n_AsE.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
1
+ import{j as t,aa as e}from"./index-BZ4sAts4.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
@@ -1 +1 @@
1
- import{j as i,X as Z,p as O,ek as R,em as $,el as v,r as u,c3 as E}from"./index-Bn8n_AsE.js";import{b as S,n as F,f,o as L,t as W,U as j,y as z,l as k,k as B,p as H}from"./useCalendarSuggestions-Bb4PGHae.js";import{e as w,p as U,a as _}from"./draft-QkjvtbSZ.js";import{f as P}from"./calendar-format-BwCpz-JZ.js";import{t as M}from"./agenda-time-O7rJVIvd.js";import{a as V}from"./CalendarSession-CK-EC1yK.js";import{C as G}from"./calendar-failure-note-DK-uzvky.js";import{E as X,C as Y}from"./EmptyState-BYR2eIr2.js";import{C as q}from"./calendar-event-sidebar-DZum-8WN.js";import"./nav-link-CtuHya9S.js";import{k as J,b as K}from"./calendar-BJu4Vl-g.js";import"./reply-DmpF7cgR.js";import"./ErrorState-BXxvOnci.js";import"./useQueries-Bs7-L_2j.js";import"./calendar-guests-Diti9JO5.js";import"./calendar-event-popup-B4-Dpgb6.js";import"./pencil-DA21sF5f.js";import"./circle-help-DJ-Mtycd.js";import"./select-Cc2Vc4qL.js";import"./chevron-down-BWbeCM3N.js";import"./useMediaQuery-C00TiD5k.js";function I({title:e,subtitle:a,onClose:r,children:s,className:o}){return i.jsxs("section",{className:O("flex h-full w-full flex-col bg-surface",o),children:[i.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[i.jsx("h2",{className:"shrink-0 text-xs font-medium text-fg",children:e}),a!==void 0&&a!==""&&i.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-fg-muted",children:a}),i.jsx("button",{type:"button","aria-label":"Close editor",onClick:r,className:"ml-auto flex size-7 shrink-0 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",children:i.jsx(Z,{className:"size-4"})})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-row-inset py-5",children:i.jsx("div",{className:"mx-auto w-full max-w-2xl",children:s})})]})}function Q(e,a,r){const s={title:e.summary,location:e.location};if(e.allDay){const t=e.dtStart.slice(0,10),c=e.dtEnd.slice(0,10);return{...w(t,a),...s,allDay:!0,startTime:"",endDate:c>t?R(c,-1):t,endTime:""}}const o=t=>e.zoneCertainty==="Ambiguous"?t:$(t,r),l=o(e.dtStart),d=o(e.dtEnd);return{...w(l.slice(0,10),a),...s,startTime:l.slice(11,16),endDate:d.slice(0,10),endTime:d.slice(11,16)}}function ee(e,a,r,s){const o=U(a,r,s);if(!o.ok)return o;const d=e.zoneCertainty==="Ambiguous"||o.patch.start!==void 0?{...o.patch,..._(r,s.clock),allDay:r.allDay,timeZone:s.anchor}:o.patch;return{ok:!0,input:{calendarId:r.calendarId,event:d}}}const te=[],ae={from:"",to:""};function ne(e,a=""){const{timeZoneByCalendarId:r}=S(),s=e.date!==""&&!e.allDay&&e.endDate!==""&&e.startTime!==""&&e.endTime!==""&&`${e.endDate}T${e.endTime}`>`${e.date}T${e.startTime}`,{instances:o,isLoading:l,error:d}=F({...s?{from:v("week",e.date).from,to:v("week",e.endDate).to}:ae,calendarIds:te,enabled:s}),t=f();return u.useMemo(()=>{if(!s||l||d)return;const c=E(e.date,e.startTime,t),p=E(e.endDate,e.endTime,t),h=o.filter(m=>L(m)&&m.calendarObjectId!==a).map(m=>W(m,r[m.calendarId]??j,t));return M({start:c,end:p},h).map(m=>({id:m.id,label:`${m.title}, ${P(m)}`}))},[s,l,d,e.date,e.endDate,e.startTime,e.endTime,t,o,a,r])}const y="Add from mail",se="The invitation named a time zone nothing could resolve. The time below is as the mail wrote it — check it before adding.";function oe({suggestionId:e,onClose:a}){const{suggestion:r,isLoading:s,error:o}=z(e),l=r??void 0,[d,t]=u.useState(void 0);l!==void 0&&d===void 0&&t(l);const c=d??l;if(c!==void 0)return i.jsx(ie,{suggestion:c,onClose:a},c.suggestionId);if(o!==null){const p="Couldn't read what your mail is waiting on.";return i.jsx(I,{title:y,onClose:a,children:i.jsx(G,{text:`${p} Close this and try again.`,reportHref:k(p),className:"m-row-inset"})})}return i.jsx(I,{title:y,onClose:a,children:i.jsx(X,{message:s?"Reading the suggestion…":"This suggestion is no longer waiting on you. It was answered, or a later message replaced it."})})}function ie({suggestion:e,onClose:a}){const{calendars:r,defaultCalendarId:s,timeZoneByCalendarId:o}=S(),l=r.filter(n=>!n.readOnly),d=B(),[t]=u.useState(()=>Q(e,"",f())),[c,p]=u.useState(t),h=V()?.dispatch;u.useEffect(()=>{h?.({type:"sidebar-range",range:{date:t.date,endDate:t.endDate,startTime:t.allDay?"":t.startTime,endTime:t.allDay?"":t.endTime,allDay:t.allDay}})},[t,h]);const[m,D]=u.useState(""),[N,A]=u.useState(),x=ne(c),g=l.some(n=>n.id===s)?s:l[0]?.id??"";u.useEffect(()=>{g!==""&&p(n=>n.calendarId===""?{...n,calendarId:g}:n)},[g]);const C=()=>{const n=ee(e,t,c,{clock:f(),anchor:H(o[c.calendarId]??j)});if(!n.ok){D(n.problem);return}D(""),d.acceptEdited(e.suggestionId,n.input).then(b=>{if(b.kind==="answered"){a();return}const T=`Couldn't add this to your calendar: ${b.message}`;A({text:T,reportHref:k(T),onRetry:C})})};return i.jsx(q,{heading:y,draft:c,onChange:n=>{p(n),h?.({type:"sidebar-range",range:{date:n.date,endDate:n.endDate,startTime:n.allDay?"":n.startTime,endTime:n.allDay?"":n.endTime,allDay:n.allDay}})},calendars:l,calendarEditable:!0,repeatEditable:!1,timeZone:f(),timeZones:[f()],onTimeZone:()=>{},busy:!0,onBusy:()=>{},onSave:C,onCancel:a,saving:d.isAnswering,saveLabel:"Add",failure:N,problem:m!==""?m:e.zoneCertainty==="Ambiguous"?se:"",children:x&&i.jsx(Y,{clashes:x})})}function je(){const e=J(),{closeToView:a}=K();return e===void 0?null:i.jsx(oe,{suggestionId:e,onClose:a})}export{je as component};
1
+ import{j as i,X as Z,p as O,ek as R,em as $,el as v,r as u,c3 as E}from"./index-BZ4sAts4.js";import{b as S,n as F,f,o as L,t as W,U as j,y as z,l as k,k as B,p as H}from"./useCalendarSuggestions-D58tKJtx.js";import{e as w,p as U,a as _}from"./draft-0DDwY2Pw.js";import{f as P}from"./calendar-format-BwCpz-JZ.js";import{t as M}from"./agenda-time-Bt4BEp3g.js";import{a as V}from"./CalendarSession-Ql7K56YK.js";import{C as G}from"./calendar-failure-note-4qETx8lD.js";import{E as X,C as Y}from"./EmptyState-BjhPv2hS.js";import{C as q}from"./calendar-event-sidebar-CGPuc517.js";import"./nav-link-BvBkmH1H.js";import{k as J,b as K}from"./calendar-SMIdRsx9.js";import"./reply-D8bLYzum.js";import"./ErrorState-nIG-x-Zh.js";import"./useQueries-B-X1sW9_.js";import"./calendar-guests-Dt2cjTqc.js";import"./calendar-event-popup-DqvJLPWt.js";import"./pencil-Py3MXttE.js";import"./circle-help-CP1s-Yi3.js";import"./select-DXHN14lo.js";import"./chevron-down-TeH9o9Q-.js";import"./useMediaQuery-D3m_n689.js";function I({title:e,subtitle:a,onClose:r,children:s,className:o}){return i.jsxs("section",{className:O("flex h-full w-full flex-col bg-surface",o),children:[i.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[i.jsx("h2",{className:"shrink-0 text-xs font-medium text-fg",children:e}),a!==void 0&&a!==""&&i.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-fg-muted",children:a}),i.jsx("button",{type:"button","aria-label":"Close editor",onClick:r,className:"ml-auto flex size-7 shrink-0 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",children:i.jsx(Z,{className:"size-4"})})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-row-inset py-5",children:i.jsx("div",{className:"mx-auto w-full max-w-2xl",children:s})})]})}function Q(e,a,r){const s={title:e.summary,location:e.location};if(e.allDay){const t=e.dtStart.slice(0,10),c=e.dtEnd.slice(0,10);return{...w(t,a),...s,allDay:!0,startTime:"",endDate:c>t?R(c,-1):t,endTime:""}}const o=t=>e.zoneCertainty==="Ambiguous"?t:$(t,r),l=o(e.dtStart),d=o(e.dtEnd);return{...w(l.slice(0,10),a),...s,startTime:l.slice(11,16),endDate:d.slice(0,10),endTime:d.slice(11,16)}}function ee(e,a,r,s){const o=U(a,r,s);if(!o.ok)return o;const d=e.zoneCertainty==="Ambiguous"||o.patch.start!==void 0?{...o.patch,..._(r,s.clock),allDay:r.allDay,timeZone:s.anchor}:o.patch;return{ok:!0,input:{calendarId:r.calendarId,event:d}}}const te=[],ae={from:"",to:""};function ne(e,a=""){const{timeZoneByCalendarId:r}=S(),s=e.date!==""&&!e.allDay&&e.endDate!==""&&e.startTime!==""&&e.endTime!==""&&`${e.endDate}T${e.endTime}`>`${e.date}T${e.startTime}`,{instances:o,isLoading:l,error:d}=F({...s?{from:v("week",e.date).from,to:v("week",e.endDate).to}:ae,calendarIds:te,enabled:s}),t=f();return u.useMemo(()=>{if(!s||l||d)return;const c=E(e.date,e.startTime,t),p=E(e.endDate,e.endTime,t),h=o.filter(m=>L(m)&&m.calendarObjectId!==a).map(m=>W(m,r[m.calendarId]??j,t));return M({start:c,end:p},h).map(m=>({id:m.id,label:`${m.title}, ${P(m)}`}))},[s,l,d,e.date,e.endDate,e.startTime,e.endTime,t,o,a,r])}const y="Add from mail",se="The invitation named a time zone nothing could resolve. The time below is as the mail wrote it — check it before adding.";function oe({suggestionId:e,onClose:a}){const{suggestion:r,isLoading:s,error:o}=z(e),l=r??void 0,[d,t]=u.useState(void 0);l!==void 0&&d===void 0&&t(l);const c=d??l;if(c!==void 0)return i.jsx(ie,{suggestion:c,onClose:a},c.suggestionId);if(o!==null){const p="Couldn't read what your mail is waiting on.";return i.jsx(I,{title:y,onClose:a,children:i.jsx(G,{text:`${p} Close this and try again.`,reportHref:k(p),className:"m-row-inset"})})}return i.jsx(I,{title:y,onClose:a,children:i.jsx(X,{message:s?"Reading the suggestion…":"This suggestion is no longer waiting on you. It was answered, or a later message replaced it."})})}function ie({suggestion:e,onClose:a}){const{calendars:r,defaultCalendarId:s,timeZoneByCalendarId:o}=S(),l=r.filter(n=>!n.readOnly),d=B(),[t]=u.useState(()=>Q(e,"",f())),[c,p]=u.useState(t),h=V()?.dispatch;u.useEffect(()=>{h?.({type:"sidebar-range",range:{date:t.date,endDate:t.endDate,startTime:t.allDay?"":t.startTime,endTime:t.allDay?"":t.endTime,allDay:t.allDay}})},[t,h]);const[m,D]=u.useState(""),[N,A]=u.useState(),x=ne(c),g=l.some(n=>n.id===s)?s:l[0]?.id??"";u.useEffect(()=>{g!==""&&p(n=>n.calendarId===""?{...n,calendarId:g}:n)},[g]);const C=()=>{const n=ee(e,t,c,{clock:f(),anchor:H(o[c.calendarId]??j)});if(!n.ok){D(n.problem);return}D(""),d.acceptEdited(e.suggestionId,n.input).then(b=>{if(b.kind==="answered"){a();return}const T=`Couldn't add this to your calendar: ${b.message}`;A({text:T,reportHref:k(T),onRetry:C})})};return i.jsx(q,{heading:y,draft:c,onChange:n=>{p(n),h?.({type:"sidebar-range",range:{date:n.date,endDate:n.endDate,startTime:n.allDay?"":n.startTime,endTime:n.allDay?"":n.endTime,allDay:n.allDay}})},calendars:l,calendarEditable:!0,repeatEditable:!1,timeZone:f(),timeZones:[f()],onTimeZone:()=>{},busy:!0,onBusy:()=>{},onSave:C,onCancel:a,saving:d.isAnswering,saveLabel:"Add",failure:N,problem:m!==""?m:e.zoneCertainty==="Ambiguous"?se:"",children:x&&i.jsx(Y,{clashes:x})})}function je(){const e=J(),{closeToView:a}=K();return e===void 0?null:i.jsx(oe,{suggestionId:e,onClose:a})}export{je as component};
@@ -1 +1 @@
1
- import{j as n,p as i}from"./index-Bn8n_AsE.js";function d({checked:e,onToggle:a,disabled:t,className:l,ref:u,...s}){const o=s["aria-disabled"],r=t===!0||o===!0||o==="true";return n.jsx("button",{type:"button",role:"switch",ref:u,"aria-checked":e,disabled:t,onClick:()=>{r||a()},className:i("group inline-flex h-11 w-14 shrink-0 items-center justify-center rounded-md outline-none focus-visible:ring-2 focus-visible:ring-ring",r?"cursor-not-allowed":"cursor-pointer",l),...s,children:n.jsx("span",{"aria-hidden":!0,className:i("relative inline-flex h-6 w-11 items-center rounded-full border transition-colors",e?"border-positive bg-positive":"border-line-strong bg-surface-sunken",r&&"opacity-60"),children:n.jsx("span",{className:i("size-4 rounded-full bg-canvas transition-transform",e?"translate-x-6":"translate-x-1")})})})}export{d as S};
1
+ import{j as n,p as i}from"./index-BZ4sAts4.js";function d({checked:e,onToggle:a,disabled:t,className:l,ref:u,...s}){const o=s["aria-disabled"],r=t===!0||o===!0||o==="true";return n.jsx("button",{type:"button",role:"switch",ref:u,"aria-checked":e,disabled:t,onClick:()=>{r||a()},className:i("group inline-flex h-11 w-14 shrink-0 items-center justify-center rounded-md outline-none focus-visible:ring-2 focus-visible:ring-ring",r?"cursor-not-allowed":"cursor-pointer",l),...s,children:n.jsx("span",{"aria-hidden":!0,className:i("relative inline-flex h-6 w-11 items-center rounded-full border transition-colors",e?"border-positive bg-positive":"border-line-strong bg-surface-sunken",r&&"opacity-60"),children:n.jsx("span",{className:i("size-4 rounded-full bg-canvas transition-transform",e?"translate-x-6":"translate-x-1")})})})}export{d as S};
@@ -1 +1 @@
1
- import{b as w,r as d,j as e,T as R,X as E,p as z,C as $,em as B,c3 as L,eY as q}from"./index-Bn8n_AsE.js";import{b as F,f as P,c as V}from"./useCalendarSuggestions-Bb4PGHae.js";import{b as Z,C as j,u as H}from"./useCalendarTasks-RmI_Ij1j.js";import"./nav-link-CtuHya9S.js";import{b as S}from"./calendar-BJu4Vl-g.js";import"./reply-DmpF7cgR.js";import{C as K}from"./CalendarLoadFailed-DcrF_lyr.js";import{C as M}from"./calendar-event-popup-B4-Dpgb6.js";import"./ErrorState-BXxvOnci.js";import"./useQueries-Bs7-L_2j.js";import"./useMediaQuery-C00TiD5k.js";import"./pencil-DA21sF5f.js";const A=w("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);const O=w("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),D="flex size-9 items-center justify-center rounded-full text-fg-muted outline-none hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-40",v="h-9 w-full rounded-md border border-line bg-surface-sunken px-2 text-sm text-fg outline-none focus-visible:ring-2 focus-visible:ring-ring/30";function W({headingId:t,headingRef:i,fields:l,dueText:r,listName:u,completed:c,onToggle:f,onSave:x,onDelete:g,onClose:p,busy:m=!1,failure:h}){const[s,o]=d.useState(null);return e.jsxs("div",{className:"flex flex-col gap-3 p-3",children:[e.jsxs("div",{className:"flex justify-end gap-1",children:[s===null&&e.jsx("button",{type:"button",onClick:()=>o(l),className:"rounded-md px-3 text-sm font-medium text-accent hover:bg-accent-soft focus-visible:ring-2 focus-visible:ring-ring",children:"Edit"}),e.jsx("button",{type:"button","aria-label":"Delete",onClick:g,disabled:m,className:D,children:e.jsx(R,{className:"size-4"})}),e.jsx("button",{type:"button","aria-label":"Close",onClick:p,className:D,children:e.jsx(E,{className:"size-4"})})]}),s===null?e.jsxs("div",{className:"flex flex-col gap-2 px-2",children:[e.jsx("h2",{id:t,ref:i,tabIndex:-1,className:z("text-xl font-normal break-words text-fg outline-none",c&&"text-fg-muted line-through"),children:l.title===""?"(No title)":l.title}),e.jsx("p",{className:"text-sm text-fg-muted",children:r}),e.jsxs("p",{className:"flex items-center gap-2 text-sm",children:[e.jsx($,{className:"size-4 text-fg-subtle","aria-label":"List"}),u]}),l.description!==""&&e.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:l.description})]}):e.jsxs("form",{className:"flex flex-col gap-2 px-2",onSubmit:n=>{n.preventDefault(),x(s),o(null)},children:[e.jsx("h2",{id:t,className:"sr-only",children:"Edit task"}),e.jsx("input",{"aria-label":"Title",value:s.title,onChange:n=>o({...s,title:n.target.value}),className:v}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"date","aria-label":"Due date",value:s.dueDate,onChange:n=>n.target.value!==""&&o({...s,dueDate:n.target.value}),className:v}),e.jsx("input",{type:"time","aria-label":"Due time",value:s.dueTime,onChange:n=>o({...s,dueTime:n.target.value}),className:v})]}),e.jsx("textarea",{"aria-label":"Description",rows:3,value:s.description,onChange:n=>o({...s,description:n.target.value}),className:"w-full rounded-md border border-line bg-surface-sunken px-2 py-1 text-sm"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:()=>o(null),className:"h-9 rounded-md border border-line px-3 text-sm font-medium",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:m,className:"h-9 rounded-md bg-accent px-4 text-sm font-medium text-accent-fg disabled:opacity-50",children:"Save"})]})]}),h&&e.jsx(M,{failure:h}),s===null&&e.jsx("div",{className:"flex justify-end px-2",children:e.jsxs("button",{type:"button",onClick:f,disabled:m,className:"inline-flex h-9 items-center gap-2 rounded-md border border-line px-3 text-sm font-medium hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",children:[c?e.jsx(O,{className:"size-4","aria-hidden":"true"}):e.jsx(A,{className:"size-4","aria-hidden":"true"}),c?"Mark not done":"Mark done"]})})]})}const U=(t,i)=>{const l=new Date(`${t.slice(0,10)}T00:00:00Z`),r=new Intl.DateTimeFormat(void 0,{weekday:"long",day:"numeric",month:"long",timeZone:"UTC"}).format(l);return i?`Due ${r}`:`Due ${r} · ${t.slice(11,16)}`};function X({calendarTaskId:t}){const i=Z(t),{closeToView:l}=S(),r=d.useId(),u=d.useRef(null),c=i.kind==="gone";return d.useEffect(()=>{c&&u.current?.focus()},[c]),i.kind==="loading"?null:i.kind==="found"?e.jsx(Y,{task:i.task}):i.kind==="failed"?e.jsx(j,{anchor:null,anchorKey:"failed",labelledBy:r,children:e.jsx("div",{id:r,className:"p-4",children:e.jsx(K,{title:"Couldn't open this task",error:i.error,onRetry:i.retry,compact:!0})})}):e.jsx(j,{anchor:null,anchorKey:"gone",labelledBy:r,children:e.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[e.jsx("h2",{id:r,className:"text-base font-medium text-fg",children:"This task was deleted or moved"}),e.jsx("button",{ref:u,type:"button",onClick:l,className:"self-end rounded-md border border-line px-3 py-1.5 text-sm font-medium hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",children:"Close"})]})})}function Y({task:t}){const{taskLists:i}=F(),{closeToView:l}=S(),{updateTask:r,deleteTask:u,isWriting:c}=H(),f=d.useId(),x=d.useRef(null),[g,p]=d.useState(),[m,h]=d.useState(null),{calendarTaskId:s}=t;d.useLayoutEffect(()=>{h(document.querySelector(`[data-task-id="${CSS.escape(s)}"]`))},[s]),d.useEffect(()=>{x.current?.focus()},[]);const o=P(),n=t.allDay?t.due:B(t.due,o),I={title:t.summary,dueDate:n.slice(0,10),dueTime:t.allDay?"":n.slice(11,16),description:t.description},b=a=>N=>{if(N.kind==="written"){p(void 0);return}const T=`Couldn't save the task: ${N.message}`;p({text:T,reportHref:V(T),onRetry:a})},y=()=>{r(t,{completed:!t.completed}).then(b(y))},C=a=>{r(t,{summary:a.title,description:a.description,allDay:a.dueTime==="",due:a.dueTime===""?a.dueDate:L(a.dueDate,a.dueTime,o)}).then(b(()=>C(a)))},k=()=>{u(t).then(a=>{if(a.kind==="written"){l();return}b(k)(a)})};return e.jsx(j,{anchor:m,anchorKey:`${s}:${m?"chip":"none"}`,labelledBy:f,children:e.jsx(W,{headingId:f,headingRef:x,fields:I,dueText:U(n,t.allDay),listName:i.find(a=>a.id===t.calendarId)?.name??"Tasks",completed:t.completed,onToggle:y,onSave:C,onDelete:k,onClose:l,busy:c,failure:g})})}function oe(){const{calendarTaskId:t}=q.useParams();return e.jsx(X,{calendarTaskId:t})}export{oe as component};
1
+ import{b as w,r as d,j as e,T as R,X as E,p as z,C as $,em as B,c3 as L,eY as q}from"./index-BZ4sAts4.js";import{b as F,f as P,c as V}from"./useCalendarSuggestions-D58tKJtx.js";import{b as Z,C as j,u as H}from"./useCalendarTasks-DLNYnUeu.js";import"./nav-link-BvBkmH1H.js";import{b as S}from"./calendar-SMIdRsx9.js";import"./reply-D8bLYzum.js";import{C as K}from"./CalendarLoadFailed-ClpqypbH.js";import{C as M}from"./calendar-event-popup-DqvJLPWt.js";import"./ErrorState-nIG-x-Zh.js";import"./useQueries-B-X1sW9_.js";import"./useMediaQuery-D3m_n689.js";import"./pencil-Py3MXttE.js";const A=w("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);const O=w("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),D="flex size-9 items-center justify-center rounded-full text-fg-muted outline-none hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-40",v="h-9 w-full rounded-md border border-line bg-surface-sunken px-2 text-sm text-fg outline-none focus-visible:ring-2 focus-visible:ring-ring/30";function W({headingId:t,headingRef:i,fields:l,dueText:r,listName:u,completed:c,onToggle:f,onSave:x,onDelete:g,onClose:p,busy:m=!1,failure:h}){const[s,o]=d.useState(null);return e.jsxs("div",{className:"flex flex-col gap-3 p-3",children:[e.jsxs("div",{className:"flex justify-end gap-1",children:[s===null&&e.jsx("button",{type:"button",onClick:()=>o(l),className:"rounded-md px-3 text-sm font-medium text-accent hover:bg-accent-soft focus-visible:ring-2 focus-visible:ring-ring",children:"Edit"}),e.jsx("button",{type:"button","aria-label":"Delete",onClick:g,disabled:m,className:D,children:e.jsx(R,{className:"size-4"})}),e.jsx("button",{type:"button","aria-label":"Close",onClick:p,className:D,children:e.jsx(E,{className:"size-4"})})]}),s===null?e.jsxs("div",{className:"flex flex-col gap-2 px-2",children:[e.jsx("h2",{id:t,ref:i,tabIndex:-1,className:z("text-xl font-normal break-words text-fg outline-none",c&&"text-fg-muted line-through"),children:l.title===""?"(No title)":l.title}),e.jsx("p",{className:"text-sm text-fg-muted",children:r}),e.jsxs("p",{className:"flex items-center gap-2 text-sm",children:[e.jsx($,{className:"size-4 text-fg-subtle","aria-label":"List"}),u]}),l.description!==""&&e.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:l.description})]}):e.jsxs("form",{className:"flex flex-col gap-2 px-2",onSubmit:n=>{n.preventDefault(),x(s),o(null)},children:[e.jsx("h2",{id:t,className:"sr-only",children:"Edit task"}),e.jsx("input",{"aria-label":"Title",value:s.title,onChange:n=>o({...s,title:n.target.value}),className:v}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"date","aria-label":"Due date",value:s.dueDate,onChange:n=>n.target.value!==""&&o({...s,dueDate:n.target.value}),className:v}),e.jsx("input",{type:"time","aria-label":"Due time",value:s.dueTime,onChange:n=>o({...s,dueTime:n.target.value}),className:v})]}),e.jsx("textarea",{"aria-label":"Description",rows:3,value:s.description,onChange:n=>o({...s,description:n.target.value}),className:"w-full rounded-md border border-line bg-surface-sunken px-2 py-1 text-sm"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:()=>o(null),className:"h-9 rounded-md border border-line px-3 text-sm font-medium",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:m,className:"h-9 rounded-md bg-accent px-4 text-sm font-medium text-accent-fg disabled:opacity-50",children:"Save"})]})]}),h&&e.jsx(M,{failure:h}),s===null&&e.jsx("div",{className:"flex justify-end px-2",children:e.jsxs("button",{type:"button",onClick:f,disabled:m,className:"inline-flex h-9 items-center gap-2 rounded-md border border-line px-3 text-sm font-medium hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",children:[c?e.jsx(O,{className:"size-4","aria-hidden":"true"}):e.jsx(A,{className:"size-4","aria-hidden":"true"}),c?"Mark not done":"Mark done"]})})]})}const U=(t,i)=>{const l=new Date(`${t.slice(0,10)}T00:00:00Z`),r=new Intl.DateTimeFormat(void 0,{weekday:"long",day:"numeric",month:"long",timeZone:"UTC"}).format(l);return i?`Due ${r}`:`Due ${r} · ${t.slice(11,16)}`};function X({calendarTaskId:t}){const i=Z(t),{closeToView:l}=S(),r=d.useId(),u=d.useRef(null),c=i.kind==="gone";return d.useEffect(()=>{c&&u.current?.focus()},[c]),i.kind==="loading"?null:i.kind==="found"?e.jsx(Y,{task:i.task}):i.kind==="failed"?e.jsx(j,{anchor:null,anchorKey:"failed",labelledBy:r,children:e.jsx("div",{id:r,className:"p-4",children:e.jsx(K,{title:"Couldn't open this task",error:i.error,onRetry:i.retry,compact:!0})})}):e.jsx(j,{anchor:null,anchorKey:"gone",labelledBy:r,children:e.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[e.jsx("h2",{id:r,className:"text-base font-medium text-fg",children:"This task was deleted or moved"}),e.jsx("button",{ref:u,type:"button",onClick:l,className:"self-end rounded-md border border-line px-3 py-1.5 text-sm font-medium hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",children:"Close"})]})})}function Y({task:t}){const{taskLists:i}=F(),{closeToView:l}=S(),{updateTask:r,deleteTask:u,isWriting:c}=H(),f=d.useId(),x=d.useRef(null),[g,p]=d.useState(),[m,h]=d.useState(null),{calendarTaskId:s}=t;d.useLayoutEffect(()=>{h(document.querySelector(`[data-task-id="${CSS.escape(s)}"]`))},[s]),d.useEffect(()=>{x.current?.focus()},[]);const o=P(),n=t.allDay?t.due:B(t.due,o),I={title:t.summary,dueDate:n.slice(0,10),dueTime:t.allDay?"":n.slice(11,16),description:t.description},b=a=>N=>{if(N.kind==="written"){p(void 0);return}const T=`Couldn't save the task: ${N.message}`;p({text:T,reportHref:V(T),onRetry:a})},y=()=>{r(t,{completed:!t.completed}).then(b(y))},C=a=>{r(t,{summary:a.title,description:a.description,allDay:a.dueTime==="",due:a.dueTime===""?a.dueDate:L(a.dueDate,a.dueTime,o)}).then(b(()=>C(a)))},k=()=>{u(t).then(a=>{if(a.kind==="written"){l();return}b(k)(a)})};return e.jsx(j,{anchor:m,anchorKey:`${s}:${m?"chip":"none"}`,labelledBy:f,children:e.jsx(W,{headingId:f,headingRef:x,fields:I,dueText:U(n,t.allDay),listName:i.find(a=>a.id===t.calendarId)?.name??"Tasks",completed:t.completed,onToggle:y,onSave:C,onDelete:k,onClose:l,busy:c,failure:g})})}function oe(){const{calendarTaskId:t}=q.useParams();return e.jsx(X,{calendarTaskId:t})}export{oe as component};
@@ -1 +1 @@
1
- import{b as a}from"./index-Bn8n_AsE.js";const d=a("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);export{d as U};
1
+ import{b as a}from"./index-BZ4sAts4.js";const d=a("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);export{d as U};
@@ -1,2 +1,2 @@
1
- import{j as l,p as x,B as E,r as f,el as S}from"./index-Bn8n_AsE.js";import{p as A,b as L,f as O,o as W,t as Z,U as B,n as P,q as U,i as F,r as M}from"./useCalendarSuggestions-Bb4PGHae.js";import{a as q,t as z}from"./useCalendarTasks-RmI_Ij1j.js";const K=[{scope:"this",label:"This event",note:"Leaves the rest of the series alone"},{scope:"following",label:"This and everything after",note:"Splits the series here"},{scope:"all",label:"The whole series",note:"Rewrites the rule itself"}];function Q({title:e,ruleText:s,instanceText:n,onChoose:t,onCancel:r,scopes:a,touch:o,className:d}){return l.jsxs("div",{className:x("flex flex-col gap-3",d),children:[l.jsxs("div",{children:[l.jsxs("h2",{className:"text-md font-semibold text-fg",children:[e," repeats"]}),l.jsx("p",{className:"text-xs text-fg-muted",children:s}),l.jsxs("p",{className:"text-xs text-fg-subtle",children:["You clicked ",n,"."]})]}),l.jsx("p",{className:"text-sm text-fg",children:"What should the change apply to?"}),l.jsx("div",{className:"flex flex-col gap-1.5",children:K.filter(c=>a===void 0||a.includes(c.scope)).map(c=>l.jsxs("button",{type:"button",onClick:()=>t(c.scope),className:x("flex flex-col rounded-md border border-line bg-surface px-3 py-2 text-left outline-none transition-colors hover:border-line-strong hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",o&&"min-h-11 justify-center"),children:[l.jsx("span",{className:"text-sm font-medium text-fg",children:c.label}),l.jsx("span",{className:"text-2xs text-fg-subtle",children:c.note})]},c.scope))}),l.jsx(E,{variant:"ghost",size:o?"md":"sm",onClick:r,className:x("self-start",o&&"min-h-11"),children:"Cancel"})]})}const C=e=>e.replace(/\r?\n[ \t]/g,""),I=e=>e.replace(/\\n/gi,`
1
+ import{j as l,p as x,B as E,r as f,el as S}from"./index-BZ4sAts4.js";import{p as A,b as L,f as O,o as W,t as Z,U as B,n as P,q as U,i as F,r as M}from"./useCalendarSuggestions-D58tKJtx.js";import{a as q,t as z}from"./useCalendarTasks-DLNYnUeu.js";const K=[{scope:"this",label:"This event",note:"Leaves the rest of the series alone"},{scope:"following",label:"This and everything after",note:"Splits the series here"},{scope:"all",label:"The whole series",note:"Rewrites the rule itself"}];function Q({title:e,ruleText:s,instanceText:n,onChoose:t,onCancel:r,scopes:a,touch:o,className:d}){return l.jsxs("div",{className:x("flex flex-col gap-3",d),children:[l.jsxs("div",{children:[l.jsxs("h2",{className:"text-md font-semibold text-fg",children:[e," repeats"]}),l.jsx("p",{className:"text-xs text-fg-muted",children:s}),l.jsxs("p",{className:"text-xs text-fg-subtle",children:["You clicked ",n,"."]})]}),l.jsx("p",{className:"text-sm text-fg",children:"What should the change apply to?"}),l.jsx("div",{className:"flex flex-col gap-1.5",children:K.filter(c=>a===void 0||a.includes(c.scope)).map(c=>l.jsxs("button",{type:"button",onClick:()=>t(c.scope),className:x("flex flex-col rounded-md border border-line bg-surface px-3 py-2 text-left outline-none transition-colors hover:border-line-strong hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",o&&"min-h-11 justify-center"),children:[l.jsx("span",{className:"text-sm font-medium text-fg",children:c.label}),l.jsx("span",{className:"text-2xs text-fg-subtle",children:c.note})]},c.scope))}),l.jsx(E,{variant:"ghost",size:o?"md":"sm",onClick:r,className:x("self-start",o&&"min-h-11"),children:"Cancel"})]})}const C=e=>e.replace(/\r?\n[ \t]/g,""),I=e=>e.replace(/\\n/gi,`
2
2
  `).replace(/\\,/g,",").replace(/\\;/g,";").replace(/\\\\/g,"\\");function g(e,s){let n=!1;for(let t=s.length;t<e.length;t+=1){const r=e[t];if(t===s.length&&r!==";"&&r!==":")return;if(r==='"'){n=!n;continue}if(!n&&r===":")return e.slice(t+1).trim()}}function v(e,s){for(const n of C(e).split(/\r?\n/)){if(!n.startsWith(s))continue;const t=g(n,s);if(t!==void 0)return t}return""}const X=e=>v(e,"RRULE"),$=e=>({location:I(v(e,"LOCATION")),description:I(v(e,"DESCRIPTION"))});function ee(e,s){const n=C(e).split(/\r?\n/).find(r=>r.startsWith("DTSTART")&&g(r,"DTSTART")!==void 0);if(n===void 0)return A(s);const t=/;TZID="?([^;:"]+)"?/i.exec(n)?.[1];return t!==void 0?Intl.supportedValuesOf("timeZone").includes(t)?t:s:g(n,"DTSTART")?.toUpperCase().endsWith("Z")?"":s}function V(e,s){const n=e.map(a=>a.id);if(s.length===0)return n;const t=new Set(s),r=n.filter(a=>t.has(a));return r.length===0?n:r}function Y(e){const{calendars:s,colorByCalendarId:n,timeZoneByCalendarId:t,isLoading:r}=L(),a=V(s,e),o=a.length===s.length?[]:a,d=e.length===0||s.length>0;return{calendars:s,colorByCalendarId:n,timeZoneByCalendarId:t,shown:a,narrowed:o,resolved:d,isLoading:r}}function _(e,s,n){const t=n.join(",");return f.useMemo(()=>{const r=O(),a=new Set(t===""?[]:t.split(","));return e.filter(o=>W(o)&&a.has(o.calendarId)).map(o=>Z(o,s[o.calendarId]??B,r))},[e,s,t])}function se({view:e,date:s,calendarIds:n,enabled:t=!0}){const{calendars:r,colorByCalendarId:a,timeZoneByCalendarId:o,shown:d,narrowed:c,resolved:j,isLoading:N}=Y(n),w=S(e,s),h=t&&j,i=P({...w,calendarIds:c,enabled:h});U(e,s,c,h);const k=_(i.instances,o,d),p=q(w,h),m=p.tasks,D=f.useMemo(()=>m.map(z),[m]),T=i.refetch,b=p.refetch,y=f.useCallback(()=>{T(),b()},[T,b]),R=f.useMemo(()=>new Set(i.instances.filter(u=>u.transparency==="Transparent").map(u=>F(u.calendarObjectId,u.recurrenceId))),[i.instances]);return{calendars:r,events:k,colorByCalendarId:a,timeZoneByCalendarId:o,isLoading:N||i.isLoading,error:i.error??p.error,retry:y,storedTasks:m,tasks:D,instanceOf:M,freeIds:R}}export{Q as R,_ as a,V as b,se as c,X as r,ee as s,$ as t,Y as u};
@@ -1 +1 @@
1
- import{e as b,a as f,c as S,b2 as m,f as y,b4 as g,r as d,cu as M,ct as p,aP as I,bS as h}from"./index-Bn8n_AsE.js";import{u as x}from"./useQueries-Bs7-L_2j.js";import{u as O}from"./useDebouncedValue-I0sDLoIF.js";function Q(){const s=b(),{data:a}=f({...S(),staleTime:6e4}),{data:o}=f(m()),r=y(g()),i=d.useMemo(()=>(a?.accounts??[]).filter(n=>n.syncedServices.includes("Mail")).map(n=>({accountId:n.accountId,email:n.email})),[a?.accounts]),l=o?.defaultInvitationSenderAccountId,c=d.useCallback(async n=>{await r.mutateAsync({body:{defaultInvitationSenderAccountId:n}}),await s.invalidateQueries({queryKey:m().queryKey})},[r,s]);return{senders:i,defaultSenderId:l,setDefaultSender:c}}const E=2;function w(s){const a=O(s.trim(),200),{data:o}=f({...h({query:{q:a,limit:8}}),enabled:a.length>=E});return d.useMemo(()=>(o?.items??[]).map(r=>({email:r.normalizedEmail,name:r.displayName??""})),[o?.items])}const q=["sent","unfiled","failed","blocked"],v=["failed","blocked"];function A(s){const a=b(),o=y(M()),r=x({queries:s.map(e=>({...p({path:{outboxMessageId:e.outboxMessageId}}),meta:{softErrorStatuses:[404]},retry:!1,refetchInterval:u=>{if(u.state.error)return!1;const t=u.state.data?.status;return t&&q.includes(t)?!1:1500}}))}),i=s.flatMap((e,u)=>{const t=r[u];return!t?.error||I(t.error)===404?[]:[{send:e,error:t.error,refetch:t.refetch}]}),l=()=>{for(const e of i)e.refetch()},c=s.filter((e,u)=>{const t=r[u]?.data?.status;return t!==void 0&&v.includes(t)}),n=d.useCallback(async()=>{for(const e of c)await o.mutateAsync({path:{outboxMessageId:e.outboxMessageId}}),await a.invalidateQueries({queryKey:p({path:{outboxMessageId:e.outboxMessageId}}).queryKey})},[c,o,a]);return{missed:c.map(e=>e.email),retry:n,checkError:i[0]?.error??null,unchecked:i.map(e=>e.send.email),recheck:l}}export{A as a,w as b,Q as u};
1
+ import{e as b,a as f,c as S,b2 as m,f as y,b4 as g,r as d,cu as M,ct as p,aP as I,bS as h}from"./index-BZ4sAts4.js";import{u as x}from"./useQueries-B-X1sW9_.js";import{u as O}from"./useDebouncedValue-CMBraotV.js";function Q(){const s=b(),{data:a}=f({...S(),staleTime:6e4}),{data:o}=f(m()),r=y(g()),i=d.useMemo(()=>(a?.accounts??[]).filter(n=>n.syncedServices.includes("Mail")).map(n=>({accountId:n.accountId,email:n.email})),[a?.accounts]),l=o?.defaultInvitationSenderAccountId,c=d.useCallback(async n=>{await r.mutateAsync({body:{defaultInvitationSenderAccountId:n}}),await s.invalidateQueries({queryKey:m().queryKey})},[r,s]);return{senders:i,defaultSenderId:l,setDefaultSender:c}}const E=2;function w(s){const a=O(s.trim(),200),{data:o}=f({...h({query:{q:a,limit:8}}),enabled:a.length>=E});return d.useMemo(()=>(o?.items??[]).map(r=>({email:r.normalizedEmail,name:r.displayName??""})),[o?.items])}const q=["sent","unfiled","failed","blocked"],v=["failed","blocked"];function A(s){const a=b(),o=y(M()),r=x({queries:s.map(e=>({...p({path:{outboxMessageId:e.outboxMessageId}}),meta:{softErrorStatuses:[404]},retry:!1,refetchInterval:u=>{if(u.state.error)return!1;const t=u.state.data?.status;return t&&q.includes(t)?!1:1500}}))}),i=s.flatMap((e,u)=>{const t=r[u];return!t?.error||I(t.error)===404?[]:[{send:e,error:t.error,refetch:t.refetch}]}),l=()=>{for(const e of i)e.refetch()},c=s.filter((e,u)=>{const t=r[u]?.data?.status;return t!==void 0&&v.includes(t)}),n=d.useCallback(async()=>{for(const e of c)await o.mutateAsync({path:{outboxMessageId:e.outboxMessageId}}),await a.invalidateQueries({queryKey:p({path:{outboxMessageId:e.outboxMessageId}}).queryKey})},[c,o,a]);return{missed:c.map(e=>e.email),retry:n,checkError:i[0]?.error??null,unchecked:i.map(e=>e.send.email),recheck:l}}export{A as a,w as b,Q as u};
@@ -1 +1 @@
1
- import{b as X,aw as w,ax as Q,em as N,a as C,en as ee,r as d,e as v,s as y,f as m,eo as te,ep as ne,eq as ae,aP as A,a$ as se,aZ as re,a_ as oe,er as ie,c1 as B,es as h,el as ce,c6 as de,et as le,eu as ue,ev as ge,ew as pe,ex as fe,ey as me,ez as Ce,eA as ye}from"./index-Bn8n_AsE.js";import{f as I}from"./ErrorState-BXxvOnci.js";import{u as G}from"./useQueries-Bs7-L_2j.js";const Fe=X("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]),be={"cal-1":{solid:"bg-cal-1",soft:"bg-cal-1-soft",text:"text-cal-1",border:"border-cal-1",rail:"border-l-cal-1"},"cal-2":{solid:"bg-cal-2",soft:"bg-cal-2-soft",text:"text-cal-2",border:"border-cal-2",rail:"border-l-cal-2"},"cal-3":{solid:"bg-cal-3",soft:"bg-cal-3-soft",text:"text-cal-3",border:"border-cal-3",rail:"border-l-cal-3"},"cal-4":{solid:"bg-cal-4",soft:"bg-cal-4-soft",text:"text-cal-4",border:"border-cal-4",rail:"border-l-cal-4"},"cal-5":{solid:"bg-cal-5",soft:"bg-cal-5-soft",text:"text-cal-5",border:"border-cal-5",rail:"border-l-cal-5"},"cal-6":{solid:"bg-cal-6",soft:"bg-cal-6-soft",text:"text-cal-6",border:"border-cal-6",rail:"border-l-cal-6"}};function We(e){return be[e]}function je(e){return w(Q({title:`Calendar invitation: ${e}`,errorMessage:e}))}function Ue(e){return w(Q({title:`Calendar event: ${e}`,errorMessage:e}))}const K=()=>Intl.DateTimeFormat().resolvedOptions().timeZone,x="";function $e(e){if(e!==x)return e;const t=K();return Intl.supportedValuesOf("timeZone").includes(t)?t:x}const Ee={Cal1:"cal-1",Cal2:"cal-2",Cal3:"cal-3",Cal4:"cal-4",Cal5:"cal-5",Cal6:"cal-6"},Z={Unscheduled:"accepted",Organizer:"accepted",Accepted:"accepted",Tentative:"tentative",Declined:"declined",NeedsAction:"noReply"},we=e=>Z[e],Oe={Local:"local",Explicit:"explicit",Ambiguous:"ambiguous"},z="#";function he(e,t){return t===""?e:`${e}${z}${t}`}function R(e){const t=e.indexOf(z);return t===-1?{calendarObjectId:e,recurrenceId:""}:{calendarObjectId:e.slice(0,t),recurrenceId:e.slice(t+1)}}const H=(e,t)=>{const n=[...e].sort((a,r)=>Date.parse(a.start)-Date.parse(r.start));return n.find(a=>Date.parse(a.end)>Date.parse(t))??n[0]};function Qe(e,t,n){const a=H(e.filter(r=>{const o=R(r.id);return o.calendarObjectId===t&&o.recurrenceId!==""}),n);return a?R(a.id):void 0}function q(e,t,n,a){const r=H(e.filter(o=>o.calendarObjectId===t&&ve(o)).map(o=>Se(o,"",a)),n);if(r)return{...R(r.id),calendarId:r.calendarId,date:r.start.slice(0,10)}}function F(e){return{id:e.calendarId,accountId:e.accountConfigId,accountLabel:"",name:e.displayName,color:Ee[e.color]??"cal-1",...e.source==="Subscribed"?{readOnly:!0,sync:e.subscriptionEnabled?"live":"paused",syncError:e.subscriptionError}:{}}}function Se(e,t,n){return{id:he(e.calendarObjectId,e.recurrenceId),calendarId:e.calendarId,title:e.summary,start:e.allDay?e.start.slice(0,10):N(e.start,n),end:e.allDay?e.end.slice(0,10):N(e.end,n),allDay:e.allDay,location:"",notes:"",attendees:[],myRsvp:Z[e.participation],threadId:"",threadSubject:"",timeZone:t,zoneCertainty:Oe[e.zoneCertainty]??"explicit",recurrenceRule:e.hasRecurrence?"Repeats":"",seriesId:e.hasRecurrence?e.icalUid:"",seriesException:!1,status:e.status==="Tentative"?"tentative":"confirmed"}}const ve=e=>e.status!=="Cancelled";function Be(){const{data:e,isLoading:t,error:n,refetch:a}=C(ee());return d.useMemo(()=>{const r=e?.items??[],o=r.filter(i=>i.componentSet!=="VtodoOnly"),l=o.map(F),s=r.filter(i=>i.componentSet==="VtodoOnly").map(F);return{calendars:l,taskLists:s,collections:r,colorByCalendarId:Object.fromEntries(l.map(i=>[i.id,i.color])),timeZoneByCalendarId:Object.fromEntries(r.map(i=>[i.calendarId,i.timezone])),defaultCalendarId:(o.find(i=>i.source==="Default")??o[0])?.calendarId??"",isLoading:t,error:n??null,retry:()=>{a()}}},[e,t,n,a])}const D=y(400,404,412),Ae=new Set(["calendarEventOperationsListCalendarEvents","calendarEventDetailOperationsGetCalendarEvent","calendarFreeBusyOperationsListCalendarFreeBusy","calendarTaskOperationsListCalendarTasks","calendarTaskDetailOperationsGetCalendarTask"]),W=e=>A(e)===412?{kind:"conflict"}:{kind:"refused",message:I(e)},Ie={this:"This",following:"Following",all:"All"};function V(){const e=v();return d.useCallback(()=>{e.invalidateQueries({predicate:t=>{const n=t.queryKey[0];if(typeof n!="object"||n===null)return!1;const a=n._id;return typeof a=="string"&&Ae.has(a)}})},[e])}const j=({scope:e,recurrenceId:t})=>e===void 0?{}:{scope:Ie[e],recurrenceId:t};function Ge(){const e=V(),t=m({...te(),meta:D,onSuccess:e}),n=m({...ne(),meta:D,onSuccess:e}),a=m({...ae(),meta:D,onSuccess:e}),r=d.useCallback(s=>t.mutateAsync({body:s}).then(i=>({kind:"created",calendarObjectId:i.calendarObjectId,sends:i.sends})).catch(i=>A(i)===412?{kind:"conflict"}:{kind:"refused",message:I(i)}),[t]),o=d.useCallback((s,i)=>n.mutateAsync({path:{calendarObjectId:s.calendarObjectId},query:{calendarId:s.calendarId,...j(s)},headers:{"If-Match":s.etag},body:i}).then(g=>({kind:"written",sends:g.sends})).catch(W),[n]),l=d.useCallback(s=>a.mutateAsync({path:{calendarObjectId:s.calendarObjectId},query:{calendarId:s.calendarId,...j(s)},headers:{"If-Match":s.etag}}).then(i=>({kind:"written",sends:i.sends})).catch(W),[a]);return d.useMemo(()=>({createEvent:r,updateEvent:o,deleteEvent:l,isWriting:t.isPending||n.isPending||a.isPending}),[r,o,l,t.isPending,n.isPending,a.isPending])}const M=y(400,404),L={kind:"written"},P=e=>({kind:"refused",message:I(e)});function Ke(){const e=v(),t=V(),n=d.useCallback(()=>e.invalidateQueries({queryKey:se()}),[e]),a=d.useCallback(()=>(t(),n()),[t,n]),r=m({...re(),meta:M,onSuccess:n}),o=m({...oe(),meta:M,onSuccess:a}),l=m({...ie(),meta:M,onSuccess:a}),s=d.useCallback(c=>r.mutateAsync({body:c}).then(()=>L).catch(P),[r]),i=d.useCallback((c,p)=>o.mutateAsync({path:{calendarId:c},body:p}).then(()=>L).catch(P),[o]),g=d.useCallback(c=>l.mutateAsync({path:{calendarId:c}}).then(()=>L).catch(P),[l]);return d.useMemo(()=>({createCalendar:s,updateCalendar:i,deleteCalendar:g,isWriting:r.isPending||o.isPending||l.isPending}),[s,i,g,r.isPending,o.isPending,l.isPending])}const ke=y(404);function Ze(e,t){const{data:n,isLoading:a,error:r,refetch:o}=C({...B({path:{calendarObjectId:e},query:{calendarId:t}}),meta:ke,enabled:e!==""&&t!==""});return{resource:n,isLoading:a,error:r,refetch:()=>{o()}}}const Y=y(400,404),k=5*6e4,T=({from:e,to:t,calendarIds:n})=>({query:n.length===0?{from:e,to:t}:{from:e,to:t,calendarId:[...n]}});function ze(e){const{data:t,isLoading:n,error:a,refetch:r}=C({...h(T(e)),meta:Y,staleTime:k,enabled:e.enabled??!0});return{instances:t?.items??[],isLoading:n,error:a,refetch:()=>{r()}}}function He(e,t,n){const a=G({queries:e.map(c=>({...h(T({...c,calendarIds:t})),meta:Y,staleTime:k,enabled:n}))}),r=e.map(c=>c.from).join("|"),o=a.map(c=>c.data),l=a.map(c=>c.isPending).join("|"),s=a.find(c=>c.error)?.error??null,i=d.useMemo(()=>o.flatMap(c=>c?.items??[]),[r,l]),g=d.useMemo(()=>{const c=new Set;return e.forEach((p,u)=>{a[u]?.isPending&&c.add(p.from)}),c},[r,l]);return{instances:i,pendingWindows:g,error:s,refetch:()=>{for(const c of a)c.error&&c.refetch()}}}function Ve(e,t,n,a){const r=v(),o=[...n].join(",");d.useEffect(()=>{if(!a)return;const l=o===""?[]:o.split(",");for(const s of[-1,1]){const i=ce(e,de(t,e,s));r.prefetchQuery({...h(T({...i,calendarIds:l})),staleTime:k})}},[r,e,t,o,a])}const De=y(400,404);function Ye(e){const t=G({queries:e.map(s=>({...le({query:{from:s.from,to:s.to}}),meta:De,staleTime:k}))}),n=e.map(s=>s.from).join("|"),a=t.map(s=>s.data),r=t.map(s=>s.isPending).join("|"),o=d.useMemo(()=>a.flatMap(s=>s?.items??[]),[n,r]),l=d.useMemo(()=>{const s=new Set;return e.forEach((i,g)=>{t[g]?.isPending&&s.add(i.from)}),s},[n,r]);return{spans:o,pendingWindows:l,error:t.find(s=>s.error)?.error??null,refetch:()=>{for(const s of t)s.error&&s.refetch()}}}const U=365*24*60*6e4,Me=1440*6e4,$=y(),Le=y(404),S=e=>new Date(e).toISOString().replace(/\.\d{3}Z$/,"+00:00"),Pe=e=>{const t=e instanceof Error&&e.message!==""?e.message:"no reason given",n=A(e);return n===void 0?t:`${t} (HTTP ${n})`};function Je(e,t){const[n]=d.useState(()=>Date.now()),a=K(),r=new Date(n).toISOString(),o=C({...h({query:{from:S(n),to:S(n+U),calendarObjectId:e}}),meta:$,retry:!1,enabled:t}),l=o.data?q(o.data.items,e,r,a):void 0,s=C({...B({path:{calendarObjectId:e}}),meta:Le,retry:!1,enabled:t&&o.data!==void 0&&l===void 0}),i=Date.parse(s.data?.dtStart??""),g=s.data!==void 0&&Number.isNaN(i),c=Number.isNaN(i)?0:i-Me,p=C({...h({query:{from:S(c),to:S(c+U),calendarObjectId:e}}),meta:$,retry:!1,enabled:t&&s.data!==void 0&&!g}),u=p.data?q(p.data.items,e,r,a):void 0;if(!t)return{kind:"Idle"};if(l)return{kind:"Found",jump:l};if(u)return{kind:"Found",jump:u};const f=A(s.error)===404,_=[o.error,f?null:s.error,p.error].find(J=>J!==null);return _!==void 0?{kind:"Failed",reason:Pe(_)}:f?{kind:"Deleted"}:g?{kind:"Failed",reason:`the stored event names no readable start (${s.data?.dtStart??""})`}:p.data!==void 0?{kind:"NoOccurrenceFound"}:{kind:"Searching"}}const b=y(400,404),Re=new Set(["calendarSuggestionOperationsListCalendarSuggestions","messageCalendarSuggestionOperationsListMessageCalendarSuggestions","calendarEventOperationsListCalendarEvents","calendarEventDetailOperationsGetCalendarEvent","calendarFreeBusyOperationsListCalendarFreeBusy","filterOperationsListFilters"]),Te=e=>e.invalidateQueries({predicate:t=>{const n=t.queryKey[0];if(typeof n!="object"||n===null)return!1;const a=n._id;return typeof a=="string"&&Re.has(a)}});function Xe(e){const{data:t,isLoading:n,error:a}=C({...ue({path:{messageId:e}}),meta:b});return{suggestions:t?.items??[],isLoading:n,error:a??null}}function et(){const{data:e,isLoading:t,error:n}=C({...Ce({query:{state:"Pending"}}),meta:b});return{suggestions:e?.items??[],isLoading:t,error:n??null}}const _e=async(e,t)=>{let n;do{const{data:a}=await ye({query:{state:"Pending",continuationToken:n},signal:t,throwOnError:!0}),r=a.items.find(o=>o.suggestionId===e);if(r)return r;n=a.continuationToken}while(n);return null};function tt(e){const{data:t,isLoading:n,error:a}=C({queryKey:[{_id:"calendarSuggestionOperationsListCalendarSuggestions",suggestionId:e}],queryFn:({signal:r})=>_e(e,r),meta:b});return{suggestion:t,isLoading:n,error:a??null}}const E={kind:"answered"},O=e=>({kind:"refused",message:I(e)});function nt(){const e=v(),t=d.useCallback(()=>Te(e),[e]),n=m({...ge(),meta:b,onSuccess:t}),a=m({...pe(),meta:b,onSuccess:t}),r=m({...fe(),meta:b,onSuccess:t}),o=m({...me(),meta:b,onSuccess:t}),l=d.useCallback((u,f)=>n.mutateAsync({path:{suggestionId:u},body:{calendarId:f}}).then(()=>E).catch(O),[n]),s=d.useCallback((u,f)=>n.mutateAsync({path:{suggestionId:u},body:{calendarId:f,answer:"Tentative"}}).then(()=>E).catch(O),[n]),i=d.useCallback((u,f)=>n.mutateAsync({path:{suggestionId:u},body:f}).then(()=>E).catch(O),[n]),g=d.useCallback(u=>a.mutateAsync({path:{suggestionId:u}}).then(()=>E).catch(O),[a]),c=d.useCallback((u,f)=>r.mutateAsync({path:{suggestionId:u},body:{muteSender:f}}).then(()=>E).catch(O),[r]),p=d.useCallback(u=>o.mutateAsync({path:{suggestionId:u}}).then(()=>E).catch(O),[o]);return d.useMemo(()=>({accept:l,tentative:s,acceptEdited:i,decline:g,dismiss:c,reopen:p,isAnswering:n.isPending||a.isPending||r.isPending||o.isPending}),[l,s,i,g,c,p,n.isPending,a.isPending,r.isPending,o.isPending])}export{D as C,Fe as M,x as U,V as a,Be as b,Ue as c,We as d,Ge as e,K as f,He as g,Ye as h,he as i,et as j,nt as k,je as l,Xe as m,ze as n,ve as o,$e as p,Ve as q,R as r,Ze as s,Se as t,Ke as u,Qe as v,Je as w,we as x,tt as y};
1
+ import{b as X,aw as w,ax as Q,em as N,a as C,en as ee,r as d,e as v,s as y,f as m,eo as te,ep as ne,eq as ae,aP as A,a$ as se,aZ as re,a_ as oe,er as ie,c1 as B,es as h,el as ce,c6 as de,et as le,eu as ue,ev as ge,ew as pe,ex as fe,ey as me,ez as Ce,eA as ye}from"./index-BZ4sAts4.js";import{f as I}from"./ErrorState-nIG-x-Zh.js";import{u as G}from"./useQueries-B-X1sW9_.js";const Fe=X("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]),be={"cal-1":{solid:"bg-cal-1",soft:"bg-cal-1-soft",text:"text-cal-1",border:"border-cal-1",rail:"border-l-cal-1"},"cal-2":{solid:"bg-cal-2",soft:"bg-cal-2-soft",text:"text-cal-2",border:"border-cal-2",rail:"border-l-cal-2"},"cal-3":{solid:"bg-cal-3",soft:"bg-cal-3-soft",text:"text-cal-3",border:"border-cal-3",rail:"border-l-cal-3"},"cal-4":{solid:"bg-cal-4",soft:"bg-cal-4-soft",text:"text-cal-4",border:"border-cal-4",rail:"border-l-cal-4"},"cal-5":{solid:"bg-cal-5",soft:"bg-cal-5-soft",text:"text-cal-5",border:"border-cal-5",rail:"border-l-cal-5"},"cal-6":{solid:"bg-cal-6",soft:"bg-cal-6-soft",text:"text-cal-6",border:"border-cal-6",rail:"border-l-cal-6"}};function We(e){return be[e]}function je(e){return w(Q({title:`Calendar invitation: ${e}`,errorMessage:e}))}function Ue(e){return w(Q({title:`Calendar event: ${e}`,errorMessage:e}))}const K=()=>Intl.DateTimeFormat().resolvedOptions().timeZone,x="";function $e(e){if(e!==x)return e;const t=K();return Intl.supportedValuesOf("timeZone").includes(t)?t:x}const Ee={Cal1:"cal-1",Cal2:"cal-2",Cal3:"cal-3",Cal4:"cal-4",Cal5:"cal-5",Cal6:"cal-6"},Z={Unscheduled:"accepted",Organizer:"accepted",Accepted:"accepted",Tentative:"tentative",Declined:"declined",NeedsAction:"noReply"},we=e=>Z[e],Oe={Local:"local",Explicit:"explicit",Ambiguous:"ambiguous"},z="#";function he(e,t){return t===""?e:`${e}${z}${t}`}function R(e){const t=e.indexOf(z);return t===-1?{calendarObjectId:e,recurrenceId:""}:{calendarObjectId:e.slice(0,t),recurrenceId:e.slice(t+1)}}const H=(e,t)=>{const n=[...e].sort((a,r)=>Date.parse(a.start)-Date.parse(r.start));return n.find(a=>Date.parse(a.end)>Date.parse(t))??n[0]};function Qe(e,t,n){const a=H(e.filter(r=>{const o=R(r.id);return o.calendarObjectId===t&&o.recurrenceId!==""}),n);return a?R(a.id):void 0}function q(e,t,n,a){const r=H(e.filter(o=>o.calendarObjectId===t&&ve(o)).map(o=>Se(o,"",a)),n);if(r)return{...R(r.id),calendarId:r.calendarId,date:r.start.slice(0,10)}}function F(e){return{id:e.calendarId,accountId:e.accountConfigId,accountLabel:"",name:e.displayName,color:Ee[e.color]??"cal-1",...e.source==="Subscribed"?{readOnly:!0,sync:e.subscriptionEnabled?"live":"paused",syncError:e.subscriptionError}:{}}}function Se(e,t,n){return{id:he(e.calendarObjectId,e.recurrenceId),calendarId:e.calendarId,title:e.summary,start:e.allDay?e.start.slice(0,10):N(e.start,n),end:e.allDay?e.end.slice(0,10):N(e.end,n),allDay:e.allDay,location:"",notes:"",attendees:[],myRsvp:Z[e.participation],threadId:"",threadSubject:"",timeZone:t,zoneCertainty:Oe[e.zoneCertainty]??"explicit",recurrenceRule:e.hasRecurrence?"Repeats":"",seriesId:e.hasRecurrence?e.icalUid:"",seriesException:!1,status:e.status==="Tentative"?"tentative":"confirmed"}}const ve=e=>e.status!=="Cancelled";function Be(){const{data:e,isLoading:t,error:n,refetch:a}=C(ee());return d.useMemo(()=>{const r=e?.items??[],o=r.filter(i=>i.componentSet!=="VtodoOnly"),l=o.map(F),s=r.filter(i=>i.componentSet==="VtodoOnly").map(F);return{calendars:l,taskLists:s,collections:r,colorByCalendarId:Object.fromEntries(l.map(i=>[i.id,i.color])),timeZoneByCalendarId:Object.fromEntries(r.map(i=>[i.calendarId,i.timezone])),defaultCalendarId:(o.find(i=>i.source==="Default")??o[0])?.calendarId??"",isLoading:t,error:n??null,retry:()=>{a()}}},[e,t,n,a])}const D=y(400,404,412),Ae=new Set(["calendarEventOperationsListCalendarEvents","calendarEventDetailOperationsGetCalendarEvent","calendarFreeBusyOperationsListCalendarFreeBusy","calendarTaskOperationsListCalendarTasks","calendarTaskDetailOperationsGetCalendarTask"]),W=e=>A(e)===412?{kind:"conflict"}:{kind:"refused",message:I(e)},Ie={this:"This",following:"Following",all:"All"};function V(){const e=v();return d.useCallback(()=>{e.invalidateQueries({predicate:t=>{const n=t.queryKey[0];if(typeof n!="object"||n===null)return!1;const a=n._id;return typeof a=="string"&&Ae.has(a)}})},[e])}const j=({scope:e,recurrenceId:t})=>e===void 0?{}:{scope:Ie[e],recurrenceId:t};function Ge(){const e=V(),t=m({...te(),meta:D,onSuccess:e}),n=m({...ne(),meta:D,onSuccess:e}),a=m({...ae(),meta:D,onSuccess:e}),r=d.useCallback(s=>t.mutateAsync({body:s}).then(i=>({kind:"created",calendarObjectId:i.calendarObjectId,sends:i.sends})).catch(i=>A(i)===412?{kind:"conflict"}:{kind:"refused",message:I(i)}),[t]),o=d.useCallback((s,i)=>n.mutateAsync({path:{calendarObjectId:s.calendarObjectId},query:{calendarId:s.calendarId,...j(s)},headers:{"If-Match":s.etag},body:i}).then(g=>({kind:"written",sends:g.sends})).catch(W),[n]),l=d.useCallback(s=>a.mutateAsync({path:{calendarObjectId:s.calendarObjectId},query:{calendarId:s.calendarId,...j(s)},headers:{"If-Match":s.etag}}).then(i=>({kind:"written",sends:i.sends})).catch(W),[a]);return d.useMemo(()=>({createEvent:r,updateEvent:o,deleteEvent:l,isWriting:t.isPending||n.isPending||a.isPending}),[r,o,l,t.isPending,n.isPending,a.isPending])}const M=y(400,404),L={kind:"written"},P=e=>({kind:"refused",message:I(e)});function Ke(){const e=v(),t=V(),n=d.useCallback(()=>e.invalidateQueries({queryKey:se()}),[e]),a=d.useCallback(()=>(t(),n()),[t,n]),r=m({...re(),meta:M,onSuccess:n}),o=m({...oe(),meta:M,onSuccess:a}),l=m({...ie(),meta:M,onSuccess:a}),s=d.useCallback(c=>r.mutateAsync({body:c}).then(()=>L).catch(P),[r]),i=d.useCallback((c,p)=>o.mutateAsync({path:{calendarId:c},body:p}).then(()=>L).catch(P),[o]),g=d.useCallback(c=>l.mutateAsync({path:{calendarId:c}}).then(()=>L).catch(P),[l]);return d.useMemo(()=>({createCalendar:s,updateCalendar:i,deleteCalendar:g,isWriting:r.isPending||o.isPending||l.isPending}),[s,i,g,r.isPending,o.isPending,l.isPending])}const ke=y(404);function Ze(e,t){const{data:n,isLoading:a,error:r,refetch:o}=C({...B({path:{calendarObjectId:e},query:{calendarId:t}}),meta:ke,enabled:e!==""&&t!==""});return{resource:n,isLoading:a,error:r,refetch:()=>{o()}}}const Y=y(400,404),k=5*6e4,T=({from:e,to:t,calendarIds:n})=>({query:n.length===0?{from:e,to:t}:{from:e,to:t,calendarId:[...n]}});function ze(e){const{data:t,isLoading:n,error:a,refetch:r}=C({...h(T(e)),meta:Y,staleTime:k,enabled:e.enabled??!0});return{instances:t?.items??[],isLoading:n,error:a,refetch:()=>{r()}}}function He(e,t,n){const a=G({queries:e.map(c=>({...h(T({...c,calendarIds:t})),meta:Y,staleTime:k,enabled:n}))}),r=e.map(c=>c.from).join("|"),o=a.map(c=>c.data),l=a.map(c=>c.isPending).join("|"),s=a.find(c=>c.error)?.error??null,i=d.useMemo(()=>o.flatMap(c=>c?.items??[]),[r,l]),g=d.useMemo(()=>{const c=new Set;return e.forEach((p,u)=>{a[u]?.isPending&&c.add(p.from)}),c},[r,l]);return{instances:i,pendingWindows:g,error:s,refetch:()=>{for(const c of a)c.error&&c.refetch()}}}function Ve(e,t,n,a){const r=v(),o=[...n].join(",");d.useEffect(()=>{if(!a)return;const l=o===""?[]:o.split(",");for(const s of[-1,1]){const i=ce(e,de(t,e,s));r.prefetchQuery({...h(T({...i,calendarIds:l})),staleTime:k})}},[r,e,t,o,a])}const De=y(400,404);function Ye(e){const t=G({queries:e.map(s=>({...le({query:{from:s.from,to:s.to}}),meta:De,staleTime:k}))}),n=e.map(s=>s.from).join("|"),a=t.map(s=>s.data),r=t.map(s=>s.isPending).join("|"),o=d.useMemo(()=>a.flatMap(s=>s?.items??[]),[n,r]),l=d.useMemo(()=>{const s=new Set;return e.forEach((i,g)=>{t[g]?.isPending&&s.add(i.from)}),s},[n,r]);return{spans:o,pendingWindows:l,error:t.find(s=>s.error)?.error??null,refetch:()=>{for(const s of t)s.error&&s.refetch()}}}const U=365*24*60*6e4,Me=1440*6e4,$=y(),Le=y(404),S=e=>new Date(e).toISOString().replace(/\.\d{3}Z$/,"+00:00"),Pe=e=>{const t=e instanceof Error&&e.message!==""?e.message:"no reason given",n=A(e);return n===void 0?t:`${t} (HTTP ${n})`};function Je(e,t){const[n]=d.useState(()=>Date.now()),a=K(),r=new Date(n).toISOString(),o=C({...h({query:{from:S(n),to:S(n+U),calendarObjectId:e}}),meta:$,retry:!1,enabled:t}),l=o.data?q(o.data.items,e,r,a):void 0,s=C({...B({path:{calendarObjectId:e}}),meta:Le,retry:!1,enabled:t&&o.data!==void 0&&l===void 0}),i=Date.parse(s.data?.dtStart??""),g=s.data!==void 0&&Number.isNaN(i),c=Number.isNaN(i)?0:i-Me,p=C({...h({query:{from:S(c),to:S(c+U),calendarObjectId:e}}),meta:$,retry:!1,enabled:t&&s.data!==void 0&&!g}),u=p.data?q(p.data.items,e,r,a):void 0;if(!t)return{kind:"Idle"};if(l)return{kind:"Found",jump:l};if(u)return{kind:"Found",jump:u};const f=A(s.error)===404,_=[o.error,f?null:s.error,p.error].find(J=>J!==null);return _!==void 0?{kind:"Failed",reason:Pe(_)}:f?{kind:"Deleted"}:g?{kind:"Failed",reason:`the stored event names no readable start (${s.data?.dtStart??""})`}:p.data!==void 0?{kind:"NoOccurrenceFound"}:{kind:"Searching"}}const b=y(400,404),Re=new Set(["calendarSuggestionOperationsListCalendarSuggestions","messageCalendarSuggestionOperationsListMessageCalendarSuggestions","calendarEventOperationsListCalendarEvents","calendarEventDetailOperationsGetCalendarEvent","calendarFreeBusyOperationsListCalendarFreeBusy","filterOperationsListFilters"]),Te=e=>e.invalidateQueries({predicate:t=>{const n=t.queryKey[0];if(typeof n!="object"||n===null)return!1;const a=n._id;return typeof a=="string"&&Re.has(a)}});function Xe(e){const{data:t,isLoading:n,error:a}=C({...ue({path:{messageId:e}}),meta:b});return{suggestions:t?.items??[],isLoading:n,error:a??null}}function et(){const{data:e,isLoading:t,error:n}=C({...Ce({query:{state:"Pending"}}),meta:b});return{suggestions:e?.items??[],isLoading:t,error:n??null}}const _e=async(e,t)=>{let n;do{const{data:a}=await ye({query:{state:"Pending",continuationToken:n},signal:t,throwOnError:!0}),r=a.items.find(o=>o.suggestionId===e);if(r)return r;n=a.continuationToken}while(n);return null};function tt(e){const{data:t,isLoading:n,error:a}=C({queryKey:[{_id:"calendarSuggestionOperationsListCalendarSuggestions",suggestionId:e}],queryFn:({signal:r})=>_e(e,r),meta:b});return{suggestion:t,isLoading:n,error:a??null}}const E={kind:"answered"},O=e=>({kind:"refused",message:I(e)});function nt(){const e=v(),t=d.useCallback(()=>Te(e),[e]),n=m({...ge(),meta:b,onSuccess:t}),a=m({...pe(),meta:b,onSuccess:t}),r=m({...fe(),meta:b,onSuccess:t}),o=m({...me(),meta:b,onSuccess:t}),l=d.useCallback((u,f)=>n.mutateAsync({path:{suggestionId:u},body:{calendarId:f}}).then(()=>E).catch(O),[n]),s=d.useCallback((u,f)=>n.mutateAsync({path:{suggestionId:u},body:{calendarId:f,answer:"Tentative"}}).then(()=>E).catch(O),[n]),i=d.useCallback((u,f)=>n.mutateAsync({path:{suggestionId:u},body:f}).then(()=>E).catch(O),[n]),g=d.useCallback(u=>a.mutateAsync({path:{suggestionId:u}}).then(()=>E).catch(O),[a]),c=d.useCallback((u,f)=>r.mutateAsync({path:{suggestionId:u},body:{muteSender:f}}).then(()=>E).catch(O),[r]),p=d.useCallback(u=>o.mutateAsync({path:{suggestionId:u}}).then(()=>E).catch(O),[o]);return d.useMemo(()=>({accept:l,tentative:s,acceptEdited:i,decline:g,dismiss:c,reopen:p,isAnswering:n.isPending||a.isPending||r.isPending||o.isPending}),[l,s,i,g,c,p,n.isPending,a.isPending,r.isPending,o.isPending])}export{D as C,Fe as M,x as U,V as a,Be as b,Ue as c,We as d,Ge as e,K as f,He as g,Ye as h,he as i,et as j,nt as k,je as l,Xe as m,ze as n,ve as o,$e as p,Ve as q,R as r,Ze as s,Se as t,Ke as u,Qe as v,Je as w,we as x,tt as y};
@@ -1 +1 @@
1
- import{r as u,j as O,p as P,f as y,eQ as v,eR as q,eS as R,a as E,eT as W,aP as I,eU as j,s as D}from"./index-Bn8n_AsE.js";import{a as z,C as k}from"./useCalendarSuggestions-Bb4PGHae.js";import{f as U}from"./ErrorState-BXxvOnci.js";const i=8,x=(e,t,a)=>Math.min(Math.max(e,t),Math.max(t,a)),B=(e,t)=>e.width>0&&e.height>0&&e.left<t.width&&e.left+e.width>0&&e.top<t.height&&e.top+e.height>0;function C(e,t){return{left:Math.max(i,(t.width-e.width)/2),top:Math.max(i,(t.height-e.height)/2),side:"center"}}function G(e,t,a){if(!e||!B(e,a))return C(t,a);const r=x(e.top,i,a.height-t.height-i),c=e.left+e.width+i;if(c+t.width<=a.width-i)return{left:c,top:r,side:"right"};const f=e.left-i-t.width;if(f>=i)return{left:f,top:r,side:"left"};const l=x(e.left,i,a.width-t.width-i),s=e.top+e.height+i;if(s+t.height<=a.height-i)return{left:l,top:s,side:"below"};const h=e.top-i-t.height;return h>=i?{left:l,top:h,side:"above"}:C(t,a)}const H='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Y({anchor:e,anchorKey:t,labelledBy:a,children:r,header:c,wrapTab:f=!1,panelRef:l,className:s}){const h=u.useRef(null),[w,M]=u.useState(null),[b,A]=u.useState({key:t,x:0,y:0}),g=b.key===t?b:{x:0,y:0};u.useLayoutEffect(()=>{const n=h.current;if(!n||t==="")return;const d=()=>{const o=(typeof e=="string"?document.querySelector(e):e)?.getBoundingClientRect();M(G(o?{left:o.left,top:o.top,width:o.width,height:o.height}:null,{width:n.offsetWidth,height:n.offsetHeight},{width:window.innerWidth,height:window.innerHeight}))};return d(),window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[e,t]);const S=n=>{if(n.button!==0||n.target instanceof Element&&n.target.closest("button, input, select, a"))return;n.preventDefault();const d={x:n.clientX-g.x,y:n.clientY-g.y},m=p=>A({key:t,x:p.clientX-d.x,y:p.clientY-d.y}),o=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",o)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",o)},L=n=>{if(!f||n.key!=="Tab")return;const d=Array.from(n.currentTarget.querySelectorAll(H));if(d.length===0)return;const m=d[0],o=d[d.length-1];n.shiftKey&&document.activeElement===m?(n.preventDefault(),o.focus()):!n.shiftKey&&document.activeElement===o&&(n.preventDefault(),m.focus())};return O.jsxs("div",{ref:n=>{h.current=n,typeof l=="function"?l(n):l&&(l.current=n)},role:"dialog","aria-modal":"false","aria-labelledby":a,"data-calendar-popover":"",onKeyDown:L,className:P("fixed z-40 w-[26rem] max-w-[calc(100vw-1rem)] rounded-xl border border-line bg-surface-raised text-fg shadow-xl shadow-black/20",w===null&&"opacity-0",s),style:{left:(w?.left??0)+g.x,top:(w?.top??0)+g.y},children:[c?.({onPointerDown:S}),r]})}const _=e=>({calendarTaskId:e.calendarTaskId,calendarId:e.calendarId,title:e.summary,due:e.allDay?e.due.slice(0,10):e.dueAt,allDay:e.allDay,completed:e.completed});function F(e,t=!0){const{data:a,error:r,refetch:c}=E({...W({query:{from:e.from,to:e.to}}),meta:D(400,404),enabled:t});return{tasks:u.useMemo(()=>a?.items??[],[a?.items]),error:r,refetch:c}}function V(e){const{data:t,error:a,refetch:r}=E({...j({path:{calendarTaskId:e}}),meta:D(404),retry:!1});return t?{kind:"found",task:t}:a===null?{kind:"loading"}:I(a)===404?{kind:"gone"}:{kind:"failed",error:a,retry:()=>{r()}}}const T=e=>({kind:"refused",message:I(e)===412?"This task changed while you were looking at it. Close it and open it again.":U(e)});function J(){const e=z(),t=y({...v(),meta:k,onSuccess:e}),a=y({...q(),meta:k,onSuccess:e}),r=y({...R(),meta:k,onSuccess:e}),c=u.useCallback(s=>t.mutateAsync({body:s}).then(()=>({kind:"written"})).catch(T),[t]),f=u.useCallback((s,h)=>a.mutateAsync({path:{calendarTaskId:s.calendarTaskId},query:{calendarId:s.calendarId},headers:{"If-Match":s.etag},body:h}).then(()=>({kind:"written"})).catch(T),[a]),l=u.useCallback(s=>r.mutateAsync({path:{calendarTaskId:s.calendarTaskId},query:{calendarId:s.calendarId},headers:{"If-Match":s.etag}}).then(()=>({kind:"written"})).catch(T),[r]);return{createTask:c,updateTask:f,deleteTask:l,isWriting:t.isPending||a.isPending||r.isPending}}export{Y as C,F as a,V as b,_ as t,J as u};
1
+ import{r as u,j as O,p as P,f as y,eQ as v,eR as q,eS as R,a as E,eT as W,aP as I,eU as j,s as D}from"./index-BZ4sAts4.js";import{a as z,C as k}from"./useCalendarSuggestions-D58tKJtx.js";import{f as U}from"./ErrorState-nIG-x-Zh.js";const i=8,x=(e,t,a)=>Math.min(Math.max(e,t),Math.max(t,a)),B=(e,t)=>e.width>0&&e.height>0&&e.left<t.width&&e.left+e.width>0&&e.top<t.height&&e.top+e.height>0;function C(e,t){return{left:Math.max(i,(t.width-e.width)/2),top:Math.max(i,(t.height-e.height)/2),side:"center"}}function G(e,t,a){if(!e||!B(e,a))return C(t,a);const r=x(e.top,i,a.height-t.height-i),c=e.left+e.width+i;if(c+t.width<=a.width-i)return{left:c,top:r,side:"right"};const f=e.left-i-t.width;if(f>=i)return{left:f,top:r,side:"left"};const l=x(e.left,i,a.width-t.width-i),s=e.top+e.height+i;if(s+t.height<=a.height-i)return{left:l,top:s,side:"below"};const h=e.top-i-t.height;return h>=i?{left:l,top:h,side:"above"}:C(t,a)}const H='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Y({anchor:e,anchorKey:t,labelledBy:a,children:r,header:c,wrapTab:f=!1,panelRef:l,className:s}){const h=u.useRef(null),[w,M]=u.useState(null),[b,A]=u.useState({key:t,x:0,y:0}),g=b.key===t?b:{x:0,y:0};u.useLayoutEffect(()=>{const n=h.current;if(!n||t==="")return;const d=()=>{const o=(typeof e=="string"?document.querySelector(e):e)?.getBoundingClientRect();M(G(o?{left:o.left,top:o.top,width:o.width,height:o.height}:null,{width:n.offsetWidth,height:n.offsetHeight},{width:window.innerWidth,height:window.innerHeight}))};return d(),window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[e,t]);const S=n=>{if(n.button!==0||n.target instanceof Element&&n.target.closest("button, input, select, a"))return;n.preventDefault();const d={x:n.clientX-g.x,y:n.clientY-g.y},m=p=>A({key:t,x:p.clientX-d.x,y:p.clientY-d.y}),o=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",o)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",o)},L=n=>{if(!f||n.key!=="Tab")return;const d=Array.from(n.currentTarget.querySelectorAll(H));if(d.length===0)return;const m=d[0],o=d[d.length-1];n.shiftKey&&document.activeElement===m?(n.preventDefault(),o.focus()):!n.shiftKey&&document.activeElement===o&&(n.preventDefault(),m.focus())};return O.jsxs("div",{ref:n=>{h.current=n,typeof l=="function"?l(n):l&&(l.current=n)},role:"dialog","aria-modal":"false","aria-labelledby":a,"data-calendar-popover":"",onKeyDown:L,className:P("fixed z-40 w-[26rem] max-w-[calc(100vw-1rem)] rounded-xl border border-line bg-surface-raised text-fg shadow-xl shadow-black/20",w===null&&"opacity-0",s),style:{left:(w?.left??0)+g.x,top:(w?.top??0)+g.y},children:[c?.({onPointerDown:S}),r]})}const _=e=>({calendarTaskId:e.calendarTaskId,calendarId:e.calendarId,title:e.summary,due:e.allDay?e.due.slice(0,10):e.dueAt,allDay:e.allDay,completed:e.completed});function F(e,t=!0){const{data:a,error:r,refetch:c}=E({...W({query:{from:e.from,to:e.to}}),meta:D(400,404),enabled:t});return{tasks:u.useMemo(()=>a?.items??[],[a?.items]),error:r,refetch:c}}function V(e){const{data:t,error:a,refetch:r}=E({...j({path:{calendarTaskId:e}}),meta:D(404),retry:!1});return t?{kind:"found",task:t}:a===null?{kind:"loading"}:I(a)===404?{kind:"gone"}:{kind:"failed",error:a,retry:()=>{r()}}}const T=e=>({kind:"refused",message:I(e)===412?"This task changed while you were looking at it. Close it and open it again.":U(e)});function J(){const e=z(),t=y({...v(),meta:k,onSuccess:e}),a=y({...q(),meta:k,onSuccess:e}),r=y({...R(),meta:k,onSuccess:e}),c=u.useCallback(s=>t.mutateAsync({body:s}).then(()=>({kind:"written"})).catch(T),[t]),f=u.useCallback((s,h)=>a.mutateAsync({path:{calendarTaskId:s.calendarTaskId},query:{calendarId:s.calendarId},headers:{"If-Match":s.etag},body:h}).then(()=>({kind:"written"})).catch(T),[a]),l=u.useCallback(s=>r.mutateAsync({path:{calendarTaskId:s.calendarTaskId},query:{calendarId:s.calendarId},headers:{"If-Match":s.etag}}).then(()=>({kind:"written"})).catch(T),[r]);return{createTask:c,updateTask:f,deleteTask:l,isWriting:t.isPending||a.isPending||r.isPending}}export{Y as C,F as a,V as b,_ as t,J as u};
@@ -1 +1 @@
1
- import{r as o}from"./index-Bn8n_AsE.js";const n=(e,t)=>{const[r,u]=o.useState(e);return o.useEffect(()=>{const s=setTimeout(()=>u(e),t);return()=>clearTimeout(s)},[e,t]),r};export{n as u};
1
+ import{r as o}from"./index-BZ4sAts4.js";const n=(e,t)=>{const[r,u]=o.useState(e);return o.useEffect(()=>{const s=setTimeout(()=>u(e),t);return()=>clearTimeout(s)},[e,t]),r};export{n as u};
@@ -1 +1 @@
1
- import{j as u,eB as x,X as E,p as M,eC as L,eD as z,ao as w,B as O,r as p,f as v,eE as T,a as D,eF as R,eG as $,eH as _,e as S,eI as J,eJ as U,eK as B,eL as K,bf as q}from"./index-Bn8n_AsE.js";import{u as H,S as Q}from"./suggest-list-FaY4DThZ.js";import{S as W}from"./select-Cc2Vc4qL.js";import{P as G}from"./plus-6ss9YFRF.js";const P="inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs";function pe({clause:e,onEdit:t,onRemove:r}){return u.jsxs("span",{className:M(P,e.derived?"border-dashed border-line-strong bg-surface-sunken":"border-line bg-surface"),children:[u.jsxs("button",{type:"button",onClick:t,"aria-label":`Edit ${x(e.field)} clause`,className:"flex items-center gap-1 text-left",children:[u.jsx("span",{className:"font-medium text-fg-muted",children:x(e.field)}),u.jsx("span",{className:"text-fg",children:e.value})]}),e.derived&&u.jsx("span",{className:"text-2xs text-fg-subtle",children:"from sender"}),r&&u.jsx("button",{type:"button",onClick:r,"aria-label":`Remove ${x(e.field)} clause`,className:"flex size-4 items-center justify-center rounded-full text-fg-subtle hover:bg-surface-sunken hover:text-fg-muted",children:u.jsx(E,{className:"size-3"})})]})}function fe({label:e,onClick:t}){return u.jsxs("button",{type:"button",onClick:t,className:M(P,"border-dashed border-line-strong text-fg-muted hover:border-accent-2 hover:text-accent-2"),children:[u.jsx(G,{className:"size-3","aria-hidden":"true"}),e]})}function be({draft:e,mode:t,fields:r=z,suggestions:s=[],onChangeField:o,onChangeValue:a,onSubmit:n,onCancel:c}){const d=L(e.field),l=H({count:s.length,onAccept:i=>a?.(s[i].value)});return u.jsxs("div",{className:"space-y-1.5 rounded-lg border border-accent-2 bg-surface p-2",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsx(W,{"aria-label":"Clause field",value:e.field,onChange:i=>o?.(i.target.value),className:"h-8 w-32 shrink-0",children:r.map(i=>u.jsx("option",{value:i,children:x(i)},i))}),u.jsx(w,{"aria-label":"Clause value",value:e.value,placeholder:"value…",autoComplete:"off",onChange:i=>{l.reopen(),a?.(i.target.value)},onKeyDown:i=>{l.handleKeyDown(i)||i.key==="Enter"&&n?.()},className:"h-8 min-w-40 flex-1",...l.comboboxProps}),u.jsx(O,{variant:"primary",size:"sm",onClick:n,disabled:e.value.trim()==="",className:"shrink-0",children:t==="add"?"Add":"Save"}),u.jsx(O,{variant:"ghost",size:"sm",onClick:c,"aria-label":"Cancel clause edit",icon:u.jsx(E,{className:"size-4"}),className:"shrink-0 px-2"})]}),l.open&&u.jsx(Q,{id:l.listId,suggestions:s,activeIndex:l.activeIndex,optionId:l.optionId,onPick:i=>{a?.(i.value),l.dismiss()},onHighlight:l.setActiveIndex,label:`${x(e.field)} suggestions`}),d&&u.jsx("p",{className:"px-0.5 text-2xs text-fg-subtle",children:d})]})}const ge=(e,t)=>{if(e.state==="Expired")return"Expired";const r=e.state==="Disabled"?"Disabled":"Active";if(e.scope!=="Temporary"||!e.expiresAt)return r;const s=Date.parse(e.expiresAt);return Number.isNaN(s)?r:s<=t?"Expired":r},N={UserDisabled:"Turned off. Turn it on to run it on new mail again.",AwaitingFolder:"Off until its folder exists on the mail server. It turns on by itself once the folder is created.",FolderCreateFailed:"Off: the mail server refused to create its folder. Pick another folder in the rule, then turn it on.",FolderMissing:"Off: the folder it moves mail into no longer exists. Pick another folder in the rule, then turn it on."},he=e=>e.disabledReason==="None"?void 0:(e.disabledReason==="AwaitingFolder"||e.disabledReason==="FolderCreateFailed")&&e.actionMailboxId!=="None"?N.UserDisabled:N[e.disabledReason],xe=e=>{if(!e)return;const t=Date.parse(e);if(!Number.isNaN(t))return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})},j=(e,t=new Date)=>{if(!e)return;const r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!r)return;const[,s,o,a]=r,n=new Date(Number(s),Number(o)-1,Number(a),23,59,59,0);if(Number.isNaN(n.getTime()))return;const c=-t.getTimezoneOffset(),d=c>=0?"+":"-",l=Math.abs(c),i=String(Math.floor(l/60)).padStart(2,"0"),f=String(l%60).padStart(2,"0"),m=b=>String(b).padStart(2,"0");return`${n.getFullYear()}-${m(n.getMonth()+1)}-${m(n.getDate())}T${m(n.getHours())}:${m(n.getMinutes())}:${m(n.getSeconds())}${d}${i}:${f}`},h="None",X=e=>({filterId:e,matchOperator:"And",literalClauses:[],actionLabelId:h,actionMailboxId:h}),I=e=>({matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h}),ve=({mode:e,ruleScope:t})=>t==="standing"?"standing":t==="until"?"temporary":e==="selected"?"just-these":"all-like-these",Ce=({ruleScope:e,clauses:t,matchOperator:r,moveMailboxId:s,until:o})=>({matchOperator:r==="all"?"And":"Or",literalClauses:t.map(a=>({field:a.field,value:a.value})),moveMailboxId:s,expiresAt:e==="until"?j(o??""):void 0}),F=(e,t,r)=>({name:r,scope:t==="standing"?"Standing":"Temporary",...t==="temporary"&&e.expiresAt?{expiresAt:e.expiresAt}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h}),Y=new Set(["Complete","Failed"]),A=e=>e!==void 0&&Y.has(e),V=1e3,Z=15e3,ee=e=>{const t=Math.max(0,e),r=V*2**t;return Math.min(r,Z)},te=(e,t,r)=>{if(e)return{kind:r?"restartFailed":"startFailed",error:e};if(t)return{kind:"statusUnreadable",error:t}},Se=e=>{const[t,r]=p.useState(),s=v({...T(),onSuccess:g=>r(g.organizeJobId)}),{mutate:o}=s,a=D({...R({path:{accountId:e??"",organizeJobId:t??""}}),enabled:!!e&&!!t,refetchInterval:g=>{const k=g.state.data?.state;return A(k)?!1:ee(g.state.dataUpdateCount)}}),n=p.useCallback(g=>{e&&o({path:{accountId:e},body:I(g)})},[e,o]),c=p.useCallback(g=>{e&&o({path:{accountId:e},body:X(g)})},[e,o]),{refetch:d}=a,l=p.useCallback(()=>{d()},[d]),i=a.data,f=s.isPending?void 0:i,m=f?.state??s.data?.state,b=A(f?.state),C={state:m,matchedCount:f?.matchedCount??0,appliedCount:f?.appliedCount??0,failedCount:f?.failedCount??0,errorMessage:f?.errorMessage??""};return{start:n,startForFilter:c,watch:r,refreshStatus:l,progress:C,isStarting:s.isPending,isRunning:!!t&&!b,isDone:b,failure:te(s.error,a.error,!!i)}},ye=["From","Subject","HasWords","ListId","FromDomain"],re=e=>{const t=e.trim(),r=t.match(/<([^>]+)>/);return(r?r[1]:t).trim().toLowerCase()},Oe=(e,t)=>e==="ListId"?re(t):t.trim(),se=e=>e==="all"?"And":"Or",ae=e=>({matchOperator:se(e.matchOperator),literalClauses:e.clauses.map(t=>({field:t.field,value:t.value}))}),ie=e=>!e.literalClauses.some(t=>t.field==="HasWords"),ne=e=>JSON.stringify({operator:e.matchOperator,clauses:e.literalClauses.map(t=>`${t.field} ${t.value}`)}),Ne=e=>{const t=ae(e);return{matchOperator:t.matchOperator,literalClauses:t.literalClauses,moveMailboxId:e.moveMailboxId,labelId:e.labelId,expiresAt:e.scope==="until"?j(e.until??""):void 0}},oe=(e,t)=>e.error!==void 0&&e.errorSignature===t?{status:"error",reason:e.error}:e.count===void 0?{status:"loading"}:e.previewedSignature===t?{status:"ready",count:e.count}:{status:"ready",count:e.count,stale:!0},le=350,Fe=(e,t,r)=>{const s=v($()),{mutateAsync:o}=s,a=ne(t),[n,c]=p.useState(()=>({})),d=p.useRef(t);d.current=t;const l=p.useRef(a),i=ie(t);return p.useEffect(()=>{if(!e||!i||a===n.previewedSignature||a===n.errorSignature)return;const f=setTimeout(()=>{const m=a;l.current=m,o({path:{accountId:e},body:I({...d.current})}).then(b=>{l.current===m&&c({count:b.matchedCount,matchedIds:b.messageIds,previewedSignature:m})}).catch(b=>{l.current===m&&c(C=>({...C,error:b instanceof Error?b.message:"Couldn't count matches.",errorSignature:m}))})},le);return()=>clearTimeout(f)},[e,i,a,n.previewedSignature,n.errorSignature,o]),i?{count:oe(n,a),matchedIds:n.previewedSignature===a?n.matchedIds??[]:[]}:{count:{status:"error",reason:_},matchedIds:[]}},y=e=>U({path:{accountId:e}}),Ae=e=>{const t=D({...B({path:{accountId:e??""}}),enabled:!!e});return{filters:t.data?.items??[],isPending:t.isPending,isError:t.isError,error:t.error,refetch:t.refetch}},Ee=e=>{const t=S(),r=v({...J(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:y(e)})}}),{mutate:s,mutateAsync:o}=r,a=p.useCallback((c,d,l)=>{e&&s({path:{accountId:e},body:F(c,d,l)})},[e,s]),n=p.useCallback(async(c,d,l)=>{if(e)return o({path:{accountId:e},body:F(c,d,l)}).then(i=>i,()=>{})},[e,o]);return{createFilter:a,createFilterAsync:n,data:r.data,isPending:r.isPending,isSuccess:r.isSuccess,isError:r.isError,error:r.error,reset:r.reset}},Me=e=>{const t=S(),r=v({...K(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:y(e)})}}),{mutate:s}=r;return{deleteFilter:p.useCallback(a=>{e&&s({path:{accountId:e,filterId:a}})},[e,s]),isPending:r.isPending,deletingFilterId:r.isPending?r.variables?.path.filterId:void 0}},De=e=>{const t=S(),r=v({...q(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:y(e)})}}),{mutate:s,variables:o}=r,a=p.useCallback((c,d)=>{e&&s({path:{accountId:e,filterId:c},body:{state:d?"Active":"Disabled"}})},[e,s]),n=p.useCallback(()=>{o&&s(o)},[s,o]);return{toggleFilter:a,retry:n,togglingFilterId:r.isPending?o?.path.filterId:void 0,isError:r.isError,error:r.error,enabling:o?.body?.state==="Active"}};export{fe as A,pe as C,h as N,ye as S,be as a,y as b,Se as c,Ne as d,he as e,ge as f,xe as g,Ae as h,Me as i,De as j,Ee as k,Ce as l,Oe as n,ve as o,j as p,ae as r,Fe as u};
1
+ import{j as u,eB as x,X as E,p as M,eC as L,eD as z,ao as w,B as O,r as p,f as v,eE as T,a as D,eF as R,eG as $,eH as _,e as S,eI as J,eJ as U,eK as B,eL as K,bf as q}from"./index-BZ4sAts4.js";import{u as H,S as Q}from"./suggest-list-CUEgGZt_.js";import{S as W}from"./select-DXHN14lo.js";import{P as G}from"./plus-5sFyaPZh.js";const P="inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs";function pe({clause:e,onEdit:t,onRemove:r}){return u.jsxs("span",{className:M(P,e.derived?"border-dashed border-line-strong bg-surface-sunken":"border-line bg-surface"),children:[u.jsxs("button",{type:"button",onClick:t,"aria-label":`Edit ${x(e.field)} clause`,className:"flex items-center gap-1 text-left",children:[u.jsx("span",{className:"font-medium text-fg-muted",children:x(e.field)}),u.jsx("span",{className:"text-fg",children:e.value})]}),e.derived&&u.jsx("span",{className:"text-2xs text-fg-subtle",children:"from sender"}),r&&u.jsx("button",{type:"button",onClick:r,"aria-label":`Remove ${x(e.field)} clause`,className:"flex size-4 items-center justify-center rounded-full text-fg-subtle hover:bg-surface-sunken hover:text-fg-muted",children:u.jsx(E,{className:"size-3"})})]})}function fe({label:e,onClick:t}){return u.jsxs("button",{type:"button",onClick:t,className:M(P,"border-dashed border-line-strong text-fg-muted hover:border-accent-2 hover:text-accent-2"),children:[u.jsx(G,{className:"size-3","aria-hidden":"true"}),e]})}function be({draft:e,mode:t,fields:r=z,suggestions:s=[],onChangeField:o,onChangeValue:a,onSubmit:n,onCancel:c}){const d=L(e.field),l=H({count:s.length,onAccept:i=>a?.(s[i].value)});return u.jsxs("div",{className:"space-y-1.5 rounded-lg border border-accent-2 bg-surface p-2",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsx(W,{"aria-label":"Clause field",value:e.field,onChange:i=>o?.(i.target.value),className:"h-8 w-32 shrink-0",children:r.map(i=>u.jsx("option",{value:i,children:x(i)},i))}),u.jsx(w,{"aria-label":"Clause value",value:e.value,placeholder:"value…",autoComplete:"off",onChange:i=>{l.reopen(),a?.(i.target.value)},onKeyDown:i=>{l.handleKeyDown(i)||i.key==="Enter"&&n?.()},className:"h-8 min-w-40 flex-1",...l.comboboxProps}),u.jsx(O,{variant:"primary",size:"sm",onClick:n,disabled:e.value.trim()==="",className:"shrink-0",children:t==="add"?"Add":"Save"}),u.jsx(O,{variant:"ghost",size:"sm",onClick:c,"aria-label":"Cancel clause edit",icon:u.jsx(E,{className:"size-4"}),className:"shrink-0 px-2"})]}),l.open&&u.jsx(Q,{id:l.listId,suggestions:s,activeIndex:l.activeIndex,optionId:l.optionId,onPick:i=>{a?.(i.value),l.dismiss()},onHighlight:l.setActiveIndex,label:`${x(e.field)} suggestions`}),d&&u.jsx("p",{className:"px-0.5 text-2xs text-fg-subtle",children:d})]})}const ge=(e,t)=>{if(e.state==="Expired")return"Expired";const r=e.state==="Disabled"?"Disabled":"Active";if(e.scope!=="Temporary"||!e.expiresAt)return r;const s=Date.parse(e.expiresAt);return Number.isNaN(s)?r:s<=t?"Expired":r},N={UserDisabled:"Turned off. Turn it on to run it on new mail again.",AwaitingFolder:"Off until its folder exists on the mail server. It turns on by itself once the folder is created.",FolderCreateFailed:"Off: the mail server refused to create its folder. Pick another folder in the rule, then turn it on.",FolderMissing:"Off: the folder it moves mail into no longer exists. Pick another folder in the rule, then turn it on."},he=e=>e.disabledReason==="None"?void 0:(e.disabledReason==="AwaitingFolder"||e.disabledReason==="FolderCreateFailed")&&e.actionMailboxId!=="None"?N.UserDisabled:N[e.disabledReason],xe=e=>{if(!e)return;const t=Date.parse(e);if(!Number.isNaN(t))return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})},j=(e,t=new Date)=>{if(!e)return;const r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!r)return;const[,s,o,a]=r,n=new Date(Number(s),Number(o)-1,Number(a),23,59,59,0);if(Number.isNaN(n.getTime()))return;const c=-t.getTimezoneOffset(),d=c>=0?"+":"-",l=Math.abs(c),i=String(Math.floor(l/60)).padStart(2,"0"),f=String(l%60).padStart(2,"0"),m=b=>String(b).padStart(2,"0");return`${n.getFullYear()}-${m(n.getMonth()+1)}-${m(n.getDate())}T${m(n.getHours())}:${m(n.getMinutes())}:${m(n.getSeconds())}${d}${i}:${f}`},h="None",X=e=>({filterId:e,matchOperator:"And",literalClauses:[],actionLabelId:h,actionMailboxId:h}),I=e=>({matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h}),ve=({mode:e,ruleScope:t})=>t==="standing"?"standing":t==="until"?"temporary":e==="selected"?"just-these":"all-like-these",Ce=({ruleScope:e,clauses:t,matchOperator:r,moveMailboxId:s,until:o})=>({matchOperator:r==="all"?"And":"Or",literalClauses:t.map(a=>({field:a.field,value:a.value})),moveMailboxId:s,expiresAt:e==="until"?j(o??""):void 0}),F=(e,t,r)=>({name:r,scope:t==="standing"?"Standing":"Temporary",...t==="temporary"&&e.expiresAt?{expiresAt:e.expiresAt}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h}),Y=new Set(["Complete","Failed"]),A=e=>e!==void 0&&Y.has(e),V=1e3,Z=15e3,ee=e=>{const t=Math.max(0,e),r=V*2**t;return Math.min(r,Z)},te=(e,t,r)=>{if(e)return{kind:r?"restartFailed":"startFailed",error:e};if(t)return{kind:"statusUnreadable",error:t}},Se=e=>{const[t,r]=p.useState(),s=v({...T(),onSuccess:g=>r(g.organizeJobId)}),{mutate:o}=s,a=D({...R({path:{accountId:e??"",organizeJobId:t??""}}),enabled:!!e&&!!t,refetchInterval:g=>{const k=g.state.data?.state;return A(k)?!1:ee(g.state.dataUpdateCount)}}),n=p.useCallback(g=>{e&&o({path:{accountId:e},body:I(g)})},[e,o]),c=p.useCallback(g=>{e&&o({path:{accountId:e},body:X(g)})},[e,o]),{refetch:d}=a,l=p.useCallback(()=>{d()},[d]),i=a.data,f=s.isPending?void 0:i,m=f?.state??s.data?.state,b=A(f?.state),C={state:m,matchedCount:f?.matchedCount??0,appliedCount:f?.appliedCount??0,failedCount:f?.failedCount??0,errorMessage:f?.errorMessage??""};return{start:n,startForFilter:c,watch:r,refreshStatus:l,progress:C,isStarting:s.isPending,isRunning:!!t&&!b,isDone:b,failure:te(s.error,a.error,!!i)}},ye=["From","Subject","HasWords","ListId","FromDomain"],re=e=>{const t=e.trim(),r=t.match(/<([^>]+)>/);return(r?r[1]:t).trim().toLowerCase()},Oe=(e,t)=>e==="ListId"?re(t):t.trim(),se=e=>e==="all"?"And":"Or",ae=e=>({matchOperator:se(e.matchOperator),literalClauses:e.clauses.map(t=>({field:t.field,value:t.value}))}),ie=e=>!e.literalClauses.some(t=>t.field==="HasWords"),ne=e=>JSON.stringify({operator:e.matchOperator,clauses:e.literalClauses.map(t=>`${t.field} ${t.value}`)}),Ne=e=>{const t=ae(e);return{matchOperator:t.matchOperator,literalClauses:t.literalClauses,moveMailboxId:e.moveMailboxId,labelId:e.labelId,expiresAt:e.scope==="until"?j(e.until??""):void 0}},oe=(e,t)=>e.error!==void 0&&e.errorSignature===t?{status:"error",reason:e.error}:e.count===void 0?{status:"loading"}:e.previewedSignature===t?{status:"ready",count:e.count}:{status:"ready",count:e.count,stale:!0},le=350,Fe=(e,t,r)=>{const s=v($()),{mutateAsync:o}=s,a=ne(t),[n,c]=p.useState(()=>({})),d=p.useRef(t);d.current=t;const l=p.useRef(a),i=ie(t);return p.useEffect(()=>{if(!e||!i||a===n.previewedSignature||a===n.errorSignature)return;const f=setTimeout(()=>{const m=a;l.current=m,o({path:{accountId:e},body:I({...d.current})}).then(b=>{l.current===m&&c({count:b.matchedCount,matchedIds:b.messageIds,previewedSignature:m})}).catch(b=>{l.current===m&&c(C=>({...C,error:b instanceof Error?b.message:"Couldn't count matches.",errorSignature:m}))})},le);return()=>clearTimeout(f)},[e,i,a,n.previewedSignature,n.errorSignature,o]),i?{count:oe(n,a),matchedIds:n.previewedSignature===a?n.matchedIds??[]:[]}:{count:{status:"error",reason:_},matchedIds:[]}},y=e=>U({path:{accountId:e}}),Ae=e=>{const t=D({...B({path:{accountId:e??""}}),enabled:!!e});return{filters:t.data?.items??[],isPending:t.isPending,isError:t.isError,error:t.error,refetch:t.refetch}},Ee=e=>{const t=S(),r=v({...J(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:y(e)})}}),{mutate:s,mutateAsync:o}=r,a=p.useCallback((c,d,l)=>{e&&s({path:{accountId:e},body:F(c,d,l)})},[e,s]),n=p.useCallback(async(c,d,l)=>{if(e)return o({path:{accountId:e},body:F(c,d,l)}).then(i=>i,()=>{})},[e,o]);return{createFilter:a,createFilterAsync:n,data:r.data,isPending:r.isPending,isSuccess:r.isSuccess,isError:r.isError,error:r.error,reset:r.reset}},Me=e=>{const t=S(),r=v({...K(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:y(e)})}}),{mutate:s}=r;return{deleteFilter:p.useCallback(a=>{e&&s({path:{accountId:e,filterId:a}})},[e,s]),isPending:r.isPending,deletingFilterId:r.isPending?r.variables?.path.filterId:void 0}},De=e=>{const t=S(),r=v({...q(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:y(e)})}}),{mutate:s,variables:o}=r,a=p.useCallback((c,d)=>{e&&s({path:{accountId:e,filterId:c},body:{state:d?"Active":"Disabled"}})},[e,s]),n=p.useCallback(()=>{o&&s(o)},[s,o]);return{toggleFilter:a,retry:n,togglingFilterId:r.isPending?o?.path.filterId:void 0,isError:r.isError,error:r.error,enabling:o?.body?.state==="Active"}};export{fe as A,pe as C,h as N,ye as S,be as a,y as b,Se as c,Ne as d,he as e,ge as f,xe as g,Ae as h,Me as i,De as j,Ee as k,Ce as l,Oe as n,ve as o,j as p,ae as r,Fe as u};
@@ -1 +1 @@
1
- import{a as L,ef as p,e as n,f as l,eg as d,r as o,eh as y,ei as c,ej as g}from"./index-Bn8n_AsE.js";const u=e=>y({path:{accountId:e}}),P=e=>{const r=L({...p({path:{accountId:e??""}}),enabled:!!e});return{labels:r.data?.items??[],isPending:r.isPending,isError:r.isError,error:r.error,refetch:r.refetch}},h=e=>{const r=n(),t=l({...d(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutateAsync:s}=t;return{createLabel:o.useCallback((a,i="Default")=>e?s({path:{accountId:e},body:{name:a,color:i}}):Promise.reject(new Error("No account")),[e,s]),isPending:t.isPending,isError:t.isError,error:t.error,reset:t.reset}},m=e=>{const r=n(),t=l({...c(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutate:s}=t;return{updateLabel:o.useCallback((a,i)=>{e&&s({path:{accountId:e,labelId:a},body:i})},[e,s]),isPending:t.isPending,updatingLabelId:t.isPending?t.variables?.path.labelId:void 0}},C=e=>{const r=n(),t=l({...g(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutate:s}=t;return{deleteLabel:o.useCallback(a=>{e&&s({path:{accountId:e,labelId:a}})},[e,s]),isPending:t.isPending,deletingLabelId:t.isPending?t.variables?.path.labelId:void 0}};export{P as a,m as b,C as c,h as u};
1
+ import{a as L,ef as p,e as n,f as l,eg as d,r as o,eh as y,ei as c,ej as g}from"./index-BZ4sAts4.js";const u=e=>y({path:{accountId:e}}),P=e=>{const r=L({...p({path:{accountId:e??""}}),enabled:!!e});return{labels:r.data?.items??[],isPending:r.isPending,isError:r.isError,error:r.error,refetch:r.refetch}},h=e=>{const r=n(),t=l({...d(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutateAsync:s}=t;return{createLabel:o.useCallback((a,i="Default")=>e?s({path:{accountId:e},body:{name:a,color:i}}):Promise.reject(new Error("No account")),[e,s]),isPending:t.isPending,isError:t.isError,error:t.error,reset:t.reset}},m=e=>{const r=n(),t=l({...c(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutate:s}=t;return{updateLabel:o.useCallback((a,i)=>{e&&s({path:{accountId:e,labelId:a},body:i})},[e,s]),isPending:t.isPending,updatingLabelId:t.isPending?t.variables?.path.labelId:void 0}},C=e=>{const r=n(),t=l({...g(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutate:s}=t;return{deleteLabel:o.useCallback(a=>{e&&s({path:{accountId:e,labelId:a}})},[e,s]),isPending:t.isPending,deletingLabelId:t.isPending?t.variables?.path.labelId:void 0}};export{P as a,m as b,C as c,h as u};
@@ -1 +1 @@
1
- import{a as s,D as e}from"./useMediaQuery-C00TiD5k.js";const i=768,a=t=>t!=="desktop",r=()=>{const t=s(`(min-width: ${i}px)`);return s(e)?"desktop":t?"tablet":"phone"};export{a as i,r as u};
1
+ import{a as s,D as e}from"./useMediaQuery-D3m_n689.js";const i=768,a=t=>t!=="desktop",r=()=>{const t=s(`(min-width: ${i}px)`);return s(e)?"desktop":t?"tablet":"phone"};export{a as i,r as u};
@@ -1 +1 @@
1
- import{r as s}from"./index-Bn8n_AsE.js";const r=1024,c=`(min-width: ${r}px) and (not ((orientation: portrait) and (pointer: coarse)))`,d=e=>{const[o,n]=s.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(e).matches);return s.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const t=window.matchMedia(e);n(t.matches);const a=i=>n(i.matches);return t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[e]),o},m=()=>d(c);export{c as D,d as a,m as u};
1
+ import{r as s}from"./index-BZ4sAts4.js";const r=1024,c=`(min-width: ${r}px) and (not ((orientation: portrait) and (pointer: coarse)))`,d=e=>{const[o,n]=s.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(e).matches);return s.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const t=window.matchMedia(e);n(t.matches);const a=i=>n(i.matches);return t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[e]),o},m=()=>d(c);export{c as D,d as a,m as u};