PageSourceSearch

https://aibotspace.com/assets/UserCenter-D1nlYaNa.js

js aibotspace.com collected 2026-09-28 00:50:55 UTC 69,787 bytes, 55 lines download raw bytes

1var ds=Object.defineProperty;var is=(u,d,m)=>d in u?ds(u,d,{enumerable:!0,configurable:!0,writable:!0,value:m}):u[d]=m;var dt=(u,d,m)=>is(u,typeof d!="symbol"?d+"":d,m);import{r as i,j as e}from"./vendor-react-B--7RBOU.js";import{P as os,g as cs,c as xe,a as me,b as be,f as it,S as xs}from"./Pricing-CI4fWoc7.js";import{c as v,u as x,b as N,M as he,B as ot,d as pe,G as ms,U as bs,x as ct,k as hs,S as xt,L as W,C as mt,X as ps,y as gs}from"./index-nJ2jv59_.js";import{d as bt}from"./desktopHermesService-CPDuxodi.js";import{BlogList as us}from"./BlogList-DFPtaaxM.js";import{D as ge,C as ue,H as ys}from"./history-BWth4Urm.js";import{U as ee}from"./users-DAhS4888.js";import{H as ht}from"./help-circle-P-0MJDdJ.js";import{C as pt}from"./check-circle-C1Mn0rM5.js";import{D as js}from"./download-CvhhlhXA.js";import{C as fs}from"./chevron-left-BKEI-4I6.js";import{C as Ns}from"./chevron-right-BrQR56Y2.js";import{P as vs}from"./pen-line-Dw1VVGvN.js";import{T as gt}from"./trash-2-BppgFw-0.js";import"./check-DCTY5VBv.js";import"./trending-up-Dir1BANR.js";import"./package-BIv8HzBI.js";import"./globe-D5nXzRzd.js";import"./vendor-batch-utils-CGYAwOYr.js";import"./blogArticles-DIGeaVqB.js";import"./workflow-Db5Gc2xy.js";import"./target-CE3OSJdU.js";import"./check-circle-2-B42-FCIu.js";import"./lightbulb-B_s-fJ5h.js";/**
2 * @license lucide-react v0.344.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const ws=v("ArrowDownToLine",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]);/**
7 * @license lucide-react v0.344.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const te=v("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
12 * @license lucide-react v0.344.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const ks=v("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
17 * @license lucide-react v0.344.0 - ISC
18 *
19 * This source code is licensed under the ISC license.
20 * See the LICENSE file in the root directory of this source tree.
21 */const Cs=v("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
22 * @license lucide-react v0.344.0 - ISC
23 *
24 * This source code is licensed under the ISC license.
25 * See the LICENSE file in the root directory of this source tree.
26 */const Ss=v("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
27 * @license lucide-react v0.344.0 - ISC
28 *
29 * This source code is licensed under the ISC license.
30 * See the LICENSE file in the root directory of this source tree.
31 */const ut=v("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
32 * @license lucide-react v0.344.0 - ISC
33 *
34 * This source code is licensed under the ISC license.
35 * See the LICENSE file in the root directory of this source tree.
36 */const yt=v("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
37 * @license lucide-react v0.344.0 - ISC
38 *
39 * This source code is licensed under the ISC license.
40 * See the LICENSE file in the root directory of this source tree.
41 */const As=v("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
42 * @license lucide-react v0.344.0 - ISC
43 *
44 * This source code is licensed under the ISC license.
45 * See the LICENSE file in the root directory of this source tree.
46 */const Ps=v("Wallet",[["path",{d:"M21 12V7H5a2 2 0 0 1 0-4h14v4",key:"195gfw"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h16v-5",key:"195n9w"}],["path",{d:"M18 12a2 2 0 0 0 0 4h4v-4Z",key:"vllfpd"}]]);class Is{authHeaders(){return{"x-user-id":x.getLocalUserId()}}async createBindCode(d){const m=await N.post("/api/desktop/device/bind-code",{deviceName:d||"",siteOrigin:typeof window<"u"?window.location.origin:""},{headers:this.authHeaders()});return{bindCode:m.data.bindCode,expiresAt:m.data.expiresAt,expires
46InSec:m.data.expiresInSec,bindUrl:m.data.bindUrl}}async fetchBindCodes(){return(await N.get("/api/desktop/device/bind-codes",{headers:this.authHeaders()})).data.codes||[]}async fetchDevices(){return(await N.get("/api/desktop/devices",{headers:this.authHeaders()})).data.devices||[]}async revokeDevice(d){await N.delete(`/api/desktop/device/${encodeURIComponent(d)}`,{headers:this.authHeaders()})}async deleteBindCode(d){await N.delete(`/api/desktop/device/bind-code/${encodeURIComponent(d.trim().toUpperCase())}`,{headers:this.authHeaders()})}async getBindStatus(d){return(await N.get("/api/desktop/device/bind-status",{params:{code:d.trim().toUpperCase()}})).data.status||"invalid"}async activateWithBindCode(d){return(await N.post("/api/desktop/device/activate",d)).data}async refreshTokens(d){return(await N.post("/api/desktop/device/refresh",{refreshToken:d})).data}}const G=new Is,M=class M{async listApiKeys(){const d=await fetch(M.BASE_URL,{headers:this.getAuthHeaders()});if(!d.ok){const n=await d.json().catch(()=>({error:`HTTP ${d.status}`}));throw new Error(n.error||"Failed to list API keys")}return(await d.json()).keys||[]}async createApiKey(d,m=["image"],n){const z=await fetch(M.BASE_URL,{method:"POST",headers:{...this.getAuthHeaders(),"Content-Type":"application/json"},body:JSON.stringify({name:d,scopes:m,rateLimitPerMinute:(n==null?void 0:n.rateLimitPerMinute)||60,monthlyQuota:(n==null?void 0:n.monthlyQuota)||-1})});if(!z.ok){const a=await z.json().catch(()=>({error:`HTTP ${z.status}`}));throw new Error(a.error||"Failed to create API key")}return z.json()}async revokeApiKey(d){const m=await fetch(`${M.BASE_URL}/${d}`,{method:"DELETE",headers:this.getAuthHeaders()});if(!m.ok){const n=await m.json().catch(()=>({error:`HTTP ${m.status}`}));throw new Error(n.error||"Failed to revoke API key")}}getAuthHeaders(){const d=x.getSessionToken();if(!d)throw new Error("未登录,请先登录后再使用开发者 API");return{Authorization:`Bearer ${d}`}}};dt(M,"BASE_URL","/api/open-api/keys");let je=M;const ye=new je;class Ds{async initiatePayment(d,m){try{return(await N.post("/api/pay/create",{method:d,...m})).data}catch(n){return console.error("Payment Error",n),{success:!1,message:"Payment server error"}}}}const jt=new Ds,ra=({onNavigate:u})=>{var st,at,rt,nt,lt;const[d,m]=i.useState("dashboard"),[n,z]=i.useState(null),[a,S]=i.useState(null),[A,fe]=i.useState("subscription"),[se,Ne]=i.useState(""),[V,ve]=i.useState(""),[f,ft]=i.useState("monthly"),[U,we]=i.useState("wechat"),[ke,Ce]=i.useState(!1),[zs,Nt]=i.useState([]),[Se,Ae]=i.useState([]),[q,vt]=i.useState(1),[wt,kt]=i.useState(!1),[ae,Pe]=i.useState(!1),re=50,[Ie,Ct]=i.useState(""),[Y,De]=i.useState(""),[ne,ze]=i.useState(""),[le,Te]=i.useState(!1),[Ke,$e]=i.useState([]),[St,Le]=i.useState(!1),[B,h]=i.useState(null),[p,g]=i.useState(null),[T,K]=i.useState(""),[H,$]=i.useState(""),[Me,E]=i.useState(""),[Ue,R]=i.useState(""),[Be,O]=i.useState(""),[L,He]=i.useState({start:new Date(Date.now()-30*24*3600*1e3).toLocaleDateString("en-CA"),end:new Date().toLocaleDateString("en-CA")}),[At,Ee]=i.useState(!1),[Re,Oe]=i.useState([]),[Pt,_e]=i.useState(!1),[w,It]=i.useState(null),[Fe,We]=i.useState([]),[Ge,Dt]=i.useState("我的电脑"),[zt,Ve]=i.useState([]),[qe,Ye]=i.useState([]),[Tt,Qe]=i.useState(!1),[Xe,Kt]=i.useState([]),[$t,Ze]=i.useState(!1),[Lt,_]=i.useState(!1),[de,Je]=i.useState(""),[k,Q]=i.useState(["image","video"]),[X,ie]=i.useState(null),[y,et]=i.useState(null),oe=async t=>{Pe(!0);try{const s=(t-1)*re,r=await x.fetchTransactions(re,s);Ae(r),vt(t),kt(r.length===re)}catch{Ae([])}finally{Pe(!1)}},P=async()=>{Le(!0);try{const t=await x.fetchSubAccounts();$e(t)}catch{$e([])}finally{Le(!1)}},Mt=async()=>{var t,s;if(!T.trim()||!H.trim())return alert("请输入用户名和密码");try{await x.createSubAccount(T.trim(),H),h(null),K(""),$(""),await P(),alert("子账户创建成功,可使用该用户名登录")}catch(r){alert(((s=(t=r.response)==null?void 0:t.data)==null?void 0:s.error)||r.message||"创建失败")}},Ut=async()=>{var t,s;if(p){if(!T.trim())return alert("请输入用户名");try{await x.updateSubAccount(p.id,T.trim(),H.trim()||void 0),h(null),g(null),K(""),$(""),await P(),alert("修改成功")}catch(r){alert(((s=(t=r.response)==null?void 0:t.data)==null?void 0:s.error)||r.message||"修改失败")}}},Bt=async t=>{var s,r;if(window.confirm(`确定删除子账户「${t.name}」?其剩余积分(${t.balance??0})将退回您的账户。`))try{await x.deleteSubAccount(t.id),await P(),alert("已删除")}catch(o){alert(((r=(s=o.response)==null?void 0:s.data)==null?void 0:r.error)||o.message||"删除失败")}},Ht=async()=>{var s,r;if(!p)return;const t=Math.floor(Number(Me));if(!Number.isInteger(t)||t<=0)return alert("请输入正整数积分");try{await x.allocateToSubAccount(p.id,t),h(null),g(null),E(""),await P(),a&&S({...a,balance:(a.balance??0)-t});const o=await x.syncUser();S(o),alert("分配成功")}catch(o){alert(((r=(s=o.response)==null?void 0:s.data)==null?void 0:r.error)||o.message||"分配失败")}},Et=async()=>{var s,r;if(!p)return;const t=Math.floor(Number(Ue));if(!Number.isInteger(t)||t<=0)return alert("请输入正整数积分");if(t>(p.balance??0))return alert("子账户积分不足");try{await x.withdrawFromSubAccount(p.id,t),h(null),g(null),R(""),await P(),a&&S({...a,balance:(a.balance??0)+t});const o=await x.syncUser();S(o),alert("收回成功")}catch(o){alert(((r=(s=o.response)==null?void 0:s.data)==null?void 0:r.error)||o.message||"收回失败")}},Rt=async()=>{var s,r;if(!p)return;const t=Math.floor(Number(Be));if(!Number.isInteger(t)||t<0)return alert("请输入非负整数");try{await x.setSubAccountBalance(p.id,t),h(null),g(null),O(""),await P();const o=await x.syncUser();S(o),alert("设置成功")}catch(o){alert(((r=(s=o.response)==null?void 0:s.data)==null?void 0:r.error)||o.message||"设置失败")}};i.useEffect(()=>{(async()=>{await pe.init();
46const s=await pe.fetchFullConfig().catch(()=>pe.getFullConfig());z(s);const r=s.payment.subscriptionPlans||[];r.length>0&&Ne(r[0].id),s.payment.packages.length>0&&ve(s.payment.packages[0].id);const o=x.getLocalUserId();Ct(o);try{const c=await x.syncUser();S(c),c.personalApiKey&&ze(c.personalApiKey),c.usePersonalKey&&Te(c.usePersonalKey)}catch(c){console.error("Failed to sync user",c)}const l=new URLSearchParams(window.location.search).get("payment");l==="success"?(alert("支付成功!积分已到账。"),window.history.replaceState({},"","/user-center")):(l==="error"||l==="not_found")&&(alert("支付处理遇到问题,请联系客服或稍后重试。"),window.history.replaceState({},"","/user-center")),Nt([]),oe(1)})()},[]),i.useEffect(()=>{a&&!a.parentId&&d==="sub-accounts"&&P()},[a,d]);const Z=async()=>{try{const t=await G.fetchBindCodes();We(t)}catch{We([])}},ce=async()=>{_e(!0);try{const t=await G.fetchDevices();Oe(t)}catch{Oe([])}finally{_e(!1)}},tt=async()=>{Qe(!0);try{const[t,s]=await Promise.all([bt.fetchRoles(),bt.fetchTasks(15)]);Ve(t),Ye(s)}catch{Ve([]),Ye([])}finally{Qe(!1)}},J=async()=>{Ze(!0);try{const t=await ye.listApiKeys();Kt(t)}catch(t){console.error("Failed to load API keys:",t),alert(t.message||"加载 API Key 列表失败")}finally{Ze(!1)}},Ot=async()=>{if(!de.trim())return alert("请输入 Key 名称");try{const t=await ye.createApiKey(de.trim(),k);ie(t),await J(),Je(""),_(!1)}catch(t){alert(t.message||"创建 API Key 失败")}},_t=async(t,s)=>{if(window.confirm(`确定撤销「${s}」?使用此 Key 的应用将无法继续调用 API。`))try{await ye.revokeApiKey(t),await J(),alert("已撤销")}catch(r){alert(r.message||"撤销失败")}};i.useEffect(()=>{d==="desktop"&&(ce(),Z(),tt()),d==="developer"&&J()},[d]),i.useEffect(()=>{if(d!=="market"||!a||!["market","admin"].includes(a.role))return;(async()=>{Ee(!0);const s=await x.fetchMarketInviteMetrics(L.start,L.end);et(s?{inviteeCountInRange:s.inviteeCountInRange,consumePoints:s.consumePoints,rechargeAmount:s.rechargeAmount,details:(s.details||[]).map(r=>({inviteeId:r.inviteeId,inviteeName:r.inviteeName,joinedAtText:r.joinedAtText,consumePoints:r.consumePoints,rechargeAmount:r.rechargeAmount}))}:null),Ee(!1)})()},[d,a,L.start,L.end]);const Ft=async()=>{var s;const t=`ORDER_${Date.now()}`;Ce(!0);try{if(A==="subscription"){const r=(s=n==null?void 0:n.payment.subscriptionPlans)==null?void 0:s.find(l=>l.id===se);if(!r)return;const o=xe(r,f),b=await jt.initiatePayment(U,{amount:o,userId:x.getLocalUserId(),orderId:t,description:`${r.name}(${be(f)})`,productType:"subscription",planId:r.id,billingCycle:f});b.success&&b.payUrl?window.location.href=b.payUrl:alert("支付创建失败: "+(b.message||"未知错误"))}else{const r=n==null?void 0:n.payment.packages.find(l=>l.id===V);if(!r)return;const o=me(r,(a==null?void 0:a.role)||"user",n),b=await jt.initiatePayment(U,{amount:o,userId:x.getLocalUserId(),orderId:t,description:r.name,productType:"credit",planId:r.id});b.success&&b.payUrl?window.location.href=b.payUrl:alert("支付创建失败: "+(b.message||"未知错误"))}}catch{alert("支付请求异常,请稍后重试")}finally{Ce(!1)}},Wt=()=>{const t=`${window.location.origin}?invite=${Ie}`;navigator.clipboard.writeText(t),alert("邀请链接已复制!发送给好友注册即可获得奖励。")},Gt=async()=>{if(!Y||Y.trim()==="")return alert("请输入新密码");try{await x.updateProfile(Y),alert("密码修改成功"),De("")}catch{alert("修改失败,请重试")}},Vt=async()=>{try{await x.updateProfile(void 0,ne,le),alert("API 设置已保存。");const t=await x.syncUser();S(t)}catch{alert("设置保存失败")}},qt=()=>{window.confirm("确定要退出登录吗?")&&x.logout()},Yt=async()=>{try{const t=await x.fetchAllTransactions();if(!t||t.length===0)return alert("暂无数据可导出");const s=["时间","类型","员工","描述","金额"].join(",")+`
47`,r=t.map(c=>{const j=c.type==="recharge"?"充值":c.type==="consume"?"消费":c.type==="refund"||c.type==="refunded"?"退款":c.type==="allocate_in"||c.type==="allocate"?"分配":c.type,C=c.description?c.description.replace(/,/g," ").replace(/\n/g," "):"",F=c.employeeName||"";return`${c.date},${j},${F},${C},${c.amount}`}).join(`
48`),o=new Blob(["\uFEFF"+s+r],{type:"text/csv;charset=utf-8;"}),b=URL.createObjectURL(o),l=document.createElement("a");l.href=b,l.download=`transactions_${new Date().toISOString().split("T")[0]}.csv`,l.click()}catch{alert("导出失败")}},Qt=t=>{let s=t||"";const r=s.match(/\[task:([^\]]+)\]/),o=s.match(/\[tx:([^\]]+)\]/),b=s.match(/\[refund_tx:([^\]]+)\]/);b&&(s=s.replace(/\s*\[refund_tx:[^\]]+\]\s*/g,"").trim()),r&&(s=s.replace(/\s*\[task:[^\]]+\]\s*/g,"").trim()),o&&(s=s.replace(/\s*\[tx:[^\]]+\]\s*/g,"").trim()),s=s.replace(/\s*\[device:[^\]]+\]\s*/g,"").trim();const l=s.match(/\s*\[seedance_stretch_partial:[^\]]+\]\s*$/);l&&(s=s.replace(l[0],"").trim());const c=[];r&&c.push(`任务ID: ${r[1]}`),b?c.push(`关联扣费: ${b[1]}`):o&&c.push(`账单: ${o[1]}`);const j=c.length?` (${c.join(" · ")})`:"";if(!(n!=null&&n.modelDisplayNames))return(s||t)+j;if(s.startsWith("Model: ")){const C=s.replace("Model: ","").trim();return(n.modelDisplayNames[C]||s)+j}if(s.startsWith("BYOK Service Fee: ")){const C=s.replace("BYOK Service Fee: ","").trim();return`BYOK服务费: ${n.modelDisplayNames[C]||C}`+j}return(s||t)+j},I=[{key:"wechat",label:"微信支付",enabled:!!((at=(st=n==null?void 0:n.payment)==null?void 0:st.wechat)!=null&&at.enabled)},{key:"alipay",label:"支付宝",enabled:!!((nt=(rt=n==null?void 0:n.payment)==null?void 0:rt.alipay)!=null&&nt.enabled)}].filter(t=>t.enabled);if(i.useEffect(()=>{if(I.length===0)return;I.some(s=>s.key===U)||we(I[0].key)},[I,U]),!n)return e.jsx("div",{className:"p-10 text-center text-gray-500",children:"加载用户中心..."});const D=((lt=n==null?void 0:n.api)==null?void 0:lt.allowBYOK)!==!1,Xt=()=>e.jsxs("div",{className:"space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[(n==null?void 0:n.site.announcement)&&e.jsxs("div",{className:"bg-brand-900/20 border border-brand-500/30 p-4 rounded-lg flex gap-3 text-brand-300",children:[e.jsx(ms,{className:"shrink-0 mt-1",size:20}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-bold",children:"系统公告"}),e.jsx("p",{className:"text-sm opacity-90",children:n.site.announcement})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-dark-800 p-5 rounded-xl border border-gray-700",children:[e.jsx("p",{className:"text-gray-400 text-xs uppercase font-bold",children:"当前余额"}),e.jsxs("p",{className:"text-2xl font-bold text-white mt-1",children:[(a==null?void 0:a.balance)??0," ",e.jsx("span",{className:"text-sm text-brand-500",children:"积分"})]})]}),e.jsxs("div",{className:"bg-dark-800 p-5 rounded-xl border border-gray-700",children:[e.jsx("p",{className:"text-gray-400 text-xs uppercase font-bold",children:"本月消耗"}),e.jsxs("p",{className:"text-2xl font-bold text-white mt-1",children:[(a==null?void 0:a.monthUsage)??0," ",e.jsx("span",{className:"text-sm text-gray-500",children:"积分"})]})]}),e.jsxs("div",{className:"bg-dark-800 p-5 rounded-xl border border-gray-700",children:[e.jsx("p",{className:"text-gray-400 text-xs uppercase font-bold",children:"当前等级"}),e.jsx("p",{className:`text-2xl font-bold mt-1 ${(a==null?void 0:a.role)==="svip"?"text-yellow-500":(a==null?void 0:a.role)==="vip"?"text-purple-500":"text-gray-300"}`,children:(a==null?void 0:a.role)==="admin"?"管理员":(a==null?void 0:a.role)==="market"?"市场组":(a==null?void 0:a.role)==="svip"?"SVIP会员":(a==null?void 0:a.role)==="vip"?"VIP会员":"普通用户"})]}),e.jsxs("div",{className:"bg-dark-800 p-5 rounded-xl border border-gray-700",children:[e.jsx("p",{className:"text-gray-400 text-xs uppercase font-bold",children:"邀请好友"}),e.jsxs("p",{className:"text-2xl font-bold text-purple-500 mt-1",children:[(a==null?void 0:a.invitedCount)??0," ",e.jsx("span",{className:"text-sm text-gray-500",children:"人"})]})]})]}),e.jsxs("div",{className:"bg-dark-800 p-6 rounded-xl border border-gray-700 mt-6",children:[e.jsxs("h3",{className:"text-lg font-bold text-white mb-6 flex items-center gap-2",children:[e.jsx(bs,{size:20})," 账户信息"]}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-8",children:[e.jsxs("div",{className:"space-y-5 flex-1",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"用户名"}),e.jsx("p",{className:"text-white font-medium bg-dark-900 px-3 py-2 rounded-lg border border-gray-800",children:a==null?void 0:a.name})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"电子邮箱"}),e.jsx("p",{className:"text-white font-medium bg-dark-900 px-3 py-2 rounded-lg border border-gray-800",children:a==null?void 0:a.email})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"注册时间"}),e.jsx("p",{className:"text-white font-medium bg-dark-900 px-3 py-2 rounded-lg border border-gray-800",children:a!=null&&a.joinedAt?new Date(a.joinedAt).toLocaleDateString():"-"})]}),e.jsxs("div",{className:"pt-6 mt-6 border-t border-gray-700",children:[e.jsxs("h4",{className:"text-sm font-bold text-brand-400 mb-3 flex items-center gap-2",children:[e.jsx(te,{size:16})," 开发者设置 (BYOK)",D?e.jsx("span",{className:"text-[10px] text-green-400 bg-green-900/30 px-2 py-0.5 rounded border border-green-500/30 ml-2",children:"功能正常"}):e.jsx("span",{className:"text-[10px] text-red-400 bg-red-900/30 px-2 py-0.5 rounded border border-red-500/30 ml-2",children:"暂时不可用"})]}),e.jsxs("div",{className:`bg-dark-900/50 p-4 rounded-lg border ${D?"border-gray-700":"border-red-900/30"} space-y-4 transition-colors`,children:[!D&&e.jsxs("div",{className:"flex items-start gap-2 bg-red-900/20 border border-red-900/50 p-3 rounded text-red-400 mb-2",children:[e.jsx(ct,{size:16,className:"mt-0.5 shrink-0"}),e.jsx("p",{className:"text-xs",children:"管理员已暂时关闭此功能。即使您开启了开关,系统仍将使用默认通道并扣除积分。"})]}),e.jsxs("p",{className:"text-xs text-gray-400",children:["如果您拥有自己的 Google Gemini API Key,可在此填入。开启后,系统将使用您的 Key 调用 Google 官方接口,",e.jsx("strong",{className:"text-brand-400",children:"大幅降低积分消耗"})," (仅收取少量服务费)。"]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"Google API Key"}),e.jsx("input",{type:"password",value:ne,onChange:t=>ze(t.target.value),className:"w-full bg-dark-800 border border-gray-600 rounded px-3 py-2 text-white text-xs font-mono disabled:opacity-50 disabled:cursor-not-allowed",placeholder:"AIzaSy...",disabled:!D&&!ne})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",id:"usePersonalKey",checked:le,onChange:t=>Te(t.target.checked),className:"w-4 h-4 rounded border-gray-600 bg-dark-800 text-brand-600 focus:ring-brand-500 disabled:opacity-50",disabled:!D&&!le}),e.jsx("label",{htmlFor:"usePersonalKey",className:`text-xs cursor-pointer select-none ${D?"text-gray-300":"text-gray-500"}`,children:"启用自有 Key (直连官方接口)"})]}),e.jsx("button",{onClick:Vt,className:`bg-brand-900/50 hover:bg-brand-800 border border-brand-500/30 text-brand-400 text-xs px-3 py-1.5 rounded font-bold transition-colors ${D?"":"opacity-50"}`,children:"保存设置"})]})]})]}),e.jsxs("div",{className:"flex-1 border-t md:border-t-0 md:border-l border-gray-700 pt-6 md:pt-0 md:pl-8",children:[e.jsxs("h4",{className:"font-bold text-white mb-4 flex items-center gap-2",children:[e.jsx(yt,{size:16})," 安全设置"]}),e.jsxs("div",{className:"space-y-4 max-w-sm",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"修改密码"}),e.jsx("input",{type:"password",placeholder:"输入新密码",className:"w-full bg-dark-900 border border-gray-600 rounded-lg px-3 py-2 text-white text-sm focus:border-brand-500 outline-none",value:Y,onChange:t=>De(t.target.value)})]}),e.jsx("button",{onClick:Gt,className:"bg-brand-600 hover:bg-brand-500 text-white px-4 py-2 rounded-lg text-sm font-bold w-full shadow-lg shadow-brand-900/30 transition-all",children:"确认修改"}),e.jsx("div",{className:"pt-4 mt-4 border-t border-gray-700/50",children:e.jsxs("button",{onClick:qt,className:"bg-red-900/20 hover:bg-red-900/40 text-red-500 border border-red-900/40 px-4 py-2 rounded-lg text-sm font-bold w-full flex items-center justify-center gap-2 transition-all",children:[e.jsx(Cs,{size:16})," 退出登录"]})})]})]})]})]})]}),Zt=()=>{var b;const t=(n==null?void 0:n.payment.subscriptionPlans)||[],s=cs((a==null?void 0:a.role)||"user",n),r=t.find(l=>l.id===se),o=A==="subscription"&&r?xe(r,f):n!=null&&n.payment.packages.find(l=>l.id===V)?me(n.payment.packages.find(l=>l.id===V),(a==null?void 0:a.role)||"user",n):0;return e.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[(a==null?void 0:a.subscriptionExpiresAt)&&a.subscriptionExpiresAt>Date.now()&&e.jsxs("div",{className:"bg-brand-900/20 border border-brand-500/30 rounded-xl px-4 py-3 text-sm text-brand-200",children:["当前订阅有效至 ",new Date(a.subscriptionExpiresAt).toLocaleDateString("zh-CN"),a.subscriptionPoints!=null&&a.subscriptionPoints>0&&e.jsxs("span",{className:"text-gray-400 ml-2",children:["(含 ",Math.floor(a.subscriptionPoints)," 订阅积分,每月月初自动重置)"]}),a.permanentPoints!=null&&a.permanentPoints>0&&e.jsxs("span",{className:"text-emerald-400 ml-2",children:["+ ",Math.floor(a.permanentPoints)," 永久积分"]})]}),e.jsxs("div",{className:"flex gap-2 p-1 bg-dark-900 rounded-lg border border-gray-700 w-fit",children:[e.jsx("button",{onClick:()=>fe("subscription"),className:`px-4 py-2 rounded-md text-sm font-bold transition-colors ${A==="subscription"?"bg-brand-600 text-white":"text-gray-400 hover:text-white"}`,children:"订阅会员"}),e.jsx("button",{onClick:()=>fe("credit"),className:`px-4 py-2 rounded-md text-sm font-bold transition-colors ${A==="credit"?"bg-brand-600 text-white":"text-gray-400 hover:text-white"}`,children:"积分加购"})]}),e.jsxs("div",{className:"rounded-xl border border-brand-400/45 bg-gradient-to-r from-brand-900/45 via-brand-950/30 to-dark-900 p-4 flex gap-3 shadow-[0_0_24px_rgba(59,130,246,0.08)]",children:[e.jsx("div",{className:"shrink-0 w-9 h-9 rounded-lg bg-brand-500/25 flex items-center justify-center",children:e.jsx(hs,{size:18,className:"text-brand-300"})}),e.jsxs("div",{className:"min-w-0 text-sm leading-relaxed",children:[e.jsxs("p",{className:"text-brand-100 font-semibold flex items-center gap-1.5",children:[e.jsx(xt,{size:14,className:"text-brand-300 shrink-0"}),"两种充值方式,按需选择"]}),e.jsxs("p",{className:"text-gray-200 mt-1.5",children:[e.jsx("span",{className:"text-cyan-300 font-medium",children:"周期订阅"}),e.jsxs("span",{className:"text-gray-300",children:[":按",A==="subscription"?"月/季/年":"周期","获
48得大量订阅积分,每月月初自动重置,适合持续创作。"]}),e.jsx("span",{className:"text-brand-400/80 mx-1.5",children:"·"}),e.jsx("span",{className:"text-emerald-300 font-medium",children:"积分加购"}),e.jsx("span",{className:"text-gray-300",children:":一次性购买永久积分,不过期不重置,适合偶尔使用或补充余额。"})]}),A==="credit"&&s<1&&e.jsxs("p",{className:"text-amber-400/90 text-xs mt-2",children:["当前会员等级享积分加购 ",Math.round((1-s)*100),"% 折扣;若长期创作,订阅通常比单独买积分更省。"]})]})]}),A==="subscription"?e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-4",children:[e.jsx("span",{className:"text-sm text-gray-400",children:"计费周期:"}),["monthly","quarterly","annual"].map(l=>e.jsx("button",{onClick:()=>ft(l),className:`px-3 py-1.5 rounded-lg text-sm border transition-colors ${f===l?"border-brand-500 bg-brand-900/30 text-brand-300":"border-gray-700 text-gray-400 hover:border-gray-500"}`,children:be(l)},l))]}),e.jsxs("h3",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[e.jsx(ue,{size:18})," 选择订阅套餐"]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:t.map(l=>{const c=xe(l,f),j=f==="quarterly"?it(l.quarterlyDiscount):f==="annual"?it(l.annualDiscount):null;return e.jsxs("div",{onClick:()=>Ne(l.id),className:`cursor-pointer p-6 rounded-xl border-2 transition-all relative overflow-hidden ${se===l.id?"border-brand-500 bg-brand-900/20":"border-gray-700 bg-dark-800 hover:border-gray-500"}`,children:[l.roleToAssign&&l.roleToAssign!=="user"&&e.jsx("div",{className:"absolute top-0 right-0 bg-gradient-to-bl from-yellow-500 to-orange-500 text-black text-[10px] font-bold px-3 py-1 rounded-bl-lg",children:l.roleToAssign.toUpperCase()}),j&&e.jsx("div",{className:"absolute top-0 left-0 bg-red-600 text-white text-[10px] font-bold px-2 py-1 rounded-br-lg",children:j}),e.jsx("h4",{className:"font-bold text-white text-lg",children:l.name}),e.jsxs("div",{className:"my-2",children:[e.jsxs("span",{className:"text-3xl font-bold text-brand-400",children:["¥",c]}),e.jsxs("span",{className:"text-xs text-gray-500 ml-1",children:["/",be(f)]})]}),l.description&&e.jsx("p",{className:"text-xs text-gray-400 mb-2",children:l.description}),e.jsx("div",{className:"border-t border-gray-700 pt-3",children:e.jsx(xs,{plan:l,billingCycle:f,variant:"recharge",className:"space-y-2"})})]},l.id)})})]}):e.jsxs("div",{children:[s<1&&e.jsxs("p",{className:"text-sm text-brand-300 mb
48-3",children:["您当前为 ",(b=a==null?void 0:a.role)==null?void 0:b.toUpperCase()," 会员,积分加购享 ",(s*10).toFixed(1).replace(/\.0$/,"")," 折优惠"]}),e.jsxs("h3",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[e.jsx(ue,{size:18})," 选择积分加购"]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:n==null?void 0:n.payment.packages.map(l=>{const c=Math.floor(Number(l.points)||0),j=Math.max(0,Math.floor(Number(l.bonusPoints)||0)),C=c+j,F=me(l,(a==null?void 0:a.role)||"user",n);return e.jsxs("div",{onClick:()=>ve(l.id),className:`cursor-pointer p-6 rounded-xl border-2 transition-all relative overflow-hidden ${V===l.id?"border-brand-500 bg-brand-900/20":"border-gray-700 bg-dark-800 hover:border-gray-500"}`,children:[e.jsx("h4",{className:"font-bold text-white text-lg",children:l.name}),e.jsxs("div",{className:"my-2",children:[e.jsxs("span",{className:"text-3xl font-bold text-brand-400",children:["Â¥",F]}),F<l.price&&e.jsxs("span",{className:"text-sm text-gray-500 line-through ml-2",children:["Â¥",l.price]})]}),l.description&&e.jsx("p",{className:"text-xs text-gray-400 mb-2",children:l.description}),e.jsxs("ul",{className:"text-sm text-gray-300 space-y-2 border-t border-gray-700 pt-3",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(pt,{size:12,className:"text-brand-500 shrink-0"}),e.jsxs("span",{className:"text-xl font-bold text-brand-300",children:[C," 永久积分"]})]}),e.jsx("li",{className:"text-xs text-gray-500 pl-5",children:"永久有效,不过期"})]})]},l.id)})})]}),e.jsxs("div",{className:"bg-dark-800 p-6 rounded-xl border border-gray-700",children:[e.jsx("h3",{className:"text-lg font-bold text-white mb-4",children:"支付方式"}),I.length>0?e.jsx("div",{className:"flex gap-4",children:I.map(l=>e.jsx("button",{onClick:()=>we(l.key),className:`flex-1 py-4 rounded-lg border flex items-center justify-center gap-2 transition-colors ${U===l.key?l.key==="wechat"?"border-green-500 bg-green-500/10 text-green-500":"border-blue-500 bg-blue-500/10 text-blue-500":"border-gray-700 text-gray-400"}`,children:e.jsx("span",{className:"font-bold",children:l.label})},l.key))}):e.jsx("div",{className:"text-sm text-gray-400 bg-dark-900 border border-gray-700 rounded-lg px-4 py-3",children:"当前暂无可用支付方式,请联系管理员在后台完成支付配置并启用。"}),e.jsx("button",{onClick:Ft,disabled:ke||I.length===0,className:"w-full mt-6 bg-brand-600 hover:bg-brand-500 text-white font-bold py-4 rounded-lg shadow-lg shadow-brand-900/50 transition-all hover:scale-[1.01] flex justify-center items-center gap-2",children:ke?"正在创建订单...":`立即支付 Â¥${o}`})]})]})},Jt=()=>e.jsxs("div",{className:"space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-bold text-white",children:"账单流水"}),e.jsxs("button",{onClick:Yt,className:"text-xs bg-dark-800 hover:bg-dark-700 border border-gray-600 text-white px-3 py-1.5 rounded flex items-center gap-2 transition-colors",children:[e.jsx(js,{size:14})," 导出全部"]})]}),e.jsxs("div",{className:"bg-dark-800 rounded-lg border border-gray-700 overflow-hidden",children:[ae?e.jsx("div",{className:"p-10 text-center",children:e.jsx(W,{className:"animate-spin mx-auto text-brand-500"})}):e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"bg-dark-900 text-gray-500 uppercase font-bold text-xs",children:e.jsxs("tr",{children:[e.jsx("th",{className:"p-4",children:"时间"}),e.jsx("th",{className:"p-4",children:"类型"}),e.jsx("th",{className:"p-4",children:"描述"}),e.jsx("th",{className:"p-4",children:"员工"}),e.jsx("th",{className:"p-4",children:"设备"}),e.jsx("th",{className:"p-4 text-right",children:"金额/积分"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-700",children:Se.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"p-10 text-center text-gray-500",children:"暂无账单记录"})}):Se.map(t=>e.jsxs("tr",{className:"hover:bg-dark-700/50",children:[e.jsx("td",{className:"p-4 text-gray-400",children:t.date}),e.jsx("td",{className:"p-4",children:e.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${t.type==="recharge"?"bg-green-900 text-green-400":t.type==="refunded"||t.type==="refund"?"bg-gray-600 text-gray-300":t.type==="allocate_in"||t.type==="allocate"||t.type==="reward"?"bg-blue-900 text-blue-400":"bg-red-900 text-red-400"}`,children:t.type==="recharge"?"充值":t.type==="refunded"||t.type==="refund"?"已退款":t.type==="allocate_in"||t.type==="allocate"||t.type==="reward"?"分é
48…":"消费"})}),e.jsx("td",{className:"p-4 text-white",children:Qt(t.description)}),e.jsx("td",{className:"p-4",children:t.employeeName?e.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-purple-900/60 text-purple-300",children:t.employeeName}):e.jsx("span",{className:"text-gray-600",children:"—"})}),e.jsx("td",{className:"p-4 text-gray-400 text-xs",children:t.source==="desktop"?t.deviceName||(t.deviceId?`设备 ${t.deviceId.slice(0,8)}…`:"HERMES 桌面"):"—"}),e.jsx("td",{className:`p-4 text-right font-mono font-bold ${t.type==="refunded"?"text-gray-400":t.amount>0?"text-green-400":"text-red-400"}`,children:t.type==="refunded"?"0":(t.amount>0?"+":"")+Math.abs(t.amount)})]},t.id))})]}),e.jsxs("div",{className:"p-3 border-t border-gray-700 flex justify-between items-center bg-dark-900/50",children:[e.jsxs("span",{className:"text-xs text-gray-500",children:["第 ",q," 页"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{disabled:q===1||ae,onClick:()=>oe(Math.max(1,q-1)),className:"p-1 rounded hover:bg-dark-700 disabled:opacity-30 disabled:hover:bg-transparent text-gray-400 hover:text-white transition-colors",children:e.jsx(fs,{size:16})}),e.jsx("button",{disabled:!wt||ae,onClick:()=>oe(q+1),className:"p-1 rounded hover:bg-dark-700 disabled:opacity-30 disabled:hover:bg-transparent text-gray-400 hover:text-white transition-colors",children:e.jsx(Ns,{size:16})})]})]})]})]}),es=()=>{var t,s;return e.jsxs("div",{className:"max-w-2xl mx-auto text-center space-y-8 py-10 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[e.jsx("div",{className:"w-20 h-20 bg-purple-900/30 rounded-full flex items-center justify-center mx-auto text-purple-500 mb-6",children:e.jsx(ut,{size:40})}),e.jsx("h3",{className:"text-2xl font-bold text-white",children:"邀请好友,赚取积分"}),e.jsxs("p",{className:"text-gray-400",children:["每邀请一位好友注册并充值,您将获得 ",e.jsx("span",{className:"text-brand-400 font-bold",children:((t=n==null?void 0:n.rewards)==null?void 0:t.inviteReward)||100})," 积分奖励。"]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 max-w-lg mx-auto",children:[e.jsxs("div",{className:"bg-dark-800 p-4 rounded-xl border border-gray-700 flex flex-col items-center",children:[e.jsx("div",{className:"mb-2 p-2 bg-dark-900 rounded-full text-brand-500",children:e.jsx(ee,{size:20})}),e.jsx("p",{className:"text-gray-400 text-xs mb-1",children:"累计成功邀请"}),e.jsxs("p",{className:"text-2xl font-bold text-white",children:[(a==null?void 0:a.invitedCount)||0," ",e.jsx("span",{className:"text-sm font-normal text-gray-500",children:"人"})]})]}),e.jsxs("div",{className:"bg-dark-800 p-4 rounded-xl border border-gray-700 flex flex-col items-center",children:[e.jsx("div",{className:"mb-2 p-2 bg-dark-900 rounded-full text-yellow-500",children:e.jsx(ge,{size:20})}),e.jsx("p",{className:"text-gray-400 text-xs mb-1",children:"累计获得奖励"}),e.jsxs("p",{className:"text-2xl font-bold text-brand-400",children:[((a==null?void 0:a.invitedCount)||0)*(((s=n==null?void 0:n.rewards)==null?void 0:s.inviteReward)||100)," ",e.jsx("span",{className:"text-sm font-normal text-gray-500",children:"积分"})]})]})]}),e.jsxs("div",{className:"bg-dark-800 p-6 rounded-xl border border-gray-700 flex items-center gap-4 max-w-lg mx-auto",children:[e.jsxs("div",{className:"flex-1 text-left",children:[e.jsx("p",{className:"text-xs text-gray-500 mb-1",children:"您的专属邀请链接"}),e.jsx("p",{className:"text-white bg-dark-900 p-2 rounded truncate font-mono text-sm",children:`${window.location.origin}?invite=${Ie}`})]}),e.jsx("button",{onClick:Wt,className:"bg-brand-600 hover:bg-brand-500 text-white p-3 rounded-lg",children:e.jsx(mt,{size:20})})]})]})},ts=()=>e.jsxs("div",{className:"bg-dark-800 p-8 rounded-xl border border-gray-700 space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[e.jsxs("h3",{className:"text-xl font-bold text-white flex items-center gap-2",children:[e.jsx(ht,{size:24})," 帮助中心 & 客服"]}),e.jsx("div",{className:"prose prose-invert max-w-none whitespace-pre-wrap text-gray-300 bg-dark-900/50 p-6 rounded-lg border border-gray-800",children:(n==null?void 0:n.site.helpContent)||"暂无帮助内容"}),e.jsx("div",{className:"text-center pt-8 border-t border-gray-700",children:e.jsx("p",{className:"text-gray-500 text-sm",children:"如需更多帮助,请根据上方指引联系管理员。"})})]}),ss=()=>e.jsxs("div",{className:"space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("h3",{className:"text-lg font-bold text-white flex items-center gap-2",children:[e.jsx(ee,{size:20})," 子账户管理"]}),e.jsxs("button",{onClick:()=>{h("create"),K(""),$("")},className:"flex items-center gap-2 px-4 py-2 bg-brand-600 hover:bg-brand-500 text-white rounded-lg text-sm font-bold transition-colors",children:[e.jsx(As,{size:16})," 添加子账户"]})]}),e.jsx("p",{className:"text-gray-400 text-sm",children:"子账户使用独立积分,由您分配。子账户可使用分配到的积分进行消费;您可修改其用户名/密码或删除。"}),e.jsx("div",{className:"bg-dark-800 rounded-xl border border-gray-700 overflow-hidden",children:St?e.jsx("div",{className:"p-10 text-center",children:e.jsx(W,{className:"animate-spin mx-auto text-brand-500",size:28})}):Ke.length===0?e.jsxs("div",{className:"p-10 text-center text-gray-500",children:[e.jsx(ee,{size:40,className:"mx-auto mb-2 opacity-30"}),e.jsx("p",{children:"暂无子账户,点击「添加子账户」创建"})]}):e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"bg-dark-900 text-gray-500 uppercase font-bold text-xs",children:e.jsxs("tr",{children:[e.jsx("th",{className:"p-4",children:"用户名"}),e.jsx("th",{className:"p-4",children:"积分余额"}),e.jsx("th",{className:"p-4 text-right",children:"操作"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-700",children:Ke.map(t=>e.jsxs("tr",{className:"hover:bg-dark-700/30",children:[e.jsx("td",{className:"p-4 font-medium text-white",children:t.name}),e.jsx("td",{className:"p-4 text-brand-400 font-mono",children:t.balance??0}),e.jsx("td",{className:"p-4 text-right",children:e.jsxs("div",{className:"flex justify-end gap-2 flex-wrap",children:[e.jsxs("button",{onClick:()=>{g(t),E(""),h("allocate")},className:"text-xs px-2 py-1 rounded border border-brand-500/50 text-brand-400 hover:bg-brand-900/30 flex items-center gap-1",children:[e.jsx(Ps,{size:12})," 分配"]}),e.jsxs("button",{onClick:()=>{g(t),R(""),h("withdraw")},className:"text-xs px-2 py-1 rounded border border-amber-500/50 text-amber-400 hover:bg-amber-900/20 flex items-center gap-1",children:[e.jsx(ws,{size:12})," 收回"]}),e.jsxs("button",{onClick:()=>{g(t),O(String(t.balance??0)),h("setBalance")},className:"text-xs px-2 py-1 rounded border border-gray-600 text-gray-400 hover:bg-dark-700 flex items-center gap-1",children:[e.jsx(vs,{size:12})," 设置积分"]}),e.jsxs("button",{onClick:()=>{g(t),K(t.name),$(""),h("edit")},className:"text-xs px-2 py-1 rounded border border-gray-600 text-gray-400 hover:bg-dark-700 flex items-center gap-1",children:[e.jsx(Ss,{size:12})," 修改"]}),e.jsxs("button",{onClick:()=>Bt(t),className:"text-xs px-2 py-1 rounded border border-red-500/50 text-red-400 hover:bg-red-900/20 flex items-center gap-1",children:[e.jsx(gt,{size:12})," 删除"]})]})})]},t.id))})]})}),B==="create"&&e.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50 p-4",onClick:()=>h(null),children:e.jsxs("div",{className:"bg-dark-800 rounded-xl border border-gray-700 p-6 w-full max-w-md 
48shadow-xl",onClick:t=>t.stopPropagation(),children:[e.jsx("h4",{className:"text-lg font-bold text-white mb-4",children:"添加子账户"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"用户名(子账户登录用)"}),e.jsx("input",{type:"text",value:T,onChange:t=>K(t.target.value),className:"w-full bg-dark-900 border border-gray-600 rounded-lg px-3 py-2 text-white",placeholder:"请输入用户名"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"密码"}),e.jsx("input",{type:"password",value:H,onChange:t=>$(t.target.value),className:"w-full bg-dark-900 border border-gray-600 rounded-lg px-3 py-2 text-white",placeholder:"请输入密码"})]})]}),e.jsxs("div",{className:"flex gap-2 mt-6",children:[e.jsx("button",{onClick:()=>h(null),className:"flex-1 py-2 rounded-lg border border-gray-600 text-gray-400 hover:bg-dark-700",children:"取消"}),e.jsx("button",{onClick:Mt,className:"flex-1 py-2 rounded-lg bg-brand-600 text-white font-bold hover:bg-brand-500",children:"创建"})]})]})}),B==="edit"&&p&&e.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50 p-4",onClick:()=>{h(null),g(null)},children:e.jsxs("div",{className:"bg-dark-800 rounded-xl border border-gray-700 p-6 w-full max-w-md 
48shadow-xl",onClick:t=>t.stopPropagation(),children:[e.jsx("h4",{className:"text-lg font-bold text-white mb-4",children:"修改子账户"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"用户名"}),e.jsx("input",{type:"text",value:T,onChange:t=>K(t.target.value),className:"w-full bg-dark-900 border border-gray-600 rounded-lg px-3 py-2 text-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"新密码(不填则不改)"}),e.jsx("input",{type:"password",value:H,onChange:t=>$(t.target.value),className:"w-full bg-dark-900 border border-gray-600 rounded-lg px-3 py-2 text-white",placeholder:"留空表示不修改"})]})]}),e.jsxs("div",{className:"flex gap-2 mt-6",children:[e.jsx("button",{onClick:()=>{h(null),g(null)},className:"flex-1 py-2 rounded-lg border border-gray-600 text-gray-400 hover:bg-dark-700",children:"取消"}),e.jsx("button",{onClick:Ut,className:"flex-1 py-2 rounded-lg bg-brand-600 text-white font-bold hover:bg-brand-500",children:"保存"})]})]})}),B==="allocate"&&p&&e.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50 p-4",onClick:()=>{h(null),g(null),E("")},children:e.jsxs("div",{className:"bg-dark-800 rounded-xl border border-gray-700 p-6 w-full max-w-md 
48shadow-xl",onClick:t=>t.stopPropagation(),children:[e.jsxs("h4",{className:"text-lg font-bold text-white mb-4",children:["分配积分给「",p.name,"」"]}),e.jsxs("p",{className:"text-gray-400 text-sm mb-2",children:["从您的账户扣除积分,转入该子账户。您当前余额:",e.jsx("span",{className:"text-brand-400 font-bold",children:(a==null?void 0:a.balance)??0})," 积分"]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"积分数量"}),e.jsx("input",{type:"number",min:1,value:Me,onChange:t=>E(t.target.value),className:"w-full bg-dark-900 border border-gray-600 rounded-lg px-3 py-2 text-white",placeholder:"正整数"})]}),e.jsxs("div",{className:"flex gap-2 mt-6",children:[e.jsx("button",{onClick:()=>{h(null),g(null),E("")},className:"flex-1 py-2 rounded-lg border border-gray-600 text-gray-400 hover:bg-dark-700",children:"取消"}),e.jsx("button",{onClick:Ht,className:"flex-1 py-2 rounded-lg bg-brand-600 text-white font-bold hover:bg-brand-500",children:"确认分配"})]})]})}),B==="withdraw"&&p&&e.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50 p-4",onClick:()=>{h(null),g(null),R("")},children:e.jsxs("div",{className:"bg-dark-800 rounded-xl border border-gray-700 p-6 w-full max-w-md 
48shadow-xl",onClick:t=>t.stopPropagation(),children:[e.jsxs("h4",{className:"text-lg font-bold text-white mb-4",children:["从「",p.name,"」收回积分"]}),e.jsxs("p",{className:"text-gray-400 text-sm mb-2",children:["子账户当前余额:",e.jsx("span",{className:"text-brand-400 font-bold",children:p.balance??0})," 积分,收回后将加回您的账户。"]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"收回数量"}),e.jsx("input",{type:"number",min:1,max:p.balance??0,value:Ue,onChange:t=>R(t.target.value),className:"w-full bg-dark-900 border border-gray-600 rounded-lg px-3 py-2 text-white",placeholder:"正整数"})]}),e.jsxs("div",{className:"flex gap-2 mt-6",children:[e.jsx("button",{onClick:()=>{h(null),g(null),R("")},className:"flex-1 py-2 rounded-lg border border-gray-600 text-gray-400 hover:bg-dark-700",children:"取消"}),e.jsx("button",{onClick:Et,className:"flex-1 py-2 rounded-lg bg-amber-600 text-white font-bold hover:bg-amber-500",children:"确认收回"})]})]})}),B==="setBalance"&&p&&e.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50 p-4",onClick:()=>{h(null),g(null),O("")},children:e.jsxs("div",{className:"bg-dark-800 rounded-xl border border-gray-700 p-6 w-full max-w-md 
48shadow-xl",onClick:t=>t.stopPropagation(),children:[e.jsxs("h4",{className:"text-lg font-bold text-white mb-4",children:["直接设置「",p.name,"」积分"]}),e.jsxs("p",{className:"text-gray-400 text-sm mb-2",children:["当前:",e.jsx("span",{className:"text-brand-400 font-bold",children:p.balance??0})," 积分。设为更大值将从您账户扣减并转入;设为更小值将从子账户扣减并退回您账户。"]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"目标积分(非负整数)"}),e.jsx("input",{type:"number",min:0,value:Be,onChange:t=>O(t.target.value),className:"w-full bg-dark-900 border border-gray-600 rounded-lg px-3 py-2 text-white",placeholder:"0"})]}),e.jsxs("div",{className:"flex gap-2 mt-6",children:[e.jsx("button",{onClick:()=>{h(null),g(null),O("")},className:"flex-1 py-2 rounded-lg border border-gray-600 text-gray-400 hover:bg-dark-700",children:"取消"}),e.jsx("button",{onClick:Rt,className:"flex-1 py-2 rounded-lg bg-brand-600 text-white font-bold hover:bg-brand-500",children:"确认设置"})]})]})})]}),as=()=>e.jsxs("div",{className:"space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[e.jsxs("div",{className:"bg-dark-800 p-4 rounded-xl border border-gray-700 flex flex-wrap items-end gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"开始日期"}),e.jsx("input",{type:"date",value:L.start,onChange:t=>He(s=>({...s,start:t.target.value})),className:"bg-dark-900 border border-gray-600 rounded px-3 py-2 text-white text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"结束日期"}),e.jsx("input",{type:"date",value:L.end,onChange:t=>He(s=>({...s,end:t.target.value})),className:"bg-dark-900 border border-gray-600 rounded px-3 py-2 text-white text-sm"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-dark-800 p-5 rounded-xl border border-gray-700",children:[e.jsx("p",{className:"text-xs text-gray-400",children:"邀请人数(区间)"}),e.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(y==null?void 0:y.inviteeCountInRange)??0})]}),e.jsxs("div",{className:"bg-dark-800 p-5 rounded-xl border border-gray-700",children:[e.jsx("p",{className:"text-xs text-gray-400",children:"净消耗(区间)"}),e.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(y==null?void 0:y.consumePoints)??0})]}),e.jsxs("div",{className:"bg-dark-800 p-5 rounded-xl border border-gray-700",children:[e.jsx("p",{className:"text-xs text-gray-400",children:"充值金额(区间)"}),e.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(y==null?void 0:y.rechargeAmount)??0})]})]}),e.jsx("div",{className:"bg-dark-800 rounded-xl border border-gray-700 overflow-auto",children:At?e.jsx("div",{className:"p-4 text-gray-400 text-sm",children:"加载中..."}):e.jsxs("table",{className:"w-full text-sm text-gray-300",children:[e.jsx("thead",{className:"bg-dark-900 text-gray-400",children:e.jsxs("tr",{children:[e.jsx("th",{className:"p-3 text-left",children:"被邀请用户"}),e.jsx("th",{className:"p-3 text-left",children:"注册时间"}),e.jsx("th",{className:"p-3 text-left",children:"净消耗"}),e.jsx("th",{className:"p-3 text-left",children:"充值金额"})]})}),e.jsx("tbody",{children:((y==null?void 0:y.details)||[]).map(t=>e.jsxs("tr",{className:"border-t border-gray-700",children:[e.jsxs("td",{className:"p-3",children:[t.inviteeName," ",e.jsxs("span",{className:"text-xs text-gray-500",children:["(",t.inviteeId,")"]})]}),e.jsx("td",{className:"p-3",children:t.joinedAtText}),e.jsx("td",{className:"p-3",children:t.consumePoints}),e.jsx("td",{className:"p-3",children:t.rechargeAmount})]},t.inviteeId))})]})})]}),rs=()=>e.jsxs("div",{className:"space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[e.jsxs("div",{className:"bg-dark-800 border border-gray-700 rounded-xl p-6",children:[e.jsxs("h3",{className:"text-lg font-bold text-white flex items-center gap-2",children:[e.jsx(he,{size:20,className:"text-brand-400"}),"桌面智能体绑定"]}),e.jsxs("p",{className:"text-sm text-gray-400 mt-2",children:["在桌面客户端输入下方绑定码,即可用本账号积分调用网站 API(生图、生视频、电商数据采集、社媒数据分析 等)。每个绑定码对应",e.jsx("strong",{className:"text-gray-300",children:"一台设备"}),",激活后长期有效(本机可自动续期);令牌仅保存在您的电脑,不会下发上游模型 Key。"]}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-3 items-end",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"设备名称(可选)"}),e.jsx("input",{value:Ge,onChange:t=>Dt(t.target.value),className:"bg-dark-900 border border-gray-600 rounded px-3 py-2 text-white text-sm w-48",placeholder:"我的电脑"})]}),e.jsx("button",{type:"button",disabled:(w==null?void 0:w.remainingSlots)!==void 0&&w.remainingSlots<=0,onClick:async()=>{var t,s;try{const r=await G.createBindCode(Ge);It(r),await Z()}catch(r){const o=r;alert(((s=(t=o.response)==null?void 0:t.data)==null?void 0:s.error)||o.message||"生成失败")}},className:"bg-brand-600 hover:bg-brand-500 disabled:opacity-50 disabled:cursor-not-allowed text-white px-4 py-2 rounded-lg text-sm font-bold",children:"生成绑定码"})]}),w&&e.jsxs("div",{className:"mt-4 p-4 bg-dark-950 border border-brand-500/40 rounded-lg",children:[e.jsx("p",{className:"text-xs text-gray-500 mb-1",children:"绑定码(在桌面智能体客户端「绑定账号」中输入)"}),e.jsx("p",{className:"text-3xl font-mono font-bold text-brand-300 tracking-widest",children:w.bindCode}),e.jsxs("p",{className:"text-xs text-gray-500 mt-2",children:["有效期至 ",new Date(w.expiresAt).toLocaleStr
48ing()," · API 地址请填"," ",e.jsx("code",{className:"text-gray-300",children:window.location.origin})]}),e.jsx("button",{type:"button",className:"mt-2 text-xs text-brand-400 underline",onClick:()=>{navigator.clipboard.writeText(w.bindCode),alert("已复制绑定码")},children:"复制绑定码"})]})]}),e.jsxs("div",{className:"bg-dark-800 border border-gray-700 rounded-xl p-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsxs("h4",{className:"font-bold text-white flex items-center gap-2",children:[e.jsx(he,{size:18,className:"text-brand-400"}),"已绑定设备"]}),e.jsx("button",{type:"button",onClick:()=>void ce(),className:"text-xs text-gray-400 hover:text-white",children:"刷新"})]}),Pt?e.jsxs("div",{className:"flex items-center gap-2 text-gray-400 text-sm",children:[e.jsx(W,{className:"animate-spin",size:16})," 加载中…"]}):Re.length===0?e.jsx("p",{className:"text-sm text-gray-500",children:"暂无绑定设备 — 在上方生成绑定码,在桌面客户端输入即可绑定"}):e.jsx("div",{className:"space-y-2",children:Re.map(t=>e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 p-4 bg-dark-900 rounded-lg border border-gray-800",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-white font-medium",children:t.deviceName}),e.jsx("p",{className:"text-xs text-gray-500 font-mono truncate",children:t.id}),e.jsxs("p",{className:"text-xs text-gray-500",children:[t.platform||"unknown"," · ",t.active?"活跃":t.revokedAt?"已吊销":"令牌过期",t.lastSeenAt?` · 最近 ${new Date(t.lastSeenAt).toLocaleString()}`:""]})]}),!t.revokedAt&&e.jsxs("button",{type:"button",onClick:async()=>{var s,r;if(window.confirm(`确定解绑「${t.deviceName}」?该设备将无法再调用 API,需在桌面客户端重新输入绑定码。`))try{await G.revokeDevice(t.id),await ce()}catch(o){alert(((r=(s=o.response)==null?void 0:s.data)==null?void 0:r.error)||"解绑失败")}},className:"flex items-center gap-1.5 bg-red-600 hover:bg-red-500 text-white text-sm font-bold px-4 py-2 rounded-lg shadow-sm shrink-0",children:[e.jsx(ps,{size:14}),"解绑此设备"]})]},t.id))})]}),e.jsxs("div",{className:"bg-dark-800 border border-gray-700 rounded-xl p-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-3",children:[e.jsx("h4",{className:"font-bold text-white text-sm",children:"绑定码历史"}),e.jsx("button",{type:"button",onClick:()=>void Z(),className:"text-xs text-gray-400 hover:text-white",children:"刷新"})]}),Fe.length===0?e.jsx("p",{className:"text-sm text-gray-500",children:"暂无绑定码记录"}):e.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:Fe.map(t=>e.jsxs("div",{className:"flex items-center justify-between gap-3 p-3 bg-dark-900 rounded-lg border border-gray-800",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-mono text-white font-medium truncate",children:t.code}),e.jsxs("p",{className:"text-xs text-gray-500",children:[t.status==="used"?"已使用":t.status==="expired"?"已过期":"待使用",t.deviceNameHint?` · ${t.deviceNameHint}`:"",t.usedAt?` · ${new Date(t.usedAt).toLocaleString()}`:"",t.status==="pending"&&` · 过期 ${new Date(t.expiresAt).toLocaleDateString()}`]})]}),t.status==="pending"&&e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(t.code),alert("已复制")},className:"text-xs text-brand-400 hover:text-brand-300 border border-brand-900/50 px-2 py-1 rounded",children:"复制"}),e.jsx("button",{type:"button",onClick:async()=>{var s,r;if(window.confirm(`确定删除此未使用的绑定码 ${t.code}?删除后无法重新生成。`))try{await G.deleteBindCode(t.code),await Z()}catch(o){alert(((r=(s=o.response)==null?void 0:s.data)==null?void 0:r.error)||"删除失败")}},className:"text-xs text-red-400 hover:text-red-300 border border-red-900/50 px-2 py-1 rounded",children:"删除"})]})]},t.code))}),e.jsxs("ol",{className:"mt-4 text-xs text-gray-500 list-decimal list-inside space-y-1",children:[e.jsx("li",{children:e.jsx("button",{type:"button",className:"text-brand-400 underline",onClick:()=>u==null?void 0:u(gs.DESKTOP_DOWNLOAD),children:"下载桌面智能体"})}),e.jsx("li",{children:"选择「绑定网站账号」→ 输入 API 地址与绑定码"}),e.jsx("li",{children:"绑定成功后,助手内调用生图/视频将扣除本账户积分"})]})]}),e.jsxs("div",{className:"bg-dark-800 border border-gray-700 rounded-xl p-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h4",{className:"font-bold text-white",children:"多角色 Profile(Gateway 端口)"}),e.jsx("button",{type:"button",onClick:()=>void tt(),className:"text-xs text-gray-400 hover:text-white",children:"刷新"})]}),Tt?e.jsxs("p",{className:"text-sm text-gray-500 flex items-center gap-2",children:[e.jsx(W,{className:"animate-spin",size:14})," 加载中…"]}):e.jsx("div",{className:"space-y-2",children:zt.map(t=>e.jsxs("div",{className:"p-3 bg-dark-900 rounded-lg border border-gray-800 text-sm",children:[e.jsx("span",{className:"text-white font-medium",children:t.name}),t.is_default&&e.jsx("span",{className:"ml-2 text-xs text-brand-400",children:"默认"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1 font-mono",children:["profile: ",t.profile_id," · API 端口 ",t.gateway_port]})]},t.id))})]}),e.jsxs("div",{className:"bg-dark-800 border border-gray-700 rounded-xl p-6",children:[e.jsx("h4",{className:"font-bold text-white mb-3",children:"桌面任务看板"}),qe.length===0?e.jsx("p",{className:"text-sm text-gray-500",children:"暂无任务(由 Hermes 创建批量编排后显示)"}):e.jsx("div",{className:"space-y-2",children:qe.map(t=>e.jsxs("div",{className:"p-3 bg-dark-900 rounded-lg border border-gray-800 flex flex-wrap justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-white text-sm font-medium",children:t.title}),e.jsx("p",{className:"text-xs text-gray-500 font-mono",children:t.id})]}),e.jsx("span",{className:"text-xs px-2 py-1 rounded bg-dark-950 text-gray-300 border border-gray-700",children:t.status})]},t.id))})]})]}),ns=()=>x.getSessionToken()?e.jsxs("div",{className:"space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[e.jsxs("div",{className:"bg-gradient-to-br from-brand-900/40 to-dark-800 p-6 rounded-xl border border-brand-500/30",children:[e.jsxs("h3",{className:"text-lg font-bold text-white flex items-center gap-2 mb-3",children:[e.jsx(te,{size:20,className:"text-brand-400"}),"开放 API"]}),e.jsx("p",{className:"text-sm text-gray-300 mb-4",children:"通过 API 调用网站的生图、生视频能力,计费与网站完全一致。支持 OpenAI 兼容格式,可轻松集成到您的应用中。"}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsxs("a",{href:"/api-docs.html",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 px-4 py-2 bg-brand-600 hover:bg-brand-500 text-white text-sm font-bold rounded-lg transition-colors",children:[e.jsx(ot,{size:16}),"查看 API 文档"]}),e.jsx("button",{onClick:()=>_(!0),className:"inline-flex items-center gap-2 px-4 py-2 bg-dark-700 hover:bg-dark-600 border border-gray-600 text-white text-sm font-bold rounded-lg transition-colors",children:"创建 API Key"})]})]}),e.jsxs("div",{className:"bg-dark-800 border border-gray-700 rounded-xl p-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsxs("h4",{className:"font-bold text-white flex items-center gap-2",children:[e.jsx(yt,{size:18,className:"text-brand-400"}),"我的 API Key"]}),e.jsx("button",{type:"button",onClick:()=>void J(),className:"text-xs text-gray-400 hover:text-white flex items-center gap-1",children:"刷新"})]}),$t?e.jsxs("div",{className:"flex items-center gap-2 text-gray-400 text-sm py-8 justify-center",children:[e.jsx(W,{className:"animate-spin",size:16})," 加载中…"]}):Xe.length===0?e.jsxs("div",{className:"text-center py-10 text-gray-500",children:[e.jsx(te,{size:40,className:"mx-auto mb-3 opacity-30"}),e.jsx("p",{className:"mb-4",children:"暂无 API Key"}),e.jsx("button",{onClick:()=>_(!0),className:"px-4 py-2 bg-brand-600 hover:bg-brand-500 text-white text-sm font-bold rounded-lg",children:"创建第一个 API Key"})]}):e.jsx("div",{className:"space-y-3",children:Xe.map(s=>e.jsxs("div",{className:"p-4 bg-dark-900 rounded-lg border border-gray-800 flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("p",{className:"text-white font-medium truncate",children:s.name}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-brand-900/50 text-brand-300 border border-brand-500/30",children:s.scopes.join(", ")})]}),e.jsxs("p",{className:"text-xs text-gray-500 font-mono truncate",children:[s.keyPrefix,"…"]}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["速率限制: ",s.rateLimitPerMinute," 次/分",s.monthlyQuota>0&&` · 月度配额: ${s.usedThisMonth}/${s.monthlyQuota}`,s.lastUsedAt&&` · 最后使用: ${new Date(s.lastUsedAt).toLocaleDateString()}`]})]}),e.jsxs("button",{type:"button",onClick:()=>_t(s.id,s.name),className:"flex items-center gap-1.5 bg-red-900/30 hover:bg-red-900/50 border border-red-900/50 text-red-400 text-xs font-bold px-3 py-1.5 rounded-lg transition-colors shrink-0",children:[e.jsx(gt,{size:12}),"撤销"]})]},s.id))})]}),e.jsxs("div",{className:"bg-dark-800 border border-gray-700 rounded-xl p-6",children:[e.jsxs("h4",{className:"font-bold text-white mb-3 flex items-center gap-2",children:[e.jsx(xt,{size:18,className:"text-brand-400"}),"快速开始"]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{children:e.jsx("p",{className:"text-xs text-gray-500 mb-1",children:"1. 创建 API Key(上方按钮)"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-gray-500 mb-1",children:"2. 复制以下代码示例"}),e.jsx("div",{className:"bg-dark-950 border border-gray-800 rounded-lg p-3 text-xs font-mono text-gray-300 overflow-x-auto",children:e.jsx("pre",{children:`curl -X POST ${window.location.origin}/api/v1/images/generations \\
49  -H "Authorization: Bearer sk-aibot-xxxx" \\
50  -H "Content-Type: application/json" \\
51  -d '{
52    "prompt": "A cute cat",
53    "model": "gpt-image-2",
54    "size": "1024x1024"
55  }'`})})]}),e.jsx("div",{children:e.jsxs("p",{className:"text-xs text-gray-500 mb-1",children:["3. 查看完整文档:",e.jsx("a",{href:"/api-docs.html",target:"_blank",rel:"noopener noreferrer",className:"text-brand-400 underline ml-1",children:"API 文档"})]})})]})]}),Lt&&e.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50 p-4",onClick:()=>_(!1),children:e.jsxs("div",{className:"bg-dark-800 rounded-xl border border-gray-700 p-6 w-full max-w-md 
55shadow-xl",onClick:s=>s.stopPropagation(),children:[e.jsx("h4",{className:"text-lg font-bold text-white mb-4",children:"创建 API Key"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"Key 名称(便于识别)"}),e.jsx("input",{type:"text",value:de,onChange:s=>Je(s.target.value),className:"w-full bg-dark-900 border border-gray-600 rounded-lg px-3 py-2 text-white",placeholder:"例如:生产环境、测试应用"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-500 mb-2",children:"权限范围"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:k.includes("image"),onChange:s=>{s.target.checked?Q([...k.filter(r=>r!=="image"),"image"]):Q(k.filter(r=>r!=="image"))},className:"w-4 h-4 rounded border-gray-600 bg-dark-800 text-brand-600 focus:ring-brand-500"}),e.jsx("span",{className:"text-sm text-gray-300",children:"生图 API (GPT-Image-2, NANO2, NANO PRO)"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:k.includes("video"),onChange:s=>{s.target.checked?Q([...k.filter(r=>r!=="video"),"video"]):Q(k.filter(r=>r!=="video"))},className:"w-4 h-4 rounded border-gray-600 bg-dark-800 text-brand-600 focus:ring-brand-500"}),e.jsx("span",{className:"text-sm text-gray-300",children:"生视频 API (Seedance 2.0)"})]})]})]})]}),e.jsxs("div",{className:"flex gap-2 mt-6",children:[e.jsx("button",{onClick:()=>_(!1),className:"flex-1 py-2 rounded-lg border border-gray-600 text-gray-400 hover:bg-dark-700",children:"取消"}),e.jsx("button",{onClick:Ot,disabled:k.length===0,className:"flex-1 py-2 rounded-lg bg-brand-600 text-white font-bold hover:bg-brand-500 disabled:opacity-50 disabled:cursor-not-allowed",children:"创建"})]})]})}),X&&e.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50 p-4",onClick:()=>ie(null),children:e.jsxs("div",{className:"bg-dark-800 rounded-xl border border-gray-700 p-6 w-full max-w-lg shadow-xl",onClick:s=>s.stopPropagation(),children:[e.jsxs("h4",{className:"text-lg font-bold text-white mb-3 flex items-center gap-2",children:[e.jsx(pt,{size:20,className:"text-green-500"}),"API Key 创建成功"]}),e.jsxs("div",{className:"bg-red-900/20 border border-red-900/50 rounded-lg p-3 mb-4",children:[e.jsx("p",{className:"text-xs text-red-400 font-bold mb-1",children:"⚠️ 请立即复制保存"}),e.jsx("p",{className:"text-xs text-red-300",children:"此 Key 只显示一次,关闭后将无法再次查看。后端只存储哈希值,无法恢复明文。"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"API Key"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",readOnly:!0,value:X.key,className:"flex-1 bg-dark-950 border border-gray-700 rounded-lg px-3 py-2 text-white font-mono text-xs"}),e.jsxs("button",{onClick:()=>{navigator.clipboard.writeText(X.key),alert("已复制到剪贴板")},className:"px-4 py-2 bg-brand-600 hover:bg-brand-500 text-white text-sm font-bold rounded-lg flex items-center gap-1",children:[e.jsx(mt,{size:14}),"复制"]})]})]}),e.jsxs("div",{className:"mt-4 p-3 bg-dark-900 rounded-lg border border-gray-800",children:[e.jsx("p",{className:"text-xs text-gray-400 mb-1",children:"使用方法:"}),e.jsxs("code",{className:"text-xs font-mono text-gray-300 block",children:["Authorization: Bearer ",X.key.slice(0,20),"..."]})]}),e.jsx("button",{onClick:()=>ie(null),className:"w-full mt-4 py-2 rounded-lg bg-dark-700 hover:bg-dark-600 border border-gray-600 text-white font-bold",children:"我已保存,关闭"})]})})]}):e.jsx("div",{className:"space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-500",children:e.jsxs("div",{className:"bg-amber-900/20 border border-amber-500/30 p-6 rounded-xl",children:[e.jsxs("h3",{className:"text-lg font-bold text-amber-400 flex items-center gap-2 mb-3",children:[e.jsx(ct,{size:20}),"需要重新登录"]}),e.jsx("p",{className:"text-sm text-gray-300 mb-4",children:"开发者 API 需要 Web Session 认证。您当前是自动登录状态,请重新登录以获取安全凭证。"}),e.jsx("button",{onClick:()=>{x.logout()},className:"px-6 py-2 bg-brand-600 hover:bg-brand-500 text-white font-bold rounded-lg",children:"退出并重新登录"})]})}),ls=[{id:"dashboard",label:"我的账户",icon:ks},{id:"developer",label:"开发者 API",icon:te},{id:"desktop",label:"桌面智能体",icon:he},{id:"pricing",label:"价格方案",icon:ge},{id:"recharge",label:"充值中心",icon:ue},{id:"invite",label:"邀请返利",icon:ut},...a&&!a.parentId?[{id:"sub-accounts",label:"子账户",icon:ee}]:[],...a&&["market","admin"].includes(a.role)?[{id:"market",label:"市场统计",icon:ge}]:[],{id:"history",label:"账单流水",icon:ys},{id:"help",label:"帮助中心",icon:ht},{id:"blog",label:"Blog 干货",icon:ot}];return e.jsx("div",{className:"max-w-6xl mx-auto pb-20",children:e.jsxs("div",{className:"flex flex-col lg:flex-row gap-8",children:[e.jsx("div",{className:"w-full lg:w-64 shrink-0",children:e.jsx("div",{className:"bg-dark-800 rounded-xl border border-gray-700 p-4 space-y-2 sticky top-4",children:ls.map(t=>e.jsxs("button",{onClick:()=>m(t.id),className:`w-full flex items-center gap-3 px-4 py-3 rounded-lg transition-colors font-medium text-sm ${d===t.id?"bg-brand-600 text-white shadow-lg":"text-gray-400 hover:bg-dark-700 hover:text-white"}`,children:[e.jsx(t.icon,{size:18}),t.label]},t.id))})}),e.jsxs("div",{className:"flex-1 min-h-[600px]",children:[d==="dashboard"&&Xt(),d==="pricing"&&e.jsx("div",{className:"animate-in fade-in slide-in-from-bottom-4 duration-500",children:e.jsx(os,{onBuy:()=>m("recharge")}
55)}),d==="recharge"&&Zt(),d==="history"&&Jt(),d==="invite"&&es(),d==="sub-accounts"&&ss(),d==="market"&&as(),d==="help"&&ts(),d==="desktop"&&rs(),d==="developer"&&ns(),d==="blog"&&e.jsx("div",{className:"animate-in fade-in slide-in-from-bottom-4 duration-500",children:e.jsx(us,{onNavigate:u})})]})]})})};export{ra as UserCenter};

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.