@remit/web-client-dist 0.0.642 → 0.0.644

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 (161) hide show
  1. package/assets/BriefPane-CWpjvftR.js +1 -0
  2. package/assets/{CalendarComposePane-CaFfehJ3.js → CalendarComposePane-DJNhu2LK.js} +1 -1
  3. package/assets/{CalendarComposeSeed-Qwwu-xz8.js → CalendarComposeSeed-SL4UWmtL.js} +1 -1
  4. package/assets/{CalendarShell-DdBSP0nU.js → CalendarShell-DAe5WXuU.js} +1 -1
  5. package/assets/{EmptyState-DffMrivH.js → EmptyState-5AzHvbUg.js} +1 -1
  6. package/assets/{ErrorState-zb46wwqB.js → ErrorState-C9wNWNx-.js} +1 -1
  7. package/assets/FlaggedPane-CzACUDwI.js +1 -0
  8. package/assets/{FullCompose-CtKaGlct.js → FullCompose-EZk91vKc.js} +1 -1
  9. package/assets/MailListHeader-KM5hxzzQ.js +7 -0
  10. package/assets/{MailNav-CDMm535x.js → MailNav-BvsTwsus.js} +1 -1
  11. package/assets/{MailShell-C6XAYw9R.js → MailShell-CO4UHszY.js} +1 -1
  12. package/assets/{MailViewChrome-BcPAwjzq.js → MailViewChrome-D0DIIe1s.js} +1 -1
  13. package/assets/{MailboxPane-Bo_304LU.js → MailboxPane-CSXmclwC.js} +1 -1
  14. package/assets/{NavMenuButton-C7p7FLnh.js → NavMenuButton-DipQuqqU.js} +1 -1
  15. package/assets/{OnboardingWizard-D15SDpIN.js → OnboardingWizard-DLthp-gp.js} +1 -1
  16. package/assets/{OpenCalendarEvent-CVHpXp5y.js → OpenCalendarEvent-DdZ8T5JX.js} +2 -2
  17. package/assets/{OutboxPane-k7EI73dP.js → OutboxPane-BQ2C8Exq.js} +1 -1
  18. package/assets/_calendarObjectId-Bmm-aQm4.js +1 -0
  19. package/assets/_mailboxId-BSG_TwdK.js +1 -0
  20. package/assets/_messageId-BdBHeA_W.js +1 -0
  21. package/assets/_messageId-DPyP0hLB.js +1 -0
  22. package/assets/_messageId-zXtGiOsw.js +1 -0
  23. package/assets/_outboxMessageId-DI-yjQl-.js +1 -0
  24. package/assets/_recurrenceId-xeHK4wQN.js +1 -0
  25. package/assets/_threadId-BWNiD5_L.js +1 -0
  26. package/assets/_threadId-BYme1h9o.js +1 -0
  27. package/assets/_threadId-BkVElb5l.js +1 -0
  28. package/assets/{_view._date-BjTcS5dY.js → _view._date-DhatDbEl.js} +1 -1
  29. package/assets/{accounts-BKh6zOiZ.js → accounts-DD5lbrRg.js} +1 -1
  30. package/assets/{advanced-AosgdV6N.js → advanced-Di1sbe8-.js} +1 -1
  31. package/assets/{appearance-lDYvlXFT.js → appearance-CuPQNqbK.js} +1 -1
  32. package/assets/{attendee-row-CNSd4msf.js → attendee-row-COD-JhkD.js} +1 -1
  33. package/assets/{avatar-BU2Acypp.js → avatar-BG16DP0I.js} +1 -1
  34. package/assets/{bell-off-BDdZq1id.js → bell-off-BJ8oYylk.js} +1 -1
  35. package/assets/{bottom-sheet-OT_uLnD0.js → bottom-sheet-CXKnmLHB.js} +1 -1
  36. package/assets/brief-DBfWEKXi.js +1 -0
  37. package/assets/{brief-B3LHy3XK.js → brief-QIMUKa1x.js} +1 -1
  38. package/assets/{browser-ponyfill-BoSoM_yw.js → browser-ponyfill-yqX8DQOe.js} +2 -2
  39. package/assets/{bug-Byoam9SI.js → bug-my1LBhjO.js} +1 -1
  40. package/assets/{calendar-BNN6Blwg.js → calendar-BKm9jIHX.js} +1 -1
  41. package/assets/{calendar-clash-strip-CuPoAcuA.js → calendar-clash-strip-BFeaJEFd.js} +1 -1
  42. package/assets/{calendar-format-t5pknBPH.js → calendar-format-Df04vYeX.js} +1 -1
  43. package/assets/{calendar-report-De_YSbMS.js → calendar-report-cFSv6gSl.js} +1 -1
  44. package/assets/calendar-suggestion-BOcnceiU.js +1 -0
  45. package/assets/{calendars-EiEYrDmO.js → calendars-C2NvDUee.js} +1 -1
  46. package/assets/{card-BU0ZWUHk.js → card-Cvm6QXrr.js} +1 -1
  47. package/assets/{checkbox-nuTXvB_z.js → checkbox-CnlRLXiS.js} +1 -1
  48. package/assets/chevron-left-B_-IAj1P.js +1 -0
  49. package/assets/{circle-check-BzcaYx-L.js → circle-check-CmDRPJ4x.js} +1 -1
  50. package/assets/{circle-check-big-CdWGb9Cq.js → circle-check-big-ZWmAdG5O.js} +1 -1
  51. package/assets/{circle-help-CVsjKp3b.js → circle-help-xoO8qyO7.js} +1 -1
  52. package/assets/{clock-qn7JbMhU.js → clock-Bkjyx82e.js} +1 -1
  53. package/assets/compose._-_outboxMessageId_-BRWb_gzB.js +1 -0
  54. package/assets/compose._-_outboxMessageId_-D-8v_F-x.js +1 -0
  55. package/assets/compose._-_outboxMessageId_-D54zCsk7.js +1 -0
  56. package/assets/compose._-_outboxMessageId_-DlyKxAyJ.js +1 -0
  57. package/assets/{config-import-DhjQZV7D.js → config-import-D_1i4Wai.js} +1 -1
  58. package/assets/{confirm-dialog-C4B2Czhl.js → confirm-dialog-D8E0auet.js} +1 -1
  59. package/assets/{copy-CJCBL3_e.js → copy-Cz51csqc.js} +1 -1
  60. package/assets/{credential-steps-BMJ8NHk-.js → credential-steps-Cm_vhM0c.js} +1 -1
  61. package/assets/{download-DG45yTbq.js → download-2vcTam8D.js} +1 -1
  62. package/assets/{file-json-Dgau07u1.js → file-json-Wb3Oc2-o.js} +1 -1
  63. package/assets/{filters-BAGXXGHm.js → filters-C2qWze-2.js} +1 -1
  64. package/assets/flagged-BIby7mOe.js +1 -0
  65. package/assets/{flagged-H7_oalgM.js → flagged-DSaiUTNf.js} +1 -1
  66. package/assets/{folders-BpqgnDKx.js → folders-B-31lHew.js} +1 -1
  67. package/assets/{help-copy-Cv-E-JTH.js → help-copy-yEiBqFt2.js} +1 -1
  68. package/assets/{import-Br9u2yf5.js → import-I5hFVfa3.js} +1 -1
  69. package/assets/index--G6_bbnZ.js +1 -0
  70. package/assets/{index-DQOjICLF.js → index-BZT8HZ--.js} +1 -1
  71. package/assets/index-BdBHeA_W.js +1 -0
  72. package/assets/index-BswNQxjJ.js +1 -0
  73. package/assets/{index-DDaQbjmr.js → index-CVyiXes6.js} +11 -11
  74. package/assets/index-CeBLFOSc.js +1 -0
  75. package/assets/index-ChJF8JuK.js +1 -0
  76. package/assets/index-Ct3c_-_h.js +1 -0
  77. package/assets/index-Cu0O7J1a.js +1 -0
  78. package/assets/index-DVEw13Tk.js +1 -0
  79. package/assets/{index-TtetXNmc.js → index-DYY0nrsl.js} +4 -4
  80. package/assets/index-zXtGiOsw.js +1 -0
  81. package/assets/{kbd-nBPX_mdB.js → kbd-BAzd-ZzK.js} +1 -1
  82. package/assets/{labels-DZRbAx-h.js → labels-D5anCXRT.js} +1 -1
  83. package/assets/{mail-xh-X6l34.js → mail-3L2_JePI.js} +1 -1
  84. package/assets/{mail-CWorRVye.js → mail-7SgAUbqy.js} +1 -1
  85. package/assets/{map-pin-DXPKFmKy.js → map-pin-C_G0KnPH.js} +1 -1
  86. package/assets/{menu-DziguOgy.js → menu-Diz2jlXK.js} +1 -1
  87. package/assets/minus-D5h1w2Lk.js +1 -0
  88. package/assets/{new-BErOQscw.js → new-CcPLKlc0.js} +1 -1
  89. package/assets/{onboarding-completion-Bvjs_wV7.js → onboarding-completion-BgX6tyKE.js} +1 -1
  90. package/assets/onboarding-kI2wRexG.js +1 -0
  91. package/assets/outbox-C60Ip38a.js +1 -0
  92. package/assets/{pane-header-BKR2Qgp4.js → pane-header-CaA1aTlU.js} +1 -1
  93. package/assets/{pencil-C_GgIxQ0.js → pencil-TKs_c6Iw.js} +1 -1
  94. package/assets/{popover-menu-eOwDgIAD.js → popover-menu-Bmzk7h6e.js} +1 -1
  95. package/assets/{refresh-cw-mlDi8LTp.js → refresh-cw-og-Ybvo3.js} +1 -1
  96. package/assets/{rich-text-BwY3htQf.js → rich-text-CHZBDrnR.js} +1 -1
  97. package/assets/{rich-text-spellcheck-worker-provider-CxrExxo5.js → rich-text-spellcheck-worker-provider-BllEMU79.js} +1 -1
  98. package/assets/{rotate-ccw-B_znez6Z.js → rotate-ccw-FAgCjZMZ.js} +1 -1
  99. package/assets/{roving-focus-D45YIEXp.js → roving-focus-DYnDzdRR.js} +1 -1
  100. package/assets/{row-actions-Bz2BO_Of.js → row-actions-DFIk5ZFA.js} +1 -1
  101. package/assets/{search-mirror-IklPpsgd.js → search-mirror-By7sgEWK.js} +1 -1
  102. package/assets/{search-token-index-DfEguIzE.js → search-token-index-CDtHdqiP.js} +1 -1
  103. package/assets/{sections-BE-YkTuC.js → sections-D-n9QfX4.js} +1 -1
  104. package/assets/{senders-Byg0IyG1.js → senders-D4sO52ZM.js} +1 -1
  105. package/assets/settings-BGp6tn2L.js +1 -0
  106. package/assets/{settings-screen-Qy0Wa0pr.js → settings-screen-DvNcGJK6.js} +1 -1
  107. package/assets/{shield-check-CCP0KBaU.js → shield-check-8L17Kh_I.js} +1 -1
  108. package/assets/{suggested-vips-Cy_wCFhG.js → suggested-vips-Q_s_mJiL.js} +1 -1
  109. package/assets/{suggestion._suggestionId-BaL7q4AC.js → suggestion._suggestionId-BAj90-2v.js} +1 -1
  110. package/assets/{undo-2-DBjV60-m.js → undo-2-BSHTchh1.js} +1 -1
  111. package/assets/{useCalendarData-TdBIWROH.js → useCalendarData-emMg6If8.js} +1 -1
  112. package/assets/{useCalendarFreeBusy-BCLJxOfD.js → useCalendarFreeBusy-oamX9h5O.js} +1 -1
  113. package/assets/{useCalendarWrites-CcZJoofA.js → useCalendarWrites-B6o3xQNN.js} +1 -1
  114. package/assets/{useCalendars-NXobBPn1.js → useCalendars-CzwJUnpW.js} +1 -1
  115. package/assets/{useDebouncedValue-Dy_g2v71.js → useDebouncedValue-3uXEWBzO.js} +1 -1
  116. package/assets/{useFilters-Dsrj-I6z.js → useFilters-D5DypOXB.js} +1 -1
  117. package/assets/{useLabels--WOniDuk.js → useLabels-CEOAQRXe.js} +1 -1
  118. package/assets/{useLayoutTier-BnLysTvl.js → useLayoutTier-BLBwlToe.js} +1 -1
  119. package/assets/{useMessageBodyContent-Azq1Bngf.js → useMessageBodyContent-Bq-24837.js} +1 -1
  120. package/assets/{useQueries-D1STUKB_.js → useQueries-CqQkOWRS.js} +1 -1
  121. package/assets/{useRefreshControl-CQDCO_Sz.js → useRefreshControl-URETybK8.js} +1 -1
  122. package/assets/{useResultFolderIndex-TIwJLY0y.js → useResultFolderIndex-DgIMhZlz.js} +1 -1
  123. package/assets/{useSearchTokenContext-DjY64Paa.js → useSearchTokenContext-V_0MB9r5.js} +1 -1
  124. package/assets/{useSemanticSearch-NH8DKMle.js → useSemanticSearch-CzayQYky.js} +1 -1
  125. package/assets/{useSignature-DbI73u9N.js → useSignature-BraM8Nn7.js} +1 -1
  126. package/index.html +1 -1
  127. package/package.json +1 -1
  128. package/assets/BriefPane-DTu07n2X.js +0 -1
  129. package/assets/FlaggedPane-StYE07Pk.js +0 -1
  130. package/assets/MailListHeader-DMMl8ZLg.js +0 -7
  131. package/assets/_calendarObjectId-BmWKOwZU.js +0 -1
  132. package/assets/_mailboxId-C5oOoR9Y.js +0 -1
  133. package/assets/_messageId-BQu6o3gE.js +0 -1
  134. package/assets/_messageId-CUK6OwnE.js +0 -1
  135. package/assets/_messageId-DiKCBlFd.js +0 -1
  136. package/assets/_outboxMessageId-BLqK1FUW.js +0 -1
  137. package/assets/_recurrenceId-CTMy5M6x.js +0 -1
  138. package/assets/_threadId-BQ2ENDxN.js +0 -1
  139. package/assets/_threadId-B_-kfUCd.js +0 -1
  140. package/assets/_threadId-CRbs6xQJ.js +0 -1
  141. package/assets/brief-DfHqHUx0.js +0 -1
  142. package/assets/calendar-suggestion-BrsagLDp.js +0 -1
  143. package/assets/chevron-left-BmceVyuQ.js +0 -1
  144. package/assets/compose._-_outboxMessageId_-CTOa6VlX.js +0 -1
  145. package/assets/compose._-_outboxMessageId_-DX18bVb7.js +0 -1
  146. package/assets/compose._-_outboxMessageId_-Drm1AU0Y.js +0 -1
  147. package/assets/compose._-_outboxMessageId_-SBimViM1.js +0 -1
  148. package/assets/flagged-BG7vNsSo.js +0 -1
  149. package/assets/index-BAIv4ARz.js +0 -1
  150. package/assets/index-BD8lc3NR.js +0 -1
  151. package/assets/index-BQu6o3gE.js +0 -1
  152. package/assets/index-BsPhXbkV.js +0 -1
  153. package/assets/index-COeV6qmo.js +0 -1
  154. package/assets/index-CXwf_sz5.js +0 -1
  155. package/assets/index-D-2HKiNE.js +0 -1
  156. package/assets/index-DiKCBlFd.js +0 -1
  157. package/assets/index-DwXDHT3g.js +0 -1
  158. package/assets/minus-RD6yC1uS.js +0 -1
  159. package/assets/onboarding-DJEkQ9iZ.js +0 -1
  160. package/assets/outbox-CobBj7od.js +0 -1
  161. package/assets/settings-EmCICmfl.js +0 -1
@@ -1,4 +1,4 @@
1
- import{e as Vr,r as z,j as F,f as uf,e_ as vu,t as ha,ao as go,e$ as jp,B as Rp,bY as Su,c0 as Pp,c1 as Lp,G as Ip,f0 as Bp,a0 as Kp,L as Wp,f1 as qp}from"./index-DDaQbjmr.js";import{h as _l,f as wu,j as Eu,k as Up}from"./index-TtetXNmc.js";import{r as Hp,u as Jp}from"./roving-focus-D45YIEXp.js";import{C as Vp}from"./confirm-dialog-C4B2Czhl.js";import{B as Yp}from"./bottom-sheet-OT_uLnD0.js";import{P as Xp,a as Gp,b as Ps}from"./popover-menu-eOwDgIAD.js";import{U as Qp}from"./undo-2-DBjV60-m.js";import{o as rv}from"./rich-text-spellcheck-provider-J8m9wz6A.js";import"./useMessageBodyContent-Azq1Bngf.js";import"./useSignature-DbI73u9N.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-Dy_g2v71.js";import"./sections-BE-YkTuC.js";const Zp=Vr("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);const em=Vr("BookPlus",[["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);const tm=Vr("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);const nm=Vr("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);const rm=Vr("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);const om=Vr("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]),IC={html:"",text:"",formatting:[]},im={account:"the account default",detected:"detected from what you wrote",manual:"chosen for this message"},sm=({language:n,languages:e,source:t,onSelect:r,helpText:o})=>{const[i,s]=z.useState(!1),a=z.useRef(null),l=z.useRef(null),u=z.useRef(null),c=z.useId(),d=z.useCallback(g=>{s(!1),g&&l.current?.focus()},[]);z.useEffect(()=>{if(!i)return;const g=m=>{a.current?.contains(m.target)||s(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[i]),z.useEffect(()=>{if(!i)return;const g=u.current?.querySelector('[aria-checked="true"]'),m=u.current?.querySelector('[role="menuitemradio"]');(g??m)?.focus()},[i]);const f=g=>{if(g.key==="Escape"){g.preventDefault(),d(!0);return}const m=[...u.current?.querySelectorAll('[role="menuitemradio"]')??[]],p=m.indexOf(document.activeElement),y=Hp(g.key,p,m.length);y!==null&&(g.preventDefault(),m[y]?.focus())},h=g=>{r(g),d(!0)};return F.jsxs("div",{ref:a,className:"relative",children:[F.jsx(uf,{ref:l,variant:"ghost",size:"md","aria-label":`Message language: ${go(n)}, ${im[t]}`,"aria-haspopup":"menu","aria-expanded":i,"aria-controls":i?c:void 0,onClick:()=>s(g=>!g),"data-testid":"compose-language-chip","data-language":n,"data-language-source":t,className:ha("min-h-11 min-w-11 shrink-0 px-2 font-medium",n!==e[0]&&"bg-accent-2-soft text-accent-2"),children:vu(n)}),i&&F.jsxs("div",{ref:u,id:c,role:"menu","aria-label":"Message language",onKeyDown:f,"data-testid":"compose-language-menu",className:"absolute right-0 top-full z-50 mt-1 flex max-h-[60dvh] min-w-56 flex-col overflow-y-auto overscroll-contain rounded-md border border-line bg-surface py-1 shadow-lg",children:[e.map(g=>F.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":g===n,lang:g,onClick:()=>h(g),className:ha("flex min-h-11 items-center justify-between gap-3 px-4 py-2.5 text-left text-sm text-fg transition-colors hover:bg-surface-sunken",g===n&&"bg-accent-2-soft"),children:[go(g),F.jsx("span",{className:"shrink-0 text-xs text-fg-subtle",children:vu(g)})]},g)),F.jsx("p",{"data-testid":"compose-language-help",className:"border-t border-line px-4 pb-1 pt-2 text-xs text-fg-muted",children:o??jp(navigator.userAgent)})]})]})},am=({mode:n,onToggle:e})=>F.jsx(uf,{variant:"ghost",size:"md","aria-pressed":n==="plain",title:"Plain text",onClick:e,"data-testid":"compose-mode-toggle",className:ha("min-h-11 shrink-0",n==="plain"&&"bg-accent-2-soft text-accent-2"),children:"Plain text"}),lm=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),cf=n=>{const e=n.activeElement;return e?.shadowRoot?cf(e.shadowRoot)??e:e},um=n=>{const e=n.tagName.toUpperCase();if(e==="IFRAME"||e==="FRAME"||e==="TEXTAREA"||e==="SELECT")return!0;if(e==="INPUT"){const r=(n.getAttribute("type")??"text").toLowerCase();return!lm.has(r)}const t=n.getAttribute("contenteditable");return t!==null&&t.toLowerCase()!=="false"?!0:n.isContentEditable===!0},df=n=>{const e=n?.ownerDocument??globalThis.document;if(!e)return!1;const t=cf(e);return!t||t===n||n?.contains(t)?!1:um(t)};function $(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function ff(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);t.search=r.toString(),console.warn(`Minified Lexical warning #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const nt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,cm=nt&&"documentMode"in document?document.documentMode:null,Ft=nt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Pt=nt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),zr=!(!nt||!("InputEvent"in window)||cm)&&"getTargetRanges"in new window.InputEvent("input"),Tn=nt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,hf=nt&&/Android/.test(navigator.userAgent),Po=nt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!hf,gf=nt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Di=nt&&hf&&gf,Lo=nt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Ft&&!gf,dm=0,fm=1,hm=2,ga=1,pa=2,ma=4,ya=8,gm=16,Ls=32,Is=64,bl=128,pm=1,mm=2,ym=3,_m=4,bm=5,km=6,Co=Po||Tn||Lo?" ":"​",Bn=`
1
+ import{e as Vr,r as z,j as F,f as uf,f0 as vu,t as ha,ao as go,f1 as jp,B as Rp,bY as Su,c0 as Pp,c1 as Lp,G as Ip,f2 as Bp,a0 as Kp,L as Wp,f3 as qp}from"./index-CVyiXes6.js";import{h as _l,f as wu,j as Eu,k as Up}from"./index-DYY0nrsl.js";import{r as Hp,u as Jp}from"./roving-focus-DYnDzdRR.js";import{C as Vp}from"./confirm-dialog-D8E0auet.js";import{B as Yp}from"./bottom-sheet-CXKnmLHB.js";import{P as Xp,a as Gp,b as Ps}from"./popover-menu-Bmzk7h6e.js";import{U as Qp}from"./undo-2-BSHTchh1.js";import{o as rv}from"./rich-text-spellcheck-provider-J8m9wz6A.js";import"./useMessageBodyContent-Bq-24837.js";import"./useSignature-BraM8Nn7.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-3uXEWBzO.js";import"./sections-D-n9QfX4.js";const Zp=Vr("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);const em=Vr("BookPlus",[["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);const tm=Vr("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);const nm=Vr("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);const rm=Vr("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);const om=Vr("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]),IC={html:"",text:"",formatting:[]},im={account:"the account default",detected:"detected from what you wrote",manual:"chosen for this message"},sm=({language:n,languages:e,source:t,onSelect:r,helpText:o})=>{const[i,s]=z.useState(!1),a=z.useRef(null),l=z.useRef(null),u=z.useRef(null),c=z.useId(),d=z.useCallback(g=>{s(!1),g&&l.current?.focus()},[]);z.useEffect(()=>{if(!i)return;const g=m=>{a.current?.contains(m.target)||s(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[i]),z.useEffect(()=>{if(!i)return;const g=u.current?.querySelector('[aria-checked="true"]'),m=u.current?.querySelector('[role="menuitemradio"]');(g??m)?.focus()},[i]);const f=g=>{if(g.key==="Escape"){g.preventDefault(),d(!0);return}const m=[...u.current?.querySelectorAll('[role="menuitemradio"]')??[]],p=m.indexOf(document.activeElement),y=Hp(g.key,p,m.length);y!==null&&(g.preventDefault(),m[y]?.focus())},h=g=>{r(g),d(!0)};return F.jsxs("div",{ref:a,className:"relative",children:[F.jsx(uf,{ref:l,variant:"ghost",size:"md","aria-label":`Message language: ${go(n)}, ${im[t]}`,"aria-haspopup":"menu","aria-expanded":i,"aria-controls":i?c:void 0,onClick:()=>s(g=>!g),"data-testid":"compose-language-chip","data-language":n,"data-language-source":t,className:ha("min-h-11 min-w-11 shrink-0 px-2 font-medium",n!==e[0]&&"bg-accent-2-soft text-accent-2"),children:vu(n)}),i&&F.jsxs("div",{ref:u,id:c,role:"menu","aria-label":"Message language",onKeyDown:f,"data-testid":"compose-language-menu",className:"absolute right-0 top-full z-50 mt-1 flex max-h-[60dvh] min-w-56 flex-col overflow-y-auto overscroll-contain rounded-md border border-line bg-surface py-1 shadow-lg",children:[e.map(g=>F.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":g===n,lang:g,onClick:()=>h(g),className:ha("flex min-h-11 items-center justify-between gap-3 px-4 py-2.5 text-left text-sm text-fg transition-colors hover:bg-surface-sunken",g===n&&"bg-accent-2-soft"),children:[go(g),F.jsx("span",{className:"shrink-0 text-xs text-fg-subtle",children:vu(g)})]},g)),F.jsx("p",{"data-testid":"compose-language-help",className:"border-t border-line px-4 pb-1 pt-2 text-xs text-fg-muted",children:o??jp(navigator.userAgent)})]})]})},am=({mode:n,onToggle:e})=>F.jsx(uf,{variant:"ghost",size:"md","aria-pressed":n==="plain",title:"Plain text",onClick:e,"data-testid":"compose-mode-toggle",className:ha("min-h-11 shrink-0",n==="plain"&&"bg-accent-2-soft text-accent-2"),children:"Plain text"}),lm=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),cf=n=>{const e=n.activeElement;return e?.shadowRoot?cf(e.shadowRoot)??e:e},um=n=>{const e=n.tagName.toUpperCase();if(e==="IFRAME"||e==="FRAME"||e==="TEXTAREA"||e==="SELECT")return!0;if(e==="INPUT"){const r=(n.getAttribute("type")??"text").toLowerCase();return!lm.has(r)}const t=n.getAttribute("contenteditable");return t!==null&&t.toLowerCase()!=="false"?!0:n.isContentEditable===!0},df=n=>{const e=n?.ownerDocument??globalThis.document;if(!e)return!1;const t=cf(e);return!t||t===n||n?.contains(t)?!1:um(t)};function $(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function ff(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);t.search=r.toString(),console.warn(`Minified Lexical warning #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const nt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,cm=nt&&"documentMode"in document?document.documentMode:null,Ft=nt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Pt=nt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),zr=!(!nt||!("InputEvent"in window)||cm)&&"getTargetRanges"in new window.InputEvent("input"),Tn=nt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,hf=nt&&/Android/.test(navigator.userAgent),Po=nt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!hf,gf=nt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Di=nt&&hf&&gf,Lo=nt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Ft&&!gf,dm=0,fm=1,hm=2,ga=1,pa=2,ma=4,ya=8,gm=16,Ls=32,Is=64,bl=128,pm=1,mm=2,ym=3,_m=4,bm=5,km=6,Co=Po||Tn||Lo?" ":"​",Bn=`
2
2
 
3
3
  `,kl=Pt?" ":Co,hn={bold:1,capitalize:1024,code:16,highlight:bl,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},xm={directionless:1,unmergeable:2},$i={center:2,end:6,justify:4,left:1,right:3,start:5},Cm={[mm]:"center",[km]:"end",[_m]:"justify",[pm]:"left",[ym]:"right",[bm]:"start"},vm={normal:0,segmented:2,token:1},Sm={[dm]:"normal",[hm]:"segmented",[fm]:"token"},Tu="$config";function Nu(){return we()._blockCursorElement}function wm(n){return n!==null&&n.nodeType===1&&n.hasAttribute("data-lexical-slot")}let pf=class yi{element;before;after;constructor(e,t,r){this.element=e,this.before=t||null,this.after=r||null}withBefore(e){return new yi(this.element,e,this.after)}withAfter(e){return new yi(this.element,this.before,e)}withElement(e){return this.element===e?this:new yi(e,this.before,this.after)}insertChild(e){const t=this.getInsertionAnchor();return t!==null&&t.parentElement!==this.element&&$(357),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&$(358),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&$(359),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;return t===this.getInsertionAnchor()?null:t}getFirstChildAnchor(){return this.after}resolveLeafPosition(e,t,r){if(this.element===e)return t===e&&r===0?"before":"after";const o=Du(e,this.element);if(o===null)return"after";const i=Array.prototype.indexOf.call(e.childNodes,o);if(i<0)return"after";if(t===e)return r<=i?"before":"after";const s=Du(e,t);if(s===null)return"after";const a=Array.prototype.indexOf.call(e.childNodes,s);return a>=0&&a<=i?"before":"after"}getInsertionAnchor(){return this.before}};function Du(n,e){let t=e;for(;t!==null&&t.parentNode!==n;)t=t.parentNode;return t}let mf=class _i extends pf{withBefore(e){return new _i(this.element,e,this.after)}withAfter(e){return new _i(this.element,this.before,e)}withElement(e){return this.element===e?this:new _i(e,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()}getFirstChildAnchor(){let e=super.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;for(;wm(t);)e=t,t=t.nextSibling;const r=e?e.nextSibling:this.element.firstChild;return r!==null&&r===Nu()?r:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(this.element.__lexicalLastChildKind=e,e===null)this.removeManagedLineBreak();else{const t=e==="decorator"&&(Lo||Tn||Po);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,r=e.nodeName==="IMG"?e.nextSibling:null;r&&t.removeChild(r),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===(t.nodeName==="IMG"))return;this.removeManagedLineBreak()}const r=this.element,o=this.before,i=ae().createElement("br");if(i.setAttribute("data-lexical-managed-linebreak","true"),r.insertBefore(i,o),e){const s=ae().createElement("img");s.setAttribute("data-lexical-managed-linebreak","true"),s.style.setProperty("display","inline","important"),s.style.setProperty("border","0px","important"),s.style.setProperty("margin","0px","important"),s.alt="",r.insertBefore(s,i),r.__lexicalLineBreak=s}else r.__lexicalLineBreak=i}getFirstChildOffset(){const e=this.getFirstChild(),t=this.getInsertionAnchor();let r=0;for(let o=this.element.firstChild;o!==null&&o!==e&&o!==t;o=o.nextSibling)r++;return r}resolveChildIndex(e,t,r,o){if(r===this.element){const l=this.getFirstChildOffset(),u=Nu(),c=this.element.childNodes,d=Math.min(o,c.length);let f=0;for(let h=l;h<d;h++)c[h]!==u&&f++;return[e,Math.min(f,e.getChildrenSize())]}const i=$u(t,r);i.push(o);const s=$u(t,this.element);let a=e.getIndexWithinParent();for(let l=0;l<s.length;l++){const u=i[l],c=s[l];if(u===void 0||u<c)break;if(u>c){a+=1;break}}return[e.getParentOrThrow(),a]}};function $u(n,e){const t=[];let r=e;for(;r!==n&&r!==null;r=r.parentNode){let o=0;for(let i=r.previousSibling;i!==null;i=i.previousSibling)o++;t.push(o)}return r!==n&&$(225),t.reverse()}let yf;try{yf="0.49.0+prod.esm"}catch{}const _f=yf??'"<unknown>+source"';let to=class{_front=new Set;_back=new Set;_cache;get size(){return this._front.size+this._back.size}addBack(e){return delete this._cache,this._front.has(e)||this._back.add(e),this}addFront(e){return delete this._cache,this._back.has(e)||this._front.add(e),this}delete(e){return delete this._cache,this._front.delete(e)||this._back.delete(e)}toArray(){const e=Array.from(this._front).reverse();for(const t of this._back)e.push(t);return e}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}};const jn=null;function bf(n,e=1e3){return n instanceof _a?n.clone():n.size<e?new Map(n):new _a().init(new Map(n),void 0,n.size)}let _a=class kf{_mutable=!1;_old=void 0;_nursery=void 0;_size=0;clone(){return this._mutable=!1,new kf().init(this._old,this._nursery,this._size)}init(e,t,r){return this._old=e,this._nursery=t,this._size=r,this}get size(){return this._size}has(e){return this.get(e)!==void 0}getWithTombstone(e){const t=this._nursery&&this._nursery.get(e);return t!==void 0?t:this._old&&this._old.get(e)}get(e){const t=this.getWithTombstone(e);return t===jn?void 0:t}shouldCompact(){return this._nursery!==void 0&&2*this._nursery.size>this._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(e=!1){if(this._nursery&&this._nursery.size>0&&(e||this.shouldCompact())){const t=new Map(this._old);for(const[r,o]of this._nursery)o!==jn?t.set(r,o):t.delete(r);this._old=t,this._nursery=void 0}return this._mutable=!1,this}set(e,t){const r=this.getWithTombstone(e);if(r===t)return this;const o=this.getNursery();return r!==jn&&r!==void 0||(this._size++,r===jn&&o.delete(e)),o.set(e,t),this}delete(e){const t=this.has(e);return t&&(this.getNursery().set(e,jn),this._size--),t}getOrInsert(e,t){const r=this.get(e);return r!==void 0?r:(this.set(e,t),t)}getOrInsertComputed(e,t){const r=this.get(e);if(r!==void 0)return r;const o=t(e);return this.set(e,o),o}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(const e of this.entries())yield e[0]}*values(){for(const e of this.entries())yield e[1]}*entries(){const e=this._nursery,t=this._old;if(t)for(const r of t){const o=r[0],i=e?e.get(o):void 0;i!==jn&&(i!==void 0&&(r[1]=i),yield r)}if(e)for(const r of e)r[1]===jn||t&&t.has(r[0])||(yield r)}forEach(e,t){t!==void 0&&(e=e.bind(t));for(const[r,o]of this.entries())e(o,r,this)}get[Symbol.toStringTag](){return"GenMap"}[Symbol.iterator](){return this.entries()}};function Ai(n,e,t,r,o,i){if(x(n)){let s=n.getFirstChild();for(;s!==null;){const a=s.__key;s.__parent===e&&((x(s)||dn(s)&&s.__slots!==null)&&Ai(s,a,t,r,o,i),t.has(a)||i.delete(a),o.push(a)),s=s.getNextSibling()}}for(const s of dn(n)&&n.__slots!==null?n.__slots.values():[]){const a=r.get(s);a!==void 0&&Gn(a)&&a.__slotHost===e&&((x(a)||dn(a)&&a.__slots!==null)&&Ai(a,s,t,r,o,i),t.has(s)||i.delete(s),o.push(s))}}let ba=!1,xl=0;function Em(n){xl=n.timeStamp}function Bs(n,e,t){const r=n.nodeName==="BR",o=e.__lexicalLineBreak;return o&&(n===o||r&&n.previousSibling===o)||r&&Gr(n,t)!==void 0}function Tm(n,e,t){const r=Pe(gt(t)),o=r&&ft(r,t._rootElement);let i=null,s=null;o!==null&&o.anchorNode===n&&(i=o.anchorOffset,s=o.focusOffset);const a=n.nodeValue;a!==null&&Kl(e,a,i,s,!1)}function Nm(n,e,t){if(N(n)){const r=n.anchor.getNode();if(r.is(t)&&n.format!==r.getFormat())return!1}return ht(e)&&t.isAttached()}function Dm(n,e,t){for(let r=n;r&&!Hh(r);r=sr(r)){const o=Gr(r,e);if(o!==void 0){const i=Z(o,t);if(i)return re(i)||!q(r)?void 0:[r,i]}}}function xf(n,e,t){ba=!0;const r=performance.now()-xl>100;try{wt(n,()=>{const o=O()||(function(d){return d.read("latest",()=>{const f=O();return f!==null?f.clone():null})})(n),i=new Map,s=n._editorState,a=n._blockCursorElement;let l=!1,u="";for(let d=0;d<e.length;d++){const f=e[d],h=f.type,g=f.target,m=Dm(g,n,s);if(!m)continue;const[p,y]=m;if(h==="characterData")r&&D(y)&&ht(g)&&Nm(o,g,y)&&Tm(g,y,n);else if(h==="childList"){l=!0;const _=f.addedNodes;for(let S=0;S<_.length;S++){const C=_[S],w=Ah(C),v=C.parentNode;if(!(v==null||C===a||w!==null||Bs(C,v,n)||n._slotsUsed&&q(C)&&C.hasAttribute("data-lexical-slot")||Hh(C))){if(Pt){const E=(q(C)?C.innerText:null)||C.nodeValue;E&&(u+=E)}v.removeChild(C)}}const b=f.removedNodes,k=b.length;if(k>0){let S=0;for(let C=0;C<k;C++){const w=b[C];(Bs(w,g,n)||a===w)&&(g.appendChild(w),S++)}k!==S&&i.set(p,y)}}}if(i.size>0)for(const[d,f]of i)f.reconcileObservedMutation(d,n);const c=t.takeRecords();if(c.length>0){for(let d=0;d<c.length;d++){const f=c[d],h=f.addedNodes,g=f.target;for(let m=0;m<h.length;m++){const p=h[m],y=p.parentNode;y==null||p.nodeName!=="BR"||Bs(p,g,n)||y.removeChild(p)}}t.takeRecords()}o!==null&&(l&&be(o),Pt&&Rh(n)&&o.insertRawText(u))})}finally{ba=!1}}function Cf(n){const e=n._observer;e!==null&&xf(n,e.takeRecords(),e)}function vf(n){(function(e){xl===0&&gt(e).addEventListener("textInput",Em,!0)})(n),n._observer=new MutationObserver((e,t)=>{xf(n,e,t)})}const Au="latest";let $m=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||zm).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function Io(n,e){return new $m(n,e)}function Bo(n,e,t=Au){const r=(t===Au?n.getLatest():n).__state;return r?r.getValue(e):e.defaultValue}function Sr(n,e,t){let r;if(Ie(),typeof t=="function"){const i=n.getLatest(),s=Bo(i,e);if(r=t(s),e.isEqual(s,r))return i}else r=t;const o=n.getWritable();return wf(o).updateFromKnown(e,r),o}function Am(n){const e=new Map,t=new Set;for(const{ownNodeConfig:r}of Vl(typeof n=="function"?n:n.replace))if(r&&r.stateConfigs)for(const o of r.stateConfigs){let i;"stateConfig"in o?(i=o.stateConfig,o.flat&&t.add(i.key)):i=o,e.set(i.key,i)}return{flatKeys:t,sharedConfigMap:e}}const Fu=new Set(["__proto__","constructor","prototype"]);let Fm=class Sf{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,r=void 0,o=new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=r,this.knownState=o;const{sharedConfigMap:s}=this.sharedNodeState,a=i!==void 0?i:(function(l,u,c){let d=c.size;if(u)for(const f in u){const h=l.get(f);h&&c.has(h)||d++}return d})(s,r,o);this.size=a}getValue(e){const t=this.knownState.get(e);if(t!==void 0)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let r=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){const o=this.unknownState[e.key];o!==void 0&&(r=e.parse(o)),this.updateFromKnown(e,r)}return r}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const e={...this.unknownState},t={};for(const[r,o]of this.knownState)r.isEqual(o,r.defaultValue)?delete e[r.key]:e[r.key]=r.unparse(o);for(const r of this.sharedNodeState.flatKeys)r in e&&(t[r]=e[r],delete e[r]);return zu(e)&&(t.$=e),t}getWritable(e){if(this.node===e)return this;const{sharedNodeState:t,unknownState:r}=this,o=new Map(this.knownState);return new Sf(e,t,(function(i,s,a){let l;if(a)for(const[u,c]of Object.entries(a)){if(Fu.has(u))continue;const d=i.get(u);d?s.has(d)||s.set(d,d.parse(c)):(l=l||{},l[u]=c)}return l})(t.sharedConfigMap,o,r),o,this.size)}resetOnCopyNode(){for(const e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){const r=e.key;this.sharedNodeState.sharedConfigMap.set(r,e);const{knownState:o,unknownState:i}=this;o.has(e)||i&&r in i||(i&&(delete i[r],this.unknownState=zu(i)),this.size++),o.set(e,t)}updateFromUnknown(e,t){if(Fu.has(e))return;const r=this.sharedNodeState.sharedConfigMap.get(e);r?this.updateFromKnown(r,r.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){const{knownState:t}=this;for(const r of t.keys())t.set(r,r.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(const[r,o]of Object.entries(e))this.updateFromUnknown(r,o)}};function wf(n){const e=n.getWritable(),t=e.__state?e.__state.getWritable(e):new Fm(e,Ef(e));return e.__state=t,t}function Ef(n){return n.__state?n.__state.sharedNodeState:Nh(we(),n.getType()).sharedNodeState}function zu(n){if(n)for(const e in n)return n}function zm(n){return n}function Ou(n,e,t){for(const[r,o]of e.knownState){if(n.has(r.key))continue;n.add(r.key);const i=t?t.getValue(r):r.defaultValue;if(i!==o&&!r.isEqual(i,o))return!0}return!1}function Mu(n,e,t){const{unknownState:r}=e,o=t?t.unknownState:void 0;if(r){for(const[i,s]of Object.entries(r))if(!n.has(i)&&(n.add(i),s!==(o?o[i]:void 0)))return!0}return!1}function ju(n,e){const t=n.__state;return t&&t.node===n?t.getWritable(e):t}function Ru(n,e){const t=n.__mode,r=n.__format,o=n.__style,i=e.__mode,s=e.__format,a=e.__style,l=n.__state,u=e.__state;return(t===null||t===i)&&(r===null||r===s)&&(o===null||o===a)&&(n.__state===null||l===u||(function(c,d){if(c===d)return!0;const f=new Set;return!(c&&Ou(f,c,d)||d&&Ou(f,d,c)||c&&Mu(f,c,d)||d&&Mu(f,d,c))})(l,u))}function Pu(n,e){const t=n.mergeWithSibling(e),r=pe()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function Lu(n){let e,t,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(e=r.getPreviousSibling())!==null&&D(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(Ru(e,r)){r=Pu(e,r);break}break}e.remove()}for(;(t=r.getNextSibling())!==null&&D(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Ru(r,t)){r=Pu(r,t);break}break}t.remove()}}else r.remove()}function Kt(n){return Iu(n.anchor),Iu(n.focus),n}function Iu(n){for(;n.type==="element";){const e=n.getNode(),t=n.offset;let r,o;if(t===e.getChildrenSize()?(r=e.getChildAtIndex(t-1),o=!0):(r=e.getChildAtIndex(t),o=!1),D(r)){n.set(r.__key,o?r.getTextContentSize():0,"text",!0);break}if(!x(r))break;n.set(r.__key,o?r.getChildrenSize():0,"element",!0)}}const vo=Symbol.for("@lexical/CachedTextSize");function Bu(n,e){return xa.read(()=>{let t=0,r=n;for(let o=0;o<e&&r!==null;o++){const i=zt.get(r);if(i===void 0&&$(345,r),x(i)){const s=De.get(r);if(s!==void 0&&x(s)&&s.__parent!==i.__parent)t+=i.getTextContentSize();else{const a=Hn.get(r),l=a&&a.__lexicalTextContent;typeof l!="string"&&$(346,i.getType()),t+=l.length}o<e-1&&!i.isInline()&&(t+=2)}else{const s=i[vo];s===void 0&&$(347,i.getType(),r),t+=s}r=i.__next}return t},{editor:de})}function Tf(n){x(n)||n[vo]===void 0&&(n[vo]=D(n)?n.__text.length:n.getTextContentSize())}const Om=4;let So,de,wo,ie="",ze=null,Qe=null,qe=null;function Wt(){return{firstTextKey:qe,format:ze,style:Qe}}function Ct(n){n.firstTextKey!==null&&(ze=n.format,Qe=n.style,qe=n.firstTextKey)}function ka(n){if(qe!==null)return;const e=n.__lexicalFirstTextKey;if(e===void 0&&$(348),e===null)return;const t=De.get(e);D(t)&&(ze=t.getFormat(),Qe=t.getStyle(),qe=e)}let ds,po,mo,zt,xa,De,Hn,Ca,Eo,Jn,ln=!1,Fi=!1;function Cn(n,e){const t=zt.get(n),r=De.has(n);if(e!==null){const o=Ta(n);o.parentNode===e&&e.removeChild(o)}if(!r){if(de._keyToDOMMap.delete(n),x(t)){const o=Gi(t,zt);va(o,0,o.length-1,null)}if(t!==void 0){for(const o of pt(t).values()){const i=wa(o);Cn(o,null),i!==null&&i.remove()}Wl(Eo,wo,ds,t,"destroyed")}}}function va(n,e,t,r){for(let o=e;o<=t;++o){const i=n[o];i!==void 0&&Cn(i,r)}}function Rn(n,e){n.setProperty("text-align",e)}const Mm="40px";function Nf(n,e){const t=So.theme.indent;if(typeof t=="string"){const r=n.classList.contains(t);e>0&&!r?n.classList.add(t):e<1&&r&&n.classList.remove(t)}n.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * var(--lexical-indent-base-value, ${Mm}))`)}function Df(n,e){const t=n.style;e===0?Rn(t,""):e===1?Rn(t,"left"):e===2?Rn(t,"center"):e===3?Rn(t,"right"):e===4?Rn(t,"justify"):e===5?Rn(t,"start"):e===6&&Rn(t,"end")}function Sa(n,e){const t=(function(r){const o=r.__dir;if(o!==null)return o;if(Oe(r))return null;const i=r.getParent();return i===null||Se(i)&&i.__dir===null?"auto":null})(e);t!==null?n.dir=t:n.removeAttribute("dir")}function $f(n){const e=ae().createElement("div");return e.setAttribute("data-lexical-slot",n),e.style.display="none",e}function Af(n,e,t){e||n.contentEditable==="false"?qy(t,de):t.removeAttribute("contenteditable")}function Ku(n,e,t){const r=ie,o=Wt();ie="";let i="";const s=re(n);for(const[a,l]of t){const u=$f(a);Af(e,s,u),e.appendChild(u),ie="";const c=Wt();vn(l,Dt(n,u,de)),Ct(c),Ff(n,a,e,u),i+=ie}return Ct(o),ie=r,i}function pt(n){return dn(n)&&n.__slots!==null?n.__slots:Yh}function Ff(n,e,t,r){const o=Jn.$getSlotTargetElement(n,e,t,de);o!==null&&(r.parentElement!==o&&o.appendChild(r),r.style.display="")}function wa(n){const e=Hn.get(n);return e!==void 0?e.parentElement:null}function Wu(n,e,t){const r=pt(n),o=pt(e);for(const[c,d]of r)if(!o.has(c)){const f=wa(d);Cn(d,null),f!==null&&f.remove()}const i=ie,s=Wt();let a="",l=null;const u=re(e);for(const[c,d]of o){const f=r.get(c);let h=f!==void 0?wa(f):null;ie="";const g=Wt();if(h===null){h=$f(c);let m=null;for(const p of t.children)if(!p.hasAttribute("data-lexical-slot")){m=p;break}t.insertBefore(h,m),vn(d,Dt(e,h,de))}else f===d?an(d,h):(f!==void 0&&Cn(f,h),vn(d,Dt(e,h,de)));if(Ct(g),Af(t,u,h),Ff(e,c,t,h),a+=ie,h.parentElement===t){const m=l===null?t.firstChild:l.nextSibling;m!==h&&t.insertBefore(h,m),l=h}}return Ct(s),ie=i,a}function vn(n,e){const t=De.get(n);if(t===void 0&&$(60),e!==null){const o=zt.get(n);if(o!==void 0){const i=Hn.get(n);if(i!==void 0){const s=Gn(o)?o.__slotHost:null,a=Gn(t)?t.__slotHost:null,l=o.__parent!==t.__parent||s!==a,u=a!==null&&i.parentElement!==e.element;if(l||u)return e.insertChild(i),an(n,e.element)}}}const r=Jn.$createDOM(t,de);if((function(o,i,s){const a=s._keyToDOMMap;Fh(i,s,o),a.set(o,i)})(n,r,de),D(t)?r.setAttribute("data-lexical-text","true"):re(t)&&(r.setAttribute("data-lexical-decorator","true"),Yi(r,{captureSelection:!0})),x(t)){const o=t.__indent,i=t.__size;Sa(r,t),o!==0&&Nf(r,o);const s=pt(t),a=s.size>0?Ku(t,r,s):"";if(i===0)r.__lexicalTextContent=a,r.__lexicalFirstTextKey=null,ie+=a,s.size>0&&(r.__lexicalSlotTextLength=a.length);else{const u=ie,c=i-1;if(Ea(Gi(t,De),t,0,c,Dt(t,r,de)),a!==""){const d=r.__lexicalTextContent||"";r.__lexicalTextContent=a+d,ie=u+a+d}s.size>0&&(r.__lexicalSlotTextLength=a.length)}const l=t.__format;l!==0&&Df(r,l),t.isInline()||zf(null,t,r)}else{const o=t.getTextContent();if(re(t)){const i=t.decorate(de,So);i!==null&&Of(n,i),r.contentEditable="false";const s=pt(t);s.size>0&&Ku(t,r,s)}ie+=o}return e!==null&&e.insertChild(r),Jn.$decorateDOM(t,null,r,de),Tf(t),Wl(Eo,wo,ds,t,"created"),r}function Ea(n,e,t,r,o){const i=ie,s=Wt();ie="",ze=null,Qe=null,qe=null;let a=t;for(;a<=r;++a){const u=Wt();vn(n[a],o);const c=De.get(n[a]);c!==null&&D(c)?ze===null&&(ze=c.getFormat(),Qe=c.getStyle(),qe=c.__key):x(c)&&a<r&&!c.isInline()&&(ie+=Bn),Ct(u)}const l=de._keyToDOMMap.get(e.__key);l===void 0&&$(349,e.__key),l.__lexicalTextContent=ie,l.__lexicalFirstTextKey=qe,ie=i+ie,Ct(s)}function zf(n,e,t){const r=Dt(e,t,de),o=r.element.__lexicalLastChildKind??null,i=(function(s,a){if(s){const l=s.__last;if(l){const u=a.get(l);if(u)return We(u)?"line-break":re(u)&&u.isInline()?"decorator":null}return pt(s).size>0?null:"empty"}return null})(e,De);o!==i&&r.setManagedLineBreak(i)}function jm(n,e,t){var r;ze=null,Qe=null,qe=null,(function(o,i,s){const a=ie,l=o.__size,u=i.__size;ie="";const c=s.element,d=de._keyToDOMMap.get(i.__key);d===void 0&&$(351,i.__key);const f=u-l;if(!ln&&Math.abs(f)<=1&&l>=Om&&o.__first===i.__first&&(f!==0||!de._cloneNotNeeded.has(o.__key))){const h=d.__lexicalTextContent,g=Ca.get(o.__key);if(!ln&&typeof h=="string"&&g!==void 0){const m=(function(p,y){const _=y.size;if(_===0||_>=p.__size)return null;let b=p.__last,k=null,S=0;for(;b!==null&&S<_;){if(!y.has(b))return null;k=b;const C=De.get(b);if(C===void 0)return null;b=C.__prev,S++}return S!==_||b!==null&&y.has(b)?null:k})(i,g);if(m!==null){const p=g.size;if(f===0){const y=Bu(m,p);let _=m,b=0;for(;_!==null&&b<p;){const v=De.get(_);if(v===void 0)break;const E=Wt();an(_,c),D(v)&&ze===null&&(ze=v.getFormat(),Qe=v.getStyle(),qe=v.__key),Ct(E),_=v.__next,b++}let k="";for(_=m,b=0;_!==null&&b<p;){const v=De.get(_);if(v===void 0)break;let E;if(x(v)){const A=de._keyToDOMMap.get(_),T=A&&A.__lexicalTextContent;typeof T!="string"&&$(352,v.getType()),E=T}else E=v.getTextContent();k+=E,b<p-1&&x(v)&&!v.isInline()&&(k+=Bn),_=v.__next,b++}const S=d.__lexicalSlotTextLength||0,C=S>0?h.slice(S):h,w=C.slice(0,C.length-y)+k;return d.__lexicalTextContent=w,ie=a+w,void qu(i,d,g)}if((function(y,_,b,k,S,C,w,v){if(v!==1&&v!==-1||w!==(v===1?2:1))return!1;const A=w-v;let T=y.__last;for(let oe=0;oe<A-1;oe++){if(T===null)return!1;const $e=zt.get(T);if($e===void 0)return!1;T=$e.__prev}if(T===null)return!1;const j=De.get(C),M=zt.get(T);if(j===void 0||M===void 0||j.__prev!==M.__prev)return!1;const R=[];let I=C;for(let oe=0;oe<w;oe++){if(I===null)return!1;R.push(I);const $e=De.get(I);I=$e?$e.__next:null}const te=[];I=T;for(let oe=0;oe<A;oe++){if(I===null)return!1;te.push(I);const $e=zt.get(I);I=$e?$e.__next:null}const se=new Set(te),ne=new Set(R),B=[];let L=0,K=0;for(;L<A&&K<w;)if(R[K]===te[L])B.push({key:R[K],kind:"reconcile"}),L++,K++;else if(ne.has(te[L])){if(se.has(R[K]))return!1;B.push({key:R[K],kind:"create",nextIndex:K}),K++}else B.push({key:te[L],kind:"destroy"}),L++;for(;L<A;)B.push({key:te[L++],kind:"destroy"});for(;K<w;)B.push({key:R[K],kind:"create",nextIndex:K}),K++;const H=Bu(T,A);for(const oe of B){const $e=Wt();if(oe.kind==="reconcile")an(oe.key,b.element);else if(oe.kind==="destroy")Cn(oe.key,b.element);else{let it=null;for(let nn=oe.nextIndex+1;nn<w;nn++){const _n=de._keyToDOMMap.get(R[nn]);if(_n!==void 0){it=_n;break}}vn(oe.key,b.withBefore(it??b.before))}if(oe.kind!=="destroy"){const it=De.get(oe.key);it&&D(it)&&ze===null&&(ze=it.getFormat(),Qe=it.getStyle(),qe=it.__key)}Ct($e)}let Y="";for(let oe=0;oe<w;oe++){const $e=De.get(R[oe]);if($e===void 0)return!1;let it;if(x($e)){const nn=de._keyToDOMMap.get(R[oe]),_n=nn&&nn.__lexicalTextContent;typeof _n!="string"&&$(350,$e.getType()),it=_n}else it=$e.getTextContent();Y+=it,oe<w-1&&x($e)&&!$e.isInline()&&(Y+=Bn)}const he=k.__lexicalSlotTextLength||0,ot=he>0?S.slice(he):S;return k.__lexicalTextContent=ot.slice(0,ot.length-H)+Y,!0})(o,0,s,d,h,m,p,f)){const y=d.__lexicalTextContent;return typeof y!="string"&&$(353),ie=a+y,void qu(i,d,g)}}}if(f===0){let m=o.__first,p=0;for(;m!==null;){const y=De.get(m);if(y===void 0)break;const _=ln||mo.has(m)||po.has(m),b=Wt();if(_)an(m,c);else{let k,S;if(x(y)){S=Hn.get(m);const C=S&&S.__lexicalTextContent;typeof C!="string"&&$(354,y.getType()),k=C}else k=y.getTextContent();ie+=k,S!==void 0&&ka(S)}D(y)?ze===null&&(ze=y.getFormat(),Qe=y.getStyle(),qe=y.__key):x(y)&&p<u-1&&!y.isInline()&&(ie+=Bn),Ct(b),m=y.__next,p++}return d.__lexicalTextContent=ie,d.__lexicalFirstTextKey=qe,void(ie=a+ie)}}if(l===1&&u===1){const h=o.__first,g=i.__first;if(h===g)an(h,c);else{const p=Ta(h),y=vn(g,null);try{p.parentNode===c?c.replaceChild(y,p):s.insertChild(y)}catch(_){if(typeof _=="object"&&_!=null){const b=`${_.toString()} Parent: ${c.tagName}, new child: {tag: ${y.tagName} key: ${g}}, old child: {tag: ${p.tagName}, key: ${h}}.`;throw new Error(b)}throw _}Cn(h,null)}const m=De.get(g);D(m)&&ze===null&&(ze=m.getFormat(),Qe=m.getStyle(),qe=m.__key)}else{const h=Gi(o,zt),g=Gi(i,De);if(h.length!==l&&$(227),g.length!==u&&$(228),l===0)u!==0&&Ea(g,i,0,u-1,s);else if(u===0){if(l!==0){const m=s.after==null&&s.before==null&&pt(i).size===0&&s.element.__lexicalLineBreak==null;va(h,0,l-1,m?null:c),m&&(c.textContent="")}}else(function(m,p,y,_,b,k){const S=_-1,C=b-1;let w,v,E=k.getFirstChild(),A=0,T=0;for(;A<=S&&T<=C;){const R=p[A],I=y[T],te=Wt();if(R===I)E=Ks(an(I,k.element)),A++,T++;else{if(v===void 0&&(v=Uu(y,T)),w===void 0)w=Uu(p,A);else if(!w.has(R)){A++,Ct(te);continue}if(!v.has(R)){E=Ks(Ta(R)),Cn(R,k.element),A++,w.delete(R),Ct(te);continue}if(w.has(I)){const ne=Lr(de,I);ne!==E&&k.withBefore(E??k.before).insertChild(ne),E=Ks(an(I,k.element)),A++,T++}else vn(I,k.withBefore(E??k.before)),T++}const se=De.get(I);se!==null&&D(se)?ze===null&&(ze=se.getFormat(),Qe=se.getStyle(),qe=se.__key):x(se)&&T<=C&&!se.isInline()&&(ie+=Bn),Ct(te)}const j=A>S,M=T>C;if(j&&!M){const R=y[C+1],I=R===void 0?null:de.getElementByKey(R);Ea(y,m,T,C,k.withBefore(I??k.before))}else M&&!j&&va(p,A,S,k.element)})(i,h,g,l,u,s)}d.__lexicalTextContent=ie,d.__lexicalFirstTextKey=qe,ie=a+ie})(n,e,Dt(e,t,de)),Se(e)||(r=e,ze==null||ze===r.__textFormat||Fi||r.setTextFormat(ze),(function(o){Qe==null||Qe===o.__textStyle||Fi||o.setTextStyle(Qe)})(e))}function qu(n,e,t){const r=e.__lexicalFirstTextKey;if(r!=null){const o=n.__key;let i=r;for(;i!==null;){const s=De.get(i);if(s===void 0){i=null;break}if(s.__parent===o)break;i=s.__parent}if(i!==null&&!t.has(i)){const s=De.get(r);if(D(s))return ze=s.getFormat(),void(Qe=s.getStyle())}}e.__lexicalFirstTextKey=qe}function an(n,e){const t=zt.get(n);let r=De.get(n);t!==void 0&&r!==void 0||$(61);const o=ln||mo.has(n)||po.has(n),i=Lr(de,n);if(t===r&&!o){let s;if(x(t)){const a=i.__lexicalTextContent;typeof a!="string"&&$(355,t.getType()),s=a,ka(i)}else s=t.getTextContent();return ie+=s,i}if(t!==r&&o&&Wl(Eo,wo,ds,r,"updated"),Jn.$updateDOM(r,t,i,de)){const s=vn(n,null);return e===null&&$(62),e.replaceChild(s,i),Cn(n,null),s}if(x(t)){x(r)||$(334,n);const s=r.__indent;(ln||s!==t.__indent)&&Nf(i,s);const a=r.__format;(ln||a!==t.__format)&&Df(i,a);const l=o&&(pt(r).size>0||pt(t).size>0)?Wu(t,r,i):"";if(o){const u=ie;if(jm(t,r,i),Oe(r)||r.isInline()||zf(0,r,i),l!==""){const c=i.__lexicalTextContent||"";i.__lexicalTextContent=l+c,ie=u+l+c,i.__lexicalSlotTextLength=l.length}else(pt(r).size>0||pt(t).size>0)&&(i.__lexicalSlotTextLength=0)}else{const u=i.__lexicalTextContent;typeof u!="string"&&$(356,t.getType()),ie+=u,ka(i)}if((ln||r.__dir!==t.__dir||r.__parent!==t.__parent)&&(Sa(i,r),Oe(r)&&!ln))for(const u of r.getChildren())x(u)&&Sa(Lr(de,u.getKey()),u)}else{const s=r.getTextContent();if(re(r)){const a=r.decorate(de,So);a!==null&&Of(n,a),o&&(pt(r).size>0||pt(t).size>0)&&Wu(t,r,i)}ie+=s}if(!Fi&&Oe(r)){const s=r.getLatest();if(s.__cachedText!==ie){const a=s.getWritable();a.__cachedText=ie,r=a}}return Jn.$decorateDOM(r,t,i,de),Tf(r),i}function Of(n,e){let t=de._pendingDecorators;const r=de._decorators;if(t===null){if(r[n]===e)return;t=zh(de)}t[n]=e}function Ks(n){let e=n.nextSibling;return e!==null&&e===de._blockCursorElement&&(e=e.nextSibling),e}function Uu(n,e){const t=new Set;for(let r=e;r<n.length;r++)t.add(n[r]);return t}function Rm(n,e,t,r,o,i){ie="",ze=null,Qe=null,qe=null,ln=r===2,de=t,So=t._config,Jn=t._config.dom||qi,wo=t._nodes,ds=de._listeners.mutation,po=o,mo=i,zt=n._nodeMap,xa=n,De=e._nodeMap,Fi=e._readOnly,Hn=bf(t._keyToDOMMap),Ca=(function(){const a=new Map,l=u=>{for(const c of u){const d=De.get(c);if(d===void 0)continue;const f=d.__parent;if(f===null)continue;let h=a.get(f);h===void 0&&(h=new Set,a.set(f,h)),h.add(c)}};return l(po.keys()),l(mo),a})();const s=new Map;return Eo=s,an("root",null),de=void 0,wo=void 0,po=void 0,mo=void 0,zt=void 0,xa=void 0,De=void 0,So=void 0,Hn=void 0,Ca=void 0,Eo=void 0,Jn=qi,s}function Ta(n){const e=Hn.get(n);return e===void 0&&$(75,n),e}function W(n){return{type:n}}const qt=W("SELECTION_CHANGE_COMMAND"),Mf=W("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),fs=W("CLICK_COMMAND"),jf=W("BEFORE_INPUT_COMMAND"),Rf=W("INPUT_COMMAND"),Pf=W("COMPOSITION_START_COMMAND"),Lf=W("COMPOSITION_END_COMMAND"),Sn=W("DELETE_CHARACTER_COMMAND"),wr=W("INSERT_LINE_BREAK_COMMAND"),Vn=W("INSERT_PARAGRAPH_COMMAND"),Wn=W("CONTROLLED_TEXT_INSERTION_COMMAND"),Yr=W("PASTE_COMMAND"),bi=W("REMOVE_TEXT_COMMAND"),Or=W("DELETE_WORD_COMMAND"),Mr=W("DELETE_LINE_COMMAND"),Ot=W("FORMAT_TEXT_COMMAND"),Pm=W("SET_TEXT_FORMAT_COMMAND"),hs=W("UNDO_COMMAND"),gs=W("REDO_COMMAND"),ps=W("KEYDOWN_COMMAND"),Cl=W("KEY_ARROW_RIGHT_COMMAND"),If=W("MOVE_TO_END"),vl=W("KEY_ARROW_LEFT_COMMAND"),Bf=W("MOVE_TO_START"),Sl=W("KEY_ARROW_UP_COMMAND"),wl=W("KEY_ARROW_DOWN_COMMAND"),zi=W("KEY_ENTER_COMMAND"),Kf=W("KEY_SPACE_COMMAND"),ms=W("KEY_BACKSPACE_COMMAND"),El=W("KEY_ESCAPE_COMMAND"),Tl=W("KEY_DELETE_COMMAND"),Nl=W("KEY_TAB_COMMAND"),Lm=W("INSERT_TAB_COMMAND"),Im=W("INDENT_CONTENT_COMMAND"),Hu=W("OUTDENT_CONTENT_COMMAND"),Wf=W("DROP_COMMAND"),qf=W("FORMAT_ELEMENT_COMMAND"),Uf=W("DRAGSTART_COMMAND"),Hf=W("DRAGOVER_COMMAND"),Bm=W("DRAGEND_COMMAND"),Ko=W("COPY_COMMAND"),ys=W("CUT_COMMAND"),Dl=W("SELECT_ALL_COMMAND"),Km=W("CLEAR_EDITOR_COMMAND"),Wm=W("CLEAR_HISTORY_COMMAND"),lo=W("CAN_REDO_COMMAND"),uo=W("CAN_UNDO_COMMAND"),Jf=W("FOCUS_COMMAND"),qm=W("BLUR_COMMAND"),Um=W("KEY_MODIFIER_COMMAND");function Hm(n){const e=new Map;return{dispose(){for(const t of e.values())t.dispose();e.clear()},register(t,r){let o=e.get(t);o===void 0&&(o={dispose:n(t,r),holders:new Set},e.set(t,o));const i=()=>{const s=e.get(t);s&&s.holders.delete(i)&&s.holders.size===0&&(e.delete(t),s.dispose())};return o.holders.add(i),i}}}function yo(n,e,t,r){return n.addEventListener(e,t,r),n.removeEventListener.bind(n,e,t,r)}const rn=Object.freeze({}),Na=[["keydown",function(n,e){const t=e._inputState;t.lastKeyDownTimeStamp=n.timeStamp,t.lastKeyCode=n.key,n.key!=="Backspace"&&To(t),!e.isComposing()&&P(e,ps,n)}],["pointerdown",function(n,e){const t=Xn(n),r=n.pointerType;Lt(t)&&r!=="touch"&&r!=="pen"&&n.button===0&&wt(e,()=>{Xi(t,e)||(e._inputState.isSelectionChangeFromMouseDown=!0)})}],["compositionstart",function(n,e){P(e,Pf,n)}],["compositionend",function(n,e){const t=e._inputState;Pt?t.compositionPhase="ending-firefox":Tn||!Po&&!Lo?P(e,Lf,n):(t.compositionPhase="ending-safari",t.compositionEndData=n.data)}],["input",function(n,e){n.stopPropagation();const t=e._inputState;To(t),wt(e,()=>{Gf(n,e)||e.dispatchCommand(Rf,n)},{event:n}),t.unprocessedBeforeInputData=null}],["click",function(n,e){wt(e,()=>{const t=O(),r=Pe(gt(e)),o=yt();if(r){if(N(t)){const i=t.anchor,s=i.getNode();i.type==="element"&&i.offset===0&&t.isCollapsed()&&!Oe(s)&&fe().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&o!==null&&t.is(o)&&(r.removeAllRanges(),t.dirty=!0)}else if(n.pointerType==="touch"||n.pointerType==="pen"){const i=ft(r,e._rootElement).anchorNode;(q(i)||ht(i))&&be(Do(o,r,e,n))}}if(Pt&&r!==null&&r.rangeCount===0){const i=e._rootElement;if(i!==null&&n.target===i){const s=n.clientY;let a=i.childNodes.length;for(let u=0;u<i.childNodes.length;u++){const c=i.childNodes[u];if(q(c)){const d=c.getBoundingClientRect();if(s<=(d.top+d.bottom)/2){a=u;break}}}r.setBaseAndExtent(i,a,i,a);const l=Do(o,r,e,n);l!==null?be(l):r.removeAllRanges()}}P(e,fs,n)})}],["cut",rn],["copy",rn],["dragstart",rn],["dragover",rn],["dragend",rn],["paste",rn],["focus",rn],["blur",rn],["drop",rn]];zr&&Na.push(["beforeinput",(n,e)=>(function(t,r){const o=t.inputType;o==="deleteCompositionText"||Pt&&Rh(r)||o!=="insertCompositionText"&&wt(r,()=>{Gf(t,r)||P(r,jf,t)},{event:t})})(n,e)]);const Da=new WeakMap,Oi=new WeakMap,Jm=Hm(n=>(n.addEventListener("selectionchange",Gu),()=>n.removeEventListener("selectionchange",Gu)));function Vf(n,e,t,r,o,i){const s=n.anchor,a=n.focus,l=s.getNode(),u=pe();let c;if(i!==void 0)c=i;else{const m=Pe(gt(u));c=m!==null?ft(m,u._rootElement):null}const d=c!==null?c.anchorNode:null,f=s.key,h=u.getElementByKey(f),g=t.length;return f!==a.key||!D(l)||(!o&&(!zr||u._inputState.lastBeforeInputInsertTextTimeStamp<r+50)||l.isDirty()&&g<2||Oh(t))&&s.offset!==a.offset&&!l.isComposing()||Et(l)||l.isDirty()&&g>1||(o||!zr)&&h!==null&&!l.isComposing()&&d!==En(l,h,u)||c!==null&&e!==null&&(!e.collapsed||e.startContainer!==c.anchorNode||e.startOffset!==c.anchorOffset)||!l.isComposing()&&(l.getFormat()!==n.format||l.getStyle()!==n.style)||(function(m,p){if(p.isSegmented())return!0;if(!m.isCollapsed())return!1;const y=m.anchor.offset,_=p.getParentOrThrow(),b=Ui(p);return y===0?!p.canInsertTextBefore()||!_.canInsertTextBefore()&&!p.isComposing()||b||(function(k){const S=k.getPreviousSibling();return(D(S)||x(S)&&S.isInline())&&!S.canInsertTextAfter()})(p):y===p.getTextContentSize()&&(!p.canInsertTextAfter()||!_.canInsertTextAfter()&&!p.isComposing()||b)})(n,l)}function Ju(n,e){return ht(n)&&n.nodeValue!==null&&e!==0&&e!==n.nodeValue.length}function Vu(n,e,t){const{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}=ft(n,e._rootElement),a=e._inputState;a.isSelectionChangeFromDOMUpdate&&(a.isSelectionChangeFromDOMUpdate=!1,Ju(r,o)&&Ju(i,s)&&!a.postDeleteSelectionToRestore)||wt(e,()=>{if(!t)return void be(null);if(!Ho(e,r,i))return;let l=O();if(a.postDeleteSelectionToRestore&&N(l)&&l.isCollapsed()){const u=l.anchor,c=a.postDeleteSelectionToRestore.anchor;(u.key===c.key&&u.offset===c.offset+1||u.offset===1&&c.getNode().is(u.getNode().getPreviousSibling()))&&(l=a.postDeleteSelectionToRestore.clone(),be(l))}if(a.postDeleteSelectionToRestore=null,N(l)){const u=l.anchor,c=u.getNode();if(l.isCollapsed()){n.type==="Range"&&r===i&&(l.dirty=!0);const d=gt(e).event,f=d?d.timeStamp:performance.now(),{format:h,style:g,offset:m,key:p,timeStamp:y}=a.collapsedSelectionFormat,_=fe(),b=e.isComposing()===!1&&_.getTextContent()==="";if(f<y+200&&u.offset===m&&u.key===p)ki(l,h,g);else if(u.type==="text")D(c)||$(141),Yf(l,c);else if(u.type==="element"&&!b){x(c)||$(259);const k=u.getNode();k.isEmpty()?(function(S,C){const w=C.getTextFormat(),v=C.getTextStyle();ki(S,w,v)})(l,k):ki(l,l.format,"")}}else{const d=u.key,f=l.focus.key,h=l.getNodes(),g=h.length,m=l.isBackward(),p=m?s:o,y=m?o:s,_=m?f:d,b=m?d:f;let k=2047,S=!1;for(let C=0;C<g;C++){const w=h[C],v=w.getTextContentSize();if(D(w)&&v!==0&&!(C===0&&w.__key===_&&p===v||C===g-1&&w.__key===b&&y===0)&&(S=!0,k&=w.getFormat(),k===0))break}l.format=S?k:0}}P(e,qt)})}function ki(n,e,t){n.format===e&&n.style===t||(n.format=e,n.style=t,n.dirty=!0)}function Yf(n,e){ki(n,e.getFormat(),e.getStyle())}function Xf(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function Yu(n){const{lastKeyCode:e}=pe()._inputState;if(n==null||n.length<=1||e==null)return;const t=e.length===1?e:e==="Enter"?`
4
4
  `:e==="Tab"?" ":null;if(!t)return;const r=O();if(!N(r)||!r.isCollapsed())return;const o=r.anchor.getNode();if(!D(o))return;const{offset:i}=r.anchor;if(o.getTextContentSize()===i){const s=o.getNextSibling();if(t===`
@@ -1 +1 @@
1
- import{f2 as r,f3 as o,f4 as a}from"./index-DDaQbjmr.js";import{o as n}from"./rich-text-spellcheck-provider-J8m9wz6A.js";const l=t=>({post:e=>t.postMessage(e),listen:e=>t.addEventListener("message",s=>e(s.data)),fail:e=>t.addEventListener("error",s=>e(s.message)),terminate:()=>t.terminate()}),i=async t=>{const e=r(t);if(!e)return null;const s=new Worker(new URL("/assets/rich-text-spellcheck-worker-pWkhC-WR.js",import.meta.url),{type:"module"});return n(e,o(),l(s),a(e))};export{i as openSpellcheckWorker};
1
+ import{f4 as r,f5 as o,f6 as a}from"./index-CVyiXes6.js";import{o as n}from"./rich-text-spellcheck-provider-J8m9wz6A.js";const l=t=>({post:e=>t.postMessage(e),listen:e=>t.addEventListener("message",s=>e(s.data)),fail:e=>t.addEventListener("error",s=>e(s.message)),terminate:()=>t.terminate()}),i=async t=>{const e=r(t);if(!e)return null;const s=new Worker(new URL("/assets/rich-text-spellcheck-worker-pWkhC-WR.js",import.meta.url),{type:"module"});return n(e,o(),l(s),a(e))};export{i as openSpellcheckWorker};
@@ -1 +1 @@
1
- import{e}from"./index-DDaQbjmr.js";const a=e("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);export{a as R};
1
+ import{e}from"./index-CVyiXes6.js";const a=e("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);export{a as R};
@@ -1 +1 @@
1
- import{r as d}from"./index-DDaQbjmr.js";const E={"data-list-row":""},v="[data-list-row]";function m(e,r,s,i="vertical"){if(s===0)return null;const n=i==="vertical"?"ArrowDown":"ArrowRight",c=i==="vertical"?"ArrowUp":"ArrowLeft";return e===n?r<0?0:Math.min(r+1,s-1):e===c?r<=0?0:r-1:e==="Home"?0:e==="End"?s-1:null}function l(e,r){return Array.from(e.querySelectorAll(r))}function y({containerRef:e,itemSelector:r,orientation:s="vertical",enabled:i=!0}){d.useEffect(()=>{if(!i)return;const n=e.current;if(!n)return;const c=()=>{const t=l(n,r);if(t.length===0)return;const f=t.find(o=>o===document.activeElement)??t[0];for(const o of t)o.tabIndex=o===f?0:-1},u=t=>{if(t.shiftKey||t.metaKey||t.ctrlKey||t.altKey)return;const a=l(n,r),f=a.indexOf(document.activeElement),o=m(t.key,f,a.length,s);o===null||o===f||(t.preventDefault(),t.stopPropagation(),a[o]?.focus())};return c(),n.addEventListener("focusin",c),n.addEventListener("keydown",u),()=>{n.removeEventListener("focusin",c),n.removeEventListener("keydown",u)}})}export{v as L,E as a,m as r,y as u};
1
+ import{r as d}from"./index-CVyiXes6.js";const E={"data-list-row":""},v="[data-list-row]";function m(e,r,s,i="vertical"){if(s===0)return null;const n=i==="vertical"?"ArrowDown":"ArrowRight",c=i==="vertical"?"ArrowUp":"ArrowLeft";return e===n?r<0?0:Math.min(r+1,s-1):e===c?r<=0?0:r-1:e==="Home"?0:e==="End"?s-1:null}function l(e,r){return Array.from(e.querySelectorAll(r))}function y({containerRef:e,itemSelector:r,orientation:s="vertical",enabled:i=!0}){d.useEffect(()=>{if(!i)return;const n=e.current;if(!n)return;const c=()=>{const t=l(n,r);if(t.length===0)return;const f=t.find(o=>o===document.activeElement)??t[0];for(const o of t)o.tabIndex=o===f?0:-1},u=t=>{if(t.shiftKey||t.metaKey||t.ctrlKey||t.altKey)return;const a=l(n,r),f=a.indexOf(document.activeElement),o=m(t.key,f,a.length,s);o===null||o===f||(t.preventDefault(),t.stopPropagation(),a[o]?.focus())};return c(),n.addEventListener("focusin",c),n.addEventListener("keydown",u),()=>{n.removeEventListener("focusin",c),n.removeEventListener("keydown",u)}})}export{v as L,E as a,m as r,y as u};
@@ -1 +1 @@
1
- import{r as e,j as l,f as b,t as y,L as x}from"./index-DDaQbjmr.js";const i=()=>l.jsx(x,{className:"size-3.5 animate-spin"}),m=(s,n)=>n?l.jsx("span",{className:"sr-only",children:s}):s;function p({actions:s=[],destructive:n,className:o}){const[f,r]=e.useState(!1);return f&&n?.confirm?l.jsxs("div",{className:y("flex items-center gap-2",o),children:[l.jsx("span",{className:"text-xs text-fg-muted",children:n.confirm.prompt}),l.jsx(b,{variant:"secondary",size:"sm",onClick:()=>r(!1),children:n.confirm.cancelLabel??"Cancel"}),l.jsx(b,{variant:"danger",size:"sm","aria-busy":n.busy,icon:n.busy?i():void 0,onClick:()=>{n.busy||n.onClick()},children:n.busy?n.busyLabel??"Working…":n.confirm.confirmLabel??n.label})]}):l.jsxs("div",{className:y("flex items-center gap-2",o),children:[s.map(a=>l.jsx(b,{variant:a.variant??"ghost",size:"sm","aria-busy":a.busy,"aria-label":a.iconOnly?a.label:void 0,icon:a.busy?i():a.icon,onClick:()=>{a.busy||a.onClick()},children:a.busy&&a.busyLabel?a.busyLabel:m(a.label,a.iconOnly)},a.label)),n&&l.jsx(b,{variant:"ghost",size:"sm","aria-busy":n.busy,"aria-label":n.iconOnly?n.label:void 0,icon:n.busy?i():n.icon,onClick:()=>{if(!n.busy){if(n.confirm){r(!0);return}n.onClick()}},children:n.busy&&n.busyLabel?n.busyLabel:m(n.label,n.iconOnly)})]})}export{p as R};
1
+ import{r as e,j as l,f as b,t as y,L as x}from"./index-CVyiXes6.js";const i=()=>l.jsx(x,{className:"size-3.5 animate-spin"}),m=(s,n)=>n?l.jsx("span",{className:"sr-only",children:s}):s;function p({actions:s=[],destructive:n,className:o}){const[f,r]=e.useState(!1);return f&&n?.confirm?l.jsxs("div",{className:y("flex items-center gap-2",o),children:[l.jsx("span",{className:"text-xs text-fg-muted",children:n.confirm.prompt}),l.jsx(b,{variant:"secondary",size:"sm",onClick:()=>r(!1),children:n.confirm.cancelLabel??"Cancel"}),l.jsx(b,{variant:"danger",size:"sm","aria-busy":n.busy,icon:n.busy?i():void 0,onClick:()=>{n.busy||n.onClick()},children:n.busy?n.busyLabel??"Working…":n.confirm.confirmLabel??n.label})]}):l.jsxs("div",{className:y("flex items-center gap-2",o),children:[s.map(a=>l.jsx(b,{variant:a.variant??"ghost",size:"sm","aria-busy":a.busy,"aria-label":a.iconOnly?a.label:void 0,icon:a.busy?i():a.icon,onClick:()=>{a.busy||a.onClick()},children:a.busy&&a.busyLabel?a.busyLabel:m(a.label,a.iconOnly)},a.label)),n&&l.jsx(b,{variant:"ghost",size:"sm","aria-busy":n.busy,"aria-label":n.iconOnly?n.label:void 0,icon:n.busy?i():n.icon,onClick:()=>{if(!n.busy){if(n.confirm){r(!0);return}n.onClick()}},children:n.busy&&n.busyLabel?n.busyLabel:m(n.label,n.iconOnly)})]})}export{p as R};
@@ -1 +1 @@
1
- import{u as x,C as v,x as p,z as I,ak as g,r as Q}from"./index-DDaQbjmr.js";import{b}from"./MailShell-C6XAYw9R.js";import{a as C}from"./useMessageBodyContent-Azq1Bngf.js";function W(o){const t=x(),{searchInput:c,searchQuery:e}=v(),i=p({select:a=>I(a.location.search)}),u=p({select:a=>a.location.pathname}),h=C(),f=g(),m=h||f,{to:s}=o,r="params"in o?o.params.mailboxId:void 0,l=r?`/mail/${r}`:s;Q.useEffect(()=>{if(!b({searchInput:c,committedQuery:e,urlQuery:i,pathname:u,listPath:l}))return;const y=!!e&&i!==e&&!m,n=d=>({...d,q:e||void 0});if(!y){t({to:".",search:n,hash:!0,replace:!0});return}if(s==="/mail/$mailboxId"){if(!r)return;t({to:s,params:{mailboxId:r},search:n,hash:!0,replace:!0});return}t({to:s,search:n,hash:!0,replace:!0})},[c,e,i,t,s,r,l,u,m])}export{W as u};
1
+ import{u as x,C as v,x as p,z as I,ak as g,r as Q}from"./index-CVyiXes6.js";import{b}from"./MailShell-CO4UHszY.js";import{a as C}from"./useMessageBodyContent-Bq-24837.js";function W(o){const t=x(),{searchInput:c,searchQuery:e}=v(),i=p({select:a=>I(a.location.search)}),u=p({select:a=>a.location.pathname}),h=C(),f=g(),m=h||f,{to:s}=o,r="params"in o?o.params.mailboxId:void 0,l=r?`/mail/${r}`:s;Q.useEffect(()=>{if(!b({searchInput:c,committedQuery:e,urlQuery:i,pathname:u,listPath:l}))return;const y=!!e&&i!==e&&!m,n=d=>({...d,q:e||void 0});if(!y){t({to:".",search:n,hash:!0,replace:!0});return}if(s==="/mail/$mailboxId"){if(!r)return;t({to:s,params:{mailboxId:r},search:n,hash:!0,replace:!0});return}t({to:s,search:n,hash:!0,replace:!0})},[c,e,i,t,s,r,l,u,m])}export{W as u};
@@ -1 +1 @@
1
- import{r as l,j as h,bU as V,t as E,cg as _,X as Q,ch as L,ci as G,cj as z,ck as X,cl as J,a9 as x,u as N,cm as Y,cn as k,co as W,ac as Z,K as M,ae as ee,af as te,C as ne,cp as K}from"./index-DDaQbjmr.js";import{s as oe,S as se}from"./search-scope-B5-OK3Cq.js";import{u as R}from"./useQueries-D1STUKB_.js";const re=[{action:"focusNext",keys:["j","k"],label:"navigate"},{action:"muteSender",keys:["m"],label:"mute"},{action:"help",keys:["?"],label:"all shortcuts"}];function xe(e){return re.filter(t=>e[t.action]!==void 0)}const ae=[{title:"Navigation",hints:[{action:"focusNext",keys:["j"],description:"Focus the message below"},{action:"focusPrevious",keys:["k"],description:"Focus the message above"},{action:"focusNext",keys:["↓"],description:"Focus the message below"},{action:"focusPrevious",keys:["↑"],description:"Focus the message above"},{action:"focusFirst",keys:["Home"],description:"Focus first"},{action:"focusLast",keys:["End"],description:"Focus last"},{action:"openFocused",keys:["Enter"],description:"Open focused thread"},{action:"back",keys:["Esc"],description:"Back / close overlay"}]},{title:"Selection",hints:[{action:"toggleSelect",keys:["x"],description:"Toggle select"},{action:"toggleSelect",keys:["Space"],description:"Toggle select"},{action:"extendSelectDown",keys:["Shift","j"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","k"],description:"Extend selection up"},{action:"extendSelectDown",keys:["Shift","↓"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","↑"],description:"Extend selection up"},{action:"selectAll",keys:["⌘","A"],description:"Select all"}]},{title:"Actions",hints:[{action:"reply",keys:["r"],description:"Reply"},{action:"replyAll",keys:["a"],description:"Reply all"},{action:"forward",keys:["f"],description:"Forward"},{action:"delete",keys:["#"],description:"Delete"},{action:"toggleStar",keys:["s"],description:"Star / unstar"},{action:"toggleRead",keys:["u"],description:"Toggle read / unread"}]},{title:"Sender",hints:[{action:"muteSender",keys:["m"],description:"Mute sender"},{action:"blockSender",keys:["b"],description:"Block sender"},{action:"vipSender",keys:["v"],description:"VIP sender"},{action:"markJunk",keys:["!"],description:"Mark junk"}]},{title:"Go to",hints:[{action:"goBrief",keys:["g","b"],description:"Daily brief"},{action:"goInbox",keys:["g","i"],description:"Inbox"},{action:"goSent",keys:["g","s"],description:"Sent"},{action:"goFlagged",keys:["g","f"],description:"Starred"},{action:"goSettings",keys:["g",","],description:"Settings"}]},{title:"View & global",hints:[{action:"toggleIntelligence",keys:["i"],description:"Toggle intelligence"},{action:"toggleDensity",keys:["d"],description:"Toggle density"},{action:"focusSearch",keys:["/"],description:"Focus search"},{action:"compose",keys:["c"],description:"Compose"},{action:"compose",keys:["⌘","N"],description:"Compose"},{action:"help",keys:["?"],description:"Shortcut help"}]}];function ie(e){for(const t of ae){const n=t.hints.find(o=>o.action===e);if(n)return n.keys}}function ce(e){const t=ie(e);return!t||t.length===0?"":t.length===1?t[0]??"":t[0]==="g"?t.join(" then "):t.join("")}function ke(e){const t=ce(e);return t===""?"":`(${t})`}function le({key:e,shiftKey:t=!1,repeat:n=!1,caretAtStart:o,hasValue:i,chipCount:r}){const a=r-1;return e==="Escape"?i?{type:"clearQuery"}:{type:"blur"}:e==="Tab"&&t?r===0?{type:"none"}:{type:"focusChip",index:a}:e==="Backspace"||e==="ArrowLeft"?!o||r===0?{type:"none"}:n?{type:"none"}:{type:"focusChip",index:a}:{type:"none"}}function ue({key:e,repeat:t=!1,index:n,chipCount:o}){return e==="Backspace"||e==="Delete"?t?{type:"none"}:{type:"removeChip",index:n}:e==="ArrowLeft"?n===0?{type:"none"}:{type:"focusChip",index:n-1}:e==="ArrowRight"?n>=o-1?{type:"focusInput"}:{type:"focusChip",index:n+1}:e==="Enter"||e===" "?{type:"activateChip",index:n}:e==="Escape"?{type:"focusInput"}:{type:"none"}}function fe(e,t){const n=t-1;return n<=0?null:e<n?e:n-1}const de=e=>e instanceof HTMLElement?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable:!1,pe=({chips:e=[],onRemoveChip:t,value:n,onChange:o,onClear:i,onClearQuery:r,placeholder:a="Search mail...",globalFocusKey:u=!0,showClearButton:p=!0,size:m="sm",inputId:f,suggest:d,className:b})=>{const D=l.useId(),F=f??D,I=l.useRef(null),P=l.useRef([]),A=r??i,[$,C]=l.useState(null),S=l.useRef(void 0),[q,O]=l.useState(""),v=e.length>0;l.useEffect(()=>{C(s=>s!==null&&s>=e.length?null:s)},[e.length]),l.useEffect(()=>{const s=S.current;if(s!==void 0){if(S.current=void 0,s===null){I.current?.focus();return}P.current[s]?.focus()}});const j=l.useRef(void 0);l.useEffect(()=>{const s=d?.caret;if(!s||s===j.current)return;j.current=s;const c=I.current;!c||c.ownerDocument.activeElement!==c||(c.setSelectionRange(s.cursor,s.cursor),d?.onCaretChange(s.cursor))});const w=s=>{d?.onCaretChange(s.selectionStart??s.value.length)},g=l.useCallback(s=>{C(s),S.current=s},[]),T=l.useCallback(s=>{const c=e[s];c&&t&&(g(fe(s,e.length)),O(`${c.label} removed`),t(c.id))},[e,t,g]),B=l.useCallback(()=>{g(null),i()},[i,g]),H=l.useCallback(s=>{const c=s.currentTarget;if(d?.onKeyDown(s))return;const y=le({key:s.key,shiftKey:s.shiftKey,repeat:s.repeat,caretAtStart:c.selectionStart===0&&c.selectionEnd===0,hasValue:n.length>0,chipCount:e.length});switch(y.type){case"focusChip":s.preventDefault(),g(y.index);return;case"clearQuery":A();return;case"blur":c.blur();return;case"none":return}},[e.length,n,A,g,d]),U=l.useCallback(s=>c=>{const y=ue({key:c.key,repeat:c.repeat,index:s,chipCount:e.length});switch(y.type!=="none"&&c.preventDefault(),y.type){case"removeChip":T(y.index);return;case"focusChip":g(y.index);return;case"focusInput":g(null);return;case"activateChip":return;case"none":return}},[e,T,g]);return l.useEffect(()=>{if(!u)return;const s=c=>{c.key!=="/"||c.metaKey||c.ctrlKey||c.altKey||de(c.target)||L("focusSearch")||(c.preventDefault(),I.current?.focus())};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[u]),h.jsxs("label",{htmlFor:F,className:E("flex w-full items-center gap-1.5 text-sm","bg-surface-sunken/50 border border-transparent","focus-within:bg-canvas focus-within:border-line focus-within:ring-2 focus-within:ring-ring","transition-colors",m==="lg"?"rounded-xl px-4 py-2":"rounded-md px-2.5 py-1",b),children:[h.jsx(V,{className:E("shrink-0 text-fg-muted pointer-events-none",m==="lg"?"size-5":"size-4")}),h.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:[v&&h.jsx("div",{role:"grid","aria-label":"Search filters",className:"flex min-w-0 flex-wrap items-center gap-1",children:e.map((s,c)=>h.jsx(_,{ref:y=>{P.current[c]=y},label:s.label,tone:s.tone,focused:$===c,onFocusLabel:()=>C(c),onKeyDown:U(c),onRemove:()=>T(c)},s.id))}),h.jsx("input",{ref:I,id:F,name:"q",type:"text","aria-label":"Search mail",autoComplete:"off",value:n,tabIndex:$===null?0:-1,onChange:s=>{o(s.target.value),w(s.target)},onKeyDown:H,onKeyUp:s=>w(s.currentTarget),onClick:s=>w(s.currentTarget),onFocus:s=>{C(null),d?.onFocusChange?.(!0),w(s.currentTarget)},onBlur:()=>d?.onFocusChange?.(!1),...d?.comboboxProps,placeholder:v?void 0:a,className:"min-w-24 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-muted"})]}),(n||v)&&p&&h.jsx("button",{type:"button",onClick:B,className:"shrink-0 rounded p-0.5 hover:bg-surface-raised transition-colors","aria-label":"Clear search",children:h.jsx(Q,{className:E("text-fg-muted",m==="lg"?"size-5":"size-4")})}),h.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:q})]})},Ie=({value:e,onChange:t,onClear:n,onClearQuery:o,chips:i,onRemoveChip:r,placeholder:a="Search mail...",globalFocusKey:u=!0,showClearButton:p=!0,size:m,inputId:f,suggest:d,className:b})=>h.jsx(pe,{value:e,onChange:t,onClear:n,onClearQuery:o,chips:i,onRemoveChip:r,placeholder:a,globalFocusKey:u,showClearButton:p,size:m,inputId:f,suggest:d,className:b});function Ce({handlers:e,enabled:t=!0,target:n,sequenceTimeoutMs:o=1e3}){const i=l.useRef(e);i.current=e;const r=l.useRef(null),a=l.useRef(null);l.useEffect(()=>{if(!t)return;const u=()=>{a.current!==null&&(clearTimeout(a.current),a.current=null)},p=f=>{const d=G({key:f.key,shiftKey:f.shiftKey,metaKey:f.metaKey,ctrlKey:f.ctrlKey,altKey:f.altKey,inEditable:X(f.target),onControl:z(f.target)},r.current);if(J().length>0){u(),r.current=null;return}if(u(),r.current=d.nextPrefix,d.nextPrefix!==null&&(a.current=setTimeout(()=>{r.current=null,a.current=null},o)),d.action===null||L(d.action)!==null)return;const b=i.current[d.action];b&&(d.preventDefault&&f.preventDefault(),b())},m=n===void 0?window:n;if(m!==null)return m.addEventListener("keydown",p),()=>{m.removeEventListener("keydown",p),u(),r.current=null}},[t,o,n])}function we(){const e=x({from:"/mail/brief/$threadId",shouldThrow:!1}),t=x({from:"/mail/brief/$threadId/$messageId",shouldThrow:!1}),n=x({from:"/mail/flagged/$threadId",shouldThrow:!1}),o=x({from:"/mail/flagged/$threadId/$messageId",shouldThrow:!1}),i=x({from:"/mail/$mailboxId/$threadId",shouldThrow:!1}),r=x({from:"/mail/$mailboxId/$threadId/$messageId",shouldThrow:!1}),a=e?.threadId??n?.threadId??i?.threadId,u=t?.messageId??o?.messageId??r?.messageId;return l.useMemo(()=>a?{threadId:a,messageId:u}:void 0,[a,u])}function Se(){const e=N(),t=Y(),{list:n,mailboxId:o}=k();return l.useCallback((i,r)=>{const a=r?.query,p={search:f=>a===void 0?f:{...f,q:a||void 0},hash:t,replace:r?.replace??!1};if(n==="flagged"){e({to:"/mail/flagged/$threadId/$messageId",params:i,...p});return}const m=r?.mailboxId??o;if(n==="mailbox"&&m){e({to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:m,...i},...p});return}e({to:"/mail/brief/$threadId/$messageId",params:i,...p})},[e,t,n,o])}function ve(){return W()}function me(){const e=N();return l.useCallback(t=>{e({to:"/mail/brief",search:{q:t||void 0}})},[e])}function Te(){const e=N();return l.useCallback((t,n)=>{e({to:"/mail/$mailboxId",params:{mailboxId:t},search:{q:n||void 0}})},[e])}const he=({accounts:e})=>{const{list:t,mailboxId:n}=k(),{t:o}=Z("mail",{useSuspense:!1}),i=l.useCallback((a,u)=>o(a,{defaultValue:u}),[o]),r=R({queries:e.map(a=>({...M({path:{accountId:a.accountId}}),staleTime:1/0}))});if(t==="outbox")return"Outbox";if(!n)return null;for(let a=0;a<e.length;a++){const u=r[a]?.data?.items;if(!u)continue;const p=u.find(f=>f.mailboxId===n);if(!p)continue;const m=ee(e[a].folderAppointments);return te(p,m.get(n),i)}return null},Ee=({accounts:e})=>{const{mailboxId:t}=k(),n=R({queries:e.map(o=>({...M({path:{accountId:o.accountId}}),staleTime:1/0}))});if(!t)return null;for(const o of n){const i=o.data?.items;if(!i)continue;const r=i.find(a=>a.mailboxId===t);if(r)return r.unseenCount}return null},Ke=({accounts:e})=>{const{mailboxId:t}=k(),n=R({queries:e.map(o=>({...M({path:{accountId:o.accountId}}),staleTime:1/0}))});if(!t)return 0;for(const o of n){const i=o.data?.items;if(!i)continue;const r=i.find(a=>a.mailboxId===t);if(r)return r.messageCount}return 0};function Ne(e){const t=me(),{searchInput:n}=ne(),o=he({accounts:e}),i=k(),r=l.useMemo(()=>oe(i,o),[i,o]),a=l.useCallback(u=>{u===se&&t(n)},[t,n]);return{scope:r,clearScope:a}}function Me(e){const t=new Map;for(const n of e){const o=n.email.toLowerCase(),i=o.split("@")[0];i&&!t.has(i)&&t.set(i,n.accountId),t.has(o)||t.set(o,n.accountId)}return t}function Re(e){const t=new Map;for(const n of e)for(const o of n){const i=o.fullPath?.toLowerCase();if(!i)continue;const r=K(o).toLowerCase();t.has(i)||t.set(i,o.mailboxId),t.has(r)||t.set(r,o.mailboxId)}return t}function Fe(e,t=[]){const n=e.flat().filter(r=>r.fullPath),o=new Map;for(const r of n){const a=K(r).toLowerCase();o.set(a,(o.get(a)??0)+1)}const i=new Map(t.map(r=>[r.accountId,r.email]));return n.map(r=>{const a=K(r),u=o.get(a.toLowerCase())===1,p=t.length>1?i.get(r.accountId):void 0;return{value:u?a:r.fullPath,label:r.displayNameOverride?.trim()||a,...p?{hint:p}:{}}})}function Pe(e){const t=new Map;for(const n of e){const o=n.email.toLowerCase().split("@")[0]??"";t.set(o,(t.get(o)??0)+1)}return e.map(n=>{const o=n.email.split("@")[0]??n.email,i=t.get(o.toLowerCase())===1,r=n.displayName?.trim();return{value:i?o:n.email,label:r||n.email,...r?{hint:n.email}:{}}})}export{ae as K,Ie as S,we as a,Re as b,Ce as c,Me as d,Se as e,ve as f,he as g,Ee as h,Ke as i,re as j,Fe as k,Pe as l,Te as m,xe as n,ce as s,ke as t,Ne as u};
1
+ import{r as l,j as h,bU as V,t as E,cg as _,X as Q,ch as L,ci as G,cj as z,ck as X,cl as J,a9 as x,u as N,cm as Y,cn as k,co as W,ac as Z,K as M,ae as ee,af as te,C as ne,cp as K}from"./index-CVyiXes6.js";import{s as oe,S as se}from"./search-scope-B5-OK3Cq.js";import{u as R}from"./useQueries-CqQkOWRS.js";const re=[{action:"focusNext",keys:["j","k"],label:"navigate"},{action:"muteSender",keys:["m"],label:"mute"},{action:"help",keys:["?"],label:"all shortcuts"}];function xe(e){return re.filter(t=>e[t.action]!==void 0)}const ae=[{title:"Navigation",hints:[{action:"focusNext",keys:["j"],description:"Focus the message below"},{action:"focusPrevious",keys:["k"],description:"Focus the message above"},{action:"focusNext",keys:["↓"],description:"Focus the message below"},{action:"focusPrevious",keys:["↑"],description:"Focus the message above"},{action:"focusFirst",keys:["Home"],description:"Focus first"},{action:"focusLast",keys:["End"],description:"Focus last"},{action:"openFocused",keys:["Enter"],description:"Open focused thread"},{action:"back",keys:["Esc"],description:"Back / close overlay"}]},{title:"Selection",hints:[{action:"toggleSelect",keys:["x"],description:"Toggle select"},{action:"toggleSelect",keys:["Space"],description:"Toggle select"},{action:"extendSelectDown",keys:["Shift","j"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","k"],description:"Extend selection up"},{action:"extendSelectDown",keys:["Shift","↓"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","↑"],description:"Extend selection up"},{action:"selectAll",keys:["⌘","A"],description:"Select all"}]},{title:"Actions",hints:[{action:"reply",keys:["r"],description:"Reply"},{action:"replyAll",keys:["a"],description:"Reply all"},{action:"forward",keys:["f"],description:"Forward"},{action:"delete",keys:["#"],description:"Delete"},{action:"toggleStar",keys:["s"],description:"Star / unstar"},{action:"toggleRead",keys:["u"],description:"Toggle read / unread"}]},{title:"Sender",hints:[{action:"muteSender",keys:["m"],description:"Mute sender"},{action:"blockSender",keys:["b"],description:"Block sender"},{action:"vipSender",keys:["v"],description:"VIP sender"},{action:"markJunk",keys:["!"],description:"Mark junk"}]},{title:"Go to",hints:[{action:"goBrief",keys:["g","b"],description:"Daily brief"},{action:"goInbox",keys:["g","i"],description:"Inbox"},{action:"goSent",keys:["g","s"],description:"Sent"},{action:"goFlagged",keys:["g","f"],description:"Starred"},{action:"goSettings",keys:["g",","],description:"Settings"}]},{title:"View & global",hints:[{action:"toggleIntelligence",keys:["i"],description:"Toggle intelligence"},{action:"toggleDensity",keys:["d"],description:"Toggle density"},{action:"focusSearch",keys:["/"],description:"Focus search"},{action:"compose",keys:["c"],description:"Compose"},{action:"compose",keys:["⌘","N"],description:"Compose"},{action:"help",keys:["?"],description:"Shortcut help"}]}];function ie(e){for(const t of ae){const n=t.hints.find(o=>o.action===e);if(n)return n.keys}}function ce(e){const t=ie(e);return!t||t.length===0?"":t.length===1?t[0]??"":t[0]==="g"?t.join(" then "):t.join("")}function ke(e){const t=ce(e);return t===""?"":`(${t})`}function le({key:e,shiftKey:t=!1,repeat:n=!1,caretAtStart:o,hasValue:i,chipCount:r}){const a=r-1;return e==="Escape"?i?{type:"clearQuery"}:{type:"blur"}:e==="Tab"&&t?r===0?{type:"none"}:{type:"focusChip",index:a}:e==="Backspace"||e==="ArrowLeft"?!o||r===0?{type:"none"}:n?{type:"none"}:{type:"focusChip",index:a}:{type:"none"}}function ue({key:e,repeat:t=!1,index:n,chipCount:o}){return e==="Backspace"||e==="Delete"?t?{type:"none"}:{type:"removeChip",index:n}:e==="ArrowLeft"?n===0?{type:"none"}:{type:"focusChip",index:n-1}:e==="ArrowRight"?n>=o-1?{type:"focusInput"}:{type:"focusChip",index:n+1}:e==="Enter"||e===" "?{type:"activateChip",index:n}:e==="Escape"?{type:"focusInput"}:{type:"none"}}function fe(e,t){const n=t-1;return n<=0?null:e<n?e:n-1}const de=e=>e instanceof HTMLElement?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable:!1,pe=({chips:e=[],onRemoveChip:t,value:n,onChange:o,onClear:i,onClearQuery:r,placeholder:a="Search mail...",globalFocusKey:u=!0,showClearButton:p=!0,size:m="sm",inputId:f,suggest:d,className:b})=>{const D=l.useId(),F=f??D,I=l.useRef(null),P=l.useRef([]),A=r??i,[$,C]=l.useState(null),S=l.useRef(void 0),[q,O]=l.useState(""),v=e.length>0;l.useEffect(()=>{C(s=>s!==null&&s>=e.length?null:s)},[e.length]),l.useEffect(()=>{const s=S.current;if(s!==void 0){if(S.current=void 0,s===null){I.current?.focus();return}P.current[s]?.focus()}});const j=l.useRef(void 0);l.useEffect(()=>{const s=d?.caret;if(!s||s===j.current)return;j.current=s;const c=I.current;!c||c.ownerDocument.activeElement!==c||(c.setSelectionRange(s.cursor,s.cursor),d?.onCaretChange(s.cursor))});const w=s=>{d?.onCaretChange(s.selectionStart??s.value.length)},g=l.useCallback(s=>{C(s),S.current=s},[]),T=l.useCallback(s=>{const c=e[s];c&&t&&(g(fe(s,e.length)),O(`${c.label} removed`),t(c.id))},[e,t,g]),B=l.useCallback(()=>{g(null),i()},[i,g]),H=l.useCallback(s=>{const c=s.currentTarget;if(d?.onKeyDown(s))return;const y=le({key:s.key,shiftKey:s.shiftKey,repeat:s.repeat,caretAtStart:c.selectionStart===0&&c.selectionEnd===0,hasValue:n.length>0,chipCount:e.length});switch(y.type){case"focusChip":s.preventDefault(),g(y.index);return;case"clearQuery":A();return;case"blur":c.blur();return;case"none":return}},[e.length,n,A,g,d]),U=l.useCallback(s=>c=>{const y=ue({key:c.key,repeat:c.repeat,index:s,chipCount:e.length});switch(y.type!=="none"&&c.preventDefault(),y.type){case"removeChip":T(y.index);return;case"focusChip":g(y.index);return;case"focusInput":g(null);return;case"activateChip":return;case"none":return}},[e,T,g]);return l.useEffect(()=>{if(!u)return;const s=c=>{c.key!=="/"||c.metaKey||c.ctrlKey||c.altKey||de(c.target)||L("focusSearch")||(c.preventDefault(),I.current?.focus())};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[u]),h.jsxs("label",{htmlFor:F,className:E("flex w-full items-center gap-1.5 text-sm","bg-surface-sunken/50 border border-transparent","focus-within:bg-canvas focus-within:border-line focus-within:ring-2 focus-within:ring-ring","transition-colors",m==="lg"?"rounded-xl px-4 py-2":"rounded-md px-2.5 py-1",b),children:[h.jsx(V,{className:E("shrink-0 text-fg-muted pointer-events-none",m==="lg"?"size-5":"size-4")}),h.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:[v&&h.jsx("div",{role:"grid","aria-label":"Search filters",className:"flex min-w-0 flex-wrap items-center gap-1",children:e.map((s,c)=>h.jsx(_,{ref:y=>{P.current[c]=y},label:s.label,tone:s.tone,focused:$===c,onFocusLabel:()=>C(c),onKeyDown:U(c),onRemove:()=>T(c)},s.id))}),h.jsx("input",{ref:I,id:F,name:"q",type:"text","aria-label":"Search mail",autoComplete:"off",value:n,tabIndex:$===null?0:-1,onChange:s=>{o(s.target.value),w(s.target)},onKeyDown:H,onKeyUp:s=>w(s.currentTarget),onClick:s=>w(s.currentTarget),onFocus:s=>{C(null),d?.onFocusChange?.(!0),w(s.currentTarget)},onBlur:()=>d?.onFocusChange?.(!1),...d?.comboboxProps,placeholder:v?void 0:a,className:"min-w-24 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-muted"})]}),(n||v)&&p&&h.jsx("button",{type:"button",onClick:B,className:"shrink-0 rounded p-0.5 hover:bg-surface-raised transition-colors","aria-label":"Clear search",children:h.jsx(Q,{className:E("text-fg-muted",m==="lg"?"size-5":"size-4")})}),h.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:q})]})},Ie=({value:e,onChange:t,onClear:n,onClearQuery:o,chips:i,onRemoveChip:r,placeholder:a="Search mail...",globalFocusKey:u=!0,showClearButton:p=!0,size:m,inputId:f,suggest:d,className:b})=>h.jsx(pe,{value:e,onChange:t,onClear:n,onClearQuery:o,chips:i,onRemoveChip:r,placeholder:a,globalFocusKey:u,showClearButton:p,size:m,inputId:f,suggest:d,className:b});function Ce({handlers:e,enabled:t=!0,target:n,sequenceTimeoutMs:o=1e3}){const i=l.useRef(e);i.current=e;const r=l.useRef(null),a=l.useRef(null);l.useEffect(()=>{if(!t)return;const u=()=>{a.current!==null&&(clearTimeout(a.current),a.current=null)},p=f=>{const d=G({key:f.key,shiftKey:f.shiftKey,metaKey:f.metaKey,ctrlKey:f.ctrlKey,altKey:f.altKey,inEditable:X(f.target),onControl:z(f.target)},r.current);if(J().length>0){u(),r.current=null;return}if(u(),r.current=d.nextPrefix,d.nextPrefix!==null&&(a.current=setTimeout(()=>{r.current=null,a.current=null},o)),d.action===null||L(d.action)!==null)return;const b=i.current[d.action];b&&(d.preventDefault&&f.preventDefault(),b())},m=n===void 0?window:n;if(m!==null)return m.addEventListener("keydown",p),()=>{m.removeEventListener("keydown",p),u(),r.current=null}},[t,o,n])}function we(){const e=x({from:"/mail/brief/$threadId",shouldThrow:!1}),t=x({from:"/mail/brief/$threadId/$messageId",shouldThrow:!1}),n=x({from:"/mail/flagged/$threadId",shouldThrow:!1}),o=x({from:"/mail/flagged/$threadId/$messageId",shouldThrow:!1}),i=x({from:"/mail/$mailboxId/$threadId",shouldThrow:!1}),r=x({from:"/mail/$mailboxId/$threadId/$messageId",shouldThrow:!1}),a=e?.threadId??n?.threadId??i?.threadId,u=t?.messageId??o?.messageId??r?.messageId;return l.useMemo(()=>a?{threadId:a,messageId:u}:void 0,[a,u])}function Se(){const e=N(),t=Y(),{list:n,mailboxId:o}=k();return l.useCallback((i,r)=>{const a=r?.query,p={search:f=>a===void 0?f:{...f,q:a||void 0},hash:t,replace:r?.replace??!1};if(n==="flagged"){e({to:"/mail/flagged/$threadId/$messageId",params:i,...p});return}const m=r?.mailboxId??o;if(n==="mailbox"&&m){e({to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:m,...i},...p});return}e({to:"/mail/brief/$threadId/$messageId",params:i,...p})},[e,t,n,o])}function ve(){return W()}function me(){const e=N();return l.useCallback(t=>{e({to:"/mail/brief",search:{q:t||void 0}})},[e])}function Te(){const e=N();return l.useCallback((t,n)=>{e({to:"/mail/$mailboxId",params:{mailboxId:t},search:{q:n||void 0}})},[e])}const he=({accounts:e})=>{const{list:t,mailboxId:n}=k(),{t:o}=Z("mail",{useSuspense:!1}),i=l.useCallback((a,u)=>o(a,{defaultValue:u}),[o]),r=R({queries:e.map(a=>({...M({path:{accountId:a.accountId}}),staleTime:1/0}))});if(t==="outbox")return"Outbox";if(!n)return null;for(let a=0;a<e.length;a++){const u=r[a]?.data?.items;if(!u)continue;const p=u.find(f=>f.mailboxId===n);if(!p)continue;const m=ee(e[a].folderAppointments);return te(p,m.get(n),i)}return null},Ee=({accounts:e})=>{const{mailboxId:t}=k(),n=R({queries:e.map(o=>({...M({path:{accountId:o.accountId}}),staleTime:1/0}))});if(!t)return null;for(const o of n){const i=o.data?.items;if(!i)continue;const r=i.find(a=>a.mailboxId===t);if(r)return r.unseenCount}return null},Ke=({accounts:e})=>{const{mailboxId:t}=k(),n=R({queries:e.map(o=>({...M({path:{accountId:o.accountId}}),staleTime:1/0}))});if(!t)return 0;for(const o of n){const i=o.data?.items;if(!i)continue;const r=i.find(a=>a.mailboxId===t);if(r)return r.messageCount}return 0};function Ne(e){const t=me(),{searchInput:n}=ne(),o=he({accounts:e}),i=k(),r=l.useMemo(()=>oe(i,o),[i,o]),a=l.useCallback(u=>{u===se&&t(n)},[t,n]);return{scope:r,clearScope:a}}function Me(e){const t=new Map;for(const n of e){const o=n.email.toLowerCase(),i=o.split("@")[0];i&&!t.has(i)&&t.set(i,n.accountId),t.has(o)||t.set(o,n.accountId)}return t}function Re(e){const t=new Map;for(const n of e)for(const o of n){const i=o.fullPath?.toLowerCase();if(!i)continue;const r=K(o).toLowerCase();t.has(i)||t.set(i,o.mailboxId),t.has(r)||t.set(r,o.mailboxId)}return t}function Fe(e,t=[]){const n=e.flat().filter(r=>r.fullPath),o=new Map;for(const r of n){const a=K(r).toLowerCase();o.set(a,(o.get(a)??0)+1)}const i=new Map(t.map(r=>[r.accountId,r.email]));return n.map(r=>{const a=K(r),u=o.get(a.toLowerCase())===1,p=t.length>1?i.get(r.accountId):void 0;return{value:u?a:r.fullPath,label:r.displayNameOverride?.trim()||a,...p?{hint:p}:{}}})}function Pe(e){const t=new Map;for(const n of e){const o=n.email.toLowerCase().split("@")[0]??"";t.set(o,(t.get(o)??0)+1)}return e.map(n=>{const o=n.email.split("@")[0]??n.email,i=t.get(o.toLowerCase())===1,r=n.displayName?.trim();return{value:i?o:n.email,label:r||n.email,...r?{hint:n.email}:{}}})}export{ae as K,Ie as S,we as a,Re as b,Ce as c,Me as d,Se as e,ve as f,he as g,Ee as h,Ke as i,re as j,Fe as k,Pe as l,Te as m,xe as n,ce as s,ke as t,Ne as u};
@@ -1 +1 @@
1
- import{u as e,r as s}from"./index-DDaQbjmr.js";const a={brief:"/mail/brief",flagged:"/mail/flagged",outbox:"/mail/outbox",settings:"/settings",accounts:"/settings/accounts",importConfig:"/import"};function c(){const t=e();return s.useCallback(o=>{t({to:a[o]})},[t])}function i(){const t=e();return s.useCallback(o=>{t({to:"/settings/accounts",search:{editAccountId:o,focusSmtp:!0}})},[t])}export{i as a,c as u};
1
+ import{u as e,r as s}from"./index-CVyiXes6.js";const a={brief:"/mail/brief",flagged:"/mail/flagged",outbox:"/mail/outbox",settings:"/settings",accounts:"/settings/accounts",importConfig:"/import"};function c(){const t=e();return s.useCallback(o=>{t({to:a[o]})},[t])}function i(){const t=e();return s.useCallback(o=>{t({to:"/settings/accounts",search:{editAccountId:o,focusSmtp:!0}})},[t])}export{i as a,c as u};
@@ -1 +1 @@
1
- import{j as e,t as S,h as I,r as c,bR as A,c as C,i as k,bS as P,bT as T,f as N,X as L,u as O,aP as R,az as $,bU as q,aR as M,bV as D,bW as G,Z as Q}from"./index-DDaQbjmr.js";import{K as f}from"./kbd-nBPX_mdB.js";import{a as E,S as K}from"./settings-screen-Qy0Wa0pr.js";import{E as V}from"./ErrorState-zb46wwqB.js";import{u as _}from"./useDebouncedValue-Dy_g2v71.js";import{s as B}from"./help-copy-Cv-E-JTH.js";import"./avatar-BU2Acypp.js";import"./chevron-left-BmceVyuQ.js";import"./menu-DziguOgy.js";import"./circle-help-CVsjKp3b.js";function F({options:t,active:r,onSelect:m}){return e.jsx("div",{role:"tablist",className:S("flex shrink-0 gap-1 overflow-x-auto border-b border-line p-2","lg:w-44 lg:flex-col lg:gap-0 lg:overflow-visible lg:border-r lg:border-b-0 lg:py-2 lg:pr-2 lg:pl-3"),children:t.map(n=>{const d=n.id===r;return e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>m(n.id),className:S("flex min-h-11 shrink-0 items-center gap-2 rounded-md px-3 text-left text-sm transition-colors lg:min-h-0 lg:px-2 lg:py-1",d?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface-sunken hover:text-fg"),children:[e.jsx("span",{className:"flex-1 truncate",children:n.label}),e.jsx("span",{className:S("text-2xs tabular-nums",d?"text-accent-2":"text-fg-subtle"),children:n.count??"—"})]},n.id)})})}const v={vip:"VIPs",muted:"Muted",blocked:"Blocked"};function H({query:t,onCount:r}){const{data:m,isPending:n,isError:d,error:b}=C(D()),g=I(),i=k({...P(),onSettled:()=>{g.invalidateQueries({queryKey:G()})}}),l=m?.suggestions??[],p=t.trim().toLowerCase(),u=p?l.filter(a=>(a.displayName??"").toLowerCase().includes(p)||a.normalizedEmail.toLowerCase().includes(p)):l;return c.useEffect(()=>{r?.(u.length,l.length)},[r,u.length,l.length]),n?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Loading VIP suggestions…"}):d?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Couldn't load VIP suggestions",error:b})}):l.length===0?e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIP suggestions yet. As you reply to senders, they'll appear here. Press ",e.jsx(f,{children:"v"})," on any message to promote a sender to VIP."]}):u.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIPs match “",t,"”."]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-row-inset py-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Suggested — promote to VIP"}),u.map(a=>e.jsx(E,{name:a.displayName??a.normalizedEmail,email:a.normalizedEmail,meta:a.replyCount>0?`${a.inboundCount} received · you replied ${a.replyCount}×`:`${a.inboundCount} received · you've never replied`,trailing:e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(Q,{className:"size-3.5"}),"aria-busy":i.isPending,onClick:()=>{i.isPending||i.mutate({path:{addressId:a.addressId},body:{flags:{vip:{value:!0,setAt:Date.now(),setBy:"user"}}}})},children:"Add VIP"})},a.addressId))]})}function U({group:t,query:r,onCount:m}){const n=_(r.trim(),300),d=I(),[b,g]=c.useState(null),i=n.length>=2,l=A({query:{q:n,limit:50}}),{data:p,isPending:u,isError:a,error:j}=C({...l,enabled:i}),x=k({...P(),onSuccess:()=>{d.invalidateQueries({queryKey:l.queryKey})}}),h=(p?.items??[]).filter(s=>t==="muted"?s.flags?.muted?.value??!1:s.flags?.blocked?.value??!1);return c.useEffect(()=>{m?.(i?h.length:0,null)},[m,i,h.length]),i?u?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Searching…"}):a?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Search failed",error:j})}):h.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No ",v[t].toLowerCase()," senders matching “",n,"”."]}):e.jsx(e.Fragment,{children:h.map(s=>{const o=t==="muted"?s.flags?.muted:s.flags?.blocked,y=o?[`${t}`,o.setAt&&T(o.setAt,{month:"short",year:"numeric"})||null,o.reason?`— ${o.reason}`:null].filter(Boolean).join(" "):t,w=x.isPending&&x.variables?.path.addressId===s.addressId,z=x.isError&&b===s.addressId;return e.jsx(E,{name:s.displayName??s.normalizedEmail,email:s.normalizedEmail,danger:t==="blocked",meta:y,trailing:z?e.jsx(N,{variant:"secondary",size:"sm",onClick:()=>{g(s.addressId),x.mutate({path:{addressId:s.addressId},body:{flags:{[t]:{value:!1,setAt:Date.now()}}}})},children:"Retry"}):e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(L,{className:"size-3.5"}),"aria-busy":w,"aria-label":`Remove ${t} flag`,onClick:()=>{w||(g(s.addressId),x.mutate({path:{addressId:s.addressId},body:{flags:{[t]:{value:!1,setAt:Date.now()}}}}))}})},s.addressId)})}):e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle space-y-2",children:[e.jsxs("p",{children:["Type 2+ characters to search ",v[t].toLowerCase()," ","senders by name or address."]}),e.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Note: a dedicated flagged-address list endpoint is in the backlog. Press ",e.jsx(f,{children:"m"})," on any message to mute its sender; ",e.jsx(f,{children:"b"})," to block."]})]})}function re(){const t=O(),[r,m]=c.useState("vip"),[n,d]=c.useState(""),[b,g]=c.useState(!0),[i,l]=c.useState(0),[p,u]=c.useState({vip:0,muted:null,blocked:null}),a=c.useCallback((s,o)=>{l(s),u(y=>({...y,vip:o}))},[]),j=c.useCallback((s,o)=>{l(s),u(y=>({...y,[r]:s}))},[r]),x=p[r],h=s=>{const o=M[s];o&&t({to:o})};return e.jsx(K,{items:R,activeId:"senders",title:"Senders & Rules",description:"Per-sender preferences — set with one key from any message, managed here.",flush:!0,help:B,helpOpen:b,onToggleHelp:()=>g(s=>!s),onSelect:h,onBackToMail:()=>{t({to:"/mail"})},children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col lg:flex-row",children:[e.jsx(F,{active:r,onSelect:s=>{m(s),d("")},options:["vip","muted","blocked"].map(s=>({id:s,label:v[s],count:p[s]}))}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("div",{className:"border-b border-line px-row-inset py-2",children:e.jsx($,{icon:e.jsx(q,{className:"size-4"}),placeholder:`Filter ${v[r].toLowerCase()} by name or address`,className:"h-8 max-w-sm",value:n,onChange:s=>d(s.target.value)})}),e.jsx("div",{className:"min-h-0 flex-1 divide-y divide-line overflow-y-auto",children:r==="vip"?e.jsx(H,{query:n,onCount:a}):e.jsx(U,{group:r,query:n,onCount:j})}),e.jsxs("footer",{className:"flex items-center justify-between border-t border-line px-row-inset py-1 text-2xs text-fg-subtle",children:[e.jsx("span",{children:x!=null?`${i} of ${x} flagged senders`:`${i} flagged senders`}),e.jsxs("span",{children:[e.jsx(f,{children:"j"})," ",e.jsx(f,{children:"k"})," navigate · ",e.jsx(f,{children:"⌫"})," remove flag"]})]})]})]})})}export{U as SearchGroupPane,re as component};
1
+ import{j as e,t as S,h as I,r as c,bR as A,c as C,i as k,bS as P,bT as T,f as N,X as L,u as O,aP as R,az as $,bU as q,aR as M,bV as D,bW as G,Z as Q}from"./index-CVyiXes6.js";import{K as f}from"./kbd-BAzd-ZzK.js";import{a as E,S as K}from"./settings-screen-DvNcGJK6.js";import{E as V}from"./ErrorState-C9wNWNx-.js";import{u as _}from"./useDebouncedValue-3uXEWBzO.js";import{s as B}from"./help-copy-yEiBqFt2.js";import"./avatar-BG16DP0I.js";import"./chevron-left-B_-IAj1P.js";import"./menu-Diz2jlXK.js";import"./circle-help-xoO8qyO7.js";function F({options:t,active:r,onSelect:m}){return e.jsx("div",{role:"tablist",className:S("flex shrink-0 gap-1 overflow-x-auto border-b border-line p-2","lg:w-44 lg:flex-col lg:gap-0 lg:overflow-visible lg:border-r lg:border-b-0 lg:py-2 lg:pr-2 lg:pl-3"),children:t.map(n=>{const d=n.id===r;return e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>m(n.id),className:S("flex min-h-11 shrink-0 items-center gap-2 rounded-md px-3 text-left text-sm transition-colors lg:min-h-0 lg:px-2 lg:py-1",d?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface-sunken hover:text-fg"),children:[e.jsx("span",{className:"flex-1 truncate",children:n.label}),e.jsx("span",{className:S("text-2xs tabular-nums",d?"text-accent-2":"text-fg-subtle"),children:n.count??"—"})]},n.id)})})}const v={vip:"VIPs",muted:"Muted",blocked:"Blocked"};function H({query:t,onCount:r}){const{data:m,isPending:n,isError:d,error:b}=C(D()),g=I(),i=k({...P(),onSettled:()=>{g.invalidateQueries({queryKey:G()})}}),l=m?.suggestions??[],p=t.trim().toLowerCase(),u=p?l.filter(a=>(a.displayName??"").toLowerCase().includes(p)||a.normalizedEmail.toLowerCase().includes(p)):l;return c.useEffect(()=>{r?.(u.length,l.length)},[r,u.length,l.length]),n?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Loading VIP suggestions…"}):d?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Couldn't load VIP suggestions",error:b})}):l.length===0?e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIP suggestions yet. As you reply to senders, they'll appear here. Press ",e.jsx(f,{children:"v"})," on any message to promote a sender to VIP."]}):u.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIPs match “",t,"”."]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-row-inset py-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Suggested — promote to VIP"}),u.map(a=>e.jsx(E,{name:a.displayName??a.normalizedEmail,email:a.normalizedEmail,meta:a.replyCount>0?`${a.inboundCount} received · you replied ${a.replyCount}×`:`${a.inboundCount} received · you've never replied`,trailing:e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(Q,{className:"size-3.5"}),"aria-busy":i.isPending,onClick:()=>{i.isPending||i.mutate({path:{addressId:a.addressId},body:{flags:{vip:{value:!0,setAt:Date.now(),setBy:"user"}}}})},children:"Add VIP"})},a.addressId))]})}function U({group:t,query:r,onCount:m}){const n=_(r.trim(),300),d=I(),[b,g]=c.useState(null),i=n.length>=2,l=A({query:{q:n,limit:50}}),{data:p,isPending:u,isError:a,error:j}=C({...l,enabled:i}),x=k({...P(),onSuccess:()=>{d.invalidateQueries({queryKey:l.queryKey})}}),h=(p?.items??[]).filter(s=>t==="muted"?s.flags?.muted?.value??!1:s.flags?.blocked?.value??!1);return c.useEffect(()=>{m?.(i?h.length:0,null)},[m,i,h.length]),i?u?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Searching…"}):a?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Search failed",error:j})}):h.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No ",v[t].toLowerCase()," senders matching “",n,"”."]}):e.jsx(e.Fragment,{children:h.map(s=>{const o=t==="muted"?s.flags?.muted:s.flags?.blocked,y=o?[`${t}`,o.setAt&&T(o.setAt,{month:"short",year:"numeric"})||null,o.reason?`— ${o.reason}`:null].filter(Boolean).join(" "):t,w=x.isPending&&x.variables?.path.addressId===s.addressId,z=x.isError&&b===s.addressId;return e.jsx(E,{name:s.displayName??s.normalizedEmail,email:s.normalizedEmail,danger:t==="blocked",meta:y,trailing:z?e.jsx(N,{variant:"secondary",size:"sm",onClick:()=>{g(s.addressId),x.mutate({path:{addressId:s.addressId},body:{flags:{[t]:{value:!1,setAt:Date.now()}}}})},children:"Retry"}):e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(L,{className:"size-3.5"}),"aria-busy":w,"aria-label":`Remove ${t} flag`,onClick:()=>{w||(g(s.addressId),x.mutate({path:{addressId:s.addressId},body:{flags:{[t]:{value:!1,setAt:Date.now()}}}}))}})},s.addressId)})}):e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle space-y-2",children:[e.jsxs("p",{children:["Type 2+ characters to search ",v[t].toLowerCase()," ","senders by name or address."]}),e.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Note: a dedicated flagged-address list endpoint is in the backlog. Press ",e.jsx(f,{children:"m"})," on any message to mute its sender; ",e.jsx(f,{children:"b"})," to block."]})]})}function re(){const t=O(),[r,m]=c.useState("vip"),[n,d]=c.useState(""),[b,g]=c.useState(!0),[i,l]=c.useState(0),[p,u]=c.useState({vip:0,muted:null,blocked:null}),a=c.useCallback((s,o)=>{l(s),u(y=>({...y,vip:o}))},[]),j=c.useCallback((s,o)=>{l(s),u(y=>({...y,[r]:s}))},[r]),x=p[r],h=s=>{const o=M[s];o&&t({to:o})};return e.jsx(K,{items:R,activeId:"senders",title:"Senders & Rules",description:"Per-sender preferences — set with one key from any message, managed here.",flush:!0,help:B,helpOpen:b,onToggleHelp:()=>g(s=>!s),onSelect:h,onBackToMail:()=>{t({to:"/mail"})},children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col lg:flex-row",children:[e.jsx(F,{active:r,onSelect:s=>{m(s),d("")},options:["vip","muted","blocked"].map(s=>({id:s,label:v[s],count:p[s]}))}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("div",{className:"border-b border-line px-row-inset py-2",children:e.jsx($,{icon:e.jsx(q,{className:"size-4"}),placeholder:`Filter ${v[r].toLowerCase()} by name or address`,className:"h-8 max-w-sm",value:n,onChange:s=>d(s.target.value)})}),e.jsx("div",{className:"min-h-0 flex-1 divide-y divide-line overflow-y-auto",children:r==="vip"?e.jsx(H,{query:n,onCount:a}):e.jsx(U,{group:r,query:n,onCount:j})}),e.jsxs("footer",{className:"flex items-center justify-between border-t border-line px-row-inset py-1 text-2xs text-fg-subtle",children:[e.jsx("span",{children:x!=null?`${i} of ${x} flagged senders`:`${i} flagged senders`}),e.jsxs("span",{children:[e.jsx(f,{children:"j"})," ",e.jsx(f,{children:"k"})," navigate · ",e.jsx(f,{children:"⌫"})," remove flag"]})]})]})]})})}export{U as SearchGroupPane,re as component};
@@ -0,0 +1 @@
1
+ import{j as t,O as o}from"./index-CVyiXes6.js";const n=()=>t.jsx(o,{});export{n as component};
@@ -1 +1 @@
1
- import{r as j,j as e,t as f,f as i,X as N,g as z}from"./index-DDaQbjmr.js";import{A as w}from"./avatar-BU2Acypp.js";import{C as h}from"./chevron-left-BmceVyuQ.js";import{M as S}from"./menu-DziguOgy.js";import{C as v}from"./circle-help-CVsjKp3b.js";function R({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),[b,C]=j.useState(!1),p=!!s&&d,g=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 pt-3 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Settings"}),e.jsx("nav",{className:"flex-1 overflow-y-auto px-2 py-1",children:l.map(a=>e.jsxs("button",{type:"button",onClick:()=>{k?.(a.id),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":b}),s&&!p&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(v,{className:"size-4"}),className:"hidden ml-auto lg:inline-flex",onClick:u,"aria-label":"Show tips"})]}),s&&b&&e.jsx("div",{className:"border-b border-line bg-surface-sunken px-row-inset py-3 text-xs leading-relaxed text-fg-muted lg:hidden",children:s}),o?e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:r}):e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx("div",{className:"max-w-2xl px-3 py-5 lg:px-5",children:e.jsx("div",{className:"space-y-5",children:r})})})]}),p&&e.jsxs("aside",{className:"hidden w-64 shrink-0 flex-col border-l border-line bg-surface-sunken lg:flex",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-row-inset",children:[e.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Tips & tricks"}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-3.5"}),onClick:u,"aria-label":"Collapse tips"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-row-inset py-3 text-xs leading-relaxed text-fg-muted",children:s})]})]})}function L({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 O={healthy:{tone:"positive",label:"healthy"},error:{tone:"danger",label:"error"},muted:{tone:"neutral",label:"muted"}};function X({label:l,email:t,connector:x,syncLabel:n,state:r,errorDetail:s,trailing:d}){const o=O[r];return e.jsxs("div",{className:f("rounded-sm border border-line bg-surface",r==="muted"&&"opacity-65"),children:[e.jsxs("div",{className:"flex flex-col gap-3 px-row-inset py-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx(w,{name:l,email:t,size:"md"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-fg",children:l}),e.jsx(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{X as A,R as S,L as a};
1
+ import{r as j,j as e,t as f,f as i,X as N,g as z}from"./index-CVyiXes6.js";import{A as w}from"./avatar-BG16DP0I.js";import{C as h}from"./chevron-left-B_-IAj1P.js";import{M as S}from"./menu-Diz2jlXK.js";import{C as v}from"./circle-help-xoO8qyO7.js";function R({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),[b,C]=j.useState(!1),p=!!s&&d,g=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 pt-3 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Settings"}),e.jsx("nav",{className:"flex-1 overflow-y-auto px-2 py-1",children:l.map(a=>e.jsxs("button",{type:"button",onClick:()=>{k?.(a.id),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":b}),s&&!p&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(v,{className:"size-4"}),className:"hidden ml-auto lg:inline-flex",onClick:u,"aria-label":"Show tips"})]}),s&&b&&e.jsx("div",{className:"border-b border-line bg-surface-sunken px-row-inset py-3 text-xs leading-relaxed text-fg-muted lg:hidden",children:s}),o?e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:r}):e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx("div",{className:"max-w-2xl px-3 py-5 lg:px-5",children:e.jsx("div",{className:"space-y-5",children:r})})})]}),p&&e.jsxs("aside",{className:"hidden w-64 shrink-0 flex-col border-l border-line bg-surface-sunken lg:flex",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-row-inset",children:[e.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Tips & tricks"}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-3.5"}),onClick:u,"aria-label":"Collapse tips"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-row-inset py-3 text-xs leading-relaxed text-fg-muted",children:s})]})]})}function L({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 O={healthy:{tone:"positive",label:"healthy"},error:{tone:"danger",label:"error"},muted:{tone:"neutral",label:"muted"}};function X({label:l,email:t,connector:x,syncLabel:n,state:r,errorDetail:s,trailing:d}){const o=O[r];return e.jsxs("div",{className:f("rounded-sm border border-line bg-surface",r==="muted"&&"opacity-65"),children:[e.jsxs("div",{className:"flex flex-col gap-3 px-row-inset py-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx(w,{name:l,email:t,size:"md"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-fg",children:l}),e.jsx(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{X as A,R as S,L as a};
@@ -1 +1 @@
1
- import{e}from"./index-DDaQbjmr.js";const d=e("CloudOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193",key:"yfwify"}],["path",{d:"M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07",key:"jlfiyv"}]]);const h=e("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);export{d as C,h as S};
1
+ import{e}from"./index-CVyiXes6.js";const d=e("CloudOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193",key:"yfwify"}],["path",{d:"M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07",key:"jlfiyv"}]]);const h=e("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);export{d as C,h as S};
@@ -1 +1 @@
1
- import{j as t,an as e}from"./index-DDaQbjmr.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
1
+ import{j as t,an as e}from"./index-CVyiXes6.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
@@ -1 +1 @@
1
- import{r as m,j as c}from"./index-DDaQbjmr.js";import{y as b,C as D,j as x,s as w}from"./calendar-suggestion-BrsagLDp.js";import{e as C,p as T,a as j,E as v,u as A,C as k}from"./CalendarComposePane-CaFfehJ3.js";import{E as N}from"./EmptyState-DffMrivH.js";import{e as F,h as O,u as R,d as E,f as Z,U as L}from"./useCalendars-NXobBPn1.js";import{c as P}from"./calendar-report-De_YSbMS.js";import{M as U,n as H}from"./calendar-format-t5pknBPH.js";import"./ErrorState-zb46wwqB.js";import"./calendar-clash-strip-CuPoAcuA.js";import"./useQueries-D1STUKB_.js";function z(e,t,d){const n={title:e.summary,location:e.location};if(e.allDay){const o=e.dtStart.slice(0,10),i=e.dtEnd.slice(0,10);return{...C(o,t),...n,allDay:!0,startTime:"",endDate:i>o?F(i,-1):o,endTime:""}}const a=o=>e.zoneCertainty==="Ambiguous"?o:O(o,d),s=a(e.dtStart),l=a(e.dtEnd);return{...C(s.slice(0,10),t),...n,startTime:s.slice(11,16),endDate:l.slice(0,10),endTime:l.slice(11,16)}}function B(e,t,d,n){const a=T(t,d,n);if(!a.ok)return a;const l=e.zoneCertainty==="Ambiguous"||a.patch.start!==void 0?{...a.patch,...j(d,n.clock),allDay:d.allDay,timeZone:n.anchor}:a.patch;return{ok:!0,input:{calendarId:d.calendarId,event:l}}}const g="Add from mail",M="The invitation named a time zone nothing could resolve. The time below is as the mail wrote it — check it before adding.";function _({suggestionId:e,onClose:t}){const{suggestion:d,isLoading:n,error:a}=b(e),s=d??void 0,[l,o]=m.useState(void 0);s!==void 0&&l===void 0&&o(s);const i=l??s;if(i!==void 0)return c.jsx($,{suggestion:i,onClose:t},i.suggestionId);if(a!==null){const u="Couldn't read what your mail is waiting on.";return c.jsx(v,{title:g,onClose:t,children:c.jsx(D,{text:`${u} Close this and try again.`,reportHref:P(u),className:"m-row-inset"})})}return c.jsx(v,{title:g,onClose:t,children:c.jsx(N,{message:n?"Reading the suggestion…":"This suggestion is no longer waiting on you. It was answered, or a later message replaced it."})})}function $({suggestion:e,onClose:t}){const{calendars:d,defaultCalendarId:n,timeZoneByCalendarId:a}=R(),s=d.filter(r=>!r.readOnly),l=x(),[o]=m.useState(()=>z(e,"",E())),[i,u]=m.useState(o),[y,f]=m.useState(""),S=A(i),p=s.some(r=>r.id===n)?n:s[0]?.id??"";m.useEffect(()=>{p!==""&&u(r=>r.calendarId===""?{...r,calendarId:p}:r)},[p]);const I=()=>{const r=B(e,o,i,{clock:E(),anchor:Z(a[i.calendarId]??L)});if(!r.ok){f(r.problem);return}f(""),l.acceptEdited(e.suggestionId,r.input).then(h=>{if(h.kind==="answered"){t();return}f(`Couldn't add this to your calendar: ${h.message}`)})};return c.jsx(k,{title:g,subtitle:w(e),notice:e.zoneCertainty==="Ambiguous"?M:"",calendars:s,draft:i,onChange:u,problem:y,saveLabel:"Add",isSaving:l.isAnswering,repeatEditable:!1,clashes:S,onSave:I,onCancel:t})}function te(){const e=U(),{closeEvent:t}=H();return e===void 0?null:c.jsx(_,{suggestionId:e,onClose:t})}export{te as component};
1
+ import{r as m,j as c}from"./index-CVyiXes6.js";import{y as b,C as D,j as x,s as w}from"./calendar-suggestion-BOcnceiU.js";import{e as C,p as T,a as j,E as v,u as A,C as k}from"./CalendarComposePane-DJNhu2LK.js";import{E as N}from"./EmptyState-5AzHvbUg.js";import{e as F,h as O,u as R,d as E,f as Z,U as L}from"./useCalendars-CzwJUnpW.js";import{c as P}from"./calendar-report-cFSv6gSl.js";import{M as U,n as H}from"./calendar-format-Df04vYeX.js";import"./ErrorState-C9wNWNx-.js";import"./calendar-clash-strip-BFeaJEFd.js";import"./useQueries-CqQkOWRS.js";function z(e,t,d){const n={title:e.summary,location:e.location};if(e.allDay){const o=e.dtStart.slice(0,10),i=e.dtEnd.slice(0,10);return{...C(o,t),...n,allDay:!0,startTime:"",endDate:i>o?F(i,-1):o,endTime:""}}const a=o=>e.zoneCertainty==="Ambiguous"?o:O(o,d),s=a(e.dtStart),l=a(e.dtEnd);return{...C(s.slice(0,10),t),...n,startTime:s.slice(11,16),endDate:l.slice(0,10),endTime:l.slice(11,16)}}function B(e,t,d,n){const a=T(t,d,n);if(!a.ok)return a;const l=e.zoneCertainty==="Ambiguous"||a.patch.start!==void 0?{...a.patch,...j(d,n.clock),allDay:d.allDay,timeZone:n.anchor}:a.patch;return{ok:!0,input:{calendarId:d.calendarId,event:l}}}const g="Add from mail",M="The invitation named a time zone nothing could resolve. The time below is as the mail wrote it — check it before adding.";function _({suggestionId:e,onClose:t}){const{suggestion:d,isLoading:n,error:a}=b(e),s=d??void 0,[l,o]=m.useState(void 0);s!==void 0&&l===void 0&&o(s);const i=l??s;if(i!==void 0)return c.jsx($,{suggestion:i,onClose:t},i.suggestionId);if(a!==null){const u="Couldn't read what your mail is waiting on.";return c.jsx(v,{title:g,onClose:t,children:c.jsx(D,{text:`${u} Close this and try again.`,reportHref:P(u),className:"m-row-inset"})})}return c.jsx(v,{title:g,onClose:t,children:c.jsx(N,{message:n?"Reading the suggestion…":"This suggestion is no longer waiting on you. It was answered, or a later message replaced it."})})}function $({suggestion:e,onClose:t}){const{calendars:d,defaultCalendarId:n,timeZoneByCalendarId:a}=R(),s=d.filter(r=>!r.readOnly),l=x(),[o]=m.useState(()=>z(e,"",E())),[i,u]=m.useState(o),[y,f]=m.useState(""),S=A(i),p=s.some(r=>r.id===n)?n:s[0]?.id??"";m.useEffect(()=>{p!==""&&u(r=>r.calendarId===""?{...r,calendarId:p}:r)},[p]);const I=()=>{const r=B(e,o,i,{clock:E(),anchor:Z(a[i.calendarId]??L)});if(!r.ok){f(r.problem);return}f(""),l.acceptEdited(e.suggestionId,r.input).then(h=>{if(h.kind==="answered"){t();return}f(`Couldn't add this to your calendar: ${h.message}`)})};return c.jsx(k,{title:g,subtitle:w(e),notice:e.zoneCertainty==="Ambiguous"?M:"",calendars:s,draft:i,onChange:u,problem:y,saveLabel:"Add",isSaving:l.isAnswering,repeatEditable:!1,clashes:S,onSave:I,onCancel:t})}function te(){const e=U(),{closeEvent:t}=H();return e===void 0?null:c.jsx(_,{suggestionId:e,onClose:t})}export{te as component};
@@ -1 +1 @@
1
- import{e as a}from"./index-DDaQbjmr.js";const o=a("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);export{o as U};
1
+ import{e as a}from"./index-CVyiXes6.js";const o=a("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);export{o as U};
@@ -1 +1 @@
1
- import{r as m}from"./index-DDaQbjmr.js";import{u as C,d as g,i as I,t as v,U as p,b as D,r as E}from"./useCalendars-NXobBPn1.js";import{x as y,I as L}from"./calendar-format-t5pknBPH.js";function Z(a,n){const t=a.map(e=>e.id);if(n.length===0)return t;const s=new Set(n),o=t.filter(e=>s.has(e));return o.length===0?t:o}function b(a){const{calendars:n,colorByCalendarId:t,timeZoneByCalendarId:s,isLoading:o}=C(),e=Z(n,a),r=e.length===n.length?[]:e,c=a.length===0||n.length>0;return{calendars:n,colorByCalendarId:t,timeZoneByCalendarId:s,shown:e,narrowed:r,resolved:c,isLoading:o}}function x(a,n,t){const s=t.join(",");return m.useMemo(()=>{const o=g(),e=new Set(s===""?[]:s.split(","));return a.filter(r=>I(r)&&e.has(r.calendarId)).map(r=>v(r,n[r.calendarId]??p,o))},[a,n,s])}function S({view:a,date:n,calendarIds:t,enabled:s=!0}){const{calendars:o,colorByCalendarId:e,timeZoneByCalendarId:r,shown:c,narrowed:l,resolved:u,isLoading:w}=b(t),h=D(a,n),i=s&&u,d=y({...h,calendarIds:l,enabled:i});L(a,n,l,i);const f=x(d.instances,r,c);return{calendars:o,events:f,colorByCalendarId:e,timeZoneByCalendarId:r,isLoading:w||d.isLoading,error:d.error,retry:d.refetch,instanceOf:E}}export{x as a,S as b,b as u};
1
+ import{r as m}from"./index-CVyiXes6.js";import{u as C,d as g,i as I,t as v,U as p,b as D,r as E}from"./useCalendars-CzwJUnpW.js";import{x as y,I as L}from"./calendar-format-Df04vYeX.js";function Z(a,n){const t=a.map(e=>e.id);if(n.length===0)return t;const s=new Set(n),o=t.filter(e=>s.has(e));return o.length===0?t:o}function b(a){const{calendars:n,colorByCalendarId:t,timeZoneByCalendarId:s,isLoading:o}=C(),e=Z(n,a),r=e.length===n.length?[]:e,c=a.length===0||n.length>0;return{calendars:n,colorByCalendarId:t,timeZoneByCalendarId:s,shown:e,narrowed:r,resolved:c,isLoading:o}}function x(a,n,t){const s=t.join(",");return m.useMemo(()=>{const o=g(),e=new Set(s===""?[]:s.split(","));return a.filter(r=>I(r)&&e.has(r.calendarId)).map(r=>v(r,n[r.calendarId]??p,o))},[a,n,s])}function S({view:a,date:n,calendarIds:t,enabled:s=!0}){const{calendars:o,colorByCalendarId:e,timeZoneByCalendarId:r,shown:c,narrowed:l,resolved:u,isLoading:w}=b(t),h=D(a,n),i=s&&u,d=y({...h,calendarIds:l,enabled:i});L(a,n,l,i);const f=x(d.instances,r,c);return{calendars:o,events:f,colorByCalendarId:e,timeZoneByCalendarId:r,isLoading:w||d.isLoading,error:d.error,retry:d.refetch,instanceOf:E}}export{x as a,S as b,b as u};
@@ -1 +1 @@
1
- import{e as R,t as c,j as e,r as N,W as D,X as P,ar as T,dp as Z,f as z,aQ as I,ah as L,eu as O,s as _}from"./index-DDaQbjmr.js";import{c as F,R as B,C as W}from"./calendar-format-t5pknBPH.js";import{M as C}from"./mail-xh-X6l34.js";import{G as A}from"./map-pin-DXPKFmKy.js";import{u as G}from"./useQueries-D1STUKB_.js";const U=R("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);function X(s){const n=F(s.color),a=s.rsvp==="tentative"||s.status==="tentative";return c("flex min-w-0 overflow-hidden rounded-sm border-l-2 px-1.5 py-0.5",n.soft,n.text,n.rail,s.layout==="column"||s.stacked?"flex-col":"items-center gap-1.5",a&&"border-y border-r border-dashed",a&&n.border,s.rsvp==="declined"&&"opacity-60",s.selected&&"ring-2 ring-ring",s.density==="compact"?"text-2xs":"text-xs")}function $({title:s,timeText:n,layout:a,rsvp:l,hasThread:d,isRecurring:m,zoneCertainty:u,trailing:t,detail:p}){const r=a==="column",i=u==="ambiguous",o=!r&&p!==void 0,x=e.jsxs("span",{className:c("flex min-w-0 items-center gap-1",r&&"w-full",l==="declined"&&"line-through"),children:[n!==""&&e.jsx("span",{className:"shrink-0 tabular-nums opacity-80",children:n}),e.jsx("span",{className:"truncate font-medium",children:s})]}),h=(m||d||i)&&e.jsxs("span",{className:c("flex shrink-0 items-center gap-1",r&&"mt-0.5",!r&&t===void 0&&"ml-auto"),children:[m&&e.jsx(B,{className:"size-2.5","aria-label":"Repeats"}),d&&e.jsx(C,{className:"size-2.5","aria-label":"From mail"}),i&&e.jsx(A,{className:"size-2.5 text-warning","aria-label":"Unclear zone"})]}),g=t!==void 0&&e.jsx("span",{className:c("shrink-0 opacity-80",!r&&"ml-auto"),children:t});return e.jsxs(e.Fragment,{children:[o?e.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[x,h,g]}):e.jsxs(e.Fragment,{children:[x,h,g]}),p]})}function ne({title:s,timeText:n,color:a,layout:l,density:d,rsvp:m,status:u,hasThread:t,isRecurring:p,zoneCertainty:r,selected:i,onClick:o,leading:x,trailing:h,detail:g}){const j=l==="column";return e.jsxs("button",{type:"button",onClick:o,"aria-pressed":i,className:c("group flex w-full min-w-0 text-left outline-none transition-colors","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface",j?"h-full":"items-start",x!==void 0&&"gap-2"),children:[x,e.jsx("span",{className:c(X({color:a,layout:l,density:d,rsvp:m,status:u,selected:i,stacked:g!==void 0}),"flex-1",j&&"h-full"),children:e.jsx($,{title:s,timeText:n,layout:l,rsvp:m,hasThread:t,isRecurring:p,zoneCertainty:r,trailing:h,detail:g})})]})}const E=96,q=6;function ae({children:s,hasCard:n,onConfirm:a,onReject:l,blocked:d,blockedReason:m,remaining:u,confirmLabel:t="Add",emptyText:p="Nothing in your mail is waiting on a decision about time.",className:r}){const[i,o]=N.useState(0),[x,h]=N.useState(null);if(!n)return e.jsxs("div",{className:c("flex flex-col items-center gap-2 p-6 text-center",r),children:[e.jsx(D,{className:"size-6 text-fg-subtle","aria-hidden":!0}),e.jsx("p",{className:"text-sm text-fg-muted",children:p})]});const g=Math.abs(i)>E,j=i>0;return e.jsxs("div",{className:c("flex flex-col gap-3",r),children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"touch-pan-y select-none",style:{transform:`translateX(${i}px) rotate(${i/40}deg)`,transition:x===null?"transform 180ms ease-out":"none"},onPointerDown:b=>{h(b.clientX)},onPointerMove:b=>{if(x===null)return;const v=b.clientX-x;Math.abs(v)>q&&!b.currentTarget.hasPointerCapture(b.pointerId)&&b.currentTarget.setPointerCapture(b.pointerId),o(v)},onPointerUp:()=>{Math.abs(i)>E&&(i>0&&!d&&a(),i<0&&l()),h(null),o(0)},onPointerCancel:()=>{h(null),o(0)},children:s}),g&&e.jsx("span",{className:c("pointer-events-none absolute top-3 rounded-md px-2 py-1 text-xs font-semibold",j?"right-3 bg-accent-soft text-accent":"left-3 bg-danger-soft text-danger"),children:j?d?m:t:"Not this"})]}),e.jsxs("p",{className:"text-center text-2xs text-fg-subtle",children:[u," left · swipe right to accept, left to drop, or use the buttons"]})]})}const H="Pick a clock first. The mail never said, and the reader will not choose for you.";function Q(s,n){const a=s.zoneOptions;return a===void 0?{settled:!0,timeZone:""}:a.some(l=>l.timeZone===n)?{settled:!0,timeZone:n}:{settled:!1,reason:H}}function S(s){return s.threadSubject===""?s.sender:`${s.sender} — ${s.threadSubject}`}function K(s){return s>=.85?"Read cleanly":s>=.6?"Read with gaps":"Barely read"}function re({suggestion:s,whenText:n,onAdd:a,onReview:l,onDismiss:d,onOpenThread:m,busy:u=!1,addBlocked:t=!1,zoneChoice:p,onZoneChoice:r,addLabel:i="Add",touch:o,className:x}){const[h,g]=N.useState(""),[j,b]=N.useState(!1),v=N.useId(),k=p??h,M=f=>{b(!1),r?r(f):g(f)},y=Q(s,k),w=f=>()=>{if(!y.settled){b(!0);return}f(y.timeZone)};return e.jsxs("article",{"aria-label":s.title,className:c("flex flex-col gap-2 rounded-lg border border-dashed border-line-strong bg-surface-sunken p-3",x),children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsxs("span",{className:"block text-2xs uppercase tracking-wider text-fg-subtle",children:["Suggested from mail · ",K(s.confidence)]}),e.jsx("span",{className:"block truncate text-sm font-medium text-fg",children:s.title}),e.jsx("span",{className:"block text-xs text-fg-muted",children:n}),s.location!==""&&e.jsx("span",{className:"block truncate text-xs text-fg-muted",children:s.location})]}),e.jsx("button",{type:"button","aria-label":"Dismiss suggestion",onClick:d,disabled:u,className:c("flex shrink-0 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",o?"size-11":"size-7"),children:e.jsx(P,{className:"size-4"})})]}),s.ambiguity!==""&&e.jsxs("p",{className:"flex items-start gap-1.5 text-2xs text-warning",children:[e.jsx(T,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),s.ambiguity]}),m?e.jsxs("button",{type:"button",onClick:m,className:"flex w-full min-w-0 items-center gap-1.5 rounded-sm text-left text-2xs text-accent-2 outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring",children:[e.jsx(C,{className:"size-3 shrink-0"}),e.jsx("span",{className:"truncate",children:S(s)})]}):e.jsxs("p",{className:"flex w-full min-w-0 items-center gap-1.5 text-2xs text-fg-subtle",children:[e.jsx(C,{className:"size-3 shrink-0"}),e.jsx("span",{className:"truncate",children:S(s)})]}),s.zoneOptions&&e.jsxs("div",{className:"flex flex-col gap-1.5 rounded-md border border-warning/40 p-2",children:[e.jsxs("p",{className:"flex items-center gap-1.5 text-2xs font-semibold text-warning",children:[e.jsx(A,{className:"size-3 shrink-0","aria-hidden":!0}),"Which clock is this on?"]}),s.zoneOptions.map(f=>e.jsxs("button",{type:"button","aria-pressed":k===f.timeZone,onClick:()=>M(f.timeZone),className:c("rounded-md border px-2 py-1 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",o&&"min-h-11",k===f.timeZone?"border-accent bg-accent-soft":"border-line bg-surface hover:border-line-strong"),children:[e.jsx("span",{className:"block text-xs font-medium text-fg",children:f.label}),e.jsx("span",{className:"block text-2xs text-fg-subtle",children:f.note})]},f.timeZone))]}),!y.settled&&e.jsx(Z,{id:v,reason:y.reason,nudged:j,className:"text-2xs text-warning"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{variant:"primary",size:o?"md":"sm",icon:e.jsx(I,{className:"size-3.5"}),onClick:w(a),disabled:u||t,"aria-describedby":y.settled?void 0:v,className:c(o&&"min-h-11 flex-1",!y.settled&&"opacity-55"),children:i}),l&&e.jsx(z,{variant:"secondary",size:o?"md":"sm",icon:e.jsx(U,{className:"size-3.5"}),onClick:w(l),disabled:u,"aria-describedby":y.settled?void 0:v,className:c(o&&"min-h-11",!y.settled&&"opacity-55"),children:"Change first"})]})]})}function ie(s){return s.defaultCalendarId!==""?"ready":s.error!==null?"failed":s.isLoading?"loading":"none"}function le(s,n){if(s!=="ready")return s==="loading"?"Reading your calendars…":s==="failed"?e.jsxs(e.Fragment,{children:["Couldn't read your calendars, so there is nowhere to add this yet. Reload to try again."," ",e.jsx("a",{href:n,target:"_blank",rel:"noreferrer",className:"font-medium text-accent hover:underline",children:"Report an issue"})]}):e.jsxs(e.Fragment,{children:["You have no calendar yet, so there is nowhere to add this."," ",e.jsx(L,{to:"/settings/calendars",className:"font-medium text-accent hover:underline",children:"Create a calendar"})]})}const Y=_(400,404);function oe(s){const n=G({queries:s.map(t=>({...O({query:{from:t.from,to:t.to}}),meta:Y,staleTime:W}))}),a=s.map(t=>t.from).join("|"),l=n.map(t=>t.data),d=n.map(t=>t.isPending).join("|"),m=N.useMemo(()=>l.flatMap(t=>t?.items??[]),[a,d]),u=N.useMemo(()=>{const t=new Set;return s.forEach((p,r)=>{n[r]?.isPending&&t.add(p.from)}),t},[a,d]);return{spans:m,pendingWindows:u,error:n.find(t=>t.error)?.error??null,refetch:()=>{for(const t of n)t.error&&t.refetch()}}}export{ne as C,re as E,H as Z,$ as a,ae as b,X as c,le as d,ie as e,Q as s,oe as u};
1
+ import{e as R,t as c,j as e,r as N,W as D,X as P,ar as T,dp as Z,f as z,aQ as I,ah as L,ev as O,s as _}from"./index-CVyiXes6.js";import{c as F,R as B,C as W}from"./calendar-format-Df04vYeX.js";import{M as C}from"./mail-3L2_JePI.js";import{G as A}from"./map-pin-C_G0KnPH.js";import{u as G}from"./useQueries-CqQkOWRS.js";const U=R("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);function X(s){const n=F(s.color),a=s.rsvp==="tentative"||s.status==="tentative";return c("flex min-w-0 overflow-hidden rounded-sm border-l-2 px-1.5 py-0.5",n.soft,n.text,n.rail,s.layout==="column"||s.stacked?"flex-col":"items-center gap-1.5",a&&"border-y border-r border-dashed",a&&n.border,s.rsvp==="declined"&&"opacity-60",s.selected&&"ring-2 ring-ring",s.density==="compact"?"text-2xs":"text-xs")}function $({title:s,timeText:n,layout:a,rsvp:l,hasThread:d,isRecurring:m,zoneCertainty:x,trailing:t,detail:p}){const r=a==="column",i=x==="ambiguous",o=!r&&p!==void 0,u=e.jsxs("span",{className:c("flex min-w-0 items-center gap-1",r&&"w-full",l==="declined"&&"line-through"),children:[n!==""&&e.jsx("span",{className:"shrink-0 tabular-nums opacity-80",children:n}),e.jsx("span",{className:"truncate font-medium",children:s})]}),h=(m||d||i)&&e.jsxs("span",{className:c("flex shrink-0 items-center gap-1",r&&"mt-0.5",!r&&t===void 0&&"ml-auto"),children:[m&&e.jsx(B,{className:"size-2.5","aria-label":"Repeats"}),d&&e.jsx(C,{className:"size-2.5","aria-label":"From mail"}),i&&e.jsx(A,{className:"size-2.5 text-warning","aria-label":"Unclear zone"})]}),g=t!==void 0&&e.jsx("span",{className:c("shrink-0 opacity-80",!r&&"ml-auto"),children:t});return e.jsxs(e.Fragment,{children:[o?e.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[u,h,g]}):e.jsxs(e.Fragment,{children:[u,h,g]}),p]})}function ne({title:s,timeText:n,color:a,layout:l,density:d,rsvp:m,status:x,hasThread:t,isRecurring:p,zoneCertainty:r,selected:i,onClick:o,leading:u,trailing:h,detail:g}){const j=l==="column";return e.jsxs("button",{type:"button",onClick:o,"aria-pressed":i,className:c("group flex w-full min-w-0 text-left outline-none transition-colors","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface",j?"h-full":"items-start",u!==void 0&&"gap-2"),children:[u,e.jsx("span",{className:c(X({color:a,layout:l,density:d,rsvp:m,status:x,selected:i,stacked:g!==void 0}),"flex-1",j&&"h-full"),children:e.jsx($,{title:s,timeText:n,layout:l,rsvp:m,hasThread:t,isRecurring:p,zoneCertainty:r,trailing:h,detail:g})})]})}const E=96,q=6;function ae({children:s,hasCard:n,onConfirm:a,onReject:l,blocked:d,blockedReason:m,remaining:x,confirmLabel:t="Add",emptyText:p="Nothing in your mail is waiting on a decision about time.",className:r}){const[i,o]=N.useState(0),[u,h]=N.useState(null);if(!n)return e.jsxs("div",{className:c("flex flex-col items-center gap-2 p-6 text-center",r),children:[e.jsx(D,{className:"size-6 text-fg-subtle","aria-hidden":!0}),e.jsx("p",{className:"text-sm text-fg-muted",children:p})]});const g=Math.abs(i)>E,j=i>0;return e.jsxs("div",{className:c("flex flex-col gap-3",r),children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"touch-pan-y select-none",style:{transform:`translateX(${i}px) rotate(${i/40}deg)`,transition:u===null?"transform 180ms ease-out":"none"},onPointerDown:b=>{h(b.clientX)},onPointerMove:b=>{if(u===null)return;const v=b.clientX-u;Math.abs(v)>q&&!b.currentTarget.hasPointerCapture(b.pointerId)&&b.currentTarget.setPointerCapture(b.pointerId),o(v)},onPointerUp:()=>{Math.abs(i)>E&&(i>0&&!d&&a(),i<0&&l()),h(null),o(0)},onPointerCancel:()=>{h(null),o(0)},children:s}),g&&e.jsx("span",{className:c("pointer-events-none absolute top-3 rounded-md px-2 py-1 text-xs font-semibold",j?"right-3 bg-accent-soft text-accent":"left-3 bg-danger-soft text-danger"),children:j?d?m:t:"Not this"})]}),e.jsxs("p",{className:"text-center text-2xs text-fg-subtle",children:[x," left · swipe right to accept, left to drop, or use the buttons"]})]})}const H="Pick a clock first. The mail never said, and the reader will not choose for you.";function Q(s,n){const a=s.zoneOptions;return a===void 0?{settled:!0,timeZone:""}:a.some(l=>l.timeZone===n)?{settled:!0,timeZone:n}:{settled:!1,reason:H}}function S(s){return s.threadSubject===""?s.sender:`${s.sender} — ${s.threadSubject}`}function K(s){return s>=.85?"Read cleanly":s>=.6?"Read with gaps":"Barely read"}function re({suggestion:s,whenText:n,onAdd:a,onReview:l,onDismiss:d,onOpenThread:m,busy:x=!1,addBlocked:t=!1,zoneChoice:p,onZoneChoice:r,addLabel:i="Add",touch:o,className:u}){const[h,g]=N.useState(""),[j,b]=N.useState(!1),v=N.useId(),k=p??h,M=f=>{b(!1),r?r(f):g(f)},y=Q(s,k),w=f=>()=>{if(!y.settled){b(!0);return}f(y.timeZone)};return e.jsxs("article",{"aria-label":s.title,className:c("flex flex-col gap-2 rounded-lg border border-dashed border-line-strong bg-surface-sunken p-3",u),children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsxs("span",{className:"block text-2xs uppercase tracking-wider text-fg-subtle",children:["Suggested from mail · ",K(s.confidence)]}),e.jsx("span",{className:"block truncate text-sm font-medium text-fg",children:s.title}),e.jsx("span",{className:"block text-xs text-fg-muted",children:n}),s.location!==""&&e.jsx("span",{className:"block truncate text-xs text-fg-muted",children:s.location})]}),e.jsx("button",{type:"button","aria-label":"Dismiss suggestion",onClick:d,disabled:x,className:c("flex shrink-0 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",o?"size-11":"size-7"),children:e.jsx(P,{className:"size-4"})})]}),s.ambiguity!==""&&e.jsxs("p",{className:"flex items-start gap-1.5 text-2xs text-warning",children:[e.jsx(T,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),s.ambiguity]}),m?e.jsxs("button",{type:"button",onClick:m,className:"flex w-full min-w-0 items-center gap-1.5 rounded-sm text-left text-2xs text-accent-2 outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring",children:[e.jsx(C,{className:"size-3 shrink-0"}),e.jsx("span",{className:"truncate",children:S(s)})]}):e.jsxs("p",{className:"flex w-full min-w-0 items-center gap-1.5 text-2xs text-fg-subtle",children:[e.jsx(C,{className:"size-3 shrink-0"}),e.jsx("span",{className:"truncate",children:S(s)})]}),s.zoneOptions&&e.jsxs("div",{className:"flex flex-col gap-1.5 rounded-md border border-warning/40 p-2",children:[e.jsxs("p",{className:"flex items-center gap-1.5 text-2xs font-semibold text-warning",children:[e.jsx(A,{className:"size-3 shrink-0","aria-hidden":!0}),"Which clock is this on?"]}),s.zoneOptions.map(f=>e.jsxs("button",{type:"button","aria-pressed":k===f.timeZone,onClick:()=>M(f.timeZone),className:c("rounded-md border px-2 py-1 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",o&&"min-h-11",k===f.timeZone?"border-accent bg-accent-soft":"border-line bg-surface hover:border-line-strong"),children:[e.jsx("span",{className:"block text-xs font-medium text-fg",children:f.label}),e.jsx("span",{className:"block text-2xs text-fg-subtle",children:f.note})]},f.timeZone))]}),!y.settled&&e.jsx(Z,{id:v,reason:y.reason,nudged:j,className:"text-2xs text-warning"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{variant:"primary",size:o?"md":"sm",icon:e.jsx(I,{className:"size-3.5"}),onClick:w(a),disabled:x||t,"aria-describedby":y.settled?void 0:v,className:c(o&&"min-h-11 flex-1",!y.settled&&"opacity-55"),children:i}),l&&e.jsx(z,{variant:"secondary",size:o?"md":"sm",icon:e.jsx(U,{className:"size-3.5"}),onClick:w(l),disabled:x,"aria-describedby":y.settled?void 0:v,className:c(o&&"min-h-11",!y.settled&&"opacity-55"),children:"Change first"})]})]})}function ie(s){return s.defaultCalendarId!==""?"ready":s.error!==null?"failed":s.isLoading?"loading":"none"}function le(s,n){if(s!=="ready")return s==="loading"?"Reading your calendars…":s==="failed"?e.jsxs(e.Fragment,{children:["Couldn't read your calendars, so there is nowhere to add this yet. Reload to try again."," ",e.jsx("a",{href:n,target:"_blank",rel:"noreferrer",className:"font-medium text-accent hover:underline",children:"Report an issue"})]}):e.jsxs(e.Fragment,{children:["You have no calendar yet, so there is nowhere to add this."," ",e.jsx(L,{to:"/settings/calendars",className:"font-medium text-accent hover:underline",children:"Create a calendar"})]})}const Y=_(400,404);function oe(s){const n=G({queries:s.map(t=>({...O({query:{from:t.from,to:t.to}}),meta:Y,staleTime:W}))}),a=s.map(t=>t.from).join("|"),l=n.map(t=>t.data),d=n.map(t=>t.isPending).join("|"),m=N.useMemo(()=>l.flatMap(t=>t?.items??[]),[a,d]),x=N.useMemo(()=>{const t=new Set;return s.forEach((p,r)=>{n[r]?.isPending&&t.add(p.from)}),t},[a,d]);return{spans:m,pendingWindows:x,error:n.find(t=>t.error)?.error??null,refetch:()=>{for(const t of n)t.error&&t.refetch()}}}export{ne as C,re as E,H as Z,$ as a,ae as b,X as c,le as d,ie as e,Q as s,oe as u};
@@ -1 +1 @@
1
- import{h as C,r,i as c,eT as h,eU as f,eV as y,s as g,b5 as m}from"./index-DDaQbjmr.js";import{f as I}from"./ErrorState-zb46wwqB.js";const o=g(400,404,412),b=new Set(["calendarEventOperationsListCalendarEvents","calendarEventDetailOperationsGetCalendarEvent","calendarFreeBusyOperationsListCalendarFreeBusy"]),d={kind:"written"},i=e=>m(e)===412?{kind:"conflict"}:{kind:"refused",message:I(e)},O={this:"This",following:"Following",all:"All"};function A(){const e=C();return r.useCallback(()=>{e.invalidateQueries({predicate:t=>{const n=t.queryKey[0];if(typeof n!="object"||n===null)return!1;const s=n._id;return typeof s=="string"&&b.has(s)}})},[e])}const p=({scope:e,recurrenceId:t})=>e===void 0?{}:{scope:O[e],recurrenceId:t};function k(){const e=A(),t=c({...h(),meta:o,onSuccess:e}),n=c({...f(),meta:o,onSuccess:e}),s=c({...y(),meta:o,onSuccess:e}),l=r.useCallback(a=>t.mutateAsync({body:a}).then(()=>d).catch(i),[t]),u=r.useCallback((a,v)=>n.mutateAsync({path:{calendarObjectId:a.calendarObjectId},query:{calendarId:a.calendarId,...p(a)},headers:{"If-Match":a.etag},body:v}).then(()=>d).catch(i),[n]),E=r.useCallback(a=>s.mutateAsync({path:{calendarObjectId:a.calendarObjectId},query:{calendarId:a.calendarId,...p(a)},headers:{"If-Match":a.etag}}).then(()=>d).catch(i),[s]);return r.useMemo(()=>({createEvent:l,updateEvent:u,deleteEvent:E,isWriting:t.isPending||n.isPending||s.isPending}),[l,u,E,t.isPending,n.isPending,s.isPending])}export{k as a,A as u};
1
+ import{h as C,r,i as c,eV as h,eW as f,eX as y,s as g,b5 as m}from"./index-CVyiXes6.js";import{f as I}from"./ErrorState-C9wNWNx-.js";const o=g(400,404,412),b=new Set(["calendarEventOperationsListCalendarEvents","calendarEventDetailOperationsGetCalendarEvent","calendarFreeBusyOperationsListCalendarFreeBusy"]),d={kind:"written"},i=e=>m(e)===412?{kind:"conflict"}:{kind:"refused",message:I(e)},O={this:"This",following:"Following",all:"All"};function A(){const e=C();return r.useCallback(()=>{e.invalidateQueries({predicate:t=>{const n=t.queryKey[0];if(typeof n!="object"||n===null)return!1;const s=n._id;return typeof s=="string"&&b.has(s)}})},[e])}const p=({scope:e,recurrenceId:t})=>e===void 0?{}:{scope:O[e],recurrenceId:t};function k(){const e=A(),t=c({...h(),meta:o,onSuccess:e}),n=c({...f(),meta:o,onSuccess:e}),s=c({...y(),meta:o,onSuccess:e}),l=r.useCallback(a=>t.mutateAsync({body:a}).then(()=>d).catch(i),[t]),u=r.useCallback((a,v)=>n.mutateAsync({path:{calendarObjectId:a.calendarObjectId},query:{calendarId:a.calendarId,...p(a)},headers:{"If-Match":a.etag},body:v}).then(()=>d).catch(i),[n]),E=r.useCallback(a=>s.mutateAsync({path:{calendarObjectId:a.calendarObjectId},query:{calendarId:a.calendarId,...p(a)},headers:{"If-Match":a.etag}}).then(()=>d).catch(i),[s]);return r.useMemo(()=>({createEvent:l,updateEvent:u,deleteEvent:E,isWriting:t.isPending||n.isPending||s.isPending}),[l,u,E,t.isPending,n.isPending,s.isPending])}export{k as a,A as u};
@@ -1 +1 @@
1
- import{c as g,ev as T,r as h}from"./index-DDaQbjmr.js";const o=e=>String(e).padStart(2,"0"),y=e=>`${e.getUTCFullYear()}-${o(e.getUTCMonth()+1)}-${o(e.getUTCDate())}`,f=e=>{const t=e<0?"-":"+",r=Math.abs(e);return`${t}${o(Math.floor(r/60))}:${o(r%60)}`};function $(e,t){const r=new Date(`${e}T${t}:00`);return`${e}T${t}:00${f(-r.getTimezoneOffset())}`}const i=new Map;function N(e){if(i.has(e))return i.get(e);let t;try{t=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{t=void 0}return i.set(e,t),t}function d(e,t){const r=N(e);if(!r)return Number.NaN;const n=r.formatToParts(new Date(t)),a=O=>Number(n.find(b=>b.type===O)?.value),s=a("hour")%24;return(Date.UTC(a("year"),a("month")-1,a("day"),s,a("minute"),a("second"))-t)/6e4}function L(e,t,r){if(r==="")return`${e}T${t}:00+00:00`;const n=Date.parse(`${e}T${t}:00Z`),a=d(r,n);if(Number.isNaN(a))return $(e,t);const s=d(r,n-a*6e4);return`${e}T${t}:00${f(Number.isNaN(s)?a:s)}`}function p(e,t){const r=Date.parse(e),n=d(t,r),a=Number.isNaN(n)?-new Date(r).getTimezoneOffset():n,s=new Date(r+a*6e4);return`${y(s)}T${o(s.getUTCHours())}:${o(s.getUTCMinutes())}:${o(s.getUTCSeconds())}${f(a)}`}const c=e=>$(e,"00:00");function u(e,t){const[r,n,a]=e.split("-").map(Number);return y(new Date(Date.UTC(r,n-1,a+t)))}function U(e){const[t,r,n]=e.split("-").map(Number),a=new Date(Date.UTC(t,r-1,n));return u(e,-((a.getUTCDay()+6)%7))}function E(e,t){const[r,n]=t.split("-").map(Number);if(e==="year")return[`${r}-01-01`,`${r+1}-01-01`];if(e==="month"){const s=`${r}-${o(n)}-01`,m=n===12?`${r+1}-01-01`:`${r}-${o(n+1)}-01`;return[s,m]}if(e==="day")return[t,u(t,1)];const a=U(t);return[a,u(a,7)]}function M(e,t){const[r,n]=E(e,t);return{from:c(r),to:c(n)}}function F(e,t){return{from:c(e),to:c(u(e,t))}}const R=()=>Intl.DateTimeFormat().resolvedOptions().timeZone,C="";function k(e){if(e!==C)return e;const t=R();return Intl.supportedValuesOf("timeZone").includes(t)?t:C}const v={Cal1:"cal-1",Cal2:"cal-2",Cal3:"cal-3",Cal4:"cal-4",Cal5:"cal-5",Cal6:"cal-6"},w={Local:"local",Explicit:"explicit",Ambiguous:"ambiguous"},D="#";function z(e,t){return t===""?e:`${e}${D}${t}`}function l(e){const t=e.indexOf(D);return t===-1?{calendarObjectId:e,recurrenceId:""}:{calendarObjectId:e.slice(0,t),recurrenceId:e.slice(t+1)}}const I=(e,t)=>{const r=[...e].sort((n,a)=>Date.parse(n.start)-Date.parse(a.start));return r.find(n=>Date.parse(n.end)>Date.parse(t))??r[0]};function B(e,t,r){const n=I(e.filter(a=>{const s=l(a.id);return s.calendarObjectId===t&&s.recurrenceId!==""}),r);return n?l(n.id):void 0}function P(e,t,r,n){const a=I(e.filter(s=>s.calendarObjectId===t&&j(s)).map(s=>x(s,"",n)),r);if(a)return{...l(a.id),calendarId:a.calendarId,date:a.start.slice(0,10)}}function S(e){return{id:e.calendarId,accountId:e.accountConfigId,accountLabel:"",name:e.displayName,color:v[e.color]??"cal-1",...e.source==="Subscribed"?{readOnly:!0,sync:e.subscriptionEnabled?"live":"paused",syncError:e.subscriptionError}:{}}}function x(e,t,r){return{id:z(e.calendarObjectId,e.recurrenceId),calendarId:e.calendarId,title:e.summary,start:e.allDay?e.start.slice(0,10):p(e.start,r),end:e.allDay?e.end.slice(0,10):p(e.end,r),allDay:e.allDay,location:"",notes:"",attendees:[],myRsvp:"accepted",threadId:"",threadSubject:"",timeZone:t,zoneCertainty:w[e.zoneCertainty]??"explicit",recurrenceRule:e.hasRecurrence?"Repeats":"",seriesId:e.hasRecurrence?e.icalUid:"",seriesException:!1,status:e.status==="Tentative"?"tentative":"confirmed"}}const j=e=>e.status!=="Cancelled";function W(){const{data:e,isLoading:t,error:r}=g(T());return h.useMemo(()=>{const n=e?.items??[],a=n.map(S);return{calendars:a,collections:n,colorByCalendarId:Object.fromEntries(a.map(s=>[s.id,s.color])),timeZoneByCalendarId:Object.fromEntries(n.map(s=>[s.calendarId,s.timezone])),defaultCalendarId:(n.find(s=>s.source==="Default")??n[0])?.calendarId??"",isLoading:t,error:r??null}},[e,t,r])}export{C as U,F as a,M as b,z as c,R as d,u as e,k as f,L as g,p as h,j as i,P as j,l as r,B as s,x as t,W as u};
1
+ import{c as g,ew as T,r as h}from"./index-CVyiXes6.js";const o=e=>String(e).padStart(2,"0"),y=e=>`${e.getUTCFullYear()}-${o(e.getUTCMonth()+1)}-${o(e.getUTCDate())}`,f=e=>{const t=e<0?"-":"+",r=Math.abs(e);return`${t}${o(Math.floor(r/60))}:${o(r%60)}`};function $(e,t){const r=new Date(`${e}T${t}:00`);return`${e}T${t}:00${f(-r.getTimezoneOffset())}`}const i=new Map;function N(e){if(i.has(e))return i.get(e);let t;try{t=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{t=void 0}return i.set(e,t),t}function d(e,t){const r=N(e);if(!r)return Number.NaN;const n=r.formatToParts(new Date(t)),a=O=>Number(n.find(b=>b.type===O)?.value),s=a("hour")%24;return(Date.UTC(a("year"),a("month")-1,a("day"),s,a("minute"),a("second"))-t)/6e4}function L(e,t,r){if(r==="")return`${e}T${t}:00+00:00`;const n=Date.parse(`${e}T${t}:00Z`),a=d(r,n);if(Number.isNaN(a))return $(e,t);const s=d(r,n-a*6e4);return`${e}T${t}:00${f(Number.isNaN(s)?a:s)}`}function p(e,t){const r=Date.parse(e),n=d(t,r),a=Number.isNaN(n)?-new Date(r).getTimezoneOffset():n,s=new Date(r+a*6e4);return`${y(s)}T${o(s.getUTCHours())}:${o(s.getUTCMinutes())}:${o(s.getUTCSeconds())}${f(a)}`}const c=e=>$(e,"00:00");function u(e,t){const[r,n,a]=e.split("-").map(Number);return y(new Date(Date.UTC(r,n-1,a+t)))}function U(e){const[t,r,n]=e.split("-").map(Number),a=new Date(Date.UTC(t,r-1,n));return u(e,-((a.getUTCDay()+6)%7))}function E(e,t){const[r,n]=t.split("-").map(Number);if(e==="year")return[`${r}-01-01`,`${r+1}-01-01`];if(e==="month"){const s=`${r}-${o(n)}-01`,m=n===12?`${r+1}-01-01`:`${r}-${o(n+1)}-01`;return[s,m]}if(e==="day")return[t,u(t,1)];const a=U(t);return[a,u(a,7)]}function M(e,t){const[r,n]=E(e,t);return{from:c(r),to:c(n)}}function F(e,t){return{from:c(e),to:c(u(e,t))}}const R=()=>Intl.DateTimeFormat().resolvedOptions().timeZone,C="";function k(e){if(e!==C)return e;const t=R();return Intl.supportedValuesOf("timeZone").includes(t)?t:C}const w={Cal1:"cal-1",Cal2:"cal-2",Cal3:"cal-3",Cal4:"cal-4",Cal5:"cal-5",Cal6:"cal-6"},v={Local:"local",Explicit:"explicit",Ambiguous:"ambiguous"},D="#";function z(e,t){return t===""?e:`${e}${D}${t}`}function l(e){const t=e.indexOf(D);return t===-1?{calendarObjectId:e,recurrenceId:""}:{calendarObjectId:e.slice(0,t),recurrenceId:e.slice(t+1)}}const I=(e,t)=>{const r=[...e].sort((n,a)=>Date.parse(n.start)-Date.parse(a.start));return r.find(n=>Date.parse(n.end)>Date.parse(t))??r[0]};function B(e,t,r){const n=I(e.filter(a=>{const s=l(a.id);return s.calendarObjectId===t&&s.recurrenceId!==""}),r);return n?l(n.id):void 0}function P(e,t,r,n){const a=I(e.filter(s=>s.calendarObjectId===t&&j(s)).map(s=>x(s,"",n)),r);if(a)return{...l(a.id),calendarId:a.calendarId,date:a.start.slice(0,10)}}function S(e){return{id:e.calendarId,accountId:e.accountConfigId,accountLabel:"",name:e.displayName,color:w[e.color]??"cal-1",...e.source==="Subscribed"?{readOnly:!0,sync:e.subscriptionEnabled?"live":"paused",syncError:e.subscriptionError}:{}}}function x(e,t,r){return{id:z(e.calendarObjectId,e.recurrenceId),calendarId:e.calendarId,title:e.summary,start:e.allDay?e.start.slice(0,10):p(e.start,r),end:e.allDay?e.end.slice(0,10):p(e.end,r),allDay:e.allDay,location:"",notes:"",attendees:[],myRsvp:"accepted",threadId:"",threadSubject:"",timeZone:t,zoneCertainty:v[e.zoneCertainty]??"explicit",recurrenceRule:e.hasRecurrence?"Repeats":"",seriesId:e.hasRecurrence?e.icalUid:"",seriesException:!1,status:e.status==="Tentative"?"tentative":"confirmed"}}const j=e=>e.status!=="Cancelled";function W(){const{data:e,isLoading:t,error:r}=g(T());return h.useMemo(()=>{const n=e?.items??[],a=n.map(S);return{calendars:a,collections:n,colorByCalendarId:Object.fromEntries(a.map(s=>[s.id,s.color])),timeZoneByCalendarId:Object.fromEntries(n.map(s=>[s.calendarId,s.timezone])),defaultCalendarId:(n.find(s=>s.source==="Default")??n[0])?.calendarId??"",isLoading:t,error:r??null}},[e,t,r])}export{C as U,F as a,M as b,z as c,R as d,u as e,k as f,L as g,p as h,j as i,P as j,l as r,B as s,x as t,W as u};
@@ -1 +1 @@
1
- import{r as o}from"./index-DDaQbjmr.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-CVyiXes6.js";const n=(e,t)=>{const[r,u]=o.useState(e);return o.useEffect(()=>{const s=setTimeout(()=>u(e),t);return()=>clearTimeout(s)},[e,t]),r};export{n as u};
@@ -1 +1 @@
1
- import{r as m,i as b,eG as x,c as M,eH as D,e0 as I,eI as P,h as v,eJ as N,eK as L,eL as T,eM as w,bm as z}from"./index-DDaQbjmr.js";const G=(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},y={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."},V=e=>e.disabledReason==="None"?void 0:(e.disabledReason==="AwaitingFolder"||e.disabledReason==="FolderCreateFailed")&&e.actionMailboxId!=="None"?y.UserDisabled:y[e.disabledReason],Y=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"})},A=(e,t=new Date)=>{if(!e)return;const r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!r)return;const[,s,n,i]=r,a=new Date(Number(s),Number(n)-1,Number(i),23,59,59,0);if(Number.isNaN(a.getTime()))return;const o=-t.getTimezoneOffset(),c=o>=0?"+":"-",u=Math.abs(o),d=String(Math.floor(u/60)).padStart(2,"0"),f=String(u%60).padStart(2,"0"),l=p=>String(p).padStart(2,"0");return`${a.getFullYear()}-${l(a.getMonth()+1)}-${l(a.getDate())}T${l(a.getHours())}:${l(a.getMinutes())}:${l(a.getSeconds())}${c}${d}:${f}`},h="None",X=e=>!e.literalClauses.some(t=>t.field==="HasWords"),E=e=>({...e.anchorMessageId?{anchorMessageId:e.anchorMessageId}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h}),Z=({mode:e,ruleScope:t})=>t==="standing"?"standing":t==="until"?"temporary":e==="selected"?"just-these":"all-like-these",ee=({mode:e,ruleScope:t,anchorMessageId:r,clauses:s,matchOperator:n,moveMailboxId:i,until:a})=>({...e==="similar"&&r?{anchorMessageId:r}:{},matchOperator:n==="all"?"And":"Or",literalClauses:s.map(o=>({field:o.field,value:o.value})),moveMailboxId:i,expiresAt:t==="until"?A(a??""):void 0}),C=(e,t,r)=>({name:r,scope:t==="standing"?"Standing":"Temporary",...t==="temporary"&&e.expiresAt?{expiresAt:e.expiresAt}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h,...e.anchorMessageId?{anchorMessageId:e.anchorMessageId}:{}}),R=new Set(["Complete","Failed"]),O=e=>e!==void 0&&R.has(e),k=1e3,_=15e3,J=e=>{const t=Math.max(0,e),r=k*2**t;return Math.min(r,_)},$=(e,t,r)=>{if(e)return{kind:r?"restartFailed":"startFailed",error:e};if(t)return{kind:"statusUnreadable",error:t}},te=e=>{const[t,r]=m.useState(),s=b({...x(),onSuccess:g=>r(g.organizeJobId)}),{mutate:n}=s,i=M({...D({path:{accountId:e??"",organizeJobId:t??""}}),enabled:!!e&&!!t,refetchInterval:g=>{const F=g.state.data?.state;return O(F)?!1:J(g.state.dataUpdateCount)}}),a=m.useCallback(g=>{e&&n({path:{accountId:e},body:E(g)})},[e,n]),{refetch:o}=i,c=m.useCallback(()=>{o()},[o]),u=i.data,d=s.isPending?void 0:u,f=d?.state??s.data?.state,l=O(d?.state),p={state:f,matchedCount:d?.matchedCount??0,appliedCount:d?.appliedCount??0,failedCount:d?.failedCount??0,errorMessage:d?.errorMessage??""};return{start:a,refreshStatus:c,progress:p,isStarting:s.isPending,isRunning:!!t&&!l,isDone:l,failure:$(s.error,i.error,!!u)}},re=["From","Subject","HasWords","ListId","FromDomain"],U=e=>{const t=e.trim(),r=t.match(/<([^>]+)>/);return(r?r[1]:t).trim().toLowerCase()},se=(e,t)=>e==="ListId"?U(t):t.trim(),q=e=>e==="all"?"And":"Or",Q=(e,t)=>{const r=e.widen!==void 0&&!e.widen.inactive,s=e.clauses.map(n=>({field:n.field,value:n.value}));return{...r&&t?{anchorMessageId:t}:{},matchOperator:q(e.matchOperator),literalClauses:s}},H=e=>e.anchorMessageId!==void 0||!e.literalClauses.some(t=>t.field==="HasWords"),K=e=>JSON.stringify({anchor:e.anchorMessageId??null,operator:e.matchOperator,clauses:e.literalClauses.map(t=>`${t.field} ${t.value}`)}),ae=(e,t)=>{const r=Q(e,t);return{...r.anchorMessageId?{anchorMessageId:r.anchorMessageId}:{},matchOperator:r.matchOperator,literalClauses:r.literalClauses,moveMailboxId:e.moveMailboxId,labelId:e.labelId,expiresAt:e.scope==="until"?A(e.until??""):void 0}},j=(e,t)=>{if(e.error!==void 0&&e.errorSignature===t)return{status:"error",reason:e.error};if(e.count===void 0)return{status:"loading"};const r=e.indexEmpty===!0?{indexEmpty:!0}:{};return e.previewedSignature===t?{status:"ready",count:e.count,...r}:{status:"ready",count:e.count,stale:!0,...r}},B=350,ne=(e,t,r)=>{const s=b(I()),{mutateAsync:n}=s,i=K(t),[a,o]=m.useState(()=>({})),c=m.useRef(t);c.current=t;const u=m.useRef(i),d=H(t);return m.useEffect(()=>{if(!e||!d||i===a.previewedSignature||i===a.errorSignature)return;const f=setTimeout(()=>{const l=i;u.current=l,n({path:{accountId:e},body:E({...c.current})}).then(p=>{u.current===l&&o({count:p.matchedCount,matchedIds:p.messageIds,indexEmpty:p.semanticIndexEmpty===!0,previewedSignature:l})}).catch(p=>{u.current===l&&o(g=>({...g,error:p instanceof Error?p.message:"Couldn't count matches.",errorSignature:l}))})},B);return()=>clearTimeout(f)},[e,d,i,a.previewedSignature,a.errorSignature,n]),d?{count:j(a,i),matchedIds:a.previewedSignature===i?a.matchedIds??[]:[]}:{count:{status:"error",reason:P},matchedIds:[]}},S=e=>L({path:{accountId:e}}),ie=e=>{const t=M({...T({path:{accountId:e??""}}),enabled:!!e});return{filters:t.data?.items??[],isPending:t.isPending,isError:t.isError,error:t.error,refetch:t.refetch}},oe=e=>{const t=v(),r=b({...N(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:S(e)})}}),{mutate:s,mutateAsync:n}=r,i=m.useCallback((o,c,u)=>{e&&s({path:{accountId:e},body:C(o,c,u)})},[e,s]),a=m.useCallback(async(o,c,u)=>e?n({path:{accountId:e},body:C(o,c,u)}).then(()=>!0,()=>!1):!1,[e,n]);return{createFilter:i,createFilterAsync:a,isPending:r.isPending,isSuccess:r.isSuccess,isError:r.isError,error:r.error,reset:r.reset}},le=e=>{const t=v(),r=b({...w(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:S(e)})}}),{mutate:s}=r;return{deleteFilter:m.useCallback(i=>{e&&s({path:{accountId:e,filterId:i}})},[e,s]),isPending:r.isPending,deletingFilterId:r.isPending?r.variables?.path.filterId:void 0}},ue=e=>{const t=v(),r=b({...z(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:S(e)})}}),{mutate:s,variables:n}=r,i=m.useCallback((o,c)=>{e&&s({path:{accountId:e,filterId:o},body:{state:c?"Active":"Disabled"}})},[e,s]),a=m.useCallback(()=>{n&&s(n)},[s,n]);return{toggleFilter:i,retry:a,togglingFilterId:r.isPending?n?.path.filterId:void 0,isError:r.isError,error:r.error,enabling:n?.body?.state==="Active"}};export{h as N,re as S,te as a,S as b,ae as c,V as d,Y as e,G as f,ie as g,le as h,ue as i,E as j,oe as k,ee as l,X as m,se as n,Z as o,A as p,Q as r,ne as u};
1
+ import{r as m,i as b,eI as x,c as M,eJ as D,e1 as I,eK as N,h as v,eL as P,eM as L,eN as T,eO as w,bm as z}from"./index-CVyiXes6.js";const V=(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},y={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."},Y=e=>e.disabledReason==="None"?void 0:(e.disabledReason==="AwaitingFolder"||e.disabledReason==="FolderCreateFailed")&&e.actionMailboxId!=="None"?y.UserDisabled:y[e.disabledReason],G=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"})},A=(e,t=new Date)=>{if(!e)return;const r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!r)return;const[,s,n,i]=r,a=new Date(Number(s),Number(n)-1,Number(i),23,59,59,0);if(Number.isNaN(a.getTime()))return;const o=-t.getTimezoneOffset(),c=o>=0?"+":"-",u=Math.abs(o),d=String(Math.floor(u/60)).padStart(2,"0"),f=String(u%60).padStart(2,"0"),l=p=>String(p).padStart(2,"0");return`${a.getFullYear()}-${l(a.getMonth()+1)}-${l(a.getDate())}T${l(a.getHours())}:${l(a.getMinutes())}:${l(a.getSeconds())}${c}${d}:${f}`},h="None",X=e=>!e.literalClauses.some(t=>t.field==="HasWords"),E=e=>({...e.anchorMessageId?{anchorMessageId:e.anchorMessageId}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h}),Z=({mode:e,ruleScope:t})=>t==="standing"?"standing":t==="until"?"temporary":e==="selected"?"just-these":"all-like-these",ee=({mode:e,ruleScope:t,anchorMessageId:r,clauses:s,matchOperator:n,moveMailboxId:i,until:a})=>({...e==="similar"&&r?{anchorMessageId:r}:{},matchOperator:n==="all"?"And":"Or",literalClauses:s.map(o=>({field:o.field,value:o.value})),moveMailboxId:i,expiresAt:t==="until"?A(a??""):void 0}),C=(e,t,r)=>({name:r,scope:t==="standing"?"Standing":"Temporary",...t==="temporary"&&e.expiresAt?{expiresAt:e.expiresAt}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h,...e.anchorMessageId?{anchorMessageId:e.anchorMessageId}:{}}),R=new Set(["Complete","Failed"]),O=e=>e!==void 0&&R.has(e),k=1e3,_=15e3,J=e=>{const t=Math.max(0,e),r=k*2**t;return Math.min(r,_)},$=(e,t,r)=>{if(e)return{kind:r?"restartFailed":"startFailed",error:e};if(t)return{kind:"statusUnreadable",error:t}},te=e=>{const[t,r]=m.useState(),s=b({...x(),onSuccess:g=>r(g.organizeJobId)}),{mutate:n}=s,i=M({...D({path:{accountId:e??"",organizeJobId:t??""}}),enabled:!!e&&!!t,refetchInterval:g=>{const F=g.state.data?.state;return O(F)?!1:J(g.state.dataUpdateCount)}}),a=m.useCallback(g=>{e&&n({path:{accountId:e},body:E(g)})},[e,n]),{refetch:o}=i,c=m.useCallback(()=>{o()},[o]),u=i.data,d=s.isPending?void 0:u,f=d?.state??s.data?.state,l=O(d?.state),p={state:f,matchedCount:d?.matchedCount??0,appliedCount:d?.appliedCount??0,failedCount:d?.failedCount??0,errorMessage:d?.errorMessage??""};return{start:a,refreshStatus:c,progress:p,isStarting:s.isPending,isRunning:!!t&&!l,isDone:l,failure:$(s.error,i.error,!!u)}},re=["From","Subject","HasWords","ListId","FromDomain"],U=e=>{const t=e.trim(),r=t.match(/<([^>]+)>/);return(r?r[1]:t).trim().toLowerCase()},se=(e,t)=>e==="ListId"?U(t):t.trim(),q=e=>e==="all"?"And":"Or",Q=(e,t)=>{const r=e.widen!==void 0&&!e.widen.inactive,s=e.clauses.map(n=>({field:n.field,value:n.value}));return{...r&&t?{anchorMessageId:t}:{},matchOperator:q(e.matchOperator),literalClauses:s}},K=e=>e.anchorMessageId!==void 0||!e.literalClauses.some(t=>t.field==="HasWords"),j=e=>JSON.stringify({anchor:e.anchorMessageId??null,operator:e.matchOperator,clauses:e.literalClauses.map(t=>`${t.field} ${t.value}`)}),ae=(e,t)=>{const r=Q(e,t);return{...r.anchorMessageId?{anchorMessageId:r.anchorMessageId}:{},matchOperator:r.matchOperator,literalClauses:r.literalClauses,moveMailboxId:e.moveMailboxId,labelId:e.labelId,expiresAt:e.scope==="until"?A(e.until??""):void 0}},B=(e,t)=>{if(e.error!==void 0&&e.errorSignature===t)return{status:"error",reason:e.error};if(e.count===void 0)return{status:"loading"};const r=e.indexEmpty===!0?{indexEmpty:!0}:{};return e.previewedSignature===t?{status:"ready",count:e.count,...r}:{status:"ready",count:e.count,stale:!0,...r}},H=350,ne=(e,t,r)=>{const s=b(I()),{mutateAsync:n}=s,i=j(t),[a,o]=m.useState(()=>({})),c=m.useRef(t);c.current=t;const u=m.useRef(i),d=K(t);return m.useEffect(()=>{if(!e||!d||i===a.previewedSignature||i===a.errorSignature)return;const f=setTimeout(()=>{const l=i;u.current=l,n({path:{accountId:e},body:E({...c.current})}).then(p=>{u.current===l&&o({count:p.matchedCount,matchedIds:p.messageIds,indexEmpty:p.semanticIndexEmpty===!0,previewedSignature:l})}).catch(p=>{u.current===l&&o(g=>({...g,error:p instanceof Error?p.message:"Couldn't count matches.",errorSignature:l}))})},H);return()=>clearTimeout(f)},[e,d,i,a.previewedSignature,a.errorSignature,n]),d?{count:B(a,i),matchedIds:a.previewedSignature===i?a.matchedIds??[]:[]}:{count:{status:"error",reason:N},matchedIds:[]}},S=e=>L({path:{accountId:e}}),ie=e=>{const t=M({...T({path:{accountId:e??""}}),enabled:!!e});return{filters:t.data?.items??[],isPending:t.isPending,isError:t.isError,error:t.error,refetch:t.refetch}},oe=e=>{const t=v(),r=b({...P(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:S(e)})}}),{mutate:s,mutateAsync:n}=r,i=m.useCallback((o,c,u)=>{e&&s({path:{accountId:e},body:C(o,c,u)})},[e,s]),a=m.useCallback(async(o,c,u)=>e?n({path:{accountId:e},body:C(o,c,u)}).then(()=>!0,()=>!1):!1,[e,n]);return{createFilter:i,createFilterAsync:a,isPending:r.isPending,isSuccess:r.isSuccess,isError:r.isError,error:r.error,reset:r.reset}},le=e=>{const t=v(),r=b({...w(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:S(e)})}}),{mutate:s}=r;return{deleteFilter:m.useCallback(i=>{e&&s({path:{accountId:e,filterId:i}})},[e,s]),isPending:r.isPending,deletingFilterId:r.isPending?r.variables?.path.filterId:void 0}},ue=e=>{const t=v(),r=b({...z(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:S(e)})}}),{mutate:s,variables:n}=r,i=m.useCallback((o,c)=>{e&&s({path:{accountId:e,filterId:o},body:{state:c?"Active":"Disabled"}})},[e,s]),a=m.useCallback(()=>{n&&s(n)},[s,n]);return{toggleFilter:i,retry:a,togglingFilterId:r.isPending?n?.path.filterId:void 0,isError:r.isError,error:r.error,enabling:n?.body?.state==="Active"}};export{h as N,re as S,te as a,S as b,ae as c,Y as d,G as e,V as f,ie as g,le as h,ue as i,E as j,oe as k,ee as l,X as m,se as n,Z as o,A as p,Q as r,ne as u};
@@ -1 +1 @@
1
- import{c as p,ep as L,h as n,i as l,eq as d,r as o,er as y,es as c,et as g}from"./index-DDaQbjmr.js";const u=e=>y({path:{accountId:e}}),f=e=>{const r=p({...L({path:{accountId:e??""}}),enabled:!!e});return{labels:r.data?.items??[],isPending:r.isPending,isError:r.isError,error:r.error,refetch:r.refetch}},h=e=>{const r=n(),t=l({...d(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutateAsync:s}=t;return{createLabel:o.useCallback((a,i="Default")=>e?s({path:{accountId:e},body:{name:a,color:i}}):Promise.reject(new Error("No account")),[e,s]),isPending:t.isPending,isError:t.isError,error:t.error,reset:t.reset}},m=e=>{const r=n(),t=l({...c(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutate:s}=t;return{updateLabel:o.useCallback((a,i)=>{e&&s({path:{accountId:e,labelId:a},body:i})},[e,s]),isPending:t.isPending,updatingLabelId:t.isPending?t.variables?.path.labelId:void 0}},C=e=>{const r=n(),t=l({...g(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutate:s}=t;return{deleteLabel:o.useCallback(a=>{e&&s({path:{accountId:e,labelId:a}})},[e,s]),isPending:t.isPending,deletingLabelId:t.isPending?t.variables?.path.labelId:void 0}};export{f as a,m as b,C as c,h as u};
1
+ import{c as L,eq as p,h as n,i as l,er as d,r as u,es as y,et as c,eu as g}from"./index-CVyiXes6.js";const o=e=>y({path:{accountId:e}}),f=e=>{const r=L({...p({path:{accountId:e??""}}),enabled:!!e});return{labels:r.data?.items??[],isPending:r.isPending,isError:r.isError,error:r.error,refetch:r.refetch}},h=e=>{const r=n(),t=l({...d(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:o(e)})}}),{mutateAsync:s}=t;return{createLabel:u.useCallback((a,i="Default")=>e?s({path:{accountId:e},body:{name:a,color:i}}):Promise.reject(new Error("No account")),[e,s]),isPending:t.isPending,isError:t.isError,error:t.error,reset:t.reset}},m=e=>{const r=n(),t=l({...c(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:o(e)})}}),{mutate:s}=t;return{updateLabel:u.useCallback((a,i)=>{e&&s({path:{accountId:e,labelId:a},body:i})},[e,s]),isPending:t.isPending,updatingLabelId:t.isPending?t.variables?.path.labelId:void 0}},C=e=>{const r=n(),t=l({...g(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:o(e)})}}),{mutate:s}=t;return{deleteLabel:u.useCallback(a=>{e&&s({path:{accountId:e,labelId:a}})},[e,s]),isPending:t.isPending,deletingLabelId:t.isPending?t.variables?.path.labelId:void 0}};export{f as a,m as b,C as c,h as u};
@@ -1 +1 @@
1
- import{c0 as s,c1 as e}from"./index-DDaQbjmr.js";const i=768,r=t=>t!=="desktop",a=()=>{const t=s(`(min-width: ${i}px)`);return s(e)?"desktop":t?"tablet":"phone"};export{r as i,a as u};
1
+ import{c0 as s,c1 as e}from"./index-CVyiXes6.js";const i=768,r=t=>t!=="desktop",a=()=>{const t=s(`(min-width: ${i}px)`);return s(e)?"desktop":t?"tablet":"phone"};export{r as i,a as u};
@@ -1 +1 @@
1
- import{r as a,u as M,cm as O,cn as N,cN as B,a9 as y,co as P,q as U,ab as $,h as D,c as F,cO as v,cC as L}from"./index-DDaQbjmr.js";const w="/mail/brief/compose/{-$outboxMessageId}",R="/mail/flagged/compose/{-$outboxMessageId}",E="/mail/outbox/compose/{-$outboxMessageId}",k="/mail/$mailboxId/compose/{-$outboxMessageId}";function T(){const e=y({from:w,shouldThrow:!1}),t=y({from:R,shouldThrow:!1}),r=y({from:E,shouldThrow:!1}),s=y({from:k,shouldThrow:!1});return e??t??r??s}function j(){return T()!==void 0}function J(){return T()?.outboxMessageId}function _(e,t,r){return e==="flagged"?{to:R,params:{outboxMessageId:r}}:e==="outbox"?{to:E,params:{outboxMessageId:r}}:e==="mailbox"&&t?{to:k,params:{mailboxId:t,outboxMessageId:r}}:{to:w,params:{outboxMessageId:r}}}function g(){const e=M(),t=O(),{list:r,mailboxId:s}=N();return a.useCallback((n,o)=>{e({..._(r,s,n),search:B,hash:o?.keepPanels?!0:t,replace:o?.replace??!1})},[e,t,r,s])}function V(){const e=g();return a.useCallback(()=>e(void 0),[e])}function Z(){const e=g();return a.useCallback(t=>e(t),[e])}function ee(){const e=g();return a.useCallback(t=>e(t,{replace:!0,keepPanels:!0}),[e])}function te(){return P()}const q=e=>{const t=e.filter(n=>!n.isMultipart&&n.disposition!=="attachment"&&n.mediaType==="TEXT"&&n.contentUrl.length>0),r=t.find(n=>n.mediaSubtype.toUpperCase()==="HTML");if(r)return{kind:"html",contentUrl:r.contentUrl};const s=t.find(n=>n.mediaSubtype.toUpperCase()==="PLAIN");return s?{kind:"text",contentUrl:s.contentUrl}:null},b={all:["messages"],detail:e=>[...b.all,"detail",e],body:e=>[...b.detail(e),"body"]};class f extends Error{reason;status;retryAfterSeconds;constructor(t,r,s,n){super(r),this.name="BodyFetchError",this.reason=t,this.status=s,this.retryAfterSeconds=n}}const K=e=>{const t=Number.parseInt(e??"",10);return!Number.isFinite(t)||t<=0?1:Math.min(t,30)},Q=8,I="x-remit-403-reason",X=(e,t)=>{const r=t?.trim()??"";return e===401?"auth":e===403?r.length>0?"auth":"body-missing":e===404?"body-missing":"generic"},G=(e,t)=>(t??"").toLowerCase().startsWith("text/html")?/<div\s+id=["']root["']/i.test(e):!1,H=(e,t)=>{const r=(t??"").toLowerCase();return!!(e==="text"&&r.startsWith("text/html"))},W=async(e,t,r=async()=>null)=>{const s={},n=await r();n&&(s.Authorization=`Bearer ${n}`);const o=await L(e,{headers:s});if(o.status===202)throw new f("not-ready","Message body is still syncing",202,K(o.headers.get("Retry-After")));if(!o.ok){const l=o.headers.get(I),h=X(o.status,l);throw new f(h,`Failed to load message body (${o.status} ${o.statusText})`,o.status)}const c=o.headers.get("content-type");if(H(t,c))throw new f("content-type-mismatch",`Refusing to render message body — expected ${t}, got Content-Type ${c}`);const m=await o.text();if(G(m,c))throw new f("spa-shell-leak","Refusing to render message body — response looks like the SPA shell (CloudFront 403/404 fallback leaked through to /content/*)");return m},z=async(e,t)=>(t.isRetryAfterNotReady&&await e.refetchDescribeMessage(),e.fetchContent(t.contentUrl,t.kind)),se=({messageId:e,bodyParts:t,enabled:r=!0})=>{const s=t?q(t):null,n=U(),{getToken:o}=$(),c=a.useRef(null),m=D(),l=a.useRef(!1),h=a.useRef(null),C=e&&s?`${e}:${s.contentUrl}`:null;h.current!==C&&(h.current=C,l.current=!1);const i=F({queryKey:e?[...b.body(e),s?.contentUrl??null]:["messages","body","noop"],queryFn:()=>{if(!s)throw new Error("No renderable body part");if(!e)throw new Error("No messageId");const d=l.current;return l.current=!1,z({fetchContent:(u,S)=>W(u,S,o),refetchDescribeMessage:()=>m.refetchQueries({queryKey:v({path:{messageId:e}})})},{contentUrl:s.contentUrl,kind:s.kind,isRetryAfterNotReady:d})},enabled:r&&!!e&&!!s,staleTime:300*1e3,gcTime:1800*1e3,retry:(d,u)=>u instanceof f&&u.reason==="not-ready"?d<Q:d<1,retryDelay:(d,u)=>u instanceof f&&u.reason==="not-ready"?(l.current=!0,(u.retryAfterSeconds??1)*1e3):1e3,meta:{softError:!0}}),p=i.isLoading&&!!s,x=t!==void 0&&s===null;a.useEffect(()=>{p&&(c.current=performance.now())},[p]),a.useEffect(()=>{i.isSuccess&&c.current!==null&&(n.recordTiming("message.body.load",Math.round(performance.now()-c.current)),c.current=null)},[i.isSuccess,n]);const A=i.data&&s?{kind:s.kind,body:i.data}:void 0;return{picked:s,data:A,isLoading:p,hasNoRenderablePart:x,isError:i.isError,error:i.error,refetch:i.refetch}};export{f as B,j as a,se as b,X as c,J as d,ee as e,te as f,Z as g,V as u};
1
+ import{r as a,u as M,cm as O,cn as N,cN as B,a9 as y,co as P,q as U,ab as $,h as D,c as F,cO as v,cC as L}from"./index-CVyiXes6.js";const w="/mail/brief/compose/{-$outboxMessageId}",R="/mail/flagged/compose/{-$outboxMessageId}",E="/mail/outbox/compose/{-$outboxMessageId}",k="/mail/$mailboxId/compose/{-$outboxMessageId}";function T(){const e=y({from:w,shouldThrow:!1}),t=y({from:R,shouldThrow:!1}),r=y({from:E,shouldThrow:!1}),s=y({from:k,shouldThrow:!1});return e??t??r??s}function j(){return T()!==void 0}function J(){return T()?.outboxMessageId}function _(e,t,r){return e==="flagged"?{to:R,params:{outboxMessageId:r}}:e==="outbox"?{to:E,params:{outboxMessageId:r}}:e==="mailbox"&&t?{to:k,params:{mailboxId:t,outboxMessageId:r}}:{to:w,params:{outboxMessageId:r}}}function g(){const e=M(),t=O(),{list:r,mailboxId:s}=N();return a.useCallback((n,o)=>{e({..._(r,s,n),search:B,hash:o?.keepPanels?!0:t,replace:o?.replace??!1})},[e,t,r,s])}function V(){const e=g();return a.useCallback(()=>e(void 0),[e])}function Z(){const e=g();return a.useCallback(t=>e(t),[e])}function ee(){const e=g();return a.useCallback(t=>e(t,{replace:!0,keepPanels:!0}),[e])}function te(){return P()}const q=e=>{const t=e.filter(n=>!n.isMultipart&&n.disposition!=="attachment"&&n.mediaType==="TEXT"&&n.contentUrl.length>0),r=t.find(n=>n.mediaSubtype.toUpperCase()==="HTML");if(r)return{kind:"html",contentUrl:r.contentUrl};const s=t.find(n=>n.mediaSubtype.toUpperCase()==="PLAIN");return s?{kind:"text",contentUrl:s.contentUrl}:null},b={all:["messages"],detail:e=>[...b.all,"detail",e],body:e=>[...b.detail(e),"body"]};class f extends Error{reason;status;retryAfterSeconds;constructor(t,r,s,n){super(r),this.name="BodyFetchError",this.reason=t,this.status=s,this.retryAfterSeconds=n}}const K=e=>{const t=Number.parseInt(e??"",10);return!Number.isFinite(t)||t<=0?1:Math.min(t,30)},Q=8,I="x-remit-403-reason",X=(e,t)=>{const r=t?.trim()??"";return e===401?"auth":e===403?r.length>0?"auth":"body-missing":e===404?"body-missing":"generic"},G=(e,t)=>(t??"").toLowerCase().startsWith("text/html")?/<div\s+id=["']root["']/i.test(e):!1,H=(e,t)=>{const r=(t??"").toLowerCase();return!!(e==="text"&&r.startsWith("text/html"))},W=async(e,t,r=async()=>null)=>{const s={},n=await r();n&&(s.Authorization=`Bearer ${n}`);const o=await L(e,{headers:s});if(o.status===202)throw new f("not-ready","Message body is still syncing",202,K(o.headers.get("Retry-After")));if(!o.ok){const l=o.headers.get(I),h=X(o.status,l);throw new f(h,`Failed to load message body (${o.status} ${o.statusText})`,o.status)}const c=o.headers.get("content-type");if(H(t,c))throw new f("content-type-mismatch",`Refusing to render message body — expected ${t}, got Content-Type ${c}`);const m=await o.text();if(G(m,c))throw new f("spa-shell-leak","Refusing to render message body — response looks like the SPA shell (CloudFront 403/404 fallback leaked through to /content/*)");return m},z=async(e,t)=>(t.isRetryAfterNotReady&&await e.refetchDescribeMessage(),e.fetchContent(t.contentUrl,t.kind)),se=({messageId:e,bodyParts:t,enabled:r=!0})=>{const s=t?q(t):null,n=U(),{getToken:o}=$(),c=a.useRef(null),m=D(),l=a.useRef(!1),h=a.useRef(null),C=e&&s?`${e}:${s.contentUrl}`:null;h.current!==C&&(h.current=C,l.current=!1);const i=F({queryKey:e?[...b.body(e),s?.contentUrl??null]:["messages","body","noop"],queryFn:()=>{if(!s)throw new Error("No renderable body part");if(!e)throw new Error("No messageId");const d=l.current;return l.current=!1,z({fetchContent:(u,S)=>W(u,S,o),refetchDescribeMessage:()=>m.refetchQueries({queryKey:v({path:{messageId:e}})})},{contentUrl:s.contentUrl,kind:s.kind,isRetryAfterNotReady:d})},enabled:r&&!!e&&!!s,staleTime:300*1e3,gcTime:1800*1e3,retry:(d,u)=>u instanceof f&&u.reason==="not-ready"?d<Q:d<1,retryDelay:(d,u)=>u instanceof f&&u.reason==="not-ready"?(l.current=!0,(u.retryAfterSeconds??1)*1e3):1e3,meta:{softError:!0}}),p=i.isLoading&&!!s,x=t!==void 0&&s===null;a.useEffect(()=>{p&&(c.current=performance.now())},[p]),a.useEffect(()=>{i.isSuccess&&c.current!==null&&(n.recordTiming("message.body.load",Math.round(performance.now()-c.current)),c.current=null)},[i.isSuccess,n]);const A=i.data&&s?{kind:s.kind,body:i.data}:void 0;return{picked:s,data:A,isLoading:p,hasNoRenderablePart:x,isError:i.isError,error:i.error,refetch:i.refetch}};export{f as B,j as a,se as b,X as c,J as d,ee as e,te as f,Z as g,V as u};