@remit/web-client-dist 0.0.415 → 0.0.416

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 (110) hide show
  1. package/assets/{BriefPane-D0RwCBB5.js → BriefPane-DSXt2QHX.js} +1 -1
  2. package/assets/{ErrorState-Bvky1o-F.js → ErrorState-B-pmt8tr.js} +1 -1
  3. package/assets/{FlaggedPane-DynEVxDw.js → FlaggedPane-DShtZRWu.js} +1 -1
  4. package/assets/{FullCompose-Bz4tU4eC.js → FullCompose-C-FIaleL.js} +1 -1
  5. package/assets/{MailListHeader-BxHE7aSw.js → MailListHeader-CCZ5QHsx.js} +1 -1
  6. package/assets/{MailViewChrome-DUH-TtBr.js → MailViewChrome-CAl6yjWH.js} +1 -1
  7. package/assets/{MailboxPane-D5wUUDzK.js → MailboxPane-GWhGjr4s.js} +1 -1
  8. package/assets/{NavMenuButton-DKAOg_uR.js → NavMenuButton-CEqFdt1K.js} +1 -1
  9. package/assets/{OnboardingWizard-DN9-XMBp.js → OnboardingWizard-B85YUGUu.js} +1 -1
  10. package/assets/{OutboxPane-BMtpzsUR.js → OutboxPane-Bo7Lq4V0.js} +1 -1
  11. package/assets/_mailboxId-CnwhppOP.js +1 -0
  12. package/assets/_messageId-5uoaY_gC.js +1 -0
  13. package/assets/_messageId-Bnvo8XB_.js +1 -0
  14. package/assets/_messageId-DHbqtOOD.js +1 -0
  15. package/assets/_outboxMessageId-DVQCFFBZ.js +1 -0
  16. package/assets/_threadId-Bli5qa_3.js +1 -0
  17. package/assets/_threadId-CND4Y2pe.js +1 -0
  18. package/assets/_threadId-cmh38Ofn.js +1 -0
  19. package/assets/{accounts-DX0sG4C_.js → accounts-DR3mXcQ9.js} +1 -1
  20. package/assets/{advanced-CdPghCwO.js → advanced-DAt4w2XT.js} +1 -1
  21. package/assets/{appearance-CL_xj507.js → appearance-DwkoBct7.js} +1 -1
  22. package/assets/{attachment-file-BQwmdAG2.js → attachment-file-DENdjOom.js} +1 -1
  23. package/assets/{avatar-ClGNsPIt.js → avatar-D9LII8Ln.js} +1 -1
  24. package/assets/{bottom-sheet-D_43RR7G.js → bottom-sheet-BH88Otuk.js} +1 -1
  25. package/assets/brief-0xPp2nlC.js +1 -0
  26. package/assets/{brief-Cy5P8jdk.js → brief-DAqFNnao.js} +1 -1
  27. package/assets/{browser-ponyfill-DvrWWkzn.js → browser-ponyfill-CC7khbtk.js} +1 -1
  28. package/assets/{bug-BSRv2K0g.js → bug-Dr0UUpJV.js} +1 -1
  29. package/assets/{circle-check-Cqvf9vm5.js → circle-check-Dn5_xOpA.js} +1 -1
  30. package/assets/{circle-check-big-BGfduKwp.js → circle-check-big-CNvQYcLR.js} +1 -1
  31. package/assets/{circle-help-Dg64QtZk.js → circle-help-DtosCxuB.js} +1 -1
  32. package/assets/{clock-CAYoClMV.js → clock-acRpctBX.js} +1 -1
  33. package/assets/compose._-_outboxMessageId_-BHzk7P4q.js +1 -0
  34. package/assets/compose._-_outboxMessageId_-CZ2ETe9Z.js +1 -0
  35. package/assets/compose._-_outboxMessageId_-Coq3EbyN.js +1 -0
  36. package/assets/compose._-_outboxMessageId_-Dwr3de1J.js +1 -0
  37. package/assets/{confirm-dialog-BlJPdK7i.js → confirm-dialog-BZYLusH1.js} +1 -1
  38. package/assets/{download-CdRNsaoH.js → download-CxMx2zdk.js} +1 -1
  39. package/assets/{filters-BR3rRPSa.js → filters-AJt2ygfK.js} +1 -1
  40. package/assets/flagged-BitLT8dn.js +1 -0
  41. package/assets/{flagged-CcuOBZdb.js → flagged-Bxo04A3W.js} +1 -1
  42. package/assets/folders-B2_U3pk2.js +1 -0
  43. package/assets/{help-copy-CCIwI_Ct.js → help-copy-BUpPDWgL.js} +1 -1
  44. package/assets/index-B4rtynXm.js +1 -0
  45. package/assets/{index-DLWkyqF-.js → index-B6Fz4X0i.js} +3 -3
  46. package/assets/index-BV6lmCgF.js +1 -0
  47. package/assets/index-Bnvo8XB_.js +1 -0
  48. package/assets/index-CR5HwpQk.js +1 -0
  49. package/assets/index-CSO8qmvz.js +1 -0
  50. package/assets/{index-Qtf-W_hi.js → index-CUDGbjSt.js} +4 -4
  51. package/assets/index-CaxyPTaf.js +1 -0
  52. package/assets/index-DHbqtOOD.js +1 -0
  53. package/assets/index-DqlZ09dc.js +1 -0
  54. package/assets/{kbd-CAjGmX5H.js → kbd-BqP2t_lb.js} +1 -1
  55. package/assets/{labels-Fd7hfSRC.js → labels-BLz2uM0_.js} +1 -1
  56. package/assets/{mail-n_ZygVTy.js → mail-9u6lVCNj.js} +1 -1
  57. package/assets/{mail-BbRDcfUS.js → mail-C-vmuTuB.js} +1 -1
  58. package/assets/{menu-CasRKef-.js → menu-zoD3J9Wr.js} +1 -1
  59. package/assets/{onboarding-Uo6gxr-U.js → onboarding-jv3YETtW.js} +1 -1
  60. package/assets/outbox-CCWhudkJ.js +1 -0
  61. package/assets/{pencil-CorrrihA.js → pencil-o1Rn-TLk.js} +1 -1
  62. package/assets/{rich-text-DltXKh-H.js → rich-text-C0KYQjJG.js} +1 -1
  63. package/assets/{rich-text-spellcheck-worker-provider-B1n5ttte.js → rich-text-spellcheck-worker-provider-DMI13IjV.js} +1 -1
  64. package/assets/{rotate-ccw-BP_KbaMk.js → rotate-ccw-BYVqv5Mw.js} +1 -1
  65. package/assets/{row-actions-B8oHfRh8.js → row-actions--_AIhWR_.js} +1 -1
  66. package/assets/{search-scope-D2ZxHCyb.js → search-scope-CdVMxnJQ.js} +1 -1
  67. package/assets/{search-token-index-DRHO8ndK.js → search-token-index-BdWyU2pZ.js} +1 -1
  68. package/assets/{search-view-CjaJttP5.js → search-view-B61gi3Tp.js} +1 -1
  69. package/assets/{senders-D6s9YKrp.js → senders-DUP4hB-5.js} +1 -1
  70. package/assets/settings-CxqTYh7B.js +1 -0
  71. package/assets/{settings-screen-DbM1oFyY.js → settings-screen-Cf-plmEr.js} +1 -1
  72. package/assets/{shield-check-DvBKjktt.js → shield-check-CSPq5rhh.js} +1 -1
  73. package/assets/{suggested-vips-D6Zs2vgu.js → suggested-vips-Ba9jVraP.js} +1 -1
  74. package/assets/{useDebouncedValue-BJSGPhpK.js → useDebouncedValue-CgbEHRND.js} +1 -1
  75. package/assets/{useFilters-Cbyy9Dzu.js → useFilters-C2y22aXO.js} +1 -1
  76. package/assets/{useLabels-BMX2o9C1.js → useLabels-ubt8he3q.js} +1 -1
  77. package/assets/{useMediaQuery-D0Zpb5Mx.js → useMediaQuery-XxWbPYsI.js} +1 -1
  78. package/assets/{useMessageBodyContent-De_0trDD.js → useMessageBodyContent-AsE119jK.js} +1 -1
  79. package/assets/{useRefreshControl-DM5b9wpy.js → useRefreshControl-CuM3uP9o.js} +1 -1
  80. package/assets/{useSearchMirror-D2NKHFvY.js → useSearchMirror-bWKQN2Dl.js} +1 -1
  81. package/assets/{useSearchTokenContext-B_Qphnhr.js → useSearchTokenContext-5QVIZLT9.js} +1 -1
  82. package/assets/{useSemanticSearch-DT-aQ4PL.js → useSemanticSearch-DQHE54Kh.js} +1 -1
  83. package/assets/{useSignature-DNtMe-P5.js → useSignature-J18jTbi3.js} +1 -1
  84. package/index.html +1 -1
  85. package/package.json +1 -1
  86. package/assets/_mailboxId-CtZVPch3.js +0 -1
  87. package/assets/_messageId-BCbS5w4b.js +0 -1
  88. package/assets/_messageId-BE_jgev4.js +0 -1
  89. package/assets/_messageId-BjaY8inA.js +0 -1
  90. package/assets/_outboxMessageId-Dh5eYnH4.js +0 -1
  91. package/assets/_threadId--4XAXR5P.js +0 -1
  92. package/assets/_threadId-CMlCij5U.js +0 -1
  93. package/assets/_threadId-FPEcoT0S.js +0 -1
  94. package/assets/brief-Bnjwe_2r.js +0 -1
  95. package/assets/compose._-_outboxMessageId_-B8kwZkUa.js +0 -1
  96. package/assets/compose._-_outboxMessageId_-CK7hZk31.js +0 -1
  97. package/assets/compose._-_outboxMessageId_-COJKJVLa.js +0 -1
  98. package/assets/compose._-_outboxMessageId_-DQmDddAN.js +0 -1
  99. package/assets/flagged-BgPZ1ncp.js +0 -1
  100. package/assets/folders-C35o4NuX.js +0 -1
  101. package/assets/index-1AziNxJ0.js +0 -1
  102. package/assets/index-5nfeeWBe.js +0 -1
  103. package/assets/index-BE_jgev4.js +0 -1
  104. package/assets/index-BjaY8inA.js +0 -1
  105. package/assets/index-DW38CIRt.js +0 -1
  106. package/assets/index-DtxIyzzB.js +0 -1
  107. package/assets/index-Dy5DLszh.js +0 -1
  108. package/assets/index-olw3drbw.js +0 -1
  109. package/assets/outbox-aaTaVlaV.js +0 -1
  110. package/assets/settings-DEBSeCuq.js +0 -1
@@ -1 +1 @@
1
- import{c}from"./index-Qtf-W_hi.js";const r=c("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);export{r as C};
1
+ import{c}from"./index-CUDGbjSt.js";const r=c("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);export{r as C};
@@ -1 +1 @@
1
- import{c}from"./index-Qtf-W_hi.js";const t=c("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);export{t as C};
1
+ import{c}from"./index-CUDGbjSt.js";const t=c("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);export{t as C};
@@ -1 +1 @@
1
- import{c}from"./index-Qtf-W_hi.js";const p=c("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);export{p as C};
1
+ import{c}from"./index-CUDGbjSt.js";const p=c("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);export{p as C};
@@ -1 +1 @@
1
- import{c}from"./index-Qtf-W_hi.js";const o=c("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);export{o as C};
1
+ import{c}from"./index-CUDGbjSt.js";const o=c("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);export{o as C};
@@ -0,0 +1 @@
1
+ import{F as o}from"./FullCompose-C-FIaleL.js";import"./index-CUDGbjSt.js";import"./ErrorState-B-pmt8tr.js";import"./index-B6Fz4X0i.js";import"./useMessageBodyContent-AsE119jK.js";import"./useMediaQuery-XxWbPYsI.js";import"./useSignature-J18jTbi3.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CgbEHRND.js";import"./confirm-dialog-BZYLusH1.js";const c=o;export{c as component};
@@ -0,0 +1 @@
1
+ import{F as o}from"./FullCompose-C-FIaleL.js";import"./index-CUDGbjSt.js";import"./ErrorState-B-pmt8tr.js";import"./index-B6Fz4X0i.js";import"./useMessageBodyContent-AsE119jK.js";import"./useMediaQuery-XxWbPYsI.js";import"./useSignature-J18jTbi3.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CgbEHRND.js";import"./confirm-dialog-BZYLusH1.js";const c=o;export{c as component};
@@ -0,0 +1 @@
1
+ import{F as o}from"./FullCompose-C-FIaleL.js";import"./index-CUDGbjSt.js";import"./ErrorState-B-pmt8tr.js";import"./index-B6Fz4X0i.js";import"./useMessageBodyContent-AsE119jK.js";import"./useMediaQuery-XxWbPYsI.js";import"./useSignature-J18jTbi3.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CgbEHRND.js";import"./confirm-dialog-BZYLusH1.js";const c=o;export{c as component};
@@ -0,0 +1 @@
1
+ import{F as o}from"./FullCompose-C-FIaleL.js";import"./index-CUDGbjSt.js";import"./ErrorState-B-pmt8tr.js";import"./index-B6Fz4X0i.js";import"./useMessageBodyContent-AsE119jK.js";import"./useMediaQuery-XxWbPYsI.js";import"./useSignature-J18jTbi3.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CgbEHRND.js";import"./confirm-dialog-BZYLusH1.js";const c=o;export{c as component};
@@ -1 +1 @@
1
- import{r as n,j as e,D as b,b as o}from"./index-Qtf-W_hi.js";const h=({isOpen:s,title:i,description:l,confirmLabel:d,cancelLabel:m="Cancel",destructive:u=!1,isBusy:f=!1,onConfirm:x,onCancel:r})=>{const c=n.useRef(null),a=n.useCallback(t=>{t.key==="Escape"&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),r())},[r]);return n.useEffect(()=>{if(s)return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[s,a]),n.useEffect(()=>{if(!s)return;const t=document.activeElement instanceof HTMLElement?document.activeElement:null;return c.current?.focus(),()=>{t?.isConnected&&t.focus()}},[s]),s?e.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center",children:[e.jsx(b,{label:"Dismiss confirmation",onDismiss:r,className:"backdrop-blur-sm"}),e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":i,className:o("relative z-10 w-full max-w-sm","bg-surface border border-line rounded-sm shadow-lg","p-6"),children:[e.jsx("h2",{className:"text-lg font-semibold",children:i}),l&&e.jsx("p",{className:"mt-2 text-sm text-fg-muted",children:l}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-2",children:[e.jsx("button",{ref:c,type:"button",onClick:r,className:o("min-h-11 inline-flex items-center justify-center px-4 rounded text-sm font-medium transition-colors","border border-line hover:bg-surface-raised"),children:m}),e.jsx("button",{type:"button",onClick:x,disabled:f,className:o("min-h-11 inline-flex items-center justify-center px-4 rounded text-sm font-medium transition-colors",u?"bg-danger text-canvas hover:bg-danger/90":"bg-accent text-accent-fg hover:bg-accent-hover","disabled:opacity-50 disabled:cursor-not-allowed"),children:d})]})]})]}):null};export{h as C};
1
+ import{r as n,j as e,D as b,b as o}from"./index-CUDGbjSt.js";const h=({isOpen:s,title:i,description:l,confirmLabel:d,cancelLabel:m="Cancel",destructive:u=!1,isBusy:f=!1,onConfirm:x,onCancel:r})=>{const c=n.useRef(null),a=n.useCallback(t=>{t.key==="Escape"&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),r())},[r]);return n.useEffect(()=>{if(s)return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[s,a]),n.useEffect(()=>{if(!s)return;const t=document.activeElement instanceof HTMLElement?document.activeElement:null;return c.current?.focus(),()=>{t?.isConnected&&t.focus()}},[s]),s?e.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center",children:[e.jsx(b,{label:"Dismiss confirmation",onDismiss:r,className:"backdrop-blur-sm"}),e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":i,className:o("relative z-10 w-full max-w-sm","bg-surface border border-line rounded-sm shadow-lg","p-6"),children:[e.jsx("h2",{className:"text-lg font-semibold",children:i}),l&&e.jsx("p",{className:"mt-2 text-sm text-fg-muted",children:l}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-2",children:[e.jsx("button",{ref:c,type:"button",onClick:r,className:o("min-h-11 inline-flex items-center justify-center px-4 rounded text-sm font-medium transition-colors","border border-line hover:bg-surface-raised"),children:m}),e.jsx("button",{type:"button",onClick:x,disabled:f,className:o("min-h-11 inline-flex items-center justify-center px-4 rounded text-sm font-medium transition-colors",u?"bg-danger text-canvas hover:bg-danger/90":"bg-accent text-accent-fg hover:bg-accent-hover","disabled:opacity-50 disabled:cursor-not-allowed"),children:d})]})]})]}):null};export{h as C};
@@ -1 +1 @@
1
- import{c as o}from"./index-Qtf-W_hi.js";const a=o("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);export{a as D};
1
+ import{c as o}from"./index-CUDGbjSt.js";const a=o("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);export{a as D};
@@ -1 +1 @@
1
- import{n as Y,a7 as Z,aO as ee,aP as te,r as x,aQ as ae,j as t,aR as se,aS as ie,af as R,B as N,an as ne,at as re,aT as oe,aU as le,T as ce,s as P,q as de,aV as me,v as ue,x as pe,aW as xe,aX as fe,m as he,Q as ge,ar as ve,av as be}from"./index-Qtf-W_hi.js";import{S as ye}from"./settings-screen-DbM1oFyY.js";import{B as je}from"./bottom-sheet-D_43RR7G.js";import{u as Ne}from"./useMediaQuery-D0Zpb5Mx.js";import{u as Ce,a as Se}from"./useLabels-BMX2o9C1.js";import{b as Fe,N as S,p as Me,u as Ie,r as Oe,a as we,S as L,c as Ee,n as De,f as Ae,d as Le,e as Te,g as ke}from"./useFilters-Cbyy9Dzu.js";import{C as A}from"./circle-check-Cqvf9vm5.js";import{E as $}from"./ErrorState-Bvky1o-F.js";import"./avatar-ClGNsPIt.js";import"./menu-CasRKef-.js";import"./circle-help-Dg64QtZk.js";const Re=(e,a)=>{const r=Y(),i=Z({...te(),onSuccess:()=>{e&&(r.invalidateQueries({queryKey:Fe(e)}),a&&r.invalidateQueries({queryKey:ee({path:{accountId:e,filterId:a}})}))}}),{mutate:c}=i;return{updateFilter:x.useCallback(d=>{!e||!a||c({path:{accountId:e,filterId:a},body:d})},[e,a,c]),isPending:i.isPending,isSuccess:i.isSuccess,isError:i.isError,error:i.error,reset:i.reset}},Pe=(e,a=!1)=>({clauses:e.literalClauses.map((i,c)=>({id:`clause-${c}`,field:i.field,value:i.value})),matchOperator:e.matchOperator==="And"?"all":"any",widen:e.hasAnchor?{anchorCount:1,...a?{inactive:!0}:{}}:void 0,moveMailboxId:e.actionMailboxId!==S?e.actionMailboxId:void 0,labelId:e.actionLabelId!==S?e.actionLabelId:void 0,scope:e.scope==="Temporary"?"until":"standing",until:e.scope==="Temporary"?$e(e.expiresAt):void 0,name:e.name}),$e=e=>{if(!e)return"";const a=Date.parse(e);if(Number.isNaN(a))return"";const r=new Date(a),i=c=>String(c).padStart(2,"0");return`${r.getFullYear()}-${i(r.getMonth()+1)}-${i(r.getDate())}`},T=e=>JSON.stringify({clauses:e.clauses.map(a=>[a.field,a.value]),operator:e.matchOperator,move:e.moveMailboxId??null,label:e.labelId??null,widen:e.widen?e.widen.inactive?"inactive":"active":"none"}),z=(e,a)=>T(e)!==T(a),k=e=>JSON.stringify({scope:e.scope==="until"?"until":"standing",until:e.scope==="until"?e.until??"":""}),U=(e,a)=>k(e)!==k(a),ze=(e,a)=>{const r={},i=(e.name??"").trim();return i!==(a.name??"").trim()&&(r.name=i),z(e,a)&&(r.matchOperator=e.matchOperator==="all"?"And":"Or",r.literalClauses=e.clauses.map(c=>({field:c.field,value:c.value})),r.actionMailboxId=e.moveMailboxId??S,r.actionLabelId=e.labelId??S),U(e,a)&&(r.scope=e.scope==="until"?"Temporary":"Standing",e.scope==="until"&&(r.expiresAt=Me(e.until??""))),r};function Ue({accountId:e,filter:a,folders:r,delimiter:i,labels:c,semanticUnavailable:g=!1,onClose:d}){const f=x.useMemo(()=>Pe(a,g),[a,g]),[n,l]=x.useState(f),[m,u]=x.useState(),[h,b]=x.useState(!1),M=x.useRef(0),{count:C}=Ie(e,Oe(n)),j=Re(e,a.filterId),v=we(e),{createFolderIn:F}=ae(e),{createLabel:w}=Ce(e),I=async o=>{const s=await w(o);return{id:s.labelId,name:s.name,color:s.color}},p=()=>u({mode:"add",draft:{field:L[0],value:""}}),O=o=>{const s=n.clauses.find(y=>y.id===o);s&&u({mode:"edit",clauseId:o,draft:{field:s.field,value:s.value}})},E=o=>u(s=>s&&{...s,draft:{...s.draft,field:o}}),_=o=>u(s=>s&&{...s,draft:{...s.draft,value:o}}),B=()=>{if(!m)return;const o=m.draft.field,s=De(o,m.draft.value);s!==""&&(l(y=>m.mode==="edit"&&m.clauseId?{...y,clauses:y.clauses.map(D=>D.id===m.clauseId?{id:D.id,field:o,value:s}:D)}:(M.current+=1,{...y,clauses:[...y.clauses,{id:`new-${M.current}`,field:o,value:s}]})),u(void 0))},Q=o=>l(s=>({...s,clauses:s.clauses.filter(y=>y.id!==o)})),K=o=>l(s=>({...s,matchOperator:o})),V=o=>l(s=>({...s,moveMailboxId:o||void 0})),q=o=>l(s=>({...s,labelId:o||void 0})),G=o=>l(s=>({...s,name:o})),H=o=>l(s=>({...s,scope:o,until:o==="until"?s.until:void 0})),J=o=>l(s=>({...s,until:o})),W=()=>{const o=z(n,f)||U(n,f),s=ze(n,f);if(Object.keys(s).length===0){d();return}b(o),j.updateFilter(s)},X=()=>v.start(Ee(n));return v.isStarting||v.isRunning||v.isDone?t.jsx(Ke,{progress:v.progress,isDone:v.isDone,onClose:d}):j.isPending?t.jsx(_e,{}):j.isError?t.jsx(Ve,{onRetry:j.reset,onClose:d}):j.isSuccess?h?t.jsx(Qe,{preview:se(C),blocked:C.status!=="ready"||C.stale===!0,onReapply:X,onClose:d}):t.jsx(Be,{onClose:d}):t.jsx(ie,{rule:n,folders:r,delimiter:i,labels:c,preview:C,semanticAvailable:!1,clauseFields:L,anchorLocked:!0,clauseEdit:m,onStartAddClause:p,onStartEditClause:O,onRemoveClause:Q,onChangeDraftField:E,onChangeDraftValue:_,onSubmitClause:B,onCancelClause:()=>u(void 0),onChangeMatchOperator:K,onChangeMove:V,onCreateFolder:F,onChangeLabel:q,onCreateLabel:I,onChangeName:G,onChangeScope:H,onChangeUntil:J,onCommit:W,onCancel:d})}function _e(){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[t.jsx(R,{className:"size-8 animate-spin text-accent-2"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Saving changes…"})]})}function Be({onClose:e}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx(A,{className:"size-8 text-positive"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Filter updated"}),t.jsx(N,{variant:"primary",onClick:e,className:"mt-2",children:"Done"})]})}function Qe({preview:e,blocked:a,onReapply:r,onClose:i}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx(A,{className:"size-8 text-positive"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Rule saved"}),t.jsxs("p",{className:"max-w-xs text-xs text-fg-muted",children:["New mail follows the rule automatically. ",e," — move the mail already in your mailbox too?"]}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsx(N,{variant:"primary",onClick:r,disabled:a,children:"Move existing mail"}),t.jsx(N,{variant:"ghost",onClick:i,children:"Not now"})]})]})}function Ke({progress:e,isDone:a,onClose:r}){const i=e.state==="Failed";return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[a?i?t.jsx("span",{className:"text-sm font-semibold text-danger",children:"Move failed"}):t.jsx(A,{className:"size-8 text-positive"}):t.jsx(R,{className:"size-8 animate-spin text-accent-2"}),!a&&t.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving existing mail…"}),a&&!i&&t.jsxs("div",{className:"text-sm text-fg",children:[t.jsx("p",{className:"font-medium",children:"Done"}),t.jsxs("p",{className:"mt-1 text-xs text-fg-muted",children:[e.appliedCount," of ",e.matchedCount," moved",e.failedCount>0?` · ${e.failedCount} failed`:"","."]})]}),a&&i&&t.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:e.errorMessage||"Something went wrong. Please try again."}),a&&t.jsx(N,{variant:"primary",onClick:r,className:"mt-2",children:"Done"})]})}function Ve({onRetry:e,onClose:a}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx("p",{className:"text-sm font-medium text-danger",children:"Couldn't save changes"}),t.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:"Please try again."}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsx(N,{variant:"primary",onClick:e,children:"Try again"}),t.jsx(N,{variant:"ghost",onClick:a,children:"Not now"})]})]})}function qe({accountId:e,filter:a,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d}){const f=Ne(),n=t.jsx(Ue,{accountId:e,filter:a,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d});return f?t.jsx(ne,{open:!0,onClose:d,title:"Filter rule",children:n}):t.jsx(je,{open:!0,onClose:d,dismissLabel:"Dismiss filter rule",children:n})}function Ge({filters:e,mailboxName:a,labelById:r,onEdit:i,onDelete:c,deletingFilterId:g,semanticUnavailable:d=!1,now:f=Date.now()}){return e.length===0?t.jsx("p",{className:"py-6 text-sm text-fg-muted",children:"No filters yet. Select a few messages in the inbox and choose Organize to make one."}):t.jsx("ul",{className:"divide-y divide-line rounded-md border border-line",children:e.map(n=>{const l=Ae(n,f),m=l==="Expired",u=n.actionMailboxId!==S?a(n.actionMailboxId):void 0,h=n.actionLabelId!==S?r.get(n.actionLabelId):void 0,b=Le(n.expiresAt);return t.jsxs("li",{className:"flex items-start gap-3 px-3 py-2.5",children:[t.jsxs("button",{type:"button",onClick:()=>i(n.filterId),"aria-label":`Edit filter ${n.name}`,className:"min-w-0 flex-1 rounded-sm text-left hover:opacity-80",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:`truncate text-sm font-medium ${m?"text-fg-muted":"text-fg"}`,children:n.name}),t.jsx(re,{tone:m?"neutral":"positive",dot:!0,children:l})]}),t.jsxs("p",{className:"mt-0.5 text-xs text-fg-subtle",children:[u?`Moves matches to ${u}`:"No move action",n.scope==="Temporary"&&b?m?` · expired ${b}`:` · until ${b}`:n.scope==="Standing"?" · always":""]}),(n.hasAnchor||h)&&t.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[n.hasAnchor&&t.jsx(oe,{widen:{anchorCount:1,...d?{inactive:!0}:{}}}),h&&t.jsx(le,{label:{labelId:h.id,name:h.name,color:h.color}})]})]}),t.jsx(N,{variant:"ghost",size:"sm",icon:t.jsx(ce,{className:"size-4 text-danger"}),onClick:()=>c(n.filterId),disabled:g===n.filterId,"aria-label":`Delete filter ${n.name}`})]},n.filterId)})})}const He=t.jsxs("div",{className:"space-y-3",children:[t.jsxs("p",{children:["Filters are the standing rules Organize creates. A"," ",t.jsx("strong",{children:"Standing"})," filter keeps working on new mail; a"," ",t.jsx("strong",{children:"Temporary"})," one stops on its own at the date you picked."]}),t.jsx("p",{children:"An expired filter isn't deleted the instant it lapses — it stays here, marked Expired, so you can see what it did and when it stopped."})]});function Je({account:e}){const a=e.accountId,{filters:r,isPending:i,isError:c,error:g,refetch:d}=Te(a),{deleteFilter:f,deletingFilterId:n}=ke(a),[l,m]=x.useState(),{data:u}=P({...de({path:{accountId:a}}),staleTime:1/0}),h=me(),b=x.useMemo(()=>ue(e.folderAppointments),[e.folderAppointments]),M=x.useCallback(p=>{const O=u?.items.find(E=>E.mailboxId===p);if(O)return pe(O,b.get(p),h)},[u?.items,b,h]),C=x.useMemo(()=>xe({mailboxes:u?.items??[],folderAppointments:e.folderAppointments,translator:h}),[u?.items,e.folderAppointments,h]),j=fe(u?.items??[]),{labels:v}=Se(a),F=x.useMemo(()=>v.map(p=>({id:p.labelId,name:p.name,color:p.color})),[v]),w=x.useMemo(()=>new Map(F.map(p=>[p.id,p])),[F]),I=r.find(p=>p.filterId===l);return t.jsxs("section",{className:"space-y-2",children:[t.jsx("h2",{className:"text-sm font-semibold text-fg",children:e.email}),I&&t.jsx(qe,{accountId:a,filter:I,folders:C,delimiter:j,labels:F,onClose:()=>m(void 0)}),i?t.jsx("div",{className:"h-16 animate-pulse rounded-md border border-line bg-surface","aria-busy":"true","aria-label":`Loading filters for ${e.email}`}):c?t.jsx($,{variant:"inline",title:`Couldn't load filters for ${e.email}`,error:g,onRetry:()=>{d()}}):t.jsx(Ge,{filters:r,mailboxName:M,labelById:w,onEdit:m,onDelete:f,deletingFilterId:n})]})}function ot(){const e=he(),[a,r]=x.useState(!0),{data:i,isPending:c,isError:g,error:d,refetch:f}=P(ge()),n=l=>{const m=be[l];m&&e({to:m})};return t.jsx(ye,{items:ve,activeId:"filters",title:"Filters",description:"Standing and temporary rules created by Organize, per account.",help:He,helpOpen:a,onToggleHelp:()=>r(l=>!l),onSelect:n,onBackToMail:()=>{e({to:"/mail"})},children:c?t.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):g?t.jsx($,{title:"Couldn't load accounts",error:d,onRetry:()=>{f()}}):i.accounts.length===0?t.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):t.jsx("div",{className:"space-y-8",children:i.accounts.map(l=>t.jsx(Je,{account:l},l.accountId))})})}export{Je as AccountFilters,ot as component};
1
+ import{n as Y,a7 as Z,aO as ee,aP as te,r as x,aQ as ae,j as t,aR as se,aS as ie,af as R,B as N,an as ne,at as re,aT as oe,aU as le,T as ce,s as P,q as de,aV as me,v as ue,x as pe,aW as xe,aX as fe,m as he,Q as ge,ar as ve,av as be}from"./index-CUDGbjSt.js";import{S as ye}from"./settings-screen-Cf-plmEr.js";import{B as je}from"./bottom-sheet-BH88Otuk.js";import{u as Ne}from"./useMediaQuery-XxWbPYsI.js";import{u as Ce,a as Se}from"./useLabels-ubt8he3q.js";import{b as Fe,N as S,p as Me,u as Ie,r as Oe,a as we,S as L,c as Ee,n as De,f as Ae,d as Le,e as Te,g as ke}from"./useFilters-C2y22aXO.js";import{C as A}from"./circle-check-Dn5_xOpA.js";import{E as $}from"./ErrorState-B-pmt8tr.js";import"./avatar-D9LII8Ln.js";import"./menu-zoD3J9Wr.js";import"./circle-help-DtosCxuB.js";const Re=(e,a)=>{const r=Y(),i=Z({...te(),onSuccess:()=>{e&&(r.invalidateQueries({queryKey:Fe(e)}),a&&r.invalidateQueries({queryKey:ee({path:{accountId:e,filterId:a}})}))}}),{mutate:c}=i;return{updateFilter:x.useCallback(d=>{!e||!a||c({path:{accountId:e,filterId:a},body:d})},[e,a,c]),isPending:i.isPending,isSuccess:i.isSuccess,isError:i.isError,error:i.error,reset:i.reset}},Pe=(e,a=!1)=>({clauses:e.literalClauses.map((i,c)=>({id:`clause-${c}`,field:i.field,value:i.value})),matchOperator:e.matchOperator==="And"?"all":"any",widen:e.hasAnchor?{anchorCount:1,...a?{inactive:!0}:{}}:void 0,moveMailboxId:e.actionMailboxId!==S?e.actionMailboxId:void 0,labelId:e.actionLabelId!==S?e.actionLabelId:void 0,scope:e.scope==="Temporary"?"until":"standing",until:e.scope==="Temporary"?$e(e.expiresAt):void 0,name:e.name}),$e=e=>{if(!e)return"";const a=Date.parse(e);if(Number.isNaN(a))return"";const r=new Date(a),i=c=>String(c).padStart(2,"0");return`${r.getFullYear()}-${i(r.getMonth()+1)}-${i(r.getDate())}`},T=e=>JSON.stringify({clauses:e.clauses.map(a=>[a.field,a.value]),operator:e.matchOperator,move:e.moveMailboxId??null,label:e.labelId??null,widen:e.widen?e.widen.inactive?"inactive":"active":"none"}),z=(e,a)=>T(e)!==T(a),k=e=>JSON.stringify({scope:e.scope==="until"?"until":"standing",until:e.scope==="until"?e.until??"":""}),U=(e,a)=>k(e)!==k(a),ze=(e,a)=>{const r={},i=(e.name??"").trim();return i!==(a.name??"").trim()&&(r.name=i),z(e,a)&&(r.matchOperator=e.matchOperator==="all"?"And":"Or",r.literalClauses=e.clauses.map(c=>({field:c.field,value:c.value})),r.actionMailboxId=e.moveMailboxId??S,r.actionLabelId=e.labelId??S),U(e,a)&&(r.scope=e.scope==="until"?"Temporary":"Standing",e.scope==="until"&&(r.expiresAt=Me(e.until??""))),r};function Ue({accountId:e,filter:a,folders:r,delimiter:i,labels:c,semanticUnavailable:g=!1,onClose:d}){const f=x.useMemo(()=>Pe(a,g),[a,g]),[n,l]=x.useState(f),[m,u]=x.useState(),[h,b]=x.useState(!1),M=x.useRef(0),{count:C}=Ie(e,Oe(n)),j=Re(e,a.filterId),v=we(e),{createFolderIn:F}=ae(e),{createLabel:w}=Ce(e),I=async o=>{const s=await w(o);return{id:s.labelId,name:s.name,color:s.color}},p=()=>u({mode:"add",draft:{field:L[0],value:""}}),O=o=>{const s=n.clauses.find(y=>y.id===o);s&&u({mode:"edit",clauseId:o,draft:{field:s.field,value:s.value}})},E=o=>u(s=>s&&{...s,draft:{...s.draft,field:o}}),_=o=>u(s=>s&&{...s,draft:{...s.draft,value:o}}),B=()=>{if(!m)return;const o=m.draft.field,s=De(o,m.draft.value);s!==""&&(l(y=>m.mode==="edit"&&m.clauseId?{...y,clauses:y.clauses.map(D=>D.id===m.clauseId?{id:D.id,field:o,value:s}:D)}:(M.current+=1,{...y,clauses:[...y.clauses,{id:`new-${M.current}`,field:o,value:s}]})),u(void 0))},Q=o=>l(s=>({...s,clauses:s.clauses.filter(y=>y.id!==o)})),K=o=>l(s=>({...s,matchOperator:o})),V=o=>l(s=>({...s,moveMailboxId:o||void 0})),q=o=>l(s=>({...s,labelId:o||void 0})),G=o=>l(s=>({...s,name:o})),H=o=>l(s=>({...s,scope:o,until:o==="until"?s.until:void 0})),J=o=>l(s=>({...s,until:o})),W=()=>{const o=z(n,f)||U(n,f),s=ze(n,f);if(Object.keys(s).length===0){d();return}b(o),j.updateFilter(s)},X=()=>v.start(Ee(n));return v.isStarting||v.isRunning||v.isDone?t.jsx(Ke,{progress:v.progress,isDone:v.isDone,onClose:d}):j.isPending?t.jsx(_e,{}):j.isError?t.jsx(Ve,{onRetry:j.reset,onClose:d}):j.isSuccess?h?t.jsx(Qe,{preview:se(C),blocked:C.status!=="ready"||C.stale===!0,onReapply:X,onClose:d}):t.jsx(Be,{onClose:d}):t.jsx(ie,{rule:n,folders:r,delimiter:i,labels:c,preview:C,semanticAvailable:!1,clauseFields:L,anchorLocked:!0,clauseEdit:m,onStartAddClause:p,onStartEditClause:O,onRemoveClause:Q,onChangeDraftField:E,onChangeDraftValue:_,onSubmitClause:B,onCancelClause:()=>u(void 0),onChangeMatchOperator:K,onChangeMove:V,onCreateFolder:F,onChangeLabel:q,onCreateLabel:I,onChangeName:G,onChangeScope:H,onChangeUntil:J,onCommit:W,onCancel:d})}function _e(){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[t.jsx(R,{className:"size-8 animate-spin text-accent-2"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Saving changes…"})]})}function Be({onClose:e}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx(A,{className:"size-8 text-positive"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Filter updated"}),t.jsx(N,{variant:"primary",onClick:e,className:"mt-2",children:"Done"})]})}function Qe({preview:e,blocked:a,onReapply:r,onClose:i}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx(A,{className:"size-8 text-positive"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Rule saved"}),t.jsxs("p",{className:"max-w-xs text-xs text-fg-muted",children:["New mail follows the rule automatically. ",e," — move the mail already in your mailbox too?"]}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsx(N,{variant:"primary",onClick:r,disabled:a,children:"Move existing mail"}),t.jsx(N,{variant:"ghost",onClick:i,children:"Not now"})]})]})}function Ke({progress:e,isDone:a,onClose:r}){const i=e.state==="Failed";return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[a?i?t.jsx("span",{className:"text-sm font-semibold text-danger",children:"Move failed"}):t.jsx(A,{className:"size-8 text-positive"}):t.jsx(R,{className:"size-8 animate-spin text-accent-2"}),!a&&t.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving existing mail…"}),a&&!i&&t.jsxs("div",{className:"text-sm text-fg",children:[t.jsx("p",{className:"font-medium",children:"Done"}),t.jsxs("p",{className:"mt-1 text-xs text-fg-muted",children:[e.appliedCount," of ",e.matchedCount," moved",e.failedCount>0?` · ${e.failedCount} failed`:"","."]})]}),a&&i&&t.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:e.errorMessage||"Something went wrong. Please try again."}),a&&t.jsx(N,{variant:"primary",onClick:r,className:"mt-2",children:"Done"})]})}function Ve({onRetry:e,onClose:a}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx("p",{className:"text-sm font-medium text-danger",children:"Couldn't save changes"}),t.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:"Please try again."}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsx(N,{variant:"primary",onClick:e,children:"Try again"}),t.jsx(N,{variant:"ghost",onClick:a,children:"Not now"})]})]})}function qe({accountId:e,filter:a,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d}){const f=Ne(),n=t.jsx(Ue,{accountId:e,filter:a,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d});return f?t.jsx(ne,{open:!0,onClose:d,title:"Filter rule",children:n}):t.jsx(je,{open:!0,onClose:d,dismissLabel:"Dismiss filter rule",children:n})}function Ge({filters:e,mailboxName:a,labelById:r,onEdit:i,onDelete:c,deletingFilterId:g,semanticUnavailable:d=!1,now:f=Date.now()}){return e.length===0?t.jsx("p",{className:"py-6 text-sm text-fg-muted",children:"No filters yet. Select a few messages in the inbox and choose Organize to make one."}):t.jsx("ul",{className:"divide-y divide-line rounded-md border border-line",children:e.map(n=>{const l=Ae(n,f),m=l==="Expired",u=n.actionMailboxId!==S?a(n.actionMailboxId):void 0,h=n.actionLabelId!==S?r.get(n.actionLabelId):void 0,b=Le(n.expiresAt);return t.jsxs("li",{className:"flex items-start gap-3 px-3 py-2.5",children:[t.jsxs("button",{type:"button",onClick:()=>i(n.filterId),"aria-label":`Edit filter ${n.name}`,className:"min-w-0 flex-1 rounded-sm text-left hover:opacity-80",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:`truncate text-sm font-medium ${m?"text-fg-muted":"text-fg"}`,children:n.name}),t.jsx(re,{tone:m?"neutral":"positive",dot:!0,children:l})]}),t.jsxs("p",{className:"mt-0.5 text-xs text-fg-subtle",children:[u?`Moves matches to ${u}`:"No move action",n.scope==="Temporary"&&b?m?` · expired ${b}`:` · until ${b}`:n.scope==="Standing"?" · always":""]}),(n.hasAnchor||h)&&t.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[n.hasAnchor&&t.jsx(oe,{widen:{anchorCount:1,...d?{inactive:!0}:{}}}),h&&t.jsx(le,{label:{labelId:h.id,name:h.name,color:h.color}})]})]}),t.jsx(N,{variant:"ghost",size:"sm",icon:t.jsx(ce,{className:"size-4 text-danger"}),onClick:()=>c(n.filterId),disabled:g===n.filterId,"aria-label":`Delete filter ${n.name}`})]},n.filterId)})})}const He=t.jsxs("div",{className:"space-y-3",children:[t.jsxs("p",{children:["Filters are the standing rules Organize creates. A"," ",t.jsx("strong",{children:"Standing"})," filter keeps working on new mail; a"," ",t.jsx("strong",{children:"Temporary"})," one stops on its own at the date you picked."]}),t.jsx("p",{children:"An expired filter isn't deleted the instant it lapses — it stays here, marked Expired, so you can see what it did and when it stopped."})]});function Je({account:e}){const a=e.accountId,{filters:r,isPending:i,isError:c,error:g,refetch:d}=Te(a),{deleteFilter:f,deletingFilterId:n}=ke(a),[l,m]=x.useState(),{data:u}=P({...de({path:{accountId:a}}),staleTime:1/0}),h=me(),b=x.useMemo(()=>ue(e.folderAppointments),[e.folderAppointments]),M=x.useCallback(p=>{const O=u?.items.find(E=>E.mailboxId===p);if(O)return pe(O,b.get(p),h)},[u?.items,b,h]),C=x.useMemo(()=>xe({mailboxes:u?.items??[],folderAppointments:e.folderAppointments,translator:h}),[u?.items,e.folderAppointments,h]),j=fe(u?.items??[]),{labels:v}=Se(a),F=x.useMemo(()=>v.map(p=>({id:p.labelId,name:p.name,color:p.color})),[v]),w=x.useMemo(()=>new Map(F.map(p=>[p.id,p])),[F]),I=r.find(p=>p.filterId===l);return t.jsxs("section",{className:"space-y-2",children:[t.jsx("h2",{className:"text-sm font-semibold text-fg",children:e.email}),I&&t.jsx(qe,{accountId:a,filter:I,folders:C,delimiter:j,labels:F,onClose:()=>m(void 0)}),i?t.jsx("div",{className:"h-16 animate-pulse rounded-md border border-line bg-surface","aria-busy":"true","aria-label":`Loading filters for ${e.email}`}):c?t.jsx($,{variant:"inline",title:`Couldn't load filters for ${e.email}`,error:g,onRetry:()=>{d()}}):t.jsx(Ge,{filters:r,mailboxName:M,labelById:w,onEdit:m,onDelete:f,deletingFilterId:n})]})}function ot(){const e=he(),[a,r]=x.useState(!0),{data:i,isPending:c,isError:g,error:d,refetch:f}=P(ge()),n=l=>{const m=be[l];m&&e({to:m})};return t.jsx(ye,{items:ve,activeId:"filters",title:"Filters",description:"Standing and temporary rules created by Organize, per account.",help:He,helpOpen:a,onToggleHelp:()=>r(l=>!l),onSelect:n,onBackToMail:()=>{e({to:"/mail"})},children:c?t.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):g?t.jsx($,{title:"Couldn't load accounts",error:d,onRetry:()=>{f()}}):i.accounts.length===0?t.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):t.jsx("div",{className:"space-y-8",children:i.accounts.map(l=>t.jsx(Je,{account:l},l.accountId))})})}export{Je as AccountFilters,ot as component};
@@ -0,0 +1 @@
1
+ import{j as o,U as i}from"./index-CUDGbjSt.js";import{a as m}from"./search-view-B61gi3Tp.js";import{F as r}from"./FlaggedPane-DShtZRWu.js";import{u as p}from"./useSearchMirror-bWKQN2Dl.js";import"./useMessageBodyContent-AsE119jK.js";import{f as e}from"./search-token-index-BdWyU2pZ.js";import"./FullCompose-C-FIaleL.js";import"./ErrorState-B-pmt8tr.js";import"./index-B6Fz4X0i.js";import"./useSignature-J18jTbi3.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CgbEHRND.js";import"./useMediaQuery-XxWbPYsI.js";import"./confirm-dialog-BZYLusH1.js";import"./useSearchTokenContext-5QVIZLT9.js";import"./kbd-BqP2t_lb.js";import"./search-scope-CdVMxnJQ.js";import"./MailListHeader-CCZ5QHsx.js";import"./attachment-file-DENdjOom.js";import"./mail-9u6lVCNj.js";import"./avatar-D9LII8Ln.js";import"./format-23Av07Go.js";import"./download-CxMx2zdk.js";import"./shield-check-CSPq5rhh.js";import"./useFilters-C2y22aXO.js";import"./clock-acRpctBX.js";import"./menu-zoD3J9Wr.js";import"./MailViewChrome-CAl6yjWH.js";import"./wizard-selection-B1bng5Jq.js";function w(){const t=e();return p({to:"/mail/flagged"}),o.jsx(r,{thread:t,children:o.jsx(m,{phone:o.jsx(r.Phone,{}),list:o.jsx(r.List,{}),reading:o.jsx(i,{}),intelligence:o.jsx(r.Intelligence,{}),hasThread:!!t})})}export{w as component};
@@ -1 +1 @@
1
- import{j as r}from"./index-Qtf-W_hi.js";import{E as o}from"./ErrorState-Bvky1o-F.js";const l=({error:t,reset:e})=>r.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:r.jsx(o,{title:"Couldn't load your starred mail",error:t,onRetry:e})});export{l as errorComponent};
1
+ import{j as r}from"./index-CUDGbjSt.js";import{E as o}from"./ErrorState-B-pmt8tr.js";const l=({error:t,reset:e})=>r.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:r.jsx(o,{title:"Couldn't load your starred mail",error:t,onRetry:e})});export{l as errorComponent};
@@ -0,0 +1 @@
1
+ import{j as e,B as N,T as Q,aY as Y,r as c,an as W,X,aw as he,ad as Z,F as xe,aZ as G,a_ as fe,ac as pe,ag as ge,as as L,az as be,a$ as ve,n as J,K as ee,V as se,b0 as ye,b1 as je,ax as Ne,J as ke,b2 as Ce,b3 as _,b4 as we,b5 as Se,b6 as te,b7 as Me,b8 as H,aQ as ae,aV as re,aW as Ie,x as B,v as ne,af as K,b9 as V,ba as Ee,a3 as De,bb as Ae,m as Oe,s as ie,Q as Te,ar as Re,av as Fe,q as Pe,a7 as U,bc as $e,bd as ze,be as Le,aD as _e,bf as Qe,bg as Be}from"./index-CUDGbjSt.js";import{P as Ke}from"./pencil-o1Rn-TLk.js";import{S as qe}from"./settings-screen-Cf-plmEr.js";import{E as oe}from"./ErrorState-B-pmt8tr.js";import"./avatar-D9LII8Ln.js";import"./menu-zoD3J9Wr.js";import"./circle-help-DtosCxuB.js";const Ge=({label:s,onRename:t,onDelete:a,deleteBlockedReason:o,renameLabel:m=u=>`Rename ${u}`,deleteLabel:r=u=>`Delete ${u}`})=>{const u=o?`${r(s)} — ${o}`:r(s);return e.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 pr-2",children:[e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(Ke,{className:"size-3.5"}),"aria-label":m(s),onClick:t}),e.jsx("span",{title:o,children:e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(Q,{className:"size-3.5"}),"aria-label":u,disabled:o!==void 0,onClick:a})})]})},He=({folders:s,onRename:t,onDelete:a,onCreateFolder:o,delimiter:m,labels:r})=>{const u=new Map(s.map(l=>[l.id,l]));return e.jsx(Y,{folders:s,onCreateFolder:o,delimiter:m,labels:{treeAriaLabel:"Your folders",optionLabel:l=>l.label,...r},rowActions:l=>{const i=u.get(l.id);return i?e.jsx(Ge,{label:i.label,deleteBlockedReason:i.deleteBlockedReason,renameLabel:r?.rename,deleteLabel:r?.remove,onRename:()=>t(i),onDelete:()=>a(i)}):null}})},Ve=({open:s,folderLabel:t,defaultLabel:a,name:o,onNameChange:m,onSubmit:r,onClose:u,pending:l=!1,error:i})=>{const d=c.useId(),g=`Rename ${t}`;return s?e.jsxs(W,{open:s,onClose:u,title:g,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:g}),e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(X,{className:"size-3.5"}),onClick:u,"aria-label":"Cancel"})]}),e.jsxs("div",{className:"space-y-3 px-5 py-4",children:[e.jsxs("div",{children:[e.jsx(he,{htmlFor:d,children:"Folder name"}),e.jsx(Z,{id:d,value:o,placeholder:a,onChange:p=>m(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),r())}})]}),e.jsxs("p",{className:"text-xs text-fg-muted",children:["Shown everywhere in Remit. Leave it blank to use"," ",e.jsx("span",{className:"font-medium text-fg",children:a}),"."]}),i&&e.jsx("p",{className:"text-xs text-danger",role:"alert",children:i})]}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:u,children:"Cancel"}),e.jsx(N,{variant:"primary",size:"sm",onClick:r,disabled:l,children:l?"Saving…":"Save name"})]})]}):null},Ue=["inbox","drafts","sent","archive","junk","trash"],q="",Ye={mailboxId:null,source:"None"};function We(s){const t=s.messageCount===1?"msg":"msgs";return`${G(s.providerPath,s.hierarchyDelimiter)} · ${s.messageCount} ${t}`}const le=s=>`${s} ${s===1?"message":"messages"}`,Xe=(s,t)=>s==="Appointed"?"Chosen by you":s==="Flagged"?`The mail server marks it as ${t}`:s==="Reserved"?"The account's own INBOX":"Matched by name, not confirmed";function Ze({role:s,folders:t,appointment:a,displayName:o,onAppoint:m,onRename:r}){const[u,l]=c.useState(o),i=c.useRef(null),d=c.useRef(!1),g=c.useId(),{mailboxId:p,source:v,staleFolderPath:y}=a,h=t.find(j=>j.mailboxId===p)??null,f=be(s),O=h!=null&&u.trim()!==o.trim();c.useEffect(()=>{!d.current||v==="Proposed"||(d.current=!1,i.current?.focus())},[v]);const I=(()=>{if(v==="None"){const j=s==="trash"?" Deleting mail needs one.":"";return e.jsx("span",{id:g,className:"pl-[7.5rem] text-xs text-fg-muted",children:`Not set — pick the folder this account uses for ${f}.${j}`})}return v==="Stale"||!h?null:e.jsx("span",{id:g,className:"truncate pl-[7.5rem] text-2xs text-fg-subtle",title:h.providerPath,children:`${Xe(v,f)} · ${h.providerPath} · ${le(h.messageCount)}`})})(),w=s==="trash"?" Deleting mail is stopped until you pick another one.":h?` reader is using ${G(h.providerPath,h.hierarchyDelimiter)} instead.`:"",A=`The folder you chose for ${f}${y?` — ${y} —`:""} is gone from the mail server.${w}`;return e.jsxs("div",{className:"flex flex-col gap-1 border-b border-line px-row-inset py-2.5 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"flex w-28 shrink-0 items-center gap-2 text-sm font-medium text-fg",children:[fe(s),f]}),e.jsxs(pe,{ref:i,className:"w-56 shrink-0",value:p??q,"aria-label":`Folder for ${f}`,"aria-describedby":I||v==="Stale"?g:void 0,onChange:j=>m(s,j.target.value===q?null:j.target.value),children:[e.jsx("option",{value:q,children:"None"}),t.map(j=>e.jsx("option",{value:j.mailboxId,children:We(j)},j.mailboxId))]}),v==="Proposed"&&h&&e.jsx(N,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{d.current=!0,m(s,h.mailboxId)},children:`Set as ${f}`}),h&&e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"flex-1",value:u,placeholder:f,"aria-label":`Display name for ${f}`,onChange:j=>l(j.target.value)}),O&&e.jsx(N,{variant:"ghost",size:"sm",className:"shrink-0",icon:e.jsx(ge,{className:"size-4"}),"aria-label":"Save display name",onClick:()=>r(h.mailboxId,u)})]})]}),I,v==="Stale"&&e.jsx(L,{tone:"warning",variant:"soft",className:"ml-[7.5rem]",children:e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{id:g,className:"flex-1",children:A}),e.jsx(N,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>i.current?.focus(),children:"Pick a folder"})]})})]})}function Je({accountEmail:s,folders:t,appointments:a,displayNames:o={},onAppoint:m,onRename:r}){const u=new Set(Object.values(a).map(i=>i.mailboxId).filter(i=>i!=null)),l=t.filter(i=>!u.has(i.mailboxId));return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsxs("h2",{className:"text-sm font-semibold text-fg",children:["Folder roles — ",s]}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Each role points to one folder. Pick the folder that holds the mail — the counts help you tell real folders from empty look-alikes. Appointing a folder here removes it from any other role. Each row says where its answer came from — your choice, the mail server's own flag, or a name reader matched."})]}),e.jsx("div",{className:"rounded-sm border border-line bg-surface",children:Ue.map(i=>{const d=a[i]??Ye;return e.jsx(Ze,{role:i,folders:t,appointment:d,displayName:d.mailboxId?o[d.mailboxId]??"":"",onAppoint:m,onRename:r},i)})}),l.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("h3",{className:"text-xs font-medium text-fg-muted",children:"Other folders"}),e.jsx("ul",{className:"rounded-sm border border-line bg-surface",children:l.map(i=>e.jsxs("li",{className:"flex items-center gap-2 border-b border-line px-row-inset py-2 text-sm text-fg last:border-b-0",children:[e.jsx(xe,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate",children:G(i.providerPath,i.hierarchyDelimiter)}),e.jsx("span",{className:"ml-auto shrink-0 text-2xs text-fg-subtle",children:le(i.messageCount)})]},i.mailboxId))})]})]})}const es=12e4,ss=2e3,ts="This folder is no longer in the account's folder list, so nothing was deleted.",ce=(s,t)=>{const a=s.find(o=>o.mailboxId===t);if(!a)throw new Error(ts);return a},as=(s,t)=>ce(s,t).lastSyncedAt??0;async function rs({readMailboxes:s,mailboxId:t,since:a,signal:o,segmentMs:m=es,pollIntervalMs:r=ss,delay:u=ve,now:l=Date.now}){const i=l()+m;for(;;){o?.throwIfAborted();const d=ce(await s(),t);if((d.lastSyncedAt??0)>a)return{status:"fresh",messageCount:d.messagesTotal};if(l()>=i)return{status:"pending"};await u(r,o)}}const de=50,ns=s=>s instanceof Error?s.message:"Something went wrong.",$=s=>s.then(t=>({ok:!0,value:t}),t=>({ok:!1,error:ns(t)})),is=async(s,t,a,o)=>{const m=[];let r;for(let u=0;u<de;u+=1){if(o.aborted)return m;const{data:l}=await te({path:{mailboxId:s},query:{order:"desc",continuationToken:r},throwOnError:!0});for(const i of l.items)if(!i.isDeleted&&!t.has(i.messageId)&&!m.includes(i.messageId)&&(m.push(i.messageId),m.length>=a))return m;if(!l.continuationToken)break;r=l.continuationToken}return m},os=async(s,t)=>{let a=0,o;for(let m=0;m<de;m+=1){if(t.aborted)return a;const{data:r}=await te({path:{mailboxId:s},query:{order:"desc",continuationToken:o},throwOnError:!0});for(const u of r.items)u.isDeleted||(a+=1);if(!r.continuationToken)break;o=r.continuationToken}return a};function ls({accountId:s,mailboxId:t,onDeleted:a}){const o=J(),[m,r]=c.useState("idle"),[u,l]=c.useState(null),[i,d]=c.useState(),[g,p]=c.useState(),v=c.useRef(null),y=c.useRef(void 0),h=c.useCallback(()=>{o.invalidateQueries({queryKey:ee({path:{accountId:s}})}),o.invalidateQueries({queryKey:se()})},[o,s]),f=c.useCallback(async()=>{r("deleting");const k=await $(ye({path:{accountId:s,mailboxId:t},throwOnError:!0}));if(!k.ok){d(k.error),r("error");return}h(),r("done"),a()},[s,t,h,a]),O=c.useCallback(()=>je({path:{accountId:s},throwOnError:!0}).then(({data:k})=>k.items.find(S=>S.mailboxId===t)?.messageCount??0),[s,t]),I=c.useCallback(()=>o.fetchQuery({...Ne({path:{accountId:s}}),staleTime:0}).then(k=>k.mailboxes??[]),[o,s]),w=c.useCallback(async()=>{const k=new AbortController;v.current=k;const{signal:S}=k;r("checking"),d(void 0);const M=y.current!==void 0,C=await $((async()=>(M||(S.throwIfAborted(),y.current=as(await I(),t),S.throwIfAborted(),p(Date.now()),await ke({path:{accountId:s},throwOnError:!0})),rs({readMailboxes:I,mailboxId:t,since:y.current??0,signal:S})))());return S.aborted?(r("idle"),y.current=void 0,{status:"failed"}):C.ok?C.value.status==="pending"?(r("check-stalled"),{status:"pending"}):(y.current=void 0,C.value.messageCount>0?(r("idle"),h(),{status:"blocked",messageCount:C.value.messageCount}):(await f(),{status:"deleted"})):(y.current=void 0,d(C.error),r("error"),{status:"failed"})},[s,t,I,f,h]),A=c.useCallback(()=>{v.current?.abort()},[]),j=c.useCallback(async k=>{const S=new AbortController;v.current=S;const{signal:M}=S;r("moving"),d(void 0);const C=await $(O());if(M.aborted)return;if(!C.ok){d(C.error),r("error");return}let x=Ce(C.value);l(x);const E=new Set;for(;;){if(M.aborted)return;const n=await $(is(t,E,Me,M));if(M.aborted)return;if(!n.ok){x=_(x,n.error),l(x),d(n.error),r("error");return}const b=n.value;if(b.length===0)break;const T=await $(we({body:{messageIds:b,destinationMailboxId:k},throwOnError:!0}));if(M.aborted)return;if(!T.ok){x=_(x,T.error),l(x),d(T.error),r("error");return}for(const P of b)E.add(P);x=Se(x,b.length),l(x)}const D=await $(os(t,M));if(!M.aborted){if(!D.ok){x=_(x,D.error),l(x),d(D.error),r("error");return}if(D.value>0){const n=`${D.value} ${D.value===1?"email is":"emails are"} still syncing. Re-open delete to finish removing this folder.`;x=_(x,n),l(x),d(n),r("error"),h();return}await f()}},[t,O,f,h]),R=c.useCallback(()=>{v.current?.abort(),v.current=null,y.current=void 0,r("idle"),l(null),d(void 0),p(void 0)},[]);return{phase:m,progress:u,errorMessage:i,checkStartedAt:g,deleteMailbox:f,deleteIfEmpty:w,moveThenDelete:j,cancel:A,reset:R}}const z=s=>`${s} ${s===1?"email":"emails"}`;function cs({open:s,accountId:t,folder:a,mailboxes:o,appointments:m,onClose:r}){const[u,l]=c.useState(()=>H(a.messageCount)),[i,d]=c.useState(),[g,p]=c.useState(),{createFolderIn:v}=ae(t),y=re(),{phase:h,progress:f,errorMessage:O,checkStartedAt:I,deleteMailbox:w,deleteIfEmpty:A,moveThenDelete:j,cancel:R,reset:k}=ls({accountId:t,mailboxId:a.mailboxId,onDeleted:r}),[S,M]=c.useState("0:00"),C=h==="checking"||h==="check-stalled";c.useEffect(()=>{if(!C||I===void 0)return;const F=()=>M(Ae(Date.now()-I));F();const ue=setInterval(F,1e3);return()=>clearInterval(ue)},[C,I]),c.useEffect(()=>{s&&(l(H(a.messageCount)),d(void 0),k())},[s,k]),c.useEffect(()=>{s&&p(void 0)},[s]),c.useEffect(()=>R,[R]);const x=c.useCallback(()=>{R(),r()},[R,r]),E=c.useCallback(async()=>{const F=await A();F.status==="blocked"&&(d(F.messageCount),l("choose-fate"))},[A]),D=c.useMemo(()=>Ie({mailboxes:o,folderAppointments:m,excludeMailboxId:a.mailboxId,translator:y}),[o,m,a.mailboxId,y]),n=D.find(F=>F.id===g),b=c.useMemo(()=>B(a,ne(m).get(a.mailboxId),y),[a,m,y]);if(!s)return null;const T=`Delete ${b}`,P=i??a.messageCount,me=h==="moving"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(K,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving emails…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:f?V(f):"Moved 0 of 0"})]}):h==="checking"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(K,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Checking the folder on the mail server…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:`Waiting ${S}. Nothing is deleted until the server answers.`})]}):h==="check-stalled"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(L,{tone:"warning",variant:"soft",children:`The mail server hasn't reported back on this folder yet — ${S} so far. Nothing has been deleted.`}),e.jsx("p",{className:"text-xs text-fg-muted",children:"A sync covers the whole account, so a busy mailbox can take a while to come round to this folder."}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"}),e.jsx(N,{size:"sm",onClick:()=>E(),children:"Keep waiting"})]})]}):h==="deleting"||h==="done"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(K,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Deleting folder…"})]}):h==="error"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(L,{tone:"danger",variant:"soft",children:O??"Something went wrong. Please try again."}),f&&e.jsxs("p",{className:"text-xs text-fg-muted",children:[V(f),". Already-moved emails stay moved — re-open delete to continue with the rest."]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Close"})})]}):u==="confirm-empty"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:b}),"? This folder is empty and will be removed from the server."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"}),e.jsx(N,{variant:"danger",size:"sm",icon:e.jsx(Q,{className:"size-3.5"}),onClick:()=>E(),children:"Delete folder"})]})]}):u==="choose-fate"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:[i!==void 0&&e.jsx(L,{tone:"warning",variant:"soft",children:`This folder is not empty: the mail server reports ${z(i)} in it. Nothing was deleted.`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:b})," holds"," ",z(P),". What should happen to them?"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{type:"button",onClick:()=>l("confirm-delete-all"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(Q,{className:"size-4 shrink-0 text-danger"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Delete them with the folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"The emails are removed from the server and can't be recovered."})]})]}),e.jsxs("button",{type:"button",onClick:()=>l("pick-destination"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(Ee,{className:"size-4 shrink-0 text-accent-2"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Move them to another folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"Keep the emails, then delete the emptied folder."})]})]})]})]}),e.jsx("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"})})]}):u==="confirm-delete-all"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:b})," and its"," ",z(P),"? The messages are removed from the server with the folder and can't be recovered."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:()=>l("choose-fate"),children:"Back"}),e.jsx(N,{variant:"danger",size:"sm",icon:e.jsx(Q,{className:"size-3.5"}),onClick:()=>w(),children:"Delete folder and emails"})]})]}):e.jsxs("div",{className:"flex h-[26rem] flex-col",children:[e.jsxs("p",{className:"px-5 pt-4 text-sm text-fg-muted",children:["Move the ",z(P)," in"," ",e.jsx("strong",{className:"text-fg",children:b})," to:"]}),e.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:e.jsx(Y,{folders:D,selectedId:g,delimiter:o[0]?.hierarchyDelimiter??"/",onSelect:p,onCreateFolder:v,onCancel:()=>{p(void 0),l("choose-fate")},labels:{filterPlaceholder:"Move emails to…"}})}),n&&e.jsx("footer",{className:"shrink-0 border-t border-line p-2",children:e.jsx(N,{variant:"danger",onClick:()=>j(n.id),className:"h-11 w-full font-semibold",children:e.jsx("span",{className:"truncate",children:`Move ${z(P)} to ${n.label}`})})})]});return e.jsxs(W,{open:s,onClose:x,title:T,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx(De,{className:"size-4 shrink-0 text-danger"}),e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:T}),e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(X,{className:"size-3.5"}),onClick:x,"aria-label":"Cancel"})]}),me]})}const ds=e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Each canonical role — Inbox, Drafts, Sent, Archive, Spam, Trash — points at one of your account's real folders. Pick the one that actually holds the mail; the message counts tell real folders from empty look-alikes."}),e.jsx("p",{children:`Appointing a folder to a role here doesn't touch any other role, and doesn't move or rename anything on the server — it just tells Remit which folder to treat as e.g. "Drafts" everywhere (sidebar, unread badges, the compose flow).`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Your folders"})," is the account's real hierarchy. Open a folder to see what's inside it, make a new one where you're looking, and rename or delete any of them from its row."]})]});function ms({account:s}){const t=J(),a=s.accountId,o=re(),{data:m,isPending:r,isError:u,error:l,refetch:i}=ie(Pe({path:{accountId:a}})),{createFolderIn:d}=ae(a),g=U({...$e(),onSuccess:()=>{t.invalidateQueries({queryKey:se()})}}),p=U({...ze(),onSuccess:()=>{t.invalidateQueries({queryKey:ee({path:{accountId:a}})})}}),[v,y]=c.useState(),[h,f]=c.useState(),[O,I]=c.useState(""),w=c.useMemo(()=>m?.items??[],[m]),A=c.useMemo(()=>ne(s.folderAppointments),[s.folderAppointments]),j=c.useMemo(()=>w.map(n=>({id:n.mailboxId,label:B(n,A.get(n.mailboxId),o),path:n.fullPath,deleteBlockedReason:Le(n,w,s.folderAppointments).message})),[w,A,o,s.folderAppointments]),R=(n,b)=>{g.mutate({path:{accountId:a,role:Be[n]},body:{mailboxId:b}})},k=(n,b)=>{const T=b.trim();p.mutate({path:{accountId:a,mailboxId:n},body:{displayNameOverride:T===""?null:T}})};if(r)return e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":`Loading folders for ${s.email}`});if(u)return e.jsx(oe,{variant:"inline",title:`Couldn't load folders for ${s.email}`,error:l,onRetry:()=>{i()}});const S=w.map(n=>({mailboxId:n.mailboxId,providerPath:n.fullPath,hierarchyDelimiter:n.hierarchyDelimiter,messageCount:n.messageCount})),M={};for(const n of s.folderAppointments){const b=_e[n.role];b&&(M[b]={mailboxId:n.mailboxId??null,source:n.source,staleFolderPath:n.staleAppointmentPath})}const C={};for(const n of w)n.displayNameOverride&&(C[n.mailboxId]=n.displayNameOverride);const x=n=>w.find(b=>b.mailboxId===n),E=x(h),D=x(v);return e.jsxs("div",{className:"space-y-4",children:[(g.isError||p.isError)&&e.jsx(L,{tone:"danger",variant:"soft",children:Qe(g.error)?"That folder is still being created on the mail server — wait for it to finish, then try again.":"Couldn't save that change. Please try again."}),e.jsx(Je,{accountEmail:s.email,folders:S,appointments:M,displayNames:C,onAppoint:R,onRename:k}),e.jsxs("section",{className:"space-y-1.5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-fg",children:["Your folders — ",s.email]}),e.jsx("div",{className:"flex h-[28rem] flex-col overflow-hidden rounded-sm border border-line bg-surface",children:e.jsx(He,{folders:j,delimiter:w[0]?.hierarchyDelimiter??"/",onCreateFolder:d,onRename:n=>{f(n.id),I(x(n.id)?.displayNameOverride?.trim()??"")},onDelete:n=>y(n.id),labels:{treeAriaLabel:`All folders for ${s.email}`}})})]}),E&&e.jsx(Ve,{open:!0,folderLabel:B(E,A.get(E.mailboxId),o),defaultLabel:B({fullPath:E.fullPath,hierarchyDelimiter:E.hierarchyDelimiter},A.get(E.mailboxId),o),name:O,onNameChange:I,pending:p.isPending,error:p.isError?"Couldn't save that name. Please try again.":void 0,onSubmit:()=>{const n=O.trim();p.mutate({path:{accountId:a,mailboxId:E.mailboxId},body:{displayNameOverride:n===""?null:n}},{onSuccess:()=>f(void 0)})},onClose:()=>f(void 0)}),D&&e.jsx(cs,{open:!0,accountId:a,folder:D,mailboxes:w,appointments:s.folderAppointments,onClose:()=>y(void 0)})]})}function vs(){const s=Oe(),[t,a]=c.useState(!0),{data:o,isPending:m,isError:r,error:u,refetch:l}=ie(Te()),i=d=>{const g=Fe[d];g&&s({to:g})};return e.jsx(qe,{items:Re,activeId:"folders",title:"Folder roles",description:"Appoint which real folder fills each canonical role, per account.",help:ds,helpOpen:t,onToggleHelp:()=>a(d=>!d),onSelect:i,onBackToMail:()=>{s({to:"/mail"})},children:m?e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):r?e.jsx(oe,{title:"Couldn't load accounts",error:u,onRetry:()=>{l()}}):o.accounts.length===0?e.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):e.jsx("div",{className:"space-y-8",children:o.accounts.map(d=>e.jsx(ms,{account:d},d.accountId))})})}export{vs as component};
@@ -1 +1 @@
1
- import{j as e}from"./index-Qtf-W_hi.js";import{K as s}from"./kbd-CAjGmX5H.js";const a=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"VIP"})," senders get priority surface in the daily brief and notification escalation, even when an account is quiet."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Muted"})," senders never notify and stay out of the brief. Their mail still syncs and stays searchable."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Blocked"})," senders never load images and go straight to junk."]}),e.jsxs("p",{children:["Tip: flag from the keyboard on any message — ",e.jsx(s,{children:"v"})," VIP,"," ",e.jsx(s,{children:"m"})," mute, ",e.jsx(s,{children:"b"})," block. Every rule an automation creates shows up here and can be removed."]})]}),r=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Sync health"})," shows the IMAP connection state and the last successful sync per account."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Error"})," means the last connection attempt failed — the raw server response is shown on the card. Reconnect re-runs the connection test from the add-account wizard."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Muted"})," accounts keep syncing but stay out of the daily brief and unified counts."]})]}),c=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Density"})," controls how much information fits on screen. Compact is great on smaller displays; Comfortable gives each item more breathing room."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Theme"})," switches between light, dark, and system-preference modes instantly. The change takes effect across the whole app immediately."]}),e.jsx("p",{className:"text-2xs text-fg-subtle",children:"Preferences are stored locally in this browser. Server-side sync is coming soon."})]}),i=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Notification rules"})," and data export are coming in a future release."]}),e.jsxs("p",{children:["A message Remit cannot read is"," ",e.jsx("strong",{className:"text-fg",children:"set aside"})," rather than skipped, and the folder keeps syncing. Setting one aside is a defect in Remit, so every entry can be reported with the diagnostics already attached."]})]});export{r as a,i as b,c,a as s};
1
+ import{j as e}from"./index-CUDGbjSt.js";import{K as s}from"./kbd-BqP2t_lb.js";const a=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"VIP"})," senders get priority surface in the daily brief and notification escalation, even when an account is quiet."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Muted"})," senders never notify and stay out of the brief. Their mail still syncs and stays searchable."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Blocked"})," senders never load images and go straight to junk."]}),e.jsxs("p",{children:["Tip: flag from the keyboard on any message — ",e.jsx(s,{children:"v"})," VIP,"," ",e.jsx(s,{children:"m"})," mute, ",e.jsx(s,{children:"b"})," block. Every rule an automation creates shows up here and can be removed."]})]}),r=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Sync health"})," shows the IMAP connection state and the last successful sync per account."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Error"})," means the last connection attempt failed — the raw server response is shown on the card. Reconnect re-runs the connection test from the add-account wizard."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Muted"})," accounts keep syncing but stay out of the daily brief and unified counts."]})]}),c=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Density"})," controls how much information fits on screen. Compact is great on smaller displays; Comfortable gives each item more breathing room."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Theme"})," switches between light, dark, and system-preference modes instantly. The change takes effect across the whole app immediately."]}),e.jsx("p",{className:"text-2xs text-fg-subtle",children:"Preferences are stored locally in this browser. Server-side sync is coming soon."})]}),i=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Notification rules"})," and data export are coming in a future release."]}),e.jsxs("p",{children:["A message Remit cannot read is"," ",e.jsx("strong",{className:"text-fg",children:"set aside"})," rather than skipped, and the folder keeps syncing. Setting one aside is a defect in Remit, so every entry can be reported with the diagnostics already attached."]})]});export{r as a,i as b,c,a as s};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-CUDGbjSt.js";import{F as r}from"./FlaggedPane-DShtZRWu.js";import"./useSearchTokenContext-5QVIZLT9.js";import"./kbd-BqP2t_lb.js";import"./useMessageBodyContent-AsE119jK.js";import"./useMediaQuery-XxWbPYsI.js";import"./search-scope-CdVMxnJQ.js";import"./MailListHeader-CCZ5QHsx.js";import"./search-token-index-BdWyU2pZ.js";import"./attachment-file-DENdjOom.js";import"./mail-9u6lVCNj.js";import"./avatar-D9LII8Ln.js";import"./index-B6Fz4X0i.js";import"./useSignature-J18jTbi3.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CgbEHRND.js";import"./ErrorState-B-pmt8tr.js";import"./format-23Av07Go.js";import"./download-CxMx2zdk.js";import"./shield-check-CSPq5rhh.js";import"./useFilters-C2y22aXO.js";import"./confirm-dialog-BZYLusH1.js";import"./clock-acRpctBX.js";import"./menu-zoD3J9Wr.js";import"./MailViewChrome-CAl6yjWH.js";import"./wizard-selection-B1bng5Jq.js";function y(){return o.jsx(r.Reading,{})}export{y as component};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/rich-text-spellcheck-worker-provider-B1n5ttte.js","assets/index-Qtf-W_hi.js","assets/index-OWhz0EKb.css","assets/rich-text-spellcheck-provider-J8m9wz6A.js","assets/rich-text-DltXKh-H.js","assets/confirm-dialog-BlJPdK7i.js","assets/useMediaQuery-D0Zpb5Mx.js","assets/bottom-sheet-D_43RR7G.js","assets/attachment-file-BQwmdAG2.js","assets/useMessageBodyContent-De_0trDD.js","assets/useSignature-DNtMe-P5.js","assets/account-form-helpers-DhckT_PN.js","assets/useDebouncedValue-BJSGPhpK.js"])))=>i.map(i=>d[i]);
2
- import{j as p,X as fr,b as mr,B as Yt,af as pr,f as hr,T as vr,r as s,cc as gr,cd as wr,C as Sn,a3 as yr,ce as br,d as Er,cf as Sr,cg as Wt,bp as xn,ch as he,ci as Cn,cj as xr,n as Cr,a7 as ut,ck as lt,cl as Rr,cm as Dr,t as Tr,s as dt,bl as Ar,m as Or,cn as Rn,aF as Nr,aG as kr,Q as Dn,co as Pr,a5 as Ir,cp as Lr,cq as Mr,bv as St,cr as _r,a8 as jr,bo as Fr,a6 as $r,cs as Br,a4 as S}from"./index-Qtf-W_hi.js";import{q as Hr}from"./useMessageBodyContent-De_0trDD.js";import{u as Wr}from"./useSignature-DNtMe-P5.js";import{b as Ur}from"./account-form-helpers-DhckT_PN.js";import{u as Vr}from"./useDebouncedValue-BJSGPhpK.js";import{u as zr}from"./useMediaQuery-D0Zpb5Mx.js";const qr=({email:e,displayName:t,onRemove:n,className:r})=>p.jsxs("span",{className:mr("inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-accent-2-soft text-sm max-w-[200px]",r),children:[p.jsx("span",{className:"truncate",children:t||e}),p.jsx("button",{type:"button",onClick:n,className:"shrink-0 p-0.5 rounded-full hover:bg-fg-muted/20 transition-colors","aria-label":`Remove ${e}`,children:p.jsx(fr,{className:"size-3"})})]}),Kr=({save:e})=>e.status==="saving"?p.jsx("output",{className:"animate-pulse text-xs text-fg-muted",children:"Saving..."}):e.status==="saved"?p.jsx("output",{className:"text-xs text-fg-muted",children:"Draft saved"}):e.status==="error"?p.jsx("output",{className:"text-xs text-danger",children:"Save failed"}):e.status==="unsaved"?p.jsx("output",{className:"truncate text-xs text-warning",children:e.reason}):null;function Yr({send:e,onSend:t,onBlocked:n,onDiscard:r,save:o={status:"idle"}}){const a=e.status==="sending",i=e.status==="blocked"?e.reason:void 0;return p.jsxs("div",{className:"flex items-center justify-between border-t border-line px-3 py-2",children:[p.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[p.jsx(Yt,{variant:"primary",size:"md","aria-busy":a,title:i,className:"min-h-11 shrink-0 rounded-full px-4","data-testid":"compose-send",icon:a?p.jsx(pr,{className:"size-4 animate-spin"}):p.jsx(hr,{className:"size-4"}),onClick:()=>{if(!a){if(i!==void 0){n(i);return}t()}},children:"Send"}),p.jsx(Kr,{save:o})]}),p.jsx(Yt,{variant:"ghost",size:"md","aria-busy":a,"aria-label":"Discard",className:"min-h-11 min-w-11 px-2 hover:text-danger",icon:p.jsx(vr,{className:"size-4"}),onClick:()=>{a||r()}})]})}const Gr=["Tab",","],Gt=e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim()),Xr=e=>{const t=e.trim();if(!t)return;const n=t.match(/^(.+?)\s*<([^>]+)>$/);if(n){const r=n[1].trim(),o=n[2].trim();if(Gt(o))return{email:o,displayName:r}}if(Gt(t))return{email:t}},Qr=({label:e,addresses:t,onChange:n,placeholder:r,suggestions:o=[],onQueryChange:a})=>{const[i,c]=s.useState(""),h=s.useRef(null),m=new Set(t.map(d=>d.email.toLowerCase())),l=i.length>=2?o.filter(d=>!m.has(d.email.toLowerCase())):[],u=s.useCallback(d=>{m.has(d.email.toLowerCase())||(n([...t,d]),c(""),a?.(""))},[t,m,n,a]),v=s.useCallback(d=>{n(t.filter((g,A)=>A!==d))},[t,n]),y=s.useCallback(d=>{u(d),h.current?.focus()},[u]),E=s.useCallback(()=>{const d=Xr(i);d&&u(d)},[i,u]),f=gr({count:l.length,acceptKeys:Gr,onAccept:d=>y(l[d])}),b=s.useMemo(()=>l.map(d=>({value:d.email,label:d.displayName??d.email,...d.displayName?{hint:d.email}:{}})),[l]),w=s.useCallback(d=>{if(d.key==="Backspace"&&i===""&&t.length>0){v(t.length-1);return}f.handleKeyDown(d)||(d.key==="Enter"||d.key==="Tab"||d.key===",")&&i.trim()&&(d.preventDefault(),E())},[i,t.length,v,f.handleKeyDown,E]),T=s.useCallback(()=>{setTimeout(()=>{E(),f.dismiss()},150)},[E,f.dismiss]);return p.jsxs("div",{className:"relative","data-address-field":e,children:[p.jsxs("div",{className:"flex items-start gap-2",children:[p.jsxs("label",{htmlFor:`address-field-${e}`,className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:[e,":"]}),p.jsxs("div",{className:"flex-1 flex flex-wrap items-center gap-1 min-h-[36px] px-2 py-1 border rounded-md bg-canvas cursor-text",onClick:()=>h.current?.focus(),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&h.current?.focus()},children:[t.map((d,g)=>p.jsx(qr,{email:d.email,displayName:d.displayName,onRemove:()=>v(g)},d.email)),p.jsx("input",{ref:h,id:`address-field-${e}`,type:"text",value:i,onChange:d=>{f.reopen(),c(d.target.value),a?.(d.target.value)},onKeyDown:w,onBlur:T,placeholder:t.length===0?r:"",className:"flex-1 min-w-[120px] bg-transparent outline-none text-sm py-0.5",autoComplete:"off",...f.comboboxProps})]})]}),f.open&&p.jsx(wr,{id:f.listId,suggestions:b,activeIndex:f.activeIndex,optionId:f.optionId,onPick:d=>{const g=l.find(A=>A.email===d.value);g&&y(g)},onHighlight:f.setActiveIndex,label:`${e} suggestions`,className:"absolute left-12 right-0 z-50 mt-1 max-h-[200px] shadow-lg"})]})},Zr=()=>p.jsxs("div",{"aria-hidden":"true","data-testid":"compose-body-skeleton",className:"min-h-[120px] px-3 py-2",children:[p.jsx("div",{className:"mb-2 h-8 animate-pulse rounded bg-surface-sunken"}),p.jsx("div",{className:"min-h-[80px] animate-pulse rounded bg-surface-sunken/50"})]});function Jr({banner:e,header:t,children:n,quoted:r,actionBar:o,layout:a="fill"}){const i=a==="fill";return p.jsxs("div",{className:i?"flex h-full min-h-0 flex-col":"flex flex-col",children:[e,t,p.jsxs("div",{className:i?"flex min-h-0 flex-1 flex-col overflow-auto":"flex flex-col","data-testid":"compose-body-area",children:[n,r&&p.jsx("div",{className:"shrink-0 px-3 pb-2",children:r})]}),i?o:p.jsx("div",{className:"sticky bottom-0 z-10 bg-canvas",children:o})]})}const xt=({label:e,onClick:t})=>p.jsx("button",{type:"button",onClick:t,className:"text-xs text-fg-muted hover:text-fg transition-colors",children:e}),eo=({to:e,cc:t,bcc:n,subject:r})=>{const o=[];return e.length>0&&o.push(`To: ${e.map(a=>a.displayName??a.email).join(", ")}`),t.length>0&&o.push(`Cc: ${t.length}`),n.length>0&&o.push(`Bcc: ${n.length}`),r&&o.push(r),o.join(" · ")},to=({collapsed:e=!1,summary:t="",onExpand:n,from:r,to:o,cc:a,bcc:i,subject:c,onShowCc:h,onShowBcc:m})=>e?p.jsxs("button",{type:"button",onClick:n,"aria-label":"Show recipients and subject",className:"flex min-h-11 w-full items-center gap-2 overflow-hidden border-b border-line px-3 py-1.5 text-left transition-colors hover:bg-surface-sunken","data-testid":"compose-header-collapsed",children:[p.jsx("span",{className:"truncate text-xs text-fg-muted",children:t||"…"}),p.jsx(Sn,{className:"ml-auto size-4 shrink-0 text-fg-muted","aria-hidden":"true"})]}):p.jsxs("div",{className:"space-y-1 px-3 py-2 border-b border-line",children:[r,o,a??p.jsxs("div",{className:"flex gap-2 pl-14",children:[p.jsx(xt,{label:"Cc",onClick:h}),p.jsx(xt,{label:"Bcc",onClick:m})]}),a&&!i&&p.jsx("div",{className:"pl-14",children:p.jsx(xt,{label:"Bcc",onClick:m})}),i,c]}),jt="This account can't send mail until SMTP is configured.",no=({onConfigure:e,configureRef:t})=>p.jsxs("div",{role:"alert","data-testid":"compose-smtp-missing-banner",className:"flex items-start gap-3 border-b border-warning/50 bg-warning/10 px-3 py-2",children:[p.jsx(yr,{className:"size-5 shrink-0 mt-0.5 text-warning","aria-hidden":"true"}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("p",{className:"text-sm font-medium text-warning",children:jt}),p.jsxs("button",{ref:t,type:"button",onClick:e,"data-testid":"compose-smtp-configure",className:"mt-1 inline-flex items-center gap-1 text-xs font-medium text-warning hover:underline",children:["Configure SMTP",p.jsx(br,{className:"size-3","aria-hidden":"true"})]})]})]}),ro=({value:e,onChange:t})=>p.jsxs("div",{className:"flex items-start gap-2",children:[p.jsx("label",{className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"Subj:"}),p.jsx("input",{type:"text",value:e,onChange:n=>t(n.target.value),className:"flex-1 px-2 py-1.5 border rounded-md bg-canvas text-sm",placeholder:"Subject","data-subject-field":!0})]}),oo=({text:e,html:t,senderName:n,date:r})=>{const[o,a]=s.useState(!1);if(!e&&!t)return null;const i=[n,r].filter(Boolean).join(" on ");return p.jsxs("div",{className:"mt-2 px-3 pb-2",children:[p.jsxs("button",{type:"button",onClick:()=>a(!o),"aria-expanded":o,className:"flex items-center gap-1 text-xs text-fg-muted hover:text-fg transition-colors",children:[o?p.jsx(Sn,{className:"size-3"}):p.jsx(Er,{className:"size-3"}),i?`${i} wrote:`:"Show quoted text"]}),o&&p.jsx("blockquote",{className:"mt-2 pl-3 border-l-2 border-fg-subtle/30 text-sm text-fg-muted [&_a]:text-accent [&_a]:underline [&_blockquote]:pl-3 [&_blockquote]:border-l-2 [&_blockquote]:border-fg-subtle/30",children:t?p.jsx("div",{dangerouslySetInnerHTML:{__html:t}}):e.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/rich-text-spellcheck-worker-provider-DMI13IjV.js","assets/index-CUDGbjSt.js","assets/index-OWhz0EKb.css","assets/rich-text-spellcheck-provider-J8m9wz6A.js","assets/rich-text-C0KYQjJG.js","assets/confirm-dialog-BZYLusH1.js","assets/useMediaQuery-XxWbPYsI.js","assets/bottom-sheet-BH88Otuk.js","assets/attachment-file-DENdjOom.js","assets/useMessageBodyContent-AsE119jK.js","assets/useSignature-J18jTbi3.js","assets/account-form-helpers-DhckT_PN.js","assets/useDebouncedValue-CgbEHRND.js"])))=>i.map(i=>d[i]);
2
+ import{j as p,X as fr,b as mr,B as Yt,af as pr,f as hr,T as vr,r as s,cc as gr,cd as wr,C as Sn,a3 as yr,ce as br,d as Er,cf as Sr,cg as Wt,bp as xn,ch as he,ci as Cn,cj as xr,n as Cr,a7 as ut,ck as lt,cl as Rr,cm as Dr,t as Tr,s as dt,bl as Ar,m as Or,cn as Rn,aF as Nr,aG as kr,Q as Dn,co as Pr,a5 as Ir,cp as Lr,cq as Mr,bv as St,cr as _r,a8 as jr,bo as Fr,a6 as $r,cs as Br,a4 as S}from"./index-CUDGbjSt.js";import{q as Hr}from"./useMessageBodyContent-AsE119jK.js";import{u as Wr}from"./useSignature-J18jTbi3.js";import{b as Ur}from"./account-form-helpers-DhckT_PN.js";import{u as Vr}from"./useDebouncedValue-CgbEHRND.js";import{u as zr}from"./useMediaQuery-XxWbPYsI.js";const qr=({email:e,displayName:t,onRemove:n,className:r})=>p.jsxs("span",{className:mr("inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-accent-2-soft text-sm max-w-[200px]",r),children:[p.jsx("span",{className:"truncate",children:t||e}),p.jsx("button",{type:"button",onClick:n,className:"shrink-0 p-0.5 rounded-full hover:bg-fg-muted/20 transition-colors","aria-label":`Remove ${e}`,children:p.jsx(fr,{className:"size-3"})})]}),Kr=({save:e})=>e.status==="saving"?p.jsx("output",{className:"animate-pulse text-xs text-fg-muted",children:"Saving..."}):e.status==="saved"?p.jsx("output",{className:"text-xs text-fg-muted",children:"Draft saved"}):e.status==="error"?p.jsx("output",{className:"text-xs text-danger",children:"Save failed"}):e.status==="unsaved"?p.jsx("output",{className:"truncate text-xs text-warning",children:e.reason}):null;function Yr({send:e,onSend:t,onBlocked:n,onDiscard:r,save:o={status:"idle"}}){const a=e.status==="sending",i=e.status==="blocked"?e.reason:void 0;return p.jsxs("div",{className:"flex items-center justify-between border-t border-line px-3 py-2",children:[p.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[p.jsx(Yt,{variant:"primary",size:"md","aria-busy":a,title:i,className:"min-h-11 shrink-0 rounded-full px-4","data-testid":"compose-send",icon:a?p.jsx(pr,{className:"size-4 animate-spin"}):p.jsx(hr,{className:"size-4"}),onClick:()=>{if(!a){if(i!==void 0){n(i);return}t()}},children:"Send"}),p.jsx(Kr,{save:o})]}),p.jsx(Yt,{variant:"ghost",size:"md","aria-busy":a,"aria-label":"Discard",className:"min-h-11 min-w-11 px-2 hover:text-danger",icon:p.jsx(vr,{className:"size-4"}),onClick:()=>{a||r()}})]})}const Gr=["Tab",","],Gt=e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim()),Xr=e=>{const t=e.trim();if(!t)return;const n=t.match(/^(.+?)\s*<([^>]+)>$/);if(n){const r=n[1].trim(),o=n[2].trim();if(Gt(o))return{email:o,displayName:r}}if(Gt(t))return{email:t}},Qr=({label:e,addresses:t,onChange:n,placeholder:r,suggestions:o=[],onQueryChange:a})=>{const[i,c]=s.useState(""),h=s.useRef(null),m=new Set(t.map(d=>d.email.toLowerCase())),l=i.length>=2?o.filter(d=>!m.has(d.email.toLowerCase())):[],u=s.useCallback(d=>{m.has(d.email.toLowerCase())||(n([...t,d]),c(""),a?.(""))},[t,m,n,a]),v=s.useCallback(d=>{n(t.filter((g,A)=>A!==d))},[t,n]),y=s.useCallback(d=>{u(d),h.current?.focus()},[u]),E=s.useCallback(()=>{const d=Xr(i);d&&u(d)},[i,u]),f=gr({count:l.length,acceptKeys:Gr,onAccept:d=>y(l[d])}),b=s.useMemo(()=>l.map(d=>({value:d.email,label:d.displayName??d.email,...d.displayName?{hint:d.email}:{}})),[l]),w=s.useCallback(d=>{if(d.key==="Backspace"&&i===""&&t.length>0){v(t.length-1);return}f.handleKeyDown(d)||(d.key==="Enter"||d.key==="Tab"||d.key===",")&&i.trim()&&(d.preventDefault(),E())},[i,t.length,v,f.handleKeyDown,E]),T=s.useCallback(()=>{setTimeout(()=>{E(),f.dismiss()},150)},[E,f.dismiss]);return p.jsxs("div",{className:"relative","data-address-field":e,children:[p.jsxs("div",{className:"flex items-start gap-2",children:[p.jsxs("label",{htmlFor:`address-field-${e}`,className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:[e,":"]}),p.jsxs("div",{className:"flex-1 flex flex-wrap items-center gap-1 min-h-[36px] px-2 py-1 border rounded-md bg-canvas cursor-text",onClick:()=>h.current?.focus(),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&h.current?.focus()},children:[t.map((d,g)=>p.jsx(qr,{email:d.email,displayName:d.displayName,onRemove:()=>v(g)},d.email)),p.jsx("input",{ref:h,id:`address-field-${e}`,type:"text",value:i,onChange:d=>{f.reopen(),c(d.target.value),a?.(d.target.value)},onKeyDown:w,onBlur:T,placeholder:t.length===0?r:"",className:"flex-1 min-w-[120px] bg-transparent outline-none text-sm py-0.5",autoComplete:"off",...f.comboboxProps})]})]}),f.open&&p.jsx(wr,{id:f.listId,suggestions:b,activeIndex:f.activeIndex,optionId:f.optionId,onPick:d=>{const g=l.find(A=>A.email===d.value);g&&y(g)},onHighlight:f.setActiveIndex,label:`${e} suggestions`,className:"absolute left-12 right-0 z-50 mt-1 max-h-[200px] shadow-lg"})]})},Zr=()=>p.jsxs("div",{"aria-hidden":"true","data-testid":"compose-body-skeleton",className:"min-h-[120px] px-3 py-2",children:[p.jsx("div",{className:"mb-2 h-8 animate-pulse rounded bg-surface-sunken"}),p.jsx("div",{className:"min-h-[80px] animate-pulse rounded bg-surface-sunken/50"})]});function Jr({banner:e,header:t,children:n,quoted:r,actionBar:o,layout:a="fill"}){const i=a==="fill";return p.jsxs("div",{className:i?"flex h-full min-h-0 flex-col":"flex flex-col",children:[e,t,p.jsxs("div",{className:i?"flex min-h-0 flex-1 flex-col overflow-auto":"flex flex-col","data-testid":"compose-body-area",children:[n,r&&p.jsx("div",{className:"shrink-0 px-3 pb-2",children:r})]}),i?o:p.jsx("div",{className:"sticky bottom-0 z-10 bg-canvas",children:o})]})}const xt=({label:e,onClick:t})=>p.jsx("button",{type:"button",onClick:t,className:"text-xs text-fg-muted hover:text-fg transition-colors",children:e}),eo=({to:e,cc:t,bcc:n,subject:r})=>{const o=[];return e.length>0&&o.push(`To: ${e.map(a=>a.displayName??a.email).join(", ")}`),t.length>0&&o.push(`Cc: ${t.length}`),n.length>0&&o.push(`Bcc: ${n.length}`),r&&o.push(r),o.join(" · ")},to=({collapsed:e=!1,summary:t="",onExpand:n,from:r,to:o,cc:a,bcc:i,subject:c,onShowCc:h,onShowBcc:m})=>e?p.jsxs("button",{type:"button",onClick:n,"aria-label":"Show recipients and subject",className:"flex min-h-11 w-full items-center gap-2 overflow-hidden border-b border-line px-3 py-1.5 text-left transition-colors hover:bg-surface-sunken","data-testid":"compose-header-collapsed",children:[p.jsx("span",{className:"truncate text-xs text-fg-muted",children:t||"…"}),p.jsx(Sn,{className:"ml-auto size-4 shrink-0 text-fg-muted","aria-hidden":"true"})]}):p.jsxs("div",{className:"space-y-1 px-3 py-2 border-b border-line",children:[r,o,a??p.jsxs("div",{className:"flex gap-2 pl-14",children:[p.jsx(xt,{label:"Cc",onClick:h}),p.jsx(xt,{label:"Bcc",onClick:m})]}),a&&!i&&p.jsx("div",{className:"pl-14",children:p.jsx(xt,{label:"Bcc",onClick:m})}),i,c]}),jt="This account can't send mail until SMTP is configured.",no=({onConfigure:e,configureRef:t})=>p.jsxs("div",{role:"alert","data-testid":"compose-smtp-missing-banner",className:"flex items-start gap-3 border-b border-warning/50 bg-warning/10 px-3 py-2",children:[p.jsx(yr,{className:"size-5 shrink-0 mt-0.5 text-warning","aria-hidden":"true"}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("p",{className:"text-sm font-medium text-warning",children:jt}),p.jsxs("button",{ref:t,type:"button",onClick:e,"data-testid":"compose-smtp-configure",className:"mt-1 inline-flex items-center gap-1 text-xs font-medium text-warning hover:underline",children:["Configure SMTP",p.jsx(br,{className:"size-3","aria-hidden":"true"})]})]})]}),ro=({value:e,onChange:t})=>p.jsxs("div",{className:"flex items-start gap-2",children:[p.jsx("label",{className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"Subj:"}),p.jsx("input",{type:"text",value:e,onChange:n=>t(n.target.value),className:"flex-1 px-2 py-1.5 border rounded-md bg-canvas text-sm",placeholder:"Subject","data-subject-field":!0})]}),oo=({text:e,html:t,senderName:n,date:r})=>{const[o,a]=s.useState(!1);if(!e&&!t)return null;const i=[n,r].filter(Boolean).join(" on ");return p.jsxs("div",{className:"mt-2 px-3 pb-2",children:[p.jsxs("button",{type:"button",onClick:()=>a(!o),"aria-expanded":o,className:"flex items-center gap-1 text-xs text-fg-muted hover:text-fg transition-colors",children:[o?p.jsx(Sn,{className:"size-3"}):p.jsx(Er,{className:"size-3"}),i?`${i} wrote:`:"Show quoted text"]}),o&&p.jsx("blockquote",{className:"mt-2 pl-3 border-l-2 border-fg-subtle/30 text-sm text-fg-muted [&_a]:text-accent [&_a]:underline [&_blockquote]:pl-3 [&_blockquote]:border-l-2 [&_blockquote]:border-fg-subtle/30",children:t?p.jsx("div",{dangerouslySetInnerHTML:{__html:t}}):e.split(`
3
3
  `).map((c,h)=>p.jsx("p",{className:"min-h-[1.2em]",children:c},h))})]})},ao=["p","br","div","h1","h2","h3","h4","h5","h6","strong","b","em","i","u","s","ul","ol","li","blockquote","pre","code","hr","table","thead","tbody","tr","th","td","a","img"],so=["href","src","alt","colspan","rowspan","lang","dir"],io=/^(?:https?:|mailto:)/i,co=/^(?:https:|data:image\/)/i,uo="max-width:100%;height:auto",lo=e=>{const t=Sr();if(!t.isSupported)throw new Error("adopted HTML cannot be sanitized: no DOM is available");return t.addHook("afterSanitizeAttributes",n=>{if(n.tagName==="A"){io.test(n.getAttribute("href")??"")||n.removeAttribute("href"),e==="quoted"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer nofollow"));return}if(n.tagName==="IMG"){if(e==="quoted"){n.remove();return}if(!co.test(n.getAttribute("src")??"")){n.remove();return}n.setAttribute("style",uo)}}),t},Xt=new Map,fo=e=>{const t=Xt.get(e);if(t)return t;const n=lo(e);return Xt.set(e,n),n},Tn=(e,t)=>fo(t).sanitize(e,{ALLOWED_TAGS:ao,ALLOWED_ATTR:so,ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1}),ti=e=>Tn(e,"outgoing"),mo=e=>Tn(e,"quoted"),po=e=>typeof e=="string"&&e.length>0?"rich":"plain",ni=(e,t)=>t.length>0,ho={plain:"Couldn't switch to plain text",rich:"Couldn't switch to rich text"},ri=(e,t,n)=>t.trim()===""||n.trim()!==""?{outcome:"switch"}:{outcome:"blocked",title:ho[e],detail:"The conversion came back empty, so your message is unchanged."};function ve(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o||!o.defaultPrevented)return t?.(o)}}function Qt(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function vo(...e){return t=>{let n=!1;const r=e.map(o=>{const a=Qt(o,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let o=0;o<r.length;o++){const a=r[o];typeof a=="function"?a():Qt(e[o],null)}}}}function xe(...e){return s.useCallback(vo(...e),e)}function go(e,t=[]){let n=[];function r(a,i){const c=s.createContext(i);c.displayName=a+"Context";const h=n.length;n=[...n,i];const m=u=>{const{scope:v,children:y,...E}=u,f=v?.[e]?.[h]||c,b=s.useMemo(()=>E,Object.values(E));return p.jsx(f.Provider,{value:b,children:y})};m.displayName=a+"Provider";function l(u,v,y={}){const{optional:E=!1}=y,f=v?.[e]?.[h]||c,b=s.useContext(f);if(b)return b;if(i!==void 0)return i;if(!E)throw new Error(`\`${u}\` must be used within \`${a}\``)}return[m,l]}const o=()=>{const a=n.map(i=>s.createContext(i));return function(c){const h=c?.[e]||a;return s.useMemo(()=>({[`__scope${e}`]:{...c,[e]:h}}),[c,h])}};return o.scopeName=e,[r,wo(o,...t)]}function wo(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const i=r.reduce((c,{useScope:h,scopeName:m})=>{const u=h(a)[`__scope${m}`];return{...c,...u}},{});return s.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var He=globalThis?.document?s.useLayoutEffect:()=>{},yo=Wt[" useInsertionEffect ".trim().toString()]||He;function bo({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,a,i]=Eo({defaultProp:t,onChange:n}),c=e!==void 0,h=c?e:o;{const l=s.useRef(e!==void 0);s.useEffect(()=>{const u=l.current;u!==c&&console.warn(`${r} is changing from ${u?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),l.current=c},[c,r])}const m=s.useCallback(l=>{if(c){const u=So(l)?l(e):l;u!==e&&i.current?.(u)}else a(l)},[c,e,a,i]);return[h,m]}function Eo({defaultProp:e,onChange:t}){const[n,r]=s.useState(e),o=s.useRef(n),a=s.useRef(t);return yo(()=>{a.current=t},[t]),s.useEffect(()=>{o.current!==n&&(a.current?.(n),o.current=n)},[n,o]),[n,r,a]}function So(e){return typeof e=="function"}function An(e){const t=s.forwardRef((n,r)=>{let{children:o,...a}=n,i=null,c=!1;const h=[];Zt(o)&&typeof Je=="function"&&(o=Je(o._payload)),s.Children.forEach(o,v=>{if(To(v)){c=!0;const y=v;let E="child"in y.props?y.props.child:y.props.children;Zt(E)&&typeof Je=="function"&&(E=Je(E._payload)),i=Co(y,E),h.push(i?.props?.children)}else h.push(v)}),i?i=s.cloneElement(i,void 0,h):!c&&s.Children.count(o)===1&&s.isValidElement(o)&&(i=o);const m=i?Do(i):void 0,l=xe(r,m);if(!i){if(o||o===0)throw new Error(c?ko(e):No(e));return o}const u=Ro(a,i.props??{});return i.type!==s.Fragment&&(u.ref=r?l:m),s.cloneElement(i,u)});return t.displayName=`${e}.Slot`,t}var xo=Symbol.for("radix.slottable"),Co=(e,t)=>{if("child"in e.props){const n=e.props.child;return s.isValidElement(n)?s.cloneElement(n,void 0,e.props.children(n.props.children)):null}return s.isValidElement(t)?t:null};function Ro(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...c)=>{const h=a(...c);return o(...c),h}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}function Do(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function To(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===xo}var Ao=Symbol.for("react.lazy");function Zt(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Ao&&"_payload"in e&&Oo(e._payload)}function Oo(e){return typeof e=="object"&&e!==null&&"then"in e}var No=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,ko=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Je=Wt[" use ".trim().toString()],Po=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],le=Po.reduce((e,t)=>{const n=An(`Primitive.${t}`),r=s.forwardRef((o,a)=>{const{asChild:i,...c}=o,h=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(h,{...c,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Io(e,t){e&&xn.flushSync(()=>e.dispatchEvent(t))}function We(e){const t=s.useRef(e);return s.useEffect(()=>{t.current=e}),s.useMemo(()=>((...n)=>t.current?.(...n)),[])}var Lo="DismissableLayer",Ft="dismissableLayer.update",Mo="dismissableLayer.pointerDownOutside",_o="dismissableLayer.focusOutside",Jt,Ut=s.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),On=s.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:c,onDismiss:h,...m}=e,l=s.useContext(Ut),[u,v]=s.useState(null),y=u?.ownerDocument??globalThis?.document,[,E]=s.useState({}),f=xe(t,v),b=Array.from(l.layers),[w]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),T=w?b.indexOf(w):-1,d=u?b.indexOf(u):-1,g=l.layersWithOutsidePointerEventsDisabled.size>0,A=d>=T,I=s.useRef(!1),C=Ho(N=>{a?.(N),c?.(N),N.defaultPrevented||h?.()},{ownerDocument:y,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:I,dismissableSurfaces:l.dismissableSurfaces,shouldHandlePointerDownOutside:s.useCallback(N=>{if(!(N instanceof Node))return!1;const H=[...l.branches].some(R=>R.contains(N));return A&&!H},[l.branches,A])}),P=Wo(N=>{if(r&&I.current)return;const H=N.target;[...l.branches].some(U=>U.contains(H))||(i?.(N),c?.(N),N.defaultPrevented||h?.())},y),k=u?d===b.length-1:!1,F=We(N=>{N.key==="Escape"&&(o?.(N),!N.defaultPrevented&&h&&(N.preventDefault(),h()))});return s.useEffect(()=>{if(k)return y.addEventListener("keydown",F,{capture:!0}),()=>y.removeEventListener("keydown",F,{capture:!0})},[y,k,F]),s.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Jt=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),en(),()=>{n&&(l.layersWithOutsidePointerEventsDisabled.delete(u),l.layersWithOutsidePointerEventsDisabled.size===0&&(y.body.style.pointerEvents=Jt))}},[u,y,n,l]),s.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),en())},[u,l]),s.useEffect(()=>{const N=()=>E({});return document.addEventListener(Ft,N),()=>document.removeEventListener(Ft,N)},[]),p.jsx(le.div,{...m,ref:f,style:{pointerEvents:g?A?"auto":"none":void 0,...e.style},onFocusCapture:ve(e.onFocusCapture,P.onFocusCapture),onBlurCapture:ve(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:ve(e.onPointerDownCapture,C.onPointerDownCapture)})});On.displayName=Lo;var jo="DismissableLayerBranch",Fo=s.forwardRef((e,t)=>{const n=s.useContext(Ut),r=s.useRef(null),o=xe(t,r);return s.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),p.jsx(le.div,{...e,ref:o})});Fo.displayName=jo;function $o(){const e=s.useContext(Ut),[t,n]=s.useState(null);return s.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}var Bo=()=>!0;function Ho(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:a,shouldHandlePointerDownOutside:i=Bo}=t,c=We(e),h=s.useRef(!1),m=s.useRef(!1),l=s.useRef(new Map),u=s.useRef(()=>{});return s.useEffect(()=>{function v(){m.current=!1,o.current=!1,l.current.clear()}function y(){return Array.from(l.current.values()).some(Boolean)}function E(d){if(!m.current)return;const g=d.target;g instanceof Node&&[...a].some(I=>I.contains(g))||l.current.set(d.type,!0),d.type==="click"&&window.setTimeout(()=>{m.current&&u.current()},0)}function f(d){m.current&&l.current.set(d.type,!1)}const b=d=>{if(d.target&&!h.current){let g=function(){n.removeEventListener("click",u.current);const I=y();v(),I||Nn(Mo,c,A,{discrete:!0})};if(!i(d.target)){n.removeEventListener("click",u.current),v(),h.current=!1;return}const A={originalEvent:d};m.current=!0,o.current=r&&d.button===0,l.current.clear(),!r||d.button!==0?g():(n.removeEventListener("click",u.current),u.current=g,n.addEventListener("click",u.current,{once:!0}))}else n.removeEventListener("click",u.current),v();h.current=!1},w=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const d of w)n.addEventListener(d,E,!0),n.addEventListener(d,f);const T=window.setTimeout(()=>{n.addEventListener("pointerdown",b)},0);return()=>{window.clearTimeout(T),n.removeEventListener("pointerdown",b),n.removeEventListener("click",u.current);for(const d of w)n.removeEventListener(d,E,!0),n.removeEventListener(d,f)}},[n,c,r,o,a,i]),{onPointerDownCapture:()=>h.current=!0}}function Wo(e,t=globalThis?.document){const n=We(e),r=s.useRef(!1);return s.useEffect(()=>{const o=a=>{a.target&&!r.current&&Nn(_o,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function en(){const e=new CustomEvent(Ft);document.dispatchEvent(e)}function Nn(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Io(o,a):o.dispatchEvent(a)}var et=0,De=null;function Uo(){s.useEffect(()=>{De||(De={start:tn(),end:tn()});const{start:e,end:t}=De;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),et++,()=>{et===1&&(De?.start.remove(),De?.end.remove(),De=null),et=Math.max(0,et-1)}},[])}function tn(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Ct="focusScope.autoFocusOnMount",Rt="focusScope.autoFocusOnUnmount",nn={bubbles:!1,cancelable:!0},Vo="FocusScope",kn=s.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...i}=e,[c,h]=s.useState(null),m=We(o),l=We(a),u=s.useRef(null),v=xe(t,h),y=s.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;s.useEffect(()=>{if(r){let f=function(d){if(y.paused||!c)return;const g=d.target;c.contains(g)?u.current=g:pe(u.current,{select:!0})},b=function(d){if(y.paused||!c)return;const g=d.relatedTarget;g!==null&&(c.contains(g)||pe(u.current,{select:!0}))},w=function(d){if(document.activeElement===document.body)for(const A of d)A.removedNodes.length>0&&pe(c)};document.addEventListener("focusin",f),document.addEventListener("focusout",b);const T=new MutationObserver(w);return c&&T.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",b),T.disconnect()}}},[r,c,y.paused]),s.useEffect(()=>{if(c){on.add(y);const f=document.activeElement;if(!c.contains(f)){const w=new CustomEvent(Ct,nn);c.addEventListener(Ct,m),c.dispatchEvent(w),w.defaultPrevented||(zo(Xo(Pn(c)),{select:!0}),document.activeElement===f&&pe(c))}return()=>{c.removeEventListener(Ct,m),setTimeout(()=>{const w=new CustomEvent(Rt,nn);c.addEventListener(Rt,l),c.dispatchEvent(w),w.defaultPrevented||pe(f??document.body,{select:!0}),c.removeEventListener(Rt,l),on.remove(y)},0)}}},[c,m,l,y]);const E=s.useCallback(f=>{if(!n&&!r||y.paused)return;const b=f.key==="Tab"&&!f.altKey&&!f.ctrlKey&&!f.metaKey,w=document.activeElement;if(b&&w){const T=f.currentTarget,[d,g]=qo(T);d&&g?!f.shiftKey&&w===g?(f.preventDefault(),n&&pe(d,{select:!0})):f.shiftKey&&w===d&&(f.preventDefault(),n&&pe(g,{select:!0})):w===T&&f.preventDefault()}},[n,r,y.paused]);return p.jsx(le.div,{tabIndex:-1,...i,ref:v,onKeyDown:E})});kn.displayName=Vo;function zo(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(pe(r,{select:t}),document.activeElement!==n)return}function qo(e){const t=Pn(e),n=rn(t,e),r=rn(t.reverse(),e);return[n,r]}function Pn(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function rn(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Ko(r,{upTo:t})))return r}function Ko(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Yo(e){return e instanceof HTMLInputElement&&"select"in e}function pe(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Yo(e)&&t&&e.select()}}var on=Go();function Go(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=an(e,t),e.unshift(t)},remove(t){e=an(e,t),e[0]?.resume()}}}function an(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Xo(e){return e.filter(t=>t.tagName!=="A")}var Qo=Wt[" useId ".trim().toString()]||(()=>{}),Zo=0;function Dt(e){const[t,n]=s.useState(Qo());return He(()=>{n(r=>r??String(Zo++))},[e]),e||(t?`radix-${t}`:"")}var Jo="Portal",In=s.forwardRef((e,t)=>{const{container:n,...r}=e,[o,a]=s.useState(!1);He(()=>a(!0),[]);const i=n||o&&globalThis?.document?.body;return i?xn.createPortal(p.jsx(le.div,{...r,ref:t}),i):null});In.displayName=Jo;function ea(e,t){return s.useReducer((n,r)=>t[n][r]??n,e)}var mt=e=>{const{present:t,children:n}=e,r=ta(t),o=typeof n=="function"?n({present:r.isPresent}):s.Children.only(n),a=na(r.ref,ra(o));return typeof n=="function"||r.isPresent?s.cloneElement(o,{ref:a}):null};mt.displayName="Presence";function ta(e){const[t,n]=s.useState(),r=s.useRef(null),o=s.useRef(e),a=s.useRef("none"),i=s.useRef(void 0),c=e?"mounted":"unmounted",[h,m]=ea(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return s.useEffect(()=>{h==="mounted"?(a.current=i.current??Fe(r.current),i.current=void 0):a.current="none"},[h]),He(()=>{const l=r.current,u=o.current;if(u!==e){const y=a.current,E=Fe(l);e?(i.current=E,m("MOUNT")):E==="none"||l?.display==="none"?m("UNMOUNT"):m(u&&y!==E?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,m]),He(()=>{if(t){let l;const u=t.ownerDocument.defaultView??window,v=E=>{const b=Fe(r.current).includes(CSS.escape(E.animationName));if(E.target===t&&b&&(m("ANIMATION_END"),!o.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",l=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},y=E=>{E.target===t&&(a.current=Fe(r.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",v),t.addEventListener("animationend",v),()=>{u.clearTimeout(l),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",v),t.removeEventListener("animationend",v)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(h),ref:s.useCallback(l=>{if(l){const u=getComputedStyle(l);r.current=u,i.current=Fe(u)}else r.current=null;n(l)},[])}}function sn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function na(...e){const t=s.useRef(e);return t.current=e,s.useCallback(n=>{const r=t.current;let o=!1;const a=r.map(i=>{const c=sn(i,n);return!o&&typeof c=="function"&&(o=!0),c});if(o)return()=>{for(let i=0;i<a.length;i++){const c=a[i];typeof c=="function"?c():sn(r[i],null)}}},[])}function Fe(e){return e?.animationName||"none"}function ra(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var oa=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Te=new WeakMap,tt=new WeakMap,nt={},Tt=0,Ln=function(e){return e&&(e.host||Ln(e.parentNode))},aa=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Ln(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},sa=function(e,t,n,r){var o=aa(t,Array.isArray(e)?e:[e]);nt[n]||(nt[n]=new WeakMap);var a=nt[n],i=[],c=new Set,h=new Set(o),m=function(u){!u||c.has(u)||(c.add(u),m(u.parentNode))};o.forEach(m);var l=function(u){!u||h.has(u)||Array.prototype.forEach.call(u.children,function(v){if(c.has(v))l(v);else try{var y=v.getAttribute(r),E=y!==null&&y!=="false",f=(Te.get(v)||0)+1,b=(a.get(v)||0)+1;Te.set(v,f),a.set(v,b),i.push(v),f===1&&E&&tt.set(v,!0),b===1&&v.setAttribute(n,"true"),E||v.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",v,w)}})};return l(t),c.clear(),Tt++,function(){i.forEach(function(u){var v=Te.get(u)-1,y=a.get(u)-1;Te.set(u,v),a.set(u,y),v||(tt.has(u)||u.removeAttribute(r),tt.delete(u)),y||u.removeAttribute(n)}),Tt--,Tt||(Te=new WeakMap,Te=new WeakMap,tt=new WeakMap,nt={})}},ia=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=oa(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),sa(r,o,n,"aria-hidden")):function(){return null}},it="right-scroll-bar-position",ct="width-before-scroll-bar",ca="with-scroll-bars-hidden",ua="--removed-body-scroll-bar-size";function At(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function la(e,t){var n=s.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var da=typeof window<"u"?s.useLayoutEffect:s.useEffect,cn=new WeakMap;function fa(e,t){var n=la(null,function(r){return e.forEach(function(o){return At(o,r)})});return da(function(){var r=cn.get(n);if(r){var o=new Set(r),a=new Set(e),i=n.current;o.forEach(function(c){a.has(c)||At(c,null)}),a.forEach(function(c){o.has(c)||At(c,i)})}cn.set(n,e)},[e]),n}function ma(e){return e}function pa(e,t){t===void 0&&(t=ma);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var i=t(a,r);return n.push(i),function(){n=n.filter(function(c){return c!==i})}},assignSyncMedium:function(a){for(r=!0;n.length;){var i=n;n=[],i.forEach(a)}n={push:function(c){return a(c)},filter:function(){return n}}},assignMedium:function(a){r=!0;var i=[];if(n.length){var c=n;n=[],c.forEach(a),i=n}var h=function(){var l=i;i=[],l.forEach(a)},m=function(){return Promise.resolve().then(h)};m(),n={push:function(l){i.push(l),m()},filter:function(l){return i=i.filter(l),n}}}};return o}function ha(e){e===void 0&&(e={});var t=pa(null);return t.options=he({async:!0,ssr:!1},e),t}var Mn=function(e){var t=e.sideCar,n=Cn(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return s.createElement(r,he({},n))};Mn.isSideCarExport=!0;function va(e,t){return e.useMedium(t),Mn}var _n=ha(),Ot=function(){},pt=s.forwardRef(function(e,t){var n=s.useRef(null),r=s.useState({onScrollCapture:Ot,onWheelCapture:Ot,onTouchMoveCapture:Ot}),o=r[0],a=r[1],i=e.forwardProps,c=e.children,h=e.className,m=e.removeScrollBar,l=e.enabled,u=e.shards,v=e.sideCar,y=e.noRelative,E=e.noIsolation,f=e.inert,b=e.allowPinchZoom,w=e.as,T=w===void 0?"div":w,d=e.gapMode,g=Cn(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),A=v,I=fa([n,t]),C=he(he({},g),o);return s.createElement(s.Fragment,null,l&&s.createElement(A,{sideCar:_n,removeScrollBar:m,shards:u,noRelative:y,noIsolation:E,inert:f,setCallbacks:a,allowPinchZoom:!!b,lockRef:n,gapMode:d}),i?s.cloneElement(s.Children.only(c),he(he({},C),{ref:I})):s.createElement(T,he({},C,{className:h,ref:I}),c))});pt.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};pt.classNames={fullWidth:ct,zeroRight:it};var ga=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function wa(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=ga();return t&&e.setAttribute("nonce",t),e}function ya(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ba(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Ea=function(){var e=0,t=null;return{add:function(n){e==0&&(t=wa())&&(ya(t,n),ba(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Sa=function(){var e=Ea();return function(t,n){s.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},jn=function(){var e=Sa(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},xa={left:0,top:0,right:0,gap:0},Nt=function(e){return parseInt(e||"",10)||0},Ca=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Nt(n),Nt(r),Nt(o)]},Ra=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return xa;var t=Ca(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Da=jn(),Ne="data-scroll-locked",Ta=function(e,t,n,r){var o=e.left,a=e.top,i=e.right,c=e.gap;return n===void 0&&(n="margin"),`
4
4
  .`.concat(ca,` {
5
5
  overflow: hidden `).concat(r,`;
@@ -40,7 +40,7 @@ import{j as p,X as fr,b as mr,B as Yt,af as pr,f as hr,T as vr,r as s,cc as gr,c
40
40
  `)},un=function(){var e=parseInt(document.body.getAttribute(Ne)||"0",10);return isFinite(e)?e:0},Aa=function(){s.useEffect(function(){return document.body.setAttribute(Ne,(un()+1).toString()),function(){var e=un()-1;e<=0?document.body.removeAttribute(Ne):document.body.setAttribute(Ne,e.toString())}},[])},Oa=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;Aa();var a=s.useMemo(function(){return Ra(o)},[o]);return s.createElement(Da,{styles:Ta(a,!t,o,n?"":"!important")})},$t=!1;if(typeof window<"u")try{var rt=Object.defineProperty({},"passive",{get:function(){return $t=!0,!0}});window.addEventListener("test",rt,rt),window.removeEventListener("test",rt,rt)}catch{$t=!1}var Ae=$t?{passive:!1}:!1,Na=function(e){return e.tagName==="TEXTAREA"},Fn=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Na(e)&&n[t]==="visible")},ka=function(e){return Fn(e,"overflowY")},Pa=function(e){return Fn(e,"overflowX")},ln=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=$n(e,r);if(o){var a=Bn(e,r),i=a[1],c=a[2];if(i>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ia=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},La=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},$n=function(e,t){return e==="v"?ka(t):Pa(t)},Bn=function(e,t){return e==="v"?Ia(t):La(t)},Ma=function(e,t){return e==="h"&&t==="rtl"?-1:1},_a=function(e,t,n,r,o){var a=Ma(e,window.getComputedStyle(t).direction),i=a*r,c=n.target,h=t.contains(c),m=!1,l=i>0,u=0,v=0;do{if(!c)break;var y=Bn(e,c),E=y[0],f=y[1],b=y[2],w=f-b-a*E;(E||w)&&$n(e,c)&&(u+=w,v+=E);var T=c.parentNode;c=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!h&&c!==document.body||h&&(t.contains(c)||t===c));return(l&&Math.abs(u)<1||!l&&Math.abs(v)<1)&&(m=!0),m},ot=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},dn=function(e){return[e.deltaX,e.deltaY]},fn=function(e){return e&&"current"in e?e.current:e},ja=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Fa=function(e){return`
41
41
  .block-interactivity-`.concat(e,` {pointer-events: none;}
42
42
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
43
- `)},$a=0,Oe=[];function Ba(e){var t=s.useRef([]),n=s.useRef([0,0]),r=s.useRef(),o=s.useState($a++)[0],a=s.useState(jn)[0],i=s.useRef(e);s.useEffect(function(){i.current=e},[e]),s.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var f=xr([e.lockRef.current],(e.shards||[]).map(fn),!0).filter(Boolean);return f.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),f.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=s.useCallback(function(f,b){if("touches"in f&&f.touches.length===2||f.type==="wheel"&&f.ctrlKey)return!i.current.allowPinchZoom;var w=ot(f),T=n.current,d="deltaX"in f?f.deltaX:T[0]-w[0],g="deltaY"in f?f.deltaY:T[1]-w[1],A,I=f.target,C=Math.abs(d)>Math.abs(g)?"h":"v";if("touches"in f&&C==="h"&&I.type==="range")return!1;var P=window.getSelection(),k=P&&P.anchorNode,F=k?k===I||k.contains(I):!1;if(F)return!1;var N=ln(C,I);if(!N)return!0;if(N?A=C:(A=C==="v"?"h":"v",N=ln(C,I)),!N)return!1;if(!r.current&&"changedTouches"in f&&(d||g)&&(r.current=A),!A)return!0;var H=r.current||A;return _a(H,b,f,H==="h"?d:g)},[]),h=s.useCallback(function(f){var b=f;if(!(!Oe.length||Oe[Oe.length-1]!==a)){var w="deltaY"in b?dn(b):ot(b),T=t.current.filter(function(A){return A.name===b.type&&(A.target===b.target||b.target===A.shadowParent)&&ja(A.delta,w)})[0];if(T&&T.should){b.cancelable&&b.preventDefault();return}if(!T){var d=(i.current.shards||[]).map(fn).filter(Boolean).filter(function(A){return A.contains(b.target)}),g=d.length>0?c(b,d[0]):!i.current.noIsolation;g&&b.cancelable&&b.preventDefault()}}},[]),m=s.useCallback(function(f,b,w,T){var d={name:f,delta:b,target:w,should:T,shadowParent:Ha(w)};t.current.push(d),setTimeout(function(){t.current=t.current.filter(function(g){return g!==d})},1)},[]),l=s.useCallback(function(f){n.current=ot(f),r.current=void 0},[]),u=s.useCallback(function(f){m(f.type,dn(f),f.target,c(f,e.lockRef.current))},[]),v=s.useCallback(function(f){m(f.type,ot(f),f.target,c(f,e.lockRef.current))},[]);s.useEffect(function(){return Oe.push(a),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:v}),document.addEventListener("wheel",h,Ae),document.addEventListener("touchmove",h,Ae),document.addEventListener("touchstart",l,Ae),function(){Oe=Oe.filter(function(f){return f!==a}),document.removeEventListener("wheel",h,Ae),document.removeEventListener("touchmove",h,Ae),document.removeEventListener("touchstart",l,Ae)}},[]);var y=e.removeScrollBar,E=e.inert;return s.createElement(s.Fragment,null,E?s.createElement(a,{styles:Fa(o)}):null,y?s.createElement(Oa,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Ha(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Wa=va(_n,Ba);var Hn=s.forwardRef(function(e,t){return s.createElement(pt,he({},e,{ref:t,sideCar:Wa}))});Hn.classNames=pt.classNames;const oi=({enabled:e=!0,bindings:t,capture:n=!1})=>{const r=s.useCallback(o=>{const a=o.target;if(!(a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.isContentEditable))for(const i of t){if(!(o.key.toLowerCase()===i.key.toLowerCase())||i.requireShift!==void 0&&i.requireShift!==o.shiftKey)continue;const h=o.ctrlKey||o.metaKey;if(i.requireMeta!==void 0){if(i.requireMeta!==h)continue}else{const m=i.noModifiers??!0,l=h||o.altKey||i.requireShift===void 0&&o.shiftKey;if(m&&l)continue}i.preventDefault&&o.preventDefault(),i.stopPropagation&&(o.stopPropagation(),o.stopImmediatePropagation()),i.handler(o);return}},[t]);s.useEffect(()=>{if(e)return window.addEventListener("keydown",r,n),()=>window.removeEventListener("keydown",r,n)},[e,r,n])},Ua=(e,t)=>e===void 0&&t.toAddresses.length===0,Va={status:"unsaved",reason:"Not saved — add a To address to keep this draft."},mn={status:"idle"},za={status:"saving"},pn={status:"saved"},hn={status:"error"},qa=e=>e.then(()=>{},()=>{}),Ka=({outboxMessageId:e,onDraftCreated:t})=>{const[n,r]=s.useState(mn),[o,a]=s.useState(null),i=s.useRef(void 0),c=s.useRef(new Set),h=Cr(),m=s.useRef(e),l=s.useRef(e);if(m.current!==e){const d=m.current!==void 0;m.current=e,l.current=e,d&&i.current&&clearTimeout(i.current)}const u=ut({...Rr(),meta:lt}),v=ut({...Dr(),meta:lt}),y=s.useCallback(async d=>{r(za),a(null);const g=l.current;if(g){const I=await v.mutateAsync({path:{outboxMessageId:g},body:{toAddresses:d.toAddresses,ccAddresses:d.ccAddresses,bccAddresses:d.bccAddresses,subject:d.subject,textBody:d.textBody,htmlBody:d.htmlBody,inReplyTo:d.inReplyTo,references:d.references}});return r(pn),I}const A=await u.mutateAsync({body:{...d,sendImmediately:!1}});return l.current=A.outboxMessageId,t(A.outboxMessageId),r(pn),h.invalidateQueries({queryKey:Tr().queryKey}),A},[u.mutateAsync,v.mutateAsync,t,h]),E=s.useRef(Promise.resolve()),f=s.useCallback(d=>{const g=E.current.then(()=>y(d));return E.current=qa(g),g},[y]),b=s.useCallback(d=>{if(i.current&&clearTimeout(i.current),Ua(l.current,d)){r(Va);return}r(g=>g.status==="unsaved"?mn:g),i.current=setTimeout(()=>{const g=l.current;g&&c.current.has(g)||f(d).catch(A=>{a(A),r(hn)})},2e3)},[f]),w=s.useCallback(d=>(i.current&&clearTimeout(i.current),f(d).then(g=>({outcome:"saved",outboxMessageId:g.outboxMessageId})).catch(g=>(r(hn),{outcome:"failed",error:g}))),[f]),T=s.useCallback(d=>{i.current&&clearTimeout(i.current),d&&c.current.add(d)},[]);return{saveState:n,saveError:o,saveDraft:b,saveImmediately:w,stopAutoSave:T}},Ya=e=>e.outboundCount>0||e.replyCount>0||e.flags?.vip?.value===!0||e.flags?.trusted?.value===!0,Ga=e=>e.flags?.blocked?.value===!0?!1:e.flags?.junkOnly?.value!==!0?!0:Ya(e),kt=({label:e,addresses:t,onChange:n,placeholder:r})=>{const[o,a]=s.useState(""),i=Vr(o,200),{data:c}=dt({...Ar({query:{q:i,limit:8}}),enabled:i.length>=2}),h=s.useMemo(()=>(c?.items??[]).filter(Ga).map(m=>({email:m.normalizedEmail,displayName:m.displayName})),[c]);return p.jsx(Qr,{label:e,addresses:t,onChange:n,placeholder:r,suggestions:h,onQueryChange:a})},Xa=({accountId:e,configureRef:t})=>{const n=Or();return p.jsx(no,{configureRef:t,onConfigure:()=>{n({to:"/settings/accounts",search:{editAccountId:e,focusSmtp:!0}})}})},Qa={download:"its dictionary could not be downloaded",engine:"the checker could not start",worker:"the checker stopped running"},Za=e=>{const t=`Spellcheck for ${e.language} is off: ${Qa[e.reason]}.`;return{severity:"warning",title:"Spellcheck stopped",detail:`${t} Your browser is checking this message instead. ${e.detail}`,action:{label:"Report this",href:Nr(kr({title:`Spellcheck stopped: ${e.reason} (${e.language})`,errorMessage:`${t} ${e.detail}`}))}}},Ja=e=>({provider:async t=>{const{openSpellcheckWorker:n}=await Rn(async()=>{const{openSpellcheckWorker:r}=await import("./rich-text-spellcheck-worker-provider-B1n5ttte.js");return{openSpellcheckWorker:r}},__vite__mapDeps([0,1,2,3]));return n(t)},onStatus:t=>{t.state==="failed"&&e(Za(t))}}),vn=150,es=()=>{const[e,t]=s.useState(()=>{if(typeof window>"u"||!window.visualViewport)return{viewportHeight:0,isKeyboardOpen:!1};const n=window.visualViewport.height;return{viewportHeight:n,isKeyboardOpen:window.innerHeight-n>vn}});return s.useEffect(()=>{if(typeof window>"u"||!window.visualViewport)return;const n=window.visualViewport,r=()=>{const o=n.height;t({viewportHeight:o,isKeyboardOpen:window.innerHeight-o>vn})};return r(),n.addEventListener("resize",r),()=>n.removeEventListener("resize",r)},[]),e},ts=({selectedAccountId:e,onSelect:t})=>{const{data:n}=dt({...Dn(),staleTime:1/0}),r=n?.accounts??[];if(s.useEffect(()=>{!e&&r.length===1&&r[0]&&t(r[0])},[e,r,t]),r.length<=1){const o=r[0];return o?p.jsxs("div",{className:"flex items-start gap-2",children:[p.jsx("label",{className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"From:"}),p.jsx("div",{className:"text-sm py-1.5",children:o.email})]}):null}return p.jsxs("div",{className:"flex items-start gap-2",children:[p.jsx("label",{htmlFor:"from-account-selector",className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"From:"}),p.jsx("select",{id:"from-account-selector",value:e??"",onChange:o=>{const a=r.find(i=>i.accountId===o.target.value);a&&t(a)},className:"flex-1 px-2 py-1.5 border rounded-md bg-canvas text-sm",children:r.map(o=>p.jsx("option",{value:o.accountId,children:o.email},o.accountId))})]})},ns=s.lazy(()=>Rn(()=>import("./rich-text-DltXKh-H.js"),__vite__mapDeps([4,1,2,5,6,7,8,3,9,10,11,12])).then(e=>({default:e.ComposeBody}))),rs=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),os=e=>e.split(`
43
+ `)},$a=0,Oe=[];function Ba(e){var t=s.useRef([]),n=s.useRef([0,0]),r=s.useRef(),o=s.useState($a++)[0],a=s.useState(jn)[0],i=s.useRef(e);s.useEffect(function(){i.current=e},[e]),s.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var f=xr([e.lockRef.current],(e.shards||[]).map(fn),!0).filter(Boolean);return f.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),f.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=s.useCallback(function(f,b){if("touches"in f&&f.touches.length===2||f.type==="wheel"&&f.ctrlKey)return!i.current.allowPinchZoom;var w=ot(f),T=n.current,d="deltaX"in f?f.deltaX:T[0]-w[0],g="deltaY"in f?f.deltaY:T[1]-w[1],A,I=f.target,C=Math.abs(d)>Math.abs(g)?"h":"v";if("touches"in f&&C==="h"&&I.type==="range")return!1;var P=window.getSelection(),k=P&&P.anchorNode,F=k?k===I||k.contains(I):!1;if(F)return!1;var N=ln(C,I);if(!N)return!0;if(N?A=C:(A=C==="v"?"h":"v",N=ln(C,I)),!N)return!1;if(!r.current&&"changedTouches"in f&&(d||g)&&(r.current=A),!A)return!0;var H=r.current||A;return _a(H,b,f,H==="h"?d:g)},[]),h=s.useCallback(function(f){var b=f;if(!(!Oe.length||Oe[Oe.length-1]!==a)){var w="deltaY"in b?dn(b):ot(b),T=t.current.filter(function(A){return A.name===b.type&&(A.target===b.target||b.target===A.shadowParent)&&ja(A.delta,w)})[0];if(T&&T.should){b.cancelable&&b.preventDefault();return}if(!T){var d=(i.current.shards||[]).map(fn).filter(Boolean).filter(function(A){return A.contains(b.target)}),g=d.length>0?c(b,d[0]):!i.current.noIsolation;g&&b.cancelable&&b.preventDefault()}}},[]),m=s.useCallback(function(f,b,w,T){var d={name:f,delta:b,target:w,should:T,shadowParent:Ha(w)};t.current.push(d),setTimeout(function(){t.current=t.current.filter(function(g){return g!==d})},1)},[]),l=s.useCallback(function(f){n.current=ot(f),r.current=void 0},[]),u=s.useCallback(function(f){m(f.type,dn(f),f.target,c(f,e.lockRef.current))},[]),v=s.useCallback(function(f){m(f.type,ot(f),f.target,c(f,e.lockRef.current))},[]);s.useEffect(function(){return Oe.push(a),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:v}),document.addEventListener("wheel",h,Ae),document.addEventListener("touchmove",h,Ae),document.addEventListener("touchstart",l,Ae),function(){Oe=Oe.filter(function(f){return f!==a}),document.removeEventListener("wheel",h,Ae),document.removeEventListener("touchmove",h,Ae),document.removeEventListener("touchstart",l,Ae)}},[]);var y=e.removeScrollBar,E=e.inert;return s.createElement(s.Fragment,null,E?s.createElement(a,{styles:Fa(o)}):null,y?s.createElement(Oa,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Ha(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Wa=va(_n,Ba);var Hn=s.forwardRef(function(e,t){return s.createElement(pt,he({},e,{ref:t,sideCar:Wa}))});Hn.classNames=pt.classNames;const oi=({enabled:e=!0,bindings:t,capture:n=!1})=>{const r=s.useCallback(o=>{const a=o.target;if(!(a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.isContentEditable))for(const i of t){if(!(o.key.toLowerCase()===i.key.toLowerCase())||i.requireShift!==void 0&&i.requireShift!==o.shiftKey)continue;const h=o.ctrlKey||o.metaKey;if(i.requireMeta!==void 0){if(i.requireMeta!==h)continue}else{const m=i.noModifiers??!0,l=h||o.altKey||i.requireShift===void 0&&o.shiftKey;if(m&&l)continue}i.preventDefault&&o.preventDefault(),i.stopPropagation&&(o.stopPropagation(),o.stopImmediatePropagation()),i.handler(o);return}},[t]);s.useEffect(()=>{if(e)return window.addEventListener("keydown",r,n),()=>window.removeEventListener("keydown",r,n)},[e,r,n])},Ua=(e,t)=>e===void 0&&t.toAddresses.length===0,Va={status:"unsaved",reason:"Not saved — add a To address to keep this draft."},mn={status:"idle"},za={status:"saving"},pn={status:"saved"},hn={status:"error"},qa=e=>e.then(()=>{},()=>{}),Ka=({outboxMessageId:e,onDraftCreated:t})=>{const[n,r]=s.useState(mn),[o,a]=s.useState(null),i=s.useRef(void 0),c=s.useRef(new Set),h=Cr(),m=s.useRef(e),l=s.useRef(e);if(m.current!==e){const d=m.current!==void 0;m.current=e,l.current=e,d&&i.current&&clearTimeout(i.current)}const u=ut({...Rr(),meta:lt}),v=ut({...Dr(),meta:lt}),y=s.useCallback(async d=>{r(za),a(null);const g=l.current;if(g){const I=await v.mutateAsync({path:{outboxMessageId:g},body:{toAddresses:d.toAddresses,ccAddresses:d.ccAddresses,bccAddresses:d.bccAddresses,subject:d.subject,textBody:d.textBody,htmlBody:d.htmlBody,inReplyTo:d.inReplyTo,references:d.references}});return r(pn),I}const A=await u.mutateAsync({body:{...d,sendImmediately:!1}});return l.current=A.outboxMessageId,t(A.outboxMessageId),r(pn),h.invalidateQueries({queryKey:Tr().queryKey}),A},[u.mutateAsync,v.mutateAsync,t,h]),E=s.useRef(Promise.resolve()),f=s.useCallback(d=>{const g=E.current.then(()=>y(d));return E.current=qa(g),g},[y]),b=s.useCallback(d=>{if(i.current&&clearTimeout(i.current),Ua(l.current,d)){r(Va);return}r(g=>g.status==="unsaved"?mn:g),i.current=setTimeout(()=>{const g=l.current;g&&c.current.has(g)||f(d).catch(A=>{a(A),r(hn)})},2e3)},[f]),w=s.useCallback(d=>(i.current&&clearTimeout(i.current),f(d).then(g=>({outcome:"saved",outboxMessageId:g.outboxMessageId})).catch(g=>(r(hn),{outcome:"failed",error:g}))),[f]),T=s.useCallback(d=>{i.current&&clearTimeout(i.current),d&&c.current.add(d)},[]);return{saveState:n,saveError:o,saveDraft:b,saveImmediately:w,stopAutoSave:T}},Ya=e=>e.outboundCount>0||e.replyCount>0||e.flags?.vip?.value===!0||e.flags?.trusted?.value===!0,Ga=e=>e.flags?.blocked?.value===!0?!1:e.flags?.junkOnly?.value!==!0?!0:Ya(e),kt=({label:e,addresses:t,onChange:n,placeholder:r})=>{const[o,a]=s.useState(""),i=Vr(o,200),{data:c}=dt({...Ar({query:{q:i,limit:8}}),enabled:i.length>=2}),h=s.useMemo(()=>(c?.items??[]).filter(Ga).map(m=>({email:m.normalizedEmail,displayName:m.displayName})),[c]);return p.jsx(Qr,{label:e,addresses:t,onChange:n,placeholder:r,suggestions:h,onQueryChange:a})},Xa=({accountId:e,configureRef:t})=>{const n=Or();return p.jsx(no,{configureRef:t,onConfigure:()=>{n({to:"/settings/accounts",search:{editAccountId:e,focusSmtp:!0}})}})},Qa={download:"its dictionary could not be downloaded",engine:"the checker could not start",worker:"the checker stopped running"},Za=e=>{const t=`Spellcheck for ${e.language} is off: ${Qa[e.reason]}.`;return{severity:"warning",title:"Spellcheck stopped",detail:`${t} Your browser is checking this message instead. ${e.detail}`,action:{label:"Report this",href:Nr(kr({title:`Spellcheck stopped: ${e.reason} (${e.language})`,errorMessage:`${t} ${e.detail}`}))}}},Ja=e=>({provider:async t=>{const{openSpellcheckWorker:n}=await Rn(async()=>{const{openSpellcheckWorker:r}=await import("./rich-text-spellcheck-worker-provider-DMI13IjV.js");return{openSpellcheckWorker:r}},__vite__mapDeps([0,1,2,3]));return n(t)},onStatus:t=>{t.state==="failed"&&e(Za(t))}}),vn=150,es=()=>{const[e,t]=s.useState(()=>{if(typeof window>"u"||!window.visualViewport)return{viewportHeight:0,isKeyboardOpen:!1};const n=window.visualViewport.height;return{viewportHeight:n,isKeyboardOpen:window.innerHeight-n>vn}});return s.useEffect(()=>{if(typeof window>"u"||!window.visualViewport)return;const n=window.visualViewport,r=()=>{const o=n.height;t({viewportHeight:o,isKeyboardOpen:window.innerHeight-o>vn})};return r(),n.addEventListener("resize",r),()=>n.removeEventListener("resize",r)},[]),e},ts=({selectedAccountId:e,onSelect:t})=>{const{data:n}=dt({...Dn(),staleTime:1/0}),r=n?.accounts??[];if(s.useEffect(()=>{!e&&r.length===1&&r[0]&&t(r[0])},[e,r,t]),r.length<=1){const o=r[0];return o?p.jsxs("div",{className:"flex items-start gap-2",children:[p.jsx("label",{className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"From:"}),p.jsx("div",{className:"text-sm py-1.5",children:o.email})]}):null}return p.jsxs("div",{className:"flex items-start gap-2",children:[p.jsx("label",{htmlFor:"from-account-selector",className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"From:"}),p.jsx("select",{id:"from-account-selector",value:e??"",onChange:o=>{const a=r.find(i=>i.accountId===o.target.value);a&&t(a)},className:"flex-1 px-2 py-1.5 border rounded-md bg-canvas text-sm",children:r.map(o=>p.jsx("option",{value:o.accountId,children:o.email},o.accountId))})]})},ns=s.lazy(()=>Rn(()=>import("./rich-text-C0KYQjJG.js"),__vite__mapDeps([4,1,2,5,6,7,8,3,9,10,11,12])).then(e=>({default:e.ComposeBody}))),rs=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),os=e=>e.split(`
44
44
  `).map(t=>`<p>${rs(t)}</p>`).join(""),as=e=>e?`<p></p><p>-- </p>${os(e)}`:"",Pt=e=>({html:as(e),text:e}),ss=e=>e?/^re:\s/i.test(e)?e:`Re: ${e}`:"Re: ",is=e=>e?/^fwd?:\s/i.test(e)?e:`Fwd: ${e}`:"Fwd: ",cs=(e,t,n)=>{const{envelope:r}=e,a=(r.replyTo.length>0?r.replyTo:r.from).map(m=>({email:m.normalizedEmail,displayName:m.displayName}));if(t!=="reply-all")return{to:a,cc:[]};const i=n?.toLowerCase(),c=new Set(a.map(m=>m.email.toLowerCase())),h=[...r.to,...r.cc].filter(m=>m.normalizedEmail.toLowerCase()!==i&&!c.has(m.normalizedEmail.toLowerCase())).map(m=>({email:m.normalizedEmail,displayName:m.displayName}));return{to:a,cc:h}},us=e=>{const t=e.envelope.messageIdValue,r=[...e.references.filter(o=>o.referenceType==="references").sort((o,a)=>o.referenceOrder-a.referenceOrder).map(o=>o.messageIdValue)];return t&&!r.includes(t)&&r.push(t),{inReplyTo:t,references:r}},gn=(e,t,n)=>({textBody:t.text||void 0,htmlBody:e==="plain"?"":t.html?Br(t.html,n):void 0}),ls="Add a To address before sending.",ds=(e,t,n,r,o)=>e.length===0&&t.length===0&&n.length===0&&r.trim()===""&&o.text.trim()==="",fs=({documentGeneration:e,selectedAccountId:t,onAccountChange:n,toAddresses:r,setToAddresses:o,ccAddresses:a,setCcAddresses:i,bccAddresses:c,setBccAddresses:h,showCc:m,setShowCc:l,showBcc:u,setShowBcc:v,subject:y,setSubject:E})=>{const f=zr(),{isKeyboardOpen:b}=es(),[w,T]=s.useState(void 0),d=w===e;return p.jsx(to,{collapsed:!f&&b&&!d,onExpand:()=>T(e),summary:eo({to:r,cc:a,bcc:c,subject:y}),from:p.jsx(ts,{selectedAccountId:t,onSelect:n}),to:p.jsx(kt,{label:"To",addresses:r,onChange:o,placeholder:"Recipients"}),cc:m?p.jsx(kt,{label:"Cc",addresses:a,onChange:i}):void 0,bcc:u?p.jsx(kt,{label:"Bcc",addresses:c,onChange:h}):void 0,subject:p.jsx(ro,{value:y,onChange:E}),onShowCc:()=>l(!0),onShowBcc:()=>v(!0)})},ai=({mode:e,account:t,sourceMessage:n,outboxMessageId:r,onDraftCreated:o,onClose:a,onAccountChange:i,layout:c="fill"})=>{const{startSendPolling:h}=Pr(),{pushError:m}=Ir(),[l,u]=s.useState([]),[v,y]=s.useState([]),[E,f]=s.useState([]),[b,w]=s.useState(""),[T,d]=s.useState(!1),[g,A]=s.useState(!1),[I,C]=s.useState(t?.accountId),[P,k]=s.useState(!1),[F,N]=s.useState(r),H=s.useRef(null),R=s.useRef(r),U=s.useRef(r!==void 0),K=s.useRef(t?.accountId);s.useEffect(()=>{const x=t?.accountId;!x||K.current===x||(K.current=x,!U.current&&C(x))},[t?.accountId]),s.useEffect(()=>{const x=R.current;if(x===r||(R.current=r,x===void 0))return;U.current=r!==void 0;const L=r?{html:"",text:""}:Pt(V.current);u([]),y([]),f([]),w(""),d(!1),A(!1),Ve(L.html),se(L.text),we("rich"),Ce(void 0),oe({...L,formatting:[]}),Z(j=>j+1),k(!1),N(r)},[r]);const{signature:Y}=Wr(I),V=s.useRef(Y.plainText);V.current=Y.plainText;const[Q,Z]=s.useState(0),[ge,Ve]=s.useState(()=>Pt(Y.plainText).html),[ze,se]=s.useState(Y.plainText),[re,we]=s.useState("rich"),[de,ye]=s.useState("en"),[be,Ce]=s.useState(),[ie,oe]=s.useState(()=>({...Pt(Y.plainText),formatting:[]})),{data:G}=dt({...Lr({path:{outboxMessageId:r??""}}),enabled:!!r&&!P});s.useEffect(()=>{if(!G||P)return;u(G.toAddresses.map($=>({email:$,displayName:void 0}))),G.ccAddresses&&G.ccAddresses.length>0&&(y(G.ccAddresses.map($=>({email:$,displayName:void 0}))),d(!0)),G.bccAddresses&&G.bccAddresses.length>0&&(f(G.bccAddresses.map($=>({email:$,displayName:void 0}))),A(!0)),G.subject&&w(G.subject);const x=Mr(G.htmlBody??""),L=x.html,j=G.textBody??"";we(po(G.htmlBody)),Ce(x.language??void 0),Ve(L),se(j),oe({html:L,text:j,formatting:[]}),Z($=>$+1),C(G.accountId),k(!0)},[G,P]),s.useEffect(()=>{if(!U.current&&n){if(e==="reply"||e==="reply-all"){const{to:x,cc:L}=cs(n,e,t?.email);u(x),y(L),L.length>0&&d(!0),w(ss(n.envelope.subject))}e==="forward"&&(u([]),y([]),f([]),w(is(n.envelope.subject)))}},[e,n,t?.email]);const qe=e==="reply"||e==="reply-all"||e==="forward",{data:O}=Hr({messageId:n?.message.messageId,bodyParts:n?.bodyParts,enabled:qe&&!!n}),Pe=O?.kind==="text"?O.body:"",Ie=O?.kind==="html"?mo(O.body):void 0,Le=n?.envelope.from[0]?.displayName??n?.envelope.from[0]?.normalizedEmail,vt=s.useCallback(x=>{k(!0),N(x),o(x)},[o]),{saveState:gt,saveError:J,saveDraft:Me,saveImmediately:Ke,stopAutoSave:ee}=Ka({outboxMessageId:r,onDraftCreated:vt});s.useEffect(()=>{J&&m({title:"Couldn't save draft",detail:St(J)??"Saving the draft failed.",error:J})},[J,m]);const Ye=ut({..._r(),meta:lt}),_e=ut({...Fr(),meta:lt,onError:x=>{m(jr("Couldn't discard draft","The draft wasn't discarded.",x))}}),{data:wt}=dt({...Dn(),staleTime:1/0}),Ee=wt?.accounts.find(x=>x.accountId===I),fe=Ee?Ur(Ee):!1,Re=Ee?.composeLanguages,Ge=s.useMemo(()=>Re&&Re.length>0?Re:$r(navigator.languages),[Re]),yt=s.useMemo(()=>Ja(m),[m]),ce=s.useRef(!1),[je,Xe]=s.useState(!1),me=s.useMemo(()=>je?{status:"sending"}:I?fe?{status:"blocked",reason:jt}:l.length===0?{status:"blocked",reason:ls}:{status:"ready",accountId:I}:{status:"blocked",reason:"Choose an account to send from."},[je,I,fe,l.length]),bt=me;s.useEffect(()=>{if(!I||F!==void 0&&F!==r||r&&!P||ds(l,v,E,b,ie))return;const{htmlBody:x,textBody:L}=gn(re,ie,de);Me({accountId:I,toAddresses:l.map(j=>j.email),ccAddresses:v.length>0?v.map(j=>j.email):void 0,bccAddresses:E.length>0?E.map(j=>j.email):void 0,subject:b||void 0,textBody:L,htmlBody:x})},[I,r,F,P,l,v,E,b,ie,re,de,Me]);const Qe=s.useCallback(async x=>{if(!ce.current){ce.current=!0,Xe(!0);try{ee();const L=n&&(e==="reply"||e==="reply-all")?us(n):{},{htmlBody:j,textBody:$}=gn(re,ie,de),ae=!r,X=await Ke({accountId:x,toAddresses:l.map(z=>z.email),ccAddresses:v.length>0?v.map(z=>z.email):void 0,bccAddresses:E.length>0?E.map(z=>z.email):void 0,subject:b||void 0,textBody:$,htmlBody:j,...L});if(X.outcome==="failed"){m({title:"Couldn't send message",detail:St(X.error)??"Saving the message failed, so nothing was sent. Try again.",error:X.error});return}const te=X.outboxMessageId;if(await Ye.mutateAsync({path:{outboxMessageId:te}}).catch(z=>(m({title:"Couldn't send message",detail:St(z)??(ae?"The draft was saved but the send request failed. Try again from the Outbox.":"The send request failed. Try again."),error:z}),null))===null)return;ee(te),h(te),a()}finally{ce.current=!1,Xe(!1)}}},[l,v,E,b,ie,re,de,e,n,r,Ke,Ye,ee,h,m,a]),Et=s.useCallback(()=>{ee(r),r&&_e.mutate({path:{outboxMessageId:r}}),a()},[ee,r,_e,a]),D=s.useCallback(x=>{m({title:"Can't send yet",detail:x}),x===jt&&H.current?.focus()},[m]),M=s.useCallback(()=>{if(me.status!=="sending"){if(me.status==="blocked"){D(me.reason);return}Qe(me.accountId)}},[me,D,Qe]),_=s.useCallback(x=>{C(x.accountId),i?.(x)},[i]);return p.jsx(Jr,{layout:c,banner:Ee&&fe?p.jsx(Xa,{accountId:Ee.accountId,configureRef:H}):void 0,header:p.jsx(fs,{documentGeneration:Q,selectedAccountId:I,onAccountChange:_,toAddresses:l,setToAddresses:u,ccAddresses:v,setCcAddresses:y,bccAddresses:E,setBccAddresses:f,showCc:T,setShowCc:d,showBcc:g,setShowBcc:A,subject:b,setSubject:w}),quoted:Pe||Ie?p.jsx(oo,{text:Pe,html:Ie,senderName:Le}):void 0,actionBar:p.jsx(Yr,{send:bt,onSend:M,onBlocked:D,onDiscard:Et,save:gt}),children:p.jsx(s.Suspense,{fallback:p.jsx(Zr,{}),children:p.jsx(ns,{mode:re,onModeChange:we,initialHtml:ge,initialText:ze,onChange:oe,onSubmit:M,initialCaret:e==="new"?"start":void 0,onConversionError:m,languages:Ge,initialLanguage:be,onLanguageChange:ye,spellcheck:yt},Q)})})};var ht="Dialog",[Wn]=go(ht),[ms,ne]=Wn(ht),Un=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:a,modal:i=!0}=e,c=s.useRef(null),h=s.useRef(null),[m,l]=bo({prop:r,defaultProp:o??!1,onChange:a,caller:ht});return p.jsx(ms,{scope:t,triggerRef:c,contentRef:h,contentId:Dt(),titleId:Dt(),descriptionId:Dt(),open:m,onOpenChange:l,onOpenToggle:s.useCallback(()=>l(u=>!u),[l]),modal:i,children:n})};Un.displayName=ht;var Vn="DialogTrigger",ps=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ne(Vn,n),a=xe(t,o.triggerRef);return p.jsx(le.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":zt(o.open),...r,ref:a,onClick:ve(e.onClick,o.onOpenToggle)})});ps.displayName=Vn;var Vt="DialogPortal",[hs,zn]=Wn(Vt,{forceMount:void 0}),qn=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,a=ne(Vt,t);return p.jsx(hs,{scope:t,forceMount:n,children:s.Children.map(r,i=>p.jsx(mt,{present:n||a.open,children:p.jsx(In,{asChild:!0,container:o,children:i})}))})};qn.displayName=Vt;var ft="DialogOverlay",Kn=s.forwardRef((e,t)=>{const n=zn(ft,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=ne(ft,e.__scopeDialog);return a.modal?p.jsx(mt,{present:r||a.open,children:p.jsx(gs,{...o,ref:t})}):null});Kn.displayName=ft;var vs=An("DialogOverlay.RemoveScroll"),gs=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ne(ft,n),a=$o(),i=xe(t,a);return p.jsx(Hn,{as:vs,allowPinchZoom:!0,shards:[o.contentRef],children:p.jsx(le.div,{"data-state":zt(o.open),...r,ref:i,style:{pointerEvents:"auto",...r.style}})})}),ke="DialogContent",Yn=s.forwardRef((e,t)=>{const n=zn(ke,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=ne(ke,e.__scopeDialog);return p.jsx(mt,{present:r||a.open,children:a.modal?p.jsx(ws,{...o,ref:t}):p.jsx(ys,{...o,ref:t})})});Yn.displayName=ke;var ws=s.forwardRef((e,t)=>{const n=ne(ke,e.__scopeDialog),r=s.useRef(null),o=xe(t,n.contentRef,r);return s.useEffect(()=>{const a=r.current;if(a)return ia(a)},[]),p.jsx(Gn,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:ve(e.onCloseAutoFocus,a=>{a.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:ve(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,c=i.button===0&&i.ctrlKey===!0;(i.button===2||c)&&a.preventDefault()}),onFocusOutside:ve(e.onFocusOutside,a=>a.preventDefault())})}),ys=s.forwardRef((e,t)=>{const n=ne(ke,e.__scopeDialog),r=s.useRef(!1),o=s.useRef(!1);return p.jsx(Gn,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(r.current||n.triggerRef.current?.focus(),a.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=a.target;n.triggerRef.current?.contains(i)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})}),Gn=s.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,...i}=e,c=ne(ke,n);return Uo(),p.jsx(p.Fragment,{children:p.jsx(kn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a,children:p.jsx(On,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":zt(c.open),...i,ref:t,deferPointerDownOutside:!0,onDismiss:()=>c.onOpenChange(!1)})})})}),Xn="DialogTitle",Qn=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ne(Xn,n);return p.jsx(le.h2,{id:o.titleId,...r,ref:t})});Qn.displayName=Xn;var Zn="DialogDescription",bs=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ne(Zn,n);return p.jsx(le.p,{id:o.descriptionId,...r,ref:t})});bs.displayName=Zn;var Jn="DialogClose",Es=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ne(Jn,n);return p.jsx(le.button,{type:"button",...r,ref:t,onClick:ve(e.onClick,()=>o.onOpenChange(!1))})});Es.displayName=Jn;function zt(e){return e?"open":"closed"}function Ss(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const er=S.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),Ue=()=>{const e=S.useContext(er);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};Ss(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
45
45
  [data-state=closed]
46
46
  ){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function xs(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function Cs(){return qt(/^Mac/)}function Rs(){return qt(/^iPhone/)}function wn(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Ds(){return qt(/^iPad/)||Cs()&&navigator.maxTouchPoints>1}function tr(){return Rs()||Ds()}function qt(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const Ts=24,As=typeof window<"u"?s.useLayoutEffect:s.useEffect;function yn(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}const It=typeof document<"u"&&window.visualViewport;function bn(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function nr(e){for(bn(e)&&(e=e.parentElement);e&&!bn(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const Os=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let at=0,Lt;function Ns(e={}){let{isDisabled:t}=e;As(()=>{if(!t)return at++,at===1&&tr()&&(Lt=ks()),()=>{at--,at===0&&Lt?.()}},[t])}function ks(){let e,t=0,n=u=>{e=nr(u.target),!(e===document.documentElement&&e===document.body)&&(t=u.changedTouches[0].pageY)},r=u=>{if(!e||e===document.documentElement||e===document.body){u.preventDefault();return}let v=u.changedTouches[0].pageY,y=e.scrollTop,E=e.scrollHeight-e.clientHeight;E!==0&&((y<=0&&v>t||y>=E&&v<t)&&u.preventDefault(),t=v)},o=u=>{let v=u.target;Bt(v)&&v!==document.activeElement&&(u.preventDefault(),v.style.transform="translateY(-2000px)",v.focus(),requestAnimationFrame(()=>{v.style.transform=""}))},a=u=>{let v=u.target;Bt(v)&&(v.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{v.style.transform="",It&&(It.height<window.innerHeight?requestAnimationFrame(()=>{En(v)}):It.addEventListener("resize",()=>En(v),{once:!0}))}))},i=()=>{window.scrollTo(0,0)},c=window.pageXOffset,h=window.pageYOffset,m=yn(Ps(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let l=yn($e(document,"touchstart",n,{passive:!1,capture:!0}),$e(document,"touchmove",r,{passive:!1,capture:!0}),$e(document,"touchend",o,{passive:!1,capture:!0}),$e(document,"focus",a,!0),$e(window,"scroll",i));return()=>{m(),l(),window.scrollTo(c,h)}}function Ps(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function $e(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function En(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let n=nr(e);if(n!==document.documentElement&&n!==document.body&&n!==e){let r=n.getBoundingClientRect().top,o=e.getBoundingClientRect().top,a=e.getBoundingClientRect().bottom;const i=n.getBoundingClientRect().bottom+Ts;a>i&&(n.scrollTop+=o-r)}e=n.parentElement}}function Bt(e){return e instanceof HTMLInputElement&&!Os.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function Is(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Ls(...e){return t=>e.forEach(n=>Is(n,t))}function rr(...e){return s.useCallback(Ls(...e),e)}const or=new WeakMap;function q(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([o,a])=>{if(o.startsWith("--")){e.style.setProperty(o,a);return}r[o]=e.style[o],e.style[o]=a}),!n&&or.set(e,r)}function Ms(e,t){if(!e||!(e instanceof HTMLElement))return;let n=or.get(e);n&&(e.style[t]=n[t])}const W=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function st(e,t){if(!e)return null;const n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform;let o=r.match(/^matrix3d\((.+)\)$/);return o?parseFloat(o[1].split(", ")[W(t)?13:12]):(o=r.match(/^matrix\((.+)\)$/),o?parseFloat(o[1].split(", ")[W(t)?5:4]):null)}function _s(e){return 8*(Math.log(e+1)-2)}function Mt(e,t){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}function js(...e){return(...t)=>{for(const n of e)typeof n=="function"&&n(...t)}}const B={DURATION:.5,EASE:[.32,.72,0,1]},ar=.4,Fs=.25,$s=100,sr=8,Se=16,Ht=26,_t="vaul-dragging";function ir(e){const t=S.useRef(e);return S.useEffect(()=>{t.current=e}),S.useMemo(()=>(...n)=>t.current==null?void 0:t.current.call(t,...n),[])}function Bs({defaultProp:e,onChange:t}){const n=S.useState(e),[r]=n,o=S.useRef(r),a=ir(t);return S.useEffect(()=>{o.current!==r&&(a(r),o.current=r)},[r,o,a]),n}function cr({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=Bs({defaultProp:t,onChange:n}),a=e!==void 0,i=a?e:r,c=ir(n),h=S.useCallback(m=>{if(a){const u=typeof m=="function"?m(e):m;u!==e&&c(u)}else o(m)},[a,e,o,c]);return[i,h]}function Hs({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:o,fadeFromIndex:a,onSnapPointChange:i,direction:c="bottom",container:h,snapToSequentialPoint:m}){const[l,u]=cr({prop:e,defaultProp:n?.[0],onChange:t}),[v,y]=S.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);S.useEffect(()=>{function C(){y({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]);const E=S.useMemo(()=>l===n?.[n.length-1]||null,[n,l]),f=S.useMemo(()=>{var C;return(C=n?.findIndex(P=>P===l))!=null?C:null},[n,l]),b=n&&n.length>0&&(a||a===0)&&!Number.isNaN(a)&&n[a]===l||!n,w=S.useMemo(()=>{const C=h?{width:h.getBoundingClientRect().width,height:h.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var P;return(P=n?.map(k=>{const F=typeof k=="string";let N=0;if(F&&(N=parseInt(k,10)),W(c)){const R=F?N:v?k*C.height:0;return v?c==="bottom"?C.height-R:-C.height+R:R}const H=F?N:v?k*C.width:0;return v?c==="right"?C.width-H:-C.width+H:H}))!=null?P:[]},[n,v,h]),T=S.useMemo(()=>f!==null?w?.[f]:null,[w,f]),d=S.useCallback(C=>{var P;const k=(P=w?.findIndex(F=>F===C))!=null?P:null;i(k),q(r.current,{transition:`transform ${B.DURATION}s cubic-bezier(${B.EASE.join(",")})`,transform:W(c)?`translate3d(0, ${C}px, 0)`:`translate3d(${C}px, 0, 0)`}),w&&k!==w.length-1&&a!==void 0&&k!==a&&k<a?q(o.current,{transition:`opacity ${B.DURATION}s cubic-bezier(${B.EASE.join(",")})`,opacity:"0"}):q(o.current,{transition:`opacity ${B.DURATION}s cubic-bezier(${B.EASE.join(",")})`,opacity:"1"}),u(n?.[Math.max(k,0)])},[r.current,n,w,a,o,u]);S.useEffect(()=>{if(l||e){var C;const P=(C=n?.findIndex(k=>k===e||k===l))!=null?C:-1;w&&P!==-1&&typeof w[P]=="number"&&d(w[P])}},[l,e,n,w,d]);function g({draggedDistance:C,closeDrawer:P,velocity:k,dismissible:F}){if(a===void 0)return;const N=c==="bottom"||c==="right"?(T??0)-C:(T??0)+C,H=f===a-1,R=f===0,U=C>0;if(H&&q(o.current,{transition:`opacity ${B.DURATION}s cubic-bezier(${B.EASE.join(",")})`}),!m&&k>2&&!U){F?P():d(w[0]);return}if(!m&&k>2&&U&&w&&n){d(w[n.length-1]);return}const K=w?.reduce((V,Q)=>typeof V!="number"||typeof Q!="number"?V:Math.abs(Q-N)<Math.abs(V-N)?Q:V),Y=W(c)?window.innerHeight:window.innerWidth;if(k>ar&&Math.abs(C)<Y*.4){const V=U?1:-1;if(V>0&&E&&n){d(w[n.length-1]);return}if(R&&V<0&&F&&P(),f===null)return;d(w[f+V]);return}d(K)}function A({draggedDistance:C}){if(T===null)return;const P=c==="bottom"||c==="right"?T-C:T+C;(c==="bottom"||c==="right")&&P<w[w.length-1]||(c==="top"||c==="left")&&P>w[w.length-1]||q(r.current,{transform:W(c)?`translate3d(0, ${P}px, 0)`:`translate3d(${P}px, 0, 0)`})}function I(C,P){if(!n||typeof f!="number"||!w||a===void 0)return null;const k=f===a-1;if(f>=a&&P)return 0;if(k&&!P)return 1;if(!b&&!k)return null;const N=k?f+1:f-1,H=k?w[N]-w[N-1]:w[N+1]-w[N],R=C/Math.abs(H);return k?1-R:R}return{isLastSnapPoint:E,activeSnapPoint:l,shouldFade:b,getPercentageDragged:I,setActiveSnapPoint:u,activeSnapPointIndex:f,onRelease:g,onDrag:A,snapPointsOffset:w}}const Ws=()=>()=>{};function Us(){const{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:o}=Ue(),a=S.useRef(null),i=s.useMemo(()=>document.body.style.backgroundColor,[]);function c(){return(window.innerWidth-Ht)/window.innerWidth}S.useEffect(()=>{if(t&&n){a.current&&clearTimeout(a.current);const h=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!h)return;js(r&&!o?Mt(document.body,{background:"black"}):Ws,Mt(h,{transformOrigin:W(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${B.DURATION}s`,transitionTimingFunction:`cubic-bezier(${B.EASE.join(",")})`}));const m=Mt(h,{borderRadius:`${sr}px`,overflow:"hidden",...W(e)?{transform:`scale(${c()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${c()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{m(),a.current=window.setTimeout(()=>{i?document.body.style.background=i:document.body.style.removeProperty("background")},B.DURATION*1e3)}}},[t,n,i])}let Be=null;function Vs({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:o,noBodyStyles:a}){const[i,c]=S.useState(()=>typeof window<"u"?window.location.href:""),h=S.useRef(0),m=S.useCallback(()=>{if(wn()&&Be===null&&e&&!a){Be={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:u,innerHeight:v}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-h.current}px`,left:`${-u}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const y=v-window.innerHeight;y&&h.current>=v&&(document.body.style.top=`${-(h.current+y)}px`)}),300)}},[e]),l=S.useCallback(()=>{if(wn()&&Be!==null&&!a){const u=-parseInt(document.body.style.top,10),v=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Be),window.requestAnimationFrame(()=>{if(o&&i!==window.location.href){c(window.location.href);return}window.scrollTo(v,u)}),Be=null}},[i]);return S.useEffect(()=>{function u(){h.current=window.scrollY}return u(),window.addEventListener("scroll",u),()=>{window.removeEventListener("scroll",u)}},[]),S.useEffect(()=>{if(t)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||l()}},[t,l]),S.useEffect(()=>{n||!r||(e?(!window.matchMedia("(display-mode: standalone)").matches&&m(),t||window.setTimeout(()=>{l()},500)):l())},[e,r,i,t,n,m,l]),{restorePositionSetting:l}}function zs({open:e,onOpenChange:t,children:n,onDrag:r,onRelease:o,snapPoints:a,shouldScaleBackground:i=!1,setBackgroundColorOnScale:c=!0,closeThreshold:h=Fs,scrollLockTimeout:m=$s,dismissible:l=!0,handleOnly:u=!1,fadeFromIndex:v=a&&a.length-1,activeSnapPoint:y,setActiveSnapPoint:E,fixed:f,modal:b=!0,onClose:w,nested:T,noBodyStyles:d=!1,direction:g="bottom",defaultOpen:A=!1,disablePreventScroll:I=!0,snapToSequentialPoint:C=!1,preventScrollRestoration:P=!1,repositionInputs:k=!0,onAnimationEnd:F,container:N,autoFocus:H=!1}){var R,U;const[K=!1,Y]=cr({defaultProp:A,prop:e,onChange:D=>{t?.(D),!D&&!T&&Ee(),setTimeout(()=>{F?.(D)},B.DURATION*1e3),D&&!b&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),D||(document.body.style.pointerEvents="auto")}}),[V,Q]=S.useState(!1),[Z,ge]=S.useState(!1),[Ve,ze]=S.useState(!1),se=S.useRef(null),re=S.useRef(null),we=S.useRef(null),de=S.useRef(null),ye=S.useRef(null),be=S.useRef(!1),Ce=S.useRef(null),ie=S.useRef(0),oe=S.useRef(!1),G=S.useRef(!A),qe=S.useRef(0),O=S.useRef(null),Pe=S.useRef(((R=O.current)==null?void 0:R.getBoundingClientRect().height)||0),Ie=S.useRef(((U=O.current)==null?void 0:U.getBoundingClientRect().width)||0),Le=S.useRef(0),vt=S.useCallback(D=>{a&&D===ee.length-1&&(re.current=new Date)},[]),{activeSnapPoint:gt,activeSnapPointIndex:J,setActiveSnapPoint:Me,onRelease:Ke,snapPointsOffset:ee,onDrag:Ye,shouldFade:_e,getPercentageDragged:wt}=Hs({snapPoints:a,activeSnapPointProp:y,setActiveSnapPointProp:E,drawerRef:O,fadeFromIndex:v,overlayRef:se,onSnapPointChange:vt,direction:g,container:N,snapToSequentialPoint:C});Ns({isDisabled:!K||Z||!b||Ve||!V||!k||!I});const{restorePositionSetting:Ee}=Vs({isOpen:K,modal:b,nested:T??!1,hasBeenOpened:V,preventScrollRestoration:P,noBodyStyles:d});function fe(){return(window.innerWidth-Ht)/window.innerWidth}function Re(D){var M,_;!l&&!a||O.current&&!O.current.contains(D.target)||(Pe.current=((M=O.current)==null?void 0:M.getBoundingClientRect().height)||0,Ie.current=((_=O.current)==null?void 0:_.getBoundingClientRect().width)||0,ge(!0),we.current=new Date,tr()&&window.addEventListener("touchend",()=>be.current=!1,{once:!0}),D.target.setPointerCapture(D.pointerId),ie.current=W(g)?D.pageY:D.pageX)}function Ge(D,M){var _;let x=D;const L=(_=window.getSelection())==null?void 0:_.toString(),j=O.current?st(O.current,g):null,$=new Date;if(x.tagName==="SELECT"||x.hasAttribute("data-vaul-no-drag")||x.closest("[data-vaul-no-drag]"))return!1;if(g==="right"||g==="left")return!0;if(re.current&&$.getTime()-re.current.getTime()<500)return!1;if(j!==null&&(g==="bottom"?j>0:j<0))return!0;if(L&&L.length>0)return!1;if(ye.current&&$.getTime()-ye.current.getTime()<m&&j===0||M)return ye.current=$,!1;for(;x;){if(x.scrollHeight>x.clientHeight){if(x.scrollTop!==0)return ye.current=new Date,!1;if(x.getAttribute("role")==="dialog")return!0}x=x.parentNode}return!0}function yt(D){if(O.current&&Z){const M=g==="bottom"||g==="right"?1:-1,_=(ie.current-(W(g)?D.pageY:D.pageX))*M,x=_>0,L=a&&!l&&!x;if(L&&J===0)return;const j=Math.abs(_),$=document.querySelector("[data-vaul-drawer-wrapper]"),ae=g==="bottom"||g==="top"?Pe.current:Ie.current;let X=j/ae;const te=wt(j,x);if(te!==null&&(X=te),L&&X>=1||!be.current&&!Ge(D.target,x))return;if(O.current.classList.add(_t),be.current=!0,q(O.current,{transition:"none"}),q(se.current,{transition:"none"}),a&&Ye({draggedDistance:_}),x&&!a){const z=_s(_),Ze=Math.min(z*-1,0)*M;q(O.current,{transform:W(g)?`translate3d(0, ${Ze}px, 0)`:`translate3d(${Ze}px, 0, 0)`});return}const ue=1-X;if((_e||v&&J===v-1)&&(r?.(D,X),q(se.current,{opacity:`${ue}`,transition:"none"},!0)),$&&se.current&&i){const z=Math.min(fe()+X*(1-fe()),1),Ze=8-X*8,Kt=Math.max(0,14-X*14);q($,{borderRadius:`${Ze}px`,transform:W(g)?`scale(${z}) translate3d(0, ${Kt}px, 0)`:`scale(${z}) translate3d(${Kt}px, 0, 0)`,transition:"none"},!0)}if(!a){const z=j*M;q(O.current,{transform:W(g)?`translate3d(0, ${z}px, 0)`:`translate3d(${z}px, 0, 0)`})}}}S.useEffect(()=>{window.requestAnimationFrame(()=>{G.current=!0})},[]),S.useEffect(()=>{var D;function M(){if(!O.current||!k)return;const _=document.activeElement;if(Bt(_)||oe.current){var x;const L=((x=window.visualViewport)==null?void 0:x.height)||0,j=window.innerHeight;let $=j-L;const ae=O.current.getBoundingClientRect().height||0,X=ae>j*.8;Le.current||(Le.current=ae);const te=O.current.getBoundingClientRect().top;if(Math.abs(qe.current-$)>60&&(oe.current=!oe.current),a&&a.length>0&&ee&&J){const ue=ee[J]||0;$+=ue}if(qe.current=$,ae>L||oe.current){const ue=O.current.getBoundingClientRect().height;let z=ue;ue>L&&(z=L-(X?te:Ht)),f?O.current.style.height=`${ue-Math.max($,0)}px`:O.current.style.height=`${Math.max(z,L-te)}px`}else xs()||(O.current.style.height=`${Le.current}px`);a&&a.length>0&&!oe.current?O.current.style.bottom="0px":O.current.style.bottom=`${Math.max($,0)}px`}}return(D=window.visualViewport)==null||D.addEventListener("resize",M),()=>{var _;return(_=window.visualViewport)==null?void 0:_.removeEventListener("resize",M)}},[J,a,ee]);function ce(D){Xe(),w?.(),D||Y(!1),setTimeout(()=>{a&&Me(a[0])},B.DURATION*1e3)}function je(){if(!O.current)return;const D=document.querySelector("[data-vaul-drawer-wrapper]"),M=st(O.current,g);q(O.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${B.DURATION}s cubic-bezier(${B.EASE.join(",")})`}),q(se.current,{transition:`opacity ${B.DURATION}s cubic-bezier(${B.EASE.join(",")})`,opacity:"1"}),i&&M&&M>0&&K&&q(D,{borderRadius:`${sr}px`,overflow:"hidden",...W(g)?{transform:`scale(${fe()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${fe()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${B.DURATION}s`,transitionTimingFunction:`cubic-bezier(${B.EASE.join(",")})`},!0)}function Xe(){!Z||!O.current||(O.current.classList.remove(_t),be.current=!1,ge(!1),de.current=new Date)}function me(D){if(!Z||!O.current)return;O.current.classList.remove(_t),be.current=!1,ge(!1),de.current=new Date;const M=st(O.current,g);if(!D||!Ge(D.target,!1)||!M||Number.isNaN(M)||we.current===null)return;const _=de.current.getTime()-we.current.getTime(),x=ie.current-(W(g)?D.pageY:D.pageX),L=Math.abs(x)/_;if(L>.05&&(ze(!0),setTimeout(()=>{ze(!1)},200)),a){Ke({draggedDistance:x*(g==="bottom"||g==="right"?1:-1),closeDrawer:ce,velocity:L,dismissible:l}),o?.(D,!0);return}if(g==="bottom"||g==="right"?x>0:x<0){je(),o?.(D,!0);return}if(L>ar){ce(),o?.(D,!1);return}var j;const $=Math.min((j=O.current.getBoundingClientRect().height)!=null?j:0,window.innerHeight);var ae;const X=Math.min((ae=O.current.getBoundingClientRect().width)!=null?ae:0,window.innerWidth),te=g==="left"||g==="right";if(Math.abs(M)>=(te?X:$)*h){ce(),o?.(D,!1);return}o?.(D,!0),je()}S.useEffect(()=>(K&&(q(document.documentElement,{scrollBehavior:"auto"}),re.current=new Date),()=>{Ms(document.documentElement,"scrollBehavior")}),[K]);function bt(D){const M=D?(window.innerWidth-Se)/window.innerWidth:1,_=D?-Se:0;Ce.current&&window.clearTimeout(Ce.current),q(O.current,{transition:`transform ${B.DURATION}s cubic-bezier(${B.EASE.join(",")})`,transform:W(g)?`scale(${M}) translate3d(0, ${_}px, 0)`:`scale(${M}) translate3d(${_}px, 0, 0)`}),!D&&O.current&&(Ce.current=setTimeout(()=>{const x=st(O.current,g);q(O.current,{transition:"none",transform:W(g)?`translate3d(0, ${x}px, 0)`:`translate3d(${x}px, 0, 0)`})},500))}function Qe(D,M){if(M<0)return;const _=(window.innerWidth-Se)/window.innerWidth,x=_+M*(1-_),L=-Se+M*Se;q(O.current,{transform:W(g)?`scale(${x}) translate3d(0, ${L}px, 0)`:`scale(${x}) translate3d(${L}px, 0, 0)`,transition:"none"})}function Et(D,M){const _=W(g)?window.innerHeight:window.innerWidth,x=M?(_-Se)/_:1,L=M?-Se:0;M&&q(O.current,{transition:`transform ${B.DURATION}s cubic-bezier(${B.EASE.join(",")})`,transform:W(g)?`scale(${x}) translate3d(0, ${L}px, 0)`:`scale(${x}) translate3d(${L}px, 0, 0)`})}return S.useEffect(()=>{b||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[b]),S.createElement(Un,{defaultOpen:A,onOpenChange:D=>{!l&&!D||(D?Q(!0):ce(!0),Y(D))},open:K},S.createElement(er.Provider,{value:{activeSnapPoint:gt,snapPoints:a,setActiveSnapPoint:Me,drawerRef:O,overlayRef:se,onOpenChange:t,onPress:Re,onRelease:me,onDrag:yt,dismissible:l,shouldAnimate:G,handleOnly:u,isOpen:K,isDragging:Z,shouldFade:_e,closeDrawer:ce,onNestedDrag:Qe,onNestedOpenChange:bt,onNestedRelease:Et,keyboardIsOpen:oe,modal:b,snapPointsOffset:ee,activeSnapPointIndex:J,direction:g,shouldScaleBackground:i,setBackgroundColorOnScale:c,noBodyStyles:d,container:N,autoFocus:H}},n))}const ur=S.forwardRef(function({...e},t){const{overlayRef:n,snapPoints:r,onRelease:o,shouldFade:a,isOpen:i,modal:c,shouldAnimate:h}=Ue(),m=rr(t,n),l=r&&r.length>0;if(!c)return null;const u=S.useCallback(v=>o(v),[o]);return S.createElement(Kn,{onMouseUp:u,ref:m,"data-vaul-overlay":"","data-vaul-snap-points":i&&l?"true":"false","data-vaul-snap-points-overlay":i&&a?"true":"false","data-vaul-animate":h?.current?"true":"false",...e})});ur.displayName="Drawer.Overlay";const lr=S.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},o){const{drawerRef:a,onPress:i,onRelease:c,onDrag:h,keyboardIsOpen:m,snapPointsOffset:l,activeSnapPointIndex:u,modal:v,isOpen:y,direction:E,snapPoints:f,container:b,handleOnly:w,shouldAnimate:T,autoFocus:d}=Ue(),[g,A]=S.useState(!1),I=rr(o,a),C=S.useRef(null),P=S.useRef(null),k=S.useRef(!1),F=f&&f.length>0;Us();const N=(R,U,K=0)=>{if(k.current)return!0;const Y=Math.abs(R.y),V=Math.abs(R.x),Q=V>Y,Z=["bottom","right"].includes(U)?1:-1;if(U==="left"||U==="right"){if(!(R.x*Z<0)&&V>=0&&V<=K)return Q}else if(!(R.y*Z<0)&&Y>=0&&Y<=K)return!Q;return k.current=!0,!0};S.useEffect(()=>{F&&window.requestAnimationFrame(()=>{A(!0)})},[]);function H(R){C.current=null,k.current=!1,c(R)}return S.createElement(Yn,{"data-vaul-drawer-direction":E,"data-vaul-drawer":"","data-vaul-delayed-snap-points":g?"true":"false","data-vaul-snap-points":y&&F?"true":"false","data-vaul-custom-container":b?"true":"false","data-vaul-animate":T?.current?"true":"false",...r,ref:I,style:l&&l.length>0?{"--snap-point-height":`${l[u??0]}px`,...t}:t,onPointerDown:R=>{w||(r.onPointerDown==null||r.onPointerDown.call(r,R),C.current={x:R.pageX,y:R.pageY},i(R))},onOpenAutoFocus:R=>{n?.(R),d||R.preventDefault()},onPointerDownOutside:R=>{if(e?.(R),!v||R.defaultPrevented){R.preventDefault();return}m.current&&(m.current=!1)},onFocusOutside:R=>{if(!v){R.preventDefault();return}},onPointerMove:R=>{if(P.current=R,w||(r.onPointerMove==null||r.onPointerMove.call(r,R),!C.current))return;const U=R.pageY-C.current.y,K=R.pageX-C.current.x,Y=R.pointerType==="touch"?10:2;N({x:K,y:U},E,Y)?h(R):(Math.abs(K)>Y||Math.abs(U)>Y)&&(C.current=null)},onPointerUp:R=>{r.onPointerUp==null||r.onPointerUp.call(r,R),C.current=null,k.current=!1,c(R)},onPointerOut:R=>{r.onPointerOut==null||r.onPointerOut.call(r,R),H(P.current)},onContextMenu:R=>{r.onContextMenu==null||r.onContextMenu.call(r,R),P.current&&H(P.current)}})});lr.displayName="Drawer.Content";const qs=250,Ks=120,dr=S.forwardRef(function({preventCycle:e=!1,children:t,...n},r){const{closeDrawer:o,isDragging:a,snapPoints:i,activeSnapPoint:c,setActiveSnapPoint:h,dismissible:m,handleOnly:l,isOpen:u,onPress:v,onDrag:y}=Ue(),E=S.useRef(null),f=S.useRef(!1);function b(){if(f.current){d();return}window.setTimeout(()=>{w()},Ks)}function w(){if(a||e||f.current){d();return}if(d(),!i||i.length===0){m||o();return}if(c===i[i.length-1]&&m){o();return}const A=i.findIndex(C=>C===c);if(A===-1)return;const I=i[A+1];h(I)}function T(){E.current=window.setTimeout(()=>{f.current=!0},qs)}function d(){E.current&&window.clearTimeout(E.current),f.current=!1}return S.createElement("div",{onClick:b,onPointerCancel:d,onPointerDown:g=>{l&&v(g),T()},onPointerMove:g=>{l&&y(g)},ref:r,"data-vaul-drawer-visible":u?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},S.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});dr.displayName="Drawer.Handle";function Ys(e){const t=Ue(),{container:n=t.container,...r}=e;return S.createElement(qn,{container:n,...r})}const si={Root:zs,Content:lr,Overlay:ur,Portal:Ys,Handle:dr,Title:Qn};export{ai as C,si as D,ni as a,ri as c,ti as s,oi as u};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-CUDGbjSt.js";import{M as i}from"./MailboxPane-GWhGjr4s.js";import"./useSearchTokenContext-5QVIZLT9.js";import"./kbd-BqP2t_lb.js";import"./useMessageBodyContent-AsE119jK.js";import"./useMediaQuery-XxWbPYsI.js";import"./search-scope-CdVMxnJQ.js";import"./useRefreshControl-CuM3uP9o.js";import"./circle-check-big-CNvQYcLR.js";import"./search-token-index-BdWyU2pZ.js";import"./MailListHeader-CCZ5QHsx.js";import"./attachment-file-DENdjOom.js";import"./mail-9u6lVCNj.js";import"./avatar-D9LII8Ln.js";import"./index-B6Fz4X0i.js";import"./useSignature-J18jTbi3.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CgbEHRND.js";import"./ErrorState-B-pmt8tr.js";import"./format-23Av07Go.js";import"./download-CxMx2zdk.js";import"./shield-check-CSPq5rhh.js";import"./useFilters-C2y22aXO.js";import"./confirm-dialog-BZYLusH1.js";import"./clock-acRpctBX.js";import"./menu-zoD3J9Wr.js";import"./MailViewChrome-CAl6yjWH.js";import"./NavMenuButton-CEqFdt1K.js";import"./useLabels-ubt8he3q.js";import"./useSemanticSearch-DQHE54Kh.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-BH88Otuk.js";import"./circle-help-DtosCxuB.js";import"./circle-check-Dn5_xOpA.js";function H(){return o.jsx(i.Reading,{})}export{H as component};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-CUDGbjSt.js";import{F as r}from"./FlaggedPane-DShtZRWu.js";import"./useSearchTokenContext-5QVIZLT9.js";import"./kbd-BqP2t_lb.js";import"./useMessageBodyContent-AsE119jK.js";import"./useMediaQuery-XxWbPYsI.js";import"./search-scope-CdVMxnJQ.js";import"./MailListHeader-CCZ5QHsx.js";import"./search-token-index-BdWyU2pZ.js";import"./attachment-file-DENdjOom.js";import"./mail-9u6lVCNj.js";import"./avatar-D9LII8Ln.js";import"./index-B6Fz4X0i.js";import"./useSignature-J18jTbi3.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CgbEHRND.js";import"./ErrorState-B-pmt8tr.js";import"./format-23Av07Go.js";import"./download-CxMx2zdk.js";import"./shield-check-CSPq5rhh.js";import"./useFilters-C2y22aXO.js";import"./confirm-dialog-BZYLusH1.js";import"./clock-acRpctBX.js";import"./menu-zoD3J9Wr.js";import"./MailViewChrome-CAl6yjWH.js";import"./wizard-selection-B1bng5Jq.js";function w(){return o.jsx(r.Reading,{})}export{w as component};
@@ -0,0 +1 @@
1
+ import{j as r}from"./index-CUDGbjSt.js";import{B as o}from"./BriefPane-DSXt2QHX.js";import"./useSearchTokenContext-5QVIZLT9.js";import"./kbd-BqP2t_lb.js";import"./useMessageBodyContent-AsE119jK.js";import"./useMediaQuery-XxWbPYsI.js";import"./search-scope-CdVMxnJQ.js";import"./MailListHeader-CCZ5QHsx.js";import"./search-token-index-BdWyU2pZ.js";import"./attachment-file-DENdjOom.js";import"./mail-9u6lVCNj.js";import"./avatar-D9LII8Ln.js";import"./index-B6Fz4X0i.js";import"./useSignature-J18jTbi3.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CgbEHRND.js";import"./ErrorState-B-pmt8tr.js";import"./format-23Av07Go.js";import"./download-CxMx2zdk.js";import"./shield-check-CSPq5rhh.js";import"./useFilters-C2y22aXO.js";import"./confirm-dialog-BZYLusH1.js";import"./clock-acRpctBX.js";import"./menu-zoD3J9Wr.js";import"./useRefreshControl-CuM3uP9o.js";import"./circle-check-big-CNvQYcLR.js";import"./useLabels-ubt8he3q.js";import"./useSemanticSearch-DQHE54Kh.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-B1bng5Jq.js";function D(){return r.jsx(o.Reading,{})}export{D as component};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-CUDGbjSt.js";import{M as r}from"./MailboxPane-GWhGjr4s.js";import"./useSearchTokenContext-5QVIZLT9.js";import"./kbd-BqP2t_lb.js";import"./useMessageBodyContent-AsE119jK.js";import"./useMediaQuery-XxWbPYsI.js";import"./search-scope-CdVMxnJQ.js";import"./useRefreshControl-CuM3uP9o.js";import"./circle-check-big-CNvQYcLR.js";import"./search-token-index-BdWyU2pZ.js";import"./MailListHeader-CCZ5QHsx.js";import"./attachment-file-DENdjOom.js";import"./mail-9u6lVCNj.js";import"./avatar-D9LII8Ln.js";import"./index-B6Fz4X0i.js";import"./useSignature-J18jTbi3.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CgbEHRND.js";import"./ErrorState-B-pmt8tr.js";import"./format-23Av07Go.js";import"./download-CxMx2zdk.js";import"./shield-check-CSPq5rhh.js";import"./useFilters-C2y22aXO.js";import"./confirm-dialog-BZYLusH1.js";import"./clock-acRpctBX.js";import"./menu-zoD3J9Wr.js";import"./MailViewChrome-CAl6yjWH.js";import"./NavMenuButton-CEqFdt1K.js";import"./useLabels-ubt8he3q.js";import"./useSemanticSearch-DQHE54Kh.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-BH88Otuk.js";import"./circle-help-DtosCxuB.js";import"./circle-check-Dn5_xOpA.js";function G(){return o.jsx(r.Reading,{})}export{G as component};