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.