| 123 |
- import{a as e,n as t,r as n}from"./react-dom-stZKkA6x.js";import{d as r,f as i,i as a,l as o,o as s,r as c}from"./theme-Dpxy803y.js";import{G as l,M as u,i as d,kt as f,n as p,st as ee,t as m}from"./jsx-runtime-dm82oUI8.js";import{a as te,i as ne,o as h,t as re}from"./grid-DzYWI3CD.js";import{n as ie,t as ae}from"./table-DJa-z-YA.js";import{t as oe}from"./badge-CT2dDAGA.js";import{i as se,n as ce,t as le}from"./SectionCard--w8cgqOe.js";import{t as ue}from"./input-number-5vwSxUlw.js";import{t as g}from"./descriptions-vs1os_w7.js";import{t as _}from"./form-Dp5ppmPu.js";import{t as v}from"./input-0_Xo22Fl.js";import{t as y}from"./list-BnsJjSCP.js";import{t as de}from"./modal-BGjs3E6e.js";import{t as b}from"./CopyOutlined-UbpGsh_G.js";import{n as x,t as fe}from"./EditOutlined-Xr2lIYb3.js";import{t as pe}from"./ExportOutlined-CUq8majW.js";import{t as me}from"./PlusOutlined-DoGMjNQS.js";import{t as he}from"./ReloadOutlined-9AZGcoed.js";import{t as ge}from"./SearchOutlined-CGjQXOn5.js";import{_ as S,a as C,b as _e,f as ve,h as ye,i as be,m as xe,n as Se,p as Ce,r as w,s as T,t as we}from"./index-DG1WRIOp.js";import{t as E}from"./EmptyState-rI31ioMm.js";import{t as Te}from"./MailboxPermissionTags-W1srDjlA.js";import{t as Ee}from"./StatusPill-BM21x0ED.js";import{t as D}from"./CodeBlock-z4Jy8-Be.js";import{n as De,t as Oe}from"./navigation-state-ixI_efPF.js";var O=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-40 824H232V687h97.9c11.6 32.8 32 62.3 59.1 84.7 34.5 28.5 78.2 44.3 123 44.3s88.5-15.7 123-44.3c27.1-22.4 47.5-51.9 59.1-84.7H792v-63H643.6l-5.2 24.7C626.4 708.5 573.2 752 512 752s-114.4-43.5-126.5-103.3l-5.2-24.7H232V136h560v752zM320 341h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zm0 160h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z`}}]},name:`container`,theme:`outlined`}})),k=e(t()),ke=e(O());function A(){return A=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},A.apply(this,arguments)}var Ae=k.forwardRef((e,t)=>k.createElement(r,A({},e,{ref:t,icon:ke.default}))),j=e(n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z`}}]},name:`file-text`,theme:`outlined`}}))());function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},M.apply(this,arguments)}var je=k.forwardRef((e,t)=>k.createElement(r,M({},e,{ref:t,icon:j.default}))),N=e(n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M880 298.4H521L403.7 186.2a8.15 8.15 0 00-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z`}}]},name:`folder`,theme:`outlined`}}))());function P(){return P=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},P.apply(this,arguments)}var Me=k.forwardRef((e,t)=>k.createElement(r,P({},e,{ref:t,icon:N.default}))),F=m(),Ne=[`INBOX`,`Sent`,`Drafts`,`Trash`,`Junk`,`Archive`];function Pe(){let{message:e}=i.useApp(),t=re.useBreakpoint(),n=we(`(min-width: 1280px)`),{locale:r,t:u}=s(),{config:m,user:oe}=Se(),b=ve(),x=Ce(),pe=xe(),[C,w]=ye(),[T]=_.useForm(),[D]=_.useForm(),[O,ke]=(0,k.useState)([]),[A,Ae]=(0,k.useState)([]),[j,M]=(0,k.useState)([]),[je,N]=(0,k.useState)(Je()),[P,Me]=(0,k.useState)([]),[Ne,Pe]=(0,k.useState)(0),[I,L]=(0,k.useState)(null),[R,Xe]=(0,k.useState)(!0),[Ze,Qe]=(0,k.useState)(!1),[z,ot]=(0,k.useState)(!1),[st,ct]=(0,k.useState)(!1),[lt,ut]=(0,k.useState)(``),[dt,ft]=(0,k.useState)(``),[pt,mt]=(0,k.useState)(``),[ht,gt]=(0,k.useState)(``),[_t,vt]=(0,k.useState)(``),[yt,bt]=(0,k.useState)(``),[xt,St]=(0,k.useState)(``),[Ct,wt]=(0,k.useState)(()=>new Set),[Tt,Et]=(0,k.useState)(C.get(`q`)||``),[Dt,Ot]=(0,k.useState)(!1),[V,kt]=(0,k.useState)(null),[At,jt]=(0,k.useState)(``),[Mt,Nt]=(0,k.useState)(`activity`),[Pt,Ft]=(0,k.useState)(``),[It,Lt]=(0,k.useState)(`domain`),[Rt,H]=(0,k.useState)(null),[zt,Bt]=(0,k.useState)(null),Vt=(0,k.useRef)(null),Ht=(0,k.useRef)(0),U=(0,k.useRef)(0),W=(0,k.useRef)(0),G=(0,k.useRef)(0),K=(0,k.useRef)(0),q=C.get(`workspace`)===`routing`?`routing`:`messages`,J=Number(C.get(`mailboxId`)||0)||null,Ut=C.get(`folder`)||`INBOX`,Wt=C.get(`read`)||`all`,Gt=C.get(`q`)||``,Kt=Math.max(1,Number(C.get(`page`)||1)||1),Y=Number(pe.messageId||0)||null,qt=Re(C.get(`tab`));(0,k.useEffect)(()=>{Et(Gt)},[Gt]);let X=(0,k.useMemo)(()=>j.filter(e=>tt(e).receive),[j]),Jt=(0,k.useMemo)(()=>X.map(e=>({value:e.id,label:r.startsWith(`en`)?`${e.address} · ${B(e.unreadCount)} unread / ${B(e.messageCount)} total${e.access?.type===`assigned`?` · Admin assigned`:``}`:`${e.address} · ${B(e.unreadCount)} 未读 / ${B(e.messageCount)} 封${e.access?.type===`assigned`?` · 管理员分配`:``}`})),[r,X]),Yt=(0,k.useMemo)(()=>A.map(e=>{let t=oe?.id===e.userId;return{value:e.domain,label:(0,F.jsxs)(d,{size:8,children:[(0,F.jsxs)(p.Text,{children:[`@`,e.domain]}),(0,F.jsx)(S,{color:t?`blue`:`purple`,children:u(t?`inbox.ownDomain`:`inbox.sharedDomain`)})]})}}),[A,u,oe?.id]),Xt=(0,k.useMemo)(()=>Ue(He(j,At),Mt),[At,Mt,j]),Zt=(0,k.useMemo)(()=>Ke(Ge(O,Pt),It),[O,Pt,It]),Z=(0,k.useCallback)(async()=>{let e=++Ht.current;Xe(!0),ut(``),ft(``);let[t,n,r]=await Promise.allSettled([c.domains(),c.inboundMailboxDomains(),c.inboundMailboxes(`effective`)]);e===Ht.current&&(t.status===`fulfilled`?ke(t.value.domains||[]):ft(t.reason instanceof Error?t.reason.message:u(`common.error`)),n.status===`fulfilled`?Ae(n.value.domains||[]):ft(n.reason instanceof Error?n.reason.message:u(`common.error`)),r.status===`fulfilled`?M(r.value.mailboxes||[]):ut(r.reason instanceof Error?r.reason.message:u(`common.error`)),Xe(!1))},[u]);(0,k.useEffect)(()=>(Z(),()=>{Ht.current+=1}),[Z]),(0,k.useEffect)(()=>{if(!X.length||Y&&(!C.has(`mailboxId`)||!C.has(`folder`))||J&&X.some(e=>e.id===J))return;let e=Ve(X,J);if(!e)return;let t=new URLSearchParams(C);t.set(`mailboxId`,String(e)),t.set(`folder`,`INBOX`),t.set(`page`,`1`),w(t,{replace:!0})},[X,Y,C,J,w]);let Q=(0,k.useCallback)(async()=>{let e=++U.current;if(!J||!X.some(e=>e.id===J)){N(Je()),vt(``),ct(!1);return}ct(!0),vt(``),N(Je());try{let t=await c.inboundFolders(J);if(e!==U.current)return;if(!t.folders?.length)throw Error(r.startsWith(`en`)?`Folder counts are unavailable.`:`文件夹计数暂不可用。`);N(t.folders.map(e=>({...e,countsAvailable:!0})))}catch(t){if(e!==U.current)return;N(Je()),vt(t instanceof Error?t.message:r.startsWith(`en`)?`Unable to load folder counts.`:`文件夹计数加载失败。`)}finally{e===U.current&&ct(!1)}},[r,X,J]);(0,k.useEffect)(()=>(Q(),()=>{U.current+=1}),[Q]);let $=(0,k.useCallback)(async()=>{let e=++W.current;if(!J||q!==`messages`||!X.some(e=>e.id===J)){Me([]),Pe(0),mt(``),Qe(!1);return}Qe(!0),mt(``);try{let t=await c.inboundMessages({mailboxId:J,folder:Ut,page:Kt,pageSize:25,q:Gt||void 0,read:Wt===`read`?!0:Wt===`unread`?!1:void 0});if(e!==W.current)return;Me(t.messages||[]),Pe(t.total??t.messages?.length??0)}catch(t){e===W.current&&mt(t instanceof Error?t.message:u(`common.error`))}finally{e===W.current&&Qe(!1)}},[Ut,Kt,Gt,Wt,X,J,u,q]);(0,k.useEffect)(()=>($(),()=>{W.current+=1}),[$]),(0,k.useEffect)(()=>{let e=++G.current;if(K.current+=1,bt(``),!Y){L(null),gt(``),ot(!1);return}return ot(!0),gt(``),c.inboundMessage(Y).then(t=>{if(e!==G.current)return;let n=t.message;if(!n){gt(u(`inbox.messageNotFound`));return}if(L(n),!n.read){let t=++K.current;c.markInboundMessageRead(n.id,!0).then(()=>{e!==G.current||t!==K.current||(L(e=>e?.id===n.id?{...e,read:!0}:e),Me(e=>e.map(e=>e.id===n.id?{...e,read:!0}:e)),M(e=>e.map(e=>e.id===n.mailboxId?{...e,unreadCount:Math.max(0,(e.unreadCount??0)-1)}:e)),Q())}).catch(n=>{e!==G.current||t!==K.current||bt(n instanceof Error?n.message:r.startsWith(`en`)?`Unable to mark this message as read.`:`邮件标记已读失败。`)})}}).catch(t=>{e===G.current&>(t instanceof Error?t.message:u(`inbox.detailLoadFailed`))}).finally(()=>{e===G.current&&ot(!1)}),()=>{G.current===e&&(G.current+=1),K.current+=1}},[Q,r,Y,u]),(0,k.useEffect)(()=>{if(!Y||I?.id!==Y||C.has(`mailboxId`)&&C.has(`folder`))return;let e=new URLSearchParams(C);e.set(`mailboxId`,String(I.mailboxId)),e.set(`folder`,I.folder||`INBOX`),w(e,{replace:!0})},[Y,C,I,w]),(0,k.useEffect)(()=>{let e=Vt.current;!e||De(b.state)?.origin===`direct`||(Vt.current=null,x(e,{replace:!0}))},[b.key,b.state,x]);function Qt(e){let t=new URLSearchParams(C);Object.entries(e).forEach(([e,n])=>{n===null||n===``?t.delete(e):t.set(e,String(n))}),w(t)}function $t(e){let t=new URLSearchParams(C);e===`routing`?t.set(`workspace`,`routing`):t.delete(`workspace`);let n=t.toString();x(`/inbox${n?`?${n}`:``}`)}function en(e){let t=new URLSearchParams(C);t.set(`mailboxId`,String(e)),t.set(`folder`,`INBOX`),t.set(`page`,`1`);let n=t.toString();x(`/inbox${n?`?${n}`:``}`)}function tn(e){let t=new URLSearchParams(C);t.set(`folder`,e),t.set(`page`,`1`);let n=t.toString();x(`/inbox${n?`?${n}`:``}`)}function nn(e){L(e);let t=C.toString(),n=`/inbox/messages/${e.id}${t?`?${t}`:``}`,r=De(b.state);if(r){x(n,{state:Oe(r.listPath,r.depth+1,r.origin)});return}if(Y){x(n,{replace:!0});return}x(n,{state:Oe(`${b.pathname}${b.search}`,1)})}function rn(){let e=De(b.state);if(e?.origin===`list`){x(-e.depth);return}let t=I?.id===Y?I:null,n=ze(C,t);if(e?.origin===`direct`){Vt.current=n,x(-e.depth);return}x(n,{replace:!0})}function an(e){let t=new URLSearchParams(C);e===`text`?t.delete(`tab`):t.set(`tab`,e);let n=De(b.state),r=I?.id===Y?I:null,i=t.toString();x({pathname:b.pathname,search:i?`?${i}`:``},{state:Oe(n?.listPath||ze(C,r),(n?.depth||0)+1,n?.origin||`direct`)})}async function on(t){t&&(await navigator.clipboard.writeText(t),e.success(u(`common.copied`)))}async function sn(t){if(!(m?.webmailSsoEnabled!==!0||!nt(t)||t.status!==`active`||Ct.has(t.id))){wt(e=>new Set(e).add(t.id));try{a((await c.createWebmailLogin(t.id)).webmailLogin)}catch(t){e.error(t instanceof Error?t.message:u(`common.error`))}finally{wt(e=>{let n=new Set(e);return n.delete(t.id),n})}}}function cn(){kt(null),T.resetFields(),T.setFieldsValue({domain:A[0]?.domain,password:et(),quotaMb:1024,keepForwarded:!0,status:`active`}),Ot(!0)}function ln(e){kt(e),T.resetFields(),T.setFieldsValue({localPart:e.localPart,domain:e.domain,password:``,displayName:e.displayName,quotaMb:e.quotaMb,aliases:e.aliases.join(`
- `),forwardTo:e.forwardTo.join(`
- `),keepForwarded:e.keepForwarded,status:e.status}),Ot(!0)}function un(){Ot(!1),kt(null),T.resetFields()}async function dn(){let t=await T.validateFields(),n=V?`mailbox:update:${V.id}`:`mailbox:create`;St(n);try{if(V){let n=String(t.password||``).trim(),i=await c.updateInboundMailbox(V.id,{displayName:t.displayName||``,aliases:t.aliases||``,forwardTo:t.forwardTo||``,keepForwarded:!!t.keepForwarded,quotaMb:t.quotaMb??null,status:t.status||V.status,...n?{password:n}:{}});e.success(r.startsWith(`en`)?`Mailbox updated`:`收信邮箱已更新`),n&&H(i.clientConfig||$e(i.mailbox,m,n))}else{let n=await c.createInboundMailbox({address:`${t.localPart}@${t.domain}`,displayName:t.displayName,password:t.password,aliases:t.aliases,forwardTo:t.forwardTo,keepForwarded:t.keepForwarded,quotaMb:t.quotaMb});e.success(u(`actions.inboundMailboxCreated`)),H(n.clientConfig||$e(n.mailbox,m,t.password))}un(),await Z()}catch(t){e.error(t instanceof Error?t.message:u(`common.error`))}finally{St(``)}}function fn(e){Bt(e),D.setFieldsValue({catchAllAddress:e.catchAllAddress||``})}async function pn(){if(!zt)return;let t=await D.validateFields();St(`catch-all:${zt.id}`);try{let n=await c.patchDomain(zt.id,{catchAllAddress:String(t.catchAllAddress||``).trim()});ke(e=>e.map(e=>e.id===n.domain.id?n.domain:e)),Bt(null),e.success(u(`actions.domainSaved`))}catch(t){e.error(t instanceof Error?t.message:u(`common.error`))}finally{St(``)}}function mn(e,t=!1){let n=it(e,oe?.id);return(0,F.jsxs)(d,{direction:`vertical`,size:8,className:t?`full-width`:void 0,children:[m?.webmailSsoEnabled===!0&&nt(e)?(0,F.jsx)(rt,{block:t,mailbox:e,locale:r,loading:Ct.has(e.id),onClick:()=>void sn(e)}):null,n?(0,F.jsxs)(d,{wrap:!0,children:[(0,F.jsx)(f,{icon:(0,F.jsx)(fe,{}),onClick:()=>ln(e),children:u(`common.edit`)}),(0,F.jsx)(f,{icon:(0,F.jsx)(be,{}),onClick:()=>H($e(e,m)),children:u(`inbox.clientConfig`)}),(0,F.jsx)(f,{icon:(0,F.jsx)(o,{}),onClick:()=>x(`/integrations/webhooks?mailboxId=${e.id}`),children:u(`inbox.mailboxWebhooks`)})]}):(0,F.jsx)(p.Text,{type:`secondary`,children:u(`inbox.ownerManaged`)})]})}let hn=[{title:u(`inbox.mailboxAddress`),dataIndex:`address`,render:(e,t)=>(0,F.jsxs)(d,{direction:`vertical`,size:0,children:[(0,F.jsx)(p.Text,{strong:!0,children:e}),t.displayName?(0,F.jsx)(p.Text,{type:`secondary`,children:t.displayName}):null]})},{title:u(`account.accessSource`),width:150,render:(e,t)=>(0,F.jsx)(at,{mailbox:t,t:u})},{title:u(`account.permissions`),width:240,render:(e,t)=>(0,F.jsx)(Te,{permissions:tt(t)})},{title:u(`common.status`),dataIndex:`status`,width:120,render:e=>(0,F.jsx)(Ee,{tone:e===`active`?`success`:`warning`,children:e})},{title:u(`inbox.forwardTo`),dataIndex:`forwardTo`,render:(e,t)=>e?.length?(0,F.jsxs)(d,{direction:`vertical`,size:2,children:[(0,F.jsx)(p.Text,{children:e.join(`, `)}),(0,F.jsx)(S,{children:t.keepForwarded?u(`inbox.keepForwarded`):u(`inbox.forwardOnly`)})]}):`—`},{title:u(`inbox.unread`),dataIndex:`unreadCount`,width:90,render:B},{title:u(`inbox.messageCount`),dataIndex:`messageCount`,width:100,render:B},{title:u(`common.actions`),width:390,render:(e,t)=>mn(t)}],gn=[{title:u(`domains.domain`),dataIndex:`domain`,render:e=>(0,F.jsx)(p.Text,{strong:!0,children:e})},{title:u(`inbox.catchAllAddress`),dataIndex:`catchAllAddress`,render:e=>e?(0,F.jsx)(S,{color:e===`/dev/null`?`default`:`blue`,children:e}):(0,F.jsx)(S,{children:u(`inbox.catchAllDisabled`)})},{title:u(`common.actions`),width:130,render:(e,t)=>(0,F.jsx)(f,{icon:(0,F.jsx)(be,{}),onClick:()=>fn(t),children:u(`common.edit`)})}];return R?(0,F.jsx)(le,{children:(0,F.jsx)(ee,{active:!0,paragraph:{rows:12}})}):(0,F.jsxs)(d,{direction:`vertical`,size:20,className:`full-width`,children:[(0,F.jsx)(ce,{title:u(`inbox.title`),subtitle:u(`inbox.subtitle`),extra:q===`routing`?(0,F.jsx)(f,{type:`primary`,icon:(0,F.jsx)(me,{}),disabled:!A.length,onClick:cn,style:{minHeight:44},children:u(`inbox.createMailbox`)}):null}),lt?(0,F.jsx)(h,{type:`error`,showIcon:!0,message:lt,action:(0,F.jsx)(f,{icon:(0,F.jsx)(he,{}),onClick:()=>void Z(),children:u(`common.refresh`)})}):null,dt?(0,F.jsx)(h,{type:`warning`,showIcon:!0,message:r.startsWith(`en`)?`Domain and routing options are temporarily unavailable.`:`域名与路由选项暂不可用。`,description:dt,action:(0,F.jsx)(f,{icon:(0,F.jsx)(he,{}),onClick:()=>void Z(),children:u(`common.refresh`)})}):null,m?.submission?.inboundEnabled===!1?(0,F.jsx)(h,{type:`warning`,showIcon:!0,message:u(`inbox.inboundDisabled`)}):null,(0,F.jsx)(te,{activeKey:q,onChange:$t,items:[{key:`messages`,label:(0,F.jsxs)(d,{children:[(0,F.jsx)(o,{}),r.startsWith(`en`)?`Mail`:`邮件`]})},{key:`routing`,label:(0,F.jsxs)(d,{children:[(0,F.jsx)(be,{}),r.startsWith(`en`)?`Mailboxes & routing`:`邮箱与路由`]})}]}),q===`messages`?lt&&!j.length?null:X.length?(0,F.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:n?`220px minmax(320px, 380px) minmax(0, 1fr)`:t.md?`220px minmax(0, 1fr)`:`minmax(0, 1fr)`,gap:16,minWidth:0},children:[t.md?(0,F.jsx)(Fe,{mailboxOptions:Jt,selectedMailboxId:J,folders:je,foldersLoading:st,foldersError:_t,activeFolder:Ut,onMailbox:en,onFolder:tn,onRetryFolders:Q,locale:r,mailboxLabel:u(`inbox.mailboxFilter`),refreshLabel:u(`common.refresh`)}):null,(0,F.jsxs)(ne,{styles:{body:{padding:0,minWidth:0}},children:[(0,F.jsxs)(`div`,{style:{padding:12,borderBottom:`1px solid #EAECF0`},children:[t.md?null:(0,F.jsxs)(d,{direction:`vertical`,size:8,className:`full-width`,style:{marginBottom:8},children:[(0,F.jsx)(l,{value:J||void 0,onChange:en,options:Jt,showSearch:!0,optionFilterProp:`label`,className:`full-width`,"aria-label":u(`inbox.mailboxFilter`)}),_t?(0,F.jsx)(h,{type:`warning`,showIcon:!0,message:r.startsWith(`en`)?`Folder counts are unavailable.`:`文件夹计数暂不可用。`,action:(0,F.jsx)(f,{size:`small`,loading:st,onClick:()=>void Q(),children:u(`common.refresh`)})}):null,(0,F.jsx)(l,{value:Ut,onChange:tn,loading:st,options:je.map(e=>({value:e.name,label:Ye(e,r)})),className:`full-width`,"aria-label":r.startsWith(`en`)?`Folder`:`文件夹`})]}),(0,F.jsxs)(d.Compact,{block:!0,children:[(0,F.jsx)(v,{value:Tt,allowClear:!0,prefix:(0,F.jsx)(ge,{}),placeholder:u(`inbox.searchPlaceholder`),onChange:e=>Et(e.target.value),onPressEnter:()=>Qt({q:Tt.trim(),page:1})}),(0,F.jsx)(f,{"aria-label":u(`common.refresh`),icon:(0,F.jsx)(he,{}),loading:Ze,onClick:()=>void $()})]}),(0,F.jsx)(l,{value:Wt,onChange:e=>Qt({read:e===`all`?null:e,page:1}),style:{width:`100%`,marginTop:8},"aria-label":r.startsWith(`en`)?`Read state`:`阅读状态`,options:[{value:`all`,label:r.startsWith(`en`)?`All mail`:`全部邮件`},{value:`unread`,label:u(`inbox.unread`)},{value:`read`,label:u(`inbox.read`)}]})]}),pt?(0,F.jsx)(h,{type:`error`,showIcon:!0,message:pt,action:(0,F.jsx)(f,{onClick:()=>void $(),children:u(`common.refresh`)})}):null,(0,F.jsx)(Ie,{items:P,loading:Ze,activeId:Y,onOpen:nn,locale:r,t:u}),Ne>25?(0,F.jsx)(`div`,{style:{padding:12,display:`flex`,justifyContent:`center`},children:(0,F.jsx)(se,{size:`small`,current:Kt,pageSize:25,total:Ne,showSizeChanger:!1,onChange:e=>Qt({page:e})})}):null]}),n?(0,F.jsx)(ne,{styles:{body:{padding:20,minWidth:0}},children:(0,F.jsx)(Le,{message:I,loading:z,error:ht,mutationError:yt,activeTab:qt,onTabChange:an,onCopy:on,t:u})}):null]}):j.length?(0,F.jsx)(E,{description:u(`inbox.noReceivingAccess`),action:(0,F.jsx)(f,{onClick:()=>x(`/account`),children:u(`account.title`)})}):(0,F.jsx)(E,{description:A.length?r.startsWith(`en`)?`No receiving mailbox has been created yet.`:`尚未创建收信邮箱。`:u(`inbox.noMailboxDomain`),action:(0,F.jsx)(f,{icon:(0,F.jsx)(me,{}),disabled:!A.length,onClick:()=>{$t(`routing`),cn()},children:u(`inbox.createMailbox`)})}):(0,F.jsxs)(d,{direction:`vertical`,size:20,className:`full-width`,children:[(0,F.jsx)(le,{title:u(`inbox.mailboxes`),extra:(0,F.jsx)(Ee,{tone:`neutral`,children:j.length}),children:j.length?(0,F.jsxs)(d,{direction:`vertical`,size:12,className:`full-width`,children:[(0,F.jsxs)(d,{wrap:!0,className:`full-width`,children:[(0,F.jsx)(v,{allowClear:!0,"aria-label":r.startsWith(`en`)?`Search mailboxes`:`搜索收信邮箱`,prefix:(0,F.jsx)(ge,{}),placeholder:r.startsWith(`en`)?`Search address, alias, or forwarding target`:`搜索邮箱、别名或转发地址`,value:At,onChange:e=>jt(e.target.value),style:{flex:`1 1 280px`}}),(0,F.jsx)(l,{"aria-label":r.startsWith(`en`)?`Sort mailboxes`:`收信邮箱排序`,value:Mt,onChange:Nt,style:{minWidth:180},options:We(r)})]}),t.md?(0,F.jsx)(ae,{rowKey:`id`,columns:hn,dataSource:Xt,scroll:{x:1420}}):(0,F.jsx)(y,{dataSource:Xt,renderItem:e=>(0,F.jsx)(y.Item,{children:(0,F.jsx)(ne,{size:`small`,className:`full-width`,title:e.address,children:(0,F.jsxs)(d,{direction:`vertical`,className:`full-width`,children:[(0,F.jsx)(at,{mailbox:e,t:u}),(0,F.jsx)(Te,{permissions:tt(e)}),(0,F.jsxs)(p.Text,{type:`secondary`,children:[B(e.messageCount),` `,u(`inbox.messageCount`),` · `,B(e.unreadCount),` `,u(`inbox.unread`)]}),mn(e,!0)]})})})})]}):lt?null:(0,F.jsx)(E,{description:A.length?r.startsWith(`en`)?`No receiving mailbox has been created yet.`:`尚未创建收信邮箱。`:u(`inbox.noMailboxDomain`),action:(0,F.jsx)(f,{icon:(0,F.jsx)(me,{}),disabled:!A.length,onClick:cn,children:u(`inbox.createMailbox`)})})}),(0,F.jsx)(le,{title:u(`inbox.domainRoutes`),extra:(0,F.jsx)(Ee,{tone:`neutral`,children:O.length}),children:O.length?(0,F.jsxs)(d,{direction:`vertical`,size:12,className:`full-width`,children:[(0,F.jsxs)(d,{wrap:!0,className:`full-width`,children:[(0,F.jsx)(v,{allowClear:!0,"aria-label":r.startsWith(`en`)?`Search receiving routes`:`搜索域名收信路由`,prefix:(0,F.jsx)(ge,{}),placeholder:r.startsWith(`en`)?`Search domain or catch-all address`:`搜索域名或未知地址收件邮箱`,value:Pt,onChange:e=>Ft(e.target.value),style:{flex:`1 1 280px`}}),(0,F.jsx)(l,{"aria-label":r.startsWith(`en`)?`Sort receiving routes`:`域名收信路由排序`,value:It,onChange:Lt,style:{minWidth:180},options:qe(r)})]}),t.md?(0,F.jsx)(ae,{rowKey:`id`,columns:gn,dataSource:Zt}):(0,F.jsx)(y,{dataSource:Zt,renderItem:e=>(0,F.jsx)(y.Item,{actions:[(0,F.jsx)(f,{onClick:()=>fn(e),children:u(`common.edit`)},`edit`)],children:(0,F.jsx)(y.Item.Meta,{title:e.domain,description:e.catchAllAddress||u(`inbox.catchAllDisabled`)})})})]}):dt?null:(0,F.jsx)(E,{description:u(`inbox.noDomain`),action:(0,F.jsx)(f,{onClick:()=>x(`/domains?create=1`),children:u(`common.addDomain`)})})})]}),n?null:(0,F.jsx)(_e,{title:u(`inbox.messageDetail`),width:t.md?680:`100%`,open:!!Y,onClose:rn,children:(0,F.jsx)(Le,{message:I,loading:z,error:ht,mutationError:yt,activeTab:qt,onTabChange:an,onCopy:on,t:u})}),(0,F.jsx)(_e,{title:V?r.startsWith(`en`)?`Edit mailbox`:`编辑收信邮箱`:u(`inbox.createMailbox`),width:560,open:Dt,onClose:un,destroyOnHidden:!0,footer:(0,F.jsxs)(d,{style:{display:`flex`,justifyContent:`flex-end`},children:[(0,F.jsx)(f,{onClick:un,children:u(`common.cancel`)}),(0,F.jsx)(f,{type:`primary`,loading:xt===`mailbox:create`||xt===`mailbox:update:${V?.id}`,onClick:()=>void dn(),children:u(V?`common.save`:`inbox.createMailbox`)})]}),children:A.length?(0,F.jsxs)(_,{form:T,layout:`vertical`,children:[V?(0,F.jsx)(g,{bordered:!0,column:1,size:`small`,style:{marginBottom:20},children:(0,F.jsx)(g.Item,{label:u(`inbox.mailboxAddress`),children:(0,F.jsx)(p.Text,{code:!0,children:V.address})})}):(0,F.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:t.sm?`minmax(0, 1fr) minmax(220px, 0.8fr)`:`minmax(0, 1fr)`,columnGap:t.sm?0:8},children:[(0,F.jsx)(_.Item,{name:`localPart`,label:u(`inbox.localPart`),rules:[{required:!0,message:u(`inbox.localPartRequired`)},{pattern:/^[^@\s]+$/,message:u(`inbox.localPartInvalid`)}],children:(0,F.jsx)(v,{autoComplete:`off`})}),(0,F.jsx)(_.Item,{name:`domain`,label:u(`domains.domain`),rules:[{required:!0,message:u(`inbox.domainRequired`)}],children:(0,F.jsx)(l,{options:Yt})})]}),(0,F.jsx)(_.Item,{name:`displayName`,label:u(`inbox.displayName`),children:(0,F.jsx)(v,{})}),(0,F.jsx)(_.Item,{name:`password`,label:V?r.startsWith(`en`)?`New password`:`新密码`:u(`inbox.password`),extra:V?r.startsWith(`en`)?`Leave blank to keep the current password.`:`留空表示保留当前密码。`:void 0,rules:[{required:!V,message:u(`inbox.passwordRequired`)},{min:8,message:u(`inbox.passwordMin`)}],children:(0,F.jsx)(v.Password,{autoComplete:`new-password`})}),(0,F.jsx)(f,{onClick:()=>T.setFieldValue(`password`,et()),children:u(`inbox.generatePassword`)}),(0,F.jsx)(_.Item,{name:`quotaMb`,label:`${u(`inbox.quotaMb`)} (MB)`,style:{marginTop:20},children:(0,F.jsx)(ue,{min:1,className:`full-width`})}),(0,F.jsx)(_.Item,{name:`aliases`,label:u(`inbox.aliases`),extra:u(`inbox.aliasesExtra`),children:(0,F.jsx)(v.TextArea,{rows:3})}),(0,F.jsx)(_.Item,{name:`forwardTo`,label:u(`inbox.forwardTo`),extra:u(`inbox.forwardToExtra`),children:(0,F.jsx)(v.TextArea,{rows:3})}),(0,F.jsx)(_.Item,{name:`keepForwarded`,valuePropName:`checked`,children:(0,F.jsx)(ie,{children:u(`inbox.keepForwarded`)})}),V?(0,F.jsx)(_.Item,{name:`status`,label:u(`common.status`),rules:[{required:!0}],children:(0,F.jsx)(l,{options:[{value:`active`,label:r.startsWith(`en`)?`Active`:`启用`},{value:`disabled`,label:r.startsWith(`en`)?`Disabled`:`停用`}]})}):null]}):(0,F.jsx)(h,{type:`warning`,showIcon:!0,message:u(`inbox.noMailboxDomain`)})}),(0,F.jsx)(de,{title:u(`inbox.catchAllTitle`),open:!!zt,confirmLoading:xt.startsWith(`catch-all:`),onCancel:()=>Bt(null),onOk:()=>void pn(),children:(0,F.jsx)(_,{form:D,layout:`vertical`,children:(0,F.jsx)(_.Item,{name:`catchAllAddress`,label:u(`inbox.catchAllAddress`),extra:u(`inbox.catchAllExtra`),children:(0,F.jsx)(v,{placeholder:`catchall@example.com / /dev/null`})})})}),(0,F.jsx)(de,{title:u(`inbox.clientConfig`),open:!!Rt,width:720,footer:(0,F.jsx)(f,{type:`primary`,onClick:()=>H(null),children:u(`common.confirm`)}),onCancel:()=>H(null),children:Rt?(0,F.jsx)(Be,{config:Rt,onCopy:on,t:u}):null})]})}function Fe({mailboxOptions:e,selectedMailboxId:t,folders:n,foldersLoading:r,foldersError:i,activeFolder:a,onMailbox:o,onFolder:s,onRetryFolders:c,locale:u,mailboxLabel:ee,refreshLabel:m}){return(0,F.jsxs)(ne,{styles:{body:{padding:8}},children:[(0,F.jsx)(l,{"aria-label":ee,value:t||void 0,onChange:o,options:e,showSearch:!0,optionFilterProp:`label`,className:`full-width`,style:{marginBottom:12}}),i?(0,F.jsx)(h,{type:`warning`,showIcon:!0,message:u.startsWith(`en`)?`Folder counts are unavailable.`:`文件夹计数暂不可用。`,description:i,action:(0,F.jsx)(f,{size:`small`,loading:r,onClick:()=>void c(),children:m}),style:{marginBottom:8}}):null,(0,F.jsx)(d,{direction:`vertical`,size:2,className:`full-width`,children:n.map(e=>(0,F.jsxs)(f,{type:a===e.name?`primary`:`text`,icon:Qe(e.name),onClick:()=>s(e.name),style:{width:`100%`,minHeight:44,display:`flex`,alignItems:`center`,justifyContent:`flex-start`},children:[(0,F.jsx)(`span`,{style:{flex:1,textAlign:`left`},children:Ze(e.name,u)}),e.countsAvailable?e.unreadCount?(0,F.jsx)(oe,{count:e.unreadCount,size:`small`}):(0,F.jsx)(p.Text,{type:`secondary`,children:e.messageCount}):(0,F.jsx)(p.Text,{type:`secondary`,"aria-label":u.startsWith(`en`)?`Count unavailable`:`计数不可用`,children:`—`})]},e.name))})]})}function Ie({items:e,loading:t,activeId:n,onOpen:r,locale:i,t:a}){return t?(0,F.jsx)(`div`,{style:{padding:16},children:(0,F.jsx)(ee,{active:!0,paragraph:{rows:8}})}):e.length?(0,F.jsx)(y,{dataSource:e,split:!0,renderItem:e=>(0,F.jsx)(y.Item,{style:{padding:0},children:(0,F.jsx)(`button`,{type:`button`,"aria-label":`${e.subject||a(`inbox.noSubject`)} · ${e.sender}`,onClick:()=>r(e),style:{width:`100%`,minHeight:88,padding:`12px 16px`,border:0,textAlign:`left`,background:n===e.id?`#EEF2FF`:e.read?`#FFFFFF`:`#F8FAFF`,cursor:`pointer`},children:(0,F.jsxs)(d,{direction:`vertical`,size:4,style:{width:`100%`},children:[(0,F.jsxs)(d,{style:{width:`100%`,justifyContent:`space-between`},children:[(0,F.jsx)(p.Text,{strong:!e.read,ellipsis:!0,style:{maxWidth:`65%`},children:e.sender||`—`}),(0,F.jsx)(p.Text,{type:`secondary`,style:{fontSize:12},children:ot(e.receivedAt)})]}),(0,F.jsx)(p.Text,{strong:!e.read,ellipsis:!0,children:e.subject||a(`inbox.noSubject`)}),(0,F.jsx)(p.Text,{type:`secondary`,ellipsis:!0,children:e.preview||`—`})]})})})}):(0,F.jsx)(E,{description:i.startsWith(`en`)?`No messages match this folder and filter.`:`当前文件夹和筛选条件下没有邮件。`})}function Le({message:e,loading:t,error:n,mutationError:r,activeTab:i,onTabChange:a,onCopy:o,t:s}){if(t)return(0,F.jsx)(ee,{active:!0,paragraph:{rows:12}});if(n)return(0,F.jsx)(h,{type:`error`,showIcon:!0,message:n});if(!e)return(0,F.jsx)(E,{description:s(`inbox.messageDetail`)});let c=i===`text`&&!e.textBody&&e.htmlBody?`html`:i;return(0,F.jsxs)(d,{direction:`vertical`,size:20,className:`full-width`,children:[r?(0,F.jsx)(h,{type:`warning`,showIcon:!0,message:r}):null,(0,F.jsxs)(`div`,{children:[(0,F.jsx)(p.Title,{level:4,style:{marginBottom:4},children:e.subject||s(`inbox.noSubject`)}),(0,F.jsx)(p.Text,{type:`secondary`,children:st(e.receivedAt)})]}),(0,F.jsxs)(g,{column:1,size:`small`,children:[(0,F.jsx)(g.Item,{label:s(`inbox.sender`),children:e.sender||`—`}),(0,F.jsx)(g.Item,{label:s(`inbox.recipients`),children:e.recipients.join(`, `)||`—`}),(0,F.jsx)(g.Item,{label:s(`logs.messageId`),children:(0,F.jsx)(p.Text,{code:!0,copyable:{onCopy:()=>o(e.messageId)},children:e.messageId||`—`})})]}),(0,F.jsx)(te,{activeKey:c,onChange:e=>a(Re(e)),items:[{key:`text`,label:s(`inbox.textBody`),children:e.textBody?(0,F.jsx)(`pre`,{className:`inbox-message-body`,children:e.textBody}):(0,F.jsx)(E,{description:s(`inbox.noTextBody`)})},{key:`html`,label:s(`inbox.htmlBody`),children:e.htmlBody?(0,F.jsx)(I,{html:e.htmlBody,title:s(`inbox.htmlBody`)}):(0,F.jsx)(E,{description:s(`inbox.noHtmlBody`)})},{key:`source`,label:s(`inbox.htmlSource`),children:e.htmlBody?(0,F.jsx)(D,{value:e.htmlBody,onCopy:o}):(0,F.jsx)(E,{description:s(`inbox.noHtmlBody`)})},{key:`raw`,label:s(`inbox.rawMessage`),children:e.rawMessage?(0,F.jsx)(D,{value:e.rawMessage,onCopy:o}):(0,F.jsx)(E,{description:s(`inbox.noRawMessage`)})}]})]})}function Re(e){return e===`html`||e===`source`||e===`raw`?e:`text`}function I({html:e,title:t}){return(0,F.jsx)(`iframe`,{title:t,className:`inbox-html-preview`,sandbox:``,referrerPolicy:`no-referrer`,srcDoc:L(e)})}function L(e){let t=[`<meta charset="utf-8">`,`<meta name="viewport" content="width=device-width, initial-scale=1">`,`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data: blob: http: https:; style-src 'unsafe-inline' http: https:; font-src data: http: https:; script-src 'none'; connect-src 'none'; frame-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'">`,`<base target="_blank">`,`<style>html,body{margin:0;padding:12px;background:#fff;color:#111827;font:14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;overflow-wrap:anywhere;}img{max-width:100%;height:auto;}table{max-width:100%;}a{color:#4F46E5;}</style>`].join(``),n=String(e||``);return/<head(?:\s[^>]*)?>/i.test(n)?n.replace(/<head(?:\s[^>]*)?>/i,e=>`${e}${t}`):/<html(?:\s[^>]*)?>/i.test(n)?n.replace(/<html(?:\s[^>]*)?>/i,e=>`${e}<head>${t}</head>`):`<!doctype html><html><head>${t}</head><body>${n}</body></html>`}function ze(e,t){let n=new URLSearchParams(e);n.delete(`tab`),t&&(!n.has(`mailboxId`)||!n.has(`folder`))&&(n.set(`mailboxId`,String(t.mailboxId)),n.set(`folder`,t.folder||`INBOX`));let r=n.toString();return`/inbox${r?`?${r}`:``}`}function Be({config:e,onCopy:t,t:n}){let r=[{key:`imap`,label:n(`inbox.incomingConfig`),value:e.incoming},...e.pop3?[{key:`pop3`,label:n(`inbox.pop3Config`),value:e.pop3}]:[],{key:`smtp`,label:n(`inbox.outgoingConfig`),value:e.outgoing}];return(0,F.jsxs)(d,{direction:`vertical`,size:16,className:`full-width`,children:[(0,F.jsx)(h,{type:`info`,showIcon:!0,message:n(`inbox.clientConfigHelpSummary`)}),(0,F.jsxs)(g,{bordered:!0,column:1,size:`small`,children:[(0,F.jsx)(g.Item,{label:n(`inbox.configUsername`),children:R(e.username,t)}),(0,F.jsx)(g.Item,{label:n(`inbox.configPassword`),children:e.password?R(e.password,t):(0,F.jsx)(p.Text,{type:`secondary`,children:n(`inbox.passwordNotShown`)})})]}),(0,F.jsx)(te,{items:r.map(e=>({key:e.key,label:e.label,children:(0,F.jsxs)(g,{bordered:!0,column:1,size:`small`,children:[(0,F.jsx)(g.Item,{label:n(`inbox.configHost`),children:R(e.value.host,t)}),(0,F.jsx)(g.Item,{label:n(`inbox.configPort`),children:R(e.value.port,t)}),(0,F.jsx)(g.Item,{label:n(`inbox.configSecurity`),children:e.value.security}),(0,F.jsx)(g.Item,{label:n(`inbox.configAuthMethod`),children:e.value.authMethod})]})}))})]})}function R(e,t){return(0,F.jsxs)(d,{children:[(0,F.jsx)(p.Text,{code:!0,children:e}),(0,F.jsx)(f,{"aria-label":`Copy`,icon:(0,F.jsx)(b,{}),onClick:()=>void t(String(e))})]})}function Ve(e,t){return t&&e.some(e=>e.id===t)?t:[...e].filter(e=>e.lastMessageAt).sort((e,t)=>Date.parse(t.lastMessageAt||``)-Date.parse(e.lastMessageAt||``))[0]?.id||e.find(e=>(e.messageCount??0)>0)?.id||e[0]?.id||null}function He(e,t){let n=t.trim().toLocaleLowerCase();return n?e.filter(e=>[e.address,e.displayName,...e.aliases,...e.forwardTo].some(e=>String(e||``).toLocaleLowerCase().includes(n))):e}function Ue(e,t){return[...e].sort((e,n)=>{if(t===`address`)return e.address.localeCompare(n.address);if(t===`unread`)return(n.unreadCount??-1)-(e.unreadCount??-1)||e.address.localeCompare(n.address);if(t===`messages`)return(n.messageCount??-1)-(e.messageCount??-1)||e.address.localeCompare(n.address);let r=Date.parse(e.lastMessageAt||``)||0;return(Date.parse(n.lastMessageAt||``)||0)-r||e.address.localeCompare(n.address)})}function We(e){return e.startsWith(`en`)?[{value:`activity`,label:`Recent activity`},{value:`address`,label:`Address`},{value:`unread`,label:`Unread count`},{value:`messages`,label:`Message count`}]:[{value:`activity`,label:`最近收信`},{value:`address`,label:`邮箱地址`},{value:`unread`,label:`未读数`},{value:`messages`,label:`邮件数`}]}function Ge(e,t){let n=t.trim().toLocaleLowerCase();return n?e.filter(e=>[e.domain,e.catchAllAddress].some(e=>String(e||``).toLocaleLowerCase().includes(n))):e}function Ke(e,t){return[...e].sort((e,n)=>{if(t===`configured`){let t=Number(!!n.catchAllAddress)-Number(!!e.catchAllAddress);if(t)return t}return e.domain.localeCompare(n.domain)})}function qe(e){return e.startsWith(`en`)?[{value:`domain`,label:`Domain`},{value:`configured`,label:`Configured first`}]:[{value:`domain`,label:`域名`},{value:`configured`,label:`已配置优先`}]}function Je(){return Ne.map(e=>({name:e,specialUse:Xe(e),messageCount:0,unreadCount:0,countsAvailable:!1}))}function Ye(e,t){let n=e.countsAvailable?e.unreadCount:`—`;return`${Ze(e.name,t)} (${n})`}function Xe(e){return{INBOX:null,Sent:`\\Sent`,Drafts:`\\Drafts`,Trash:`\\Trash`,Junk:`\\Junk`,Archive:`\\Archive`}[e]??null}function Ze(e,t){return t.startsWith(`en`)?e:{INBOX:`收件箱`,Sent:`已发送`,Drafts:`草稿`,Trash:`已删除`,Junk:`垃圾邮件`,Archive:`归档`}[e]||e}function Qe(e){return e===`INBOX`?(0,F.jsx)(T,{}):e===`Sent`?(0,F.jsx)(C,{}):e===`Drafts`?(0,F.jsx)(je,{}):e===`Trash`?(0,F.jsx)(x,{}):e===`Junk`?(0,F.jsx)(w,{}):e===`Archive`?(0,F.jsx)(Ae,{}):(0,F.jsx)(Me,{})}function $e(e,t,n=``){let r=z(t?.submission?.ports||[],[587,465]),i=z(t?.mailAccess?.imap.ports||[],[993,143]),a=z(t?.mailAccess?.pop3.ports||[],[995,110]),o=t?.mailAccess?.host||t?.submission?.host||t?.mailHostname||e.domain;return{username:e.address,password:n,incoming:{protocol:`IMAP`,host:o,port:i?.port||143,security:i?.protocol||`IMAP + STARTTLS`,authMethod:`Normal password`,username:e.address,password:n},pop3:{protocol:`POP3`,host:o,port:a?.port||110,security:a?.protocol||`POP3 + STLS`,authMethod:`Normal password`,username:e.address,password:n},outgoing:{protocol:`SMTP`,host:t?.submission?.host||t?.mailHostname||e.domain,port:r?.port||587,security:r?.protocol||`SMTP + STARTTLS`,authMethod:`Normal password`,username:e.address,password:n}}}function z(e,t){for(let n of t){let t=e.find(e=>e.port===n);if(t)return t}return e[0]||null}function et(){let e=new Uint8Array(14);return globalThis.crypto.getRandomValues(e),Array.from(e,e=>(e%36).toString(36)).join(``)}function tt(e){let t=e.access?.permissions,n=e.access?e.access.type===`owner`:!0;return{view:t?.view??n,receive:t?.receive??n,send:t?.send??n}}function nt(e){let t=e.access?.type||`owner`;return(t===`owner`||t===`assigned`)&&tt(e).receive}function rt({block:e=!1,mailbox:t,locale:n,loading:r,onClick:i}){let a=n.startsWith(`en`)?`Open Webmail`:`一键登录 Webmail`,o=t.status===`active`?``:n.startsWith(`en`)?`This mailbox is disabled and cannot sign in to Webmail.`:`该邮箱已停用,无法登录 Webmail。`,s=(0,F.jsx)(f,{block:e,"aria-label":`${a} · ${t.address}${o?` · ${o}`:``}`,disabled:!!o,icon:(0,F.jsx)(pe,{}),loading:r,onClick:i,style:{minHeight:44},title:o||void 0,children:a});return o?(0,F.jsx)(u,{title:o,children:(0,F.jsx)(`span`,{style:e?{display:`block`}:void 0,children:s})}):s}function it(e,t){return t?e.access?.type===`owner`||(e.ownerUserId||e.userId)===t:!1}function at({mailbox:e,t}){return e.access?.type===`assigned`?(0,F.jsx)(S,{color:`purple`,children:t(`account.adminAssigned`)}):e.access?.type===`admin`?(0,F.jsx)(S,{color:`gold`,children:t(`account.adminAccess`)}):(0,F.jsx)(S,{color:`blue`,children:t(`account.ownedMailbox`)})}function B(e){return e??`—`}function ot(e){let t=new Date(e),n=new Date;return t.toDateString()===n.toDateString()?t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):t.toLocaleDateString()}function st(e){return e?new Date(e).toLocaleString():`—`}export{Pe as default};
|