@remit/web-client-dist 0.0.375 → 0.0.377
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.
- package/assets/BriefPane-BsW7qf9q.js +1 -0
- package/assets/{ErrorState-C1oxCUkU.js → ErrorState-BF7k9VeT.js} +1 -1
- package/assets/FlaggedPane-DfrV_6op.js +1 -0
- package/assets/{FullCompose-DmnWwFwI.js → FullCompose-DH3l81DA.js} +1 -1
- package/assets/MailListHeader-BIcOZoHT.js +7 -0
- package/assets/{MailViewChrome-DYx2akG4.js → MailViewChrome-D2WwK5Zk.js} +1 -1
- package/assets/MailboxPane-CA5Y3_SN.js +1 -0
- package/assets/{NavMenuButton-CMrBW7pM.js → NavMenuButton-C2qYzQDt.js} +1 -1
- package/assets/{OnboardingWizard-B9cNpJ_Q.js → OnboardingWizard-D6Sn5k_f.js} +1 -1
- package/assets/{OutboxPane-BF9GXw9G.js → OutboxPane-B8997jd5.js} +1 -1
- package/assets/_mailboxId-DvdjqS95.js +1 -0
- package/assets/_messageId-Bq4BfNYr.js +1 -0
- package/assets/_messageId-CXWsFbun.js +1 -0
- package/assets/_messageId-DZt3eqB1.js +1 -0
- package/assets/_outboxMessageId-BNxGvFC1.js +1 -0
- package/assets/_threadId-Ci8LFi0O.js +1 -0
- package/assets/_threadId-DOkG75Nn.js +1 -0
- package/assets/_threadId-p4Emj3uU.js +1 -0
- package/assets/{accounts-DZU5Xd9t.js → accounts-SKSGi2NU.js} +1 -1
- package/assets/{advanced-DlCOjUfc.js → advanced-BLZJTC6T.js} +1 -1
- package/assets/{appearance-j0Uw_zbE.js → appearance-C896NCBV.js} +1 -1
- package/assets/{attachment-file-Bp6X2P9U.js → attachment-file-uAdi6sKR.js} +1 -1
- package/assets/{avatar-P6pfWsVW.js → avatar-CFndQH5R.js} +1 -1
- package/assets/{bottom-sheet-s8eYewr5.js → bottom-sheet-Bw8q9Cma.js} +1 -1
- package/assets/brief-B1CfEBkK.js +1 -0
- package/assets/{brief-BrVHUpQm.js → brief-DQ2qsYu4.js} +1 -1
- package/assets/{browser-ponyfill-CSGHsdHW.js → browser-ponyfill-CmT40eLd.js} +1 -1
- package/assets/{bug-BUu7LAp0.js → bug-CWcjuCI9.js} +1 -1
- package/assets/{circle-check-CRet7JA0.js → circle-check-CtwlOpag.js} +1 -1
- package/assets/{circle-check-big-jjmu5Nss.js → circle-check-big-CPS4axVs.js} +1 -1
- package/assets/{circle-help-Bf0O-YS0.js → circle-help-6oY_xcWT.js} +1 -1
- package/assets/{clock-C0gL-PYL.js → clock-Cm_TLM05.js} +1 -1
- package/assets/compose._-_outboxMessageId_-Bd-QCthp.js +1 -0
- package/assets/compose._-_outboxMessageId_-DeMSPAl_.js +1 -0
- package/assets/compose._-_outboxMessageId_-RWo-zOES.js +1 -0
- package/assets/compose._-_outboxMessageId_-uKsT8jv-.js +1 -0
- package/assets/{confirm-dialog-Cj-oNdv1.js → confirm-dialog-tiuVS57c.js} +1 -1
- package/assets/{download-a7Y-jQAE.js → download-DM2bn95G.js} +1 -1
- package/assets/{filters-Dg-6FFMR.js → filters-z1cgXkva.js} +1 -1
- package/assets/flagged-ClTjTYOn.js +1 -0
- package/assets/{flagged-hLDOrBrf.js → flagged-DYeJoYTA.js} +1 -1
- package/assets/{folders-qURYbQD9.js → folders-DNV0RHTd.js} +1 -1
- package/assets/format-HasNd5qT.js +1 -0
- package/assets/index-34_DDX6t.js +1 -0
- package/assets/index-BTDgC3og.js +1 -0
- package/assets/index-CEsKfGNN.js +1 -0
- package/assets/index-CXWsFbun.js +1 -0
- package/assets/index-Cs8PFdeN.js +1 -0
- package/assets/{index-CD4V-Lrv.js → index-DJa-q1BD.js} +3 -3
- package/assets/index-DZt3eqB1.js +1 -0
- package/assets/index-DkUkF0OU.js +1 -0
- package/assets/index-DsukC8dv.js +1 -0
- package/assets/{index-D4GNMXJp.js → index-M_tY9XTt.js} +4 -4
- package/assets/{kbd-DW4mL8Ts.js → kbd-BHAPJuqc.js} +1 -1
- package/assets/{labels-Deqa9gmJ.js → labels-Cs8GABWD.js} +1 -1
- package/assets/{mail-BPyHA14i.js → mail-D6GOeJKp.js} +1 -1
- package/assets/{mail-Bu7xd4oX.js → mail-xuqH4cWa.js} +1 -1
- package/assets/{menu-kXyiT8p3.js → menu-DnyLlQ6R.js} +1 -1
- package/assets/{move-options-B0LunqBm.js → move-options-E3q-ftA4.js} +1 -1
- package/assets/{onboarding-Do7ViFIs.js → onboarding-DNEirFz6.js} +1 -1
- package/assets/outbox-Xyk2YiIq.js +1 -0
- package/assets/{pencil-CqMvXV0T.js → pencil-Dv_vxc_I.js} +1 -1
- package/assets/{rich-text-BhglEqdB.js → rich-text-WDSUzqmW.js} +1 -1
- package/assets/{rich-text-spellcheck-worker-provider-ChahdeX-.js → rich-text-spellcheck-worker-provider-Cp2XW2DG.js} +1 -1
- package/assets/{rotate-ccw-oGKYHJNH.js → rotate-ccw-DDVwYFgh.js} +1 -1
- package/assets/{row-actions-Dy8JIA9i.js → row-actions-BJnWfpUS.js} +1 -1
- package/assets/{search-scope-DMuJ3ZG3.js → search-scope-BqP7bipM.js} +1 -1
- package/assets/{search-token-index-DygfO1Ra.js → search-token-index-Dq1YsfkF.js} +1 -1
- package/assets/{search-view-kmp2_nYE.js → search-view-k-zJxJGB.js} +1 -1
- package/assets/{senders-BJ64S39H.js → senders-yNP2Rf5W.js} +1 -1
- package/assets/settings-CeQ_usM2.js +1 -0
- package/assets/{settings-screen-Dxy8IIO7.js → settings-screen-SE1NBJSJ.js} +1 -1
- package/assets/{shield-check-CxRJLg1p.js → shield-check-CFPVcDje.js} +1 -1
- package/assets/{suggested-vips-BPQTRYrM.js → suggested-vips-D0cOnY8P.js} +1 -1
- package/assets/{useDebouncedValue-CBu_R9br.js → useDebouncedValue-CVloHKPu.js} +1 -1
- package/assets/{useFilters-DbVsX56r.js → useFilters-BxSvo_8a.js} +1 -1
- package/assets/{useLabels-DrNtpBRv.js → useLabels-BfLvkcxZ.js} +1 -1
- package/assets/{useMediaQuery-Cfl95yDw.js → useMediaQuery-D0jZQl9A.js} +1 -1
- package/assets/{useMessageBodyContent-B_9rbntp.js → useMessageBodyContent-BVHgD2uM.js} +1 -1
- package/assets/{useRefreshControl-BuNPKJVr.js → useRefreshControl-XfZdONZZ.js} +1 -1
- package/assets/{useSearchMirror-Du8sBEpg.js → useSearchMirror-Dbv78_0t.js} +1 -1
- package/assets/{useSearchTokenContext-CkTxmD0P.js → useSearchTokenContext-DU66fBNH.js} +1 -1
- package/assets/{useSemanticSearch-BqTar8dl.js → useSemanticSearch-DX_yFDSq.js} +1 -1
- package/assets/{useSignature-CRc2RVPc.js → useSignature-B9-4He3j.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/BriefPane-BeXDV5Zn.js +0 -1
- package/assets/FlaggedPane-EAfKdsNW.js +0 -1
- package/assets/MailListHeader-CfanDV0L.js +0 -7
- package/assets/MailboxPane-wz_IRkR7.js +0 -1
- package/assets/_mailboxId-BHZjIwhm.js +0 -1
- package/assets/_messageId-BJZETSfD.js +0 -1
- package/assets/_messageId-BJvuW8nM.js +0 -1
- package/assets/_messageId-BWX8VBJ8.js +0 -1
- package/assets/_outboxMessageId-uFinHfZ_.js +0 -1
- package/assets/_threadId-1KpMkWIW.js +0 -1
- package/assets/_threadId-CK0a9sG6.js +0 -1
- package/assets/_threadId-D8GkNLrP.js +0 -1
- package/assets/brief-fiIYT_9U.js +0 -1
- package/assets/compose._-_outboxMessageId_-B-1XxI4P.js +0 -1
- package/assets/compose._-_outboxMessageId_-Bw_0kQTZ.js +0 -1
- package/assets/compose._-_outboxMessageId_-CyUnPsvL.js +0 -1
- package/assets/compose._-_outboxMessageId_-DWAkGhEM.js +0 -1
- package/assets/flagged-Dv4u1zQE.js +0 -1
- package/assets/format-De9HZKjg.js +0 -1
- package/assets/index-BJZETSfD.js +0 -1
- package/assets/index-BJvuW8nM.js +0 -1
- package/assets/index-BexxstWJ.js +0 -1
- package/assets/index-Brxlfsgf.js +0 -1
- package/assets/index-BzhiMB34.js +0 -1
- package/assets/index-C4nGT-Xp.js +0 -1
- package/assets/index-C9rIVDiT.js +0 -1
- package/assets/index-UEtKfC0z.js +0 -1
- package/assets/outbox-CKRxB5uJ.js +0 -1
- package/assets/settings-LnjiQmUe.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a}from"./index-
|
|
1
|
+
import{c as a}from"./index-M_tY9XTt.js";const t=a("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);export{t as B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c}from"./index-
|
|
1
|
+
import{c}from"./index-M_tY9XTt.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-
|
|
1
|
+
import{c}from"./index-M_tY9XTt.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-
|
|
1
|
+
import{c}from"./index-M_tY9XTt.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-
|
|
1
|
+
import{c}from"./index-M_tY9XTt.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-DH3l81DA.js";import"./index-M_tY9XTt.js";import"./ErrorState-BF7k9VeT.js";import"./index-DJa-q1BD.js";import"./useMessageBodyContent-BVHgD2uM.js";import"./useMediaQuery-D0jZQl9A.js";import"./useSignature-B9-4He3j.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CVloHKPu.js";import"./confirm-dialog-tiuVS57c.js";const c=o;export{c as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as o}from"./FullCompose-DH3l81DA.js";import"./index-M_tY9XTt.js";import"./ErrorState-BF7k9VeT.js";import"./index-DJa-q1BD.js";import"./useMessageBodyContent-BVHgD2uM.js";import"./useMediaQuery-D0jZQl9A.js";import"./useSignature-B9-4He3j.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CVloHKPu.js";import"./confirm-dialog-tiuVS57c.js";const c=o;export{c as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as o}from"./FullCompose-DH3l81DA.js";import"./index-M_tY9XTt.js";import"./ErrorState-BF7k9VeT.js";import"./index-DJa-q1BD.js";import"./useMessageBodyContent-BVHgD2uM.js";import"./useMediaQuery-D0jZQl9A.js";import"./useSignature-B9-4He3j.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CVloHKPu.js";import"./confirm-dialog-tiuVS57c.js";const c=o;export{c as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as o}from"./FullCompose-DH3l81DA.js";import"./index-M_tY9XTt.js";import"./ErrorState-BF7k9VeT.js";import"./index-DJa-q1BD.js";import"./useMessageBodyContent-BVHgD2uM.js";import"./useMediaQuery-D0jZQl9A.js";import"./useSignature-B9-4He3j.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CVloHKPu.js";import"./confirm-dialog-tiuVS57c.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-
|
|
1
|
+
import{r as n,j as e,D as b,b as o}from"./index-M_tY9XTt.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-
|
|
1
|
+
import{c as o}from"./index-M_tY9XTt.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 X,a7 as Z,aO as ee,aP as te,r as x,j as t,aQ as ae,aR as se,af as R,B as N,an as ie,at as ne,aS as re,aT as oe,T as le,s as P,q as ce,v as de,x as me,m as ue,Q as pe,ar as xe,av as fe}from"./index-D4GNMXJp.js";import{S as he}from"./settings-screen-Dxy8IIO7.js";import{B as ge}from"./bottom-sheet-s8eYewr5.js";import{u as ve}from"./useMediaQuery-Cfl95yDw.js";import{u as be,a as ye,b as je,f as Ne}from"./move-options-B0LunqBm.js";import{u as Ce,a as Se}from"./useLabels-DrNtpBRv.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-DbVsX56r.js";import{C as A}from"./circle-check-CRet7JA0.js";import{E as $}from"./ErrorState-C1oxCUkU.js";import"./avatar-P6pfWsVW.js";import"./menu-kXyiT8p3.js";import"./circle-help-Bf0O-YS0.js";import"./enums-CCxx0t2v.js";const Re=(e,a)=>{const r=X(),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??"":""}),_=(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),_(e,a)&&(r.scope=e.scope==="until"?"Temporary":"Standing",e.scope==="until"&&(r.expiresAt=Me(e.until??""))),r};function _e({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}=be(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}}),B=o=>u(s=>s&&{...s,draft:{...s.draft,value:o}}),Q=()=>{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))},U=o=>l(s=>({...s,clauses:s.clauses.filter(y=>y.id!==o)})),K=o=>l(s=>({...s,matchOperator:o})),q=o=>l(s=>({...s,moveMailboxId:o||void 0})),G=o=>l(s=>({...s,labelId:o||void 0})),H=o=>l(s=>({...s,name:o})),J=o=>l(s=>({...s,scope:o,until:o==="until"?s.until:void 0})),V=o=>l(s=>({...s,until:o})),W=()=>{const o=z(n,f)||_(n,f),s=ze(n,f);if(Object.keys(s).length===0){d();return}b(o),j.updateFilter(s)},Y=()=>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(Be,{}):j.isError?t.jsx(qe,{onRetry:j.reset,onClose:d}):j.isSuccess?h?t.jsx(Ue,{preview:ae(C),blocked:C.status!=="ready"||C.stale===!0,onReapply:Y,onClose:d}):t.jsx(Qe,{onClose:d}):t.jsx(se,{rule:n,folders:r,delimiter:i,labels:c,preview:C,semanticAvailable:!1,clauseFields:L,anchorLocked:!0,clauseEdit:m,onStartAddClause:p,onStartEditClause:O,onRemoveClause:U,onChangeDraftField:E,onChangeDraftValue:B,onSubmitClause:Q,onCancelClause:()=>u(void 0),onChangeMatchOperator:K,onChangeMove:q,onCreateFolder:F,onChangeLabel:G,onCreateLabel:I,onChangeName:H,onChangeScope:J,onChangeUntil:V,onCommit:W,onCancel:d})}function Be(){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 Qe({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 Ue({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 qe({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 Ge({accountId:e,filter:a,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d}){const f=ve(),n=t.jsx(_e,{accountId:e,filter:a,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d});return f?t.jsx(ie,{open:!0,onClose:d,title:"Filter rule",children:n}):t.jsx(ge,{open:!0,onClose:d,dismissLabel:"Dismiss filter rule",children:n})}function He({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(ne,{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(re,{widen:{anchorCount:1,...d?{inactive:!0}:{}}}),h&&t.jsx(oe,{label:{labelId:h.id,name:h.name,color:h.color}})]})]}),t.jsx(N,{variant:"ghost",size:"sm",icon:t.jsx(le,{className:"size-4 text-danger"}),onClick:()=>c(n.filterId),disabled:g===n.filterId,"aria-label":`Delete filter ${n.name}`})]},n.filterId)})})}const Je=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 Ve({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({...ce({path:{accountId:a}}),staleTime:1/0}),h=ye(),b=x.useMemo(()=>de(e.folderAppointments),[e.folderAppointments]),M=x.useCallback(p=>{const O=u?.items.find(E=>E.mailboxId===p);if(O)return me(O,b.get(p),h)},[u?.items,b,h]),C=x.useMemo(()=>je({mailboxes:u?.items??[],folderAppointments:e.folderAppointments,translator:h}),[u?.items,e.folderAppointments,h]),j=Ne(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(Ge,{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(He,{filters:r,mailboxName:M,labelById:w,onEdit:m,onDelete:f,deletingFilterId:n})]})}function ct(){const e=ue(),[a,r]=x.useState(!0),{data:i,isPending:c,isError:g,error:d,refetch:f}=P(pe()),n=l=>{const m=fe[l];m&&e({to:m})};return t.jsx(he,{items:xe,activeId:"filters",title:"Filters",description:"Standing and temporary rules created by Organize, per account.",help:Je,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(Ve,{account:l},l.accountId))})})}export{Ve as AccountFilters,ct as component};
|
|
1
|
+
import{n as X,a7 as Z,aO as ee,aP as te,r as x,j as t,aQ as ae,aR as se,af as R,B as N,an as ie,at as ne,aS as re,aT as oe,T as le,s as P,q as ce,v as de,x as me,m as ue,Q as pe,ar as xe,av as fe}from"./index-M_tY9XTt.js";import{S as he}from"./settings-screen-SE1NBJSJ.js";import{B as ge}from"./bottom-sheet-Bw8q9Cma.js";import{u as ve}from"./useMediaQuery-D0jZQl9A.js";import{u as be,a as ye,b as je,f as Ne}from"./move-options-E3q-ftA4.js";import{u as Ce,a as Se}from"./useLabels-BfLvkcxZ.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-BxSvo_8a.js";import{C as A}from"./circle-check-CtwlOpag.js";import{E as $}from"./ErrorState-BF7k9VeT.js";import"./avatar-CFndQH5R.js";import"./menu-DnyLlQ6R.js";import"./circle-help-6oY_xcWT.js";import"./enums-CCxx0t2v.js";const Re=(e,a)=>{const r=X(),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??"":""}),_=(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),_(e,a)&&(r.scope=e.scope==="until"?"Temporary":"Standing",e.scope==="until"&&(r.expiresAt=Me(e.until??""))),r};function _e({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}=be(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}}),B=o=>u(s=>s&&{...s,draft:{...s.draft,value:o}}),Q=()=>{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))},U=o=>l(s=>({...s,clauses:s.clauses.filter(y=>y.id!==o)})),K=o=>l(s=>({...s,matchOperator:o})),q=o=>l(s=>({...s,moveMailboxId:o||void 0})),G=o=>l(s=>({...s,labelId:o||void 0})),H=o=>l(s=>({...s,name:o})),J=o=>l(s=>({...s,scope:o,until:o==="until"?s.until:void 0})),V=o=>l(s=>({...s,until:o})),W=()=>{const o=z(n,f)||_(n,f),s=ze(n,f);if(Object.keys(s).length===0){d();return}b(o),j.updateFilter(s)},Y=()=>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(Be,{}):j.isError?t.jsx(qe,{onRetry:j.reset,onClose:d}):j.isSuccess?h?t.jsx(Ue,{preview:ae(C),blocked:C.status!=="ready"||C.stale===!0,onReapply:Y,onClose:d}):t.jsx(Qe,{onClose:d}):t.jsx(se,{rule:n,folders:r,delimiter:i,labels:c,preview:C,semanticAvailable:!1,clauseFields:L,anchorLocked:!0,clauseEdit:m,onStartAddClause:p,onStartEditClause:O,onRemoveClause:U,onChangeDraftField:E,onChangeDraftValue:B,onSubmitClause:Q,onCancelClause:()=>u(void 0),onChangeMatchOperator:K,onChangeMove:q,onCreateFolder:F,onChangeLabel:G,onCreateLabel:I,onChangeName:H,onChangeScope:J,onChangeUntil:V,onCommit:W,onCancel:d})}function Be(){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 Qe({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 Ue({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 qe({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 Ge({accountId:e,filter:a,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d}){const f=ve(),n=t.jsx(_e,{accountId:e,filter:a,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d});return f?t.jsx(ie,{open:!0,onClose:d,title:"Filter rule",children:n}):t.jsx(ge,{open:!0,onClose:d,dismissLabel:"Dismiss filter rule",children:n})}function He({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(ne,{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(re,{widen:{anchorCount:1,...d?{inactive:!0}:{}}}),h&&t.jsx(oe,{label:{labelId:h.id,name:h.name,color:h.color}})]})]}),t.jsx(N,{variant:"ghost",size:"sm",icon:t.jsx(le,{className:"size-4 text-danger"}),onClick:()=>c(n.filterId),disabled:g===n.filterId,"aria-label":`Delete filter ${n.name}`})]},n.filterId)})})}const Je=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 Ve({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({...ce({path:{accountId:a}}),staleTime:1/0}),h=ye(),b=x.useMemo(()=>de(e.folderAppointments),[e.folderAppointments]),M=x.useCallback(p=>{const O=u?.items.find(E=>E.mailboxId===p);if(O)return me(O,b.get(p),h)},[u?.items,b,h]),C=x.useMemo(()=>je({mailboxes:u?.items??[],folderAppointments:e.folderAppointments,translator:h}),[u?.items,e.folderAppointments,h]),j=Ne(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(Ge,{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(He,{filters:r,mailboxName:M,labelById:w,onEdit:m,onDelete:f,deletingFilterId:n})]})}function ct(){const e=ue(),[a,r]=x.useState(!0),{data:i,isPending:c,isError:g,error:d,refetch:f}=P(pe()),n=l=>{const m=fe[l];m&&e({to:m})};return t.jsx(he,{items:xe,activeId:"filters",title:"Filters",description:"Standing and temporary rules created by Organize, per account.",help:Je,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(Ve,{account:l},l.accountId))})})}export{Ve as AccountFilters,ct as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o,U as i}from"./index-M_tY9XTt.js";import{a as m}from"./search-view-k-zJxJGB.js";import{F as r}from"./FlaggedPane-DfrV_6op.js";import{u as p}from"./useSearchMirror-Dbv78_0t.js";import"./useMessageBodyContent-BVHgD2uM.js";import{f as e}from"./search-token-index-Dq1YsfkF.js";import"./FullCompose-DH3l81DA.js";import"./ErrorState-BF7k9VeT.js";import"./index-DJa-q1BD.js";import"./useSignature-B9-4He3j.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CVloHKPu.js";import"./useMediaQuery-D0jZQl9A.js";import"./confirm-dialog-tiuVS57c.js";import"./useSearchTokenContext-DU66fBNH.js";import"./kbd-BHAPJuqc.js";import"./enums-CCxx0t2v.js";import"./search-scope-BqP7bipM.js";import"./MailListHeader-BIcOZoHT.js";import"./attachment-file-uAdi6sKR.js";import"./mail-D6GOeJKp.js";import"./avatar-CFndQH5R.js";import"./format-HasNd5qT.js";import"./download-DM2bn95G.js";import"./shield-check-CFPVcDje.js";import"./move-options-E3q-ftA4.js";import"./useFilters-BxSvo_8a.js";import"./clock-Cm_TLM05.js";import"./menu-DnyLlQ6R.js";import"./MailViewChrome-D2WwK5Zk.js";function z(){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{z as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r}from"./index-
|
|
1
|
+
import{j as r}from"./index-M_tY9XTt.js";import{E as o}from"./ErrorState-BF7k9VeT.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 +1 @@
|
|
|
1
|
-
import{j as e,B as j,T as R,aU as V,r as u,an as G,X as H,aw as ie,ad as Y,F as le,aA as W,aV as ce,ac as de,ag as me,az as xe,n as X,J as Z,V as J,aW as ue,aX as he,aY as fe,aZ as U,x as z,v as ee,af as q,as as se,a_ as pe,a3 as ge,m as be,s as te,Q as je,ar as ve,av as ye,q as Ne,a7 as B,a$ as Ce,b0 as ke,aD as Me,b1 as we}from"./index-D4GNMXJp.js";import{P as Ie}from"./pencil-CqMvXV0T.js";import{S as Se}from"./settings-screen-Dxy8IIO7.js";import{c as Oe,d as F,e as Ae,M as De,i as Q,u as ae,a as re,b as Ee,m as K,g as Te}from"./move-options-B0LunqBm.js";import{E as ne}from"./ErrorState-C1oxCUkU.js";import"./avatar-P6pfWsVW.js";import"./menu-kXyiT8p3.js";import"./circle-help-Bf0O-YS0.js";import"./enums-CCxx0t2v.js";const Fe=({label:s,onRename:n,onDelete:t,deleteBlockedReason:i,renameLabel:d=c=>`Rename ${c}`,deleteLabel:r=c=>`Delete ${c}`})=>{const c=i?`${r(s)} — ${i}`:r(s);return e.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 pr-2",children:[e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(Ie,{className:"size-3.5"}),"aria-label":d(s),onClick:n}),e.jsx("span",{title:i,children:e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(R,{className:"size-3.5"}),"aria-label":c,disabled:i!==void 0,onClick:t})})]})},Pe=({folders:s,onRename:n,onDelete:t,onCreateFolder:i,delimiter:d,labels:r})=>{const c=new Map(s.map(o=>[o.id,o]));return e.jsx(V,{folders:s,onCreateFolder:i,delimiter:d,labels:{treeAriaLabel:"Your folders",optionLabel:o=>o,...r},rowActions:o=>{const a=c.get(o.id);return a?e.jsx(Fe,{label:a.label,deleteBlockedReason:a.deleteBlockedReason,renameLabel:r?.rename,deleteLabel:r?.remove,onRename:()=>n(a),onDelete:()=>t(a)}):null}})},Re=({open:s,folderLabel:n,defaultLabel:t,name:i,onNameChange:d,onSubmit:r,onClose:c,pending:o=!1,error:a})=>{const l=u.useId(),p=`Rename ${n}`;return s?e.jsxs(G,{open:s,onClose:c,title:p,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:p}),e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(H,{className:"size-3.5"}),onClick:c,"aria-label":"Cancel"})]}),e.jsxs("div",{className:"space-y-3 px-5 py-4",children:[e.jsxs("div",{children:[e.jsx(ie,{htmlFor:l,children:"Folder name"}),e.jsx(Y,{id:l,value:i,placeholder:t,onChange:m=>d(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.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:t}),"."]}),a&&e.jsx("p",{className:"text-xs text-danger",role:"alert",children:a})]}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(j,{variant:"secondary",size:"sm",onClick:c,children:"Cancel"}),e.jsx(j,{variant:"primary",size:"sm",onClick:r,disabled:o,children:o?"Saving…":"Save name"})]})]}):null},ze=["inbox","drafts","sent","archive","junk","trash"],L="";function Le(s){const n=s.messageCount===1?"msg":"msgs";return`${W(s.providerPath)} · ${s.messageCount} ${n}`}function $e({role:s,folders:n,appointedId:t,displayName:i,onAppoint:d,onRename:r}){const[c,o]=u.useState(i),a=n.find(m=>m.mailboxId===t)??null,l=xe(s),p=a!=null&&c.trim()!==i.trim();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:[ce(s),l]}),e.jsxs(de,{className:"w-56 shrink-0",value:t??L,"aria-label":`Folder for ${l}`,onChange:m=>d(s,m.target.value===L?null:m.target.value),children:[e.jsx("option",{value:L,children:"None"}),n.map(m=>e.jsx("option",{value:m.mailboxId,children:Le(m)},m.mailboxId))]}),a&&e.jsxs(e.Fragment,{children:[e.jsx(Y,{className:"flex-1",value:c,placeholder:l,"aria-label":`Display name for ${l}`,onChange:m=>o(m.target.value)}),p&&e.jsx(j,{variant:"ghost",size:"sm",className:"shrink-0",icon:e.jsx(me,{className:"size-4"}),"aria-label":"Save display name",onClick:()=>r(a.mailboxId,c)})]})]}),a&&e.jsxs("span",{className:"truncate pl-[7.5rem] text-2xs text-fg-subtle",title:a.providerPath,children:[a.providerPath," · ",a.messageCount," ",a.messageCount===1?"message":"messages"]})]})}function _e({accountEmail:s,folders:n,appointments:t,displayNames:i={},onAppoint:d,onRename:r}){const c=new Set(Object.values(t).filter(a=>a!=null)),o=n.filter(a=>!c.has(a.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."})]}),e.jsx("div",{className:"rounded-sm border border-line bg-surface",children:ze.map(a=>{const l=t[a]??null;return e.jsx($e,{role:a,folders:n,appointedId:l,displayName:l?i[l]??"":"",onAppoint:d,onRename:r},a)})}),o.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:o.map(a=>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(le,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate",children:W(a.providerPath)}),e.jsxs("span",{className:"ml-auto shrink-0 text-2xs text-fg-subtle",children:[a.messageCount," ",a.messageCount===1?"message":"messages"]})]},a.mailboxId))})]})]})}const oe=50,qe=s=>s instanceof Error?s.message:"Something went wrong.",T=s=>s.then(n=>({ok:!0,value:n}),n=>({ok:!1,error:qe(n)})),Be=async(s,n,t,i)=>{const d=[];let r;for(let c=0;c<oe;c+=1){if(i.aborted)return d;const{data:o}=await U({path:{mailboxId:s},query:{order:"desc",continuationToken:r},throwOnError:!0});for(const a of o.items)if(!a.isDeleted&&!n.has(a.messageId)&&!d.includes(a.messageId)&&(d.push(a.messageId),d.length>=t))return d;if(!o.continuationToken)break;r=o.continuationToken}return d},Qe=async(s,n)=>{let t=0,i;for(let d=0;d<oe;d+=1){if(n.aborted)return t;const{data:r}=await U({path:{mailboxId:s},query:{order:"desc",continuationToken:i},throwOnError:!0});for(const c of r.items)c.isDeleted||(t+=1);if(!r.continuationToken)break;i=r.continuationToken}return t};function Ke({accountId:s,mailboxId:n,onDeleted:t}){const i=X(),[d,r]=u.useState("idle"),[c,o]=u.useState(null),[a,l]=u.useState(),p=u.useRef(null),m=u.useCallback(()=>{i.invalidateQueries({queryKey:Z({path:{accountId:s}})}),i.invalidateQueries({queryKey:J()})},[i,s]),N=u.useCallback(async()=>{r("deleting");const b=await T(ue({path:{accountId:s,mailboxId:n},throwOnError:!0}));if(!b.ok){l(b.error),r("error");return}m(),r("done"),t()},[s,n,m,t]),C=u.useCallback(()=>he({path:{accountId:s},throwOnError:!0}).then(({data:b})=>b.items.find(g=>g.mailboxId===n)?.messageCount??0),[s,n]),E=u.useCallback(()=>{p.current?.abort()},[]),w=u.useCallback(async b=>{const g=new AbortController;p.current=g;const{signal:f}=g;r("moving"),l(void 0);const I=await T(C());if(f.aborted)return;if(!I.ok){l(I.error),r("error");return}let h=Oe(I.value);o(h);const k=new Set;for(;;){if(f.aborted)return;const v=await T(Be(n,k,De,f));if(f.aborted)return;if(!v.ok){h=F(h,v.error),o(h),l(v.error),r("error");return}const M=v.value;if(M.length===0)break;const A=await T(fe({body:{messageIds:M,destinationMailboxId:b},throwOnError:!0}));if(f.aborted)return;if(!A.ok){h=F(h,A.error),o(h),l(A.error),r("error");return}for(const S of M)k.add(S);h=Ae(h,M.length),o(h)}const y=await T(Qe(n,f));if(!f.aborted){if(!y.ok){h=F(h,y.error),o(h),l(y.error),r("error");return}if(y.value>0){const v=`${y.value} ${y.value===1?"email is":"emails are"} still syncing. Re-open delete to finish removing this folder.`;h=F(h,v),o(h),l(v),r("error"),m();return}await N()}},[n,C,N,m]),D=u.useCallback(()=>{p.current?.abort(),p.current=null,r("idle"),o(null),l(void 0)},[]);return{phase:d,progress:c,errorMessage:a,deleteMailbox:N,moveThenDelete:w,cancel:E,reset:D}}const P=s=>`${s} ${s===1?"email":"emails"}`;function Ve({open:s,accountId:n,folder:t,mailboxes:i,appointments:d,onClose:r}){const[c,o]=u.useState(()=>Q(t.messageCount)),[a,l]=u.useState(),{createFolderIn:p}=ae(n),m=re(),{phase:N,progress:C,errorMessage:E,deleteMailbox:w,moveThenDelete:D,cancel:b,reset:g}=Ke({accountId:n,mailboxId:t.mailboxId,onDeleted:r});u.useEffect(()=>{s&&(o(Q(t.messageCount)),g())},[s,t.messageCount,g]),u.useEffect(()=>{s&&l(void 0)},[s]),u.useEffect(()=>b,[b]);const f=u.useCallback(()=>{b(),r()},[b,r]),I=u.useMemo(()=>Ee({mailboxes:i,folderAppointments:d,excludeMailboxId:t.mailboxId,translator:m}),[i,d,t.mailboxId,m]),h=I.find(M=>M.id===a),k=u.useMemo(()=>z(t,ee(d).get(t.mailboxId),m),[t,d,m]);if(!s)return null;const y=`Delete ${k}`,v=N==="moving"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(q,{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:C?K(C):"Moved 0 of 0"})]}):N==="deleting"||N==="done"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(q,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Deleting folder…"})]}):N==="error"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(se,{tone:"danger",variant:"soft",children:E??"Something went wrong. Please try again."}),C&&e.jsxs("p",{className:"text-xs text-fg-muted",children:[K(C),". Already-moved emails stay moved — re-open delete to continue with the rest."]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(j,{variant:"secondary",size:"sm",onClick:f,children:"Close"})})]}):c==="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:k}),"? 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(j,{variant:"secondary",size:"sm",onClick:f,children:"Cancel"}),e.jsx(j,{variant:"danger",size:"sm",icon:e.jsx(R,{className:"size-3.5"}),onClick:()=>w(),children:"Delete folder"})]})]}):c==="choose-fate"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:k})," holds"," ",P(t.messageCount),". What should happen to them?"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{type:"button",onClick:()=>o("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(R,{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:()=>o("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(pe,{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(j,{variant:"secondary",size:"sm",onClick:f,children:"Cancel"})})]}):c==="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:k})," and its"," ",P(t.messageCount),"? 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(j,{variant:"secondary",size:"sm",onClick:()=>o("choose-fate"),children:"Back"}),e.jsx(j,{variant:"danger",size:"sm",icon:e.jsx(R,{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 ",P(t.messageCount)," in"," ",e.jsx("strong",{className:"text-fg",children:k})," to:"]}),e.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:e.jsx(V,{folders:I,selectedId:a,delimiter:i[0]?.hierarchyDelimiter??"/",onSelect:l,onCreateFolder:p,onCancel:()=>{l(void 0),o("choose-fate")},labels:{filterPlaceholder:"Move emails to…"}})}),h&&e.jsx("footer",{className:"shrink-0 border-t border-line p-2",children:e.jsx(j,{variant:"danger",onClick:()=>D(h.id),className:"h-11 w-full font-semibold",children:e.jsx("span",{className:"truncate",children:`Move ${P(t.messageCount)} to ${h.label}`})})})]});return e.jsxs(G,{open:s,onClose:f,title:y,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx(ge,{className:"size-4 shrink-0 text-danger"}),e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:y}),e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(H,{className:"size-3.5"}),onClick:f,"aria-label":"Cancel"})]}),v]})}const Ge=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 He({account:s}){const n=X(),t=s.accountId,i=re(),{data:d,isPending:r,isError:c,error:o,refetch:a}=te(Ne({path:{accountId:t}})),{createFolderIn:l}=ae(t),p=B({...Ce(),onSuccess:()=>{n.invalidateQueries({queryKey:J()})}}),m=B({...ke(),onSuccess:()=>{n.invalidateQueries({queryKey:Z({path:{accountId:t}})})}}),[N,C]=u.useState(),[E,w]=u.useState(),[D,b]=u.useState(""),g=u.useMemo(()=>d?.items??[],[d]),f=u.useMemo(()=>ee(s.folderAppointments),[s.folderAppointments]),I=u.useMemo(()=>g.map(x=>({id:x.mailboxId,label:z(x,f.get(x.mailboxId),i),path:x.fullPath,deleteBlockedReason:Te(x,g,s.folderAppointments).message})),[g,f,i,s.folderAppointments]),h=(x,O)=>{p.mutate({path:{accountId:t,role:we[x]},body:{mailboxId:O}})},k=(x,O)=>{const _=O.trim();m.mutate({path:{accountId:t,mailboxId:x},body:{displayNameOverride:_===""?null:_}})};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(c)return e.jsx(ne,{variant:"inline",title:`Couldn't load folders for ${s.email}`,error:o,onRetry:()=>{a()}});const y=g.map(x=>({mailboxId:x.mailboxId,providerPath:x.fullPath,messageCount:x.messageCount})),v={};for(const x of s.folderAppointments){const O=Me[x.role];O&&(v[O]=x.mailboxId??null)}const M={};for(const x of g)x.displayNameOverride&&(M[x.mailboxId]=x.displayNameOverride);const A=x=>g.find(O=>O.mailboxId===x),S=A(E),$=A(N);return e.jsxs("div",{className:"space-y-4",children:[(p.isError||m.isError)&&e.jsx(se,{tone:"danger",variant:"soft",children:"Couldn't save that change. Please try again."}),e.jsx(_e,{accountEmail:s.email,folders:y,appointments:v,displayNames:M,onAppoint:h,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(Pe,{folders:I,delimiter:g[0]?.hierarchyDelimiter??"/",onCreateFolder:l,onRename:x=>{w(x.id),b(A(x.id)?.displayNameOverride?.trim()??"")},onDelete:x=>C(x.id),labels:{treeAriaLabel:`All folders for ${s.email}`}})})]}),S&&e.jsx(Re,{open:!0,folderLabel:z(S,f.get(S.mailboxId),i),defaultLabel:z({fullPath:S.fullPath},f.get(S.mailboxId),i),name:D,onNameChange:b,pending:m.isPending,error:m.isError?"Couldn't save that name. Please try again.":void 0,onSubmit:()=>{const x=D.trim();m.mutate({path:{accountId:t,mailboxId:S.mailboxId},body:{displayNameOverride:x===""?null:x}},{onSuccess:()=>w(void 0)})},onClose:()=>w(void 0)}),$&&e.jsx(Ve,{open:!0,accountId:t,folder:$,mailboxes:g,appointments:s.folderAppointments,onClose:()=>C(void 0)})]})}function as(){const s=be(),[n,t]=u.useState(!0),{data:i,isPending:d,isError:r,error:c,refetch:o}=te(je()),a=l=>{const p=ye[l];p&&s({to:p})};return e.jsx(Se,{items:ve,activeId:"folders",title:"Folder roles",description:"Appoint which real folder fills each canonical role, per account.",help:Ge,helpOpen:n,onToggleHelp:()=>t(l=>!l),onSelect:a,onBackToMail:()=>{s({to:"/mail"})},children:d?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(ne,{title:"Couldn't load accounts",error:c,onRetry:()=>{o()}}):i.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:i.accounts.map(l=>e.jsx(He,{account:l},l.accountId))})})}export{as as component};
|
|
1
|
+
import{j as e,B as j,T as R,aU as V,r as u,an as G,X as H,aw as ie,ad as Y,F as le,aA as W,aV as ce,ac as de,ag as me,az as xe,n as X,J as Z,V as J,aW as ue,aX as he,aY as fe,aZ as U,x as z,v as ee,af as q,as as se,a_ as pe,a3 as ge,m as be,s as te,Q as je,ar as ve,av as ye,q as Ne,a7 as B,a$ as Ce,b0 as ke,aD as Me,b1 as we}from"./index-M_tY9XTt.js";import{P as Ie}from"./pencil-Dv_vxc_I.js";import{S as Se}from"./settings-screen-SE1NBJSJ.js";import{c as Oe,d as F,e as Ae,M as De,i as Q,u as ae,a as re,b as Ee,m as K,g as Te}from"./move-options-E3q-ftA4.js";import{E as ne}from"./ErrorState-BF7k9VeT.js";import"./avatar-CFndQH5R.js";import"./menu-DnyLlQ6R.js";import"./circle-help-6oY_xcWT.js";import"./enums-CCxx0t2v.js";const Fe=({label:s,onRename:n,onDelete:t,deleteBlockedReason:i,renameLabel:d=c=>`Rename ${c}`,deleteLabel:r=c=>`Delete ${c}`})=>{const c=i?`${r(s)} — ${i}`:r(s);return e.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 pr-2",children:[e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(Ie,{className:"size-3.5"}),"aria-label":d(s),onClick:n}),e.jsx("span",{title:i,children:e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(R,{className:"size-3.5"}),"aria-label":c,disabled:i!==void 0,onClick:t})})]})},Pe=({folders:s,onRename:n,onDelete:t,onCreateFolder:i,delimiter:d,labels:r})=>{const c=new Map(s.map(o=>[o.id,o]));return e.jsx(V,{folders:s,onCreateFolder:i,delimiter:d,labels:{treeAriaLabel:"Your folders",optionLabel:o=>o,...r},rowActions:o=>{const a=c.get(o.id);return a?e.jsx(Fe,{label:a.label,deleteBlockedReason:a.deleteBlockedReason,renameLabel:r?.rename,deleteLabel:r?.remove,onRename:()=>n(a),onDelete:()=>t(a)}):null}})},Re=({open:s,folderLabel:n,defaultLabel:t,name:i,onNameChange:d,onSubmit:r,onClose:c,pending:o=!1,error:a})=>{const l=u.useId(),p=`Rename ${n}`;return s?e.jsxs(G,{open:s,onClose:c,title:p,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:p}),e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(H,{className:"size-3.5"}),onClick:c,"aria-label":"Cancel"})]}),e.jsxs("div",{className:"space-y-3 px-5 py-4",children:[e.jsxs("div",{children:[e.jsx(ie,{htmlFor:l,children:"Folder name"}),e.jsx(Y,{id:l,value:i,placeholder:t,onChange:m=>d(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.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:t}),"."]}),a&&e.jsx("p",{className:"text-xs text-danger",role:"alert",children:a})]}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(j,{variant:"secondary",size:"sm",onClick:c,children:"Cancel"}),e.jsx(j,{variant:"primary",size:"sm",onClick:r,disabled:o,children:o?"Saving…":"Save name"})]})]}):null},ze=["inbox","drafts","sent","archive","junk","trash"],L="";function Le(s){const n=s.messageCount===1?"msg":"msgs";return`${W(s.providerPath)} · ${s.messageCount} ${n}`}function $e({role:s,folders:n,appointedId:t,displayName:i,onAppoint:d,onRename:r}){const[c,o]=u.useState(i),a=n.find(m=>m.mailboxId===t)??null,l=xe(s),p=a!=null&&c.trim()!==i.trim();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:[ce(s),l]}),e.jsxs(de,{className:"w-56 shrink-0",value:t??L,"aria-label":`Folder for ${l}`,onChange:m=>d(s,m.target.value===L?null:m.target.value),children:[e.jsx("option",{value:L,children:"None"}),n.map(m=>e.jsx("option",{value:m.mailboxId,children:Le(m)},m.mailboxId))]}),a&&e.jsxs(e.Fragment,{children:[e.jsx(Y,{className:"flex-1",value:c,placeholder:l,"aria-label":`Display name for ${l}`,onChange:m=>o(m.target.value)}),p&&e.jsx(j,{variant:"ghost",size:"sm",className:"shrink-0",icon:e.jsx(me,{className:"size-4"}),"aria-label":"Save display name",onClick:()=>r(a.mailboxId,c)})]})]}),a&&e.jsxs("span",{className:"truncate pl-[7.5rem] text-2xs text-fg-subtle",title:a.providerPath,children:[a.providerPath," · ",a.messageCount," ",a.messageCount===1?"message":"messages"]})]})}function _e({accountEmail:s,folders:n,appointments:t,displayNames:i={},onAppoint:d,onRename:r}){const c=new Set(Object.values(t).filter(a=>a!=null)),o=n.filter(a=>!c.has(a.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."})]}),e.jsx("div",{className:"rounded-sm border border-line bg-surface",children:ze.map(a=>{const l=t[a]??null;return e.jsx($e,{role:a,folders:n,appointedId:l,displayName:l?i[l]??"":"",onAppoint:d,onRename:r},a)})}),o.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:o.map(a=>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(le,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate",children:W(a.providerPath)}),e.jsxs("span",{className:"ml-auto shrink-0 text-2xs text-fg-subtle",children:[a.messageCount," ",a.messageCount===1?"message":"messages"]})]},a.mailboxId))})]})]})}const oe=50,qe=s=>s instanceof Error?s.message:"Something went wrong.",T=s=>s.then(n=>({ok:!0,value:n}),n=>({ok:!1,error:qe(n)})),Be=async(s,n,t,i)=>{const d=[];let r;for(let c=0;c<oe;c+=1){if(i.aborted)return d;const{data:o}=await U({path:{mailboxId:s},query:{order:"desc",continuationToken:r},throwOnError:!0});for(const a of o.items)if(!a.isDeleted&&!n.has(a.messageId)&&!d.includes(a.messageId)&&(d.push(a.messageId),d.length>=t))return d;if(!o.continuationToken)break;r=o.continuationToken}return d},Qe=async(s,n)=>{let t=0,i;for(let d=0;d<oe;d+=1){if(n.aborted)return t;const{data:r}=await U({path:{mailboxId:s},query:{order:"desc",continuationToken:i},throwOnError:!0});for(const c of r.items)c.isDeleted||(t+=1);if(!r.continuationToken)break;i=r.continuationToken}return t};function Ke({accountId:s,mailboxId:n,onDeleted:t}){const i=X(),[d,r]=u.useState("idle"),[c,o]=u.useState(null),[a,l]=u.useState(),p=u.useRef(null),m=u.useCallback(()=>{i.invalidateQueries({queryKey:Z({path:{accountId:s}})}),i.invalidateQueries({queryKey:J()})},[i,s]),N=u.useCallback(async()=>{r("deleting");const b=await T(ue({path:{accountId:s,mailboxId:n},throwOnError:!0}));if(!b.ok){l(b.error),r("error");return}m(),r("done"),t()},[s,n,m,t]),C=u.useCallback(()=>he({path:{accountId:s},throwOnError:!0}).then(({data:b})=>b.items.find(g=>g.mailboxId===n)?.messageCount??0),[s,n]),E=u.useCallback(()=>{p.current?.abort()},[]),w=u.useCallback(async b=>{const g=new AbortController;p.current=g;const{signal:f}=g;r("moving"),l(void 0);const I=await T(C());if(f.aborted)return;if(!I.ok){l(I.error),r("error");return}let h=Oe(I.value);o(h);const k=new Set;for(;;){if(f.aborted)return;const v=await T(Be(n,k,De,f));if(f.aborted)return;if(!v.ok){h=F(h,v.error),o(h),l(v.error),r("error");return}const M=v.value;if(M.length===0)break;const A=await T(fe({body:{messageIds:M,destinationMailboxId:b},throwOnError:!0}));if(f.aborted)return;if(!A.ok){h=F(h,A.error),o(h),l(A.error),r("error");return}for(const S of M)k.add(S);h=Ae(h,M.length),o(h)}const y=await T(Qe(n,f));if(!f.aborted){if(!y.ok){h=F(h,y.error),o(h),l(y.error),r("error");return}if(y.value>0){const v=`${y.value} ${y.value===1?"email is":"emails are"} still syncing. Re-open delete to finish removing this folder.`;h=F(h,v),o(h),l(v),r("error"),m();return}await N()}},[n,C,N,m]),D=u.useCallback(()=>{p.current?.abort(),p.current=null,r("idle"),o(null),l(void 0)},[]);return{phase:d,progress:c,errorMessage:a,deleteMailbox:N,moveThenDelete:w,cancel:E,reset:D}}const P=s=>`${s} ${s===1?"email":"emails"}`;function Ve({open:s,accountId:n,folder:t,mailboxes:i,appointments:d,onClose:r}){const[c,o]=u.useState(()=>Q(t.messageCount)),[a,l]=u.useState(),{createFolderIn:p}=ae(n),m=re(),{phase:N,progress:C,errorMessage:E,deleteMailbox:w,moveThenDelete:D,cancel:b,reset:g}=Ke({accountId:n,mailboxId:t.mailboxId,onDeleted:r});u.useEffect(()=>{s&&(o(Q(t.messageCount)),g())},[s,t.messageCount,g]),u.useEffect(()=>{s&&l(void 0)},[s]),u.useEffect(()=>b,[b]);const f=u.useCallback(()=>{b(),r()},[b,r]),I=u.useMemo(()=>Ee({mailboxes:i,folderAppointments:d,excludeMailboxId:t.mailboxId,translator:m}),[i,d,t.mailboxId,m]),h=I.find(M=>M.id===a),k=u.useMemo(()=>z(t,ee(d).get(t.mailboxId),m),[t,d,m]);if(!s)return null;const y=`Delete ${k}`,v=N==="moving"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(q,{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:C?K(C):"Moved 0 of 0"})]}):N==="deleting"||N==="done"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(q,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Deleting folder…"})]}):N==="error"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(se,{tone:"danger",variant:"soft",children:E??"Something went wrong. Please try again."}),C&&e.jsxs("p",{className:"text-xs text-fg-muted",children:[K(C),". Already-moved emails stay moved — re-open delete to continue with the rest."]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(j,{variant:"secondary",size:"sm",onClick:f,children:"Close"})})]}):c==="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:k}),"? 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(j,{variant:"secondary",size:"sm",onClick:f,children:"Cancel"}),e.jsx(j,{variant:"danger",size:"sm",icon:e.jsx(R,{className:"size-3.5"}),onClick:()=>w(),children:"Delete folder"})]})]}):c==="choose-fate"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:k})," holds"," ",P(t.messageCount),". What should happen to them?"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{type:"button",onClick:()=>o("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(R,{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:()=>o("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(pe,{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(j,{variant:"secondary",size:"sm",onClick:f,children:"Cancel"})})]}):c==="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:k})," and its"," ",P(t.messageCount),"? 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(j,{variant:"secondary",size:"sm",onClick:()=>o("choose-fate"),children:"Back"}),e.jsx(j,{variant:"danger",size:"sm",icon:e.jsx(R,{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 ",P(t.messageCount)," in"," ",e.jsx("strong",{className:"text-fg",children:k})," to:"]}),e.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:e.jsx(V,{folders:I,selectedId:a,delimiter:i[0]?.hierarchyDelimiter??"/",onSelect:l,onCreateFolder:p,onCancel:()=>{l(void 0),o("choose-fate")},labels:{filterPlaceholder:"Move emails to…"}})}),h&&e.jsx("footer",{className:"shrink-0 border-t border-line p-2",children:e.jsx(j,{variant:"danger",onClick:()=>D(h.id),className:"h-11 w-full font-semibold",children:e.jsx("span",{className:"truncate",children:`Move ${P(t.messageCount)} to ${h.label}`})})})]});return e.jsxs(G,{open:s,onClose:f,title:y,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx(ge,{className:"size-4 shrink-0 text-danger"}),e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:y}),e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(H,{className:"size-3.5"}),onClick:f,"aria-label":"Cancel"})]}),v]})}const Ge=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 He({account:s}){const n=X(),t=s.accountId,i=re(),{data:d,isPending:r,isError:c,error:o,refetch:a}=te(Ne({path:{accountId:t}})),{createFolderIn:l}=ae(t),p=B({...Ce(),onSuccess:()=>{n.invalidateQueries({queryKey:J()})}}),m=B({...ke(),onSuccess:()=>{n.invalidateQueries({queryKey:Z({path:{accountId:t}})})}}),[N,C]=u.useState(),[E,w]=u.useState(),[D,b]=u.useState(""),g=u.useMemo(()=>d?.items??[],[d]),f=u.useMemo(()=>ee(s.folderAppointments),[s.folderAppointments]),I=u.useMemo(()=>g.map(x=>({id:x.mailboxId,label:z(x,f.get(x.mailboxId),i),path:x.fullPath,deleteBlockedReason:Te(x,g,s.folderAppointments).message})),[g,f,i,s.folderAppointments]),h=(x,O)=>{p.mutate({path:{accountId:t,role:we[x]},body:{mailboxId:O}})},k=(x,O)=>{const _=O.trim();m.mutate({path:{accountId:t,mailboxId:x},body:{displayNameOverride:_===""?null:_}})};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(c)return e.jsx(ne,{variant:"inline",title:`Couldn't load folders for ${s.email}`,error:o,onRetry:()=>{a()}});const y=g.map(x=>({mailboxId:x.mailboxId,providerPath:x.fullPath,messageCount:x.messageCount})),v={};for(const x of s.folderAppointments){const O=Me[x.role];O&&(v[O]=x.mailboxId??null)}const M={};for(const x of g)x.displayNameOverride&&(M[x.mailboxId]=x.displayNameOverride);const A=x=>g.find(O=>O.mailboxId===x),S=A(E),$=A(N);return e.jsxs("div",{className:"space-y-4",children:[(p.isError||m.isError)&&e.jsx(se,{tone:"danger",variant:"soft",children:"Couldn't save that change. Please try again."}),e.jsx(_e,{accountEmail:s.email,folders:y,appointments:v,displayNames:M,onAppoint:h,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(Pe,{folders:I,delimiter:g[0]?.hierarchyDelimiter??"/",onCreateFolder:l,onRename:x=>{w(x.id),b(A(x.id)?.displayNameOverride?.trim()??"")},onDelete:x=>C(x.id),labels:{treeAriaLabel:`All folders for ${s.email}`}})})]}),S&&e.jsx(Re,{open:!0,folderLabel:z(S,f.get(S.mailboxId),i),defaultLabel:z({fullPath:S.fullPath},f.get(S.mailboxId),i),name:D,onNameChange:b,pending:m.isPending,error:m.isError?"Couldn't save that name. Please try again.":void 0,onSubmit:()=>{const x=D.trim();m.mutate({path:{accountId:t,mailboxId:S.mailboxId},body:{displayNameOverride:x===""?null:x}},{onSuccess:()=>w(void 0)})},onClose:()=>w(void 0)}),$&&e.jsx(Ve,{open:!0,accountId:t,folder:$,mailboxes:g,appointments:s.folderAppointments,onClose:()=>C(void 0)})]})}function as(){const s=be(),[n,t]=u.useState(!0),{data:i,isPending:d,isError:r,error:c,refetch:o}=te(je()),a=l=>{const p=ye[l];p&&s({to:p})};return e.jsx(Se,{items:ve,activeId:"folders",title:"Folder roles",description:"Appoint which real folder fills each canonical role, per account.",help:Ge,helpOpen:n,onToggleHelp:()=>t(l=>!l),onSelect:a,onBackToMail:()=>{s({to:"/mail"})},children:d?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(ne,{title:"Couldn't load accounts",error:c,onRetry:()=>{o()}}):i.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:i.accounts.map(l=>e.jsx(He,{account:l},l.accountId))})})}export{as as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const c=()=>typeof navigator<"u"&&(navigator.language||navigator.languages?.[0])||"en-US",l=(t,e)=>new Intl.NumberFormat(c(),e).format(t),g=/^-?\d+$/,f=t=>{if(t instanceof Date)return t;if(typeof t=="number")return new Date(t);if(typeof t=="string"){const e=t.trim();return g.test(e)?new Date(Number(e)):new Date(e)}return new Date(Number.NaN)},d=t=>Number.isFinite(t.getTime()),i=(t,e)=>{const n=f(t);return d(n)?new Intl.DateTimeFormat(c(),e).format(n):""},y=(t,e)=>i(t,{short:{month:"short",day:"numeric"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"},time:{hour:"numeric",minute:"numeric"},datetime:{month:"short",day:"numeric",hour:"numeric",minute:"numeric"}}[e]),w=t=>{const e=f(t);if(!d(e))return"";const n=new Intl.RelativeTimeFormat(c(),{numeric:"auto"}),a=Date.now(),r=e.getTime()-a,s=Math.round(r/1e3),o=Math.round(r/(1e3*60)),m=Math.round(r/(1e3*60*60)),u=Math.round(r/(1e3*60*60*24)),h=Math.round(r/(1e3*60*60*24*7));return Math.abs(s)<60?n.format(s,"second"):Math.abs(o)<60?n.format(o,"minute"):Math.abs(m)<24?n.format(m,"hour"):Math.abs(u)<7?n.format(u,"day"):Math.abs(h)<4?n.format(h,"week"):y(e,"medium")},b=t=>{const e=f(t);if(!d(e))return"";const n=new Date,a=e.toDateString()===n.toDateString(),r=new Date(n);r.setDate(r.getDate()-1);const s=e.toDateString()===r.toDateString(),o=new Date(n);o.setDate(o.getDate()-6);const m=e>=o&&e<n,u=e.getFullYear()===n.getFullYear();return a?i(e,{hour:"numeric",minute:"numeric"}):s?"Yesterday":m?i(e,{weekday:"long"}):u?i(e,{month:"short",day:"numeric"}):i(e,{month:"short",day:"numeric",year:"numeric"})},D=t=>`Move ${t===1?"1":l(t)} ${t===1?"message":"messages"} to Trash?`,T=(t,e)=>{const n=t===1?"1":l(t),a=t===1?"message":"messages";return e==="unknown"?{title:`Delete ${n} ${a}?`,description:"Checking where this account files deleted mail…",confirmLabel:"Delete"}:e==="permanent"?{title:`Permanently delete ${n} ${a}?`,description:"They are erased from the mail server and cannot be restored.",confirmLabel:"Delete permanently"}:{title:D(t),description:"You can restore them from Trash later.",confirmLabel:"Move to Trash"}};export{i as a,b,l as c,T as d,y as e,w as f,D as g,f as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./index-M_tY9XTt.js";import{M as i}from"./MailboxPane-CA5Y3_SN.js";import"./useSearchTokenContext-DU66fBNH.js";import"./kbd-BHAPJuqc.js";import"./useMessageBodyContent-BVHgD2uM.js";import"./useMediaQuery-D0jZQl9A.js";import"./enums-CCxx0t2v.js";import"./search-scope-BqP7bipM.js";import"./useRefreshControl-XfZdONZZ.js";import"./circle-check-big-CPS4axVs.js";import"./search-token-index-Dq1YsfkF.js";import"./MailListHeader-BIcOZoHT.js";import"./attachment-file-uAdi6sKR.js";import"./mail-D6GOeJKp.js";import"./avatar-CFndQH5R.js";import"./index-DJa-q1BD.js";import"./useSignature-B9-4He3j.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CVloHKPu.js";import"./ErrorState-BF7k9VeT.js";import"./format-HasNd5qT.js";import"./download-DM2bn95G.js";import"./shield-check-CFPVcDje.js";import"./move-options-E3q-ftA4.js";import"./useFilters-BxSvo_8a.js";import"./confirm-dialog-tiuVS57c.js";import"./clock-Cm_TLM05.js";import"./menu-DnyLlQ6R.js";import"./MailViewChrome-D2WwK5Zk.js";import"./NavMenuButton-C2qYzQDt.js";import"./useLabels-BfLvkcxZ.js";import"./useSemanticSearch-DX_yFDSq.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-Bw8q9Cma.js";import"./circle-help-6oY_xcWT.js";import"./circle-check-CtwlOpag.js";function J(){return o.jsx(i.Reading,{})}export{J as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as r}from"./index-M_tY9XTt.js";import{B as o}from"./BriefPane-BsW7qf9q.js";import"./useSearchTokenContext-DU66fBNH.js";import"./kbd-BHAPJuqc.js";import"./useMessageBodyContent-BVHgD2uM.js";import"./useMediaQuery-D0jZQl9A.js";import"./enums-CCxx0t2v.js";import"./search-scope-BqP7bipM.js";import"./MailListHeader-BIcOZoHT.js";import"./search-token-index-Dq1YsfkF.js";import"./attachment-file-uAdi6sKR.js";import"./mail-D6GOeJKp.js";import"./avatar-CFndQH5R.js";import"./index-DJa-q1BD.js";import"./useSignature-B9-4He3j.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CVloHKPu.js";import"./ErrorState-BF7k9VeT.js";import"./format-HasNd5qT.js";import"./download-DM2bn95G.js";import"./shield-check-CFPVcDje.js";import"./move-options-E3q-ftA4.js";import"./useFilters-BxSvo_8a.js";import"./confirm-dialog-tiuVS57c.js";import"./clock-Cm_TLM05.js";import"./menu-DnyLlQ6R.js";import"./useRefreshControl-XfZdONZZ.js";import"./circle-check-big-CPS4axVs.js";import"./useLabels-BfLvkcxZ.js";import"./useSemanticSearch-DX_yFDSq.js";import"./search-query-Cr_ZXBCp.js";function F(){return r.jsx(o.Reading,{})}export{F as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./index-M_tY9XTt.js";import{F as r}from"./FlaggedPane-DfrV_6op.js";import"./useSearchTokenContext-DU66fBNH.js";import"./kbd-BHAPJuqc.js";import"./useMessageBodyContent-BVHgD2uM.js";import"./useMediaQuery-D0jZQl9A.js";import"./enums-CCxx0t2v.js";import"./search-scope-BqP7bipM.js";import"./MailListHeader-BIcOZoHT.js";import"./search-token-index-Dq1YsfkF.js";import"./attachment-file-uAdi6sKR.js";import"./mail-D6GOeJKp.js";import"./avatar-CFndQH5R.js";import"./index-DJa-q1BD.js";import"./useSignature-B9-4He3j.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CVloHKPu.js";import"./ErrorState-BF7k9VeT.js";import"./format-HasNd5qT.js";import"./download-DM2bn95G.js";import"./shield-check-CFPVcDje.js";import"./move-options-E3q-ftA4.js";import"./useFilters-BxSvo_8a.js";import"./confirm-dialog-tiuVS57c.js";import"./clock-Cm_TLM05.js";import"./menu-DnyLlQ6R.js";import"./MailViewChrome-D2WwK5Zk.js";function z(){return o.jsx(r.Reading,{})}export{z as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./index-M_tY9XTt.js";import{F as r}from"./FlaggedPane-DfrV_6op.js";import"./useSearchTokenContext-DU66fBNH.js";import"./kbd-BHAPJuqc.js";import"./useMessageBodyContent-BVHgD2uM.js";import"./useMediaQuery-D0jZQl9A.js";import"./enums-CCxx0t2v.js";import"./search-scope-BqP7bipM.js";import"./MailListHeader-BIcOZoHT.js";import"./search-token-index-Dq1YsfkF.js";import"./attachment-file-uAdi6sKR.js";import"./mail-D6GOeJKp.js";import"./avatar-CFndQH5R.js";import"./index-DJa-q1BD.js";import"./useSignature-B9-4He3j.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CVloHKPu.js";import"./ErrorState-BF7k9VeT.js";import"./format-HasNd5qT.js";import"./download-DM2bn95G.js";import"./shield-check-CFPVcDje.js";import"./move-options-E3q-ftA4.js";import"./useFilters-BxSvo_8a.js";import"./confirm-dialog-tiuVS57c.js";import"./clock-Cm_TLM05.js";import"./menu-DnyLlQ6R.js";import"./MailViewChrome-D2WwK5Zk.js";function y(){return o.jsx(r.Reading,{})}export{y as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,$ as o}from"./index-M_tY9XTt.js";const n=()=>t.jsx(o,{to:"/settings/accounts"});export{n 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-
|
|
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,bW as gr,bX as wr,C as Sn,a3 as yr,bY as br,d as Er,bZ as Sr,b_ as Wt,ba as xn,b$ as ve,c0 as Cn,c1 as xr,n as Cr,a7 as lt,c2 as dt,c3 as Rr,c4 as Dr,t as Tr,s as ft,b6 as Ar,m as Or,c5 as Rn,aF as Nr,aG as kr,Q as Dn,c6 as Pr,a5 as Ir,c7 as Lr,c8 as Mr,bn as St,c9 as _r,a8 as jr,b9 as Fr,a6 as $r,ca as Br,a4 as S}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/rich-text-spellcheck-worker-provider-Cp2XW2DG.js","assets/index-M_tY9XTt.js","assets/index-Bn4mOVkF.css","assets/rich-text-spellcheck-provider-J8m9wz6A.js","assets/rich-text-WDSUzqmW.js","assets/confirm-dialog-tiuVS57c.js","assets/useMediaQuery-D0jZQl9A.js","assets/bottom-sheet-Bw8q9Cma.js","assets/attachment-file-uAdi6sKR.js","assets/useMessageBodyContent-BVHgD2uM.js","assets/useSignature-B9-4He3j.js","assets/account-form-helpers-DhckT_PN.js","assets/useDebouncedValue-CVloHKPu.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,bW as gr,bX as wr,C as Sn,a3 as yr,bY as br,d as Er,bZ as Sr,b_ as Wt,ba as xn,b$ as ve,c0 as Cn,c1 as xr,n as Cr,a7 as lt,c2 as dt,c3 as Rr,c4 as Dr,t as Tr,s as ft,b6 as Ar,m as Or,c5 as Rn,aF as Nr,aG as kr,Q as Dn,c6 as Pr,a5 as Ir,c7 as Lr,c8 as Mr,bn as St,c9 as _r,a8 as jr,b9 as Fr,a6 as $r,ca as Br,a4 as S}from"./index-M_tY9XTt.js";import{p as Hr}from"./useMessageBodyContent-BVHgD2uM.js";import{u as Wr}from"./useSignature-B9-4He3j.js";import{b as Ur}from"./account-form-helpers-DhckT_PN.js";import{u as Vr}from"./useDebouncedValue-CVloHKPu.js";import{u as zr}from"./useMediaQuery-D0jZQl9A.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 Xr=["Tab",","],Xt=e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim()),Gr=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(Xt(o))return{email:o,displayName:r}}if(Xt(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=Gr(i);d&&u(d)},[i,u]),f=gr({count:l.length,acceptKeys:Xr,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]),D=s.useCallback(()=>{setTimeout(()=>{E(),f.dismiss()},150)},[E,f.dismiss]);return p.jsxs("div",{className:"relative",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:D,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},Gt=new Map,fo=e=>{const t=Gt.get(e);if(t)return t;const n=lo(e);return Gt.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 ge(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 Ce(...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 Ve=globalThis?.document?s.useLayoutEffect:()=>{},yo=Wt[" useInsertionEffect ".trim().toString()]||Ve;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 et=="function"&&(o=et(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 et=="function"&&(E=et(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=Ce(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.`,et=Wt[" use ".trim().toString()],Po=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],se=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 ze(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=Ce(t,v),b=Array.from(l.layers),[w]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),D=w?b.indexOf(w):-1,d=u?b.indexOf(u):-1,g=l.layersWithOutsidePointerEventsDisabled.size>0,A=d>=D,L=s.useRef(!1),x=Ho(N=>{a?.(N),c?.(N),N.defaultPrevented||h?.()},{ownerDocument:y,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:L,dismissableSurfaces:l.dismissableSurfaces,shouldHandlePointerDownOutside:s.useCallback(N=>{if(!(N instanceof Node))return!1;const B=[...l.branches].some(C=>C.contains(N));return A&&!B},[l.branches,A])}),I=Wo(N=>{if(r&&L.current)return;const B=N.target;[...l.branches].some(q=>q.contains(B))||(i?.(N),c?.(N),N.defaultPrevented||h?.())},y),P=u?d===b.length-1:!1,j=ze(N=>{N.key==="Escape"&&(o?.(N),!N.defaultPrevented&&h&&(N.preventDefault(),h()))});return s.useEffect(()=>{if(P)return y.addEventListener("keydown",j,{capture:!0}),()=>y.removeEventListener("keydown",j,{capture:!0})},[y,P,j]),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(se.div,{...m,ref:f,style:{pointerEvents:g?A?"auto":"none":void 0,...e.style},onFocusCapture:ge(e.onFocusCapture,I.onFocusCapture),onBlurCapture:ge(e.onBlurCapture,I.onBlurCapture),onPointerDownCapture:ge(e.onPointerDownCapture,x.onPointerDownCapture)})});On.displayName=Lo;var jo="DismissableLayerBranch",Fo=s.forwardRef((e,t)=>{const n=s.useContext(Ut),r=s.useRef(null),o=Ce(t,r);return s.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),p.jsx(se.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=ze(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(L=>L.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 L=y();v(),L||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 D=window.setTimeout(()=>{n.addEventListener("pointerdown",b)},0);return()=>{window.clearTimeout(D),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=ze(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 tt=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),tt++,()=>{tt===1&&(De?.start.remove(),De?.end.remove(),De=null),tt=Math.max(0,tt-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=ze(o),l=ze(a),u=s.useRef(null),v=Ce(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:he(u.current,{select:!0})},b=function(d){if(y.paused||!c)return;const g=d.relatedTarget;g!==null&&(c.contains(g)||he(u.current,{select:!0}))},w=function(d){if(document.activeElement===document.body)for(const A of d)A.removedNodes.length>0&&he(c)};document.addEventListener("focusin",f),document.addEventListener("focusout",b);const D=new MutationObserver(w);return c&&D.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",b),D.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(Go(Pn(c)),{select:!0}),document.activeElement===f&&he(c))}return()=>{c.removeEventListener(Ct,m),setTimeout(()=>{const w=new CustomEvent(Rt,nn);c.addEventListener(Rt,l),c.dispatchEvent(w),w.defaultPrevented||he(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 D=f.currentTarget,[d,g]=qo(D);d&&g?!f.shiftKey&&w===g?(f.preventDefault(),n&&he(d,{select:!0})):f.shiftKey&&w===d&&(f.preventDefault(),n&&he(g,{select:!0})):w===D&&f.preventDefault()}},[n,r,y.paused]);return p.jsx(se.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(he(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 he(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=Xo();function Xo(){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 Go(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 Ve(()=>{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);Ve(()=>a(!0),[]);const i=n||o&&globalThis?.document?.body;return i?xn.createPortal(p.jsx(se.div,{...r,ref:t}),i):null});In.displayName=Jo;function ea(e,t){return s.useReducer((n,r)=>t[n][r]??n,e)}var pt=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};pt.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??He(r.current),i.current=void 0):a.current="none"},[h]),Ve(()=>{const l=r.current,u=o.current;if(u!==e){const y=a.current,E=He(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]),Ve(()=>{if(t){let l;const u=t.ownerDocument.defaultView??window,v=E=>{const b=He(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=He(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=He(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 He(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,nt=new WeakMap,rt={},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]);rt[n]||(rt[n]=new WeakMap);var a=rt[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&&nt.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||(nt.has(u)||u.removeAttribute(r),nt.delete(u)),y||u.removeAttribute(n)}),Tt--,Tt||(Te=new WeakMap,Te=new WeakMap,nt=new WeakMap,rt={})}},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}},ct="right-scroll-bar-position",ut="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=ve({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,ve({},n))};Mn.isSideCarExport=!0;function va(e,t){return e.useMedium(t),Mn}var _n=ha(),Ot=function(){},ht=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,D=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,L=fa([n,t]),x=ve(ve({},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),ve(ve({},x),{ref:L})):s.createElement(D,ve({},x,{className:h,ref:L}),c))});ht.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ht.classNames={fullWidth:ut,zeroRight:ct};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,bW as gr,b
|
|
|
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 ot=Object.defineProperty({},"passive",{get:function(){return $t=!0,!0}});window.addEventListener("test",ot,ot),window.removeEventListener("test",ot,ot)}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 D=c.parentNode;c=D&&D.nodeType===Node.DOCUMENT_FRAGMENT_NODE?D.host:D}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},at=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=at(f),D=n.current,d="deltaX"in f?f.deltaX:D[0]-w[0],g="deltaY"in f?f.deltaY:D[1]-w[1],A,L=f.target,x=Math.abs(d)>Math.abs(g)?"h":"v";if("touches"in f&&x==="h"&&L.type==="range")return!1;var I=window.getSelection(),P=I&&I.anchorNode,j=P?P===L||P.contains(L):!1;if(j)return!1;var N=ln(x,L);if(!N)return!0;if(N?A=x:(A=x==="v"?"h":"v",N=ln(x,L)),!N)return!1;if(!r.current&&"changedTouches"in f&&(d||g)&&(r.current=A),!A)return!0;var B=r.current||A;return _a(B,b,f,B==="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):at(b),D=t.current.filter(function(A){return A.name===b.type&&(A.target===b.target||b.target===A.shadowParent)&&ja(A.delta,w)})[0];if(D&&D.should){b.cancelable&&b.preventDefault();return}if(!D){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,D){var d={name:f,delta:b,target:w,should:D,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=at(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,at(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(ht,ve({},e,{ref:t,sideCar:Wa}))});Hn.classNames=ht.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=lt({...Rr(),meta:dt}),v=lt({...Dr(),meta:dt}),y=s.useCallback(async d=>{r(za),a(null);const g=l.current;if(g){const L=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),L}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]),D=s.useCallback(d=>{i.current&&clearTimeout(i.current),d&&c.current.add(d)},[]);return{saveState:n,saveError:o,saveDraft:b,saveImmediately:w,stopAutoSave:D}},Ya=e=>e.outboundCount>0||e.replyCount>0||e.flags?.vip?.value===!0||e.flags?.trusted?.value===!0,Xa=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}=ft({...Ar({query:{q:i,limit:8}}),enabled:i.length>=2}),h=s.useMemo(()=>(c?.items??[]).filter(Xa).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})},Ga=({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-
|
|
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=at(f),D=n.current,d="deltaX"in f?f.deltaX:D[0]-w[0],g="deltaY"in f?f.deltaY:D[1]-w[1],A,L=f.target,x=Math.abs(d)>Math.abs(g)?"h":"v";if("touches"in f&&x==="h"&&L.type==="range")return!1;var I=window.getSelection(),P=I&&I.anchorNode,j=P?P===L||P.contains(L):!1;if(j)return!1;var N=ln(x,L);if(!N)return!0;if(N?A=x:(A=x==="v"?"h":"v",N=ln(x,L)),!N)return!1;if(!r.current&&"changedTouches"in f&&(d||g)&&(r.current=A),!A)return!0;var B=r.current||A;return _a(B,b,f,B==="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):at(b),D=t.current.filter(function(A){return A.name===b.type&&(A.target===b.target||b.target===A.shadowParent)&&ja(A.delta,w)})[0];if(D&&D.should){b.cancelable&&b.preventDefault();return}if(!D){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,D){var d={name:f,delta:b,target:w,should:D,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=at(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,at(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(ht,ve({},e,{ref:t,sideCar:Wa}))});Hn.classNames=ht.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=lt({...Rr(),meta:dt}),v=lt({...Dr(),meta:dt}),y=s.useCallback(async d=>{r(za),a(null);const g=l.current;if(g){const L=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),L}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]),D=s.useCallback(d=>{i.current&&clearTimeout(i.current),d&&c.current.add(d)},[]);return{saveState:n,saveError:o,saveDraft:b,saveImmediately:w,stopAutoSave:D}},Ya=e=>e.outboundCount>0||e.replyCount>0||e.flags?.vip?.value===!0||e.flags?.trusted?.value===!0,Xa=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}=ft({...Ar({query:{q:i,limit:8}}),enabled:i.length>=2}),h=s.useMemo(()=>(c?.items??[]).filter(Xa).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})},Ga=({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-Cp2XW2DG.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}=ft({...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-WDSUzqmW.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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),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,D]=s.useState(void 0),d=w===e;return p.jsx(to,{collapsed:!f&&b&&!d,onExpand:()=>D(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(""),[D,d]=s.useState(!1),[g,A]=s.useState(!1),[L,x]=s.useState(t?.accountId),[I,P]=s.useState(!1),[j,N]=s.useState(r),B=s.useRef(null),C=s.useRef(r),q=s.useRef(r!==void 0);s.useEffect(()=>{const R=C.current;if(R===r||(C.current=r,R===void 0))return;q.current=r!==void 0;const O=r?{html:"",text:""}:Pt(X.current);u([]),y([]),f([]),w(""),d(!1),A(!1),ie(O.html),Pe(O.text),ce("rich"),le(void 0),ye({...O,formatting:[]}),Z(M=>M+1),P(!1),N(r)},[r]);const{signature:W}=Wr(L),X=s.useRef(W.plainText);X.current=W.plainText;const[V,Z]=s.useState(0),[te,ie]=s.useState(()=>Pt(W.plainText).html),[gt,Pe]=s.useState(W.plainText),[J,ce]=s.useState("rich"),[ue,Ie]=s.useState("en"),[we,le]=s.useState(),[re,ye]=s.useState(()=>({...Pt(W.plainText),formatting:[]})),{data:H}=ft({...Lr({path:{outboxMessageId:r??""}}),enabled:!!r&&!I});s.useEffect(()=>{if(!H||I)return;u(H.toAddresses.map(F=>({email:F,displayName:void 0}))),H.ccAddresses&&H.ccAddresses.length>0&&(y(H.ccAddresses.map(F=>({email:F,displayName:void 0}))),d(!0)),H.bccAddresses&&H.bccAddresses.length>0&&(f(H.bccAddresses.map(F=>({email:F,displayName:void 0}))),A(!0)),H.subject&&w(H.subject);const R=Mr(H.htmlBody??""),O=R.html,M=H.textBody??"";ce(po(H.htmlBody)),le(R.language??void 0),ie(O),Pe(M),ye({html:O,text:M,formatting:[]}),Z(F=>F+1),x(H.accountId),P(!0)},[H,I]),s.useEffect(()=>{if(!q.current&&n){if(e==="reply"||e==="reply-all"){const{to:R,cc:O}=cs(n,e,t?.email);u(R),y(O),O.length>0&&d(!0),w(ss(n.envelope.subject))}e==="forward"&&w(is(n.envelope.subject))}},[e,n,t?.email]);const Ke=e==="reply"||e==="reply-all"||e==="forward",{data:be}=Hr({messageId:n?.message.messageId,bodyParts:n?.bodyParts,enabled:Ke&&!!n}),k=be?.kind==="text"?be.body:"",Le=be?.kind==="html"?mo(be.body):void 0,Ye=n?.envelope.from[0]?.displayName??n?.envelope.from[0]?.normalizedEmail,Me=s.useCallback(R=>{P(!0),N(R),o(R)},[o]),{saveState:wt,saveError:Re,saveDraft:oe,saveImmediately:_e,stopAutoSave:Ee}=Ka({outboxMessageId:r,onDraftCreated:Me});s.useEffect(()=>{Re&&m({title:"Couldn't save draft",detail:St(Re)??"Saving the draft failed.",error:Re})},[Re,m]);const de=lt({..._r(),meta:dt}),Xe=lt({...Fr(),meta:dt,onError:R=>{m(jr("Couldn't discard draft","The draft wasn't discarded.",R))}}),{data:Ge}=ft({...Dn(),staleTime:1/0}),Se=Ge?.accounts.find(R=>R.accountId===L),je=Se?Ur(Se):!1,ae=Se?.composeLanguages,yt=s.useMemo(()=>ae&&ae.length>0?ae:$r(navigator.languages),[ae]),Qe=s.useMemo(()=>Ja(m),[m]),Fe=s.useRef(!1),[fe,$e]=s.useState(!1),me=s.useMemo(()=>fe?{status:"sending"}:L?je?{status:"blocked",reason:jt}:l.length===0?{status:"blocked",reason:ls}:{status:"ready",accountId:L}:{status:"blocked",reason:"Choose an account to send from."},[fe,L,je,l.length]),bt=me;s.useEffect(()=>{if(!L||j!==void 0&&j!==r||r&&!I||ds(l,v,E,b,re))return;const{htmlBody:R,textBody:O}=gn(J,re,ue);oe({accountId:L,toAddresses:l.map(M=>M.email),ccAddresses:v.length>0?v.map(M=>M.email):void 0,bccAddresses:E.length>0?E.map(M=>M.email):void 0,subject:b||void 0,textBody:O,htmlBody:R})},[L,r,j,I,l,v,E,b,re,J,ue,oe]);const Ze=s.useCallback(async R=>{if(!Fe.current){Fe.current=!0,$e(!0);try{Ee();const O=n&&(e==="reply"||e==="reply-all")?us(n):{},{htmlBody:M,textBody:F}=gn(J,re,ue),K=!r,Q=await _e({accountId:R,toAddresses:l.map(Y=>Y.email),ccAddresses:v.length>0?v.map(Y=>Y.email):void 0,bccAddresses:E.length>0?E.map(Y=>Y.email):void 0,subject:b||void 0,textBody:F,htmlBody:M,...O});if(Q.outcome==="failed"){m({title:"Couldn't send message",detail:St(Q.error)??"Saving the message failed, so nothing was sent. Try again.",error:Q.error});return}const G=Q.outboxMessageId;if(await de.mutateAsync({path:{outboxMessageId:G}}).catch(Y=>(m({title:"Couldn't send message",detail:St(Y)??(K?"The draft was saved but the send request failed. Try again from the Outbox.":"The send request failed. Try again."),error:Y}),null))===null)return;Ee(G),h(G),a()}finally{Fe.current=!1,$e(!1)}}},[l,v,E,b,re,J,ue,e,n,r,_e,de,Ee,h,m,a]),Et=s.useCallback(()=>{Ee(r),r&&Xe.mutate({path:{outboxMessageId:r}}),a()},[Ee,r,Xe,a]),Be=s.useCallback(R=>{m({title:"Can't send yet",detail:R}),R===jt&&B.current?.focus()},[m]),T=s.useCallback(()=>{if(me.status!=="sending"){if(me.status==="blocked"){Be(me.reason);return}Ze(me.accountId)}},[me,Be,Ze]),_=s.useCallback(R=>{x(R.accountId),i?.(R)},[i]);return p.jsx(Jr,{layout:c,banner:Se&&je?p.jsx(Ga,{accountId:Se.accountId,configureRef:B}):void 0,header:p.jsx(fs,{documentGeneration:V,selectedAccountId:L,onAccountChange:_,toAddresses:l,setToAddresses:u,ccAddresses:v,setCcAddresses:y,bccAddresses:E,setBccAddresses:f,showCc:D,setShowCc:d,showBcc:g,setShowBcc:A,subject:b,setSubject:w}),quoted:k||Le?p.jsx(oo,{text:k,html:Le,senderName:Ye}):void 0,actionBar:p.jsx(Yr,{send:bt,onSend:T,onBlocked:Be,onDiscard:Et,save:wt}),children:p.jsx(s.Suspense,{fallback:p.jsx(Zr,{}),children:p.jsx(ns,{mode:J,onModeChange:ce,initialHtml:te,initialText:gt,onChange:ye,onSubmit:T,initialCaret:e==="new"?"start":void 0,onConversionError:m,languages:yt,initialLanguage:we,onLanguageChange:Ie,spellcheck:Qe},V)})})};var vt="Dialog",[Wn]=go(vt),[ms,ee]=Wn(vt),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:vt});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=vt;var Vn="DialogTrigger",ps=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ee(Vn,n),a=Ce(t,o.triggerRef);return p.jsx(se.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:ge(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=ee(Vt,t);return p.jsx(hs,{scope:t,forceMount:n,children:s.Children.map(r,i=>p.jsx(pt,{present:n||a.open,children:p.jsx(In,{asChild:!0,container:o,children:i})}))})};qn.displayName=Vt;var mt="DialogOverlay",Kn=s.forwardRef((e,t)=>{const n=zn(mt,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=ee(mt,e.__scopeDialog);return a.modal?p.jsx(pt,{present:r||a.open,children:p.jsx(gs,{...o,ref:t})}):null});Kn.displayName=mt;var vs=An("DialogOverlay.RemoveScroll"),gs=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ee(mt,n),a=$o(),i=Ce(t,a);return p.jsx(Hn,{as:vs,allowPinchZoom:!0,shards:[o.contentRef],children:p.jsx(se.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=ee(ke,e.__scopeDialog);return p.jsx(pt,{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=ee(ke,e.__scopeDialog),r=s.useRef(null),o=Ce(t,n.contentRef,r);return s.useEffect(()=>{const a=r.current;if(a)return ia(a)},[]),p.jsx(Xn,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:ge(e.onCloseAutoFocus,a=>{a.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:ge(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,c=i.button===0&&i.ctrlKey===!0;(i.button===2||c)&&a.preventDefault()}),onFocusOutside:ge(e.onFocusOutside,a=>a.preventDefault())})}),ys=s.forwardRef((e,t)=>{const n=ee(ke,e.__scopeDialog),r=s.useRef(!1),o=s.useRef(!1);return p.jsx(Xn,{...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()}})}),Xn=s.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,...i}=e,c=ee(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)})})})}),Gn="DialogTitle",Qn=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ee(Gn,n);return p.jsx(se.h2,{id:o.titleId,...r,ref:t})});Qn.displayName=Gn;var Zn="DialogDescription",bs=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ee(Zn,n);return p.jsx(se.p,{id:o.descriptionId,...r,ref:t})});bs.displayName=Zn;var Jn="DialogClose",Es=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ee(Jn,n);return p.jsx(se.button,{type:"button",...r,ref:t,onClick:ge(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}),qe=()=>{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 st=0,Lt;function Ns(e={}){let{isDisabled:t}=e;As(()=>{if(!t)return st++,st===1&&tr()&&(Lt=ks()),()=>{st--,st===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(We(document,"touchstart",n,{passive:!1,capture:!0}),We(document,"touchmove",r,{passive:!1,capture:!0}),We(document,"touchend",o,{passive:!1,capture:!0}),We(document,"focus",a,!0),We(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 We(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 z(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 U=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function it(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(", ")[U(t)?13:12]):(o=r.match(/^matrix\((.+)\)$/),o?parseFloat(o[1].split(", ")[U(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 $={DURATION:.5,EASE:[.32,.72,0,1]},ar=.4,Fs=.25,$s=100,sr=8,xe=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 x(){y({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[]);const E=S.useMemo(()=>l===n?.[n.length-1]||null,[n,l]),f=S.useMemo(()=>{var x;return(x=n?.findIndex(I=>I===l))!=null?x:null},[n,l]),b=n&&n.length>0&&(a||a===0)&&!Number.isNaN(a)&&n[a]===l||!n,w=S.useMemo(()=>{const x=h?{width:h.getBoundingClientRect().width,height:h.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var I;return(I=n?.map(P=>{const j=typeof P=="string";let N=0;if(j&&(N=parseInt(P,10)),U(c)){const C=j?N:v?P*x.height:0;return v?c==="bottom"?x.height-C:-x.height+C:C}const B=j?N:v?P*x.width:0;return v?c==="right"?x.width-B:-x.width+B:B}))!=null?I:[]},[n,v,h]),D=S.useMemo(()=>f!==null?w?.[f]:null,[w,f]),d=S.useCallback(x=>{var I;const P=(I=w?.findIndex(j=>j===x))!=null?I:null;i(P),z(r.current,{transition:`transform ${$.DURATION}s cubic-bezier(${$.EASE.join(",")})`,transform:U(c)?`translate3d(0, ${x}px, 0)`:`translate3d(${x}px, 0, 0)`}),w&&P!==w.length-1&&a!==void 0&&P!==a&&P<a?z(o.current,{transition:`opacity ${$.DURATION}s cubic-bezier(${$.EASE.join(",")})`,opacity:"0"}):z(o.current,{transition:`opacity ${$.DURATION}s cubic-bezier(${$.EASE.join(",")})`,opacity:"1"}),u(n?.[Math.max(P,0)])},[r.current,n,w,a,o,u]);S.useEffect(()=>{if(l||e){var x;const I=(x=n?.findIndex(P=>P===e||P===l))!=null?x:-1;w&&I!==-1&&typeof w[I]=="number"&&d(w[I])}},[l,e,n,w,d]);function g({draggedDistance:x,closeDrawer:I,velocity:P,dismissible:j}){if(a===void 0)return;const N=c==="bottom"||c==="right"?(D??0)-x:(D??0)+x,B=f===a-1,C=f===0,q=x>0;if(B&&z(o.current,{transition:`opacity ${$.DURATION}s cubic-bezier(${$.EASE.join(",")})`}),!m&&P>2&&!q){j?I():d(w[0]);return}if(!m&&P>2&&q&&w&&n){d(w[n.length-1]);return}const W=w?.reduce((V,Z)=>typeof V!="number"||typeof Z!="number"?V:Math.abs(Z-N)<Math.abs(V-N)?Z:V),X=U(c)?window.innerHeight:window.innerWidth;if(P>ar&&Math.abs(x)<X*.4){const V=q?1:-1;if(V>0&&E&&n){d(w[n.length-1]);return}if(C&&V<0&&j&&I(),f===null)return;d(w[f+V]);return}d(W)}function A({draggedDistance:x}){if(D===null)return;const I=c==="bottom"||c==="right"?D-x:D+x;(c==="bottom"||c==="right")&&I<w[w.length-1]||(c==="top"||c==="left")&&I>w[w.length-1]||z(r.current,{transform:U(c)?`translate3d(0, ${I}px, 0)`:`translate3d(${I}px, 0, 0)`})}function L(x,I){if(!n||typeof f!="number"||!w||a===void 0)return null;const P=f===a-1;if(f>=a&&I)return 0;if(P&&!I)return 1;if(!b&&!P)return null;const N=P?f+1:f-1,B=P?w[N]-w[N-1]:w[N+1]-w[N],C=x/Math.abs(B);return P?1-C:C}return{isLastSnapPoint:E,activeSnapPoint:l,shouldFade:b,getPercentageDragged:L,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}=qe(),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:U(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${$.DURATION}s`,transitionTimingFunction:`cubic-bezier(${$.EASE.join(",")})`}));const m=Mt(h,{borderRadius:`${sr}px`,overflow:"hidden",...U(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")},$.DURATION*1e3)}}},[t,n,i])}let Ue=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()&&Ue===null&&e&&!a){Ue={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()&&Ue!==null&&!a){const u=-parseInt(document.body.style.top,10),v=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Ue),window.requestAnimationFrame(()=>{if(o&&i!==window.location.href){c(window.location.href);return}window.scrollTo(v,u)}),Ue=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:D,noBodyStyles:d=!1,direction:g="bottom",defaultOpen:A=!1,disablePreventScroll:L=!0,snapToSequentialPoint:x=!1,preventScrollRestoration:I=!1,repositionInputs:P=!0,onAnimationEnd:j,container:N,autoFocus:B=!1}){var C,q;const[W=!1,X]=cr({defaultProp:A,prop:e,onChange:T=>{t?.(T),!T&&!D&&je(),setTimeout(()=>{j?.(T)},$.DURATION*1e3),T&&!b&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),T||(document.body.style.pointerEvents="auto")}}),[V,Z]=S.useState(!1),[te,ie]=S.useState(!1),[gt,Pe]=S.useState(!1),J=S.useRef(null),ce=S.useRef(null),ue=S.useRef(null),Ie=S.useRef(null),we=S.useRef(null),le=S.useRef(!1),re=S.useRef(null),ye=S.useRef(0),H=S.useRef(!1),Ke=S.useRef(!A),be=S.useRef(0),k=S.useRef(null),Le=S.useRef(((C=k.current)==null?void 0:C.getBoundingClientRect().height)||0),Ye=S.useRef(((q=k.current)==null?void 0:q.getBoundingClientRect().width)||0),Me=S.useRef(0),wt=S.useCallback(T=>{a&&T===de.length-1&&(ce.current=new Date)},[]),{activeSnapPoint:Re,activeSnapPointIndex:oe,setActiveSnapPoint:_e,onRelease:Ee,snapPointsOffset:de,onDrag:Xe,shouldFade:Ge,getPercentageDragged:Se}=Hs({snapPoints:a,activeSnapPointProp:y,setActiveSnapPointProp:E,drawerRef:k,fadeFromIndex:v,overlayRef:J,onSnapPointChange:wt,direction:g,container:N,snapToSequentialPoint:x});Ns({isDisabled:!W||te||!b||gt||!V||!P||!L});const{restorePositionSetting:je}=Vs({isOpen:W,modal:b,nested:D??!1,hasBeenOpened:V,preventScrollRestoration:I,noBodyStyles:d});function ae(){return(window.innerWidth-Ht)/window.innerWidth}function yt(T){var _,R;!l&&!a||k.current&&!k.current.contains(T.target)||(Le.current=((_=k.current)==null?void 0:_.getBoundingClientRect().height)||0,Ye.current=((R=k.current)==null?void 0:R.getBoundingClientRect().width)||0,ie(!0),ue.current=new Date,tr()&&window.addEventListener("touchend",()=>le.current=!1,{once:!0}),T.target.setPointerCapture(T.pointerId),ye.current=U(g)?T.pageY:T.pageX)}function Qe(T,_){var R;let O=T;const M=(R=window.getSelection())==null?void 0:R.toString(),F=k.current?it(k.current,g):null,K=new Date;if(O.tagName==="SELECT"||O.hasAttribute("data-vaul-no-drag")||O.closest("[data-vaul-no-drag]"))return!1;if(g==="right"||g==="left")return!0;if(ce.current&&K.getTime()-ce.current.getTime()<500)return!1;if(F!==null&&(g==="bottom"?F>0:F<0))return!0;if(M&&M.length>0)return!1;if(we.current&&K.getTime()-we.current.getTime()<m&&F===0||_)return we.current=K,!1;for(;O;){if(O.scrollHeight>O.clientHeight){if(O.scrollTop!==0)return we.current=new Date,!1;if(O.getAttribute("role")==="dialog")return!0}O=O.parentNode}return!0}function Fe(T){if(k.current&&te){const _=g==="bottom"||g==="right"?1:-1,R=(ye.current-(U(g)?T.pageY:T.pageX))*_,O=R>0,M=a&&!l&&!O;if(M&&oe===0)return;const F=Math.abs(R),K=document.querySelector("[data-vaul-drawer-wrapper]"),Q=g==="bottom"||g==="top"?Le.current:Ye.current;let G=F/Q;const pe=Se(F,O);if(pe!==null&&(G=pe),M&&G>=1||!le.current&&!Qe(T.target,O))return;if(k.current.classList.add(_t),le.current=!0,z(k.current,{transition:"none"}),z(J.current,{transition:"none"}),a&&Xe({draggedDistance:R}),O&&!a){const ne=_s(R),Je=Math.min(ne*-1,0)*_;z(k.current,{transform:U(g)?`translate3d(0, ${Je}px, 0)`:`translate3d(${Je}px, 0, 0)`});return}const Y=1-G;if((Ge||v&&oe===v-1)&&(r?.(T,G),z(J.current,{opacity:`${Y}`,transition:"none"},!0)),K&&J.current&&i){const ne=Math.min(ae()+G*(1-ae()),1),Je=8-G*8,Kt=Math.max(0,14-G*14);z(K,{borderRadius:`${Je}px`,transform:U(g)?`scale(${ne}) translate3d(0, ${Kt}px, 0)`:`scale(${ne}) translate3d(${Kt}px, 0, 0)`,transition:"none"},!0)}if(!a){const ne=F*_;z(k.current,{transform:U(g)?`translate3d(0, ${ne}px, 0)`:`translate3d(${ne}px, 0, 0)`})}}}S.useEffect(()=>{window.requestAnimationFrame(()=>{Ke.current=!0})},[]),S.useEffect(()=>{var T;function _(){if(!k.current||!P)return;const R=document.activeElement;if(Bt(R)||H.current){var O;const M=((O=window.visualViewport)==null?void 0:O.height)||0,F=window.innerHeight;let K=F-M;const Q=k.current.getBoundingClientRect().height||0,G=Q>F*.8;Me.current||(Me.current=Q);const pe=k.current.getBoundingClientRect().top;if(Math.abs(be.current-K)>60&&(H.current=!H.current),a&&a.length>0&&de&&oe){const Y=de[oe]||0;K+=Y}if(be.current=K,Q>M||H.current){const Y=k.current.getBoundingClientRect().height;let ne=Y;Y>M&&(ne=M-(G?pe:Ht)),f?k.current.style.height=`${Y-Math.max(K,0)}px`:k.current.style.height=`${Math.max(ne,M-pe)}px`}else xs()||(k.current.style.height=`${Me.current}px`);a&&a.length>0&&!H.current?k.current.style.bottom="0px":k.current.style.bottom=`${Math.max(K,0)}px`}}return(T=window.visualViewport)==null||T.addEventListener("resize",_),()=>{var R;return(R=window.visualViewport)==null?void 0:R.removeEventListener("resize",_)}},[oe,a,de]);function fe(T){me(),w?.(),T||X(!1),setTimeout(()=>{a&&_e(a[0])},$.DURATION*1e3)}function $e(){if(!k.current)return;const T=document.querySelector("[data-vaul-drawer-wrapper]"),_=it(k.current,g);z(k.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${$.DURATION}s cubic-bezier(${$.EASE.join(",")})`}),z(J.current,{transition:`opacity ${$.DURATION}s cubic-bezier(${$.EASE.join(",")})`,opacity:"1"}),i&&_&&_>0&&W&&z(T,{borderRadius:`${sr}px`,overflow:"hidden",...U(g)?{transform:`scale(${ae()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${ae()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${$.DURATION}s`,transitionTimingFunction:`cubic-bezier(${$.EASE.join(",")})`},!0)}function me(){!te||!k.current||(k.current.classList.remove(_t),le.current=!1,ie(!1),Ie.current=new Date)}function bt(T){if(!te||!k.current)return;k.current.classList.remove(_t),le.current=!1,ie(!1),Ie.current=new Date;const _=it(k.current,g);if(!T||!Qe(T.target,!1)||!_||Number.isNaN(_)||ue.current===null)return;const R=Ie.current.getTime()-ue.current.getTime(),O=ye.current-(U(g)?T.pageY:T.pageX),M=Math.abs(O)/R;if(M>.05&&(Pe(!0),setTimeout(()=>{Pe(!1)},200)),a){Ee({draggedDistance:O*(g==="bottom"||g==="right"?1:-1),closeDrawer:fe,velocity:M,dismissible:l}),o?.(T,!0);return}if(g==="bottom"||g==="right"?O>0:O<0){$e(),o?.(T,!0);return}if(M>ar){fe(),o?.(T,!1);return}var F;const K=Math.min((F=k.current.getBoundingClientRect().height)!=null?F:0,window.innerHeight);var Q;const G=Math.min((Q=k.current.getBoundingClientRect().width)!=null?Q:0,window.innerWidth),pe=g==="left"||g==="right";if(Math.abs(_)>=(pe?G:K)*h){fe(),o?.(T,!1);return}o?.(T,!0),$e()}S.useEffect(()=>(W&&(z(document.documentElement,{scrollBehavior:"auto"}),ce.current=new Date),()=>{Ms(document.documentElement,"scrollBehavior")}),[W]);function Ze(T){const _=T?(window.innerWidth-xe)/window.innerWidth:1,R=T?-xe:0;re.current&&window.clearTimeout(re.current),z(k.current,{transition:`transform ${$.DURATION}s cubic-bezier(${$.EASE.join(",")})`,transform:U(g)?`scale(${_}) translate3d(0, ${R}px, 0)`:`scale(${_}) translate3d(${R}px, 0, 0)`}),!T&&k.current&&(re.current=setTimeout(()=>{const O=it(k.current,g);z(k.current,{transition:"none",transform:U(g)?`translate3d(0, ${O}px, 0)`:`translate3d(${O}px, 0, 0)`})},500))}function Et(T,_){if(_<0)return;const R=(window.innerWidth-xe)/window.innerWidth,O=R+_*(1-R),M=-xe+_*xe;z(k.current,{transform:U(g)?`scale(${O}) translate3d(0, ${M}px, 0)`:`scale(${O}) translate3d(${M}px, 0, 0)`,transition:"none"})}function Be(T,_){const R=U(g)?window.innerHeight:window.innerWidth,O=_?(R-xe)/R:1,M=_?-xe:0;_&&z(k.current,{transition:`transform ${$.DURATION}s cubic-bezier(${$.EASE.join(",")})`,transform:U(g)?`scale(${O}) translate3d(0, ${M}px, 0)`:`scale(${O}) translate3d(${M}px, 0, 0)`})}return S.useEffect(()=>{b||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[b]),S.createElement(Un,{defaultOpen:A,onOpenChange:T=>{!l&&!T||(T?Z(!0):fe(!0),X(T))},open:W},S.createElement(er.Provider,{value:{activeSnapPoint:Re,snapPoints:a,setActiveSnapPoint:_e,drawerRef:k,overlayRef:J,onOpenChange:t,onPress:yt,onRelease:bt,onDrag:Fe,dismissible:l,shouldAnimate:Ke,handleOnly:u,isOpen:W,isDragging:te,shouldFade:Ge,closeDrawer:fe,onNestedDrag:Et,onNestedOpenChange:Ze,onNestedRelease:Be,keyboardIsOpen:H,modal:b,snapPointsOffset:de,activeSnapPointIndex:oe,direction:g,shouldScaleBackground:i,setBackgroundColorOnScale:c,noBodyStyles:d,container:N,autoFocus:B}},n))}const ur=S.forwardRef(function({...e},t){const{overlayRef:n,snapPoints:r,onRelease:o,shouldFade:a,isOpen:i,modal:c,shouldAnimate:h}=qe(),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:D,autoFocus:d}=qe(),[g,A]=S.useState(!1),L=rr(o,a),x=S.useRef(null),I=S.useRef(null),P=S.useRef(!1),j=f&&f.length>0;Us();const N=(C,q,W=0)=>{if(P.current)return!0;const X=Math.abs(C.y),V=Math.abs(C.x),Z=V>X,te=["bottom","right"].includes(q)?1:-1;if(q==="left"||q==="right"){if(!(C.x*te<0)&&V>=0&&V<=W)return Z}else if(!(C.y*te<0)&&X>=0&&X<=W)return!Z;return P.current=!0,!0};S.useEffect(()=>{j&&window.requestAnimationFrame(()=>{A(!0)})},[]);function B(C){x.current=null,P.current=!1,c(C)}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&&j?"true":"false","data-vaul-custom-container":b?"true":"false","data-vaul-animate":D?.current?"true":"false",...r,ref:L,style:l&&l.length>0?{"--snap-point-height":`${l[u??0]}px`,...t}:t,onPointerDown:C=>{w||(r.onPointerDown==null||r.onPointerDown.call(r,C),x.current={x:C.pageX,y:C.pageY},i(C))},onOpenAutoFocus:C=>{n?.(C),d||C.preventDefault()},onPointerDownOutside:C=>{if(e?.(C),!v||C.defaultPrevented){C.preventDefault();return}m.current&&(m.current=!1)},onFocusOutside:C=>{if(!v){C.preventDefault();return}},onPointerMove:C=>{if(I.current=C,w||(r.onPointerMove==null||r.onPointerMove.call(r,C),!x.current))return;const q=C.pageY-x.current.y,W=C.pageX-x.current.x,X=C.pointerType==="touch"?10:2;N({x:W,y:q},E,X)?h(C):(Math.abs(W)>X||Math.abs(q)>X)&&(x.current=null)},onPointerUp:C=>{r.onPointerUp==null||r.onPointerUp.call(r,C),x.current=null,P.current=!1,c(C)},onPointerOut:C=>{r.onPointerOut==null||r.onPointerOut.call(r,C),B(I.current)},onContextMenu:C=>{r.onContextMenu==null||r.onContextMenu.call(r,C),I.current&&B(I.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}=qe(),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(x=>x===c);if(A===-1)return;const L=i[A+1];h(L)}function D(){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),D()},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=qe(),{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 r}from"./index-M_tY9XTt.js";import{B as o}from"./BriefPane-BsW7qf9q.js";import"./useSearchTokenContext-DU66fBNH.js";import"./kbd-BHAPJuqc.js";import"./useMessageBodyContent-BVHgD2uM.js";import"./useMediaQuery-D0jZQl9A.js";import"./enums-CCxx0t2v.js";import"./search-scope-BqP7bipM.js";import"./MailListHeader-BIcOZoHT.js";import"./search-token-index-Dq1YsfkF.js";import"./attachment-file-uAdi6sKR.js";import"./mail-D6GOeJKp.js";import"./avatar-CFndQH5R.js";import"./index-DJa-q1BD.js";import"./useSignature-B9-4He3j.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CVloHKPu.js";import"./ErrorState-BF7k9VeT.js";import"./format-HasNd5qT.js";import"./download-DM2bn95G.js";import"./shield-check-CFPVcDje.js";import"./move-options-E3q-ftA4.js";import"./useFilters-BxSvo_8a.js";import"./confirm-dialog-tiuVS57c.js";import"./clock-Cm_TLM05.js";import"./menu-DnyLlQ6R.js";import"./useRefreshControl-XfZdONZZ.js";import"./circle-check-big-CPS4axVs.js";import"./useLabels-BfLvkcxZ.js";import"./useSemanticSearch-DX_yFDSq.js";import"./search-query-Cr_ZXBCp.js";function D(){return r.jsx(o.Reading,{})}export{D as component};
|