xiaoyukkkk commited on
Commit
b71597d
·
verified ·
1 Parent(s): 53e1ac0

Upload 541 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. static/assets/Accounts-B-WgN3aV.js +1 -0
  2. static/assets/Accounts-B-ft7iE1.js +2 -0
  3. static/assets/Accounts-BBKUc_zD.js +2 -0
  4. static/assets/Accounts-BPJBl--e.js +1 -0
  5. static/assets/Accounts-BWmfQ8Fj.js +2 -0
  6. static/assets/Accounts-BgTEWmTn.js +2 -0
  7. static/assets/Accounts-CS68WEf6.js +2 -0
  8. static/assets/Accounts-CWTZ3Utf.js +1 -0
  9. static/assets/Accounts-CgsggPDB.js +2 -0
  10. static/assets/Accounts-Cujd5Q6N.js +1 -0
  11. static/assets/Accounts-D4WYjY04.js +2 -0
  12. static/assets/Accounts-D9VhnA3_.js +1 -0
  13. static/assets/Accounts-DIoN-Ccm.js +2 -0
  14. static/assets/Accounts-DW_IBG7n.js +2 -0
  15. static/assets/Accounts-DanJ5qVz.js +1 -0
  16. static/assets/Accounts-DeEVJUcd.js +2 -0
  17. static/assets/Accounts-DnG8de1F.js +2 -0
  18. static/assets/Accounts-Dzw6xcVv.js +2 -0
  19. static/assets/Accounts-EOqS8kG-.js +2 -0
  20. static/assets/Accounts-J1ZNWiem.js +2 -0
  21. static/assets/Accounts-JKhKShMC.js +1 -0
  22. static/assets/Accounts-YFw0nAMh.js +1 -0
  23. static/assets/Accounts-kVPSbBOv.js +2 -0
  24. static/assets/Accounts-lQSfPTKz.js +1 -0
  25. static/assets/Accounts-mLu74uIS.js +2 -0
  26. static/assets/Accounts-qETksrou.js +2 -0
  27. static/assets/Accounts-rG9Hbj71.js +2 -0
  28. static/assets/Accounts-vV-lLEEq.js +2 -0
  29. static/assets/Accounts-v_9wnBup.js +2 -0
  30. static/assets/AppShell-5WTn-3Ed.js +1 -0
  31. static/assets/AppShell-78CtCTQC.js +1 -0
  32. static/assets/AppShell-8b_m8Zl7.js +1 -0
  33. static/assets/AppShell-B0aV7cPb.js +1 -0
  34. static/assets/AppShell-B2wCSsyk.js +1 -0
  35. static/assets/AppShell-B58juTD2.js +1 -0
  36. static/assets/AppShell-BCoBt3vb.js +1 -0
  37. static/assets/AppShell-BQVnOvTQ.js +1 -0
  38. static/assets/AppShell-BbGZjE35.js +1 -0
  39. static/assets/AppShell-Bk_f20v2.js +1 -0
  40. static/assets/AppShell-By1VIFEt.js +1 -0
  41. static/assets/AppShell-C-FNXlk9.js +1 -0
  42. static/assets/AppShell-C6gOM0Kd.js +1 -0
  43. static/assets/AppShell-CI3sE0H8.js +1 -0
  44. static/assets/AppShell-CXOssFu_.js +1 -0
  45. static/assets/AppShell-CsF8NWoD.js +1 -0
  46. static/assets/AppShell-D4_kHEqh.js +1 -0
  47. static/assets/AppShell-D6boa7bt.js +1 -0
  48. static/assets/AppShell-DKPLDP3H.js +1 -0
  49. static/assets/AppShell-DWHcP5pC.js +1 -0
  50. static/assets/AppShell-DZfg1gi0.js +1 -0
static/assets/Accounts-B-WgN3aV.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{g as C,C as zt,h as a,d as Pt,D as Ft,i as N,o as Kt,j as Jt,c as l,a as s,x as U,y as ke,m as V,v as I,A as ft,t as n,n as b,u as S,b as f,f as Ce,F as ie,r as Te,T as Se,w as A,e as r}from"./index-DrM07qAY.js";import{_ as Ht}from"./SelectMenu.vue_vue_type_script_setup_true_lang-BOyWonLr.js";import{_ as ue}from"./Checkbox.vue_vue_type_script_setup_true_lang-DXuWSs7B.js";import{_ as Gt}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-2Xqtgrin.js";import{u as Yt}from"./useConfirmDialog-CfZjR4ey.js";import{_ as Qt}from"./HelpTip.vue_vue_type_script_setup_true_lang-DLBrB24x.js";const y={list:()=>C.get("/admin/accounts"),getConfig:()=>C.get("/admin/accounts-config"),updateConfig:x=>C.put("/admin/accounts-config",x),delete:x=>C.delete(`/admin/accounts/${x}`),disable:x=>C.put(`/admin/accounts/${x}/disable`),enable:x=>C.put(`/admin/accounts/${x}/enable`),startRegister:(x,_)=>C.post("/admin/register/start",{count:x,domain:_}),getRegisterTask:x=>C.get(`/admin/register/task/${x}`),getRegisterCurrent:()=>C.get("/admin/register/current"),startLogin:x=>C.post("/admin/login/start",x),getLoginTask:x=>C.get(`/admin/login/task/${x}`),getLoginCurrent:()=>C.get("/admin/login/current"),checkLogin:()=>C.post("/admin/login/check")},qt=zt("accounts",()=>{const x=a([]),_=a(!1);async function T(){_.value=!0;try{const u=await y.list();x.value=Array.isArray(u)?u:u.accounts||[]}finally{_.value=!1}}async function X(u){await y.delete(u),await T()}async function k(u){await y.disable(u),await T()}async function Z(u){await y.enable(u),await T()}async function J(u){await Promise.all(u.map(E=>y.enable(E))),await T()}async function g(u){await Promise.all(u.map(E=>y.disable(E))),await T()}async function z(u){await Promise.all(u.map(E=>y.delete(E))),await T()}async function ee(u){await y.updateConfig(u),await T()}return{accounts:x,isLoading:_,loadAccounts:T,deleteAccount:X,disableAccount:k,enableAccount:Z,bulkEnable:J,bulkDisable:g,bulkDelete:z,updateConfig:ee}}),Wt={class:"space-y-8"},Xt={class:"rounded-3xl border border-border bg-card p-6"},Zt={class:"flex flex-wrap items-center justify-between gap-4"},es={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},ts={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},ss={class:"ml-auto flex items-center gap-2 sm:ml-0"},os={class:"mt-4 flex flex-wrap items-center gap-2"},rs=["disabled"],ls=["disabled"],ns={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},as=["disabled"],is=["disabled"],us=["disabled"],ds=["disabled"],cs=["disabled"],vs={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},fs=["onClick"],xs={class:"flex items-start justify-between gap-3"},gs={class:"mt-1 font-mono text-xs text-foreground"},ms={class:"flex items-center gap-2"},ps={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},bs={key:0,class:"mt-1 text-[11px]"},ys={key:0},_s={key:1},ws={class:"mt-1 text-sm font-semibold text-foreground"},hs={class:"mt-1 text-sm font-semibold text-foreground"},ks={class:"mt-4 flex flex-wrap items-center gap-2"},Cs=["onClick"],Ts=["onClick"],Ss=["onClick"],As=["onClick"],Es={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Ls={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},$s={class:"min-w-full text-left text-sm"},Rs={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Vs={class:"py-3 pr-4"},Is={class:"py-3 pr-6"},js={class:"inline-flex items-center gap-2"},Ds={class:"text-sm text-foreground"},Ms={key:0},Os=["onClick"],Bs={class:"py-4 pr-6 font-mono text-xs text-foreground"},Ns={class:"py-4 pr-6"},Us={class:"py-4 pr-6"},zs={key:0,class:"block text-[11px] text-muted-foreground"},Ps={class:"py-4 pr-6 text-xs"},Fs={class:"py-4 pr-6 text-xs text-muted-foreground"},Ks={class:"py-4 pr-6 text-xs text-muted-foreground"},Js={class:"py-4 text-right"},Hs={class:"flex flex-wrap justify-end gap-2"},Gs=["onClick"],Ys=["onClick"],Qs=["onClick"],qs=["onClick"],Ws={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Xs={class:"w-full max-w-md rounded-3xl border border-border bg-card p-6 shadow-xl"},Zs={class:"mt-4 space-y-4 text-sm"},eo={class:"mt-6 flex items-center justify-end gap-2"},to=["disabled"],so={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},oo={class:"w-full max-w-2xl max-h-[80vh] rounded-3xl border border-border bg-card shadow-xl"},ro={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},lo={class:"flex items-center gap-2"},no=["disabled"],ao={class:"max-h-[calc(80vh-92px)] overflow-y-auto px-6 py-4"},io={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},uo={key:1,class:"mt-4 grid gap-2 text-xs text-muted-foreground"},co={key:0},vo={class:"ml-2"},fo={class:"ml-2"},xo={class:"ml-2"},go={class:"ml-2"},mo={key:1},po={class:"ml-2"},bo={class:"ml-2"},yo={class:"ml-2"},_o={class:"ml-2"},wo={key:2,class:"mt-4 grid gap-2"},ho={key:0,class:"rounded-2xl border border-border bg-muted/30 p-3"},ko={class:"mt-2 space-y-1 text-[11px] text-muted-foreground"},Co={key:1,class:"rounded-2xl border border-border bg-muted/30 p-3"},To={class:"mt-2 space-y-1 text-[11px] text-muted-foreground"},So={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},Ao={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Eo={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Lo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},$o={class:"mt-4 space-y-3 text-sm"},Ro={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Vo={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},Io={class:"flex items-center justify-between"},jo={class:"flex items-center gap-2"},Do={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},Mo={class:"mt-4"},Oo=["readonly"],Bo={class:"mt-6 flex items-center justify-end gap-2"},No=["disabled"],De="accounts-register-task-cache",Me="accounts-login-task-cache",Oe="accounts-register-log-clear",Be="accounts-login-log-clear",Ne="accounts-register-task-cleared-id",Ue="accounts-login-task-cleared-id",Ho=Pt({__name:"Accounts",setup(x){const _=qt(),{accounts:T,isLoading:X}=Ft(_),k=Yt(),Z=a(""),J=a("all"),g=a(new Set),z=a("table"),ee=a(!1),u=a(""),E=a(!1),L=a(""),H=a(""),j=a(!1),te=a([]),se=a(1),de=a(!1),oe=a(!1),D=a(!1),Ae=a(null),ce=a(null),ve=a(null),M=a(null),O=a(null),G=a(0),Y=a(0),fe=a(!1),d=a(null),c=a(null),$=a(!1),h=a(!1),m=a(""),p=a({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),xe=a(null),ze=a([]),xt=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],B=N(()=>{const e=Z.value.trim().toLowerCase();return T.value.filter(t=>{const o=!e||t.id.toLowerCase().includes(e),i=J.value==="all"||re(t)===J.value;return o&&i})}),R=N(()=>g.value.size),Ee=N(()=>B.value.length>0&&B.value.every(e=>g.value.has(e.id))),ge=async()=>{await _.loadAccounts(),g.value=new Set,D.value=!1},Pe=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},Fe=e=>{try{return localStorage.getItem(e)||null}catch{return null}},me=(e,t)=>{try{if(t){localStorage.setItem(e,t);return}localStorage.removeItem(e)}catch{}},Ke=(e,t)=>{try{localStorage.setItem(e,JSON.stringify(t))}catch{}},Je=e=>{try{localStorage.removeItem(e)}catch{}},He=e=>{const t=localStorage.getItem(e),o=Number(t);return Number.isFinite(o)?o:0},pe=(e,t)=>{try{localStorage.setItem(e,String(t))}catch{}},Le=(e,t=!0)=>{e&&(e.id&&e.id===M.value||(e.id&&M.value&&e.id!==M.value&&(M.value=null,me(Ne,null)),d.value=e,e.id&&e.id!==ce.value&&(ce.value=e.id,G.value=0,pe(Oe,0)),t&&Ke(De,e)))},be=(e,t=!0)=>{e&&(e.id&&e.id===O.value||(e.id&&O.value&&e.id!==O.value&&(O.value=null,me(Ue,null)),c.value=e,e.id&&e.id!==ve.value&&(ve.value=e.id,Y.value=0,pe(Be,0)),t&&Ke(Me,e)))},gt=()=>{G.value=He(Oe),Y.value=He(Be),M.value=Fe(Ne),O.value=Fe(Ue);const e=Pe(De);e&&e.id!==M.value&&(d.value=e,ce.value=e.id||null);const t=Pe(Me);t&&t.id!==O.value&&(c.value=t,ve.value=t.id||null)},mt=()=>{de.value=!0,fe.value=!1},Ge=()=>{de.value=!1},pt=async()=>{try{const e=[],t=d.value?.id,o=c.value?.id;if(t&&!ye(t)&&e.push(dt(t)),o&&!_e(o)&&e.push(ct(o)),!e.length){await je();return}await Promise.all(e)}catch(e){m.value=e?.message||"任务状态更新失败"}},bt=async()=>{oe.value=!0,await pt()},yt=()=>{oe.value=!1},_t=()=>{const e=d.value?.id||null,t=c.value?.id||null;M.value=e,O.value=t,me(Ne,e),me(Ue,t),G.value=d.value?.logs?.length||0,Y.value=c.value?.logs?.length||0,pe(Oe,G.value),pe(Be,Y.value),d.value=null,c.value=null,ce.value=null,ve.value=null,m.value="",$.value=!1,h.value=!1,P(),F(),Je(De),Je(Me)},ye=e=>!!(e&&e===M.value),_e=e=>!!(e&&e===O.value),wt=()=>{D.value=!D.value},Q=()=>{D.value=!1},Ye=e=>{if(!D.value)return;const t=e.target;Ae.value&&!Ae.value.contains(t)&&(D.value=!1)};Kt(async()=>{gt(),await ge(),await je(),Ot(),document.addEventListener("click",Ye)});const q=N(()=>{const e=d.value?.logs||[];return G.value?e.slice(G.value):e}),W=N(()=>{const e=c.value?.logs||[];return Y.value?e.slice(Y.value):e}),ht=N(()=>!!m.value||!!d.value||!!c.value||q.value.length>0||W.value.length>0),kt=N(()=>{const e=d.value?.status,t=c.value?.status;return e==="running"||e==="pending"||t==="running"||t==="pending"}),Ct=N(()=>{if(m.value)return"bg-rose-500";if(kt.value)return"bg-sky-400";const e=[];if(d.value){const v=d.value.success_count??0,w=d.value.fail_count??0,K=d.value.count??v+w;e.push({success:v,fail:w,total:K,status:d.value.status})}if(c.value){const v=c.value.success_count??0,w=c.value.fail_count??0,K=c.value.account_ids?.length??v+w;e.push({success:v,fail:w,total:K,status:c.value.status})}if(!e.length)return"bg-muted-foreground";const t=e.reduce((v,w)=>v+w.success,0),o=e.reduce((v,w)=>v+w.fail,0),i=e.reduce((v,w)=>v+(w.total||0),0);if(t>0&&o>0)return"bg-amber-400";if(o>0&&t===0)return"bg-rose-500";if(t>0&&o===0)return"bg-emerald-400";if(i===0){const v=e.every(K=>K.status==="success");if(e.some(K=>K.status==="failed"))return"bg-rose-500";if(v)return"bg-emerald-400"}return"bg-muted-foreground"});Jt(()=>{P(),F(),Mt(),document.removeEventListener("click",Ye)});const re=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?"429限流":e.cooldown_reason==="错误禁用"?"错误禁用":e.disabled?"手动禁用":e.status==="已过期"?"已过期":e.status==="即将过期"?"即将过期":"正常",Qe=e=>{const t=re(e);return t==="429限流"||t==="即将过期"?"bg-amber-200 text-amber-900":t==="错误禁用"||t==="已过期"?"bg-destructive/10 text-destructive":t==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},qe=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?!0:e.disabled||e.cooldown_reason==="错误禁用",We=e=>e==="已过期"?"过期":e==="未设置"?"未设置":e,Xe=e=>e.status==="已过期"?"text-rose-600":e.status==="即将过期"?"text-amber-700":e.status==="未设置"?"text-muted-foreground":"text-emerald-600",Ze=e=>e<60?`${e} 秒`:e<3600?`${Math.ceil(e/60)} 分钟`:`${(e/3600).toFixed(1)} 小时`,$e=e=>e.cooldown_seconds>0?"text-amber-700":e.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",et=e=>{const t=re(e);return t==="手动禁用"||t==="已过期"?"bg-muted/70":""},we=e=>{const t=new Set(g.value);t.has(e)?t.delete(e):t.add(e),g.value=t},tt=()=>{if(Ee.value){g.value=new Set;return}g.value=new Set(B.value.map(e=>e.id))},Tt=(e,t)=>e.id||`account_${t+1}`,St=async()=>(await y.getConfig()).accounts.map((t,o)=>({...t,id:Tt(t,o)})),st=e=>`${e.time} [${e.level}] ${e.message}`,At=(e,t)=>{let o=-1;for(let v=0;v<e.length;v+=1)if(e[v].id===t){o=v;break}if(o===-1)return u.value="未找到对应账号配置。",!1;const i=e[o];return p.value={id:i.id,secure_c_ses:i.secure_c_ses,csesidx:i.csesidx,config_id:i.config_id,host_c_oses:i.host_c_oses,expires_at:i.expires_at},ze.value=e,xe.value=o,ee.value=!0,!0},ot=async e=>{u.value="";try{const t=await St();At(t,e)}catch(t){u.value=t.message||"加载账号配置失败"}},Et=async()=>{L.value="";try{const e=await y.getConfig();te.value=Array.isArray(e.accounts)?e.accounts:[],H.value=JSON.stringify(lt(te.value),null,2),j.value=!0,E.value=!0}catch(e){L.value=e.message||"加载账号配置失败"}},Re=()=>{E.value=!1,L.value="",j.value=!1},rt=()=>{const e=JSON.parse(H.value);if(!Array.isArray(e))throw new Error("配置格式必须是数组。");return e},Lt=e=>typeof e!="string"||!e?e:e.length<=6?`${e.slice(0,2)}****`:`${e.slice(0,3)}****`,lt=e=>{const t=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password"]);return e.map(o=>{const i={...o};return t.forEach(v=>{const w=i[v];w&&(i[v]=Lt(w))}),i})},$t=()=>{if(L.value="",!j.value){try{te.value=rt()}catch(e){L.value=e.message||"JSON 格式错误";return}H.value=JSON.stringify(lt(te.value),null,2),j.value=!0;return}H.value=JSON.stringify(te.value,null,2),j.value=!1},Rt=async()=>{L.value="";try{const e=rt();await _.updateConfig(e),Re()}catch(e){L.value=e.message||"保存失败"}},Ve=()=>{ee.value=!1,u.value=""},Vt=async()=>{if(xe.value===null)return;const e=[...ze.value];e[xe.value]={...e[xe.value],id:p.value.id,secure_c_ses:p.value.secure_c_ses,csesidx:p.value.csesidx,config_id:p.value.config_id,host_c_oses:p.value.host_c_oses||void 0,expires_at:p.value.expires_at||void 0};try{await _.updateConfig(e),Ve()}catch(t){u.value=t.message||"保存失败"}},It=async()=>{await _.bulkEnable(Array.from(g.value)),g.value=new Set},jt=async()=>{await k.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"})&&(await _.bulkDisable(Array.from(g.value)),g.value=new Set)},Dt=async()=>{await k.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"})&&(await _.bulkDelete(Array.from(g.value)),g.value=new Set)},nt=async e=>{await _.enableAccount(e)},at=async e=>{await k.ask({title:"禁用账号",message:"确定要禁用该账号吗?"})&&await _.disableAccount(e)},it=async e=>{await k.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"})&&await _.deleteAccount(e)};let le=null,ne=null,ae=null,he=!1;const P=()=>{le!==null&&(window.clearInterval(le),le=null)},F=()=>{ne!==null&&(window.clearInterval(ne),ne=null)},Mt=()=>{ae!==null&&(window.clearInterval(ae),ae=null),he=!1},ut=e=>e==="pending"?"等待中":e==="running"?"执行中":e==="success"?"成功":e==="failed"?"失败":e,dt=async e=>{if(ye(e)){P();return}const t=await y.getRegisterTask(e);if(ye(t.id)){P();return}Le(t),t.status!=="running"&&t.status!=="pending"&&($.value=!1,P(),await ge())},ct=async e=>{if(_e(e)){F();return}const t=await y.getLoginTask(e);if(_e(t.id)){F();return}be(t),t.status!=="running"&&t.status!=="pending"&&(h.value=!1,F(),await ge())},vt=e=>{P(),le=window.setInterval(()=>{dt(e).catch(t=>{m.value=t?.message||"注册任务更���失败",P(),$.value=!1})},3e3)},Ie=e=>{F(),ne=window.setInterval(()=>{ct(e).catch(t=>{m.value=t?.message||"刷新任务更新失败",F(),h.value=!1})},3e3)},Ot=()=>{ae===null&&(ae=window.setInterval(async()=>{if(!he&&!oe.value&&!(le!==null||ne!==null)&&!(!$.value&&!h.value&&!d.value&&!c.value)){he=!0;try{await je()}catch(e){m.value=e?.message||"后台刷新失败"}finally{he=!1}}},6e3))},je=async()=>{try{const e=await y.getRegisterCurrent();e&&"id"in e&&!ye(e.id)&&(Le(e),(e.status==="running"||e.status==="pending")&&($.value=!0,vt(e.id)))}catch(e){m.value=e.message||"加载注册任务失败"}try{const e=await y.getLoginCurrent();e&&"id"in e&&!_e(e.id)&&(be(e),(e.status==="running"||e.status==="pending")&&(h.value=!0,Ie(e.id)))}catch(e){m.value=e.message||"加载刷新任务失败"}},Bt=async()=>{m.value="",$.value=!0;try{const e=Number.isFinite(se.value)&&se.value>0?se.value:void 0,t=await y.startRegister(e);Le(t),vt(t.id),de.value=!1,oe.value=!0}catch(e){m.value=e.message||"启动注册失败",$.value=!1}},Nt=async()=>{if(g.value.size){m.value="",h.value=!0;try{const e=await y.startLogin(Array.from(g.value));be(e),Ie(e.id)}catch(e){m.value=e.message||"启动刷新失败",h.value=!1}}},Ut=async()=>{m.value="",h.value=!0;try{await y.checkLogin();const e=await y.getLoginCurrent();if(e&&"id"in e){be(e),Ie(e.id);return}h.value=!1}catch(e){m.value=e.message||"触发刷新失败",h.value=!1}};return(e,t)=>(r(),l(ie,null,[s("div",Wt,[s("section",Xt,[s("div",Zt,[s("div",es,[V(s("input",{"onUpdate:modelValue":t[0]||(t[0]=o=>Z.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[I,Z.value]]),U(Ht,{modelValue:J.value,"onUpdate:modelValue":t[1]||(t[1]=o=>J.value=o),options:xt},null,8,["modelValue"])]),s("div",ts,[U(ue,{modelValue:Ee.value,"onUpdate:modelValue":tt},{default:ft(()=>[...t[24]||(t[24]=[Ce(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+n(R.value)+" / "+n(B.value.length)+" 个账号",1),s("div",ss,[s("button",{type:"button",class:b(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",z.value==="table"?"bg-accent text-accent-foreground":""]),onClick:t[2]||(t[2]=o=>z.value="table"),"aria-label":"列表视图"},[...t[25]||(t[25]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:b(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",z.value==="card"?"bg-accent text-accent-foreground":""]),onClick:t[3]||(t[3]=o=>z.value="card"),"aria-label":"卡片视图"},[...t[26]||(t[26]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",os,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:S(X),onClick:ge}," 刷新列表 ",8,rs),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:Et}," 账户配置 "),s("button",{class:"rounded-full border border-border bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:$.value,onClick:mt}," 添加账户 ",8,ls),s("div",{ref_key:"moreActionsRef",ref:Ae,class:"relative"},[s("button",{class:b(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",D.value?"bg-accent text-accent-foreground":""]),onClick:wt},[t[27]||(t[27]=Ce(" 更多操作 ",-1)),t[28]||(t[28]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),ht.value?(r(),l("span",{key:0,class:b(["ml-1 h-2 w-2 rounded-full",Ct.value]),"aria-hidden":"true"},null,2)):f("",!0)],2),D.value?(r(),l("div",ns,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:t[4]||(t[4]=o=>{bt(),Q()})}," 任务状态 "),t[29]||(t[29]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",h.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:h.value,onClick:t[5]||(t[5]=o=>{Ut(),Q()})}," 刷新过期 ",10,as),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!R.value||h.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!R.value||h.value,onClick:t[6]||(t[6]=o=>{Nt(),Q()})}," 刷新选中 ",10,is),t[30]||(t[30]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",R.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!R.value,onClick:t[7]||(t[7]=o=>{It(),Q()})}," 批量启用 ",10,us),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",R.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!R.value,onClick:t[8]||(t[8]=o=>{jt(),Q()})}," 批量禁用 ",10,ds),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",R.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!R.value,onClick:t[9]||(t[9]=o=>{Dt(),Q()})}," 批量删除 ",10,cs)])):f("",!0)],512)]),z.value==="card"?(r(),l("div",vs,[(r(!0),l(ie,null,Te(B.value,o=>(r(),l("div",{key:o.id,class:b(["rounded-2xl border border-border bg-card p-4",et(o)]),onClick:i=>we(o.id)},[s("div",xs,[s("div",null,[t[31]||(t[31]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",gs,n(o.id),1)]),s("div",ms,[U(ue,{modelValue:g.value.has(o.id),"onUpdate:modelValue":i=>we(o.id),onClick:t[10]||(t[10]=A(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:b(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",Qe(o)])},n(re(o)),3)])]),s("div",ps,[s("div",null,[t[32]||(t[32]=s("p",null,"剩余时间",-1)),s("p",{class:b(["mt-1 text-sm font-semibold",Xe(o)])},n(We(o.remaining_display)),3),o.expires_at?(r(),l("p",bs,n(o.expires_at),1)):f("",!0)]),s("div",null,[t[33]||(t[33]=s("p",null,"冷却",-1)),s("p",{class:b(["mt-1",$e(o)])},[o.cooldown_seconds>0?(r(),l("span",ys,n(Ze(o.cooldown_seconds))+" · "+n(o.cooldown_reason),1)):(r(),l("span",_s,n(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[t[34]||(t[34]=s("p",null,"失败数",-1)),s("p",ws,n(o.error_count),1)]),s("div",null,[t[35]||(t[35]=s("p",null,"会话数",-1)),s("p",hs,n(o.conversation_count),1)])]),s("div",ks,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>ot(o.id),["stop"])}," 编辑 ",8,Cs),qe(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[11]||(t[11]=A(()=>{},["stop"])),i=>nt(o.id)]}," 启用 ",8,Ts)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[12]||(t[12]=A(()=>{},["stop"])),i=>at(o.id)]}," 禁用 ",8,Ss)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[t[13]||(t[13]=A(()=>{},["stop"])),i=>it(o.id)]}," 删除 ",8,As)])],10,fs))),128)),!B.value.length&&!S(X)?(r(),l("div",Es," 暂无账号数据,请检查后台配置。 ")):f("",!0)])):(r(),l("div",Ls,[s("table",$s,[s("thead",Rs,[s("tr",null,[s("th",Vs,[U(ue,{modelValue:Ee.value,"onUpdate:modelValue":tt},null,8,["modelValue"])]),t[37]||(t[37]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),t[38]||(t[38]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",Is,[s("span",js,[t[36]||(t[36]=Ce(" 剩余/过期 ",-1)),U(Qt,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),t[39]||(t[39]=s("th",{class:"py-3 pr-6"},"冷却",-1)),t[40]||(t[40]=s("th",{class:"py-3 pr-6"},"失败数",-1)),t[41]||(t[41]=s("th",{class:"py-3 pr-6"},"会话数",-1)),t[42]||(t[42]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",Ds,[!B.value.length&&!S(X)?(r(),l("tr",Ms,[...t[43]||(t[43]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):f("",!0),(r(!0),l(ie,null,Te(B.value,o=>(r(),l("tr",{key:o.id,class:b(["border-t border-border",et(o)]),onClick:i=>we(o.id)},[s("td",{class:"py-4 pr-4",onClick:t[14]||(t[14]=A(()=>{},["stop"]))},[U(ue,{modelValue:g.value.has(o.id),"onUpdate:modelValue":i=>we(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",Bs,n(o.id),1),s("td",Ns,[s("span",{class:b(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",Qe(o)])},n(re(o)),3)]),s("td",Us,[s("div",{class:b(["text-sm font-semibold",Xe(o)])},n(We(o.remaining_display)),3),o.expires_at?(r(),l("span",zs,n(o.expires_at),1)):f("",!0)]),s("td",Ps,[o.cooldown_seconds>0?(r(),l("span",{key:0,class:b($e(o))},n(Ze(o.cooldown_seconds))+" · "+n(o.cooldown_reason),3)):(r(),l("span",{key:1,class:b($e(o))},n(o.cooldown_reason||"无冷却"),3))]),s("td",Fs,n(o.error_count),1),s("td",Ks,n(o.conversation_count),1),s("td",Js,[s("div",Hs,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>ot(o.id),["stop"])}," 编辑 ",8,Gs),qe(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>nt(o.id),["stop"])}," 启用 ",8,Ys)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>at(o.id),["stop"])}," 禁用 ",8,Qs)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:A(i=>it(o.id),["stop"])}," 删除 ",8,qs)])])],10,Os))),128))])])]))])]),U(Gt,{open:S(k).open.value,title:S(k).title.value,message:S(k).message.value,"confirm-text":S(k).confirmText.value,"cancel-text":S(k).cancelText.value,onConfirm:S(k).confirm,onCancel:S(k).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(r(),ke(Se,{to:"body"},[de.value?(r(),l("div",Ws,[s("div",Xs,[s("div",{class:"flex items-center justify-between"},[t[44]||(t[44]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"添加账户"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"创建 DuckMail 账号并自动注册")],-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Ge}," 关闭 ")]),s("div",Zs,[t[46]||(t[46]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),V(s("input",{"onUpdate:modelValue":t[15]||(t[15]=o=>se.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,se.value,void 0,{number:!0}]]),t[47]||(t[47]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"}," 默认域名来自设置面板(可在“配置面板”中修改) ",-1)),t[48]||(t[48]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-[11px] leading-relaxed text-muted-foreground"},[s("div",{class:"space-y-2"},[s("p",{class:"font-semibold text-rose-600"},"使用限制:禁止将本工具用于商业用途或大规模滥用。"),s("p",null,"用途说明:本项目仅用于学习、研究和技术交流,旨在探索浏览器自动化与系统集成。"),s("p",null,"使用责任:因使用本工具产生的一切后果由使用者自行承担,包括但不限于账号封禁、数据损失及法律责任。"),s("p",null,"合规要求:使用者应遵守所在国家/地区法律法规及 Google 服务条款,作者不对任何违规使用行为负责。"),s("p",null,"无担保:本项目按“现状”提供,不提供任何明示或暗示的担保,包括适销性或特定用途适用性。"),s("p",null,"第三方服务:本项目依赖 DuckMail API 等第三方服务,其可用性与稳定性不受作者控制。"),s("p",null,"维护声明:作者保留随时停止维护或变更功能的权利,恕不另行通知。")])],-1)),U(ue,{modelValue:fe.value,"onUpdate:modelValue":t[16]||(t[16]=o=>fe.value=o)},{default:ft(()=>[...t[45]||(t[45]=[Ce(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])]),s("div",eo,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ge}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:$.value||!fe.value,onClick:Bt}," 开始注册 ",8,to)])])])):f("",!0)])),(r(),ke(Se,{to:"body"},[oe.value?(r(),l("div",so,[s("div",oo,[s("div",ro,[t[49]||(t[49]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",lo,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary",disabled:!q.value.length&&!W.value.length&&!d.value&&!c.value&&!m.value,onClick:_t}," 清空日志 ",8,no),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:yt}," 关闭 ")])]),s("div",ao,[m.value?(r(),l("div",io,n(m.value),1)):f("",!0),d.value||c.value?(r(),l("div",uo,[d.value?(r(),l("div",co,[t[50]||(t[50]=s("span",{class:"font-medium text-foreground"},"注册任务",-1)),s("span",vo,"状态:"+n(ut(d.value.status)),1),s("span",fo,"进度:"+n(d.value.progress)+"/"+n(d.value.count),1),s("span",xo,"成功:"+n(d.value.success_count),1),s("span",go,"失败:"+n(d.value.fail_count),1)])):f("",!0),c.value?(r(),l("div",mo,[t[51]||(t[51]=s("span",{class:"font-medium text-foreground"},"刷新任务",-1)),s("span",po,"状态:"+n(ut(c.value.status)),1),s("span",bo,"进度:"+n(c.value.progress)+"/"+n(c.value.account_ids.length),1),s("span",yo,"成功:"+n(c.value.success_count),1),s("span",_o,"失败:"+n(c.value.fail_count),1)])):f("",!0)])):f("",!0),q.value.length||W.value.length?(r(),l("div",wo,[q.value.length?(r(),l("div",ho,[t[52]||(t[52]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",ko,[(r(!0),l(ie,null,Te(q.value,(o,i)=>(r(),l("div",{key:`reg-${i}`,class:"font-mono"},n(st(o)),1))),128))])])):f("",!0),W.value.length?(r(),l("div",Co,[t[53]||(t[53]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",To,[(r(!0),l(ie,null,Te(W.value,(o,i)=>(r(),l("div",{key:`login-${i}`,class:"font-mono"},n(st(o)),1))),128))])])):f("",!0)])):f("",!0),!m.value&&!d.value&&!c.value&&!q.value.length&&!W.value.length?(r(),l("div",So," 暂无任务 ")):f("",!0)])])])):f("",!0)])),(r(),ke(Se,{to:"body"},[ee.value?(r(),l("div",Ao,[s("div",Eo,[s("div",{class:"flex items-center justify-between"},[t[54]||(t[54]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Ve}," 关闭 ")]),u.value?(r(),l("div",Lo,n(u.value),1)):f("",!0),s("div",$o,[t[55]||(t[55]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),V(s("input",{"onUpdate:modelValue":t[17]||(t[17]=o=>p.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[I,p.value.id]]),t[56]||(t[56]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),V(s("textarea",{"onUpdate:modelValue":t[18]||(t[18]=o=>p.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[I,p.value.secure_c_ses]]),t[57]||(t[57]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),V(s("input",{"onUpdate:modelValue":t[19]||(t[19]=o=>p.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,p.value.csesidx]]),t[58]||(t[58]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),V(s("input",{"onUpdate:modelValue":t[20]||(t[20]=o=>p.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,p.value.config_id]]),t[59]||(t[59]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),V(s("input",{"onUpdate:modelValue":t[21]||(t[21]=o=>p.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,p.value.host_c_oses]]),t[60]||(t[60]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),V(s("input",{"onUpdate:modelValue":t[22]||(t[22]=o=>p.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[I,p.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ve}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Vt}," 保存 ")])])])):f("",!0)])),(r(),ke(Se,{to:"body"},[E.value?(r(),l("div",Ro,[s("div",Vo,[s("div",Io,[t[61]||(t[61]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",jo,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:$t},n(j.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Re}," 关闭 ")])]),L.value?(r(),l("div",Do,n(L.value),1)):f("",!0),s("div",Mo,[V(s("textarea",{"onUpdate:modelValue":t[23]||(t[23]=o=>H.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:j.value},null,8,Oo),[[I,H.value]])]),s("div",Bo,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Re}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Rt,disabled:j.value}," 保存 ",8,No)])])])):f("",!0)]))],64))}});export{Ho as default};
static/assets/Accounts-B-ft7iE1.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ import{g as E,C as ts,h as a,d as ss,D as os,i as H,o as rs,x as ls,j as ns,c as l,a as s,y as J,z as Re,p as A,v as $,A as Tt,t as n,n as g,u as R,b as m,f as pe,F as ge,r as Ve,T as je,w as V,e as r,E as as}from"./index-Bx7qSams.js";import{_ as is}from"./SelectMenu.vue_vue_type_script_setup_true_lang-CJjLLYhZ.js";import{_ as be}from"./Checkbox.vue_vue_type_script_setup_true_lang-BCrOKjX_.js";import{_ as ds}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-CLzCrpfO.js";import{u as us}from"./useConfirmDialog-DIY3VaSP.js";import{_ as cs}from"./HelpTip.vue_vue_type_script_setup_true_lang-BaMbEJhq.js";const h={list:()=>E.get("/admin/accounts"),getConfig:()=>E.get("/admin/accounts-config"),updateConfig:b=>E.put("/admin/accounts-config",b),delete:b=>E.delete(`/admin/accounts/${b}`),disable:b=>E.put(`/admin/accounts/${b}/disable`),enable:b=>E.put(`/admin/accounts/${b}/enable`),startRegister:(b,w)=>E.post("/admin/register/start",{count:b,domain:w}),getRegisterTask:b=>E.get(`/admin/register/task/${b}`),getRegisterCurrent:()=>E.get("/admin/register/current"),startLogin:b=>E.post("/admin/login/start",b),getLoginTask:b=>E.get(`/admin/login/task/${b}`),getLoginCurrent:()=>E.get("/admin/login/current"),checkLogin:()=>E.post("/admin/login/check")},fs=ts("accounts",()=>{const b=a([]),w=a(!1);async function L(){w.value=!0;try{const u=await h.list();b.value=Array.isArray(u)?u:u.accounts||[]}finally{w.value=!1}}async function re(u){await h.delete(u),await L()}async function C(u){await h.disable(u),await L()}async function le(u){await h.enable(u),await L()}async function Z(u){await Promise.all(u.map(j=>h.enable(j))),await L()}async function p(u){await Promise.all(u.map(j=>h.disable(j))),await L()}async function G(u){await Promise.all(u.map(j=>h.delete(j))),await L()}async function ne(u){await h.updateConfig(u),await L()}return{accounts:b,isLoading:w,loadAccounts:L,deleteAccount:re,disableAccount:C,enableAccount:le,bulkEnable:Z,bulkDisable:p,bulkDelete:G,updateConfig:ne}}),vs={class:"space-y-8"},xs={class:"rounded-3xl border border-border bg-card p-6"},ms={class:"flex flex-wrap items-center justify-between gap-4"},ps={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},gs={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},bs={class:"ml-auto flex items-center gap-2 sm:ml-0"},ys={class:"mt-4 flex flex-wrap items-center gap-2"},_s=["disabled"],hs=["disabled"],ws={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},ks=["disabled"],Cs=["disabled"],Ts=["disabled"],Ss=["disabled"],Es=["disabled"],Is={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},Ls=["onClick"],As={class:"flex items-start justify-between gap-3"},$s={class:"mt-1 font-mono text-xs text-foreground"},Rs={class:"flex items-center gap-2"},Vs={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},js={key:0,class:"mt-1 text-[11px]"},Ms={key:0},Ds={key:1},Os={class:"mt-1 text-sm font-semibold text-foreground"},Bs={class:"mt-1 text-sm font-semibold text-foreground"},Ns={class:"mt-4 flex flex-wrap items-center gap-2"},Us=["onClick"],zs=["onClick"],Ps=["onClick"],Fs=["onClick"],Ks={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Hs={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},Js={class:"min-w-full text-left text-sm"},Gs={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Ys={class:"py-3 pr-4"},Qs={class:"py-3 pr-6"},qs={class:"inline-flex items-center gap-2"},Xs={class:"text-sm text-foreground"},Ws={key:0},Zs=["onClick"],eo={class:"py-4 pr-6 font-mono text-xs text-foreground"},to={class:"py-4 pr-6"},so={class:"py-4 pr-6"},oo={key:0,class:"block text-[11px] text-muted-foreground"},ro={class:"py-4 pr-6 text-xs"},lo={class:"py-4 pr-6 text-xs text-muted-foreground"},no={class:"py-4 pr-6 text-xs text-muted-foreground"},ao={class:"py-4 text-right"},io={class:"flex flex-wrap justify-end gap-2"},uo=["onClick"],co=["onClick"],fo=["onClick"],vo=["onClick"],xo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},mo={class:"flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},po={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},go={class:"mt-1 text-xs text-muted-foreground"},bo={class:"scrollbar-slim flex-1 overflow-y-auto px-6 py-4"},yo={class:"space-y-4 text-sm"},_o={class:"flex rounded-full border border-border bg-muted/30 p-1 text-xs"},ho={key:0,class:"space-y-4"},wo={key:1,class:"space-y-4"},ko={key:0,class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-600"},Co={class:"border-t border-border/60 px-6 py-4"},To={class:"flex items-center justify-end gap-2"},So=["disabled"],Eo=["disabled"],Io={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Lo={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},Ao={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},$o={class:"flex items-center gap-2"},Ro=["disabled"],Vo={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},jo={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},Mo={key:1,class:"grid gap-3 text-xs text-muted-foreground"},Do={key:0,class:"space-y-1"},Oo={class:"flex flex-wrap gap-x-4 gap-y-1"},Bo={key:1,class:"space-y-1"},No={class:"flex flex-wrap gap-x-4 gap-y-1"},Uo={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},zo={key:0,class:"space-y-2"},Po={class:"space-y-1 text-[11px] text-muted-foreground"},Fo={key:1,class:"mt-4 space-y-2"},Ko={class:"space-y-1 text-[11px] text-muted-foreground"},Ho={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},Jo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Go={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Yo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},Qo={class:"mt-4 space-y-3 text-sm"},qo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Xo={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},Wo={class:"flex items-center justify-between"},Zo={class:"flex items-center gap-2"},er={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},tr={class:"mt-4"},sr=["readonly"],or={class:"mt-6 flex items-center justify-end gap-2"},rr=["disabled"],He="accounts-register-task-cache",Je="accounts-login-task-cache",Ge="accounts-register-log-clear",Ye="accounts-login-log-clear",Qe="accounts-register-task-cleared-id",qe="accounts-login-task-cleared-id",St="1970-01-01 00:00:00",cr=ss({__name:"Accounts",setup(b){const w=fs(),{accounts:L,isLoading:re}=os(w),C=us(),le=a(""),Z=a("all"),p=a(new Set),G=a("table"),ne=a(!1),u=a(""),j=a(!1),M=a(""),ee=a(""),B=a(!1),ae=a([]),ie=a(1),ye=a(!1),N=a("register"),de=a(""),U=a(""),_e=a(!1),Y=a(!1),z=a(!1),Me=a(null),he=a(null),we=a(null),P=a(null),F=a(null),te=a(0),se=a(0),ue=a(!1),c=a(null),f=a(null),Xe=a(null),D=a(!1),T=a(!1),y=a(""),_=a({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),ke=a(null),We=a([]),Et=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],K=H(()=>{const e=le.value.trim().toLowerCase();return L.value.filter(t=>{const o=!e||t.id.toLowerCase().includes(e),i=Z.value==="all"||fe(t)===Z.value;return o&&i})}),O=H(()=>p.value.size),De=H(()=>K.value.length>0&&K.value.every(e=>p.value.has(e.id))),ce=async()=>{await w.loadAccounts(),p.value=new Set,z.value=!1},Ze=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},et=e=>{try{return localStorage.getItem(e)||null}catch{return null}},Ce=(e,t)=>{try{if(t){localStorage.setItem(e,t);return}localStorage.removeItem(e)}catch{}},tt=(e,t)=>{try{localStorage.setItem(e,JSON.stringify(t))}catch{}},st=e=>{try{localStorage.removeItem(e)}catch{}},ot=e=>{const t=localStorage.getItem(e),o=Number(t);return Number.isFinite(o)?o:0},Te=(e,t)=>{try{localStorage.setItem(e,String(t))}catch{}},Oe=(e,t=!0)=>{e&&(e.id&&e.id===P.value||(e.id&&P.value&&e.id!==P.value&&(P.value=null,Ce(Qe,null)),c.value=e,e.id&&e.id!==he.value&&(he.value=e.id,te.value=0,Te(Ge,0)),t&&tt(He,e)))},Se=(e,t=!0)=>{e&&(e.id&&e.id===F.value||(e.id&&F.value&&e.id!==F.value&&(F.value=null,Ce(qe,null)),f.value=e,e.id&&e.id!==we.value&&(we.value=e.id,se.value=0,Te(Ye,0)),t&&tt(Je,e)))},It=()=>{te.value=ot(Ge),se.value=ot(Ye),P.value=et(Qe),F.value=et(qe);const e=Ze(He);e&&e.id!==P.value&&(c.value=e,he.value=e.id||null);const t=Ze(Je);t&&t.id!==F.value&&(f.value=t,we.value=t.id||null)},Lt=()=>{ye.value=!0,N.value="register",de.value="",U.value="",_e.value=!1,ue.value=!1},Be=()=>{ye.value=!1},At=e=>{const t=[],o=[];return e.split(/\r?\n/).map(d=>d.trim()).filter(Boolean).forEach((d,x)=>{const v=d.split("----").map(S=>S.trim()),k=x+1;if(v.length){if(v[0].toLowerCase()==="duckmail"){if(v.length<3||!v[1]||!v[2]){o.push(`第 ${k} 行格式错误(duckmail)`);return}const S=v[1],$e=v.slice(2).join("----");t.push({id:S,secure_c_ses:"",csesidx:"",config_id:"",expires_at:St,mail_provider:"duckmail",mail_address:S,mail_password:$e});return}if(v.length>=4&&v[0]&&v[2]&&v[3]){const S=v[0],$e=v[1]||"",I=v[2],es=v.slice(3).join("----");t.push({id:S,secure_c_ses:"",csesidx:"",config_id:"",expires_at:St,mail_provider:"microsoft",mail_address:S,mail_password:$e,mail_client_id:I,mail_refresh_token:es,mail_tenant:"consumers"});return}o.push(`第 ${k} 行格式错误`)}}),{items:t,errors:o}},$t=async()=>{if(U.value="",!de.value.trim()){U.value="请输入导入内容";return}const{items:e,errors:t}=At(de.value);if(!e.length){U.value=t.length?t.join(","):"未识别到有效账号";return}if(t.length){U.value=t.slice(0,3).join(",");return}_e.value=!0;try{const i=[...await ft()],d=new Map(i.map((k,S)=>[k.id,S])),x=[];e.forEach(k=>{const S=d.get(k.id||"");if(S===void 0){i.push(k),x.push(k.id);return}const I={...i[S],mail_provider:k.mail_provider,mail_address:k.mail_address};k.mail_provider==="microsoft"?(I.mail_client_id=k.mail_client_id,I.mail_refresh_token=k.mail_refresh_token,I.mail_tenant=k.mail_tenant,I.mail_password=k.mail_password):(I.mail_password=k.mail_password,I.mail_client_id=void 0,I.mail_refresh_token=void 0,I.mail_tenant=void 0),i[S]=I,x.push(k.id)}),await w.updateConfig(i),await ce(),p.value=new Set(x),Be(),await C.ask({title:"导入成功",message:`已导入 ${x.length} 个账户并自动选中。是否立即刷新这些账户以获取 Cookie?`,confirmText:"立即刷新",cancelText:"稍后手动刷新"})&&await Ct()}catch(o){U.value=o.message||"导入失败"}finally{_e.value=!1}},Rt=async()=>{try{const e=[],t=c.value?.id,o=f.value?.id;if(t&&!Ee(t)&&e.push(ht(t)),o&&!Ie(o)&&e.push(wt(o)),!e.length){await Ke();return}await Promise.all(e)}catch(e){y.value=e?.message||"任务状态更新失败"}},Ne=async()=>{Y.value=!0,await Rt()},Vt=()=>{Y.value=!1},jt=()=>{const e=c.value?.id||null,t=f.value?.id||null;P.value=e,F.value=t,Ce(Qe,e),Ce(qe,t),te.value=c.value?.logs?.length||0,se.value=f.value?.logs?.length||0,Te(Ge,te.value),Te(Ye,se.value),c.value=null,f.value=null,he.value=null,we.value=null,y.value="",D.value=!1,T.value=!1,X(),W(),st(He),st(Je)},Ee=e=>!!(e&&e===P.value),Ie=e=>!!(e&&e===F.value),Mt=()=>{z.value=!z.value},oe=()=>{z.value=!1},rt=e=>{if(!z.value)return;const t=e.target;Me.value&&!Me.value.contains(t)&&(z.value=!1)};rs(async()=>{It(),await ce(),await Ke(),Xt(),document.addEventListener("click",rt)});const Q=H(()=>{const e=c.value?.logs||[];return te.value?e.slice(te.value):e}),q=H(()=>{const e=f.value?.logs||[];return se.value?e.slice(se.value):e}),Dt=H(()=>!!y.value||!!c.value||!!f.value||Q.value.length>0||q.value.length>0),Ot=async()=>{await as();const e=Xe.value;e&&(e.scrollTop=e.scrollHeight)};ls([Q,q,Y],async()=>{Y.value&&await Ot()},{deep:!0});const Bt=H(()=>{const e=c.value?.status,t=f.value?.status;return e==="running"||e==="pending"||t==="running"||t==="pending"}),Nt=H(()=>{if(y.value)return"bg-rose-500";if(Bt.value)return"bg-sky-400";const e=[];if(c.value){const d=c.value.success_count??0,x=c.value.fail_count??0,v=c.value.count??d+x;e.push({success:d,fail:x,total:v,status:c.value.status})}if(f.value){const d=f.value.success_count??0,x=f.value.fail_count??0,v=f.value.account_ids?.length??d+x;e.push({success:d,fail:x,total:v,status:f.value.status})}if(!e.length)return"bg-muted-foreground";const t=e.reduce((d,x)=>d+x.success,0),o=e.reduce((d,x)=>d+x.fail,0),i=e.reduce((d,x)=>d+(x.total||0),0);if(t>0&&o>0)return"bg-amber-400";if(o>0&&t===0)return"bg-rose-500";if(t>0&&o===0)return"bg-emerald-400";if(i===0){const d=e.every(v=>v.status==="success");if(e.some(v=>v.status==="failed"))return"bg-rose-500";if(d)return"bg-emerald-400"}return"bg-muted-foreground"});ns(()=>{X(),W(),qt(),document.removeEventListener("click",rt)});const fe=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?"429限流":e.cooldown_reason==="错误禁用"?"错误禁用":e.disabled?"手动禁用":e.status==="已过期"?"已过期":e.status==="即将过期"?"即将过期":"正常",lt=e=>{const t=fe(e);return t==="429限流"||t==="即将过期"?"bg-amber-200 text-amber-900":t==="错误禁用"||t==="已过期"?"bg-destructive/10 text-destructive":t==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},nt=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?!0:e.disabled||e.cooldown_reason==="错误禁用",at=e=>e==="已过期"?"过期":e==="未设置"?"未设置":e,it=e=>e.status==="已过期"?"text-rose-600":e.status==="即将过期"?"text-amber-700":e.status==="未设置"?"text-muted-foreground":"text-emerald-600",dt=e=>e<60?`${e} 秒`:e<3600?`${Math.ceil(e/60)} 分钟`:`${(e/3600).toFixed(1)} 小时`,Ue=e=>e.cooldown_seconds>0?"text-amber-700":e.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",ut=e=>{const t=fe(e);return t==="手动禁用"||t==="已过期"?"bg-muted/70":""},Le=e=>{const t=new Set(p.value);t.has(e)?t.delete(e):t.add(e),p.value=t},ct=()=>{if(De.value){p.value=new Set;return}p.value=new Set(K.value.map(e=>e.id))},Ut=(e,t)=>e.id||`account_${t+1}`,ft=async()=>(await h.getConfig()).accounts.map((t,o)=>({...t,id:Ut(t,o)})),vt=e=>`${e.time} [${e.level}] ${e.message}`,zt=(e,t)=>{let o=-1;for(let d=0;d<e.length;d+=1)if(e[d].id===t){o=d;break}if(o===-1)return u.value="未找到对应账号配置。",!1;const i=e[o];return _.value={id:i.id,secure_c_ses:i.secure_c_ses,csesidx:i.csesidx,config_id:i.config_id,host_c_oses:i.host_c_oses,expires_at:i.expires_at},We.value=e,ke.value=o,ne.value=!0,!0},xt=async e=>{u.value="";try{const t=await ft();zt(t,e)}catch(t){u.value=t.message||"加载账号配置失败"}},Pt=async()=>{M.value="";try{const e=await h.getConfig();ae.value=Array.isArray(e.accounts)?e.accounts:[],ee.value=JSON.stringify(pt(ae.value),null,2),B.value=!0,j.value=!0}catch(e){M.value=e.message||"加载账号配置失败"}},ze=()=>{j.value=!1,M.value="",B.value=!1},mt=()=>{const e=JSON.parse(ee.value);if(!Array.isArray(e))throw new Error("配置格式必须是数组。");return e},Ft=e=>typeof e!="string"||!e?e:e.length<=6?`${e.slice(0,2)}****`:`${e.slice(0,3)}****`,pt=e=>{const t=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password","mail_refresh_token","mail_client_id"]);return e.map(o=>{const i={...o};return t.forEach(d=>{const x=i[d];x&&(i[d]=Ft(x))}),i})},Kt=()=>{if(M.value="",!B.value){try{ae.value=mt()}catch(e){M.value=e.message||"JSON 格式错误";return}ee.value=JSON.stringify(pt(ae.value),null,2),B.value=!0;return}ee.value=JSON.stringify(ae.value,null,2),B.value=!1},Ht=async()=>{M.value="";try{const e=mt();await w.updateConfig(e),ze()}catch(e){M.value=e.message||"保存失败"}},Pe=()=>{ne.value=!1,u.value=""},Jt=async()=>{if(ke.value===null)return;const e=[...We.value];e[ke.value]={...e[ke.value],id:_.value.id,secure_c_ses:_.value.secure_c_ses,csesidx:_.value.csesidx,config_id:_.value.config_id,host_c_oses:_.value.host_c_oses||void 0,expires_at:_.value.expires_at||void 0};try{await w.updateConfig(e),Pe()}catch(t){u.value=t.message||"保存失败"}},Gt=async()=>{await w.bulkEnable(Array.from(p.value)),p.value=new Set},Yt=async()=>{await C.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"})&&(await w.bulkDisable(Array.from(p.value)),p.value=new Set)},Qt=async()=>{await C.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"})&&(await w.bulkDelete(Array.from(p.value)),p.value=new Set)},gt=async e=>{await w.enableAccount(e)},bt=async e=>{await C.ask({title:"禁用账号",message:"确定要禁用该账号吗?"})&&await w.disableAccount(e)},yt=async e=>{await C.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"})&&await w.deleteAccount(e)};let ve=null,xe=null,me=null,Ae=!1;const X=()=>{ve!==null&&(window.clearInterval(ve),ve=null)},W=()=>{xe!==null&&(window.clearInterval(xe),xe=null)},qt=()=>{me!==null&&(window.clearInterval(me),me=null),Ae=!1},_t=e=>e==="pending"?"等待中":e==="running"?"执行中":e==="success"?"成功":e==="failed"?"失败":e,ht=async e=>{if(Ee(e)){X();return}const t=await h.getRegisterTask(e);if(Ee(t.id)){X();return}Oe(t),t.status!=="running"&&t.status!=="pending"&&(D.value=!1,X(),await ce())},wt=async e=>{if(Ie(e)){W();return}const t=await h.getLoginTask(e);if(Ie(t.id)){W();return}Se(t),t.status!=="running"&&t.status!=="pending"&&(T.value=!1,W(),await ce())},kt=e=>{X(),ve=window.setInterval(()=>{ht(e).catch(t=>{y.value=t?.message||"注册任务更新失败",X(),D.value=!1})},3e3)},Fe=e=>{W(),xe=window.setInterval(()=>{wt(e).catch(t=>{y.value=t?.message||"刷新任务更新失败",W(),T.value=!1})},3e3)},Xt=()=>{me===null&&(me=window.setInterval(async()=>{if(!Ae&&!Y.value&&!(ve!==null||xe!==null)&&!(!D.value&&!T.value&&!c.value&&!f.value)){Ae=!0;try{await Ke()}catch(e){y.value=e?.message||"后台刷新失败"}finally{Ae=!1}}},6e3))},Ke=async()=>{try{const e=await h.getRegisterCurrent();e&&"id"in e&&!Ee(e.id)&&(Oe(e),(e.status==="running"||e.status==="pending")&&(D.value=!0,kt(e.id)))}catch(e){y.value=e.message||"加载注册任务失败"}try{const e=await h.getLoginCurrent();e&&"id"in e&&!Ie(e.id)&&(Se(e),(e.status==="running"||e.status==="pending")&&(T.value=!0,Fe(e.id)))}catch(e){y.value=e.message||"加载刷新任务失败"}},Wt=async()=>{y.value="",D.value=!0;try{const e=Number.isFinite(ie.value)&&ie.value>0?ie.value:void 0,t=await h.startRegister(e);Oe(t),kt(t.id),ye.value=!1,Y.value=!0}catch(e){y.value=e.message||"启动注册失败",D.value=!1}},Ct=async()=>{if(p.value.size){y.value="",T.value=!0;try{const e=await h.startLogin(Array.from(p.value));Se(e),Fe(e.id),Ne()}catch(e){y.value=e.message||"启动刷新失败",T.value=!1}}},Zt=async()=>{y.value="",T.value=!0;try{await h.checkLogin();const e=await h.getLoginCurrent();if(e&&"id"in e){Se(e),Fe(e.id),Ne();return}T.value=!1}catch(e){y.value=e.message||"触发刷新失败",T.value=!1}};return(e,t)=>(r(),l(ge,null,[s("div",vs,[s("section",xs,[s("div",ms,[s("div",ps,[A(s("input",{"onUpdate:modelValue":t[0]||(t[0]=o=>le.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[$,le.value]]),J(is,{modelValue:Z.value,"onUpdate:modelValue":t[1]||(t[1]=o=>Z.value=o),options:Et},null,8,["modelValue"])]),s("div",gs,[J(be,{modelValue:De.value,"onUpdate:modelValue":ct},{default:Tt(()=>[...t[27]||(t[27]=[pe(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+n(O.value)+" / "+n(K.value.length)+" 个账号",1),s("div",bs,[s("button",{type:"button",class:g(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",G.value==="table"?"bg-accent text-accent-foreground":""]),onClick:t[2]||(t[2]=o=>G.value="table"),"aria-label":"列表视图"},[...t[28]||(t[28]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:g(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",G.value==="card"?"bg-accent text-accent-foreground":""]),onClick:t[3]||(t[3]=o=>G.value="card"),"aria-label":"卡片视图"},[...t[29]||(t[29]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",ys,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:R(re),onClick:ce}," 刷新列表 ",8,_s),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pt}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:D.value,onClick:Lt}," 添加账户 ",8,hs),s("div",{ref_key:"moreActionsRef",ref:Me,class:"relative"},[s("button",{class:g(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",z.value?"bg-accent text-accent-foreground":""]),onClick:Mt},[t[30]||(t[30]=pe(" 更多操作 ",-1)),t[31]||(t[31]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),Dt.value?(r(),l("span",{key:0,class:g(["ml-1 h-2 w-2 rounded-full",Nt.value]),"aria-hidden":"true"},null,2)):m("",!0)],2),z.value?(r(),l("div",ws,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:t[4]||(t[4]=o=>{Ne(),oe()})}," 任务状态 "),t[32]||(t[32]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",T.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:T.value,onClick:t[5]||(t[5]=o=>{Zt(),oe()})}," 刷新过期 ",10,ks),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!O.value||T.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!O.value||T.value,onClick:t[6]||(t[6]=o=>{Ct(),oe()})}," 刷新选中 ",10,Cs),t[33]||(t[33]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[7]||(t[7]=o=>{Gt(),oe()})}," 批量启用 ",10,Ts),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[8]||(t[8]=o=>{Yt(),oe()})}," 批量禁用 ",10,Ss),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[9]||(t[9]=o=>{Qt(),oe()})}," 批量删除 ",10,Es)])):m("",!0)],512)]),G.value==="card"?(r(),l("div",Is,[(r(!0),l(ge,null,Ve(K.value,o=>(r(),l("div",{key:o.id,class:g(["rounded-2xl border border-border bg-card p-4",ut(o)]),onClick:i=>Le(o.id)},[s("div",As,[s("div",null,[t[34]||(t[34]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",$s,n(o.id),1)]),s("div",Rs,[J(be,{modelValue:p.value.has(o.id),"onUpdate:modelValue":i=>Le(o.id),onClick:t[10]||(t[10]=V(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:g(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",lt(o)])},n(fe(o)),3)])]),s("div",Vs,[s("div",null,[t[35]||(t[35]=s("p",null,"剩余时间",-1)),s("p",{class:g(["mt-1 text-sm font-semibold",it(o)])},n(at(o.remaining_display)),3),o.expires_at?(r(),l("p",js,n(o.expires_at),1)):m("",!0)]),s("div",null,[t[36]||(t[36]=s("p",null,"冷却",-1)),s("p",{class:g(["mt-1",Ue(o)])},[o.cooldown_seconds>0?(r(),l("span",Ms,n(dt(o.cooldown_seconds))+" · "+n(o.cooldown_reason),1)):(r(),l("span",Ds,n(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[t[37]||(t[37]=s("p",null,"失败数",-1)),s("p",Os,n(o.error_count),1)]),s("div",null,[t[38]||(t[38]=s("p",null,"会话数",-1)),s("p",Bs,n(o.conversation_count),1)])]),s("div",Ns,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>xt(o.id),["stop"])}," 编辑 ",8,Us),nt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[11]||(t[11]=V(()=>{},["stop"])),i=>gt(o.id)]}," 启用 ",8,zs)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[12]||(t[12]=V(()=>{},["stop"])),i=>bt(o.id)]}," 禁用 ",8,Ps)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[t[13]||(t[13]=V(()=>{},["stop"])),i=>yt(o.id)]}," 删除 ",8,Fs)])],10,Ls))),128)),!K.value.length&&!R(re)?(r(),l("div",Ks," 暂无账号数据,请检查后台配置。 ")):m("",!0)])):(r(),l("div",Hs,[s("table",Js,[s("thead",Gs,[s("tr",null,[s("th",Ys,[J(be,{modelValue:De.value,"onUpdate:modelValue":ct},null,8,["modelValue"])]),t[40]||(t[40]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),t[41]||(t[41]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",Qs,[s("span",qs,[t[39]||(t[39]=pe(" 剩余/过期 ",-1)),J(cs,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),t[42]||(t[42]=s("th",{class:"py-3 pr-6"},"冷却",-1)),t[43]||(t[43]=s("th",{class:"py-3 pr-6"},"失败数",-1)),t[44]||(t[44]=s("th",{class:"py-3 pr-6"},"会话数",-1)),t[45]||(t[45]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",Xs,[!K.value.length&&!R(re)?(r(),l("tr",Ws,[...t[46]||(t[46]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):m("",!0),(r(!0),l(ge,null,Ve(K.value,o=>(r(),l("tr",{key:o.id,class:g(["border-t border-border",ut(o)]),onClick:i=>Le(o.id)},[s("td",{class:"py-4 pr-4",onClick:t[14]||(t[14]=V(()=>{},["stop"]))},[J(be,{modelValue:p.value.has(o.id),"onUpdate:modelValue":i=>Le(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",eo,n(o.id),1),s("td",to,[s("span",{class:g(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",lt(o)])},n(fe(o)),3)]),s("td",so,[s("div",{class:g(["text-sm font-semibold",it(o)])},n(at(o.remaining_display)),3),o.expires_at?(r(),l("span",oo,n(o.expires_at),1)):m("",!0)]),s("td",ro,[o.cooldown_seconds>0?(r(),l("span",{key:0,class:g(Ue(o))},n(dt(o.cooldown_seconds))+" · "+n(o.cooldown_reason),3)):(r(),l("span",{key:1,class:g(Ue(o))},n(o.cooldown_reason||"无冷却"),3))]),s("td",lo,n(o.error_count),1),s("td",no,n(o.conversation_count),1),s("td",ao,[s("div",io,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>xt(o.id),["stop"])}," 编辑 ",8,uo),nt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>gt(o.id),["stop"])}," 启用 ",8,co)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>bt(o.id),["stop"])}," 禁用 ",8,fo)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:V(i=>yt(o.id),["stop"])}," 删除 ",8,vo)])])],10,Zs))),128))])])]))])]),J(ds,{open:R(C).open.value,title:R(C).title.value,message:R(C).message.value,"confirm-text":R(C).confirmText.value,"cancel-text":R(C).cancelText.value,onConfirm:R(C).confirm,onCancel:R(C).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(r(),Re(je,{to:"body"},[ye.value?(r(),l("div",xo,[s("div",mo,[s("div",po,[s("div",null,[t[47]||(t[47]=s("p",{class:"text-sm font-medium text-foreground"},"添加账户",-1)),s("p",go,n(N.value==="register"?"创建 DuckMail 账号并自动注册":"批量导入账户配置"),1)]),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Be}," 关闭 ")]),s("div",bo,[s("div",yo,[s("div",_o,[s("button",{type:"button",class:g(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",N.value==="register"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[15]||(t[15]=o=>N.value="register")}," 自动注册 ",2),s("button",{type:"button",class:g(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",N.value==="import"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[16]||(t[16]=o=>N.value="import")}," 批量导入 ",2)]),N.value==="register"?(r(),l("div",ho,[t[48]||(t[48]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),A(s("input",{"onUpdate:modelValue":t[17]||(t[17]=o=>ie.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,ie.value,void 0,{number:!0}]]),t[49]||(t[49]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"}," 默认域名来自设置面板(可在“配置面板”中修改) ",-1))])):(r(),l("div",wo,[t[50]||(t[50]=s("label",{class:"block text-xs text-muted-foreground"},"批量导入(每行一个)",-1)),A(s("textarea",{"onUpdate:modelValue":t[18]||(t[18]=o=>de.value=o),class:"min-h-[140px] w-full rounded-2xl border border-input bg-background px-3 py-2 text-xs font-mono",placeholder:`duckmail----you@example.com----password
2
+ user@outlook.com----loginPassword----clientId----refreshToken`},null,512),[[$,de.value]]),t[51]||(t[51]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"支持两种格式:"),s("p",{class:"mt-1 font-mono"},"duckmail----email----password"),s("p",{class:"mt-1 font-mono"},"email----password----clientId----refreshToken"),s("p",{class:"mt-2 text-[11px]"},'导入后请执行一次"刷新选中"以获取 Cookie。')],-1)),U.value?(r(),l("div",ko,n(U.value),1)):m("",!0)])),t[53]||(t[53]=s("div",{class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-[11px] leading-relaxed"},[s("p",{class:"text-xs font-bold text-rose-600"},"⚠️ 严禁滥用:禁止将本工具用于商业用途或任何形式的滥用(无论规模大小)"),s("p",{class:"mt-1 text-muted-foreground"},[pe("详细声明请查看项目 "),s("a",{href:"https://github.com/Dreamy-rain/gemini-business2api/blob/main/docs/DISCLAIMER.md",target:"_blank",class:"text-primary hover:underline font-medium"},"DISCLAIMER.md")])],-1)),J(be,{modelValue:ue.value,"onUpdate:modelValue":t[19]||(t[19]=o=>ue.value=o)},{default:Tt(()=>[...t[52]||(t[52]=[pe(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])])]),s("div",Co,[s("div",To,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Be}," 取消 "),N.value==="register"?(r(),l("button",{key:0,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:D.value||!ue.value,onClick:Wt}," 开始注册 ",8,So)):(r(),l("button",{key:1,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:_e.value||!ue.value,onClick:$t}," 导入并保存 ",8,Eo))])])])])):m("",!0)])),(r(),Re(je,{to:"body"},[Y.value?(r(),l("div",Io,[s("div",Lo,[s("div",Ao,[t[54]||(t[54]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",$o,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary",disabled:!Q.value.length&&!q.value.length&&!c.value&&!f.value&&!y.value,onClick:jt}," 清空日志 ",8,Ro),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Vt}," 关闭 ")])]),s("div",Vo,[y.value?(r(),l("div",jo,n(y.value),1)):m("",!0),c.value||f.value?(r(),l("div",Mo,[c.value?(r(),l("div",Do,[t[55]||(t[55]=s("div",{class:"font-medium text-foreground"},"注册任务",-1)),s("div",Oo,[s("span",null,"状态:"+n(_t(c.value.status)),1),s("span",null,"进度:"+n(c.value.progress)+"/"+n(c.value.count),1),s("span",null,"成功:"+n(c.value.success_count),1),s("span",null,"失败:"+n(c.value.fail_count),1)])])):m("",!0),f.value?(r(),l("div",Bo,[t[56]||(t[56]=s("div",{class:"font-medium text-foreground"},"刷新任务",-1)),s("div",No,[s("span",null,"状态:"+n(_t(f.value.status)),1),s("span",null,"进度:"+n(f.value.progress)+"/"+n(f.value.account_ids.length),1),s("span",null,"成功:"+n(f.value.success_count),1),s("span",null,"失败:"+n(f.value.fail_count),1)])])):m("",!0)])):m("",!0),Q.value.length||q.value.length?(r(),l("div",Uo,[s("div",{ref_key:"taskLogsRef",ref:Xe,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[Q.value.length?(r(),l("div",zo,[t[57]||(t[57]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",Po,[(r(!0),l(ge,null,Ve(Q.value,(o,i)=>(r(),l("div",{key:`reg-${i}`,class:"font-mono"},n(vt(o)),1))),128))])])):m("",!0),q.value.length?(r(),l("div",Fo,[t[58]||(t[58]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",Ko,[(r(!0),l(ge,null,Ve(q.value,(o,i)=>(r(),l("div",{key:`login-${i}`,class:"font-mono"},n(vt(o)),1))),128))])])):m("",!0)],512)])):m("",!0),!y.value&&!c.value&&!f.value&&!Q.value.length&&!q.value.length?(r(),l("div",Ho," 暂无任务 ")):m("",!0)])])])):m("",!0)])),(r(),Re(je,{to:"body"},[ne.value?(r(),l("div",Jo,[s("div",Go,[s("div",{class:"flex items-center justify-between"},[t[59]||(t[59]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Pe}," 关闭 ")]),u.value?(r(),l("div",Yo,n(u.value),1)):m("",!0),s("div",Qo,[t[60]||(t[60]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),A(s("input",{"onUpdate:modelValue":t[20]||(t[20]=o=>_.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[$,_.value.id]]),t[61]||(t[61]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),A(s("textarea",{"onUpdate:modelValue":t[21]||(t[21]=o=>_.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[$,_.value.secure_c_ses]]),t[62]||(t[62]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),A(s("input",{"onUpdate:modelValue":t[22]||(t[22]=o=>_.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.csesidx]]),t[63]||(t[63]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),A(s("input",{"onUpdate:modelValue":t[23]||(t[23]=o=>_.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.config_id]]),t[64]||(t[64]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),A(s("input",{"onUpdate:modelValue":t[24]||(t[24]=o=>_.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.host_c_oses]]),t[65]||(t[65]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),A(s("input",{"onUpdate:modelValue":t[25]||(t[25]=o=>_.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[$,_.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Jt}," 保存 ")])])])):m("",!0)])),(r(),Re(je,{to:"body"},[j.value?(r(),l("div",qo,[s("div",Xo,[s("div",Wo,[t[66]||(t[66]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",Zo,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Kt},n(B.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:ze}," 关闭 ")])]),M.value?(r(),l("div",er,n(M.value),1)):m("",!0),s("div",tr,[A(s("textarea",{"onUpdate:modelValue":t[26]||(t[26]=o=>ee.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:B.value},null,8,sr),[[$,ee.value]])]),s("div",or,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:ze}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Ht,disabled:B.value}," 保存 ",8,rr)])])])):m("",!0)]))],64))}});export{cr as default};
static/assets/Accounts-BBKUc_zD.js CHANGED
@@ -0,0 +1,2 @@
 
 
 
1
+ import{g as E,C as os,h as i,d as rs,D as ls,i as J,o as ns,z as as,j as is,c as n,a as s,p as G,m as Re,q as R,v as V,s as $t,t as a,n as p,u as j,b as g,f as ee,F as ge,r as Ve,T as je,E as ds,w as M,e as l,G as us}from"./index-C4edAQLF.js";import{_ as cs}from"./SelectMenu.vue_vue_type_script_setup_true_lang-Cu_3WwPc.js";import{_ as be}from"./Checkbox.vue_vue_type_script_setup_true_lang-41XRw3c5.js";import{_ as fs}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-DW0P4Bk8.js";import{u as vs}from"./useConfirmDialog-wyft8rf-.js";import{_ as ms}from"./HelpTip.vue_vue_type_script_setup_true_lang-CWJidBqq.js";const w={list:()=>E.get("/admin/accounts"),getConfig:()=>E.get("/admin/accounts-config"),updateConfig:y=>E.put("/admin/accounts-config",y),delete:y=>E.delete(`/admin/accounts/${y}`),disable:y=>E.put(`/admin/accounts/${y}/disable`),enable:y=>E.put(`/admin/accounts/${y}/enable`),startRegister:(y,k)=>E.post("/admin/register/start",{count:y,domain:k}),getRegisterTask:y=>E.get(`/admin/register/task/${y}`),getRegisterCurrent:()=>E.get("/admin/register/current"),startLogin:y=>E.post("/admin/login/start",y),getLoginTask:y=>E.get(`/admin/login/task/${y}`),getLoginCurrent:()=>E.get("/admin/login/current"),checkLogin:()=>E.post("/admin/login/check")},ps=os("accounts",()=>{const y=i([]),k=i(!1);async function A(){k.value=!0;try{const x=await w.list();y.value=Array.isArray(x)?x:x.accounts||[]}finally{k.value=!1}}async function ne(x){await w.delete(x),await A()}async function T(x){await w.disable(x),await A()}async function d(x){await w.enable(x),await A()}async function ae(x){await Promise.all(x.map($=>w.enable($))),await A()}async function te(x){await Promise.all(x.map($=>w.disable($))),await A()}async function b(x){await Promise.all(x.map($=>w.delete($))),await A()}async function Y(x){await w.updateConfig(x),await A()}return{accounts:y,isLoading:k,loadAccounts:A,deleteAccount:ne,disableAccount:T,enableAccount:d,bulkEnable:ae,bulkDisable:te,bulkDelete:b,updateConfig:Y}}),xs={class:"space-y-8"},gs={class:"rounded-3xl border border-border bg-card p-6"},bs={class:"flex flex-wrap items-center justify-between gap-4"},ys={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},_s={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},hs={class:"ml-auto flex items-center gap-2 sm:ml-0"},ws={class:"mt-4 flex flex-wrap items-center gap-2"},ks=["disabled"],Cs=["disabled"],Ts={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},Ss=["disabled"],$s=["disabled"],Is=["disabled"],Es=["disabled"],Ls=["disabled"],As={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},Rs=["onClick"],Vs={class:"flex items-start justify-between gap-3"},js={class:"mt-1 font-mono text-xs text-foreground"},Ms={class:"flex items-center gap-2"},Ds={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},Os={key:0,class:"mt-1 text-[11px]"},Bs={key:0},Ns={key:1},Us={class:"mt-1 text-sm font-semibold text-foreground"},zs={class:"mt-1 text-sm font-semibold text-foreground"},Ps={class:"mt-4 flex flex-wrap items-center gap-2"},Fs=["onClick"],Ks=["onClick"],Hs=["onClick"],Js=["onClick"],Gs={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Ys={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},qs={class:"min-w-full text-left text-sm"},Qs={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Xs={class:"py-3 pr-4"},Ws={class:"py-3 pr-6"},Zs={class:"inline-flex items-center gap-2"},eo={class:"text-sm text-foreground"},to={key:0},so=["onClick"],oo={class:"py-4 pr-6 font-mono text-xs text-foreground"},ro={class:"py-4 pr-6"},lo={class:"py-4 pr-6"},no={key:0,class:"block text-[11px] text-muted-foreground"},ao={class:"py-4 pr-6 text-xs"},io={class:"py-4 pr-6 text-xs text-muted-foreground"},uo={class:"py-4 pr-6 text-xs text-muted-foreground"},co={class:"py-4 text-right"},fo={class:"flex flex-wrap justify-end gap-2"},vo=["onClick"],mo=["onClick"],po=["onClick"],xo=["onClick"],go={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},bo={class:"flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},yo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},_o={class:"mt-1 text-xs text-muted-foreground"},ho={class:"scrollbar-slim flex-1 overflow-y-auto px-6 py-4"},wo={class:"space-y-4 text-sm"},ko={class:"flex rounded-full border border-border bg-muted/30 p-1 text-xs"},Co={key:0,class:"space-y-4"},To={key:1,class:"space-y-4"},So={key:0,class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-600"},$o={class:"border-t border-border/60 px-6 py-4"},Io={class:"flex items-center justify-end gap-2"},Eo=["disabled"],Lo=["disabled"],Ao={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Ro={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},Vo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},jo={class:"flex items-center gap-2"},Mo=["disabled"],Do={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},Oo={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},Bo={key:1,class:"grid gap-3 text-xs text-muted-foreground"},No={key:0,class:"space-y-1"},Uo={class:"flex items-center gap-2 font-medium text-foreground"},zo={class:"flex flex-wrap gap-x-4 gap-y-1"},Po={key:1,class:"space-y-1"},Fo={class:"flex items-center gap-2 font-medium text-foreground"},Ko={class:"flex flex-wrap gap-x-4 gap-y-1"},Ho={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},Jo={key:0,class:"space-y-2"},Go={class:"space-y-1 text-[11px] text-muted-foreground"},Yo={key:1,class:"mt-4 space-y-2"},qo={class:"space-y-1 text-[11px] text-muted-foreground"},Qo={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},Xo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Wo={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Zo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},er={class:"mt-4 space-y-3 text-sm"},tr={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},sr={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},or={class:"flex items-center justify-between"},rr={class:"flex items-center gap-2"},lr={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},nr={class:"mt-4"},ar=["readonly"],ir={class:"mt-6 flex items-center justify-end gap-2"},dr=["disabled"],Je="accounts-register-task-cache",Ge="accounts-login-task-cache",Ye="accounts-register-log-clear",qe="accounts-login-log-clear",Qe="accounts-register-task-cleared-id",Xe="accounts-login-task-cleared-id",It="1970-01-01 00:00:00",xr=rs({__name:"Accounts",setup(y){const k=ps(),{accounts:A,isLoading:ne}=ls(k),T=vs(),d=ds(),ae=i(""),te=i("all"),b=i(new Set),Y=i("table"),x=i(!1),$=i(""),Me=i(!1),D=i(""),se=i(""),N=i(!1),ie=i([]),de=i(1),ye=i(!1),U=i("register"),ue=i(""),z=i(""),_e=i(!1),q=i(!1),P=i(!1),De=i(null),he=i(null),we=i(null),F=i(null),K=i(null),oe=i(0),re=i(0),ce=i(!1),c=i(null),f=i(null),We=i(null),O=i(!1),S=i(!1),_=i(""),h=i({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),ke=i(null),Ze=i([]),Et=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],H=J(()=>{const t=ae.value.trim().toLowerCase();return A.value.filter(e=>{const o=!t||e.id.toLowerCase().includes(t),r=te.value==="all"||ve(e)===te.value;return o&&r})}),B=J(()=>b.value.size),Oe=J(()=>H.value.length>0&&H.value.every(t=>b.value.has(t.id))),fe=async()=>{await k.loadAccounts(),b.value=new Set,P.value=!1},et=t=>{try{const e=localStorage.getItem(t);return e?JSON.parse(e):null}catch{return null}},tt=t=>{try{return localStorage.getItem(t)||null}catch{return null}},Ce=(t,e)=>{try{if(e){localStorage.setItem(t,e);return}localStorage.removeItem(t)}catch{}},st=(t,e)=>{try{localStorage.setItem(t,JSON.stringify(e))}catch{}},ot=t=>{try{localStorage.removeItem(t)}catch{}},rt=t=>{const e=localStorage.getItem(t),o=Number(e);return Number.isFinite(o)?o:0},Te=(t,e)=>{try{localStorage.setItem(t,String(e))}catch{}},Be=(t,e=!0)=>{t&&(t.id&&t.id===F.value||(t.id&&F.value&&t.id!==F.value&&(F.value=null,Ce(Qe,null)),c.value=t,t.id&&t.id!==he.value&&(he.value=t.id,oe.value=0,Te(Ye,0)),e&&st(Je,t)))},Se=(t,e=!0)=>{t&&(t.id&&t.id===K.value||(t.id&&K.value&&t.id!==K.value&&(K.value=null,Ce(Xe,null)),f.value=t,t.id&&t.id!==we.value&&(we.value=t.id,re.value=0,Te(qe,0)),e&&st(Ge,t)))},Lt=()=>{oe.value=rt(Ye),re.value=rt(qe),F.value=tt(Qe),K.value=tt(Xe);const t=et(Je);t&&t.id!==F.value&&(c.value=t,he.value=t.id||null);const e=et(Ge);e&&e.id!==K.value&&(f.value=e,we.value=e.id||null)},At=()=>{ye.value=!0,U.value="register",ue.value="",z.value="",_e.value=!1,ce.value=!1},Ne=()=>{ye.value=!1},Rt=t=>{const e=[],o=[];return t.split(/\r?\n/).map(u=>u.trim()).filter(Boolean).forEach((u,m)=>{const v=u.split("----").map(I=>I.trim()),C=m+1;if(v.length){if(v[0].toLowerCase()==="duckmail"){if(v.length<3||!v[1]||!v[2]){o.push(`第 ${C} 行格式错误(duckmail)`);return}const I=v[1],Ae=v.slice(2).join("----");e.push({id:I,secure_c_ses:"",csesidx:"",config_id:"",expires_at:It,mail_provider:"duckmail",mail_address:I,mail_password:Ae});return}if(v.length>=4&&v[0]&&v[2]&&v[3]){const I=v[0],Ae=v[1]||"",L=v[2],ss=v.slice(3).join("----");e.push({id:I,secure_c_ses:"",csesidx:"",config_id:"",expires_at:It,mail_provider:"microsoft",mail_address:I,mail_password:Ae,mail_client_id:L,mail_refresh_token:ss,mail_tenant:"consumers"});return}o.push(`第 ${C} 行格式错误`)}}),{items:e,errors:o}},Vt=async()=>{if(z.value="",!ue.value.trim()){z.value="请输入导��内容";return}const{items:t,errors:e}=Rt(ue.value);if(!t.length){z.value=e.length?e.join(","):"未识别到有效账号";return}if(e.length){z.value=e.slice(0,3).join(",");return}_e.value=!0;try{const r=[...await vt()],u=new Map(r.map((C,I)=>[C.id,I])),m=[];t.forEach(C=>{const I=u.get(C.id||"");if(I===void 0){r.push(C),m.push(C.id);return}const L={...r[I],mail_provider:C.mail_provider,mail_address:C.mail_address};C.mail_provider==="microsoft"?(L.mail_client_id=C.mail_client_id,L.mail_refresh_token=C.mail_refresh_token,L.mail_tenant=C.mail_tenant,L.mail_password=C.mail_password):(L.mail_password=C.mail_password,L.mail_client_id=void 0,L.mail_refresh_token=void 0,L.mail_tenant=void 0),r[I]=L,m.push(C.id)}),await k.updateConfig(r),await fe(),b.value=new Set(m),d.success(`成功导入 ${m.length} 个账户`),Ne(),await T.ask({title:"导入成功",message:`已导入 ${m.length} 个账户并自动选中。是否立即刷新这些账户以获取 Cookie?`,confirmText:"立即刷新",cancelText:"稍后手动刷新"})&&await St()}catch(o){z.value=o.message||"导入失败",d.error(o.message||"导入失败")}finally{_e.value=!1}},jt=async()=>{try{const t=[],e=c.value?.id,o=f.value?.id;if(e&&!$e(e)&&t.push(kt(e)),o&&!Ie(o)&&t.push(Ct(o)),!t.length){await He();return}await Promise.all(t)}catch(t){_.value=t?.message||"任务状态更新失败"}},Ue=async()=>{q.value=!0,await jt()},Mt=()=>{q.value=!1},Dt=()=>{const t=c.value?.id||null,e=f.value?.id||null;F.value=t,K.value=e,Ce(Qe,t),Ce(Xe,e),oe.value=c.value?.logs?.length||0,re.value=f.value?.logs?.length||0,Te(Ye,oe.value),Te(qe,re.value),c.value=null,f.value=null,he.value=null,we.value=null,_.value="",O.value=!1,S.value=!1,W(),Z(),ot(Je),ot(Ge)},$e=t=>!!(t&&t===F.value),Ie=t=>!!(t&&t===K.value),Ot=()=>{P.value=!P.value},le=()=>{P.value=!1},lt=t=>{if(!P.value)return;const e=t.target;De.value&&!De.value.contains(e)&&(P.value=!1)};ns(async()=>{Lt(),await fe(),await He(),Zt(),document.addEventListener("click",lt)});const Q=J(()=>{const t=c.value?.logs||[];return oe.value?t.slice(oe.value):t}),X=J(()=>{const t=f.value?.logs||[];return re.value?t.slice(re.value):t}),Bt=J(()=>!!_.value||!!c.value||!!f.value||Q.value.length>0||X.value.length>0),Nt=async()=>{await us();const t=We.value;t&&(t.scrollTop=t.scrollHeight)};as([Q,X,q],async()=>{q.value&&await Nt()},{deep:!0});const Ut=J(()=>{const t=c.value?.status,e=f.value?.status;return t==="running"||t==="pending"||e==="running"||e==="pending"}),zt=J(()=>{if(_.value)return"bg-rose-500";if(Ut.value)return"bg-sky-400";const t=[];if(c.value){const u=c.value.success_count??0,m=c.value.fail_count??0,v=c.value.count??u+m;t.push({success:u,fail:m,total:v,status:c.value.status})}if(f.value){const u=f.value.success_count??0,m=f.value.fail_count??0,v=f.value.account_ids?.length??u+m;t.push({success:u,fail:m,total:v,status:f.value.status})}if(!t.length)return"bg-muted-foreground";const e=t.reduce((u,m)=>u+m.success,0),o=t.reduce((u,m)=>u+m.fail,0),r=t.reduce((u,m)=>u+(m.total||0),0);if(e>0&&o>0)return"bg-amber-400";if(o>0&&e===0)return"bg-rose-500";if(e>0&&o===0)return"bg-emerald-400";if(r===0){const u=t.every(v=>v.status==="success");if(t.some(v=>v.status==="failed"))return"bg-rose-500";if(u)return"bg-emerald-400"}return"bg-muted-foreground"});is(()=>{W(),Z(),Wt(),document.removeEventListener("click",lt)});const ve=t=>t.cooldown_reason?.includes("429")&&t.cooldown_seconds>0?"429限流":t.cooldown_reason==="错误禁用"?"错误禁用":t.disabled?"手动禁用":t.status==="已过期"?"已过期":t.status==="即将过期"?"即将过期":"正常",nt=t=>{const e=ve(t);return e==="429限流"||e==="即将过期"?"bg-amber-200 text-amber-900":e==="错误禁用"||e==="已过期"?"bg-destructive/10 text-destructive":e==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},at=t=>t.cooldown_reason?.includes("429")&&t.cooldown_seconds>0?!0:t.disabled||t.cooldown_reason==="错误禁用",it=t=>t==="已过期"?"过期":t==="未设置"?"未设置":t,dt=t=>t.status==="已过期"?"text-rose-600":t.status==="即将过期"?"text-amber-700":t.status==="未设置"?"text-muted-foreground":"text-emerald-600",ut=t=>t<60?`${t} 秒`:t<3600?`${Math.ceil(t/60)} 分钟`:`${(t/3600).toFixed(1)} 小时`,ze=t=>t.cooldown_seconds>0?"text-amber-700":t.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",ct=t=>{const e=ve(t);return e==="手动禁用"||e==="已过期"?"bg-muted/70":""},Ee=t=>{const e=new Set(b.value);e.has(t)?e.delete(t):e.add(t),b.value=e},ft=()=>{if(Oe.value){b.value=new Set;return}b.value=new Set(H.value.map(t=>t.id))},Pt=(t,e)=>t.id||`account_${e+1}`,vt=async()=>(await w.getConfig()).accounts.map((e,o)=>({...e,id:Pt(e,o)})),mt=t=>`${t.time} [${t.level}] ${t.message}`,Ft=(t,e)=>{let o=-1;for(let u=0;u<t.length;u+=1)if(t[u].id===e){o=u;break}if(o===-1)return $.value="未找到对应账号配置。",!1;const r=t[o];return h.value={id:r.id,secure_c_ses:r.secure_c_ses,csesidx:r.csesidx,config_id:r.config_id,host_c_oses:r.host_c_oses,expires_at:r.expires_at},Ze.value=t,ke.value=o,x.value=!0,!0},pt=async t=>{$.value="";try{const e=await vt();Ft(e,t)}catch(e){$.value=e.message||"加载账号配置失败"}},Kt=async()=>{D.value="";try{const t=await w.getConfig();ie.value=Array.isArray(t.accounts)?t.accounts:[],se.value=JSON.stringify(gt(ie.value),null,2),N.value=!0,Me.value=!0}catch(t){D.value=t.message||"加载账号配置失败"}},Pe=()=>{Me.value=!1,D.value="",N.value=!1},xt=()=>{const t=JSON.parse(se.value);if(!Array.isArray(t))throw new Error("配置格式必须是数组。");return t},Ht=t=>typeof t!="string"||!t?t:t.length<=6?`${t.slice(0,2)}****`:`${t.slice(0,3)}****`,gt=t=>{const e=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password","mail_refresh_token","mail_client_id"]);return t.map(o=>{const r={...o};return e.forEach(u=>{const m=r[u];m&&(r[u]=Ht(m))}),r})},Jt=()=>{if(D.value="",!N.value){try{ie.value=xt()}catch(t){D.value=t.message||"JSON 格式错误";return}se.value=JSON.stringify(gt(ie.value),null,2),N.value=!0;return}se.value=JSON.stringify(ie.value,null,2),N.value=!1},Gt=async()=>{D.value="";try{const t=xt();await k.updateConfig(t),d.success("配置保存成功"),Pe()}catch(t){D.value=t.message||"保存失败",d.error(t.message||"保存失败")}},Fe=()=>{x.value=!1,$.value=""},Yt=async()=>{if(ke.value===null)return;const t=[...Ze.value];t[ke.value]={...t[ke.value],id:h.value.id,secure_c_ses:h.value.secure_c_ses,csesidx:h.value.csesidx,config_id:h.value.config_id,host_c_oses:h.value.host_c_oses||void 0,expires_at:h.value.expires_at||void 0};try{await k.updateConfig(t),d.success("账号编辑成功"),Fe()}catch(e){$.value=e.message||"保存失败",d.error(e.message||"保存失败")}},qt=async()=>{try{await k.bulkEnable(Array.from(b.value)),d.success("批量启用成功"),b.value=new Set}catch(t){d.error(t.message||"批量启用失败")}},Qt=async()=>{if(await T.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"}))try{await k.bulkDisable(Array.from(b.value)),d.success("批量禁用成功"),b.value=new Set}catch(e){d.error(e.message||"批量禁用失败")}},Xt=async()=>{if(await T.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"}))try{await k.bulkDelete(Array.from(b.value)),d.success("批量删除成功"),b.value=new Set}catch(e){d.error(e.message||"批量删除失败")}},bt=async t=>{try{await k.enableAccount(t),d.success("账号已启用")}catch(e){d.error(e.message||"启用失败")}},yt=async t=>{if(await T.ask({title:"禁用账号",message:"确定要禁用该账号吗?"}))try{await k.disableAccount(t),d.success("账号已禁用")}catch(o){d.error(o.message||"禁用失败")}},_t=async t=>{if(await T.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"}))try{await k.deleteAccount(t),d.success("账号已删除")}catch(o){d.error(o.message||"删除失败")}};let me=null,pe=null,xe=null,Le=!1;const W=()=>{me!==null&&(window.clearInterval(me),me=null)},Z=()=>{pe!==null&&(window.clearInterval(pe),pe=null)},Wt=()=>{xe!==null&&(window.clearInterval(xe),xe=null),Le=!1},ht=t=>t==="pending"?"等待中":t==="running"?"执行中":t==="success"?"成功":t==="failed"?"失败":t,wt=t=>{const e=t.status,o=t.success_count??0,r=t.fail_count??0;if(e==="running"||e==="pending")return"bg-sky-400";if(e==="success"||e==="failed"){if(o>0&&r===0)return"bg-emerald-400";if(r>0&&o===0)return"bg-rose-500";if(o>0&&r>0)return"bg-amber-400"}return"bg-muted-foreground"},kt=async t=>{if($e(t)){W();return}const e=await w.getRegisterTask(t);if($e(e.id)){W();return}if(Be(e),e.status!=="running"&&e.status!=="pending"){O.value=!1,W(),await fe();const o=e.success_count||0,r=e.fail_count||0;o>0&&r>0?d.success(`注册任务完成:成功 ${o},失败 ${r}`):o>0&&r===0?d.success(`注册任务完成:全部成功 (${o})`):r>0&&o===0?d.error(`注册任务完成:全部失败 (${r})`):d.error("注册任务失败")}},Ct=async t=>{if(Ie(t)){Z();return}const e=await w.getLoginTask(t);if(Ie(e.id)){Z();return}if(Se(e),e.status!=="running"&&e.status!=="pending"){S.value=!1,Z(),await fe();const o=e.success_count||0,r=e.fail_count||0;o>0&&r>0?d.success(`刷新任务完成:成功 ${o},失败 ${r}`):o>0&&r===0?d.success(`刷新任务完成:全部成功 (${o})`):r>0&&o===0?d.error(`刷新任务完成:全部失败 (${r})`):d.error("刷新任务失败")}},Tt=t=>{W(),me=window.setInterval(()=>{kt(t).catch(e=>{_.value=e?.message||"注册任务更新失败",W(),O.value=!1})},3e3)},Ke=t=>{Z(),pe=window.setInterval(()=>{Ct(t).catch(e=>{_.value=e?.message||"刷新任务更新失败",Z(),S.value=!1})},3e3)},Zt=()=>{xe===null&&(xe=window.setInterval(async()=>{if(!Le&&!q.value&&!(me!==null||pe!==null)&&!(!O.value&&!S.value&&!c.value&&!f.value)){Le=!0;try{await He()}catch(t){_.value=t?.message||"后台刷新失败"}finally{Le=!1}}},6e3))},He=async()=>{try{const t=await w.getRegisterCurrent();t&&"id"in t&&!$e(t.id)&&(Be(t),(t.status==="running"||t.status==="pending")&&(O.value=!0,Tt(t.id)))}catch(t){_.value=t.message||"加载注册任务失败"}try{const t=await w.getLoginCurrent();t&&"id"in t&&!Ie(t.id)&&(Se(t),(t.status==="running"||t.status==="pending")&&(S.value=!0,Ke(t.id)))}catch(t){_.value=t.message||"加载刷新任务失败"}},es=async()=>{_.value="",O.value=!0;try{const t=Number.isFinite(de.value)&&de.value>0?de.value:void 0,e=await w.startRegister(t);Be(e),Tt(e.id),ye.value=!1,q.value=!0}catch(t){_.value=t.message||"启动注册失败",O.value=!1}},St=async()=>{if(b.value.size){_.value="",S.value=!0;try{const t=await w.startLogin(Array.from(b.value));Se(t),Ke(t.id),Ue()}catch(t){_.value=t.message||"启动刷新失败",S.value=!1}}},ts=async()=>{_.value="",S.value=!0;try{await w.checkLogin();const t=await w.getLoginCurrent();if(t&&"id"in t){Se(t),Ke(t.id),Ue();return}S.value=!1}catch(t){_.value=t.message||"触发刷新失败",S.value=!1}};return(t,e)=>(l(),n(ge,null,[s("div",xs,[s("section",gs,[s("div",bs,[s("div",ys,[R(s("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>ae.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[V,ae.value]]),G(cs,{modelValue:te.value,"onUpdate:modelValue":e[1]||(e[1]=o=>te.value=o),options:Et,class:"!w-full sm:!w-40"},null,8,["modelValue"])]),s("div",_s,[G(be,{modelValue:Oe.value,"onUpdate:modelValue":ft},{default:$t(()=>[...e[27]||(e[27]=[ee(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+a(B.value)+" / "+a(H.value.length)+" 个账号",1),s("div",hs,[s("button",{type:"button",class:p(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",Y.value==="table"?"bg-accent text-accent-foreground":""]),onClick:e[2]||(e[2]=o=>Y.value="table"),"aria-label":"列表视图"},[...e[28]||(e[28]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:p(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",Y.value==="card"?"bg-accent text-accent-foreground":""]),onClick:e[3]||(e[3]=o=>Y.value="card"),"aria-label":"卡片视图"},[...e[29]||(e[29]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",ws,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:j(ne),onClick:fe}," 刷新列表 ",8,ks),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:Kt}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:O.value,onClick:At}," 添加账户 ",8,Cs),s("div",{ref_key:"moreActionsRef",ref:De,class:"relative"},[s("button",{class:p(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",P.value?"bg-accent text-accent-foreground":""]),onClick:Ot},[e[30]||(e[30]=ee(" 更多操作 ",-1)),e[31]||(e[31]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),Bt.value?(l(),n("span",{key:0,class:p(["ml-1 h-2 w-2 rounded-full",zt.value]),"aria-hidden":"true"},null,2)):g("",!0)],2),P.value?(l(),n("div",Ts,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:e[4]||(e[4]=o=>{Ue(),le()})}," 任务状态 "),e[32]||(e[32]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",S.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:S.value,onClick:e[5]||(e[5]=o=>{ts(),le()})}," 刷新过期 ",10,Ss),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!B.value||S.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!B.value||S.value,onClick:e[6]||(e[6]=o=>{St(),le()})}," 刷新选中 ",10,$s),e[33]||(e[33]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[7]||(e[7]=o=>{qt(),le()})}," 批量启用 ",10,Is),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[8]||(e[8]=o=>{Qt(),le()})}," 批量禁用 ",10,Es),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[9]||(e[9]=o=>{Xt(),le()})}," 批量删除 ",10,Ls)])):g("",!0)],512)]),Y.value==="card"?(l(),n("div",As,[(l(!0),n(ge,null,Ve(H.value,o=>(l(),n("div",{key:o.id,class:p(["rounded-2xl border border-border bg-card p-4",ct(o)]),onClick:r=>Ee(o.id)},[s("div",Vs,[s("div",null,[e[34]||(e[34]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",js,a(o.id),1)]),s("div",Ms,[G(be,{modelValue:b.value.has(o.id),"onUpdate:modelValue":r=>Ee(o.id),onClick:e[10]||(e[10]=M(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:p(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",nt(o)])},a(ve(o)),3)])]),s("div",Ds,[s("div",null,[e[35]||(e[35]=s("p",null,"剩余时间",-1)),s("p",{class:p(["mt-1 text-sm font-semibold",dt(o)])},a(it(o.remaining_display)),3),o.expires_at?(l(),n("p",Os,a(o.expires_at),1)):g("",!0)]),s("div",null,[e[36]||(e[36]=s("p",null,"冷却",-1)),s("p",{class:p(["mt-1",ze(o)])},[o.cooldown_seconds>0?(l(),n("span",Bs,a(ut(o.cooldown_seconds))+" · "+a(o.cooldown_reason),1)):(l(),n("span",Ns,a(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[e[37]||(e[37]=s("p",null,"失败数",-1)),s("p",Us,a(o.error_count),1)]),s("div",null,[e[38]||(e[38]=s("p",null,"会话数",-1)),s("p",zs,a(o.conversation_count),1)])]),s("div",Ps,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>pt(o.id),["stop"])}," 编辑 ",8,Fs),at(o)?(l(),n("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[11]||(e[11]=M(()=>{},["stop"])),r=>bt(o.id)]}," 启用 ",8,Ks)):(l(),n("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[12]||(e[12]=M(()=>{},["stop"])),r=>yt(o.id)]}," 禁用 ",8,Hs)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[e[13]||(e[13]=M(()=>{},["stop"])),r=>_t(o.id)]}," 删除 ",8,Js)])],10,Rs))),128)),!H.value.length&&!j(ne)?(l(),n("div",Gs," 暂无账号数据,请检查后台配置。 ")):g("",!0)])):(l(),n("div",Ys,[s("table",qs,[s("thead",Qs,[s("tr",null,[s("th",Xs,[G(be,{modelValue:Oe.value,"onUpdate:modelValue":ft},null,8,["modelValue"])]),e[40]||(e[40]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),e[41]||(e[41]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",Ws,[s("span",Zs,[e[39]||(e[39]=ee(" 剩余/过期 ",-1)),G(ms,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),e[42]||(e[42]=s("th",{class:"py-3 pr-6"},"冷却",-1)),e[43]||(e[43]=s("th",{class:"py-3 pr-6"},"失败数",-1)),e[44]||(e[44]=s("th",{class:"py-3 pr-6"},"会话数",-1)),e[45]||(e[45]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",eo,[!H.value.length&&!j(ne)?(l(),n("tr",to,[...e[46]||(e[46]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):g("",!0),(l(!0),n(ge,null,Ve(H.value,o=>(l(),n("tr",{key:o.id,class:p(["border-t border-border",ct(o)]),onClick:r=>Ee(o.id)},[s("td",{class:"py-4 pr-4",onClick:e[14]||(e[14]=M(()=>{},["stop"]))},[G(be,{modelValue:b.value.has(o.id),"onUpdate:modelValue":r=>Ee(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",oo,a(o.id),1),s("td",ro,[s("span",{class:p(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",nt(o)])},a(ve(o)),3)]),s("td",lo,[s("div",{class:p(["text-sm font-semibold",dt(o)])},a(it(o.remaining_display)),3),o.expires_at?(l(),n("span",no,a(o.expires_at),1)):g("",!0)]),s("td",ao,[o.cooldown_seconds>0?(l(),n("span",{key:0,class:p(ze(o))},a(ut(o.cooldown_seconds))+" · "+a(o.cooldown_reason),3)):(l(),n("span",{key:1,class:p(ze(o))},a(o.cooldown_reason||"无冷却"),3))]),s("td",io,a(o.error_count),1),s("td",uo,a(o.conversation_count),1),s("td",co,[s("div",fo,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>pt(o.id),["stop"])}," 编辑 ",8,vo),at(o)?(l(),n("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>bt(o.id),["stop"])}," 启用 ",8,mo)):(l(),n("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>yt(o.id),["stop"])}," 禁用 ",8,po)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:M(r=>_t(o.id),["stop"])}," 删除 ",8,xo)])])],10,so))),128))])])]))])]),G(fs,{open:j(T).open.value,title:j(T).title.value,message:j(T).message.value,"confirm-text":j(T).confirmText.value,"cancel-text":j(T).cancelText.value,onConfirm:j(T).confirm,onCancel:j(T).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(l(),Re(je,{to:"body"},[ye.value?(l(),n("div",go,[s("div",bo,[s("div",yo,[s("div",null,[e[47]||(e[47]=s("p",{class:"text-sm font-medium text-foreground"},"添加账户",-1)),s("p",_o,a(U.value==="register"?"创建 DuckMail 账号并自动注册":"批量导入账户配置"),1)]),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Ne}," 关闭 ")]),s("div",ho,[s("div",wo,[s("div",ko,[s("button",{type:"button",class:p(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",U.value==="register"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:e[15]||(e[15]=o=>U.value="register")}," 自动注册 ",2),s("button",{type:"button",class:p(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",U.value==="import"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:e[16]||(e[16]=o=>U.value="import")}," 批量导入 ",2)]),U.value==="register"?(l(),n("div",Co,[e[48]||(e[48]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),R(s("input",{"onUpdate:modelValue":e[17]||(e[17]=o=>de.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,de.value,void 0,{number:!0}]]),e[49]||(e[49]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"默认域名(可在配置面板修改,推荐使用)"),s("p",{class:"mt-1"},"注册失败建议关闭无头浏览器再试")],-1))])):(l(),n("div",To,[e[50]||(e[50]=s("label",{class:"block text-xs text-muted-foreground"},"批量导入(每行一个)",-1)),R(s("textarea",{"onUpdate:modelValue":e[18]||(e[18]=o=>ue.value=o),class:"min-h-[140px] w-full rounded-2xl border border-input bg-background px-3 py-2 text-xs font-mono",placeholder:`duckmail----you@example.com----password
2
+ user@outlook.com----loginPassword----clientId----refreshToken`},null,512),[[V,ue.value]]),e[51]||(e[51]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"支持两种格式:"),s("p",{class:"mt-1 font-mono"},"duckmail----email----password"),s("p",{class:"mt-1 font-mono"},"email----password----clientId----refreshToken"),s("p",{class:"mt-2"},'导入后请执行一次"刷新选中"以获取 Cookie。'),s("p",{class:"mt-1"},"注册失败建议关闭无头浏览器再试")],-1)),z.value?(l(),n("div",So,a(z.value),1)):g("",!0)])),e[53]||(e[53]=s("div",{class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-[11px] leading-relaxed"},[s("p",{class:"text-xs font-bold text-rose-600"},"⚠️ 严禁滥用:禁止将本工具用于商业用途或任何形式的滥用(无论规模大小)"),s("p",{class:"mt-1 text-muted-foreground"},[ee("详细声明请查看项目 "),s("a",{href:"https://github.com/Dreamy-rain/gemini-business2api/blob/main/docs/DISCLAIMER.md",target:"_blank",class:"text-primary hover:underline font-medium"},"DISCLAIMER.md")])],-1)),G(be,{modelValue:ce.value,"onUpdate:modelValue":e[19]||(e[19]=o=>ce.value=o)},{default:$t(()=>[...e[52]||(e[52]=[ee(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])])]),s("div",$o,[s("div",Io,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ne}," 取消 "),U.value==="register"?(l(),n("button",{key:0,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",disabled:O.value||!ce.value,onClick:es}," 开始注册 ",8,Eo)):(l(),n("button",{key:1,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",disabled:_e.value||!ce.value,onClick:Vt}," 导入并保存 ",8,Lo))])])])])):g("",!0)])),(l(),Re(je,{to:"body"},[q.value?(l(),n("div",Ao,[s("div",Ro,[s("div",Vo,[e[54]||(e[54]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",jo,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:!Q.value.length&&!X.value.length&&!c.value&&!f.value&&!_.value,onClick:Dt}," 清空日志 ",8,Mo),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Mt}," 关闭 ")])]),s("div",Do,[_.value?(l(),n("div",Oo,a(_.value),1)):g("",!0),c.value||f.value?(l(),n("div",Bo,[c.value?(l(),n("div",No,[s("div",Uo,[s("span",{class:p(["h-2.5 w-2.5 rounded-full",wt(c.value)]),"aria-hidden":"true"},null,2),e[55]||(e[55]=ee(" 注册任务 ",-1))]),s("div",zo,[s("span",null,"状态:"+a(ht(c.value.status)),1),s("span",null,"进度:"+a(c.value.progress)+"/"+a(c.value.count),1),s("span",null,"成功:"+a(c.value.success_count),1),s("span",null,"失败:"+a(c.value.fail_count),1)])])):g("",!0),f.value?(l(),n("div",Po,[s("div",Fo,[s("span",{class:p(["h-2.5 w-2.5 rounded-full",wt(f.value)]),"aria-hidden":"true"},null,2),e[56]||(e[56]=ee(" 刷新任务 ",-1))]),s("div",Ko,[s("span",null,"状态:"+a(ht(f.value.status)),1),s("span",null,"进度:"+a(f.value.progress)+"/"+a(f.value.account_ids.length),1),s("span",null,"成功:"+a(f.value.success_count),1),s("span",null,"失败:"+a(f.value.fail_count),1)])])):g("",!0)])):g("",!0),Q.value.length||X.value.length?(l(),n("div",Ho,[s("div",{ref_key:"taskLogsRef",ref:We,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[Q.value.length?(l(),n("div",Jo,[e[57]||(e[57]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",Go,[(l(!0),n(ge,null,Ve(Q.value,(o,r)=>(l(),n("div",{key:`reg-${r}`,class:"font-mono"},a(mt(o)),1))),128))])])):g("",!0),X.value.length?(l(),n("div",Yo,[e[58]||(e[58]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",qo,[(l(!0),n(ge,null,Ve(X.value,(o,r)=>(l(),n("div",{key:`login-${r}`,class:"font-mono"},a(mt(o)),1))),128))])])):g("",!0)],512)])):g("",!0),!_.value&&!c.value&&!f.value&&!Q.value.length&&!X.value.length?(l(),n("div",Qo," 暂无任务 ")):g("",!0)])])])):g("",!0)])),(l(),Re(je,{to:"body"},[x.value?(l(),n("div",Xo,[s("div",Wo,[s("div",{class:"flex items-center justify-between"},[e[59]||(e[59]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Fe}," 关闭 ")]),$.value?(l(),n("div",Zo,a($.value),1)):g("",!0),s("div",er,[e[60]||(e[60]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),R(s("input",{"onUpdate:modelValue":e[20]||(e[20]=o=>h.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[V,h.value.id]]),e[61]||(e[61]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),R(s("textarea",{"onUpdate:modelValue":e[21]||(e[21]=o=>h.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[V,h.value.secure_c_ses]]),e[62]||(e[62]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),R(s("input",{"onUpdate:modelValue":e[22]||(e[22]=o=>h.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.csesidx]]),e[63]||(e[63]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),R(s("input",{"onUpdate:modelValue":e[23]||(e[23]=o=>h.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.config_id]]),e[64]||(e[64]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),R(s("input",{"onUpdate:modelValue":e[24]||(e[24]=o=>h.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.host_c_oses]]),e[65]||(e[65]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),R(s("input",{"onUpdate:modelValue":e[25]||(e[25]=o=>h.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[V,h.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Fe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Yt}," 保存 ")])])])):g("",!0)])),(l(),Re(je,{to:"body"},[Me.value?(l(),n("div",tr,[s("div",sr,[s("div",or,[e[66]||(e[66]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",rr,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Jt},a(N.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Pe}," 关闭 ")])]),D.value?(l(),n("div",lr,a(D.value),1)):g("",!0),s("div",nr,[R(s("textarea",{"onUpdate:modelValue":e[26]||(e[26]=o=>se.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:N.value},null,8,ar),[[V,se.value]])]),s("div",ir,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",onClick:Gt,disabled:N.value}," 保存 ",8,dr)])])])):g("",!0)]))],64))}});export{xr as default};
static/assets/Accounts-BPJBl--e.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{g as j,C as $e,h as c,d as Ae,D as Se,i as R,o as De,c as d,a as t,x as D,y as ue,m as V,v as $,b as h,A as Ee,t as a,n as m,u as v,F as q,r as ce,f as xe,T as pe,w as g,e as r}from"./index-B0A0-QFY.js";import{_ as Ue}from"./SelectMenu.vue_vue_type_script_setup_true_lang-Bb3w9pba.js";import{_ as F}from"./Checkbox.vue_vue_type_script_setup_true_lang-B6QFZaQQ.js";import{_ as je}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-Bkr0tSJw.js";import{u as ze}from"./useConfirmDialog-BS9rDomX.js";import{_ as Me}from"./HelpTip.vue_vue_type_script_setup_true_lang-BwK5Fa3C.js";const y={list:()=>j.get("/admin/accounts"),getConfig:()=>j.get("/admin/accounts-config"),updateConfig:f=>j.put("/admin/accounts-config",f),delete:f=>j.delete(`/admin/accounts/${f}`),disable:f=>j.put(`/admin/accounts/${f}/disable`),enable:f=>j.put(`/admin/accounts/${f}/enable`)},Ne=$e("accounts",()=>{const f=c([]),x=c(!1);async function b(){x.value=!0;try{const l=await y.list();f.value=Array.isArray(l)?l:l.accounts||[]}finally{x.value=!1}}async function z(l){await y.delete(l),await b()}async function p(l){await y.disable(l),await b()}async function M(l){await y.enable(l),await b()}async function E(l){await Promise.all(l.map(_=>y.enable(_))),await b()}async function u(l){await Promise.all(l.map(_=>y.disable(_))),await b()}async function A(l){await Promise.all(l.map(_=>y.delete(_))),await b()}async function N(l){await y.updateConfig(l),await b()}return{accounts:f,isLoading:x,loadAccounts:b,deleteAccount:z,disableAccount:p,enableAccount:M,bulkEnable:E,bulkDisable:u,bulkDelete:A,updateConfig:N}}),Te={class:"space-y-8"},Be={class:"rounded-3xl border border-border bg-card p-6"},Oe={class:"flex flex-wrap items-center justify-between gap-4"},Je={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},Le={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},Fe={key:0},Ie={class:"ml-auto flex items-center gap-2 sm:ml-0"},Pe={class:"mt-4 flex flex-wrap items-center gap-3"},He=["disabled"],Qe=["disabled"],Re=["disabled"],qe=["disabled"],Ge={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},Ke=["onClick"],We={class:"flex items-start justify-between gap-3"},Xe={class:"mt-1 font-mono text-xs text-foreground"},Ye={class:"flex items-center gap-2"},Ze={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},et={key:0,class:"mt-1 text-[11px]"},tt={key:0},ot={key:1},st={class:"mt-1 text-sm font-semibold text-foreground"},rt={class:"mt-1 text-sm font-semibold text-foreground"},lt={class:"mt-4 flex flex-wrap items-center gap-2"},nt=["onClick"],dt=["onClick"],at=["onClick"],it=["onClick"],ut={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},ct={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},xt={class:"min-w-full text-left text-sm"},pt={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},ft={class:"py-3 pr-4"},mt={class:"py-3 pr-6"},bt={class:"inline-flex items-center gap-2"},vt={class:"text-sm text-foreground"},gt={key:0},yt=["onClick"],_t={class:"py-4 pr-6 font-mono text-xs text-foreground"},wt={class:"py-4 pr-6"},ht={class:"py-4 pr-6"},kt={key:0,class:"block text-[11px] text-muted-foreground"},Ct={class:"py-4 pr-6 text-xs"},Vt={class:"py-4 pr-6 text-xs text-muted-foreground"},$t={class:"py-4 pr-6 text-xs text-muted-foreground"},At={class:"py-4 text-right"},St={class:"flex flex-wrap justify-end gap-2"},Dt=["onClick"],Et=["onClick"],Ut=["onClick"],jt=["onClick"],zt={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Mt={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Nt={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},Tt={class:"mt-4 space-y-3 text-sm"},Bt={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Ot={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},Jt={class:"flex items-center justify-between"},Lt={class:"flex items-center gap-2"},Ft={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},It={class:"mt-4"},Pt=["readonly"],Ht={class:"mt-6 flex items-center justify-end gap-2"},Qt=["disabled"],Yt=Ae({__name:"Accounts",setup(f){const x=Ne(),{accounts:b,isLoading:z}=Se(x),p=ze(),M=c(""),E=c("all"),u=c(new Set),A=c("table"),N=c(!1),l=c(""),_=c(!1),w=c(""),U=c(""),k=c(!1),T=c([]),i=c({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),J=c(null),G=c([]),fe=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],C=R(()=>{const o=M.value.trim().toLowerCase();return b.value.filter(e=>{const s=!o||e.id.toLowerCase().includes(o),n=E.value==="all"||O(e)===E.value;return s&&n})}),B=R(()=>u.value.size),I=R(()=>C.value.length>0&&C.value.every(o=>u.value.has(o.id))),K=async()=>{await x.loadAccounts(),u.value=new Set};De(async()=>{await K()});const O=o=>o.cooldown_reason?.includes("429")&&o.cooldown_seconds>0?"429限流":o.cooldown_reason==="错误禁用"?"错误禁用":o.disabled?"手动禁用":o.status==="已过期"?"已过期":o.status==="即将过期"?"即将过期":"正常",W=o=>{const e=O(o);return e==="429限流"||e==="即将过期"?"bg-amber-200 text-amber-900":e==="错误禁用"||e==="已过期"?"bg-destructive/10 text-destructive":e==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},X=o=>o.cooldown_reason?.includes("429")&&o.cooldown_seconds>0?!0:o.disabled||o.cooldown_reason==="错误禁用",Y=o=>o==="已过期"?"过期":o==="未设置"?"未设置":o,Z=o=>o.status==="已过期"?"text-rose-600":o.status==="即将过期"?"text-amber-700":o.status==="未设置"?"text-muted-foreground":"text-emerald-600",ee=o=>o<60?`${o} 秒`:o<3600?`${Math.ceil(o/60)} 分钟`:`${(o/3600).toFixed(1)} 小时`,P=o=>o.cooldown_seconds>0?"text-amber-700":o.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",te=o=>{const e=O(o);return e==="手动禁用"||e==="已过期"?"bg-muted/70":""},L=o=>{const e=new Set(u.value);e.has(o)?e.delete(o):e.add(o),u.value=e},oe=()=>{if(I.value){u.value=new Set;return}u.value=new Set(C.value.map(o=>o.id))},me=(o,e)=>o.id||`account_${e+1}`,be=async()=>(await y.getConfig()).accounts.map((e,s)=>({...e,id:me(e,s)})),ve=(o,e)=>{let s=-1;for(let S=0;S<o.length;S+=1)if(o[S].id===e){s=S;break}if(s===-1)return l.value="未找到对应账号配置。",!1;const n=o[s];return i.value={id:n.id,secure_c_ses:n.secure_c_ses,csesidx:n.csesidx,config_id:n.config_id,host_c_oses:n.host_c_oses,expires_at:n.expires_at},G.value=o,J.value=s,N.value=!0,!0},se=async o=>{l.value="";try{const e=await be();ve(e,o)}catch(e){l.value=e.message||"加载账号配置失败"}},ge=async()=>{w.value="";try{const o=await y.getConfig();T.value=Array.isArray(o.accounts)?o.accounts:[],U.value=JSON.stringify(le(T.value),null,2),k.value=!0,_.value=!0}catch(o){w.value=o.message||"加载账号配置失败"}},H=()=>{_.value=!1,w.value="",k.value=!1},re=()=>{const o=JSON.parse(U.value);if(!Array.isArray(o))throw new Error("配置格式必须是数组。");return o},ye=o=>typeof o!="string"||!o?o:o.length<=6?`${o.slice(0,2)}****`:`${o.slice(0,3)}****`,le=o=>{const e=new Set(["secure_c_ses","csesidx","config_id","host_c_oses"]);return o.map(s=>{const n={...s};return e.forEach(S=>{const ie=n[S];ie&&(n[S]=ye(ie))}),n})},_e=()=>{if(w.value="",!k.value){try{T.value=re()}catch(o){w.value=o.message||"JSON 格式错误";return}U.value=JSON.stringify(le(T.value),null,2),k.value=!0;return}U.value=JSON.stringify(T.value,null,2),k.value=!1},we=async()=>{w.value="";try{const o=re();await x.updateConfig(o),H()}catch(o){w.value=o.message||"保存失败"}},Q=()=>{N.value=!1,l.value=""},he=async()=>{if(J.value===null)return;const o=[...G.value];o[J.value]={...o[J.value],id:i.value.id,secure_c_ses:i.value.secure_c_ses,csesidx:i.value.csesidx,config_id:i.value.config_id,host_c_oses:i.value.host_c_oses||void 0,expires_at:i.value.expires_at||void 0};try{await x.updateConfig(o),Q()}catch(e){l.value=e.message||"保存失败"}},ke=async()=>{await x.bulkEnable(Array.from(u.value)),u.value=new Set},Ce=async()=>{await p.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"})&&(await x.bulkDisable(Array.from(u.value)),u.value=new Set)},Ve=async()=>{await p.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"})&&(await x.bulkDelete(Array.from(u.value)),u.value=new Set)},ne=async o=>{await x.enableAccount(o)},de=async o=>{await p.ask({title:"禁用账号",message:"确定要禁用该账号吗?"})&&await x.disableAccount(o)},ae=async o=>{await p.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"})&&await x.deleteAccount(o)};return(o,e)=>(r(),d(q,null,[t("div",Te,[t("section",Be,[t("div",Oe,[t("div",Je,[V(t("input",{"onUpdate:modelValue":e[0]||(e[0]=s=>M.value=s),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[$,M.value]]),D(Ue,{modelValue:E.value,"onUpdate:modelValue":e[1]||(e[1]=s=>E.value=s),options:fe},null,8,["modelValue"])]),t("div",Le,[D(F,{modelValue:I.value,"onUpdate:modelValue":oe},{default:Ee(()=>[...e[16]||(e[16]=[xe(" 全选 ",-1)])]),_:1},8,["modelValue"]),t("span",null,"共 "+a(C.value.length)+" 个账号",1),B.value?(r(),d("span",Fe,"已选 "+a(B.value)+" 个",1)):h("",!0),t("div",Ie,[t("button",{type:"button",class:m(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",A.value==="table"?"bg-accent text-accent-foreground":""]),onClick:e[2]||(e[2]=s=>A.value="table"),"aria-label":"列表视图"},[...e[17]||(e[17]=[t("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[t("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),t("button",{type:"button",class:m(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",A.value==="card"?"bg-accent text-accent-foreground":""]),onClick:e[3]||(e[3]=s=>A.value="card"),"aria-label":"卡片视图"},[...e[18]||(e[18]=[t("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[t("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),t("div",Pe,[t("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:ge}," 账户配置 "),t("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:v(z),onClick:K}," 刷新列表 ",8,He),t("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:!B.value,onClick:ke}," 批量启用 ",8,Qe),t("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:!B.value,onClick:Ce}," 批量禁用 ",8,Re),t("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-destructive transition-colors hover:border-destructive hover:text-destructive",disabled:!B.value,onClick:Ve}," 批量删除 ",8,qe)]),A.value==="card"?(r(),d("div",Ge,[(r(!0),d(q,null,ce(C.value,s=>(r(),d("div",{key:s.id,class:m(["rounded-2xl border border-border bg-card p-4",te(s)]),onClick:n=>L(s.id)},[t("div",We,[t("div",null,[e[19]||(e[19]=t("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),t("p",Xe,a(s.id),1)]),t("div",Ye,[D(F,{modelValue:u.value.has(s.id),"onUpdate:modelValue":n=>L(s.id),onClick:e[4]||(e[4]=g(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),t("span",{class:m(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",W(s)])},a(O(s)),3)])]),t("div",Ze,[t("div",null,[e[20]||(e[20]=t("p",null,"剩余时间",-1)),t("p",{class:m(["mt-1 text-sm font-semibold",Z(s)])},a(Y(s.remaining_display)),3),s.expires_at?(r(),d("p",et,a(s.expires_at),1)):h("",!0)]),t("div",null,[e[21]||(e[21]=t("p",null,"冷却",-1)),t("p",{class:m(["mt-1",P(s)])},[s.cooldown_seconds>0?(r(),d("span",tt,a(ee(s.cooldown_seconds))+" · "+a(s.cooldown_reason),1)):(r(),d("span",ot,a(s.cooldown_reason||"无冷却"),1))],2)]),t("div",null,[e[22]||(e[22]=t("p",null,"失败数",-1)),t("p",st,a(s.error_count),1)]),t("div",null,[e[23]||(e[23]=t("p",null,"会话数",-1)),t("p",rt,a(s.conversation_count),1)])]),t("div",lt,[t("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:g(n=>se(s.id),["stop"])}," 编辑 ",8,nt),X(s)?(r(),d("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[5]||(e[5]=g(()=>{},["stop"])),n=>ne(s.id)]}," 启用 ",8,dt)):(r(),d("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[6]||(e[6]=g(()=>{},["stop"])),n=>de(s.id)]}," 禁用 ",8,at)),t("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[e[7]||(e[7]=g(()=>{},["stop"])),n=>ae(s.id)]}," 删除 ",8,it)])],10,Ke))),128)),!C.value.length&&!v(z)?(r(),d("div",ut," 暂无账号数据,请检查后台配置。 ")):h("",!0)])):(r(),d("div",ct,[t("table",xt,[t("thead",pt,[t("tr",null,[t("th",ft,[D(F,{modelValue:I.value,"onUpdate:modelValue":oe},null,8,["modelValue"])]),e[25]||(e[25]=t("th",{class:"py-3 pr-6"},"账号 ID",-1)),e[26]||(e[26]=t("th",{class:"py-3 pr-6"},"状态",-1)),t("th",mt,[t("span",bt,[e[24]||(e[24]=xe(" 剩余/过期 ",-1)),D(Me,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),e[27]||(e[27]=t("th",{class:"py-3 pr-6"},"冷却",-1)),e[28]||(e[28]=t("th",{class:"py-3 pr-6"},"失败数",-1)),e[29]||(e[29]=t("th",{class:"py-3 pr-6"},"会话数",-1)),e[30]||(e[30]=t("th",{class:"py-3 text-right"},"操作",-1))])]),t("tbody",vt,[!C.value.length&&!v(z)?(r(),d("tr",gt,[...e[31]||(e[31]=[t("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):h("",!0),(r(!0),d(q,null,ce(C.value,s=>(r(),d("tr",{key:s.id,class:m(["border-t border-border",te(s)]),onClick:n=>L(s.id)},[t("td",{class:"py-4 pr-4",onClick:e[8]||(e[8]=g(()=>{},["stop"]))},[D(F,{modelValue:u.value.has(s.id),"onUpdate:modelValue":n=>L(s.id)},null,8,["modelValue","onUpdate:modelValue"])]),t("td",_t,a(s.id),1),t("td",wt,[t("span",{class:m(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",W(s)])},a(O(s)),3)]),t("td",ht,[t("div",{class:m(["text-sm font-semibold",Z(s)])},a(Y(s.remaining_display)),3),s.expires_at?(r(),d("span",kt,a(s.expires_at),1)):h("",!0)]),t("td",Ct,[s.cooldown_seconds>0?(r(),d("span",{key:0,class:m(P(s))},a(ee(s.cooldown_seconds))+" · "+a(s.cooldown_reason),3)):(r(),d("span",{key:1,class:m(P(s))},a(s.cooldown_reason||"无冷却"),3))]),t("td",Vt,a(s.error_count),1),t("td",$t,a(s.conversation_count),1),t("td",At,[t("div",St,[t("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:g(n=>se(s.id),["stop"])}," 编辑 ",8,Dt),X(s)?(r(),d("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:g(n=>ne(s.id),["stop"])}," 启用 ",8,Et)):(r(),d("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:g(n=>de(s.id),["stop"])}," 禁用 ",8,Ut)),t("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:g(n=>ae(s.id),["stop"])}," 删除 ",8,jt)])])],10,yt))),128))])])]))])]),D(je,{open:v(p).open.value,title:v(p).title.value,message:v(p).message.value,"confirm-text":v(p).confirmText.value,"cancel-text":v(p).cancelText.value,onConfirm:v(p).confirm,onCancel:v(p).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(r(),ue(pe,{to:"body"},[N.value?(r(),d("div",zt,[t("div",Mt,[t("div",{class:"flex items-center justify-between"},[e[32]||(e[32]=t("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),t("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Q}," 关闭 ")]),l.value?(r(),d("div",Nt,a(l.value),1)):h("",!0),t("div",Tt,[e[33]||(e[33]=t("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),V(t("input",{"onUpdate:modelValue":e[9]||(e[9]=s=>i.value.id=s),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[$,i.value.id]]),e[34]||(e[34]=t("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),V(t("textarea",{"onUpdate:modelValue":e[10]||(e[10]=s=>i.value.secure_c_ses=s),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[$,i.value.secure_c_ses]]),e[35]||(e[35]=t("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),V(t("input",{"onUpdate:modelValue":e[11]||(e[11]=s=>i.value.csesidx=s),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,i.value.csesidx]]),e[36]||(e[36]=t("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),V(t("input",{"onUpdate:modelValue":e[12]||(e[12]=s=>i.value.config_id=s),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,i.value.config_id]]),e[37]||(e[37]=t("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),V(t("input",{"onUpdate:modelValue":e[13]||(e[13]=s=>i.value.host_c_oses=s),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,i.value.host_c_oses]]),e[38]||(e[38]=t("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),V(t("input",{"onUpdate:modelValue":e[14]||(e[14]=s=>i.value.expires_at=s),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[$,i.value.expires_at]])]),t("div",{class:"mt-6 flex items-center justify-end gap-2"},[t("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Q}," 取消 "),t("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:he}," 保存 ")])])])):h("",!0)])),(r(),ue(pe,{to:"body"},[_.value?(r(),d("div",Bt,[t("div",Ot,[t("div",Jt,[e[39]||(e[39]=t("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),t("div",Lt,[t("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:_e},a(k.value?"显示原文":"脱敏显示"),1),t("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:H}," 关闭 ")])]),w.value?(r(),d("div",Ft,a(w.value),1)):h("",!0),t("div",It,[V(t("textarea",{"onUpdate:modelValue":e[15]||(e[15]=s=>U.value=s),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:k.value},null,8,Pt),[[$,U.value]])]),t("div",Ht,[t("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:H}," 取消 "),t("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:we,disabled:k.value}," 保存 ",8,Qt)])])])):h("",!0)]))],64))}});export{Yt as default};
static/assets/Accounts-BWmfQ8Fj.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ import{g as E,D as ts,h as a,d as ss,E as os,i as H,o as rs,A as ls,j as ns,c as l,a as s,q as J,m as Re,p as A,v as $,s as Tt,t as n,n as g,u as R,b as m,f as pe,F as ge,r as Ve,x as je,w as V,e as r,G as as}from"./index-DL4Fp3an.js";import{_ as is}from"./SelectMenu.vue_vue_type_script_setup_true_lang-CmVUq-Y1.js";import{_ as be}from"./Checkbox.vue_vue_type_script_setup_true_lang-FvD-aCmU.js";import{_ as ds}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-CWs1-jf0.js";import{u as us}from"./useConfirmDialog-MThy7PVA.js";import{_ as cs}from"./HelpTip.vue_vue_type_script_setup_true_lang-CAICIbTF.js";const h={list:()=>E.get("/admin/accounts"),getConfig:()=>E.get("/admin/accounts-config"),updateConfig:b=>E.put("/admin/accounts-config",b),delete:b=>E.delete(`/admin/accounts/${b}`),disable:b=>E.put(`/admin/accounts/${b}/disable`),enable:b=>E.put(`/admin/accounts/${b}/enable`),startRegister:(b,w)=>E.post("/admin/register/start",{count:b,domain:w}),getRegisterTask:b=>E.get(`/admin/register/task/${b}`),getRegisterCurrent:()=>E.get("/admin/register/current"),startLogin:b=>E.post("/admin/login/start",b),getLoginTask:b=>E.get(`/admin/login/task/${b}`),getLoginCurrent:()=>E.get("/admin/login/current"),checkLogin:()=>E.post("/admin/login/check")},fs=ts("accounts",()=>{const b=a([]),w=a(!1);async function L(){w.value=!0;try{const u=await h.list();b.value=Array.isArray(u)?u:u.accounts||[]}finally{w.value=!1}}async function re(u){await h.delete(u),await L()}async function C(u){await h.disable(u),await L()}async function le(u){await h.enable(u),await L()}async function Z(u){await Promise.all(u.map(j=>h.enable(j))),await L()}async function p(u){await Promise.all(u.map(j=>h.disable(j))),await L()}async function G(u){await Promise.all(u.map(j=>h.delete(j))),await L()}async function ne(u){await h.updateConfig(u),await L()}return{accounts:b,isLoading:w,loadAccounts:L,deleteAccount:re,disableAccount:C,enableAccount:le,bulkEnable:Z,bulkDisable:p,bulkDelete:G,updateConfig:ne}}),vs={class:"space-y-8"},xs={class:"rounded-3xl border border-border bg-card p-6"},ms={class:"flex flex-wrap items-center justify-between gap-4"},ps={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},gs={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},bs={class:"ml-auto flex items-center gap-2 sm:ml-0"},ys={class:"mt-4 flex flex-wrap items-center gap-2"},_s=["disabled"],hs=["disabled"],ws={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},ks=["disabled"],Cs=["disabled"],Ts=["disabled"],Ss=["disabled"],Es=["disabled"],Is={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},Ls=["onClick"],As={class:"flex items-start justify-between gap-3"},$s={class:"mt-1 font-mono text-xs text-foreground"},Rs={class:"flex items-center gap-2"},Vs={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},js={key:0,class:"mt-1 text-[11px]"},Ms={key:0},Ds={key:1},Os={class:"mt-1 text-sm font-semibold text-foreground"},Bs={class:"mt-1 text-sm font-semibold text-foreground"},Ns={class:"mt-4 flex flex-wrap items-center gap-2"},Us=["onClick"],zs=["onClick"],Ps=["onClick"],Fs=["onClick"],Ks={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Hs={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},Js={class:"min-w-full text-left text-sm"},Gs={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Ys={class:"py-3 pr-4"},qs={class:"py-3 pr-6"},Qs={class:"inline-flex items-center gap-2"},Xs={class:"text-sm text-foreground"},Ws={key:0},Zs=["onClick"],eo={class:"py-4 pr-6 font-mono text-xs text-foreground"},to={class:"py-4 pr-6"},so={class:"py-4 pr-6"},oo={key:0,class:"block text-[11px] text-muted-foreground"},ro={class:"py-4 pr-6 text-xs"},lo={class:"py-4 pr-6 text-xs text-muted-foreground"},no={class:"py-4 pr-6 text-xs text-muted-foreground"},ao={class:"py-4 text-right"},io={class:"flex flex-wrap justify-end gap-2"},uo=["onClick"],co=["onClick"],fo=["onClick"],vo=["onClick"],xo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},mo={class:"flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},po={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},go={class:"mt-1 text-xs text-muted-foreground"},bo={class:"scrollbar-slim flex-1 overflow-y-auto px-6 py-4"},yo={class:"space-y-4 text-sm"},_o={class:"flex rounded-full border border-border bg-muted/30 p-1 text-xs"},ho={key:0,class:"space-y-4"},wo={key:1,class:"space-y-4"},ko={key:0,class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-600"},Co={class:"border-t border-border/60 px-6 py-4"},To={class:"flex items-center justify-end gap-2"},So=["disabled"],Eo=["disabled"],Io={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Lo={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},Ao={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},$o={class:"flex items-center gap-2"},Ro=["disabled"],Vo={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},jo={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},Mo={key:1,class:"grid gap-3 text-xs text-muted-foreground"},Do={key:0,class:"space-y-1"},Oo={class:"flex flex-wrap gap-x-4 gap-y-1"},Bo={key:1,class:"space-y-1"},No={class:"flex flex-wrap gap-x-4 gap-y-1"},Uo={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},zo={key:0,class:"space-y-2"},Po={class:"space-y-1 text-[11px] text-muted-foreground"},Fo={key:1,class:"mt-4 space-y-2"},Ko={class:"space-y-1 text-[11px] text-muted-foreground"},Ho={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},Jo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Go={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Yo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},qo={class:"mt-4 space-y-3 text-sm"},Qo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Xo={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},Wo={class:"flex items-center justify-between"},Zo={class:"flex items-center gap-2"},er={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},tr={class:"mt-4"},sr=["readonly"],or={class:"mt-6 flex items-center justify-end gap-2"},rr=["disabled"],He="accounts-register-task-cache",Je="accounts-login-task-cache",Ge="accounts-register-log-clear",Ye="accounts-login-log-clear",qe="accounts-register-task-cleared-id",Qe="accounts-login-task-cleared-id",St="1970-01-01 00:00:00",cr=ss({__name:"Accounts",setup(b){const w=fs(),{accounts:L,isLoading:re}=os(w),C=us(),le=a(""),Z=a("all"),p=a(new Set),G=a("table"),ne=a(!1),u=a(""),j=a(!1),M=a(""),ee=a(""),B=a(!1),ae=a([]),ie=a(1),ye=a(!1),N=a("register"),de=a(""),U=a(""),_e=a(!1),Y=a(!1),z=a(!1),Me=a(null),he=a(null),we=a(null),P=a(null),F=a(null),te=a(0),se=a(0),ue=a(!1),c=a(null),f=a(null),Xe=a(null),D=a(!1),T=a(!1),y=a(""),_=a({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),ke=a(null),We=a([]),Et=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],K=H(()=>{const e=le.value.trim().toLowerCase();return L.value.filter(t=>{const o=!e||t.id.toLowerCase().includes(e),i=Z.value==="all"||fe(t)===Z.value;return o&&i})}),O=H(()=>p.value.size),De=H(()=>K.value.length>0&&K.value.every(e=>p.value.has(e.id))),ce=async()=>{await w.loadAccounts(),p.value=new Set,z.value=!1},Ze=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},et=e=>{try{return localStorage.getItem(e)||null}catch{return null}},Ce=(e,t)=>{try{if(t){localStorage.setItem(e,t);return}localStorage.removeItem(e)}catch{}},tt=(e,t)=>{try{localStorage.setItem(e,JSON.stringify(t))}catch{}},st=e=>{try{localStorage.removeItem(e)}catch{}},ot=e=>{const t=localStorage.getItem(e),o=Number(t);return Number.isFinite(o)?o:0},Te=(e,t)=>{try{localStorage.setItem(e,String(t))}catch{}},Oe=(e,t=!0)=>{e&&(e.id&&e.id===P.value||(e.id&&P.value&&e.id!==P.value&&(P.value=null,Ce(qe,null)),c.value=e,e.id&&e.id!==he.value&&(he.value=e.id,te.value=0,Te(Ge,0)),t&&tt(He,e)))},Se=(e,t=!0)=>{e&&(e.id&&e.id===F.value||(e.id&&F.value&&e.id!==F.value&&(F.value=null,Ce(Qe,null)),f.value=e,e.id&&e.id!==we.value&&(we.value=e.id,se.value=0,Te(Ye,0)),t&&tt(Je,e)))},It=()=>{te.value=ot(Ge),se.value=ot(Ye),P.value=et(qe),F.value=et(Qe);const e=Ze(He);e&&e.id!==P.value&&(c.value=e,he.value=e.id||null);const t=Ze(Je);t&&t.id!==F.value&&(f.value=t,we.value=t.id||null)},Lt=()=>{ye.value=!0,N.value="register",de.value="",U.value="",_e.value=!1,ue.value=!1},Be=()=>{ye.value=!1},At=e=>{const t=[],o=[];return e.split(/\r?\n/).map(d=>d.trim()).filter(Boolean).forEach((d,x)=>{const v=d.split("----").map(S=>S.trim()),k=x+1;if(v.length){if(v[0].toLowerCase()==="duckmail"){if(v.length<3||!v[1]||!v[2]){o.push(`第 ${k} 行格式错误(duckmail)`);return}const S=v[1],$e=v.slice(2).join("----");t.push({id:S,secure_c_ses:"",csesidx:"",config_id:"",expires_at:St,mail_provider:"duckmail",mail_address:S,mail_password:$e});return}if(v.length>=4&&v[0]&&v[2]&&v[3]){const S=v[0],$e=v[1]||"",I=v[2],es=v.slice(3).join("----");t.push({id:S,secure_c_ses:"",csesidx:"",config_id:"",expires_at:St,mail_provider:"microsoft",mail_address:S,mail_password:$e,mail_client_id:I,mail_refresh_token:es,mail_tenant:"consumers"});return}o.push(`第 ${k} 行格式错误`)}}),{items:t,errors:o}},$t=async()=>{if(U.value="",!de.value.trim()){U.value="请输入导入内容";return}const{items:e,errors:t}=At(de.value);if(!e.length){U.value=t.length?t.join(","):"未识别到有效账号";return}if(t.length){U.value=t.slice(0,3).join(",");return}_e.value=!0;try{const i=[...await ft()],d=new Map(i.map((k,S)=>[k.id,S])),x=[];e.forEach(k=>{const S=d.get(k.id||"");if(S===void 0){i.push(k),x.push(k.id);return}const I={...i[S],mail_provider:k.mail_provider,mail_address:k.mail_address};k.mail_provider==="microsoft"?(I.mail_client_id=k.mail_client_id,I.mail_refresh_token=k.mail_refresh_token,I.mail_tenant=k.mail_tenant,I.mail_password=k.mail_password):(I.mail_password=k.mail_password,I.mail_client_id=void 0,I.mail_refresh_token=void 0,I.mail_tenant=void 0),i[S]=I,x.push(k.id)}),await w.updateConfig(i),await ce(),p.value=new Set(x),Be(),await C.ask({title:"导入成功",message:`已导入 ${x.length} 个账户并自动选中。是否立即刷新这些账户以获取 Cookie?`,confirmText:"立即刷新",cancelText:"稍后手动刷新"})&&await Ct()}catch(o){U.value=o.message||"导入失败"}finally{_e.value=!1}},Rt=async()=>{try{const e=[],t=c.value?.id,o=f.value?.id;if(t&&!Ee(t)&&e.push(ht(t)),o&&!Ie(o)&&e.push(wt(o)),!e.length){await Ke();return}await Promise.all(e)}catch(e){y.value=e?.message||"任务状态更新失败"}},Ne=async()=>{Y.value=!0,await Rt()},Vt=()=>{Y.value=!1},jt=()=>{const e=c.value?.id||null,t=f.value?.id||null;P.value=e,F.value=t,Ce(qe,e),Ce(Qe,t),te.value=c.value?.logs?.length||0,se.value=f.value?.logs?.length||0,Te(Ge,te.value),Te(Ye,se.value),c.value=null,f.value=null,he.value=null,we.value=null,y.value="",D.value=!1,T.value=!1,X(),W(),st(He),st(Je)},Ee=e=>!!(e&&e===P.value),Ie=e=>!!(e&&e===F.value),Mt=()=>{z.value=!z.value},oe=()=>{z.value=!1},rt=e=>{if(!z.value)return;const t=e.target;Me.value&&!Me.value.contains(t)&&(z.value=!1)};rs(async()=>{It(),await ce(),await Ke(),Xt(),document.addEventListener("click",rt)});const q=H(()=>{const e=c.value?.logs||[];return te.value?e.slice(te.value):e}),Q=H(()=>{const e=f.value?.logs||[];return se.value?e.slice(se.value):e}),Dt=H(()=>!!y.value||!!c.value||!!f.value||q.value.length>0||Q.value.length>0),Ot=async()=>{await as();const e=Xe.value;e&&(e.scrollTop=e.scrollHeight)};ls([q,Q,Y],async()=>{Y.value&&await Ot()},{deep:!0});const Bt=H(()=>{const e=c.value?.status,t=f.value?.status;return e==="running"||e==="pending"||t==="running"||t==="pending"}),Nt=H(()=>{if(y.value)return"bg-rose-500";if(Bt.value)return"bg-sky-400";const e=[];if(c.value){const d=c.value.success_count??0,x=c.value.fail_count??0,v=c.value.count??d+x;e.push({success:d,fail:x,total:v,status:c.value.status})}if(f.value){const d=f.value.success_count??0,x=f.value.fail_count??0,v=f.value.account_ids?.length??d+x;e.push({success:d,fail:x,total:v,status:f.value.status})}if(!e.length)return"bg-muted-foreground";const t=e.reduce((d,x)=>d+x.success,0),o=e.reduce((d,x)=>d+x.fail,0),i=e.reduce((d,x)=>d+(x.total||0),0);if(t>0&&o>0)return"bg-amber-400";if(o>0&&t===0)return"bg-rose-500";if(t>0&&o===0)return"bg-emerald-400";if(i===0){const d=e.every(v=>v.status==="success");if(e.some(v=>v.status==="failed"))return"bg-rose-500";if(d)return"bg-emerald-400"}return"bg-muted-foreground"});ns(()=>{X(),W(),Qt(),document.removeEventListener("click",rt)});const fe=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?"429限流":e.cooldown_reason==="错误禁用"?"错误禁用":e.disabled?"手动禁用":e.status==="已过期"?"已过期":e.status==="即将过期"?"即将过期":"正常",lt=e=>{const t=fe(e);return t==="429限流"||t==="即将过期"?"bg-amber-200 text-amber-900":t==="错误禁用"||t==="已过期"?"bg-destructive/10 text-destructive":t==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},nt=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?!0:e.disabled||e.cooldown_reason==="错误禁用",at=e=>e==="已过期"?"过期":e==="未设置"?"未设置":e,it=e=>e.status==="已过期"?"text-rose-600":e.status==="即将过期"?"text-amber-700":e.status==="未设置"?"text-muted-foreground":"text-emerald-600",dt=e=>e<60?`${e} 秒`:e<3600?`${Math.ceil(e/60)} 分钟`:`${(e/3600).toFixed(1)} 小时`,Ue=e=>e.cooldown_seconds>0?"text-amber-700":e.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",ut=e=>{const t=fe(e);return t==="手动禁用"||t==="已过期"?"bg-muted/70":""},Le=e=>{const t=new Set(p.value);t.has(e)?t.delete(e):t.add(e),p.value=t},ct=()=>{if(De.value){p.value=new Set;return}p.value=new Set(K.value.map(e=>e.id))},Ut=(e,t)=>e.id||`account_${t+1}`,ft=async()=>(await h.getConfig()).accounts.map((t,o)=>({...t,id:Ut(t,o)})),vt=e=>`${e.time} [${e.level}] ${e.message}`,zt=(e,t)=>{let o=-1;for(let d=0;d<e.length;d+=1)if(e[d].id===t){o=d;break}if(o===-1)return u.value="未找到对应账号配置。",!1;const i=e[o];return _.value={id:i.id,secure_c_ses:i.secure_c_ses,csesidx:i.csesidx,config_id:i.config_id,host_c_oses:i.host_c_oses,expires_at:i.expires_at},We.value=e,ke.value=o,ne.value=!0,!0},xt=async e=>{u.value="";try{const t=await ft();zt(t,e)}catch(t){u.value=t.message||"加载账号配置失败"}},Pt=async()=>{M.value="";try{const e=await h.getConfig();ae.value=Array.isArray(e.accounts)?e.accounts:[],ee.value=JSON.stringify(pt(ae.value),null,2),B.value=!0,j.value=!0}catch(e){M.value=e.message||"加载账号配置失败"}},ze=()=>{j.value=!1,M.value="",B.value=!1},mt=()=>{const e=JSON.parse(ee.value);if(!Array.isArray(e))throw new Error("配置格式必须是数组。");return e},Ft=e=>typeof e!="string"||!e?e:e.length<=6?`${e.slice(0,2)}****`:`${e.slice(0,3)}****`,pt=e=>{const t=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password","mail_refresh_token","mail_client_id"]);return e.map(o=>{const i={...o};return t.forEach(d=>{const x=i[d];x&&(i[d]=Ft(x))}),i})},Kt=()=>{if(M.value="",!B.value){try{ae.value=mt()}catch(e){M.value=e.message||"JSON 格式错误";return}ee.value=JSON.stringify(pt(ae.value),null,2),B.value=!0;return}ee.value=JSON.stringify(ae.value,null,2),B.value=!1},Ht=async()=>{M.value="";try{const e=mt();await w.updateConfig(e),ze()}catch(e){M.value=e.message||"保存失败"}},Pe=()=>{ne.value=!1,u.value=""},Jt=async()=>{if(ke.value===null)return;const e=[...We.value];e[ke.value]={...e[ke.value],id:_.value.id,secure_c_ses:_.value.secure_c_ses,csesidx:_.value.csesidx,config_id:_.value.config_id,host_c_oses:_.value.host_c_oses||void 0,expires_at:_.value.expires_at||void 0};try{await w.updateConfig(e),Pe()}catch(t){u.value=t.message||"保存失败"}},Gt=async()=>{await w.bulkEnable(Array.from(p.value)),p.value=new Set},Yt=async()=>{await C.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"})&&(await w.bulkDisable(Array.from(p.value)),p.value=new Set)},qt=async()=>{await C.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"})&&(await w.bulkDelete(Array.from(p.value)),p.value=new Set)},gt=async e=>{await w.enableAccount(e)},bt=async e=>{await C.ask({title:"禁用账号",message:"确定要禁用该账号吗?"})&&await w.disableAccount(e)},yt=async e=>{await C.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"})&&await w.deleteAccount(e)};let ve=null,xe=null,me=null,Ae=!1;const X=()=>{ve!==null&&(window.clearInterval(ve),ve=null)},W=()=>{xe!==null&&(window.clearInterval(xe),xe=null)},Qt=()=>{me!==null&&(window.clearInterval(me),me=null),Ae=!1},_t=e=>e==="pending"?"等待中":e==="running"?"执行中":e==="success"?"成功":e==="failed"?"失败":e,ht=async e=>{if(Ee(e)){X();return}const t=await h.getRegisterTask(e);if(Ee(t.id)){X();return}Oe(t),t.status!=="running"&&t.status!=="pending"&&(D.value=!1,X(),await ce())},wt=async e=>{if(Ie(e)){W();return}const t=await h.getLoginTask(e);if(Ie(t.id)){W();return}Se(t),t.status!=="running"&&t.status!=="pending"&&(T.value=!1,W(),await ce())},kt=e=>{X(),ve=window.setInterval(()=>{ht(e).catch(t=>{y.value=t?.message||"注册任务更新失败",X(),D.value=!1})},3e3)},Fe=e=>{W(),xe=window.setInterval(()=>{wt(e).catch(t=>{y.value=t?.message||"刷新任务更新失败",W(),T.value=!1})},3e3)},Xt=()=>{me===null&&(me=window.setInterval(async()=>{if(!Ae&&!Y.value&&!(ve!==null||xe!==null)&&!(!D.value&&!T.value&&!c.value&&!f.value)){Ae=!0;try{await Ke()}catch(e){y.value=e?.message||"后台刷新失败"}finally{Ae=!1}}},6e3))},Ke=async()=>{try{const e=await h.getRegisterCurrent();e&&"id"in e&&!Ee(e.id)&&(Oe(e),(e.status==="running"||e.status==="pending")&&(D.value=!0,kt(e.id)))}catch(e){y.value=e.message||"加载注册任务失败"}try{const e=await h.getLoginCurrent();e&&"id"in e&&!Ie(e.id)&&(Se(e),(e.status==="running"||e.status==="pending")&&(T.value=!0,Fe(e.id)))}catch(e){y.value=e.message||"加载刷新任务失败"}},Wt=async()=>{y.value="",D.value=!0;try{const e=Number.isFinite(ie.value)&&ie.value>0?ie.value:void 0,t=await h.startRegister(e);Oe(t),kt(t.id),ye.value=!1,Y.value=!0}catch(e){y.value=e.message||"启动注册失败",D.value=!1}},Ct=async()=>{if(p.value.size){y.value="",T.value=!0;try{const e=await h.startLogin(Array.from(p.value));Se(e),Fe(e.id),Ne()}catch(e){y.value=e.message||"启动刷新失败",T.value=!1}}},Zt=async()=>{y.value="",T.value=!0;try{await h.checkLogin();const e=await h.getLoginCurrent();if(e&&"id"in e){Se(e),Fe(e.id),Ne();return}T.value=!1}catch(e){y.value=e.message||"触发刷新失败",T.value=!1}};return(e,t)=>(r(),l(ge,null,[s("div",vs,[s("section",xs,[s("div",ms,[s("div",ps,[A(s("input",{"onUpdate:modelValue":t[0]||(t[0]=o=>le.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[$,le.value]]),J(is,{modelValue:Z.value,"onUpdate:modelValue":t[1]||(t[1]=o=>Z.value=o),options:Et},null,8,["modelValue"])]),s("div",gs,[J(be,{modelValue:De.value,"onUpdate:modelValue":ct},{default:Tt(()=>[...t[27]||(t[27]=[pe(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+n(O.value)+" / "+n(K.value.length)+" 个账号",1),s("div",bs,[s("button",{type:"button",class:g(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",G.value==="table"?"bg-accent text-accent-foreground":""]),onClick:t[2]||(t[2]=o=>G.value="table"),"aria-label":"列表视图"},[...t[28]||(t[28]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:g(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",G.value==="card"?"bg-accent text-accent-foreground":""]),onClick:t[3]||(t[3]=o=>G.value="card"),"aria-label":"卡片视图"},[...t[29]||(t[29]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",ys,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:R(re),onClick:ce}," 刷新列表 ",8,_s),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pt}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:D.value,onClick:Lt}," 添加账户 ",8,hs),s("div",{ref_key:"moreActionsRef",ref:Me,class:"relative"},[s("button",{class:g(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",z.value?"bg-accent text-accent-foreground":""]),onClick:Mt},[t[30]||(t[30]=pe(" 更多操作 ",-1)),t[31]||(t[31]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),Dt.value?(r(),l("span",{key:0,class:g(["ml-1 h-2 w-2 rounded-full",Nt.value]),"aria-hidden":"true"},null,2)):m("",!0)],2),z.value?(r(),l("div",ws,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:t[4]||(t[4]=o=>{Ne(),oe()})}," 任务状态 "),t[32]||(t[32]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",T.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:T.value,onClick:t[5]||(t[5]=o=>{Zt(),oe()})}," 刷新过期 ",10,ks),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!O.value||T.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!O.value||T.value,onClick:t[6]||(t[6]=o=>{Ct(),oe()})}," 刷新选中 ",10,Cs),t[33]||(t[33]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[7]||(t[7]=o=>{Gt(),oe()})}," 批量启用 ",10,Ts),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[8]||(t[8]=o=>{Yt(),oe()})}," 批量禁用 ",10,Ss),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[9]||(t[9]=o=>{qt(),oe()})}," 批量删除 ",10,Es)])):m("",!0)],512)]),G.value==="card"?(r(),l("div",Is,[(r(!0),l(ge,null,Ve(K.value,o=>(r(),l("div",{key:o.id,class:g(["rounded-2xl border border-border bg-card p-4",ut(o)]),onClick:i=>Le(o.id)},[s("div",As,[s("div",null,[t[34]||(t[34]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",$s,n(o.id),1)]),s("div",Rs,[J(be,{modelValue:p.value.has(o.id),"onUpdate:modelValue":i=>Le(o.id),onClick:t[10]||(t[10]=V(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:g(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",lt(o)])},n(fe(o)),3)])]),s("div",Vs,[s("div",null,[t[35]||(t[35]=s("p",null,"剩余时间",-1)),s("p",{class:g(["mt-1 text-sm font-semibold",it(o)])},n(at(o.remaining_display)),3),o.expires_at?(r(),l("p",js,n(o.expires_at),1)):m("",!0)]),s("div",null,[t[36]||(t[36]=s("p",null,"冷却",-1)),s("p",{class:g(["mt-1",Ue(o)])},[o.cooldown_seconds>0?(r(),l("span",Ms,n(dt(o.cooldown_seconds))+" · "+n(o.cooldown_reason),1)):(r(),l("span",Ds,n(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[t[37]||(t[37]=s("p",null,"失败数",-1)),s("p",Os,n(o.error_count),1)]),s("div",null,[t[38]||(t[38]=s("p",null,"会话数",-1)),s("p",Bs,n(o.conversation_count),1)])]),s("div",Ns,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>xt(o.id),["stop"])}," 编辑 ",8,Us),nt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[11]||(t[11]=V(()=>{},["stop"])),i=>gt(o.id)]}," 启用 ",8,zs)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[12]||(t[12]=V(()=>{},["stop"])),i=>bt(o.id)]}," 禁用 ",8,Ps)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[t[13]||(t[13]=V(()=>{},["stop"])),i=>yt(o.id)]}," 删除 ",8,Fs)])],10,Ls))),128)),!K.value.length&&!R(re)?(r(),l("div",Ks," 暂无账号数据,请检查后台配置。 ")):m("",!0)])):(r(),l("div",Hs,[s("table",Js,[s("thead",Gs,[s("tr",null,[s("th",Ys,[J(be,{modelValue:De.value,"onUpdate:modelValue":ct},null,8,["modelValue"])]),t[40]||(t[40]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),t[41]||(t[41]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",qs,[s("span",Qs,[t[39]||(t[39]=pe(" 剩余/过期 ",-1)),J(cs,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),t[42]||(t[42]=s("th",{class:"py-3 pr-6"},"冷却",-1)),t[43]||(t[43]=s("th",{class:"py-3 pr-6"},"失败数",-1)),t[44]||(t[44]=s("th",{class:"py-3 pr-6"},"会话数",-1)),t[45]||(t[45]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",Xs,[!K.value.length&&!R(re)?(r(),l("tr",Ws,[...t[46]||(t[46]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):m("",!0),(r(!0),l(ge,null,Ve(K.value,o=>(r(),l("tr",{key:o.id,class:g(["border-t border-border",ut(o)]),onClick:i=>Le(o.id)},[s("td",{class:"py-4 pr-4",onClick:t[14]||(t[14]=V(()=>{},["stop"]))},[J(be,{modelValue:p.value.has(o.id),"onUpdate:modelValue":i=>Le(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",eo,n(o.id),1),s("td",to,[s("span",{class:g(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",lt(o)])},n(fe(o)),3)]),s("td",so,[s("div",{class:g(["text-sm font-semibold",it(o)])},n(at(o.remaining_display)),3),o.expires_at?(r(),l("span",oo,n(o.expires_at),1)):m("",!0)]),s("td",ro,[o.cooldown_seconds>0?(r(),l("span",{key:0,class:g(Ue(o))},n(dt(o.cooldown_seconds))+" · "+n(o.cooldown_reason),3)):(r(),l("span",{key:1,class:g(Ue(o))},n(o.cooldown_reason||"无冷却"),3))]),s("td",lo,n(o.error_count),1),s("td",no,n(o.conversation_count),1),s("td",ao,[s("div",io,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>xt(o.id),["stop"])}," 编辑 ",8,uo),nt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>gt(o.id),["stop"])}," 启用 ",8,co)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>bt(o.id),["stop"])}," 禁用 ",8,fo)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:V(i=>yt(o.id),["stop"])}," 删除 ",8,vo)])])],10,Zs))),128))])])]))])]),J(ds,{open:R(C).open.value,title:R(C).title.value,message:R(C).message.value,"confirm-text":R(C).confirmText.value,"cancel-text":R(C).cancelText.value,onConfirm:R(C).confirm,onCancel:R(C).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(r(),Re(je,{to:"body"},[ye.value?(r(),l("div",xo,[s("div",mo,[s("div",po,[s("div",null,[t[47]||(t[47]=s("p",{class:"text-sm font-medium text-foreground"},"添加账户",-1)),s("p",go,n(N.value==="register"?"创建 DuckMail 账号并自动注册":"批量导入账户配置"),1)]),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Be}," 关闭 ")]),s("div",bo,[s("div",yo,[s("div",_o,[s("button",{type:"button",class:g(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",N.value==="register"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[15]||(t[15]=o=>N.value="register")}," 自动注册 ",2),s("button",{type:"button",class:g(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",N.value==="import"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[16]||(t[16]=o=>N.value="import")}," 批量导入 ",2)]),N.value==="register"?(r(),l("div",ho,[t[48]||(t[48]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),A(s("input",{"onUpdate:modelValue":t[17]||(t[17]=o=>ie.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,ie.value,void 0,{number:!0}]]),t[49]||(t[49]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"}," 默认域名来自设置面板(可在“配置面板”中修改) ",-1))])):(r(),l("div",wo,[t[50]||(t[50]=s("label",{class:"block text-xs text-muted-foreground"},"批量导入(每行一个)",-1)),A(s("textarea",{"onUpdate:modelValue":t[18]||(t[18]=o=>de.value=o),class:"min-h-[140px] w-full rounded-2xl border border-input bg-background px-3 py-2 text-xs font-mono",placeholder:`duckmail----you@example.com----password
2
+ user@outlook.com----loginPassword----clientId----refreshToken`},null,512),[[$,de.value]]),t[51]||(t[51]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"支持两种格式:"),s("p",{class:"mt-1 font-mono"},"duckmail----email----password"),s("p",{class:"mt-1 font-mono"},"email----password----clientId----refreshToken"),s("p",{class:"mt-2 text-[11px]"},'导入后请执行一次"刷新选中"以获取 Cookie。')],-1)),U.value?(r(),l("div",ko,n(U.value),1)):m("",!0)])),t[53]||(t[53]=s("div",{class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-[11px] leading-relaxed"},[s("p",{class:"text-xs font-bold text-rose-600"},"⚠️ 严禁滥用:禁止将本工具用于商业用途或任何形式的滥用(无论规模大小)"),s("p",{class:"mt-1 text-muted-foreground"},[pe("详细声明请查看项目 "),s("a",{href:"https://github.com/Dreamy-rain/gemini-business2api/blob/main/docs/DISCLAIMER.md",target:"_blank",class:"text-primary hover:underline font-medium"},"DISCLAIMER.md")])],-1)),J(be,{modelValue:ue.value,"onUpdate:modelValue":t[19]||(t[19]=o=>ue.value=o)},{default:Tt(()=>[...t[52]||(t[52]=[pe(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])])]),s("div",Co,[s("div",To,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Be}," 取消 "),N.value==="register"?(r(),l("button",{key:0,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:D.value||!ue.value,onClick:Wt}," 开始注册 ",8,So)):(r(),l("button",{key:1,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:_e.value||!ue.value,onClick:$t}," 导入并保存 ",8,Eo))])])])])):m("",!0)])),(r(),Re(je,{to:"body"},[Y.value?(r(),l("div",Io,[s("div",Lo,[s("div",Ao,[t[54]||(t[54]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",$o,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary",disabled:!q.value.length&&!Q.value.length&&!c.value&&!f.value&&!y.value,onClick:jt}," 清空日志 ",8,Ro),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Vt}," 关闭 ")])]),s("div",Vo,[y.value?(r(),l("div",jo,n(y.value),1)):m("",!0),c.value||f.value?(r(),l("div",Mo,[c.value?(r(),l("div",Do,[t[55]||(t[55]=s("div",{class:"font-medium text-foreground"},"注册任务",-1)),s("div",Oo,[s("span",null,"状态:"+n(_t(c.value.status)),1),s("span",null,"进度:"+n(c.value.progress)+"/"+n(c.value.count),1),s("span",null,"成功:"+n(c.value.success_count),1),s("span",null,"失败:"+n(c.value.fail_count),1)])])):m("",!0),f.value?(r(),l("div",Bo,[t[56]||(t[56]=s("div",{class:"font-medium text-foreground"},"刷新任务",-1)),s("div",No,[s("span",null,"状态:"+n(_t(f.value.status)),1),s("span",null,"进度:"+n(f.value.progress)+"/"+n(f.value.account_ids.length),1),s("span",null,"成功:"+n(f.value.success_count),1),s("span",null,"失败:"+n(f.value.fail_count),1)])])):m("",!0)])):m("",!0),q.value.length||Q.value.length?(r(),l("div",Uo,[s("div",{ref_key:"taskLogsRef",ref:Xe,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[q.value.length?(r(),l("div",zo,[t[57]||(t[57]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",Po,[(r(!0),l(ge,null,Ve(q.value,(o,i)=>(r(),l("div",{key:`reg-${i}`,class:"font-mono"},n(vt(o)),1))),128))])])):m("",!0),Q.value.length?(r(),l("div",Fo,[t[58]||(t[58]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",Ko,[(r(!0),l(ge,null,Ve(Q.value,(o,i)=>(r(),l("div",{key:`login-${i}`,class:"font-mono"},n(vt(o)),1))),128))])])):m("",!0)],512)])):m("",!0),!y.value&&!c.value&&!f.value&&!q.value.length&&!Q.value.length?(r(),l("div",Ho," 暂无任务 ")):m("",!0)])])])):m("",!0)])),(r(),Re(je,{to:"body"},[ne.value?(r(),l("div",Jo,[s("div",Go,[s("div",{class:"flex items-center justify-between"},[t[59]||(t[59]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Pe}," 关闭 ")]),u.value?(r(),l("div",Yo,n(u.value),1)):m("",!0),s("div",qo,[t[60]||(t[60]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),A(s("input",{"onUpdate:modelValue":t[20]||(t[20]=o=>_.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[$,_.value.id]]),t[61]||(t[61]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),A(s("textarea",{"onUpdate:modelValue":t[21]||(t[21]=o=>_.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[$,_.value.secure_c_ses]]),t[62]||(t[62]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),A(s("input",{"onUpdate:modelValue":t[22]||(t[22]=o=>_.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.csesidx]]),t[63]||(t[63]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),A(s("input",{"onUpdate:modelValue":t[23]||(t[23]=o=>_.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.config_id]]),t[64]||(t[64]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),A(s("input",{"onUpdate:modelValue":t[24]||(t[24]=o=>_.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.host_c_oses]]),t[65]||(t[65]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),A(s("input",{"onUpdate:modelValue":t[25]||(t[25]=o=>_.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[$,_.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Jt}," 保存 ")])])])):m("",!0)])),(r(),Re(je,{to:"body"},[j.value?(r(),l("div",Qo,[s("div",Xo,[s("div",Wo,[t[66]||(t[66]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",Zo,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Kt},n(B.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:ze}," 关闭 ")])]),M.value?(r(),l("div",er,n(M.value),1)):m("",!0),s("div",tr,[A(s("textarea",{"onUpdate:modelValue":t[26]||(t[26]=o=>ee.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:B.value},null,8,sr),[[$,ee.value]])]),s("div",or,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:ze}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Ht,disabled:B.value}," 保存 ",8,rr)])])])):m("",!0)]))],64))}});export{cr as default};
static/assets/Accounts-BgTEWmTn.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ import{g as E,C as os,h as i,d as rs,D as ls,i as J,o as ns,z as as,j as is,c as n,a as s,p as G,m as Re,q as R,v as V,s as $t,t as a,n as p,u as j,b as g,f as ee,F as ge,r as Ve,T as je,E as ds,w as M,e as l,G as us}from"./index-BYFRJmx0.js";import{_ as cs}from"./SelectMenu.vue_vue_type_script_setup_true_lang-D8K-xqMi.js";import{_ as be}from"./Checkbox.vue_vue_type_script_setup_true_lang-BQ4FJTZi.js";import{_ as fs}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-BElgd3uY.js";import{u as vs}from"./useConfirmDialog-BQNp3TV9.js";import{_ as ms}from"./HelpTip.vue_vue_type_script_setup_true_lang-sPivD74C.js";const w={list:()=>E.get("/admin/accounts"),getConfig:()=>E.get("/admin/accounts-config"),updateConfig:y=>E.put("/admin/accounts-config",y),delete:y=>E.delete(`/admin/accounts/${y}`),disable:y=>E.put(`/admin/accounts/${y}/disable`),enable:y=>E.put(`/admin/accounts/${y}/enable`),startRegister:(y,k)=>E.post("/admin/register/start",{count:y,domain:k}),getRegisterTask:y=>E.get(`/admin/register/task/${y}`),getRegisterCurrent:()=>E.get("/admin/register/current"),startLogin:y=>E.post("/admin/login/start",y),getLoginTask:y=>E.get(`/admin/login/task/${y}`),getLoginCurrent:()=>E.get("/admin/login/current"),checkLogin:()=>E.post("/admin/login/check")},ps=os("accounts",()=>{const y=i([]),k=i(!1);async function A(){k.value=!0;try{const x=await w.list();y.value=Array.isArray(x)?x:x.accounts||[]}finally{k.value=!1}}async function ne(x){await w.delete(x),await A()}async function T(x){await w.disable(x),await A()}async function d(x){await w.enable(x),await A()}async function ae(x){await Promise.all(x.map($=>w.enable($))),await A()}async function te(x){await Promise.all(x.map($=>w.disable($))),await A()}async function b(x){await Promise.all(x.map($=>w.delete($))),await A()}async function Y(x){await w.updateConfig(x),await A()}return{accounts:y,isLoading:k,loadAccounts:A,deleteAccount:ne,disableAccount:T,enableAccount:d,bulkEnable:ae,bulkDisable:te,bulkDelete:b,updateConfig:Y}}),xs={class:"space-y-8"},gs={class:"rounded-3xl border border-border bg-card p-6"},bs={class:"flex flex-wrap items-center justify-between gap-4"},ys={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},_s={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},hs={class:"ml-auto flex items-center gap-2 sm:ml-0"},ws={class:"mt-4 flex flex-wrap items-center gap-2"},ks=["disabled"],Cs=["disabled"],Ts={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},Ss=["disabled"],$s=["disabled"],Is=["disabled"],Es=["disabled"],Ls=["disabled"],As={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},Rs=["onClick"],Vs={class:"flex items-start justify-between gap-3"},js={class:"mt-1 font-mono text-xs text-foreground"},Ms={class:"flex items-center gap-2"},Ds={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},Os={key:0,class:"mt-1 text-[11px]"},Bs={key:0},Ns={key:1},Us={class:"mt-1 text-sm font-semibold text-foreground"},zs={class:"mt-1 text-sm font-semibold text-foreground"},Ps={class:"mt-4 flex flex-wrap items-center gap-2"},Fs=["onClick"],Ks=["onClick"],Hs=["onClick"],Js=["onClick"],Gs={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Ys={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},qs={class:"min-w-full text-left text-sm"},Qs={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Xs={class:"py-3 pr-4"},Ws={class:"py-3 pr-6"},Zs={class:"inline-flex items-center gap-2"},eo={class:"text-sm text-foreground"},to={key:0},so=["onClick"],oo={class:"py-4 pr-6 font-mono text-xs text-foreground"},ro={class:"py-4 pr-6"},lo={class:"py-4 pr-6"},no={key:0,class:"block text-[11px] text-muted-foreground"},ao={class:"py-4 pr-6 text-xs"},io={class:"py-4 pr-6 text-xs text-muted-foreground"},uo={class:"py-4 pr-6 text-xs text-muted-foreground"},co={class:"py-4 text-right"},fo={class:"flex flex-wrap justify-end gap-2"},vo=["onClick"],mo=["onClick"],po=["onClick"],xo=["onClick"],go={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},bo={class:"flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},yo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},_o={class:"mt-1 text-xs text-muted-foreground"},ho={class:"scrollbar-slim flex-1 overflow-y-auto px-6 py-4"},wo={class:"space-y-4 text-sm"},ko={class:"flex rounded-full border border-border bg-muted/30 p-1 text-xs"},Co={key:0,class:"space-y-4"},To={key:1,class:"space-y-4"},So={key:0,class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-600"},$o={class:"border-t border-border/60 px-6 py-4"},Io={class:"flex items-center justify-end gap-2"},Eo=["disabled"],Lo=["disabled"],Ao={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Ro={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},Vo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},jo={class:"flex items-center gap-2"},Mo=["disabled"],Do={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},Oo={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},Bo={key:1,class:"grid gap-3 text-xs text-muted-foreground"},No={key:0,class:"space-y-1"},Uo={class:"flex items-center gap-2 font-medium text-foreground"},zo={class:"flex flex-wrap gap-x-4 gap-y-1"},Po={key:1,class:"space-y-1"},Fo={class:"flex items-center gap-2 font-medium text-foreground"},Ko={class:"flex flex-wrap gap-x-4 gap-y-1"},Ho={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},Jo={key:0,class:"space-y-2"},Go={class:"space-y-1 text-[11px] text-muted-foreground"},Yo={key:1,class:"mt-4 space-y-2"},qo={class:"space-y-1 text-[11px] text-muted-foreground"},Qo={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},Xo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Wo={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Zo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},er={class:"mt-4 space-y-3 text-sm"},tr={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},sr={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},or={class:"flex items-center justify-between"},rr={class:"flex items-center gap-2"},lr={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},nr={class:"mt-4"},ar=["readonly"],ir={class:"mt-6 flex items-center justify-end gap-2"},dr=["disabled"],Je="accounts-register-task-cache",Ge="accounts-login-task-cache",Ye="accounts-register-log-clear",qe="accounts-login-log-clear",Qe="accounts-register-task-cleared-id",Xe="accounts-login-task-cleared-id",It="1970-01-01 00:00:00",xr=rs({__name:"Accounts",setup(y){const k=ps(),{accounts:A,isLoading:ne}=ls(k),T=vs(),d=ds(),ae=i(""),te=i("all"),b=i(new Set),Y=i("table"),x=i(!1),$=i(""),Me=i(!1),D=i(""),se=i(""),N=i(!1),ie=i([]),de=i(1),ye=i(!1),U=i("register"),ue=i(""),z=i(""),_e=i(!1),q=i(!1),P=i(!1),De=i(null),he=i(null),we=i(null),F=i(null),K=i(null),oe=i(0),re=i(0),ce=i(!1),c=i(null),f=i(null),We=i(null),O=i(!1),S=i(!1),_=i(""),h=i({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),ke=i(null),Ze=i([]),Et=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],H=J(()=>{const t=ae.value.trim().toLowerCase();return A.value.filter(e=>{const o=!t||e.id.toLowerCase().includes(t),r=te.value==="all"||ve(e)===te.value;return o&&r})}),B=J(()=>b.value.size),Oe=J(()=>H.value.length>0&&H.value.every(t=>b.value.has(t.id))),fe=async()=>{await k.loadAccounts(),b.value=new Set,P.value=!1},et=t=>{try{const e=localStorage.getItem(t);return e?JSON.parse(e):null}catch{return null}},tt=t=>{try{return localStorage.getItem(t)||null}catch{return null}},Ce=(t,e)=>{try{if(e){localStorage.setItem(t,e);return}localStorage.removeItem(t)}catch{}},st=(t,e)=>{try{localStorage.setItem(t,JSON.stringify(e))}catch{}},ot=t=>{try{localStorage.removeItem(t)}catch{}},rt=t=>{const e=localStorage.getItem(t),o=Number(e);return Number.isFinite(o)?o:0},Te=(t,e)=>{try{localStorage.setItem(t,String(e))}catch{}},Be=(t,e=!0)=>{t&&(t.id&&t.id===F.value||(t.id&&F.value&&t.id!==F.value&&(F.value=null,Ce(Qe,null)),c.value=t,t.id&&t.id!==he.value&&(he.value=t.id,oe.value=0,Te(Ye,0)),e&&st(Je,t)))},Se=(t,e=!0)=>{t&&(t.id&&t.id===K.value||(t.id&&K.value&&t.id!==K.value&&(K.value=null,Ce(Xe,null)),f.value=t,t.id&&t.id!==we.value&&(we.value=t.id,re.value=0,Te(qe,0)),e&&st(Ge,t)))},Lt=()=>{oe.value=rt(Ye),re.value=rt(qe),F.value=tt(Qe),K.value=tt(Xe);const t=et(Je);t&&t.id!==F.value&&(c.value=t,he.value=t.id||null);const e=et(Ge);e&&e.id!==K.value&&(f.value=e,we.value=e.id||null)},At=()=>{ye.value=!0,U.value="register",ue.value="",z.value="",_e.value=!1,ce.value=!1},Ne=()=>{ye.value=!1},Rt=t=>{const e=[],o=[];return t.split(/\r?\n/).map(u=>u.trim()).filter(Boolean).forEach((u,m)=>{const v=u.split("----").map(I=>I.trim()),C=m+1;if(v.length){if(v[0].toLowerCase()==="duckmail"){if(v.length<3||!v[1]||!v[2]){o.push(`第 ${C} 行格式错误(duckmail)`);return}const I=v[1],Ae=v.slice(2).join("----");e.push({id:I,secure_c_ses:"",csesidx:"",config_id:"",expires_at:It,mail_provider:"duckmail",mail_address:I,mail_password:Ae});return}if(v.length>=4&&v[0]&&v[2]&&v[3]){const I=v[0],Ae=v[1]||"",L=v[2],ss=v.slice(3).join("----");e.push({id:I,secure_c_ses:"",csesidx:"",config_id:"",expires_at:It,mail_provider:"microsoft",mail_address:I,mail_password:Ae,mail_client_id:L,mail_refresh_token:ss,mail_tenant:"consumers"});return}o.push(`第 ${C} 行格式错误`)}}),{items:e,errors:o}},Vt=async()=>{if(z.value="",!ue.value.trim()){z.value="请输入导��内容";return}const{items:t,errors:e}=Rt(ue.value);if(!t.length){z.value=e.length?e.join(","):"未识别到有效账号";return}if(e.length){z.value=e.slice(0,3).join(",");return}_e.value=!0;try{const r=[...await vt()],u=new Map(r.map((C,I)=>[C.id,I])),m=[];t.forEach(C=>{const I=u.get(C.id||"");if(I===void 0){r.push(C),m.push(C.id);return}const L={...r[I],mail_provider:C.mail_provider,mail_address:C.mail_address};C.mail_provider==="microsoft"?(L.mail_client_id=C.mail_client_id,L.mail_refresh_token=C.mail_refresh_token,L.mail_tenant=C.mail_tenant,L.mail_password=C.mail_password):(L.mail_password=C.mail_password,L.mail_client_id=void 0,L.mail_refresh_token=void 0,L.mail_tenant=void 0),r[I]=L,m.push(C.id)}),await k.updateConfig(r),await fe(),b.value=new Set(m),d.success(`成功导入 ${m.length} 个账户`),Ne(),await T.ask({title:"导入成功",message:`已导入 ${m.length} 个账户并自动选中。是否立即刷新这些账户以获取 Cookie?`,confirmText:"立即刷新",cancelText:"稍后手动刷新"})&&await St()}catch(o){z.value=o.message||"导入失败",d.error(o.message||"导入失败")}finally{_e.value=!1}},jt=async()=>{try{const t=[],e=c.value?.id,o=f.value?.id;if(e&&!$e(e)&&t.push(kt(e)),o&&!Ie(o)&&t.push(Ct(o)),!t.length){await He();return}await Promise.all(t)}catch(t){_.value=t?.message||"任务状态更新失败"}},Ue=async()=>{q.value=!0,await jt()},Mt=()=>{q.value=!1},Dt=()=>{const t=c.value?.id||null,e=f.value?.id||null;F.value=t,K.value=e,Ce(Qe,t),Ce(Xe,e),oe.value=c.value?.logs?.length||0,re.value=f.value?.logs?.length||0,Te(Ye,oe.value),Te(qe,re.value),c.value=null,f.value=null,he.value=null,we.value=null,_.value="",O.value=!1,S.value=!1,W(),Z(),ot(Je),ot(Ge)},$e=t=>!!(t&&t===F.value),Ie=t=>!!(t&&t===K.value),Ot=()=>{P.value=!P.value},le=()=>{P.value=!1},lt=t=>{if(!P.value)return;const e=t.target;De.value&&!De.value.contains(e)&&(P.value=!1)};ns(async()=>{Lt(),await fe(),await He(),Zt(),document.addEventListener("click",lt)});const Q=J(()=>{const t=c.value?.logs||[];return oe.value?t.slice(oe.value):t}),X=J(()=>{const t=f.value?.logs||[];return re.value?t.slice(re.value):t}),Bt=J(()=>!!_.value||!!c.value||!!f.value||Q.value.length>0||X.value.length>0),Nt=async()=>{await us();const t=We.value;t&&(t.scrollTop=t.scrollHeight)};as([Q,X,q],async()=>{q.value&&await Nt()},{deep:!0});const Ut=J(()=>{const t=c.value?.status,e=f.value?.status;return t==="running"||t==="pending"||e==="running"||e==="pending"}),zt=J(()=>{if(_.value)return"bg-rose-500";if(Ut.value)return"bg-sky-400";const t=[];if(c.value){const u=c.value.success_count??0,m=c.value.fail_count??0,v=c.value.count??u+m;t.push({success:u,fail:m,total:v,status:c.value.status})}if(f.value){const u=f.value.success_count??0,m=f.value.fail_count??0,v=f.value.account_ids?.length??u+m;t.push({success:u,fail:m,total:v,status:f.value.status})}if(!t.length)return"bg-muted-foreground";const e=t.reduce((u,m)=>u+m.success,0),o=t.reduce((u,m)=>u+m.fail,0),r=t.reduce((u,m)=>u+(m.total||0),0);if(e>0&&o>0)return"bg-amber-400";if(o>0&&e===0)return"bg-rose-500";if(e>0&&o===0)return"bg-emerald-400";if(r===0){const u=t.every(v=>v.status==="success");if(t.some(v=>v.status==="failed"))return"bg-rose-500";if(u)return"bg-emerald-400"}return"bg-muted-foreground"});is(()=>{W(),Z(),Wt(),document.removeEventListener("click",lt)});const ve=t=>t.cooldown_reason?.includes("429")&&t.cooldown_seconds>0?"429限流":t.cooldown_reason==="错误禁用"?"错误禁用":t.disabled?"手动禁用":t.status==="已过期"?"已过期":t.status==="即将过期"?"即将过期":"正常",nt=t=>{const e=ve(t);return e==="429限流"||e==="即将过期"?"bg-amber-200 text-amber-900":e==="错误禁用"||e==="已过期"?"bg-destructive/10 text-destructive":e==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},at=t=>t.cooldown_reason?.includes("429")&&t.cooldown_seconds>0?!0:t.disabled||t.cooldown_reason==="错误禁用",it=t=>t==="已过期"?"过期":t==="未设置"?"未设置":t,dt=t=>t.status==="已过期"?"text-rose-600":t.status==="即将过期"?"text-amber-700":t.status==="未设置"?"text-muted-foreground":"text-emerald-600",ut=t=>t<60?`${t} 秒`:t<3600?`${Math.ceil(t/60)} 分钟`:`${(t/3600).toFixed(1)} 小时`,ze=t=>t.cooldown_seconds>0?"text-amber-700":t.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",ct=t=>{const e=ve(t);return e==="手动禁用"||e==="已过期"?"bg-muted/70":""},Ee=t=>{const e=new Set(b.value);e.has(t)?e.delete(t):e.add(t),b.value=e},ft=()=>{if(Oe.value){b.value=new Set;return}b.value=new Set(H.value.map(t=>t.id))},Pt=(t,e)=>t.id||`account_${e+1}`,vt=async()=>(await w.getConfig()).accounts.map((e,o)=>({...e,id:Pt(e,o)})),mt=t=>`${t.time} [${t.level}] ${t.message}`,Ft=(t,e)=>{let o=-1;for(let u=0;u<t.length;u+=1)if(t[u].id===e){o=u;break}if(o===-1)return $.value="未找到对应账号配置。",!1;const r=t[o];return h.value={id:r.id,secure_c_ses:r.secure_c_ses,csesidx:r.csesidx,config_id:r.config_id,host_c_oses:r.host_c_oses,expires_at:r.expires_at},Ze.value=t,ke.value=o,x.value=!0,!0},pt=async t=>{$.value="";try{const e=await vt();Ft(e,t)}catch(e){$.value=e.message||"加载账号配置失败"}},Kt=async()=>{D.value="";try{const t=await w.getConfig();ie.value=Array.isArray(t.accounts)?t.accounts:[],se.value=JSON.stringify(gt(ie.value),null,2),N.value=!0,Me.value=!0}catch(t){D.value=t.message||"加载账号配置失败"}},Pe=()=>{Me.value=!1,D.value="",N.value=!1},xt=()=>{const t=JSON.parse(se.value);if(!Array.isArray(t))throw new Error("配置格式必须是数组。");return t},Ht=t=>typeof t!="string"||!t?t:t.length<=6?`${t.slice(0,2)}****`:`${t.slice(0,3)}****`,gt=t=>{const e=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password","mail_refresh_token","mail_client_id"]);return t.map(o=>{const r={...o};return e.forEach(u=>{const m=r[u];m&&(r[u]=Ht(m))}),r})},Jt=()=>{if(D.value="",!N.value){try{ie.value=xt()}catch(t){D.value=t.message||"JSON 格式错误";return}se.value=JSON.stringify(gt(ie.value),null,2),N.value=!0;return}se.value=JSON.stringify(ie.value,null,2),N.value=!1},Gt=async()=>{D.value="";try{const t=xt();await k.updateConfig(t),d.success("配置保存成功"),Pe()}catch(t){D.value=t.message||"保存失败",d.error(t.message||"保存失败")}},Fe=()=>{x.value=!1,$.value=""},Yt=async()=>{if(ke.value===null)return;const t=[...Ze.value];t[ke.value]={...t[ke.value],id:h.value.id,secure_c_ses:h.value.secure_c_ses,csesidx:h.value.csesidx,config_id:h.value.config_id,host_c_oses:h.value.host_c_oses||void 0,expires_at:h.value.expires_at||void 0};try{await k.updateConfig(t),d.success("账号编辑成功"),Fe()}catch(e){$.value=e.message||"保存失败",d.error(e.message||"保存失败")}},qt=async()=>{try{await k.bulkEnable(Array.from(b.value)),d.success("批量启用成功"),b.value=new Set}catch(t){d.error(t.message||"批量启用失败")}},Qt=async()=>{if(await T.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"}))try{await k.bulkDisable(Array.from(b.value)),d.success("批量禁用成功"),b.value=new Set}catch(e){d.error(e.message||"批量禁用失败")}},Xt=async()=>{if(await T.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"}))try{await k.bulkDelete(Array.from(b.value)),d.success("批量删除成功"),b.value=new Set}catch(e){d.error(e.message||"批量删除失败")}},bt=async t=>{try{await k.enableAccount(t),d.success("账号已启用")}catch(e){d.error(e.message||"启用失败")}},yt=async t=>{if(await T.ask({title:"禁用账号",message:"确定要禁用该账号吗?"}))try{await k.disableAccount(t),d.success("账号已禁用")}catch(o){d.error(o.message||"禁用失败")}},_t=async t=>{if(await T.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"}))try{await k.deleteAccount(t),d.success("账号已删除")}catch(o){d.error(o.message||"删除失败")}};let me=null,pe=null,xe=null,Le=!1;const W=()=>{me!==null&&(window.clearInterval(me),me=null)},Z=()=>{pe!==null&&(window.clearInterval(pe),pe=null)},Wt=()=>{xe!==null&&(window.clearInterval(xe),xe=null),Le=!1},ht=t=>t==="pending"?"等待中":t==="running"?"执行中":t==="success"?"成功":t==="failed"?"失败":t,wt=t=>{const e=t.status,o=t.success_count??0,r=t.fail_count??0;if(e==="running"||e==="pending")return"bg-sky-400";if(e==="success"||e==="failed"){if(o>0&&r===0)return"bg-emerald-400";if(r>0&&o===0)return"bg-rose-500";if(o>0&&r>0)return"bg-amber-400"}return"bg-muted-foreground"},kt=async t=>{if($e(t)){W();return}const e=await w.getRegisterTask(t);if($e(e.id)){W();return}if(Be(e),e.status!=="running"&&e.status!=="pending"){O.value=!1,W(),await fe();const o=e.success_count||0,r=e.fail_count||0;o>0&&r>0?d.success(`注册任务完成:成功 ${o},失败 ${r}`):o>0&&r===0?d.success(`注册任务完成:全部成功 (${o})`):r>0&&o===0?d.error(`注册任务完成:全部失败 (${r})`):d.error("注册任务失败")}},Ct=async t=>{if(Ie(t)){Z();return}const e=await w.getLoginTask(t);if(Ie(e.id)){Z();return}if(Se(e),e.status!=="running"&&e.status!=="pending"){S.value=!1,Z(),await fe();const o=e.success_count||0,r=e.fail_count||0;o>0&&r>0?d.success(`刷新任务完成:成功 ${o},失败 ${r}`):o>0&&r===0?d.success(`刷新任务完成:全部成功 (${o})`):r>0&&o===0?d.error(`刷新任务完成:全部失败 (${r})`):d.error("刷新任务失败")}},Tt=t=>{W(),me=window.setInterval(()=>{kt(t).catch(e=>{_.value=e?.message||"注册任务更新失败",W(),O.value=!1})},3e3)},Ke=t=>{Z(),pe=window.setInterval(()=>{Ct(t).catch(e=>{_.value=e?.message||"刷新任务更新失败",Z(),S.value=!1})},3e3)},Zt=()=>{xe===null&&(xe=window.setInterval(async()=>{if(!Le&&!q.value&&!(me!==null||pe!==null)&&!(!O.value&&!S.value&&!c.value&&!f.value)){Le=!0;try{await He()}catch(t){_.value=t?.message||"后台刷新失败"}finally{Le=!1}}},6e3))},He=async()=>{try{const t=await w.getRegisterCurrent();t&&"id"in t&&!$e(t.id)&&(Be(t),(t.status==="running"||t.status==="pending")&&(O.value=!0,Tt(t.id)))}catch(t){_.value=t.message||"加载注册任务失败"}try{const t=await w.getLoginCurrent();t&&"id"in t&&!Ie(t.id)&&(Se(t),(t.status==="running"||t.status==="pending")&&(S.value=!0,Ke(t.id)))}catch(t){_.value=t.message||"加载刷新任务失败"}},es=async()=>{_.value="",O.value=!0;try{const t=Number.isFinite(de.value)&&de.value>0?de.value:void 0,e=await w.startRegister(t);Be(e),Tt(e.id),ye.value=!1,q.value=!0}catch(t){_.value=t.message||"启动注册失败",O.value=!1}},St=async()=>{if(b.value.size){_.value="",S.value=!0;try{const t=await w.startLogin(Array.from(b.value));Se(t),Ke(t.id),Ue()}catch(t){_.value=t.message||"启动刷新失败",S.value=!1}}},ts=async()=>{_.value="",S.value=!0;try{await w.checkLogin();const t=await w.getLoginCurrent();if(t&&"id"in t){Se(t),Ke(t.id),Ue();return}S.value=!1}catch(t){_.value=t.message||"触发刷新失败",S.value=!1}};return(t,e)=>(l(),n(ge,null,[s("div",xs,[s("section",gs,[s("div",bs,[s("div",ys,[R(s("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>ae.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[V,ae.value]]),G(cs,{modelValue:te.value,"onUpdate:modelValue":e[1]||(e[1]=o=>te.value=o),options:Et},null,8,["modelValue"])]),s("div",_s,[G(be,{modelValue:Oe.value,"onUpdate:modelValue":ft},{default:$t(()=>[...e[27]||(e[27]=[ee(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+a(B.value)+" / "+a(H.value.length)+" 个账号",1),s("div",hs,[s("button",{type:"button",class:p(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",Y.value==="table"?"bg-accent text-accent-foreground":""]),onClick:e[2]||(e[2]=o=>Y.value="table"),"aria-label":"列表视图"},[...e[28]||(e[28]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:p(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",Y.value==="card"?"bg-accent text-accent-foreground":""]),onClick:e[3]||(e[3]=o=>Y.value="card"),"aria-label":"卡片视图"},[...e[29]||(e[29]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",ws,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:j(ne),onClick:fe}," 刷新列表 ",8,ks),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:Kt}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:O.value,onClick:At}," 添加账户 ",8,Cs),s("div",{ref_key:"moreActionsRef",ref:De,class:"relative"},[s("button",{class:p(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",P.value?"bg-accent text-accent-foreground":""]),onClick:Ot},[e[30]||(e[30]=ee(" 更多操作 ",-1)),e[31]||(e[31]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),Bt.value?(l(),n("span",{key:0,class:p(["ml-1 h-2 w-2 rounded-full",zt.value]),"aria-hidden":"true"},null,2)):g("",!0)],2),P.value?(l(),n("div",Ts,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:e[4]||(e[4]=o=>{Ue(),le()})}," 任务状态 "),e[32]||(e[32]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",S.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:S.value,onClick:e[5]||(e[5]=o=>{ts(),le()})}," 刷新过期 ",10,Ss),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!B.value||S.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!B.value||S.value,onClick:e[6]||(e[6]=o=>{St(),le()})}," 刷新选中 ",10,$s),e[33]||(e[33]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[7]||(e[7]=o=>{qt(),le()})}," 批量启用 ",10,Is),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[8]||(e[8]=o=>{Qt(),le()})}," 批量禁用 ",10,Es),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[9]||(e[9]=o=>{Xt(),le()})}," 批量删除 ",10,Ls)])):g("",!0)],512)]),Y.value==="card"?(l(),n("div",As,[(l(!0),n(ge,null,Ve(H.value,o=>(l(),n("div",{key:o.id,class:p(["rounded-2xl border border-border bg-card p-4",ct(o)]),onClick:r=>Ee(o.id)},[s("div",Vs,[s("div",null,[e[34]||(e[34]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",js,a(o.id),1)]),s("div",Ms,[G(be,{modelValue:b.value.has(o.id),"onUpdate:modelValue":r=>Ee(o.id),onClick:e[10]||(e[10]=M(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:p(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",nt(o)])},a(ve(o)),3)])]),s("div",Ds,[s("div",null,[e[35]||(e[35]=s("p",null,"剩余时间",-1)),s("p",{class:p(["mt-1 text-sm font-semibold",dt(o)])},a(it(o.remaining_display)),3),o.expires_at?(l(),n("p",Os,a(o.expires_at),1)):g("",!0)]),s("div",null,[e[36]||(e[36]=s("p",null,"冷却",-1)),s("p",{class:p(["mt-1",ze(o)])},[o.cooldown_seconds>0?(l(),n("span",Bs,a(ut(o.cooldown_seconds))+" · "+a(o.cooldown_reason),1)):(l(),n("span",Ns,a(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[e[37]||(e[37]=s("p",null,"失败数",-1)),s("p",Us,a(o.error_count),1)]),s("div",null,[e[38]||(e[38]=s("p",null,"会话数",-1)),s("p",zs,a(o.conversation_count),1)])]),s("div",Ps,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>pt(o.id),["stop"])}," 编辑 ",8,Fs),at(o)?(l(),n("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[11]||(e[11]=M(()=>{},["stop"])),r=>bt(o.id)]}," 启用 ",8,Ks)):(l(),n("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[12]||(e[12]=M(()=>{},["stop"])),r=>yt(o.id)]}," 禁用 ",8,Hs)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[e[13]||(e[13]=M(()=>{},["stop"])),r=>_t(o.id)]}," 删除 ",8,Js)])],10,Rs))),128)),!H.value.length&&!j(ne)?(l(),n("div",Gs," 暂无账号数据,请检查后台配置。 ")):g("",!0)])):(l(),n("div",Ys,[s("table",qs,[s("thead",Qs,[s("tr",null,[s("th",Xs,[G(be,{modelValue:Oe.value,"onUpdate:modelValue":ft},null,8,["modelValue"])]),e[40]||(e[40]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),e[41]||(e[41]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",Ws,[s("span",Zs,[e[39]||(e[39]=ee(" 剩余/过期 ",-1)),G(ms,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),e[42]||(e[42]=s("th",{class:"py-3 pr-6"},"冷却",-1)),e[43]||(e[43]=s("th",{class:"py-3 pr-6"},"失败数",-1)),e[44]||(e[44]=s("th",{class:"py-3 pr-6"},"会话数",-1)),e[45]||(e[45]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",eo,[!H.value.length&&!j(ne)?(l(),n("tr",to,[...e[46]||(e[46]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):g("",!0),(l(!0),n(ge,null,Ve(H.value,o=>(l(),n("tr",{key:o.id,class:p(["border-t border-border",ct(o)]),onClick:r=>Ee(o.id)},[s("td",{class:"py-4 pr-4",onClick:e[14]||(e[14]=M(()=>{},["stop"]))},[G(be,{modelValue:b.value.has(o.id),"onUpdate:modelValue":r=>Ee(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",oo,a(o.id),1),s("td",ro,[s("span",{class:p(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",nt(o)])},a(ve(o)),3)]),s("td",lo,[s("div",{class:p(["text-sm font-semibold",dt(o)])},a(it(o.remaining_display)),3),o.expires_at?(l(),n("span",no,a(o.expires_at),1)):g("",!0)]),s("td",ao,[o.cooldown_seconds>0?(l(),n("span",{key:0,class:p(ze(o))},a(ut(o.cooldown_seconds))+" · "+a(o.cooldown_reason),3)):(l(),n("span",{key:1,class:p(ze(o))},a(o.cooldown_reason||"无冷却"),3))]),s("td",io,a(o.error_count),1),s("td",uo,a(o.conversation_count),1),s("td",co,[s("div",fo,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>pt(o.id),["stop"])}," 编辑 ",8,vo),at(o)?(l(),n("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>bt(o.id),["stop"])}," 启用 ",8,mo)):(l(),n("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>yt(o.id),["stop"])}," 禁用 ",8,po)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:M(r=>_t(o.id),["stop"])}," 删除 ",8,xo)])])],10,so))),128))])])]))])]),G(fs,{open:j(T).open.value,title:j(T).title.value,message:j(T).message.value,"confirm-text":j(T).confirmText.value,"cancel-text":j(T).cancelText.value,onConfirm:j(T).confirm,onCancel:j(T).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(l(),Re(je,{to:"body"},[ye.value?(l(),n("div",go,[s("div",bo,[s("div",yo,[s("div",null,[e[47]||(e[47]=s("p",{class:"text-sm font-medium text-foreground"},"添加账户",-1)),s("p",_o,a(U.value==="register"?"创建 DuckMail 账号并自动注册":"批量导入账户配置"),1)]),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Ne}," 关闭 ")]),s("div",ho,[s("div",wo,[s("div",ko,[s("button",{type:"button",class:p(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",U.value==="register"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:e[15]||(e[15]=o=>U.value="register")}," 自动注册 ",2),s("button",{type:"button",class:p(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",U.value==="import"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:e[16]||(e[16]=o=>U.value="import")}," 批量导入 ",2)]),U.value==="register"?(l(),n("div",Co,[e[48]||(e[48]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),R(s("input",{"onUpdate:modelValue":e[17]||(e[17]=o=>de.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,de.value,void 0,{number:!0}]]),e[49]||(e[49]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"默认域名(可在配置面板修改,推荐使用)"),s("p",{class:"mt-1"},"注册失败建议关闭无头浏览器再试")],-1))])):(l(),n("div",To,[e[50]||(e[50]=s("label",{class:"block text-xs text-muted-foreground"},"批量导入(每行一个)",-1)),R(s("textarea",{"onUpdate:modelValue":e[18]||(e[18]=o=>ue.value=o),class:"min-h-[140px] w-full rounded-2xl border border-input bg-background px-3 py-2 text-xs font-mono",placeholder:`duckmail----you@example.com----password
2
+ user@outlook.com----loginPassword----clientId----refreshToken`},null,512),[[V,ue.value]]),e[51]||(e[51]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"支持两种格式:"),s("p",{class:"mt-1 font-mono"},"duckmail----email----password"),s("p",{class:"mt-1 font-mono"},"email----password----clientId----refreshToken"),s("p",{class:"mt-2"},'导入后请执行一次"刷新选中"以获取 Cookie。'),s("p",{class:"mt-1"},"注册失败建议关闭无头浏览器再试")],-1)),z.value?(l(),n("div",So,a(z.value),1)):g("",!0)])),e[53]||(e[53]=s("div",{class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-[11px] leading-relaxed"},[s("p",{class:"text-xs font-bold text-rose-600"},"⚠️ 严禁滥用:禁止将本工具用于商业用途或任何形式的滥用(无论规模大小)"),s("p",{class:"mt-1 text-muted-foreground"},[ee("详细声明请查看项目 "),s("a",{href:"https://github.com/Dreamy-rain/gemini-business2api/blob/main/docs/DISCLAIMER.md",target:"_blank",class:"text-primary hover:underline font-medium"},"DISCLAIMER.md")])],-1)),G(be,{modelValue:ce.value,"onUpdate:modelValue":e[19]||(e[19]=o=>ce.value=o)},{default:$t(()=>[...e[52]||(e[52]=[ee(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])])]),s("div",$o,[s("div",Io,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ne}," 取消 "),U.value==="register"?(l(),n("button",{key:0,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",disabled:O.value||!ce.value,onClick:es}," 开始注册 ",8,Eo)):(l(),n("button",{key:1,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",disabled:_e.value||!ce.value,onClick:Vt}," 导入并保存 ",8,Lo))])])])])):g("",!0)])),(l(),Re(je,{to:"body"},[q.value?(l(),n("div",Ao,[s("div",Ro,[s("div",Vo,[e[54]||(e[54]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",jo,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:!Q.value.length&&!X.value.length&&!c.value&&!f.value&&!_.value,onClick:Dt}," 清空日志 ",8,Mo),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Mt}," 关闭 ")])]),s("div",Do,[_.value?(l(),n("div",Oo,a(_.value),1)):g("",!0),c.value||f.value?(l(),n("div",Bo,[c.value?(l(),n("div",No,[s("div",Uo,[s("span",{class:p(["h-2.5 w-2.5 rounded-full",wt(c.value)]),"aria-hidden":"true"},null,2),e[55]||(e[55]=ee(" 注册任务 ",-1))]),s("div",zo,[s("span",null,"状态:"+a(ht(c.value.status)),1),s("span",null,"进度:"+a(c.value.progress)+"/"+a(c.value.count),1),s("span",null,"成功:"+a(c.value.success_count),1),s("span",null,"失败:"+a(c.value.fail_count),1)])])):g("",!0),f.value?(l(),n("div",Po,[s("div",Fo,[s("span",{class:p(["h-2.5 w-2.5 rounded-full",wt(f.value)]),"aria-hidden":"true"},null,2),e[56]||(e[56]=ee(" 刷新任务 ",-1))]),s("div",Ko,[s("span",null,"状态:"+a(ht(f.value.status)),1),s("span",null,"进度:"+a(f.value.progress)+"/"+a(f.value.account_ids.length),1),s("span",null,"成功:"+a(f.value.success_count),1),s("span",null,"失败:"+a(f.value.fail_count),1)])])):g("",!0)])):g("",!0),Q.value.length||X.value.length?(l(),n("div",Ho,[s("div",{ref_key:"taskLogsRef",ref:We,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[Q.value.length?(l(),n("div",Jo,[e[57]||(e[57]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",Go,[(l(!0),n(ge,null,Ve(Q.value,(o,r)=>(l(),n("div",{key:`reg-${r}`,class:"font-mono"},a(mt(o)),1))),128))])])):g("",!0),X.value.length?(l(),n("div",Yo,[e[58]||(e[58]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",qo,[(l(!0),n(ge,null,Ve(X.value,(o,r)=>(l(),n("div",{key:`login-${r}`,class:"font-mono"},a(mt(o)),1))),128))])])):g("",!0)],512)])):g("",!0),!_.value&&!c.value&&!f.value&&!Q.value.length&&!X.value.length?(l(),n("div",Qo," 暂无任务 ")):g("",!0)])])])):g("",!0)])),(l(),Re(je,{to:"body"},[x.value?(l(),n("div",Xo,[s("div",Wo,[s("div",{class:"flex items-center justify-between"},[e[59]||(e[59]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Fe}," 关闭 ")]),$.value?(l(),n("div",Zo,a($.value),1)):g("",!0),s("div",er,[e[60]||(e[60]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),R(s("input",{"onUpdate:modelValue":e[20]||(e[20]=o=>h.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[V,h.value.id]]),e[61]||(e[61]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),R(s("textarea",{"onUpdate:modelValue":e[21]||(e[21]=o=>h.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[V,h.value.secure_c_ses]]),e[62]||(e[62]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),R(s("input",{"onUpdate:modelValue":e[22]||(e[22]=o=>h.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.csesidx]]),e[63]||(e[63]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),R(s("input",{"onUpdate:modelValue":e[23]||(e[23]=o=>h.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.config_id]]),e[64]||(e[64]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),R(s("input",{"onUpdate:modelValue":e[24]||(e[24]=o=>h.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.host_c_oses]]),e[65]||(e[65]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),R(s("input",{"onUpdate:modelValue":e[25]||(e[25]=o=>h.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[V,h.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Fe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Yt}," 保存 ")])])])):g("",!0)])),(l(),Re(je,{to:"body"},[Me.value?(l(),n("div",tr,[s("div",sr,[s("div",or,[e[66]||(e[66]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",rr,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Jt},a(N.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Pe}," 关闭 ")])]),D.value?(l(),n("div",lr,a(D.value),1)):g("",!0),s("div",nr,[R(s("textarea",{"onUpdate:modelValue":e[26]||(e[26]=o=>se.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:N.value},null,8,ar),[[V,se.value]])]),s("div",ir,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",onClick:Gt,disabled:N.value}," 保存 ",8,dr)])])])):g("",!0)]))],64))}});export{xr as default};
static/assets/Accounts-CS68WEf6.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ import{g as E,D as ts,h as a,d as ss,E as os,i as H,o as rs,A as ls,j as ns,c as l,a as s,p as J,m as Re,q as A,v as $,s as Tt,t as n,n as g,u as R,b as m,f as pe,F as ge,r as Ve,x as je,w as V,e as r,G as as}from"./index-B38eA7T4.js";import{_ as is}from"./SelectMenu.vue_vue_type_script_setup_true_lang-n4k9i9SG.js";import{_ as be}from"./Checkbox.vue_vue_type_script_setup_true_lang-mPA_O7TM.js";import{_ as ds}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-B4oTz-IR.js";import{u as us}from"./useConfirmDialog-DRJ5fetN.js";import{_ as cs}from"./HelpTip.vue_vue_type_script_setup_true_lang-P0lttIQ0.js";const h={list:()=>E.get("/admin/accounts"),getConfig:()=>E.get("/admin/accounts-config"),updateConfig:b=>E.put("/admin/accounts-config",b),delete:b=>E.delete(`/admin/accounts/${b}`),disable:b=>E.put(`/admin/accounts/${b}/disable`),enable:b=>E.put(`/admin/accounts/${b}/enable`),startRegister:(b,w)=>E.post("/admin/register/start",{count:b,domain:w}),getRegisterTask:b=>E.get(`/admin/register/task/${b}`),getRegisterCurrent:()=>E.get("/admin/register/current"),startLogin:b=>E.post("/admin/login/start",b),getLoginTask:b=>E.get(`/admin/login/task/${b}`),getLoginCurrent:()=>E.get("/admin/login/current"),checkLogin:()=>E.post("/admin/login/check")},fs=ts("accounts",()=>{const b=a([]),w=a(!1);async function L(){w.value=!0;try{const u=await h.list();b.value=Array.isArray(u)?u:u.accounts||[]}finally{w.value=!1}}async function re(u){await h.delete(u),await L()}async function C(u){await h.disable(u),await L()}async function le(u){await h.enable(u),await L()}async function Z(u){await Promise.all(u.map(j=>h.enable(j))),await L()}async function p(u){await Promise.all(u.map(j=>h.disable(j))),await L()}async function G(u){await Promise.all(u.map(j=>h.delete(j))),await L()}async function ne(u){await h.updateConfig(u),await L()}return{accounts:b,isLoading:w,loadAccounts:L,deleteAccount:re,disableAccount:C,enableAccount:le,bulkEnable:Z,bulkDisable:p,bulkDelete:G,updateConfig:ne}}),vs={class:"space-y-8"},xs={class:"rounded-3xl border border-border bg-card p-6"},ms={class:"flex flex-wrap items-center justify-between gap-4"},ps={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},gs={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},bs={class:"ml-auto flex items-center gap-2 sm:ml-0"},ys={class:"mt-4 flex flex-wrap items-center gap-2"},_s=["disabled"],hs=["disabled"],ws={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},ks=["disabled"],Cs=["disabled"],Ts=["disabled"],Ss=["disabled"],Es=["disabled"],Is={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},Ls=["onClick"],As={class:"flex items-start justify-between gap-3"},$s={class:"mt-1 font-mono text-xs text-foreground"},Rs={class:"flex items-center gap-2"},Vs={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},js={key:0,class:"mt-1 text-[11px]"},Ms={key:0},Ds={key:1},Os={class:"mt-1 text-sm font-semibold text-foreground"},Bs={class:"mt-1 text-sm font-semibold text-foreground"},Ns={class:"mt-4 flex flex-wrap items-center gap-2"},Us=["onClick"],zs=["onClick"],Ps=["onClick"],Fs=["onClick"],Ks={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Hs={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},Js={class:"min-w-full text-left text-sm"},Gs={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Ys={class:"py-3 pr-4"},qs={class:"py-3 pr-6"},Qs={class:"inline-flex items-center gap-2"},Xs={class:"text-sm text-foreground"},Ws={key:0},Zs=["onClick"],eo={class:"py-4 pr-6 font-mono text-xs text-foreground"},to={class:"py-4 pr-6"},so={class:"py-4 pr-6"},oo={key:0,class:"block text-[11px] text-muted-foreground"},ro={class:"py-4 pr-6 text-xs"},lo={class:"py-4 pr-6 text-xs text-muted-foreground"},no={class:"py-4 pr-6 text-xs text-muted-foreground"},ao={class:"py-4 text-right"},io={class:"flex flex-wrap justify-end gap-2"},uo=["onClick"],co=["onClick"],fo=["onClick"],vo=["onClick"],xo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},mo={class:"flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},po={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},go={class:"mt-1 text-xs text-muted-foreground"},bo={class:"scrollbar-slim flex-1 overflow-y-auto px-6 py-4"},yo={class:"space-y-4 text-sm"},_o={class:"flex rounded-full border border-border bg-muted/30 p-1 text-xs"},ho={key:0,class:"space-y-4"},wo={key:1,class:"space-y-4"},ko={key:0,class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-600"},Co={class:"border-t border-border/60 px-6 py-4"},To={class:"flex items-center justify-end gap-2"},So=["disabled"],Eo=["disabled"],Io={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Lo={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},Ao={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},$o={class:"flex items-center gap-2"},Ro=["disabled"],Vo={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},jo={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},Mo={key:1,class:"grid gap-3 text-xs text-muted-foreground"},Do={key:0,class:"space-y-1"},Oo={class:"flex flex-wrap gap-x-4 gap-y-1"},Bo={key:1,class:"space-y-1"},No={class:"flex flex-wrap gap-x-4 gap-y-1"},Uo={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},zo={key:0,class:"space-y-2"},Po={class:"space-y-1 text-[11px] text-muted-foreground"},Fo={key:1,class:"mt-4 space-y-2"},Ko={class:"space-y-1 text-[11px] text-muted-foreground"},Ho={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},Jo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Go={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Yo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},qo={class:"mt-4 space-y-3 text-sm"},Qo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Xo={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},Wo={class:"flex items-center justify-between"},Zo={class:"flex items-center gap-2"},er={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},tr={class:"mt-4"},sr=["readonly"],or={class:"mt-6 flex items-center justify-end gap-2"},rr=["disabled"],He="accounts-register-task-cache",Je="accounts-login-task-cache",Ge="accounts-register-log-clear",Ye="accounts-login-log-clear",qe="accounts-register-task-cleared-id",Qe="accounts-login-task-cleared-id",St="1970-01-01 00:00:00",cr=ss({__name:"Accounts",setup(b){const w=fs(),{accounts:L,isLoading:re}=os(w),C=us(),le=a(""),Z=a("all"),p=a(new Set),G=a("table"),ne=a(!1),u=a(""),j=a(!1),M=a(""),ee=a(""),B=a(!1),ae=a([]),ie=a(1),ye=a(!1),N=a("register"),de=a(""),U=a(""),_e=a(!1),Y=a(!1),z=a(!1),Me=a(null),he=a(null),we=a(null),P=a(null),F=a(null),te=a(0),se=a(0),ue=a(!1),c=a(null),f=a(null),Xe=a(null),D=a(!1),T=a(!1),y=a(""),_=a({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),ke=a(null),We=a([]),Et=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],K=H(()=>{const e=le.value.trim().toLowerCase();return L.value.filter(t=>{const o=!e||t.id.toLowerCase().includes(e),i=Z.value==="all"||fe(t)===Z.value;return o&&i})}),O=H(()=>p.value.size),De=H(()=>K.value.length>0&&K.value.every(e=>p.value.has(e.id))),ce=async()=>{await w.loadAccounts(),p.value=new Set,z.value=!1},Ze=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},et=e=>{try{return localStorage.getItem(e)||null}catch{return null}},Ce=(e,t)=>{try{if(t){localStorage.setItem(e,t);return}localStorage.removeItem(e)}catch{}},tt=(e,t)=>{try{localStorage.setItem(e,JSON.stringify(t))}catch{}},st=e=>{try{localStorage.removeItem(e)}catch{}},ot=e=>{const t=localStorage.getItem(e),o=Number(t);return Number.isFinite(o)?o:0},Te=(e,t)=>{try{localStorage.setItem(e,String(t))}catch{}},Oe=(e,t=!0)=>{e&&(e.id&&e.id===P.value||(e.id&&P.value&&e.id!==P.value&&(P.value=null,Ce(qe,null)),c.value=e,e.id&&e.id!==he.value&&(he.value=e.id,te.value=0,Te(Ge,0)),t&&tt(He,e)))},Se=(e,t=!0)=>{e&&(e.id&&e.id===F.value||(e.id&&F.value&&e.id!==F.value&&(F.value=null,Ce(Qe,null)),f.value=e,e.id&&e.id!==we.value&&(we.value=e.id,se.value=0,Te(Ye,0)),t&&tt(Je,e)))},It=()=>{te.value=ot(Ge),se.value=ot(Ye),P.value=et(qe),F.value=et(Qe);const e=Ze(He);e&&e.id!==P.value&&(c.value=e,he.value=e.id||null);const t=Ze(Je);t&&t.id!==F.value&&(f.value=t,we.value=t.id||null)},Lt=()=>{ye.value=!0,N.value="register",de.value="",U.value="",_e.value=!1,ue.value=!1},Be=()=>{ye.value=!1},At=e=>{const t=[],o=[];return e.split(/\r?\n/).map(d=>d.trim()).filter(Boolean).forEach((d,x)=>{const v=d.split("----").map(S=>S.trim()),k=x+1;if(v.length){if(v[0].toLowerCase()==="duckmail"){if(v.length<3||!v[1]||!v[2]){o.push(`第 ${k} 行格式错误(duckmail)`);return}const S=v[1],$e=v.slice(2).join("----");t.push({id:S,secure_c_ses:"",csesidx:"",config_id:"",expires_at:St,mail_provider:"duckmail",mail_address:S,mail_password:$e});return}if(v.length>=4&&v[0]&&v[2]&&v[3]){const S=v[0],$e=v[1]||"",I=v[2],es=v.slice(3).join("----");t.push({id:S,secure_c_ses:"",csesidx:"",config_id:"",expires_at:St,mail_provider:"microsoft",mail_address:S,mail_password:$e,mail_client_id:I,mail_refresh_token:es,mail_tenant:"consumers"});return}o.push(`第 ${k} 行格式错误`)}}),{items:t,errors:o}},$t=async()=>{if(U.value="",!de.value.trim()){U.value="请输入导入内容";return}const{items:e,errors:t}=At(de.value);if(!e.length){U.value=t.length?t.join(","):"未识别到有效账号";return}if(t.length){U.value=t.slice(0,3).join(",");return}_e.value=!0;try{const i=[...await ft()],d=new Map(i.map((k,S)=>[k.id,S])),x=[];e.forEach(k=>{const S=d.get(k.id||"");if(S===void 0){i.push(k),x.push(k.id);return}const I={...i[S],mail_provider:k.mail_provider,mail_address:k.mail_address};k.mail_provider==="microsoft"?(I.mail_client_id=k.mail_client_id,I.mail_refresh_token=k.mail_refresh_token,I.mail_tenant=k.mail_tenant,I.mail_password=k.mail_password):(I.mail_password=k.mail_password,I.mail_client_id=void 0,I.mail_refresh_token=void 0,I.mail_tenant=void 0),i[S]=I,x.push(k.id)}),await w.updateConfig(i),await ce(),p.value=new Set(x),Be(),await C.ask({title:"导入成功",message:`已导入 ${x.length} 个账户并自动选中。是否立即刷新这些账户以获取 Cookie?`,confirmText:"立即刷新",cancelText:"稍后手动刷新"})&&await Ct()}catch(o){U.value=o.message||"导入失败"}finally{_e.value=!1}},Rt=async()=>{try{const e=[],t=c.value?.id,o=f.value?.id;if(t&&!Ee(t)&&e.push(ht(t)),o&&!Ie(o)&&e.push(wt(o)),!e.length){await Ke();return}await Promise.all(e)}catch(e){y.value=e?.message||"任务状态更新失败"}},Ne=async()=>{Y.value=!0,await Rt()},Vt=()=>{Y.value=!1},jt=()=>{const e=c.value?.id||null,t=f.value?.id||null;P.value=e,F.value=t,Ce(qe,e),Ce(Qe,t),te.value=c.value?.logs?.length||0,se.value=f.value?.logs?.length||0,Te(Ge,te.value),Te(Ye,se.value),c.value=null,f.value=null,he.value=null,we.value=null,y.value="",D.value=!1,T.value=!1,X(),W(),st(He),st(Je)},Ee=e=>!!(e&&e===P.value),Ie=e=>!!(e&&e===F.value),Mt=()=>{z.value=!z.value},oe=()=>{z.value=!1},rt=e=>{if(!z.value)return;const t=e.target;Me.value&&!Me.value.contains(t)&&(z.value=!1)};rs(async()=>{It(),await ce(),await Ke(),Xt(),document.addEventListener("click",rt)});const q=H(()=>{const e=c.value?.logs||[];return te.value?e.slice(te.value):e}),Q=H(()=>{const e=f.value?.logs||[];return se.value?e.slice(se.value):e}),Dt=H(()=>!!y.value||!!c.value||!!f.value||q.value.length>0||Q.value.length>0),Ot=async()=>{await as();const e=Xe.value;e&&(e.scrollTop=e.scrollHeight)};ls([q,Q,Y],async()=>{Y.value&&await Ot()},{deep:!0});const Bt=H(()=>{const e=c.value?.status,t=f.value?.status;return e==="running"||e==="pending"||t==="running"||t==="pending"}),Nt=H(()=>{if(y.value)return"bg-rose-500";if(Bt.value)return"bg-sky-400";const e=[];if(c.value){const d=c.value.success_count??0,x=c.value.fail_count??0,v=c.value.count??d+x;e.push({success:d,fail:x,total:v,status:c.value.status})}if(f.value){const d=f.value.success_count??0,x=f.value.fail_count??0,v=f.value.account_ids?.length??d+x;e.push({success:d,fail:x,total:v,status:f.value.status})}if(!e.length)return"bg-muted-foreground";const t=e.reduce((d,x)=>d+x.success,0),o=e.reduce((d,x)=>d+x.fail,0),i=e.reduce((d,x)=>d+(x.total||0),0);if(t>0&&o>0)return"bg-amber-400";if(o>0&&t===0)return"bg-rose-500";if(t>0&&o===0)return"bg-emerald-400";if(i===0){const d=e.every(v=>v.status==="success");if(e.some(v=>v.status==="failed"))return"bg-rose-500";if(d)return"bg-emerald-400"}return"bg-muted-foreground"});ns(()=>{X(),W(),Qt(),document.removeEventListener("click",rt)});const fe=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?"429限流":e.cooldown_reason==="错误禁用"?"错误禁用":e.disabled?"手动禁用":e.status==="已过期"?"已过期":e.status==="即将过期"?"即将过期":"正常",lt=e=>{const t=fe(e);return t==="429限流"||t==="即将过期"?"bg-amber-200 text-amber-900":t==="错误禁用"||t==="已过期"?"bg-destructive/10 text-destructive":t==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},nt=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?!0:e.disabled||e.cooldown_reason==="错误禁用",at=e=>e==="已过期"?"过期":e==="未设置"?"未设置":e,it=e=>e.status==="已过期"?"text-rose-600":e.status==="即将过期"?"text-amber-700":e.status==="未设置"?"text-muted-foreground":"text-emerald-600",dt=e=>e<60?`${e} 秒`:e<3600?`${Math.ceil(e/60)} 分钟`:`${(e/3600).toFixed(1)} 小时`,Ue=e=>e.cooldown_seconds>0?"text-amber-700":e.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",ut=e=>{const t=fe(e);return t==="手动禁用"||t==="已过期"?"bg-muted/70":""},Le=e=>{const t=new Set(p.value);t.has(e)?t.delete(e):t.add(e),p.value=t},ct=()=>{if(De.value){p.value=new Set;return}p.value=new Set(K.value.map(e=>e.id))},Ut=(e,t)=>e.id||`account_${t+1}`,ft=async()=>(await h.getConfig()).accounts.map((t,o)=>({...t,id:Ut(t,o)})),vt=e=>`${e.time} [${e.level}] ${e.message}`,zt=(e,t)=>{let o=-1;for(let d=0;d<e.length;d+=1)if(e[d].id===t){o=d;break}if(o===-1)return u.value="未找到对应账号配置。",!1;const i=e[o];return _.value={id:i.id,secure_c_ses:i.secure_c_ses,csesidx:i.csesidx,config_id:i.config_id,host_c_oses:i.host_c_oses,expires_at:i.expires_at},We.value=e,ke.value=o,ne.value=!0,!0},xt=async e=>{u.value="";try{const t=await ft();zt(t,e)}catch(t){u.value=t.message||"加载账号配置失败"}},Pt=async()=>{M.value="";try{const e=await h.getConfig();ae.value=Array.isArray(e.accounts)?e.accounts:[],ee.value=JSON.stringify(pt(ae.value),null,2),B.value=!0,j.value=!0}catch(e){M.value=e.message||"加载账号配置失败"}},ze=()=>{j.value=!1,M.value="",B.value=!1},mt=()=>{const e=JSON.parse(ee.value);if(!Array.isArray(e))throw new Error("配置格式必须是数组。");return e},Ft=e=>typeof e!="string"||!e?e:e.length<=6?`${e.slice(0,2)}****`:`${e.slice(0,3)}****`,pt=e=>{const t=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password","mail_refresh_token","mail_client_id"]);return e.map(o=>{const i={...o};return t.forEach(d=>{const x=i[d];x&&(i[d]=Ft(x))}),i})},Kt=()=>{if(M.value="",!B.value){try{ae.value=mt()}catch(e){M.value=e.message||"JSON 格式错误";return}ee.value=JSON.stringify(pt(ae.value),null,2),B.value=!0;return}ee.value=JSON.stringify(ae.value,null,2),B.value=!1},Ht=async()=>{M.value="";try{const e=mt();await w.updateConfig(e),ze()}catch(e){M.value=e.message||"保存失败"}},Pe=()=>{ne.value=!1,u.value=""},Jt=async()=>{if(ke.value===null)return;const e=[...We.value];e[ke.value]={...e[ke.value],id:_.value.id,secure_c_ses:_.value.secure_c_ses,csesidx:_.value.csesidx,config_id:_.value.config_id,host_c_oses:_.value.host_c_oses||void 0,expires_at:_.value.expires_at||void 0};try{await w.updateConfig(e),Pe()}catch(t){u.value=t.message||"保存失败"}},Gt=async()=>{await w.bulkEnable(Array.from(p.value)),p.value=new Set},Yt=async()=>{await C.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"})&&(await w.bulkDisable(Array.from(p.value)),p.value=new Set)},qt=async()=>{await C.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"})&&(await w.bulkDelete(Array.from(p.value)),p.value=new Set)},gt=async e=>{await w.enableAccount(e)},bt=async e=>{await C.ask({title:"禁用账号",message:"确定要禁用该账号吗?"})&&await w.disableAccount(e)},yt=async e=>{await C.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"})&&await w.deleteAccount(e)};let ve=null,xe=null,me=null,Ae=!1;const X=()=>{ve!==null&&(window.clearInterval(ve),ve=null)},W=()=>{xe!==null&&(window.clearInterval(xe),xe=null)},Qt=()=>{me!==null&&(window.clearInterval(me),me=null),Ae=!1},_t=e=>e==="pending"?"等待中":e==="running"?"执行中":e==="success"?"成功":e==="failed"?"失败":e,ht=async e=>{if(Ee(e)){X();return}const t=await h.getRegisterTask(e);if(Ee(t.id)){X();return}Oe(t),t.status!=="running"&&t.status!=="pending"&&(D.value=!1,X(),await ce())},wt=async e=>{if(Ie(e)){W();return}const t=await h.getLoginTask(e);if(Ie(t.id)){W();return}Se(t),t.status!=="running"&&t.status!=="pending"&&(T.value=!1,W(),await ce())},kt=e=>{X(),ve=window.setInterval(()=>{ht(e).catch(t=>{y.value=t?.message||"注册任务更新失败",X(),D.value=!1})},3e3)},Fe=e=>{W(),xe=window.setInterval(()=>{wt(e).catch(t=>{y.value=t?.message||"刷新任务更新失败",W(),T.value=!1})},3e3)},Xt=()=>{me===null&&(me=window.setInterval(async()=>{if(!Ae&&!Y.value&&!(ve!==null||xe!==null)&&!(!D.value&&!T.value&&!c.value&&!f.value)){Ae=!0;try{await Ke()}catch(e){y.value=e?.message||"后台刷新失败"}finally{Ae=!1}}},6e3))},Ke=async()=>{try{const e=await h.getRegisterCurrent();e&&"id"in e&&!Ee(e.id)&&(Oe(e),(e.status==="running"||e.status==="pending")&&(D.value=!0,kt(e.id)))}catch(e){y.value=e.message||"加载注册任务失败"}try{const e=await h.getLoginCurrent();e&&"id"in e&&!Ie(e.id)&&(Se(e),(e.status==="running"||e.status==="pending")&&(T.value=!0,Fe(e.id)))}catch(e){y.value=e.message||"加载刷新任务失败"}},Wt=async()=>{y.value="",D.value=!0;try{const e=Number.isFinite(ie.value)&&ie.value>0?ie.value:void 0,t=await h.startRegister(e);Oe(t),kt(t.id),ye.value=!1,Y.value=!0}catch(e){y.value=e.message||"启动注册失败",D.value=!1}},Ct=async()=>{if(p.value.size){y.value="",T.value=!0;try{const e=await h.startLogin(Array.from(p.value));Se(e),Fe(e.id),Ne()}catch(e){y.value=e.message||"启动刷新失败",T.value=!1}}},Zt=async()=>{y.value="",T.value=!0;try{await h.checkLogin();const e=await h.getLoginCurrent();if(e&&"id"in e){Se(e),Fe(e.id),Ne();return}T.value=!1}catch(e){y.value=e.message||"触发刷新失败",T.value=!1}};return(e,t)=>(r(),l(ge,null,[s("div",vs,[s("section",xs,[s("div",ms,[s("div",ps,[A(s("input",{"onUpdate:modelValue":t[0]||(t[0]=o=>le.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[$,le.value]]),J(is,{modelValue:Z.value,"onUpdate:modelValue":t[1]||(t[1]=o=>Z.value=o),options:Et},null,8,["modelValue"])]),s("div",gs,[J(be,{modelValue:De.value,"onUpdate:modelValue":ct},{default:Tt(()=>[...t[27]||(t[27]=[pe(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+n(O.value)+" / "+n(K.value.length)+" 个账号",1),s("div",bs,[s("button",{type:"button",class:g(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",G.value==="table"?"bg-accent text-accent-foreground":""]),onClick:t[2]||(t[2]=o=>G.value="table"),"aria-label":"列表视图"},[...t[28]||(t[28]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:g(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",G.value==="card"?"bg-accent text-accent-foreground":""]),onClick:t[3]||(t[3]=o=>G.value="card"),"aria-label":"卡片视图"},[...t[29]||(t[29]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",ys,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:R(re),onClick:ce}," 刷新列表 ",8,_s),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pt}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:D.value,onClick:Lt}," 添加账户 ",8,hs),s("div",{ref_key:"moreActionsRef",ref:Me,class:"relative"},[s("button",{class:g(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",z.value?"bg-accent text-accent-foreground":""]),onClick:Mt},[t[30]||(t[30]=pe(" 更多操作 ",-1)),t[31]||(t[31]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),Dt.value?(r(),l("span",{key:0,class:g(["ml-1 h-2 w-2 rounded-full",Nt.value]),"aria-hidden":"true"},null,2)):m("",!0)],2),z.value?(r(),l("div",ws,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:t[4]||(t[4]=o=>{Ne(),oe()})}," 任务状态 "),t[32]||(t[32]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",T.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:T.value,onClick:t[5]||(t[5]=o=>{Zt(),oe()})}," 刷新过期 ",10,ks),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!O.value||T.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!O.value||T.value,onClick:t[6]||(t[6]=o=>{Ct(),oe()})}," 刷新选中 ",10,Cs),t[33]||(t[33]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[7]||(t[7]=o=>{Gt(),oe()})}," 批量启用 ",10,Ts),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[8]||(t[8]=o=>{Yt(),oe()})}," 批量禁用 ",10,Ss),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[9]||(t[9]=o=>{qt(),oe()})}," 批量删除 ",10,Es)])):m("",!0)],512)]),G.value==="card"?(r(),l("div",Is,[(r(!0),l(ge,null,Ve(K.value,o=>(r(),l("div",{key:o.id,class:g(["rounded-2xl border border-border bg-card p-4",ut(o)]),onClick:i=>Le(o.id)},[s("div",As,[s("div",null,[t[34]||(t[34]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",$s,n(o.id),1)]),s("div",Rs,[J(be,{modelValue:p.value.has(o.id),"onUpdate:modelValue":i=>Le(o.id),onClick:t[10]||(t[10]=V(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:g(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",lt(o)])},n(fe(o)),3)])]),s("div",Vs,[s("div",null,[t[35]||(t[35]=s("p",null,"剩余时间",-1)),s("p",{class:g(["mt-1 text-sm font-semibold",it(o)])},n(at(o.remaining_display)),3),o.expires_at?(r(),l("p",js,n(o.expires_at),1)):m("",!0)]),s("div",null,[t[36]||(t[36]=s("p",null,"冷却",-1)),s("p",{class:g(["mt-1",Ue(o)])},[o.cooldown_seconds>0?(r(),l("span",Ms,n(dt(o.cooldown_seconds))+" · "+n(o.cooldown_reason),1)):(r(),l("span",Ds,n(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[t[37]||(t[37]=s("p",null,"失败数",-1)),s("p",Os,n(o.error_count),1)]),s("div",null,[t[38]||(t[38]=s("p",null,"会话数",-1)),s("p",Bs,n(o.conversation_count),1)])]),s("div",Ns,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>xt(o.id),["stop"])}," 编辑 ",8,Us),nt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[11]||(t[11]=V(()=>{},["stop"])),i=>gt(o.id)]}," 启用 ",8,zs)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[12]||(t[12]=V(()=>{},["stop"])),i=>bt(o.id)]}," 禁用 ",8,Ps)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[t[13]||(t[13]=V(()=>{},["stop"])),i=>yt(o.id)]}," 删除 ",8,Fs)])],10,Ls))),128)),!K.value.length&&!R(re)?(r(),l("div",Ks," 暂无账号数据,请检查后台配置。 ")):m("",!0)])):(r(),l("div",Hs,[s("table",Js,[s("thead",Gs,[s("tr",null,[s("th",Ys,[J(be,{modelValue:De.value,"onUpdate:modelValue":ct},null,8,["modelValue"])]),t[40]||(t[40]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),t[41]||(t[41]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",qs,[s("span",Qs,[t[39]||(t[39]=pe(" 剩余/过期 ",-1)),J(cs,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),t[42]||(t[42]=s("th",{class:"py-3 pr-6"},"冷却",-1)),t[43]||(t[43]=s("th",{class:"py-3 pr-6"},"失败数",-1)),t[44]||(t[44]=s("th",{class:"py-3 pr-6"},"会话数",-1)),t[45]||(t[45]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",Xs,[!K.value.length&&!R(re)?(r(),l("tr",Ws,[...t[46]||(t[46]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):m("",!0),(r(!0),l(ge,null,Ve(K.value,o=>(r(),l("tr",{key:o.id,class:g(["border-t border-border",ut(o)]),onClick:i=>Le(o.id)},[s("td",{class:"py-4 pr-4",onClick:t[14]||(t[14]=V(()=>{},["stop"]))},[J(be,{modelValue:p.value.has(o.id),"onUpdate:modelValue":i=>Le(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",eo,n(o.id),1),s("td",to,[s("span",{class:g(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",lt(o)])},n(fe(o)),3)]),s("td",so,[s("div",{class:g(["text-sm font-semibold",it(o)])},n(at(o.remaining_display)),3),o.expires_at?(r(),l("span",oo,n(o.expires_at),1)):m("",!0)]),s("td",ro,[o.cooldown_seconds>0?(r(),l("span",{key:0,class:g(Ue(o))},n(dt(o.cooldown_seconds))+" · "+n(o.cooldown_reason),3)):(r(),l("span",{key:1,class:g(Ue(o))},n(o.cooldown_reason||"无冷却"),3))]),s("td",lo,n(o.error_count),1),s("td",no,n(o.conversation_count),1),s("td",ao,[s("div",io,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>xt(o.id),["stop"])}," 编辑 ",8,uo),nt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>gt(o.id),["stop"])}," 启用 ",8,co)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>bt(o.id),["stop"])}," 禁用 ",8,fo)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:V(i=>yt(o.id),["stop"])}," 删除 ",8,vo)])])],10,Zs))),128))])])]))])]),J(ds,{open:R(C).open.value,title:R(C).title.value,message:R(C).message.value,"confirm-text":R(C).confirmText.value,"cancel-text":R(C).cancelText.value,onConfirm:R(C).confirm,onCancel:R(C).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(r(),Re(je,{to:"body"},[ye.value?(r(),l("div",xo,[s("div",mo,[s("div",po,[s("div",null,[t[47]||(t[47]=s("p",{class:"text-sm font-medium text-foreground"},"添加账户",-1)),s("p",go,n(N.value==="register"?"创建 DuckMail 账号并自动注册":"批量导入账户配置"),1)]),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Be}," 关闭 ")]),s("div",bo,[s("div",yo,[s("div",_o,[s("button",{type:"button",class:g(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",N.value==="register"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[15]||(t[15]=o=>N.value="register")}," 自动注册 ",2),s("button",{type:"button",class:g(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",N.value==="import"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[16]||(t[16]=o=>N.value="import")}," 批量导入 ",2)]),N.value==="register"?(r(),l("div",ho,[t[48]||(t[48]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),A(s("input",{"onUpdate:modelValue":t[17]||(t[17]=o=>ie.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,ie.value,void 0,{number:!0}]]),t[49]||(t[49]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"}," 默认域名来自设置面板(可在“配置面板”中修改) ",-1))])):(r(),l("div",wo,[t[50]||(t[50]=s("label",{class:"block text-xs text-muted-foreground"},"批量导入(每行一个)",-1)),A(s("textarea",{"onUpdate:modelValue":t[18]||(t[18]=o=>de.value=o),class:"min-h-[140px] w-full rounded-2xl border border-input bg-background px-3 py-2 text-xs font-mono",placeholder:`duckmail----you@example.com----password
2
+ user@outlook.com----loginPassword----clientId----refreshToken`},null,512),[[$,de.value]]),t[51]||(t[51]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"支持两种格式:"),s("p",{class:"mt-1 font-mono"},"duckmail----email----password"),s("p",{class:"mt-1 font-mono"},"email----password----clientId----refreshToken"),s("p",{class:"mt-2 text-[11px]"},'导入后请执行一次"刷新选中"以获取 Cookie。')],-1)),U.value?(r(),l("div",ko,n(U.value),1)):m("",!0)])),t[53]||(t[53]=s("div",{class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-[11px] leading-relaxed"},[s("p",{class:"text-xs font-bold text-rose-600"},"⚠️ 严禁滥用:禁止将本工具用于商业用途或任何形式的滥用(无论规模大小)"),s("p",{class:"mt-1 text-muted-foreground"},[pe("详细声明请查看项目 "),s("a",{href:"https://github.com/Dreamy-rain/gemini-business2api/blob/main/docs/DISCLAIMER.md",target:"_blank",class:"text-primary hover:underline font-medium"},"DISCLAIMER.md")])],-1)),J(be,{modelValue:ue.value,"onUpdate:modelValue":t[19]||(t[19]=o=>ue.value=o)},{default:Tt(()=>[...t[52]||(t[52]=[pe(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])])]),s("div",Co,[s("div",To,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Be}," 取消 "),N.value==="register"?(r(),l("button",{key:0,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:D.value||!ue.value,onClick:Wt}," 开始注册 ",8,So)):(r(),l("button",{key:1,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:_e.value||!ue.value,onClick:$t}," 导入并保存 ",8,Eo))])])])])):m("",!0)])),(r(),Re(je,{to:"body"},[Y.value?(r(),l("div",Io,[s("div",Lo,[s("div",Ao,[t[54]||(t[54]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",$o,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary",disabled:!q.value.length&&!Q.value.length&&!c.value&&!f.value&&!y.value,onClick:jt}," 清空日志 ",8,Ro),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Vt}," 关闭 ")])]),s("div",Vo,[y.value?(r(),l("div",jo,n(y.value),1)):m("",!0),c.value||f.value?(r(),l("div",Mo,[c.value?(r(),l("div",Do,[t[55]||(t[55]=s("div",{class:"font-medium text-foreground"},"注册任务",-1)),s("div",Oo,[s("span",null,"状态:"+n(_t(c.value.status)),1),s("span",null,"进度:"+n(c.value.progress)+"/"+n(c.value.count),1),s("span",null,"成功:"+n(c.value.success_count),1),s("span",null,"失败:"+n(c.value.fail_count),1)])])):m("",!0),f.value?(r(),l("div",Bo,[t[56]||(t[56]=s("div",{class:"font-medium text-foreground"},"刷新任务",-1)),s("div",No,[s("span",null,"状态:"+n(_t(f.value.status)),1),s("span",null,"进度:"+n(f.value.progress)+"/"+n(f.value.account_ids.length),1),s("span",null,"成功:"+n(f.value.success_count),1),s("span",null,"失败:"+n(f.value.fail_count),1)])])):m("",!0)])):m("",!0),q.value.length||Q.value.length?(r(),l("div",Uo,[s("div",{ref_key:"taskLogsRef",ref:Xe,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[q.value.length?(r(),l("div",zo,[t[57]||(t[57]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",Po,[(r(!0),l(ge,null,Ve(q.value,(o,i)=>(r(),l("div",{key:`reg-${i}`,class:"font-mono"},n(vt(o)),1))),128))])])):m("",!0),Q.value.length?(r(),l("div",Fo,[t[58]||(t[58]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",Ko,[(r(!0),l(ge,null,Ve(Q.value,(o,i)=>(r(),l("div",{key:`login-${i}`,class:"font-mono"},n(vt(o)),1))),128))])])):m("",!0)],512)])):m("",!0),!y.value&&!c.value&&!f.value&&!q.value.length&&!Q.value.length?(r(),l("div",Ho," 暂无任务 ")):m("",!0)])])])):m("",!0)])),(r(),Re(je,{to:"body"},[ne.value?(r(),l("div",Jo,[s("div",Go,[s("div",{class:"flex items-center justify-between"},[t[59]||(t[59]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Pe}," 关闭 ")]),u.value?(r(),l("div",Yo,n(u.value),1)):m("",!0),s("div",qo,[t[60]||(t[60]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),A(s("input",{"onUpdate:modelValue":t[20]||(t[20]=o=>_.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[$,_.value.id]]),t[61]||(t[61]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),A(s("textarea",{"onUpdate:modelValue":t[21]||(t[21]=o=>_.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[$,_.value.secure_c_ses]]),t[62]||(t[62]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),A(s("input",{"onUpdate:modelValue":t[22]||(t[22]=o=>_.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.csesidx]]),t[63]||(t[63]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),A(s("input",{"onUpdate:modelValue":t[23]||(t[23]=o=>_.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.config_id]]),t[64]||(t[64]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),A(s("input",{"onUpdate:modelValue":t[24]||(t[24]=o=>_.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.host_c_oses]]),t[65]||(t[65]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),A(s("input",{"onUpdate:modelValue":t[25]||(t[25]=o=>_.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[$,_.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Jt}," 保存 ")])])])):m("",!0)])),(r(),Re(je,{to:"body"},[j.value?(r(),l("div",Qo,[s("div",Xo,[s("div",Wo,[t[66]||(t[66]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",Zo,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Kt},n(B.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:ze}," 关闭 ")])]),M.value?(r(),l("div",er,n(M.value),1)):m("",!0),s("div",tr,[A(s("textarea",{"onUpdate:modelValue":t[26]||(t[26]=o=>ee.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:B.value},null,8,sr),[[$,ee.value]])]),s("div",or,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:ze}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Ht,disabled:B.value}," 保存 ",8,rr)])])])):m("",!0)]))],64))}});export{cr as default};
static/assets/Accounts-CWTZ3Utf.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{g as b,C as Qe,h as d,d as qe,D as Ge,i as ne,o as Ke,j as We,c as l,a as s,x as R,y as Ce,m as C,v as V,b as g,A as Xe,t as r,n as h,u as $,F as le,r as Ve,f as $e,T as Ae,w as A,e as n}from"./index-gD6QQiOu.js";import{_ as Ye}from"./SelectMenu.vue_vue_type_script_setup_true_lang-B2Zu3W0l.js";import{_ as Y}from"./Checkbox.vue_vue_type_script_setup_true_lang-DT0LWHxC.js";import{_ as Ze}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-D2ZZ5gFD.js";import{u as et}from"./useConfirmDialog-DEfIwwMt.js";import{_ as tt}from"./HelpTip.vue_vue_type_script_setup_true_lang-Cur056hv.js";const x={list:()=>b.get("/admin/accounts"),getConfig:()=>b.get("/admin/accounts-config"),updateConfig:u=>b.put("/admin/accounts-config",u),delete:u=>b.delete(`/admin/accounts/${u}`),disable:u=>b.put(`/admin/accounts/${u}/disable`),enable:u=>b.put(`/admin/accounts/${u}/enable`),startRegister:(u,m)=>b.post("/admin/register/start",{count:u,domain:m}),getRegisterTask:u=>b.get(`/admin/register/task/${u}`),getRegisterCurrent:()=>b.get("/admin/register/current"),startLogin:u=>b.post("/admin/login/start",u),getLoginTask:u=>b.get(`/admin/login/task/${u}`),getLoginCurrent:()=>b.get("/admin/login/current"),checkLogin:()=>b.post("/admin/login/check")},st=Qe("accounts",()=>{const u=d([]),m=d(!1);async function w(){m.value=!0;try{const a=await x.list();u.value=Array.isArray(a)?a:a.accounts||[]}finally{m.value=!1}}async function I(a){await x.delete(a),await w()}async function f(a){await x.disable(a),await w()}async function M(a){await x.enable(a),await w()}async function j(a){await Promise.all(a.map(S=>x.enable(S))),await w()}async function c(a){await Promise.all(a.map(S=>x.disable(S))),await w()}async function E(a){await Promise.all(a.map(S=>x.delete(S))),await w()}async function O(a){await x.updateConfig(a),await w()}return{accounts:u,isLoading:m,loadAccounts:w,deleteAccount:I,disableAccount:f,enableAccount:M,bulkEnable:j,bulkDisable:c,bulkDelete:E,updateConfig:O}}),ot={class:"space-y-8"},rt={class:"rounded-3xl border border-border bg-card p-6"},nt={class:"flex flex-wrap items-center justify-between gap-4"},lt={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},at={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},it={key:0},dt={class:"ml-auto flex items-center gap-2 sm:ml-0"},ut={class:"mt-4 flex flex-wrap items-center gap-3"},ct=["disabled"],pt=["disabled"],xt=["disabled"],mt=["disabled"],ft={class:"mt-4 rounded-2xl border border-border bg-background p-4"},vt={class:"flex flex-wrap items-center gap-3"},bt={class:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground"},gt=["disabled"],yt=["disabled"],_t=["disabled"],ht={key:0,class:"mt-3 rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},wt={key:1,class:"mt-3 grid gap-2 text-xs text-muted-foreground"},kt={key:0},Ct={class:"ml-2"},Vt={class:"ml-2"},$t={class:"ml-2"},At={class:"ml-2"},St={key:1},Tt={class:"ml-2"},Dt={class:"ml-2"},Lt={class:"ml-2"},Et={class:"ml-2"},Ut={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},Rt=["onClick"],jt={class:"flex items-start justify-between gap-3"},zt={class:"mt-1 font-mono text-xs text-foreground"},Nt={class:"flex items-center gap-2"},Bt={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},It={key:0,class:"mt-1 text-[11px]"},Mt={key:0},Ot={key:1},Pt={class:"mt-1 text-sm font-semibold text-foreground"},Ft={class:"mt-1 text-sm font-semibold text-foreground"},Jt={class:"mt-4 flex flex-wrap items-center gap-2"},Ht=["onClick"],Qt=["onClick"],qt=["onClick"],Gt=["onClick"],Kt={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Wt={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},Xt={class:"min-w-full text-left text-sm"},Yt={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Zt={class:"py-3 pr-4"},es={class:"py-3 pr-6"},ts={class:"inline-flex items-center gap-2"},ss={class:"text-sm text-foreground"},os={key:0},rs=["onClick"],ns={class:"py-4 pr-6 font-mono text-xs text-foreground"},ls={class:"py-4 pr-6"},as={class:"py-4 pr-6"},is={key:0,class:"block text-[11px] text-muted-foreground"},ds={class:"py-4 pr-6 text-xs"},us={class:"py-4 pr-6 text-xs text-muted-foreground"},cs={class:"py-4 pr-6 text-xs text-muted-foreground"},ps={class:"py-4 text-right"},xs={class:"flex flex-wrap justify-end gap-2"},ms=["onClick"],fs=["onClick"],vs=["onClick"],bs=["onClick"],gs={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ys={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},_s={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},hs={class:"mt-4 space-y-3 text-sm"},ws={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ks={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},Cs={class:"flex items-center justify-between"},Vs={class:"flex items-center gap-2"},$s={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},As={class:"mt-4"},Ss=["readonly"],Ts={class:"mt-6 flex items-center justify-end gap-2"},Ds=["disabled"],Ns=qe({__name:"Accounts",setup(u){const m=st(),{accounts:w,isLoading:I}=Ge(m),f=et(),M=d(""),j=d("all"),c=d(new Set),E=d("table"),O=d(!1),a=d(""),S=d(!1),T=d(""),z=d(""),D=d(!1),P=d([]),F=d(1),Z=d(""),_=d(null),v=d(null),N=d(!1),k=d(!1),y=d(""),p=d({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),H=d(null),ae=d([]),Se=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],L=ne(()=>{const t=M.value.trim().toLowerCase();return w.value.filter(e=>{const o=!t||e.id.toLowerCase().includes(t),i=j.value==="all"||J(e)===j.value;return o&&i})}),B=ne(()=>c.value.size),ee=ne(()=>L.value.length>0&&L.value.every(t=>c.value.has(t.id))),Q=async()=>{await m.loadAccounts(),c.value=new Set};Ke(async()=>{await Q(),await Pe()}),We(()=>{W(),X()});const J=t=>t.cooldown_reason?.includes("429")&&t.cooldown_seconds>0?"429限流":t.cooldown_reason==="错误禁用"?"错误禁用":t.disabled?"手动禁用":t.status==="已过期"?"已过期":t.status==="即将过期"?"即将过期":"正常",ie=t=>{const e=J(t);return e==="429限流"||e==="即将过期"?"bg-amber-200 text-amber-900":e==="错误禁用"||e==="已过期"?"bg-destructive/10 text-destructive":e==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},de=t=>t.cooldown_reason?.includes("429")&&t.cooldown_seconds>0?!0:t.disabled||t.cooldown_reason==="错误禁用",ue=t=>t==="已过期"?"过期":t==="未设置"?"未设置":t,ce=t=>t.status==="已过期"?"text-rose-600":t.status==="即将过期"?"text-amber-700":t.status==="未设置"?"text-muted-foreground":"text-emerald-600",pe=t=>t<60?`${t} 秒`:t<3600?`${Math.ceil(t/60)} 分钟`:`${(t/3600).toFixed(1)} 小时`,te=t=>t.cooldown_seconds>0?"text-amber-700":t.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",xe=t=>{const e=J(t);return e==="手动禁用"||e==="已过期"?"bg-muted/70":""},q=t=>{const e=new Set(c.value);e.has(t)?e.delete(t):e.add(t),c.value=e},me=()=>{if(ee.value){c.value=new Set;return}c.value=new Set(L.value.map(t=>t.id))},Te=(t,e)=>t.id||`account_${e+1}`,De=async()=>(await x.getConfig()).accounts.map((e,o)=>({...e,id:Te(e,o)})),Le=(t,e)=>{let o=-1;for(let U=0;U<t.length;U+=1)if(t[U].id===e){o=U;break}if(o===-1)return a.value="未找到对应账号配置。",!1;const i=t[o];return p.value={id:i.id,secure_c_ses:i.secure_c_ses,csesidx:i.csesidx,config_id:i.config_id,host_c_oses:i.host_c_oses,expires_at:i.expires_at},ae.value=t,H.value=o,O.value=!0,!0},fe=async t=>{a.value="";try{const e=await De();Le(e,t)}catch(e){a.value=e.message||"加载账号配置失败"}},Ee=async()=>{T.value="";try{const t=await x.getConfig();P.value=Array.isArray(t.accounts)?t.accounts:[],z.value=JSON.stringify(be(P.value),null,2),D.value=!0,S.value=!0}catch(t){T.value=t.message||"加载账号配置失败"}},se=()=>{S.value=!1,T.value="",D.value=!1},ve=()=>{const t=JSON.parse(z.value);if(!Array.isArray(t))throw new Error("配置格式必须是数组。");return t},Ue=t=>typeof t!="string"||!t?t:t.length<=6?`${t.slice(0,2)}****`:`${t.slice(0,3)}****`,be=t=>{const e=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password"]);return t.map(o=>{const i={...o};return e.forEach(U=>{const ke=i[U];ke&&(i[U]=Ue(ke))}),i})},Re=()=>{if(T.value="",!D.value){try{P.value=ve()}catch(t){T.value=t.message||"JSON 格式错误";return}z.value=JSON.stringify(be(P.value),null,2),D.value=!0;return}z.value=JSON.stringify(P.value,null,2),D.value=!1},je=async()=>{T.value="";try{const t=ve();await m.updateConfig(t),se()}catch(t){T.value=t.message||"保存失败"}},oe=()=>{O.value=!1,a.value=""},ze=async()=>{if(H.value===null)return;const t=[...ae.value];t[H.value]={...t[H.value],id:p.value.id,secure_c_ses:p.value.secure_c_ses,csesidx:p.value.csesidx,config_id:p.value.config_id,host_c_oses:p.value.host_c_oses||void 0,expires_at:p.value.expires_at||void 0};try{await m.updateConfig(t),oe()}catch(e){a.value=e.message||"保存失败"}},Ne=async()=>{await m.bulkEnable(Array.from(c.value)),c.value=new Set},Be=async()=>{await f.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"})&&(await m.bulkDisable(Array.from(c.value)),c.value=new Set)},Ie=async()=>{await f.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"})&&(await m.bulkDelete(Array.from(c.value)),c.value=new Set)},ge=async t=>{await m.enableAccount(t)},ye=async t=>{await f.ask({title:"禁用账号",message:"确定要禁用该账号吗?"})&&await m.disableAccount(t)},_e=async t=>{await f.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"})&&await m.deleteAccount(t)};let G=null,K=null;const W=()=>{G!==null&&(window.clearInterval(G),G=null)},X=()=>{K!==null&&(window.clearInterval(K),K=null)},he=t=>t==="pending"?"等待中":t==="running"?"执行中":t==="success"?"成功":t==="failed"?"失败":t,Me=async t=>{const e=await x.getRegisterTask(t);_.value=e,e.status!=="running"&&e.status!=="pending"&&(N.value=!1,W(),await Q())},Oe=async t=>{const e=await x.getLoginTask(t);v.value=e,e.status!=="running"&&e.status!=="pending"&&(k.value=!1,X(),await Q())},we=t=>{W(),G=window.setInterval(()=>{Me(t).catch(e=>{y.value=e?.message||"注册任务更新失败",W(),N.value=!1})},3e3)},re=t=>{X(),K=window.setInterval(()=>{Oe(t).catch(e=>{y.value=e?.message||"刷新任务更新失败",X(),k.value=!1})},3e3)},Pe=async()=>{try{const t=await x.getRegisterCurrent();t&&"id"in t?(_.value=t,(t.status==="running"||t.status==="pending")&&(N.value=!0,we(t.id))):_.value=null}catch(t){y.value=t.message||"加载注册任务失败"}try{const t=await x.getLoginCurrent();t&&"id"in t?(v.value=t,(t.status==="running"||t.status==="pending")&&(k.value=!0,re(t.id))):v.value=null}catch(t){y.value=t.message||"加载刷新任务失败"}},Fe=async()=>{y.value="",N.value=!0;const t=Z.value.trim();try{const e=Number.isFinite(F.value)&&F.value>0?F.value:void 0,o=await x.startRegister(e,t||void 0);_.value=o,we(o.id)}catch(e){y.value=e.message||"启动注册失败",N.value=!1}},Je=async()=>{if(c.value.size){y.value="",k.value=!0;try{const t=await x.startLogin(Array.from(c.value));v.value=t,re(t.id)}catch(t){y.value=t.message||"启动刷新失败",k.value=!1}}},He=async()=>{y.value="",k.value=!0;try{await x.checkLogin();const t=await x.getLoginCurrent();if(t&&"id"in t){v.value=t,re(t.id);return}v.value=null,k.value=!1}catch(t){y.value=t.message||"触发刷新失败",k.value=!1}};return(t,e)=>(n(),l(le,null,[s("div",ot,[s("section",rt,[s("div",nt,[s("div",lt,[C(s("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>M.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[V,M.value]]),R(Ye,{modelValue:j.value,"onUpdate:modelValue":e[1]||(e[1]=o=>j.value=o),options:Se},null,8,["modelValue"])]),s("div",at,[R(Y,{modelValue:ee.value,"onUpdate:modelValue":me},{default:Xe(()=>[...e[18]||(e[18]=[$e(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"共 "+r(L.value.length)+" 个账号",1),B.value?(n(),l("span",it,"已选 "+r(B.value)+" 个",1)):g("",!0),s("div",dt,[s("button",{type:"button",class:h(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",E.value==="table"?"bg-accent text-accent-foreground":""]),onClick:e[2]||(e[2]=o=>E.value="table"),"aria-label":"列表视图"},[...e[19]||(e[19]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:h(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",E.value==="card"?"bg-accent text-accent-foreground":""]),onClick:e[3]||(e[3]=o=>E.value="card"),"aria-label":"卡片视图"},[...e[20]||(e[20]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",ut,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ee}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:$(I),onClick:Q}," 刷新列表 ",8,ct),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:!B.value,onClick:Ne}," 批量启用 ",8,pt),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:!B.value,onClick:Be}," 批量禁用 ",8,xt),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-destructive transition-colors hover:border-destructive hover:text-destructive",disabled:!B.value,onClick:Ie}," 批量删除 ",8,mt)]),s("div",ft,[s("div",vt,[s("div",bt,[e[21]||(e[21]=s("span",{class:"text-foreground"},"自动注册",-1)),C(s("input",{"onUpdate:modelValue":e[4]||(e[4]=o=>F.value=o),type:"number",min:"1",class:"w-20 rounded-full border border-input bg-background px-3 py-1 text-xs"},null,512),[[V,F.value,void 0,{number:!0}]]),C(s("input",{"onUpdate:modelValue":e[5]||(e[5]=o=>Z.value=o),type:"text",class:"w-40 rounded-full border border-input bg-background px-3 py-1 text-xs",placeholder:"指定域名(可选)"},null,512),[[V,Z.value]])]),s("button",{class:"rounded-full border border-border px-4 py-2 text-xs font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:N.value,onClick:Fe}," 开始注册 ",8,gt),s("button",{class:"rounded-full border border-border px-4 py-2 text-xs font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:k.value,onClick:He}," 刷新过期 ",8,yt),s("button",{class:"rounded-full border border-border px-4 py-2 text-xs font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:!B.value||k.value,onClick:Je}," 刷新选中 ",8,_t)]),y.value?(n(),l("div",ht,r(y.value),1)):g("",!0),_.value||v.value?(n(),l("div",wt,[_.value?(n(),l("div",kt,[e[22]||(e[22]=s("span",{class:"font-medium text-foreground"},"注册任务",-1)),s("span",Ct,"状态:"+r(he(_.value.status)),1),s("span",Vt,"进度:"+r(_.value.progress)+"/"+r(_.value.count),1),s("span",$t,"成功:"+r(_.value.success_count),1),s("span",At,"失败:"+r(_.value.fail_count),1)])):g("",!0),v.value?(n(),l("div",St,[e[23]||(e[23]=s("span",{class:"font-medium text-foreground"},"刷新任务",-1)),s("span",Tt,"状态:"+r(he(v.value.status)),1),s("span",Dt,"进度:"+r(v.value.progress)+"/"+r(v.value.account_ids.length),1),s("span",Lt,"成功:"+r(v.value.success_count),1),s("span",Et,"失败:"+r(v.value.fail_count),1)])):g("",!0)])):g("",!0)]),E.value==="card"?(n(),l("div",Ut,[(n(!0),l(le,null,Ve(L.value,o=>(n(),l("div",{key:o.id,class:h(["rounded-2xl border border-border bg-card p-4",xe(o)]),onClick:i=>q(o.id)},[s("div",jt,[s("div",null,[e[24]||(e[24]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",zt,r(o.id),1)]),s("div",Nt,[R(Y,{modelValue:c.value.has(o.id),"onUpdate:modelValue":i=>q(o.id),onClick:e[6]||(e[6]=A(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:h(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",ie(o)])},r(J(o)),3)])]),s("div",Bt,[s("div",null,[e[25]||(e[25]=s("p",null,"剩余时间",-1)),s("p",{class:h(["mt-1 text-sm font-semibold",ce(o)])},r(ue(o.remaining_display)),3),o.expires_at?(n(),l("p",It,r(o.expires_at),1)):g("",!0)]),s("div",null,[e[26]||(e[26]=s("p",null,"冷却",-1)),s("p",{class:h(["mt-1",te(o)])},[o.cooldown_seconds>0?(n(),l("span",Mt,r(pe(o.cooldown_seconds))+" · "+r(o.cooldown_reason),1)):(n(),l("span",Ot,r(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[e[27]||(e[27]=s("p",null,"失败数",-1)),s("p",Pt,r(o.error_count),1)]),s("div",null,[e[28]||(e[28]=s("p",null,"会话数",-1)),s("p",Ft,r(o.conversation_count),1)])]),s("div",Jt,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>fe(o.id),["stop"])}," 编辑 ",8,Ht),de(o)?(n(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[7]||(e[7]=A(()=>{},["stop"])),i=>ge(o.id)]}," 启用 ",8,Qt)):(n(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[8]||(e[8]=A(()=>{},["stop"])),i=>ye(o.id)]}," 禁用 ",8,qt)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[e[9]||(e[9]=A(()=>{},["stop"])),i=>_e(o.id)]}," 删除 ",8,Gt)])],10,Rt))),128)),!L.value.length&&!$(I)?(n(),l("div",Kt," 暂无账号数据,请检查后台配置。 ")):g("",!0)])):(n(),l("div",Wt,[s("table",Xt,[s("thead",Yt,[s("tr",null,[s("th",Zt,[R(Y,{modelValue:ee.value,"onUpdate:modelValue":me},null,8,["modelValue"])]),e[30]||(e[30]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),e[31]||(e[31]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",es,[s("span",ts,[e[29]||(e[29]=$e(" 剩余/过期 ",-1)),R(tt,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),e[32]||(e[32]=s("th",{class:"py-3 pr-6"},"冷却",-1)),e[33]||(e[33]=s("th",{class:"py-3 pr-6"},"失败数",-1)),e[34]||(e[34]=s("th",{class:"py-3 pr-6"},"会话数",-1)),e[35]||(e[35]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",ss,[!L.value.length&&!$(I)?(n(),l("tr",os,[...e[36]||(e[36]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):g("",!0),(n(!0),l(le,null,Ve(L.value,o=>(n(),l("tr",{key:o.id,class:h(["border-t border-border",xe(o)]),onClick:i=>q(o.id)},[s("td",{class:"py-4 pr-4",onClick:e[10]||(e[10]=A(()=>{},["stop"]))},[R(Y,{modelValue:c.value.has(o.id),"onUpdate:modelValue":i=>q(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",ns,r(o.id),1),s("td",ls,[s("span",{class:h(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",ie(o)])},r(J(o)),3)]),s("td",as,[s("div",{class:h(["text-sm font-semibold",ce(o)])},r(ue(o.remaining_display)),3),o.expires_at?(n(),l("span",is,r(o.expires_at),1)):g("",!0)]),s("td",ds,[o.cooldown_seconds>0?(n(),l("span",{key:0,class:h(te(o))},r(pe(o.cooldown_seconds))+" · "+r(o.cooldown_reason),3)):(n(),l("span",{key:1,class:h(te(o))},r(o.cooldown_reason||"无冷却"),3))]),s("td",us,r(o.error_count),1),s("td",cs,r(o.conversation_count),1),s("td",ps,[s("div",xs,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>fe(o.id),["stop"])}," 编辑 ",8,ms),de(o)?(n(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>ge(o.id),["stop"])}," 启用 ",8,fs)):(n(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>ye(o.id),["stop"])}," 禁用 ",8,vs)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:A(i=>_e(o.id),["stop"])}," 删除 ",8,bs)])])],10,rs))),128))])])]))])]),R(Ze,{open:$(f).open.value,title:$(f).title.value,message:$(f).message.value,"confirm-text":$(f).confirmText.value,"cancel-text":$(f).cancelText.value,onConfirm:$(f).confirm,onCancel:$(f).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(n(),Ce(Ae,{to:"body"},[O.value?(n(),l("div",gs,[s("div",ys,[s("div",{class:"flex items-center justify-between"},[e[37]||(e[37]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:oe}," 关闭 ")]),a.value?(n(),l("div",_s,r(a.value),1)):g("",!0),s("div",hs,[e[38]||(e[38]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),C(s("input",{"onUpdate:modelValue":e[11]||(e[11]=o=>p.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[V,p.value.id]]),e[39]||(e[39]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),C(s("textarea",{"onUpdate:modelValue":e[12]||(e[12]=o=>p.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[V,p.value.secure_c_ses]]),e[40]||(e[40]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),C(s("input",{"onUpdate:modelValue":e[13]||(e[13]=o=>p.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,p.value.csesidx]]),e[41]||(e[41]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),C(s("input",{"onUpdate:modelValue":e[14]||(e[14]=o=>p.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,p.value.config_id]]),e[42]||(e[42]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),C(s("input",{"onUpdate:modelValue":e[15]||(e[15]=o=>p.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,p.value.host_c_oses]]),e[43]||(e[43]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),C(s("input",{"onUpdate:modelValue":e[16]||(e[16]=o=>p.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[V,p.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:oe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:ze}," 保存 ")])])])):g("",!0)])),(n(),Ce(Ae,{to:"body"},[S.value?(n(),l("div",ws,[s("div",ks,[s("div",Cs,[e[44]||(e[44]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",Vs,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Re},r(D.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:se}," 关闭 ")])]),T.value?(n(),l("div",$s,r(T.value),1)):g("",!0),s("div",As,[C(s("textarea",{"onUpdate:modelValue":e[17]||(e[17]=o=>z.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:D.value},null,8,Ss),[[V,z.value]])]),s("div",Ts,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:se}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:je,disabled:D.value}," 保存 ",8,Ds)])])])):g("",!0)]))],64))}});export{Ns as default};
static/assets/Accounts-CgsggPDB.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ import{g as E,D as os,h as i,d as rs,E as ls,i as J,o as ns,A as as,j as is,c as n,a as s,p as G,m as Re,q as R,v as V,s as $t,t as a,n as x,u as j,b as g,f as ee,F as ge,r as Ve,x as je,G as ds,w as M,e as l,H as us}from"./index-BRM37S6x.js";import{_ as cs}from"./SelectMenu.vue_vue_type_script_setup_true_lang-CeWkosco.js";import{_ as be}from"./Checkbox.vue_vue_type_script_setup_true_lang-BBcv-AYv.js";import{_ as fs}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-C9Wgr_sd.js";import{u as vs}from"./useConfirmDialog-BaiXrQSU.js";import{_ as ms}from"./HelpTip.vue_vue_type_script_setup_true_lang-DJyeZS9P.js";const w={list:()=>E.get("/admin/accounts"),getConfig:()=>E.get("/admin/accounts-config"),updateConfig:y=>E.put("/admin/accounts-config",y),delete:y=>E.delete(`/admin/accounts/${y}`),disable:y=>E.put(`/admin/accounts/${y}/disable`),enable:y=>E.put(`/admin/accounts/${y}/enable`),startRegister:(y,k)=>E.post("/admin/register/start",{count:y,domain:k}),getRegisterTask:y=>E.get(`/admin/register/task/${y}`),getRegisterCurrent:()=>E.get("/admin/register/current"),startLogin:y=>E.post("/admin/login/start",y),getLoginTask:y=>E.get(`/admin/login/task/${y}`),getLoginCurrent:()=>E.get("/admin/login/current"),checkLogin:()=>E.post("/admin/login/check")},xs=os("accounts",()=>{const y=i([]),k=i(!1);async function A(){k.value=!0;try{const p=await w.list();y.value=Array.isArray(p)?p:p.accounts||[]}finally{k.value=!1}}async function ne(p){await w.delete(p),await A()}async function T(p){await w.disable(p),await A()}async function d(p){await w.enable(p),await A()}async function ae(p){await Promise.all(p.map($=>w.enable($))),await A()}async function te(p){await Promise.all(p.map($=>w.disable($))),await A()}async function b(p){await Promise.all(p.map($=>w.delete($))),await A()}async function Y(p){await w.updateConfig(p),await A()}return{accounts:y,isLoading:k,loadAccounts:A,deleteAccount:ne,disableAccount:T,enableAccount:d,bulkEnable:ae,bulkDisable:te,bulkDelete:b,updateConfig:Y}}),ps={class:"space-y-8"},gs={class:"rounded-3xl border border-border bg-card p-6"},bs={class:"flex flex-wrap items-center justify-between gap-4"},ys={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},_s={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},hs={class:"ml-auto flex items-center gap-2 sm:ml-0"},ws={class:"mt-4 flex flex-wrap items-center gap-2"},ks=["disabled"],Cs=["disabled"],Ts={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},Ss=["disabled"],$s=["disabled"],Is=["disabled"],Es=["disabled"],Ls=["disabled"],As={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},Rs=["onClick"],Vs={class:"flex items-start justify-between gap-3"},js={class:"mt-1 font-mono text-xs text-foreground"},Ms={class:"flex items-center gap-2"},Ds={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},Os={key:0,class:"mt-1 text-[11px]"},Bs={key:0},Ns={key:1},Us={class:"mt-1 text-sm font-semibold text-foreground"},zs={class:"mt-1 text-sm font-semibold text-foreground"},Ps={class:"mt-4 flex flex-wrap items-center gap-2"},Fs=["onClick"],Hs=["onClick"],Ks=["onClick"],Js=["onClick"],Gs={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Ys={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},qs={class:"min-w-full text-left text-sm"},Qs={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Xs={class:"py-3 pr-4"},Ws={class:"py-3 pr-6"},Zs={class:"inline-flex items-center gap-2"},eo={class:"text-sm text-foreground"},to={key:0},so=["onClick"],oo={class:"py-4 pr-6 font-mono text-xs text-foreground"},ro={class:"py-4 pr-6"},lo={class:"py-4 pr-6"},no={key:0,class:"block text-[11px] text-muted-foreground"},ao={class:"py-4 pr-6 text-xs"},io={class:"py-4 pr-6 text-xs text-muted-foreground"},uo={class:"py-4 pr-6 text-xs text-muted-foreground"},co={class:"py-4 text-right"},fo={class:"flex flex-wrap justify-end gap-2"},vo=["onClick"],mo=["onClick"],xo=["onClick"],po=["onClick"],go={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},bo={class:"flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},yo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},_o={class:"mt-1 text-xs text-muted-foreground"},ho={class:"scrollbar-slim flex-1 overflow-y-auto px-6 py-4"},wo={class:"space-y-4 text-sm"},ko={class:"flex rounded-full border border-border bg-muted/30 p-1 text-xs"},Co={key:0,class:"space-y-4"},To={key:1,class:"space-y-4"},So={key:0,class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-600"},$o={class:"border-t border-border/60 px-6 py-4"},Io={class:"flex items-center justify-end gap-2"},Eo=["disabled"],Lo=["disabled"],Ao={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Ro={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},Vo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},jo={class:"flex items-center gap-2"},Mo=["disabled"],Do={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},Oo={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},Bo={key:1,class:"grid gap-3 text-xs text-muted-foreground"},No={key:0,class:"space-y-1"},Uo={class:"flex items-center gap-2 font-medium text-foreground"},zo={class:"flex flex-wrap gap-x-4 gap-y-1"},Po={key:1,class:"space-y-1"},Fo={class:"flex items-center gap-2 font-medium text-foreground"},Ho={class:"flex flex-wrap gap-x-4 gap-y-1"},Ko={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},Jo={key:0,class:"space-y-2"},Go={class:"space-y-1 text-[11px] text-muted-foreground"},Yo={key:1,class:"mt-4 space-y-2"},qo={class:"space-y-1 text-[11px] text-muted-foreground"},Qo={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},Xo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Wo={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Zo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},er={class:"mt-4 space-y-3 text-sm"},tr={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},sr={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},or={class:"flex items-center justify-between"},rr={class:"flex items-center gap-2"},lr={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},nr={class:"mt-4"},ar=["readonly"],ir={class:"mt-6 flex items-center justify-end gap-2"},dr=["disabled"],Je="accounts-register-task-cache",Ge="accounts-login-task-cache",Ye="accounts-register-log-clear",qe="accounts-login-log-clear",Qe="accounts-register-task-cleared-id",Xe="accounts-login-task-cleared-id",It="1970-01-01 00:00:00",pr=rs({__name:"Accounts",setup(y){const k=xs(),{accounts:A,isLoading:ne}=ls(k),T=vs(),d=ds(),ae=i(""),te=i("all"),b=i(new Set),Y=i("table"),p=i(!1),$=i(""),Me=i(!1),D=i(""),se=i(""),N=i(!1),ie=i([]),de=i(1),ye=i(!1),U=i("register"),ue=i(""),z=i(""),_e=i(!1),q=i(!1),P=i(!1),De=i(null),he=i(null),we=i(null),F=i(null),H=i(null),oe=i(0),re=i(0),ce=i(!1),c=i(null),f=i(null),We=i(null),O=i(!1),S=i(!1),_=i(""),h=i({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),ke=i(null),Ze=i([]),Et=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],K=J(()=>{const t=ae.value.trim().toLowerCase();return A.value.filter(e=>{const o=!t||e.id.toLowerCase().includes(t),r=te.value==="all"||ve(e)===te.value;return o&&r})}),B=J(()=>b.value.size),Oe=J(()=>K.value.length>0&&K.value.every(t=>b.value.has(t.id))),fe=async()=>{await k.loadAccounts(),b.value=new Set,P.value=!1},et=t=>{try{const e=localStorage.getItem(t);return e?JSON.parse(e):null}catch{return null}},tt=t=>{try{return localStorage.getItem(t)||null}catch{return null}},Ce=(t,e)=>{try{if(e){localStorage.setItem(t,e);return}localStorage.removeItem(t)}catch{}},st=(t,e)=>{try{localStorage.setItem(t,JSON.stringify(e))}catch{}},ot=t=>{try{localStorage.removeItem(t)}catch{}},rt=t=>{const e=localStorage.getItem(t),o=Number(e);return Number.isFinite(o)?o:0},Te=(t,e)=>{try{localStorage.setItem(t,String(e))}catch{}},Be=(t,e=!0)=>{t&&(t.id&&t.id===F.value||(t.id&&F.value&&t.id!==F.value&&(F.value=null,Ce(Qe,null)),c.value=t,t.id&&t.id!==he.value&&(he.value=t.id,oe.value=0,Te(Ye,0)),e&&st(Je,t)))},Se=(t,e=!0)=>{t&&(t.id&&t.id===H.value||(t.id&&H.value&&t.id!==H.value&&(H.value=null,Ce(Xe,null)),f.value=t,t.id&&t.id!==we.value&&(we.value=t.id,re.value=0,Te(qe,0)),e&&st(Ge,t)))},Lt=()=>{oe.value=rt(Ye),re.value=rt(qe),F.value=tt(Qe),H.value=tt(Xe);const t=et(Je);t&&t.id!==F.value&&(c.value=t,he.value=t.id||null);const e=et(Ge);e&&e.id!==H.value&&(f.value=e,we.value=e.id||null)},At=()=>{ye.value=!0,U.value="register",ue.value="",z.value="",_e.value=!1,ce.value=!1},Ne=()=>{ye.value=!1},Rt=t=>{const e=[],o=[];return t.split(/\r?\n/).map(u=>u.trim()).filter(Boolean).forEach((u,m)=>{const v=u.split("----").map(I=>I.trim()),C=m+1;if(v.length){if(v[0].toLowerCase()==="duckmail"){if(v.length<3||!v[1]||!v[2]){o.push(`第 ${C} 行格式错误(duckmail)`);return}const I=v[1],Ae=v.slice(2).join("----");e.push({id:I,secure_c_ses:"",csesidx:"",config_id:"",expires_at:It,mail_provider:"duckmail",mail_address:I,mail_password:Ae});return}if(v.length>=4&&v[0]&&v[2]&&v[3]){const I=v[0],Ae=v[1]||"",L=v[2],ss=v.slice(3).join("----");e.push({id:I,secure_c_ses:"",csesidx:"",config_id:"",expires_at:It,mail_provider:"microsoft",mail_address:I,mail_password:Ae,mail_client_id:L,mail_refresh_token:ss,mail_tenant:"consumers"});return}o.push(`第 ${C} 行格式错误`)}}),{items:e,errors:o}},Vt=async()=>{if(z.value="",!ue.value.trim()){z.value="请输入导��内容";return}const{items:t,errors:e}=Rt(ue.value);if(!t.length){z.value=e.length?e.join(","):"未识别到有效账号";return}if(e.length){z.value=e.slice(0,3).join(",");return}_e.value=!0;try{const r=[...await vt()],u=new Map(r.map((C,I)=>[C.id,I])),m=[];t.forEach(C=>{const I=u.get(C.id||"");if(I===void 0){r.push(C),m.push(C.id);return}const L={...r[I],mail_provider:C.mail_provider,mail_address:C.mail_address};C.mail_provider==="microsoft"?(L.mail_client_id=C.mail_client_id,L.mail_refresh_token=C.mail_refresh_token,L.mail_tenant=C.mail_tenant,L.mail_password=C.mail_password):(L.mail_password=C.mail_password,L.mail_client_id=void 0,L.mail_refresh_token=void 0,L.mail_tenant=void 0),r[I]=L,m.push(C.id)}),await k.updateConfig(r),await fe(),b.value=new Set(m),d.success(`成功导入 ${m.length} 个账户`),Ne(),await T.ask({title:"导入成功",message:`已导入 ${m.length} 个账户并自动选中。是否立即刷新这些账户以获取 Cookie?`,confirmText:"立即刷新",cancelText:"稍后手动刷新"})&&await St()}catch(o){z.value=o.message||"导入失败",d.error(o.message||"导入失败")}finally{_e.value=!1}},jt=async()=>{try{const t=[],e=c.value?.id,o=f.value?.id;if(e&&!$e(e)&&t.push(kt(e)),o&&!Ie(o)&&t.push(Ct(o)),!t.length){await Ke();return}await Promise.all(t)}catch(t){_.value=t?.message||"任务状态更新失败"}},Ue=async()=>{q.value=!0,await jt()},Mt=()=>{q.value=!1},Dt=()=>{const t=c.value?.id||null,e=f.value?.id||null;F.value=t,H.value=e,Ce(Qe,t),Ce(Xe,e),oe.value=c.value?.logs?.length||0,re.value=f.value?.logs?.length||0,Te(Ye,oe.value),Te(qe,re.value),c.value=null,f.value=null,he.value=null,we.value=null,_.value="",O.value=!1,S.value=!1,W(),Z(),ot(Je),ot(Ge)},$e=t=>!!(t&&t===F.value),Ie=t=>!!(t&&t===H.value),Ot=()=>{P.value=!P.value},le=()=>{P.value=!1},lt=t=>{if(!P.value)return;const e=t.target;De.value&&!De.value.contains(e)&&(P.value=!1)};ns(async()=>{Lt(),await fe(),await Ke(),Zt(),document.addEventListener("click",lt)});const Q=J(()=>{const t=c.value?.logs||[];return oe.value?t.slice(oe.value):t}),X=J(()=>{const t=f.value?.logs||[];return re.value?t.slice(re.value):t}),Bt=J(()=>!!_.value||!!c.value||!!f.value||Q.value.length>0||X.value.length>0),Nt=async()=>{await us();const t=We.value;t&&(t.scrollTop=t.scrollHeight)};as([Q,X,q],async()=>{q.value&&await Nt()},{deep:!0});const Ut=J(()=>{const t=c.value?.status,e=f.value?.status;return t==="running"||t==="pending"||e==="running"||e==="pending"}),zt=J(()=>{if(_.value)return"bg-rose-500";if(Ut.value)return"bg-sky-400";const t=[];if(c.value){const u=c.value.success_count??0,m=c.value.fail_count??0,v=c.value.count??u+m;t.push({success:u,fail:m,total:v,status:c.value.status})}if(f.value){const u=f.value.success_count??0,m=f.value.fail_count??0,v=f.value.account_ids?.length??u+m;t.push({success:u,fail:m,total:v,status:f.value.status})}if(!t.length)return"bg-muted-foreground";const e=t.reduce((u,m)=>u+m.success,0),o=t.reduce((u,m)=>u+m.fail,0),r=t.reduce((u,m)=>u+(m.total||0),0);if(e>0&&o>0)return"bg-amber-400";if(o>0&&e===0)return"bg-rose-500";if(e>0&&o===0)return"bg-emerald-400";if(r===0){const u=t.every(v=>v.status==="success");if(t.some(v=>v.status==="failed"))return"bg-rose-500";if(u)return"bg-emerald-400"}return"bg-muted-foreground"});is(()=>{W(),Z(),Wt(),document.removeEventListener("click",lt)});const ve=t=>t.cooldown_reason?.includes("429")&&t.cooldown_seconds>0?"429限流":t.cooldown_reason==="错误禁用"?"错误禁用":t.disabled?"手动禁用":t.status==="已过期"?"已过期":t.status==="即将过期"?"即将过期":"正常",nt=t=>{const e=ve(t);return e==="429限流"||e==="即将过期"?"bg-amber-200 text-amber-900":e==="错误禁用"||e==="已过期"?"bg-destructive/10 text-destructive":e==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},at=t=>t.cooldown_reason?.includes("429")&&t.cooldown_seconds>0?!0:t.disabled||t.cooldown_reason==="错误禁用",it=t=>t==="已过期"?"过期":t==="未设置"?"未设置":t,dt=t=>t.status==="已过期"?"text-rose-600":t.status==="即将过期"?"text-amber-700":t.status==="未设置"?"text-muted-foreground":"text-emerald-600",ut=t=>t<60?`${t} 秒`:t<3600?`${Math.ceil(t/60)} 分钟`:`${(t/3600).toFixed(1)} 小时`,ze=t=>t.cooldown_seconds>0?"text-amber-700":t.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",ct=t=>{const e=ve(t);return e==="手动禁用"||e==="已过期"?"bg-muted/70":""},Ee=t=>{const e=new Set(b.value);e.has(t)?e.delete(t):e.add(t),b.value=e},ft=()=>{if(Oe.value){b.value=new Set;return}b.value=new Set(K.value.map(t=>t.id))},Pt=(t,e)=>t.id||`account_${e+1}`,vt=async()=>(await w.getConfig()).accounts.map((e,o)=>({...e,id:Pt(e,o)})),mt=t=>`${t.time} [${t.level}] ${t.message}`,Ft=(t,e)=>{let o=-1;for(let u=0;u<t.length;u+=1)if(t[u].id===e){o=u;break}if(o===-1)return $.value="未找到对应账号配置。",!1;const r=t[o];return h.value={id:r.id,secure_c_ses:r.secure_c_ses,csesidx:r.csesidx,config_id:r.config_id,host_c_oses:r.host_c_oses,expires_at:r.expires_at},Ze.value=t,ke.value=o,p.value=!0,!0},xt=async t=>{$.value="";try{const e=await vt();Ft(e,t)}catch(e){$.value=e.message||"加载账号配置失败"}},Ht=async()=>{D.value="";try{const t=await w.getConfig();ie.value=Array.isArray(t.accounts)?t.accounts:[],se.value=JSON.stringify(gt(ie.value),null,2),N.value=!0,Me.value=!0}catch(t){D.value=t.message||"加载账号配置失败"}},Pe=()=>{Me.value=!1,D.value="",N.value=!1},pt=()=>{const t=JSON.parse(se.value);if(!Array.isArray(t))throw new Error("配置格式必须是数组。");return t},Kt=t=>typeof t!="string"||!t?t:t.length<=6?`${t.slice(0,2)}****`:`${t.slice(0,3)}****`,gt=t=>{const e=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password","mail_refresh_token","mail_client_id"]);return t.map(o=>{const r={...o};return e.forEach(u=>{const m=r[u];m&&(r[u]=Kt(m))}),r})},Jt=()=>{if(D.value="",!N.value){try{ie.value=pt()}catch(t){D.value=t.message||"JSON 格式错误";return}se.value=JSON.stringify(gt(ie.value),null,2),N.value=!0;return}se.value=JSON.stringify(ie.value,null,2),N.value=!1},Gt=async()=>{D.value="";try{const t=pt();await k.updateConfig(t),d.success("配置保存成功"),Pe()}catch(t){D.value=t.message||"保存失败",d.error(t.message||"保存失败")}},Fe=()=>{p.value=!1,$.value=""},Yt=async()=>{if(ke.value===null)return;const t=[...Ze.value];t[ke.value]={...t[ke.value],id:h.value.id,secure_c_ses:h.value.secure_c_ses,csesidx:h.value.csesidx,config_id:h.value.config_id,host_c_oses:h.value.host_c_oses||void 0,expires_at:h.value.expires_at||void 0};try{await k.updateConfig(t),d.success("账号编辑成功"),Fe()}catch(e){$.value=e.message||"保存失败",d.error(e.message||"保存失败")}},qt=async()=>{try{await k.bulkEnable(Array.from(b.value)),d.success("批量启用成功"),b.value=new Set}catch(t){d.error(t.message||"批量启用失败")}},Qt=async()=>{if(await T.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"}))try{await k.bulkDisable(Array.from(b.value)),d.success("批量禁用成功"),b.value=new Set}catch(e){d.error(e.message||"批量禁用失败")}},Xt=async()=>{if(await T.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"}))try{await k.bulkDelete(Array.from(b.value)),d.success("批量删除成功"),b.value=new Set}catch(e){d.error(e.message||"批量删除失败")}},bt=async t=>{try{await k.enableAccount(t),d.success("账号已启用")}catch(e){d.error(e.message||"启用失败")}},yt=async t=>{if(await T.ask({title:"禁用账号",message:"确定要禁用该账号吗?"}))try{await k.disableAccount(t),d.success("账号已禁用")}catch(o){d.error(o.message||"禁用失败")}},_t=async t=>{if(await T.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"}))try{await k.deleteAccount(t),d.success("账号已删除")}catch(o){d.error(o.message||"删除失败")}};let me=null,xe=null,pe=null,Le=!1;const W=()=>{me!==null&&(window.clearInterval(me),me=null)},Z=()=>{xe!==null&&(window.clearInterval(xe),xe=null)},Wt=()=>{pe!==null&&(window.clearInterval(pe),pe=null),Le=!1},ht=t=>t==="pending"?"等待中":t==="running"?"执行中":t==="success"?"成功":t==="failed"?"失败":t,wt=t=>{const e=t.status,o=t.success_count??0,r=t.fail_count??0;if(e==="running"||e==="pending")return"bg-sky-400";if(e==="success"||e==="failed"){if(o>0&&r===0)return"bg-emerald-400";if(r>0&&o===0)return"bg-rose-500";if(o>0&&r>0)return"bg-amber-400"}return"bg-muted-foreground"},kt=async t=>{if($e(t)){W();return}const e=await w.getRegisterTask(t);if($e(e.id)){W();return}if(Be(e),e.status!=="running"&&e.status!=="pending"){O.value=!1,W(),await fe();const o=e.success_count||0,r=e.fail_count||0;o>0&&r>0?d.success(`注册任务完成:成功 ${o},失败 ${r}`):o>0&&r===0?d.success(`注册任务完成:全部成功 (${o})`):r>0&&o===0?d.error(`注册任务完成:全部失败 (${r})`):d.error("注册任务失败")}},Ct=async t=>{if(Ie(t)){Z();return}const e=await w.getLoginTask(t);if(Ie(e.id)){Z();return}if(Se(e),e.status!=="running"&&e.status!=="pending"){S.value=!1,Z(),await fe();const o=e.success_count||0,r=e.fail_count||0;o>0&&r>0?d.success(`刷新任务完成:成功 ${o},失败 ${r}`):o>0&&r===0?d.success(`刷新任务完成:全部成功 (${o})`):r>0&&o===0?d.error(`刷新任务完成:全部失败 (${r})`):d.error("刷新任务失败")}},Tt=t=>{W(),me=window.setInterval(()=>{kt(t).catch(e=>{_.value=e?.message||"注册任务更新失败",W(),O.value=!1})},3e3)},He=t=>{Z(),xe=window.setInterval(()=>{Ct(t).catch(e=>{_.value=e?.message||"刷新任务更新失败",Z(),S.value=!1})},3e3)},Zt=()=>{pe===null&&(pe=window.setInterval(async()=>{if(!Le&&!q.value&&!(me!==null||xe!==null)&&!(!O.value&&!S.value&&!c.value&&!f.value)){Le=!0;try{await Ke()}catch(t){_.value=t?.message||"后台刷新失败"}finally{Le=!1}}},6e3))},Ke=async()=>{try{const t=await w.getRegisterCurrent();t&&"id"in t&&!$e(t.id)&&(Be(t),(t.status==="running"||t.status==="pending")&&(O.value=!0,Tt(t.id)))}catch(t){_.value=t.message||"加载注册任务失败"}try{const t=await w.getLoginCurrent();t&&"id"in t&&!Ie(t.id)&&(Se(t),(t.status==="running"||t.status==="pending")&&(S.value=!0,He(t.id)))}catch(t){_.value=t.message||"加载刷新任务失败"}},es=async()=>{_.value="",O.value=!0;try{const t=Number.isFinite(de.value)&&de.value>0?de.value:void 0,e=await w.startRegister(t);Be(e),Tt(e.id),ye.value=!1,q.value=!0}catch(t){_.value=t.message||"启动注册失败",O.value=!1}},St=async()=>{if(b.value.size){_.value="",S.value=!0;try{const t=await w.startLogin(Array.from(b.value));Se(t),He(t.id),Ue()}catch(t){_.value=t.message||"启动刷新失败",S.value=!1}}},ts=async()=>{_.value="",S.value=!0;try{await w.checkLogin();const t=await w.getLoginCurrent();if(t&&"id"in t){Se(t),He(t.id),Ue();return}S.value=!1}catch(t){_.value=t.message||"触发刷新失败",S.value=!1}};return(t,e)=>(l(),n(ge,null,[s("div",ps,[s("section",gs,[s("div",bs,[s("div",ys,[R(s("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>ae.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[V,ae.value]]),G(cs,{modelValue:te.value,"onUpdate:modelValue":e[1]||(e[1]=o=>te.value=o),options:Et},null,8,["modelValue"])]),s("div",_s,[G(be,{modelValue:Oe.value,"onUpdate:modelValue":ft},{default:$t(()=>[...e[27]||(e[27]=[ee(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+a(B.value)+" / "+a(K.value.length)+" 个账号",1),s("div",hs,[s("button",{type:"button",class:x(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",Y.value==="table"?"bg-accent text-accent-foreground":""]),onClick:e[2]||(e[2]=o=>Y.value="table"),"aria-label":"列表视图"},[...e[28]||(e[28]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:x(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",Y.value==="card"?"bg-accent text-accent-foreground":""]),onClick:e[3]||(e[3]=o=>Y.value="card"),"aria-label":"卡片视图"},[...e[29]||(e[29]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",ws,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:j(ne),onClick:fe}," 刷新列表 ",8,ks),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ht}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:O.value,onClick:At}," 添加账户 ",8,Cs),s("div",{ref_key:"moreActionsRef",ref:De,class:"relative"},[s("button",{class:x(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",P.value?"bg-accent text-accent-foreground":""]),onClick:Ot},[e[30]||(e[30]=ee(" 更多操作 ",-1)),e[31]||(e[31]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),Bt.value?(l(),n("span",{key:0,class:x(["ml-1 h-2 w-2 rounded-full",zt.value]),"aria-hidden":"true"},null,2)):g("",!0)],2),P.value?(l(),n("div",Ts,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:e[4]||(e[4]=o=>{Ue(),le()})}," 任务状态 "),e[32]||(e[32]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:x(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",S.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:S.value,onClick:e[5]||(e[5]=o=>{ts(),le()})}," 刷新过期 ",10,Ss),s("button",{type:"button",class:x(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!B.value||S.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!B.value||S.value,onClick:e[6]||(e[6]=o=>{St(),le()})}," 刷新选中 ",10,$s),e[33]||(e[33]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:x(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[7]||(e[7]=o=>{qt(),le()})}," 批量启用 ",10,Is),s("button",{type:"button",class:x(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[8]||(e[8]=o=>{Qt(),le()})}," 批量禁用 ",10,Es),s("button",{type:"button",class:x(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[9]||(e[9]=o=>{Xt(),le()})}," 批量删除 ",10,Ls)])):g("",!0)],512)]),Y.value==="card"?(l(),n("div",As,[(l(!0),n(ge,null,Ve(K.value,o=>(l(),n("div",{key:o.id,class:x(["rounded-2xl border border-border bg-card p-4",ct(o)]),onClick:r=>Ee(o.id)},[s("div",Vs,[s("div",null,[e[34]||(e[34]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",js,a(o.id),1)]),s("div",Ms,[G(be,{modelValue:b.value.has(o.id),"onUpdate:modelValue":r=>Ee(o.id),onClick:e[10]||(e[10]=M(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:x(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",nt(o)])},a(ve(o)),3)])]),s("div",Ds,[s("div",null,[e[35]||(e[35]=s("p",null,"剩余时间",-1)),s("p",{class:x(["mt-1 text-sm font-semibold",dt(o)])},a(it(o.remaining_display)),3),o.expires_at?(l(),n("p",Os,a(o.expires_at),1)):g("",!0)]),s("div",null,[e[36]||(e[36]=s("p",null,"冷却",-1)),s("p",{class:x(["mt-1",ze(o)])},[o.cooldown_seconds>0?(l(),n("span",Bs,a(ut(o.cooldown_seconds))+" · "+a(o.cooldown_reason),1)):(l(),n("span",Ns,a(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[e[37]||(e[37]=s("p",null,"失败数",-1)),s("p",Us,a(o.error_count),1)]),s("div",null,[e[38]||(e[38]=s("p",null,"会话数",-1)),s("p",zs,a(o.conversation_count),1)])]),s("div",Ps,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>xt(o.id),["stop"])}," 编辑 ",8,Fs),at(o)?(l(),n("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[11]||(e[11]=M(()=>{},["stop"])),r=>bt(o.id)]}," 启用 ",8,Hs)):(l(),n("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[12]||(e[12]=M(()=>{},["stop"])),r=>yt(o.id)]}," 禁用 ",8,Ks)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[e[13]||(e[13]=M(()=>{},["stop"])),r=>_t(o.id)]}," 删除 ",8,Js)])],10,Rs))),128)),!K.value.length&&!j(ne)?(l(),n("div",Gs," 暂无账号数据,请检查后台配置。 ")):g("",!0)])):(l(),n("div",Ys,[s("table",qs,[s("thead",Qs,[s("tr",null,[s("th",Xs,[G(be,{modelValue:Oe.value,"onUpdate:modelValue":ft},null,8,["modelValue"])]),e[40]||(e[40]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),e[41]||(e[41]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",Ws,[s("span",Zs,[e[39]||(e[39]=ee(" 剩余/过期 ",-1)),G(ms,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),e[42]||(e[42]=s("th",{class:"py-3 pr-6"},"冷却",-1)),e[43]||(e[43]=s("th",{class:"py-3 pr-6"},"失败数",-1)),e[44]||(e[44]=s("th",{class:"py-3 pr-6"},"会话数",-1)),e[45]||(e[45]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",eo,[!K.value.length&&!j(ne)?(l(),n("tr",to,[...e[46]||(e[46]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):g("",!0),(l(!0),n(ge,null,Ve(K.value,o=>(l(),n("tr",{key:o.id,class:x(["border-t border-border",ct(o)]),onClick:r=>Ee(o.id)},[s("td",{class:"py-4 pr-4",onClick:e[14]||(e[14]=M(()=>{},["stop"]))},[G(be,{modelValue:b.value.has(o.id),"onUpdate:modelValue":r=>Ee(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",oo,a(o.id),1),s("td",ro,[s("span",{class:x(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",nt(o)])},a(ve(o)),3)]),s("td",lo,[s("div",{class:x(["text-sm font-semibold",dt(o)])},a(it(o.remaining_display)),3),o.expires_at?(l(),n("span",no,a(o.expires_at),1)):g("",!0)]),s("td",ao,[o.cooldown_seconds>0?(l(),n("span",{key:0,class:x(ze(o))},a(ut(o.cooldown_seconds))+" · "+a(o.cooldown_reason),3)):(l(),n("span",{key:1,class:x(ze(o))},a(o.cooldown_reason||"无冷却"),3))]),s("td",io,a(o.error_count),1),s("td",uo,a(o.conversation_count),1),s("td",co,[s("div",fo,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>xt(o.id),["stop"])}," 编辑 ",8,vo),at(o)?(l(),n("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>bt(o.id),["stop"])}," 启用 ",8,mo)):(l(),n("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>yt(o.id),["stop"])}," 禁用 ",8,xo)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:M(r=>_t(o.id),["stop"])}," 删除 ",8,po)])])],10,so))),128))])])]))])]),G(fs,{open:j(T).open.value,title:j(T).title.value,message:j(T).message.value,"confirm-text":j(T).confirmText.value,"cancel-text":j(T).cancelText.value,onConfirm:j(T).confirm,onCancel:j(T).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(l(),Re(je,{to:"body"},[ye.value?(l(),n("div",go,[s("div",bo,[s("div",yo,[s("div",null,[e[47]||(e[47]=s("p",{class:"text-sm font-medium text-foreground"},"添加账户",-1)),s("p",_o,a(U.value==="register"?"创建 DuckMail 账号并自动注册":"批量导入账户配置"),1)]),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Ne}," 关闭 ")]),s("div",ho,[s("div",wo,[s("div",ko,[s("button",{type:"button",class:x(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",U.value==="register"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:e[15]||(e[15]=o=>U.value="register")}," 自动注册 ",2),s("button",{type:"button",class:x(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",U.value==="import"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:e[16]||(e[16]=o=>U.value="import")}," 批量导入 ",2)]),U.value==="register"?(l(),n("div",Co,[e[48]||(e[48]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),R(s("input",{"onUpdate:modelValue":e[17]||(e[17]=o=>de.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,de.value,void 0,{number:!0}]]),e[49]||(e[49]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"}," 默认域名(可在配置面板修改,推荐使用) ",-1))])):(l(),n("div",To,[e[50]||(e[50]=s("label",{class:"block text-xs text-muted-foreground"},"批量导入(每行一个)",-1)),R(s("textarea",{"onUpdate:modelValue":e[18]||(e[18]=o=>ue.value=o),class:"min-h-[140px] w-full rounded-2xl border border-input bg-background px-3 py-2 text-xs font-mono",placeholder:`duckmail----you@example.com----password
2
+ user@outlook.com----loginPassword----clientId----refreshToken`},null,512),[[V,ue.value]]),e[51]||(e[51]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"支持两种格式:"),s("p",{class:"mt-1 font-mono"},"duckmail----email----password"),s("p",{class:"mt-1 font-mono"},"email----password----clientId----refreshToken"),s("p",{class:"mt-2 text-[11px]"},'导入后请执行一次"刷新选中"以获取 Cookie。')],-1)),z.value?(l(),n("div",So,a(z.value),1)):g("",!0)])),e[53]||(e[53]=s("div",{class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-[11px] leading-relaxed"},[s("p",{class:"text-xs font-bold text-rose-600"},"⚠️ 严禁滥用:禁止将本工具用于商业用途或任何形式的滥用(无论规模大小)"),s("p",{class:"mt-1 text-muted-foreground"},[ee("详细声明请查看项目 "),s("a",{href:"https://github.com/Dreamy-rain/gemini-business2api/blob/main/docs/DISCLAIMER.md",target:"_blank",class:"text-primary hover:underline font-medium"},"DISCLAIMER.md")])],-1)),G(be,{modelValue:ce.value,"onUpdate:modelValue":e[19]||(e[19]=o=>ce.value=o)},{default:$t(()=>[...e[52]||(e[52]=[ee(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])])]),s("div",$o,[s("div",Io,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ne}," 取消 "),U.value==="register"?(l(),n("button",{key:0,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",disabled:O.value||!ce.value,onClick:es}," 开始注册 ",8,Eo)):(l(),n("button",{key:1,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",disabled:_e.value||!ce.value,onClick:Vt}," 导入并保存 ",8,Lo))])])])])):g("",!0)])),(l(),Re(je,{to:"body"},[q.value?(l(),n("div",Ao,[s("div",Ro,[s("div",Vo,[e[54]||(e[54]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",jo,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:!Q.value.length&&!X.value.length&&!c.value&&!f.value&&!_.value,onClick:Dt}," 清空日志 ",8,Mo),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Mt}," 关�� ")])]),s("div",Do,[_.value?(l(),n("div",Oo,a(_.value),1)):g("",!0),c.value||f.value?(l(),n("div",Bo,[c.value?(l(),n("div",No,[s("div",Uo,[s("span",{class:x(["h-2.5 w-2.5 rounded-full",wt(c.value)]),"aria-hidden":"true"},null,2),e[55]||(e[55]=ee(" 注册任务 ",-1))]),s("div",zo,[s("span",null,"状态:"+a(ht(c.value.status)),1),s("span",null,"进度:"+a(c.value.progress)+"/"+a(c.value.count),1),s("span",null,"成功:"+a(c.value.success_count),1),s("span",null,"失败:"+a(c.value.fail_count),1)])])):g("",!0),f.value?(l(),n("div",Po,[s("div",Fo,[s("span",{class:x(["h-2.5 w-2.5 rounded-full",wt(f.value)]),"aria-hidden":"true"},null,2),e[56]||(e[56]=ee(" 刷新任务 ",-1))]),s("div",Ho,[s("span",null,"状态:"+a(ht(f.value.status)),1),s("span",null,"进度:"+a(f.value.progress)+"/"+a(f.value.account_ids.length),1),s("span",null,"成功:"+a(f.value.success_count),1),s("span",null,"失败:"+a(f.value.fail_count),1)])])):g("",!0)])):g("",!0),Q.value.length||X.value.length?(l(),n("div",Ko,[s("div",{ref_key:"taskLogsRef",ref:We,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[Q.value.length?(l(),n("div",Jo,[e[57]||(e[57]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",Go,[(l(!0),n(ge,null,Ve(Q.value,(o,r)=>(l(),n("div",{key:`reg-${r}`,class:"font-mono"},a(mt(o)),1))),128))])])):g("",!0),X.value.length?(l(),n("div",Yo,[e[58]||(e[58]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",qo,[(l(!0),n(ge,null,Ve(X.value,(o,r)=>(l(),n("div",{key:`login-${r}`,class:"font-mono"},a(mt(o)),1))),128))])])):g("",!0)],512)])):g("",!0),!_.value&&!c.value&&!f.value&&!Q.value.length&&!X.value.length?(l(),n("div",Qo," 暂无任务 ")):g("",!0)])])])):g("",!0)])),(l(),Re(je,{to:"body"},[p.value?(l(),n("div",Xo,[s("div",Wo,[s("div",{class:"flex items-center justify-between"},[e[59]||(e[59]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Fe}," 关闭 ")]),$.value?(l(),n("div",Zo,a($.value),1)):g("",!0),s("div",er,[e[60]||(e[60]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),R(s("input",{"onUpdate:modelValue":e[20]||(e[20]=o=>h.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[V,h.value.id]]),e[61]||(e[61]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),R(s("textarea",{"onUpdate:modelValue":e[21]||(e[21]=o=>h.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[V,h.value.secure_c_ses]]),e[62]||(e[62]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),R(s("input",{"onUpdate:modelValue":e[22]||(e[22]=o=>h.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.csesidx]]),e[63]||(e[63]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),R(s("input",{"onUpdate:modelValue":e[23]||(e[23]=o=>h.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.config_id]]),e[64]||(e[64]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),R(s("input",{"onUpdate:modelValue":e[24]||(e[24]=o=>h.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.host_c_oses]]),e[65]||(e[65]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),R(s("input",{"onUpdate:modelValue":e[25]||(e[25]=o=>h.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[V,h.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Fe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Yt}," 保存 ")])])])):g("",!0)])),(l(),Re(je,{to:"body"},[Me.value?(l(),n("div",tr,[s("div",sr,[s("div",or,[e[66]||(e[66]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",rr,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Jt},a(N.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Pe}," 关闭 ")])]),D.value?(l(),n("div",lr,a(D.value),1)):g("",!0),s("div",nr,[R(s("textarea",{"onUpdate:modelValue":e[26]||(e[26]=o=>se.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:N.value},null,8,ar),[[V,se.value]])]),s("div",ir,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",onClick:Gt,disabled:N.value}," 保存 ",8,dr)])])])):g("",!0)]))],64))}});export{pr as default};
static/assets/Accounts-Cujd5Q6N.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{g as C,C as Ft,h as a,d as Kt,D as Ht,i as N,o as Jt,s as Gt,j as Yt,c as l,a as s,x as U,y as Ce,m as V,v as I,A as xt,t as n,n as b,u as S,b as v,f as z,F as ue,r as Te,T as Se,w as A,e as r,E as Qt}from"./index-4tSmcUDY.js";import{_ as qt}from"./SelectMenu.vue_vue_type_script_setup_true_lang-DsnNWmZF.js";import{_ as de}from"./Checkbox.vue_vue_type_script_setup_true_lang-B2pvqq8a.js";import{_ as Wt}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-TmgBmCy7.js";import{u as Xt}from"./useConfirmDialog-DC2-Wjcf.js";import{_ as Zt}from"./HelpTip.vue_vue_type_script_setup_true_lang-BNcd5Xum.js";const y={list:()=>C.get("/admin/accounts"),getConfig:()=>C.get("/admin/accounts-config"),updateConfig:x=>C.put("/admin/accounts-config",x),delete:x=>C.delete(`/admin/accounts/${x}`),disable:x=>C.put(`/admin/accounts/${x}/disable`),enable:x=>C.put(`/admin/accounts/${x}/enable`),startRegister:(x,_)=>C.post("/admin/register/start",{count:x,domain:_}),getRegisterTask:x=>C.get(`/admin/register/task/${x}`),getRegisterCurrent:()=>C.get("/admin/register/current"),startLogin:x=>C.post("/admin/login/start",x),getLoginTask:x=>C.get(`/admin/login/task/${x}`),getLoginCurrent:()=>C.get("/admin/login/current"),checkLogin:()=>C.post("/admin/login/check")},es=Ft("accounts",()=>{const x=a([]),_=a(!1);async function T(){_.value=!0;try{const u=await y.list();x.value=Array.isArray(u)?u:u.accounts||[]}finally{_.value=!1}}async function ee(u){await y.delete(u),await T()}async function h(u){await y.disable(u),await T()}async function te(u){await y.enable(u),await T()}async function Q(u){await Promise.all(u.map(L=>y.enable(L))),await T()}async function g(u){await Promise.all(u.map(L=>y.disable(L))),await T()}async function P(u){await Promise.all(u.map(L=>y.delete(L))),await T()}async function se(u){await y.updateConfig(u),await T()}return{accounts:x,isLoading:_,loadAccounts:T,deleteAccount:ee,disableAccount:h,enableAccount:te,bulkEnable:Q,bulkDisable:g,bulkDelete:P,updateConfig:se}}),ts={class:"space-y-8"},ss={class:"rounded-3xl border border-border bg-card p-6"},os={class:"flex flex-wrap items-center justify-between gap-4"},rs={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},ls={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},ns={class:"ml-auto flex items-center gap-2 sm:ml-0"},as={class:"mt-4 flex flex-wrap items-center gap-2"},is=["disabled"],us=["disabled"],ds={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},cs=["disabled"],fs=["disabled"],vs=["disabled"],xs=["disabled"],gs=["disabled"],ps={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},ms=["onClick"],bs={class:"flex items-start justify-between gap-3"},ys={class:"mt-1 font-mono text-xs text-foreground"},_s={class:"flex items-center gap-2"},ws={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},ks={key:0,class:"mt-1 text-[11px]"},hs={key:0},Cs={key:1},Ts={class:"mt-1 text-sm font-semibold text-foreground"},Ss={class:"mt-1 text-sm font-semibold text-foreground"},As={class:"mt-4 flex flex-wrap items-center gap-2"},Ls=["onClick"],Es=["onClick"],$s=["onClick"],Rs=["onClick"],Vs={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Is={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},js={class:"min-w-full text-left text-sm"},Ds={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Ms={class:"py-3 pr-4"},Os={class:"py-3 pr-6"},Bs={class:"inline-flex items-center gap-2"},Ns={class:"text-sm text-foreground"},Us={key:0},zs=["onClick"],Ps={class:"py-4 pr-6 font-mono text-xs text-foreground"},Fs={class:"py-4 pr-6"},Ks={class:"py-4 pr-6"},Hs={key:0,class:"block text-[11px] text-muted-foreground"},Js={class:"py-4 pr-6 text-xs"},Gs={class:"py-4 pr-6 text-xs text-muted-foreground"},Ys={class:"py-4 pr-6 text-xs text-muted-foreground"},Qs={class:"py-4 text-right"},qs={class:"flex flex-wrap justify-end gap-2"},Ws=["onClick"],Xs=["onClick"],Zs=["onClick"],eo=["onClick"],to={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},so={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},oo={class:"mt-4 space-y-4 text-sm"},ro={class:"mt-6 flex items-center justify-end gap-2"},lo=["disabled"],no={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ao={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},io={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},uo={class:"flex items-center gap-2"},co=["disabled"],fo={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},vo={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},xo={key:1,class:"grid gap-3 text-xs text-muted-foreground"},go={key:0,class:"space-y-1"},po={class:"flex flex-wrap gap-x-4 gap-y-1"},mo={key:1,class:"space-y-1"},bo={class:"flex flex-wrap gap-x-4 gap-y-1"},yo={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},_o={key:0,class:"space-y-2"},wo={class:"space-y-1 text-[11px] text-muted-foreground"},ko={key:1,class:"mt-4 space-y-2"},ho={class:"space-y-1 text-[11px] text-muted-foreground"},Co={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},To={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},So={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Ao={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},Lo={class:"mt-4 space-y-3 text-sm"},Eo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},$o={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},Ro={class:"flex items-center justify-between"},Vo={class:"flex items-center gap-2"},Io={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},jo={class:"mt-4"},Do=["readonly"],Mo={class:"mt-6 flex items-center justify-end gap-2"},Oo=["disabled"],De="accounts-register-task-cache",Me="accounts-login-task-cache",Oe="accounts-register-log-clear",Be="accounts-login-log-clear",Ne="accounts-register-task-cleared-id",Ue="accounts-login-task-cleared-id",Ko=Kt({__name:"Accounts",setup(x){const _=es(),{accounts:T,isLoading:ee}=Ht(_),h=Xt(),te=a(""),Q=a("all"),g=a(new Set),P=a("table"),se=a(!1),u=a(""),L=a(!1),E=a(""),q=a(""),j=a(!1),oe=a([]),re=a(1),ce=a(!1),F=a(!1),D=a(!1),Ae=a(null),fe=a(null),ve=a(null),M=a(null),O=a(null),W=a(0),X=a(0),xe=a(!1),d=a(null),c=a(null),ze=a(null),$=a(!1),k=a(!1),p=a(""),m=a({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),ge=a(null),Pe=a([]),gt=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],B=N(()=>{const e=te.value.trim().toLowerCase();return T.value.filter(t=>{const o=!e||t.id.toLowerCase().includes(e),i=Q.value==="all"||le(t)===Q.value;return o&&i})}),R=N(()=>g.value.size),Le=N(()=>B.value.length>0&&B.value.every(e=>g.value.has(e.id))),pe=async()=>{await _.loadAccounts(),g.value=new Set,D.value=!1},Fe=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},Ke=e=>{try{return localStorage.getItem(e)||null}catch{return null}},me=(e,t)=>{try{if(t){localStorage.setItem(e,t);return}localStorage.removeItem(e)}catch{}},He=(e,t)=>{try{localStorage.setItem(e,JSON.stringify(t))}catch{}},Je=e=>{try{localStorage.removeItem(e)}catch{}},Ge=e=>{const t=localStorage.getItem(e),o=Number(t);return Number.isFinite(o)?o:0},be=(e,t)=>{try{localStorage.setItem(e,String(t))}catch{}},Ee=(e,t=!0)=>{e&&(e.id&&e.id===M.value||(e.id&&M.value&&e.id!==M.value&&(M.value=null,me(Ne,null)),d.value=e,e.id&&e.id!==fe.value&&(fe.value=e.id,W.value=0,be(Oe,0)),t&&He(De,e)))},ye=(e,t=!0)=>{e&&(e.id&&e.id===O.value||(e.id&&O.value&&e.id!==O.value&&(O.value=null,me(Ue,null)),c.value=e,e.id&&e.id!==ve.value&&(ve.value=e.id,X.value=0,be(Be,0)),t&&He(Me,e)))},pt=()=>{W.value=Ge(Oe),X.value=Ge(Be),M.value=Ke(Ne),O.value=Ke(Ue);const e=Fe(De);e&&e.id!==M.value&&(d.value=e,fe.value=e.id||null);const t=Fe(Me);t&&t.id!==O.value&&(c.value=t,ve.value=t.id||null)},mt=()=>{ce.value=!0,xe.value=!1},Ye=()=>{ce.value=!1},bt=async()=>{try{const e=[],t=d.value?.id,o=c.value?.id;if(t&&!_e(t)&&e.push(ct(t)),o&&!we(o)&&e.push(ft(o)),!e.length){await je();return}await Promise.all(e)}catch(e){p.value=e?.message||"任务状态更新失败"}},yt=async()=>{F.value=!0,await bt()},_t=()=>{F.value=!1},wt=()=>{const e=d.value?.id||null,t=c.value?.id||null;M.value=e,O.value=t,me(Ne,e),me(Ue,t),W.value=d.value?.logs?.length||0,X.value=c.value?.logs?.length||0,be(Oe,W.value),be(Be,X.value),d.value=null,c.value=null,fe.value=null,ve.value=null,p.value="",$.value=!1,k.value=!1,J(),G(),Je(De),Je(Me)},_e=e=>!!(e&&e===M.value),we=e=>!!(e&&e===O.value),kt=()=>{D.value=!D.value},Z=()=>{D.value=!1},Qe=e=>{if(!D.value)return;const t=e.target;Ae.value&&!Ae.value.contains(t)&&(D.value=!1)};Jt(async()=>{pt(),await pe(),await je(),Nt(),document.addEventListener("click",Qe)});const K=N(()=>{const e=d.value?.logs||[];return W.value?e.slice(W.value):e}),H=N(()=>{const e=c.value?.logs||[];return X.value?e.slice(X.value):e}),ht=N(()=>!!p.value||!!d.value||!!c.value||K.value.length>0||H.value.length>0),Ct=async()=>{await Qt();const e=ze.value;e&&(e.scrollTop=e.scrollHeight)};Gt([K,H,F],async()=>{F.value&&await Ct()},{deep:!0});const Tt=N(()=>{const e=d.value?.status,t=c.value?.status;return e==="running"||e==="pending"||t==="running"||t==="pending"}),St=N(()=>{if(p.value)return"bg-rose-500";if(Tt.value)return"bg-sky-400";const e=[];if(d.value){const f=d.value.success_count??0,w=d.value.fail_count??0,Y=d.value.count??f+w;e.push({success:f,fail:w,total:Y,status:d.value.status})}if(c.value){const f=c.value.success_count??0,w=c.value.fail_count??0,Y=c.value.account_ids?.length??f+w;e.push({success:f,fail:w,total:Y,status:c.value.status})}if(!e.length)return"bg-muted-foreground";const t=e.reduce((f,w)=>f+w.success,0),o=e.reduce((f,w)=>f+w.fail,0),i=e.reduce((f,w)=>f+(w.total||0),0);if(t>0&&o>0)return"bg-amber-400";if(o>0&&t===0)return"bg-rose-500";if(t>0&&o===0)return"bg-emerald-400";if(i===0){const f=e.every(Y=>Y.status==="success");if(e.some(Y=>Y.status==="failed"))return"bg-rose-500";if(f)return"bg-emerald-400"}return"bg-muted-foreground"});Yt(()=>{J(),G(),Bt(),document.removeEventListener("click",Qe)});const le=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?"429限流":e.cooldown_reason==="错误禁用"?"错误禁用":e.disabled?"手动禁用":e.status==="已过期"?"已过期":e.status==="即将过期"?"即将过期":"正常",qe=e=>{const t=le(e);return t==="429限流"||t==="即将过期"?"bg-amber-200 text-amber-900":t==="错误禁用"||t==="已过期"?"bg-destructive/10 text-destructive":t==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},We=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?!0:e.disabled||e.cooldown_reason==="错误禁用",Xe=e=>e==="已过期"?"过期":e==="未设置"?"未设置":e,Ze=e=>e.status==="已过期"?"text-rose-600":e.status==="即将过期"?"text-amber-700":e.status==="未设置"?"text-muted-foreground":"text-emerald-600",et=e=>e<60?`${e} 秒`:e<3600?`${Math.ceil(e/60)} 分钟`:`${(e/3600).toFixed(1)} 小时`,$e=e=>e.cooldown_seconds>0?"text-amber-700":e.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",tt=e=>{const t=le(e);return t==="手动禁用"||t==="已过期"?"bg-muted/70":""},ke=e=>{const t=new Set(g.value);t.has(e)?t.delete(e):t.add(e),g.value=t},st=()=>{if(Le.value){g.value=new Set;return}g.value=new Set(B.value.map(e=>e.id))},At=(e,t)=>e.id||`account_${t+1}`,Lt=async()=>(await y.getConfig()).accounts.map((t,o)=>({...t,id:At(t,o)})),ot=e=>`${e.time} [${e.level}] ${e.message}`,Et=(e,t)=>{let o=-1;for(let f=0;f<e.length;f+=1)if(e[f].id===t){o=f;break}if(o===-1)return u.value="未找到对应账号配置。",!1;const i=e[o];return m.value={id:i.id,secure_c_ses:i.secure_c_ses,csesidx:i.csesidx,config_id:i.config_id,host_c_oses:i.host_c_oses,expires_at:i.expires_at},Pe.value=e,ge.value=o,se.value=!0,!0},rt=async e=>{u.value="";try{const t=await Lt();Et(t,e)}catch(t){u.value=t.message||"加载账号配置失败"}},$t=async()=>{E.value="";try{const e=await y.getConfig();oe.value=Array.isArray(e.accounts)?e.accounts:[],q.value=JSON.stringify(nt(oe.value),null,2),j.value=!0,L.value=!0}catch(e){E.value=e.message||"加载账号配置失败"}},Re=()=>{L.value=!1,E.value="",j.value=!1},lt=()=>{const e=JSON.parse(q.value);if(!Array.isArray(e))throw new Error("配置格式必须是数组。");return e},Rt=e=>typeof e!="string"||!e?e:e.length<=6?`${e.slice(0,2)}****`:`${e.slice(0,3)}****`,nt=e=>{const t=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password"]);return e.map(o=>{const i={...o};return t.forEach(f=>{const w=i[f];w&&(i[f]=Rt(w))}),i})},Vt=()=>{if(E.value="",!j.value){try{oe.value=lt()}catch(e){E.value=e.message||"JSON 格式错误";return}q.value=JSON.stringify(nt(oe.value),null,2),j.value=!0;return}q.value=JSON.stringify(oe.value,null,2),j.value=!1},It=async()=>{E.value="";try{const e=lt();await _.updateConfig(e),Re()}catch(e){E.value=e.message||"保存失败"}},Ve=()=>{se.value=!1,u.value=""},jt=async()=>{if(ge.value===null)return;const e=[...Pe.value];e[ge.value]={...e[ge.value],id:m.value.id,secure_c_ses:m.value.secure_c_ses,csesidx:m.value.csesidx,config_id:m.value.config_id,host_c_oses:m.value.host_c_oses||void 0,expires_at:m.value.expires_at||void 0};try{await _.updateConfig(e),Ve()}catch(t){u.value=t.message||"保存失败"}},Dt=async()=>{await _.bulkEnable(Array.from(g.value)),g.value=new Set},Mt=async()=>{await h.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"})&&(await _.bulkDisable(Array.from(g.value)),g.value=new Set)},Ot=async()=>{await h.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"})&&(await _.bulkDelete(Array.from(g.value)),g.value=new Set)},at=async e=>{await _.enableAccount(e)},it=async e=>{await h.ask({title:"禁用账号",message:"确定要禁用该账号吗?"})&&await _.disableAccount(e)},ut=async e=>{await h.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"})&&await _.deleteAccount(e)};let ne=null,ae=null,ie=null,he=!1;const J=()=>{ne!==null&&(window.clearInterval(ne),ne=null)},G=()=>{ae!==null&&(window.clearInterval(ae),ae=null)},Bt=()=>{ie!==null&&(window.clearInterval(ie),ie=null),he=!1},dt=e=>e==="pending"?"等待中":e==="running"?"执行中":e==="success"?"成功":e==="failed"?"失败":e,ct=async e=>{if(_e(e)){J();return}const t=await y.getRegisterTask(e);if(_e(t.id)){J();return}Ee(t),t.status!=="running"&&t.status!=="pending"&&($.value=!1,J(),await pe())},ft=async e=>{if(we(e)){G();return}const t=await y.getLoginTask(e);if(we(t.id)){G();return}ye(t),t.status!=="running"&&t.status!=="pending"&&(k.value=!1,G(),await pe())},vt=e=>{J(),ne=window.setInterval(()=>{ct(e).catch(t=>{p.value=t?.message||"注册任务更新失败",J(),$.value=!1})},3e3)},Ie=e=>{G(),ae=window.setInterval(()=>{ft(e).catch(t=>{p.value=t?.message||"刷新任务更新失败",G(),k.value=!1})},3e3)},Nt=()=>{ie===null&&(ie=window.setInterval(async()=>{if(!he&&!F.value&&!(ne!==null||ae!==null)&&!(!$.value&&!k.value&&!d.value&&!c.value)){he=!0;try{await je()}catch(e){p.value=e?.message||"后台刷新失败"}finally{he=!1}}},6e3))},je=async()=>{try{const e=await y.getRegisterCurrent();e&&"id"in e&&!_e(e.id)&&(Ee(e),(e.status==="running"||e.status==="pending")&&($.value=!0,vt(e.id)))}catch(e){p.value=e.message||"加载注册任务失败"}try{const e=await y.getLoginCurrent();e&&"id"in e&&!we(e.id)&&(ye(e),(e.status==="running"||e.status==="pending")&&(k.value=!0,Ie(e.id)))}catch(e){p.value=e.message||"加载刷新任务失败"}},Ut=async()=>{p.value="",$.value=!0;try{const e=Number.isFinite(re.value)&&re.value>0?re.value:void 0,t=await y.startRegister(e);Ee(t),vt(t.id),ce.value=!1,F.value=!0}catch(e){p.value=e.message||"启动注册失败",$.value=!1}},zt=async()=>{if(g.value.size){p.value="",k.value=!0;try{const e=await y.startLogin(Array.from(g.value));ye(e),Ie(e.id)}catch(e){p.value=e.message||"启动刷新失败",k.value=!1}}},Pt=async()=>{p.value="",k.value=!0;try{await y.checkLogin();const e=await y.getLoginCurrent();if(e&&"id"in e){ye(e),Ie(e.id);return}k.value=!1}catch(e){p.value=e.message||"触发刷新失败",k.value=!1}};return(e,t)=>(r(),l(ue,null,[s("div",ts,[s("section",ss,[s("div",os,[s("div",rs,[V(s("input",{"onUpdate:modelValue":t[0]||(t[0]=o=>te.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[I,te.value]]),U(qt,{modelValue:Q.value,"onUpdate:modelValue":t[1]||(t[1]=o=>Q.value=o),options:gt},null,8,["modelValue"])]),s("div",ls,[U(de,{modelValue:Le.value,"onUpdate:modelValue":st},{default:xt(()=>[...t[24]||(t[24]=[z(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+n(R.value)+" / "+n(B.value.length)+" 个账号",1),s("div",ns,[s("button",{type:"button",class:b(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",P.value==="table"?"bg-accent text-accent-foreground":""]),onClick:t[2]||(t[2]=o=>P.value="table"),"aria-label":"列表视图"},[...t[25]||(t[25]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:b(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",P.value==="card"?"bg-accent text-accent-foreground":""]),onClick:t[3]||(t[3]=o=>P.value="card"),"aria-label":"卡片视图"},[...t[26]||(t[26]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",as,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:S(ee),onClick:pe}," 刷新列表 ",8,is),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:$t}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:$.value,onClick:mt}," 添加账户 ",8,us),s("div",{ref_key:"moreActionsRef",ref:Ae,class:"relative"},[s("button",{class:b(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",D.value?"bg-accent text-accent-foreground":""]),onClick:kt},[t[27]||(t[27]=z(" 更多操作 ",-1)),t[28]||(t[28]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),ht.value?(r(),l("span",{key:0,class:b(["ml-1 h-2 w-2 rounded-full",St.value]),"aria-hidden":"true"},null,2)):v("",!0)],2),D.value?(r(),l("div",ds,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:t[4]||(t[4]=o=>{yt(),Z()})}," 任务状态 "),t[29]||(t[29]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",k.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:k.value,onClick:t[5]||(t[5]=o=>{Pt(),Z()})}," 刷新过期 ",10,cs),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!R.value||k.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!R.value||k.value,onClick:t[6]||(t[6]=o=>{zt(),Z()})}," 刷新选中 ",10,fs),t[30]||(t[30]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",R.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!R.value,onClick:t[7]||(t[7]=o=>{Dt(),Z()})}," 批量启用 ",10,vs),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",R.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!R.value,onClick:t[8]||(t[8]=o=>{Mt(),Z()})}," 批量禁用 ",10,xs),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",R.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!R.value,onClick:t[9]||(t[9]=o=>{Ot(),Z()})}," 批量删除 ",10,gs)])):v("",!0)],512)]),P.value==="card"?(r(),l("div",ps,[(r(!0),l(ue,null,Te(B.value,o=>(r(),l("div",{key:o.id,class:b(["rounded-2xl border border-border bg-card p-4",tt(o)]),onClick:i=>ke(o.id)},[s("div",bs,[s("div",null,[t[31]||(t[31]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",ys,n(o.id),1)]),s("div",_s,[U(de,{modelValue:g.value.has(o.id),"onUpdate:modelValue":i=>ke(o.id),onClick:t[10]||(t[10]=A(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:b(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",qe(o)])},n(le(o)),3)])]),s("div",ws,[s("div",null,[t[32]||(t[32]=s("p",null,"剩余时间",-1)),s("p",{class:b(["mt-1 text-sm font-semibold",Ze(o)])},n(Xe(o.remaining_display)),3),o.expires_at?(r(),l("p",ks,n(o.expires_at),1)):v("",!0)]),s("div",null,[t[33]||(t[33]=s("p",null,"冷却",-1)),s("p",{class:b(["mt-1",$e(o)])},[o.cooldown_seconds>0?(r(),l("span",hs,n(et(o.cooldown_seconds))+" · "+n(o.cooldown_reason),1)):(r(),l("span",Cs,n(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[t[34]||(t[34]=s("p",null,"失败数",-1)),s("p",Ts,n(o.error_count),1)]),s("div",null,[t[35]||(t[35]=s("p",null,"会话数",-1)),s("p",Ss,n(o.conversation_count),1)])]),s("div",As,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>rt(o.id),["stop"])}," 编辑 ",8,Ls),We(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[11]||(t[11]=A(()=>{},["stop"])),i=>at(o.id)]}," 启用 ",8,Es)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[12]||(t[12]=A(()=>{},["stop"])),i=>it(o.id)]}," 禁用 ",8,$s)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[t[13]||(t[13]=A(()=>{},["stop"])),i=>ut(o.id)]}," 删除 ",8,Rs)])],10,ms))),128)),!B.value.length&&!S(ee)?(r(),l("div",Vs," 暂无账号数据,请检查后台配置。 ")):v("",!0)])):(r(),l("div",Is,[s("table",js,[s("thead",Ds,[s("tr",null,[s("th",Ms,[U(de,{modelValue:Le.value,"onUpdate:modelValue":st},null,8,["modelValue"])]),t[37]||(t[37]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),t[38]||(t[38]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",Os,[s("span",Bs,[t[36]||(t[36]=z(" 剩余/过期 ",-1)),U(Zt,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),t[39]||(t[39]=s("th",{class:"py-3 pr-6"},"冷却",-1)),t[40]||(t[40]=s("th",{class:"py-3 pr-6"},"失败数",-1)),t[41]||(t[41]=s("th",{class:"py-3 pr-6"},"会话数",-1)),t[42]||(t[42]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",Ns,[!B.value.length&&!S(ee)?(r(),l("tr",Us,[...t[43]||(t[43]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):v("",!0),(r(!0),l(ue,null,Te(B.value,o=>(r(),l("tr",{key:o.id,class:b(["border-t border-border",tt(o)]),onClick:i=>ke(o.id)},[s("td",{class:"py-4 pr-4",onClick:t[14]||(t[14]=A(()=>{},["stop"]))},[U(de,{modelValue:g.value.has(o.id),"onUpdate:modelValue":i=>ke(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",Ps,n(o.id),1),s("td",Fs,[s("span",{class:b(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",qe(o)])},n(le(o)),3)]),s("td",Ks,[s("div",{class:b(["text-sm font-semibold",Ze(o)])},n(Xe(o.remaining_display)),3),o.expires_at?(r(),l("span",Hs,n(o.expires_at),1)):v("",!0)]),s("td",Js,[o.cooldown_seconds>0?(r(),l("span",{key:0,class:b($e(o))},n(et(o.cooldown_seconds))+" · "+n(o.cooldown_reason),3)):(r(),l("span",{key:1,class:b($e(o))},n(o.cooldown_reason||"无冷却"),3))]),s("td",Gs,n(o.error_count),1),s("td",Ys,n(o.conversation_count),1),s("td",Qs,[s("div",qs,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>rt(o.id),["stop"])}," 编辑 ",8,Ws),We(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>at(o.id),["stop"])}," 启用 ",8,Xs)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>it(o.id),["stop"])}," 禁用 ",8,Zs)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:A(i=>ut(o.id),["stop"])}," 删除 ",8,eo)])])],10,zs))),128))])])]))])]),U(Wt,{open:S(h).open.value,title:S(h).title.value,message:S(h).message.value,"confirm-text":S(h).confirmText.value,"cancel-text":S(h).cancelText.value,onConfirm:S(h).confirm,onCancel:S(h).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(r(),Ce(Se,{to:"body"},[ce.value?(r(),l("div",to,[s("div",so,[s("div",{class:"flex items-center justify-between"},[t[44]||(t[44]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"添加账户"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"创建 DuckMail 账号并自动注册")],-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Ye}," 关闭 ")]),s("div",oo,[t[46]||(t[46]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),V(s("input",{"onUpdate:modelValue":t[15]||(t[15]=o=>re.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,re.value,void 0,{number:!0}]]),t[47]||(t[47]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"}," 默认域名来自设置面板(可在“配置面板”中修改) ",-1)),t[48]||(t[48]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-[11px] leading-relaxed text-muted-foreground"},[s("div",{class:"space-y-2"},[s("p",{class:"font-semibold text-rose-600"},"⚠️ 严禁滥用:禁止将本工具用于商业用途或任何形式的滥用(无论规模大小)"),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"合法用途:"),z("本项目仅限个人学习、技术研究与非商业性技术交流,旨在探索浏览器自动化与系统集成。")])]),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"禁止行为:"),z("严禁用于以下场景:")]),s("p",{class:"pl-3"},"• 商业用途或盈利性使用"),s("p",{class:"pl-3"},"• 任何形式的批量注册或自动化滥用(无论规模大小)"),s("p",{class:"pl-3"},"• 破坏市场秩序或恶意竞争"),s("p",{class:"pl-3"},"• 违反 Google 服务条款的任何行为")]),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"使用责任:"),z("因使用本工具产生的一切后果由使用者完全承担,包括但不限于账号封禁、数据损失及法律责任。")]),s("p",null,[s("strong",null,"合规要求:"),z("使用者必须遵守所在地法律法规及第三方服务条款,作者不对任何违规使用行为承担责任。")])]),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"技术声明:")]),s("p",{class:"pl-3"},'• 本项目按"现状"提供,不提供任何明示或暗示的担保'),s("p",{class:"pl-3"},"• 依赖 DuckMail API 等第三方服务,其可用性不受作者控制"),s("p",{class:"pl-3"},"• 作者保留随时停止维护或变更功能的权利")])])],-1)),U(de,{modelValue:xe.value,"onUpdate:modelValue":t[16]||(t[16]=o=>xe.value=o)},{default:xt(()=>[...t[45]||(t[45]=[z(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])]),s("div",ro,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ye}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:$.value||!xe.value,onClick:Ut}," 开始注册 ",8,lo)])])])):v("",!0)])),(r(),Ce(Se,{to:"body"},[F.value?(r(),l("div",no,[s("div",ao,[s("div",io,[t[49]||(t[49]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",uo,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary",disabled:!K.value.length&&!H.value.length&&!d.value&&!c.value&&!p.value,onClick:wt}," 清空日志 ",8,co),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:_t}," 关闭 ")])]),s("div",fo,[p.value?(r(),l("div",vo,n(p.value),1)):v("",!0),d.value||c.value?(r(),l("div",xo,[d.value?(r(),l("div",go,[t[50]||(t[50]=s("div",{class:"font-medium text-foreground"},"注册任务",-1)),s("div",po,[s("span",null,"状态:"+n(dt(d.value.status)),1),s("span",null,"进度:"+n(d.value.progress)+"/"+n(d.value.count),1),s("span",null,"成功:"+n(d.value.success_count),1),s("span",null,"失败:"+n(d.value.fail_count),1)])])):v("",!0),c.value?(r(),l("div",mo,[t[51]||(t[51]=s("div",{class:"font-medium text-foreground"},"刷新任务",-1)),s("div",bo,[s("span",null,"状态:"+n(dt(c.value.status)),1),s("span",null,"进度:"+n(c.value.progress)+"/"+n(c.value.account_ids.length),1),s("span",null,"成功:"+n(c.value.success_count),1),s("span",null,"失败:"+n(c.value.fail_count),1)])])):v("",!0)])):v("",!0),K.value.length||H.value.length?(r(),l("div",yo,[s("div",{ref_key:"taskLogsRef",ref:ze,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[K.value.length?(r(),l("div",_o,[t[52]||(t[52]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",wo,[(r(!0),l(ue,null,Te(K.value,(o,i)=>(r(),l("div",{key:`reg-${i}`,class:"font-mono"},n(ot(o)),1))),128))])])):v("",!0),H.value.length?(r(),l("div",ko,[t[53]||(t[53]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",ho,[(r(!0),l(ue,null,Te(H.value,(o,i)=>(r(),l("div",{key:`login-${i}`,class:"font-mono"},n(ot(o)),1))),128))])])):v("",!0)],512)])):v("",!0),!p.value&&!d.value&&!c.value&&!K.value.length&&!H.value.length?(r(),l("div",Co," 暂无任务 ")):v("",!0)])])])):v("",!0)])),(r(),Ce(Se,{to:"body"},[se.value?(r(),l("div",To,[s("div",So,[s("div",{class:"flex items-center justify-between"},[t[54]||(t[54]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Ve}," 关闭 ")]),u.value?(r(),l("div",Ao,n(u.value),1)):v("",!0),s("div",Lo,[t[55]||(t[55]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),V(s("input",{"onUpdate:modelValue":t[17]||(t[17]=o=>m.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[I,m.value.id]]),t[56]||(t[56]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),V(s("textarea",{"onUpdate:modelValue":t[18]||(t[18]=o=>m.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[I,m.value.secure_c_ses]]),t[57]||(t[57]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),V(s("input",{"onUpdate:modelValue":t[19]||(t[19]=o=>m.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,m.value.csesidx]]),t[58]||(t[58]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),V(s("input",{"onUpdate:modelValue":t[20]||(t[20]=o=>m.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,m.value.config_id]]),t[59]||(t[59]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),V(s("input",{"onUpdate:modelValue":t[21]||(t[21]=o=>m.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,m.value.host_c_oses]]),t[60]||(t[60]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),V(s("input",{"onUpdate:modelValue":t[22]||(t[22]=o=>m.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[I,m.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ve}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:jt}," 保存 ")])])])):v("",!0)])),(r(),Ce(Se,{to:"body"},[L.value?(r(),l("div",Eo,[s("div",$o,[s("div",Ro,[t[61]||(t[61]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",Vo,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Vt},n(j.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Re}," 关闭 ")])]),E.value?(r(),l("div",Io,n(E.value),1)):v("",!0),s("div",jo,[V(s("textarea",{"onUpdate:modelValue":t[23]||(t[23]=o=>q.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:j.value},null,8,Do),[[I,q.value]])]),s("div",Mo,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Re}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:It,disabled:j.value}," 保存 ",8,Oo)])])])):v("",!0)]))],64))}});export{Ko as default};
static/assets/Accounts-D4WYjY04.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ import{g as A,C as ts,h as a,d as ss,D as os,i as G,o as rs,s as ls,j as ns,c as l,a as s,x as H,y as Re,m as L,v as $,A as Ct,t as n,n as g,u as R,b as x,f as J,F as ge,r as Ve,T as Me,w as V,e as r,E as as}from"./index-BRg_yWJl.js";import{_ as is}from"./SelectMenu.vue_vue_type_script_setup_true_lang-DswSmh70.js";import{_ as be}from"./Checkbox.vue_vue_type_script_setup_true_lang-CRAgcaHj.js";import{_ as ds}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-CZswS7RJ.js";import{u as us}from"./useConfirmDialog-Ds3wJrfU.js";import{_ as cs}from"./HelpTip.vue_vue_type_script_setup_true_lang-D8gzoJNA.js";const w={list:()=>A.get("/admin/accounts"),getConfig:()=>A.get("/admin/accounts-config"),updateConfig:b=>A.put("/admin/accounts-config",b),delete:b=>A.delete(`/admin/accounts/${b}`),disable:b=>A.put(`/admin/accounts/${b}/disable`),enable:b=>A.put(`/admin/accounts/${b}/enable`),startRegister:(b,h)=>A.post("/admin/register/start",{count:b,domain:h}),getRegisterTask:b=>A.get(`/admin/register/task/${b}`),getRegisterCurrent:()=>A.get("/admin/register/current"),startLogin:b=>A.post("/admin/login/start",b),getLoginTask:b=>A.get(`/admin/login/task/${b}`),getLoginCurrent:()=>A.get("/admin/login/current"),checkLogin:()=>A.post("/admin/login/check")},fs=ts("accounts",()=>{const b=a([]),h=a(!1);async function I(){h.value=!0;try{const u=await w.list();b.value=Array.isArray(u)?u:u.accounts||[]}finally{h.value=!1}}async function le(u){await w.delete(u),await I()}async function C(u){await w.disable(u),await I()}async function ne(u){await w.enable(u),await I()}async function ee(u){await Promise.all(u.map(M=>w.enable(M))),await I()}async function m(u){await Promise.all(u.map(M=>w.disable(M))),await I()}async function Y(u){await Promise.all(u.map(M=>w.delete(M))),await I()}async function ae(u){await w.updateConfig(u),await I()}return{accounts:b,isLoading:h,loadAccounts:I,deleteAccount:le,disableAccount:C,enableAccount:ne,bulkEnable:ee,bulkDisable:m,bulkDelete:Y,updateConfig:ae}}),vs={class:"space-y-8"},ps={class:"rounded-3xl border border-border bg-card p-6"},xs={class:"flex flex-wrap items-center justify-between gap-4"},ms={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},gs={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},bs={class:"ml-auto flex items-center gap-2 sm:ml-0"},ys={class:"mt-4 flex flex-wrap items-center gap-2"},_s=["disabled"],ws=["disabled"],hs={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},ks=["disabled"],Cs=["disabled"],Ts=["disabled"],Ss=["disabled"],As=["disabled"],Es={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},Is=["onClick"],Ls={class:"flex items-start justify-between gap-3"},$s={class:"mt-1 font-mono text-xs text-foreground"},Rs={class:"flex items-center gap-2"},Vs={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},Ms={key:0,class:"mt-1 text-[11px]"},js={key:0},Ds={key:1},Os={class:"mt-1 text-sm font-semibold text-foreground"},Bs={class:"mt-1 text-sm font-semibold text-foreground"},Ns={class:"mt-4 flex flex-wrap items-center gap-2"},Us=["onClick"],zs=["onClick"],Ps=["onClick"],Fs=["onClick"],Ks={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Gs={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},Hs={class:"min-w-full text-left text-sm"},Js={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Ys={class:"py-3 pr-4"},Qs={class:"py-3 pr-6"},qs={class:"inline-flex items-center gap-2"},Ws={class:"text-sm text-foreground"},Xs={key:0},Zs=["onClick"],eo={class:"py-4 pr-6 font-mono text-xs text-foreground"},to={class:"py-4 pr-6"},so={class:"py-4 pr-6"},oo={key:0,class:"block text-[11px] text-muted-foreground"},ro={class:"py-4 pr-6 text-xs"},lo={class:"py-4 pr-6 text-xs text-muted-foreground"},no={class:"py-4 pr-6 text-xs text-muted-foreground"},ao={class:"py-4 text-right"},io={class:"flex flex-wrap justify-end gap-2"},uo=["onClick"],co=["onClick"],fo=["onClick"],vo=["onClick"],po={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},xo={class:"flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},mo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},go={class:"mt-1 text-xs text-muted-foreground"},bo={class:"scrollbar-slim flex-1 overflow-y-auto px-6 py-4"},yo={class:"space-y-4 text-sm"},_o={class:"flex rounded-full border border-border bg-muted/30 p-1 text-xs"},wo={key:0,class:"space-y-4"},ho={key:1,class:"space-y-4"},ko={key:0,class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-600"},Co={class:"border-t border-border/60 px-6 py-4"},To={class:"flex items-center justify-end gap-2"},So=["disabled"],Ao=["disabled"],Eo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Io={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},Lo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},$o={class:"flex items-center gap-2"},Ro=["disabled"],Vo={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},Mo={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},jo={key:1,class:"grid gap-3 text-xs text-muted-foreground"},Do={key:0,class:"space-y-1"},Oo={class:"flex flex-wrap gap-x-4 gap-y-1"},Bo={key:1,class:"space-y-1"},No={class:"flex flex-wrap gap-x-4 gap-y-1"},Uo={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},zo={key:0,class:"space-y-2"},Po={class:"space-y-1 text-[11px] text-muted-foreground"},Fo={key:1,class:"mt-4 space-y-2"},Ko={class:"space-y-1 text-[11px] text-muted-foreground"},Go={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},Ho={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Jo={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Yo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},Qo={class:"mt-4 space-y-3 text-sm"},qo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Wo={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},Xo={class:"flex items-center justify-between"},Zo={class:"flex items-center gap-2"},er={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},tr={class:"mt-4"},sr=["readonly"],or={class:"mt-6 flex items-center justify-end gap-2"},rr=["disabled"],Ke="accounts-register-task-cache",Ge="accounts-login-task-cache",He="accounts-register-log-clear",Je="accounts-login-log-clear",Ye="accounts-register-task-cleared-id",Qe="accounts-login-task-cleared-id",Tt="1970-01-01 00:00:00",cr=ss({__name:"Accounts",setup(b){const h=fs(),{accounts:I,isLoading:le}=os(h),C=us(),ne=a(""),ee=a("all"),m=a(new Set),Y=a("table"),ae=a(!1),u=a(""),M=a(!1),j=a(""),te=a(""),B=a(!1),ie=a([]),de=a(1),ye=a(!1),N=a("register"),ue=a(""),U=a(""),_e=a(!1),Q=a(!1),z=a(!1),je=a(null),we=a(null),he=a(null),P=a(null),F=a(null),se=a(0),oe=a(0),ce=a(!1),c=a(null),f=a(null),qe=a(null),D=a(!1),T=a(!1),y=a(""),_=a({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),ke=a(null),We=a([]),St=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],K=G(()=>{const e=ne.value.trim().toLowerCase();return I.value.filter(t=>{const o=!e||t.id.toLowerCase().includes(e),i=ee.value==="all"||ve(t)===ee.value;return o&&i})}),O=G(()=>m.value.size),De=G(()=>K.value.length>0&&K.value.every(e=>m.value.has(e.id))),fe=async()=>{await h.loadAccounts(),m.value=new Set,z.value=!1},Xe=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},Ze=e=>{try{return localStorage.getItem(e)||null}catch{return null}},Ce=(e,t)=>{try{if(t){localStorage.setItem(e,t);return}localStorage.removeItem(e)}catch{}},et=(e,t)=>{try{localStorage.setItem(e,JSON.stringify(t))}catch{}},tt=e=>{try{localStorage.removeItem(e)}catch{}},st=e=>{const t=localStorage.getItem(e),o=Number(t);return Number.isFinite(o)?o:0},Te=(e,t)=>{try{localStorage.setItem(e,String(t))}catch{}},Oe=(e,t=!0)=>{e&&(e.id&&e.id===P.value||(e.id&&P.value&&e.id!==P.value&&(P.value=null,Ce(Ye,null)),c.value=e,e.id&&e.id!==we.value&&(we.value=e.id,se.value=0,Te(He,0)),t&&et(Ke,e)))},Se=(e,t=!0)=>{e&&(e.id&&e.id===F.value||(e.id&&F.value&&e.id!==F.value&&(F.value=null,Ce(Qe,null)),f.value=e,e.id&&e.id!==he.value&&(he.value=e.id,oe.value=0,Te(Je,0)),t&&et(Ge,e)))},At=()=>{se.value=st(He),oe.value=st(Je),P.value=Ze(Ye),F.value=Ze(Qe);const e=Xe(Ke);e&&e.id!==P.value&&(c.value=e,we.value=e.id||null);const t=Xe(Ge);t&&t.id!==F.value&&(f.value=t,he.value=t.id||null)},Et=()=>{ye.value=!0,N.value="register",ue.value="",U.value="",_e.value=!1,ce.value=!1},Be=()=>{ye.value=!1},It=e=>{const t=[],o=[];return e.split(/\r?\n/).map(d=>d.trim()).filter(Boolean).forEach((d,p)=>{const v=d.split("----").map(S=>S.trim()),k=p+1;if(v.length){if(v[0].toLowerCase()==="duckmail"){if(v.length<3||!v[1]||!v[2]){o.push(`第 ${k} 行格式错误(duckmail)`);return}const S=v[1],$e=v.slice(2).join("----");t.push({id:S,secure_c_ses:"",csesidx:"",config_id:"",expires_at:Tt,mail_provider:"duckmail",mail_address:S,mail_password:$e});return}if(v.length>=4&&v[0]&&v[2]&&v[3]){const S=v[0],$e=v[1]||"",E=v[2],es=v.slice(3).join("----");t.push({id:S,secure_c_ses:"",csesidx:"",config_id:"",expires_at:Tt,mail_provider:"microsoft",mail_address:S,mail_password:$e,mail_client_id:E,mail_refresh_token:es,mail_tenant:"consumers"});return}o.push(`第 ${k} 行格式错误`)}}),{items:t,errors:o}},Lt=async()=>{if(U.value="",!ue.value.trim()){U.value="请输入导入内容";return}const{items:e,errors:t}=It(ue.value);if(!e.length){U.value=t.length?t.join(","):"未识别到有效账号";return}if(t.length){U.value=t.slice(0,3).join(",");return}_e.value=!0;try{const i=[...await ct()],d=new Map(i.map((k,S)=>[k.id,S])),p=[];e.forEach(k=>{const S=d.get(k.id||"");if(S===void 0){i.push(k),p.push(k.id);return}const E={...i[S],mail_provider:k.mail_provider,mail_address:k.mail_address};k.mail_provider==="microsoft"?(E.mail_client_id=k.mail_client_id,E.mail_refresh_token=k.mail_refresh_token,E.mail_tenant=k.mail_tenant,E.mail_password=k.mail_password):(E.mail_password=k.mail_password,E.mail_client_id=void 0,E.mail_refresh_token=void 0,E.mail_tenant=void 0),i[S]=E,p.push(k.id)}),await h.updateConfig(i),await fe(),m.value=new Set(p),Be(),await C.ask({title:"导入成功",message:`已导入 ${p.length} 个账户并自动选中。是否立即刷新这些账户以获取 Cookie?`,confirmText:"立即刷新",cancelText:"稍后手动刷新"})&&await kt()}catch(o){U.value=o.message||"导入失败"}finally{_e.value=!1}},$t=async()=>{try{const e=[],t=c.value?.id,o=f.value?.id;if(t&&!Ae(t)&&e.push(_t(t)),o&&!Ee(o)&&e.push(wt(o)),!e.length){await Fe();return}await Promise.all(e)}catch(e){y.value=e?.message||"任务状态更新失败"}},Rt=async()=>{Q.value=!0,await $t()},Vt=()=>{Q.value=!1},Mt=()=>{const e=c.value?.id||null,t=f.value?.id||null;P.value=e,F.value=t,Ce(Ye,e),Ce(Qe,t),se.value=c.value?.logs?.length||0,oe.value=f.value?.logs?.length||0,Te(He,se.value),Te(Je,oe.value),c.value=null,f.value=null,we.value=null,he.value=null,y.value="",D.value=!1,T.value=!1,X(),Z(),tt(Ke),tt(Ge)},Ae=e=>!!(e&&e===P.value),Ee=e=>!!(e&&e===F.value),jt=()=>{z.value=!z.value},re=()=>{z.value=!1},ot=e=>{if(!z.value)return;const t=e.target;je.value&&!je.value.contains(t)&&(z.value=!1)};rs(async()=>{At(),await fe(),await Fe(),Wt(),document.addEventListener("click",ot)});const q=G(()=>{const e=c.value?.logs||[];return se.value?e.slice(se.value):e}),W=G(()=>{const e=f.value?.logs||[];return oe.value?e.slice(oe.value):e}),Dt=G(()=>!!y.value||!!c.value||!!f.value||q.value.length>0||W.value.length>0),Ot=async()=>{await as();const e=qe.value;e&&(e.scrollTop=e.scrollHeight)};ls([q,W,Q],async()=>{Q.value&&await Ot()},{deep:!0});const Bt=G(()=>{const e=c.value?.status,t=f.value?.status;return e==="running"||e==="pending"||t==="running"||t==="pending"}),Nt=G(()=>{if(y.value)return"bg-rose-500";if(Bt.value)return"bg-sky-400";const e=[];if(c.value){const d=c.value.success_count??0,p=c.value.fail_count??0,v=c.value.count??d+p;e.push({success:d,fail:p,total:v,status:c.value.status})}if(f.value){const d=f.value.success_count??0,p=f.value.fail_count??0,v=f.value.account_ids?.length??d+p;e.push({success:d,fail:p,total:v,status:f.value.status})}if(!e.length)return"bg-muted-foreground";const t=e.reduce((d,p)=>d+p.success,0),o=e.reduce((d,p)=>d+p.fail,0),i=e.reduce((d,p)=>d+(p.total||0),0);if(t>0&&o>0)return"bg-amber-400";if(o>0&&t===0)return"bg-rose-500";if(t>0&&o===0)return"bg-emerald-400";if(i===0){const d=e.every(v=>v.status==="success");if(e.some(v=>v.status==="failed"))return"bg-rose-500";if(d)return"bg-emerald-400"}return"bg-muted-foreground"});ns(()=>{X(),Z(),qt(),document.removeEventListener("click",ot)});const ve=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?"429限流":e.cooldown_reason==="错误禁用"?"错误禁用":e.disabled?"手动禁用":e.status==="已过期"?"已过期":e.status==="即将过期"?"即将过期":"正常",rt=e=>{const t=ve(e);return t==="429限流"||t==="即将过期"?"bg-amber-200 text-amber-900":t==="错误禁用"||t==="已过期"?"bg-destructive/10 text-destructive":t==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},lt=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?!0:e.disabled||e.cooldown_reason==="错误禁用",nt=e=>e==="已过期"?"过期":e==="未设置"?"未设置":e,at=e=>e.status==="已过期"?"text-rose-600":e.status==="即将过期"?"text-amber-700":e.status==="未设置"?"text-muted-foreground":"text-emerald-600",it=e=>e<60?`${e} 秒`:e<3600?`${Math.ceil(e/60)} 分钟`:`${(e/3600).toFixed(1)} 小时`,Ne=e=>e.cooldown_seconds>0?"text-amber-700":e.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",dt=e=>{const t=ve(e);return t==="手动禁用"||t==="已过期"?"bg-muted/70":""},Ie=e=>{const t=new Set(m.value);t.has(e)?t.delete(e):t.add(e),m.value=t},ut=()=>{if(De.value){m.value=new Set;return}m.value=new Set(K.value.map(e=>e.id))},Ut=(e,t)=>e.id||`account_${t+1}`,ct=async()=>(await w.getConfig()).accounts.map((t,o)=>({...t,id:Ut(t,o)})),ft=e=>`${e.time} [${e.level}] ${e.message}`,zt=(e,t)=>{let o=-1;for(let d=0;d<e.length;d+=1)if(e[d].id===t){o=d;break}if(o===-1)return u.value="未找到对应账号配置。",!1;const i=e[o];return _.value={id:i.id,secure_c_ses:i.secure_c_ses,csesidx:i.csesidx,config_id:i.config_id,host_c_oses:i.host_c_oses,expires_at:i.expires_at},We.value=e,ke.value=o,ae.value=!0,!0},vt=async e=>{u.value="";try{const t=await ct();zt(t,e)}catch(t){u.value=t.message||"加载账号配置失败"}},Pt=async()=>{j.value="";try{const e=await w.getConfig();ie.value=Array.isArray(e.accounts)?e.accounts:[],te.value=JSON.stringify(xt(ie.value),null,2),B.value=!0,M.value=!0}catch(e){j.value=e.message||"加载账号配置失败"}},Ue=()=>{M.value=!1,j.value="",B.value=!1},pt=()=>{const e=JSON.parse(te.value);if(!Array.isArray(e))throw new Error("配置格式必须是数组。");return e},Ft=e=>typeof e!="string"||!e?e:e.length<=6?`${e.slice(0,2)}****`:`${e.slice(0,3)}****`,xt=e=>{const t=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password","mail_refresh_token","mail_client_id"]);return e.map(o=>{const i={...o};return t.forEach(d=>{const p=i[d];p&&(i[d]=Ft(p))}),i})},Kt=()=>{if(j.value="",!B.value){try{ie.value=pt()}catch(e){j.value=e.message||"JSON 格式错误";return}te.value=JSON.stringify(xt(ie.value),null,2),B.value=!0;return}te.value=JSON.stringify(ie.value,null,2),B.value=!1},Gt=async()=>{j.value="";try{const e=pt();await h.updateConfig(e),Ue()}catch(e){j.value=e.message||"保存失败"}},ze=()=>{ae.value=!1,u.value=""},Ht=async()=>{if(ke.value===null)return;const e=[...We.value];e[ke.value]={...e[ke.value],id:_.value.id,secure_c_ses:_.value.secure_c_ses,csesidx:_.value.csesidx,config_id:_.value.config_id,host_c_oses:_.value.host_c_oses||void 0,expires_at:_.value.expires_at||void 0};try{await h.updateConfig(e),ze()}catch(t){u.value=t.message||"保存失败"}},Jt=async()=>{await h.bulkEnable(Array.from(m.value)),m.value=new Set},Yt=async()=>{await C.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"})&&(await h.bulkDisable(Array.from(m.value)),m.value=new Set)},Qt=async()=>{await C.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"})&&(await h.bulkDelete(Array.from(m.value)),m.value=new Set)},mt=async e=>{await h.enableAccount(e)},gt=async e=>{await C.ask({title:"禁用账号",message:"确定要禁用该账号吗?"})&&await h.disableAccount(e)},bt=async e=>{await C.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"})&&await h.deleteAccount(e)};let pe=null,xe=null,me=null,Le=!1;const X=()=>{pe!==null&&(window.clearInterval(pe),pe=null)},Z=()=>{xe!==null&&(window.clearInterval(xe),xe=null)},qt=()=>{me!==null&&(window.clearInterval(me),me=null),Le=!1},yt=e=>e==="pending"?"等待中":e==="running"?"执行中":e==="success"?"成功":e==="failed"?"失败":e,_t=async e=>{if(Ae(e)){X();return}const t=await w.getRegisterTask(e);if(Ae(t.id)){X();return}Oe(t),t.status!=="running"&&t.status!=="pending"&&(D.value=!1,X(),await fe())},wt=async e=>{if(Ee(e)){Z();return}const t=await w.getLoginTask(e);if(Ee(t.id)){Z();return}Se(t),t.status!=="running"&&t.status!=="pending"&&(T.value=!1,Z(),await fe())},ht=e=>{X(),pe=window.setInterval(()=>{_t(e).catch(t=>{y.value=t?.message||"注册任务更新失败",X(),D.value=!1})},3e3)},Pe=e=>{Z(),xe=window.setInterval(()=>{wt(e).catch(t=>{y.value=t?.message||"刷新任务更新失败",Z(),T.value=!1})},3e3)},Wt=()=>{me===null&&(me=window.setInterval(async()=>{if(!Le&&!Q.value&&!(pe!==null||xe!==null)&&!(!D.value&&!T.value&&!c.value&&!f.value)){Le=!0;try{await Fe()}catch(e){y.value=e?.message||"后台刷新失败"}finally{Le=!1}}},6e3))},Fe=async()=>{try{const e=await w.getRegisterCurrent();e&&"id"in e&&!Ae(e.id)&&(Oe(e),(e.status==="running"||e.status==="pending")&&(D.value=!0,ht(e.id)))}catch(e){y.value=e.message||"加载注册任务失败"}try{const e=await w.getLoginCurrent();e&&"id"in e&&!Ee(e.id)&&(Se(e),(e.status==="running"||e.status==="pending")&&(T.value=!0,Pe(e.id)))}catch(e){y.value=e.message||"加载刷新任务失败"}},Xt=async()=>{y.value="",D.value=!0;try{const e=Number.isFinite(de.value)&&de.value>0?de.value:void 0,t=await w.startRegister(e);Oe(t),ht(t.id),ye.value=!1,Q.value=!0}catch(e){y.value=e.message||"启动注册失败",D.value=!1}},kt=async()=>{if(m.value.size){y.value="",T.value=!0;try{const e=await w.startLogin(Array.from(m.value));Se(e),Pe(e.id)}catch(e){y.value=e.message||"启动刷新失败",T.value=!1}}},Zt=async()=>{y.value="",T.value=!0;try{await w.checkLogin();const e=await w.getLoginCurrent();if(e&&"id"in e){Se(e),Pe(e.id);return}T.value=!1}catch(e){y.value=e.message||"触发刷新失败",T.value=!1}};return(e,t)=>(r(),l(ge,null,[s("div",vs,[s("section",ps,[s("div",xs,[s("div",ms,[L(s("input",{"onUpdate:modelValue":t[0]||(t[0]=o=>ne.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[$,ne.value]]),H(is,{modelValue:ee.value,"onUpdate:modelValue":t[1]||(t[1]=o=>ee.value=o),options:St},null,8,["modelValue"])]),s("div",gs,[H(be,{modelValue:De.value,"onUpdate:modelValue":ut},{default:Ct(()=>[...t[27]||(t[27]=[J(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+n(O.value)+" / "+n(K.value.length)+" 个账号",1),s("div",bs,[s("button",{type:"button",class:g(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",Y.value==="table"?"bg-accent text-accent-foreground":""]),onClick:t[2]||(t[2]=o=>Y.value="table"),"aria-label":"列表视图"},[...t[28]||(t[28]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:g(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",Y.value==="card"?"bg-accent text-accent-foreground":""]),onClick:t[3]||(t[3]=o=>Y.value="card"),"aria-label":"卡片视图"},[...t[29]||(t[29]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",ys,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:R(le),onClick:fe}," 刷新列表 ",8,_s),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pt}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:D.value,onClick:Et}," 添加账户 ",8,ws),s("div",{ref_key:"moreActionsRef",ref:je,class:"relative"},[s("button",{class:g(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",z.value?"bg-accent text-accent-foreground":""]),onClick:jt},[t[30]||(t[30]=J(" 更多操作 ",-1)),t[31]||(t[31]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),Dt.value?(r(),l("span",{key:0,class:g(["ml-1 h-2 w-2 rounded-full",Nt.value]),"aria-hidden":"true"},null,2)):x("",!0)],2),z.value?(r(),l("div",hs,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:t[4]||(t[4]=o=>{Rt(),re()})}," 任务状态 "),t[32]||(t[32]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",T.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:T.value,onClick:t[5]||(t[5]=o=>{Zt(),re()})}," 刷新过期 ",10,ks),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!O.value||T.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!O.value||T.value,onClick:t[6]||(t[6]=o=>{kt(),re()})}," 刷新选中 ",10,Cs),t[33]||(t[33]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[7]||(t[7]=o=>{Jt(),re()})}," 批量启用 ",10,Ts),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[8]||(t[8]=o=>{Yt(),re()})}," 批量禁用 ",10,Ss),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[9]||(t[9]=o=>{Qt(),re()})}," 批量删除 ",10,As)])):x("",!0)],512)]),Y.value==="card"?(r(),l("div",Es,[(r(!0),l(ge,null,Ve(K.value,o=>(r(),l("div",{key:o.id,class:g(["rounded-2xl border border-border bg-card p-4",dt(o)]),onClick:i=>Ie(o.id)},[s("div",Ls,[s("div",null,[t[34]||(t[34]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",$s,n(o.id),1)]),s("div",Rs,[H(be,{modelValue:m.value.has(o.id),"onUpdate:modelValue":i=>Ie(o.id),onClick:t[10]||(t[10]=V(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:g(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",rt(o)])},n(ve(o)),3)])]),s("div",Vs,[s("div",null,[t[35]||(t[35]=s("p",null,"剩余时间",-1)),s("p",{class:g(["mt-1 text-sm font-semibold",at(o)])},n(nt(o.remaining_display)),3),o.expires_at?(r(),l("p",Ms,n(o.expires_at),1)):x("",!0)]),s("div",null,[t[36]||(t[36]=s("p",null,"冷却",-1)),s("p",{class:g(["mt-1",Ne(o)])},[o.cooldown_seconds>0?(r(),l("span",js,n(it(o.cooldown_seconds))+" · "+n(o.cooldown_reason),1)):(r(),l("span",Ds,n(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[t[37]||(t[37]=s("p",null,"失败数",-1)),s("p",Os,n(o.error_count),1)]),s("div",null,[t[38]||(t[38]=s("p",null,"会话数",-1)),s("p",Bs,n(o.conversation_count),1)])]),s("div",Ns,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>vt(o.id),["stop"])}," 编辑 ",8,Us),lt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[11]||(t[11]=V(()=>{},["stop"])),i=>mt(o.id)]}," 启用 ",8,zs)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[12]||(t[12]=V(()=>{},["stop"])),i=>gt(o.id)]}," 禁用 ",8,Ps)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[t[13]||(t[13]=V(()=>{},["stop"])),i=>bt(o.id)]}," 删除 ",8,Fs)])],10,Is))),128)),!K.value.length&&!R(le)?(r(),l("div",Ks," 暂无账号数据,请检查后台配置。 ")):x("",!0)])):(r(),l("div",Gs,[s("table",Hs,[s("thead",Js,[s("tr",null,[s("th",Ys,[H(be,{modelValue:De.value,"onUpdate:modelValue":ut},null,8,["modelValue"])]),t[40]||(t[40]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),t[41]||(t[41]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",Qs,[s("span",qs,[t[39]||(t[39]=J(" 剩余/过期 ",-1)),H(cs,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),t[42]||(t[42]=s("th",{class:"py-3 pr-6"},"冷却",-1)),t[43]||(t[43]=s("th",{class:"py-3 pr-6"},"失败数",-1)),t[44]||(t[44]=s("th",{class:"py-3 pr-6"},"会话数",-1)),t[45]||(t[45]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",Ws,[!K.value.length&&!R(le)?(r(),l("tr",Xs,[...t[46]||(t[46]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):x("",!0),(r(!0),l(ge,null,Ve(K.value,o=>(r(),l("tr",{key:o.id,class:g(["border-t border-border",dt(o)]),onClick:i=>Ie(o.id)},[s("td",{class:"py-4 pr-4",onClick:t[14]||(t[14]=V(()=>{},["stop"]))},[H(be,{modelValue:m.value.has(o.id),"onUpdate:modelValue":i=>Ie(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",eo,n(o.id),1),s("td",to,[s("span",{class:g(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",rt(o)])},n(ve(o)),3)]),s("td",so,[s("div",{class:g(["text-sm font-semibold",at(o)])},n(nt(o.remaining_display)),3),o.expires_at?(r(),l("span",oo,n(o.expires_at),1)):x("",!0)]),s("td",ro,[o.cooldown_seconds>0?(r(),l("span",{key:0,class:g(Ne(o))},n(it(o.cooldown_seconds))+" · "+n(o.cooldown_reason),3)):(r(),l("span",{key:1,class:g(Ne(o))},n(o.cooldown_reason||"无冷却"),3))]),s("td",lo,n(o.error_count),1),s("td",no,n(o.conversation_count),1),s("td",ao,[s("div",io,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>vt(o.id),["stop"])}," 编辑 ",8,uo),lt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>mt(o.id),["stop"])}," 启用 ",8,co)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>gt(o.id),["stop"])}," 禁用 ",8,fo)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:V(i=>bt(o.id),["stop"])}," 删除 ",8,vo)])])],10,Zs))),128))])])]))])]),H(ds,{open:R(C).open.value,title:R(C).title.value,message:R(C).message.value,"confirm-text":R(C).confirmText.value,"cancel-text":R(C).cancelText.value,onConfirm:R(C).confirm,onCancel:R(C).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(r(),Re(Me,{to:"body"},[ye.value?(r(),l("div",po,[s("div",xo,[s("div",mo,[s("div",null,[t[47]||(t[47]=s("p",{class:"text-sm font-medium text-foreground"},"添加账户",-1)),s("p",go,n(N.value==="register"?"创建 DuckMail 账号并自动注册":"批量导入账户配置"),1)]),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Be}," 关闭 ")]),s("div",bo,[s("div",yo,[s("div",_o,[s("button",{type:"button",class:g(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",N.value==="register"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[15]||(t[15]=o=>N.value="register")}," 自动注册 ",2),s("button",{type:"button",class:g(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",N.value==="import"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[16]||(t[16]=o=>N.value="import")}," 批量导入 ",2)]),N.value==="register"?(r(),l("div",wo,[t[48]||(t[48]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),L(s("input",{"onUpdate:modelValue":t[17]||(t[17]=o=>de.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,de.value,void 0,{number:!0}]]),t[49]||(t[49]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"}," 默认域名来自设置面板(可在“配置面板”中修改) ",-1))])):(r(),l("div",ho,[t[50]||(t[50]=s("label",{class:"block text-xs text-muted-foreground"},"批量导入(每行一个)",-1)),L(s("textarea",{"onUpdate:modelValue":t[18]||(t[18]=o=>ue.value=o),class:"min-h-[140px] w-full rounded-2xl border border-input bg-background px-3 py-2 text-xs font-mono",placeholder:`duckmail----you@example.com----password
2
+ user@outlook.com----loginPassword----clientId----refreshToken`},null,512),[[$,ue.value]]),t[51]||(t[51]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"支持两种格式:"),s("p",{class:"mt-1 font-mono"},"duckmail----email----password"),s("p",{class:"mt-1 font-mono"},"email----password----clientId----refreshToken"),s("p",{class:"mt-2 text-[11px]"},'导入后请执行一次"刷新选中"以获取 Cookie。')],-1)),U.value?(r(),l("div",ko,n(U.value),1)):x("",!0)])),t[53]||(t[53]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-[11px] leading-relaxed text-muted-foreground"},[s("div",{class:"space-y-2"},[s("p",{class:"text-xs font-bold text-rose-600"},"⚠️ 严禁滥用:禁止将本工具用于商业用途或任何形式的滥用(无论规模大小)"),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"本工具严禁用于以下行为:")]),s("p",{class:"pl-3"},"• 商业用途或盈利性使用"),s("p",{class:"pl-3"},"• 任何形式的批量操作或自动化滥用(无论规模大小)"),s("p",{class:"pl-3"},"• 破坏市场秩序或恶意竞争"),s("p",{class:"pl-3"},"• 违反 Google 服务条款的任何行为"),s("p",{class:"pl-3"},"• 违反 Microsoft 服务条款的任何行为")]),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"违规后果:"),J("滥用行为可能导致账号永久封禁、法律追责,一切后果由使用者自行承担。")])]),s("div",{class:"space-y-1"},[s("p",{class:"font-semibold text-foreground"},"📖 合法用途"),s("p",null,"本项目仅限于以下场景:"),s("p",{class:"pl-3"},"• 个人学习与技术研究"),s("p",{class:"pl-3"},"• 浏览器自动化技术探索"),s("p",{class:"pl-3"},"• 非商业性技术交流")]),s("div",{class:"space-y-1"},[s("p",{class:"font-semibold text-foreground"},"⚖️ 法律责任"),s("p",null,[s("strong",null,"使用者责任:"),J("使用本工具产生的一切后果(包括但不限于账号封禁、数据损失、法律纠纷)由使用者完全承担。")]),s("p",null,[s("strong",null,"合规义务:"),J("使用者必须遵守所在地法律法规及第三方服务条款(包括但不限于 Google Workspace、Microsoft 365 等服务条款)。")]),s("p",null,[s("strong",null,"作者免责:"),J("作者不对任何违规使用、滥用行为或由此产生的后果承担责任。")])]),s("div",{class:"space-y-1"},[s("p",{class:"font-semibold text-foreground"},"📋 技术声明"),s("p",{class:"pl-3"},'• 本项目按"现状"提供,不提供任何形式的担保'),s("p",{class:"pl-3"},"• 依赖的第三方服务(如 DuckMail API、Microsoft Graph API 等)可用性不受作者控制"),s("p",{class:"pl-3"},"• 作者保留随时停止维护、变更功能或关闭项目的权利")])])],-1)),H(be,{modelValue:ce.value,"onUpdate:modelValue":t[19]||(t[19]=o=>ce.value=o)},{default:Ct(()=>[...t[52]||(t[52]=[J(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])])]),s("div",Co,[s("div",To,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Be}," 取消 "),N.value==="register"?(r(),l("button",{key:0,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:D.value||!ce.value,onClick:Xt}," 开始注册 ",8,So)):(r(),l("button",{key:1,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:_e.value||!ce.value,onClick:Lt}," 导入并保存 ",8,Ao))])])])])):x("",!0)])),(r(),Re(Me,{to:"body"},[Q.value?(r(),l("div",Eo,[s("div",Io,[s("div",Lo,[t[54]||(t[54]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",$o,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary",disabled:!q.value.length&&!W.value.length&&!c.value&&!f.value&&!y.value,onClick:Mt}," 清空日志 ",8,Ro),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Vt}," 关闭 ")])]),s("div",Vo,[y.value?(r(),l("div",Mo,n(y.value),1)):x("",!0),c.value||f.value?(r(),l("div",jo,[c.value?(r(),l("div",Do,[t[55]||(t[55]=s("div",{class:"font-medium text-foreground"},"注册任务",-1)),s("div",Oo,[s("span",null,"状态:"+n(yt(c.value.status)),1),s("span",null,"进度:"+n(c.value.progress)+"/"+n(c.value.count),1),s("span",null,"成功:"+n(c.value.success_count),1),s("span",null,"失败:"+n(c.value.fail_count),1)])])):x("",!0),f.value?(r(),l("div",Bo,[t[56]||(t[56]=s("div",{class:"font-medium text-foreground"},"刷新任务",-1)),s("div",No,[s("span",null,"状态:"+n(yt(f.value.status)),1),s("span",null,"进度:"+n(f.value.progress)+"/"+n(f.value.account_ids.length),1),s("span",null,"成功:"+n(f.value.success_count),1),s("span",null,"失败:"+n(f.value.fail_count),1)])])):x("",!0)])):x("",!0),q.value.length||W.value.length?(r(),l("div",Uo,[s("div",{ref_key:"taskLogsRef",ref:qe,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[q.value.length?(r(),l("div",zo,[t[57]||(t[57]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",Po,[(r(!0),l(ge,null,Ve(q.value,(o,i)=>(r(),l("div",{key:`reg-${i}`,class:"font-mono"},n(ft(o)),1))),128))])])):x("",!0),W.value.length?(r(),l("div",Fo,[t[58]||(t[58]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",Ko,[(r(!0),l(ge,null,Ve(W.value,(o,i)=>(r(),l("div",{key:`login-${i}`,class:"font-mono"},n(ft(o)),1))),128))])])):x("",!0)],512)])):x("",!0),!y.value&&!c.value&&!f.value&&!q.value.length&&!W.value.length?(r(),l("div",Go," 暂无任务 ")):x("",!0)])])])):x("",!0)])),(r(),Re(Me,{to:"body"},[ae.value?(r(),l("div",Ho,[s("div",Jo,[s("div",{class:"flex items-center justify-between"},[t[59]||(t[59]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:ze}," 关闭 ")]),u.value?(r(),l("div",Yo,n(u.value),1)):x("",!0),s("div",Qo,[t[60]||(t[60]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),L(s("input",{"onUpdate:modelValue":t[20]||(t[20]=o=>_.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[$,_.value.id]]),t[61]||(t[61]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),L(s("textarea",{"onUpdate:modelValue":t[21]||(t[21]=o=>_.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[$,_.value.secure_c_ses]]),t[62]||(t[62]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),L(s("input",{"onUpdate:modelValue":t[22]||(t[22]=o=>_.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.csesidx]]),t[63]||(t[63]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),L(s("input",{"onUpdate:modelValue":t[23]||(t[23]=o=>_.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.config_id]]),t[64]||(t[64]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),L(s("input",{"onUpdate:modelValue":t[24]||(t[24]=o=>_.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.host_c_oses]]),t[65]||(t[65]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),L(s("input",{"onUpdate:modelValue":t[25]||(t[25]=o=>_.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[$,_.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:ze}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Ht}," 保存 ")])])])):x("",!0)])),(r(),Re(Me,{to:"body"},[M.value?(r(),l("div",qo,[s("div",Wo,[s("div",Xo,[t[66]||(t[66]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",Zo,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Kt},n(B.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Ue}," 关闭 ")])]),j.value?(r(),l("div",er,n(j.value),1)):x("",!0),s("div",tr,[L(s("textarea",{"onUpdate:modelValue":t[26]||(t[26]=o=>te.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:B.value},null,8,sr),[[$,te.value]])]),s("div",or,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ue}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Gt,disabled:B.value}," 保存 ",8,rr)])])])):x("",!0)]))],64))}});export{cr as default};
static/assets/Accounts-D9VhnA3_.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{g as C,C as Ft,h as a,d as Kt,D as Ht,i as N,o as Jt,s as Gt,j as Yt,c as l,a as s,x as U,y as Ce,m as V,v as I,A as xt,t as n,n as b,u as S,b as v,f as z,F as ue,r as Te,T as Se,w as A,e as r,E as Qt}from"./index-Babp7OwB.js";import{_ as qt}from"./SelectMenu.vue_vue_type_script_setup_true_lang-BVzlIq4n.js";import{_ as de}from"./Checkbox.vue_vue_type_script_setup_true_lang-566L0Qi-.js";import{_ as Wt}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-LOlIelGk.js";import{u as Xt}from"./useConfirmDialog-CVbCTmLz.js";import{_ as Zt}from"./HelpTip.vue_vue_type_script_setup_true_lang-Cx7pOr6m.js";const y={list:()=>C.get("/admin/accounts"),getConfig:()=>C.get("/admin/accounts-config"),updateConfig:x=>C.put("/admin/accounts-config",x),delete:x=>C.delete(`/admin/accounts/${x}`),disable:x=>C.put(`/admin/accounts/${x}/disable`),enable:x=>C.put(`/admin/accounts/${x}/enable`),startRegister:(x,_)=>C.post("/admin/register/start",{count:x,domain:_}),getRegisterTask:x=>C.get(`/admin/register/task/${x}`),getRegisterCurrent:()=>C.get("/admin/register/current"),startLogin:x=>C.post("/admin/login/start",x),getLoginTask:x=>C.get(`/admin/login/task/${x}`),getLoginCurrent:()=>C.get("/admin/login/current"),checkLogin:()=>C.post("/admin/login/check")},es=Ft("accounts",()=>{const x=a([]),_=a(!1);async function T(){_.value=!0;try{const u=await y.list();x.value=Array.isArray(u)?u:u.accounts||[]}finally{_.value=!1}}async function ee(u){await y.delete(u),await T()}async function h(u){await y.disable(u),await T()}async function te(u){await y.enable(u),await T()}async function Q(u){await Promise.all(u.map(L=>y.enable(L))),await T()}async function g(u){await Promise.all(u.map(L=>y.disable(L))),await T()}async function P(u){await Promise.all(u.map(L=>y.delete(L))),await T()}async function se(u){await y.updateConfig(u),await T()}return{accounts:x,isLoading:_,loadAccounts:T,deleteAccount:ee,disableAccount:h,enableAccount:te,bulkEnable:Q,bulkDisable:g,bulkDelete:P,updateConfig:se}}),ts={class:"space-y-8"},ss={class:"rounded-3xl border border-border bg-card p-6"},os={class:"flex flex-wrap items-center justify-between gap-4"},rs={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},ls={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},ns={class:"ml-auto flex items-center gap-2 sm:ml-0"},as={class:"mt-4 flex flex-wrap items-center gap-2"},is=["disabled"],us=["disabled"],ds={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},cs=["disabled"],fs=["disabled"],vs=["disabled"],xs=["disabled"],gs=["disabled"],ps={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},ms=["onClick"],bs={class:"flex items-start justify-between gap-3"},ys={class:"mt-1 font-mono text-xs text-foreground"},_s={class:"flex items-center gap-2"},ws={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},ks={key:0,class:"mt-1 text-[11px]"},hs={key:0},Cs={key:1},Ts={class:"mt-1 text-sm font-semibold text-foreground"},Ss={class:"mt-1 text-sm font-semibold text-foreground"},As={class:"mt-4 flex flex-wrap items-center gap-2"},Ls=["onClick"],Es=["onClick"],$s=["onClick"],Rs=["onClick"],Vs={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Is={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},js={class:"min-w-full text-left text-sm"},Ds={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Ms={class:"py-3 pr-4"},Os={class:"py-3 pr-6"},Bs={class:"inline-flex items-center gap-2"},Ns={class:"text-sm text-foreground"},Us={key:0},zs=["onClick"],Ps={class:"py-4 pr-6 font-mono text-xs text-foreground"},Fs={class:"py-4 pr-6"},Ks={class:"py-4 pr-6"},Hs={key:0,class:"block text-[11px] text-muted-foreground"},Js={class:"py-4 pr-6 text-xs"},Gs={class:"py-4 pr-6 text-xs text-muted-foreground"},Ys={class:"py-4 pr-6 text-xs text-muted-foreground"},Qs={class:"py-4 text-right"},qs={class:"flex flex-wrap justify-end gap-2"},Ws=["onClick"],Xs=["onClick"],Zs=["onClick"],eo=["onClick"],to={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},so={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},oo={class:"mt-4 space-y-4 text-sm"},ro={class:"mt-6 flex items-center justify-end gap-2"},lo=["disabled"],no={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ao={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},io={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},uo={class:"flex items-center gap-2"},co=["disabled"],fo={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},vo={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},xo={key:1,class:"mt-4 grid gap-3 text-xs text-muted-foreground"},go={key:0,class:"space-y-1"},po={class:"flex flex-wrap gap-x-4 gap-y-1"},mo={key:1,class:"space-y-1"},bo={class:"flex flex-wrap gap-x-4 gap-y-1"},yo={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},_o={key:0,class:"space-y-2"},wo={class:"space-y-1 text-[11px] text-muted-foreground"},ko={key:1,class:"mt-4 space-y-2"},ho={class:"space-y-1 text-[11px] text-muted-foreground"},Co={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},To={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},So={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Ao={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},Lo={class:"mt-4 space-y-3 text-sm"},Eo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},$o={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},Ro={class:"flex items-center justify-between"},Vo={class:"flex items-center gap-2"},Io={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},jo={class:"mt-4"},Do=["readonly"],Mo={class:"mt-6 flex items-center justify-end gap-2"},Oo=["disabled"],De="accounts-register-task-cache",Me="accounts-login-task-cache",Oe="accounts-register-log-clear",Be="accounts-login-log-clear",Ne="accounts-register-task-cleared-id",Ue="accounts-login-task-cleared-id",Ko=Kt({__name:"Accounts",setup(x){const _=es(),{accounts:T,isLoading:ee}=Ht(_),h=Xt(),te=a(""),Q=a("all"),g=a(new Set),P=a("table"),se=a(!1),u=a(""),L=a(!1),E=a(""),q=a(""),j=a(!1),oe=a([]),re=a(1),ce=a(!1),F=a(!1),D=a(!1),Ae=a(null),fe=a(null),ve=a(null),M=a(null),O=a(null),W=a(0),X=a(0),xe=a(!1),d=a(null),c=a(null),ze=a(null),$=a(!1),k=a(!1),p=a(""),m=a({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),ge=a(null),Pe=a([]),gt=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],B=N(()=>{const e=te.value.trim().toLowerCase();return T.value.filter(t=>{const o=!e||t.id.toLowerCase().includes(e),i=Q.value==="all"||le(t)===Q.value;return o&&i})}),R=N(()=>g.value.size),Le=N(()=>B.value.length>0&&B.value.every(e=>g.value.has(e.id))),pe=async()=>{await _.loadAccounts(),g.value=new Set,D.value=!1},Fe=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},Ke=e=>{try{return localStorage.getItem(e)||null}catch{return null}},me=(e,t)=>{try{if(t){localStorage.setItem(e,t);return}localStorage.removeItem(e)}catch{}},He=(e,t)=>{try{localStorage.setItem(e,JSON.stringify(t))}catch{}},Je=e=>{try{localStorage.removeItem(e)}catch{}},Ge=e=>{const t=localStorage.getItem(e),o=Number(t);return Number.isFinite(o)?o:0},be=(e,t)=>{try{localStorage.setItem(e,String(t))}catch{}},Ee=(e,t=!0)=>{e&&(e.id&&e.id===M.value||(e.id&&M.value&&e.id!==M.value&&(M.value=null,me(Ne,null)),d.value=e,e.id&&e.id!==fe.value&&(fe.value=e.id,W.value=0,be(Oe,0)),t&&He(De,e)))},ye=(e,t=!0)=>{e&&(e.id&&e.id===O.value||(e.id&&O.value&&e.id!==O.value&&(O.value=null,me(Ue,null)),c.value=e,e.id&&e.id!==ve.value&&(ve.value=e.id,X.value=0,be(Be,0)),t&&He(Me,e)))},pt=()=>{W.value=Ge(Oe),X.value=Ge(Be),M.value=Ke(Ne),O.value=Ke(Ue);const e=Fe(De);e&&e.id!==M.value&&(d.value=e,fe.value=e.id||null);const t=Fe(Me);t&&t.id!==O.value&&(c.value=t,ve.value=t.id||null)},mt=()=>{ce.value=!0,xe.value=!1},Ye=()=>{ce.value=!1},bt=async()=>{try{const e=[],t=d.value?.id,o=c.value?.id;if(t&&!_e(t)&&e.push(ct(t)),o&&!we(o)&&e.push(ft(o)),!e.length){await je();return}await Promise.all(e)}catch(e){p.value=e?.message||"任务状态更新失败"}},yt=async()=>{F.value=!0,await bt()},_t=()=>{F.value=!1},wt=()=>{const e=d.value?.id||null,t=c.value?.id||null;M.value=e,O.value=t,me(Ne,e),me(Ue,t),W.value=d.value?.logs?.length||0,X.value=c.value?.logs?.length||0,be(Oe,W.value),be(Be,X.value),d.value=null,c.value=null,fe.value=null,ve.value=null,p.value="",$.value=!1,k.value=!1,J(),G(),Je(De),Je(Me)},_e=e=>!!(e&&e===M.value),we=e=>!!(e&&e===O.value),kt=()=>{D.value=!D.value},Z=()=>{D.value=!1},Qe=e=>{if(!D.value)return;const t=e.target;Ae.value&&!Ae.value.contains(t)&&(D.value=!1)};Jt(async()=>{pt(),await pe(),await je(),Nt(),document.addEventListener("click",Qe)});const K=N(()=>{const e=d.value?.logs||[];return W.value?e.slice(W.value):e}),H=N(()=>{const e=c.value?.logs||[];return X.value?e.slice(X.value):e}),ht=N(()=>!!p.value||!!d.value||!!c.value||K.value.length>0||H.value.length>0),Ct=async()=>{await Qt();const e=ze.value;e&&(e.scrollTop=e.scrollHeight)};Gt([K,H,F],async()=>{F.value&&await Ct()},{deep:!0});const Tt=N(()=>{const e=d.value?.status,t=c.value?.status;return e==="running"||e==="pending"||t==="running"||t==="pending"}),St=N(()=>{if(p.value)return"bg-rose-500";if(Tt.value)return"bg-sky-400";const e=[];if(d.value){const f=d.value.success_count??0,w=d.value.fail_count??0,Y=d.value.count??f+w;e.push({success:f,fail:w,total:Y,status:d.value.status})}if(c.value){const f=c.value.success_count??0,w=c.value.fail_count??0,Y=c.value.account_ids?.length??f+w;e.push({success:f,fail:w,total:Y,status:c.value.status})}if(!e.length)return"bg-muted-foreground";const t=e.reduce((f,w)=>f+w.success,0),o=e.reduce((f,w)=>f+w.fail,0),i=e.reduce((f,w)=>f+(w.total||0),0);if(t>0&&o>0)return"bg-amber-400";if(o>0&&t===0)return"bg-rose-500";if(t>0&&o===0)return"bg-emerald-400";if(i===0){const f=e.every(Y=>Y.status==="success");if(e.some(Y=>Y.status==="failed"))return"bg-rose-500";if(f)return"bg-emerald-400"}return"bg-muted-foreground"});Yt(()=>{J(),G(),Bt(),document.removeEventListener("click",Qe)});const le=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?"429限流":e.cooldown_reason==="错误禁用"?"错误禁用":e.disabled?"手动禁用":e.status==="已过期"?"已过期":e.status==="即将过期"?"即将过期":"正常",qe=e=>{const t=le(e);return t==="429限流"||t==="即将过期"?"bg-amber-200 text-amber-900":t==="错误禁用"||t==="已过期"?"bg-destructive/10 text-destructive":t==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},We=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?!0:e.disabled||e.cooldown_reason==="错误禁用",Xe=e=>e==="已过期"?"过期":e==="未设置"?"未设置":e,Ze=e=>e.status==="已过期"?"text-rose-600":e.status==="即将过期"?"text-amber-700":e.status==="未设置"?"text-muted-foreground":"text-emerald-600",et=e=>e<60?`${e} 秒`:e<3600?`${Math.ceil(e/60)} 分钟`:`${(e/3600).toFixed(1)} 小时`,$e=e=>e.cooldown_seconds>0?"text-amber-700":e.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",tt=e=>{const t=le(e);return t==="手动禁用"||t==="已过期"?"bg-muted/70":""},ke=e=>{const t=new Set(g.value);t.has(e)?t.delete(e):t.add(e),g.value=t},st=()=>{if(Le.value){g.value=new Set;return}g.value=new Set(B.value.map(e=>e.id))},At=(e,t)=>e.id||`account_${t+1}`,Lt=async()=>(await y.getConfig()).accounts.map((t,o)=>({...t,id:At(t,o)})),ot=e=>`${e.time} [${e.level}] ${e.message}`,Et=(e,t)=>{let o=-1;for(let f=0;f<e.length;f+=1)if(e[f].id===t){o=f;break}if(o===-1)return u.value="未找到对应账号配置。",!1;const i=e[o];return m.value={id:i.id,secure_c_ses:i.secure_c_ses,csesidx:i.csesidx,config_id:i.config_id,host_c_oses:i.host_c_oses,expires_at:i.expires_at},Pe.value=e,ge.value=o,se.value=!0,!0},rt=async e=>{u.value="";try{const t=await Lt();Et(t,e)}catch(t){u.value=t.message||"加载账号配置失败"}},$t=async()=>{E.value="";try{const e=await y.getConfig();oe.value=Array.isArray(e.accounts)?e.accounts:[],q.value=JSON.stringify(nt(oe.value),null,2),j.value=!0,L.value=!0}catch(e){E.value=e.message||"加载账号配置失败"}},Re=()=>{L.value=!1,E.value="",j.value=!1},lt=()=>{const e=JSON.parse(q.value);if(!Array.isArray(e))throw new Error("配置格式必须是数组。");return e},Rt=e=>typeof e!="string"||!e?e:e.length<=6?`${e.slice(0,2)}****`:`${e.slice(0,3)}****`,nt=e=>{const t=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password"]);return e.map(o=>{const i={...o};return t.forEach(f=>{const w=i[f];w&&(i[f]=Rt(w))}),i})},Vt=()=>{if(E.value="",!j.value){try{oe.value=lt()}catch(e){E.value=e.message||"JSON 格式错误";return}q.value=JSON.stringify(nt(oe.value),null,2),j.value=!0;return}q.value=JSON.stringify(oe.value,null,2),j.value=!1},It=async()=>{E.value="";try{const e=lt();await _.updateConfig(e),Re()}catch(e){E.value=e.message||"保存失败"}},Ve=()=>{se.value=!1,u.value=""},jt=async()=>{if(ge.value===null)return;const e=[...Pe.value];e[ge.value]={...e[ge.value],id:m.value.id,secure_c_ses:m.value.secure_c_ses,csesidx:m.value.csesidx,config_id:m.value.config_id,host_c_oses:m.value.host_c_oses||void 0,expires_at:m.value.expires_at||void 0};try{await _.updateConfig(e),Ve()}catch(t){u.value=t.message||"保存失败"}},Dt=async()=>{await _.bulkEnable(Array.from(g.value)),g.value=new Set},Mt=async()=>{await h.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"})&&(await _.bulkDisable(Array.from(g.value)),g.value=new Set)},Ot=async()=>{await h.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"})&&(await _.bulkDelete(Array.from(g.value)),g.value=new Set)},at=async e=>{await _.enableAccount(e)},it=async e=>{await h.ask({title:"禁用账号",message:"确定要禁用该账号吗?"})&&await _.disableAccount(e)},ut=async e=>{await h.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"})&&await _.deleteAccount(e)};let ne=null,ae=null,ie=null,he=!1;const J=()=>{ne!==null&&(window.clearInterval(ne),ne=null)},G=()=>{ae!==null&&(window.clearInterval(ae),ae=null)},Bt=()=>{ie!==null&&(window.clearInterval(ie),ie=null),he=!1},dt=e=>e==="pending"?"等待中":e==="running"?"执行中":e==="success"?"成功":e==="failed"?"失败":e,ct=async e=>{if(_e(e)){J();return}const t=await y.getRegisterTask(e);if(_e(t.id)){J();return}Ee(t),t.status!=="running"&&t.status!=="pending"&&($.value=!1,J(),await pe())},ft=async e=>{if(we(e)){G();return}const t=await y.getLoginTask(e);if(we(t.id)){G();return}ye(t),t.status!=="running"&&t.status!=="pending"&&(k.value=!1,G(),await pe())},vt=e=>{J(),ne=window.setInterval(()=>{ct(e).catch(t=>{p.value=t?.message||"注册任务更新失败",J(),$.value=!1})},3e3)},Ie=e=>{G(),ae=window.setInterval(()=>{ft(e).catch(t=>{p.value=t?.message||"刷新任务更新失败",G(),k.value=!1})},3e3)},Nt=()=>{ie===null&&(ie=window.setInterval(async()=>{if(!he&&!F.value&&!(ne!==null||ae!==null)&&!(!$.value&&!k.value&&!d.value&&!c.value)){he=!0;try{await je()}catch(e){p.value=e?.message||"后台刷新失败"}finally{he=!1}}},6e3))},je=async()=>{try{const e=await y.getRegisterCurrent();e&&"id"in e&&!_e(e.id)&&(Ee(e),(e.status==="running"||e.status==="pending")&&($.value=!0,vt(e.id)))}catch(e){p.value=e.message||"加载注册任务失败"}try{const e=await y.getLoginCurrent();e&&"id"in e&&!we(e.id)&&(ye(e),(e.status==="running"||e.status==="pending")&&(k.value=!0,Ie(e.id)))}catch(e){p.value=e.message||"加载刷新任务失败"}},Ut=async()=>{p.value="",$.value=!0;try{const e=Number.isFinite(re.value)&&re.value>0?re.value:void 0,t=await y.startRegister(e);Ee(t),vt(t.id),ce.value=!1,F.value=!0}catch(e){p.value=e.message||"启动注册失败",$.value=!1}},zt=async()=>{if(g.value.size){p.value="",k.value=!0;try{const e=await y.startLogin(Array.from(g.value));ye(e),Ie(e.id)}catch(e){p.value=e.message||"启动刷新失败",k.value=!1}}},Pt=async()=>{p.value="",k.value=!0;try{await y.checkLogin();const e=await y.getLoginCurrent();if(e&&"id"in e){ye(e),Ie(e.id);return}k.value=!1}catch(e){p.value=e.message||"触发刷新失败",k.value=!1}};return(e,t)=>(r(),l(ue,null,[s("div",ts,[s("section",ss,[s("div",os,[s("div",rs,[V(s("input",{"onUpdate:modelValue":t[0]||(t[0]=o=>te.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[I,te.value]]),U(qt,{modelValue:Q.value,"onUpdate:modelValue":t[1]||(t[1]=o=>Q.value=o),options:gt},null,8,["modelValue"])]),s("div",ls,[U(de,{modelValue:Le.value,"onUpdate:modelValue":st},{default:xt(()=>[...t[24]||(t[24]=[z(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+n(R.value)+" / "+n(B.value.length)+" 个账号",1),s("div",ns,[s("button",{type:"button",class:b(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",P.value==="table"?"bg-accent text-accent-foreground":""]),onClick:t[2]||(t[2]=o=>P.value="table"),"aria-label":"列表视图"},[...t[25]||(t[25]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:b(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",P.value==="card"?"bg-accent text-accent-foreground":""]),onClick:t[3]||(t[3]=o=>P.value="card"),"aria-label":"卡片视图"},[...t[26]||(t[26]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",as,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:S(ee),onClick:pe}," 刷新列表 ",8,is),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:$t}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:$.value,onClick:mt}," 添加账户 ",8,us),s("div",{ref_key:"moreActionsRef",ref:Ae,class:"relative"},[s("button",{class:b(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",D.value?"bg-accent text-accent-foreground":""]),onClick:kt},[t[27]||(t[27]=z(" 更多操作 ",-1)),t[28]||(t[28]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),ht.value?(r(),l("span",{key:0,class:b(["ml-1 h-2 w-2 rounded-full",St.value]),"aria-hidden":"true"},null,2)):v("",!0)],2),D.value?(r(),l("div",ds,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:t[4]||(t[4]=o=>{yt(),Z()})}," 任务状态 "),t[29]||(t[29]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",k.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:k.value,onClick:t[5]||(t[5]=o=>{Pt(),Z()})}," 刷新过期 ",10,cs),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!R.value||k.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!R.value||k.value,onClick:t[6]||(t[6]=o=>{zt(),Z()})}," 刷新选中 ",10,fs),t[30]||(t[30]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",R.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!R.value,onClick:t[7]||(t[7]=o=>{Dt(),Z()})}," 批量启用 ",10,vs),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",R.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!R.value,onClick:t[8]||(t[8]=o=>{Mt(),Z()})}," 批量禁用 ",10,xs),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",R.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!R.value,onClick:t[9]||(t[9]=o=>{Ot(),Z()})}," 批量删除 ",10,gs)])):v("",!0)],512)]),P.value==="card"?(r(),l("div",ps,[(r(!0),l(ue,null,Te(B.value,o=>(r(),l("div",{key:o.id,class:b(["rounded-2xl border border-border bg-card p-4",tt(o)]),onClick:i=>ke(o.id)},[s("div",bs,[s("div",null,[t[31]||(t[31]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",ys,n(o.id),1)]),s("div",_s,[U(de,{modelValue:g.value.has(o.id),"onUpdate:modelValue":i=>ke(o.id),onClick:t[10]||(t[10]=A(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:b(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",qe(o)])},n(le(o)),3)])]),s("div",ws,[s("div",null,[t[32]||(t[32]=s("p",null,"剩余时间",-1)),s("p",{class:b(["mt-1 text-sm font-semibold",Ze(o)])},n(Xe(o.remaining_display)),3),o.expires_at?(r(),l("p",ks,n(o.expires_at),1)):v("",!0)]),s("div",null,[t[33]||(t[33]=s("p",null,"冷却",-1)),s("p",{class:b(["mt-1",$e(o)])},[o.cooldown_seconds>0?(r(),l("span",hs,n(et(o.cooldown_seconds))+" · "+n(o.cooldown_reason),1)):(r(),l("span",Cs,n(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[t[34]||(t[34]=s("p",null,"失败数",-1)),s("p",Ts,n(o.error_count),1)]),s("div",null,[t[35]||(t[35]=s("p",null,"会话数",-1)),s("p",Ss,n(o.conversation_count),1)])]),s("div",As,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>rt(o.id),["stop"])}," 编辑 ",8,Ls),We(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[11]||(t[11]=A(()=>{},["stop"])),i=>at(o.id)]}," 启用 ",8,Es)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[12]||(t[12]=A(()=>{},["stop"])),i=>it(o.id)]}," 禁用 ",8,$s)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[t[13]||(t[13]=A(()=>{},["stop"])),i=>ut(o.id)]}," 删除 ",8,Rs)])],10,ms))),128)),!B.value.length&&!S(ee)?(r(),l("div",Vs," 暂无账号数据,请检查后台配置。 ")):v("",!0)])):(r(),l("div",Is,[s("table",js,[s("thead",Ds,[s("tr",null,[s("th",Ms,[U(de,{modelValue:Le.value,"onUpdate:modelValue":st},null,8,["modelValue"])]),t[37]||(t[37]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),t[38]||(t[38]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",Os,[s("span",Bs,[t[36]||(t[36]=z(" 剩余/过期 ",-1)),U(Zt,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),t[39]||(t[39]=s("th",{class:"py-3 pr-6"},"冷却",-1)),t[40]||(t[40]=s("th",{class:"py-3 pr-6"},"失败数",-1)),t[41]||(t[41]=s("th",{class:"py-3 pr-6"},"会话数",-1)),t[42]||(t[42]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",Ns,[!B.value.length&&!S(ee)?(r(),l("tr",Us,[...t[43]||(t[43]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):v("",!0),(r(!0),l(ue,null,Te(B.value,o=>(r(),l("tr",{key:o.id,class:b(["border-t border-border",tt(o)]),onClick:i=>ke(o.id)},[s("td",{class:"py-4 pr-4",onClick:t[14]||(t[14]=A(()=>{},["stop"]))},[U(de,{modelValue:g.value.has(o.id),"onUpdate:modelValue":i=>ke(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",Ps,n(o.id),1),s("td",Fs,[s("span",{class:b(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",qe(o)])},n(le(o)),3)]),s("td",Ks,[s("div",{class:b(["text-sm font-semibold",Ze(o)])},n(Xe(o.remaining_display)),3),o.expires_at?(r(),l("span",Hs,n(o.expires_at),1)):v("",!0)]),s("td",Js,[o.cooldown_seconds>0?(r(),l("span",{key:0,class:b($e(o))},n(et(o.cooldown_seconds))+" · "+n(o.cooldown_reason),3)):(r(),l("span",{key:1,class:b($e(o))},n(o.cooldown_reason||"无冷却"),3))]),s("td",Gs,n(o.error_count),1),s("td",Ys,n(o.conversation_count),1),s("td",Qs,[s("div",qs,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>rt(o.id),["stop"])}," 编辑 ",8,Ws),We(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>at(o.id),["stop"])}," 启用 ",8,Xs)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>it(o.id),["stop"])}," 禁用 ",8,Zs)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:A(i=>ut(o.id),["stop"])}," 删除 ",8,eo)])])],10,zs))),128))])])]))])]),U(Wt,{open:S(h).open.value,title:S(h).title.value,message:S(h).message.value,"confirm-text":S(h).confirmText.value,"cancel-text":S(h).cancelText.value,onConfirm:S(h).confirm,onCancel:S(h).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(r(),Ce(Se,{to:"body"},[ce.value?(r(),l("div",to,[s("div",so,[s("div",{class:"flex items-center justify-between"},[t[44]||(t[44]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"添加账户"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"创建 DuckMail 账号并自动注册")],-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Ye}," 关闭 ")]),s("div",oo,[t[46]||(t[46]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),V(s("input",{"onUpdate:modelValue":t[15]||(t[15]=o=>re.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,re.value,void 0,{number:!0}]]),t[47]||(t[47]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"}," 默认域名来自设置面板(可在“配置面板”中修改) ",-1)),t[48]||(t[48]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-[11px] leading-relaxed text-muted-foreground"},[s("div",{class:"space-y-2"},[s("p",{class:"font-semibold text-rose-600"},"⚠️ 严禁滥用:禁止将本工具用于商业用途或任何形式的滥用(无论规模大小)"),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"合法用途:"),z("本项目仅限个人学习、技术研究与非商业性技术交流,旨在探索浏览器自动化与系统集成。")])]),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"禁止行为:"),z("严禁用于以下场景:")]),s("p",{class:"pl-3"},"• 商业用途或盈利性使用"),s("p",{class:"pl-3"},"• 任何形式的批量注册或自动化滥用(无论规模大小)"),s("p",{class:"pl-3"},"• 破坏市场秩序或恶意竞争"),s("p",{class:"pl-3"},"• 违反 Google 服务条款的任何行为")]),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"使用责任:"),z("因使用本工具产生的一切后果由使用者完全承担,包括但不限于账号封禁、数据损失及法律责任。")]),s("p",null,[s("strong",null,"合规要求:"),z("使用者必须遵守所在地法律法规及第三方服务条款,作者不对任何违规使用行为承担责任。")])]),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"技术声明:")]),s("p",{class:"pl-3"},'• 本项目按"现状"提供,不提供任何明示或暗示的担保'),s("p",{class:"pl-3"},"• 依赖 DuckMail API 等第三方服务,其可用性不受作者控制"),s("p",{class:"pl-3"},"• 作者保留随时停止维护或变更功能的权利")])])],-1)),U(de,{modelValue:xe.value,"onUpdate:modelValue":t[16]||(t[16]=o=>xe.value=o)},{default:xt(()=>[...t[45]||(t[45]=[z(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])]),s("div",ro,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ye}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:$.value||!xe.value,onClick:Ut}," 开始注册 ",8,lo)])])])):v("",!0)])),(r(),Ce(Se,{to:"body"},[F.value?(r(),l("div",no,[s("div",ao,[s("div",io,[t[49]||(t[49]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",uo,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary",disabled:!K.value.length&&!H.value.length&&!d.value&&!c.value&&!p.value,onClick:wt}," 清空日志 ",8,co),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:_t}," 关闭 ")])]),s("div",fo,[p.value?(r(),l("div",vo,n(p.value),1)):v("",!0),d.value||c.value?(r(),l("div",xo,[d.value?(r(),l("div",go,[t[50]||(t[50]=s("div",{class:"font-medium text-foreground"},"注册任务",-1)),s("div",po,[s("span",null,"状态:"+n(dt(d.value.status)),1),s("span",null,"进度:"+n(d.value.progress)+"/"+n(d.value.count),1),s("span",null,"成功:"+n(d.value.success_count),1),s("span",null,"失败:"+n(d.value.fail_count),1)])])):v("",!0),c.value?(r(),l("div",mo,[t[51]||(t[51]=s("div",{class:"font-medium text-foreground"},"刷新任务",-1)),s("div",bo,[s("span",null,"状态:"+n(dt(c.value.status)),1),s("span",null,"进度:"+n(c.value.progress)+"/"+n(c.value.account_ids.length),1),s("span",null,"成功:"+n(c.value.success_count),1),s("span",null,"失败:"+n(c.value.fail_count),1)])])):v("",!0)])):v("",!0),K.value.length||H.value.length?(r(),l("div",yo,[s("div",{ref_key:"taskLogsRef",ref:ze,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[K.value.length?(r(),l("div",_o,[t[52]||(t[52]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",wo,[(r(!0),l(ue,null,Te(K.value,(o,i)=>(r(),l("div",{key:`reg-${i}`,class:"font-mono"},n(ot(o)),1))),128))])])):v("",!0),H.value.length?(r(),l("div",ko,[t[53]||(t[53]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",ho,[(r(!0),l(ue,null,Te(H.value,(o,i)=>(r(),l("div",{key:`login-${i}`,class:"font-mono"},n(ot(o)),1))),128))])])):v("",!0)],512)])):v("",!0),!p.value&&!d.value&&!c.value&&!K.value.length&&!H.value.length?(r(),l("div",Co," 暂无任务 ")):v("",!0)])])])):v("",!0)])),(r(),Ce(Se,{to:"body"},[se.value?(r(),l("div",To,[s("div",So,[s("div",{class:"flex items-center justify-between"},[t[54]||(t[54]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Ve}," 关闭 ")]),u.value?(r(),l("div",Ao,n(u.value),1)):v("",!0),s("div",Lo,[t[55]||(t[55]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),V(s("input",{"onUpdate:modelValue":t[17]||(t[17]=o=>m.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[I,m.value.id]]),t[56]||(t[56]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),V(s("textarea",{"onUpdate:modelValue":t[18]||(t[18]=o=>m.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[I,m.value.secure_c_ses]]),t[57]||(t[57]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),V(s("input",{"onUpdate:modelValue":t[19]||(t[19]=o=>m.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,m.value.csesidx]]),t[58]||(t[58]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),V(s("input",{"onUpdate:modelValue":t[20]||(t[20]=o=>m.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,m.value.config_id]]),t[59]||(t[59]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),V(s("input",{"onUpdate:modelValue":t[21]||(t[21]=o=>m.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,m.value.host_c_oses]]),t[60]||(t[60]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),V(s("input",{"onUpdate:modelValue":t[22]||(t[22]=o=>m.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[I,m.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ve}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:jt}," 保存 ")])])])):v("",!0)])),(r(),Ce(Se,{to:"body"},[L.value?(r(),l("div",Eo,[s("div",$o,[s("div",Ro,[t[61]||(t[61]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",Vo,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Vt},n(j.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Re}," 关闭 ")])]),E.value?(r(),l("div",Io,n(E.value),1)):v("",!0),s("div",jo,[V(s("textarea",{"onUpdate:modelValue":t[23]||(t[23]=o=>q.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:j.value},null,8,Do),[[I,q.value]])]),s("div",Mo,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Re}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:It,disabled:j.value}," 保存 ",8,Oo)])])])):v("",!0)]))],64))}});export{Ko as default};
static/assets/Accounts-DIoN-Ccm.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ import{g as E,C as os,h as i,d as rs,D as ls,i as J,o as ns,z as as,j as is,c as n,a as s,p as G,m as Re,q as R,v as V,s as $t,t as a,n as p,u as j,b as g,f as ee,F as ge,r as Ve,T as je,E as ds,w as M,e as l,G as us}from"./index-Bjh6Z8Zq.js";import{_ as cs}from"./SelectMenu.vue_vue_type_script_setup_true_lang-DG1nunQt.js";import{_ as be}from"./Checkbox.vue_vue_type_script_setup_true_lang-zogPNTWE.js";import{_ as fs}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-NECRqKOO.js";import{u as vs}from"./useConfirmDialog-GDc9JuxO.js";import{_ as ms}from"./HelpTip.vue_vue_type_script_setup_true_lang-D_8sK7BY.js";const w={list:()=>E.get("/admin/accounts"),getConfig:()=>E.get("/admin/accounts-config"),updateConfig:y=>E.put("/admin/accounts-config",y),delete:y=>E.delete(`/admin/accounts/${y}`),disable:y=>E.put(`/admin/accounts/${y}/disable`),enable:y=>E.put(`/admin/accounts/${y}/enable`),startRegister:(y,k)=>E.post("/admin/register/start",{count:y,domain:k}),getRegisterTask:y=>E.get(`/admin/register/task/${y}`),getRegisterCurrent:()=>E.get("/admin/register/current"),startLogin:y=>E.post("/admin/login/start",y),getLoginTask:y=>E.get(`/admin/login/task/${y}`),getLoginCurrent:()=>E.get("/admin/login/current"),checkLogin:()=>E.post("/admin/login/check")},ps=os("accounts",()=>{const y=i([]),k=i(!1);async function A(){k.value=!0;try{const x=await w.list();y.value=Array.isArray(x)?x:x.accounts||[]}finally{k.value=!1}}async function ne(x){await w.delete(x),await A()}async function T(x){await w.disable(x),await A()}async function d(x){await w.enable(x),await A()}async function ae(x){await Promise.all(x.map($=>w.enable($))),await A()}async function te(x){await Promise.all(x.map($=>w.disable($))),await A()}async function b(x){await Promise.all(x.map($=>w.delete($))),await A()}async function Y(x){await w.updateConfig(x),await A()}return{accounts:y,isLoading:k,loadAccounts:A,deleteAccount:ne,disableAccount:T,enableAccount:d,bulkEnable:ae,bulkDisable:te,bulkDelete:b,updateConfig:Y}}),xs={class:"space-y-8"},gs={class:"rounded-3xl border border-border bg-card p-6"},bs={class:"flex flex-wrap items-center justify-between gap-4"},ys={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},_s={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},hs={class:"ml-auto flex items-center gap-2 sm:ml-0"},ws={class:"mt-4 flex flex-wrap items-center gap-2"},ks=["disabled"],Cs=["disabled"],Ts={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},Ss=["disabled"],$s=["disabled"],Is=["disabled"],Es=["disabled"],Ls=["disabled"],As={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},Rs=["onClick"],Vs={class:"flex items-start justify-between gap-3"},js={class:"mt-1 font-mono text-xs text-foreground"},Ms={class:"flex items-center gap-2"},Ds={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},Os={key:0,class:"mt-1 text-[11px]"},Bs={key:0},Ns={key:1},Us={class:"mt-1 text-sm font-semibold text-foreground"},zs={class:"mt-1 text-sm font-semibold text-foreground"},Ps={class:"mt-4 flex flex-wrap items-center gap-2"},Fs=["onClick"],Ks=["onClick"],Hs=["onClick"],Js=["onClick"],Gs={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Ys={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},qs={class:"min-w-full text-left text-sm"},Qs={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Xs={class:"py-3 pr-4"},Ws={class:"py-3 pr-6"},Zs={class:"inline-flex items-center gap-2"},eo={class:"text-sm text-foreground"},to={key:0},so=["onClick"],oo={class:"py-4 pr-6 font-mono text-xs text-foreground"},ro={class:"py-4 pr-6"},lo={class:"py-4 pr-6"},no={key:0,class:"block text-[11px] text-muted-foreground"},ao={class:"py-4 pr-6 text-xs"},io={class:"py-4 pr-6 text-xs text-muted-foreground"},uo={class:"py-4 pr-6 text-xs text-muted-foreground"},co={class:"py-4 text-right"},fo={class:"flex flex-wrap justify-end gap-2"},vo=["onClick"],mo=["onClick"],po=["onClick"],xo=["onClick"],go={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},bo={class:"flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},yo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},_o={class:"mt-1 text-xs text-muted-foreground"},ho={class:"scrollbar-slim flex-1 overflow-y-auto px-6 py-4"},wo={class:"space-y-4 text-sm"},ko={class:"flex rounded-full border border-border bg-muted/30 p-1 text-xs"},Co={key:0,class:"space-y-4"},To={key:1,class:"space-y-4"},So={key:0,class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-600"},$o={class:"border-t border-border/60 px-6 py-4"},Io={class:"flex items-center justify-end gap-2"},Eo=["disabled"],Lo=["disabled"],Ao={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Ro={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},Vo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},jo={class:"flex items-center gap-2"},Mo=["disabled"],Do={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},Oo={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},Bo={key:1,class:"grid gap-3 text-xs text-muted-foreground"},No={key:0,class:"space-y-1"},Uo={class:"flex items-center gap-2 font-medium text-foreground"},zo={class:"flex flex-wrap gap-x-4 gap-y-1"},Po={key:1,class:"space-y-1"},Fo={class:"flex items-center gap-2 font-medium text-foreground"},Ko={class:"flex flex-wrap gap-x-4 gap-y-1"},Ho={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},Jo={key:0,class:"space-y-2"},Go={class:"space-y-1 text-[11px] text-muted-foreground"},Yo={key:1,class:"mt-4 space-y-2"},qo={class:"space-y-1 text-[11px] text-muted-foreground"},Qo={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},Xo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Wo={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Zo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},er={class:"mt-4 space-y-3 text-sm"},tr={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},sr={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},or={class:"flex items-center justify-between"},rr={class:"flex items-center gap-2"},lr={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},nr={class:"mt-4"},ar=["readonly"],ir={class:"mt-6 flex items-center justify-end gap-2"},dr=["disabled"],Je="accounts-register-task-cache",Ge="accounts-login-task-cache",Ye="accounts-register-log-clear",qe="accounts-login-log-clear",Qe="accounts-register-task-cleared-id",Xe="accounts-login-task-cleared-id",It="1970-01-01 00:00:00",xr=rs({__name:"Accounts",setup(y){const k=ps(),{accounts:A,isLoading:ne}=ls(k),T=vs(),d=ds(),ae=i(""),te=i("all"),b=i(new Set),Y=i("table"),x=i(!1),$=i(""),Me=i(!1),D=i(""),se=i(""),N=i(!1),ie=i([]),de=i(1),ye=i(!1),U=i("register"),ue=i(""),z=i(""),_e=i(!1),q=i(!1),P=i(!1),De=i(null),he=i(null),we=i(null),F=i(null),K=i(null),oe=i(0),re=i(0),ce=i(!1),c=i(null),f=i(null),We=i(null),O=i(!1),S=i(!1),_=i(""),h=i({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),ke=i(null),Ze=i([]),Et=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],H=J(()=>{const t=ae.value.trim().toLowerCase();return A.value.filter(e=>{const o=!t||e.id.toLowerCase().includes(t),r=te.value==="all"||ve(e)===te.value;return o&&r})}),B=J(()=>b.value.size),Oe=J(()=>H.value.length>0&&H.value.every(t=>b.value.has(t.id))),fe=async()=>{await k.loadAccounts(),b.value=new Set,P.value=!1},et=t=>{try{const e=localStorage.getItem(t);return e?JSON.parse(e):null}catch{return null}},tt=t=>{try{return localStorage.getItem(t)||null}catch{return null}},Ce=(t,e)=>{try{if(e){localStorage.setItem(t,e);return}localStorage.removeItem(t)}catch{}},st=(t,e)=>{try{localStorage.setItem(t,JSON.stringify(e))}catch{}},ot=t=>{try{localStorage.removeItem(t)}catch{}},rt=t=>{const e=localStorage.getItem(t),o=Number(e);return Number.isFinite(o)?o:0},Te=(t,e)=>{try{localStorage.setItem(t,String(e))}catch{}},Be=(t,e=!0)=>{t&&(t.id&&t.id===F.value||(t.id&&F.value&&t.id!==F.value&&(F.value=null,Ce(Qe,null)),c.value=t,t.id&&t.id!==he.value&&(he.value=t.id,oe.value=0,Te(Ye,0)),e&&st(Je,t)))},Se=(t,e=!0)=>{t&&(t.id&&t.id===K.value||(t.id&&K.value&&t.id!==K.value&&(K.value=null,Ce(Xe,null)),f.value=t,t.id&&t.id!==we.value&&(we.value=t.id,re.value=0,Te(qe,0)),e&&st(Ge,t)))},Lt=()=>{oe.value=rt(Ye),re.value=rt(qe),F.value=tt(Qe),K.value=tt(Xe);const t=et(Je);t&&t.id!==F.value&&(c.value=t,he.value=t.id||null);const e=et(Ge);e&&e.id!==K.value&&(f.value=e,we.value=e.id||null)},At=()=>{ye.value=!0,U.value="register",ue.value="",z.value="",_e.value=!1,ce.value=!1},Ne=()=>{ye.value=!1},Rt=t=>{const e=[],o=[];return t.split(/\r?\n/).map(u=>u.trim()).filter(Boolean).forEach((u,m)=>{const v=u.split("----").map(I=>I.trim()),C=m+1;if(v.length){if(v[0].toLowerCase()==="duckmail"){if(v.length<3||!v[1]||!v[2]){o.push(`第 ${C} 行格式错误(duckmail)`);return}const I=v[1],Ae=v.slice(2).join("----");e.push({id:I,secure_c_ses:"",csesidx:"",config_id:"",expires_at:It,mail_provider:"duckmail",mail_address:I,mail_password:Ae});return}if(v.length>=4&&v[0]&&v[2]&&v[3]){const I=v[0],Ae=v[1]||"",L=v[2],ss=v.slice(3).join("----");e.push({id:I,secure_c_ses:"",csesidx:"",config_id:"",expires_at:It,mail_provider:"microsoft",mail_address:I,mail_password:Ae,mail_client_id:L,mail_refresh_token:ss,mail_tenant:"consumers"});return}o.push(`第 ${C} 行格式错误`)}}),{items:e,errors:o}},Vt=async()=>{if(z.value="",!ue.value.trim()){z.value="请输入导��内容";return}const{items:t,errors:e}=Rt(ue.value);if(!t.length){z.value=e.length?e.join(","):"未识别到有效账号";return}if(e.length){z.value=e.slice(0,3).join(",");return}_e.value=!0;try{const r=[...await vt()],u=new Map(r.map((C,I)=>[C.id,I])),m=[];t.forEach(C=>{const I=u.get(C.id||"");if(I===void 0){r.push(C),m.push(C.id);return}const L={...r[I],mail_provider:C.mail_provider,mail_address:C.mail_address};C.mail_provider==="microsoft"?(L.mail_client_id=C.mail_client_id,L.mail_refresh_token=C.mail_refresh_token,L.mail_tenant=C.mail_tenant,L.mail_password=C.mail_password):(L.mail_password=C.mail_password,L.mail_client_id=void 0,L.mail_refresh_token=void 0,L.mail_tenant=void 0),r[I]=L,m.push(C.id)}),await k.updateConfig(r),await fe(),b.value=new Set(m),d.success(`成功导入 ${m.length} 个账户`),Ne(),await T.ask({title:"导入成功",message:`已导入 ${m.length} 个账户并自动选中。是否立即刷新这些账户以获取 Cookie?`,confirmText:"立即刷新",cancelText:"稍后手动刷新"})&&await St()}catch(o){z.value=o.message||"导入失败",d.error(o.message||"导入失败")}finally{_e.value=!1}},jt=async()=>{try{const t=[],e=c.value?.id,o=f.value?.id;if(e&&!$e(e)&&t.push(kt(e)),o&&!Ie(o)&&t.push(Ct(o)),!t.length){await He();return}await Promise.all(t)}catch(t){_.value=t?.message||"任务状态更新失败"}},Ue=async()=>{q.value=!0,await jt()},Mt=()=>{q.value=!1},Dt=()=>{const t=c.value?.id||null,e=f.value?.id||null;F.value=t,K.value=e,Ce(Qe,t),Ce(Xe,e),oe.value=c.value?.logs?.length||0,re.value=f.value?.logs?.length||0,Te(Ye,oe.value),Te(qe,re.value),c.value=null,f.value=null,he.value=null,we.value=null,_.value="",O.value=!1,S.value=!1,W(),Z(),ot(Je),ot(Ge)},$e=t=>!!(t&&t===F.value),Ie=t=>!!(t&&t===K.value),Ot=()=>{P.value=!P.value},le=()=>{P.value=!1},lt=t=>{if(!P.value)return;const e=t.target;De.value&&!De.value.contains(e)&&(P.value=!1)};ns(async()=>{Lt(),await fe(),await He(),Zt(),document.addEventListener("click",lt)});const Q=J(()=>{const t=c.value?.logs||[];return oe.value?t.slice(oe.value):t}),X=J(()=>{const t=f.value?.logs||[];return re.value?t.slice(re.value):t}),Bt=J(()=>!!_.value||!!c.value||!!f.value||Q.value.length>0||X.value.length>0),Nt=async()=>{await us();const t=We.value;t&&(t.scrollTop=t.scrollHeight)};as([Q,X,q],async()=>{q.value&&await Nt()},{deep:!0});const Ut=J(()=>{const t=c.value?.status,e=f.value?.status;return t==="running"||t==="pending"||e==="running"||e==="pending"}),zt=J(()=>{if(_.value)return"bg-rose-500";if(Ut.value)return"bg-sky-400";const t=[];if(c.value){const u=c.value.success_count??0,m=c.value.fail_count??0,v=c.value.count??u+m;t.push({success:u,fail:m,total:v,status:c.value.status})}if(f.value){const u=f.value.success_count??0,m=f.value.fail_count??0,v=f.value.account_ids?.length??u+m;t.push({success:u,fail:m,total:v,status:f.value.status})}if(!t.length)return"bg-muted-foreground";const e=t.reduce((u,m)=>u+m.success,0),o=t.reduce((u,m)=>u+m.fail,0),r=t.reduce((u,m)=>u+(m.total||0),0);if(e>0&&o>0)return"bg-amber-400";if(o>0&&e===0)return"bg-rose-500";if(e>0&&o===0)return"bg-emerald-400";if(r===0){const u=t.every(v=>v.status==="success");if(t.some(v=>v.status==="failed"))return"bg-rose-500";if(u)return"bg-emerald-400"}return"bg-muted-foreground"});is(()=>{W(),Z(),Wt(),document.removeEventListener("click",lt)});const ve=t=>t.cooldown_reason?.includes("429")&&t.cooldown_seconds>0?"429限流":t.cooldown_reason==="错误禁用"?"错误禁用":t.disabled?"手动禁用":t.status==="已过期"?"已过期":t.status==="即将过期"?"即将过期":"正常",nt=t=>{const e=ve(t);return e==="429限流"||e==="即将过期"?"bg-amber-200 text-amber-900":e==="错误禁用"||e==="已过期"?"bg-destructive/10 text-destructive":e==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},at=t=>t.cooldown_reason?.includes("429")&&t.cooldown_seconds>0?!0:t.disabled||t.cooldown_reason==="错误禁用",it=t=>t==="已过期"?"过期":t==="未设置"?"未设置":t,dt=t=>t.status==="已过期"?"text-rose-600":t.status==="即将过期"?"text-amber-700":t.status==="未设置"?"text-muted-foreground":"text-emerald-600",ut=t=>t<60?`${t} 秒`:t<3600?`${Math.ceil(t/60)} 分钟`:`${(t/3600).toFixed(1)} 小时`,ze=t=>t.cooldown_seconds>0?"text-amber-700":t.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",ct=t=>{const e=ve(t);return e==="手动禁用"||e==="已过期"?"bg-muted/70":""},Ee=t=>{const e=new Set(b.value);e.has(t)?e.delete(t):e.add(t),b.value=e},ft=()=>{if(Oe.value){b.value=new Set;return}b.value=new Set(H.value.map(t=>t.id))},Pt=(t,e)=>t.id||`account_${e+1}`,vt=async()=>(await w.getConfig()).accounts.map((e,o)=>({...e,id:Pt(e,o)})),mt=t=>`${t.time} [${t.level}] ${t.message}`,Ft=(t,e)=>{let o=-1;for(let u=0;u<t.length;u+=1)if(t[u].id===e){o=u;break}if(o===-1)return $.value="未找到对应账号配置。",!1;const r=t[o];return h.value={id:r.id,secure_c_ses:r.secure_c_ses,csesidx:r.csesidx,config_id:r.config_id,host_c_oses:r.host_c_oses,expires_at:r.expires_at},Ze.value=t,ke.value=o,x.value=!0,!0},pt=async t=>{$.value="";try{const e=await vt();Ft(e,t)}catch(e){$.value=e.message||"加载账号配置失败"}},Kt=async()=>{D.value="";try{const t=await w.getConfig();ie.value=Array.isArray(t.accounts)?t.accounts:[],se.value=JSON.stringify(gt(ie.value),null,2),N.value=!0,Me.value=!0}catch(t){D.value=t.message||"加载账号配置失败"}},Pe=()=>{Me.value=!1,D.value="",N.value=!1},xt=()=>{const t=JSON.parse(se.value);if(!Array.isArray(t))throw new Error("配置格式必须是数组。");return t},Ht=t=>typeof t!="string"||!t?t:t.length<=6?`${t.slice(0,2)}****`:`${t.slice(0,3)}****`,gt=t=>{const e=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password","mail_refresh_token","mail_client_id"]);return t.map(o=>{const r={...o};return e.forEach(u=>{const m=r[u];m&&(r[u]=Ht(m))}),r})},Jt=()=>{if(D.value="",!N.value){try{ie.value=xt()}catch(t){D.value=t.message||"JSON 格式错误";return}se.value=JSON.stringify(gt(ie.value),null,2),N.value=!0;return}se.value=JSON.stringify(ie.value,null,2),N.value=!1},Gt=async()=>{D.value="";try{const t=xt();await k.updateConfig(t),d.success("配置保存成功"),Pe()}catch(t){D.value=t.message||"保存失败",d.error(t.message||"保存失败")}},Fe=()=>{x.value=!1,$.value=""},Yt=async()=>{if(ke.value===null)return;const t=[...Ze.value];t[ke.value]={...t[ke.value],id:h.value.id,secure_c_ses:h.value.secure_c_ses,csesidx:h.value.csesidx,config_id:h.value.config_id,host_c_oses:h.value.host_c_oses||void 0,expires_at:h.value.expires_at||void 0};try{await k.updateConfig(t),d.success("账号编辑成功"),Fe()}catch(e){$.value=e.message||"保存失败",d.error(e.message||"保存失败")}},qt=async()=>{try{await k.bulkEnable(Array.from(b.value)),d.success("批量启用成功"),b.value=new Set}catch(t){d.error(t.message||"批量启用失败")}},Qt=async()=>{if(await T.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"}))try{await k.bulkDisable(Array.from(b.value)),d.success("批量禁用成功"),b.value=new Set}catch(e){d.error(e.message||"批量禁用失败")}},Xt=async()=>{if(await T.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"}))try{await k.bulkDelete(Array.from(b.value)),d.success("批量删除成功"),b.value=new Set}catch(e){d.error(e.message||"批量删除失败")}},bt=async t=>{try{await k.enableAccount(t),d.success("账号已启用")}catch(e){d.error(e.message||"启用失败")}},yt=async t=>{if(await T.ask({title:"禁用账号",message:"确定要禁用该账号吗?"}))try{await k.disableAccount(t),d.success("账号已禁用")}catch(o){d.error(o.message||"禁用失败")}},_t=async t=>{if(await T.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"}))try{await k.deleteAccount(t),d.success("账号已删除")}catch(o){d.error(o.message||"删除失败")}};let me=null,pe=null,xe=null,Le=!1;const W=()=>{me!==null&&(window.clearInterval(me),me=null)},Z=()=>{pe!==null&&(window.clearInterval(pe),pe=null)},Wt=()=>{xe!==null&&(window.clearInterval(xe),xe=null),Le=!1},ht=t=>t==="pending"?"等待中":t==="running"?"执行中":t==="success"?"成功":t==="failed"?"失败":t,wt=t=>{const e=t.status,o=t.success_count??0,r=t.fail_count??0;if(e==="running"||e==="pending")return"bg-sky-400";if(e==="success"||e==="failed"){if(o>0&&r===0)return"bg-emerald-400";if(r>0&&o===0)return"bg-rose-500";if(o>0&&r>0)return"bg-amber-400"}return"bg-muted-foreground"},kt=async t=>{if($e(t)){W();return}const e=await w.getRegisterTask(t);if($e(e.id)){W();return}if(Be(e),e.status!=="running"&&e.status!=="pending"){O.value=!1,W(),await fe();const o=e.success_count||0,r=e.fail_count||0;o>0&&r>0?d.success(`注册任务完成:成功 ${o},失败 ${r}`):o>0&&r===0?d.success(`注册任务完成:全部成功 (${o})`):r>0&&o===0?d.error(`注册任务完成:全部失败 (${r})`):d.error("注册任务失败")}},Ct=async t=>{if(Ie(t)){Z();return}const e=await w.getLoginTask(t);if(Ie(e.id)){Z();return}if(Se(e),e.status!=="running"&&e.status!=="pending"){S.value=!1,Z(),await fe();const o=e.success_count||0,r=e.fail_count||0;o>0&&r>0?d.success(`刷新任务完成:成功 ${o},失败 ${r}`):o>0&&r===0?d.success(`刷新任务完成:全部成功 (${o})`):r>0&&o===0?d.error(`刷新任务完成:全部失败 (${r})`):d.error("刷新任务失败")}},Tt=t=>{W(),me=window.setInterval(()=>{kt(t).catch(e=>{_.value=e?.message||"注册任务更新失败",W(),O.value=!1})},3e3)},Ke=t=>{Z(),pe=window.setInterval(()=>{Ct(t).catch(e=>{_.value=e?.message||"刷新任务更新失败",Z(),S.value=!1})},3e3)},Zt=()=>{xe===null&&(xe=window.setInterval(async()=>{if(!Le&&!q.value&&!(me!==null||pe!==null)&&!(!O.value&&!S.value&&!c.value&&!f.value)){Le=!0;try{await He()}catch(t){_.value=t?.message||"后台刷新失败"}finally{Le=!1}}},6e3))},He=async()=>{try{const t=await w.getRegisterCurrent();t&&"id"in t&&!$e(t.id)&&(Be(t),(t.status==="running"||t.status==="pending")&&(O.value=!0,Tt(t.id)))}catch(t){_.value=t.message||"加载注册任务失败"}try{const t=await w.getLoginCurrent();t&&"id"in t&&!Ie(t.id)&&(Se(t),(t.status==="running"||t.status==="pending")&&(S.value=!0,Ke(t.id)))}catch(t){_.value=t.message||"加载刷新任务失败"}},es=async()=>{_.value="",O.value=!0;try{const t=Number.isFinite(de.value)&&de.value>0?de.value:void 0,e=await w.startRegister(t);Be(e),Tt(e.id),ye.value=!1,q.value=!0}catch(t){_.value=t.message||"启动注册失败",O.value=!1}},St=async()=>{if(b.value.size){_.value="",S.value=!0;try{const t=await w.startLogin(Array.from(b.value));Se(t),Ke(t.id),Ue()}catch(t){_.value=t.message||"启动刷新失败",S.value=!1}}},ts=async()=>{_.value="",S.value=!0;try{await w.checkLogin();const t=await w.getLoginCurrent();if(t&&"id"in t){Se(t),Ke(t.id),Ue();return}S.value=!1}catch(t){_.value=t.message||"触发刷新失败",S.value=!1}};return(t,e)=>(l(),n(ge,null,[s("div",xs,[s("section",gs,[s("div",bs,[s("div",ys,[R(s("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>ae.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[V,ae.value]]),G(cs,{modelValue:te.value,"onUpdate:modelValue":e[1]||(e[1]=o=>te.value=o),options:Et,class:"!w-full sm:!w-40"},null,8,["modelValue"])]),s("div",_s,[G(be,{modelValue:Oe.value,"onUpdate:modelValue":ft},{default:$t(()=>[...e[27]||(e[27]=[ee(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+a(B.value)+" / "+a(H.value.length)+" 个账号",1),s("div",hs,[s("button",{type:"button",class:p(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",Y.value==="table"?"bg-accent text-accent-foreground":""]),onClick:e[2]||(e[2]=o=>Y.value="table"),"aria-label":"列表视图"},[...e[28]||(e[28]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:p(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",Y.value==="card"?"bg-accent text-accent-foreground":""]),onClick:e[3]||(e[3]=o=>Y.value="card"),"aria-label":"卡片视图"},[...e[29]||(e[29]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",ws,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:j(ne),onClick:fe}," 刷新列表 ",8,ks),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:Kt}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:O.value,onClick:At}," 添加账户 ",8,Cs),s("div",{ref_key:"moreActionsRef",ref:De,class:"relative"},[s("button",{class:p(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",P.value?"bg-accent text-accent-foreground":""]),onClick:Ot},[e[30]||(e[30]=ee(" 更多操作 ",-1)),e[31]||(e[31]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),Bt.value?(l(),n("span",{key:0,class:p(["ml-1 h-2 w-2 rounded-full",zt.value]),"aria-hidden":"true"},null,2)):g("",!0)],2),P.value?(l(),n("div",Ts,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:e[4]||(e[4]=o=>{Ue(),le()})}," 任务状态 "),e[32]||(e[32]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",S.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:S.value,onClick:e[5]||(e[5]=o=>{ts(),le()})}," 刷新过期 ",10,Ss),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!B.value||S.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!B.value||S.value,onClick:e[6]||(e[6]=o=>{St(),le()})}," 刷新选中 ",10,$s),e[33]||(e[33]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[7]||(e[7]=o=>{qt(),le()})}," 批量启用 ",10,Is),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[8]||(e[8]=o=>{Qt(),le()})}," 批量禁用 ",10,Es),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[9]||(e[9]=o=>{Xt(),le()})}," 批量删除 ",10,Ls)])):g("",!0)],512)]),Y.value==="card"?(l(),n("div",As,[(l(!0),n(ge,null,Ve(H.value,o=>(l(),n("div",{key:o.id,class:p(["rounded-2xl border border-border bg-card p-4",ct(o)]),onClick:r=>Ee(o.id)},[s("div",Vs,[s("div",null,[e[34]||(e[34]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",js,a(o.id),1)]),s("div",Ms,[G(be,{modelValue:b.value.has(o.id),"onUpdate:modelValue":r=>Ee(o.id),onClick:e[10]||(e[10]=M(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:p(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",nt(o)])},a(ve(o)),3)])]),s("div",Ds,[s("div",null,[e[35]||(e[35]=s("p",null,"剩余时间",-1)),s("p",{class:p(["mt-1 text-sm font-semibold",dt(o)])},a(it(o.remaining_display)),3),o.expires_at?(l(),n("p",Os,a(o.expires_at),1)):g("",!0)]),s("div",null,[e[36]||(e[36]=s("p",null,"冷却",-1)),s("p",{class:p(["mt-1",ze(o)])},[o.cooldown_seconds>0?(l(),n("span",Bs,a(ut(o.cooldown_seconds))+" · "+a(o.cooldown_reason),1)):(l(),n("span",Ns,a(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[e[37]||(e[37]=s("p",null,"失败数",-1)),s("p",Us,a(o.error_count),1)]),s("div",null,[e[38]||(e[38]=s("p",null,"会话数",-1)),s("p",zs,a(o.conversation_count),1)])]),s("div",Ps,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>pt(o.id),["stop"])}," 编辑 ",8,Fs),at(o)?(l(),n("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[11]||(e[11]=M(()=>{},["stop"])),r=>bt(o.id)]}," 启用 ",8,Ks)):(l(),n("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[12]||(e[12]=M(()=>{},["stop"])),r=>yt(o.id)]}," 禁用 ",8,Hs)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[e[13]||(e[13]=M(()=>{},["stop"])),r=>_t(o.id)]}," 删除 ",8,Js)])],10,Rs))),128)),!H.value.length&&!j(ne)?(l(),n("div",Gs," 暂无账号数据,请检查后台配置。 ")):g("",!0)])):(l(),n("div",Ys,[s("table",qs,[s("thead",Qs,[s("tr",null,[s("th",Xs,[G(be,{modelValue:Oe.value,"onUpdate:modelValue":ft},null,8,["modelValue"])]),e[40]||(e[40]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),e[41]||(e[41]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",Ws,[s("span",Zs,[e[39]||(e[39]=ee(" 剩余/过期 ",-1)),G(ms,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),e[42]||(e[42]=s("th",{class:"py-3 pr-6"},"冷却",-1)),e[43]||(e[43]=s("th",{class:"py-3 pr-6"},"失败数",-1)),e[44]||(e[44]=s("th",{class:"py-3 pr-6"},"会话数",-1)),e[45]||(e[45]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",eo,[!H.value.length&&!j(ne)?(l(),n("tr",to,[...e[46]||(e[46]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):g("",!0),(l(!0),n(ge,null,Ve(H.value,o=>(l(),n("tr",{key:o.id,class:p(["border-t border-border",ct(o)]),onClick:r=>Ee(o.id)},[s("td",{class:"py-4 pr-4",onClick:e[14]||(e[14]=M(()=>{},["stop"]))},[G(be,{modelValue:b.value.has(o.id),"onUpdate:modelValue":r=>Ee(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",oo,a(o.id),1),s("td",ro,[s("span",{class:p(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",nt(o)])},a(ve(o)),3)]),s("td",lo,[s("div",{class:p(["text-sm font-semibold",dt(o)])},a(it(o.remaining_display)),3),o.expires_at?(l(),n("span",no,a(o.expires_at),1)):g("",!0)]),s("td",ao,[o.cooldown_seconds>0?(l(),n("span",{key:0,class:p(ze(o))},a(ut(o.cooldown_seconds))+" · "+a(o.cooldown_reason),3)):(l(),n("span",{key:1,class:p(ze(o))},a(o.cooldown_reason||"无冷却"),3))]),s("td",io,a(o.error_count),1),s("td",uo,a(o.conversation_count),1),s("td",co,[s("div",fo,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>pt(o.id),["stop"])}," 编辑 ",8,vo),at(o)?(l(),n("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>bt(o.id),["stop"])}," 启用 ",8,mo)):(l(),n("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>yt(o.id),["stop"])}," 禁用 ",8,po)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:M(r=>_t(o.id),["stop"])}," 删除 ",8,xo)])])],10,so))),128))])])]))])]),G(fs,{open:j(T).open.value,title:j(T).title.value,message:j(T).message.value,"confirm-text":j(T).confirmText.value,"cancel-text":j(T).cancelText.value,onConfirm:j(T).confirm,onCancel:j(T).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(l(),Re(je,{to:"body"},[ye.value?(l(),n("div",go,[s("div",bo,[s("div",yo,[s("div",null,[e[47]||(e[47]=s("p",{class:"text-sm font-medium text-foreground"},"添加账户",-1)),s("p",_o,a(U.value==="register"?"创建 DuckMail 账号并自动注册":"批量导入账户配置"),1)]),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Ne}," 关闭 ")]),s("div",ho,[s("div",wo,[s("div",ko,[s("button",{type:"button",class:p(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",U.value==="register"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:e[15]||(e[15]=o=>U.value="register")}," 自动注册 ",2),s("button",{type:"button",class:p(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",U.value==="import"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:e[16]||(e[16]=o=>U.value="import")}," 批量导入 ",2)]),U.value==="register"?(l(),n("div",Co,[e[48]||(e[48]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),R(s("input",{"onUpdate:modelValue":e[17]||(e[17]=o=>de.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,de.value,void 0,{number:!0}]]),e[49]||(e[49]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"默认域名(可在配置面板修改,推荐使用)"),s("p",{class:"mt-1"},"注册失败建议关闭无头浏览器再试")],-1))])):(l(),n("div",To,[e[50]||(e[50]=s("label",{class:"block text-xs text-muted-foreground"},"批量导入(每行一个)",-1)),R(s("textarea",{"onUpdate:modelValue":e[18]||(e[18]=o=>ue.value=o),class:"min-h-[140px] w-full rounded-2xl border border-input bg-background px-3 py-2 text-xs font-mono",placeholder:`duckmail----you@example.com----password
2
+ user@outlook.com----loginPassword----clientId----refreshToken`},null,512),[[V,ue.value]]),e[51]||(e[51]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"支持两种格式:"),s("p",{class:"mt-1 font-mono"},"duckmail----email----password"),s("p",{class:"mt-1 font-mono"},"email----password----clientId----refreshToken"),s("p",{class:"mt-2"},'导入后请执行一次"刷新选中"以获取 Cookie。'),s("p",{class:"mt-1"},"注册失败建议关闭无头浏览器再试")],-1)),z.value?(l(),n("div",So,a(z.value),1)):g("",!0)])),e[53]||(e[53]=s("div",{class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-[11px] leading-relaxed"},[s("p",{class:"text-xs font-bold text-rose-600"},"⚠️ 严禁滥用:禁止将本工具用于商业用途或任何形式的滥用(无论规模大小)"),s("p",{class:"mt-1 text-muted-foreground"},[ee("详细声明请查看项目 "),s("a",{href:"https://github.com/Dreamy-rain/gemini-business2api/blob/main/docs/DISCLAIMER.md",target:"_blank",class:"text-primary hover:underline font-medium"},"DISCLAIMER.md")])],-1)),G(be,{modelValue:ce.value,"onUpdate:modelValue":e[19]||(e[19]=o=>ce.value=o)},{default:$t(()=>[...e[52]||(e[52]=[ee(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])])]),s("div",$o,[s("div",Io,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ne}," 取消 "),U.value==="register"?(l(),n("button",{key:0,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",disabled:O.value||!ce.value,onClick:es}," 开始注册 ",8,Eo)):(l(),n("button",{key:1,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",disabled:_e.value||!ce.value,onClick:Vt}," 导入并保存 ",8,Lo))])])])])):g("",!0)])),(l(),Re(je,{to:"body"},[q.value?(l(),n("div",Ao,[s("div",Ro,[s("div",Vo,[e[54]||(e[54]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",jo,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:!Q.value.length&&!X.value.length&&!c.value&&!f.value&&!_.value,onClick:Dt}," 清空日志 ",8,Mo),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Mt}," 关闭 ")])]),s("div",Do,[_.value?(l(),n("div",Oo,a(_.value),1)):g("",!0),c.value||f.value?(l(),n("div",Bo,[c.value?(l(),n("div",No,[s("div",Uo,[s("span",{class:p(["h-2.5 w-2.5 rounded-full",wt(c.value)]),"aria-hidden":"true"},null,2),e[55]||(e[55]=ee(" 注册任务 ",-1))]),s("div",zo,[s("span",null,"状态:"+a(ht(c.value.status)),1),s("span",null,"进度:"+a(c.value.progress)+"/"+a(c.value.count),1),s("span",null,"成功:"+a(c.value.success_count),1),s("span",null,"失败:"+a(c.value.fail_count),1)])])):g("",!0),f.value?(l(),n("div",Po,[s("div",Fo,[s("span",{class:p(["h-2.5 w-2.5 rounded-full",wt(f.value)]),"aria-hidden":"true"},null,2),e[56]||(e[56]=ee(" 刷新任务 ",-1))]),s("div",Ko,[s("span",null,"状态:"+a(ht(f.value.status)),1),s("span",null,"进度:"+a(f.value.progress)+"/"+a(f.value.account_ids.length),1),s("span",null,"成功:"+a(f.value.success_count),1),s("span",null,"失败:"+a(f.value.fail_count),1)])])):g("",!0)])):g("",!0),Q.value.length||X.value.length?(l(),n("div",Ho,[s("div",{ref_key:"taskLogsRef",ref:We,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[Q.value.length?(l(),n("div",Jo,[e[57]||(e[57]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",Go,[(l(!0),n(ge,null,Ve(Q.value,(o,r)=>(l(),n("div",{key:`reg-${r}`,class:"font-mono"},a(mt(o)),1))),128))])])):g("",!0),X.value.length?(l(),n("div",Yo,[e[58]||(e[58]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",qo,[(l(!0),n(ge,null,Ve(X.value,(o,r)=>(l(),n("div",{key:`login-${r}`,class:"font-mono"},a(mt(o)),1))),128))])])):g("",!0)],512)])):g("",!0),!_.value&&!c.value&&!f.value&&!Q.value.length&&!X.value.length?(l(),n("div",Qo," 暂无任务 ")):g("",!0)])])])):g("",!0)])),(l(),Re(je,{to:"body"},[x.value?(l(),n("div",Xo,[s("div",Wo,[s("div",{class:"flex items-center justify-between"},[e[59]||(e[59]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Fe}," 关闭 ")]),$.value?(l(),n("div",Zo,a($.value),1)):g("",!0),s("div",er,[e[60]||(e[60]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),R(s("input",{"onUpdate:modelValue":e[20]||(e[20]=o=>h.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[V,h.value.id]]),e[61]||(e[61]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),R(s("textarea",{"onUpdate:modelValue":e[21]||(e[21]=o=>h.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[V,h.value.secure_c_ses]]),e[62]||(e[62]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),R(s("input",{"onUpdate:modelValue":e[22]||(e[22]=o=>h.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.csesidx]]),e[63]||(e[63]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),R(s("input",{"onUpdate:modelValue":e[23]||(e[23]=o=>h.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.config_id]]),e[64]||(e[64]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),R(s("input",{"onUpdate:modelValue":e[24]||(e[24]=o=>h.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.host_c_oses]]),e[65]||(e[65]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),R(s("input",{"onUpdate:modelValue":e[25]||(e[25]=o=>h.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[V,h.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Fe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Yt}," 保存 ")])])])):g("",!0)])),(l(),Re(je,{to:"body"},[Me.value?(l(),n("div",tr,[s("div",sr,[s("div",or,[e[66]||(e[66]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",rr,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Jt},a(N.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Pe}," 关闭 ")])]),D.value?(l(),n("div",lr,a(D.value),1)):g("",!0),s("div",nr,[R(s("textarea",{"onUpdate:modelValue":e[26]||(e[26]=o=>se.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:N.value},null,8,ar),[[V,se.value]])]),s("div",ir,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",onClick:Gt,disabled:N.value}," 保存 ",8,dr)])])])):g("",!0)]))],64))}});export{xr as default};
static/assets/Accounts-DW_IBG7n.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ import{g as A,C as ts,h as a,d as ss,D as os,i as G,o as rs,s as ls,j as ns,c as l,a as s,x as H,y as Re,m as L,v as $,A as Tt,t as n,n as g,u as R,b as x,f as J,F as ge,r as Ve,T as Me,w as V,e as r,E as as}from"./index-CDbQWWUi.js";import{_ as is}from"./SelectMenu.vue_vue_type_script_setup_true_lang-DebMUA1u.js";import{_ as be}from"./Checkbox.vue_vue_type_script_setup_true_lang-B6kSOS_e.js";import{_ as ds}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-BA1J4R7-.js";import{u as us}from"./useConfirmDialog-qOidKSEY.js";import{_ as cs}from"./HelpTip.vue_vue_type_script_setup_true_lang-Cw2hnECN.js";const w={list:()=>A.get("/admin/accounts"),getConfig:()=>A.get("/admin/accounts-config"),updateConfig:b=>A.put("/admin/accounts-config",b),delete:b=>A.delete(`/admin/accounts/${b}`),disable:b=>A.put(`/admin/accounts/${b}/disable`),enable:b=>A.put(`/admin/accounts/${b}/enable`),startRegister:(b,h)=>A.post("/admin/register/start",{count:b,domain:h}),getRegisterTask:b=>A.get(`/admin/register/task/${b}`),getRegisterCurrent:()=>A.get("/admin/register/current"),startLogin:b=>A.post("/admin/login/start",b),getLoginTask:b=>A.get(`/admin/login/task/${b}`),getLoginCurrent:()=>A.get("/admin/login/current"),checkLogin:()=>A.post("/admin/login/check")},fs=ts("accounts",()=>{const b=a([]),h=a(!1);async function I(){h.value=!0;try{const u=await w.list();b.value=Array.isArray(u)?u:u.accounts||[]}finally{h.value=!1}}async function le(u){await w.delete(u),await I()}async function C(u){await w.disable(u),await I()}async function ne(u){await w.enable(u),await I()}async function ee(u){await Promise.all(u.map(M=>w.enable(M))),await I()}async function m(u){await Promise.all(u.map(M=>w.disable(M))),await I()}async function Y(u){await Promise.all(u.map(M=>w.delete(M))),await I()}async function ae(u){await w.updateConfig(u),await I()}return{accounts:b,isLoading:h,loadAccounts:I,deleteAccount:le,disableAccount:C,enableAccount:ne,bulkEnable:ee,bulkDisable:m,bulkDelete:Y,updateConfig:ae}}),vs={class:"space-y-8"},ps={class:"rounded-3xl border border-border bg-card p-6"},xs={class:"flex flex-wrap items-center justify-between gap-4"},ms={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},gs={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},bs={class:"ml-auto flex items-center gap-2 sm:ml-0"},ys={class:"mt-4 flex flex-wrap items-center gap-2"},_s=["disabled"],ws=["disabled"],hs={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},ks=["disabled"],Cs=["disabled"],Ts=["disabled"],Ss=["disabled"],As=["disabled"],Es={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},Is=["onClick"],Ls={class:"flex items-start justify-between gap-3"},$s={class:"mt-1 font-mono text-xs text-foreground"},Rs={class:"flex items-center gap-2"},Vs={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},Ms={key:0,class:"mt-1 text-[11px]"},js={key:0},Ds={key:1},Os={class:"mt-1 text-sm font-semibold text-foreground"},Bs={class:"mt-1 text-sm font-semibold text-foreground"},Ns={class:"mt-4 flex flex-wrap items-center gap-2"},Us=["onClick"],zs=["onClick"],Ps=["onClick"],Fs=["onClick"],Ks={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Gs={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},Hs={class:"min-w-full text-left text-sm"},Js={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Ys={class:"py-3 pr-4"},Qs={class:"py-3 pr-6"},qs={class:"inline-flex items-center gap-2"},Ws={class:"text-sm text-foreground"},Xs={key:0},Zs=["onClick"],eo={class:"py-4 pr-6 font-mono text-xs text-foreground"},to={class:"py-4 pr-6"},so={class:"py-4 pr-6"},oo={key:0,class:"block text-[11px] text-muted-foreground"},ro={class:"py-4 pr-6 text-xs"},lo={class:"py-4 pr-6 text-xs text-muted-foreground"},no={class:"py-4 pr-6 text-xs text-muted-foreground"},ao={class:"py-4 text-right"},io={class:"flex flex-wrap justify-end gap-2"},uo=["onClick"],co=["onClick"],fo=["onClick"],vo=["onClick"],po={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},xo={class:"flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},mo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},go={class:"mt-1 text-xs text-muted-foreground"},bo={class:"scrollbar-slim flex-1 overflow-y-auto px-6 py-4"},yo={class:"space-y-4 text-sm"},_o={class:"flex rounded-full border border-border bg-muted/30 p-1 text-xs"},wo={key:0,class:"space-y-4"},ho={key:1,class:"space-y-4"},ko={key:0,class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-600"},Co={class:"border-t border-border/60 px-6 py-4"},To={class:"flex items-center justify-end gap-2"},So=["disabled"],Ao=["disabled"],Eo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Io={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},Lo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},$o={class:"flex items-center gap-2"},Ro=["disabled"],Vo={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},Mo={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},jo={key:1,class:"grid gap-3 text-xs text-muted-foreground"},Do={key:0,class:"space-y-1"},Oo={class:"flex flex-wrap gap-x-4 gap-y-1"},Bo={key:1,class:"space-y-1"},No={class:"flex flex-wrap gap-x-4 gap-y-1"},Uo={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},zo={key:0,class:"space-y-2"},Po={class:"space-y-1 text-[11px] text-muted-foreground"},Fo={key:1,class:"mt-4 space-y-2"},Ko={class:"space-y-1 text-[11px] text-muted-foreground"},Go={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},Ho={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Jo={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Yo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},Qo={class:"mt-4 space-y-3 text-sm"},qo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Wo={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},Xo={class:"flex items-center justify-between"},Zo={class:"flex items-center gap-2"},er={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},tr={class:"mt-4"},sr=["readonly"],or={class:"mt-6 flex items-center justify-end gap-2"},rr=["disabled"],Ge="accounts-register-task-cache",He="accounts-login-task-cache",Je="accounts-register-log-clear",Ye="accounts-login-log-clear",Qe="accounts-register-task-cleared-id",qe="accounts-login-task-cleared-id",St="1970-01-01 00:00:00",cr=ss({__name:"Accounts",setup(b){const h=fs(),{accounts:I,isLoading:le}=os(h),C=us(),ne=a(""),ee=a("all"),m=a(new Set),Y=a("table"),ae=a(!1),u=a(""),M=a(!1),j=a(""),te=a(""),B=a(!1),ie=a([]),de=a(1),ye=a(!1),N=a("register"),ue=a(""),U=a(""),_e=a(!1),Q=a(!1),z=a(!1),je=a(null),we=a(null),he=a(null),P=a(null),F=a(null),se=a(0),oe=a(0),ce=a(!1),c=a(null),f=a(null),We=a(null),D=a(!1),T=a(!1),y=a(""),_=a({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),ke=a(null),Xe=a([]),At=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],K=G(()=>{const e=ne.value.trim().toLowerCase();return I.value.filter(t=>{const o=!e||t.id.toLowerCase().includes(e),i=ee.value==="all"||ve(t)===ee.value;return o&&i})}),O=G(()=>m.value.size),De=G(()=>K.value.length>0&&K.value.every(e=>m.value.has(e.id))),fe=async()=>{await h.loadAccounts(),m.value=new Set,z.value=!1},Ze=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},et=e=>{try{return localStorage.getItem(e)||null}catch{return null}},Ce=(e,t)=>{try{if(t){localStorage.setItem(e,t);return}localStorage.removeItem(e)}catch{}},tt=(e,t)=>{try{localStorage.setItem(e,JSON.stringify(t))}catch{}},st=e=>{try{localStorage.removeItem(e)}catch{}},ot=e=>{const t=localStorage.getItem(e),o=Number(t);return Number.isFinite(o)?o:0},Te=(e,t)=>{try{localStorage.setItem(e,String(t))}catch{}},Oe=(e,t=!0)=>{e&&(e.id&&e.id===P.value||(e.id&&P.value&&e.id!==P.value&&(P.value=null,Ce(Qe,null)),c.value=e,e.id&&e.id!==we.value&&(we.value=e.id,se.value=0,Te(Je,0)),t&&tt(Ge,e)))},Se=(e,t=!0)=>{e&&(e.id&&e.id===F.value||(e.id&&F.value&&e.id!==F.value&&(F.value=null,Ce(qe,null)),f.value=e,e.id&&e.id!==he.value&&(he.value=e.id,oe.value=0,Te(Ye,0)),t&&tt(He,e)))},Et=()=>{se.value=ot(Je),oe.value=ot(Ye),P.value=et(Qe),F.value=et(qe);const e=Ze(Ge);e&&e.id!==P.value&&(c.value=e,we.value=e.id||null);const t=Ze(He);t&&t.id!==F.value&&(f.value=t,he.value=t.id||null)},It=()=>{ye.value=!0,N.value="register",ue.value="",U.value="",_e.value=!1,ce.value=!1},Be=()=>{ye.value=!1},Lt=e=>{const t=[],o=[];return e.split(/\r?\n/).map(d=>d.trim()).filter(Boolean).forEach((d,p)=>{const v=d.split("----").map(S=>S.trim()),k=p+1;if(v.length){if(v[0].toLowerCase()==="duckmail"){if(v.length<3||!v[1]||!v[2]){o.push(`第 ${k} 行格式错误(duckmail)`);return}const S=v[1],$e=v.slice(2).join("----");t.push({id:S,secure_c_ses:"",csesidx:"",config_id:"",expires_at:St,mail_provider:"duckmail",mail_address:S,mail_password:$e});return}if(v.length>=4&&v[0]&&v[2]&&v[3]){const S=v[0],$e=v[1]||"",E=v[2],es=v.slice(3).join("----");t.push({id:S,secure_c_ses:"",csesidx:"",config_id:"",expires_at:St,mail_provider:"microsoft",mail_address:S,mail_password:$e,mail_client_id:E,mail_refresh_token:es,mail_tenant:"consumers"});return}o.push(`第 ${k} 行格式错误`)}}),{items:t,errors:o}},$t=async()=>{if(U.value="",!ue.value.trim()){U.value="请输入导入内容";return}const{items:e,errors:t}=Lt(ue.value);if(!e.length){U.value=t.length?t.join(","):"未识别到有效账号";return}if(t.length){U.value=t.slice(0,3).join(",");return}_e.value=!0;try{const i=[...await ft()],d=new Map(i.map((k,S)=>[k.id,S])),p=[];e.forEach(k=>{const S=d.get(k.id||"");if(S===void 0){i.push(k),p.push(k.id);return}const E={...i[S],mail_provider:k.mail_provider,mail_address:k.mail_address};k.mail_provider==="microsoft"?(E.mail_client_id=k.mail_client_id,E.mail_refresh_token=k.mail_refresh_token,E.mail_tenant=k.mail_tenant,E.mail_password=k.mail_password):(E.mail_password=k.mail_password,E.mail_client_id=void 0,E.mail_refresh_token=void 0,E.mail_tenant=void 0),i[S]=E,p.push(k.id)}),await h.updateConfig(i),await fe(),m.value=new Set(p),Be(),await C.ask({title:"导入成功",message:`已导入 ${p.length} 个账户并自动选中。是否立即刷新这些账户以获取 Cookie?`,confirmText:"立即刷新",cancelText:"稍后手动刷新"})&&await Ct()}catch(o){U.value=o.message||"导入失败"}finally{_e.value=!1}},Rt=async()=>{try{const e=[],t=c.value?.id,o=f.value?.id;if(t&&!Ae(t)&&e.push(wt(t)),o&&!Ee(o)&&e.push(ht(o)),!e.length){await Ke();return}await Promise.all(e)}catch(e){y.value=e?.message||"任务状态更新失败"}},Ne=async()=>{Q.value=!0,await Rt()},Vt=()=>{Q.value=!1},Mt=()=>{const e=c.value?.id||null,t=f.value?.id||null;P.value=e,F.value=t,Ce(Qe,e),Ce(qe,t),se.value=c.value?.logs?.length||0,oe.value=f.value?.logs?.length||0,Te(Je,se.value),Te(Ye,oe.value),c.value=null,f.value=null,we.value=null,he.value=null,y.value="",D.value=!1,T.value=!1,X(),Z(),st(Ge),st(He)},Ae=e=>!!(e&&e===P.value),Ee=e=>!!(e&&e===F.value),jt=()=>{z.value=!z.value},re=()=>{z.value=!1},rt=e=>{if(!z.value)return;const t=e.target;je.value&&!je.value.contains(t)&&(z.value=!1)};rs(async()=>{Et(),await fe(),await Ke(),Wt(),document.addEventListener("click",rt)});const q=G(()=>{const e=c.value?.logs||[];return se.value?e.slice(se.value):e}),W=G(()=>{const e=f.value?.logs||[];return oe.value?e.slice(oe.value):e}),Dt=G(()=>!!y.value||!!c.value||!!f.value||q.value.length>0||W.value.length>0),Ot=async()=>{await as();const e=We.value;e&&(e.scrollTop=e.scrollHeight)};ls([q,W,Q],async()=>{Q.value&&await Ot()},{deep:!0});const Bt=G(()=>{const e=c.value?.status,t=f.value?.status;return e==="running"||e==="pending"||t==="running"||t==="pending"}),Nt=G(()=>{if(y.value)return"bg-rose-500";if(Bt.value)return"bg-sky-400";const e=[];if(c.value){const d=c.value.success_count??0,p=c.value.fail_count??0,v=c.value.count??d+p;e.push({success:d,fail:p,total:v,status:c.value.status})}if(f.value){const d=f.value.success_count??0,p=f.value.fail_count??0,v=f.value.account_ids?.length??d+p;e.push({success:d,fail:p,total:v,status:f.value.status})}if(!e.length)return"bg-muted-foreground";const t=e.reduce((d,p)=>d+p.success,0),o=e.reduce((d,p)=>d+p.fail,0),i=e.reduce((d,p)=>d+(p.total||0),0);if(t>0&&o>0)return"bg-amber-400";if(o>0&&t===0)return"bg-rose-500";if(t>0&&o===0)return"bg-emerald-400";if(i===0){const d=e.every(v=>v.status==="success");if(e.some(v=>v.status==="failed"))return"bg-rose-500";if(d)return"bg-emerald-400"}return"bg-muted-foreground"});ns(()=>{X(),Z(),qt(),document.removeEventListener("click",rt)});const ve=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?"429限流":e.cooldown_reason==="错误禁用"?"错误禁用":e.disabled?"手动禁用":e.status==="已过期"?"已过期":e.status==="即将过期"?"即将过期":"正常",lt=e=>{const t=ve(e);return t==="429限流"||t==="即将过期"?"bg-amber-200 text-amber-900":t==="错误禁用"||t==="已过期"?"bg-destructive/10 text-destructive":t==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},nt=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?!0:e.disabled||e.cooldown_reason==="错误禁用",at=e=>e==="已过期"?"过期":e==="未设置"?"未设置":e,it=e=>e.status==="已过期"?"text-rose-600":e.status==="即将过期"?"text-amber-700":e.status==="未设置"?"text-muted-foreground":"text-emerald-600",dt=e=>e<60?`${e} 秒`:e<3600?`${Math.ceil(e/60)} 分钟`:`${(e/3600).toFixed(1)} 小时`,Ue=e=>e.cooldown_seconds>0?"text-amber-700":e.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",ut=e=>{const t=ve(e);return t==="手动禁用"||t==="已过期"?"bg-muted/70":""},Ie=e=>{const t=new Set(m.value);t.has(e)?t.delete(e):t.add(e),m.value=t},ct=()=>{if(De.value){m.value=new Set;return}m.value=new Set(K.value.map(e=>e.id))},Ut=(e,t)=>e.id||`account_${t+1}`,ft=async()=>(await w.getConfig()).accounts.map((t,o)=>({...t,id:Ut(t,o)})),vt=e=>`${e.time} [${e.level}] ${e.message}`,zt=(e,t)=>{let o=-1;for(let d=0;d<e.length;d+=1)if(e[d].id===t){o=d;break}if(o===-1)return u.value="未找到对应账号配置。",!1;const i=e[o];return _.value={id:i.id,secure_c_ses:i.secure_c_ses,csesidx:i.csesidx,config_id:i.config_id,host_c_oses:i.host_c_oses,expires_at:i.expires_at},Xe.value=e,ke.value=o,ae.value=!0,!0},pt=async e=>{u.value="";try{const t=await ft();zt(t,e)}catch(t){u.value=t.message||"加载账号配置失败"}},Pt=async()=>{j.value="";try{const e=await w.getConfig();ie.value=Array.isArray(e.accounts)?e.accounts:[],te.value=JSON.stringify(mt(ie.value),null,2),B.value=!0,M.value=!0}catch(e){j.value=e.message||"加载账号配置失败"}},ze=()=>{M.value=!1,j.value="",B.value=!1},xt=()=>{const e=JSON.parse(te.value);if(!Array.isArray(e))throw new Error("配置格式必须是数组。");return e},Ft=e=>typeof e!="string"||!e?e:e.length<=6?`${e.slice(0,2)}****`:`${e.slice(0,3)}****`,mt=e=>{const t=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password","mail_refresh_token","mail_client_id"]);return e.map(o=>{const i={...o};return t.forEach(d=>{const p=i[d];p&&(i[d]=Ft(p))}),i})},Kt=()=>{if(j.value="",!B.value){try{ie.value=xt()}catch(e){j.value=e.message||"JSON 格式错误";return}te.value=JSON.stringify(mt(ie.value),null,2),B.value=!0;return}te.value=JSON.stringify(ie.value,null,2),B.value=!1},Gt=async()=>{j.value="";try{const e=xt();await h.updateConfig(e),ze()}catch(e){j.value=e.message||"保存失败"}},Pe=()=>{ae.value=!1,u.value=""},Ht=async()=>{if(ke.value===null)return;const e=[...Xe.value];e[ke.value]={...e[ke.value],id:_.value.id,secure_c_ses:_.value.secure_c_ses,csesidx:_.value.csesidx,config_id:_.value.config_id,host_c_oses:_.value.host_c_oses||void 0,expires_at:_.value.expires_at||void 0};try{await h.updateConfig(e),Pe()}catch(t){u.value=t.message||"保存失败"}},Jt=async()=>{await h.bulkEnable(Array.from(m.value)),m.value=new Set},Yt=async()=>{await C.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"})&&(await h.bulkDisable(Array.from(m.value)),m.value=new Set)},Qt=async()=>{await C.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"})&&(await h.bulkDelete(Array.from(m.value)),m.value=new Set)},gt=async e=>{await h.enableAccount(e)},bt=async e=>{await C.ask({title:"禁用账号",message:"确定要禁用该账号吗?"})&&await h.disableAccount(e)},yt=async e=>{await C.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"})&&await h.deleteAccount(e)};let pe=null,xe=null,me=null,Le=!1;const X=()=>{pe!==null&&(window.clearInterval(pe),pe=null)},Z=()=>{xe!==null&&(window.clearInterval(xe),xe=null)},qt=()=>{me!==null&&(window.clearInterval(me),me=null),Le=!1},_t=e=>e==="pending"?"等待中":e==="running"?"执行中":e==="success"?"成功":e==="failed"?"失败":e,wt=async e=>{if(Ae(e)){X();return}const t=await w.getRegisterTask(e);if(Ae(t.id)){X();return}Oe(t),t.status!=="running"&&t.status!=="pending"&&(D.value=!1,X(),await fe())},ht=async e=>{if(Ee(e)){Z();return}const t=await w.getLoginTask(e);if(Ee(t.id)){Z();return}Se(t),t.status!=="running"&&t.status!=="pending"&&(T.value=!1,Z(),await fe())},kt=e=>{X(),pe=window.setInterval(()=>{wt(e).catch(t=>{y.value=t?.message||"注册任务更新失败",X(),D.value=!1})},3e3)},Fe=e=>{Z(),xe=window.setInterval(()=>{ht(e).catch(t=>{y.value=t?.message||"刷新任务更新失败",Z(),T.value=!1})},3e3)},Wt=()=>{me===null&&(me=window.setInterval(async()=>{if(!Le&&!Q.value&&!(pe!==null||xe!==null)&&!(!D.value&&!T.value&&!c.value&&!f.value)){Le=!0;try{await Ke()}catch(e){y.value=e?.message||"后台刷新失败"}finally{Le=!1}}},6e3))},Ke=async()=>{try{const e=await w.getRegisterCurrent();e&&"id"in e&&!Ae(e.id)&&(Oe(e),(e.status==="running"||e.status==="pending")&&(D.value=!0,kt(e.id)))}catch(e){y.value=e.message||"加载注册任务失败"}try{const e=await w.getLoginCurrent();e&&"id"in e&&!Ee(e.id)&&(Se(e),(e.status==="running"||e.status==="pending")&&(T.value=!0,Fe(e.id)))}catch(e){y.value=e.message||"加载刷新任务失败"}},Xt=async()=>{y.value="",D.value=!0;try{const e=Number.isFinite(de.value)&&de.value>0?de.value:void 0,t=await w.startRegister(e);Oe(t),kt(t.id),ye.value=!1,Q.value=!0}catch(e){y.value=e.message||"启动注册失败",D.value=!1}},Ct=async()=>{if(m.value.size){y.value="",T.value=!0;try{const e=await w.startLogin(Array.from(m.value));Se(e),Fe(e.id),Ne()}catch(e){y.value=e.message||"启动刷新失败",T.value=!1}}},Zt=async()=>{y.value="",T.value=!0;try{await w.checkLogin();const e=await w.getLoginCurrent();if(e&&"id"in e){Se(e),Fe(e.id),Ne();return}T.value=!1}catch(e){y.value=e.message||"触发刷新失败",T.value=!1}};return(e,t)=>(r(),l(ge,null,[s("div",vs,[s("section",ps,[s("div",xs,[s("div",ms,[L(s("input",{"onUpdate:modelValue":t[0]||(t[0]=o=>ne.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[$,ne.value]]),H(is,{modelValue:ee.value,"onUpdate:modelValue":t[1]||(t[1]=o=>ee.value=o),options:At},null,8,["modelValue"])]),s("div",gs,[H(be,{modelValue:De.value,"onUpdate:modelValue":ct},{default:Tt(()=>[...t[27]||(t[27]=[J(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+n(O.value)+" / "+n(K.value.length)+" 个账号",1),s("div",bs,[s("button",{type:"button",class:g(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",Y.value==="table"?"bg-accent text-accent-foreground":""]),onClick:t[2]||(t[2]=o=>Y.value="table"),"aria-label":"列表视图"},[...t[28]||(t[28]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:g(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",Y.value==="card"?"bg-accent text-accent-foreground":""]),onClick:t[3]||(t[3]=o=>Y.value="card"),"aria-label":"卡片视图"},[...t[29]||(t[29]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",ys,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:R(le),onClick:fe}," 刷新列表 ",8,_s),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pt}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:D.value,onClick:It}," 添加账户 ",8,ws),s("div",{ref_key:"moreActionsRef",ref:je,class:"relative"},[s("button",{class:g(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",z.value?"bg-accent text-accent-foreground":""]),onClick:jt},[t[30]||(t[30]=J(" 更多操作 ",-1)),t[31]||(t[31]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),Dt.value?(r(),l("span",{key:0,class:g(["ml-1 h-2 w-2 rounded-full",Nt.value]),"aria-hidden":"true"},null,2)):x("",!0)],2),z.value?(r(),l("div",hs,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:t[4]||(t[4]=o=>{Ne(),re()})}," 任务状态 "),t[32]||(t[32]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",T.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:T.value,onClick:t[5]||(t[5]=o=>{Zt(),re()})}," 刷新过期 ",10,ks),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!O.value||T.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!O.value||T.value,onClick:t[6]||(t[6]=o=>{Ct(),re()})}," 刷新选中 ",10,Cs),t[33]||(t[33]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[7]||(t[7]=o=>{Jt(),re()})}," 批量启用 ",10,Ts),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[8]||(t[8]=o=>{Yt(),re()})}," 批量禁用 ",10,Ss),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[9]||(t[9]=o=>{Qt(),re()})}," 批量删除 ",10,As)])):x("",!0)],512)]),Y.value==="card"?(r(),l("div",Es,[(r(!0),l(ge,null,Ve(K.value,o=>(r(),l("div",{key:o.id,class:g(["rounded-2xl border border-border bg-card p-4",ut(o)]),onClick:i=>Ie(o.id)},[s("div",Ls,[s("div",null,[t[34]||(t[34]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",$s,n(o.id),1)]),s("div",Rs,[H(be,{modelValue:m.value.has(o.id),"onUpdate:modelValue":i=>Ie(o.id),onClick:t[10]||(t[10]=V(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:g(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",lt(o)])},n(ve(o)),3)])]),s("div",Vs,[s("div",null,[t[35]||(t[35]=s("p",null,"剩余时间",-1)),s("p",{class:g(["mt-1 text-sm font-semibold",it(o)])},n(at(o.remaining_display)),3),o.expires_at?(r(),l("p",Ms,n(o.expires_at),1)):x("",!0)]),s("div",null,[t[36]||(t[36]=s("p",null,"冷却",-1)),s("p",{class:g(["mt-1",Ue(o)])},[o.cooldown_seconds>0?(r(),l("span",js,n(dt(o.cooldown_seconds))+" · "+n(o.cooldown_reason),1)):(r(),l("span",Ds,n(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[t[37]||(t[37]=s("p",null,"失败数",-1)),s("p",Os,n(o.error_count),1)]),s("div",null,[t[38]||(t[38]=s("p",null,"会话数",-1)),s("p",Bs,n(o.conversation_count),1)])]),s("div",Ns,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>pt(o.id),["stop"])}," 编辑 ",8,Us),nt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[11]||(t[11]=V(()=>{},["stop"])),i=>gt(o.id)]}," 启用 ",8,zs)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[12]||(t[12]=V(()=>{},["stop"])),i=>bt(o.id)]}," 禁用 ",8,Ps)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[t[13]||(t[13]=V(()=>{},["stop"])),i=>yt(o.id)]}," 删除 ",8,Fs)])],10,Is))),128)),!K.value.length&&!R(le)?(r(),l("div",Ks," 暂无账号数据,请检查后台配置。 ")):x("",!0)])):(r(),l("div",Gs,[s("table",Hs,[s("thead",Js,[s("tr",null,[s("th",Ys,[H(be,{modelValue:De.value,"onUpdate:modelValue":ct},null,8,["modelValue"])]),t[40]||(t[40]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),t[41]||(t[41]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",Qs,[s("span",qs,[t[39]||(t[39]=J(" 剩余/过期 ",-1)),H(cs,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),t[42]||(t[42]=s("th",{class:"py-3 pr-6"},"冷却",-1)),t[43]||(t[43]=s("th",{class:"py-3 pr-6"},"失败数",-1)),t[44]||(t[44]=s("th",{class:"py-3 pr-6"},"会话数",-1)),t[45]||(t[45]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",Ws,[!K.value.length&&!R(le)?(r(),l("tr",Xs,[...t[46]||(t[46]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):x("",!0),(r(!0),l(ge,null,Ve(K.value,o=>(r(),l("tr",{key:o.id,class:g(["border-t border-border",ut(o)]),onClick:i=>Ie(o.id)},[s("td",{class:"py-4 pr-4",onClick:t[14]||(t[14]=V(()=>{},["stop"]))},[H(be,{modelValue:m.value.has(o.id),"onUpdate:modelValue":i=>Ie(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",eo,n(o.id),1),s("td",to,[s("span",{class:g(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",lt(o)])},n(ve(o)),3)]),s("td",so,[s("div",{class:g(["text-sm font-semibold",it(o)])},n(at(o.remaining_display)),3),o.expires_at?(r(),l("span",oo,n(o.expires_at),1)):x("",!0)]),s("td",ro,[o.cooldown_seconds>0?(r(),l("span",{key:0,class:g(Ue(o))},n(dt(o.cooldown_seconds))+" · "+n(o.cooldown_reason),3)):(r(),l("span",{key:1,class:g(Ue(o))},n(o.cooldown_reason||"无冷却"),3))]),s("td",lo,n(o.error_count),1),s("td",no,n(o.conversation_count),1),s("td",ao,[s("div",io,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>pt(o.id),["stop"])}," 编辑 ",8,uo),nt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>gt(o.id),["stop"])}," 启用 ",8,co)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>bt(o.id),["stop"])}," 禁用 ",8,fo)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:V(i=>yt(o.id),["stop"])}," 删除 ",8,vo)])])],10,Zs))),128))])])]))])]),H(ds,{open:R(C).open.value,title:R(C).title.value,message:R(C).message.value,"confirm-text":R(C).confirmText.value,"cancel-text":R(C).cancelText.value,onConfirm:R(C).confirm,onCancel:R(C).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(r(),Re(Me,{to:"body"},[ye.value?(r(),l("div",po,[s("div",xo,[s("div",mo,[s("div",null,[t[47]||(t[47]=s("p",{class:"text-sm font-medium text-foreground"},"添加账户",-1)),s("p",go,n(N.value==="register"?"创建 DuckMail 账号并自动注册":"批量导入账户配置"),1)]),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Be}," 关闭 ")]),s("div",bo,[s("div",yo,[s("div",_o,[s("button",{type:"button",class:g(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",N.value==="register"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[15]||(t[15]=o=>N.value="register")}," 自动注册 ",2),s("button",{type:"button",class:g(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",N.value==="import"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[16]||(t[16]=o=>N.value="import")}," 批量导入 ",2)]),N.value==="register"?(r(),l("div",wo,[t[48]||(t[48]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),L(s("input",{"onUpdate:modelValue":t[17]||(t[17]=o=>de.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,de.value,void 0,{number:!0}]]),t[49]||(t[49]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"}," 默认域名来自设置面板(可在“配置面板”中修改) ",-1))])):(r(),l("div",ho,[t[50]||(t[50]=s("label",{class:"block text-xs text-muted-foreground"},"批量导入(每行一个)",-1)),L(s("textarea",{"onUpdate:modelValue":t[18]||(t[18]=o=>ue.value=o),class:"min-h-[140px] w-full rounded-2xl border border-input bg-background px-3 py-2 text-xs font-mono",placeholder:`duckmail----you@example.com----password
2
+ user@outlook.com----loginPassword----clientId----refreshToken`},null,512),[[$,ue.value]]),t[51]||(t[51]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"支持两种格式:"),s("p",{class:"mt-1 font-mono"},"duckmail----email----password"),s("p",{class:"mt-1 font-mono"},"email----password----clientId----refreshToken"),s("p",{class:"mt-2 text-[11px]"},'导入后请执行一次"刷新选中"以获取 Cookie。')],-1)),U.value?(r(),l("div",ko,n(U.value),1)):x("",!0)])),t[53]||(t[53]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-[11px] leading-relaxed text-muted-foreground"},[s("div",{class:"space-y-2"},[s("p",{class:"text-xs font-bold text-rose-600"},"⚠️ 严禁滥用:禁止将本工具用于商业用途或任何形式的滥用(无论规模大小)"),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"本工具严禁用于以下行为:")]),s("p",{class:"pl-3"},"• 商业用途或盈利性使用"),s("p",{class:"pl-3"},"• 任何形式的批量操作或自动化滥用(无论规模大小)"),s("p",{class:"pl-3"},"• 破坏市场秩序或恶意竞争"),s("p",{class:"pl-3"},"• 违反 Google 服务条款的任何行为"),s("p",{class:"pl-3"},"• 违反 Microsoft 服务条款的任何行为")]),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"违规后果:"),J("滥用行为可能导致账号永久封禁、法律追责,一切后果由使用者自行承担。")])]),s("div",{class:"space-y-1"},[s("p",{class:"font-semibold text-foreground"},"📖 合法用途"),s("p",null,"本项目仅限于以下场景:"),s("p",{class:"pl-3"},"• 个人学习与技术研究"),s("p",{class:"pl-3"},"• 浏览器自动化技术探索"),s("p",{class:"pl-3"},"• 非商业性技术交流")]),s("div",{class:"space-y-1"},[s("p",{class:"font-semibold text-foreground"},"⚖️ 法律责任"),s("p",null,[s("strong",null,"使用者责任:"),J("使用本工具产生的一切后果(包括但不限于账号封禁、数据损失、法律纠纷)由使用者完全承担。")]),s("p",null,[s("strong",null,"合规义务:"),J("使用者必须遵守所在地法律法规及第三方服务条款(包括但不限于 Google Workspace、Microsoft 365 等服务条款)。")]),s("p",null,[s("strong",null,"作者免责:"),J("作者不对任何违规使用、滥用行为或由此产生的后果承担责任。")])]),s("div",{class:"space-y-1"},[s("p",{class:"font-semibold text-foreground"},"📋 技术声明"),s("p",{class:"pl-3"},'• 本项目按"现状"提供,不提供任何形式的担保'),s("p",{class:"pl-3"},"• 依赖的第三方服务(如 DuckMail API、Microsoft Graph API 等)可用性不受作者控制"),s("p",{class:"pl-3"},"• 作者保留随时停止维护、变更功能或关闭项目的权利")])])],-1)),H(be,{modelValue:ce.value,"onUpdate:modelValue":t[19]||(t[19]=o=>ce.value=o)},{default:Tt(()=>[...t[52]||(t[52]=[J(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])])]),s("div",Co,[s("div",To,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Be}," 取消 "),N.value==="register"?(r(),l("button",{key:0,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:D.value||!ce.value,onClick:Xt}," 开始注册 ",8,So)):(r(),l("button",{key:1,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:_e.value||!ce.value,onClick:$t}," 导入并保存 ",8,Ao))])])])])):x("",!0)])),(r(),Re(Me,{to:"body"},[Q.value?(r(),l("div",Eo,[s("div",Io,[s("div",Lo,[t[54]||(t[54]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",$o,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary",disabled:!q.value.length&&!W.value.length&&!c.value&&!f.value&&!y.value,onClick:Mt}," 清空日志 ",8,Ro),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Vt}," 关闭 ")])]),s("div",Vo,[y.value?(r(),l("div",Mo,n(y.value),1)):x("",!0),c.value||f.value?(r(),l("div",jo,[c.value?(r(),l("div",Do,[t[55]||(t[55]=s("div",{class:"font-medium text-foreground"},"注册任务",-1)),s("div",Oo,[s("span",null,"状态:"+n(_t(c.value.status)),1),s("span",null,"进度:"+n(c.value.progress)+"/"+n(c.value.count),1),s("span",null,"成功:"+n(c.value.success_count),1),s("span",null,"失败:"+n(c.value.fail_count),1)])])):x("",!0),f.value?(r(),l("div",Bo,[t[56]||(t[56]=s("div",{class:"font-medium text-foreground"},"刷新任务",-1)),s("div",No,[s("span",null,"状态:"+n(_t(f.value.status)),1),s("span",null,"进度:"+n(f.value.progress)+"/"+n(f.value.account_ids.length),1),s("span",null,"成功:"+n(f.value.success_count),1),s("span",null,"失败:"+n(f.value.fail_count),1)])])):x("",!0)])):x("",!0),q.value.length||W.value.length?(r(),l("div",Uo,[s("div",{ref_key:"taskLogsRef",ref:We,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[q.value.length?(r(),l("div",zo,[t[57]||(t[57]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",Po,[(r(!0),l(ge,null,Ve(q.value,(o,i)=>(r(),l("div",{key:`reg-${i}`,class:"font-mono"},n(vt(o)),1))),128))])])):x("",!0),W.value.length?(r(),l("div",Fo,[t[58]||(t[58]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",Ko,[(r(!0),l(ge,null,Ve(W.value,(o,i)=>(r(),l("div",{key:`login-${i}`,class:"font-mono"},n(vt(o)),1))),128))])])):x("",!0)],512)])):x("",!0),!y.value&&!c.value&&!f.value&&!q.value.length&&!W.value.length?(r(),l("div",Go," 暂无任务 ")):x("",!0)])])])):x("",!0)])),(r(),Re(Me,{to:"body"},[ae.value?(r(),l("div",Ho,[s("div",Jo,[s("div",{class:"flex items-center justify-between"},[t[59]||(t[59]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Pe}," 关闭 ")]),u.value?(r(),l("div",Yo,n(u.value),1)):x("",!0),s("div",Qo,[t[60]||(t[60]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),L(s("input",{"onUpdate:modelValue":t[20]||(t[20]=o=>_.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[$,_.value.id]]),t[61]||(t[61]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),L(s("textarea",{"onUpdate:modelValue":t[21]||(t[21]=o=>_.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[$,_.value.secure_c_ses]]),t[62]||(t[62]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),L(s("input",{"onUpdate:modelValue":t[22]||(t[22]=o=>_.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.csesidx]]),t[63]||(t[63]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),L(s("input",{"onUpdate:modelValue":t[23]||(t[23]=o=>_.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.config_id]]),t[64]||(t[64]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),L(s("input",{"onUpdate:modelValue":t[24]||(t[24]=o=>_.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.host_c_oses]]),t[65]||(t[65]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),L(s("input",{"onUpdate:modelValue":t[25]||(t[25]=o=>_.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[$,_.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Ht}," 保存 ")])])])):x("",!0)])),(r(),Re(Me,{to:"body"},[M.value?(r(),l("div",qo,[s("div",Wo,[s("div",Xo,[t[66]||(t[66]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",Zo,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Kt},n(B.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:ze}," 关闭 ")])]),j.value?(r(),l("div",er,n(j.value),1)):x("",!0),s("div",tr,[L(s("textarea",{"onUpdate:modelValue":t[26]||(t[26]=o=>te.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:B.value},null,8,sr),[[$,te.value]])]),s("div",or,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:ze}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Gt,disabled:B.value}," 保存 ",8,rr)])])])):x("",!0)]))],64))}});export{cr as default};
static/assets/Accounts-DanJ5qVz.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{g as C,C as Ft,h as a,d as Kt,D as Ht,i as N,o as Jt,s as Gt,j as Yt,c as l,a as s,x as U,y as Ce,m as V,v as I,A as xt,t as n,n as b,u as S,b as v,f as z,F as ue,r as Te,T as Se,w as A,e as r,E as Qt}from"./index-CkXB0iyt.js";import{_ as qt}from"./SelectMenu.vue_vue_type_script_setup_true_lang-DEvRak0a.js";import{_ as de}from"./Checkbox.vue_vue_type_script_setup_true_lang-Bn84CDew.js";import{_ as Wt}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-87LA-h3c.js";import{u as Xt}from"./useConfirmDialog-BpSB-4KN.js";import{_ as Zt}from"./HelpTip.vue_vue_type_script_setup_true_lang-PWvzGrPg.js";const y={list:()=>C.get("/admin/accounts"),getConfig:()=>C.get("/admin/accounts-config"),updateConfig:x=>C.put("/admin/accounts-config",x),delete:x=>C.delete(`/admin/accounts/${x}`),disable:x=>C.put(`/admin/accounts/${x}/disable`),enable:x=>C.put(`/admin/accounts/${x}/enable`),startRegister:(x,_)=>C.post("/admin/register/start",{count:x,domain:_}),getRegisterTask:x=>C.get(`/admin/register/task/${x}`),getRegisterCurrent:()=>C.get("/admin/register/current"),startLogin:x=>C.post("/admin/login/start",x),getLoginTask:x=>C.get(`/admin/login/task/${x}`),getLoginCurrent:()=>C.get("/admin/login/current"),checkLogin:()=>C.post("/admin/login/check")},es=Ft("accounts",()=>{const x=a([]),_=a(!1);async function T(){_.value=!0;try{const u=await y.list();x.value=Array.isArray(u)?u:u.accounts||[]}finally{_.value=!1}}async function ee(u){await y.delete(u),await T()}async function h(u){await y.disable(u),await T()}async function te(u){await y.enable(u),await T()}async function Q(u){await Promise.all(u.map(L=>y.enable(L))),await T()}async function g(u){await Promise.all(u.map(L=>y.disable(L))),await T()}async function P(u){await Promise.all(u.map(L=>y.delete(L))),await T()}async function se(u){await y.updateConfig(u),await T()}return{accounts:x,isLoading:_,loadAccounts:T,deleteAccount:ee,disableAccount:h,enableAccount:te,bulkEnable:Q,bulkDisable:g,bulkDelete:P,updateConfig:se}}),ts={class:"space-y-8"},ss={class:"rounded-3xl border border-border bg-card p-6"},os={class:"flex flex-wrap items-center justify-between gap-4"},rs={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},ls={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},ns={class:"ml-auto flex items-center gap-2 sm:ml-0"},as={class:"mt-4 flex flex-wrap items-center gap-2"},is=["disabled"],us=["disabled"],ds={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},cs=["disabled"],fs=["disabled"],vs=["disabled"],xs=["disabled"],gs=["disabled"],ps={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},ms=["onClick"],bs={class:"flex items-start justify-between gap-3"},ys={class:"mt-1 font-mono text-xs text-foreground"},_s={class:"flex items-center gap-2"},ws={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},ks={key:0,class:"mt-1 text-[11px]"},hs={key:0},Cs={key:1},Ts={class:"mt-1 text-sm font-semibold text-foreground"},Ss={class:"mt-1 text-sm font-semibold text-foreground"},As={class:"mt-4 flex flex-wrap items-center gap-2"},Ls=["onClick"],Es=["onClick"],$s=["onClick"],Rs=["onClick"],Vs={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Is={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},js={class:"min-w-full text-left text-sm"},Ds={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Ms={class:"py-3 pr-4"},Os={class:"py-3 pr-6"},Bs={class:"inline-flex items-center gap-2"},Ns={class:"text-sm text-foreground"},Us={key:0},zs=["onClick"],Ps={class:"py-4 pr-6 font-mono text-xs text-foreground"},Fs={class:"py-4 pr-6"},Ks={class:"py-4 pr-6"},Hs={key:0,class:"block text-[11px] text-muted-foreground"},Js={class:"py-4 pr-6 text-xs"},Gs={class:"py-4 pr-6 text-xs text-muted-foreground"},Ys={class:"py-4 pr-6 text-xs text-muted-foreground"},Qs={class:"py-4 text-right"},qs={class:"flex flex-wrap justify-end gap-2"},Ws=["onClick"],Xs=["onClick"],Zs=["onClick"],eo=["onClick"],to={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},so={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},oo={class:"mt-4 space-y-4 text-sm"},ro={class:"mt-6 flex items-center justify-end gap-2"},lo=["disabled"],no={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ao={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},io={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},uo={class:"flex items-center gap-2"},co=["disabled"],fo={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},vo={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},xo={key:1,class:"mt-4 grid gap-3 text-xs text-muted-foreground"},go={key:0,class:"space-y-1"},po={class:"flex flex-wrap gap-x-4 gap-y-1"},mo={key:1,class:"space-y-1"},bo={class:"flex flex-wrap gap-x-4 gap-y-1"},yo={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},_o={key:0,class:"space-y-2"},wo={class:"space-y-1 text-[11px] text-muted-foreground"},ko={key:1,class:"mt-4 space-y-2"},ho={class:"space-y-1 text-[11px] text-muted-foreground"},Co={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},To={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},So={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Ao={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},Lo={class:"mt-4 space-y-3 text-sm"},Eo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},$o={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},Ro={class:"flex items-center justify-between"},Vo={class:"flex items-center gap-2"},Io={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},jo={class:"mt-4"},Do=["readonly"],Mo={class:"mt-6 flex items-center justify-end gap-2"},Oo=["disabled"],De="accounts-register-task-cache",Me="accounts-login-task-cache",Oe="accounts-register-log-clear",Be="accounts-login-log-clear",Ne="accounts-register-task-cleared-id",Ue="accounts-login-task-cleared-id",Ko=Kt({__name:"Accounts",setup(x){const _=es(),{accounts:T,isLoading:ee}=Ht(_),h=Xt(),te=a(""),Q=a("all"),g=a(new Set),P=a("table"),se=a(!1),u=a(""),L=a(!1),E=a(""),q=a(""),j=a(!1),oe=a([]),re=a(1),ce=a(!1),F=a(!1),D=a(!1),Ae=a(null),fe=a(null),ve=a(null),M=a(null),O=a(null),W=a(0),X=a(0),xe=a(!1),d=a(null),c=a(null),ze=a(null),$=a(!1),k=a(!1),p=a(""),m=a({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),ge=a(null),Pe=a([]),gt=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],B=N(()=>{const e=te.value.trim().toLowerCase();return T.value.filter(t=>{const o=!e||t.id.toLowerCase().includes(e),i=Q.value==="all"||le(t)===Q.value;return o&&i})}),R=N(()=>g.value.size),Le=N(()=>B.value.length>0&&B.value.every(e=>g.value.has(e.id))),pe=async()=>{await _.loadAccounts(),g.value=new Set,D.value=!1},Fe=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},Ke=e=>{try{return localStorage.getItem(e)||null}catch{return null}},me=(e,t)=>{try{if(t){localStorage.setItem(e,t);return}localStorage.removeItem(e)}catch{}},He=(e,t)=>{try{localStorage.setItem(e,JSON.stringify(t))}catch{}},Je=e=>{try{localStorage.removeItem(e)}catch{}},Ge=e=>{const t=localStorage.getItem(e),o=Number(t);return Number.isFinite(o)?o:0},be=(e,t)=>{try{localStorage.setItem(e,String(t))}catch{}},Ee=(e,t=!0)=>{e&&(e.id&&e.id===M.value||(e.id&&M.value&&e.id!==M.value&&(M.value=null,me(Ne,null)),d.value=e,e.id&&e.id!==fe.value&&(fe.value=e.id,W.value=0,be(Oe,0)),t&&He(De,e)))},ye=(e,t=!0)=>{e&&(e.id&&e.id===O.value||(e.id&&O.value&&e.id!==O.value&&(O.value=null,me(Ue,null)),c.value=e,e.id&&e.id!==ve.value&&(ve.value=e.id,X.value=0,be(Be,0)),t&&He(Me,e)))},pt=()=>{W.value=Ge(Oe),X.value=Ge(Be),M.value=Ke(Ne),O.value=Ke(Ue);const e=Fe(De);e&&e.id!==M.value&&(d.value=e,fe.value=e.id||null);const t=Fe(Me);t&&t.id!==O.value&&(c.value=t,ve.value=t.id||null)},mt=()=>{ce.value=!0,xe.value=!1},Ye=()=>{ce.value=!1},bt=async()=>{try{const e=[],t=d.value?.id,o=c.value?.id;if(t&&!_e(t)&&e.push(ct(t)),o&&!we(o)&&e.push(ft(o)),!e.length){await je();return}await Promise.all(e)}catch(e){p.value=e?.message||"任务状态更新失败"}},yt=async()=>{F.value=!0,await bt()},_t=()=>{F.value=!1},wt=()=>{const e=d.value?.id||null,t=c.value?.id||null;M.value=e,O.value=t,me(Ne,e),me(Ue,t),W.value=d.value?.logs?.length||0,X.value=c.value?.logs?.length||0,be(Oe,W.value),be(Be,X.value),d.value=null,c.value=null,fe.value=null,ve.value=null,p.value="",$.value=!1,k.value=!1,J(),G(),Je(De),Je(Me)},_e=e=>!!(e&&e===M.value),we=e=>!!(e&&e===O.value),kt=()=>{D.value=!D.value},Z=()=>{D.value=!1},Qe=e=>{if(!D.value)return;const t=e.target;Ae.value&&!Ae.value.contains(t)&&(D.value=!1)};Jt(async()=>{pt(),await pe(),await je(),Nt(),document.addEventListener("click",Qe)});const K=N(()=>{const e=d.value?.logs||[];return W.value?e.slice(W.value):e}),H=N(()=>{const e=c.value?.logs||[];return X.value?e.slice(X.value):e}),ht=N(()=>!!p.value||!!d.value||!!c.value||K.value.length>0||H.value.length>0),Ct=async()=>{await Qt();const e=ze.value;e&&(e.scrollTop=e.scrollHeight)};Gt([K,H,F],async()=>{F.value&&await Ct()},{deep:!0});const Tt=N(()=>{const e=d.value?.status,t=c.value?.status;return e==="running"||e==="pending"||t==="running"||t==="pending"}),St=N(()=>{if(p.value)return"bg-rose-500";if(Tt.value)return"bg-sky-400";const e=[];if(d.value){const f=d.value.success_count??0,w=d.value.fail_count??0,Y=d.value.count??f+w;e.push({success:f,fail:w,total:Y,status:d.value.status})}if(c.value){const f=c.value.success_count??0,w=c.value.fail_count??0,Y=c.value.account_ids?.length??f+w;e.push({success:f,fail:w,total:Y,status:c.value.status})}if(!e.length)return"bg-muted-foreground";const t=e.reduce((f,w)=>f+w.success,0),o=e.reduce((f,w)=>f+w.fail,0),i=e.reduce((f,w)=>f+(w.total||0),0);if(t>0&&o>0)return"bg-amber-400";if(o>0&&t===0)return"bg-rose-500";if(t>0&&o===0)return"bg-emerald-400";if(i===0){const f=e.every(Y=>Y.status==="success");if(e.some(Y=>Y.status==="failed"))return"bg-rose-500";if(f)return"bg-emerald-400"}return"bg-muted-foreground"});Yt(()=>{J(),G(),Bt(),document.removeEventListener("click",Qe)});const le=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?"429限流":e.cooldown_reason==="错误禁用"?"错误禁用":e.disabled?"手动禁用":e.status==="已过期"?"已过期":e.status==="即将过期"?"即将过期":"正常",qe=e=>{const t=le(e);return t==="429限流"||t==="即将过期"?"bg-amber-200 text-amber-900":t==="错误禁用"||t==="已过期"?"bg-destructive/10 text-destructive":t==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},We=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?!0:e.disabled||e.cooldown_reason==="错误禁用",Xe=e=>e==="已过期"?"过期":e==="未设置"?"未设置":e,Ze=e=>e.status==="已过期"?"text-rose-600":e.status==="即将过期"?"text-amber-700":e.status==="未设置"?"text-muted-foreground":"text-emerald-600",et=e=>e<60?`${e} 秒`:e<3600?`${Math.ceil(e/60)} 分钟`:`${(e/3600).toFixed(1)} 小时`,$e=e=>e.cooldown_seconds>0?"text-amber-700":e.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",tt=e=>{const t=le(e);return t==="手动禁用"||t==="已过期"?"bg-muted/70":""},ke=e=>{const t=new Set(g.value);t.has(e)?t.delete(e):t.add(e),g.value=t},st=()=>{if(Le.value){g.value=new Set;return}g.value=new Set(B.value.map(e=>e.id))},At=(e,t)=>e.id||`account_${t+1}`,Lt=async()=>(await y.getConfig()).accounts.map((t,o)=>({...t,id:At(t,o)})),ot=e=>`${e.time} [${e.level}] ${e.message}`,Et=(e,t)=>{let o=-1;for(let f=0;f<e.length;f+=1)if(e[f].id===t){o=f;break}if(o===-1)return u.value="未找到对应账号配置。",!1;const i=e[o];return m.value={id:i.id,secure_c_ses:i.secure_c_ses,csesidx:i.csesidx,config_id:i.config_id,host_c_oses:i.host_c_oses,expires_at:i.expires_at},Pe.value=e,ge.value=o,se.value=!0,!0},rt=async e=>{u.value="";try{const t=await Lt();Et(t,e)}catch(t){u.value=t.message||"加载账号配置失败"}},$t=async()=>{E.value="";try{const e=await y.getConfig();oe.value=Array.isArray(e.accounts)?e.accounts:[],q.value=JSON.stringify(nt(oe.value),null,2),j.value=!0,L.value=!0}catch(e){E.value=e.message||"加载账号配置失败"}},Re=()=>{L.value=!1,E.value="",j.value=!1},lt=()=>{const e=JSON.parse(q.value);if(!Array.isArray(e))throw new Error("配置格式必须是数组。");return e},Rt=e=>typeof e!="string"||!e?e:e.length<=6?`${e.slice(0,2)}****`:`${e.slice(0,3)}****`,nt=e=>{const t=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password"]);return e.map(o=>{const i={...o};return t.forEach(f=>{const w=i[f];w&&(i[f]=Rt(w))}),i})},Vt=()=>{if(E.value="",!j.value){try{oe.value=lt()}catch(e){E.value=e.message||"JSON 格式错误";return}q.value=JSON.stringify(nt(oe.value),null,2),j.value=!0;return}q.value=JSON.stringify(oe.value,null,2),j.value=!1},It=async()=>{E.value="";try{const e=lt();await _.updateConfig(e),Re()}catch(e){E.value=e.message||"保存失败"}},Ve=()=>{se.value=!1,u.value=""},jt=async()=>{if(ge.value===null)return;const e=[...Pe.value];e[ge.value]={...e[ge.value],id:m.value.id,secure_c_ses:m.value.secure_c_ses,csesidx:m.value.csesidx,config_id:m.value.config_id,host_c_oses:m.value.host_c_oses||void 0,expires_at:m.value.expires_at||void 0};try{await _.updateConfig(e),Ve()}catch(t){u.value=t.message||"保存失败"}},Dt=async()=>{await _.bulkEnable(Array.from(g.value)),g.value=new Set},Mt=async()=>{await h.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"})&&(await _.bulkDisable(Array.from(g.value)),g.value=new Set)},Ot=async()=>{await h.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"})&&(await _.bulkDelete(Array.from(g.value)),g.value=new Set)},at=async e=>{await _.enableAccount(e)},it=async e=>{await h.ask({title:"禁用账号",message:"确定要禁用该账号吗?"})&&await _.disableAccount(e)},ut=async e=>{await h.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"})&&await _.deleteAccount(e)};let ne=null,ae=null,ie=null,he=!1;const J=()=>{ne!==null&&(window.clearInterval(ne),ne=null)},G=()=>{ae!==null&&(window.clearInterval(ae),ae=null)},Bt=()=>{ie!==null&&(window.clearInterval(ie),ie=null),he=!1},dt=e=>e==="pending"?"等待中":e==="running"?"执行中":e==="success"?"成功":e==="failed"?"失败":e,ct=async e=>{if(_e(e)){J();return}const t=await y.getRegisterTask(e);if(_e(t.id)){J();return}Ee(t),t.status!=="running"&&t.status!=="pending"&&($.value=!1,J(),await pe())},ft=async e=>{if(we(e)){G();return}const t=await y.getLoginTask(e);if(we(t.id)){G();return}ye(t),t.status!=="running"&&t.status!=="pending"&&(k.value=!1,G(),await pe())},vt=e=>{J(),ne=window.setInterval(()=>{ct(e).catch(t=>{p.value=t?.message||"注册任务更新失败",J(),$.value=!1})},3e3)},Ie=e=>{G(),ae=window.setInterval(()=>{ft(e).catch(t=>{p.value=t?.message||"刷新任务更新失败",G(),k.value=!1})},3e3)},Nt=()=>{ie===null&&(ie=window.setInterval(async()=>{if(!he&&!F.value&&!(ne!==null||ae!==null)&&!(!$.value&&!k.value&&!d.value&&!c.value)){he=!0;try{await je()}catch(e){p.value=e?.message||"后台刷新失败"}finally{he=!1}}},6e3))},je=async()=>{try{const e=await y.getRegisterCurrent();e&&"id"in e&&!_e(e.id)&&(Ee(e),(e.status==="running"||e.status==="pending")&&($.value=!0,vt(e.id)))}catch(e){p.value=e.message||"加载注册任务失败"}try{const e=await y.getLoginCurrent();e&&"id"in e&&!we(e.id)&&(ye(e),(e.status==="running"||e.status==="pending")&&(k.value=!0,Ie(e.id)))}catch(e){p.value=e.message||"加载刷新任务失败"}},Ut=async()=>{p.value="",$.value=!0;try{const e=Number.isFinite(re.value)&&re.value>0?re.value:void 0,t=await y.startRegister(e);Ee(t),vt(t.id),ce.value=!1,F.value=!0}catch(e){p.value=e.message||"启动注册失败",$.value=!1}},zt=async()=>{if(g.value.size){p.value="",k.value=!0;try{const e=await y.startLogin(Array.from(g.value));ye(e),Ie(e.id)}catch(e){p.value=e.message||"启动刷新失败",k.value=!1}}},Pt=async()=>{p.value="",k.value=!0;try{await y.checkLogin();const e=await y.getLoginCurrent();if(e&&"id"in e){ye(e),Ie(e.id);return}k.value=!1}catch(e){p.value=e.message||"触发刷新失败",k.value=!1}};return(e,t)=>(r(),l(ue,null,[s("div",ts,[s("section",ss,[s("div",os,[s("div",rs,[V(s("input",{"onUpdate:modelValue":t[0]||(t[0]=o=>te.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[I,te.value]]),U(qt,{modelValue:Q.value,"onUpdate:modelValue":t[1]||(t[1]=o=>Q.value=o),options:gt},null,8,["modelValue"])]),s("div",ls,[U(de,{modelValue:Le.value,"onUpdate:modelValue":st},{default:xt(()=>[...t[24]||(t[24]=[z(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+n(R.value)+" / "+n(B.value.length)+" 个账号",1),s("div",ns,[s("button",{type:"button",class:b(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",P.value==="table"?"bg-accent text-accent-foreground":""]),onClick:t[2]||(t[2]=o=>P.value="table"),"aria-label":"列表视图"},[...t[25]||(t[25]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:b(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",P.value==="card"?"bg-accent text-accent-foreground":""]),onClick:t[3]||(t[3]=o=>P.value="card"),"aria-label":"卡片视图"},[...t[26]||(t[26]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",as,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:S(ee),onClick:pe}," 刷新列表 ",8,is),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:$t}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:$.value,onClick:mt}," 添加账户 ",8,us),s("div",{ref_key:"moreActionsRef",ref:Ae,class:"relative"},[s("button",{class:b(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",D.value?"bg-accent text-accent-foreground":""]),onClick:kt},[t[27]||(t[27]=z(" 更多操作 ",-1)),t[28]||(t[28]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),ht.value?(r(),l("span",{key:0,class:b(["ml-1 h-2 w-2 rounded-full",St.value]),"aria-hidden":"true"},null,2)):v("",!0)],2),D.value?(r(),l("div",ds,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:t[4]||(t[4]=o=>{yt(),Z()})}," 任务状态 "),t[29]||(t[29]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",k.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:k.value,onClick:t[5]||(t[5]=o=>{Pt(),Z()})}," 刷新过期 ",10,cs),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!R.value||k.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!R.value||k.value,onClick:t[6]||(t[6]=o=>{zt(),Z()})}," 刷新选中 ",10,fs),t[30]||(t[30]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",R.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!R.value,onClick:t[7]||(t[7]=o=>{Dt(),Z()})}," 批量启用 ",10,vs),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",R.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!R.value,onClick:t[8]||(t[8]=o=>{Mt(),Z()})}," 批量禁用 ",10,xs),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",R.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!R.value,onClick:t[9]||(t[9]=o=>{Ot(),Z()})}," 批量删除 ",10,gs)])):v("",!0)],512)]),P.value==="card"?(r(),l("div",ps,[(r(!0),l(ue,null,Te(B.value,o=>(r(),l("div",{key:o.id,class:b(["rounded-2xl border border-border bg-card p-4",tt(o)]),onClick:i=>ke(o.id)},[s("div",bs,[s("div",null,[t[31]||(t[31]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",ys,n(o.id),1)]),s("div",_s,[U(de,{modelValue:g.value.has(o.id),"onUpdate:modelValue":i=>ke(o.id),onClick:t[10]||(t[10]=A(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:b(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",qe(o)])},n(le(o)),3)])]),s("div",ws,[s("div",null,[t[32]||(t[32]=s("p",null,"剩余时间",-1)),s("p",{class:b(["mt-1 text-sm font-semibold",Ze(o)])},n(Xe(o.remaining_display)),3),o.expires_at?(r(),l("p",ks,n(o.expires_at),1)):v("",!0)]),s("div",null,[t[33]||(t[33]=s("p",null,"冷却",-1)),s("p",{class:b(["mt-1",$e(o)])},[o.cooldown_seconds>0?(r(),l("span",hs,n(et(o.cooldown_seconds))+" · "+n(o.cooldown_reason),1)):(r(),l("span",Cs,n(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[t[34]||(t[34]=s("p",null,"失败数",-1)),s("p",Ts,n(o.error_count),1)]),s("div",null,[t[35]||(t[35]=s("p",null,"会话数",-1)),s("p",Ss,n(o.conversation_count),1)])]),s("div",As,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>rt(o.id),["stop"])}," 编辑 ",8,Ls),We(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[11]||(t[11]=A(()=>{},["stop"])),i=>at(o.id)]}," 启用 ",8,Es)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[12]||(t[12]=A(()=>{},["stop"])),i=>it(o.id)]}," 禁用 ",8,$s)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[t[13]||(t[13]=A(()=>{},["stop"])),i=>ut(o.id)]}," 删除 ",8,Rs)])],10,ms))),128)),!B.value.length&&!S(ee)?(r(),l("div",Vs," 暂无账号数据,请检查后台配置。 ")):v("",!0)])):(r(),l("div",Is,[s("table",js,[s("thead",Ds,[s("tr",null,[s("th",Ms,[U(de,{modelValue:Le.value,"onUpdate:modelValue":st},null,8,["modelValue"])]),t[37]||(t[37]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),t[38]||(t[38]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",Os,[s("span",Bs,[t[36]||(t[36]=z(" 剩余/过期 ",-1)),U(Zt,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),t[39]||(t[39]=s("th",{class:"py-3 pr-6"},"冷却",-1)),t[40]||(t[40]=s("th",{class:"py-3 pr-6"},"失败数",-1)),t[41]||(t[41]=s("th",{class:"py-3 pr-6"},"会话数",-1)),t[42]||(t[42]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",Ns,[!B.value.length&&!S(ee)?(r(),l("tr",Us,[...t[43]||(t[43]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):v("",!0),(r(!0),l(ue,null,Te(B.value,o=>(r(),l("tr",{key:o.id,class:b(["border-t border-border",tt(o)]),onClick:i=>ke(o.id)},[s("td",{class:"py-4 pr-4",onClick:t[14]||(t[14]=A(()=>{},["stop"]))},[U(de,{modelValue:g.value.has(o.id),"onUpdate:modelValue":i=>ke(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",Ps,n(o.id),1),s("td",Fs,[s("span",{class:b(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",qe(o)])},n(le(o)),3)]),s("td",Ks,[s("div",{class:b(["text-sm font-semibold",Ze(o)])},n(Xe(o.remaining_display)),3),o.expires_at?(r(),l("span",Hs,n(o.expires_at),1)):v("",!0)]),s("td",Js,[o.cooldown_seconds>0?(r(),l("span",{key:0,class:b($e(o))},n(et(o.cooldown_seconds))+" · "+n(o.cooldown_reason),3)):(r(),l("span",{key:1,class:b($e(o))},n(o.cooldown_reason||"无冷却"),3))]),s("td",Gs,n(o.error_count),1),s("td",Ys,n(o.conversation_count),1),s("td",Qs,[s("div",qs,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>rt(o.id),["stop"])}," 编辑 ",8,Ws),We(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>at(o.id),["stop"])}," 启用 ",8,Xs)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>it(o.id),["stop"])}," 禁用 ",8,Zs)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:A(i=>ut(o.id),["stop"])}," 删除 ",8,eo)])])],10,zs))),128))])])]))])]),U(Wt,{open:S(h).open.value,title:S(h).title.value,message:S(h).message.value,"confirm-text":S(h).confirmText.value,"cancel-text":S(h).cancelText.value,onConfirm:S(h).confirm,onCancel:S(h).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(r(),Ce(Se,{to:"body"},[ce.value?(r(),l("div",to,[s("div",so,[s("div",{class:"flex items-center justify-between"},[t[44]||(t[44]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"添加账户"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"创建 DuckMail 账号并自动注册")],-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Ye}," 关闭 ")]),s("div",oo,[t[46]||(t[46]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),V(s("input",{"onUpdate:modelValue":t[15]||(t[15]=o=>re.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,re.value,void 0,{number:!0}]]),t[47]||(t[47]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"}," 默认域名来自设置面板(可在“配置面板”中修改) ",-1)),t[48]||(t[48]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-[11px] leading-relaxed text-muted-foreground"},[s("div",{class:"space-y-2"},[s("p",{class:"font-semibold text-rose-600"},"⚠️ 严禁滥用:禁止将本工具用于商业用途或任何形式的滥用(无论规模大小)"),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"合法用途:"),z("本项目仅限个人学习、技术研究与非商业性技术交流,旨在探索浏览器自动化与系统集成。")])]),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"禁止行为:"),z("严禁用于以下场景:")]),s("p",{class:"pl-3"},"• 商业用途或盈利性使用"),s("p",{class:"pl-3"},"• 任何形式的批量注册或自动化滥用(无论规模大小)"),s("p",{class:"pl-3"},"• 破坏市场秩序或恶意竞争"),s("p",{class:"pl-3"},"• 违反 Google 服务条款的任何行为")]),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"使用责任:"),z("因使用本工具产生的一切后果由使用者完全承担,包括但不限于账号封禁、数据损失及法律责任。")]),s("p",null,[s("strong",null,"合规要求:"),z("使用者必须遵守所在地法律法规及第三方服务条款,作者不对任何违规使用行为承担责任。")])]),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"技术声明:")]),s("p",{class:"pl-3"},'• 本项目按"现状"提供,不提供任何明示或暗示的担保'),s("p",{class:"pl-3"},"• 依赖 DuckMail API 等第三方服务,其可用性不受作者控制"),s("p",{class:"pl-3"},"• 作者保留随时停止维护或变更功能的权利")])])],-1)),U(de,{modelValue:xe.value,"onUpdate:modelValue":t[16]||(t[16]=o=>xe.value=o)},{default:xt(()=>[...t[45]||(t[45]=[z(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])]),s("div",ro,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ye}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:$.value||!xe.value,onClick:Ut}," 开始注册 ",8,lo)])])])):v("",!0)])),(r(),Ce(Se,{to:"body"},[F.value?(r(),l("div",no,[s("div",ao,[s("div",io,[t[49]||(t[49]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",uo,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary",disabled:!K.value.length&&!H.value.length&&!d.value&&!c.value&&!p.value,onClick:wt}," 清空日志 ",8,co),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:_t}," 关闭 ")])]),s("div",fo,[p.value?(r(),l("div",vo,n(p.value),1)):v("",!0),d.value||c.value?(r(),l("div",xo,[d.value?(r(),l("div",go,[t[50]||(t[50]=s("div",{class:"font-medium text-foreground"},"注册任务",-1)),s("div",po,[s("span",null,"状态:"+n(dt(d.value.status)),1),s("span",null,"进度:"+n(d.value.progress)+"/"+n(d.value.count),1),s("span",null,"成功:"+n(d.value.success_count),1),s("span",null,"失败:"+n(d.value.fail_count),1)])])):v("",!0),c.value?(r(),l("div",mo,[t[51]||(t[51]=s("div",{class:"font-medium text-foreground"},"刷新任务",-1)),s("div",bo,[s("span",null,"状态:"+n(dt(c.value.status)),1),s("span",null,"进度:"+n(c.value.progress)+"/"+n(c.value.account_ids.length),1),s("span",null,"成功:"+n(c.value.success_count),1),s("span",null,"失败:"+n(c.value.fail_count),1)])])):v("",!0)])):v("",!0),K.value.length||H.value.length?(r(),l("div",yo,[s("div",{ref_key:"taskLogsRef",ref:ze,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[K.value.length?(r(),l("div",_o,[t[52]||(t[52]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",wo,[(r(!0),l(ue,null,Te(K.value,(o,i)=>(r(),l("div",{key:`reg-${i}`,class:"font-mono"},n(ot(o)),1))),128))])])):v("",!0),H.value.length?(r(),l("div",ko,[t[53]||(t[53]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",ho,[(r(!0),l(ue,null,Te(H.value,(o,i)=>(r(),l("div",{key:`login-${i}`,class:"font-mono"},n(ot(o)),1))),128))])])):v("",!0)],512)])):v("",!0),!p.value&&!d.value&&!c.value&&!K.value.length&&!H.value.length?(r(),l("div",Co," 暂无任务 ")):v("",!0)])])])):v("",!0)])),(r(),Ce(Se,{to:"body"},[se.value?(r(),l("div",To,[s("div",So,[s("div",{class:"flex items-center justify-between"},[t[54]||(t[54]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Ve}," 关闭 ")]),u.value?(r(),l("div",Ao,n(u.value),1)):v("",!0),s("div",Lo,[t[55]||(t[55]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),V(s("input",{"onUpdate:modelValue":t[17]||(t[17]=o=>m.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[I,m.value.id]]),t[56]||(t[56]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),V(s("textarea",{"onUpdate:modelValue":t[18]||(t[18]=o=>m.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[I,m.value.secure_c_ses]]),t[57]||(t[57]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),V(s("input",{"onUpdate:modelValue":t[19]||(t[19]=o=>m.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,m.value.csesidx]]),t[58]||(t[58]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),V(s("input",{"onUpdate:modelValue":t[20]||(t[20]=o=>m.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,m.value.config_id]]),t[59]||(t[59]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),V(s("input",{"onUpdate:modelValue":t[21]||(t[21]=o=>m.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,m.value.host_c_oses]]),t[60]||(t[60]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),V(s("input",{"onUpdate:modelValue":t[22]||(t[22]=o=>m.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[I,m.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ve}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:jt}," 保存 ")])])])):v("",!0)])),(r(),Ce(Se,{to:"body"},[L.value?(r(),l("div",Eo,[s("div",$o,[s("div",Ro,[t[61]||(t[61]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",Vo,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Vt},n(j.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Re}," 关闭 ")])]),E.value?(r(),l("div",Io,n(E.value),1)):v("",!0),s("div",jo,[V(s("textarea",{"onUpdate:modelValue":t[23]||(t[23]=o=>q.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:j.value},null,8,Do),[[I,q.value]])]),s("div",Mo,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Re}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:It,disabled:j.value}," 保存 ",8,Oo)])])])):v("",!0)]))],64))}});export{Ko as default};
static/assets/Accounts-DeEVJUcd.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ import{g as E,C as os,h as i,d as rs,D as ls,i as J,o as ns,z as as,j as is,c as n,a as s,p as G,m as Re,q as R,v as V,s as $t,t as a,n as p,u as j,b as g,f as ee,F as ge,r as Ve,T as je,E as ds,w as M,e as l,G as us}from"./index-Dul9zA0O.js";import{_ as cs}from"./SelectMenu.vue_vue_type_script_setup_true_lang-B6K28QJL.js";import{_ as be}from"./Checkbox.vue_vue_type_script_setup_true_lang-BzH_cd6M.js";import{_ as fs}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-Dx9N8w52.js";import{u as vs}from"./useConfirmDialog-Bh7Fog50.js";import{_ as ms}from"./HelpTip.vue_vue_type_script_setup_true_lang-ZZDQpvjn.js";const w={list:()=>E.get("/admin/accounts"),getConfig:()=>E.get("/admin/accounts-config"),updateConfig:y=>E.put("/admin/accounts-config",y),delete:y=>E.delete(`/admin/accounts/${y}`),disable:y=>E.put(`/admin/accounts/${y}/disable`),enable:y=>E.put(`/admin/accounts/${y}/enable`),startRegister:(y,k)=>E.post("/admin/register/start",{count:y,domain:k}),getRegisterTask:y=>E.get(`/admin/register/task/${y}`),getRegisterCurrent:()=>E.get("/admin/register/current"),startLogin:y=>E.post("/admin/login/start",y),getLoginTask:y=>E.get(`/admin/login/task/${y}`),getLoginCurrent:()=>E.get("/admin/login/current"),checkLogin:()=>E.post("/admin/login/check")},ps=os("accounts",()=>{const y=i([]),k=i(!1);async function A(){k.value=!0;try{const x=await w.list();y.value=Array.isArray(x)?x:x.accounts||[]}finally{k.value=!1}}async function ne(x){await w.delete(x),await A()}async function T(x){await w.disable(x),await A()}async function d(x){await w.enable(x),await A()}async function ae(x){await Promise.all(x.map($=>w.enable($))),await A()}async function te(x){await Promise.all(x.map($=>w.disable($))),await A()}async function b(x){await Promise.all(x.map($=>w.delete($))),await A()}async function Y(x){await w.updateConfig(x),await A()}return{accounts:y,isLoading:k,loadAccounts:A,deleteAccount:ne,disableAccount:T,enableAccount:d,bulkEnable:ae,bulkDisable:te,bulkDelete:b,updateConfig:Y}}),xs={class:"space-y-8"},gs={class:"rounded-3xl border border-border bg-card p-6"},bs={class:"flex flex-wrap items-center justify-between gap-4"},ys={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},_s={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},hs={class:"ml-auto flex items-center gap-2 sm:ml-0"},ws={class:"mt-4 flex flex-wrap items-center gap-2"},ks=["disabled"],Cs=["disabled"],Ts={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},Ss=["disabled"],$s=["disabled"],Is=["disabled"],Es=["disabled"],Ls=["disabled"],As={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},Rs=["onClick"],Vs={class:"flex items-start justify-between gap-3"},js={class:"mt-1 font-mono text-xs text-foreground"},Ms={class:"flex items-center gap-2"},Ds={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},Os={key:0,class:"mt-1 text-[11px]"},Bs={key:0},Ns={key:1},Us={class:"mt-1 text-sm font-semibold text-foreground"},zs={class:"mt-1 text-sm font-semibold text-foreground"},Ps={class:"mt-4 flex flex-wrap items-center gap-2"},Fs=["onClick"],Ks=["onClick"],Hs=["onClick"],Js=["onClick"],Gs={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Ys={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},qs={class:"min-w-full text-left text-sm"},Qs={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Xs={class:"py-3 pr-4"},Ws={class:"py-3 pr-6"},Zs={class:"inline-flex items-center gap-2"},eo={class:"text-sm text-foreground"},to={key:0},so=["onClick"],oo={class:"py-4 pr-6 font-mono text-xs text-foreground"},ro={class:"py-4 pr-6"},lo={class:"py-4 pr-6"},no={key:0,class:"block text-[11px] text-muted-foreground"},ao={class:"py-4 pr-6 text-xs"},io={class:"py-4 pr-6 text-xs text-muted-foreground"},uo={class:"py-4 pr-6 text-xs text-muted-foreground"},co={class:"py-4 text-right"},fo={class:"flex flex-wrap justify-end gap-2"},vo=["onClick"],mo=["onClick"],po=["onClick"],xo=["onClick"],go={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},bo={class:"flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},yo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},_o={class:"mt-1 text-xs text-muted-foreground"},ho={class:"scrollbar-slim flex-1 overflow-y-auto px-6 py-4"},wo={class:"space-y-4 text-sm"},ko={class:"flex rounded-full border border-border bg-muted/30 p-1 text-xs"},Co={key:0,class:"space-y-4"},To={key:1,class:"space-y-4"},So={key:0,class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-600"},$o={class:"border-t border-border/60 px-6 py-4"},Io={class:"flex items-center justify-end gap-2"},Eo=["disabled"],Lo=["disabled"],Ao={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Ro={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},Vo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},jo={class:"flex items-center gap-2"},Mo=["disabled"],Do={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},Oo={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},Bo={key:1,class:"grid gap-3 text-xs text-muted-foreground"},No={key:0,class:"space-y-1"},Uo={class:"flex items-center gap-2 font-medium text-foreground"},zo={class:"flex flex-wrap gap-x-4 gap-y-1"},Po={key:1,class:"space-y-1"},Fo={class:"flex items-center gap-2 font-medium text-foreground"},Ko={class:"flex flex-wrap gap-x-4 gap-y-1"},Ho={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},Jo={key:0,class:"space-y-2"},Go={class:"space-y-1 text-[11px] text-muted-foreground"},Yo={key:1,class:"mt-4 space-y-2"},qo={class:"space-y-1 text-[11px] text-muted-foreground"},Qo={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},Xo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Wo={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Zo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},er={class:"mt-4 space-y-3 text-sm"},tr={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},sr={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},or={class:"flex items-center justify-between"},rr={class:"flex items-center gap-2"},lr={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},nr={class:"mt-4"},ar=["readonly"],ir={class:"mt-6 flex items-center justify-end gap-2"},dr=["disabled"],Je="accounts-register-task-cache",Ge="accounts-login-task-cache",Ye="accounts-register-log-clear",qe="accounts-login-log-clear",Qe="accounts-register-task-cleared-id",Xe="accounts-login-task-cleared-id",It="1970-01-01 00:00:00",xr=rs({__name:"Accounts",setup(y){const k=ps(),{accounts:A,isLoading:ne}=ls(k),T=vs(),d=ds(),ae=i(""),te=i("all"),b=i(new Set),Y=i("table"),x=i(!1),$=i(""),Me=i(!1),D=i(""),se=i(""),N=i(!1),ie=i([]),de=i(1),ye=i(!1),U=i("register"),ue=i(""),z=i(""),_e=i(!1),q=i(!1),P=i(!1),De=i(null),he=i(null),we=i(null),F=i(null),K=i(null),oe=i(0),re=i(0),ce=i(!1),c=i(null),f=i(null),We=i(null),O=i(!1),S=i(!1),_=i(""),h=i({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),ke=i(null),Ze=i([]),Et=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],H=J(()=>{const t=ae.value.trim().toLowerCase();return A.value.filter(e=>{const o=!t||e.id.toLowerCase().includes(t),r=te.value==="all"||ve(e)===te.value;return o&&r})}),B=J(()=>b.value.size),Oe=J(()=>H.value.length>0&&H.value.every(t=>b.value.has(t.id))),fe=async()=>{await k.loadAccounts(),b.value=new Set,P.value=!1},et=t=>{try{const e=localStorage.getItem(t);return e?JSON.parse(e):null}catch{return null}},tt=t=>{try{return localStorage.getItem(t)||null}catch{return null}},Ce=(t,e)=>{try{if(e){localStorage.setItem(t,e);return}localStorage.removeItem(t)}catch{}},st=(t,e)=>{try{localStorage.setItem(t,JSON.stringify(e))}catch{}},ot=t=>{try{localStorage.removeItem(t)}catch{}},rt=t=>{const e=localStorage.getItem(t),o=Number(e);return Number.isFinite(o)?o:0},Te=(t,e)=>{try{localStorage.setItem(t,String(e))}catch{}},Be=(t,e=!0)=>{t&&(t.id&&t.id===F.value||(t.id&&F.value&&t.id!==F.value&&(F.value=null,Ce(Qe,null)),c.value=t,t.id&&t.id!==he.value&&(he.value=t.id,oe.value=0,Te(Ye,0)),e&&st(Je,t)))},Se=(t,e=!0)=>{t&&(t.id&&t.id===K.value||(t.id&&K.value&&t.id!==K.value&&(K.value=null,Ce(Xe,null)),f.value=t,t.id&&t.id!==we.value&&(we.value=t.id,re.value=0,Te(qe,0)),e&&st(Ge,t)))},Lt=()=>{oe.value=rt(Ye),re.value=rt(qe),F.value=tt(Qe),K.value=tt(Xe);const t=et(Je);t&&t.id!==F.value&&(c.value=t,he.value=t.id||null);const e=et(Ge);e&&e.id!==K.value&&(f.value=e,we.value=e.id||null)},At=()=>{ye.value=!0,U.value="register",ue.value="",z.value="",_e.value=!1,ce.value=!1},Ne=()=>{ye.value=!1},Rt=t=>{const e=[],o=[];return t.split(/\r?\n/).map(u=>u.trim()).filter(Boolean).forEach((u,m)=>{const v=u.split("----").map(I=>I.trim()),C=m+1;if(v.length){if(v[0].toLowerCase()==="duckmail"){if(v.length<3||!v[1]||!v[2]){o.push(`第 ${C} 行格式错误(duckmail)`);return}const I=v[1],Ae=v.slice(2).join("----");e.push({id:I,secure_c_ses:"",csesidx:"",config_id:"",expires_at:It,mail_provider:"duckmail",mail_address:I,mail_password:Ae});return}if(v.length>=4&&v[0]&&v[2]&&v[3]){const I=v[0],Ae=v[1]||"",L=v[2],ss=v.slice(3).join("----");e.push({id:I,secure_c_ses:"",csesidx:"",config_id:"",expires_at:It,mail_provider:"microsoft",mail_address:I,mail_password:Ae,mail_client_id:L,mail_refresh_token:ss,mail_tenant:"consumers"});return}o.push(`第 ${C} 行格式错误`)}}),{items:e,errors:o}},Vt=async()=>{if(z.value="",!ue.value.trim()){z.value="请输入导��内容";return}const{items:t,errors:e}=Rt(ue.value);if(!t.length){z.value=e.length?e.join(","):"未识别到有效账号";return}if(e.length){z.value=e.slice(0,3).join(",");return}_e.value=!0;try{const r=[...await vt()],u=new Map(r.map((C,I)=>[C.id,I])),m=[];t.forEach(C=>{const I=u.get(C.id||"");if(I===void 0){r.push(C),m.push(C.id);return}const L={...r[I],mail_provider:C.mail_provider,mail_address:C.mail_address};C.mail_provider==="microsoft"?(L.mail_client_id=C.mail_client_id,L.mail_refresh_token=C.mail_refresh_token,L.mail_tenant=C.mail_tenant,L.mail_password=C.mail_password):(L.mail_password=C.mail_password,L.mail_client_id=void 0,L.mail_refresh_token=void 0,L.mail_tenant=void 0),r[I]=L,m.push(C.id)}),await k.updateConfig(r),await fe(),b.value=new Set(m),d.success(`成功导入 ${m.length} 个账户`),Ne(),await T.ask({title:"导入成功",message:`已导入 ${m.length} 个账户并自动选中。是否立即刷新这些账户以获取 Cookie?`,confirmText:"立即刷新",cancelText:"稍后手动刷新"})&&await St()}catch(o){z.value=o.message||"导入失败",d.error(o.message||"导入失败")}finally{_e.value=!1}},jt=async()=>{try{const t=[],e=c.value?.id,o=f.value?.id;if(e&&!$e(e)&&t.push(kt(e)),o&&!Ie(o)&&t.push(Ct(o)),!t.length){await He();return}await Promise.all(t)}catch(t){_.value=t?.message||"任务状态更新失败"}},Ue=async()=>{q.value=!0,await jt()},Mt=()=>{q.value=!1},Dt=()=>{const t=c.value?.id||null,e=f.value?.id||null;F.value=t,K.value=e,Ce(Qe,t),Ce(Xe,e),oe.value=c.value?.logs?.length||0,re.value=f.value?.logs?.length||0,Te(Ye,oe.value),Te(qe,re.value),c.value=null,f.value=null,he.value=null,we.value=null,_.value="",O.value=!1,S.value=!1,W(),Z(),ot(Je),ot(Ge)},$e=t=>!!(t&&t===F.value),Ie=t=>!!(t&&t===K.value),Ot=()=>{P.value=!P.value},le=()=>{P.value=!1},lt=t=>{if(!P.value)return;const e=t.target;De.value&&!De.value.contains(e)&&(P.value=!1)};ns(async()=>{Lt(),await fe(),await He(),Zt(),document.addEventListener("click",lt)});const Q=J(()=>{const t=c.value?.logs||[];return oe.value?t.slice(oe.value):t}),X=J(()=>{const t=f.value?.logs||[];return re.value?t.slice(re.value):t}),Bt=J(()=>!!_.value||!!c.value||!!f.value||Q.value.length>0||X.value.length>0),Nt=async()=>{await us();const t=We.value;t&&(t.scrollTop=t.scrollHeight)};as([Q,X,q],async()=>{q.value&&await Nt()},{deep:!0});const Ut=J(()=>{const t=c.value?.status,e=f.value?.status;return t==="running"||t==="pending"||e==="running"||e==="pending"}),zt=J(()=>{if(_.value)return"bg-rose-500";if(Ut.value)return"bg-sky-400";const t=[];if(c.value){const u=c.value.success_count??0,m=c.value.fail_count??0,v=c.value.count??u+m;t.push({success:u,fail:m,total:v,status:c.value.status})}if(f.value){const u=f.value.success_count??0,m=f.value.fail_count??0,v=f.value.account_ids?.length??u+m;t.push({success:u,fail:m,total:v,status:f.value.status})}if(!t.length)return"bg-muted-foreground";const e=t.reduce((u,m)=>u+m.success,0),o=t.reduce((u,m)=>u+m.fail,0),r=t.reduce((u,m)=>u+(m.total||0),0);if(e>0&&o>0)return"bg-amber-400";if(o>0&&e===0)return"bg-rose-500";if(e>0&&o===0)return"bg-emerald-400";if(r===0){const u=t.every(v=>v.status==="success");if(t.some(v=>v.status==="failed"))return"bg-rose-500";if(u)return"bg-emerald-400"}return"bg-muted-foreground"});is(()=>{W(),Z(),Wt(),document.removeEventListener("click",lt)});const ve=t=>t.cooldown_reason?.includes("429")&&t.cooldown_seconds>0?"429限流":t.cooldown_reason==="错误禁用"?"错误禁用":t.disabled?"手动禁用":t.status==="已过期"?"已过期":t.status==="即将过期"?"即将过期":"正常",nt=t=>{const e=ve(t);return e==="429限流"||e==="即将过期"?"bg-amber-200 text-amber-900":e==="错误禁用"||e==="已过期"?"bg-destructive/10 text-destructive":e==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},at=t=>t.cooldown_reason?.includes("429")&&t.cooldown_seconds>0?!0:t.disabled||t.cooldown_reason==="错误禁用",it=t=>t==="已过期"?"过期":t==="未设置"?"未设置":t,dt=t=>t.status==="已过期"?"text-rose-600":t.status==="即将过期"?"text-amber-700":t.status==="未设置"?"text-muted-foreground":"text-emerald-600",ut=t=>t<60?`${t} 秒`:t<3600?`${Math.ceil(t/60)} 分钟`:`${(t/3600).toFixed(1)} 小时`,ze=t=>t.cooldown_seconds>0?"text-amber-700":t.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",ct=t=>{const e=ve(t);return e==="手动禁用"||e==="已过期"?"bg-muted/70":""},Ee=t=>{const e=new Set(b.value);e.has(t)?e.delete(t):e.add(t),b.value=e},ft=()=>{if(Oe.value){b.value=new Set;return}b.value=new Set(H.value.map(t=>t.id))},Pt=(t,e)=>t.id||`account_${e+1}`,vt=async()=>(await w.getConfig()).accounts.map((e,o)=>({...e,id:Pt(e,o)})),mt=t=>`${t.time} [${t.level}] ${t.message}`,Ft=(t,e)=>{let o=-1;for(let u=0;u<t.length;u+=1)if(t[u].id===e){o=u;break}if(o===-1)return $.value="未找到对应账号配置。",!1;const r=t[o];return h.value={id:r.id,secure_c_ses:r.secure_c_ses,csesidx:r.csesidx,config_id:r.config_id,host_c_oses:r.host_c_oses,expires_at:r.expires_at},Ze.value=t,ke.value=o,x.value=!0,!0},pt=async t=>{$.value="";try{const e=await vt();Ft(e,t)}catch(e){$.value=e.message||"加载账号配置失败"}},Kt=async()=>{D.value="";try{const t=await w.getConfig();ie.value=Array.isArray(t.accounts)?t.accounts:[],se.value=JSON.stringify(gt(ie.value),null,2),N.value=!0,Me.value=!0}catch(t){D.value=t.message||"加载账号配置失败"}},Pe=()=>{Me.value=!1,D.value="",N.value=!1},xt=()=>{const t=JSON.parse(se.value);if(!Array.isArray(t))throw new Error("配置格式必须是数组。");return t},Ht=t=>typeof t!="string"||!t?t:t.length<=6?`${t.slice(0,2)}****`:`${t.slice(0,3)}****`,gt=t=>{const e=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password","mail_refresh_token","mail_client_id"]);return t.map(o=>{const r={...o};return e.forEach(u=>{const m=r[u];m&&(r[u]=Ht(m))}),r})},Jt=()=>{if(D.value="",!N.value){try{ie.value=xt()}catch(t){D.value=t.message||"JSON 格式错误";return}se.value=JSON.stringify(gt(ie.value),null,2),N.value=!0;return}se.value=JSON.stringify(ie.value,null,2),N.value=!1},Gt=async()=>{D.value="";try{const t=xt();await k.updateConfig(t),d.success("配置保存成功"),Pe()}catch(t){D.value=t.message||"保存失败",d.error(t.message||"保存失败")}},Fe=()=>{x.value=!1,$.value=""},Yt=async()=>{if(ke.value===null)return;const t=[...Ze.value];t[ke.value]={...t[ke.value],id:h.value.id,secure_c_ses:h.value.secure_c_ses,csesidx:h.value.csesidx,config_id:h.value.config_id,host_c_oses:h.value.host_c_oses||void 0,expires_at:h.value.expires_at||void 0};try{await k.updateConfig(t),d.success("账号编辑成功"),Fe()}catch(e){$.value=e.message||"保存失败",d.error(e.message||"保存失败")}},qt=async()=>{try{await k.bulkEnable(Array.from(b.value)),d.success("批量启用成功"),b.value=new Set}catch(t){d.error(t.message||"批量启用失败")}},Qt=async()=>{if(await T.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"}))try{await k.bulkDisable(Array.from(b.value)),d.success("批量禁用成功"),b.value=new Set}catch(e){d.error(e.message||"批量禁用失败")}},Xt=async()=>{if(await T.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"}))try{await k.bulkDelete(Array.from(b.value)),d.success("批量删除成功"),b.value=new Set}catch(e){d.error(e.message||"批量删除失败")}},bt=async t=>{try{await k.enableAccount(t),d.success("账号已启用")}catch(e){d.error(e.message||"启用失败")}},yt=async t=>{if(await T.ask({title:"禁用账号",message:"确定要禁用该账号吗?"}))try{await k.disableAccount(t),d.success("账号已禁用")}catch(o){d.error(o.message||"禁用失败")}},_t=async t=>{if(await T.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"}))try{await k.deleteAccount(t),d.success("账号已删除")}catch(o){d.error(o.message||"删除失败")}};let me=null,pe=null,xe=null,Le=!1;const W=()=>{me!==null&&(window.clearInterval(me),me=null)},Z=()=>{pe!==null&&(window.clearInterval(pe),pe=null)},Wt=()=>{xe!==null&&(window.clearInterval(xe),xe=null),Le=!1},ht=t=>t==="pending"?"等待中":t==="running"?"执行中":t==="success"?"成功":t==="failed"?"失败":t,wt=t=>{const e=t.status,o=t.success_count??0,r=t.fail_count??0;if(e==="running"||e==="pending")return"bg-sky-400";if(e==="success"||e==="failed"){if(o>0&&r===0)return"bg-emerald-400";if(r>0&&o===0)return"bg-rose-500";if(o>0&&r>0)return"bg-amber-400"}return"bg-muted-foreground"},kt=async t=>{if($e(t)){W();return}const e=await w.getRegisterTask(t);if($e(e.id)){W();return}if(Be(e),e.status!=="running"&&e.status!=="pending"){O.value=!1,W(),await fe();const o=e.success_count||0,r=e.fail_count||0;o>0&&r>0?d.success(`注册任务完成:成功 ${o},失败 ${r}`):o>0&&r===0?d.success(`注册任务完成:全部成功 (${o})`):r>0&&o===0?d.error(`注册任务完成:全部失败 (${r})`):d.error("注册任务失败")}},Ct=async t=>{if(Ie(t)){Z();return}const e=await w.getLoginTask(t);if(Ie(e.id)){Z();return}if(Se(e),e.status!=="running"&&e.status!=="pending"){S.value=!1,Z(),await fe();const o=e.success_count||0,r=e.fail_count||0;o>0&&r>0?d.success(`刷新任务完成:成功 ${o},失败 ${r}`):o>0&&r===0?d.success(`刷新任务完成:全部成功 (${o})`):r>0&&o===0?d.error(`刷新任务完成:全部失败 (${r})`):d.error("刷新任务失败")}},Tt=t=>{W(),me=window.setInterval(()=>{kt(t).catch(e=>{_.value=e?.message||"注册任务更新失败",W(),O.value=!1})},3e3)},Ke=t=>{Z(),pe=window.setInterval(()=>{Ct(t).catch(e=>{_.value=e?.message||"刷新任务更新失败",Z(),S.value=!1})},3e3)},Zt=()=>{xe===null&&(xe=window.setInterval(async()=>{if(!Le&&!q.value&&!(me!==null||pe!==null)&&!(!O.value&&!S.value&&!c.value&&!f.value)){Le=!0;try{await He()}catch(t){_.value=t?.message||"后台刷新失败"}finally{Le=!1}}},6e3))},He=async()=>{try{const t=await w.getRegisterCurrent();t&&"id"in t&&!$e(t.id)&&(Be(t),(t.status==="running"||t.status==="pending")&&(O.value=!0,Tt(t.id)))}catch(t){_.value=t.message||"加载注册任务失败"}try{const t=await w.getLoginCurrent();t&&"id"in t&&!Ie(t.id)&&(Se(t),(t.status==="running"||t.status==="pending")&&(S.value=!0,Ke(t.id)))}catch(t){_.value=t.message||"加载刷新任务失败"}},es=async()=>{_.value="",O.value=!0;try{const t=Number.isFinite(de.value)&&de.value>0?de.value:void 0,e=await w.startRegister(t);Be(e),Tt(e.id),ye.value=!1,q.value=!0}catch(t){_.value=t.message||"启动注册失败",O.value=!1}},St=async()=>{if(b.value.size){_.value="",S.value=!0;try{const t=await w.startLogin(Array.from(b.value));Se(t),Ke(t.id),Ue()}catch(t){_.value=t.message||"启动刷新失败",S.value=!1}}},ts=async()=>{_.value="",S.value=!0;try{await w.checkLogin();const t=await w.getLoginCurrent();if(t&&"id"in t){Se(t),Ke(t.id),Ue();return}S.value=!1}catch(t){_.value=t.message||"触发刷新失败",S.value=!1}};return(t,e)=>(l(),n(ge,null,[s("div",xs,[s("section",gs,[s("div",bs,[s("div",ys,[R(s("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>ae.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[V,ae.value]]),G(cs,{modelValue:te.value,"onUpdate:modelValue":e[1]||(e[1]=o=>te.value=o),options:Et},null,8,["modelValue"])]),s("div",_s,[G(be,{modelValue:Oe.value,"onUpdate:modelValue":ft},{default:$t(()=>[...e[27]||(e[27]=[ee(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+a(B.value)+" / "+a(H.value.length)+" 个账号",1),s("div",hs,[s("button",{type:"button",class:p(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",Y.value==="table"?"bg-accent text-accent-foreground":""]),onClick:e[2]||(e[2]=o=>Y.value="table"),"aria-label":"列表视图"},[...e[28]||(e[28]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:p(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",Y.value==="card"?"bg-accent text-accent-foreground":""]),onClick:e[3]||(e[3]=o=>Y.value="card"),"aria-label":"卡片视图"},[...e[29]||(e[29]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",ws,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:j(ne),onClick:fe}," 刷新列表 ",8,ks),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:Kt}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:O.value,onClick:At}," 添加账户 ",8,Cs),s("div",{ref_key:"moreActionsRef",ref:De,class:"relative"},[s("button",{class:p(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",P.value?"bg-accent text-accent-foreground":""]),onClick:Ot},[e[30]||(e[30]=ee(" 更多操作 ",-1)),e[31]||(e[31]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),Bt.value?(l(),n("span",{key:0,class:p(["ml-1 h-2 w-2 rounded-full",zt.value]),"aria-hidden":"true"},null,2)):g("",!0)],2),P.value?(l(),n("div",Ts,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:e[4]||(e[4]=o=>{Ue(),le()})}," 任务状态 "),e[32]||(e[32]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",S.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:S.value,onClick:e[5]||(e[5]=o=>{ts(),le()})}," 刷新过期 ",10,Ss),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!B.value||S.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!B.value||S.value,onClick:e[6]||(e[6]=o=>{St(),le()})}," 刷新选中 ",10,$s),e[33]||(e[33]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[7]||(e[7]=o=>{qt(),le()})}," 批量启用 ",10,Is),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[8]||(e[8]=o=>{Qt(),le()})}," 批量禁用 ",10,Es),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[9]||(e[9]=o=>{Xt(),le()})}," 批量删除 ",10,Ls)])):g("",!0)],512)]),Y.value==="card"?(l(),n("div",As,[(l(!0),n(ge,null,Ve(H.value,o=>(l(),n("div",{key:o.id,class:p(["rounded-2xl border border-border bg-card p-4",ct(o)]),onClick:r=>Ee(o.id)},[s("div",Vs,[s("div",null,[e[34]||(e[34]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",js,a(o.id),1)]),s("div",Ms,[G(be,{modelValue:b.value.has(o.id),"onUpdate:modelValue":r=>Ee(o.id),onClick:e[10]||(e[10]=M(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:p(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",nt(o)])},a(ve(o)),3)])]),s("div",Ds,[s("div",null,[e[35]||(e[35]=s("p",null,"剩余时间",-1)),s("p",{class:p(["mt-1 text-sm font-semibold",dt(o)])},a(it(o.remaining_display)),3),o.expires_at?(l(),n("p",Os,a(o.expires_at),1)):g("",!0)]),s("div",null,[e[36]||(e[36]=s("p",null,"冷却",-1)),s("p",{class:p(["mt-1",ze(o)])},[o.cooldown_seconds>0?(l(),n("span",Bs,a(ut(o.cooldown_seconds))+" · "+a(o.cooldown_reason),1)):(l(),n("span",Ns,a(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[e[37]||(e[37]=s("p",null,"失败数",-1)),s("p",Us,a(o.error_count),1)]),s("div",null,[e[38]||(e[38]=s("p",null,"会话数",-1)),s("p",zs,a(o.conversation_count),1)])]),s("div",Ps,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>pt(o.id),["stop"])}," 编辑 ",8,Fs),at(o)?(l(),n("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[11]||(e[11]=M(()=>{},["stop"])),r=>bt(o.id)]}," 启用 ",8,Ks)):(l(),n("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[12]||(e[12]=M(()=>{},["stop"])),r=>yt(o.id)]}," 禁用 ",8,Hs)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[e[13]||(e[13]=M(()=>{},["stop"])),r=>_t(o.id)]}," 删除 ",8,Js)])],10,Rs))),128)),!H.value.length&&!j(ne)?(l(),n("div",Gs," 暂无账号数据,请检查后台配置。 ")):g("",!0)])):(l(),n("div",Ys,[s("table",qs,[s("thead",Qs,[s("tr",null,[s("th",Xs,[G(be,{modelValue:Oe.value,"onUpdate:modelValue":ft},null,8,["modelValue"])]),e[40]||(e[40]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),e[41]||(e[41]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",Ws,[s("span",Zs,[e[39]||(e[39]=ee(" 剩余/过期 ",-1)),G(ms,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),e[42]||(e[42]=s("th",{class:"py-3 pr-6"},"冷却",-1)),e[43]||(e[43]=s("th",{class:"py-3 pr-6"},"失败数",-1)),e[44]||(e[44]=s("th",{class:"py-3 pr-6"},"会话数",-1)),e[45]||(e[45]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",eo,[!H.value.length&&!j(ne)?(l(),n("tr",to,[...e[46]||(e[46]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):g("",!0),(l(!0),n(ge,null,Ve(H.value,o=>(l(),n("tr",{key:o.id,class:p(["border-t border-border",ct(o)]),onClick:r=>Ee(o.id)},[s("td",{class:"py-4 pr-4",onClick:e[14]||(e[14]=M(()=>{},["stop"]))},[G(be,{modelValue:b.value.has(o.id),"onUpdate:modelValue":r=>Ee(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",oo,a(o.id),1),s("td",ro,[s("span",{class:p(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",nt(o)])},a(ve(o)),3)]),s("td",lo,[s("div",{class:p(["text-sm font-semibold",dt(o)])},a(it(o.remaining_display)),3),o.expires_at?(l(),n("span",no,a(o.expires_at),1)):g("",!0)]),s("td",ao,[o.cooldown_seconds>0?(l(),n("span",{key:0,class:p(ze(o))},a(ut(o.cooldown_seconds))+" · "+a(o.cooldown_reason),3)):(l(),n("span",{key:1,class:p(ze(o))},a(o.cooldown_reason||"无冷却"),3))]),s("td",io,a(o.error_count),1),s("td",uo,a(o.conversation_count),1),s("td",co,[s("div",fo,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>pt(o.id),["stop"])}," 编辑 ",8,vo),at(o)?(l(),n("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>bt(o.id),["stop"])}," 启用 ",8,mo)):(l(),n("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>yt(o.id),["stop"])}," 禁用 ",8,po)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:M(r=>_t(o.id),["stop"])}," 删除 ",8,xo)])])],10,so))),128))])])]))])]),G(fs,{open:j(T).open.value,title:j(T).title.value,message:j(T).message.value,"confirm-text":j(T).confirmText.value,"cancel-text":j(T).cancelText.value,onConfirm:j(T).confirm,onCancel:j(T).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(l(),Re(je,{to:"body"},[ye.value?(l(),n("div",go,[s("div",bo,[s("div",yo,[s("div",null,[e[47]||(e[47]=s("p",{class:"text-sm font-medium text-foreground"},"添加账户",-1)),s("p",_o,a(U.value==="register"?"创建 DuckMail 账号并自动注册":"批量导入账户配置"),1)]),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Ne}," 关闭 ")]),s("div",ho,[s("div",wo,[s("div",ko,[s("button",{type:"button",class:p(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",U.value==="register"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:e[15]||(e[15]=o=>U.value="register")}," 自动注册 ",2),s("button",{type:"button",class:p(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",U.value==="import"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:e[16]||(e[16]=o=>U.value="import")}," 批量导入 ",2)]),U.value==="register"?(l(),n("div",Co,[e[48]||(e[48]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),R(s("input",{"onUpdate:modelValue":e[17]||(e[17]=o=>de.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,de.value,void 0,{number:!0}]]),e[49]||(e[49]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"默认域名(可在配置面板修改,推荐使用)"),s("p",{class:"mt-1"},"注册失败建议关闭无头浏览器再试")],-1))])):(l(),n("div",To,[e[50]||(e[50]=s("label",{class:"block text-xs text-muted-foreground"},"批量导入(每行一个)",-1)),R(s("textarea",{"onUpdate:modelValue":e[18]||(e[18]=o=>ue.value=o),class:"min-h-[140px] w-full rounded-2xl border border-input bg-background px-3 py-2 text-xs font-mono",placeholder:`duckmail----you@example.com----password
2
+ user@outlook.com----loginPassword----clientId----refreshToken`},null,512),[[V,ue.value]]),e[51]||(e[51]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"支持两种格式:"),s("p",{class:"mt-1 font-mono"},"duckmail----email----password"),s("p",{class:"mt-1 font-mono"},"email----password----clientId----refreshToken"),s("p",{class:"mt-2"},'导入后请执行一次"刷新选中"以获取 Cookie。'),s("p",{class:"mt-1"},"注册失败建议关闭无头浏览器再试")],-1)),z.value?(l(),n("div",So,a(z.value),1)):g("",!0)])),e[53]||(e[53]=s("div",{class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-[11px] leading-relaxed"},[s("p",{class:"text-xs font-bold text-rose-600"},"⚠️ 严禁滥用:禁止将本工具用于商业用途或任何形式的滥用(无论规模大小)"),s("p",{class:"mt-1 text-muted-foreground"},[ee("详细声明请查看项目 "),s("a",{href:"https://github.com/Dreamy-rain/gemini-business2api/blob/main/docs/DISCLAIMER.md",target:"_blank",class:"text-primary hover:underline font-medium"},"DISCLAIMER.md")])],-1)),G(be,{modelValue:ce.value,"onUpdate:modelValue":e[19]||(e[19]=o=>ce.value=o)},{default:$t(()=>[...e[52]||(e[52]=[ee(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])])]),s("div",$o,[s("div",Io,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ne}," 取消 "),U.value==="register"?(l(),n("button",{key:0,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",disabled:O.value||!ce.value,onClick:es}," 开始注册 ",8,Eo)):(l(),n("button",{key:1,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",disabled:_e.value||!ce.value,onClick:Vt}," 导入并保存 ",8,Lo))])])])])):g("",!0)])),(l(),Re(je,{to:"body"},[q.value?(l(),n("div",Ao,[s("div",Ro,[s("div",Vo,[e[54]||(e[54]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",jo,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:!Q.value.length&&!X.value.length&&!c.value&&!f.value&&!_.value,onClick:Dt}," 清空日志 ",8,Mo),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Mt}," 关闭 ")])]),s("div",Do,[_.value?(l(),n("div",Oo,a(_.value),1)):g("",!0),c.value||f.value?(l(),n("div",Bo,[c.value?(l(),n("div",No,[s("div",Uo,[s("span",{class:p(["h-2.5 w-2.5 rounded-full",wt(c.value)]),"aria-hidden":"true"},null,2),e[55]||(e[55]=ee(" 注册任务 ",-1))]),s("div",zo,[s("span",null,"状态:"+a(ht(c.value.status)),1),s("span",null,"进度:"+a(c.value.progress)+"/"+a(c.value.count),1),s("span",null,"成功:"+a(c.value.success_count),1),s("span",null,"失败:"+a(c.value.fail_count),1)])])):g("",!0),f.value?(l(),n("div",Po,[s("div",Fo,[s("span",{class:p(["h-2.5 w-2.5 rounded-full",wt(f.value)]),"aria-hidden":"true"},null,2),e[56]||(e[56]=ee(" 刷新任务 ",-1))]),s("div",Ko,[s("span",null,"状态:"+a(ht(f.value.status)),1),s("span",null,"进度:"+a(f.value.progress)+"/"+a(f.value.account_ids.length),1),s("span",null,"成功:"+a(f.value.success_count),1),s("span",null,"失败:"+a(f.value.fail_count),1)])])):g("",!0)])):g("",!0),Q.value.length||X.value.length?(l(),n("div",Ho,[s("div",{ref_key:"taskLogsRef",ref:We,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[Q.value.length?(l(),n("div",Jo,[e[57]||(e[57]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",Go,[(l(!0),n(ge,null,Ve(Q.value,(o,r)=>(l(),n("div",{key:`reg-${r}`,class:"font-mono"},a(mt(o)),1))),128))])])):g("",!0),X.value.length?(l(),n("div",Yo,[e[58]||(e[58]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",qo,[(l(!0),n(ge,null,Ve(X.value,(o,r)=>(l(),n("div",{key:`login-${r}`,class:"font-mono"},a(mt(o)),1))),128))])])):g("",!0)],512)])):g("",!0),!_.value&&!c.value&&!f.value&&!Q.value.length&&!X.value.length?(l(),n("div",Qo," 暂无任务 ")):g("",!0)])])])):g("",!0)])),(l(),Re(je,{to:"body"},[x.value?(l(),n("div",Xo,[s("div",Wo,[s("div",{class:"flex items-center justify-between"},[e[59]||(e[59]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Fe}," 关闭 ")]),$.value?(l(),n("div",Zo,a($.value),1)):g("",!0),s("div",er,[e[60]||(e[60]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),R(s("input",{"onUpdate:modelValue":e[20]||(e[20]=o=>h.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[V,h.value.id]]),e[61]||(e[61]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),R(s("textarea",{"onUpdate:modelValue":e[21]||(e[21]=o=>h.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[V,h.value.secure_c_ses]]),e[62]||(e[62]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),R(s("input",{"onUpdate:modelValue":e[22]||(e[22]=o=>h.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.csesidx]]),e[63]||(e[63]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),R(s("input",{"onUpdate:modelValue":e[23]||(e[23]=o=>h.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.config_id]]),e[64]||(e[64]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),R(s("input",{"onUpdate:modelValue":e[24]||(e[24]=o=>h.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.host_c_oses]]),e[65]||(e[65]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),R(s("input",{"onUpdate:modelValue":e[25]||(e[25]=o=>h.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[V,h.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Fe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Yt}," 保存 ")])])])):g("",!0)])),(l(),Re(je,{to:"body"},[Me.value?(l(),n("div",tr,[s("div",sr,[s("div",or,[e[66]||(e[66]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",rr,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Jt},a(N.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Pe}," 关闭 ")])]),D.value?(l(),n("div",lr,a(D.value),1)):g("",!0),s("div",nr,[R(s("textarea",{"onUpdate:modelValue":e[26]||(e[26]=o=>se.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:N.value},null,8,ar),[[V,se.value]])]),s("div",ir,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",onClick:Gt,disabled:N.value}," 保存 ",8,dr)])])])):g("",!0)]))],64))}});export{xr as default};
static/assets/Accounts-DnG8de1F.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ import{g as E,E as ts,h as a,d as ss,G as os,i as K,o as rs,w as ls,j as ns,c as l,a as s,x as J,m as Re,q as A,v as $,y as Tt,t as n,n as g,u as R,b as m,f as pe,F as ge,r as Ve,z as je,p as V,e as r,H as as}from"./index-CM73xqTK.js";import{_ as is}from"./SelectMenu.vue_vue_type_script_setup_true_lang-CmlylKNl.js";import{_ as be}from"./Checkbox.vue_vue_type_script_setup_true_lang-D3YmChBg.js";import{_ as ds}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-szV8KRsH.js";import{u as us}from"./useConfirmDialog-WjrHNzIy.js";import{_ as cs}from"./HelpTip.vue_vue_type_script_setup_true_lang-D0920Okk.js";const h={list:()=>E.get("/admin/accounts"),getConfig:()=>E.get("/admin/accounts-config"),updateConfig:b=>E.put("/admin/accounts-config",b),delete:b=>E.delete(`/admin/accounts/${b}`),disable:b=>E.put(`/admin/accounts/${b}/disable`),enable:b=>E.put(`/admin/accounts/${b}/enable`),startRegister:(b,w)=>E.post("/admin/register/start",{count:b,domain:w}),getRegisterTask:b=>E.get(`/admin/register/task/${b}`),getRegisterCurrent:()=>E.get("/admin/register/current"),startLogin:b=>E.post("/admin/login/start",b),getLoginTask:b=>E.get(`/admin/login/task/${b}`),getLoginCurrent:()=>E.get("/admin/login/current"),checkLogin:()=>E.post("/admin/login/check")},fs=ts("accounts",()=>{const b=a([]),w=a(!1);async function L(){w.value=!0;try{const u=await h.list();b.value=Array.isArray(u)?u:u.accounts||[]}finally{w.value=!1}}async function re(u){await h.delete(u),await L()}async function C(u){await h.disable(u),await L()}async function le(u){await h.enable(u),await L()}async function Z(u){await Promise.all(u.map(j=>h.enable(j))),await L()}async function p(u){await Promise.all(u.map(j=>h.disable(j))),await L()}async function G(u){await Promise.all(u.map(j=>h.delete(j))),await L()}async function ne(u){await h.updateConfig(u),await L()}return{accounts:b,isLoading:w,loadAccounts:L,deleteAccount:re,disableAccount:C,enableAccount:le,bulkEnable:Z,bulkDisable:p,bulkDelete:G,updateConfig:ne}}),vs={class:"space-y-8"},xs={class:"rounded-3xl border border-border bg-card p-6"},ms={class:"flex flex-wrap items-center justify-between gap-4"},ps={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},gs={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},bs={class:"ml-auto flex items-center gap-2 sm:ml-0"},ys={class:"mt-4 flex flex-wrap items-center gap-2"},_s=["disabled"],hs=["disabled"],ws={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},ks=["disabled"],Cs=["disabled"],Ts=["disabled"],Ss=["disabled"],Es=["disabled"],Is={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},Ls=["onClick"],As={class:"flex items-start justify-between gap-3"},$s={class:"mt-1 font-mono text-xs text-foreground"},Rs={class:"flex items-center gap-2"},Vs={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},js={key:0,class:"mt-1 text-[11px]"},Ms={key:0},Ds={key:1},Os={class:"mt-1 text-sm font-semibold text-foreground"},Bs={class:"mt-1 text-sm font-semibold text-foreground"},Ns={class:"mt-4 flex flex-wrap items-center gap-2"},Us=["onClick"],zs=["onClick"],Ps=["onClick"],Fs=["onClick"],Hs={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Ks={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},Js={class:"min-w-full text-left text-sm"},Gs={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Ys={class:"py-3 pr-4"},qs={class:"py-3 pr-6"},Qs={class:"inline-flex items-center gap-2"},Xs={class:"text-sm text-foreground"},Ws={key:0},Zs=["onClick"],eo={class:"py-4 pr-6 font-mono text-xs text-foreground"},to={class:"py-4 pr-6"},so={class:"py-4 pr-6"},oo={key:0,class:"block text-[11px] text-muted-foreground"},ro={class:"py-4 pr-6 text-xs"},lo={class:"py-4 pr-6 text-xs text-muted-foreground"},no={class:"py-4 pr-6 text-xs text-muted-foreground"},ao={class:"py-4 text-right"},io={class:"flex flex-wrap justify-end gap-2"},uo=["onClick"],co=["onClick"],fo=["onClick"],vo=["onClick"],xo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},mo={class:"flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},po={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},go={class:"mt-1 text-xs text-muted-foreground"},bo={class:"scrollbar-slim flex-1 overflow-y-auto px-6 py-4"},yo={class:"space-y-4 text-sm"},_o={class:"flex rounded-full border border-border bg-muted/30 p-1 text-xs"},ho={key:0,class:"space-y-4"},wo={key:1,class:"space-y-4"},ko={key:0,class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-600"},Co={class:"border-t border-border/60 px-6 py-4"},To={class:"flex items-center justify-end gap-2"},So=["disabled"],Eo=["disabled"],Io={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Lo={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},Ao={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},$o={class:"flex items-center gap-2"},Ro=["disabled"],Vo={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},jo={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},Mo={key:1,class:"grid gap-3 text-xs text-muted-foreground"},Do={key:0,class:"space-y-1"},Oo={class:"flex flex-wrap gap-x-4 gap-y-1"},Bo={key:1,class:"space-y-1"},No={class:"flex flex-wrap gap-x-4 gap-y-1"},Uo={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},zo={key:0,class:"space-y-2"},Po={class:"space-y-1 text-[11px] text-muted-foreground"},Fo={key:1,class:"mt-4 space-y-2"},Ho={class:"space-y-1 text-[11px] text-muted-foreground"},Ko={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},Jo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Go={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Yo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},qo={class:"mt-4 space-y-3 text-sm"},Qo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Xo={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},Wo={class:"flex items-center justify-between"},Zo={class:"flex items-center gap-2"},er={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},tr={class:"mt-4"},sr=["readonly"],or={class:"mt-6 flex items-center justify-end gap-2"},rr=["disabled"],Ke="accounts-register-task-cache",Je="accounts-login-task-cache",Ge="accounts-register-log-clear",Ye="accounts-login-log-clear",qe="accounts-register-task-cleared-id",Qe="accounts-login-task-cleared-id",St="1970-01-01 00:00:00",cr=ss({__name:"Accounts",setup(b){const w=fs(),{accounts:L,isLoading:re}=os(w),C=us(),le=a(""),Z=a("all"),p=a(new Set),G=a("table"),ne=a(!1),u=a(""),j=a(!1),M=a(""),ee=a(""),B=a(!1),ae=a([]),ie=a(1),ye=a(!1),N=a("register"),de=a(""),U=a(""),_e=a(!1),Y=a(!1),z=a(!1),Me=a(null),he=a(null),we=a(null),P=a(null),F=a(null),te=a(0),se=a(0),ue=a(!1),c=a(null),f=a(null),Xe=a(null),D=a(!1),T=a(!1),y=a(""),_=a({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),ke=a(null),We=a([]),Et=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],H=K(()=>{const e=le.value.trim().toLowerCase();return L.value.filter(t=>{const o=!e||t.id.toLowerCase().includes(e),i=Z.value==="all"||fe(t)===Z.value;return o&&i})}),O=K(()=>p.value.size),De=K(()=>H.value.length>0&&H.value.every(e=>p.value.has(e.id))),ce=async()=>{await w.loadAccounts(),p.value=new Set,z.value=!1},Ze=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},et=e=>{try{return localStorage.getItem(e)||null}catch{return null}},Ce=(e,t)=>{try{if(t){localStorage.setItem(e,t);return}localStorage.removeItem(e)}catch{}},tt=(e,t)=>{try{localStorage.setItem(e,JSON.stringify(t))}catch{}},st=e=>{try{localStorage.removeItem(e)}catch{}},ot=e=>{const t=localStorage.getItem(e),o=Number(t);return Number.isFinite(o)?o:0},Te=(e,t)=>{try{localStorage.setItem(e,String(t))}catch{}},Oe=(e,t=!0)=>{e&&(e.id&&e.id===P.value||(e.id&&P.value&&e.id!==P.value&&(P.value=null,Ce(qe,null)),c.value=e,e.id&&e.id!==he.value&&(he.value=e.id,te.value=0,Te(Ge,0)),t&&tt(Ke,e)))},Se=(e,t=!0)=>{e&&(e.id&&e.id===F.value||(e.id&&F.value&&e.id!==F.value&&(F.value=null,Ce(Qe,null)),f.value=e,e.id&&e.id!==we.value&&(we.value=e.id,se.value=0,Te(Ye,0)),t&&tt(Je,e)))},It=()=>{te.value=ot(Ge),se.value=ot(Ye),P.value=et(qe),F.value=et(Qe);const e=Ze(Ke);e&&e.id!==P.value&&(c.value=e,he.value=e.id||null);const t=Ze(Je);t&&t.id!==F.value&&(f.value=t,we.value=t.id||null)},Lt=()=>{ye.value=!0,N.value="register",de.value="",U.value="",_e.value=!1,ue.value=!1},Be=()=>{ye.value=!1},At=e=>{const t=[],o=[];return e.split(/\r?\n/).map(d=>d.trim()).filter(Boolean).forEach((d,x)=>{const v=d.split("----").map(S=>S.trim()),k=x+1;if(v.length){if(v[0].toLowerCase()==="duckmail"){if(v.length<3||!v[1]||!v[2]){o.push(`第 ${k} 行格式错误(duckmail)`);return}const S=v[1],$e=v.slice(2).join("----");t.push({id:S,secure_c_ses:"",csesidx:"",config_id:"",expires_at:St,mail_provider:"duckmail",mail_address:S,mail_password:$e});return}if(v.length>=4&&v[0]&&v[2]&&v[3]){const S=v[0],$e=v[1]||"",I=v[2],es=v.slice(3).join("----");t.push({id:S,secure_c_ses:"",csesidx:"",config_id:"",expires_at:St,mail_provider:"microsoft",mail_address:S,mail_password:$e,mail_client_id:I,mail_refresh_token:es,mail_tenant:"consumers"});return}o.push(`第 ${k} 行格式错误`)}}),{items:t,errors:o}},$t=async()=>{if(U.value="",!de.value.trim()){U.value="请输入导入内容";return}const{items:e,errors:t}=At(de.value);if(!e.length){U.value=t.length?t.join(","):"未识别到有效账号";return}if(t.length){U.value=t.slice(0,3).join(",");return}_e.value=!0;try{const i=[...await ft()],d=new Map(i.map((k,S)=>[k.id,S])),x=[];e.forEach(k=>{const S=d.get(k.id||"");if(S===void 0){i.push(k),x.push(k.id);return}const I={...i[S],mail_provider:k.mail_provider,mail_address:k.mail_address};k.mail_provider==="microsoft"?(I.mail_client_id=k.mail_client_id,I.mail_refresh_token=k.mail_refresh_token,I.mail_tenant=k.mail_tenant,I.mail_password=k.mail_password):(I.mail_password=k.mail_password,I.mail_client_id=void 0,I.mail_refresh_token=void 0,I.mail_tenant=void 0),i[S]=I,x.push(k.id)}),await w.updateConfig(i),await ce(),p.value=new Set(x),Be(),await C.ask({title:"导入成功",message:`已导入 ${x.length} 个账户并自动选中。是否立即刷新这些账户以获取 Cookie?`,confirmText:"立即刷新",cancelText:"稍后手动刷新"})&&await Ct()}catch(o){U.value=o.message||"导入失败"}finally{_e.value=!1}},Rt=async()=>{try{const e=[],t=c.value?.id,o=f.value?.id;if(t&&!Ee(t)&&e.push(ht(t)),o&&!Ie(o)&&e.push(wt(o)),!e.length){await He();return}await Promise.all(e)}catch(e){y.value=e?.message||"任务状态更新失败"}},Ne=async()=>{Y.value=!0,await Rt()},Vt=()=>{Y.value=!1},jt=()=>{const e=c.value?.id||null,t=f.value?.id||null;P.value=e,F.value=t,Ce(qe,e),Ce(Qe,t),te.value=c.value?.logs?.length||0,se.value=f.value?.logs?.length||0,Te(Ge,te.value),Te(Ye,se.value),c.value=null,f.value=null,he.value=null,we.value=null,y.value="",D.value=!1,T.value=!1,X(),W(),st(Ke),st(Je)},Ee=e=>!!(e&&e===P.value),Ie=e=>!!(e&&e===F.value),Mt=()=>{z.value=!z.value},oe=()=>{z.value=!1},rt=e=>{if(!z.value)return;const t=e.target;Me.value&&!Me.value.contains(t)&&(z.value=!1)};rs(async()=>{It(),await ce(),await He(),Xt(),document.addEventListener("click",rt)});const q=K(()=>{const e=c.value?.logs||[];return te.value?e.slice(te.value):e}),Q=K(()=>{const e=f.value?.logs||[];return se.value?e.slice(se.value):e}),Dt=K(()=>!!y.value||!!c.value||!!f.value||q.value.length>0||Q.value.length>0),Ot=async()=>{await as();const e=Xe.value;e&&(e.scrollTop=e.scrollHeight)};ls([q,Q,Y],async()=>{Y.value&&await Ot()},{deep:!0});const Bt=K(()=>{const e=c.value?.status,t=f.value?.status;return e==="running"||e==="pending"||t==="running"||t==="pending"}),Nt=K(()=>{if(y.value)return"bg-rose-500";if(Bt.value)return"bg-sky-400";const e=[];if(c.value){const d=c.value.success_count??0,x=c.value.fail_count??0,v=c.value.count??d+x;e.push({success:d,fail:x,total:v,status:c.value.status})}if(f.value){const d=f.value.success_count??0,x=f.value.fail_count??0,v=f.value.account_ids?.length??d+x;e.push({success:d,fail:x,total:v,status:f.value.status})}if(!e.length)return"bg-muted-foreground";const t=e.reduce((d,x)=>d+x.success,0),o=e.reduce((d,x)=>d+x.fail,0),i=e.reduce((d,x)=>d+(x.total||0),0);if(t>0&&o>0)return"bg-amber-400";if(o>0&&t===0)return"bg-rose-500";if(t>0&&o===0)return"bg-emerald-400";if(i===0){const d=e.every(v=>v.status==="success");if(e.some(v=>v.status==="failed"))return"bg-rose-500";if(d)return"bg-emerald-400"}return"bg-muted-foreground"});ns(()=>{X(),W(),Qt(),document.removeEventListener("click",rt)});const fe=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?"429限流":e.cooldown_reason==="错误禁用"?"错误禁用":e.disabled?"手动禁用":e.status==="已过期"?"已过期":e.status==="即将过期"?"即将过期":"正常",lt=e=>{const t=fe(e);return t==="429限流"||t==="即将过期"?"bg-amber-200 text-amber-900":t==="错误禁用"||t==="已过期"?"bg-destructive/10 text-destructive":t==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},nt=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?!0:e.disabled||e.cooldown_reason==="错误禁用",at=e=>e==="已过期"?"过期":e==="未设置"?"未设置":e,it=e=>e.status==="已过期"?"text-rose-600":e.status==="即将过期"?"text-amber-700":e.status==="未设置"?"text-muted-foreground":"text-emerald-600",dt=e=>e<60?`${e} 秒`:e<3600?`${Math.ceil(e/60)} 分钟`:`${(e/3600).toFixed(1)} 小时`,Ue=e=>e.cooldown_seconds>0?"text-amber-700":e.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",ut=e=>{const t=fe(e);return t==="手动禁用"||t==="已过期"?"bg-muted/70":""},Le=e=>{const t=new Set(p.value);t.has(e)?t.delete(e):t.add(e),p.value=t},ct=()=>{if(De.value){p.value=new Set;return}p.value=new Set(H.value.map(e=>e.id))},Ut=(e,t)=>e.id||`account_${t+1}`,ft=async()=>(await h.getConfig()).accounts.map((t,o)=>({...t,id:Ut(t,o)})),vt=e=>`${e.time} [${e.level}] ${e.message}`,zt=(e,t)=>{let o=-1;for(let d=0;d<e.length;d+=1)if(e[d].id===t){o=d;break}if(o===-1)return u.value="未找到对应账号配置。",!1;const i=e[o];return _.value={id:i.id,secure_c_ses:i.secure_c_ses,csesidx:i.csesidx,config_id:i.config_id,host_c_oses:i.host_c_oses,expires_at:i.expires_at},We.value=e,ke.value=o,ne.value=!0,!0},xt=async e=>{u.value="";try{const t=await ft();zt(t,e)}catch(t){u.value=t.message||"加载账号配置失败"}},Pt=async()=>{M.value="";try{const e=await h.getConfig();ae.value=Array.isArray(e.accounts)?e.accounts:[],ee.value=JSON.stringify(pt(ae.value),null,2),B.value=!0,j.value=!0}catch(e){M.value=e.message||"加载账号配置失败"}},ze=()=>{j.value=!1,M.value="",B.value=!1},mt=()=>{const e=JSON.parse(ee.value);if(!Array.isArray(e))throw new Error("配置格式必须是数组。");return e},Ft=e=>typeof e!="string"||!e?e:e.length<=6?`${e.slice(0,2)}****`:`${e.slice(0,3)}****`,pt=e=>{const t=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password","mail_refresh_token","mail_client_id"]);return e.map(o=>{const i={...o};return t.forEach(d=>{const x=i[d];x&&(i[d]=Ft(x))}),i})},Ht=()=>{if(M.value="",!B.value){try{ae.value=mt()}catch(e){M.value=e.message||"JSON 格式错误";return}ee.value=JSON.stringify(pt(ae.value),null,2),B.value=!0;return}ee.value=JSON.stringify(ae.value,null,2),B.value=!1},Kt=async()=>{M.value="";try{const e=mt();await w.updateConfig(e),ze()}catch(e){M.value=e.message||"保存失败"}},Pe=()=>{ne.value=!1,u.value=""},Jt=async()=>{if(ke.value===null)return;const e=[...We.value];e[ke.value]={...e[ke.value],id:_.value.id,secure_c_ses:_.value.secure_c_ses,csesidx:_.value.csesidx,config_id:_.value.config_id,host_c_oses:_.value.host_c_oses||void 0,expires_at:_.value.expires_at||void 0};try{await w.updateConfig(e),Pe()}catch(t){u.value=t.message||"保存失败"}},Gt=async()=>{await w.bulkEnable(Array.from(p.value)),p.value=new Set},Yt=async()=>{await C.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"})&&(await w.bulkDisable(Array.from(p.value)),p.value=new Set)},qt=async()=>{await C.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"})&&(await w.bulkDelete(Array.from(p.value)),p.value=new Set)},gt=async e=>{await w.enableAccount(e)},bt=async e=>{await C.ask({title:"禁用账号",message:"确定要禁用该账号吗?"})&&await w.disableAccount(e)},yt=async e=>{await C.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"})&&await w.deleteAccount(e)};let ve=null,xe=null,me=null,Ae=!1;const X=()=>{ve!==null&&(window.clearInterval(ve),ve=null)},W=()=>{xe!==null&&(window.clearInterval(xe),xe=null)},Qt=()=>{me!==null&&(window.clearInterval(me),me=null),Ae=!1},_t=e=>e==="pending"?"等待中":e==="running"?"执行中":e==="success"?"成功":e==="failed"?"失败":e,ht=async e=>{if(Ee(e)){X();return}const t=await h.getRegisterTask(e);if(Ee(t.id)){X();return}Oe(t),t.status!=="running"&&t.status!=="pending"&&(D.value=!1,X(),await ce())},wt=async e=>{if(Ie(e)){W();return}const t=await h.getLoginTask(e);if(Ie(t.id)){W();return}Se(t),t.status!=="running"&&t.status!=="pending"&&(T.value=!1,W(),await ce())},kt=e=>{X(),ve=window.setInterval(()=>{ht(e).catch(t=>{y.value=t?.message||"注册任务更新失败",X(),D.value=!1})},3e3)},Fe=e=>{W(),xe=window.setInterval(()=>{wt(e).catch(t=>{y.value=t?.message||"刷新任务更新失败",W(),T.value=!1})},3e3)},Xt=()=>{me===null&&(me=window.setInterval(async()=>{if(!Ae&&!Y.value&&!(ve!==null||xe!==null)&&!(!D.value&&!T.value&&!c.value&&!f.value)){Ae=!0;try{await He()}catch(e){y.value=e?.message||"后台刷新失败"}finally{Ae=!1}}},6e3))},He=async()=>{try{const e=await h.getRegisterCurrent();e&&"id"in e&&!Ee(e.id)&&(Oe(e),(e.status==="running"||e.status==="pending")&&(D.value=!0,kt(e.id)))}catch(e){y.value=e.message||"加载注册任务失败"}try{const e=await h.getLoginCurrent();e&&"id"in e&&!Ie(e.id)&&(Se(e),(e.status==="running"||e.status==="pending")&&(T.value=!0,Fe(e.id)))}catch(e){y.value=e.message||"加载刷新任务失败"}},Wt=async()=>{y.value="",D.value=!0;try{const e=Number.isFinite(ie.value)&&ie.value>0?ie.value:void 0,t=await h.startRegister(e);Oe(t),kt(t.id),ye.value=!1,Y.value=!0}catch(e){y.value=e.message||"启动注册失败",D.value=!1}},Ct=async()=>{if(p.value.size){y.value="",T.value=!0;try{const e=await h.startLogin(Array.from(p.value));Se(e),Fe(e.id),Ne()}catch(e){y.value=e.message||"启动刷新失败",T.value=!1}}},Zt=async()=>{y.value="",T.value=!0;try{await h.checkLogin();const e=await h.getLoginCurrent();if(e&&"id"in e){Se(e),Fe(e.id),Ne();return}T.value=!1}catch(e){y.value=e.message||"触发刷新失败",T.value=!1}};return(e,t)=>(r(),l(ge,null,[s("div",vs,[s("section",xs,[s("div",ms,[s("div",ps,[A(s("input",{"onUpdate:modelValue":t[0]||(t[0]=o=>le.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[$,le.value]]),J(is,{modelValue:Z.value,"onUpdate:modelValue":t[1]||(t[1]=o=>Z.value=o),options:Et},null,8,["modelValue"])]),s("div",gs,[J(be,{modelValue:De.value,"onUpdate:modelValue":ct},{default:Tt(()=>[...t[27]||(t[27]=[pe(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+n(O.value)+" / "+n(H.value.length)+" 个账号",1),s("div",bs,[s("button",{type:"button",class:g(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",G.value==="table"?"bg-accent text-accent-foreground":""]),onClick:t[2]||(t[2]=o=>G.value="table"),"aria-label":"列表视图"},[...t[28]||(t[28]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:g(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",G.value==="card"?"bg-accent text-accent-foreground":""]),onClick:t[3]||(t[3]=o=>G.value="card"),"aria-label":"卡片视图"},[...t[29]||(t[29]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",ys,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:R(re),onClick:ce}," 刷新列表 ",8,_s),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pt}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:D.value,onClick:Lt}," 添加账户 ",8,hs),s("div",{ref_key:"moreActionsRef",ref:Me,class:"relative"},[s("button",{class:g(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",z.value?"bg-accent text-accent-foreground":""]),onClick:Mt},[t[30]||(t[30]=pe(" 更多操作 ",-1)),t[31]||(t[31]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),Dt.value?(r(),l("span",{key:0,class:g(["ml-1 h-2 w-2 rounded-full",Nt.value]),"aria-hidden":"true"},null,2)):m("",!0)],2),z.value?(r(),l("div",ws,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:t[4]||(t[4]=o=>{Ne(),oe()})}," 任务状态 "),t[32]||(t[32]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",T.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:T.value,onClick:t[5]||(t[5]=o=>{Zt(),oe()})}," 刷新过期 ",10,ks),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!O.value||T.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!O.value||T.value,onClick:t[6]||(t[6]=o=>{Ct(),oe()})}," 刷新选中 ",10,Cs),t[33]||(t[33]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[7]||(t[7]=o=>{Gt(),oe()})}," 批量启用 ",10,Ts),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[8]||(t[8]=o=>{Yt(),oe()})}," 批量禁用 ",10,Ss),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[9]||(t[9]=o=>{qt(),oe()})}," 批量删除 ",10,Es)])):m("",!0)],512)]),G.value==="card"?(r(),l("div",Is,[(r(!0),l(ge,null,Ve(H.value,o=>(r(),l("div",{key:o.id,class:g(["rounded-2xl border border-border bg-card p-4",ut(o)]),onClick:i=>Le(o.id)},[s("div",As,[s("div",null,[t[34]||(t[34]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",$s,n(o.id),1)]),s("div",Rs,[J(be,{modelValue:p.value.has(o.id),"onUpdate:modelValue":i=>Le(o.id),onClick:t[10]||(t[10]=V(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:g(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",lt(o)])},n(fe(o)),3)])]),s("div",Vs,[s("div",null,[t[35]||(t[35]=s("p",null,"剩余时间",-1)),s("p",{class:g(["mt-1 text-sm font-semibold",it(o)])},n(at(o.remaining_display)),3),o.expires_at?(r(),l("p",js,n(o.expires_at),1)):m("",!0)]),s("div",null,[t[36]||(t[36]=s("p",null,"冷却",-1)),s("p",{class:g(["mt-1",Ue(o)])},[o.cooldown_seconds>0?(r(),l("span",Ms,n(dt(o.cooldown_seconds))+" · "+n(o.cooldown_reason),1)):(r(),l("span",Ds,n(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[t[37]||(t[37]=s("p",null,"失败数",-1)),s("p",Os,n(o.error_count),1)]),s("div",null,[t[38]||(t[38]=s("p",null,"会话数",-1)),s("p",Bs,n(o.conversation_count),1)])]),s("div",Ns,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>xt(o.id),["stop"])}," 编辑 ",8,Us),nt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[11]||(t[11]=V(()=>{},["stop"])),i=>gt(o.id)]}," 启用 ",8,zs)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[12]||(t[12]=V(()=>{},["stop"])),i=>bt(o.id)]}," 禁用 ",8,Ps)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[t[13]||(t[13]=V(()=>{},["stop"])),i=>yt(o.id)]}," 删除 ",8,Fs)])],10,Ls))),128)),!H.value.length&&!R(re)?(r(),l("div",Hs," 暂无账号数据,请检查后台配置。 ")):m("",!0)])):(r(),l("div",Ks,[s("table",Js,[s("thead",Gs,[s("tr",null,[s("th",Ys,[J(be,{modelValue:De.value,"onUpdate:modelValue":ct},null,8,["modelValue"])]),t[40]||(t[40]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),t[41]||(t[41]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",qs,[s("span",Qs,[t[39]||(t[39]=pe(" 剩余/过期 ",-1)),J(cs,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),t[42]||(t[42]=s("th",{class:"py-3 pr-6"},"冷却",-1)),t[43]||(t[43]=s("th",{class:"py-3 pr-6"},"失败数",-1)),t[44]||(t[44]=s("th",{class:"py-3 pr-6"},"会话数",-1)),t[45]||(t[45]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",Xs,[!H.value.length&&!R(re)?(r(),l("tr",Ws,[...t[46]||(t[46]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):m("",!0),(r(!0),l(ge,null,Ve(H.value,o=>(r(),l("tr",{key:o.id,class:g(["border-t border-border",ut(o)]),onClick:i=>Le(o.id)},[s("td",{class:"py-4 pr-4",onClick:t[14]||(t[14]=V(()=>{},["stop"]))},[J(be,{modelValue:p.value.has(o.id),"onUpdate:modelValue":i=>Le(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",eo,n(o.id),1),s("td",to,[s("span",{class:g(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",lt(o)])},n(fe(o)),3)]),s("td",so,[s("div",{class:g(["text-sm font-semibold",it(o)])},n(at(o.remaining_display)),3),o.expires_at?(r(),l("span",oo,n(o.expires_at),1)):m("",!0)]),s("td",ro,[o.cooldown_seconds>0?(r(),l("span",{key:0,class:g(Ue(o))},n(dt(o.cooldown_seconds))+" · "+n(o.cooldown_reason),3)):(r(),l("span",{key:1,class:g(Ue(o))},n(o.cooldown_reason||"无冷却"),3))]),s("td",lo,n(o.error_count),1),s("td",no,n(o.conversation_count),1),s("td",ao,[s("div",io,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>xt(o.id),["stop"])}," 编辑 ",8,uo),nt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>gt(o.id),["stop"])}," 启用 ",8,co)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>bt(o.id),["stop"])}," 禁用 ",8,fo)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:V(i=>yt(o.id),["stop"])}," 删除 ",8,vo)])])],10,Zs))),128))])])]))])]),J(ds,{open:R(C).open.value,title:R(C).title.value,message:R(C).message.value,"confirm-text":R(C).confirmText.value,"cancel-text":R(C).cancelText.value,onConfirm:R(C).confirm,onCancel:R(C).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(r(),Re(je,{to:"body"},[ye.value?(r(),l("div",xo,[s("div",mo,[s("div",po,[s("div",null,[t[47]||(t[47]=s("p",{class:"text-sm font-medium text-foreground"},"添加账户",-1)),s("p",go,n(N.value==="register"?"创建 DuckMail 账号并自动注册":"批量导入账户配置"),1)]),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Be}," 关闭 ")]),s("div",bo,[s("div",yo,[s("div",_o,[s("button",{type:"button",class:g(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",N.value==="register"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[15]||(t[15]=o=>N.value="register")}," 自动注册 ",2),s("button",{type:"button",class:g(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",N.value==="import"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[16]||(t[16]=o=>N.value="import")}," 批量导入 ",2)]),N.value==="register"?(r(),l("div",ho,[t[48]||(t[48]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),A(s("input",{"onUpdate:modelValue":t[17]||(t[17]=o=>ie.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,ie.value,void 0,{number:!0}]]),t[49]||(t[49]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"}," 默认域名来自设置面板(可在“配置面板”中修改) ",-1))])):(r(),l("div",wo,[t[50]||(t[50]=s("label",{class:"block text-xs text-muted-foreground"},"批量导入(每行一个)",-1)),A(s("textarea",{"onUpdate:modelValue":t[18]||(t[18]=o=>de.value=o),class:"min-h-[140px] w-full rounded-2xl border border-input bg-background px-3 py-2 text-xs font-mono",placeholder:`duckmail----you@example.com----password
2
+ user@outlook.com----loginPassword----clientId----refreshToken`},null,512),[[$,de.value]]),t[51]||(t[51]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"支持两种格式:"),s("p",{class:"mt-1 font-mono"},"duckmail----email----password"),s("p",{class:"mt-1 font-mono"},"email----password----clientId----refreshToken"),s("p",{class:"mt-2 text-[11px]"},'导入后请执行一次"刷新选中"以获取 Cookie。')],-1)),U.value?(r(),l("div",ko,n(U.value),1)):m("",!0)])),t[53]||(t[53]=s("div",{class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-[11px] leading-relaxed"},[s("p",{class:"text-xs font-bold text-rose-600"},"⚠️ 严禁滥用:禁止将本工具用于商业用途或任何形式的滥用(无论规模大小)"),s("p",{class:"mt-1 text-muted-foreground"},[pe("详细声明请查看项目 "),s("a",{href:"https://github.com/Dreamy-rain/gemini-business2api/blob/main/docs/DISCLAIMER.md",target:"_blank",class:"text-primary hover:underline font-medium"},"DISCLAIMER.md")])],-1)),J(be,{modelValue:ue.value,"onUpdate:modelValue":t[19]||(t[19]=o=>ue.value=o)},{default:Tt(()=>[...t[52]||(t[52]=[pe(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])])]),s("div",Co,[s("div",To,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Be}," 取消 "),N.value==="register"?(r(),l("button",{key:0,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:D.value||!ue.value,onClick:Wt}," 开始注册 ",8,So)):(r(),l("button",{key:1,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:_e.value||!ue.value,onClick:$t}," 导入并保存 ",8,Eo))])])])])):m("",!0)])),(r(),Re(je,{to:"body"},[Y.value?(r(),l("div",Io,[s("div",Lo,[s("div",Ao,[t[54]||(t[54]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",$o,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary",disabled:!q.value.length&&!Q.value.length&&!c.value&&!f.value&&!y.value,onClick:jt}," 清空日志 ",8,Ro),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Vt}," 关闭 ")])]),s("div",Vo,[y.value?(r(),l("div",jo,n(y.value),1)):m("",!0),c.value||f.value?(r(),l("div",Mo,[c.value?(r(),l("div",Do,[t[55]||(t[55]=s("div",{class:"font-medium text-foreground"},"注册任务",-1)),s("div",Oo,[s("span",null,"状态:"+n(_t(c.value.status)),1),s("span",null,"进度:"+n(c.value.progress)+"/"+n(c.value.count),1),s("span",null,"成功:"+n(c.value.success_count),1),s("span",null,"失败:"+n(c.value.fail_count),1)])])):m("",!0),f.value?(r(),l("div",Bo,[t[56]||(t[56]=s("div",{class:"font-medium text-foreground"},"刷新任务",-1)),s("div",No,[s("span",null,"状态:"+n(_t(f.value.status)),1),s("span",null,"进度:"+n(f.value.progress)+"/"+n(f.value.account_ids.length),1),s("span",null,"成功:"+n(f.value.success_count),1),s("span",null,"失败:"+n(f.value.fail_count),1)])])):m("",!0)])):m("",!0),q.value.length||Q.value.length?(r(),l("div",Uo,[s("div",{ref_key:"taskLogsRef",ref:Xe,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[q.value.length?(r(),l("div",zo,[t[57]||(t[57]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",Po,[(r(!0),l(ge,null,Ve(q.value,(o,i)=>(r(),l("div",{key:`reg-${i}`,class:"font-mono"},n(vt(o)),1))),128))])])):m("",!0),Q.value.length?(r(),l("div",Fo,[t[58]||(t[58]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",Ho,[(r(!0),l(ge,null,Ve(Q.value,(o,i)=>(r(),l("div",{key:`login-${i}`,class:"font-mono"},n(vt(o)),1))),128))])])):m("",!0)],512)])):m("",!0),!y.value&&!c.value&&!f.value&&!q.value.length&&!Q.value.length?(r(),l("div",Ko," 暂无任务 ")):m("",!0)])])])):m("",!0)])),(r(),Re(je,{to:"body"},[ne.value?(r(),l("div",Jo,[s("div",Go,[s("div",{class:"flex items-center justify-between"},[t[59]||(t[59]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Pe}," 关闭 ")]),u.value?(r(),l("div",Yo,n(u.value),1)):m("",!0),s("div",qo,[t[60]||(t[60]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),A(s("input",{"onUpdate:modelValue":t[20]||(t[20]=o=>_.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[$,_.value.id]]),t[61]||(t[61]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),A(s("textarea",{"onUpdate:modelValue":t[21]||(t[21]=o=>_.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[$,_.value.secure_c_ses]]),t[62]||(t[62]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),A(s("input",{"onUpdate:modelValue":t[22]||(t[22]=o=>_.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.csesidx]]),t[63]||(t[63]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),A(s("input",{"onUpdate:modelValue":t[23]||(t[23]=o=>_.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.config_id]]),t[64]||(t[64]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),A(s("input",{"onUpdate:modelValue":t[24]||(t[24]=o=>_.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.host_c_oses]]),t[65]||(t[65]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),A(s("input",{"onUpdate:modelValue":t[25]||(t[25]=o=>_.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[$,_.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Jt}," 保存 ")])])])):m("",!0)])),(r(),Re(je,{to:"body"},[j.value?(r(),l("div",Qo,[s("div",Xo,[s("div",Wo,[t[66]||(t[66]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",Zo,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Ht},n(B.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:ze}," 关闭 ")])]),M.value?(r(),l("div",er,n(M.value),1)):m("",!0),s("div",tr,[A(s("textarea",{"onUpdate:modelValue":t[26]||(t[26]=o=>ee.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:B.value},null,8,sr),[[$,ee.value]])]),s("div",or,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:ze}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Kt,disabled:B.value}," 保存 ",8,rr)])])])):m("",!0)]))],64))}});export{cr as default};
static/assets/Accounts-Dzw6xcVv.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ import{g as S,C as es,h as a,d as ts,D as ss,i as F,o as os,s as rs,j as ls,c as l,a as s,x as K,y as Le,m as A,v as L,A as wt,t as n,n as m,u as I,b as x,f as H,F as pe,r as Ie,T as $e,w as $,e as r,E as ns}from"./index-C7QtVLks.js";import{_ as as}from"./SelectMenu.vue_vue_type_script_setup_true_lang-bF-MPrxc.js";import{_ as xe}from"./Checkbox.vue_vue_type_script_setup_true_lang-ChgTHjuD.js";import{_ as is}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-Cf0ef7-g.js";import{u as ds}from"./useConfirmDialog-0WVRfuk6.js";import{_ as us}from"./HelpTip.vue_vue_type_script_setup_true_lang-C9YlQcyS.js";const k={list:()=>S.get("/admin/accounts"),getConfig:()=>S.get("/admin/accounts-config"),updateConfig:g=>S.put("/admin/accounts-config",g),delete:g=>S.delete(`/admin/accounts/${g}`),disable:g=>S.put(`/admin/accounts/${g}/disable`),enable:g=>S.put(`/admin/accounts/${g}/enable`),startRegister:(g,w)=>S.post("/admin/register/start",{count:g,domain:w}),getRegisterTask:g=>S.get(`/admin/register/task/${g}`),getRegisterCurrent:()=>S.get("/admin/register/current"),startLogin:g=>S.post("/admin/login/start",g),getLoginTask:g=>S.get(`/admin/login/task/${g}`),getLoginCurrent:()=>S.get("/admin/login/current"),checkLogin:()=>S.post("/admin/login/check")},cs=es("accounts",()=>{const g=a([]),w=a(!1);async function E(){w.value=!0;try{const f=await k.list();g.value=Array.isArray(f)?f:f.accounts||[]}finally{w.value=!1}}async function oe(f){await k.delete(f),await E()}async function T(f){await k.disable(f),await E()}async function re(f){await k.enable(f),await E()}async function W(f){await Promise.all(f.map(R=>k.enable(R))),await E()}async function b(f){await Promise.all(f.map(R=>k.disable(R))),await E()}async function J(f){await Promise.all(f.map(R=>k.delete(R))),await E()}async function le(f){await k.updateConfig(f),await E()}return{accounts:g,isLoading:w,loadAccounts:E,deleteAccount:oe,disableAccount:T,enableAccount:re,bulkEnable:W,bulkDisable:b,bulkDelete:J,updateConfig:le}}),fs={class:"space-y-8"},vs={class:"rounded-3xl border border-border bg-card p-6"},ps={class:"flex flex-wrap items-center justify-between gap-4"},xs={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},ms={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},gs={class:"ml-auto flex items-center gap-2 sm:ml-0"},bs={class:"mt-4 flex flex-wrap items-center gap-2"},ys=["disabled"],_s=["disabled"],ks={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},ws=["disabled"],hs=["disabled"],Cs=["disabled"],Ts=["disabled"],Ss=["disabled"],Es={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},As=["onClick"],Ls={class:"flex items-start justify-between gap-3"},Is={class:"mt-1 font-mono text-xs text-foreground"},$s={class:"flex items-center gap-2"},Rs={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},Vs={key:0,class:"mt-1 text-[11px]"},js={key:0},Ms={key:1},Ds={class:"mt-1 text-sm font-semibold text-foreground"},Os={class:"mt-1 text-sm font-semibold text-foreground"},Bs={class:"mt-4 flex flex-wrap items-center gap-2"},Ns=["onClick"],Us=["onClick"],zs=["onClick"],Ps=["onClick"],Fs={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Ks={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},Hs={class:"min-w-full text-left text-sm"},Js={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Gs={class:"py-3 pr-4"},Ys={class:"py-3 pr-6"},Qs={class:"inline-flex items-center gap-2"},qs={class:"text-sm text-foreground"},Xs={key:0},Ws=["onClick"],Zs={class:"py-4 pr-6 font-mono text-xs text-foreground"},eo={class:"py-4 pr-6"},to={class:"py-4 pr-6"},so={key:0,class:"block text-[11px] text-muted-foreground"},oo={class:"py-4 pr-6 text-xs"},ro={class:"py-4 pr-6 text-xs text-muted-foreground"},lo={class:"py-4 pr-6 text-xs text-muted-foreground"},no={class:"py-4 text-right"},ao={class:"flex flex-wrap justify-end gap-2"},io=["onClick"],uo=["onClick"],co=["onClick"],fo=["onClick"],vo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},po={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},xo={class:"flex items-center justify-between"},mo={class:"mt-1 text-xs text-muted-foreground"},go={class:"mt-4 space-y-4 text-sm"},bo={class:"flex rounded-full border border-border bg-muted/30 p-1 text-xs"},yo={key:0,class:"space-y-4"},_o={key:1,class:"space-y-4"},ko={key:0,class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-600"},wo={class:"mt-6 flex items-center justify-end gap-2"},ho=["disabled"],Co=["disabled"],To={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},So={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},Eo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},Ao={class:"flex items-center gap-2"},Lo=["disabled"],Io={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},$o={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},Ro={key:1,class:"grid gap-3 text-xs text-muted-foreground"},Vo={key:0,class:"space-y-1"},jo={class:"flex flex-wrap gap-x-4 gap-y-1"},Mo={key:1,class:"space-y-1"},Do={class:"flex flex-wrap gap-x-4 gap-y-1"},Oo={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},Bo={key:0,class:"space-y-2"},No={class:"space-y-1 text-[11px] text-muted-foreground"},Uo={key:1,class:"mt-4 space-y-2"},zo={class:"space-y-1 text-[11px] text-muted-foreground"},Po={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},Fo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Ko={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Ho={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},Jo={class:"mt-4 space-y-3 text-sm"},Go={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Yo={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},Qo={class:"flex items-center justify-between"},qo={class:"flex items-center gap-2"},Xo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},Wo={class:"mt-4"},Zo=["readonly"],er={class:"mt-6 flex items-center justify-end gap-2"},tr=["disabled"],Fe="accounts-register-task-cache",Ke="accounts-login-task-cache",He="accounts-register-log-clear",Je="accounts-login-log-clear",Ge="accounts-register-task-cleared-id",Ye="accounts-login-task-cleared-id",ht="1970-01-01 00:00:00",ir=ts({__name:"Accounts",setup(g){const w=cs(),{accounts:E,isLoading:oe}=ss(w),T=ds(),re=a(""),W=a("all"),b=a(new Set),J=a("table"),le=a(!1),f=a(""),R=a(!1),V=a(""),Z=a(""),D=a(!1),ne=a([]),ae=a(1),me=a(!1),O=a("register"),ie=a(""),B=a(""),ge=a(!1),G=a(!1),N=a(!1),Re=a(null),be=a(null),ye=a(null),U=a(null),z=a(null),ee=a(0),te=a(0),de=a(!1),v=a(null),p=a(null),Qe=a(null),j=a(!1),C=a(!1),y=a(""),_=a({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),_e=a(null),qe=a([]),Ct=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],P=F(()=>{const e=re.value.trim().toLowerCase();return E.value.filter(t=>{const o=!e||t.id.toLowerCase().includes(e),i=W.value==="all"||ue(t)===W.value;return o&&i})}),M=F(()=>b.value.size),Ve=F(()=>P.value.length>0&&P.value.every(e=>b.value.has(e.id))),ke=async()=>{await w.loadAccounts(),b.value=new Set,N.value=!1},Xe=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},We=e=>{try{return localStorage.getItem(e)||null}catch{return null}},we=(e,t)=>{try{if(t){localStorage.setItem(e,t);return}localStorage.removeItem(e)}catch{}},Ze=(e,t)=>{try{localStorage.setItem(e,JSON.stringify(t))}catch{}},et=e=>{try{localStorage.removeItem(e)}catch{}},tt=e=>{const t=localStorage.getItem(e),o=Number(t);return Number.isFinite(o)?o:0},he=(e,t)=>{try{localStorage.setItem(e,String(t))}catch{}},je=(e,t=!0)=>{e&&(e.id&&e.id===U.value||(e.id&&U.value&&e.id!==U.value&&(U.value=null,we(Ge,null)),v.value=e,e.id&&e.id!==be.value&&(be.value=e.id,ee.value=0,he(He,0)),t&&Ze(Fe,e)))},Ce=(e,t=!0)=>{e&&(e.id&&e.id===z.value||(e.id&&z.value&&e.id!==z.value&&(z.value=null,we(Ye,null)),p.value=e,e.id&&e.id!==ye.value&&(ye.value=e.id,te.value=0,he(Je,0)),t&&Ze(Ke,e)))},Tt=()=>{ee.value=tt(He),te.value=tt(Je),U.value=We(Ge),z.value=We(Ye);const e=Xe(Fe);e&&e.id!==U.value&&(v.value=e,be.value=e.id||null);const t=Xe(Ke);t&&t.id!==z.value&&(p.value=t,ye.value=t.id||null)},St=()=>{me.value=!0,O.value="register",ie.value="",B.value="",ge.value=!1,de.value=!1},Me=()=>{me.value=!1},Et=e=>{const t=[],o=[];return e.split(/\r?\n/).map(c=>c.trim()).filter(Boolean).forEach((c,d)=>{const u=c.split("----").map(h=>h.trim()),ze=d+1;if(u.length){if(u[0].toLowerCase()==="duckmail"){if(u.length<3||!u[1]||!u[2]){o.push(`第 ${ze} 行格式错误(duckmail)`);return}const h=u[1],Pe=u.slice(2).join("----");t.push({id:h,secure_c_ses:"",csesidx:"",config_id:"",expires_at:ht,mail_provider:"duckmail",mail_address:h,mail_password:Pe});return}if(u.length>=4&&u[0]&&u[2]&&u[3]){const h=u[0],Pe=u[2],Zt=u.slice(3).join("----");t.push({id:h,secure_c_ses:"",csesidx:"",config_id:"",expires_at:ht,mail_provider:"microsoft",mail_address:h,mail_client_id:Pe,mail_refresh_token:Zt,mail_tenant:"consumers"});return}o.push(`第 ${ze} 行格式错误`)}}),{items:t,errors:o}},At=async()=>{if(B.value="",!ie.value.trim()){B.value="请输入导入内容";return}const{items:e,errors:t}=Et(ie.value);if(!e.length){B.value=t.length?t.join(","):"未识别到有效账号";return}if(t.length){B.value=t.slice(0,3).join(",");return}ge.value=!0;try{const i=[...await ut()],c=new Map(i.map((d,u)=>[d.id,u]));e.forEach(d=>{const u=c.get(d.id||"");if(u===void 0){i.push(d);return}const h={...i[u],mail_provider:d.mail_provider,mail_address:d.mail_address};d.mail_provider==="microsoft"?(h.mail_client_id=d.mail_client_id,h.mail_refresh_token=d.mail_refresh_token,h.mail_tenant=d.mail_tenant,h.mail_password=void 0):(h.mail_password=d.mail_password,h.mail_client_id=void 0,h.mail_refresh_token=void 0,h.mail_tenant=void 0),i[u]=h}),await w.updateConfig(i),Me()}catch(o){B.value=o.message||"导入失败"}finally{ge.value=!1}},Lt=async()=>{try{const e=[],t=v.value?.id,o=p.value?.id;if(t&&!Te(t)&&e.push(yt(t)),o&&!Se(o)&&e.push(_t(o)),!e.length){await Ue();return}await Promise.all(e)}catch(e){y.value=e?.message||"任务状态更新失败"}},It=async()=>{G.value=!0,await Lt()},$t=()=>{G.value=!1},Rt=()=>{const e=v.value?.id||null,t=p.value?.id||null;U.value=e,z.value=t,we(Ge,e),we(Ye,t),ee.value=v.value?.logs?.length||0,te.value=p.value?.logs?.length||0,he(He,ee.value),he(Je,te.value),v.value=null,p.value=null,be.value=null,ye.value=null,y.value="",j.value=!1,C.value=!1,q(),X(),et(Fe),et(Ke)},Te=e=>!!(e&&e===U.value),Se=e=>!!(e&&e===z.value),Vt=()=>{N.value=!N.value},se=()=>{N.value=!1},st=e=>{if(!N.value)return;const t=e.target;Re.value&&!Re.value.contains(t)&&(N.value=!1)};os(async()=>{Tt(),await ke(),await Ue(),Qt(),document.addEventListener("click",st)});const Y=F(()=>{const e=v.value?.logs||[];return ee.value?e.slice(ee.value):e}),Q=F(()=>{const e=p.value?.logs||[];return te.value?e.slice(te.value):e}),jt=F(()=>!!y.value||!!v.value||!!p.value||Y.value.length>0||Q.value.length>0),Mt=async()=>{await ns();const e=Qe.value;e&&(e.scrollTop=e.scrollHeight)};rs([Y,Q,G],async()=>{G.value&&await Mt()},{deep:!0});const Dt=F(()=>{const e=v.value?.status,t=p.value?.status;return e==="running"||e==="pending"||t==="running"||t==="pending"}),Ot=F(()=>{if(y.value)return"bg-rose-500";if(Dt.value)return"bg-sky-400";const e=[];if(v.value){const c=v.value.success_count??0,d=v.value.fail_count??0,u=v.value.count??c+d;e.push({success:c,fail:d,total:u,status:v.value.status})}if(p.value){const c=p.value.success_count??0,d=p.value.fail_count??0,u=p.value.account_ids?.length??c+d;e.push({success:c,fail:d,total:u,status:p.value.status})}if(!e.length)return"bg-muted-foreground";const t=e.reduce((c,d)=>c+d.success,0),o=e.reduce((c,d)=>c+d.fail,0),i=e.reduce((c,d)=>c+(d.total||0),0);if(t>0&&o>0)return"bg-amber-400";if(o>0&&t===0)return"bg-rose-500";if(t>0&&o===0)return"bg-emerald-400";if(i===0){const c=e.every(u=>u.status==="success");if(e.some(u=>u.status==="failed"))return"bg-rose-500";if(c)return"bg-emerald-400"}return"bg-muted-foreground"});ls(()=>{q(),X(),Yt(),document.removeEventListener("click",st)});const ue=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?"429限流":e.cooldown_reason==="错误禁用"?"错误禁用":e.disabled?"手动禁用":e.status==="已过期"?"已过期":e.status==="即将过期"?"即将过期":"正常",ot=e=>{const t=ue(e);return t==="429限流"||t==="即将过期"?"bg-amber-200 text-amber-900":t==="错误禁用"||t==="已过期"?"bg-destructive/10 text-destructive":t==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},rt=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?!0:e.disabled||e.cooldown_reason==="错误禁用",lt=e=>e==="已过期"?"过期":e==="未设置"?"未设置":e,nt=e=>e.status==="已过期"?"text-rose-600":e.status==="即将过期"?"text-amber-700":e.status==="未设置"?"text-muted-foreground":"text-emerald-600",at=e=>e<60?`${e} 秒`:e<3600?`${Math.ceil(e/60)} 分钟`:`${(e/3600).toFixed(1)} 小时`,De=e=>e.cooldown_seconds>0?"text-amber-700":e.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",it=e=>{const t=ue(e);return t==="手动禁用"||t==="已过期"?"bg-muted/70":""},Ee=e=>{const t=new Set(b.value);t.has(e)?t.delete(e):t.add(e),b.value=t},dt=()=>{if(Ve.value){b.value=new Set;return}b.value=new Set(P.value.map(e=>e.id))},Bt=(e,t)=>e.id||`account_${t+1}`,ut=async()=>(await k.getConfig()).accounts.map((t,o)=>({...t,id:Bt(t,o)})),ct=e=>`${e.time} [${e.level}] ${e.message}`,Nt=(e,t)=>{let o=-1;for(let c=0;c<e.length;c+=1)if(e[c].id===t){o=c;break}if(o===-1)return f.value="未找到对应账号配置。",!1;const i=e[o];return _.value={id:i.id,secure_c_ses:i.secure_c_ses,csesidx:i.csesidx,config_id:i.config_id,host_c_oses:i.host_c_oses,expires_at:i.expires_at},qe.value=e,_e.value=o,le.value=!0,!0},ft=async e=>{f.value="";try{const t=await ut();Nt(t,e)}catch(t){f.value=t.message||"加载账号配置失败"}},Ut=async()=>{V.value="";try{const e=await k.getConfig();ne.value=Array.isArray(e.accounts)?e.accounts:[],Z.value=JSON.stringify(pt(ne.value),null,2),D.value=!0,R.value=!0}catch(e){V.value=e.message||"加载账号配置失败"}},Oe=()=>{R.value=!1,V.value="",D.value=!1},vt=()=>{const e=JSON.parse(Z.value);if(!Array.isArray(e))throw new Error("配置格式必须是数组。");return e},zt=e=>typeof e!="string"||!e?e:e.length<=6?`${e.slice(0,2)}****`:`${e.slice(0,3)}****`,pt=e=>{const t=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password","mail_refresh_token","mail_client_id"]);return e.map(o=>{const i={...o};return t.forEach(c=>{const d=i[c];d&&(i[c]=zt(d))}),i})},Pt=()=>{if(V.value="",!D.value){try{ne.value=vt()}catch(e){V.value=e.message||"JSON 格式错误";return}Z.value=JSON.stringify(pt(ne.value),null,2),D.value=!0;return}Z.value=JSON.stringify(ne.value,null,2),D.value=!1},Ft=async()=>{V.value="";try{const e=vt();await w.updateConfig(e),Oe()}catch(e){V.value=e.message||"保存失败"}},Be=()=>{le.value=!1,f.value=""},Kt=async()=>{if(_e.value===null)return;const e=[...qe.value];e[_e.value]={...e[_e.value],id:_.value.id,secure_c_ses:_.value.secure_c_ses,csesidx:_.value.csesidx,config_id:_.value.config_id,host_c_oses:_.value.host_c_oses||void 0,expires_at:_.value.expires_at||void 0};try{await w.updateConfig(e),Be()}catch(t){f.value=t.message||"保存失败"}},Ht=async()=>{await w.bulkEnable(Array.from(b.value)),b.value=new Set},Jt=async()=>{await T.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"})&&(await w.bulkDisable(Array.from(b.value)),b.value=new Set)},Gt=async()=>{await T.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"})&&(await w.bulkDelete(Array.from(b.value)),b.value=new Set)},xt=async e=>{await w.enableAccount(e)},mt=async e=>{await T.ask({title:"禁用账号",message:"确定要禁用该账号吗?"})&&await w.disableAccount(e)},gt=async e=>{await T.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"})&&await w.deleteAccount(e)};let ce=null,fe=null,ve=null,Ae=!1;const q=()=>{ce!==null&&(window.clearInterval(ce),ce=null)},X=()=>{fe!==null&&(window.clearInterval(fe),fe=null)},Yt=()=>{ve!==null&&(window.clearInterval(ve),ve=null),Ae=!1},bt=e=>e==="pending"?"等待中":e==="running"?"执行中":e==="success"?"成功":e==="failed"?"失败":e,yt=async e=>{if(Te(e)){q();return}const t=await k.getRegisterTask(e);if(Te(t.id)){q();return}je(t),t.status!=="running"&&t.status!=="pending"&&(j.value=!1,q(),await ke())},_t=async e=>{if(Se(e)){X();return}const t=await k.getLoginTask(e);if(Se(t.id)){X();return}Ce(t),t.status!=="running"&&t.status!=="pending"&&(C.value=!1,X(),await ke())},kt=e=>{q(),ce=window.setInterval(()=>{yt(e).catch(t=>{y.value=t?.message||"注册任务更新失败",q(),j.value=!1})},3e3)},Ne=e=>{X(),fe=window.setInterval(()=>{_t(e).catch(t=>{y.value=t?.message||"刷新任务更新失败",X(),C.value=!1})},3e3)},Qt=()=>{ve===null&&(ve=window.setInterval(async()=>{if(!Ae&&!G.value&&!(ce!==null||fe!==null)&&!(!j.value&&!C.value&&!v.value&&!p.value)){Ae=!0;try{await Ue()}catch(e){y.value=e?.message||"后台刷新失败"}finally{Ae=!1}}},6e3))},Ue=async()=>{try{const e=await k.getRegisterCurrent();e&&"id"in e&&!Te(e.id)&&(je(e),(e.status==="running"||e.status==="pending")&&(j.value=!0,kt(e.id)))}catch(e){y.value=e.message||"加载注册任务失败"}try{const e=await k.getLoginCurrent();e&&"id"in e&&!Se(e.id)&&(Ce(e),(e.status==="running"||e.status==="pending")&&(C.value=!0,Ne(e.id)))}catch(e){y.value=e.message||"加载刷新任务失败"}},qt=async()=>{y.value="",j.value=!0;try{const e=Number.isFinite(ae.value)&&ae.value>0?ae.value:void 0,t=await k.startRegister(e);je(t),kt(t.id),me.value=!1,G.value=!0}catch(e){y.value=e.message||"启动注册失败",j.value=!1}},Xt=async()=>{if(b.value.size){y.value="",C.value=!0;try{const e=await k.startLogin(Array.from(b.value));Ce(e),Ne(e.id)}catch(e){y.value=e.message||"启动刷新失败",C.value=!1}}},Wt=async()=>{y.value="",C.value=!0;try{await k.checkLogin();const e=await k.getLoginCurrent();if(e&&"id"in e){Ce(e),Ne(e.id);return}C.value=!1}catch(e){y.value=e.message||"触发刷新失败",C.value=!1}};return(e,t)=>(r(),l(pe,null,[s("div",fs,[s("section",vs,[s("div",ps,[s("div",xs,[A(s("input",{"onUpdate:modelValue":t[0]||(t[0]=o=>re.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[L,re.value]]),K(as,{modelValue:W.value,"onUpdate:modelValue":t[1]||(t[1]=o=>W.value=o),options:Ct},null,8,["modelValue"])]),s("div",ms,[K(xe,{modelValue:Ve.value,"onUpdate:modelValue":dt},{default:wt(()=>[...t[27]||(t[27]=[H(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+n(M.value)+" / "+n(P.value.length)+" 个账号",1),s("div",gs,[s("button",{type:"button",class:m(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",J.value==="table"?"bg-accent text-accent-foreground":""]),onClick:t[2]||(t[2]=o=>J.value="table"),"aria-label":"列表视图"},[...t[28]||(t[28]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:m(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",J.value==="card"?"bg-accent text-accent-foreground":""]),onClick:t[3]||(t[3]=o=>J.value="card"),"aria-label":"卡片视图"},[...t[29]||(t[29]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",bs,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:I(oe),onClick:ke}," 刷新列表 ",8,ys),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ut}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:j.value,onClick:St}," 添加账户 ",8,_s),s("div",{ref_key:"moreActionsRef",ref:Re,class:"relative"},[s("button",{class:m(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",N.value?"bg-accent text-accent-foreground":""]),onClick:Vt},[t[30]||(t[30]=H(" 更多操作 ",-1)),t[31]||(t[31]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),jt.value?(r(),l("span",{key:0,class:m(["ml-1 h-2 w-2 rounded-full",Ot.value]),"aria-hidden":"true"},null,2)):x("",!0)],2),N.value?(r(),l("div",ks,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:t[4]||(t[4]=o=>{It(),se()})}," 任务状态 "),t[32]||(t[32]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:m(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",C.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:C.value,onClick:t[5]||(t[5]=o=>{Wt(),se()})}," 刷新过期 ",10,ws),s("button",{type:"button",class:m(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!M.value||C.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!M.value||C.value,onClick:t[6]||(t[6]=o=>{Xt(),se()})}," 刷新选中 ",10,hs),t[33]||(t[33]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:m(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",M.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!M.value,onClick:t[7]||(t[7]=o=>{Ht(),se()})}," 批量启用 ",10,Cs),s("button",{type:"button",class:m(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",M.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!M.value,onClick:t[8]||(t[8]=o=>{Jt(),se()})}," 批量禁用 ",10,Ts),s("button",{type:"button",class:m(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",M.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!M.value,onClick:t[9]||(t[9]=o=>{Gt(),se()})}," 批量删除 ",10,Ss)])):x("",!0)],512)]),J.value==="card"?(r(),l("div",Es,[(r(!0),l(pe,null,Ie(P.value,o=>(r(),l("div",{key:o.id,class:m(["rounded-2xl border border-border bg-card p-4",it(o)]),onClick:i=>Ee(o.id)},[s("div",Ls,[s("div",null,[t[34]||(t[34]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",Is,n(o.id),1)]),s("div",$s,[K(xe,{modelValue:b.value.has(o.id),"onUpdate:modelValue":i=>Ee(o.id),onClick:t[10]||(t[10]=$(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:m(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",ot(o)])},n(ue(o)),3)])]),s("div",Rs,[s("div",null,[t[35]||(t[35]=s("p",null,"剩余时间",-1)),s("p",{class:m(["mt-1 text-sm font-semibold",nt(o)])},n(lt(o.remaining_display)),3),o.expires_at?(r(),l("p",Vs,n(o.expires_at),1)):x("",!0)]),s("div",null,[t[36]||(t[36]=s("p",null,"冷却",-1)),s("p",{class:m(["mt-1",De(o)])},[o.cooldown_seconds>0?(r(),l("span",js,n(at(o.cooldown_seconds))+" · "+n(o.cooldown_reason),1)):(r(),l("span",Ms,n(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[t[37]||(t[37]=s("p",null,"失败数",-1)),s("p",Ds,n(o.error_count),1)]),s("div",null,[t[38]||(t[38]=s("p",null,"会话数",-1)),s("p",Os,n(o.conversation_count),1)])]),s("div",Bs,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:$(i=>ft(o.id),["stop"])}," 编辑 ",8,Ns),rt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[11]||(t[11]=$(()=>{},["stop"])),i=>xt(o.id)]}," 启用 ",8,Us)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[12]||(t[12]=$(()=>{},["stop"])),i=>mt(o.id)]}," 禁用 ",8,zs)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[t[13]||(t[13]=$(()=>{},["stop"])),i=>gt(o.id)]}," 删除 ",8,Ps)])],10,As))),128)),!P.value.length&&!I(oe)?(r(),l("div",Fs," 暂无账号数据,请检查后台配置。 ")):x("",!0)])):(r(),l("div",Ks,[s("table",Hs,[s("thead",Js,[s("tr",null,[s("th",Gs,[K(xe,{modelValue:Ve.value,"onUpdate:modelValue":dt},null,8,["modelValue"])]),t[40]||(t[40]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),t[41]||(t[41]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",Ys,[s("span",Qs,[t[39]||(t[39]=H(" 剩余/过期 ",-1)),K(us,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),t[42]||(t[42]=s("th",{class:"py-3 pr-6"},"冷却",-1)),t[43]||(t[43]=s("th",{class:"py-3 pr-6"},"失败数",-1)),t[44]||(t[44]=s("th",{class:"py-3 pr-6"},"会话数",-1)),t[45]||(t[45]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",qs,[!P.value.length&&!I(oe)?(r(),l("tr",Xs,[...t[46]||(t[46]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):x("",!0),(r(!0),l(pe,null,Ie(P.value,o=>(r(),l("tr",{key:o.id,class:m(["border-t border-border",it(o)]),onClick:i=>Ee(o.id)},[s("td",{class:"py-4 pr-4",onClick:t[14]||(t[14]=$(()=>{},["stop"]))},[K(xe,{modelValue:b.value.has(o.id),"onUpdate:modelValue":i=>Ee(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",Zs,n(o.id),1),s("td",eo,[s("span",{class:m(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",ot(o)])},n(ue(o)),3)]),s("td",to,[s("div",{class:m(["text-sm font-semibold",nt(o)])},n(lt(o.remaining_display)),3),o.expires_at?(r(),l("span",so,n(o.expires_at),1)):x("",!0)]),s("td",oo,[o.cooldown_seconds>0?(r(),l("span",{key:0,class:m(De(o))},n(at(o.cooldown_seconds))+" · "+n(o.cooldown_reason),3)):(r(),l("span",{key:1,class:m(De(o))},n(o.cooldown_reason||"无冷却"),3))]),s("td",ro,n(o.error_count),1),s("td",lo,n(o.conversation_count),1),s("td",no,[s("div",ao,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:$(i=>ft(o.id),["stop"])}," 编辑 ",8,io),rt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:$(i=>xt(o.id),["stop"])}," 启用 ",8,uo)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:$(i=>mt(o.id),["stop"])}," 禁用 ",8,co)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:$(i=>gt(o.id),["stop"])}," 删除 ",8,fo)])])],10,Ws))),128))])])]))])]),K(is,{open:I(T).open.value,title:I(T).title.value,message:I(T).message.value,"confirm-text":I(T).confirmText.value,"cancel-text":I(T).cancelText.value,onConfirm:I(T).confirm,onCancel:I(T).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(r(),Le($e,{to:"body"},[me.value?(r(),l("div",vo,[s("div",po,[s("div",xo,[s("div",null,[t[47]||(t[47]=s("p",{class:"text-sm font-medium text-foreground"},"添加账户",-1)),s("p",mo,n(O.value==="register"?"创建 DuckMail 账号并自动注册":"批量导入账户配置"),1)]),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Me}," 关闭 ")]),s("div",go,[s("div",bo,[s("button",{type:"button",class:m(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",O.value==="register"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[15]||(t[15]=o=>O.value="register")}," 自动注册 ",2),s("button",{type:"button",class:m(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",O.value==="import"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[16]||(t[16]=o=>O.value="import")}," 批量导入 ",2)]),O.value==="register"?(r(),l("div",yo,[t[48]||(t[48]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),A(s("input",{"onUpdate:modelValue":t[17]||(t[17]=o=>ae.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[L,ae.value,void 0,{number:!0}]]),t[49]||(t[49]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"}," 默认域名来自设置面板(可在“配置面板”中修改) ",-1))])):(r(),l("div",_o,[t[50]||(t[50]=s("label",{class:"block text-xs text-muted-foreground"},"批量导入(每行一个)",-1)),A(s("textarea",{"onUpdate:modelValue":t[18]||(t[18]=o=>ie.value=o),class:"min-h-[140px] w-full rounded-2xl border border-input bg-background px-3 py-2 text-xs font-mono",placeholder:`duckmail----you@example.com----password
2
+ user@outlook.com----loginPassword----clientId----refreshToken`},null,512),[[L,ie.value]]),t[51]||(t[51]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"支持两种格式:"),s("p",{class:"mt-1 font-mono"},"duckmail----email----password"),s("p",{class:"mt-1 font-mono"},"email----password----clientId----refreshToken"),s("p",{class:"mt-2 text-[11px]"},"说明:微软格式中的 password 仅用于兼容输入,不会保存或使用。"),s("p",{class:"mt-1 text-[11px]"},"导入后请执行一次“刷新选中”以获取 Cookie。")],-1)),B.value?(r(),l("div",ko,n(B.value),1)):x("",!0)])),t[53]||(t[53]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-[11px] leading-relaxed text-muted-foreground"},[s("div",{class:"space-y-2"},[s("p",{class:"font-semibold text-rose-600"},"严禁滥用:禁止将本工具用于商业用途或任何形式的滥用(无论规模大小)"),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"合法用途:"),H("本项目仅限个人学习、技术研究与非商业性技术交流,旨在探索浏览器自动化与系统集成。")])]),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"禁止行为:"),H("严禁用于以下场景:")]),s("p",{class:"pl-3"},"- 商业用途或盈利性使用"),s("p",{class:"pl-3"},"- 任何形式的批量注册或自动化滥用(无论规模大小)"),s("p",{class:"pl-3"},"- 破坏市场秩序或恶意竞争"),s("p",{class:"pl-3"},"- 违反 Google 服务条款的任何行为")]),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"使用责任:"),H("因使用本工具产生的一切后果由使用者完全承担,包括但不限于账号封禁、数据损失及法律责任。")]),s("p",null,[s("strong",null,"合规要求:"),H("使用者必须遵守所在地法律法规及第三方服务条款,作者不对任何违规使用行为承担责任。")])]),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"技术声明:")]),s("p",{class:"pl-3"},'- 本项目按"现状"提供,不提供任何明示或暗示的担保'),s("p",{class:"pl-3"},"- 依赖 DuckMail API 等第三方服务,其可用性不受作者控制"),s("p",{class:"pl-3"},"- 作者保留随时停止维护或变更功能的权利")])])],-1)),K(xe,{modelValue:de.value,"onUpdate:modelValue":t[19]||(t[19]=o=>de.value=o)},{default:wt(()=>[...t[52]||(t[52]=[H(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])]),s("div",wo,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Me}," 取消 "),O.value==="register"?(r(),l("button",{key:0,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:j.value||!de.value,onClick:qt}," 开始注册 ",8,ho)):(r(),l("button",{key:1,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:ge.value||!de.value,onClick:At}," 导入并保存 ",8,Co))])])])):x("",!0)])),(r(),Le($e,{to:"body"},[G.value?(r(),l("div",To,[s("div",So,[s("div",Eo,[t[54]||(t[54]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",Ao,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary",disabled:!Y.value.length&&!Q.value.length&&!v.value&&!p.value&&!y.value,onClick:Rt}," 清空日志 ",8,Lo),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:$t}," 关闭 ")])]),s("div",Io,[y.value?(r(),l("div",$o,n(y.value),1)):x("",!0),v.value||p.value?(r(),l("div",Ro,[v.value?(r(),l("div",Vo,[t[55]||(t[55]=s("div",{class:"font-medium text-foreground"},"注册任务",-1)),s("div",jo,[s("span",null,"状态:"+n(bt(v.value.status)),1),s("span",null,"进度:"+n(v.value.progress)+"/"+n(v.value.count),1),s("span",null,"成功:"+n(v.value.success_count),1),s("span",null,"失败:"+n(v.value.fail_count),1)])])):x("",!0),p.value?(r(),l("div",Mo,[t[56]||(t[56]=s("div",{class:"font-medium text-foreground"},"刷新任务",-1)),s("div",Do,[s("span",null,"状态:"+n(bt(p.value.status)),1),s("span",null,"进度:"+n(p.value.progress)+"/"+n(p.value.account_ids.length),1),s("span",null,"成功:"+n(p.value.success_count),1),s("span",null,"失败:"+n(p.value.fail_count),1)])])):x("",!0)])):x("",!0),Y.value.length||Q.value.length?(r(),l("div",Oo,[s("div",{ref_key:"taskLogsRef",ref:Qe,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[Y.value.length?(r(),l("div",Bo,[t[57]||(t[57]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",No,[(r(!0),l(pe,null,Ie(Y.value,(o,i)=>(r(),l("div",{key:`reg-${i}`,class:"font-mono"},n(ct(o)),1))),128))])])):x("",!0),Q.value.length?(r(),l("div",Uo,[t[58]||(t[58]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",zo,[(r(!0),l(pe,null,Ie(Q.value,(o,i)=>(r(),l("div",{key:`login-${i}`,class:"font-mono"},n(ct(o)),1))),128))])])):x("",!0)],512)])):x("",!0),!y.value&&!v.value&&!p.value&&!Y.value.length&&!Q.value.length?(r(),l("div",Po," 暂无任务 ")):x("",!0)])])])):x("",!0)])),(r(),Le($e,{to:"body"},[le.value?(r(),l("div",Fo,[s("div",Ko,[s("div",{class:"flex items-center justify-between"},[t[59]||(t[59]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Be}," 关闭 ")]),f.value?(r(),l("div",Ho,n(f.value),1)):x("",!0),s("div",Jo,[t[60]||(t[60]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),A(s("input",{"onUpdate:modelValue":t[20]||(t[20]=o=>_.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[L,_.value.id]]),t[61]||(t[61]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),A(s("textarea",{"onUpdate:modelValue":t[21]||(t[21]=o=>_.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[L,_.value.secure_c_ses]]),t[62]||(t[62]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),A(s("input",{"onUpdate:modelValue":t[22]||(t[22]=o=>_.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[L,_.value.csesidx]]),t[63]||(t[63]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),A(s("input",{"onUpdate:modelValue":t[23]||(t[23]=o=>_.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[L,_.value.config_id]]),t[64]||(t[64]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),A(s("input",{"onUpdate:modelValue":t[24]||(t[24]=o=>_.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[L,_.value.host_c_oses]]),t[65]||(t[65]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),A(s("input",{"onUpdate:modelValue":t[25]||(t[25]=o=>_.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[L,_.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Be}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Kt}," 保存 ")])])])):x("",!0)])),(r(),Le($e,{to:"body"},[R.value?(r(),l("div",Go,[s("div",Yo,[s("div",Qo,[t[66]||(t[66]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",qo,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Pt},n(D.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Oe}," 关闭 ")])]),V.value?(r(),l("div",Xo,n(V.value),1)):x("",!0),s("div",Wo,[A(s("textarea",{"onUpdate:modelValue":t[26]||(t[26]=o=>Z.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:D.value},null,8,Zo),[[L,Z.value]])]),s("div",er,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Oe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Ft,disabled:D.value}," 保存 ",8,tr)])])])):x("",!0)]))],64))}});export{ir as default};
static/assets/Accounts-EOqS8kG-.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ import{g as E,C as os,h as i,d as rs,D as ls,i as J,o as ns,z as as,j as is,c as n,a as s,p as G,m as Re,q as R,v as V,s as $t,t as a,n as p,u as j,b as g,f as ee,F as ge,r as Ve,T as je,E as ds,w as M,e as l,G as us}from"./index-BCQxBeUo.js";import{_ as cs}from"./SelectMenu.vue_vue_type_script_setup_true_lang-SHDMWwbQ.js";import{_ as be}from"./Checkbox.vue_vue_type_script_setup_true_lang-12Ygc6BR.js";import{_ as fs}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-CXKmFeEu.js";import{u as vs}from"./useConfirmDialog-CdgTrrpG.js";import{_ as ms}from"./HelpTip.vue_vue_type_script_setup_true_lang-32PHHvO_.js";const w={list:()=>E.get("/admin/accounts"),getConfig:()=>E.get("/admin/accounts-config"),updateConfig:y=>E.put("/admin/accounts-config",y),delete:y=>E.delete(`/admin/accounts/${y}`),disable:y=>E.put(`/admin/accounts/${y}/disable`),enable:y=>E.put(`/admin/accounts/${y}/enable`),startRegister:(y,k)=>E.post("/admin/register/start",{count:y,domain:k}),getRegisterTask:y=>E.get(`/admin/register/task/${y}`),getRegisterCurrent:()=>E.get("/admin/register/current"),startLogin:y=>E.post("/admin/login/start",y),getLoginTask:y=>E.get(`/admin/login/task/${y}`),getLoginCurrent:()=>E.get("/admin/login/current"),checkLogin:()=>E.post("/admin/login/check")},ps=os("accounts",()=>{const y=i([]),k=i(!1);async function A(){k.value=!0;try{const x=await w.list();y.value=Array.isArray(x)?x:x.accounts||[]}finally{k.value=!1}}async function ne(x){await w.delete(x),await A()}async function T(x){await w.disable(x),await A()}async function d(x){await w.enable(x),await A()}async function ae(x){await Promise.all(x.map($=>w.enable($))),await A()}async function te(x){await Promise.all(x.map($=>w.disable($))),await A()}async function b(x){await Promise.all(x.map($=>w.delete($))),await A()}async function Y(x){await w.updateConfig(x),await A()}return{accounts:y,isLoading:k,loadAccounts:A,deleteAccount:ne,disableAccount:T,enableAccount:d,bulkEnable:ae,bulkDisable:te,bulkDelete:b,updateConfig:Y}}),xs={class:"space-y-8"},gs={class:"rounded-3xl border border-border bg-card p-6"},bs={class:"flex flex-wrap items-center justify-between gap-4"},ys={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},_s={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},hs={class:"ml-auto flex items-center gap-2 sm:ml-0"},ws={class:"mt-4 flex flex-wrap items-center gap-2"},ks=["disabled"],Cs=["disabled"],Ts={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},Ss=["disabled"],$s=["disabled"],Is=["disabled"],Es=["disabled"],Ls=["disabled"],As={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},Rs=["onClick"],Vs={class:"flex items-start justify-between gap-3"},js={class:"mt-1 font-mono text-xs text-foreground"},Ms={class:"flex items-center gap-2"},Ds={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},Os={key:0,class:"mt-1 text-[11px]"},Bs={key:0},Ns={key:1},Us={class:"mt-1 text-sm font-semibold text-foreground"},zs={class:"mt-1 text-sm font-semibold text-foreground"},Ps={class:"mt-4 flex flex-wrap items-center gap-2"},Fs=["onClick"],Ks=["onClick"],Hs=["onClick"],Js=["onClick"],Gs={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Ys={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},qs={class:"min-w-full text-left text-sm"},Qs={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Xs={class:"py-3 pr-4"},Ws={class:"py-3 pr-6"},Zs={class:"inline-flex items-center gap-2"},eo={class:"text-sm text-foreground"},to={key:0},so=["onClick"],oo={class:"py-4 pr-6 font-mono text-xs text-foreground"},ro={class:"py-4 pr-6"},lo={class:"py-4 pr-6"},no={key:0,class:"block text-[11px] text-muted-foreground"},ao={class:"py-4 pr-6 text-xs"},io={class:"py-4 pr-6 text-xs text-muted-foreground"},uo={class:"py-4 pr-6 text-xs text-muted-foreground"},co={class:"py-4 text-right"},fo={class:"flex flex-wrap justify-end gap-2"},vo=["onClick"],mo=["onClick"],po=["onClick"],xo=["onClick"],go={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},bo={class:"flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},yo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},_o={class:"mt-1 text-xs text-muted-foreground"},ho={class:"scrollbar-slim flex-1 overflow-y-auto px-6 py-4"},wo={class:"space-y-4 text-sm"},ko={class:"flex rounded-full border border-border bg-muted/30 p-1 text-xs"},Co={key:0,class:"space-y-4"},To={key:1,class:"space-y-4"},So={key:0,class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-600"},$o={class:"border-t border-border/60 px-6 py-4"},Io={class:"flex items-center justify-end gap-2"},Eo=["disabled"],Lo=["disabled"],Ao={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Ro={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},Vo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},jo={class:"flex items-center gap-2"},Mo=["disabled"],Do={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},Oo={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},Bo={key:1,class:"grid gap-3 text-xs text-muted-foreground"},No={key:0,class:"space-y-1"},Uo={class:"flex items-center gap-2 font-medium text-foreground"},zo={class:"flex flex-wrap gap-x-4 gap-y-1"},Po={key:1,class:"space-y-1"},Fo={class:"flex items-center gap-2 font-medium text-foreground"},Ko={class:"flex flex-wrap gap-x-4 gap-y-1"},Ho={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},Jo={key:0,class:"space-y-2"},Go={class:"space-y-1 text-[11px] text-muted-foreground"},Yo={key:1,class:"mt-4 space-y-2"},qo={class:"space-y-1 text-[11px] text-muted-foreground"},Qo={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},Xo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Wo={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Zo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},er={class:"mt-4 space-y-3 text-sm"},tr={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},sr={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},or={class:"flex items-center justify-between"},rr={class:"flex items-center gap-2"},lr={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},nr={class:"mt-4"},ar=["readonly"],ir={class:"mt-6 flex items-center justify-end gap-2"},dr=["disabled"],Je="accounts-register-task-cache",Ge="accounts-login-task-cache",Ye="accounts-register-log-clear",qe="accounts-login-log-clear",Qe="accounts-register-task-cleared-id",Xe="accounts-login-task-cleared-id",It="1970-01-01 00:00:00",xr=rs({__name:"Accounts",setup(y){const k=ps(),{accounts:A,isLoading:ne}=ls(k),T=vs(),d=ds(),ae=i(""),te=i("all"),b=i(new Set),Y=i("table"),x=i(!1),$=i(""),Me=i(!1),D=i(""),se=i(""),N=i(!1),ie=i([]),de=i(1),ye=i(!1),U=i("register"),ue=i(""),z=i(""),_e=i(!1),q=i(!1),P=i(!1),De=i(null),he=i(null),we=i(null),F=i(null),K=i(null),oe=i(0),re=i(0),ce=i(!1),c=i(null),f=i(null),We=i(null),O=i(!1),S=i(!1),_=i(""),h=i({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),ke=i(null),Ze=i([]),Et=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],H=J(()=>{const t=ae.value.trim().toLowerCase();return A.value.filter(e=>{const o=!t||e.id.toLowerCase().includes(t),r=te.value==="all"||ve(e)===te.value;return o&&r})}),B=J(()=>b.value.size),Oe=J(()=>H.value.length>0&&H.value.every(t=>b.value.has(t.id))),fe=async()=>{await k.loadAccounts(),b.value=new Set,P.value=!1},et=t=>{try{const e=localStorage.getItem(t);return e?JSON.parse(e):null}catch{return null}},tt=t=>{try{return localStorage.getItem(t)||null}catch{return null}},Ce=(t,e)=>{try{if(e){localStorage.setItem(t,e);return}localStorage.removeItem(t)}catch{}},st=(t,e)=>{try{localStorage.setItem(t,JSON.stringify(e))}catch{}},ot=t=>{try{localStorage.removeItem(t)}catch{}},rt=t=>{const e=localStorage.getItem(t),o=Number(e);return Number.isFinite(o)?o:0},Te=(t,e)=>{try{localStorage.setItem(t,String(e))}catch{}},Be=(t,e=!0)=>{t&&(t.id&&t.id===F.value||(t.id&&F.value&&t.id!==F.value&&(F.value=null,Ce(Qe,null)),c.value=t,t.id&&t.id!==he.value&&(he.value=t.id,oe.value=0,Te(Ye,0)),e&&st(Je,t)))},Se=(t,e=!0)=>{t&&(t.id&&t.id===K.value||(t.id&&K.value&&t.id!==K.value&&(K.value=null,Ce(Xe,null)),f.value=t,t.id&&t.id!==we.value&&(we.value=t.id,re.value=0,Te(qe,0)),e&&st(Ge,t)))},Lt=()=>{oe.value=rt(Ye),re.value=rt(qe),F.value=tt(Qe),K.value=tt(Xe);const t=et(Je);t&&t.id!==F.value&&(c.value=t,he.value=t.id||null);const e=et(Ge);e&&e.id!==K.value&&(f.value=e,we.value=e.id||null)},At=()=>{ye.value=!0,U.value="register",ue.value="",z.value="",_e.value=!1,ce.value=!1},Ne=()=>{ye.value=!1},Rt=t=>{const e=[],o=[];return t.split(/\r?\n/).map(u=>u.trim()).filter(Boolean).forEach((u,m)=>{const v=u.split("----").map(I=>I.trim()),C=m+1;if(v.length){if(v[0].toLowerCase()==="duckmail"){if(v.length<3||!v[1]||!v[2]){o.push(`第 ${C} 行格式错误(duckmail)`);return}const I=v[1],Ae=v.slice(2).join("----");e.push({id:I,secure_c_ses:"",csesidx:"",config_id:"",expires_at:It,mail_provider:"duckmail",mail_address:I,mail_password:Ae});return}if(v.length>=4&&v[0]&&v[2]&&v[3]){const I=v[0],Ae=v[1]||"",L=v[2],ss=v.slice(3).join("----");e.push({id:I,secure_c_ses:"",csesidx:"",config_id:"",expires_at:It,mail_provider:"microsoft",mail_address:I,mail_password:Ae,mail_client_id:L,mail_refresh_token:ss,mail_tenant:"consumers"});return}o.push(`第 ${C} 行格式错误`)}}),{items:e,errors:o}},Vt=async()=>{if(z.value="",!ue.value.trim()){z.value="请输入导��内容";return}const{items:t,errors:e}=Rt(ue.value);if(!t.length){z.value=e.length?e.join(","):"未识别到有效账号";return}if(e.length){z.value=e.slice(0,3).join(",");return}_e.value=!0;try{const r=[...await vt()],u=new Map(r.map((C,I)=>[C.id,I])),m=[];t.forEach(C=>{const I=u.get(C.id||"");if(I===void 0){r.push(C),m.push(C.id);return}const L={...r[I],mail_provider:C.mail_provider,mail_address:C.mail_address};C.mail_provider==="microsoft"?(L.mail_client_id=C.mail_client_id,L.mail_refresh_token=C.mail_refresh_token,L.mail_tenant=C.mail_tenant,L.mail_password=C.mail_password):(L.mail_password=C.mail_password,L.mail_client_id=void 0,L.mail_refresh_token=void 0,L.mail_tenant=void 0),r[I]=L,m.push(C.id)}),await k.updateConfig(r),await fe(),b.value=new Set(m),d.success(`成功导入 ${m.length} 个账户`),Ne(),await T.ask({title:"导入成功",message:`已导入 ${m.length} 个账户并自动选中。是否立即刷新这些账户以获取 Cookie?`,confirmText:"立即刷新",cancelText:"稍后手动刷新"})&&await St()}catch(o){z.value=o.message||"导入失败",d.error(o.message||"导入失败")}finally{_e.value=!1}},jt=async()=>{try{const t=[],e=c.value?.id,o=f.value?.id;if(e&&!$e(e)&&t.push(kt(e)),o&&!Ie(o)&&t.push(Ct(o)),!t.length){await He();return}await Promise.all(t)}catch(t){_.value=t?.message||"任务状态更新失败"}},Ue=async()=>{q.value=!0,await jt()},Mt=()=>{q.value=!1},Dt=()=>{const t=c.value?.id||null,e=f.value?.id||null;F.value=t,K.value=e,Ce(Qe,t),Ce(Xe,e),oe.value=c.value?.logs?.length||0,re.value=f.value?.logs?.length||0,Te(Ye,oe.value),Te(qe,re.value),c.value=null,f.value=null,he.value=null,we.value=null,_.value="",O.value=!1,S.value=!1,W(),Z(),ot(Je),ot(Ge)},$e=t=>!!(t&&t===F.value),Ie=t=>!!(t&&t===K.value),Ot=()=>{P.value=!P.value},le=()=>{P.value=!1},lt=t=>{if(!P.value)return;const e=t.target;De.value&&!De.value.contains(e)&&(P.value=!1)};ns(async()=>{Lt(),await fe(),await He(),Zt(),document.addEventListener("click",lt)});const Q=J(()=>{const t=c.value?.logs||[];return oe.value?t.slice(oe.value):t}),X=J(()=>{const t=f.value?.logs||[];return re.value?t.slice(re.value):t}),Bt=J(()=>!!_.value||!!c.value||!!f.value||Q.value.length>0||X.value.length>0),Nt=async()=>{await us();const t=We.value;t&&(t.scrollTop=t.scrollHeight)};as([Q,X,q],async()=>{q.value&&await Nt()},{deep:!0});const Ut=J(()=>{const t=c.value?.status,e=f.value?.status;return t==="running"||t==="pending"||e==="running"||e==="pending"}),zt=J(()=>{if(_.value)return"bg-rose-500";if(Ut.value)return"bg-sky-400";const t=[];if(c.value){const u=c.value.success_count??0,m=c.value.fail_count??0,v=c.value.count??u+m;t.push({success:u,fail:m,total:v,status:c.value.status})}if(f.value){const u=f.value.success_count??0,m=f.value.fail_count??0,v=f.value.account_ids?.length??u+m;t.push({success:u,fail:m,total:v,status:f.value.status})}if(!t.length)return"bg-muted-foreground";const e=t.reduce((u,m)=>u+m.success,0),o=t.reduce((u,m)=>u+m.fail,0),r=t.reduce((u,m)=>u+(m.total||0),0);if(e>0&&o>0)return"bg-amber-400";if(o>0&&e===0)return"bg-rose-500";if(e>0&&o===0)return"bg-emerald-400";if(r===0){const u=t.every(v=>v.status==="success");if(t.some(v=>v.status==="failed"))return"bg-rose-500";if(u)return"bg-emerald-400"}return"bg-muted-foreground"});is(()=>{W(),Z(),Wt(),document.removeEventListener("click",lt)});const ve=t=>t.cooldown_reason?.includes("429")&&t.cooldown_seconds>0?"429限流":t.cooldown_reason==="错误禁用"?"错误禁用":t.disabled?"手动禁用":t.status==="已过期"?"已过期":t.status==="即将过期"?"即将过期":"正常",nt=t=>{const e=ve(t);return e==="429限流"||e==="即将过期"?"bg-amber-200 text-amber-900":e==="错误禁用"||e==="已过期"?"bg-destructive/10 text-destructive":e==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},at=t=>t.cooldown_reason?.includes("429")&&t.cooldown_seconds>0?!0:t.disabled||t.cooldown_reason==="错误禁用",it=t=>t==="已过期"?"过期":t==="未设置"?"未设置":t,dt=t=>t.status==="已过期"?"text-rose-600":t.status==="即将过期"?"text-amber-700":t.status==="未设置"?"text-muted-foreground":"text-emerald-600",ut=t=>t<60?`${t} 秒`:t<3600?`${Math.ceil(t/60)} 分钟`:`${(t/3600).toFixed(1)} 小时`,ze=t=>t.cooldown_seconds>0?"text-amber-700":t.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",ct=t=>{const e=ve(t);return e==="手动禁用"||e==="已过期"?"bg-muted/70":""},Ee=t=>{const e=new Set(b.value);e.has(t)?e.delete(t):e.add(t),b.value=e},ft=()=>{if(Oe.value){b.value=new Set;return}b.value=new Set(H.value.map(t=>t.id))},Pt=(t,e)=>t.id||`account_${e+1}`,vt=async()=>(await w.getConfig()).accounts.map((e,o)=>({...e,id:Pt(e,o)})),mt=t=>`${t.time} [${t.level}] ${t.message}`,Ft=(t,e)=>{let o=-1;for(let u=0;u<t.length;u+=1)if(t[u].id===e){o=u;break}if(o===-1)return $.value="未找到对应账号配置。",!1;const r=t[o];return h.value={id:r.id,secure_c_ses:r.secure_c_ses,csesidx:r.csesidx,config_id:r.config_id,host_c_oses:r.host_c_oses,expires_at:r.expires_at},Ze.value=t,ke.value=o,x.value=!0,!0},pt=async t=>{$.value="";try{const e=await vt();Ft(e,t)}catch(e){$.value=e.message||"加载账号配置失败"}},Kt=async()=>{D.value="";try{const t=await w.getConfig();ie.value=Array.isArray(t.accounts)?t.accounts:[],se.value=JSON.stringify(gt(ie.value),null,2),N.value=!0,Me.value=!0}catch(t){D.value=t.message||"加载账号配置失败"}},Pe=()=>{Me.value=!1,D.value="",N.value=!1},xt=()=>{const t=JSON.parse(se.value);if(!Array.isArray(t))throw new Error("配置格式必须是数组。");return t},Ht=t=>typeof t!="string"||!t?t:t.length<=6?`${t.slice(0,2)}****`:`${t.slice(0,3)}****`,gt=t=>{const e=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password","mail_refresh_token","mail_client_id"]);return t.map(o=>{const r={...o};return e.forEach(u=>{const m=r[u];m&&(r[u]=Ht(m))}),r})},Jt=()=>{if(D.value="",!N.value){try{ie.value=xt()}catch(t){D.value=t.message||"JSON 格式错误";return}se.value=JSON.stringify(gt(ie.value),null,2),N.value=!0;return}se.value=JSON.stringify(ie.value,null,2),N.value=!1},Gt=async()=>{D.value="";try{const t=xt();await k.updateConfig(t),d.success("配置保存成功"),Pe()}catch(t){D.value=t.message||"保存失败",d.error(t.message||"保存失败")}},Fe=()=>{x.value=!1,$.value=""},Yt=async()=>{if(ke.value===null)return;const t=[...Ze.value];t[ke.value]={...t[ke.value],id:h.value.id,secure_c_ses:h.value.secure_c_ses,csesidx:h.value.csesidx,config_id:h.value.config_id,host_c_oses:h.value.host_c_oses||void 0,expires_at:h.value.expires_at||void 0};try{await k.updateConfig(t),d.success("账号编辑成功"),Fe()}catch(e){$.value=e.message||"保存失败",d.error(e.message||"保存失败")}},qt=async()=>{try{await k.bulkEnable(Array.from(b.value)),d.success("批量启用成功"),b.value=new Set}catch(t){d.error(t.message||"批量启用失败")}},Qt=async()=>{if(await T.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"}))try{await k.bulkDisable(Array.from(b.value)),d.success("批量禁用成功"),b.value=new Set}catch(e){d.error(e.message||"批量禁用失败")}},Xt=async()=>{if(await T.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"}))try{await k.bulkDelete(Array.from(b.value)),d.success("批量删除成功"),b.value=new Set}catch(e){d.error(e.message||"批量删除失败")}},bt=async t=>{try{await k.enableAccount(t),d.success("账号已启用")}catch(e){d.error(e.message||"启用失败")}},yt=async t=>{if(await T.ask({title:"禁用账号",message:"确定要禁用该账号吗?"}))try{await k.disableAccount(t),d.success("账号已禁用")}catch(o){d.error(o.message||"禁用失败")}},_t=async t=>{if(await T.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"}))try{await k.deleteAccount(t),d.success("账号已删除")}catch(o){d.error(o.message||"删除失败")}};let me=null,pe=null,xe=null,Le=!1;const W=()=>{me!==null&&(window.clearInterval(me),me=null)},Z=()=>{pe!==null&&(window.clearInterval(pe),pe=null)},Wt=()=>{xe!==null&&(window.clearInterval(xe),xe=null),Le=!1},ht=t=>t==="pending"?"等待中":t==="running"?"执行中":t==="success"?"成功":t==="failed"?"失败":t,wt=t=>{const e=t.status,o=t.success_count??0,r=t.fail_count??0;if(e==="running"||e==="pending")return"bg-sky-400";if(e==="success"||e==="failed"){if(o>0&&r===0)return"bg-emerald-400";if(r>0&&o===0)return"bg-rose-500";if(o>0&&r>0)return"bg-amber-400"}return"bg-muted-foreground"},kt=async t=>{if($e(t)){W();return}const e=await w.getRegisterTask(t);if($e(e.id)){W();return}if(Be(e),e.status!=="running"&&e.status!=="pending"){O.value=!1,W(),await fe();const o=e.success_count||0,r=e.fail_count||0;o>0&&r>0?d.success(`注册任务完成:成功 ${o},失败 ${r}`):o>0&&r===0?d.success(`注册任务完成:全部成功 (${o})`):r>0&&o===0?d.error(`注册任务完成:全部失败 (${r})`):d.error("注册任务失败")}},Ct=async t=>{if(Ie(t)){Z();return}const e=await w.getLoginTask(t);if(Ie(e.id)){Z();return}if(Se(e),e.status!=="running"&&e.status!=="pending"){S.value=!1,Z(),await fe();const o=e.success_count||0,r=e.fail_count||0;o>0&&r>0?d.success(`刷新任务完成:成功 ${o},失败 ${r}`):o>0&&r===0?d.success(`刷新任务完成:全部成功 (${o})`):r>0&&o===0?d.error(`刷新任务完成:全部失败 (${r})`):d.error("刷新任务失败")}},Tt=t=>{W(),me=window.setInterval(()=>{kt(t).catch(e=>{_.value=e?.message||"注册任务更新失败",W(),O.value=!1})},3e3)},Ke=t=>{Z(),pe=window.setInterval(()=>{Ct(t).catch(e=>{_.value=e?.message||"刷新任务更新失败",Z(),S.value=!1})},3e3)},Zt=()=>{xe===null&&(xe=window.setInterval(async()=>{if(!Le&&!q.value&&!(me!==null||pe!==null)&&!(!O.value&&!S.value&&!c.value&&!f.value)){Le=!0;try{await He()}catch(t){_.value=t?.message||"后台刷新失败"}finally{Le=!1}}},6e3))},He=async()=>{try{const t=await w.getRegisterCurrent();t&&"id"in t&&!$e(t.id)&&(Be(t),(t.status==="running"||t.status==="pending")&&(O.value=!0,Tt(t.id)))}catch(t){_.value=t.message||"加载注册任务失败"}try{const t=await w.getLoginCurrent();t&&"id"in t&&!Ie(t.id)&&(Se(t),(t.status==="running"||t.status==="pending")&&(S.value=!0,Ke(t.id)))}catch(t){_.value=t.message||"加载刷新任务失败"}},es=async()=>{_.value="",O.value=!0;try{const t=Number.isFinite(de.value)&&de.value>0?de.value:void 0,e=await w.startRegister(t);Be(e),Tt(e.id),ye.value=!1,q.value=!0}catch(t){_.value=t.message||"启动注册失败",O.value=!1}},St=async()=>{if(b.value.size){_.value="",S.value=!0;try{const t=await w.startLogin(Array.from(b.value));Se(t),Ke(t.id),Ue()}catch(t){_.value=t.message||"启动刷新失败",S.value=!1}}},ts=async()=>{_.value="",S.value=!0;try{await w.checkLogin();const t=await w.getLoginCurrent();if(t&&"id"in t){Se(t),Ke(t.id),Ue();return}S.value=!1}catch(t){_.value=t.message||"触发刷新失败",S.value=!1}};return(t,e)=>(l(),n(ge,null,[s("div",xs,[s("section",gs,[s("div",bs,[s("div",ys,[R(s("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>ae.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[V,ae.value]]),G(cs,{modelValue:te.value,"onUpdate:modelValue":e[1]||(e[1]=o=>te.value=o),options:Et},null,8,["modelValue"])]),s("div",_s,[G(be,{modelValue:Oe.value,"onUpdate:modelValue":ft},{default:$t(()=>[...e[27]||(e[27]=[ee(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+a(B.value)+" / "+a(H.value.length)+" 个账号",1),s("div",hs,[s("button",{type:"button",class:p(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",Y.value==="table"?"bg-accent text-accent-foreground":""]),onClick:e[2]||(e[2]=o=>Y.value="table"),"aria-label":"列表视图"},[...e[28]||(e[28]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:p(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",Y.value==="card"?"bg-accent text-accent-foreground":""]),onClick:e[3]||(e[3]=o=>Y.value="card"),"aria-label":"卡片视图"},[...e[29]||(e[29]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",ws,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:j(ne),onClick:fe}," 刷新列表 ",8,ks),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:Kt}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:O.value,onClick:At}," 添加账户 ",8,Cs),s("div",{ref_key:"moreActionsRef",ref:De,class:"relative"},[s("button",{class:p(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",P.value?"bg-accent text-accent-foreground":""]),onClick:Ot},[e[30]||(e[30]=ee(" 更多操作 ",-1)),e[31]||(e[31]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),Bt.value?(l(),n("span",{key:0,class:p(["ml-1 h-2 w-2 rounded-full",zt.value]),"aria-hidden":"true"},null,2)):g("",!0)],2),P.value?(l(),n("div",Ts,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:e[4]||(e[4]=o=>{Ue(),le()})}," 任务状态 "),e[32]||(e[32]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",S.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:S.value,onClick:e[5]||(e[5]=o=>{ts(),le()})}," 刷新过期 ",10,Ss),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!B.value||S.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!B.value||S.value,onClick:e[6]||(e[6]=o=>{St(),le()})}," 刷新选中 ",10,$s),e[33]||(e[33]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[7]||(e[7]=o=>{qt(),le()})}," 批量启用 ",10,Is),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[8]||(e[8]=o=>{Qt(),le()})}," 批量禁用 ",10,Es),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[9]||(e[9]=o=>{Xt(),le()})}," 批量删除 ",10,Ls)])):g("",!0)],512)]),Y.value==="card"?(l(),n("div",As,[(l(!0),n(ge,null,Ve(H.value,o=>(l(),n("div",{key:o.id,class:p(["rounded-2xl border border-border bg-card p-4",ct(o)]),onClick:r=>Ee(o.id)},[s("div",Vs,[s("div",null,[e[34]||(e[34]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",js,a(o.id),1)]),s("div",Ms,[G(be,{modelValue:b.value.has(o.id),"onUpdate:modelValue":r=>Ee(o.id),onClick:e[10]||(e[10]=M(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:p(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",nt(o)])},a(ve(o)),3)])]),s("div",Ds,[s("div",null,[e[35]||(e[35]=s("p",null,"剩余时间",-1)),s("p",{class:p(["mt-1 text-sm font-semibold",dt(o)])},a(it(o.remaining_display)),3),o.expires_at?(l(),n("p",Os,a(o.expires_at),1)):g("",!0)]),s("div",null,[e[36]||(e[36]=s("p",null,"冷却",-1)),s("p",{class:p(["mt-1",ze(o)])},[o.cooldown_seconds>0?(l(),n("span",Bs,a(ut(o.cooldown_seconds))+" · "+a(o.cooldown_reason),1)):(l(),n("span",Ns,a(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[e[37]||(e[37]=s("p",null,"失败数",-1)),s("p",Us,a(o.error_count),1)]),s("div",null,[e[38]||(e[38]=s("p",null,"会话数",-1)),s("p",zs,a(o.conversation_count),1)])]),s("div",Ps,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>pt(o.id),["stop"])}," 编辑 ",8,Fs),at(o)?(l(),n("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[11]||(e[11]=M(()=>{},["stop"])),r=>bt(o.id)]}," 启用 ",8,Ks)):(l(),n("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[12]||(e[12]=M(()=>{},["stop"])),r=>yt(o.id)]}," 禁用 ",8,Hs)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[e[13]||(e[13]=M(()=>{},["stop"])),r=>_t(o.id)]}," 删除 ",8,Js)])],10,Rs))),128)),!H.value.length&&!j(ne)?(l(),n("div",Gs," 暂无账号数据,请检查后台配置。 ")):g("",!0)])):(l(),n("div",Ys,[s("table",qs,[s("thead",Qs,[s("tr",null,[s("th",Xs,[G(be,{modelValue:Oe.value,"onUpdate:modelValue":ft},null,8,["modelValue"])]),e[40]||(e[40]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),e[41]||(e[41]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",Ws,[s("span",Zs,[e[39]||(e[39]=ee(" 剩余/过期 ",-1)),G(ms,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),e[42]||(e[42]=s("th",{class:"py-3 pr-6"},"冷却",-1)),e[43]||(e[43]=s("th",{class:"py-3 pr-6"},"失败数",-1)),e[44]||(e[44]=s("th",{class:"py-3 pr-6"},"会话数",-1)),e[45]||(e[45]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",eo,[!H.value.length&&!j(ne)?(l(),n("tr",to,[...e[46]||(e[46]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):g("",!0),(l(!0),n(ge,null,Ve(H.value,o=>(l(),n("tr",{key:o.id,class:p(["border-t border-border",ct(o)]),onClick:r=>Ee(o.id)},[s("td",{class:"py-4 pr-4",onClick:e[14]||(e[14]=M(()=>{},["stop"]))},[G(be,{modelValue:b.value.has(o.id),"onUpdate:modelValue":r=>Ee(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",oo,a(o.id),1),s("td",ro,[s("span",{class:p(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",nt(o)])},a(ve(o)),3)]),s("td",lo,[s("div",{class:p(["text-sm font-semibold",dt(o)])},a(it(o.remaining_display)),3),o.expires_at?(l(),n("span",no,a(o.expires_at),1)):g("",!0)]),s("td",ao,[o.cooldown_seconds>0?(l(),n("span",{key:0,class:p(ze(o))},a(ut(o.cooldown_seconds))+" · "+a(o.cooldown_reason),3)):(l(),n("span",{key:1,class:p(ze(o))},a(o.cooldown_reason||"无冷却"),3))]),s("td",io,a(o.error_count),1),s("td",uo,a(o.conversation_count),1),s("td",co,[s("div",fo,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>pt(o.id),["stop"])}," 编辑 ",8,vo),at(o)?(l(),n("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>bt(o.id),["stop"])}," 启用 ",8,mo)):(l(),n("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>yt(o.id),["stop"])}," 禁用 ",8,po)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:M(r=>_t(o.id),["stop"])}," 删除 ",8,xo)])])],10,so))),128))])])]))])]),G(fs,{open:j(T).open.value,title:j(T).title.value,message:j(T).message.value,"confirm-text":j(T).confirmText.value,"cancel-text":j(T).cancelText.value,onConfirm:j(T).confirm,onCancel:j(T).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(l(),Re(je,{to:"body"},[ye.value?(l(),n("div",go,[s("div",bo,[s("div",yo,[s("div",null,[e[47]||(e[47]=s("p",{class:"text-sm font-medium text-foreground"},"添加账户",-1)),s("p",_o,a(U.value==="register"?"创建 DuckMail 账号并自动注册":"批量导入账户配置"),1)]),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Ne}," 关闭 ")]),s("div",ho,[s("div",wo,[s("div",ko,[s("button",{type:"button",class:p(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",U.value==="register"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:e[15]||(e[15]=o=>U.value="register")}," 自动注册 ",2),s("button",{type:"button",class:p(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",U.value==="import"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:e[16]||(e[16]=o=>U.value="import")}," 批量导入 ",2)]),U.value==="register"?(l(),n("div",Co,[e[48]||(e[48]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),R(s("input",{"onUpdate:modelValue":e[17]||(e[17]=o=>de.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,de.value,void 0,{number:!0}]]),e[49]||(e[49]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"默认域名(可在配置面板修改,推荐使用)"),s("p",{class:"mt-1"},"注册失败建议关闭无头浏览器再试")],-1))])):(l(),n("div",To,[e[50]||(e[50]=s("label",{class:"block text-xs text-muted-foreground"},"批量导入(每行一个)",-1)),R(s("textarea",{"onUpdate:modelValue":e[18]||(e[18]=o=>ue.value=o),class:"min-h-[140px] w-full rounded-2xl border border-input bg-background px-3 py-2 text-xs font-mono",placeholder:`duckmail----you@example.com----password
2
+ user@outlook.com----loginPassword----clientId----refreshToken`},null,512),[[V,ue.value]]),e[51]||(e[51]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"支持两种格式:"),s("p",{class:"mt-1 font-mono"},"duckmail----email----password"),s("p",{class:"mt-1 font-mono"},"email----password----clientId----refreshToken"),s("p",{class:"mt-2"},'导入后请执行一次"刷新选中"以获取 Cookie。'),s("p",{class:"mt-1"},"注册失败建议关闭无头浏览器再试")],-1)),z.value?(l(),n("div",So,a(z.value),1)):g("",!0)])),e[53]||(e[53]=s("div",{class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-[11px] leading-relaxed"},[s("p",{class:"text-xs font-bold text-rose-600"},"⚠️ 严禁滥用:禁止将本工具用于商业用途或任何形式的滥用(无论规模大小)"),s("p",{class:"mt-1 text-muted-foreground"},[ee("详细声明请查看项目 "),s("a",{href:"https://github.com/Dreamy-rain/gemini-business2api/blob/main/docs/DISCLAIMER.md",target:"_blank",class:"text-primary hover:underline font-medium"},"DISCLAIMER.md")])],-1)),G(be,{modelValue:ce.value,"onUpdate:modelValue":e[19]||(e[19]=o=>ce.value=o)},{default:$t(()=>[...e[52]||(e[52]=[ee(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])])]),s("div",$o,[s("div",Io,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ne}," 取消 "),U.value==="register"?(l(),n("button",{key:0,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",disabled:O.value||!ce.value,onClick:es}," 开始注册 ",8,Eo)):(l(),n("button",{key:1,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",disabled:_e.value||!ce.value,onClick:Vt}," 导入并保存 ",8,Lo))])])])])):g("",!0)])),(l(),Re(je,{to:"body"},[q.value?(l(),n("div",Ao,[s("div",Ro,[s("div",Vo,[e[54]||(e[54]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",jo,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:!Q.value.length&&!X.value.length&&!c.value&&!f.value&&!_.value,onClick:Dt}," 清空日志 ",8,Mo),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Mt}," 关闭 ")])]),s("div",Do,[_.value?(l(),n("div",Oo,a(_.value),1)):g("",!0),c.value||f.value?(l(),n("div",Bo,[c.value?(l(),n("div",No,[s("div",Uo,[s("span",{class:p(["h-2.5 w-2.5 rounded-full",wt(c.value)]),"aria-hidden":"true"},null,2),e[55]||(e[55]=ee(" 注册任务 ",-1))]),s("div",zo,[s("span",null,"状态:"+a(ht(c.value.status)),1),s("span",null,"进度:"+a(c.value.progress)+"/"+a(c.value.count),1),s("span",null,"成功:"+a(c.value.success_count),1),s("span",null,"失败:"+a(c.value.fail_count),1)])])):g("",!0),f.value?(l(),n("div",Po,[s("div",Fo,[s("span",{class:p(["h-2.5 w-2.5 rounded-full",wt(f.value)]),"aria-hidden":"true"},null,2),e[56]||(e[56]=ee(" 刷新任务 ",-1))]),s("div",Ko,[s("span",null,"状态:"+a(ht(f.value.status)),1),s("span",null,"进度:"+a(f.value.progress)+"/"+a(f.value.account_ids.length),1),s("span",null,"成功:"+a(f.value.success_count),1),s("span",null,"失败:"+a(f.value.fail_count),1)])])):g("",!0)])):g("",!0),Q.value.length||X.value.length?(l(),n("div",Ho,[s("div",{ref_key:"taskLogsRef",ref:We,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[Q.value.length?(l(),n("div",Jo,[e[57]||(e[57]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",Go,[(l(!0),n(ge,null,Ve(Q.value,(o,r)=>(l(),n("div",{key:`reg-${r}`,class:"font-mono"},a(mt(o)),1))),128))])])):g("",!0),X.value.length?(l(),n("div",Yo,[e[58]||(e[58]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",qo,[(l(!0),n(ge,null,Ve(X.value,(o,r)=>(l(),n("div",{key:`login-${r}`,class:"font-mono"},a(mt(o)),1))),128))])])):g("",!0)],512)])):g("",!0),!_.value&&!c.value&&!f.value&&!Q.value.length&&!X.value.length?(l(),n("div",Qo," 暂无任务 ")):g("",!0)])])])):g("",!0)])),(l(),Re(je,{to:"body"},[x.value?(l(),n("div",Xo,[s("div",Wo,[s("div",{class:"flex items-center justify-between"},[e[59]||(e[59]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Fe}," 关闭 ")]),$.value?(l(),n("div",Zo,a($.value),1)):g("",!0),s("div",er,[e[60]||(e[60]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),R(s("input",{"onUpdate:modelValue":e[20]||(e[20]=o=>h.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[V,h.value.id]]),e[61]||(e[61]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),R(s("textarea",{"onUpdate:modelValue":e[21]||(e[21]=o=>h.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[V,h.value.secure_c_ses]]),e[62]||(e[62]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),R(s("input",{"onUpdate:modelValue":e[22]||(e[22]=o=>h.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.csesidx]]),e[63]||(e[63]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),R(s("input",{"onUpdate:modelValue":e[23]||(e[23]=o=>h.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.config_id]]),e[64]||(e[64]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),R(s("input",{"onUpdate:modelValue":e[24]||(e[24]=o=>h.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.host_c_oses]]),e[65]||(e[65]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),R(s("input",{"onUpdate:modelValue":e[25]||(e[25]=o=>h.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[V,h.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Fe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Yt}," 保存 ")])])])):g("",!0)])),(l(),Re(je,{to:"body"},[Me.value?(l(),n("div",tr,[s("div",sr,[s("div",or,[e[66]||(e[66]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",rr,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Jt},a(N.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Pe}," 关闭 ")])]),D.value?(l(),n("div",lr,a(D.value),1)):g("",!0),s("div",nr,[R(s("textarea",{"onUpdate:modelValue":e[26]||(e[26]=o=>se.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:N.value},null,8,ar),[[V,se.value]])]),s("div",ir,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",onClick:Gt,disabled:N.value}," 保存 ",8,dr)])])])):g("",!0)]))],64))}});export{xr as default};
static/assets/Accounts-J1ZNWiem.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ import{g as S,C as ts,h as a,d as ss,D as os,i as F,o as rs,s as ls,j as ns,c as l,a as s,x as K,y as Ie,m as E,v as I,A as ht,t as n,n as m,u as L,b as x,f as G,F as pe,r as Le,T as $e,w as $,e as r,E as as}from"./index-DhxxzIOh.js";import{_ as is}from"./SelectMenu.vue_vue_type_script_setup_true_lang-Vv-llkmB.js";import{_ as xe}from"./Checkbox.vue_vue_type_script_setup_true_lang-Cui3ZVy3.js";import{_ as ds}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-C_ZbANx_.js";import{u as us}from"./useConfirmDialog-ChXSHLDJ.js";import{_ as cs}from"./HelpTip.vue_vue_type_script_setup_true_lang-Dj0Fsuty.js";const w={list:()=>S.get("/admin/accounts"),getConfig:()=>S.get("/admin/accounts-config"),updateConfig:g=>S.put("/admin/accounts-config",g),delete:g=>S.delete(`/admin/accounts/${g}`),disable:g=>S.put(`/admin/accounts/${g}/disable`),enable:g=>S.put(`/admin/accounts/${g}/enable`),startRegister:(g,h)=>S.post("/admin/register/start",{count:g,domain:h}),getRegisterTask:g=>S.get(`/admin/register/task/${g}`),getRegisterCurrent:()=>S.get("/admin/register/current"),startLogin:g=>S.post("/admin/login/start",g),getLoginTask:g=>S.get(`/admin/login/task/${g}`),getLoginCurrent:()=>S.get("/admin/login/current"),checkLogin:()=>S.post("/admin/login/check")},fs=ts("accounts",()=>{const g=a([]),h=a(!1);async function A(){h.value=!0;try{const f=await w.list();g.value=Array.isArray(f)?f:f.accounts||[]}finally{h.value=!1}}async function oe(f){await w.delete(f),await A()}async function T(f){await w.disable(f),await A()}async function re(f){await w.enable(f),await A()}async function X(f){await Promise.all(f.map(R=>w.enable(R))),await A()}async function b(f){await Promise.all(f.map(R=>w.disable(R))),await A()}async function H(f){await Promise.all(f.map(R=>w.delete(R))),await A()}async function le(f){await w.updateConfig(f),await A()}return{accounts:g,isLoading:h,loadAccounts:A,deleteAccount:oe,disableAccount:T,enableAccount:re,bulkEnable:X,bulkDisable:b,bulkDelete:H,updateConfig:le}}),vs={class:"space-y-8"},ps={class:"rounded-3xl border border-border bg-card p-6"},xs={class:"flex flex-wrap items-center justify-between gap-4"},ms={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},gs={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},bs={class:"ml-auto flex items-center gap-2 sm:ml-0"},ys={class:"mt-4 flex flex-wrap items-center gap-2"},_s=["disabled"],ws=["disabled"],hs={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},ks=["disabled"],Cs=["disabled"],Ts=["disabled"],Ss=["disabled"],As=["disabled"],Es={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},Is=["onClick"],Ls={class:"flex items-start justify-between gap-3"},$s={class:"mt-1 font-mono text-xs text-foreground"},Rs={class:"flex items-center gap-2"},Vs={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},Ms={key:0,class:"mt-1 text-[11px]"},js={key:0},Ds={key:1},Os={class:"mt-1 text-sm font-semibold text-foreground"},Bs={class:"mt-1 text-sm font-semibold text-foreground"},Ns={class:"mt-4 flex flex-wrap items-center gap-2"},Us=["onClick"],zs=["onClick"],Ps=["onClick"],Fs=["onClick"],Ks={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Gs={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},Hs={class:"min-w-full text-left text-sm"},Js={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Ys={class:"py-3 pr-4"},Qs={class:"py-3 pr-6"},qs={class:"inline-flex items-center gap-2"},Ws={class:"text-sm text-foreground"},Xs={key:0},Zs=["onClick"],eo={class:"py-4 pr-6 font-mono text-xs text-foreground"},to={class:"py-4 pr-6"},so={class:"py-4 pr-6"},oo={key:0,class:"block text-[11px] text-muted-foreground"},ro={class:"py-4 pr-6 text-xs"},lo={class:"py-4 pr-6 text-xs text-muted-foreground"},no={class:"py-4 pr-6 text-xs text-muted-foreground"},ao={class:"py-4 text-right"},io={class:"flex flex-wrap justify-end gap-2"},uo=["onClick"],co=["onClick"],fo=["onClick"],vo=["onClick"],po={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},xo={class:"flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},mo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},go={class:"mt-1 text-xs text-muted-foreground"},bo={class:"scrollbar-slim flex-1 overflow-y-auto px-6 py-4"},yo={class:"space-y-4 text-sm"},_o={class:"flex rounded-full border border-border bg-muted/30 p-1 text-xs"},wo={key:0,class:"space-y-4"},ho={key:1,class:"space-y-4"},ko={key:0,class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-600"},Co={class:"border-t border-border/60 px-6 py-4"},To={class:"flex items-center justify-end gap-2"},So=["disabled"],Ao=["disabled"],Eo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Io={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},Lo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},$o={class:"flex items-center gap-2"},Ro=["disabled"],Vo={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},Mo={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},jo={key:1,class:"grid gap-3 text-xs text-muted-foreground"},Do={key:0,class:"space-y-1"},Oo={class:"flex flex-wrap gap-x-4 gap-y-1"},Bo={key:1,class:"space-y-1"},No={class:"flex flex-wrap gap-x-4 gap-y-1"},Uo={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},zo={key:0,class:"space-y-2"},Po={class:"space-y-1 text-[11px] text-muted-foreground"},Fo={key:1,class:"mt-4 space-y-2"},Ko={class:"space-y-1 text-[11px] text-muted-foreground"},Go={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},Ho={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Jo={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Yo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},Qo={class:"mt-4 space-y-3 text-sm"},qo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Wo={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},Xo={class:"flex items-center justify-between"},Zo={class:"flex items-center gap-2"},er={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},tr={class:"mt-4"},sr=["readonly"],or={class:"mt-6 flex items-center justify-end gap-2"},rr=["disabled"],Fe="accounts-register-task-cache",Ke="accounts-login-task-cache",Ge="accounts-register-log-clear",He="accounts-login-log-clear",Je="accounts-register-task-cleared-id",Ye="accounts-login-task-cleared-id",kt="1970-01-01 00:00:00",cr=ss({__name:"Accounts",setup(g){const h=fs(),{accounts:A,isLoading:oe}=os(h),T=us(),re=a(""),X=a("all"),b=a(new Set),H=a("table"),le=a(!1),f=a(""),R=a(!1),V=a(""),Z=a(""),D=a(!1),ne=a([]),ae=a(1),me=a(!1),O=a("register"),ie=a(""),B=a(""),ge=a(!1),J=a(!1),N=a(!1),Re=a(null),be=a(null),ye=a(null),U=a(null),z=a(null),ee=a(0),te=a(0),de=a(!1),v=a(null),p=a(null),Qe=a(null),M=a(!1),C=a(!1),y=a(""),_=a({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),_e=a(null),qe=a([]),Ct=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],P=F(()=>{const e=re.value.trim().toLowerCase();return A.value.filter(t=>{const o=!e||t.id.toLowerCase().includes(e),i=X.value==="all"||ue(t)===X.value;return o&&i})}),j=F(()=>b.value.size),Ve=F(()=>P.value.length>0&&P.value.every(e=>b.value.has(e.id))),we=async()=>{await h.loadAccounts(),b.value=new Set,N.value=!1},We=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},Xe=e=>{try{return localStorage.getItem(e)||null}catch{return null}},he=(e,t)=>{try{if(t){localStorage.setItem(e,t);return}localStorage.removeItem(e)}catch{}},Ze=(e,t)=>{try{localStorage.setItem(e,JSON.stringify(t))}catch{}},et=e=>{try{localStorage.removeItem(e)}catch{}},tt=e=>{const t=localStorage.getItem(e),o=Number(t);return Number.isFinite(o)?o:0},ke=(e,t)=>{try{localStorage.setItem(e,String(t))}catch{}},Me=(e,t=!0)=>{e&&(e.id&&e.id===U.value||(e.id&&U.value&&e.id!==U.value&&(U.value=null,he(Je,null)),v.value=e,e.id&&e.id!==be.value&&(be.value=e.id,ee.value=0,ke(Ge,0)),t&&Ze(Fe,e)))},Ce=(e,t=!0)=>{e&&(e.id&&e.id===z.value||(e.id&&z.value&&e.id!==z.value&&(z.value=null,he(Ye,null)),p.value=e,e.id&&e.id!==ye.value&&(ye.value=e.id,te.value=0,ke(He,0)),t&&Ze(Ke,e)))},Tt=()=>{ee.value=tt(Ge),te.value=tt(He),U.value=Xe(Je),z.value=Xe(Ye);const e=We(Fe);e&&e.id!==U.value&&(v.value=e,be.value=e.id||null);const t=We(Ke);t&&t.id!==z.value&&(p.value=t,ye.value=t.id||null)},St=()=>{me.value=!0,O.value="register",ie.value="",B.value="",ge.value=!1,de.value=!1},je=()=>{me.value=!1},At=e=>{const t=[],o=[];return e.split(/\r?\n/).map(c=>c.trim()).filter(Boolean).forEach((c,d)=>{const u=c.split("----").map(k=>k.trim()),ze=d+1;if(u.length){if(u[0].toLowerCase()==="duckmail"){if(u.length<3||!u[1]||!u[2]){o.push(`第 ${ze} 行格式错误(duckmail)`);return}const k=u[1],Pe=u.slice(2).join("----");t.push({id:k,secure_c_ses:"",csesidx:"",config_id:"",expires_at:kt,mail_provider:"duckmail",mail_address:k,mail_password:Pe});return}if(u.length>=4&&u[0]&&u[2]&&u[3]){const k=u[0],Pe=u[1]||"",Zt=u[2],es=u.slice(3).join("----");t.push({id:k,secure_c_ses:"",csesidx:"",config_id:"",expires_at:kt,mail_provider:"microsoft",mail_address:k,mail_password:Pe,mail_client_id:Zt,mail_refresh_token:es,mail_tenant:"consumers"});return}o.push(`第 ${ze} 行格式错误`)}}),{items:t,errors:o}},Et=async()=>{if(B.value="",!ie.value.trim()){B.value="请输入导入内容";return}const{items:e,errors:t}=At(ie.value);if(!e.length){B.value=t.length?t.join(","):"未识别到有效账号";return}if(t.length){B.value=t.slice(0,3).join(",");return}ge.value=!0;try{const i=[...await ut()],c=new Map(i.map((d,u)=>[d.id,u]));e.forEach(d=>{const u=c.get(d.id||"");if(u===void 0){i.push(d);return}const k={...i[u],mail_provider:d.mail_provider,mail_address:d.mail_address};d.mail_provider==="microsoft"?(k.mail_client_id=d.mail_client_id,k.mail_refresh_token=d.mail_refresh_token,k.mail_tenant=d.mail_tenant,k.mail_password=void 0):(k.mail_password=d.mail_password,k.mail_client_id=void 0,k.mail_refresh_token=void 0,k.mail_tenant=void 0),i[u]=k}),await h.updateConfig(i),je()}catch(o){B.value=o.message||"导入失败"}finally{ge.value=!1}},It=async()=>{try{const e=[],t=v.value?.id,o=p.value?.id;if(t&&!Te(t)&&e.push(yt(t)),o&&!Se(o)&&e.push(_t(o)),!e.length){await Ue();return}await Promise.all(e)}catch(e){y.value=e?.message||"任务状态更新失败"}},Lt=async()=>{J.value=!0,await It()},$t=()=>{J.value=!1},Rt=()=>{const e=v.value?.id||null,t=p.value?.id||null;U.value=e,z.value=t,he(Je,e),he(Ye,t),ee.value=v.value?.logs?.length||0,te.value=p.value?.logs?.length||0,ke(Ge,ee.value),ke(He,te.value),v.value=null,p.value=null,be.value=null,ye.value=null,y.value="",M.value=!1,C.value=!1,q(),W(),et(Fe),et(Ke)},Te=e=>!!(e&&e===U.value),Se=e=>!!(e&&e===z.value),Vt=()=>{N.value=!N.value},se=()=>{N.value=!1},st=e=>{if(!N.value)return;const t=e.target;Re.value&&!Re.value.contains(t)&&(N.value=!1)};rs(async()=>{Tt(),await we(),await Ue(),Qt(),document.addEventListener("click",st)});const Y=F(()=>{const e=v.value?.logs||[];return ee.value?e.slice(ee.value):e}),Q=F(()=>{const e=p.value?.logs||[];return te.value?e.slice(te.value):e}),Mt=F(()=>!!y.value||!!v.value||!!p.value||Y.value.length>0||Q.value.length>0),jt=async()=>{await as();const e=Qe.value;e&&(e.scrollTop=e.scrollHeight)};ls([Y,Q,J],async()=>{J.value&&await jt()},{deep:!0});const Dt=F(()=>{const e=v.value?.status,t=p.value?.status;return e==="running"||e==="pending"||t==="running"||t==="pending"}),Ot=F(()=>{if(y.value)return"bg-rose-500";if(Dt.value)return"bg-sky-400";const e=[];if(v.value){const c=v.value.success_count??0,d=v.value.fail_count??0,u=v.value.count??c+d;e.push({success:c,fail:d,total:u,status:v.value.status})}if(p.value){const c=p.value.success_count??0,d=p.value.fail_count??0,u=p.value.account_ids?.length??c+d;e.push({success:c,fail:d,total:u,status:p.value.status})}if(!e.length)return"bg-muted-foreground";const t=e.reduce((c,d)=>c+d.success,0),o=e.reduce((c,d)=>c+d.fail,0),i=e.reduce((c,d)=>c+(d.total||0),0);if(t>0&&o>0)return"bg-amber-400";if(o>0&&t===0)return"bg-rose-500";if(t>0&&o===0)return"bg-emerald-400";if(i===0){const c=e.every(u=>u.status==="success");if(e.some(u=>u.status==="failed"))return"bg-rose-500";if(c)return"bg-emerald-400"}return"bg-muted-foreground"});ns(()=>{q(),W(),Yt(),document.removeEventListener("click",st)});const ue=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?"429限流":e.cooldown_reason==="错误禁用"?"错误禁用":e.disabled?"手动禁用":e.status==="已过期"?"已过期":e.status==="即将过期"?"即将过期":"正常",ot=e=>{const t=ue(e);return t==="429限流"||t==="即将过期"?"bg-amber-200 text-amber-900":t==="错误禁用"||t==="已过期"?"bg-destructive/10 text-destructive":t==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},rt=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?!0:e.disabled||e.cooldown_reason==="错误禁用",lt=e=>e==="已过期"?"过期":e==="未设置"?"未设置":e,nt=e=>e.status==="已过期"?"text-rose-600":e.status==="即将过期"?"text-amber-700":e.status==="未设置"?"text-muted-foreground":"text-emerald-600",at=e=>e<60?`${e} 秒`:e<3600?`${Math.ceil(e/60)} 分钟`:`${(e/3600).toFixed(1)} 小时`,De=e=>e.cooldown_seconds>0?"text-amber-700":e.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",it=e=>{const t=ue(e);return t==="手动禁用"||t==="已过期"?"bg-muted/70":""},Ae=e=>{const t=new Set(b.value);t.has(e)?t.delete(e):t.add(e),b.value=t},dt=()=>{if(Ve.value){b.value=new Set;return}b.value=new Set(P.value.map(e=>e.id))},Bt=(e,t)=>e.id||`account_${t+1}`,ut=async()=>(await w.getConfig()).accounts.map((t,o)=>({...t,id:Bt(t,o)})),ct=e=>`${e.time} [${e.level}] ${e.message}`,Nt=(e,t)=>{let o=-1;for(let c=0;c<e.length;c+=1)if(e[c].id===t){o=c;break}if(o===-1)return f.value="未找到对应账号配置。",!1;const i=e[o];return _.value={id:i.id,secure_c_ses:i.secure_c_ses,csesidx:i.csesidx,config_id:i.config_id,host_c_oses:i.host_c_oses,expires_at:i.expires_at},qe.value=e,_e.value=o,le.value=!0,!0},ft=async e=>{f.value="";try{const t=await ut();Nt(t,e)}catch(t){f.value=t.message||"加载账号配置失败"}},Ut=async()=>{V.value="";try{const e=await w.getConfig();ne.value=Array.isArray(e.accounts)?e.accounts:[],Z.value=JSON.stringify(pt(ne.value),null,2),D.value=!0,R.value=!0}catch(e){V.value=e.message||"加载账号配置失败"}},Oe=()=>{R.value=!1,V.value="",D.value=!1},vt=()=>{const e=JSON.parse(Z.value);if(!Array.isArray(e))throw new Error("配置格式必须是数组。");return e},zt=e=>typeof e!="string"||!e?e:e.length<=6?`${e.slice(0,2)}****`:`${e.slice(0,3)}****`,pt=e=>{const t=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password","mail_refresh_token","mail_client_id"]);return e.map(o=>{const i={...o};return t.forEach(c=>{const d=i[c];d&&(i[c]=zt(d))}),i})},Pt=()=>{if(V.value="",!D.value){try{ne.value=vt()}catch(e){V.value=e.message||"JSON 格式错误";return}Z.value=JSON.stringify(pt(ne.value),null,2),D.value=!0;return}Z.value=JSON.stringify(ne.value,null,2),D.value=!1},Ft=async()=>{V.value="";try{const e=vt();await h.updateConfig(e),Oe()}catch(e){V.value=e.message||"保存失败"}},Be=()=>{le.value=!1,f.value=""},Kt=async()=>{if(_e.value===null)return;const e=[...qe.value];e[_e.value]={...e[_e.value],id:_.value.id,secure_c_ses:_.value.secure_c_ses,csesidx:_.value.csesidx,config_id:_.value.config_id,host_c_oses:_.value.host_c_oses||void 0,expires_at:_.value.expires_at||void 0};try{await h.updateConfig(e),Be()}catch(t){f.value=t.message||"保存失败"}},Gt=async()=>{await h.bulkEnable(Array.from(b.value)),b.value=new Set},Ht=async()=>{await T.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"})&&(await h.bulkDisable(Array.from(b.value)),b.value=new Set)},Jt=async()=>{await T.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"})&&(await h.bulkDelete(Array.from(b.value)),b.value=new Set)},xt=async e=>{await h.enableAccount(e)},mt=async e=>{await T.ask({title:"禁用账号",message:"确定要禁用该账号吗?"})&&await h.disableAccount(e)},gt=async e=>{await T.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"})&&await h.deleteAccount(e)};let ce=null,fe=null,ve=null,Ee=!1;const q=()=>{ce!==null&&(window.clearInterval(ce),ce=null)},W=()=>{fe!==null&&(window.clearInterval(fe),fe=null)},Yt=()=>{ve!==null&&(window.clearInterval(ve),ve=null),Ee=!1},bt=e=>e==="pending"?"等待中":e==="running"?"执行中":e==="success"?"成功":e==="failed"?"失败":e,yt=async e=>{if(Te(e)){q();return}const t=await w.getRegisterTask(e);if(Te(t.id)){q();return}Me(t),t.status!=="running"&&t.status!=="pending"&&(M.value=!1,q(),await we())},_t=async e=>{if(Se(e)){W();return}const t=await w.getLoginTask(e);if(Se(t.id)){W();return}Ce(t),t.status!=="running"&&t.status!=="pending"&&(C.value=!1,W(),await we())},wt=e=>{q(),ce=window.setInterval(()=>{yt(e).catch(t=>{y.value=t?.message||"注册任务更新失败",q(),M.value=!1})},3e3)},Ne=e=>{W(),fe=window.setInterval(()=>{_t(e).catch(t=>{y.value=t?.message||"刷新任务更新失败",W(),C.value=!1})},3e3)},Qt=()=>{ve===null&&(ve=window.setInterval(async()=>{if(!Ee&&!J.value&&!(ce!==null||fe!==null)&&!(!M.value&&!C.value&&!v.value&&!p.value)){Ee=!0;try{await Ue()}catch(e){y.value=e?.message||"后台刷新失败"}finally{Ee=!1}}},6e3))},Ue=async()=>{try{const e=await w.getRegisterCurrent();e&&"id"in e&&!Te(e.id)&&(Me(e),(e.status==="running"||e.status==="pending")&&(M.value=!0,wt(e.id)))}catch(e){y.value=e.message||"加载注册任务失败"}try{const e=await w.getLoginCurrent();e&&"id"in e&&!Se(e.id)&&(Ce(e),(e.status==="running"||e.status==="pending")&&(C.value=!0,Ne(e.id)))}catch(e){y.value=e.message||"加载刷新任务失败"}},qt=async()=>{y.value="",M.value=!0;try{const e=Number.isFinite(ae.value)&&ae.value>0?ae.value:void 0,t=await w.startRegister(e);Me(t),wt(t.id),me.value=!1,J.value=!0}catch(e){y.value=e.message||"启动注册失败",M.value=!1}},Wt=async()=>{if(b.value.size){y.value="",C.value=!0;try{const e=await w.startLogin(Array.from(b.value));Ce(e),Ne(e.id)}catch(e){y.value=e.message||"启动刷新失败",C.value=!1}}},Xt=async()=>{y.value="",C.value=!0;try{await w.checkLogin();const e=await w.getLoginCurrent();if(e&&"id"in e){Ce(e),Ne(e.id);return}C.value=!1}catch(e){y.value=e.message||"触发刷新失败",C.value=!1}};return(e,t)=>(r(),l(pe,null,[s("div",vs,[s("section",ps,[s("div",xs,[s("div",ms,[E(s("input",{"onUpdate:modelValue":t[0]||(t[0]=o=>re.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[I,re.value]]),K(is,{modelValue:X.value,"onUpdate:modelValue":t[1]||(t[1]=o=>X.value=o),options:Ct},null,8,["modelValue"])]),s("div",gs,[K(xe,{modelValue:Ve.value,"onUpdate:modelValue":dt},{default:ht(()=>[...t[27]||(t[27]=[G(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+n(j.value)+" / "+n(P.value.length)+" 个账号",1),s("div",bs,[s("button",{type:"button",class:m(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",H.value==="table"?"bg-accent text-accent-foreground":""]),onClick:t[2]||(t[2]=o=>H.value="table"),"aria-label":"列表视图"},[...t[28]||(t[28]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:m(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",H.value==="card"?"bg-accent text-accent-foreground":""]),onClick:t[3]||(t[3]=o=>H.value="card"),"aria-label":"卡片视图"},[...t[29]||(t[29]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",ys,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:L(oe),onClick:we}," 刷新列表 ",8,_s),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ut}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:M.value,onClick:St}," 添加账户 ",8,ws),s("div",{ref_key:"moreActionsRef",ref:Re,class:"relative"},[s("button",{class:m(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",N.value?"bg-accent text-accent-foreground":""]),onClick:Vt},[t[30]||(t[30]=G(" 更多操作 ",-1)),t[31]||(t[31]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),Mt.value?(r(),l("span",{key:0,class:m(["ml-1 h-2 w-2 rounded-full",Ot.value]),"aria-hidden":"true"},null,2)):x("",!0)],2),N.value?(r(),l("div",hs,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:t[4]||(t[4]=o=>{Lt(),se()})}," 任务状态 "),t[32]||(t[32]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:m(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",C.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:C.value,onClick:t[5]||(t[5]=o=>{Xt(),se()})}," 刷新过期 ",10,ks),s("button",{type:"button",class:m(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!j.value||C.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!j.value||C.value,onClick:t[6]||(t[6]=o=>{Wt(),se()})}," 刷新选中 ",10,Cs),t[33]||(t[33]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:m(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",j.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!j.value,onClick:t[7]||(t[7]=o=>{Gt(),se()})}," 批量启用 ",10,Ts),s("button",{type:"button",class:m(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",j.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!j.value,onClick:t[8]||(t[8]=o=>{Ht(),se()})}," 批量禁用 ",10,Ss),s("button",{type:"button",class:m(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",j.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!j.value,onClick:t[9]||(t[9]=o=>{Jt(),se()})}," 批量删除 ",10,As)])):x("",!0)],512)]),H.value==="card"?(r(),l("div",Es,[(r(!0),l(pe,null,Le(P.value,o=>(r(),l("div",{key:o.id,class:m(["rounded-2xl border border-border bg-card p-4",it(o)]),onClick:i=>Ae(o.id)},[s("div",Ls,[s("div",null,[t[34]||(t[34]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",$s,n(o.id),1)]),s("div",Rs,[K(xe,{modelValue:b.value.has(o.id),"onUpdate:modelValue":i=>Ae(o.id),onClick:t[10]||(t[10]=$(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:m(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",ot(o)])},n(ue(o)),3)])]),s("div",Vs,[s("div",null,[t[35]||(t[35]=s("p",null,"剩余时间",-1)),s("p",{class:m(["mt-1 text-sm font-semibold",nt(o)])},n(lt(o.remaining_display)),3),o.expires_at?(r(),l("p",Ms,n(o.expires_at),1)):x("",!0)]),s("div",null,[t[36]||(t[36]=s("p",null,"冷却",-1)),s("p",{class:m(["mt-1",De(o)])},[o.cooldown_seconds>0?(r(),l("span",js,n(at(o.cooldown_seconds))+" · "+n(o.cooldown_reason),1)):(r(),l("span",Ds,n(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[t[37]||(t[37]=s("p",null,"失败数",-1)),s("p",Os,n(o.error_count),1)]),s("div",null,[t[38]||(t[38]=s("p",null,"会话数",-1)),s("p",Bs,n(o.conversation_count),1)])]),s("div",Ns,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:$(i=>ft(o.id),["stop"])}," 编辑 ",8,Us),rt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[11]||(t[11]=$(()=>{},["stop"])),i=>xt(o.id)]}," 启用 ",8,zs)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[12]||(t[12]=$(()=>{},["stop"])),i=>mt(o.id)]}," 禁用 ",8,Ps)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[t[13]||(t[13]=$(()=>{},["stop"])),i=>gt(o.id)]}," 删除 ",8,Fs)])],10,Is))),128)),!P.value.length&&!L(oe)?(r(),l("div",Ks," 暂无账号数据,请检查后台配置。 ")):x("",!0)])):(r(),l("div",Gs,[s("table",Hs,[s("thead",Js,[s("tr",null,[s("th",Ys,[K(xe,{modelValue:Ve.value,"onUpdate:modelValue":dt},null,8,["modelValue"])]),t[40]||(t[40]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),t[41]||(t[41]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",Qs,[s("span",qs,[t[39]||(t[39]=G(" 剩余/过期 ",-1)),K(cs,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),t[42]||(t[42]=s("th",{class:"py-3 pr-6"},"冷却",-1)),t[43]||(t[43]=s("th",{class:"py-3 pr-6"},"失败数",-1)),t[44]||(t[44]=s("th",{class:"py-3 pr-6"},"会话数",-1)),t[45]||(t[45]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",Ws,[!P.value.length&&!L(oe)?(r(),l("tr",Xs,[...t[46]||(t[46]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):x("",!0),(r(!0),l(pe,null,Le(P.value,o=>(r(),l("tr",{key:o.id,class:m(["border-t border-border",it(o)]),onClick:i=>Ae(o.id)},[s("td",{class:"py-4 pr-4",onClick:t[14]||(t[14]=$(()=>{},["stop"]))},[K(xe,{modelValue:b.value.has(o.id),"onUpdate:modelValue":i=>Ae(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",eo,n(o.id),1),s("td",to,[s("span",{class:m(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",ot(o)])},n(ue(o)),3)]),s("td",so,[s("div",{class:m(["text-sm font-semibold",nt(o)])},n(lt(o.remaining_display)),3),o.expires_at?(r(),l("span",oo,n(o.expires_at),1)):x("",!0)]),s("td",ro,[o.cooldown_seconds>0?(r(),l("span",{key:0,class:m(De(o))},n(at(o.cooldown_seconds))+" · "+n(o.cooldown_reason),3)):(r(),l("span",{key:1,class:m(De(o))},n(o.cooldown_reason||"无冷却"),3))]),s("td",lo,n(o.error_count),1),s("td",no,n(o.conversation_count),1),s("td",ao,[s("div",io,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:$(i=>ft(o.id),["stop"])}," 编辑 ",8,uo),rt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:$(i=>xt(o.id),["stop"])}," 启用 ",8,co)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:$(i=>mt(o.id),["stop"])}," 禁用 ",8,fo)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:$(i=>gt(o.id),["stop"])}," 删除 ",8,vo)])])],10,Zs))),128))])])]))])]),K(ds,{open:L(T).open.value,title:L(T).title.value,message:L(T).message.value,"confirm-text":L(T).confirmText.value,"cancel-text":L(T).cancelText.value,onConfirm:L(T).confirm,onCancel:L(T).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(r(),Ie($e,{to:"body"},[me.value?(r(),l("div",po,[s("div",xo,[s("div",mo,[s("div",null,[t[47]||(t[47]=s("p",{class:"text-sm font-medium text-foreground"},"添加账户",-1)),s("p",go,n(O.value==="register"?"创建 DuckMail 账号并自动注册":"批量导入账户配置"),1)]),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:je}," 关闭 ")]),s("div",bo,[s("div",yo,[s("div",_o,[s("button",{type:"button",class:m(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",O.value==="register"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[15]||(t[15]=o=>O.value="register")}," 自动注册 ",2),s("button",{type:"button",class:m(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",O.value==="import"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[16]||(t[16]=o=>O.value="import")}," 批量导入 ",2)]),O.value==="register"?(r(),l("div",wo,[t[48]||(t[48]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),E(s("input",{"onUpdate:modelValue":t[17]||(t[17]=o=>ae.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,ae.value,void 0,{number:!0}]]),t[49]||(t[49]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"}," 默认域名来自设置面板(可在“配置面板”中修改) ",-1))])):(r(),l("div",ho,[t[50]||(t[50]=s("label",{class:"block text-xs text-muted-foreground"},"批量导入(每行一个)",-1)),E(s("textarea",{"onUpdate:modelValue":t[18]||(t[18]=o=>ie.value=o),class:"min-h-[140px] w-full rounded-2xl border border-input bg-background px-3 py-2 text-xs font-mono",placeholder:`duckmail----you@example.com----password
2
+ user@outlook.com----loginPassword----clientId----refreshToken`},null,512),[[I,ie.value]]),t[51]||(t[51]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"支持两种格式:"),s("p",{class:"mt-1 font-mono"},"duckmail----email----password"),s("p",{class:"mt-1 font-mono"},"email----password----clientId----refreshToken"),s("p",{class:"mt-2 text-[11px]"},'导入后请执行一次"刷新选中"以获取 Cookie。')],-1)),B.value?(r(),l("div",ko,n(B.value),1)):x("",!0)])),t[53]||(t[53]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-[11px] leading-relaxed text-muted-foreground"},[s("div",{class:"space-y-2"},[s("p",{class:"text-xs font-bold text-rose-600"},"⚠️ 严禁滥用:禁止将本工具用于商业用途或任何形式的滥用(无论规模大小)"),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"本工具严禁用于以下行为:")]),s("p",{class:"pl-3"},"• 商业用途或盈利性使用"),s("p",{class:"pl-3"},"• 任何形式的批量操作或自动化滥用(无论规模大小)"),s("p",{class:"pl-3"},"• 破坏市场秩序或恶意竞争"),s("p",{class:"pl-3"},"• 违反 Google 服务条款的任何行为"),s("p",{class:"pl-3"},"• 违反 Microsoft 服务条款的任何行为")]),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"违规后果:"),G("滥用行为可能导致账号永久封禁、法律追责,一切后果由使用者自行承担。")])]),s("div",{class:"space-y-1"},[s("p",{class:"font-semibold text-foreground"},"📖 合法用途"),s("p",null,"本项目仅限于以下场景:"),s("p",{class:"pl-3"},"• 个人学习与技术研究"),s("p",{class:"pl-3"},"• 浏览器自动化技术探索"),s("p",{class:"pl-3"},"• 非商业性技术交流")]),s("div",{class:"space-y-1"},[s("p",{class:"font-semibold text-foreground"},"⚖️ 法律责任"),s("p",null,[s("strong",null,"使用者责任:"),G("使用本工具产生的一切后果(包括但不限于账号封禁、数据损失、法律纠纷)由使用者完全承担。")]),s("p",null,[s("strong",null,"合规义务:"),G("使用者必须遵守所在地法律法规及第三方服务条款(包括但不限于 Google Workspace、Microsoft 365 等服务条款)。")]),s("p",null,[s("strong",null,"作者免责:"),G("作者不对任何违规使用、滥用行为或由此产生的后果承担责任。")])]),s("div",{class:"space-y-1"},[s("p",{class:"font-semibold text-foreground"},"📋 技术声明"),s("p",{class:"pl-3"},'• 本项目按"现状"提供,不提供任何形式的担保'),s("p",{class:"pl-3"},"• 依赖的第三方服务(如 DuckMail API、Microsoft Graph API 等)可用性不受作者控制"),s("p",{class:"pl-3"},"• 作者保留随时停止维护、变更功能或关闭项目的权利")])])],-1)),K(xe,{modelValue:de.value,"onUpdate:modelValue":t[19]||(t[19]=o=>de.value=o)},{default:ht(()=>[...t[52]||(t[52]=[G(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])])]),s("div",Co,[s("div",To,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:je}," 取消 "),O.value==="register"?(r(),l("button",{key:0,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:M.value||!de.value,onClick:qt}," 开始注册 ",8,So)):(r(),l("button",{key:1,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:ge.value||!de.value,onClick:Et}," 导入并保存 ",8,Ao))])])])])):x("",!0)])),(r(),Ie($e,{to:"body"},[J.value?(r(),l("div",Eo,[s("div",Io,[s("div",Lo,[t[54]||(t[54]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",$o,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary",disabled:!Y.value.length&&!Q.value.length&&!v.value&&!p.value&&!y.value,onClick:Rt}," 清空日志 ",8,Ro),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:$t}," 关闭 ")])]),s("div",Vo,[y.value?(r(),l("div",Mo,n(y.value),1)):x("",!0),v.value||p.value?(r(),l("div",jo,[v.value?(r(),l("div",Do,[t[55]||(t[55]=s("div",{class:"font-medium text-foreground"},"注册任务",-1)),s("div",Oo,[s("span",null,"状态:"+n(bt(v.value.status)),1),s("span",null,"进度:"+n(v.value.progress)+"/"+n(v.value.count),1),s("span",null,"成功:"+n(v.value.success_count),1),s("span",null,"失败:"+n(v.value.fail_count),1)])])):x("",!0),p.value?(r(),l("div",Bo,[t[56]||(t[56]=s("div",{class:"font-medium text-foreground"},"刷新任务",-1)),s("div",No,[s("span",null,"状态:"+n(bt(p.value.status)),1),s("span",null,"进度:"+n(p.value.progress)+"/"+n(p.value.account_ids.length),1),s("span",null,"成功:"+n(p.value.success_count),1),s("span",null,"失败:"+n(p.value.fail_count),1)])])):x("",!0)])):x("",!0),Y.value.length||Q.value.length?(r(),l("div",Uo,[s("div",{ref_key:"taskLogsRef",ref:Qe,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[Y.value.length?(r(),l("div",zo,[t[57]||(t[57]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",Po,[(r(!0),l(pe,null,Le(Y.value,(o,i)=>(r(),l("div",{key:`reg-${i}`,class:"font-mono"},n(ct(o)),1))),128))])])):x("",!0),Q.value.length?(r(),l("div",Fo,[t[58]||(t[58]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",Ko,[(r(!0),l(pe,null,Le(Q.value,(o,i)=>(r(),l("div",{key:`login-${i}`,class:"font-mono"},n(ct(o)),1))),128))])])):x("",!0)],512)])):x("",!0),!y.value&&!v.value&&!p.value&&!Y.value.length&&!Q.value.length?(r(),l("div",Go," 暂无任务 ")):x("",!0)])])])):x("",!0)])),(r(),Ie($e,{to:"body"},[le.value?(r(),l("div",Ho,[s("div",Jo,[s("div",{class:"flex items-center justify-between"},[t[59]||(t[59]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Be}," 关闭 ")]),f.value?(r(),l("div",Yo,n(f.value),1)):x("",!0),s("div",Qo,[t[60]||(t[60]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),E(s("input",{"onUpdate:modelValue":t[20]||(t[20]=o=>_.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[I,_.value.id]]),t[61]||(t[61]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),E(s("textarea",{"onUpdate:modelValue":t[21]||(t[21]=o=>_.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[I,_.value.secure_c_ses]]),t[62]||(t[62]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),E(s("input",{"onUpdate:modelValue":t[22]||(t[22]=o=>_.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,_.value.csesidx]]),t[63]||(t[63]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),E(s("input",{"onUpdate:modelValue":t[23]||(t[23]=o=>_.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,_.value.config_id]]),t[64]||(t[64]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),E(s("input",{"onUpdate:modelValue":t[24]||(t[24]=o=>_.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,_.value.host_c_oses]]),t[65]||(t[65]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),E(s("input",{"onUpdate:modelValue":t[25]||(t[25]=o=>_.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[I,_.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Be}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Kt}," 保存 ")])])])):x("",!0)])),(r(),Ie($e,{to:"body"},[R.value?(r(),l("div",qo,[s("div",Wo,[s("div",Xo,[t[66]||(t[66]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",Zo,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Pt},n(D.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Oe}," 关闭 ")])]),V.value?(r(),l("div",er,n(V.value),1)):x("",!0),s("div",tr,[E(s("textarea",{"onUpdate:modelValue":t[26]||(t[26]=o=>Z.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:D.value},null,8,sr),[[I,Z.value]])]),s("div",or,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Oe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Ft,disabled:D.value}," 保存 ",8,rr)])])])):x("",!0)]))],64))}});export{cr as default};
static/assets/Accounts-JKhKShMC.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{g as C,C as zt,h as a,d as Pt,D as Ft,i as N,o as Kt,j as Jt,c as l,a as s,x as U,y as ke,m as V,v as I,A as ft,t as n,n as b,u as S,b as f,f as Ce,F as ie,r as Te,T as Se,w as A,e as r}from"./index-C9KL0lrc.js";import{_ as Ht}from"./SelectMenu.vue_vue_type_script_setup_true_lang-gwg2tONM.js";import{_ as ue}from"./Checkbox.vue_vue_type_script_setup_true_lang-DQLrRLI4.js";import{_ as Gt}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-pFdqEtiD.js";import{u as Yt}from"./useConfirmDialog-DHNXQEiw.js";import{_ as Qt}from"./HelpTip.vue_vue_type_script_setup_true_lang-q6qcDogV.js";const y={list:()=>C.get("/admin/accounts"),getConfig:()=>C.get("/admin/accounts-config"),updateConfig:x=>C.put("/admin/accounts-config",x),delete:x=>C.delete(`/admin/accounts/${x}`),disable:x=>C.put(`/admin/accounts/${x}/disable`),enable:x=>C.put(`/admin/accounts/${x}/enable`),startRegister:(x,_)=>C.post("/admin/register/start",{count:x,domain:_}),getRegisterTask:x=>C.get(`/admin/register/task/${x}`),getRegisterCurrent:()=>C.get("/admin/register/current"),startLogin:x=>C.post("/admin/login/start",x),getLoginTask:x=>C.get(`/admin/login/task/${x}`),getLoginCurrent:()=>C.get("/admin/login/current"),checkLogin:()=>C.post("/admin/login/check")},qt=zt("accounts",()=>{const x=a([]),_=a(!1);async function T(){_.value=!0;try{const u=await y.list();x.value=Array.isArray(u)?u:u.accounts||[]}finally{_.value=!1}}async function X(u){await y.delete(u),await T()}async function k(u){await y.disable(u),await T()}async function Z(u){await y.enable(u),await T()}async function J(u){await Promise.all(u.map(E=>y.enable(E))),await T()}async function g(u){await Promise.all(u.map(E=>y.disable(E))),await T()}async function z(u){await Promise.all(u.map(E=>y.delete(E))),await T()}async function ee(u){await y.updateConfig(u),await T()}return{accounts:x,isLoading:_,loadAccounts:T,deleteAccount:X,disableAccount:k,enableAccount:Z,bulkEnable:J,bulkDisable:g,bulkDelete:z,updateConfig:ee}}),Wt={class:"space-y-8"},Xt={class:"rounded-3xl border border-border bg-card p-6"},Zt={class:"flex flex-wrap items-center justify-between gap-4"},es={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},ts={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},ss={class:"ml-auto flex items-center gap-2 sm:ml-0"},os={class:"mt-4 flex flex-wrap items-center gap-2"},rs=["disabled"],ls=["disabled"],ns={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},as=["disabled"],is=["disabled"],us=["disabled"],ds=["disabled"],cs=["disabled"],vs={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},fs=["onClick"],xs={class:"flex items-start justify-between gap-3"},gs={class:"mt-1 font-mono text-xs text-foreground"},ms={class:"flex items-center gap-2"},ps={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},bs={key:0,class:"mt-1 text-[11px]"},ys={key:0},_s={key:1},ws={class:"mt-1 text-sm font-semibold text-foreground"},hs={class:"mt-1 text-sm font-semibold text-foreground"},ks={class:"mt-4 flex flex-wrap items-center gap-2"},Cs=["onClick"],Ts=["onClick"],Ss=["onClick"],As=["onClick"],Es={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Ls={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},$s={class:"min-w-full text-left text-sm"},Rs={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Vs={class:"py-3 pr-4"},Is={class:"py-3 pr-6"},js={class:"inline-flex items-center gap-2"},Ds={class:"text-sm text-foreground"},Ms={key:0},Os=["onClick"],Bs={class:"py-4 pr-6 font-mono text-xs text-foreground"},Ns={class:"py-4 pr-6"},Us={class:"py-4 pr-6"},zs={key:0,class:"block text-[11px] text-muted-foreground"},Ps={class:"py-4 pr-6 text-xs"},Fs={class:"py-4 pr-6 text-xs text-muted-foreground"},Ks={class:"py-4 pr-6 text-xs text-muted-foreground"},Js={class:"py-4 text-right"},Hs={class:"flex flex-wrap justify-end gap-2"},Gs=["onClick"],Ys=["onClick"],Qs=["onClick"],qs=["onClick"],Ws={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Xs={class:"w-full max-w-md rounded-3xl border border-border bg-card p-6 shadow-xl"},Zs={class:"mt-4 space-y-4 text-sm"},eo={class:"mt-6 flex items-center justify-end gap-2"},to=["disabled"],so={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},oo={class:"w-full max-w-2xl max-h-[80vh] overflow-y-auto rounded-3xl border border-border bg-card p-6 shadow-xl"},ro={class:"flex items-center justify-between"},lo={class:"flex items-center gap-2"},no=["disabled"],ao={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},io={key:1,class:"mt-4 grid gap-2 text-xs text-muted-foreground"},uo={key:0},co={class:"ml-2"},vo={class:"ml-2"},fo={class:"ml-2"},xo={class:"ml-2"},go={key:1},mo={class:"ml-2"},po={class:"ml-2"},bo={class:"ml-2"},yo={class:"ml-2"},_o={key:2,class:"mt-4 grid gap-2"},wo={key:0,class:"rounded-2xl border border-border bg-muted/30 p-3"},ho={class:"mt-2 space-y-1 text-[11px] text-muted-foreground"},ko={key:1,class:"rounded-2xl border border-border bg-muted/30 p-3"},Co={class:"mt-2 space-y-1 text-[11px] text-muted-foreground"},To={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},So={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Ao={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Eo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},Lo={class:"mt-4 space-y-3 text-sm"},$o={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Ro={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},Vo={class:"flex items-center justify-between"},Io={class:"flex items-center gap-2"},jo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},Do={class:"mt-4"},Mo=["readonly"],Oo={class:"mt-6 flex items-center justify-end gap-2"},Bo=["disabled"],De="accounts-register-task-cache",Me="accounts-login-task-cache",Oe="accounts-register-log-clear",Be="accounts-login-log-clear",Ne="accounts-register-task-cleared-id",Ue="accounts-login-task-cleared-id",Jo=Pt({__name:"Accounts",setup(x){const _=qt(),{accounts:T,isLoading:X}=Ft(_),k=Yt(),Z=a(""),J=a("all"),g=a(new Set),z=a("table"),ee=a(!1),u=a(""),E=a(!1),L=a(""),H=a(""),j=a(!1),te=a([]),se=a(1),de=a(!1),oe=a(!1),D=a(!1),Ae=a(null),ce=a(null),ve=a(null),M=a(null),O=a(null),G=a(0),Y=a(0),fe=a(!1),d=a(null),c=a(null),$=a(!1),h=a(!1),m=a(""),p=a({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),xe=a(null),ze=a([]),xt=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],B=N(()=>{const e=Z.value.trim().toLowerCase();return T.value.filter(t=>{const o=!e||t.id.toLowerCase().includes(e),i=J.value==="all"||re(t)===J.value;return o&&i})}),R=N(()=>g.value.size),Ee=N(()=>B.value.length>0&&B.value.every(e=>g.value.has(e.id))),ge=async()=>{await _.loadAccounts(),g.value=new Set,D.value=!1},Pe=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},Fe=e=>{try{return localStorage.getItem(e)||null}catch{return null}},me=(e,t)=>{try{if(t){localStorage.setItem(e,t);return}localStorage.removeItem(e)}catch{}},Ke=(e,t)=>{try{localStorage.setItem(e,JSON.stringify(t))}catch{}},Je=e=>{try{localStorage.removeItem(e)}catch{}},He=e=>{const t=localStorage.getItem(e),o=Number(t);return Number.isFinite(o)?o:0},pe=(e,t)=>{try{localStorage.setItem(e,String(t))}catch{}},Le=(e,t=!0)=>{e&&(e.id&&e.id===M.value||(e.id&&M.value&&e.id!==M.value&&(M.value=null,me(Ne,null)),d.value=e,e.id&&e.id!==ce.value&&(ce.value=e.id,G.value=0,pe(Oe,0)),t&&Ke(De,e)))},be=(e,t=!0)=>{e&&(e.id&&e.id===O.value||(e.id&&O.value&&e.id!==O.value&&(O.value=null,me(Ue,null)),c.value=e,e.id&&e.id!==ve.value&&(ve.value=e.id,Y.value=0,pe(Be,0)),t&&Ke(Me,e)))},gt=()=>{G.value=He(Oe),Y.value=He(Be),M.value=Fe(Ne),O.value=Fe(Ue);const e=Pe(De);e&&e.id!==M.value&&(d.value=e,ce.value=e.id||null);const t=Pe(Me);t&&t.id!==O.value&&(c.value=t,ve.value=t.id||null)},mt=()=>{de.value=!0,fe.value=!1},Ge=()=>{de.value=!1},pt=async()=>{try{const e=[],t=d.value?.id,o=c.value?.id;if(t&&!ye(t)&&e.push(dt(t)),o&&!_e(o)&&e.push(ct(o)),!e.length){await je();return}await Promise.all(e)}catch(e){m.value=e?.message||"任务状态更新失败"}},bt=async()=>{oe.value=!0,await pt()},yt=()=>{oe.value=!1},_t=()=>{const e=d.value?.id||null,t=c.value?.id||null;M.value=e,O.value=t,me(Ne,e),me(Ue,t),G.value=d.value?.logs?.length||0,Y.value=c.value?.logs?.length||0,pe(Oe,G.value),pe(Be,Y.value),d.value=null,c.value=null,ce.value=null,ve.value=null,m.value="",$.value=!1,h.value=!1,P(),F(),Je(De),Je(Me)},ye=e=>!!(e&&e===M.value),_e=e=>!!(e&&e===O.value),wt=()=>{D.value=!D.value},Q=()=>{D.value=!1},Ye=e=>{if(!D.value)return;const t=e.target;Ae.value&&!Ae.value.contains(t)&&(D.value=!1)};Kt(async()=>{gt(),await ge(),await je(),Ot(),document.addEventListener("click",Ye)});const q=N(()=>{const e=d.value?.logs||[];return G.value?e.slice(G.value):e}),W=N(()=>{const e=c.value?.logs||[];return Y.value?e.slice(Y.value):e}),ht=N(()=>!!m.value||!!d.value||!!c.value||q.value.length>0||W.value.length>0),kt=N(()=>{const e=d.value?.status,t=c.value?.status;return e==="running"||e==="pending"||t==="running"||t==="pending"}),Ct=N(()=>{if(m.value)return"bg-rose-500";if(kt.value)return"bg-sky-400";const e=[];if(d.value){const v=d.value.success_count??0,w=d.value.fail_count??0,K=d.value.count??v+w;e.push({success:v,fail:w,total:K,status:d.value.status})}if(c.value){const v=c.value.success_count??0,w=c.value.fail_count??0,K=c.value.account_ids?.length??v+w;e.push({success:v,fail:w,total:K,status:c.value.status})}if(!e.length)return"bg-muted-foreground";const t=e.reduce((v,w)=>v+w.success,0),o=e.reduce((v,w)=>v+w.fail,0),i=e.reduce((v,w)=>v+(w.total||0),0);if(t>0&&o>0)return"bg-amber-400";if(o>0&&t===0)return"bg-rose-500";if(t>0&&o===0)return"bg-emerald-400";if(i===0){const v=e.every(K=>K.status==="success");if(e.some(K=>K.status==="failed"))return"bg-rose-500";if(v)return"bg-emerald-400"}return"bg-muted-foreground"});Jt(()=>{P(),F(),Mt(),document.removeEventListener("click",Ye)});const re=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?"429限流":e.cooldown_reason==="错误禁用"?"错误禁用":e.disabled?"手动禁用":e.status==="已过期"?"已过期":e.status==="即将过期"?"即将过期":"正常",Qe=e=>{const t=re(e);return t==="429限流"||t==="即将过期"?"bg-amber-200 text-amber-900":t==="错误禁用"||t==="已过期"?"bg-destructive/10 text-destructive":t==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},qe=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?!0:e.disabled||e.cooldown_reason==="错误禁用",We=e=>e==="已过期"?"过期":e==="未设置"?"未设置":e,Xe=e=>e.status==="已过期"?"text-rose-600":e.status==="即将过期"?"text-amber-700":e.status==="未设置"?"text-muted-foreground":"text-emerald-600",Ze=e=>e<60?`${e} 秒`:e<3600?`${Math.ceil(e/60)} 分钟`:`${(e/3600).toFixed(1)} 小时`,$e=e=>e.cooldown_seconds>0?"text-amber-700":e.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",et=e=>{const t=re(e);return t==="手动禁用"||t==="已过期"?"bg-muted/70":""},we=e=>{const t=new Set(g.value);t.has(e)?t.delete(e):t.add(e),g.value=t},tt=()=>{if(Ee.value){g.value=new Set;return}g.value=new Set(B.value.map(e=>e.id))},Tt=(e,t)=>e.id||`account_${t+1}`,St=async()=>(await y.getConfig()).accounts.map((t,o)=>({...t,id:Tt(t,o)})),st=e=>`${e.time} [${e.level}] ${e.message}`,At=(e,t)=>{let o=-1;for(let v=0;v<e.length;v+=1)if(e[v].id===t){o=v;break}if(o===-1)return u.value="未找到对应账号配置。",!1;const i=e[o];return p.value={id:i.id,secure_c_ses:i.secure_c_ses,csesidx:i.csesidx,config_id:i.config_id,host_c_oses:i.host_c_oses,expires_at:i.expires_at},ze.value=e,xe.value=o,ee.value=!0,!0},ot=async e=>{u.value="";try{const t=await St();At(t,e)}catch(t){u.value=t.message||"加载账号配置失败"}},Et=async()=>{L.value="";try{const e=await y.getConfig();te.value=Array.isArray(e.accounts)?e.accounts:[],H.value=JSON.stringify(lt(te.value),null,2),j.value=!0,E.value=!0}catch(e){L.value=e.message||"加载账号配置失败"}},Re=()=>{E.value=!1,L.value="",j.value=!1},rt=()=>{const e=JSON.parse(H.value);if(!Array.isArray(e))throw new Error("配置格式必须是数组。");return e},Lt=e=>typeof e!="string"||!e?e:e.length<=6?`${e.slice(0,2)}****`:`${e.slice(0,3)}****`,lt=e=>{const t=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password"]);return e.map(o=>{const i={...o};return t.forEach(v=>{const w=i[v];w&&(i[v]=Lt(w))}),i})},$t=()=>{if(L.value="",!j.value){try{te.value=rt()}catch(e){L.value=e.message||"JSON 格式错误";return}H.value=JSON.stringify(lt(te.value),null,2),j.value=!0;return}H.value=JSON.stringify(te.value,null,2),j.value=!1},Rt=async()=>{L.value="";try{const e=rt();await _.updateConfig(e),Re()}catch(e){L.value=e.message||"保存失败"}},Ve=()=>{ee.value=!1,u.value=""},Vt=async()=>{if(xe.value===null)return;const e=[...ze.value];e[xe.value]={...e[xe.value],id:p.value.id,secure_c_ses:p.value.secure_c_ses,csesidx:p.value.csesidx,config_id:p.value.config_id,host_c_oses:p.value.host_c_oses||void 0,expires_at:p.value.expires_at||void 0};try{await _.updateConfig(e),Ve()}catch(t){u.value=t.message||"保存失败"}},It=async()=>{await _.bulkEnable(Array.from(g.value)),g.value=new Set},jt=async()=>{await k.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"})&&(await _.bulkDisable(Array.from(g.value)),g.value=new Set)},Dt=async()=>{await k.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"})&&(await _.bulkDelete(Array.from(g.value)),g.value=new Set)},nt=async e=>{await _.enableAccount(e)},at=async e=>{await k.ask({title:"禁用账号",message:"确定要禁用该账号吗?"})&&await _.disableAccount(e)},it=async e=>{await k.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"})&&await _.deleteAccount(e)};let le=null,ne=null,ae=null,he=!1;const P=()=>{le!==null&&(window.clearInterval(le),le=null)},F=()=>{ne!==null&&(window.clearInterval(ne),ne=null)},Mt=()=>{ae!==null&&(window.clearInterval(ae),ae=null),he=!1},ut=e=>e==="pending"?"等待中":e==="running"?"执行中":e==="success"?"成功":e==="failed"?"失败":e,dt=async e=>{if(ye(e)){P();return}const t=await y.getRegisterTask(e);if(ye(t.id)){P();return}Le(t),t.status!=="running"&&t.status!=="pending"&&($.value=!1,P(),await ge())},ct=async e=>{if(_e(e)){F();return}const t=await y.getLoginTask(e);if(_e(t.id)){F();return}be(t),t.status!=="running"&&t.status!=="pending"&&(h.value=!1,F(),await ge())},vt=e=>{P(),le=window.setInterval(()=>{dt(e).catch(t=>{m.value=t?.message||"注册任务更新失败",P(),$.value=!1})},3e3)},Ie=e=>{F(),ne=window.setInterval(()=>{ct(e).catch(t=>{m.value=t?.message||"刷新任务更新失败",F(),h.value=!1})},3e3)},Ot=()=>{ae===null&&(ae=window.setInterval(async()=>{if(!he&&!oe.value&&!(le!==null||ne!==null)&&!(!$.value&&!h.value&&!d.value&&!c.value)){he=!0;try{await je()}catch(e){m.value=e?.message||"后台刷新失败"}finally{he=!1}}},6e3))},je=async()=>{try{const e=await y.getRegisterCurrent();e&&"id"in e&&!ye(e.id)&&(Le(e),(e.status==="running"||e.status==="pending")&&($.value=!0,vt(e.id)))}catch(e){m.value=e.message||"加载注册任务失败"}try{const e=await y.getLoginCurrent();e&&"id"in e&&!_e(e.id)&&(be(e),(e.status==="running"||e.status==="pending")&&(h.value=!0,Ie(e.id)))}catch(e){m.value=e.message||"加载刷新任务失败"}},Bt=async()=>{m.value="",$.value=!0;try{const e=Number.isFinite(se.value)&&se.value>0?se.value:void 0,t=await y.startRegister(e);Le(t),vt(t.id),de.value=!1,oe.value=!0}catch(e){m.value=e.message||"启动注册失败",$.value=!1}},Nt=async()=>{if(g.value.size){m.value="",h.value=!0;try{const e=await y.startLogin(Array.from(g.value));be(e),Ie(e.id)}catch(e){m.value=e.message||"启动刷新失败",h.value=!1}}},Ut=async()=>{m.value="",h.value=!0;try{await y.checkLogin();const e=await y.getLoginCurrent();if(e&&"id"in e){be(e),Ie(e.id);return}h.value=!1}catch(e){m.value=e.message||"触发刷新失败",h.value=!1}};return(e,t)=>(r(),l(ie,null,[s("div",Wt,[s("section",Xt,[s("div",Zt,[s("div",es,[V(s("input",{"onUpdate:modelValue":t[0]||(t[0]=o=>Z.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[I,Z.value]]),U(Ht,{modelValue:J.value,"onUpdate:modelValue":t[1]||(t[1]=o=>J.value=o),options:xt},null,8,["modelValue"])]),s("div",ts,[U(ue,{modelValue:Ee.value,"onUpdate:modelValue":tt},{default:ft(()=>[...t[24]||(t[24]=[Ce(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+n(R.value)+" / "+n(B.value.length)+" 个账号",1),s("div",ss,[s("button",{type:"button",class:b(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",z.value==="table"?"bg-accent text-accent-foreground":""]),onClick:t[2]||(t[2]=o=>z.value="table"),"aria-label":"列表视图"},[...t[25]||(t[25]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:b(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",z.value==="card"?"bg-accent text-accent-foreground":""]),onClick:t[3]||(t[3]=o=>z.value="card"),"aria-label":"卡片视图"},[...t[26]||(t[26]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",os,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:S(X),onClick:ge}," 刷新列表 ",8,rs),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:Et}," 账户配置 "),s("button",{class:"rounded-full border border-border bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:$.value,onClick:mt}," 添加账户 ",8,ls),s("div",{ref_key:"moreActionsRef",ref:Ae,class:"relative"},[s("button",{class:b(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",D.value?"bg-accent text-accent-foreground":""]),onClick:wt},[t[27]||(t[27]=Ce(" 更多操作 ",-1)),t[28]||(t[28]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),ht.value?(r(),l("span",{key:0,class:b(["ml-1 h-2 w-2 rounded-full",Ct.value]),"aria-hidden":"true"},null,2)):f("",!0)],2),D.value?(r(),l("div",ns,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:t[4]||(t[4]=o=>{bt(),Q()})}," 任务状态 "),t[29]||(t[29]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",h.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:h.value,onClick:t[5]||(t[5]=o=>{Ut(),Q()})}," 刷新过期 ",10,as),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!R.value||h.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!R.value||h.value,onClick:t[6]||(t[6]=o=>{Nt(),Q()})}," 刷新选中 ",10,is),t[30]||(t[30]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",R.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!R.value,onClick:t[7]||(t[7]=o=>{It(),Q()})}," 批量启用 ",10,us),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",R.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!R.value,onClick:t[8]||(t[8]=o=>{jt(),Q()})}," 批量禁用 ",10,ds),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",R.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!R.value,onClick:t[9]||(t[9]=o=>{Dt(),Q()})}," 批量删除 ",10,cs)])):f("",!0)],512)]),z.value==="card"?(r(),l("div",vs,[(r(!0),l(ie,null,Te(B.value,o=>(r(),l("div",{key:o.id,class:b(["rounded-2xl border border-border bg-card p-4",et(o)]),onClick:i=>we(o.id)},[s("div",xs,[s("div",null,[t[31]||(t[31]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",gs,n(o.id),1)]),s("div",ms,[U(ue,{modelValue:g.value.has(o.id),"onUpdate:modelValue":i=>we(o.id),onClick:t[10]||(t[10]=A(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:b(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",Qe(o)])},n(re(o)),3)])]),s("div",ps,[s("div",null,[t[32]||(t[32]=s("p",null,"剩余时间",-1)),s("p",{class:b(["mt-1 text-sm font-semibold",Xe(o)])},n(We(o.remaining_display)),3),o.expires_at?(r(),l("p",bs,n(o.expires_at),1)):f("",!0)]),s("div",null,[t[33]||(t[33]=s("p",null,"冷却",-1)),s("p",{class:b(["mt-1",$e(o)])},[o.cooldown_seconds>0?(r(),l("span",ys,n(Ze(o.cooldown_seconds))+" · "+n(o.cooldown_reason),1)):(r(),l("span",_s,n(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[t[34]||(t[34]=s("p",null,"失败数",-1)),s("p",ws,n(o.error_count),1)]),s("div",null,[t[35]||(t[35]=s("p",null,"会话数",-1)),s("p",hs,n(o.conversation_count),1)])]),s("div",ks,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>ot(o.id),["stop"])}," 编辑 ",8,Cs),qe(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[11]||(t[11]=A(()=>{},["stop"])),i=>nt(o.id)]}," 启用 ",8,Ts)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[12]||(t[12]=A(()=>{},["stop"])),i=>at(o.id)]}," 禁用 ",8,Ss)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[t[13]||(t[13]=A(()=>{},["stop"])),i=>it(o.id)]}," 删除 ",8,As)])],10,fs))),128)),!B.value.length&&!S(X)?(r(),l("div",Es," 暂无账号数据,请检查后台配置。 ")):f("",!0)])):(r(),l("div",Ls,[s("table",$s,[s("thead",Rs,[s("tr",null,[s("th",Vs,[U(ue,{modelValue:Ee.value,"onUpdate:modelValue":tt},null,8,["modelValue"])]),t[37]||(t[37]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),t[38]||(t[38]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",Is,[s("span",js,[t[36]||(t[36]=Ce(" 剩余/过期 ",-1)),U(Qt,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),t[39]||(t[39]=s("th",{class:"py-3 pr-6"},"冷却",-1)),t[40]||(t[40]=s("th",{class:"py-3 pr-6"},"失败数",-1)),t[41]||(t[41]=s("th",{class:"py-3 pr-6"},"会话数",-1)),t[42]||(t[42]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",Ds,[!B.value.length&&!S(X)?(r(),l("tr",Ms,[...t[43]||(t[43]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):f("",!0),(r(!0),l(ie,null,Te(B.value,o=>(r(),l("tr",{key:o.id,class:b(["border-t border-border",et(o)]),onClick:i=>we(o.id)},[s("td",{class:"py-4 pr-4",onClick:t[14]||(t[14]=A(()=>{},["stop"]))},[U(ue,{modelValue:g.value.has(o.id),"onUpdate:modelValue":i=>we(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",Bs,n(o.id),1),s("td",Ns,[s("span",{class:b(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",Qe(o)])},n(re(o)),3)]),s("td",Us,[s("div",{class:b(["text-sm font-semibold",Xe(o)])},n(We(o.remaining_display)),3),o.expires_at?(r(),l("span",zs,n(o.expires_at),1)):f("",!0)]),s("td",Ps,[o.cooldown_seconds>0?(r(),l("span",{key:0,class:b($e(o))},n(Ze(o.cooldown_seconds))+" · "+n(o.cooldown_reason),3)):(r(),l("span",{key:1,class:b($e(o))},n(o.cooldown_reason||"无冷却"),3))]),s("td",Fs,n(o.error_count),1),s("td",Ks,n(o.conversation_count),1),s("td",Js,[s("div",Hs,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>ot(o.id),["stop"])}," 编辑 ",8,Gs),qe(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>nt(o.id),["stop"])}," 启用 ",8,Ys)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>at(o.id),["stop"])}," 禁用 ",8,Qs)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:A(i=>it(o.id),["stop"])}," 删除 ",8,qs)])])],10,Os))),128))])])]))])]),U(Gt,{open:S(k).open.value,title:S(k).title.value,message:S(k).message.value,"confirm-text":S(k).confirmText.value,"cancel-text":S(k).cancelText.value,onConfirm:S(k).confirm,onCancel:S(k).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(r(),ke(Se,{to:"body"},[de.value?(r(),l("div",Ws,[s("div",Xs,[s("div",{class:"flex items-center justify-between"},[t[44]||(t[44]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"添加账户"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"创建 DuckMail 账号并自动注册")],-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Ge}," 关闭 ")]),s("div",Zs,[t[46]||(t[46]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),V(s("input",{"onUpdate:modelValue":t[15]||(t[15]=o=>se.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,se.value,void 0,{number:!0}]]),t[47]||(t[47]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"}," 默认域名来自设置面板(可在“配置面板”中修改) ",-1)),t[48]||(t[48]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-[11px] leading-relaxed text-muted-foreground"},[s("div",{class:"space-y-2"},[s("p",{class:"font-semibold text-rose-600"},"使用限制:禁止将本工具用于商业用途或大规模滥用。"),s("p",null,"用途说明:本项目仅用于学习、研究和技术交流,旨在探索浏览器自动化与系统集成。"),s("p",null,"使用责任:因使用本工具产生的一切后果由使用者自行承担,包括但不限于账号封禁、数据损失及法律责任。"),s("p",null,"合规要求:使用者应遵守所在国家/地区法律法规及 Google 服务条款,作者不对任何违规使用行为负责。"),s("p",null,"无担保:本项目按“现状”提供,不提供任何明示或暗示的担保,包括适销性或特定用途适用性。"),s("p",null,"第三方服务:本项目依赖 DuckMail API 等第三方服务,其可用性与稳定性不受作者控制。"),s("p",null,"维护声明:作者保留随时停止维护或变更功能的权利,恕不另行通知。")])],-1)),U(ue,{modelValue:fe.value,"onUpdate:modelValue":t[16]||(t[16]=o=>fe.value=o)},{default:ft(()=>[...t[45]||(t[45]=[Ce(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])]),s("div",eo,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ge}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:$.value||!fe.value,onClick:Bt}," 开始注册 ",8,to)])])])):f("",!0)])),(r(),ke(Se,{to:"body"},[oe.value?(r(),l("div",so,[s("div",oo,[s("div",ro,[t[49]||(t[49]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",lo,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary",disabled:!q.value.length&&!W.value.length&&!d.value&&!c.value&&!m.value,onClick:_t}," 清空日志 ",8,no),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:yt}," 关闭 ")])]),m.value?(r(),l("div",ao,n(m.value),1)):f("",!0),d.value||c.value?(r(),l("div",io,[d.value?(r(),l("div",uo,[t[50]||(t[50]=s("span",{class:"font-medium text-foreground"},"注册任务",-1)),s("span",co,"状态:"+n(ut(d.value.status)),1),s("span",vo,"进度:"+n(d.value.progress)+"/"+n(d.value.count),1),s("span",fo,"成功:"+n(d.value.success_count),1),s("span",xo,"失败:"+n(d.value.fail_count),1)])):f("",!0),c.value?(r(),l("div",go,[t[51]||(t[51]=s("span",{class:"font-medium text-foreground"},"刷新任务",-1)),s("span",mo,"状态:"+n(ut(c.value.status)),1),s("span",po,"进度:"+n(c.value.progress)+"/"+n(c.value.account_ids.length),1),s("span",bo,"成功:"+n(c.value.success_count),1),s("span",yo,"���败:"+n(c.value.fail_count),1)])):f("",!0)])):f("",!0),q.value.length||W.value.length?(r(),l("div",_o,[q.value.length?(r(),l("div",wo,[t[52]||(t[52]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",ho,[(r(!0),l(ie,null,Te(q.value,(o,i)=>(r(),l("div",{key:`reg-${i}`,class:"font-mono"},n(st(o)),1))),128))])])):f("",!0),W.value.length?(r(),l("div",ko,[t[53]||(t[53]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",Co,[(r(!0),l(ie,null,Te(W.value,(o,i)=>(r(),l("div",{key:`login-${i}`,class:"font-mono"},n(st(o)),1))),128))])])):f("",!0)])):f("",!0),!m.value&&!d.value&&!c.value&&!q.value.length&&!W.value.length?(r(),l("div",To," 暂无任务 ")):f("",!0)])])):f("",!0)])),(r(),ke(Se,{to:"body"},[ee.value?(r(),l("div",So,[s("div",Ao,[s("div",{class:"flex items-center justify-between"},[t[54]||(t[54]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Ve}," 关闭 ")]),u.value?(r(),l("div",Eo,n(u.value),1)):f("",!0),s("div",Lo,[t[55]||(t[55]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),V(s("input",{"onUpdate:modelValue":t[17]||(t[17]=o=>p.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[I,p.value.id]]),t[56]||(t[56]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),V(s("textarea",{"onUpdate:modelValue":t[18]||(t[18]=o=>p.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[I,p.value.secure_c_ses]]),t[57]||(t[57]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),V(s("input",{"onUpdate:modelValue":t[19]||(t[19]=o=>p.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,p.value.csesidx]]),t[58]||(t[58]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),V(s("input",{"onUpdate:modelValue":t[20]||(t[20]=o=>p.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,p.value.config_id]]),t[59]||(t[59]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),V(s("input",{"onUpdate:modelValue":t[21]||(t[21]=o=>p.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,p.value.host_c_oses]]),t[60]||(t[60]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),V(s("input",{"onUpdate:modelValue":t[22]||(t[22]=o=>p.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[I,p.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ve}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Vt}," 保存 ")])])])):f("",!0)])),(r(),ke(Se,{to:"body"},[E.value?(r(),l("div",$o,[s("div",Ro,[s("div",Vo,[t[61]||(t[61]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",Io,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:$t},n(j.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Re}," 关闭 ")])]),L.value?(r(),l("div",jo,n(L.value),1)):f("",!0),s("div",Do,[V(s("textarea",{"onUpdate:modelValue":t[23]||(t[23]=o=>H.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:j.value},null,8,Mo),[[I,H.value]])]),s("div",Oo,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Re}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Rt,disabled:j.value}," 保存 ",8,Bo)])])])):f("",!0)]))],64))}});export{Jo as default};
static/assets/Accounts-YFw0nAMh.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{g as b,C as Ke,h as d,d as We,D as Xe,i as H,o as Ye,j as Ze,c as l,a as s,x as R,y as Se,m as C,v as V,b as v,A as et,t as n,n as h,u as $,F as Q,r as ee,f as Te,T as Le,w as A,e as r}from"./index-Bh_hLcqi.js";import{_ as tt}from"./SelectMenu.vue_vue_type_script_setup_true_lang-8KWxq5-G.js";import{_ as te}from"./Checkbox.vue_vue_type_script_setup_true_lang-DsgZPRUK.js";import{_ as st}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-B-fGXmXJ.js";import{u as ot}from"./useConfirmDialog-CSNT_h0m.js";import{_ as rt}from"./HelpTip.vue_vue_type_script_setup_true_lang-Be-NxYdK.js";const x={list:()=>b.get("/admin/accounts"),getConfig:()=>b.get("/admin/accounts-config"),updateConfig:u=>b.put("/admin/accounts-config",u),delete:u=>b.delete(`/admin/accounts/${u}`),disable:u=>b.put(`/admin/accounts/${u}/disable`),enable:u=>b.put(`/admin/accounts/${u}/enable`),startRegister:(u,m)=>b.post("/admin/register/start",{count:u,domain:m}),getRegisterTask:u=>b.get(`/admin/register/task/${u}`),getRegisterCurrent:()=>b.get("/admin/register/current"),startLogin:u=>b.post("/admin/login/start",u),getLoginTask:u=>b.get(`/admin/login/task/${u}`),getLoginCurrent:()=>b.get("/admin/login/current"),checkLogin:()=>b.post("/admin/login/check")},nt=Ke("accounts",()=>{const u=d([]),m=d(!1);async function w(){m.value=!0;try{const i=await x.list();u.value=Array.isArray(i)?i:i.accounts||[]}finally{m.value=!1}}async function I(i){await x.delete(i),await w()}async function g(i){await x.disable(i),await w()}async function M(i){await x.enable(i),await w()}async function j(i){await Promise.all(i.map(S=>x.enable(S))),await w()}async function c(i){await Promise.all(i.map(S=>x.disable(S))),await w()}async function E(i){await Promise.all(i.map(S=>x.delete(S))),await w()}async function O(i){await x.updateConfig(i),await w()}return{accounts:u,isLoading:m,loadAccounts:w,deleteAccount:I,disableAccount:g,enableAccount:M,bulkEnable:j,bulkDisable:c,bulkDelete:E,updateConfig:O}}),lt={class:"space-y-8"},at={class:"rounded-3xl border border-border bg-card p-6"},it={class:"flex flex-wrap items-center justify-between gap-4"},dt={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},ut={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},ct={key:0},pt={class:"ml-auto flex items-center gap-2 sm:ml-0"},xt={class:"mt-4 flex flex-wrap items-center gap-3"},mt=["disabled"],vt=["disabled"],ft=["disabled"],gt=["disabled"],bt={class:"mt-4 rounded-2xl border border-border bg-background p-4"},yt={class:"flex flex-wrap items-center gap-3"},_t={class:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground"},ht=["disabled"],wt=["disabled"],kt=["disabled"],Ct={key:0,class:"mt-3 rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},Vt={key:1,class:"mt-3 grid gap-2 text-xs text-muted-foreground"},$t={key:0},At={class:"ml-2"},St={class:"ml-2"},Tt={class:"ml-2"},Lt={class:"ml-2"},Dt={key:1},Et={class:"ml-2"},Ut={class:"ml-2"},Rt={class:"ml-2"},jt={class:"ml-2"},zt={key:2,class:"mt-3 grid gap-2"},Nt={key:0,class:"rounded-2xl border border-border bg-muted/30 p-3"},Bt={class:"mt-2 space-y-1 text-[11px] text-muted-foreground"},It={key:1,class:"rounded-2xl border border-border bg-muted/30 p-3"},Mt={class:"mt-2 space-y-1 text-[11px] text-muted-foreground"},Ot={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},Pt=["onClick"],Ft={class:"flex items-start justify-between gap-3"},Jt={class:"mt-1 font-mono text-xs text-foreground"},Ht={class:"flex items-center gap-2"},Qt={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},qt={key:0,class:"mt-1 text-[11px]"},Gt={key:0},Kt={key:1},Wt={class:"mt-1 text-sm font-semibold text-foreground"},Xt={class:"mt-1 text-sm font-semibold text-foreground"},Yt={class:"mt-4 flex flex-wrap items-center gap-2"},Zt=["onClick"],es=["onClick"],ts=["onClick"],ss=["onClick"],os={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},rs={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},ns={class:"min-w-full text-left text-sm"},ls={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},as={class:"py-3 pr-4"},is={class:"py-3 pr-6"},ds={class:"inline-flex items-center gap-2"},us={class:"text-sm text-foreground"},cs={key:0},ps=["onClick"],xs={class:"py-4 pr-6 font-mono text-xs text-foreground"},ms={class:"py-4 pr-6"},vs={class:"py-4 pr-6"},fs={key:0,class:"block text-[11px] text-muted-foreground"},gs={class:"py-4 pr-6 text-xs"},bs={class:"py-4 pr-6 text-xs text-muted-foreground"},ys={class:"py-4 pr-6 text-xs text-muted-foreground"},_s={class:"py-4 text-right"},hs={class:"flex flex-wrap justify-end gap-2"},ws=["onClick"],ks=["onClick"],Cs=["onClick"],Vs=["onClick"],$s={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},As={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Ss={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},Ts={class:"mt-4 space-y-3 text-sm"},Ls={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Ds={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},Es={class:"flex items-center justify-between"},Us={class:"flex items-center gap-2"},Rs={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},js={class:"mt-4"},zs=["readonly"],Ns={class:"mt-6 flex items-center justify-end gap-2"},Bs=["disabled"],Hs=We({__name:"Accounts",setup(u){const m=nt(),{accounts:w,isLoading:I}=Xe(m),g=ot(),M=d(""),j=d("all"),c=d(new Set),E=d("table"),O=d(!1),i=d(""),S=d(!1),T=d(""),z=d(""),L=d(!1),P=d([]),F=d(1),se=d(""),y=d(null),f=d(null),N=d(!1),k=d(!1),_=d(""),p=d({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),q=d(null),ue=d([]),De=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],D=H(()=>{const t=M.value.trim().toLowerCase();return w.value.filter(e=>{const o=!t||e.id.toLowerCase().includes(t),a=j.value==="all"||J(e)===j.value;return o&&a})}),B=H(()=>c.value.size),oe=H(()=>D.value.length>0&&D.value.every(t=>c.value.has(t.id))),G=async()=>{await m.loadAccounts(),c.value=new Set};Ye(async()=>{await G(),await He()});const re=H(()=>y.value?.logs?.slice(-8)||[]),ne=H(()=>f.value?.logs?.slice(-8)||[]);Ze(()=>{Y(),Z()});const J=t=>t.cooldown_reason?.includes("429")&&t.cooldown_seconds>0?"429限流":t.cooldown_reason==="错误禁用"?"错误禁用":t.disabled?"手动禁用":t.status==="已过期"?"已过期":t.status==="即将过期"?"即将过期":"正常",ce=t=>{const e=J(t);return e==="429限流"||e==="即将过期"?"bg-amber-200 text-amber-900":e==="错误禁用"||e==="已过期"?"bg-destructive/10 text-destructive":e==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},pe=t=>t.cooldown_reason?.includes("429")&&t.cooldown_seconds>0?!0:t.disabled||t.cooldown_reason==="错误禁用",xe=t=>t==="已过期"?"过期":t==="未设置"?"未设置":t,me=t=>t.status==="已过期"?"text-rose-600":t.status==="即将过期"?"text-amber-700":t.status==="未设置"?"text-muted-foreground":"text-emerald-600",ve=t=>t<60?`${t} 秒`:t<3600?`${Math.ceil(t/60)} 分钟`:`${(t/3600).toFixed(1)} 小时`,le=t=>t.cooldown_seconds>0?"text-amber-700":t.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",fe=t=>{const e=J(t);return e==="手动禁用"||e==="已过期"?"bg-muted/70":""},K=t=>{const e=new Set(c.value);e.has(t)?e.delete(t):e.add(t),c.value=e},ge=()=>{if(oe.value){c.value=new Set;return}c.value=new Set(D.value.map(t=>t.id))},Ee=(t,e)=>t.id||`account_${e+1}`,Ue=async()=>(await x.getConfig()).accounts.map((e,o)=>({...e,id:Ee(e,o)})),be=t=>`${t.time} [${t.level}] ${t.message}`,Re=(t,e)=>{let o=-1;for(let U=0;U<t.length;U+=1)if(t[U].id===e){o=U;break}if(o===-1)return i.value="未找到对应账号配置。",!1;const a=t[o];return p.value={id:a.id,secure_c_ses:a.secure_c_ses,csesidx:a.csesidx,config_id:a.config_id,host_c_oses:a.host_c_oses,expires_at:a.expires_at},ue.value=t,q.value=o,O.value=!0,!0},ye=async t=>{i.value="";try{const e=await Ue();Re(e,t)}catch(e){i.value=e.message||"加载账号配置失败"}},je=async()=>{T.value="";try{const t=await x.getConfig();P.value=Array.isArray(t.accounts)?t.accounts:[],z.value=JSON.stringify(he(P.value),null,2),L.value=!0,S.value=!0}catch(t){T.value=t.message||"加载账号配置失败"}},ae=()=>{S.value=!1,T.value="",L.value=!1},_e=()=>{const t=JSON.parse(z.value);if(!Array.isArray(t))throw new Error("配置格式必须是数组。");return t},ze=t=>typeof t!="string"||!t?t:t.length<=6?`${t.slice(0,2)}****`:`${t.slice(0,3)}****`,he=t=>{const e=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password"]);return t.map(o=>{const a={...o};return e.forEach(U=>{const Ae=a[U];Ae&&(a[U]=ze(Ae))}),a})},Ne=()=>{if(T.value="",!L.value){try{P.value=_e()}catch(t){T.value=t.message||"JSON 格式错误";return}z.value=JSON.stringify(he(P.value),null,2),L.value=!0;return}z.value=JSON.stringify(P.value,null,2),L.value=!1},Be=async()=>{T.value="";try{const t=_e();await m.updateConfig(t),ae()}catch(t){T.value=t.message||"保存失败"}},ie=()=>{O.value=!1,i.value=""},Ie=async()=>{if(q.value===null)return;const t=[...ue.value];t[q.value]={...t[q.value],id:p.value.id,secure_c_ses:p.value.secure_c_ses,csesidx:p.value.csesidx,config_id:p.value.config_id,host_c_oses:p.value.host_c_oses||void 0,expires_at:p.value.expires_at||void 0};try{await m.updateConfig(t),ie()}catch(e){i.value=e.message||"保存失败"}},Me=async()=>{await m.bulkEnable(Array.from(c.value)),c.value=new Set},Oe=async()=>{await g.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"})&&(await m.bulkDisable(Array.from(c.value)),c.value=new Set)},Pe=async()=>{await g.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"})&&(await m.bulkDelete(Array.from(c.value)),c.value=new Set)},we=async t=>{await m.enableAccount(t)},ke=async t=>{await g.ask({title:"禁用账号",message:"确定要禁用该账号吗?"})&&await m.disableAccount(t)},Ce=async t=>{await g.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"})&&await m.deleteAccount(t)};let W=null,X=null;const Y=()=>{W!==null&&(window.clearInterval(W),W=null)},Z=()=>{X!==null&&(window.clearInterval(X),X=null)},Ve=t=>t==="pending"?"等待中":t==="running"?"执行中":t==="success"?"成功":t==="failed"?"失败":t,Fe=async t=>{const e=await x.getRegisterTask(t);y.value=e,e.status!=="running"&&e.status!=="pending"&&(N.value=!1,Y(),await G())},Je=async t=>{const e=await x.getLoginTask(t);f.value=e,e.status!=="running"&&e.status!=="pending"&&(k.value=!1,Z(),await G())},$e=t=>{Y(),W=window.setInterval(()=>{Fe(t).catch(e=>{_.value=e?.message||"注册任务更新失败",Y(),N.value=!1})},3e3)},de=t=>{Z(),X=window.setInterval(()=>{Je(t).catch(e=>{_.value=e?.message||"刷新任务更新失败",Z(),k.value=!1})},3e3)},He=async()=>{try{const t=await x.getRegisterCurrent();t&&"id"in t?(y.value=t,(t.status==="running"||t.status==="pending")&&(N.value=!0,$e(t.id))):y.value=null}catch(t){_.value=t.message||"加载注册任务失败"}try{const t=await x.getLoginCurrent();t&&"id"in t?(f.value=t,(t.status==="running"||t.status==="pending")&&(k.value=!0,de(t.id))):f.value=null}catch(t){_.value=t.message||"加载刷新任务失败"}},Qe=async()=>{_.value="",N.value=!0;const t=se.value.trim();try{const e=Number.isFinite(F.value)&&F.value>0?F.value:void 0,o=await x.startRegister(e,t||void 0);y.value=o,$e(o.id)}catch(e){_.value=e.message||"启动注册失败",N.value=!1}},qe=async()=>{if(c.value.size){_.value="",k.value=!0;try{const t=await x.startLogin(Array.from(c.value));f.value=t,de(t.id)}catch(t){_.value=t.message||"启动刷新失败",k.value=!1}}},Ge=async()=>{_.value="",k.value=!0;try{await x.checkLogin();const t=await x.getLoginCurrent();if(t&&"id"in t){f.value=t,de(t.id);return}f.value=null,k.value=!1}catch(t){_.value=t.message||"触发刷新失败",k.value=!1}};return(t,e)=>(r(),l(Q,null,[s("div",lt,[s("section",at,[s("div",it,[s("div",dt,[C(s("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>M.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[V,M.value]]),R(tt,{modelValue:j.value,"onUpdate:modelValue":e[1]||(e[1]=o=>j.value=o),options:De},null,8,["modelValue"])]),s("div",ut,[R(te,{modelValue:oe.value,"onUpdate:modelValue":ge},{default:et(()=>[...e[18]||(e[18]=[Te(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"共 "+n(D.value.length)+" 个账号",1),B.value?(r(),l("span",ct,"已选 "+n(B.value)+" 个",1)):v("",!0),s("div",pt,[s("button",{type:"button",class:h(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",E.value==="table"?"bg-accent text-accent-foreground":""]),onClick:e[2]||(e[2]=o=>E.value="table"),"aria-label":"列表视图"},[...e[19]||(e[19]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:h(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",E.value==="card"?"bg-accent text-accent-foreground":""]),onClick:e[3]||(e[3]=o=>E.value="card"),"aria-label":"卡片视图"},[...e[20]||(e[20]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",xt,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:je}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:$(I),onClick:G}," 刷新列表 ",8,mt),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:!B.value,onClick:Me}," 批量启用 ",8,vt),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:!B.value,onClick:Oe}," 批量禁用 ",8,ft),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-destructive transition-colors hover:border-destructive hover:text-destructive",disabled:!B.value,onClick:Pe}," 批量删除 ",8,gt)]),s("div",bt,[s("div",yt,[s("div",_t,[e[21]||(e[21]=s("span",{class:"text-foreground"},"自动注册",-1)),C(s("input",{"onUpdate:modelValue":e[4]||(e[4]=o=>F.value=o),type:"number",min:"1",class:"w-20 rounded-full border border-input bg-background px-3 py-1 text-xs"},null,512),[[V,F.value,void 0,{number:!0}]]),C(s("input",{"onUpdate:modelValue":e[5]||(e[5]=o=>se.value=o),type:"text",class:"w-40 rounded-full border border-input bg-background px-3 py-1 text-xs",placeholder:"指定域名(可选)"},null,512),[[V,se.value]])]),s("button",{class:"rounded-full border border-border px-4 py-2 text-xs font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:N.value,onClick:Qe}," 开始注册 ",8,ht),s("button",{class:"rounded-full border border-border px-4 py-2 text-xs font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:k.value,onClick:Ge}," 刷新过期 ",8,wt),s("button",{class:"rounded-full border border-border px-4 py-2 text-xs font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:!B.value||k.value,onClick:qe}," 刷新选中 ",8,kt)]),_.value?(r(),l("div",Ct,n(_.value),1)):v("",!0),y.value||f.value?(r(),l("div",Vt,[y.value?(r(),l("div",$t,[e[22]||(e[22]=s("span",{class:"font-medium text-foreground"},"注册任务",-1)),s("span",At,"状态:"+n(Ve(y.value.status)),1),s("span",St,"进度:"+n(y.value.progress)+"/"+n(y.value.count),1),s("span",Tt,"成功:"+n(y.value.success_count),1),s("span",Lt,"失败:"+n(y.value.fail_count),1)])):v("",!0),f.value?(r(),l("div",Dt,[e[23]||(e[23]=s("span",{class:"font-medium text-foreground"},"刷新任务",-1)),s("span",Et,"状态:"+n(Ve(f.value.status)),1),s("span",Ut,"进度:"+n(f.value.progress)+"/"+n(f.value.account_ids.length),1),s("span",Rt,"成功:"+n(f.value.success_count),1),s("span",jt,"失败:"+n(f.value.fail_count),1)])):v("",!0)])):v("",!0),re.value.length||ne.value.length?(r(),l("div",zt,[re.value.length?(r(),l("div",Nt,[e[24]||(e[24]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",Bt,[(r(!0),l(Q,null,ee(re.value,(o,a)=>(r(),l("div",{key:`reg-${a}`,class:"font-mono"},n(be(o)),1))),128))])])):v("",!0),ne.value.length?(r(),l("div",It,[e[25]||(e[25]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",Mt,[(r(!0),l(Q,null,ee(ne.value,(o,a)=>(r(),l("div",{key:`login-${a}`,class:"font-mono"},n(be(o)),1))),128))])])):v("",!0)])):v("",!0)]),E.value==="card"?(r(),l("div",Ot,[(r(!0),l(Q,null,ee(D.value,o=>(r(),l("div",{key:o.id,class:h(["rounded-2xl border border-border bg-card p-4",fe(o)]),onClick:a=>K(o.id)},[s("div",Ft,[s("div",null,[e[26]||(e[26]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",Jt,n(o.id),1)]),s("div",Ht,[R(te,{modelValue:c.value.has(o.id),"onUpdate:modelValue":a=>K(o.id),onClick:e[6]||(e[6]=A(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:h(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",ce(o)])},n(J(o)),3)])]),s("div",Qt,[s("div",null,[e[27]||(e[27]=s("p",null,"剩余时间",-1)),s("p",{class:h(["mt-1 text-sm font-semibold",me(o)])},n(xe(o.remaining_display)),3),o.expires_at?(r(),l("p",qt,n(o.expires_at),1)):v("",!0)]),s("div",null,[e[28]||(e[28]=s("p",null,"冷却",-1)),s("p",{class:h(["mt-1",le(o)])},[o.cooldown_seconds>0?(r(),l("span",Gt,n(ve(o.cooldown_seconds))+" · "+n(o.cooldown_reason),1)):(r(),l("span",Kt,n(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[e[29]||(e[29]=s("p",null,"失败数",-1)),s("p",Wt,n(o.error_count),1)]),s("div",null,[e[30]||(e[30]=s("p",null,"会话数",-1)),s("p",Xt,n(o.conversation_count),1)])]),s("div",Yt,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(a=>ye(o.id),["stop"])}," 编辑 ",8,Zt),pe(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[7]||(e[7]=A(()=>{},["stop"])),a=>we(o.id)]}," 启用 ",8,es)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[8]||(e[8]=A(()=>{},["stop"])),a=>ke(o.id)]}," 禁用 ",8,ts)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[e[9]||(e[9]=A(()=>{},["stop"])),a=>Ce(o.id)]}," 删除 ",8,ss)])],10,Pt))),128)),!D.value.length&&!$(I)?(r(),l("div",os," 暂无账号数据,请检查后台配置。 ")):v("",!0)])):(r(),l("div",rs,[s("table",ns,[s("thead",ls,[s("tr",null,[s("th",as,[R(te,{modelValue:oe.value,"onUpdate:modelValue":ge},null,8,["modelValue"])]),e[32]||(e[32]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),e[33]||(e[33]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",is,[s("span",ds,[e[31]||(e[31]=Te(" 剩余/过期 ",-1)),R(rt,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),e[34]||(e[34]=s("th",{class:"py-3 pr-6"},"冷却",-1)),e[35]||(e[35]=s("th",{class:"py-3 pr-6"},"失败数",-1)),e[36]||(e[36]=s("th",{class:"py-3 pr-6"},"会话数",-1)),e[37]||(e[37]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",us,[!D.value.length&&!$(I)?(r(),l("tr",cs,[...e[38]||(e[38]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):v("",!0),(r(!0),l(Q,null,ee(D.value,o=>(r(),l("tr",{key:o.id,class:h(["border-t border-border",fe(o)]),onClick:a=>K(o.id)},[s("td",{class:"py-4 pr-4",onClick:e[10]||(e[10]=A(()=>{},["stop"]))},[R(te,{modelValue:c.value.has(o.id),"onUpdate:modelValue":a=>K(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",xs,n(o.id),1),s("td",ms,[s("span",{class:h(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",ce(o)])},n(J(o)),3)]),s("td",vs,[s("div",{class:h(["text-sm font-semibold",me(o)])},n(xe(o.remaining_display)),3),o.expires_at?(r(),l("span",fs,n(o.expires_at),1)):v("",!0)]),s("td",gs,[o.cooldown_seconds>0?(r(),l("span",{key:0,class:h(le(o))},n(ve(o.cooldown_seconds))+" · "+n(o.cooldown_reason),3)):(r(),l("span",{key:1,class:h(le(o))},n(o.cooldown_reason||"无冷却"),3))]),s("td",bs,n(o.error_count),1),s("td",ys,n(o.conversation_count),1),s("td",_s,[s("div",hs,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(a=>ye(o.id),["stop"])}," 编辑 ",8,ws),pe(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(a=>we(o.id),["stop"])}," 启用 ",8,ks)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(a=>ke(o.id),["stop"])}," 禁用 ",8,Cs)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:A(a=>Ce(o.id),["stop"])}," 删除 ",8,Vs)])])],10,ps))),128))])])]))])]),R(st,{open:$(g).open.value,title:$(g).title.value,message:$(g).message.value,"confirm-text":$(g).confirmText.value,"cancel-text":$(g).cancelText.value,onConfirm:$(g).confirm,onCancel:$(g).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(r(),Se(Le,{to:"body"},[O.value?(r(),l("div",$s,[s("div",As,[s("div",{class:"flex items-center justify-between"},[e[39]||(e[39]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:ie}," 关闭 ")]),i.value?(r(),l("div",Ss,n(i.value),1)):v("",!0),s("div",Ts,[e[40]||(e[40]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),C(s("input",{"onUpdate:modelValue":e[11]||(e[11]=o=>p.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[V,p.value.id]]),e[41]||(e[41]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),C(s("textarea",{"onUpdate:modelValue":e[12]||(e[12]=o=>p.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[V,p.value.secure_c_ses]]),e[42]||(e[42]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),C(s("input",{"onUpdate:modelValue":e[13]||(e[13]=o=>p.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,p.value.csesidx]]),e[43]||(e[43]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),C(s("input",{"onUpdate:modelValue":e[14]||(e[14]=o=>p.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,p.value.config_id]]),e[44]||(e[44]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),C(s("input",{"onUpdate:modelValue":e[15]||(e[15]=o=>p.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,p.value.host_c_oses]]),e[45]||(e[45]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),C(s("input",{"onUpdate:modelValue":e[16]||(e[16]=o=>p.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[V,p.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:ie}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Ie}," 保存 ")])])])):v("",!0)])),(r(),Se(Le,{to:"body"},[S.value?(r(),l("div",Ls,[s("div",Ds,[s("div",Es,[e[46]||(e[46]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",Us,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Ne},n(L.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:ae}," 关闭 ")])]),T.value?(r(),l("div",Rs,n(T.value),1)):v("",!0),s("div",js,[C(s("textarea",{"onUpdate:modelValue":e[17]||(e[17]=o=>z.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:L.value},null,8,zs),[[V,z.value]])]),s("div",Ns,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:ae}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Be,disabled:L.value}," 保存 ",8,Bs)])])])):v("",!0)]))],64))}});export{Hs as default};
static/assets/Accounts-kVPSbBOv.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ import{g as E,C as os,h as i,d as rs,D as ls,i as J,o as ns,z as as,j as is,c as n,a as s,p as G,m as Re,q as R,v as V,s as $t,t as a,n as x,u as j,b as g,f as ee,F as ge,r as Ve,T as je,E as ds,w as M,e as l,G as us}from"./index-Dt-VnrHx.js";import{_ as cs}from"./SelectMenu.vue_vue_type_script_setup_true_lang-r1ha8_PD.js";import{_ as be}from"./Checkbox.vue_vue_type_script_setup_true_lang-D6uSa7ue.js";import{_ as fs}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-jpm-Quh6.js";import{u as vs}from"./useConfirmDialog-Dz9xMRf2.js";import{_ as ms}from"./HelpTip.vue_vue_type_script_setup_true_lang-DV7kZRSO.js";const w={list:()=>E.get("/admin/accounts"),getConfig:()=>E.get("/admin/accounts-config"),updateConfig:y=>E.put("/admin/accounts-config",y),delete:y=>E.delete(`/admin/accounts/${y}`),disable:y=>E.put(`/admin/accounts/${y}/disable`),enable:y=>E.put(`/admin/accounts/${y}/enable`),startRegister:(y,k)=>E.post("/admin/register/start",{count:y,domain:k}),getRegisterTask:y=>E.get(`/admin/register/task/${y}`),getRegisterCurrent:()=>E.get("/admin/register/current"),startLogin:y=>E.post("/admin/login/start",y),getLoginTask:y=>E.get(`/admin/login/task/${y}`),getLoginCurrent:()=>E.get("/admin/login/current"),checkLogin:()=>E.post("/admin/login/check")},xs=os("accounts",()=>{const y=i([]),k=i(!1);async function A(){k.value=!0;try{const p=await w.list();y.value=Array.isArray(p)?p:p.accounts||[]}finally{k.value=!1}}async function ne(p){await w.delete(p),await A()}async function T(p){await w.disable(p),await A()}async function d(p){await w.enable(p),await A()}async function ae(p){await Promise.all(p.map($=>w.enable($))),await A()}async function te(p){await Promise.all(p.map($=>w.disable($))),await A()}async function b(p){await Promise.all(p.map($=>w.delete($))),await A()}async function Y(p){await w.updateConfig(p),await A()}return{accounts:y,isLoading:k,loadAccounts:A,deleteAccount:ne,disableAccount:T,enableAccount:d,bulkEnable:ae,bulkDisable:te,bulkDelete:b,updateConfig:Y}}),ps={class:"space-y-8"},gs={class:"rounded-3xl border border-border bg-card p-6"},bs={class:"flex flex-wrap items-center justify-between gap-4"},ys={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},_s={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},hs={class:"ml-auto flex items-center gap-2 sm:ml-0"},ws={class:"mt-4 flex flex-wrap items-center gap-2"},ks=["disabled"],Cs=["disabled"],Ts={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},Ss=["disabled"],$s=["disabled"],Is=["disabled"],Es=["disabled"],Ls=["disabled"],As={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},Rs=["onClick"],Vs={class:"flex items-start justify-between gap-3"},js={class:"mt-1 font-mono text-xs text-foreground"},Ms={class:"flex items-center gap-2"},Ds={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},Os={key:0,class:"mt-1 text-[11px]"},Bs={key:0},Ns={key:1},Us={class:"mt-1 text-sm font-semibold text-foreground"},zs={class:"mt-1 text-sm font-semibold text-foreground"},Ps={class:"mt-4 flex flex-wrap items-center gap-2"},Fs=["onClick"],Ks=["onClick"],Hs=["onClick"],Js=["onClick"],Gs={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Ys={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},qs={class:"min-w-full text-left text-sm"},Qs={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Xs={class:"py-3 pr-4"},Ws={class:"py-3 pr-6"},Zs={class:"inline-flex items-center gap-2"},eo={class:"text-sm text-foreground"},to={key:0},so=["onClick"],oo={class:"py-4 pr-6 font-mono text-xs text-foreground"},ro={class:"py-4 pr-6"},lo={class:"py-4 pr-6"},no={key:0,class:"block text-[11px] text-muted-foreground"},ao={class:"py-4 pr-6 text-xs"},io={class:"py-4 pr-6 text-xs text-muted-foreground"},uo={class:"py-4 pr-6 text-xs text-muted-foreground"},co={class:"py-4 text-right"},fo={class:"flex flex-wrap justify-end gap-2"},vo=["onClick"],mo=["onClick"],xo=["onClick"],po=["onClick"],go={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},bo={class:"flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},yo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},_o={class:"mt-1 text-xs text-muted-foreground"},ho={class:"scrollbar-slim flex-1 overflow-y-auto px-6 py-4"},wo={class:"space-y-4 text-sm"},ko={class:"flex rounded-full border border-border bg-muted/30 p-1 text-xs"},Co={key:0,class:"space-y-4"},To={key:1,class:"space-y-4"},So={key:0,class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-600"},$o={class:"border-t border-border/60 px-6 py-4"},Io={class:"flex items-center justify-end gap-2"},Eo=["disabled"],Lo=["disabled"],Ao={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Ro={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},Vo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},jo={class:"flex items-center gap-2"},Mo=["disabled"],Do={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},Oo={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},Bo={key:1,class:"grid gap-3 text-xs text-muted-foreground"},No={key:0,class:"space-y-1"},Uo={class:"flex items-center gap-2 font-medium text-foreground"},zo={class:"flex flex-wrap gap-x-4 gap-y-1"},Po={key:1,class:"space-y-1"},Fo={class:"flex items-center gap-2 font-medium text-foreground"},Ko={class:"flex flex-wrap gap-x-4 gap-y-1"},Ho={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},Jo={key:0,class:"space-y-2"},Go={class:"space-y-1 text-[11px] text-muted-foreground"},Yo={key:1,class:"mt-4 space-y-2"},qo={class:"space-y-1 text-[11px] text-muted-foreground"},Qo={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},Xo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Wo={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Zo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},er={class:"mt-4 space-y-3 text-sm"},tr={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},sr={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},or={class:"flex items-center justify-between"},rr={class:"flex items-center gap-2"},lr={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},nr={class:"mt-4"},ar=["readonly"],ir={class:"mt-6 flex items-center justify-end gap-2"},dr=["disabled"],Je="accounts-register-task-cache",Ge="accounts-login-task-cache",Ye="accounts-register-log-clear",qe="accounts-login-log-clear",Qe="accounts-register-task-cleared-id",Xe="accounts-login-task-cleared-id",It="1970-01-01 00:00:00",pr=rs({__name:"Accounts",setup(y){const k=xs(),{accounts:A,isLoading:ne}=ls(k),T=vs(),d=ds(),ae=i(""),te=i("all"),b=i(new Set),Y=i("table"),p=i(!1),$=i(""),Me=i(!1),D=i(""),se=i(""),N=i(!1),ie=i([]),de=i(1),ye=i(!1),U=i("register"),ue=i(""),z=i(""),_e=i(!1),q=i(!1),P=i(!1),De=i(null),he=i(null),we=i(null),F=i(null),K=i(null),oe=i(0),re=i(0),ce=i(!1),c=i(null),f=i(null),We=i(null),O=i(!1),S=i(!1),_=i(""),h=i({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),ke=i(null),Ze=i([]),Et=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],H=J(()=>{const t=ae.value.trim().toLowerCase();return A.value.filter(e=>{const o=!t||e.id.toLowerCase().includes(t),r=te.value==="all"||ve(e)===te.value;return o&&r})}),B=J(()=>b.value.size),Oe=J(()=>H.value.length>0&&H.value.every(t=>b.value.has(t.id))),fe=async()=>{await k.loadAccounts(),b.value=new Set,P.value=!1},et=t=>{try{const e=localStorage.getItem(t);return e?JSON.parse(e):null}catch{return null}},tt=t=>{try{return localStorage.getItem(t)||null}catch{return null}},Ce=(t,e)=>{try{if(e){localStorage.setItem(t,e);return}localStorage.removeItem(t)}catch{}},st=(t,e)=>{try{localStorage.setItem(t,JSON.stringify(e))}catch{}},ot=t=>{try{localStorage.removeItem(t)}catch{}},rt=t=>{const e=localStorage.getItem(t),o=Number(e);return Number.isFinite(o)?o:0},Te=(t,e)=>{try{localStorage.setItem(t,String(e))}catch{}},Be=(t,e=!0)=>{t&&(t.id&&t.id===F.value||(t.id&&F.value&&t.id!==F.value&&(F.value=null,Ce(Qe,null)),c.value=t,t.id&&t.id!==he.value&&(he.value=t.id,oe.value=0,Te(Ye,0)),e&&st(Je,t)))},Se=(t,e=!0)=>{t&&(t.id&&t.id===K.value||(t.id&&K.value&&t.id!==K.value&&(K.value=null,Ce(Xe,null)),f.value=t,t.id&&t.id!==we.value&&(we.value=t.id,re.value=0,Te(qe,0)),e&&st(Ge,t)))},Lt=()=>{oe.value=rt(Ye),re.value=rt(qe),F.value=tt(Qe),K.value=tt(Xe);const t=et(Je);t&&t.id!==F.value&&(c.value=t,he.value=t.id||null);const e=et(Ge);e&&e.id!==K.value&&(f.value=e,we.value=e.id||null)},At=()=>{ye.value=!0,U.value="register",ue.value="",z.value="",_e.value=!1,ce.value=!1},Ne=()=>{ye.value=!1},Rt=t=>{const e=[],o=[];return t.split(/\r?\n/).map(u=>u.trim()).filter(Boolean).forEach((u,m)=>{const v=u.split("----").map(I=>I.trim()),C=m+1;if(v.length){if(v[0].toLowerCase()==="duckmail"){if(v.length<3||!v[1]||!v[2]){o.push(`第 ${C} 行格式错误(duckmail)`);return}const I=v[1],Ae=v.slice(2).join("----");e.push({id:I,secure_c_ses:"",csesidx:"",config_id:"",expires_at:It,mail_provider:"duckmail",mail_address:I,mail_password:Ae});return}if(v.length>=4&&v[0]&&v[2]&&v[3]){const I=v[0],Ae=v[1]||"",L=v[2],ss=v.slice(3).join("----");e.push({id:I,secure_c_ses:"",csesidx:"",config_id:"",expires_at:It,mail_provider:"microsoft",mail_address:I,mail_password:Ae,mail_client_id:L,mail_refresh_token:ss,mail_tenant:"consumers"});return}o.push(`第 ${C} 行格式错误`)}}),{items:e,errors:o}},Vt=async()=>{if(z.value="",!ue.value.trim()){z.value="请输入导��内容";return}const{items:t,errors:e}=Rt(ue.value);if(!t.length){z.value=e.length?e.join(","):"未识别到有效账号";return}if(e.length){z.value=e.slice(0,3).join(",");return}_e.value=!0;try{const r=[...await vt()],u=new Map(r.map((C,I)=>[C.id,I])),m=[];t.forEach(C=>{const I=u.get(C.id||"");if(I===void 0){r.push(C),m.push(C.id);return}const L={...r[I],mail_provider:C.mail_provider,mail_address:C.mail_address};C.mail_provider==="microsoft"?(L.mail_client_id=C.mail_client_id,L.mail_refresh_token=C.mail_refresh_token,L.mail_tenant=C.mail_tenant,L.mail_password=C.mail_password):(L.mail_password=C.mail_password,L.mail_client_id=void 0,L.mail_refresh_token=void 0,L.mail_tenant=void 0),r[I]=L,m.push(C.id)}),await k.updateConfig(r),await fe(),b.value=new Set(m),d.success(`成功导入 ${m.length} 个账户`),Ne(),await T.ask({title:"导入成功",message:`已导入 ${m.length} 个账户并自动选中。是否立即刷新这些账户以获取 Cookie?`,confirmText:"立即刷新",cancelText:"稍后手动刷新"})&&await St()}catch(o){z.value=o.message||"导入失败",d.error(o.message||"导入失败")}finally{_e.value=!1}},jt=async()=>{try{const t=[],e=c.value?.id,o=f.value?.id;if(e&&!$e(e)&&t.push(kt(e)),o&&!Ie(o)&&t.push(Ct(o)),!t.length){await He();return}await Promise.all(t)}catch(t){_.value=t?.message||"任务状态更新失败"}},Ue=async()=>{q.value=!0,await jt()},Mt=()=>{q.value=!1},Dt=()=>{const t=c.value?.id||null,e=f.value?.id||null;F.value=t,K.value=e,Ce(Qe,t),Ce(Xe,e),oe.value=c.value?.logs?.length||0,re.value=f.value?.logs?.length||0,Te(Ye,oe.value),Te(qe,re.value),c.value=null,f.value=null,he.value=null,we.value=null,_.value="",O.value=!1,S.value=!1,W(),Z(),ot(Je),ot(Ge)},$e=t=>!!(t&&t===F.value),Ie=t=>!!(t&&t===K.value),Ot=()=>{P.value=!P.value},le=()=>{P.value=!1},lt=t=>{if(!P.value)return;const e=t.target;De.value&&!De.value.contains(e)&&(P.value=!1)};ns(async()=>{Lt(),await fe(),await He(),Zt(),document.addEventListener("click",lt)});const Q=J(()=>{const t=c.value?.logs||[];return oe.value?t.slice(oe.value):t}),X=J(()=>{const t=f.value?.logs||[];return re.value?t.slice(re.value):t}),Bt=J(()=>!!_.value||!!c.value||!!f.value||Q.value.length>0||X.value.length>0),Nt=async()=>{await us();const t=We.value;t&&(t.scrollTop=t.scrollHeight)};as([Q,X,q],async()=>{q.value&&await Nt()},{deep:!0});const Ut=J(()=>{const t=c.value?.status,e=f.value?.status;return t==="running"||t==="pending"||e==="running"||e==="pending"}),zt=J(()=>{if(_.value)return"bg-rose-500";if(Ut.value)return"bg-sky-400";const t=[];if(c.value){const u=c.value.success_count??0,m=c.value.fail_count??0,v=c.value.count??u+m;t.push({success:u,fail:m,total:v,status:c.value.status})}if(f.value){const u=f.value.success_count??0,m=f.value.fail_count??0,v=f.value.account_ids?.length??u+m;t.push({success:u,fail:m,total:v,status:f.value.status})}if(!t.length)return"bg-muted-foreground";const e=t.reduce((u,m)=>u+m.success,0),o=t.reduce((u,m)=>u+m.fail,0),r=t.reduce((u,m)=>u+(m.total||0),0);if(e>0&&o>0)return"bg-amber-400";if(o>0&&e===0)return"bg-rose-500";if(e>0&&o===0)return"bg-emerald-400";if(r===0){const u=t.every(v=>v.status==="success");if(t.some(v=>v.status==="failed"))return"bg-rose-500";if(u)return"bg-emerald-400"}return"bg-muted-foreground"});is(()=>{W(),Z(),Wt(),document.removeEventListener("click",lt)});const ve=t=>t.cooldown_reason?.includes("429")&&t.cooldown_seconds>0?"429限流":t.cooldown_reason==="错误禁用"?"错误禁用":t.disabled?"手动禁用":t.status==="已过期"?"已过期":t.status==="即将过期"?"即将过期":"正常",nt=t=>{const e=ve(t);return e==="429限流"||e==="即将过期"?"bg-amber-200 text-amber-900":e==="错误禁用"||e==="已过期"?"bg-destructive/10 text-destructive":e==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},at=t=>t.cooldown_reason?.includes("429")&&t.cooldown_seconds>0?!0:t.disabled||t.cooldown_reason==="错误禁用",it=t=>t==="已过期"?"过期":t==="未设置"?"未设置":t,dt=t=>t.status==="已过期"?"text-rose-600":t.status==="即将过期"?"text-amber-700":t.status==="未设置"?"text-muted-foreground":"text-emerald-600",ut=t=>t<60?`${t} 秒`:t<3600?`${Math.ceil(t/60)} 分钟`:`${(t/3600).toFixed(1)} 小时`,ze=t=>t.cooldown_seconds>0?"text-amber-700":t.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",ct=t=>{const e=ve(t);return e==="手动禁用"||e==="已过期"?"bg-muted/70":""},Ee=t=>{const e=new Set(b.value);e.has(t)?e.delete(t):e.add(t),b.value=e},ft=()=>{if(Oe.value){b.value=new Set;return}b.value=new Set(H.value.map(t=>t.id))},Pt=(t,e)=>t.id||`account_${e+1}`,vt=async()=>(await w.getConfig()).accounts.map((e,o)=>({...e,id:Pt(e,o)})),mt=t=>`${t.time} [${t.level}] ${t.message}`,Ft=(t,e)=>{let o=-1;for(let u=0;u<t.length;u+=1)if(t[u].id===e){o=u;break}if(o===-1)return $.value="未找到对应账号配置。",!1;const r=t[o];return h.value={id:r.id,secure_c_ses:r.secure_c_ses,csesidx:r.csesidx,config_id:r.config_id,host_c_oses:r.host_c_oses,expires_at:r.expires_at},Ze.value=t,ke.value=o,p.value=!0,!0},xt=async t=>{$.value="";try{const e=await vt();Ft(e,t)}catch(e){$.value=e.message||"加载账号配置失败"}},Kt=async()=>{D.value="";try{const t=await w.getConfig();ie.value=Array.isArray(t.accounts)?t.accounts:[],se.value=JSON.stringify(gt(ie.value),null,2),N.value=!0,Me.value=!0}catch(t){D.value=t.message||"加载账号配置失败"}},Pe=()=>{Me.value=!1,D.value="",N.value=!1},pt=()=>{const t=JSON.parse(se.value);if(!Array.isArray(t))throw new Error("配置格式必须是数组。");return t},Ht=t=>typeof t!="string"||!t?t:t.length<=6?`${t.slice(0,2)}****`:`${t.slice(0,3)}****`,gt=t=>{const e=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password","mail_refresh_token","mail_client_id"]);return t.map(o=>{const r={...o};return e.forEach(u=>{const m=r[u];m&&(r[u]=Ht(m))}),r})},Jt=()=>{if(D.value="",!N.value){try{ie.value=pt()}catch(t){D.value=t.message||"JSON 格式错误";return}se.value=JSON.stringify(gt(ie.value),null,2),N.value=!0;return}se.value=JSON.stringify(ie.value,null,2),N.value=!1},Gt=async()=>{D.value="";try{const t=pt();await k.updateConfig(t),d.success("配置保存成功"),Pe()}catch(t){D.value=t.message||"保存失败",d.error(t.message||"保存失败")}},Fe=()=>{p.value=!1,$.value=""},Yt=async()=>{if(ke.value===null)return;const t=[...Ze.value];t[ke.value]={...t[ke.value],id:h.value.id,secure_c_ses:h.value.secure_c_ses,csesidx:h.value.csesidx,config_id:h.value.config_id,host_c_oses:h.value.host_c_oses||void 0,expires_at:h.value.expires_at||void 0};try{await k.updateConfig(t),d.success("账号编辑成功"),Fe()}catch(e){$.value=e.message||"保存失败",d.error(e.message||"保存失败")}},qt=async()=>{try{await k.bulkEnable(Array.from(b.value)),d.success("批量启用成功"),b.value=new Set}catch(t){d.error(t.message||"批量启用失败")}},Qt=async()=>{if(await T.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"}))try{await k.bulkDisable(Array.from(b.value)),d.success("批量禁用成功"),b.value=new Set}catch(e){d.error(e.message||"批量禁用失败")}},Xt=async()=>{if(await T.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"}))try{await k.bulkDelete(Array.from(b.value)),d.success("批量删除成功"),b.value=new Set}catch(e){d.error(e.message||"批量删除失败")}},bt=async t=>{try{await k.enableAccount(t),d.success("账号已启用")}catch(e){d.error(e.message||"启用失败")}},yt=async t=>{if(await T.ask({title:"禁用账号",message:"确定要禁用该账号吗?"}))try{await k.disableAccount(t),d.success("账号已禁用")}catch(o){d.error(o.message||"禁用失败")}},_t=async t=>{if(await T.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"}))try{await k.deleteAccount(t),d.success("账号已删除")}catch(o){d.error(o.message||"删除失败")}};let me=null,xe=null,pe=null,Le=!1;const W=()=>{me!==null&&(window.clearInterval(me),me=null)},Z=()=>{xe!==null&&(window.clearInterval(xe),xe=null)},Wt=()=>{pe!==null&&(window.clearInterval(pe),pe=null),Le=!1},ht=t=>t==="pending"?"等待中":t==="running"?"执行中":t==="success"?"成功":t==="failed"?"失败":t,wt=t=>{const e=t.status,o=t.success_count??0,r=t.fail_count??0;if(e==="running"||e==="pending")return"bg-sky-400";if(e==="success"||e==="failed"){if(o>0&&r===0)return"bg-emerald-400";if(r>0&&o===0)return"bg-rose-500";if(o>0&&r>0)return"bg-amber-400"}return"bg-muted-foreground"},kt=async t=>{if($e(t)){W();return}const e=await w.getRegisterTask(t);if($e(e.id)){W();return}if(Be(e),e.status!=="running"&&e.status!=="pending"){O.value=!1,W(),await fe();const o=e.success_count||0,r=e.fail_count||0;o>0&&r>0?d.success(`注册任务完成:成功 ${o},失败 ${r}`):o>0&&r===0?d.success(`注册任务完成:全部成功 (${o})`):r>0&&o===0?d.error(`注册任务完成:全部失败 (${r})`):d.error("注册任务失败")}},Ct=async t=>{if(Ie(t)){Z();return}const e=await w.getLoginTask(t);if(Ie(e.id)){Z();return}if(Se(e),e.status!=="running"&&e.status!=="pending"){S.value=!1,Z(),await fe();const o=e.success_count||0,r=e.fail_count||0;o>0&&r>0?d.success(`刷新任务完成:成功 ${o},失败 ${r}`):o>0&&r===0?d.success(`刷新任务完成:全部成功 (${o})`):r>0&&o===0?d.error(`刷新任务完成:全部失败 (${r})`):d.error("刷新任务失败")}},Tt=t=>{W(),me=window.setInterval(()=>{kt(t).catch(e=>{_.value=e?.message||"注册任务更新失败",W(),O.value=!1})},3e3)},Ke=t=>{Z(),xe=window.setInterval(()=>{Ct(t).catch(e=>{_.value=e?.message||"刷新任务更新失败",Z(),S.value=!1})},3e3)},Zt=()=>{pe===null&&(pe=window.setInterval(async()=>{if(!Le&&!q.value&&!(me!==null||xe!==null)&&!(!O.value&&!S.value&&!c.value&&!f.value)){Le=!0;try{await He()}catch(t){_.value=t?.message||"后台刷新失败"}finally{Le=!1}}},6e3))},He=async()=>{try{const t=await w.getRegisterCurrent();t&&"id"in t&&!$e(t.id)&&(Be(t),(t.status==="running"||t.status==="pending")&&(O.value=!0,Tt(t.id)))}catch(t){_.value=t.message||"加载注册任务失败"}try{const t=await w.getLoginCurrent();t&&"id"in t&&!Ie(t.id)&&(Se(t),(t.status==="running"||t.status==="pending")&&(S.value=!0,Ke(t.id)))}catch(t){_.value=t.message||"加载刷新任务失败"}},es=async()=>{_.value="",O.value=!0;try{const t=Number.isFinite(de.value)&&de.value>0?de.value:void 0,e=await w.startRegister(t);Be(e),Tt(e.id),ye.value=!1,q.value=!0}catch(t){_.value=t.message||"启动注册失败",O.value=!1}},St=async()=>{if(b.value.size){_.value="",S.value=!0;try{const t=await w.startLogin(Array.from(b.value));Se(t),Ke(t.id),Ue()}catch(t){_.value=t.message||"启动刷新失败",S.value=!1}}},ts=async()=>{_.value="",S.value=!0;try{await w.checkLogin();const t=await w.getLoginCurrent();if(t&&"id"in t){Se(t),Ke(t.id),Ue();return}S.value=!1}catch(t){_.value=t.message||"触发刷新失败",S.value=!1}};return(t,e)=>(l(),n(ge,null,[s("div",ps,[s("section",gs,[s("div",bs,[s("div",ys,[R(s("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>ae.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[V,ae.value]]),G(cs,{modelValue:te.value,"onUpdate:modelValue":e[1]||(e[1]=o=>te.value=o),options:Et},null,8,["modelValue"])]),s("div",_s,[G(be,{modelValue:Oe.value,"onUpdate:modelValue":ft},{default:$t(()=>[...e[27]||(e[27]=[ee(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+a(B.value)+" / "+a(H.value.length)+" 个账号",1),s("div",hs,[s("button",{type:"button",class:x(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",Y.value==="table"?"bg-accent text-accent-foreground":""]),onClick:e[2]||(e[2]=o=>Y.value="table"),"aria-label":"列表视图"},[...e[28]||(e[28]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:x(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",Y.value==="card"?"bg-accent text-accent-foreground":""]),onClick:e[3]||(e[3]=o=>Y.value="card"),"aria-label":"卡片视图"},[...e[29]||(e[29]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",ws,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:j(ne),onClick:fe}," 刷新列表 ",8,ks),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:Kt}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:O.value,onClick:At}," 添加账户 ",8,Cs),s("div",{ref_key:"moreActionsRef",ref:De,class:"relative"},[s("button",{class:x(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",P.value?"bg-accent text-accent-foreground":""]),onClick:Ot},[e[30]||(e[30]=ee(" 更多操作 ",-1)),e[31]||(e[31]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),Bt.value?(l(),n("span",{key:0,class:x(["ml-1 h-2 w-2 rounded-full",zt.value]),"aria-hidden":"true"},null,2)):g("",!0)],2),P.value?(l(),n("div",Ts,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:e[4]||(e[4]=o=>{Ue(),le()})}," 任务状态 "),e[32]||(e[32]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:x(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",S.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:S.value,onClick:e[5]||(e[5]=o=>{ts(),le()})}," 刷新过期 ",10,Ss),s("button",{type:"button",class:x(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!B.value||S.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!B.value||S.value,onClick:e[6]||(e[6]=o=>{St(),le()})}," 刷新选中 ",10,$s),e[33]||(e[33]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:x(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[7]||(e[7]=o=>{qt(),le()})}," 批量启用 ",10,Is),s("button",{type:"button",class:x(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[8]||(e[8]=o=>{Qt(),le()})}," 批量禁用 ",10,Es),s("button",{type:"button",class:x(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[9]||(e[9]=o=>{Xt(),le()})}," 批量删除 ",10,Ls)])):g("",!0)],512)]),Y.value==="card"?(l(),n("div",As,[(l(!0),n(ge,null,Ve(H.value,o=>(l(),n("div",{key:o.id,class:x(["rounded-2xl border border-border bg-card p-4",ct(o)]),onClick:r=>Ee(o.id)},[s("div",Vs,[s("div",null,[e[34]||(e[34]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",js,a(o.id),1)]),s("div",Ms,[G(be,{modelValue:b.value.has(o.id),"onUpdate:modelValue":r=>Ee(o.id),onClick:e[10]||(e[10]=M(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:x(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",nt(o)])},a(ve(o)),3)])]),s("div",Ds,[s("div",null,[e[35]||(e[35]=s("p",null,"剩余时间",-1)),s("p",{class:x(["mt-1 text-sm font-semibold",dt(o)])},a(it(o.remaining_display)),3),o.expires_at?(l(),n("p",Os,a(o.expires_at),1)):g("",!0)]),s("div",null,[e[36]||(e[36]=s("p",null,"冷却",-1)),s("p",{class:x(["mt-1",ze(o)])},[o.cooldown_seconds>0?(l(),n("span",Bs,a(ut(o.cooldown_seconds))+" · "+a(o.cooldown_reason),1)):(l(),n("span",Ns,a(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[e[37]||(e[37]=s("p",null,"失败数",-1)),s("p",Us,a(o.error_count),1)]),s("div",null,[e[38]||(e[38]=s("p",null,"会话数",-1)),s("p",zs,a(o.conversation_count),1)])]),s("div",Ps,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>xt(o.id),["stop"])}," 编辑 ",8,Fs),at(o)?(l(),n("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[11]||(e[11]=M(()=>{},["stop"])),r=>bt(o.id)]}," 启用 ",8,Ks)):(l(),n("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[12]||(e[12]=M(()=>{},["stop"])),r=>yt(o.id)]}," 禁用 ",8,Hs)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[e[13]||(e[13]=M(()=>{},["stop"])),r=>_t(o.id)]}," 删除 ",8,Js)])],10,Rs))),128)),!H.value.length&&!j(ne)?(l(),n("div",Gs," 暂无账号数据,请检查后台配置。 ")):g("",!0)])):(l(),n("div",Ys,[s("table",qs,[s("thead",Qs,[s("tr",null,[s("th",Xs,[G(be,{modelValue:Oe.value,"onUpdate:modelValue":ft},null,8,["modelValue"])]),e[40]||(e[40]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),e[41]||(e[41]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",Ws,[s("span",Zs,[e[39]||(e[39]=ee(" 剩余/过期 ",-1)),G(ms,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),e[42]||(e[42]=s("th",{class:"py-3 pr-6"},"冷却",-1)),e[43]||(e[43]=s("th",{class:"py-3 pr-6"},"失败数",-1)),e[44]||(e[44]=s("th",{class:"py-3 pr-6"},"会话数",-1)),e[45]||(e[45]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",eo,[!H.value.length&&!j(ne)?(l(),n("tr",to,[...e[46]||(e[46]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):g("",!0),(l(!0),n(ge,null,Ve(H.value,o=>(l(),n("tr",{key:o.id,class:x(["border-t border-border",ct(o)]),onClick:r=>Ee(o.id)},[s("td",{class:"py-4 pr-4",onClick:e[14]||(e[14]=M(()=>{},["stop"]))},[G(be,{modelValue:b.value.has(o.id),"onUpdate:modelValue":r=>Ee(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",oo,a(o.id),1),s("td",ro,[s("span",{class:x(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",nt(o)])},a(ve(o)),3)]),s("td",lo,[s("div",{class:x(["text-sm font-semibold",dt(o)])},a(it(o.remaining_display)),3),o.expires_at?(l(),n("span",no,a(o.expires_at),1)):g("",!0)]),s("td",ao,[o.cooldown_seconds>0?(l(),n("span",{key:0,class:x(ze(o))},a(ut(o.cooldown_seconds))+" · "+a(o.cooldown_reason),3)):(l(),n("span",{key:1,class:x(ze(o))},a(o.cooldown_reason||"无冷却"),3))]),s("td",io,a(o.error_count),1),s("td",uo,a(o.conversation_count),1),s("td",co,[s("div",fo,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>xt(o.id),["stop"])}," 编辑 ",8,vo),at(o)?(l(),n("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>bt(o.id),["stop"])}," 启用 ",8,mo)):(l(),n("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>yt(o.id),["stop"])}," 禁用 ",8,xo)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:M(r=>_t(o.id),["stop"])}," 删除 ",8,po)])])],10,so))),128))])])]))])]),G(fs,{open:j(T).open.value,title:j(T).title.value,message:j(T).message.value,"confirm-text":j(T).confirmText.value,"cancel-text":j(T).cancelText.value,onConfirm:j(T).confirm,onCancel:j(T).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(l(),Re(je,{to:"body"},[ye.value?(l(),n("div",go,[s("div",bo,[s("div",yo,[s("div",null,[e[47]||(e[47]=s("p",{class:"text-sm font-medium text-foreground"},"添加账户",-1)),s("p",_o,a(U.value==="register"?"创建 DuckMail 账号并自动注册":"批量导入账户配置"),1)]),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Ne}," 关闭 ")]),s("div",ho,[s("div",wo,[s("div",ko,[s("button",{type:"button",class:x(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",U.value==="register"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:e[15]||(e[15]=o=>U.value="register")}," 自动注册 ",2),s("button",{type:"button",class:x(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",U.value==="import"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:e[16]||(e[16]=o=>U.value="import")}," 批量导入 ",2)]),U.value==="register"?(l(),n("div",Co,[e[48]||(e[48]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),R(s("input",{"onUpdate:modelValue":e[17]||(e[17]=o=>de.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,de.value,void 0,{number:!0}]]),e[49]||(e[49]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"}," 默认域名(可在配置面板修改,推荐使用) ",-1))])):(l(),n("div",To,[e[50]||(e[50]=s("label",{class:"block text-xs text-muted-foreground"},"批量导入(每行一个)",-1)),R(s("textarea",{"onUpdate:modelValue":e[18]||(e[18]=o=>ue.value=o),class:"min-h-[140px] w-full rounded-2xl border border-input bg-background px-3 py-2 text-xs font-mono",placeholder:`duckmail----you@example.com----password
2
+ user@outlook.com----loginPassword----clientId----refreshToken`},null,512),[[V,ue.value]]),e[51]||(e[51]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"支持两种格式:"),s("p",{class:"mt-1 font-mono"},"duckmail----email----password"),s("p",{class:"mt-1 font-mono"},"email----password----clientId----refreshToken"),s("p",{class:"mt-2 text-[11px]"},'导入后请执行一次"刷新选中"以获取 Cookie。')],-1)),z.value?(l(),n("div",So,a(z.value),1)):g("",!0)])),e[53]||(e[53]=s("div",{class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-[11px] leading-relaxed"},[s("p",{class:"text-xs font-bold text-rose-600"},"⚠️ 严禁滥用:禁止将本工具用于商业用途或任何形式的滥用(无论规模大小)"),s("p",{class:"mt-1 text-muted-foreground"},[ee("详细声明请查看项目 "),s("a",{href:"https://github.com/Dreamy-rain/gemini-business2api/blob/main/docs/DISCLAIMER.md",target:"_blank",class:"text-primary hover:underline font-medium"},"DISCLAIMER.md")])],-1)),G(be,{modelValue:ce.value,"onUpdate:modelValue":e[19]||(e[19]=o=>ce.value=o)},{default:$t(()=>[...e[52]||(e[52]=[ee(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])])]),s("div",$o,[s("div",Io,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ne}," 取消 "),U.value==="register"?(l(),n("button",{key:0,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",disabled:O.value||!ce.value,onClick:es}," 开始注册 ",8,Eo)):(l(),n("button",{key:1,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",disabled:_e.value||!ce.value,onClick:Vt}," 导入并保存 ",8,Lo))])])])])):g("",!0)])),(l(),Re(je,{to:"body"},[q.value?(l(),n("div",Ao,[s("div",Ro,[s("div",Vo,[e[54]||(e[54]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",jo,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:!Q.value.length&&!X.value.length&&!c.value&&!f.value&&!_.value,onClick:Dt}," 清空日志 ",8,Mo),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Mt}," 关�� ")])]),s("div",Do,[_.value?(l(),n("div",Oo,a(_.value),1)):g("",!0),c.value||f.value?(l(),n("div",Bo,[c.value?(l(),n("div",No,[s("div",Uo,[s("span",{class:x(["h-2.5 w-2.5 rounded-full",wt(c.value)]),"aria-hidden":"true"},null,2),e[55]||(e[55]=ee(" 注册任务 ",-1))]),s("div",zo,[s("span",null,"状态:"+a(ht(c.value.status)),1),s("span",null,"进度:"+a(c.value.progress)+"/"+a(c.value.count),1),s("span",null,"成功:"+a(c.value.success_count),1),s("span",null,"失败:"+a(c.value.fail_count),1)])])):g("",!0),f.value?(l(),n("div",Po,[s("div",Fo,[s("span",{class:x(["h-2.5 w-2.5 rounded-full",wt(f.value)]),"aria-hidden":"true"},null,2),e[56]||(e[56]=ee(" 刷新任务 ",-1))]),s("div",Ko,[s("span",null,"状态:"+a(ht(f.value.status)),1),s("span",null,"进度:"+a(f.value.progress)+"/"+a(f.value.account_ids.length),1),s("span",null,"成功:"+a(f.value.success_count),1),s("span",null,"失败:"+a(f.value.fail_count),1)])])):g("",!0)])):g("",!0),Q.value.length||X.value.length?(l(),n("div",Ho,[s("div",{ref_key:"taskLogsRef",ref:We,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[Q.value.length?(l(),n("div",Jo,[e[57]||(e[57]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",Go,[(l(!0),n(ge,null,Ve(Q.value,(o,r)=>(l(),n("div",{key:`reg-${r}`,class:"font-mono"},a(mt(o)),1))),128))])])):g("",!0),X.value.length?(l(),n("div",Yo,[e[58]||(e[58]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",qo,[(l(!0),n(ge,null,Ve(X.value,(o,r)=>(l(),n("div",{key:`login-${r}`,class:"font-mono"},a(mt(o)),1))),128))])])):g("",!0)],512)])):g("",!0),!_.value&&!c.value&&!f.value&&!Q.value.length&&!X.value.length?(l(),n("div",Qo," 暂无任务 ")):g("",!0)])])])):g("",!0)])),(l(),Re(je,{to:"body"},[p.value?(l(),n("div",Xo,[s("div",Wo,[s("div",{class:"flex items-center justify-between"},[e[59]||(e[59]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Fe}," 关闭 ")]),$.value?(l(),n("div",Zo,a($.value),1)):g("",!0),s("div",er,[e[60]||(e[60]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),R(s("input",{"onUpdate:modelValue":e[20]||(e[20]=o=>h.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[V,h.value.id]]),e[61]||(e[61]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),R(s("textarea",{"onUpdate:modelValue":e[21]||(e[21]=o=>h.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[V,h.value.secure_c_ses]]),e[62]||(e[62]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),R(s("input",{"onUpdate:modelValue":e[22]||(e[22]=o=>h.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.csesidx]]),e[63]||(e[63]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),R(s("input",{"onUpdate:modelValue":e[23]||(e[23]=o=>h.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.config_id]]),e[64]||(e[64]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),R(s("input",{"onUpdate:modelValue":e[24]||(e[24]=o=>h.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.host_c_oses]]),e[65]||(e[65]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),R(s("input",{"onUpdate:modelValue":e[25]||(e[25]=o=>h.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[V,h.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Fe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Yt}," 保存 ")])])])):g("",!0)])),(l(),Re(je,{to:"body"},[Me.value?(l(),n("div",tr,[s("div",sr,[s("div",or,[e[66]||(e[66]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",rr,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Jt},a(N.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Pe}," 关闭 ")])]),D.value?(l(),n("div",lr,a(D.value),1)):g("",!0),s("div",nr,[R(s("textarea",{"onUpdate:modelValue":e[26]||(e[26]=o=>se.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:N.value},null,8,ar),[[V,se.value]])]),s("div",ir,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",onClick:Gt,disabled:N.value}," 保存 ",8,dr)])])])):g("",!0)]))],64))}});export{pr as default};
static/assets/Accounts-lQSfPTKz.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{g as C,C as Ft,h as a,d as Kt,D as Ht,i as N,o as Jt,s as Gt,j as Yt,c as l,a as s,x as U,y as Ce,m as V,v as I,A as xt,t as n,n as b,u as S,b as v,f as z,F as ue,r as Te,T as Se,w as A,e as r,E as Qt}from"./index-DDWWwh2l.js";import{_ as qt}from"./SelectMenu.vue_vue_type_script_setup_true_lang-BgTufWxo.js";import{_ as de}from"./Checkbox.vue_vue_type_script_setup_true_lang-CvXZKsyi.js";import{_ as Wt}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-Bos9Whi2.js";import{u as Xt}from"./useConfirmDialog-B1UvQk4s.js";import{_ as Zt}from"./HelpTip.vue_vue_type_script_setup_true_lang-C7-LVvI-.js";const y={list:()=>C.get("/admin/accounts"),getConfig:()=>C.get("/admin/accounts-config"),updateConfig:x=>C.put("/admin/accounts-config",x),delete:x=>C.delete(`/admin/accounts/${x}`),disable:x=>C.put(`/admin/accounts/${x}/disable`),enable:x=>C.put(`/admin/accounts/${x}/enable`),startRegister:(x,_)=>C.post("/admin/register/start",{count:x,domain:_}),getRegisterTask:x=>C.get(`/admin/register/task/${x}`),getRegisterCurrent:()=>C.get("/admin/register/current"),startLogin:x=>C.post("/admin/login/start",x),getLoginTask:x=>C.get(`/admin/login/task/${x}`),getLoginCurrent:()=>C.get("/admin/login/current"),checkLogin:()=>C.post("/admin/login/check")},es=Ft("accounts",()=>{const x=a([]),_=a(!1);async function T(){_.value=!0;try{const u=await y.list();x.value=Array.isArray(u)?u:u.accounts||[]}finally{_.value=!1}}async function ee(u){await y.delete(u),await T()}async function h(u){await y.disable(u),await T()}async function te(u){await y.enable(u),await T()}async function Q(u){await Promise.all(u.map(L=>y.enable(L))),await T()}async function g(u){await Promise.all(u.map(L=>y.disable(L))),await T()}async function P(u){await Promise.all(u.map(L=>y.delete(L))),await T()}async function se(u){await y.updateConfig(u),await T()}return{accounts:x,isLoading:_,loadAccounts:T,deleteAccount:ee,disableAccount:h,enableAccount:te,bulkEnable:Q,bulkDisable:g,bulkDelete:P,updateConfig:se}}),ts={class:"space-y-8"},ss={class:"rounded-3xl border border-border bg-card p-6"},os={class:"flex flex-wrap items-center justify-between gap-4"},rs={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},ls={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},ns={class:"ml-auto flex items-center gap-2 sm:ml-0"},as={class:"mt-4 flex flex-wrap items-center gap-2"},is=["disabled"],us=["disabled"],ds={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},cs=["disabled"],fs=["disabled"],vs=["disabled"],xs=["disabled"],gs=["disabled"],ps={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},ms=["onClick"],bs={class:"flex items-start justify-between gap-3"},ys={class:"mt-1 font-mono text-xs text-foreground"},_s={class:"flex items-center gap-2"},ws={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},ks={key:0,class:"mt-1 text-[11px]"},hs={key:0},Cs={key:1},Ts={class:"mt-1 text-sm font-semibold text-foreground"},Ss={class:"mt-1 text-sm font-semibold text-foreground"},As={class:"mt-4 flex flex-wrap items-center gap-2"},Ls=["onClick"],Es=["onClick"],$s=["onClick"],Rs=["onClick"],Vs={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Is={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},js={class:"min-w-full text-left text-sm"},Ds={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Ms={class:"py-3 pr-4"},Os={class:"py-3 pr-6"},Bs={class:"inline-flex items-center gap-2"},Ns={class:"text-sm text-foreground"},Us={key:0},zs=["onClick"],Ps={class:"py-4 pr-6 font-mono text-xs text-foreground"},Fs={class:"py-4 pr-6"},Ks={class:"py-4 pr-6"},Hs={key:0,class:"block text-[11px] text-muted-foreground"},Js={class:"py-4 pr-6 text-xs"},Gs={class:"py-4 pr-6 text-xs text-muted-foreground"},Ys={class:"py-4 pr-6 text-xs text-muted-foreground"},Qs={class:"py-4 text-right"},qs={class:"flex flex-wrap justify-end gap-2"},Ws=["onClick"],Xs=["onClick"],Zs=["onClick"],eo=["onClick"],to={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},so={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},oo={class:"mt-4 space-y-4 text-sm"},ro={class:"mt-6 flex items-center justify-end gap-2"},lo=["disabled"],no={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ao={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},io={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},uo={class:"flex items-center gap-2"},co=["disabled"],fo={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},vo={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},xo={key:1,class:"grid gap-3 text-xs text-muted-foreground"},go={key:0,class:"space-y-1"},po={class:"flex flex-wrap gap-x-4 gap-y-1"},mo={key:1,class:"space-y-1"},bo={class:"flex flex-wrap gap-x-4 gap-y-1"},yo={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},_o={key:0,class:"space-y-2"},wo={class:"space-y-1 text-[11px] text-muted-foreground"},ko={key:1,class:"mt-4 space-y-2"},ho={class:"space-y-1 text-[11px] text-muted-foreground"},Co={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},To={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},So={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Ao={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},Lo={class:"mt-4 space-y-3 text-sm"},Eo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},$o={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},Ro={class:"flex items-center justify-between"},Vo={class:"flex items-center gap-2"},Io={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},jo={class:"mt-4"},Do=["readonly"],Mo={class:"mt-6 flex items-center justify-end gap-2"},Oo=["disabled"],De="accounts-register-task-cache",Me="accounts-login-task-cache",Oe="accounts-register-log-clear",Be="accounts-login-log-clear",Ne="accounts-register-task-cleared-id",Ue="accounts-login-task-cleared-id",Ko=Kt({__name:"Accounts",setup(x){const _=es(),{accounts:T,isLoading:ee}=Ht(_),h=Xt(),te=a(""),Q=a("all"),g=a(new Set),P=a("table"),se=a(!1),u=a(""),L=a(!1),E=a(""),q=a(""),j=a(!1),oe=a([]),re=a(1),ce=a(!1),F=a(!1),D=a(!1),Ae=a(null),fe=a(null),ve=a(null),M=a(null),O=a(null),W=a(0),X=a(0),xe=a(!1),d=a(null),c=a(null),ze=a(null),$=a(!1),k=a(!1),p=a(""),m=a({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),ge=a(null),Pe=a([]),gt=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],B=N(()=>{const e=te.value.trim().toLowerCase();return T.value.filter(t=>{const o=!e||t.id.toLowerCase().includes(e),i=Q.value==="all"||le(t)===Q.value;return o&&i})}),R=N(()=>g.value.size),Le=N(()=>B.value.length>0&&B.value.every(e=>g.value.has(e.id))),pe=async()=>{await _.loadAccounts(),g.value=new Set,D.value=!1},Fe=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},Ke=e=>{try{return localStorage.getItem(e)||null}catch{return null}},me=(e,t)=>{try{if(t){localStorage.setItem(e,t);return}localStorage.removeItem(e)}catch{}},He=(e,t)=>{try{localStorage.setItem(e,JSON.stringify(t))}catch{}},Je=e=>{try{localStorage.removeItem(e)}catch{}},Ge=e=>{const t=localStorage.getItem(e),o=Number(t);return Number.isFinite(o)?o:0},be=(e,t)=>{try{localStorage.setItem(e,String(t))}catch{}},Ee=(e,t=!0)=>{e&&(e.id&&e.id===M.value||(e.id&&M.value&&e.id!==M.value&&(M.value=null,me(Ne,null)),d.value=e,e.id&&e.id!==fe.value&&(fe.value=e.id,W.value=0,be(Oe,0)),t&&He(De,e)))},ye=(e,t=!0)=>{e&&(e.id&&e.id===O.value||(e.id&&O.value&&e.id!==O.value&&(O.value=null,me(Ue,null)),c.value=e,e.id&&e.id!==ve.value&&(ve.value=e.id,X.value=0,be(Be,0)),t&&He(Me,e)))},pt=()=>{W.value=Ge(Oe),X.value=Ge(Be),M.value=Ke(Ne),O.value=Ke(Ue);const e=Fe(De);e&&e.id!==M.value&&(d.value=e,fe.value=e.id||null);const t=Fe(Me);t&&t.id!==O.value&&(c.value=t,ve.value=t.id||null)},mt=()=>{ce.value=!0,xe.value=!1},Ye=()=>{ce.value=!1},bt=async()=>{try{const e=[],t=d.value?.id,o=c.value?.id;if(t&&!_e(t)&&e.push(ct(t)),o&&!we(o)&&e.push(ft(o)),!e.length){await je();return}await Promise.all(e)}catch(e){p.value=e?.message||"任务状态更新失败"}},yt=async()=>{F.value=!0,await bt()},_t=()=>{F.value=!1},wt=()=>{const e=d.value?.id||null,t=c.value?.id||null;M.value=e,O.value=t,me(Ne,e),me(Ue,t),W.value=d.value?.logs?.length||0,X.value=c.value?.logs?.length||0,be(Oe,W.value),be(Be,X.value),d.value=null,c.value=null,fe.value=null,ve.value=null,p.value="",$.value=!1,k.value=!1,J(),G(),Je(De),Je(Me)},_e=e=>!!(e&&e===M.value),we=e=>!!(e&&e===O.value),kt=()=>{D.value=!D.value},Z=()=>{D.value=!1},Qe=e=>{if(!D.value)return;const t=e.target;Ae.value&&!Ae.value.contains(t)&&(D.value=!1)};Jt(async()=>{pt(),await pe(),await je(),Nt(),document.addEventListener("click",Qe)});const K=N(()=>{const e=d.value?.logs||[];return W.value?e.slice(W.value):e}),H=N(()=>{const e=c.value?.logs||[];return X.value?e.slice(X.value):e}),ht=N(()=>!!p.value||!!d.value||!!c.value||K.value.length>0||H.value.length>0),Ct=async()=>{await Qt();const e=ze.value;e&&(e.scrollTop=e.scrollHeight)};Gt([K,H,F],async()=>{F.value&&await Ct()},{deep:!0});const Tt=N(()=>{const e=d.value?.status,t=c.value?.status;return e==="running"||e==="pending"||t==="running"||t==="pending"}),St=N(()=>{if(p.value)return"bg-rose-500";if(Tt.value)return"bg-sky-400";const e=[];if(d.value){const f=d.value.success_count??0,w=d.value.fail_count??0,Y=d.value.count??f+w;e.push({success:f,fail:w,total:Y,status:d.value.status})}if(c.value){const f=c.value.success_count??0,w=c.value.fail_count??0,Y=c.value.account_ids?.length??f+w;e.push({success:f,fail:w,total:Y,status:c.value.status})}if(!e.length)return"bg-muted-foreground";const t=e.reduce((f,w)=>f+w.success,0),o=e.reduce((f,w)=>f+w.fail,0),i=e.reduce((f,w)=>f+(w.total||0),0);if(t>0&&o>0)return"bg-amber-400";if(o>0&&t===0)return"bg-rose-500";if(t>0&&o===0)return"bg-emerald-400";if(i===0){const f=e.every(Y=>Y.status==="success");if(e.some(Y=>Y.status==="failed"))return"bg-rose-500";if(f)return"bg-emerald-400"}return"bg-muted-foreground"});Yt(()=>{J(),G(),Bt(),document.removeEventListener("click",Qe)});const le=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?"429限流":e.cooldown_reason==="错误禁用"?"错误禁用":e.disabled?"手动禁用":e.status==="已过期"?"已过期":e.status==="即将过期"?"即将过期":"正常",qe=e=>{const t=le(e);return t==="429限流"||t==="即将过期"?"bg-amber-200 text-amber-900":t==="错误禁用"||t==="已过期"?"bg-destructive/10 text-destructive":t==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},We=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?!0:e.disabled||e.cooldown_reason==="错误禁用",Xe=e=>e==="已过期"?"过期":e==="未设置"?"未设置":e,Ze=e=>e.status==="已过期"?"text-rose-600":e.status==="即将过期"?"text-amber-700":e.status==="未设置"?"text-muted-foreground":"text-emerald-600",et=e=>e<60?`${e} 秒`:e<3600?`${Math.ceil(e/60)} 分钟`:`${(e/3600).toFixed(1)} 小时`,$e=e=>e.cooldown_seconds>0?"text-amber-700":e.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",tt=e=>{const t=le(e);return t==="手动禁用"||t==="已过期"?"bg-muted/70":""},ke=e=>{const t=new Set(g.value);t.has(e)?t.delete(e):t.add(e),g.value=t},st=()=>{if(Le.value){g.value=new Set;return}g.value=new Set(B.value.map(e=>e.id))},At=(e,t)=>e.id||`account_${t+1}`,Lt=async()=>(await y.getConfig()).accounts.map((t,o)=>({...t,id:At(t,o)})),ot=e=>`${e.time} [${e.level}] ${e.message}`,Et=(e,t)=>{let o=-1;for(let f=0;f<e.length;f+=1)if(e[f].id===t){o=f;break}if(o===-1)return u.value="未找到对应账号配置。",!1;const i=e[o];return m.value={id:i.id,secure_c_ses:i.secure_c_ses,csesidx:i.csesidx,config_id:i.config_id,host_c_oses:i.host_c_oses,expires_at:i.expires_at},Pe.value=e,ge.value=o,se.value=!0,!0},rt=async e=>{u.value="";try{const t=await Lt();Et(t,e)}catch(t){u.value=t.message||"加载账号配置失败"}},$t=async()=>{E.value="";try{const e=await y.getConfig();oe.value=Array.isArray(e.accounts)?e.accounts:[],q.value=JSON.stringify(nt(oe.value),null,2),j.value=!0,L.value=!0}catch(e){E.value=e.message||"加载账号配置失败"}},Re=()=>{L.value=!1,E.value="",j.value=!1},lt=()=>{const e=JSON.parse(q.value);if(!Array.isArray(e))throw new Error("配置格式必须是数组。");return e},Rt=e=>typeof e!="string"||!e?e:e.length<=6?`${e.slice(0,2)}****`:`${e.slice(0,3)}****`,nt=e=>{const t=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password"]);return e.map(o=>{const i={...o};return t.forEach(f=>{const w=i[f];w&&(i[f]=Rt(w))}),i})},Vt=()=>{if(E.value="",!j.value){try{oe.value=lt()}catch(e){E.value=e.message||"JSON 格式错误";return}q.value=JSON.stringify(nt(oe.value),null,2),j.value=!0;return}q.value=JSON.stringify(oe.value,null,2),j.value=!1},It=async()=>{E.value="";try{const e=lt();await _.updateConfig(e),Re()}catch(e){E.value=e.message||"保存失败"}},Ve=()=>{se.value=!1,u.value=""},jt=async()=>{if(ge.value===null)return;const e=[...Pe.value];e[ge.value]={...e[ge.value],id:m.value.id,secure_c_ses:m.value.secure_c_ses,csesidx:m.value.csesidx,config_id:m.value.config_id,host_c_oses:m.value.host_c_oses||void 0,expires_at:m.value.expires_at||void 0};try{await _.updateConfig(e),Ve()}catch(t){u.value=t.message||"保存失败"}},Dt=async()=>{await _.bulkEnable(Array.from(g.value)),g.value=new Set},Mt=async()=>{await h.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"})&&(await _.bulkDisable(Array.from(g.value)),g.value=new Set)},Ot=async()=>{await h.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"})&&(await _.bulkDelete(Array.from(g.value)),g.value=new Set)},at=async e=>{await _.enableAccount(e)},it=async e=>{await h.ask({title:"禁用账号",message:"确定要禁用该账号吗?"})&&await _.disableAccount(e)},ut=async e=>{await h.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"})&&await _.deleteAccount(e)};let ne=null,ae=null,ie=null,he=!1;const J=()=>{ne!==null&&(window.clearInterval(ne),ne=null)},G=()=>{ae!==null&&(window.clearInterval(ae),ae=null)},Bt=()=>{ie!==null&&(window.clearInterval(ie),ie=null),he=!1},dt=e=>e==="pending"?"等待中":e==="running"?"执行中":e==="success"?"成功":e==="failed"?"失败":e,ct=async e=>{if(_e(e)){J();return}const t=await y.getRegisterTask(e);if(_e(t.id)){J();return}Ee(t),t.status!=="running"&&t.status!=="pending"&&($.value=!1,J(),await pe())},ft=async e=>{if(we(e)){G();return}const t=await y.getLoginTask(e);if(we(t.id)){G();return}ye(t),t.status!=="running"&&t.status!=="pending"&&(k.value=!1,G(),await pe())},vt=e=>{J(),ne=window.setInterval(()=>{ct(e).catch(t=>{p.value=t?.message||"注册任务更新失败",J(),$.value=!1})},3e3)},Ie=e=>{G(),ae=window.setInterval(()=>{ft(e).catch(t=>{p.value=t?.message||"刷新任务更新失败",G(),k.value=!1})},3e3)},Nt=()=>{ie===null&&(ie=window.setInterval(async()=>{if(!he&&!F.value&&!(ne!==null||ae!==null)&&!(!$.value&&!k.value&&!d.value&&!c.value)){he=!0;try{await je()}catch(e){p.value=e?.message||"后台刷新失败"}finally{he=!1}}},6e3))},je=async()=>{try{const e=await y.getRegisterCurrent();e&&"id"in e&&!_e(e.id)&&(Ee(e),(e.status==="running"||e.status==="pending")&&($.value=!0,vt(e.id)))}catch(e){p.value=e.message||"加载注册任务失败"}try{const e=await y.getLoginCurrent();e&&"id"in e&&!we(e.id)&&(ye(e),(e.status==="running"||e.status==="pending")&&(k.value=!0,Ie(e.id)))}catch(e){p.value=e.message||"加载刷新任务失败"}},Ut=async()=>{p.value="",$.value=!0;try{const e=Number.isFinite(re.value)&&re.value>0?re.value:void 0,t=await y.startRegister(e);Ee(t),vt(t.id),ce.value=!1,F.value=!0}catch(e){p.value=e.message||"启动注册失败",$.value=!1}},zt=async()=>{if(g.value.size){p.value="",k.value=!0;try{const e=await y.startLogin(Array.from(g.value));ye(e),Ie(e.id)}catch(e){p.value=e.message||"启动刷新失败",k.value=!1}}},Pt=async()=>{p.value="",k.value=!0;try{await y.checkLogin();const e=await y.getLoginCurrent();if(e&&"id"in e){ye(e),Ie(e.id);return}k.value=!1}catch(e){p.value=e.message||"触发刷新失败",k.value=!1}};return(e,t)=>(r(),l(ue,null,[s("div",ts,[s("section",ss,[s("div",os,[s("div",rs,[V(s("input",{"onUpdate:modelValue":t[0]||(t[0]=o=>te.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[I,te.value]]),U(qt,{modelValue:Q.value,"onUpdate:modelValue":t[1]||(t[1]=o=>Q.value=o),options:gt},null,8,["modelValue"])]),s("div",ls,[U(de,{modelValue:Le.value,"onUpdate:modelValue":st},{default:xt(()=>[...t[24]||(t[24]=[z(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+n(R.value)+" / "+n(B.value.length)+" 个账号",1),s("div",ns,[s("button",{type:"button",class:b(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",P.value==="table"?"bg-accent text-accent-foreground":""]),onClick:t[2]||(t[2]=o=>P.value="table"),"aria-label":"列表视图"},[...t[25]||(t[25]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:b(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",P.value==="card"?"bg-accent text-accent-foreground":""]),onClick:t[3]||(t[3]=o=>P.value="card"),"aria-label":"卡片视图"},[...t[26]||(t[26]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",as,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:S(ee),onClick:pe}," 刷新列表 ",8,is),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:$t}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:$.value,onClick:mt}," 添加账户 ",8,us),s("div",{ref_key:"moreActionsRef",ref:Ae,class:"relative"},[s("button",{class:b(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",D.value?"bg-accent text-accent-foreground":""]),onClick:kt},[t[27]||(t[27]=z(" 更多操作 ",-1)),t[28]||(t[28]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),ht.value?(r(),l("span",{key:0,class:b(["ml-1 h-2 w-2 rounded-full",St.value]),"aria-hidden":"true"},null,2)):v("",!0)],2),D.value?(r(),l("div",ds,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:t[4]||(t[4]=o=>{yt(),Z()})}," 任务状态 "),t[29]||(t[29]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",k.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:k.value,onClick:t[5]||(t[5]=o=>{Pt(),Z()})}," 刷新过期 ",10,cs),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!R.value||k.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!R.value||k.value,onClick:t[6]||(t[6]=o=>{zt(),Z()})}," 刷新选中 ",10,fs),t[30]||(t[30]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",R.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!R.value,onClick:t[7]||(t[7]=o=>{Dt(),Z()})}," 批量启用 ",10,vs),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",R.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!R.value,onClick:t[8]||(t[8]=o=>{Mt(),Z()})}," 批量禁用 ",10,xs),s("button",{type:"button",class:b(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",R.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!R.value,onClick:t[9]||(t[9]=o=>{Ot(),Z()})}," 批量删除 ",10,gs)])):v("",!0)],512)]),P.value==="card"?(r(),l("div",ps,[(r(!0),l(ue,null,Te(B.value,o=>(r(),l("div",{key:o.id,class:b(["rounded-2xl border border-border bg-card p-4",tt(o)]),onClick:i=>ke(o.id)},[s("div",bs,[s("div",null,[t[31]||(t[31]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",ys,n(o.id),1)]),s("div",_s,[U(de,{modelValue:g.value.has(o.id),"onUpdate:modelValue":i=>ke(o.id),onClick:t[10]||(t[10]=A(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:b(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",qe(o)])},n(le(o)),3)])]),s("div",ws,[s("div",null,[t[32]||(t[32]=s("p",null,"剩余时间",-1)),s("p",{class:b(["mt-1 text-sm font-semibold",Ze(o)])},n(Xe(o.remaining_display)),3),o.expires_at?(r(),l("p",ks,n(o.expires_at),1)):v("",!0)]),s("div",null,[t[33]||(t[33]=s("p",null,"冷却",-1)),s("p",{class:b(["mt-1",$e(o)])},[o.cooldown_seconds>0?(r(),l("span",hs,n(et(o.cooldown_seconds))+" · "+n(o.cooldown_reason),1)):(r(),l("span",Cs,n(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[t[34]||(t[34]=s("p",null,"失败数",-1)),s("p",Ts,n(o.error_count),1)]),s("div",null,[t[35]||(t[35]=s("p",null,"会话数",-1)),s("p",Ss,n(o.conversation_count),1)])]),s("div",As,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>rt(o.id),["stop"])}," 编辑 ",8,Ls),We(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[11]||(t[11]=A(()=>{},["stop"])),i=>at(o.id)]}," 启用 ",8,Es)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[12]||(t[12]=A(()=>{},["stop"])),i=>it(o.id)]}," 禁用 ",8,$s)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[t[13]||(t[13]=A(()=>{},["stop"])),i=>ut(o.id)]}," 删除 ",8,Rs)])],10,ms))),128)),!B.value.length&&!S(ee)?(r(),l("div",Vs," 暂无账号数据,请检查后台配置。 ")):v("",!0)])):(r(),l("div",Is,[s("table",js,[s("thead",Ds,[s("tr",null,[s("th",Ms,[U(de,{modelValue:Le.value,"onUpdate:modelValue":st},null,8,["modelValue"])]),t[37]||(t[37]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),t[38]||(t[38]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",Os,[s("span",Bs,[t[36]||(t[36]=z(" 剩余/过期 ",-1)),U(Zt,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),t[39]||(t[39]=s("th",{class:"py-3 pr-6"},"冷却",-1)),t[40]||(t[40]=s("th",{class:"py-3 pr-6"},"失败数",-1)),t[41]||(t[41]=s("th",{class:"py-3 pr-6"},"会话数",-1)),t[42]||(t[42]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",Ns,[!B.value.length&&!S(ee)?(r(),l("tr",Us,[...t[43]||(t[43]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):v("",!0),(r(!0),l(ue,null,Te(B.value,o=>(r(),l("tr",{key:o.id,class:b(["border-t border-border",tt(o)]),onClick:i=>ke(o.id)},[s("td",{class:"py-4 pr-4",onClick:t[14]||(t[14]=A(()=>{},["stop"]))},[U(de,{modelValue:g.value.has(o.id),"onUpdate:modelValue":i=>ke(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",Ps,n(o.id),1),s("td",Fs,[s("span",{class:b(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",qe(o)])},n(le(o)),3)]),s("td",Ks,[s("div",{class:b(["text-sm font-semibold",Ze(o)])},n(Xe(o.remaining_display)),3),o.expires_at?(r(),l("span",Hs,n(o.expires_at),1)):v("",!0)]),s("td",Js,[o.cooldown_seconds>0?(r(),l("span",{key:0,class:b($e(o))},n(et(o.cooldown_seconds))+" · "+n(o.cooldown_reason),3)):(r(),l("span",{key:1,class:b($e(o))},n(o.cooldown_reason||"无冷却"),3))]),s("td",Gs,n(o.error_count),1),s("td",Ys,n(o.conversation_count),1),s("td",Qs,[s("div",qs,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>rt(o.id),["stop"])}," 编辑 ",8,Ws),We(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>at(o.id),["stop"])}," 启用 ",8,Xs)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(i=>it(o.id),["stop"])}," 禁用 ",8,Zs)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:A(i=>ut(o.id),["stop"])}," 删除 ",8,eo)])])],10,zs))),128))])])]))])]),U(Wt,{open:S(h).open.value,title:S(h).title.value,message:S(h).message.value,"confirm-text":S(h).confirmText.value,"cancel-text":S(h).cancelText.value,onConfirm:S(h).confirm,onCancel:S(h).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(r(),Ce(Se,{to:"body"},[ce.value?(r(),l("div",to,[s("div",so,[s("div",{class:"flex items-center justify-between"},[t[44]||(t[44]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"添加账户"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"创建 DuckMail 账号并自动注册")],-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Ye}," 关闭 ")]),s("div",oo,[t[46]||(t[46]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),V(s("input",{"onUpdate:modelValue":t[15]||(t[15]=o=>re.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,re.value,void 0,{number:!0}]]),t[47]||(t[47]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"}," 默认域名来自设置面板(可在“配置面板”中修改) ",-1)),t[48]||(t[48]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-[11px] leading-relaxed text-muted-foreground"},[s("div",{class:"space-y-2"},[s("p",{class:"font-semibold text-rose-600"},"⚠️ 严禁滥用:禁止将本工具用于商业用途或任何形式的滥用(无论规模大小)"),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"合法用途:"),z("本项目仅限个人学习、技术研究与非商业性技术交流,旨在探索浏览器自动化与系统集成。")])]),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"禁止行为:"),z("严禁用于以下场景:")]),s("p",{class:"pl-3"},"• 商业用途或盈利性使用"),s("p",{class:"pl-3"},"• 任何形式的批量注册或自动化滥用(无论规模大小)"),s("p",{class:"pl-3"},"• 破坏市场秩序或恶意竞争"),s("p",{class:"pl-3"},"• 违反 Google 服务条款的任何行为")]),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"使用责任:"),z("因使用本工具产生的一切后果由使用者完全承担,包括但不限于账号封禁、数据损失及法律责任。")]),s("p",null,[s("strong",null,"合规要求:"),z("使用者必须遵守所在地法律法规及第三方服务条款,作者不对任何违规使用行为承担责任。")])]),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"技术声明:")]),s("p",{class:"pl-3"},'• 本项目按"现状"提供,不提供任何明示或暗示的担保'),s("p",{class:"pl-3"},"• 依赖 DuckMail API 等第三方服务,其可用性不受作者控制"),s("p",{class:"pl-3"},"• 作者保留随时停止维护或变更功能的权利")])])],-1)),U(de,{modelValue:xe.value,"onUpdate:modelValue":t[16]||(t[16]=o=>xe.value=o)},{default:xt(()=>[...t[45]||(t[45]=[z(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])]),s("div",ro,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ye}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:$.value||!xe.value,onClick:Ut}," 开始注册 ",8,lo)])])])):v("",!0)])),(r(),Ce(Se,{to:"body"},[F.value?(r(),l("div",no,[s("div",ao,[s("div",io,[t[49]||(t[49]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",uo,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary",disabled:!K.value.length&&!H.value.length&&!d.value&&!c.value&&!p.value,onClick:wt}," 清空日志 ",8,co),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:_t}," 关闭 ")])]),s("div",fo,[p.value?(r(),l("div",vo,n(p.value),1)):v("",!0),d.value||c.value?(r(),l("div",xo,[d.value?(r(),l("div",go,[t[50]||(t[50]=s("div",{class:"font-medium text-foreground"},"注册任务",-1)),s("div",po,[s("span",null,"状态:"+n(dt(d.value.status)),1),s("span",null,"进度:"+n(d.value.progress)+"/"+n(d.value.count),1),s("span",null,"成功:"+n(d.value.success_count),1),s("span",null,"失败:"+n(d.value.fail_count),1)])])):v("",!0),c.value?(r(),l("div",mo,[t[51]||(t[51]=s("div",{class:"font-medium text-foreground"},"刷新任务",-1)),s("div",bo,[s("span",null,"状态:"+n(dt(c.value.status)),1),s("span",null,"进度:"+n(c.value.progress)+"/"+n(c.value.account_ids.length),1),s("span",null,"成功:"+n(c.value.success_count),1),s("span",null,"失败:"+n(c.value.fail_count),1)])])):v("",!0)])):v("",!0),K.value.length||H.value.length?(r(),l("div",yo,[s("div",{ref_key:"taskLogsRef",ref:ze,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[K.value.length?(r(),l("div",_o,[t[52]||(t[52]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",wo,[(r(!0),l(ue,null,Te(K.value,(o,i)=>(r(),l("div",{key:`reg-${i}`,class:"font-mono"},n(ot(o)),1))),128))])])):v("",!0),H.value.length?(r(),l("div",ko,[t[53]||(t[53]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",ho,[(r(!0),l(ue,null,Te(H.value,(o,i)=>(r(),l("div",{key:`login-${i}`,class:"font-mono"},n(ot(o)),1))),128))])])):v("",!0)],512)])):v("",!0),!p.value&&!d.value&&!c.value&&!K.value.length&&!H.value.length?(r(),l("div",Co," 暂无任务 ")):v("",!0)])])])):v("",!0)])),(r(),Ce(Se,{to:"body"},[se.value?(r(),l("div",To,[s("div",So,[s("div",{class:"flex items-center justify-between"},[t[54]||(t[54]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Ve}," 关闭 ")]),u.value?(r(),l("div",Ao,n(u.value),1)):v("",!0),s("div",Lo,[t[55]||(t[55]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),V(s("input",{"onUpdate:modelValue":t[17]||(t[17]=o=>m.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[I,m.value.id]]),t[56]||(t[56]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),V(s("textarea",{"onUpdate:modelValue":t[18]||(t[18]=o=>m.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[I,m.value.secure_c_ses]]),t[57]||(t[57]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),V(s("input",{"onUpdate:modelValue":t[19]||(t[19]=o=>m.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,m.value.csesidx]]),t[58]||(t[58]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),V(s("input",{"onUpdate:modelValue":t[20]||(t[20]=o=>m.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,m.value.config_id]]),t[59]||(t[59]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),V(s("input",{"onUpdate:modelValue":t[21]||(t[21]=o=>m.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,m.value.host_c_oses]]),t[60]||(t[60]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),V(s("input",{"onUpdate:modelValue":t[22]||(t[22]=o=>m.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[I,m.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ve}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:jt}," 保存 ")])])])):v("",!0)])),(r(),Ce(Se,{to:"body"},[L.value?(r(),l("div",Eo,[s("div",$o,[s("div",Ro,[t[61]||(t[61]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",Vo,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Vt},n(j.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Re}," 关闭 ")])]),E.value?(r(),l("div",Io,n(E.value),1)):v("",!0),s("div",jo,[V(s("textarea",{"onUpdate:modelValue":t[23]||(t[23]=o=>q.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:j.value},null,8,Do),[[I,q.value]])]),s("div",Mo,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Re}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:It,disabled:j.value}," 保存 ",8,Oo)])])])):v("",!0)]))],64))}});export{Ko as default};
static/assets/Accounts-mLu74uIS.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ import{g as E,C as ts,h as a,d as ss,D as os,i as H,o as rs,s as ls,j as ns,c as l,a as s,x as J,y as Re,m as A,v as $,A as Tt,t as n,n as g,u as R,b as m,f as pe,F as ge,r as Ve,T as je,w as V,e as r,E as as}from"./index-DMWZCTlx.js";import{_ as is}from"./SelectMenu.vue_vue_type_script_setup_true_lang-R5yoq9NP.js";import{_ as be}from"./Checkbox.vue_vue_type_script_setup_true_lang-CsCJog3q.js";import{_ as ds}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-C75dpm4L.js";import{u as us}from"./useConfirmDialog-BdcqQTU3.js";import{_ as cs}from"./HelpTip.vue_vue_type_script_setup_true_lang-BgxOFSZZ.js";const h={list:()=>E.get("/admin/accounts"),getConfig:()=>E.get("/admin/accounts-config"),updateConfig:b=>E.put("/admin/accounts-config",b),delete:b=>E.delete(`/admin/accounts/${b}`),disable:b=>E.put(`/admin/accounts/${b}/disable`),enable:b=>E.put(`/admin/accounts/${b}/enable`),startRegister:(b,w)=>E.post("/admin/register/start",{count:b,domain:w}),getRegisterTask:b=>E.get(`/admin/register/task/${b}`),getRegisterCurrent:()=>E.get("/admin/register/current"),startLogin:b=>E.post("/admin/login/start",b),getLoginTask:b=>E.get(`/admin/login/task/${b}`),getLoginCurrent:()=>E.get("/admin/login/current"),checkLogin:()=>E.post("/admin/login/check")},fs=ts("accounts",()=>{const b=a([]),w=a(!1);async function L(){w.value=!0;try{const u=await h.list();b.value=Array.isArray(u)?u:u.accounts||[]}finally{w.value=!1}}async function re(u){await h.delete(u),await L()}async function C(u){await h.disable(u),await L()}async function le(u){await h.enable(u),await L()}async function Z(u){await Promise.all(u.map(j=>h.enable(j))),await L()}async function p(u){await Promise.all(u.map(j=>h.disable(j))),await L()}async function G(u){await Promise.all(u.map(j=>h.delete(j))),await L()}async function ne(u){await h.updateConfig(u),await L()}return{accounts:b,isLoading:w,loadAccounts:L,deleteAccount:re,disableAccount:C,enableAccount:le,bulkEnable:Z,bulkDisable:p,bulkDelete:G,updateConfig:ne}}),vs={class:"space-y-8"},xs={class:"rounded-3xl border border-border bg-card p-6"},ms={class:"flex flex-wrap items-center justify-between gap-4"},ps={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},gs={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},bs={class:"ml-auto flex items-center gap-2 sm:ml-0"},ys={class:"mt-4 flex flex-wrap items-center gap-2"},_s=["disabled"],hs=["disabled"],ws={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},ks=["disabled"],Cs=["disabled"],Ts=["disabled"],Ss=["disabled"],Es=["disabled"],Is={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},Ls=["onClick"],As={class:"flex items-start justify-between gap-3"},$s={class:"mt-1 font-mono text-xs text-foreground"},Rs={class:"flex items-center gap-2"},Vs={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},js={key:0,class:"mt-1 text-[11px]"},Ms={key:0},Ds={key:1},Os={class:"mt-1 text-sm font-semibold text-foreground"},Bs={class:"mt-1 text-sm font-semibold text-foreground"},Ns={class:"mt-4 flex flex-wrap items-center gap-2"},Us=["onClick"],zs=["onClick"],Ps=["onClick"],Fs=["onClick"],Ks={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Hs={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},Js={class:"min-w-full text-left text-sm"},Gs={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Ys={class:"py-3 pr-4"},Qs={class:"py-3 pr-6"},qs={class:"inline-flex items-center gap-2"},Xs={class:"text-sm text-foreground"},Ws={key:0},Zs=["onClick"],eo={class:"py-4 pr-6 font-mono text-xs text-foreground"},to={class:"py-4 pr-6"},so={class:"py-4 pr-6"},oo={key:0,class:"block text-[11px] text-muted-foreground"},ro={class:"py-4 pr-6 text-xs"},lo={class:"py-4 pr-6 text-xs text-muted-foreground"},no={class:"py-4 pr-6 text-xs text-muted-foreground"},ao={class:"py-4 text-right"},io={class:"flex flex-wrap justify-end gap-2"},uo=["onClick"],co=["onClick"],fo=["onClick"],vo=["onClick"],xo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},mo={class:"flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},po={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},go={class:"mt-1 text-xs text-muted-foreground"},bo={class:"scrollbar-slim flex-1 overflow-y-auto px-6 py-4"},yo={class:"space-y-4 text-sm"},_o={class:"flex rounded-full border border-border bg-muted/30 p-1 text-xs"},ho={key:0,class:"space-y-4"},wo={key:1,class:"space-y-4"},ko={key:0,class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-600"},Co={class:"border-t border-border/60 px-6 py-4"},To={class:"flex items-center justify-end gap-2"},So=["disabled"],Eo=["disabled"],Io={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Lo={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},Ao={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},$o={class:"flex items-center gap-2"},Ro=["disabled"],Vo={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},jo={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},Mo={key:1,class:"grid gap-3 text-xs text-muted-foreground"},Do={key:0,class:"space-y-1"},Oo={class:"flex flex-wrap gap-x-4 gap-y-1"},Bo={key:1,class:"space-y-1"},No={class:"flex flex-wrap gap-x-4 gap-y-1"},Uo={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},zo={key:0,class:"space-y-2"},Po={class:"space-y-1 text-[11px] text-muted-foreground"},Fo={key:1,class:"mt-4 space-y-2"},Ko={class:"space-y-1 text-[11px] text-muted-foreground"},Ho={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},Jo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Go={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Yo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},Qo={class:"mt-4 space-y-3 text-sm"},qo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Xo={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},Wo={class:"flex items-center justify-between"},Zo={class:"flex items-center gap-2"},er={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},tr={class:"mt-4"},sr=["readonly"],or={class:"mt-6 flex items-center justify-end gap-2"},rr=["disabled"],He="accounts-register-task-cache",Je="accounts-login-task-cache",Ge="accounts-register-log-clear",Ye="accounts-login-log-clear",Qe="accounts-register-task-cleared-id",qe="accounts-login-task-cleared-id",St="1970-01-01 00:00:00",cr=ss({__name:"Accounts",setup(b){const w=fs(),{accounts:L,isLoading:re}=os(w),C=us(),le=a(""),Z=a("all"),p=a(new Set),G=a("table"),ne=a(!1),u=a(""),j=a(!1),M=a(""),ee=a(""),B=a(!1),ae=a([]),ie=a(1),ye=a(!1),N=a("register"),de=a(""),U=a(""),_e=a(!1),Y=a(!1),z=a(!1),Me=a(null),he=a(null),we=a(null),P=a(null),F=a(null),te=a(0),se=a(0),ue=a(!1),c=a(null),f=a(null),Xe=a(null),D=a(!1),T=a(!1),y=a(""),_=a({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),ke=a(null),We=a([]),Et=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],K=H(()=>{const e=le.value.trim().toLowerCase();return L.value.filter(t=>{const o=!e||t.id.toLowerCase().includes(e),i=Z.value==="all"||fe(t)===Z.value;return o&&i})}),O=H(()=>p.value.size),De=H(()=>K.value.length>0&&K.value.every(e=>p.value.has(e.id))),ce=async()=>{await w.loadAccounts(),p.value=new Set,z.value=!1},Ze=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},et=e=>{try{return localStorage.getItem(e)||null}catch{return null}},Ce=(e,t)=>{try{if(t){localStorage.setItem(e,t);return}localStorage.removeItem(e)}catch{}},tt=(e,t)=>{try{localStorage.setItem(e,JSON.stringify(t))}catch{}},st=e=>{try{localStorage.removeItem(e)}catch{}},ot=e=>{const t=localStorage.getItem(e),o=Number(t);return Number.isFinite(o)?o:0},Te=(e,t)=>{try{localStorage.setItem(e,String(t))}catch{}},Oe=(e,t=!0)=>{e&&(e.id&&e.id===P.value||(e.id&&P.value&&e.id!==P.value&&(P.value=null,Ce(Qe,null)),c.value=e,e.id&&e.id!==he.value&&(he.value=e.id,te.value=0,Te(Ge,0)),t&&tt(He,e)))},Se=(e,t=!0)=>{e&&(e.id&&e.id===F.value||(e.id&&F.value&&e.id!==F.value&&(F.value=null,Ce(qe,null)),f.value=e,e.id&&e.id!==we.value&&(we.value=e.id,se.value=0,Te(Ye,0)),t&&tt(Je,e)))},It=()=>{te.value=ot(Ge),se.value=ot(Ye),P.value=et(Qe),F.value=et(qe);const e=Ze(He);e&&e.id!==P.value&&(c.value=e,he.value=e.id||null);const t=Ze(Je);t&&t.id!==F.value&&(f.value=t,we.value=t.id||null)},Lt=()=>{ye.value=!0,N.value="register",de.value="",U.value="",_e.value=!1,ue.value=!1},Be=()=>{ye.value=!1},At=e=>{const t=[],o=[];return e.split(/\r?\n/).map(d=>d.trim()).filter(Boolean).forEach((d,x)=>{const v=d.split("----").map(S=>S.trim()),k=x+1;if(v.length){if(v[0].toLowerCase()==="duckmail"){if(v.length<3||!v[1]||!v[2]){o.push(`第 ${k} 行格式错误(duckmail)`);return}const S=v[1],$e=v.slice(2).join("----");t.push({id:S,secure_c_ses:"",csesidx:"",config_id:"",expires_at:St,mail_provider:"duckmail",mail_address:S,mail_password:$e});return}if(v.length>=4&&v[0]&&v[2]&&v[3]){const S=v[0],$e=v[1]||"",I=v[2],es=v.slice(3).join("----");t.push({id:S,secure_c_ses:"",csesidx:"",config_id:"",expires_at:St,mail_provider:"microsoft",mail_address:S,mail_password:$e,mail_client_id:I,mail_refresh_token:es,mail_tenant:"consumers"});return}o.push(`第 ${k} 行格式错误`)}}),{items:t,errors:o}},$t=async()=>{if(U.value="",!de.value.trim()){U.value="请输入导入内容";return}const{items:e,errors:t}=At(de.value);if(!e.length){U.value=t.length?t.join(","):"未识别到有效账号";return}if(t.length){U.value=t.slice(0,3).join(",");return}_e.value=!0;try{const i=[...await ft()],d=new Map(i.map((k,S)=>[k.id,S])),x=[];e.forEach(k=>{const S=d.get(k.id||"");if(S===void 0){i.push(k),x.push(k.id);return}const I={...i[S],mail_provider:k.mail_provider,mail_address:k.mail_address};k.mail_provider==="microsoft"?(I.mail_client_id=k.mail_client_id,I.mail_refresh_token=k.mail_refresh_token,I.mail_tenant=k.mail_tenant,I.mail_password=k.mail_password):(I.mail_password=k.mail_password,I.mail_client_id=void 0,I.mail_refresh_token=void 0,I.mail_tenant=void 0),i[S]=I,x.push(k.id)}),await w.updateConfig(i),await ce(),p.value=new Set(x),Be(),await C.ask({title:"导入成功",message:`已导入 ${x.length} 个账户并自动选中。是否立即刷新这些账户以获取 Cookie?`,confirmText:"立即刷新",cancelText:"稍后手动刷新"})&&await Ct()}catch(o){U.value=o.message||"导入失败"}finally{_e.value=!1}},Rt=async()=>{try{const e=[],t=c.value?.id,o=f.value?.id;if(t&&!Ee(t)&&e.push(ht(t)),o&&!Ie(o)&&e.push(wt(o)),!e.length){await Ke();return}await Promise.all(e)}catch(e){y.value=e?.message||"任务状态更新失败"}},Ne=async()=>{Y.value=!0,await Rt()},Vt=()=>{Y.value=!1},jt=()=>{const e=c.value?.id||null,t=f.value?.id||null;P.value=e,F.value=t,Ce(Qe,e),Ce(qe,t),te.value=c.value?.logs?.length||0,se.value=f.value?.logs?.length||0,Te(Ge,te.value),Te(Ye,se.value),c.value=null,f.value=null,he.value=null,we.value=null,y.value="",D.value=!1,T.value=!1,X(),W(),st(He),st(Je)},Ee=e=>!!(e&&e===P.value),Ie=e=>!!(e&&e===F.value),Mt=()=>{z.value=!z.value},oe=()=>{z.value=!1},rt=e=>{if(!z.value)return;const t=e.target;Me.value&&!Me.value.contains(t)&&(z.value=!1)};rs(async()=>{It(),await ce(),await Ke(),Xt(),document.addEventListener("click",rt)});const Q=H(()=>{const e=c.value?.logs||[];return te.value?e.slice(te.value):e}),q=H(()=>{const e=f.value?.logs||[];return se.value?e.slice(se.value):e}),Dt=H(()=>!!y.value||!!c.value||!!f.value||Q.value.length>0||q.value.length>0),Ot=async()=>{await as();const e=Xe.value;e&&(e.scrollTop=e.scrollHeight)};ls([Q,q,Y],async()=>{Y.value&&await Ot()},{deep:!0});const Bt=H(()=>{const e=c.value?.status,t=f.value?.status;return e==="running"||e==="pending"||t==="running"||t==="pending"}),Nt=H(()=>{if(y.value)return"bg-rose-500";if(Bt.value)return"bg-sky-400";const e=[];if(c.value){const d=c.value.success_count??0,x=c.value.fail_count??0,v=c.value.count??d+x;e.push({success:d,fail:x,total:v,status:c.value.status})}if(f.value){const d=f.value.success_count??0,x=f.value.fail_count??0,v=f.value.account_ids?.length??d+x;e.push({success:d,fail:x,total:v,status:f.value.status})}if(!e.length)return"bg-muted-foreground";const t=e.reduce((d,x)=>d+x.success,0),o=e.reduce((d,x)=>d+x.fail,0),i=e.reduce((d,x)=>d+(x.total||0),0);if(t>0&&o>0)return"bg-amber-400";if(o>0&&t===0)return"bg-rose-500";if(t>0&&o===0)return"bg-emerald-400";if(i===0){const d=e.every(v=>v.status==="success");if(e.some(v=>v.status==="failed"))return"bg-rose-500";if(d)return"bg-emerald-400"}return"bg-muted-foreground"});ns(()=>{X(),W(),qt(),document.removeEventListener("click",rt)});const fe=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?"429限流":e.cooldown_reason==="错误禁用"?"错误禁用":e.disabled?"手动禁用":e.status==="已过期"?"已过期":e.status==="即将过期"?"即将过期":"正常",lt=e=>{const t=fe(e);return t==="429限流"||t==="即将过期"?"bg-amber-200 text-amber-900":t==="错误禁用"||t==="已过期"?"bg-destructive/10 text-destructive":t==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},nt=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?!0:e.disabled||e.cooldown_reason==="错误禁用",at=e=>e==="已过期"?"过期":e==="未设置"?"未设置":e,it=e=>e.status==="已过期"?"text-rose-600":e.status==="即将过期"?"text-amber-700":e.status==="未设置"?"text-muted-foreground":"text-emerald-600",dt=e=>e<60?`${e} 秒`:e<3600?`${Math.ceil(e/60)} 分钟`:`${(e/3600).toFixed(1)} 小时`,Ue=e=>e.cooldown_seconds>0?"text-amber-700":e.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",ut=e=>{const t=fe(e);return t==="手动禁用"||t==="已过期"?"bg-muted/70":""},Le=e=>{const t=new Set(p.value);t.has(e)?t.delete(e):t.add(e),p.value=t},ct=()=>{if(De.value){p.value=new Set;return}p.value=new Set(K.value.map(e=>e.id))},Ut=(e,t)=>e.id||`account_${t+1}`,ft=async()=>(await h.getConfig()).accounts.map((t,o)=>({...t,id:Ut(t,o)})),vt=e=>`${e.time} [${e.level}] ${e.message}`,zt=(e,t)=>{let o=-1;for(let d=0;d<e.length;d+=1)if(e[d].id===t){o=d;break}if(o===-1)return u.value="未找到对应账号配置。",!1;const i=e[o];return _.value={id:i.id,secure_c_ses:i.secure_c_ses,csesidx:i.csesidx,config_id:i.config_id,host_c_oses:i.host_c_oses,expires_at:i.expires_at},We.value=e,ke.value=o,ne.value=!0,!0},xt=async e=>{u.value="";try{const t=await ft();zt(t,e)}catch(t){u.value=t.message||"加载账号配置失败"}},Pt=async()=>{M.value="";try{const e=await h.getConfig();ae.value=Array.isArray(e.accounts)?e.accounts:[],ee.value=JSON.stringify(pt(ae.value),null,2),B.value=!0,j.value=!0}catch(e){M.value=e.message||"加载账号配置失败"}},ze=()=>{j.value=!1,M.value="",B.value=!1},mt=()=>{const e=JSON.parse(ee.value);if(!Array.isArray(e))throw new Error("配置格式必须是数组。");return e},Ft=e=>typeof e!="string"||!e?e:e.length<=6?`${e.slice(0,2)}****`:`${e.slice(0,3)}****`,pt=e=>{const t=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password","mail_refresh_token","mail_client_id"]);return e.map(o=>{const i={...o};return t.forEach(d=>{const x=i[d];x&&(i[d]=Ft(x))}),i})},Kt=()=>{if(M.value="",!B.value){try{ae.value=mt()}catch(e){M.value=e.message||"JSON 格式错误";return}ee.value=JSON.stringify(pt(ae.value),null,2),B.value=!0;return}ee.value=JSON.stringify(ae.value,null,2),B.value=!1},Ht=async()=>{M.value="";try{const e=mt();await w.updateConfig(e),ze()}catch(e){M.value=e.message||"保存失败"}},Pe=()=>{ne.value=!1,u.value=""},Jt=async()=>{if(ke.value===null)return;const e=[...We.value];e[ke.value]={...e[ke.value],id:_.value.id,secure_c_ses:_.value.secure_c_ses,csesidx:_.value.csesidx,config_id:_.value.config_id,host_c_oses:_.value.host_c_oses||void 0,expires_at:_.value.expires_at||void 0};try{await w.updateConfig(e),Pe()}catch(t){u.value=t.message||"保存失败"}},Gt=async()=>{await w.bulkEnable(Array.from(p.value)),p.value=new Set},Yt=async()=>{await C.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"})&&(await w.bulkDisable(Array.from(p.value)),p.value=new Set)},Qt=async()=>{await C.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"})&&(await w.bulkDelete(Array.from(p.value)),p.value=new Set)},gt=async e=>{await w.enableAccount(e)},bt=async e=>{await C.ask({title:"禁用账号",message:"确定要禁用该账号吗?"})&&await w.disableAccount(e)},yt=async e=>{await C.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"})&&await w.deleteAccount(e)};let ve=null,xe=null,me=null,Ae=!1;const X=()=>{ve!==null&&(window.clearInterval(ve),ve=null)},W=()=>{xe!==null&&(window.clearInterval(xe),xe=null)},qt=()=>{me!==null&&(window.clearInterval(me),me=null),Ae=!1},_t=e=>e==="pending"?"等待中":e==="running"?"执行中":e==="success"?"成功":e==="failed"?"失败":e,ht=async e=>{if(Ee(e)){X();return}const t=await h.getRegisterTask(e);if(Ee(t.id)){X();return}Oe(t),t.status!=="running"&&t.status!=="pending"&&(D.value=!1,X(),await ce())},wt=async e=>{if(Ie(e)){W();return}const t=await h.getLoginTask(e);if(Ie(t.id)){W();return}Se(t),t.status!=="running"&&t.status!=="pending"&&(T.value=!1,W(),await ce())},kt=e=>{X(),ve=window.setInterval(()=>{ht(e).catch(t=>{y.value=t?.message||"注册任务更新失败",X(),D.value=!1})},3e3)},Fe=e=>{W(),xe=window.setInterval(()=>{wt(e).catch(t=>{y.value=t?.message||"刷新任务更新失败",W(),T.value=!1})},3e3)},Xt=()=>{me===null&&(me=window.setInterval(async()=>{if(!Ae&&!Y.value&&!(ve!==null||xe!==null)&&!(!D.value&&!T.value&&!c.value&&!f.value)){Ae=!0;try{await Ke()}catch(e){y.value=e?.message||"后台刷新失败"}finally{Ae=!1}}},6e3))},Ke=async()=>{try{const e=await h.getRegisterCurrent();e&&"id"in e&&!Ee(e.id)&&(Oe(e),(e.status==="running"||e.status==="pending")&&(D.value=!0,kt(e.id)))}catch(e){y.value=e.message||"加载注册任务失败"}try{const e=await h.getLoginCurrent();e&&"id"in e&&!Ie(e.id)&&(Se(e),(e.status==="running"||e.status==="pending")&&(T.value=!0,Fe(e.id)))}catch(e){y.value=e.message||"加载刷新任务失败"}},Wt=async()=>{y.value="",D.value=!0;try{const e=Number.isFinite(ie.value)&&ie.value>0?ie.value:void 0,t=await h.startRegister(e);Oe(t),kt(t.id),ye.value=!1,Y.value=!0}catch(e){y.value=e.message||"启动注册失败",D.value=!1}},Ct=async()=>{if(p.value.size){y.value="",T.value=!0;try{const e=await h.startLogin(Array.from(p.value));Se(e),Fe(e.id),Ne()}catch(e){y.value=e.message||"启动刷新失败",T.value=!1}}},Zt=async()=>{y.value="",T.value=!0;try{await h.checkLogin();const e=await h.getLoginCurrent();if(e&&"id"in e){Se(e),Fe(e.id),Ne();return}T.value=!1}catch(e){y.value=e.message||"触发刷新失败",T.value=!1}};return(e,t)=>(r(),l(ge,null,[s("div",vs,[s("section",xs,[s("div",ms,[s("div",ps,[A(s("input",{"onUpdate:modelValue":t[0]||(t[0]=o=>le.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[$,le.value]]),J(is,{modelValue:Z.value,"onUpdate:modelValue":t[1]||(t[1]=o=>Z.value=o),options:Et},null,8,["modelValue"])]),s("div",gs,[J(be,{modelValue:De.value,"onUpdate:modelValue":ct},{default:Tt(()=>[...t[27]||(t[27]=[pe(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+n(O.value)+" / "+n(K.value.length)+" 个账号",1),s("div",bs,[s("button",{type:"button",class:g(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",G.value==="table"?"bg-accent text-accent-foreground":""]),onClick:t[2]||(t[2]=o=>G.value="table"),"aria-label":"列表视图"},[...t[28]||(t[28]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:g(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",G.value==="card"?"bg-accent text-accent-foreground":""]),onClick:t[3]||(t[3]=o=>G.value="card"),"aria-label":"卡片视图"},[...t[29]||(t[29]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",ys,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:R(re),onClick:ce}," 刷新列表 ",8,_s),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pt}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:D.value,onClick:Lt}," 添加账户 ",8,hs),s("div",{ref_key:"moreActionsRef",ref:Me,class:"relative"},[s("button",{class:g(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",z.value?"bg-accent text-accent-foreground":""]),onClick:Mt},[t[30]||(t[30]=pe(" 更多操作 ",-1)),t[31]||(t[31]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),Dt.value?(r(),l("span",{key:0,class:g(["ml-1 h-2 w-2 rounded-full",Nt.value]),"aria-hidden":"true"},null,2)):m("",!0)],2),z.value?(r(),l("div",ws,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:t[4]||(t[4]=o=>{Ne(),oe()})}," 任务状态 "),t[32]||(t[32]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",T.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:T.value,onClick:t[5]||(t[5]=o=>{Zt(),oe()})}," 刷新过期 ",10,ks),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!O.value||T.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!O.value||T.value,onClick:t[6]||(t[6]=o=>{Ct(),oe()})}," 刷新选中 ",10,Cs),t[33]||(t[33]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[7]||(t[7]=o=>{Gt(),oe()})}," 批量启用 ",10,Ts),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[8]||(t[8]=o=>{Yt(),oe()})}," 批量禁用 ",10,Ss),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[9]||(t[9]=o=>{Qt(),oe()})}," 批量删除 ",10,Es)])):m("",!0)],512)]),G.value==="card"?(r(),l("div",Is,[(r(!0),l(ge,null,Ve(K.value,o=>(r(),l("div",{key:o.id,class:g(["rounded-2xl border border-border bg-card p-4",ut(o)]),onClick:i=>Le(o.id)},[s("div",As,[s("div",null,[t[34]||(t[34]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",$s,n(o.id),1)]),s("div",Rs,[J(be,{modelValue:p.value.has(o.id),"onUpdate:modelValue":i=>Le(o.id),onClick:t[10]||(t[10]=V(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:g(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",lt(o)])},n(fe(o)),3)])]),s("div",Vs,[s("div",null,[t[35]||(t[35]=s("p",null,"剩余时间",-1)),s("p",{class:g(["mt-1 text-sm font-semibold",it(o)])},n(at(o.remaining_display)),3),o.expires_at?(r(),l("p",js,n(o.expires_at),1)):m("",!0)]),s("div",null,[t[36]||(t[36]=s("p",null,"冷却",-1)),s("p",{class:g(["mt-1",Ue(o)])},[o.cooldown_seconds>0?(r(),l("span",Ms,n(dt(o.cooldown_seconds))+" · "+n(o.cooldown_reason),1)):(r(),l("span",Ds,n(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[t[37]||(t[37]=s("p",null,"失败数",-1)),s("p",Os,n(o.error_count),1)]),s("div",null,[t[38]||(t[38]=s("p",null,"会话数",-1)),s("p",Bs,n(o.conversation_count),1)])]),s("div",Ns,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>xt(o.id),["stop"])}," 编辑 ",8,Us),nt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[11]||(t[11]=V(()=>{},["stop"])),i=>gt(o.id)]}," 启用 ",8,zs)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[12]||(t[12]=V(()=>{},["stop"])),i=>bt(o.id)]}," 禁用 ",8,Ps)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[t[13]||(t[13]=V(()=>{},["stop"])),i=>yt(o.id)]}," 删除 ",8,Fs)])],10,Ls))),128)),!K.value.length&&!R(re)?(r(),l("div",Ks," 暂无账号数据,请检查后台配置。 ")):m("",!0)])):(r(),l("div",Hs,[s("table",Js,[s("thead",Gs,[s("tr",null,[s("th",Ys,[J(be,{modelValue:De.value,"onUpdate:modelValue":ct},null,8,["modelValue"])]),t[40]||(t[40]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),t[41]||(t[41]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",Qs,[s("span",qs,[t[39]||(t[39]=pe(" 剩余/过期 ",-1)),J(cs,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),t[42]||(t[42]=s("th",{class:"py-3 pr-6"},"冷却",-1)),t[43]||(t[43]=s("th",{class:"py-3 pr-6"},"失败数",-1)),t[44]||(t[44]=s("th",{class:"py-3 pr-6"},"会话数",-1)),t[45]||(t[45]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",Xs,[!K.value.length&&!R(re)?(r(),l("tr",Ws,[...t[46]||(t[46]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):m("",!0),(r(!0),l(ge,null,Ve(K.value,o=>(r(),l("tr",{key:o.id,class:g(["border-t border-border",ut(o)]),onClick:i=>Le(o.id)},[s("td",{class:"py-4 pr-4",onClick:t[14]||(t[14]=V(()=>{},["stop"]))},[J(be,{modelValue:p.value.has(o.id),"onUpdate:modelValue":i=>Le(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",eo,n(o.id),1),s("td",to,[s("span",{class:g(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",lt(o)])},n(fe(o)),3)]),s("td",so,[s("div",{class:g(["text-sm font-semibold",it(o)])},n(at(o.remaining_display)),3),o.expires_at?(r(),l("span",oo,n(o.expires_at),1)):m("",!0)]),s("td",ro,[o.cooldown_seconds>0?(r(),l("span",{key:0,class:g(Ue(o))},n(dt(o.cooldown_seconds))+" · "+n(o.cooldown_reason),3)):(r(),l("span",{key:1,class:g(Ue(o))},n(o.cooldown_reason||"无冷却"),3))]),s("td",lo,n(o.error_count),1),s("td",no,n(o.conversation_count),1),s("td",ao,[s("div",io,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>xt(o.id),["stop"])}," 编辑 ",8,uo),nt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>gt(o.id),["stop"])}," 启用 ",8,co)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>bt(o.id),["stop"])}," 禁用 ",8,fo)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:V(i=>yt(o.id),["stop"])}," 删除 ",8,vo)])])],10,Zs))),128))])])]))])]),J(ds,{open:R(C).open.value,title:R(C).title.value,message:R(C).message.value,"confirm-text":R(C).confirmText.value,"cancel-text":R(C).cancelText.value,onConfirm:R(C).confirm,onCancel:R(C).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(r(),Re(je,{to:"body"},[ye.value?(r(),l("div",xo,[s("div",mo,[s("div",po,[s("div",null,[t[47]||(t[47]=s("p",{class:"text-sm font-medium text-foreground"},"添加账户",-1)),s("p",go,n(N.value==="register"?"创建 DuckMail 账号并自动注册":"批量导入账户配置"),1)]),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Be}," 关闭 ")]),s("div",bo,[s("div",yo,[s("div",_o,[s("button",{type:"button",class:g(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",N.value==="register"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[15]||(t[15]=o=>N.value="register")}," 自动注册 ",2),s("button",{type:"button",class:g(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",N.value==="import"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[16]||(t[16]=o=>N.value="import")}," 批量导入 ",2)]),N.value==="register"?(r(),l("div",ho,[t[48]||(t[48]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),A(s("input",{"onUpdate:modelValue":t[17]||(t[17]=o=>ie.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,ie.value,void 0,{number:!0}]]),t[49]||(t[49]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"}," 默认域名来自设置面板(可在“配置面板”中修改) ",-1))])):(r(),l("div",wo,[t[50]||(t[50]=s("label",{class:"block text-xs text-muted-foreground"},"批量导入(每行一个)",-1)),A(s("textarea",{"onUpdate:modelValue":t[18]||(t[18]=o=>de.value=o),class:"min-h-[140px] w-full rounded-2xl border border-input bg-background px-3 py-2 text-xs font-mono",placeholder:`duckmail----you@example.com----password
2
+ user@outlook.com----loginPassword----clientId----refreshToken`},null,512),[[$,de.value]]),t[51]||(t[51]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"支持两种格式:"),s("p",{class:"mt-1 font-mono"},"duckmail----email----password"),s("p",{class:"mt-1 font-mono"},"email----password----clientId----refreshToken"),s("p",{class:"mt-2 text-[11px]"},'导入后请执行一次"刷新选中"以获取 Cookie。')],-1)),U.value?(r(),l("div",ko,n(U.value),1)):m("",!0)])),t[53]||(t[53]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-[11px] leading-relaxed text-muted-foreground"},[s("p",{class:"text-xs font-medium text-foreground"},"⚠️ 使用提示"),s("p",{class:"mt-1"},"• 本工具仅限个人学习与技术研究"),s("p",null,"• 请遵守相关服务条款,合理使用"),s("p",null,[pe("• 详细声明请查看项目 "),s("a",{href:"https://github.com/Dreamy-rain/gemini-business2api/blob/main/docs/DISCLAIMER.md",target:"_blank",class:"text-primary hover:underline"},"DISCLAIMER.md")])],-1)),J(be,{modelValue:ue.value,"onUpdate:modelValue":t[19]||(t[19]=o=>ue.value=o)},{default:Tt(()=>[...t[52]||(t[52]=[pe(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])])]),s("div",Co,[s("div",To,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Be}," 取消 "),N.value==="register"?(r(),l("button",{key:0,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:D.value||!ue.value,onClick:Wt}," 开始注册 ",8,So)):(r(),l("button",{key:1,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:_e.value||!ue.value,onClick:$t}," 导入并保存 ",8,Eo))])])])])):m("",!0)])),(r(),Re(je,{to:"body"},[Y.value?(r(),l("div",Io,[s("div",Lo,[s("div",Ao,[t[54]||(t[54]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",$o,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary",disabled:!Q.value.length&&!q.value.length&&!c.value&&!f.value&&!y.value,onClick:jt}," 清空日志 ",8,Ro),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Vt}," 关闭 ")])]),s("div",Vo,[y.value?(r(),l("div",jo,n(y.value),1)):m("",!0),c.value||f.value?(r(),l("div",Mo,[c.value?(r(),l("div",Do,[t[55]||(t[55]=s("div",{class:"font-medium text-foreground"},"注册任务",-1)),s("div",Oo,[s("span",null,"状态:"+n(_t(c.value.status)),1),s("span",null,"进度:"+n(c.value.progress)+"/"+n(c.value.count),1),s("span",null,"成功:"+n(c.value.success_count),1),s("span",null,"失败:"+n(c.value.fail_count),1)])])):m("",!0),f.value?(r(),l("div",Bo,[t[56]||(t[56]=s("div",{class:"font-medium text-foreground"},"刷新任务",-1)),s("div",No,[s("span",null,"状态:"+n(_t(f.value.status)),1),s("span",null,"进度:"+n(f.value.progress)+"/"+n(f.value.account_ids.length),1),s("span",null,"成功:"+n(f.value.success_count),1),s("span",null,"失败:"+n(f.value.fail_count),1)])])):m("",!0)])):m("",!0),Q.value.length||q.value.length?(r(),l("div",Uo,[s("div",{ref_key:"taskLogsRef",ref:Xe,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[Q.value.length?(r(),l("div",zo,[t[57]||(t[57]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",Po,[(r(!0),l(ge,null,Ve(Q.value,(o,i)=>(r(),l("div",{key:`reg-${i}`,class:"font-mono"},n(vt(o)),1))),128))])])):m("",!0),q.value.length?(r(),l("div",Fo,[t[58]||(t[58]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",Ko,[(r(!0),l(ge,null,Ve(q.value,(o,i)=>(r(),l("div",{key:`login-${i}`,class:"font-mono"},n(vt(o)),1))),128))])])):m("",!0)],512)])):m("",!0),!y.value&&!c.value&&!f.value&&!Q.value.length&&!q.value.length?(r(),l("div",Ho," 暂无任务 ")):m("",!0)])])])):m("",!0)])),(r(),Re(je,{to:"body"},[ne.value?(r(),l("div",Jo,[s("div",Go,[s("div",{class:"flex items-center justify-between"},[t[59]||(t[59]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Pe}," 关闭 ")]),u.value?(r(),l("div",Yo,n(u.value),1)):m("",!0),s("div",Qo,[t[60]||(t[60]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),A(s("input",{"onUpdate:modelValue":t[20]||(t[20]=o=>_.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[$,_.value.id]]),t[61]||(t[61]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),A(s("textarea",{"onUpdate:modelValue":t[21]||(t[21]=o=>_.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[$,_.value.secure_c_ses]]),t[62]||(t[62]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),A(s("input",{"onUpdate:modelValue":t[22]||(t[22]=o=>_.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.csesidx]]),t[63]||(t[63]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),A(s("input",{"onUpdate:modelValue":t[23]||(t[23]=o=>_.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.config_id]]),t[64]||(t[64]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),A(s("input",{"onUpdate:modelValue":t[24]||(t[24]=o=>_.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.host_c_oses]]),t[65]||(t[65]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),A(s("input",{"onUpdate:modelValue":t[25]||(t[25]=o=>_.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[$,_.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Jt}," 保存 ")])])])):m("",!0)])),(r(),Re(je,{to:"body"},[j.value?(r(),l("div",qo,[s("div",Xo,[s("div",Wo,[t[66]||(t[66]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",Zo,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Kt},n(B.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:ze}," 关闭 ")])]),M.value?(r(),l("div",er,n(M.value),1)):m("",!0),s("div",tr,[A(s("textarea",{"onUpdate:modelValue":t[26]||(t[26]=o=>ee.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:B.value},null,8,sr),[[$,ee.value]])]),s("div",or,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:ze}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Ht,disabled:B.value}," 保存 ",8,rr)])])])):m("",!0)]))],64))}});export{cr as default};
static/assets/Accounts-qETksrou.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ import{g as E,D as ts,h as a,d as ss,E as os,i as H,o as rs,A as ls,j as ns,c as l,a as s,p as J,m as Re,q as A,v as $,s as Tt,t as n,n as g,u as R,b as m,f as pe,F as ge,r as Ve,x as je,w as V,e as r,G as as}from"./index-JaBfp01b.js";import{_ as is}from"./SelectMenu.vue_vue_type_script_setup_true_lang-cSKw_kbn.js";import{_ as be}from"./Checkbox.vue_vue_type_script_setup_true_lang-B33RCL2G.js";import{_ as ds}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-BuSWgV7j.js";import{u as us}from"./useConfirmDialog-BGx3Bidu.js";import{_ as cs}from"./HelpTip.vue_vue_type_script_setup_true_lang-DO1J64wx.js";const h={list:()=>E.get("/admin/accounts"),getConfig:()=>E.get("/admin/accounts-config"),updateConfig:b=>E.put("/admin/accounts-config",b),delete:b=>E.delete(`/admin/accounts/${b}`),disable:b=>E.put(`/admin/accounts/${b}/disable`),enable:b=>E.put(`/admin/accounts/${b}/enable`),startRegister:(b,w)=>E.post("/admin/register/start",{count:b,domain:w}),getRegisterTask:b=>E.get(`/admin/register/task/${b}`),getRegisterCurrent:()=>E.get("/admin/register/current"),startLogin:b=>E.post("/admin/login/start",b),getLoginTask:b=>E.get(`/admin/login/task/${b}`),getLoginCurrent:()=>E.get("/admin/login/current"),checkLogin:()=>E.post("/admin/login/check")},fs=ts("accounts",()=>{const b=a([]),w=a(!1);async function L(){w.value=!0;try{const u=await h.list();b.value=Array.isArray(u)?u:u.accounts||[]}finally{w.value=!1}}async function re(u){await h.delete(u),await L()}async function C(u){await h.disable(u),await L()}async function le(u){await h.enable(u),await L()}async function Z(u){await Promise.all(u.map(j=>h.enable(j))),await L()}async function p(u){await Promise.all(u.map(j=>h.disable(j))),await L()}async function G(u){await Promise.all(u.map(j=>h.delete(j))),await L()}async function ne(u){await h.updateConfig(u),await L()}return{accounts:b,isLoading:w,loadAccounts:L,deleteAccount:re,disableAccount:C,enableAccount:le,bulkEnable:Z,bulkDisable:p,bulkDelete:G,updateConfig:ne}}),vs={class:"space-y-8"},xs={class:"rounded-3xl border border-border bg-card p-6"},ms={class:"flex flex-wrap items-center justify-between gap-4"},ps={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},gs={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},bs={class:"ml-auto flex items-center gap-2 sm:ml-0"},ys={class:"mt-4 flex flex-wrap items-center gap-2"},_s=["disabled"],hs=["disabled"],ws={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},ks=["disabled"],Cs=["disabled"],Ts=["disabled"],Ss=["disabled"],Es=["disabled"],Is={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},Ls=["onClick"],As={class:"flex items-start justify-between gap-3"},$s={class:"mt-1 font-mono text-xs text-foreground"},Rs={class:"flex items-center gap-2"},Vs={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},js={key:0,class:"mt-1 text-[11px]"},Ms={key:0},Ds={key:1},Os={class:"mt-1 text-sm font-semibold text-foreground"},Bs={class:"mt-1 text-sm font-semibold text-foreground"},Ns={class:"mt-4 flex flex-wrap items-center gap-2"},Us=["onClick"],zs=["onClick"],Ps=["onClick"],Fs=["onClick"],Ks={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Hs={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},Js={class:"min-w-full text-left text-sm"},Gs={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Ys={class:"py-3 pr-4"},qs={class:"py-3 pr-6"},Qs={class:"inline-flex items-center gap-2"},Xs={class:"text-sm text-foreground"},Ws={key:0},Zs=["onClick"],eo={class:"py-4 pr-6 font-mono text-xs text-foreground"},to={class:"py-4 pr-6"},so={class:"py-4 pr-6"},oo={key:0,class:"block text-[11px] text-muted-foreground"},ro={class:"py-4 pr-6 text-xs"},lo={class:"py-4 pr-6 text-xs text-muted-foreground"},no={class:"py-4 pr-6 text-xs text-muted-foreground"},ao={class:"py-4 text-right"},io={class:"flex flex-wrap justify-end gap-2"},uo=["onClick"],co=["onClick"],fo=["onClick"],vo=["onClick"],xo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},mo={class:"flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},po={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},go={class:"mt-1 text-xs text-muted-foreground"},bo={class:"scrollbar-slim flex-1 overflow-y-auto px-6 py-4"},yo={class:"space-y-4 text-sm"},_o={class:"flex rounded-full border border-border bg-muted/30 p-1 text-xs"},ho={key:0,class:"space-y-4"},wo={key:1,class:"space-y-4"},ko={key:0,class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-600"},Co={class:"border-t border-border/60 px-6 py-4"},To={class:"flex items-center justify-end gap-2"},So=["disabled"],Eo=["disabled"],Io={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Lo={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},Ao={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},$o={class:"flex items-center gap-2"},Ro=["disabled"],Vo={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},jo={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},Mo={key:1,class:"grid gap-3 text-xs text-muted-foreground"},Do={key:0,class:"space-y-1"},Oo={class:"flex flex-wrap gap-x-4 gap-y-1"},Bo={key:1,class:"space-y-1"},No={class:"flex flex-wrap gap-x-4 gap-y-1"},Uo={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},zo={key:0,class:"space-y-2"},Po={class:"space-y-1 text-[11px] text-muted-foreground"},Fo={key:1,class:"mt-4 space-y-2"},Ko={class:"space-y-1 text-[11px] text-muted-foreground"},Ho={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},Jo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Go={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Yo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},qo={class:"mt-4 space-y-3 text-sm"},Qo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Xo={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},Wo={class:"flex items-center justify-between"},Zo={class:"flex items-center gap-2"},er={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},tr={class:"mt-4"},sr=["readonly"],or={class:"mt-6 flex items-center justify-end gap-2"},rr=["disabled"],He="accounts-register-task-cache",Je="accounts-login-task-cache",Ge="accounts-register-log-clear",Ye="accounts-login-log-clear",qe="accounts-register-task-cleared-id",Qe="accounts-login-task-cleared-id",St="1970-01-01 00:00:00",cr=ss({__name:"Accounts",setup(b){const w=fs(),{accounts:L,isLoading:re}=os(w),C=us(),le=a(""),Z=a("all"),p=a(new Set),G=a("table"),ne=a(!1),u=a(""),j=a(!1),M=a(""),ee=a(""),B=a(!1),ae=a([]),ie=a(1),ye=a(!1),N=a("register"),de=a(""),U=a(""),_e=a(!1),Y=a(!1),z=a(!1),Me=a(null),he=a(null),we=a(null),P=a(null),F=a(null),te=a(0),se=a(0),ue=a(!1),c=a(null),f=a(null),Xe=a(null),D=a(!1),T=a(!1),y=a(""),_=a({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),ke=a(null),We=a([]),Et=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],K=H(()=>{const e=le.value.trim().toLowerCase();return L.value.filter(t=>{const o=!e||t.id.toLowerCase().includes(e),i=Z.value==="all"||fe(t)===Z.value;return o&&i})}),O=H(()=>p.value.size),De=H(()=>K.value.length>0&&K.value.every(e=>p.value.has(e.id))),ce=async()=>{await w.loadAccounts(),p.value=new Set,z.value=!1},Ze=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},et=e=>{try{return localStorage.getItem(e)||null}catch{return null}},Ce=(e,t)=>{try{if(t){localStorage.setItem(e,t);return}localStorage.removeItem(e)}catch{}},tt=(e,t)=>{try{localStorage.setItem(e,JSON.stringify(t))}catch{}},st=e=>{try{localStorage.removeItem(e)}catch{}},ot=e=>{const t=localStorage.getItem(e),o=Number(t);return Number.isFinite(o)?o:0},Te=(e,t)=>{try{localStorage.setItem(e,String(t))}catch{}},Oe=(e,t=!0)=>{e&&(e.id&&e.id===P.value||(e.id&&P.value&&e.id!==P.value&&(P.value=null,Ce(qe,null)),c.value=e,e.id&&e.id!==he.value&&(he.value=e.id,te.value=0,Te(Ge,0)),t&&tt(He,e)))},Se=(e,t=!0)=>{e&&(e.id&&e.id===F.value||(e.id&&F.value&&e.id!==F.value&&(F.value=null,Ce(Qe,null)),f.value=e,e.id&&e.id!==we.value&&(we.value=e.id,se.value=0,Te(Ye,0)),t&&tt(Je,e)))},It=()=>{te.value=ot(Ge),se.value=ot(Ye),P.value=et(qe),F.value=et(Qe);const e=Ze(He);e&&e.id!==P.value&&(c.value=e,he.value=e.id||null);const t=Ze(Je);t&&t.id!==F.value&&(f.value=t,we.value=t.id||null)},Lt=()=>{ye.value=!0,N.value="register",de.value="",U.value="",_e.value=!1,ue.value=!1},Be=()=>{ye.value=!1},At=e=>{const t=[],o=[];return e.split(/\r?\n/).map(d=>d.trim()).filter(Boolean).forEach((d,x)=>{const v=d.split("----").map(S=>S.trim()),k=x+1;if(v.length){if(v[0].toLowerCase()==="duckmail"){if(v.length<3||!v[1]||!v[2]){o.push(`第 ${k} 行格式错误(duckmail)`);return}const S=v[1],$e=v.slice(2).join("----");t.push({id:S,secure_c_ses:"",csesidx:"",config_id:"",expires_at:St,mail_provider:"duckmail",mail_address:S,mail_password:$e});return}if(v.length>=4&&v[0]&&v[2]&&v[3]){const S=v[0],$e=v[1]||"",I=v[2],es=v.slice(3).join("----");t.push({id:S,secure_c_ses:"",csesidx:"",config_id:"",expires_at:St,mail_provider:"microsoft",mail_address:S,mail_password:$e,mail_client_id:I,mail_refresh_token:es,mail_tenant:"consumers"});return}o.push(`第 ${k} 行格式错误`)}}),{items:t,errors:o}},$t=async()=>{if(U.value="",!de.value.trim()){U.value="请输入导入内容";return}const{items:e,errors:t}=At(de.value);if(!e.length){U.value=t.length?t.join(","):"未识别到有效账号";return}if(t.length){U.value=t.slice(0,3).join(",");return}_e.value=!0;try{const i=[...await ft()],d=new Map(i.map((k,S)=>[k.id,S])),x=[];e.forEach(k=>{const S=d.get(k.id||"");if(S===void 0){i.push(k),x.push(k.id);return}const I={...i[S],mail_provider:k.mail_provider,mail_address:k.mail_address};k.mail_provider==="microsoft"?(I.mail_client_id=k.mail_client_id,I.mail_refresh_token=k.mail_refresh_token,I.mail_tenant=k.mail_tenant,I.mail_password=k.mail_password):(I.mail_password=k.mail_password,I.mail_client_id=void 0,I.mail_refresh_token=void 0,I.mail_tenant=void 0),i[S]=I,x.push(k.id)}),await w.updateConfig(i),await ce(),p.value=new Set(x),Be(),await C.ask({title:"导入成功",message:`已导入 ${x.length} 个账户并自动选中。是否立即刷新这些账户以获取 Cookie?`,confirmText:"立即刷新",cancelText:"稍后手动刷新"})&&await Ct()}catch(o){U.value=o.message||"导入失败"}finally{_e.value=!1}},Rt=async()=>{try{const e=[],t=c.value?.id,o=f.value?.id;if(t&&!Ee(t)&&e.push(ht(t)),o&&!Ie(o)&&e.push(wt(o)),!e.length){await Ke();return}await Promise.all(e)}catch(e){y.value=e?.message||"任务状态更新失败"}},Ne=async()=>{Y.value=!0,await Rt()},Vt=()=>{Y.value=!1},jt=()=>{const e=c.value?.id||null,t=f.value?.id||null;P.value=e,F.value=t,Ce(qe,e),Ce(Qe,t),te.value=c.value?.logs?.length||0,se.value=f.value?.logs?.length||0,Te(Ge,te.value),Te(Ye,se.value),c.value=null,f.value=null,he.value=null,we.value=null,y.value="",D.value=!1,T.value=!1,X(),W(),st(He),st(Je)},Ee=e=>!!(e&&e===P.value),Ie=e=>!!(e&&e===F.value),Mt=()=>{z.value=!z.value},oe=()=>{z.value=!1},rt=e=>{if(!z.value)return;const t=e.target;Me.value&&!Me.value.contains(t)&&(z.value=!1)};rs(async()=>{It(),await ce(),await Ke(),Xt(),document.addEventListener("click",rt)});const q=H(()=>{const e=c.value?.logs||[];return te.value?e.slice(te.value):e}),Q=H(()=>{const e=f.value?.logs||[];return se.value?e.slice(se.value):e}),Dt=H(()=>!!y.value||!!c.value||!!f.value||q.value.length>0||Q.value.length>0),Ot=async()=>{await as();const e=Xe.value;e&&(e.scrollTop=e.scrollHeight)};ls([q,Q,Y],async()=>{Y.value&&await Ot()},{deep:!0});const Bt=H(()=>{const e=c.value?.status,t=f.value?.status;return e==="running"||e==="pending"||t==="running"||t==="pending"}),Nt=H(()=>{if(y.value)return"bg-rose-500";if(Bt.value)return"bg-sky-400";const e=[];if(c.value){const d=c.value.success_count??0,x=c.value.fail_count??0,v=c.value.count??d+x;e.push({success:d,fail:x,total:v,status:c.value.status})}if(f.value){const d=f.value.success_count??0,x=f.value.fail_count??0,v=f.value.account_ids?.length??d+x;e.push({success:d,fail:x,total:v,status:f.value.status})}if(!e.length)return"bg-muted-foreground";const t=e.reduce((d,x)=>d+x.success,0),o=e.reduce((d,x)=>d+x.fail,0),i=e.reduce((d,x)=>d+(x.total||0),0);if(t>0&&o>0)return"bg-amber-400";if(o>0&&t===0)return"bg-rose-500";if(t>0&&o===0)return"bg-emerald-400";if(i===0){const d=e.every(v=>v.status==="success");if(e.some(v=>v.status==="failed"))return"bg-rose-500";if(d)return"bg-emerald-400"}return"bg-muted-foreground"});ns(()=>{X(),W(),Qt(),document.removeEventListener("click",rt)});const fe=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?"429限流":e.cooldown_reason==="错误禁用"?"错误禁用":e.disabled?"手动禁用":e.status==="已过期"?"已过期":e.status==="即将过期"?"即将过期":"正常",lt=e=>{const t=fe(e);return t==="429限流"||t==="即将过期"?"bg-amber-200 text-amber-900":t==="错误禁用"||t==="已过期"?"bg-destructive/10 text-destructive":t==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},nt=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?!0:e.disabled||e.cooldown_reason==="错误禁用",at=e=>e==="已过期"?"过期":e==="未设置"?"未设置":e,it=e=>e.status==="已过期"?"text-rose-600":e.status==="即将过期"?"text-amber-700":e.status==="未设置"?"text-muted-foreground":"text-emerald-600",dt=e=>e<60?`${e} 秒`:e<3600?`${Math.ceil(e/60)} 分钟`:`${(e/3600).toFixed(1)} 小时`,Ue=e=>e.cooldown_seconds>0?"text-amber-700":e.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",ut=e=>{const t=fe(e);return t==="手动禁用"||t==="已过期"?"bg-muted/70":""},Le=e=>{const t=new Set(p.value);t.has(e)?t.delete(e):t.add(e),p.value=t},ct=()=>{if(De.value){p.value=new Set;return}p.value=new Set(K.value.map(e=>e.id))},Ut=(e,t)=>e.id||`account_${t+1}`,ft=async()=>(await h.getConfig()).accounts.map((t,o)=>({...t,id:Ut(t,o)})),vt=e=>`${e.time} [${e.level}] ${e.message}`,zt=(e,t)=>{let o=-1;for(let d=0;d<e.length;d+=1)if(e[d].id===t){o=d;break}if(o===-1)return u.value="未找到对应账号配置。",!1;const i=e[o];return _.value={id:i.id,secure_c_ses:i.secure_c_ses,csesidx:i.csesidx,config_id:i.config_id,host_c_oses:i.host_c_oses,expires_at:i.expires_at},We.value=e,ke.value=o,ne.value=!0,!0},xt=async e=>{u.value="";try{const t=await ft();zt(t,e)}catch(t){u.value=t.message||"加载账号配置失败"}},Pt=async()=>{M.value="";try{const e=await h.getConfig();ae.value=Array.isArray(e.accounts)?e.accounts:[],ee.value=JSON.stringify(pt(ae.value),null,2),B.value=!0,j.value=!0}catch(e){M.value=e.message||"加载账号配置失败"}},ze=()=>{j.value=!1,M.value="",B.value=!1},mt=()=>{const e=JSON.parse(ee.value);if(!Array.isArray(e))throw new Error("配置格式必须是数组。");return e},Ft=e=>typeof e!="string"||!e?e:e.length<=6?`${e.slice(0,2)}****`:`${e.slice(0,3)}****`,pt=e=>{const t=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password","mail_refresh_token","mail_client_id"]);return e.map(o=>{const i={...o};return t.forEach(d=>{const x=i[d];x&&(i[d]=Ft(x))}),i})},Kt=()=>{if(M.value="",!B.value){try{ae.value=mt()}catch(e){M.value=e.message||"JSON 格式错误";return}ee.value=JSON.stringify(pt(ae.value),null,2),B.value=!0;return}ee.value=JSON.stringify(ae.value,null,2),B.value=!1},Ht=async()=>{M.value="";try{const e=mt();await w.updateConfig(e),ze()}catch(e){M.value=e.message||"保存失败"}},Pe=()=>{ne.value=!1,u.value=""},Jt=async()=>{if(ke.value===null)return;const e=[...We.value];e[ke.value]={...e[ke.value],id:_.value.id,secure_c_ses:_.value.secure_c_ses,csesidx:_.value.csesidx,config_id:_.value.config_id,host_c_oses:_.value.host_c_oses||void 0,expires_at:_.value.expires_at||void 0};try{await w.updateConfig(e),Pe()}catch(t){u.value=t.message||"保存失败"}},Gt=async()=>{await w.bulkEnable(Array.from(p.value)),p.value=new Set},Yt=async()=>{await C.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"})&&(await w.bulkDisable(Array.from(p.value)),p.value=new Set)},qt=async()=>{await C.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"})&&(await w.bulkDelete(Array.from(p.value)),p.value=new Set)},gt=async e=>{await w.enableAccount(e)},bt=async e=>{await C.ask({title:"禁用账号",message:"确定要禁用该账号吗?"})&&await w.disableAccount(e)},yt=async e=>{await C.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"})&&await w.deleteAccount(e)};let ve=null,xe=null,me=null,Ae=!1;const X=()=>{ve!==null&&(window.clearInterval(ve),ve=null)},W=()=>{xe!==null&&(window.clearInterval(xe),xe=null)},Qt=()=>{me!==null&&(window.clearInterval(me),me=null),Ae=!1},_t=e=>e==="pending"?"等待中":e==="running"?"执行中":e==="success"?"成功":e==="failed"?"失败":e,ht=async e=>{if(Ee(e)){X();return}const t=await h.getRegisterTask(e);if(Ee(t.id)){X();return}Oe(t),t.status!=="running"&&t.status!=="pending"&&(D.value=!1,X(),await ce())},wt=async e=>{if(Ie(e)){W();return}const t=await h.getLoginTask(e);if(Ie(t.id)){W();return}Se(t),t.status!=="running"&&t.status!=="pending"&&(T.value=!1,W(),await ce())},kt=e=>{X(),ve=window.setInterval(()=>{ht(e).catch(t=>{y.value=t?.message||"注册任务更新失败",X(),D.value=!1})},3e3)},Fe=e=>{W(),xe=window.setInterval(()=>{wt(e).catch(t=>{y.value=t?.message||"刷新任务更新失败",W(),T.value=!1})},3e3)},Xt=()=>{me===null&&(me=window.setInterval(async()=>{if(!Ae&&!Y.value&&!(ve!==null||xe!==null)&&!(!D.value&&!T.value&&!c.value&&!f.value)){Ae=!0;try{await Ke()}catch(e){y.value=e?.message||"后台刷新失败"}finally{Ae=!1}}},6e3))},Ke=async()=>{try{const e=await h.getRegisterCurrent();e&&"id"in e&&!Ee(e.id)&&(Oe(e),(e.status==="running"||e.status==="pending")&&(D.value=!0,kt(e.id)))}catch(e){y.value=e.message||"加载注册任务失败"}try{const e=await h.getLoginCurrent();e&&"id"in e&&!Ie(e.id)&&(Se(e),(e.status==="running"||e.status==="pending")&&(T.value=!0,Fe(e.id)))}catch(e){y.value=e.message||"加载刷新任务失败"}},Wt=async()=>{y.value="",D.value=!0;try{const e=Number.isFinite(ie.value)&&ie.value>0?ie.value:void 0,t=await h.startRegister(e);Oe(t),kt(t.id),ye.value=!1,Y.value=!0}catch(e){y.value=e.message||"启动注册失败",D.value=!1}},Ct=async()=>{if(p.value.size){y.value="",T.value=!0;try{const e=await h.startLogin(Array.from(p.value));Se(e),Fe(e.id),Ne()}catch(e){y.value=e.message||"启动刷新失败",T.value=!1}}},Zt=async()=>{y.value="",T.value=!0;try{await h.checkLogin();const e=await h.getLoginCurrent();if(e&&"id"in e){Se(e),Fe(e.id),Ne();return}T.value=!1}catch(e){y.value=e.message||"触发刷新失败",T.value=!1}};return(e,t)=>(r(),l(ge,null,[s("div",vs,[s("section",xs,[s("div",ms,[s("div",ps,[A(s("input",{"onUpdate:modelValue":t[0]||(t[0]=o=>le.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[$,le.value]]),J(is,{modelValue:Z.value,"onUpdate:modelValue":t[1]||(t[1]=o=>Z.value=o),options:Et},null,8,["modelValue"])]),s("div",gs,[J(be,{modelValue:De.value,"onUpdate:modelValue":ct},{default:Tt(()=>[...t[27]||(t[27]=[pe(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+n(O.value)+" / "+n(K.value.length)+" 个账号",1),s("div",bs,[s("button",{type:"button",class:g(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",G.value==="table"?"bg-accent text-accent-foreground":""]),onClick:t[2]||(t[2]=o=>G.value="table"),"aria-label":"列表视图"},[...t[28]||(t[28]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:g(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",G.value==="card"?"bg-accent text-accent-foreground":""]),onClick:t[3]||(t[3]=o=>G.value="card"),"aria-label":"卡片视图"},[...t[29]||(t[29]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",ys,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:R(re),onClick:ce}," 刷新列表 ",8,_s),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pt}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:D.value,onClick:Lt}," 添加账户 ",8,hs),s("div",{ref_key:"moreActionsRef",ref:Me,class:"relative"},[s("button",{class:g(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",z.value?"bg-accent text-accent-foreground":""]),onClick:Mt},[t[30]||(t[30]=pe(" 更多操作 ",-1)),t[31]||(t[31]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),Dt.value?(r(),l("span",{key:0,class:g(["ml-1 h-2 w-2 rounded-full",Nt.value]),"aria-hidden":"true"},null,2)):m("",!0)],2),z.value?(r(),l("div",ws,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:t[4]||(t[4]=o=>{Ne(),oe()})}," 任务状态 "),t[32]||(t[32]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",T.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:T.value,onClick:t[5]||(t[5]=o=>{Zt(),oe()})}," 刷新过期 ",10,ks),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!O.value||T.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!O.value||T.value,onClick:t[6]||(t[6]=o=>{Ct(),oe()})}," 刷新选中 ",10,Cs),t[33]||(t[33]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[7]||(t[7]=o=>{Gt(),oe()})}," 批量启用 ",10,Ts),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[8]||(t[8]=o=>{Yt(),oe()})}," 批量禁用 ",10,Ss),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[9]||(t[9]=o=>{qt(),oe()})}," 批量删除 ",10,Es)])):m("",!0)],512)]),G.value==="card"?(r(),l("div",Is,[(r(!0),l(ge,null,Ve(K.value,o=>(r(),l("div",{key:o.id,class:g(["rounded-2xl border border-border bg-card p-4",ut(o)]),onClick:i=>Le(o.id)},[s("div",As,[s("div",null,[t[34]||(t[34]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",$s,n(o.id),1)]),s("div",Rs,[J(be,{modelValue:p.value.has(o.id),"onUpdate:modelValue":i=>Le(o.id),onClick:t[10]||(t[10]=V(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:g(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",lt(o)])},n(fe(o)),3)])]),s("div",Vs,[s("div",null,[t[35]||(t[35]=s("p",null,"剩余时间",-1)),s("p",{class:g(["mt-1 text-sm font-semibold",it(o)])},n(at(o.remaining_display)),3),o.expires_at?(r(),l("p",js,n(o.expires_at),1)):m("",!0)]),s("div",null,[t[36]||(t[36]=s("p",null,"冷却",-1)),s("p",{class:g(["mt-1",Ue(o)])},[o.cooldown_seconds>0?(r(),l("span",Ms,n(dt(o.cooldown_seconds))+" · "+n(o.cooldown_reason),1)):(r(),l("span",Ds,n(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[t[37]||(t[37]=s("p",null,"失败数",-1)),s("p",Os,n(o.error_count),1)]),s("div",null,[t[38]||(t[38]=s("p",null,"会话数",-1)),s("p",Bs,n(o.conversation_count),1)])]),s("div",Ns,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>xt(o.id),["stop"])}," 编辑 ",8,Us),nt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[11]||(t[11]=V(()=>{},["stop"])),i=>gt(o.id)]}," 启用 ",8,zs)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[12]||(t[12]=V(()=>{},["stop"])),i=>bt(o.id)]}," 禁用 ",8,Ps)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[t[13]||(t[13]=V(()=>{},["stop"])),i=>yt(o.id)]}," 删除 ",8,Fs)])],10,Ls))),128)),!K.value.length&&!R(re)?(r(),l("div",Ks," 暂无账号数据,请检查后台配置。 ")):m("",!0)])):(r(),l("div",Hs,[s("table",Js,[s("thead",Gs,[s("tr",null,[s("th",Ys,[J(be,{modelValue:De.value,"onUpdate:modelValue":ct},null,8,["modelValue"])]),t[40]||(t[40]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),t[41]||(t[41]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",qs,[s("span",Qs,[t[39]||(t[39]=pe(" 剩余/过期 ",-1)),J(cs,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),t[42]||(t[42]=s("th",{class:"py-3 pr-6"},"冷却",-1)),t[43]||(t[43]=s("th",{class:"py-3 pr-6"},"失败数",-1)),t[44]||(t[44]=s("th",{class:"py-3 pr-6"},"会话数",-1)),t[45]||(t[45]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",Xs,[!K.value.length&&!R(re)?(r(),l("tr",Ws,[...t[46]||(t[46]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):m("",!0),(r(!0),l(ge,null,Ve(K.value,o=>(r(),l("tr",{key:o.id,class:g(["border-t border-border",ut(o)]),onClick:i=>Le(o.id)},[s("td",{class:"py-4 pr-4",onClick:t[14]||(t[14]=V(()=>{},["stop"]))},[J(be,{modelValue:p.value.has(o.id),"onUpdate:modelValue":i=>Le(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",eo,n(o.id),1),s("td",to,[s("span",{class:g(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",lt(o)])},n(fe(o)),3)]),s("td",so,[s("div",{class:g(["text-sm font-semibold",it(o)])},n(at(o.remaining_display)),3),o.expires_at?(r(),l("span",oo,n(o.expires_at),1)):m("",!0)]),s("td",ro,[o.cooldown_seconds>0?(r(),l("span",{key:0,class:g(Ue(o))},n(dt(o.cooldown_seconds))+" · "+n(o.cooldown_reason),3)):(r(),l("span",{key:1,class:g(Ue(o))},n(o.cooldown_reason||"无冷却"),3))]),s("td",lo,n(o.error_count),1),s("td",no,n(o.conversation_count),1),s("td",ao,[s("div",io,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>xt(o.id),["stop"])}," 编辑 ",8,uo),nt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>gt(o.id),["stop"])}," 启用 ",8,co)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>bt(o.id),["stop"])}," 禁用 ",8,fo)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:V(i=>yt(o.id),["stop"])}," 删除 ",8,vo)])])],10,Zs))),128))])])]))])]),J(ds,{open:R(C).open.value,title:R(C).title.value,message:R(C).message.value,"confirm-text":R(C).confirmText.value,"cancel-text":R(C).cancelText.value,onConfirm:R(C).confirm,onCancel:R(C).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(r(),Re(je,{to:"body"},[ye.value?(r(),l("div",xo,[s("div",mo,[s("div",po,[s("div",null,[t[47]||(t[47]=s("p",{class:"text-sm font-medium text-foreground"},"添加账户",-1)),s("p",go,n(N.value==="register"?"创建 DuckMail 账号并自动注册":"批量导入账户配置"),1)]),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Be}," 关闭 ")]),s("div",bo,[s("div",yo,[s("div",_o,[s("button",{type:"button",class:g(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",N.value==="register"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[15]||(t[15]=o=>N.value="register")}," 自动注册 ",2),s("button",{type:"button",class:g(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",N.value==="import"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[16]||(t[16]=o=>N.value="import")}," 批量导入 ",2)]),N.value==="register"?(r(),l("div",ho,[t[48]||(t[48]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),A(s("input",{"onUpdate:modelValue":t[17]||(t[17]=o=>ie.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,ie.value,void 0,{number:!0}]]),t[49]||(t[49]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"}," 默认域名来自设置面板(可在“配置面板”中修改) ",-1))])):(r(),l("div",wo,[t[50]||(t[50]=s("label",{class:"block text-xs text-muted-foreground"},"批量导入(每行一个)",-1)),A(s("textarea",{"onUpdate:modelValue":t[18]||(t[18]=o=>de.value=o),class:"min-h-[140px] w-full rounded-2xl border border-input bg-background px-3 py-2 text-xs font-mono",placeholder:`duckmail----you@example.com----password
2
+ user@outlook.com----loginPassword----clientId----refreshToken`},null,512),[[$,de.value]]),t[51]||(t[51]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"支持两种格式:"),s("p",{class:"mt-1 font-mono"},"duckmail----email----password"),s("p",{class:"mt-1 font-mono"},"email----password----clientId----refreshToken"),s("p",{class:"mt-2 text-[11px]"},'导入后请执行一次"刷新选中"以获取 Cookie。')],-1)),U.value?(r(),l("div",ko,n(U.value),1)):m("",!0)])),t[53]||(t[53]=s("div",{class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-[11px] leading-relaxed"},[s("p",{class:"text-xs font-bold text-rose-600"},"⚠️ 严禁滥用:禁止将本工具用于商业用途或任何形式的滥用(无论规模大小)"),s("p",{class:"mt-1 text-muted-foreground"},[pe("详细声明请查看项目 "),s("a",{href:"https://github.com/Dreamy-rain/gemini-business2api/blob/main/docs/DISCLAIMER.md",target:"_blank",class:"text-primary hover:underline font-medium"},"DISCLAIMER.md")])],-1)),J(be,{modelValue:ue.value,"onUpdate:modelValue":t[19]||(t[19]=o=>ue.value=o)},{default:Tt(()=>[...t[52]||(t[52]=[pe(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])])]),s("div",Co,[s("div",To,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Be}," 取消 "),N.value==="register"?(r(),l("button",{key:0,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:D.value||!ue.value,onClick:Wt}," 开始注册 ",8,So)):(r(),l("button",{key:1,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:_e.value||!ue.value,onClick:$t}," 导入并保存 ",8,Eo))])])])])):m("",!0)])),(r(),Re(je,{to:"body"},[Y.value?(r(),l("div",Io,[s("div",Lo,[s("div",Ao,[t[54]||(t[54]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",$o,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary",disabled:!q.value.length&&!Q.value.length&&!c.value&&!f.value&&!y.value,onClick:jt}," 清空日志 ",8,Ro),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Vt}," 关闭 ")])]),s("div",Vo,[y.value?(r(),l("div",jo,n(y.value),1)):m("",!0),c.value||f.value?(r(),l("div",Mo,[c.value?(r(),l("div",Do,[t[55]||(t[55]=s("div",{class:"font-medium text-foreground"},"注册任务",-1)),s("div",Oo,[s("span",null,"状态:"+n(_t(c.value.status)),1),s("span",null,"进度:"+n(c.value.progress)+"/"+n(c.value.count),1),s("span",null,"成功:"+n(c.value.success_count),1),s("span",null,"失败:"+n(c.value.fail_count),1)])])):m("",!0),f.value?(r(),l("div",Bo,[t[56]||(t[56]=s("div",{class:"font-medium text-foreground"},"刷新任务",-1)),s("div",No,[s("span",null,"状态:"+n(_t(f.value.status)),1),s("span",null,"进度:"+n(f.value.progress)+"/"+n(f.value.account_ids.length),1),s("span",null,"成功:"+n(f.value.success_count),1),s("span",null,"失败:"+n(f.value.fail_count),1)])])):m("",!0)])):m("",!0),q.value.length||Q.value.length?(r(),l("div",Uo,[s("div",{ref_key:"taskLogsRef",ref:Xe,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[q.value.length?(r(),l("div",zo,[t[57]||(t[57]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",Po,[(r(!0),l(ge,null,Ve(q.value,(o,i)=>(r(),l("div",{key:`reg-${i}`,class:"font-mono"},n(vt(o)),1))),128))])])):m("",!0),Q.value.length?(r(),l("div",Fo,[t[58]||(t[58]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",Ko,[(r(!0),l(ge,null,Ve(Q.value,(o,i)=>(r(),l("div",{key:`login-${i}`,class:"font-mono"},n(vt(o)),1))),128))])])):m("",!0)],512)])):m("",!0),!y.value&&!c.value&&!f.value&&!q.value.length&&!Q.value.length?(r(),l("div",Ho," 暂无任务 ")):m("",!0)])])])):m("",!0)])),(r(),Re(je,{to:"body"},[ne.value?(r(),l("div",Jo,[s("div",Go,[s("div",{class:"flex items-center justify-between"},[t[59]||(t[59]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Pe}," 关闭 ")]),u.value?(r(),l("div",Yo,n(u.value),1)):m("",!0),s("div",qo,[t[60]||(t[60]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),A(s("input",{"onUpdate:modelValue":t[20]||(t[20]=o=>_.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[$,_.value.id]]),t[61]||(t[61]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),A(s("textarea",{"onUpdate:modelValue":t[21]||(t[21]=o=>_.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[$,_.value.secure_c_ses]]),t[62]||(t[62]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),A(s("input",{"onUpdate:modelValue":t[22]||(t[22]=o=>_.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.csesidx]]),t[63]||(t[63]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),A(s("input",{"onUpdate:modelValue":t[23]||(t[23]=o=>_.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.config_id]]),t[64]||(t[64]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),A(s("input",{"onUpdate:modelValue":t[24]||(t[24]=o=>_.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.host_c_oses]]),t[65]||(t[65]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),A(s("input",{"onUpdate:modelValue":t[25]||(t[25]=o=>_.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[$,_.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Jt}," 保存 ")])])])):m("",!0)])),(r(),Re(je,{to:"body"},[j.value?(r(),l("div",Qo,[s("div",Xo,[s("div",Wo,[t[66]||(t[66]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",Zo,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Kt},n(B.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:ze}," 关闭 ")])]),M.value?(r(),l("div",er,n(M.value),1)):m("",!0),s("div",tr,[A(s("textarea",{"onUpdate:modelValue":t[26]||(t[26]=o=>ee.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:B.value},null,8,sr),[[$,ee.value]])]),s("div",or,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:ze}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Ht,disabled:B.value}," 保存 ",8,rr)])])])):m("",!0)]))],64))}});export{cr as default};
static/assets/Accounts-rG9Hbj71.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ import{g as E,C as os,h as i,d as rs,D as ls,i as J,o as ns,z as as,j as is,c as n,a as s,p as G,m as Re,q as R,v as V,s as $t,t as a,n as p,u as j,b as g,f as ee,F as ge,r as Ve,T as je,E as ds,w as M,e as l,G as us}from"./index-CQv2QMzB.js";import{_ as cs}from"./SelectMenu.vue_vue_type_script_setup_true_lang-BVovBIaU.js";import{_ as be}from"./Checkbox.vue_vue_type_script_setup_true_lang-D9NLz7h-.js";import{_ as fs}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-BRmG52AD.js";import{u as vs}from"./useConfirmDialog-BeyA60E7.js";import{_ as ms}from"./HelpTip.vue_vue_type_script_setup_true_lang-Dt22lg9h.js";const w={list:()=>E.get("/admin/accounts"),getConfig:()=>E.get("/admin/accounts-config"),updateConfig:y=>E.put("/admin/accounts-config",y),delete:y=>E.delete(`/admin/accounts/${y}`),disable:y=>E.put(`/admin/accounts/${y}/disable`),enable:y=>E.put(`/admin/accounts/${y}/enable`),startRegister:(y,k)=>E.post("/admin/register/start",{count:y,domain:k}),getRegisterTask:y=>E.get(`/admin/register/task/${y}`),getRegisterCurrent:()=>E.get("/admin/register/current"),startLogin:y=>E.post("/admin/login/start",y),getLoginTask:y=>E.get(`/admin/login/task/${y}`),getLoginCurrent:()=>E.get("/admin/login/current"),checkLogin:()=>E.post("/admin/login/check")},ps=os("accounts",()=>{const y=i([]),k=i(!1);async function A(){k.value=!0;try{const x=await w.list();y.value=Array.isArray(x)?x:x.accounts||[]}finally{k.value=!1}}async function ne(x){await w.delete(x),await A()}async function T(x){await w.disable(x),await A()}async function d(x){await w.enable(x),await A()}async function ae(x){await Promise.all(x.map($=>w.enable($))),await A()}async function te(x){await Promise.all(x.map($=>w.disable($))),await A()}async function b(x){await Promise.all(x.map($=>w.delete($))),await A()}async function Y(x){await w.updateConfig(x),await A()}return{accounts:y,isLoading:k,loadAccounts:A,deleteAccount:ne,disableAccount:T,enableAccount:d,bulkEnable:ae,bulkDisable:te,bulkDelete:b,updateConfig:Y}}),xs={class:"space-y-8"},gs={class:"rounded-3xl border border-border bg-card p-6"},bs={class:"flex flex-wrap items-center justify-between gap-4"},ys={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},_s={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},hs={class:"ml-auto flex items-center gap-2 sm:ml-0"},ws={class:"mt-4 flex flex-wrap items-center gap-2"},ks=["disabled"],Cs=["disabled"],Ts={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},Ss=["disabled"],$s=["disabled"],Is=["disabled"],Es=["disabled"],Ls=["disabled"],As={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},Rs=["onClick"],Vs={class:"flex items-start justify-between gap-3"},js={class:"mt-1 font-mono text-xs text-foreground"},Ms={class:"flex items-center gap-2"},Ds={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},Os={key:0,class:"mt-1 text-[11px]"},Bs={key:0},Ns={key:1},Us={class:"mt-1 text-sm font-semibold text-foreground"},zs={class:"mt-1 text-sm font-semibold text-foreground"},Ps={class:"mt-4 flex flex-wrap items-center gap-2"},Fs=["onClick"],Ks=["onClick"],Hs=["onClick"],Js=["onClick"],Gs={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Ys={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},qs={class:"min-w-full text-left text-sm"},Qs={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Xs={class:"py-3 pr-4"},Ws={class:"py-3 pr-6"},Zs={class:"inline-flex items-center gap-2"},eo={class:"text-sm text-foreground"},to={key:0},so=["onClick"],oo={class:"py-4 pr-6 font-mono text-xs text-foreground"},ro={class:"py-4 pr-6"},lo={class:"py-4 pr-6"},no={key:0,class:"block text-[11px] text-muted-foreground"},ao={class:"py-4 pr-6 text-xs"},io={class:"py-4 pr-6 text-xs text-muted-foreground"},uo={class:"py-4 pr-6 text-xs text-muted-foreground"},co={class:"py-4 text-right"},fo={class:"flex flex-wrap justify-end gap-2"},vo=["onClick"],mo=["onClick"],po=["onClick"],xo=["onClick"],go={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},bo={class:"flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},yo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},_o={class:"mt-1 text-xs text-muted-foreground"},ho={class:"scrollbar-slim flex-1 overflow-y-auto px-6 py-4"},wo={class:"space-y-4 text-sm"},ko={class:"flex rounded-full border border-border bg-muted/30 p-1 text-xs"},Co={key:0,class:"space-y-4"},To={key:1,class:"space-y-4"},So={key:0,class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-600"},$o={class:"border-t border-border/60 px-6 py-4"},Io={class:"flex items-center justify-end gap-2"},Eo=["disabled"],Lo=["disabled"],Ao={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Ro={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},Vo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},jo={class:"flex items-center gap-2"},Mo=["disabled"],Do={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},Oo={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},Bo={key:1,class:"grid gap-3 text-xs text-muted-foreground"},No={key:0,class:"space-y-1"},Uo={class:"flex items-center gap-2 font-medium text-foreground"},zo={class:"flex flex-wrap gap-x-4 gap-y-1"},Po={key:1,class:"space-y-1"},Fo={class:"flex items-center gap-2 font-medium text-foreground"},Ko={class:"flex flex-wrap gap-x-4 gap-y-1"},Ho={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},Jo={key:0,class:"space-y-2"},Go={class:"space-y-1 text-[11px] text-muted-foreground"},Yo={key:1,class:"mt-4 space-y-2"},qo={class:"space-y-1 text-[11px] text-muted-foreground"},Qo={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},Xo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Wo={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Zo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},er={class:"mt-4 space-y-3 text-sm"},tr={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},sr={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},or={class:"flex items-center justify-between"},rr={class:"flex items-center gap-2"},lr={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},nr={class:"mt-4"},ar=["readonly"],ir={class:"mt-6 flex items-center justify-end gap-2"},dr=["disabled"],Je="accounts-register-task-cache",Ge="accounts-login-task-cache",Ye="accounts-register-log-clear",qe="accounts-login-log-clear",Qe="accounts-register-task-cleared-id",Xe="accounts-login-task-cleared-id",It="1970-01-01 00:00:00",xr=rs({__name:"Accounts",setup(y){const k=ps(),{accounts:A,isLoading:ne}=ls(k),T=vs(),d=ds(),ae=i(""),te=i("all"),b=i(new Set),Y=i("table"),x=i(!1),$=i(""),Me=i(!1),D=i(""),se=i(""),N=i(!1),ie=i([]),de=i(1),ye=i(!1),U=i("register"),ue=i(""),z=i(""),_e=i(!1),q=i(!1),P=i(!1),De=i(null),he=i(null),we=i(null),F=i(null),K=i(null),oe=i(0),re=i(0),ce=i(!1),c=i(null),f=i(null),We=i(null),O=i(!1),S=i(!1),_=i(""),h=i({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),ke=i(null),Ze=i([]),Et=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],H=J(()=>{const t=ae.value.trim().toLowerCase();return A.value.filter(e=>{const o=!t||e.id.toLowerCase().includes(t),r=te.value==="all"||ve(e)===te.value;return o&&r})}),B=J(()=>b.value.size),Oe=J(()=>H.value.length>0&&H.value.every(t=>b.value.has(t.id))),fe=async()=>{await k.loadAccounts(),b.value=new Set,P.value=!1},et=t=>{try{const e=localStorage.getItem(t);return e?JSON.parse(e):null}catch{return null}},tt=t=>{try{return localStorage.getItem(t)||null}catch{return null}},Ce=(t,e)=>{try{if(e){localStorage.setItem(t,e);return}localStorage.removeItem(t)}catch{}},st=(t,e)=>{try{localStorage.setItem(t,JSON.stringify(e))}catch{}},ot=t=>{try{localStorage.removeItem(t)}catch{}},rt=t=>{const e=localStorage.getItem(t),o=Number(e);return Number.isFinite(o)?o:0},Te=(t,e)=>{try{localStorage.setItem(t,String(e))}catch{}},Be=(t,e=!0)=>{t&&(t.id&&t.id===F.value||(t.id&&F.value&&t.id!==F.value&&(F.value=null,Ce(Qe,null)),c.value=t,t.id&&t.id!==he.value&&(he.value=t.id,oe.value=0,Te(Ye,0)),e&&st(Je,t)))},Se=(t,e=!0)=>{t&&(t.id&&t.id===K.value||(t.id&&K.value&&t.id!==K.value&&(K.value=null,Ce(Xe,null)),f.value=t,t.id&&t.id!==we.value&&(we.value=t.id,re.value=0,Te(qe,0)),e&&st(Ge,t)))},Lt=()=>{oe.value=rt(Ye),re.value=rt(qe),F.value=tt(Qe),K.value=tt(Xe);const t=et(Je);t&&t.id!==F.value&&(c.value=t,he.value=t.id||null);const e=et(Ge);e&&e.id!==K.value&&(f.value=e,we.value=e.id||null)},At=()=>{ye.value=!0,U.value="register",ue.value="",z.value="",_e.value=!1,ce.value=!1},Ne=()=>{ye.value=!1},Rt=t=>{const e=[],o=[];return t.split(/\r?\n/).map(u=>u.trim()).filter(Boolean).forEach((u,m)=>{const v=u.split("----").map(I=>I.trim()),C=m+1;if(v.length){if(v[0].toLowerCase()==="duckmail"){if(v.length<3||!v[1]||!v[2]){o.push(`第 ${C} 行格式错误(duckmail)`);return}const I=v[1],Ae=v.slice(2).join("----");e.push({id:I,secure_c_ses:"",csesidx:"",config_id:"",expires_at:It,mail_provider:"duckmail",mail_address:I,mail_password:Ae});return}if(v.length>=4&&v[0]&&v[2]&&v[3]){const I=v[0],Ae=v[1]||"",L=v[2],ss=v.slice(3).join("----");e.push({id:I,secure_c_ses:"",csesidx:"",config_id:"",expires_at:It,mail_provider:"microsoft",mail_address:I,mail_password:Ae,mail_client_id:L,mail_refresh_token:ss,mail_tenant:"consumers"});return}o.push(`第 ${C} 行格式错误`)}}),{items:e,errors:o}},Vt=async()=>{if(z.value="",!ue.value.trim()){z.value="请输入导��内容";return}const{items:t,errors:e}=Rt(ue.value);if(!t.length){z.value=e.length?e.join(","):"未识别到有效账号";return}if(e.length){z.value=e.slice(0,3).join(",");return}_e.value=!0;try{const r=[...await vt()],u=new Map(r.map((C,I)=>[C.id,I])),m=[];t.forEach(C=>{const I=u.get(C.id||"");if(I===void 0){r.push(C),m.push(C.id);return}const L={...r[I],mail_provider:C.mail_provider,mail_address:C.mail_address};C.mail_provider==="microsoft"?(L.mail_client_id=C.mail_client_id,L.mail_refresh_token=C.mail_refresh_token,L.mail_tenant=C.mail_tenant,L.mail_password=C.mail_password):(L.mail_password=C.mail_password,L.mail_client_id=void 0,L.mail_refresh_token=void 0,L.mail_tenant=void 0),r[I]=L,m.push(C.id)}),await k.updateConfig(r),await fe(),b.value=new Set(m),d.success(`成功导入 ${m.length} 个账户`),Ne(),await T.ask({title:"导入成功",message:`已导入 ${m.length} 个账户并自动选中。是否立即刷新这些账户以获取 Cookie?`,confirmText:"立即刷新",cancelText:"稍后手动刷新"})&&await St()}catch(o){z.value=o.message||"导入失败",d.error(o.message||"导入失败")}finally{_e.value=!1}},jt=async()=>{try{const t=[],e=c.value?.id,o=f.value?.id;if(e&&!$e(e)&&t.push(kt(e)),o&&!Ie(o)&&t.push(Ct(o)),!t.length){await He();return}await Promise.all(t)}catch(t){_.value=t?.message||"任务状态更新失败"}},Ue=async()=>{q.value=!0,await jt()},Mt=()=>{q.value=!1},Dt=()=>{const t=c.value?.id||null,e=f.value?.id||null;F.value=t,K.value=e,Ce(Qe,t),Ce(Xe,e),oe.value=c.value?.logs?.length||0,re.value=f.value?.logs?.length||0,Te(Ye,oe.value),Te(qe,re.value),c.value=null,f.value=null,he.value=null,we.value=null,_.value="",O.value=!1,S.value=!1,W(),Z(),ot(Je),ot(Ge)},$e=t=>!!(t&&t===F.value),Ie=t=>!!(t&&t===K.value),Ot=()=>{P.value=!P.value},le=()=>{P.value=!1},lt=t=>{if(!P.value)return;const e=t.target;De.value&&!De.value.contains(e)&&(P.value=!1)};ns(async()=>{Lt(),await fe(),await He(),Zt(),document.addEventListener("click",lt)});const Q=J(()=>{const t=c.value?.logs||[];return oe.value?t.slice(oe.value):t}),X=J(()=>{const t=f.value?.logs||[];return re.value?t.slice(re.value):t}),Bt=J(()=>!!_.value||!!c.value||!!f.value||Q.value.length>0||X.value.length>0),Nt=async()=>{await us();const t=We.value;t&&(t.scrollTop=t.scrollHeight)};as([Q,X,q],async()=>{q.value&&await Nt()},{deep:!0});const Ut=J(()=>{const t=c.value?.status,e=f.value?.status;return t==="running"||t==="pending"||e==="running"||e==="pending"}),zt=J(()=>{if(_.value)return"bg-rose-500";if(Ut.value)return"bg-sky-400";const t=[];if(c.value){const u=c.value.success_count??0,m=c.value.fail_count??0,v=c.value.count??u+m;t.push({success:u,fail:m,total:v,status:c.value.status})}if(f.value){const u=f.value.success_count??0,m=f.value.fail_count??0,v=f.value.account_ids?.length??u+m;t.push({success:u,fail:m,total:v,status:f.value.status})}if(!t.length)return"bg-muted-foreground";const e=t.reduce((u,m)=>u+m.success,0),o=t.reduce((u,m)=>u+m.fail,0),r=t.reduce((u,m)=>u+(m.total||0),0);if(e>0&&o>0)return"bg-amber-400";if(o>0&&e===0)return"bg-rose-500";if(e>0&&o===0)return"bg-emerald-400";if(r===0){const u=t.every(v=>v.status==="success");if(t.some(v=>v.status==="failed"))return"bg-rose-500";if(u)return"bg-emerald-400"}return"bg-muted-foreground"});is(()=>{W(),Z(),Wt(),document.removeEventListener("click",lt)});const ve=t=>t.cooldown_reason?.includes("429")&&t.cooldown_seconds>0?"429限流":t.cooldown_reason==="错误禁用"?"错误禁用":t.disabled?"手动禁用":t.status==="已过期"?"已过期":t.status==="即将过期"?"即将过期":"正常",nt=t=>{const e=ve(t);return e==="429限流"||e==="即将过期"?"bg-amber-200 text-amber-900":e==="错误禁用"||e==="已过期"?"bg-destructive/10 text-destructive":e==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},at=t=>t.cooldown_reason?.includes("429")&&t.cooldown_seconds>0?!0:t.disabled||t.cooldown_reason==="错误禁用",it=t=>t==="已过期"?"过期":t==="未设置"?"未设置":t,dt=t=>t.status==="已过期"?"text-rose-600":t.status==="即将过期"?"text-amber-700":t.status==="未设置"?"text-muted-foreground":"text-emerald-600",ut=t=>t<60?`${t} 秒`:t<3600?`${Math.ceil(t/60)} 分钟`:`${(t/3600).toFixed(1)} 小时`,ze=t=>t.cooldown_seconds>0?"text-amber-700":t.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",ct=t=>{const e=ve(t);return e==="手动禁用"||e==="已过期"?"bg-muted/70":""},Ee=t=>{const e=new Set(b.value);e.has(t)?e.delete(t):e.add(t),b.value=e},ft=()=>{if(Oe.value){b.value=new Set;return}b.value=new Set(H.value.map(t=>t.id))},Pt=(t,e)=>t.id||`account_${e+1}`,vt=async()=>(await w.getConfig()).accounts.map((e,o)=>({...e,id:Pt(e,o)})),mt=t=>`${t.time} [${t.level}] ${t.message}`,Ft=(t,e)=>{let o=-1;for(let u=0;u<t.length;u+=1)if(t[u].id===e){o=u;break}if(o===-1)return $.value="未找到对应账号配置。",!1;const r=t[o];return h.value={id:r.id,secure_c_ses:r.secure_c_ses,csesidx:r.csesidx,config_id:r.config_id,host_c_oses:r.host_c_oses,expires_at:r.expires_at},Ze.value=t,ke.value=o,x.value=!0,!0},pt=async t=>{$.value="";try{const e=await vt();Ft(e,t)}catch(e){$.value=e.message||"加载账号配置失败"}},Kt=async()=>{D.value="";try{const t=await w.getConfig();ie.value=Array.isArray(t.accounts)?t.accounts:[],se.value=JSON.stringify(gt(ie.value),null,2),N.value=!0,Me.value=!0}catch(t){D.value=t.message||"加载账号配置失败"}},Pe=()=>{Me.value=!1,D.value="",N.value=!1},xt=()=>{const t=JSON.parse(se.value);if(!Array.isArray(t))throw new Error("配置格式必须是数组。");return t},Ht=t=>typeof t!="string"||!t?t:t.length<=6?`${t.slice(0,2)}****`:`${t.slice(0,3)}****`,gt=t=>{const e=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password","mail_refresh_token","mail_client_id"]);return t.map(o=>{const r={...o};return e.forEach(u=>{const m=r[u];m&&(r[u]=Ht(m))}),r})},Jt=()=>{if(D.value="",!N.value){try{ie.value=xt()}catch(t){D.value=t.message||"JSON 格式错误";return}se.value=JSON.stringify(gt(ie.value),null,2),N.value=!0;return}se.value=JSON.stringify(ie.value,null,2),N.value=!1},Gt=async()=>{D.value="";try{const t=xt();await k.updateConfig(t),d.success("配置保存成功"),Pe()}catch(t){D.value=t.message||"保存失败",d.error(t.message||"保存失败")}},Fe=()=>{x.value=!1,$.value=""},Yt=async()=>{if(ke.value===null)return;const t=[...Ze.value];t[ke.value]={...t[ke.value],id:h.value.id,secure_c_ses:h.value.secure_c_ses,csesidx:h.value.csesidx,config_id:h.value.config_id,host_c_oses:h.value.host_c_oses||void 0,expires_at:h.value.expires_at||void 0};try{await k.updateConfig(t),d.success("账号编辑成功"),Fe()}catch(e){$.value=e.message||"保存失败",d.error(e.message||"保存失败")}},qt=async()=>{try{await k.bulkEnable(Array.from(b.value)),d.success("批量启用成功"),b.value=new Set}catch(t){d.error(t.message||"批量启用失败")}},Qt=async()=>{if(await T.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"}))try{await k.bulkDisable(Array.from(b.value)),d.success("批量禁用成功"),b.value=new Set}catch(e){d.error(e.message||"批量禁用失败")}},Xt=async()=>{if(await T.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"}))try{await k.bulkDelete(Array.from(b.value)),d.success("批量删除成功"),b.value=new Set}catch(e){d.error(e.message||"批量删除失败")}},bt=async t=>{try{await k.enableAccount(t),d.success("账号已启用")}catch(e){d.error(e.message||"启用失败")}},yt=async t=>{if(await T.ask({title:"禁用账号",message:"确定要禁用该账号吗?"}))try{await k.disableAccount(t),d.success("账号已禁用")}catch(o){d.error(o.message||"禁用失败")}},_t=async t=>{if(await T.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"}))try{await k.deleteAccount(t),d.success("账号已删除")}catch(o){d.error(o.message||"删除失败")}};let me=null,pe=null,xe=null,Le=!1;const W=()=>{me!==null&&(window.clearInterval(me),me=null)},Z=()=>{pe!==null&&(window.clearInterval(pe),pe=null)},Wt=()=>{xe!==null&&(window.clearInterval(xe),xe=null),Le=!1},ht=t=>t==="pending"?"等待中":t==="running"?"执行中":t==="success"?"成功":t==="failed"?"失败":t,wt=t=>{const e=t.status,o=t.success_count??0,r=t.fail_count??0;if(e==="running"||e==="pending")return"bg-sky-400";if(e==="success"||e==="failed"){if(o>0&&r===0)return"bg-emerald-400";if(r>0&&o===0)return"bg-rose-500";if(o>0&&r>0)return"bg-amber-400"}return"bg-muted-foreground"},kt=async t=>{if($e(t)){W();return}const e=await w.getRegisterTask(t);if($e(e.id)){W();return}if(Be(e),e.status!=="running"&&e.status!=="pending"){O.value=!1,W(),await fe();const o=e.success_count||0,r=e.fail_count||0;o>0&&r>0?d.success(`注册任务完成:成功 ${o},失败 ${r}`):o>0&&r===0?d.success(`注册任务完成:全部成功 (${o})`):r>0&&o===0?d.error(`注册任务完成:全部失败 (${r})`):d.error("注册任务失败")}},Ct=async t=>{if(Ie(t)){Z();return}const e=await w.getLoginTask(t);if(Ie(e.id)){Z();return}if(Se(e),e.status!=="running"&&e.status!=="pending"){S.value=!1,Z(),await fe();const o=e.success_count||0,r=e.fail_count||0;o>0&&r>0?d.success(`刷新任务完成:成功 ${o},失败 ${r}`):o>0&&r===0?d.success(`刷新任务完成:全部成功 (${o})`):r>0&&o===0?d.error(`刷新任务完成:全部失败 (${r})`):d.error("刷新任务失败")}},Tt=t=>{W(),me=window.setInterval(()=>{kt(t).catch(e=>{_.value=e?.message||"注册任务更新失败",W(),O.value=!1})},3e3)},Ke=t=>{Z(),pe=window.setInterval(()=>{Ct(t).catch(e=>{_.value=e?.message||"刷新任务更新失败",Z(),S.value=!1})},3e3)},Zt=()=>{xe===null&&(xe=window.setInterval(async()=>{if(!Le&&!q.value&&!(me!==null||pe!==null)&&!(!O.value&&!S.value&&!c.value&&!f.value)){Le=!0;try{await He()}catch(t){_.value=t?.message||"后台刷新失败"}finally{Le=!1}}},6e3))},He=async()=>{try{const t=await w.getRegisterCurrent();t&&"id"in t&&!$e(t.id)&&(Be(t),(t.status==="running"||t.status==="pending")&&(O.value=!0,Tt(t.id)))}catch(t){_.value=t.message||"加载注册任务失败"}try{const t=await w.getLoginCurrent();t&&"id"in t&&!Ie(t.id)&&(Se(t),(t.status==="running"||t.status==="pending")&&(S.value=!0,Ke(t.id)))}catch(t){_.value=t.message||"加载刷新任务失败"}},es=async()=>{_.value="",O.value=!0;try{const t=Number.isFinite(de.value)&&de.value>0?de.value:void 0,e=await w.startRegister(t);Be(e),Tt(e.id),ye.value=!1,q.value=!0}catch(t){_.value=t.message||"启动注册失败",O.value=!1}},St=async()=>{if(b.value.size){_.value="",S.value=!0;try{const t=await w.startLogin(Array.from(b.value));Se(t),Ke(t.id),Ue()}catch(t){_.value=t.message||"启动刷新失败",S.value=!1}}},ts=async()=>{_.value="",S.value=!0;try{await w.checkLogin();const t=await w.getLoginCurrent();if(t&&"id"in t){Se(t),Ke(t.id),Ue();return}S.value=!1}catch(t){_.value=t.message||"触发刷新失败",S.value=!1}};return(t,e)=>(l(),n(ge,null,[s("div",xs,[s("section",gs,[s("div",bs,[s("div",ys,[R(s("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>ae.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[V,ae.value]]),G(cs,{modelValue:te.value,"onUpdate:modelValue":e[1]||(e[1]=o=>te.value=o),options:Et},null,8,["modelValue"])]),s("div",_s,[G(be,{modelValue:Oe.value,"onUpdate:modelValue":ft},{default:$t(()=>[...e[27]||(e[27]=[ee(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+a(B.value)+" / "+a(H.value.length)+" 个账号",1),s("div",hs,[s("button",{type:"button",class:p(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",Y.value==="table"?"bg-accent text-accent-foreground":""]),onClick:e[2]||(e[2]=o=>Y.value="table"),"aria-label":"列表视图"},[...e[28]||(e[28]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:p(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",Y.value==="card"?"bg-accent text-accent-foreground":""]),onClick:e[3]||(e[3]=o=>Y.value="card"),"aria-label":"卡片视图"},[...e[29]||(e[29]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",ws,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:j(ne),onClick:fe}," 刷新列表 ",8,ks),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:Kt}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:O.value,onClick:At}," 添加账户 ",8,Cs),s("div",{ref_key:"moreActionsRef",ref:De,class:"relative"},[s("button",{class:p(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",P.value?"bg-accent text-accent-foreground":""]),onClick:Ot},[e[30]||(e[30]=ee(" 更多操作 ",-1)),e[31]||(e[31]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),Bt.value?(l(),n("span",{key:0,class:p(["ml-1 h-2 w-2 rounded-full",zt.value]),"aria-hidden":"true"},null,2)):g("",!0)],2),P.value?(l(),n("div",Ts,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:e[4]||(e[4]=o=>{Ue(),le()})}," 任务状态 "),e[32]||(e[32]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",S.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:S.value,onClick:e[5]||(e[5]=o=>{ts(),le()})}," 刷新过期 ",10,Ss),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!B.value||S.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!B.value||S.value,onClick:e[6]||(e[6]=o=>{St(),le()})}," 刷新选中 ",10,$s),e[33]||(e[33]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[7]||(e[7]=o=>{qt(),le()})}," 批量启用 ",10,Is),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[8]||(e[8]=o=>{Qt(),le()})}," 批量禁用 ",10,Es),s("button",{type:"button",class:p(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",B.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!B.value,onClick:e[9]||(e[9]=o=>{Xt(),le()})}," 批量删除 ",10,Ls)])):g("",!0)],512)]),Y.value==="card"?(l(),n("div",As,[(l(!0),n(ge,null,Ve(H.value,o=>(l(),n("div",{key:o.id,class:p(["rounded-2xl border border-border bg-card p-4",ct(o)]),onClick:r=>Ee(o.id)},[s("div",Vs,[s("div",null,[e[34]||(e[34]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",js,a(o.id),1)]),s("div",Ms,[G(be,{modelValue:b.value.has(o.id),"onUpdate:modelValue":r=>Ee(o.id),onClick:e[10]||(e[10]=M(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:p(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",nt(o)])},a(ve(o)),3)])]),s("div",Ds,[s("div",null,[e[35]||(e[35]=s("p",null,"剩余时间",-1)),s("p",{class:p(["mt-1 text-sm font-semibold",dt(o)])},a(it(o.remaining_display)),3),o.expires_at?(l(),n("p",Os,a(o.expires_at),1)):g("",!0)]),s("div",null,[e[36]||(e[36]=s("p",null,"冷却",-1)),s("p",{class:p(["mt-1",ze(o)])},[o.cooldown_seconds>0?(l(),n("span",Bs,a(ut(o.cooldown_seconds))+" · "+a(o.cooldown_reason),1)):(l(),n("span",Ns,a(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[e[37]||(e[37]=s("p",null,"失败数",-1)),s("p",Us,a(o.error_count),1)]),s("div",null,[e[38]||(e[38]=s("p",null,"会话数",-1)),s("p",zs,a(o.conversation_count),1)])]),s("div",Ps,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>pt(o.id),["stop"])}," 编辑 ",8,Fs),at(o)?(l(),n("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[11]||(e[11]=M(()=>{},["stop"])),r=>bt(o.id)]}," 启用 ",8,Ks)):(l(),n("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[12]||(e[12]=M(()=>{},["stop"])),r=>yt(o.id)]}," 禁用 ",8,Hs)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[e[13]||(e[13]=M(()=>{},["stop"])),r=>_t(o.id)]}," 删除 ",8,Js)])],10,Rs))),128)),!H.value.length&&!j(ne)?(l(),n("div",Gs," 暂无账号数据,请检查后台配置。 ")):g("",!0)])):(l(),n("div",Ys,[s("table",qs,[s("thead",Qs,[s("tr",null,[s("th",Xs,[G(be,{modelValue:Oe.value,"onUpdate:modelValue":ft},null,8,["modelValue"])]),e[40]||(e[40]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),e[41]||(e[41]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",Ws,[s("span",Zs,[e[39]||(e[39]=ee(" 剩余/过期 ",-1)),G(ms,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),e[42]||(e[42]=s("th",{class:"py-3 pr-6"},"冷却",-1)),e[43]||(e[43]=s("th",{class:"py-3 pr-6"},"失败数",-1)),e[44]||(e[44]=s("th",{class:"py-3 pr-6"},"会话数",-1)),e[45]||(e[45]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",eo,[!H.value.length&&!j(ne)?(l(),n("tr",to,[...e[46]||(e[46]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):g("",!0),(l(!0),n(ge,null,Ve(H.value,o=>(l(),n("tr",{key:o.id,class:p(["border-t border-border",ct(o)]),onClick:r=>Ee(o.id)},[s("td",{class:"py-4 pr-4",onClick:e[14]||(e[14]=M(()=>{},["stop"]))},[G(be,{modelValue:b.value.has(o.id),"onUpdate:modelValue":r=>Ee(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",oo,a(o.id),1),s("td",ro,[s("span",{class:p(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",nt(o)])},a(ve(o)),3)]),s("td",lo,[s("div",{class:p(["text-sm font-semibold",dt(o)])},a(it(o.remaining_display)),3),o.expires_at?(l(),n("span",no,a(o.expires_at),1)):g("",!0)]),s("td",ao,[o.cooldown_seconds>0?(l(),n("span",{key:0,class:p(ze(o))},a(ut(o.cooldown_seconds))+" · "+a(o.cooldown_reason),3)):(l(),n("span",{key:1,class:p(ze(o))},a(o.cooldown_reason||"无冷却"),3))]),s("td",io,a(o.error_count),1),s("td",uo,a(o.conversation_count),1),s("td",co,[s("div",fo,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>pt(o.id),["stop"])}," 编辑 ",8,vo),at(o)?(l(),n("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>bt(o.id),["stop"])}," 启用 ",8,mo)):(l(),n("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:M(r=>yt(o.id),["stop"])}," 禁用 ",8,po)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:M(r=>_t(o.id),["stop"])}," 删除 ",8,xo)])])],10,so))),128))])])]))])]),G(fs,{open:j(T).open.value,title:j(T).title.value,message:j(T).message.value,"confirm-text":j(T).confirmText.value,"cancel-text":j(T).cancelText.value,onConfirm:j(T).confirm,onCancel:j(T).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(l(),Re(je,{to:"body"},[ye.value?(l(),n("div",go,[s("div",bo,[s("div",yo,[s("div",null,[e[47]||(e[47]=s("p",{class:"text-sm font-medium text-foreground"},"添加账户",-1)),s("p",_o,a(U.value==="register"?"创建 DuckMail 账号并自动注册":"批量导入账户配置"),1)]),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Ne}," 关闭 ")]),s("div",ho,[s("div",wo,[s("div",ko,[s("button",{type:"button",class:p(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",U.value==="register"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:e[15]||(e[15]=o=>U.value="register")}," 自动注册 ",2),s("button",{type:"button",class:p(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",U.value==="import"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:e[16]||(e[16]=o=>U.value="import")}," 批量导入 ",2)]),U.value==="register"?(l(),n("div",Co,[e[48]||(e[48]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),R(s("input",{"onUpdate:modelValue":e[17]||(e[17]=o=>de.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,de.value,void 0,{number:!0}]]),e[49]||(e[49]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"默认域名(可在配置面板修改,推荐使用)"),s("p",{class:"mt-1"},"注册失败建议关闭无头浏览器再试")],-1))])):(l(),n("div",To,[e[50]||(e[50]=s("label",{class:"block text-xs text-muted-foreground"},"批量导入(每行一个)",-1)),R(s("textarea",{"onUpdate:modelValue":e[18]||(e[18]=o=>ue.value=o),class:"min-h-[140px] w-full rounded-2xl border border-input bg-background px-3 py-2 text-xs font-mono",placeholder:`duckmail----you@example.com----password
2
+ user@outlook.com----loginPassword----clientId----refreshToken`},null,512),[[V,ue.value]]),e[51]||(e[51]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"支持两种格式:"),s("p",{class:"mt-1 font-mono"},"duckmail----email----password"),s("p",{class:"mt-1 font-mono"},"email----password----clientId----refreshToken"),s("p",{class:"mt-2"},'导入后请执行一次"刷新选中"以获取 Cookie。'),s("p",{class:"mt-1"},"注册失败建议关闭无头浏览器再试")],-1)),z.value?(l(),n("div",So,a(z.value),1)):g("",!0)])),e[53]||(e[53]=s("div",{class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-[11px] leading-relaxed"},[s("p",{class:"text-xs font-bold text-rose-600"},"⚠️ 严禁滥用:禁止将本工具用于商业用途或任何形式的滥用(无论规模大小)"),s("p",{class:"mt-1 text-muted-foreground"},[ee("详细声明请查看项目 "),s("a",{href:"https://github.com/Dreamy-rain/gemini-business2api/blob/main/docs/DISCLAIMER.md",target:"_blank",class:"text-primary hover:underline font-medium"},"DISCLAIMER.md")])],-1)),G(be,{modelValue:ce.value,"onUpdate:modelValue":e[19]||(e[19]=o=>ce.value=o)},{default:$t(()=>[...e[52]||(e[52]=[ee(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])])]),s("div",$o,[s("div",Io,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ne}," 取消 "),U.value==="register"?(l(),n("button",{key:0,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",disabled:O.value||!ce.value,onClick:es}," 开始注册 ",8,Eo)):(l(),n("button",{key:1,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",disabled:_e.value||!ce.value,onClick:Vt}," 导入并保存 ",8,Lo))])])])])):g("",!0)])),(l(),Re(je,{to:"body"},[q.value?(l(),n("div",Ao,[s("div",Ro,[s("div",Vo,[e[54]||(e[54]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",jo,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",disabled:!Q.value.length&&!X.value.length&&!c.value&&!f.value&&!_.value,onClick:Dt}," 清空日志 ",8,Mo),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Mt}," 关闭 ")])]),s("div",Do,[_.value?(l(),n("div",Oo,a(_.value),1)):g("",!0),c.value||f.value?(l(),n("div",Bo,[c.value?(l(),n("div",No,[s("div",Uo,[s("span",{class:p(["h-2.5 w-2.5 rounded-full",wt(c.value)]),"aria-hidden":"true"},null,2),e[55]||(e[55]=ee(" 注册任务 ",-1))]),s("div",zo,[s("span",null,"状态:"+a(ht(c.value.status)),1),s("span",null,"进度:"+a(c.value.progress)+"/"+a(c.value.count),1),s("span",null,"成功:"+a(c.value.success_count),1),s("span",null,"失败:"+a(c.value.fail_count),1)])])):g("",!0),f.value?(l(),n("div",Po,[s("div",Fo,[s("span",{class:p(["h-2.5 w-2.5 rounded-full",wt(f.value)]),"aria-hidden":"true"},null,2),e[56]||(e[56]=ee(" 刷新任务 ",-1))]),s("div",Ko,[s("span",null,"状态:"+a(ht(f.value.status)),1),s("span",null,"进度:"+a(f.value.progress)+"/"+a(f.value.account_ids.length),1),s("span",null,"成功:"+a(f.value.success_count),1),s("span",null,"失败:"+a(f.value.fail_count),1)])])):g("",!0)])):g("",!0),Q.value.length||X.value.length?(l(),n("div",Ho,[s("div",{ref_key:"taskLogsRef",ref:We,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[Q.value.length?(l(),n("div",Jo,[e[57]||(e[57]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",Go,[(l(!0),n(ge,null,Ve(Q.value,(o,r)=>(l(),n("div",{key:`reg-${r}`,class:"font-mono"},a(mt(o)),1))),128))])])):g("",!0),X.value.length?(l(),n("div",Yo,[e[58]||(e[58]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",qo,[(l(!0),n(ge,null,Ve(X.value,(o,r)=>(l(),n("div",{key:`login-${r}`,class:"font-mono"},a(mt(o)),1))),128))])])):g("",!0)],512)])):g("",!0),!_.value&&!c.value&&!f.value&&!Q.value.length&&!X.value.length?(l(),n("div",Qo," 暂无任务 ")):g("",!0)])])])):g("",!0)])),(l(),Re(je,{to:"body"},[x.value?(l(),n("div",Xo,[s("div",Wo,[s("div",{class:"flex items-center justify-between"},[e[59]||(e[59]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Fe}," 关闭 ")]),$.value?(l(),n("div",Zo,a($.value),1)):g("",!0),s("div",er,[e[60]||(e[60]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),R(s("input",{"onUpdate:modelValue":e[20]||(e[20]=o=>h.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[V,h.value.id]]),e[61]||(e[61]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),R(s("textarea",{"onUpdate:modelValue":e[21]||(e[21]=o=>h.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[V,h.value.secure_c_ses]]),e[62]||(e[62]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),R(s("input",{"onUpdate:modelValue":e[22]||(e[22]=o=>h.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.csesidx]]),e[63]||(e[63]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),R(s("input",{"onUpdate:modelValue":e[23]||(e[23]=o=>h.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.config_id]]),e[64]||(e[64]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),R(s("input",{"onUpdate:modelValue":e[24]||(e[24]=o=>h.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,h.value.host_c_oses]]),e[65]||(e[65]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),R(s("input",{"onUpdate:modelValue":e[25]||(e[25]=o=>h.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[V,h.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Fe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Yt}," 保存 ")])])])):g("",!0)])),(l(),Re(je,{to:"body"},[Me.value?(l(),n("div",tr,[s("div",sr,[s("div",or,[e[66]||(e[66]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",rr,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Jt},a(N.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Pe}," 关闭 ")])]),D.value?(l(),n("div",lr,a(D.value),1)):g("",!0),s("div",nr,[R(s("textarea",{"onUpdate:modelValue":e[26]||(e[26]=o=>se.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:N.value},null,8,ar),[[V,se.value]])]),s("div",ir,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",onClick:Gt,disabled:N.value}," 保存 ",8,dr)])])])):g("",!0)]))],64))}});export{xr as default};
static/assets/Accounts-vV-lLEEq.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ import{g as E,D as ts,h as a,d as ss,E as os,i as H,o as rs,A as ls,j as ns,c as l,a as s,p as J,m as Re,q as A,v as $,s as Tt,t as n,n as g,u as R,b as m,f as pe,F as ge,r as Ve,x as je,w as V,e as r,G as as}from"./index-OP3F9IRB.js";import{_ as is}from"./SelectMenu.vue_vue_type_script_setup_true_lang-BN7xX40H.js";import{_ as be}from"./Checkbox.vue_vue_type_script_setup_true_lang-aBWvRhQv.js";import{_ as ds}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-CPmtaJk8.js";import{u as us}from"./useConfirmDialog-BNQ4DnH9.js";import{_ as cs}from"./HelpTip.vue_vue_type_script_setup_true_lang-CpmAUbfQ.js";const h={list:()=>E.get("/admin/accounts"),getConfig:()=>E.get("/admin/accounts-config"),updateConfig:b=>E.put("/admin/accounts-config",b),delete:b=>E.delete(`/admin/accounts/${b}`),disable:b=>E.put(`/admin/accounts/${b}/disable`),enable:b=>E.put(`/admin/accounts/${b}/enable`),startRegister:(b,w)=>E.post("/admin/register/start",{count:b,domain:w}),getRegisterTask:b=>E.get(`/admin/register/task/${b}`),getRegisterCurrent:()=>E.get("/admin/register/current"),startLogin:b=>E.post("/admin/login/start",b),getLoginTask:b=>E.get(`/admin/login/task/${b}`),getLoginCurrent:()=>E.get("/admin/login/current"),checkLogin:()=>E.post("/admin/login/check")},fs=ts("accounts",()=>{const b=a([]),w=a(!1);async function L(){w.value=!0;try{const u=await h.list();b.value=Array.isArray(u)?u:u.accounts||[]}finally{w.value=!1}}async function re(u){await h.delete(u),await L()}async function C(u){await h.disable(u),await L()}async function le(u){await h.enable(u),await L()}async function Z(u){await Promise.all(u.map(j=>h.enable(j))),await L()}async function p(u){await Promise.all(u.map(j=>h.disable(j))),await L()}async function G(u){await Promise.all(u.map(j=>h.delete(j))),await L()}async function ne(u){await h.updateConfig(u),await L()}return{accounts:b,isLoading:w,loadAccounts:L,deleteAccount:re,disableAccount:C,enableAccount:le,bulkEnable:Z,bulkDisable:p,bulkDelete:G,updateConfig:ne}}),vs={class:"space-y-8"},xs={class:"rounded-3xl border border-border bg-card p-6"},ms={class:"flex flex-wrap items-center justify-between gap-4"},ps={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},gs={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},bs={class:"ml-auto flex items-center gap-2 sm:ml-0"},ys={class:"mt-4 flex flex-wrap items-center gap-2"},_s=["disabled"],hs=["disabled"],ws={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},ks=["disabled"],Cs=["disabled"],Ts=["disabled"],Ss=["disabled"],Es=["disabled"],Is={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},Ls=["onClick"],As={class:"flex items-start justify-between gap-3"},$s={class:"mt-1 font-mono text-xs text-foreground"},Rs={class:"flex items-center gap-2"},Vs={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},js={key:0,class:"mt-1 text-[11px]"},Ms={key:0},Ds={key:1},Os={class:"mt-1 text-sm font-semibold text-foreground"},Bs={class:"mt-1 text-sm font-semibold text-foreground"},Ns={class:"mt-4 flex flex-wrap items-center gap-2"},Us=["onClick"],zs=["onClick"],Ps=["onClick"],Fs=["onClick"],Ks={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Hs={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},Js={class:"min-w-full text-left text-sm"},Gs={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Ys={class:"py-3 pr-4"},qs={class:"py-3 pr-6"},Qs={class:"inline-flex items-center gap-2"},Xs={class:"text-sm text-foreground"},Ws={key:0},Zs=["onClick"],eo={class:"py-4 pr-6 font-mono text-xs text-foreground"},to={class:"py-4 pr-6"},so={class:"py-4 pr-6"},oo={key:0,class:"block text-[11px] text-muted-foreground"},ro={class:"py-4 pr-6 text-xs"},lo={class:"py-4 pr-6 text-xs text-muted-foreground"},no={class:"py-4 pr-6 text-xs text-muted-foreground"},ao={class:"py-4 text-right"},io={class:"flex flex-wrap justify-end gap-2"},uo=["onClick"],co=["onClick"],fo=["onClick"],vo=["onClick"],xo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},mo={class:"flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},po={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},go={class:"mt-1 text-xs text-muted-foreground"},bo={class:"scrollbar-slim flex-1 overflow-y-auto px-6 py-4"},yo={class:"space-y-4 text-sm"},_o={class:"flex rounded-full border border-border bg-muted/30 p-1 text-xs"},ho={key:0,class:"space-y-4"},wo={key:1,class:"space-y-4"},ko={key:0,class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-600"},Co={class:"border-t border-border/60 px-6 py-4"},To={class:"flex items-center justify-end gap-2"},So=["disabled"],Eo=["disabled"],Io={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Lo={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},Ao={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},$o={class:"flex items-center gap-2"},Ro=["disabled"],Vo={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},jo={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},Mo={key:1,class:"grid gap-3 text-xs text-muted-foreground"},Do={key:0,class:"space-y-1"},Oo={class:"flex flex-wrap gap-x-4 gap-y-1"},Bo={key:1,class:"space-y-1"},No={class:"flex flex-wrap gap-x-4 gap-y-1"},Uo={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},zo={key:0,class:"space-y-2"},Po={class:"space-y-1 text-[11px] text-muted-foreground"},Fo={key:1,class:"mt-4 space-y-2"},Ko={class:"space-y-1 text-[11px] text-muted-foreground"},Ho={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},Jo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Go={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Yo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},qo={class:"mt-4 space-y-3 text-sm"},Qo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Xo={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},Wo={class:"flex items-center justify-between"},Zo={class:"flex items-center gap-2"},er={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},tr={class:"mt-4"},sr=["readonly"],or={class:"mt-6 flex items-center justify-end gap-2"},rr=["disabled"],He="accounts-register-task-cache",Je="accounts-login-task-cache",Ge="accounts-register-log-clear",Ye="accounts-login-log-clear",qe="accounts-register-task-cleared-id",Qe="accounts-login-task-cleared-id",St="1970-01-01 00:00:00",cr=ss({__name:"Accounts",setup(b){const w=fs(),{accounts:L,isLoading:re}=os(w),C=us(),le=a(""),Z=a("all"),p=a(new Set),G=a("table"),ne=a(!1),u=a(""),j=a(!1),M=a(""),ee=a(""),B=a(!1),ae=a([]),ie=a(1),ye=a(!1),N=a("register"),de=a(""),U=a(""),_e=a(!1),Y=a(!1),z=a(!1),Me=a(null),he=a(null),we=a(null),P=a(null),F=a(null),te=a(0),se=a(0),ue=a(!1),c=a(null),f=a(null),Xe=a(null),D=a(!1),T=a(!1),y=a(""),_=a({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),ke=a(null),We=a([]),Et=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],K=H(()=>{const e=le.value.trim().toLowerCase();return L.value.filter(t=>{const o=!e||t.id.toLowerCase().includes(e),i=Z.value==="all"||fe(t)===Z.value;return o&&i})}),O=H(()=>p.value.size),De=H(()=>K.value.length>0&&K.value.every(e=>p.value.has(e.id))),ce=async()=>{await w.loadAccounts(),p.value=new Set,z.value=!1},Ze=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},et=e=>{try{return localStorage.getItem(e)||null}catch{return null}},Ce=(e,t)=>{try{if(t){localStorage.setItem(e,t);return}localStorage.removeItem(e)}catch{}},tt=(e,t)=>{try{localStorage.setItem(e,JSON.stringify(t))}catch{}},st=e=>{try{localStorage.removeItem(e)}catch{}},ot=e=>{const t=localStorage.getItem(e),o=Number(t);return Number.isFinite(o)?o:0},Te=(e,t)=>{try{localStorage.setItem(e,String(t))}catch{}},Oe=(e,t=!0)=>{e&&(e.id&&e.id===P.value||(e.id&&P.value&&e.id!==P.value&&(P.value=null,Ce(qe,null)),c.value=e,e.id&&e.id!==he.value&&(he.value=e.id,te.value=0,Te(Ge,0)),t&&tt(He,e)))},Se=(e,t=!0)=>{e&&(e.id&&e.id===F.value||(e.id&&F.value&&e.id!==F.value&&(F.value=null,Ce(Qe,null)),f.value=e,e.id&&e.id!==we.value&&(we.value=e.id,se.value=0,Te(Ye,0)),t&&tt(Je,e)))},It=()=>{te.value=ot(Ge),se.value=ot(Ye),P.value=et(qe),F.value=et(Qe);const e=Ze(He);e&&e.id!==P.value&&(c.value=e,he.value=e.id||null);const t=Ze(Je);t&&t.id!==F.value&&(f.value=t,we.value=t.id||null)},Lt=()=>{ye.value=!0,N.value="register",de.value="",U.value="",_e.value=!1,ue.value=!1},Be=()=>{ye.value=!1},At=e=>{const t=[],o=[];return e.split(/\r?\n/).map(d=>d.trim()).filter(Boolean).forEach((d,x)=>{const v=d.split("----").map(S=>S.trim()),k=x+1;if(v.length){if(v[0].toLowerCase()==="duckmail"){if(v.length<3||!v[1]||!v[2]){o.push(`第 ${k} 行格式错误(duckmail)`);return}const S=v[1],$e=v.slice(2).join("----");t.push({id:S,secure_c_ses:"",csesidx:"",config_id:"",expires_at:St,mail_provider:"duckmail",mail_address:S,mail_password:$e});return}if(v.length>=4&&v[0]&&v[2]&&v[3]){const S=v[0],$e=v[1]||"",I=v[2],es=v.slice(3).join("----");t.push({id:S,secure_c_ses:"",csesidx:"",config_id:"",expires_at:St,mail_provider:"microsoft",mail_address:S,mail_password:$e,mail_client_id:I,mail_refresh_token:es,mail_tenant:"consumers"});return}o.push(`第 ${k} 行格式错误`)}}),{items:t,errors:o}},$t=async()=>{if(U.value="",!de.value.trim()){U.value="请输入导入内容";return}const{items:e,errors:t}=At(de.value);if(!e.length){U.value=t.length?t.join(","):"未识别到有效账号";return}if(t.length){U.value=t.slice(0,3).join(",");return}_e.value=!0;try{const i=[...await ft()],d=new Map(i.map((k,S)=>[k.id,S])),x=[];e.forEach(k=>{const S=d.get(k.id||"");if(S===void 0){i.push(k),x.push(k.id);return}const I={...i[S],mail_provider:k.mail_provider,mail_address:k.mail_address};k.mail_provider==="microsoft"?(I.mail_client_id=k.mail_client_id,I.mail_refresh_token=k.mail_refresh_token,I.mail_tenant=k.mail_tenant,I.mail_password=k.mail_password):(I.mail_password=k.mail_password,I.mail_client_id=void 0,I.mail_refresh_token=void 0,I.mail_tenant=void 0),i[S]=I,x.push(k.id)}),await w.updateConfig(i),await ce(),p.value=new Set(x),Be(),await C.ask({title:"导入成功",message:`已导入 ${x.length} 个账户并自动选中。是否立即刷新这些账户以获取 Cookie?`,confirmText:"立即刷新",cancelText:"稍后手动刷新"})&&await Ct()}catch(o){U.value=o.message||"导入失败"}finally{_e.value=!1}},Rt=async()=>{try{const e=[],t=c.value?.id,o=f.value?.id;if(t&&!Ee(t)&&e.push(ht(t)),o&&!Ie(o)&&e.push(wt(o)),!e.length){await Ke();return}await Promise.all(e)}catch(e){y.value=e?.message||"任务状态更新失败"}},Ne=async()=>{Y.value=!0,await Rt()},Vt=()=>{Y.value=!1},jt=()=>{const e=c.value?.id||null,t=f.value?.id||null;P.value=e,F.value=t,Ce(qe,e),Ce(Qe,t),te.value=c.value?.logs?.length||0,se.value=f.value?.logs?.length||0,Te(Ge,te.value),Te(Ye,se.value),c.value=null,f.value=null,he.value=null,we.value=null,y.value="",D.value=!1,T.value=!1,X(),W(),st(He),st(Je)},Ee=e=>!!(e&&e===P.value),Ie=e=>!!(e&&e===F.value),Mt=()=>{z.value=!z.value},oe=()=>{z.value=!1},rt=e=>{if(!z.value)return;const t=e.target;Me.value&&!Me.value.contains(t)&&(z.value=!1)};rs(async()=>{It(),await ce(),await Ke(),Xt(),document.addEventListener("click",rt)});const q=H(()=>{const e=c.value?.logs||[];return te.value?e.slice(te.value):e}),Q=H(()=>{const e=f.value?.logs||[];return se.value?e.slice(se.value):e}),Dt=H(()=>!!y.value||!!c.value||!!f.value||q.value.length>0||Q.value.length>0),Ot=async()=>{await as();const e=Xe.value;e&&(e.scrollTop=e.scrollHeight)};ls([q,Q,Y],async()=>{Y.value&&await Ot()},{deep:!0});const Bt=H(()=>{const e=c.value?.status,t=f.value?.status;return e==="running"||e==="pending"||t==="running"||t==="pending"}),Nt=H(()=>{if(y.value)return"bg-rose-500";if(Bt.value)return"bg-sky-400";const e=[];if(c.value){const d=c.value.success_count??0,x=c.value.fail_count??0,v=c.value.count??d+x;e.push({success:d,fail:x,total:v,status:c.value.status})}if(f.value){const d=f.value.success_count??0,x=f.value.fail_count??0,v=f.value.account_ids?.length??d+x;e.push({success:d,fail:x,total:v,status:f.value.status})}if(!e.length)return"bg-muted-foreground";const t=e.reduce((d,x)=>d+x.success,0),o=e.reduce((d,x)=>d+x.fail,0),i=e.reduce((d,x)=>d+(x.total||0),0);if(t>0&&o>0)return"bg-amber-400";if(o>0&&t===0)return"bg-rose-500";if(t>0&&o===0)return"bg-emerald-400";if(i===0){const d=e.every(v=>v.status==="success");if(e.some(v=>v.status==="failed"))return"bg-rose-500";if(d)return"bg-emerald-400"}return"bg-muted-foreground"});ns(()=>{X(),W(),Qt(),document.removeEventListener("click",rt)});const fe=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?"429限流":e.cooldown_reason==="错误禁用"?"错误禁用":e.disabled?"手动禁用":e.status==="已过期"?"已过期":e.status==="即将过期"?"即将过期":"正常",lt=e=>{const t=fe(e);return t==="429限流"||t==="即将过期"?"bg-amber-200 text-amber-900":t==="错误禁用"||t==="已过期"?"bg-destructive/10 text-destructive":t==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},nt=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?!0:e.disabled||e.cooldown_reason==="错误禁用",at=e=>e==="已过期"?"过期":e==="未设置"?"未设置":e,it=e=>e.status==="已过期"?"text-rose-600":e.status==="即将过期"?"text-amber-700":e.status==="未设置"?"text-muted-foreground":"text-emerald-600",dt=e=>e<60?`${e} 秒`:e<3600?`${Math.ceil(e/60)} 分钟`:`${(e/3600).toFixed(1)} 小时`,Ue=e=>e.cooldown_seconds>0?"text-amber-700":e.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",ut=e=>{const t=fe(e);return t==="手动禁用"||t==="已过期"?"bg-muted/70":""},Le=e=>{const t=new Set(p.value);t.has(e)?t.delete(e):t.add(e),p.value=t},ct=()=>{if(De.value){p.value=new Set;return}p.value=new Set(K.value.map(e=>e.id))},Ut=(e,t)=>e.id||`account_${t+1}`,ft=async()=>(await h.getConfig()).accounts.map((t,o)=>({...t,id:Ut(t,o)})),vt=e=>`${e.time} [${e.level}] ${e.message}`,zt=(e,t)=>{let o=-1;for(let d=0;d<e.length;d+=1)if(e[d].id===t){o=d;break}if(o===-1)return u.value="未找到对应账号配置。",!1;const i=e[o];return _.value={id:i.id,secure_c_ses:i.secure_c_ses,csesidx:i.csesidx,config_id:i.config_id,host_c_oses:i.host_c_oses,expires_at:i.expires_at},We.value=e,ke.value=o,ne.value=!0,!0},xt=async e=>{u.value="";try{const t=await ft();zt(t,e)}catch(t){u.value=t.message||"加载账号配置失败"}},Pt=async()=>{M.value="";try{const e=await h.getConfig();ae.value=Array.isArray(e.accounts)?e.accounts:[],ee.value=JSON.stringify(pt(ae.value),null,2),B.value=!0,j.value=!0}catch(e){M.value=e.message||"加载账号配置失败"}},ze=()=>{j.value=!1,M.value="",B.value=!1},mt=()=>{const e=JSON.parse(ee.value);if(!Array.isArray(e))throw new Error("配置格式必须是数组。");return e},Ft=e=>typeof e!="string"||!e?e:e.length<=6?`${e.slice(0,2)}****`:`${e.slice(0,3)}****`,pt=e=>{const t=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password","mail_refresh_token","mail_client_id"]);return e.map(o=>{const i={...o};return t.forEach(d=>{const x=i[d];x&&(i[d]=Ft(x))}),i})},Kt=()=>{if(M.value="",!B.value){try{ae.value=mt()}catch(e){M.value=e.message||"JSON 格式错误";return}ee.value=JSON.stringify(pt(ae.value),null,2),B.value=!0;return}ee.value=JSON.stringify(ae.value,null,2),B.value=!1},Ht=async()=>{M.value="";try{const e=mt();await w.updateConfig(e),ze()}catch(e){M.value=e.message||"保存失败"}},Pe=()=>{ne.value=!1,u.value=""},Jt=async()=>{if(ke.value===null)return;const e=[...We.value];e[ke.value]={...e[ke.value],id:_.value.id,secure_c_ses:_.value.secure_c_ses,csesidx:_.value.csesidx,config_id:_.value.config_id,host_c_oses:_.value.host_c_oses||void 0,expires_at:_.value.expires_at||void 0};try{await w.updateConfig(e),Pe()}catch(t){u.value=t.message||"保存失败"}},Gt=async()=>{await w.bulkEnable(Array.from(p.value)),p.value=new Set},Yt=async()=>{await C.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"})&&(await w.bulkDisable(Array.from(p.value)),p.value=new Set)},qt=async()=>{await C.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"})&&(await w.bulkDelete(Array.from(p.value)),p.value=new Set)},gt=async e=>{await w.enableAccount(e)},bt=async e=>{await C.ask({title:"禁用账号",message:"确定要禁用该账号吗?"})&&await w.disableAccount(e)},yt=async e=>{await C.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"})&&await w.deleteAccount(e)};let ve=null,xe=null,me=null,Ae=!1;const X=()=>{ve!==null&&(window.clearInterval(ve),ve=null)},W=()=>{xe!==null&&(window.clearInterval(xe),xe=null)},Qt=()=>{me!==null&&(window.clearInterval(me),me=null),Ae=!1},_t=e=>e==="pending"?"等待中":e==="running"?"执行中":e==="success"?"成功":e==="failed"?"失败":e,ht=async e=>{if(Ee(e)){X();return}const t=await h.getRegisterTask(e);if(Ee(t.id)){X();return}Oe(t),t.status!=="running"&&t.status!=="pending"&&(D.value=!1,X(),await ce())},wt=async e=>{if(Ie(e)){W();return}const t=await h.getLoginTask(e);if(Ie(t.id)){W();return}Se(t),t.status!=="running"&&t.status!=="pending"&&(T.value=!1,W(),await ce())},kt=e=>{X(),ve=window.setInterval(()=>{ht(e).catch(t=>{y.value=t?.message||"注册任务更新失败",X(),D.value=!1})},3e3)},Fe=e=>{W(),xe=window.setInterval(()=>{wt(e).catch(t=>{y.value=t?.message||"刷新任务更新失败",W(),T.value=!1})},3e3)},Xt=()=>{me===null&&(me=window.setInterval(async()=>{if(!Ae&&!Y.value&&!(ve!==null||xe!==null)&&!(!D.value&&!T.value&&!c.value&&!f.value)){Ae=!0;try{await Ke()}catch(e){y.value=e?.message||"后台刷新失败"}finally{Ae=!1}}},6e3))},Ke=async()=>{try{const e=await h.getRegisterCurrent();e&&"id"in e&&!Ee(e.id)&&(Oe(e),(e.status==="running"||e.status==="pending")&&(D.value=!0,kt(e.id)))}catch(e){y.value=e.message||"加载注册任务失败"}try{const e=await h.getLoginCurrent();e&&"id"in e&&!Ie(e.id)&&(Se(e),(e.status==="running"||e.status==="pending")&&(T.value=!0,Fe(e.id)))}catch(e){y.value=e.message||"加载刷新任务失败"}},Wt=async()=>{y.value="",D.value=!0;try{const e=Number.isFinite(ie.value)&&ie.value>0?ie.value:void 0,t=await h.startRegister(e);Oe(t),kt(t.id),ye.value=!1,Y.value=!0}catch(e){y.value=e.message||"启动注册失败",D.value=!1}},Ct=async()=>{if(p.value.size){y.value="",T.value=!0;try{const e=await h.startLogin(Array.from(p.value));Se(e),Fe(e.id),Ne()}catch(e){y.value=e.message||"启动刷新失败",T.value=!1}}},Zt=async()=>{y.value="",T.value=!0;try{await h.checkLogin();const e=await h.getLoginCurrent();if(e&&"id"in e){Se(e),Fe(e.id),Ne();return}T.value=!1}catch(e){y.value=e.message||"触发刷新失败",T.value=!1}};return(e,t)=>(r(),l(ge,null,[s("div",vs,[s("section",xs,[s("div",ms,[s("div",ps,[A(s("input",{"onUpdate:modelValue":t[0]||(t[0]=o=>le.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[$,le.value]]),J(is,{modelValue:Z.value,"onUpdate:modelValue":t[1]||(t[1]=o=>Z.value=o),options:Et},null,8,["modelValue"])]),s("div",gs,[J(be,{modelValue:De.value,"onUpdate:modelValue":ct},{default:Tt(()=>[...t[27]||(t[27]=[pe(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+n(O.value)+" / "+n(K.value.length)+" 个账号",1),s("div",bs,[s("button",{type:"button",class:g(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",G.value==="table"?"bg-accent text-accent-foreground":""]),onClick:t[2]||(t[2]=o=>G.value="table"),"aria-label":"列表视图"},[...t[28]||(t[28]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:g(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",G.value==="card"?"bg-accent text-accent-foreground":""]),onClick:t[3]||(t[3]=o=>G.value="card"),"aria-label":"卡片视图"},[...t[29]||(t[29]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",ys,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:R(re),onClick:ce}," 刷新列表 ",8,_s),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pt}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:D.value,onClick:Lt}," 添加账户 ",8,hs),s("div",{ref_key:"moreActionsRef",ref:Me,class:"relative"},[s("button",{class:g(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",z.value?"bg-accent text-accent-foreground":""]),onClick:Mt},[t[30]||(t[30]=pe(" 更多操作 ",-1)),t[31]||(t[31]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),Dt.value?(r(),l("span",{key:0,class:g(["ml-1 h-2 w-2 rounded-full",Nt.value]),"aria-hidden":"true"},null,2)):m("",!0)],2),z.value?(r(),l("div",ws,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:t[4]||(t[4]=o=>{Ne(),oe()})}," 任务状态 "),t[32]||(t[32]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",T.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:T.value,onClick:t[5]||(t[5]=o=>{Zt(),oe()})}," 刷新过期 ",10,ks),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!O.value||T.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!O.value||T.value,onClick:t[6]||(t[6]=o=>{Ct(),oe()})}," 刷新选中 ",10,Cs),t[33]||(t[33]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[7]||(t[7]=o=>{Gt(),oe()})}," 批量启用 ",10,Ts),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[8]||(t[8]=o=>{Yt(),oe()})}," 批量禁用 ",10,Ss),s("button",{type:"button",class:g(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",O.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!O.value,onClick:t[9]||(t[9]=o=>{qt(),oe()})}," 批量删除 ",10,Es)])):m("",!0)],512)]),G.value==="card"?(r(),l("div",Is,[(r(!0),l(ge,null,Ve(K.value,o=>(r(),l("div",{key:o.id,class:g(["rounded-2xl border border-border bg-card p-4",ut(o)]),onClick:i=>Le(o.id)},[s("div",As,[s("div",null,[t[34]||(t[34]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",$s,n(o.id),1)]),s("div",Rs,[J(be,{modelValue:p.value.has(o.id),"onUpdate:modelValue":i=>Le(o.id),onClick:t[10]||(t[10]=V(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:g(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",lt(o)])},n(fe(o)),3)])]),s("div",Vs,[s("div",null,[t[35]||(t[35]=s("p",null,"剩余时间",-1)),s("p",{class:g(["mt-1 text-sm font-semibold",it(o)])},n(at(o.remaining_display)),3),o.expires_at?(r(),l("p",js,n(o.expires_at),1)):m("",!0)]),s("div",null,[t[36]||(t[36]=s("p",null,"冷却",-1)),s("p",{class:g(["mt-1",Ue(o)])},[o.cooldown_seconds>0?(r(),l("span",Ms,n(dt(o.cooldown_seconds))+" · "+n(o.cooldown_reason),1)):(r(),l("span",Ds,n(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[t[37]||(t[37]=s("p",null,"失败数",-1)),s("p",Os,n(o.error_count),1)]),s("div",null,[t[38]||(t[38]=s("p",null,"会话数",-1)),s("p",Bs,n(o.conversation_count),1)])]),s("div",Ns,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>xt(o.id),["stop"])}," 编辑 ",8,Us),nt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[11]||(t[11]=V(()=>{},["stop"])),i=>gt(o.id)]}," 启用 ",8,zs)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[12]||(t[12]=V(()=>{},["stop"])),i=>bt(o.id)]}," 禁用 ",8,Ps)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[t[13]||(t[13]=V(()=>{},["stop"])),i=>yt(o.id)]}," 删除 ",8,Fs)])],10,Ls))),128)),!K.value.length&&!R(re)?(r(),l("div",Ks," 暂无账号数据,请检查后台配置。 ")):m("",!0)])):(r(),l("div",Hs,[s("table",Js,[s("thead",Gs,[s("tr",null,[s("th",Ys,[J(be,{modelValue:De.value,"onUpdate:modelValue":ct},null,8,["modelValue"])]),t[40]||(t[40]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),t[41]||(t[41]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",qs,[s("span",Qs,[t[39]||(t[39]=pe(" 剩余/过期 ",-1)),J(cs,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),t[42]||(t[42]=s("th",{class:"py-3 pr-6"},"冷却",-1)),t[43]||(t[43]=s("th",{class:"py-3 pr-6"},"失败数",-1)),t[44]||(t[44]=s("th",{class:"py-3 pr-6"},"会话数",-1)),t[45]||(t[45]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",Xs,[!K.value.length&&!R(re)?(r(),l("tr",Ws,[...t[46]||(t[46]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):m("",!0),(r(!0),l(ge,null,Ve(K.value,o=>(r(),l("tr",{key:o.id,class:g(["border-t border-border",ut(o)]),onClick:i=>Le(o.id)},[s("td",{class:"py-4 pr-4",onClick:t[14]||(t[14]=V(()=>{},["stop"]))},[J(be,{modelValue:p.value.has(o.id),"onUpdate:modelValue":i=>Le(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",eo,n(o.id),1),s("td",to,[s("span",{class:g(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",lt(o)])},n(fe(o)),3)]),s("td",so,[s("div",{class:g(["text-sm font-semibold",it(o)])},n(at(o.remaining_display)),3),o.expires_at?(r(),l("span",oo,n(o.expires_at),1)):m("",!0)]),s("td",ro,[o.cooldown_seconds>0?(r(),l("span",{key:0,class:g(Ue(o))},n(dt(o.cooldown_seconds))+" · "+n(o.cooldown_reason),3)):(r(),l("span",{key:1,class:g(Ue(o))},n(o.cooldown_reason||"无冷却"),3))]),s("td",lo,n(o.error_count),1),s("td",no,n(o.conversation_count),1),s("td",ao,[s("div",io,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>xt(o.id),["stop"])}," 编辑 ",8,uo),nt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>gt(o.id),["stop"])}," 启用 ",8,co)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:V(i=>bt(o.id),["stop"])}," 禁用 ",8,fo)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:V(i=>yt(o.id),["stop"])}," 删除 ",8,vo)])])],10,Zs))),128))])])]))])]),J(ds,{open:R(C).open.value,title:R(C).title.value,message:R(C).message.value,"confirm-text":R(C).confirmText.value,"cancel-text":R(C).cancelText.value,onConfirm:R(C).confirm,onCancel:R(C).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(r(),Re(je,{to:"body"},[ye.value?(r(),l("div",xo,[s("div",mo,[s("div",po,[s("div",null,[t[47]||(t[47]=s("p",{class:"text-sm font-medium text-foreground"},"添加账户",-1)),s("p",go,n(N.value==="register"?"创建 DuckMail 账号并自动注册":"批量导入账户配置"),1)]),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Be}," 关闭 ")]),s("div",bo,[s("div",yo,[s("div",_o,[s("button",{type:"button",class:g(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",N.value==="register"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[15]||(t[15]=o=>N.value="register")}," 自动注册 ",2),s("button",{type:"button",class:g(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",N.value==="import"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[16]||(t[16]=o=>N.value="import")}," 批量导入 ",2)]),N.value==="register"?(r(),l("div",ho,[t[48]||(t[48]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),A(s("input",{"onUpdate:modelValue":t[17]||(t[17]=o=>ie.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,ie.value,void 0,{number:!0}]]),t[49]||(t[49]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"}," 默认域名来自设置面板(可在“配置面板”中修改) ",-1))])):(r(),l("div",wo,[t[50]||(t[50]=s("label",{class:"block text-xs text-muted-foreground"},"批量导入(每行一个)",-1)),A(s("textarea",{"onUpdate:modelValue":t[18]||(t[18]=o=>de.value=o),class:"min-h-[140px] w-full rounded-2xl border border-input bg-background px-3 py-2 text-xs font-mono",placeholder:`duckmail----you@example.com----password
2
+ user@outlook.com----loginPassword----clientId----refreshToken`},null,512),[[$,de.value]]),t[51]||(t[51]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"支持两种格式:"),s("p",{class:"mt-1 font-mono"},"duckmail----email----password"),s("p",{class:"mt-1 font-mono"},"email----password----clientId----refreshToken"),s("p",{class:"mt-2 text-[11px]"},'导入后请执行一次"刷新选中"以获取 Cookie。')],-1)),U.value?(r(),l("div",ko,n(U.value),1)):m("",!0)])),t[53]||(t[53]=s("div",{class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-[11px] leading-relaxed"},[s("p",{class:"text-xs font-bold text-rose-600"},"⚠️ 严禁滥用:禁止将本工具用于商业用途或任何形式的滥用(无论规模大小)"),s("p",{class:"mt-1 text-muted-foreground"},[pe("详细声明请查看项目 "),s("a",{href:"https://github.com/Dreamy-rain/gemini-business2api/blob/main/docs/DISCLAIMER.md",target:"_blank",class:"text-primary hover:underline font-medium"},"DISCLAIMER.md")])],-1)),J(be,{modelValue:ue.value,"onUpdate:modelValue":t[19]||(t[19]=o=>ue.value=o)},{default:Tt(()=>[...t[52]||(t[52]=[pe(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])])]),s("div",Co,[s("div",To,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Be}," 取消 "),N.value==="register"?(r(),l("button",{key:0,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:D.value||!ue.value,onClick:Wt}," 开始注册 ",8,So)):(r(),l("button",{key:1,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:_e.value||!ue.value,onClick:$t}," 导入并保存 ",8,Eo))])])])])):m("",!0)])),(r(),Re(je,{to:"body"},[Y.value?(r(),l("div",Io,[s("div",Lo,[s("div",Ao,[t[54]||(t[54]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",$o,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary",disabled:!q.value.length&&!Q.value.length&&!c.value&&!f.value&&!y.value,onClick:jt}," 清空日志 ",8,Ro),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Vt}," 关闭 ")])]),s("div",Vo,[y.value?(r(),l("div",jo,n(y.value),1)):m("",!0),c.value||f.value?(r(),l("div",Mo,[c.value?(r(),l("div",Do,[t[55]||(t[55]=s("div",{class:"font-medium text-foreground"},"注册任务",-1)),s("div",Oo,[s("span",null,"状态:"+n(_t(c.value.status)),1),s("span",null,"进度:"+n(c.value.progress)+"/"+n(c.value.count),1),s("span",null,"成功:"+n(c.value.success_count),1),s("span",null,"失败:"+n(c.value.fail_count),1)])])):m("",!0),f.value?(r(),l("div",Bo,[t[56]||(t[56]=s("div",{class:"font-medium text-foreground"},"刷新任务",-1)),s("div",No,[s("span",null,"状态:"+n(_t(f.value.status)),1),s("span",null,"进度:"+n(f.value.progress)+"/"+n(f.value.account_ids.length),1),s("span",null,"成功:"+n(f.value.success_count),1),s("span",null,"失败:"+n(f.value.fail_count),1)])])):m("",!0)])):m("",!0),q.value.length||Q.value.length?(r(),l("div",Uo,[s("div",{ref_key:"taskLogsRef",ref:Xe,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[q.value.length?(r(),l("div",zo,[t[57]||(t[57]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",Po,[(r(!0),l(ge,null,Ve(q.value,(o,i)=>(r(),l("div",{key:`reg-${i}`,class:"font-mono"},n(vt(o)),1))),128))])])):m("",!0),Q.value.length?(r(),l("div",Fo,[t[58]||(t[58]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",Ko,[(r(!0),l(ge,null,Ve(Q.value,(o,i)=>(r(),l("div",{key:`login-${i}`,class:"font-mono"},n(vt(o)),1))),128))])])):m("",!0)],512)])):m("",!0),!y.value&&!c.value&&!f.value&&!q.value.length&&!Q.value.length?(r(),l("div",Ho," 暂无任务 ")):m("",!0)])])])):m("",!0)])),(r(),Re(je,{to:"body"},[ne.value?(r(),l("div",Jo,[s("div",Go,[s("div",{class:"flex items-center justify-between"},[t[59]||(t[59]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Pe}," 关闭 ")]),u.value?(r(),l("div",Yo,n(u.value),1)):m("",!0),s("div",qo,[t[60]||(t[60]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),A(s("input",{"onUpdate:modelValue":t[20]||(t[20]=o=>_.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[$,_.value.id]]),t[61]||(t[61]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),A(s("textarea",{"onUpdate:modelValue":t[21]||(t[21]=o=>_.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[$,_.value.secure_c_ses]]),t[62]||(t[62]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),A(s("input",{"onUpdate:modelValue":t[22]||(t[22]=o=>_.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.csesidx]]),t[63]||(t[63]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),A(s("input",{"onUpdate:modelValue":t[23]||(t[23]=o=>_.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.config_id]]),t[64]||(t[64]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),A(s("input",{"onUpdate:modelValue":t[24]||(t[24]=o=>_.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[$,_.value.host_c_oses]]),t[65]||(t[65]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),A(s("input",{"onUpdate:modelValue":t[25]||(t[25]=o=>_.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[$,_.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Pe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Jt}," 保存 ")])])])):m("",!0)])),(r(),Re(je,{to:"body"},[j.value?(r(),l("div",Qo,[s("div",Xo,[s("div",Wo,[t[66]||(t[66]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",Zo,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Kt},n(B.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:ze}," 关闭 ")])]),M.value?(r(),l("div",er,n(M.value),1)):m("",!0),s("div",tr,[A(s("textarea",{"onUpdate:modelValue":t[26]||(t[26]=o=>ee.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:B.value},null,8,sr),[[$,ee.value]])]),s("div",or,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:ze}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Ht,disabled:B.value}," 保存 ",8,rr)])])])):m("",!0)]))],64))}});export{cr as default};
static/assets/Accounts-v_9wnBup.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ import{g as S,C as es,h as a,d as ts,D as ss,i as F,o as os,s as rs,j as ls,c as l,a as s,x as K,y as Ie,m as E,v as I,A as kt,t as n,n as m,u as L,b as x,f as G,F as pe,r as Le,T as $e,w as $,e as r,E as ns}from"./index-BIHSVHyU.js";import{_ as as}from"./SelectMenu.vue_vue_type_script_setup_true_lang-Cdct4OHH.js";import{_ as xe}from"./Checkbox.vue_vue_type_script_setup_true_lang-p51UOq8I.js";import{_ as is}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-fISQukFW.js";import{u as ds}from"./useConfirmDialog-urbmwbaE.js";import{_ as us}from"./HelpTip.vue_vue_type_script_setup_true_lang-BYvP2-eE.js";const h={list:()=>S.get("/admin/accounts"),getConfig:()=>S.get("/admin/accounts-config"),updateConfig:g=>S.put("/admin/accounts-config",g),delete:g=>S.delete(`/admin/accounts/${g}`),disable:g=>S.put(`/admin/accounts/${g}/disable`),enable:g=>S.put(`/admin/accounts/${g}/enable`),startRegister:(g,k)=>S.post("/admin/register/start",{count:g,domain:k}),getRegisterTask:g=>S.get(`/admin/register/task/${g}`),getRegisterCurrent:()=>S.get("/admin/register/current"),startLogin:g=>S.post("/admin/login/start",g),getLoginTask:g=>S.get(`/admin/login/task/${g}`),getLoginCurrent:()=>S.get("/admin/login/current"),checkLogin:()=>S.post("/admin/login/check")},cs=es("accounts",()=>{const g=a([]),k=a(!1);async function A(){k.value=!0;try{const f=await h.list();g.value=Array.isArray(f)?f:f.accounts||[]}finally{k.value=!1}}async function oe(f){await h.delete(f),await A()}async function T(f){await h.disable(f),await A()}async function re(f){await h.enable(f),await A()}async function X(f){await Promise.all(f.map(R=>h.enable(R))),await A()}async function b(f){await Promise.all(f.map(R=>h.disable(R))),await A()}async function H(f){await Promise.all(f.map(R=>h.delete(R))),await A()}async function le(f){await h.updateConfig(f),await A()}return{accounts:g,isLoading:k,loadAccounts:A,deleteAccount:oe,disableAccount:T,enableAccount:re,bulkEnable:X,bulkDisable:b,bulkDelete:H,updateConfig:le}}),fs={class:"space-y-8"},vs={class:"rounded-3xl border border-border bg-card p-6"},ps={class:"flex flex-wrap items-center justify-between gap-4"},xs={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},ms={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},gs={class:"ml-auto flex items-center gap-2 sm:ml-0"},bs={class:"mt-4 flex flex-wrap items-center gap-2"},ys=["disabled"],_s=["disabled"],hs={key:0,class:"absolute right-0 z-10 mt-2 w-full space-y-1 rounded-2xl border border-border bg-card p-2 shadow-lg"},ks=["disabled"],ws=["disabled"],Cs=["disabled"],Ts=["disabled"],Ss=["disabled"],As={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},Es=["onClick"],Is={class:"flex items-start justify-between gap-3"},Ls={class:"mt-1 font-mono text-xs text-foreground"},$s={class:"flex items-center gap-2"},Rs={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},Vs={key:0,class:"mt-1 text-[11px]"},Ms={key:0},js={key:1},Ds={class:"mt-1 text-sm font-semibold text-foreground"},Os={class:"mt-1 text-sm font-semibold text-foreground"},Bs={class:"mt-4 flex flex-wrap items-center gap-2"},Ns=["onClick"],Us=["onClick"],zs=["onClick"],Ps=["onClick"],Fs={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},Ks={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},Gs={class:"min-w-full text-left text-sm"},Hs={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},Js={class:"py-3 pr-4"},Ys={class:"py-3 pr-6"},Qs={class:"inline-flex items-center gap-2"},qs={class:"text-sm text-foreground"},Ws={key:0},Xs=["onClick"],Zs={class:"py-4 pr-6 font-mono text-xs text-foreground"},eo={class:"py-4 pr-6"},to={class:"py-4 pr-6"},so={key:0,class:"block text-[11px] text-muted-foreground"},oo={class:"py-4 pr-6 text-xs"},ro={class:"py-4 pr-6 text-xs text-muted-foreground"},lo={class:"py-4 pr-6 text-xs text-muted-foreground"},no={class:"py-4 text-right"},ao={class:"flex flex-wrap justify-end gap-2"},io=["onClick"],uo=["onClick"],co=["onClick"],fo=["onClick"],vo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},po={class:"flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},xo={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},mo={class:"mt-1 text-xs text-muted-foreground"},go={class:"scrollbar-slim flex-1 overflow-y-auto px-6 py-4"},bo={class:"space-y-4 text-sm"},yo={class:"flex rounded-full border border-border bg-muted/30 p-1 text-xs"},_o={key:0,class:"space-y-4"},ho={key:1,class:"space-y-4"},ko={key:0,class:"rounded-2xl border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-600"},wo={class:"border-t border-border/60 px-6 py-4"},Co={class:"flex items-center justify-end gap-2"},To=["disabled"],So=["disabled"],Ao={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Eo={class:"flex h-[80vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-border bg-card shadow-xl"},Io={class:"flex items-center justify-between border-b border-border/60 px-6 py-4"},Lo={class:"flex items-center gap-2"},$o=["disabled"],Ro={class:"flex min-h-0 flex-1 flex-col px-6 py-4"},Vo={key:0,class:"rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},Mo={key:1,class:"grid gap-3 text-xs text-muted-foreground"},jo={key:0,class:"space-y-1"},Do={class:"flex flex-wrap gap-x-4 gap-y-1"},Oo={key:1,class:"space-y-1"},Bo={class:"flex flex-wrap gap-x-4 gap-y-1"},No={key:2,class:"mt-4 flex min-h-0 flex-1 flex-col"},Uo={key:0,class:"space-y-2"},zo={class:"space-y-1 text-[11px] text-muted-foreground"},Po={key:1,class:"mt-4 space-y-2"},Fo={class:"space-y-1 text-[11px] text-muted-foreground"},Ko={key:3,class:"mt-4 rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},Go={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Ho={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Jo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},Yo={class:"mt-4 space-y-3 text-sm"},Qo={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},qo={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},Wo={class:"flex items-center justify-between"},Xo={class:"flex items-center gap-2"},Zo={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},er={class:"mt-4"},tr=["readonly"],sr={class:"mt-6 flex items-center justify-end gap-2"},or=["disabled"],Fe="accounts-register-task-cache",Ke="accounts-login-task-cache",Ge="accounts-register-log-clear",He="accounts-login-log-clear",Je="accounts-register-task-cleared-id",Ye="accounts-login-task-cleared-id",wt="1970-01-01 00:00:00",ur=ts({__name:"Accounts",setup(g){const k=cs(),{accounts:A,isLoading:oe}=ss(k),T=ds(),re=a(""),X=a("all"),b=a(new Set),H=a("table"),le=a(!1),f=a(""),R=a(!1),V=a(""),Z=a(""),D=a(!1),ne=a([]),ae=a(1),me=a(!1),O=a("register"),ie=a(""),B=a(""),ge=a(!1),J=a(!1),N=a(!1),Re=a(null),be=a(null),ye=a(null),U=a(null),z=a(null),ee=a(0),te=a(0),de=a(!1),v=a(null),p=a(null),Qe=a(null),M=a(!1),C=a(!1),y=a(""),_=a({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),_e=a(null),qe=a([]),Ct=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],P=F(()=>{const e=re.value.trim().toLowerCase();return A.value.filter(t=>{const o=!e||t.id.toLowerCase().includes(e),i=X.value==="all"||ue(t)===X.value;return o&&i})}),j=F(()=>b.value.size),Ve=F(()=>P.value.length>0&&P.value.every(e=>b.value.has(e.id))),he=async()=>{await k.loadAccounts(),b.value=new Set,N.value=!1},We=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},Xe=e=>{try{return localStorage.getItem(e)||null}catch{return null}},ke=(e,t)=>{try{if(t){localStorage.setItem(e,t);return}localStorage.removeItem(e)}catch{}},Ze=(e,t)=>{try{localStorage.setItem(e,JSON.stringify(t))}catch{}},et=e=>{try{localStorage.removeItem(e)}catch{}},tt=e=>{const t=localStorage.getItem(e),o=Number(t);return Number.isFinite(o)?o:0},we=(e,t)=>{try{localStorage.setItem(e,String(t))}catch{}},Me=(e,t=!0)=>{e&&(e.id&&e.id===U.value||(e.id&&U.value&&e.id!==U.value&&(U.value=null,ke(Je,null)),v.value=e,e.id&&e.id!==be.value&&(be.value=e.id,ee.value=0,we(Ge,0)),t&&Ze(Fe,e)))},Ce=(e,t=!0)=>{e&&(e.id&&e.id===z.value||(e.id&&z.value&&e.id!==z.value&&(z.value=null,ke(Ye,null)),p.value=e,e.id&&e.id!==ye.value&&(ye.value=e.id,te.value=0,we(He,0)),t&&Ze(Ke,e)))},Tt=()=>{ee.value=tt(Ge),te.value=tt(He),U.value=Xe(Je),z.value=Xe(Ye);const e=We(Fe);e&&e.id!==U.value&&(v.value=e,be.value=e.id||null);const t=We(Ke);t&&t.id!==z.value&&(p.value=t,ye.value=t.id||null)},St=()=>{me.value=!0,O.value="register",ie.value="",B.value="",ge.value=!1,de.value=!1},je=()=>{me.value=!1},At=e=>{const t=[],o=[];return e.split(/\r?\n/).map(c=>c.trim()).filter(Boolean).forEach((c,d)=>{const u=c.split("----").map(w=>w.trim()),ze=d+1;if(u.length){if(u[0].toLowerCase()==="duckmail"){if(u.length<3||!u[1]||!u[2]){o.push(`第 ${ze} 行格式错误(duckmail)`);return}const w=u[1],Pe=u.slice(2).join("----");t.push({id:w,secure_c_ses:"",csesidx:"",config_id:"",expires_at:wt,mail_provider:"duckmail",mail_address:w,mail_password:Pe});return}if(u.length>=4&&u[0]&&u[2]&&u[3]){const w=u[0],Pe=u[2],Zt=u.slice(3).join("----");t.push({id:w,secure_c_ses:"",csesidx:"",config_id:"",expires_at:wt,mail_provider:"microsoft",mail_address:w,mail_client_id:Pe,mail_refresh_token:Zt,mail_tenant:"consumers"});return}o.push(`第 ${ze} 行格式错误`)}}),{items:t,errors:o}},Et=async()=>{if(B.value="",!ie.value.trim()){B.value="请输入导入内容";return}const{items:e,errors:t}=At(ie.value);if(!e.length){B.value=t.length?t.join(","):"未识别到有效账号";return}if(t.length){B.value=t.slice(0,3).join("��");return}ge.value=!0;try{const i=[...await ut()],c=new Map(i.map((d,u)=>[d.id,u]));e.forEach(d=>{const u=c.get(d.id||"");if(u===void 0){i.push(d);return}const w={...i[u],mail_provider:d.mail_provider,mail_address:d.mail_address};d.mail_provider==="microsoft"?(w.mail_client_id=d.mail_client_id,w.mail_refresh_token=d.mail_refresh_token,w.mail_tenant=d.mail_tenant,w.mail_password=void 0):(w.mail_password=d.mail_password,w.mail_client_id=void 0,w.mail_refresh_token=void 0,w.mail_tenant=void 0),i[u]=w}),await k.updateConfig(i),je()}catch(o){B.value=o.message||"导入失败"}finally{ge.value=!1}},It=async()=>{try{const e=[],t=v.value?.id,o=p.value?.id;if(t&&!Te(t)&&e.push(yt(t)),o&&!Se(o)&&e.push(_t(o)),!e.length){await Ue();return}await Promise.all(e)}catch(e){y.value=e?.message||"任务状态更新失败"}},Lt=async()=>{J.value=!0,await It()},$t=()=>{J.value=!1},Rt=()=>{const e=v.value?.id||null,t=p.value?.id||null;U.value=e,z.value=t,ke(Je,e),ke(Ye,t),ee.value=v.value?.logs?.length||0,te.value=p.value?.logs?.length||0,we(Ge,ee.value),we(He,te.value),v.value=null,p.value=null,be.value=null,ye.value=null,y.value="",M.value=!1,C.value=!1,q(),W(),et(Fe),et(Ke)},Te=e=>!!(e&&e===U.value),Se=e=>!!(e&&e===z.value),Vt=()=>{N.value=!N.value},se=()=>{N.value=!1},st=e=>{if(!N.value)return;const t=e.target;Re.value&&!Re.value.contains(t)&&(N.value=!1)};os(async()=>{Tt(),await he(),await Ue(),Qt(),document.addEventListener("click",st)});const Y=F(()=>{const e=v.value?.logs||[];return ee.value?e.slice(ee.value):e}),Q=F(()=>{const e=p.value?.logs||[];return te.value?e.slice(te.value):e}),Mt=F(()=>!!y.value||!!v.value||!!p.value||Y.value.length>0||Q.value.length>0),jt=async()=>{await ns();const e=Qe.value;e&&(e.scrollTop=e.scrollHeight)};rs([Y,Q,J],async()=>{J.value&&await jt()},{deep:!0});const Dt=F(()=>{const e=v.value?.status,t=p.value?.status;return e==="running"||e==="pending"||t==="running"||t==="pending"}),Ot=F(()=>{if(y.value)return"bg-rose-500";if(Dt.value)return"bg-sky-400";const e=[];if(v.value){const c=v.value.success_count??0,d=v.value.fail_count??0,u=v.value.count??c+d;e.push({success:c,fail:d,total:u,status:v.value.status})}if(p.value){const c=p.value.success_count??0,d=p.value.fail_count??0,u=p.value.account_ids?.length??c+d;e.push({success:c,fail:d,total:u,status:p.value.status})}if(!e.length)return"bg-muted-foreground";const t=e.reduce((c,d)=>c+d.success,0),o=e.reduce((c,d)=>c+d.fail,0),i=e.reduce((c,d)=>c+(d.total||0),0);if(t>0&&o>0)return"bg-amber-400";if(o>0&&t===0)return"bg-rose-500";if(t>0&&o===0)return"bg-emerald-400";if(i===0){const c=e.every(u=>u.status==="success");if(e.some(u=>u.status==="failed"))return"bg-rose-500";if(c)return"bg-emerald-400"}return"bg-muted-foreground"});ls(()=>{q(),W(),Yt(),document.removeEventListener("click",st)});const ue=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?"429限流":e.cooldown_reason==="错误禁用"?"错误禁用":e.disabled?"手动禁用":e.status==="已过期"?"已过期":e.status==="即将过期"?"即将过期":"正常",ot=e=>{const t=ue(e);return t==="429限流"||t==="即将过期"?"bg-amber-200 text-amber-900":t==="错误禁用"||t==="已过期"?"bg-destructive/10 text-destructive":t==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},rt=e=>e.cooldown_reason?.includes("429")&&e.cooldown_seconds>0?!0:e.disabled||e.cooldown_reason==="错误禁用",lt=e=>e==="已过期"?"过期":e==="未设置"?"未设置":e,nt=e=>e.status==="已过期"?"text-rose-600":e.status==="即将过期"?"text-amber-700":e.status==="未设置"?"text-muted-foreground":"text-emerald-600",at=e=>e<60?`${e} 秒`:e<3600?`${Math.ceil(e/60)} 分钟`:`${(e/3600).toFixed(1)} 小时`,De=e=>e.cooldown_seconds>0?"text-amber-700":e.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",it=e=>{const t=ue(e);return t==="手动禁用"||t==="已过期"?"bg-muted/70":""},Ae=e=>{const t=new Set(b.value);t.has(e)?t.delete(e):t.add(e),b.value=t},dt=()=>{if(Ve.value){b.value=new Set;return}b.value=new Set(P.value.map(e=>e.id))},Bt=(e,t)=>e.id||`account_${t+1}`,ut=async()=>(await h.getConfig()).accounts.map((t,o)=>({...t,id:Bt(t,o)})),ct=e=>`${e.time} [${e.level}] ${e.message}`,Nt=(e,t)=>{let o=-1;for(let c=0;c<e.length;c+=1)if(e[c].id===t){o=c;break}if(o===-1)return f.value="未找到对应账号配置。",!1;const i=e[o];return _.value={id:i.id,secure_c_ses:i.secure_c_ses,csesidx:i.csesidx,config_id:i.config_id,host_c_oses:i.host_c_oses,expires_at:i.expires_at},qe.value=e,_e.value=o,le.value=!0,!0},ft=async e=>{f.value="";try{const t=await ut();Nt(t,e)}catch(t){f.value=t.message||"加载账号配置失败"}},Ut=async()=>{V.value="";try{const e=await h.getConfig();ne.value=Array.isArray(e.accounts)?e.accounts:[],Z.value=JSON.stringify(pt(ne.value),null,2),D.value=!0,R.value=!0}catch(e){V.value=e.message||"加载账号配置失败"}},Oe=()=>{R.value=!1,V.value="",D.value=!1},vt=()=>{const e=JSON.parse(Z.value);if(!Array.isArray(e))throw new Error("配置格式必须是数组。");return e},zt=e=>typeof e!="string"||!e?e:e.length<=6?`${e.slice(0,2)}****`:`${e.slice(0,3)}****`,pt=e=>{const t=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password","mail_refresh_token","mail_client_id"]);return e.map(o=>{const i={...o};return t.forEach(c=>{const d=i[c];d&&(i[c]=zt(d))}),i})},Pt=()=>{if(V.value="",!D.value){try{ne.value=vt()}catch(e){V.value=e.message||"JSON 格式错误";return}Z.value=JSON.stringify(pt(ne.value),null,2),D.value=!0;return}Z.value=JSON.stringify(ne.value,null,2),D.value=!1},Ft=async()=>{V.value="";try{const e=vt();await k.updateConfig(e),Oe()}catch(e){V.value=e.message||"保存失败"}},Be=()=>{le.value=!1,f.value=""},Kt=async()=>{if(_e.value===null)return;const e=[...qe.value];e[_e.value]={...e[_e.value],id:_.value.id,secure_c_ses:_.value.secure_c_ses,csesidx:_.value.csesidx,config_id:_.value.config_id,host_c_oses:_.value.host_c_oses||void 0,expires_at:_.value.expires_at||void 0};try{await k.updateConfig(e),Be()}catch(t){f.value=t.message||"保存失败"}},Gt=async()=>{await k.bulkEnable(Array.from(b.value)),b.value=new Set},Ht=async()=>{await T.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"})&&(await k.bulkDisable(Array.from(b.value)),b.value=new Set)},Jt=async()=>{await T.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"})&&(await k.bulkDelete(Array.from(b.value)),b.value=new Set)},xt=async e=>{await k.enableAccount(e)},mt=async e=>{await T.ask({title:"禁用账号",message:"确定要禁用该账号吗?"})&&await k.disableAccount(e)},gt=async e=>{await T.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"})&&await k.deleteAccount(e)};let ce=null,fe=null,ve=null,Ee=!1;const q=()=>{ce!==null&&(window.clearInterval(ce),ce=null)},W=()=>{fe!==null&&(window.clearInterval(fe),fe=null)},Yt=()=>{ve!==null&&(window.clearInterval(ve),ve=null),Ee=!1},bt=e=>e==="pending"?"等待中":e==="running"?"执行中":e==="success"?"成功":e==="failed"?"失败":e,yt=async e=>{if(Te(e)){q();return}const t=await h.getRegisterTask(e);if(Te(t.id)){q();return}Me(t),t.status!=="running"&&t.status!=="pending"&&(M.value=!1,q(),await he())},_t=async e=>{if(Se(e)){W();return}const t=await h.getLoginTask(e);if(Se(t.id)){W();return}Ce(t),t.status!=="running"&&t.status!=="pending"&&(C.value=!1,W(),await he())},ht=e=>{q(),ce=window.setInterval(()=>{yt(e).catch(t=>{y.value=t?.message||"注册任务更新失败",q(),M.value=!1})},3e3)},Ne=e=>{W(),fe=window.setInterval(()=>{_t(e).catch(t=>{y.value=t?.message||"刷新任务更新失败",W(),C.value=!1})},3e3)},Qt=()=>{ve===null&&(ve=window.setInterval(async()=>{if(!Ee&&!J.value&&!(ce!==null||fe!==null)&&!(!M.value&&!C.value&&!v.value&&!p.value)){Ee=!0;try{await Ue()}catch(e){y.value=e?.message||"后台刷新失败"}finally{Ee=!1}}},6e3))},Ue=async()=>{try{const e=await h.getRegisterCurrent();e&&"id"in e&&!Te(e.id)&&(Me(e),(e.status==="running"||e.status==="pending")&&(M.value=!0,ht(e.id)))}catch(e){y.value=e.message||"加载注册任务失败"}try{const e=await h.getLoginCurrent();e&&"id"in e&&!Se(e.id)&&(Ce(e),(e.status==="running"||e.status==="pending")&&(C.value=!0,Ne(e.id)))}catch(e){y.value=e.message||"加载刷新任务失败"}},qt=async()=>{y.value="",M.value=!0;try{const e=Number.isFinite(ae.value)&&ae.value>0?ae.value:void 0,t=await h.startRegister(e);Me(t),ht(t.id),me.value=!1,J.value=!0}catch(e){y.value=e.message||"启动注册失败",M.value=!1}},Wt=async()=>{if(b.value.size){y.value="",C.value=!0;try{const e=await h.startLogin(Array.from(b.value));Ce(e),Ne(e.id)}catch(e){y.value=e.message||"启动刷新失败",C.value=!1}}},Xt=async()=>{y.value="",C.value=!0;try{await h.checkLogin();const e=await h.getLoginCurrent();if(e&&"id"in e){Ce(e),Ne(e.id);return}C.value=!1}catch(e){y.value=e.message||"触发刷新失败",C.value=!1}};return(e,t)=>(r(),l(pe,null,[s("div",fs,[s("section",vs,[s("div",ps,[s("div",xs,[E(s("input",{"onUpdate:modelValue":t[0]||(t[0]=o=>re.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[I,re.value]]),K(as,{modelValue:X.value,"onUpdate:modelValue":t[1]||(t[1]=o=>X.value=o),options:Ct},null,8,["modelValue"])]),s("div",ms,[K(xe,{modelValue:Ve.value,"onUpdate:modelValue":dt},{default:kt(()=>[...t[27]||(t[27]=[G(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"已选 "+n(j.value)+" / "+n(P.value.length)+" 个账号",1),s("div",gs,[s("button",{type:"button",class:m(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",H.value==="table"?"bg-accent text-accent-foreground":""]),onClick:t[2]||(t[2]=o=>H.value="table"),"aria-label":"列表视图"},[...t[28]||(t[28]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:m(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",H.value==="card"?"bg-accent text-accent-foreground":""]),onClick:t[3]||(t[3]=o=>H.value="card"),"aria-label":"卡片视图"},[...t[29]||(t[29]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",bs,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:L(oe),onClick:he}," 刷新列表 ",8,ys),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:Ut}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:M.value,onClick:St}," 添加账户 ",8,_s),s("div",{ref_key:"moreActionsRef",ref:Re,class:"relative"},[s("button",{class:m(["flex items-center gap-2 rounded-full border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary",N.value?"bg-accent text-accent-foreground":""]),onClick:Vt},[t[30]||(t[30]=G(" 更多操作 ",-1)),t[31]||(t[31]=s("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M5 7l5 6 5-6H5z"})],-1)),Mt.value?(r(),l("span",{key:0,class:m(["ml-1 h-2 w-2 rounded-full",Ot.value]),"aria-hidden":"true"},null,2)):x("",!0)],2),N.value?(r(),l("div",hs,[s("button",{type:"button",class:"flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm text-foreground transition-colors hover:bg-accent",onClick:t[4]||(t[4]=o=>{Lt(),se()})}," 任务状态 "),t[32]||(t[32]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:m(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",C.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:C.value,onClick:t[5]||(t[5]=o=>{Xt(),se()})}," 刷新过期 ",10,ks),s("button",{type:"button",class:m(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",!j.value||C.value?"cursor-not-allowed text-muted-foreground":"text-foreground hover:bg-accent"]),disabled:!j.value||C.value,onClick:t[6]||(t[6]=o=>{Wt(),se()})}," 刷新选中 ",10,ws),t[33]||(t[33]=s("div",{class:"my-1 border-t border-border/60"},null,-1)),s("button",{type:"button",class:m(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",j.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!j.value,onClick:t[7]||(t[7]=o=>{Gt(),se()})}," 批量启用 ",10,Cs),s("button",{type:"button",class:m(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",j.value?"text-foreground hover:bg-accent":"cursor-not-allowed text-muted-foreground"]),disabled:!j.value,onClick:t[8]||(t[8]=o=>{Ht(),se()})}," 批量禁用 ",10,Ts),s("button",{type:"button",class:m(["flex w-full items-center justify-between rounded-xl px-3 py-2.5 text-left text-sm transition-colors",j.value?"text-destructive hover:bg-destructive/10":"cursor-not-allowed text-muted-foreground"]),disabled:!j.value,onClick:t[9]||(t[9]=o=>{Jt(),se()})}," 批量删除 ",10,Ss)])):x("",!0)],512)]),H.value==="card"?(r(),l("div",As,[(r(!0),l(pe,null,Le(P.value,o=>(r(),l("div",{key:o.id,class:m(["rounded-2xl border border-border bg-card p-4",it(o)]),onClick:i=>Ae(o.id)},[s("div",Is,[s("div",null,[t[34]||(t[34]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",Ls,n(o.id),1)]),s("div",$s,[K(xe,{modelValue:b.value.has(o.id),"onUpdate:modelValue":i=>Ae(o.id),onClick:t[10]||(t[10]=$(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:m(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",ot(o)])},n(ue(o)),3)])]),s("div",Rs,[s("div",null,[t[35]||(t[35]=s("p",null,"剩余时间",-1)),s("p",{class:m(["mt-1 text-sm font-semibold",nt(o)])},n(lt(o.remaining_display)),3),o.expires_at?(r(),l("p",Vs,n(o.expires_at),1)):x("",!0)]),s("div",null,[t[36]||(t[36]=s("p",null,"冷却",-1)),s("p",{class:m(["mt-1",De(o)])},[o.cooldown_seconds>0?(r(),l("span",Ms,n(at(o.cooldown_seconds))+" · "+n(o.cooldown_reason),1)):(r(),l("span",js,n(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[t[37]||(t[37]=s("p",null,"失败数",-1)),s("p",Ds,n(o.error_count),1)]),s("div",null,[t[38]||(t[38]=s("p",null,"会话数",-1)),s("p",Os,n(o.conversation_count),1)])]),s("div",Bs,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:$(i=>ft(o.id),["stop"])}," 编辑 ",8,Ns),rt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[11]||(t[11]=$(()=>{},["stop"])),i=>xt(o.id)]}," 启用 ",8,Us)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[t[12]||(t[12]=$(()=>{},["stop"])),i=>mt(o.id)]}," 禁用 ",8,zs)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[t[13]||(t[13]=$(()=>{},["stop"])),i=>gt(o.id)]}," 删除 ",8,Ps)])],10,Es))),128)),!P.value.length&&!L(oe)?(r(),l("div",Fs," 暂无账号数据,请检查后台配置。 ")):x("",!0)])):(r(),l("div",Ks,[s("table",Gs,[s("thead",Hs,[s("tr",null,[s("th",Js,[K(xe,{modelValue:Ve.value,"onUpdate:modelValue":dt},null,8,["modelValue"])]),t[40]||(t[40]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),t[41]||(t[41]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",Ys,[s("span",Qs,[t[39]||(t[39]=G(" 剩余/过期 ",-1)),K(us,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),t[42]||(t[42]=s("th",{class:"py-3 pr-6"},"冷却",-1)),t[43]||(t[43]=s("th",{class:"py-3 pr-6"},"失败数",-1)),t[44]||(t[44]=s("th",{class:"py-3 pr-6"},"会话数",-1)),t[45]||(t[45]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",qs,[!P.value.length&&!L(oe)?(r(),l("tr",Ws,[...t[46]||(t[46]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):x("",!0),(r(!0),l(pe,null,Le(P.value,o=>(r(),l("tr",{key:o.id,class:m(["border-t border-border",it(o)]),onClick:i=>Ae(o.id)},[s("td",{class:"py-4 pr-4",onClick:t[14]||(t[14]=$(()=>{},["stop"]))},[K(xe,{modelValue:b.value.has(o.id),"onUpdate:modelValue":i=>Ae(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",Zs,n(o.id),1),s("td",eo,[s("span",{class:m(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",ot(o)])},n(ue(o)),3)]),s("td",to,[s("div",{class:m(["text-sm font-semibold",nt(o)])},n(lt(o.remaining_display)),3),o.expires_at?(r(),l("span",so,n(o.expires_at),1)):x("",!0)]),s("td",oo,[o.cooldown_seconds>0?(r(),l("span",{key:0,class:m(De(o))},n(at(o.cooldown_seconds))+" · "+n(o.cooldown_reason),3)):(r(),l("span",{key:1,class:m(De(o))},n(o.cooldown_reason||"无冷却"),3))]),s("td",ro,n(o.error_count),1),s("td",lo,n(o.conversation_count),1),s("td",no,[s("div",ao,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:$(i=>ft(o.id),["stop"])}," 编辑 ",8,io),rt(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:$(i=>xt(o.id),["stop"])}," 启用 ",8,uo)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:$(i=>mt(o.id),["stop"])}," 禁用 ",8,co)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:$(i=>gt(o.id),["stop"])}," 删除 ",8,fo)])])],10,Xs))),128))])])]))])]),K(is,{open:L(T).open.value,title:L(T).title.value,message:L(T).message.value,"confirm-text":L(T).confirmText.value,"cancel-text":L(T).cancelText.value,onConfirm:L(T).confirm,onCancel:L(T).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(r(),Ie($e,{to:"body"},[me.value?(r(),l("div",vo,[s("div",po,[s("div",xo,[s("div",null,[t[47]||(t[47]=s("p",{class:"text-sm font-medium text-foreground"},"添加账户",-1)),s("p",mo,n(O.value==="register"?"创建 DuckMail 账号并自动注册":"批量导入账户配置"),1)]),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:je}," 关闭 ")]),s("div",go,[s("div",bo,[s("div",yo,[s("button",{type:"button",class:m(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",O.value==="register"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[15]||(t[15]=o=>O.value="register")}," 自动注册 ",2),s("button",{type:"button",class:m(["flex-1 rounded-full px-3 py-2 font-medium transition-colors",O.value==="import"?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"]),onClick:t[16]||(t[16]=o=>O.value="import")}," 批量导入 ",2)]),O.value==="register"?(r(),l("div",_o,[t[48]||(t[48]=s("label",{class:"block text-xs text-muted-foreground"},"注册数量",-1)),E(s("input",{"onUpdate:modelValue":t[17]||(t[17]=o=>ae.value=o),type:"number",min:"1",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,ae.value,void 0,{number:!0}]]),t[49]||(t[49]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"}," 默认域名来自设置面板(可在“配置面板”中修改) ",-1))])):(r(),l("div",ho,[t[50]||(t[50]=s("label",{class:"block text-xs text-muted-foreground"},"批量导入(每行一个)",-1)),E(s("textarea",{"onUpdate:modelValue":t[18]||(t[18]=o=>ie.value=o),class:"min-h-[140px] w-full rounded-2xl border border-input bg-background px-3 py-2 text-xs font-mono",placeholder:`duckmail----you@example.com----password
2
+ user@outlook.com----loginPassword----clientId----refreshToken`},null,512),[[I,ie.value]]),t[51]||(t[51]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground"},[s("p",null,"支持两种格式:"),s("p",{class:"mt-1 font-mono"},"duckmail----email----password"),s("p",{class:"mt-1 font-mono"},"email----password----clientId----refreshToken"),s("p",{class:"mt-2 text-[11px]"},"说明:微软格式中的 password 仅用于兼容输入,不会保存或使用。"),s("p",{class:"mt-1 text-[11px]"},"导入后请执行一次“刷新选中”以获取 Cookie。")],-1)),B.value?(r(),l("div",ko,n(B.value),1)):x("",!0)])),t[53]||(t[53]=s("div",{class:"rounded-2xl border border-border bg-muted/30 px-3 py-2 text-[11px] leading-relaxed text-muted-foreground"},[s("div",{class:"space-y-2"},[s("p",{class:"text-xs font-bold text-rose-600"},"⚠️ 严禁滥用:禁止将本工具用于商业用途或任何形式的滥用(无论规模大小)"),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"本工具严禁用于以下行为:")]),s("p",{class:"pl-3"},"• 商业用途或盈利性使用"),s("p",{class:"pl-3"},"• 任何形式的批量操作或自动化滥用(无论规模大小)"),s("p",{class:"pl-3"},"• 破坏市场秩序或恶意竞争"),s("p",{class:"pl-3"},"• 违反 Google 服务条款的任何行为"),s("p",{class:"pl-3"},"• 违反 Microsoft 服务条款的任何行为")]),s("div",{class:"space-y-1"},[s("p",null,[s("strong",null,"违规后果:"),G("滥用行为可能导致账号永久封禁、法律追责,一切后果由使用者自行承担。")])]),s("div",{class:"space-y-1"},[s("p",{class:"font-semibold text-foreground"},"📖 合法用途"),s("p",null,"本项目仅限于以下场景:"),s("p",{class:"pl-3"},"• 个人学习与技术研究"),s("p",{class:"pl-3"},"• 浏览器自动化技术探索"),s("p",{class:"pl-3"},"• 非商业性技术交流")]),s("div",{class:"space-y-1"},[s("p",{class:"font-semibold text-foreground"},"⚖️ 法律责任"),s("p",null,[s("strong",null,"使用者责任:"),G("使用本工具产生的一切后果(包括但不限于账号封禁、数据损失、法律纠纷)由使用者完全承担。")]),s("p",null,[s("strong",null,"合规义务:"),G("使用者必须遵守所在地法律法规及第三方服务条款(包括但不限于 Google Workspace、Microsoft 365 等服务条款)。")]),s("p",null,[s("strong",null,"作者免责:"),G("作者不对任何违规使用、滥用行为或由此产生的后果承担责任。")])]),s("div",{class:"space-y-1"},[s("p",{class:"font-semibold text-foreground"},"📋 技术声明"),s("p",{class:"pl-3"},'• 本项目按"现状"提供,不提供任何形式的担保'),s("p",{class:"pl-3"},"• 依赖的第三方服务(如 DuckMail API、Microsoft Graph API 等)可用性不受作者控制"),s("p",{class:"pl-3"},"• 作者保留随时停止维护、变更功能或关闭项目的权利")])])],-1)),K(xe,{modelValue:de.value,"onUpdate:modelValue":t[19]||(t[19]=o=>de.value=o)},{default:kt(()=>[...t[52]||(t[52]=[G(" 我已阅读并同意上述说明与限制 ",-1)])]),_:1},8,["modelValue"])])]),s("div",wo,[s("div",Co,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:je}," 取消 "),O.value==="register"?(r(),l("button",{key:0,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:M.value||!de.value,onClick:qt}," 开始注册 ",8,To)):(r(),l("button",{key:1,class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",disabled:ge.value||!de.value,onClick:Et}," 导入并保存 ",8,So))])])])])):x("",!0)])),(r(),Ie($e,{to:"body"},[J.value?(r(),l("div",Ao,[s("div",Eo,[s("div",Io,[t[54]||(t[54]=s("div",null,[s("p",{class:"text-sm font-medium text-foreground"},"任务状态"),s("p",{class:"mt-1 text-xs text-muted-foreground"},"注册与刷新任务的状态与日志")],-1)),s("div",Lo,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary hover:text-primary",disabled:!Y.value.length&&!Q.value.length&&!v.value&&!p.value&&!y.value,onClick:Rt}," 清空日志 ",8,$o),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:$t}," 关闭 ")])]),s("div",Ro,[y.value?(r(),l("div",Vo,n(y.value),1)):x("",!0),v.value||p.value?(r(),l("div",Mo,[v.value?(r(),l("div",jo,[t[55]||(t[55]=s("div",{class:"font-medium text-foreground"},"注册任务",-1)),s("div",Do,[s("span",null,"状态:"+n(bt(v.value.status)),1),s("span",null,"进度:"+n(v.value.progress)+"/"+n(v.value.count),1),s("span",null,"成功:"+n(v.value.success_count),1),s("span",null,"失败:"+n(v.value.fail_count),1)])])):x("",!0),p.value?(r(),l("div",Oo,[t[56]||(t[56]=s("div",{class:"font-medium text-foreground"},"刷新任务",-1)),s("div",Bo,[s("span",null,"状态:"+n(bt(p.value.status)),1),s("span",null,"进度:"+n(p.value.progress)+"/"+n(p.value.account_ids.length),1),s("span",null,"成功:"+n(p.value.success_count),1),s("span",null,"失败:"+n(p.value.fail_count),1)])])):x("",!0)])):x("",!0),Y.value.length||Q.value.length?(r(),l("div",No,[s("div",{ref_key:"taskLogsRef",ref:Qe,class:"scrollbar-slim flex-1 overflow-y-auto rounded-2xl border border-border bg-muted/30 p-3"},[Y.value.length?(r(),l("div",Uo,[t[57]||(t[57]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",zo,[(r(!0),l(pe,null,Le(Y.value,(o,i)=>(r(),l("div",{key:`reg-${i}`,class:"font-mono"},n(ct(o)),1))),128))])])):x("",!0),Q.value.length?(r(),l("div",Po,[t[58]||(t[58]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",Fo,[(r(!0),l(pe,null,Le(Q.value,(o,i)=>(r(),l("div",{key:`login-${i}`,class:"font-mono"},n(ct(o)),1))),128))])])):x("",!0)],512)])):x("",!0),!y.value&&!v.value&&!p.value&&!Y.value.length&&!Q.value.length?(r(),l("div",Ko," 暂无任务 ")):x("",!0)])])])):x("",!0)])),(r(),Ie($e,{to:"body"},[le.value?(r(),l("div",Go,[s("div",Ho,[s("div",{class:"flex items-center justify-between"},[t[59]||(t[59]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Be}," 关闭 ")]),f.value?(r(),l("div",Jo,n(f.value),1)):x("",!0),s("div",Yo,[t[60]||(t[60]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),E(s("input",{"onUpdate:modelValue":t[20]||(t[20]=o=>_.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[I,_.value.id]]),t[61]||(t[61]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),E(s("textarea",{"onUpdate:modelValue":t[21]||(t[21]=o=>_.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[I,_.value.secure_c_ses]]),t[62]||(t[62]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),E(s("input",{"onUpdate:modelValue":t[22]||(t[22]=o=>_.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,_.value.csesidx]]),t[63]||(t[63]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),E(s("input",{"onUpdate:modelValue":t[23]||(t[23]=o=>_.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,_.value.config_id]]),t[64]||(t[64]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),E(s("input",{"onUpdate:modelValue":t[24]||(t[24]=o=>_.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[I,_.value.host_c_oses]]),t[65]||(t[65]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),E(s("input",{"onUpdate:modelValue":t[25]||(t[25]=o=>_.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[I,_.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Be}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Kt}," 保存 ")])])])):x("",!0)])),(r(),Ie($e,{to:"body"},[R.value?(r(),l("div",Qo,[s("div",qo,[s("div",Wo,[t[66]||(t[66]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",Xo,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Pt},n(D.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:Oe}," 关闭 ")])]),V.value?(r(),l("div",Zo,n(V.value),1)):x("",!0),s("div",er,[E(s("textarea",{"onUpdate:modelValue":t[26]||(t[26]=o=>Z.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:D.value},null,8,tr),[[I,Z.value]])]),s("div",sr,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:Oe}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Ft,disabled:D.value}," 保存 ",8,or)])])])):x("",!0)]))],64))}});export{ur as default};
static/assets/AppShell-5WTn-3Ed.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as F,l as U,h as y,i as f,q as Z,s as S,c as l,a as e,x as m,y as G,b as d,n as u,F as V,r as $,z as K,t as p,A as w,u as a,R as k,B as O,T as q,p as E,f as A,e as s}from"./index-CDbQWWUi.js";import{u as J}from"./settings-CqbT_C8Q.js";import{_ as Q}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-BA1J4R7-.js";import{u as W}from"./useConfirmDialog-qOidKSEY.js";const X={class:"min-h-screen"},Y={class:"flex min-h-screen flex-col lg:flex-row"},ee={key:0,class:"text-base font-semibold text-foreground"},te={key:0,class:"px-3 pb-2 text-xs uppercase tracking-[0.28em] text-muted-foreground"},re={class:"space-y-1"},oe={"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},se=["d"],ne={key:0,class:"flex-1 min-w-0 truncate"},le={key:1,class:"ml-auto text-xs opacity-0 transition-opacity group-hover:opacity-100"},ae={class:"mt-auto border-t border-border px-6 py-3 lg:py-4"},ie={key:0,class:"rounded-2xl bg-secondary/60 p-3"},de=["title"],ue={class:"min-w-0 flex-1 overflow-hidden lg:ml-0"},pe={class:"min-w-0 flex flex-col gap-4 border-b border-border bg-card/70 px-6 py-5 backdrop-blur lg:flex-row lg:items-center lg:justify-between lg:px-10"},ce={class:"flex items-center gap-3"},xe={class:"text-xl font-semibold text-foreground lg:text-2xl"},fe={class:"flex flex-wrap items-center gap-3"},me={class:"h-full overflow-y-auto overflow-x-hidden bg-card/70 px-4 pb-10 pt-6 backdrop-blur lg:px-10 lg:pt-10"},be={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ge={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},ve={class:"flex items-center justify-between"},he={class:"mt-4 space-y-3 text-sm"},ye={class:"mt-1 flex items-start gap-2"},we={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ke={class:"mt-1 flex items-start gap-2"},_e={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ze={class:"mt-1 flex items-start gap-2"},Ce={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},He={class:"mt-1 rounded-2xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground"},Me={class:"flex flex-wrap gap-2 text-foreground"},Se={class:"mt-1 flex items-start gap-2"},Ve={class:"min-w-0 flex-1 rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},$e={class:"mt-6 flex items-center justify-end"},Ie=F({__name:"AppShell",setup(Ae){const L=E(),b=Z(),j=U(),c=J(),x=y(!1),o=y(!1),i=W(),g=y(!1),_=[{path:"/",label:"概览",icon:"M4 4h7v7H4V4zm9 0h7v4h-7V4zm0 6h7v10h-7V10zM4 13h7v7H4v-7z"},{path:"/accounts",label:"账号管理",icon:"M12 12a3.5 3.5 0 1 0-3.5-3.5A3.5 3.5 0 0 0 12 12zm0 2c-4.1 0-7.5 2.2-7.5 5v1h15v-1c0-2.8-3.4-5-7.5-5z"},{path:"/settings",label:"系统设置",icon:"M4 6h10v2H4V6zm12 0h4v2h-4V6zM4 11h6v2H4v-2zm8 0h8v2h-8v-2zM4 16h10v2H4v-2zm12 0h4v2h-4v-2z"},{path:"/monitor",label:"监控状态",icon:"M3 12h4l2-4 4 8 3-6h5v2h-4l-4 8-4-8-2 4H3v-2z"},{path:"/logs",label:"运行日志",icon:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h10v2H4v-2z"},{path:"/docs",label:"文档中心",icon:"M6 3h9l4 4v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm8 1.5V8h3.5L14 4.5zM8 11h8v2H8v-2zm0 4h8v2H8v-2z"}],B=f(()=>_.find(t=>t.path===b.path)?.label||"概览"),D=n=>{const r=`transition-colors ${o.value?"px-2 justify-center gap-0":"px-3 gap-3"}`;return b.path===n?`${r} bg-primary text-primary-foreground`:`${r} text-muted-foreground hover:bg-accent hover:text-accent-foreground`},I=n=>b.path===n?"bg-primary-foreground/15 text-primary-foreground border-primary-foreground/40":"bg-secondary text-muted-foreground group-hover:text-accent-foreground",v=f(()=>(c.settings?.basic?.base_url||""||window.location.origin).replace(/\/$/,"")),z=f(()=>`${v.value}/v1`),C=f(()=>`${v.value}/v1/chat/completions`),H=f(()=>c.settings?.basic?.api_key||"未设置"),T=["gemini-auto","gemini-2.5-flash","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview"];S(()=>b.path,()=>{x.value=!1});const M=localStorage.getItem("sidebar-collapsed");M&&(o.value=M==="true"),S(o,n=>{localStorage.setItem("sidebar-collapsed",n?"true":"false")});async function N(){await i.ask({title:"退出登录",message:"确定退出管理控制台吗?"})&&(await j.logout(),L.push({name:"login"}))}function P(){window.location.reload()}async function R(){g.value=!0,!c.settings&&!c.isLoading&&await c.loadSettings()}async function h(n){if(n)try{await navigator.clipboard.writeText(n)}catch(t){console.error("Copy failed",t)}}return(n,t)=>(s(),l("div",X,[e("div",Y,[x.value?(s(),l("div",{key:0,class:"fixed inset-0 z-30 bg-black/20 backdrop-blur-sm lg:hidden",onClick:t[0]||(t[0]=r=>x.value=!1)})):d("",!0),e("aside",{class:u(["fixed inset-y-0 left-0 z-40 w-72 -translate-x-full bg-card/90 backdrop-blur-sm lg:backdrop-blur-none border-r border-border transition-[width,transform] duration-200 ease-out will-change-[transform] transform-gpu flex flex-col lg:static lg:translate-x-0 lg:bg-card/80 lg:border-b-0 lg:border-r lg:sticky lg:top-0 lg:h-screen",[{"translate-x-0":x.value,"w-20 lg:w-20":o.value}]])},[e("div",{class:u(["flex h-16 items-center justify-between px-6 pt-4 lg:h-20 lg:pt-5",o.value?"justify-center px-0":""])},[e("div",{class:u(["flex items-center gap-2",o.value?"gap-0 justify-center w-full":""])},[t[9]||(t[9]=e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"text-foreground transition-colors hover:text-primary","aria-label":"GitHub"},[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-6 w-6",fill:"currentColor"},[e("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.166 6.839 9.489.5.09.682-.217.682-.483 0-.237-.009-.868-.014-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.004.071 1.532 1.031 1.532 1.031.892 1.529 2.341 1.087 2.91.832.091-.647.349-1.087.636-1.337-2.22-.253-4.555-1.11-4.555-4.944 0-1.092.39-1.987 1.029-2.687-.103-.253-.446-1.272.098-2.65 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.295 2.748-1.026 2.748-1.026.546 1.378.202 2.397.1 2.65.64.7 1.028 1.595 1.028 2.687 0 3.842-2.338 4.687-4.566 4.936.359.309.678.919.678 1.852 0 1.337-.012 2.418-.012 2.747 0 .268.18.577.688.479A10.002 10.002 0 0 0 22 12c0-5.523-4.477-10-10-10z"})])],-1)),o.value?d("",!0):(s(),l("span",ee,"Gemini Business2API"))],2)],2),e("nav",{class:u(["pb-4 pt-4 lg:pt-6 flex-1 overflow-y-auto",o.value?"px-2":"px-3"])},[o.value?d("",!0):(s(),l("p",te," 导航 ")),e("div",re,[(s(),l(V,null,$(_,r=>m(a(k),{key:r.path,to:r.path,class:u(["group flex items-center rounded-2xl py-2 text-sm font-medium transition-colors overflow-hidden",D(r.path)]),title:o.value?r.label:void 0},{default:w(()=>[e("span",{class:u(["inline-flex h-9 w-9 items-center justify-center rounded-2xl border border-border",I(r.path)])},[(s(),l("svg",oe,[e("path",{d:r.icon},null,8,se)]))],2),o.value?d("",!0):(s(),l("span",ne,p(r.label),1)),o.value?d("",!0):(s(),l("span",le," 进入 "))]),_:2},1032,["to","class","title"])),64))])],2),e("div",ae,[o.value?d("",!0):(s(),l("div",ie,[...t[10]||(t[10]=[e("p",{class:"text-xs tracking-[0.12em] text-muted-foreground"},[e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 transition-colors hover:text-foreground"}," gemini-business2api "),e("span",null," · 声明")],-1),e("p",{class:"mt-2 text-xs text-muted-foreground"}," 本项目仅限学习与研究用途,禁止用于商业用途。请保留本声明、原作者信息与开源来源。 ",-1)])])),e("div",{class:u(["mt-4 flex items-center gap-3",o.value?"justify-center":""])},[o.value?d("",!0):(s(),l("button",{key:0,onClick:N,class:"flex-1 rounded-2xl border border-border bg-background px-4 py-3 text-sm font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:text-destructive"}," 退出登录 ")),e("button",{class:"h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-border text-muted-foreground transition-all hover:border-primary hover:text-primary flex",onClick:t[1]||(t[1]=r=>o.value=!o.value),title:o.value?"展开侧边栏":"收起侧边栏"},[...t[11]||(t[11]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 shrink-0",fill:"currentColor"},[e("path",{d:"M6 4h2v16H6V4zm4 4h8v2h-8V8zm0 6h8v2h-8v-2z"})],-1)])],8,de)],2)])],2),e("main",ue,[e("header",pe,[e("div",ce,[e("button",{class:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-border text-foreground transition-colors hover:border-primary hover:text-primary lg:hidden",onClick:t[2]||(t[2]=r=>x.value=!0),"aria-label":"打开导航"},[...t[12]||(t[12]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},[e("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])]),t[13]||(t[13]=K('<svg aria-hidden="true" viewBox="0 0 130 150" class="logo-mark h-9 w-9 shrink-0 text-foreground"><defs><filter id="head-shadow" x="-50%" y="-50%" width="200%" height="200%"><feDropShadow dx="0" dy="10" stdDeviation="12" flood-color="rgba(0, 188, 212, 0.2)"></feDropShadow></filter></defs><g class="logo-cat-wrapper" transform="translate(0, 12)"><g transform="translate(16, 20) rotate(-10, 9, 12)"><path d="M14 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g transform="translate(96, 20) rotate(10, 9, 12)"><path d="M4 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g filter="url(#head-shadow)"><path d="M 32 40 L 98 40 A 12 12 0 0 1 110 52 L 110 90 A 30 30 0 0 1 80 120 L 50 120 A 30 30 0 0 1 20 90 L 20 52 A 12 12 0 0 1 32 40 Z" fill="rgba(255, 255, 255, 0.9)" stroke="#2c3e50" stroke-width="3"></path></g><rect class="logo-eye" x="35" y="68" width="14" height="4" rx="1"></rect><rect class="logo-eye" x="81" y="68" width="14" height="4" rx="1"></rect></g></svg>',1)),e("h2",xe,p(B.value),1)]),e("div",fe,[e("button",{onClick:P,class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",title:"刷新"}," ��新 "),e("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:R}," 接口信息 "),m(a(k),{to:"/public/uptime",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[14]||(t[14]=[A(" 状态监控 ",-1)])]),_:1}),m(a(k),{to:"/public/logs",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[15]||(t[15]=[A(" 公开日志 ",-1)])]),_:1})])]),e("div",me,[m(a(O))])])]),m(Q,{open:a(i).open.value,title:a(i).title.value,message:a(i).message.value,"confirm-text":a(i).confirmText.value,"cancel-text":a(i).cancelText.value,onConfirm:a(i).confirm,onCancel:a(i).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(s(),G(q,{to:"body"},[g.value?(s(),l("div",be,[e("div",ge,[e("div",ve,[t[16]||(t[16]=e("p",{class:"text-sm font-medium text-foreground"},"API 接口",-1)),e("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:t[3]||(t[3]=r=>g.value=!1)}," 关闭 ")]),t[22]||(t[22]=e("p",{class:"mt-2 text-xs text-muted-foreground"},"根据客户端选择对应接口",-1)),e("div",he,[e("div",null,[t[17]||(t[17]=e("p",{class:"text-xs text-muted-foreground"},"基础端点",-1)),e("div",ye,[e("p",we,p(v.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[4]||(t[4]=r=>h(v.value))}," 复制 ")])]),e("div",null,[t[18]||(t[18]=e("p",{class:"text-xs text-muted-foreground"},"SDK 接口",-1)),e("div",ke,[e("p",_e,p(z.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[5]||(t[5]=r=>h(z.value))}," 复制 ")])]),e("div",null,[t[19]||(t[19]=e("p",{class:"text-xs text-muted-foreground"},"完整接口",-1)),e("div",ze,[e("p",Ce,p(C.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[6]||(t[6]=r=>h(C.value))}," 复制 ")])]),e("div",null,[t[20]||(t[20]=e("p",{class:"text-xs text-muted-foreground"},"支持模型",-1)),e("div",He,[e("div",Me,[(s(),l(V,null,$(T,r=>e("span",{key:r,class:"rounded-full border border-border px-2 py-0.5 text-[11px]"},p(r),1)),64))])])]),e("div",null,[t[21]||(t[21]=e("p",{class:"text-xs text-muted-foreground"},"API 密钥",-1)),e("div",Se,[e("p",Ve,p(H.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[7]||(t[7]=r=>h(H.value))}," 复制 ")])])]),e("div",$e,[e("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:t[8]||(t[8]=r=>g.value=!1)}," 知道了 ")])])])):d("",!0)]))]))}});export{Ie as default};
static/assets/AppShell-78CtCTQC.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as F,l as U,h as y,i as f,q as Z,s as S,c as l,a as e,x as m,y as G,b as d,n as u,F as V,r as $,z as K,t as p,A as w,u as a,R as k,B as O,T as q,p as E,f as A,e as s}from"./index-C9KL0lrc.js";import{u as J}from"./settings-DpDmWAP6.js";import{_ as Q}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-pFdqEtiD.js";import{u as W}from"./useConfirmDialog-DHNXQEiw.js";const X={class:"min-h-screen"},Y={class:"flex min-h-screen flex-col lg:flex-row"},ee={key:0,class:"text-base font-semibold text-foreground"},te={key:0,class:"px-3 pb-2 text-xs uppercase tracking-[0.28em] text-muted-foreground"},re={class:"space-y-1"},oe={"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},se=["d"],ne={key:0,class:"flex-1 min-w-0 truncate"},le={key:1,class:"ml-auto text-xs opacity-0 transition-opacity group-hover:opacity-100"},ae={class:"mt-auto border-t border-border px-6 py-3 lg:py-4"},ie={key:0,class:"rounded-2xl bg-secondary/60 p-3"},de=["title"],ue={class:"min-w-0 flex-1 overflow-hidden lg:ml-0"},pe={class:"min-w-0 flex flex-col gap-4 border-b border-border bg-card/70 px-6 py-5 backdrop-blur lg:flex-row lg:items-center lg:justify-between lg:px-10"},ce={class:"flex items-center gap-3"},xe={class:"text-xl font-semibold text-foreground lg:text-2xl"},fe={class:"flex flex-wrap items-center gap-3"},me={class:"h-full overflow-y-auto overflow-x-hidden bg-card/70 px-4 pb-10 pt-6 backdrop-blur lg:px-10 lg:pt-10"},be={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ge={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},ve={class:"flex items-center justify-between"},he={class:"mt-4 space-y-3 text-sm"},ye={class:"mt-1 flex items-start gap-2"},we={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ke={class:"mt-1 flex items-start gap-2"},_e={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ze={class:"mt-1 flex items-start gap-2"},Ce={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},He={class:"mt-1 rounded-2xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground"},Me={class:"flex flex-wrap gap-2 text-foreground"},Se={class:"mt-1 flex items-start gap-2"},Ve={class:"min-w-0 flex-1 rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},$e={class:"mt-6 flex items-center justify-end"},Ie=F({__name:"AppShell",setup(Ae){const L=E(),b=Z(),j=U(),c=J(),x=y(!1),o=y(!1),i=W(),g=y(!1),_=[{path:"/",label:"概览",icon:"M4 4h7v7H4V4zm9 0h7v4h-7V4zm0 6h7v10h-7V10zM4 13h7v7H4v-7z"},{path:"/accounts",label:"账号管理",icon:"M12 12a3.5 3.5 0 1 0-3.5-3.5A3.5 3.5 0 0 0 12 12zm0 2c-4.1 0-7.5 2.2-7.5 5v1h15v-1c0-2.8-3.4-5-7.5-5z"},{path:"/settings",label:"系统设置",icon:"M4 6h10v2H4V6zm12 0h4v2h-4V6zM4 11h6v2H4v-2zm8 0h8v2h-8v-2zM4 16h10v2H4v-2zm12 0h4v2h-4v-2z"},{path:"/monitor",label:"监控状态",icon:"M3 12h4l2-4 4 8 3-6h5v2h-4l-4 8-4-8-2 4H3v-2z"},{path:"/logs",label:"运行日志",icon:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h10v2H4v-2z"},{path:"/docs",label:"文档中心",icon:"M6 3h9l4 4v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm8 1.5V8h3.5L14 4.5zM8 11h8v2H8v-2zm0 4h8v2H8v-2z"}],B=f(()=>_.find(t=>t.path===b.path)?.label||"概览"),D=n=>{const r=`transition-colors ${o.value?"px-2 justify-center gap-0":"px-3 gap-3"}`;return b.path===n?`${r} bg-primary text-primary-foreground`:`${r} text-muted-foreground hover:bg-accent hover:text-accent-foreground`},I=n=>b.path===n?"bg-primary-foreground/15 text-primary-foreground border-primary-foreground/40":"bg-secondary text-muted-foreground group-hover:text-accent-foreground",v=f(()=>(c.settings?.basic?.base_url||""||window.location.origin).replace(/\/$/,"")),z=f(()=>`${v.value}/v1`),C=f(()=>`${v.value}/v1/chat/completions`),H=f(()=>c.settings?.basic?.api_key||"未设置"),T=["gemini-auto","gemini-2.5-flash","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview"];S(()=>b.path,()=>{x.value=!1});const M=localStorage.getItem("sidebar-collapsed");M&&(o.value=M==="true"),S(o,n=>{localStorage.setItem("sidebar-collapsed",n?"true":"false")});async function N(){await i.ask({title:"退出登录",message:"确定退出管理控制台吗?"})&&(await j.logout(),L.push({name:"login"}))}function P(){window.location.reload()}async function R(){g.value=!0,!c.settings&&!c.isLoading&&await c.loadSettings()}async function h(n){if(n)try{await navigator.clipboard.writeText(n)}catch(t){console.error("Copy failed",t)}}return(n,t)=>(s(),l("div",X,[e("div",Y,[x.value?(s(),l("div",{key:0,class:"fixed inset-0 z-30 bg-black/20 backdrop-blur-sm lg:hidden",onClick:t[0]||(t[0]=r=>x.value=!1)})):d("",!0),e("aside",{class:u(["fixed inset-y-0 left-0 z-40 w-72 -translate-x-full bg-card/90 backdrop-blur-sm lg:backdrop-blur-none border-r border-border transition-transform duration-200 ease-out will-change-[transform] transform-gpu flex flex-col lg:static lg:translate-x-0 lg:bg-card/80 lg:border-b-0 lg:border-r lg:sticky lg:top-0 lg:h-screen",[{"translate-x-0":x.value,"w-20 lg:w-20":o.value}]])},[e("div",{class:u(["flex h-16 items-center justify-between px-6 pt-4 lg:h-20 lg:pt-5",o.value?"justify-center px-0":""])},[e("div",{class:u(["flex items-center gap-2",o.value?"gap-0 justify-center w-full":""])},[t[9]||(t[9]=e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"text-foreground transition-colors hover:text-primary","aria-label":"GitHub"},[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-6 w-6",fill:"currentColor"},[e("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.166 6.839 9.489.5.09.682-.217.682-.483 0-.237-.009-.868-.014-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.004.071 1.532 1.031 1.532 1.031.892 1.529 2.341 1.087 2.91.832.091-.647.349-1.087.636-1.337-2.22-.253-4.555-1.11-4.555-4.944 0-1.092.39-1.987 1.029-2.687-.103-.253-.446-1.272.098-2.65 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.295 2.748-1.026 2.748-1.026.546 1.378.202 2.397.1 2.65.64.7 1.028 1.595 1.028 2.687 0 3.842-2.338 4.687-4.566 4.936.359.309.678.919.678 1.852 0 1.337-.012 2.418-.012 2.747 0 .268.18.577.688.479A10.002 10.002 0 0 0 22 12c0-5.523-4.477-10-10-10z"})])],-1)),o.value?d("",!0):(s(),l("span",ee,"Gemini Business2API"))],2)],2),e("nav",{class:u(["pb-4 pt-4 lg:pt-6 flex-1 overflow-y-auto",o.value?"px-2":"px-3"])},[o.value?d("",!0):(s(),l("p",te," 导航 ")),e("div",re,[(s(),l(V,null,$(_,r=>m(a(k),{key:r.path,to:r.path,class:u(["group flex items-center rounded-2xl py-2 text-sm font-medium transition-colors overflow-hidden",D(r.path)]),title:o.value?r.label:void 0},{default:w(()=>[e("span",{class:u(["inline-flex h-9 w-9 items-center justify-center rounded-2xl border border-border",I(r.path)])},[(s(),l("svg",oe,[e("path",{d:r.icon},null,8,se)]))],2),o.value?d("",!0):(s(),l("span",ne,p(r.label),1)),o.value?d("",!0):(s(),l("span",le," 进入 "))]),_:2},1032,["to","class","title"])),64))])],2),e("div",ae,[o.value?d("",!0):(s(),l("div",ie,[...t[10]||(t[10]=[e("p",{class:"text-xs tracking-[0.12em] text-muted-foreground"},[e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 transition-colors hover:text-foreground"}," gemini-business2api "),e("span",null," · 声明")],-1),e("p",{class:"mt-2 text-xs text-muted-foreground"}," 本项目仅限学习与研究用途,禁止用于商业用途。请保留本声明、原作者信息与开源来源。 ",-1)])])),e("div",{class:u(["mt-4 flex items-center gap-3",o.value?"justify-center":""])},[o.value?d("",!0):(s(),l("button",{key:0,onClick:N,class:"flex-1 rounded-2xl border border-border bg-background px-4 py-3 text-sm font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:text-destructive"}," 退出登录 ")),e("button",{class:"h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-border text-muted-foreground transition-all hover:border-primary hover:text-primary flex",onClick:t[1]||(t[1]=r=>o.value=!o.value),title:o.value?"展开侧边栏":"收起侧边栏"},[...t[11]||(t[11]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 shrink-0",fill:"currentColor"},[e("path",{d:"M6 4h2v16H6V4zm4 4h8v2h-8V8zm0 6h8v2h-8v-2z"})],-1)])],8,de)],2)])],2),e("main",ue,[e("header",pe,[e("div",ce,[e("button",{class:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-border text-foreground transition-colors hover:border-primary hover:text-primary lg:hidden",onClick:t[2]||(t[2]=r=>x.value=!0),"aria-label":"打开导航"},[...t[12]||(t[12]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},[e("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])]),t[13]||(t[13]=K('<svg aria-hidden="true" viewBox="0 0 130 150" class="logo-mark h-9 w-9 shrink-0 text-foreground"><defs><filter id="head-shadow" x="-50%" y="-50%" width="200%" height="200%"><feDropShadow dx="0" dy="10" stdDeviation="12" flood-color="rgba(0, 188, 212, 0.2)"></feDropShadow></filter></defs><g class="logo-cat-wrapper" transform="translate(0, 12)"><g transform="translate(16, 20) rotate(-10, 9, 12)"><path d="M14 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g transform="translate(96, 20) rotate(10, 9, 12)"><path d="M4 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g filter="url(#head-shadow)"><path d="M 32 40 L 98 40 A 12 12 0 0 1 110 52 L 110 90 A 30 30 0 0 1 80 120 L 50 120 A 30 30 0 0 1 20 90 L 20 52 A 12 12 0 0 1 32 40 Z" fill="rgba(255, 255, 255, 0.9)" stroke="#2c3e50" stroke-width="3"></path></g><rect class="logo-eye" x="35" y="68" width="14" height="4" rx="1"></rect><rect class="logo-eye" x="81" y="68" width="14" height="4" rx="1"></rect></g></svg>',1)),e("h2",xe,p(B.value),1)]),e("div",fe,[e("button",{onClick:P,class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",title:"刷新"}," 刷新 "),e("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:R}," 接口信息 "),m(a(k),{to:"/public/uptime",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[14]||(t[14]=[A(" 状态监控 ",-1)])]),_:1}),m(a(k),{to:"/public/logs",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[15]||(t[15]=[A(" 公开日志 ",-1)])]),_:1})])]),e("div",me,[m(a(O))])])]),m(Q,{open:a(i).open.value,title:a(i).title.value,message:a(i).message.value,"confirm-text":a(i).confirmText.value,"cancel-text":a(i).cancelText.value,onConfirm:a(i).confirm,onCancel:a(i).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(s(),G(q,{to:"body"},[g.value?(s(),l("div",be,[e("div",ge,[e("div",ve,[t[16]||(t[16]=e("p",{class:"text-sm font-medium text-foreground"},"API 接口",-1)),e("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:t[3]||(t[3]=r=>g.value=!1)}," 关闭 ")]),t[22]||(t[22]=e("p",{class:"mt-2 text-xs text-muted-foreground"},"根据客户端选择对应接口",-1)),e("div",he,[e("div",null,[t[17]||(t[17]=e("p",{class:"text-xs text-muted-foreground"},"基础端点",-1)),e("div",ye,[e("p",we,p(v.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[4]||(t[4]=r=>h(v.value))}," 复制 ")])]),e("div",null,[t[18]||(t[18]=e("p",{class:"text-xs text-muted-foreground"},"SDK 接口",-1)),e("div",ke,[e("p",_e,p(z.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[5]||(t[5]=r=>h(z.value))}," 复制 ")])]),e("div",null,[t[19]||(t[19]=e("p",{class:"text-xs text-muted-foreground"},"完整接口",-1)),e("div",ze,[e("p",Ce,p(C.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[6]||(t[6]=r=>h(C.value))}," 复制 ")])]),e("div",null,[t[20]||(t[20]=e("p",{class:"text-xs text-muted-foreground"},"支持模型",-1)),e("div",He,[e("div",Me,[(s(),l(V,null,$(T,r=>e("span",{key:r,class:"rounded-full border border-border px-2 py-0.5 text-[11px]"},p(r),1)),64))])])]),e("div",null,[t[21]||(t[21]=e("p",{class:"text-xs text-muted-foreground"},"API 密钥",-1)),e("div",Se,[e("p",Ve,p(H.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[7]||(t[7]=r=>h(H.value))}," 复制 ")])])]),e("div",$e,[e("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:t[8]||(t[8]=r=>g.value=!1)}," 知道了 ")])])])):d("",!0)]))]))}});export{Ie as default};
static/assets/AppShell-8b_m8Zl7.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as F,l as U,h as y,i as f,z as Z,A as S,c as l,a as e,p as m,m as G,b as d,n as u,F as V,r as $,B as K,t as p,s as w,u as a,R as k,C as O,x as E,y as q,f as A,e as s}from"./index-JaBfp01b.js";import{u as J}from"./settings-BHsdlelt.js";import{_ as Q}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-BuSWgV7j.js";import{u as W}from"./useConfirmDialog-BGx3Bidu.js";const X={class:"min-h-screen"},Y={class:"flex min-h-screen flex-col lg:flex-row"},ee={key:0,class:"text-base font-semibold text-foreground"},te={key:0,class:"px-3 pb-2 text-xs uppercase tracking-[0.28em] text-muted-foreground"},re={class:"space-y-1"},oe={"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},se=["d"],ne={key:0,class:"flex-1 min-w-0 truncate"},le={key:1,class:"ml-auto text-xs opacity-0 transition-opacity group-hover:opacity-100"},ae={class:"mt-auto border-t border-border px-6 py-3 lg:py-4"},ie={key:0,class:"rounded-2xl bg-secondary/60 p-3"},de=["title"],ue={class:"min-w-0 flex-1 overflow-hidden lg:ml-0"},pe={class:"min-w-0 flex flex-col gap-4 border-b border-border bg-card/70 px-6 py-5 backdrop-blur lg:flex-row lg:items-center lg:justify-between lg:px-10"},ce={class:"flex items-center gap-3"},xe={class:"text-xl font-semibold text-foreground lg:text-2xl"},fe={class:"flex flex-wrap items-center gap-3"},me={class:"h-full overflow-y-auto overflow-x-hidden bg-card/70 px-4 pb-10 pt-6 backdrop-blur lg:px-10 lg:pt-10"},be={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ge={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},ve={class:"flex items-center justify-between"},he={class:"mt-4 space-y-3 text-sm"},ye={class:"mt-1 flex items-start gap-2"},we={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ke={class:"mt-1 flex items-start gap-2"},_e={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ze={class:"mt-1 flex items-start gap-2"},Ce={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},He={class:"mt-1 rounded-2xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground"},Me={class:"flex flex-wrap gap-2 text-foreground"},Se={class:"mt-1 flex items-start gap-2"},Ve={class:"min-w-0 flex-1 rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},$e={class:"mt-6 flex items-center justify-end"},Ie=F({__name:"AppShell",setup(Ae){const L=q(),b=Z(),j=U(),c=J(),x=y(!1),o=y(!1),i=W(),g=y(!1),_=[{path:"/",label:"概览",icon:"M4 4h7v7H4V4zm9 0h7v4h-7V4zm0 6h7v10h-7V10zM4 13h7v7H4v-7z"},{path:"/accounts",label:"账号管理",icon:"M12 12a3.5 3.5 0 1 0-3.5-3.5A3.5 3.5 0 0 0 12 12zm0 2c-4.1 0-7.5 2.2-7.5 5v1h15v-1c0-2.8-3.4-5-7.5-5z"},{path:"/settings",label:"系统设置",icon:"M4 6h10v2H4V6zm12 0h4v2h-4V6zM4 11h6v2H4v-2zm8 0h8v2h-8v-2zM4 16h10v2H4v-2zm12 0h4v2h-4v-2z"},{path:"/monitor",label:"监控状态",icon:"M3 12h4l2-4 4 8 3-6h5v2h-4l-4 8-4-8-2 4H3v-2z"},{path:"/logs",label:"运行日志",icon:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h10v2H4v-2z"},{path:"/docs",label:"文档中心",icon:"M6 3h9l4 4v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm8 1.5V8h3.5L14 4.5zM8 11h8v2H8v-2zm0 4h8v2H8v-2z"}],B=f(()=>_.find(t=>t.path===b.path)?.label||"概览"),D=n=>{const r=`transition-colors ${o.value?"px-2 justify-center gap-0":"px-3 gap-3"}`;return b.path===n?`${r} bg-primary text-primary-foreground`:`${r} text-muted-foreground hover:bg-accent hover:text-accent-foreground`},I=n=>b.path===n?"bg-primary-foreground/15 text-primary-foreground border-primary-foreground/40":"bg-secondary text-muted-foreground group-hover:text-accent-foreground",v=f(()=>(c.settings?.basic?.base_url||""||window.location.origin).replace(/\/$/,"")),z=f(()=>`${v.value}/v1`),C=f(()=>`${v.value}/v1/chat/completions`),H=f(()=>c.settings?.basic?.api_key||"未设置"),T=["gemini-auto","gemini-2.5-flash","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview"];S(()=>b.path,()=>{x.value=!1});const M=localStorage.getItem("sidebar-collapsed");M&&(o.value=M==="true"),S(o,n=>{localStorage.setItem("sidebar-collapsed",n?"true":"false")});async function N(){await i.ask({title:"退出登录",message:"确定退出管理控制台吗?"})&&(await j.logout(),L.push({name:"login"}))}function P(){window.location.reload()}async function R(){g.value=!0,!c.settings&&!c.isLoading&&await c.loadSettings()}async function h(n){if(n)try{await navigator.clipboard.writeText(n)}catch(t){console.error("Copy failed",t)}}return(n,t)=>(s(),l("div",X,[e("div",Y,[x.value?(s(),l("div",{key:0,class:"fixed inset-0 z-30 bg-black/20 backdrop-blur-sm lg:hidden",onClick:t[0]||(t[0]=r=>x.value=!1)})):d("",!0),e("aside",{class:u(["fixed inset-y-0 left-0 z-40 w-72 -translate-x-full bg-card/90 backdrop-blur-sm lg:backdrop-blur-none border-r border-border transition-[width,transform] duration-200 ease-out will-change-[transform] transform-gpu flex flex-col lg:static lg:translate-x-0 lg:bg-card/80 lg:border-b-0 lg:border-r lg:sticky lg:top-0 lg:h-screen",[{"translate-x-0":x.value,"w-20 lg:w-20":o.value}]])},[e("div",{class:u(["flex h-16 items-center justify-between px-6 pt-4 lg:h-20 lg:pt-5",o.value?"justify-center px-0":""])},[e("div",{class:u(["flex items-center gap-2",o.value?"gap-0 justify-center w-full":""])},[t[9]||(t[9]=e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"text-foreground transition-colors hover:text-primary","aria-label":"GitHub"},[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-6 w-6",fill:"currentColor"},[e("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.166 6.839 9.489.5.09.682-.217.682-.483 0-.237-.009-.868-.014-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.004.071 1.532 1.031 1.532 1.031.892 1.529 2.341 1.087 2.91.832.091-.647.349-1.087.636-1.337-2.22-.253-4.555-1.11-4.555-4.944 0-1.092.39-1.987 1.029-2.687-.103-.253-.446-1.272.098-2.65 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.295 2.748-1.026 2.748-1.026.546 1.378.202 2.397.1 2.65.64.7 1.028 1.595 1.028 2.687 0 3.842-2.338 4.687-4.566 4.936.359.309.678.919.678 1.852 0 1.337-.012 2.418-.012 2.747 0 .268.18.577.688.479A10.002 10.002 0 0 0 22 12c0-5.523-4.477-10-10-10z"})])],-1)),o.value?d("",!0):(s(),l("span",ee,"Gemini Business2API"))],2)],2),e("nav",{class:u(["pb-4 pt-4 lg:pt-6 flex-1 overflow-y-auto",o.value?"px-2":"px-3"])},[o.value?d("",!0):(s(),l("p",te," 导航 ")),e("div",re,[(s(),l(V,null,$(_,r=>m(a(k),{key:r.path,to:r.path,class:u(["group flex items-center rounded-2xl py-2 text-sm font-medium transition-colors overflow-hidden",D(r.path)]),title:o.value?r.label:void 0},{default:w(()=>[e("span",{class:u(["inline-flex h-9 w-9 items-center justify-center rounded-2xl border border-border",I(r.path)])},[(s(),l("svg",oe,[e("path",{d:r.icon},null,8,se)]))],2),o.value?d("",!0):(s(),l("span",ne,p(r.label),1)),o.value?d("",!0):(s(),l("span",le," 进入 "))]),_:2},1032,["to","class","title"])),64))])],2),e("div",ae,[o.value?d("",!0):(s(),l("div",ie,[...t[10]||(t[10]=[e("p",{class:"text-xs tracking-[0.12em] text-muted-foreground"},[e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 transition-colors hover:text-foreground"}," gemini-business2api "),e("span",null," · 声明")],-1),e("p",{class:"mt-2 text-xs text-muted-foreground"}," 本项目仅限学习与研究用途,禁止用于商业用途。请保留本声明、原作者信息与开源来源。 ",-1)])])),e("div",{class:u(["mt-4 flex items-center gap-3",o.value?"justify-center":""])},[o.value?d("",!0):(s(),l("button",{key:0,onClick:N,class:"flex-1 rounded-2xl border border-border bg-background px-4 py-3 text-sm font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:text-destructive"}," 退出登录 ")),e("button",{class:"h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-border text-muted-foreground transition-all hover:border-primary hover:text-primary flex",onClick:t[1]||(t[1]=r=>o.value=!o.value),title:o.value?"展开侧边栏":"收起侧边栏"},[...t[11]||(t[11]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 shrink-0",fill:"currentColor"},[e("path",{d:"M6 4h2v16H6V4zm4 4h8v2h-8V8zm0 6h8v2h-8v-2z"})],-1)])],8,de)],2)])],2),e("main",ue,[e("header",pe,[e("div",ce,[e("button",{class:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-border text-foreground transition-colors hover:border-primary hover:text-primary lg:hidden",onClick:t[2]||(t[2]=r=>x.value=!0),"aria-label":"打开导航"},[...t[12]||(t[12]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},[e("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])]),t[13]||(t[13]=K('<svg aria-hidden="true" viewBox="0 0 130 150" class="logo-mark h-9 w-9 shrink-0 text-foreground"><defs><filter id="head-shadow" x="-50%" y="-50%" width="200%" height="200%"><feDropShadow dx="0" dy="10" stdDeviation="12" flood-color="rgba(0, 188, 212, 0.2)"></feDropShadow></filter></defs><g class="logo-cat-wrapper" transform="translate(0, 12)"><g transform="translate(16, 20) rotate(-10, 9, 12)"><path d="M14 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g transform="translate(96, 20) rotate(10, 9, 12)"><path d="M4 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g filter="url(#head-shadow)"><path d="M 32 40 L 98 40 A 12 12 0 0 1 110 52 L 110 90 A 30 30 0 0 1 80 120 L 50 120 A 30 30 0 0 1 20 90 L 20 52 A 12 12 0 0 1 32 40 Z" fill="rgba(255, 255, 255, 0.9)" stroke="#2c3e50" stroke-width="3"></path></g><rect class="logo-eye" x="35" y="68" width="14" height="4" rx="1"></rect><rect class="logo-eye" x="81" y="68" width="14" height="4" rx="1"></rect></g></svg>',1)),e("h2",xe,p(B.value),1)]),e("div",fe,[e("button",{onClick:P,class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",title:"刷新"}," ��新 "),e("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:R}," 接口信息 "),m(a(k),{to:"/public/uptime",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[14]||(t[14]=[A(" 状态监控 ",-1)])]),_:1}),m(a(k),{to:"/public/logs",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[15]||(t[15]=[A(" 公开日志 ",-1)])]),_:1})])]),e("div",me,[m(a(O))])])]),m(Q,{open:a(i).open.value,title:a(i).title.value,message:a(i).message.value,"confirm-text":a(i).confirmText.value,"cancel-text":a(i).cancelText.value,onConfirm:a(i).confirm,onCancel:a(i).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(s(),G(E,{to:"body"},[g.value?(s(),l("div",be,[e("div",ge,[e("div",ve,[t[16]||(t[16]=e("p",{class:"text-sm font-medium text-foreground"},"API 接口",-1)),e("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:t[3]||(t[3]=r=>g.value=!1)}," 关闭 ")]),t[22]||(t[22]=e("p",{class:"mt-2 text-xs text-muted-foreground"},"根据客户端选择对应接口",-1)),e("div",he,[e("div",null,[t[17]||(t[17]=e("p",{class:"text-xs text-muted-foreground"},"基础端点",-1)),e("div",ye,[e("p",we,p(v.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[4]||(t[4]=r=>h(v.value))}," 复制 ")])]),e("div",null,[t[18]||(t[18]=e("p",{class:"text-xs text-muted-foreground"},"SDK 接口",-1)),e("div",ke,[e("p",_e,p(z.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[5]||(t[5]=r=>h(z.value))}," 复制 ")])]),e("div",null,[t[19]||(t[19]=e("p",{class:"text-xs text-muted-foreground"},"完整接口",-1)),e("div",ze,[e("p",Ce,p(C.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[6]||(t[6]=r=>h(C.value))}," 复制 ")])]),e("div",null,[t[20]||(t[20]=e("p",{class:"text-xs text-muted-foreground"},"支持模型",-1)),e("div",He,[e("div",Me,[(s(),l(V,null,$(T,r=>e("span",{key:r,class:"rounded-full border border-border px-2 py-0.5 text-[11px]"},p(r),1)),64))])])]),e("div",null,[t[21]||(t[21]=e("p",{class:"text-xs text-muted-foreground"},"API 密钥",-1)),e("div",Se,[e("p",Ve,p(H.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[7]||(t[7]=r=>h(H.value))}," 复制 ")])])]),e("div",$e,[e("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:t[8]||(t[8]=r=>g.value=!1)}," 知道了 ")])])])):d("",!0)]))]))}});export{Ie as default};
static/assets/AppShell-B0aV7cPb.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as F,l as U,h as y,i as f,q as Z,s as S,c as l,a as e,x as m,y as G,b as d,n as u,F as V,r as $,z as K,t as p,A as w,u as a,R as k,B as O,T as q,p as E,f as A,e as s}from"./index-DMWZCTlx.js";import{u as J}from"./settings-DXLXVT8l.js";import{_ as Q}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-C75dpm4L.js";import{u as W}from"./useConfirmDialog-BdcqQTU3.js";const X={class:"min-h-screen"},Y={class:"flex min-h-screen flex-col lg:flex-row"},ee={key:0,class:"text-base font-semibold text-foreground"},te={key:0,class:"px-3 pb-2 text-xs uppercase tracking-[0.28em] text-muted-foreground"},re={class:"space-y-1"},oe={"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},se=["d"],ne={key:0,class:"flex-1 min-w-0 truncate"},le={key:1,class:"ml-auto text-xs opacity-0 transition-opacity group-hover:opacity-100"},ae={class:"mt-auto border-t border-border px-6 py-3 lg:py-4"},ie={key:0,class:"rounded-2xl bg-secondary/60 p-3"},de=["title"],ue={class:"min-w-0 flex-1 overflow-hidden lg:ml-0"},pe={class:"min-w-0 flex flex-col gap-4 border-b border-border bg-card/70 px-6 py-5 backdrop-blur lg:flex-row lg:items-center lg:justify-between lg:px-10"},ce={class:"flex items-center gap-3"},xe={class:"text-xl font-semibold text-foreground lg:text-2xl"},fe={class:"flex flex-wrap items-center gap-3"},me={class:"h-full overflow-y-auto overflow-x-hidden bg-card/70 px-4 pb-10 pt-6 backdrop-blur lg:px-10 lg:pt-10"},be={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ge={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},ve={class:"flex items-center justify-between"},he={class:"mt-4 space-y-3 text-sm"},ye={class:"mt-1 flex items-start gap-2"},we={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ke={class:"mt-1 flex items-start gap-2"},_e={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ze={class:"mt-1 flex items-start gap-2"},Ce={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},He={class:"mt-1 rounded-2xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground"},Me={class:"flex flex-wrap gap-2 text-foreground"},Se={class:"mt-1 flex items-start gap-2"},Ve={class:"min-w-0 flex-1 rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},$e={class:"mt-6 flex items-center justify-end"},Ie=F({__name:"AppShell",setup(Ae){const L=E(),b=Z(),j=U(),c=J(),x=y(!1),o=y(!1),i=W(),g=y(!1),_=[{path:"/",label:"概览",icon:"M4 4h7v7H4V4zm9 0h7v4h-7V4zm0 6h7v10h-7V10zM4 13h7v7H4v-7z"},{path:"/accounts",label:"账号管理",icon:"M12 12a3.5 3.5 0 1 0-3.5-3.5A3.5 3.5 0 0 0 12 12zm0 2c-4.1 0-7.5 2.2-7.5 5v1h15v-1c0-2.8-3.4-5-7.5-5z"},{path:"/settings",label:"系统设置",icon:"M4 6h10v2H4V6zm12 0h4v2h-4V6zM4 11h6v2H4v-2zm8 0h8v2h-8v-2zM4 16h10v2H4v-2zm12 0h4v2h-4v-2z"},{path:"/monitor",label:"监控状态",icon:"M3 12h4l2-4 4 8 3-6h5v2h-4l-4 8-4-8-2 4H3v-2z"},{path:"/logs",label:"运行日志",icon:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h10v2H4v-2z"},{path:"/docs",label:"文档中心",icon:"M6 3h9l4 4v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm8 1.5V8h3.5L14 4.5zM8 11h8v2H8v-2zm0 4h8v2H8v-2z"}],B=f(()=>_.find(t=>t.path===b.path)?.label||"概览"),D=n=>{const r=`transition-colors ${o.value?"px-2 justify-center gap-0":"px-3 gap-3"}`;return b.path===n?`${r} bg-primary text-primary-foreground`:`${r} text-muted-foreground hover:bg-accent hover:text-accent-foreground`},I=n=>b.path===n?"bg-primary-foreground/15 text-primary-foreground border-primary-foreground/40":"bg-secondary text-muted-foreground group-hover:text-accent-foreground",v=f(()=>(c.settings?.basic?.base_url||""||window.location.origin).replace(/\/$/,"")),z=f(()=>`${v.value}/v1`),C=f(()=>`${v.value}/v1/chat/completions`),H=f(()=>c.settings?.basic?.api_key||"未设置"),T=["gemini-auto","gemini-2.5-flash","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview"];S(()=>b.path,()=>{x.value=!1});const M=localStorage.getItem("sidebar-collapsed");M&&(o.value=M==="true"),S(o,n=>{localStorage.setItem("sidebar-collapsed",n?"true":"false")});async function N(){await i.ask({title:"退出登录",message:"确定退出管理控制台吗?"})&&(await j.logout(),L.push({name:"login"}))}function P(){window.location.reload()}async function R(){g.value=!0,!c.settings&&!c.isLoading&&await c.loadSettings()}async function h(n){if(n)try{await navigator.clipboard.writeText(n)}catch(t){console.error("Copy failed",t)}}return(n,t)=>(s(),l("div",X,[e("div",Y,[x.value?(s(),l("div",{key:0,class:"fixed inset-0 z-30 bg-black/20 backdrop-blur-sm lg:hidden",onClick:t[0]||(t[0]=r=>x.value=!1)})):d("",!0),e("aside",{class:u(["fixed inset-y-0 left-0 z-40 w-72 -translate-x-full bg-card/90 backdrop-blur-sm lg:backdrop-blur-none border-r border-border transition-[width,transform] duration-200 ease-out will-change-[transform] transform-gpu flex flex-col lg:static lg:translate-x-0 lg:bg-card/80 lg:border-b-0 lg:border-r lg:sticky lg:top-0 lg:h-screen",[{"translate-x-0":x.value,"w-20 lg:w-20":o.value}]])},[e("div",{class:u(["flex h-16 items-center justify-between px-6 pt-4 lg:h-20 lg:pt-5",o.value?"justify-center px-0":""])},[e("div",{class:u(["flex items-center gap-2",o.value?"gap-0 justify-center w-full":""])},[t[9]||(t[9]=e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"text-foreground transition-colors hover:text-primary","aria-label":"GitHub"},[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-6 w-6",fill:"currentColor"},[e("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.166 6.839 9.489.5.09.682-.217.682-.483 0-.237-.009-.868-.014-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.004.071 1.532 1.031 1.532 1.031.892 1.529 2.341 1.087 2.91.832.091-.647.349-1.087.636-1.337-2.22-.253-4.555-1.11-4.555-4.944 0-1.092.39-1.987 1.029-2.687-.103-.253-.446-1.272.098-2.65 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.295 2.748-1.026 2.748-1.026.546 1.378.202 2.397.1 2.65.64.7 1.028 1.595 1.028 2.687 0 3.842-2.338 4.687-4.566 4.936.359.309.678.919.678 1.852 0 1.337-.012 2.418-.012 2.747 0 .268.18.577.688.479A10.002 10.002 0 0 0 22 12c0-5.523-4.477-10-10-10z"})])],-1)),o.value?d("",!0):(s(),l("span",ee,"Gemini Business2API"))],2)],2),e("nav",{class:u(["pb-4 pt-4 lg:pt-6 flex-1 overflow-y-auto",o.value?"px-2":"px-3"])},[o.value?d("",!0):(s(),l("p",te," 导航 ")),e("div",re,[(s(),l(V,null,$(_,r=>m(a(k),{key:r.path,to:r.path,class:u(["group flex items-center rounded-2xl py-2 text-sm font-medium transition-colors overflow-hidden",D(r.path)]),title:o.value?r.label:void 0},{default:w(()=>[e("span",{class:u(["inline-flex h-9 w-9 items-center justify-center rounded-2xl border border-border",I(r.path)])},[(s(),l("svg",oe,[e("path",{d:r.icon},null,8,se)]))],2),o.value?d("",!0):(s(),l("span",ne,p(r.label),1)),o.value?d("",!0):(s(),l("span",le," 进入 "))]),_:2},1032,["to","class","title"])),64))])],2),e("div",ae,[o.value?d("",!0):(s(),l("div",ie,[...t[10]||(t[10]=[e("p",{class:"text-xs tracking-[0.12em] text-muted-foreground"},[e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 transition-colors hover:text-foreground"}," gemini-business2api "),e("span",null," · 声明")],-1),e("p",{class:"mt-2 text-xs text-muted-foreground"}," 本项目仅限学习与研究用途,禁止用于商业用途。请保留本声明、原作者信息与开源来源。 ",-1)])])),e("div",{class:u(["mt-4 flex items-center gap-3",o.value?"justify-center":""])},[o.value?d("",!0):(s(),l("button",{key:0,onClick:N,class:"flex-1 rounded-2xl border border-border bg-background px-4 py-3 text-sm font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:text-destructive"}," 退出登录 ")),e("button",{class:"h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-border text-muted-foreground transition-all hover:border-primary hover:text-primary flex",onClick:t[1]||(t[1]=r=>o.value=!o.value),title:o.value?"展开侧边栏":"收起侧边栏"},[...t[11]||(t[11]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 shrink-0",fill:"currentColor"},[e("path",{d:"M6 4h2v16H6V4zm4 4h8v2h-8V8zm0 6h8v2h-8v-2z"})],-1)])],8,de)],2)])],2),e("main",ue,[e("header",pe,[e("div",ce,[e("button",{class:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-border text-foreground transition-colors hover:border-primary hover:text-primary lg:hidden",onClick:t[2]||(t[2]=r=>x.value=!0),"aria-label":"打开导航"},[...t[12]||(t[12]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},[e("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])]),t[13]||(t[13]=K('<svg aria-hidden="true" viewBox="0 0 130 150" class="logo-mark h-9 w-9 shrink-0 text-foreground"><defs><filter id="head-shadow" x="-50%" y="-50%" width="200%" height="200%"><feDropShadow dx="0" dy="10" stdDeviation="12" flood-color="rgba(0, 188, 212, 0.2)"></feDropShadow></filter></defs><g class="logo-cat-wrapper" transform="translate(0, 12)"><g transform="translate(16, 20) rotate(-10, 9, 12)"><path d="M14 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g transform="translate(96, 20) rotate(10, 9, 12)"><path d="M4 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g filter="url(#head-shadow)"><path d="M 32 40 L 98 40 A 12 12 0 0 1 110 52 L 110 90 A 30 30 0 0 1 80 120 L 50 120 A 30 30 0 0 1 20 90 L 20 52 A 12 12 0 0 1 32 40 Z" fill="rgba(255, 255, 255, 0.9)" stroke="#2c3e50" stroke-width="3"></path></g><rect class="logo-eye" x="35" y="68" width="14" height="4" rx="1"></rect><rect class="logo-eye" x="81" y="68" width="14" height="4" rx="1"></rect></g></svg>',1)),e("h2",xe,p(B.value),1)]),e("div",fe,[e("button",{onClick:P,class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",title:"刷新"}," ��新 "),e("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:R}," 接口信息 "),m(a(k),{to:"/public/uptime",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[14]||(t[14]=[A(" 状态监控 ",-1)])]),_:1}),m(a(k),{to:"/public/logs",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[15]||(t[15]=[A(" 公开日志 ",-1)])]),_:1})])]),e("div",me,[m(a(O))])])]),m(Q,{open:a(i).open.value,title:a(i).title.value,message:a(i).message.value,"confirm-text":a(i).confirmText.value,"cancel-text":a(i).cancelText.value,onConfirm:a(i).confirm,onCancel:a(i).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(s(),G(q,{to:"body"},[g.value?(s(),l("div",be,[e("div",ge,[e("div",ve,[t[16]||(t[16]=e("p",{class:"text-sm font-medium text-foreground"},"API 接口",-1)),e("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:t[3]||(t[3]=r=>g.value=!1)}," 关闭 ")]),t[22]||(t[22]=e("p",{class:"mt-2 text-xs text-muted-foreground"},"根据客户端选择对应接口",-1)),e("div",he,[e("div",null,[t[17]||(t[17]=e("p",{class:"text-xs text-muted-foreground"},"基础端点",-1)),e("div",ye,[e("p",we,p(v.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[4]||(t[4]=r=>h(v.value))}," 复制 ")])]),e("div",null,[t[18]||(t[18]=e("p",{class:"text-xs text-muted-foreground"},"SDK 接口",-1)),e("div",ke,[e("p",_e,p(z.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[5]||(t[5]=r=>h(z.value))}," 复制 ")])]),e("div",null,[t[19]||(t[19]=e("p",{class:"text-xs text-muted-foreground"},"完整接口",-1)),e("div",ze,[e("p",Ce,p(C.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[6]||(t[6]=r=>h(C.value))}," 复制 ")])]),e("div",null,[t[20]||(t[20]=e("p",{class:"text-xs text-muted-foreground"},"支持模型",-1)),e("div",He,[e("div",Me,[(s(),l(V,null,$(T,r=>e("span",{key:r,class:"rounded-full border border-border px-2 py-0.5 text-[11px]"},p(r),1)),64))])])]),e("div",null,[t[21]||(t[21]=e("p",{class:"text-xs text-muted-foreground"},"API 密钥",-1)),e("div",Se,[e("p",Ve,p(H.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[7]||(t[7]=r=>h(H.value))}," 复制 ")])])]),e("div",$e,[e("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:t[8]||(t[8]=r=>g.value=!1)}," 知道了 ")])])])):d("",!0)]))]))}});export{Ie as default};
static/assets/AppShell-B2wCSsyk.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as F,l as U,h as y,i as f,q as Z,s as S,c as l,a as e,x as m,y as G,b as d,n as u,F as V,r as $,z as K,t as p,A as w,u as a,R as k,B as O,T as q,p as E,f as A,e as s}from"./index-Babp7OwB.js";import{u as J}from"./settings-AxgaqgWn.js";import{_ as Q}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-LOlIelGk.js";import{u as W}from"./useConfirmDialog-CVbCTmLz.js";const X={class:"min-h-screen"},Y={class:"flex min-h-screen flex-col lg:flex-row"},ee={key:0,class:"text-base font-semibold text-foreground"},te={key:0,class:"px-3 pb-2 text-xs uppercase tracking-[0.28em] text-muted-foreground"},re={class:"space-y-1"},oe={"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},se=["d"],ne={key:0,class:"flex-1 min-w-0 truncate"},le={key:1,class:"ml-auto text-xs opacity-0 transition-opacity group-hover:opacity-100"},ae={class:"mt-auto border-t border-border px-6 py-3 lg:py-4"},ie={key:0,class:"rounded-2xl bg-secondary/60 p-3"},de=["title"],ue={class:"min-w-0 flex-1 overflow-hidden lg:ml-0"},pe={class:"min-w-0 flex flex-col gap-4 border-b border-border bg-card/70 px-6 py-5 backdrop-blur lg:flex-row lg:items-center lg:justify-between lg:px-10"},ce={class:"flex items-center gap-3"},xe={class:"text-xl font-semibold text-foreground lg:text-2xl"},fe={class:"flex flex-wrap items-center gap-3"},me={class:"h-full overflow-y-auto overflow-x-hidden bg-card/70 px-4 pb-10 pt-6 backdrop-blur lg:px-10 lg:pt-10"},be={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ge={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},ve={class:"flex items-center justify-between"},he={class:"mt-4 space-y-3 text-sm"},ye={class:"mt-1 flex items-start gap-2"},we={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ke={class:"mt-1 flex items-start gap-2"},_e={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ze={class:"mt-1 flex items-start gap-2"},Ce={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},He={class:"mt-1 rounded-2xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground"},Me={class:"flex flex-wrap gap-2 text-foreground"},Se={class:"mt-1 flex items-start gap-2"},Ve={class:"min-w-0 flex-1 rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},$e={class:"mt-6 flex items-center justify-end"},Ie=F({__name:"AppShell",setup(Ae){const L=E(),b=Z(),j=U(),c=J(),x=y(!1),o=y(!1),i=W(),g=y(!1),_=[{path:"/",label:"概览",icon:"M4 4h7v7H4V4zm9 0h7v4h-7V4zm0 6h7v10h-7V10zM4 13h7v7H4v-7z"},{path:"/accounts",label:"账号管理",icon:"M12 12a3.5 3.5 0 1 0-3.5-3.5A3.5 3.5 0 0 0 12 12zm0 2c-4.1 0-7.5 2.2-7.5 5v1h15v-1c0-2.8-3.4-5-7.5-5z"},{path:"/settings",label:"系统设置",icon:"M4 6h10v2H4V6zm12 0h4v2h-4V6zM4 11h6v2H4v-2zm8 0h8v2h-8v-2zM4 16h10v2H4v-2zm12 0h4v2h-4v-2z"},{path:"/monitor",label:"监控状态",icon:"M3 12h4l2-4 4 8 3-6h5v2h-4l-4 8-4-8-2 4H3v-2z"},{path:"/logs",label:"运行日志",icon:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h10v2H4v-2z"},{path:"/docs",label:"文档中心",icon:"M6 3h9l4 4v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm8 1.5V8h3.5L14 4.5zM8 11h8v2H8v-2zm0 4h8v2H8v-2z"}],B=f(()=>_.find(t=>t.path===b.path)?.label||"概览"),D=n=>{const r=`transition-colors ${o.value?"px-2 justify-center gap-0":"px-3 gap-3"}`;return b.path===n?`${r} bg-primary text-primary-foreground`:`${r} text-muted-foreground hover:bg-accent hover:text-accent-foreground`},I=n=>b.path===n?"bg-primary-foreground/15 text-primary-foreground border-primary-foreground/40":"bg-secondary text-muted-foreground group-hover:text-accent-foreground",v=f(()=>(c.settings?.basic?.base_url||""||window.location.origin).replace(/\/$/,"")),z=f(()=>`${v.value}/v1`),C=f(()=>`${v.value}/v1/chat/completions`),H=f(()=>c.settings?.basic?.api_key||"未设置"),T=["gemini-auto","gemini-2.5-flash","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview"];S(()=>b.path,()=>{x.value=!1});const M=localStorage.getItem("sidebar-collapsed");M&&(o.value=M==="true"),S(o,n=>{localStorage.setItem("sidebar-collapsed",n?"true":"false")});async function N(){await i.ask({title:"退出登录",message:"确定退出管理控制台吗?"})&&(await j.logout(),L.push({name:"login"}))}function P(){window.location.reload()}async function R(){g.value=!0,!c.settings&&!c.isLoading&&await c.loadSettings()}async function h(n){if(n)try{await navigator.clipboard.writeText(n)}catch(t){console.error("Copy failed",t)}}return(n,t)=>(s(),l("div",X,[e("div",Y,[x.value?(s(),l("div",{key:0,class:"fixed inset-0 z-30 bg-black/20 backdrop-blur-sm lg:hidden",onClick:t[0]||(t[0]=r=>x.value=!1)})):d("",!0),e("aside",{class:u(["fixed inset-y-0 left-0 z-40 w-72 -translate-x-full bg-card/90 backdrop-blur-sm lg:backdrop-blur-none border-r border-border transition-transform duration-200 ease-out will-change-[transform] transform-gpu flex flex-col lg:static lg:translate-x-0 lg:bg-card/80 lg:border-b-0 lg:border-r lg:sticky lg:top-0 lg:h-screen",[{"translate-x-0":x.value,"w-20 lg:w-20":o.value}]])},[e("div",{class:u(["flex h-16 items-center justify-between px-6 pt-4 lg:h-20 lg:pt-5",o.value?"justify-center px-0":""])},[e("div",{class:u(["flex items-center gap-2",o.value?"gap-0 justify-center w-full":""])},[t[9]||(t[9]=e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"text-foreground transition-colors hover:text-primary","aria-label":"GitHub"},[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-6 w-6",fill:"currentColor"},[e("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.166 6.839 9.489.5.09.682-.217.682-.483 0-.237-.009-.868-.014-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.004.071 1.532 1.031 1.532 1.031.892 1.529 2.341 1.087 2.91.832.091-.647.349-1.087.636-1.337-2.22-.253-4.555-1.11-4.555-4.944 0-1.092.39-1.987 1.029-2.687-.103-.253-.446-1.272.098-2.65 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.295 2.748-1.026 2.748-1.026.546 1.378.202 2.397.1 2.65.64.7 1.028 1.595 1.028 2.687 0 3.842-2.338 4.687-4.566 4.936.359.309.678.919.678 1.852 0 1.337-.012 2.418-.012 2.747 0 .268.18.577.688.479A10.002 10.002 0 0 0 22 12c0-5.523-4.477-10-10-10z"})])],-1)),o.value?d("",!0):(s(),l("span",ee,"Gemini Business2API"))],2)],2),e("nav",{class:u(["pb-4 pt-4 lg:pt-6 flex-1 overflow-y-auto",o.value?"px-2":"px-3"])},[o.value?d("",!0):(s(),l("p",te," 导航 ")),e("div",re,[(s(),l(V,null,$(_,r=>m(a(k),{key:r.path,to:r.path,class:u(["group flex items-center rounded-2xl py-2 text-sm font-medium transition-colors overflow-hidden",D(r.path)]),title:o.value?r.label:void 0},{default:w(()=>[e("span",{class:u(["inline-flex h-9 w-9 items-center justify-center rounded-2xl border border-border",I(r.path)])},[(s(),l("svg",oe,[e("path",{d:r.icon},null,8,se)]))],2),o.value?d("",!0):(s(),l("span",ne,p(r.label),1)),o.value?d("",!0):(s(),l("span",le," 进入 "))]),_:2},1032,["to","class","title"])),64))])],2),e("div",ae,[o.value?d("",!0):(s(),l("div",ie,[...t[10]||(t[10]=[e("p",{class:"text-xs tracking-[0.12em] text-muted-foreground"},[e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 transition-colors hover:text-foreground"}," gemini-business2api "),e("span",null," · 声明")],-1),e("p",{class:"mt-2 text-xs text-muted-foreground"}," 本项目仅限学习与研究用途,禁止用于商业用途。请保留本声明、原作者信息与开源来源。 ",-1)])])),e("div",{class:u(["mt-4 flex items-center gap-3",o.value?"justify-center":""])},[o.value?d("",!0):(s(),l("button",{key:0,onClick:N,class:"flex-1 rounded-2xl border border-border bg-background px-4 py-3 text-sm font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:text-destructive"}," 退出登录 ")),e("button",{class:"h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-border text-muted-foreground transition-all hover:border-primary hover:text-primary flex",onClick:t[1]||(t[1]=r=>o.value=!o.value),title:o.value?"展开侧边栏":"收起侧边栏"},[...t[11]||(t[11]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 shrink-0",fill:"currentColor"},[e("path",{d:"M6 4h2v16H6V4zm4 4h8v2h-8V8zm0 6h8v2h-8v-2z"})],-1)])],8,de)],2)])],2),e("main",ue,[e("header",pe,[e("div",ce,[e("button",{class:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-border text-foreground transition-colors hover:border-primary hover:text-primary lg:hidden",onClick:t[2]||(t[2]=r=>x.value=!0),"aria-label":"打开导航"},[...t[12]||(t[12]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},[e("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])]),t[13]||(t[13]=K('<svg aria-hidden="true" viewBox="0 0 130 150" class="logo-mark h-9 w-9 shrink-0 text-foreground"><defs><filter id="head-shadow" x="-50%" y="-50%" width="200%" height="200%"><feDropShadow dx="0" dy="10" stdDeviation="12" flood-color="rgba(0, 188, 212, 0.2)"></feDropShadow></filter></defs><g class="logo-cat-wrapper" transform="translate(0, 12)"><g transform="translate(16, 20) rotate(-10, 9, 12)"><path d="M14 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g transform="translate(96, 20) rotate(10, 9, 12)"><path d="M4 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g filter="url(#head-shadow)"><path d="M 32 40 L 98 40 A 12 12 0 0 1 110 52 L 110 90 A 30 30 0 0 1 80 120 L 50 120 A 30 30 0 0 1 20 90 L 20 52 A 12 12 0 0 1 32 40 Z" fill="rgba(255, 255, 255, 0.9)" stroke="#2c3e50" stroke-width="3"></path></g><rect class="logo-eye" x="35" y="68" width="14" height="4" rx="1"></rect><rect class="logo-eye" x="81" y="68" width="14" height="4" rx="1"></rect></g></svg>',1)),e("h2",xe,p(B.value),1)]),e("div",fe,[e("button",{onClick:P,class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",title:"刷新"}," 刷新 "),e("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:R}," 接口信息 "),m(a(k),{to:"/public/uptime",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[14]||(t[14]=[A(" 状态监控 ",-1)])]),_:1}),m(a(k),{to:"/public/logs",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[15]||(t[15]=[A(" 公开日志 ",-1)])]),_:1})])]),e("div",me,[m(a(O))])])]),m(Q,{open:a(i).open.value,title:a(i).title.value,message:a(i).message.value,"confirm-text":a(i).confirmText.value,"cancel-text":a(i).cancelText.value,onConfirm:a(i).confirm,onCancel:a(i).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(s(),G(q,{to:"body"},[g.value?(s(),l("div",be,[e("div",ge,[e("div",ve,[t[16]||(t[16]=e("p",{class:"text-sm font-medium text-foreground"},"API 接口",-1)),e("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:t[3]||(t[3]=r=>g.value=!1)}," 关闭 ")]),t[22]||(t[22]=e("p",{class:"mt-2 text-xs text-muted-foreground"},"根据客户端选择对应接口",-1)),e("div",he,[e("div",null,[t[17]||(t[17]=e("p",{class:"text-xs text-muted-foreground"},"基础端点",-1)),e("div",ye,[e("p",we,p(v.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[4]||(t[4]=r=>h(v.value))}," 复制 ")])]),e("div",null,[t[18]||(t[18]=e("p",{class:"text-xs text-muted-foreground"},"SDK 接口",-1)),e("div",ke,[e("p",_e,p(z.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[5]||(t[5]=r=>h(z.value))}," 复制 ")])]),e("div",null,[t[19]||(t[19]=e("p",{class:"text-xs text-muted-foreground"},"完整接口",-1)),e("div",ze,[e("p",Ce,p(C.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[6]||(t[6]=r=>h(C.value))}," 复制 ")])]),e("div",null,[t[20]||(t[20]=e("p",{class:"text-xs text-muted-foreground"},"支持模型",-1)),e("div",He,[e("div",Me,[(s(),l(V,null,$(T,r=>e("span",{key:r,class:"rounded-full border border-border px-2 py-0.5 text-[11px]"},p(r),1)),64))])])]),e("div",null,[t[21]||(t[21]=e("p",{class:"text-xs text-muted-foreground"},"API 密钥",-1)),e("div",Se,[e("p",Ve,p(H.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[7]||(t[7]=r=>h(H.value))}," 复制 ")])])]),e("div",$e,[e("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:t[8]||(t[8]=r=>g.value=!1)}," 知道了 ")])])])):d("",!0)]))]))}});export{Ie as default};
static/assets/AppShell-B58juTD2.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as F,l as U,h as y,i as f,z as Z,A as S,c as l,a as e,q as m,m as G,b as d,n as u,F as V,r as $,B as K,t as p,s as w,u as a,R as k,C as O,x as q,y as E,f as A,e as s}from"./index-DL4Fp3an.js";import{u as J}from"./settings-oZBOK-or.js";import{_ as Q}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-CWs1-jf0.js";import{u as W}from"./useConfirmDialog-MThy7PVA.js";const X={class:"min-h-screen"},Y={class:"flex min-h-screen flex-col lg:flex-row"},ee={key:0,class:"text-base font-semibold text-foreground"},te={key:0,class:"px-3 pb-2 text-xs uppercase tracking-[0.28em] text-muted-foreground"},re={class:"space-y-1"},oe={"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},se=["d"],ne={key:0,class:"flex-1 min-w-0 truncate"},le={key:1,class:"ml-auto text-xs opacity-0 transition-opacity group-hover:opacity-100"},ae={class:"mt-auto border-t border-border px-6 py-3 lg:py-4"},ie={key:0,class:"rounded-2xl bg-secondary/60 p-3"},de=["title"],ue={class:"min-w-0 flex-1 overflow-hidden lg:ml-0"},pe={class:"min-w-0 flex flex-col gap-4 border-b border-border bg-card/70 px-6 py-5 backdrop-blur lg:flex-row lg:items-center lg:justify-between lg:px-10"},ce={class:"flex items-center gap-3"},xe={class:"text-xl font-semibold text-foreground lg:text-2xl"},fe={class:"flex flex-wrap items-center gap-3"},me={class:"h-full overflow-y-auto overflow-x-hidden bg-card/70 px-4 pb-10 pt-6 backdrop-blur lg:px-10 lg:pt-10"},be={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ge={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},ve={class:"flex items-center justify-between"},he={class:"mt-4 space-y-3 text-sm"},ye={class:"mt-1 flex items-start gap-2"},we={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ke={class:"mt-1 flex items-start gap-2"},_e={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ze={class:"mt-1 flex items-start gap-2"},Ce={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},He={class:"mt-1 rounded-2xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground"},Me={class:"flex flex-wrap gap-2 text-foreground"},Se={class:"mt-1 flex items-start gap-2"},Ve={class:"min-w-0 flex-1 rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},$e={class:"mt-6 flex items-center justify-end"},Ie=F({__name:"AppShell",setup(Ae){const L=E(),b=Z(),j=U(),c=J(),x=y(!1),o=y(!1),i=W(),g=y(!1),_=[{path:"/",label:"概览",icon:"M4 4h7v7H4V4zm9 0h7v4h-7V4zm0 6h7v10h-7V10zM4 13h7v7H4v-7z"},{path:"/accounts",label:"账号管理",icon:"M12 12a3.5 3.5 0 1 0-3.5-3.5A3.5 3.5 0 0 0 12 12zm0 2c-4.1 0-7.5 2.2-7.5 5v1h15v-1c0-2.8-3.4-5-7.5-5z"},{path:"/settings",label:"系统设置",icon:"M4 6h10v2H4V6zm12 0h4v2h-4V6zM4 11h6v2H4v-2zm8 0h8v2h-8v-2zM4 16h10v2H4v-2zm12 0h4v2h-4v-2z"},{path:"/monitor",label:"监控状态",icon:"M3 12h4l2-4 4 8 3-6h5v2h-4l-4 8-4-8-2 4H3v-2z"},{path:"/logs",label:"运行日志",icon:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h10v2H4v-2z"},{path:"/docs",label:"文档中心",icon:"M6 3h9l4 4v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm8 1.5V8h3.5L14 4.5zM8 11h8v2H8v-2zm0 4h8v2H8v-2z"}],B=f(()=>_.find(t=>t.path===b.path)?.label||"概览"),D=n=>{const r=`transition-colors ${o.value?"px-2 justify-center gap-0":"px-3 gap-3"}`;return b.path===n?`${r} bg-primary text-primary-foreground`:`${r} text-muted-foreground hover:bg-accent hover:text-accent-foreground`},I=n=>b.path===n?"bg-primary-foreground/15 text-primary-foreground border-primary-foreground/40":"bg-secondary text-muted-foreground group-hover:text-accent-foreground",v=f(()=>(c.settings?.basic?.base_url||""||window.location.origin).replace(/\/$/,"")),z=f(()=>`${v.value}/v1`),C=f(()=>`${v.value}/v1/chat/completions`),H=f(()=>c.settings?.basic?.api_key||"未设置"),T=["gemini-auto","gemini-2.5-flash","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview"];S(()=>b.path,()=>{x.value=!1});const M=localStorage.getItem("sidebar-collapsed");M&&(o.value=M==="true"),S(o,n=>{localStorage.setItem("sidebar-collapsed",n?"true":"false")});async function N(){await i.ask({title:"退出登录",message:"确定退出管理控制台吗?"})&&(await j.logout(),L.push({name:"login"}))}function P(){window.location.reload()}async function R(){g.value=!0,!c.settings&&!c.isLoading&&await c.loadSettings()}async function h(n){if(n)try{await navigator.clipboard.writeText(n)}catch(t){console.error("Copy failed",t)}}return(n,t)=>(s(),l("div",X,[e("div",Y,[x.value?(s(),l("div",{key:0,class:"fixed inset-0 z-30 bg-black/20 backdrop-blur-sm lg:hidden",onClick:t[0]||(t[0]=r=>x.value=!1)})):d("",!0),e("aside",{class:u(["fixed inset-y-0 left-0 z-40 w-72 -translate-x-full bg-card/90 backdrop-blur-sm lg:backdrop-blur-none border-r border-border transition-[width,transform] duration-200 ease-out will-change-[transform] transform-gpu flex flex-col lg:static lg:translate-x-0 lg:bg-card/80 lg:border-b-0 lg:border-r lg:sticky lg:top-0 lg:h-screen",[{"translate-x-0":x.value,"w-20 lg:w-20":o.value}]])},[e("div",{class:u(["flex h-16 items-center justify-between px-6 pt-4 lg:h-20 lg:pt-5",o.value?"justify-center px-0":""])},[e("div",{class:u(["flex items-center gap-2",o.value?"gap-0 justify-center w-full":""])},[t[9]||(t[9]=e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"text-foreground transition-colors hover:text-primary","aria-label":"GitHub"},[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-6 w-6",fill:"currentColor"},[e("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.166 6.839 9.489.5.09.682-.217.682-.483 0-.237-.009-.868-.014-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.004.071 1.532 1.031 1.532 1.031.892 1.529 2.341 1.087 2.91.832.091-.647.349-1.087.636-1.337-2.22-.253-4.555-1.11-4.555-4.944 0-1.092.39-1.987 1.029-2.687-.103-.253-.446-1.272.098-2.65 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.295 2.748-1.026 2.748-1.026.546 1.378.202 2.397.1 2.65.64.7 1.028 1.595 1.028 2.687 0 3.842-2.338 4.687-4.566 4.936.359.309.678.919.678 1.852 0 1.337-.012 2.418-.012 2.747 0 .268.18.577.688.479A10.002 10.002 0 0 0 22 12c0-5.523-4.477-10-10-10z"})])],-1)),o.value?d("",!0):(s(),l("span",ee,"Gemini Business2API"))],2)],2),e("nav",{class:u(["pb-4 pt-4 lg:pt-6 flex-1 overflow-y-auto",o.value?"px-2":"px-3"])},[o.value?d("",!0):(s(),l("p",te," 导航 ")),e("div",re,[(s(),l(V,null,$(_,r=>m(a(k),{key:r.path,to:r.path,class:u(["group flex items-center rounded-2xl py-2 text-sm font-medium transition-colors overflow-hidden",D(r.path)]),title:o.value?r.label:void 0},{default:w(()=>[e("span",{class:u(["inline-flex h-9 w-9 items-center justify-center rounded-2xl border border-border",I(r.path)])},[(s(),l("svg",oe,[e("path",{d:r.icon},null,8,se)]))],2),o.value?d("",!0):(s(),l("span",ne,p(r.label),1)),o.value?d("",!0):(s(),l("span",le," 进入 "))]),_:2},1032,["to","class","title"])),64))])],2),e("div",ae,[o.value?d("",!0):(s(),l("div",ie,[...t[10]||(t[10]=[e("p",{class:"text-xs tracking-[0.12em] text-muted-foreground"},[e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 transition-colors hover:text-foreground"}," gemini-business2api "),e("span",null," · 声明")],-1),e("p",{class:"mt-2 text-xs text-muted-foreground"}," 本项目仅限学习与研究用途,禁止用于商业用途。请保留本声明、原作者信息与开源来源。 ",-1)])])),e("div",{class:u(["mt-4 flex items-center gap-3",o.value?"justify-center":""])},[o.value?d("",!0):(s(),l("button",{key:0,onClick:N,class:"flex-1 rounded-2xl border border-border bg-background px-4 py-3 text-sm font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:text-destructive"}," 退出登录 ")),e("button",{class:"h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-border text-muted-foreground transition-all hover:border-primary hover:text-primary flex",onClick:t[1]||(t[1]=r=>o.value=!o.value),title:o.value?"展开侧边栏":"收起侧边栏"},[...t[11]||(t[11]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 shrink-0",fill:"currentColor"},[e("path",{d:"M6 4h2v16H6V4zm4 4h8v2h-8V8zm0 6h8v2h-8v-2z"})],-1)])],8,de)],2)])],2),e("main",ue,[e("header",pe,[e("div",ce,[e("button",{class:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-border text-foreground transition-colors hover:border-primary hover:text-primary lg:hidden",onClick:t[2]||(t[2]=r=>x.value=!0),"aria-label":"打开导航"},[...t[12]||(t[12]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},[e("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])]),t[13]||(t[13]=K('<svg aria-hidden="true" viewBox="0 0 130 150" class="logo-mark h-9 w-9 shrink-0 text-foreground"><defs><filter id="head-shadow" x="-50%" y="-50%" width="200%" height="200%"><feDropShadow dx="0" dy="10" stdDeviation="12" flood-color="rgba(0, 188, 212, 0.2)"></feDropShadow></filter></defs><g class="logo-cat-wrapper" transform="translate(0, 12)"><g transform="translate(16, 20) rotate(-10, 9, 12)"><path d="M14 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g transform="translate(96, 20) rotate(10, 9, 12)"><path d="M4 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g filter="url(#head-shadow)"><path d="M 32 40 L 98 40 A 12 12 0 0 1 110 52 L 110 90 A 30 30 0 0 1 80 120 L 50 120 A 30 30 0 0 1 20 90 L 20 52 A 12 12 0 0 1 32 40 Z" fill="rgba(255, 255, 255, 0.9)" stroke="#2c3e50" stroke-width="3"></path></g><rect class="logo-eye" x="35" y="68" width="14" height="4" rx="1"></rect><rect class="logo-eye" x="81" y="68" width="14" height="4" rx="1"></rect></g></svg>',1)),e("h2",xe,p(B.value),1)]),e("div",fe,[e("button",{onClick:P,class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",title:"刷新"}," ��新 "),e("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:R}," 接口信息 "),m(a(k),{to:"/public/uptime",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[14]||(t[14]=[A(" 状态监控 ",-1)])]),_:1}),m(a(k),{to:"/public/logs",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[15]||(t[15]=[A(" 公开日志 ",-1)])]),_:1})])]),e("div",me,[m(a(O))])])]),m(Q,{open:a(i).open.value,title:a(i).title.value,message:a(i).message.value,"confirm-text":a(i).confirmText.value,"cancel-text":a(i).cancelText.value,onConfirm:a(i).confirm,onCancel:a(i).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(s(),G(q,{to:"body"},[g.value?(s(),l("div",be,[e("div",ge,[e("div",ve,[t[16]||(t[16]=e("p",{class:"text-sm font-medium text-foreground"},"API 接口",-1)),e("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:t[3]||(t[3]=r=>g.value=!1)}," 关闭 ")]),t[22]||(t[22]=e("p",{class:"mt-2 text-xs text-muted-foreground"},"根据客户端选择对应接口",-1)),e("div",he,[e("div",null,[t[17]||(t[17]=e("p",{class:"text-xs text-muted-foreground"},"基础端点",-1)),e("div",ye,[e("p",we,p(v.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[4]||(t[4]=r=>h(v.value))}," 复制 ")])]),e("div",null,[t[18]||(t[18]=e("p",{class:"text-xs text-muted-foreground"},"SDK 接口",-1)),e("div",ke,[e("p",_e,p(z.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[5]||(t[5]=r=>h(z.value))}," 复制 ")])]),e("div",null,[t[19]||(t[19]=e("p",{class:"text-xs text-muted-foreground"},"完整接口",-1)),e("div",ze,[e("p",Ce,p(C.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[6]||(t[6]=r=>h(C.value))}," 复制 ")])]),e("div",null,[t[20]||(t[20]=e("p",{class:"text-xs text-muted-foreground"},"支持模型",-1)),e("div",He,[e("div",Me,[(s(),l(V,null,$(T,r=>e("span",{key:r,class:"rounded-full border border-border px-2 py-0.5 text-[11px]"},p(r),1)),64))])])]),e("div",null,[t[21]||(t[21]=e("p",{class:"text-xs text-muted-foreground"},"API 密钥",-1)),e("div",Se,[e("p",Ve,p(H.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[7]||(t[7]=r=>h(H.value))}," 复制 ")])])]),e("div",$e,[e("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:t[8]||(t[8]=r=>g.value=!1)}," 知道了 ")])])])):d("",!0)]))]))}});export{Ie as default};
static/assets/AppShell-BCoBt3vb.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as F,l as U,h as y,i as f,y as Z,z as S,c as l,a as e,p as m,m as G,b as d,n as u,F as V,r as $,A as K,t as p,s as w,u as a,R as k,B as O,T as E,x as q,f as A,e as s}from"./index-Dul9zA0O.js";import{u as J}from"./settings-GoayIAiR.js";import{_ as Q}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-Dx9N8w52.js";import{u as W}from"./useConfirmDialog-Bh7Fog50.js";const X={class:"min-h-screen"},Y={class:"flex min-h-screen flex-col lg:flex-row"},ee={key:0,class:"text-base font-semibold text-foreground"},te={key:0,class:"px-3 pb-2 text-xs uppercase tracking-[0.28em] text-muted-foreground"},re={class:"space-y-1"},oe={"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},se=["d"],ne={key:0,class:"flex-1 min-w-0 truncate"},le={key:1,class:"ml-auto text-xs opacity-0 transition-opacity group-hover:opacity-100"},ae={class:"mt-auto border-t border-border px-6 py-3 lg:py-4"},ie={key:0,class:"rounded-2xl bg-secondary/60 p-3"},de=["title"],ue={class:"min-w-0 flex-1 overflow-hidden lg:ml-0"},pe={class:"min-w-0 flex flex-col gap-4 border-b border-border bg-card/70 px-6 py-5 backdrop-blur lg:flex-row lg:items-center lg:justify-between lg:px-10"},ce={class:"flex items-center gap-3"},xe={class:"text-xl font-semibold text-foreground lg:text-2xl"},fe={class:"flex flex-wrap items-center gap-3"},me={class:"h-full overflow-y-auto overflow-x-hidden bg-card/70 px-4 pb-10 pt-6 backdrop-blur lg:px-10 lg:pt-10"},be={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ge={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},ve={class:"flex items-center justify-between"},he={class:"mt-4 space-y-3 text-sm"},ye={class:"mt-1 flex items-start gap-2"},we={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ke={class:"mt-1 flex items-start gap-2"},_e={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ze={class:"mt-1 flex items-start gap-2"},Ce={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},He={class:"mt-1 rounded-2xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground"},Me={class:"flex flex-wrap gap-2 text-foreground"},Se={class:"mt-1 flex items-start gap-2"},Ve={class:"min-w-0 flex-1 rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},$e={class:"mt-6 flex items-center justify-end"},Ie=F({__name:"AppShell",setup(Ae){const L=q(),b=Z(),j=U(),c=J(),x=y(!1),o=y(!1),i=W(),g=y(!1),_=[{path:"/",label:"概览",icon:"M4 4h7v7H4V4zm9 0h7v4h-7V4zm0 6h7v10h-7V10zM4 13h7v7H4v-7z"},{path:"/accounts",label:"账号管理",icon:"M12 12a3.5 3.5 0 1 0-3.5-3.5A3.5 3.5 0 0 0 12 12zm0 2c-4.1 0-7.5 2.2-7.5 5v1h15v-1c0-2.8-3.4-5-7.5-5z"},{path:"/settings",label:"系统设置",icon:"M4 6h10v2H4V6zm12 0h4v2h-4V6zM4 11h6v2H4v-2zm8 0h8v2h-8v-2zM4 16h10v2H4v-2zm12 0h4v2h-4v-2z"},{path:"/monitor",label:"监控状态",icon:"M3 12h4l2-4 4 8 3-6h5v2h-4l-4 8-4-8-2 4H3v-2z"},{path:"/logs",label:"运行日志",icon:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h10v2H4v-2z"},{path:"/docs",label:"文档中心",icon:"M6 3h9l4 4v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm8 1.5V8h3.5L14 4.5zM8 11h8v2H8v-2zm0 4h8v2H8v-2z"}],B=f(()=>_.find(t=>t.path===b.path)?.label||"概览"),D=n=>{const r=`transition-colors ${o.value?"px-2 justify-center gap-0":"px-3 gap-3"}`;return b.path===n?`${r} bg-primary text-primary-foreground`:`${r} text-muted-foreground hover:bg-accent hover:text-accent-foreground`},I=n=>b.path===n?"bg-primary-foreground/15 text-primary-foreground border-primary-foreground/40":"bg-secondary text-muted-foreground group-hover:text-accent-foreground",v=f(()=>(c.settings?.basic?.base_url||""||window.location.origin).replace(/\/$/,"")),z=f(()=>`${v.value}/v1`),C=f(()=>`${v.value}/v1/chat/completions`),H=f(()=>c.settings?.basic?.api_key||"未设置"),T=["gemini-auto","gemini-2.5-flash","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview"];S(()=>b.path,()=>{x.value=!1});const M=localStorage.getItem("sidebar-collapsed");M&&(o.value=M==="true"),S(o,n=>{localStorage.setItem("sidebar-collapsed",n?"true":"false")});async function N(){await i.ask({title:"退出登录",message:"确定退出管理控制台吗?"})&&(await j.logout(),L.push({name:"login"}))}function P(){window.location.reload()}async function R(){g.value=!0,!c.settings&&!c.isLoading&&await c.loadSettings()}async function h(n){if(n)try{await navigator.clipboard.writeText(n)}catch(t){console.error("Copy failed",t)}}return(n,t)=>(s(),l("div",X,[e("div",Y,[x.value?(s(),l("div",{key:0,class:"fixed inset-0 z-30 bg-black/20 backdrop-blur-sm lg:hidden",onClick:t[0]||(t[0]=r=>x.value=!1)})):d("",!0),e("aside",{class:u(["fixed inset-y-0 left-0 z-40 w-72 -translate-x-full bg-card/90 backdrop-blur-sm lg:backdrop-blur-none border-r border-border transition-[width,transform] duration-200 ease-out will-change-[transform] transform-gpu flex flex-col lg:static lg:translate-x-0 lg:bg-card/80 lg:border-b-0 lg:border-r lg:sticky lg:top-0 lg:h-screen",[{"translate-x-0":x.value,"w-20 lg:w-20":o.value}]])},[e("div",{class:u(["flex h-16 items-center justify-between px-6 pt-4 lg:h-20 lg:pt-5",o.value?"justify-center px-0":""])},[e("div",{class:u(["flex items-center gap-2",o.value?"gap-0 justify-center w-full":""])},[t[9]||(t[9]=e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"text-foreground transition-colors hover:text-primary","aria-label":"GitHub"},[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-6 w-6",fill:"currentColor"},[e("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.166 6.839 9.489.5.09.682-.217.682-.483 0-.237-.009-.868-.014-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.004.071 1.532 1.031 1.532 1.031.892 1.529 2.341 1.087 2.91.832.091-.647.349-1.087.636-1.337-2.22-.253-4.555-1.11-4.555-4.944 0-1.092.39-1.987 1.029-2.687-.103-.253-.446-1.272.098-2.65 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.295 2.748-1.026 2.748-1.026.546 1.378.202 2.397.1 2.65.64.7 1.028 1.595 1.028 2.687 0 3.842-2.338 4.687-4.566 4.936.359.309.678.919.678 1.852 0 1.337-.012 2.418-.012 2.747 0 .268.18.577.688.479A10.002 10.002 0 0 0 22 12c0-5.523-4.477-10-10-10z"})])],-1)),o.value?d("",!0):(s(),l("span",ee,"Gemini Business2API"))],2)],2),e("nav",{class:u(["pb-4 pt-4 lg:pt-6 flex-1 overflow-y-auto",o.value?"px-2":"px-3"])},[o.value?d("",!0):(s(),l("p",te," 导航 ")),e("div",re,[(s(),l(V,null,$(_,r=>m(a(k),{key:r.path,to:r.path,class:u(["group flex items-center rounded-2xl py-2 text-sm font-medium transition-colors overflow-hidden",D(r.path)]),title:o.value?r.label:void 0},{default:w(()=>[e("span",{class:u(["inline-flex h-9 w-9 items-center justify-center rounded-2xl border border-border",I(r.path)])},[(s(),l("svg",oe,[e("path",{d:r.icon},null,8,se)]))],2),o.value?d("",!0):(s(),l("span",ne,p(r.label),1)),o.value?d("",!0):(s(),l("span",le," 进入 "))]),_:2},1032,["to","class","title"])),64))])],2),e("div",ae,[o.value?d("",!0):(s(),l("div",ie,[...t[10]||(t[10]=[e("p",{class:"text-xs tracking-[0.12em] text-muted-foreground"},[e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 transition-colors hover:text-foreground"}," gemini-business2api "),e("span",null," · 声明")],-1),e("p",{class:"mt-2 text-xs text-muted-foreground"}," 本项目仅限学习与研究用途,禁止用于商业用途。请保留本声明、原作者信息与开源来源。 ",-1)])])),e("div",{class:u(["mt-4 flex items-center gap-3",o.value?"justify-center":""])},[o.value?d("",!0):(s(),l("button",{key:0,onClick:N,class:"flex-1 rounded-2xl border border-border bg-background px-4 py-3 text-sm font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:text-destructive"}," 退出登录 ")),e("button",{class:"h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-border text-muted-foreground transition-all hover:border-primary hover:text-primary flex",onClick:t[1]||(t[1]=r=>o.value=!o.value),title:o.value?"展开侧边栏":"收起侧边栏"},[...t[11]||(t[11]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 shrink-0",fill:"currentColor"},[e("path",{d:"M6 4h2v16H6V4zm4 4h8v2h-8V8zm0 6h8v2h-8v-2z"})],-1)])],8,de)],2)])],2),e("main",ue,[e("header",pe,[e("div",ce,[e("button",{class:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-border text-foreground transition-colors hover:border-primary hover:text-primary lg:hidden",onClick:t[2]||(t[2]=r=>x.value=!0),"aria-label":"打开导航"},[...t[12]||(t[12]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},[e("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])]),t[13]||(t[13]=K('<svg aria-hidden="true" viewBox="0 0 130 150" class="logo-mark h-9 w-9 shrink-0 text-foreground"><defs><filter id="head-shadow" x="-50%" y="-50%" width="200%" height="200%"><feDropShadow dx="0" dy="10" stdDeviation="12" flood-color="rgba(0, 188, 212, 0.2)"></feDropShadow></filter></defs><g class="logo-cat-wrapper" transform="translate(0, 12)"><g transform="translate(16, 20) rotate(-10, 9, 12)"><path d="M14 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g transform="translate(96, 20) rotate(10, 9, 12)"><path d="M4 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g filter="url(#head-shadow)"><path d="M 32 40 L 98 40 A 12 12 0 0 1 110 52 L 110 90 A 30 30 0 0 1 80 120 L 50 120 A 30 30 0 0 1 20 90 L 20 52 A 12 12 0 0 1 32 40 Z" fill="rgba(255, 255, 255, 0.9)" stroke="#2c3e50" stroke-width="3"></path></g><rect class="logo-eye" x="35" y="68" width="14" height="4" rx="1"></rect><rect class="logo-eye" x="81" y="68" width="14" height="4" rx="1"></rect></g></svg>',1)),e("h2",xe,p(B.value),1)]),e("div",fe,[e("button",{onClick:P,class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",title:"刷新"}," ��新 "),e("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:R}," 接口信息 "),m(a(k),{to:"/public/uptime",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[14]||(t[14]=[A(" 状态监控 ",-1)])]),_:1}),m(a(k),{to:"/public/logs",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[15]||(t[15]=[A(" 公开日志 ",-1)])]),_:1})])]),e("div",me,[m(a(O))])])]),m(Q,{open:a(i).open.value,title:a(i).title.value,message:a(i).message.value,"confirm-text":a(i).confirmText.value,"cancel-text":a(i).cancelText.value,onConfirm:a(i).confirm,onCancel:a(i).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(s(),G(E,{to:"body"},[g.value?(s(),l("div",be,[e("div",ge,[e("div",ve,[t[16]||(t[16]=e("p",{class:"text-sm font-medium text-foreground"},"API 接口",-1)),e("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:t[3]||(t[3]=r=>g.value=!1)}," 关闭 ")]),t[22]||(t[22]=e("p",{class:"mt-2 text-xs text-muted-foreground"},"根据客户端选择对应接口",-1)),e("div",he,[e("div",null,[t[17]||(t[17]=e("p",{class:"text-xs text-muted-foreground"},"基础端点",-1)),e("div",ye,[e("p",we,p(v.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[4]||(t[4]=r=>h(v.value))}," 复制 ")])]),e("div",null,[t[18]||(t[18]=e("p",{class:"text-xs text-muted-foreground"},"SDK 接口",-1)),e("div",ke,[e("p",_e,p(z.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[5]||(t[5]=r=>h(z.value))}," 复制 ")])]),e("div",null,[t[19]||(t[19]=e("p",{class:"text-xs text-muted-foreground"},"完整接口",-1)),e("div",ze,[e("p",Ce,p(C.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[6]||(t[6]=r=>h(C.value))}," 复制 ")])]),e("div",null,[t[20]||(t[20]=e("p",{class:"text-xs text-muted-foreground"},"支持模型",-1)),e("div",He,[e("div",Me,[(s(),l(V,null,$(T,r=>e("span",{key:r,class:"rounded-full border border-border px-2 py-0.5 text-[11px]"},p(r),1)),64))])])]),e("div",null,[t[21]||(t[21]=e("p",{class:"text-xs text-muted-foreground"},"API 密钥",-1)),e("div",Se,[e("p",Ve,p(H.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[7]||(t[7]=r=>h(H.value))}," 复制 ")])])]),e("div",$e,[e("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:t[8]||(t[8]=r=>g.value=!1)}," 知道了 ")])])])):d("",!0)]))]))}});export{Ie as default};
static/assets/AppShell-BQVnOvTQ.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as F,l as U,h as y,i as f,z as Z,A as S,c as l,a as e,p as m,m as G,b as d,n as u,F as V,r as $,B as K,t as p,s as w,u as a,R as k,C as O,x as E,y as q,f as A,e as s}from"./index-BRM37S6x.js";import{u as J}from"./settings-SJhBKmRs.js";import{_ as Q}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-C9Wgr_sd.js";import{u as W}from"./useConfirmDialog-BaiXrQSU.js";const X={class:"min-h-screen"},Y={class:"flex min-h-screen flex-col lg:flex-row"},ee={key:0,class:"text-base font-semibold text-foreground"},te={key:0,class:"px-3 pb-2 text-xs uppercase tracking-[0.28em] text-muted-foreground"},re={class:"space-y-1"},oe={"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},se=["d"],ne={key:0,class:"flex-1 min-w-0 truncate"},le={key:1,class:"ml-auto text-xs opacity-0 transition-opacity group-hover:opacity-100"},ae={class:"mt-auto border-t border-border px-6 py-3 lg:py-4"},ie={key:0,class:"rounded-2xl bg-secondary/60 p-3"},de=["title"],ue={class:"min-w-0 flex-1 overflow-hidden lg:ml-0"},pe={class:"min-w-0 flex flex-col gap-4 border-b border-border bg-card/70 px-6 py-5 backdrop-blur lg:flex-row lg:items-center lg:justify-between lg:px-10"},ce={class:"flex items-center gap-3"},xe={class:"text-xl font-semibold text-foreground lg:text-2xl"},fe={class:"flex flex-wrap items-center gap-3"},me={class:"h-full overflow-y-auto overflow-x-hidden bg-card/70 px-4 pb-10 pt-6 backdrop-blur lg:px-10 lg:pt-10"},be={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ge={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},ve={class:"flex items-center justify-between"},he={class:"mt-4 space-y-3 text-sm"},ye={class:"mt-1 flex items-start gap-2"},we={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ke={class:"mt-1 flex items-start gap-2"},_e={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ze={class:"mt-1 flex items-start gap-2"},Ce={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},He={class:"mt-1 rounded-2xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground"},Me={class:"flex flex-wrap gap-2 text-foreground"},Se={class:"mt-1 flex items-start gap-2"},Ve={class:"min-w-0 flex-1 rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},$e={class:"mt-6 flex items-center justify-end"},Ie=F({__name:"AppShell",setup(Ae){const L=q(),b=Z(),j=U(),c=J(),x=y(!1),o=y(!1),i=W(),g=y(!1),_=[{path:"/",label:"概览",icon:"M4 4h7v7H4V4zm9 0h7v4h-7V4zm0 6h7v10h-7V10zM4 13h7v7H4v-7z"},{path:"/accounts",label:"账号管理",icon:"M12 12a3.5 3.5 0 1 0-3.5-3.5A3.5 3.5 0 0 0 12 12zm0 2c-4.1 0-7.5 2.2-7.5 5v1h15v-1c0-2.8-3.4-5-7.5-5z"},{path:"/settings",label:"系统设置",icon:"M4 6h10v2H4V6zm12 0h4v2h-4V6zM4 11h6v2H4v-2zm8 0h8v2h-8v-2zM4 16h10v2H4v-2zm12 0h4v2h-4v-2z"},{path:"/monitor",label:"监控状态",icon:"M3 12h4l2-4 4 8 3-6h5v2h-4l-4 8-4-8-2 4H3v-2z"},{path:"/logs",label:"运行日志",icon:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h10v2H4v-2z"},{path:"/docs",label:"文档中心",icon:"M6 3h9l4 4v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm8 1.5V8h3.5L14 4.5zM8 11h8v2H8v-2zm0 4h8v2H8v-2z"}],B=f(()=>_.find(t=>t.path===b.path)?.label||"概览"),D=n=>{const r=`transition-colors ${o.value?"px-2 justify-center gap-0":"px-3 gap-3"}`;return b.path===n?`${r} bg-primary text-primary-foreground`:`${r} text-muted-foreground hover:bg-accent hover:text-accent-foreground`},I=n=>b.path===n?"bg-primary-foreground/15 text-primary-foreground border-primary-foreground/40":"bg-secondary text-muted-foreground group-hover:text-accent-foreground",v=f(()=>(c.settings?.basic?.base_url||""||window.location.origin).replace(/\/$/,"")),z=f(()=>`${v.value}/v1`),C=f(()=>`${v.value}/v1/chat/completions`),H=f(()=>c.settings?.basic?.api_key||"未设置"),T=["gemini-auto","gemini-2.5-flash","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview"];S(()=>b.path,()=>{x.value=!1});const M=localStorage.getItem("sidebar-collapsed");M&&(o.value=M==="true"),S(o,n=>{localStorage.setItem("sidebar-collapsed",n?"true":"false")});async function N(){await i.ask({title:"退出登录",message:"确定退出管理控制台吗?"})&&(await j.logout(),L.push({name:"login"}))}function P(){window.location.reload()}async function R(){g.value=!0,!c.settings&&!c.isLoading&&await c.loadSettings()}async function h(n){if(n)try{await navigator.clipboard.writeText(n)}catch(t){console.error("Copy failed",t)}}return(n,t)=>(s(),l("div",X,[e("div",Y,[x.value?(s(),l("div",{key:0,class:"fixed inset-0 z-30 bg-black/20 backdrop-blur-sm lg:hidden",onClick:t[0]||(t[0]=r=>x.value=!1)})):d("",!0),e("aside",{class:u(["fixed inset-y-0 left-0 z-40 w-72 -translate-x-full bg-card/90 backdrop-blur-sm lg:backdrop-blur-none border-r border-border transition-[width,transform] duration-200 ease-out will-change-[transform] transform-gpu flex flex-col lg:static lg:translate-x-0 lg:bg-card/80 lg:border-b-0 lg:border-r lg:sticky lg:top-0 lg:h-screen",[{"translate-x-0":x.value,"w-20 lg:w-20":o.value}]])},[e("div",{class:u(["flex h-16 items-center justify-between px-6 pt-4 lg:h-20 lg:pt-5",o.value?"justify-center px-0":""])},[e("div",{class:u(["flex items-center gap-2",o.value?"gap-0 justify-center w-full":""])},[t[9]||(t[9]=e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"text-foreground transition-colors hover:text-primary","aria-label":"GitHub"},[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-6 w-6",fill:"currentColor"},[e("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.166 6.839 9.489.5.09.682-.217.682-.483 0-.237-.009-.868-.014-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.004.071 1.532 1.031 1.532 1.031.892 1.529 2.341 1.087 2.91.832.091-.647.349-1.087.636-1.337-2.22-.253-4.555-1.11-4.555-4.944 0-1.092.39-1.987 1.029-2.687-.103-.253-.446-1.272.098-2.65 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.295 2.748-1.026 2.748-1.026.546 1.378.202 2.397.1 2.65.64.7 1.028 1.595 1.028 2.687 0 3.842-2.338 4.687-4.566 4.936.359.309.678.919.678 1.852 0 1.337-.012 2.418-.012 2.747 0 .268.18.577.688.479A10.002 10.002 0 0 0 22 12c0-5.523-4.477-10-10-10z"})])],-1)),o.value?d("",!0):(s(),l("span",ee,"Gemini Business2API"))],2)],2),e("nav",{class:u(["pb-4 pt-4 lg:pt-6 flex-1 overflow-y-auto",o.value?"px-2":"px-3"])},[o.value?d("",!0):(s(),l("p",te," 导航 ")),e("div",re,[(s(),l(V,null,$(_,r=>m(a(k),{key:r.path,to:r.path,class:u(["group flex items-center rounded-2xl py-2 text-sm font-medium transition-colors overflow-hidden",D(r.path)]),title:o.value?r.label:void 0},{default:w(()=>[e("span",{class:u(["inline-flex h-9 w-9 items-center justify-center rounded-2xl border border-border",I(r.path)])},[(s(),l("svg",oe,[e("path",{d:r.icon},null,8,se)]))],2),o.value?d("",!0):(s(),l("span",ne,p(r.label),1)),o.value?d("",!0):(s(),l("span",le," 进入 "))]),_:2},1032,["to","class","title"])),64))])],2),e("div",ae,[o.value?d("",!0):(s(),l("div",ie,[...t[10]||(t[10]=[e("p",{class:"text-xs tracking-[0.12em] text-muted-foreground"},[e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 transition-colors hover:text-foreground"}," gemini-business2api "),e("span",null," · 声明")],-1),e("p",{class:"mt-2 text-xs text-muted-foreground"}," 本项目仅限学习与研究用途,禁止用于商业用途。请保留本声明、原作者信息与开源来源。 ",-1)])])),e("div",{class:u(["mt-4 flex items-center gap-3",o.value?"justify-center":""])},[o.value?d("",!0):(s(),l("button",{key:0,onClick:N,class:"flex-1 rounded-2xl border border-border bg-background px-4 py-3 text-sm font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:text-destructive"}," 退出登录 ")),e("button",{class:"h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-border text-muted-foreground transition-all hover:border-primary hover:text-primary flex",onClick:t[1]||(t[1]=r=>o.value=!o.value),title:o.value?"展开侧边栏":"收起侧边栏"},[...t[11]||(t[11]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 shrink-0",fill:"currentColor"},[e("path",{d:"M6 4h2v16H6V4zm4 4h8v2h-8V8zm0 6h8v2h-8v-2z"})],-1)])],8,de)],2)])],2),e("main",ue,[e("header",pe,[e("div",ce,[e("button",{class:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-border text-foreground transition-colors hover:border-primary hover:text-primary lg:hidden",onClick:t[2]||(t[2]=r=>x.value=!0),"aria-label":"打开导航"},[...t[12]||(t[12]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},[e("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])]),t[13]||(t[13]=K('<svg aria-hidden="true" viewBox="0 0 130 150" class="logo-mark h-9 w-9 shrink-0 text-foreground"><defs><filter id="head-shadow" x="-50%" y="-50%" width="200%" height="200%"><feDropShadow dx="0" dy="10" stdDeviation="12" flood-color="rgba(0, 188, 212, 0.2)"></feDropShadow></filter></defs><g class="logo-cat-wrapper" transform="translate(0, 12)"><g transform="translate(16, 20) rotate(-10, 9, 12)"><path d="M14 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g transform="translate(96, 20) rotate(10, 9, 12)"><path d="M4 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g filter="url(#head-shadow)"><path d="M 32 40 L 98 40 A 12 12 0 0 1 110 52 L 110 90 A 30 30 0 0 1 80 120 L 50 120 A 30 30 0 0 1 20 90 L 20 52 A 12 12 0 0 1 32 40 Z" fill="rgba(255, 255, 255, 0.9)" stroke="#2c3e50" stroke-width="3"></path></g><rect class="logo-eye" x="35" y="68" width="14" height="4" rx="1"></rect><rect class="logo-eye" x="81" y="68" width="14" height="4" rx="1"></rect></g></svg>',1)),e("h2",xe,p(B.value),1)]),e("div",fe,[e("button",{onClick:P,class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",title:"刷新"}," ��新 "),e("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:R}," 接口信息 "),m(a(k),{to:"/public/uptime",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[14]||(t[14]=[A(" 状态监控 ",-1)])]),_:1}),m(a(k),{to:"/public/logs",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[15]||(t[15]=[A(" 公开日志 ",-1)])]),_:1})])]),e("div",me,[m(a(O))])])]),m(Q,{open:a(i).open.value,title:a(i).title.value,message:a(i).message.value,"confirm-text":a(i).confirmText.value,"cancel-text":a(i).cancelText.value,onConfirm:a(i).confirm,onCancel:a(i).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(s(),G(E,{to:"body"},[g.value?(s(),l("div",be,[e("div",ge,[e("div",ve,[t[16]||(t[16]=e("p",{class:"text-sm font-medium text-foreground"},"API 接口",-1)),e("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:t[3]||(t[3]=r=>g.value=!1)}," 关闭 ")]),t[22]||(t[22]=e("p",{class:"mt-2 text-xs text-muted-foreground"},"根据客户端选择对应接口",-1)),e("div",he,[e("div",null,[t[17]||(t[17]=e("p",{class:"text-xs text-muted-foreground"},"基础端点",-1)),e("div",ye,[e("p",we,p(v.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[4]||(t[4]=r=>h(v.value))}," 复制 ")])]),e("div",null,[t[18]||(t[18]=e("p",{class:"text-xs text-muted-foreground"},"SDK 接口",-1)),e("div",ke,[e("p",_e,p(z.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[5]||(t[5]=r=>h(z.value))}," 复制 ")])]),e("div",null,[t[19]||(t[19]=e("p",{class:"text-xs text-muted-foreground"},"完整接口",-1)),e("div",ze,[e("p",Ce,p(C.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[6]||(t[6]=r=>h(C.value))}," 复制 ")])]),e("div",null,[t[20]||(t[20]=e("p",{class:"text-xs text-muted-foreground"},"支持模型",-1)),e("div",He,[e("div",Me,[(s(),l(V,null,$(T,r=>e("span",{key:r,class:"rounded-full border border-border px-2 py-0.5 text-[11px]"},p(r),1)),64))])])]),e("div",null,[t[21]||(t[21]=e("p",{class:"text-xs text-muted-foreground"},"API 密钥",-1)),e("div",Se,[e("p",Ve,p(H.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[7]||(t[7]=r=>h(H.value))}," 复制 ")])])]),e("div",$e,[e("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:t[8]||(t[8]=r=>g.value=!1)}," 知道了 ")])])])):d("",!0)]))]))}});export{Ie as default};
static/assets/AppShell-BbGZjE35.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as F,l as U,h as y,i as f,q as Z,s as S,c as l,a as e,x as m,y as G,b as d,n as u,F as V,r as $,z as K,t as p,A as w,u as a,R as k,B as O,T as q,p as E,f as A,e as s}from"./index-B0A0-QFY.js";import{u as J}from"./settings-MHx3aXRd.js";import{_ as Q}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-Bkr0tSJw.js";import{u as W}from"./useConfirmDialog-BS9rDomX.js";const X={class:"min-h-screen"},Y={class:"flex min-h-screen flex-col lg:flex-row"},ee={key:0,class:"text-base font-semibold text-foreground"},te={key:0,class:"px-3 pb-2 text-xs uppercase tracking-[0.28em] text-muted-foreground"},re={class:"space-y-1"},oe={"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},se=["d"],ne={key:0,class:"flex-1 min-w-0 truncate"},le={key:1,class:"ml-auto text-xs opacity-0 transition-opacity group-hover:opacity-100"},ae={class:"mt-auto border-t border-border px-6 py-3 lg:py-4"},ie={key:0,class:"rounded-2xl bg-secondary/60 p-3"},de=["title"],ue={class:"min-w-0 flex-1 overflow-hidden lg:ml-0"},pe={class:"min-w-0 flex flex-col gap-4 border-b border-border bg-card/70 px-6 py-5 backdrop-blur lg:flex-row lg:items-center lg:justify-between lg:px-10"},ce={class:"flex items-center gap-3"},xe={class:"text-xl font-semibold text-foreground lg:text-2xl"},fe={class:"flex flex-wrap items-center gap-3"},me={class:"h-full overflow-y-auto overflow-x-hidden bg-card/70 px-4 pb-10 pt-6 backdrop-blur lg:px-10 lg:pt-10"},be={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ge={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},ve={class:"flex items-center justify-between"},he={class:"mt-4 space-y-3 text-sm"},ye={class:"mt-1 flex items-start gap-2"},we={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ke={class:"mt-1 flex items-start gap-2"},_e={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ze={class:"mt-1 flex items-start gap-2"},Ce={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},He={class:"mt-1 rounded-2xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground"},Me={class:"flex flex-wrap gap-2 text-foreground"},Se={class:"mt-1 flex items-start gap-2"},Ve={class:"min-w-0 flex-1 rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},$e={class:"mt-6 flex items-center justify-end"},Ie=F({__name:"AppShell",setup(Ae){const L=E(),b=Z(),j=U(),c=J(),x=y(!1),o=y(!1),i=W(),g=y(!1),_=[{path:"/",label:"概览",icon:"M4 4h7v7H4V4zm9 0h7v4h-7V4zm0 6h7v10h-7V10zM4 13h7v7H4v-7z"},{path:"/accounts",label:"账号管理",icon:"M12 12a3.5 3.5 0 1 0-3.5-3.5A3.5 3.5 0 0 0 12 12zm0 2c-4.1 0-7.5 2.2-7.5 5v1h15v-1c0-2.8-3.4-5-7.5-5z"},{path:"/settings",label:"系统设置",icon:"M4 6h10v2H4V6zm12 0h4v2h-4V6zM4 11h6v2H4v-2zm8 0h8v2h-8v-2zM4 16h10v2H4v-2zm12 0h4v2h-4v-2z"},{path:"/monitor",label:"监控状态",icon:"M3 12h4l2-4 4 8 3-6h5v2h-4l-4 8-4-8-2 4H3v-2z"},{path:"/logs",label:"运行日志",icon:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h10v2H4v-2z"},{path:"/docs",label:"文档中心",icon:"M6 3h9l4 4v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm8 1.5V8h3.5L14 4.5zM8 11h8v2H8v-2zm0 4h8v2H8v-2z"}],B=f(()=>_.find(t=>t.path===b.path)?.label||"概览"),D=n=>{const r=`transition-colors ${o.value?"px-2 justify-center gap-0":"px-3 gap-3"}`;return b.path===n?`${r} bg-primary text-primary-foreground`:`${r} text-muted-foreground hover:bg-accent hover:text-accent-foreground`},I=n=>b.path===n?"bg-primary-foreground/15 text-primary-foreground border-primary-foreground/40":"bg-secondary text-muted-foreground group-hover:text-accent-foreground",v=f(()=>(c.settings?.basic?.base_url||""||window.location.origin).replace(/\/$/,"")),z=f(()=>`${v.value}/v1`),C=f(()=>`${v.value}/v1/chat/completions`),H=f(()=>c.settings?.basic?.api_key||"未设置"),T=["gemini-auto","gemini-2.5-flash","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview"];S(()=>b.path,()=>{x.value=!1});const M=localStorage.getItem("sidebar-collapsed");M&&(o.value=M==="true"),S(o,n=>{localStorage.setItem("sidebar-collapsed",n?"true":"false")});async function N(){await i.ask({title:"退出登录",message:"确定退出管理控制台吗?"})&&(await j.logout(),L.push({name:"login"}))}function P(){window.location.reload()}async function R(){g.value=!0,!c.settings&&!c.isLoading&&await c.loadSettings()}async function h(n){if(n)try{await navigator.clipboard.writeText(n)}catch(t){console.error("Copy failed",t)}}return(n,t)=>(s(),l("div",X,[e("div",Y,[x.value?(s(),l("div",{key:0,class:"fixed inset-0 z-30 bg-black/20 backdrop-blur-sm lg:hidden",onClick:t[0]||(t[0]=r=>x.value=!1)})):d("",!0),e("aside",{class:u(["fixed inset-y-0 left-0 z-40 w-72 -translate-x-full bg-card/90 backdrop-blur-sm lg:backdrop-blur-none border-r border-border transition-transform duration-200 ease-out will-change-[transform] transform-gpu flex flex-col lg:static lg:translate-x-0 lg:bg-card/80 lg:border-b-0 lg:border-r lg:sticky lg:top-0 lg:h-screen",[{"translate-x-0":x.value,"w-20 lg:w-20":o.value}]])},[e("div",{class:u(["flex h-16 items-center justify-between px-6 pt-4 lg:h-20 lg:pt-5",o.value?"justify-center px-0":""])},[e("div",{class:u(["flex items-center gap-2",o.value?"gap-0 justify-center w-full":""])},[t[9]||(t[9]=e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"text-foreground transition-colors hover:text-primary","aria-label":"GitHub"},[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-6 w-6",fill:"currentColor"},[e("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.166 6.839 9.489.5.09.682-.217.682-.483 0-.237-.009-.868-.014-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.004.071 1.532 1.031 1.532 1.031.892 1.529 2.341 1.087 2.91.832.091-.647.349-1.087.636-1.337-2.22-.253-4.555-1.11-4.555-4.944 0-1.092.39-1.987 1.029-2.687-.103-.253-.446-1.272.098-2.65 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.295 2.748-1.026 2.748-1.026.546 1.378.202 2.397.1 2.65.64.7 1.028 1.595 1.028 2.687 0 3.842-2.338 4.687-4.566 4.936.359.309.678.919.678 1.852 0 1.337-.012 2.418-.012 2.747 0 .268.18.577.688.479A10.002 10.002 0 0 0 22 12c0-5.523-4.477-10-10-10z"})])],-1)),o.value?d("",!0):(s(),l("span",ee,"Gemini Business2API"))],2)],2),e("nav",{class:u(["pb-4 pt-4 lg:pt-6 flex-1 overflow-y-auto",o.value?"px-2":"px-3"])},[o.value?d("",!0):(s(),l("p",te," 导航 ")),e("div",re,[(s(),l(V,null,$(_,r=>m(a(k),{key:r.path,to:r.path,class:u(["group flex items-center rounded-2xl py-2 text-sm font-medium transition-colors overflow-hidden",D(r.path)]),title:o.value?r.label:void 0},{default:w(()=>[e("span",{class:u(["inline-flex h-9 w-9 items-center justify-center rounded-2xl border border-border",I(r.path)])},[(s(),l("svg",oe,[e("path",{d:r.icon},null,8,se)]))],2),o.value?d("",!0):(s(),l("span",ne,p(r.label),1)),o.value?d("",!0):(s(),l("span",le," 进入 "))]),_:2},1032,["to","class","title"])),64))])],2),e("div",ae,[o.value?d("",!0):(s(),l("div",ie,[...t[10]||(t[10]=[e("p",{class:"text-xs tracking-[0.12em] text-muted-foreground"},[e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 transition-colors hover:text-foreground"}," gemini-business2api "),e("span",null," · 声明")],-1),e("p",{class:"mt-2 text-xs text-muted-foreground"}," 本项目仅限学习与研究用途,禁止用于商业用途。请保留本声明、原作者信息与开源来源。 ",-1)])])),e("div",{class:u(["mt-4 flex items-center gap-3",o.value?"justify-center":""])},[o.value?d("",!0):(s(),l("button",{key:0,onClick:N,class:"flex-1 rounded-2xl border border-border bg-background px-4 py-3 text-sm font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:text-destructive"}," 退出登录 ")),e("button",{class:"h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-border text-muted-foreground transition-all hover:border-primary hover:text-primary flex",onClick:t[1]||(t[1]=r=>o.value=!o.value),title:o.value?"展开侧边栏":"收起侧边栏"},[...t[11]||(t[11]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 shrink-0",fill:"currentColor"},[e("path",{d:"M6 4h2v16H6V4zm4 4h8v2h-8V8zm0 6h8v2h-8v-2z"})],-1)])],8,de)],2)])],2),e("main",ue,[e("header",pe,[e("div",ce,[e("button",{class:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-border text-foreground transition-colors hover:border-primary hover:text-primary lg:hidden",onClick:t[2]||(t[2]=r=>x.value=!0),"aria-label":"打开导航"},[...t[12]||(t[12]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},[e("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])]),t[13]||(t[13]=K('<svg aria-hidden="true" viewBox="0 0 130 150" class="logo-mark h-9 w-9 shrink-0 text-foreground"><defs><filter id="head-shadow" x="-50%" y="-50%" width="200%" height="200%"><feDropShadow dx="0" dy="10" stdDeviation="12" flood-color="rgba(0, 188, 212, 0.2)"></feDropShadow></filter></defs><g class="logo-cat-wrapper" transform="translate(0, 12)"><g transform="translate(16, 20) rotate(-10, 9, 12)"><path d="M14 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g transform="translate(96, 20) rotate(10, 9, 12)"><path d="M4 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g filter="url(#head-shadow)"><path d="M 32 40 L 98 40 A 12 12 0 0 1 110 52 L 110 90 A 30 30 0 0 1 80 120 L 50 120 A 30 30 0 0 1 20 90 L 20 52 A 12 12 0 0 1 32 40 Z" fill="rgba(255, 255, 255, 0.9)" stroke="#2c3e50" stroke-width="3"></path></g><rect class="logo-eye" x="35" y="68" width="14" height="4" rx="1"></rect><rect class="logo-eye" x="81" y="68" width="14" height="4" rx="1"></rect></g></svg>',1)),e("h2",xe,p(B.value),1)]),e("div",fe,[e("button",{onClick:P,class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",title:"刷新"}," 刷新 "),e("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:R}," 接口信息 "),m(a(k),{to:"/public/uptime",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[14]||(t[14]=[A(" 状态监控 ",-1)])]),_:1}),m(a(k),{to:"/public/logs",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[15]||(t[15]=[A(" 公开日志 ",-1)])]),_:1})])]),e("div",me,[m(a(O))])])]),m(Q,{open:a(i).open.value,title:a(i).title.value,message:a(i).message.value,"confirm-text":a(i).confirmText.value,"cancel-text":a(i).cancelText.value,onConfirm:a(i).confirm,onCancel:a(i).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(s(),G(q,{to:"body"},[g.value?(s(),l("div",be,[e("div",ge,[e("div",ve,[t[16]||(t[16]=e("p",{class:"text-sm font-medium text-foreground"},"API 接口",-1)),e("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:t[3]||(t[3]=r=>g.value=!1)}," 关闭 ")]),t[22]||(t[22]=e("p",{class:"mt-2 text-xs text-muted-foreground"},"根据客户端选择对应接口",-1)),e("div",he,[e("div",null,[t[17]||(t[17]=e("p",{class:"text-xs text-muted-foreground"},"基础端点",-1)),e("div",ye,[e("p",we,p(v.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[4]||(t[4]=r=>h(v.value))}," 复制 ")])]),e("div",null,[t[18]||(t[18]=e("p",{class:"text-xs text-muted-foreground"},"SDK 接口",-1)),e("div",ke,[e("p",_e,p(z.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[5]||(t[5]=r=>h(z.value))}," 复制 ")])]),e("div",null,[t[19]||(t[19]=e("p",{class:"text-xs text-muted-foreground"},"完整接口",-1)),e("div",ze,[e("p",Ce,p(C.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[6]||(t[6]=r=>h(C.value))}," 复制 ")])]),e("div",null,[t[20]||(t[20]=e("p",{class:"text-xs text-muted-foreground"},"支持模型",-1)),e("div",He,[e("div",Me,[(s(),l(V,null,$(T,r=>e("span",{key:r,class:"rounded-full border border-border px-2 py-0.5 text-[11px]"},p(r),1)),64))])])]),e("div",null,[t[21]||(t[21]=e("p",{class:"text-xs text-muted-foreground"},"API 密钥",-1)),e("div",Se,[e("p",Ve,p(H.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[7]||(t[7]=r=>h(H.value))}," 复制 ")])])]),e("div",$e,[e("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:t[8]||(t[8]=r=>g.value=!1)}," 知道了 ")])])])):d("",!0)]))]))}});export{Ie as default};
static/assets/AppShell-Bk_f20v2.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as F,l as U,h as y,i as f,y as Z,z as S,c as l,a as e,p as m,m as G,b as d,n as u,F as V,r as $,A as K,t as p,s as w,u as a,R as k,B as O,T as E,x as q,f as A,e as s}from"./index-C4edAQLF.js";import{u as J}from"./settings-C6i6OeZ-.js";import{_ as Q}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-DW0P4Bk8.js";import{u as W}from"./useConfirmDialog-wyft8rf-.js";const X={class:"min-h-screen"},Y={class:"flex min-h-screen flex-col lg:flex-row"},ee={key:0,class:"text-base font-semibold text-foreground"},te={key:0,class:"px-3 pb-2 text-xs uppercase tracking-[0.28em] text-muted-foreground"},re={class:"space-y-1"},oe={"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},se=["d"],ne={key:0,class:"flex-1 min-w-0 truncate"},le={key:1,class:"ml-auto text-xs opacity-0 transition-opacity group-hover:opacity-100"},ae={class:"mt-auto border-t border-border px-6 py-3 lg:py-4"},ie={key:0,class:"rounded-2xl bg-secondary/60 p-3"},de=["title"],ue={class:"min-w-0 flex-1 overflow-hidden lg:ml-0"},pe={class:"min-w-0 flex flex-col gap-4 border-b border-border bg-card/70 px-6 py-5 backdrop-blur lg:flex-row lg:items-center lg:justify-between lg:px-10"},ce={class:"flex items-center gap-3"},xe={class:"text-xl font-semibold text-foreground lg:text-2xl"},fe={class:"flex flex-wrap items-center gap-3"},me={class:"h-full overflow-y-auto overflow-x-hidden bg-card/70 px-4 pb-10 pt-6 backdrop-blur lg:px-10 lg:pt-10"},be={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ge={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},ve={class:"flex items-center justify-between"},he={class:"mt-4 space-y-3 text-sm"},ye={class:"mt-1 flex items-start gap-2"},we={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ke={class:"mt-1 flex items-start gap-2"},_e={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ze={class:"mt-1 flex items-start gap-2"},Ce={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},He={class:"mt-1 rounded-2xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground"},Me={class:"flex flex-wrap gap-2 text-foreground"},Se={class:"mt-1 flex items-start gap-2"},Ve={class:"min-w-0 flex-1 rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},$e={class:"mt-6 flex items-center justify-end"},Ie=F({__name:"AppShell",setup(Ae){const L=q(),b=Z(),j=U(),c=J(),x=y(!1),o=y(!1),i=W(),g=y(!1),_=[{path:"/",label:"概览",icon:"M4 4h7v7H4V4zm9 0h7v4h-7V4zm0 6h7v10h-7V10zM4 13h7v7H4v-7z"},{path:"/accounts",label:"账号管理",icon:"M12 12a3.5 3.5 0 1 0-3.5-3.5A3.5 3.5 0 0 0 12 12zm0 2c-4.1 0-7.5 2.2-7.5 5v1h15v-1c0-2.8-3.4-5-7.5-5z"},{path:"/settings",label:"系统设置",icon:"M4 6h10v2H4V6zm12 0h4v2h-4V6zM4 11h6v2H4v-2zm8 0h8v2h-8v-2zM4 16h10v2H4v-2zm12 0h4v2h-4v-2z"},{path:"/monitor",label:"监控状态",icon:"M3 12h4l2-4 4 8 3-6h5v2h-4l-4 8-4-8-2 4H3v-2z"},{path:"/logs",label:"运行日志",icon:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h10v2H4v-2z"},{path:"/docs",label:"文档中心",icon:"M6 3h9l4 4v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm8 1.5V8h3.5L14 4.5zM8 11h8v2H8v-2zm0 4h8v2H8v-2z"}],B=f(()=>_.find(t=>t.path===b.path)?.label||"概览"),D=n=>{const r=`transition-colors ${o.value?"px-2 justify-center gap-0":"px-3 gap-3"}`;return b.path===n?`${r} bg-primary text-primary-foreground`:`${r} text-muted-foreground hover:bg-accent hover:text-accent-foreground`},I=n=>b.path===n?"bg-primary-foreground/15 text-primary-foreground border-primary-foreground/40":"bg-secondary text-muted-foreground group-hover:text-accent-foreground",v=f(()=>(c.settings?.basic?.base_url||""||window.location.origin).replace(/\/$/,"")),z=f(()=>`${v.value}/v1`),C=f(()=>`${v.value}/v1/chat/completions`),H=f(()=>c.settings?.basic?.api_key||"未设置"),T=["gemini-auto","gemini-2.5-flash","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview"];S(()=>b.path,()=>{x.value=!1});const M=localStorage.getItem("sidebar-collapsed");M&&(o.value=M==="true"),S(o,n=>{localStorage.setItem("sidebar-collapsed",n?"true":"false")});async function N(){await i.ask({title:"退出登录",message:"确定退出管理控制台吗?"})&&(await j.logout(),L.push({name:"login"}))}function P(){window.location.reload()}async function R(){g.value=!0,!c.settings&&!c.isLoading&&await c.loadSettings()}async function h(n){if(n)try{await navigator.clipboard.writeText(n)}catch(t){console.error("Copy failed",t)}}return(n,t)=>(s(),l("div",X,[e("div",Y,[x.value?(s(),l("div",{key:0,class:"fixed inset-0 z-30 bg-black/20 backdrop-blur-sm lg:hidden",onClick:t[0]||(t[0]=r=>x.value=!1)})):d("",!0),e("aside",{class:u(["fixed inset-y-0 left-0 z-40 w-72 -translate-x-full bg-card/90 backdrop-blur-sm lg:backdrop-blur-none border-r border-border transition-[width,transform] duration-200 ease-out will-change-[transform] transform-gpu flex flex-col lg:static lg:translate-x-0 lg:bg-card/80 lg:border-b-0 lg:border-r lg:sticky lg:top-0 lg:h-screen",[{"translate-x-0":x.value,"w-20 lg:w-20":o.value}]])},[e("div",{class:u(["flex h-16 items-center justify-between px-6 pt-4 lg:h-20 lg:pt-5",o.value?"justify-center px-0":""])},[e("div",{class:u(["flex items-center gap-2",o.value?"gap-0 justify-center w-full":""])},[t[9]||(t[9]=e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"text-foreground transition-colors hover:text-primary","aria-label":"GitHub"},[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-6 w-6",fill:"currentColor"},[e("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.166 6.839 9.489.5.09.682-.217.682-.483 0-.237-.009-.868-.014-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.004.071 1.532 1.031 1.532 1.031.892 1.529 2.341 1.087 2.91.832.091-.647.349-1.087.636-1.337-2.22-.253-4.555-1.11-4.555-4.944 0-1.092.39-1.987 1.029-2.687-.103-.253-.446-1.272.098-2.65 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.295 2.748-1.026 2.748-1.026.546 1.378.202 2.397.1 2.65.64.7 1.028 1.595 1.028 2.687 0 3.842-2.338 4.687-4.566 4.936.359.309.678.919.678 1.852 0 1.337-.012 2.418-.012 2.747 0 .268.18.577.688.479A10.002 10.002 0 0 0 22 12c0-5.523-4.477-10-10-10z"})])],-1)),o.value?d("",!0):(s(),l("span",ee,"Gemini Business2API"))],2)],2),e("nav",{class:u(["pb-4 pt-4 lg:pt-6 flex-1 overflow-y-auto",o.value?"px-2":"px-3"])},[o.value?d("",!0):(s(),l("p",te," 导航 ")),e("div",re,[(s(),l(V,null,$(_,r=>m(a(k),{key:r.path,to:r.path,class:u(["group flex items-center rounded-2xl py-2 text-sm font-medium transition-colors overflow-hidden",D(r.path)]),title:o.value?r.label:void 0},{default:w(()=>[e("span",{class:u(["inline-flex h-9 w-9 items-center justify-center rounded-2xl border border-border",I(r.path)])},[(s(),l("svg",oe,[e("path",{d:r.icon},null,8,se)]))],2),o.value?d("",!0):(s(),l("span",ne,p(r.label),1)),o.value?d("",!0):(s(),l("span",le," 进入 "))]),_:2},1032,["to","class","title"])),64))])],2),e("div",ae,[o.value?d("",!0):(s(),l("div",ie,[...t[10]||(t[10]=[e("p",{class:"text-xs tracking-[0.12em] text-muted-foreground"},[e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 transition-colors hover:text-foreground"}," gemini-business2api "),e("span",null," · 声明")],-1),e("p",{class:"mt-2 text-xs text-muted-foreground"}," 本项目仅限学习与研究用途,禁止用于商业用途。请保留本声明、原作者信息与开源来源。 ",-1)])])),e("div",{class:u(["mt-4 flex items-center gap-3",o.value?"justify-center":""])},[o.value?d("",!0):(s(),l("button",{key:0,onClick:N,class:"flex-1 rounded-2xl border border-border bg-background px-4 py-3 text-sm font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:text-destructive"}," 退出登录 ")),e("button",{class:"h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-border text-muted-foreground transition-all hover:border-primary hover:text-primary flex",onClick:t[1]||(t[1]=r=>o.value=!o.value),title:o.value?"展开侧边栏":"收起侧边栏"},[...t[11]||(t[11]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 shrink-0",fill:"currentColor"},[e("path",{d:"M6 4h2v16H6V4zm4 4h8v2h-8V8zm0 6h8v2h-8v-2z"})],-1)])],8,de)],2)])],2),e("main",ue,[e("header",pe,[e("div",ce,[e("button",{class:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-border text-foreground transition-colors hover:border-primary hover:text-primary lg:hidden",onClick:t[2]||(t[2]=r=>x.value=!0),"aria-label":"打开导航"},[...t[12]||(t[12]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},[e("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])]),t[13]||(t[13]=K('<svg aria-hidden="true" viewBox="0 0 130 150" class="logo-mark h-9 w-9 shrink-0 text-foreground"><defs><filter id="head-shadow" x="-50%" y="-50%" width="200%" height="200%"><feDropShadow dx="0" dy="10" stdDeviation="12" flood-color="rgba(0, 188, 212, 0.2)"></feDropShadow></filter></defs><g class="logo-cat-wrapper" transform="translate(0, 12)"><g transform="translate(16, 20) rotate(-10, 9, 12)"><path d="M14 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g transform="translate(96, 20) rotate(10, 9, 12)"><path d="M4 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g filter="url(#head-shadow)"><path d="M 32 40 L 98 40 A 12 12 0 0 1 110 52 L 110 90 A 30 30 0 0 1 80 120 L 50 120 A 30 30 0 0 1 20 90 L 20 52 A 12 12 0 0 1 32 40 Z" fill="rgba(255, 255, 255, 0.9)" stroke="#2c3e50" stroke-width="3"></path></g><rect class="logo-eye" x="35" y="68" width="14" height="4" rx="1"></rect><rect class="logo-eye" x="81" y="68" width="14" height="4" rx="1"></rect></g></svg>',1)),e("h2",xe,p(B.value),1)]),e("div",fe,[e("button",{onClick:P,class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",title:"刷新"}," ��新 "),e("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:R}," 接口信息 "),m(a(k),{to:"/public/uptime",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[14]||(t[14]=[A(" 状态监控 ",-1)])]),_:1}),m(a(k),{to:"/public/logs",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[15]||(t[15]=[A(" 公开日志 ",-1)])]),_:1})])]),e("div",me,[m(a(O))])])]),m(Q,{open:a(i).open.value,title:a(i).title.value,message:a(i).message.value,"confirm-text":a(i).confirmText.value,"cancel-text":a(i).cancelText.value,onConfirm:a(i).confirm,onCancel:a(i).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(s(),G(E,{to:"body"},[g.value?(s(),l("div",be,[e("div",ge,[e("div",ve,[t[16]||(t[16]=e("p",{class:"text-sm font-medium text-foreground"},"API 接口",-1)),e("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:t[3]||(t[3]=r=>g.value=!1)}," 关闭 ")]),t[22]||(t[22]=e("p",{class:"mt-2 text-xs text-muted-foreground"},"根据客户端选择对应接口",-1)),e("div",he,[e("div",null,[t[17]||(t[17]=e("p",{class:"text-xs text-muted-foreground"},"基础端点",-1)),e("div",ye,[e("p",we,p(v.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[4]||(t[4]=r=>h(v.value))}," 复制 ")])]),e("div",null,[t[18]||(t[18]=e("p",{class:"text-xs text-muted-foreground"},"SDK 接口",-1)),e("div",ke,[e("p",_e,p(z.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[5]||(t[5]=r=>h(z.value))}," 复制 ")])]),e("div",null,[t[19]||(t[19]=e("p",{class:"text-xs text-muted-foreground"},"完整接口",-1)),e("div",ze,[e("p",Ce,p(C.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[6]||(t[6]=r=>h(C.value))}," 复制 ")])]),e("div",null,[t[20]||(t[20]=e("p",{class:"text-xs text-muted-foreground"},"支持模型",-1)),e("div",He,[e("div",Me,[(s(),l(V,null,$(T,r=>e("span",{key:r,class:"rounded-full border border-border px-2 py-0.5 text-[11px]"},p(r),1)),64))])])]),e("div",null,[t[21]||(t[21]=e("p",{class:"text-xs text-muted-foreground"},"API 密钥",-1)),e("div",Se,[e("p",Ve,p(H.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[7]||(t[7]=r=>h(H.value))}," 复制 ")])])]),e("div",$e,[e("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:t[8]||(t[8]=r=>g.value=!1)}," 知道了 ")])])])):d("",!0)]))]))}});export{Ie as default};
static/assets/AppShell-By1VIFEt.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as F,l as U,h as y,i as f,q as Z,s as S,c as l,a as e,x as m,y as G,b as d,n as u,F as V,r as $,z as K,t as p,A as w,u as a,R as k,B as O,T as q,p as E,f as A,e as s}from"./index-C7QtVLks.js";import{u as J}from"./settings-_wJjBPdz.js";import{_ as Q}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-Cf0ef7-g.js";import{u as W}from"./useConfirmDialog-0WVRfuk6.js";const X={class:"min-h-screen"},Y={class:"flex min-h-screen flex-col lg:flex-row"},ee={key:0,class:"text-base font-semibold text-foreground"},te={key:0,class:"px-3 pb-2 text-xs uppercase tracking-[0.28em] text-muted-foreground"},re={class:"space-y-1"},oe={"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},se=["d"],ne={key:0,class:"flex-1 min-w-0 truncate"},le={key:1,class:"ml-auto text-xs opacity-0 transition-opacity group-hover:opacity-100"},ae={class:"mt-auto border-t border-border px-6 py-3 lg:py-4"},ie={key:0,class:"rounded-2xl bg-secondary/60 p-3"},de=["title"],ue={class:"min-w-0 flex-1 overflow-hidden lg:ml-0"},pe={class:"min-w-0 flex flex-col gap-4 border-b border-border bg-card/70 px-6 py-5 backdrop-blur lg:flex-row lg:items-center lg:justify-between lg:px-10"},ce={class:"flex items-center gap-3"},xe={class:"text-xl font-semibold text-foreground lg:text-2xl"},fe={class:"flex flex-wrap items-center gap-3"},me={class:"h-full overflow-y-auto overflow-x-hidden bg-card/70 px-4 pb-10 pt-6 backdrop-blur lg:px-10 lg:pt-10"},be={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ge={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},ve={class:"flex items-center justify-between"},he={class:"mt-4 space-y-3 text-sm"},ye={class:"mt-1 flex items-start gap-2"},we={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ke={class:"mt-1 flex items-start gap-2"},_e={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ze={class:"mt-1 flex items-start gap-2"},Ce={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},He={class:"mt-1 rounded-2xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground"},Me={class:"flex flex-wrap gap-2 text-foreground"},Se={class:"mt-1 flex items-start gap-2"},Ve={class:"min-w-0 flex-1 rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},$e={class:"mt-6 flex items-center justify-end"},Ie=F({__name:"AppShell",setup(Ae){const L=E(),b=Z(),j=U(),c=J(),x=y(!1),o=y(!1),i=W(),g=y(!1),_=[{path:"/",label:"概览",icon:"M4 4h7v7H4V4zm9 0h7v4h-7V4zm0 6h7v10h-7V10zM4 13h7v7H4v-7z"},{path:"/accounts",label:"账号管理",icon:"M12 12a3.5 3.5 0 1 0-3.5-3.5A3.5 3.5 0 0 0 12 12zm0 2c-4.1 0-7.5 2.2-7.5 5v1h15v-1c0-2.8-3.4-5-7.5-5z"},{path:"/settings",label:"系统设置",icon:"M4 6h10v2H4V6zm12 0h4v2h-4V6zM4 11h6v2H4v-2zm8 0h8v2h-8v-2zM4 16h10v2H4v-2zm12 0h4v2h-4v-2z"},{path:"/monitor",label:"监控状态",icon:"M3 12h4l2-4 4 8 3-6h5v2h-4l-4 8-4-8-2 4H3v-2z"},{path:"/logs",label:"运行日志",icon:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h10v2H4v-2z"},{path:"/docs",label:"文档中心",icon:"M6 3h9l4 4v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm8 1.5V8h3.5L14 4.5zM8 11h8v2H8v-2zm0 4h8v2H8v-2z"}],B=f(()=>_.find(t=>t.path===b.path)?.label||"概览"),D=n=>{const r=`transition-colors ${o.value?"px-2 justify-center gap-0":"px-3 gap-3"}`;return b.path===n?`${r} bg-primary text-primary-foreground`:`${r} text-muted-foreground hover:bg-accent hover:text-accent-foreground`},I=n=>b.path===n?"bg-primary-foreground/15 text-primary-foreground border-primary-foreground/40":"bg-secondary text-muted-foreground group-hover:text-accent-foreground",v=f(()=>(c.settings?.basic?.base_url||""||window.location.origin).replace(/\/$/,"")),z=f(()=>`${v.value}/v1`),C=f(()=>`${v.value}/v1/chat/completions`),H=f(()=>c.settings?.basic?.api_key||"未设置"),T=["gemini-auto","gemini-2.5-flash","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview"];S(()=>b.path,()=>{x.value=!1});const M=localStorage.getItem("sidebar-collapsed");M&&(o.value=M==="true"),S(o,n=>{localStorage.setItem("sidebar-collapsed",n?"true":"false")});async function N(){await i.ask({title:"退出登录",message:"确定退出管理控制台吗?"})&&(await j.logout(),L.push({name:"login"}))}function P(){window.location.reload()}async function R(){g.value=!0,!c.settings&&!c.isLoading&&await c.loadSettings()}async function h(n){if(n)try{await navigator.clipboard.writeText(n)}catch(t){console.error("Copy failed",t)}}return(n,t)=>(s(),l("div",X,[e("div",Y,[x.value?(s(),l("div",{key:0,class:"fixed inset-0 z-30 bg-black/20 backdrop-blur-sm lg:hidden",onClick:t[0]||(t[0]=r=>x.value=!1)})):d("",!0),e("aside",{class:u(["fixed inset-y-0 left-0 z-40 w-72 -translate-x-full bg-card/90 backdrop-blur-sm lg:backdrop-blur-none border-r border-border transition-[width,transform] duration-200 ease-out will-change-[transform] transform-gpu flex flex-col lg:static lg:translate-x-0 lg:bg-card/80 lg:border-b-0 lg:border-r lg:sticky lg:top-0 lg:h-screen",[{"translate-x-0":x.value,"w-20 lg:w-20":o.value}]])},[e("div",{class:u(["flex h-16 items-center justify-between px-6 pt-4 lg:h-20 lg:pt-5",o.value?"justify-center px-0":""])},[e("div",{class:u(["flex items-center gap-2",o.value?"gap-0 justify-center w-full":""])},[t[9]||(t[9]=e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"text-foreground transition-colors hover:text-primary","aria-label":"GitHub"},[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-6 w-6",fill:"currentColor"},[e("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.166 6.839 9.489.5.09.682-.217.682-.483 0-.237-.009-.868-.014-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.004.071 1.532 1.031 1.532 1.031.892 1.529 2.341 1.087 2.91.832.091-.647.349-1.087.636-1.337-2.22-.253-4.555-1.11-4.555-4.944 0-1.092.39-1.987 1.029-2.687-.103-.253-.446-1.272.098-2.65 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.295 2.748-1.026 2.748-1.026.546 1.378.202 2.397.1 2.65.64.7 1.028 1.595 1.028 2.687 0 3.842-2.338 4.687-4.566 4.936.359.309.678.919.678 1.852 0 1.337-.012 2.418-.012 2.747 0 .268.18.577.688.479A10.002 10.002 0 0 0 22 12c0-5.523-4.477-10-10-10z"})])],-1)),o.value?d("",!0):(s(),l("span",ee,"Gemini Business2API"))],2)],2),e("nav",{class:u(["pb-4 pt-4 lg:pt-6 flex-1 overflow-y-auto",o.value?"px-2":"px-3"])},[o.value?d("",!0):(s(),l("p",te," 导航 ")),e("div",re,[(s(),l(V,null,$(_,r=>m(a(k),{key:r.path,to:r.path,class:u(["group flex items-center rounded-2xl py-2 text-sm font-medium transition-colors overflow-hidden",D(r.path)]),title:o.value?r.label:void 0},{default:w(()=>[e("span",{class:u(["inline-flex h-9 w-9 items-center justify-center rounded-2xl border border-border",I(r.path)])},[(s(),l("svg",oe,[e("path",{d:r.icon},null,8,se)]))],2),o.value?d("",!0):(s(),l("span",ne,p(r.label),1)),o.value?d("",!0):(s(),l("span",le," 进入 "))]),_:2},1032,["to","class","title"])),64))])],2),e("div",ae,[o.value?d("",!0):(s(),l("div",ie,[...t[10]||(t[10]=[e("p",{class:"text-xs tracking-[0.12em] text-muted-foreground"},[e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 transition-colors hover:text-foreground"}," gemini-business2api "),e("span",null," · 声明")],-1),e("p",{class:"mt-2 text-xs text-muted-foreground"}," 本项目仅限学习与研究用途,禁止用于商业用途。请保留本声明、原作者信息与开源来源。 ",-1)])])),e("div",{class:u(["mt-4 flex items-center gap-3",o.value?"justify-center":""])},[o.value?d("",!0):(s(),l("button",{key:0,onClick:N,class:"flex-1 rounded-2xl border border-border bg-background px-4 py-3 text-sm font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:text-destructive"}," 退出登录 ")),e("button",{class:"h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-border text-muted-foreground transition-all hover:border-primary hover:text-primary flex",onClick:t[1]||(t[1]=r=>o.value=!o.value),title:o.value?"展开侧边栏":"收起侧边栏"},[...t[11]||(t[11]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 shrink-0",fill:"currentColor"},[e("path",{d:"M6 4h2v16H6V4zm4 4h8v2h-8V8zm0 6h8v2h-8v-2z"})],-1)])],8,de)],2)])],2),e("main",ue,[e("header",pe,[e("div",ce,[e("button",{class:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-border text-foreground transition-colors hover:border-primary hover:text-primary lg:hidden",onClick:t[2]||(t[2]=r=>x.value=!0),"aria-label":"打开导航"},[...t[12]||(t[12]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},[e("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])]),t[13]||(t[13]=K('<svg aria-hidden="true" viewBox="0 0 130 150" class="logo-mark h-9 w-9 shrink-0 text-foreground"><defs><filter id="head-shadow" x="-50%" y="-50%" width="200%" height="200%"><feDropShadow dx="0" dy="10" stdDeviation="12" flood-color="rgba(0, 188, 212, 0.2)"></feDropShadow></filter></defs><g class="logo-cat-wrapper" transform="translate(0, 12)"><g transform="translate(16, 20) rotate(-10, 9, 12)"><path d="M14 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g transform="translate(96, 20) rotate(10, 9, 12)"><path d="M4 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g filter="url(#head-shadow)"><path d="M 32 40 L 98 40 A 12 12 0 0 1 110 52 L 110 90 A 30 30 0 0 1 80 120 L 50 120 A 30 30 0 0 1 20 90 L 20 52 A 12 12 0 0 1 32 40 Z" fill="rgba(255, 255, 255, 0.9)" stroke="#2c3e50" stroke-width="3"></path></g><rect class="logo-eye" x="35" y="68" width="14" height="4" rx="1"></rect><rect class="logo-eye" x="81" y="68" width="14" height="4" rx="1"></rect></g></svg>',1)),e("h2",xe,p(B.value),1)]),e("div",fe,[e("button",{onClick:P,class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",title:"刷新"}," ��新 "),e("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:R}," 接口信息 "),m(a(k),{to:"/public/uptime",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[14]||(t[14]=[A(" 状态监控 ",-1)])]),_:1}),m(a(k),{to:"/public/logs",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[15]||(t[15]=[A(" 公开日志 ",-1)])]),_:1})])]),e("div",me,[m(a(O))])])]),m(Q,{open:a(i).open.value,title:a(i).title.value,message:a(i).message.value,"confirm-text":a(i).confirmText.value,"cancel-text":a(i).cancelText.value,onConfirm:a(i).confirm,onCancel:a(i).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(s(),G(q,{to:"body"},[g.value?(s(),l("div",be,[e("div",ge,[e("div",ve,[t[16]||(t[16]=e("p",{class:"text-sm font-medium text-foreground"},"API 接口",-1)),e("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:t[3]||(t[3]=r=>g.value=!1)}," 关闭 ")]),t[22]||(t[22]=e("p",{class:"mt-2 text-xs text-muted-foreground"},"根据客户端选择对应接口",-1)),e("div",he,[e("div",null,[t[17]||(t[17]=e("p",{class:"text-xs text-muted-foreground"},"基础端点",-1)),e("div",ye,[e("p",we,p(v.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[4]||(t[4]=r=>h(v.value))}," 复制 ")])]),e("div",null,[t[18]||(t[18]=e("p",{class:"text-xs text-muted-foreground"},"SDK 接口",-1)),e("div",ke,[e("p",_e,p(z.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[5]||(t[5]=r=>h(z.value))}," 复制 ")])]),e("div",null,[t[19]||(t[19]=e("p",{class:"text-xs text-muted-foreground"},"完整接口",-1)),e("div",ze,[e("p",Ce,p(C.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[6]||(t[6]=r=>h(C.value))}," 复制 ")])]),e("div",null,[t[20]||(t[20]=e("p",{class:"text-xs text-muted-foreground"},"支持模型",-1)),e("div",He,[e("div",Me,[(s(),l(V,null,$(T,r=>e("span",{key:r,class:"rounded-full border border-border px-2 py-0.5 text-[11px]"},p(r),1)),64))])])]),e("div",null,[t[21]||(t[21]=e("p",{class:"text-xs text-muted-foreground"},"API 密钥",-1)),e("div",Se,[e("p",Ve,p(H.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[7]||(t[7]=r=>h(H.value))}," 复制 ")])])]),e("div",$e,[e("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:t[8]||(t[8]=r=>g.value=!1)}," 知道了 ")])])])):d("",!0)]))]))}});export{Ie as default};
static/assets/AppShell-C-FNXlk9.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as F,l as U,h as y,i as f,q as Z,s as S,c as l,a as e,x as m,y as G,b as d,n as u,F as V,r as $,z as K,t as p,A as w,u as a,R as k,B as O,T as q,p as E,f as A,e as s}from"./index-DhxxzIOh.js";import{u as J}from"./settings-CCCXerrX.js";import{_ as Q}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-C_ZbANx_.js";import{u as W}from"./useConfirmDialog-ChXSHLDJ.js";const X={class:"min-h-screen"},Y={class:"flex min-h-screen flex-col lg:flex-row"},ee={key:0,class:"text-base font-semibold text-foreground"},te={key:0,class:"px-3 pb-2 text-xs uppercase tracking-[0.28em] text-muted-foreground"},re={class:"space-y-1"},oe={"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},se=["d"],ne={key:0,class:"flex-1 min-w-0 truncate"},le={key:1,class:"ml-auto text-xs opacity-0 transition-opacity group-hover:opacity-100"},ae={class:"mt-auto border-t border-border px-6 py-3 lg:py-4"},ie={key:0,class:"rounded-2xl bg-secondary/60 p-3"},de=["title"],ue={class:"min-w-0 flex-1 overflow-hidden lg:ml-0"},pe={class:"min-w-0 flex flex-col gap-4 border-b border-border bg-card/70 px-6 py-5 backdrop-blur lg:flex-row lg:items-center lg:justify-between lg:px-10"},ce={class:"flex items-center gap-3"},xe={class:"text-xl font-semibold text-foreground lg:text-2xl"},fe={class:"flex flex-wrap items-center gap-3"},me={class:"h-full overflow-y-auto overflow-x-hidden bg-card/70 px-4 pb-10 pt-6 backdrop-blur lg:px-10 lg:pt-10"},be={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ge={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},ve={class:"flex items-center justify-between"},he={class:"mt-4 space-y-3 text-sm"},ye={class:"mt-1 flex items-start gap-2"},we={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ke={class:"mt-1 flex items-start gap-2"},_e={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ze={class:"mt-1 flex items-start gap-2"},Ce={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},He={class:"mt-1 rounded-2xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground"},Me={class:"flex flex-wrap gap-2 text-foreground"},Se={class:"mt-1 flex items-start gap-2"},Ve={class:"min-w-0 flex-1 rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},$e={class:"mt-6 flex items-center justify-end"},Ie=F({__name:"AppShell",setup(Ae){const L=E(),b=Z(),j=U(),c=J(),x=y(!1),o=y(!1),i=W(),g=y(!1),_=[{path:"/",label:"概览",icon:"M4 4h7v7H4V4zm9 0h7v4h-7V4zm0 6h7v10h-7V10zM4 13h7v7H4v-7z"},{path:"/accounts",label:"账号管理",icon:"M12 12a3.5 3.5 0 1 0-3.5-3.5A3.5 3.5 0 0 0 12 12zm0 2c-4.1 0-7.5 2.2-7.5 5v1h15v-1c0-2.8-3.4-5-7.5-5z"},{path:"/settings",label:"系统设置",icon:"M4 6h10v2H4V6zm12 0h4v2h-4V6zM4 11h6v2H4v-2zm8 0h8v2h-8v-2zM4 16h10v2H4v-2zm12 0h4v2h-4v-2z"},{path:"/monitor",label:"监控状态",icon:"M3 12h4l2-4 4 8 3-6h5v2h-4l-4 8-4-8-2 4H3v-2z"},{path:"/logs",label:"运行日志",icon:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h10v2H4v-2z"},{path:"/docs",label:"文档中心",icon:"M6 3h9l4 4v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm8 1.5V8h3.5L14 4.5zM8 11h8v2H8v-2zm0 4h8v2H8v-2z"}],B=f(()=>_.find(t=>t.path===b.path)?.label||"概览"),D=n=>{const r=`transition-colors ${o.value?"px-2 justify-center gap-0":"px-3 gap-3"}`;return b.path===n?`${r} bg-primary text-primary-foreground`:`${r} text-muted-foreground hover:bg-accent hover:text-accent-foreground`},I=n=>b.path===n?"bg-primary-foreground/15 text-primary-foreground border-primary-foreground/40":"bg-secondary text-muted-foreground group-hover:text-accent-foreground",v=f(()=>(c.settings?.basic?.base_url||""||window.location.origin).replace(/\/$/,"")),z=f(()=>`${v.value}/v1`),C=f(()=>`${v.value}/v1/chat/completions`),H=f(()=>c.settings?.basic?.api_key||"未设置"),T=["gemini-auto","gemini-2.5-flash","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview"];S(()=>b.path,()=>{x.value=!1});const M=localStorage.getItem("sidebar-collapsed");M&&(o.value=M==="true"),S(o,n=>{localStorage.setItem("sidebar-collapsed",n?"true":"false")});async function N(){await i.ask({title:"退出登录",message:"确定退出管理控制台吗?"})&&(await j.logout(),L.push({name:"login"}))}function P(){window.location.reload()}async function R(){g.value=!0,!c.settings&&!c.isLoading&&await c.loadSettings()}async function h(n){if(n)try{await navigator.clipboard.writeText(n)}catch(t){console.error("Copy failed",t)}}return(n,t)=>(s(),l("div",X,[e("div",Y,[x.value?(s(),l("div",{key:0,class:"fixed inset-0 z-30 bg-black/20 backdrop-blur-sm lg:hidden",onClick:t[0]||(t[0]=r=>x.value=!1)})):d("",!0),e("aside",{class:u(["fixed inset-y-0 left-0 z-40 w-72 -translate-x-full bg-card/90 backdrop-blur-sm lg:backdrop-blur-none border-r border-border transition-[width,transform] duration-200 ease-out will-change-[transform] transform-gpu flex flex-col lg:static lg:translate-x-0 lg:bg-card/80 lg:border-b-0 lg:border-r lg:sticky lg:top-0 lg:h-screen",[{"translate-x-0":x.value,"w-20 lg:w-20":o.value}]])},[e("div",{class:u(["flex h-16 items-center justify-between px-6 pt-4 lg:h-20 lg:pt-5",o.value?"justify-center px-0":""])},[e("div",{class:u(["flex items-center gap-2",o.value?"gap-0 justify-center w-full":""])},[t[9]||(t[9]=e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"text-foreground transition-colors hover:text-primary","aria-label":"GitHub"},[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-6 w-6",fill:"currentColor"},[e("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.166 6.839 9.489.5.09.682-.217.682-.483 0-.237-.009-.868-.014-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.004.071 1.532 1.031 1.532 1.031.892 1.529 2.341 1.087 2.91.832.091-.647.349-1.087.636-1.337-2.22-.253-4.555-1.11-4.555-4.944 0-1.092.39-1.987 1.029-2.687-.103-.253-.446-1.272.098-2.65 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.295 2.748-1.026 2.748-1.026.546 1.378.202 2.397.1 2.65.64.7 1.028 1.595 1.028 2.687 0 3.842-2.338 4.687-4.566 4.936.359.309.678.919.678 1.852 0 1.337-.012 2.418-.012 2.747 0 .268.18.577.688.479A10.002 10.002 0 0 0 22 12c0-5.523-4.477-10-10-10z"})])],-1)),o.value?d("",!0):(s(),l("span",ee,"Gemini Business2API"))],2)],2),e("nav",{class:u(["pb-4 pt-4 lg:pt-6 flex-1 overflow-y-auto",o.value?"px-2":"px-3"])},[o.value?d("",!0):(s(),l("p",te," 导航 ")),e("div",re,[(s(),l(V,null,$(_,r=>m(a(k),{key:r.path,to:r.path,class:u(["group flex items-center rounded-2xl py-2 text-sm font-medium transition-colors overflow-hidden",D(r.path)]),title:o.value?r.label:void 0},{default:w(()=>[e("span",{class:u(["inline-flex h-9 w-9 items-center justify-center rounded-2xl border border-border",I(r.path)])},[(s(),l("svg",oe,[e("path",{d:r.icon},null,8,se)]))],2),o.value?d("",!0):(s(),l("span",ne,p(r.label),1)),o.value?d("",!0):(s(),l("span",le," 进入 "))]),_:2},1032,["to","class","title"])),64))])],2),e("div",ae,[o.value?d("",!0):(s(),l("div",ie,[...t[10]||(t[10]=[e("p",{class:"text-xs tracking-[0.12em] text-muted-foreground"},[e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 transition-colors hover:text-foreground"}," gemini-business2api "),e("span",null," · 声明")],-1),e("p",{class:"mt-2 text-xs text-muted-foreground"}," 本项目仅限学习与研究用途,禁止用于商业用途。请保留本声明、原作者信息与开源来源。 ",-1)])])),e("div",{class:u(["mt-4 flex items-center gap-3",o.value?"justify-center":""])},[o.value?d("",!0):(s(),l("button",{key:0,onClick:N,class:"flex-1 rounded-2xl border border-border bg-background px-4 py-3 text-sm font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:text-destructive"}," 退出登录 ")),e("button",{class:"h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-border text-muted-foreground transition-all hover:border-primary hover:text-primary flex",onClick:t[1]||(t[1]=r=>o.value=!o.value),title:o.value?"展开侧边栏":"收起侧边栏"},[...t[11]||(t[11]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 shrink-0",fill:"currentColor"},[e("path",{d:"M6 4h2v16H6V4zm4 4h8v2h-8V8zm0 6h8v2h-8v-2z"})],-1)])],8,de)],2)])],2),e("main",ue,[e("header",pe,[e("div",ce,[e("button",{class:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-border text-foreground transition-colors hover:border-primary hover:text-primary lg:hidden",onClick:t[2]||(t[2]=r=>x.value=!0),"aria-label":"打开导航"},[...t[12]||(t[12]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},[e("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])]),t[13]||(t[13]=K('<svg aria-hidden="true" viewBox="0 0 130 150" class="logo-mark h-9 w-9 shrink-0 text-foreground"><defs><filter id="head-shadow" x="-50%" y="-50%" width="200%" height="200%"><feDropShadow dx="0" dy="10" stdDeviation="12" flood-color="rgba(0, 188, 212, 0.2)"></feDropShadow></filter></defs><g class="logo-cat-wrapper" transform="translate(0, 12)"><g transform="translate(16, 20) rotate(-10, 9, 12)"><path d="M14 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g transform="translate(96, 20) rotate(10, 9, 12)"><path d="M4 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g filter="url(#head-shadow)"><path d="M 32 40 L 98 40 A 12 12 0 0 1 110 52 L 110 90 A 30 30 0 0 1 80 120 L 50 120 A 30 30 0 0 1 20 90 L 20 52 A 12 12 0 0 1 32 40 Z" fill="rgba(255, 255, 255, 0.9)" stroke="#2c3e50" stroke-width="3"></path></g><rect class="logo-eye" x="35" y="68" width="14" height="4" rx="1"></rect><rect class="logo-eye" x="81" y="68" width="14" height="4" rx="1"></rect></g></svg>',1)),e("h2",xe,p(B.value),1)]),e("div",fe,[e("button",{onClick:P,class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",title:"刷新"}," ��新 "),e("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:R}," 接口信息 "),m(a(k),{to:"/public/uptime",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[14]||(t[14]=[A(" 状态监控 ",-1)])]),_:1}),m(a(k),{to:"/public/logs",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[15]||(t[15]=[A(" 公开日志 ",-1)])]),_:1})])]),e("div",me,[m(a(O))])])]),m(Q,{open:a(i).open.value,title:a(i).title.value,message:a(i).message.value,"confirm-text":a(i).confirmText.value,"cancel-text":a(i).cancelText.value,onConfirm:a(i).confirm,onCancel:a(i).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(s(),G(q,{to:"body"},[g.value?(s(),l("div",be,[e("div",ge,[e("div",ve,[t[16]||(t[16]=e("p",{class:"text-sm font-medium text-foreground"},"API 接口",-1)),e("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:t[3]||(t[3]=r=>g.value=!1)}," 关闭 ")]),t[22]||(t[22]=e("p",{class:"mt-2 text-xs text-muted-foreground"},"根据客户端选择对应接口",-1)),e("div",he,[e("div",null,[t[17]||(t[17]=e("p",{class:"text-xs text-muted-foreground"},"基础端点",-1)),e("div",ye,[e("p",we,p(v.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[4]||(t[4]=r=>h(v.value))}," 复制 ")])]),e("div",null,[t[18]||(t[18]=e("p",{class:"text-xs text-muted-foreground"},"SDK 接口",-1)),e("div",ke,[e("p",_e,p(z.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[5]||(t[5]=r=>h(z.value))}," 复制 ")])]),e("div",null,[t[19]||(t[19]=e("p",{class:"text-xs text-muted-foreground"},"完整接口",-1)),e("div",ze,[e("p",Ce,p(C.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[6]||(t[6]=r=>h(C.value))}," 复制 ")])]),e("div",null,[t[20]||(t[20]=e("p",{class:"text-xs text-muted-foreground"},"支持模型",-1)),e("div",He,[e("div",Me,[(s(),l(V,null,$(T,r=>e("span",{key:r,class:"rounded-full border border-border px-2 py-0.5 text-[11px]"},p(r),1)),64))])])]),e("div",null,[t[21]||(t[21]=e("p",{class:"text-xs text-muted-foreground"},"API 密钥",-1)),e("div",Se,[e("p",Ve,p(H.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[7]||(t[7]=r=>h(H.value))}," 复制 ")])])]),e("div",$e,[e("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:t[8]||(t[8]=r=>g.value=!1)}," 知道了 ")])])])):d("",!0)]))]))}});export{Ie as default};
static/assets/AppShell-C6gOM0Kd.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as F,l as U,h as y,i as f,B as Z,w as S,c as l,a as e,x as m,m as G,b as d,n as u,F as V,r as $,C as K,t as p,y as w,u as a,R as k,D as O,z as E,A as q,f as A,e as s}from"./index-CM73xqTK.js";import{u as J}from"./settings-vReTlwTm.js";import{_ as Q}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-szV8KRsH.js";import{u as W}from"./useConfirmDialog-WjrHNzIy.js";const X={class:"min-h-screen"},Y={class:"flex min-h-screen flex-col lg:flex-row"},ee={key:0,class:"text-base font-semibold text-foreground"},te={key:0,class:"px-3 pb-2 text-xs uppercase tracking-[0.28em] text-muted-foreground"},re={class:"space-y-1"},oe={"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},se=["d"],ne={key:0,class:"flex-1 min-w-0 truncate"},le={key:1,class:"ml-auto text-xs opacity-0 transition-opacity group-hover:opacity-100"},ae={class:"mt-auto border-t border-border px-6 py-3 lg:py-4"},ie={key:0,class:"rounded-2xl bg-secondary/60 p-3"},de=["title"],ue={class:"min-w-0 flex-1 overflow-hidden lg:ml-0"},pe={class:"min-w-0 flex flex-col gap-4 border-b border-border bg-card/70 px-6 py-5 backdrop-blur lg:flex-row lg:items-center lg:justify-between lg:px-10"},ce={class:"flex items-center gap-3"},xe={class:"text-xl font-semibold text-foreground lg:text-2xl"},fe={class:"flex flex-wrap items-center gap-3"},me={class:"h-full overflow-y-auto overflow-x-hidden bg-card/70 px-4 pb-10 pt-6 backdrop-blur lg:px-10 lg:pt-10"},be={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ge={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},ve={class:"flex items-center justify-between"},he={class:"mt-4 space-y-3 text-sm"},ye={class:"mt-1 flex items-start gap-2"},we={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ke={class:"mt-1 flex items-start gap-2"},_e={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ze={class:"mt-1 flex items-start gap-2"},Ce={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},He={class:"mt-1 rounded-2xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground"},Me={class:"flex flex-wrap gap-2 text-foreground"},Se={class:"mt-1 flex items-start gap-2"},Ve={class:"min-w-0 flex-1 rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},$e={class:"mt-6 flex items-center justify-end"},Ie=F({__name:"AppShell",setup(Ae){const L=q(),b=Z(),j=U(),c=J(),x=y(!1),o=y(!1),i=W(),g=y(!1),_=[{path:"/",label:"概览",icon:"M4 4h7v7H4V4zm9 0h7v4h-7V4zm0 6h7v10h-7V10zM4 13h7v7H4v-7z"},{path:"/accounts",label:"账号管理",icon:"M12 12a3.5 3.5 0 1 0-3.5-3.5A3.5 3.5 0 0 0 12 12zm0 2c-4.1 0-7.5 2.2-7.5 5v1h15v-1c0-2.8-3.4-5-7.5-5z"},{path:"/settings",label:"系统设置",icon:"M4 6h10v2H4V6zm12 0h4v2h-4V6zM4 11h6v2H4v-2zm8 0h8v2h-8v-2zM4 16h10v2H4v-2zm12 0h4v2h-4v-2z"},{path:"/monitor",label:"监控状态",icon:"M3 12h4l2-4 4 8 3-6h5v2h-4l-4 8-4-8-2 4H3v-2z"},{path:"/logs",label:"运行日志",icon:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h10v2H4v-2z"},{path:"/docs",label:"文档中心",icon:"M6 3h9l4 4v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm8 1.5V8h3.5L14 4.5zM8 11h8v2H8v-2zm0 4h8v2H8v-2z"}],B=f(()=>_.find(t=>t.path===b.path)?.label||"概览"),D=n=>{const r=`transition-colors ${o.value?"px-2 justify-center gap-0":"px-3 gap-3"}`;return b.path===n?`${r} bg-primary text-primary-foreground`:`${r} text-muted-foreground hover:bg-accent hover:text-accent-foreground`},I=n=>b.path===n?"bg-primary-foreground/15 text-primary-foreground border-primary-foreground/40":"bg-secondary text-muted-foreground group-hover:text-accent-foreground",v=f(()=>(c.settings?.basic?.base_url||""||window.location.origin).replace(/\/$/,"")),z=f(()=>`${v.value}/v1`),C=f(()=>`${v.value}/v1/chat/completions`),H=f(()=>c.settings?.basic?.api_key||"未设置"),T=["gemini-auto","gemini-2.5-flash","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview"];S(()=>b.path,()=>{x.value=!1});const M=localStorage.getItem("sidebar-collapsed");M&&(o.value=M==="true"),S(o,n=>{localStorage.setItem("sidebar-collapsed",n?"true":"false")});async function N(){await i.ask({title:"退出登录",message:"确定退出管理控制台吗?"})&&(await j.logout(),L.push({name:"login"}))}function P(){window.location.reload()}async function R(){g.value=!0,!c.settings&&!c.isLoading&&await c.loadSettings()}async function h(n){if(n)try{await navigator.clipboard.writeText(n)}catch(t){console.error("Copy failed",t)}}return(n,t)=>(s(),l("div",X,[e("div",Y,[x.value?(s(),l("div",{key:0,class:"fixed inset-0 z-30 bg-black/20 backdrop-blur-sm lg:hidden",onClick:t[0]||(t[0]=r=>x.value=!1)})):d("",!0),e("aside",{class:u(["fixed inset-y-0 left-0 z-40 w-72 -translate-x-full bg-card/90 backdrop-blur-sm lg:backdrop-blur-none border-r border-border transition-[width,transform] duration-200 ease-out will-change-[transform] transform-gpu flex flex-col lg:static lg:translate-x-0 lg:bg-card/80 lg:border-b-0 lg:border-r lg:sticky lg:top-0 lg:h-screen",[{"translate-x-0":x.value,"w-20 lg:w-20":o.value}]])},[e("div",{class:u(["flex h-16 items-center justify-between px-6 pt-4 lg:h-20 lg:pt-5",o.value?"justify-center px-0":""])},[e("div",{class:u(["flex items-center gap-2",o.value?"gap-0 justify-center w-full":""])},[t[9]||(t[9]=e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"text-foreground transition-colors hover:text-primary","aria-label":"GitHub"},[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-6 w-6",fill:"currentColor"},[e("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.166 6.839 9.489.5.09.682-.217.682-.483 0-.237-.009-.868-.014-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.004.071 1.532 1.031 1.532 1.031.892 1.529 2.341 1.087 2.91.832.091-.647.349-1.087.636-1.337-2.22-.253-4.555-1.11-4.555-4.944 0-1.092.39-1.987 1.029-2.687-.103-.253-.446-1.272.098-2.65 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.295 2.748-1.026 2.748-1.026.546 1.378.202 2.397.1 2.65.64.7 1.028 1.595 1.028 2.687 0 3.842-2.338 4.687-4.566 4.936.359.309.678.919.678 1.852 0 1.337-.012 2.418-.012 2.747 0 .268.18.577.688.479A10.002 10.002 0 0 0 22 12c0-5.523-4.477-10-10-10z"})])],-1)),o.value?d("",!0):(s(),l("span",ee,"Gemini Business2API"))],2)],2),e("nav",{class:u(["pb-4 pt-4 lg:pt-6 flex-1 overflow-y-auto",o.value?"px-2":"px-3"])},[o.value?d("",!0):(s(),l("p",te," 导航 ")),e("div",re,[(s(),l(V,null,$(_,r=>m(a(k),{key:r.path,to:r.path,class:u(["group flex items-center rounded-2xl py-2 text-sm font-medium transition-colors overflow-hidden",D(r.path)]),title:o.value?r.label:void 0},{default:w(()=>[e("span",{class:u(["inline-flex h-9 w-9 items-center justify-center rounded-2xl border border-border",I(r.path)])},[(s(),l("svg",oe,[e("path",{d:r.icon},null,8,se)]))],2),o.value?d("",!0):(s(),l("span",ne,p(r.label),1)),o.value?d("",!0):(s(),l("span",le," 进入 "))]),_:2},1032,["to","class","title"])),64))])],2),e("div",ae,[o.value?d("",!0):(s(),l("div",ie,[...t[10]||(t[10]=[e("p",{class:"text-xs tracking-[0.12em] text-muted-foreground"},[e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 transition-colors hover:text-foreground"}," gemini-business2api "),e("span",null," · 声明")],-1),e("p",{class:"mt-2 text-xs text-muted-foreground"}," 本项目仅限学习与研究用途,禁止用于商业用途。请保留本声明、原作者信息与开源来源。 ",-1)])])),e("div",{class:u(["mt-4 flex items-center gap-3",o.value?"justify-center":""])},[o.value?d("",!0):(s(),l("button",{key:0,onClick:N,class:"flex-1 rounded-2xl border border-border bg-background px-4 py-3 text-sm font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:text-destructive"}," 退出登录 ")),e("button",{class:"h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-border text-muted-foreground transition-all hover:border-primary hover:text-primary flex",onClick:t[1]||(t[1]=r=>o.value=!o.value),title:o.value?"展开侧边栏":"收起侧边栏"},[...t[11]||(t[11]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 shrink-0",fill:"currentColor"},[e("path",{d:"M6 4h2v16H6V4zm4 4h8v2h-8V8zm0 6h8v2h-8v-2z"})],-1)])],8,de)],2)])],2),e("main",ue,[e("header",pe,[e("div",ce,[e("button",{class:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-border text-foreground transition-colors hover:border-primary hover:text-primary lg:hidden",onClick:t[2]||(t[2]=r=>x.value=!0),"aria-label":"打开导航"},[...t[12]||(t[12]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},[e("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])]),t[13]||(t[13]=K('<svg aria-hidden="true" viewBox="0 0 130 150" class="logo-mark h-9 w-9 shrink-0 text-foreground"><defs><filter id="head-shadow" x="-50%" y="-50%" width="200%" height="200%"><feDropShadow dx="0" dy="10" stdDeviation="12" flood-color="rgba(0, 188, 212, 0.2)"></feDropShadow></filter></defs><g class="logo-cat-wrapper" transform="translate(0, 12)"><g transform="translate(16, 20) rotate(-10, 9, 12)"><path d="M14 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g transform="translate(96, 20) rotate(10, 9, 12)"><path d="M4 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g filter="url(#head-shadow)"><path d="M 32 40 L 98 40 A 12 12 0 0 1 110 52 L 110 90 A 30 30 0 0 1 80 120 L 50 120 A 30 30 0 0 1 20 90 L 20 52 A 12 12 0 0 1 32 40 Z" fill="rgba(255, 255, 255, 0.9)" stroke="#2c3e50" stroke-width="3"></path></g><rect class="logo-eye" x="35" y="68" width="14" height="4" rx="1"></rect><rect class="logo-eye" x="81" y="68" width="14" height="4" rx="1"></rect></g></svg>',1)),e("h2",xe,p(B.value),1)]),e("div",fe,[e("button",{onClick:P,class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",title:"刷新"}," ��新 "),e("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:R}," 接口信息 "),m(a(k),{to:"/public/uptime",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[14]||(t[14]=[A(" 状态监控 ",-1)])]),_:1}),m(a(k),{to:"/public/logs",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[15]||(t[15]=[A(" 公开日志 ",-1)])]),_:1})])]),e("div",me,[m(a(O))])])]),m(Q,{open:a(i).open.value,title:a(i).title.value,message:a(i).message.value,"confirm-text":a(i).confirmText.value,"cancel-text":a(i).cancelText.value,onConfirm:a(i).confirm,onCancel:a(i).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(s(),G(E,{to:"body"},[g.value?(s(),l("div",be,[e("div",ge,[e("div",ve,[t[16]||(t[16]=e("p",{class:"text-sm font-medium text-foreground"},"API 接口",-1)),e("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:t[3]||(t[3]=r=>g.value=!1)}," 关闭 ")]),t[22]||(t[22]=e("p",{class:"mt-2 text-xs text-muted-foreground"},"根据客户端选择对应接口",-1)),e("div",he,[e("div",null,[t[17]||(t[17]=e("p",{class:"text-xs text-muted-foreground"},"基础端点",-1)),e("div",ye,[e("p",we,p(v.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[4]||(t[4]=r=>h(v.value))}," 复制 ")])]),e("div",null,[t[18]||(t[18]=e("p",{class:"text-xs text-muted-foreground"},"SDK 接口",-1)),e("div",ke,[e("p",_e,p(z.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[5]||(t[5]=r=>h(z.value))}," 复制 ")])]),e("div",null,[t[19]||(t[19]=e("p",{class:"text-xs text-muted-foreground"},"完整接口",-1)),e("div",ze,[e("p",Ce,p(C.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[6]||(t[6]=r=>h(C.value))}," 复制 ")])]),e("div",null,[t[20]||(t[20]=e("p",{class:"text-xs text-muted-foreground"},"支持模型",-1)),e("div",He,[e("div",Me,[(s(),l(V,null,$(T,r=>e("span",{key:r,class:"rounded-full border border-border px-2 py-0.5 text-[11px]"},p(r),1)),64))])])]),e("div",null,[t[21]||(t[21]=e("p",{class:"text-xs text-muted-foreground"},"API 密钥",-1)),e("div",Se,[e("p",Ve,p(H.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[7]||(t[7]=r=>h(H.value))}," 复制 ")])])]),e("div",$e,[e("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:t[8]||(t[8]=r=>g.value=!1)}," 知道了 ")])])])):d("",!0)]))]))}});export{Ie as default};
static/assets/AppShell-CI3sE0H8.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as F,l as U,h as y,i as f,y as Z,z as S,c as l,a as e,p as m,m as G,b as d,n as u,F as V,r as $,A as K,t as p,s as w,u as a,R as k,B as O,T as E,x as q,f as A,e as s}from"./index-Bjh6Z8Zq.js";import{u as J}from"./settings-BgKIn-YY.js";import{_ as Q}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-NECRqKOO.js";import{u as W}from"./useConfirmDialog-GDc9JuxO.js";const X={class:"min-h-screen"},Y={class:"flex min-h-screen flex-col lg:flex-row"},ee={key:0,class:"text-base font-semibold text-foreground"},te={key:0,class:"px-3 pb-2 text-xs uppercase tracking-[0.28em] text-muted-foreground"},re={class:"space-y-1"},oe={"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},se=["d"],ne={key:0,class:"flex-1 min-w-0 truncate"},le={key:1,class:"ml-auto text-xs opacity-0 transition-opacity group-hover:opacity-100"},ae={class:"mt-auto border-t border-border px-6 py-3 lg:py-4"},ie={key:0,class:"rounded-2xl bg-secondary/60 p-3"},de=["title"],ue={class:"min-w-0 flex-1 overflow-hidden lg:ml-0"},pe={class:"min-w-0 flex flex-col gap-4 border-b border-border bg-card/70 px-6 py-5 backdrop-blur lg:flex-row lg:items-center lg:justify-between lg:px-10"},ce={class:"flex items-center gap-3"},xe={class:"text-xl font-semibold text-foreground lg:text-2xl"},fe={class:"flex flex-wrap items-center gap-3"},me={class:"h-full overflow-y-auto overflow-x-hidden bg-card/70 px-4 pb-10 pt-6 backdrop-blur lg:px-10 lg:pt-10"},be={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ge={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},ve={class:"flex items-center justify-between"},he={class:"mt-4 space-y-3 text-sm"},ye={class:"mt-1 flex items-start gap-2"},we={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ke={class:"mt-1 flex items-start gap-2"},_e={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ze={class:"mt-1 flex items-start gap-2"},Ce={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},He={class:"mt-1 rounded-2xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground"},Me={class:"flex flex-wrap gap-2 text-foreground"},Se={class:"mt-1 flex items-start gap-2"},Ve={class:"min-w-0 flex-1 rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},$e={class:"mt-6 flex items-center justify-end"},Ie=F({__name:"AppShell",setup(Ae){const L=q(),b=Z(),j=U(),c=J(),x=y(!1),o=y(!1),i=W(),g=y(!1),_=[{path:"/",label:"概览",icon:"M4 4h7v7H4V4zm9 0h7v4h-7V4zm0 6h7v10h-7V10zM4 13h7v7H4v-7z"},{path:"/accounts",label:"账号管理",icon:"M12 12a3.5 3.5 0 1 0-3.5-3.5A3.5 3.5 0 0 0 12 12zm0 2c-4.1 0-7.5 2.2-7.5 5v1h15v-1c0-2.8-3.4-5-7.5-5z"},{path:"/settings",label:"系统设置",icon:"M4 6h10v2H4V6zm12 0h4v2h-4V6zM4 11h6v2H4v-2zm8 0h8v2h-8v-2zM4 16h10v2H4v-2zm12 0h4v2h-4v-2z"},{path:"/monitor",label:"监控状态",icon:"M3 12h4l2-4 4 8 3-6h5v2h-4l-4 8-4-8-2 4H3v-2z"},{path:"/logs",label:"运行日志",icon:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h10v2H4v-2z"},{path:"/docs",label:"文档中心",icon:"M6 3h9l4 4v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm8 1.5V8h3.5L14 4.5zM8 11h8v2H8v-2zm0 4h8v2H8v-2z"}],B=f(()=>_.find(t=>t.path===b.path)?.label||"概览"),D=n=>{const r=`transition-colors ${o.value?"px-2 justify-center gap-0":"px-3 gap-3"}`;return b.path===n?`${r} bg-primary text-primary-foreground`:`${r} text-muted-foreground hover:bg-accent hover:text-accent-foreground`},I=n=>b.path===n?"bg-primary-foreground/15 text-primary-foreground border-primary-foreground/40":"bg-secondary text-muted-foreground group-hover:text-accent-foreground",v=f(()=>(c.settings?.basic?.base_url||""||window.location.origin).replace(/\/$/,"")),z=f(()=>`${v.value}/v1`),C=f(()=>`${v.value}/v1/chat/completions`),H=f(()=>c.settings?.basic?.api_key||"未设置"),T=["gemini-auto","gemini-2.5-flash","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview"];S(()=>b.path,()=>{x.value=!1});const M=localStorage.getItem("sidebar-collapsed");M&&(o.value=M==="true"),S(o,n=>{localStorage.setItem("sidebar-collapsed",n?"true":"false")});async function N(){await i.ask({title:"退出登录",message:"确定退出管理控制台吗?"})&&(await j.logout(),L.push({name:"login"}))}function P(){window.location.reload()}async function R(){g.value=!0,!c.settings&&!c.isLoading&&await c.loadSettings()}async function h(n){if(n)try{await navigator.clipboard.writeText(n)}catch(t){console.error("Copy failed",t)}}return(n,t)=>(s(),l("div",X,[e("div",Y,[x.value?(s(),l("div",{key:0,class:"fixed inset-0 z-30 bg-black/20 backdrop-blur-sm lg:hidden",onClick:t[0]||(t[0]=r=>x.value=!1)})):d("",!0),e("aside",{class:u(["fixed inset-y-0 left-0 z-40 w-72 -translate-x-full bg-card/90 backdrop-blur-sm lg:backdrop-blur-none border-r border-border transition-[width,transform] duration-200 ease-out will-change-[transform] transform-gpu flex flex-col lg:static lg:translate-x-0 lg:bg-card/80 lg:border-b-0 lg:border-r lg:sticky lg:top-0 lg:h-screen",[{"translate-x-0":x.value,"w-20 lg:w-20":o.value}]])},[e("div",{class:u(["flex h-16 items-center justify-between px-6 pt-4 lg:h-20 lg:pt-5",o.value?"justify-center px-0":""])},[e("div",{class:u(["flex items-center gap-2",o.value?"gap-0 justify-center w-full":""])},[t[9]||(t[9]=e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"text-foreground transition-colors hover:text-primary","aria-label":"GitHub"},[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-6 w-6",fill:"currentColor"},[e("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.166 6.839 9.489.5.09.682-.217.682-.483 0-.237-.009-.868-.014-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.004.071 1.532 1.031 1.532 1.031.892 1.529 2.341 1.087 2.91.832.091-.647.349-1.087.636-1.337-2.22-.253-4.555-1.11-4.555-4.944 0-1.092.39-1.987 1.029-2.687-.103-.253-.446-1.272.098-2.65 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.295 2.748-1.026 2.748-1.026.546 1.378.202 2.397.1 2.65.64.7 1.028 1.595 1.028 2.687 0 3.842-2.338 4.687-4.566 4.936.359.309.678.919.678 1.852 0 1.337-.012 2.418-.012 2.747 0 .268.18.577.688.479A10.002 10.002 0 0 0 22 12c0-5.523-4.477-10-10-10z"})])],-1)),o.value?d("",!0):(s(),l("span",ee,"Gemini Business2API"))],2)],2),e("nav",{class:u(["pb-4 pt-4 lg:pt-6 flex-1 overflow-y-auto",o.value?"px-2":"px-3"])},[o.value?d("",!0):(s(),l("p",te," 导航 ")),e("div",re,[(s(),l(V,null,$(_,r=>m(a(k),{key:r.path,to:r.path,class:u(["group flex items-center rounded-2xl py-2 text-sm font-medium transition-colors overflow-hidden",D(r.path)]),title:o.value?r.label:void 0},{default:w(()=>[e("span",{class:u(["inline-flex h-9 w-9 items-center justify-center rounded-2xl border border-border",I(r.path)])},[(s(),l("svg",oe,[e("path",{d:r.icon},null,8,se)]))],2),o.value?d("",!0):(s(),l("span",ne,p(r.label),1)),o.value?d("",!0):(s(),l("span",le," 进入 "))]),_:2},1032,["to","class","title"])),64))])],2),e("div",ae,[o.value?d("",!0):(s(),l("div",ie,[...t[10]||(t[10]=[e("p",{class:"text-xs tracking-[0.12em] text-muted-foreground"},[e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 transition-colors hover:text-foreground"}," gemini-business2api "),e("span",null," · 声明")],-1),e("p",{class:"mt-2 text-xs text-muted-foreground"}," 本项目仅限学习与研究用途,禁止用于商业用途。请保留本声明、原作者信息与开源来源。 ",-1)])])),e("div",{class:u(["mt-4 flex items-center gap-3",o.value?"justify-center":""])},[o.value?d("",!0):(s(),l("button",{key:0,onClick:N,class:"flex-1 rounded-2xl border border-border bg-background px-4 py-3 text-sm font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:text-destructive"}," 退出登录 ")),e("button",{class:"h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-border text-muted-foreground transition-all hover:border-primary hover:text-primary flex",onClick:t[1]||(t[1]=r=>o.value=!o.value),title:o.value?"展开侧边栏":"收起侧边栏"},[...t[11]||(t[11]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 shrink-0",fill:"currentColor"},[e("path",{d:"M6 4h2v16H6V4zm4 4h8v2h-8V8zm0 6h8v2h-8v-2z"})],-1)])],8,de)],2)])],2),e("main",ue,[e("header",pe,[e("div",ce,[e("button",{class:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-border text-foreground transition-colors hover:border-primary hover:text-primary lg:hidden",onClick:t[2]||(t[2]=r=>x.value=!0),"aria-label":"打开导航"},[...t[12]||(t[12]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},[e("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])]),t[13]||(t[13]=K('<svg aria-hidden="true" viewBox="0 0 130 150" class="logo-mark h-9 w-9 shrink-0 text-foreground"><defs><filter id="head-shadow" x="-50%" y="-50%" width="200%" height="200%"><feDropShadow dx="0" dy="10" stdDeviation="12" flood-color="rgba(0, 188, 212, 0.2)"></feDropShadow></filter></defs><g class="logo-cat-wrapper" transform="translate(0, 12)"><g transform="translate(16, 20) rotate(-10, 9, 12)"><path d="M14 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g transform="translate(96, 20) rotate(10, 9, 12)"><path d="M4 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g filter="url(#head-shadow)"><path d="M 32 40 L 98 40 A 12 12 0 0 1 110 52 L 110 90 A 30 30 0 0 1 80 120 L 50 120 A 30 30 0 0 1 20 90 L 20 52 A 12 12 0 0 1 32 40 Z" fill="rgba(255, 255, 255, 0.9)" stroke="#2c3e50" stroke-width="3"></path></g><rect class="logo-eye" x="35" y="68" width="14" height="4" rx="1"></rect><rect class="logo-eye" x="81" y="68" width="14" height="4" rx="1"></rect></g></svg>',1)),e("h2",xe,p(B.value),1)]),e("div",fe,[e("button",{onClick:P,class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",title:"刷新"}," ��新 "),e("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:R}," 接口信息 "),m(a(k),{to:"/public/uptime",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[14]||(t[14]=[A(" 状态监控 ",-1)])]),_:1}),m(a(k),{to:"/public/logs",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[15]||(t[15]=[A(" 公开日志 ",-1)])]),_:1})])]),e("div",me,[m(a(O))])])]),m(Q,{open:a(i).open.value,title:a(i).title.value,message:a(i).message.value,"confirm-text":a(i).confirmText.value,"cancel-text":a(i).cancelText.value,onConfirm:a(i).confirm,onCancel:a(i).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(s(),G(E,{to:"body"},[g.value?(s(),l("div",be,[e("div",ge,[e("div",ve,[t[16]||(t[16]=e("p",{class:"text-sm font-medium text-foreground"},"API 接口",-1)),e("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:t[3]||(t[3]=r=>g.value=!1)}," 关闭 ")]),t[22]||(t[22]=e("p",{class:"mt-2 text-xs text-muted-foreground"},"根据客户端选择对应接口",-1)),e("div",he,[e("div",null,[t[17]||(t[17]=e("p",{class:"text-xs text-muted-foreground"},"基础端点",-1)),e("div",ye,[e("p",we,p(v.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[4]||(t[4]=r=>h(v.value))}," 复制 ")])]),e("div",null,[t[18]||(t[18]=e("p",{class:"text-xs text-muted-foreground"},"SDK 接口",-1)),e("div",ke,[e("p",_e,p(z.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[5]||(t[5]=r=>h(z.value))}," 复制 ")])]),e("div",null,[t[19]||(t[19]=e("p",{class:"text-xs text-muted-foreground"},"完整接口",-1)),e("div",ze,[e("p",Ce,p(C.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[6]||(t[6]=r=>h(C.value))}," 复制 ")])]),e("div",null,[t[20]||(t[20]=e("p",{class:"text-xs text-muted-foreground"},"支持模型",-1)),e("div",He,[e("div",Me,[(s(),l(V,null,$(T,r=>e("span",{key:r,class:"rounded-full border border-border px-2 py-0.5 text-[11px]"},p(r),1)),64))])])]),e("div",null,[t[21]||(t[21]=e("p",{class:"text-xs text-muted-foreground"},"API 密钥",-1)),e("div",Se,[e("p",Ve,p(H.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[7]||(t[7]=r=>h(H.value))}," 复制 ")])])]),e("div",$e,[e("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:t[8]||(t[8]=r=>g.value=!1)}," 知道了 ")])])])):d("",!0)]))]))}});export{Ie as default};
static/assets/AppShell-CXOssFu_.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as F,l as U,h as y,i as f,q as Z,s as S,c as l,a as e,x as m,y as G,b as d,n as u,F as V,r as $,z as K,t as p,A as w,u as a,R as k,B as O,T as q,p as E,f as A,e as s}from"./index-CkXB0iyt.js";import{u as J}from"./settings-B_knXf3v.js";import{_ as Q}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-87LA-h3c.js";import{u as W}from"./useConfirmDialog-BpSB-4KN.js";const X={class:"min-h-screen"},Y={class:"flex min-h-screen flex-col lg:flex-row"},ee={key:0,class:"text-base font-semibold text-foreground"},te={key:0,class:"px-3 pb-2 text-xs uppercase tracking-[0.28em] text-muted-foreground"},re={class:"space-y-1"},oe={"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},se=["d"],ne={key:0,class:"flex-1 min-w-0 truncate"},le={key:1,class:"ml-auto text-xs opacity-0 transition-opacity group-hover:opacity-100"},ae={class:"mt-auto border-t border-border px-6 py-3 lg:py-4"},ie={key:0,class:"rounded-2xl bg-secondary/60 p-3"},de=["title"],ue={class:"min-w-0 flex-1 overflow-hidden lg:ml-0"},pe={class:"min-w-0 flex flex-col gap-4 border-b border-border bg-card/70 px-6 py-5 backdrop-blur lg:flex-row lg:items-center lg:justify-between lg:px-10"},ce={class:"flex items-center gap-3"},xe={class:"text-xl font-semibold text-foreground lg:text-2xl"},fe={class:"flex flex-wrap items-center gap-3"},me={class:"h-full overflow-y-auto overflow-x-hidden bg-card/70 px-4 pb-10 pt-6 backdrop-blur lg:px-10 lg:pt-10"},be={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ge={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},ve={class:"flex items-center justify-between"},he={class:"mt-4 space-y-3 text-sm"},ye={class:"mt-1 flex items-start gap-2"},we={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ke={class:"mt-1 flex items-start gap-2"},_e={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ze={class:"mt-1 flex items-start gap-2"},Ce={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},He={class:"mt-1 rounded-2xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground"},Me={class:"flex flex-wrap gap-2 text-foreground"},Se={class:"mt-1 flex items-start gap-2"},Ve={class:"min-w-0 flex-1 rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},$e={class:"mt-6 flex items-center justify-end"},Ie=F({__name:"AppShell",setup(Ae){const L=E(),b=Z(),j=U(),c=J(),x=y(!1),o=y(!1),i=W(),g=y(!1),_=[{path:"/",label:"概览",icon:"M4 4h7v7H4V4zm9 0h7v4h-7V4zm0 6h7v10h-7V10zM4 13h7v7H4v-7z"},{path:"/accounts",label:"账号管理",icon:"M12 12a3.5 3.5 0 1 0-3.5-3.5A3.5 3.5 0 0 0 12 12zm0 2c-4.1 0-7.5 2.2-7.5 5v1h15v-1c0-2.8-3.4-5-7.5-5z"},{path:"/settings",label:"系统设置",icon:"M4 6h10v2H4V6zm12 0h4v2h-4V6zM4 11h6v2H4v-2zm8 0h8v2h-8v-2zM4 16h10v2H4v-2zm12 0h4v2h-4v-2z"},{path:"/monitor",label:"监控状态",icon:"M3 12h4l2-4 4 8 3-6h5v2h-4l-4 8-4-8-2 4H3v-2z"},{path:"/logs",label:"运行日志",icon:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h10v2H4v-2z"},{path:"/docs",label:"文档中心",icon:"M6 3h9l4 4v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm8 1.5V8h3.5L14 4.5zM8 11h8v2H8v-2zm0 4h8v2H8v-2z"}],B=f(()=>_.find(t=>t.path===b.path)?.label||"概览"),D=n=>{const r=`transition-colors ${o.value?"px-2 justify-center gap-0":"px-3 gap-3"}`;return b.path===n?`${r} bg-primary text-primary-foreground`:`${r} text-muted-foreground hover:bg-accent hover:text-accent-foreground`},I=n=>b.path===n?"bg-primary-foreground/15 text-primary-foreground border-primary-foreground/40":"bg-secondary text-muted-foreground group-hover:text-accent-foreground",v=f(()=>(c.settings?.basic?.base_url||""||window.location.origin).replace(/\/$/,"")),z=f(()=>`${v.value}/v1`),C=f(()=>`${v.value}/v1/chat/completions`),H=f(()=>c.settings?.basic?.api_key||"未设置"),T=["gemini-auto","gemini-2.5-flash","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview"];S(()=>b.path,()=>{x.value=!1});const M=localStorage.getItem("sidebar-collapsed");M&&(o.value=M==="true"),S(o,n=>{localStorage.setItem("sidebar-collapsed",n?"true":"false")});async function N(){await i.ask({title:"退出登录",message:"确定退出管理控制台吗?"})&&(await j.logout(),L.push({name:"login"}))}function P(){window.location.reload()}async function R(){g.value=!0,!c.settings&&!c.isLoading&&await c.loadSettings()}async function h(n){if(n)try{await navigator.clipboard.writeText(n)}catch(t){console.error("Copy failed",t)}}return(n,t)=>(s(),l("div",X,[e("div",Y,[x.value?(s(),l("div",{key:0,class:"fixed inset-0 z-30 bg-black/20 backdrop-blur-sm lg:hidden",onClick:t[0]||(t[0]=r=>x.value=!1)})):d("",!0),e("aside",{class:u(["fixed inset-y-0 left-0 z-40 w-72 -translate-x-full bg-card/90 backdrop-blur-sm lg:backdrop-blur-none border-r border-border transition-transform duration-200 ease-out will-change-[transform] transform-gpu flex flex-col lg:static lg:translate-x-0 lg:bg-card/80 lg:border-b-0 lg:border-r lg:sticky lg:top-0 lg:h-screen",[{"translate-x-0":x.value,"w-20 lg:w-20":o.value}]])},[e("div",{class:u(["flex h-16 items-center justify-between px-6 pt-4 lg:h-20 lg:pt-5",o.value?"justify-center px-0":""])},[e("div",{class:u(["flex items-center gap-2",o.value?"gap-0 justify-center w-full":""])},[t[9]||(t[9]=e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"text-foreground transition-colors hover:text-primary","aria-label":"GitHub"},[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-6 w-6",fill:"currentColor"},[e("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.166 6.839 9.489.5.09.682-.217.682-.483 0-.237-.009-.868-.014-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.004.071 1.532 1.031 1.532 1.031.892 1.529 2.341 1.087 2.91.832.091-.647.349-1.087.636-1.337-2.22-.253-4.555-1.11-4.555-4.944 0-1.092.39-1.987 1.029-2.687-.103-.253-.446-1.272.098-2.65 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.295 2.748-1.026 2.748-1.026.546 1.378.202 2.397.1 2.65.64.7 1.028 1.595 1.028 2.687 0 3.842-2.338 4.687-4.566 4.936.359.309.678.919.678 1.852 0 1.337-.012 2.418-.012 2.747 0 .268.18.577.688.479A10.002 10.002 0 0 0 22 12c0-5.523-4.477-10-10-10z"})])],-1)),o.value?d("",!0):(s(),l("span",ee,"Gemini Business2API"))],2)],2),e("nav",{class:u(["pb-4 pt-4 lg:pt-6 flex-1 overflow-y-auto",o.value?"px-2":"px-3"])},[o.value?d("",!0):(s(),l("p",te," 导航 ")),e("div",re,[(s(),l(V,null,$(_,r=>m(a(k),{key:r.path,to:r.path,class:u(["group flex items-center rounded-2xl py-2 text-sm font-medium transition-colors overflow-hidden",D(r.path)]),title:o.value?r.label:void 0},{default:w(()=>[e("span",{class:u(["inline-flex h-9 w-9 items-center justify-center rounded-2xl border border-border",I(r.path)])},[(s(),l("svg",oe,[e("path",{d:r.icon},null,8,se)]))],2),o.value?d("",!0):(s(),l("span",ne,p(r.label),1)),o.value?d("",!0):(s(),l("span",le," 进入 "))]),_:2},1032,["to","class","title"])),64))])],2),e("div",ae,[o.value?d("",!0):(s(),l("div",ie,[...t[10]||(t[10]=[e("p",{class:"text-xs tracking-[0.12em] text-muted-foreground"},[e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 transition-colors hover:text-foreground"}," gemini-business2api "),e("span",null," · 声明")],-1),e("p",{class:"mt-2 text-xs text-muted-foreground"}," 本项目仅限学习与研究用途,禁止用于商业用途。请保留本声明、原作者信息与开源来源。 ",-1)])])),e("div",{class:u(["mt-4 flex items-center gap-3",o.value?"justify-center":""])},[o.value?d("",!0):(s(),l("button",{key:0,onClick:N,class:"flex-1 rounded-2xl border border-border bg-background px-4 py-3 text-sm font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:text-destructive"}," 退出登录 ")),e("button",{class:"h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-border text-muted-foreground transition-all hover:border-primary hover:text-primary flex",onClick:t[1]||(t[1]=r=>o.value=!o.value),title:o.value?"展开侧边栏":"收起侧边栏"},[...t[11]||(t[11]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 shrink-0",fill:"currentColor"},[e("path",{d:"M6 4h2v16H6V4zm4 4h8v2h-8V8zm0 6h8v2h-8v-2z"})],-1)])],8,de)],2)])],2),e("main",ue,[e("header",pe,[e("div",ce,[e("button",{class:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-border text-foreground transition-colors hover:border-primary hover:text-primary lg:hidden",onClick:t[2]||(t[2]=r=>x.value=!0),"aria-label":"打开导航"},[...t[12]||(t[12]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},[e("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])]),t[13]||(t[13]=K('<svg aria-hidden="true" viewBox="0 0 130 150" class="logo-mark h-9 w-9 shrink-0 text-foreground"><defs><filter id="head-shadow" x="-50%" y="-50%" width="200%" height="200%"><feDropShadow dx="0" dy="10" stdDeviation="12" flood-color="rgba(0, 188, 212, 0.2)"></feDropShadow></filter></defs><g class="logo-cat-wrapper" transform="translate(0, 12)"><g transform="translate(16, 20) rotate(-10, 9, 12)"><path d="M14 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g transform="translate(96, 20) rotate(10, 9, 12)"><path d="M4 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g filter="url(#head-shadow)"><path d="M 32 40 L 98 40 A 12 12 0 0 1 110 52 L 110 90 A 30 30 0 0 1 80 120 L 50 120 A 30 30 0 0 1 20 90 L 20 52 A 12 12 0 0 1 32 40 Z" fill="rgba(255, 255, 255, 0.9)" stroke="#2c3e50" stroke-width="3"></path></g><rect class="logo-eye" x="35" y="68" width="14" height="4" rx="1"></rect><rect class="logo-eye" x="81" y="68" width="14" height="4" rx="1"></rect></g></svg>',1)),e("h2",xe,p(B.value),1)]),e("div",fe,[e("button",{onClick:P,class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",title:"刷新"}," 刷新 "),e("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:R}," 接口信息 "),m(a(k),{to:"/public/uptime",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[14]||(t[14]=[A(" 状态监控 ",-1)])]),_:1}),m(a(k),{to:"/public/logs",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[15]||(t[15]=[A(" 公开日志 ",-1)])]),_:1})])]),e("div",me,[m(a(O))])])]),m(Q,{open:a(i).open.value,title:a(i).title.value,message:a(i).message.value,"confirm-text":a(i).confirmText.value,"cancel-text":a(i).cancelText.value,onConfirm:a(i).confirm,onCancel:a(i).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(s(),G(q,{to:"body"},[g.value?(s(),l("div",be,[e("div",ge,[e("div",ve,[t[16]||(t[16]=e("p",{class:"text-sm font-medium text-foreground"},"API 接口",-1)),e("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:t[3]||(t[3]=r=>g.value=!1)}," 关闭 ")]),t[22]||(t[22]=e("p",{class:"mt-2 text-xs text-muted-foreground"},"根据客户端选择对应接口",-1)),e("div",he,[e("div",null,[t[17]||(t[17]=e("p",{class:"text-xs text-muted-foreground"},"基础端点",-1)),e("div",ye,[e("p",we,p(v.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[4]||(t[4]=r=>h(v.value))}," 复制 ")])]),e("div",null,[t[18]||(t[18]=e("p",{class:"text-xs text-muted-foreground"},"SDK 接口",-1)),e("div",ke,[e("p",_e,p(z.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[5]||(t[5]=r=>h(z.value))}," 复制 ")])]),e("div",null,[t[19]||(t[19]=e("p",{class:"text-xs text-muted-foreground"},"完整接口",-1)),e("div",ze,[e("p",Ce,p(C.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[6]||(t[6]=r=>h(C.value))}," 复制 ")])]),e("div",null,[t[20]||(t[20]=e("p",{class:"text-xs text-muted-foreground"},"支持模型",-1)),e("div",He,[e("div",Me,[(s(),l(V,null,$(T,r=>e("span",{key:r,class:"rounded-full border border-border px-2 py-0.5 text-[11px]"},p(r),1)),64))])])]),e("div",null,[t[21]||(t[21]=e("p",{class:"text-xs text-muted-foreground"},"API 密钥",-1)),e("div",Se,[e("p",Ve,p(H.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[7]||(t[7]=r=>h(H.value))}," 复制 ")])])]),e("div",$e,[e("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:t[8]||(t[8]=r=>g.value=!1)}," 知道了 ")])])])):d("",!0)]))]))}});export{Ie as default};
static/assets/AppShell-CsF8NWoD.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as F,l as U,h as y,i as f,q as Z,s as S,c as l,a as e,x as m,y as G,b as d,n as u,F as V,r as $,z as K,t as p,A as w,u as a,R as k,B as O,T as q,p as E,f as A,e as s}from"./index-DrM07qAY.js";import{u as J}from"./settings-BYE7wugy.js";import{_ as Q}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-2Xqtgrin.js";import{u as W}from"./useConfirmDialog-CfZjR4ey.js";const X={class:"min-h-screen"},Y={class:"flex min-h-screen flex-col lg:flex-row"},ee={key:0,class:"text-base font-semibold text-foreground"},te={key:0,class:"px-3 pb-2 text-xs uppercase tracking-[0.28em] text-muted-foreground"},re={class:"space-y-1"},oe={"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},se=["d"],ne={key:0,class:"flex-1 min-w-0 truncate"},le={key:1,class:"ml-auto text-xs opacity-0 transition-opacity group-hover:opacity-100"},ae={class:"mt-auto border-t border-border px-6 py-3 lg:py-4"},ie={key:0,class:"rounded-2xl bg-secondary/60 p-3"},de=["title"],ue={class:"min-w-0 flex-1 overflow-hidden lg:ml-0"},pe={class:"min-w-0 flex flex-col gap-4 border-b border-border bg-card/70 px-6 py-5 backdrop-blur lg:flex-row lg:items-center lg:justify-between lg:px-10"},ce={class:"flex items-center gap-3"},xe={class:"text-xl font-semibold text-foreground lg:text-2xl"},fe={class:"flex flex-wrap items-center gap-3"},me={class:"h-full overflow-y-auto overflow-x-hidden bg-card/70 px-4 pb-10 pt-6 backdrop-blur lg:px-10 lg:pt-10"},be={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ge={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},ve={class:"flex items-center justify-between"},he={class:"mt-4 space-y-3 text-sm"},ye={class:"mt-1 flex items-start gap-2"},we={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ke={class:"mt-1 flex items-start gap-2"},_e={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ze={class:"mt-1 flex items-start gap-2"},Ce={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},He={class:"mt-1 rounded-2xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground"},Me={class:"flex flex-wrap gap-2 text-foreground"},Se={class:"mt-1 flex items-start gap-2"},Ve={class:"min-w-0 flex-1 rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},$e={class:"mt-6 flex items-center justify-end"},Ie=F({__name:"AppShell",setup(Ae){const L=E(),b=Z(),j=U(),c=J(),x=y(!1),o=y(!1),i=W(),g=y(!1),_=[{path:"/",label:"概览",icon:"M4 4h7v7H4V4zm9 0h7v4h-7V4zm0 6h7v10h-7V10zM4 13h7v7H4v-7z"},{path:"/accounts",label:"账号管理",icon:"M12 12a3.5 3.5 0 1 0-3.5-3.5A3.5 3.5 0 0 0 12 12zm0 2c-4.1 0-7.5 2.2-7.5 5v1h15v-1c0-2.8-3.4-5-7.5-5z"},{path:"/settings",label:"系统设置",icon:"M4 6h10v2H4V6zm12 0h4v2h-4V6zM4 11h6v2H4v-2zm8 0h8v2h-8v-2zM4 16h10v2H4v-2zm12 0h4v2h-4v-2z"},{path:"/monitor",label:"监控状态",icon:"M3 12h4l2-4 4 8 3-6h5v2h-4l-4 8-4-8-2 4H3v-2z"},{path:"/logs",label:"运行日志",icon:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h10v2H4v-2z"},{path:"/docs",label:"文档中心",icon:"M6 3h9l4 4v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm8 1.5V8h3.5L14 4.5zM8 11h8v2H8v-2zm0 4h8v2H8v-2z"}],B=f(()=>_.find(t=>t.path===b.path)?.label||"概览"),D=n=>{const r=`transition-colors ${o.value?"px-2 justify-center gap-0":"px-3 gap-3"}`;return b.path===n?`${r} bg-primary text-primary-foreground`:`${r} text-muted-foreground hover:bg-accent hover:text-accent-foreground`},I=n=>b.path===n?"bg-primary-foreground/15 text-primary-foreground border-primary-foreground/40":"bg-secondary text-muted-foreground group-hover:text-accent-foreground",v=f(()=>(c.settings?.basic?.base_url||""||window.location.origin).replace(/\/$/,"")),z=f(()=>`${v.value}/v1`),C=f(()=>`${v.value}/v1/chat/completions`),H=f(()=>c.settings?.basic?.api_key||"未设置"),T=["gemini-auto","gemini-2.5-flash","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview"];S(()=>b.path,()=>{x.value=!1});const M=localStorage.getItem("sidebar-collapsed");M&&(o.value=M==="true"),S(o,n=>{localStorage.setItem("sidebar-collapsed",n?"true":"false")});async function N(){await i.ask({title:"退出登录",message:"确定退出管理控制台吗?"})&&(await j.logout(),L.push({name:"login"}))}function P(){window.location.reload()}async function R(){g.value=!0,!c.settings&&!c.isLoading&&await c.loadSettings()}async function h(n){if(n)try{await navigator.clipboard.writeText(n)}catch(t){console.error("Copy failed",t)}}return(n,t)=>(s(),l("div",X,[e("div",Y,[x.value?(s(),l("div",{key:0,class:"fixed inset-0 z-30 bg-black/20 backdrop-blur-sm lg:hidden",onClick:t[0]||(t[0]=r=>x.value=!1)})):d("",!0),e("aside",{class:u(["fixed inset-y-0 left-0 z-40 w-72 -translate-x-full bg-card/90 backdrop-blur-sm lg:backdrop-blur-none border-r border-border transition-transform duration-200 ease-out will-change-[transform] transform-gpu flex flex-col lg:static lg:translate-x-0 lg:bg-card/80 lg:border-b-0 lg:border-r lg:sticky lg:top-0 lg:h-screen",[{"translate-x-0":x.value,"w-20 lg:w-20":o.value}]])},[e("div",{class:u(["flex h-16 items-center justify-between px-6 pt-4 lg:h-20 lg:pt-5",o.value?"justify-center px-0":""])},[e("div",{class:u(["flex items-center gap-2",o.value?"gap-0 justify-center w-full":""])},[t[9]||(t[9]=e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"text-foreground transition-colors hover:text-primary","aria-label":"GitHub"},[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-6 w-6",fill:"currentColor"},[e("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.166 6.839 9.489.5.09.682-.217.682-.483 0-.237-.009-.868-.014-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.004.071 1.532 1.031 1.532 1.031.892 1.529 2.341 1.087 2.91.832.091-.647.349-1.087.636-1.337-2.22-.253-4.555-1.11-4.555-4.944 0-1.092.39-1.987 1.029-2.687-.103-.253-.446-1.272.098-2.65 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.295 2.748-1.026 2.748-1.026.546 1.378.202 2.397.1 2.65.64.7 1.028 1.595 1.028 2.687 0 3.842-2.338 4.687-4.566 4.936.359.309.678.919.678 1.852 0 1.337-.012 2.418-.012 2.747 0 .268.18.577.688.479A10.002 10.002 0 0 0 22 12c0-5.523-4.477-10-10-10z"})])],-1)),o.value?d("",!0):(s(),l("span",ee,"Gemini Business2API"))],2)],2),e("nav",{class:u(["pb-4 pt-4 lg:pt-6 flex-1 overflow-y-auto",o.value?"px-2":"px-3"])},[o.value?d("",!0):(s(),l("p",te," 导航 ")),e("div",re,[(s(),l(V,null,$(_,r=>m(a(k),{key:r.path,to:r.path,class:u(["group flex items-center rounded-2xl py-2 text-sm font-medium transition-colors overflow-hidden",D(r.path)]),title:o.value?r.label:void 0},{default:w(()=>[e("span",{class:u(["inline-flex h-9 w-9 items-center justify-center rounded-2xl border border-border",I(r.path)])},[(s(),l("svg",oe,[e("path",{d:r.icon},null,8,se)]))],2),o.value?d("",!0):(s(),l("span",ne,p(r.label),1)),o.value?d("",!0):(s(),l("span",le," 进入 "))]),_:2},1032,["to","class","title"])),64))])],2),e("div",ae,[o.value?d("",!0):(s(),l("div",ie,[...t[10]||(t[10]=[e("p",{class:"text-xs tracking-[0.12em] text-muted-foreground"},[e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 transition-colors hover:text-foreground"}," gemini-business2api "),e("span",null," · 声明")],-1),e("p",{class:"mt-2 text-xs text-muted-foreground"}," 本项目仅限学习与研究用途,禁止用于商业用途。请保留本声明、原作者信息与开源来源。 ",-1)])])),e("div",{class:u(["mt-4 flex items-center gap-3",o.value?"justify-center":""])},[o.value?d("",!0):(s(),l("button",{key:0,onClick:N,class:"flex-1 rounded-2xl border border-border bg-background px-4 py-3 text-sm font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:text-destructive"}," 退出登录 ")),e("button",{class:"h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-border text-muted-foreground transition-all hover:border-primary hover:text-primary flex",onClick:t[1]||(t[1]=r=>o.value=!o.value),title:o.value?"展开侧边栏":"收起侧边栏"},[...t[11]||(t[11]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 shrink-0",fill:"currentColor"},[e("path",{d:"M6 4h2v16H6V4zm4 4h8v2h-8V8zm0 6h8v2h-8v-2z"})],-1)])],8,de)],2)])],2),e("main",ue,[e("header",pe,[e("div",ce,[e("button",{class:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-border text-foreground transition-colors hover:border-primary hover:text-primary lg:hidden",onClick:t[2]||(t[2]=r=>x.value=!0),"aria-label":"打开导航"},[...t[12]||(t[12]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},[e("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])]),t[13]||(t[13]=K('<svg aria-hidden="true" viewBox="0 0 130 150" class="logo-mark h-9 w-9 shrink-0 text-foreground"><defs><filter id="head-shadow" x="-50%" y="-50%" width="200%" height="200%"><feDropShadow dx="0" dy="10" stdDeviation="12" flood-color="rgba(0, 188, 212, 0.2)"></feDropShadow></filter></defs><g class="logo-cat-wrapper" transform="translate(0, 12)"><g transform="translate(16, 20) rotate(-10, 9, 12)"><path d="M14 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g transform="translate(96, 20) rotate(10, 9, 12)"><path d="M4 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g filter="url(#head-shadow)"><path d="M 32 40 L 98 40 A 12 12 0 0 1 110 52 L 110 90 A 30 30 0 0 1 80 120 L 50 120 A 30 30 0 0 1 20 90 L 20 52 A 12 12 0 0 1 32 40 Z" fill="rgba(255, 255, 255, 0.9)" stroke="#2c3e50" stroke-width="3"></path></g><rect class="logo-eye" x="35" y="68" width="14" height="4" rx="1"></rect><rect class="logo-eye" x="81" y="68" width="14" height="4" rx="1"></rect></g></svg>',1)),e("h2",xe,p(B.value),1)]),e("div",fe,[e("button",{onClick:P,class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",title:"刷新"}," 刷新 "),e("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:R}," 接口信息 "),m(a(k),{to:"/public/uptime",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[14]||(t[14]=[A(" 状态监控 ",-1)])]),_:1}),m(a(k),{to:"/public/logs",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[15]||(t[15]=[A(" 公开日志 ",-1)])]),_:1})])]),e("div",me,[m(a(O))])])]),m(Q,{open:a(i).open.value,title:a(i).title.value,message:a(i).message.value,"confirm-text":a(i).confirmText.value,"cancel-text":a(i).cancelText.value,onConfirm:a(i).confirm,onCancel:a(i).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(s(),G(q,{to:"body"},[g.value?(s(),l("div",be,[e("div",ge,[e("div",ve,[t[16]||(t[16]=e("p",{class:"text-sm font-medium text-foreground"},"API 接口",-1)),e("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:t[3]||(t[3]=r=>g.value=!1)}," 关闭 ")]),t[22]||(t[22]=e("p",{class:"mt-2 text-xs text-muted-foreground"},"根据客户端选择对应接口",-1)),e("div",he,[e("div",null,[t[17]||(t[17]=e("p",{class:"text-xs text-muted-foreground"},"基础端点",-1)),e("div",ye,[e("p",we,p(v.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[4]||(t[4]=r=>h(v.value))}," 复制 ")])]),e("div",null,[t[18]||(t[18]=e("p",{class:"text-xs text-muted-foreground"},"SDK 接口",-1)),e("div",ke,[e("p",_e,p(z.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[5]||(t[5]=r=>h(z.value))}," 复制 ")])]),e("div",null,[t[19]||(t[19]=e("p",{class:"text-xs text-muted-foreground"},"完整接口",-1)),e("div",ze,[e("p",Ce,p(C.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[6]||(t[6]=r=>h(C.value))}," 复制 ")])]),e("div",null,[t[20]||(t[20]=e("p",{class:"text-xs text-muted-foreground"},"支持模型",-1)),e("div",He,[e("div",Me,[(s(),l(V,null,$(T,r=>e("span",{key:r,class:"rounded-full border border-border px-2 py-0.5 text-[11px]"},p(r),1)),64))])])]),e("div",null,[t[21]||(t[21]=e("p",{class:"text-xs text-muted-foreground"},"API 密钥",-1)),e("div",Se,[e("p",Ve,p(H.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[7]||(t[7]=r=>h(H.value))}," 复制 ")])])]),e("div",$e,[e("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:t[8]||(t[8]=r=>g.value=!1)}," 知道了 ")])])])):d("",!0)]))]))}});export{Ie as default};
static/assets/AppShell-D4_kHEqh.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as F,l as U,h as y,i as f,z as Z,A as S,c as l,a as e,p as m,m as G,b as d,n as u,F as V,r as $,B as K,t as p,s as w,u as a,R as k,C as O,x as E,y as q,f as A,e as s}from"./index-B38eA7T4.js";import{u as J}from"./settings-CVW1vhYs.js";import{_ as Q}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-B4oTz-IR.js";import{u as W}from"./useConfirmDialog-DRJ5fetN.js";const X={class:"min-h-screen"},Y={class:"flex min-h-screen flex-col lg:flex-row"},ee={key:0,class:"text-base font-semibold text-foreground"},te={key:0,class:"px-3 pb-2 text-xs uppercase tracking-[0.28em] text-muted-foreground"},re={class:"space-y-1"},oe={"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},se=["d"],ne={key:0,class:"flex-1 min-w-0 truncate"},le={key:1,class:"ml-auto text-xs opacity-0 transition-opacity group-hover:opacity-100"},ae={class:"mt-auto border-t border-border px-6 py-3 lg:py-4"},ie={key:0,class:"rounded-2xl bg-secondary/60 p-3"},de=["title"],ue={class:"min-w-0 flex-1 overflow-hidden lg:ml-0"},pe={class:"min-w-0 flex flex-col gap-4 border-b border-border bg-card/70 px-6 py-5 backdrop-blur lg:flex-row lg:items-center lg:justify-between lg:px-10"},ce={class:"flex items-center gap-3"},xe={class:"text-xl font-semibold text-foreground lg:text-2xl"},fe={class:"flex flex-wrap items-center gap-3"},me={class:"h-full overflow-y-auto overflow-x-hidden bg-card/70 px-4 pb-10 pt-6 backdrop-blur lg:px-10 lg:pt-10"},be={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ge={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},ve={class:"flex items-center justify-between"},he={class:"mt-4 space-y-3 text-sm"},ye={class:"mt-1 flex items-start gap-2"},we={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ke={class:"mt-1 flex items-start gap-2"},_e={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ze={class:"mt-1 flex items-start gap-2"},Ce={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},He={class:"mt-1 rounded-2xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground"},Me={class:"flex flex-wrap gap-2 text-foreground"},Se={class:"mt-1 flex items-start gap-2"},Ve={class:"min-w-0 flex-1 rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},$e={class:"mt-6 flex items-center justify-end"},Ie=F({__name:"AppShell",setup(Ae){const L=q(),b=Z(),j=U(),c=J(),x=y(!1),o=y(!1),i=W(),g=y(!1),_=[{path:"/",label:"概览",icon:"M4 4h7v7H4V4zm9 0h7v4h-7V4zm0 6h7v10h-7V10zM4 13h7v7H4v-7z"},{path:"/accounts",label:"账号管理",icon:"M12 12a3.5 3.5 0 1 0-3.5-3.5A3.5 3.5 0 0 0 12 12zm0 2c-4.1 0-7.5 2.2-7.5 5v1h15v-1c0-2.8-3.4-5-7.5-5z"},{path:"/settings",label:"系统设置",icon:"M4 6h10v2H4V6zm12 0h4v2h-4V6zM4 11h6v2H4v-2zm8 0h8v2h-8v-2zM4 16h10v2H4v-2zm12 0h4v2h-4v-2z"},{path:"/monitor",label:"监控状态",icon:"M3 12h4l2-4 4 8 3-6h5v2h-4l-4 8-4-8-2 4H3v-2z"},{path:"/logs",label:"运行日志",icon:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h10v2H4v-2z"},{path:"/docs",label:"文档中心",icon:"M6 3h9l4 4v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm8 1.5V8h3.5L14 4.5zM8 11h8v2H8v-2zm0 4h8v2H8v-2z"}],B=f(()=>_.find(t=>t.path===b.path)?.label||"概览"),D=n=>{const r=`transition-colors ${o.value?"px-2 justify-center gap-0":"px-3 gap-3"}`;return b.path===n?`${r} bg-primary text-primary-foreground`:`${r} text-muted-foreground hover:bg-accent hover:text-accent-foreground`},I=n=>b.path===n?"bg-primary-foreground/15 text-primary-foreground border-primary-foreground/40":"bg-secondary text-muted-foreground group-hover:text-accent-foreground",v=f(()=>(c.settings?.basic?.base_url||""||window.location.origin).replace(/\/$/,"")),z=f(()=>`${v.value}/v1`),C=f(()=>`${v.value}/v1/chat/completions`),H=f(()=>c.settings?.basic?.api_key||"未设置"),T=["gemini-auto","gemini-2.5-flash","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview"];S(()=>b.path,()=>{x.value=!1});const M=localStorage.getItem("sidebar-collapsed");M&&(o.value=M==="true"),S(o,n=>{localStorage.setItem("sidebar-collapsed",n?"true":"false")});async function N(){await i.ask({title:"退出登录",message:"确定退出管理控制台吗?"})&&(await j.logout(),L.push({name:"login"}))}function P(){window.location.reload()}async function R(){g.value=!0,!c.settings&&!c.isLoading&&await c.loadSettings()}async function h(n){if(n)try{await navigator.clipboard.writeText(n)}catch(t){console.error("Copy failed",t)}}return(n,t)=>(s(),l("div",X,[e("div",Y,[x.value?(s(),l("div",{key:0,class:"fixed inset-0 z-30 bg-black/20 backdrop-blur-sm lg:hidden",onClick:t[0]||(t[0]=r=>x.value=!1)})):d("",!0),e("aside",{class:u(["fixed inset-y-0 left-0 z-40 w-72 -translate-x-full bg-card/90 backdrop-blur-sm lg:backdrop-blur-none border-r border-border transition-[width,transform] duration-200 ease-out will-change-[transform] transform-gpu flex flex-col lg:static lg:translate-x-0 lg:bg-card/80 lg:border-b-0 lg:border-r lg:sticky lg:top-0 lg:h-screen",[{"translate-x-0":x.value,"w-20 lg:w-20":o.value}]])},[e("div",{class:u(["flex h-16 items-center justify-between px-6 pt-4 lg:h-20 lg:pt-5",o.value?"justify-center px-0":""])},[e("div",{class:u(["flex items-center gap-2",o.value?"gap-0 justify-center w-full":""])},[t[9]||(t[9]=e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"text-foreground transition-colors hover:text-primary","aria-label":"GitHub"},[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-6 w-6",fill:"currentColor"},[e("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.166 6.839 9.489.5.09.682-.217.682-.483 0-.237-.009-.868-.014-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.004.071 1.532 1.031 1.532 1.031.892 1.529 2.341 1.087 2.91.832.091-.647.349-1.087.636-1.337-2.22-.253-4.555-1.11-4.555-4.944 0-1.092.39-1.987 1.029-2.687-.103-.253-.446-1.272.098-2.65 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.295 2.748-1.026 2.748-1.026.546 1.378.202 2.397.1 2.65.64.7 1.028 1.595 1.028 2.687 0 3.842-2.338 4.687-4.566 4.936.359.309.678.919.678 1.852 0 1.337-.012 2.418-.012 2.747 0 .268.18.577.688.479A10.002 10.002 0 0 0 22 12c0-5.523-4.477-10-10-10z"})])],-1)),o.value?d("",!0):(s(),l("span",ee,"Gemini Business2API"))],2)],2),e("nav",{class:u(["pb-4 pt-4 lg:pt-6 flex-1 overflow-y-auto",o.value?"px-2":"px-3"])},[o.value?d("",!0):(s(),l("p",te," 导航 ")),e("div",re,[(s(),l(V,null,$(_,r=>m(a(k),{key:r.path,to:r.path,class:u(["group flex items-center rounded-2xl py-2 text-sm font-medium transition-colors overflow-hidden",D(r.path)]),title:o.value?r.label:void 0},{default:w(()=>[e("span",{class:u(["inline-flex h-9 w-9 items-center justify-center rounded-2xl border border-border",I(r.path)])},[(s(),l("svg",oe,[e("path",{d:r.icon},null,8,se)]))],2),o.value?d("",!0):(s(),l("span",ne,p(r.label),1)),o.value?d("",!0):(s(),l("span",le," 进入 "))]),_:2},1032,["to","class","title"])),64))])],2),e("div",ae,[o.value?d("",!0):(s(),l("div",ie,[...t[10]||(t[10]=[e("p",{class:"text-xs tracking-[0.12em] text-muted-foreground"},[e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 transition-colors hover:text-foreground"}," gemini-business2api "),e("span",null," · 声明")],-1),e("p",{class:"mt-2 text-xs text-muted-foreground"}," 本项目仅限学习与研究用途,禁止用于商业用途。请保留本声明、原作者信息与开源来源。 ",-1)])])),e("div",{class:u(["mt-4 flex items-center gap-3",o.value?"justify-center":""])},[o.value?d("",!0):(s(),l("button",{key:0,onClick:N,class:"flex-1 rounded-2xl border border-border bg-background px-4 py-3 text-sm font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:text-destructive"}," 退出登录 ")),e("button",{class:"h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-border text-muted-foreground transition-all hover:border-primary hover:text-primary flex",onClick:t[1]||(t[1]=r=>o.value=!o.value),title:o.value?"展开侧边栏":"收起侧边栏"},[...t[11]||(t[11]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 shrink-0",fill:"currentColor"},[e("path",{d:"M6 4h2v16H6V4zm4 4h8v2h-8V8zm0 6h8v2h-8v-2z"})],-1)])],8,de)],2)])],2),e("main",ue,[e("header",pe,[e("div",ce,[e("button",{class:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-border text-foreground transition-colors hover:border-primary hover:text-primary lg:hidden",onClick:t[2]||(t[2]=r=>x.value=!0),"aria-label":"打开导航"},[...t[12]||(t[12]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},[e("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])]),t[13]||(t[13]=K('<svg aria-hidden="true" viewBox="0 0 130 150" class="logo-mark h-9 w-9 shrink-0 text-foreground"><defs><filter id="head-shadow" x="-50%" y="-50%" width="200%" height="200%"><feDropShadow dx="0" dy="10" stdDeviation="12" flood-color="rgba(0, 188, 212, 0.2)"></feDropShadow></filter></defs><g class="logo-cat-wrapper" transform="translate(0, 12)"><g transform="translate(16, 20) rotate(-10, 9, 12)"><path d="M14 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g transform="translate(96, 20) rotate(10, 9, 12)"><path d="M4 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g filter="url(#head-shadow)"><path d="M 32 40 L 98 40 A 12 12 0 0 1 110 52 L 110 90 A 30 30 0 0 1 80 120 L 50 120 A 30 30 0 0 1 20 90 L 20 52 A 12 12 0 0 1 32 40 Z" fill="rgba(255, 255, 255, 0.9)" stroke="#2c3e50" stroke-width="3"></path></g><rect class="logo-eye" x="35" y="68" width="14" height="4" rx="1"></rect><rect class="logo-eye" x="81" y="68" width="14" height="4" rx="1"></rect></g></svg>',1)),e("h2",xe,p(B.value),1)]),e("div",fe,[e("button",{onClick:P,class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",title:"刷新"}," ��新 "),e("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:R}," 接口信息 "),m(a(k),{to:"/public/uptime",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[14]||(t[14]=[A(" 状态监控 ",-1)])]),_:1}),m(a(k),{to:"/public/logs",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[15]||(t[15]=[A(" 公开日志 ",-1)])]),_:1})])]),e("div",me,[m(a(O))])])]),m(Q,{open:a(i).open.value,title:a(i).title.value,message:a(i).message.value,"confirm-text":a(i).confirmText.value,"cancel-text":a(i).cancelText.value,onConfirm:a(i).confirm,onCancel:a(i).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(s(),G(E,{to:"body"},[g.value?(s(),l("div",be,[e("div",ge,[e("div",ve,[t[16]||(t[16]=e("p",{class:"text-sm font-medium text-foreground"},"API 接口",-1)),e("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:t[3]||(t[3]=r=>g.value=!1)}," 关闭 ")]),t[22]||(t[22]=e("p",{class:"mt-2 text-xs text-muted-foreground"},"根据客户端选择对应接口",-1)),e("div",he,[e("div",null,[t[17]||(t[17]=e("p",{class:"text-xs text-muted-foreground"},"基础端点",-1)),e("div",ye,[e("p",we,p(v.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[4]||(t[4]=r=>h(v.value))}," 复制 ")])]),e("div",null,[t[18]||(t[18]=e("p",{class:"text-xs text-muted-foreground"},"SDK 接口",-1)),e("div",ke,[e("p",_e,p(z.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[5]||(t[5]=r=>h(z.value))}," 复制 ")])]),e("div",null,[t[19]||(t[19]=e("p",{class:"text-xs text-muted-foreground"},"完整接口",-1)),e("div",ze,[e("p",Ce,p(C.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[6]||(t[6]=r=>h(C.value))}," 复制 ")])]),e("div",null,[t[20]||(t[20]=e("p",{class:"text-xs text-muted-foreground"},"支持模型",-1)),e("div",He,[e("div",Me,[(s(),l(V,null,$(T,r=>e("span",{key:r,class:"rounded-full border border-border px-2 py-0.5 text-[11px]"},p(r),1)),64))])])]),e("div",null,[t[21]||(t[21]=e("p",{class:"text-xs text-muted-foreground"},"API 密钥",-1)),e("div",Se,[e("p",Ve,p(H.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[7]||(t[7]=r=>h(H.value))}," 复制 ")])])]),e("div",$e,[e("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:t[8]||(t[8]=r=>g.value=!1)}," 知道了 ")])])])):d("",!0)]))]))}});export{Ie as default};
static/assets/AppShell-D6boa7bt.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as F,l as U,h as y,i as f,q as Z,s as S,c as l,a as e,x as m,y as G,b as d,n as u,F as V,r as $,z as K,t as p,A as w,u as a,R as k,B as O,T as q,p as E,f as A,e as s}from"./index-Bh_hLcqi.js";import{u as J}from"./settings-D1FY5IP9.js";import{_ as Q}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-B-fGXmXJ.js";import{u as W}from"./useConfirmDialog-CSNT_h0m.js";const X={class:"min-h-screen"},Y={class:"flex min-h-screen flex-col lg:flex-row"},ee={key:0,class:"text-base font-semibold text-foreground"},te={key:0,class:"px-3 pb-2 text-xs uppercase tracking-[0.28em] text-muted-foreground"},re={class:"space-y-1"},oe={"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},se=["d"],ne={key:0,class:"flex-1 min-w-0 truncate"},le={key:1,class:"ml-auto text-xs opacity-0 transition-opacity group-hover:opacity-100"},ae={class:"mt-auto border-t border-border px-6 py-3 lg:py-4"},ie={key:0,class:"rounded-2xl bg-secondary/60 p-3"},de=["title"],ue={class:"min-w-0 flex-1 overflow-hidden lg:ml-0"},pe={class:"min-w-0 flex flex-col gap-4 border-b border-border bg-card/70 px-6 py-5 backdrop-blur lg:flex-row lg:items-center lg:justify-between lg:px-10"},ce={class:"flex items-center gap-3"},xe={class:"text-xl font-semibold text-foreground lg:text-2xl"},fe={class:"flex flex-wrap items-center gap-3"},me={class:"h-full overflow-y-auto overflow-x-hidden bg-card/70 px-4 pb-10 pt-6 backdrop-blur lg:px-10 lg:pt-10"},be={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ge={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},ve={class:"flex items-center justify-between"},he={class:"mt-4 space-y-3 text-sm"},ye={class:"mt-1 flex items-start gap-2"},we={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ke={class:"mt-1 flex items-start gap-2"},_e={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ze={class:"mt-1 flex items-start gap-2"},Ce={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},He={class:"mt-1 rounded-2xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground"},Me={class:"flex flex-wrap gap-2 text-foreground"},Se={class:"mt-1 flex items-start gap-2"},Ve={class:"min-w-0 flex-1 rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},$e={class:"mt-6 flex items-center justify-end"},Ie=F({__name:"AppShell",setup(Ae){const L=E(),b=Z(),j=U(),c=J(),x=y(!1),o=y(!1),i=W(),g=y(!1),_=[{path:"/",label:"概览",icon:"M4 4h7v7H4V4zm9 0h7v4h-7V4zm0 6h7v10h-7V10zM4 13h7v7H4v-7z"},{path:"/accounts",label:"账号管理",icon:"M12 12a3.5 3.5 0 1 0-3.5-3.5A3.5 3.5 0 0 0 12 12zm0 2c-4.1 0-7.5 2.2-7.5 5v1h15v-1c0-2.8-3.4-5-7.5-5z"},{path:"/settings",label:"系统设置",icon:"M4 6h10v2H4V6zm12 0h4v2h-4V6zM4 11h6v2H4v-2zm8 0h8v2h-8v-2zM4 16h10v2H4v-2zm12 0h4v2h-4v-2z"},{path:"/monitor",label:"监控状态",icon:"M3 12h4l2-4 4 8 3-6h5v2h-4l-4 8-4-8-2 4H3v-2z"},{path:"/logs",label:"运行日志",icon:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h10v2H4v-2z"},{path:"/docs",label:"文档中心",icon:"M6 3h9l4 4v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm8 1.5V8h3.5L14 4.5zM8 11h8v2H8v-2zm0 4h8v2H8v-2z"}],B=f(()=>_.find(t=>t.path===b.path)?.label||"概览"),D=n=>{const r=`transition-colors ${o.value?"px-2 justify-center gap-0":"px-3 gap-3"}`;return b.path===n?`${r} bg-primary text-primary-foreground`:`${r} text-muted-foreground hover:bg-accent hover:text-accent-foreground`},I=n=>b.path===n?"bg-primary-foreground/15 text-primary-foreground border-primary-foreground/40":"bg-secondary text-muted-foreground group-hover:text-accent-foreground",v=f(()=>(c.settings?.basic?.base_url||""||window.location.origin).replace(/\/$/,"")),z=f(()=>`${v.value}/v1`),C=f(()=>`${v.value}/v1/chat/completions`),H=f(()=>c.settings?.basic?.api_key||"未设置"),T=["gemini-auto","gemini-2.5-flash","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview"];S(()=>b.path,()=>{x.value=!1});const M=localStorage.getItem("sidebar-collapsed");M&&(o.value=M==="true"),S(o,n=>{localStorage.setItem("sidebar-collapsed",n?"true":"false")});async function N(){await i.ask({title:"退出登录",message:"确定退出管理控制台吗?"})&&(await j.logout(),L.push({name:"login"}))}function P(){window.location.reload()}async function R(){g.value=!0,!c.settings&&!c.isLoading&&await c.loadSettings()}async function h(n){if(n)try{await navigator.clipboard.writeText(n)}catch(t){console.error("Copy failed",t)}}return(n,t)=>(s(),l("div",X,[e("div",Y,[x.value?(s(),l("div",{key:0,class:"fixed inset-0 z-30 bg-black/20 backdrop-blur-sm lg:hidden",onClick:t[0]||(t[0]=r=>x.value=!1)})):d("",!0),e("aside",{class:u(["fixed inset-y-0 left-0 z-40 w-72 -translate-x-full bg-card/90 backdrop-blur-sm lg:backdrop-blur-none border-r border-border transition-transform duration-200 ease-out will-change-[transform] transform-gpu flex flex-col lg:static lg:translate-x-0 lg:bg-card/80 lg:border-b-0 lg:border-r lg:sticky lg:top-0 lg:h-screen",[{"translate-x-0":x.value,"w-20 lg:w-20":o.value}]])},[e("div",{class:u(["flex h-16 items-center justify-between px-6 pt-4 lg:h-20 lg:pt-5",o.value?"justify-center px-0":""])},[e("div",{class:u(["flex items-center gap-2",o.value?"gap-0 justify-center w-full":""])},[t[9]||(t[9]=e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"text-foreground transition-colors hover:text-primary","aria-label":"GitHub"},[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-6 w-6",fill:"currentColor"},[e("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.166 6.839 9.489.5.09.682-.217.682-.483 0-.237-.009-.868-.014-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.004.071 1.532 1.031 1.532 1.031.892 1.529 2.341 1.087 2.91.832.091-.647.349-1.087.636-1.337-2.22-.253-4.555-1.11-4.555-4.944 0-1.092.39-1.987 1.029-2.687-.103-.253-.446-1.272.098-2.65 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.295 2.748-1.026 2.748-1.026.546 1.378.202 2.397.1 2.65.64.7 1.028 1.595 1.028 2.687 0 3.842-2.338 4.687-4.566 4.936.359.309.678.919.678 1.852 0 1.337-.012 2.418-.012 2.747 0 .268.18.577.688.479A10.002 10.002 0 0 0 22 12c0-5.523-4.477-10-10-10z"})])],-1)),o.value?d("",!0):(s(),l("span",ee,"Gemini Business2API"))],2)],2),e("nav",{class:u(["pb-4 pt-4 lg:pt-6 flex-1 overflow-y-auto",o.value?"px-2":"px-3"])},[o.value?d("",!0):(s(),l("p",te," 导航 ")),e("div",re,[(s(),l(V,null,$(_,r=>m(a(k),{key:r.path,to:r.path,class:u(["group flex items-center rounded-2xl py-2 text-sm font-medium transition-colors overflow-hidden",D(r.path)]),title:o.value?r.label:void 0},{default:w(()=>[e("span",{class:u(["inline-flex h-9 w-9 items-center justify-center rounded-2xl border border-border",I(r.path)])},[(s(),l("svg",oe,[e("path",{d:r.icon},null,8,se)]))],2),o.value?d("",!0):(s(),l("span",ne,p(r.label),1)),o.value?d("",!0):(s(),l("span",le," 进入 "))]),_:2},1032,["to","class","title"])),64))])],2),e("div",ae,[o.value?d("",!0):(s(),l("div",ie,[...t[10]||(t[10]=[e("p",{class:"text-xs tracking-[0.12em] text-muted-foreground"},[e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 transition-colors hover:text-foreground"}," gemini-business2api "),e("span",null," · 声明")],-1),e("p",{class:"mt-2 text-xs text-muted-foreground"}," 本项目仅限学习与研究用途,禁止用于商业用途。请保留本声明、原作者信息与开源来源。 ",-1)])])),e("div",{class:u(["mt-4 flex items-center gap-3",o.value?"justify-center":""])},[o.value?d("",!0):(s(),l("button",{key:0,onClick:N,class:"flex-1 rounded-2xl border border-border bg-background px-4 py-3 text-sm font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:text-destructive"}," 退出登录 ")),e("button",{class:"h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-border text-muted-foreground transition-all hover:border-primary hover:text-primary flex",onClick:t[1]||(t[1]=r=>o.value=!o.value),title:o.value?"展开侧边栏":"收起侧边栏"},[...t[11]||(t[11]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 shrink-0",fill:"currentColor"},[e("path",{d:"M6 4h2v16H6V4zm4 4h8v2h-8V8zm0 6h8v2h-8v-2z"})],-1)])],8,de)],2)])],2),e("main",ue,[e("header",pe,[e("div",ce,[e("button",{class:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-border text-foreground transition-colors hover:border-primary hover:text-primary lg:hidden",onClick:t[2]||(t[2]=r=>x.value=!0),"aria-label":"打开导航"},[...t[12]||(t[12]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},[e("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])]),t[13]||(t[13]=K('<svg aria-hidden="true" viewBox="0 0 130 150" class="logo-mark h-9 w-9 shrink-0 text-foreground"><defs><filter id="head-shadow" x="-50%" y="-50%" width="200%" height="200%"><feDropShadow dx="0" dy="10" stdDeviation="12" flood-color="rgba(0, 188, 212, 0.2)"></feDropShadow></filter></defs><g class="logo-cat-wrapper" transform="translate(0, 12)"><g transform="translate(16, 20) rotate(-10, 9, 12)"><path d="M14 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g transform="translate(96, 20) rotate(10, 9, 12)"><path d="M4 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g filter="url(#head-shadow)"><path d="M 32 40 L 98 40 A 12 12 0 0 1 110 52 L 110 90 A 30 30 0 0 1 80 120 L 50 120 A 30 30 0 0 1 20 90 L 20 52 A 12 12 0 0 1 32 40 Z" fill="rgba(255, 255, 255, 0.9)" stroke="#2c3e50" stroke-width="3"></path></g><rect class="logo-eye" x="35" y="68" width="14" height="4" rx="1"></rect><rect class="logo-eye" x="81" y="68" width="14" height="4" rx="1"></rect></g></svg>',1)),e("h2",xe,p(B.value),1)]),e("div",fe,[e("button",{onClick:P,class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",title:"刷新"}," 刷新 "),e("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:R}," 接口信息 "),m(a(k),{to:"/public/uptime",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[14]||(t[14]=[A(" 状态监控 ",-1)])]),_:1}),m(a(k),{to:"/public/logs",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[15]||(t[15]=[A(" 公开日志 ",-1)])]),_:1})])]),e("div",me,[m(a(O))])])]),m(Q,{open:a(i).open.value,title:a(i).title.value,message:a(i).message.value,"confirm-text":a(i).confirmText.value,"cancel-text":a(i).cancelText.value,onConfirm:a(i).confirm,onCancel:a(i).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(s(),G(q,{to:"body"},[g.value?(s(),l("div",be,[e("div",ge,[e("div",ve,[t[16]||(t[16]=e("p",{class:"text-sm font-medium text-foreground"},"API 接口",-1)),e("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:t[3]||(t[3]=r=>g.value=!1)}," 关闭 ")]),t[22]||(t[22]=e("p",{class:"mt-2 text-xs text-muted-foreground"},"根据客户端选择对应接口",-1)),e("div",he,[e("div",null,[t[17]||(t[17]=e("p",{class:"text-xs text-muted-foreground"},"基础端点",-1)),e("div",ye,[e("p",we,p(v.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[4]||(t[4]=r=>h(v.value))}," 复制 ")])]),e("div",null,[t[18]||(t[18]=e("p",{class:"text-xs text-muted-foreground"},"SDK 接口",-1)),e("div",ke,[e("p",_e,p(z.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[5]||(t[5]=r=>h(z.value))}," 复制 ")])]),e("div",null,[t[19]||(t[19]=e("p",{class:"text-xs text-muted-foreground"},"完整接口",-1)),e("div",ze,[e("p",Ce,p(C.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[6]||(t[6]=r=>h(C.value))}," 复制 ")])]),e("div",null,[t[20]||(t[20]=e("p",{class:"text-xs text-muted-foreground"},"支持模型",-1)),e("div",He,[e("div",Me,[(s(),l(V,null,$(T,r=>e("span",{key:r,class:"rounded-full border border-border px-2 py-0.5 text-[11px]"},p(r),1)),64))])])]),e("div",null,[t[21]||(t[21]=e("p",{class:"text-xs text-muted-foreground"},"API 密钥",-1)),e("div",Se,[e("p",Ve,p(H.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[7]||(t[7]=r=>h(H.value))}," 复制 ")])])]),e("div",$e,[e("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:t[8]||(t[8]=r=>g.value=!1)}," 知道了 ")])])])):d("",!0)]))]))}});export{Ie as default};
static/assets/AppShell-DKPLDP3H.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as F,l as U,h as y,i as f,y as Z,z as S,c as l,a as e,p as m,m as G,b as d,n as u,F as V,r as $,A as K,t as p,s as w,u as a,R as k,B as O,T as E,x as q,f as A,e as s}from"./index-BYFRJmx0.js";import{u as J}from"./settings-BkhyfuxO.js";import{_ as Q}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-BElgd3uY.js";import{u as W}from"./useConfirmDialog-BQNp3TV9.js";const X={class:"min-h-screen"},Y={class:"flex min-h-screen flex-col lg:flex-row"},ee={key:0,class:"text-base font-semibold text-foreground"},te={key:0,class:"px-3 pb-2 text-xs uppercase tracking-[0.28em] text-muted-foreground"},re={class:"space-y-1"},oe={"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},se=["d"],ne={key:0,class:"flex-1 min-w-0 truncate"},le={key:1,class:"ml-auto text-xs opacity-0 transition-opacity group-hover:opacity-100"},ae={class:"mt-auto border-t border-border px-6 py-3 lg:py-4"},ie={key:0,class:"rounded-2xl bg-secondary/60 p-3"},de=["title"],ue={class:"min-w-0 flex-1 overflow-hidden lg:ml-0"},pe={class:"min-w-0 flex flex-col gap-4 border-b border-border bg-card/70 px-6 py-5 backdrop-blur lg:flex-row lg:items-center lg:justify-between lg:px-10"},ce={class:"flex items-center gap-3"},xe={class:"text-xl font-semibold text-foreground lg:text-2xl"},fe={class:"flex flex-wrap items-center gap-3"},me={class:"h-full overflow-y-auto overflow-x-hidden bg-card/70 px-4 pb-10 pt-6 backdrop-blur lg:px-10 lg:pt-10"},be={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ge={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},ve={class:"flex items-center justify-between"},he={class:"mt-4 space-y-3 text-sm"},ye={class:"mt-1 flex items-start gap-2"},we={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ke={class:"mt-1 flex items-start gap-2"},_e={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ze={class:"mt-1 flex items-start gap-2"},Ce={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},He={class:"mt-1 rounded-2xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground"},Me={class:"flex flex-wrap gap-2 text-foreground"},Se={class:"mt-1 flex items-start gap-2"},Ve={class:"min-w-0 flex-1 rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},$e={class:"mt-6 flex items-center justify-end"},Ie=F({__name:"AppShell",setup(Ae){const L=q(),b=Z(),j=U(),c=J(),x=y(!1),o=y(!1),i=W(),g=y(!1),_=[{path:"/",label:"概览",icon:"M4 4h7v7H4V4zm9 0h7v4h-7V4zm0 6h7v10h-7V10zM4 13h7v7H4v-7z"},{path:"/accounts",label:"账号管理",icon:"M12 12a3.5 3.5 0 1 0-3.5-3.5A3.5 3.5 0 0 0 12 12zm0 2c-4.1 0-7.5 2.2-7.5 5v1h15v-1c0-2.8-3.4-5-7.5-5z"},{path:"/settings",label:"系统设置",icon:"M4 6h10v2H4V6zm12 0h4v2h-4V6zM4 11h6v2H4v-2zm8 0h8v2h-8v-2zM4 16h10v2H4v-2zm12 0h4v2h-4v-2z"},{path:"/monitor",label:"监控状态",icon:"M3 12h4l2-4 4 8 3-6h5v2h-4l-4 8-4-8-2 4H3v-2z"},{path:"/logs",label:"运行日志",icon:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h10v2H4v-2z"},{path:"/docs",label:"文档中心",icon:"M6 3h9l4 4v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm8 1.5V8h3.5L14 4.5zM8 11h8v2H8v-2zm0 4h8v2H8v-2z"}],B=f(()=>_.find(t=>t.path===b.path)?.label||"概览"),D=n=>{const r=`transition-colors ${o.value?"px-2 justify-center gap-0":"px-3 gap-3"}`;return b.path===n?`${r} bg-primary text-primary-foreground`:`${r} text-muted-foreground hover:bg-accent hover:text-accent-foreground`},I=n=>b.path===n?"bg-primary-foreground/15 text-primary-foreground border-primary-foreground/40":"bg-secondary text-muted-foreground group-hover:text-accent-foreground",v=f(()=>(c.settings?.basic?.base_url||""||window.location.origin).replace(/\/$/,"")),z=f(()=>`${v.value}/v1`),C=f(()=>`${v.value}/v1/chat/completions`),H=f(()=>c.settings?.basic?.api_key||"未设置"),T=["gemini-auto","gemini-2.5-flash","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview"];S(()=>b.path,()=>{x.value=!1});const M=localStorage.getItem("sidebar-collapsed");M&&(o.value=M==="true"),S(o,n=>{localStorage.setItem("sidebar-collapsed",n?"true":"false")});async function N(){await i.ask({title:"退出登录",message:"确定退出管理控制台吗?"})&&(await j.logout(),L.push({name:"login"}))}function P(){window.location.reload()}async function R(){g.value=!0,!c.settings&&!c.isLoading&&await c.loadSettings()}async function h(n){if(n)try{await navigator.clipboard.writeText(n)}catch(t){console.error("Copy failed",t)}}return(n,t)=>(s(),l("div",X,[e("div",Y,[x.value?(s(),l("div",{key:0,class:"fixed inset-0 z-30 bg-black/20 backdrop-blur-sm lg:hidden",onClick:t[0]||(t[0]=r=>x.value=!1)})):d("",!0),e("aside",{class:u(["fixed inset-y-0 left-0 z-40 w-72 -translate-x-full bg-card/90 backdrop-blur-sm lg:backdrop-blur-none border-r border-border transition-[width,transform] duration-200 ease-out will-change-[transform] transform-gpu flex flex-col lg:static lg:translate-x-0 lg:bg-card/80 lg:border-b-0 lg:border-r lg:sticky lg:top-0 lg:h-screen",[{"translate-x-0":x.value,"w-20 lg:w-20":o.value}]])},[e("div",{class:u(["flex h-16 items-center justify-between px-6 pt-4 lg:h-20 lg:pt-5",o.value?"justify-center px-0":""])},[e("div",{class:u(["flex items-center gap-2",o.value?"gap-0 justify-center w-full":""])},[t[9]||(t[9]=e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"text-foreground transition-colors hover:text-primary","aria-label":"GitHub"},[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-6 w-6",fill:"currentColor"},[e("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.166 6.839 9.489.5.09.682-.217.682-.483 0-.237-.009-.868-.014-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.004.071 1.532 1.031 1.532 1.031.892 1.529 2.341 1.087 2.91.832.091-.647.349-1.087.636-1.337-2.22-.253-4.555-1.11-4.555-4.944 0-1.092.39-1.987 1.029-2.687-.103-.253-.446-1.272.098-2.65 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.295 2.748-1.026 2.748-1.026.546 1.378.202 2.397.1 2.65.64.7 1.028 1.595 1.028 2.687 0 3.842-2.338 4.687-4.566 4.936.359.309.678.919.678 1.852 0 1.337-.012 2.418-.012 2.747 0 .268.18.577.688.479A10.002 10.002 0 0 0 22 12c0-5.523-4.477-10-10-10z"})])],-1)),o.value?d("",!0):(s(),l("span",ee,"Gemini Business2API"))],2)],2),e("nav",{class:u(["pb-4 pt-4 lg:pt-6 flex-1 overflow-y-auto",o.value?"px-2":"px-3"])},[o.value?d("",!0):(s(),l("p",te," 导航 ")),e("div",re,[(s(),l(V,null,$(_,r=>m(a(k),{key:r.path,to:r.path,class:u(["group flex items-center rounded-2xl py-2 text-sm font-medium transition-colors overflow-hidden",D(r.path)]),title:o.value?r.label:void 0},{default:w(()=>[e("span",{class:u(["inline-flex h-9 w-9 items-center justify-center rounded-2xl border border-border",I(r.path)])},[(s(),l("svg",oe,[e("path",{d:r.icon},null,8,se)]))],2),o.value?d("",!0):(s(),l("span",ne,p(r.label),1)),o.value?d("",!0):(s(),l("span",le," 进入 "))]),_:2},1032,["to","class","title"])),64))])],2),e("div",ae,[o.value?d("",!0):(s(),l("div",ie,[...t[10]||(t[10]=[e("p",{class:"text-xs tracking-[0.12em] text-muted-foreground"},[e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 transition-colors hover:text-foreground"}," gemini-business2api "),e("span",null," · 声明")],-1),e("p",{class:"mt-2 text-xs text-muted-foreground"}," 本项目仅限学习与研究用途,禁止用于商业用途。请保留本声明、原作者信息与开源来源。 ",-1)])])),e("div",{class:u(["mt-4 flex items-center gap-3",o.value?"justify-center":""])},[o.value?d("",!0):(s(),l("button",{key:0,onClick:N,class:"flex-1 rounded-2xl border border-border bg-background px-4 py-3 text-sm font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:text-destructive"}," 退出登录 ")),e("button",{class:"h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-border text-muted-foreground transition-all hover:border-primary hover:text-primary flex",onClick:t[1]||(t[1]=r=>o.value=!o.value),title:o.value?"展开侧边栏":"收起侧边栏"},[...t[11]||(t[11]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 shrink-0",fill:"currentColor"},[e("path",{d:"M6 4h2v16H6V4zm4 4h8v2h-8V8zm0 6h8v2h-8v-2z"})],-1)])],8,de)],2)])],2),e("main",ue,[e("header",pe,[e("div",ce,[e("button",{class:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-border text-foreground transition-colors hover:border-primary hover:text-primary lg:hidden",onClick:t[2]||(t[2]=r=>x.value=!0),"aria-label":"打开导航"},[...t[12]||(t[12]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},[e("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])]),t[13]||(t[13]=K('<svg aria-hidden="true" viewBox="0 0 130 150" class="logo-mark h-9 w-9 shrink-0 text-foreground"><defs><filter id="head-shadow" x="-50%" y="-50%" width="200%" height="200%"><feDropShadow dx="0" dy="10" stdDeviation="12" flood-color="rgba(0, 188, 212, 0.2)"></feDropShadow></filter></defs><g class="logo-cat-wrapper" transform="translate(0, 12)"><g transform="translate(16, 20) rotate(-10, 9, 12)"><path d="M14 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g transform="translate(96, 20) rotate(10, 9, 12)"><path d="M4 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g filter="url(#head-shadow)"><path d="M 32 40 L 98 40 A 12 12 0 0 1 110 52 L 110 90 A 30 30 0 0 1 80 120 L 50 120 A 30 30 0 0 1 20 90 L 20 52 A 12 12 0 0 1 32 40 Z" fill="rgba(255, 255, 255, 0.9)" stroke="#2c3e50" stroke-width="3"></path></g><rect class="logo-eye" x="35" y="68" width="14" height="4" rx="1"></rect><rect class="logo-eye" x="81" y="68" width="14" height="4" rx="1"></rect></g></svg>',1)),e("h2",xe,p(B.value),1)]),e("div",fe,[e("button",{onClick:P,class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",title:"刷新"}," ��新 "),e("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:R}," 接口信息 "),m(a(k),{to:"/public/uptime",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[14]||(t[14]=[A(" 状态监控 ",-1)])]),_:1}),m(a(k),{to:"/public/logs",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[15]||(t[15]=[A(" 公开日志 ",-1)])]),_:1})])]),e("div",me,[m(a(O))])])]),m(Q,{open:a(i).open.value,title:a(i).title.value,message:a(i).message.value,"confirm-text":a(i).confirmText.value,"cancel-text":a(i).cancelText.value,onConfirm:a(i).confirm,onCancel:a(i).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(s(),G(E,{to:"body"},[g.value?(s(),l("div",be,[e("div",ge,[e("div",ve,[t[16]||(t[16]=e("p",{class:"text-sm font-medium text-foreground"},"API 接口",-1)),e("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:t[3]||(t[3]=r=>g.value=!1)}," 关闭 ")]),t[22]||(t[22]=e("p",{class:"mt-2 text-xs text-muted-foreground"},"根据客户端选择对应接口",-1)),e("div",he,[e("div",null,[t[17]||(t[17]=e("p",{class:"text-xs text-muted-foreground"},"基础端点",-1)),e("div",ye,[e("p",we,p(v.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[4]||(t[4]=r=>h(v.value))}," 复制 ")])]),e("div",null,[t[18]||(t[18]=e("p",{class:"text-xs text-muted-foreground"},"SDK 接口",-1)),e("div",ke,[e("p",_e,p(z.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[5]||(t[5]=r=>h(z.value))}," 复制 ")])]),e("div",null,[t[19]||(t[19]=e("p",{class:"text-xs text-muted-foreground"},"完整接口",-1)),e("div",ze,[e("p",Ce,p(C.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[6]||(t[6]=r=>h(C.value))}," 复制 ")])]),e("div",null,[t[20]||(t[20]=e("p",{class:"text-xs text-muted-foreground"},"支持模型",-1)),e("div",He,[e("div",Me,[(s(),l(V,null,$(T,r=>e("span",{key:r,class:"rounded-full border border-border px-2 py-0.5 text-[11px]"},p(r),1)),64))])])]),e("div",null,[t[21]||(t[21]=e("p",{class:"text-xs text-muted-foreground"},"API 密钥",-1)),e("div",Se,[e("p",Ve,p(H.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[7]||(t[7]=r=>h(H.value))}," 复制 ")])])]),e("div",$e,[e("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:t[8]||(t[8]=r=>g.value=!1)}," 知道了 ")])])])):d("",!0)]))]))}});export{Ie as default};
static/assets/AppShell-DWHcP5pC.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as F,l as U,h as y,i as f,q as Z,s as S,c as l,a as e,x as m,y as G,b as d,n as u,F as V,r as $,z as K,t as p,A as w,u as a,R as k,B as O,T as q,p as E,f as A,e as s}from"./index-4tSmcUDY.js";import{u as J}from"./settings-By2abYt3.js";import{_ as Q}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-TmgBmCy7.js";import{u as W}from"./useConfirmDialog-DC2-Wjcf.js";const X={class:"min-h-screen"},Y={class:"flex min-h-screen flex-col lg:flex-row"},ee={key:0,class:"text-base font-semibold text-foreground"},te={key:0,class:"px-3 pb-2 text-xs uppercase tracking-[0.28em] text-muted-foreground"},re={class:"space-y-1"},oe={"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},se=["d"],ne={key:0,class:"flex-1 min-w-0 truncate"},le={key:1,class:"ml-auto text-xs opacity-0 transition-opacity group-hover:opacity-100"},ae={class:"mt-auto border-t border-border px-6 py-3 lg:py-4"},ie={key:0,class:"rounded-2xl bg-secondary/60 p-3"},de=["title"],ue={class:"min-w-0 flex-1 overflow-hidden lg:ml-0"},pe={class:"min-w-0 flex flex-col gap-4 border-b border-border bg-card/70 px-6 py-5 backdrop-blur lg:flex-row lg:items-center lg:justify-between lg:px-10"},ce={class:"flex items-center gap-3"},xe={class:"text-xl font-semibold text-foreground lg:text-2xl"},fe={class:"flex flex-wrap items-center gap-3"},me={class:"h-full overflow-y-auto overflow-x-hidden bg-card/70 px-4 pb-10 pt-6 backdrop-blur lg:px-10 lg:pt-10"},be={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ge={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},ve={class:"flex items-center justify-between"},he={class:"mt-4 space-y-3 text-sm"},ye={class:"mt-1 flex items-start gap-2"},we={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ke={class:"mt-1 flex items-start gap-2"},_e={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ze={class:"mt-1 flex items-start gap-2"},Ce={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},He={class:"mt-1 rounded-2xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground"},Me={class:"flex flex-wrap gap-2 text-foreground"},Se={class:"mt-1 flex items-start gap-2"},Ve={class:"min-w-0 flex-1 rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},$e={class:"mt-6 flex items-center justify-end"},Ie=F({__name:"AppShell",setup(Ae){const L=E(),b=Z(),j=U(),c=J(),x=y(!1),o=y(!1),i=W(),g=y(!1),_=[{path:"/",label:"概览",icon:"M4 4h7v7H4V4zm9 0h7v4h-7V4zm0 6h7v10h-7V10zM4 13h7v7H4v-7z"},{path:"/accounts",label:"账号管理",icon:"M12 12a3.5 3.5 0 1 0-3.5-3.5A3.5 3.5 0 0 0 12 12zm0 2c-4.1 0-7.5 2.2-7.5 5v1h15v-1c0-2.8-3.4-5-7.5-5z"},{path:"/settings",label:"系统设置",icon:"M4 6h10v2H4V6zm12 0h4v2h-4V6zM4 11h6v2H4v-2zm8 0h8v2h-8v-2zM4 16h10v2H4v-2zm12 0h4v2h-4v-2z"},{path:"/monitor",label:"监控状态",icon:"M3 12h4l2-4 4 8 3-6h5v2h-4l-4 8-4-8-2 4H3v-2z"},{path:"/logs",label:"运行日志",icon:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h10v2H4v-2z"},{path:"/docs",label:"文档中心",icon:"M6 3h9l4 4v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm8 1.5V8h3.5L14 4.5zM8 11h8v2H8v-2zm0 4h8v2H8v-2z"}],B=f(()=>_.find(t=>t.path===b.path)?.label||"概览"),D=n=>{const r=`transition-colors ${o.value?"px-2 justify-center gap-0":"px-3 gap-3"}`;return b.path===n?`${r} bg-primary text-primary-foreground`:`${r} text-muted-foreground hover:bg-accent hover:text-accent-foreground`},I=n=>b.path===n?"bg-primary-foreground/15 text-primary-foreground border-primary-foreground/40":"bg-secondary text-muted-foreground group-hover:text-accent-foreground",v=f(()=>(c.settings?.basic?.base_url||""||window.location.origin).replace(/\/$/,"")),z=f(()=>`${v.value}/v1`),C=f(()=>`${v.value}/v1/chat/completions`),H=f(()=>c.settings?.basic?.api_key||"未设置"),T=["gemini-auto","gemini-2.5-flash","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview"];S(()=>b.path,()=>{x.value=!1});const M=localStorage.getItem("sidebar-collapsed");M&&(o.value=M==="true"),S(o,n=>{localStorage.setItem("sidebar-collapsed",n?"true":"false")});async function N(){await i.ask({title:"退出登录",message:"确定退出管理控制台吗?"})&&(await j.logout(),L.push({name:"login"}))}function P(){window.location.reload()}async function R(){g.value=!0,!c.settings&&!c.isLoading&&await c.loadSettings()}async function h(n){if(n)try{await navigator.clipboard.writeText(n)}catch(t){console.error("Copy failed",t)}}return(n,t)=>(s(),l("div",X,[e("div",Y,[x.value?(s(),l("div",{key:0,class:"fixed inset-0 z-30 bg-black/20 backdrop-blur-sm lg:hidden",onClick:t[0]||(t[0]=r=>x.value=!1)})):d("",!0),e("aside",{class:u(["fixed inset-y-0 left-0 z-40 w-72 -translate-x-full bg-card/90 backdrop-blur-sm lg:backdrop-blur-none border-r border-border transition-[width,transform] duration-200 ease-out will-change-[transform] transform-gpu flex flex-col lg:static lg:translate-x-0 lg:bg-card/80 lg:border-b-0 lg:border-r lg:sticky lg:top-0 lg:h-screen",[{"translate-x-0":x.value,"w-20 lg:w-20":o.value}]])},[e("div",{class:u(["flex h-16 items-center justify-between px-6 pt-4 lg:h-20 lg:pt-5",o.value?"justify-center px-0":""])},[e("div",{class:u(["flex items-center gap-2",o.value?"gap-0 justify-center w-full":""])},[t[9]||(t[9]=e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"text-foreground transition-colors hover:text-primary","aria-label":"GitHub"},[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-6 w-6",fill:"currentColor"},[e("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.166 6.839 9.489.5.09.682-.217.682-.483 0-.237-.009-.868-.014-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.004.071 1.532 1.031 1.532 1.031.892 1.529 2.341 1.087 2.91.832.091-.647.349-1.087.636-1.337-2.22-.253-4.555-1.11-4.555-4.944 0-1.092.39-1.987 1.029-2.687-.103-.253-.446-1.272.098-2.65 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.295 2.748-1.026 2.748-1.026.546 1.378.202 2.397.1 2.65.64.7 1.028 1.595 1.028 2.687 0 3.842-2.338 4.687-4.566 4.936.359.309.678.919.678 1.852 0 1.337-.012 2.418-.012 2.747 0 .268.18.577.688.479A10.002 10.002 0 0 0 22 12c0-5.523-4.477-10-10-10z"})])],-1)),o.value?d("",!0):(s(),l("span",ee,"Gemini Business2API"))],2)],2),e("nav",{class:u(["pb-4 pt-4 lg:pt-6 flex-1 overflow-y-auto",o.value?"px-2":"px-3"])},[o.value?d("",!0):(s(),l("p",te," 导航 ")),e("div",re,[(s(),l(V,null,$(_,r=>m(a(k),{key:r.path,to:r.path,class:u(["group flex items-center rounded-2xl py-2 text-sm font-medium transition-colors overflow-hidden",D(r.path)]),title:o.value?r.label:void 0},{default:w(()=>[e("span",{class:u(["inline-flex h-9 w-9 items-center justify-center rounded-2xl border border-border",I(r.path)])},[(s(),l("svg",oe,[e("path",{d:r.icon},null,8,se)]))],2),o.value?d("",!0):(s(),l("span",ne,p(r.label),1)),o.value?d("",!0):(s(),l("span",le," 进入 "))]),_:2},1032,["to","class","title"])),64))])],2),e("div",ae,[o.value?d("",!0):(s(),l("div",ie,[...t[10]||(t[10]=[e("p",{class:"text-xs tracking-[0.12em] text-muted-foreground"},[e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 transition-colors hover:text-foreground"}," gemini-business2api "),e("span",null," · 声明")],-1),e("p",{class:"mt-2 text-xs text-muted-foreground"}," 本项目仅限学习与研究用途,禁止用于商业用途。请保留本声明、原作者信息与开源来源。 ",-1)])])),e("div",{class:u(["mt-4 flex items-center gap-3",o.value?"justify-center":""])},[o.value?d("",!0):(s(),l("button",{key:0,onClick:N,class:"flex-1 rounded-2xl border border-border bg-background px-4 py-3 text-sm font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:text-destructive"}," 退出登录 ")),e("button",{class:"h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-border text-muted-foreground transition-all hover:border-primary hover:text-primary flex",onClick:t[1]||(t[1]=r=>o.value=!o.value),title:o.value?"展开侧边栏":"收起侧边栏"},[...t[11]||(t[11]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 shrink-0",fill:"currentColor"},[e("path",{d:"M6 4h2v16H6V4zm4 4h8v2h-8V8zm0 6h8v2h-8v-2z"})],-1)])],8,de)],2)])],2),e("main",ue,[e("header",pe,[e("div",ce,[e("button",{class:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-border text-foreground transition-colors hover:border-primary hover:text-primary lg:hidden",onClick:t[2]||(t[2]=r=>x.value=!0),"aria-label":"打开导航"},[...t[12]||(t[12]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},[e("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])]),t[13]||(t[13]=K('<svg aria-hidden="true" viewBox="0 0 130 150" class="logo-mark h-9 w-9 shrink-0 text-foreground"><defs><filter id="head-shadow" x="-50%" y="-50%" width="200%" height="200%"><feDropShadow dx="0" dy="10" stdDeviation="12" flood-color="rgba(0, 188, 212, 0.2)"></feDropShadow></filter></defs><g class="logo-cat-wrapper" transform="translate(0, 12)"><g transform="translate(16, 20) rotate(-10, 9, 12)"><path d="M14 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g transform="translate(96, 20) rotate(10, 9, 12)"><path d="M4 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g filter="url(#head-shadow)"><path d="M 32 40 L 98 40 A 12 12 0 0 1 110 52 L 110 90 A 30 30 0 0 1 80 120 L 50 120 A 30 30 0 0 1 20 90 L 20 52 A 12 12 0 0 1 32 40 Z" fill="rgba(255, 255, 255, 0.9)" stroke="#2c3e50" stroke-width="3"></path></g><rect class="logo-eye" x="35" y="68" width="14" height="4" rx="1"></rect><rect class="logo-eye" x="81" y="68" width="14" height="4" rx="1"></rect></g></svg>',1)),e("h2",xe,p(B.value),1)]),e("div",fe,[e("button",{onClick:P,class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",title:"刷新"}," ��新 "),e("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:R}," 接口信息 "),m(a(k),{to:"/public/uptime",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[14]||(t[14]=[A(" 状态监控 ",-1)])]),_:1}),m(a(k),{to:"/public/logs",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[15]||(t[15]=[A(" 公开日志 ",-1)])]),_:1})])]),e("div",me,[m(a(O))])])]),m(Q,{open:a(i).open.value,title:a(i).title.value,message:a(i).message.value,"confirm-text":a(i).confirmText.value,"cancel-text":a(i).cancelText.value,onConfirm:a(i).confirm,onCancel:a(i).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(s(),G(q,{to:"body"},[g.value?(s(),l("div",be,[e("div",ge,[e("div",ve,[t[16]||(t[16]=e("p",{class:"text-sm font-medium text-foreground"},"API 接口",-1)),e("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:t[3]||(t[3]=r=>g.value=!1)}," 关闭 ")]),t[22]||(t[22]=e("p",{class:"mt-2 text-xs text-muted-foreground"},"根据客户端选择对应接口",-1)),e("div",he,[e("div",null,[t[17]||(t[17]=e("p",{class:"text-xs text-muted-foreground"},"基础端点",-1)),e("div",ye,[e("p",we,p(v.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[4]||(t[4]=r=>h(v.value))}," 复制 ")])]),e("div",null,[t[18]||(t[18]=e("p",{class:"text-xs text-muted-foreground"},"SDK 接口",-1)),e("div",ke,[e("p",_e,p(z.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[5]||(t[5]=r=>h(z.value))}," 复制 ")])]),e("div",null,[t[19]||(t[19]=e("p",{class:"text-xs text-muted-foreground"},"完整接口",-1)),e("div",ze,[e("p",Ce,p(C.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[6]||(t[6]=r=>h(C.value))}," 复制 ")])]),e("div",null,[t[20]||(t[20]=e("p",{class:"text-xs text-muted-foreground"},"支持模型",-1)),e("div",He,[e("div",Me,[(s(),l(V,null,$(T,r=>e("span",{key:r,class:"rounded-full border border-border px-2 py-0.5 text-[11px]"},p(r),1)),64))])])]),e("div",null,[t[21]||(t[21]=e("p",{class:"text-xs text-muted-foreground"},"API 密钥",-1)),e("div",Se,[e("p",Ve,p(H.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[7]||(t[7]=r=>h(H.value))}," 复制 ")])])]),e("div",$e,[e("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:t[8]||(t[8]=r=>g.value=!1)}," 知道了 ")])])])):d("",!0)]))]))}});export{Ie as default};
static/assets/AppShell-DZfg1gi0.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as F,l as U,h as y,i as f,q as Z,s as S,c as l,a as e,x as m,y as G,b as d,n as u,F as V,r as $,z as K,t as p,A as w,u as a,R as k,B as O,T as q,p as E,f as A,e as s}from"./index-DDWWwh2l.js";import{u as J}from"./settings-CHSHPnGz.js";import{_ as Q}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-Bos9Whi2.js";import{u as W}from"./useConfirmDialog-B1UvQk4s.js";const X={class:"min-h-screen"},Y={class:"flex min-h-screen flex-col lg:flex-row"},ee={key:0,class:"text-base font-semibold text-foreground"},te={key:0,class:"px-3 pb-2 text-xs uppercase tracking-[0.28em] text-muted-foreground"},re={class:"space-y-1"},oe={"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},se=["d"],ne={key:0,class:"flex-1 min-w-0 truncate"},le={key:1,class:"ml-auto text-xs opacity-0 transition-opacity group-hover:opacity-100"},ae={class:"mt-auto border-t border-border px-6 py-3 lg:py-4"},ie={key:0,class:"rounded-2xl bg-secondary/60 p-3"},de=["title"],ue={class:"min-w-0 flex-1 overflow-hidden lg:ml-0"},pe={class:"min-w-0 flex flex-col gap-4 border-b border-border bg-card/70 px-6 py-5 backdrop-blur lg:flex-row lg:items-center lg:justify-between lg:px-10"},ce={class:"flex items-center gap-3"},xe={class:"text-xl font-semibold text-foreground lg:text-2xl"},fe={class:"flex flex-wrap items-center gap-3"},me={class:"h-full overflow-y-auto overflow-x-hidden bg-card/70 px-4 pb-10 pt-6 backdrop-blur lg:px-10 lg:pt-10"},be={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ge={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},ve={class:"flex items-center justify-between"},he={class:"mt-4 space-y-3 text-sm"},ye={class:"mt-1 flex items-start gap-2"},we={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ke={class:"mt-1 flex items-start gap-2"},_e={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ze={class:"mt-1 flex items-start gap-2"},Ce={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},He={class:"mt-1 rounded-2xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground"},Me={class:"flex flex-wrap gap-2 text-foreground"},Se={class:"mt-1 flex items-start gap-2"},Ve={class:"min-w-0 flex-1 rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},$e={class:"mt-6 flex items-center justify-end"},Ie=F({__name:"AppShell",setup(Ae){const L=E(),b=Z(),j=U(),c=J(),x=y(!1),o=y(!1),i=W(),g=y(!1),_=[{path:"/",label:"概览",icon:"M4 4h7v7H4V4zm9 0h7v4h-7V4zm0 6h7v10h-7V10zM4 13h7v7H4v-7z"},{path:"/accounts",label:"账号管理",icon:"M12 12a3.5 3.5 0 1 0-3.5-3.5A3.5 3.5 0 0 0 12 12zm0 2c-4.1 0-7.5 2.2-7.5 5v1h15v-1c0-2.8-3.4-5-7.5-5z"},{path:"/settings",label:"系统设置",icon:"M4 6h10v2H4V6zm12 0h4v2h-4V6zM4 11h6v2H4v-2zm8 0h8v2h-8v-2zM4 16h10v2H4v-2zm12 0h4v2h-4v-2z"},{path:"/monitor",label:"监控状态",icon:"M3 12h4l2-4 4 8 3-6h5v2h-4l-4 8-4-8-2 4H3v-2z"},{path:"/logs",label:"运行日志",icon:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h10v2H4v-2z"},{path:"/docs",label:"文档中心",icon:"M6 3h9l4 4v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm8 1.5V8h3.5L14 4.5zM8 11h8v2H8v-2zm0 4h8v2H8v-2z"}],B=f(()=>_.find(t=>t.path===b.path)?.label||"概览"),D=n=>{const r=`transition-colors ${o.value?"px-2 justify-center gap-0":"px-3 gap-3"}`;return b.path===n?`${r} bg-primary text-primary-foreground`:`${r} text-muted-foreground hover:bg-accent hover:text-accent-foreground`},I=n=>b.path===n?"bg-primary-foreground/15 text-primary-foreground border-primary-foreground/40":"bg-secondary text-muted-foreground group-hover:text-accent-foreground",v=f(()=>(c.settings?.basic?.base_url||""||window.location.origin).replace(/\/$/,"")),z=f(()=>`${v.value}/v1`),C=f(()=>`${v.value}/v1/chat/completions`),H=f(()=>c.settings?.basic?.api_key||"未设置"),T=["gemini-auto","gemini-2.5-flash","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview"];S(()=>b.path,()=>{x.value=!1});const M=localStorage.getItem("sidebar-collapsed");M&&(o.value=M==="true"),S(o,n=>{localStorage.setItem("sidebar-collapsed",n?"true":"false")});async function N(){await i.ask({title:"退出登录",message:"确定退出管理控制台吗?"})&&(await j.logout(),L.push({name:"login"}))}function P(){window.location.reload()}async function R(){g.value=!0,!c.settings&&!c.isLoading&&await c.loadSettings()}async function h(n){if(n)try{await navigator.clipboard.writeText(n)}catch(t){console.error("Copy failed",t)}}return(n,t)=>(s(),l("div",X,[e("div",Y,[x.value?(s(),l("div",{key:0,class:"fixed inset-0 z-30 bg-black/20 backdrop-blur-sm lg:hidden",onClick:t[0]||(t[0]=r=>x.value=!1)})):d("",!0),e("aside",{class:u(["fixed inset-y-0 left-0 z-40 w-72 -translate-x-full bg-card/90 backdrop-blur-sm lg:backdrop-blur-none border-r border-border transition-[width,transform] duration-200 ease-out will-change-[transform] transform-gpu flex flex-col lg:static lg:translate-x-0 lg:bg-card/80 lg:border-b-0 lg:border-r lg:sticky lg:top-0 lg:h-screen",[{"translate-x-0":x.value,"w-20 lg:w-20":o.value}]])},[e("div",{class:u(["flex h-16 items-center justify-between px-6 pt-4 lg:h-20 lg:pt-5",o.value?"justify-center px-0":""])},[e("div",{class:u(["flex items-center gap-2",o.value?"gap-0 justify-center w-full":""])},[t[9]||(t[9]=e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"text-foreground transition-colors hover:text-primary","aria-label":"GitHub"},[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-6 w-6",fill:"currentColor"},[e("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.166 6.839 9.489.5.09.682-.217.682-.483 0-.237-.009-.868-.014-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.004.071 1.532 1.031 1.532 1.031.892 1.529 2.341 1.087 2.91.832.091-.647.349-1.087.636-1.337-2.22-.253-4.555-1.11-4.555-4.944 0-1.092.39-1.987 1.029-2.687-.103-.253-.446-1.272.098-2.65 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.295 2.748-1.026 2.748-1.026.546 1.378.202 2.397.1 2.65.64.7 1.028 1.595 1.028 2.687 0 3.842-2.338 4.687-4.566 4.936.359.309.678.919.678 1.852 0 1.337-.012 2.418-.012 2.747 0 .268.18.577.688.479A10.002 10.002 0 0 0 22 12c0-5.523-4.477-10-10-10z"})])],-1)),o.value?d("",!0):(s(),l("span",ee,"Gemini Business2API"))],2)],2),e("nav",{class:u(["pb-4 pt-4 lg:pt-6 flex-1 overflow-y-auto",o.value?"px-2":"px-3"])},[o.value?d("",!0):(s(),l("p",te," 导航 ")),e("div",re,[(s(),l(V,null,$(_,r=>m(a(k),{key:r.path,to:r.path,class:u(["group flex items-center rounded-2xl py-2 text-sm font-medium transition-colors overflow-hidden",D(r.path)]),title:o.value?r.label:void 0},{default:w(()=>[e("span",{class:u(["inline-flex h-9 w-9 items-center justify-center rounded-2xl border border-border",I(r.path)])},[(s(),l("svg",oe,[e("path",{d:r.icon},null,8,se)]))],2),o.value?d("",!0):(s(),l("span",ne,p(r.label),1)),o.value?d("",!0):(s(),l("span",le," 进入 "))]),_:2},1032,["to","class","title"])),64))])],2),e("div",ae,[o.value?d("",!0):(s(),l("div",ie,[...t[10]||(t[10]=[e("p",{class:"text-xs tracking-[0.12em] text-muted-foreground"},[e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 transition-colors hover:text-foreground"}," gemini-business2api "),e("span",null," · 声明")],-1),e("p",{class:"mt-2 text-xs text-muted-foreground"}," 本项目仅限学习与研究用途,禁止用于商业用途。请保留本声明、原作者信息与开源来源。 ",-1)])])),e("div",{class:u(["mt-4 flex items-center gap-3",o.value?"justify-center":""])},[o.value?d("",!0):(s(),l("button",{key:0,onClick:N,class:"flex-1 rounded-2xl border border-border bg-background px-4 py-3 text-sm font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:text-destructive"}," 退出登录 ")),e("button",{class:"h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-border text-muted-foreground transition-all hover:border-primary hover:text-primary flex",onClick:t[1]||(t[1]=r=>o.value=!o.value),title:o.value?"展开侧边栏":"收起侧边栏"},[...t[11]||(t[11]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 shrink-0",fill:"currentColor"},[e("path",{d:"M6 4h2v16H6V4zm4 4h8v2h-8V8zm0 6h8v2h-8v-2z"})],-1)])],8,de)],2)])],2),e("main",ue,[e("header",pe,[e("div",ce,[e("button",{class:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-border text-foreground transition-colors hover:border-primary hover:text-primary lg:hidden",onClick:t[2]||(t[2]=r=>x.value=!0),"aria-label":"打开导航"},[...t[12]||(t[12]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},[e("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])]),t[13]||(t[13]=K('<svg aria-hidden="true" viewBox="0 0 130 150" class="logo-mark h-9 w-9 shrink-0 text-foreground"><defs><filter id="head-shadow" x="-50%" y="-50%" width="200%" height="200%"><feDropShadow dx="0" dy="10" stdDeviation="12" flood-color="rgba(0, 188, 212, 0.2)"></feDropShadow></filter></defs><g class="logo-cat-wrapper" transform="translate(0, 12)"><g transform="translate(16, 20) rotate(-10, 9, 12)"><path d="M14 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g transform="translate(96, 20) rotate(10, 9, 12)"><path d="M4 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g filter="url(#head-shadow)"><path d="M 32 40 L 98 40 A 12 12 0 0 1 110 52 L 110 90 A 30 30 0 0 1 80 120 L 50 120 A 30 30 0 0 1 20 90 L 20 52 A 12 12 0 0 1 32 40 Z" fill="rgba(255, 255, 255, 0.9)" stroke="#2c3e50" stroke-width="3"></path></g><rect class="logo-eye" x="35" y="68" width="14" height="4" rx="1"></rect><rect class="logo-eye" x="81" y="68" width="14" height="4" rx="1"></rect></g></svg>',1)),e("h2",xe,p(B.value),1)]),e("div",fe,[e("button",{onClick:P,class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",title:"刷新"}," ��新 "),e("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:R}," 接口信息 "),m(a(k),{to:"/public/uptime",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[14]||(t[14]=[A(" 状态监控 ",-1)])]),_:1}),m(a(k),{to:"/public/logs",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[15]||(t[15]=[A(" 公开日志 ",-1)])]),_:1})])]),e("div",me,[m(a(O))])])]),m(Q,{open:a(i).open.value,title:a(i).title.value,message:a(i).message.value,"confirm-text":a(i).confirmText.value,"cancel-text":a(i).cancelText.value,onConfirm:a(i).confirm,onCancel:a(i).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(s(),G(q,{to:"body"},[g.value?(s(),l("div",be,[e("div",ge,[e("div",ve,[t[16]||(t[16]=e("p",{class:"text-sm font-medium text-foreground"},"API 接口",-1)),e("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:t[3]||(t[3]=r=>g.value=!1)}," 关闭 ")]),t[22]||(t[22]=e("p",{class:"mt-2 text-xs text-muted-foreground"},"根据客户端选择对应接口",-1)),e("div",he,[e("div",null,[t[17]||(t[17]=e("p",{class:"text-xs text-muted-foreground"},"基础端点",-1)),e("div",ye,[e("p",we,p(v.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[4]||(t[4]=r=>h(v.value))}," 复制 ")])]),e("div",null,[t[18]||(t[18]=e("p",{class:"text-xs text-muted-foreground"},"SDK 接口",-1)),e("div",ke,[e("p",_e,p(z.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[5]||(t[5]=r=>h(z.value))}," 复制 ")])]),e("div",null,[t[19]||(t[19]=e("p",{class:"text-xs text-muted-foreground"},"完整接口",-1)),e("div",ze,[e("p",Ce,p(C.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[6]||(t[6]=r=>h(C.value))}," 复制 ")])]),e("div",null,[t[20]||(t[20]=e("p",{class:"text-xs text-muted-foreground"},"支持模型",-1)),e("div",He,[e("div",Me,[(s(),l(V,null,$(T,r=>e("span",{key:r,class:"rounded-full border border-border px-2 py-0.5 text-[11px]"},p(r),1)),64))])])]),e("div",null,[t[21]||(t[21]=e("p",{class:"text-xs text-muted-foreground"},"API 密钥",-1)),e("div",Se,[e("p",Ve,p(H.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[7]||(t[7]=r=>h(H.value))}," 复制 ")])])]),e("div",$e,[e("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:t[8]||(t[8]=r=>g.value=!1)}," 知道了 ")])])])):d("",!0)]))]))}});export{Ie as default};