@remit/web-client-dist 0.0.210 → 0.0.211

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/assets/{ComposeBody-C1MCR27t.js → ComposeBody-wilPjdd4.js} +1 -1
  2. package/assets/{ConfirmDialog-QcTswzQ-.js → ConfirmDialog-DnD0wdBA.js} +1 -1
  3. package/assets/{ErrorState-Cmo4ZTs6.js → ErrorState-C-qt7L5W.js} +1 -1
  4. package/assets/{OnboardingWizard-BSrEytWI.js → OnboardingWizard-l2MGuA6A.js} +1 -1
  5. package/assets/{account-form-helpers-BhgxcoAH.js → account-form-helpers-DLSEfuIr.js} +1 -1
  6. package/assets/{accounts-QrBHG5tG.js → accounts-Dfc0mHNd.js} +1 -1
  7. package/assets/{advanced-BMNePWot.js → advanced-BRGBlcP1.js} +1 -1
  8. package/assets/{appearance-CU9bBTct.js → appearance-DRIFydFD.js} +1 -1
  9. package/assets/{avatar-DgcYp_pM.js → avatar-CypHN17J.js} +1 -1
  10. package/assets/{browser-ponyfill-lGuv4mvO.js → browser-ponyfill-u24dk4-T.js} +2 -2
  11. package/assets/{circle-check-BBWjCUW1.js → circle-check-j3DpmpuG.js} +1 -1
  12. package/assets/{download-C-1EE_SQ.js → download-BXnWFr8V.js} +1 -1
  13. package/assets/filters-Nc_ruyEv.js +1 -0
  14. package/assets/{flagged-FcT-rioJ.js → flagged-CZnIi_3J.js} +1 -1
  15. package/assets/{folder-DfiD-MRq.js → folder-jCYPM0QT.js} +1 -1
  16. package/assets/{folders-OU2093b6.js → folders-61znXSzG.js} +1 -1
  17. package/assets/{format-B6Elex-n.js → format-BWvUVmUm.js} +1 -1
  18. package/assets/index-BS3yS_rq.js +1 -0
  19. package/assets/{index-CXGHJejR.js → index-DBLtMQVY.js} +63 -63
  20. package/assets/{index-cYpNuQRY.css → index-DCLadAJi.css} +1 -1
  21. package/assets/{index-D4ZjGYRC.js → index-DV2XBUm3.js} +1 -1
  22. package/assets/{kbd-DCgPMOHu.js → kbd-Bm4kcOe_.js} +1 -1
  23. package/assets/{labels-GAWwN_t-.js → labels-DcW9D038.js} +1 -1
  24. package/assets/mail-BbUXwoQH.js +118 -0
  25. package/assets/move-targets-DR3SzEM3.js +1 -0
  26. package/assets/{onboarding-DC0PrXVA.js → onboarding-Dzbvu8rA.js} +1 -1
  27. package/assets/{senders-BmLxmMBw.js → senders-DLwjmx0M.js} +1 -1
  28. package/assets/settings-sSuMeOlB.js +1 -0
  29. package/assets/{settings-screen-WO-Vp8pt.js → settings-screen-DBuPiW9q.js} +1 -1
  30. package/assets/{shield-check-BHk04XRt.js → shield-check-DY-38rr6.js} +1 -1
  31. package/assets/{suggested-vips-B5ja8TGX.js → suggested-vips-BQZwMd5b.js} +1 -1
  32. package/assets/{useDebouncedValue-BmoFUmBJ.js → useDebouncedValue-C3why0DM.js} +1 -1
  33. package/assets/{useLabels-tLtNWBGc.js → useLabels-B9dNNhmU.js} +1 -1
  34. package/assets/useRulePreview-BZxifYYj.js +1 -0
  35. package/assets/{useSignature-DFRGRKMd.js → useSignature-mSu7RyMJ.js} +1 -1
  36. package/index.html +2 -2
  37. package/package.json +1 -1
  38. package/assets/filters-BMXg2C7T.js +0 -1
  39. package/assets/index-CyUKZqx0.js +0 -1
  40. package/assets/mail-Bj55HeZP.js +0 -118
  41. package/assets/move-targets-BuUh04if.js +0 -1
  42. package/assets/settings-A78oY7aJ.js +0 -1
  43. package/assets/useRulePreview-DJvFPUom.js +0 -1
@@ -1 +1 @@
1
- import{a}from"./index-CXGHJejR.js";const o=a("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);export{o as F};
1
+ import{a}from"./index-DBLtMQVY.js";const o=a("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);export{o as F};
@@ -1 +1 @@
1
- import{j as e,cm as q,r as f,cn as Y,bO as B,be as K,B as C,k as ee,co as te,a4 as Q,aR as G,bJ as H,cp as se,cq as ae,bn as re,bt as V,aW as F,L as R,l as L,T as S,F as ne,K as le,D as oe,H as ie,X as ce,aj as de,av as W,aG as me,bZ as ue,b$ as xe,ak as he,ay as $,cr as fe,cs as pe,ct as ge,cu as be}from"./index-CXGHJejR.js";import{F as ve}from"./folder-DfiD-MRq.js";import{S as je}from"./settings-screen-WO-Vp8pt.js";import{u as Z,b as ye,v as Ne,c as Ce}from"./move-targets-BuUh04if.js";import{E as J}from"./ErrorState-Cmo4ZTs6.js";import"./avatar-DgcYp_pM.js";const ke=["inbox","drafts","sent","archive","junk","trash"],T="";function we(t){const a=t.messageCount===1?"msg":"msgs";return`${q(t.providerPath)} · ${t.messageCount} ${a}`}function Ie({role:t,folders:a,appointedId:s,displayName:n,onAppoint:d,onRename:o}){const[x,c]=f.useState(n),r=a.find(m=>m.mailboxId===s)??null,l=te(t),h=r!=null&&x.trim()!==n.trim();return e.jsxs("div",{className:"flex flex-col gap-1 border-b border-line px-row-inset py-2.5 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"flex w-28 shrink-0 items-center gap-2 text-sm font-medium text-fg",children:[Y(t),l]}),e.jsxs(B,{className:"w-56 shrink-0",value:s??T,"aria-label":`Folder for ${l}`,onChange:m=>d(t,m.target.value===T?null:m.target.value),children:[e.jsx("option",{value:T,children:"None"}),a.map(m=>e.jsx("option",{value:m.mailboxId,children:we(m)},m.mailboxId))]}),r&&e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"flex-1",value:x,placeholder:l,"aria-label":`Display name for ${l}`,onChange:m=>c(m.target.value)}),h&&e.jsx(C,{variant:"ghost",size:"sm",className:"shrink-0",icon:e.jsx(ee,{className:"size-4"}),"aria-label":"Save display name",onClick:()=>o(r.mailboxId,x)})]})]}),r&&e.jsxs("span",{className:"truncate pl-[7.5rem] text-2xs text-fg-subtle",title:r.providerPath,children:[r.providerPath," · ",r.messageCount," ",r.messageCount===1?"message":"messages"]})]})}function Me({accountEmail:t,folders:a,appointments:s,displayNames:n={},onAppoint:d,onRename:o}){const x=new Set(Object.values(s).filter(r=>r!=null)),c=a.filter(r=>!x.has(r.mailboxId));return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsxs("h2",{className:"text-sm font-semibold text-fg",children:["Folder roles — ",t]}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Each role points to one folder. Pick the folder that holds the mail — the counts help you tell real folders from empty look-alikes. Appointing a folder here removes it from any other role."})]}),e.jsx("div",{className:"rounded-sm border border-line bg-surface",children:ke.map(r=>{const l=s[r]??null;return e.jsx(Ie,{role:r,folders:a,appointedId:l,displayName:l?n[l]??"":"",onAppoint:d,onRename:o},r)})}),c.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("h3",{className:"text-xs font-medium text-fg-muted",children:"Other folders"}),e.jsx("ul",{className:"rounded-sm border border-line bg-surface",children:c.map(r=>e.jsxs("li",{className:"flex items-center gap-2 border-b border-line px-row-inset py-2 text-sm text-fg last:border-b-0",children:[e.jsx(ve,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate",children:q(r.providerPath)}),e.jsxs("span",{className:"ml-auto shrink-0 text-2xs text-fg-subtle",children:[r.messageCount," ",r.messageCount===1?"message":"messages"]})]},r.mailboxId))})]})]})}const Pe=100,De=t=>t.trim().toLowerCase()==="inbox",Oe=(t,a)=>{const s=`${t.fullPath}${t.hierarchyDelimiter}`;return a.some(n=>n.mailboxId!==t.mailboxId&&n.fullPath.startsWith(s))},Se=(t,a)=>a.find(s=>s.mailboxId!=null&&s.mailboxId===t)?.role;function Ee(t,a,s){if(De(t.fullPath))return{deletable:!1,reason:"inbox",message:"The inbox can't be deleted."};const n=Se(t.mailboxId,s);return n?{deletable:!1,reason:"role",message:`This folder is your ${n} folder. Reassign that role before deleting it.`}:Oe(t,a)?{deletable:!1,reason:"children",message:"This folder has subfolders. Delete them first."}:{deletable:!0}}function Te(t,a){return t.filter(s=>s.mailboxId!==a)}function Ae(t){return{total:t,moved:0,phase:t===0?"moved":"moving"}}function Fe(t,a){if(t.phase!=="moving")return t;const s=Math.min(t.total,t.moved+Math.max(0,a));return{...t,moved:s,phase:s>=t.total?"moved":"moving"}}function O(t,a){return{...t,phase:"failed",error:a}}function z(t){return`Moved ${t.moved} of ${t.total}`}function _(t){return t>0?"choose-fate":"confirm-empty"}const X=50,Le=t=>t instanceof Error?t.message:"Something went wrong.",P=t=>t.then(a=>({ok:!0,value:a}),a=>({ok:!1,error:Le(a)})),Re=async(t,a,s,n)=>{const d=[];let o;for(let x=0;x<X;x+=1){if(n.aborted)return d;const{data:c}=await V({path:{mailboxId:t},query:{order:"desc",continuationToken:o},throwOnError:!0});for(const r of c.items)if(!r.isDeleted&&!a.has(r.messageId)&&!d.includes(r.messageId)&&(d.push(r.messageId),d.length>=s))return d;if(!c.continuationToken)break;o=c.continuationToken}return d},$e=async(t,a)=>{let s=0,n;for(let d=0;d<X;d+=1){if(a.aborted)return s;const{data:o}=await V({path:{mailboxId:t},query:{order:"desc",continuationToken:n},throwOnError:!0});for(const x of o.items)x.isDeleted||(s+=1);if(!o.continuationToken)break;n=o.continuationToken}return s};function ze({accountId:t,mailboxId:a,onDeleted:s}){const n=Q(),[d,o]=f.useState("idle"),[x,c]=f.useState(null),[r,l]=f.useState(),h=f.useRef(null),m=f.useCallback(()=>{n.invalidateQueries({queryKey:G({path:{accountId:t}})}),n.invalidateQueries({queryKey:H()})},[n,t]),j=f.useCallback(async()=>{o("deleting");const i=await P(se({path:{accountId:t,mailboxId:a},throwOnError:!0}));if(!i.ok){l(i.error),o("error");return}m(),o("done"),s()},[t,a,m,s]),k=f.useCallback(()=>ae({path:{accountId:t},throwOnError:!0}).then(({data:i})=>i.items.find(p=>p.mailboxId===a)?.messageCount??0),[t,a]),u=f.useCallback(()=>{h.current?.abort()},[]),w=f.useCallback(async i=>{const p=new AbortController;h.current=p;const{signal:g}=p;o("moving"),l(void 0);const M=await P(k());if(g.aborted)return;if(!M.ok){l(M.error),o("error");return}let b=Ae(M.value);c(b);const v=new Set;for(;;){if(g.aborted)return;const N=await P(Re(a,v,Pe,g));if(g.aborted)return;if(!N.ok){b=O(b,N.error),c(b),l(N.error),o("error");return}const D=N.value;if(D.length===0)break;const E=await P(re({body:{messageIds:D,destinationMailboxId:i},throwOnError:!0}));if(g.aborted)return;if(!E.ok){b=O(b,E.error),c(b),l(E.error),o("error");return}for(const U of D)v.add(U);b=Fe(b,D.length),c(b)}const I=await P($e(a,g));if(!g.aborted){if(!I.ok){b=O(b,I.error),c(b),l(I.error),o("error");return}if(I.value>0){const N=`${I.value} ${I.value===1?"email is":"emails are"} still syncing. Re-open delete to finish removing this folder.`;b=O(b,N),c(b),l(N),o("error"),m();return}await j()}},[a,k,j,m]),y=f.useCallback(()=>{h.current?.abort(),h.current=null,o("idle"),c(null),l(void 0)},[]);return{phase:d,progress:x,errorMessage:r,deleteMailbox:j,moveThenDelete:w,cancel:u,reset:y}}const _e=t=>t.displayNameOverride?.trim()||F(t.fullPath),A=t=>`${t} ${t===1?"email":"emails"}`;function qe({open:t,accountId:a,folder:s,mailboxes:n,appointments:d,onClose:o}){const[x,c]=f.useState(()=>_(s.messageCount)),{createFolder:r}=Z(a),{phase:l,progress:h,errorMessage:m,deleteMailbox:j,moveThenDelete:k,cancel:u,reset:w}=ze({accountId:a,mailboxId:s.mailboxId,onDeleted:o});f.useEffect(()=>{t&&(c(_(s.messageCount)),w())},[t,s.messageCount,w]),f.useEffect(()=>u,[u]);const y=f.useCallback(()=>{u(),o()},[u,o]),i=f.useMemo(()=>Te(ye(n,d),s.mailboxId).map(v=>({id:v.mailboxId,label:F(v.fullPath),searchValue:v.fullPath})),[n,d,s.mailboxId]),p=async(v,I)=>{const N=await r(v,I);return{id:N.id,label:N.label}};if(!t)return null;const g=_e(s),M=`Delete ${g}`,b=l==="moving"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(R,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving emails…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:h?z(h):"Moved 0 of 0"})]}):l==="deleting"||l==="done"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(R,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Deleting folder…"})]}):l==="error"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(L,{tone:"danger",variant:"soft",children:m??"Something went wrong. Please try again."}),h&&e.jsxs("p",{className:"text-xs text-fg-muted",children:[z(h),". Already-moved emails stay moved — re-open delete to continue with the rest."]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(C,{variant:"secondary",size:"sm",onClick:y,children:"Close"})})]}):x==="confirm-empty"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:g}),"? This folder is empty and will be removed from the server."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(C,{variant:"secondary",size:"sm",onClick:y,children:"Cancel"}),e.jsx(C,{variant:"danger",size:"sm",icon:e.jsx(S,{className:"size-3.5"}),onClick:()=>j(),children:"Delete folder"})]})]}):x==="choose-fate"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:g})," holds"," ",A(s.messageCount),". What should happen to them?"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{type:"button",onClick:()=>c("confirm-delete-all"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(S,{className:"size-4 shrink-0 text-danger"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Delete them with the folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"The emails are removed from the server and can't be recovered."})]})]}),e.jsxs("button",{type:"button",onClick:()=>c("pick-destination"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(ne,{className:"size-4 shrink-0 text-accent-2"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Move them to another folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"Keep the emails, then delete the emptied folder."})]})]})]})]}),e.jsx("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:e.jsx(C,{variant:"secondary",size:"sm",onClick:y,children:"Cancel"})})]}):x==="confirm-delete-all"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:g})," and its"," ",A(s.messageCount),"? The messages are removed from the server with the folder and can't be recovered."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(C,{variant:"secondary",size:"sm",onClick:()=>c("choose-fate"),children:"Back"}),e.jsx(C,{variant:"danger",size:"sm",icon:e.jsx(S,{className:"size-3.5"}),onClick:()=>j(),children:"Delete folder and emails"})]})]}):e.jsxs("div",{className:"flex h-80 flex-col",children:[e.jsxs("p",{className:"px-5 pt-4 text-sm text-fg-muted",children:["Move the ",A(s.messageCount)," in"," ",e.jsx("strong",{className:"text-fg",children:g})," to:"]}),e.jsx("div",{className:"min-h-0 flex-1 px-2 py-2",children:e.jsx(le,{mailboxes:i,onSelect:v=>k(v),onCreateFolder:p,onCancel:()=>c("choose-fate"),labels:{searchPlaceholder:"Move emails to…",optionLabel:v=>`Move to ${v}`,createLabel:v=>`Create "${v}"`}})})]});return e.jsxs(oe,{open:t,onClose:y,title:M,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx(ie,{className:"size-4 shrink-0 text-danger"}),e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:M}),e.jsx(C,{variant:"ghost",size:"sm",icon:e.jsx(ce,{className:"size-3.5"}),onClick:y,"aria-label":"Cancel"})]}),b]})}const Be=e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Each canonical role — Inbox, Drafts, Sent, Archive, Spam, Trash — points at one of your account's real folders. Pick the one that actually holds the mail; the message counts tell real folders from empty look-alikes."}),e.jsx("p",{children:`Appointing a folder to a role here doesn't touch any other role, and doesn't move or rename anything on the server — it just tells Remit which folder to treat as e.g. "Drafts" everywhere (sidebar, unread badges, the compose flow).`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Display name"})," renames the appointed folder for the sidebar. Leave it blank to use the role's canonical name."]})]});function Ke({accountId:t,mailboxes:a}){const{mutation:s}=Z(t),[n,d]=f.useState(""),[o,x]=f.useState(""),[c,r]=f.useState(),l=a[0]?.hierarchyDelimiter??"/",h=a.find(u=>u.mailboxId===o),m=h?{fullPath:h.fullPath,hierarchyDelimiter:h.hierarchyDelimiter}:void 0,j=m?.hierarchyDelimiter??l,k=()=>{const u=Ne({name:n,delimiter:j,parent:m,existingPaths:a.map(w=>w.fullPath)});if(u){r(u);return}r(void 0),s.mutate({path:{accountId:t},body:{fullPath:Ce(n,m),namespaceType:"personal"}},{onSuccess:()=>{d(""),x("")}})};return e.jsxs("div",{className:"space-y-2 rounded-sm border border-line bg-surface p-3",children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:"New folder"}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-end",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Name"}),e.jsx(K,{value:n,onChange:u=>{d(u.target.value),c&&r(void 0)},placeholder:"e.g. Receipts","aria-label":"Folder name",onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),k())}})]}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Inside (optional)"}),e.jsxs(B,{value:o,onChange:u=>x(u.target.value),"aria-label":"Parent folder",children:[e.jsx("option",{value:"",children:"No parent — top level"}),a.map(u=>e.jsx("option",{value:u.mailboxId,children:u.fullPath},u.mailboxId))]})]}),e.jsx(C,{variant:"primary",onClick:k,disabled:s.isPending||n.trim()==="",children:s.isPending?"Creating…":"Create folder"})]}),c&&e.jsx("p",{className:"text-xs text-danger",role:"alert",children:c}),s.isError&&e.jsx(L,{tone:"danger",variant:"soft",children:"Couldn't create that folder. Please try again."})]})}function Qe({account:t}){const a=Q(),s=t.accountId,{data:n,isPending:d,isError:o,error:x,refetch:c}=W(he({path:{accountId:s}})),r=$({...fe(),onSuccess:()=>{a.invalidateQueries({queryKey:H()})}}),l=$({...pe(),onSuccess:()=>{a.invalidateQueries({queryKey:G({path:{accountId:s}})})}}),[h,m]=f.useState(),j=(i,p)=>{r.mutate({path:{accountId:s,role:be[i]},body:{mailboxId:p}})},k=(i,p)=>{const g=p.trim();l.mutate({path:{accountId:s,mailboxId:i},body:{displayNameOverride:g===""?null:g}})};if(d)return e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":`Loading folders for ${t.email}`});if(o)return e.jsx(J,{variant:"inline",title:`Couldn't load folders for ${t.email}`,error:x,onRetry:()=>{c()}});const u=n.items.map(i=>({mailboxId:i.mailboxId,providerPath:i.fullPath,messageCount:i.messageCount})),w={};for(const i of t.folderAppointments){const p=ge[i.role];p&&(w[p]=i.mailboxId??null)}const y={};for(const i of n.items)i.displayNameOverride&&(y[i.mailboxId]=i.displayNameOverride);return e.jsxs("div",{className:"space-y-2",children:[(r.isError||l.isError)&&e.jsx(L,{tone:"danger",variant:"soft",children:"Couldn't save that change. Please try again."}),e.jsx(Me,{accountEmail:t.email,folders:u,appointments:w,displayNames:y,onAppoint:j,onRename:k}),e.jsx(Ke,{accountId:s,mailboxes:n.items}),e.jsx("ul",{className:"space-y-1","aria-label":`All folders for ${t.email}`,children:n.items.map(i=>{const p=Ee(i,n.items,t.folderAppointments),g=F(i.fullPath);return e.jsxs("li",{className:"flex items-center gap-2 rounded-sm px-2 py-1 text-sm text-fg",children:[e.jsx("span",{className:"truncate",children:g}),e.jsx("span",{className:"ml-auto shrink-0 text-xs text-fg-muted",children:i.fullPath}),e.jsx(C,{variant:"ghost",size:"sm",icon:e.jsx(S,{className:"size-3.5"}),"aria-label":`Delete ${g}`,disabled:!p.deletable,title:p.deletable?void 0:p.message,onClick:()=>m(i.mailboxId),className:p.deletable?void 0:"opacity-40"})]},i.mailboxId)})}),h&&(()=>{const i=n.items.find(p=>p.mailboxId===h);return i?e.jsx(qe,{open:!0,accountId:s,folder:i,mailboxes:n.items,appointments:t.folderAppointments,onClose:()=>m(void 0)}):null})()]})}function Xe(){const t=de(),[a,s]=f.useState(!0),{data:n,isPending:d,isError:o,error:x,refetch:c}=W(me()),r=l=>{const h=xe[l];h&&t({to:h})};return e.jsx(je,{items:ue,activeId:"folders",title:"Folder roles",description:"Appoint which real folder fills each canonical role, per account.",help:Be,helpOpen:a,onToggleHelp:()=>s(l=>!l),onSelect:r,onBackToMail:()=>{t({to:"/mail"})},children:d?e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):o?e.jsx(J,{title:"Couldn't load accounts",error:x,onRetry:()=>{c()}}):n.accounts.length===0?e.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):e.jsx("div",{className:"space-y-8",children:n.accounts.map(l=>e.jsx(Qe,{account:l},l.accountId))})})}export{Xe as component};
1
+ import{j as e,cp as B,r as f,cq as Y,bR as q,bS as K,B as C,k as ee,cr as te,a5 as Q,aS as H,bM as V,cs as se,ct as ae,bg as re,bB as G,aX as F,L as R,l as L,T as O,F as ne,K as le,D as oe,H as ie,X as ce,ak as de,aw as W,aH as me,c1 as ue,c3 as xe,al as he,az as z,cu as fe,cv as pe,cw as ge,cx as be}from"./index-DBLtMQVY.js";import{F as ve}from"./folder-jCYPM0QT.js";import{S as je}from"./settings-screen-DBuPiW9q.js";import{u as X,b as ye,v as Ne,c as Ce}from"./move-targets-DR3SzEM3.js";import{E as Z}from"./ErrorState-C-qt7L5W.js";import"./avatar-CypHN17J.js";const ke=["inbox","drafts","sent","archive","junk","trash"],T="";function we(t){const a=t.messageCount===1?"msg":"msgs";return`${B(t.providerPath)} · ${t.messageCount} ${a}`}function Me({role:t,folders:a,appointedId:s,displayName:n,onAppoint:d,onRename:o}){const[x,c]=f.useState(n),r=a.find(m=>m.mailboxId===s)??null,l=te(t),h=r!=null&&x.trim()!==n.trim();return e.jsxs("div",{className:"flex flex-col gap-1 border-b border-line px-row-inset py-2.5 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"flex w-28 shrink-0 items-center gap-2 text-sm font-medium text-fg",children:[Y(t),l]}),e.jsxs(q,{className:"w-56 shrink-0",value:s??T,"aria-label":`Folder for ${l}`,onChange:m=>d(t,m.target.value===T?null:m.target.value),children:[e.jsx("option",{value:T,children:"None"}),a.map(m=>e.jsx("option",{value:m.mailboxId,children:we(m)},m.mailboxId))]}),r&&e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"flex-1",value:x,placeholder:l,"aria-label":`Display name for ${l}`,onChange:m=>c(m.target.value)}),h&&e.jsx(C,{variant:"ghost",size:"sm",className:"shrink-0",icon:e.jsx(ee,{className:"size-4"}),"aria-label":"Save display name",onClick:()=>o(r.mailboxId,x)})]})]}),r&&e.jsxs("span",{className:"truncate pl-[7.5rem] text-2xs text-fg-subtle",title:r.providerPath,children:[r.providerPath," · ",r.messageCount," ",r.messageCount===1?"message":"messages"]})]})}function Ie({accountEmail:t,folders:a,appointments:s,displayNames:n={},onAppoint:d,onRename:o}){const x=new Set(Object.values(s).filter(r=>r!=null)),c=a.filter(r=>!x.has(r.mailboxId));return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsxs("h2",{className:"text-sm font-semibold text-fg",children:["Folder roles — ",t]}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Each role points to one folder. Pick the folder that holds the mail — the counts help you tell real folders from empty look-alikes. Appointing a folder here removes it from any other role."})]}),e.jsx("div",{className:"rounded-sm border border-line bg-surface",children:ke.map(r=>{const l=s[r]??null;return e.jsx(Me,{role:r,folders:a,appointedId:l,displayName:l?n[l]??"":"",onAppoint:d,onRename:o},r)})}),c.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("h3",{className:"text-xs font-medium text-fg-muted",children:"Other folders"}),e.jsx("ul",{className:"rounded-sm border border-line bg-surface",children:c.map(r=>e.jsxs("li",{className:"flex items-center gap-2 border-b border-line px-row-inset py-2 text-sm text-fg last:border-b-0",children:[e.jsx(ve,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate",children:B(r.providerPath)}),e.jsxs("span",{className:"ml-auto shrink-0 text-2xs text-fg-subtle",children:[r.messageCount," ",r.messageCount===1?"message":"messages"]})]},r.mailboxId))})]})]})}const Pe=100,Se=t=>t.trim().toLowerCase()==="inbox",De=(t,a)=>{const s=`${t.fullPath}${t.hierarchyDelimiter}`;return a.some(n=>n.mailboxId!==t.mailboxId&&n.fullPath.startsWith(s))},Oe=(t,a)=>a.find(s=>s.mailboxId!=null&&s.mailboxId===t)?.role;function Ee(t,a,s){if(Se(t.fullPath))return{deletable:!1,reason:"inbox",message:"The inbox can't be deleted."};const n=Oe(t.mailboxId,s);return n?{deletable:!1,reason:"role",message:`This folder is your ${n} folder. Reassign that role before deleting it.`}:De(t,a)?{deletable:!1,reason:"children",message:"This folder has subfolders. Delete them first."}:{deletable:!0}}function Te(t,a){return t.filter(s=>s.mailboxId!==a)}function Ae(t){return{total:t,moved:0,phase:t===0?"moved":"moving"}}function Fe(t,a){if(t.phase!=="moving")return t;const s=Math.min(t.total,t.moved+Math.max(0,a));return{...t,moved:s,phase:s>=t.total?"moved":"moving"}}function D(t,a){return{...t,phase:"failed",error:a}}function $(t){return`Moved ${t.moved} of ${t.total}`}function _(t){return t>0?"choose-fate":"confirm-empty"}const J=50,Le=t=>t instanceof Error?t.message:"Something went wrong.",P=t=>t.then(a=>({ok:!0,value:a}),a=>({ok:!1,error:Le(a)})),Re=async(t,a,s,n)=>{const d=[];let o;for(let x=0;x<J;x+=1){if(n.aborted)return d;const{data:c}=await G({path:{mailboxId:t},query:{order:"desc",continuationToken:o},throwOnError:!0});for(const r of c.items)if(!r.isDeleted&&!a.has(r.messageId)&&!d.includes(r.messageId)&&(d.push(r.messageId),d.length>=s))return d;if(!c.continuationToken)break;o=c.continuationToken}return d},ze=async(t,a)=>{let s=0,n;for(let d=0;d<J;d+=1){if(a.aborted)return s;const{data:o}=await G({path:{mailboxId:t},query:{order:"desc",continuationToken:n},throwOnError:!0});for(const x of o.items)x.isDeleted||(s+=1);if(!o.continuationToken)break;n=o.continuationToken}return s};function $e({accountId:t,mailboxId:a,onDeleted:s}){const n=Q(),[d,o]=f.useState("idle"),[x,c]=f.useState(null),[r,l]=f.useState(),h=f.useRef(null),m=f.useCallback(()=>{n.invalidateQueries({queryKey:H({path:{accountId:t}})}),n.invalidateQueries({queryKey:V()})},[n,t]),j=f.useCallback(async()=>{o("deleting");const i=await P(se({path:{accountId:t,mailboxId:a},throwOnError:!0}));if(!i.ok){l(i.error),o("error");return}m(),o("done"),s()},[t,a,m,s]),k=f.useCallback(()=>ae({path:{accountId:t},throwOnError:!0}).then(({data:i})=>i.items.find(p=>p.mailboxId===a)?.messageCount??0),[t,a]),u=f.useCallback(()=>{h.current?.abort()},[]),w=f.useCallback(async i=>{const p=new AbortController;h.current=p;const{signal:g}=p;o("moving"),l(void 0);const I=await P(k());if(g.aborted)return;if(!I.ok){l(I.error),o("error");return}let b=Ae(I.value);c(b);const v=new Set;for(;;){if(g.aborted)return;const N=await P(Re(a,v,Pe,g));if(g.aborted)return;if(!N.ok){b=D(b,N.error),c(b),l(N.error),o("error");return}const S=N.value;if(S.length===0)break;const E=await P(re({body:{messageIds:S,destinationMailboxId:i},throwOnError:!0}));if(g.aborted)return;if(!E.ok){b=D(b,E.error),c(b),l(E.error),o("error");return}for(const U of S)v.add(U);b=Fe(b,S.length),c(b)}const M=await P(ze(a,g));if(!g.aborted){if(!M.ok){b=D(b,M.error),c(b),l(M.error),o("error");return}if(M.value>0){const N=`${M.value} ${M.value===1?"email is":"emails are"} still syncing. Re-open delete to finish removing this folder.`;b=D(b,N),c(b),l(N),o("error"),m();return}await j()}},[a,k,j,m]),y=f.useCallback(()=>{h.current?.abort(),h.current=null,o("idle"),c(null),l(void 0)},[]);return{phase:d,progress:x,errorMessage:r,deleteMailbox:j,moveThenDelete:w,cancel:u,reset:y}}const _e=t=>t.displayNameOverride?.trim()||F(t.fullPath),A=t=>`${t} ${t===1?"email":"emails"}`;function Be({open:t,accountId:a,folder:s,mailboxes:n,appointments:d,onClose:o}){const[x,c]=f.useState(()=>_(s.messageCount)),{createFolder:r}=X(a),{phase:l,progress:h,errorMessage:m,deleteMailbox:j,moveThenDelete:k,cancel:u,reset:w}=$e({accountId:a,mailboxId:s.mailboxId,onDeleted:o});f.useEffect(()=>{t&&(c(_(s.messageCount)),w())},[t,s.messageCount,w]),f.useEffect(()=>u,[u]);const y=f.useCallback(()=>{u(),o()},[u,o]),i=f.useMemo(()=>Te(ye(n,d),s.mailboxId).map(v=>({id:v.mailboxId,label:F(v.fullPath),searchValue:v.fullPath})),[n,d,s.mailboxId]),p=async(v,M)=>{const N=await r(v,M);return{id:N.id,label:N.label}};if(!t)return null;const g=_e(s),I=`Delete ${g}`,b=l==="moving"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(R,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving emails…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:h?$(h):"Moved 0 of 0"})]}):l==="deleting"||l==="done"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(R,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Deleting folder…"})]}):l==="error"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(L,{tone:"danger",variant:"soft",children:m??"Something went wrong. Please try again."}),h&&e.jsxs("p",{className:"text-xs text-fg-muted",children:[$(h),". Already-moved emails stay moved — re-open delete to continue with the rest."]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(C,{variant:"secondary",size:"sm",onClick:y,children:"Close"})})]}):x==="confirm-empty"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:g}),"? This folder is empty and will be removed from the server."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(C,{variant:"secondary",size:"sm",onClick:y,children:"Cancel"}),e.jsx(C,{variant:"danger",size:"sm",icon:e.jsx(O,{className:"size-3.5"}),onClick:()=>j(),children:"Delete folder"})]})]}):x==="choose-fate"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:g})," holds"," ",A(s.messageCount),". What should happen to them?"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{type:"button",onClick:()=>c("confirm-delete-all"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(O,{className:"size-4 shrink-0 text-danger"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Delete them with the folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"The emails are removed from the server and can't be recovered."})]})]}),e.jsxs("button",{type:"button",onClick:()=>c("pick-destination"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(ne,{className:"size-4 shrink-0 text-accent-2"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Move them to another folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"Keep the emails, then delete the emptied folder."})]})]})]})]}),e.jsx("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:e.jsx(C,{variant:"secondary",size:"sm",onClick:y,children:"Cancel"})})]}):x==="confirm-delete-all"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:g})," and its"," ",A(s.messageCount),"? The messages are removed from the server with the folder and can't be recovered."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(C,{variant:"secondary",size:"sm",onClick:()=>c("choose-fate"),children:"Back"}),e.jsx(C,{variant:"danger",size:"sm",icon:e.jsx(O,{className:"size-3.5"}),onClick:()=>j(),children:"Delete folder and emails"})]})]}):e.jsxs("div",{className:"flex h-80 flex-col",children:[e.jsxs("p",{className:"px-5 pt-4 text-sm text-fg-muted",children:["Move the ",A(s.messageCount)," in"," ",e.jsx("strong",{className:"text-fg",children:g})," to:"]}),e.jsx("div",{className:"min-h-0 flex-1 px-2 py-2",children:e.jsx(le,{mailboxes:i,onSelect:v=>k(v),onCreateFolder:p,onCancel:()=>c("choose-fate"),labels:{searchPlaceholder:"Move emails to…",optionLabel:v=>`Move to ${v}`,createLabel:v=>`Create "${v}"`}})})]});return e.jsxs(oe,{open:t,onClose:y,title:I,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx(ie,{className:"size-4 shrink-0 text-danger"}),e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:I}),e.jsx(C,{variant:"ghost",size:"sm",icon:e.jsx(ce,{className:"size-3.5"}),onClick:y,"aria-label":"Cancel"})]}),b]})}const qe=e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Each canonical role — Inbox, Drafts, Sent, Archive, Spam, Trash — points at one of your account's real folders. Pick the one that actually holds the mail; the message counts tell real folders from empty look-alikes."}),e.jsx("p",{children:`Appointing a folder to a role here doesn't touch any other role, and doesn't move or rename anything on the server — it just tells Remit which folder to treat as e.g. "Drafts" everywhere (sidebar, unread badges, the compose flow).`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Display name"})," renames the appointed folder for the sidebar. Leave it blank to use the role's canonical name."]})]});function Ke({accountId:t,mailboxes:a}){const{mutation:s}=X(t),[n,d]=f.useState(""),[o,x]=f.useState(""),[c,r]=f.useState(),l=a[0]?.hierarchyDelimiter??"/",h=a.find(u=>u.mailboxId===o),m=h?{fullPath:h.fullPath,hierarchyDelimiter:h.hierarchyDelimiter}:void 0,j=m?.hierarchyDelimiter??l,k=()=>{const u=Ne({name:n,delimiter:j,parent:m,existingPaths:a.map(w=>w.fullPath)});if(u){r(u);return}r(void 0),s.mutate({path:{accountId:t},body:{fullPath:Ce(n,m),namespaceType:"personal"}},{onSuccess:()=>{d(""),x("")}})};return e.jsxs("div",{className:"space-y-2 rounded-sm border border-line bg-surface p-3",children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:"New folder"}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-end",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Name"}),e.jsx(K,{value:n,onChange:u=>{d(u.target.value),c&&r(void 0)},placeholder:"e.g. Receipts","aria-label":"Folder name",onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),k())}})]}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Inside (optional)"}),e.jsxs(q,{value:o,onChange:u=>x(u.target.value),"aria-label":"Parent folder",children:[e.jsx("option",{value:"",children:"No parent — top level"}),a.map(u=>e.jsx("option",{value:u.mailboxId,children:u.fullPath},u.mailboxId))]})]}),e.jsx(C,{variant:"primary",onClick:k,disabled:s.isPending||n.trim()==="",children:s.isPending?"Creating…":"Create folder"})]}),c&&e.jsx("p",{className:"text-xs text-danger",role:"alert",children:c}),s.isError&&e.jsx(L,{tone:"danger",variant:"soft",children:"Couldn't create that folder. Please try again."})]})}function Qe({account:t}){const a=Q(),s=t.accountId,{data:n,isPending:d,isError:o,error:x,refetch:c}=W(he({path:{accountId:s}})),r=z({...fe(),onSuccess:()=>{a.invalidateQueries({queryKey:V()})}}),l=z({...pe(),onSuccess:()=>{a.invalidateQueries({queryKey:H({path:{accountId:s}})})}}),[h,m]=f.useState(),j=(i,p)=>{r.mutate({path:{accountId:s,role:be[i]},body:{mailboxId:p}})},k=(i,p)=>{const g=p.trim();l.mutate({path:{accountId:s,mailboxId:i},body:{displayNameOverride:g===""?null:g}})};if(d)return e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":`Loading folders for ${t.email}`});if(o)return e.jsx(Z,{variant:"inline",title:`Couldn't load folders for ${t.email}`,error:x,onRetry:()=>{c()}});const u=n.items.map(i=>({mailboxId:i.mailboxId,providerPath:i.fullPath,messageCount:i.messageCount})),w={};for(const i of t.folderAppointments){const p=ge[i.role];p&&(w[p]=i.mailboxId??null)}const y={};for(const i of n.items)i.displayNameOverride&&(y[i.mailboxId]=i.displayNameOverride);return e.jsxs("div",{className:"space-y-2",children:[(r.isError||l.isError)&&e.jsx(L,{tone:"danger",variant:"soft",children:"Couldn't save that change. Please try again."}),e.jsx(Ie,{accountEmail:t.email,folders:u,appointments:w,displayNames:y,onAppoint:j,onRename:k}),e.jsx(Ke,{accountId:s,mailboxes:n.items}),e.jsx("ul",{className:"space-y-1","aria-label":`All folders for ${t.email}`,children:n.items.map(i=>{const p=Ee(i,n.items,t.folderAppointments),g=F(i.fullPath);return e.jsxs("li",{className:"flex items-center gap-2 rounded-sm px-2 py-1 text-sm text-fg",children:[e.jsx("span",{className:"truncate",children:g}),e.jsx("span",{className:"ml-auto shrink-0 text-xs text-fg-muted",children:i.fullPath}),e.jsx(C,{variant:"ghost",size:"sm",icon:e.jsx(O,{className:"size-3.5"}),"aria-label":`Delete ${g}`,disabled:!p.deletable,title:p.deletable?void 0:p.message,onClick:()=>m(i.mailboxId),className:p.deletable?void 0:"opacity-40"})]},i.mailboxId)})}),h&&(()=>{const i=n.items.find(p=>p.mailboxId===h);return i?e.jsx(Be,{open:!0,accountId:s,folder:i,mailboxes:n.items,appointments:t.folderAppointments,onClose:()=>m(void 0)}):null})()]})}function Je(){const t=de(),[a,s]=f.useState(!0),{data:n,isPending:d,isError:o,error:x,refetch:c}=W(me()),r=l=>{const h=xe[l];h&&t({to:h})};return e.jsx(je,{items:ue,activeId:"folders",title:"Folder roles",description:"Appoint which real folder fills each canonical role, per account.",help:qe,helpOpen:a,onToggleHelp:()=>s(l=>!l),onSelect:r,onBackToMail:()=>{t({to:"/mail"})},children:d?e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):o?e.jsx(Z,{title:"Couldn't load accounts",error:x,onRetry:()=>{c()}}):n.accounts.length===0?e.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):e.jsx("div",{className:"space-y-8",children:n.accounts.map(l=>e.jsx(Qe,{account:l},l.accountId))})})}export{Je as component};
@@ -1 +1 @@
1
- const c=()=>typeof navigator<"u"&&(navigator.language||navigator.languages?.[0])||"en-US",g=(e,t)=>new Intl.NumberFormat(c(),t).format(e),D=/^-?\d+$/,f=e=>{if(e instanceof Date)return e;if(typeof e=="number")return new Date(e);if(typeof e=="string"){const t=e.trim();return D.test(t)?new Date(Number(t)):new Date(t)}return new Date(Number.NaN)},d=e=>Number.isFinite(e.getTime()),o=(e,t)=>{const n=f(e);return d(n)?new Intl.DateTimeFormat(c(),t).format(n):""},y=(e,t)=>o(e,{short:{month:"short",day:"numeric"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"},time:{hour:"numeric",minute:"numeric"},datetime:{month:"short",day:"numeric",hour:"numeric",minute:"numeric"}}[t]),l=e=>{const t=f(e);if(!d(t))return"";const n=new Intl.RelativeTimeFormat(c(),{numeric:"auto"}),s=Date.now(),r=t.getTime()-s,i=Math.round(r/1e3),a=Math.round(r/(1e3*60)),u=Math.round(r/(1e3*60*60)),m=Math.round(r/(1e3*60*60*24)),h=Math.round(r/(1e3*60*60*24*7));return Math.abs(i)<60?n.format(i,"second"):Math.abs(a)<60?n.format(a,"minute"):Math.abs(u)<24?n.format(u,"hour"):Math.abs(m)<7?n.format(m,"day"):Math.abs(h)<4?n.format(h,"week"):y(t,"medium")},w=e=>{const t=f(e);if(!d(t))return"";const n=new Date,s=t.toDateString()===n.toDateString(),r=new Date(n);r.setDate(r.getDate()-1);const i=t.toDateString()===r.toDateString(),a=new Date(n);a.setDate(a.getDate()-6);const u=t>=a&&t<n,m=t.getFullYear()===n.getFullYear();return s?o(t,{hour:"numeric",minute:"numeric"}):i?"Yesterday":u?o(t,{weekday:"long"}):m?o(t,{month:"short",day:"numeric"}):o(t,{month:"short",day:"numeric",year:"numeric"})},b=(e,t=!1)=>{const n=e===1?"1":g(e);return`Move ${t?"about ":""}${n} ${e===1?"message":"messages"} to Trash?`};export{w as a,b,o as c,g as d,l as e,y as f,f as t};
1
+ const c=()=>typeof navigator<"u"&&(navigator.language||navigator.languages?.[0])||"en-US",g=(e,t)=>new Intl.NumberFormat(c(),t).format(e),D=/^-?\d+$/,f=e=>{if(e instanceof Date)return e;if(typeof e=="number")return new Date(e);if(typeof e=="string"){const t=e.trim();return D.test(t)?new Date(Number(t)):new Date(t)}return new Date(Number.NaN)},d=e=>Number.isFinite(e.getTime()),o=(e,t)=>{const n=f(e);return d(n)?new Intl.DateTimeFormat(c(),t).format(n):""},y=(e,t)=>o(e,{short:{month:"short",day:"numeric"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"},time:{hour:"numeric",minute:"numeric"},datetime:{month:"short",day:"numeric",hour:"numeric",minute:"numeric"}}[t]),l=e=>{const t=f(e);if(!d(t))return"";const n=new Intl.RelativeTimeFormat(c(),{numeric:"auto"}),s=Date.now(),r=t.getTime()-s,i=Math.round(r/1e3),a=Math.round(r/(1e3*60)),u=Math.round(r/(1e3*60*60)),m=Math.round(r/(1e3*60*60*24)),h=Math.round(r/(1e3*60*60*24*7));return Math.abs(i)<60?n.format(i,"second"):Math.abs(a)<60?n.format(a,"minute"):Math.abs(u)<24?n.format(u,"hour"):Math.abs(m)<7?n.format(m,"day"):Math.abs(h)<4?n.format(h,"week"):y(t,"medium")},w=e=>{const t=f(e);if(!d(t))return"";const n=new Date,s=t.toDateString()===n.toDateString(),r=new Date(n);r.setDate(r.getDate()-1);const i=t.toDateString()===r.toDateString(),a=new Date(n);a.setDate(a.getDate()-6);const u=t>=a&&t<n,m=t.getFullYear()===n.getFullYear();return s?o(t,{hour:"numeric",minute:"numeric"}):i?"Yesterday":u?o(t,{weekday:"long"}):m?o(t,{month:"short",day:"numeric"}):o(t,{month:"short",day:"numeric",year:"numeric"})},b=(e,t=!1)=>{const n=e===1?"1":g(e);return`Move ${t?"about ":""}${n} ${e===1?"message":"messages"} to Trash?`};export{w as a,b,g as c,o as d,l as e,y as f,f as t};
@@ -0,0 +1 @@
1
+ import{j as t,bN as o}from"./index-DBLtMQVY.js";const n=()=>t.jsx(o,{to:"/settings/accounts"});export{n as component};