Settings-CMfYJMlD.js23.2 KB
import{$ as ze,a8 as Ce,R as le,u as Ie,bq as Be,r as c,j as e,T as r,d as p,F as u,br as ae,S,bs as Re,G as He,c as x,bt as $}from"./index-DS2B3OLK.js";import{B as F}from"./index-BNK0Nj_J.js";import{C as w}from"./index-CNcKSYi_.js";import{M as Ue}from"./Modal-frvVG_x8.js";import{F as A}from"./textarea-Q146PoFE.js";import{I as re}from"./index-R4PZyHYh.js";import{R as Ve,a as We}from"./index-CElfosix.js";import{S as oe}from"./index-DpzzYpyM.js";import{T as a}from"./index-DhB1Ls4S.js";import{I as De}from"./IconRefresh-5WsT0pLC.js";import"./IconTickCircle-Bbh_c2jr.js";import"./index-Bj7oeOfx.js";import"./_baseDifference-D1QxGNC2.js";import"./object-DvQZmkoP.js";const Fe={PREFIX:`${ze}`};var Pe=function(t,h){var j={};for(var g in t)Object.prototype.hasOwnProperty.call(t,g)&&h.indexOf(g)<0&&(j[g]=t[g]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var y=0,g=Object.getOwnPropertySymbols(t);y<g.length;y++)h.indexOf(g[y])<0&&Object.prototype.propertyIsEnumerable.call(t,g[y])&&(j[g[y]]=t[g[y]]);return j};const b=Fe.PREFIX,T=t=>{const{layout:h="horizontal",dashed:j,align:g="center",className:y,margin:f,style:B,children:v}=t,R=Pe(t,["layout","dashed","align","className","margin","style","children"]),H=Ce(`${b}-divider`,y,{[`${b}-divider-horizontal`]:h==="horizontal",[`${b}-divider-vertical`]:h==="vertical",[`${b}-divider-dashed`]:!!j,[`${b}-divider-with-text`]:v&&h==="horizontal",[`${b}-divider-with-text-${g}`]:v&&h==="horizontal"});let k={};return f!==void 0&&(h==="vertical"?k={marginLeft:f,marginRight:f}:h==="horizontal"&&(k={marginTop:f,marginBottom:f})),le.createElement("div",Object.assign({},R,{className:H,style:Object.assign(Object.assign({},k),B)}),v&&h==="horizontal"?typeof v=="string"?le.createElement("span",{className:`${b}-divider_inner-text`,"x-semi-prop":"children"},v):v:null)},I="var(--wstat-mono)";function Ze(){const{t}=Ie(),h=Be(),j=!!(h&&h.is_admin),[g,y]=c.useState(!0),[f,B]=c.useState(!1),[v,R]=c.useState(!1),[H,k]=c.useState(""),[i,P]=c.useState(null),[N,de]=c.useState(""),[n,X]=c.useState(null),[ce,G]=c.useState(!1),[pe,K]=c.useState(!1),[m,q]=c.useState(null),[me,J]=c.useState(!1),[Q,Y]=c.useState(""),[Z,U]=c.useState(!1),O=c.useRef(null),E=c.useRef(null),[V,W]=c.useState(""),[ge,ee]=c.useState(!1),te=async()=>{await _(),await $()},se=async(s,l)=>{const d=l&&l.files&&l.files[0];if(!d)return;const z=new FormData;z.append(s,d),W(s);try{await x.brandUpload(z),a.success(t("setUiSaved")),await te()}catch(C){a.error(C.message)}finally{W(""),l&&(l.value="")}},ie=async s=>{const l=new FormData;l.append("reset",s),W(s);try{await x.brandUpload(l),a.success(t("setUiSaved")),await te()}catch(d){a.error(d.message)}finally{W("")}},he=async(s,l)=>{const d=new Set(String(i&&i.hidden_menus||"").split(",").map(C=>C.trim()).filter(Boolean));l?d.delete(s):d.add(s);const z=Array.from(d).join(",");ee(!0);try{await x.settingsSave({hidden_menus:z}),o("hidden_menus",z),a.success(t("setSaved")),await $()}catch(C){a.error(C.message)}finally{ee(!1)}},[xe,ne]=c.useState(!1),ye=async()=>{ne(!0);try{await x.settingsSave({brand_name:String(i.brand_name??"").trim(),meta_keywords:String(i.meta_keywords??"").trim(),meta_description:String(i.meta_description??"").trim()}),a.success(t("setSaved")),await _(),await $()}catch(s){a.error(s.message)}finally{ne(!1)}},fe=async()=>{J(!0),Y("");try{q(await x.ipCheck())}catch(s){q(null),Y(s&&s.message?s.message:String(s))}finally{J(!1)}},ue=async()=>{U(!0);try{await x.settingsSave({ip_source:i.ip_source||"remote_addr",ip_source_header:String(i.ip_source_header??"").trim()}),a.success(t("setSaved")),await _()}catch(s){a.error(s.message)}finally{U(!1)}},je=async s=>{U(!0);try{await x.settingsSave({ip_source:s}),P(l=>({...l,ip_source:s})),a.success(t("setSaved")),await _()}catch(l){a.error(l.message)}finally{U(!1)}},_=async()=>{y(!0);try{const s=await x.settingsGet();P(s),k(""),x.settingsVersion().then(X).catch(()=>{})}catch(s){k(s.message)}finally{y(!1)}};if(c.useEffect(()=>{j?_():y(!1)},[j]),!j)return e.jsxs("div",{className:"page",children:[e.jsx(r.Title,{heading:5,style:{marginBottom:12},children:t("settings")}),e.jsx(F,{type:"warning",description:t("setAdminOnly")})]});const o=(s,l)=>P(d=>({...d,[s]:l})),D=async()=>{if((i.ip_source||"remote_addr")==="custom"&&String(i.ip_source_header??"").trim()===""){a.error(t("setIpHeaderRequired"));return}B(!0);try{await x.settingsSave({registration_enabled:i.registration_enabled,email_verify_enabled:i.email_verify_enabled,collect_enabled:i.collect_enabled,alert_enabled:i.alert_enabled,bot_filter_enabled:i.bot_filter_enabled,retention_days:String(i.retention_days??"").trim(),screen_password:String(i.screen_password??""),sdk_snippet:String(i.sdk_snippet??"").trim(),inject_code:String(i.inject_code??"").trim(),ip_source:i.ip_source||"remote_addr",ip_source_header:String(i.ip_source_header??"").trim(),smtp_host:i.smtp_host,smtp_port:i.smtp_port,smtp_secure:i.smtp_secure,smtp_username:i.smtp_username,smtp_password:i.smtp_password,smtp_from_name:i.smtp_from_name,smtp_from_email:i.smtp_from_email}),a.success(t("setSaved")),await _()}catch(s){a.error(s.message)}finally{B(!1)}},ve=async()=>{if(!N)return a.error(t("setTestTo"));R(!0);try{const s=await x.settingsEmailTest(N);s&&s.ok?a.success(t("setTestOk")+"("+(s.via||"")+")"):a.error(s&&s.msg||t("setTestFail"))}catch(s){a.error(s.message)}finally{R(!1)}},_e=[{key:"registration_enabled",title:t("setRegTitle"),desc:t("setRegDesc")},{key:"email_verify_enabled",title:t("setEmailVerify"),desc:t("setEmailVerifyDesc"),warn:i&&i.captcha_ready?"":t("setEmailVerifyWarn")},{key:"collect_enabled",title:t("setCollectTitle"),desc:t("setCollectDesc")},{key:"alert_enabled",title:t("setAlertTitle"),desc:t("setAlertDesc")},{key:"bot_filter_enabled",title:t("setBotTitle"),desc:t("setBotDesc")},{key:"spider_enabled",title:t("setSpiderTitle"),desc:t("setSpiderDesc")}],Se=async()=>{G(!0);try{const s=await x.settingsVersion();X(s||{}),s&&s.has_update?a.warning(t("setVerNew")+":"+s.latest):s&&s.latest&&a.success(t("setVerUpToDate"))}catch(s){a.error(s.message)}finally{G(!1)}},we=()=>{Ue.confirm({title:t("setVerUpgrade"),content:t("setVerUpgradeConfirm"),okText:t("setVerUpgrade"),okButtonProps:{type:"warning",theme:"solid"},onOk:async()=>{K(!0);try{const s=await x.settingsUpdate();a.success(s&&s.notice||t("setVerUpgraded")),await _()}catch(s){a.error(s.message)}finally{K(!1)}}})},M=String(i&&i.sdk_snippet||"").trim(),L=i&&i.sdk_snippet_default||"",be=M||L,Te=M!==""&&!/\{site_key\}/.test(M),ke=be.replace(/\{site_key\}/g,"sk_3f9a1c7d2e").replace(/\{(?:host|origin)\}/g,typeof location<"u"&&location.origin||"https://stats.example.com");return e.jsxs("div",{className:"page",children:[e.jsxs("div",{className:"toolbar",children:[e.jsx(r.Title,{heading:5,style:{margin:0},children:t("settings")}),e.jsx(p,{icon:e.jsx(De,{}),size:"small",theme:"borderless",onClick:_,children:t("alRefresh")})]}),H&&e.jsx(F,{type:"danger",description:H,style:{marginBottom:12},closeIcon:null}),g&&!i?e.jsx(r.Text,{type:"tertiary",children:t("loading")||"…"}):i?e.jsxs(e.Fragment,{children:[e.jsxs(w,{title:t("setTogglesTitle"),style:{marginBottom:16},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:18},children:[_e.map(s=>e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:24},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontWeight:600,marginBottom:2},children:s.title}),e.jsx("div",{style:{fontSize:13,color:"#86909c",lineHeight:1.6},children:s.desc}),s.warn&&e.jsxs("div",{style:{fontSize:13,color:"#d4380d",lineHeight:1.6,marginTop:4},children:["⚠ ",s.warn]})]}),e.jsx(oe,{checked:(i[s.key]??"1")==="1"||i[s.key]===1,onChange:l=>o(s.key,l?"1":"0")})]},s.key)),e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:24},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontWeight:600,marginBottom:2},children:t("setRetention")}),e.jsx("div",{style:{fontSize:13,color:"#86909c",lineHeight:1.6},children:t("setRetentionDesc")})]}),e.jsx(re,{value:i.retention_days===""||i.retention_days==null?void 0:Number(i.retention_days),onChange:s=>o("retention_days",s==null?"":String(s)),min:1,max:3650,style:{width:140},placeholder:t("setRetentionPH")})]}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:24},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontWeight:600,marginBottom:2},children:t("setScreenPwd")}),e.jsx("div",{style:{fontSize:13,color:"#86909c",lineHeight:1.6},children:t("setScreenPwdDesc")})]}),e.jsx(u,{mode:"password",value:i.screen_password==="******"?"******":String(i.screen_password??""),onChange:s=>o("screen_password",s),placeholder:t("setScreenPwdPH"),style:{width:220}})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,flexWrap:"wrap",marginTop:16},children:[e.jsx(r.Text,{type:"tertiary",size:"small",children:t("setTogglesHint")}),e.jsx(p,{theme:"solid",size:"small",loading:f,onClick:D,children:t("save")})]})]}),e.jsxs(w,{title:t("setUiTitle"),style:{marginBottom:16},children:[e.jsx("div",{style:{fontSize:13,color:"#86909c",lineHeight:1.7,marginBottom:12},children:t("setUiDesc")}),(()=>{const s=ae("logo")||(i.brand_logo?`/brand/logo?fv=${encodeURIComponent(i.brand_logo)}`:""),l=ae("icon")||(i.brand_icon?`/brand/icon?fv=${encodeURIComponent(i.brand_icon)}`:"");return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,flexWrap:"wrap"},children:[s?e.jsx("img",{src:s,alt:"Logo",className:"logo-badge",style:{width:42,height:42,objectFit:"contain",background:"#fff",padding:2,boxSizing:"border-box"}}):e.jsx("div",{className:"logo-badge",children:"W"}),e.jsxs("div",{style:{flex:1,minWidth:200},children:[e.jsx("div",{style:{fontWeight:600,fontSize:13},children:t("setUiLogo")}),e.jsx("div",{style:{fontSize:12.5,color:"#86909c",lineHeight:1.6},children:t("setUiLogoHint")})]}),e.jsxs(S,{children:[e.jsx("input",{ref:O,type:"file",accept:".png,.jpg,.jpeg,.svg,.ico,.webp",style:{display:"none"},onChange:d=>se("logo",d.target)}),e.jsx(p,{size:"small",loading:V==="logo",onClick:()=>{O.current&&O.current.click()},children:t("setUiUpload")}),s?e.jsx(p,{size:"small",loading:V==="logo",onClick:()=>ie("logo"),children:t("setUiReset")}):null]})]}),e.jsx(T,{margin:12}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,flexWrap:"wrap"},children:[l?e.jsx("img",{src:l,alt:"Icon",style:{width:28,height:28,borderRadius:6,objectFit:"contain",border:"1px solid #e5e6eb"}}):e.jsx("div",{style:{width:28,height:28,borderRadius:6,border:"1px dashed #c9cdd4",display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,color:"#86909c"},children:"W"}),e.jsxs("div",{style:{flex:1,minWidth:200},children:[e.jsx("div",{style:{fontWeight:600,fontSize:13},children:t("setUiIcon")}),e.jsx("div",{style:{fontSize:12.5,color:"#86909c",lineHeight:1.6},children:t("setUiIconHint")})]}),e.jsxs(S,{children:[e.jsx("input",{ref:E,type:"file",accept:".png,.jpg,.jpeg,.svg,.ico,.webp",style:{display:"none"},onChange:d=>se("icon",d.target)}),e.jsx(p,{size:"small",loading:V==="icon",onClick:()=>{E.current&&E.current.click()},children:t("setUiUpload")}),l?e.jsx(p,{size:"small",loading:V==="icon",onClick:()=>ie("icon"),children:t("setUiReset")}):null]})]})]})})(),e.jsx(T,{margin:14}),e.jsx("div",{style:{fontWeight:600,fontSize:13,marginBottom:8},children:t("setBrandTextTitle")}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:12.5,color:"#86909c",marginBottom:4},children:t("setBrandName")}),e.jsx(u,{value:String(i.brand_name??""),onChange:s=>o("brand_name",s),placeholder:t("setBrandNamePh"),maxlength:40}),e.jsx("div",{style:{fontSize:12,color:"#86909c",lineHeight:1.7,marginTop:4},children:t("setBrandNameHint")})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:12.5,color:"#86909c",marginBottom:4},children:t("setMetaKw")}),e.jsx(u,{value:String(i.meta_keywords??""),onChange:s=>o("meta_keywords",s),placeholder:t("setMetaKwPh"),maxlength:200})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:12.5,color:"#86909c",marginBottom:4},children:t("setMetaDesc")}),e.jsx(A,{value:String(i.meta_description??""),onChange:s=>o("meta_description",s),placeholder:t("setMetaDescPh"),autosize:{minRows:2,maxRows:5},maxlength:300})]}),e.jsx("div",{style:{fontSize:12,color:"#86909c",lineHeight:1.7},children:t("setMetaHint")}),e.jsx("div",{children:e.jsx(p,{theme:"solid",size:"small",loading:xe,onClick:ye,children:t("save")})})]}),e.jsx(T,{margin:14}),e.jsx("div",{style:{fontWeight:600,fontSize:13,marginBottom:4},children:t("setMenuTitle")}),e.jsx("div",{style:{fontSize:12.5,color:"#86909c",lineHeight:1.7,marginBottom:10},children:t("setMenuDesc")}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(180px, 1fr))",gap:"8px 20px"},children:Re.flatMap(s=>s.items).map(s=>{const l=String(i&&i.hidden_menus||"").split(",").map(d=>d.trim()).filter(Boolean).includes(s.key);return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,borderBottom:"1px solid #f5f6f8",paddingBottom:6},children:[e.jsx(r.Text,{style:{fontSize:13},children:t(s.labelKey)}),e.jsx(oe,{size:"small",checked:!l,loading:ge,onChange:d=>he(s.key,d)})]},s.key)})}),e.jsx("div",{style:{marginTop:10,fontSize:12,color:"#86909c",lineHeight:1.7},children:t("setMenuHint")})]}),e.jsxs(w,{title:t("setSdkTitle"),style:{marginBottom:16},children:[e.jsx("div",{style:{fontSize:13,color:"#86909c",lineHeight:1.7,marginBottom:10},children:t("setSdkDesc")}),e.jsx(A,{value:String(i.sdk_snippet??""),onChange:s=>o("sdk_snippet",s),autosize:{minRows:3,maxRows:10},placeholder:L,style:{fontFamily:"var(--wstat-mono)",fontSize:12.5}}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,flexWrap:"wrap",marginTop:10},children:[e.jsx(r.Text,{type:"tertiary",size:"small",children:t("setSdkPh")}),e.jsxs(S,{children:[e.jsx(p,{size:"small",onClick:()=>o("sdk_snippet",L),children:t("setSdkUseDefault")}),e.jsx(p,{size:"small",onClick:()=>o("sdk_snippet",""),children:t("setSdkReset")}),e.jsx(p,{theme:"solid",size:"small",loading:f,onClick:D,children:t("save")})]})]}),Te?e.jsxs("div",{style:{fontSize:13,color:"#d4380d",lineHeight:1.6,marginTop:8},children:["⚠ ",t("setSdkNoKey")]}):null,e.jsxs("div",{style:{marginTop:14},children:[e.jsx("div",{style:{fontWeight:600,marginBottom:6,fontSize:13},children:t("setSdkPreview")}),e.jsx("pre",{style:{background:"#0f172a",color:"#e2e8f0",padding:"10px 12px",borderRadius:8,margin:0,fontSize:12.5,overflowX:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all"},children:ke})]})]}),e.jsxs(w,{title:t("setInjTitle"),style:{marginBottom:16},children:[e.jsx("div",{style:{fontSize:13,color:"#86909c",lineHeight:1.7,marginBottom:10},children:t("setInjDesc")}),e.jsx(A,{value:String(i.inject_code??""),onChange:s=>o("inject_code",s),autosize:{minRows:3,maxRows:12},placeholder:t("setInjPh"),style:{fontFamily:"var(--wstat-mono)",fontSize:12.5}}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,flexWrap:"wrap",marginTop:10},children:[e.jsx(r.Text,{type:"tertiary",size:"small",children:t("setInjPos")}),e.jsxs(S,{children:[e.jsx(p,{size:"small",onClick:()=>o("inject_code",""),children:t("setSdkReset")}),e.jsx(p,{theme:"solid",size:"small",loading:f,onClick:D,children:t("save")})]})]})]}),e.jsxs(w,{title:t("setIpTitle"),style:{marginBottom:16},children:[e.jsx("div",{style:{fontSize:13,color:"#86909c",lineHeight:1.7,marginBottom:10},children:t("setIpDesc")}),e.jsx(Ve,{value:i.ip_source||"remote_addr",onChange:s=>o("ip_source",s.target.value),direction:"vertical",children:[["x_forwarded_for","X-Forwarded-For",t("setIpOptXffHint")],["x_real_ip","X-Real-IP",t("setIpOptXriHint")],["remote_addr","REMOTE_ADDR",t("setIpOptRemoteHint")],["custom",t("setIpOptCustom"),t("setIpOptCustomHint")]].map(([s,l,d])=>e.jsxs(We,{value:s,style:{marginBottom:4},children:[e.jsx("span",{style:{fontFamily:I,fontSize:13},children:l}),e.jsx("div",{style:{fontSize:12,color:"#86909c",lineHeight:1.6},children:d})]},s))}),i.ip_source==="custom"&&e.jsxs("div",{style:{marginTop:8,maxWidth:380},children:[e.jsx(r.Text,{type:"tertiary",size:"small",children:t("setIpHeaderLabel")}),e.jsx(u,{value:i.ip_source_header||"",placeholder:t("setIpHeaderPh"),onChange:s=>o("ip_source_header",s)})]}),e.jsxs(S,{style:{marginTop:12},children:[e.jsx(p,{theme:"solid",size:"small",loading:Z,onClick:ue,children:t("save")}),e.jsx(p,{size:"small",loading:me,onClick:fe,children:t("setIpRun")}),e.jsx(r.Text,{type:"tertiary",size:"small",children:t("setIpRunHint")})]}),Q!==""&&e.jsx("div",{style:{marginTop:10},children:e.jsx(F,{type:"danger",description:t("setIpFail")+Q,closable:!1})}),m&&e.jsxs("div",{style:{marginTop:12},children:[e.jsx(T,{margin:"0 0 8px"}),e.jsx(r.Text,{type:"tertiary",size:"small",children:t("setIpCand")}),e.jsx("div",{style:{marginTop:6,border:"1px solid var(--semi-color-border, #e5e6eb)",borderRadius:6,overflow:"hidden"},children:(m.candidates||[]).map(s=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"150px 1fr 110px",gap:8,padding:"6px 10px",fontSize:12.5,alignItems:"center",background:s.current?"rgba(0,100,250,0.06)":"transparent"},children:[e.jsx("span",{style:{fontFamily:I,wordBreak:"break-all"},children:s.label}),e.jsx("span",{style:{fontFamily:I,wordBreak:"break-all",color:s.ok?"#1d2129":"#c9cdd4"},children:s.value||t("setIpNoHeader")}),e.jsx("span",{style:{textAlign:"right"},children:s.current?e.jsxs("span",{style:{color:"#00b42a",fontWeight:600},children:["✓ ",t("setIpCurrent")]}):s.key==="custom"&&!s.header?null:e.jsx(p,{size:"small",theme:"borderless",loading:Z,onClick:()=>je(s.key),children:t("setIpUse")})})]},s.key))}),e.jsx("div",{style:{marginTop:6,fontSize:12,color:"#86909c",lineHeight:1.7},children:t("setIpCandHint")}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"10px 20px",marginTop:12},children:[e.jsxs("div",{children:[e.jsx(r.Text,{type:"tertiary",size:"small",children:t("setIpRemote")}),e.jsx("div",{style:{fontFamily:I,fontSize:13,marginTop:2,wordBreak:"break-all"},children:(m.remote||"-")+(m.remote_cdn?" ("+m.remote_cdn+")":"")})]}),e.jsxs("div",{children:[e.jsx(r.Text,{type:"tertiary",size:"small",children:t("setIpApplied")}),e.jsx("div",{style:{fontFamily:I,fontSize:13,marginTop:2,wordBreak:"break-all"},children:(m.ip||"-")+" ← "+(m.source||"-")})]}),e.jsxs("div",{children:[e.jsx(r.Text,{type:"tertiary",size:"small",children:t("setIpGeo")}),e.jsxs("div",{style:{fontSize:13,marginTop:2},children:[m.geo_ok?[m.geo&&m.geo.country,m.geo&&m.geo.province,m.geo&&m.geo.city].filter(Boolean).join(" / "):t("setIpNone"),m.ip?e.jsx("span",{style:{marginLeft:6,fontSize:12,color:"#86909c"},children:m.is_ipv6?"IPv6":"IPv4"}):null]})]})]}),(m.advice||[]).length>0&&e.jsxs("div",{style:{marginTop:12},children:[e.jsx(T,{margin:"0 0 8px"}),e.jsx(r.Text,{type:"tertiary",size:"small",children:t("setIpAdvice")}),e.jsx("ul",{style:{margin:"6px 0 0",paddingLeft:20,fontSize:13,lineHeight:1.8,color:"#4e5969"},children:(m.advice||[]).map((s,l)=>e.jsx("li",{children:s},String(l)))})]})]})]}),e.jsxs(w,{title:t("setMailTitle"),children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"14px 20px"},children:[e.jsxs("div",{children:[e.jsx(r.Text,{type:"tertiary",size:"small",children:t("setSmtpHost")}),e.jsx(u,{value:i.smtp_host,onChange:s=>o("smtp_host",s),placeholder:"smtp.example.com",style:{marginTop:4}})]}),e.jsxs("div",{children:[e.jsx(r.Text,{type:"tertiary",size:"small",children:t("setSmtpPort")}),e.jsx(re,{value:Number(i.smtp_port)||465,onChange:s=>o("smtp_port",String(s??465)),min:1,max:65535,style:{width:"100%",marginTop:4}})]}),e.jsxs("div",{children:[e.jsx(r.Text,{type:"tertiary",size:"small",children:t("setSmtpSecure")}),e.jsx(He,{value:i.smtp_secure||"ssl",onChange:s=>o("smtp_secure",s),style:{width:"100%",marginTop:4},optionList:[{value:"ssl",label:"SSL(465)"},{value:"tls",label:"STARTTLS(587)"},{value:"none",label:t("setSecureNone")}]})]}),e.jsxs("div",{children:[e.jsx(r.Text,{type:"tertiary",size:"small",children:t("setSmtpUser")}),e.jsx(u,{value:i.smtp_username,onChange:s=>o("smtp_username",s),style:{marginTop:4}})]}),e.jsxs("div",{children:[e.jsx(r.Text,{type:"tertiary",size:"small",children:t("setSmtpPass")}),e.jsx(u,{mode:"password",value:i.smtp_password,onChange:s=>o("smtp_password",s),placeholder:t("setSmtpPassHint"),style:{marginTop:4}})]}),e.jsxs("div",{children:[e.jsx(r.Text,{type:"tertiary",size:"small",children:t("setFromName")}),e.jsx(u,{value:i.smtp_from_name,onChange:s=>o("smtp_from_name",s),style:{marginTop:4}})]}),e.jsxs("div",{style:{gridColumn:"1 / -1"},children:[e.jsx(r.Text,{type:"tertiary",size:"small",children:t("setFromEmail")}),e.jsx(u,{value:i.smtp_from_email,onChange:s=>o("smtp_from_email",s),placeholder:"[email protected]",style:{marginTop:4}})]})]}),e.jsx(T,{margin:16}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,flexWrap:"wrap"},children:[e.jsx(r.Text,{type:"tertiary",size:"small",children:t("setMailHint")}),e.jsxs(S,{children:[e.jsx(u,{value:N,onChange:de,placeholder:t("setTestTo"),style:{width:240},size:"small"}),e.jsx(p,{size:"small",loading:v,onClick:ve,children:t("setTestBtn")}),e.jsx(p,{theme:"solid",size:"small",loading:f,onClick:D,children:t("save")})]})]})]}),e.jsxs(w,{title:t("setVerTitle"),style:{marginTop:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12,flexWrap:"wrap"},children:[e.jsxs("div",{style:{minWidth:240},children:[e.jsxs("div",{style:{fontWeight:600,marginBottom:2},children:[t("setVerCur"),":v",n&&n.version||"…"]}),e.jsx("div",{style:{fontSize:13,color:"#86909c",lineHeight:1.6},children:n?n.latest?`${t("setVerLatest")}:v${n.latest} · ${n.has_update?t("setVerNew"):t("setVerUpToDate")}`:n.msg||t("setVerFail"):t("setVerDesc")}),n&&n.has_update&&n.released_at?e.jsxs("div",{style:{fontSize:12,color:"#86909c",marginTop:2},children:[t("setVerReleased"),":",n.released_at]}):null]}),e.jsxs(S,{children:[n&&n.has_update&&n.can_auto?e.jsx(p,{type:"warning",theme:"solid",size:"small",loading:pe,onClick:we,children:t("setVerUpgrade")}):null,n&&n.has_update&&!n.can_auto&&n.full_url?e.jsx("a",{href:n.full_url,target:"_blank",rel:"noreferrer",style:{fontSize:13,lineHeight:"28px"},children:t("setVerDownloadFull")}):null,e.jsx(p,{size:"small",loading:ce,onClick:Se,children:t("setVerCheck")})]})]}),n&&n.has_update&&n.reason?e.jsx("div",{style:{marginTop:12},children:e.jsx(F,{type:n.can_auto?"info":"warning",description:n.reason})}):null,n&&n.changelog&&n.changelog.length?e.jsxs("div",{style:{marginTop:14},children:[e.jsx("div",{style:{fontWeight:600,marginBottom:6,fontSize:13},children:t("setVerChanges")}),e.jsx("ul",{style:{margin:0,paddingLeft:20,fontSize:13,color:"#4e5969",lineHeight:1.8},children:n.changelog.map((s,l)=>e.jsx("li",{children:s},l))})]}):null,n&&n.notes?e.jsx("div",{style:{marginTop:8,fontSize:13,color:"#86909c"},children:n.notes}):null,e.jsx(T,{margin:14}),e.jsxs("div",{style:{display:"flex",gap:18,flexWrap:"wrap",fontSize:12,color:"#86909c"},children:[e.jsxs("span",{children:[t("setVerLayout"),":",n&&n.layout?n.layout:"—"]}),e.jsxs("span",{children:[t("setVerBackups"),":",n&&n.backups&&n.backups.length?n.backups.map(s=>s.name).join("、"):t("setVerNoBackup")]}),n&&n.update_enabled===!1?e.jsx("span",{children:t("setVerOff")}):null]})]})]}):null]})}export{Ze as default};