@remit/web-client-dist 0.0.695 → 0.0.696

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 (203) hide show
  1. package/assets/{BriefPane-BJLNB-w7.js → BriefPane-DqAium13.js} +1 -1
  2. package/assets/{CalendarEventEditor-MMNLFvjJ.js → CalendarEventEditor-53hot8oY.js} +1 -1
  3. package/assets/{CalendarEventPopup-DVJ9DC_Y.js → CalendarEventPopup-BBlKWgkP.js} +1 -1
  4. package/assets/{CalendarLoadFailed-uHGxFBGx.js → CalendarLoadFailed-D9O_t7aS.js} +1 -1
  5. package/assets/{CalendarQuickCreate-CzJ4lehP.js → CalendarQuickCreate-B39DWHxB.js} +1 -1
  6. package/assets/{CalendarSession-BVuy8A2H.js → CalendarSession-CjGsYSn3.js} +1 -1
  7. package/assets/CollectionPane-DH6KjfeW.js +1 -0
  8. package/assets/{DesktopChrome-Ct-IB4ks.js → DesktopChrome-DrLXNfAF.js} +1 -1
  9. package/assets/{DropdownMenu-CTCHgh4X.js → DropdownMenu-CgMO6e8h.js} +1 -1
  10. package/assets/{EmptyState-CN-AyHj-.js → EmptyState-FjON9Ve2.js} +1 -1
  11. package/assets/{ErrorState-Bk3DwNvd.js → ErrorState-DHsQU1XS.js} +1 -1
  12. package/assets/{FullCompose-BWiLy3Vm.js → FullCompose-karPPSLh.js} +1 -1
  13. package/assets/{LabelApplyTrigger-52QGuTLD.js → LabelApplyTrigger-BLIxuWTi.js} +1 -1
  14. package/assets/{MailShell-DAqGpnce.js → MailShell-jW6JmRUB.js} +1 -1
  15. package/assets/MailViewChrome-By52WjOW.js +1 -0
  16. package/assets/{MailboxPane-DUI-sxQF.js → MailboxPane-dO1WtQIE.js} +2 -2
  17. package/assets/{MessageBody-BeciCqb_.js → MessageBody-bibpHbC1.js} +2 -2
  18. package/assets/{MessageToolbar-BYhqv9RG.js → MessageToolbar-BK8iddsy.js} +1 -1
  19. package/assets/{NavMenuButton-A6v6v8tE.js → NavMenuButton-DMqlg3at.js} +1 -1
  20. package/assets/{OnboardingWizard-CIneAccs.js → OnboardingWizard-BVm-45mM.js} +1 -1
  21. package/assets/{OutboxPane-InUnHiNC.js → OutboxPane-BwIG-6n1.js} +1 -1
  22. package/assets/{ReportLink-q8WFRQli.js → ReportLink-DbjCeZ9_.js} +1 -1
  23. package/assets/_calendarObjectId-DcrqQ1pT.js +1 -0
  24. package/assets/_labelId-B-uoAJUi.js +1 -0
  25. package/assets/_mailboxId-B_BsU1d4.js +1 -0
  26. package/assets/_messageId-BBhFHooJ.js +1 -0
  27. package/assets/_messageId-BC4E5AdD.js +1 -0
  28. package/assets/_messageId-BFceTya0.js +1 -0
  29. package/assets/_messageId-CaLvmUYl.js +1 -0
  30. package/assets/_outboxMessageId-D3RH7suq.js +1 -0
  31. package/assets/_recurrenceId-BmFnTbJZ.js +1 -0
  32. package/assets/{_slotId-Cf-NASLE.js → _slotId-ipxsVzxt.js} +1 -1
  33. package/assets/_threadId-BdAvQAKq.js +1 -0
  34. package/assets/_threadId-Ok6MuUb2.js +1 -0
  35. package/assets/_threadId-PwztExmU.js +1 -0
  36. package/assets/_threadId-oAltpOkl.js +1 -0
  37. package/assets/{_view._date-dARprXsM.js → _view._date-kxLdB_iw.js} +1 -1
  38. package/assets/{account-service-status-DexPoUiT.js → account-service-status-jau7OHM-.js} +1 -1
  39. package/assets/{accounts-DPvTdrTr.js → accounts-Dv0XYTrh.js} +1 -1
  40. package/assets/{advanced-CDr_JOXg.js → advanced-Co1jIx2-.js} +1 -1
  41. package/assets/{agenda-time-BcOiQ5_R.js → agenda-time--0lz2pGX.js} +1 -1
  42. package/assets/{app-chrome-6ZXmy5H4.js → app-chrome-BtWv1mrl.js} +1 -1
  43. package/assets/{appearance-BQZnBlkc.js → appearance-CIaVIf5W.js} +1 -1
  44. package/assets/{avatar-B_QEsxCw.js → avatar-BLhNXW-W.js} +1 -1
  45. package/assets/{badge-CeCxCmzS.js → badge-CoJzTE5F.js} +1 -1
  46. package/assets/{bottom-sheet-DWqGf7I3.js → bottom-sheet-BSnl2giv.js} +1 -1
  47. package/assets/{brief-B7EfkUB4.js → brief-BIpUj9JN.js} +1 -1
  48. package/assets/brief-E24hWVP8.js +1 -0
  49. package/assets/{calendar-DxjT7IrR.js → calendar-B4zVNn1v.js} +1 -1
  50. package/assets/{calendar-CJGXdypt.js → calendar-BRsmtlld.js} +1 -1
  51. package/assets/{calendar-event-popup-y4Z860B0.js → calendar-event-popup-DsOb1y1u.js} +1 -1
  52. package/assets/{calendar-event-sidebar-BaAGgT2x.js → calendar-event-sidebar-Bi4U7yon.js} +1 -1
  53. package/assets/{calendar-failure-note-CJvPzX2o.js → calendar-failure-note-DlpRkxBL.js} +1 -1
  54. package/assets/{calendar-guests-DeRthr7k.js → calendar-guests-BQoxXEOG.js} +1 -1
  55. package/assets/{calendar-suggestion-BulekNHV.js → calendar-suggestion-CJMwfDpf.js} +1 -1
  56. package/assets/{calendars-D-Use38B.js → calendars-0hXvo4Yo.js} +1 -1
  57. package/assets/{card-0Dzt3Scs.js → card-CAuqZLKK.js} +1 -1
  58. package/assets/{checkbox-DIKh2-eX.js → checkbox-ImKY_DpK.js} +1 -1
  59. package/assets/{chevron-down-BnC2m4J6.js → chevron-down-CHMH78GK.js} +1 -1
  60. package/assets/{chevron-left-CNQ3caMn.js → chevron-left-Brxnh-p_.js} +1 -1
  61. package/assets/{circle-check-CTlM3FQo.js → circle-check-bdTVfKb7.js} +1 -1
  62. package/assets/{circle-check-big-DCVJA_H0.js → circle-check-big-D7T0Fr-Y.js} +1 -1
  63. package/assets/{circle-question-mark-CpApZe3H.js → circle-question-mark-BJ-7TUgf.js} +1 -1
  64. package/assets/{classification-C7_2tIfb.js → classification-IsZmGA3c.js} +1 -1
  65. package/assets/{clock-CTlZVcLb.js → clock-CcJSq9G-.js} +1 -1
  66. package/assets/{cloud-off-CtJJ9OTh.js → cloud-off-KCT2nWKe.js} +1 -1
  67. package/assets/compose._-_outboxMessageId_-5h4Thyui.js +1 -0
  68. package/assets/compose._-_outboxMessageId_-CG67dlL2.js +1 -0
  69. package/assets/compose._-_outboxMessageId_-Dm_l3weH.js +1 -0
  70. package/assets/compose._-_outboxMessageId_-TYmtS11N.js +1 -0
  71. package/assets/compose._-_outboxMessageId_-wdQo3fol.js +1 -0
  72. package/assets/{config-import-CHZ9oJuF.js → config-import-CDPSmiwE.js} +1 -1
  73. package/assets/{confirm-dialog-Cc446-7C.js → confirm-dialog-Nw9MwHVJ.js} +1 -1
  74. package/assets/{copy-jXKvwaUz.js → copy-CBfiykpW.js} +1 -1
  75. package/assets/{credential-steps-yT5IXLY8.js → credential-steps-DijGQsa7.js} +1 -1
  76. package/assets/{download-CyhaY4zL.js → download-BGcYYhWw.js} +1 -1
  77. package/assets/{draft-C1ufEqDz.js → draft-BIlfX99J.js} +1 -1
  78. package/assets/edit-DPWo7v-f.js +1 -0
  79. package/assets/edit-DZEKnuQ0.js +1 -0
  80. package/assets/{external-link-1TiTglgB.js → external-link-D7g7AAZP.js} +1 -1
  81. package/assets/{file-braces-CXZUVCry.js → file-braces-GrxXAr-8.js} +1 -1
  82. package/assets/{filters-CR0iG1ow.js → filters-DfUsL7bX.js} +1 -1
  83. package/assets/{flagged-DuEE_WUV.js → flagged-B833_7J0.js} +1 -1
  84. package/assets/flagged-zsMPG8wt.js +1 -0
  85. package/assets/{folder-input-kcvJkrLj.js → folder-input-uYHmZSIB.js} +1 -1
  86. package/assets/{folders-6mmHeM8E.js → folders-B2KHLLXQ.js} +1 -1
  87. package/assets/{help-copy-CIhcXCo3.js → help-copy-DWTmr8ZJ.js} +1 -1
  88. package/assets/{import-76KXkdMq.js → import-S0-kKNSZ.js} +1 -1
  89. package/assets/{index-yeSesYv-.js → index-9QMShYZC.js} +35 -35
  90. package/assets/index-BBhFHooJ.js +1 -0
  91. package/assets/index-BC4E5AdD.js +1 -0
  92. package/assets/{index-iXcp-mGT.js → index-Baytk5ez.js} +4 -4
  93. package/assets/index-BeYdWLSr.js +1 -0
  94. package/assets/index-BlWjdYaS.js +1 -0
  95. package/assets/index-CgyMBBs4.js +1 -0
  96. package/assets/index-D2U9KSTT.js +1 -0
  97. package/assets/index-DB540_Zp.js +1 -0
  98. package/assets/index-DX3L0os1.js +1 -0
  99. package/assets/index-DwKXH-XS.js +1 -0
  100. package/assets/index-dE8tDfaV.js +1 -0
  101. package/assets/index-gg1vreMW.js +1 -0
  102. package/assets/index-opRNV15g.js +1 -0
  103. package/assets/{kbd-BVK8yKhS.js → kbd-BD-ER_Yv.js} +1 -1
  104. package/assets/{label-chip-CrQMhpJe.js → label-chip-D6mHiJlY.js} +1 -1
  105. package/assets/{labels-CaXUAL8B.js → labels-SmD1KE3F.js} +1 -1
  106. package/assets/mail-AiBxTd_5.js +1 -0
  107. package/assets/{mail-CLkdzm71.js → mail-DZhnB5_L.js} +1 -1
  108. package/assets/{menu-Cn2tY52U.js → menu-BQAGsNoE.js} +1 -1
  109. package/assets/{nav-link-BvlYCbp-.js → nav-link-BaRr8ufx.js} +1 -1
  110. package/assets/new-CBzvvAzX.js +1 -0
  111. package/assets/onboarding-Boe7D95J.js +1 -0
  112. package/assets/{onboarding-completion-CJl9zKMA.js → onboarding-completion-CEthyLI-.js} +1 -1
  113. package/assets/outbox-BqHfAcnr.js +1 -0
  114. package/assets/{pencil-A679n1yJ.js → pencil-Dp-S5che.js} +1 -1
  115. package/assets/{people-C5ni4bV_.js → people-CFuQvhz_.js} +1 -1
  116. package/assets/{plus-D9A6i0pi.js → plus-ivySO7aD.js} +1 -1
  117. package/assets/{popover-menu-wrc2e8Vk.js → popover-menu-CNRsrfGN.js} +1 -1
  118. package/assets/{refresh-cw-BRmmCn_2.js → refresh-cw-D43K-uJ_.js} +1 -1
  119. package/assets/{reply-DL5kkaJs.js → reply-CdhmgK8D.js} +1 -1
  120. package/assets/{rich-text-EZFEOU8t.js → rich-text-BNnd4RhC.js} +1 -1
  121. package/assets/{rich-text-spellcheck-worker-provider-NOmoFs4G.js → rich-text-spellcheck-worker-provider-D35wa69O.js} +1 -1
  122. package/assets/{rotate-ccw-C2NtRHS-.js → rotate-ccw-DY-C3cnl.js} +1 -1
  123. package/assets/{roving-focus-CSq3MPWi.js → roving-focus-CfNxjWPW.js} +1 -1
  124. package/assets/{row-actions-Cthc4RCY.js → row-actions-DMyxcQFg.js} +1 -1
  125. package/assets/{search-mirror-CCAs_ZWe.js → search-mirror-PLEys8yY.js} +1 -1
  126. package/assets/{search-scope-DaiXqXNv.js → search-scope-DowTds7f.js} +1 -1
  127. package/assets/{search-token-index-VBBiMTaA.js → search-token-index-Qe9FLPUx.js} +1 -1
  128. package/assets/{sections-uFHlOXiA.js → sections-aErIO9A7.js} +1 -1
  129. package/assets/{segmented-control-DNxc5Ghi.js → segmented-control-CZRUmZT-.js} +1 -1
  130. package/assets/{select-B9t8348S.js → select-Bar5gCGO.js} +1 -1
  131. package/assets/{senders-uBzIqu95.js → senders-6bWn5dUX.js} +1 -1
  132. package/assets/settings-BfuOXGy8.js +1 -0
  133. package/assets/{settings-screen-CafoSGzb.js → settings-screen-DjVJZ-eS.js} +1 -1
  134. package/assets/{shield-check-BdZGtm0z.js → shield-check-C-ddv9so.js} +1 -1
  135. package/assets/{spam-DKjh33Xi.js → spam-CfM26JXy.js} +1 -1
  136. package/assets/{suggest-list-Do7i1-gb.js → suggest-list-BU1CAWaS.js} +1 -1
  137. package/assets/{suggested-vips-C-je5foZ.js → suggested-vips-CVTKxBdO.js} +1 -1
  138. package/assets/{suggestion._suggestionId-DF2BM_zX.js → suggestion._suggestionId-LOmWNAzV.js} +1 -1
  139. package/assets/{switch-1RDXcNo-.js → switch-C60zzRNi.js} +1 -1
  140. package/assets/{task._calendarTaskId-B7k5whQt.js → task._calendarTaskId-CwbcSZL4.js} +1 -1
  141. package/assets/{undo-2-B-b8_FeJ.js → undo-2-D6HzUJ41.js} +1 -1
  142. package/assets/{useCalendarData-BcNSn1yP.js → useCalendarData-n3x_s1Nb.js} +1 -1
  143. package/assets/{useCalendarScheduling-Dfk1b293.js → useCalendarScheduling-B3bHM8TC.js} +1 -1
  144. package/assets/{useCalendarSuggestions-D_tk6nh4.js → useCalendarSuggestions-dbmN8tRh.js} +1 -1
  145. package/assets/{useCalendarTasks-CX2Wh1Fn.js → useCalendarTasks-CC9jcVTp.js} +1 -1
  146. package/assets/{useClassificationSettings-Bi0m63-O.js → useClassificationSettings-DDXeuHc9.js} +1 -1
  147. package/assets/useCollectionThreads-bR-HQDXT.js +1 -0
  148. package/assets/{useDebouncedValue-AWe2Zncy.js → useDebouncedValue-nIbP08sa.js} +1 -1
  149. package/assets/{useFilters-Bp1QgyWU.js → useFilters-C3QPNclJ.js} +1 -1
  150. package/assets/useInfiniteQuery-CneHLmnO.js +1 -0
  151. package/assets/{useJunkMailboxIds-CWScvBHw.js → useJunkMailboxIds-BCvLXlA_.js} +1 -1
  152. package/assets/{useLabels-CGE9kc74.js → useLabels-BiYidhrJ.js} +1 -1
  153. package/assets/{useLayoutTier-D5MoTNho.js → useLayoutTier-c01ZWqQ0.js} +1 -1
  154. package/assets/{useMediaQuery-Bf7zukl9.js → useMediaQuery-BL50IiYB.js} +1 -1
  155. package/assets/{useMessageBodyContent-BxjoKGiE.js → useMessageBodyContent-DdX1ZZwR.js} +1 -1
  156. package/assets/{useQueries-Dj93detX.js → useQueries-B2w-f15M.js} +1 -1
  157. package/assets/{useRefreshControl-DCFTdDZz.js → useRefreshControl-C-8PJltS.js} +1 -1
  158. package/assets/{useResultFolderIndex-DAcbTt0T.js → useResultFolderIndex-BTY9xXDW.js} +1 -1
  159. package/assets/{useSignature-CA8ypw7f.js → useSignature-DQ-8mjVB.js} +1 -1
  160. package/assets/{warnings-C-blkf-m.js → warnings-iL5faBYa.js} +1 -1
  161. package/index.html +1 -1
  162. package/package.json +1 -1
  163. package/assets/CollectionPane-RUuB6sFo.js +0 -1
  164. package/assets/MailViewChrome-BDymWKX9.js +0 -1
  165. package/assets/_calendarObjectId-B3IHxxnZ.js +0 -1
  166. package/assets/_labelId-BX1_9FW3.js +0 -1
  167. package/assets/_mailboxId-BKCf6hRR.js +0 -1
  168. package/assets/_messageId-DGc5xyqH.js +0 -1
  169. package/assets/_messageId-ODP9L5rG.js +0 -1
  170. package/assets/_messageId-_9l1GYCG.js +0 -1
  171. package/assets/_messageId-t0gwqxwG.js +0 -1
  172. package/assets/_outboxMessageId-DGFiVWCU.js +0 -1
  173. package/assets/_recurrenceId-yqFEhvsn.js +0 -1
  174. package/assets/_threadId-Bvd5G-pJ.js +0 -1
  175. package/assets/_threadId-BwJQjORR.js +0 -1
  176. package/assets/_threadId-CFLbzDUi.js +0 -1
  177. package/assets/_threadId-Dj29QtLs.js +0 -1
  178. package/assets/brief-NsiukvBp.js +0 -1
  179. package/assets/compose._-_outboxMessageId_-BT2RKEAF.js +0 -1
  180. package/assets/compose._-_outboxMessageId_-B_NGqkpg.js +0 -1
  181. package/assets/compose._-_outboxMessageId_-CCPr3GjM.js +0 -1
  182. package/assets/compose._-_outboxMessageId_-CFBNHbeY.js +0 -1
  183. package/assets/compose._-_outboxMessageId_-Cw-Zq1kx.js +0 -1
  184. package/assets/edit-BGhTeEac.js +0 -1
  185. package/assets/edit-CeXJ3wiI.js +0 -1
  186. package/assets/flagged-B4N5fCui.js +0 -1
  187. package/assets/index-5PtybTMj.js +0 -1
  188. package/assets/index-B-gNDz7v.js +0 -1
  189. package/assets/index-B1AltYi_.js +0 -1
  190. package/assets/index-BX5kv92z.js +0 -1
  191. package/assets/index-CzMYehsR.js +0 -1
  192. package/assets/index-DT4iQTvg.js +0 -1
  193. package/assets/index-DZ4zN_a2.js +0 -1
  194. package/assets/index-Xq-TD3Lr.js +0 -1
  195. package/assets/index-eKzwYumy.js +0 -1
  196. package/assets/index-ehMMhnu5.js +0 -1
  197. package/assets/index-rui9BQ_f.js +0 -1
  198. package/assets/index-t0gwqxwG.js +0 -1
  199. package/assets/mail-CiuTTyMm.js +0 -1
  200. package/assets/new-ZEuIlDnl.js +0 -1
  201. package/assets/onboarding-bCsMaIPY.js +0 -1
  202. package/assets/outbox-BthyAXQ5.js +0 -1
  203. package/assets/settings-BLs90wKU.js +0 -1
@@ -1 +1 @@
1
- import{j as a,p as x}from"./index-yeSesYv-.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-9QMShYZC.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-yeSesYv-.js";import{C as a}from"./chevron-down-BnC2m4J6.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-9QMShYZC.js";import{C as a}from"./chevron-down-CHMH78GK.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 N,e as k,r as u,bS as q,a as P,f as E,bT as V,bU as A,B as w,X as $,u as L,af as D,bV as M,bW as Q,ar as B,bX as G,bY as K,bZ as F,q as T}from"./index-yeSesYv-.js";import{u as H}from"./useDebouncedValue-AWe2Zncy.js";import{a as U}from"./sections-uFHlOXiA.js";import{s as X}from"./help-copy-CIhcXCo3.js";import{K as v}from"./kbd-BVK8yKhS.js";import{E as O}from"./ErrorState-Bk3DwNvd.js";import{a as z,S as _}from"./settings-screen-CafoSGzb.js";import"./avatar-B_QEsxCw.js";import"./badge-CeCxCmzS.js";import"./chevron-left-CNQ3caMn.js";import"./menu-Cn2tY52U.js";import"./circle-question-mark-CpApZe3H.js";function W({options:t,active:i,onSelect:m}){return e.jsx("div",{role:"tablist",className:N("flex shrink-0 gap-1 overflow-x-auto border-b border-line p-2","lg:w-44 lg:flex-col lg:gap-0 lg:overflow-visible lg:border-r lg:border-b-0 lg:py-2 lg:pr-2 lg:pl-3"),children:t.map(n=>{const d=n.id===i;return e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>m(n.id),className:N("flex min-h-11 shrink-0 items-center gap-2 rounded-md px-3 text-left text-sm transition-colors lg:min-h-0 lg:px-2 lg:py-1",d?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface-sunken hover:text-fg"),children:[e.jsx("span",{className:"flex-1 truncate",children:n.label}),e.jsx("span",{className:N("text-2xs tabular-nums",d?"text-accent-2":"text-fg-subtle"),children:n.count??"—"})]},n.id)})})}const I={vip:"VIPs",muted:"Muted",blocked:"Blocked (reported)",neverSpam:"Never in Spam"},y={muted:"muted",blocked:"blocked",neverSpam:"never-in-spam"},C=(t,i)=>t.flags?.[i];function Y({query:t,onCount:i}){const{data:m,isPending:n,isError:d,error:x}=P(K()),g=k(),l=E({...V(),onSettled:()=>{g.invalidateQueries({queryKey:F()})}}),o=m?.suggestions??[],p=t.trim().toLowerCase(),c=p?o.filter(a=>(a.displayName??"").toLowerCase().includes(p)||a.normalizedEmail.toLowerCase().includes(p)):o;return u.useEffect(()=>{i?.(c.length,o.length)},[i,c.length,o.length]),n?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Loading VIP suggestions…"}):d?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(O,{variant:"inline",title:"Couldn't load VIP suggestions",error:x})}):o.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(v,{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 “",t,"”."]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-row-inset py-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Suggested — promote to VIP"}),c.map(a=>e.jsx(z,{name:a.displayName??a.normalizedEmail,email:a.normalizedEmail,meta:a.replyCount>0?`${a.inboundCount} received · you replied ${a.replyCount}×`:`${a.inboundCount} received · you've never replied`,trailing:e.jsx(w,{variant:"ghost",size:"sm",icon:e.jsx(T,{className:"size-3.5"}),"aria-busy":l.isPending,onClick:()=>{l.isPending||l.mutate({path:{addressId:a.addressId},body:{flags:{vip:{value:!0,setAt:Date.now(),setBy:"user"}}}})},children:"Add VIP"})},a.addressId))]})}function Z({group:t,query:i,onCount:m}){const n=H(i.trim(),300),d=k(),[x,g]=u.useState(null),l=n.length>=2,o=q({query:{q:n,limit:50}}),{data:p,isPending:c,isError:a,error:j}=P({...o,enabled:l}),h=E({...V(),onSuccess:()=>{d.invalidateQueries({queryKey:o.queryKey})}}),f=(p?.items??[]).filter(r=>C(r,t)?.value??!1);return u.useEffect(()=>{m?.(l?f.length:0,null)},[m,l,f.length]),l?c?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Searching…"}):a?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(O,{variant:"inline",title:"Search failed",error:j})}):f.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No ",y[t]," senders matching “",n,"”."]}):e.jsx(e.Fragment,{children:f.map(r=>{const s=C(r,t),S=s?[y[t],s.setAt&&A(s.setAt,{month:"short",year:"numeric"})||null,s.reason?`— ${s.reason}`:null].filter(Boolean).join(" "):y[t],b=h.isPending&&h.variables?.path.addressId===r.addressId,R=h.isError&&x===r.addressId;return e.jsx(z,{name:r.displayName??r.normalizedEmail,email:r.normalizedEmail,danger:t==="blocked",meta:S,trailing:R?e.jsx(w,{variant:"secondary",size:"sm",onClick:()=>{g(r.addressId),h.mutate({path:{addressId:r.addressId},body:{flags:{[t]:{value:!1,setAt:Date.now()}}}})},children:"Retry"}):e.jsx(w,{variant:"ghost",size:"sm",icon:e.jsx($,{className:"size-3.5"}),"aria-busy":b,"aria-label":`Remove ${y[t]} flag`,onClick:()=>{b||(g(r.addressId),h.mutate({path:{addressId:r.addressId},body:{flags:{[t]:{value:!1,setAt:Date.now()}}}}))}})},r.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 ",y[t]," 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(v,{children:"m"})," on any message to mute its sender; ",e.jsx(v,{children:"b"})," to block."]})]})}function ue(){const t=L(),i=D(),m=U(),n=M.useSearch({select:s=>s.group??"vip"}),d=s=>{t({to:"/settings/senders",search:{group:s},replace:!0})},[x,g]=u.useState(""),[l,o]=u.useState(!0),[p,c]=u.useState(0),[a,j]=u.useState({vip:0,muted:null,blocked:null,neverSpam:null}),h=u.useCallback((s,S)=>{c(s),j(b=>({...b,vip:S}))},[]),f=u.useCallback((s,S)=>{c(s),j(b=>({...b,[n]:s}))},[n]),r=a[n];return e.jsx(_,{items:i,activeId:"senders",title:"Senders & Rules",description:"Per-sender preferences — set with one key from any message, managed here.",flush:!0,help:X,helpOpen:l,onToggleHelp:()=>o(s=>!s),onSelect:m,onBackToMail:()=>{t({to:"/mail"})},children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col lg:flex-row",children:[e.jsx(W,{active:n,onSelect:s=>{d(s),g("")},options:Q.map(s=>({id:s,label:I[s],count:a[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(B,{icon:e.jsx(G,{className:"size-4"}),placeholder:`Filter ${I[n].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:n==="vip"?e.jsx(Y,{query:x,onCount:h}):e.jsx(Z,{group:n,query:x,onCount:f})}),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:r!=null?`${p} of ${r} flagged senders`:`${p} flagged senders`}),e.jsxs("span",{children:[e.jsx(v,{children:"j"})," ",e.jsx(v,{children:"k"})," navigate · ",e.jsx(v,{children:"⌫"})," remove flag"]})]})]})]})})}export{Z as SearchGroupPane,ue as component};
1
+ import{j as e,p as N,e as k,r as u,bS as q,a as P,f as E,bT as V,bU as A,B as w,X as $,u as L,af as D,bV as M,bW as Q,ar as B,bX as G,bY as K,bZ as F,q as T}from"./index-9QMShYZC.js";import{u as H}from"./useDebouncedValue-nIbP08sa.js";import{a as U}from"./sections-aErIO9A7.js";import{s as X}from"./help-copy-DWTmr8ZJ.js";import{K as v}from"./kbd-BD-ER_Yv.js";import{E as O}from"./ErrorState-DHsQU1XS.js";import{a as z,S as _}from"./settings-screen-DjVJZ-eS.js";import"./avatar-BLhNXW-W.js";import"./badge-CoJzTE5F.js";import"./chevron-left-Brxnh-p_.js";import"./menu-BQAGsNoE.js";import"./circle-question-mark-BJ-7TUgf.js";function W({options:t,active:i,onSelect:m}){return e.jsx("div",{role:"tablist",className:N("flex shrink-0 gap-1 overflow-x-auto border-b border-line p-2","lg:w-44 lg:flex-col lg:gap-0 lg:overflow-visible lg:border-r lg:border-b-0 lg:py-2 lg:pr-2 lg:pl-3"),children:t.map(n=>{const d=n.id===i;return e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>m(n.id),className:N("flex min-h-11 shrink-0 items-center gap-2 rounded-md px-3 text-left text-sm transition-colors lg:min-h-0 lg:px-2 lg:py-1",d?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface-sunken hover:text-fg"),children:[e.jsx("span",{className:"flex-1 truncate",children:n.label}),e.jsx("span",{className:N("text-2xs tabular-nums",d?"text-accent-2":"text-fg-subtle"),children:n.count??"—"})]},n.id)})})}const I={vip:"VIPs",muted:"Muted",blocked:"Blocked (reported)",neverSpam:"Never in Spam"},y={muted:"muted",blocked:"blocked",neverSpam:"never-in-spam"},C=(t,i)=>t.flags?.[i];function Y({query:t,onCount:i}){const{data:m,isPending:n,isError:d,error:x}=P(K()),g=k(),l=E({...V(),onSettled:()=>{g.invalidateQueries({queryKey:F()})}}),o=m?.suggestions??[],p=t.trim().toLowerCase(),c=p?o.filter(a=>(a.displayName??"").toLowerCase().includes(p)||a.normalizedEmail.toLowerCase().includes(p)):o;return u.useEffect(()=>{i?.(c.length,o.length)},[i,c.length,o.length]),n?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Loading VIP suggestions…"}):d?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(O,{variant:"inline",title:"Couldn't load VIP suggestions",error:x})}):o.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(v,{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 “",t,"”."]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-row-inset py-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Suggested — promote to VIP"}),c.map(a=>e.jsx(z,{name:a.displayName??a.normalizedEmail,email:a.normalizedEmail,meta:a.replyCount>0?`${a.inboundCount} received · you replied ${a.replyCount}×`:`${a.inboundCount} received · you've never replied`,trailing:e.jsx(w,{variant:"ghost",size:"sm",icon:e.jsx(T,{className:"size-3.5"}),"aria-busy":l.isPending,onClick:()=>{l.isPending||l.mutate({path:{addressId:a.addressId},body:{flags:{vip:{value:!0,setAt:Date.now(),setBy:"user"}}}})},children:"Add VIP"})},a.addressId))]})}function Z({group:t,query:i,onCount:m}){const n=H(i.trim(),300),d=k(),[x,g]=u.useState(null),l=n.length>=2,o=q({query:{q:n,limit:50}}),{data:p,isPending:c,isError:a,error:j}=P({...o,enabled:l}),h=E({...V(),onSuccess:()=>{d.invalidateQueries({queryKey:o.queryKey})}}),f=(p?.items??[]).filter(r=>C(r,t)?.value??!1);return u.useEffect(()=>{m?.(l?f.length:0,null)},[m,l,f.length]),l?c?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Searching…"}):a?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(O,{variant:"inline",title:"Search failed",error:j})}):f.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No ",y[t]," senders matching “",n,"”."]}):e.jsx(e.Fragment,{children:f.map(r=>{const s=C(r,t),S=s?[y[t],s.setAt&&A(s.setAt,{month:"short",year:"numeric"})||null,s.reason?`— ${s.reason}`:null].filter(Boolean).join(" "):y[t],b=h.isPending&&h.variables?.path.addressId===r.addressId,R=h.isError&&x===r.addressId;return e.jsx(z,{name:r.displayName??r.normalizedEmail,email:r.normalizedEmail,danger:t==="blocked",meta:S,trailing:R?e.jsx(w,{variant:"secondary",size:"sm",onClick:()=>{g(r.addressId),h.mutate({path:{addressId:r.addressId},body:{flags:{[t]:{value:!1,setAt:Date.now()}}}})},children:"Retry"}):e.jsx(w,{variant:"ghost",size:"sm",icon:e.jsx($,{className:"size-3.5"}),"aria-busy":b,"aria-label":`Remove ${y[t]} flag`,onClick:()=>{b||(g(r.addressId),h.mutate({path:{addressId:r.addressId},body:{flags:{[t]:{value:!1,setAt:Date.now()}}}}))}})},r.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 ",y[t]," 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(v,{children:"m"})," on any message to mute its sender; ",e.jsx(v,{children:"b"})," to block."]})]})}function ue(){const t=L(),i=D(),m=U(),n=M.useSearch({select:s=>s.group??"vip"}),d=s=>{t({to:"/settings/senders",search:{group:s},replace:!0})},[x,g]=u.useState(""),[l,o]=u.useState(!0),[p,c]=u.useState(0),[a,j]=u.useState({vip:0,muted:null,blocked:null,neverSpam:null}),h=u.useCallback((s,S)=>{c(s),j(b=>({...b,vip:S}))},[]),f=u.useCallback((s,S)=>{c(s),j(b=>({...b,[n]:s}))},[n]),r=a[n];return e.jsx(_,{items:i,activeId:"senders",title:"Senders & Rules",description:"Per-sender preferences — set with one key from any message, managed here.",flush:!0,help:X,helpOpen:l,onToggleHelp:()=>o(s=>!s),onSelect:m,onBackToMail:()=>{t({to:"/mail"})},children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col lg:flex-row",children:[e.jsx(W,{active:n,onSelect:s=>{d(s),g("")},options:Q.map(s=>({id:s,label:I[s],count:a[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(B,{icon:e.jsx(G,{className:"size-4"}),placeholder:`Filter ${I[n].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:n==="vip"?e.jsx(Y,{query:x,onCount:h}):e.jsx(Z,{group:n,query:x,onCount:f})}),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:r!=null?`${p} of ${r} flagged senders`:`${p} flagged senders`}),e.jsxs("span",{children:[e.jsx(v,{children:"j"})," ",e.jsx(v,{children:"k"})," navigate · ",e.jsx(v,{children:"⌫"})," remove flag"]})]})]})]})})}export{Z as SearchGroupPane,ue as component};
@@ -0,0 +1 @@
1
+ import{j as t,O as o}from"./index-9QMShYZC.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-yeSesYv-.js";import{A as w}from"./avatar-B_QEsxCw.js";import{B as z}from"./badge-CeCxCmzS.js";import{C as h}from"./chevron-left-CNQ3caMn.js";import{M as S}from"./menu-Cn2tY52U.js";import{C as v}from"./circle-question-mark-CpApZe3H.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 M({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,M as a};
1
+ import{r as j,j as e,p as f,B as i,X as N}from"./index-9QMShYZC.js";import{A as w}from"./avatar-BLhNXW-W.js";import{B as z}from"./badge-CoJzTE5F.js";import{C as h}from"./chevron-left-Brxnh-p_.js";import{M as S}from"./menu-BQAGsNoE.js";import{C as v}from"./circle-question-mark-BJ-7TUgf.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 M({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,M as a};
@@ -1 +1 @@
1
- import{b as a}from"./index-yeSesYv-.js";const e={name:"shield-check",size:24,node:[["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"}]]};e.node;const o=a(e);export{o as S};
1
+ import{b as a}from"./index-9QMShYZC.js";const e={name:"shield-check",size:24,node:[["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"}]]};e.node;const o=a(e);export{o as S};
@@ -1 +1 @@
1
- import{j as e,p as g,r as f,a as j,b_ as E,c as M,b$ as y,c0 as P,c1 as D,c2 as C,c3 as R,c4 as A,a5 as F,c5 as T,c6 as w,s as W,c7 as _,u as z,af as B}from"./index-yeSesYv-.js";import{F as $,u as q}from"./useClassificationSettings-Bi0m63-O.js";import{u as U}from"./useJunkMailboxIds-CWScvBHw.js";import{u as V}from"./useLabels-CGE9kc74.js";import{N as u}from"./nav-link-BvlYCbp-.js";import"./reply-DL5kkaJs.js";import{L as Y}from"./label-chip-CrQMhpJe.js";import{f as v}from"./ErrorState-Bk3DwNvd.js";import{S as G}from"./segmented-control-DNxc5Ghi.js";import{a as H}from"./sections-uFHlOXiA.js";import{S as J}from"./settings-screen-CafoSGzb.js";import"./useMediaQuery-Bf7zukl9.js";import"./avatar-B_QEsxCw.js";import"./badge-CeCxCmzS.js";import"./chevron-left-CNQ3caMn.js";import"./menu-Cn2tY52U.js";import"./circle-question-mark-CpApZe3H.js";const K={warning:{moved:"bg-warning",warned:"bg-warning/35"},danger:{moved:"bg-danger",warned:"bg-danger/35"}},Q=s=>`${s.date}: ${s.moved} moved, ${s.warned} warned`;function I({title:s,tone:t,days:a}){const n=Math.max(1,...a.map(l=>l.moved+l.warned)),c=K[t],m=a[0],r=a[a.length-1];return e.jsxs("figure",{className:"min-w-0",children:[e.jsx("figcaption",{className:"text-xs font-semibold text-fg",children:s}),e.jsx("ul",{className:"mt-2 flex h-24 list-none items-end gap-px border-b border-line",children:a.map(l=>e.jsx("li",{className:"h-full min-w-0 flex-1",children:e.jsxs("span",{role:"img","aria-label":Q(l),className:"flex h-full flex-col justify-end",children:[e.jsx("span",{className:g("w-full rounded-t-sm",c.warned),style:{height:`${l.warned/n*100}%`}}),e.jsx("span",{className:g("w-full",c.moved),style:{height:`${l.moved/n*100}%`}})]})},l.date))}),m&&r&&e.jsxs("div",{"aria-hidden":"true",className:"mt-1 flex justify-between text-2xs text-fg-subtle tabular-nums",children:[e.jsx("span",{children:m.date}),e.jsx("span",{children:r.date})]})]})}const k=30,b=s=>String(s).padStart(2,"0"),O=s=>`${s.getFullYear()}-${b(s.getMonth()+1)}-${b(s.getDate())}`,X=s=>{const t=-s.getTimezoneOffset(),a=t>=0?"+":"-",n=Math.abs(t);return`${a}${b(Math.floor(n/60))}:${b(n%60)}`},Z=(s,t=k)=>{const a=new Date(s.getFullYear(),s.getMonth(),s.getDate()-(t-1));return`${O(a)}T00:00:00${X(a)}`},ee=(s,t=k)=>Array.from({length:t},(a,n)=>O(new Date(s.getFullYear(),s.getMonth(),s.getDate()-(t-1-n)))),se=(s,t)=>{const a=r=>t.map(l=>{const x=i=>s.spamByDay.filter(o=>o.date===l&&o.kind===r&&o.action===i).reduce((o,p)=>o+p.count,0);return{date:l,moved:x("Junk"),warned:x("Warn")}}),n=a("Spam"),c=a("Phishing"),m=r=>[...n,...c].reduce((l,x)=>l+r(x),0);return{checkedAny:s.spamScoreBands.some(r=>r.count>0),moved:m(r=>r.moved),warned:m(r=>r.warned),spam:n,phishing:c}},te="text-xs font-semibold uppercase tracking-wider text-fg-subtle",N=W(400,403,404),L=10;function d({title:s,children:t,aside:a}){const n=f.useId();return e.jsxs("section",{"aria-labelledby":n,className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[e.jsx("h2",{id:n,className:te,children:s}),a]}),t]})}function h({className:s}){return e.jsx("div",{"aria-hidden":"true",className:g("animate-pulse rounded-md bg-surface-sunken",s)})}function S({title:s,error:t,onRetry:a,skeleton:n}){if(F(t))return n;const c=v(t);return e.jsx($,{title:s,message:c,reportHref:T(s,c),onRetry:a})}function ae(){const[s]=f.useState(()=>new Date),t=j({...E({query:{since:Z(s)}}),meta:N}),a=e.jsxs(e.Fragment,{children:[e.jsx(h,{className:"h-4 w-64"}),e.jsxs("div",{className:"grid gap-6 sm:grid-cols-2",children:[e.jsx(h,{className:"h-32"}),e.jsx(h,{className:"h-32"})]})]});if(t.isPending)return e.jsx(d,{title:"Last 30 days",children:a});if(t.isError)return e.jsx(d,{title:"Last 30 days",children:e.jsx(S,{title:"Couldn't count the last 30 days",error:t.error,onRetry:()=>{t.refetch()},skeleton:a})});const n=se(t.data,ee(s));return n.checkedAny?e.jsxs(d,{title:"Last 30 days",children:[e.jsx("p",{className:"text-sm text-fg tabular-nums",children:`Reached Spam ${n.moved} · Warned ${n.warned}`}),e.jsxs("div",{className:"grid gap-6 sm:grid-cols-2",children:[e.jsx(I,{title:"Spam",tone:"warning",days:n.spam}),e.jsx(I,{title:"Phishing",tone:"danger",days:n.phishing})]}),e.jsxs("ul",{className:"flex list-none flex-wrap gap-x-4 gap-y-1 text-2xs text-fg-muted",children:[e.jsxs("li",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"size-2 rounded-sm bg-fg-muted","aria-hidden":"true"}),"Reached the Move to Spam threshold"]}),e.jsxs("li",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"size-2 rounded-sm bg-fg-muted/35","aria-hidden":"true"}),"Warned"]})]})]}):e.jsx(d,{title:"Last 30 days",children:e.jsxs("div",{className:"rounded-md border border-line px-4 py-6 text-center",children:[e.jsx("p",{className:"font-medium text-fg",children:"Remit has not checked any mail yet"}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:"Counts appear here once new mail arrives."})]})})}const ne=async s=>{const{data:t}=await _({query:{labelId:s,order:"desc",limit:L},throwOnError:!0});return t.items??[]};function re(){const s=U(),t=j({...M(),staleTime:1/0}),a=V(t.data?.accounts[0]?.accountId),n=a.labels.find(i=>i.name==="Spam"),c=a.labels.find(i=>i.name==="Phishing"),m=[n,c].flatMap(i=>i?[i.labelId]:[]),r=j({queryKey:["spam-settings","latest-flagged",...m],queryFn:async()=>(await Promise.all(m.map(ne))).flat().filter(i=>!i.spamCleared&&y(i.labels)!==void 0).sort((i,o)=>o.sentDate-i.sentDate).slice(0,L),enabled:a.isSuccess,meta:N}),l=e.jsx("div",{className:"space-y-2",children:["a","b","c","d"].map(i=>e.jsx(h,{className:"h-10"},i))}),x=t.isError?{error:t.error,retry:()=>{t.refetch()}}:a.isError?{error:a.error,retry:()=>{a.refetch()}}:r.isError?{error:r.error,retry:()=>{r.refetch()}}:void 0;return x?e.jsx(d,{title:"Latest flagged",children:e.jsx(S,{title:"Couldn't load the latest flagged mail",error:x.error,onRetry:x.retry,skeleton:l})}):r.isSuccess?r.data.length===0?e.jsx(d,{title:"Latest flagged",children:e.jsx("p",{className:"text-sm text-fg-muted",children:"Nothing flagged yet."})}):e.jsx(d,{title:"Latest flagged",aside:e.jsxs("span",{className:"flex gap-4 text-sm",children:[n&&e.jsx(u,{to:"/mail/label/$labelId",params:{labelId:n.labelId},variant:"inline",children:"Review all in Spam"}),c&&e.jsx(u,{to:"/mail/label/$labelId",params:{labelId:c.labelId},variant:"inline",children:"Open Phishing"})]}),children:e.jsx("div",{className:"overflow-x-auto rounded-md border border-line",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-line text-2xs uppercase tracking-wide text-fg-subtle",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2 font-medium",children:"Sender"}),e.jsx("th",{className:"px-3 py-2 font-medium",children:"Subject and top reason"}),e.jsx("th",{className:"px-3 py-2 font-medium",children:"Date"}),e.jsx("th",{className:"px-3 py-2 font-medium",children:"Label"}),e.jsx("th",{className:"px-3 py-2 font-medium",children:"Action"})]})}),e.jsx("tbody",{className:"divide-y divide-line",children:r.data.map(i=>{const o=y(i.labels);if(!o)return null;const p=P(i.spamVerdict);return e.jsxs("tr",{className:"hover:bg-surface-sunken",children:[e.jsx("td",{className:"px-3 py-2 align-top text-fg",children:i.fromName??i.fromEmail??"Unknown"}),e.jsxs("td",{className:"px-3 py-2 align-top",children:[e.jsx(u,{to:"/mail/label/$labelId/$threadId/$messageId",params:{labelId:o.labelId,threadId:i.threadId,messageId:i.messageId},variant:"inline",className:"text-fg",children:i.subject??"(No subject)"}),p&&e.jsx("p",{className:"text-xs text-fg-muted",children:D(p.reasons)})]}),e.jsx("td",{className:"whitespace-nowrap px-3 py-2 align-top text-fg-muted tabular-nums",children:C(i.sentDate)}),e.jsx("td",{className:"px-3 py-2 align-top",children:e.jsx(Y,{label:o})}),e.jsx("td",{className:"px-3 py-2 align-top text-fg-muted",children:s.has(i.mailboxId)?"Moved":"Warned"})]},i.messageId)})})]})})}):e.jsx(d,{title:"Latest flagged",children:l})}function ie({spam:s}){const{thresholds:t}=s;return e.jsxs(d,{title:"Thresholds",children:[t.state==="Set"?e.jsxs("dl",{className:"flex flex-wrap gap-x-8 gap-y-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-fg-muted",children:"Warn from"}),e.jsx("dd",{className:"font-medium text-fg tabular-nums",children:w(t.cleanBelow)})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-fg-muted",children:"Move to Spam from"}),e.jsx("dd",{className:"font-medium text-fg tabular-nums",children:w(t.spamAt)})]})]}):e.jsx("p",{className:"text-sm text-fg",children:"The spam service applies its own thresholds."}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Scores run from 0 to 1. The deployment sets these values, and they apply to mail arriving from now on. Check again in any list updates older mail."})]})}const le=[{value:"WarnOnly",label:"Warn only"},{value:"MoveToSpam",label:"Move to Spam"}];function ce({spam:s}){const t=q(),[a,n]=f.useState(""),c=f.useId(),m=[{field:"spamPlacementSpam",label:"Spam",value:s.spamPlacement},{field:"spamPlacementPhishing",label:"Phishing",value:s.phishingPlacement}];return e.jsxs(d,{title:"Per label",children:[e.jsx("div",{className:"space-y-2",children:m.map(r=>e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"w-20 text-sm text-fg",children:r.label}),e.jsx(G,{name:`${c}-${r.field}`,"aria-label":`${r.label} label`,size:"sm",options:le,value:r.value,onChange:l=>{n(""),t.mutate({body:{[r.field]:l}},{onSuccess:()=>n("Saved")})}})]},r.field))}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Warn only keeps the message where it arrived, under the warning banner."}),t.isError&&e.jsx($,{title:"The label setting was not saved",message:v(t.error),reportHref:T("The label setting was not saved",v(t.error)),onRetry:()=>t.variables&&t.mutate(t.variables)}),e.jsx("p",{"aria-live":"polite",className:"text-xs text-positive",children:a})]})}function de(){const s=j({...R(),meta:N}),t=e.jsxs(e.Fragment,{children:[e.jsx(d,{title:"Thresholds",children:e.jsx(h,{className:"h-11 w-64"})}),e.jsxs(d,{title:"Per label",children:[e.jsx(h,{className:"h-9 w-48"}),e.jsx(h,{className:"h-9 w-48"})]})]});return s.isPending?t:s.isError?e.jsx(d,{title:"Thresholds",children:e.jsx(S,{title:"Couldn't load the spam settings",error:s.error,onRetry:()=>{s.refetch()},skeleton:t})}):e.jsxs(e.Fragment,{children:[e.jsx(ie,{spam:s.data.spam}),e.jsx(ce,{spam:s.data.spam})]})}function oe(){const s=[{title:"Never in Spam",hint:"Their mail skips the spam check.",group:"neverSpam"},{title:"Reported",hint:"Their mail goes straight to Spam.",group:"blocked"}];return e.jsx(d,{title:"Senders",children:e.jsx("ul",{className:"list-none divide-y divide-line rounded-md border border-line",children:s.map(t=>e.jsxs("li",{className:"flex items-center justify-between gap-3 px-3 py-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:t.title}),e.jsx("p",{className:"text-xs text-fg-muted",children:t.hint})]}),e.jsx(u,{to:"/settings/senders",search:{group:t.group},variant:"inline",className:g(A({variant:"secondary"}),"min-h-11 hover:no-underline"),"aria-label":`Manage ${t.title}`,children:"Manage"})]},t.title))})})}function me(){return e.jsxs("div",{className:"max-w-3xl space-y-8",children:[e.jsx(ae,{}),e.jsx(re,{}),e.jsx(de,{}),e.jsx(oe,{})]})}function Oe(){const s=z(),t=B(),a=H();return e.jsx(J,{items:t,activeId:"spam",title:"Spam & phishing",description:"What Remit flagged, and when it acts.",onSelect:a,onBackToMail:()=>{s({to:"/mail"})},children:e.jsx(me,{})})}export{Oe as component};
1
+ import{j as e,p as g,r as f,a as j,b_ as E,c as M,b$ as y,c0 as P,c1 as D,c2 as C,c3 as R,c4 as A,a5 as F,c5 as T,c6 as w,s as W,c7 as _,u as z,af as B}from"./index-9QMShYZC.js";import{F as $,u as q}from"./useClassificationSettings-DDXeuHc9.js";import{u as U}from"./useJunkMailboxIds-BCvLXlA_.js";import{u as V}from"./useLabels-BiYidhrJ.js";import{N as u}from"./nav-link-BaRr8ufx.js";import"./reply-CdhmgK8D.js";import{L as Y}from"./label-chip-D6mHiJlY.js";import{f as v}from"./ErrorState-DHsQU1XS.js";import{S as G}from"./segmented-control-CZRUmZT-.js";import{a as H}from"./sections-aErIO9A7.js";import{S as J}from"./settings-screen-DjVJZ-eS.js";import"./useMediaQuery-BL50IiYB.js";import"./avatar-BLhNXW-W.js";import"./badge-CoJzTE5F.js";import"./chevron-left-Brxnh-p_.js";import"./menu-BQAGsNoE.js";import"./circle-question-mark-BJ-7TUgf.js";const K={warning:{moved:"bg-warning",warned:"bg-warning/35"},danger:{moved:"bg-danger",warned:"bg-danger/35"}},Q=s=>`${s.date}: ${s.moved} moved, ${s.warned} warned`;function I({title:s,tone:t,days:a}){const n=Math.max(1,...a.map(l=>l.moved+l.warned)),c=K[t],m=a[0],r=a[a.length-1];return e.jsxs("figure",{className:"min-w-0",children:[e.jsx("figcaption",{className:"text-xs font-semibold text-fg",children:s}),e.jsx("ul",{className:"mt-2 flex h-24 list-none items-end gap-px border-b border-line",children:a.map(l=>e.jsx("li",{className:"h-full min-w-0 flex-1",children:e.jsxs("span",{role:"img","aria-label":Q(l),className:"flex h-full flex-col justify-end",children:[e.jsx("span",{className:g("w-full rounded-t-sm",c.warned),style:{height:`${l.warned/n*100}%`}}),e.jsx("span",{className:g("w-full",c.moved),style:{height:`${l.moved/n*100}%`}})]})},l.date))}),m&&r&&e.jsxs("div",{"aria-hidden":"true",className:"mt-1 flex justify-between text-2xs text-fg-subtle tabular-nums",children:[e.jsx("span",{children:m.date}),e.jsx("span",{children:r.date})]})]})}const k=30,b=s=>String(s).padStart(2,"0"),O=s=>`${s.getFullYear()}-${b(s.getMonth()+1)}-${b(s.getDate())}`,X=s=>{const t=-s.getTimezoneOffset(),a=t>=0?"+":"-",n=Math.abs(t);return`${a}${b(Math.floor(n/60))}:${b(n%60)}`},Z=(s,t=k)=>{const a=new Date(s.getFullYear(),s.getMonth(),s.getDate()-(t-1));return`${O(a)}T00:00:00${X(a)}`},ee=(s,t=k)=>Array.from({length:t},(a,n)=>O(new Date(s.getFullYear(),s.getMonth(),s.getDate()-(t-1-n)))),se=(s,t)=>{const a=r=>t.map(l=>{const x=i=>s.spamByDay.filter(o=>o.date===l&&o.kind===r&&o.action===i).reduce((o,p)=>o+p.count,0);return{date:l,moved:x("Junk"),warned:x("Warn")}}),n=a("Spam"),c=a("Phishing"),m=r=>[...n,...c].reduce((l,x)=>l+r(x),0);return{checkedAny:s.spamScoreBands.some(r=>r.count>0),moved:m(r=>r.moved),warned:m(r=>r.warned),spam:n,phishing:c}},te="text-xs font-semibold uppercase tracking-wider text-fg-subtle",N=W(400,403,404),L=10;function d({title:s,children:t,aside:a}){const n=f.useId();return e.jsxs("section",{"aria-labelledby":n,className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[e.jsx("h2",{id:n,className:te,children:s}),a]}),t]})}function h({className:s}){return e.jsx("div",{"aria-hidden":"true",className:g("animate-pulse rounded-md bg-surface-sunken",s)})}function S({title:s,error:t,onRetry:a,skeleton:n}){if(F(t))return n;const c=v(t);return e.jsx($,{title:s,message:c,reportHref:T(s,c),onRetry:a})}function ae(){const[s]=f.useState(()=>new Date),t=j({...E({query:{since:Z(s)}}),meta:N}),a=e.jsxs(e.Fragment,{children:[e.jsx(h,{className:"h-4 w-64"}),e.jsxs("div",{className:"grid gap-6 sm:grid-cols-2",children:[e.jsx(h,{className:"h-32"}),e.jsx(h,{className:"h-32"})]})]});if(t.isPending)return e.jsx(d,{title:"Last 30 days",children:a});if(t.isError)return e.jsx(d,{title:"Last 30 days",children:e.jsx(S,{title:"Couldn't count the last 30 days",error:t.error,onRetry:()=>{t.refetch()},skeleton:a})});const n=se(t.data,ee(s));return n.checkedAny?e.jsxs(d,{title:"Last 30 days",children:[e.jsx("p",{className:"text-sm text-fg tabular-nums",children:`Reached Spam ${n.moved} · Warned ${n.warned}`}),e.jsxs("div",{className:"grid gap-6 sm:grid-cols-2",children:[e.jsx(I,{title:"Spam",tone:"warning",days:n.spam}),e.jsx(I,{title:"Phishing",tone:"danger",days:n.phishing})]}),e.jsxs("ul",{className:"flex list-none flex-wrap gap-x-4 gap-y-1 text-2xs text-fg-muted",children:[e.jsxs("li",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"size-2 rounded-sm bg-fg-muted","aria-hidden":"true"}),"Reached the Move to Spam threshold"]}),e.jsxs("li",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"size-2 rounded-sm bg-fg-muted/35","aria-hidden":"true"}),"Warned"]})]})]}):e.jsx(d,{title:"Last 30 days",children:e.jsxs("div",{className:"rounded-md border border-line px-4 py-6 text-center",children:[e.jsx("p",{className:"font-medium text-fg",children:"Remit has not checked any mail yet"}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:"Counts appear here once new mail arrives."})]})})}const ne=async s=>{const{data:t}=await _({query:{labelId:s,order:"desc",limit:L},throwOnError:!0});return t.items??[]};function re(){const s=U(),t=j({...M(),staleTime:1/0}),a=V(t.data?.accounts[0]?.accountId),n=a.labels.find(i=>i.name==="Spam"),c=a.labels.find(i=>i.name==="Phishing"),m=[n,c].flatMap(i=>i?[i.labelId]:[]),r=j({queryKey:["spam-settings","latest-flagged",...m],queryFn:async()=>(await Promise.all(m.map(ne))).flat().filter(i=>!i.spamCleared&&y(i.labels)!==void 0).sort((i,o)=>o.sentDate-i.sentDate).slice(0,L),enabled:a.isSuccess,meta:N}),l=e.jsx("div",{className:"space-y-2",children:["a","b","c","d"].map(i=>e.jsx(h,{className:"h-10"},i))}),x=t.isError?{error:t.error,retry:()=>{t.refetch()}}:a.isError?{error:a.error,retry:()=>{a.refetch()}}:r.isError?{error:r.error,retry:()=>{r.refetch()}}:void 0;return x?e.jsx(d,{title:"Latest flagged",children:e.jsx(S,{title:"Couldn't load the latest flagged mail",error:x.error,onRetry:x.retry,skeleton:l})}):r.isSuccess?r.data.length===0?e.jsx(d,{title:"Latest flagged",children:e.jsx("p",{className:"text-sm text-fg-muted",children:"Nothing flagged yet."})}):e.jsx(d,{title:"Latest flagged",aside:e.jsxs("span",{className:"flex gap-4 text-sm",children:[n&&e.jsx(u,{to:"/mail/label/$labelId",params:{labelId:n.labelId},variant:"inline",children:"Review all in Spam"}),c&&e.jsx(u,{to:"/mail/label/$labelId",params:{labelId:c.labelId},variant:"inline",children:"Open Phishing"})]}),children:e.jsx("div",{className:"overflow-x-auto rounded-md border border-line",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-line text-2xs uppercase tracking-wide text-fg-subtle",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2 font-medium",children:"Sender"}),e.jsx("th",{className:"px-3 py-2 font-medium",children:"Subject and top reason"}),e.jsx("th",{className:"px-3 py-2 font-medium",children:"Date"}),e.jsx("th",{className:"px-3 py-2 font-medium",children:"Label"}),e.jsx("th",{className:"px-3 py-2 font-medium",children:"Action"})]})}),e.jsx("tbody",{className:"divide-y divide-line",children:r.data.map(i=>{const o=y(i.labels);if(!o)return null;const p=P(i.spamVerdict);return e.jsxs("tr",{className:"hover:bg-surface-sunken",children:[e.jsx("td",{className:"px-3 py-2 align-top text-fg",children:i.fromName??i.fromEmail??"Unknown"}),e.jsxs("td",{className:"px-3 py-2 align-top",children:[e.jsx(u,{to:"/mail/label/$labelId/$threadId/$messageId",params:{labelId:o.labelId,threadId:i.threadId,messageId:i.messageId},variant:"inline",className:"text-fg",children:i.subject??"(No subject)"}),p&&e.jsx("p",{className:"text-xs text-fg-muted",children:D(p.reasons)})]}),e.jsx("td",{className:"whitespace-nowrap px-3 py-2 align-top text-fg-muted tabular-nums",children:C(i.sentDate)}),e.jsx("td",{className:"px-3 py-2 align-top",children:e.jsx(Y,{label:o})}),e.jsx("td",{className:"px-3 py-2 align-top text-fg-muted",children:s.has(i.mailboxId)?"Moved":"Warned"})]},i.messageId)})})]})})}):e.jsx(d,{title:"Latest flagged",children:l})}function ie({spam:s}){const{thresholds:t}=s;return e.jsxs(d,{title:"Thresholds",children:[t.state==="Set"?e.jsxs("dl",{className:"flex flex-wrap gap-x-8 gap-y-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-fg-muted",children:"Warn from"}),e.jsx("dd",{className:"font-medium text-fg tabular-nums",children:w(t.cleanBelow)})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-fg-muted",children:"Move to Spam from"}),e.jsx("dd",{className:"font-medium text-fg tabular-nums",children:w(t.spamAt)})]})]}):e.jsx("p",{className:"text-sm text-fg",children:"The spam service applies its own thresholds."}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Scores run from 0 to 1. The deployment sets these values, and they apply to mail arriving from now on. Check again in any list updates older mail."})]})}const le=[{value:"WarnOnly",label:"Warn only"},{value:"MoveToSpam",label:"Move to Spam"}];function ce({spam:s}){const t=q(),[a,n]=f.useState(""),c=f.useId(),m=[{field:"spamPlacementSpam",label:"Spam",value:s.spamPlacement},{field:"spamPlacementPhishing",label:"Phishing",value:s.phishingPlacement}];return e.jsxs(d,{title:"Per label",children:[e.jsx("div",{className:"space-y-2",children:m.map(r=>e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"w-20 text-sm text-fg",children:r.label}),e.jsx(G,{name:`${c}-${r.field}`,"aria-label":`${r.label} label`,size:"sm",options:le,value:r.value,onChange:l=>{n(""),t.mutate({body:{[r.field]:l}},{onSuccess:()=>n("Saved")})}})]},r.field))}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Warn only keeps the message where it arrived, under the warning banner."}),t.isError&&e.jsx($,{title:"The label setting was not saved",message:v(t.error),reportHref:T("The label setting was not saved",v(t.error)),onRetry:()=>t.variables&&t.mutate(t.variables)}),e.jsx("p",{"aria-live":"polite",className:"text-xs text-positive",children:a})]})}function de(){const s=j({...R(),meta:N}),t=e.jsxs(e.Fragment,{children:[e.jsx(d,{title:"Thresholds",children:e.jsx(h,{className:"h-11 w-64"})}),e.jsxs(d,{title:"Per label",children:[e.jsx(h,{className:"h-9 w-48"}),e.jsx(h,{className:"h-9 w-48"})]})]});return s.isPending?t:s.isError?e.jsx(d,{title:"Thresholds",children:e.jsx(S,{title:"Couldn't load the spam settings",error:s.error,onRetry:()=>{s.refetch()},skeleton:t})}):e.jsxs(e.Fragment,{children:[e.jsx(ie,{spam:s.data.spam}),e.jsx(ce,{spam:s.data.spam})]})}function oe(){const s=[{title:"Never in Spam",hint:"Their mail skips the spam check.",group:"neverSpam"},{title:"Reported",hint:"Their mail goes straight to Spam.",group:"blocked"}];return e.jsx(d,{title:"Senders",children:e.jsx("ul",{className:"list-none divide-y divide-line rounded-md border border-line",children:s.map(t=>e.jsxs("li",{className:"flex items-center justify-between gap-3 px-3 py-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:t.title}),e.jsx("p",{className:"text-xs text-fg-muted",children:t.hint})]}),e.jsx(u,{to:"/settings/senders",search:{group:t.group},variant:"inline",className:g(A({variant:"secondary"}),"min-h-11 hover:no-underline"),"aria-label":`Manage ${t.title}`,children:"Manage"})]},t.title))})})}function me(){return e.jsxs("div",{className:"max-w-3xl space-y-8",children:[e.jsx(ae,{}),e.jsx(re,{}),e.jsx(de,{}),e.jsx(oe,{})]})}function Oe(){const s=z(),t=B(),a=H();return e.jsx(J,{items:t,activeId:"spam",title:"Spam & phishing",description:"What Remit flagged, and when it acts.",onSelect:a,onBackToMail:()=>{s({to:"/mail"})},children:e.jsx(me,{})})}export{Oe as component};
@@ -1 +1 @@
1
- import{r as s,j as x,p as b}from"./index-yeSesYv-.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-9QMShYZC.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,ad as e}from"./index-yeSesYv-.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
1
+ import{j as t,ad as e}from"./index-9QMShYZC.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,f3 as R,f5 as $,f4 as v,r as u,cl as E}from"./index-yeSesYv-.js";import{b as S,n as F,f as h,o as L,t as W,U as j,y as z,l as k,k as B,p as H}from"./useCalendarSuggestions-D_tk6nh4.js";import{e as w,p as U,a as _}from"./draft-C1ufEqDz.js";import{f as P}from"./calendar-format-BwCpz-JZ.js";import{t as M}from"./agenda-time-BcOiQ5_R.js";import{a as V}from"./CalendarSession-BVuy8A2H.js";import{C as G}from"./calendar-failure-note-CJvPzX2o.js";import{E as X,C as Y}from"./EmptyState-CN-AyHj-.js";import{C as q}from"./calendar-event-sidebar-BaAGgT2x.js";import"./nav-link-BvlYCbp-.js";import{k as J,b as K}from"./calendar-CJGXdypt.js";import"./reply-DL5kkaJs.js";import"./ErrorState-Bk3DwNvd.js";import"./useQueries-Dj93detX.js";import"./calendar-guests-DeRthr7k.js";import"./calendar-event-popup-y4Z860B0.js";import"./pencil-A679n1yJ.js";import"./circle-question-mark-CpApZe3H.js";import"./select-B9t8348S.js";import"./chevron-down-BnC2m4J6.js";import"./useMediaQuery-Bf7zukl9.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=h();return u.useMemo(()=>{if(!s||l||d)return;const c=E(e.date,e.startTime,t),p=E(e.endDate,e.endTime,t),f=o.filter(m=>L(m)&&m.calendarObjectId!==a).map(m=>W(m,r[m.calendarId]??j,t));return M({start:c,end:p},f).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,"",h())),[c,p]=u.useState(t),f=V()?.dispatch;u.useEffect(()=>{f?.({type:"sidebar-range",range:{date:t.date,endDate:t.endDate,startTime:t.allDay?"":t.startTime,endTime:t.allDay?"":t.endTime,allDay:t.allDay}})},[t,f]);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:h(),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),f?.({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:h(),timeZones:[h()],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,f3 as R,f5 as $,f4 as v,r as u,cl as E}from"./index-9QMShYZC.js";import{b as S,n as F,f as h,o as L,t as W,U as j,y as z,l as k,k as B,p as H}from"./useCalendarSuggestions-dbmN8tRh.js";import{e as w,p as U,a as _}from"./draft-BIlfX99J.js";import{f as P}from"./calendar-format-BwCpz-JZ.js";import{t as M}from"./agenda-time--0lz2pGX.js";import{a as V}from"./CalendarSession-CjGsYSn3.js";import{C as G}from"./calendar-failure-note-DlpRkxBL.js";import{E as X,C as Y}from"./EmptyState-FjON9Ve2.js";import{C as q}from"./calendar-event-sidebar-Bi4U7yon.js";import"./nav-link-BaRr8ufx.js";import{k as J,b as K}from"./calendar-BRsmtlld.js";import"./reply-CdhmgK8D.js";import"./ErrorState-DHsQU1XS.js";import"./useQueries-B2w-f15M.js";import"./calendar-guests-BQoxXEOG.js";import"./calendar-event-popup-DsOb1y1u.js";import"./pencil-Dp-S5che.js";import"./circle-question-mark-BJ-7TUgf.js";import"./select-Bar5gCGO.js";import"./chevron-down-CHMH78GK.js";import"./useMediaQuery-BL50IiYB.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=h();return u.useMemo(()=>{if(!s||l||d)return;const c=E(e.date,e.startTime,t),p=E(e.endDate,e.endTime,t),f=o.filter(m=>L(m)&&m.calendarObjectId!==a).map(m=>W(m,r[m.calendarId]??j,t));return M({start:c,end:p},f).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,"",h())),[c,p]=u.useState(t),f=V()?.dispatch;u.useEffect(()=>{f?.({type:"sidebar-range",range:{date:t.date,endDate:t.endDate,startTime:t.allDay?"":t.startTime,endTime:t.allDay?"":t.endTime,allDay:t.allDay}})},[t,f]);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:h(),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),f?.({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:h(),timeZones:[h()],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-yeSesYv-.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-9QMShYZC.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 E,X as $,p as q,C as B,f5 as L,cl as F,fw as P}from"./index-yeSesYv-.js";import{b as V,f as Z,c as _}from"./useCalendarSuggestions-D_tk6nh4.js";import{b as H,C as j,u as K}from"./useCalendarTasks-CX2Wh1Fn.js";import"./nav-link-BvlYCbp-.js";import{b as S}from"./calendar-CJGXdypt.js";import"./reply-DL5kkaJs.js";import{C as M}from"./CalendarLoadFailed-uHGxFBGx.js";import{C as A}from"./calendar-event-popup-y4Z860B0.js";import"./ErrorState-Bk3DwNvd.js";import"./useQueries-Dj93detX.js";import"./useMediaQuery-Bf7zukl9.js";import"./pencil-A679n1yJ.js";const I={name:"square",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]};I.node;const O=w(I);const R={name:"square-check-big",size:24,node:[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],aliases:["check-square"]};R.node;const W=w(R),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 U({headingId:s,headingRef:i,fields:l,dueText:r,listName:u,completed:c,onToggle:f,onSave:p,onDelete:g,onClose:x,busy:m=!1,failure:h}){const[t,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:[t===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(E,{className:"size-4"})}),e.jsx("button",{type:"button","aria-label":"Close",onClick:x,className:D,children:e.jsx($,{className:"size-4"})})]}),t===null?e.jsxs("div",{className:"flex flex-col gap-2 px-2",children:[e.jsx("h2",{id:s,ref:i,tabIndex:-1,className:q("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(B,{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(),p(t),o(null)},children:[e.jsx("h2",{id:s,className:"sr-only",children:"Edit task"}),e.jsx("input",{"aria-label":"Title",value:t.title,onChange:n=>o({...t,title:n.target.value}),className:v}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"date","aria-label":"Due date",value:t.dueDate,onChange:n=>n.target.value!==""&&o({...t,dueDate:n.target.value}),className:v}),e.jsx("input",{type:"time","aria-label":"Due time",value:t.dueTime,onChange:n=>o({...t,dueTime:n.target.value}),className:v})]}),e.jsx("textarea",{"aria-label":"Description",rows:3,value:t.description,onChange:n=>o({...t,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(A,{failure:h}),t===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(W,{className:"size-4","aria-hidden":"true"}),c?"Mark not done":"Mark done"]})})]})}const X=(s,i)=>{const l=new Date(`${s.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} · ${s.slice(11,16)}`};function G({calendarTaskId:s}){const i=H(s),{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(J,{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(M,{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 J({task:s}){const{taskLists:i}=V(),{closeToView:l}=S(),{updateTask:r,deleteTask:u,isWriting:c}=K(),f=d.useId(),p=d.useRef(null),[g,x]=d.useState(),[m,h]=d.useState(null),{calendarTaskId:t}=s;d.useLayoutEffect(()=>{h(document.querySelector(`[data-task-id="${CSS.escape(t)}"]`))},[t]),d.useEffect(()=>{p.current?.focus()},[]);const o=Z(),n=s.allDay?s.due:L(s.due,o),z={title:s.summary,dueDate:n.slice(0,10),dueTime:s.allDay?"":n.slice(11,16),description:s.description},b=a=>N=>{if(N.kind==="written"){x(void 0);return}const T=`Couldn't save the task: ${N.message}`;x({text:T,reportHref:_(T),onRetry:a})},y=()=>{r(s,{completed:!s.completed}).then(b(y))},k=a=>{r(s,{summary:a.title,description:a.description,allDay:a.dueTime==="",due:a.dueTime===""?a.dueDate:F(a.dueDate,a.dueTime,o)}).then(b(()=>k(a)))},C=()=>{u(s).then(a=>{if(a.kind==="written"){l();return}b(C)(a)})};return e.jsx(j,{anchor:m,anchorKey:`${t}:${m?"chip":"none"}`,labelledBy:f,children:e.jsx(U,{headingId:f,headingRef:p,fields:z,dueText:X(n,s.allDay),listName:i.find(a=>a.id===s.calendarId)?.name??"Tasks",completed:s.completed,onToggle:y,onSave:k,onDelete:C,onClose:l,busy:c,failure:g})})}function ce(){const{calendarTaskId:s}=P.useParams();return e.jsx(G,{calendarTaskId:s})}export{ce as component};
1
+ import{b as w,r as d,j as e,T as E,X as $,p as q,C as B,f5 as L,cl as F,fw as P}from"./index-9QMShYZC.js";import{b as V,f as Z,c as _}from"./useCalendarSuggestions-dbmN8tRh.js";import{b as H,C as j,u as K}from"./useCalendarTasks-CC9jcVTp.js";import"./nav-link-BaRr8ufx.js";import{b as S}from"./calendar-BRsmtlld.js";import"./reply-CdhmgK8D.js";import{C as M}from"./CalendarLoadFailed-D9O_t7aS.js";import{C as A}from"./calendar-event-popup-DsOb1y1u.js";import"./ErrorState-DHsQU1XS.js";import"./useQueries-B2w-f15M.js";import"./useMediaQuery-BL50IiYB.js";import"./pencil-Dp-S5che.js";const I={name:"square",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]};I.node;const O=w(I);const R={name:"square-check-big",size:24,node:[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],aliases:["check-square"]};R.node;const W=w(R),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 U({headingId:s,headingRef:i,fields:l,dueText:r,listName:u,completed:c,onToggle:f,onSave:p,onDelete:g,onClose:x,busy:m=!1,failure:h}){const[t,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:[t===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(E,{className:"size-4"})}),e.jsx("button",{type:"button","aria-label":"Close",onClick:x,className:D,children:e.jsx($,{className:"size-4"})})]}),t===null?e.jsxs("div",{className:"flex flex-col gap-2 px-2",children:[e.jsx("h2",{id:s,ref:i,tabIndex:-1,className:q("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(B,{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(),p(t),o(null)},children:[e.jsx("h2",{id:s,className:"sr-only",children:"Edit task"}),e.jsx("input",{"aria-label":"Title",value:t.title,onChange:n=>o({...t,title:n.target.value}),className:v}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"date","aria-label":"Due date",value:t.dueDate,onChange:n=>n.target.value!==""&&o({...t,dueDate:n.target.value}),className:v}),e.jsx("input",{type:"time","aria-label":"Due time",value:t.dueTime,onChange:n=>o({...t,dueTime:n.target.value}),className:v})]}),e.jsx("textarea",{"aria-label":"Description",rows:3,value:t.description,onChange:n=>o({...t,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(A,{failure:h}),t===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(W,{className:"size-4","aria-hidden":"true"}),c?"Mark not done":"Mark done"]})})]})}const X=(s,i)=>{const l=new Date(`${s.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} · ${s.slice(11,16)}`};function G({calendarTaskId:s}){const i=H(s),{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(J,{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(M,{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 J({task:s}){const{taskLists:i}=V(),{closeToView:l}=S(),{updateTask:r,deleteTask:u,isWriting:c}=K(),f=d.useId(),p=d.useRef(null),[g,x]=d.useState(),[m,h]=d.useState(null),{calendarTaskId:t}=s;d.useLayoutEffect(()=>{h(document.querySelector(`[data-task-id="${CSS.escape(t)}"]`))},[t]),d.useEffect(()=>{p.current?.focus()},[]);const o=Z(),n=s.allDay?s.due:L(s.due,o),z={title:s.summary,dueDate:n.slice(0,10),dueTime:s.allDay?"":n.slice(11,16),description:s.description},b=a=>N=>{if(N.kind==="written"){x(void 0);return}const T=`Couldn't save the task: ${N.message}`;x({text:T,reportHref:_(T),onRetry:a})},y=()=>{r(s,{completed:!s.completed}).then(b(y))},k=a=>{r(s,{summary:a.title,description:a.description,allDay:a.dueTime==="",due:a.dueTime===""?a.dueDate:F(a.dueDate,a.dueTime,o)}).then(b(()=>k(a)))},C=()=>{u(s).then(a=>{if(a.kind==="written"){l();return}b(C)(a)})};return e.jsx(j,{anchor:m,anchorKey:`${t}:${m?"chip":"none"}`,labelledBy:f,children:e.jsx(U,{headingId:f,headingRef:p,fields:z,dueText:X(n,s.allDay),listName:i.find(a=>a.id===s.calendarId)?.name??"Tasks",completed:s.completed,onToggle:y,onSave:k,onDelete:C,onClose:l,busy:c,failure:g})})}function ce(){const{calendarTaskId:s}=P.useParams();return e.jsx(G,{calendarTaskId:s})}export{ce as component};
@@ -1 +1 @@
1
- import{b as a}from"./index-yeSesYv-.js";const o={name:"undo-2",size:24,node:[["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"}]]};o.node;const n=a(o);export{n as U};
1
+ import{b as a}from"./index-9QMShYZC.js";const o={name:"undo-2",size:24,node:[["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"}]]};o.node;const n=a(o);export{n as U};
@@ -1,2 +1,2 @@
1
- import{j as c,p as x,B as E,r as f,f4 as S}from"./index-yeSesYv-.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-D_tk6nh4.js";import{a as q,t as z}from"./useCalendarTasks-CX2Wh1Fn.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 c.jsxs("div",{className:x("flex flex-col gap-3",d),children:[c.jsxs("div",{children:[c.jsxs("h2",{className:"text-md font-semibold text-fg",children:[e," repeats"]}),c.jsx("p",{className:"text-xs text-fg-muted",children:s}),c.jsxs("p",{className:"text-xs text-fg-subtle",children:["You clicked ",n,"."]})]}),c.jsx("p",{className:"text-sm text-fg",children:"What should the change apply to?"}),c.jsx("div",{className:"flex flex-col gap-1.5",children:K.filter(l=>a===void 0||a.includes(l.scope)).map(l=>c.jsxs("button",{type:"button",onClick:()=>t(l.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:[c.jsx("span",{className:"text-sm font-medium text-fg",children:l.label}),c.jsx("span",{className:"text-2xs text-fg-subtle",children:l.note})]},l.scope))}),c.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 c,p as x,B as E,r as f,f4 as S}from"./index-9QMShYZC.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-dbmN8tRh.js";import{a as q,t as z}from"./useCalendarTasks-CC9jcVTp.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 c.jsxs("div",{className:x("flex flex-col gap-3",d),children:[c.jsxs("div",{children:[c.jsxs("h2",{className:"text-md font-semibold text-fg",children:[e," repeats"]}),c.jsx("p",{className:"text-xs text-fg-muted",children:s}),c.jsxs("p",{className:"text-xs text-fg-subtle",children:["You clicked ",n,"."]})]}),c.jsx("p",{className:"text-sm text-fg",children:"What should the change apply to?"}),c.jsx("div",{className:"flex flex-col gap-1.5",children:K.filter(l=>a===void 0||a.includes(l.scope)).map(l=>c.jsxs("button",{type:"button",onClick:()=>t(l.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:[c.jsx("span",{className:"text-sm font-medium text-fg",children:l.label}),c.jsx("span",{className:"text-2xs text-fg-subtle",children:l.note})]},l.scope))}),c.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:l,resolved:j,isLoading:N}=Y(n),w=S(e,s),h=t&&j,i=P({...w,calendarIds:l,enabled:h});U(e,s,l,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 y,a as f,c as S,c3 as m,f as b,ca as g,r as d,cL as M,cK as p,aS as I,bS as h}from"./index-yeSesYv-.js";import{u as x}from"./useQueries-Dj93detX.js";import{u as O}from"./useDebouncedValue-AWe2Zncy.js";function Q(){const s=y(),{data:a}=f({...S(),staleTime:6e4}),{data:o}=f(m()),r=b(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=y(),o=b(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 y,a as f,c as S,c3 as m,f as b,ca as g,r as d,cL as M,cK as p,aS as I,bS as h}from"./index-9QMShYZC.js";import{u as x}from"./useQueries-B2w-f15M.js";import{u as O}from"./useDebouncedValue-nIbP08sa.js";function Q(){const s=y(),{data:a}=f({...S(),staleTime:6e4}),{data:o}=f(m()),r=b(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=y(),o=b(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 ee,az as Q,aA as B,f5 as N,a as C,f6 as te,r as d,e as v,s as b,f as m,f7 as ne,f8 as ae,f9 as se,aS as A,b2 as re,b0 as oe,b1 as ie,fa as ce,cj as w,fb as h,f4 as de,co as le,fc as ue,fd as fe,fe as ge,ff as pe,fg as me,fh as Ce,fi as be,fj as ye}from"./index-yeSesYv-.js";import{f as I}from"./ErrorState-Bk3DwNvd.js";import{u as G}from"./useQueries-Dj93detX.js";const z={name:"map-pin",size:24,node:[["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"}]]};z.node;const Fe=ee(z),Ee={"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 Ee[e]}function Ue(e){return Q(B({title:`Calendar invitation: ${e}`,errorMessage:e}))}function $e(e){return Q(B({title:`Calendar event: ${e}`,errorMessage:e}))}const K=()=>Intl.DateTimeFormat().resolvedOptions().timeZone,x="";function Qe(e){if(e!==x)return e;const t=K();return Intl.supportedValuesOf("timeZone").includes(t)?t:x}const Oe={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"},Be=e=>Z[e],he={Local:"local",Explicit:"explicit",Ambiguous:"ambiguous"},H="#";function Se(e,t){return t===""?e:`${e}${H}${t}`}function P(e){const t=e.indexOf(H);return t===-1?{calendarObjectId:e,recurrenceId:""}:{calendarObjectId:e.slice(0,t),recurrenceId:e.slice(t+1)}}const V=(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 we(e,t,n){const a=V(e.filter(r=>{const o=P(r.id);return o.calendarObjectId===t&&o.recurrenceId!==""}),n);return a?P(a.id):void 0}function q(e,t,n,a){const r=V(e.filter(o=>o.calendarObjectId===t&&Ae(o)).map(o=>ve(o,"",a)),n);if(r)return{...P(r.id),calendarId:r.calendarId,date:r.start.slice(0,10)}}function j(e){return{id:e.calendarId,accountId:e.accountConfigId,accountLabel:"",name:e.displayName,color:Oe[e.color]??"cal-1",...e.source==="Subscribed"?{readOnly:!0,sync:e.subscriptionEnabled?"live":"paused",syncError:e.subscriptionError}:{}}}function ve(e,t,n){return{id:Se(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:he[e.zoneCertainty]??"explicit",recurrenceRule:e.hasRecurrence?"Repeats":"",seriesId:e.hasRecurrence?e.icalUid:"",seriesException:!1,status:e.status==="Tentative"?"tentative":"confirmed"}}const Ae=e=>e.status!=="Cancelled";function Ge(){const{data:e,isLoading:t,error:n,refetch:a}=C(te());return d.useMemo(()=>{const r=e?.items??[],o=r.filter(i=>i.componentSet!=="VtodoOnly"),l=o.map(j),s=r.filter(i=>i.componentSet==="VtodoOnly").map(j);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=b(400,404,412),Ie=new Set(["calendarEventOperationsListCalendarEvents","calendarEventDetailOperationsGetCalendarEvent","calendarFreeBusyOperationsListCalendarFreeBusy","calendarTaskOperationsListCalendarTasks","calendarTaskDetailOperationsGetCalendarTask"]),F=e=>A(e)===412?{kind:"conflict"}:{kind:"refused",message:I(e)},ke={this:"This",following:"Following",all:"All"};function Y(){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"&&Ie.has(a)}})},[e])}const W=({scope:e,recurrenceId:t})=>e===void 0?{}:{scope:ke[e],recurrenceId:t};function ze(){const e=Y(),t=m({...ne(),meta:D,onSuccess:e}),n=m({...ae(),meta:D,onSuccess:e}),a=m({...se(),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,...W(s)},headers:{"If-Match":s.etag},body:i}).then(f=>({kind:"written",sends:f.sends})).catch(F),[n]),l=d.useCallback(s=>a.mutateAsync({path:{calendarObjectId:s.calendarObjectId},query:{calendarId:s.calendarId,...W(s)},headers:{"If-Match":s.etag}}).then(i=>({kind:"written",sends:i.sends})).catch(F),[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=b(400,404),L={kind:"written"},R=e=>({kind:"refused",message:I(e)});function Ke(){const e=v(),t=Y(),n=d.useCallback(()=>e.invalidateQueries({queryKey:re()}),[e]),a=d.useCallback(()=>(t(),n()),[t,n]),r=m({...oe(),meta:M,onSuccess:n}),o=m({...ie(),meta:M,onSuccess:a}),l=m({...ce(),meta:M,onSuccess:a}),s=d.useCallback(c=>r.mutateAsync({body:c}).then(()=>L).catch(R),[r]),i=d.useCallback((c,g)=>o.mutateAsync({path:{calendarId:c},body:g}).then(()=>L).catch(R),[o]),f=d.useCallback(c=>l.mutateAsync({path:{calendarId:c}}).then(()=>L).catch(R),[l]);return d.useMemo(()=>({createCalendar:s,updateCalendar:i,deleteCalendar:f,isWriting:r.isPending||o.isPending||l.isPending}),[s,i,f,r.isPending,o.isPending,l.isPending])}const De=b(404);function Ze(e,t){const{data:n,isLoading:a,error:r,refetch:o}=C({...w({path:{calendarObjectId:e},query:{calendarId:t}}),meta:De,enabled:e!==""&&t!==""});return{resource:n,isLoading:a,error:r,refetch:()=>{o()}}}const J=b(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 He(e){const{data:t,isLoading:n,error:a,refetch:r}=C({...h(T(e)),meta:J,staleTime:k,enabled:e.enabled??!0});return{instances:t?.items??[],isLoading:n,error:a,refetch:()=>{r()}}}function Ve(e,t,n){const a=G({queries:e.map(c=>({...h(T({...c,calendarIds:t})),meta:J,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]),f=d.useMemo(()=>{const c=new Set;return e.forEach((g,u)=>{a[u]?.isPending&&c.add(g.from)}),c},[r,l]);return{instances:i,pendingWindows:f,error:s,refetch:()=>{for(const c of a)c.error&&c.refetch()}}}function Ye(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=de(e,le(t,e,s));r.prefetchQuery({...h(T({...i,calendarIds:l})),staleTime:k})}},[r,e,t,o,a])}const Me=b(400,404);function Je(e){const t=G({queries:e.map(s=>({...ue({query:{from:s.from,to:s.to}}),meta:Me,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,f)=>{t[f]?.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,Le=1440*6e4,$=b(),Re=b(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 Xe(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({...w({path:{calendarObjectId:e}}),meta:Re,retry:!1,enabled:t&&o.data!==void 0&&l===void 0}),i=Date.parse(s.data?.dtStart??""),f=s.data!==void 0&&Number.isNaN(i),c=Number.isNaN(i)?0:i-Le,g=C({...h({query:{from:S(c),to:S(c+U),calendarObjectId:e}}),meta:$,retry:!1,enabled:t&&s.data!==void 0&&!f}),u=g.data?q(g.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 p=A(s.error)===404,_=[o.error,p?null:s.error,g.error].find(X=>X!==null);return _!==void 0?{kind:"Failed",reason:Pe(_)}:p?{kind:"Deleted"}:f?{kind:"Failed",reason:`the stored event names no readable start (${s.data?.dtStart??""})`}:g.data!==void 0?{kind:"NoOccurrenceFound"}:{kind:"Searching"}}const y=b(400,404),Te=new Set(["calendarSuggestionOperationsListCalendarSuggestions","messageCalendarSuggestionOperationsListMessageCalendarSuggestions","calendarEventOperationsListCalendarEvents","calendarEventDetailOperationsGetCalendarEvent","calendarFreeBusyOperationsListCalendarFreeBusy","filterOperationsListFilters"]),_e=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"&&Te.has(a)}});function et(e){const{data:t,isLoading:n,error:a}=C({...fe({path:{messageId:e}}),meta:y});return{suggestions:t?.items??[],isLoading:n,error:a??null}}function tt(){const{data:e,isLoading:t,error:n}=C({...be({query:{state:"Pending"}}),meta:y});return{suggestions:e?.items??[],isLoading:t,error:n??null}}const Ne=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 nt(e){const{data:t,isLoading:n,error:a}=C({queryKey:[{_id:"calendarSuggestionOperationsListCalendarSuggestions",suggestionId:e}],queryFn:({signal:r})=>Ne(e,r),meta:y});return{suggestion:t,isLoading:n,error:a??null}}const E={kind:"answered"},O=e=>({kind:"refused",message:I(e)});function at(){const e=v(),t=d.useCallback(()=>_e(e),[e]),n=m({...ge(),meta:y,onSuccess:t}),a=m({...pe(),meta:y,onSuccess:t}),r=m({...me(),meta:y,onSuccess:t}),o=m({...Ce(),meta:y,onSuccess:t}),l=d.useCallback((u,p)=>n.mutateAsync({path:{suggestionId:u},body:{calendarId:p}}).then(()=>E).catch(O),[n]),s=d.useCallback((u,p)=>n.mutateAsync({path:{suggestionId:u},body:{calendarId:p,answer:"Tentative"}}).then(()=>E).catch(O),[n]),i=d.useCallback((u,p)=>n.mutateAsync({path:{suggestionId:u},body:p}).then(()=>E).catch(O),[n]),f=d.useCallback(u=>a.mutateAsync({path:{suggestionId:u}}).then(()=>E).catch(O),[a]),c=d.useCallback((u,p)=>r.mutateAsync({path:{suggestionId:u},body:{muteSender:p}}).then(()=>E).catch(O),[r]),g=d.useCallback(u=>o.mutateAsync({path:{suggestionId:u}}).then(()=>E).catch(O),[o]);return d.useMemo(()=>({accept:l,tentative:s,acceptEdited:i,decline:f,dismiss:c,reopen:g,isAnswering:n.isPending||a.isPending||r.isPending||o.isPending}),[l,s,i,f,c,g,n.isPending,a.isPending,r.isPending,o.isPending])}export{D as C,Fe as M,x as U,Y as a,Ge as b,$e as c,We as d,ze as e,K as f,Ve as g,Je as h,Se as i,tt as j,at as k,Ue as l,et as m,He as n,Ae as o,Qe as p,Ye as q,P as r,Ze as s,ve as t,Ke as u,we as v,Xe as w,Be as x,nt as y};
1
+ import{b as ee,az as Q,aA as B,f5 as N,a as C,f6 as te,r as d,e as v,s as b,f as m,f7 as ne,f8 as ae,f9 as se,aS as A,b2 as re,b0 as oe,b1 as ie,fa as ce,cj as w,fb as h,f4 as de,co as le,fc as ue,fd as fe,fe as ge,ff as pe,fg as me,fh as Ce,fi as be,fj as ye}from"./index-9QMShYZC.js";import{f as I}from"./ErrorState-DHsQU1XS.js";import{u as G}from"./useQueries-B2w-f15M.js";const z={name:"map-pin",size:24,node:[["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"}]]};z.node;const Fe=ee(z),Ee={"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 Ee[e]}function Ue(e){return Q(B({title:`Calendar invitation: ${e}`,errorMessage:e}))}function $e(e){return Q(B({title:`Calendar event: ${e}`,errorMessage:e}))}const K=()=>Intl.DateTimeFormat().resolvedOptions().timeZone,x="";function Qe(e){if(e!==x)return e;const t=K();return Intl.supportedValuesOf("timeZone").includes(t)?t:x}const Oe={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"},Be=e=>Z[e],he={Local:"local",Explicit:"explicit",Ambiguous:"ambiguous"},H="#";function Se(e,t){return t===""?e:`${e}${H}${t}`}function P(e){const t=e.indexOf(H);return t===-1?{calendarObjectId:e,recurrenceId:""}:{calendarObjectId:e.slice(0,t),recurrenceId:e.slice(t+1)}}const V=(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 we(e,t,n){const a=V(e.filter(r=>{const o=P(r.id);return o.calendarObjectId===t&&o.recurrenceId!==""}),n);return a?P(a.id):void 0}function q(e,t,n,a){const r=V(e.filter(o=>o.calendarObjectId===t&&Ae(o)).map(o=>ve(o,"",a)),n);if(r)return{...P(r.id),calendarId:r.calendarId,date:r.start.slice(0,10)}}function j(e){return{id:e.calendarId,accountId:e.accountConfigId,accountLabel:"",name:e.displayName,color:Oe[e.color]??"cal-1",...e.source==="Subscribed"?{readOnly:!0,sync:e.subscriptionEnabled?"live":"paused",syncError:e.subscriptionError}:{}}}function ve(e,t,n){return{id:Se(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:he[e.zoneCertainty]??"explicit",recurrenceRule:e.hasRecurrence?"Repeats":"",seriesId:e.hasRecurrence?e.icalUid:"",seriesException:!1,status:e.status==="Tentative"?"tentative":"confirmed"}}const Ae=e=>e.status!=="Cancelled";function Ge(){const{data:e,isLoading:t,error:n,refetch:a}=C(te());return d.useMemo(()=>{const r=e?.items??[],o=r.filter(i=>i.componentSet!=="VtodoOnly"),l=o.map(j),s=r.filter(i=>i.componentSet==="VtodoOnly").map(j);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=b(400,404,412),Ie=new Set(["calendarEventOperationsListCalendarEvents","calendarEventDetailOperationsGetCalendarEvent","calendarFreeBusyOperationsListCalendarFreeBusy","calendarTaskOperationsListCalendarTasks","calendarTaskDetailOperationsGetCalendarTask"]),F=e=>A(e)===412?{kind:"conflict"}:{kind:"refused",message:I(e)},ke={this:"This",following:"Following",all:"All"};function Y(){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"&&Ie.has(a)}})},[e])}const W=({scope:e,recurrenceId:t})=>e===void 0?{}:{scope:ke[e],recurrenceId:t};function ze(){const e=Y(),t=m({...ne(),meta:D,onSuccess:e}),n=m({...ae(),meta:D,onSuccess:e}),a=m({...se(),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,...W(s)},headers:{"If-Match":s.etag},body:i}).then(f=>({kind:"written",sends:f.sends})).catch(F),[n]),l=d.useCallback(s=>a.mutateAsync({path:{calendarObjectId:s.calendarObjectId},query:{calendarId:s.calendarId,...W(s)},headers:{"If-Match":s.etag}}).then(i=>({kind:"written",sends:i.sends})).catch(F),[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=b(400,404),L={kind:"written"},R=e=>({kind:"refused",message:I(e)});function Ke(){const e=v(),t=Y(),n=d.useCallback(()=>e.invalidateQueries({queryKey:re()}),[e]),a=d.useCallback(()=>(t(),n()),[t,n]),r=m({...oe(),meta:M,onSuccess:n}),o=m({...ie(),meta:M,onSuccess:a}),l=m({...ce(),meta:M,onSuccess:a}),s=d.useCallback(c=>r.mutateAsync({body:c}).then(()=>L).catch(R),[r]),i=d.useCallback((c,g)=>o.mutateAsync({path:{calendarId:c},body:g}).then(()=>L).catch(R),[o]),f=d.useCallback(c=>l.mutateAsync({path:{calendarId:c}}).then(()=>L).catch(R),[l]);return d.useMemo(()=>({createCalendar:s,updateCalendar:i,deleteCalendar:f,isWriting:r.isPending||o.isPending||l.isPending}),[s,i,f,r.isPending,o.isPending,l.isPending])}const De=b(404);function Ze(e,t){const{data:n,isLoading:a,error:r,refetch:o}=C({...w({path:{calendarObjectId:e},query:{calendarId:t}}),meta:De,enabled:e!==""&&t!==""});return{resource:n,isLoading:a,error:r,refetch:()=>{o()}}}const J=b(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 He(e){const{data:t,isLoading:n,error:a,refetch:r}=C({...h(T(e)),meta:J,staleTime:k,enabled:e.enabled??!0});return{instances:t?.items??[],isLoading:n,error:a,refetch:()=>{r()}}}function Ve(e,t,n){const a=G({queries:e.map(c=>({...h(T({...c,calendarIds:t})),meta:J,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]),f=d.useMemo(()=>{const c=new Set;return e.forEach((g,u)=>{a[u]?.isPending&&c.add(g.from)}),c},[r,l]);return{instances:i,pendingWindows:f,error:s,refetch:()=>{for(const c of a)c.error&&c.refetch()}}}function Ye(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=de(e,le(t,e,s));r.prefetchQuery({...h(T({...i,calendarIds:l})),staleTime:k})}},[r,e,t,o,a])}const Me=b(400,404);function Je(e){const t=G({queries:e.map(s=>({...ue({query:{from:s.from,to:s.to}}),meta:Me,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,f)=>{t[f]?.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,Le=1440*6e4,$=b(),Re=b(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 Xe(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({...w({path:{calendarObjectId:e}}),meta:Re,retry:!1,enabled:t&&o.data!==void 0&&l===void 0}),i=Date.parse(s.data?.dtStart??""),f=s.data!==void 0&&Number.isNaN(i),c=Number.isNaN(i)?0:i-Le,g=C({...h({query:{from:S(c),to:S(c+U),calendarObjectId:e}}),meta:$,retry:!1,enabled:t&&s.data!==void 0&&!f}),u=g.data?q(g.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 p=A(s.error)===404,_=[o.error,p?null:s.error,g.error].find(X=>X!==null);return _!==void 0?{kind:"Failed",reason:Pe(_)}:p?{kind:"Deleted"}:f?{kind:"Failed",reason:`the stored event names no readable start (${s.data?.dtStart??""})`}:g.data!==void 0?{kind:"NoOccurrenceFound"}:{kind:"Searching"}}const y=b(400,404),Te=new Set(["calendarSuggestionOperationsListCalendarSuggestions","messageCalendarSuggestionOperationsListMessageCalendarSuggestions","calendarEventOperationsListCalendarEvents","calendarEventDetailOperationsGetCalendarEvent","calendarFreeBusyOperationsListCalendarFreeBusy","filterOperationsListFilters"]),_e=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"&&Te.has(a)}});function et(e){const{data:t,isLoading:n,error:a}=C({...fe({path:{messageId:e}}),meta:y});return{suggestions:t?.items??[],isLoading:n,error:a??null}}function tt(){const{data:e,isLoading:t,error:n}=C({...be({query:{state:"Pending"}}),meta:y});return{suggestions:e?.items??[],isLoading:t,error:n??null}}const Ne=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 nt(e){const{data:t,isLoading:n,error:a}=C({queryKey:[{_id:"calendarSuggestionOperationsListCalendarSuggestions",suggestionId:e}],queryFn:({signal:r})=>Ne(e,r),meta:y});return{suggestion:t,isLoading:n,error:a??null}}const E={kind:"answered"},O=e=>({kind:"refused",message:I(e)});function at(){const e=v(),t=d.useCallback(()=>_e(e),[e]),n=m({...ge(),meta:y,onSuccess:t}),a=m({...pe(),meta:y,onSuccess:t}),r=m({...me(),meta:y,onSuccess:t}),o=m({...Ce(),meta:y,onSuccess:t}),l=d.useCallback((u,p)=>n.mutateAsync({path:{suggestionId:u},body:{calendarId:p}}).then(()=>E).catch(O),[n]),s=d.useCallback((u,p)=>n.mutateAsync({path:{suggestionId:u},body:{calendarId:p,answer:"Tentative"}}).then(()=>E).catch(O),[n]),i=d.useCallback((u,p)=>n.mutateAsync({path:{suggestionId:u},body:p}).then(()=>E).catch(O),[n]),f=d.useCallback(u=>a.mutateAsync({path:{suggestionId:u}}).then(()=>E).catch(O),[a]),c=d.useCallback((u,p)=>r.mutateAsync({path:{suggestionId:u},body:{muteSender:p}}).then(()=>E).catch(O),[r]),g=d.useCallback(u=>o.mutateAsync({path:{suggestionId:u}}).then(()=>E).catch(O),[o]);return d.useMemo(()=>({accept:l,tentative:s,acceptEdited:i,decline:f,dismiss:c,reopen:g,isAnswering:n.isPending||a.isPending||r.isPending||o.isPending}),[l,s,i,f,c,g,n.isPending,a.isPending,r.isPending,o.isPending])}export{D as C,Fe as M,x as U,Y as a,Ge as b,$e as c,We as d,ze as e,K as f,Ve as g,Je as h,Se as i,tt as j,at as k,Ue as l,et as m,He as n,Ae as o,Qe as p,Ye as q,P as r,Ze as s,ve as t,Ke as u,we as v,Xe as w,Be as x,nt as y};
@@ -1 +1 @@
1
- import{r as u,j as O,p as v,f as y,fn as P,fo as q,fp as W,a as E,fq as R,aS as I,fr as j,s as D}from"./index-yeSesYv-.js";import{a as z,C as k}from"./useCalendarSuggestions-D_tk6nh4.js";import{f as B}from"./ErrorState-Bk3DwNvd.js";const i=8,x=(e,t,a)=>Math.min(Math.max(e,t),Math.max(t,a)),G=(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 H(e,t,a){if(!e||!G(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 N='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function _({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),[p,A]=u.useState({key:t,x:0,y:0}),g=p.key===t?p:{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(H(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=b=>A({key:t,x:b.clientX-d.x,y:b.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(N));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:v("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 F=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 Q(e,t=!0){const{data:a,error:r,refetch:c}=E({...R({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.":B(e)});function J(){const e=z(),t=y({...P(),meta:k,onSuccess:e}),a=y({...q(),meta:k,onSuccess:e}),r=y({...W(),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{_ as C,Q as a,V as b,F as t,J as u};
1
+ import{r as u,j as O,p as v,f as y,fn as P,fo as q,fp as W,a as E,fq as R,aS as I,fr as j,s as D}from"./index-9QMShYZC.js";import{a as z,C as k}from"./useCalendarSuggestions-dbmN8tRh.js";import{f as B}from"./ErrorState-DHsQU1XS.js";const i=8,x=(e,t,a)=>Math.min(Math.max(e,t),Math.max(t,a)),G=(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 H(e,t,a){if(!e||!G(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 N='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function _({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),[p,A]=u.useState({key:t,x:0,y:0}),g=p.key===t?p:{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(H(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=b=>A({key:t,x:b.clientX-d.x,y:b.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(N));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:v("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 F=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 Q(e,t=!0){const{data:a,error:r,refetch:c}=E({...R({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.":B(e)});function J(){const e=z(),t=y({...P(),meta:k,onSuccess:e}),a=y({...q(),meta:k,onSuccess:e}),r=y({...W(),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{_ as C,Q as a,V as b,F as t,J as u};
@@ -1 +1 @@
1
- import{j as a,d as U,B as C,aS as k,az as x,aA as N,c8 as E,b3 as n,bU as P,s as y,c9 as w,a as K,c3 as I,r as M,bN as S,e as g,f as u,ca as A,cb as B,cc as $}from"./index-yeSesYv-.js";function V({title:e,message:s,reportHref:t,onRetry:r,retryLabel:o="Retry",retryRef:c}){return a.jsxs(U,{tone:"danger",variant:"soft",children:[a.jsx("p",{className:"font-medium",children:e}),a.jsx("p",{className:"mt-0.5 break-words text-fg-muted",children:s}),a.jsxs("p",{className:"flex flex-wrap items-center gap-x-4",children:[r&&a.jsx(C,{ref:c,variant:"secondary",className:"min-h-11",onClick:r,children:o}),a.jsx("a",{href:t,target:"_blank",rel:"noreferrer",className:"inline-flex min-h-11 items-center font-medium text-accent hover:underline",children:"Report an issue"})]})]})}const L=y(403),d={...y(400,403,404,409,422,429),...E},v=e=>k(e)===403,i=e=>e.state==="NotConfigured"?{presetId:void 0,sources:void 0}:e.state==="Unrunnable"?{presetId:e.presetId,sources:void 0}:{presetId:e.presetId,sources:e.sources},O=(e,s)=>{const t=i(e);return t.presetId===s?t.sources:void 0},f=(e,s)=>e.state==="Configured"&&e.sources[s]===n.Saved?e[s]:"",R=(e,s,t)=>e.state==="Configured"&&e.presetId===s&&e[t]!==""?e[t]:void 0,F=e=>({presetId:i(e).presetId,model:f(e,"model"),baseUrl:f(e,"baseUrl"),apiKey:""}),G=(e,s)=>i(s).presetId===e.presetId?F(s):{presetId:e.presetId,model:"",baseUrl:"",apiKey:""},Y=e=>e.state==="Unrunnable"?!0:e.state==="NotConfigured"?!1:Object.values(e.sources).includes(n.Saved),j={Hosted:"Hosted",Custom:"Your own endpoint",Local:"Self-hosted"},z=e=>{const s=[];for(const t of e){const r=s.find(o=>o.group===t.group);if(r){r.presets.push(t);continue}s.push({group:t.group,label:j[t.group],presets:[t]})}return s},D=e=>e.defaultBaseUrl===void 0,X=(e,s)=>s===n.Saved?`${e} Saved by you.`:s===n.Deployment?`${e} Provided by the deployment.`:e,T="Paste an API key",Z=e=>w(e)?.code==="ClassificationApiKeyRequired",p="Enter a URL that starts with http:// or https://",q=e=>{if(!URL.canParse(e))return!1;const{protocol:s}=new URL(e);return s==="http:"||s==="https:"},J=(e,s,t)=>{const r=e.baseUrl.trim(),o=e.apiKey.trim(),c=O(t,s.presetId);if(r!==""&&!q(r))return{ok:!1,field:"BaseUrl",message:p};if(r===""&&D(s)&&R(t,s.presetId,"baseUrl")===void 0)return{ok:!1,field:"BaseUrl",message:p};const b=c?.apiKey??n.Default;return s.needsKey&&o===""&&b===n.Default?{ok:!1,field:"ApiKey",message:T}:{ok:!0,body:{...i(t).presetId!==s.presetId?{classificationPresetId:s.presetId}:{},classificationModel:e.model.trim(),classificationBaseUrl:r,...s.needsKey&&o!==""?{classificationApiKey:o}:{}}}},W=(e,s,t)=>{const r=i(e).presetId;if(!(r===void 0||s===void 0)&&r!==s)return t.find(o=>o.presetId===r)},ee=e=>{const s=e.status===void 0?e.kind:`${e.status}`;return`Test failed after ${e.latencyMs} ms: ${s}`},se=(e,s)=>x(N({title:`Mail classification: ${e}`,errorMessage:`${e}. ${s}`})),te=e=>{const s=e.needsKey?"Needs an API key.":"No key needed.";if(e.price.state!=="Priced")return s;const t=new Intl.NumberFormat("en",{style:"currency",currency:e.price.currency,maximumFractionDigits:4}).format(e.price.perMillionInputTokens);return`${s} ${t} per million input tokens.`},m="Enter a whole number of 1 or more.",H=2147483647,re=e=>{const s=e.trim();if(!/^\d+$/.test(s))return{ok:!1,message:m};const t=Number(s);return t<1||t>H?{ok:!1,message:m}:{ok:!0,limit:t}},oe=e=>e.calls>=e.dailyLimit,ae=(e,s)=>{const{cost:t}=e;if(t.state==="Priced"){const r=new Intl.NumberFormat("en",{style:"currency",currency:t.currency,maximumFractionDigits:2});return t.amount>0&&t.amount<.01?`under ${r.format(.01)}`:t.amount===0?r.format(0):`about ${r.format(t.amount)}`}return s?.group==="Local"?"no price, self-hosted":"no price"},ne=e=>P(e,{hour:"2-digit",minute:"2-digit",timeZoneName:"shortOffset"}),l=e=>{v(e)&&S()},h=e=>s=>{e.setQueryData(I().queryKey,s)},ie=()=>{const e=K({...I(),meta:L}),s=e.isError&&v(e.error);return M.useEffect(()=>{s&&S()},[s]),{...e,signedOut:s}},ce=()=>{const e=g();return u({...A(),meta:d,onSuccess:h(e),onError:l})},ue=()=>{const e=g();return u({...B(),meta:d,onSuccess:h(e),onError:l})},de=()=>u({...$(),meta:d,onError:l});export{V as F,T as P,ue as a,te as b,se as c,F as d,i as e,de as f,z as g,Y as h,G as i,O as j,R as k,J as l,Z as m,D as n,ie as o,re as p,oe as q,ne as r,W as s,ee as t,ce as u,ae as v,X as w};
1
+ import{j as a,d as U,B as C,aS as k,az as x,aA as N,c8 as E,b3 as n,bU as P,s as y,c9 as w,a as K,c3 as I,r as M,bN as S,e as g,f as u,ca as A,cb as B,cc as $}from"./index-9QMShYZC.js";function V({title:e,message:s,reportHref:t,onRetry:r,retryLabel:o="Retry",retryRef:c}){return a.jsxs(U,{tone:"danger",variant:"soft",children:[a.jsx("p",{className:"font-medium",children:e}),a.jsx("p",{className:"mt-0.5 break-words text-fg-muted",children:s}),a.jsxs("p",{className:"flex flex-wrap items-center gap-x-4",children:[r&&a.jsx(C,{ref:c,variant:"secondary",className:"min-h-11",onClick:r,children:o}),a.jsx("a",{href:t,target:"_blank",rel:"noreferrer",className:"inline-flex min-h-11 items-center font-medium text-accent hover:underline",children:"Report an issue"})]})]})}const L=y(403),d={...y(400,403,404,409,422,429),...E},v=e=>k(e)===403,i=e=>e.state==="NotConfigured"?{presetId:void 0,sources:void 0}:e.state==="Unrunnable"?{presetId:e.presetId,sources:void 0}:{presetId:e.presetId,sources:e.sources},O=(e,s)=>{const t=i(e);return t.presetId===s?t.sources:void 0},f=(e,s)=>e.state==="Configured"&&e.sources[s]===n.Saved?e[s]:"",R=(e,s,t)=>e.state==="Configured"&&e.presetId===s&&e[t]!==""?e[t]:void 0,F=e=>({presetId:i(e).presetId,model:f(e,"model"),baseUrl:f(e,"baseUrl"),apiKey:""}),G=(e,s)=>i(s).presetId===e.presetId?F(s):{presetId:e.presetId,model:"",baseUrl:"",apiKey:""},Y=e=>e.state==="Unrunnable"?!0:e.state==="NotConfigured"?!1:Object.values(e.sources).includes(n.Saved),j={Hosted:"Hosted",Custom:"Your own endpoint",Local:"Self-hosted"},z=e=>{const s=[];for(const t of e){const r=s.find(o=>o.group===t.group);if(r){r.presets.push(t);continue}s.push({group:t.group,label:j[t.group],presets:[t]})}return s},D=e=>e.defaultBaseUrl===void 0,X=(e,s)=>s===n.Saved?`${e} Saved by you.`:s===n.Deployment?`${e} Provided by the deployment.`:e,T="Paste an API key",Z=e=>w(e)?.code==="ClassificationApiKeyRequired",p="Enter a URL that starts with http:// or https://",q=e=>{if(!URL.canParse(e))return!1;const{protocol:s}=new URL(e);return s==="http:"||s==="https:"},J=(e,s,t)=>{const r=e.baseUrl.trim(),o=e.apiKey.trim(),c=O(t,s.presetId);if(r!==""&&!q(r))return{ok:!1,field:"BaseUrl",message:p};if(r===""&&D(s)&&R(t,s.presetId,"baseUrl")===void 0)return{ok:!1,field:"BaseUrl",message:p};const b=c?.apiKey??n.Default;return s.needsKey&&o===""&&b===n.Default?{ok:!1,field:"ApiKey",message:T}:{ok:!0,body:{...i(t).presetId!==s.presetId?{classificationPresetId:s.presetId}:{},classificationModel:e.model.trim(),classificationBaseUrl:r,...s.needsKey&&o!==""?{classificationApiKey:o}:{}}}},W=(e,s,t)=>{const r=i(e).presetId;if(!(r===void 0||s===void 0)&&r!==s)return t.find(o=>o.presetId===r)},ee=e=>{const s=e.status===void 0?e.kind:`${e.status}`;return`Test failed after ${e.latencyMs} ms: ${s}`},se=(e,s)=>x(N({title:`Mail classification: ${e}`,errorMessage:`${e}. ${s}`})),te=e=>{const s=e.needsKey?"Needs an API key.":"No key needed.";if(e.price.state!=="Priced")return s;const t=new Intl.NumberFormat("en",{style:"currency",currency:e.price.currency,maximumFractionDigits:4}).format(e.price.perMillionInputTokens);return`${s} ${t} per million input tokens.`},m="Enter a whole number of 1 or more.",H=2147483647,re=e=>{const s=e.trim();if(!/^\d+$/.test(s))return{ok:!1,message:m};const t=Number(s);return t<1||t>H?{ok:!1,message:m}:{ok:!0,limit:t}},oe=e=>e.calls>=e.dailyLimit,ae=(e,s)=>{const{cost:t}=e;if(t.state==="Priced"){const r=new Intl.NumberFormat("en",{style:"currency",currency:t.currency,maximumFractionDigits:2});return t.amount>0&&t.amount<.01?`under ${r.format(.01)}`:t.amount===0?r.format(0):`about ${r.format(t.amount)}`}return s?.group==="Local"?"no price, self-hosted":"no price"},ne=e=>P(e,{hour:"2-digit",minute:"2-digit",timeZoneName:"shortOffset"}),l=e=>{v(e)&&S()},h=e=>s=>{e.setQueryData(I().queryKey,s)},ie=()=>{const e=K({...I(),meta:L}),s=e.isError&&v(e.error);return M.useEffect(()=>{s&&S()},[s]),{...e,signedOut:s}},ce=()=>{const e=g();return u({...A(),meta:d,onSuccess:h(e),onError:l})},ue=()=>{const e=g();return u({...B(),meta:d,onSuccess:h(e),onError:l})},de=()=>u({...$(),meta:d,onError:l});export{V as F,T as P,ue as a,te as b,se as c,F as d,i as e,de as f,z as g,Y as h,G as i,O as j,R as k,J as l,Z as m,D as n,ie as o,re as p,oe as q,ne as r,W as s,ee as t,ce as u,ae as v,X as w};
@@ -0,0 +1 @@
1
+ import{r as u,c7 as i,d6 as c,a as g}from"./index-9QMShYZC.js";import{u as T}from"./useQueries-B2w-f15M.js";import{u as q}from"./useInfiniteQuery-CneHLmnO.js";const s=(e,t)=>({...t,...e,order:"desc"}),P=(e,t={})=>c({query:s(e,t)});function M(e,t={}){const{data:r,isLoading:n,isError:o,error:y,refetch:f,fetchNextPage:m,hasNextPage:p,isFetchingNextPage:h}=q({queryKey:P(e,t),queryFn:async({pageParam:a})=>{const{data:l}=await i({query:{...s(e,t),continuationToken:a},throwOnError:!0});return l},initialPageParam:void 0,getNextPageParam:a=>a.continuationToken,staleTime:6e4});return{threads:u.useMemo(()=>(r?.pages??[]).flatMap(a=>a.items??[]),[r]),isLoading:n,isError:o,error:y,refetch:f,fetchNextPage:m,hasNextPage:p,isFetchingNextPage:h}}function E(e,t={}){const{data:r}=g(d(e,t));return r?.count}function K(e){const t=T({queries:e.map(r=>d({labelId:r})),combine:x});return u.useMemo(()=>new Map(e.flatMap((r,n)=>{const o=t[n];return o===void 0?[]:[[r,o]]})),[e,t])}const x=e=>e.map(t=>t.data?.count);function d(e,t={}){const r={...s(e,t),unread:!0,count:!0,results:!1};return{queryKey:c({query:r}),queryFn:async()=>{const{data:n}=await i({query:r,throwOnError:!0});return n},staleTime:6e4}}export{M as a,E as b,K as u};
@@ -1 +1 @@
1
- import{r as o}from"./index-yeSesYv-.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-9QMShYZC.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,eU as x,X as E,p as M,eV as z,eW as L,ar as w,B as O,r as p,f as v,eX as T,a as D,eY as R,eZ as $,e_ as _,e$ as J,e as S,f0 as U,f1 as q,f2 as B,bd as K}from"./index-yeSesYv-.js";import{u as Q,S as H}from"./suggest-list-Do7i1-gb.js";import{S as W}from"./select-B9t8348S.js";import{P as X}from"./plus-D9A6i0pi.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(X,{className:"size-3","aria-hidden":"true"}),e]})}function be({draft:e,mode:t,fields:r=L,suggestions:s=[],onChangeField:o,onChangeValue:a,onSubmit:n,onCancel:c}){const d=z(e.field),l=Q({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(H,{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",Y=e=>({filterId:e,matchOperator:"And",literalClauses:[],actionLabelId:h,actionMailboxId:h}),k=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}),G=new Set(["Complete","Failed"]),A=e=>e!==void 0&&G.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 I=g.state.data?.state;return A(I)?!1:ee(g.state.dataUpdateCount)}}),n=p.useCallback(g=>{e&&o({path:{accountId:e},body:k(g)})},[e,o]),c=p.useCallback(g=>{e&&o({path:{accountId:e},body:Y(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:k({...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=>q({path:{accountId:e}}),Ae=e=>{const t=D({...J({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({...U(),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({...B(),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({...K(),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,eU as x,X as E,p as M,eV as z,eW as L,ar as w,B as O,r as p,f as v,eX as T,a as D,eY as R,eZ as $,e_ as _,e$ as J,e as S,f0 as U,f1 as q,f2 as B,bd as K}from"./index-9QMShYZC.js";import{u as Q,S as H}from"./suggest-list-BU1CAWaS.js";import{S as W}from"./select-Bar5gCGO.js";import{P as X}from"./plus-ivySO7aD.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(X,{className:"size-3","aria-hidden":"true"}),e]})}function be({draft:e,mode:t,fields:r=L,suggestions:s=[],onChangeField:o,onChangeValue:a,onSubmit:n,onCancel:c}){const d=z(e.field),l=Q({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(H,{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",Y=e=>({filterId:e,matchOperator:"And",literalClauses:[],actionLabelId:h,actionMailboxId:h}),k=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}),G=new Set(["Complete","Failed"]),A=e=>e!==void 0&&G.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 I=g.state.data?.state;return A(I)?!1:ee(g.state.dataUpdateCount)}}),n=p.useCallback(g=>{e&&o({path:{accountId:e},body:k(g)})},[e,o]),c=p.useCallback(g=>{e&&o({path:{accountId:e},body:Y(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:k({...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=>q({path:{accountId:e}}),Ae=e=>{const t=D({...J({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({...U(),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({...B(),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({...K(),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};
@@ -0,0 +1 @@
1
+ import{cY as g,dc as d,dd as v,de as x}from"./index-9QMShYZC.js";var p=class extends g{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:s}=e,i=super.createResult(e,t),{isFetching:c,isRefetching:f,isError:a,isRefetchError:P}=i,r=s.fetchMeta?.fetchMore?.direction,h=a&&r==="forward",n=c&&r==="forward",o=a&&r==="backward",u=c&&r==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:v(t,s.data),hasPreviousPage:d(t,s.data),isFetchNextPageError:h,isFetchingNextPage:n,isFetchPreviousPageError:o,isFetchingPreviousPage:u,isRefetchError:P&&!h&&!o,isRefetching:f&&!n&&!u}}};function N(e,t){return x(e,p)}export{N as u};
@@ -1 +1 @@
1
- import{a,c as n,r}from"./index-yeSesYv-.js";const c=new Set,u=()=>{const{data:s}=a({...n(),staleTime:1/0});return r.useMemo(()=>{const e=(s?.accounts??[]).flatMap(o=>o.folderAppointments.flatMap(t=>t.role==="Junk"&&t.mailboxId?[t.mailboxId]:[]));return e.length===0?c:new Set(e)},[s?.accounts])};export{u};
1
+ import{a,c as n,r}from"./index-9QMShYZC.js";const c=new Set,u=()=>{const{data:s}=a({...n(),staleTime:1/0});return r.useMemo(()=>{const e=(s?.accounts??[]).flatMap(o=>o.folderAppointments.flatMap(t=>t.role==="Junk"&&t.mailboxId?[t.mailboxId]:[]));return e.length===0?c:new Set(e)},[s?.accounts])};export{u};
@@ -1 +1 @@
1
- import{a as d,d6 as g,e as i,f as o,d7 as y,r as u,d8 as p,d9 as L,da as c}from"./index-yeSesYv-.js";const f={Default:"bg-fg-subtle",Red:"bg-red-500",Orange:"bg-orange-500",Yellow:"bg-yellow-500",Green:"bg-green-500",Teal:"bg-teal-500",Blue:"bg-blue-500",Purple:"bg-purple-500",Gray:"bg-gray-500"},O=["Default","Red","Orange","Yellow","Green","Teal","Blue","Purple","Gray"],m=e=>Object.hasOwn(f,e),l=e=>g({path:{accountId:e}}),h=async e=>{const t=[];let a;do{const{data:s}=await c({path:{accountId:e},query:{continuationToken:a},throwOnError:!0});t.push(...s.items),a=s.continuationToken}while(a);return t},P=[],q=e=>{const t=d({queryKey:l(e??""),queryFn:()=>h(e??""),enabled:!!e});return{labels:t.data??P,isSuccess:t.isSuccess,isPending:t.isPending,isError:t.isError,error:t.error,refetch:t.refetch}},w=e=>{const t=i(),a=o({...y(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:l(e)})}}),{mutateAsync:s}=a;return{createLabel:u.useCallback((r,n="Default")=>e?s({path:{accountId:e},body:{name:r,color:n}}):Promise.reject(new Error("No account")),[e,s]),isPending:a.isPending,isError:a.isError,error:a.error,reset:a.reset}},D=e=>{const t=i(),a=o({...p(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:l(e)})}}),{mutate:s}=a;return{updateLabel:u.useCallback((r,n)=>{e&&s({path:{accountId:e,labelId:r},body:n})},[e,s]),isPending:a.isPending,updatingLabelId:a.isPending?a.variables?.path.labelId:void 0}},E=e=>{const t=i(),a=o({...L(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:l(e)})}}),{mutate:s}=a;return{deleteLabel:u.useCallback(r=>{e&&s({path:{accountId:e,labelId:r}})},[e,s]),isPending:a.isPending,deletingLabelId:a.isPending?a.variables?.path.labelId:void 0}};export{w as a,O as b,D as c,E as d,m as i,f as l,q as u};
1
+ import{a as d,d7 as g,e as i,f as o,d8 as y,r as u,d9 as p,da as L,db as c}from"./index-9QMShYZC.js";const f={Default:"bg-fg-subtle",Red:"bg-red-500",Orange:"bg-orange-500",Yellow:"bg-yellow-500",Green:"bg-green-500",Teal:"bg-teal-500",Blue:"bg-blue-500",Purple:"bg-purple-500",Gray:"bg-gray-500"},O=["Default","Red","Orange","Yellow","Green","Teal","Blue","Purple","Gray"],m=e=>Object.hasOwn(f,e),l=e=>g({path:{accountId:e}}),h=async e=>{const t=[];let a;do{const{data:s}=await c({path:{accountId:e},query:{continuationToken:a},throwOnError:!0});t.push(...s.items),a=s.continuationToken}while(a);return t},P=[],q=e=>{const t=d({queryKey:l(e??""),queryFn:()=>h(e??""),enabled:!!e});return{labels:t.data??P,isSuccess:t.isSuccess,isPending:t.isPending,isError:t.isError,error:t.error,refetch:t.refetch}},w=e=>{const t=i(),a=o({...y(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:l(e)})}}),{mutateAsync:s}=a;return{createLabel:u.useCallback((r,n="Default")=>e?s({path:{accountId:e},body:{name:r,color:n}}):Promise.reject(new Error("No account")),[e,s]),isPending:a.isPending,isError:a.isError,error:a.error,reset:a.reset}},D=e=>{const t=i(),a=o({...p(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:l(e)})}}),{mutate:s}=a;return{updateLabel:u.useCallback((r,n)=>{e&&s({path:{accountId:e,labelId:r},body:n})},[e,s]),isPending:a.isPending,updatingLabelId:a.isPending?a.variables?.path.labelId:void 0}},E=e=>{const t=i(),a=o({...L(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:l(e)})}}),{mutate:s}=a;return{deleteLabel:u.useCallback(r=>{e&&s({path:{accountId:e,labelId:r}})},[e,s]),isPending:a.isPending,deletingLabelId:a.isPending?a.variables?.path.labelId:void 0}};export{w as a,O as b,D as c,E as d,m as i,f as l,q as u};
@@ -1 +1 @@
1
- import{a as s,D as e}from"./useMediaQuery-Bf7zukl9.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-BL50IiYB.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-yeSesYv-.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-9QMShYZC.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};