PageSourceSearch

https://nickz.ai/assets/js/PersonalSetting-DKgcUK1y.js

js nickz.ai collected 2026-10-05 14:20:16 UTC 65,724 bytes, 1 lines download raw bytes

1import{r as e,u as s,h as a,j as t}from"./vendor-react-DejgYtBM.js";import{U as l,S as i,u as r,G as n,H as d,J as c,A as o,s as m,K as x,E as u,M as h,N as g,O as j,P as p,Q as f,R as v,T as N,V as y,W as b,x as _,w,v as k,B as z,D as T,X as C}from"./index-BeIIFw6E.js";import{_ as S}from"./index-BOZr6JVI.js";import{m as I,A as O,i as W,T as $,a as q,f as U,S as P,E as B,I as E,b as K,j as M,q as R,l as A,r as L,B as D,F,p as Q,s as G,t as V,k as H,u as J,v as X,M as Z,w as Y,o as ee}from"./vendor-semi-D8d7bTtM.js";import{S as se,a as ae,b as te,c as le}from"./index-N09zZel9.js";import{T as ie}from"./index-KF7PEnkU.js";import{C as re}from"./Captcha-DqOlJ3BU.js";import{U as ne,S as de,d as ce,e as oe,f as me,c as xe,g as ue,G as he,h as ge,i as je,K as pe,L as fe,T as ve,j as Ne,k as ye,l as be,W as _e,m as we,n as ke,o as ze,B as Te}from"./vendor-icons-EJvJ5X-w.js";import"./vendor-motion-Chfy_MiU.js";import"./iconBase-SIM2SzwB.js";import"./captchaCrypto-qWW2iG_E.js";function Ce(){try{const e=localStorage.getItem("status");return e?JSON.parse(e):{}}catch{return{}}}const Se=()=>{const[Se,Ie]=e.useContext(l),[Oe,We]=e.useContext(i);let $e=s();const qe=a(),{t:Ue}=r();n();const Pe=d(),Be=(()=>{try{return new URLSearchParams(qe.search).get("tab")||"models"}catch{return"models"}})(),[Ee,Ke]=e.useState(Be);e.useEffect(()=>{try{const e=new URLSearchParams(qe.search).get("tab");e&&Ke(e)}catch{}},[qe.search]);const Me=Oe?.status?.enabled_personal_features,Re=null!=Me?Me.split(",").map(e=>e.trim()).filter(Boolean):null,Ae=null===Re||Re.includes("change_password"),Le=null===Re||Re.includes("delete_account"),De=Oe?.status?.personal_verify_enabled??!0,[Fe,Qe]=e.useState({wechat_verification_code:"",email_verification_code:"",email:"",phone:"",ph
1one_verification_code:"",self_account_deletion_confirmation:"",original_password:"",set_new_password:"",set_new_password_confirmation:""}),[Ge,Ve]=e.useState({}),[He,Je]=e.useState(!1),[Xe,Ze]=e.useState(!1),[Ye,es]=e.useState(!1),[ss,as]=e.useState(!1),[ts,ls]=e.useState(!1),[is,rs]=e.useState(60),[ns,ds]=e.useState(!1),[cs,os]=e.useState(!1),[ms,xs]=e.useState(!1),[us,hs]=e.useState(""),[gs,js]=e.useState(""),[ps,fs]=e.useState(!1),[vs,Ns]=e.useState(!1),[ys,bs]=e.useState(30),[_s,ws]=e.useState(""),[ks,zs]=e.useState([]),[Ts,Cs]=e.useState(()=>{const e=localStorage.getItem("modelsExpanded");return!!e&&JSON.parse(e)}),[Ss,Is]=e.useState("all"),[Os,Ws]=e.useState({warningType:"email",warningThreshold:1e5,webhookUrl:"",webhookSecret:"",notificationEmail:"",acceptUnsetModelRatioModel:!1,recordIpLog:!1,subscriptionOptions:["quota_push","sale_push","back_push","system_push","price_push","token_warning_push","token_exhaust_push"],tokenQuotaWarningPercent:20,wxpusherUid:"",wecomKey:"",dingtalkToken:"",dingtalkSecret:"",dingtalkAtMobiles:"",telegramBotToken:"",telegramChatId:"",feishuWebhookUrl:"",feishuSecret:""}),[$s,qs]=e.useState(!1),[Us,Ps]=e.useState(!1),[Bs,Es]=e.useState("initial"),[Ks,Ms]=e.useState(""),Rs=e.useRef(null),As=e.useRef(null),[Ls,Ds]=e.useState(!0),[Fs,Qs]=e.useState(!0),[Gs,Vs]=e.useState("notify"),[Hs,Js]=e.useState(null),[Xs,Zs]=e.useState(!1),[Ys,ea]=e.useState(!1),[sa,aa]=e.useState(""),[ta,la]=e.useState(null),[ia,ra]=e.useState(!1),[na,da]=e.useState(null),[ca,oa]=e.useState(!0),[ma,xa]=e.useState(!1),[ua,ha]=e.useState(!1);e.useEffect(()=>{if(!Se?.user?.id||!c())return;let e=!1;return(async()=>{xa(!0);try{const s=await o.get("/api/option/getagentoptions"),{success:a,message:t,data:l}=s.data;if(!a)return void m(t||Ue("加载失败"));!e&&l&&oa(!1!==l.ticket_enabled)}catch(s){m(s.message||Ue("加载失败"))}finally{e||xa(!1)}})(),()=>{e=!0}},[Se?.user?.id,Se?.user?.role,Ue]);const ga=async()=>{try{const e=await o.get("/api/option/getagentoptions"),{success:s,data:a}=e.data;s&&a&&oa(!1!==a.ticket_enabled)}catch{}};e.useEffect(()=>{const e=Oe?.status||Ce()||{};Ve(e),(Oe?.status?.turnstile_check||e.turnstile_check)&&(xs(!0),hs(Oe?.status?.turnstile_site_key||e.turnstile_site_key)),pa().then(e=>{}),fa().then(),va().then()},[Oe?.status]),e.useEffect(()=>{let e=null;return vs&&ys>0?e=setInterval(()=>{bs(ys-1)},1e3):0===ys&&(Ns(!1),bs(30)),()=>clearInterval(e)},[vs,ys]),e.useEffect(()=>{let e=null;return ts&&is>0?e=setInterval(()=>{rs(is-1)},1e3):0===is&&(ls(!1),rs(60)),()=>clearInterval(e)},[ts,is]),e.useEffect(()=>{if(Se?.user?.setting){const e=JSON.parse(Se.user.setting);Ws({warningType:e.notify_type||"email",warningThreshold:e.quota_
1warning_threshold||x(1),webhookUrl:e.webhook_url||"",webhookSecret:e.webhook_secret||"",notificationEmail:e.notification_email||"",acceptUnsetModelRatioModel:e.accept_unset_model_ratio_model||!1,recordIpLog:e.record_ip_log||!1,subscriptionOptions:e.subscription_options?e.subscription_options.split(","):["quota_push","sale_push","back_push","system_push","price_push","token_warning_push","token_exhaust_push"],tokenQuotaWarningPercent:e.token_quota_warning_percent||20,wxpusherUid:e.wxpusher_uid||"",wecomKey:e.wecom_key||"",dingtalkToken:e.dingtalk_token||"",dingtalkSecret:e.dingtalk_secret||"",dingtalkAtMobiles:e.dingtalk_at_mobiles||"",telegramBotToken:e.telegram_bot_token||"",telegramChatId:e.telegram_chat_id||"",feishuWebhookUrl:e.feishu_webhook_url||"",feishuSecret:e.feishu_secret||""}),e.wxpusher_uid?Ps(!0):Ps(!1)}},[Se?.user?.setting]),e.useEffect(()=>{localStorage.setItem("modelsExpanded",JSON.stringify(Ts))},[Ts]),e.useEffect(()=>()=>{Rs.current&&clearInterval(Rs.current),As.current&&clearTimeout(As.current)},[]);const ja=(e,s)=>{Qe(a=>({...a,[e]:s}))},pa=async()=>{let e=await o.get("/api/user/self");const{success:s,message:a,data:t}=e.data;s?(u(t),Ie({type:"login",payload:t})):m(a)},fa=async()=>{Ds(!0);try{let e=await o.get("/api/user/models");const{success:s,message:a,data:t}=e.data;s?null!=t&&zs(t):m(a)}catch(e){m(Ue("加载模型列表失败"))}finally{Ds(!1)}},va=async()=>{Zs(!0);try{const e=await o.get("/api/identity_verify/status");e.data.success&&Js(e.data.data)}catch(e){console.error("获取认证状态失败:",e)}finally{Zs(!1)}},Na=async e=>{const s=e||"";Ns(!0),fs(!0);try{const e=[`email=${encodeURIComponent(Fe.email)}`,`turnstile=${encodeURIComponent(gs||"")}`];s&&e.push(`captcha_token=${encodeURIComponent(s)}`);const a=await o.get(`/api/verification?${e.join("&")}`),{success:t,message:l}=a.data;t?w(Ue("验证码发送成功,请检查邮箱!")):(m(l),Ns(!1))}catch(a){m(a),Ns(!1)}finally{fs(!1)}},ya=e=>/^\+?[1-9]\d{1,14}$/.test(e),ba=()=>Se.user?Se.user.username:"null",_a=async e=>{await k(e)?w(Ue("已复制")+":"+e):Z.error({title:Ue("无法复制到剪贴板,请手动复制"),content:e})},wa=(e,s)=>{Ws(a=>({...a,[e]:s.target?void 0!==s.target.value?s.target.value:s.target.checked:s}))},ka=async(e="save")=>{try{const s=await o.put("/api/user/setting",{notify_type:Os.warningType,quota_warning_threshold:parseFloat(Os.warningThreshold),webhook_url:Os.webhookUrl,webhook_secret:Os.webhookSecret,notification_email:Os.notificationEmail,wxpusher_uid:Os.wxpusherUid,accept_unset_model_ratio_model:Os.acceptUnsetModelRatioModel,record_ip_log:Os.recordIpLog,subscription_options:Os.subscriptionOptions.join(","),token_quota_warning_percent:Os.tokenQuotaWarningPercent,wecom_key:Os.wecomKey,dingtalk_token:Os.dingtalkToken,dingtalk_secret:Os.dingtalkSecret,dingtalk_at_mobiles:Os.dingtalkAtMobiles,telegram_bot_token:Os.telegramBotToken,telegram_chat_id:Os.telegramChatId,feishu_webhook_url:Os.feishuWebhookUrl,feishu_secret:Os.feishuSecret});return"test"!==e&&(s.data.success?(w(Ue("设置保存成功")),await pa()):m(s.data.message||Ue("设置保存失败"))),{success:!!s.data.success,message:s.data.message}}catch(s){const a=s?.response?.data?.message;return"test"!==e&&m(a||Ue("设置保存失败")),{success:!1,message:a}}},za=async()=>{if("initial"===Bs||"expired"===Bs){Es("loading");try{const e=await o.get("/api/push/wxpusher_qrcode"),{success:s,message:a,data:t}=e.data;s?(Ms(t.qrcode_url),Es("loaded"),Rs.current=setInterval(Ta,2e3),As.current=setTimeout(()=>{clearInterval(Rs.current),Es("expired")},6e4)):(m(a),Es("initial"))}catch(e){console.error("Error fetching QR code:",e),m(Ue("获取二维码失败")),Es("initial")}}},Ta=async()=>{try{const e=await o.get("/api/push/self"),{success:s,data:a}=e.data;s&&a.notice_receiver_uid&&(clearInterval(Rs.current),clearTimeout(As.current),Ps(!0),Es("initial"),w(Ue("绑定成功!")),await pa())}catch(e){console.error("Error checking bind status:",e)}},Ca=()=>{Z.confirm({title:Ue("确认解绑"),content:Ue("您确定要解绑WxPusher吗?"),onOk:async()=>{try{const e=await o.post("/api/push/unbind_wxpusher"),{success:s,message:a}=e.data;s?(Ps(!1),Es("initial"),Ms(""),w(a),await pa()):m(a)}catch{m(Ue("解绑失败"))}}})};return t.jsxs("div",{className:"bg-background",children:[t.jsx("div",{className:"flex justify-center",children:t.jsx("div",{className:"w-full",children:t.jsxs(I,{className:"!rounded-2xl shadow-lg border-0",children:[t.jsxs(I,{className:"!rounded-2xl !border-0 !shadow-lg overflow-hidden",style:{background:"dark"===Pe?"linear-gradient(135deg, #1e293b 0%, #334155 50%, #475569 100%)":"linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #cbd5e1 100%)",position:"relative"},bodyStyle:{padding:0},children:[t.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[t.jsx("div",{className:"absolute -top-10 -right-10 w-40 h-40 bg-slate-400 dark:bg-slate-500 opacity-5 rounded-full"}),t.jsx("div",{className:"absolute -bottom-16 -left-16 w-48 h-48 bg-slate-300 dark:bg-slate-400 opacity-8 rounded-full"}),t.jsx("div",{className:"absolute top-1/2 right-1/4 w-24 h-24 bg-slate-400 dark:bg-slate-500 opacity-6 rounded-full"})]}),t.jsxs("div",{className:"relative p-4 sm:p-6 md:p-8 text-foreground
1/80",children:[t.jsxs("div",{className:"flex justify-between items-start mb-4 sm:mb-6",children:[t.jsxs("div",{className:"flex items-center flex-1 min-w-0",children:[t.jsx(O,{size:"large",className:"mr-3 sm:mr-4 shadow-md flex-shrink-0 bg-primary",children:(()=>{const e=ba();return e&&e.length>0?e.slice(0,2).toUpperCase():"NA"})()}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-base sm:text-lg font-semibold truncate text-foreground cursor-pointer",onClick:()=>_a(ba()),title:Ue("点击复制"),children:ba()}),t.jsxs("div",{className:"mt-1 flex flex-wrap gap-1 sm:gap-2",children:[t.jsx(W,{size:"small",className:"!rounded-full bg-fill-subtle text-foreground",style:{fontWeight:"500"},children:Ue(h(Se?.user?.role))}),t.jsxs(W,{size:"small",className:"!rounded-full bg-fill-subtle text-foreground cursor-pointer",style:{fontWeight:"500"},onClick:()=>_a(String(Se?.user?.id)),title:Ue("点击复制"),children:["ID: ",Se?.user?.id]})]})]})]}),t.jsx("div",{className:"w-10 h-10 sm:w-12 sm:h-12 rounded-lg flex items-center justify-center shadow-md flex-shrink-0 ml-2 bg-primary",children:t.jsx(ne,{size:20,className:"text-white"})})]}),t.jsxs("div",{className:"mb-4 sm:mb-6",children:[t.jsx("div",{className:"text-xs sm:text-sm mb-1 sm:mb-2 text-muted-foreground",children:Ue("当前余额")}),t.jsx("div",{className:"text-2xl sm:text-3xl md:text-4xl font-bold tracking-wide text-foreground cursor-pointer",onClick:()=>_a(g(Se?.user?.quota)),title:Ue("点击复制"),children:g(Se?.user?.quota)})]}),t.jsx("div",{className:"flex flex-col sm:flex-row sm:justify-between sm:items-end",children:t.jsxs("div",{className:"grid grid-cols-3 gap-2 sm:flex sm:space-x-6 lg:space-x-8 mb-3 sm:mb-0",children:[t.jsxs("div",{className:"text-center sm:text-left",children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:Ue("历史消耗")}),t.jsx("div",{className:"text-xs sm:text-sm font-medium truncate text-foreground/80 cursor-pointer",onClick:()=>_a(g(Se?.user?.used_quota)),title:Ue("点击复制"),children:g(Se?.user?.used_quota)})]}),t.jsxs("div",{className:"text-center sm:text-left",children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:Ue("请求次数")}),t.jsx("div",{className:"text-xs sm:text-sm font-medium truncate text-foreground/80 cursor-pointer",onClick:()=>_a(String(Se.user?.request_count||0)),title:Ue("点击复制"),children:Se.user?.request_count||0})]}),t.jsxs("div",{className:"text-center sm:text-left",children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:Ue("用户分组")}),t.jsx("div",{className:"text-xs sm:text-sm font-medium truncate text-foreground/80 cursor-pointer",onClick:()=>_a(Se?.user?.group||Ue("默认")),title:Ue("点击复制"),children:Se?.user?.group||Ue("默认")})]})]})}),t.jsx("div",{className:"absolute top-0 left-0 w-full h-2 bg-primary opacity-60"})]})]}),t.jsx("div",{className:"p-4",children:t.jsxs($,{type:"line",activeKey:Ee,onChange:Ke,className:"modern-tabs",children:[t.jsx(q,{tab:t.jsxs("div",{className:"flex items-center",children:[t.jsx(de,{size:16,className:"mr-2"}),Ue("可用模型")]}),itemKey:"models",children:t.jsx("div",{className:"gap-6 py-4",children:t.jsxs("div",{className:"bg-card rounded-xl",children:[t.jsxs("div",{className:"flex items-center mb-4",children:[t.jsx("div",{className:"w-10 h-10 rounded-full bg-fill-default flex items-center justify-center mr-3",children:t.jsx(de,{size:20,className:"text-foreground"})}),t.jsxs("div",{children:[t.jsx(U.Title,{heading:6,className:"mb-0",children:Ue("模型列表")}),t.jsx("div",{className:"text-muted-foreground text-sm",children:Ue("点击模型名称可复制")})]})]}),Ls?t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"mb-4",style:{borderBottom:"1px solid hsl(var(--border))"},children:t.jsx("div",{className:"flex overflow-x-auto py-2 gap-2",children:Array.from({length:8}).map((e,s)=>t.jsx(P.Button,{style:{width:0===s?130:100+50*Math.random(),height:36,borderRadius:8}},`cat-${s}`))})}),t.jsx("div",{className:"flex flex-wrap gap-2",children:Array.from({length:20}).map((e,s)=>t.jsx(P.Button,{style:{width:100+100*Math.random(),height:32,borderRadius:16,margin:"4px"}},`model-${s}`))})]}):0===ks.length?t.jsx("div",{className:"py-8",children:t.jsx(B,{image:t.jsx(K,{style:{width:150,height:150}}),darkModeImage:t.jsx(E,{style:{width:150,height:150}}),description:Ue("没有可用模型"),style:{padding:"24px 0"}})}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"mb-4",children:t.jsx($,{type:"card",activeKey:Ss,onChange:e=>Is(e),className:"mt-2",children:Object.entries(j(Ue)).map(([e,s])=>{const a="all"===e?ks.length:ks.filter(e=>s.filter({model_name:e})).length;return 0===a&&"all"!==e?null:t.jsx(q,{tab:t.jsxs("span",{className:"flex items-center gap-2",children:[s.icon&&t.jsx("span",{className:"w-4 h-4",children:s.icon}),s.label,t.jsx(W,{color:Ss===e?"red":"grey",size:"small",shape:"circle",children:a})]}),itemKey:e},e)})})}),t.jsx("div",{className:"bg-card rounded-lg p-3",children:(()=>{const e=j(Ue),s="all"===Ss?ks:ks.filter(s=>e[Ss].filter({model_name:s}));return 0===s.length?t.jsx(B,{image:t.jsx(K,{style:{width:120,height:120}}),darkModeImage:t.jsx(E,{style:{width:120,height:120}}),description:Ue("该分类下没有可用模型"),style:{padding:"16px 0"}}):s.length<=25?t.jsx(M,{wrap:!0,children:s.map(e=>p(e,{size:"large",shape:"circle",onClick:()=>_a(e)}))}):t.jsxs(t.Fragment,{children:[t.jsx(R,{isOpen:Ts,children:t.jsxs(M,{wrap:!0,children:[s.map(e=>p(e,{size:"large",shape:"circle",onClick:()=>_a(e)})),t.jsx(W,{color:"grey",type:"light",className:"cursor-pointer !rounded-lg",onClick:()=>Cs(!1),icon:t.jsx(ce,{size:16}),children:Ue("收起")})]})}),!Ts&&t.jsxs(M,{wrap:!0,children:[s.slice(0,25).map(e=>p(e,{size:"large",shape:"circle",onClick:()=>_a(e)})),t.jsxs(W,{color:"grey",type:"light",className:"cursor-pointer !rounded-lg",onClick:()=>Cs(!0),icon:t.jsx(oe,{size:16}),children:[Ue("更多")," ",s.length-25," ",Ue("个模型")]})]})]})})()})]})]})})}),t.jsx(q,{tab:t.jsxs("div",{className:"flex items-center",children:[t.jsx(je,{size:16,className:"mr-2"}),Ue("账户绑定")]}),itemKey:"account",children:t.jsxs("div",{className:"py-4",children:[c()&&t.jsx(I,{className:"!rounded-xl transition-shadow mb-4",bodyStyle:{padding:"16px"},shadows:"hover",children:t.jsxs("div",{className:"flex items-center justify-between gap-4",children:[t.jsxs("div",{className:"flex items-start flex-1 min-w-0",children:[t.jsx("div",{className:"w-10 h-10 rounded-full bg-fill-subtle flex items-center justify-center mr-3 shrink-0",children:t.jsx(me,{size:20,className:"text-foreground"})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"font-medium text-foreground",children:Ue("分站用户显示我的工单")}),t.jsx("div",{className:"text-sm text-muted-foreground mt-1",children:Ue("分站工单入口说明")})]})]}),ma?t.jsx(A,{}):t.jsx(L,{checked:ca,disabled:ua,onChange:async e=>{ha(!0);try{const s=await o.post("/api/option/updateagentoption",{ticket_enabled:e}),{success:a,message:t}=s.data;a?(oa(e),w(Ue("保存成功")),We({type:"set",payload:{...Oe?.status||{},ticket_enabled:e}})):(m(t||Ue("保存失败")),await ga())}catch(s){m(s.message||Ue("保存失败")),await ga()}finally{ha(!1)}}})]})}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[t.jsx(I,{className:"!rounded-xl transition-shadow",bodyStyle:{padding:"16px"},shadows:"hover",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center flex-1",children:[t.jsx("div",{className:"w-10 h-10 rounded-full bg-fill-subtle flex items-center justify-center mr-3",children:t.jsx(xe,{size:20,className:"text-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"font-medium text-foreground",children:Ue("邮箱")}
1),t.jsx("div",{className:"text-sm text-muted-foreground truncate",children:Se.user&&""!==Se.user.email?Se.user.email:Ue("未绑定")})]})]}),t.jsx(D,{type:"primary",theme:"outline",size:"small",onClick:()=>es(!0),className:"!rounded-lg",children:Se.user&&""!==Se.user.email?Ue("修改绑定"):Ue("绑定")})]})}),Ge.sms_login_enabled&&t.jsx(I,{className:"!rounded-xl transition-shadow",bodyStyle:{padding:"16px"},shadows:"hover",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center flex-1",children:[t.jsx("div",{className:"w-10 h-10 rounded-full bg-fill-subtle flex items-center justify-center mr-3",children:t.jsx(ue,{size:20,className:"text-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"font-medium text-foreground",children:Ue("手机号")}),t.jsx("div",{className:"text-sm text-muted-foreground truncate",children:Se.user&&Se.user.phone?Se.user.phone:Ue("未绑定")})]})]}),t.jsx(D,{type:"primary",theme:"outline",size:"small",onClick:()=>as(!0),className:"!rounded-lg",children:Se.user&&Se.user.phone?Ue("修改绑定"):Ue("绑定")})]})}),t.jsx(I,{className:"!rounded-xl transition-shadow",bodyStyle:{padding:"16px"},shadows:"hover",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center flex-1",children:[t.jsx("div",{className:"w-10 h-10 rounded-full bg-fill-subtle flex items-center justify-center mr-3",children:t.jsx(se,{size:20,className:"text-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"font-medium text-foreground",children:Ue("微信")}),t.jsx("div",{className:"text-sm text-muted-foreground truncate",children:Se.user&&""!==Se.user.wechat_id?Ue("已绑定"):Ue("未绑定")})]})]}),t.jsx(D,{type:"primary",theme:"outline",size:"small",disabled:!Ge.wechat_login,onClick:()=>Ze(!0),className:"!rounded-lg",children:Se.user&&""!==Se.user.wechat_id?Ue("修改绑定"):Ge.wechat_login?Ue("绑定"):Ue("未启用")})]})}),t.jsx(I,{className:"!rounded-xl transition-shadow",bodyStyle:{padding:"16px"},shadows:"hover",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center flex-1",children:[t.jsx("div",{className:"w-10 h-10 rounded-full bg-fill-subtle flex items-center justify-center mr-3",children:t.jsx(he,{size:20,className:"text-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"font-medium text-foreground",children:Ue("GitHub")}),t.jsx("div",{className:"text-sm text-muted-foreground truncate",children:Se.user&&""!==Se.user.github_id?Se.user.github_id:Ue("未绑定")})]})]}),t.jsx(D,{type:"primary",theme:"outline",size:"small",onClick:()=>{const e=Se.user&&Se.user.github_id||"",s=()=>C(Ge.github_client_id,!0);""!==e?Z.confirm({title:Ue("修改 GitHub 绑定"),centered:!0,content:t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("div",{children:[Ue("当前已绑定 GitHub 账号 ID:"),t.jsx("strong",{children:e})]}),t.jsx("div",{className:"text-sm text-[var(--semi-color-text-2)]",children:Ue("继续授权时会弹出 GitHub 账号选择页,请选择要绑定的账号;若要绑定其他账号,可在该页登录对应账号后再选择。")})]}),okText:Ue("继续前往授权"),cancelText:Ue("取消"),onOk:s}):s()},disabled:!Ge.github_oauth,className:"!rounded-lg",children:Ge.github_oauth?Se.user&&""!==Se.user.github_id?Ue("修改绑定"):Ue("绑定"):Ue("未启用")})]})}),t.jsx(I,{className:"!rounded-xl transition-shadow",bodyStyle:{padding:"16px"},shadows:"hover",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center flex-1",children:[t.jsx("div",{className:"w-10 h-10 rounded-full bg-fill-subtle flex items-center justify-center mr-3",children:t.jsx(ae,{size:20,className:"text-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"font-medium text-foreground",children:Ue("Google")}),t.jsx("div",{className:"text-sm text-muted-foreground truncate",children:Se.user&&""!==Se.user.google_id?Se.user.google_id:Ue("未绑定")})]})]}),t.jsx(D,{type:"primary",theme:"outline",size:"small",onClick:()=>f(Ge.google_client_id,!0),disabled:Se.user&&""!==Se.user.google_id||!Ge.google_oauth,className:"!rounded-lg",children:Ge.google_oauth?Ue("绑定"):Ue("未启用")})]})}),t.jsx(I,{className:"!rounded-xl transition-shadow",bodyStyle:{padding:"16px"},shadows:"hover",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center flex-1",children:[t.jsx("div",{className:"w-10 h-10 rounded-full bg-fill-subtle flex items-center justify-center mr-3",children:t.jsx(ge,{size:20,className:"text-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"font-medium text-foreground",children:Ue("OIDC")}),t.jsx("div",{className:"text-sm text-muted-foreground truncate",children:Se.user&&""!==Se.user.oidc_id?Se.user.oidc_id:Ue("未绑定")})]})]}),t.jsx(D,{type:"primary",theme:"outline",size:"small",onClick:()=>v(Ge.oidc_authorization_endpoint,Ge.oidc_client_id,!1,!0),disabled:Se.user&&""!==Se.user.oidc_id||!Ge.oidc_enabled,className:"!rounded-lg",children:Ge.oidc_enabled?Ue("绑定"):Ue("未启用")})]})}),t.jsx(I,{className:"!rounded-xl transition-shadow",bodyStyle:{padding:"16px"},shadows:"hover",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center flex-1",children:[t.jsx("div",{className:"w-10 h-10 rounded-full bg-fill-subtle flex items-center justify-center mr-3",children:t.jsx(te,{size:20,className:"text-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"font-medium text-foreground",children:Ue("Telegram")}),t.jsx("div",{className:"text-sm text-muted-foreground truncate",children:Se.user&&""!==Se.user.telegram_id?Se.user.telegram_id:Ue("未绑定")})]})]}),t.jsx("div",{className:"flex-shrink-0",children:Ge.telegram_oauth?""!==Se.user.telegram_id?t.jsx(D,{disabled:!0,size:"small",className:"!rounded-lg",children:Ue("已绑定")}):t.jsx("div",{className:"scale-75",children:t.jsx(ie,{dataAuthUrl:"/api/oauth/telegram/bind",botName:Ge.telegram_bot_name})}):t.jsx(D,{disabled:!0,size:"small",className:"!rounded-lg",children:Ue("未启用")})})]})}),t.jsx(I,{className:"!rounded-xl transition-shadow",bodyStyle:{padding:"16px"},shadows:"hover",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center flex-1",children:[t.jsx("div",{className:"w-10 h-10 rounded-full bg-fill-subtle flex items-center justify-center mr-3",children:t.jsx(le,{size:20,className:"text-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"font-medium text-foreground",children:Ue("LinuxDO")}),t.jsx("div",{className:"text-sm text-muted-foreground truncate",children:Se.user&&""!==Se.user.linux_do_id?Se.user.linux_do_id:Ue("未绑定")})]})]}),t.jsx(D,{type:"primary",theme:"outline",size:"small",onClick:()=>N(Ge.linuxdo_client_id,!0),disabled:Se.user&&""!==Se.user.linux_do_id||!Ge.linuxdo_oauth,className:"!rounded-lg",children:Ge.linuxdo_oauth?Ue("绑定"):Ue("未启用")})]})})]})]})}),t.jsx(q,{tab:t.jsxs("div",{className:"flex items-center",children:[t.jsx(Ne,{size:16,className:"mr-2"}),Ue("安全设置")]}),itemKey:"security",children:t.jsx("div",{className:"py-4",children:t.jsx("div",{className:"space-y-6",children:t.jsxs(M,{vertical:!0,className:"w-full",children:[t.jsx(I,{className:"!rounded-xl w-full",bodyStyle:{padding:"20px"},shadows:"hover",children:t.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:justify-between gap-4",children:[t.jsxs("div",{className:"flex items-start w-full sm:w-auto",children:[t.jsx("div",{className:"w-12 h-12 rounded-full bg-fill-subtle flex items-center justify-center mr-4 flex-shrink-0",children:t.jsx(pe,{size:20,className:"text-foreground"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx(U.Title,{heading:6,className:"mb-1",children:Ue("系统访问令牌")}),t.jsx(U.Text,{type:"tertiary",className:"text-sm",children:Ue("用于API调用的身份验证令牌,请妥善保管")}),_s&&t.jsx("div",{className:"mt-3",children:t.jsx(F,{readonly:!0,value:_s,onClick:async e=>{e.target.select(),await k(e.target.value),w(Ue("系统令牌已复制到剪切板"))},size:"large",className:"!rounded-lg",prefix:t.jsx(pe,{size:16})})})]})]}),t.jsx(D,{type:"primary",theme:"solid",onClick:async()=>{const e=await o.get("/api/user/token"),{success:s,message:a,data:t}=e.data;s?(ws(t),await k(t),w(Ue("令牌已重置并已复制到剪贴板"))):m(a)},className:"!rounded-lg !bg-primary hover:!bg-primary-hover !text-white w-full sm:w-auto",icon:t.jsx(pe,{size:16}),children:Ue(_s?"重新生成":"生成令牌")})]})}),Ae&&t.jsx(I,{className:"!rounded-xl w-full",bodyStyle:{padding:"20px"},shadows:"hover",children:t.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:justify-between gap-4",children:[t.jsxs("div",{className:"flex items-start w-full sm:w-auto",children:[t.jsx("div",{className:"w-12 h-12 rounded-full bg-fill-subtle flex items-center justify-center mr-4 flex-shrink-0",children:t.jsx(fe,{size:20,className:"text-foreground"})}),t.jsxs("div",{children:[t.jsx(U.Title,{heading:6,className:"mb-1",children:Ue("密码管理")}),t.jsx(U.Text,{type:"tertiary",className:"text-sm",children:Ue("定期更改密码可以提高账户安全性")})]})]}),t.jsx(D,{type:"primary",theme:"solid",onClick:()=>Je(!0),className:"!rounded-lg !bg-primary hover:!bg-primary-hover !text-white w-full sm:w-auto",icon:t.jsx(fe,{size:16}),children:Ue("修改密码")})]})}),Le&&t.jsx(I,{className:"!rounded-xl border-red-200 w-full",bodyStyle:{padding:"20px"},shadows:"hover",children:t.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:justify-between gap-4",children:[t.jsxs("div",{className:"flex items-start w-full sm:w-auto",children:[t.jsx("div",{className:"w-12 h-12 rounded-full bg-fill-subtle flex items-center justify-center mr-4 flex-shrink-0",children:t.jsx(ve,{size:20,className:"text-foreground"})}),t.jsxs("div",{children:[t.jsx(U.Title,{heading:6,className:"mb-1 text-foreground",children:Ue("删除账户")}),t.jsx(U.Text,{type:"tertiary",className:"text-sm",children:Ue("此操作不可逆,所有数据将被永久删除")})]})]}),t.jsx(D,{type:"danger",theme:"solid",onClick:()=>ds(!0),className:"!rounded-lg w-full sm:w-auto !bg-primary hover:!bg-primary-hover !text-white",icon:t.jsx(ve,{size:16}),children:Ue("删除账户")})]})})]})})})}),t.jsx(q,{tab:t.jsxs("div",{className:"flex items-center",children:[t.jsx(be,{size:16,className:"mr-2"}),Ue("实名认证"),Hs?.has_any_verification&&t.jsx(W,{color:"green",size:"small",className:"ml-2",children:Ue("已认证")})]}),itemKey:"verify",children:t.jsx("div",{className:"py-4",children:Xs?t.jsx("div",{className:"flex justify-center py-12",children:t.jsx(A,{size:"large"})}):t.jsxs("div",{className:"space-y-6",children:[t.jsx(Q,{type:Hs?.has_any_verification?"success":"info",description:Hs?.has_any_verification?Ue("您已完成{{type}}认证,每个账号只能选择一种认证方式",{type:Ue("personal"===Hs?.existing_verify_type?"个人":"企业")}):Ue("实名认证后可申请开具发票。每个账号只能选择一种认证方式(个人认证或企业认证),认证成功后不可更改"),closeIcon:null,className:"!rounded-lg"}),Hs?.has_any_verification&&t.jsx(I,{className:"!rounded-xl",bodyStyle:{padding:"20px"},shadows:"hover",children:t.jsxs("div",{className:"flex items-center flex-wrap gap-4",children:[t.jsx("div",{className:"w-12 h-12 rounded-full bg-green-100 dark:bg-green-900 flex items-center justify-center flex-shrink-0",children:t.jsx(ye,{size:20,className:"text-green-600"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx(U.Title,{heading:6,className:"mb-1",children:Ue("personal"===Hs?.existing_verify_type?"个人认证":"企业认证")}
1),"personal"===Hs?.existing_verify_type&&Hs?.personal?.record&&t.jsxs("div",{className:"text-sm text-muted-foreground",children:[t.jsxs("div",{children:[Ue("姓名"),": ",Hs.personal.record.cert_name]}),t.jsxs("div",{children:[Ue("身份证号"),": ",Hs.personal.record.cert_no?.replace(/^(.{6}).*(.{4})$/,"$1****$2")]})]}),"enterprise"===Hs?.existing_verify_type&&Hs?.enterprise?.record&&t.jsxs("div",{className:"text-sm text-muted-foreground",children:[t.jsxs("div",{children:[Ue("企业名称"),": ",Hs.enterprise.record.ep_cert_name]}),t.jsxs("div",{children:[Ue("统一社会信用代码"),": ",Hs.enterprise.record.ep_cert_no?.replace(/^(.{6}).*(.{4})$/,"$1****$2")]}),t.jsxs("div",{children:[Ue("法人姓名"),": ",Hs.enterprise.record.legal_person_cert_name]})]})]}),t.jsx("div",{className:"flex items-center gap-2 flex-shrink-0",children:t.jsxs(W,{color:"green",size:"small",className:"!rounded-lg",children:[t.jsx(ye,{size:16,className:"mr-1"}),Ue("已认证")]})})]})}),!Hs?.has_any_verification&&t.jsx(I,{className:"!rounded-xl",bodyStyle:{padding:"24px"},shadows:"hover",children:t.jsxs("div",{className:"flex flex-col items-center text-center py-4",children:[t.jsx("div",{className:"w-16 h-16 rounded-full bg-fill-default flex items-center justify-center mb-4",children:t.jsx(be,{size:32,className:"text-primary"})}),t.jsx(U.Title,{heading:5,className:"mb-2",children:Ue("开始实名认证")}),t.jsx(U.Text,{type:"tertiary",className:"mb-6",children:Ue("完成实名认证后可申请开具发票")}),t.jsx(D,{type:"primary",theme:"solid",size:"large",icon:t.jsx(be,{size:18}),onClick:()=>{da(null),aa(""),ra(!0)},className:"!rounded-lg",style:{background:"linear-gradient(45deg, #0070f3 0%, #00a8ff 100%)",minWidth:200},children:Ue("立即认证")})]})})]})})}),t.jsx(q,{tab:t.jsxs("div",{className:"flex items-center",children:[t.jsx(Te,{size:16,className:"mr-2"}),Ue("其他设置")]}),itemKey:"notification",children:t.jsxs("div",{className:"py-4",children:[t.jsxs($,{type:"card",defaultActiveKey:"notify",className:"!rounded-lg",onChange:e=>Vs(e),children:[t.jsx(q,{tab:Ue("通知设置"),itemKey:"notify",children:t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"bg-card rounded-xl",children:[t.jsx(U.Text,{strong:!0,className:"block mb-4 pt-4",children:Ue("通知方式")}),t.jsxs(G,{value:Os.warningType,onChange:e=>wa("warningType",e),type:"pureCard",children:[t.jsx(V,{value:"email",className:"!p-4 !rounded-lg",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx(xe,{size:16,className:"mr-2 text-foreground"}),t.jsxs("div",{children:[t.jsx("div",{className:"font-medium",children:Ue("邮件通知")}),t.jsx("div",{className:"text-sm text-muted-foreground",children:Ue("通过邮件接收通知")})]})]})}),t.jsx(V,{value:"webhook",className:"!p-4 !rounded-lg",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx(_e,{size:16,className:"mr-2 text-foreground"}),t.jsxs("div",{children:[t.jsx("div",{className:"font-medium",children:Ue("Webhook通知")}),t.jsx("div",{className:"text-sm text-muted-foreground",children:Ue("通过HTTP请求接收通知")})]})]})}),t.jsx(V,{value:"wxpusher",className:"!p-4 !rounded-lg",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx(se,{size:16,className:"mr-2 text-green-500"}),t.jsxs("div",{children:[t.jsx("div",{className:"font-medium",children:Ue("WxPusher通知")}),t.jsx("div",{className:"text-sm text-muted-foreground",children:Ue("通过微信小程序接收通知")})]})]})}),t.jsx(V,{value:"wecom",className:"!p-4 !rounded-lg",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx(we,{size:16,className:"mr-2 text-blue-500"}),t.jsxs("div",{children:[t.jsx("div",{className:"font-medium",children:Ue("企业微信通知")}),t.jsx("div",{className:"text-sm text-muted-foreground",children:Ue("通过企业微信群机器人接收通知")})]})]})}),t.jsx(V,{value:"dingtalk",className:"!p-4 !rounded-lg",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx(me,{size:16,className:"mr-2 text-blue-600"}),t.jsxs("div",{children:[t.jsx("div",{className:"font-medium",children:Ue("钉钉通知")}),t.jsx("div",{className:"text-sm text-muted-foreground",children:Ue("通过钉钉群机器人接收通知")})]})]})}),t.jsx(V,{value:"telegram",className:"!p-4 !rounded-lg",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx(te,{size:16,className:"mr-2 text-sky-500"}),t.jsxs("div",{children:[t.jsx("div",{className:"font-medium",children:Ue("Telegram通知")}),t.jsx("div",{className:"text-sm text-muted-foreground",children:Ue("通过Telegram Bot接收通知")})]})]})}),t.jsx(V,{value:"feishu",className:"!p-4 !rounded-lg",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx(me,{size:16,className:"mr-2 text-red-500"}),t.jsxs("div",{children:[t.jsx("div",{className:"font-medium",children:Ue("飞书通知")}),t.jsx("div",{className:"text-sm text-muted-foreground",children:Ue("通过飞书群机器人接收通知")})]})]})})]})]}),"webhook"===Os.warningType&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"bg-card rounded-xl",children:[t.jsx(U.Text,{strong:!0,className:"block mb-3",children:Ue("Webhook地址")}),t.jsx(F,{value:Os.webhookUrl,onChange:e=>wa("webhookUrl",e),placeholder:Ue("请输入Webhook地址,例如: https://example.com/webhook"),size:"large",className:"!rounded-lg",prefix:t.jsx(_e,{size:16,className:"m-2"})}),t.jsx("div",{className:"text-muted-foreground text-sm mt-2",children:Ue("只支持https,系统将以 POST 方式发送通知,请确保地址可以接收 POST 请求")})]}),t.jsxs("div",{className:"bg-card rounded-xl",children:[t.jsx(U.Text,{strong:!0,className:"block mb-3",children:Ue("接口凭证(可选)")}),t.jsx(F,{value:Os.webhookSecret,onChange:e=>wa("webhookSecret",e),placeholder:Ue("请输入密钥"),size:"large",className:"!rounded-lg",prefix:t.jsx(pe,{size:16})}),t.jsx("div",{className:"text-muted-foreground text-sm mt-2",children:Ue("密钥将以 Bearer 方式添加到请求头中,用于验证webhook请求的合法性")})]}),t.jsxs("div",{className:"bg-card rounded-xl",children:[t.jsxs("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>Qs(!Fs),children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx(ke,{size:16,className:"mr-2 text-foreground"}),t.jsx(U.Text,{strong:!0,className:"text-foreground",children:Ue("Webhook请求结构")})]}),Fs?t.jsx(ce,{size:16}):t.jsx(oe,{size:16})]}),t.jsx(R,{isOpen:Fs,children:t.jsx("pre",{className:"mt-4 bg-gray-800 text-gray-100 rounded-lg text-sm overflow-x-auto",children:'{\n  "type": "quota_exceed",      // 通知类型\n  "title": "标题",             // 通知标题\n  "content": "通知内容",       // 通知内容,支持 {{value}} 变量占位符\n  "values": ["值1", "值2"],    // 按顺序替换content中的 {{value}} 占位符\n  "timestamp": 1739950503      // 时间戳\n}\n\n示例:\n{\n  "type": "quota_exceed",\n  "title": "额度预警通知",\n  "content": "您的额度即将用尽,当前剩余额度为 {{value}}",\n  "values": ["$0.99"],\n  "timestamp": 1739950503\n}'})})]})]}),"email"===Os.warningType&&t.jsxs("div",{className:"bg-card rounded-xl",children:[t.jsx(U.Text,{strong:!0,className:"block mb-3",children:Ue("通知邮箱")}
1),t.jsx(F,{value:Os.notificationEmail,onChange:e=>wa("notificationEmail",e),placeholder:Ue("留空则使用账号绑定的邮箱"),size:"large",className:"!rounded-lg",prefix:t.jsx(xe,{size:16})}),t.jsx("div",{className:"text-muted-foreground text-sm mt-2",children:Ue("设置用于接收额度预警的邮箱地址,不填则使用账号绑定的邮箱")})]}),"wxpusher"===Os.warningType&&t.jsxs("div",{className:"bg-card rounded-xl",children:[t.jsx(U.Text,{strong:!0,className:"block mb-3",children:Ue("WxPusher绑定")}),t.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[t.jsx(U.Text,{children:Ue(Us?"已绑定 WxPusher":"请扫描二维码绑定WxPusher")}),(()=>{const e={width:"150px",height:"150px",display:"flex",justifyContent:"center",alignItems:"center",border:"2px dashed #ccc",borderRadius:"8px",cursor:"pointer",textAlign:"center",fontSize:"14px",color:"#666"};if(Us)return t.jsx("div",{onClick:Ca,style:e,children:t.jsxs("div",{children:[t.jsxs("div",{style:{color:"hsl(var(--success))",marginBottom:"8px"},children:["✓ ",Ue("已绑定")]}),t.jsx("div",{children:Ue("点击解绑")})]})});switch(Bs){case"initial":return t.jsx("div",{onClick:za,style:e,children:Ue("点击显示二维码")});case"loading":return t.jsx("div",{style:e,children:t.jsx("div",{children:Ue("生成中...")})});case"loaded":return t.jsx("img",{src:Ks,style:{...e,border:"1px solid hsl(var(--border))",cursor:"default"},alt:Ue("WxPusher绑定二维码")});case"expired":return t.jsx("div",{onClick:za,style:{...e,borderColor:"hsl(var(--destructive))",color:"hsl(var(--destructive))"},children:t.jsxs("div",{children:[t.jsx("div",{children:Ue("二维码已过期")}),t.jsx("div",{children:Ue("点击重新获取")})]})});default:return null}})(),t.jsx("div",{className:"text-muted-foreground text-sm text-center max-w-xs",children:Ue("扫描二维码绑定WxPusher,绑定后将通过微信接收通知")})]})]}),"wecom"===Os.warningType&&t.jsxs("div",{className:"bg-card rounded-xl",children:[t.jsx(U.Text,{strong:!0,className:"block mb-3",children:Ue("企业微信机器人Key")}),t.jsx(F,{value:Os.wecomKey,onChange:e=>wa("wecomKey",e),placeholder:Ue("请输入企业微信群机器人的Key"),size:"large",className:"!rounded-lg",prefix:t.jsx(we,{size:16,className:"m-2"})}),t.jsx("div",{className:"text-muted-foreground text-sm mt-2",children:Ue("在企业微信群 → 群设置 → 群机器人 → 添加机器人 中获取Webhook地址末尾的key值")})]}),"dingtalk"===Os.warningType&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"bg-card rounded-xl",children:[t.jsx(U.Text,{strong:!0,className:"block mb-3",children:Ue("钉钉机器人Token")}),t.jsx(F,{value:Os.dingtalkToken,onChange:e=>wa("dingtalkToken",e),placeholder:Ue("请输入钉钉群机器人的access_token"),size:"large",className:"!rounded-lg",prefix:t.jsx(me,{size:16,className:"m-2"})}),t.jsx("div",{className:"text-muted-foreground text-sm mt-2",children:Ue("在钉钉群 → 群设置 → 机器人 → 添加机器人 → 自定义 中获取Webhook地址中的access_token值")})]}),t.jsxs("div",{className:"bg-card rounded-xl",children:[t.jsx(U.Text,{strong:!0,className:"block mb-3",children:Ue("加签密钥(可选)")}),t.jsx(F,{value:Os.dingtalkSecret,onChange:e=>wa("dingtalkSecret",e),placeholder:Ue("请输入加签密钥,以SEC开头"),size:"large",className:"!rounded-lg",prefix:t.jsx(pe,{size:16})}),t.jsx("div",{className:"text-muted-foreground text-sm mt-2",children:Ue('如果机器人安全设置选择了"加签",请填写加签密钥;选择"自定义关键词"则无需填写')})]}),t.jsxs("div",{className:"bg-card rounded-xl",children:[t.jsx(U.Text,{strong:!0,className:"block mb-3",children:Ue("@成员手机号(可选)")}),t.jsx(F,{value:Os.dingtalkAtMobiles,onChange:e=>wa("dingtalkAtMobiles",e),placeholder:Ue("请输入被@成员的手机号,多个用英文逗号分隔"),size:"large",className:"!rounded-lg",prefix:t.jsx(me,{size:16,className:"m-2"})}),t.jsx("div",{className:"text-muted-foreground text-sm mt-2",children:Ue("填写后发送通知时会@对应成员,例如:13800138000,13900139000")})]}),t.jsx("div",{className:"bg-card rounded-xl p-3",children:t.jsxs("div",{className:"text-muted-foreground text-sm",children:[Ue("钉钉机器人配置文档"),":",t.jsx("a",{href:"https://open.dingtalk.com/document/development/assign-a-webhook-url-to-an-internal-chatbot",target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-600 ml-1",children:Ue("查看官方文档")})]})})]}),"telegram"===Os.warningType&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"bg-card rounded-xl",children:[t.jsx(U.Text,{strong:!0,className:"block mb-3",children:Ue("Telegram Bot Token")}),t.jsx(F,{value:Os.telegramBotToken,onChange:e=>wa("telegramBotToken",e),placeholder:Ue("请输入Telegram Bot Token"),size:"large",className:"!rounded-lg",prefix:t.jsx(te,{size:16,className:"m-2"})}),t.jsx("div",{className:"text-muted-foreground text-sm mt-2",children:Ue("通过Telegram @BotFather创建机器人获取Token")})]}),t.jsxs("div",{className:"bg-card rounded-xl",children:[t.jsx(U.Text,{strong:!0,className:"block mb-3",children:Ue("Telegram Chat ID")}),t.jsx(F,{value:Os.telegramChatId,onChange:e=>wa("telegramChatId",e),placeholder:Ue("请输入接收通知的Chat ID"),size:"large",className:"!rounded-lg",prefix:t.jsx(te,{size:16,className:"m-2"})}),t.jsx("div",{className:"text-muted-foreground text-sm mt-2",children:Ue("个人聊天使用@userinfobot获取,群组需先将Bot加入群组后获取群组ID")})]}),t.jsx("div",{className:"bg-card rounded-xl p-3",children:t.jsxs("div",{className:"text-muted-foreground text-sm",children:[Ue("Telegram Bot配置文档"),":",t.jsx("a",{href:"https://core.telegram.org/bots#how-do-i-create-a-bot",target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-600 ml-1",children:Ue("查看官方文档")})]})})]}),"feishu"===Os.warningType&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"bg-card rounded-xl",children:[t.jsx(U.Text,{strong:!0,className:"block mb-3",children:Ue("飞书Webhook地址")}),t.jsx(F,{value:Os.feishuWebhookUrl,onChange:e=>wa("feishuWebhookUrl",e),placeholder:Ue("请输入飞书自定义机器人的Webhook地址"),size:"large",className:"!rounded-lg",prefix:t.jsx(me,{size:16,className:"m-2"})}),t.jsx("div",{className:"text-muted-foreground text-sm mt-2",children:Ue("在飞书群 → 群设置 → 群机器人 → 添加机器人 → 自定义机器人 中获取Webhook地址")})]}),t.jsxs("div",{className:"bg-card rounded-xl",children:[t.jsx(U.Text,{strong:!0,className:"block mb-3",children:Ue("签名密钥(可选)")}
1),t.jsx(F,{value:Os.feishuSecret,onChange:e=>wa("feishuSecret",e),placeholder:Ue("如果机器人启用了签名校验,请输入密钥"),size:"large",className:"!rounded-lg",prefix:t.jsx(pe,{size:16})}),t.jsx("div",{className:"text-muted-foreground text-sm mt-2",children:Ue("若飞书机器人安全设置开启了“签名校验”,请填写密钥;未开启可留空")})]})]}),t.jsxs("div",{className:"bg-card rounded-xl",children:[t.jsx(U.Text,{strong:!0,className:"block mb-3",children:Ue("订阅事件")}),t.jsxs(H,{style:{width:"100%"},multiple:!0,value:Os.subscriptionOptions,onChange:e=>wa("subscriptionOptions",e),maxTagCount:5,size:"large",className:"!rounded-lg",children:[t.jsx(H.Option,{value:"quota_push",children:Ue("余额不足预警")}),t.jsx(H.Option,{value:"sale_push",children:Ue("促销活动通知")}),t.jsx(H.Option,{value:"back_push",children:Ue("防失联-定期通知")}),t.jsx(H.Option,{value:"system_push",children:Ue("系统公告通知")}),t.jsx(H.Option,{value:"price_push",children:Ue("模型调价通知")}),t.jsx(H.Option,{value:"token_warning_push",children:Ue("令牌余额不足预警")}),t.jsx(H.Option,{value:"token_exhaust_push",children:Ue("令牌余额不足")})]}),t.jsx("div",{className:"text-muted-foreground text-sm mt-2",children:Ue("选择您希望接收的通知类型")})]}),Os.subscriptionOptions.includes("token_warning_push")&&t.jsxs("div",{className:"bg-card rounded-xl",children:[t.jsx(U.Text,{strong:!0,className:"block mb-3",children:Ue("令牌不足阈值")}
1),t.jsx("div",{className:"flex items-center gap-3",children:t.jsx(J,{value:Os.tokenQuotaWarningPercent,onChange:e=>wa("tokenQuotaWarningPercent",e??20),min:1,max:100,step:5,precision:0,addonAfter:"%",style:{width:160},size:"large",className:"!rounded-lg"})}),t.jsx("div",{className:"text-muted-foreground text-sm mt-2",children:Ue("当令牌剩余额度低于总额度该百分比时发送预警,仅对有限额度的令牌生效")})]}),t.jsxs("div",{className:"bg-card rounded-xl",children:[t.jsx(U.Text,{strong:!0,className:"block mb-3",children:Ue("预警额度")}),t.jsxs("div",{className:"space-y-3",children:[t.jsx(J,{value:Os.warningThreshold?parseFloat(b(Os.warningThreshold)):0,onChange:e=>{if(e){const s=y();wa("warningThreshold",e*s)}},style:{width:200},addonBefore:"$",size:"large",className:"!rounded-lg",step:.1,min:0,precision:2}),t.jsxs("div",{className:"text-muted-foreground text-sm",children:[Ue("当余额低于")," $",Os.warningThreshold?parseFloat(b(Os.warningThreshold)).toFixed(2):0," ",Ue("时,将收到预警通知(30分钟最多1次)")]})]})]})]})}),t.jsx(q,{tab:Ue("价格设置"),itemKey:"price",children:t.jsx("div",{className:"py-4",children:t.jsx("div",{className:"space-y-4",children:t.jsx("div",{className:"bg-card rounded-xl",children:t.jsxs("div",{className:"flex items-start",children:[t.jsx("div",{className:"w-10 h-10 rounded-full bg-fill-subtle flex items-center justify-center mt-1",children:t.jsx(ge,{size:20,className:"text-foreground"})}),t.jsx("div",{className:"flex-1",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx(U.Text,{strong:!0,className:"block mb-2",children:Ue("接受未设置价格模型")}),t.jsx("div",{className:"text-muted-foreground text-sm",children:Ue("当模型没有设置价格时仍接受调用,仅当您信任该网站时使用,可能会产生高额费用")})]}),t.jsx(X,{checked:Os.acceptUnsetModelRatioModel,onChange:e=>wa("acceptUnsetModelRatioModel",e.target.checked),className:"ml-4"})]})})]})})})})}),t.jsx(q,{tab:Ue("IP记录"),itemKey:"ip",children:t.jsx("div",{className:"py-4",children:t.jsx("div",{className:"bg-card rounded-xl",children:t.jsxs("div",{className:"flex items-start",children:[t.jsx("div",{className:"w-10 h-10 rounded-full bg-fill-subtle flex items-center justify-center mt-1",children:t.jsx(Ne,{size:20,className:"text-foreground"})}),t.jsx("div",{className:"flex-1",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx(U.Text,{strong:!0,className:"block mb-2",children:Ue("记录请求与错误日志 IP")}),t.jsx("div",{className:"text-muted-foreground text-sm",children:Ue("开启后,仅“消费”和“错误”日志将记录您的客户端 IP 地址")})]}),t.jsx(X,{checked:Os.recordIpLog,onChange:e=>wa("recordIpLog",e.target.checked),className:"ml-4"})]})})]})})})}),t.jsx(q,{tab:Ue("语言偏好"),itemKey:"language",children:t.jsxs("div",{className:"py-4",children:[t.jsxs("div",{className:"flex items-center mb-4",children:[t.jsx(O,{size:14,color:"violet",className:"mr-3 shadow-md",children:t.jsx(ze,{size:16})}),t.jsxs("div",{children:[t.jsx(U.Text,{className:"text-lg font-medium",children:Ue("偏好设置")}),t.jsx("div",{className:"text-xs text-muted-foreground",children:Ue("界面语言和其他个人偏好")})]})]}),t.jsx(I,{className:"!rounded-xl",shadows:"hover",children:t.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center sm:justify-between gap-4",children:[t.jsxs("div",{className:"flex items-start w-full sm:w-auto",children:[t.jsx("div",{className:"w-12 h-12 rounded-full bg-violet-50 dark:bg-violet-900/30 flex items-center justify-center mr-4 flex-shrink-0",children:t.jsx(ze,{size:20,className:"text-violet-600 dark:text-violet-400"})}),t.jsxs("div",{children:[t.jsx(U.Title,{heading:6,className:"mb-1",children:Ue("语言偏好")}),t.jsx(U.Text,{type:"tertiary",className:"text-sm",children:Ue("选择您的首选界面语言,设置将自动保存并同步到所有设备")})]})]}),t.jsx(H,{value:_.language?.startsWith("zh")?"zh":_.language||"zh",onChange:async e=>{const s=_.language?.startsWith("zh")?"zh":_.language||"zh";_.changeLanguage(e);try{const a=Se?.user?.setting?JSON.parse(Se.user.setting):{},t=await o.put("/api/user/setting",{notify_type:a.notify_type||"email",quota_
1warning_threshold:a.quota_warning_threshold||1e5,webhook_url:a.webhook_url||"",webhook_secret:a.webhook_secret||"",notification_email:a.notification_email||"",accept_unset_model_ratio_model:a.accept_unset_model_ratio_model||!1,record_ip_log:a.record_ip_log||!1,wxpusher_uid:a.wxpusher_uid||"",subscription_options:a.subscription_options||"quota_push,sale_push,back_push,system_push,price_push,token_warning_push,token_exhaust_push",wecom_key:a.wecom_key||"",dingtalk_token:a.dingtalk_token||"",dingtalk_secret:a.dingtalk_secret||"",dingtalk_at_mobiles:a.dingtalk_at_mobiles||"",telegram_bot_token:a.telegram_bot_token||"",telegram_chat_id:a.telegram_chat_id||"",language:e});t.data.success?(w(Ue("语言偏好已保存")),await pa()):(m(t.data.message||Ue("保存失败")),_.changeLanguage(s))}catch(a){m(Ue("保存失败,请重试")),_.changeLanguage(s)}},style:{width:180},optionList:[{value:"zh",label:Ue("简体中文")},{value:"en",label:"English"},{value:"ja",label:"日本語"},{value:"ko",label:"한국어"},{value:"es",label:"Español"},{value:"de",label:"Deutsch"}]})]})}),t.jsx("div",{className:"mt-4",children:t.jsx(U.Text,{type:"tertiary",className:"text-xs",children:Ue("提示:语言偏好会同步到您登录的所有设备,并影响API返回的错误消息语言。")})})]})})]}),"notify"===Gs&&t.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[t.jsx(D,{onClick:async()=>{const e=await ka("test");if(e.success){qs(!0);try{const e=await o.post("/api/push/test",{notify_type:Os.warningType,title:Ue("测试通知"),test_agent_mode:!!c(),content:Ue("这是一条测试通知,如果您收到此消息,说明通知配置正确。")});e.data.success?w(Ue("测试通知发送成功")):m(e.data.message||Ue("测试通知发送失败"))}catch(s){const e=s?.response?.data?.message;m(e||Ue("测试通知发送失败"))}qs(!1)}else m(e.message||Ue("设置保存失败"))},loading:$s,size:"large",className:"!rounded-lg",icon:t.jsx(Te,{size:16}),children:Ue("发送测试通知")}),t.jsx(D,{type:"primary",onClick:ka,size:"large",className:"!rounded-lg !bg-primary hover:!bg-primary-hover !text-white",icon:t.jsx(de,{size:16}),children:Ue("保存设置")})]}),"language"!==Gs&&"notify"!==Gs&&t.jsx("div",{className:"mt-6 flex justify-end",children:t.jsx(D,{type:"primary",onClick:ka,size:"large",className:"!rounded-lg !bg-primary hover:!bg-primary-hover !text-white",icon:t.jsx(de,{size:16}),children:Ue("保存设置")})})]})})]})})]})})}),t.jsx(Z,{title:t.jsxs("div",{className:"flex items-center",children:[t.jsx(xe,{size:16,className:"mr-2 text-blue-500"}),Ue("绑定邮箱地址")]}),visible:Ye,onCancel:()=>es(!1),onOk:async()=>{if(""===Fe.email_verification_code)return void m(Ue("请输入邮箱验证码!"));fs(!0);const e=await o.get(`/api/oauth/email/bind?email=${Fe.email}&code=${Fe.email_verification_code}`),{success:s,message:a}=e.data;s?(w(Ue("邮箱账户绑定成功!")),es(!1),Se.user.email=Fe.email):m(a),fs(!1)},size:"small",centered:!0,maskClosable:!1,className:"modern-modal",children:t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"flex gap-3",children:[t.jsx(F,{placeholder:Ue("输入邮箱地址"),onChange:e=>ja("email",e),name:"email",type:"email",size:"large",className:"!rounded-lg flex-1",prefix:t.jsx(xe,{size:16})}),t.jsx(D,{onClick:async()=>{if(""===Fe.email)return void m(Ue("请输入邮箱!"));if(ms&&""===gs)return void z(Ue("请稍后几秒重试,Turnstile 正在检查用户环境!"));const e=Oe?.status||Ce()||{};e.captcha_send_code_enabled||e.captcha_register_enabled?os(!0):await Na("")},disabled:vs||ps,className:"!rounded-lg",type:"primary",theme:"outline",size:"large",children:vs?`${Ue("重新发送")} (${ys})`:Ue("获取验证码")})]}),t.jsx(F,{placeholder:Ue("验证码"),name:"email_verification_code",value:Fe.email_verification_code,onChange:e=>ja("email_verification_code",e),size:"large",className:"!rounded-lg",prefix:t.jsx(pe,{size:16})}),ms&&t.jsx("div",{className:"flex justify-center",children:t.jsx(S,{sitekey:us,onVerify:e=>{js(e)}})})]})}),t.jsx(Z,{title:t.jsxs("div",{className:"flex items-center",children:[t.jsx(ue,{size:16,className:"mr-2 text-blue-500"}),Ue("绑定手机号")]}),visible:ss,onCancel:()=>as(!1),onOk:async()=>
1{if(""!==Fe.phone&&ya(Fe.phone))if(""!==Fe.phone_verification_code){fs(!0);try{const e=await o.post("/api/user/phone/bind",{phone:Fe.phone,code:Fe.phone_verification_code}),{success:s,message:a}=e.data;s?(w(Ue("手机号绑定成功!")),as(!1),await pa()):m(a)}catch(e){m(e)}finally{fs(!1)}}else m(Ue("请输入验证码!"));else m(Ue("手机号格式不正确"))},confirmLoading:ps,size:"small",centered:!0,maskClosable:!1,className:"modern-modal",children:t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"flex gap-3",children:[t.jsx(F,{placeholder:Ue("输入手机号"),value:Fe.phone,onChange:e=>ja("phone",e),name:"phone",size:"large",className:"!rounded-lg flex-1",prefix:t.jsx(ue,{size:16})}),t.jsx(D,{onClick:async()=>{if(""!==Fe.phone)if(ya(Fe.phone)){ls(!0),fs(!0);try{const e=await o.post("/api/user/sms/send",{phone:Fe.phone,purpose:"bind"}),{success:s,message:a}=e.data;s?w(Ue("验证码已发送")):(m(a),ls(!1),rs(60))}catch(e){m(e),ls(!1),rs(60)}finally{fs(!1)}}else m(Ue("手机号格式不正确"));else m(Ue("请输入手机号!"))},disabled:ts||ps,className:"!rounded-lg",type:"primary",theme:"outline",size:"large",children:ts?`${Ue("重新发送")} (${is})`:Ue("获取验证码")})]}),t.jsx(F,{placeholder:Ue("验证码"),name:"phone_verification_code",value:Fe.phone_verification_code,onChange:e=>ja("phone_verification_code",e),size:"large",className:"!rounded-lg",prefix:t.jsx(pe,{size:16})})]})}),t.jsx(Z,{title:t.jsxs("div",{className:"flex items-center",children:[t.jsx(se,{className:"mr-2 text-green-500",size:20}),Ue("绑定微信账户")]}),visible:Xe,onCancel:()=>Ze(!1),footer:null,size:"small",centered:!0,className:"modern-modal",children:t.jsxs("div",{className:"space-y-4 py-4 text-center",children:[t.jsx(Y,{src:Ge.wechat_qrcode,className:"mx-auto"}),t.jsx("div",{className:"text-foreground/80",children:t.jsx("p",{children:Ue("微信扫码关注公众号,输入「验证码」获取验证码(三分钟内有效)")})}),t.jsx(F,{placeholder:Ue("验证码"),name:"wechat_verification_code",value:Fe.wechat_verification_code,onChange:e=>ja("wechat_verification_code",e),size:"large",className:"!rounded-lg",prefix:t.jsx(pe,{size:16})}),t.jsx(D,{type:"primary",theme:"solid",size:"large",onClick:async()=>{if(""===Fe.wechat_verification_code)return;const e=await o.get(`/api/oauth/wechat/bind?code=${Fe.wechat_verification_code}`),{success:s,message:a}=e.data;s?(w(Ue("微信账户绑定成功!")),Ze(!1)):m(a)},className:"!rounded-lg w-full !bg-primary hover:!bg-primary-hover !text-white",icon:t.jsx(se,{size:16}),children:Ue("绑定")})]})}),t.jsx(Z,{title:t.jsxs("div",{className:"flex items-center",children:[t.jsx(ve,{size:16,className:"mr-2 text-red-500"}),Ue("删除账户确认")]}),visible:ns,onCancel:()=>ds(!1),onOk:async()=>{if(Fe.self_account_deletion_confirmation!==Se.user.username)return void m(Ue("请输入你的账户名以确认删除!"));const e=await o.delete("/api/user/self"),{success:s,message:a}=e.data;s?(w(Ue("账户已删除!")),await o.get("/api/user/logout"),Ie({type:"logout"}),T(),$e("/login")):m(a)},size:"small",centered:!0,className:"modern-modal",children:t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsx(Q,{type:"danger",description:Ue("您正在删除自己的帐户,将清空所有数据且不可恢复"),closeIcon:null,className:"!rounded-lg"}),t.jsxs("div",{children:[t.jsx(U.Text,{strong:!0,className:"block mb-2 text-red-600",children:Ue("请输入您的用户名以确认删除")}),t.jsx(F,{placeholder:Ue("输入你的账户名{{username}}以确认删除",{username:` ${Se?.user?.username} `}),name:"self_account_deletion_confirmation",value:Fe.self_account_deletion_confirmation,onChange:e=>ja("self_account_deletion_confirmation",e),size:"large",className:"!rounded-lg",prefix:t.jsx(ne,{size:16})})]}),ms&&t.jsx("div",{className:"flex justify-center",children:t.jsx(S,{sitekey:us,onVerify:e=>{js(e)}})})]})}),t.jsx(Z,{title:t.jsxs("div",{className:"flex items-center",children:[t.jsx(fe,{size:16,className:"mr-2 text-orange-500"}),Ue("修改密码")]}),visible:He,onCancel:()=>Je(!1),onOk:async()=>
1{if(""===Fe.original_password)return void m(Ue("请输入原密码")+"!");if(""===Fe.set_new_password)return void m(Ue("请输入新密码")+"!");if(Fe.original_password===Fe.set_new_password)return void m(Ue("新密码需要和原密码不一致!"));if(Fe.set_new_password!==Fe.set_new_password_confirmation)return void m(Ue("两次输入的密码不一致")+"!");const e=await o.put("/api/user/self",{original_password:Fe.original_password,password:Fe.set_new_password}),{success:s,message:a}=e.data;s?(w(Ue("密码修改成功,请重新登录!")),Je(!1),Ie({type:"logout"}),T(),$e("/login")):(m(a),Je(!1))},size:"small",centered:!0,className:"modern-modal",children:t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{children:[t.jsx(U.Text,{strong:!0,className:"block mb-2",children:Ue("原密码")}),t.jsx(F,{name:"original_password",placeholder:Ue("请输入原密码"),type:"password",value:Fe.original_password,onChange:e=>ja("original_password",e),size:"large",className:"!rounded-lg",prefix:t.jsx(fe,{size:16})})]}),t.jsxs("div",{children:[t.jsx(U.Text,{strong:!0,className:"block mb-2",children:Ue("新密码")}),t.jsx(F,{name:"set_new_password",placeholder:Ue("请输入新密码"),type:"password",value:Fe.set_new_password,onChange:e=>ja("set_new_password",e),size:"large",className:"!rounded-lg",prefix:t.jsx(fe,{size:16})})]}),t.jsxs("div",{children:[t.jsx(U.Text,{strong:!0,className:"block mb-2",children:Ue("确认新密码")}),t.jsx(F,{name:"set_new_password_confirmation",placeholder:Ue("请再次输入新密码"),type:"password",value:Fe.set_new_password_confirmation,onChange:e=>ja("set_new_password_confirmation",e),size:"large",className:"!rounded-lg",prefix:t.jsx(fe,{size:16})})]}),ms&&t.jsx("div",{className:"flex justify-center",children:t.jsx(S,{sitekey:us,onVerify:e=>{js(e)}})})]})}),t.jsx(Z,{title:t.jsxs("div",{className:"flex items-center",children:[t.jsx(be,{size:20,className:"mr-2 text-primary"}),Ue(na?"personal"===na?"个人认证":"企业认证":"选择认证类型")]}),visible:ia,onCancel:()=>{ra(!1),da(null),aa("")},footer:null,width:na?500:600,centered:!0,className:"verify-modal",children:na?"personal"===na?t.jsxs("div",{className:"py-4",children:[t.jsx(D,{type:"tertiary",icon:t.jsx(ce,{size:16,style:{transform:"rotate(-90deg)"}}),onClick:()=>{da(null),aa("")},className:"mb-4",size:"small",children:Ue("返回选择")}),t.jsxs(ee,{getFormApi:la,onSubmit:async e=>{if(sa){ea(!0);try{const s=await o.post("/api/identity_verify/personal",{cert_name:e.cert_name,cert_no:e.cert_no,captcha_token:sa});s.data.success?(w(Ue("个人认证成功")),ra(!1),da(null),ta&&ta.reset(),await va()):m(s.data.message)}catch(s){m(s.message||Ue("认证失败"))}finally{ea(!1),aa("")}}else m(Ue("请先完成滑块验证"))},children:[t.jsx(ee.Input,{field:"cert_name",label:Ue("真实姓名"),placeholder:Ue("请输入您的真实姓名"),rules:[{required:!0,message:Ue("请输入真实姓名")}],size:"large",className:"!rounded-lg"}),t.jsx(ee.Input,{field:"cert_no",label:Ue("身份证号"),placeholder:Ue("请输入您的身份证号"),rules:[{required:!0,message:Ue("请输入身份证号")},{pattern:/^[0-9]{17}[0-9Xx]$|^[0-9]{15}$/,message:Ue("身份证号格式不正确")}],size:"large",className:"!rounded-lg"}),t.jsx("div",{className:"mt-4",children:sa?t.jsx(D,{type:"primary",theme:"solid",size:"large",block:!0,htmlType:"submit",loading:Ys,className:"!rounded-lg",style:{background:"linear-gradient(45deg, hsl(var(--success)) 0%, hsl(var(--success) / 0.75) 100%)"},children:"✓ "+Ue("已验证,点击提交")}):t.jsx(re,{onVerified:e=>aa(e),disabled:!1,children:t.jsx(D,{type:"primary",theme:"solid",size:"large",block:!0,className:"!rounded-lg",children:Ue("提交认证")})})})]})]}):t.jsxs("div",{className:"py-4",children:[t.jsx(D,{type:"tertiary",icon:t.jsx(ce,{size:16,style:{transform:"rotate(-90deg)"}}),onClick:()=>{da(null),aa("")},className:"mb-4",size:"small",children:Ue("返回选择")}),t.jsxs(ee,{onSubmit:async e=>{if(sa){ea(!0);try{const s=await o.post("/api/identity_verify/enterprise",{ep_cert_name:e.ep_cert_name,ep_cert_no:e.ep_cert_no,legal_person_cert_name:e.legal_person_cert_name,captcha_token:sa});s.data.success?(w(Ue("企业认证成功")),ra(!1),da(null),ta&&ta.reset(),await va()):m(s.data.message)}catch(s){m(s.message||Ue("认证失败"))}finally{ea(!1),aa("")}}else m(Ue("请先完成滑块验证"))},children:[t.jsx(ee.Input,{field:"ep_cert_name",label:Ue("企业名称"),placeholder:Ue("请输入企业全称"),rules:[{required:!0,message:Ue("请输入企业名称")}],size:"large",className:"!rounded-lg"}),t.jsx(ee.Input,{field:"ep_cert_no",label:Ue("统一社会信用代码"),placeholder:Ue("请输入18位统一社会信用代码"),rules:[{required:!0,message:Ue("请输入统一社会信用代码")},{pattern:/^[0-9A-Za-z]{18}$/,message:Ue("统一社会信用代码应为18位")}],size:"large",className:"!rounded-lg"}),t.jsx(ee.Input,{field:"legal_person_cert_name",label:Ue("法人姓名"),placeholder:Ue("请输入法人真实姓名"),rules:[{required:!0,message:Ue("请输入法人姓名")}],size:"large",className:"!rounded-lg"}),t.jsx("div",{className:"mt-4",children:sa?t.jsx(D,{type:"primary",theme:"solid",size:"large",block:!0,htmlType:"submit",loading:Ys,className:"!rounded-lg",style:{background:"linear-gradient(45deg, hsl(var(--success)) 0%, hsl(var(--success) / 0.75) 100%)"},children:"✓ "+Ue("已验证,点击提交")}):t.jsx(re,{onVerified:e=>aa(e),disabled:!1,children:t.jsx(D,{type:"primary",theme:"solid",size:"large",block:!0,className:"!rounded-lg",children:Ue("提交认证")})})})]})]}):t.jsxs("div",{className:"py-4",children:[t.jsx(U.Text,{type:"tertiary",className:"block text-center mb-4",children:Ue("请选择您的认证类型,每个账号只能选择一种认证方式")}),t.jsx(Q,{type:"warning",description:Ue("认证完成后,开票主体只能是认证主体(个人认证只能以本人名义开票,企业认证只能以该企业名义开票),请谨慎选择。"),closeIcon:null,className:"!rounded-lg mb-6"}),t.jsxs("div",{className:`grid grid-cols-1 ${De?"sm:grid-cols-2":""} gap-4`,children:[De&&t.jsx(I,{className:"!rounded-xl cursor-pointer transition-all hover:shadow-lg",bodyStyle:{padding:"24px"},shadows:"hover",onClick:()=>da("personal"),children:t.jsxs("div",{className:"flex flex-col items-center text-center",children:[t.jsx("div",{className:"w-14 h-14 roun
1ded-full bg-blue-100 dark:bg-blue-900 flex items-center justify-center mb-4",children:t.jsx(ne,{size:28,className:"text-blue-600"})}),t.jsx(U.Title,{heading:6,className:"mb-2",children:Ue("个人认证")}),t.jsx(U.Text,{type:"tertiary",size:"small",children:Ue("适用于个人用户开具普通发票")})]})}),t.jsx(I,{className:"!rounded-xl cursor-pointer transition-all hover:shadow-lg",bodyStyle:{padding:"24px"},shadows:"hover",onClick:()=>da("enterprise"),children:t.jsxs("div",{className:"flex flex-col items-center text-center",children:[t.jsx("div",{className:"w-14 h-14 rounded-full bg-orange-100 dark:bg-orange-900 flex items-center justify-center mb-4",children:t.jsx(we,{size:28,className:"text-orange-600"})}),t.jsx(U.Title,{heading:6,className:"mb-2",children:Ue("企业认证")}),t.jsx(U.Text,{type:"tertiary",size:"small",children:Ue("适用于企业用户开具增值税发票")})]})})]})]})}),t.jsx(Z,{title:Ue("人机验证"),visible:cs,footer:null,centered:!0,onCancel:()=>os(!1),bodyStyle:{padding:0},lazyRender:!0,keepDOM:!1,children:cs&&t.jsx(re,{inline:!0,onVerified:e=>{os(!1),Na(e)}})})]})};export{Se as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.