@remit/web-client-dist 0.0.430 → 0.0.432
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-CytP3J7O.js → BriefPane-BToIPtXS.js} +1 -1
- package/assets/{ErrorState-B_pp6XjY.js → ErrorState-DbgUZ__l.js} +1 -1
- package/assets/{FlaggedPane-BTGAqs21.js → FlaggedPane-uXhvpt4T.js} +1 -1
- package/assets/{FullCompose-D8BBZrtI.js → FullCompose-C07owHeK.js} +1 -1
- package/assets/{MailListHeader-BjsRsJYI.js → MailListHeader-3VPhFLtl.js} +1 -1
- package/assets/{MailShell-CvPQWjl1.js → MailShell-Dpl2UghQ.js} +1 -1
- package/assets/{MailViewChrome-ZN5UsScT.js → MailViewChrome-DjiziPrg.js} +1 -1
- package/assets/{MailboxPane-Bca57rKs.js → MailboxPane-CoyUSu35.js} +1 -1
- package/assets/{NavMenuButton-_aiK1QXb.js → NavMenuButton-DNhdUn1P.js} +1 -1
- package/assets/{OnboardingWizard-BdBknD3m.js → OnboardingWizard-BzWjoYzT.js} +1 -1
- package/assets/{OutboxPane-3nlNVjx6.js → OutboxPane-D7Dv6g_7.js} +1 -1
- package/assets/_mailboxId-txvVoMd6.js +1 -0
- package/assets/_messageId-CyAGoeAS.js +1 -0
- package/assets/_messageId-FlTOT12c.js +1 -0
- package/assets/_messageId-plfPIig1.js +1 -0
- package/assets/_outboxMessageId-CmJkmgK7.js +1 -0
- package/assets/_threadId-BYxzsRTx.js +1 -0
- package/assets/_threadId-D25pTF3U.js +1 -0
- package/assets/_threadId-DKZtl3Jy.js +1 -0
- package/assets/{accounts-Cji9zFqV.js → accounts-DsPNyX6L.js} +1 -1
- package/assets/{advanced-BXCAioJN.js → advanced-BQF1N0OG.js} +1 -1
- package/assets/{appearance-Dg7qROVT.js → appearance-dP4dSaM8.js} +1 -1
- package/assets/{attachment-file-CLrI3kMw.js → attachment-file-BpcYj8EC.js} +1 -1
- package/assets/{avatar-C8lpjlQO.js → avatar-CkH5WRjW.js} +1 -1
- package/assets/{bottom-sheet-BuEgZWXh.js → bottom-sheet-2TDQ0T_I.js} +1 -1
- package/assets/{brief-Dt7lMB8R.js → brief-BHm02jne.js} +1 -1
- package/assets/brief-OSPCXSz1.js +1 -0
- package/assets/{browser-ponyfill-g58jgFl_.js → browser-ponyfill-BaJX5QEf.js} +1 -1
- package/assets/{bug-CDU4oK_3.js → bug-7A296w_v.js} +1 -1
- package/assets/{circle-check-BhMyR8BA.js → circle-check-CGtgFyYX.js} +1 -1
- package/assets/{circle-check-big-5NMrNFUI.js → circle-check-big-CdK3PYyl.js} +1 -1
- package/assets/{circle-help-BAup3nOG.js → circle-help-BsddLaRz.js} +1 -1
- package/assets/{clock-DCdX5E4T.js → clock-DWWB2TEy.js} +1 -1
- package/assets/compose._-_outboxMessageId_-80lzl3ll.js +1 -0
- package/assets/compose._-_outboxMessageId_-C1-S35ba.js +1 -0
- package/assets/compose._-_outboxMessageId_-CXFLT0jx.js +1 -0
- package/assets/compose._-_outboxMessageId_-dquYHUV6.js +1 -0
- package/assets/{confirm-dialog-BxXd7BDT.js → confirm-dialog-BnyN7GHh.js} +1 -1
- package/assets/{download-Br1uSntK.js → download-BbohFpPf.js} +1 -1
- package/assets/{filters-snY8U8V2.js → filters-DlzeE2gu.js} +1 -1
- package/assets/{flagged-DBt5871J.js → flagged-B24N8bTl.js} +1 -1
- package/assets/flagged-D7U7pDyB.js +1 -0
- package/assets/{folders-BzRKidwZ.js → folders-B5VxdyRh.js} +1 -1
- package/assets/{help-copy-D1mikTkH.js → help-copy-CuPR-ASR.js} +1 -1
- package/assets/index-0FGoRika.js +46 -0
- package/assets/index-C0cB9J-h.js +1 -0
- package/assets/index-CGmkQXmE.js +1 -0
- package/assets/{index-idulIG65.js → index-CKkjA-cG.js} +4 -4
- package/assets/index-CLQMMX7i.js +1 -0
- package/assets/index-COHZoe1M.js +1 -0
- package/assets/index-CyAGoeAS.js +1 -0
- package/assets/index-DCx9rym2.js +1 -0
- package/assets/index-FZFwEfWQ.js +1 -0
- package/assets/index-plfPIig1.js +1 -0
- package/assets/{kbd-eZWvlfcb.js → kbd-ZFs3oMUy.js} +1 -1
- package/assets/{labels-DFa210V0.js → labels-Y7iA9EQB.js} +1 -1
- package/assets/{mail-Ba7j-n-X.js → mail-Dr2jAfYM.js} +1 -1
- package/assets/{mail-lLnBwPN-.js → mail-DsAXVtA0.js} +1 -1
- package/assets/{menu-MXmFQ7m-.js → menu-CBoa4zv9.js} +1 -1
- package/assets/{onboarding-BQv4jg_d.js → onboarding-CGWbq5Ey.js} +1 -1
- package/assets/outbox-7TeMxKa_.js +1 -0
- package/assets/{pencil-CFys2EU7.js → pencil-DlTfcBDH.js} +1 -1
- package/assets/{rich-text-DUWqcHC5.js → rich-text-CWIUvmQO.js} +1 -1
- package/assets/{rich-text-spellcheck-worker-provider-DTxcyJ9W.js → rich-text-spellcheck-worker-provider-BnPHerMN.js} +1 -1
- package/assets/{rotate-ccw-DfGOnKhE.js → rotate-ccw-CkgxPcaT.js} +1 -1
- package/assets/{row-actions-zVghhE3a.js → row-actions-BgRf_L5r.js} +1 -1
- package/assets/{search-mirror-_pK4jqc8.js → search-mirror-Ci3JhyjF.js} +1 -1
- package/assets/{search-token-index-C-cpQFN3.js → search-token-index-DwZH1pNH.js} +1 -1
- package/assets/{senders-Gj8Yentl.js → senders-BxlwkK_q.js} +1 -1
- package/assets/settings-pIz-kLv4.js +1 -0
- package/assets/{settings-screen-B17eDLDl.js → settings-screen-DHFhkUWA.js} +1 -1
- package/assets/{shield-check-DG9twqa-.js → shield-check-B7H7xIyv.js} +1 -1
- package/assets/{suggested-vips--KmGV5np.js → suggested-vips-BRy8ZjuB.js} +1 -1
- package/assets/{useDebouncedValue-CntZIoMR.js → useDebouncedValue-C4gSwa1u.js} +1 -1
- package/assets/{useFilters-DaiBln2b.js → useFilters-BowNMCvT.js} +1 -1
- package/assets/{useLabels-amyS-Wph.js → useLabels-DCDbtd5c.js} +1 -1
- package/assets/{useMessageBodyContent-5kw10g9a.js → useMessageBodyContent-BZvmaesf.js} +1 -1
- package/assets/{useRefreshControl-CUTMAyIA.js → useRefreshControl-BtqovDHX.js} +1 -1
- package/assets/{useSearchTokenContext-BxDapNdu.js → useSearchTokenContext-ayOQJT8b.js} +1 -1
- package/assets/{useSemanticSearch-BDxoAQSc.js → useSemanticSearch-DEkBjMQk.js} +1 -1
- package/assets/{useSignature-osTmnWZe.js → useSignature-VLETEnXD.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/_mailboxId-ByYUZV2Y.js +0 -1
- package/assets/_messageId-DLU18Mnl.js +0 -1
- package/assets/_messageId-DzC6VHu2.js +0 -1
- package/assets/_messageId-yJtPeY_Z.js +0 -1
- package/assets/_outboxMessageId-AEnONMiY.js +0 -1
- package/assets/_threadId-BdblixoD.js +0 -1
- package/assets/_threadId-CC5eBVBw.js +0 -1
- package/assets/_threadId-Cb8ALPnU.js +0 -1
- package/assets/brief-06HoE0GS.js +0 -1
- package/assets/compose._-_outboxMessageId_-CyN4sUxa.js +0 -1
- package/assets/compose._-_outboxMessageId_-D5_JMiLJ.js +0 -1
- package/assets/compose._-_outboxMessageId_-Db3_5Bzx.js +0 -1
- package/assets/compose._-_outboxMessageId_-YqQysly2.js +0 -1
- package/assets/flagged-DErOl3l4.js +0 -1
- package/assets/index--TsBKY5T.js +0 -1
- package/assets/index-BG1B897N.js +0 -1
- package/assets/index-BIcRfpbR.js +0 -1
- package/assets/index-DLU18Mnl.js +0 -1
- package/assets/index-DX5RhVmh.js +0 -46
- package/assets/index-DqLBbxu3.js +0 -1
- package/assets/index-DwKeNLeB.js +0 -1
- package/assets/index-yJtPeY_Z.js +0 -1
- package/assets/index-zNCEv1vY.js +0 -1
- package/assets/outbox-Dye6uwnb.js +0 -1
- package/assets/settings-D96it8Kf.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as re,j as e,b as z,ao as V,as as oe,r as i,aF as he,aI as A,ap as F,x as xe,aj as X,a5 as fe,an as ye,D as Q,aJ as Y,a1 as ne,B as C,ar as $,am as ge,aq as ve,aE as q,aB as be,I as je}from"./index-idulIG65.js";import{K as Se}from"./kbd-eZWvlfcb.js";import{c as we}from"./account-form-helpers-DhckT_PN.js";import{M as ke}from"./mail-Ba7j-n-X.js";const K=re("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);const Ce=re("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);function Ne({url:t}){return e.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Stored encrypted, used only to connect to your mail server."," ",t?e.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"How to create an app password"}):e.jsx("span",{children:"Check your provider's help for app password instructions."})]})}function Ee({raised:t,className:o,...s}){return e.jsx("div",{className:z("rounded-sm border border-line bg-surface",t?"bg-surface-raised shadow-sm":"",o),...s})}function J({value:t,defaultValue:o,onValueChange:s,...a}){return s?e.jsxs(V,{value:t,onChange:n=>s(n.target.value),...a,children:[e.jsx("option",{value:"tls",children:"TLS/SSL"}),e.jsx("option",{value:"starttls",children:"STARTTLS"}),e.jsx("option",{value:"none",children:"None (insecure)"})]}):e.jsxs(V,{defaultValue:o??t,...a,children:[e.jsx("option",{value:"tls",children:"TLS/SSL"}),e.jsx("option",{value:"starttls",children:"STARTTLS"}),e.jsx("option",{value:"none",children:"None (insecure)"})]})}function G(t){return{tls:t==="tls",startTls:t==="starttls"}}function Te({steps:t,activeStep:o}){return e.jsx("ol",{className:"flex items-center gap-1",children:t.map((s,a)=>{const n=a<o,r=a===o;return e.jsxs("li",{className:"flex items-center gap-1",children:[a>0&&e.jsx("span",{className:"h-px w-5 bg-line","aria-hidden":!0}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:z("flex size-5 items-center justify-center rounded-full text-2xs font-semibold tabular-nums",n&&"bg-accent text-accent-fg",r&&"bg-accent-soft text-accent ring-1 ring-accent",!n&&!r&&"bg-surface-sunken text-fg-subtle"),children:n?e.jsx(oe,{className:"size-3"}):a+1}),e.jsx("span",{className:z("hidden text-2xs sm:inline",r?"font-medium text-fg":"text-fg-subtle"),children:s})]})]},s)})})}function L({steps:t,activeStep:o,title:s,subtitle:a,children:n,footer:r,hideSteps:u}){return e.jsxs("div",{className:"flex min-h-dvh w-full flex-col items-center overflow-y-auto bg-canvas pb-[max(2rem,env(safe-area-inset-bottom,0px))] pl-[max(2rem,env(safe-area-inset-left,0px))] pr-[max(2rem,env(safe-area-inset-right,0px))] pt-[max(2rem,env(safe-area-inset-top,0px))] font-sans text-fg sm:pt-[30vh]",children:[!u&&e.jsx("div",{className:"mb-5 w-full max-w-xl",children:e.jsx(Te,{steps:t,activeStep:o})}),e.jsxs(Ee,{raised:!0,className:"w-full max-w-xl",children:[e.jsxs("div",{className:"px-5 pt-5",children:[e.jsx("h1",{className:"text-xl font-semibold text-fg",children:s}),a&&e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:a})]}),e.jsx("div",{className:"px-5 py-5",children:n}),r&&e.jsx("div",{className:"flex items-center justify-between gap-3 border-t border-line px-5 py-3",children:r})]})]})}const Pe="Coming soon — use IMAP for now.";function W({name:t,description:o,icon:s,comingSoon:a,selected:n,onSelect:r}){const[u,h]=i.useState(!1),c=()=>{if(r){r();return}a&&h(!0)};return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("button",{type:"button",onClick:c,"aria-disabled":a||void 0,className:z("flex flex-col items-start gap-2 rounded-sm border p-3 text-left transition-colors",n?"border-accent-2 bg-accent-2-soft":"border-line bg-surface hover:border-line-strong",a&&"opacity-55"),children:[e.jsx("span",{className:z("text-fg-muted",n&&"text-accent-2"),children:s}),e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold text-fg",children:t}),a&&e.jsx("span",{className:"rounded-full bg-surface-sunken px-1.5 py-0.5 text-2xs text-fg-subtle",children:"soon"})]}),e.jsx("span",{className:"text-xs text-fg-subtle",children:o})]}),u&&e.jsx("p",{className:"text-2xs text-fg-subtle",children:Pe})]})}function Z({legend:t,badge:o,host:s,port:a,security:n,readOnly:r,onHostChange:u,onPortChange:h,onSecurityChange:c,hostPlaceholder:v,portPlaceholder:j}){const S=i.useId(),y=i.useId(),w=i.useId();return e.jsxs("fieldset",{children:[e.jsxs("legend",{className:"flex items-center gap-2 text-sm font-semibold text-fg",children:[t,o&&e.jsx(he,{tone:o.tone,children:o.label})]}),e.jsxs("div",{className:"mt-2 grid grid-cols-1 gap-3 sm:grid-cols-[1fr_6rem_8rem] sm:gap-2",children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:S,children:"Host"}),u?e.jsx(F,{id:S,readOnly:r,value:s,onChange:x=>u(x.target.value),placeholder:v}):e.jsx(F,{id:S,readOnly:r,defaultValue:s,placeholder:v})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:y,children:"Port"}),h?e.jsx(F,{id:y,readOnly:r,value:a,onChange:x=>h(x.target.value),placeholder:j}):e.jsx(F,{id:y,readOnly:r,defaultValue:a,placeholder:j})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:w,children:"Security"}),c?e.jsx(J,{id:w,value:n,onValueChange:c}):e.jsx(J,{id:w,defaultValue:n})]})]})]})}function _({label:t,detail:o,state:s}){return e.jsxs("div",{className:"flex items-start gap-3 py-2",children:[e.jsxs("span",{className:z("mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full text-2xs",s==="ok"&&"bg-positive text-accent-fg",s==="failed"&&"bg-danger text-accent-fg",s==="running"&&"border border-accent text-accent",s==="pending"&&"border border-line text-fg-subtle"),children:[s==="ok"&&e.jsx(oe,{className:"size-3"}),s==="failed"&&"!",s==="running"&&e.jsx("span",{className:"size-2 animate-pulse rounded-full bg-accent"})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:z("text-sm",s==="failed"?"font-medium text-danger":"text-fg"),children:t}),o&&e.jsx("div",{className:"mt-0.5 text-xs text-fg-subtle",children:o})]})]})}const Ie=(t,o)=>{const s=i.useRef(o);s.current=o,i.useEffect(()=>{if(!t)return;const a=()=>{document.visibilityState==="visible"&&s.current()};return document.addEventListener("visibilitychange",a),window.addEventListener("pageshow",a),()=>{document.removeEventListener("visibilitychange",a),window.removeEventListener("pageshow",a)}},[t])},Ae={"gmail.com":{imap:{host:"imap.gmail.com",port:993,security:"tls"},smtp:{host:"smtp.gmail.com",port:587,security:"starttls"},source:"provider-table"},"googlemail.com":{imap:{host:"imap.gmail.com",port:993,security:"tls"},smtp:{host:"smtp.gmail.com",port:587,security:"starttls"},source:"provider-table"},"outlook.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"hotmail.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"live.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"msn.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"icloud.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"me.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"mac.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"fastmail.com":{imap:{host:"imap.fastmail.com",port:993,security:"tls"},smtp:{host:"smtp.fastmail.com",port:465,security:"tls"},source:"provider-table"},"fastmail.fm":{imap:{host:"imap.fastmail.com",port:993,security:"tls"},smtp:{host:"smtp.fastmail.com",port:465,security:"tls"},source:"provider-table"},"yahoo.com":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"yahoo.co.uk":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"ymail.com":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"aol.com":{imap:{host:"imap.aol.com",port:993,security:"tls"},smtp:{host:"smtp.aol.com",port:465,security:"tls"},source:"provider-table"},"zoho.com":{imap:{host:"imap.zoho.com",port:993,security:"tls"},smtp:{host:"smtp.zoho.com",port:465,security:"tls"},source:"provider-table"},"gmx.com":{imap:{host:"imap.gmx.com",port:993,security:"tls"},smtp:{host:"smtp.gmx.com",port:587,security:"starttls"},source:"provider-table"},"gmx.net":{imap:{host:"imap.gmx.net",port:993,security:"tls"},smtp:{host:"mail.gmx.net",port:587,security:"starttls"},source:"provider-table"},"gmx.de":{imap:{host:"imap.gmx.net",port:993,security:"tls"},smtp:{host:"mail.gmx.net",port:587,security:"starttls"},source:"provider-table"},"web.de":{imap:{host:"imap.web.de",port:993,security:"tls"},smtp:{host:"smtp.web.de",port:587,security:"starttls"},source:"provider-table"},"mail.com":{imap:{host:"imap.mail.com",port:993,security:"tls"},smtp:{host:"smtp.mail.com",port:465,security:"tls"},source:"provider-table"},"hey.com":{imap:{host:"imap.hey.com",port:993,security:"tls"},smtp:{host:"smtp.hey.com",port:465,security:"tls"},source:"provider-table"},"tutanota.com":{imap:{host:"mail.tutanota.com",port:993,security:"tls"},smtp:{host:"mail.tutanota.com",port:465,security:"tls"},source:"provider-table"},"tuta.io":{imap:{host:"mail.tutanota.com",port:993,security:"tls"},smtp:{host:"mail.tutanota.com",port:465,security:"tls"},source:"provider-table"},"posteo.de":{imap:{host:"posteo.de",port:993,security:"tls"},smtp:{host:"posteo.de",port:465,security:"tls"},source:"provider-table"},"runbox.com":{imap:{host:"imap.runbox.com",port:993,security:"tls"},smtp:{host:"smtp.runbox.com",port:587,security:"starttls"},source:"provider-table"},"mailbox.org":{imap:{host:"imap.mailbox.org",port:993,security:"tls"},smtp:{host:"smtp.mailbox.org",port:465,security:"tls"},source:"provider-table"},"hushmail.com":{imap:{host:"imap.hushmail.com",port:993,security:"tls"},smtp:{host:"smtp.hushmail.com",port:465,security:"tls"},source:"provider-table"}},Le={"gmail.com":"https://support.google.com/accounts/answer/185833","googlemail.com":"https://support.google.com/accounts/answer/185833","yahoo.com":"https://help.yahoo.com/kb/generate-manage-third-party-passwords-sln15241.html","icloud.com":"https://support.apple.com/en-us/102654","me.com":"https://support.apple.com/en-us/102654","mac.com":"https://support.apple.com/en-us/102654","fastmail.com":"https://www.fastmail.help/hc/en-us/articles/360058752854","fastmail.fm":"https://www.fastmail.help/hc/en-us/articles/360058752854","outlook.com":"https://support.microsoft.com/en-us/account-billing/manage-app-passwords-for-two-step-verification-d6dc8c6d-4bf7-4851-ad95-6d07799387e9","hotmail.com":"https://support.microsoft.com/en-us/account-billing/manage-app-passwords-for-two-step-verification-d6dc8c6d-4bf7-4851-ad95-6d07799387e9","zoho.com":"https://help.zoho.com/portal/en/kb/zoho-mail/client-configuration/imap-access/articles/zoho-mail-app-passwords"};function ae(t){try{const s=new DOMParser().parseFromString(t,"application/xml");if(s.querySelector("parsererror"))return null;const a=s.querySelectorAll("incomingServer[type='imap']"),n=s.querySelectorAll("outgoingServer[type='smtp']");if(!a.length||!n.length)return null;const r=a[0],u=n[0],h=r.querySelector("hostname")?.textContent?.trim(),c=r.querySelector("port")?.textContent?.trim(),v=r.querySelector("socketType")?.textContent?.trim().toUpperCase(),j=u.querySelector("hostname")?.textContent?.trim(),S=u.querySelector("port")?.textContent?.trim(),y=u.querySelector("socketType")?.textContent?.trim().toUpperCase();if(!h||!c||!j||!S)return null;const w=x=>x==="SSL"||x==="TLS"||x==="SSL/TLS"?"tls":x==="STARTTLS"?"starttls":"none";return{imap:{host:h,port:Number.parseInt(c,10),security:w(v)},smtp:{host:j,port:Number.parseInt(S,10),security:w(y)},source:"mozilla-autoconfig"}}catch{return null}}async function Me(t,o){try{const s=`https://autoconfig.thunderbird.net/v1.1/${t}`,a=await fetch(s,{signal:o});if(!a.ok)return null;const n=await a.text(),r=ae(n);return r||null}catch{return null}}async function Fe(t,o){try{const s=`https://autoconfig.${t}/mail/config-v1.1.xml`,a=await fetch(s,{signal:o});if(!a.ok)return null;const n=await a.text(),r=ae(n);return r?{...r,source:"domain-autoconfig"}:null}catch{return null}}function Re(t){return{imap:{host:`imap.${t}`,port:993,security:"tls"},smtp:{host:`smtp.${t}`,port:587,security:"starttls"},source:"heuristic"}}async function Oe(t,o=1500){const s=t.indexOf("@");if(s===-1)return null;const a=t.slice(s+1).toLowerCase();if(!a)return null;const n=Ae[a];if(n)return n;const r=new AbortController,u=setTimeout(()=>r.abort(),o);try{const h=await Me(a,r.signal);if(h)return h;const c=await Fe(a,r.signal);if(c)return c}finally{clearTimeout(u)}return Re(a)}function ze(t){const o=t.indexOf("@");return o===-1?"Looking up server settings…":`Looking up settings for ${t.slice(o+1)}…`}function ie(t){const o=t.indexOf("@");if(o===-1)return;const s=t.slice(o+1).toLowerCase();return Le[s]}const ce=[{id:"icloud",label:"iCloud",username:"full-email",imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},passwordHelp:{text:"iCloud requires an app-specific password, not your Apple ID password. Generate one under Sign-In & Security → App-Specific Passwords.",url:"https://support.apple.com/en-us/102654"}},{id:"yahoo",label:"Yahoo",username:"full-email",imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},passwordHelp:{text:"Yahoo requires an app password, not your login password. Generate one under Account Security.",url:"https://help.yahoo.com/kb/generate-manage-third-party-passwords-sln15241.html"}},{id:"aol",label:"AOL",username:"full-email",imap:{host:"imap.aol.com",port:993,security:"tls"},smtp:{host:"smtp.aol.com",port:465,security:"tls"},passwordHelp:{text:"AOL requires an app password, not your login password. Generate one under Account Security.",url:"https://login.aol.com/account/security"}},{id:"fastmail",label:"Fastmail",username:"full-email",imap:{host:"imap.fastmail.com",port:993,security:"tls"},smtp:{host:"smtp.fastmail.com",port:465,security:"tls"},passwordHelp:{text:"Fastmail requires an app password, not your login password. Create one under Settings → Privacy & Security → App passwords.",url:"https://www.fastmail.help/hc/en-us/articles/360058752854"}}];function ee(t){return ce.find(o=>o.id===t)}const _e={"icloud.com":"icloud","me.com":"icloud","mac.com":"icloud","yahoo.com":"yahoo","yahoo.co.uk":"yahoo","ymail.com":"yahoo","aol.com":"aol","fastmail.com":"fastmail","fastmail.fm":"fastmail"};function He(t){const o=t.indexOf("@");if(o===-1)return"";const s=t.slice(o+1).toLowerCase();return _e[s]??""}const M=["Connector","Address","Servers","Credentials","Test","Sync"],R={connector:0,address:1,servers:2,credentials:3,test:4,sync:5},te={host:"",port:993,security:"tls"},se={host:"",port:587,security:"starttls"};function De({onStart:t}){return i.useEffect(()=>{const o=s=>{s.key==="Enter"&&t()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t]),e.jsx(L,{steps:M,activeStep:0,hideSteps:!0,title:"Welcome to Remit",subtitle:"One inbox for all your mail, with context about every message.",footer:e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-2xs text-fg-subtle",children:[e.jsx(Se,{children:"Enter"})," to continue"]}),e.jsx(C,{variant:"primary",onClick:t,children:"Add your first account"})]}),children:e.jsxs("div",{className:"flex flex-col items-start py-5",children:[e.jsx("span",{className:"flex size-14 items-center justify-center rounded-md bg-accent-soft",children:e.jsx(ke,{className:"size-7 text-accent"})}),e.jsx("p",{className:"mt-5 max-w-sm text-sm leading-relaxed text-fg-muted",children:"Remit syncs your existing mailboxes and tells you who is really writing to you — sender history, authenticity checks, and similar messages, right next to every email."})]})})}function $e({onContinue:t,onMicrosoft:o,onBack:s,showBack:a}){const[n,r]=i.useState("imap");i.useEffect(()=>{const h=c=>{c.key==="Enter"&&(n==="microsoft"?o():t()),c.key==="Escape"&&s()};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[t,o,s,n]);const u=()=>{n==="microsoft"?o():t()};return e.jsx(L,{steps:M,activeStep:R.connector,title:"How does this account connect?",subtitle:"Choose a sign-in method. IMAP works with any provider.",footer:e.jsxs(e.Fragment,{children:[a?e.jsx(C,{variant:"ghost",onClick:s,children:"Back"}):e.jsx("span",{}),e.jsx(C,{variant:"primary",onClick:u,children:n==="microsoft"?"Continue with Microsoft":"Continue with IMAP"})]}),children:e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[e.jsx(W,{name:"IMAP / SMTP",description:"Any mail provider — Fastmail, iCloud, your own server.",icon:e.jsx(Ce,{className:"size-5"}),selected:n==="imap",onSelect:()=>r("imap")}),e.jsx(W,{name:"Gmail",description:"Sign in with Google. No app passwords.",icon:e.jsx(K,{className:"size-5"}),comingSoon:!0}),e.jsx(W,{name:"Outlook / Microsoft 365",description:"Sign in with Microsoft. Works with Outlook.com and work accounts.",icon:e.jsx(je,{className:"size-5"}),selected:n==="microsoft",onSelect:()=>r("microsoft")})]})})}function qe({onBack:t,onConnected:o}){const[s,a]=i.useState(""),[n,r]=i.useState(null),[u,h]=i.useState(!1),[c,v]=i.useState(!1),j=i.useRef(!0);i.useEffect(()=>(j.current=!0,()=>{j.current=!1}),[]);const S=i.useRef(new Set),{refetch:y}=Q(ne()),w=X({...be(),onSuccess:p=>{j.current&&(h(!0),window.location.assign(p.authorizationUrl))},onError:p=>{v(!1),r(p instanceof Error?p.message:"Failed to start sign-in")}});Ie(u,i.useCallback(()=>{v(!1),y().then(({data:p,isError:m})=>{if(!j.current)return;if(m||!p){r("Couldn't check whether the sign-in finished. Open Settings › Accounts to see whether the account is connected.");return}r(null);const N=p.accounts.find(b=>!S.current.has(b.accountId));N&&o(N.accountId)})},[y,o]));const x=c||w.isPending,f=()=>{x||(r(null),v(!0),y().then(({data:p,isError:m})=>{if(j.current){if(m||!p){v(!1),r("Couldn't read this instance's accounts, so sign-in can't be tracked. Check your connection and try again.");return}S.current=new Set(p.accounts.map(N=>N.accountId)),w.mutate({body:{email:s.trim()||void 0}})}}))},l=i.useRef(f);return l.current=f,i.useEffect(()=>{const p=m=>{m.key==="Enter"&&l.current(),m.key==="Escape"&&t()};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[t]),e.jsx(L,{steps:M,activeStep:R.connector,title:"Sign in with Microsoft",subtitle:"You'll be redirected to Microsoft to sign in securely.",footer:e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"ghost",onClick:t,children:"Back"}),e.jsx(C,{variant:"primary",onClick:f,disabled:x,icon:x?e.jsx($,{className:"size-4 animate-spin"}):void 0,children:x?"Redirecting…":u?"Start over":"Sign in with Microsoft"})]}),children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:"microsoft-email",children:"Email address (optional)"}),e.jsx(F,{id:"microsoft-email",icon:e.jsx(K,{className:"size-4"}),placeholder:"you@outlook.com",value:s,onChange:p=>a(p.target.value),type:"email",autoComplete:"email"}),e.jsx("p",{className:"mt-1.5 text-2xs text-fg-subtle",children:"Pre-fills the Microsoft sign-in form. Leave blank to choose on the Microsoft page."})]}),u&&e.jsx(q,{tone:"info",children:"Waiting for Microsoft. Finish signing in — this window carries on the moment the account is connected, wherever you finished."}),n&&e.jsx(q,{tone:"danger",children:n})]})})}function Ge({initialEmail:t,initialDisplayName:o,onContinue:s,onBack:a}){const[n,r]=i.useState(t),[u,h]=i.useState(o),[c,v]=i.useState(!1),[j,S]=i.useState(""),[y,w]=i.useState(null),x=i.useCallback(async()=>{const f=n.trim();if(!f.includes("@")||!f.includes(".")){w("Enter a valid email address.");return}w(null),v(!0),S(ze(f));try{const l=await Oe(f);s(f,u.trim(),l)}finally{v(!1)}},[n,u,s]);return i.useEffect(()=>{const f=l=>{l.key==="Enter"&&!c&&x(),l.key==="Escape"&&a()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[x,c,a]),e.jsx(L,{steps:M,activeStep:R.address,title:"What's the email address?",subtitle:"We'll detect the server settings for you.",footer:e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"ghost",onClick:a,children:"Back"}),e.jsx(C,{variant:"primary",disabled:c,onClick:()=>{x()},children:"Continue"})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:"onboarding-email",children:"Email address"}),e.jsx(F,{id:"onboarding-email",icon:e.jsx(K,{className:"size-4"}),placeholder:"you@example.com",value:n,onChange:f=>{r(f.target.value),w(null)},type:"email",autoComplete:"email"})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"onboarding-display-name",children:"Display name (optional)"}),e.jsx(F,{id:"onboarding-display-name",placeholder:"Alice",value:u,onChange:f=>h(f.target.value)}),e.jsx("p",{className:"mt-1.5 text-2xs text-fg-subtle",children:"What to call this account in Remit. Leave blank to use a name derived from the address."})]}),c&&e.jsxs("div",{className:"mt-3 flex items-center gap-2 text-xs text-fg-muted",children:[e.jsx($,{className:"size-3.5 animate-spin text-accent"}),j]}),y&&!c&&e.jsx("div",{className:"mt-3",children:e.jsx(q,{tone:"danger",children:y})})]})})}function Be({email:t,imapConfig:o,smtpConfig:s,discovered:a,onContinue:n,onBack:r,onChange:u}){const[h,c]=i.useState(o),[v,j]=i.useState(s),[S,y]=i.useState(()=>He(t)),[w,x]=i.useState(!1),[f,l]=i.useState(null),p=ee(S),m=p!==void 0&&!w,N=i.useCallback(g=>{y(g),x(!1),l(null);const d=ee(g);d&&(c({host:d.imap.host,port:d.imap.port,security:d.imap.security}),j({host:d.smtp.host,port:d.smtp.port,security:d.smtp.security}))},[]);i.useEffect(()=>{u(h,v)},[h,v,u]);const b=h.host.trim()!=="",k=i.useCallback(()=>{if(!b){l("Enter the IMAP host.");return}l(null),n()},[b,n]);i.useEffect(()=>{const g=d=>{d.key==="Enter"&&k(),d.key==="Escape"&&r()};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[k,r]);const T=t.split("@")[1]??"your domain",O=p?"Pick your provider to fill in the right settings — or choose Custom to enter them by hand.":a?"Found via autodiscovery — adjust anything that looks off.":`We couldn't detect settings for ${T} — enter them manually.`,P=m?{label:"preset",tone:"neutral"}:!p&&a?{label:"detected",tone:"positive"}:void 0,I=p?.passwordHelp.url??ie(t);return e.jsx(L,{steps:M,activeStep:R.servers,title:"Confirm server settings",subtitle:O,footer:e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"ghost",onClick:r,children:"Back"}),e.jsx(C,{variant:"primary",onClick:k,children:"Continue"})]}),children:e.jsxs("div",{className:"space-y-5",children:[f&&e.jsx(q,{tone:"danger",children:f}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"provider-select",children:"Provider"}),e.jsxs(V,{id:"provider-select",value:S,onChange:g=>N(g.target.value),children:[e.jsx("option",{value:"",children:"Custom / other"}),ce.map(g=>e.jsx("option",{value:g.id,children:g.label},g.id))]}),p&&e.jsx("p",{className:"mt-1 text-2xs text-fg-subtle",children:m?e.jsxs(e.Fragment,{children:["Server settings are pre-filled for ",p.label," and locked."," ",e.jsx("button",{type:"button",className:"text-accent underline",onClick:()=>x(!0),children:"Advanced"})," ","lets you edit them by hand."]}):e.jsxs(e.Fragment,{children:["Editing ",p.label,"'s settings by hand."]})})]}),e.jsx(Z,{legend:"IMAP — incoming",badge:P,readOnly:m,host:h.host,port:String(h.port),security:h.security,hostPlaceholder:"imap.example.com",portPlaceholder:"993",onHostChange:g=>{c(d=>({...d,host:g})),l(null)},onPortChange:g=>c(d=>({...d,port:Number(g)})),onSecurityChange:g=>c(d=>({...d,security:g}))}),e.jsx("p",{className:"text-2xs text-fg-subtle",children:"Sending (SMTP) is optional — leave it blank to set up a receive-only account and add sending later in Settings."}),e.jsx(Z,{legend:"SMTP — outgoing (optional)",badge:P,readOnly:m,host:v.host,port:String(v.port),security:v.security,hostPlaceholder:"smtp.example.com",portPlaceholder:"587",onHostChange:g=>{j(d=>({...d,host:g})),l(null)},onPortChange:g=>j(d=>({...d,port:Number(g)})),onSecurityChange:g=>j(d=>({...d,security:g}))}),p&&e.jsxs("p",{className:"text-2xs text-fg-subtle",children:[p.passwordHelp.text," ",I&&e.jsx("a",{href:I,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"Get an app password"})]})]})})}function Ue({email:t,username:o,password:s,onContinue:a,onBack:n,onChange:r}){const[u,h]=i.useState(o||t),[c,v]=i.useState(s),[j,S]=i.useState(null),y=t.split("@")[1]??"",w=ie(t),x=u.trim()!==""&&c.trim()!=="";i.useEffect(()=>{r(u,c)},[u,c,r]);const f=i.useCallback(()=>{if(!x){S("Enter your username and password.");return}S(null),a()},[x,a]);return i.useEffect(()=>{const l=p=>{p.key==="Enter"&&f(),p.key==="Escape"&&n()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[f,n]),e.jsx(L,{steps:M,activeStep:R.credentials,title:`Sign in to ${y||"your mail server"}`,subtitle:"Many providers require an app password instead of your normal one.",footer:e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"ghost",onClick:n,children:"Back"}),e.jsx(C,{variant:"primary",onClick:f,children:"Test connection"})]}),children:e.jsxs("div",{className:"space-y-3",children:[j&&e.jsx("div",{className:"rounded-md bg-danger-soft px-3 py-2 text-sm text-danger",children:j}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"credentials-username",children:"Username"}),e.jsx(F,{id:"credentials-username",value:u,onChange:l=>{h(l.target.value),S(null)},autoComplete:"username"})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"credentials-password",children:"Password or app password"}),e.jsx(ve,{id:"credentials-password",value:c,onChange:l=>{v(l.target.value),S(null)},autoComplete:"current-password"})]}),e.jsx(Ne,{url:w})]})})}function We({email:t,imapConfig:o,smtpConfig:s,username:a,password:n,onSuccess:r,onBackToCredentials:u,onBackToServers:h}){const[c,v]=i.useState({imapState:"running",smtpState:"pending",phase:"running"}),[j,S]=i.useState(0),y=s.host.trim()!=="",w=G(o.security),x=G(s.security),f=X({...ge()});i.useEffect(()=>{let m=!1;const N=[];return v({imapState:"running",smtpState:"pending",phase:"running"}),f.mutate({body:{username:a,password:n,imapHost:o.host,imapPort:o.port,imapTls:w.tls,imapStartTls:w.startTls,smtpHost:s.host,smtpPort:s.port,smtpTls:x.tls,smtpStartTls:x.startTls}},{onSuccess:b=>{if(m)return;const k=b.imapSuccess,T=y?b.smtpSuccess:!0;v({imapState:k?"ok":"failed",smtpState:y?"running":"ok",imapDetail:k?`Connected — ${o.host}:${o.port}`:b.imapError,phase:"running"}),N.push(window.setTimeout(()=>{if(m)return;const O=I=>{const g=I?.toLowerCase()??"";return g.includes("auth")||g.includes("login")||g.includes("535")||g.includes("credential")},P=!k&&O(b.imapError)||k&&y&&!b.smtpSuccess&&O(b.smtpError);v({imapState:k?"ok":"failed",smtpState:y?b.smtpSuccess?"ok":"failed":"ok",imapDetail:k?`Connected — ${o.host}:${o.port}`:b.imapError,smtpDetail:y?b.smtpSuccess?`Connected — ${s.host}:${s.port}`:b.smtpError:"Not set up — receive-only",rawError:k?y&&!b.smtpSuccess?b.smtpError:void 0:b.imapError,phase:k&&T?"success":P?"auth-failure":"network-failure"}),k&&T&&N.push(window.setTimeout(()=>{m||r()},800))},400))},onError:b=>{if(m)return;const k=b instanceof Error?b.message:"Connection failed";v({imapState:"failed",smtpState:"failed",imapDetail:k,smtpDetail:k,rawError:k,phase:"network-failure"})}}),()=>{m=!0;for(const b of N)window.clearTimeout(b)}},[j]);const{phase:l}=c;i.useEffect(()=>{const m=N=>{N.key==="Escape"&&(l==="auth-failure"?u():l==="network-failure"&&h())};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[l,u,h]);const p=l==="auth-failure"?e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"ghost",onClick:u,children:"Back to credentials"}),e.jsx(C,{variant:"primary",onClick:()=>S(m=>m+1),children:"Retry"})]}):l==="network-failure"?e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"ghost",onClick:h,children:"Back to servers"}),e.jsx(C,{variant:"primary",onClick:()=>S(m=>m+1),children:"Retry"})]}):l==="success"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:"Connection verified"}),e.jsx(C,{variant:"primary",onClick:r,children:"Start syncing"})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:"Testing…"}),e.jsx("span",{})]});return e.jsx(L,{steps:M,activeStep:R.test,title:"Testing the connection",subtitle:`Checking ${t}`,footer:p,children:e.jsxs("div",{className:"divide-y divide-line",children:[e.jsx(_,{label:`IMAP — ${o.host}:${o.port}`,detail:c.imapDetail,state:c.imapState}),e.jsx(_,{label:y?`SMTP — ${s.host}:${s.port}`:"SMTP — sending",detail:y?c.smtpDetail:"Not set up — you can add sending later in Settings",state:c.smtpState}),(l==="auth-failure"||l==="network-failure")&&c.rawError&&e.jsxs("div",{className:"py-3",children:[l==="auth-failure"&&e.jsx("p",{className:"mb-2 text-xs text-fg-muted",children:"Check your password — many providers require an app password."}),e.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:c.rawError})]})]})})}const Ve=2e4;function Qe({email:t,displayName:o,imapConfig:s,smtpConfig:a,username:n,password:r,onGoToInbox:u}){const h=xe(),[c,v]=i.useState(null),[j,S]=i.useState(null),y=i.useRef(!1),w=G(s.security),x=G(a.security),f=X({...ye(),onSuccess:E=>{v(E.accountId),h.invalidateQueries({queryKey:fe()})},onError:E=>{S(E instanceof Error?E.message:"Failed to create account")}});i.useEffect(()=>{if(y.current)return;y.current=!0;const E=a.host.trim()!=="",H=we({imapHost:s.host,smtpHost:a.host,smtpPort:a.port}),D=E?H??{smtpHost:a.host,smtpPort:a.port,smtpTls:x.tls,smtpStartTls:x.startTls}:null;f.mutate({body:{email:t,displayName:o||void 0,username:n!==t?n:void 0,password:r,imapHost:s.host,imapPort:s.port,imapTls:w.tls,imapStartTls:w.startTls,smtpHost:D?.smtpHost||void 0,smtpPort:D?.smtpPort||void 0,smtpTls:D?.smtpTls??!1,smtpStartTls:D?.smtpStartTls??!1}})},[]);const{data:l,isError:p}=Q({...Y({path:{accountId:c??""}}),enabled:!!c,refetchInterval:E=>{const H=E.state.data?.syncPhase;return H==="complete"||H==="error"?!1:2e3}}),m=l?.syncPhase==="error",{data:N}=Q({...ne(),enabled:!!c&&m}),b=N?.accounts.find(E=>E.accountId===c)?.lastError,k=l?.mailboxes.find(E=>E.fullPath==="INBOX"||E.fullPath==="Inbox"),T=l?.mailboxCountTotal??0,O=l?.mailboxCountSynced??0,P=k?.messagesTotal??0,I=k?.messagesSynced??0,g=P>0?I/P:0,d=l?.syncPhase,le=m?"failed":d==="idle"||d===void 0||d==="discovering_mailboxes"?"running":T>0?"ok":"running",B=m?"failed":!d||d==="idle"||d==="discovering_mailboxes"?"pending":d==="syncing_inbox"||d==="syncing_others"?"running":"ok",U=m?"failed":!d||d==="idle"||d==="discovering_mailboxes"||d==="syncing_inbox"?"pending":d==="syncing_others"?"running":"ok",me=I>0||k?.phase==="complete"||d==="complete"||m,[ue,de]=i.useState(!1);i.useEffect(()=>{if(!c)return;const E=setTimeout(()=>de(!0),Ve);return()=>clearTimeout(E)},[c]);const pe=!!c&&(me||p||ue);return j?e.jsx(L,{steps:M,activeStep:R.sync,title:"Couldn't create account",subtitle:"Something went wrong saving your account.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{}),e.jsx(C,{variant:"primary",onClick:()=>{y.current=!1,S(null),f.mutate({body:{email:t,displayName:o||void 0,username:n!==t?n:void 0,password:r,imapHost:s.host,imapPort:s.port,imapTls:w.tls,imapStartTls:w.startTls,smtpHost:a.host||void 0,smtpPort:a.port||void 0,smtpTls:x.tls,smtpStartTls:x.startTls}})},children:"Retry"})]}),children:e.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:j})}):e.jsx(L,{steps:M,activeStep:R.sync,title:`Syncing ${t}`,subtitle:"Newest mail first — you can start reading right away.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:"Sync continues in the background"}),pe?e.jsx(C,{variant:"primary",onClick:()=>c&&u(c),children:"Go to inbox"}):e.jsx(C,{variant:"primary",disabled:!0,icon:e.jsx($,{className:"size-3.5 animate-spin"}),children:"Getting your mail…"})]}),children:f.isPending?e.jsxs("div",{className:"flex items-center gap-2 py-4 text-sm text-fg-muted",children:[e.jsx($,{className:"size-4 animate-spin text-accent"}),"Creating your account…"]}):e.jsxs("div",{className:"space-y-3",children:[P>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-baseline justify-between text-xs",children:[e.jsx("span",{className:"font-medium text-fg",children:"INBOX"}),e.jsxs("span",{className:"text-fg-subtle tabular-nums",children:[I.toLocaleString()," / ",P.toLocaleString()," ","messages"]})]}),e.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-surface-sunken",children:e.jsx("div",{className:"h-full rounded-full bg-accent transition-all duration-500",style:{width:`${Math.max(2,g*100)}%`}})})]}),e.jsxs("div",{className:"divide-y divide-line",children:[e.jsx(_,{label:"Mailboxes discovered",detail:T>0?`${T} mailbox${T===1?"":"es"} found`:"Discovering…",state:le}),e.jsx(_,{label:"INBOX",detail:B==="ok"?`${I.toLocaleString()} messages synced`:B==="running"?"Syncing newest first…":"Queued",state:B}),O>1||d==="syncing_others"||d==="complete"?e.jsx(_,{label:"Other mailboxes",detail:U==="ok"?`${O-1} mailboxes synced`:U==="running"?"Syncing…":"Queued",state:U}):null]}),m&&e.jsxs("div",{className:"mt-2 space-y-2",children:[e.jsxs("p",{className:"text-xs text-danger",children:["Sync stalled. The account is still active —"," ",e.jsx("button",{type:"button",className:"underline",onClick:()=>{h.invalidateQueries({queryKey:Y({path:{accountId:c??""}}).queryKey})},children:"retry"})]}),b&&e.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:b})]})]})})}function Ze({skipWelcome:t=!1,onComplete:o,onCancel:s}){const[a,n]=i.useState(t?"connector":"welcome"),[r,u]=i.useState({email:"",displayName:"",imapConfig:te,smtpConfig:se,username:"",password:"",discoveryResult:null,discovered:!1,createdAccountId:null}),h=i.useCallback(()=>n("connector"),[]),c=i.useCallback(()=>n("address"),[]),v=i.useCallback(()=>n("microsoft-email"),[]),j=i.useCallback(()=>{t?s?.():n("welcome")},[t,s]),S=i.useCallback((l,p,m)=>{let N=te,b=se,k=!1;m&&(k=m.source!=="heuristic",N={host:m.imap.host,port:m.imap.port,security:m.imap.security},b={host:m.smtp.host,port:m.smtp.port,security:m.smtp.security}),u(T=>({...T,email:l,displayName:p,imapConfig:N,smtpConfig:b,discoveryResult:m,discovered:k,username:l})),n("servers")},[]),y=i.useCallback((l,p)=>{u(m=>({...m,imapConfig:l,smtpConfig:p}))},[]),w=i.useCallback((l,p)=>{u(m=>({...m,username:l,password:p}))},[]),x=i.useCallback(()=>n("sync"),[]),f=i.useCallback(l=>{o(l)},[o]);switch(a){case"welcome":return e.jsx(De,{onStart:h});case"connector":return e.jsx($e,{onContinue:c,onMicrosoft:v,onBack:j,showBack:!t});case"microsoft-email":return e.jsx(qe,{onBack:()=>n("connector"),onConnected:f});case"address":return e.jsx(Ge,{initialEmail:r.email,initialDisplayName:r.displayName,onContinue:S,onBack:()=>n("connector")});case"servers":return e.jsx(Be,{email:r.email,imapConfig:r.imapConfig,smtpConfig:r.smtpConfig,discovered:r.discovered,onContinue:()=>n("credentials"),onBack:()=>n("address"),onChange:y});case"credentials":return e.jsx(Ue,{email:r.email,username:r.username,password:r.password,onContinue:()=>n("test"),onBack:()=>n("servers"),onChange:w});case"test":return e.jsx(We,{email:r.email,imapConfig:r.imapConfig,smtpConfig:r.smtpConfig,username:r.username,password:r.password,onSuccess:x,onBackToCredentials:()=>n("credentials"),onBackToServers:()=>n("servers")});case"sync":return e.jsx(Qe,{email:r.email,displayName:r.displayName,imapConfig:r.imapConfig,smtpConfig:r.smtpConfig,username:r.username,password:r.password,onGoToInbox:f})}}export{Ze as O,ce as P,ee as g,G as s,Ie as u};
|
|
1
|
+
import{c as re,j as e,b as z,ao as V,as as oe,r as i,aF as he,aI as A,ap as F,x as xe,aj as X,a5 as fe,an as ye,D as Q,aJ as Y,a1 as ne,B as C,ar as $,am as ge,aq as ve,aE as q,aB as be,I as je}from"./index-CKkjA-cG.js";import{K as Se}from"./kbd-ZFs3oMUy.js";import{c as we}from"./account-form-helpers-DhckT_PN.js";import{M as ke}from"./mail-Dr2jAfYM.js";const K=re("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);const Ce=re("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);function Ne({url:t}){return e.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Stored encrypted, used only to connect to your mail server."," ",t?e.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"How to create an app password"}):e.jsx("span",{children:"Check your provider's help for app password instructions."})]})}function Ee({raised:t,className:o,...s}){return e.jsx("div",{className:z("rounded-sm border border-line bg-surface",t?"bg-surface-raised shadow-sm":"",o),...s})}function J({value:t,defaultValue:o,onValueChange:s,...a}){return s?e.jsxs(V,{value:t,onChange:n=>s(n.target.value),...a,children:[e.jsx("option",{value:"tls",children:"TLS/SSL"}),e.jsx("option",{value:"starttls",children:"STARTTLS"}),e.jsx("option",{value:"none",children:"None (insecure)"})]}):e.jsxs(V,{defaultValue:o??t,...a,children:[e.jsx("option",{value:"tls",children:"TLS/SSL"}),e.jsx("option",{value:"starttls",children:"STARTTLS"}),e.jsx("option",{value:"none",children:"None (insecure)"})]})}function G(t){return{tls:t==="tls",startTls:t==="starttls"}}function Te({steps:t,activeStep:o}){return e.jsx("ol",{className:"flex items-center gap-1",children:t.map((s,a)=>{const n=a<o,r=a===o;return e.jsxs("li",{className:"flex items-center gap-1",children:[a>0&&e.jsx("span",{className:"h-px w-5 bg-line","aria-hidden":!0}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:z("flex size-5 items-center justify-center rounded-full text-2xs font-semibold tabular-nums",n&&"bg-accent text-accent-fg",r&&"bg-accent-soft text-accent ring-1 ring-accent",!n&&!r&&"bg-surface-sunken text-fg-subtle"),children:n?e.jsx(oe,{className:"size-3"}):a+1}),e.jsx("span",{className:z("hidden text-2xs sm:inline",r?"font-medium text-fg":"text-fg-subtle"),children:s})]})]},s)})})}function L({steps:t,activeStep:o,title:s,subtitle:a,children:n,footer:r,hideSteps:u}){return e.jsxs("div",{className:"flex min-h-dvh w-full flex-col items-center overflow-y-auto bg-canvas pb-[max(2rem,env(safe-area-inset-bottom,0px))] pl-[max(2rem,env(safe-area-inset-left,0px))] pr-[max(2rem,env(safe-area-inset-right,0px))] pt-[max(2rem,env(safe-area-inset-top,0px))] font-sans text-fg sm:pt-[30vh]",children:[!u&&e.jsx("div",{className:"mb-5 w-full max-w-xl",children:e.jsx(Te,{steps:t,activeStep:o})}),e.jsxs(Ee,{raised:!0,className:"w-full max-w-xl",children:[e.jsxs("div",{className:"px-5 pt-5",children:[e.jsx("h1",{className:"text-xl font-semibold text-fg",children:s}),a&&e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:a})]}),e.jsx("div",{className:"px-5 py-5",children:n}),r&&e.jsx("div",{className:"flex items-center justify-between gap-3 border-t border-line px-5 py-3",children:r})]})]})}const Pe="Coming soon — use IMAP for now.";function W({name:t,description:o,icon:s,comingSoon:a,selected:n,onSelect:r}){const[u,h]=i.useState(!1),c=()=>{if(r){r();return}a&&h(!0)};return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("button",{type:"button",onClick:c,"aria-disabled":a||void 0,className:z("flex flex-col items-start gap-2 rounded-sm border p-3 text-left transition-colors",n?"border-accent-2 bg-accent-2-soft":"border-line bg-surface hover:border-line-strong",a&&"opacity-55"),children:[e.jsx("span",{className:z("text-fg-muted",n&&"text-accent-2"),children:s}),e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold text-fg",children:t}),a&&e.jsx("span",{className:"rounded-full bg-surface-sunken px-1.5 py-0.5 text-2xs text-fg-subtle",children:"soon"})]}),e.jsx("span",{className:"text-xs text-fg-subtle",children:o})]}),u&&e.jsx("p",{className:"text-2xs text-fg-subtle",children:Pe})]})}function Z({legend:t,badge:o,host:s,port:a,security:n,readOnly:r,onHostChange:u,onPortChange:h,onSecurityChange:c,hostPlaceholder:v,portPlaceholder:j}){const S=i.useId(),y=i.useId(),w=i.useId();return e.jsxs("fieldset",{children:[e.jsxs("legend",{className:"flex items-center gap-2 text-sm font-semibold text-fg",children:[t,o&&e.jsx(he,{tone:o.tone,children:o.label})]}),e.jsxs("div",{className:"mt-2 grid grid-cols-1 gap-3 sm:grid-cols-[1fr_6rem_8rem] sm:gap-2",children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:S,children:"Host"}),u?e.jsx(F,{id:S,readOnly:r,value:s,onChange:x=>u(x.target.value),placeholder:v}):e.jsx(F,{id:S,readOnly:r,defaultValue:s,placeholder:v})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:y,children:"Port"}),h?e.jsx(F,{id:y,readOnly:r,value:a,onChange:x=>h(x.target.value),placeholder:j}):e.jsx(F,{id:y,readOnly:r,defaultValue:a,placeholder:j})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:w,children:"Security"}),c?e.jsx(J,{id:w,value:n,onValueChange:c}):e.jsx(J,{id:w,defaultValue:n})]})]})]})}function _({label:t,detail:o,state:s}){return e.jsxs("div",{className:"flex items-start gap-3 py-2",children:[e.jsxs("span",{className:z("mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full text-2xs",s==="ok"&&"bg-positive text-accent-fg",s==="failed"&&"bg-danger text-accent-fg",s==="running"&&"border border-accent text-accent",s==="pending"&&"border border-line text-fg-subtle"),children:[s==="ok"&&e.jsx(oe,{className:"size-3"}),s==="failed"&&"!",s==="running"&&e.jsx("span",{className:"size-2 animate-pulse rounded-full bg-accent"})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:z("text-sm",s==="failed"?"font-medium text-danger":"text-fg"),children:t}),o&&e.jsx("div",{className:"mt-0.5 text-xs text-fg-subtle",children:o})]})]})}const Ie=(t,o)=>{const s=i.useRef(o);s.current=o,i.useEffect(()=>{if(!t)return;const a=()=>{document.visibilityState==="visible"&&s.current()};return document.addEventListener("visibilitychange",a),window.addEventListener("pageshow",a),()=>{document.removeEventListener("visibilitychange",a),window.removeEventListener("pageshow",a)}},[t])},Ae={"gmail.com":{imap:{host:"imap.gmail.com",port:993,security:"tls"},smtp:{host:"smtp.gmail.com",port:587,security:"starttls"},source:"provider-table"},"googlemail.com":{imap:{host:"imap.gmail.com",port:993,security:"tls"},smtp:{host:"smtp.gmail.com",port:587,security:"starttls"},source:"provider-table"},"outlook.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"hotmail.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"live.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"msn.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"icloud.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"me.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"mac.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"fastmail.com":{imap:{host:"imap.fastmail.com",port:993,security:"tls"},smtp:{host:"smtp.fastmail.com",port:465,security:"tls"},source:"provider-table"},"fastmail.fm":{imap:{host:"imap.fastmail.com",port:993,security:"tls"},smtp:{host:"smtp.fastmail.com",port:465,security:"tls"},source:"provider-table"},"yahoo.com":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"yahoo.co.uk":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"ymail.com":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"aol.com":{imap:{host:"imap.aol.com",port:993,security:"tls"},smtp:{host:"smtp.aol.com",port:465,security:"tls"},source:"provider-table"},"zoho.com":{imap:{host:"imap.zoho.com",port:993,security:"tls"},smtp:{host:"smtp.zoho.com",port:465,security:"tls"},source:"provider-table"},"gmx.com":{imap:{host:"imap.gmx.com",port:993,security:"tls"},smtp:{host:"smtp.gmx.com",port:587,security:"starttls"},source:"provider-table"},"gmx.net":{imap:{host:"imap.gmx.net",port:993,security:"tls"},smtp:{host:"mail.gmx.net",port:587,security:"starttls"},source:"provider-table"},"gmx.de":{imap:{host:"imap.gmx.net",port:993,security:"tls"},smtp:{host:"mail.gmx.net",port:587,security:"starttls"},source:"provider-table"},"web.de":{imap:{host:"imap.web.de",port:993,security:"tls"},smtp:{host:"smtp.web.de",port:587,security:"starttls"},source:"provider-table"},"mail.com":{imap:{host:"imap.mail.com",port:993,security:"tls"},smtp:{host:"smtp.mail.com",port:465,security:"tls"},source:"provider-table"},"hey.com":{imap:{host:"imap.hey.com",port:993,security:"tls"},smtp:{host:"smtp.hey.com",port:465,security:"tls"},source:"provider-table"},"tutanota.com":{imap:{host:"mail.tutanota.com",port:993,security:"tls"},smtp:{host:"mail.tutanota.com",port:465,security:"tls"},source:"provider-table"},"tuta.io":{imap:{host:"mail.tutanota.com",port:993,security:"tls"},smtp:{host:"mail.tutanota.com",port:465,security:"tls"},source:"provider-table"},"posteo.de":{imap:{host:"posteo.de",port:993,security:"tls"},smtp:{host:"posteo.de",port:465,security:"tls"},source:"provider-table"},"runbox.com":{imap:{host:"imap.runbox.com",port:993,security:"tls"},smtp:{host:"smtp.runbox.com",port:587,security:"starttls"},source:"provider-table"},"mailbox.org":{imap:{host:"imap.mailbox.org",port:993,security:"tls"},smtp:{host:"smtp.mailbox.org",port:465,security:"tls"},source:"provider-table"},"hushmail.com":{imap:{host:"imap.hushmail.com",port:993,security:"tls"},smtp:{host:"smtp.hushmail.com",port:465,security:"tls"},source:"provider-table"}},Le={"gmail.com":"https://support.google.com/accounts/answer/185833","googlemail.com":"https://support.google.com/accounts/answer/185833","yahoo.com":"https://help.yahoo.com/kb/generate-manage-third-party-passwords-sln15241.html","icloud.com":"https://support.apple.com/en-us/102654","me.com":"https://support.apple.com/en-us/102654","mac.com":"https://support.apple.com/en-us/102654","fastmail.com":"https://www.fastmail.help/hc/en-us/articles/360058752854","fastmail.fm":"https://www.fastmail.help/hc/en-us/articles/360058752854","outlook.com":"https://support.microsoft.com/en-us/account-billing/manage-app-passwords-for-two-step-verification-d6dc8c6d-4bf7-4851-ad95-6d07799387e9","hotmail.com":"https://support.microsoft.com/en-us/account-billing/manage-app-passwords-for-two-step-verification-d6dc8c6d-4bf7-4851-ad95-6d07799387e9","zoho.com":"https://help.zoho.com/portal/en/kb/zoho-mail/client-configuration/imap-access/articles/zoho-mail-app-passwords"};function ae(t){try{const s=new DOMParser().parseFromString(t,"application/xml");if(s.querySelector("parsererror"))return null;const a=s.querySelectorAll("incomingServer[type='imap']"),n=s.querySelectorAll("outgoingServer[type='smtp']");if(!a.length||!n.length)return null;const r=a[0],u=n[0],h=r.querySelector("hostname")?.textContent?.trim(),c=r.querySelector("port")?.textContent?.trim(),v=r.querySelector("socketType")?.textContent?.trim().toUpperCase(),j=u.querySelector("hostname")?.textContent?.trim(),S=u.querySelector("port")?.textContent?.trim(),y=u.querySelector("socketType")?.textContent?.trim().toUpperCase();if(!h||!c||!j||!S)return null;const w=x=>x==="SSL"||x==="TLS"||x==="SSL/TLS"?"tls":x==="STARTTLS"?"starttls":"none";return{imap:{host:h,port:Number.parseInt(c,10),security:w(v)},smtp:{host:j,port:Number.parseInt(S,10),security:w(y)},source:"mozilla-autoconfig"}}catch{return null}}async function Me(t,o){try{const s=`https://autoconfig.thunderbird.net/v1.1/${t}`,a=await fetch(s,{signal:o});if(!a.ok)return null;const n=await a.text(),r=ae(n);return r||null}catch{return null}}async function Fe(t,o){try{const s=`https://autoconfig.${t}/mail/config-v1.1.xml`,a=await fetch(s,{signal:o});if(!a.ok)return null;const n=await a.text(),r=ae(n);return r?{...r,source:"domain-autoconfig"}:null}catch{return null}}function Re(t){return{imap:{host:`imap.${t}`,port:993,security:"tls"},smtp:{host:`smtp.${t}`,port:587,security:"starttls"},source:"heuristic"}}async function Oe(t,o=1500){const s=t.indexOf("@");if(s===-1)return null;const a=t.slice(s+1).toLowerCase();if(!a)return null;const n=Ae[a];if(n)return n;const r=new AbortController,u=setTimeout(()=>r.abort(),o);try{const h=await Me(a,r.signal);if(h)return h;const c=await Fe(a,r.signal);if(c)return c}finally{clearTimeout(u)}return Re(a)}function ze(t){const o=t.indexOf("@");return o===-1?"Looking up server settings…":`Looking up settings for ${t.slice(o+1)}…`}function ie(t){const o=t.indexOf("@");if(o===-1)return;const s=t.slice(o+1).toLowerCase();return Le[s]}const ce=[{id:"icloud",label:"iCloud",username:"full-email",imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},passwordHelp:{text:"iCloud requires an app-specific password, not your Apple ID password. Generate one under Sign-In & Security → App-Specific Passwords.",url:"https://support.apple.com/en-us/102654"}},{id:"yahoo",label:"Yahoo",username:"full-email",imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},passwordHelp:{text:"Yahoo requires an app password, not your login password. Generate one under Account Security.",url:"https://help.yahoo.com/kb/generate-manage-third-party-passwords-sln15241.html"}},{id:"aol",label:"AOL",username:"full-email",imap:{host:"imap.aol.com",port:993,security:"tls"},smtp:{host:"smtp.aol.com",port:465,security:"tls"},passwordHelp:{text:"AOL requires an app password, not your login password. Generate one under Account Security.",url:"https://login.aol.com/account/security"}},{id:"fastmail",label:"Fastmail",username:"full-email",imap:{host:"imap.fastmail.com",port:993,security:"tls"},smtp:{host:"smtp.fastmail.com",port:465,security:"tls"},passwordHelp:{text:"Fastmail requires an app password, not your login password. Create one under Settings → Privacy & Security → App passwords.",url:"https://www.fastmail.help/hc/en-us/articles/360058752854"}}];function ee(t){return ce.find(o=>o.id===t)}const _e={"icloud.com":"icloud","me.com":"icloud","mac.com":"icloud","yahoo.com":"yahoo","yahoo.co.uk":"yahoo","ymail.com":"yahoo","aol.com":"aol","fastmail.com":"fastmail","fastmail.fm":"fastmail"};function He(t){const o=t.indexOf("@");if(o===-1)return"";const s=t.slice(o+1).toLowerCase();return _e[s]??""}const M=["Connector","Address","Servers","Credentials","Test","Sync"],R={connector:0,address:1,servers:2,credentials:3,test:4,sync:5},te={host:"",port:993,security:"tls"},se={host:"",port:587,security:"starttls"};function De({onStart:t}){return i.useEffect(()=>{const o=s=>{s.key==="Enter"&&t()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t]),e.jsx(L,{steps:M,activeStep:0,hideSteps:!0,title:"Welcome to Remit",subtitle:"One inbox for all your mail, with context about every message.",footer:e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-2xs text-fg-subtle",children:[e.jsx(Se,{children:"Enter"})," to continue"]}),e.jsx(C,{variant:"primary",onClick:t,children:"Add your first account"})]}),children:e.jsxs("div",{className:"flex flex-col items-start py-5",children:[e.jsx("span",{className:"flex size-14 items-center justify-center rounded-md bg-accent-soft",children:e.jsx(ke,{className:"size-7 text-accent"})}),e.jsx("p",{className:"mt-5 max-w-sm text-sm leading-relaxed text-fg-muted",children:"Remit syncs your existing mailboxes and tells you who is really writing to you — sender history, authenticity checks, and similar messages, right next to every email."})]})})}function $e({onContinue:t,onMicrosoft:o,onBack:s,showBack:a}){const[n,r]=i.useState("imap");i.useEffect(()=>{const h=c=>{c.key==="Enter"&&(n==="microsoft"?o():t()),c.key==="Escape"&&s()};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[t,o,s,n]);const u=()=>{n==="microsoft"?o():t()};return e.jsx(L,{steps:M,activeStep:R.connector,title:"How does this account connect?",subtitle:"Choose a sign-in method. IMAP works with any provider.",footer:e.jsxs(e.Fragment,{children:[a?e.jsx(C,{variant:"ghost",onClick:s,children:"Back"}):e.jsx("span",{}),e.jsx(C,{variant:"primary",onClick:u,children:n==="microsoft"?"Continue with Microsoft":"Continue with IMAP"})]}),children:e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[e.jsx(W,{name:"IMAP / SMTP",description:"Any mail provider — Fastmail, iCloud, your own server.",icon:e.jsx(Ce,{className:"size-5"}),selected:n==="imap",onSelect:()=>r("imap")}),e.jsx(W,{name:"Gmail",description:"Sign in with Google. No app passwords.",icon:e.jsx(K,{className:"size-5"}),comingSoon:!0}),e.jsx(W,{name:"Outlook / Microsoft 365",description:"Sign in with Microsoft. Works with Outlook.com and work accounts.",icon:e.jsx(je,{className:"size-5"}),selected:n==="microsoft",onSelect:()=>r("microsoft")})]})})}function qe({onBack:t,onConnected:o}){const[s,a]=i.useState(""),[n,r]=i.useState(null),[u,h]=i.useState(!1),[c,v]=i.useState(!1),j=i.useRef(!0);i.useEffect(()=>(j.current=!0,()=>{j.current=!1}),[]);const S=i.useRef(new Set),{refetch:y}=Q(ne()),w=X({...be(),onSuccess:p=>{j.current&&(h(!0),window.location.assign(p.authorizationUrl))},onError:p=>{v(!1),r(p instanceof Error?p.message:"Failed to start sign-in")}});Ie(u,i.useCallback(()=>{v(!1),y().then(({data:p,isError:m})=>{if(!j.current)return;if(m||!p){r("Couldn't check whether the sign-in finished. Open Settings › Accounts to see whether the account is connected.");return}r(null);const N=p.accounts.find(b=>!S.current.has(b.accountId));N&&o(N.accountId)})},[y,o]));const x=c||w.isPending,f=()=>{x||(r(null),v(!0),y().then(({data:p,isError:m})=>{if(j.current){if(m||!p){v(!1),r("Couldn't read this instance's accounts, so sign-in can't be tracked. Check your connection and try again.");return}S.current=new Set(p.accounts.map(N=>N.accountId)),w.mutate({body:{email:s.trim()||void 0}})}}))},l=i.useRef(f);return l.current=f,i.useEffect(()=>{const p=m=>{m.key==="Enter"&&l.current(),m.key==="Escape"&&t()};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[t]),e.jsx(L,{steps:M,activeStep:R.connector,title:"Sign in with Microsoft",subtitle:"You'll be redirected to Microsoft to sign in securely.",footer:e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"ghost",onClick:t,children:"Back"}),e.jsx(C,{variant:"primary",onClick:f,disabled:x,icon:x?e.jsx($,{className:"size-4 animate-spin"}):void 0,children:x?"Redirecting…":u?"Start over":"Sign in with Microsoft"})]}),children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:"microsoft-email",children:"Email address (optional)"}),e.jsx(F,{id:"microsoft-email",icon:e.jsx(K,{className:"size-4"}),placeholder:"you@outlook.com",value:s,onChange:p=>a(p.target.value),type:"email",autoComplete:"email"}),e.jsx("p",{className:"mt-1.5 text-2xs text-fg-subtle",children:"Pre-fills the Microsoft sign-in form. Leave blank to choose on the Microsoft page."})]}),u&&e.jsx(q,{tone:"info",children:"Waiting for Microsoft. Finish signing in — this window carries on the moment the account is connected, wherever you finished."}),n&&e.jsx(q,{tone:"danger",children:n})]})})}function Ge({initialEmail:t,initialDisplayName:o,onContinue:s,onBack:a}){const[n,r]=i.useState(t),[u,h]=i.useState(o),[c,v]=i.useState(!1),[j,S]=i.useState(""),[y,w]=i.useState(null),x=i.useCallback(async()=>{const f=n.trim();if(!f.includes("@")||!f.includes(".")){w("Enter a valid email address.");return}w(null),v(!0),S(ze(f));try{const l=await Oe(f);s(f,u.trim(),l)}finally{v(!1)}},[n,u,s]);return i.useEffect(()=>{const f=l=>{l.key==="Enter"&&!c&&x(),l.key==="Escape"&&a()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[x,c,a]),e.jsx(L,{steps:M,activeStep:R.address,title:"What's the email address?",subtitle:"We'll detect the server settings for you.",footer:e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"ghost",onClick:a,children:"Back"}),e.jsx(C,{variant:"primary",disabled:c,onClick:()=>{x()},children:"Continue"})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:"onboarding-email",children:"Email address"}),e.jsx(F,{id:"onboarding-email",icon:e.jsx(K,{className:"size-4"}),placeholder:"you@example.com",value:n,onChange:f=>{r(f.target.value),w(null)},type:"email",autoComplete:"email"})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"onboarding-display-name",children:"Display name (optional)"}),e.jsx(F,{id:"onboarding-display-name",placeholder:"Alice",value:u,onChange:f=>h(f.target.value)}),e.jsx("p",{className:"mt-1.5 text-2xs text-fg-subtle",children:"What to call this account in Remit. Leave blank to use a name derived from the address."})]}),c&&e.jsxs("div",{className:"mt-3 flex items-center gap-2 text-xs text-fg-muted",children:[e.jsx($,{className:"size-3.5 animate-spin text-accent"}),j]}),y&&!c&&e.jsx("div",{className:"mt-3",children:e.jsx(q,{tone:"danger",children:y})})]})})}function Be({email:t,imapConfig:o,smtpConfig:s,discovered:a,onContinue:n,onBack:r,onChange:u}){const[h,c]=i.useState(o),[v,j]=i.useState(s),[S,y]=i.useState(()=>He(t)),[w,x]=i.useState(!1),[f,l]=i.useState(null),p=ee(S),m=p!==void 0&&!w,N=i.useCallback(g=>{y(g),x(!1),l(null);const d=ee(g);d&&(c({host:d.imap.host,port:d.imap.port,security:d.imap.security}),j({host:d.smtp.host,port:d.smtp.port,security:d.smtp.security}))},[]);i.useEffect(()=>{u(h,v)},[h,v,u]);const b=h.host.trim()!=="",k=i.useCallback(()=>{if(!b){l("Enter the IMAP host.");return}l(null),n()},[b,n]);i.useEffect(()=>{const g=d=>{d.key==="Enter"&&k(),d.key==="Escape"&&r()};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[k,r]);const T=t.split("@")[1]??"your domain",O=p?"Pick your provider to fill in the right settings — or choose Custom to enter them by hand.":a?"Found via autodiscovery — adjust anything that looks off.":`We couldn't detect settings for ${T} — enter them manually.`,P=m?{label:"preset",tone:"neutral"}:!p&&a?{label:"detected",tone:"positive"}:void 0,I=p?.passwordHelp.url??ie(t);return e.jsx(L,{steps:M,activeStep:R.servers,title:"Confirm server settings",subtitle:O,footer:e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"ghost",onClick:r,children:"Back"}),e.jsx(C,{variant:"primary",onClick:k,children:"Continue"})]}),children:e.jsxs("div",{className:"space-y-5",children:[f&&e.jsx(q,{tone:"danger",children:f}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"provider-select",children:"Provider"}),e.jsxs(V,{id:"provider-select",value:S,onChange:g=>N(g.target.value),children:[e.jsx("option",{value:"",children:"Custom / other"}),ce.map(g=>e.jsx("option",{value:g.id,children:g.label},g.id))]}),p&&e.jsx("p",{className:"mt-1 text-2xs text-fg-subtle",children:m?e.jsxs(e.Fragment,{children:["Server settings are pre-filled for ",p.label," and locked."," ",e.jsx("button",{type:"button",className:"text-accent underline",onClick:()=>x(!0),children:"Advanced"})," ","lets you edit them by hand."]}):e.jsxs(e.Fragment,{children:["Editing ",p.label,"'s settings by hand."]})})]}),e.jsx(Z,{legend:"IMAP — incoming",badge:P,readOnly:m,host:h.host,port:String(h.port),security:h.security,hostPlaceholder:"imap.example.com",portPlaceholder:"993",onHostChange:g=>{c(d=>({...d,host:g})),l(null)},onPortChange:g=>c(d=>({...d,port:Number(g)})),onSecurityChange:g=>c(d=>({...d,security:g}))}),e.jsx("p",{className:"text-2xs text-fg-subtle",children:"Sending (SMTP) is optional — leave it blank to set up a receive-only account and add sending later in Settings."}),e.jsx(Z,{legend:"SMTP — outgoing (optional)",badge:P,readOnly:m,host:v.host,port:String(v.port),security:v.security,hostPlaceholder:"smtp.example.com",portPlaceholder:"587",onHostChange:g=>{j(d=>({...d,host:g})),l(null)},onPortChange:g=>j(d=>({...d,port:Number(g)})),onSecurityChange:g=>j(d=>({...d,security:g}))}),p&&e.jsxs("p",{className:"text-2xs text-fg-subtle",children:[p.passwordHelp.text," ",I&&e.jsx("a",{href:I,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"Get an app password"})]})]})})}function Ue({email:t,username:o,password:s,onContinue:a,onBack:n,onChange:r}){const[u,h]=i.useState(o||t),[c,v]=i.useState(s),[j,S]=i.useState(null),y=t.split("@")[1]??"",w=ie(t),x=u.trim()!==""&&c.trim()!=="";i.useEffect(()=>{r(u,c)},[u,c,r]);const f=i.useCallback(()=>{if(!x){S("Enter your username and password.");return}S(null),a()},[x,a]);return i.useEffect(()=>{const l=p=>{p.key==="Enter"&&f(),p.key==="Escape"&&n()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[f,n]),e.jsx(L,{steps:M,activeStep:R.credentials,title:`Sign in to ${y||"your mail server"}`,subtitle:"Many providers require an app password instead of your normal one.",footer:e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"ghost",onClick:n,children:"Back"}),e.jsx(C,{variant:"primary",onClick:f,children:"Test connection"})]}),children:e.jsxs("div",{className:"space-y-3",children:[j&&e.jsx("div",{className:"rounded-md bg-danger-soft px-3 py-2 text-sm text-danger",children:j}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"credentials-username",children:"Username"}),e.jsx(F,{id:"credentials-username",value:u,onChange:l=>{h(l.target.value),S(null)},autoComplete:"username"})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"credentials-password",children:"Password or app password"}),e.jsx(ve,{id:"credentials-password",value:c,onChange:l=>{v(l.target.value),S(null)},autoComplete:"current-password"})]}),e.jsx(Ne,{url:w})]})})}function We({email:t,imapConfig:o,smtpConfig:s,username:a,password:n,onSuccess:r,onBackToCredentials:u,onBackToServers:h}){const[c,v]=i.useState({imapState:"running",smtpState:"pending",phase:"running"}),[j,S]=i.useState(0),y=s.host.trim()!=="",w=G(o.security),x=G(s.security),f=X({...ge()});i.useEffect(()=>{let m=!1;const N=[];return v({imapState:"running",smtpState:"pending",phase:"running"}),f.mutate({body:{username:a,password:n,imapHost:o.host,imapPort:o.port,imapTls:w.tls,imapStartTls:w.startTls,smtpHost:s.host,smtpPort:s.port,smtpTls:x.tls,smtpStartTls:x.startTls}},{onSuccess:b=>{if(m)return;const k=b.imapSuccess,T=y?b.smtpSuccess:!0;v({imapState:k?"ok":"failed",smtpState:y?"running":"ok",imapDetail:k?`Connected — ${o.host}:${o.port}`:b.imapError,phase:"running"}),N.push(window.setTimeout(()=>{if(m)return;const O=I=>{const g=I?.toLowerCase()??"";return g.includes("auth")||g.includes("login")||g.includes("535")||g.includes("credential")},P=!k&&O(b.imapError)||k&&y&&!b.smtpSuccess&&O(b.smtpError);v({imapState:k?"ok":"failed",smtpState:y?b.smtpSuccess?"ok":"failed":"ok",imapDetail:k?`Connected — ${o.host}:${o.port}`:b.imapError,smtpDetail:y?b.smtpSuccess?`Connected — ${s.host}:${s.port}`:b.smtpError:"Not set up — receive-only",rawError:k?y&&!b.smtpSuccess?b.smtpError:void 0:b.imapError,phase:k&&T?"success":P?"auth-failure":"network-failure"}),k&&T&&N.push(window.setTimeout(()=>{m||r()},800))},400))},onError:b=>{if(m)return;const k=b instanceof Error?b.message:"Connection failed";v({imapState:"failed",smtpState:"failed",imapDetail:k,smtpDetail:k,rawError:k,phase:"network-failure"})}}),()=>{m=!0;for(const b of N)window.clearTimeout(b)}},[j]);const{phase:l}=c;i.useEffect(()=>{const m=N=>{N.key==="Escape"&&(l==="auth-failure"?u():l==="network-failure"&&h())};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[l,u,h]);const p=l==="auth-failure"?e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"ghost",onClick:u,children:"Back to credentials"}),e.jsx(C,{variant:"primary",onClick:()=>S(m=>m+1),children:"Retry"})]}):l==="network-failure"?e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"ghost",onClick:h,children:"Back to servers"}),e.jsx(C,{variant:"primary",onClick:()=>S(m=>m+1),children:"Retry"})]}):l==="success"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:"Connection verified"}),e.jsx(C,{variant:"primary",onClick:r,children:"Start syncing"})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:"Testing…"}),e.jsx("span",{})]});return e.jsx(L,{steps:M,activeStep:R.test,title:"Testing the connection",subtitle:`Checking ${t}`,footer:p,children:e.jsxs("div",{className:"divide-y divide-line",children:[e.jsx(_,{label:`IMAP — ${o.host}:${o.port}`,detail:c.imapDetail,state:c.imapState}),e.jsx(_,{label:y?`SMTP — ${s.host}:${s.port}`:"SMTP — sending",detail:y?c.smtpDetail:"Not set up — you can add sending later in Settings",state:c.smtpState}),(l==="auth-failure"||l==="network-failure")&&c.rawError&&e.jsxs("div",{className:"py-3",children:[l==="auth-failure"&&e.jsx("p",{className:"mb-2 text-xs text-fg-muted",children:"Check your password — many providers require an app password."}),e.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:c.rawError})]})]})})}const Ve=2e4;function Qe({email:t,displayName:o,imapConfig:s,smtpConfig:a,username:n,password:r,onGoToInbox:u}){const h=xe(),[c,v]=i.useState(null),[j,S]=i.useState(null),y=i.useRef(!1),w=G(s.security),x=G(a.security),f=X({...ye(),onSuccess:E=>{v(E.accountId),h.invalidateQueries({queryKey:fe()})},onError:E=>{S(E instanceof Error?E.message:"Failed to create account")}});i.useEffect(()=>{if(y.current)return;y.current=!0;const E=a.host.trim()!=="",H=we({imapHost:s.host,smtpHost:a.host,smtpPort:a.port}),D=E?H??{smtpHost:a.host,smtpPort:a.port,smtpTls:x.tls,smtpStartTls:x.startTls}:null;f.mutate({body:{email:t,displayName:o||void 0,username:n!==t?n:void 0,password:r,imapHost:s.host,imapPort:s.port,imapTls:w.tls,imapStartTls:w.startTls,smtpHost:D?.smtpHost||void 0,smtpPort:D?.smtpPort||void 0,smtpTls:D?.smtpTls??!1,smtpStartTls:D?.smtpStartTls??!1}})},[]);const{data:l,isError:p}=Q({...Y({path:{accountId:c??""}}),enabled:!!c,refetchInterval:E=>{const H=E.state.data?.syncPhase;return H==="complete"||H==="error"?!1:2e3}}),m=l?.syncPhase==="error",{data:N}=Q({...ne(),enabled:!!c&&m}),b=N?.accounts.find(E=>E.accountId===c)?.lastError,k=l?.mailboxes.find(E=>E.fullPath==="INBOX"||E.fullPath==="Inbox"),T=l?.mailboxCountTotal??0,O=l?.mailboxCountSynced??0,P=k?.messagesTotal??0,I=k?.messagesSynced??0,g=P>0?I/P:0,d=l?.syncPhase,le=m?"failed":d==="idle"||d===void 0||d==="discovering_mailboxes"?"running":T>0?"ok":"running",B=m?"failed":!d||d==="idle"||d==="discovering_mailboxes"?"pending":d==="syncing_inbox"||d==="syncing_others"?"running":"ok",U=m?"failed":!d||d==="idle"||d==="discovering_mailboxes"||d==="syncing_inbox"?"pending":d==="syncing_others"?"running":"ok",me=I>0||k?.phase==="complete"||d==="complete"||m,[ue,de]=i.useState(!1);i.useEffect(()=>{if(!c)return;const E=setTimeout(()=>de(!0),Ve);return()=>clearTimeout(E)},[c]);const pe=!!c&&(me||p||ue);return j?e.jsx(L,{steps:M,activeStep:R.sync,title:"Couldn't create account",subtitle:"Something went wrong saving your account.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{}),e.jsx(C,{variant:"primary",onClick:()=>{y.current=!1,S(null),f.mutate({body:{email:t,displayName:o||void 0,username:n!==t?n:void 0,password:r,imapHost:s.host,imapPort:s.port,imapTls:w.tls,imapStartTls:w.startTls,smtpHost:a.host||void 0,smtpPort:a.port||void 0,smtpTls:x.tls,smtpStartTls:x.startTls}})},children:"Retry"})]}),children:e.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:j})}):e.jsx(L,{steps:M,activeStep:R.sync,title:`Syncing ${t}`,subtitle:"Newest mail first — you can start reading right away.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:"Sync continues in the background"}),pe?e.jsx(C,{variant:"primary",onClick:()=>c&&u(c),children:"Go to inbox"}):e.jsx(C,{variant:"primary",disabled:!0,icon:e.jsx($,{className:"size-3.5 animate-spin"}),children:"Getting your mail…"})]}),children:f.isPending?e.jsxs("div",{className:"flex items-center gap-2 py-4 text-sm text-fg-muted",children:[e.jsx($,{className:"size-4 animate-spin text-accent"}),"Creating your account…"]}):e.jsxs("div",{className:"space-y-3",children:[P>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-baseline justify-between text-xs",children:[e.jsx("span",{className:"font-medium text-fg",children:"INBOX"}),e.jsxs("span",{className:"text-fg-subtle tabular-nums",children:[I.toLocaleString()," / ",P.toLocaleString()," ","messages"]})]}),e.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-surface-sunken",children:e.jsx("div",{className:"h-full rounded-full bg-accent transition-all duration-500",style:{width:`${Math.max(2,g*100)}%`}})})]}),e.jsxs("div",{className:"divide-y divide-line",children:[e.jsx(_,{label:"Mailboxes discovered",detail:T>0?`${T} mailbox${T===1?"":"es"} found`:"Discovering…",state:le}),e.jsx(_,{label:"INBOX",detail:B==="ok"?`${I.toLocaleString()} messages synced`:B==="running"?"Syncing newest first…":"Queued",state:B}),O>1||d==="syncing_others"||d==="complete"?e.jsx(_,{label:"Other mailboxes",detail:U==="ok"?`${O-1} mailboxes synced`:U==="running"?"Syncing…":"Queued",state:U}):null]}),m&&e.jsxs("div",{className:"mt-2 space-y-2",children:[e.jsxs("p",{className:"text-xs text-danger",children:["Sync stalled. The account is still active —"," ",e.jsx("button",{type:"button",className:"underline",onClick:()=>{h.invalidateQueries({queryKey:Y({path:{accountId:c??""}}).queryKey})},children:"retry"})]}),b&&e.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:b})]})]})})}function Ze({skipWelcome:t=!1,onComplete:o,onCancel:s}){const[a,n]=i.useState(t?"connector":"welcome"),[r,u]=i.useState({email:"",displayName:"",imapConfig:te,smtpConfig:se,username:"",password:"",discoveryResult:null,discovered:!1,createdAccountId:null}),h=i.useCallback(()=>n("connector"),[]),c=i.useCallback(()=>n("address"),[]),v=i.useCallback(()=>n("microsoft-email"),[]),j=i.useCallback(()=>{t?s?.():n("welcome")},[t,s]),S=i.useCallback((l,p,m)=>{let N=te,b=se,k=!1;m&&(k=m.source!=="heuristic",N={host:m.imap.host,port:m.imap.port,security:m.imap.security},b={host:m.smtp.host,port:m.smtp.port,security:m.smtp.security}),u(T=>({...T,email:l,displayName:p,imapConfig:N,smtpConfig:b,discoveryResult:m,discovered:k,username:l})),n("servers")},[]),y=i.useCallback((l,p)=>{u(m=>({...m,imapConfig:l,smtpConfig:p}))},[]),w=i.useCallback((l,p)=>{u(m=>({...m,username:l,password:p}))},[]),x=i.useCallback(()=>n("sync"),[]),f=i.useCallback(l=>{o(l)},[o]);switch(a){case"welcome":return e.jsx(De,{onStart:h});case"connector":return e.jsx($e,{onContinue:c,onMicrosoft:v,onBack:j,showBack:!t});case"microsoft-email":return e.jsx(qe,{onBack:()=>n("connector"),onConnected:f});case"address":return e.jsx(Ge,{initialEmail:r.email,initialDisplayName:r.displayName,onContinue:S,onBack:()=>n("connector")});case"servers":return e.jsx(Be,{email:r.email,imapConfig:r.imapConfig,smtpConfig:r.smtpConfig,discovered:r.discovered,onContinue:()=>n("credentials"),onBack:()=>n("address"),onChange:y});case"credentials":return e.jsx(Ue,{email:r.email,username:r.username,password:r.password,onContinue:()=>n("test"),onBack:()=>n("servers"),onChange:w});case"test":return e.jsx(We,{email:r.email,imapConfig:r.imapConfig,smtpConfig:r.smtpConfig,username:r.username,password:r.password,onSuccess:x,onBackToCredentials:()=>n("credentials"),onBackToServers:()=>n("servers")});case"sync":return e.jsx(Qe,{email:r.email,displayName:r.displayName,imapConfig:r.imapConfig,smtpConfig:r.smtpConfig,username:r.username,password:r.password,onGoToInbox:f})}}export{Ze as O,ce as P,ee as g,G as s,Ie as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{af as g,e as w,ar as C,j as s,b,cM as $,T as _,f as k,l as q,a0 as H,cm as U,r as x,cn as K,D as W,E as G,v as J,u as S,dy as R,cP as V,x as X,ah as Y,bC as Z,aj as v,ak as y,cF as ee,bD as se}from"./index-idulIG65.js";import{u as te,p as ne,R as j,e as ae}from"./useSearchTokenContext-BxDapNdu.js";import{C as D}from"./circle-check-big-5NMrNFUI.js";import{C as I}from"./clock-DCdX5E4T.js";import{R as oe}from"./row-actions-zVghhE3a.js";import{R as re}from"./rotate-ccw-DfGOnKhE.js";import{N as T}from"./NavMenuButton-_aiK1QXb.js";import{a as p,t as ie}from"./format-23Av07Go.js";import{i as le,s as A}from"./outbox-status-BlKn6P0x.js";import{n as ce}from"./search-query-Cr_ZXBCp.js";import{c as de}from"./useMessageBodyContent-5kw10g9a.js";const ue={queued:{icon:I,label:"Queued",className:"text-warning"},sending:{icon:C,label:"Sending…",className:"text-accent-2",spin:!0},sent:{icon:D,label:"Sent",className:"text-positive"},unfiled:{icon:g,label:"Sent, not filed",className:"text-warning"},failed:{icon:w,label:"Failed",className:"text-danger"},blocked:{icon:g,label:"Blocked",className:"text-warning"}};function O({status:e,iconOnly:n,className:a}){const t=ue[e],o=t.icon;return s.jsxs("span",{className:b("inline-flex items-center gap-1.5 text-xs font-medium",t.className,a),children:[s.jsx(o,{className:b("size-4",t.spin&&"animate-spin")}),!n&&t.label]})}const xe=(e,n)=>n?"bg-accent-2-soft":e==="failed"?"bg-danger-soft":e==="blocked"||e==="unfiled"?"bg-warning/10":"";function fe({recipients:e,subject:n,time:a,status:t,error:o,selected:l,onSelect:c,onRetry:r,retrying:d,onEdit:i,onDelete:f,deleting:u}){const m=t==="failed"||t==="blocked"||t==="unfiled";return s.jsxs("div",{className:b("flex items-start gap-3 border-b border-line px-4 py-3 transition-colors hover:bg-surface-raised",xe(t,l)),children:[s.jsxs("button",{type:"button",...$,onClick:c,className:"flex flex-1 min-w-0 items-start gap-3 text-left",children:[s.jsx("div",{className:"mt-0.5 shrink-0",children:s.jsx(O,{status:t,iconOnly:!0})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"truncate text-sm font-medium",children:e}),s.jsx("span",{className:"shrink-0 text-xs text-fg-muted",children:a})]}),s.jsx("div",{className:"truncate text-sm",children:n||"No subject"}),s.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[s.jsx(O,{status:t}),o&&s.jsxs("span",{className:"truncate text-xs text-fg-muted",children:["— ",o]})]})]})]}),m&&s.jsx("div",{className:"shrink-0",children:s.jsx(oe,{actions:[...t==="failed"&&r?[{label:"Retry sending",iconOnly:!0,icon:s.jsx(re,{className:"size-3.5"}),busy:d,onClick:r}]:[],...t==="unfiled"?[]:[{label:"Edit as draft",iconOnly:!0,icon:s.jsx(k,{className:"size-3.5"}),onClick:i}]],destructive:{label:"Delete message",iconOnly:!0,icon:s.jsx(_,{className:"size-3.5"}),busy:u,confirm:{prompt:"Delete this message?",confirmLabel:"Delete"},onClick:f}})})]})}function Le(){return q({from:"/mail/outbox/draft/$outboxMessageId",shouldThrow:!1})?.outboxMessageId}function me(){const e=H(),n=U();return x.useCallback(a=>{e({to:"/mail/outbox/draft/$outboxMessageId",params:{outboxMessageId:a},search:t=>t,hash:n})},[e,n])}function he(){return K()}function be(e,n){const a=n.trim().toLowerCase();if(a.length===0)return!0;const t=[e.subject,e.fromAddress,e.fromName,...e.toAddresses??[],...e.ccAddresses??[]].filter(o=>typeof o=="string").join(" ").toLowerCase();return a.split(/\s+/).every(o=>o.length===0||t.includes(o))}function ge(e){return e.tokens.length>0&&e.freeText.trim().length===0}const E={queued:{icon:I,label:"Queued",className:"text-warning"},sending:{icon:C,label:"Sending…",className:"text-accent-2"},sent:{icon:D,label:"Sent",className:"text-positive"},unfiled:{icon:g,label:"Sent, not filed",className:"text-warning"},failed:{icon:w,label:"Failed",className:"text-danger"},blocked:{icon:g,label:"Blocked",className:"text-warning"}},pe=e=>ie(e).toDateString()===new Date().toDateString()?p(e,{hour:"numeric",minute:"2-digit"}):p(e,{month:"short",day:"numeric"}),M=e=>p(e,{dateStyle:"medium",timeStyle:"short"}),je=e=>{const n=e.toAddresses??[];return n.length===0?"No recipients":n.length===1?n[0]:`${n[0]} +${n.length-1}`},L=(e,n)=>n?"The outbox cannot filter on those terms":e?"No matching outbox messages":"No outbox messages",P=x.createContext(null);function N(){const e=x.useContext(P);if(!e)throw new Error("OutboxPane.* must be used inside <OutboxPane>");return e}function Ne({outboxMessageId:e,children:n}){const a=me(),t=he(),{data:o,isLoading:l}=W(G()),{searchQuery:c}=J(),r=te(),d=ce(c),i=ne(d,r),f=d.length>0,u=ge(i),m=x.useMemo(()=>u?[]:(o?.items??[]).filter(h=>le(h.status)).filter(h=>be(h,i.freeText)),[o,i.freeText,u]),z=x.useMemo(()=>m.find(h=>h.outboxMessageId===e),[m,e]),F={messages:m,hasQuery:f,unsupportedQuery:u,isLoading:l,selectedMessageId:e,selectedMessage:z,onOpenMessage:a,onCloseMessage:t};return s.jsx(P.Provider,{value:F,children:n})}function Q({message:e,isSelected:n,onSelect:a}){const t=X(),o=de(),{pushError:l}=Y(),c=x.useCallback(()=>{t.invalidateQueries({queryKey:Z()})},[t]),r=v({...ee(),onSuccess:c,onError:u=>{l(y("Couldn't resend message","The message wasn't sent.",u))}}),d=v({...se(),onSuccess:c,onError:u=>{l(y("Couldn't delete message","The message wasn't deleted.",u))}}),i=e.status;if(!E[i])return null;const f=A(e.status);return s.jsx(fe,{recipients:je(e),subject:e.subject||"",time:pe(e.sentAt??e.updatedAt),status:i,error:f?e.lastError??void 0:void 0,selected:n,onSelect:a,onRetry:i==="failed"?()=>r.mutate({path:{outboxMessageId:e.outboxMessageId}}):void 0,retrying:r.isPending,onEdit:()=>o(e.outboxMessageId),onDelete:()=>d.mutate({path:{outboxMessageId:e.outboxMessageId}}),deleting:d.isPending})}function B({message:e,onBack:n}){const a=e.status,t=E[a],o=t?.icon??k,l=e.sentAt?M(e.sentAt):M(e.updatedAt);return s.jsxs("div",{className:"h-full overflow-y-auto bg-canvas",children:[s.jsxs("div",{className:"border-b border-line p-4",children:[n&&s.jsxs("button",{type:"button",onClick:n,className:"mb-3 inline-flex items-center gap-1 text-sm text-fg-muted hover:text-fg",children:[s.jsx(V,{className:"size-4"}),s.jsx("span",{children:"Back"})]}),s.jsx("h1",{className:"text-xl font-semibold mb-3",children:e.subject||"(No subject)"}),s.jsxs("div",{className:"space-y-1 text-sm",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"From:"}),s.jsx("span",{className:"text-fg",children:e.fromName?`${e.fromName} <${e.fromAddress}>`:e.fromAddress})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"To:"}),s.jsx("span",{className:"text-fg",children:(e.toAddresses??[]).join(", ")})]}),e.ccAddresses&&e.ccAddresses.length>0&&s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"Cc:"}),s.jsx("span",{className:"text-fg",children:e.ccAddresses.join(", ")})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"Date:"}),s.jsx("span",{className:"text-fg",children:l})]}),t&&s.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[s.jsx(o,{className:b("size-4",t.className,a==="sending"&&"animate-spin")}),s.jsx("span",{className:b("text-xs font-medium",t.className),children:t.label}),A(e.status)&&e.lastError&&s.jsxs("span",{className:"text-xs text-fg-muted",children:["— ",e.lastError]})]})]})]}),s.jsx("div",{className:"p-4",children:s.jsx(ae,{html:e.htmlBody,text:e.textBody})})]})}function ve(){const{messages:e,hasQuery:n,unsupportedQuery:a,isLoading:t,selectedMessageId:o,onOpenMessage:l}=N(),c=x.useRef(null);return S({containerRef:c,itemSelector:R}),t?s.jsx("div",{className:"flex h-full items-center justify-center bg-canvas",children:s.jsx("span",{className:"text-fg-muted",children:"Loading..."})}):e.length===0?s.jsx("div",{className:"flex h-full bg-surface",children:s.jsx(j,{message:L(n,a),showHints:!1})}):s.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[s.jsx(T,{}),s.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:"Outbox"}),s.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:[e.length," ",e.length===1?"message":"messages"]})]}),s.jsx("div",{ref:c,className:"flex-1 overflow-y-auto",children:e.map(r=>s.jsx(Q,{message:r,isSelected:o===r.outboxMessageId,onSelect:()=>l(r.outboxMessageId)},r.outboxMessageId))})]})}function ye(){const{selectedMessage:e}=N();return s.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[s.jsx("header",{className:"flex h-pane-header shrink-0 items-center border-b border-line px-3"}),s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?s.jsx(B,{message:e}):s.jsx(j,{message:"Select a message to read",showHints:!1})})]})}function Oe(){const{messages:e,hasQuery:n,unsupportedQuery:a,isLoading:t,selectedMessageId:o,selectedMessage:l,onOpenMessage:c,onCloseMessage:r}=N(),d=x.useRef(null);return S({containerRef:d,itemSelector:R}),t?s.jsx("div",{className:"flex h-full items-center justify-center bg-canvas",children:s.jsx("span",{className:"text-fg-muted",children:"Loading..."})}):l?s.jsx(B,{message:l,onBack:r}):e.length===0?s.jsx("div",{className:"flex h-full bg-surface",children:s.jsx(j,{message:L(n,a),showHints:!1})}):s.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[s.jsx(T,{}),s.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:"Outbox"}),s.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:[e.length," ",e.length===1?"message":"messages"]})]}),s.jsx("div",{ref:d,className:"flex-1 overflow-y-auto",children:e.map(i=>s.jsx(Q,{message:i,isSelected:o===i.outboxMessageId,onSelect:()=>c(i.outboxMessageId)},i.outboxMessageId))})]})}const Pe=Object.assign(Ne,{List:ve,Reading:ye,Phone:Oe});export{Pe as O,Le as u};
|
|
1
|
+
import{af as g,e as w,ar as C,j as s,b,cM as $,T as _,f as k,l as q,a0 as H,cm as U,r as x,cn as K,D as W,E as G,v as J,u as S,dy as R,cP as V,x as X,ah as Y,bC as Z,aj as v,ak as y,cF as ee,bD as se}from"./index-CKkjA-cG.js";import{u as te,p as ne,R as j,e as ae}from"./useSearchTokenContext-ayOQJT8b.js";import{C as D}from"./circle-check-big-CdK3PYyl.js";import{C as I}from"./clock-DWWB2TEy.js";import{R as oe}from"./row-actions-BgRf_L5r.js";import{R as re}from"./rotate-ccw-CkgxPcaT.js";import{N as T}from"./NavMenuButton-DNhdUn1P.js";import{a as p,t as ie}from"./format-23Av07Go.js";import{i as le,s as A}from"./outbox-status-BlKn6P0x.js";import{n as ce}from"./search-query-Cr_ZXBCp.js";import{c as de}from"./useMessageBodyContent-BZvmaesf.js";const ue={queued:{icon:I,label:"Queued",className:"text-warning"},sending:{icon:C,label:"Sending…",className:"text-accent-2",spin:!0},sent:{icon:D,label:"Sent",className:"text-positive"},unfiled:{icon:g,label:"Sent, not filed",className:"text-warning"},failed:{icon:w,label:"Failed",className:"text-danger"},blocked:{icon:g,label:"Blocked",className:"text-warning"}};function O({status:e,iconOnly:n,className:a}){const t=ue[e],o=t.icon;return s.jsxs("span",{className:b("inline-flex items-center gap-1.5 text-xs font-medium",t.className,a),children:[s.jsx(o,{className:b("size-4",t.spin&&"animate-spin")}),!n&&t.label]})}const xe=(e,n)=>n?"bg-accent-2-soft":e==="failed"?"bg-danger-soft":e==="blocked"||e==="unfiled"?"bg-warning/10":"";function fe({recipients:e,subject:n,time:a,status:t,error:o,selected:l,onSelect:c,onRetry:r,retrying:d,onEdit:i,onDelete:f,deleting:u}){const m=t==="failed"||t==="blocked"||t==="unfiled";return s.jsxs("div",{className:b("flex items-start gap-3 border-b border-line px-4 py-3 transition-colors hover:bg-surface-raised",xe(t,l)),children:[s.jsxs("button",{type:"button",...$,onClick:c,className:"flex flex-1 min-w-0 items-start gap-3 text-left",children:[s.jsx("div",{className:"mt-0.5 shrink-0",children:s.jsx(O,{status:t,iconOnly:!0})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"truncate text-sm font-medium",children:e}),s.jsx("span",{className:"shrink-0 text-xs text-fg-muted",children:a})]}),s.jsx("div",{className:"truncate text-sm",children:n||"No subject"}),s.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[s.jsx(O,{status:t}),o&&s.jsxs("span",{className:"truncate text-xs text-fg-muted",children:["— ",o]})]})]})]}),m&&s.jsx("div",{className:"shrink-0",children:s.jsx(oe,{actions:[...t==="failed"&&r?[{label:"Retry sending",iconOnly:!0,icon:s.jsx(re,{className:"size-3.5"}),busy:d,onClick:r}]:[],...t==="unfiled"?[]:[{label:"Edit as draft",iconOnly:!0,icon:s.jsx(k,{className:"size-3.5"}),onClick:i}]],destructive:{label:"Delete message",iconOnly:!0,icon:s.jsx(_,{className:"size-3.5"}),busy:u,confirm:{prompt:"Delete this message?",confirmLabel:"Delete"},onClick:f}})})]})}function Le(){return q({from:"/mail/outbox/draft/$outboxMessageId",shouldThrow:!1})?.outboxMessageId}function me(){const e=H(),n=U();return x.useCallback(a=>{e({to:"/mail/outbox/draft/$outboxMessageId",params:{outboxMessageId:a},search:t=>t,hash:n})},[e,n])}function he(){return K()}function be(e,n){const a=n.trim().toLowerCase();if(a.length===0)return!0;const t=[e.subject,e.fromAddress,e.fromName,...e.toAddresses??[],...e.ccAddresses??[]].filter(o=>typeof o=="string").join(" ").toLowerCase();return a.split(/\s+/).every(o=>o.length===0||t.includes(o))}function ge(e){return e.tokens.length>0&&e.freeText.trim().length===0}const E={queued:{icon:I,label:"Queued",className:"text-warning"},sending:{icon:C,label:"Sending…",className:"text-accent-2"},sent:{icon:D,label:"Sent",className:"text-positive"},unfiled:{icon:g,label:"Sent, not filed",className:"text-warning"},failed:{icon:w,label:"Failed",className:"text-danger"},blocked:{icon:g,label:"Blocked",className:"text-warning"}},pe=e=>ie(e).toDateString()===new Date().toDateString()?p(e,{hour:"numeric",minute:"2-digit"}):p(e,{month:"short",day:"numeric"}),M=e=>p(e,{dateStyle:"medium",timeStyle:"short"}),je=e=>{const n=e.toAddresses??[];return n.length===0?"No recipients":n.length===1?n[0]:`${n[0]} +${n.length-1}`},L=(e,n)=>n?"The outbox cannot filter on those terms":e?"No matching outbox messages":"No outbox messages",P=x.createContext(null);function N(){const e=x.useContext(P);if(!e)throw new Error("OutboxPane.* must be used inside <OutboxPane>");return e}function Ne({outboxMessageId:e,children:n}){const a=me(),t=he(),{data:o,isLoading:l}=W(G()),{searchQuery:c}=J(),r=te(),d=ce(c),i=ne(d,r),f=d.length>0,u=ge(i),m=x.useMemo(()=>u?[]:(o?.items??[]).filter(h=>le(h.status)).filter(h=>be(h,i.freeText)),[o,i.freeText,u]),z=x.useMemo(()=>m.find(h=>h.outboxMessageId===e),[m,e]),F={messages:m,hasQuery:f,unsupportedQuery:u,isLoading:l,selectedMessageId:e,selectedMessage:z,onOpenMessage:a,onCloseMessage:t};return s.jsx(P.Provider,{value:F,children:n})}function Q({message:e,isSelected:n,onSelect:a}){const t=X(),o=de(),{pushError:l}=Y(),c=x.useCallback(()=>{t.invalidateQueries({queryKey:Z()})},[t]),r=v({...ee(),onSuccess:c,onError:u=>{l(y("Couldn't resend message","The message wasn't sent.",u))}}),d=v({...se(),onSuccess:c,onError:u=>{l(y("Couldn't delete message","The message wasn't deleted.",u))}}),i=e.status;if(!E[i])return null;const f=A(e.status);return s.jsx(fe,{recipients:je(e),subject:e.subject||"",time:pe(e.sentAt??e.updatedAt),status:i,error:f?e.lastError??void 0:void 0,selected:n,onSelect:a,onRetry:i==="failed"?()=>r.mutate({path:{outboxMessageId:e.outboxMessageId}}):void 0,retrying:r.isPending,onEdit:()=>o(e.outboxMessageId),onDelete:()=>d.mutate({path:{outboxMessageId:e.outboxMessageId}}),deleting:d.isPending})}function B({message:e,onBack:n}){const a=e.status,t=E[a],o=t?.icon??k,l=e.sentAt?M(e.sentAt):M(e.updatedAt);return s.jsxs("div",{className:"h-full overflow-y-auto bg-canvas",children:[s.jsxs("div",{className:"border-b border-line p-4",children:[n&&s.jsxs("button",{type:"button",onClick:n,className:"mb-3 inline-flex items-center gap-1 text-sm text-fg-muted hover:text-fg",children:[s.jsx(V,{className:"size-4"}),s.jsx("span",{children:"Back"})]}),s.jsx("h1",{className:"text-xl font-semibold mb-3",children:e.subject||"(No subject)"}),s.jsxs("div",{className:"space-y-1 text-sm",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"From:"}),s.jsx("span",{className:"text-fg",children:e.fromName?`${e.fromName} <${e.fromAddress}>`:e.fromAddress})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"To:"}),s.jsx("span",{className:"text-fg",children:(e.toAddresses??[]).join(", ")})]}),e.ccAddresses&&e.ccAddresses.length>0&&s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"Cc:"}),s.jsx("span",{className:"text-fg",children:e.ccAddresses.join(", ")})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"Date:"}),s.jsx("span",{className:"text-fg",children:l})]}),t&&s.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[s.jsx(o,{className:b("size-4",t.className,a==="sending"&&"animate-spin")}),s.jsx("span",{className:b("text-xs font-medium",t.className),children:t.label}),A(e.status)&&e.lastError&&s.jsxs("span",{className:"text-xs text-fg-muted",children:["— ",e.lastError]})]})]})]}),s.jsx("div",{className:"p-4",children:s.jsx(ae,{html:e.htmlBody,text:e.textBody})})]})}function ve(){const{messages:e,hasQuery:n,unsupportedQuery:a,isLoading:t,selectedMessageId:o,onOpenMessage:l}=N(),c=x.useRef(null);return S({containerRef:c,itemSelector:R}),t?s.jsx("div",{className:"flex h-full items-center justify-center bg-canvas",children:s.jsx("span",{className:"text-fg-muted",children:"Loading..."})}):e.length===0?s.jsx("div",{className:"flex h-full bg-surface",children:s.jsx(j,{message:L(n,a),showHints:!1})}):s.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[s.jsx(T,{}),s.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:"Outbox"}),s.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:[e.length," ",e.length===1?"message":"messages"]})]}),s.jsx("div",{ref:c,className:"flex-1 overflow-y-auto",children:e.map(r=>s.jsx(Q,{message:r,isSelected:o===r.outboxMessageId,onSelect:()=>l(r.outboxMessageId)},r.outboxMessageId))})]})}function ye(){const{selectedMessage:e}=N();return s.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[s.jsx("header",{className:"flex h-pane-header shrink-0 items-center border-b border-line px-3"}),s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?s.jsx(B,{message:e}):s.jsx(j,{message:"Select a message to read",showHints:!1})})]})}function Oe(){const{messages:e,hasQuery:n,unsupportedQuery:a,isLoading:t,selectedMessageId:o,selectedMessage:l,onOpenMessage:c,onCloseMessage:r}=N(),d=x.useRef(null);return S({containerRef:d,itemSelector:R}),t?s.jsx("div",{className:"flex h-full items-center justify-center bg-canvas",children:s.jsx("span",{className:"text-fg-muted",children:"Loading..."})}):l?s.jsx(B,{message:l,onBack:r}):e.length===0?s.jsx("div",{className:"flex h-full bg-surface",children:s.jsx(j,{message:L(n,a),showHints:!1})}):s.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[s.jsx(T,{}),s.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:"Outbox"}),s.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:[e.length," ",e.length===1?"message":"messages"]})]}),s.jsx("div",{ref:d,className:"flex-1 overflow-y-auto",children:e.map(i=>s.jsx(Q,{message:i,isSelected:o===i.outboxMessageId,onSelect:()=>c(i.outboxMessageId)},i.outboxMessageId))})]})}const Pe=Object.assign(Ne,{List:ve,Reading:ye,Phone:Oe});export{Pe as O,Le as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a7 as m,j as o,a4 as p}from"./index-CKkjA-cG.js";import{a}from"./MailShell-Dpl2UghQ.js";import{M as r}from"./MailboxPane-CoyUSu35.js";import{g as e}from"./search-token-index-DwZH1pNH.js";import{u as s}from"./search-mirror-Ci3JhyjF.js";import"./FullCompose-C07owHeK.js";import"./ErrorState-DbgUZ__l.js";import"./index-0FGoRika.js";import"./useMessageBodyContent-BZvmaesf.js";import"./useSignature-VLETEnXD.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-C4gSwa1u.js";import"./confirm-dialog-BnyN7GHh.js";import"./useSearchTokenContext-ayOQJT8b.js";import"./kbd-ZFs3oMUy.js";import"./search-scope-DTcpOp3S.js";import"./useRefreshControl-BtqovDHX.js";import"./circle-check-big-CdK3PYyl.js";import"./MailListHeader-3VPhFLtl.js";import"./attachment-file-BpcYj8EC.js";import"./mail-Dr2jAfYM.js";import"./avatar-CkH5WRjW.js";import"./format-23Av07Go.js";import"./download-BbohFpPf.js";import"./shield-check-B7H7xIyv.js";import"./useFilters-BowNMCvT.js";import"./clock-DWWB2TEy.js";import"./menu-CBoa4zv9.js";import"./MailViewChrome-DjiziPrg.js";import"./NavMenuButton-DNhdUn1P.js";import"./useLabels-DCDbtd5c.js";import"./useSemanticSearch-DEkBjMQk.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-2TDQ0T_I.js";import"./circle-help-BsddLaRz.js";import"./circle-check-CGtgFyYX.js";function N(){const{mailboxId:t}=m.useParams(),i=e();return s({to:"/mail/$mailboxId",params:{mailboxId:t}}),o.jsx(r,{mailboxId:t,thread:i,children:o.jsx(a,{phone:o.jsx(r.Phone,{}),list:o.jsx(r.List,{}),reading:o.jsx(p,{}),intelligence:o.jsx(r.Intelligence,{}),hasThread:!!i})})}export{N as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./index-CKkjA-cG.js";import{F as r}from"./FlaggedPane-uXhvpt4T.js";import"./useSearchTokenContext-ayOQJT8b.js";import"./kbd-ZFs3oMUy.js";import"./useMessageBodyContent-BZvmaesf.js";import"./search-scope-DTcpOp3S.js";import"./MailListHeader-3VPhFLtl.js";import"./search-token-index-DwZH1pNH.js";import"./attachment-file-BpcYj8EC.js";import"./mail-Dr2jAfYM.js";import"./avatar-CkH5WRjW.js";import"./index-0FGoRika.js";import"./useSignature-VLETEnXD.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-C4gSwa1u.js";import"./ErrorState-DbgUZ__l.js";import"./format-23Av07Go.js";import"./download-BbohFpPf.js";import"./shield-check-B7H7xIyv.js";import"./useFilters-BowNMCvT.js";import"./confirm-dialog-BnyN7GHh.js";import"./clock-DWWB2TEy.js";import"./menu-CBoa4zv9.js";import"./MailViewChrome-DjiziPrg.js";import"./wizard-selection-B1bng5Jq.js";function v(){return o.jsx(r.Reading,{})}export{v as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./index-CKkjA-cG.js";import{M as r}from"./MailboxPane-CoyUSu35.js";import"./useSearchTokenContext-ayOQJT8b.js";import"./kbd-ZFs3oMUy.js";import"./useMessageBodyContent-BZvmaesf.js";import"./search-scope-DTcpOp3S.js";import"./useRefreshControl-BtqovDHX.js";import"./circle-check-big-CdK3PYyl.js";import"./search-token-index-DwZH1pNH.js";import"./MailListHeader-3VPhFLtl.js";import"./attachment-file-BpcYj8EC.js";import"./mail-Dr2jAfYM.js";import"./avatar-CkH5WRjW.js";import"./index-0FGoRika.js";import"./useSignature-VLETEnXD.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-C4gSwa1u.js";import"./ErrorState-DbgUZ__l.js";import"./format-23Av07Go.js";import"./download-BbohFpPf.js";import"./shield-check-B7H7xIyv.js";import"./useFilters-BowNMCvT.js";import"./confirm-dialog-BnyN7GHh.js";import"./clock-DWWB2TEy.js";import"./menu-CBoa4zv9.js";import"./MailViewChrome-DjiziPrg.js";import"./NavMenuButton-DNhdUn1P.js";import"./useLabels-DCDbtd5c.js";import"./useSemanticSearch-DEkBjMQk.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-2TDQ0T_I.js";import"./circle-help-BsddLaRz.js";import"./circle-check-CGtgFyYX.js";function G(){return o.jsx(r.Reading,{})}export{G as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as r}from"./index-CKkjA-cG.js";import{B as o}from"./BriefPane-BToIPtXS.js";import"./useSearchTokenContext-ayOQJT8b.js";import"./kbd-ZFs3oMUy.js";import"./useMessageBodyContent-BZvmaesf.js";import"./search-scope-DTcpOp3S.js";import"./MailListHeader-3VPhFLtl.js";import"./search-token-index-DwZH1pNH.js";import"./attachment-file-BpcYj8EC.js";import"./mail-Dr2jAfYM.js";import"./avatar-CkH5WRjW.js";import"./index-0FGoRika.js";import"./useSignature-VLETEnXD.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-C4gSwa1u.js";import"./ErrorState-DbgUZ__l.js";import"./format-23Av07Go.js";import"./download-BbohFpPf.js";import"./shield-check-B7H7xIyv.js";import"./useFilters-BowNMCvT.js";import"./confirm-dialog-BnyN7GHh.js";import"./clock-DWWB2TEy.js";import"./menu-CBoa4zv9.js";import"./useRefreshControl-BtqovDHX.js";import"./circle-check-big-CdK3PYyl.js";import"./useLabels-DCDbtd5c.js";import"./useSemanticSearch-DEkBjMQk.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-B1bng5Jq.js";function A(){return r.jsx(o.Reading,{})}export{A as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./index-CKkjA-cG.js";import{O as t}from"./OutboxPane-D7Dv6g_7.js";import"./useSearchTokenContext-ayOQJT8b.js";import"./kbd-ZFs3oMUy.js";import"./useMessageBodyContent-BZvmaesf.js";import"./search-scope-DTcpOp3S.js";import"./circle-check-big-CdK3PYyl.js";import"./clock-DWWB2TEy.js";import"./row-actions-BgRf_L5r.js";import"./rotate-ccw-CkgxPcaT.js";import"./NavMenuButton-DNhdUn1P.js";import"./menu-CBoa4zv9.js";import"./format-23Av07Go.js";import"./outbox-status-BlKn6P0x.js";import"./search-query-Cr_ZXBCp.js";function P(){return o.jsx(t.Reading,{})}export{P as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a4 as o}from"./index-CKkjA-cG.js";const n=o;export{n as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a4 as o}from"./index-CKkjA-cG.js";const n=o;export{n as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a4 as o}from"./index-CKkjA-cG.js";const n=o;export{n as component};
|