1import{r as a,j as e}from"./react-vendor-CNvx0oQm.js";import{A as ur,m as k,d as gr,b2 as it,b3 as Os,b4 as ta,b5 as K,b6 as wr,b7 as fr,b8 as jr,N as vr,b9 as Nr,ba as ae,bb as yr,bc as Vs,g as Lt,bd as zs,be as Cr,bf as kr,bg as Sr,bh as _r,bi as Ir,bj as Ar,bk as $r,bl as Lr,bm as Dr,bn as Pr,bo as Mr,bp as nt,bq as Tr,br as Er,bs as Fr,bt as Ur,bu as re,bv as Rr,bw as Kr,bx as Br}from"./index-BQf_T_Zv.js";import{r as Hs}from"./promptAssistRecord-BgDg6xDI.js";import{l as Gr,b as Or,r as Vr}from"./testerApplication-DKUTJ9v_.js";import B from"./icons-x-CRa6bIIW.js";import{b as Js}from"./icons-l-CH7lX_W_.js";import{c as zr,I as qs}from"./icons-i-QaBHOwu2.js";import{f as xt,t as Hr,b as Jr,d as qr,w as sa,m as Qr,k as ge,v as Xr,x as ot,e as Wr}from"./icons-c-fsvgkOz3.js";import{g as Yr,a as Zr,h as el}from"./icons-f-DIXpr9ke.js";import{c as tl,s as sl,b as Ge}from"./icons-p-Dta2O8IR.js";import{d as dt,a as al,i as rl}from"./icons-b-CH3Xfanu.js";import{e as ll,i as Qs,g as Dt,o as Re}from"./icons-s-CRibo1eD.js";import{U as Xs}from"./icons-u-DT3ttqpi.js";import{j as Ws,k as il}from"./icons-t-CsRekfkF.js";import{b as Ke}from"./icons-z-BaTRSvaf.js";import{R as nl,b as Ys}from"./icons-r-FrRD_B32.js";import{o as Pt,k as ct}from"./icons-a-BkSjOGTI.js";import{D as ol,b as Mt}from"./icons-d-DAr8vZwR.js";import{G as Zs}from"./icons-g-BJpaIHqr.js";import{a as Tt}from"./icons-e-dngfxdnk.js";import{n as dl}from"./icons-m-drNSL4rT.js";import"./lucide-core-CmglOHoc.js";import"./icons-h-BeLly2Mf.js";import"./icons-q-Dw42O6Rm.js";import"./icons-k-DVmbnQnX.js";const cl=[{key:"pending",label:"å¾
审æ¹"},{key:"approved",label:"å·²éè¿"},{key:"rejected",label:"å·²æç»"},{key:"all",label:"å
¨é¨"}];function ea(x){return x?new Date(x*1e3).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"â"}function xl({open:x,onClose:w}){const[L,G]=a.useState("pending"),[F,f]=a.useState([]),[A,D]=a.use
1State(!1),[P,M]=a.useState(null),[S,O]=a.useState(""),T=a.useCallback(async()=>{D(!0),O("");try{const m=await Gr(L,1,100);f(m.data)}catch(m){O(m?.message||"å 载失败")}finally{D(!1)}},[L]);a.useEffect(()=>{x&&T()},[x,T]);const R=async m=>{M(m.id);try{await Or(m.id),await T()}catch(V){O(V?.message||"æä½å¤±è´¥")}finally{M(null)}},W=async m=>{M(m.id);try{await Vr(m.id),await T()}catch(V){O(V?.message||"æä½å¤±è´¥")}finally{M(null)}};return e.jsx(ur,{children:x&&e.jsx(k.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/80 backdrop-blur-sm z-50 flex items-center justify-center p-2 md:p-6",onClick:w,children:e.jsxs(k.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},onClick:m=>m.stopPropagation(),className:"bg-gray-900 border border-white/20 rounded-2xl max-w-4xl w-full max-h-[90vh] md:max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"p-6 border-b border-white/10 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"å
æµç³è¯·å®¡æ¹"}),e.jsx("p",{className:"text-xs text-white/50 mt-1",children:"éè¿åç¨æ·è§è²å级为 testerï¼å¯å¨ Lab å建ä½å"})]}),e.jsx("button",{onClick:w,className:"text-white/60 hover:text-white",children:e.jsx(B,{className:"w-6 h-6"})})]}),e.jsx("div",{className:"px-6 pt-4 pb-2 border-b border-white/10 flex items-center gap-1.5",children:cl.map(m=>e.jsx("button",{onClick:()=>G(m.key),className:`px-3 py-1.5 rounded-lg text-sm transition-colors ${L===m.key?"bg-orange-500/20 text-orange-300 border border-orange-500/30":"text-white/60 hover:text-white border border-transparent hover:bg-white/5"}`,children:m.label},m.key))}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[S&&e.jsx("p",{className:"text-red-400 text-sm mb-3",children:S}),A?e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx(Js,{className:"w-6 h-6 animate-spin text-orange-400"})}):F.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-white/40",children:[e.jsx(zr,{className:"w-12 h-12 mb-3 opacity-40"}),e.jsx("p",{className:"text-sm",children:L==="pending"?"å½å没æå¾
审æ¹çç³è¯·":"ææ è®°å½"})]}):e.jsx("div",{className:"space-y-2",children:F.map(m=>e.jsxs("div",{className:"bg-white/[0.04] border border-white/10 rounded-xl p-4 flex items-start gap-4",children:[e.jsx("div",{className:"shrink-0",children:m.avatar_url?e.jsx("img",{src:m.avatar_url,alt:"",className:"w-10 h-10 rounded-full object-cover"}):e.jsx("div",{className:"w-10 h-10 rounded-full bg-gradient-to-br from-orange-500/30 to-amber-500/30 flex items-center justify-center text-sm font-medium text-white/80",children:(m.nickname||m.email).slice(0,1).toUpperCase()})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2 mb-0.5",children:[e.jsx("span",{className:"text-sm font-medium text-white truncate",children:m.nickname||"(æªè®¾ç½®æµç§°)"}),e.jsx("span",{className:"text-xs text-white/40 truncate",children:m.email})]}),e.jsxs("p",{className:"text-xs text-white/50 mb-2",children:["ç³è¯·äº ",ea(m.applied_at),m.reviewed_at&&m.status!=="pending"&&e.jsxs(e.Fragment,{children:[" · ",m.status==="approved"?"å·²éè¿":"å·²æç»"," ",ea(m.reviewed_at)]})]}),e.jsx("p",{className:"text-sm text-white/70 leading-relaxed whitespace-pre-wrap break-words",children:m.reason||e.jsx("span",{className:"text-white/30 italic",children:"ï¼ç¨æ·æ²¡æå¡«åçç±ï¼"})})]}),e.jsx("div",{className:"shrink-0 flex items-center gap-1.5",children:m.status==="pending"?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>R(m),disabled:P===m.id,className:"flex items-center gap-1 px-3 py-1.5 rounded-lg bg-emerald-500/20 hover:bg-emerald-500/30 text-emerald-300 text-xs font-medium border border-emerald-500/30 disabled:opacity-50 transition-colors",children:[P===m.id?e.jsx(Js,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(xt,{className:"w-3.5 h-3.5"}),"éè¿"]}),e.jsxs("button",{onClick:()=>W(m),disabled:P===m.id,className:"flex items-center gap-1 px-3 py-1.5 rounded-lg bg-white/5 hover:bg-red-500/20 text-white/60 hover:text-red-300 text-xs font-medium border border-white/10 hover:border-red-500/30 disabled:opacity-50 transition-colors",children:[e.jsx(Hr,{className:"w-3.5 h-3.5"}),"æç»"]})]}):m.status==="approved"?e.jsxs("span",{className:"flex items-center gap-1 text-xs text-emerald-400",children:[e.jsx(Jr,{className:"w-3.5 h-3.5"})," å·²éè¿"]}):e.jsxs("span",{className:"flex items-center gap-1 text-xs text-white/40",children:[e.jsx(qr,{className:"w-3.5 h-3.5"})," å·²æç»"]})})]},m.id))})]})]})})})}function Rl({user:x,loading:w,onLoginClick:L,onLogout:G,onRedeemClick:F}){const f=gr(),A=()=>window.matchMedia("(min-width: 768px)").matches,[D,P]=a.useState(null),[M,S]=a.useState(!0),[O,T]=a.useState(null),[R,W]=a.useState(10),[m,V]=a.useState(100),[E,le]=a.useState("GIFT"),[Y,we]=a.useState(0),[q,j]=a.useState(0),[y,o]=a.use
1State(0),[n,b]=a.useState([]),[u,N]=a.useState(!1),[v,ie]=a.useState("all"),[Z,ht]=a.useState(""),[fe,mt]=a.useState(""),[ne,bt]=a.useState(100),[oe,Oe]=a.useState(""),[_e,l]=a.useState(!1),[d,de]=a.useState(""),[$,ce]=a.useState(""),[Ve,aa]=a.useState(!1),[ze,Et]=a.useState([]),[xe,pt]=a.useState("ALL"),[He,Ft]=a.useState(!1),[Ut,ra]=a.useState(null),[la,Rt]=a.useState(0),[Kt,ia]=a.useState(!1),[Bt,Gt]=a.useState(!1),[he,Je]=a.useState(""),[Ot,na]=a.useState(0),[je,oa]=a.useState(""),[Ie,Vt]=a.useState(0),[Ae,zt]=a.useState(0),[ve,Ht]=a.useState(""),[Jt,qt]=a.useState(!1),[qe,da]=a.useState(1),[$e,ca]=a.useState(400),[Le,xa]=a.useState(10),[Qe,ha]=a.useState([]),[Qt,Xt]=a.useState(!1),[ma,Wt]=a.useState(null),[ba,Yt]=a.useState(!1),[pa,me]=a.useState(!1),[ua,Zt]=a.useState(!1),[es,ga]=a.useState([]),[Ne,ut]=a.useState([]),[ts,wa]=a.useState("ALL"),[ee,fa]=a.useState(""),[De,ja]=a.useState(""),[p,ss]=a.useState(null),[va,as]=a.useState(!1),[Na,be]=a.useState(!1),[g,ya]=a.useState(null),[Ca,rs]=a.useState(!1),[ka,Xe]=a.useState(!1),[gt,Sa]=a.useState(0),[ls,is]=a.useState(0),[wt,_a]=a.useState(!0),[We,ns]=a.useState(!1),[U,Ia]=a.useState(""),[Ye,ye]=a.useState(!1),[Aa,os]=a.use
1State(!1),[ds,$a]=a.useState([]),[Pe,cs]=a.useState(null),[xs,La]=a.useState("ALL"),[pe,hs]=a.useState(!0),[ms,bs]=a.useState("Googleæå¡ææ¡¶è·è·¯ï¼ç¨å忥ççå§"),[ps,us]=a.useState(!1),[ft,Da]=a.useState("aistudio"),[gs,ws]=a.useState(!1),[Ce,te]=a.useState([]),[fs,Pa]=a.useState("Vivart 宿¹"),[Me,js]=a.useState(""),[vs,Ns]=a.useState(!1),[_,Ma]=a.useState("all"),[Te,Ta]=a.useState(""),[Ze,Ea]=a.useState(""),[et,Fa]=a.useState([]),[se,Ua]=a.useState(null),[Ra,ys]=a.useState(!1),[Cs,Ka]=a.useState([]),[ks,Ba]=a.useState("all"),[jt,Ss]=a.useState(!1),[Ga,_s]=a.useState(null),[Q,Oa]=a.useState(null),[Is,Va]=a.useState([]),[z,za]=a.useState(null),[Ha,vt]=a.useState(!1),[tt,As]=a.useState(""),[st,$s]=a.useState(""),[Ls,Ds]=a.useState(!1),[Ee,H]=a.useState([]),[Ps,ke]=a.useState([]),[Ja,at]=a.useState(!1),[ue,qa]=a.useState("aistudio"),[rt,Nt]=a.useState(""),[yt,Ct]=a.useState(""),[kt,St]=a.useState(""),[_t,It]=a.useState(""),[Ms,Ts]=a.useState(!1),[Es,Fs]=a.useState(null);a.useEffect(()=>{if(console.log("[AdminDashboard] æéæ£æ¥ - authLoading:",w,"user:",x),w){console.log("[AdminDashboard] æ£å¨å è½½ç¨æ·ä¿¡æ¯ï¼çå¾ ...");return}if(!x){console.log("[AdminDashboard] ç¨æ·æªç»å½ï¼éå®åå°é¦é¡µ"),f("/",{replace:!0});return}if(console.log("[AdminDashboard] ç¨æ·è§è²:",x.role),x.role!=="admin"){console.log("[AdminDashboard] ç¨æ·ä¸æ¯ç®¡çåï¼è§è²ä¸º:",x.role),alert("âï¸ éè¦ç®¡çåæéï¼å½åè§è²ï¼"+x.role),f("/",{replace:!0});return}console.log("[AdminDashboard] æééªè¯éè¿ï¼å¼å§å è½½æ°æ®"),Qa(),Xa(),At();const s=new URLSearchParams(window.location.search).get("ledgerUser");s&&(Je(s),pt("ALL"),X("ALL",!1,s),window.history.replaceState({},"",window.location.pathname),setTimeout(()=>{document.getElementById("ledger-section")?.scrollIntoView({behavior:"smooth"})},500))},[x,w,f]);const Qa=async()=>{if(x)try{S(!0);const t=localStorage.getItem("jwt_token")||"",s=await it(t);P(s.data);try{const r=await Os(t,"ALL",1,0);cs(r.stats||null)}catch(r){console.error("Failed to load invite codes stats:",r)}}catch(t){console.error("Failed to load stats:",t),alert("å è½½ç»è®¡æ°æ®å¤±è´¥ï¼"+t.message)}finally{S(!1)}},Xa=async()=>{try{const t=localStorage.getItem("jwt_token")||"",s=await ta(t);if(s.settings?.generate_enabled&&hs(s.settings.generate_enabled.value!=="false"),s.settings?.generate_disabled_message&&bs(s.settings.generate_disabled_message.value||"Googleæå¡ææ¡¶è·è·¯ï¼ç¨å忥ççå§"),s.settings?.api_provider){const r=s.settings.api_provider.value;(r==="aistudio"||r==="vertex"||r==="vertex-iam")&&Da(r)}s.modelSettings&&Array.isArray(s.modelSettings)&&te(s.modelSettings);try{const r=await K(t);H(r.routes),ke(r.credentials)}catch{console.log("No API credentials configured or endpoint not available")}}catch(t){console.error("Failed to load system settings:",t)}},Wa=async()=>{try{us(!0);const t=localStorage.getItem("jwt_token")||"";await zs(t,{generate_enabled:pe,generate_disabled_message:ms}),alert("â 设置已ä¿å")}catch(t){alert("ä¿å失败ï¼"+t.message)}finally{us(!1)}},Ya=async()=>{try{ws(!0);const t=localStorage.getItem("jwt_token")||"";await zs(t,{api_provider:ft,model_settings:Ce.map(s=>({id:s.id,enabled:s.enabled,pointsCost:s.pointsCost,accessLevel:s.accessLevel,extraConfig:s.extraConfig}))}),alert("â 设置已ä¿å")}catch(t){alert("ä¿å失败ï¼"+t.message)}finally{ws(!1)}},Za=async()=>{if(!Me.trim()){alert("请è¾å ¥æ¶æ¯å 容");return}if(_==="specific"&&!Te.trim()){alert("请è¾å ¥ç®æ ç¨æ·é®ç®±");return}if(_==="registered_after"&&!Ze){alert("è¯·éæ©æ³¨åæ¥æ");return}if(_==="airdrop_batch"&&!se){alert("è¯·éæ©ç©ºææ¹æ¬¡");return}let t="";if(_==="all")t="å ¨ä½ç¨æ·";else if(_==="specific")t=Te;else if(_==="registered_after")t=`${Ze} åæ³¨åçç¨æ·`;else if(_==="airdrop_batch"){const s=et.find(r=>r.created_at===se.created_at&&r.reference===se.reference);t=`ç©ºææ¹æ¬¡ã${se.reference}ãç ${s?.user_count||"?"} ä½ç¨æ·`}if(confirm(`确认åé广æç» ${t}ï¼ 2 3å 容ï¼${Me.slice(0,100)}`))try{Ns(!0);const s=localStorage.getItem("jwt_token")||"",r=await Cr(s,fs,Me,_,_==="specific"?Te.trim():void 0,_==="registered_after"?Ze:void 0,_==="airdrop_batch"?se.created_at:void 0,_==="airdrop_batch"?se.reference:void 0);alert(`â ${r.message}`),js("")}catch(s){alert("åé失败ï¼"+s.message)}finally{Ns(!1)}},At=async(t="all")=>{try{Ss(!0);const s=localStorage.getItem("jwt_token")||"",r=await wr(s,{limit:100,filter:t});
3Ka(r.logs),Oa(r.recentStats),Va(r.stats),za(r.orphans??null)}catch(s){console.error("Failed to load generation logs:",s)}finally{Ss(!1)}},er=async()=>{try{const t=localStorage.getItem("jwt_token")||"";await kr(t)}catch(t){alert("导åºå¤±è´¥ï¼"+t.message)}},tr=async()=>{if(x){if(R<1||R>1e3){alert("çææ°éå¿ é¡»å¨ 1-1000 ä¹é´");return}if(E==="PAID"){if(q<=0){alert("æ¬é积åå¿ é¡»å¤§äº 0");return}if(Y<=0){alert("ä»·æ ¼(CNY)å¿ é¡»å¤§äº 0");return}}else if(m<1||m>1e5){alert("ç§¯åæ°éå¿ é¡»å¨ 1-100000 ä¹é´");return}try{N(!0);const t=localStorage.getItem("jwt_token")||"",r=await Sr(t,E==="PAID"?{count:R,type:"PAID",base_points:q,bonus_points:y,price_cny:Y}:{count:R,type:"GIFT",points:m});b(r.coupons),alert(`â æåçæ ${r.coupons.length} 个${E==="PAID"?"ä»è´¹":"ç¦å©"}å¡å¯`);try{const i=localStorage.getItem("jwt_token")||"",c=await it(i);P(c.data)}catch(i){console.error("Failed to silently refresh stats:",i)}}catch(t){console.error("Failed to generate coupons:",t),alert("çæå¡å¯å¤±è´¥ï¼"+t.message)}finally{N(!1)}}},sr=async()=>{if(!x)return;if(ne<1||ne>1e5){alert("ç§¯åæ°éå¿ é¡»å¨ 1-100000 ä¹é´");return}if(!oe.trim()){alert("请填å空æåå ");return}if(v==="specific"&&!Z.trim()){alert("请è¾å ¥ç®æ ç¨æ·é®ç®±");return}if(v==="registered_after"&&!fe){alert("è¯·éæ©æ³¨åæ¥æ");return}if(v==="by_condition"&&!(d!=="")&&!($!=="")&&!Ve){alert("请è³å°è®¾ç½®ä¸ä¸ªç鿡件ï¼ä½é¢èå´ææ å å¼åå²ï¼");return}let t="";if(v==="all")t="å ¨ä½ç¨æ·";else if(v==="specific")t=`ç¨æ· ${Z}`;else if(v==="registered_after")t=`${fe} åæ³¨åçç¨æ·`;else if(v==="by_condition"){const s=[];if(d!==""||$!==""){const r=d!==""?d:"ä¸é",i=$!==""?$:"ä¸é";s.push(`ä½é¢ ${r}~${i}`)}Ve&&s.push("仿ªè·å¾è¿ç§¯å"),t=`æ¡ä»¶çéï¼${s.join("ï¼")}ï¼çç¨æ·`}if(confirm(`确认å ${t} 空æ ${ne} 积åï¼ 4åå : ${oe}`))try{l(!0);const s=localStorage.getItem("jwt_token")||"",r=await _r(s,{target:v,email:v==="specific"?Z.trim():void 0,registeredAfter:v==="registered_after"?fe:void 0,balanceMin:v==="by_condition"&&d!==""?parseInt(d):void 0,balanceMax:v==="by_condition"&&$!==""?parseInt($):void 0,neverReceivedPoints:v==="by_condition"?Ve:void 0,points:ne,reason:oe.trim()});alert(`â ${r.message}`),Oe(""),X(xe);try{const i=await it(s);P(i.data)}catch{}}catch(s){alert("空æå¤±è´¥ï¼"+s.message)}finally{l(!1)}},ar=async()=>{if(!x)return;if(!je.trim()){alert("请è¾å ¥ç¨æ·é®ç®±");return}if(!ve.trim()){alert("请填å鿬¾åå ");return}if(Ae<0){alert("鿬¾éé¢ä¸è½ä¸ºè´æ°");return}if(Ie<0){alert("éè¿ç§¯åä¸è½ä¸ºè´æ°");return}const t=Ie>0?`ç¡®è®¤ä» ${je} æ£å ${Ie} 积åï¼è®°å½é款 Â¥${Ae}ï¼ 5åå : ${ve}`:`确认记å½é款 Â¥${Ae} ç» ${je}ï¼ä» è®°è´¦ï¼ä¸æ£å积åï¼ï¼ 6åå : ${ve}`;if(confirm(t))try{qt(!0);const s=localStorage.getItem("jwt_token")||"",r=await Ir(s,{email:je.trim(),points:Ie,amountCny:Ae,reason:ve.trim()});alert(`â ${r.message}`),Ht(""),Vt(0),zt(0),X(xe);try{const i=await it(s);P(i.data)}catch{}}catch(s){alert("鿬¾å¤±è´¥ï¼"+s.message)}finally{qt(!1)}},X=async(t="ALL",s=!1,r=he)=>{try{s?Gt(!0):(Ft(!0),Rt(0));const i=localStorage.getItem("jwt_token")||"",c=s?la:0,h=await fr(i,t,50,c,r),C=h.data||[];Et(s?I=>[...I,...C]:C),ra(h.stats||null),ia(h.pagination?.hasMore||!1),na(h.pagination?.total||0),Rt(c+C.length)}catch(i){console.error("Failed to load ledger:",i)}finally{Ft(!1),Gt(!1)}},rr=t=>{if(Bt||!Kt)return;const{scrollTop:s,scrollHeight:r,clientHeight:i}=t.currentTarget;r-s-i<100&&X(xe,!0,he)},lr=()=>{Je(""),X(xe,!1,"")},ir=(t,s)=>{navigator.clipboard.writeText(t),T(s),setTimeout(()=>T(null),2e3)},nr=()=>{const t=n.map(s=>s.code).join(` 7`);navigator.clipboard.writeText(t),alert("â å·²å¤å¶ææå¡å¯å°åªè´´æ¿")},or=async()=>{if(x){if(qe<1||qe>100){alert("çææ°éå¿ é¡»å¨ 1-100 ä¹é´");return}if($e<1||$e>1e5){alert("积åé¢é¢å¿ é¡»å¨ 1-100000 ä¹é´");return}if(Le<1||Le>1e4){alert("å¯ç¨æ¬¡æ°å¿ é¡»å¨ 1-10000 ä¹é´");return}try{Xt(!0);const t=localStorage.getItem("jwt_token")||"",s=await Ar(t,qe,$e,Le);ha(s.codes),alert(`â æåçæ ${s.codes.length} 个é请ç `)}catch(t){console.error("Failed to generate invitation codes:",t),alert("çæé请ç 失败ï¼"+t.message)}finally{Xt(!1)}}},dr=(t,s)=>{navigator.clipboard.writeText(t),Wt(s),setTimeout(()=>Wt(null),2e3)},cr=()=>{const t=Qe.join(` 8`);navigator.clipboard.writeText(t),alert("â å·²å¤å¶ææé请ç å°åªè´´æ¿")},Us=async(t="ALL")=>{try{ye(!0);const s=localStorage.getItem("jwt_token")||"";if(console.log("[AdminDashboard] Loading coupons list, filter:",t,"token exists:",!!s),!s)throw new Error("请å ç»å½");const r=await $r(s,t,100,0);console.log("[AdminDashboard] Coupons loaded:",r),ga(r.data||[])}catch(s){console.error("[AdminDashboard] Failed to load coupons:",s),alert("å è½½å¡å¯å表失败ï¼"+s.message)}finally{ye(!1)}},Se=async(t="",s=!1,r=U,i)=>{const h=i!==void 0?i:De;try{s?ns(!0):(ye(!0),is(0),ut([]));const C=localStorage.getItem("jwt_token")||"";if(!C)throw new Error("请å ç»å½");const I=s?ls:0,J=await Lr(C,30,I,t,r,h);console.log("[AdminDashboard] Users loaded:",J);const lt=J.data||[],Gs=J.pagination?.total||0;ut(s?pr=>[...pr,...lt]:lt),Sa(Gs),is(I+lt.length),_a(I+lt.length<Gs)}catch(C){console.error("[AdminDashboard] Failed to load users:",C),alert("å è½½ç¨æ·å表失败ï¼"+C.message)}finally{ye(!1),ns(!1)}},Fe=async t=>{try{as(!0),be(!0);const s=localStorage.getItem("jwt_token")||"",r=await Dr(s,t);ss(r.data)}catch(s){console.error("Failed to load user detail:",s),be(!1)}finally{as(!1)}},Rs=async(t,s)=>{if(p){if(!s){const r=t==="can_publish"?`ç¡®å®éå¶ã${p.nickname}ãå ¬å¼ä½ååï¼ 9å°ç«å³ä¸æ¶å ¶å䏿æå·²å ¬å¼ä½åï¼ä¸å ¶æ æ³åå ¬å¼ã`:`ç¡®å®éå¶ã${p.nickname}ãå享ä½ååï¼
10å°åéå
¶å䏿æç§å¯åäº«é¾æ¥ï¼ä¸å
¶æ æ³åçæåäº«é¾æ¥ã`;if(!confirm(r))return}try{const r=localStorage.getItem("jwt_token")||"",i=await fetch("/api/admin/users/permissions",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({userId:p.id,[t]:s})});if(!i.ok){const c=await i.json().catch(()=>null);throw new Error(c?.error||"æä½å¤±è´¥")}ss(c=>c&&{...c,[t]:s?1:0})}catch(r){alert(r.message||"æä½å¤±è´¥")}}},$t=async t=>{try{rs(!0),Xe(!0);const s=localStorage.getItem("jwt_token")||"",r=await Pr(s,t);ya(r.data)}catch(s){console.error("Failed to load task detail:",s),Xe(!1)}finally{rs(!1)}},Ks=a.useCallback(t=>{const s=t.currentTarget;if(We||!wt)return;(s.scrollTop+s.clientHeight)/s.scrollHeight>.8&&Se(ee,!0,U)},[We,wt,ee,ls,U,De]),Ue=t=>{const s=U===t?"":t;Ia(s),Se(ee,!1,s)},xr=t=>{const s=De===t?"":t;ja(s),Se(ee,!1,U,s)},hr=()=>{Yt(!0),Us(ts)},mr=()=>{me(!0),Se(ee,!1,"")},Bs=async(t="ALL")=>{try{ye(!0);const s=localStorage.getItem("jwt_token")||"";if(!s)throw new Error("请å
ç»å½");const r=await Os(s,t,100,0);$a(r.data||[]),cs(r.stats||null)}catch(s){console.error("[AdminDashboard] Failed to load invitation codes:",s),alert("å è½½é请ç å表失败ï¼"+s.message)}finally{ye(!1)}},br=()=>{os(!0),Bs(xs)};return M?e.jsx(jr,{}):e.jsxs("div",{className:"min-h-screen bg-black text-white",children:[e.jsx(vr,{user:x,onLoginClick:L,onLogout:G,onRedeemClick:F}),e.jsxs("div",{className:"w-full max-w-[1400px] mx-auto px-1 md:px-6 py-20",children:[e.jsxs(k.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},className:"mb-12",children:[e.jsx("h1",{className:"text-5xl font-bold mb-4 bg-gradient-to-r from-accent via-orange-400 to-yellow-400 bg-clip-text text-transparent",children:"管çåå°"}),e.jsx("p",{className:"text-white/60 text-lg",children:"è¿è¥ä¸å° · Admin Dashboard"}),e.jsxs("div",{className:"mt-6 flex flex-wrap gap-3",children:[e.jsxs("button",{onClick:()=>f("/admin/assets"),className:"flex items-center gap-2 px-4 py-2.5 bg-gradient-to-r from-white/[0.08] to-white/[0.04] hover:from-white/[0.12] hover:to-white/[0.08] border border-white/10 hover:border-white/25 rounded-xl transition-all duration-300 hover:shadow-[0_0_20px_rgba(34,197,94,0.15)] group",children:[e.jsx(Yr,{className:"w-4 h-4 text-green-400 group-hover:text-green-300"}),e.jsx("span",{className:"text-sm font-medium",children:"èµæºç®¡ç"})]}),e.jsxs("button",{onClick:()=>f("/admin/generations"),className:"flex items-center gap-2 px-4 py-2.5 bg-gradient-to-r from-white/[0.08] to-white/[0.04] hover:from-white/[0.12] hover:to-white/[0.08] border border-white/10 hover:border-white/25 rounded-xl transition-all duration-300 hover:shadow-[0_0_20px_rgba(168,85,247,0.15)] group",children:[e.jsx(qs,{className:"w-4 h-4 text-purple-400 group-hover:text-purple-300"}),e.jsx("span",{className:"text-sm font-medium",children:"ä½å管ç"})]}),e.jsxs("button",{onClick:()=>f("/admin/poster-generator"),className:"flex items-center gap-2 px-4 py-2.5 bg-gradient-to-r from-white/[0.08] to-white/[0.04] hover:from-white/[0.12] hover:to-white/[0.08] border border-white/10 hover:border-white/25 rounded-xl transition-all duration-300 hover:shadow-[0_0_20px_rgba(59,130,246,0.15)] group",children:[e.jsx(tl,{className:"w-4 h-4 text-blue-400 group-hover:text-blue-300"}),e.jsx("span",{className:"text-sm font-medium",children:"æµ·æ¥çæ"})]}),e.jsxs("button",{onClick:()=>f("/admin/lab-content"),className:"flex items-center gap-2 px-4 py-2.5 bg-gradient-to-r from-white/[0.08] to-white/[0.04] hover:from-white/[0.12] hover:to-white/[0.08] border border-white/10 hover:border-white/25 rounded-xl transition-all duration-300 hover:shadow-[0_0_20px_rgba(245,158,11,0.15)] group",children:[e.jsx(dt,{className:"w-4 h-4 text-amber-400 group-hover:text-amber-300"}),e.jsx("span",{className:"text-sm font-medium",children:"æ¼ç¤ºç®¡ç"})]}),e.jsxs("button",{onClick:()=>Zt(!0),className:"flex items-center gap-2 px-4 py-2.5 bg-gradient-to-r from-white/[0.08] to-white/[0.04] hover:from-white/[0.12] hover:to-white/[0.08] border border-white/10 hover:border-white/25 rounded-xl transition-all duration-300 hover:shadow-[0_0_20px_rgba(249,115,22,0.15)] group",children:[e.jsx(Zr,{className:"w-4 h-4 text-orange-400 group-hover:text-orange-300"}),e.jsx("span",{className:"text-sm font-medium",children:"å
æµç³è¯·"})]}),e.jsxs("button",{onClick:()=>f("/admin/prompts"),className:"flex items-center gap-2 px-4 py-2.5 bg-gradient-to-r from-white/[0.08] to-white/[0.04] hover:from-white/[0.12] hover:to-white/[0.08] border border-white/10 hover:border-white/25 rounded-xl transition-all duration-300 hover:shadow-[0_0_20px_rgba(6,182,212,0.15)] group",children:[e.jsx(ll,{className:"w-4 h-4 text-cyan-400 group-hover:text-cyan-300"}),e.jsx("span",{className:"text-sm font-medium",children:"æç¤ºè¯åº"})]}),e.jsxs("button",{onClick:()=>f("/admin/chat-models"),className:"flex items-center gap-2 px-4 py-2.5 bg-gradient-to-r from-white/[0.08] to-white/[0.04] hover:from-white/[0.12] hover:to-white/[0.08] border border-white/10 hover:border-white/25 rounded-xl transition-all duration-300 hover:shadow-[0_0_20px_rgba(99,102,241,0.15)] group",children:[e.jsx(sa,{className:"w-4 h-4 text-indigo-400 group-hover:text-indigo-300"}),e.jsx("span",{className:"text-sm font-medium",children:"模å管ç"})]}),e.jsxs("button",{onClick:()=>f("/admin/orgs"),className:"flex items-center gap-2 px-4 py-2.5 bg-gradient-to-r from-white/[0.08] to-white/[0.04] hover:from-white/[0.12] hover:to-white/[0.08] border border-white/10 hover:border-white/25 rounded-xl transition-all duration-300 hover:shadow-[0_0_20px_rgba(20,184,166,0.15)] group",children:[e.jsx(al,{className:"w-4 h-4 text-teal-400 group-hover:text-teal-300"}),e.jsx("span",{className:"text-sm font-medium",children:"æºæç®¡ç"})]})]})]}),e.jsxs("div",{className:"w-full grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 ga
10p-4 mb-12",children:[e.jsx(Be,{icon:Xs,label:"æ»ç¨æ·æ°",value:D?.totalUsers||0,color:"blue",delay:0,onClick:mr}),e.jsx(Be,{icon:Qr,label:"å·²åå积å",value:D?.totalPointsDistributed||0,color:"orange",delay:.1}),e.jsx(Be,{icon:Ws,label:"æªä½¿ç¨å¡å¯",value:D?.activeCoupons||0,color:"green",delay:.2,onClick:hr}),e.jsx(Be,{icon:Ke,label:"ææé请ç ",value:Pe?.activeCount||0,color:"yellow",delay:.25,onClick:br}),e.jsx(Be,{icon:il,label:"æè¿7天æ°ç¨æ·",value:D?.recentUsers||0,color:"blue",delay:.3})]}),e.jsxs(k.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.35},className:"w-full bg-gradient-to-br from-white/[0.08] to-white/[0.02] backdrop-blur-sm border border-white/10 rounded-2xl p-6 mb-6 hover:border-white/20 transition-colors",children:[e.jsxs("h2",{className:"text-xl font-bold mb-5 flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-red-500 to-orange-500 flex items-center justify-center shadow-lg",children:e.jsx(sl,{className:"w-5 h-5 text-white"})}),"ç³»ç»æ§å¶"]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-3 h-3 rounded-full ${pe?"bg-green-500 animate-pulse":"bg-red-500"}`}),e.jsx("span",{className:"font-medium",children:"çæåè½"}),e.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${pe?"bg-green-500/20 text-green-400":"bg-red-500/20 text-red-400"}`,children:pe?"å·²å¼å¯":"å·²å
³é"})]}),e.jsx("button",{onClick:()=>hs(!pe),className:`relative w-14 h-7 rounded-full transition-colors ${pe?"bg-green-500":"bg-gray-600"}`,children:e.jsx("div",{className:`absolute top-0.5 w-6 h-6 bg-white rounded-full transition-transform ${pe?"left-7":"left-0.5"}`})})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"å
³éæ¶çæç¤ºææ¡"}),e.jsx("input",{type:"text",value:ms,onChange:t=>
10bs(t.target.value),placeholder:"è¾å
¥ç¦ç¨æ¶çæç¤º...",className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-accent transition-colors"})]}),e.jsx("button",{onClick:Wa,disabled:ps,className:"w-full bg-gradient-to-r from-accent to-blue-600 hover:from-blue-600 hover:to-accent text-white font-medium px-4 py-2.5 rounded-lg transition-all duration-300 disabled:opacity-50 text-sm",children:ps?"ä¿åä¸...":"ä¿å设置"})]}),e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(nl,{className:"w-4 h-4 text-orange-400"}),e.jsx("span",{className:"font-medium",children:"广æç³»ç»æ¶æ¯"})]}),e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"åéç®æ "}),e.jsx("div",{className:"flex flex-wrap gap-2",children:[{id:"all",label:"å
¨ä½ç¨æ·",color:"orange"},{id:"specific",label:"æå®ç¨æ·",color:"blue"},{id:"registered_after",label:"æå®æ¥æå注å",color:"purple"},{id:"airdrop_batch",label:"æå®ç©ºææ¹æ¬¡",color:"emerald"}].map(({id:t,label:s,color:r})=>e.jsx("button",{onClick:async()=>{if(Ma(t),t==="airdrop_batch"&&et.length===0)try{ys(!0);const i=localStorage.getItem("jwt_token")||"",c=await Nr(i);Fa(c.batches||[])}catch(i){alert("å è½½ç©ºææ¹æ¬¡å¤±è´¥: "+i.message)}finally{ys(!1)}},className:`px-3 py-1.5 rounded-lg text-xs transition-all border ${_===t?`bg-${r}-500/20 border-${r}-500/40 text-${r}-400`:"bg-white/5 border-white/5 text-white/40 hover:text-white/60"}`,children:s},t))})]}),_==="specific"&&e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"ç®æ ç¨æ·é®ç®±"}),e.jsx("input",{type:"email",value:Te,onChange:t=>Ta(t.target.value),placeholder:"è¾å
¥ç¨æ·é®ç®±",className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-blue-400 transition-colors"})]}),_==="registered_after"&&e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"æ³¨åæ¥æä¹å"}),e.jsx("input",{type:"date",value:Ze,onChange:t=>Ea(t.target.value),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-purple-400 transition-colors"})]}),_==="airdrop_batch"&&e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"éæ©ç©ºææ¹æ¬¡"}),Ra?e.jsx("div",{className:"text-center py-4 text-white/40 text-sm",children:"å è½½ä¸..."}):et.length===0?e.jsx("div",{className:"text-center py-4 text-white/30 text-sm",children:"ææ ç©ºæè®°å½"}):e.jsx("div",{className:"max-h-48 overflow-y-auto space-y-1.5 bg-black/20 rounded-lg p-2",children:et.map((t,s)=>{const r=se?.created_at===t.created_at&&se?.reference===t.reference,i=new Date(t.created_at*1e3).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"});return e.jsxs("button",{onClick:()=>Ua({created_at:t.created_at,reference:t.reference}),className:`w-full text-left px-3 py-2.5 rounded-lg text-sm transition-all border ${r?"bg-emerald-500/20 border-emerald-500/40 text-emerald-300":"bg-white/5 border-white/5 text-white/60 hover:bg-white/10 hover:text-white/80"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium truncate",children:t.reference}),e.jsx("span",{className:"text-xs text-white/40 shrink-0 ml-2",children:i})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-1 text-xs text-white/40",children:[e.jsxs("span",{children:[t.user_count," ä½ç¨æ·"]}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:["æ¯äºº ",t.amount," 积å"]})]})]},s)})})]}),e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"åé人"}),e.jsx("input",{type:"text",value:fs,onChange:t=>Pa(t.target.value),placeholder:"Vivart 宿¹",className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-accent transition-colors"})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"æ¶æ¯å
容"}),e.jsx("textarea",{value:Me,onChange:t=>js(t.target.value),placeholder:"è¾å
¥è¦åéçæ¶æ¯...",rows:3,className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-accent transition-colors resize-none"})]}),e.jsxs("button",{onClick:Za,disabled:vs||!Me.trim(),className:"w-full bg-gradient-to-r from-orange-500 to-red-500 hover:from-red-500 hover:to-orange-500 text-white font-medium px-4 py-2.5 rounded-lg transition-all duration-300 disabled:opacity-50 flex items-center justify-center gap-2 text-sm",children:[e.jsx(Qs,{className:"w-4 h-4"}),vs?"åéä¸...":_==="all"?"åéç»å
¨ä½ç¨æ·":_==="specific"?`åéç» ${Te||"æå®ç¨æ·"}`:_==="airdrop_batch"?"åéç»ç©ºææ¹æ¬¡ç¨æ·":"åéç»æå®æ¥æå注åç¨æ·"]})]})]})]}),e.jsxs(k.div,{initial:{opacity:0,y:20}
10,animate:{opacity:1,y:0},transition:{delay:.37},className:"w-full bg-gradient-to-br from-white/[0.08] to-white/[0.02] backdrop-blur-sm border border-white/10 rounded-2xl p-6 mb-6 hover:border-white/20 transition-colors",children:[e.jsxs("h2",{className:"text-xl font-bold mb-5 flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-purple-500 to-indigo-500 flex items-center justify-center shadow-lg",children:e.jsx(Ke,{className:"w-5 h-5 text-white"})}),"AI éé设置"]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5",children:[e.jsx("label",{className:"block text-sm text-white/60 mb-3",children:"Gemini é»è®¤éé"}),e.jsx("div",{className:"space-y-2",children:[{id:"aistudio",name:"èå²å¼æ",desc:"AI Studio / API Key",color:"blue"},{id:"vertex",name:"æäºå¼æ",desc:"Vertex AI / Express API",color:"purple"},{id:"vertex-iam",name:"ç©éµå¼æ",desc:"Vertex IAM / Service Account",color:"green"}].map(t=>{const s=Ee.find(i=>i.route===t.id)?.is_default===1,r=Ee.find(i=>i.route===t.id)?.enabled;return e.jsxs("button",{onClick:async()=>{if(!r){alert("该路ç±å·²ç¦ç¨ï¼è¯·å
å¨ä¸æ¹å¯ç¨");return}const i=localStorage.getItem("jwt_token");if(!i)return;await ae(i,{route:t.id,setDefault:!0});const c=await K(i);H(c.routes)},disabled:!r,className:`w-full flex items-center gap-3 px-4 py-3 rounded-lg border transition-all ${s?`bg-${t.color}-500/20 border-${t.color}-500/50 text-${t.color}-400`:r?"bg-white/5 border-white/10 text-white/60 hover:bg-white/10":"bg-white/5 border-white/5 text-white/30 curs
10or-not-allowed"}`,children:[e.jsx("div",{className:`w-3 h-3 rounded-full ${s?`bg-${t.color}-500`:"bg-white/20"}`}),e.jsxs("div",{className:"text-left flex-1",children:[e.jsx("div",{className:"font-medium",children:t.name}),e.jsx("div",{className:"text-xs opacity-60",children:t.desc})]}),s&&e.jsx("span",{className:"text-xs px-2 py-0.5 bg-yellow-500/20 text-yellow-400 rounded",children:"é»è®¤"}),!r&&e.jsx("span",{className:"text-xs text-red-400",children:"å·²ç¦ç¨"})]},t.id)})}),e.jsx("p",{className:"mt-3 text-xs text-white/40",children:"ç¹å»éæ© Nano Banana Pro 模åçé»è®¤å端éé"})]}),e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-cyan-500/20 lg:col-span-2",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("label",{className:"block text-sm text-cyan-400",children:"ð Gemini æå¡å¨è·¯ç±ç®¡ç"}),e.jsxs("button",{onClick:()=>at(!0),className:"flex items-center gap-1 px-3 py-1.5 bg-cyan-500/20 text-cyan-400 rounded-lg hover:bg-cyan-500/30 transition-all text-sm",children:[e.jsx(Ge,{className:"w-4 h-4"}),"æ·»å åæ®"]})]}),e.jsx("div",{className:"grid grid-cols-3 gap-2 mb-4",children:Ee.map(t=>{const s=Ps.filter(c=>c.route===t.route).length,i={aistudio:"blue",vertex:"purple","vertex-iam":"green"}[t.route]||"gray";return e.jsxs("div",{className:`p-3 rounded-lg border ${t.enabled?`bg-${i}-500/10 border-${i}-500/30`:"bg-white/5 border-white/10 opacity-50"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:`font-medium text-sm ${t.enabled?`text-${i}-400`:"text-white/40"}`,children:t.display_name}),t.is_default===1&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-yellow-500/20 text-yellow-400 rounded",children:"é»è®¤"})]}),e.jsxs("div",{className:"text-xs text-white/50 mt-1",children:[s," ä¸ªåæ® | ",t.enabled?"å·²å¯ç¨":"å·²ç¦ç¨"]}),e.jsxs("div",{className:"flex items-center gap-1 mt-2",children:[e.jsxs("select",{value:t.visibility||"all",onChange:async c=>{const h=localStorage.getItem("jwt_token");if(!h)return;await ae(h,{route:t.route,visibility:c.target.value});const C=await K(h);H(C.routes)},className:"text-xs px-1.5 py-1 bg-white/5 border border-white/10 rounded text-white/70 cursor-pointer",children:[e.jsx("option",{value:"all",children:"ææäºº"}),e.jsx("option",{value:"paid",children:"ä»è´¹ç¨æ·"}),e.jsx("option",{value:"admin",children:"ä»
管çå"})]}),!t.is_default&&t.enabled&&e.jsx("button",{onClick:async()=>{const c=localStorage.getItem("jwt_token");if(!c)return;await ae(c,{route:t.route,setDefault:!0});const h=await K(c);H(h.routes)},className:"text-xs px-2 py-1 bg-yellow-500/20 text-yellow-400 rounded hover:bg-yellow-500/30",children:"设为é»è®¤"}),e.jsx("button",{onClick:async()=>{const c=localStorage.getItem("jwt_token");if(!c)return;await ae(c,{route:t.route,routeEnabled:!t.enabled});const h=await K(c);H(h.routes)},className:`text-xs px-2 py-1 rounded ${t.enabled?"bg-red-500/20 text-red-400 hover:bg-red-500/30":"bg-green-500/20 text-green-400 hover:bg-green-500/30"}`,children:t.enabled?"ç¦ç¨":"å¯ç¨"})]})]},t.route)})}),["aistudio","vertex","vertex-iam"].map(t=>{const s=Ps.filter(h=>h.route===t),r=Ee.find(h=>h.route===t);if(!r)return null;const c={aistudio:"blue",vertex:"purple","vertex-iam":"green"}[t];return e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:`text-xs text-${c}-400 mb-2 flex items-center gap-2`,children:[e.jsx("div",{className:`w-2 h-2 rounded-full bg-${c}-500`}),r.display_name," (",s.length,")"]}),s.length===0?e.jsx("div",{className:"text-xs text-white/30 pl-4",children:"ææ åæ®"}):e.jsx("div",{className:"space-y-1.5 pl-4",children:s.map((h,C)=>e.jsxs("div",{className:`flex items-center justify-between p-2 rounded-lg border text-sm ${h.enabled?C===0?`bg-${c}-500/10 border-${c}-500/30`:"bg-white/5 border-white/10":"bg-red-500/5 border-red-500/20 opacity-60"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${h.enabled?h.consecutiveFailures>0?"bg-yellow-500":C===0?`bg-${c}-500 animate-pulse`:"bg-white/30":"bg-red-500"}`}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-white",children:h.label}),C===0&&h.enabled&&e.jsx("span",{className:"text-xs ml-2 text-green-400",children:"[æ´»è·]"}),!h.enabled&&e.jsx("span",{className:"text-xs ml-2 text-red-400",children:"[çæ]"}),h.consecutiveFailures>0&&h.enabled&&e.jsxs("span",{className:"text-xs ml-2 text-yellow-400",children:["[失败:",h.consecutiveFailures,"]"]})]}),e.jsx("span",{className:"text-xs text-white/40",children:h.apiKeyMasked||h.clientEmailMasked||"-"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[C>0&&e.jsx("button",{onClick:async()=>{const I=localStorage.getItem("jwt_token");if(!I)return;await ae(I,{id:h.id,priority:-1});const J=await K(I);ke(J.credentials)},className:"text-xs px-2 py-1 bg-blue-500/20 text-blue-400 rounded hover:bg-blue-500/30",title:"置顶",children:"â"}),h.consecutiveFailures>0&&e.jsx("button",{onClick:async()=>{const I=localStorage.getItem("jwt_token");if(!I)return;await ae(I,{id:h.id,resetFailures:!0});const J=await K(I);ke(J.credentials)},className:"text-xs px-2 py-1 bg-yellow-500/20 text-yellow-400 rounded hover:bg-yellow-500/30",children:"éç½®"}),e.jsx("button",{onClick:async()=>
10{if(confirm(`ç¡®å®å é¤ "${h.label}" åï¼`)){Fs(h.id);try{const I=localStorage.getItem("jwt_token");if(!I)return;await yr(I,h.id);const J=await K(I);ke(J.credentials),H(J.routes)}catch(I){alert(I.message)}finally{Fs(null)}}},disabled:Es===h.id,className:"text-xs px-2 py-1 bg-red-500/20 text-red-400 rounded hover:bg-red-500/30 disabled:opacity-50",children:Es===h.id?"...":"Ã"})]})]},h.id))})]},t)}),e.jsxs("div",{className:"mt-4 pt-4 border-t border-white/10",children:[e.jsx("div",{className:"text-xs text-white/50 mb-3",children:"â¡ çæä¿æ¤è®¾ç½® (åè·¯ç±ç¬ç«çæ)"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:Ee.map(t=>{const r={aistudio:"blue",vertex:"purple","vertex-iam":"green"}[t.route]||"gray";return e.jsxs("div",{className:`p-3 rounded-lg bg-${r}-500/5 border border-${r}-500/20`,children:[e.jsx("div",{className:`text-xs text-${r}-400 mb-2 font-medium`,children:t.display_name}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-white/60",children:[e.jsxs("label",{className:"flex items-center gap-1",children:["çæ:",e.jsx("input",{type:"number",value:t.circuit_threshold,onChange:async i=>{const c=localStorage.getItem("jwt_token");if(!c)return;const h=parseInt(i.target.value)||3;await ae(c,{route:t.route,circuitThreshold:h});const C=await K(c);H(C.routes)},className:"w-10 px-1.5 py-1 bg-white/5 border border-white/10 rounded text-center text-white",min:1,max:10}),"次"]}),e.jsxs("label",{className:"flex items-center gap-1",children:["æ¢å¤:",e.jsx("input",{type:"number",value:t.circuit_reset_minutes,onChange:async i=>{const c=localStorage.getItem("jwt_token");if(!c)return;const h=parseInt(i.target.value)||30;await ae(c,{route:t.route,circuitResetMinutes:h});const C=await K(c);H(C.routes)},className:"w-12 px-1.5 py-1 bg-white/5 border border-white/10 rounded text-center text-white",min:5,max:1440}),"å"]})]})]},t.route)})}),e.jsx("div",{className:"text-xs text-white/40 mt-2",children:"ð¡ è¿ç»å¤±è´¥è¾¾å°éå¼åèªå¨çæè¯¥ Keyï¼æå®æ¶é´åèªå¨æ¢å¤ï¼æåä¸ä¸ª Key ä¸ä¼è¢«çæ"})]})]}),e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5",children:[e.jsx("label",{className:"block text-sm text-white/60 mb-3",children:"模å管ç"}),e.jsx("div",{className:"space-y-2",children:Ce.map(t=>{const s={"nano-banana-pro":"ð","nano-banana-2":"ð","nano-banana":"â¡","flux-klein":"ð¨","flux-klein-4b":"ð","crisp-upscale":"ð","gpt-image-2":"ð¨","gpt-image-2.5-flare":"ð¨","gpt-image-2.5-sunburst":"â¨"},r={"nano-banana-pro":"æéé设置","nano-banana-2":"æéé设置","nano-banana":"åºå® AIStudio","flux-klein":"åºå® Replicate","flux-klein-4b":"åºå® Replicate","crisp-upscale":"æ¸
æ°æ¾å¤§","gpt-image-2":"åºå® Fal.ai","gpt-image-2.5-flare":"åºå® Fal.ai","gpt-image-2.5-sunburst":"åºå® Fal.ai"},i={"nano-banana-pro":"12积å · 2K | 25积å · 4K","nano-banana-2":"6积å · 1K | 9积å · 2K | 15积å · 4K","nano-banana":"4积å/次 · 1Kåºå®","flux-klein":"3积å/次 · æMP设置","flux-klein-4b":"1积å/次 · æMP设置","crisp-upscale":"2积å/次 · æ¸
æ°æ¾å¤§","gpt-image-2":"ä½/ä¸/é« Ã 1K/2K/4K æµ®å¨è®¡è´¹","gpt-image-2.5-flare":"ä½âæè´ 5 æ¡£ à 1K/2K/4K æµ®å¨è®¡è´¹ · å¿«æ¡£","gpt-image-2.5-sunburst":"ä½âæè´ 5 æ¡£ à 1K/2K/4K æµ®å¨è®¡è´¹ · 精工档"};return e.jsxs("div",{className:`flex items-center justify-between px-4 py-3 rounded-lg border transition-all ${t.enabled?"bg-green-500/10 border-green-500/30":"bg-white/5 border-white/10"}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-lg",children:s[t.id]||"ð¤"}),e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium text-white flex items-center gap-2",children:[t.displayName,e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 bg-blue-500/20 text-blue-400 rounded",children:r[t.id]||""})]}),e.jsx("div",{className:"text-xs text-white/50",children:i[t.id]||`${t.pointsCost} 积å/次`})]})]}),e.jsx("button",{onClick:()=>{te(c=>c.map(h=>h.id===t.id?{...h,enabled:!h.enabled}:h))},className:`px-3 py-1 rounded-lg text-sm font-medium transition-all ${t.enabled?"bg-green-500/20 text-green-400 hover:bg-red-500/20 hover:text-red-400":"bg-white/10 text-white/60 hover:bg-green-500/20 hover:text-green-400"}`,children:t.enabled?"å·²å¯ç¨":"å·²ç¦ç¨"})]},t.id)})})]}),Ce.filter(t=>t.providerType==="replicate").length>0&&e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5",children:[e.jsx("label",{className:"block text-sm text-white/60 mb-3",children:"Replicate 模å设置"}),e.jsx("div",{className:"space-y-4",children:Ce.filter(t=>t.providerType==="replicate").map(t=>{const s=t.id==="real-esrgan";return e.jsxs("div",{className:`p-3 rounded-lg border ${t.enabled?"border-green-500/30 bg-green-500/5":"border-white/10 bg-white/5 opacity-50"}`,children:[e.jsx("div",{className:"text-sm font-medium text-white mb-2",children:t.displayName}),s?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"text-xs text-white/50 w-16",children:"æ¾å¤§åæ°:"}),e.jsx("div",{className:"flex gap-1",children:[2,4,6,8,10].map(r=>e.jsxs("button",{onClick:()=>{te(i=>i.map(c=>c.id===t.id?{...c,extraConfig:{...c.extraConfig,scale:r}}:c))},disabled:!t.enabled,className:`px-2 py-1 text-xs rounded border transition-all ${t.extraConfig?.scale===r?"bg-green-500/20 border-green-500/50 text-green-400":"bg-white/5 border-white/10 text-white/60"} ${t.enabled?"hover:bg-white/10":"cursor-not-allowed"}`,children:[r,"x"]},r))})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-white/50 w-16",children:"人è¸å¢å¼º:"}),e.jsx("button",{onClick:()=>{te(r=>r.map(i=>i.id===t.id?{...i,extraConfig:{...i.extraConfig,face_enhance:!i.extraConfig?.face_enhance}}:i))},disabled:!t.enabled,className:`px-2 py-1 text-xs rounded border transition-all ${t.extraConfig?.face_enhance?"bg-green-500/20 border-green-500/50 text-green-400":"bg-white/5 border-white/10 text-white/60"} ${t.enabled?"hover:bg-white/10":"cursor-not-allowed"}`,children:t.extraConfig?.face_enhance?"å¼å¯":"å
³é"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"text-xs text-white/50 w-16",children:"è¾åºç²¾åº¦:"}),e.jsx("div",{className:"flex gap-1",children:["1","2","4"].map(r=>e.jsxs("button",{onClick:()=>{te(i=>i.map(c=>c.id===t.id?{...c,extraConfig:{...c.extraConfig,megapixels:r}}:c))},disabled:!t.enabled,className:`px-2 py-1 text-xs rounded border transition-all ${t.extraConfig?.megapixels===r?"bg-green-500/20 border-green-500/50 text-green-400":"bg-white/5 border-white/10 text-white/60"} ${t.enabled?"hover:bg-white/10":"cursor-not-allowed"}`,children:[r,"MP"]},r))})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-white/50 w-16",children:"å¿«éæ¨¡å¼:"}),e.jsx("button",{onClick:()=>{te(r=>r.map(i=>i.id===t.id?{...i,extraConfig:{...i.extraConfig,go_fast:!i.extraConfig?.go_fast}}:i))},disabled:!t.enabled,className:`px-2 py-1 text-xs rounded border transition-all ${t.extraConfig?.go_fast?"bg-green-500/20 border-green-500/50 text-green-400":"bg-white/5 border-white/10 text-white/60"} ${t.enabled?"hover:bg-white/10":"cursor-not-allowed"}`,children:t.extraConfig?.go_fast?"å¼å¯":"å
³é"})]})]})]},t.id)})}),e.jsx("p",{className:"mt-2 text-xs text-white/40",children:"çææ¨¡å: 1MP â 1024px, 2MP â 1448px, 4MP â 2048px"})]}),Ce.filter(t=>t.providerType==="fal").length>0&&e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5",children:[e.jsx("label",{className:"block text-sm text-white/60 mb-3",children:"Fal.ai 模å设置"}),e.jsx("div",{className:"space-y-4",children:Ce.filter(t=>t.providerType==="fal").map(t=>e.jsxs("div",{className:`p-3 rounded-lg border ${t.enabled?"border-green-500/30 bg-green-500/5":"border-white/10 bg-white/5 opacity-50"}`,children:[e.jsx("div",{className:"text-sm font-medium text-white mb-2",children:t.displayName}),t.modelType==="upscale"&&e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"text-xs text-white/50 w-20",children:"å®å
¨æ£æ¥:"}),e.jsx("button",{onClick:()=>{te(s=>s.map(r=>r.id===t.id?{...r,extraConfig:{...r.extraConfig,enable_safety_checker:!r.extraConfig?.enable_safety_checker}}:r))},disabled:!t.enabled,className:`px-2 py-1 text-xs rounded border transition-all ${t.extraConfig?.enable_safety_checker?"bg-green-500/20 border-green-500/50 text-green-400":"bg-white/5 border-white/10 text-white/60"} ${t.enabled?"hover:bg-white/10":"cursor-not-allowed"}`,children:t.extraConfig?.enable_safety_checker?"å¼å¯":"å
³é"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-white/50 w-20",children:"弿¾å±çº§:"}),e.jsx("div",{className:"flex gap-1",children:[{v:"registered",label:"注åç¨æ·"},{v:"paid",label:"ä»è´¹+管çå"},{v:"admin",label:"ä»
管çå"}].map(s=>{const r=t.accessLevel||"registered";return e.jsx("button",{onClick:()=>{te(i=>i.map(c=>c.id===t.id?{...c,accessLevel:s.v}:c))},className:`px-2 py-1 text-xs rounded border transition-all ${r===s.v?"bg-blue-500/20 border-blue-500/50 text-blue-400":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,children:s.label},s.v)})})]})]},t.id))}),e.jsx("p",{className:"mt-2 text-xs text-white/40",children:"弿¾å±çº§æ§å¶æ¨¡åå¯¹ç¨æ·çå¯è§ä¸å¯ç¨èå´ï¼æå¡ç«¯å¼ºå¶ï¼ãCrisp Upscale 为åºå®åæ°æ¾å¤§ï¼å®å
¨æ£æ¥å¯è¿æ»¤ææå
容"})]}),e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5 flex flex-col justify-end",children:[e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-white/60 mb-1",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${ft==="vertex"?"bg-purple-500":"bg-blue-500"}`}),"å½å: ",ft==="vertex"?"Vertex AI":"AI Studio"]})}),e.jsx("button",{onClick:Ya,disabled:gs,className:"w-full bg-gradient-to-r from-purple-500 to-indigo-500 hover:from-indigo-500 hover:to-purple-500 text-white font-medium px-4 py-3 rounded-lg transition-all duration-300 disabled:opacity-50 text-sm",children:gs?"ä¿åä¸...":"ä¿å设置"})]})]})]}),e.jsx(hl,{}),e.jsxs(k.div,{initial:{opacity:0,y:20}
10,animate:{opacity:1,y:0},transition:{delay:.38},className:"w-full bg-gradient-to-br from-white/[0.08] to-white/[0.02] backdrop-blur-sm border border-white/10 rounded-2xl p-6 mb-6 hover:border-white/20 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between mb-5",children:[e.jsxs("h2",{className:"text-xl font-bold flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-cyan-500 to-teal-500 flex items-center justify-center shadow-lg",children:e.jsx(Pt,{className:"w-5 h-5 text-white"})}),"çææ¥å¿çæ§"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:er,className:"px-3 py-1.5 bg-white/10 hover:bg-white/20 rounded-lg text-sm flex items-center gap-1.5 transition-colors",children:[e.jsx(ol,{className:"w-4 h-4"}),"导åºCSV"]}),e.jsxs("button",{onClick:()=>At(ks),disabled:jt,className:"px-3 py-1.5 bg-white/10 hover:bg-white/20 rounded-lg text-sm flex items-center gap-1.5 transition-colors disabled:opacity-50",children:[e.jsx(Ys,{className:`w-4 h-4 ${jt?"animate-spin":""}`}),"å·æ°"]})]})]}),Q&&e.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-4",children:[e.jsxs("div",{className:"bg-white/5 rounded-lg p-3 text-center",children:[e.jsx("div",{className:"text-2xl font-bold",children:Q.total}),e.jsx("div",{className:"text-xs text-white/50",children:"æè¿1å°æ¶"})]}),e.jsxs("div",{className:"bg-green-500/10 rounded-lg p-3 text-center border border-green-500/20",children:[e.jsx("div",{className:"text-2xl font-bold text-green-400",children:Q.success}),e.jsx("div",{className:"text-xs text-white/50",children:"æå"})]}),e.jsxs("div",{className:"bg-red-500/10 rounded-lg p-3 text-center border border-red-500/20",children:[e.jsx("div",{className:"text-2xl font-bold text-red-400",children:Q.failed}),e.jsx("div",{className:"text-xs text-white/50",children:"失败"})]}),e.jsxs("div",{className:`rounded-lg p-3 text-center ${Q.successRate>=90?"bg-green-500/10 border border-green-500/20":Q.successRate>=70?"bg-yellow-500/10 border border-yellow-500/20":"bg-red-500/10 border border-red-500/20"}`,children:[e.jsxs("div",{className:`text-2xl font-bold ${Q.successRate>=90?"text-green-400":Q.successRate>=70?"text-yellow-400":"text-red-400"}`,children:[Q.successRate,"%"]}),e.jsx("div",{className:"text-xs text-white/50",children:"æåç"})]})]}),z&&z.total>0&&e.jsxs("div",{className:`mb-4 p-3 rounded-lg border ${z.recent>0?"bg-red-500/10 border-red-500/30":"bg-white/5 border-white/10"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:z.recent>0?"text-red-400":"text-white/40",children:z.recent>0?"ð´":"·"}),e.jsxs("span",{className:z.recent>0?"text-red-300 font-medium":"text-white/50",children:["å¤å¿ä½åï¼è¿ 7 天 ",z.recent," ä¾"]}),e.jsxs("span",{className:"text-white/40 text-xs",children:["åå²ç´¯è®¡ ",z.total]})]}),e.jsx("div",{className:"mt-1 text-xs text-white/40",children:"ä»»å¡ç»ç®æåã积åå·²æ£ï¼generations éå´æ²¡æå¯¹åºè¡ ââ ç¨æ·å¨ãæç主页ãçä¸å°è¿å¼ ä½åï¼deck éå¼ç¨å®çå¾ä¹å¯è½å·²æ¯æ»é¾"}),z.latest.length>0&&e.jsx("div",{className:"mt-2 space-y-1",children:z.latest.map(t=>e.jsxs("div",{className:"flex items-center gap-2 text-xs text-white/50",children:[e.jsx("span",{className:"text-white/30",children:t.completedAt?new Date(t.completedAt*1e3).toLocaleString("zh-CN"):"â"}),e.jsxs("button",{onClick:()=>$t(t.taskId),className:"font-mono hover:text-accent hover:underline",title:"æ¥ççæåæ°",children:[t.taskId.slice(0,8),"â¦"]}),e.jsx("span",{className:"text-white/30",children:t.modelId}),e.jsxs("button",{onClick:()=>Fe(t.userId),className:"hover:text-accent hover:underline",title:"æ¥çç¨æ·",children:[t.userId.slice(0,8),"â¦"]})]},t.taskId))})]}),Is.length>0&&e.jsxs("div",{className:"mb-4 p-3 bg-white/5 rounded-lg",children:[e.jsx("div",{className:"text-sm text-white/60 mb-2",children:"åå²ç´¯è®¡ç»è®¡"}),e.jsx("div",{className:"flex flex-wrap gap-4 text-xs",children:Is.filter(t=>t.model_id!=="_global").reduce((t,s)=>{const r=t.find(i=>i.model_id===s.model_id);return r?r[s.stat_key]=s.value:t.push({model_id:s.model_id,[s.stat_key]:s.value}),t},[]).map(t=>e.jsxs("div",{className:"bg-white/5 px-2 py-1 rounded",children:[e.jsxs("span",{className:"text-white/70",children:[t.model_id,":"]})," ",e.jsxs("span",{className:"text-green-400",children:[t.success||0,"â"]})," ",e.jsxs("span",{className:"text-red-400",children:[t.failed||0,"â"]})]},t.model_id))})]}),e.jsx("div",{className:"flex gap-2 mb-4",children:["all","success","failed"].map(t=>e.jsx("button",{onClick:()=>{Ba(t),At(t)},className:`px-3 py-1.5 rounded-lg text-sm transition-colors ${ks===t?t==="failed"?"bg-red-500/20 text-red-400":t==="success"?"bg-green-500/20 text-green-400":"bg-white/20 text-white":"bg-white/5 text-white/60 hover:bg-white/10"}`,children:t==="all"?"å
¨é¨":t==="success"?"æå":"失败"},t))}),e.jsx("div",{className:"max-h-80 overflow-y-auto space-y-2",children:Cs.length===0?e.jsx("div",{className:"text-center text-white/40 py-8",children:jt?"å è½½ä¸...":"ç¹å»å·æ°æé®å è½½æ¥å¿"}):Cs.map(t=>{const r=new Date(t.createdAt*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit"});return e.jsxs("div",{className:`flex items-center gap-3 px-3 py-2 rounded-lg text-sm ${t.success?"bg-white/5":"bg-red-500/10 border border-red-500/20"}
10`,children:[e.jsx("span",{className:t.success?"text-green-400":"text-red-400",children:t.success?"ð¢":"ð´"}),e.jsx("button",{onClick:()=>{t.taskId&&$t(t.taskId)},className:`text-white/50 w-20 text-left ${t.taskId?"hover:text-accent hover:underline cursor-pointer":""}`,title:t.taskId?"ç¹å»æ¥ççæåæ°":"æ å ³èä»»å¡",disabled:!t.taskId,children:r}),e.jsx("button",{onClick:()=>{t.userId&&Fe(t.userId)},className:"text-white/70 w-24 truncate hover:text-accent hover:underline transition-colors text-left",title:t.userId?"ç¹å»æ¥çç¨æ·è¯¦æ ":"",children:t.username}),e.jsx("button",{onClick:()=>{t.taskId&&$t(t.taskId)},className:`text-white/80 w-32 truncate text-left ${t.taskId?"hover:text-accent hover:underline cursor-pointer":""}`,title:t.taskId?"ç¹å»æ¥ççæåæ°":"",disabled:!t.taskId,children:t.modelId}),e.jsx("span",{className:"text-white/50 w-28 truncate shrink-0",title:t.provider,children:t.provider}),t.success?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-white/50",children:t.durationMs?`${(t.durationMs/1e3).toFixed(1)}s`:"-"}),e.jsxs("span",{className:"text-yellow-400 ml-auto",children:[t.pointsCost,"pt"]})]}):e.jsxs("div",{className:"ml-auto flex flex-col items-end gap-0.5 max-w-[320px]",children:[e.jsxs("button",{onClick:()=>{t.errorMessage&&(navigator.clipboard.writeText(t.errorMessage),_s(t.id),setTimeout(()=>_s(null),2e3))},className:"flex items-center justify-end gap-2 group/error hover:bg-white/5 rounded px-2 py-0.5 transition-colors cursor-pointer",title:t.errorMessage?`ç¹å»å¤å¶å®æ´é误信æ¯: 11`+t.errorMessage:void 0,children:[e.jsxs("span",{className:"text-red-400 truncate text-right block",children:[t.errorCode," ",t.errorMessage?.substring(0,30)]}),e.jsx("div",{className:"w-4 h-4 flex items-center justify-center flex-shrink-0",children:Ga===t.id?e.jsx(xt,{className:"w-3.5 h-3.5 text-green-400"}):e.jsx(ge,{className:"w-3.5 h-3.5 text-white/40 opacity-0 group-hover/error:opacity-100 transition-opacity"})})]}),t.friendlyHint&&e.jsxs("span",{className:"text-amber-400/80 text-xs truncate max-w-full px-2",title:t.friendlyHint,children:["ð¬ ",t.friendlyHint]})]})]},t.id)})})]}),e.jsxs(k.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.4},className:"w-full bg-gradient-to-br from-white/[0.08] to-white/[0.02] backdrop-blur-sm border border-white/10 rounded-2xl p-6 mb-6 hover:border-white/20 transition-colors",children:[e.jsxs("h2",{className:"text-xl font-bold mb-5 flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-blue-500 to-cyan-500 flex items-center justify-center shadow-lg",children:e.jsx(Ws,{className:"w-5 h-5 text-white"})}),"å¡å¯çæå¨"]}),e.jsxs("div",{className:"flex gap-3 mb-6",children:[e.jsxs("button",{onClick:()=>le("GIFT"),className:`flex items-center gap-2 px-5 py-2.5 rounded-xl border transition-all duration-300 ${E==="GIFT"?"bg-green-500/20 border-green-500/50 text-green-400 shadow-[0_0_15px_rgba(34,197,94,0.15)]":"bg-white/5 border-white/10 text-white/50 hover:border-white/25"}`,children:[e.jsx(Zs,{className:"w-4 h-4"}),"å è´¹ç¦å©",e.jsx("span",{className:"text-xs opacity-60",children:"VIP-"})]}),e.jsxs("button",{onClick:()=>le("PAID"),className:`flex items-center gap-2 px-5 py-2.5 rounded-xl border transition-all duration-300 ${E==="PAID"?"bg-orange-500/20 border-orange-500/50 text-orange-400 shadow-[0_0_15px_rgba(249,115,22,0.15)]":"bg-white/5 border-white/10 text-white/50 hover:border-white/25"}`,children:[e.jsx(Mt,{className:"w-4 h-4"}),"ä»è´¹å å¼",e.jsx("span",{className:"text-xs opacity-60",children:"PRO-"})]})]}),e.jsxs("div",{className:"w-full grid grid-cols-1 md:grid-cols-3 gap-6 mb-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"çææ°é"}),e.jsx("input",{type:"number",min:"1",max:"1000",value:R,onChange:t=>W(parseInt(t.target.value)||1),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-3 text-white focus:outline-none focus:border-accent transition-colors",placeholder:"1-1000"})]}),E==="GIFT"?e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"æ»ç§¯å"}),e.jsx("input",{type:"number",min:"1",max:"100000",value:m,onChange:t=>V(parseInt(t.target.value)||1),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-3 text-white focus:outline-none focus:border-accent transition-colors",placeholder:"1-100000"})]}):e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"ä»·æ ¼ (CNY Â¥)"}),e.jsx("input",{type:"number",min:"0.01",step:"0.01",value:Y||"",onChange:t=>we(parseFloat(t.target.value)||0),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-3 text-white focus:outline-none focus:border-orange-400 transition-colors",placeholder:"人æ°å¸éé¢"})]}),e.jsx("div",{className:"flex items-end",children:e.jsxs("button",{onClick:tr,disabled:u,className:`w-full font-medium px-6 py-3 rounded-lg transition-all duration-300 shadow-lg disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2 text-white ${E==="PAID"?"bg-gradient-to-r from-orange-500 to-red-500 hover:from-red-500 hover:to-orange-500 hover:shadow-orange-500/50":"bg-gradient-to-r from-accent to-blue-600 hover:from-blue-600 hover:to-accent hover:shadow-accent/50"}`,children:[e.jsx(Ge,{className:"w-5 h-5"}),u?"çæä¸...":E==="PAID"?"çæä»è´¹å¡å¯":"çæç¦å©å¡å¯"]})})]}),E==="PAID"&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-6 p-4 bg-orange-500/5 border border-orange-500/10 rounded-xl",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-orange-300/80 mb-2",children:"æ¬é积å"}),e.jsx("input",{type:"number",min:"1",value:q||"",onChange:t=>j(parseInt(t.target.value)||0),className:"w-full bg-white/5 border border-orange-500/20 rounded-lg px-4 py-3 text-white focus:outline-none focus:border-orange-400 transition-colors",placeholder:"æ¬éç§¯åæ°"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-orange-300/80 mb-2",children:"èµ é积å"}),e.jsx("input",{type:"number",min:"0",value:y||"",onChange:t=>o(parseInt(t.target.value)||0),className:"w-full bg-white/5 border border-orange-500/20 rounded-lg px-4 py-3 text-white focus:outline-none focus:border-orange-400 transition-colors",placeholder:"èµ éç§¯åæ°ï¼å¯éï¼"})]}),e.jsx("div",{className:"flex items-end",children:e.jsxs("div",{className:"w-full bg-orange-500/10 border border-orange-500/20 rounded-lg px-4 py-3 text-center",children:[e.jsx("span",{className:"text-xs text-white/40 block",children:"æ»ç§¯å"}),e.jsx("span",{className:"text-2xl font-bold text-orange-400",children:q+y})]})})]}),n.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsxs("h3",{className:"text-lg font-medium",children:["å·²çæ ",n.length," 个",n[0]?.type==="PAID"?"ä»è´¹":"ç¦å©","å¡å¯"]}),e.jsxs("button",{onClick:nr,className:"text-sm text-accent hover:text-blue-400 transition-colors flex items-center gap-2",children:[e.jsx(ge,{className:"w-4 h-4"}),"å¤å¶å ¨é¨"]})]}),e.jsx("div",{className:"bg-black/30 rounded-lg p-4 max-h-96 overflow-y-auto",children:e.jsx("div",{className:"space-y-2",children:n.map((t,s)=>e.jsxs("div",{className:`flex items-center justify-between rounded-lg px-4 py-3 transition-colors border ${t.type==="PAID"?"bg-
11orange-500/5 border-orange-500/15 hover:bg-orange-500/10":"bg-white/5 border-white/10 hover:bg-white/10"}`,children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"text-white/40 text-sm w-8",children:["#",s+1]}),e.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${t.type==="PAID"?"bg-orange-500/20 text-orange-400":"bg-green-500/20 text-green-400"}`,children:t.type==="PAID"?"ä»è´¹":"ç¦å©"}),e.jsx("span",{className:"font-mono text-lg",children:t.code}),e.jsxs("span",{className:"text-accent text-sm",children:[t.points," 积å"]})]}),e.jsx("button",{onClick:()=>ir(t.code,s),className:"text-white/60 hover:text-accent transition-colors",children:O===s?e.jsx(xt,{className:"w-5 h-5 text-green-500"}):e.jsx(ge,{className:"w-5 h-5"})})]},s))})})]})]}),e.jsxs(k.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.45},className:"w-full bg-gradient-to-br from-white/[0.08] to-white/[0.02] backdrop-blur-sm border border-white/10 rounded-2xl p-6 mb-6 hover:border-white/20 transition-colors",children:[e.jsxs("h2",{className:"text-xl font-bold mb-5 flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-yellow-500 to-orange-500 flex items-center justify-center shadow-lg",children:e.jsx(Ke,{className:"w-5 h-5 text-white"})}),"é请ç çæå¨"]}),e.jsxs("div",{className:"w-full grid grid-cols-1 md:grid-cols-4 gap-6 mb-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"çææ°é"}),e.jsx("input",{type:"number",min:"1",max:"100",value:qe,onChange:t=>da(parseInt(t.target.value)||1),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-3 text-white focus:outline-none focus:border-accent transition-colors",placeholder:"1-100"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"积åé¢é¢"}),e.jsx("input",{type:"number",min:"1",max:"100000",value:$e,onChange:t=>ca(parseInt(t.target.value)||1),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-3 text-white focus:outline-none focus:border-accent transition-colors",placeholder:"1-100000"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"å¯ç¨æ¬¡æ°"}),e.jsx("input",{type:"number",min:"1",max:"10000",value:Le,onChange:t=>xa(parseInt(t.target.value)||1),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-3 text-white focus:outline-none focus:border-accent transition-colors",placeholder:"1-10000"})]}),e.jsx("div",{className:"flex items-end",children:e.jsxs("button",{onClick:or,disabled:Qt,className:"w-full bg-gradient-to-r from-yellow-500 to-orange-500 hover:from-orange-500 hover:to-yellow-500 text-white font-medium px-6 py-3 rounded-lg transition-all duration-300 shadow-lg hover:shadow-yellow-500/50 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2",children:[e.jsx(Ke,{className:"w-5 h-5"}),Qt?"çæä¸...":"çæé请ç "]})})]}),Qe.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsxs("h3",{className:"text-lg font-medium",children:["å·²çæ ",Qe.length," 个é请ç ",e.jsxs("span",{className:"text-sm text-white/40 ml-2",children:["(æ¯ç ",$e," 积åï¼å¯ç¨ ",Le," 次)"]})]}),e.jsxs("button",{onClick:cr,className:"text-sm text-yellow-400 hover:text-yellow-300 transition-colors flex items-center gap-2",children:[e.jsx(ge,{className:"w-4 h-4"}),"å¤å¶å
¨é¨"]})]}),e.jsx("div",{className:"bg-black/30 rounded-lg p-4 max-h-96 overflow-y-auto",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-2",children:Qe.map((t,s)=>e.jsxs("div",{className:"flex items-center justify-between bg-yellow-500/10 border border-yellow-500/20 rounded-lg px-4 py-3 hover:bg-yellow-500/20 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-white/40 text-sm",children:["#",s+1]}),e.jsx("span",{className:"font-mono text-lg tracking-widest",children:t})]}),e.jsx("button",{onClick:()=>dr(t,s),className:"text-white/60 hover:text-yellow-400 transition-colors",children:ma===s?e.jsx(xt,{className:"w-5 h-5 text-green-500"}):e.jsx(ge,{className:"w-5 h-5"})})]},s))})})]})]}),e.jsxs(k.div,{initial:{opacity:0,y:20}
11,animate:{opacity:1,y:0},transition:{delay:.48},className:"w-full bg-gradient-to-br from-white/[0.08] to-white/[0.02] backdrop-blur-sm border border-white/10 rounded-2xl p-6 mb-6 hover:border-white/20 transition-colors",children:[e.jsxs("h2",{className:"text-xl font-bold mb-5 flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-emerald-500 to-teal-500 flex items-center justify-center shadow-lg",children:e.jsx(dt,{className:"w-5 h-5 text-white"})}),"è´¦æ¬ä¸ç©ºæ"]}),e.jsxs("div",{className:"bg-black/20 rounded-xl p-5 border border-white/5 mb-6",children:[e.jsxs("h3",{className:"text-base font-semibold mb-4 flex items-center gap-2",children:[e.jsx(Zs,{className:"w-4 h-4 text-emerald-400"}),"积å空æ"]}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:[{id:"all",label:"å
¨ä½ç¨æ·",Icon:Xs},{id:"specific",label:"æå®ç¨æ·",Icon:Dt},{id:"registered_after",label:"æå®æ¥æå注å",Icon:Xr},{id:"by_condition",label:"æ¡ä»¶çé",Icon:el}].map(({id:t,label:s,Icon:r})=>e.jsxs("button",{onClick:()=>ie(t),className:`flex items-center gap-2 px-4 py-2 rounded-lg border text-sm transition-all ${v===t?"bg-emerald-500/20 border-emerald-500/50 text-emerald-400":"bg-white/5 border-white/10 text-white/50 hover:border-white/25"}`,children:[e.jsx(r,{className:"w-3.5 h-3.5"}),s]},t))}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-4",children:[v==="specific"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"ç¨æ·é®ç®±"}),e.jsx("input",{type:"email",value:Z,onChange:t=>ht(t.target.value),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-emerald-400 transition-colors",placeholder:"è¾å
¥ç¨æ·é®ç®±"})]}),v==="registered_after"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"æ³¨åæ¥æ"}),e.jsx("input",{type:"date",value:fe,onChange:t=>mt(t.target.value),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-emerald-400 transition-colors"})]}),v==="by_condition"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"ä½é¢ä¸éï¼å«ï¼"}),e.jsx("input",{type:"number",min:"0",value:d,onChange:t=>de(t.target.value),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-emerald-400 transition-colors",placeholder:"ç空ä¸é"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"ä½é¢ä¸éï¼å«ï¼"}),e.jsx("input",{type:"number",min:"0",value:$,onChange:t=>ce(t.target.value),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-emerald-400 transition-colors",placeholder:"ç空ä¸é"})]}),e.jsx("div",{className:"flex items-end",children:e.jsxs("label",{className:"flex items-center gap-2.5 px-4 py-2.5 bg-white/5 border border-white/20 rounded-lg cursor-pointer hover:border-emerald-400/50 transition-colors select-none",children:[e.jsx("input",{type:"checkbox",checked:Ve,onChange:t=>aa(t.target.checked),className:"w-4 h-4 rounded accent-emerald-500"}),e.jsx("span",{className:"text-sm text-white/70",children:"仿ªè·å¾è¿ç§¯å"})]})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"ç§¯åæ°é"}),e.jsx("input",{type:"number",min:"1",max:"100000",value:ne,onChange:t=>bt(parseInt(t.target.value)||1),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-emerald-400 transition-colors",placeholder:"ç§¯åæ°é"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"åå / æè¿°"}),e.jsx("input",{type:"text",value:oe,onChange:t=>Oe(t.target.value),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-emerald-400 transition-colors",placeholder:"å¦ï¼ç¾äººç ´å°çºªå¿µ"})]})]}),e.jsxs("button",{onClick:sr,disabled:_e||!oe.trim(),className:"bg-gradient-to-r from-emerald-500 to-teal-500 hover:from-teal-500 hover:to-emerald-500 text-white font-medium px-6 py-2.5 rounded-lg transition-all duration-300 disabled:opacity-50 flex items-center gap-2 text-sm",children:[e.jsx(Qs,{className:"w-4 h-4"}),_e?"åéä¸...":"åé空æ"]})]}),e.jsxs("div",{className:"bg-black/20 rounded-xl p-5 border border-white/5 mb-6",children:[e.jsxs("h3",{className:"text-base font-semibold mb-4 flex items-center gap-2",children:[e.jsx(Mt,{className:"w-4 h-4 text-yellow-400"}),"鿬¾è®°è´¦"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"ç¨æ·é®ç®±"}),e.jsx("input",{type:"email",value:je,onChange:t=>oa(t.target.value),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-yellow-400 transition-colors",placeholder:"è¾å
¥ç¨æ·é®ç®±"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"æ£å积å"}),e.jsx("input",{type:"number",min:"0",value:Ie,onChange:t=>Vt(parseInt(t.target.value)||0),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-yellow-400 transition-colors",placeholder:"å¯ä¸º 0ï¼ä»
è®°è´¦ï¼"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"鿬¾éé¢ (CNY Â¥)"}),e.jsx("input",{type:"number",min:"0",step:"0.01",value:Ae||"",onChange:t=>zt(parseFloat(t.target.value)||0),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-yellow-400 transition-colors",placeholder:"人æ°å¸éé¢"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"鿬¾åå "}),e.jsx("input",{type:"text",value:ve,onChange:t=>Ht(t.target.value),className:"w-full bg-white/5 border border-white/20 rounded-lg px-4 py-2.5 text-white text-sm focus:outline-none focus:border-yellow-400 transition-colors",placeholder:"å¦ï¼ç¨æ·æè¯¯è´ä¹°"})]})]}),e.jsxs("button",{onClick:ar,disabled:Jt||!je.trim()||!ve.trim(),className:"bg-gradient-to-r from-yellow-500 to-orange-500 hover:from-orange-500 hover:to-yellow-500 text-white font-medium px-6 py-2.5 rounded-lg transition-all duration-300 disabled:opacity-50 flex items-center gap-2 text-sm",children:[e.jsx(Mt,{className:"w-4 h-4"}),Jt?"å¤çä¸...":"ç¡®è®¤éæ¬¾è®°è´¦"]})]}),e.jsxs("div",{id:"ledger-section",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Pt,{className:"w-4 h-4 text-emerald-400"}),"ç§¯åæµæ°´",Ot>0&&e.jsxs("span",{className:"text-xs text-white/30 font-normal",children:["(",Ot," æ¡)"]})]}),e.jsxs("button",{onClick:()=>X(xe,!1,he),disabled:He,className:"text-sm text-emerald-400 hover:text-emerald-300 transition-colors flex items-center gap-1",children:[e.jsx(Ys,{className:`w-3.5 h-3.5 ${He?"animate-spin":""}`}),"å·æ°"]})]}),e.jsxs("div",{className:"flex items-center gap-2 mb-3 px-3 py-2 bg-white/5 border border-white/10 rounded-lg text-sm focus-within:border-accent/40 transition-colors",children:[e.jsx(Dt,{className:"w-3.5 h-3.5 text-white/40 shrink-0"}
11),e.jsx("input",{type:"text",value:he,onChange:t=>Je(t.target.value),onKeyDown:t=>{t.key==="Enter"&&X(xe,!1,he)},className:"flex-1 bg-transparent outline-none text-white text-sm placeholder-white/30",placeholder:"è¾å
¥é®ç®±ææµç§°çéç¨æ·ï¼å车æç´¢..."}),he&&e.jsx("button",{onClick:lr,className:"text-white/40 hover:text-white transition-colors shrink-0",children:e.jsx(B,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:[{id:"ALL",label:"å
¨é¨"},{id:"RECHARGE",label:"å
å¼"},{id:"AIRDROP",label:"空æ"},{id:"CONSUME",label:"æ¶è´¹"},{id:"REFUND",label:"鿬¾"}].map(({id:t,label:s})=>e.jsxs("button",{onClick:()=>{pt(t),X(t,!1,he)},className:`px-3 py-1.5 rounded-lg text-xs transition-all border ${xe===t?"bg-emerald-500/20 border-emerald-500/40 text-emerald-400":"bg-white/5 border-white/5 text-white/40 hover:text-white/60"}`,children:[s,Ut&&t!=="ALL"&&e.jsxs("span",{className:"ml-1 opacity-60",children:["(",Ut[t.toLowerCase()]||0,")"]})]},t))}),ze.length===0&&!He?e.jsxs("div",{className:"text-center py-8 text-white/30",children:[e.jsx(dt,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"ææ æµæ°´è®°å½ï¼ç¹å»âå·æ°âå è½½"})]}):e.jsx("div",{className:"bg-black/30 rounded-lg overflow-hidden",children:e.jsxs("div",{onScroll:rr,className:"overflow-x-auto max-h-[400px] overflow-y-auto",children:[e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"sticky top-0 bg-white/5 backdrop-blur-sm z-10",children:e.jsxs("tr",{className:"text-white/50 text-left",children:[e.jsx("th",{className:"px-4 py-3 font-medium",children:"æ¶é´"}),e.jsx("th",{className:"px-4 py-3 font-medium",children:"ç¨æ·"}),e.jsx("th",{className:"hidden md:table-cell px-4 py-3 font-medium",children:"é®ç®±"}),e.jsx("th",{className:"px-4 py-3 font-medium",children:"ç±»å"}),e.jsx("th",{className:"px-4 py-3 font-medium text-right",children:"åå¨"}),e.jsx("th",{className:"px-4 py-3 font-medium",children:"åå / åè"})]})}),e.jsx("tbody",{className:"divide-y divide-white/5",children:ze.map(t=>{const s={RECHARGE:"å
å¼",AIRDROP:"空æ",CONSUME:"æ¶è´¹",REFUND:"鿬¾"},i={RECHARGE:"blue",AIRDROP:"emerald",CONSUME:"red",REFUND:"yellow"}[t.type]||"gray",c=String(t.reference||""),h=t.type==="CONSUME"?/(页é¢|æ¼ç¤º)/.test(c)?"页é¢çæ":/(å¾ç|å¾å|çå¾)/.test(c)?"å¾åçæ":null:null,C=h?`æ¶è´¹ · ${h}`:s[t.type]||t.type;return e.jsxs("tr",{className:"hover:bg-white/5 transition-colors",children:[e.jsx("td",{className:"px-4 py-3 text-white/50 whitespace-nowrap",children:new Date(t.created_at*1e3).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("button",{onClick:()=>{t.user_id&&Fe(t.user_id)},className:"text-white/70 hover:text-accent hover:underline transition-colors cursor-pointer text-left",title:"ç¹å»æ¥çç¨æ·è¯¦æ
",children:t.user_nickname||t.user_email||t.user_id?.slice(0,8)})}),e.jsx("td",{className:"hidden md:table-cell px-4 py-3",children:e.jsx("span",{className:"text-white/40 text-xs",children:t.user_email||"-"})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs whitespace-nowrap bg-${i}-500/20 text-${i}-400`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full bg-${i}-400 shrink-0`}),C]})}),e.jsxs("td",{className:`px-4 py-3 text-right font-mono font-medium whitespace-nowrap ${t.amount>0?"text-green-400":"text-red-400"}`,children:[t.amount>0?"+":"",t.amount]}),e.jsx("td",{className:"px-4 py-3 text-white/40 max-w-[200px] truncate",children:t.reference||"-"})]},t.id)})})]}),Bt&&e.jsx("div",{className:"py-3 text-center text-white/40 text-sm",children:"å è½½æ´å¤..."}),!Kt&&ze.length>0&&!He&&e.jsxs("div",{className:"py-3 text-center text-white/20 text-xs",children:["â å·²å è½½å
¨é¨ ",ze.length," æ¡è®°å½ â"]})]})})]})]}),e.jsx(ml,{}),e.jsx(k.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.5},className:"w-full",children:e.jsxs("button",{onClick:()=>f("/"),className:"w-full bg-white/5 backdrop-blur-sm border border-white/10 rounded-2xl p-8 text-left hover:bg-white/10 hover:border-accent/50 transition-all duration-300 group",children:[e.jsx("h3",{className:"text-xl font-bold mb-2 group-hover:text-accent transition-colors",children:"è¿åé¦é¡µ"}),e.jsx("p",{className:"text-white/60",children:"æ¥çåå°å±ç¤ºææ"})]})})]}),ba&&e.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm z-50 flex items-center justify-center p-6",children:e.jsxs(k.div,{initial:{opacity:0,scale:.95}
11,animate:{opacity:1,scale:1},className:"bg-gray-900 border border-white/20 rounded-2xl max-w-4xl w-full max-h-[80vh] overflow-hidden",children:[e.jsxs("div",{className:"p-6 border-b border-white/10 flex items-center justify-between",children:[e.jsx("h2",{className:"text-2xl font-bold",children:"å¡å¯å表"}),e.jsx("button",{onClick:()=>Yt(!1),className:"text-white/60 hover:text-white",children:e.jsx(B,{className:"w-6 h-6"})})]}),e.jsx("div",{className:"p-6 border-b border-white/10",children:e.jsx("div",{className:"flex gap-2",children:["ALL","ACTIVE","USED","EXPIRED"].map(t=>e.jsx("button",{onClick:()=>{wa(t),Us(t)},className:`px-4 py-2 rounded-lg transition-colors ${ts===t?"bg-accent text-white":"bg-white/5 text-white/60 hover:bg-white/10"}`,children:t==="ALL"?"å
¨é¨":t==="ACTIVE"?"æªä½¿ç¨":t==="USED"?"已使ç¨":"å·²è¿æ"},t))})}),e.jsx("div",{className:"p-6 overflow-y-auto max-h-[50vh]",children:Ye?e.jsx("div",{className:"text-center py-12 text-white/40",children:"å è½½ä¸..."}):es.length===0?e.jsx("div",{className:"text-center py-12 text-white/40",children:"ææ å¡å¯"}):e.jsx("div",{className:"space-y-2",children:es.map(t=>e.jsx("div",{className:"bg-white/5 border border-white/10 rounded-lg px-4 py-3 hover:bg-white/10 transition-colors",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"font-mono text-lg",children:t.code}),e.jsxs("span",{className:"text-accent text-sm",children:[t.points," 积å"]}),e.jsx("span",{className:`px-2 py-0.5 rounded text-xs ${t.status==="ACTIVE"?"bg-green-500/20 text-green-400":t.status==="USED"?"bg-gray-500/20 text-gray-400":"bg-red-500/20 text-red-400"}`,children:t.status==="ACTIVE"?"æªä½¿ç¨":t.status==="USED"?"已使ç¨":"å·²è¿æ"})]}),t.status==="USED"&&t.used_by_email&&e.jsxs("div",{className:"text-xs text-white/40 mt-1",children:["使ç¨è
: ",t.used_by_nickname||t.used_by_email," · ",new Date(t.used_at*1e3).toLocaleString()]})]}),t.status==="ACTIVE"&&e.jsx("button",{onClick:()=>{navigator.clipboard.writeText(t.code),alert("â
å·²å¤å¶")},className:"text-white/60 hover:text-accent",children:e.jsx(ge,{className:"w-5 h-5"})})]})},t.id))})})]})}),Ha&&e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:e.jsxs(k.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"bg-[#1a1a2e] rounded-2xl border border-green-500/20 w-full max-w-lg shadow-xl",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-white/5",children:[e.jsx("h3",{className:"text-lg font-semibold text-green-400",children:"ð æ·»å IAM Key"}),e.jsx("button",{onClick:()=>vt(!1),className:"text-white/40 hover:text-white",children:e.jsx(B,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-1",children:"åç§°"}),e.jsx("input",{type:"text",value:tt,onChange:t=>As(t.target.value),placeholder:"å¦: ä¸»è´¦å· / å¤ç¨A",className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-lg text-white placeholder:text-white/30 focus:border-green-500/50 focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-1",children:"Service Account JSON Key"}),e.jsx("textarea",{value:st,onChange:t=>$s(t.target.value),placeholder:"ç²è´´å®æ´ç JSON Key (åè¡æå¤è¡åå¯)",rows:6,className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-lg text-white placeholder:text-white/30 focus:border-green-500/50 focus:outline-none font-mono text-xs"}),e.jsx("p",{className:"text-xs text-white/40 mt-1",children:"ä» Google Cloud Console ä¸è½½ç Service Account JSON æä»¶å
容"})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 p-4 border-t border-white/5",children:[e.jsx("button",{onClick:()=>vt(!1),className:"px-4 py-2 text-white/60 hover:text-white",children:"忶"}),e.jsx("button",{onClick:async()=>
11{if(!tt.trim()||!st.trim()){alert("请填ååç§°å JSON Key");return}Ds(!0);try{const t=localStorage.getItem("jwt_token");if(!t)return;await Vs(t,{route:"vertex-iam",label:tt.trim(),credentials_json:st.trim()});const s=await K(t);ke(s.credentials),H(s.routes),As(""),$s(""),vt(!1)}catch(t){alert(t.message)}finally{Ds(!1)}},disabled:Ls||!tt.trim()||!st.trim(),className:"px-4 py-2 bg-green-500 text-white rounded-lg hover:bg-green-600 disabled:opacity-50 disabled:cursor-not-allowed",children:Ls?"æ·»å ä¸...":"æ·»å "})]})]})}),Ja&&e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:e.jsxs(k.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"bg-[#1a1a2e] rounded-2xl border border-cyan-500/20 w-full max-w-lg shadow-xl",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-white/5",children:[e.jsx("h3",{className:"text-lg font-semibold text-cyan-400",children:"ð æ·»å API åæ®"}),e.jsx("button",{onClick:()=>at(!1),className:"text-white/40 hover:text-white",children:e.jsx(B,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-2",children:"éæ©è·¯ç±"}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{id:"aistudio",name:"AIStudioå¿«ééé",color:"blue"},{id:"vertex",name:"VertexAIå¤ç¨éé1",color:"purple"},{id:"vertex-iam",name:"VertexIAMå¤ç¨éé2",color:"green"}].map(t=>e.jsx("button",{onClick:()=>qa(t.id),className:`px-3 py-2 rounded-lg border transition-all ${ue===t.id?`bg-${t.color}-500/20 border-${t.color}-500/50 text-${t.color}-400`:"bg-white/5 border-white/10 text-white/60 hover:bg-white/10"}`,children:t.name},t.id))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-1",children:"åç§°"}),e.jsx("input",{type:"text",value:rt,onChange:t=>Nt(t.target.value),placeholder:"å¦: 主Key / å¤ç¨1",className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-lg text-white placeholder:text-white/30 focus:border-cyan-500/50 focus:outline-none"})]}),ue!=="vertex-iam"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-1",children:"API Key"}),e.jsx("input",{type:"password",value:yt,onChange:t=>Ct(t.target.value),placeholder:"è¾å
¥ API Key",className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-lg text-white placeholder:text-white/30 focus:border-cyan-500/50 focus:outline-none font-mono"})]}),ue==="vertex"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-1",children:"Project ID"}),e.jsx("input",{type:"text",value:kt,onChange:t=>St(t.target.value),placeholder:"è¾å
¥ GCP Project ID",className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-lg text-white placeholder:text-white/30 focus:border-cyan-500/50 focus:outline-none"})]})]}),ue==="vertex-iam"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-white/60 mb-1",children:"Service Account JSON"}),e.jsx("textarea",{value:_t,onChange:t=>It(t.target.value),placeholder:"ç²è´´å®æ´ç JSON Key",rows:6,className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-lg text-white placeholder:text-white/30 focus:border-cyan-500/50 focus:outline-none font-mono text-xs"}),e.jsx("p",{className:"text-xs text-white/40 mt-1",children:"ä» Google Cloud Console ä¸è½½ç Service Account JSON æä»¶"})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 p-4 border-t border-white/5",children:[e.jsx("button",{onClick:()=>{at(!1),Nt(""),Ct(""),St(""),It("")},className:"px-4 py-2 text-white/60 hover:text-white",children:"åæ¶"}),e.jsx("button",{onClick:async()=>{if(!rt.trim()){alert("请填ååç§°");return}Ts(!0);try{const t=localStorage.getItem("jwt_token");if(!t)return;const s={route:ue,label:rt.trim()};if(ue==="vertex-iam"){if(!_t.trim()){alert("请填å Service Account JSON");return}s.credentials_json=_t.trim()}else{if(!yt.trim()){alert("请填å API Key");return}if(s.api_key=yt.trim(),ue==="vertex"){if(!kt.trim()){alert("Vertex éè¦å¡«å Project ID");return}s.project_id=kt.trim()}}await Vs(t,s);const r=await K(t);ke(r.credentials),H(r.routes),Nt(""),Ct(""),St(""),It(""),at(!1)}catch(t){alert(t.message)}finally{Ts(!1)}},disabled:Ms||!rt.trim(),className:"px-4 py-2 bg-cyan-500 text-white rounded-lg hover:bg-cyan-600 disabled:opacity-50 disabled:cursor-not-allowed",children:Ms?"æ·»å ä¸...":"æ·»å "})]})]})}),pa&&e.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm z-50 flex items-center justify-center p-2 md:p-6",children:e.jsxs(k.div,{initial:{opacity:0,scale:.95}
11,animate:{opacity:1,scale:1},className:"bg-gray-900 border border-white/20 rounded-2xl max-w-6xl w-full max-h-[90vh] md:max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"p-6 border-b border-white/10 flex items-center justify-between",children:[e.jsx("h2",{className:"text-2xl font-bold",children:"ç¨æ·å表"}),e.jsx("button",{onClick:()=>me(!1),className:"text-white/60 hover:text-white",children:e.jsx(B,{className:"w-6 h-6"})})]}),e.jsxs("div",{className:"p-4 md:p-6 border-b border-white/10 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 bg-white/5 rounded-lg px-4 py-2 border border-white/10",children:[e.jsx(Dt,{className:"w-5 h-5 text-white/40"}),e.jsx("input",{type:"text",placeholder:"æç´¢é®ç®±ææµç§°...",value:ee,onChange:t=>fa(t.target.value),onKeyDown:t=>t.key==="Enter"&&Se(ee,!1,U),className:"flex-1 bg-transparent outline-none text-white"}),e.jsx("button",{onClick:()=>Se(ee,!1,U),className:"px-4 py-1 bg-accent rounded-lg hover:bg-accent/80 transition-colors",children:"æç´¢"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:[{key:"paid",label:"ä»è´¹ç¨æ·",icon:e.jsx(ot,{className:"w-3 h-3"}),activeClass:"bg-yellow-500/20 border-yellow-500/40 text-yellow-400"},{key:"admin",label:"管çå",icon:e.jsx(Re,{className:"w-3 h-3"}),activeClass:"bg-purple-500/20 border-purple-500/40 text-purple-400"},{key:"active7d",label:"è¿7天活è·",icon:e.jsx(Pt,{className:"w-3 h-3"}),activeClass:"bg-green-500/20 border-green-500/40 text-green-400"},{key:"new7d",label:"è¿7å¤©æ°æ³¨å",icon:e.jsx(Ge,{className:"w-3 h-3"}),activeClass:"bg-blue-500/20 border-blue-500/40 text-blue-400"}].map(({key:t,label:s,icon:r,activeClass:i})=>e.jsxs("button",{onClick:()=>xr(t),className:`flex items-center gap-1.5 px-3 py-1 rounded-full text-xs transition-all border ${De===t?i:"bg-white/5 border-white/10 text-white/50 hover:border-white/20"}`,children:[r,s,De===t&>>0&&e.jsxs("span",{className:"opacity-60",children:["(",gt,")"]})]},t))})]}),e.jsxs("div",{onScroll:Ks,className:"hidden md:block overflow-auto max-h-[50vh]",children:[e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-white/5 border-b border-white/10 sticky top-0 z-10",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 text-left text-sm font-semibold text-white/80",children:"ç¨æ·"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-semibold text-white/80",children:"é®ç®±"}),e.jsx("th",{onClick:()=>Ue("balance"),className:"px-4 py-3 text-left text-sm font-semibold text-white/80 cursor-pointer hover:text-accent transition-colors select-none",children:e.jsxs("span",{className:"flex items-center gap-1",children:["ä½é¢",U==="balance"&&e.jsx(ct,{className:"w-3.5 h-3.5 text-accent"})]})}),e.jsx("th",{onClick:()=>Ue("generation_count"),className:"px-4 py-3 text-left text-sm font-semibold text-white/80 cursor-pointer hover:text-accent transition-colors select-none",children:e.jsxs("span",{className:"flex items-center gap-1",children:["çæ",U==="generation_count"&&e.jsx(ct,{className:"w-3.5 h-3.5 text-accent"})]})}),e.jsx("th",{onClick:()=>Ue("points_paid"),className:"px-4 py-3 text-left text-sm font-semibold text-white/80 cursor-pointer hover:text-accent transition-colors select-none",children:e.jsxs("span",{className:"flex items-center gap-1",children:["ä»è´¹",U==="points_paid"&&e.jsx(ct,{className:"w-3.5 h-3.5 text-accent"})]})}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-semibold text-white/80",children:"èµ å"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-semibold text-white/80",children:"空æ"}),e.jsx("th",{onClick:()=>Ue("total_points_spent"),className:"px-4 py-3 text-left text-sm font-semibold text-white/80 cursor-pointer hover:text-accent transition-colors select-none",children:e.jsxs("span",{className:"flex items-center gap-1",children:["æ¶è´¹",U==="total_points_spent"&&e.jsx(ct,{className:"w-3.5 h-3.5 text-accent"})]})}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-semibold text-white/80",children:"注å"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-semibold text-white/80",children:"æä½"})]})}),e.jsx("tbody",{className:"divide-y divide-white/10",children:Ye?e.jsx("tr",{children:e.jsx("td",{colSpan:10,className:"px-6 py-12 text-center text-white/40",children:"å è½½ä¸..."})}):Ne.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:10,className:"px-6 py-12 text-center text-white/40",children:"ææ ç¨æ·"})}):Ne.map(t=>{const s=t.is_paid===1,r=t.role==="admin",i=s?"text-yellow-400":r?"text-purple-400":"text-white",c=s?"text-yellow-400/60":"text-white/60";return e.jsxs("tr",{className:"hover:bg-white/5",children:[e.jsx("td",{className:"px-4 py-3 text-sm",children:e.jsxs("button",{onClick:()=>Fe(t.id),className:`flex items-center gap-1.5 ${i} hover:underline text-left`,children:[s&&e.jsx(ot,{className:"w-3.5 h-3.5 text-yellow-400 shrink-0"}),r&&e.jsx(Re,{className:"w-3.5 h-3.5 text-purple-400 shrink-0"}),e.jsx("span",{className:"truncate max-w-[120px]",children:t.nickname})]})}),e.jsx("td",{className:`px-4 py-3 text-sm ${c}`,children:t.email}),e.jsx("td",{className:"px-4 py-3 text-sm",children:e.jsx("span",{className:"text-accent font-semibold",children:t.balance})}),e.jsx("td",{className:"px-4 py-3 text-sm",children:t.generation_count||0}),e.jsx("td",{className:"px-4 py-3 text-sm text-yellow-400",children:t.points_paid||0}),e.jsx("td",{className:"px-4 py-3 text-sm text-green-400",children:t.points_gift||0}),e.jsx("td",{className:"px-4 py-3 text-sm text-emerald-400",children:t.points_airdrop||0}),e.jsx("td",{className:"px-4 py-3 text-sm text-orange-400",children:t.total_points_spent||0}),e.jsx("td",{className:"px-4 py-3 text-sm text-white/60",children:new Date(t.created_at*1e3).toLocaleDateString()}),e.jsx("td",{className:"px-4 py-3 text-sm",children:e.jsx("button",{onClick:()=>{const h=`/admin/generations?userId=${encodeURIComponent(t.id)}`;A()?window.open(h,"_blank"):(me(!1),f(h))},className:"text-accent hover:text-accent/80 underline",children:"æ¥çä½å"})})]},t.id)})})]}),We&&e.jsx("div",{className:"py-4 text-center text-white/40 text-sm",children:"å è½½æ´å¤..."})]}),e.jsxs("div",{onScroll:Ks,className:"md:hidden overflow-y-auto max-h-[60vh] px-4 py-2 space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap gap-2 pb-2 border-b border-white/10",children:[e.jsx("span",{className:"text-xs text-white/40 w-full mb-1",children:"æåºï¼"}),[{key:"balance",label:"积å"},{key:"generation_count",label:"次æ°"},{key:"points_paid",label:"ä»è´¹"},{key:"total_points_spent",label:"æ¶è´¹"}].map(({key:t,label:s})=>e.jsxs("button",{onClick:()=>Ue(t),className:`px-3 py-1 rounded-full text-xs transition-colors ${U===t?"bg-accent text-white":"bg-white/10 text-white/60 hover:bg-white/20"}`,children:[s," ",U===t&&"â"]},t))]}),Ye?e.jsx("div",{className:"py-12 text-center text-white/40",children:"å è½½ä¸..."}):Ne.length===0?e.jsx("div",{className:"py-12 text-center text-white/40",children:"ææ ç¨æ·"}):Ne.map(t=>{const s=t.is_paid===1,r=t.role==="admin";return e.jsxs("div",{className:`bg-white/5 border rounded-xl p-4 space-y-2 ${s?"border-yellow-500/30":"border-white/10"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("button",{onClick:()=>Fe(t.id),className:`flex items-center gap-1.5 font-semibold ${s?"text-yellow-400":r?"text-purple-400":"text-white"} hover:underline text-left`,children:[s&&e.jsx(ot,{className:"w-3.5 h-3.5 text-yellow-400 shrink-0"}),r&&e.jsx(Re,{className:"w-3.5 h-3.5 text-purple-400 shrink-0"}),t.nickname]}),e.jsxs("span",{className:"text-accent font-bold",children:[t.balance," 积å"]})]}),e.jsx("div",{className:`text-xs truncate ${s?"text-yellow-400/50":"text-white/50"}`,children:t.email}),e.jsxs("div",{className:"grid grid-cols-4 gap-2 text-xs pt-2 border-t border-white/10",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-white/40",children:"çæ"}),e.jsx("div",{className:"text-white",children:t.generation_count||0})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-white/40",children:"ä»è´¹"}),e.jsx("div",{className:"text-yellow-400",children:t.points_paid||0})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-white/40",children:"èµ å"}),e.jsx("div",{className:"text-green-400",children:t.points_gift||0})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-white/40",children:"æ¶è´¹"}),e.jsx("div",{className:"text-orange-400",children:t.total_points_spent||0})]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2 text-xs",children:[e.jsx("span",{className:"text-white/40",children:new Date(t.created_at*1e3).toLocaleDateString()}),e.jsx("button",{onClick:()=>{me(!1),f(`/admin/generations?userId=${encodeURIComponent(t.id)}`)},className:"text-accent hover:text-accent/80 text-xs",children:"æ¥çä½å â"})]})]},t.id)}),We&&e.jsx("div",{className:"py-4 text-center text-white/40 text-sm",children:"å è½½æ´å¤..."})]}),Ne.length>0&&e.jsxs("div",{className:"px-6 py-3 border-t border-white/10 text-sm text-white/50 flex justify-between",children:[e.jsxs("span",{children:["å·²å è½½ ",
11Ne.length," / ",gt," ä½ç¨æ·"]}),!wt&&e.jsx("span",{className:"text-green-400/60",children:"å·²æ¾ç¤ºå
¨é¨"})]})]})}),Aa&&e.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm z-50 flex items-center justify-center p-6",children:e.jsxs(k.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"bg-gray-900 border border-white/20 rounded-2xl max-w-4xl w-full max-h-[80vh] overflow-hidden",children:[e.jsxs("div",{className:"p-6 border-b border-white/10 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[e.jsx(Ke,{className:"w-6 h-6 text-yellow-400"}),"é请ç 管ç"]}),Pe&&e.jsxs("p",{className:"text-sm text-white/60 mt-1",children:["å
± ",Pe.total," 个 · ææ ",Pe.activeCount," 个 · å©ä½å¯ç¨ ",Pe.totalRemainingUses," 次"]})]}),e.jsx("button",{onClick:()=>os(!1),className:"text-white/60 hover:text-white",children:e.jsx(B,{className:"w-6 h-6"})})]}),e.jsx("div",{className:"p-6 border-b border-white/10",children:e.jsx("div",{className:"flex gap-2",children:["ALL","ACTIVE","EXHAUSTED"].map(t=>e.jsx("button",{onClick:()=>{La(t),Bs(t)},className:`px-4 py-2 rounded-lg transition-colors ${xs===t?"bg-yellow-500 text-white":"bg-white/5 text-white/60 hover:bg-white/10"}`,children:t==="ALL"?"å
¨é¨":t==="ACTIVE"?"ææ":"å·²ç¨å°½"},t))})}),e.jsx("div",{className:"p-6 overflow-y-auto max-h-[50vh]",children:Ye?e.jsx("div",{className:"text-center py-12 text-white/40",children:"å è½½ä¸..."}):ds.length===0?e.jsx("div",{className:"text-center py-12 text-white/40",children:"ææ é请ç "}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:ds.map(t=>e.jsxs("div",{className:`p-4 rounded-lg border ${t.used_count>=t.max_uses?"bg-white/5 border-white/10 opacity-50":"bg-yellow-500/10 border-yellow-500/20"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"font-mono text-lg tracking-widest",children:t.code}),t.used_count<t.max_uses&&e.jsx("button",{onClick:()=>{navigator.clipboard.writeText(t.code),alert("â
å·²å¤å¶")},className:"text-white/60 hover:text-yellow-400",children:e.jsx(ge,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsxs("span",{className:"text-yellow-400",children:[t.credit_amount," 积å"]}),e.jsxs("span",{className:t.remaining_uses>0?"text-green-400":"text-red-400",children:["å©ä½ ",t.remaining_uses,"/",t.max_uses," 次"]})]})]},t.code))})})]})}),Na&&e.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[60] flex items-center justify-center p-4",onClick:()=>be(!1),children:e.jsx(k.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},onClick:t=>t.stopPropagation(),className:"bg-gray-900 border border-white/20 rounded-2xl w-full max-w-md overflow-hidden shadow-2xl",children:va?e.jsx("div",{className:"p-8 text-center text-white/40",children:"å è½½ä¸..."}):p?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`p-5 border-b border-white/10 ${p.is_paid===1?"bg-gradient-to-r from-yellow-500/10 to-transparent":""}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:p.avatar_url||`https://api.dicebear.com/7.x/thumbs/svg?seed=${p.email}`,alt:"",className:"w-12 h-12 rounded-full border-2 border-white/10"}),e.jsxs("div",{children:[e.jsxs("div",{className:`flex items-center gap-1.5 font-bold text-lg ${p.is_paid===1?"text-yellow-400":p.role==="admin"?"text-purple-400":"text-white"}`,children:[p.is_paid===1&&e.jsx(ot,{className:"w-4 h-4 text-yellow-400"}),p.role==="admin"&&e.jsx(Re,{className:"w-4 h-4 text-purple-400"}),p.nickname]}),e.jsx("div",{className:`text-sm ${p.is_paid===1?"text-yellow-400/60":"text-white/50"}`,children:p.email})]})]}),e.jsx("button",{onClick:()=>be(!1),className:"text-white/40 hover:text-white",children:e.jsx(B,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/40",children:[e.jsxs("span",{children:["注åäº ",new Date(p.created_at*1e3).toLocaleDateString()]}),p.is_paid===1&&e.jsx("span",{className:"px-2 py-0.5 rounded-full bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"ä»è´¹ç¨æ·"}),p.role==="admin"&&e.jsx("span",{className:"px-2 py-0.5 rounded-full bg-purple-500/20 text-purple-400 border border-purple-500/30",children:"管çå"})]})]}),e.jsxs("div",{className:"p-5 space-y-4",children:[e.jsxs("div",{className:"text-center py-3 bg-white/5 rounded-xl border border-white/10",children:[e.jsx("div",{className:"text-3xl font-bold text-accent",children:p.balance?.toLocaleStr
11ing()}),e.jsx("div",{className:"text-xs text-white/40 mt-1",children:"å½å积åä½é¢"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"bg-white/5 rounded-lg p-3",children:[e.jsx("div",{className:"text-white/40 text-xs mb-1",children:"çææ¬¡æ°"}),e.jsx("div",{className:"text-white font-semibold",children:p.generation_count?.toLocaleString()||0})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-3",children:[e.jsx("div",{className:"text-white/40 text-xs mb-1",children:"累计æ¶è´¹"}),e.jsx("div",{className:"text-orange-400 font-semibold",children:p.total_points_spent?.toLocaleString()||0}),p.points_spent_images||p.points_spent_other?e.jsxs("div",{className:"text-[10px] text-white/35 mt-1 leading-snug",children:["å¾ ",(p.points_spent_images||0).toLocaleString()," · ","页/ææ¡£ ",(p.points_spent_other||0).toLocaleString()]}):null]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-3",children:[e.jsx("div",{className:"text-white/40 text-xs mb-1",children:"ä»è´¹å
å¼"}),e.jsx("div",{className:"text-yellow-400 font-semibold",children:p.points_paid?.toLocaleString()||0})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-3",children:[e.jsx("div",{className:"text-white/40 text-xs mb-1",children:"èµ å"}),e.jsx("div",{className:"text-green-400 font-semibold",children:p.points_gift?.toLocaleString()||0})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-3 col-span-2",children:[e.jsx("div",{className:"text-white/40 text-xs mb-1",children:"空æ"}),e.jsx("div",{className:"text-emerald-400 font-semibold",children:p.points_airdrop?.toLocaleString()||0})]})]}),p.role!=="admin"&&e.jsxs("div",{className:"bg-white/5 rounded-xl p-4 border border-white/10 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-white/80",children:[e.jsx(Re,{className:"w-4 h-4 text-accent"}),"å
容æé"]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm text-white/90",children:"å
许å
¬å¼ä½å"}),e.jsx("div",{className:"text-xs text-white/40 leading-snug",children:"å
³éåç«å³ä¸æ¶å
¶å
¨é¨å
¬å¼ä½åï¼ä¸æ æ³åå
¬å¼"})]}),e.jsx("button",{onClick:()=>Rs("can_publish",p.can_publish===0),className:`relative shrink-0 w-12 h-6 rounded-full transition-colors ${p.can_publish!==0?"bg-green-500":"bg-gray-600"}`,title:p.can_publish!==0?"ç¹å»éå¶å
¬å¼":"ç¹å»æ¢å¤å
¬å¼",children:e.jsx("div",{className:`absolute top-0.5 w-5 h-5 bg-white rounded-full transition-transform ${p.can_publish!==0?"left-6":"left-0.5"}`})})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm text-white/90",children:"å
许ç§å¯å享"}),e.jsx("div",{className:"text-xs text-white/40 leading-snug",children:"å
³éååéå
¶å
¨é¨åäº«é¾æ¥ï¼ä¸æ æ³åçæ"})]}),e.jsx("button",{onClick:()=>Rs("can_share",p.can_share===0),className:`relative shrink-0 w-12 h-6 rounded-full transition-colors ${p.can_share!==0?"bg-green-500":"bg-gray-600"}`,title:p.can_share!==0?"ç¹å»éå¶å享":"ç¹å»æ¢å¤å享",children:e.jsx("div",{className:`absolute top-0.5 w-5 h-5 bg-white rounded-full transition-transform ${p.can_share!==0?"left-6":"left-0.5"}`})})]}),(p.can_publish===0||p.can_share===0)&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-red-400 bg-red-500/10 border border-red-500/20 rounded-lg px-2.5 py-1.5",children:[e.jsx(rl,{className:"w-3.5 h-3.5 shrink-0"}),"å·²éå¶",p.can_publish===0?"å
¬å¼":"",p.can_publish===0&&p.can_share===0?" ä¸ ":"",p.can_share===0?"å享":""]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:()=>{A()?window.open(`/admin?ledgerUser=${encodeURIComponent(p.email)}`,"_blank"):(be(!1),me(!1),Je(p.email),pt("ALL"),X("ALL",!1,p.email),setTimeout(()=>{document.getElementById("ledger-section")?.scrollIntoView({behavior:"smooth"})},100))},className:"flex-1 flex items-center justify-center gap-2 px-4 py-2.5 bg-white/5 border border-white/10 rounded-xl text-sm text-white/70 hover:bg-white/10 hover:text-white transition-colors",children:[e.jsx(dt,{className:"w-4 h-4"}),"æ¥çæµæ°´"]}),e.jsxs("button",{onClick:()=>{const t=`/admin/generations?userId=${encodeURIComponent(p.id)}`;A()?window.open(t,"_blank"):(be(!1),me(!1),f(t))},className:"flex-1 flex items-center justify-center gap-2 px-4 py-2.5 bg-accent/20 border border-accent/30 rounded-xl text-sm text-accent hover:bg-accent/30 transition-colors",children:[e.jsx(qs,{className:"w-4 h-4"}),"æ¥çä½å"]})]}),e.jsxs("button",{onClick:()=>{const t=`/profile/${p.id}`;A()?window.open(t,"_blank"):(be(!1),me(!1),f(t))},className:"w-full flex items-center justify-center gap-2 px-4 py-2.5 bg-white/5 border border-white/10 rounded-xl text-sm text-white/50 hover:bg-white/10 hover:text-white/70 transition-colors",children:[e.jsx(Tt,{className:"w-4 h-4"}),"æ¥çå
¬å¼ä¸»é¡µ"]})]})]}):e.jsx("div",{className:"p-8 text-center text-white/40",children:"ç¨æ·ä¸åå¨"})})}),ka&&e.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[60] flex items-center justify-center p-4",onClick:()=>Xe(!1),children:e.jsx(k.div,{initial:{opacity:0,scale:.95}
11,animate:{opacity:1,scale:1},onClick:t=>t.stopPropagation(),className:"bg-gray-900 border border-white/20 rounded-2xl w-full max-w-lg overflow-hidden shadow-2xl max-h-[85vh] overflow-y-auto",children:Ca?e.jsx("div",{className:"p-8 text-center text-white/40",children:"å è½½ä¸..."}):g?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`p-5 border-b border-white/10 flex items-center justify-between ${g.status==="success"?"bg-green-500/5":g.status==="failed"?"bg-red-500/5":""}`,children:[e.jsxs("div",{children:[e.jsxs("div",{className:"font-bold text-lg text-white flex items-center gap-2",children:[e.jsx("span",{className:g.status==="success"?"text-green-400":g.status==="failed"?"text-red-400":"text-yellow-400",children:g.status==="success"?"ð¢":g.status==="failed"?"ð´":"ð¡"}),"çæä»»å¡è¯¦æ
"]}),e.jsx("div",{className:"text-xs text-white/40 mt-1 font-mono",children:g.id})]}),e.jsx("button",{onClick:()=>Xe(!1),className:"text-white/40 hover:text-white",children:e.jsx(B,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-5 space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{className:"bg-white/5 rounded-lg p-3",children:[e.jsx("div",{className:"text-white/40 text-xs mb-1",children:"模å"}),e.jsx("div",{className:"text-white font-medium",children:g.modelId})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-3",children:[e.jsx("div",{className:"text-white/40 text-xs mb-1",children:"éé"}),e.jsx("div",{className:"text-white font-medium",children:g.provider})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-3",children:[e.jsx("div",{className:"text-white/40 text-xs mb-1",children:"积å"}),e.jsxs("div",{className:"text-yellow-400 font-medium",children:[g.pointsCost,"pt"]})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-3",children:[e.jsx("div",{className:"text-white/40 text-xs mb-1",children:"èæ¶"}),e.jsx("div",{className:"text-white font-medium",children:g.completedAt&&g.createdAt?`${g.completedAt-g.createdAt}s`:"-"})]})]}),g.config&&Object.keys(g.config).length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-white/40 mb-2 font-medium",children:"é
ç½®åæ°"}),e.jsx("div",{className:"bg-white/5 rounded-lg p-3 flex flex-wrap gap-2",children:Object.entries(g.config).map(([t,s])=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-white/5 rounded text-xs border border-white/10",children:[e.jsxs("span",{className:"text-white/40",children:[t,":"]}),e.jsx("span",{className:"text-white/80",children:String(s)})]},t))})]}),g.prompt&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"text-xs text-white/40 font-medium",children:"æç¤ºè¯"}),Hs(g.config)&&e.jsx("span",{className:"px-2 py-0.5 rounded-full bg-[#f6973d]/10 border border-[#f6973d]/30 text-[10px] text-[#f6973d] font-medium",children:"AI 帮å"})]}),e.jsx("div",{className:"bg-white/5 rounded-lg p-3 text-sm text-white/80 whitespace-pre-wrap break-words max-h-40 overflow-y-auto border border-white/10",children:g.prompt})]}),(()=>{const t=Hs(g.config);return t?e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 flex-wrap",children:[e.jsx("span",{className:"text-xs text-white/40 font-medium",children:"ç¨æ·åå§æå¾"}),t.technique&&e.jsxs("span",{className:"px-2 py-0.5 rounded-full bg-white/5 border border-white/10 text-[10px] text-white/50",children:["ææ³ · ",t.technique]}),t.translated&&e.jsx("span",{className:"px-2 py-0.5 rounded-full bg-white/5 border border-white/10 text-[10px] text-white/50",children:"åç»ç¿»è¯"}),e.jsx("span",{className:`px-2 py-0.5 rounded-full text-[10px] border ${t.aiPrompt?"bg-amber-500/10 border-amber-500/30 text-amber-400":"bg-emerald-500/10 border-emerald-500/30 text-emerald-400"}`,children:t.aiPrompt?"æäº¤åæ¹è¿":"AI åç¨¿ç´æ¥ç¨"})]}),e.jsx("div",{className:"bg-[#f6973d]/[0.06] rounded-lg p-3 text-sm text-white/80 whitespace-pre-wrap break-words max-h-32 overflow-y-auto border border-[#f6973d]/20",children:t.intent}),t.aiPrompt&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-xs text-white/40 mb-2 mt-3 font-medium",children:"AI åçå稿ï¼ç¨æ·æäº¤åæ¹è¿ï¼"}),e.jsx("div",{className:"bg-white/5 rounded-lg p-3 text-xs text-white/55 whitespace-pre-wrap break-words max-h-40 overflow-y-auto border border-white/10",children:t.aiPrompt})]})]}):null})(),(g.baseImageUrl||g.referenceImageUrls&&g.referenceImageUrls.length>0)&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-white/40 mb-2 font-medium",children:"è¾å
¥å¾ç"}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[g.baseImageUrl&&e.jsxs("div",{className:"relative group",children:[e.jsx("div",{className:"text-[10px] text-white/30 mb-1",children:"åºå¾"}),e.jsx("a",{href:g.baseImageUrl,target:"_blank",rel:"noopener noreferrer",children:e.jsx("img",{src:Lt(g.baseImageUrl,{width:256,height:256,fit:"cover",quality:70}),alt:"åºå¾",className:"w-24 h-24 md:w-32 md:h-32 object-cover rounded-lg border border-white/10 hover:border-accent/50 transition-colors cursor-pointer"})})]}),g.referenceImageUrls?.map((t,s)=>e.jsxs("div",{className:"relative group",children:[e.jsxs("div",{className:"text-[10px] text-white/30 mb-1",children:["åèå¾ ",s+1]}),e.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",children:e.jsx("img",{src:Lt(t,{width:256,height:256,fit:"cover",quality:70}),alt:`åèå¾ ${s+1}`,className:"w-24 h-24 md:w-32 md:h-32 object-cover rounded-lg border border-white/10 hover:border-accent/50 transition-colors cursor-pointer"})})]},s))]})]}),g.status==="success"&&(g.resultThumbnailUrl||g.resultImageUrl)&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-white/40 mb-2 font-medium",children:"çæç»æ"}),e.jsx("a",{href:g.resultImageUrl,target:"_blank",rel:"noopener noreferrer",children:e.jsx("img",{src:g.resultThumbnailUrl||Lt(g.resultImageUrl,{width:400,height:400,fit:"contain",quality:75}),alt:"çæç»æ",className:"max-w-full max-h-48 rounded-lg border border-white/10 hover:border-green-500/50 transition-colors cursor-pointer"})})]}),g.status==="failed"&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-white/40 mb-2 font-medium",children:"é误信æ¯"}),e.jsxs("div",{className:"bg-red-500/10 border border-red-500/20 rounded-lg p-3 text-sm",children:[e.jsx("div",{className:"text-red-400 font-medium mb-1",children:g.errorCode}),e.jsx("div",{className:"text-red-400/70 text-xs break-words",children:g.errorMessage})]})]}),e.jsxs("div",{className:"text-xs text-white/30 space-y-1 pt-2 border-t border-white/10",children:[e.jsxs("div",{children:["å建: ",g.createdAt?new Date(g.createdAt*1e3).toLocaleStr
11ing("zh-CN"):"-"]}),g.startedAt&&e.jsxs("div",{children:["å¼å§: ",new Date(g.startedAt*1e3).toLocaleString("zh-CN")]}),g.completedAt&&e.jsxs("div",{children:["宿: ",new Date(g.completedAt*1e3).toLocaleString("zh-CN")]})]})]})]}):e.jsx("div",{className:"p-8 text-center text-white/40",children:"ä»»å¡ä¸åå¨ï¼ä» 弿¥çæçä»»å¡å¯æ¥çåæ°ï¼"})})}),e.jsx(xl,{open:ua,onClose:()=>Zt(!1)})]})}function hl(){const[x,w]=a.useState([]),[L,G]=a.useState(5),[F,f]=a.useState("5"),[A,D]=a.useState(!0),[P,M]=a.useState(!1),[S,O]=a.useState("vertex"),[T,R]=a.useState(""),[W,m]=a.useState(""),[V,E]=a.useState(""),[le,Y]=a.useState(""),[we,q]=a.useState(!1),[j,y]=a.useState(null),[o,n]=a.useState("600"),b=()=>localStorage.getItem("jwt_token")||"",u=async()=>{try{D(!0);const l=await Ur(b());w(l.credentials),G(l.concurrency),f(String(l.concurrency)),y(l.queue??null),l.queue&&n(String(l.queue.waitMaxS))}catch(l){console.error("[ComposePool] load failed",l)}finally{D(!1)}};a.useEffect(()=>{u()},[]);const N=async()=>{if(!T.trim()){alert("请填ååç§°");return}try{q(!0),await Rr(b(),{route:S,label:T.trim(),api_key:S==="vertex"?W.trim():void 0,project_id:S==="vertex"?V.trim():void 0,credentials_json:S==="vertex-iam"?le.trim():void 0}),R(""),m(""),E(""),Y(""),M(!1),await u()}catch(l){alert("æ·»å 失败ï¼"+(l?.message||l))}finally{q(!1)}},v=async l=>{try{await re(b(),{id:l.id,setActive:!0}),await u()}catch(d){alert("æä½å¤±è´¥ï¼"+(d?.message||d))}},ie=async()=>{const l=Math.max(1,Math.min(20,parseInt(F,10)||5));if(f(String(l)),l!==L)try{await re(b(),{concurrency:l}),await u()}catch(d){alert("ä¿å失败ï¼"+(d?.message||d))}},Z=async l=>{try{await re(b(),{id:l.id,resetFailures:!0}),await u()}catch(d){alert("æä½å¤±è´¥ï¼"+(d?.message||d))}},ht=async()=>{if(!j)return;const l=!j.enabled;if(!(!l&&!confirm("å ³ééå = æææ¹ééºå¾ç«å³åéç´åï¼æ éæµä¿æ¤ï¼ãç¡®è®¤å ³éï¼")))try{await re(b(),{queueEnabled:l}),await u()}catch(d){alert("æä½å¤±è´¥ï¼"+(d?.message||d))}},fe=async()=>{if(!j)return;const l=Math.max(60,Math.min(3600,parseInt(o,10)||600));if(n(String(l)),l!==j.waitMaxS)try{await re(b(),{queueWaitMaxS:l}),await u()}catch(d){alert("ä¿å失败ï¼"+(d?.message||d))}},mt=async(l,d)=>{const de=prompt(`设置 ${l} çåå§å¨é£ä¸é targetï¼1-50ï¼ï¼ 12æ 429 ä¼ä¸´æ¶éæ¡£ï¼éé» 5 åéèªå¨åæ¤å¼`,String(d));if(de===null)return;const $=parseInt(de.trim(),10);if(!Number.isFinite($)||$<1){alert("æ ææ°å¼");return}try{await re(b(),{limiter:{modelId:l,target:$}}),await u()}catch(ce){alert("设置失败ï¼"+(ce?.message||ce))}},ne=async(l,d)=>{const de=prompt(`设置 ${l} çåå§åå°é´é spacingï¼æ¯«ç§ï¼0-10000ï¼ï¼ 13两次åå°çæå°é´éï¼æ 429 æ¯æ¡£ +300msï¼éé» 5 åé忤å¼`,String(d));if(de===null)return;const $=parseInt(de.trim(),10);if(!Number.isFinite($)||$<0){alert("æ ææ°å¼");return}try{await re(b(),{limiter:{modelId:l,spacing:$}}),await u()}catch(ce){alert("设置失败ï¼"+(ce?.message||ce))}},bt=async l=>{if(confirm(`æ ${l} é置为åå§å¼ï¼ï¼æ¸ æå½å 429 éé¿ï¼çæå¼ç«å»åå°ä½ 设çåå§ target / spacingï¼`))try{await re(b(),{limiter:{modelId:l,reset:!0}}),await u()}catch(d){alert("é置失败ï¼"+(d?.message||d))}},oe=l=>{if(!l)return"â";const d=Math.max(0,Math.floor((Date.now()/1e3-l)/60));return d<1?"åå":d<60?`${d} åéå`:d<1440?`${Math.floor(d/60)} å°æ¶å`:"å¾ä¹ å"},Oe=async l=>{if(confirm(`确认å é¤ééã${l.label}ã(${l.projectId||"?"})ï¼`))try{await Kr(b(),l.id),await u()}catch(d){alert("å é¤å¤±è´¥ï¼"+(d?.message||d))}},_e=l=>x.filter(d=>d.route===l);return e.jsxs(k.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"w-full bg-gradient-to-br from-white/[0.08] to-white/[0.02] backdrop-blur-sm border border-white/10 rounded-2xl p-6 mb-6 hover:border-white/20 transition-colors",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-2",children:[e.jsxs("h2",{className:"text-xl font-bold flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-teal-500 to-emerald-500 flex items-center justify-center shadow-lg",children:e.jsx(sa,{className:"w-5 h-5 text-white"})}),"Compose çå¾éé"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-white/50",children:"å¹¶åæ°"}),e.jsx("input",{value:F,onChange:l=>f(l.target.value),onBlur:ie,title:"å个工ä½ééå çå¹¶åæ° Kï¼1â20ï¼é»è®¤ 5ï¼",className:"w-14 px-2 py-1 text-sm text-center bg-white/5 border border-white/15 rounded text-white focus:outline-none focus:border-emerald-400"}),e.jsxs("button",{onClick:()=>M(l=>!l),className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-emerald-500/15 hover:bg-emerald-500/25 border border-emerald-400/30 text-emerald-200 rounded-lg transition-colors",children:[e.jsx(Ge,{className:"w-4 h-4"})," æ·»å éé"]})]})]}),e.jsxs("p",{className:"text-white/50 text-sm mb-4",children:["ä¸ä¾æ¼ç¤ºï¼Composeï¼æ¹ééºå¾ï¼ä¸ Studio ééæ± ç©çåå¼ã",e.jsx("b",{children:"å¯å¡«å¤æ¡ï¼ä½ä»£ç åªè®¤ä¸æ¡ãå·¥ä½ééã"}),"ï¼ä»»ææ¶å»åªæè¿ä¸ä¸ª GCP projectï¼æç»å¤ project åæ¶å¹¶å=Google ToS è¿è§ãä¼å°å·ï¼ã",e.jsx("b",{children:"æªè®¾å·¥ä½ééæ¶ï¼æ¼ç¤ºèªå¨åé串è¡ï¼ç¨ Studio 飿¡ééï¼ã"}),"éå管家ä¸çº¿åãå¹¶åæ° Kãçè§è² = ",e.jsx("b",{children:"æ¯ä¸ªç¨æ·"}),"å端并è¡å¤çå¼ æ°ï¼å¤©ç¶çæ¯ç¨æ·å ¬å¹³ä¸éï¼ï¼ çæ£æå Google çå ¨å±èæµå¨ä¸æ¹ãéå管家ãç targetã"]}),j&&e.jsxs("div",{className:"bg-black/25 rounded-xl p-4 border border-white/10 mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5 flex-wrap gap-2",children:[e.jsx("div",{className:"text-sm font-semibold text-white/80",children:"ð¦ éåç®¡å®¶ï¼æ¹ééºå¾éæµï¼"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs",children:[e.jsxs("label",{className:"flex items-center gap-1.5 text-white/60",children:["æéä¸é",e.jsx("input",{value:o,onChange:l=>n(l.target.value),onBlur:fe,title:"任塿éè¶ è¿æ¤ç§æ° â 主å¨å¤±è´¥é款ï¼60-3600ï¼",className:"w-16 px-2 py-1 text-center bg-white/5 border border-white/15 rounded text-white focus:outline-none focus:border-emerald-400"}),"ç§"]}),e.jsx("button",{onClick:ht,className:`px-3 py-1 rounded-lg border transition-colors ${j.enabled?"bg-emerald-500/15 border-emerald-400/30 text-emerald-200 hover:bg-emerald-500/25":"bg-red-500/15 border-red-400/35 text-red-200 hover:bg-red-500/25"}`,title:"çäº§åæ»é¸ï¼å ³éåæææ¹ééºå¾ç«å³åéç´åï¼å é¨ç½²ç§çº§çæï¼",children:j.enabled?"éåè¿è¡ä¸":"å·²å ³éï¼ç´åï¼"})]})]}),e.jsx("p",{className:"text-[11px] text-white/40 mb-2.5",children:"target = åæ¶æå Google çå ¨å±å¨é£ä¸éï¼é´é = 两次åå°çæå° spacingãæ 429 â èªå¨ targetâ1ãé´é +300msï¼æ¸è¿éé¿ï¼ï¼ éé» 5 åéæ 429 â èªå¨åå°ä½ 设çåå§å¼ï¼ææ¶é´èªæï¼ä¸æ°æåï¼ããéç½®ã= ç«å³æ¸ æéé¿ååå§ãå ³ééå = åæ»é¸ï¼ç§çº§åç´åï¼ã"}),e.jsx("div",{className:"space-y-1",children:j.limiters.map(l=>{const d=l.backoff>0;return e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-1.5 sm:gap-3 text-xs bg-white/[0.03] rounded-lg px-3 py-2 sm:py-1.5",children:[e.jsx("span",{className:"sm:w-40 shrink-0 font-mono text-white/70 break-all",children:l.modelId}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 flex-1 min-w-0",children:[e.jsxs("span",{className:"sm:w-28 shrink-0",children:["target ",e.jsx("b",{className:d?"text-amber-300":"text-emerald-300",children:l.effectiveTarget}),d&&e.jsxs("span",{className:"text-white/35",children:[" â",l.initTarget]}),e.jsxs("span",{className:"text-white/35",children:["/",l.maxTarget]})]}),e.jsxs("span",{className:"sm:w-28 shrink-0",children:["é´é ",e.jsx("b",{className:d?"text-amber-300":"text-white/70",children:l.effectiveSpacing}),d&&e.jsxs("span",{className:"text-white/35",children:[" â",l.initSpacing]}),e.jsx("span",{className:"text-white/35",children:"ms"})]}),e.jsxs("span",{className:"sm:w-28 shrink-0 text-white/45",children:["æè¿429ï¼",oe(l.last429At)]}),e.jsx("span",{className:"sm:flex-1 text-white/45",children:d?`éé¿æ¡£ ${l.backoff}`:"å¥åº·"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("button",{onClick:()=>mt(l.modelId,l.initTarget),className:"px-2 py-0.5 rounded bg-white/8 hover:bg-white/15 border border-white/15 text-white/70 transition-colors",children:"设 target"}),e.jsx("button",{onClick:()=>ne(l.modelId,l.initSpacing),className:"px-2 py-0.5 rounded bg-white/8 hover:bg-white/15 border border-white/15 text-white/70 transition-colors",children:"设 é´é"}),e.jsx("button",{onClick:()=>bt(l.modelId),className:"px-2 py-0.5 rounded bg-white/5 hover:bg-white/12 border border-white/10 text-white/50 transition-colors",children:"éç½®"})]})]},l.modelId)})})]}),P&&e.jsxs("div",{className:"bg-black/25 rounded-xl p-4 border border-white/10 mb-4 space-y-3",children:[e.jsx("div",{className:"flex gap-2",children:["vertex","vertex-iam"].map(l=>e.jsx("button",{onClick:()=>O(l),className:`px-3 py-1.5 rounded-lg text-xs border transition-all ${S===l?"bg-emerald-500/20 border-emerald-400/40 text-emerald-300":"bg-white/5 border-white/10 text-white/50"}`,children:l==="vertex"?"æäºå¼æ · Express API":"ç©éµå¼æ · IAM JSON"},l))}),e.jsx("input",{value:T,onChange:l=>R(l.target.value),placeholder:"ééåç§°ï¼èªå®ä¹ï¼ä¾¿äºè¾¨è®¤ï¼",className:"w-full bg-white/5 border border-white/15 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-emerald-400"}),S==="vertex"?e.jsxs(e.Fragment,{children:[e.jsx("input",{value:W,onChange:l=>m(l.target.value),placeholder:"Vertex Express API Key",className:"w-full bg-white/5 border border-white/15 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-emerald-400"}),e.jsx("input",{value:V,onChange:l=>E(l.target.value),placeholder:"GCP Project IDï¼å¹¶ååå ï¼å¡å¿ ä¸åï¼",className:"w-full bg-white/5 border border-white/15 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-emerald-400"})]}):e.jsx("textarea",{value:le,onChange:l=>Y(l.target.value),placeholder:"Service Account JSONï¼å« project_id / client_email / private_keyï¼",rows:4,className:"w-full bg-white/5 border border-white/15 rounded-lg px-3 py-2 text-white text-xs font-mono focus:outline-none focus:border-emerald-400"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:N,disabled:we,className:"px-4 py-2 text-sm bg-emerald-500/20 hover:bg-emerald-500/30 border border-emerald-400/30 text-emerald-200 rounded-lg disabled:opacity-50",children:we?"æ·»å ä¸...":"确认添å "}),e.jsx("button",{onClick:()=>M(!1),className:"px-4 py-2 text-sm bg-white/5 hover:bg-white/10 border border-white/10 text-white/60 rounded-lg",children:"åæ¶"})]})]}),A?e.jsx("div",{className:"text-center py-6 text-white/40 text-sm",children:"å è½½ä¸..."}):x.length===0?e.jsx("div",{className:"text-center py-6 text-white/30 text-sm",children:"å°æªé 置任ä½éé ââ æ¼ç¤ºæ¹ééºå¾å½å走串è¡åéãç¹ãæ·»å ééãå¼å§ã"}):e.jsx("div",{className:"space-y-4",children:["vertex","vertex-iam"].map(l=>_e(l).length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-white/45 mb-2",children:l==="vertex"?"ð¥ï¸ æäºå¼æ · Vertex Express API":"ð· ç©éµå¼æ · Vertex IAM JSON"}),e.jsx("div",{className:"space-y-2",children:_e(l).map(d=>e.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 rounded-lg border transition-all ${d.isActive?"bg-emerald-500/12 border-emerald-400/45":"bg-white/5 border-white/10"}`,children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"text-sm text-white truncate",children:[d.label,d.isActive&&e.jsx("span",{className:"ml-2 text-[11px] text-emerald-300",children:"â å·¥ä½ä¸"}),d.consecutiveFailures>0&&e.jsxs("span",{className:"ml-2 text-[11px] text-amber-300/80",children:["失败Ã",d.consecutiveFailures]})]}),e.jsxs("div",{className:"text-[11px] text-white/40 truncate",children:["projectï¼",d.projectId||"â",d.apiKeyMasked?` · key ${d.apiKeyMasked}`:"",d.clientEmailMasked?` · ${d.clientEmailMasked}`:""]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[d.consecutiveFailures>0&&e.jsx("button",{onClick:()=>Z(d),className:"px-2 py-1 text-[11px] bg-white/5 hover:bg-white/10 border border-white/10 text-white/60 rounded",children:"éç½®"}),d.isActive?e.jsx("span",{className:"px-2 py-1 text-[11px] rounded border bg-emerald-500/15 border-emerald-400/30 text-emerald-300",children:"å·¥ä½ä¸"}):e.jsx("button",{onClick:()=>v(d),className:"px-2 py-1 text-[11px] rounded border bg-white/5 hover:bg-emerald-500/15 border-white/10 hover:border-emerald-400/30 text-white/60 hover:text-emerald-300 transition-colors",children:"设为工ä½éé"}),e.jsx("button",{onClick:()=>Oe(d),className:"px-2 py-1 text-[11px] bg-red-500/10 hover:bg-red-500/20 border border-red-400/25 text-red-300 rounded",children:"å é¤"})]})]},d.id))})]},l))}),e.jsxs("div",{className:"text-xs text-white/40 mt-3",children:["ð¡ 填夿¡åªä¸ºæ¹ä¾¿åæ¢ï¼æ¯å¦æ project 被éé/å°äºï¼ç¹ã设为工ä½ééãç§åå¤ç¨ï¼ã",e.jsx("b",{children:"ä»»ææ
13¶å»åªæä¸æ¡å·¥ä½ééå¨è¢«è°ç¨"}),"ââå¹¶ååªå¨å®å
é¨ãç±å¹¶åæ° K æ§å¶ï¼å»ºè®®å
5ï¼è§å¯ 429 åè°ï¼ã",e.jsx("b",{children:'ç»ä¸è¦ä¸ºäº"åé度"å»å¡«åä¸ä¸ªè°·æè´¦å·çå¤ä¸ª project å¹¶åââ飿£æ¯ä¸æ¬¡å°å·çåå ã'})]})]})}function ml(){const[x,w]=a.useState(Mr()),[L,G]=a.useState(!0),[F,f]=a.useState(!1),[A,D]=a.useState(!1),[P,M]=a.useState(!1),[S,O]=a.useState(!1);a.useEffect(()=>{(async()=>{try{const n=localStorage.getItem("jwt_token")||"",b=await ta(n);if(b.settings?.promo_config?.value)try{const u=JSON.parse(b.settings.promo_config.value);w(u)}catch{console.warn("[PromoMgmt] Failed to parse promo_config from settings")}}catch(n){console.error("[PromoMgmt] Failed to load:",n)}finally{G(!1)}})()},[]);const T=async o=>{try{f(!0);const n=localStorage.getItem("jwt_token")||"";return await Br(n,o),!0}catch(n){return alert("ä¿å失败ï¼"+n.message),!1}finally{f(!1)}},R=async()=>{await T(x)&&alert("â
ä¿éé
置已ä¿åå°æ°æ®åº")},W=async()=>{const o={...x,enabled:!x.enabled};w(o),await T(o)},m=(o,n,b)=>{w(u=>({...u,tiers:u.tiers.map((N,v)=>v===o?{...N,[n]:b}:N)}))},V=()=>{w(o=>({...o,tiers:[...o.tiers,{startDate:"",endDate:"",label:"",bonusPerHundred:0}],modalContent:{...o.modalContent,tiers:[...o.modalContent.tiers,{period:"",examples:[""]}]}}))},E=o=>{w(n=>({...n,tiers:n.tiers.filter((b,u)=>u!==o),modalContent:{...n.modalContent,tiers:n.modalContent.tiers.filter((b,u)=>u!==o)}}))},le=(o,n,b)=>{w(u=>({...u,modalContent:{...u.modalContent,tiers:u.modalContent.tiers.map((N,v)=>v===o?{...N,[n]:b}:N)}}))},Y=(o,n,b)=>{w(u=>({...u,modalContent:{...u.modalContent,tiers:u.modalContent.tiers.map((N,v)=>v===o?{...N,examples:N.examples.map((ie,Z)=>Z===n?b:ie)}:N)}}))},we=o=>{w(n=>({...n,modalContent:{...n.modalContent,tiers:n.modalContent.tiers.map((b,u)=>u===o?{...b,examples:[...b.examples,""]}:b)}}))},q=(o,n)=>{w(b=>({...b,modalContent:{...b.modalContent,tiers:b.modalContent.tiers.map((u,N)=>N===o?{...u,examples:u.examples.filter((v,ie)=>ie!==n)}:u)}}))},j="w-full bg-white/5 border border-white/20 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-accent transition-colors",y="block text-xs text-white/50 mb-1 font-medium";return e.jsxs(e.Fragment,{children:[e.jsxs(k.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.32},className:"w-full bg-gradient-to-br from-white/[0.08] to-white/[0.02] backdrop-blur-sm border border-white/10 rounded-2xl p-6 mb-6 hover:border-white/20 transition-colors",children:[e.jsxs("div",{className:`flex items-center justify-between ${S?"mb-5":""}`,children:[e.jsxs("button",{type:"button",onClick:()=>O(o=>!o),className:"flex items-center gap-3 group",children:[e.jsxs("h2",{className:"text-xl font-bold flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-red-500 to-amber-500 flex items-center justify-center shadow-lg",children:e.jsx(dl,{className:"w-5 h-5 text-white"})}),"ä¿ééç¥ç®¡ç"]}),!S&&!L&&e.jsx("span",{className:`text-xs px-2 py-0.5 rounded font-medium ${nt(x)?"bg-green-500/20 text-green-400":x.enabled?"bg-yellow-500/20 text-yellow-400":"bg-gray-500/20 text-gray-400"}`,children:nt(x)?"è¿è¡ä¸":x.enabled?"æªå°æ¶é´":"å·²å
³é"}),e.jsx(Wr,{className:`w-4 h-4 text-white/40 group-hover:text-white/80 transition-transform ${S?"rotate-180":""}`})]}),S&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>D(!A),className:`flex items-center gap-1.5 px-3 py-2 rounded-lg text-xs font-medium transition-all ${A?"bg-amber-500/20 text-amber-300 border border-amber-500/30":"bg-white/5 text-white/60 border border-white/10 hover:bg-white/10"}`,children:[e.jsx(Tt,{className:"w-3.5 h-3.5"}),A?"å
³éé¢è§":"Banner é¢è§"]}),e.jsxs("button",{onClick:()=>M(!0),className:"flex items-center gap-1.5 px-3 py-2 rounded-lg text-xs font-medium bg-white/5 text-white/60 border border-white/10 hover:bg-white/10 transition-all",children:[e.jsx(Tt,{className:"w-3.5 h-3.5"}),"å¼¹çªé¢è§"]})]})]}),S&&L&&e.jsx("div",{className:"text-white/40 text-sm",children:"å è½½ä¿éé
ç½®ä¸..."}),S&&!L&&e.jsxs(e.Fragment,{children:[A&&e.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden border border-amber-500/20",children:[e.jsx("div",{className:"text-xs text-amber-300/60 px-3 py-1 bg-amber-500/5 border-b border-amber-500/10",children:"â¬ï¸ é¢è§æ¨¡å¼ â 以䏿¯ç¨æ·çå°çææ"}),e.jsx(Tr,{config:x,forceShow:!0,onClickDetail:()=>M(!0)})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-3 h-3 rounded-full ${x.enabled?"bg-green-500 animate-pulse":"bg-gray-500"}`}),e.jsx("span",{className:"font-medium text-sm",children:"æ´»å¨å¼å
³"}),e.jsx("span",{className:`text-xs px-2 py-0.5 rounded font-medium ${nt(x)?"bg-green-500/20 text-green-400":x.enabled?"bg-yellow-500/20 text-yellow-400":"bg-gray-500/20 text-gray-400"}`,children:nt(x)?"è¿è¡ä¸":x.enabled?"æªå°æ¶é´":"å·²å
³é"})]}),e.jsx("button",{onClick:W,disabled:F,className:`relative w-14 h-7 rounded-full transition-colors ${x.enabled?"bg-green-500":"bg-gray-600"}`,children:e.jsx("div",{className:`absolute top-0.5 w-6 h-6 bg-white rounded-full transition-transform ${x.enabled?"left-7":"left-0.5"}`})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:y,children:"æ´»å¨ ID"}),e.jsx("input",{className:j,value:x.id,onChange:o=>w(n=>({...n,id:o.target.value})),placeholder:"å¦ï¼may-day-2026"})]}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"仿¥æ¥æ"}),e.jsx("div",{className:"text-sm text-white/60 py-2 font-mono",children:Er()})]})]})]}),e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5 space-y-3",children:[e.jsx("span",{className:"text-sm font-medium text-white/80",children:"Banner ææ¡"}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"主æ é¢"}),e.jsx("input",{className:j,value:x.title,onChange:o=>w(n=>({...n,title:o.target.value})),placeholder:"ð¥ äºä¸å
å¼ç¹æ "})]}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"坿 é¢"}),e.jsx("input",{className:j,value:x.subtitle,onChange:o=>w(n=>({...n,subtitle:o.target.value})),placeholder:"å
10 å
æé«å¾ 180 积åï¼"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:y,children:"å¼å§æ¥æ"}),e.jsx("input",{type:"date",className:j,value:x.startDate,onChange:o=>w(n=>({...n,startDate:o.target.value}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"ç»ææ¥æ"}),e.jsx("input",{type:"date",className:j,value:x.endDate,onChange:o=>w(n=>({...n,endDate:o.target.value}))})]})]})]}),e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium text-white/80",children:"ä¿éæ¡£ä½"}),e.jsxs("button",{onClick:V,className:"flex items-center gap-1 text-xs text-accent hover:text-accent/80 transition-colors",children:[e.jsx(Ge,{className:"w-3.5 h-3.5"})," æ·»å æ¡£ä½"]})]}),x.tiers.map((o,n)=>e.jsxs("div",{className:"bg-white/[0.02] border border-white/5 rounded-lg p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-white/40",children:["æ¡£ä½ ",n+1]}),e.jsx("button",{onClick:()=>E(n),className:"text-red-400/60 hover:text-red-400 transition-colors",children:e.jsx(B,{className:"w-3.5 h-3.5"})})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:y,children:"å¼å§"}),e.jsx("input",{type:"date",className:j,value:o.startDate,onChange:b=>m(n,"startDate",b.target.value)})]}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"ç»æ"}),e.jsx("input",{type:"date",className:j,value:o.endDate,onChange:b=>m(n,"endDate",b.target.value)})]}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"å
100é"}),e.jsx("input",{type:"number",className:j,value:o.bonusPerHundred,onChange:b=>m(n,"bonusPerHundred",parseInt(b.target.value)||0)})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"æ ç¾"}),e.jsx("input",{className:j,value:o.label,onChange:b=>m(n,"label",b.target.value),placeholder:"ð¥ é¢çæ¢å
ä»·"})]})]},n))]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5 space-y-3",children:[e.jsx("span",{className:"text-sm font-medium text-white/80",children:"å¼¹çªå
容"}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"æ é¢"}),e.jsx("input",{className:j,value:x.modalContent.heading,onChange:o=>w(n=>({...n,modalContent:{...n.modalContent,heading:o.target.value}})),placeholder:"ð äºä¸å
å¼ç¹æ "})]}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"æè¿°ï¼æ¯æå¤è¡ï¼
13å车æ¢è¡ï¼"}),e.jsx("textarea",{className:`${j} resize-y`,rows:4,value:x.modalContent.description,onChange:o=>w(n=>({...n,modalContent:{...n.modalContent,description:o.target.value}})),placeholder:`éæ¶ç§¯åå éæ´»å¨ 14å å¾è¶å¤éå¾è¶å¤ï¼`})]}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"äºç»´ç 䏿¹éå ææ¡ï¼å¯éï¼ä¸ºç©ºä¸æ¾ç¤ºï¼"}),e.jsx("input",{className:j,value:x.modalContent.footer,onChange:o=>w(n=>({...n,modalContent:{...n.modalContent,footer:o.target.value}})),placeholder:"å¦ï¼å 弿¹å¼ï¼å¾®ä¿¡è½¬è´¦ï¼ç§åä¸å±å æ¢å¡å¯ã"})]}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"峿 åºé¨æç¤ºï¼å¯éï¼ä¸ºç©ºä¸æ¾ç¤ºé»è²æç¤ºæ¡ï¼"}),e.jsx("input",{className:j,value:x.modalContent.tipText||"",onChange:o=>w(n=>({...n,modalContent:{...n.modalContent,tipText:o.target.value}})),placeholder:"å¦ï¼è½¬è´¦æ¶å¤æ³¨ãæ´»å¨ãå³å¯"})]})]}),e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium text-white/80",children:"å·¦æ åºé¨å£°æï¼æ¯æ¡åèªå¨å *ï¼"}),e.jsx("button",{onClick:()=>w(o=>({...o,modalContent:{...o.modalContent,disclaimers:[...o.modalContent.disclaimers||[],""]}})),className:"text-xs text-accent hover:text-accent/80",children:"+ æ·»å "})]}),(x.modalContent.disclaimers||[]).map((o,n)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-white/30 text-xs",children:"*"}),e.jsx("input",{className:`${j} flex-1`,value:o,onChange:b=>{const u=[...x.modalContent.disclaimers||[]];u[n]=b.target.value,w(N=>({...N,modalContent:{...N.modalContent,disclaimers:u}}))},placeholder:"æ´»å¨æé´èµ 鿝ä¾åçº§ï¼æ¿ä»£æ¥å¸¸èµ éã"}),e.jsx("button",{onClick:()=>w(b=>({...b,modalContent:{...b.modalContent,disclaimers:(b.modalContent.disclaimers||[]).filter((u,N)=>N!==n)}})),className:"text-red-400/40 hover:text-red-400 p-1",children:e.jsx(B,{className:"w-3 h-3"})})]},n))]}),x.modalContent.tiers.map((o,n)=>e.jsxs("div",{className:"bg-black/20 rounded-xl p-4 border border-white/5 space-y-3",children:[e.jsxs("span",{className:"text-xs text-white/40",children:["å¼¹çªæ¡£ä½ ",n+1]}),e.jsxs("div",{children:[e.jsx("label",{className:y,children:"æ¶æ®µæè¿°"}),e.jsx("input",{className:j,value:o.period,onChange:b=>le(n,"period",b.target.value),placeholder:"ð¥ é¢çæ¢å ä»· · 4.29-4.30"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("label",{className:y,children:"éé¢ç¤ºä¾"}),e.jsx("button",{onClick:()=>we(n),className:"text-xs text-accent hover:text-accent/80",children:"+ æ·»å "})]}),o.examples.map((b,u)=>e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx("input",{className:`${j} flex-1`,value:b,onChange:N=>Y(n,u,N.target.value),placeholder:"å 10 å â å°è´¦ 180 积å"}),o.examples.length>1&&e.jsx("button",{onClick:()=>q(n,u),className:"text-red-400/40 hover:text-red-400 p-1",children:e.jsx(B,{className:"w-3 h-3"})})]},u))]})]},n)),e.jsx("button",{onClick:R,disabled:F,className:"w-full bg-gradient-to-r from-red-500 to-amber-500 hover:from-red-600 hover:to-amber-600 text-white font-medium px-4 py-3 rounded-xl transition-all duration-300 disabled:opacity-50 text-sm shadow-lg shadow-red-500/20",children:F?"ä¿åä¸...":"ð¾ ä¿åä¿éé ç½®å°æ°æ®åº"})]})]})]})]}),e.jsx(Fr,{isOpen:P,onClose:()=>M(!1),config:x})]})}function Be({icon:x,label:w,value:L,color:G,delay:F,onClick:f}){const A={blue:"from-blue-500 to-blue-600",orange:"from-orange-500 to-orange-600",green:"from-green-500 to-green-600",yellow:"from-yellow-500 to-yellow-600"},D={blue:"hover:shadow-[0_0_25px_rgba(59,130,246,0.4)]",orange:"hover:shadow-[0_0_25px_rgba(249,115,22,0.4)]",green:"hover:shadow-[0_0_25px_rgba(34,197,94,0.4)]",yellow:"hover:shadow-[0_0_25px_rgba(234,179,8,0.4)]"},P=f?"button":"div";return e.jsx(k.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:F},whileHover:{y:-4,transition:{duration:.2}},children:e.jsxs(P,{onClick:f,className:`w-full h-full text-center bg-gradient-to-br from-white/[0.08] to-white/[0.02] backdrop-blur-sm border border-white/10 rounded-2xl p-5 transition-all duration-300 ${D[G]}
14 ${f?"hover:border-white/30 cursor-pointer":"hover:border-white/20"}`,children:[e.jsx("div",{className:`w-11 h-11 rounded-xl bg-gradient-to-br ${A[G]} flex items-center justify-center mb-3 shadow-lg mx-auto`,children:e.jsx(x,{className:"w-5 h-5 text-white"})}),e.jsx("div",{className:"text-2xl font-bold mb-0.5 text-white",children:L.toLocaleString()}),e.jsx("div",{className:"text-white/50 text-xs font-medium",children:w})]})})}export{Rl as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.