@remit/web-client-dist 0.0.18 → 0.0.20
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/{ComposeBody-DFy65d0K.js → ComposeBody-YnCJxfqC.js} +1 -1
- package/assets/{ErrorState-DcRLxeD3.js → ErrorState-j8S5XFk6.js} +1 -1
- package/assets/{OnboardingWizard-DVQU7pxH.js → OnboardingWizard-1Up61eEk.js} +1 -1
- package/assets/{account-form-helpers-Df3Xpiui.js → account-form-helpers-Cnz1UyCd.js} +1 -1
- package/assets/accounts-C5ua8Szj.js +1 -0
- package/assets/{advanced-Bhkj9t-5.js → advanced-DAyxsQQA.js} +1 -1
- package/assets/{appearance-CUUsbqXo.js → appearance-CGIVvQ__.js} +1 -1
- package/assets/{avatar-T4FFad0L.js → avatar-BBYbqlEP.js} +1 -1
- package/assets/{browser-ponyfill-By2QI_Fk.js → browser-ponyfill-B8dXU7OB.js} +1 -1
- package/assets/{filter-status-CHPlLmmq.js → filter-status-C5iGEfo1.js} +1 -1
- package/assets/{filters-Bh9UR8cT.js → filters-ChFVclfN.js} +1 -1
- package/assets/{flagged-DZKf9caC.js → flagged-CYp-wRoV.js} +1 -1
- package/assets/{folders-ikYaFcry.js → folders-CiwXxce8.js} +1 -1
- package/assets/{index-9Uw_PSW4.css → index-BkU-X8Kl.css} +1 -1
- package/assets/{index-Dng478lt.js → index-CTKsy36p.js} +4 -4
- package/assets/index-CdSD5Ukp.js +1 -0
- package/assets/{index-CY9K23Lo.js → index-D8tcVoGJ.js} +1 -1
- package/assets/{kbd-DrA2jRYH.js → kbd-CheP1Ri1.js} +1 -1
- package/assets/{mail-q3JyfCk1.js → mail-DUpIpDxR.js} +3 -3
- package/assets/{onboarding-D_5xG_1S.js → onboarding-D3j_ozgf.js} +1 -1
- package/assets/{select-hMoAw7PU.js → select-Cp8q0xm5.js} +1 -1
- package/assets/{send-BVuhT8IO.js → send-DhVj_U9i.js} +1 -1
- package/assets/{senders-B5YOOT2k.js → senders-Dfo4XvA2.js} +1 -1
- package/assets/settings-HMGH-kik.js +1 -0
- package/assets/{settings-screen-DlAI5qBl.js → settings-screen-fLD_jdIZ.js} +1 -1
- package/assets/{star-Ctg0JOHj.js → star-DS7xFC3x.js} +1 -1
- package/assets/{suggested-vips-D555A3py.js → suggested-vips-C286_Wq_.js} +1 -1
- package/assets/{trash-2-B0hhKzUf.js → trash-2-BsYJJRpG.js} +1 -1
- package/assets/{useDebouncedValue-DaSp0UBY.js → useDebouncedValue-B5Xuyscd.js} +1 -1
- package/assets/{useMutation-t_RHgamh.js → useMutation-0lfTKIOn.js} +1 -1
- package/assets/{useSignature-DAhu1TJA.js → useSignature-CF90xdGJ.js} +1 -1
- package/index.html +2 -2
- package/package.json +1 -1
- package/assets/accounts-BLmKM6Wn.js +0 -1
- package/assets/index-PRVXShJU.js +0 -1
- package/assets/settings-Dc02o3Fr.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a$ as r,Z as a,a0 as i,y as s,r as c,j as m}from"./index-
|
|
1
|
+
import{a$ as r,Z as a,a0 as i,y as s,r as c,j as m}from"./index-CTKsy36p.js";import{O as l}from"./OnboardingWizard-1Up61eEk.js";import"./kbd-CheP1Ri1.js";import"./select-Cp8q0xm5.js";import"./useMutation-0lfTKIOn.js";import"./account-form-helpers-Cnz1UyCd.js";async function p(e){e.recordCompleted(),await e.queryClient.refetchQueries({queryKey:r()}),e.navigateToInbox()}function v(){const e=a(),o=i(),t=s(),n=c.useCallback(u=>{p({queryClient:t,recordCompleted:()=>o.recordEvent("onboarding.completed"),navigateToInbox:()=>{e({to:"/mail"})}})},[e,o,t]);return m.jsx(l,{skipWelcome:!1,onComplete:n})}export{v as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a,j as e,C as i,a as o}from"./index-
|
|
1
|
+
import{c as a,j as e,C as i,a as o}from"./index-CTKsy36p.js";const l=a("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);function u({icon:s,className:n,children:t,...r}){return e.jsxs("div",{className:o("relative flex h-9 items-center gap-2 rounded-md border border-line bg-surface-sunken pl-3 text-sm","focus-within:border-line-strong focus-within:ring-2 focus-within:ring-ring/30 transition-colors",n),children:[s&&e.jsx("span",{className:"shrink-0 text-fg-subtle",children:s}),e.jsx("select",{className:"min-w-0 flex-1 appearance-none bg-transparent py-0 pr-8 text-fg outline-none",...r,children:t}),e.jsx(i,{className:"pointer-events-none absolute right-2.5 size-4 text-fg-subtle"})]})}export{l as C,u as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a}from"./index-
|
|
1
|
+
import{c as a}from"./index-CTKsy36p.js";const t=a("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);const h=a("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const d=a("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);const p=a("Mails",[["rect",{width:"16",height:"13",x:"6",y:"4",rx:"2",key:"1drq3f"}],["path",{d:"m22 7-7.1 3.78c-.57.3-1.23.3-1.8 0L6 7",key:"xn252p"}],["path",{d:"M2 8v11c0 1.1.9 2 2 2h14",key:"n13cji"}]]);const c=a("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);export{t as A,d as F,p as M,c as S,h as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,a as N,Z as z,r as c,bd as q,k as L,be as O,a2 as I,br as $,y as k,bs as A,aq as C,B as S,a7 as M,X as R}from"./index-
|
|
1
|
+
import{j as e,a as N,Z as z,r as c,bd as q,k as L,be as O,a2 as I,br as $,y as k,bs as A,aq as C,B as S,a7 as M,X as R}from"./index-CTKsy36p.js";import{K as m}from"./kbd-CheP1Ri1.js";import{S as B,a as P}from"./settings-screen-fLD_jdIZ.js";import{u as E}from"./useMutation-0lfTKIOn.js";import{E as V}from"./ErrorState-j8S5XFk6.js";import{S as G,u as Q}from"./useDebouncedValue-B5Xuyscd.js";import{b as K}from"./format-BGdB831k.js";import{S as _}from"./star-DS7xFC3x.js";import"./avatar-BBYbqlEP.js";function D({options:t,active:r,onSelect:x}){return e.jsx("div",{role:"tablist",className:N("flex shrink-0 gap-1 overflow-x-auto border-b border-line p-2","lg:w-44 lg:flex-col lg:gap-0 lg:overflow-visible lg:border-r lg:border-b-0 lg:py-2 lg:pr-2 lg:pl-3"),children:t.map(a=>{const d=a.id===r;return e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>x(a.id),className:N("flex min-h-11 shrink-0 items-center gap-2 rounded-md px-3 text-left text-sm transition-colors lg:min-h-0 lg:px-2 lg:py-1",d?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface-sunken hover:text-fg"),children:[e.jsx("span",{className:"flex-1 truncate",children:a.label}),e.jsx("span",{className:N("text-2xs tabular-nums",d?"text-accent-2":"text-fg-subtle"),children:a.count??"—"})]},a.id)})})}const v={vip:"VIPs",muted:"Muted",blocked:"Blocked"},F=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(m,{children:"v"})," VIP,"," ",e.jsx(m,{children:"m"})," mute, ",e.jsx(m,{children:"b"})," block. Every rule an automation creates shows up here and can be removed."]})]});function H({query:t,onCount:r}){const{data:x,isPending:a,isError:d,error:b}=I($()),g=k(),i=E({...C(),onSettled:()=>{g.invalidateQueries({queryKey:A()})}}),l=x?.suggestions??[],p=t.trim().toLowerCase(),u=p?l.filter(n=>(n.displayName??"").toLowerCase().includes(p)||n.normalizedEmail.toLowerCase().includes(p)):l;return c.useEffect(()=>{r?.(u.length,l.length)},[r,u.length,l.length]),a?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Loading VIP suggestions…"}):d?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Couldn't load VIP suggestions",error:b})}):l.length===0?e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIP suggestions yet. As you reply to senders, they'll appear here. Press ",e.jsx(m,{children:"v"})," on any message to promote a sender to VIP."]}):u.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIPs match “",t,"”."]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-row-inset py-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Suggested — promote to VIP"}),u.map(n=>e.jsx(P,{name:n.displayName??n.normalizedEmail,email:n.normalizedEmail,meta:n.replyCount>0?`${n.inboundCount} received · you replied ${n.replyCount}×`:`${n.inboundCount} received · you've never replied`,trailing:e.jsx(S,{variant:"ghost",size:"sm",icon:e.jsx(_,{className:"size-3.5"}),"aria-busy":i.isPending,onClick:()=>{i.isPending||i.mutate({path:{addressId:n.addressId},body:{flags:{vip:{value:!0,setAt:Date.now(),setBy:"user"}}}})},children:"Add VIP"})},n.addressId))]})}function U({group:t,query:r,onCount:x}){const a=Q(r.trim(),300),d=k(),[b,g]=c.useState(null),i=a.length>=2,l=M({query:{q:a,limit:50}}),{data:p,isPending:u,isError:n,error:j}=I({...l,enabled:i}),h=E({...C(),onSuccess:()=>{d.invalidateQueries({queryKey:l.queryKey})}}),f=(p?.items??[]).filter(s=>t==="muted"?s.flags?.muted?.value??!1:s.flags?.blocked?.value??!1);return c.useEffect(()=>{x?.(i?f.length:0,null)},[x,i,f.length]),i?u?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Searching…"}):n?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Search failed",error:j})}):f.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No ",v[t].toLowerCase()," senders matching “",a,"”."]}):e.jsx(e.Fragment,{children:f.map(s=>{const o=t==="muted"?s.flags?.muted:s.flags?.blocked,y=o?[`${t}`,o.setAt&&K(o.setAt,{month:"short",year:"numeric"})||null,o.reason?`— ${o.reason}`:null].filter(Boolean).join(" "):t,w=h.isPending&&h.variables?.path.addressId===s.addressId,T=h.isError&&b===s.addressId;return e.jsx(P,{name:s.displayName??s.normalizedEmail,email:s.normalizedEmail,danger:t==="blocked",meta:y,trailing:T?e.jsx(S,{variant:"secondary",size:"sm",onClick:()=>{g(s.addressId),h.mutate({path:{addressId:s.addressId},body:{flags:{[t]:null}}})},children:"Retry"}):e.jsx(S,{variant:"ghost",size:"sm",icon:e.jsx(R,{className:"size-3.5"}),"aria-busy":w,"aria-label":`Remove ${t} flag`,onClick:()=>{w||(g(s.addressId),h.mutate({path:{addressId:s.addressId},body:{flags:{[t]:null}}}))}})},s.addressId)})}):e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle space-y-2",children:[e.jsxs("p",{children:["Type 2+ characters to search ",v[t].toLowerCase()," ","senders by name or address."]}),e.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Note: a dedicated flagged-address list endpoint is in the backlog. Press ",e.jsx(m,{children:"m"})," on any message to mute its sender; ",e.jsx(m,{children:"b"})," to block."]})]})}function ae(){const t=z(),[r,x]=c.useState("vip"),[a,d]=c.useState(""),[b,g]=c.useState(!0),[i,l]=c.useState(0),[p,u]=c.useState({vip:0,muted:null,blocked:null}),n=c.useCallback((s,o)=>{l(s),u(y=>({...y,vip:o}))},[]),j=c.useCallback((s,o)=>{l(s),u(y=>({...y,[r]:s}))},[r]),h=p[r],f=s=>{const o=O[s];o&&t({to:o})};return e.jsx(B,{items:q,activeId:"senders",title:"Senders & Rules",description:"Per-sender preferences — set with one key from any message, managed here.",flush:!0,help:F,helpOpen:b,onToggleHelp:()=>g(s=>!s),onSelect:f,onBackToMail:()=>{t({to:"/mail"})},children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col lg:flex-row",children:[e.jsx(D,{active:r,onSelect:s=>{x(s),d("")},options:["vip","muted","blocked"].map(s=>({id:s,label:v[s],count:p[s]}))}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("div",{className:"border-b border-line px-row-inset py-2",children:e.jsx(L,{icon:e.jsx(G,{className:"size-4"}),placeholder:`Filter ${v[r].toLowerCase()} by name or address`,className:"h-8 max-w-sm",value:a,onChange:s=>d(s.target.value)})}),e.jsx("div",{className:"min-h-0 flex-1 divide-y divide-line overflow-y-auto",children:r==="vip"?e.jsx(H,{query:a,onCount:n}):e.jsx(U,{group:r,query:a,onCount:j})}),e.jsxs("footer",{className:"flex items-center justify-between border-t border-line px-row-inset py-1 text-2xs text-fg-subtle",children:[e.jsx("span",{children:h!=null?`${i} of ${h} flagged senders`:`${i} flagged senders`}),e.jsxs("span",{children:[e.jsx(m,{children:"j"})," ",e.jsx(m,{children:"k"})," navigate · ",e.jsx(m,{children:"⌫"})," remove flag"]})]})]})]})})}export{ae as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,a_ as o}from"./index-CTKsy36p.js";const n=()=>t.jsx(o,{});export{n as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as z,r as g,j as e,a as m,B as x,X as j,b as S}from"./index-
|
|
1
|
+
import{c as z,r as g,j as e,a as m,B as x,X as j,b as S}from"./index-CTKsy36p.js";import{M as B,C as N,A as w}from"./avatar-BBYbqlEP.js";const v=z("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);function L({items:l,activeId:t,title:i,description:n,children:r,help:s,helpOpen:d=!0,flush:o,onSelect:k,onToggleHelp:f,onBackToMail:h}){const[y,c]=g.useState(!1),[u,C]=g.useState(!1),b=!!s&&d,p=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 pt-3 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Settings"}),e.jsx("nav",{className:"flex-1 overflow-y-auto px-2 py-1",children:l.map(a=>e.jsxs("button",{type:"button",onClick:()=>{k?.(a.id),c(!1)},className:m("flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors lg:min-h-0",a.id===t?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg"),children:[a.icon&&e.jsx("span",{className:m("shrink-0",a.id===t?"text-accent-2":"text-fg-subtle"),children:a.icon}),a.label]},a.id))})]});return e.jsxs("div",{className:"flex h-dvh w-full overflow-hidden bg-canvas font-sans text-fg",children:[e.jsxs("aside",{className:"hidden w-60 shrink-0 flex-col border-r border-line bg-surface-sunken lg:flex",children:[e.jsx("div",{className:"flex h-pane-header shrink-0 items-center border-b border-line px-2",children:e.jsxs("button",{type:"button",onClick:h,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-fg-muted hover:bg-surface hover:text-fg",children:[e.jsx(v,{className:"size-4 text-fg-subtle"}),"Back to mail"]})}),p]}),y&&e.jsxs("div",{className:"fixed inset-0 z-50 flex lg:hidden",children:[e.jsx("button",{type:"button","aria-label":"Close menu",className:"absolute inset-0 bg-canvas/60",onClick:()=>c(!1)}),e.jsxs("aside",{className:"relative flex w-72 max-w-[85%] flex-col border-r border-line bg-surface-sunken",children:[e.jsxs("div",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-2",children:[e.jsxs("button",{type:"button",onClick:()=>{h?.(),c(!1)},className:"flex items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-fg-muted hover:bg-surface hover:text-fg",children:[e.jsx(v,{className:"size-4 text-fg-subtle"}),"Back to mail"]}),e.jsx(x,{variant:"ghost",size:"sm",icon:e.jsx(j,{className:"size-4"}),onClick:()=>c(!1),"aria-label":"Close menu"})]}),p]})]}),e.jsxs("main",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-3 border-b border-line px-3 lg:px-5",children:[e.jsx(x,{variant:"ghost",size:"sm",icon:e.jsx(B,{className:"size-4"}),className:"lg:hidden",onClick:()=>c(!0),"aria-label":"Open settings menu"}),e.jsx("h1",{className:"text-md font-semibold text-fg",children:i}),n&&e.jsx("p",{className:"hidden min-w-0 truncate text-xs text-fg-subtle lg:block",children:n}),s&&e.jsx(x,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-4"}),className:"ml-auto lg:hidden",onClick:()=>C(a=>!a),"aria-label":"Tips","aria-expanded":u}),s&&!b&&e.jsx(x,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-4"}),className:"hidden ml-auto lg:inline-flex",onClick:f,"aria-label":"Show tips"})]}),s&&u&&e.jsx("div",{className:"border-b border-line bg-surface-sunken px-row-inset py-3 text-xs leading-relaxed text-fg-muted lg:hidden",children:s}),o?e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:r}):e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx("div",{className:"max-w-2xl px-3 py-5 lg:px-5",children:e.jsx("div",{className:"space-y-5",children:r})})})]}),b&&e.jsxs("aside",{className:"hidden w-64 shrink-0 flex-col border-l border-line bg-surface-sunken lg:flex",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-row-inset",children:[e.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Tips & tricks"}),e.jsx(x,{variant:"ghost",size:"sm",icon:e.jsx(j,{className:"size-3.5"}),onClick:f,"aria-label":"Collapse tips"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-row-inset py-3 text-xs leading-relaxed text-fg-muted",children:s})]})]})}function E({name:l,email:t,meta:i,caption:n,danger:r,trailing:s}){return e.jsxs("div",{className:"flex items-center gap-3 px-row-inset py-2 hover:bg-surface-sunken",children:[e.jsx("span",{className:m(r&&"rounded-full ring-2 ring-danger/40"),children:e.jsx(w,{name:l,email:t,size:"sm"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-col gap-0 sm:flex-row sm:items-baseline sm:gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium text-fg",children:l}),e.jsx("span",{className:"truncate text-2xs text-fg-subtle",children:t})]}),e.jsxs("div",{className:"text-xs text-fg-subtle",children:[i,n&&e.jsxs("span",{className:"text-fg-muted",children:[" · ",n]})]})]}),s&&e.jsx("div",{className:"shrink-0",children:s})]})}const O={healthy:{tone:"positive",label:"healthy"},error:{tone:"danger",label:"error"},muted:{tone:"neutral",label:"muted"}};function F({label:l,email:t,connector:i,syncLabel:n,state:r,errorDetail:s,trailing:d}){const o=O[r];return e.jsxs("div",{className:m("rounded-sm border border-line bg-surface",r==="muted"&&"opacity-65"),children:[e.jsxs("div",{className:"flex flex-col gap-3 px-row-inset py-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx(w,{name:l,email:t,size:"md"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-fg",children:l}),e.jsx(S,{tone:o.tone,dot:!0,children:o.label})]}),e.jsxs("div",{className:"truncate text-xs text-fg-subtle",children:[t," · ",i," · ",n]})]})]}),d&&e.jsx("div",{className:"shrink-0",children:d})]}),s&&e.jsx("div",{className:"border-t border-line px-row-inset py-2",children:e.jsx("code",{className:"block rounded-xs bg-danger-soft px-2 py-1 text-2xs text-danger",children:s})})]})}export{F as A,L as S,E as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a}from"./index-
|
|
1
|
+
import{c as a}from"./index-CTKsy36p.js";const r=a("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);export{r as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,b0 as e}from"./index-
|
|
1
|
+
import{j as t,b0 as e}from"./index-CTKsy36p.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"./index-
|
|
1
|
+
import{c as e}from"./index-CTKsy36p.js";const c=e("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);export{c as T};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as u,r as t}from"./index-
|
|
1
|
+
import{c as u,r as t}from"./index-CTKsy36p.js";const n=u("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),i=(e,c)=>{const[r,o]=t.useState(e);return t.useEffect(()=>{const s=setTimeout(()=>o(e),c);return()=>clearTimeout(s)},[e,c]),r};export{n as S,i as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as l,w as d,bt as a,bu as b,v as h,y as p,r as o,J as m,bv as v}from"./index-
|
|
1
|
+
import{u as l,w as d,bt as a,bu as b,v as h,y as p,r as o,J as m,bv as v}from"./index-CTKsy36p.js";var y=class extends l{#s;#i=void 0;#t;#e;constructor(t,s){super(),this.#s=t,this.setOptions(s),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const s=this.options;this.options=this.#s.defaultMutationOptions(t),d(this.options,s)||this.#s.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#t,observer:this}),s?.mutationKey&&this.options.mutationKey&&a(s.mutationKey)!==a(this.options.mutationKey)?this.reset():this.#t?.state.status==="pending"&&this.#t.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#t?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#o(t)}getCurrentResult(){return this.#i}reset(){this.#t?.removeObserver(this),this.#t=void 0,this.#r(),this.#o()}mutate(t,s){return this.#e=s,this.#t?.removeObserver(this),this.#t=this.#s.getMutationCache().build(this.#s,this.options),this.#t.addObserver(this),this.#t.execute(t)}#r(){const t=this.#t?.state??b();this.#i={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#o(t){h.batch(()=>{if(this.#e&&this.hasListeners()){const s=this.#i.variables,r=this.#i.context,e={client:this.#s,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#e.onSuccess?.(t.data,s,r,e)}catch(i){Promise.reject(i)}try{this.#e.onSettled?.(t.data,null,s,r,e)}catch(i){Promise.reject(i)}}else if(t?.type==="error"){try{this.#e.onError?.(t.error,s,r,e)}catch(i){Promise.reject(i)}try{this.#e.onSettled?.(void 0,t.error,s,r,e)}catch(i){Promise.reject(i)}}}this.listeners.forEach(s=>{s(this.#i)})})}};function O(t,s){const r=p(),[e]=o.useState(()=>new y(r,t));o.useEffect(()=>{e.setOptions(t)},[e,t]);const i=o.useSyncExternalStore(o.useCallback(n=>e.subscribe(h.batchCalls(n)),[e]),()=>e.getCurrentResult(),()=>e.getCurrentResult()),u=o.useCallback((n,c)=>{e.mutate(n,c).catch(m)},[e]);if(i.error&&v(e.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:u,mutateAsync:i.mutate}}export{O as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as m,j as i,B as u,a as y,y as p,a9 as x,a2 as C,a8 as h,ad as j,a$ as L,b3 as k}from"./index-
|
|
1
|
+
import{r as m,j as i,B as u,a as y,y as p,a9 as x,a2 as C,a8 as h,ad as j,a$ as L,b3 as k}from"./index-CTKsy36p.js";import{L as E}from"./account-form-helpers-Cnz1UyCd.js";import{u as O}from"./useMutation-0lfTKIOn.js";const b=()=>i.jsx(E,{className:"size-3.5 animate-spin"}),f=(s,n)=>n?i.jsx("span",{className:"sr-only",children:s}):s;function M({actions:s=[],destructive:n,className:l}){const[e,o]=m.useState(!1);return e&&n?.confirm?i.jsxs("div",{className:y("flex items-center gap-2",l),children:[i.jsx("span",{className:"text-xs text-fg-muted",children:n.confirm.prompt}),i.jsx(u,{variant:"secondary",size:"sm",onClick:()=>o(!1),children:n.confirm.cancelLabel??"Cancel"}),i.jsx(u,{variant:"danger",size:"sm","aria-busy":n.busy,icon:n.busy?b():void 0,onClick:()=>{n.busy||n.onClick()},children:n.busy?n.busyLabel??"Working…":n.confirm.confirmLabel??n.label})]}):i.jsxs("div",{className:y("flex items-center gap-2",l),children:[s.map(a=>i.jsx(u,{variant:a.variant??"ghost",size:"sm","aria-busy":a.busy,"aria-label":a.iconOnly?a.label:void 0,icon:a.busy?b():a.icon,onClick:()=>{a.busy||a.onClick()},children:a.busy&&a.busyLabel?a.busyLabel:f(a.label,a.iconOnly)},a.label)),n&&i.jsx(u,{variant:"ghost",size:"sm","aria-busy":n.busy,"aria-label":n.iconOnly?n.label:void 0,icon:n.busy?b():n.icon,onClick:()=>{if(!n.busy){if(n.confirm){o(!0);return}n.onClick()}},children:n.busy&&n.busyLabel?n.busyLabel:f(n.label,n.iconOnly)})]})}const c={html:"",plainText:""},N=s=>{const n=p(),{pushError:l}=x(),{data:e}=C({...h(),staleTime:1/0}),o=m.useMemo(()=>{if(!s||!e)return c;const r=e.accounts.find(t=>t.accountId===s);return r?{html:r.signatureHtml??"",plainText:r.signaturePlainText??""}:c},[s,e]),a=O({...k(),onSuccess:()=>{n.invalidateQueries({queryKey:L()})},onError:r=>{l(j("Couldn't save signature","The signature wasn't saved.",r))}}),g=m.useCallback((r,t)=>{s&&a.mutate({path:{accountId:s},body:{signatureHtml:r,signaturePlainText:t}})},[s,a]);return{signature:o,setSignature:g,isSaving:a.isPending}};export{M as R,N as u};
|
package/index.html
CHANGED
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
} catch (_) {}
|
|
32
32
|
})();
|
|
33
33
|
</script>
|
|
34
|
-
<script type="module" crossorigin src="/assets/index-
|
|
35
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
34
|
+
<script type="module" crossorigin src="/assets/index-CTKsy36p.js"></script>
|
|
35
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BkU-X8Kl.css">
|
|
36
36
|
</head>
|
|
37
37
|
<body>
|
|
38
38
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as Kt,j as i,T as ot,ar as X,$ as Be,X as Oe,y as Gt,r as M,b1 as Ns,a$ as Fe,b2 as Ts,b3 as As,B as se,k as de,b4 as _s,b5 as ke,b6 as be,b7 as St,a1 as Ps,b8 as Vs,b9 as Es,D as Yt,ba as wt,Z as ks,a2 as Ds,a8 as Fs,bb as Cs,bc as Os,bd as Is,l as Nt,b as Ms,be as Rs}from"./index-Dng478lt.js";import{u as Us,R as Hs}from"./useSignature-DAhu1TJA.js";import{S as Ls,A as zs}from"./settings-screen-DlAI5qBl.js";import{u as Ne}from"./useMutation-t_RHgamh.js";import{g as Tt,P as Bs,s as Ue,O as qs}from"./OnboardingWizard-DVQU7pxH.js";import{S as $s,C as At}from"./select-hMoAw7PU.js";import{c as Ws,b as _t,L as tt,d as Ks}from"./account-form-helpers-Df3Xpiui.js";import{E as Gs}from"./ErrorState-DcRLxeD3.js";import{d as Ys}from"./format-BGdB831k.js";import{T as Zs}from"./trash-2-B0hhKzUf.js";import"./avatar-T4FFad0L.js";import"./kbd-DrA2jRYH.js";const Qs=Kt("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"}]]);const Pt=Kt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);function Xs({title:e,description:s,action:t}){return i.jsxs("div",{className:"rounded-sm border border-danger/50",children:[i.jsxs("div",{className:"flex items-center gap-2 border-b border-danger/30 bg-danger-soft px-row-inset py-2",children:[i.jsx(ot,{className:"size-4 text-danger"}),i.jsx("h2",{className:"text-sm font-semibold text-danger",children:"Danger zone"})]}),i.jsxs("div",{className:"flex flex-col gap-3 px-row-inset py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-sm font-medium text-fg",children:e}),i.jsx("p",{className:"text-xs text-fg-muted",children:s})]}),i.jsx("div",{className:"shrink-0",children:t})]})]})}var Ie=e=>e.type==="checkbox",je=e=>e instanceof Date,G=e=>e==null;const lt=e=>typeof e=="object";var z=e=>!G(e)&&!Array.isArray(e)&<(e)&&!je(e),Js=e=>z(e)&&e.target?Ie(e.target)?e.target.checked:e.target.value:e,er=(e,s)=>s.split(".").some((t,a,c)=>!isNaN(Number(t))&&e.has(c.slice(0,a).join("."))),Zt=e=>{const s=e.constructor&&e.constructor.prototype;return z(s)&&s.hasOwnProperty("isPrototypeOf")},We=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function B(e){if(e instanceof Date)return new Date(e);const s=typeof FileList<"u"&&e instanceof FileList;if(We&&(e instanceof Blob||s))return e;const t=Array.isArray(e);if(!t&&!(z(e)&&Zt(e)))return e;const a=t?[]:Object.create(Object.getPrototypeOf(e));for(const c in e)Object.prototype.hasOwnProperty.call(e,c)&&(a[c]=B(e[c]));return a}const Ae={BLUR:"blur",FOCUS_OUT:"focusout",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},fe={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ue={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Qt="root",ct=["__proto__","constructor","prototype"],tr=/^\w*$/;var Me=e=>tr.test(e),R=e=>e===void 0;const sr=/[.[\]'"]/;var Ke=e=>e.split(sr).filter(Boolean),g=(e,s,t)=>{if(!s||!z(e))return t;const a=Me(s)?[s]:Ke(s);if(a.some(d=>ct.includes(d)))return t;const c=a.reduce((d,n)=>G(d)?void 0:d[n],e);return R(c)||c===e?R(e[s])?t:e[s]:c},me=e=>typeof e=="boolean",ne=e=>typeof e=="function",F=(e,s,t)=>{let a=-1;const c=Me(s)?[s]:Ke(s),d=c.length,n=d-1;for(;++a<d;){const u=c[a];let j=t;if(a!==n){const P=e[u];j=z(P)||Array.isArray(P)?P:isNaN(+c[a+1])?{}:[]}if(ct.includes(u))return;e[u]=j,e=e[u]}};const rr=X.createContext(null);rr.displayName="HookFormControlContext";var ir=(e,s,t,a=!0)=>{const c={};for(const d in e)Object.defineProperty(c,d,{get:()=>{const n=d;return s._proxyFormState[n]!==fe.all&&(s._proxyFormState[n]=!a||fe.all),e[n]}});return c};const ar=We?X.useLayoutEffect:X.useEffect;var Y=e=>typeof e=="string",nr=(e,s,t,a,c)=>Y(e)?(a&&s.watch.add(e),g(t,e,c)):Array.isArray(e)?e.map(d=>(a&&s.watch.add(d),g(t,d))):(a&&(s.watchAll=!0),t),st=e=>G(e)||!lt(e);const Vt=(e,s)=>s.length===0&&!Array.isArray(e)&&!Zt(e);function pe(e,s,t=new WeakMap){if(e===s)return!0;if(st(e)||st(s))return Object.is(e,s);if(je(e)&&je(s))return Object.is(e.getTime(),s.getTime());const a=Object.keys(e),c=Object.keys(s);if(a.length!==c.length)return!1;if(Vt(e,a)||Vt(s,c))return Object.is(e,s);if(!a.length&&Array.isArray(e)!==Array.isArray(s))return!1;const d=t.get(e);if(d&&d.has(s))return!0;if(d)d.add(s);else{const n=new WeakSet;n.add(s),t.set(e,n)}for(const n of a){const u=e[n];if(!(n in s))return!1;if(n!=="ref"){const j=s[n];if(je(u)&&je(j)||(z(u)||Array.isArray(u))&&(z(j)||Array.isArray(j))?!pe(u,j,t):!Object.is(u,j))return!1}}return!0}var He=e=>({isOnSubmit:!e||e===fe.onSubmit,isOnBlur:e===fe.onBlur,isOnChange:e===fe.onChange,isOnAll:e===fe.all,isOnTouch:e===fe.onTouched}),Xe=(e,s,t)=>{if(t)return!1;if(s.watchAll||s.watch.has(e))return!0;for(const a of s.watch)if(e.startsWith(a)&&e.charAt(a.length)===".")return!0;return!1};const Ce=(e,s,t,a)=>{for(const c of t||Object.keys(e)){const d=g(e,c);if(d){const{_f:n,...u}=d;if(n){if(n.refs&&n.refs[0]&&s(n.refs[0],c)&&!a)return!0;if(n.ref&&s(n.ref,n.name)&&!a)return!0;if(Ce(u,s))break}else if(z(u)&&Ce(u,s))break}}};var Et=(e,s,t)=>{const a=g(e,t),c=Array.isArray(a)?a:[];return F(c,Qt,s[t]),F(e,t,c),e},K=e=>z(e)&&!Object.keys(e).length,dt=e=>e.type==="file",qe=e=>{if(!We)return!1;const s=e?e.ownerDocument:0;return e instanceof(s&&s.defaultView?s.defaultView.HTMLElement:HTMLElement)},ut=e=>e.type==="radio",$e=e=>e instanceof RegExp,ft=(e,s,t,a,c)=>s?{...t[e],types:{...t[e]&&t[e].types?t[e].types:{},[a]:c||!0}}:{};const kt={value:!1,isValid:!1},Dt={value:!0,isValid:!0};var Xt=e=>{if(Array.isArray(e)){if(e.length>1){const s=e.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:s,isValid:!!s.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!R(e[0].attributes.value)?R(e[0].value)||e[0].value===""?Dt:{value:e[0].value,isValid:!0}:Dt:kt}return kt};const Ft={isValid:!1,value:null};var Jt=e=>Array.isArray(e)?e.reduce((s,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:s,Ft):Ft;function Ct(e,s,t="validate"){if(Y(e)||Array.isArray(e)&&e.every(Y)||me(e)&&!e)return{type:t,message:Y(e)?e:"",ref:s}}var _e=e=>z(e)&&!$e(e)?e:{value:e,message:""},Ot=async(e,s,t,a,c,d)=>{const{ref:n,refs:u,required:j,maxLength:P,minLength:V,min:L,max:O,pattern:C,validate:N,name:f,valueAsNumber:b,mount:ie}=e._f,T=g(t,f);if(!ie||s.has(f))return{};const J=u?u[0]:n,I=A=>{if(c&&J.reportValidity){const _=me(A)?"":A||"";u?u.forEach(D=>D.setCustomValidity(_)):J.setCustomValidity(_),J.reportValidity()}},E={},oe=ut(n),re=Ie(n),he=oe||re,le=(b||dt(n))&&R(n.value)&&R(T)||qe(n)&&n.value===""||T===""||Array.isArray(T)&&!T.length,W=ft.bind(null,f,a,E),ee=(A,_,D,$=ue.maxLength,w=ue.minLength)=>{const H=A?_:D;E[f]={type:A?$:w,message:H,ref:n,...W(A?$:w,H)}};if(d?!Array.isArray(T)||!T.length:j&&(!he&&(le||G(T))||me(T)&&!T||re&&!Xt(u).isValid||oe&&!Jt(u).isValid)){const{value:A,message:_}=Y(j)?{value:!!j,message:j}:_e(j);if(A&&(E[f]={type:ue.required,message:_,ref:J,...W(ue.required,_)},!a))return I(_),E}if(!le&&(!G(L)||!G(O))){let A,_;const D=_e(O),$=_e(L);if(!G(T)&&!isNaN(T)){const w=n.valueAsNumber||T&&+T;G(D.value)||(A=w>D.value),G($.value)||(_=w<$.value)}else{const w=n.valueAsDate||new Date(T),H=ve=>new Date(new Date().toDateString()+" "+ve),ye=n.type=="time",Z=n.type=="week";Y(D.value)&&T&&(A=ye?H(T)>H(D.value):Z?T>D.value:w>new Date(D.value)),Y($.value)&&T&&(_=ye?H(T)<H($.value):Z?T<$.value:w<new Date($.value))}if((A||_)&&(ee(!!A,D.message,$.message,ue.max,ue.min),!a))return I(E[f].message),E}if((P||V)&&!le&&(Y(T)||d&&Array.isArray(T))){const A=_e(P),_=_e(V),D=!G(A.value)&&T.length>+A.value,$=!G(_.value)&&T.length<+_.value;if((D||$)&&(ee(D,A.message,_.message),!a))return I(E[f].message),E}if(C&&!le&&Y(T)){const{value:A,message:_}=_e(C);if($e(A)&&!T.match(A)&&(E[f]={type:ue.pattern,message:_,ref:n,...W(ue.pattern,_)},!a))return I(_),E}if(N){if(ne(N)){const A=await N(T,t),_=Ct(A,J);if(_&&(E[f]={..._,...W(ue.validate,_.message)},!a))return I(_.message),E}else if(z(N)){let A={};for(const _ in N){if(!K(A)&&!a)break;const D=Ct(await N[_](T,t),J,_);D&&(A={...D,...W(_,D.message)},I(D.message),a&&(E[f]=A))}if(!K(A)&&(E[f]={ref:J,...A},!a))return E}}return I(!0),E},ze=e=>Array.isArray(e)?e:[e],es=e=>Array.isArray(e)?e.filter(Boolean):[];function or(e,s){const t=s.slice(0,-1).length;let a=0;for(;a<t;){if(G(e)){e=void 0;break}e=e[s[a]],a++}return e}function lr(e){for(const s in e)if(e.hasOwnProperty(s)&&!R(e[s]))return!1;return!0}function q(e,s){if(Y(s)&&Object.prototype.hasOwnProperty.call(e,s))return delete e[s],e;const t=Array.isArray(s)?s:Me(s)?[s]:Ke(s);if(t.some(n=>ct.includes(String(n))))return e;const a=t.length===1?e:or(e,t),c=t.length-1,d=t[c];return a&&delete a[d],c!==0&&(z(a)&&K(a)||Array.isArray(a)&&lr(a))&&q(e,t.slice(0,-1)),e}const ts=e=>{const s={};for(const t of Object.keys(e))if(lt(e[t])&&e[t]!==null&&!je(e[t])){const a=ts(e[t]);for(const c of Object.keys(a))s[`${t}.${c}`]=a[c]}else s[t]=e[t];return s},cr=X.createContext(null);cr.displayName="HookFormContext";var It=()=>{let e=[];return{get observers(){return e},next:c=>{for(const d of e)d.next&&d.next(c)},subscribe:c=>(e.push(c),{unsubscribe:()=>{e=e.filter(d=>d!==c)}}),unsubscribe:()=>{e=[]}}};function ss(e,s){const t={};for(const a in e)if(e.hasOwnProperty(a)){const c=e[a],d=s[a];if(c&&z(c)&&d){const n=ss(c,d);z(n)&&(t[a]=n)}else e[a]&&(t[a]=d)}return t}var rs=e=>e.type==="select-multiple",dr=e=>ut(e)||Ie(e),Je=e=>qe(e)&&e.isConnected,ur=e=>{for(const s in e)if(ne(e[s]))return!0;return!1};function is(e){return Array.isArray(e)||z(e)&&!ur(e)}function as(e){return!!(e&&"_f"in e)}function ns(e){return Array.isArray(e)?!e.some(s=>!R(s)):!Object.keys(e).length}function rt(e,s){Array.isArray(e)?e[s]=void 0:delete e[s]}function it(e,s={},t){for(const a in e){const c=e[a],d=t&&t[a];is(c)&&(!Array.isArray(c)||!as(d))?(s[a]=Array.isArray(c)?[]:{},it(c,s[a],d),ns(s[a])&&rt(s,a)):R(c)||(s[a]=!0)}return s}function we(e,s,t,a){t||(t=it(s,{},a));for(const c in e){const d=e[c],n=a&&a[c];is(d)&&(!Array.isArray(d)||!as(n))?(R(s)||st(t[c])?t[c]=it(d,Array.isArray(d)?[]:{},n):we(d,G(s)?{}:s[c],t[c],n),ns(t[c])&&rt(t,c)):pe(d,s[c])?rt(t,c):t[c]=!0}return t}var os=(e,{valueAsNumber:s,valueAsDate:t,setValueAs:a})=>R(e)?e:s?e===""?NaN:e&&+e:t&&Y(e)?new Date(e):a?a(e):e;function Mt(e){const s=e.ref;return dt(s)?s.files:ut(s)?Jt(e.refs).value:rs(s)?[...s.selectedOptions].map(({value:t})=>t):Ie(s)?Xt(e.refs).value:os(R(s.value)?e.ref.value:s.value,e)}var fr=(e,s,t,a)=>{const c={};for(const d of e){const n=g(s,d);n&&F(c,d,n._f)}return{criteriaMode:t,names:[...e],fields:c,shouldUseNativeValidation:a}},De=e=>R(e)?e:$e(e)?e.source:z(e)?$e(e.value)?e.value.source:e.value:e;const Rt="AsyncFunction";var mr=e=>{if(!e||!e.validate)return!1;if(ne(e.validate))return e.validate.constructor.name===Rt;if(z(e.validate)){for(const s in e.validate)if(e.validate[s].constructor.name===Rt)return!0}return!1},pr=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Ut(e,s,t){const a=g(e,t);if(a||Me(t))return{error:a,name:t};const c=t.split(".");for(;c.length;){const d=c.join("."),n=g(s,d),u=g(e,d);if(n&&!Array.isArray(n)&&t!==d)return{name:t};if(u&&u.type)return{name:d,error:u};if(u&&u.root&&u.root.type)return{name:`${d}.root`,error:u.root};c.pop()}return{name:t}}var hr=(e,s,t,a)=>{t(e);const{name:c,...d}=e,n=Object.keys(d);return!n.length||a&&n.length>=Object.keys(s).length||n.find(u=>s[u]===(!a||fe.all))},yr=(e,s,t)=>!e||!s||e===s||ze(e).some(a=>a&&(t?a===s||a.startsWith(s+"."):a.startsWith(s)||s.startsWith(a))),xr=(e,s,t,a,c)=>c.isOnAll?!1:!t&&c.isOnTouch?!(s||e):(t?a.isOnBlur:c.isOnBlur)?!e:(t?a.isOnChange:c.isOnChange)?e:!0,gr=(e,s)=>!es(g(e,s)).length&&q(e,s);const vr={mode:fe.onSubmit,reValidateMode:fe.onChange,shouldFocusError:!0},et="form",ls={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function br(e={}){let s={...vr,...e},t={...B(ls),isLoading:ne(s.defaultValues),errors:s.errors||{},disabled:s.disabled||!1},a={},c=z(s.defaultValues)||z(s.values)?B(s.defaultValues||s.values)||{}:{},d=s.shouldUnregister?{}:B(c),n={action:!1,mount:!1,watch:!1,keepIsValid:!1},u={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set};const j={},P={};let V=0,L=He(s.mode),O=He(s.reValidateMode);const C={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},N={...C};let f={...N};const b={array:It(),state:It()};let ie=0;const T=s.criteriaMode===fe.all,J=(r,o)=>l=>{clearTimeout(P[r]),P[r]=setTimeout(o,l)},I=async r=>{if(!n.keepIsValid&&!s.disabled&&(N.isValid||f.isValid||r)){const o=++ie;let l;s.resolver?(l=K((await D()).errors),o===ie&&E()):l=await H({fields:a,onlyCheckValid:!0,eventType:Ae.VALID}),o===ie&&l!==t.isValid&&b.state.next({isValid:l})}},E=(r,o)=>{!s.disabled&&(N.isValidating||N.validatingFields||f.isValidating||f.validatingFields)&&((r||Array.from(u.mount)).forEach(l=>{l&&(o?F(t.validatingFields,l,o):q(t.validatingFields,l))}),b.state.next({validatingFields:t.validatingFields,isValidating:!K(t.validatingFields)}))},oe=()=>{t.dirtyFields=we(c,d,void 0,a)},re=(r,o=[],l,m,p=!0,x=!0)=>{if(m&&l&&!s.disabled){if(n.action=!0,x&&Array.isArray(g(a,r))){const y=l(g(a,r),m.argA,m.argB);p&&F(a,r,y)}if(x&&Array.isArray(g(t.errors,r))){const y=l(g(t.errors,r),m.argA,m.argB);p&&F(t.errors,r,y),gr(t.errors,r)}if((N.touchedFields||f.touchedFields)&&x&&Array.isArray(g(t.touchedFields,r))){const y=l(g(t.touchedFields,r),m.argA,m.argB);p&&F(t.touchedFields,r,y)}(N.dirtyFields||f.dirtyFields)&&oe(),b.state.next({name:r,isDirty:Z(r,o),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else F(d,r,o)},he=(r,o)=>{F(t.errors,r,o),t.errors={...t.errors},b.state.next({errors:t.errors})},le=r=>{t.errors=r,b.state.next({errors:t.errors,isValid:!1})},W=r=>{const o=Me(r)?[r]:Ke(r);let l=d,m=c;for(let p=0;p<o.length-1;p++){const x=o[p];if(l=G(l)?l:l[x],m=G(m)?m:m[x],l===null&&m!==null)return!0}return!1},ee=(r,o,l,m)=>{const p=g(a,r);if(p){if(W(r))return;const x=R(g(d,r)),y=g(d,r,R(l)?g(c,r):l);R(y)||m&&m.defaultChecked||o?F(d,r,o?y:Mt(p._f)):k(r,y),n.mount&&!n.action&&(I(),x&&t.isDirty&&(N.isDirty||f.isDirty)&&(Z()||(t.isDirty=!1,b.state.next({...t}))),e.shouldUnregister&&x&&!R(g(d,r))&&Xe(r,u)&&(n.watch=!0))}},A=(r,o,l,m,p)=>{let x=!1,y=!1;const v={name:r};if(!s.disabled||m===!0){if(!l||m){const S=pe(g(c,r),o);(N.isDirty||f.isDirty)&&(y=t.isDirty,t.isDirty=v.isDirty=!S||Z(),x=y!==v.isDirty),y=!!g(t.dirtyFields,r),S!==t.isDirty?t.dirtyFields=we(c,d,void 0,a):S?q(t.dirtyFields,r):F(t.dirtyFields,r,!0),v.dirtyFields=t.dirtyFields,x=x||(N.dirtyFields||f.dirtyFields)&&y!==!S}if(l){const S=g(t.touchedFields,r);S||(F(t.touchedFields,r,l),v.touchedFields=t.touchedFields,x=x||(N.touchedFields||f.touchedFields)&&S!==l)}x&&p&&b.state.next(v)}return x?v:{}},_=(r,o,l,m)=>{const p=g(t.errors,r),x=(N.isValid||f.isValid)&&me(o)&&t.isValid!==o;if(s.delayError&&l?(j[r]=J(r,()=>he(r,l)),j[r](s.delayError)):(clearTimeout(P[r]),delete j[r],l?F(t.errors,r,l):q(t.errors,r),t.errors={...t.errors}),(l?!pe(p,l):p)||!K(m)||x){const y={...m,...x&&me(o)?{isValid:o}:{},errors:t.errors,name:r};t={...t,...y},b.state.next(y)}},D=async r=>(E(r,!0),await s.resolver(d,s.context,fr(r||u.mount,a,s.criteriaMode,s.shouldUseNativeValidation))),$=async r=>{const{errors:o}=await D(r);if(E(r),r){for(const l of r){const m=g(o,l);m?u.array.has(l)&&z(m)&&!Object.keys(m).some(p=>!Number.isNaN(Number(p)))?Et(t.errors,{[l]:m},l):F(t.errors,l,m):q(t.errors,l)}t.errors={...t.errors}}else t.errors=o;return o},w=async({name:r,eventType:o})=>{if(e.validate){const l=await e.validate({formValues:d,formState:t,name:r,eventType:o});if(z(l))for(const m in l){const p=l[m];p&&Re(`${et}.${m}`,{message:Y(p.message)?p.message:"",type:p.type||ue.validate})}else Y(l)||!l?Re(et,{message:l||"",type:ue.validate}):pt(et);return l}return!0},H=async({fields:r,onlyCheckValid:o,name:l,eventType:m,context:p={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(p.runRootValidation=!0,!await w({name:l,eventType:m})&&(p.valid=!1,o)))return p.valid;for(const x in r){const y=r[x];if(y){const{_f:v,...S}=y;if(v){const U=u.array.has(v.name),Q=y._f&&mr(y._f),xe=N.validatingFields||N.isValidating||f.validatingFields||f.isValidating;Q&&xe&&E([v.name],!0);const ge=await Ot(y,u.disabled,d,T,s.shouldUseNativeValidation&&!o,U);if(Q&&xe&&E([v.name]),ge[v.name]&&(p.valid=!1,o)||(!o&&(g(ge,v.name)?U?Et(t.errors,ge,v.name):F(t.errors,v.name,ge[v.name]):q(t.errors,v.name)),e.shouldUseNativeValidation&&ge[v.name]))break}!K(S)&&await H({context:p,onlyCheckValid:o,fields:S,name:x,eventType:m})}}return p.valid},ye=()=>{for(const r of u.unMount){const o=g(a,r);o&&(o._f.refs?o._f.refs.every(l=>!Je(l)):!Je(o._f.ref))&&Ye(r)}u.unMount=new Set},Z=(r,o)=>(r&&o&&F(d,r,o),!pe(n.mount?d:c,c)),ve=(r,o,l)=>nr(r,u,{...n.mount?d:R(o)?c:Y(r)?{[r]:o}:o},l,o),h=r=>es(g(n.mount?d:c,r,s.shouldUnregister?g(c,r,[]):[])),k=(r,o,l={},m=!1,p=!1)=>{const x=g(a,r);let y=o;if(x){const v=x._f;v&&(!v.disabled&&F(d,r,os(o,v)),y=qe(v.ref)&&G(o)?"":o,rs(v.ref)?[...v.ref.options].forEach(S=>S.selected=y.includes(S.value)):v.refs?Ie(v.ref)?v.refs.forEach(S=>{(!S.defaultChecked||!S.disabled)&&(Array.isArray(y)?S.checked=!!y.find(U=>U===S.value):S.checked=y===S.value||!!y)}):v.refs.forEach(S=>S.checked=S.value===y):dt(v.ref)?v.ref.value="":(v.ref.value=y,!v.ref.type&&!p&&b.state.next({name:r,values:m?d:B(d)})))}(l.shouldDirty||l.shouldTouch)&&A(r,y,l.shouldTouch,l.shouldDirty,!p),l.shouldValidate&&Ge(r,{delayError:l.delayError})},ce=(r,o,l,m=!1,p=!1)=>{for(const x in o){if(!o.hasOwnProperty(x))return;const y=o[x],v=r+"."+x,S=g(a,v);(u.array.has(r)||z(y)||S&&!S._f)&&!je(y)?ce(v,y,l,m,p):k(v,y,l,m,p)}},te=(r,o,l,m,p=!1)=>{const x=g(a,r),y=u.array.has(r),v=m?o:B(o),S=g(d,r),U=pe(S,v);if(U||F(d,r,v),y)b.array.next({name:r,values:m?d:B(d)}),(N.isDirty||N.dirtyFields||f.isDirty||f.dirtyFields)&&l.shouldDirty&&(oe(),p||b.state.next({name:r,dirtyFields:t.dirtyFields,isDirty:Z(r,v)}));else{const Q=Array.isArray(v)&&!v.length||K(v);!x||x._f||G(v)||Q?k(r,v,l,m,p):ce(r,v,l,m,p)}if(!U&&!p){const Q=Xe(r,u),xe=m?d:B(d);b.state.next({...Q&&t,name:n.mount||Q?r:void 0,values:xe})}},ae=(r,o,l={})=>te(r,o,l,!1),Se=(r,o={})=>{const l=ne(r)?r(d):r;if(!pe(d,l)){d={...d,...l};const m=ts(l);for(const p of u.mount)p in m&&te(p,m[p],o,!0,!0);b.state.next({...t,name:void 0,type:void 0,...V?{values:d}:{}}),o.shouldValidate&&I()}},Pe=async r=>{n.mount=!0;const o=r.target;let l=o.name,m=!0;const p=g(a,l),x=y=>{m=Number.isNaN(y)||je(y)&&isNaN(y.getTime())||pe(y,g(d,l,y))};if(p){let y,v;const S=o.type?Mt(p._f):Js(r),U=r.type===Ae.BLUR||r.type===Ae.FOCUS_OUT,Q=!pr(p._f)&&!e.validate&&!s.resolver&&!g(t.errors,l)&&!p._f.deps,xe=Q||xr(U,g(t.touchedFields,l),t.isSubmitted,O,L),ge=Xe(l,u,U);if(F(d,l,S),U){if(!o||!o.readOnly){p._f.onBlur&&p._f.onBlur(r);const Ee=j[l];Ee&&Ee(0)}}else p._f.onChange&&p._f.onChange(r);const Ve=A(l,S,U),Ss=!K(Ve)||ge;if(!U&&b.state.next({name:l,type:r.type,...V?{values:B(d)}:{}}),xe)return(!Q||!t.isValid)&&(N.isValid||f.isValid)&&(s.mode==="onBlur"?U&&I():U||I()),Ss&&b.state.next({name:l,...ge?{}:Ve});if(!s.resolver&&e.validate&&await w({name:l,eventType:r.type}),!U&&ge&&b.state.next({...t}),s.resolver){const{errors:Ee}=await D([l]);if(E([l]),x(S),!m){!K(Ve)&&b.state.next(Ve);return}const ws=Ut(t.errors,a,l),jt=Ut(Ee,a,ws.name||l);y=jt.error,l=jt.name,v=K(Ee)}else E([l],!0),y=(await Ot(p,u.disabled,d,T,s.shouldUseNativeValidation))[l],E([l]),x(S),m&&(y?v=!1:(N.isValid||f.isValid)&&(v=await H({fields:a,onlyCheckValid:!0,name:l,eventType:r.type})));m&&(p._f.deps&&(!Array.isArray(p._f.deps)||p._f.deps.length>0)&&Ge(p._f.deps),_(l,v,y,Ve))}},Te=(r,o)=>{if(g(t.errors,o)&&r.focus)return r.focus(),1},Ge=async(r,o={})=>{let l,m;const p=ze(r);if(s.resolver){const x=await $(R(r)?r:p);l=K(x),m=r?!p.some(y=>g(x,y)):l}else r?(m=(await Promise.all(p.map(async x=>{const y=g(a,x);return await H({fields:y&&y._f?{[x]:y}:y,eventType:Ae.TRIGGER})}))).every(Boolean),!(!m&&!t.isValid)&&I()):m=l=await H({fields:a,name:r,eventType:Ae.TRIGGER});if(o.delayError&&s.delayError&&Y(r)){const x=g(t.errors,r);x?(q(t.errors,r),j[r]=J(r,()=>he(r,x)),j[r](s.delayError)):(clearTimeout(P[r]),delete j[r])}return b.state.next({...!Y(r)||(N.isValid||f.isValid)&&l!==t.isValid?{}:{name:r},...s.resolver||!r?{isValid:l}:{},errors:t.errors}),o.shouldFocus&&!m&&Ce(a,Te,r?p:u.mount),m},hs=(r,o)=>{let l={...n.mount?d:c};return o&&(l=ss(o.dirtyFields?t.dirtyFields:t.touchedFields,l)),R(r)?l:Y(r)?g(l,r):r.map(m=>g(l,m))},mt=(r,o)=>({invalid:!!g((o||t).errors,r),isDirty:!!g((o||t).dirtyFields,r),error:g((o||t).errors,r),isValidating:!!g(t.validatingFields,r),isTouched:!!g((o||t).touchedFields,r)}),pt=r=>{const o=r?ze(r):void 0;o?.forEach(l=>q(t.errors,l)),o?o.forEach(l=>{b.state.next({name:l,errors:t.errors})}):b.state.next({errors:{}})},Re=(r,o,l)=>{const m=(g(a,r,{_f:{}})._f||{}).ref,p=g(t.errors,r)||{},{ref:x,message:y,type:v,...S}=p;F(t.errors,r,{...S,...o,ref:m}),b.state.next({name:r,errors:t.errors,isValid:!1}),l&&l.shouldFocus&&m&&m.focus&&m.focus()},ys=(r,o)=>{if(ne(r)){V++;const{unsubscribe:l}=b.state.subscribe({next:p=>"values"in p&&r(p.values||ve(void 0,o),p)});let m=!1;return{unsubscribe:()=>{m||(m=!0,V--,l())}}}return ve(r,o,!0)},ht=r=>{var o;const l=!!(!((o=r.formState)===null||o===void 0)&&o.values);l&&V++;const{unsubscribe:m}=b.state.subscribe({next:x=>{if(yr(r.name,x.name,r.exact)&&hr(x,r.formState||N,js,r.reRenderRoot)){const y={...d};r.callback({values:y,...t,...x,defaultValues:c})}}});if(!l)return m;let p=!1;return()=>{p||(p=!0,V--,m())}},xs=r=>(n.mount=!0,f={...f,...r.formState},ht({...r,formState:{...C,...r.formState}})),Ye=(r,o={})=>{for(const l of r?ze(r):u.mount)u.mount.delete(l),u.array.delete(l),o.keepValue||(q(a,l),q(d,l)),!o.keepError&&q(t.errors,l),!o.keepDirty&&q(t.dirtyFields,l),!o.keepTouched&&q(t.touchedFields,l),!o.keepIsValidating&&q(t.validatingFields,l),!s.shouldUnregister&&!o.keepDefaultValue&&q(c,l);b.state.next({values:B(d)}),b.state.next({...t,...o.keepDirty?{isDirty:Z()}:{}}),!o.keepIsValid&&I()},yt=({disabled:r,name:o})=>{if(me(r)&&n.mount||r||u.disabled.has(o)){const p=u.disabled.has(o)!==!!r;r?u.disabled.add(o):u.disabled.delete(o),p&&n.mount&&!n.action&&I()}},Ze=(r,o={})=>{let l=g(a,r);const m=me(o.disabled)||me(s.disabled),p=!u.registerName.has(r)&&l&&l._f&&!l._f.mount;return F(a,r,{...l||{},_f:{...l&&l._f?l._f:{ref:{name:r}},name:r,mount:!0,...o}}),u.mount.add(r),l&&!p?yt({disabled:me(o.disabled)?o.disabled:s.disabled,name:r}):ee(r,!0,o.value),{...m?{disabled:o.disabled||s.disabled}:{},...s.progressive?{required:!!o.required,min:De(o.min),max:De(o.max),minLength:De(o.minLength),maxLength:De(o.maxLength),pattern:De(o.pattern)}:{},name:r,onChange:Pe,onBlur:Pe,ref:x=>{if(x){u.registerName.add(r),Ze(r,o),u.registerName.delete(r),l=g(a,r);const y=R(x.value)&&x.querySelectorAll&&x.querySelectorAll("input,select,textarea")[0]||x,v=dr(y),S=l._f.refs||[];if(v?S.find(U=>U===y):y===l._f.ref)return;F(a,r,{_f:{...l._f,...v?{refs:[...S.filter(Je),y,...Array.isArray(g(c,r))?[{}]:[]],ref:{type:y.type,name:r}}:{ref:y}}}),ee(r,!1,void 0,y)}else l=g(a,r,{}),l._f&&(l._f.mount=!1),(s.shouldUnregister||o.shouldUnregister)&&!(er(u.array,r)&&n.action)&&u.unMount.add(r)}}},Qe=()=>s.shouldFocusError&&!s.shouldUseNativeValidation&&Ce(a,Te,u.mount),gs=r=>{me(r)&&(b.state.next({disabled:r}),Ce(a,(o,l)=>{const m=g(a,l);m&&(o.disabled=m._f.disabled||r,Array.isArray(m._f.refs)&&m._f.refs.forEach(p=>{p.disabled=m._f.disabled||r}))},0,!1))},xt=(r,o)=>async l=>{let m;l&&(l.preventDefault&&l.preventDefault(),l.persist&&l.persist());let p=B(d);if(b.state.next({isSubmitting:!0}),s.resolver){const{errors:x,values:y}=await D();E(),t.errors=x,p=B(y)}else await H({fields:a,eventType:Ae.SUBMIT});if(u.disabled.size)for(const x of u.disabled)q(p,x);if(q(t.errors,Qt),K(t.errors)){b.state.next({errors:{}});try{await r(p,l)}catch(x){m=x}}else o&&await o({...t.errors},l),Qe(),setTimeout(Qe);if(b.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:K(t.errors)&&!m,submitCount:t.submitCount+1,errors:t.errors}),m)throw m},vs=(r,o={})=>{g(a,r)&&(R(o.defaultValue)?ae(r,B(g(c,r))):(ae(r,o.defaultValue),F(c,r,B(o.defaultValue))),o.keepTouched||q(t.touchedFields,r),o.keepDirty||(q(t.dirtyFields,r),t.isDirty=o.defaultValue?Z(r,B(g(c,r))):Z()),o.keepError||(q(t.errors,r),N.isValid&&I()),b.state.next({...t}))},gt=(r,o={})=>{const l=r?B(r):c,m=B(l),p=K(r),x=m,y=a;if(o.keepDefaultValues||(c=l),!o.keepValues){if(o.keepDirtyValues){const v=new Set([...u.mount,...Object.keys(we(c,d,void 0,y))]);for(const S of Array.from(v)){const U=g(t.dirtyFields,S),Q=g(d,S),xe=g(x,S);U&&!R(Q)?F(x,S,Q):!U&&!R(xe)&&ae(S,xe)}}else{if(We&&R(r))for(const v of u.mount){const S=g(a,v);if(S&&S._f){const U=Array.isArray(S._f.refs)?S._f.refs[0]:S._f.ref;if(qe(U)){const Q=U.closest("form");if(Q){Q.reset();break}}}}if(o.keepFieldsRef)for(const v of u.mount)ae(v,g(x,v));else a={}}if(s.shouldUnregister){if(d=o.keepDefaultValues?B(c):{},o.keepFieldsRef)for(const v of u.mount)F(d,v,g(x,v))}else d=B(x);b.array.next({values:{...x}}),b.state.next({name:void 0,type:void 0,values:{...x}})}u={mount:o.keepDirtyValues?u.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},n.mount=!N.isValid||!!o.keepIsValid||!!o.keepDirtyValues||!s.shouldUnregister&&!K(x),n.watch=!!s.shouldUnregister,n.keepIsValid=!!o.keepIsValid,n.action=!1,o.keepErrors||(t.errors={}),b.state.next({submitCount:o.keepSubmitCount?t.submitCount:0,isDirty:p?!1:o.keepDirty?t.isDirty:o.keepValues?Z():!!(o.keepDefaultValues&&!pe(r,c)),isSubmitted:o.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:p?{}:o.keepDirtyValues?o.keepDefaultValues&&d?we(c,d,void 0,y):t.dirtyFields:o.keepDefaultValues&&r?we(c,r,void 0,y):o.keepDirty?t.dirtyFields:{},touchedFields:o.keepTouched?t.touchedFields:{},errors:o.keepErrors?t.errors:{},isSubmitSuccessful:o.keepIsSubmitSuccessful?t.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:c})},vt=(r,o)=>gt(ne(r)?r(d):r,{...s.resetOptions,...o}),bs=(r,o={})=>{const l=g(a,r),m=l&&l._f;if(m){const p=m.refs?m.refs[0]:m.ref;p.focus&&setTimeout(()=>{p.focus(),o.shouldSelect&&ne(p.select)&&p.select()})}},js=r=>{const{name:o,type:l,values:m,...p}=r;t={...t,...p}},bt={control:{register:Ze,unregister:Ye,getFieldState:mt,handleSubmit:xt,setError:Re,_subscribe:ht,_runSchema:D,_updateIsValidating:E,_focusError:Qe,_getWatch:ve,_getDirty:Z,_setValid:I,_setFieldArray:re,_setDisabledField:yt,_setErrors:le,_getFieldArray:h,_reset:gt,_resetDefaultValues:()=>ne(s.defaultValues)&&s.defaultValues().then(r=>{vt(r,s.resetOptions),b.state.next({isLoading:!1})}),_removeUnmounted:ye,_disableForm:gs,_subjects:b,_proxyFormState:N,get _fields(){return a},get _formValues(){return d},get _state(){return n},set _state(r){n=r},get _defaultValues(){return c},get _names(){return u},set _names(r){u=r},get _formState(){return t},get _options(){return s},set _options(r){s={...s,...r},L=He(s.mode),O=He(s.reValidateMode)}},subscribe:xs,trigger:Ge,register:Ze,handleSubmit:xt,watch:ys,setValue:ae,setValues:Se,getValues:hs,reset:vt,resetField:vs,resetDefaultValues:(r,o={})=>{if(c=B(r),!o.keepDirty){const l=we(c,d,void 0,a);t.dirtyFields=l,t.isDirty=!K(l)}o.keepIsValid||I(),b.state.next({...t,defaultValues:c})},clearErrors:pt,unregister:Ye,setError:Re,setFocus:bs,getFieldState:mt};return{...bt,formControl:bt}}function jr(e={}){const s=X.useRef(void 0),t=X.useRef(void 0),a=X.useRef(e.formControl),[c,d]=X.useState(()=>({...B(ls),isLoading:ne(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:ne(e.defaultValues)?void 0:e.defaultValues}));if(!s.current||e.formControl&&a.current!==e.formControl)if(a.current=e.formControl,e.formControl)s.current={...e.formControl,formState:c},e.defaultValues&&!ne(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:u,...j}=br(e);s.current={...j,formState:c}}const n=s.current.control;return n._options=e,ar(()=>{const u=n._subscribe({formState:n._proxyFormState,callback:()=>d({...n._formState,defaultValues:n._defaultValues}),reRenderRoot:!0});return d(j=>({...j,isReady:!0})),n._formState.isReady=!0,u},[n]),X.useEffect(()=>n._disableForm(e.disabled),[n,e.disabled]),X.useEffect(()=>{e.mode&&(n._options.mode=e.mode),e.reValidateMode&&(n._options.reValidateMode=e.reValidateMode)},[n,e.mode,e.reValidateMode]),X.useEffect(()=>{e.errors&&(n._setErrors(e.errors),n._focusError())},[n,e.errors]),X.useEffect(()=>{e.shouldUnregister&&n._subjects.state.next({values:n._getWatch()})},[n,e.shouldUnregister]),X.useEffect(()=>{if(n._proxyFormState.isDirty){const u=n._getDirty();u!==c.isDirty&&n._subjects.state.next({isDirty:u})}},[n,c.isDirty]),X.useEffect(()=>{var u;e.values&&!pe(e.values,t.current)?(n._reset(e.values,{keepFieldsRef:!0,...n._options.resetOptions}),!((u=n._options.resetOptions)===null||u===void 0)&&u.keepIsValid||n._setValid(),t.current=e.values,d(j=>({...j}))):n._resetDefaultValues()},[n,e.values]),X.useEffect(()=>{n._state.mount||(n._setValid(),n._state.mount=!0),n._state.watch&&(n._state.watch=!1,n._subjects.state.next({...n._formState})),n._removeUnmounted()}),s.current.formState=X.useMemo(()=>ir(c,n),[n,c]),s.current}const Ht=(e,s,t)=>{if(e&&"reportValidity"in e){const a=g(t,s);e.setCustomValidity(a&&a.message||""),e.reportValidity()}},at=(e,s)=>{for(const t in s.fields){const a=s.fields[t];a&&a.ref&&"reportValidity"in a.ref?Ht(a.ref,t,e):a&&a.refs&&a.refs.forEach(c=>Ht(c,t,e))}},Lt=(e,s)=>{s.shouldUseNativeValidation&&at(e,s);const t={};for(const a in e){const c=g(s.fields,a),d=Object.assign(e[a]||{},{ref:c&&c.ref});if(Sr(s.names||Object.keys(e),a)){const n=Object.assign({},g(t,a));F(n,"root",d),F(t,a,n)}else F(t,a,d)}return t},Sr=(e,s)=>{const t=zt(s).replace(/[.*+?^${}()|\\]/g,"\\$&");return e.some(a=>zt(a).match(`^${t}\\.\\d+`))};function zt(e){return e.replace(/[\[\]]/g,"")}function cs(e,s,t){function a(u,j){var P;Object.defineProperty(u,"_zod",{value:u._zod??{},enumerable:!1}),(P=u._zod).traits??(P.traits=new Set),u._zod.traits.add(e),s(u,j);for(const V in n.prototype)V in u||Object.defineProperty(u,V,{value:n.prototype[V].bind(u)});u._zod.constr=n,u._zod.def=j}const c=t?.Parent??Object;class d extends c{}Object.defineProperty(d,"name",{value:e});function n(u){var j;const P=t?.Parent?new d:this;a(P,u),(j=P._zod).deferred??(j.deferred=[]);for(const V of P._zod.deferred)V();return P}return Object.defineProperty(n,"init",{value:a}),Object.defineProperty(n,Symbol.hasInstance,{value:u=>t?.Parent&&u instanceof t.Parent?!0:u?._zod?.traits?.has(e)}),Object.defineProperty(n,"name",{value:e}),n}class wr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const Nr={};function ds(e){return Nr}function Tr(e,s){return typeof s=="bigint"?s.toString():s}const us=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Le(e){return typeof e=="string"?e:e?.message}function fs(e,s,t){const a={...e,path:e.path??[]};if(!e.message){const c=Le(e.inst?._zod.def?.error?.(e))??Le(s?.error?.(e))??Le(t.customError?.(e))??Le(t.localeError?.(e))??"Invalid input";a.message=c}return delete a.inst,delete a.continue,s?.reportInput||delete a.input,a}const ms=(e,s)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:s,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(s,Tr,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ar=cs("$ZodError",ms),ps=cs("$ZodError",ms,{Parent:Error}),_r=e=>(s,t,a,c)=>{const d=a?Object.assign(a,{async:!1}):{async:!1},n=s._zod.run({value:t,issues:[]},d);if(n instanceof Promise)throw new wr;if(n.issues.length){const u=new(c?.Err??e)(n.issues.map(j=>fs(j,d,ds())));throw us(u,c?.callee),u}return n.value},Pr=_r(ps),Vr=e=>async(s,t,a,c)=>{const d=a?Object.assign(a,{async:!0}):{async:!0};let n=s._zod.run({value:t,issues:[]},d);if(n instanceof Promise&&(n=await n),n.issues.length){const u=new(c?.Err??e)(n.issues.map(j=>fs(j,d,ds())));throw us(u,c?.callee),u}return n.value},Er=Vr(ps);function nt(){return nt=Object.assign?Object.assign.bind():function(e){for(var s=1;s<arguments.length;s++){var t=arguments[s];for(var a in t)({}).hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},nt.apply(null,arguments)}function Bt(e,s){try{var t=e()}catch(a){return s(a)}return t&&t.then?t.then(void 0,s):t}function kr(e,s){for(var t={};e.length;){var a=e[0],c=a.code,d=a.message,n=a.path.join(".");if(!t[n])if("unionErrors"in a){var u=a.unionErrors[0].errors[0];t[n]={message:u.message,type:u.code}}else t[n]={message:d,type:c};if("unionErrors"in a&&a.unionErrors.forEach(function(V){return V.errors.forEach(function(L){return e.push(L)})}),s){var j=t[n].types,P=j&&j[a.code];t[n]=ft(n,s,t,c,P?[].concat(P,a.message):a.message)}e.shift()}return t}function Dr(e,s){for(var t={},a=function(){var c=e[0],d=c.code,n=c.message,u=c.path.join(".");if(!t[u])if(c.code==="invalid_union"&&c.errors.length>0){var j=c.errors[0][0];t[u]={message:j.message,type:j.code}}else t[u]={message:n,type:d};if(c.code==="invalid_union"&&c.errors.forEach(function(L){return L.forEach(function(O){return e.push(nt({},O,{path:[].concat(c.path,O.path)}))})}),s){var P=t[u].types,V=P&&P[c.code];t[u]=ft(u,s,t,d,V?[].concat(V,c.message):c.message)}e.shift()};e.length;)a();return t}function Fr(e,s,t){if(t===void 0&&(t={}),(function(a){return"_def"in a&&typeof a._def=="object"&&"typeName"in a._def})(e))return function(a,c,d){try{return Promise.resolve(Bt(function(){return Promise.resolve(e[t.mode==="sync"?"parse":"parseAsync"](a,s)).then(function(n){return d.shouldUseNativeValidation&&at({},d),{errors:{},values:t.raw?Object.assign({},a):n}})},function(n){if((function(u){return Array.isArray(u?.issues)})(n))return{values:{},errors:Lt(kr(n.errors,!d.shouldUseNativeValidation&&d.criteriaMode==="all"),d)};throw n}))}catch(n){return Promise.reject(n)}};if((function(a){return"_zod"in a&&typeof a._zod=="object"})(e))return function(a,c,d){try{return Promise.resolve(Bt(function(){return Promise.resolve((t.mode==="sync"?Pr:Er)(e,a,s)).then(function(n){return d.shouldUseNativeValidation&&at({},d),{errors:{},values:t.raw?Object.assign({},a):n}})},function(n){if((function(u){return u instanceof Ar})(n))return{values:{},errors:Lt(Dr(n.issues,!d.shouldUseNativeValidation&&d.criteriaMode==="all"),d)};throw n}))}catch(n){return Promise.reject(n)}};throw new Error("Invalid input: not a Zod schema")}const qt=({isOpen:e,onClose:s,title:t,children:a,footer:c})=>i.jsxs(i.Fragment,{children:[i.jsx("div",{className:Be("fixed inset-0 bg-black/30 z-40 transition-opacity",e?"opacity-100":"opacity-0 pointer-events-none"),onClick:s,onKeyDown:d=>d.key==="Escape"&&s(),role:"button",tabIndex:0,"aria-label":"Close panel"}),i.jsxs("div",{className:Be("fixed top-0 right-0 h-full w-full sm:w-[400px] sm:max-w-[90vw] bg-canvas border-l border-line shadow-xl z-50","transform transition-transform duration-200 ease-out",e?"translate-x-0":"translate-x-full"),role:"dialog","aria-modal":"true","aria-labelledby":"slide-panel-title",children:[i.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-b border-line",children:[i.jsx("h2",{id:"slide-panel-title",className:"font-semibold",children:t}),i.jsx("button",{type:"button",onClick:s,className:"p-1.5 rounded-md hover:bg-surface-raised transition-colors","aria-label":"Close",children:i.jsx(Oe,{className:"size-5"})})]}),i.jsxs("div",{className:"h-[calc(100%-3.5rem)] flex flex-col",children:[i.jsx("div",{className:"flex-1 overflow-auto p-4",children:a}),c&&i.jsx("div",{className:"flex justify-end gap-3 p-4 border-t border-line bg-canvas",children:c})]})]})]}),Cr=e=>e.authType==="oauthMicrosoft",Or="••••••••••",Ir=e=>{const s=e.smtpUsername?.trim();return s?s!==e.username:!1},Mr=_s({email:be().email().min(1,"Email is required"),displayName:be().optional(),username:be().optional(),password:be().optional(),imapHost:be().min(1,"IMAP host is required"),imapPort:St.number().int().min(1).max(65535),imapTls:ke(),imapStartTls:ke(),smtpHost:be().optional(),smtpPort:St.number().int().min(1).max(65535).optional(),smtpTls:ke().optional(),smtpStartTls:ke().optional(),smtpUsername:be().optional(),smtpPassword:be().optional(),useDifferentSmtpCreds:ke().optional()}),Rr=({isOpen:e,onClose:s,account:t,focusSmtp:a})=>{const c=Gt(),d=!!t,[n,u]=M.useState(!1),[j,P]=M.useState(""),[V,L]=M.useState(!1),O=Tt(j),C=!!O&&!V,N=M.useRef(null),f=jr({resolver:Fr(Mr),defaultValues:{email:"",displayName:"",username:"",password:"",imapHost:"",imapPort:993,imapTls:!0,imapStartTls:!1,smtpHost:"",smtpPort:587,smtpTls:!1,smtpStartTls:!0,useDifferentSmtpCreds:!1}});M.useEffect(()=>{if(t){const h=Ir(t);f.reset({email:t.email,displayName:t.displayName||"",username:t.username||"",password:Or,imapHost:t.imapHost,imapPort:t.imapPort,imapTls:t.imapTls,imapStartTls:t.imapStartTls,smtpHost:t.smtpHost||"",smtpPort:t.smtpPort||587,smtpTls:t.smtpTls||!1,smtpStartTls:t.smtpStartTls||!0,smtpUsername:h&&t.smtpUsername||"",smtpPassword:"",useDifferentSmtpCreds:h}),u(!1)}else f.reset({email:"",displayName:"",username:"",password:"",imapHost:"",imapPort:993,imapTls:!0,imapStartTls:!1,smtpHost:"",smtpPort:587,smtpTls:!1,smtpStartTls:!0,useDifferentSmtpCreds:!1}),u(!1)},[t,f]);const b=Ne({...Ns()}),ie=Ne({...Ts(),onSuccess:()=>{c.invalidateQueries({queryKey:Fe()}),s()}}),T=Ne({...As(),onSuccess:()=>{c.invalidateQueries({queryKey:Fe()}),s()}}),J=()=>{const h=f.getValues(),k=d&&!n;b.mutate({body:{accountId:k?t?.accountId:void 0,username:h.username||h.email,password:k?void 0:h.password||void 0,imapHost:h.imapHost,imapPort:Number(h.imapPort),imapTls:h.imapTls,imapStartTls:h.imapStartTls}})},I=()=>{const h=f.getValues(),k=d&&!n;b.mutate({body:{accountId:k?t?.accountId:void 0,username:h.username||h.email,password:k?void 0:h.password||void 0,imapHost:h.imapHost,imapPort:Number(h.imapPort),imapTls:h.imapTls,imapStartTls:h.imapStartTls,smtpHost:h.smtpHost||void 0,smtpPort:h.smtpPort?Number(h.smtpPort):void 0,smtpTls:h.smtpTls,smtpStartTls:h.smtpStartTls,smtpUsername:h.useDifferentSmtpCreds?h.smtpUsername:void 0,smtpPassword:h.useDifferentSmtpCreds?h.smtpPassword:void 0}})},E=f.handleSubmit(h=>{if(!d&&!h.password){f.setError("password",{message:"Password is required"});return}const k=Ws({imapHost:h.imapHost,smtpHost:h.smtpHost,smtpPort:h.smtpPort,smtpTls:h.smtpTls,smtpStartTls:h.smtpStartTls});k&&(f.setValue("smtpHost",k.smtpHost),f.setValue("smtpPort",k.smtpPort),f.setValue("smtpTls",k.smtpTls),f.setValue("smtpStartTls",k.smtpStartTls));const ce=k?.smtpHost??h.smtpHost,te=k?.smtpPort??h.smtpPort,ae=k?.smtpTls??h.smtpTls,Se=k?.smtpStartTls??h.smtpStartTls,Pe={email:h.email,displayName:h.displayName?.trim()||void 0,username:h.username||void 0,imapHost:h.imapHost,imapPort:Number(h.imapPort),imapTls:h.imapTls,imapStartTls:h.imapStartTls,smtpHost:ce||void 0,smtpPort:te?Number(te):void 0,smtpTls:ae,smtpStartTls:Se,smtpUsername:h.useDifferentSmtpCreds&&h.smtpUsername||void 0,smtpPassword:h.useDifferentSmtpCreds&&h.smtpPassword||void 0};if(d&&t){const Te={...Pe,password:n?h.password:void 0};T.mutate({path:{accountId:t.accountId},body:Te})}else{const Te={...Pe,password:h.password};ie.mutate({body:Te})}}),oe=ie.isPending||T.isPending,{signature:re,setSignature:he,isSaving:le}=Us(t?.accountId),[W,ee]=M.useState(re.plainText);M.useEffect(()=>{ee(re.plainText)},[re.plainText]),M.useEffect(()=>{if(!e||!a)return;const h=N.current;if(!h)return;const k=window.setTimeout(()=>{h.scrollIntoView({behavior:"smooth",block:"start"})},250);return()=>window.clearTimeout(k)},[e,a]);const A=M.useCallback(()=>{W!==re.plainText&&he(W,W)},[W,re.plainText,he]),_=h=>{const{tls:k,startTls:ce}=Ue(h);f.setValue("imapTls",k),f.setValue("imapStartTls",ce);const te=f.getValues("imapPort");(te===993||te===143)&&f.setValue("imapPort",h==="tls"?993:143)},D=h=>{const{tls:k,startTls:ce}=Ue(h);f.setValue("smtpTls",k),f.setValue("smtpStartTls",ce);const te=f.getValues("smtpPort");if(te===465||te===587||te===25){const Se=h==="tls"?465:h==="starttls"?587:25;f.setValue("smtpPort",Se)}},$=()=>{const h=f.getValues("imapHost");f.setValue("smtpHost",Ks(h)),f.setValue("smtpTls",!1),f.setValue("smtpStartTls",!0),f.setValue("smtpPort",587)},w=h=>{P(h),L(!1);const k=Tt(h);if(!k)return;const ce=Ue(k.imap.security);f.setValue("imapHost",k.imap.host),f.setValue("imapPort",k.imap.port),f.setValue("imapTls",ce.tls),f.setValue("imapStartTls",ce.startTls);const te=Ue(k.smtp.security);f.setValue("smtpHost",k.smtp.host),f.setValue("smtpPort",k.smtp.port),f.setValue("smtpTls",te.tls),f.setValue("smtpStartTls",te.startTls);const ae=f.getValues("email").trim(),Se=f.getValues("username")?.trim();ae&&!Se&&f.setValue("username",ae)},H=O?.passwordHelp.text,ye=_t(b.data?.imapError,H),Z=_t(b.data?.smtpError,H);return(t?Cr(t):!1)&&d?i.jsx(qt,{isOpen:e,onClose:s,title:"Edit Account",footer:i.jsx(se,{type:"button",variant:"secondary",onClick:s,children:"Close"}),children:i.jsxs("div",{className:"space-y-6",children:[i.jsxs("section",{children:[i.jsx("h3",{className:"text-2xs font-semibold text-fg-subtle uppercase tracking-wider mb-3",children:"Microsoft 365 Account"}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"rounded-md border border-line bg-surface-sunken px-3 py-2.5 text-sm text-fg-muted",children:[i.jsx("span",{className:"block text-2xs font-medium uppercase tracking-wider text-fg-subtle mb-1",children:"Email"}),i.jsx("span",{className:"text-fg",children:t?.email})]}),i.jsxs("div",{className:"rounded-md border border-line bg-surface-sunken px-3 py-2.5 text-sm text-fg-muted",children:[i.jsx("span",{className:"block text-2xs font-medium uppercase tracking-wider text-fg-subtle mb-1",children:"Authentication"}),i.jsx("span",{className:"text-fg",children:"Microsoft OAuth (XOAUTH2)"})]}),i.jsx("p",{className:"text-xs text-fg-muted",children:"Server settings are managed automatically for Microsoft 365 accounts. To update credentials, use the Reconnect button."})]})]}),d&&i.jsxs("section",{children:[i.jsx("h3",{className:"text-2xs font-semibold text-fg-subtle uppercase tracking-wider mb-3",children:"Signature"}),i.jsx("div",{className:"space-y-3",children:i.jsxs("div",{children:[i.jsx("label",{htmlFor:"email-sig-view",className:"text-sm font-medium mb-1.5 block",children:"Email Signature"}),i.jsx("textarea",{id:"email-sig-view",value:W,onChange:h=>ee(h.target.value),onBlur:A,rows:5,className:"w-full px-3 py-2 border border-line rounded-md bg-surface-sunken text-sm text-fg placeholder:text-fg-subtle focus-within:border-line-strong focus-within:ring-2 focus-within:ring-ring/30 transition-colors resize-y outline-none",placeholder:"Enter your email signature..."}),i.jsx("p",{className:"text-xs text-fg-muted mt-1",children:le?"Saving signature...":"This signature will be appended to new emails."})]})})]})]})}):i.jsx(qt,{isOpen:e,onClose:s,title:d?"Edit Account":"Add Account",footer:i.jsxs(i.Fragment,{children:[i.jsx(se,{type:"button",variant:"secondary",onClick:s,children:"Cancel"}),i.jsx(se,{type:"submit",form:"account-form",variant:"primary",disabled:oe,children:oe?"Saving...":"Save Account"})]}),children:i.jsxs("form",{id:"account-form",onSubmit:E,className:"space-y-6",children:[i.jsxs("section",{children:[i.jsx("h3",{className:"text-2xs font-semibold text-fg-subtle uppercase tracking-wider mb-3",children:"Account Information"}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{children:[i.jsx("label",{htmlFor:"account-provider",className:"text-sm font-medium mb-1.5 block",children:"Provider"}),i.jsxs($s,{id:"account-provider",value:j,onChange:h=>w(h.target.value),children:[i.jsx("option",{value:"",children:"Custom / other"}),Bs.map(h=>i.jsx("option",{value:h.id,children:h.label},h.id))]}),i.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Pick your email provider to fill in server settings automatically, or choose Custom to enter them by hand."})]}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:"account-email",className:"text-sm font-medium mb-1.5 block",children:"Email Address"}),i.jsx(de,{id:"account-email",...f.register("email"),placeholder:"alice@example.com"}),f.formState.errors.email&&i.jsx("p",{className:"text-sm text-danger mt-1",children:f.formState.errors.email.message})]}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:"account-displayName",className:"text-sm font-medium mb-1.5 block",children:"Display name (optional)"}),i.jsx(de,{id:"account-displayName",...f.register("displayName"),placeholder:"Alice"}),i.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"What to call this account in Remit. Leave blank to use a name derived from the address."})]}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:"account-username",className:"text-sm font-medium mb-1.5 block",children:"Username"}),i.jsx(de,{id:"account-username",...f.register("username"),placeholder:"Same as email if empty"})]}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:"account-password",className:"text-sm font-medium mb-1.5 block",children:"Password"}),i.jsx(de,{id:"account-password",...f.register("password",{onChange:()=>u(!0)}),type:"password",onFocus:()=>{d&&!n&&(f.setValue("password",""),u(!0))},placeholder:d?"Leave empty to keep current":""}),f.formState.errors.password&&i.jsx("p",{className:"text-sm text-danger mt-1",children:f.formState.errors.password.message}),O&&i.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[O.passwordHelp.text," ",i.jsx("a",{href:O.passwordHelp.url,target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline",children:"Get an app password"})]})]})]})]}),i.jsxs("section",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsx("h3",{className:"text-2xs font-semibold text-fg-subtle uppercase tracking-wider",children:"Incoming Mail (IMAP)"}),O&&i.jsx("button",{type:"button",onClick:()=>L(h=>!h),className:"text-xs text-fg-muted hover:text-fg transition-colors",children:V?"Use preset settings":"Advanced"})]}),C&&i.jsxs("p",{className:"text-xs text-fg-muted mb-3",children:["Server settings are pre-filled for ",O?.label," and locked. Choose Advanced to edit them by hand."]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{children:[i.jsx("label",{htmlFor:"imap-host",className:"text-sm font-medium mb-1.5 block",children:"Server"}),i.jsx(de,{id:"imap-host",...f.register("imapHost"),readOnly:C,placeholder:"imap.example.com"}),f.formState.errors.imapHost&&i.jsx("p",{className:"text-sm text-danger mt-1",children:f.formState.errors.imapHost.message})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{htmlFor:"imap-port",className:"text-sm font-medium mb-1.5 block",children:"Port"}),i.jsx(de,{id:"imap-port",...f.register("imapPort"),readOnly:C,type:"number"})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-sm font-medium mb-1.5 block",children:"Security"}),i.jsxs("div",{className:"space-y-1.5 mt-2",children:[i.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[i.jsx("input",{type:"radio",disabled:C,checked:f.watch("imapTls"),onChange:()=>_("tls")}),"TLS (Port 993)"]}),i.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[i.jsx("input",{type:"radio",disabled:C,checked:!f.watch("imapTls")&&f.watch("imapStartTls"),onChange:()=>_("starttls")}),"STARTTLS (Port 143)"]}),i.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[i.jsx("input",{type:"radio",disabled:C,checked:!f.watch("imapTls")&&!f.watch("imapStartTls"),onChange:()=>_("none")}),"None (Unencrypted)"]})]})]})]}),i.jsx(se,{type:"button",variant:"secondary",onClick:J,disabled:b.isPending,className:"w-full",icon:b.isPending?i.jsx(tt,{className:"size-4 animate-spin"}):void 0,children:b.isPending?"Testing...":"Test IMAP Connection"}),b.data&&i.jsxs("div",{className:Be("p-2 rounded-md text-sm",b.data.imapSuccess?"bg-positive/10 text-positive":"bg-danger-soft text-danger"),children:[b.data.imapSuccess?i.jsx(At,{className:"inline size-4 mr-1"}):i.jsx(Oe,{className:"inline size-4 mr-1"}),b.data.imapSuccess?"IMAP Connected":ye]})]})]}),i.jsxs("section",{ref:N,"data-testid":"smtp-section",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsx("h3",{className:"text-2xs font-semibold text-fg-subtle uppercase tracking-wider",children:"Outgoing Mail (SMTP)"}),!C&&i.jsx("button",{type:"button",onClick:$,disabled:!f.watch("imapHost"),className:"text-xs text-fg-muted hover:text-fg transition-colors disabled:opacity-50",children:"Pre-fill from IMAP"})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{children:[i.jsx("label",{htmlFor:"smtp-host",className:"text-sm font-medium mb-1.5 block",children:"Server"}),i.jsx(de,{id:"smtp-host",...f.register("smtpHost"),readOnly:C,placeholder:"smtp.example.com"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{htmlFor:"smtp-port",className:"text-sm font-medium mb-1.5 block",children:"Port"}),i.jsx(de,{id:"smtp-port",...f.register("smtpPort"),readOnly:C,type:"number"})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-sm font-medium mb-1.5 block",children:"Security"}),i.jsxs("div",{className:"space-y-1.5 mt-2",children:[i.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[i.jsx("input",{type:"radio",disabled:C,checked:f.watch("smtpTls")===!0,onChange:()=>D("tls")}),"TLS (Port 465)"]}),i.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[i.jsx("input",{type:"radio",disabled:C,checked:!f.watch("smtpTls")&&f.watch("smtpStartTls")===!0,onChange:()=>D("starttls")}),"STARTTLS (Port 587)"]}),i.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[i.jsx("input",{type:"radio",disabled:C,checked:!f.watch("smtpTls")&&!f.watch("smtpStartTls"),onChange:()=>D("none")}),"None (Unencrypted)"]})]})]})]}),i.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[i.jsx("input",{type:"checkbox",...f.register("useDifferentSmtpCreds")}),"Use different credentials for SMTP"]}),f.watch("useDifferentSmtpCreds")&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{htmlFor:"smtp-username",className:"text-sm font-medium mb-1.5 block",children:"SMTP Username"}),i.jsx(de,{id:"smtp-username",...f.register("smtpUsername")})]}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:"smtp-password",className:"text-sm font-medium mb-1.5 block",children:"SMTP Password"}),i.jsx(de,{id:"smtp-password",...f.register("smtpPassword"),type:"password"})]})]}),i.jsx(se,{type:"button",variant:"secondary",onClick:I,disabled:b.isPending||!f.watch("smtpHost"),className:"w-full",icon:b.isPending?i.jsx(tt,{className:"size-4 animate-spin"}):void 0,children:b.isPending?"Testing...":"Test SMTP Connection"}),b.data?.smtpSuccess!==void 0&&i.jsxs("div",{className:Be("p-2 rounded-md text-sm",b.data.smtpSuccess?"bg-positive/10 text-positive":"bg-danger-soft text-danger"),children:[b.data.smtpSuccess?i.jsx(At,{className:"inline size-4 mr-1"}):i.jsx(Oe,{className:"inline size-4 mr-1"}),b.data.smtpSuccess?"SMTP Connected":Z]})]})]}),d&&i.jsxs("section",{children:[i.jsx("h3",{className:"text-2xs font-semibold text-fg-subtle uppercase tracking-wider mb-3",children:"Signature"}),i.jsx("div",{className:"space-y-3",children:i.jsxs("div",{children:[i.jsx("label",{htmlFor:"email-sig-edit",className:"text-sm font-medium mb-1.5 block",children:"Email Signature"}),i.jsx("textarea",{id:"email-sig-edit",value:W,onChange:h=>ee(h.target.value),onBlur:A,rows:5,className:"w-full px-3 py-2 border border-line rounded-md bg-surface-sunken text-sm text-fg placeholder:text-fg-subtle focus-within:border-line-strong focus-within:ring-2 focus-within:ring-ring/30 transition-colors resize-y outline-none",placeholder:"Enter your email signature..."}),i.jsx("p",{className:"text-xs text-fg-muted mt-1",children:le?"Saving signature...":"This signature will be appended to new emails."})]})})]})]})})};function $t({open:e,onClose:s,accountEmail:t,signOut:a}){const[c,d]=M.useState(""),[n,u]=M.useState(!1),[j,P]=M.useState(!1),V=Ne({...Vs(),onSuccess:()=>{P(!0),setTimeout(()=>a(),2e3)}}),L=Ne(Es()),O=()=>{V.isPending||(d(""),u(!1),P(!1),V.reset(),L.reset(),s())},C=()=>{if(c.trim().toLowerCase()!==t.toLowerCase()){u(!0);return}u(!1),V.mutate({body:{confirmEmail:c.trim()}})};return i.jsxs(Yt,{open:e,onClose:O,title:"Delete your Remit account",children:[i.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[i.jsx(ot,{className:"size-4 shrink-0 text-danger"}),i.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:"Delete your Remit account"}),i.jsx(se,{variant:"ghost",size:"sm",icon:i.jsx(Oe,{className:"size-3.5"}),onClick:O,"aria-label":"Cancel"})]}),j?i.jsxs("div",{className:"px-5 py-6 text-sm text-fg-muted",children:[i.jsx("p",{className:"font-medium text-fg",children:"Account deletion scheduled."}),i.jsx("p",{className:"mt-1",children:"Your data will be erased shortly. Signing you out…"})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"space-y-4 px-5 py-4 text-sm text-fg-muted",children:[i.jsx("p",{children:"This permanently erases everything Remit holds for you:"}),i.jsxs("ul",{className:"space-y-1.5 text-xs",children:[i.jsxs("li",{className:"flex gap-2",children:[i.jsx("span",{className:"text-danger",children:"•"}),"All connected accounts disconnected and access tokens revoked."]}),i.jsxs("li",{className:"flex gap-2",children:[i.jsx("span",{className:"text-danger",children:"•"}),"Synced mail cache and search index."]}),i.jsxs("li",{className:"flex gap-2",children:[i.jsx("span",{className:"text-danger",children:"•"}),"AI history and insights."]}),i.jsxs("li",{className:"flex gap-2",children:[i.jsx("span",{className:"text-danger",children:"•"}),"Preferences and rules."]})]}),i.jsxs("div",{className:"rounded-sm border border-line bg-surface-sunken px-3 py-2 text-xs",children:[i.jsx("strong",{className:"text-fg",children:"Your mail at Gmail / IMAP is not deleted."})," ","This only removes Remit's copy and its access — the mail stays in your provider mailboxes."]}),i.jsxs("div",{className:"text-xs",children:[i.jsxs("button",{type:"button",onClick:()=>L.mutate({}),"aria-busy":L.isPending,className:"inline-flex items-center gap-1.5 font-medium text-accent hover:underline",children:[i.jsx(Qs,{className:"size-3.5"}),L.isPending?"Requesting export…":"Export my data first"]}),L.isSuccess&&i.jsx("p",{className:"mt-1.5 text-fg-muted",role:"status",children:"Export requested. We'll prepare a ZIP of your mail — find it under your data exports when it's ready."}),L.isError&&i.jsx("p",{className:"mt-1.5 text-danger",role:"alert",children:"Couldn't start the export. Please try again."})]}),i.jsxs("div",{children:[i.jsxs("label",{htmlFor:"confirm-remit-email",className:"mb-1 block text-xs font-medium text-fg",children:["Type"," ",i.jsx("span",{className:"font-mono text-fg-muted",children:t})," ","to confirm"]}),i.jsx(de,{id:"confirm-remit-email",type:"email",placeholder:t,value:c,onChange:N=>{d(N.target.value),n&&u(!1),V.isError&&V.reset()},autoComplete:"off"}),n&&i.jsx("p",{className:"mt-1.5 text-xs text-danger",role:"alert",children:"That doesn't match your account email. Type it exactly to confirm."}),V.isError&&i.jsx("p",{className:"mt-1.5 text-xs text-danger",role:"alert",children:V.error instanceof Error?V.error.message:"Something went wrong. Please try again."})]})]}),i.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[i.jsx(se,{variant:"secondary",size:"sm",onClick:O,children:"Cancel"}),i.jsx(se,{variant:"danger",size:"sm",onClick:C,"aria-busy":V.isPending,children:V.isPending?"Deleting…":"Delete everything"})]})]})]})}function Ur(e){const{Account:s}=Ps();return i.jsx(s,{fallback:i.jsx($t,{...e,accountEmail:"",signOut:()=>{}}),children:({email:t,signOut:a})=>i.jsx($t,{...e,accountEmail:t??"",signOut:a})})}function Hr(){const[e,s]=M.useState(!1);return i.jsxs("section",{className:"mt-8 border-t border-line pt-6",children:[i.jsx(Xs,{title:"Delete your Remit account",description:"Disconnects every account and erases Remit's copy of your mail, insights and preferences. Your mail at the providers is untouched.",action:i.jsx(se,{variant:"danger",size:"sm",onClick:()=>s(!0),children:"Delete your Remit account"})}),i.jsx(Ur,{open:e,onClose:()=>s(!1)})]})}function Lr(e){const s=e.toLowerCase();return s==="access_denied"?"You cancelled the sign-in.":s==="consent_required"||s.includes("admin_consent")||s.includes("interaction_required")?"Your organisation's admin needs to approve Remit. Ask your IT admin to grant the required permissions.":s.includes("imap_disabled")||s.includes("imap disabled")?"IMAP is disabled for this account. Ask your admin to enable IMAP access in the Microsoft 365 admin centre.":`Sign-in failed: ${e}. Please try again.`}function zr(e){const s=e.split("@")[0]??"";return s?s.split(/[._-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" "):e}function Br(e){const s=e.displayName?.trim();return s||zr(e.email)}function qr(e){if(!e.lastSyncAt)return"never synced";const s=Ys(e.lastSyncAt);return s?`synced ${s}`:"never synced"}function Wt(e){return e.muted?.value?"muted":e.lastError?"error":e.connectionState==="authenticated"?"healthy":"error"}function $r(e){return e.connectionState==="reauth_required"}const Wr=i.jsxs("div",{className:"space-y-3",children:[i.jsxs("p",{children:[i.jsx("strong",{className:"text-fg",children:"Sync health"})," shows the IMAP connection state and the last successful sync per account."]}),i.jsxs("p",{children:[i.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."]}),i.jsxs("p",{children:[i.jsx("strong",{className:"text-fg",children:"Muted"})," accounts keep syncing but stay out of the daily brief and unified counts."]})]}),Kr=()=>i.jsx("div",{className:"space-y-3",role:"status","aria-busy":"true","aria-label":"Loading accounts",children:["skeleton-0","skeleton-1"].map(e=>i.jsx("div",{className:"rounded-sm border border-line bg-surface animate-pulse p-4",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"size-10 rounded-full bg-surface-sunken"}),i.jsxs("div",{className:"flex-1 space-y-2",children:[i.jsx("div",{className:"h-4 bg-surface-sunken rounded w-1/3"}),i.jsx("div",{className:"h-3 bg-surface-sunken rounded w-2/3"})]})]})},e))});function li(){const e=wt.useSearch(),s=ks({from:wt.fullPath}),[t,a]=M.useState(!0),[c,d]=M.useState(!1),[n,u]=M.useState(!1),[j,P]=M.useState(null),[V,L]=M.useState(!1),[O,C]=M.useState(null),[N,f]=M.useState(null),[b,ie]=M.useState(null),[T,J]=M.useState(null),I=Gt(),{data:E,isPending:oe,isError:re,error:he,refetch:le}=Ds(Fs());M.useEffect(()=>{e.editAccountId&&(P(e.editAccountId),L(!!e.focusSmtp),s({search:{editAccountId:void 0,focusSmtp:void 0,connected:e.connected,oauthError:e.oauthError},replace:!0}))},[e.editAccountId,e.focusSmtp,s,e.connected,e.oauthError]),M.useEffect(()=>{e.connected&&(f("Account connected successfully."),P(e.connected),I.invalidateQueries({queryKey:Fe()}),s({search:{connected:void 0,oauthError:void 0,editAccountId:void 0,focusSmtp:void 0},replace:!0}))},[e.connected,s,I]),M.useEffect(()=>{e.oauthError&&(ie(Lr(e.oauthError)),s({search:{oauthError:void 0,connected:void 0,editAccountId:void 0,focusSmtp:void 0},replace:!0}))},[e.oauthError,s]);const W=Ne({...Cs(),onSuccess:w=>{window.location.assign(w.authorizationUrl)},onError:w=>{ie(w instanceof Error?w.message:"Failed to start reconnect"),J(null)}}),ee=Ne({...Os(),onSuccess:()=>{I.invalidateQueries({queryKey:Fe()}),C(null)}}),A=E?.accounts.find(w=>w.accountId===O),_=E?.accounts.find(w=>w.accountId===j),D=()=>{d(!1),u(!1),P(null),L(!1)},$=w=>{const H=Rs[w];H&&s({to:H})};return i.jsxs(Ls,{items:Is,activeId:"accounts",title:"Accounts",description:"Every account keeps syncing — muted ones just stay out of unified views.",help:Wr,helpOpen:t,onToggleHelp:()=>a(w=>!w),onSelect:$,onBackToMail:()=>{s({to:"/mail"})},children:[N&&i.jsx(Nt,{tone:"success",variant:"soft","data-testid":"oauth-success-banner",onDismiss:()=>f(null),children:N}),b&&i.jsx(Nt,{tone:"danger",variant:"soft","data-testid":"oauth-error-banner",onDismiss:()=>ie(null),children:b}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(Ms,{tone:"neutral",children:oe||re?"accounts":`${E.accounts.length} ${E.accounts.length===1?"account":"accounts"}`}),i.jsx(se,{variant:"primary",size:"sm",icon:i.jsx(Pt,{className:"size-3.5"}),onClick:()=>u(!0),children:"Add account"})]}),oe?i.jsx(Kr,{}):re?i.jsx(Gs,{title:"Couldn't load accounts",error:he,onRetry:()=>{le()}}):E.accounts.length===0?i.jsxs("div",{className:"py-12 text-sm text-fg-muted","data-testid":"accounts-empty",children:[i.jsx("p",{className:"mb-3",children:"No accounts configured."}),i.jsx(se,{variant:"primary",size:"sm",icon:i.jsx(Pt,{className:"size-3.5"}),onClick:()=>u(!0),children:"Add your first account"})]}):i.jsx("div",{className:"space-y-3",children:E.accounts.map(w=>{const H=$r(w),ye=w.authType==="oauthMicrosoft",Z=T===w.accountId&&W.isPending,ve=H&&ye?{label:"Reconnect",variant:"secondary",busy:Z,busyLabel:"Redirecting…",onClick:()=>{J(w.accountId),W.mutate({body:{email:w.email}})}}:Wt(w)==="error"?{label:"Reconnect",variant:"secondary",onClick:()=>P(w.accountId)}:{label:"Manage",variant:"ghost",onClick:()=>P(w.accountId)},h=i.jsx(Hs,{actions:[ve],destructive:{label:"Delete account",iconOnly:!0,icon:i.jsx(Zs,{className:"size-3.5"}),onClick:()=>C(w.accountId)}});return i.jsx(zs,{label:Br(w),email:w.email,connector:ye?"Microsoft 365":"IMAP",syncLabel:qr(w),state:Wt(w),errorDetail:H?"Re-authentication required":w.lastError,trailing:h},w.accountId)})}),n&&i.jsx("div",{className:"fixed inset-0 z-40 overflow-auto bg-canvas",children:i.jsx(qs,{skipWelcome:!0,onComplete:()=>{u(!1),I.invalidateQueries({queryKey:Fe()})},onCancel:()=>u(!1)})}),i.jsx(Rr,{isOpen:c||!!j,account:_,focusSmtp:V,onClose:D}),i.jsxs(Yt,{open:!!O,onClose:()=>C(null),title:"Delete account",children:[i.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[i.jsx(ot,{className:"size-4 shrink-0 text-danger"}),i.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:"Delete account"}),i.jsx(se,{variant:"ghost",size:"sm",icon:i.jsx(Oe,{className:"size-3.5"}),onClick:()=>C(null),"aria-label":"Cancel"})]}),i.jsxs("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:[i.jsx("p",{className:"text-center text-lg font-medium text-fg",children:"Are you sure?"}),A&&i.jsx("p",{className:"text-center",children:A.email}),i.jsxs("ul",{className:"list-inside list-disc space-y-1",children:[i.jsx("li",{children:"Remove the account from your settings"}),i.jsx("li",{children:"Stop syncing mail for this account"}),i.jsx("li",{children:"Delete all associated data (within 24 hours)"})]})]}),i.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[i.jsx(se,{variant:"secondary",size:"sm",onClick:()=>C(null),children:"Cancel"}),i.jsx(se,{variant:"danger",size:"sm","aria-busy":ee.isPending,icon:ee.isPending?i.jsx(tt,{className:"size-3.5 animate-spin"}):void 0,onClick:()=>{ee.isPending||O&&ee.mutate({path:{accountId:O}})},children:ee.isPending?"Deleting…":"Delete account"})]})]}),i.jsx(Hr,{})]})}export{li as component,Lr as mapOauthError};
|
package/assets/index-PRVXShJU.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t,b0 as o}from"./index-Dng478lt.js";const n=()=>t.jsx(o,{to:"/settings/accounts"});export{n as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t,a_ as o}from"./index-Dng478lt.js";const n=()=>t.jsx(o,{});export{n as component};
|