@remit/web-client-dist 0.0.445 → 0.0.446
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-Cblx3dGb.js → BriefPane-Bpqxot_I.js} +1 -1
- package/assets/{ErrorState-Cp-q2w9w.js → ErrorState-BWniNNLI.js} +1 -1
- package/assets/{FlaggedPane-Ch58MU9E.js → FlaggedPane-ByiGoYb9.js} +1 -1
- package/assets/{FullCompose-BdIpZxG9.js → FullCompose-Ieim42pl.js} +1 -1
- package/assets/{MailListHeader-C4iFTdSN.js → MailListHeader-BHGSftKr.js} +1 -1
- package/assets/{MailShell-B0aQqEP7.js → MailShell-DzVywptv.js} +1 -1
- package/assets/{MailViewChrome-DLb2fNYu.js → MailViewChrome-SzuUWxgg.js} +1 -1
- package/assets/{MailboxPane-tM9Qnk8K.js → MailboxPane-Di__jLmS.js} +1 -1
- package/assets/{NavMenuButton-BEErFBgW.js → NavMenuButton-BoghQWpq.js} +1 -1
- package/assets/{OnboardingWizard-CLEu4Eq2.js → OnboardingWizard-CyzX7Cvf.js} +1 -1
- package/assets/{OutboxPane-CH8APoTv.js → OutboxPane-CPK3pHCF.js} +1 -1
- package/assets/_mailboxId-W-bNF_6i.js +1 -0
- package/assets/_messageId-Czhj2--s.js +1 -0
- package/assets/_messageId-DC7OUPWh.js +1 -0
- package/assets/_messageId-DghXg7bX.js +1 -0
- package/assets/_outboxMessageId-DNdRLwuX.js +1 -0
- package/assets/_threadId-CRPQopPs.js +1 -0
- package/assets/_threadId-CvwZc1l_.js +1 -0
- package/assets/_threadId-y9iiXbc3.js +1 -0
- package/assets/{accounts-C1FX-wXA.js → accounts-EEy_hPMg.js} +1 -1
- package/assets/{advanced-C2AEDPuc.js → advanced-cZaa-yhV.js} +1 -1
- package/assets/{appearance-CkC1P9AI.js → appearance-BmzA9Zgq.js} +1 -1
- package/assets/{attachment-file-DKdoDsJb.js → attachment-file-DCCiH8rU.js} +1 -1
- package/assets/{avatar-66IHVolP.js → avatar-3gOksDCk.js} +1 -1
- package/assets/{bottom-sheet-BuQUdfIO.js → bottom-sheet-Q1Yo1VpI.js} +1 -1
- package/assets/{brief-CqCGPd9D.js → brief-Bmn0eYz9.js} +1 -1
- package/assets/brief-DW36FbWz.js +1 -0
- package/assets/{browser-ponyfill-Bv-32OYZ.js → browser-ponyfill-Cz76hLV1.js} +1 -1
- package/assets/{bug-JqbSSZae.js → bug-tKv2ttug.js} +1 -1
- package/assets/{circle-check-D7Qb9gYa.js → circle-check-BEwBL06Z.js} +1 -1
- package/assets/{circle-check-big-3v1UEeDx.js → circle-check-big-ChRe_Wku.js} +1 -1
- package/assets/{circle-help-DmuGFuc3.js → circle-help-CaHmlraq.js} +1 -1
- package/assets/{clock-BcUfg-A3.js → clock-ChSrYxbD.js} +1 -1
- package/assets/compose._-_outboxMessageId_-BQcJNEj0.js +1 -0
- package/assets/compose._-_outboxMessageId_-BdwmBbfx.js +1 -0
- package/assets/compose._-_outboxMessageId_-BgPbuoRZ.js +1 -0
- package/assets/compose._-_outboxMessageId_-QTPTiRHw.js +1 -0
- package/assets/{confirm-dialog-ivQtQll4.js → confirm-dialog-9nNs4PoT.js} +1 -1
- package/assets/{download-mx2VQnFX.js → download-B__fhY6X.js} +1 -1
- package/assets/{filters-HyB2nktC.js → filters-Bx8d67Z4.js} +1 -1
- package/assets/flagged-BR9F7MxM.js +1 -0
- package/assets/{flagged-B2Ah_D4L.js → flagged-TGasEsay.js} +1 -1
- package/assets/folders-DSef1CY9.js +1 -0
- package/assets/{help-copy-DaC5HYBZ.js → help-copy-DNeNPqsn.js} +1 -1
- package/assets/index-9kZ6vFxd.js +1 -0
- package/assets/index-B7JXK2IQ.js +1 -0
- package/assets/index-Bk6r9aYn.js +1 -0
- package/assets/{index-C_T2dvXA.js → index-Bwf9xzdM.js} +3 -3
- package/assets/index-C0Fs5W39.js +1 -0
- package/assets/index-C1PKJDoU.js +1 -0
- package/assets/index-Czhj2--s.js +1 -0
- package/assets/{index-C8zyy3XE.js → index-D6cG7byA.js} +4 -4
- package/assets/index-DC7OUPWh.js +1 -0
- package/assets/index-Dvi2nzo5.js +1 -0
- package/assets/{kbd-CX9mOiuU.js → kbd-D9zPHSME.js} +1 -1
- package/assets/{labels-DkmAGZ7K.js → labels-C8mL_8Ji.js} +1 -1
- package/assets/{mail-Do62nxWg.js → mail-ByYRm2uq.js} +1 -1
- package/assets/{mail-bfhHdZI4.js → mail-C9YlNyyX.js} +1 -1
- package/assets/{menu-B4qp5h8W.js → menu-BwITdrHJ.js} +1 -1
- package/assets/{onboarding-q1FU68bt.js → onboarding-DeE-Q-vw.js} +1 -1
- package/assets/outbox-AvlduX3v.js +1 -0
- package/assets/{pencil-HWlQ-VeT.js → pencil-B7yR5m-G.js} +1 -1
- package/assets/{rich-text-CnDN7D4n.js → rich-text-Cif9kSC5.js} +1 -1
- package/assets/{rich-text-spellcheck-worker-provider-DekTHQo0.js → rich-text-spellcheck-worker-provider-B9aC9uh5.js} +1 -1
- package/assets/{rotate-ccw-o3IPokHS.js → rotate-ccw-BeF14MYx.js} +1 -1
- package/assets/{row-actions-D2-obDQJ.js → row-actions-B8DU6Yub.js} +1 -1
- package/assets/{search-mirror-Bz6qYFNs.js → search-mirror-DPHBCjbv.js} +1 -1
- package/assets/{search-token-index-Cu3vEtDY.js → search-token-index-CxmKvGEg.js} +1 -1
- package/assets/{senders-DPVdGxvA.js → senders-N_mMAEv7.js} +1 -1
- package/assets/settings-CA2PlDc3.js +1 -0
- package/assets/{settings-screen-Ai1ERiVR.js → settings-screen-C2ZkFxf7.js} +1 -1
- package/assets/{shield-check-D5RHQNp7.js → shield-check-dOBQ-uI5.js} +1 -1
- package/assets/{suggested-vips-DLXmRg2R.js → suggested-vips-CkscQTzq.js} +1 -1
- package/assets/{useDebouncedValue-KxXY_DAe.js → useDebouncedValue-DbEOYj9t.js} +1 -1
- package/assets/{useFilters-BG3A-lfv.js → useFilters-D9hpYXHe.js} +1 -1
- package/assets/{useLabels-BAvJi8nW.js → useLabels-DoFulO_g.js} +1 -1
- package/assets/{useMessageBodyContent-CBSYjeOA.js → useMessageBodyContent-DiZa-Pn-.js} +1 -1
- package/assets/{useRefreshControl-CrWcN2XJ.js → useRefreshControl-DvC_GtG8.js} +1 -1
- package/assets/{useSearchTokenContext-C6RcQO8N.js → useSearchTokenContext-BDEE5r-4.js} +1 -1
- package/assets/{useSemanticSearch-De9TD-3t.js → useSemanticSearch-Dw7XCf2z.js} +1 -1
- package/assets/{useSignature-B4CKEb6v.js → useSignature-C4RjdCvH.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/_mailboxId-DcISVk3F.js +0 -1
- package/assets/_messageId-BZtIYzNu.js +0 -1
- package/assets/_messageId-DFnLvvGO.js +0 -1
- package/assets/_messageId-DzbGwFwZ.js +0 -1
- package/assets/_outboxMessageId-BEfNt7nb.js +0 -1
- package/assets/_threadId-Ci_-K0C6.js +0 -1
- package/assets/_threadId-DvFA5v_L.js +0 -1
- package/assets/_threadId-dk1ldVTF.js +0 -1
- package/assets/brief-C86Uy-43.js +0 -1
- package/assets/compose._-_outboxMessageId_-3VUipX_Q.js +0 -1
- package/assets/compose._-_outboxMessageId_-DAnrZybQ.js +0 -1
- package/assets/compose._-_outboxMessageId_-Du-G4jNM.js +0 -1
- package/assets/compose._-_outboxMessageId_-RHFyqrwf.js +0 -1
- package/assets/flagged-DjIUOfzE.js +0 -1
- package/assets/folders-CM8k-aJT.js +0 -1
- package/assets/index-53xrH7Fb.js +0 -1
- package/assets/index-BBeUuXvu.js +0 -1
- package/assets/index-BZdlt25E.js +0 -1
- package/assets/index-BZtIYzNu.js +0 -1
- package/assets/index-CKNZWQuQ.js +0 -1
- package/assets/index-DdEGI_Za.js +0 -1
- package/assets/index-DzbGwFwZ.js +0 -1
- package/assets/index-vx2VgI_F.js +0 -1
- package/assets/outbox-BdjOpLA8.js +0 -1
- package/assets/settings-BkFq1Zf9.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c}from"./index-
|
|
1
|
+
import{c}from"./index-D6cG7byA.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-D6cG7byA.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-D6cG7byA.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-D6cG7byA.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-Ieim42pl.js";import"./index-D6cG7byA.js";import"./ErrorState-BWniNNLI.js";import"./index-Bwf9xzdM.js";import"./useMessageBodyContent-DiZa-Pn-.js";import"./useSignature-C4RjdCvH.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DbEOYj9t.js";import"./confirm-dialog-9nNs4PoT.js";const a=o;export{a as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as o}from"./FullCompose-Ieim42pl.js";import"./index-D6cG7byA.js";import"./ErrorState-BWniNNLI.js";import"./index-Bwf9xzdM.js";import"./useMessageBodyContent-DiZa-Pn-.js";import"./useSignature-C4RjdCvH.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DbEOYj9t.js";import"./confirm-dialog-9nNs4PoT.js";const a=o;export{a as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as o}from"./FullCompose-Ieim42pl.js";import"./index-D6cG7byA.js";import"./ErrorState-BWniNNLI.js";import"./index-Bwf9xzdM.js";import"./useMessageBodyContent-DiZa-Pn-.js";import"./useSignature-C4RjdCvH.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DbEOYj9t.js";import"./confirm-dialog-9nNs4PoT.js";const a=o;export{a as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as o}from"./FullCompose-Ieim42pl.js";import"./index-D6cG7byA.js";import"./ErrorState-BWniNNLI.js";import"./index-Bwf9xzdM.js";import"./useMessageBodyContent-DiZa-Pn-.js";import"./useSignature-C4RjdCvH.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DbEOYj9t.js";import"./confirm-dialog-9nNs4PoT.js";const a=o;export{a as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,j as e,L as b,b as o}from"./index-
|
|
1
|
+
import{r as n,j as e,L as b,b as o}from"./index-D6cG7byA.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-D6cG7byA.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{x as X,aj as Z,a_ as ee,a$ as te,r as x,b0 as se,j as t,b1 as ae,b2 as ie,ar as R,B as N,b3 as ne,az as re,aF as oe,b4 as le,b5 as ce,T as de,D as z,z as me,b6 as ue,G as pe,H as xe,b7 as fe,b8 as he,a0 as ge,a1 as be,aD as ve,aH as je}from"./index-C8zyy3XE.js";import{S as ye}from"./settings-screen-Ai1ERiVR.js";import{B as Ne}from"./bottom-sheet-BuQUdfIO.js";import{u as Ce,a as Se}from"./useLabels-BAvJi8nW.js";import{b as Fe,N as S,p as Me,u as Ie,r as we,a as Ee,S as L,c as Oe,n as De,f as Ae,d as Le,e as Te,g as ke}from"./useFilters-BG3A-lfv.js";import{C as A}from"./circle-check-D7Qb9gYa.js";import{E as P}from"./ErrorState-Cp-q2w9w.js";import"./avatar-66IHVolP.js";import"./menu-B4qp5h8W.js";import"./circle-help-DmuGFuc3.js";const Re=(e,s)=>{const r=X(),i=Z({...te(),onSuccess:()=>{e&&(r.invalidateQueries({queryKey:Fe(e)}),s&&r.invalidateQueries({queryKey:ee({path:{accountId:e,filterId:s}})}))}}),{mutate:c}=i;return{updateFilter:x.useCallback(d=>{!e||!s||c({path:{accountId:e,filterId:s},body:d})},[e,s,c]),isPending:i.isPending,isSuccess:i.isSuccess,isError:i.isError,error:i.error,reset:i.reset}},ze=(e,s=!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,...s?{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"?Pe(e.expiresAt):void 0,name:e.name}),Pe=e=>{if(!e)return"";const s=Date.parse(e);if(Number.isNaN(s))return"";const r=new Date(s),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(s=>[s.field,s.value]),operator:e.matchOperator,move:e.moveMailboxId??null,label:e.labelId??null,widen:e.widen?e.widen.inactive?"inactive":"active":"none"}),$=(e,s)=>T(e)!==T(s),k=e=>JSON.stringify({scope:e.scope==="until"?"until":"standing",until:e.scope==="until"?e.until??"":""}),_=(e,s)=>k(e)!==k(s),$e=(e,s)=>{const r={},i=(e.name??"").trim();return i!==(s.name??"").trim()&&(r.name=i),$(e,s)&&(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,s)&&(r.scope=e.scope==="until"?"Temporary":"Standing",e.scope==="until"&&(r.expiresAt=Me(e.until??""))),r};function _e({accountId:e,filter:s,folders:r,delimiter:i,labels:c,semanticUnavailable:g=!1,onClose:d}){const f=x.useMemo(()=>ze(s,g),[s,g]),[n,l]=x.useState(f),[m,u]=x.useState(),[h,v]=x.useState(!1),M=x.useRef(0),{count:C}=Ie(e,we(n)),y=Re(e,s.filterId),b=Ee(e),{createFolderIn:F}=se(e),{createLabel:E}=Ce(e),I=async o=>{const a=await E(o);return{id:a.labelId,name:a.name,color:a.color}},p=()=>u({mode:"add",draft:{field:L[0],value:""}}),w=o=>{const a=n.clauses.find(j=>j.id===o);a&&u({mode:"edit",clauseId:o,draft:{field:a.field,value:a.value}})},O=o=>u(a=>a&&{...a,draft:{...a.draft,field:o}}),B=o=>u(a=>a&&{...a,draft:{...a.draft,value:o}}),U=()=>{if(!m)return;const o=m.draft.field,a=De(o,m.draft.value);a!==""&&(l(j=>m.mode==="edit"&&m.clauseId?{...j,clauses:j.clauses.map(D=>D.id===m.clauseId?{id:D.id,field:o,value:a}:D)}:(M.current+=1,{...j,clauses:[...j.clauses,{id:`new-${M.current}`,field:o,value:a}]})),u(void 0))},H=o=>l(a=>({...a,clauses:a.clauses.filter(j=>j.id!==o)})),K=o=>l(a=>({...a,matchOperator:o})),G=o=>l(a=>({...a,moveMailboxId:o||void 0})),Q=o=>l(a=>({...a,labelId:o||void 0})),J=o=>l(a=>({...a,name:o})),V=o=>l(a=>({...a,scope:o,until:o==="until"?a.until:void 0})),q=o=>l(a=>({...a,until:o})),W=()=>{const o=$(n,f)||_(n,f),a=$e(n,f);if(Object.keys(a).length===0){d();return}v(o),y.updateFilter(a)},Y=()=>b.start(Oe(n));return b.isStarting||b.isRunning||b.isDone?t.jsx(Ke,{progress:b.progress,isDone:b.isDone,onClose:d}):y.isPending?t.jsx(Be,{}):y.isError?t.jsx(Ge,{onRetry:y.reset,onClose:d}):y.isSuccess?h?t.jsx(He,{preview:ae(C),blocked:C.status!=="ready"||C.stale===!0,onReapply:Y,onClose:d}):t.jsx(Ue,{onClose:d}):t.jsx(ie,{rule:n,folders:r,delimiter:i,labels:c,preview:C,semanticAvailable:!1,clauseFields:L,anchorLocked:!0,clauseEdit:m,onStartAddClause:p,onStartEditClause:w,onRemoveClause:H,onChangeDraftField:O,onChangeDraftValue:B,onSubmitClause:U,onCancelClause:()=>u(void 0),onChangeMatchOperator:K,onChangeMove:G,onCreateFolder:F,onChangeLabel:Q,onCreateLabel:I,onChangeName:J,onChangeScope:V,onChangeUntil:q,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 Ue({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 He({preview:e,blocked:s,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:s,children:"Move existing mail"}),t.jsx(N,{variant:"ghost",onClick:i,children:"Not now"})]})]})}function Ke({progress:e,isDone:s,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:[s?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"}),!s&&t.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving existing mail…"}),s&&!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`:"","."]})]}),s&&i&&t.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:e.errorMessage||"Something went wrong. Please try again."}),s&&t.jsx(N,{variant:"primary",onClick:r,className:"mt-2",children:"Done"})]})}function Ge({onRetry:e,onClose:s}){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:s,children:"Not now"})]})]})}function Qe({accountId:e,filter:s,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d}){const f=ne(),n=t.jsx(_e,{accountId:e,filter:s,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d});return f?t.jsx(re,{open:!0,onClose:d,title:"Filter rule",children:n}):t.jsx(Ne,{open:!0,onClose:d,dismissLabel:"Dismiss filter rule",children:n})}function Je({filters:e,mailboxName:s,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?s(n.actionMailboxId):void 0,h=n.actionLabelId!==S?r.get(n.actionLabelId):void 0,v=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(oe,{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"&&v?m?` · expired ${v}`:` · until ${v}`: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(le,{widen:{anchorCount:1,...d?{inactive:!0}:{}}}),h&&t.jsx(ce,{label:{labelId:h.id,name:h.name,color:h.color}})]})]}),t.jsx(N,{variant:"ghost",size:"sm",icon:t.jsx(de,{className:"size-4 text-danger"}),onClick:()=>c(n.filterId),disabled:g===n.filterId,"aria-label":`Delete filter ${n.name}`})]},n.filterId)})})}const Ve=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 qe({account:e}){const s=e.accountId,{filters:r,isPending:i,isError:c,error:g,refetch:d}=Te(s),{deleteFilter:f,deletingFilterId:n}=ke(s),[l,m]=x.useState(),{data:u}=z({...me({path:{accountId:s}}),staleTime:1/0}),h=ue(),v=x.useMemo(()=>pe(e.folderAppointments),[e.folderAppointments]),M=x.useCallback(p=>{const w=u?.items.find(O=>O.mailboxId===p);if(w)return xe(w,v.get(p),h)},[u?.items,v,h]),C=x.useMemo(()=>fe({mailboxes:u?.items??[],folderAppointments:e.folderAppointments,translator:h}),[u?.items,e.folderAppointments,h]),y=he(u?.items??[]),{labels:b}=Se(s),F=x.useMemo(()=>b.map(p=>({id:p.labelId,name:p.name,color:p.color})),[b]),E=x.useMemo(()=>new Map(F.map(p=>[p.id,p])),[F]),I=r.find(p=>p.filterId===l);return t.jsxs("section",{className:"space-y-2",children:[t.jsx("h2",{className:"text-sm font-semibold text-fg",children:e.email}),I&&t.jsx(Qe,{accountId:s,filter:I,folders:C,delimiter:y,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(P,{variant:"inline",title:`Couldn't load filters for ${e.email}`,error:g,onRetry:()=>{d()}}):t.jsx(Je,{filters:r,mailboxName:M,labelById:E,onEdit:m,onDelete:f,deletingFilterId:n})]})}function rt(){const e=ge(),[s,r]=x.useState(!0),{data:i,isPending:c,isError:g,error:d,refetch:f}=z(be()),n=l=>{const m=je[l];m&&e({to:m})};return t.jsx(ye,{items:ve,activeId:"filters",title:"Filters",description:"Standing and temporary rules created by Organize, per account.",help:Ve,helpOpen:s,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(P,{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(qe,{account:l},l.accountId))})})}export{qe as AccountFilters,rt as component};
|
|
1
|
+
import{x as X,aj as Z,a_ as ee,a$ as te,r as x,b0 as se,j as t,b1 as ae,b2 as ie,ar as R,B as N,b3 as ne,az as re,aF as oe,b4 as le,b5 as ce,T as de,D as z,z as me,b6 as ue,G as pe,H as xe,b7 as fe,b8 as he,a0 as ge,a1 as be,aD as ve,aH as je}from"./index-D6cG7byA.js";import{S as ye}from"./settings-screen-C2ZkFxf7.js";import{B as Ne}from"./bottom-sheet-Q1Yo1VpI.js";import{u as Ce,a as Se}from"./useLabels-DoFulO_g.js";import{b as Fe,N as S,p as Me,u as Ie,r as we,a as Ee,S as L,c as Oe,n as De,f as Ae,d as Le,e as Te,g as ke}from"./useFilters-D9hpYXHe.js";import{C as A}from"./circle-check-BEwBL06Z.js";import{E as P}from"./ErrorState-BWniNNLI.js";import"./avatar-3gOksDCk.js";import"./menu-BwITdrHJ.js";import"./circle-help-CaHmlraq.js";const Re=(e,s)=>{const r=X(),i=Z({...te(),onSuccess:()=>{e&&(r.invalidateQueries({queryKey:Fe(e)}),s&&r.invalidateQueries({queryKey:ee({path:{accountId:e,filterId:s}})}))}}),{mutate:c}=i;return{updateFilter:x.useCallback(d=>{!e||!s||c({path:{accountId:e,filterId:s},body:d})},[e,s,c]),isPending:i.isPending,isSuccess:i.isSuccess,isError:i.isError,error:i.error,reset:i.reset}},ze=(e,s=!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,...s?{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"?Pe(e.expiresAt):void 0,name:e.name}),Pe=e=>{if(!e)return"";const s=Date.parse(e);if(Number.isNaN(s))return"";const r=new Date(s),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(s=>[s.field,s.value]),operator:e.matchOperator,move:e.moveMailboxId??null,label:e.labelId??null,widen:e.widen?e.widen.inactive?"inactive":"active":"none"}),$=(e,s)=>T(e)!==T(s),k=e=>JSON.stringify({scope:e.scope==="until"?"until":"standing",until:e.scope==="until"?e.until??"":""}),_=(e,s)=>k(e)!==k(s),$e=(e,s)=>{const r={},i=(e.name??"").trim();return i!==(s.name??"").trim()&&(r.name=i),$(e,s)&&(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,s)&&(r.scope=e.scope==="until"?"Temporary":"Standing",e.scope==="until"&&(r.expiresAt=Me(e.until??""))),r};function _e({accountId:e,filter:s,folders:r,delimiter:i,labels:c,semanticUnavailable:g=!1,onClose:d}){const f=x.useMemo(()=>ze(s,g),[s,g]),[n,l]=x.useState(f),[m,u]=x.useState(),[h,v]=x.useState(!1),M=x.useRef(0),{count:C}=Ie(e,we(n)),y=Re(e,s.filterId),b=Ee(e),{createFolderIn:F}=se(e),{createLabel:E}=Ce(e),I=async o=>{const a=await E(o);return{id:a.labelId,name:a.name,color:a.color}},p=()=>u({mode:"add",draft:{field:L[0],value:""}}),w=o=>{const a=n.clauses.find(j=>j.id===o);a&&u({mode:"edit",clauseId:o,draft:{field:a.field,value:a.value}})},O=o=>u(a=>a&&{...a,draft:{...a.draft,field:o}}),B=o=>u(a=>a&&{...a,draft:{...a.draft,value:o}}),U=()=>{if(!m)return;const o=m.draft.field,a=De(o,m.draft.value);a!==""&&(l(j=>m.mode==="edit"&&m.clauseId?{...j,clauses:j.clauses.map(D=>D.id===m.clauseId?{id:D.id,field:o,value:a}:D)}:(M.current+=1,{...j,clauses:[...j.clauses,{id:`new-${M.current}`,field:o,value:a}]})),u(void 0))},H=o=>l(a=>({...a,clauses:a.clauses.filter(j=>j.id!==o)})),K=o=>l(a=>({...a,matchOperator:o})),G=o=>l(a=>({...a,moveMailboxId:o||void 0})),Q=o=>l(a=>({...a,labelId:o||void 0})),J=o=>l(a=>({...a,name:o})),V=o=>l(a=>({...a,scope:o,until:o==="until"?a.until:void 0})),q=o=>l(a=>({...a,until:o})),W=()=>{const o=$(n,f)||_(n,f),a=$e(n,f);if(Object.keys(a).length===0){d();return}v(o),y.updateFilter(a)},Y=()=>b.start(Oe(n));return b.isStarting||b.isRunning||b.isDone?t.jsx(Ke,{progress:b.progress,isDone:b.isDone,onClose:d}):y.isPending?t.jsx(Be,{}):y.isError?t.jsx(Ge,{onRetry:y.reset,onClose:d}):y.isSuccess?h?t.jsx(He,{preview:ae(C),blocked:C.status!=="ready"||C.stale===!0,onReapply:Y,onClose:d}):t.jsx(Ue,{onClose:d}):t.jsx(ie,{rule:n,folders:r,delimiter:i,labels:c,preview:C,semanticAvailable:!1,clauseFields:L,anchorLocked:!0,clauseEdit:m,onStartAddClause:p,onStartEditClause:w,onRemoveClause:H,onChangeDraftField:O,onChangeDraftValue:B,onSubmitClause:U,onCancelClause:()=>u(void 0),onChangeMatchOperator:K,onChangeMove:G,onCreateFolder:F,onChangeLabel:Q,onCreateLabel:I,onChangeName:J,onChangeScope:V,onChangeUntil:q,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 Ue({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 He({preview:e,blocked:s,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:s,children:"Move existing mail"}),t.jsx(N,{variant:"ghost",onClick:i,children:"Not now"})]})]})}function Ke({progress:e,isDone:s,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:[s?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"}),!s&&t.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving existing mail…"}),s&&!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`:"","."]})]}),s&&i&&t.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:e.errorMessage||"Something went wrong. Please try again."}),s&&t.jsx(N,{variant:"primary",onClick:r,className:"mt-2",children:"Done"})]})}function Ge({onRetry:e,onClose:s}){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:s,children:"Not now"})]})]})}function Qe({accountId:e,filter:s,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d}){const f=ne(),n=t.jsx(_e,{accountId:e,filter:s,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d});return f?t.jsx(re,{open:!0,onClose:d,title:"Filter rule",children:n}):t.jsx(Ne,{open:!0,onClose:d,dismissLabel:"Dismiss filter rule",children:n})}function Je({filters:e,mailboxName:s,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?s(n.actionMailboxId):void 0,h=n.actionLabelId!==S?r.get(n.actionLabelId):void 0,v=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(oe,{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"&&v?m?` · expired ${v}`:` · until ${v}`: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(le,{widen:{anchorCount:1,...d?{inactive:!0}:{}}}),h&&t.jsx(ce,{label:{labelId:h.id,name:h.name,color:h.color}})]})]}),t.jsx(N,{variant:"ghost",size:"sm",icon:t.jsx(de,{className:"size-4 text-danger"}),onClick:()=>c(n.filterId),disabled:g===n.filterId,"aria-label":`Delete filter ${n.name}`})]},n.filterId)})})}const Ve=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 qe({account:e}){const s=e.accountId,{filters:r,isPending:i,isError:c,error:g,refetch:d}=Te(s),{deleteFilter:f,deletingFilterId:n}=ke(s),[l,m]=x.useState(),{data:u}=z({...me({path:{accountId:s}}),staleTime:1/0}),h=ue(),v=x.useMemo(()=>pe(e.folderAppointments),[e.folderAppointments]),M=x.useCallback(p=>{const w=u?.items.find(O=>O.mailboxId===p);if(w)return xe(w,v.get(p),h)},[u?.items,v,h]),C=x.useMemo(()=>fe({mailboxes:u?.items??[],folderAppointments:e.folderAppointments,translator:h}),[u?.items,e.folderAppointments,h]),y=he(u?.items??[]),{labels:b}=Se(s),F=x.useMemo(()=>b.map(p=>({id:p.labelId,name:p.name,color:p.color})),[b]),E=x.useMemo(()=>new Map(F.map(p=>[p.id,p])),[F]),I=r.find(p=>p.filterId===l);return t.jsxs("section",{className:"space-y-2",children:[t.jsx("h2",{className:"text-sm font-semibold text-fg",children:e.email}),I&&t.jsx(Qe,{accountId:s,filter:I,folders:C,delimiter:y,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(P,{variant:"inline",title:`Couldn't load filters for ${e.email}`,error:g,onRetry:()=>{d()}}):t.jsx(Je,{filters:r,mailboxName:M,labelById:E,onEdit:m,onDelete:f,deletingFilterId:n})]})}function rt(){const e=ge(),[s,r]=x.useState(!0),{data:i,isPending:c,isError:g,error:d,refetch:f}=z(be()),n=l=>{const m=je[l];m&&e({to:m})};return t.jsx(ye,{items:ve,activeId:"filters",title:"Filters",description:"Standing and temporary rules created by Organize, per account.",help:Ve,helpOpen:s,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(P,{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(qe,{account:l},l.accountId))})})}export{qe as AccountFilters,rt as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o,a4 as i}from"./index-D6cG7byA.js";import{a as m}from"./MailShell-DzVywptv.js";import{F as r}from"./FlaggedPane-ByiGoYb9.js";import{g as p}from"./search-token-index-CxmKvGEg.js";import{u as e}from"./search-mirror-DPHBCjbv.js";import"./FullCompose-Ieim42pl.js";import"./ErrorState-BWniNNLI.js";import"./index-Bwf9xzdM.js";import"./useMessageBodyContent-DiZa-Pn-.js";import"./useSignature-C4RjdCvH.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DbEOYj9t.js";import"./confirm-dialog-9nNs4PoT.js";import"./useSearchTokenContext-BDEE5r-4.js";import"./kbd-D9zPHSME.js";import"./search-scope-DTcpOp3S.js";import"./MailListHeader-BHGSftKr.js";import"./attachment-file-DCCiH8rU.js";import"./mail-C9YlNyyX.js";import"./avatar-3gOksDCk.js";import"./format-23Av07Go.js";import"./download-B__fhY6X.js";import"./shield-check-dOBQ-uI5.js";import"./useFilters-D9hpYXHe.js";import"./clock-ChSrYxbD.js";import"./menu-BwITdrHJ.js";import"./MailViewChrome-SzuUWxgg.js";import"./wizard-selection-B1bng5Jq.js";function w(){const t=p();return e({to:"/mail/flagged"}),o.jsx(r,{thread:t,children:o.jsx(m,{phone:o.jsx(r.Phone,{}),list:o.jsx(r.List,{}),reading:o.jsx(i,{}),intelligence:o.jsx(r.Intelligence,{}),hasThread:!!t})})}export{w as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r}from"./index-
|
|
1
|
+
import{j as r}from"./index-D6cG7byA.js";import{E as o}from"./ErrorState-BWniNNLI.js";const l=({error:t,reset:e})=>r.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:r.jsx(o,{title:"Couldn't load your starred mail",error:t,onRetry:e})});export{l as errorComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,B as N,T as B,b9 as Y,r as c,az as W,X,aI as he,ap as J,F as xe,ba as K,bb as fe,ao as pe,as as ge,aE as L,aL as be,bc as ve,x as Z,Y as ee,a5 as se,bd as je,be as ye,aJ as Ne,W as ke,bf as Ce,bg as _,bh as we,bi as Se,bj as te,bk as Ie,bl as Q,b0 as ae,b6 as re,b7 as Me,H as G,G as ne,ar as H,bm as V,bn as Ee,af as De,bo as Ae,a0 as Oe,D as ie,a1 as Te,aD as Re,aH as Pe,z as Fe,aj as U,bp as $e,bq as ze,br as Le,aP as _e,bs as Be,bt as Ge}from"./index-D6cG7byA.js";import{P as He}from"./pencil-B7yR5m-G.js";import{S as qe}from"./settings-screen-C2ZkFxf7.js";import{E as oe}from"./ErrorState-BWniNNLI.js";import"./avatar-3gOksDCk.js";import"./menu-BwITdrHJ.js";import"./circle-help-CaHmlraq.js";const Ke=({label:s,onRename:t,onDelete:a,deleteBlockedReason:o,renameLabel:m=u=>`Rename ${u}`,deleteLabel:r=u=>`Delete ${u}`})=>{const u=o?`${r(s)} — ${o}`:r(s);return e.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 pr-2",children:[e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(He,{className:"size-3.5"}),"aria-label":m(s),onClick:t}),e.jsx("span",{title:o,children:e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(B,{className:"size-3.5"}),"aria-label":u,disabled:o!==void 0,onClick:a})})]})},Qe=({folders:s,onRename:t,onDelete:a,onCreateFolder:o,delimiter:m,labels:r})=>{const u=new Map(s.map(l=>[l.id,l]));return e.jsx(Y,{folders:s,onCreateFolder:o,delimiter:m,labels:{treeAriaLabel:"Your folders",optionLabel:l=>l.label,...r},rowActions:l=>{const i=u.get(l.id);return i?e.jsx(Ke,{label:i.label,deleteBlockedReason:i.deleteBlockedReason,renameLabel:r?.rename,deleteLabel:r?.remove,onRename:()=>t(i),onDelete:()=>a(i)}):null}})},Ve=({open:s,folderLabel:t,defaultLabel:a,name:o,onNameChange:m,onSubmit:r,onClose:u,pending:l=!1,error:i})=>{const d=c.useId(),g=`Rename ${t}`;return s?e.jsxs(W,{open:s,onClose:u,title:g,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:g}),e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(X,{className:"size-3.5"}),onClick:u,"aria-label":"Cancel"})]}),e.jsxs("div",{className:"space-y-3 px-5 py-4",children:[e.jsxs("div",{children:[e.jsx(he,{htmlFor:d,children:"Folder name"}),e.jsx(J,{id:d,value:o,placeholder:a,onChange:p=>m(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),r())}})]}),e.jsxs("p",{className:"text-xs text-fg-muted",children:["Shown everywhere in Remit. Leave it blank to use"," ",e.jsx("span",{className:"font-medium text-fg",children:a}),"."]}),i&&e.jsx("p",{className:"text-xs text-danger",role:"alert",children:i})]}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:u,children:"Cancel"}),e.jsx(N,{variant:"primary",size:"sm",onClick:r,disabled:l,children:l?"Saving…":"Save name"})]})]}):null},Ue=["inbox","drafts","sent","archive","junk","trash"],q="",Ye={mailboxId:null,source:"None"};function We(s){const t=s.messageCount===1?"msg":"msgs";return`${K(s.providerPath,s.hierarchyDelimiter)} · ${s.messageCount} ${t}`}const le=s=>`${s} ${s===1?"message":"messages"}`,Xe=(s,t)=>s==="Appointed"?"Chosen by you":s==="Flagged"?`The mail server marks it as ${t}`:s==="Reserved"?"The account's own INBOX":"Matched by name, not confirmed";function Je({role:s,folders:t,appointment:a,displayName:o,onAppoint:m,onRename:r}){const[u,l]=c.useState(o),i=c.useRef(null),d=c.useRef(!1),g=c.useId(),{mailboxId:p,source:v,staleFolderPath:j}=a,h=t.find(y=>y.mailboxId===p)??null,f=be(s),O=h!=null&&u.trim()!==o.trim();c.useEffect(()=>{!d.current||v==="Proposed"||(d.current=!1,i.current?.focus())},[v]);const M=(()=>{if(v==="None"){const y=s==="trash"?" Deleting mail needs one.":"";return e.jsx("span",{id:g,className:"pl-[7.5rem] text-xs text-fg-muted",children:`Not set — pick the folder this account uses for ${f}.${y}`})}return v==="Stale"||!h?null:e.jsx("span",{id:g,className:"truncate pl-[7.5rem] text-2xs text-fg-subtle",title:h.providerPath,children:`${Xe(v,f)} · ${h.providerPath} · ${le(h.messageCount)}`})})(),w=s==="trash"?" Deleting mail is stopped until you pick another one.":h?` reader is using ${K(h.providerPath,h.hierarchyDelimiter)} instead.`:"",A=`The folder you chose for ${f}${j?` — ${j} —`:""} is gone from the mail server.${w}`;return e.jsxs("div",{className:"flex flex-col gap-1 border-b border-line px-row-inset py-2.5 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"flex w-28 shrink-0 items-center gap-2 text-sm font-medium text-fg",children:[fe(s),f]}),e.jsxs(pe,{ref:i,className:"w-56 shrink-0",value:p??q,"aria-label":`Folder for ${f}`,"aria-describedby":M||v==="Stale"?g:void 0,onChange:y=>m(s,y.target.value===q?null:y.target.value),children:[e.jsx("option",{value:q,children:"None"}),t.map(y=>e.jsx("option",{value:y.mailboxId,children:We(y)},y.mailboxId))]}),v==="Proposed"&&h&&e.jsx(N,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{d.current=!0,m(s,h.mailboxId)},children:`Set as ${f}`}),h&&e.jsxs(e.Fragment,{children:[e.jsx(J,{className:"flex-1",value:u,placeholder:f,"aria-label":`Display name for ${f}`,onChange:y=>l(y.target.value)}),O&&e.jsx(N,{variant:"ghost",size:"sm",className:"shrink-0",icon:e.jsx(ge,{className:"size-4"}),"aria-label":"Save display name",onClick:()=>r(h.mailboxId,u)})]})]}),M,v==="Stale"&&e.jsx(L,{tone:"warning",variant:"soft",className:"ml-[7.5rem]",children:e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{id:g,className:"flex-1",children:A}),e.jsx(N,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>i.current?.focus(),children:"Pick a folder"})]})})]})}function Ze({accountEmail:s,folders:t,appointments:a,displayNames:o={},onAppoint:m,onRename:r}){const u=new Set(Object.values(a).map(i=>i.mailboxId).filter(i=>i!=null)),l=t.filter(i=>!u.has(i.mailboxId));return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsxs("h2",{className:"text-sm font-semibold text-fg",children:["Folder roles — ",s]}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Each role points to one folder. Pick the folder that holds the mail — the counts help you tell real folders from empty look-alikes. Each row says where its answer came from — your choice, the mail server's own flag, or a name reader matched."})]}),e.jsx("div",{className:"rounded-sm border border-line bg-surface",children:Ue.map(i=>{const d=a[i]??Ye;return e.jsx(Je,{role:i,folders:t,appointment:d,displayName:d.mailboxId?o[d.mailboxId]??"":"",onAppoint:m,onRename:r},i)})}),l.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("h3",{className:"text-xs font-medium text-fg-muted",children:"Other folders"}),e.jsx("ul",{className:"rounded-sm border border-line bg-surface",children:l.map(i=>e.jsxs("li",{className:"flex items-center gap-2 border-b border-line px-row-inset py-2 text-sm text-fg last:border-b-0",children:[e.jsx(xe,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate",children:K(i.providerPath,i.hierarchyDelimiter)}),e.jsx("span",{className:"ml-auto shrink-0 text-2xs text-fg-subtle",children:le(i.messageCount)})]},i.mailboxId))})]})]})}const es=12e4,ss=2e3,ts="This folder is no longer in the account's folder list, so nothing was deleted.",ce=(s,t)=>{const a=s.find(o=>o.mailboxId===t);if(!a)throw new Error(ts);return a},as=(s,t)=>ce(s,t).lastSyncedAt??0;async function rs({readMailboxes:s,mailboxId:t,since:a,signal:o,segmentMs:m=es,pollIntervalMs:r=ss,delay:u=ve,now:l=Date.now}){const i=l()+m;for(;;){o?.throwIfAborted();const d=ce(await s(),t);if((d.lastSyncedAt??0)>a)return{status:"fresh",messageCount:d.messagesTotal};if(l()>=i)return{status:"pending"};await u(r,o)}}const de=50,ns=s=>s instanceof Error?s.message:"Something went wrong.",$=s=>s.then(t=>({ok:!0,value:t}),t=>({ok:!1,error:ns(t)})),is=async(s,t,a,o)=>{const m=[];let r;for(let u=0;u<de;u+=1){if(o.aborted)return m;const{data:l}=await te({path:{mailboxId:s},query:{order:"desc",continuationToken:r},throwOnError:!0});for(const i of l.items)if(!i.isDeleted&&!t.has(i.messageId)&&!m.includes(i.messageId)&&(m.push(i.messageId),m.length>=a))return m;if(!l.continuationToken)break;r=l.continuationToken}return m},os=async(s,t)=>{let a=0,o;for(let m=0;m<de;m+=1){if(t.aborted)return a;const{data:r}=await te({path:{mailboxId:s},query:{order:"desc",continuationToken:o},throwOnError:!0});for(const u of r.items)u.isDeleted||(a+=1);if(!r.continuationToken)break;o=r.continuationToken}return a};function ls({accountId:s,mailboxId:t,onDeleted:a}){const o=Z(),[m,r]=c.useState("idle"),[u,l]=c.useState(null),[i,d]=c.useState(),[g,p]=c.useState(),v=c.useRef(null),j=c.useRef(void 0),h=c.useCallback(()=>{o.invalidateQueries({queryKey:ee({path:{accountId:s}})}),o.invalidateQueries({queryKey:se()})},[o,s]),f=c.useCallback(async()=>{r("deleting");const k=await $(je({path:{accountId:s,mailboxId:t},throwOnError:!0}));if(!k.ok){d(k.error),r("error");return}h(),r("done"),a()},[s,t,h,a]),O=c.useCallback(()=>ye({path:{accountId:s},throwOnError:!0}).then(({data:k})=>k.items.find(S=>S.mailboxId===t)?.messageCount??0),[s,t]),M=c.useCallback(()=>o.fetchQuery({...Ne({path:{accountId:s}}),staleTime:0}).then(k=>k.mailboxes??[]),[o,s]),w=c.useCallback(async()=>{const k=new AbortController;v.current=k;const{signal:S}=k;r("checking"),d(void 0);const I=j.current!==void 0,C=await $((async()=>(I||(S.throwIfAborted(),j.current=as(await M(),t),S.throwIfAborted(),p(Date.now()),await ke({path:{accountId:s},throwOnError:!0})),rs({readMailboxes:M,mailboxId:t,since:j.current??0,signal:S})))());return S.aborted?(r("idle"),j.current=void 0,{status:"failed"}):C.ok?C.value.status==="pending"?(r("check-stalled"),{status:"pending"}):(j.current=void 0,C.value.messageCount>0?(r("idle"),h(),{status:"blocked",messageCount:C.value.messageCount}):(await f(),{status:"deleted"})):(j.current=void 0,d(C.error),r("error"),{status:"failed"})},[s,t,M,f,h]),A=c.useCallback(()=>{v.current?.abort()},[]),y=c.useCallback(async k=>{const S=new AbortController;v.current=S;const{signal:I}=S;r("moving"),d(void 0);const C=await $(O());if(I.aborted)return;if(!C.ok){d(C.error),r("error");return}let x=Ce(C.value);l(x);const E=new Set;for(;;){if(I.aborted)return;const n=await $(is(t,E,Ie,I));if(I.aborted)return;if(!n.ok){x=_(x,n.error),l(x),d(n.error),r("error");return}const b=n.value;if(b.length===0)break;const T=await $(we({body:{messageIds:b,destinationMailboxId:k},throwOnError:!0}));if(I.aborted)return;if(!T.ok){x=_(x,T.error),l(x),d(T.error),r("error");return}for(const F of b)E.add(F);x=Se(x,b.length),l(x)}const D=await $(os(t,I));if(!I.aborted){if(!D.ok){x=_(x,D.error),l(x),d(D.error),r("error");return}if(D.value>0){const n=`${D.value} ${D.value===1?"email is":"emails are"} still syncing. Re-open delete to finish removing this folder.`;x=_(x,n),l(x),d(n),r("error"),h();return}await f()}},[t,O,f,h]),R=c.useCallback(()=>{v.current?.abort(),v.current=null,j.current=void 0,r("idle"),l(null),d(void 0),p(void 0)},[]);return{phase:m,progress:u,errorMessage:i,checkStartedAt:g,deleteMailbox:f,deleteIfEmpty:w,moveThenDelete:y,cancel:A,reset:R}}const z=s=>`${s} ${s===1?"email":"emails"}`;function cs({open:s,accountId:t,folder:a,mailboxes:o,appointments:m,onClose:r}){const[u,l]=c.useState(()=>Q(a.messageCount)),[i,d]=c.useState(),[g,p]=c.useState(),{createFolderIn:v}=ae(t),j=re(),{phase:h,progress:f,errorMessage:O,checkStartedAt:M,deleteMailbox:w,deleteIfEmpty:A,moveThenDelete:y,cancel:R,reset:k}=ls({accountId:t,mailboxId:a.mailboxId,onDeleted:r}),[S,I]=c.useState("0:00"),C=h==="checking"||h==="check-stalled";c.useEffect(()=>{if(!C||M===void 0)return;const P=()=>I(Ae(Date.now()-M));P();const ue=setInterval(P,1e3);return()=>clearInterval(ue)},[C,M]),c.useEffect(()=>{s&&(l(Q(a.messageCount)),d(void 0),k())},[s,k]),c.useEffect(()=>{s&&p(void 0)},[s]),c.useEffect(()=>R,[R]);const x=c.useCallback(()=>{R(),r()},[R,r]),E=c.useCallback(async()=>{const P=await A();P.status==="blocked"&&(d(P.messageCount),l("choose-fate"))},[A]),D=c.useMemo(()=>Me({mailboxes:o,folderAppointments:m,excludeMailboxId:a.mailboxId,translator:j}),[o,m,a.mailboxId,j]),n=D.find(P=>P.id===g),b=c.useMemo(()=>G(a,ne(m).get(a.mailboxId),j),[a,m,j]);if(!s)return null;const T=`Delete ${b}`,F=i??a.messageCount,me=h==="moving"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(H,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving emails…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:f?V(f):"Moved 0 of 0"})]}):h==="checking"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(H,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Checking the folder on the mail server…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:`Waiting ${S}. Nothing is deleted until the server answers.`})]}):h==="check-stalled"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(L,{tone:"warning",variant:"soft",children:`The mail server hasn't reported back on this folder yet — ${S} so far. Nothing has been deleted.`}),e.jsx("p",{className:"text-xs text-fg-muted",children:"A sync covers the whole account, so a busy mailbox can take a while to come round to this folder."}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"}),e.jsx(N,{size:"sm",onClick:()=>E(),children:"Keep waiting"})]})]}):h==="deleting"||h==="done"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(H,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Deleting folder…"})]}):h==="error"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(L,{tone:"danger",variant:"soft",children:O??"Something went wrong. Please try again."}),f&&e.jsxs("p",{className:"text-xs text-fg-muted",children:[V(f),". Already-moved emails stay moved — re-open delete to continue with the rest."]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Close"})})]}):u==="confirm-empty"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:b}),"? This folder is empty and will be removed from the server."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"}),e.jsx(N,{variant:"danger",size:"sm",icon:e.jsx(B,{className:"size-3.5"}),onClick:()=>E(),children:"Delete folder"})]})]}):u==="choose-fate"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:[i!==void 0&&e.jsx(L,{tone:"warning",variant:"soft",children:`This folder is not empty: the mail server reports ${z(i)} in it. Nothing was deleted.`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:b})," holds"," ",z(F),". What should happen to them?"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{type:"button",onClick:()=>l("confirm-delete-all"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(B,{className:"size-4 shrink-0 text-danger"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Delete them with the folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"The emails are removed from the server and can't be recovered."})]})]}),e.jsxs("button",{type:"button",onClick:()=>l("pick-destination"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(Ee,{className:"size-4 shrink-0 text-accent-2"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Move them to another folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"Keep the emails, then delete the emptied folder."})]})]})]})]}),e.jsx("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"})})]}):u==="confirm-delete-all"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:b})," and its"," ",z(F),"? The messages are removed from the server with the folder and can't be recovered."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:()=>l("choose-fate"),children:"Back"}),e.jsx(N,{variant:"danger",size:"sm",icon:e.jsx(B,{className:"size-3.5"}),onClick:()=>w(),children:"Delete folder and emails"})]})]}):e.jsxs("div",{className:"flex h-[26rem] flex-col",children:[e.jsxs("p",{className:"px-5 pt-4 text-sm text-fg-muted",children:["Move the ",z(F)," in"," ",e.jsx("strong",{className:"text-fg",children:b})," to:"]}),e.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:e.jsx(Y,{folders:D,selectedId:g,delimiter:o[0]?.hierarchyDelimiter??"/",onSelect:p,onCreateFolder:v,onCancel:()=>{p(void 0),l("choose-fate")},labels:{filterPlaceholder:"Move emails to…"}})}),n&&e.jsx("footer",{className:"shrink-0 border-t border-line p-2",children:e.jsx(N,{variant:"danger",onClick:()=>y(n.id),className:"h-11 w-full font-semibold",children:e.jsx("span",{className:"truncate",children:`Move ${z(F)} to ${n.label}`})})})]});return e.jsxs(W,{open:s,onClose:x,title:T,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx(De,{className:"size-4 shrink-0 text-danger"}),e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:T}),e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(X,{className:"size-3.5"}),onClick:x,"aria-label":"Cancel"})]}),me]})}const ds=e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Each canonical role — Inbox, Drafts, Sent, Archive, Spam, Trash — points at one of your account's real folders. Pick the one that actually holds the mail; the message counts tell real folders from empty look-alikes."}),e.jsx("p",{children:`Appointing a folder to a role here doesn't touch any other role, and doesn't move or rename anything on the server — it just tells Remit which folder to treat as e.g. "Drafts" everywhere (sidebar, unread badges, the compose flow).`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Your folders"})," is the account's real hierarchy. Open a folder to see what's inside it, make a new one where you're looking, and rename or delete any of them from its row."]})]});function ms({account:s}){const t=Z(),a=s.accountId,o=re(),{data:m,isPending:r,isError:u,error:l,refetch:i}=ie(Fe({path:{accountId:a}})),{createFolderIn:d}=ae(a),g=U({...$e(),onSuccess:()=>{t.invalidateQueries({queryKey:se()})}}),p=U({...ze(),onSuccess:()=>{t.invalidateQueries({queryKey:ee({path:{accountId:a}})})}}),[v,j]=c.useState(),[h,f]=c.useState(),[O,M]=c.useState(""),w=c.useMemo(()=>m?.items??[],[m]),A=c.useMemo(()=>ne(s.folderAppointments),[s.folderAppointments]),y=c.useMemo(()=>w.map(n=>({id:n.mailboxId,label:G(n,A.get(n.mailboxId),o),path:n.fullPath,deleteBlockedReason:Le(n,w,s.folderAppointments).message})),[w,A,o,s.folderAppointments]),R=(n,b)=>{g.mutate({path:{accountId:a,role:Ge[n]},body:{mailboxId:b}})},k=(n,b)=>{const T=b.trim();p.mutate({path:{accountId:a,mailboxId:n},body:{displayNameOverride:T===""?null:T}})};if(r)return e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":`Loading folders for ${s.email}`});if(u)return e.jsx(oe,{variant:"inline",title:`Couldn't load folders for ${s.email}`,error:l,onRetry:()=>{i()}});const S=w.map(n=>({mailboxId:n.mailboxId,providerPath:n.fullPath,hierarchyDelimiter:n.hierarchyDelimiter,messageCount:n.messageCount})),I={};for(const n of s.folderAppointments){const b=_e[n.role];b&&(I[b]={mailboxId:n.mailboxId??null,source:n.source,staleFolderPath:n.staleAppointmentPath})}const C={};for(const n of w)n.displayNameOverride&&(C[n.mailboxId]=n.displayNameOverride);const x=n=>w.find(b=>b.mailboxId===n),E=x(h),D=x(v);return e.jsxs("div",{className:"space-y-4",children:[(g.isError||p.isError)&&e.jsx(L,{tone:"danger",variant:"soft",children:Be(g.error)?"That folder is still being created on the mail server — wait for it to finish, then try again.":"Couldn't save that change. Please try again."}),e.jsx(Ze,{accountEmail:s.email,folders:S,appointments:I,displayNames:C,onAppoint:R,onRename:k}),e.jsxs("section",{className:"space-y-1.5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-fg",children:["Your folders — ",s.email]}),e.jsx("div",{className:"flex h-[28rem] flex-col overflow-hidden rounded-sm border border-line bg-surface",children:e.jsx(Qe,{folders:y,delimiter:w[0]?.hierarchyDelimiter??"/",onCreateFolder:d,onRename:n=>{f(n.id),M(x(n.id)?.displayNameOverride?.trim()??"")},onDelete:n=>j(n.id),labels:{treeAriaLabel:`All folders for ${s.email}`}})})]}),E&&e.jsx(Ve,{open:!0,folderLabel:G(E,A.get(E.mailboxId),o),defaultLabel:G({fullPath:E.fullPath,hierarchyDelimiter:E.hierarchyDelimiter},A.get(E.mailboxId),o),name:O,onNameChange:M,pending:p.isPending,error:p.isError?"Couldn't save that name. Please try again.":void 0,onSubmit:()=>{const n=O.trim();p.mutate({path:{accountId:a,mailboxId:E.mailboxId},body:{displayNameOverride:n===""?null:n}},{onSuccess:()=>f(void 0)})},onClose:()=>f(void 0)}),D&&e.jsx(cs,{open:!0,accountId:a,folder:D,mailboxes:w,appointments:s.folderAppointments,onClose:()=>j(void 0)})]})}function vs(){const s=Oe(),[t,a]=c.useState(!0),{data:o,isPending:m,isError:r,error:u,refetch:l}=ie(Te()),i=d=>{const g=Pe[d];g&&s({to:g})};return e.jsx(qe,{items:Re,activeId:"folders",title:"Folder roles",description:"Appoint which real folder fills each canonical role, per account.",help:ds,helpOpen:t,onToggleHelp:()=>a(d=>!d),onSelect:i,onBackToMail:()=>{s({to:"/mail"})},children:m?e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):r?e.jsx(oe,{title:"Couldn't load accounts",error:u,onRetry:()=>{l()}}):o.accounts.length===0?e.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):e.jsx("div",{className:"space-y-8",children:o.accounts.map(d=>e.jsx(ms,{account:d},d.accountId))})})}export{vs as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./index-
|
|
1
|
+
import{j as e}from"./index-D6cG7byA.js";import{K as s}from"./kbd-D9zPHSME.js";const a=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"VIP"})," senders get priority surface in the daily brief and notification escalation, even when an account is quiet."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Muted"})," senders never notify and stay out of the brief. Their mail still syncs and stays searchable."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Blocked"})," senders never load images and go straight to junk."]}),e.jsxs("p",{children:["Tip: flag from the keyboard on any message — ",e.jsx(s,{children:"v"})," VIP,"," ",e.jsx(s,{children:"m"})," mute, ",e.jsx(s,{children:"b"})," block. Every rule an automation creates shows up here and can be removed."]})]}),r=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Sync health"})," shows the IMAP connection state and the last successful sync per account."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Error"})," means the last connection attempt failed — the raw server response is shown on the card. Reconnect re-runs the connection test from the add-account wizard."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Muted"})," accounts keep syncing but stay out of the daily brief and unified counts."]})]}),c=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Density"})," controls how much information fits on screen. Compact is great on smaller displays; Comfortable gives each item more breathing room."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Theme"})," switches between light, dark, and system-preference modes instantly. The change takes effect across the whole app immediately."]}),e.jsx("p",{className:"text-2xs text-fg-subtle",children:"Preferences are stored locally in this browser. Server-side sync is coming soon."})]}),i=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Notification rules"})," and data export are coming in a future release."]}),e.jsxs("p",{children:["A message Remit cannot read is"," ",e.jsx("strong",{className:"text-fg",children:"set aside"})," rather than skipped, and the folder keeps syncing. Setting one aside is a defect in Remit, so every entry can be reported with the diagnostics already attached."]})]});export{r as a,i as b,c,a as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./index-D6cG7byA.js";import{M as r}from"./MailboxPane-Di__jLmS.js";import"./useSearchTokenContext-BDEE5r-4.js";import"./kbd-D9zPHSME.js";import"./useMessageBodyContent-DiZa-Pn-.js";import"./search-scope-DTcpOp3S.js";import"./useRefreshControl-DvC_GtG8.js";import"./circle-check-big-ChRe_Wku.js";import"./search-token-index-CxmKvGEg.js";import"./MailListHeader-BHGSftKr.js";import"./attachment-file-DCCiH8rU.js";import"./mail-C9YlNyyX.js";import"./avatar-3gOksDCk.js";import"./index-Bwf9xzdM.js";import"./useSignature-C4RjdCvH.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DbEOYj9t.js";import"./ErrorState-BWniNNLI.js";import"./format-23Av07Go.js";import"./download-B__fhY6X.js";import"./shield-check-dOBQ-uI5.js";import"./useFilters-D9hpYXHe.js";import"./confirm-dialog-9nNs4PoT.js";import"./clock-ChSrYxbD.js";import"./menu-BwITdrHJ.js";import"./MailViewChrome-SzuUWxgg.js";import"./NavMenuButton-BoghQWpq.js";import"./useLabels-DoFulO_g.js";import"./useSemanticSearch-Dw7XCf2z.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-Q1Yo1VpI.js";import"./circle-help-CaHmlraq.js";import"./circle-check-BEwBL06Z.js";function F(){return o.jsx(r.Reading,{})}export{F as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./index-D6cG7byA.js";import{F as r}from"./FlaggedPane-ByiGoYb9.js";import"./useSearchTokenContext-BDEE5r-4.js";import"./kbd-D9zPHSME.js";import"./useMessageBodyContent-DiZa-Pn-.js";import"./search-scope-DTcpOp3S.js";import"./MailListHeader-BHGSftKr.js";import"./search-token-index-CxmKvGEg.js";import"./attachment-file-DCCiH8rU.js";import"./mail-C9YlNyyX.js";import"./avatar-3gOksDCk.js";import"./index-Bwf9xzdM.js";import"./useSignature-C4RjdCvH.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DbEOYj9t.js";import"./ErrorState-BWniNNLI.js";import"./format-23Av07Go.js";import"./download-B__fhY6X.js";import"./shield-check-dOBQ-uI5.js";import"./useFilters-D9hpYXHe.js";import"./confirm-dialog-9nNs4PoT.js";import"./clock-ChSrYxbD.js";import"./menu-BwITdrHJ.js";import"./MailViewChrome-SzuUWxgg.js";import"./wizard-selection-B1bng5Jq.js";function w(){return o.jsx(r.Reading,{})}export{w as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./index-D6cG7byA.js";import{O as t}from"./OutboxPane-CPK3pHCF.js";import"./useSearchTokenContext-BDEE5r-4.js";import"./kbd-D9zPHSME.js";import"./useMessageBodyContent-DiZa-Pn-.js";import"./search-scope-DTcpOp3S.js";import"./circle-check-big-ChRe_Wku.js";import"./clock-ChSrYxbD.js";import"./row-actions-B8DU6Yub.js";import"./rotate-ccw-BeF14MYx.js";import"./NavMenuButton-BoghQWpq.js";import"./menu-BwITdrHJ.js";import"./format-23Av07Go.js";import"./outbox-status-BlKn6P0x.js";import"./search-query-Cr_ZXBCp.js";function c(){return o.jsx(t.Reading,{})}export{c 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 m,X as Rr,b as Dr,B as nn,ar as Tr,f as Ar,T as Or,r as s,cp as Nr,cq as kr,C as Pn,af as Pr,cr as Ir,d as Lr,cs as Mr,ct as Qt,bE as In,cu as be,cv as Ln,cw as _r,a0 as Mn,x as jr,aj as yt,cx as bt,cy as Fr,cz as $r,E as Br,D as Et,by as Hr,cA as _n,aR as Wr,aS as Ur,a1 as jn,cB as Vr,ah as zr,cC as qr,cD as rn,cE as Kr,bK as kt,cF as Yr,ak as Gr,bD as Xr,ai as Qr,cG as Zr,b3 as Jr,cH as eo,ag as C}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/rich-text-spellcheck-worker-provider-B9aC9uh5.js","assets/index-D6cG7byA.js","assets/index-OWhz0EKb.css","assets/rich-text-spellcheck-provider-J8m9wz6A.js","assets/rich-text-Cif9kSC5.js","assets/confirm-dialog-9nNs4PoT.js","assets/bottom-sheet-Q1Yo1VpI.js","assets/attachment-file-DCCiH8rU.js","assets/useMessageBodyContent-DiZa-Pn-.js","assets/useSignature-C4RjdCvH.js","assets/account-form-helpers-DhckT_PN.js","assets/useDebouncedValue-DbEOYj9t.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{j as m,X as Rr,b as Dr,B as nn,ar as Tr,f as Ar,T as Or,r as s,cp as Nr,cq as kr,C as Pn,af as Pr,cr as Ir,d as Lr,cs as Mr,ct as Qt,bE as In,cu as be,cv as Ln,cw as _r,a0 as Mn,x as jr,aj as yt,cx as bt,cy as Fr,cz as $r,E as Br,D as Et,by as Hr,cA as _n,aR as Wr,aS as Ur,a1 as jn,cB as Vr,ah as zr,cC as qr,cD as rn,cE as Kr,bK as kt,cF as Yr,ak as Gr,bD as Xr,ai as Qr,cG as Zr,b3 as Jr,cH as eo,ag as C}from"./index-D6cG7byA.js";import{d as to}from"./useMessageBodyContent-DiZa-Pn-.js";import{u as no}from"./useSignature-C4RjdCvH.js";import{b as ro}from"./account-form-helpers-DhckT_PN.js";import{u as oo}from"./useDebouncedValue-DbEOYj9t.js";const ao=({email:e,displayName:t,onRemove:n,className:r})=>m.jsxs("span",{className:Dr("inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-accent-2-soft text-sm max-w-[200px]",r),children:[m.jsx("span",{className:"truncate",children:t||e}),m.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:m.jsx(Rr,{className:"size-3"})})]}),so=({save:e})=>e.status==="saving"?m.jsx("output",{className:"animate-pulse text-xs text-fg-muted",children:"Saving..."}):e.status==="saved"?m.jsx("output",{className:"text-xs text-fg-muted",children:"Draft saved"}):e.status==="error"?m.jsx("output",{className:"text-xs text-danger",children:"Save failed"}):e.status==="unsaved"?m.jsx("output",{className:"truncate text-xs text-warning",children:e.reason}):null;function io({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 m.jsxs("div",{className:"flex items-center justify-between border-t border-line px-3 py-2",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[m.jsx(nn,{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?m.jsx(Tr,{className:"size-4 animate-spin"}):m.jsx(Ar,{className:"size-4"}),onClick:()=>{if(!a){if(i!==void 0){n(i);return}t()}},children:"Send"}),m.jsx(so,{save:o})]}),m.jsx(nn,{variant:"ghost",size:"md","aria-busy":a,"aria-label":"Discard",className:"min-h-11 min-w-11 px-2 hover:text-danger",icon:m.jsx(Or,{className:"size-4"}),onClick:()=>{a||r()}})]})}const on=e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim()),co=e=>{const t=e.trim();if(!t)return;const n=t.match(/^(.+?)\s*<([^>]+)>$/);if(n){const r=n[1].trim().replace(/^"(.*)"$/,"$1"),o=n[2].trim();if(on(o))return{email:o,displayName:r}}if(on(t))return{email:t}},uo=e=>{const t=[];let n="",r=!1,o=!1;for(const a of e){if(a==='"'&&(r=!r),a==="<"&&(o=!0),a===">"&&(o=!1),(a===","||a===";")&&!r&&!o){t.push(n),n="";continue}n+=a}return t.push(n),t},lo=e=>{const t=[],n=[];for(const r of uo(e)){const o=co(r);if(o){t.push(o);continue}r.trim()&&n.push(r.trim())}return{entries:t,unparsed:n.join(", ")}},fo=["Tab",","],mo=150,po=({label:e,addresses:t,onChange:n,placeholder:r,suggestions:o=[],onQueryChange:a,onPendingChange:i,ref:c})=>{const[p,f]=s.useState(""),l=s.useRef(null),u=s.useMemo(()=>lo(p),[p]);s.useEffect(()=>{i?.(u)},[u,i]);const h=s.useRef(void 0),w=s.useCallback(()=>{h.current!==void 0&&(clearTimeout(h.current),h.current=void 0)},[]);s.useEffect(()=>w,[w]);const x=new Set(t.map(y=>y.email.toLowerCase())),d=p.length>=2?o.filter(y=>!x.has(y.email.toLowerCase())):[],E=s.useCallback(y=>{f(y),a?.(y)},[a]),b=s.useCallback(y=>{w(),!x.has(y.email.toLowerCase())&&(n([...t,y]),E(""))},[t,x,n,E,w]),D=s.useCallback(y=>{n(t.filter((_,R)=>R!==y))},[t,n]),g=s.useCallback(y=>{b(y),l.current?.focus()},[b]),v=s.useCallback(()=>{if(w(),u.entries.length===0)return{addresses:t,unparsed:u.unparsed};const y=new Set(x),_=[...t];for(const R of u.entries){const W=R.email.toLowerCase();y.has(W)||(y.add(W),_.push(R))}return n(_),E(u.unparsed),{addresses:_,unparsed:u.unparsed}},[u,t,x,n,E,w]),T=s.useCallback(()=>{w(),E("")},[E,w]);s.useImperativeHandle(c,()=>({commitPending:v,clearPending:T}),[v,T]);const M=s.useRef(v);s.useEffect(()=>{M.current=v},[v]);const S=Nr({count:d.length,acceptKeys:fo,onAccept:y=>g(d[y])}),N=s.useMemo(()=>d.map(y=>({value:y.email,label:y.displayName??y.email,...y.displayName?{hint:y.email}:{}})),[d]),k=s.useCallback(y=>{if(y.key==="Backspace"&&p===""&&t.length>0){D(t.length-1);return}S.handleKeyDown(y)||(y.key==="Enter"||y.key==="Tab"||y.key===",")&&p.trim()&&(y.preventDefault(),v())},[p,t.length,D,S.handleKeyDown,v]),j=s.useCallback(()=>{w(),h.current=setTimeout(()=>{h.current=void 0,M.current(),S.dismiss()},mo)},[w,S.dismiss]);return m.jsxs("div",{className:"relative","data-address-field":e,children:[m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsxs("label",{htmlFor:`address-field-${e}`,className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:[e,":"]}),m.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:()=>l.current?.focus(),onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&l.current?.focus()},children:[t.map((y,_)=>m.jsx(ao,{email:y.email,displayName:y.displayName,onRemove:()=>D(_)},y.email)),m.jsx("input",{ref:l,id:`address-field-${e}`,type:"text",value:p,onChange:y=>{S.reopen(),E(y.target.value)},onKeyDown:k,onBlur:j,placeholder:t.length===0?r:"",className:"flex-1 min-w-[120px] bg-transparent outline-none text-sm py-0.5",autoComplete:"off",...S.comboboxProps})]})]}),S.open&&m.jsx(kr,{id:S.listId,suggestions:N,activeIndex:S.activeIndex,optionId:S.optionId,onPick:y=>{const _=d.find(R=>R.email===y.value);_&&g(_)},onHighlight:S.setActiveIndex,label:`${e} suggestions`,className:"absolute left-12 right-0 z-50 mt-1 max-h-[200px] shadow-lg"})]})},ho=()=>m.jsxs("div",{"aria-hidden":"true","data-testid":"compose-body-skeleton",className:"min-h-[120px] px-3 py-2",children:[m.jsx("div",{className:"mb-2 h-8 animate-pulse rounded bg-surface-sunken"}),m.jsx("div",{className:"min-h-[80px] animate-pulse rounded bg-surface-sunken/50"})]});function vo({banner:e,header:t,children:n,quoted:r,actionBar:o,layout:a="fill"}){const i=a==="fill";return m.jsxs("div",{className:i?"flex h-full min-h-0 flex-col":"flex flex-col",children:[e,t,m.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&&m.jsx("div",{className:"shrink-0 px-3 pb-2",children:r})]}),i?o:m.jsx("div",{className:"sticky bottom-0 z-10 bg-canvas",children:o})]})}const Pt=({label:e,onClick:t})=>m.jsx("button",{type:"button",onClick:t,className:"text-xs text-fg-muted hover:text-fg transition-colors",children:e}),go=({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(" · ")},wo=({collapsed:e=!1,summary:t="",onExpand:n,from:r,to:o,cc:a,bcc:i,subject:c,onShowCc:p,onShowBcc:f})=>e?m.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:[m.jsx("span",{className:"truncate text-xs text-fg-muted",children:t||"…"}),m.jsx(Pn,{className:"ml-auto size-4 shrink-0 text-fg-muted","aria-hidden":"true"})]}):m.jsxs("div",{className:"space-y-1 px-3 py-2 border-b border-line",children:[r,o,a??m.jsxs("div",{className:"flex gap-2 pl-14",children:[m.jsx(Pt,{label:"Cc",onClick:p}),m.jsx(Pt,{label:"Bcc",onClick:f})]}),a&&!i&&m.jsx("div",{className:"pl-14",children:m.jsx(Pt,{label:"Bcc",onClick:f})}),i,c]}),qt="This account can't send mail until SMTP is configured.",yo=({onConfigure:e,configureRef:t})=>m.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:[m.jsx(Pr,{className:"size-5 shrink-0 mt-0.5 text-warning","aria-hidden":"true"}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("p",{className:"text-sm font-medium text-warning",children:qt}),m.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",m.jsx(Ir,{className:"size-3","aria-hidden":"true"})]})]})]}),bo=({value:e,onChange:t})=>m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx("label",{className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"Subj:"}),m.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})]}),Eo=({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 m.jsxs("div",{className:"mt-2 px-3 pb-2",children:[m.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?m.jsx(Pn,{className:"size-3"}):m.jsx(Lr,{className:"size-3"}),i?`${i} wrote:`:"Show quoted text"]}),o&&m.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?m.jsx("div",{dangerouslySetInnerHTML:{__html:t}}):e.split(`
|
|
3
3
|
`).map((c,p)=>m.jsx("p",{className:"min-h-[1.2em]",children:c},p))})]})},So=["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"],xo=["href","src","alt","colspan","rowspan","lang","dir"],Co=/^(?:https?:|mailto:)/i,Ro=/^(?:https:|data:image\/)/i,Do="max-width:100%;height:auto",To=e=>{const t=Mr();if(!t.isSupported)throw new Error("adopted HTML cannot be sanitized: no DOM is available");return t.addHook("afterSanitizeAttributes",n=>{if(n.tagName==="A"){Co.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(!Ro.test(n.getAttribute("src")??"")){n.remove();return}n.setAttribute("style",Do)}}),t},an=new Map,Ao=e=>{const t=an.get(e);if(t)return t;const n=To(e);return an.set(e,n),n},Fn=(e,t)=>Ao(t).sanitize(e,{ALLOWED_TAGS:So,ALLOWED_ATTR:xo,ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1}),Ei=e=>Fn(e,"outgoing"),Oo=e=>Fn(e,"quoted"),No=e=>typeof e=="string"&&e.length>0?"rich":"plain",Si=(e,t)=>t.length>0,ko={plain:"Couldn't switch to plain text",rich:"Couldn't switch to rich text"},xi=(e,t,n)=>t.trim()===""||n.trim()!==""?{outcome:"switch"}:{outcome:"blocked",title:ko[e],detail:"The conversion came back empty, so your message is unchanged."};function Ee(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o||!o.defaultPrevented)return t?.(o)}}function sn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Po(...e){return t=>{let n=!1;const r=e.map(o=>{const a=sn(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():sn(e[o],null)}}}}function Ae(...e){return s.useCallback(Po(...e),e)}function Io(e,t=[]){let n=[];function r(a,i){const c=s.createContext(i);c.displayName=a+"Context";const p=n.length;n=[...n,i];const f=u=>{const{scope:h,children:w,...x}=u,d=h?.[e]?.[p]||c,E=s.useMemo(()=>x,Object.values(x));return m.jsx(d.Provider,{value:E,children:w})};f.displayName=a+"Provider";function l(u,h,w={}){const{optional:x=!1}=w,d=h?.[e]?.[p]||c,E=s.useContext(d);if(E)return E;if(i!==void 0)return i;if(!x)throw new Error(`\`${u}\` must be used within \`${a}\``)}return[f,l]}const o=()=>{const a=n.map(i=>s.createContext(i));return function(c){const p=c?.[e]||a;return s.useMemo(()=>({[`__scope${e}`]:{...c,[e]:p}}),[c,p])}};return o.scopeName=e,[r,Lo(o,...t)]}function Lo(...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:p,scopeName:f})=>{const u=p(a)[`__scope${f}`];return{...c,...u}},{});return s.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var Ze=globalThis?.document?s.useLayoutEffect:()=>{},Mo=Qt[" useInsertionEffect ".trim().toString()]||Ze;function _o({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,a,i]=jo({defaultProp:t,onChange:n}),c=e!==void 0,p=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 f=s.useCallback(l=>{if(c){const u=Fo(l)?l(e):l;u!==e&&i.current?.(u)}else a(l)},[c,e,a,i]);return[p,f]}function jo({defaultProp:e,onChange:t}){const[n,r]=s.useState(e),o=s.useRef(n),a=s.useRef(t);return Mo(()=>{a.current=t},[t]),s.useEffect(()=>{o.current!==n&&(a.current?.(n),o.current=n)},[n,o]),[n,r,a]}function Fo(e){return typeof e=="function"}function $n(e){const t=s.forwardRef((n,r)=>{let{children:o,...a}=n,i=null,c=!1;const p=[];cn(o)&&typeof ut=="function"&&(o=ut(o._payload)),s.Children.forEach(o,h=>{if(Uo(h)){c=!0;const w=h;let x="child"in w.props?w.props.child:w.props.children;cn(x)&&typeof ut=="function"&&(x=ut(x._payload)),i=Bo(w,x),p.push(i?.props?.children)}else p.push(h)}),i?i=s.cloneElement(i,void 0,p):!c&&s.Children.count(o)===1&&s.isValidElement(o)&&(i=o);const f=i?Wo(i):void 0,l=Ae(r,f);if(!i){if(o||o===0)throw new Error(c?Ko(e):qo(e));return o}const u=Ho(a,i.props??{});return i.type!==s.Fragment&&(u.ref=r?l:f),s.cloneElement(i,u)});return t.displayName=`${e}.Slot`,t}var $o=Symbol.for("radix.slottable"),Bo=(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 Ho(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 p=a(...c);return o(...c),p}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}function Wo(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 Uo(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$o}var Vo=Symbol.for("react.lazy");function cn(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Vo&&"_payload"in e&&zo(e._payload)}function zo(e){return typeof e=="object"&&e!==null&&"then"in e}var qo=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.`,ut=Qt[" use ".trim().toString()],Yo=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],de=Yo.reduce((e,t)=>{const n=$n(`Primitive.${t}`),r=s.forwardRef((o,a)=>{const{asChild:i,...c}=o,p=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(p,{...c,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Go(e,t){e&&In.flushSync(()=>e.dispatchEvent(t))}function Je(e){const t=s.useRef(e);return s.useEffect(()=>{t.current=e}),s.useMemo(()=>((...n)=>t.current?.(...n)),[])}var Xo="DismissableLayer",Kt="dismissableLayer.update",Qo="dismissableLayer.pointerDownOutside",Zo="dismissableLayer.focusOutside",un,Zt=s.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Bn=s.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:c,onDismiss:p,...f}=e,l=s.useContext(Zt),[u,h]=s.useState(null),w=u?.ownerDocument??globalThis?.document,[,x]=s.useState({}),d=Ae(t,h),E=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),D=b?E.indexOf(b):-1,g=u?E.indexOf(u):-1,v=l.layersWithOutsidePointerEventsDisabled.size>0,T=g>=D,M=s.useRef(!1),S=ra(y=>{a?.(y),c?.(y),y.defaultPrevented||p?.()},{ownerDocument:w,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:M,dismissableSurfaces:l.dismissableSurfaces,shouldHandlePointerDownOutside:s.useCallback(y=>{if(!(y instanceof Node))return!1;const _=[...l.branches].some(R=>R.contains(y));return T&&!_},[l.branches,T])}),N=oa(y=>{if(r&&M.current)return;const _=y.target;[...l.branches].some(W=>W.contains(_))||(i?.(y),c?.(y),y.defaultPrevented||p?.())},w),k=u?g===E.length-1:!1,j=Je(y=>{y.key==="Escape"&&(o?.(y),!y.defaultPrevented&&p&&(y.preventDefault(),p()))});return s.useEffect(()=>{if(k)return w.addEventListener("keydown",j,{capture:!0}),()=>w.removeEventListener("keydown",j,{capture:!0})},[w,k,j]),s.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(un=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),ln(),()=>{n&&(l.layersWithOutsidePointerEventsDisabled.delete(u),l.layersWithOutsidePointerEventsDisabled.size===0&&(w.body.style.pointerEvents=un))}},[u,w,n,l]),s.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),ln())},[u,l]),s.useEffect(()=>{const y=()=>x({});return document.addEventListener(Kt,y),()=>document.removeEventListener(Kt,y)},[]),m.jsx(de.div,{...f,ref:d,style:{pointerEvents:v?T?"auto":"none":void 0,...e.style},onFocusCapture:Ee(e.onFocusCapture,N.onFocusCapture),onBlurCapture:Ee(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:Ee(e.onPointerDownCapture,S.onPointerDownCapture)})});Bn.displayName=Xo;var Jo="DismissableLayerBranch",ea=s.forwardRef((e,t)=>{const n=s.useContext(Zt),r=s.useRef(null),o=Ae(t,r);return s.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),m.jsx(de.div,{...e,ref:o})});ea.displayName=Jo;function ta(){const e=s.useContext(Zt),[t,n]=s.useState(null);return s.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}var na=()=>!0;function ra(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:a,shouldHandlePointerDownOutside:i=na}=t,c=Je(e),p=s.useRef(!1),f=s.useRef(!1),l=s.useRef(new Map),u=s.useRef(()=>{});return s.useEffect(()=>{function h(){f.current=!1,o.current=!1,l.current.clear()}function w(){return Array.from(l.current.values()).some(Boolean)}function x(g){if(!f.current)return;const v=g.target;v instanceof Node&&[...a].some(M=>M.contains(v))||l.current.set(g.type,!0),g.type==="click"&&window.setTimeout(()=>{f.current&&u.current()},0)}function d(g){f.current&&l.current.set(g.type,!1)}const E=g=>{if(g.target&&!p.current){let v=function(){n.removeEventListener("click",u.current);const M=w();h(),M||Hn(Qo,c,T,{discrete:!0})};if(!i(g.target)){n.removeEventListener("click",u.current),h(),p.current=!1;return}const T={originalEvent:g};f.current=!0,o.current=r&&g.button===0,l.current.clear(),!r||g.button!==0?v():(n.removeEventListener("click",u.current),u.current=v,n.addEventListener("click",u.current,{once:!0}))}else n.removeEventListener("click",u.current),h();p.current=!1},b=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const g of b)n.addEventListener(g,x,!0),n.addEventListener(g,d);const D=window.setTimeout(()=>{n.addEventListener("pointerdown",E)},0);return()=>{window.clearTimeout(D),n.removeEventListener("pointerdown",E),n.removeEventListener("click",u.current);for(const g of b)n.removeEventListener(g,x,!0),n.removeEventListener(g,d)}},[n,c,r,o,a,i]),{onPointerDownCapture:()=>p.current=!0}}function oa(e,t=globalThis?.document){const n=Je(e),r=s.useRef(!1);return s.useEffect(()=>{const o=a=>{a.target&&!r.current&&Hn(Zo,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 ln(){const e=new CustomEvent(Kt);document.dispatchEvent(e)}function Hn(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?Go(o,a):o.dispatchEvent(a)}var lt=0,je=null;function aa(){s.useEffect(()=>{je||(je={start:dn(),end:dn()});const{start:e,end:t}=je;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),lt++,()=>{lt===1&&(je?.start.remove(),je?.end.remove(),je=null),lt=Math.max(0,lt-1)}},[])}function dn(){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 It="focusScope.autoFocusOnMount",Lt="focusScope.autoFocusOnUnmount",fn={bubbles:!1,cancelable:!0},sa="FocusScope",Wn=s.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...i}=e,[c,p]=s.useState(null),f=Je(o),l=Je(a),u=s.useRef(null),h=Ae(t,p),w=s.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;s.useEffect(()=>{if(r){let d=function(g){if(w.paused||!c)return;const v=g.target;c.contains(v)?u.current=v:ye(u.current,{select:!0})},E=function(g){if(w.paused||!c)return;const v=g.relatedTarget;v!==null&&(c.contains(v)||ye(u.current,{select:!0}))},b=function(g){if(document.activeElement===document.body)for(const T of g)T.removedNodes.length>0&&ye(c)};document.addEventListener("focusin",d),document.addEventListener("focusout",E);const D=new MutationObserver(b);return c&&D.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",d),document.removeEventListener("focusout",E),D.disconnect()}}},[r,c,w.paused]),s.useEffect(()=>{if(c){pn.add(w);const d=document.activeElement;if(!c.contains(d)){const b=new CustomEvent(It,fn);c.addEventListener(It,f),c.dispatchEvent(b),b.defaultPrevented||(ia(fa(Un(c)),{select:!0}),document.activeElement===d&&ye(c))}return()=>{c.removeEventListener(It,f),setTimeout(()=>{const b=new CustomEvent(Lt,fn);c.addEventListener(Lt,l),c.dispatchEvent(b),b.defaultPrevented||ye(d??document.body,{select:!0}),c.removeEventListener(Lt,l),pn.remove(w)},0)}}},[c,f,l,w]);const x=s.useCallback(d=>{if(!n&&!r||w.paused)return;const E=d.key==="Tab"&&!d.altKey&&!d.ctrlKey&&!d.metaKey,b=document.activeElement;if(E&&b){const D=d.currentTarget,[g,v]=ca(D);g&&v?!d.shiftKey&&b===v?(d.preventDefault(),n&&ye(g,{select:!0})):d.shiftKey&&b===g&&(d.preventDefault(),n&&ye(v,{select:!0})):b===D&&d.preventDefault()}},[n,r,w.paused]);return m.jsx(de.div,{tabIndex:-1,...i,ref:h,onKeyDown:x})});Wn.displayName=sa;function ia(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ye(r,{select:t}),document.activeElement!==n)return}function ca(e){const t=Un(e),n=mn(t,e),r=mn(t.reverse(),e);return[n,r]}function Un(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 mn(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):ua(r,{upTo:t})))return r}function ua(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 la(e){return e instanceof HTMLInputElement&&"select"in e}function ye(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&la(e)&&t&&e.select()}}var pn=da();function da(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=hn(e,t),e.unshift(t)},remove(t){e=hn(e,t),e[0]?.resume()}}}function hn(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function fa(e){return e.filter(t=>t.tagName!=="A")}var ma=Qt[" useId ".trim().toString()]||(()=>{}),pa=0;function Mt(e){const[t,n]=s.useState(ma());return Ze(()=>{n(r=>r??String(pa++))},[e]),e||(t?`radix-${t}`:"")}var ha="Portal",Vn=s.forwardRef((e,t)=>{const{container:n,...r}=e,[o,a]=s.useState(!1);Ze(()=>a(!0),[]);const i=n||o&&globalThis?.document?.body;return i?In.createPortal(m.jsx(de.div,{...r,ref:t}),i):null});Vn.displayName=ha;function va(e,t){return s.useReducer((n,r)=>t[n][r]??n,e)}var xt=e=>{const{present:t,children:n}=e,r=ga(t),o=typeof n=="function"?n({present:r.isPresent}):s.Children.only(n),a=wa(r.ref,ya(o));return typeof n=="function"||r.isPresent?s.cloneElement(o,{ref:a}):null};xt.displayName="Presence";function ga(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",[p,f]=va(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return s.useEffect(()=>{p==="mounted"?(a.current=i.current??Ge(r.current),i.current=void 0):a.current="none"},[p]),Ze(()=>{const l=r.current,u=o.current;if(u!==e){const w=a.current,x=Ge(l);e?(i.current=x,f("MOUNT")):x==="none"||l?.display==="none"?f("UNMOUNT"):f(u&&w!==x?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,f]),Ze(()=>{if(t){let l;const u=t.ownerDocument.defaultView??window,h=x=>{const E=Ge(r.current).includes(CSS.escape(x.animationName));if(x.target===t&&E&&(f("ANIMATION_END"),!o.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",l=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},w=x=>{x.target===t&&(a.current=Ge(r.current))};return t.addEventListener("animationstart",w),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{u.clearTimeout(l),t.removeEventListener("animationstart",w),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(p),ref:s.useCallback(l=>{if(l){const u=getComputedStyle(l);r.current=u,i.current=Ge(u)}else r.current=null;n(l)},[])}}function vn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function wa(...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=vn(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():vn(r[i],null)}}},[])}function Ge(e){return e?.animationName||"none"}function ya(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 ba=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Fe=new WeakMap,dt=new WeakMap,ft={},_t=0,zn=function(e){return e&&(e.host||zn(e.parentNode))},Ea=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=zn(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=Ea(t,Array.isArray(e)?e:[e]);ft[n]||(ft[n]=new WeakMap);var a=ft[n],i=[],c=new Set,p=new Set(o),f=function(u){!u||c.has(u)||(c.add(u),f(u.parentNode))};o.forEach(f);var l=function(u){!u||p.has(u)||Array.prototype.forEach.call(u.children,function(h){if(c.has(h))l(h);else try{var w=h.getAttribute(r),x=w!==null&&w!=="false",d=(Fe.get(h)||0)+1,E=(a.get(h)||0)+1;Fe.set(h,d),a.set(h,E),i.push(h),d===1&&x&&dt.set(h,!0),E===1&&h.setAttribute(n,"true"),x||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return l(t),c.clear(),_t++,function(){i.forEach(function(u){var h=Fe.get(u)-1,w=a.get(u)-1;Fe.set(u,h),a.set(u,w),h||(dt.has(u)||u.removeAttribute(r),dt.delete(u)),w||u.removeAttribute(n)}),_t--,_t||(Fe=new WeakMap,Fe=new WeakMap,dt=new WeakMap,ft={})}},xa=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=ba(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Sa(r,o,n,"aria-hidden")):function(){return null}},gt="right-scroll-bar-position",wt="width-before-scroll-bar",Ca="with-scroll-bars-hidden",Ra="--removed-body-scroll-bar-size";function jt(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Da(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 Ta=typeof window<"u"?s.useLayoutEffect:s.useEffect,gn=new WeakMap;function Aa(e,t){var n=Da(null,function(r){return e.forEach(function(o){return jt(o,r)})});return Ta(function(){var r=gn.get(n);if(r){var o=new Set(r),a=new Set(e),i=n.current;o.forEach(function(c){a.has(c)||jt(c,null)}),a.forEach(function(c){o.has(c)||jt(c,i)})}gn.set(n,e)},[e]),n}function Oa(e){return e}function Na(e,t){t===void 0&&(t=Oa);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 p=function(){var l=i;i=[],l.forEach(a)},f=function(){return Promise.resolve().then(p)};f(),n={push:function(l){i.push(l),f()},filter:function(l){return i=i.filter(l),n}}}};return o}function ka(e){e===void 0&&(e={});var t=Na(null);return t.options=be({async:!0,ssr:!1},e),t}var qn=function(e){var t=e.sideCar,n=Ln(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,be({},n))};qn.isSideCarExport=!0;function Pa(e,t){return e.useMedium(t),qn}var Kn=ka(),Ft=function(){},Ct=s.forwardRef(function(e,t){var n=s.useRef(null),r=s.useState({onScrollCapture:Ft,onWheelCapture:Ft,onTouchMoveCapture:Ft}),o=r[0],a=r[1],i=e.forwardProps,c=e.children,p=e.className,f=e.removeScrollBar,l=e.enabled,u=e.shards,h=e.sideCar,w=e.noRelative,x=e.noIsolation,d=e.inert,E=e.allowPinchZoom,b=e.as,D=b===void 0?"div":b,g=e.gapMode,v=Ln(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=h,M=Aa([n,t]),S=be(be({},v),o);return s.createElement(s.Fragment,null,l&&s.createElement(T,{sideCar:Kn,removeScrollBar:f,shards:u,noRelative:w,noIsolation:x,inert:d,setCallbacks:a,allowPinchZoom:!!E,lockRef:n,gapMode:g}),i?s.cloneElement(s.Children.only(c),be(be({},S),{ref:M})):s.createElement(D,be({},S,{className:p,ref:M}),c))});Ct.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ct.classNames={fullWidth:wt,zeroRight:gt};var Ia=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function La(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Ia();return t&&e.setAttribute("nonce",t),e}function Ma(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function _a(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var ja=function(){var e=0,t=null;return{add:function(n){e==0&&(t=La())&&(Ma(t,n),_a(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Fa=function(){var e=ja();return function(t,n){s.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Yn=function(){var e=Fa(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},$a={left:0,top:0,right:0,gap:0},$t=function(e){return parseInt(e||"",10)||0},Ba=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[$t(n),$t(r),$t(o)]},Ha=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return $a;var t=Ba(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])}},Wa=Yn(),He="data-scroll-locked",Ua=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 m,X as Rr,b as Dr,B as nn,ar as Tr,f as Ar,T as Or,r as s,cp as Nr,c
|
|
|
40
40
|
`)},wn=function(){var e=parseInt(document.body.getAttribute(He)||"0",10);return isFinite(e)?e:0},Va=function(){s.useEffect(function(){return document.body.setAttribute(He,(wn()+1).toString()),function(){var e=wn()-1;e<=0?document.body.removeAttribute(He):document.body.setAttribute(He,e.toString())}},[])},za=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;Va();var a=s.useMemo(function(){return Ha(o)},[o]);return s.createElement(Wa,{styles:Ua(a,!t,o,n?"":"!important")})},Yt=!1;if(typeof window<"u")try{var mt=Object.defineProperty({},"passive",{get:function(){return Yt=!0,!0}});window.addEventListener("test",mt,mt),window.removeEventListener("test",mt,mt)}catch{Yt=!1}var $e=Yt?{passive:!1}:!1,qa=function(e){return e.tagName==="TEXTAREA"},Gn=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!qa(e)&&n[t]==="visible")},Ka=function(e){return Gn(e,"overflowY")},Ya=function(e){return Gn(e,"overflowX")},yn=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Xn(e,r);if(o){var a=Qn(e,r),i=a[1],c=a[2];if(i>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ga=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Xa=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Xn=function(e,t){return e==="v"?Ka(t):Ya(t)},Qn=function(e,t){return e==="v"?Ga(t):Xa(t)},Qa=function(e,t){return e==="h"&&t==="rtl"?-1:1},Za=function(e,t,n,r,o){var a=Qa(e,window.getComputedStyle(t).direction),i=a*r,c=n.target,p=t.contains(c),f=!1,l=i>0,u=0,h=0;do{if(!c)break;var w=Qn(e,c),x=w[0],d=w[1],E=w[2],b=d-E-a*x;(x||b)&&Xn(e,c)&&(u+=b,h+=x);var D=c.parentNode;c=D&&D.nodeType===Node.DOCUMENT_FRAGMENT_NODE?D.host:D}while(!p&&c!==document.body||p&&(t.contains(c)||t===c));return(l&&Math.abs(u)<1||!l&&Math.abs(h)<1)&&(f=!0),f},pt=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},bn=function(e){return[e.deltaX,e.deltaY]},En=function(e){return e&&"current"in e?e.current:e},Ja=function(e,t){return e[0]===t[0]&&e[1]===t[1]},es=function(e){return`
|
|
41
41
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
42
42
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
43
|
-
`)},ts=0,Be=[];function ns(e){var t=s.useRef([]),n=s.useRef([0,0]),r=s.useRef(),o=s.useState(ts++)[0],a=s.useState(Yn)[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 d=_r([e.lockRef.current],(e.shards||[]).map(En),!0).filter(Boolean);return d.forEach(function(E){return E.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),d.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=s.useCallback(function(d,E){if("touches"in d&&d.touches.length===2||d.type==="wheel"&&d.ctrlKey)return!i.current.allowPinchZoom;var b=pt(d),D=n.current,g="deltaX"in d?d.deltaX:D[0]-b[0],v="deltaY"in d?d.deltaY:D[1]-b[1],T,M=d.target,S=Math.abs(g)>Math.abs(v)?"h":"v";if("touches"in d&&S==="h"&&M.type==="range")return!1;var N=window.getSelection(),k=N&&N.anchorNode,j=k?k===M||k.contains(M):!1;if(j)return!1;var y=yn(S,M);if(!y)return!0;if(y?T=S:(T=S==="v"?"h":"v",y=yn(S,M)),!y)return!1;if(!r.current&&"changedTouches"in d&&(g||v)&&(r.current=T),!T)return!0;var _=r.current||T;return Za(_,E,d,_==="h"?g:v)},[]),p=s.useCallback(function(d){var E=d;if(!(!Be.length||Be[Be.length-1]!==a)){var b="deltaY"in E?bn(E):pt(E),D=t.current.filter(function(T){return T.name===E.type&&(T.target===E.target||E.target===T.shadowParent)&&Ja(T.delta,b)})[0];if(D&&D.should){E.cancelable&&E.preventDefault();return}if(!D){var g=(i.current.shards||[]).map(En).filter(Boolean).filter(function(T){return T.contains(E.target)}),v=g.length>0?c(E,g[0]):!i.current.noIsolation;v&&E.cancelable&&E.preventDefault()}}},[]),f=s.useCallback(function(d,E,b,D){var g={name:d,delta:E,target:b,should:D,shadowParent:rs(b)};t.current.push(g),setTimeout(function(){t.current=t.current.filter(function(v){return v!==g})},1)},[]),l=s.useCallback(function(d){n.current=pt(d),r.current=void 0},[]),u=s.useCallback(function(d){f(d.type,bn(d),d.target,c(d,e.lockRef.current))},[]),h=s.useCallback(function(d){f(d.type,pt(d),d.target,c(d,e.lockRef.current))},[]);s.useEffect(function(){return Be.push(a),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:h}),document.addEventListener("wheel",p,$e),document.addEventListener("touchmove",p,$e),document.addEventListener("touchstart",l,$e),function(){Be=Be.filter(function(d){return d!==a}),document.removeEventListener("wheel",p,$e),document.removeEventListener("touchmove",p,$e),document.removeEventListener("touchstart",l,$e)}},[]);var w=e.removeScrollBar,x=e.inert;return s.createElement(s.Fragment,null,x?s.createElement(a,{styles:es(o)}):null,w?s.createElement(za,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function rs(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const os=Pa(Kn,ns);var Zn=s.forwardRef(function(e,t){return s.createElement(Ct,be({},e,{ref:t,sideCar:os}))});Zn.classNames=Ct.classNames;const as={brief:"/mail/brief",flagged:"/mail/flagged",outbox:"/mail/outbox",settings:"/settings",accounts:"/settings/accounts"};function Ci(){const e=Mn();return s.useCallback(t=>{e({to:as[t]})},[e])}function ss(){const e=Mn();return s.useCallback(t=>{e({to:"/settings/accounts",search:{editAccountId:t,focusSmtp:!0}})},[e])}const Ri=({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 p=o.ctrlKey||o.metaKey;if(i.requireMeta!==void 0){if(i.requireMeta!==p)continue}else{const f=i.noModifiers??!0,l=p||o.altKey||i.requireShift===void 0&&o.shiftKey;if(f&&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])},is=(e,t)=>e===void 0&&t.toAddresses.length===0,cs={status:"unsaved",reason:"Not saved — add a To address to keep this draft."},Sn={status:"idle"},us={status:"saving"},xn={status:"saved"},Cn={status:"error"},ls=e=>e.then(()=>{},()=>{}),ds=({outboxMessageId:e,onDraftCreated:t})=>{const[n,r]=s.useState(Sn),[o,a]=s.useState(null),i=s.useRef(void 0),c=s.useRef(new Set),p=jr(),f=s.useRef(e),l=s.useRef(e);if(f.current!==e){const g=f.current!==void 0;f.current=e,l.current=e,g&&i.current&&clearTimeout(i.current)}const u=yt({...Fr(),meta:bt}),h=yt({...$r(),meta:bt}),w=s.useCallback(async g=>{r(us),a(null);const v=l.current;if(v){const M=await h.mutateAsync({path:{outboxMessageId:v},body:{toAddresses:g.toAddresses,ccAddresses:g.ccAddresses,bccAddresses:g.bccAddresses,subject:g.subject,textBody:g.textBody,htmlBody:g.htmlBody,inReplyTo:g.inReplyTo,references:g.references}});return r(xn),M}const T=await u.mutateAsync({body:{...g,sendImmediately:!1}});return l.current=T.outboxMessageId,t(T.outboxMessageId),r(xn),p.invalidateQueries({queryKey:Br().queryKey}),T},[u.mutateAsync,h.mutateAsync,t,p]),x=s.useRef(Promise.resolve()),d=s.useCallback(g=>{const v=x.current.then(()=>w(g));return x.current=ls(v),v},[w]),E=s.useCallback(g=>{if(i.current&&clearTimeout(i.current),is(l.current,g)){r(cs);return}r(v=>v.status==="unsaved"?Sn:v),i.current=setTimeout(()=>{const v=l.current;v&&c.current.has(v)||d(g).catch(T=>{a(T),r(Cn)})},2e3)},[d]),b=s.useCallback(g=>(i.current&&clearTimeout(i.current),d(g).then(v=>({outcome:"saved",outboxMessageId:v.outboxMessageId})).catch(v=>(r(Cn),{outcome:"failed",error:v}))),[d]),D=s.useCallback(g=>{i.current&&clearTimeout(i.current),g&&c.current.add(g)},[]);return{saveState:n,saveError:o,saveDraft:E,saveImmediately:b,stopAutoSave:D}},fs=e=>e.outboundCount>0||e.replyCount>0||e.flags?.vip?.value===!0||e.flags?.trusted?.value===!0,ms=e=>e.flags?.blocked?.value===!0?!1:e.flags?.junkOnly?.value!==!0?!0:fs(e),Bt=({label:e,addresses:t,onChange:n,placeholder:r,onPendingChange:o,ref:a})=>{const[i,c]=s.useState(""),p=oo(i,200),{data:f}=Et({...Hr({query:{q:p,limit:8}}),enabled:p.length>=2}),l=s.useMemo(()=>(f?.items??[]).filter(ms).map(u=>({email:u.normalizedEmail,displayName:u.displayName})),[f]);return m.jsx(po,{label:e,addresses:t,onChange:n,placeholder:r,suggestions:l,onQueryChange:c,onPendingChange:o,ref:a})},ps=({accountId:e,configureRef:t})=>{const n=ss();return m.jsx(yo,{configureRef:t,onConfigure:()=>{n(e)}})},hs={download:"its dictionary could not be downloaded",engine:"the checker could not start",worker:"the checker stopped running"},vs=e=>{const t=`Spellcheck for ${e.language} is off: ${hs[e.reason]}.`;return{severity:"warning",title:"Spellcheck stopped",detail:`${t} Your browser is checking this message instead. ${e.detail}`,action:{label:"Report this",href:Wr(Ur({title:`Spellcheck stopped: ${e.reason} (${e.language})`,errorMessage:`${t} ${e.detail}`}))}}},gs=e=>({provider:async t=>{const{openSpellcheckWorker:n}=await _n(async()=>{const{openSpellcheckWorker:r}=await import("./rich-text-spellcheck-worker-provider-
|
|
43
|
+
`)},ts=0,Be=[];function ns(e){var t=s.useRef([]),n=s.useRef([0,0]),r=s.useRef(),o=s.useState(ts++)[0],a=s.useState(Yn)[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 d=_r([e.lockRef.current],(e.shards||[]).map(En),!0).filter(Boolean);return d.forEach(function(E){return E.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),d.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=s.useCallback(function(d,E){if("touches"in d&&d.touches.length===2||d.type==="wheel"&&d.ctrlKey)return!i.current.allowPinchZoom;var b=pt(d),D=n.current,g="deltaX"in d?d.deltaX:D[0]-b[0],v="deltaY"in d?d.deltaY:D[1]-b[1],T,M=d.target,S=Math.abs(g)>Math.abs(v)?"h":"v";if("touches"in d&&S==="h"&&M.type==="range")return!1;var N=window.getSelection(),k=N&&N.anchorNode,j=k?k===M||k.contains(M):!1;if(j)return!1;var y=yn(S,M);if(!y)return!0;if(y?T=S:(T=S==="v"?"h":"v",y=yn(S,M)),!y)return!1;if(!r.current&&"changedTouches"in d&&(g||v)&&(r.current=T),!T)return!0;var _=r.current||T;return Za(_,E,d,_==="h"?g:v)},[]),p=s.useCallback(function(d){var E=d;if(!(!Be.length||Be[Be.length-1]!==a)){var b="deltaY"in E?bn(E):pt(E),D=t.current.filter(function(T){return T.name===E.type&&(T.target===E.target||E.target===T.shadowParent)&&Ja(T.delta,b)})[0];if(D&&D.should){E.cancelable&&E.preventDefault();return}if(!D){var g=(i.current.shards||[]).map(En).filter(Boolean).filter(function(T){return T.contains(E.target)}),v=g.length>0?c(E,g[0]):!i.current.noIsolation;v&&E.cancelable&&E.preventDefault()}}},[]),f=s.useCallback(function(d,E,b,D){var g={name:d,delta:E,target:b,should:D,shadowParent:rs(b)};t.current.push(g),setTimeout(function(){t.current=t.current.filter(function(v){return v!==g})},1)},[]),l=s.useCallback(function(d){n.current=pt(d),r.current=void 0},[]),u=s.useCallback(function(d){f(d.type,bn(d),d.target,c(d,e.lockRef.current))},[]),h=s.useCallback(function(d){f(d.type,pt(d),d.target,c(d,e.lockRef.current))},[]);s.useEffect(function(){return Be.push(a),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:h}),document.addEventListener("wheel",p,$e),document.addEventListener("touchmove",p,$e),document.addEventListener("touchstart",l,$e),function(){Be=Be.filter(function(d){return d!==a}),document.removeEventListener("wheel",p,$e),document.removeEventListener("touchmove",p,$e),document.removeEventListener("touchstart",l,$e)}},[]);var w=e.removeScrollBar,x=e.inert;return s.createElement(s.Fragment,null,x?s.createElement(a,{styles:es(o)}):null,w?s.createElement(za,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function rs(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const os=Pa(Kn,ns);var Zn=s.forwardRef(function(e,t){return s.createElement(Ct,be({},e,{ref:t,sideCar:os}))});Zn.classNames=Ct.classNames;const as={brief:"/mail/brief",flagged:"/mail/flagged",outbox:"/mail/outbox",settings:"/settings",accounts:"/settings/accounts"};function Ci(){const e=Mn();return s.useCallback(t=>{e({to:as[t]})},[e])}function ss(){const e=Mn();return s.useCallback(t=>{e({to:"/settings/accounts",search:{editAccountId:t,focusSmtp:!0}})},[e])}const Ri=({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 p=o.ctrlKey||o.metaKey;if(i.requireMeta!==void 0){if(i.requireMeta!==p)continue}else{const f=i.noModifiers??!0,l=p||o.altKey||i.requireShift===void 0&&o.shiftKey;if(f&&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])},is=(e,t)=>e===void 0&&t.toAddresses.length===0,cs={status:"unsaved",reason:"Not saved — add a To address to keep this draft."},Sn={status:"idle"},us={status:"saving"},xn={status:"saved"},Cn={status:"error"},ls=e=>e.then(()=>{},()=>{}),ds=({outboxMessageId:e,onDraftCreated:t})=>{const[n,r]=s.useState(Sn),[o,a]=s.useState(null),i=s.useRef(void 0),c=s.useRef(new Set),p=jr(),f=s.useRef(e),l=s.useRef(e);if(f.current!==e){const g=f.current!==void 0;f.current=e,l.current=e,g&&i.current&&clearTimeout(i.current)}const u=yt({...Fr(),meta:bt}),h=yt({...$r(),meta:bt}),w=s.useCallback(async g=>{r(us),a(null);const v=l.current;if(v){const M=await h.mutateAsync({path:{outboxMessageId:v},body:{toAddresses:g.toAddresses,ccAddresses:g.ccAddresses,bccAddresses:g.bccAddresses,subject:g.subject,textBody:g.textBody,htmlBody:g.htmlBody,inReplyTo:g.inReplyTo,references:g.references}});return r(xn),M}const T=await u.mutateAsync({body:{...g,sendImmediately:!1}});return l.current=T.outboxMessageId,t(T.outboxMessageId),r(xn),p.invalidateQueries({queryKey:Br().queryKey}),T},[u.mutateAsync,h.mutateAsync,t,p]),x=s.useRef(Promise.resolve()),d=s.useCallback(g=>{const v=x.current.then(()=>w(g));return x.current=ls(v),v},[w]),E=s.useCallback(g=>{if(i.current&&clearTimeout(i.current),is(l.current,g)){r(cs);return}r(v=>v.status==="unsaved"?Sn:v),i.current=setTimeout(()=>{const v=l.current;v&&c.current.has(v)||d(g).catch(T=>{a(T),r(Cn)})},2e3)},[d]),b=s.useCallback(g=>(i.current&&clearTimeout(i.current),d(g).then(v=>({outcome:"saved",outboxMessageId:v.outboxMessageId})).catch(v=>(r(Cn),{outcome:"failed",error:v}))),[d]),D=s.useCallback(g=>{i.current&&clearTimeout(i.current),g&&c.current.add(g)},[]);return{saveState:n,saveError:o,saveDraft:E,saveImmediately:b,stopAutoSave:D}},fs=e=>e.outboundCount>0||e.replyCount>0||e.flags?.vip?.value===!0||e.flags?.trusted?.value===!0,ms=e=>e.flags?.blocked?.value===!0?!1:e.flags?.junkOnly?.value!==!0?!0:fs(e),Bt=({label:e,addresses:t,onChange:n,placeholder:r,onPendingChange:o,ref:a})=>{const[i,c]=s.useState(""),p=oo(i,200),{data:f}=Et({...Hr({query:{q:p,limit:8}}),enabled:p.length>=2}),l=s.useMemo(()=>(f?.items??[]).filter(ms).map(u=>({email:u.normalizedEmail,displayName:u.displayName})),[f]);return m.jsx(po,{label:e,addresses:t,onChange:n,placeholder:r,suggestions:l,onQueryChange:c,onPendingChange:o,ref:a})},ps=({accountId:e,configureRef:t})=>{const n=ss();return m.jsx(yo,{configureRef:t,onConfigure:()=>{n(e)}})},hs={download:"its dictionary could not be downloaded",engine:"the checker could not start",worker:"the checker stopped running"},vs=e=>{const t=`Spellcheck for ${e.language} is off: ${hs[e.reason]}.`;return{severity:"warning",title:"Spellcheck stopped",detail:`${t} Your browser is checking this message instead. ${e.detail}`,action:{label:"Report this",href:Wr(Ur({title:`Spellcheck stopped: ${e.reason} (${e.language})`,errorMessage:`${t} ${e.detail}`}))}}},gs=e=>({provider:async t=>{const{openSpellcheckWorker:n}=await _n(async()=>{const{openSpellcheckWorker:r}=await import("./rich-text-spellcheck-worker-provider-B9aC9uh5.js");return{openSpellcheckWorker:r}},__vite__mapDeps([0,1,2,3]));return n(t)},onStatus:t=>{t.state==="failed"&&e(vs(t))}}),Rn=150,ws=()=>{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>Rn}});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>Rn})};return r(),n.addEventListener("resize",r),()=>n.removeEventListener("resize",r)},[]),e},ys=({selectedAccountId:e,onSelect:t})=>{const{data:n}=Et({...jn(),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?m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx("label",{className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"From:"}),m.jsx("div",{className:"text-sm py-1.5",children:o.email})]}):null}return m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx("label",{htmlFor:"from-account-selector",className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"From:"}),m.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=>m.jsx("option",{value:o.accountId,children:o.email},o.accountId))})]})},bs=s.lazy(()=>_n(()=>import("./rich-text-Cif9kSC5.js"),__vite__mapDeps([4,1,2,5,6,7,3,8,9,10,11])).then(e=>({default:e.ComposeBody}))),Es=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),Ss=e=>e.split(`
|
|
44
44
|
`).map(t=>`<p>${Es(t)}</p>`).join(""),xs=e=>e?`<p></p><p>-- </p>${Ss(e)}`:"",Ht=e=>({html:xs(e),text:e}),Cs=e=>e?/^re:\s/i.test(e)?e:`Re: ${e}`:"Re: ",Rs=e=>e?/^fwd?:\s/i.test(e)?e:`Fwd: ${e}`:"Fwd: ",Ds=(e,t,n)=>{const{envelope:r}=e,a=(r.replyTo.length>0?r.replyTo:r.from).map(f=>({email:f.normalizedEmail,displayName:f.displayName}));if(t!=="reply-all")return{to:a,cc:[]};const i=n?.toLowerCase(),c=new Set(a.map(f=>f.email.toLowerCase())),p=[...r.to,...r.cc].filter(f=>f.normalizedEmail.toLowerCase()!==i&&!c.has(f.normalizedEmail.toLowerCase())).map(f=>({email:f.normalizedEmail,displayName:f.displayName}));return{to:a,cc:p}},Ts=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}},Dn=(e,t,n)=>({textBody:t.text||void 0,htmlBody:e==="plain"?"":t.html?Zr(t.html,n):void 0}),As="Add a To address before sending.",Os=({label:e,text:t})=>`${e} holds "${t}", which is not an address.`,Tn=e=>e.find(t=>t.text.trim()!==""),Ns={entries:[],unparsed:""},ks=(e,t,n,r,o)=>e.length===0&&t.length===0&&n.length===0&&r.trim()===""&&o.text.trim()==="",Ps=({documentGeneration:e,selectedAccountId:t,onAccountChange:n,toAddresses:r,setToAddresses:o,ccAddresses:a,setCcAddresses:i,bccAddresses:c,setBccAddresses:p,showCc:f,setShowCc:l,showBcc:u,setShowBcc:h,subject:w,setSubject:x,fieldHandles:d,onToPendingChange:E})=>{const b=Jr(),{isKeyboardOpen:D}=ws(),[g,v]=s.useState(void 0),T=g===e;return m.jsx(wo,{collapsed:!b&&D&&!T,onExpand:()=>v(e),summary:go({to:r,cc:a,bcc:c,subject:w}),from:m.jsx(ys,{selectedAccountId:t,onSelect:n}),to:m.jsx(Bt,{label:"To",addresses:r,onChange:o,placeholder:"Recipients",onPendingChange:E,ref:d.to}),cc:f?m.jsx(Bt,{label:"Cc",addresses:a,onChange:i,ref:d.cc}):void 0,bcc:u?m.jsx(Bt,{label:"Bcc",addresses:c,onChange:p,ref:d.bcc}):void 0,subject:m.jsx(bo,{value:w,onChange:x}),onShowCc:()=>l(!0),onShowBcc:()=>h(!0)})},Di=({mode:e,account:t,sourceMessage:n,outboxMessageId:r,onDraftCreated:o,onClose:a,onAccountChange:i,layout:c="fill"})=>{const{startSendPolling:p}=Vr(),{pushError:f}=zr(),[l,u]=s.useState([]),[h,w]=s.useState([]),[x,d]=s.useState([]),[E,b]=s.useState(Ns),D=s.useRef(null),g=s.useRef(null),v=s.useRef(null),T=s.useMemo(()=>({to:D,cc:g,bcc:v}),[]),M=s.useCallback(()=>{D.current?.clearPending(),g.current?.clearPending(),v.current?.clearPending()},[]),[S,N]=s.useState(""),[k,j]=s.useState(!1),[y,_]=s.useState(!1),[R,W]=s.useState(t?.accountId),[U,X]=s.useState(!1),[V,ee]=s.useState(r),oe=s.useRef(null),fe=s.useRef(r),Ue=s.useRef(r!==void 0),Oe=s.useRef(r!==void 0?e:void 0),ie=s.useRef(void 0),Se=s.useRef(e);Se.current=e;const Ne=s.useRef(t?.accountId);s.useEffect(()=>{const P=t?.accountId;!P||Ne.current===P||(Ne.current=P,!Ue.current&&W(P))},[t?.accountId]),s.useEffect(()=>{const P=fe.current;if(P===r||(fe.current=r,P===void 0))return;Ue.current=r!==void 0,Oe.current=r!==void 0?Se.current:void 0,ie.current=void 0;const B=r?{html:"",text:""}:Ht(me.current);u([]),w([]),d([]),M(),N(""),j(!1),_(!1),ue(B.html),ze(B.text),Pe("rich"),nt(void 0),Ie({...B,formatting:[]}),ke(Z=>Z+1),X(!1),ee(r)},[r,M]);const{signature:ce}=no(R),me=s.useRef(ce.plainText);me.current=ce.plainText;const[pe,ke]=s.useState(0),[Ve,ue]=s.useState(()=>Ht(ce.plainText).html),[tt,ze]=s.useState(ce.plainText),[O,Pe]=s.useState("rich"),[xe,qe]=s.useState("en"),[Dt,nt]=s.useState(),[te,Ie]=s.useState(()=>({...Ht(ce.plainText),formatting:[]})),{data:Y,error:he}=Et({...qr({path:{outboxMessageId:r??""}}),enabled:!!r&&!U,meta:eo,retry:(P,B)=>!rn(B)&&P<1});s.useEffect(()=>{rn(he)&&a()},[he,a]),s.useEffect(()=>{if(!Y||U)return;u(Y.toAddresses.map(re=>({email:re,displayName:void 0}))),Y.ccAddresses&&Y.ccAddresses.length>0&&(w(Y.ccAddresses.map(re=>({email:re,displayName:void 0}))),j(!0)),Y.bccAddresses&&Y.bccAddresses.length>0&&(d(Y.bccAddresses.map(re=>({email:re,displayName:void 0}))),_(!0)),Y.subject&&N(Y.subject);const P=Kr(Y.htmlBody??""),B=P.html,Z=Y.textBody??"";Pe(No(Y.htmlBody)),nt(P.language??void 0),ue(B),ze(Z),Ie({html:B,text:Z,formatting:[]}),ke(re=>re+1),W(Y.accountId),X(!0)},[Y,U]),s.useEffect(()=>{if(n){if(Ue.current&&Oe.current===e){const P=ie.current;if(!P||P.myEmail===t?.email)return}if(Oe.current=e,ie.current={myEmail:t?.email},M(),e==="reply"||e==="reply-all"){const{to:P,cc:B}=Ds(n,e,t?.email);u(P),w(B),B.length>0&&j(!0),N(Cs(n.envelope.subject))}e==="forward"&&(u([]),w([]),d([]),N(Rs(n.envelope.subject)))}},[e,n,t?.email,M]);const Tt=e==="reply"||e==="reply-all"||e==="forward",{data:Ce}=to({messageId:n?.message.messageId,bodyParts:n?.bodyParts,enabled:Tt&&!!n}),rt=Ce?.kind==="text"?Ce.body:"",ot=Ce?.kind==="html"?Oo(Ce.body):void 0,Le=n?.envelope.from[0]?.displayName??n?.envelope.from[0]?.normalizedEmail,At=s.useCallback(P=>{X(!0),ee(P),o(P)},[o]),{saveState:at,saveError:Me,saveDraft:ve,saveImmediately:Ke,stopAutoSave:Re}=ds({outboxMessageId:r,onDraftCreated:At});s.useEffect(()=>{Me&&f({title:"Couldn't save draft",detail:kt(Me)??"Saving the draft failed.",error:Me})},[Me,f]);const st=yt({...Yr(),meta:bt}),it=yt({...Xr(),meta:bt,onError:P=>{f(Gr("Couldn't discard draft","The draft wasn't discarded.",P))}}),{data:Ot}=Et({...jn(),staleTime:1/0}),De=Ot?.accounts.find(P=>P.accountId===R),A=De?ro(De):!1,I=De?.composeLanguages,F=s.useMemo(()=>I&&I.length>0?I:Qr(navigator.languages),[I]),L=s.useMemo(()=>gs(f),[f]),$=s.useRef(!1),[G,K]=s.useState(!1),J=s.useCallback((P,B)=>G?{status:"sending"}:R?A?{status:"blocked",reason:qt}:B?{status:"blocked",reason:Os(B)}:P===0?{status:"blocked",reason:As}:{status:"ready",accountId:R}:{status:"blocked",reason:"Choose an account to send from."},[G,R,A]),Q=s.useMemo(()=>J(l.length+E.entries.length,Tn([{label:"To",text:E.unparsed}])),[J,l.length,E]),le=Q;s.useEffect(()=>{if(!R||$.current||V!==void 0&&V!==r||r&&!U||ks(l,h,x,S,te))return;const{htmlBody:P,textBody:B}=Dn(O,te,xe);ve({accountId:R,toAddresses:l.map(Z=>Z.email),ccAddresses:h.length>0?h.map(Z=>Z.email):void 0,bccAddresses:x.length>0?x.map(Z=>Z.email):void 0,subject:S||void 0,textBody:B,htmlBody:P})},[R,r,V,U,l,h,x,S,te,O,xe,ve]);const ae=s.useCallback(async(P,B)=>{if(!$.current){$.current=!0,K(!0);try{Re();const Z=n&&(e==="reply"||e==="reply-all")?Ts(n):{},{htmlBody:re,textBody:_e}=Dn(O,te,xe),Cr=!r,ct=await Ke({accountId:P,toAddresses:B.to.map(we=>we.email),ccAddresses:B.cc.length>0?B.cc.map(we=>we.email):void 0,bccAddresses:B.bcc.length>0?B.bcc.map(we=>we.email):void 0,subject:S||void 0,textBody:_e,htmlBody:re,...Z});if(ct.outcome==="failed"){f({title:"Couldn't send message",detail:kt(ct.error)??"Saving the message failed, so nothing was sent. Try again.",error:ct.error});return}const Nt=ct.outboxMessageId;if(await st.mutateAsync({path:{outboxMessageId:Nt}}).catch(we=>(f({title:"Couldn't send message",detail:kt(we)??(Cr?"The draft was saved but the send request failed. Try again from the Outbox.":"The send request failed. Try again."),error:we}),null))===null)return;Re(Nt),p(Nt),a()}finally{$.current=!1,K(!1)}}},[S,te,O,xe,e,n,r,Ke,st,Re,p,f,a]),ne=s.useCallback(()=>{Re(r),r&&it.mutate({path:{outboxMessageId:r}}),a()},[Re,r,it,a]),ge=s.useCallback(P=>{f({title:"Can't send yet",detail:P}),P===qt&&oe.current?.focus()},[f]),Ye=s.useCallback(()=>{if(Q.status==="sending")return;const P=T.to.current?.commitPending(),B=T.cc.current?.commitPending(),Z=T.bcc.current?.commitPending(),re={to:P?.addresses??l,cc:B?.addresses??h,bcc:Z?.addresses??x},_e=J(re.to.length,Tn([{label:"To",text:P?.unparsed??""},{label:"Cc",text:B?.unparsed??""},{label:"Bcc",text:Z?.unparsed??""}]));if(_e.status!=="sending"){if(_e.status==="blocked"){ge(_e.reason);return}ae(_e.accountId,re)}},[Q.status,T,l,h,x,J,ge,ae]),xr=s.useCallback(P=>{W(P.accountId),i?.(P)},[i]);return m.jsx(vo,{layout:c,banner:De&&A?m.jsx(ps,{accountId:De.accountId,configureRef:oe}):void 0,header:m.jsx(Ps,{documentGeneration:pe,selectedAccountId:R,onAccountChange:xr,toAddresses:l,setToAddresses:u,ccAddresses:h,setCcAddresses:w,bccAddresses:x,setBccAddresses:d,showCc:k,setShowCc:j,showBcc:y,setShowBcc:_,subject:S,setSubject:N,fieldHandles:T,onToPendingChange:b}),quoted:rt||ot?m.jsx(Eo,{text:rt,html:ot,senderName:Le}):void 0,actionBar:m.jsx(io,{send:le,onSend:Ye,onBlocked:ge,onDiscard:ne,save:at}),children:m.jsx(s.Suspense,{fallback:m.jsx(ho,{}),children:m.jsx(bs,{mode:O,onModeChange:Pe,initialHtml:Ve,initialText:tt,onChange:Ie,onSubmit:Ye,initialCaret:e==="new"?"start":void 0,onConversionError:f,languages:F,initialLanguage:Dt,onLanguageChange:qe,spellcheck:L},pe)})})};var Rt="Dialog",[Jn]=Io(Rt),[Is,se]=Jn(Rt),er=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:a,modal:i=!0}=e,c=s.useRef(null),p=s.useRef(null),[f,l]=_o({prop:r,defaultProp:o??!1,onChange:a,caller:Rt});return m.jsx(Is,{scope:t,triggerRef:c,contentRef:p,contentId:Mt(),titleId:Mt(),descriptionId:Mt(),open:f,onOpenChange:l,onOpenToggle:s.useCallback(()=>l(u=>!u),[l]),modal:i,children:n})};er.displayName=Rt;var tr="DialogTrigger",Ls=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=se(tr,n),a=Ae(t,o.triggerRef);return m.jsx(de.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":en(o.open),...r,ref:a,onClick:Ee(e.onClick,o.onOpenToggle)})});Ls.displayName=tr;var Jt="DialogPortal",[Ms,nr]=Jn(Jt,{forceMount:void 0}),rr=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,a=se(Jt,t);return m.jsx(Ms,{scope:t,forceMount:n,children:s.Children.map(r,i=>m.jsx(xt,{present:n||a.open,children:m.jsx(Vn,{asChild:!0,container:o,children:i})}))})};rr.displayName=Jt;var St="DialogOverlay",or=s.forwardRef((e,t)=>{const n=nr(St,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=se(St,e.__scopeDialog);return a.modal?m.jsx(xt,{present:r||a.open,children:m.jsx(js,{...o,ref:t})}):null});or.displayName=St;var _s=$n("DialogOverlay.RemoveScroll"),js=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=se(St,n),a=ta(),i=Ae(t,a);return m.jsx(Zn,{as:_s,allowPinchZoom:!0,shards:[o.contentRef],children:m.jsx(de.div,{"data-state":en(o.open),...r,ref:i,style:{pointerEvents:"auto",...r.style}})})}),We="DialogContent",ar=s.forwardRef((e,t)=>{const n=nr(We,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=se(We,e.__scopeDialog);return m.jsx(xt,{present:r||a.open,children:a.modal?m.jsx(Fs,{...o,ref:t}):m.jsx($s,{...o,ref:t})})});ar.displayName=We;var Fs=s.forwardRef((e,t)=>{const n=se(We,e.__scopeDialog),r=s.useRef(null),o=Ae(t,n.contentRef,r);return s.useEffect(()=>{const a=r.current;if(a)return xa(a)},[]),m.jsx(sr,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Ee(e.onCloseAutoFocus,a=>{a.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Ee(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,c=i.button===0&&i.ctrlKey===!0;(i.button===2||c)&&a.preventDefault()}),onFocusOutside:Ee(e.onFocusOutside,a=>a.preventDefault())})}),$s=s.forwardRef((e,t)=>{const n=se(We,e.__scopeDialog),r=s.useRef(!1),o=s.useRef(!1);return m.jsx(sr,{...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()}})}),sr=s.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,...i}=e,c=se(We,n);return aa(),m.jsx(m.Fragment,{children:m.jsx(Wn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a,children:m.jsx(Bn,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":en(c.open),...i,ref:t,deferPointerDownOutside:!0,onDismiss:()=>c.onOpenChange(!1)})})})}),ir="DialogTitle",cr=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=se(ir,n);return m.jsx(de.h2,{id:o.titleId,...r,ref:t})});cr.displayName=ir;var ur="DialogDescription",Bs=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=se(ur,n);return m.jsx(de.p,{id:o.descriptionId,...r,ref:t})});Bs.displayName=ur;var lr="DialogClose",Hs=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=se(lr,n);return m.jsx(de.button,{type:"button",...r,ref:t,onClick:Ee(e.onClick,()=>o.onOpenChange(!1))})});Hs.displayName=lr;function en(e){return e?"open":"closed"}function Ws(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 dr=C.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}),et=()=>{const e=C.useContext(dr);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};Ws(`[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 Us(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function Vs(){return tn(/^Mac/)}function zs(){return tn(/^iPhone/)}function An(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function qs(){return tn(/^iPad/)||Vs()&&navigator.maxTouchPoints>1}function fr(){return zs()||qs()}function tn(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const Ks=24,Ys=typeof window<"u"?s.useLayoutEffect:s.useEffect;function On(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}const Wt=typeof document<"u"&&window.visualViewport;function Nn(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function mr(e){for(Nn(e)&&(e=e.parentElement);e&&!Nn(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const Gs=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let ht=0,Ut;function Xs(e={}){let{isDisabled:t}=e;Ys(()=>{if(!t)return ht++,ht===1&&fr()&&(Ut=Qs()),()=>{ht--,ht===0&&Ut?.()}},[t])}function Qs(){let e,t=0,n=u=>{e=mr(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 h=u.changedTouches[0].pageY,w=e.scrollTop,x=e.scrollHeight-e.clientHeight;x!==0&&((w<=0&&h>t||w>=x&&h<t)&&u.preventDefault(),t=h)},o=u=>{let h=u.target;Gt(h)&&h!==document.activeElement&&(u.preventDefault(),h.style.transform="translateY(-2000px)",h.focus(),requestAnimationFrame(()=>{h.style.transform=""}))},a=u=>{let h=u.target;Gt(h)&&(h.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{h.style.transform="",Wt&&(Wt.height<window.innerHeight?requestAnimationFrame(()=>{kn(h)}):Wt.addEventListener("resize",()=>kn(h),{once:!0}))}))},i=()=>{window.scrollTo(0,0)},c=window.pageXOffset,p=window.pageYOffset,f=On(Zs(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let l=On(Xe(document,"touchstart",n,{passive:!1,capture:!0}),Xe(document,"touchmove",r,{passive:!1,capture:!0}),Xe(document,"touchend",o,{passive:!1,capture:!0}),Xe(document,"focus",a,!0),Xe(window,"scroll",i));return()=>{f(),l(),window.scrollTo(c,p)}}function Zs(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Xe(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function kn(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let n=mr(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+Ks;a>i&&(n.scrollTop+=o-r)}e=n.parentElement}}function Gt(e){return e instanceof HTMLInputElement&&!Gs.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function Js(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function ei(...e){return t=>e.forEach(n=>Js(n,t))}function pr(...e){return s.useCallback(ei(...e),e)}const hr=new WeakMap;function q(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([o,a])=>{if(o.startsWith("--")){e.style.setProperty(o,a);return}r[o]=e.style[o],e.style[o]=a}),!n&&hr.set(e,r)}function ti(e,t){if(!e||!(e instanceof HTMLElement))return;let n=hr.get(e);n&&(e.style[t]=n[t])}const z=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function vt(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(", ")[z(t)?13:12]):(o=r.match(/^matrix\((.+)\)$/),o?parseFloat(o[1].split(", ")[z(t)?5:4]):null)}function ni(e){return 8*(Math.log(e+1)-2)}function Vt(e,t){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}function ri(...e){return(...t)=>{for(const n of e)typeof n=="function"&&n(...t)}}const H={DURATION:.5,EASE:[.32,.72,0,1]},vr=.4,oi=.25,ai=100,gr=8,Te=16,Xt=26,zt="vaul-dragging";function wr(e){const t=C.useRef(e);return C.useEffect(()=>{t.current=e}),C.useMemo(()=>(...n)=>t.current==null?void 0:t.current.call(t,...n),[])}function si({defaultProp:e,onChange:t}){const n=C.useState(e),[r]=n,o=C.useRef(r),a=wr(t);return C.useEffect(()=>{o.current!==r&&(a(r),o.current=r)},[r,o,a]),n}function yr({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=si({defaultProp:t,onChange:n}),a=e!==void 0,i=a?e:r,c=wr(n),p=C.useCallback(f=>{if(a){const u=typeof f=="function"?f(e):f;u!==e&&c(u)}else o(f)},[a,e,o,c]);return[i,p]}function ii({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:o,fadeFromIndex:a,onSnapPointChange:i,direction:c="bottom",container:p,snapToSequentialPoint:f}){const[l,u]=yr({prop:e,defaultProp:n?.[0],onChange:t}),[h,w]=C.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);C.useEffect(()=>{function S(){w({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const x=C.useMemo(()=>l===n?.[n.length-1]||null,[n,l]),d=C.useMemo(()=>{var S;return(S=n?.findIndex(N=>N===l))!=null?S:null},[n,l]),E=n&&n.length>0&&(a||a===0)&&!Number.isNaN(a)&&n[a]===l||!n,b=C.useMemo(()=>{const S=p?{width:p.getBoundingClientRect().width,height:p.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var N;return(N=n?.map(k=>{const j=typeof k=="string";let y=0;if(j&&(y=parseInt(k,10)),z(c)){const R=j?y:h?k*S.height:0;return h?c==="bottom"?S.height-R:-S.height+R:R}const _=j?y:h?k*S.width:0;return h?c==="right"?S.width-_:-S.width+_:_}))!=null?N:[]},[n,h,p]),D=C.useMemo(()=>d!==null?b?.[d]:null,[b,d]),g=C.useCallback(S=>{var N;const k=(N=b?.findIndex(j=>j===S))!=null?N:null;i(k),q(r.current,{transition:`transform ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})`,transform:z(c)?`translate3d(0, ${S}px, 0)`:`translate3d(${S}px, 0, 0)`}),b&&k!==b.length-1&&a!==void 0&&k!==a&&k<a?q(o.current,{transition:`opacity ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})`,opacity:"0"}):q(o.current,{transition:`opacity ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})`,opacity:"1"}),u(n?.[Math.max(k,0)])},[r.current,n,b,a,o,u]);C.useEffect(()=>{if(l||e){var S;const N=(S=n?.findIndex(k=>k===e||k===l))!=null?S:-1;b&&N!==-1&&typeof b[N]=="number"&&g(b[N])}},[l,e,n,b,g]);function v({draggedDistance:S,closeDrawer:N,velocity:k,dismissible:j}){if(a===void 0)return;const y=c==="bottom"||c==="right"?(D??0)-S:(D??0)+S,_=d===a-1,R=d===0,W=S>0;if(_&&q(o.current,{transition:`opacity ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})`}),!f&&k>2&&!W){j?N():g(b[0]);return}if(!f&&k>2&&W&&b&&n){g(b[n.length-1]);return}const U=b?.reduce((V,ee)=>typeof V!="number"||typeof ee!="number"?V:Math.abs(ee-y)<Math.abs(V-y)?ee:V),X=z(c)?window.innerHeight:window.innerWidth;if(k>vr&&Math.abs(S)<X*.4){const V=W?1:-1;if(V>0&&x&&n){g(b[n.length-1]);return}if(R&&V<0&&j&&N(),d===null)return;g(b[d+V]);return}g(U)}function T({draggedDistance:S}){if(D===null)return;const N=c==="bottom"||c==="right"?D-S:D+S;(c==="bottom"||c==="right")&&N<b[b.length-1]||(c==="top"||c==="left")&&N>b[b.length-1]||q(r.current,{transform:z(c)?`translate3d(0, ${N}px, 0)`:`translate3d(${N}px, 0, 0)`})}function M(S,N){if(!n||typeof d!="number"||!b||a===void 0)return null;const k=d===a-1;if(d>=a&&N)return 0;if(k&&!N)return 1;if(!E&&!k)return null;const y=k?d+1:d-1,_=k?b[y]-b[y-1]:b[y+1]-b[y],R=S/Math.abs(_);return k?1-R:R}return{isLastSnapPoint:x,activeSnapPoint:l,shouldFade:E,getPercentageDragged:M,setActiveSnapPoint:u,activeSnapPointIndex:d,onRelease:v,onDrag:T,snapPointsOffset:b}}const ci=()=>()=>{};function ui(){const{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:o}=et(),a=C.useRef(null),i=s.useMemo(()=>document.body.style.backgroundColor,[]);function c(){return(window.innerWidth-Xt)/window.innerWidth}C.useEffect(()=>{if(t&&n){a.current&&clearTimeout(a.current);const p=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!p)return;ri(r&&!o?Vt(document.body,{background:"black"}):ci,Vt(p,{transformOrigin:z(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${H.DURATION}s`,transitionTimingFunction:`cubic-bezier(${H.EASE.join(",")})`}));const f=Vt(p,{borderRadius:`${gr}px`,overflow:"hidden",...z(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()=>{f(),a.current=window.setTimeout(()=>{i?document.body.style.background=i:document.body.style.removeProperty("background")},H.DURATION*1e3)}}},[t,n,i])}let Qe=null;function li({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:o,noBodyStyles:a}){const[i,c]=C.useState(()=>typeof window<"u"?window.location.href:""),p=C.useRef(0),f=C.useCallback(()=>{if(An()&&Qe===null&&e&&!a){Qe={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:h}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-p.current}px`,left:`${-u}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const w=h-window.innerHeight;w&&p.current>=h&&(document.body.style.top=`${-(p.current+w)}px`)}),300)}},[e]),l=C.useCallback(()=>{if(An()&&Qe!==null&&!a){const u=-parseInt(document.body.style.top,10),h=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Qe),window.requestAnimationFrame(()=>{if(o&&i!==window.location.href){c(window.location.href);return}window.scrollTo(h,u)}),Qe=null}},[i]);return C.useEffect(()=>{function u(){p.current=window.scrollY}return u(),window.addEventListener("scroll",u),()=>{window.removeEventListener("scroll",u)}},[]),C.useEffect(()=>{if(t)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||l()}},[t,l]),C.useEffect(()=>{n||!r||(e?(!window.matchMedia("(display-mode: standalone)").matches&&f(),t||window.setTimeout(()=>{l()},500)):l())},[e,r,i,t,n,f,l]),{restorePositionSetting:l}}function di({open:e,onOpenChange:t,children:n,onDrag:r,onRelease:o,snapPoints:a,shouldScaleBackground:i=!1,setBackgroundColorOnScale:c=!0,closeThreshold:p=oi,scrollLockTimeout:f=ai,dismissible:l=!0,handleOnly:u=!1,fadeFromIndex:h=a&&a.length-1,activeSnapPoint:w,setActiveSnapPoint:x,fixed:d,modal:E=!0,onClose:b,nested:D,noBodyStyles:g=!1,direction:v="bottom",defaultOpen:T=!1,disablePreventScroll:M=!0,snapToSequentialPoint:S=!1,preventScrollRestoration:N=!1,repositionInputs:k=!0,onAnimationEnd:j,container:y,autoFocus:_=!1}){var R,W;const[U=!1,X]=yr({defaultProp:T,prop:e,onChange:A=>{t?.(A),!A&&!D&&ot(),setTimeout(()=>{j?.(A)},H.DURATION*1e3),A&&!E&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),A||(document.body.style.pointerEvents="auto")}}),[V,ee]=C.useState(!1),[oe,fe]=C.useState(!1),[Ue,Oe]=C.useState(!1),ie=C.useRef(null),Se=C.useRef(null),Ne=C.useRef(null),ce=C.useRef(null),me=C.useRef(null),pe=C.useRef(!1),ke=C.useRef(null),Ve=C.useRef(0),ue=C.useRef(!1),tt=C.useRef(!T),ze=C.useRef(0),O=C.useRef(null),Pe=C.useRef(((R=O.current)==null?void 0:R.getBoundingClientRect().height)||0),xe=C.useRef(((W=O.current)==null?void 0:W.getBoundingClientRect().width)||0),qe=C.useRef(0),Dt=C.useCallback(A=>{a&&A===he.length-1&&(Se.current=new Date)},[]),{activeSnapPoint:nt,activeSnapPointIndex:te,setActiveSnapPoint:Ie,onRelease:Y,snapPointsOffset:he,onDrag:Tt,shouldFade:Ce,getPercentageDragged:rt}=ii({snapPoints:a,activeSnapPointProp:w,setActiveSnapPointProp:x,drawerRef:O,fadeFromIndex:h,overlayRef:ie,onSnapPointChange:Dt,direction:v,container:y,snapToSequentialPoint:S});Xs({isDisabled:!U||oe||!E||Ue||!V||!k||!M});const{restorePositionSetting:ot}=li({isOpen:U,modal:E,nested:D??!1,hasBeenOpened:V,preventScrollRestoration:N,noBodyStyles:g});function Le(){return(window.innerWidth-Xt)/window.innerWidth}function At(A){var I,F;!l&&!a||O.current&&!O.current.contains(A.target)||(Pe.current=((I=O.current)==null?void 0:I.getBoundingClientRect().height)||0,xe.current=((F=O.current)==null?void 0:F.getBoundingClientRect().width)||0,fe(!0),Ne.current=new Date,fr()&&window.addEventListener("touchend",()=>pe.current=!1,{once:!0}),A.target.setPointerCapture(A.pointerId),Ve.current=z(v)?A.pageY:A.pageX)}function at(A,I){var F;let L=A;const $=(F=window.getSelection())==null?void 0:F.toString(),G=O.current?vt(O.current,v):null,K=new Date;if(L.tagName==="SELECT"||L.hasAttribute("data-vaul-no-drag")||L.closest("[data-vaul-no-drag]"))return!1;if(v==="right"||v==="left")return!0;if(Se.current&&K.getTime()-Se.current.getTime()<500)return!1;if(G!==null&&(v==="bottom"?G>0:G<0))return!0;if($&&$.length>0)return!1;if(me.current&&K.getTime()-me.current.getTime()<f&&G===0||I)return me.current=K,!1;for(;L;){if(L.scrollHeight>L.clientHeight){if(L.scrollTop!==0)return me.current=new Date,!1;if(L.getAttribute("role")==="dialog")return!0}L=L.parentNode}return!0}function Me(A){if(O.current&&oe){const I=v==="bottom"||v==="right"?1:-1,F=(Ve.current-(z(v)?A.pageY:A.pageX))*I,L=F>0,$=a&&!l&&!L;if($&&te===0)return;const G=Math.abs(F),K=document.querySelector("[data-vaul-drawer-wrapper]"),J=v==="bottom"||v==="top"?Pe.current:xe.current;let Q=G/J;const le=rt(G,L);if(le!==null&&(Q=le),$&&Q>=1||!pe.current&&!at(A.target,L))return;if(O.current.classList.add(zt),pe.current=!0,q(O.current,{transition:"none"}),q(ie.current,{transition:"none"}),a&&Tt({draggedDistance:F}),L&&!a){const ne=ni(F),ge=Math.min(ne*-1,0)*I;q(O.current,{transform:z(v)?`translate3d(0, ${ge}px, 0)`:`translate3d(${ge}px, 0, 0)`});return}const ae=1-Q;if((Ce||h&&te===h-1)&&(r?.(A,Q),q(ie.current,{opacity:`${ae}`,transition:"none"},!0)),K&&ie.current&&i){const ne=Math.min(Le()+Q*(1-Le()),1),ge=8-Q*8,Ye=Math.max(0,14-Q*14);q(K,{borderRadius:`${ge}px`,transform:z(v)?`scale(${ne}) translate3d(0, ${Ye}px, 0)`:`scale(${ne}) translate3d(${Ye}px, 0, 0)`,transition:"none"},!0)}if(!a){const ne=G*I;q(O.current,{transform:z(v)?`translate3d(0, ${ne}px, 0)`:`translate3d(${ne}px, 0, 0)`})}}}C.useEffect(()=>{window.requestAnimationFrame(()=>{tt.current=!0})},[]),C.useEffect(()=>{var A;function I(){if(!O.current||!k)return;const F=document.activeElement;if(Gt(F)||ue.current){var L;const $=((L=window.visualViewport)==null?void 0:L.height)||0,G=window.innerHeight;let K=G-$;const J=O.current.getBoundingClientRect().height||0,Q=J>G*.8;qe.current||(qe.current=J);const le=O.current.getBoundingClientRect().top;if(Math.abs(ze.current-K)>60&&(ue.current=!ue.current),a&&a.length>0&&he&&te){const ae=he[te]||0;K+=ae}if(ze.current=K,J>$||ue.current){const ae=O.current.getBoundingClientRect().height;let ne=ae;ae>$&&(ne=$-(Q?le:Xt)),d?O.current.style.height=`${ae-Math.max(K,0)}px`:O.current.style.height=`${Math.max(ne,$-le)}px`}else Us()||(O.current.style.height=`${qe.current}px`);a&&a.length>0&&!ue.current?O.current.style.bottom="0px":O.current.style.bottom=`${Math.max(K,0)}px`}}return(A=window.visualViewport)==null||A.addEventListener("resize",I),()=>{var F;return(F=window.visualViewport)==null?void 0:F.removeEventListener("resize",I)}},[te,a,he]);function ve(A){Re(),b?.(),A||X(!1),setTimeout(()=>{a&&Ie(a[0])},H.DURATION*1e3)}function Ke(){if(!O.current)return;const A=document.querySelector("[data-vaul-drawer-wrapper]"),I=vt(O.current,v);q(O.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})`}),q(ie.current,{transition:`opacity ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})`,opacity:"1"}),i&&I&&I>0&&U&&q(A,{borderRadius:`${gr}px`,overflow:"hidden",...z(v)?{transform:`scale(${Le()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${Le()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${H.DURATION}s`,transitionTimingFunction:`cubic-bezier(${H.EASE.join(",")})`},!0)}function Re(){!oe||!O.current||(O.current.classList.remove(zt),pe.current=!1,fe(!1),ce.current=new Date)}function st(A){if(!oe||!O.current)return;O.current.classList.remove(zt),pe.current=!1,fe(!1),ce.current=new Date;const I=vt(O.current,v);if(!A||!at(A.target,!1)||!I||Number.isNaN(I)||Ne.current===null)return;const F=ce.current.getTime()-Ne.current.getTime(),L=Ve.current-(z(v)?A.pageY:A.pageX),$=Math.abs(L)/F;if($>.05&&(Oe(!0),setTimeout(()=>{Oe(!1)},200)),a){Y({draggedDistance:L*(v==="bottom"||v==="right"?1:-1),closeDrawer:ve,velocity:$,dismissible:l}),o?.(A,!0);return}if(v==="bottom"||v==="right"?L>0:L<0){Ke(),o?.(A,!0);return}if($>vr){ve(),o?.(A,!1);return}var G;const K=Math.min((G=O.current.getBoundingClientRect().height)!=null?G:0,window.innerHeight);var J;const Q=Math.min((J=O.current.getBoundingClientRect().width)!=null?J:0,window.innerWidth),le=v==="left"||v==="right";if(Math.abs(I)>=(le?Q:K)*p){ve(),o?.(A,!1);return}o?.(A,!0),Ke()}C.useEffect(()=>(U&&(q(document.documentElement,{scrollBehavior:"auto"}),Se.current=new Date),()=>{ti(document.documentElement,"scrollBehavior")}),[U]);function it(A){const I=A?(window.innerWidth-Te)/window.innerWidth:1,F=A?-Te:0;ke.current&&window.clearTimeout(ke.current),q(O.current,{transition:`transform ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})`,transform:z(v)?`scale(${I}) translate3d(0, ${F}px, 0)`:`scale(${I}) translate3d(${F}px, 0, 0)`}),!A&&O.current&&(ke.current=setTimeout(()=>{const L=vt(O.current,v);q(O.current,{transition:"none",transform:z(v)?`translate3d(0, ${L}px, 0)`:`translate3d(${L}px, 0, 0)`})},500))}function Ot(A,I){if(I<0)return;const F=(window.innerWidth-Te)/window.innerWidth,L=F+I*(1-F),$=-Te+I*Te;q(O.current,{transform:z(v)?`scale(${L}) translate3d(0, ${$}px, 0)`:`scale(${L}) translate3d(${$}px, 0, 0)`,transition:"none"})}function De(A,I){const F=z(v)?window.innerHeight:window.innerWidth,L=I?(F-Te)/F:1,$=I?-Te:0;I&&q(O.current,{transition:`transform ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})`,transform:z(v)?`scale(${L}) translate3d(0, ${$}px, 0)`:`scale(${L}) translate3d(${$}px, 0, 0)`})}return C.useEffect(()=>{E||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[E]),C.createElement(er,{defaultOpen:T,onOpenChange:A=>{!l&&!A||(A?ee(!0):ve(!0),X(A))},open:U},C.createElement(dr.Provider,{value:{activeSnapPoint:nt,snapPoints:a,setActiveSnapPoint:Ie,drawerRef:O,overlayRef:ie,onOpenChange:t,onPress:At,onRelease:st,onDrag:Me,dismissible:l,shouldAnimate:tt,handleOnly:u,isOpen:U,isDragging:oe,shouldFade:Ce,closeDrawer:ve,onNestedDrag:Ot,onNestedOpenChange:it,onNestedRelease:De,keyboardIsOpen:ue,modal:E,snapPointsOffset:he,activeSnapPointIndex:te,direction:v,shouldScaleBackground:i,setBackgroundColorOnScale:c,noBodyStyles:g,container:y,autoFocus:_}},n))}const br=C.forwardRef(function({...e},t){const{overlayRef:n,snapPoints:r,onRelease:o,shouldFade:a,isOpen:i,modal:c,shouldAnimate:p}=et(),f=pr(t,n),l=r&&r.length>0;if(!c)return null;const u=C.useCallback(h=>o(h),[o]);return C.createElement(or,{onMouseUp:u,ref:f,"data-vaul-overlay":"","data-vaul-snap-points":i&&l?"true":"false","data-vaul-snap-points-overlay":i&&a?"true":"false","data-vaul-animate":p?.current?"true":"false",...e})});br.displayName="Drawer.Overlay";const Er=C.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},o){const{drawerRef:a,onPress:i,onRelease:c,onDrag:p,keyboardIsOpen:f,snapPointsOffset:l,activeSnapPointIndex:u,modal:h,isOpen:w,direction:x,snapPoints:d,container:E,handleOnly:b,shouldAnimate:D,autoFocus:g}=et(),[v,T]=C.useState(!1),M=pr(o,a),S=C.useRef(null),N=C.useRef(null),k=C.useRef(!1),j=d&&d.length>0;ui();const y=(R,W,U=0)=>{if(k.current)return!0;const X=Math.abs(R.y),V=Math.abs(R.x),ee=V>X,oe=["bottom","right"].includes(W)?1:-1;if(W==="left"||W==="right"){if(!(R.x*oe<0)&&V>=0&&V<=U)return ee}else if(!(R.y*oe<0)&&X>=0&&X<=U)return!ee;return k.current=!0,!0};C.useEffect(()=>{j&&window.requestAnimationFrame(()=>{T(!0)})},[]);function _(R){S.current=null,k.current=!1,c(R)}return C.createElement(ar,{"data-vaul-drawer-direction":x,"data-vaul-drawer":"","data-vaul-delayed-snap-points":v?"true":"false","data-vaul-snap-points":w&&j?"true":"false","data-vaul-custom-container":E?"true":"false","data-vaul-animate":D?.current?"true":"false",...r,ref:M,style:l&&l.length>0?{"--snap-point-height":`${l[u??0]}px`,...t}:t,onPointerDown:R=>{b||(r.onPointerDown==null||r.onPointerDown.call(r,R),S.current={x:R.pageX,y:R.pageY},i(R))},onOpenAutoFocus:R=>{n?.(R),g||R.preventDefault()},onPointerDownOutside:R=>{if(e?.(R),!h||R.defaultPrevented){R.preventDefault();return}f.current&&(f.current=!1)},onFocusOutside:R=>{if(!h){R.preventDefault();return}},onPointerMove:R=>{if(N.current=R,b||(r.onPointerMove==null||r.onPointerMove.call(r,R),!S.current))return;const W=R.pageY-S.current.y,U=R.pageX-S.current.x,X=R.pointerType==="touch"?10:2;y({x:U,y:W},x,X)?p(R):(Math.abs(U)>X||Math.abs(W)>X)&&(S.current=null)},onPointerUp:R=>{r.onPointerUp==null||r.onPointerUp.call(r,R),S.current=null,k.current=!1,c(R)},onPointerOut:R=>{r.onPointerOut==null||r.onPointerOut.call(r,R),_(N.current)},onContextMenu:R=>{r.onContextMenu==null||r.onContextMenu.call(r,R),N.current&&_(N.current)}})});Er.displayName="Drawer.Content";const fi=250,mi=120,Sr=C.forwardRef(function({preventCycle:e=!1,children:t,...n},r){const{closeDrawer:o,isDragging:a,snapPoints:i,activeSnapPoint:c,setActiveSnapPoint:p,dismissible:f,handleOnly:l,isOpen:u,onPress:h,onDrag:w}=et(),x=C.useRef(null),d=C.useRef(!1);function E(){if(d.current){g();return}window.setTimeout(()=>{b()},mi)}function b(){if(a||e||d.current){g();return}if(g(),!i||i.length===0){f||o();return}if(c===i[i.length-1]&&f){o();return}const T=i.findIndex(S=>S===c);if(T===-1)return;const M=i[T+1];p(M)}function D(){x.current=window.setTimeout(()=>{d.current=!0},fi)}function g(){x.current&&window.clearTimeout(x.current),d.current=!1}return C.createElement("div",{onClick:E,onPointerCancel:g,onPointerDown:v=>{l&&h(v),D()},onPointerMove:v=>{l&&w(v)},ref:r,"data-vaul-drawer-visible":u?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},C.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});Sr.displayName="Drawer.Handle";function pi(e){const t=et(),{container:n=t.container,...r}=e;return C.createElement(rr,{container:n,...r})}const Ti={Root:di,Content:Er,Overlay:br,Portal:pi,Handle:Sr,Title:cr};export{Di as C,Ti as D,Ri as a,Si as b,xi as c,Ei as s,Ci as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,ab as o}from"./index-D6cG7byA.js";const n=()=>t.jsx(o,{to:"/settings/accounts"});export{n as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as r}from"./index-D6cG7byA.js";import{B as o}from"./BriefPane-Bpqxot_I.js";import"./useSearchTokenContext-BDEE5r-4.js";import"./kbd-D9zPHSME.js";import"./useMessageBodyContent-DiZa-Pn-.js";import"./search-scope-DTcpOp3S.js";import"./MailListHeader-BHGSftKr.js";import"./search-token-index-CxmKvGEg.js";import"./attachment-file-DCCiH8rU.js";import"./mail-C9YlNyyX.js";import"./avatar-3gOksDCk.js";import"./index-Bwf9xzdM.js";import"./useSignature-C4RjdCvH.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DbEOYj9t.js";import"./ErrorState-BWniNNLI.js";import"./format-23Av07Go.js";import"./download-B__fhY6X.js";import"./shield-check-dOBQ-uI5.js";import"./useFilters-D9hpYXHe.js";import"./confirm-dialog-9nNs4PoT.js";import"./clock-ChSrYxbD.js";import"./menu-BwITdrHJ.js";import"./useRefreshControl-DvC_GtG8.js";import"./circle-check-big-ChRe_Wku.js";import"./useLabels-DoFulO_g.js";import"./useSemanticSearch-Dw7XCf2z.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-B1bng5Jq.js";function C(){return r.jsx(o.Reading,{})}export{C as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as r}from"./index-D6cG7byA.js";import{B as o}from"./BriefPane-Bpqxot_I.js";import"./useSearchTokenContext-BDEE5r-4.js";import"./kbd-D9zPHSME.js";import"./useMessageBodyContent-DiZa-Pn-.js";import"./search-scope-DTcpOp3S.js";import"./MailListHeader-BHGSftKr.js";import"./search-token-index-CxmKvGEg.js";import"./attachment-file-DCCiH8rU.js";import"./mail-C9YlNyyX.js";import"./avatar-3gOksDCk.js";import"./index-Bwf9xzdM.js";import"./useSignature-C4RjdCvH.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DbEOYj9t.js";import"./ErrorState-BWniNNLI.js";import"./format-23Av07Go.js";import"./download-B__fhY6X.js";import"./shield-check-dOBQ-uI5.js";import"./useFilters-D9hpYXHe.js";import"./confirm-dialog-9nNs4PoT.js";import"./clock-ChSrYxbD.js";import"./menu-BwITdrHJ.js";import"./useRefreshControl-DvC_GtG8.js";import"./circle-check-big-ChRe_Wku.js";import"./useLabels-DoFulO_g.js";import"./useSemanticSearch-Dw7XCf2z.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-B1bng5Jq.js";function A(){return r.jsx(o.Reading,{})}export{A as component};
|