@remit/web-client-dist 0.0.482 → 0.0.483

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 (172) hide show
  1. package/assets/BriefPane-D6mVesqu.js +1 -0
  2. package/assets/CalendarShell-CbesY9P5.js +1 -0
  3. package/assets/EmptyState-DYWkEoYy.js +1 -0
  4. package/assets/{ErrorState-4TfgxGLk.js → ErrorState-CQA1uNfQ.js} +1 -1
  5. package/assets/{FlaggedPane-B7mltHsE.js → FlaggedPane-DoeXJfm_.js} +1 -1
  6. package/assets/FullCompose-DdXnvGhK.js +1 -0
  7. package/assets/MailListHeader-Dv4RRNrm.js +7 -0
  8. package/assets/MailNav-v3LcAYtx.js +1 -0
  9. package/assets/MailShell-CqyZkGBA.js +1 -0
  10. package/assets/MailViewChrome-BrAblQ-h.js +1 -0
  11. package/assets/MailboxPane-B1OopvI6.js +1 -0
  12. package/assets/{NavMenuButton-n2Am7T-q.js → NavMenuButton-DsipgLLk.js} +1 -1
  13. package/assets/{OnboardingWizard-BtlDSuHk.js → OnboardingWizard-LMPbQ6jT.js} +1 -1
  14. package/assets/OpenCalendarEvent-jziTx8_b.js +1 -0
  15. package/assets/OutboxPane-C5Ns55rS.js +1 -0
  16. package/assets/_calendarObjectId-BwZvTd4q.js +1 -0
  17. package/assets/_mailboxId-r4aTgexi.js +1 -0
  18. package/assets/_messageId-B1vH4rgJ.js +1 -0
  19. package/assets/_messageId-BtEEXwAi.js +1 -0
  20. package/assets/_messageId-Df_PxEto.js +1 -0
  21. package/assets/_outboxMessageId-CxMGfZJP.js +1 -0
  22. package/assets/_recurrenceId-C2heuIxv.js +1 -0
  23. package/assets/_threadId-BCSAHVdO.js +1 -0
  24. package/assets/_threadId-qoVrigtw.js +1 -0
  25. package/assets/_threadId-vleFQxLm.js +1 -0
  26. package/assets/_view._date-kUsauS8B.js +1 -0
  27. package/assets/accounts-Dzj3yoGR.js +1 -0
  28. package/assets/{advanced-DtxZPECw.js → advanced-DUCDPZSq.js} +3 -3
  29. package/assets/appearance-BOPQSuz4.js +1 -0
  30. package/assets/attachment-file-DClGI76U.js +1 -0
  31. package/assets/{avatar-G7g9Uwvc.js → avatar-wLH6-Ayd.js} +1 -1
  32. package/assets/bottom-sheet-D6dXigqc.js +1 -0
  33. package/assets/{brief-BcQPVd1X.js → brief-BVNqThW-.js} +1 -1
  34. package/assets/brief-DZPDGIPc.js +1 -0
  35. package/assets/browser-ponyfill-CH8d2KQ8.js +2 -0
  36. package/assets/{bug-Dj9DPa4Y.js → bug-C9mbESSL.js} +1 -1
  37. package/assets/calendar-ZcQGYvWc.js +1 -0
  38. package/assets/calendar-_byPswbZ.js +1 -0
  39. package/assets/calendar-days-GutYioyG.js +1 -0
  40. package/assets/card-D55_7IJj.js +1 -0
  41. package/assets/chevron-left-KNAXuraL.js +1 -0
  42. package/assets/{circle-check-big-SYJDr4tY.js → circle-check-big-B1p6oh-i.js} +1 -1
  43. package/assets/circle-check-o0AqGZ-u.js +1 -0
  44. package/assets/{circle-help-BoGPc17x.js → circle-help-DtvJPapE.js} +1 -1
  45. package/assets/clock-Z-oAijsz.js +1 -0
  46. package/assets/compose._-_outboxMessageId_-5aWrcne1.js +1 -0
  47. package/assets/compose._-_outboxMessageId_-Bi_nmcO4.js +1 -0
  48. package/assets/compose._-_outboxMessageId_-D3DAlT64.js +1 -0
  49. package/assets/compose._-_outboxMessageId_-PDfNjd_n.js +1 -0
  50. package/assets/{config-import-1pqti4UQ.js → config-import-CMt0F7iy.js} +1 -1
  51. package/assets/confirm-dialog-XKVleo_p.js +1 -0
  52. package/assets/{credential-steps-BNmmF6YJ.js → credential-steps-Bhbo8-zA.js} +1 -1
  53. package/assets/download-BzIqNtrq.js +1 -0
  54. package/assets/filters-Cp8CCnd5.js +1 -0
  55. package/assets/{flagged-uZGUg7Dw.js → flagged-CLgTXep4.js} +1 -1
  56. package/assets/flagged-D-ptU5v2.js +1 -0
  57. package/assets/folders-BiY-9lME.js +1 -0
  58. package/assets/{format-BSk7Do06.js → format-CCaI2KqP.js} +1 -1
  59. package/assets/{help-copy-D6t16AP5.js → help-copy-DawC2xSA.js} +1 -1
  60. package/assets/import-CJAbCD1j.js +1 -0
  61. package/assets/index-BDh85s_o.js +1 -0
  62. package/assets/index-BluhX7J5.js +1 -0
  63. package/assets/index-BqjhYbTK.js +1 -0
  64. package/assets/index-BtEEXwAi.js +1 -0
  65. package/assets/index-CJDhCMZY.js +1 -0
  66. package/assets/index-CeziyGm_.js +1 -0
  67. package/assets/index-CxA7LBuE.js +1 -0
  68. package/assets/index-D8-XdCBI.js +1 -0
  69. package/assets/index-Df_PxEto.js +1 -0
  70. package/assets/index-lqmSDAG_.js +1 -0
  71. package/assets/{index-FpwHnbdV.js → index-lxVTsHBH.js} +64 -64
  72. package/assets/{index-CYwsmjFx.js → index-y3enq74c.js} +6 -6
  73. package/assets/kbd-Ds8JAL-i.js +1 -0
  74. package/assets/labels-CwARLqAD.js +1 -0
  75. package/assets/mail-Bux3edOt.js +1 -0
  76. package/assets/mail-CSpgLNSC.js +1 -0
  77. package/assets/menu-D6aq1T1f.js +1 -0
  78. package/assets/minus-DW1FraKg.js +1 -0
  79. package/assets/new-DwJ7NLZR.js +1 -0
  80. package/assets/onboarding-0lqsEEMH.js +1 -0
  81. package/assets/onboarding-completion-WuK4B8wi.js +1 -0
  82. package/assets/outbox-4__1O2vy.js +1 -0
  83. package/assets/{pencil-DSzm4tGc.js → pencil-DJPntSjN.js} +1 -1
  84. package/assets/{rich-text-Bi1khhyl.js → rich-text-Ticmqq6R.js} +1 -1
  85. package/assets/{rich-text-spellcheck-worker-provider-vLdWVTOw.js → rich-text-spellcheck-worker-provider-CEjXNkTo.js} +1 -1
  86. package/assets/rotate-ccw-Snzk6-SP.js +1 -0
  87. package/assets/{row-actions-DgziqjAx.js → row-actions-BY8sJ70m.js} +1 -1
  88. package/assets/search-mirror-CgMxavNa.js +1 -0
  89. package/assets/{search-scope-DTcpOp3S.js → search-scope-B5-OK3Cq.js} +1 -1
  90. package/assets/search-token-index-D1mRODfF.js +1 -0
  91. package/assets/sections-BaNfgGs8.js +1 -0
  92. package/assets/senders-DtfLvp-S.js +1 -0
  93. package/assets/settings-JoaCyeEy.js +1 -0
  94. package/assets/settings-screen-D5PdsyBl.js +1 -0
  95. package/assets/shield-check-Bvnu7s8U.js +1 -0
  96. package/assets/{suggested-vips-CtCLsdy6.js → suggested-vips-W8f9qNN8.js} +1 -1
  97. package/assets/useCalendarData-CBjm4DbE.js +1 -0
  98. package/assets/{useDebouncedValue-DU11pzlc.js → useDebouncedValue-D4EGUdvx.js} +1 -1
  99. package/assets/{useFilters-BBJu_93Q.js → useFilters-CW_hrFZo.js} +1 -1
  100. package/assets/useLabels-Dlob_XK-.js +1 -0
  101. package/assets/useLayoutTier-Ciq4HlaK.js +1 -0
  102. package/assets/useMessageBodyContent-CUM4C6Cq.js +1 -0
  103. package/assets/useQueries-CPnZMt_1.js +1 -0
  104. package/assets/useRefreshControl-DiNXvxEh.js +1 -0
  105. package/assets/{useSearchTokenContext-DH5XswlU.js → useSearchTokenContext-mRvSGuNd.js} +4 -4
  106. package/assets/useSemanticSearch-DqVnsXbc.js +1 -0
  107. package/assets/{useSignature-HAuR6_Ul.js → useSignature-CrrwTrAx.js} +1 -1
  108. package/index.html +1 -1
  109. package/package.json +1 -1
  110. package/assets/BriefPane-CfitNMEu.js +0 -1
  111. package/assets/FullCompose-0DIPCtd6.js +0 -1
  112. package/assets/MailListHeader-Brjq4vBE.js +0 -7
  113. package/assets/MailShell-CvGuWCuj.js +0 -1
  114. package/assets/MailViewChrome-C7sCKY-n.js +0 -1
  115. package/assets/MailboxPane-COHQn6Yb.js +0 -1
  116. package/assets/OutboxPane-C-_EQFRO.js +0 -1
  117. package/assets/_mailboxId-Bqbp7c9M.js +0 -1
  118. package/assets/_messageId-BAluf3UO.js +0 -1
  119. package/assets/_messageId-CHs89GPR.js +0 -1
  120. package/assets/_messageId-Ctd9_Bl1.js +0 -1
  121. package/assets/_outboxMessageId-_2jJC1Qb.js +0 -1
  122. package/assets/_threadId-BYyW8ujt.js +0 -1
  123. package/assets/_threadId-BrgLQ-Pl.js +0 -1
  124. package/assets/_threadId-C9FCiXzy.js +0 -1
  125. package/assets/accounts-D3L3nj2z.js +0 -1
  126. package/assets/appearance-OV39hcLF.js +0 -1
  127. package/assets/attachment-file-ul58bxI4.js +0 -1
  128. package/assets/bottom-sheet-B6YVIwAN.js +0 -1
  129. package/assets/brief-Bc68FlBf.js +0 -1
  130. package/assets/browser-ponyfill-DXnwXxSp.js +0 -2
  131. package/assets/card-B1IEp2-a.js +0 -1
  132. package/assets/circle-check-CsnMhxDa.js +0 -1
  133. package/assets/clock-C2olBfsH.js +0 -1
  134. package/assets/compose._-_outboxMessageId_-C_qZJ56q.js +0 -1
  135. package/assets/compose._-_outboxMessageId_-DKWODs5S.js +0 -1
  136. package/assets/compose._-_outboxMessageId_-DwRvAUq2.js +0 -1
  137. package/assets/compose._-_outboxMessageId_-mWQ2SoXJ.js +0 -1
  138. package/assets/confirm-dialog-B4KJVTQx.js +0 -1
  139. package/assets/download-vw3zYEkx.js +0 -1
  140. package/assets/filters-BmW8kKxW.js +0 -1
  141. package/assets/flagged-R318UqUZ.js +0 -1
  142. package/assets/folders-CkYvGGkZ.js +0 -1
  143. package/assets/import-CNvHrBcn.js +0 -1
  144. package/assets/index-2Vc2Ycg0.js +0 -1
  145. package/assets/index-BBBVjIQK.js +0 -1
  146. package/assets/index-CAPjLYZ5.js +0 -1
  147. package/assets/index-CHs89GPR.js +0 -1
  148. package/assets/index-COugriit.js +0 -1
  149. package/assets/index-Ctd9_Bl1.js +0 -1
  150. package/assets/index-D93knX1J.js +0 -1
  151. package/assets/index-N1RMrj2-.js +0 -1
  152. package/assets/kbd-tXno4rYH.js +0 -1
  153. package/assets/labels-D8dMllXL.js +0 -1
  154. package/assets/mail-CFC6XnIq.js +0 -1
  155. package/assets/mail-DmVe7n1g.js +0 -1
  156. package/assets/menu-B-aaGy7K.js +0 -1
  157. package/assets/onboarding-completion-YE4GukFN.js +0 -1
  158. package/assets/onboarding-vJtatS1N.js +0 -1
  159. package/assets/outbox-C9Rxk-WO.js +0 -1
  160. package/assets/rotate-ccw-CwLIBdgY.js +0 -1
  161. package/assets/search-mirror-B2LoSoNR.js +0 -1
  162. package/assets/search-token-index-C9KNJC5_.js +0 -1
  163. package/assets/sections-DDQm-Sbc.js +0 -1
  164. package/assets/senders-BWTk7Fqx.js +0 -1
  165. package/assets/settings-B4qmCAFR.js +0 -1
  166. package/assets/settings-screen-m0Uy9zlo.js +0 -1
  167. package/assets/shield-check-Cs0C_oxK.js +0 -1
  168. package/assets/useLabels-GtiakPKP.js +0 -1
  169. package/assets/useMessageBodyContent-BOBb68Px.js +0 -1
  170. package/assets/useQueries-Dx2PHSps.js +0 -1
  171. package/assets/useRefreshControl-CWjutjgw.js +0 -1
  172. package/assets/useSemanticSearch-CZUtmciE.js +0 -1
@@ -1,4 +1,4 @@
1
- import{c as Jr,r as O,j as F,a as nf,d_ as ku,p as da,am as ho,d$ as Ap,e0 as Fp,B as zp,bK as xu,bF as Op,bG as Mp,n as jp,a1 as Rp,e1 as Pp,t as Lp,L as Ip,e2 as Bp}from"./index-FpwHnbdV.js";import{s as ml,c as Cu,a as Kp}from"./index-CYwsmjFx.js";import{C as Wp}from"./confirm-dialog-B4KJVTQx.js";import{B as qp}from"./bottom-sheet-B6YVIwAN.js";import{a as Up,b as Hp,c as js,f as vu,U as Jp}from"./attachment-file-ul58bxI4.js";import{o as JC}from"./rich-text-spellcheck-provider-J8m9wz6A.js";import"./useMessageBodyContent-BOBb68Px.js";import"./useSignature-HAuR6_Ul.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DU11pzlc.js";import"./sections-DDQm-Sbc.js";import"./format-BSk7Do06.js";const Vp=Jr("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 Yp=Jr("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 Xp=Jr("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 Gp=Jr("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 Qp=Jr("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 Zp=Jr("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"}]]),$C={html:"",text:"",formatting:[]},em={account:"the account default",detected:"detected from what you wrote",manual:"chosen for this message"},tm=({language:n,languages:e,source:t,onSelect:r,helpText:o})=>{const[i,s]=O.useState(!1),a=O.useRef(null),l=O.useRef(null),u=O.useRef(null),c=O.useId(),d=O.useCallback(g=>{s(!1),g&&l.current?.focus()},[]);O.useEffect(()=>{if(!i)return;const g=m=>{a.current?.contains(m.target)||s(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[i]),O.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=Fp(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(nf,{ref:l,variant:"ghost",size:"md","aria-label":`Message language: ${ho(n)}, ${em[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:da("min-h-11 min-w-11 shrink-0 px-2 font-medium",n!==e[0]&&"bg-accent-2-soft text-accent-2"),children:ku(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:da("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:[ho(g),F.jsx("span",{className:"shrink-0 text-xs text-fg-subtle",children:ku(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??Ap(navigator.userAgent)})]})]})},nm=({mode:n,onToggle:e})=>F.jsx(nf,{variant:"ghost",size:"md","aria-pressed":n==="plain",title:"Plain text",onClick:e,"data-testid":"compose-mode-toggle",className:da("min-h-11 shrink-0",n==="plain"&&"bg-accent-2-soft text-accent-2"),children:"Plain text"}),rm=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),rf=n=>{const e=n.activeElement;return e?.shadowRoot?rf(e.shadowRoot)??e:e},om=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!rm.has(r)}const t=n.getAttribute("contenteditable");return t!==null&&t.toLowerCase()!=="false"?!0:n.isContentEditable===!0},of=n=>{const e=n?.ownerDocument??globalThis.document;if(!e)return!1;const t=rf(e);return!t||t===n||n?.contains(t)?!1:om(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 sf(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 et=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,im=et&&"documentMode"in document?document.documentMode:null,Ft=et&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Pt=et&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Fr=!(!et||!("InputEvent"in window)||im)&&"getTargetRanges"in new window.InputEvent("input"),En=et&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,af=et&&/Android/.test(navigator.userAgent),jo=et&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!af,lf=et&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ei=et&&af&&lf,Ro=et&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Ft&&!lf,sm=0,am=1,lm=2,fa=1,ha=2,ga=4,pa=8,um=16,Rs=32,Ps=64,yl=128,cm=1,dm=2,fm=3,hm=4,gm=5,pm=6,ko=jo||En||Ro?" ":"​",In=`
1
+ import{e as Jr,r as O,j as F,f as nf,e7 as ku,t as da,an as ho,e8 as Ap,e9 as Fp,B as zp,bG as xu,bJ as Op,bK as Mp,U as jp,E as Rp,ea as Pp,_ as Lp,L as Ip,eb as Bp}from"./index-lxVTsHBH.js";import{s as ml,c as Cu,a as Kp}from"./index-y3enq74c.js";import{C as Wp}from"./confirm-dialog-XKVleo_p.js";import{B as qp}from"./bottom-sheet-D6dXigqc.js";import{a as Up,b as Hp,c as js,f as vu,U as Jp}from"./attachment-file-DClGI76U.js";import{o as JC}from"./rich-text-spellcheck-provider-J8m9wz6A.js";import"./useMessageBodyContent-CUM4C6Cq.js";import"./useSignature-CrrwTrAx.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-D4EGUdvx.js";import"./sections-BaNfgGs8.js";import"./format-CCaI2KqP.js";const Vp=Jr("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 Yp=Jr("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 Xp=Jr("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 Gp=Jr("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 Qp=Jr("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 Zp=Jr("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"}]]),$C={html:"",text:"",formatting:[]},em={account:"the account default",detected:"detected from what you wrote",manual:"chosen for this message"},tm=({language:n,languages:e,source:t,onSelect:r,helpText:o})=>{const[i,s]=O.useState(!1),a=O.useRef(null),l=O.useRef(null),u=O.useRef(null),c=O.useId(),d=O.useCallback(g=>{s(!1),g&&l.current?.focus()},[]);O.useEffect(()=>{if(!i)return;const g=m=>{a.current?.contains(m.target)||s(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[i]),O.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=Fp(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(nf,{ref:l,variant:"ghost",size:"md","aria-label":`Message language: ${ho(n)}, ${em[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:da("min-h-11 min-w-11 shrink-0 px-2 font-medium",n!==e[0]&&"bg-accent-2-soft text-accent-2"),children:ku(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:da("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:[ho(g),F.jsx("span",{className:"shrink-0 text-xs text-fg-subtle",children:ku(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??Ap(navigator.userAgent)})]})]})},nm=({mode:n,onToggle:e})=>F.jsx(nf,{variant:"ghost",size:"md","aria-pressed":n==="plain",title:"Plain text",onClick:e,"data-testid":"compose-mode-toggle",className:da("min-h-11 shrink-0",n==="plain"&&"bg-accent-2-soft text-accent-2"),children:"Plain text"}),rm=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),rf=n=>{const e=n.activeElement;return e?.shadowRoot?rf(e.shadowRoot)??e:e},om=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!rm.has(r)}const t=n.getAttribute("contenteditable");return t!==null&&t.toLowerCase()!=="false"?!0:n.isContentEditable===!0},of=n=>{const e=n?.ownerDocument??globalThis.document;if(!e)return!1;const t=rf(e);return!t||t===n||n?.contains(t)?!1:om(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 sf(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 et=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,im=et&&"documentMode"in document?document.documentMode:null,Ft=et&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Pt=et&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Fr=!(!et||!("InputEvent"in window)||im)&&"getTargetRanges"in new window.InputEvent("input"),En=et&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,af=et&&/Android/.test(navigator.userAgent),jo=et&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!af,lf=et&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ei=et&&af&&lf,Ro=et&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Ft&&!lf,sm=0,am=1,lm=2,fa=1,ha=2,ga=4,pa=8,um=16,Rs=32,Ps=64,yl=128,cm=1,dm=2,fm=3,hm=4,gm=5,pm=6,ko=jo||En||Ro?" ":"​",In=`
2
2
 
3
3
  `,_l=Pt?" ":ko,hn={bold:1,capitalize:1024,code:16,highlight:yl,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},mm={directionless:1,unmergeable:2},Ti={center:2,end:6,justify:4,left:1,right:3,start:5},ym={[dm]:"center",[pm]:"end",[hm]:"justify",[cm]:"left",[fm]:"right",[gm]:"start"},_m={normal:0,segmented:2,token:1},bm={[sm]:"normal",[lm]:"segmented",[am]:"token"},Su="$config";function wu(){return we()._blockCursorElement}function km(n){return n!==null&&n.nodeType===1&&n.hasAttribute("data-lexical-slot")}let uf=class gi{element;before;after;constructor(e,t,r){this.element=e,this.before=t||null,this.after=r||null}withBefore(e){return new gi(this.element,e,this.after)}withAfter(e){return new gi(this.element,this.before,e)}withElement(e){return this.element===e?this:new gi(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=Eu(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=Eu(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 Eu(n,e){let t=e;for(;t!==null&&t.parentNode!==n;)t=t.parentNode;return t}let cf=class pi extends uf{withBefore(e){return new pi(this.element,e,this.after)}withAfter(e){return new pi(this.element,this.before,e)}withElement(e){return this.element===e?this:new pi(e,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()}getFirstChildAnchor(){let e=super.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;for(;km(t);)e=t,t=t.nextSibling;const r=e?e.nextSibling:this.element.firstChild;return r!==null&&r===wu()?r:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(this.element.__lexicalLastChildKind=e,e===null)this.removeManagedLineBreak();else{const t=e==="decorator"&&(Ro||En||jo);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=wu(),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=Tu(t,r);i.push(o);const s=Tu(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 Tu(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 df;try{df="0.49.0+prod.esm"}catch{}const ff=df??'"<unknown>+source"';let eo=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 Mn=null;function hf(n,e=1e3){return n instanceof ma?n.clone():n.size<e?new Map(n):new ma().init(new Map(n),void 0,n.size)}let ma=class gf{_mutable=!1;_old=void 0;_nursery=void 0;_size=0;clone(){return this._mutable=!1,new gf().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===Mn?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!==Mn?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!==Mn&&r!==void 0||(this._size++,r===Mn&&o.delete(e)),o.set(e,t),this}delete(e){const t=this.has(e);return t&&(this.getNursery().set(e,Mn),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!==Mn&&(i!==void 0&&(r[1]=i),yield r)}if(e)for(const r of e)r[1]===Mn||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 Ni(n,e,t,r,o,i){if(C(n)){let s=n.getFirstChild();for(;s!==null;){const a=s.__key;s.__parent===e&&((C(s)||dn(s)&&s.__slots!==null)&&Ni(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&&Yn(a)&&a.__slotHost===e&&((C(a)||dn(a)&&a.__slots!==null)&&Ni(a,s,t,r,o,i),t.has(s)||i.delete(s),o.push(s))}}let ya=!1,bl=0;function xm(n){bl=n.timeStamp}function Ls(n,e,t){const r=n.nodeName==="BR",o=e.__lexicalLineBreak;return o&&(n===o||r&&n.previousSibling===o)||r&&Xr(n,t)!==void 0}function Cm(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&&Ll(e,a,i,s,!1)}function vm(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 Sm(n,e,t){for(let r=n;r&&!Bh(r);r=or(r)){const o=Xr(r,e);if(o!==void 0){const i=te(o,t);if(i)return ne(i)||!q(r)?void 0:[r,i]}}}function pf(n,e,t){ya=!0;const r=performance.now()-bl>100;try{wt(n,()=>{const o=z()||(function(d){return d.read("latest",()=>{const f=z();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=Sm(g,n,s);if(!m)continue;const[p,y]=m;if(h==="characterData")r&&D(y)&&ht(g)&&vm(o,g,y)&&Cm(g,y,n);else if(h==="childList"){l=!0;const _=f.addedNodes;for(let S=0;S<_.length;S++){const x=_[S],w=Eh(x),v=x.parentNode;if(!(v==null||x===a||w!==null||Ls(x,v,n)||n._slotsUsed&&q(x)&&x.hasAttribute("data-lexical-slot")||Bh(x))){if(Pt){const E=(q(x)?x.innerText:null)||x.nodeValue;E&&(u+=E)}v.removeChild(x)}}const b=f.removedNodes,k=b.length;if(k>0){let S=0;for(let x=0;x<k;x++){const w=b[x];(Ls(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"||Ls(p,g,n)||y.removeChild(p)}}t.takeRecords()}o!==null&&(l&&_e(o),Pt&&Fh(n)&&o.insertRawText(u))})}finally{ya=!1}}function mf(n){const e=n._observer;e!==null&&pf(n,e.takeRecords(),e)}function yf(n){(function(e){bl===0&&gt(e).addEventListener("textInput",xm,!0)})(n),n._observer=new MutationObserver((e,t)=>{pf(n,e,t)})}const Nu="latest";let wm=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||Nm).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function Po(n,e){return new wm(n,e)}function Lo(n,e,t=Nu){const r=(t===Nu?n.getLatest():n).__state;return r?r.getValue(e):e.defaultValue}function Cr(n,e,t){let r;if(Ie(),typeof t=="function"){const i=n.getLatest(),s=Lo(i,e);if(r=t(s),e.isEqual(s,r))return i}else r=t;const o=n.getWritable();return bf(o).updateFromKnown(e,r),o}function Em(n){const e=new Map,t=new Set;for(const{ownNodeConfig:r}of Ul(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 Du=new Set(["__proto__","constructor","prototype"]);let Tm=class _f{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 $u(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 _f(e,t,(function(i,s,a){let l;if(a)for(const[u,c]of Object.entries(a)){if(Du.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=$u(i)),this.size++),o.set(e,t)}updateFromUnknown(e,t){if(Du.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 bf(n){const e=n.getWritable(),t=e.__state?e.__state.getWritable(e):new Tm(e,kf(e));return e.__state=t,t}function kf(n){return n.__state?n.__state.sharedNodeState:vh(we(),n.getType()).sharedNodeState}function $u(n){if(n)for(const e in n)return n}function Nm(n){return n}function Au(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 Fu(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 zu(n,e){const t=n.__state;return t&&t.node===n?t.getWritable(e):t}function Ou(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&&Au(f,c,d)||d&&Au(f,d,c)||c&&Fu(f,c,d)||d&&Fu(f,d,c))})(l,u))}function Mu(n,e){const t=n.mergeWithSibling(e),r=he()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function ju(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(Ou(e,r)){r=Mu(e,r);break}break}e.remove()}for(;(t=r.getNextSibling())!==null&&D(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Ou(r,t)){r=Mu(r,t);break}break}t.remove()}}else r.remove()}function Kt(n){return Ru(n.anchor),Ru(n.focus),n}function Ru(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(!C(r))break;n.set(r.__key,o?r.getChildrenSize():0,"element",!0)}}const xo=Symbol.for("@lexical/CachedTextSize");function Pu(n,e){return ba.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),C(i)){const s=De.get(r);if(s!==void 0&&C(s)&&s.__parent!==i.__parent)t+=i.getTextContentSize();else{const a=qn.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[xo];s===void 0&&$(347,i.getType(),r),t+=s}r=i.__next}return t},{editor:de})}function xf(n){C(n)||n[xo]===void 0&&(n[xo]=D(n)?n.__text.length:n.getTextContentSize())}const Dm=4;let Co,de,vo,oe="",ze=null,Ye=null,qe=null;function Wt(){return{firstTextKey:qe,format:ze,style:Ye}}function Ct(n){n.firstTextKey!==null&&(ze=n.format,Ye=n.style,qe=n.firstTextKey)}function _a(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(),Ye=t.getStyle(),qe=e)}let ls,go,po,zt,ba,De,qn,ka,So,Un,ln=!1,Di=!1;function xn(n,e){const t=zt.get(n),r=De.has(n);if(e!==null){const o=wa(n);o.parentNode===e&&e.removeChild(o)}if(!r){if(de._keyToDOMMap.delete(n),C(t)){const o=Vi(t,zt);xa(o,0,o.length-1,null)}if(t!==void 0){for(const o of pt(t).values()){const i=va(o);xn(o,null),i!==null&&i.remove()}Il(So,vo,ls,t,"destroyed")}}}function xa(n,e,t,r){for(let o=e;o<=t;++o){const i=n[o];i!==void 0&&xn(i,r)}}function jn(n,e){n.setProperty("text-align",e)}const $m="40px";function Cf(n,e){const t=Co.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, ${$m}))`)}function vf(n,e){const t=n.style;e===0?jn(t,""):e===1?jn(t,"left"):e===2?jn(t,"center"):e===3?jn(t,"right"):e===4?jn(t,"justify"):e===5?jn(t,"start"):e===6&&jn(t,"end")}function Ca(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 Sf(n){const e=ae().createElement("div");return e.setAttribute("data-lexical-slot",n),e.style.display="none",e}function wf(n,e,t){e||n.contentEditable==="false"?Ly(t,de):t.removeAttribute("contenteditable")}function Lu(n,e,t){const r=oe,o=Wt();oe="";let i="";const s=ne(n);for(const[a,l]of t){const u=Sf(a);wf(e,s,u),e.appendChild(u),oe="";const c=Wt();Cn(l,Dt(n,u,de)),Ct(c),Ef(n,a,e,u),i+=oe}return Ct(o),oe=r,i}function pt(n){return dn(n)&&n.__slots!==null?n.__slots:qh}function Ef(n,e,t,r){const o=Un.$getSlotTargetElement(n,e,t,de);o!==null&&(r.parentElement!==o&&o.appendChild(r),r.style.display="")}function va(n){const e=qn.get(n);return e!==void 0?e.parentElement:null}function Iu(n,e,t){const r=pt(n),o=pt(e);for(const[c,d]of r)if(!o.has(c)){const f=va(d);xn(d,null),f!==null&&f.remove()}const i=oe,s=Wt();let a="",l=null;const u=ne(e);for(const[c,d]of o){const f=r.get(c);let h=f!==void 0?va(f):null;oe="";const g=Wt();if(h===null){h=Sf(c);let m=null;for(const p of t.children)if(!p.hasAttribute("data-lexical-slot")){m=p;break}t.insertBefore(h,m),Cn(d,Dt(e,h,de))}else f===d?an(d,h):(f!==void 0&&xn(f,h),Cn(d,Dt(e,h,de)));if(Ct(g),wf(t,u,h),Ef(e,c,t,h),a+=oe,h.parentElement===t){const m=l===null?t.firstChild:l.nextSibling;m!==h&&t.insertBefore(h,m),l=h}}return Ct(s),oe=i,a}function Cn(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=qn.get(n);if(i!==void 0){const s=Yn(o)?o.__slotHost:null,a=Yn(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=Un.$createDOM(t,de);if((function(o,i,s){const a=s._keyToDOMMap;Th(i,s,o),a.set(o,i)})(n,r,de),D(t)?r.setAttribute("data-lexical-text","true"):ne(t)&&(r.setAttribute("data-lexical-decorator","true"),Hi(r,{captureSelection:!0})),C(t)){const o=t.__indent,i=t.__size;Ca(r,t),o!==0&&Cf(r,o);const s=pt(t),a=s.size>0?Lu(t,r,s):"";if(i===0)r.__lexicalTextContent=a,r.__lexicalFirstTextKey=null,oe+=a,s.size>0&&(r.__lexicalSlotTextLength=a.length);else{const u=oe,c=i-1;if(Sa(Vi(t,De),t,0,c,Dt(t,r,de)),a!==""){const d=r.__lexicalTextContent||"";r.__lexicalTextContent=a+d,oe=u+a+d}s.size>0&&(r.__lexicalSlotTextLength=a.length)}const l=t.__format;l!==0&&vf(r,l),t.isInline()||Tf(null,t,r)}else{const o=t.getTextContent();if(ne(t)){const i=t.decorate(de,Co);i!==null&&Nf(n,i),r.contentEditable="false";const s=pt(t);s.size>0&&Lu(t,r,s)}oe+=o}return e!==null&&e.insertChild(r),Un.$decorateDOM(t,null,r,de),xf(t),Il(So,vo,ls,t,"created"),r}function Sa(n,e,t,r,o){const i=oe,s=Wt();oe="",ze=null,Ye=null,qe=null;let a=t;for(;a<=r;++a){const u=Wt();Cn(n[a],o);const c=De.get(n[a]);c!==null&&D(c)?ze===null&&(ze=c.getFormat(),Ye=c.getStyle(),qe=c.__key):C(c)&&a<r&&!c.isInline()&&(oe+=In),Ct(u)}const l=de._keyToDOMMap.get(e.__key);l===void 0&&$(349,e.__key),l.__lexicalTextContent=oe,l.__lexicalFirstTextKey=qe,oe=i+oe,Ct(s)}function Tf(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":ne(u)&&u.isInline()?"decorator":null}return pt(s).size>0?null:"empty"}return null})(e,De);o!==i&&r.setManagedLineBreak(i)}function Am(n,e,t){var r;ze=null,Ye=null,qe=null,(function(o,i,s){const a=oe,l=o.__size,u=i.__size;oe="";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>=Dm&&o.__first===i.__first&&(f!==0||!de._cloneNotNeeded.has(o.__key))){const h=d.__lexicalTextContent,g=ka.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 x=De.get(b);if(x===void 0)return null;b=x.__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=Pu(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(),Ye=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(C(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&&C(v)&&!v.isInline()&&(k+=In),_=v.__next,b++}const S=d.__lexicalSlotTextLength||0,x=S>0?h.slice(S):h,w=x.slice(0,x.length-y)+k;return d.__lexicalTextContent=w,oe=a+w,void Bu(i,d,g)}if((function(y,_,b,k,S,x,w,v){if(v!==1&&v!==-1||w!==(v===1?2:1))return!1;const A=w-v;let T=y.__last;for(let re=0;re<A-1;re++){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 M=De.get(x),j=zt.get(T);if(M===void 0||j===void 0||M.__prev!==j.__prev)return!1;const R=[];let B=x;for(let re=0;re<w;re++){if(B===null)return!1;R.push(B);const $e=De.get(B);B=$e?$e.__next:null}const Q=[];B=T;for(let re=0;re<A;re++){if(B===null)return!1;Q.push(B);const $e=zt.get(B);B=$e?$e.__next:null}const ie=new Set(Q),Z=new Set(R),L=[];let P=0,K=0;for(;P<A&&K<w;)if(R[K]===Q[P])L.push({key:R[K],kind:"reconcile"}),P++,K++;else if(Z.has(Q[P])){if(ie.has(R[K]))return!1;L.push({key:R[K],kind:"create",nextIndex:K}),K++}else L.push({key:Q[P],kind:"destroy"}),P++;for(;P<A;)L.push({key:Q[P++],kind:"destroy"});for(;K<w;)L.push({key:R[K],kind:"create",nextIndex:K}),K++;const se=Pu(T,A);for(const re of L){const $e=Wt();if(re.kind==="reconcile")an(re.key,b.element);else if(re.kind==="destroy")xn(re.key,b.element);else{let it=null;for(let nn=re.nextIndex+1;nn<w;nn++){const _n=de._keyToDOMMap.get(R[nn]);if(_n!==void 0){it=_n;break}}Cn(re.key,b.withBefore(it??b.before))}if(re.kind!=="destroy"){const it=De.get(re.key);it&&D(it)&&ze===null&&(ze=it.getFormat(),Ye=it.getStyle(),qe=it.__key)}Ct($e)}let ee="";for(let re=0;re<w;re++){const $e=De.get(R[re]);if($e===void 0)return!1;let it;if(C($e)){const nn=de._keyToDOMMap.get(R[re]),_n=nn&&nn.__lexicalTextContent;typeof _n!="string"&&$(350,$e.getType()),it=_n}else it=$e.getTextContent();ee+=it,re<w-1&&C($e)&&!$e.isInline()&&(ee+=In)}const xe=k.__lexicalSlotTextLength||0,ot=xe>0?S.slice(xe):S;return k.__lexicalTextContent=ot.slice(0,ot.length-se)+ee,!0})(o,0,s,d,h,m,p,f)){const y=d.__lexicalTextContent;return typeof y!="string"&&$(353),oe=a+y,void Bu(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||po.has(m)||go.has(m),b=Wt();if(_)an(m,c);else{let k,S;if(C(y)){S=qn.get(m);const x=S&&S.__lexicalTextContent;typeof x!="string"&&$(354,y.getType()),k=x}else k=y.getTextContent();oe+=k,S!==void 0&&_a(S)}D(y)?ze===null&&(ze=y.getFormat(),Ye=y.getStyle(),qe=y.__key):C(y)&&p<u-1&&!y.isInline()&&(oe+=In),Ct(b),m=y.__next,p++}return d.__lexicalTextContent=oe,d.__lexicalFirstTextKey=qe,void(oe=a+oe)}}if(l===1&&u===1){const h=o.__first,g=i.__first;if(h===g)an(h,c);else{const p=wa(h),y=Cn(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 _}xn(h,null)}const m=De.get(g);D(m)&&ze===null&&(ze=m.getFormat(),Ye=m.getStyle(),qe=m.__key)}else{const h=Vi(o,zt),g=Vi(i,De);if(h.length!==l&&$(227),g.length!==u&&$(228),l===0)u!==0&&Sa(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;xa(h,0,l-1,m?null:c),m&&(c.textContent="")}}else(function(m,p,y,_,b,k){const S=_-1,x=b-1;let w,v,E=k.getFirstChild(),A=0,T=0;for(;A<=S&&T<=x;){const R=p[A],B=y[T],Q=Wt();if(R===B)E=Is(an(B,k.element)),A++,T++;else{if(v===void 0&&(v=Ku(y,T)),w===void 0)w=Ku(p,A);else if(!w.has(R)){A++,Ct(Q);continue}if(!v.has(R)){E=Is(wa(R)),xn(R,k.element),A++,w.delete(R),Ct(Q);continue}if(w.has(B)){const Z=Pr(de,B);Z!==E&&k.withBefore(E??k.before).insertChild(Z),E=Is(an(B,k.element)),A++,T++}else Cn(B,k.withBefore(E??k.before)),T++}const ie=De.get(B);ie!==null&&D(ie)?ze===null&&(ze=ie.getFormat(),Ye=ie.getStyle(),qe=ie.__key):C(ie)&&T<=x&&!ie.isInline()&&(oe+=In),Ct(Q)}const M=A>S,j=T>x;if(M&&!j){const R=y[x+1],B=R===void 0?null:de.getElementByKey(R);Sa(y,m,T,x,k.withBefore(B??k.before))}else j&&!M&&xa(p,A,S,k.element)})(i,h,g,l,u,s)}d.__lexicalTextContent=oe,d.__lexicalFirstTextKey=qe,oe=a+oe})(n,e,Dt(e,t,de)),Se(e)||(r=e,ze==null||ze===r.__textFormat||Di||r.setTextFormat(ze),(function(o){Ye==null||Ye===o.__textStyle||Di||o.setTextStyle(Ye)})(e))}function Bu(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(Ye=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||po.has(n)||go.has(n),i=Pr(de,n);if(t===r&&!o){let s;if(C(t)){const a=i.__lexicalTextContent;typeof a!="string"&&$(355,t.getType()),s=a,_a(i)}else s=t.getTextContent();return oe+=s,i}if(t!==r&&o&&Il(So,vo,ls,r,"updated"),Un.$updateDOM(r,t,i,de)){const s=Cn(n,null);return e===null&&$(62),e.replaceChild(s,i),xn(n,null),s}if(C(t)){C(r)||$(334,n);const s=r.__indent;(ln||s!==t.__indent)&&Cf(i,s);const a=r.__format;(ln||a!==t.__format)&&vf(i,a);const l=o&&(pt(r).size>0||pt(t).size>0)?Iu(t,r,i):"";if(o){const u=oe;if(Am(t,r,i),Oe(r)||r.isInline()||Tf(0,r,i),l!==""){const c=i.__lexicalTextContent||"";i.__lexicalTextContent=l+c,oe=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()),oe+=u,_a(i)}if((ln||r.__dir!==t.__dir||r.__parent!==t.__parent)&&(Ca(i,r),Oe(r)&&!ln))for(const u of r.getChildren())C(u)&&Ca(Pr(de,u.getKey()),u)}else{const s=r.getTextContent();if(ne(r)){const a=r.decorate(de,Co);a!==null&&Nf(n,a),o&&(pt(r).size>0||pt(t).size>0)&&Iu(t,r,i)}oe+=s}if(!Di&&Oe(r)){const s=r.getLatest();if(s.__cachedText!==oe){const a=s.getWritable();a.__cachedText=oe,r=a}}return Un.$decorateDOM(r,t,i,de),xf(r),i}function Nf(n,e){let t=de._pendingDecorators;const r=de._decorators;if(t===null){if(r[n]===e)return;t=Nh(de)}t[n]=e}function Is(n){let e=n.nextSibling;return e!==null&&e===de._blockCursorElement&&(e=e.nextSibling),e}function Ku(n,e){const t=new Set;for(let r=e;r<n.length;r++)t.add(n[r]);return t}function Fm(n,e,t,r,o,i){oe="",ze=null,Ye=null,qe=null,ln=r===2,de=t,Co=t._config,Un=t._config.dom||Bi,vo=t._nodes,ls=de._listeners.mutation,go=o,po=i,zt=n._nodeMap,ba=n,De=e._nodeMap,Di=e._readOnly,qn=hf(t._keyToDOMMap),ka=(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(go.keys()),l(po),a})();const s=new Map;return So=s,an("root",null),de=void 0,vo=void 0,go=void 0,po=void 0,zt=void 0,ba=void 0,De=void 0,Co=void 0,qn=void 0,ka=void 0,So=void 0,Un=Bi,s}function wa(n){const e=qn.get(n);return e===void 0&&$(75,n),e}function W(n){return{type:n}}const qt=W("SELECTION_CHANGE_COMMAND"),Df=W("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),us=W("CLICK_COMMAND"),$f=W("BEFORE_INPUT_COMMAND"),Af=W("INPUT_COMMAND"),Ff=W("COMPOSITION_START_COMMAND"),zf=W("COMPOSITION_END_COMMAND"),vn=W("DELETE_CHARACTER_COMMAND"),vr=W("INSERT_LINE_BREAK_COMMAND"),Hn=W("INSERT_PARAGRAPH_COMMAND"),Kn=W("CONTROLLED_TEXT_INSERTION_COMMAND"),Vr=W("PASTE_COMMAND"),mi=W("REMOVE_TEXT_COMMAND"),zr=W("DELETE_WORD_COMMAND"),Or=W("DELETE_LINE_COMMAND"),Ot=W("FORMAT_TEXT_COMMAND"),zm=W("SET_TEXT_FORMAT_COMMAND"),cs=W("UNDO_COMMAND"),ds=W("REDO_COMMAND"),fs=W("KEYDOWN_COMMAND"),kl=W("KEY_ARROW_RIGHT_COMMAND"),Of=W("MOVE_TO_END"),xl=W("KEY_ARROW_LEFT_COMMAND"),Mf=W("MOVE_TO_START"),Cl=W("KEY_ARROW_UP_COMMAND"),vl=W("KEY_ARROW_DOWN_COMMAND"),$i=W("KEY_ENTER_COMMAND"),jf=W("KEY_SPACE_COMMAND"),hs=W("KEY_BACKSPACE_COMMAND"),Sl=W("KEY_ESCAPE_COMMAND"),wl=W("KEY_DELETE_COMMAND"),El=W("KEY_TAB_COMMAND"),Om=W("INSERT_TAB_COMMAND"),Mm=W("INDENT_CONTENT_COMMAND"),Wu=W("OUTDENT_CONTENT_COMMAND"),Rf=W("DROP_COMMAND"),Pf=W("FORMAT_ELEMENT_COMMAND"),Lf=W("DRAGSTART_COMMAND"),If=W("DRAGOVER_COMMAND"),jm=W("DRAGEND_COMMAND"),Io=W("COPY_COMMAND"),gs=W("CUT_COMMAND"),Tl=W("SELECT_ALL_COMMAND"),Rm=W("CLEAR_EDITOR_COMMAND"),Pm=W("CLEAR_HISTORY_COMMAND"),ao=W("CAN_REDO_COMMAND"),lo=W("CAN_UNDO_COMMAND"),Bf=W("FOCUS_COMMAND"),Lm=W("BLUR_COMMAND"),Im=W("KEY_MODIFIER_COMMAND");function Bm(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 mo(n,e,t,r){return n.addEventListener(e,t,r),n.removeEventListener.bind(n,e,t,r)}const rn=Object.freeze({}),Ea=[["keydown",function(n,e){const t=e._inputState;t.lastKeyDownTimeStamp=n.timeStamp,t.lastKeyCode=n.key,n.key!=="Backspace"&&wo(t),!e.isComposing()&&I(e,fs,n)}],["pointerdown",function(n,e){const t=Vn(n),r=n.pointerType;Lt(t)&&r!=="touch"&&r!=="pen"&&n.button===0&&wt(e,()=>{Ji(t,e)||(e._inputState.isSelectionChangeFromMouseDown=!0)})}],["compositionstart",function(n,e){I(e,Ff,n)}],["compositionend",function(n,e){const t=e._inputState;Pt?t.compositionPhase="ending-firefox":En||!jo&&!Ro?I(e,zf,n):(t.compositionPhase="ending-safari",t.compositionEndData=n.data)}],["input",function(n,e){n.stopPropagation();const t=e._inputState;wo(t),wt(e,()=>{Uf(n,e)||e.dispatchCommand(Af,n)},{event:n}),t.unprocessedBeforeInputData=null}],["click",function(n,e){wt(e,()=>{const t=z(),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)&&ge().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))&&_e(To(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=To(o,r,e,n);l!==null?_e(l):r.removeAllRanges()}}I(e,us,n)})}],["cut",rn],["copy",rn],["dragstart",rn],["dragover",rn],["dragend",rn],["paste",rn],["focus",rn],["blur",rn],["drop",rn]];Fr&&Ea.push(["beforeinput",(n,e)=>(function(t,r){const o=t.inputType;o==="deleteCompositionText"||Pt&&Fh(r)||o!=="insertCompositionText"&&wt(r,()=>{Uf(t,r)||I(r,$f,t)},{event:t})})(n,e)]);const Ta=new WeakMap,Ai=new WeakMap,Km=Bm(n=>(n.addEventListener("selectionchange",Vu),()=>n.removeEventListener("selectionchange",Vu)));function Kf(n,e,t,r,o,i){const s=n.anchor,a=n.focus,l=s.getNode(),u=he();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&&(!Fr||u._inputState.lastBeforeInputInsertTextTimeStamp<r+50)||l.isDirty()&&g<2||Dh(t))&&s.offset!==a.offset&&!l.isComposing()||Et(l)||l.isDirty()&&g>1||(o||!Fr)&&h!==null&&!l.isComposing()&&d!==wn(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=Ki(p);return y===0?!p.canInsertTextBefore()||!_.canInsertTextBefore()&&!p.isComposing()||b||(function(k){const S=k.getPreviousSibling();return(D(S)||C(S)&&S.isInline())&&!S.canInsertTextAfter()})(p):y===p.getTextContentSize()&&(!p.canInsertTextAfter()||!_.canInsertTextAfter()&&!p.isComposing()||b)})(n,l)}function qu(n,e){return ht(n)&&n.nodeValue!==null&&e!==0&&e!==n.nodeValue.length}function Uu(n,e,t){const{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}=ft(n,e._rootElement),a=e._inputState;a.isSelectionChangeFromDOMUpdate&&(a.isSelectionChangeFromDOMUpdate=!1,qu(r,o)&&qu(i,s)&&!a.postDeleteSelectionToRestore)||wt(e,()=>{if(!t)return void _e(null);if(!Wo(e,r,i))return;let l=z();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(),_e(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,_=ge(),b=e.isComposing()===!1&&_.getTextContent()==="";if(f<y+200&&u.offset===m&&u.key===p)yi(l,h,g);else if(u.type==="text")D(c)||$(141),Wf(l,c);else if(u.type==="element"&&!b){C(c)||$(259);const k=u.getNode();k.isEmpty()?(function(S,x){const w=x.getTextFormat(),v=x.getTextStyle();yi(S,w,v)})(l,k):yi(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 x=0;x<g;x++){const w=h[x],v=w.getTextContentSize();if(D(w)&&v!==0&&!(x===0&&w.__key===_&&p===v||x===g-1&&w.__key===b&&y===0)&&(S=!0,k&=w.getFormat(),k===0))break}l.format=S?k:0}}I(e,qt)})}function yi(n,e,t){n.format===e&&n.style===t||(n.format=e,n.style=t,n.dirty=!0)}function Wf(n,e){yi(n,e.getFormat(),e.getStyle())}function qf(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function Hu(n){const{lastKeyCode:e}=he()._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=z();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{e3 as r,e4 as o,e5 as a}from"./index-FpwHnbdV.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{ec as r,ed as o,ee as a}from"./index-lxVTsHBH.js";import{o as n}from"./rich-text-spellcheck-provider-J8m9wz6A.js";const c=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(),c(s),a(e))};export{i as openSpellcheckWorker};
@@ -0,0 +1 @@
1
+ import{e}from"./index-lxVTsHBH.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 e,j as l,a as b,p as y,L as x}from"./index-FpwHnbdV.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 c({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{c as R};
1
+ import{r as e,j as l,f as b,t as y,L as x}from"./index-lxVTsHBH.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};
@@ -0,0 +1 @@
1
+ import{u as x,C as v,x as p,z as I,aj as g,r as Q}from"./index-lxVTsHBH.js";import{b}from"./MailShell-CqyZkGBA.js";import{a as C}from"./useMessageBodyContent-CUM4C6Cq.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
- const o="search-scope";function t(i){const e=i.trim().replace(/\s+/g," ").toLowerCase();return/\s/.test(e)?`in:"${e}"`:`in:${e}`}function l(i){return i.list!==void 0&&i.list!=="brief"}function r(i){return i.list==="mailbox"?i.mailboxId:void 0}function c(i){const e=r(i.browsed);return e||(l(i.browsed)?i.callerMailboxId:i.callerMailboxId??i.inTokenMailboxId)}function a(i,e){return i.list==="flagged"?{kind:"scoped",chip:{id:o,label:"is:starred"}}:i.list==="outbox"?{kind:"scoped",chip:{id:o,label:"in:outbox"}}:i.list==="mailbox"?e?{kind:"scoped",chip:{id:o,label:t(e)}}:{kind:"pending"}:{kind:"global"}}function s(i,e,n){return e.kind==="global"?{kind:"global"}:i.list==="flagged"?{kind:"collection"}:{kind:"folder",...n?{role:n}:{}}}export{o as S,a,s as b,l as i,r,c as s};
1
+ const o="search-scope";function t(i){const e=i.trim().replace(/\s+/g," ").toLowerCase();return/\s/.test(e)?`in:"${e}"`:`in:${e}`}function l(i){return i.list!==void 0&&i.list!=="brief"}function r(i){return i.list==="mailbox"?i.mailboxId:void 0}function c(i){const e=r(i.browsed);return e||(l(i.browsed)?i.callerMailboxId:i.callerMailboxId??i.inTokenMailboxId)}function a(i,e){return i.list==="flagged"?{kind:"scoped",chip:{id:o,label:"is:starred"}}:i.list==="outbox"?{kind:"scoped",chip:{id:o,label:"in:outbox"}}:i.list==="mailbox"?e?{kind:"scoped",chip:{id:o,label:t(e)}}:{kind:"pending"}:{kind:"global"}}function s(i,e,n){return e.kind==="global"?{kind:"global"}:i.list==="flagged"?{kind:"collection"}:{kind:"folder",...n?{role:n}:{}}}export{o as S,s as a,c as b,l as i,r,a as s};
@@ -0,0 +1 @@
1
+ import{e as H,r as l,j as h,a1 as U,t as k,bZ as V,X as _,b_ as P,b$ as z,c0 as G,c1 as X,c2 as J,a8 as x,u as Y,c3 as Z,c4 as w,c5 as W,E as ee,ah as te,c6 as ne,c7 as se,ab as re,G as K,ad as oe,ae,C as ie,c8 as L}from"./index-lxVTsHBH.js";import{s as ce,S as le}from"./search-scope-B5-OK3Cq.js";import{a as ue}from"./useLayoutTier-Ciq4HlaK.js";import{u as M}from"./useQueries-CPnZMt_1.js";const Le=H("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),de=[{action:"focusNext",keys:["j","k"],label:"navigate"},{action:"muteSender",keys:["m"],label:"mute"},{action:"help",keys:["?"],label:"all shortcuts"}];function Ke(e){return de.filter(t=>e[t.action]!==void 0)}const fe=[{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 pe(e){for(const t of fe){const n=t.hints.find(s=>s.action===e);if(n)return n.keys}}function he(e){const t=pe(e);return!t||t.length===0?"":t.length===1?t[0]??"":t[0]==="g"?t.join(" then "):t.join("")}function Me(e){const t=he(e);return t===""?"":`(${t})`}function me({key:e,shiftKey:t=!1,repeat:n=!1,caretAtStart:s,hasValue:o,chipCount:r}){const i=r-1;return e==="Escape"?o?{type:"clearQuery"}:{type:"blur"}:e==="Tab"&&t?r===0?{type:"none"}:{type:"focusChip",index:i}:e==="Backspace"||e==="ArrowLeft"?!s||r===0?{type:"none"}:n?{type:"none"}:{type:"focusChip",index:i}:{type:"none"}}function ye({key:e,repeat:t=!1,index:n,chipCount:s}){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>=s-1?{type:"focusInput"}:{type:"focusChip",index:n+1}:e==="Enter"||e===" "?{type:"activateChip",index:n}:e==="Escape"?{type:"focusInput"}:{type:"none"}}function ge(e,t){const n=t-1;return n<=0?null:e<n?e:n-1}const be=e=>e instanceof HTMLElement?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable:!1,xe=({chips:e=[],onRemoveChip:t,value:n,onChange:s,onClear:o,onClearQuery:r,placeholder:i="Search mail...",globalFocusKey:u=!0,showClearButton:p=!0,size:m="sm",inputId:d,suggest:f,className:b})=>{const F=l.useId(),N=d??F,I=l.useRef(null),R=l.useRef([]),A=r??o,[j,C]=l.useState(null),v=l.useRef(void 0),[$,q]=l.useState(""),T=e.length>0;l.useEffect(()=>{C(a=>a!==null&&a>=e.length?null:a)},[e.length]),l.useEffect(()=>{const a=v.current;if(a!==void 0){if(v.current=void 0,a===null){I.current?.focus();return}R.current[a]?.focus()}});const D=l.useRef(void 0);l.useEffect(()=>{const a=f?.caret;if(!a||a===D.current)return;D.current=a;const c=I.current;!c||c.ownerDocument.activeElement!==c||(c.setSelectionRange(a.cursor,a.cursor),f?.onCaretChange(a.cursor))});const S=a=>{f?.onCaretChange(a.selectionStart??a.value.length)},y=l.useCallback(a=>{C(a),v.current=a},[]),E=l.useCallback(a=>{const c=e[a];c&&t&&(y(ge(a,e.length)),q(`${c.label} removed`),t(c.id))},[e,t,y]),O=l.useCallback(()=>{y(null),o()},[o,y]),Q=l.useCallback(a=>{const c=a.currentTarget;if(f?.onKeyDown(a))return;const g=me({key:a.key,shiftKey:a.shiftKey,repeat:a.repeat,caretAtStart:c.selectionStart===0&&c.selectionEnd===0,hasValue:n.length>0,chipCount:e.length});switch(g.type){case"focusChip":a.preventDefault(),y(g.index);return;case"clearQuery":A();return;case"blur":c.blur();return;case"none":return}},[e.length,n,A,y,f]),B=l.useCallback(a=>c=>{const g=ye({key:c.key,repeat:c.repeat,index:a,chipCount:e.length});switch(g.type!=="none"&&c.preventDefault(),g.type){case"removeChip":E(g.index);return;case"focusChip":y(g.index);return;case"focusInput":y(null);return;case"activateChip":return;case"none":return}},[e,E,y]);return l.useEffect(()=>{if(!u)return;const a=c=>{c.key!=="/"||c.metaKey||c.ctrlKey||c.altKey||be(c.target)||P("focusSearch")||(c.preventDefault(),I.current?.focus())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[u]),h.jsxs("label",{htmlFor:N,className:k("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(U,{className:k("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:[T&&h.jsx("div",{role:"grid","aria-label":"Search filters",className:"flex min-w-0 flex-wrap items-center gap-1",children:e.map((a,c)=>h.jsx(V,{ref:g=>{R.current[c]=g},label:a.label,tone:a.tone,focused:j===c,onFocusLabel:()=>C(c),onKeyDown:B(c),onRemove:()=>E(c)},a.id))}),h.jsx("input",{ref:I,id:N,name:"q",type:"text","aria-label":"Search mail",autoComplete:"off",value:n,tabIndex:j===null?0:-1,onChange:a=>{s(a.target.value),S(a.target)},onKeyDown:Q,onKeyUp:a=>S(a.currentTarget),onClick:a=>S(a.currentTarget),onFocus:a=>{C(null),f?.onFocusChange?.(!0),S(a.currentTarget)},onBlur:()=>f?.onFocusChange?.(!1),...f?.comboboxProps,placeholder:T?void 0:i,className:"min-w-24 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-muted"})]}),(n||T)&&p&&h.jsx("button",{type:"button",onClick:O,className:"shrink-0 rounded p-0.5 hover:bg-surface-raised transition-colors","aria-label":"Clear search",children:h.jsx(_,{className:k("text-fg-muted",m==="lg"?"size-5":"size-4")})}),h.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:$})]})},Ne=({value:e,onChange:t,onClear:n,onClearQuery:s,chips:o,onRemoveChip:r,placeholder:i="Search mail...",globalFocusKey:u=!0,showClearButton:p=!0,size:m,inputId:d,suggest:f,className:b})=>h.jsx(xe,{value:e,onChange:t,onClear:n,onClearQuery:s,chips:o,onRemoveChip:r,placeholder:i,globalFocusKey:u,showClearButton:p,size:m,inputId:d,suggest:f,className:b});function Re({handlers:e,enabled:t=!0,target:n,sequenceTimeoutMs:s=1e3}){const o=l.useRef(e);o.current=e;const r=l.useRef(null),i=l.useRef(null);l.useEffect(()=>{if(!t)return;const u=()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)},p=d=>{const f=z({key:d.key,shiftKey:d.shiftKey,metaKey:d.metaKey,ctrlKey:d.ctrlKey,altKey:d.altKey,inEditable:X(d.target),onControl:G(d.target)},r.current);if(J().length>0){u(),r.current=null;return}if(u(),r.current=f.nextPrefix,f.nextPrefix!==null&&(i.current=setTimeout(()=>{r.current=null,i.current=null},s)),f.action===null||P(f.action)!==null)return;const b=o.current[f.action];b&&(f.preventDefault&&d.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,s,n])}function Ae(){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}),s=x({from:"/mail/flagged/$threadId/$messageId",shouldThrow:!1}),o=x({from:"/mail/$mailboxId/$threadId",shouldThrow:!1}),r=x({from:"/mail/$mailboxId/$threadId/$messageId",shouldThrow:!1}),i=e?.threadId??n?.threadId??o?.threadId,u=t?.messageId??s?.messageId??r?.messageId;return l.useMemo(()=>i?{threadId:i,messageId:u}:void 0,[i,u])}function je(){const e=Y(),t=Z(),{list:n,mailboxId:s}=w();return l.useCallback((o,r)=>{const i=r?.query,p={search:d=>i===void 0?d:{...d,q:i||void 0},hash:t,replace:r?.replace??!1};if(n==="flagged"){e({to:"/mail/flagged/$threadId/$messageId",params:o,...p});return}const m=r?.mailboxId??s;if(n==="mailbox"&&m){e({to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:m,...o},...p});return}e({to:"/mail/brief/$threadId/$messageId",params:o,...p})},[e,t,n,s])}function De(){return W()}const Pe=({trigger:e,children:t,align:n="right"})=>{const[s,o]=l.useState(!1),r=l.useRef(null),i=l.useCallback(u=>{r.current&&!r.current.contains(u.target)&&o(!1)},[]);return ee({id:"dropdown-menu",open:s,answers:{back:()=>o(!1)}}),l.useEffect(()=>(s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)),[s,i]),h.jsxs("div",{ref:r,className:"relative",children:[h.jsx("button",{type:"button",onClick:u=>{u.stopPropagation(),o(!s)},className:k("p-1.5 min-h-11 min-w-11 inline-flex items-center justify-center rounded-md transition-colors","hover:bg-surface-raised text-fg-muted hover:text-fg"),children:e}),s&&h.jsx("div",{className:k("absolute z-50 mt-1 min-w-[180px] py-1","bg-surface border border-line rounded-md shadow-lg",n==="right"?"right-0":"left-0"),children:t})]})},Fe=({onClick:e,disabled:t,destructive:n,children:s})=>h.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t||e()},disabled:t,className:k("w-full px-3 py-2 text-left text-sm transition-colors","flex items-center gap-2",t&&"opacity-50 cursor-not-allowed",!t&&"hover:bg-surface-raised",n&&"text-danger hover:text-danger"),children:s}),$e=()=>h.jsx("div",{className:"my-1 h-px bg-line"}),ke=e=>typeof e=="object"&&e!==null&&Array.isArray(e.pages),we=e=>typeof e=="object"&&e!==null&&Array.isArray(e.items),Ie=(e,t)=>e===void 0?e:ke(e)?{...e,pages:e.pages.map(n=>({...n,items:t(n.items)}))}:we(e)?{...e,items:t(e.items)}:e,qe=e=>{const t=[];for(const n of new Set(e))t.push(te({path:{mailboxId:n}})),t.push(ne({path:{mailboxId:n}}));return t.push(se()),t},Oe=(e,t)=>Promise.all(t.map(n=>e.cancelQueries({queryKey:n}))),Qe=(e,t)=>t.flatMap(n=>e.getQueriesData({queryKey:n})).filter(n=>n[1]!==void 0).map(([n,s])=>({queryKey:n,data:s})),Be=(e,t,n)=>{const s=o=>Ie(o,n);for(const o of t)e.setQueriesData({queryKey:o},s)},He=(e,t)=>{for(const n of t)e.setQueryData(n.queryKey,n.data)},Ue=(e,t)=>{for(const n of t)e.invalidateQueries({queryKey:n})},Ce=({accounts:e})=>{const{list:t,mailboxId:n}=w(),{t:s}=re("mail",{useSuspense:!1}),o=l.useCallback((i,u)=>s(i,{defaultValue:u}),[s]),r=M({queries:e.map(i=>({...K({path:{accountId:i.accountId}}),staleTime:1/0}))});if(t==="outbox")return"Outbox";if(!n)return null;for(let i=0;i<e.length;i++){const u=r[i]?.data?.items;if(!u)continue;const p=u.find(d=>d.mailboxId===n);if(!p)continue;const m=oe(e[i].folderAppointments);return ae(p,m.get(n),o)}return null},Ve=({accounts:e})=>{const{mailboxId:t}=w(),n=M({queries:e.map(s=>({...K({path:{accountId:s.accountId}}),staleTime:1/0}))});if(!t)return null;for(const s of n){const o=s.data?.items;if(!o)continue;const r=o.find(i=>i.mailboxId===t);if(r)return r.unseenCount}return null},_e=({accounts:e})=>{const{mailboxId:t}=w(),n=M({queries:e.map(s=>({...K({path:{accountId:s.accountId}}),staleTime:1/0}))});if(!t)return 0;for(const s of n){const o=s.data?.items;if(!o)continue;const r=o.find(i=>i.mailboxId===t);if(r)return r.messageCount}return 0};function ze(e){const t=ue(),{searchInput:n}=ie(),s=Ce({accounts:e}),o=w(),r=ce(o,s),i=l.useCallback(u=>{u===le&&t(n)},[t,n]);return{scope:r,clearScope:i}}function Ge(e){const t=new Map;for(const n of e){const s=n.email.toLowerCase(),o=s.split("@")[0];o&&!t.has(o)&&t.set(o,n.accountId),t.has(s)||t.set(s,n.accountId)}return t}function Xe(e){const t=new Map;for(const n of e)for(const s of n){const o=s.fullPath?.toLowerCase();if(!o)continue;const r=L(s).toLowerCase();t.has(o)||t.set(o,s.mailboxId),t.has(r)||t.set(r,s.mailboxId)}return t}function Je(e,t=[]){const n=e.flat().filter(r=>r.fullPath),s=new Map;for(const r of n){const i=L(r).toLowerCase();s.set(i,(s.get(i)??0)+1)}const o=new Map(t.map(r=>[r.accountId,r.email]));return n.map(r=>{const i=L(r),u=s.get(i.toLowerCase())===1,p=t.length>1?o.get(r.accountId):void 0;return{value:u?i:r.fullPath,label:r.displayNameOverride?.trim()||i,...p?{hint:p}:{}}})}function Ye(e){const t=new Map;for(const n of e){const s=n.email.toLowerCase().split("@")[0]??"";t.set(s,(t.get(s)??0)+1)}return e.map(n=>{const s=n.email.split("@")[0]??n.email,o=t.get(s.toLowerCase())===1,r=n.displayName?.trim();return{value:o?s:n.email,label:r||n.email,...r?{hint:n.email}:{}}})}export{Ke as A,Pe as D,fe as K,Le as R,Ne as S,$e as a,Fe as b,Xe as c,Ae as d,Re as e,Ge as f,je as g,De as h,Ue as i,Ce as j,Ve as k,_e as l,de as m,Oe as n,Qe as o,Be as p,Ie as q,He as r,he as s,qe as t,ze as u,ke as v,we as w,Me as x,Je as y,Ye as z};
@@ -0,0 +1 @@
1
+ import{u as e,r as s}from"./index-lxVTsHBH.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};
@@ -0,0 +1 @@
1
+ import{j as e,t as S,u as L,r as c,aK as O,ay as T,a1 as $,aM as A,c as I,bC as M,h as C,i as k,bD as q,bE as P,f as N,W as R,bF as G,X as K}from"./index-lxVTsHBH.js";import{K as f}from"./kbd-Ds8JAL-i.js";import{S as Q,a as E}from"./settings-screen-D5PdsyBl.js";import{E as V}from"./ErrorState-CQA1uNfQ.js";import{u as D}from"./useDebouncedValue-D4EGUdvx.js";import{a as F}from"./format-CCaI2KqP.js";import{s as _}from"./help-copy-DawC2xSA.js";import"./avatar-wLH6-Ayd.js";import"./chevron-left-KNAXuraL.js";import"./menu-D6aq1T1f.js";import"./circle-help-DtvJPapE.js";function B({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(a=>{const d=a.id===r;return e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>m(a.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:a.label}),e.jsx("span",{className:S("text-2xs tabular-nums",d?"text-accent-2":"text-fg-subtle"),children:a.count??"—"})]},a.id)})})}const v={vip:"VIPs",muted:"Muted",blocked:"Blocked"};function H({query:t,onCount:r}){const{data:m,isPending:a,isError:d,error:b}=I(M()),g=C(),i=k({...P(),onSettled:()=>{g.invalidateQueries({queryKey:q()})}}),l=m?.suggestions??[],p=t.trim().toLowerCase(),u=p?l.filter(n=>(n.displayName??"").toLowerCase().includes(p)||n.normalizedEmail.toLowerCase().includes(p)):l;return c.useEffect(()=>{r?.(u.length,l.length)},[r,u.length,l.length]),a?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(n=>e.jsx(E,{name:n.displayName??n.normalizedEmail,email:n.normalizedEmail,meta:n.replyCount>0?`${n.inboundCount} received · you replied ${n.replyCount}×`:`${n.inboundCount} received · you've never replied`,trailing:e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(R,{className:"size-3.5"}),"aria-busy":i.isPending,onClick:()=>{i.isPending||i.mutate({path:{addressId:n.addressId},body:{flags:{vip:{value:!0,setAt:Date.now(),setBy:"user"}}}})},children:"Add VIP"})},n.addressId))]})}function U({group:t,query:r,onCount:m}){const a=D(r.trim(),300),d=C(),[b,g]=c.useState(null),i=a.length>=2,l=G({query:{q:a,limit:50}}),{data:p,isPending:u,isError:n,error:j}=I({...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…"}):n?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 “",a,"”."]}):e.jsx(e.Fragment,{children:h.map(s=>{const o=t==="muted"?s.flags?.muted:s.flags?.blocked,y=o?[`${t}`,o.setAt&&F(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]:null}}})},children:"Retry"}):e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(K,{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]:null}}}))}})},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 ie(){const t=L(),[r,m]=c.useState("vip"),[a,d]=c.useState(""),[b,g]=c.useState(!0),[i,l]=c.useState(0),[p,u]=c.useState({vip:0,muted:null,blocked:null}),n=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=A[s];o&&t({to:o})};return e.jsx(Q,{items:O,activeId:"senders",title:"Senders & Rules",description:"Per-sender preferences — set with one key from any message, managed here.",flush:!0,help:_,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(B,{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(T,{icon:e.jsx($,{className:"size-4"}),placeholder:`Filter ${v[r].toLowerCase()} by name or address`,className:"h-8 max-w-sm",value:a,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:a,onCount:n}):e.jsx(U,{group:r,query:a,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{ie as component};
@@ -0,0 +1 @@
1
+ import{j as t,O as o}from"./index-lxVTsHBH.js";const n=()=>t.jsx(o,{});export{n as component};
@@ -0,0 +1 @@
1
+ import{r as j,j as e,t as f,f as i,X as N,g as z}from"./index-lxVTsHBH.js";import{A as w}from"./avatar-wLH6-Ayd.js";import{C as h}from"./chevron-left-KNAXuraL.js";import{M as S}from"./menu-D6aq1T1f.js";import{C as v}from"./circle-help-DtvJPapE.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};
@@ -0,0 +1 @@
1
+ import{e}from"./index-lxVTsHBH.js";const c=e("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);export{c as S};
@@ -1 +1 @@
1
- import{j as t,al as e}from"./index-FpwHnbdV.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
1
+ import{j as t,am as e}from"./index-lxVTsHBH.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
@@ -0,0 +1 @@
1
+ import{e as b,r as x}from"./index-lxVTsHBH.js";const D=b("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);const T=b("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]),m={"cal-1":{solid:"bg-cal-1",soft:"bg-cal-1-soft",text:"text-cal-1",border:"border-cal-1",rail:"border-l-cal-1"},"cal-2":{solid:"bg-cal-2",soft:"bg-cal-2-soft",text:"text-cal-2",border:"border-cal-2",rail:"border-l-cal-2"},"cal-3":{solid:"bg-cal-3",soft:"bg-cal-3-soft",text:"text-cal-3",border:"border-cal-3",rail:"border-l-cal-3"},"cal-4":{solid:"bg-cal-4",soft:"bg-cal-4-soft",text:"text-cal-4",border:"border-cal-4",rail:"border-l-cal-4"},"cal-5":{solid:"bg-cal-5",soft:"bg-cal-5-soft",text:"text-cal-5",border:"border-cal-5",rail:"border-l-cal-5"},"cal-6":{solid:"bg-cal-6",soft:"bg-cal-6-soft",text:"text-cal-6",border:"border-cal-6",rail:"border-l-cal-6"}};function $(e){return m[e]}const u="fixture-work",d="fixture-personal",s="fixture-team",i=[{id:u,accountId:"fixture-account-work",accountLabel:"Work",name:"Work",color:"cal-1"},{id:s,accountId:"fixture-account-work",accountLabel:"Work",name:"Team",color:"cal-6"},{id:d,accountId:"fixture-account-personal",accountLabel:"Personal",name:"Personal",color:"cal-4"}],I=Object.fromEntries(i.map(e=>[e.id,e.color])),l=e=>String(e).padStart(2,"0");function g(e){const[n,t,a]=e.split("-").map(Number),r=new Date(Date.UTC(n,t-1,a)),c=(r.getUTCDay()+6)%7;return r.setUTCDate(r.getUTCDate()-c),r}function k(e,n){const t=new Date(e);return t.setUTCDate(t.getUTCDate()+n),`${t.getUTCFullYear()}-${l(t.getUTCMonth()+1)}-${l(t.getUTCDate())}`}const w=()=>Intl.DateTimeFormat().resolvedOptions().timeZone;function p(e,n,t){const r=-new Date(`${e}T${l(n)}:${l(t)}:00`).getTimezoneOffset(),c=r<0?"-":"+",f=Math.abs(r);return`${e}T${l(n)}:${l(t)}:00${c}${l(Math.floor(f/60))}:${l(f%60)}`}const y={id:"",calendarId:u,title:"",start:"",end:"",allDay:!1,location:"",notes:"",attendees:[],myRsvp:"accepted",threadId:"",threadSubject:"",timeZone:"",zoneCertainty:"explicit",recurrenceRule:"",seriesId:"",seriesException:!1,status:"confirmed"},o=(e,n,t,a,r={})=>({dayOffset:e,startHour:t,startMinute:0,endHour:a,endMinute:0,title:n,calendarId:u,location:"",recurrenceRule:"",seriesId:"",...r}),C=[o(0,"Standup",9,9,{startMinute:15,endMinute:30,recurrenceRule:"Every weekday, 09:15",seriesId:"fixture-standup"}),o(0,"Roadmap review",11,12,{calendarId:s}),o(1,"Standup",9,9,{startMinute:15,endMinute:30,recurrenceRule:"Every weekday, 09:15",seriesId:"fixture-standup"}),o(1,"Supplier call",14,15,{calendarId:s,location:"Meet"}),o(2,"Standup",9,9,{startMinute:15,endMinute:30,recurrenceRule:"Every weekday, 09:15",seriesId:"fixture-standup"}),o(2,"Design review",10,12,{calendarId:s}),o(2,"Dentist",11,12,{calendarId:d,location:"Kerkstraat 4"}),o(3,"Standup",9,9,{startMinute:15,endMinute:30,recurrenceRule:"Every weekday, 09:15",seriesId:"fixture-standup"}),o(3,"One to one",15,16,{location:"Room 2"}),o(4,"Standup",9,9,{startMinute:15,endMinute:30,recurrenceRule:"Every weekday, 09:15",seriesId:"fixture-standup"}),o(4,"Retro",16,17,{calendarId:s}),o(5,"Climbing",10,12,{calendarId:d})];function M(e){const n=g(e),t=w();return C.map(a=>{const r=k(n,a.dayOffset);return{...y,id:`fixture-${r}-${a.title.toLowerCase().replace(/\s+/g,"-")}`,calendarId:a.calendarId,title:a.title,start:p(r,a.startHour,a.startMinute),end:p(r,a.endHour,a.endMinute),location:a.location,timeZone:t,recurrenceRule:a.recurrenceRule,seriesId:a.seriesId}})}function h(e,n){const t=e.map(c=>c.id);if(n.length===0)return t;const a=new Set(n),r=t.filter(c=>a.has(c));return r.length===0?t:r}function v({date:e,calendarIds:n}){const t=[...n].join(",");return x.useMemo(()=>{const a=t===""?[]:t.split(","),r=new Set(h(i,a));return{calendars:i,events:M(e).filter(c=>r.has(c.calendarId)),colorByCalendarId:I,isLoading:!1}},[e,t])}export{D as G,T as R,$ as c,w as f,v as u};
@@ -1 +1 @@
1
- import{r as o}from"./index-FpwHnbdV.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-lxVTsHBH.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,f as b,dR as E,d as C,dS as x,dA as F,dT as D,u as M,dU as N,dV as P,dW as L,dX as z}from"./index-FpwHnbdV.js";const B=(e,t)=>{if(e.state==="Expired")return"Expired";if(e.scope!=="Temporary"||!e.expiresAt)return"Active";const r=Date.parse(e.expiresAt);return Number.isNaN(r)?"Active":r<=t?"Expired":"Active"},K=e=>{if(!e)return;const t=Date.parse(e);if(!Number.isNaN(t))return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})},O=(e,t=new Date)=>{if(!e)return;const r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!r)return;const[,a,i,n]=r,s=new Date(Number(a),Number(i)-1,Number(n),23,59,59,0);if(Number.isNaN(s.getTime()))return;const o=-t.getTimezoneOffset(),d=o>=0?"+":"-",l=Math.abs(o),c=String(Math.floor(l/60)).padStart(2,"0"),f=String(l%60).padStart(2,"0"),u=p=>String(p).padStart(2,"0");return`${s.getFullYear()}-${u(s.getMonth()+1)}-${u(s.getDate())}T${u(s.getHours())}:${u(s.getMinutes())}:${u(s.getSeconds())}${d}${c}:${f}`},h="None",V=e=>!e.literalClauses.some(t=>t.field==="HasWords"),y=e=>({...e.anchorMessageId?{anchorMessageId:e.anchorMessageId}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h}),X=({mode:e,ruleScope:t})=>t==="standing"?"standing":t==="until"?"temporary":e==="selected"?"just-these":"all-like-these",G=({mode:e,ruleScope:t,anchorMessageId:r,clauses:a,matchOperator:i,moveMailboxId:n,until:s})=>({...e==="similar"&&r?{anchorMessageId:r}:{},matchOperator:i==="all"?"And":"Or",literalClauses:a.map(o=>({field:o.field,value:o.value})),moveMailboxId:n,expiresAt:t==="until"?O(s??""):void 0}),S=(e,t,r)=>({name:r,scope:t==="standing"?"Standing":"Temporary",...t==="temporary"&&e.expiresAt?{expiresAt:e.expiresAt}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h,...e.anchorMessageId?{anchorMessageId:e.anchorMessageId}:{}}),T=new Set(["Complete","Failed"]),v=e=>e!==void 0&&T.has(e),w=1e3,J=15e3,R=e=>{const t=Math.max(0,e),r=w*2**t;return Math.min(r,J)},_=(e,t,r)=>{if(e)return{kind:r?"restartFailed":"startFailed",error:e};if(t)return{kind:"statusUnreadable",error:t}},Y=e=>{const[t,r]=m.useState(),a=b({...E(),onSuccess:g=>r(g.organizeJobId)}),{mutate:i}=a,n=C({...x({path:{accountId:e??"",organizeJobId:t??""}}),enabled:!!e&&!!t,refetchInterval:g=>{const I=g.state.data?.state;return v(I)?!1:R(g.state.dataUpdateCount)}}),s=m.useCallback(g=>{e&&i({path:{accountId:e},body:y(g)})},[e,i]),{refetch:o}=n,d=m.useCallback(()=>{o()},[o]),l=n.data,c=a.isPending?void 0:l,f=c?.state??a.data?.state,u=v(c?.state),p={state:f,matchedCount:c?.matchedCount??0,appliedCount:c?.appliedCount??0,failedCount:c?.failedCount??0,errorMessage:c?.errorMessage??""};return{start:s,refreshStatus:d,progress:p,isStarting:a.isPending,isRunning:!!t&&!u,isDone:u,failure:_(a.error,n.error,!!l)}},Z=["From","Subject","HasWords","ListId","FromDomain"],$=e=>{const t=e.trim(),r=t.match(/<([^>]+)>/);return(r?r[1]:t).trim().toLowerCase()},ee=(e,t)=>e==="ListId"?$(t):t.trim(),k=e=>e==="all"?"And":"Or",U=(e,t)=>{const r=e.widen!==void 0&&!e.widen.inactive,a=e.clauses.map(i=>({field:i.field,value:i.value}));return{...r&&t?{anchorMessageId:t}:{},matchOperator:k(e.matchOperator),literalClauses:a}},Q=e=>e.anchorMessageId!==void 0||!e.literalClauses.some(t=>t.field==="HasWords"),W=e=>JSON.stringify({anchor:e.anchorMessageId??null,operator:e.matchOperator,clauses:e.literalClauses.map(t=>`${t.field} ${t.value}`)}),te=(e,t)=>{const r=U(e,t);return{...r.anchorMessageId?{anchorMessageId:r.anchorMessageId}:{},matchOperator:r.matchOperator,literalClauses:r.literalClauses,moveMailboxId:e.moveMailboxId,labelId:e.labelId,expiresAt:e.scope==="until"?O(e.until??""):void 0}},j=(e,t)=>e.error!==void 0&&e.errorSignature===t?{status:"error",reason:e.error}:e.count===void 0?{status:"loading"}:e.previewedSignature===t?{status:"ready",count:e.count}:{status:"ready",count:e.count,stale:!0},q=350,re=(e,t,r)=>{const a=b(F()),{mutateAsync:i}=a,n=W(t),[s,o]=m.useState(()=>({})),d=m.useRef(t);d.current=t;const l=m.useRef(n),c=Q(t);return m.useEffect(()=>{if(!e||!c||n===s.previewedSignature||n===s.errorSignature)return;const f=setTimeout(()=>{const u=n;l.current=u,i({path:{accountId:e},body:y({...d.current})}).then(p=>{l.current===u&&o({count:p.matchedCount,matchedIds:p.messageIds,previewedSignature:u})}).catch(p=>{l.current===u&&o(g=>({...g,error:p instanceof Error?p.message:"Couldn't count matches.",errorSignature:u}))})},q);return()=>clearTimeout(f)},[e,c,n,s.previewedSignature,s.errorSignature,i]),c?{count:j(s,n),matchedIds:s.previewedSignature===n?s.matchedIds??[]:[]}:{count:{status:"error",reason:D},matchedIds:[]}},A=e=>P({path:{accountId:e}}),se=e=>{const t=C({...L({path:{accountId:e??""}}),enabled:!!e});return{filters:t.data?.items??[],isPending:t.isPending,isError:t.isError,error:t.error,refetch:t.refetch}},ae=e=>{const t=M(),r=b({...N(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:A(e)})}}),{mutate:a,mutateAsync:i}=r,n=m.useCallback((o,d,l)=>{e&&a({path:{accountId:e},body:S(o,d,l)})},[e,a]),s=m.useCallback(async(o,d,l)=>e?i({path:{accountId:e},body:S(o,d,l)}).then(()=>!0,()=>!1):!1,[e,i]);return{createFilter:n,createFilterAsync:s,isPending:r.isPending,isSuccess:r.isSuccess,isError:r.isError,error:r.error,reset:r.reset}},ne=e=>{const t=M(),r=b({...z(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:A(e)})}}),{mutate:a}=r;return{deleteFilter:m.useCallback(n=>{e&&a({path:{accountId:e,filterId:n}})},[e,a]),isPending:r.isPending,deletingFilterId:r.isPending?r.variables?.path.filterId:void 0}};export{h as N,Z as S,Y as a,A as b,te as c,K as d,se as e,B as f,ne as g,y as h,ae as i,G as j,V as k,ee as n,X as o,O as p,U as r,re as u};
1
+ import{r as p,i as b,dR as E,c as C,dS as x,dp as F,dT as D,h as M,dU as N,dV as P,dW as L,dX as z}from"./index-lxVTsHBH.js";const B=(e,t)=>{if(e.state==="Expired")return"Expired";if(e.scope!=="Temporary"||!e.expiresAt)return"Active";const r=Date.parse(e.expiresAt);return Number.isNaN(r)?"Active":r<=t?"Expired":"Active"},K=e=>{if(!e)return;const t=Date.parse(e);if(!Number.isNaN(t))return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})},O=(e,t=new Date)=>{if(!e)return;const r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!r)return;const[,a,i,n]=r,s=new Date(Number(a),Number(i)-1,Number(n),23,59,59,0);if(Number.isNaN(s.getTime()))return;const o=-t.getTimezoneOffset(),d=o>=0?"+":"-",l=Math.abs(o),c=String(Math.floor(l/60)).padStart(2,"0"),f=String(l%60).padStart(2,"0"),u=m=>String(m).padStart(2,"0");return`${s.getFullYear()}-${u(s.getMonth()+1)}-${u(s.getDate())}T${u(s.getHours())}:${u(s.getMinutes())}:${u(s.getSeconds())}${d}${c}:${f}`},h="None",V=e=>!e.literalClauses.some(t=>t.field==="HasWords"),y=e=>({...e.anchorMessageId?{anchorMessageId:e.anchorMessageId}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h}),X=({mode:e,ruleScope:t})=>t==="standing"?"standing":t==="until"?"temporary":e==="selected"?"just-these":"all-like-these",G=({mode:e,ruleScope:t,anchorMessageId:r,clauses:a,matchOperator:i,moveMailboxId:n,until:s})=>({...e==="similar"&&r?{anchorMessageId:r}:{},matchOperator:i==="all"?"And":"Or",literalClauses:a.map(o=>({field:o.field,value:o.value})),moveMailboxId:n,expiresAt:t==="until"?O(s??""):void 0}),S=(e,t,r)=>({name:r,scope:t==="standing"?"Standing":"Temporary",...t==="temporary"&&e.expiresAt?{expiresAt:e.expiresAt}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h,...e.anchorMessageId?{anchorMessageId:e.anchorMessageId}:{}}),T=new Set(["Complete","Failed"]),v=e=>e!==void 0&&T.has(e),w=1e3,J=15e3,R=e=>{const t=Math.max(0,e),r=w*2**t;return Math.min(r,J)},_=(e,t,r)=>{if(e)return{kind:r?"restartFailed":"startFailed",error:e};if(t)return{kind:"statusUnreadable",error:t}},Y=e=>{const[t,r]=p.useState(),a=b({...E(),onSuccess:g=>r(g.organizeJobId)}),{mutate:i}=a,n=C({...x({path:{accountId:e??"",organizeJobId:t??""}}),enabled:!!e&&!!t,refetchInterval:g=>{const I=g.state.data?.state;return v(I)?!1:R(g.state.dataUpdateCount)}}),s=p.useCallback(g=>{e&&i({path:{accountId:e},body:y(g)})},[e,i]),{refetch:o}=n,d=p.useCallback(()=>{o()},[o]),l=n.data,c=a.isPending?void 0:l,f=c?.state??a.data?.state,u=v(c?.state),m={state:f,matchedCount:c?.matchedCount??0,appliedCount:c?.appliedCount??0,failedCount:c?.failedCount??0,errorMessage:c?.errorMessage??""};return{start:s,refreshStatus:d,progress:m,isStarting:a.isPending,isRunning:!!t&&!u,isDone:u,failure:_(a.error,n.error,!!l)}},Z=["From","Subject","HasWords","ListId","FromDomain"],$=e=>{const t=e.trim(),r=t.match(/<([^>]+)>/);return(r?r[1]:t).trim().toLowerCase()},ee=(e,t)=>e==="ListId"?$(t):t.trim(),k=e=>e==="all"?"And":"Or",U=(e,t)=>{const r=e.widen!==void 0&&!e.widen.inactive,a=e.clauses.map(i=>({field:i.field,value:i.value}));return{...r&&t?{anchorMessageId:t}:{},matchOperator:k(e.matchOperator),literalClauses:a}},Q=e=>e.anchorMessageId!==void 0||!e.literalClauses.some(t=>t.field==="HasWords"),W=e=>JSON.stringify({anchor:e.anchorMessageId??null,operator:e.matchOperator,clauses:e.literalClauses.map(t=>`${t.field} ${t.value}`)}),te=(e,t)=>{const r=U(e,t);return{...r.anchorMessageId?{anchorMessageId:r.anchorMessageId}:{},matchOperator:r.matchOperator,literalClauses:r.literalClauses,moveMailboxId:e.moveMailboxId,labelId:e.labelId,expiresAt:e.scope==="until"?O(e.until??""):void 0}},j=(e,t)=>e.error!==void 0&&e.errorSignature===t?{status:"error",reason:e.error}:e.count===void 0?{status:"loading"}:e.previewedSignature===t?{status:"ready",count:e.count}:{status:"ready",count:e.count,stale:!0},q=350,re=(e,t,r)=>{const a=b(F()),{mutateAsync:i}=a,n=W(t),[s,o]=p.useState(()=>({})),d=p.useRef(t);d.current=t;const l=p.useRef(n),c=Q(t);return p.useEffect(()=>{if(!e||!c||n===s.previewedSignature||n===s.errorSignature)return;const f=setTimeout(()=>{const u=n;l.current=u,i({path:{accountId:e},body:y({...d.current})}).then(m=>{l.current===u&&o({count:m.matchedCount,matchedIds:m.messageIds,previewedSignature:u})}).catch(m=>{l.current===u&&o(g=>({...g,error:m instanceof Error?m.message:"Couldn't count matches.",errorSignature:u}))})},q);return()=>clearTimeout(f)},[e,c,n,s.previewedSignature,s.errorSignature,i]),c?{count:j(s,n),matchedIds:s.previewedSignature===n?s.matchedIds??[]:[]}:{count:{status:"error",reason:D},matchedIds:[]}},A=e=>P({path:{accountId:e}}),se=e=>{const t=C({...L({path:{accountId:e??""}}),enabled:!!e});return{filters:t.data?.items??[],isPending:t.isPending,isError:t.isError,error:t.error,refetch:t.refetch}},ae=e=>{const t=M(),r=b({...N(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:A(e)})}}),{mutate:a,mutateAsync:i}=r,n=p.useCallback((o,d,l)=>{e&&a({path:{accountId:e},body:S(o,d,l)})},[e,a]),s=p.useCallback(async(o,d,l)=>e?i({path:{accountId:e},body:S(o,d,l)}).then(()=>!0,()=>!1):!1,[e,i]);return{createFilter:n,createFilterAsync:s,isPending:r.isPending,isSuccess:r.isSuccess,isError:r.isError,error:r.error,reset:r.reset}},ne=e=>{const t=M(),r=b({...z(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:A(e)})}}),{mutate:a}=r;return{deleteFilter:p.useCallback(n=>{e&&a({path:{accountId:e,filterId:n}})},[e,a]),isPending:r.isPending,deletingFilterId:r.isPending?r.variables?.path.filterId:void 0}};export{h as N,Z as S,Y as a,A as b,te as c,K as d,se as e,B as f,ne as g,y as h,ae as i,G as j,V as k,ee as n,X as o,O as p,U as r,re as u};
@@ -0,0 +1 @@
1
+ import{c as d,dM as L,h as n,i as l,dN as p,r as o,dO as y,dP as c,dQ as g}from"./index-lxVTsHBH.js";const u=e=>y({path:{accountId:e}}),f=e=>{const r=d({...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({...p(),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};
@@ -0,0 +1 @@
1
+ import{e as r,u as s,r as o,bJ as t,bK as n}from"./index-lxVTsHBH.js";const p=r("BellOff",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]);function l(){const e=s();return o.useCallback(a=>{e({to:"/mail/brief",search:{q:a||void 0}})},[e])}function h(){const e=s();return o.useCallback((a,i)=>{e({to:"/mail/$mailboxId",params:{mailboxId:a},search:{q:i||void 0}})},[e])}const c=768,d=e=>e!=="desktop",b=()=>{const e=t(`(min-width: ${c}px)`);return t(n)?"desktop":e?"tablet":"phone"};export{p as B,l as a,h as b,d as i,b as u};
@@ -0,0 +1 @@
1
+ import{r as c,u as M,c3 as S,c4 as O,a8 as h,c5 as B,q as P,aa as U,h as N,c as $,cu as D,cv as F}from"./index-lxVTsHBH.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=h({from:w,shouldThrow:!1}),t=h({from:R,shouldThrow:!1}),r=h({from:E,shouldThrow:!1}),s=h({from:k,shouldThrow:!1});return e??t??r??s}function z(){return T()!==void 0}function Y(){return T()?.outboxMessageId}function v(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 b(){const e=M(),t=S(),{list:r,mailboxId:s}=O();return c.useCallback((n,o)=>{e({...v(r,s,n),search:a=>a,hash:o?.keepPanels?!0:t,replace:o?.replace??!1})},[e,t,r,s])}function j(){const e=b();return c.useCallback(()=>e(void 0),[e])}function J(){const e=b();return c.useCallback(t=>e(t),[e])}function V(){const e=b();return c.useCallback(t=>e(t,{replace:!0,keepPanels:!0}),[e])}function Z(){return B()}const L=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},g={all:["messages"],detail:e=>[...g.all,"detail",e],body:e=>[...g.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 _=e=>{const t=Number.parseInt(e??"",10);return!Number.isFinite(t)||t<=0?1:Math.min(t,30)},q=8,K="x-remit-403-reason",Q=(e,t)=>{const r=t?.trim()??"";return e===401?"auth":e===403?r.length>0?"auth":"body-missing":e===404?"body-missing":"generic"},I=(e,t)=>(t??"").toLowerCase().startsWith("text/html")?/<div\s+id=["']root["']/i.test(e):!1,X=(e,t)=>{const r=(t??"").toLowerCase();return!!(e==="text"&&r.startsWith("text/html"))},G=async(e,t,r=async()=>null)=>{const s={},n=await r();n&&(s.Authorization=`Bearer ${n}`);const o=await F(e,{headers:s});if(o.status===202)throw new f("not-ready","Message body is still syncing",202,_(o.headers.get("Retry-After")));if(!o.ok){const l=o.headers.get(K),m=Q(o.status,l);throw new f(m,`Failed to load message body (${o.status} ${o.statusText})`,o.status)}const a=o.headers.get("content-type");if(X(t,a))throw new f("content-type-mismatch",`Refusing to render message body — expected ${t}, got Content-Type ${a}`);const y=await o.text();if(I(y,a))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 y},H=async(e,t)=>(t.isRetryAfterNotReady&&await e.refetchDescribeMessage(),e.fetchContent(t.contentUrl,t.kind)),ee=({messageId:e,bodyParts:t,enabled:r=!0})=>{const s=t?L(t):null,n=P(),{getToken:o}=U(),a=c.useRef(null),y=N(),l=c.useRef(!1),m=c.useRef(null),C=e&&s?`${e}:${s.contentUrl}`:null;m.current!==C&&(m.current=C,l.current=!1);const i=$({queryKey:e?[...g.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,H({fetchContent:(u,A)=>G(u,A,o),refetchDescribeMessage:()=>y.refetchQueries({queryKey:D({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;c.useEffect(()=>{p&&(a.current=performance.now())},[p]),c.useEffect(()=>{i.isSuccess&&a.current!==null&&(n.recordTiming("message.body.load",Math.round(performance.now()-a.current)),a.current=null)},[i.isSuccess,n]);const x=i.data&&s?{kind:s.kind,body:i.data}:void 0;return{picked:s,data:x,isLoading:p,isError:i.isError,error:i.error,refetch:i.refetch}};export{f as B,z as a,ee as b,Y as c,V as d,Z as e,J as f,Q as g,j as u};
@@ -0,0 +1 @@
1
+ import{bL as E,bM as y,bN as S,bO as w,bP as C,h as k,bQ as M,bR as q,r as d,bS as x,bT as H,bU as L,bV as P,bW as R,bX as B,bY as T}from"./index-lxVTsHBH.js";function v(r,e){const s=new Set(e);return r.filter(t=>!s.has(t))}function A(r,e,s){const t=r.slice(0);return t[e]=s,t}var U=class extends E{#i;#e;#n;#r;#s;#t;#o;#u;#h;#a=[];constructor(r,e,s){super(),this.#i=r,this.#r=s,this.#n=[],this.#s=[],this.#e=[],this.setQueries(e)}onSubscribe(){this.listeners.size===1&&this.#s.forEach(r=>{r.subscribe(e=>{this.#f(r,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#s.forEach(r=>{r.destroy()})}setQueries(r,e){this.#n=r,this.#r=e,y.batch(()=>{const s=this.#s,t=this.#b(this.#n);t.forEach(o=>o.observer.setOptions(o.defaultedQueryOptions));const i=t.map(o=>o.observer),n=i.map(o=>o.getCurrentResult()),u=s.length!==i.length,c=i.some((o,f)=>o!==s[f]),b=u||c,p=b?!0:n.some((o,f)=>{const g=this.#e[f];return!g||!S(o,g)});!b&&!p||(b&&(this.#a=t,this.#s=i),this.#e=n,this.hasListeners()&&(b&&(v(s,i).forEach(o=>{o.destroy()}),v(i,s).forEach(o=>{o.subscribe(f=>{this.#f(o,f)})})),this.#d()))})}getCurrentResult(){return this.#e}getQueries(){return this.#s.map(r=>r.getCurrentQuery())}getObservers(){return this.#s}getOptimisticResult(r,e){const s=this.#b(r),t=s.map(n=>n.observer.getOptimisticResult(n.defaultedQueryOptions)),i=s.map(n=>n.defaultedQueryOptions.queryHash);return[t,n=>this.#l(n??t,e,i),()=>this.#c(t,s)]}#c(r,e){return e.map((s,t)=>{const i=r[t];return s.defaultedQueryOptions.notifyOnChangeProps?i:s.observer.trackResult(i,n=>{e.forEach(u=>{u.observer.trackProp(n)})})})}#l(r,e,s){if(e){const t=this.#h,i=s!==void 0&&t!==void 0&&(t.length!==s.length||s.some((n,u)=>n!==t[u]));return(!this.#t||this.#e!==this.#u||i||e!==this.#o)&&(this.#o=e,this.#u=this.#e,s!==void 0&&(this.#h=s),this.#t=w(this.#t,e(r))),this.#t}return r}#p(){return this.#r?.combine!==void 0&&this.#s.some((r,e)=>r.options.suspense&&this.#e[e]?.data===void 0)}#b(r){const e=new Map;this.#s.forEach(t=>{const i=t.options.queryHash;if(!i)return;const n=e.get(i);n?n.push(t):e.set(i,[t])});const s=[];return r.forEach(t=>{const i=this.#i.defaultQueryOptions(t),u=e.get(i.queryHash)?.shift()??new C(this.#i,i);s.push({defaultedQueryOptions:i,observer:u})}),s}#f(r,e){const s=this.#s.indexOf(r);s!==-1&&(this.#e=A(this.#e,s,e),this.#d())}#d(){if(this.hasListeners()){const r=this.#c(this.#e,this.#a),e=this.#p(),s=this.#t,t=e?s:this.#l(r,this.#r?.combine);(e||s!==t)&&y.batch(()=>{this.listeners.forEach(i=>{i(this.#e)})})}}};function I({queries:r,...e},s){const t=k(),i=M(),n=q(),u=d.useMemo(()=>r.map(h=>{const a=t.defaultQueryOptions(h);return a._optimisticResults=i?"isRestoring":"optimistic",a}),[r,t,i]);u.forEach(h=>{x(h);const a=t.getQueryCache().get(h.queryHash);H(h,n,a)}),L(n);const[c]=d.useState(()=>new U(t,u,e)),[b,p,o]=c.getOptimisticResult(u,e.combine),f=!i&&e.subscribed!==!1;d.useSyncExternalStore(d.useCallback(h=>f?c.subscribe(y.batchCalls(h)):P,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),d.useEffect(()=>{c.setQueries(u,e)},[u,e,c]);const m=b.some((h,a)=>R(u[a],h))?b.flatMap((h,a)=>{const l=u[a];if(l&&R(l,h)){const Q=new C(t,l);return B(l,Q,n)}return[]}):[];if(m.length>0)throw Promise.all(m);const O=b.find((h,a)=>{const l=u[a];return l&&T({result:h,errorResetBoundary:n,throwOnError:l.throwOnError,query:t.getQueryCache().get(l.queryHash),suspense:l.suspense})});if(O?.error)throw O.error;return p(o())}export{I as u};
@@ -0,0 +1 @@
1
+ import{j as E,_ as Q,t as W,f as U,r as o,aN as R,h as O,C as $,q as z,M as B,N as G,P as I,Q as X}from"./index-lxVTsHBH.js";import{C as V}from"./circle-check-big-B1p6oh-i.js";import{R as J,i as Y,t as Z}from"./search-token-index-D1mRODfF.js";import{u as P}from"./useQueries-CPnZMt_1.js";function Se({state:e,onRefresh:s,label:t,errorMessage:r,hasUpdate:a,size:u="sm",className:c}){const i=e==="refreshing",n=e==="error",h=e==="success",y=n?E.jsx(Q,{className:"size-4 text-danger"}):h?E.jsx(V,{className:"size-4 text-positive"}):E.jsx(J,{className:W("size-4",i&&"animate-spin")}),w=n?`${t} — failed: ${r??"try again"}`:i?`${t} — refreshing`:h?`${t} — up to date`:a?`${t} — new mail`:t;return E.jsxs("div",{className:"relative inline-flex",children:[E.jsx(U,{variant:"ghost",size:u,icon:y,onClick:s,disabled:i,"aria-label":w,"aria-busy":i||void 0,title:n?r:t,className:c}),e==="idle"&&a&&E.jsx("span",{"aria-hidden":"true",className:"absolute right-1 top-1 size-1.5 rounded-full bg-accent-2"})]})}const ee=new Set(["discovering_mailboxes","syncing_inbox","syncing_others"]);function L(e){return!!e&&ee.has(e)}const q=3e3,te=q*2,T={syncing:!1,resolved:!1,synced:0,total:0};function we(e,s){const t=e.join(","),[r,a]=o.useState(!1),[u,c]=o.useState(!1);o.useEffect(()=>{a(!1),c(!1)},[t,s]),o.useEffect(()=>{if(!s)return;const m=setTimeout(()=>c(!0),te);return()=>clearTimeout(m)},[t,s]);const i=P({queries:e.map(m=>({...R({path:{accountId:m}}),enabled:s&&!r,refetchInterval:q,meta:{softError:!0}}))}),n=i.every(m=>m.isSuccess||m.isError),h=i.length===0||n||u;let y=!1,w=0,S=0;for(const m of i)if(L(m.data?.syncPhase)){y=!0;for(const l of m.data?.mailboxes??[])w+=l.messagesSynced,S+=l.messagesTotal}const x=s&&h&&!y;return o.useEffect(()=>{x&&a(!0)},[x]),!s||!h?T:{syncing:y,resolved:!0,synced:w,total:S}}const se=180*1e3,xe=30*1e3;let F=0;const M=new Set,ne=(e=Date.now())=>{F=e+se;for(const s of M)s()},pe=(e=Date.now())=>e<F,Ee=e=>(M.add(e),()=>{M.delete(e)}),_=6e4,re=new Set(["sent","drafts","trash","archive"]),C=(e,s)=>{const t=new Map;for(const r of e){const a=s.get(r.mailboxId)?.role;a&&re.has(a)||t.set(r.mailboxId,r.messagesTotal)}return t},j=(e,s)=>{const t=[];for(const[r,a]of s)a>(e.get(r)??0)&&t.push(r);return t},oe=(e,s)=>j(e,s).length>0,D=o.createContext(null),ae=()=>{const e=o.useContext(D);if(!e)throw new Error("useMailFreshness must be used inside <MailFreshnessProvider>");return e};function be({accountIds:e,children:s}){const t=O(),{resultFolderIndex:r}=$(),a=o.useRef(new Map),u=o.useRef(new Set),c=o.useRef(new Map),[i,n]=o.useState(new Set),h=P({queries:e.map(l=>({...R({path:{accountId:l}}),refetchInterval:_,staleTime:_,meta:{softError:!0}}))}),y=h.map(l=>l.dataUpdatedAt).join(","),w=e.join(",");o.useEffect(()=>{let l=!1;const f=new Set(i);e.forEach((d,p)=>{const b=h[p]?.data;if(!b)return;const g=C(b.mailboxes??[],r),k=c.current.get(d);if(c.current.set(d,g),k){const A=j(k,g);A.length>0&&Y(t,Z(A))}if(!u.current.has(d)){u.current.add(d),a.current.set(d,g);return}if(f.has(d))return;const K=a.current.get(d)??new Map;oe(K,g)&&(f.add(d),l=!0)}),l&&n(f)},[w,y]);const S=o.useCallback(l=>l.some(f=>i.has(f)),[i]),x=o.useCallback(l=>{n(f=>{if(l.every(p=>!f.has(p)))return f;const d=new Set(f);for(const p of l)d.delete(p);return d});for(const f of l){const d=t.getQueryData(R({path:{accountId:f}}).queryKey);a.current.set(f,C(d?.mailboxes??[],r)),u.current.add(f)}},[t,r]),m=o.useMemo(()=>({hasNewMail:S,acknowledge:x}),[S,x]);return E.jsx(D.Provider,{value:m,children:s})}const ie=2e3,ce=45e3,ue=e=>new Promise(s=>setTimeout(s,e)),v=e=>e instanceof Error&&e.message?e.message:"Something went wrong",le=e=>{I(e,{softError:!0},"user")&&X(e)},N=(e,s)=>e.fetchQuery({...R({path:{accountId:s}}),staleTime:0}),H=e=>e.mailboxes?.find(s=>s.fullPath?.toUpperCase()==="INBOX")?.lastSyncedAt??0,fe=async({accountId:e,readStatus:s,baselineLastSyncAt:t,baselineInboxSyncedAt:r=0,onInboxSynced:a,deadline:u,pollMs:c=ie})=>{let i=!1;for(;;){const n=await s().then(S=>({ok:!0,data:S})).catch(S=>({ok:!1,error:S}));if(!n.ok)return{accountId:e,message:v(n.error)};const{syncPhase:h,lastSyncAt:y}=n.data;if((y??0)>t&&!L(h))return h==="error"?{accountId:e,message:"Sync failed for this account"}:void 0;if(!i&&H(n.data)>r&&(i=!0,a?.()),Date.now()>=u)return{accountId:e,message:"Refresh is taking longer than usual"};await ue(c)}},de=async(e,s,t,r,a)=>{const u=await N(e,t).then(n=>({ok:!0,lastSyncAt:n.lastSyncAt??0,inboxSyncedAt:H(n)})).catch(n=>({ok:!1,error:n}));if(!u.ok)return{accountId:t,enqueued:!1,ok:!1,message:v(u.error)};const c=await B({path:{accountId:t},throwOnError:!0}).then(()=>({ok:!0})).catch(n=>({ok:!1,error:n}));if(!c.ok)return le(c.error),{accountId:t,enqueued:!1,ok:!1,message:v(c.error)};s.recordEvent("sync.triggered");const i=await fe({accountId:t,readStatus:()=>N(e,t),baselineLastSyncAt:u.lastSyncAt,baselineInboxSyncedAt:u.inboxSyncedAt,onInboxSynced:()=>a(t),deadline:r});return i?{accountId:t,enqueued:!0,ok:!1,message:i.message}:{accountId:t,enqueued:!0,ok:!0}},Re=(e,s={})=>{const t=O(),r=z(),{acknowledge:a}=ae(),[u,c]=o.useState("idle"),[i,n]=o.useState(),h=o.useRef(0),y=o.useRef(e);y.current=e;const w=o.useRef(s);w.current=s,o.useEffect(()=>{if(u!=="success")return;const x=setTimeout(()=>c("idle"),2e3);return()=>clearTimeout(x)},[u]);const S=o.useCallback(()=>{const x=y.current;if(x.length===0){c("error"),n("Nothing to refresh yet");return}const m=++h.current;c("refreshing"),n(void 0),ne();const l=f=>{h.current===m&&(t.invalidateQueries({queryKey:G({path:{accountId:f}})}),w.current.onSettled?.())};(async()=>{const f=Date.now()+ce,d=await Promise.all(x.map(g=>de(t,r,g,f,l)));if(h.current!==m)return;const p=d.filter(g=>g.enqueued).map(g=>g.accountId);for(const g of p)l(g);p.length>0&&a(p);const b=d.filter(g=>!g.ok);b.length===0?c("success"):(c("error"),n(b[0]?.message))})()},[a,t,r]);return{state:u,errorMessage:i,refresh:S}};export{xe as H,be as M,Se as R,Re as a,L as b,we as c,pe as i,Ee as s,ae as u};
@@ -1,4 +1,4 @@
1
- import{cp as V,r as g,j as a,p as b,I as Q,u as Y,ar as q,f as X,at as Z,cF as J,bD as ee,P as te,t as se,X as re,bS as R,Q as ne,c5 as ae}from"./index-FpwHnbdV.js";import{K as k}from"./kbd-tXno4rYH.js";import{B as oe,d as ie}from"./useMessageBodyContent-BOBb68Px.js";import{i as ce}from"./search-scope-DTcpOp3S.js";const le=(e,t)=>{const r=e==="newsletter"||e==="marketing"||t;return{framed:r,isPlain:!r}},de=()=>`
1
+ import{cc as V,r as g,j as a,t as b,I as Q,h as Y,as as q,i as X,au as Z,cu as J,bE as ee,aa as te,_ as se,X as re,cJ as R,C as ne,c4 as ae}from"./index-lxVTsHBH.js";import{K as k}from"./kbd-Ds8JAL-i.js";import{B as oe,b as ie}from"./useMessageBodyContent-CUM4C6Cq.js";import{i as ce}from"./search-scope-B5-OK3Cq.js";const le=(e,t)=>{const r=e==="newsletter"||e==="marketing"||t;return{framed:r,isPlain:!r}},de=()=>`
2
2
  /* Zero the UA default body margin and clamp the document to the iframe width so
3
3
  wide author markup can't push the body (and the page) past the viewport. */
4
4
  html, body {
@@ -53,14 +53,14 @@ pre, code {
53
53
  :is(pre, code, pre *, code *):is([nowrap], [style*="nowrap" i]) {
54
54
  white-space: pre-wrap !important;
55
55
  }
56
- `,ue=e=>{const t=new Map;for(const s of e){if(!s.contentId||s.contentUrl.length===0)continue;const r=s.contentId.replace(/^<|>$/g,"");t.set(r,s.contentUrl)}return s=>t.get(s.replace(/^<|>$/g,""))},me=/^(none|transparent|inherit|initial|unset)\s*$/i,_=e=>{const t=[],s=/<style[^>]*>([\s\S]*?)<\/style>/gi;let r;for(r=s.exec(e);r!==null;)t.push(r[1]),r=s.exec(e);return t},fe=e=>{const t=/background(?:-color)?\s*:\s*([^;}\n]+)/gi;let s;for(s=t.exec(e);s!==null;){const r=s[1].trim();if(!me.test(r))return!0;s=t.exec(e)}return!1},he=e=>{if(/\bstyle\s*=\s*["'][^"']*background/i.test(e)||/\bbgcolor\s*=/i.test(e))return!0;for(const t of _(e))if(fe(t))return!0;return!1},ge=new Set(["auto","none","initial","inherit","unset","revert","revert-layer"]),pe=new RegExp(`(?<![-\\w])(?:padding|margin)(?:-(top|right|bottom|left|block|inline)(?:-(?:start|end))?)?\\s*:\\s*([^;}"']+)`,"gi"),be=new Set(["top","bottom","block"]),B=e=>e.replace(/\/\*[\s\S]*?\*\//g,""),E=e=>{const t=e.toLowerCase();if(!t||ge.has(t)||t.startsWith("-"))return!1;const s=/^\+?(\d*\.?\d+)[a-z%]*$/.exec(t);return s?Number.parseFloat(s[1])!==0:!0},ye=e=>{const t=e.split(/\s+/).filter(Boolean);return t.length<2?t:t.length<4?[t[1]]:[t[1],t[3]]},xe=(e,t)=>{if(e&&be.has(e))return!1;const s=t.replace(/!\s*important/gi,"").trim();return s?e?s.split(/\s+/).some(E):ye(s).some(E):!1},T=e=>{for(const t of B(e).matchAll(pe))if(xe(t[1],t[2]))return!0;return!1},I=new Set(["blockquote"]),we=e=>e.replace(/<!--[\s\S]*?-->/g,""),ve=e=>{const t=[],s=/<([a-zA-Z][\w:-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,r=/\bstyle\s*=\s*(?:"([^"]*)"|'([^']*)')/gi;for(const[,n,o]of e.matchAll(s))for(const l of o.matchAll(r))t.push({tag:n.toLowerCase(),style:l[1]??l[2]??""});return t},ke=e=>[...B(e).matchAll(/([^{}]*)\{([^{}]*)\}/g)].map(t=>({selector:t[1].trim(),body:t[2]})),Se=e=>{const t=e.trim().split(/[\s>+~]+/).pop()??"";return(/^[a-zA-Z][\w-]*/.exec(t)?.[0]??"").toLowerCase()},Ae=e=>e.split(",").every(t=>I.has(Se(t))),Ee=e=>{const t=_(e),s=we(e);if(/\bcellpadding\s*=\s*["']?(?!0["'\s>])\d/i.test(s))return!0;for(const{tag:r,style:n}of ve(s))if(!I.has(r)&&T(n))return!0;for(const r of t)for(const n of ke(r))if(!Ae(n.selector)&&T(n.body))return!0;return!1},Te=["script","iframe","object","embed","form","input","button","textarea","select","meta","link","base"],Ne=["onerror","onload","onclick","onmouseover","onmouseout","onfocus","onblur","onsubmit","onkeydown","onkeyup","formaction","xlink:href","data-bind"],Ce="data:image/svg+xml,"+encodeURIComponent(`
56
+ `,ue=e=>{const t=new Map;for(const s of e){if(!s.contentId||s.contentUrl.length===0)continue;const r=s.contentId.replace(/^<|>$/g,"");t.set(r,s.contentUrl)}return s=>t.get(s.replace(/^<|>$/g,""))},me=/^(none|transparent|inherit|initial|unset)\s*$/i,_=e=>{const t=[],s=/<style[^>]*>([\s\S]*?)<\/style>/gi;let r;for(r=s.exec(e);r!==null;)t.push(r[1]),r=s.exec(e);return t},fe=e=>{const t=/background(?:-color)?\s*:\s*([^;}\n]+)/gi;let s;for(s=t.exec(e);s!==null;){const r=s[1].trim();if(!me.test(r))return!0;s=t.exec(e)}return!1},he=e=>{if(/\bstyle\s*=\s*["'][^"']*background/i.test(e)||/\bbgcolor\s*=/i.test(e))return!0;for(const t of _(e))if(fe(t))return!0;return!1},ge=new Set(["auto","none","initial","inherit","unset","revert","revert-layer"]),pe=new RegExp(`(?<![-\\w])(?:padding|margin)(?:-(top|right|bottom|left|block|inline)(?:-(?:start|end))?)?\\s*:\\s*([^;}"']+)`,"gi"),be=new Set(["top","bottom","block"]),B=e=>e.replace(/\/\*[\s\S]*?\*\//g,""),E=e=>{const t=e.toLowerCase();if(!t||ge.has(t)||t.startsWith("-"))return!1;const s=/^\+?(\d*\.?\d+)[a-z%]*$/.exec(t);return s?Number.parseFloat(s[1])!==0:!0},ye=e=>{const t=e.split(/\s+/).filter(Boolean);return t.length<2?t:t.length<4?[t[1]]:[t[1],t[3]]},xe=(e,t)=>{if(e&&be.has(e))return!1;const s=t.replace(/!\s*important/gi,"").trim();return s?e?s.split(/\s+/).some(E):ye(s).some(E):!1},T=e=>{for(const t of B(e).matchAll(pe))if(xe(t[1],t[2]))return!0;return!1},I=new Set(["blockquote"]),we=e=>e.replace(/<!--[\s\S]*?-->/g,""),ve=e=>{const t=[],s=/<([a-zA-Z][\w:-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,r=/\bstyle\s*=\s*(?:"([^"]*)"|'([^']*)')/gi;for(const[,n,o]of e.matchAll(s))for(const l of o.matchAll(r))t.push({tag:n.toLowerCase(),style:l[1]??l[2]??""});return t},ke=e=>[...B(e).matchAll(/([^{}]*)\{([^{}]*)\}/g)].map(t=>({selector:t[1].trim(),body:t[2]})),Ae=e=>{const t=e.trim().split(/[\s>+~]+/).pop()??"";return(/^[a-zA-Z][\w-]*/.exec(t)?.[0]??"").toLowerCase()},Se=e=>e.split(",").every(t=>I.has(Ae(t))),Ee=e=>{const t=_(e),s=we(e);if(/\bcellpadding\s*=\s*["']?(?!0["'\s>])\d/i.test(s))return!0;for(const{tag:r,style:n}of ve(s))if(!I.has(r)&&T(n))return!0;for(const r of t)for(const n of ke(r))if(!Se(n.selector)&&T(n.body))return!0;return!1},Te=["script","iframe","object","embed","form","input","button","textarea","select","meta","link","base"],Ce=["onerror","onload","onclick","onmouseover","onmouseout","onfocus","onblur","onsubmit","onkeydown","onkeyup","formaction","xlink:href","data-bind"],Ne="data:image/svg+xml,"+encodeURIComponent(`
57
57
  <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100">
58
58
  <rect fill="#f0f0f0" width="100" height="100"/>
59
59
  <text x="50" y="50" text-anchor="middle" dy=".3em" fill="#999" font-size="12">
60
60
  Image blocked
61
61
  </text>
62
62
  </svg>
63
- `),je=e=>e.replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),Le=e=>e.replace(/@import[^;]*;/gi,"/* @import blocked */").replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),Re=(e={})=>{const t=V(),s={FORBID_TAGS:Te,FORBID_ATTR:Ne,ALLOW_DATA_ATTR:!1,ALLOW_UNKNOWN_PROTOCOLS:!1};return t.addHook("afterSanitizeAttributes",r=>{if(r.tagName==="IMG"){const n=r.getAttribute("src")||"";if(n.startsWith("data:"))return;if(n.startsWith("cid:")){const l=n.slice(4).replace(/^<|>$/g,""),m=e.resolveCid?.(l);m&&(r.setAttribute("src",m),r.classList.add("inline-content"));return}e.allowExternalImages||(r.setAttribute("data-blocked-src",n),r.setAttribute("src",Ce),r.setAttribute("alt","[Blocked image]"),r.classList.add("blocked-image"))}if(r.tagName==="A"){const n=r.getAttribute("href")||"";if(/^(javascript|data):/i.test(n)){r.removeAttribute("href");return}r.setAttribute("target","_blank"),r.setAttribute("rel","noopener noreferrer nofollow"),r.classList.add("external-link")}if(r.hasAttribute("style")){const n=r.getAttribute("style")||"";r.setAttribute("style",je(n))}}),t.addHook("uponSanitizeElement",(r,n)=>{if(n.tagName==="style"){const o=r.textContent||"";r.textContent=Le(o)}}),r=>{const n=he(r),o=Ee(r),l=t.sanitize(r,s);return{html:`<style>${de()}</style>${l}`,hasAuthorBackground:n,hasAuthorSpacing:o}}},_e='"Geist Variable", "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',v={light:{fg:"oklch(0.3 0.025 235)",canvas:"oklch(0.96 0.015 90)",accent:"oklch(0.55 0.14 150)"},dark:{fg:"oklch(0.88 0.02 90)",canvas:"oklch(0.22 0.025 220)",accent:"oklch(0.78 0.16 150)"}},Be={background:!1,spacing:!1},Ie="16px",Me=()=>`html{padding:0}body{padding:${Ie};box-sizing:border-box}`,Oe=()=>"html{overflow:hidden}body{overflow-x:auto}",De=/prefers-color-scheme\s*:\s*dark|color-scheme\s*:\s*[^;}"']*\bdark\b/i,$e='<meta name="viewport" content="width=device-width, initial-scale=1">',ze=e=>{const t=e?v.dark:v.light;return`
63
+ `),je=e=>e.replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),Le=e=>e.replace(/@import[^;]*;/gi,"/* @import blocked */").replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),Re=(e={})=>{const t=V(),s={FORBID_TAGS:Te,FORBID_ATTR:Ce,ALLOW_DATA_ATTR:!1,ALLOW_UNKNOWN_PROTOCOLS:!1};return t.addHook("afterSanitizeAttributes",r=>{if(r.tagName==="IMG"){const n=r.getAttribute("src")||"";if(n.startsWith("data:"))return;if(n.startsWith("cid:")){const l=n.slice(4).replace(/^<|>$/g,""),m=e.resolveCid?.(l);m&&(r.setAttribute("src",m),r.classList.add("inline-content"));return}e.allowExternalImages||(r.setAttribute("data-blocked-src",n),r.setAttribute("src",Ne),r.setAttribute("alt","[Blocked image]"),r.classList.add("blocked-image"))}if(r.tagName==="A"){const n=r.getAttribute("href")||"";if(/^(javascript|data):/i.test(n)){r.removeAttribute("href");return}r.setAttribute("target","_blank"),r.setAttribute("rel","noopener noreferrer nofollow"),r.classList.add("external-link")}if(r.hasAttribute("style")){const n=r.getAttribute("style")||"";r.setAttribute("style",je(n))}}),t.addHook("uponSanitizeElement",(r,n)=>{if(n.tagName==="style"){const o=r.textContent||"";r.textContent=Le(o)}}),r=>{const n=he(r),o=Ee(r),l=t.sanitize(r,s);return{html:`<style>${de()}</style>${l}`,hasAuthorBackground:n,hasAuthorSpacing:o}}},_e='"Geist Variable", "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',v={light:{fg:"oklch(0.3 0.025 235)",canvas:"oklch(0.96 0.015 90)",accent:"oklch(0.55 0.14 150)"},dark:{fg:"oklch(0.88 0.02 90)",canvas:"oklch(0.22 0.025 220)",accent:"oklch(0.78 0.16 150)"}},Be={background:!1,spacing:!1},Ie="16px",Me=()=>`html{padding:0}body{padding:${Ie};box-sizing:border-box}`,Oe=()=>"html{overflow:hidden}body{overflow-x:auto}",$e=/prefers-color-scheme\s*:\s*dark|color-scheme\s*:\s*[^;}"']*\bdark\b/i,De='<meta name="viewport" content="width=device-width, initial-scale=1">',ze=e=>{const t=e?v.dark:v.light;return`
64
64
  /* Plain-email base: UI font-stack + theme-aware colors (#424) */
65
65
  html, body {
66
66
  font-family: ${_e};
@@ -81,4 +81,4 @@ a, a:visited {
81
81
  color: ${t.accent} !important;
82
82
  text-decoration: underline;
83
83
  }
84
- `},A="invert(0.92) hue-rotate(180deg)",N=`img,picture,video,svg,canvas,[style*='background-image'],[background]{filter:${A}}`,Pe=(e,t,s)=>{const r=e?v.dark.canvas:v.light.canvas;return s?e?t?`html,body{margin:0;background-color:${r};color-scheme:dark light}`:`html{margin:0;background-color:#ffffff;filter:${A}}body{margin:0}${N}`:"html,body{margin:0;background-color:#ffffff;color-scheme:light}":e?t?`html,body{margin:0;background-color:${r};color-scheme:dark light}`:`html{margin:0;background-color:${r}}body{margin:0;filter:${A}}${N}`:`html,body{margin:0;background-color:${r};color-scheme:light}`},Ke=(e,t,s,r=Be)=>{const n=t==="plain"?ze(s):Pe(s,De.test(e),r.background),o=r.spacing?"":Me();return`${$e}<style>${n}</style>${e}<style>${Oe()}${o}</style>`},Fe=5e4,He="allow-same-origin allow-popups allow-popups-to-escape-sandbox",Ue=(e,t,s)=>Math.min(Math.ceil(Math.max(e,t)),s),Ge=new Set(["Enter","Escape","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"]),We=e=>e===" "?!1:e.length===1?!0:Ge.has(e),S=e=>{if(e.metaKey||e.ctrlKey||e.altKey||!We(e.key))return;const t=e.currentTarget??e.target,s=t?.defaultView?.parent;!s||s===t?.defaultView||s.dispatchEvent(new KeyboardEvent("keydown",{key:e.key,code:e.code,shiftKey:e.shiftKey,bubbles:!0,cancelable:!0}))},C=({html:e,variant:t="framed",isDark:s=!1,declares:r,className:n})=>{const o=g.useRef(null),[l,m]=g.useState(0),d=g.useMemo(()=>Ke(e,t,s,r),[e,t,s,r]);return g.useEffect(()=>{const c=o.current;if(!c)return;const f=()=>{const i=c.contentDocument;if(!i?.body)return;const x=i.documentElement,y=Ue(i.body.scrollHeight,x?.scrollHeight??0,Fe);m(w=>w===y?w:y)};let u,h;const p=()=>{f(),u?.disconnect(),u=void 0,h?.removeEventListener("keydown",S),h?.removeEventListener("load",f,!0),h=void 0;const i=c.contentDocument;i?.body&&(u=new ResizeObserver(f),u.observe(i.body),i.documentElement&&u.observe(i.documentElement),i.addEventListener("load",f,!0),i.fonts?.ready.then(f),i.addEventListener("keydown",S),h=i)};return c.addEventListener("load",p),()=>{c.removeEventListener("load",p),h?.removeEventListener("keydown",S),h?.removeEventListener("load",f,!0),u?.disconnect()}},[]),a.jsx("iframe",{ref:o,title:"Email content",sandbox:He,srcDoc:d,className:n,style:{width:"100%",border:"none",display:"block",height:l===0?"1px":`${l}px`,colorScheme:"normal"}})},j=()=>a.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),vt=({className:e,children:t})=>a.jsx("div",{className:b("[&_.message-body-frame]:-mx-2 lg:[&_.message-body-frame]:-mx-4",e),children:t}),Ve=({html:e,text:t,isDark:s=!1,category:r,allowImages:n=!1,resolveCid:o,className:l,renderBlockedNotice:m})=>{const d=g.useMemo(()=>!e||typeof document>"u"?null:Re({allowExternalImages:n,resolveCid:o})(e),[e,n,o]),c=d?.html??null,{framed:f,isPlain:u}=le(r,d?.hasAuthorBackground??!1),h=g.useMemo(()=>({background:d?.hasAuthorBackground??!1,spacing:d?.hasAuthorSpacing??!1}),[d?.hasAuthorBackground,d?.hasAuthorSpacing]),p=g.useMemo(()=>!c||n?0:(c.match(/data-blocked-src/g)||[]).length,[c,n]);return!c&&!t?a.jsx("div",{className:b("message-body",l),children:a.jsx(j,{})}):a.jsxs("div",{className:b("message-body",l),children:[p>0&&a.jsx("div",{children:m?.(p)}),c?a.jsx("div",{className:"message-body-frame",children:f?a.jsx("div",{className:"w-full max-w-full",children:a.jsx(C,{html:c,variant:"framed",isDark:s,declares:h})}):a.jsx("div",{className:"max-w-full lg:max-w-2xl",children:a.jsx(C,{html:c,variant:u?"plain":"framed",isDark:s,declares:h})})}):t?a.jsx("pre",{className:"email-text whitespace-pre-wrap text-sm leading-relaxed",children:t}):a.jsx(j,{})]})};function kt({message:e="Select a thread to read",icon:t,showHints:s=!0,className:r}){return a.jsxs("div",{className:b("flex flex-1 flex-col items-center justify-center text-center",r),children:[t??a.jsx(Q,{className:"size-10 text-fg-subtle"}),a.jsx("p",{className:"mt-3 text-sm text-fg-muted",children:e}),s&&a.jsxs("p",{className:"text-2xs text-fg-subtle",children:[a.jsx(k,{children:"j"})," / ",a.jsx(k,{children:"k"})," to move, ",a.jsx(k,{children:"Enter"})," to open"]})]})}function M(e){const t=[];let s=-1,r=!1;for(let n=0;n<e.length;n++){const o=e[n];if(o==='"'){r=!r,s<0&&(s=n);continue}if(!r&&/\s/.test(o)){s>=0&&t.push({raw:e.slice(s,n),start:s,end:n}),s=-1;continue}s<0&&(s=n)}return s>=0&&t.push({raw:e.slice(s),start:s,end:e.length}),t}const Qe=e=>{if(!e.startsWith('"'))return e;const t=e.slice(1);return t.endsWith('"')?t.slice(0,-1):t};function Ye(e){const t=e.indexOf(":");if(t<=0)return;const s=e.slice(t+1);return{name:e.slice(0,t).toLowerCase(),value:Qe(s),rawValue:s}}const qe=e=>/[\s"]/.test(e),Xe=e=>qe(e)?`"${e.replace(/"/g,"")}"`:e,St=(e,t)=>`${e}:${Xe(t)}`,O=(e,t=Date.now())=>({value:e,setAt:t}),Ze=(e,t,s,r)=>{if(e.addressId!==t)return e;const n={...e.flags??{}};return s?n.trusted=O(!0,r):delete n.trusted,{...e,flags:n}},Je=(e,t,s,r)=>{const n=o=>o.map(l=>Ze(l,t,s,r));return{...e,envelope:{...e.envelope,from:n(e.envelope.from),to:n(e.envelope.to),cc:n(e.envelope.cc),bcc:n(e.envelope.bcc),replyTo:n(e.envelope.replyTo)}}},et=({messageId:e})=>{const t=Y(),{pushError:s}=q(),{mutate:r,isPending:n,error:o,reset:l}=X({...ee(),onMutate:async d=>{const c=d.path.addressId,u=d.body.flags?.trusted?.value===!0,h=J({path:{messageId:e}});await t.cancelQueries({queryKey:h});const p=t.getQueriesData({queryKey:h}).filter(i=>i[1]!==void 0).map(([i,x])=>({queryKey:i,data:x}));return t.setQueriesData({queryKey:h},i=>i&&Je(i,c,u)),{describePrefix:h,previous:p}},onError:(d,c,f)=>{if(f)for(const u of f.previous)t.setQueryData(u.queryKey,u.data);s(Z("Couldn't trust sender","The change wasn't saved.",d))},onSettled:(d,c,f,u)=>{u&&t.invalidateQueries({queryKey:u.describePrefix})}});return{toggleTrusted:(d,c)=>{r({path:{addressId:d},body:{flags:{trusted:O(!c)}}})},isPending:n,error:o,reset:l}},tt=()=>{const[e,t]=g.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark"));return g.useEffect(()=>{const s=document.documentElement,r=new MutationObserver(()=>{t(s.classList.contains("dark"))});return r.observe(s,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),e},st=({blockedImageCount:e,canAlwaysTrust:t,isTrustPending:s,onLoadOnce:r,onAlwaysTrust:n})=>a.jsxs("div",{className:"mb-3 flex items-center justify-between rounded-md bg-surface-sunken/50 px-3 py-2 text-sm",children:[a.jsxs("span",{className:"text-fg-muted",children:[e," image",e>1?"s":""," blocked for privacy"]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{type:"button",onClick:r,className:"text-accent hover:underline",children:"Load once"}),t&&a.jsx("button",{type:"button",onClick:n,"aria-busy":s,className:"text-accent hover:underline aria-busy:opacity-50",children:s?"Trusting…":"Always trust"})]})]}),rt=(e,t)=>{switch(e){case"auth":return{title:"Your session expired",detail:"Sign in again to reload the message body. Other parts of the app may also stop responding until you do."};case"body-missing":return{title:"Message body is missing in storage",detail:"A sync failure may have left this message without its body bytes. Contact support, or run the reconcile script to refetch from the upstream IMAP server."};case"content-type-mismatch":return{title:"Couldn't load message body",detail:"The server returned an unexpected content type for this part. The message body has not been rendered to keep you safe."};case"spa-shell-leak":return{title:"Couldn't load message body",detail:"The server returned the app shell instead of the message body. This is an infrastructure bug — please report it."};case"not-ready":return{title:"Message body is still syncing",detail:"This message's body hasn't finished downloading from the mail server yet. It should appear shortly — reopen the message to try again."};default:return{title:"Couldn't load message body",detail:t}}},nt=e=>e instanceof oe?e.reason:"generic",at=e=>e instanceof Error?e.message:typeof e=="string"?e:"An unexpected error occurred while loading the message body.",ot=({error:e,onRetry:t})=>{const s=nt(e),r=at(e),{title:n,detail:o}=rt(s,r),[l,m]=g.useState(!1),{Account:d}=te();return l?null:a.jsxs("div",{role:"alert","data-testid":"message-body-error-banner","data-reason":s,className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[a.jsx(se,{className:"size-4 shrink-0 text-danger mt-0.5","aria-hidden":"true"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-medium text-danger",children:n}),a.jsx("p",{className:"text-fg-muted mt-1 break-words",children:o})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[s==="auth"&&a.jsx(d,{children:({signOut:c})=>a.jsx("button",{type:"button",onClick:()=>c(),className:"text-sm font-medium text-accent hover:underline",children:"Sign in again"})}),t&&a.jsx("button",{type:"button",onClick:t,className:"text-sm font-medium text-accent hover:underline",children:"Retry"}),a.jsx("button",{type:"button",onClick:()=>m(!0),"aria-label":"Dismiss message body error",className:"rounded-md p-1 text-fg-muted hover:bg-surface-raised hover:text-fg transition-colors",children:a.jsx(re,{className:"size-4","aria-hidden":"true"})})]})]})},it=()=>a.jsxs("div",{className:"animate-pulse space-y-2",role:"status","aria-label":"Loading message body",children:[a.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),a.jsx("div",{className:"h-4 bg-surface-sunken rounded w-11/12"}),a.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"}),a.jsx("div",{className:"h-4 bg-surface-sunken rounded w-5/6"})]}),L=()=>a.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),At=({bodyParts:e,html:t,text:s,isTrusted:r=!1,messageId:n,fromAddressId:o,category:l,className:m})=>{const[d,c]=g.useState(!1),f=r||d,u=tt(),{toggleTrusted:h,isPending:p}=et({messageId:n??""}),i=!!e&&e.length>0,{picked:x,data:y,isLoading:w,isError:$,error:z,refetch:P}=ie({messageId:n,bodyParts:e,enabled:i}),K=g.useMemo(()=>ue(e??[]),[e]),F=i&&y?.kind==="html"?y.body:t,H=i&&y?.kind==="text"?y.body:s;if(i){if(w)return a.jsx("div",{className:b("message-body",m),children:a.jsx(it,{})});if($)return a.jsx("div",{className:b("message-body",m),children:a.jsx(ot,{error:z,onRetry:()=>P()})});if(!x)return a.jsx("div",{className:b("message-body",m),children:a.jsx(L,{})})}else if(!t&&!s)return a.jsx("div",{className:b("message-body",m),children:a.jsx(L,{})});const U=!!(o&&n),G=()=>{!o||p||(c(!0),h(o,!1))};return a.jsx(Ve,{className:m,html:F,text:H,isDark:u,category:l,allowImages:f,resolveCid:K,renderBlockedNotice:W=>a.jsx(st,{blockedImageCount:W,canAlwaysTrust:U,isTrustPending:p,onLoadOnce:()=>c(!0),onAlwaysTrust:G})})},D={personal:"Personal",uncategorized:"Unclassified",transactional:"Transactional",newsletter:"Newsletter",marketing:"Marketing",social:"Social",automated:"Automated"},ct=Object.values(R).map(e=>({value:e,label:D[e]})),lt={unclassified:"uncategorized"},dt=[{name:"from",label:"Sender",values:"contact"},{name:"subject",label:"Subject",values:"text"},{name:"category",label:"Category",values:"fixed",options:ct},{name:"is",label:"State",values:"fixed",options:[{value:"unread",label:"Unread"},{value:"read",label:"Read"},{value:"starred",label:"Starred"}]},{name:"has",label:"Contents",values:"fixed",options:[{value:"attachment",label:"Has attachment"}]},{name:"in",label:"Folder",values:"mailbox"},{name:"account",label:"Account",values:"account"},{name:"after",label:"Sent on or after",values:"date"},{name:"before",label:"Sent before",values:"date"}],ut=new Map(dt.map(e=>[e.name,e])),Et=e=>ut.get(e.toLowerCase()),mt=/^\d{4}-\d{2}-\d{2}$/;function ft(e,t,s){if(!mt.test(s))return;const r=Date.parse(`${s}T00:00:00Z`);if(!Number.isNaN(r))return{type:e,raw:t,value:s,epochSeconds:Math.floor(r/1e3)}}function ht(e){const t=e.toLowerCase(),s=lt[t];return s||Object.values(R).find(n=>n===t)}function gt(e,t){switch(t.toLowerCase()){case"unread":return{type:"isUnread",raw:e};case"read":return{type:"isRead",raw:e};case"starred":case"flagged":return{type:"isStarred",raw:e};default:return}}function pt(e,t){const s=Ye(e);if(!s||s.value.length===0)return;const{name:r,value:n}=s;switch(r){case"from":return{type:"from",raw:e,value:n};case"subject":return{type:"subject",raw:e,value:n};case"category":{const o=ht(n);return o?{type:"category",raw:e,value:n,category:o}:void 0}case"is":return gt(e,n);case"has":return n.toLowerCase()==="attachment"?{type:"hasAttachment",raw:e}:void 0;case"before":case"after":return ft(r,e,n);case"in":{const o=t.mailboxesByName?.get(n.toLowerCase());return o?{type:"in",raw:e,value:n,mailboxId:o}:void 0}case"account":{const o=t.accountsByName?.get(n.toLowerCase());return o?{type:"account",raw:e,value:n,accountId:o}:void 0}default:return}}function Tt(e,t={}){const s=[],r=[];for(const n of M(e)){const o=pt(n.raw,t);o?s.push(o):r.push(n.raw)}return{freeText:r.join(" "),tokens:s}}function Nt(e,t){return M(e).filter(s=>s.raw!==t.raw).map(s=>s.raw).join(" ")}function Ct(e){switch(e.type){case"from":return`From: ${e.value}`;case"subject":return`Subject: ${e.value}`;case"category":return`Category: ${D[e.category]}`;case"hasAttachment":return"Has attachment";case"isUnread":return"Unread";case"isRead":return"Read";case"isStarred":return"Starred";case"before":return`Before ${e.value}`;case"after":return`After ${e.value}`;case"in":return`In: ${e.value}`;case"account":return`Account: ${e.value}`}}function jt(){const{mailboxNameIndex:e,accountNameIndex:t}=ne(),s=ae();return{...ce(s)?{}:{mailboxesByName:e},accountsByName:t}}export{vt as M,kt as R,dt as S,M as a,Ye as b,Ve as c,et as d,At as e,Ct as f,Et as g,Tt as p,Nt as r,St as s,jt as u};
84
+ `},S="invert(0.92) hue-rotate(180deg)",C=`img,picture,video,svg,canvas,[style*='background-image'],[background]{filter:${S}}`,Pe=(e,t,s)=>{const r=e?v.dark.canvas:v.light.canvas;return s?e?t?`html,body{margin:0;background-color:${r};color-scheme:dark light}`:`html{margin:0;background-color:#ffffff;filter:${S}}body{margin:0}${C}`:"html,body{margin:0;background-color:#ffffff;color-scheme:light}":e?t?`html,body{margin:0;background-color:${r};color-scheme:dark light}`:`html{margin:0;background-color:${r}}body{margin:0;filter:${S}}${C}`:`html,body{margin:0;background-color:${r};color-scheme:light}`},Ke=(e,t,s,r=Be)=>{const n=t==="plain"?ze(s):Pe(s,$e.test(e),r.background),o=r.spacing?"":Me();return`${De}<style>${n}</style>${e}<style>${Oe()}${o}</style>`},Fe=5e4,He="allow-same-origin allow-popups allow-popups-to-escape-sandbox",Ue=(e,t,s)=>Math.min(Math.ceil(Math.max(e,t)),s),Ge=new Set(["Enter","Escape","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"]),We=e=>e===" "?!1:e.length===1?!0:Ge.has(e),A=e=>{if(e.metaKey||e.ctrlKey||e.altKey||!We(e.key))return;const t=e.currentTarget??e.target,s=t?.defaultView?.parent;!s||s===t?.defaultView||s.dispatchEvent(new KeyboardEvent("keydown",{key:e.key,code:e.code,shiftKey:e.shiftKey,bubbles:!0,cancelable:!0}))},N=({html:e,variant:t="framed",isDark:s=!1,declares:r,className:n})=>{const o=g.useRef(null),[l,m]=g.useState(0),d=g.useMemo(()=>Ke(e,t,s,r),[e,t,s,r]);return g.useEffect(()=>{const c=o.current;if(!c)return;const f=()=>{const i=c.contentDocument;if(!i?.body)return;const x=i.documentElement,y=Ue(i.body.scrollHeight,x?.scrollHeight??0,Fe);m(w=>w===y?w:y)};let u,h;const p=()=>{f(),u?.disconnect(),u=void 0,h?.removeEventListener("keydown",A),h?.removeEventListener("load",f,!0),h=void 0;const i=c.contentDocument;i?.body&&(u=new ResizeObserver(f),u.observe(i.body),i.documentElement&&u.observe(i.documentElement),i.addEventListener("load",f,!0),i.fonts?.ready.then(f),i.addEventListener("keydown",A),h=i)};return c.addEventListener("load",p),()=>{c.removeEventListener("load",p),h?.removeEventListener("keydown",A),h?.removeEventListener("load",f,!0),u?.disconnect()}},[]),a.jsx("iframe",{ref:o,title:"Email content",sandbox:He,srcDoc:d,className:n,style:{width:"100%",border:"none",display:"block",height:l===0?"1px":`${l}px`,colorScheme:"normal"}})},j=()=>a.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),vt=({className:e,children:t})=>a.jsx("div",{className:b("[&_.message-body-frame]:-mx-2 lg:[&_.message-body-frame]:-mx-4",e),children:t}),Ve=({html:e,text:t,isDark:s=!1,category:r,allowImages:n=!1,resolveCid:o,className:l,renderBlockedNotice:m})=>{const d=g.useMemo(()=>!e||typeof document>"u"?null:Re({allowExternalImages:n,resolveCid:o})(e),[e,n,o]),c=d?.html??null,{framed:f,isPlain:u}=le(r,d?.hasAuthorBackground??!1),h=g.useMemo(()=>({background:d?.hasAuthorBackground??!1,spacing:d?.hasAuthorSpacing??!1}),[d?.hasAuthorBackground,d?.hasAuthorSpacing]),p=g.useMemo(()=>!c||n?0:(c.match(/data-blocked-src/g)||[]).length,[c,n]);return!c&&!t?a.jsx("div",{className:b("message-body",l),children:a.jsx(j,{})}):a.jsxs("div",{className:b("message-body",l),children:[p>0&&a.jsx("div",{children:m?.(p)}),c?a.jsx("div",{className:"message-body-frame",children:f?a.jsx("div",{className:"w-full max-w-full",children:a.jsx(N,{html:c,variant:"framed",isDark:s,declares:h})}):a.jsx("div",{className:"max-w-full lg:max-w-2xl",children:a.jsx(N,{html:c,variant:u?"plain":"framed",isDark:s,declares:h})})}):t?a.jsx("pre",{className:"email-text whitespace-pre-wrap text-sm leading-relaxed",children:t}):a.jsx(j,{})]})};function kt({message:e="Select a thread to read",icon:t,showHints:s=!0,className:r}){return a.jsxs("div",{className:b("flex flex-1 flex-col items-center justify-center text-center",r),children:[t??a.jsx(Q,{className:"size-10 text-fg-subtle"}),a.jsx("p",{className:"mt-3 text-sm text-fg-muted",children:e}),s&&a.jsxs("p",{className:"text-2xs text-fg-subtle",children:[a.jsx(k,{children:"j"})," / ",a.jsx(k,{children:"k"})," to move, ",a.jsx(k,{children:"Enter"})," to open"]})]})}function M(e){const t=[];let s=-1,r=!1;for(let n=0;n<e.length;n++){const o=e[n];if(o==='"'){r=!r,s<0&&(s=n);continue}if(!r&&/\s/.test(o)){s>=0&&t.push({raw:e.slice(s,n),start:s,end:n}),s=-1;continue}s<0&&(s=n)}return s>=0&&t.push({raw:e.slice(s),start:s,end:e.length}),t}const Qe=e=>{if(!e.startsWith('"'))return e;const t=e.slice(1);return t.endsWith('"')?t.slice(0,-1):t};function Ye(e){const t=e.indexOf(":");if(t<=0)return;const s=e.slice(t+1);return{name:e.slice(0,t).toLowerCase(),value:Qe(s),rawValue:s}}const qe=e=>/[\s"]/.test(e),Xe=e=>qe(e)?`"${e.replace(/"/g,"")}"`:e,At=(e,t)=>`${e}:${Xe(t)}`,O=(e,t=Date.now())=>({value:e,setAt:t}),Ze=(e,t,s,r)=>{if(e.addressId!==t)return e;const n={...e.flags??{}};return s?n.trusted=O(!0,r):delete n.trusted,{...e,flags:n}},Je=(e,t,s,r)=>{const n=o=>o.map(l=>Ze(l,t,s,r));return{...e,envelope:{...e.envelope,from:n(e.envelope.from),to:n(e.envelope.to),cc:n(e.envelope.cc),bcc:n(e.envelope.bcc),replyTo:n(e.envelope.replyTo)}}},et=({messageId:e})=>{const t=Y(),{pushError:s}=q(),{mutate:r,isPending:n,error:o,reset:l}=X({...ee(),onMutate:async d=>{const c=d.path.addressId,u=d.body.flags?.trusted?.value===!0,h=J({path:{messageId:e}});await t.cancelQueries({queryKey:h});const p=t.getQueriesData({queryKey:h}).filter(i=>i[1]!==void 0).map(([i,x])=>({queryKey:i,data:x}));return t.setQueriesData({queryKey:h},i=>i&&Je(i,c,u)),{describePrefix:h,previous:p}},onError:(d,c,f)=>{if(f)for(const u of f.previous)t.setQueryData(u.queryKey,u.data);s(Z("Couldn't trust sender","The change wasn't saved.",d))},onSettled:(d,c,f,u)=>{u&&t.invalidateQueries({queryKey:u.describePrefix})}});return{toggleTrusted:(d,c)=>{r({path:{addressId:d},body:{flags:{trusted:O(!c)}}})},isPending:n,error:o,reset:l}},tt=()=>{const[e,t]=g.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark"));return g.useEffect(()=>{const s=document.documentElement,r=new MutationObserver(()=>{t(s.classList.contains("dark"))});return r.observe(s,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),e},st=({blockedImageCount:e,canAlwaysTrust:t,isTrustPending:s,onLoadOnce:r,onAlwaysTrust:n})=>a.jsxs("div",{className:"mb-3 flex items-center justify-between rounded-md bg-surface-sunken/50 px-3 py-2 text-sm",children:[a.jsxs("span",{className:"text-fg-muted",children:[e," image",e>1?"s":""," blocked for privacy"]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{type:"button",onClick:r,className:"text-accent hover:underline",children:"Load once"}),t&&a.jsx("button",{type:"button",onClick:n,"aria-busy":s,className:"text-accent hover:underline aria-busy:opacity-50",children:s?"Trusting…":"Always trust"})]})]}),rt=(e,t)=>{switch(e){case"auth":return{title:"Your session expired",detail:"Sign in again to reload the message body. Other parts of the app may also stop responding until you do."};case"body-missing":return{title:"Message body is missing in storage",detail:"A sync failure may have left this message without its body bytes. Contact support, or run the reconcile script to refetch from the upstream IMAP server."};case"content-type-mismatch":return{title:"Couldn't load message body",detail:"The server returned an unexpected content type for this part. The message body has not been rendered to keep you safe."};case"spa-shell-leak":return{title:"Couldn't load message body",detail:"The server returned the app shell instead of the message body. This is an infrastructure bug — please report it."};case"not-ready":return{title:"Message body is still syncing",detail:"This message's body hasn't finished downloading from the mail server yet. It should appear shortly — reopen the message to try again."};default:return{title:"Couldn't load message body",detail:t}}},nt=e=>e instanceof oe?e.reason:"generic",at=e=>e instanceof Error?e.message:typeof e=="string"?e:"An unexpected error occurred while loading the message body.",ot=({error:e,onRetry:t})=>{const s=nt(e),r=at(e),{title:n,detail:o}=rt(s,r),[l,m]=g.useState(!1),{Account:d}=te();return l?null:a.jsxs("div",{role:"alert","data-testid":"message-body-error-banner","data-reason":s,className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[a.jsx(se,{className:"size-4 shrink-0 text-danger mt-0.5","aria-hidden":"true"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-medium text-danger",children:n}),a.jsx("p",{className:"text-fg-muted mt-1 break-words",children:o})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[s==="auth"&&a.jsx(d,{children:({signOut:c})=>a.jsx("button",{type:"button",onClick:()=>c(),className:"text-sm font-medium text-accent hover:underline",children:"Sign in again"})}),t&&a.jsx("button",{type:"button",onClick:t,className:"text-sm font-medium text-accent hover:underline",children:"Retry"}),a.jsx("button",{type:"button",onClick:()=>m(!0),"aria-label":"Dismiss message body error",className:"rounded-md p-1 text-fg-muted hover:bg-surface-raised hover:text-fg transition-colors",children:a.jsx(re,{className:"size-4","aria-hidden":"true"})})]})]})},it=()=>a.jsxs("div",{className:"animate-pulse space-y-2",role:"status","aria-label":"Loading message body",children:[a.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),a.jsx("div",{className:"h-4 bg-surface-sunken rounded w-11/12"}),a.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"}),a.jsx("div",{className:"h-4 bg-surface-sunken rounded w-5/6"})]}),L=()=>a.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),St=({bodyParts:e,html:t,text:s,isTrusted:r=!1,messageId:n,fromAddressId:o,category:l,className:m})=>{const[d,c]=g.useState(!1),f=r||d,u=tt(),{toggleTrusted:h,isPending:p}=et({messageId:n??""}),i=!!e&&e.length>0,{picked:x,data:y,isLoading:w,isError:D,error:z,refetch:P}=ie({messageId:n,bodyParts:e,enabled:i}),K=g.useMemo(()=>ue(e??[]),[e]),F=i&&y?.kind==="html"?y.body:t,H=i&&y?.kind==="text"?y.body:s;if(i){if(w)return a.jsx("div",{className:b("message-body",m),children:a.jsx(it,{})});if(D)return a.jsx("div",{className:b("message-body",m),children:a.jsx(ot,{error:z,onRetry:()=>P()})});if(!x)return a.jsx("div",{className:b("message-body",m),children:a.jsx(L,{})})}else if(!t&&!s)return a.jsx("div",{className:b("message-body",m),children:a.jsx(L,{})});const U=!!(o&&n),G=()=>{!o||p||(c(!0),h(o,!1))};return a.jsx(Ve,{className:m,html:F,text:H,isDark:u,category:l,allowImages:f,resolveCid:K,renderBlockedNotice:W=>a.jsx(st,{blockedImageCount:W,canAlwaysTrust:U,isTrustPending:p,onLoadOnce:()=>c(!0),onAlwaysTrust:G})})},$={personal:"Personal",uncategorized:"Unclassified",transactional:"Transactional",newsletter:"Newsletter",marketing:"Marketing",social:"Social",automated:"Automated"},ct=Object.values(R).map(e=>({value:e,label:$[e]})),lt={unclassified:"uncategorized"},dt=[{name:"from",label:"Sender",values:"contact"},{name:"subject",label:"Subject",values:"text"},{name:"category",label:"Category",values:"fixed",options:ct},{name:"is",label:"State",values:"fixed",options:[{value:"unread",label:"Unread"},{value:"read",label:"Read"},{value:"starred",label:"Starred"}]},{name:"has",label:"Contents",values:"fixed",options:[{value:"attachment",label:"Has attachment"}]},{name:"in",label:"Folder",values:"mailbox"},{name:"account",label:"Account",values:"account"},{name:"after",label:"Sent on or after",values:"date"},{name:"before",label:"Sent before",values:"date"}],ut=new Map(dt.map(e=>[e.name,e])),Et=e=>ut.get(e.toLowerCase()),mt=/^\d{4}-\d{2}-\d{2}$/;function ft(e,t,s){if(!mt.test(s))return;const r=Date.parse(`${s}T00:00:00Z`);if(!Number.isNaN(r))return{type:e,raw:t,value:s,epochSeconds:Math.floor(r/1e3)}}function ht(e){const t=e.toLowerCase(),s=lt[t];return s||Object.values(R).find(n=>n===t)}function gt(e,t){switch(t.toLowerCase()){case"unread":return{type:"isUnread",raw:e};case"read":return{type:"isRead",raw:e};case"starred":case"flagged":return{type:"isStarred",raw:e};default:return}}function pt(e,t){const s=Ye(e);if(!s||s.value.length===0)return;const{name:r,value:n}=s;switch(r){case"from":return{type:"from",raw:e,value:n};case"subject":return{type:"subject",raw:e,value:n};case"category":{const o=ht(n);return o?{type:"category",raw:e,value:n,category:o}:void 0}case"is":return gt(e,n);case"has":return n.toLowerCase()==="attachment"?{type:"hasAttachment",raw:e}:void 0;case"before":case"after":return ft(r,e,n);case"in":{const o=t.mailboxesByName?.get(n.toLowerCase());return o?{type:"in",raw:e,value:n,mailboxId:o}:void 0}case"account":{const o=t.accountsByName?.get(n.toLowerCase());return o?{type:"account",raw:e,value:n,accountId:o}:void 0}default:return}}function Tt(e,t={}){const s=[],r=[];for(const n of M(e)){const o=pt(n.raw,t);o?s.push(o):r.push(n.raw)}return{freeText:r.join(" "),tokens:s}}function Ct(e,t){return M(e).filter(s=>s.raw!==t.raw).map(s=>s.raw).join(" ")}function Nt(e){switch(e.type){case"from":return`From: ${e.value}`;case"subject":return`Subject: ${e.value}`;case"category":return`Category: ${$[e.category]}`;case"hasAttachment":return"Has attachment";case"isUnread":return"Unread";case"isRead":return"Read";case"isStarred":return"Starred";case"before":return`Before ${e.value}`;case"after":return`After ${e.value}`;case"in":return`In: ${e.value}`;case"account":return`Account: ${e.value}`}}function jt(){const{mailboxNameIndex:e,accountNameIndex:t}=ne(),s=ae();return{...ce(s)?{}:{mailboxesByName:e},accountsByName:t}}export{vt as M,kt as R,dt as S,Ve as a,et as b,St as c,Et as d,M as e,Ye as f,At as g,Tt as p,Ct as r,Nt as s,jt as u};
@@ -0,0 +1 @@
1
+ import{h as T,as as I,i as C,cq as k,dI as A,r as v,j as p,dJ as h,dK as E,dL as j,C as w,c4 as D,c as z,dh as Q,cJ as R}from"./index-lxVTsHBH.js";import{P as O}from"./attachment-file-DClGI76U.js";import{ag as P,ah as _}from"./MailListHeader-Dv4RRNrm.js";import{i as q,t as N}from"./search-token-index-D1mRODfF.js";import{a as B}from"./useLabels-Dlob_XK-.js";import{n as U}from"./search-query-Cr_ZXBCp.js";import{b as F}from"./search-scope-B5-OK3Cq.js";import{u as G,p as H}from"./useSearchTokenContext-mRvSGuNd.js";const ne=e=>{const t=new Set;for(const a of e)a&&t.add(a);return t.size>1?{accountId:void 0,restriction:"spansAccounts",moveDisabledHint:"Move only works within one account — clear selection or pick messages from a single account"}:{accountId:t.size===1?[...t][0]:void 0,restriction:void 0,moveDisabledHint:void 0}},J=e=>{const{mailboxId:t,messages:a}=e,c=T(),{pushError:l}=I(),{mutateAsync:i,isPending:o}=C({...A(),onError:(n,d)=>{l({title:d.body.action==="Remove"?"Couldn't remove label":"Couldn't apply label",detail:k(n),error:n})},onSettled:(n,d,u)=>{q(c,N(P(u.body.messageIds??[],a??[],t)))}});return{applyLabel:v.useCallback((n,d,u)=>{n.length!==0&&_(n,m=>i({body:{messageIds:m,labelId:d,action:u}}))},[i]),isPending:o}};function re({accountId:e,mailboxId:t,messageIds:a}){const{labels:c}=B(e),{applyLabel:l}=J({mailboxId:t}),i=v.useMemo(()=>c.map(o=>({key:o.labelId,label:o.name,icon:p.jsx("span",{className:`size-2.5 rounded-full ${E(o.color)?h[o.color]:h.Default}`}),onSelect:()=>l(a,o.labelId,"Apply")})),[c,a,l]);return i.length===0?null:p.jsx(O,{triggerLabel:"Apply label to selected messages",triggerIcon:p.jsx(j,{className:"size-4 text-fg-subtle"}),triggerText:"Apply label",items:i,align:"start",nested:!0,touch:!1,triggerClassName:"min-h-11 w-full justify-start gap-3 px-4 py-2.5 text-sm font-normal text-fg"})}const K=20,V=new Set(Object.values(R)),$=e=>e!==void 0&&V.has(e)?e:void 0,W=e=>{if(e.some(t=>t.type==="isUnread"))return!1;if(e.some(t=>t.type==="isRead"))return!0};function ie({mailboxId:e,filterCategory:t}={}){const{searchQuery:a}=w(),c=G(),l=D(),i=U(a),{freeText:o,tokens:r}=H(i,c),n=o.length>0,d=r.find(s=>s.type==="category"),u=$(t)??d?.category,m=r.some(s=>s.type==="hasAttachment")?!0:void 0,f=r.some(s=>s.type==="isStarred")?!0:void 0,y=W(r),b=r.find(s=>s.type==="after"),g=r.find(s=>s.type==="before"),S=r.find(s=>s.type==="in"),x=F({browsed:l,callerMailboxId:e,inTokenMailboxId:S?.mailboxId}),{data:L,isLoading:M}=z({...Q({query:{query:o,mailboxId:x,limit:K,...u!==void 0?{category:u}:{},...m!==void 0?{hasAttachment:m}:{},...f!==void 0?{hasStars:f}:{},...y!==void 0?{isRead:y}:{},...b?{sentDateFrom:b.epochSeconds}:{},...g?{sentDateTo:g.epochSeconds}:{}}}),enabled:n,staleTime:6e4});return{hits:L?.items??[],isLoading:n&&M}}export{re as L,ne as r,ie as u};
@@ -1 +1 @@
1
- import{u as g,ar as f,d as p,e as m,r,f as y,at as T,k as E,h as d}from"./index-FpwHnbdV.js";const i={html:"",plainText:""},x=e=>{const u=g(),{pushError:o}=f(),{data:n}=p({...m(),staleTime:1/0}),l=r.useMemo(()=>{if(!e||!n)return i;const t=n.accounts.find(a=>a.accountId===e);return t?{html:t.signatureHtml??"",plainText:t.signaturePlainText??""}:i},[e,n]),s=y({...d(),onSuccess:()=>{u.invalidateQueries({queryKey:E()})},onError:t=>{o(T("Couldn't save signature","The signature wasn't saved.",t))}}),c=r.useCallback((t,a)=>{e&&s.mutate({path:{accountId:e},body:{signatureHtml:t,signaturePlainText:a}})},[e,s]);return{signature:l,setSignature:c,isSaving:s.isPending}};export{x as u};
1
+ import{h as g,as as p,c as f,d as m,r,i as y,au as T,o as E,l as d}from"./index-lxVTsHBH.js";const i={html:"",plainText:""},x=e=>{const u=g(),{pushError:o}=p(),{data:n}=f({...m(),staleTime:1/0}),l=r.useMemo(()=>{if(!e||!n)return i;const t=n.accounts.find(a=>a.accountId===e);return t?{html:t.signatureHtml??"",plainText:t.signaturePlainText??""}:i},[e,n]),s=y({...d(),onSuccess:()=>{u.invalidateQueries({queryKey:E()})},onError:t=>{o(T("Couldn't save signature","The signature wasn't saved.",t))}}),c=r.useCallback((t,a)=>{e&&s.mutate({path:{accountId:e},body:{signatureHtml:t,signaturePlainText:a}})},[e,s]);return{signature:l,setSignature:c,isSaving:s.isPending}};export{x as u};
package/index.html CHANGED
@@ -38,7 +38,7 @@
38
38
  } catch (_) {}
39
39
  })();
40
40
  </script>
41
- <script type="module" crossorigin src="/assets/index-FpwHnbdV.js"></script>
41
+ <script type="module" crossorigin src="/assets/index-lxVTsHBH.js"></script>
42
42
  <link rel="stylesheet" crossorigin href="/assets/index-DYO-sbPN.css">
43
43
  </head>
44
44
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/web-client-dist",
3
- "version": "0.0.482",
3
+ "version": "0.0.483",
4
4
  "description": "Built Remit web client — static assets and the default runtime config.",
5
5
  "files": [
6
6
  "**/*"