From 17040862b49c389e27525a81c87557fc0fe76359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E6=A2=93=E6=9F=92?= <1787882683@qq.com> Date: Mon, 5 Jan 2026 18:02:40 +0800 Subject: [PATCH] WebUI 51481d84362d504fa9b50695bebb9769fc9920fe --- .../{icons-9Z4kBNLK.js => icons-CmIU8FzD.js} | 2 +- webui/dist/assets/index-B50WYNXg.css | 1 + webui/dist/assets/index-CK0sXzir.js | 94 ------------------- webui/dist/assets/index-CcX1ThoO.css | 1 - webui/dist/assets/index-D90_5BXS.js | 94 +++++++++++++++++++ webui/dist/index.html | 6 +- 6 files changed, 99 insertions(+), 99 deletions(-) rename webui/dist/assets/{icons-9Z4kBNLK.js => icons-CmIU8FzD.js} (97%) create mode 100644 webui/dist/assets/index-B50WYNXg.css delete mode 100644 webui/dist/assets/index-CK0sXzir.js delete mode 100644 webui/dist/assets/index-CcX1ThoO.css create mode 100644 webui/dist/assets/index-D90_5BXS.js diff --git a/webui/dist/assets/icons-9Z4kBNLK.js b/webui/dist/assets/icons-CmIU8FzD.js similarity index 97% rename from webui/dist/assets/icons-9Z4kBNLK.js rename to webui/dist/assets/icons-CmIU8FzD.js index 1be32d04..70b7cacf 100644 --- a/webui/dist/assets/icons-9Z4kBNLK.js +++ b/webui/dist/assets/icons-CmIU8FzD.js @@ -1 +1 @@ -import{r as h}from"./router-9vIXuQkh.js";const M=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,c,o)=>o?o.toUpperCase():c.toLowerCase()),d=t=>{const a=_(t);return a.charAt(0).toUpperCase()+a.slice(1)},k=(...t)=>t.filter((a,c,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===c).join(" ").trim(),x=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var m={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const v=h.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:n="",children:y,iconNode:r,...s},p)=>h.createElement("svg",{ref:p,...m,width:a,height:a,stroke:t,strokeWidth:o?Number(c)*24/Number(a):c,className:k("lucide",n),...!y&&!x(s)&&{"aria-hidden":"true"},...s},[...r.map(([i,l])=>h.createElement(i,l)),...Array.isArray(y)?y:[y]]));const e=(t,a)=>{const c=h.forwardRef(({className:o,...n},y)=>h.createElement(v,{ref:y,iconNode:a,className:k(`lucide-${M(d(t))}`,`lucide-${t}`,o),...n}));return c.displayName=d(t),c};const g=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],A2=e("activity",g);const u=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],V2=e("arrow-left",u);const f=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],H2=e("arrow-right",f);const w=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],L2=e("arrow-up-down",w);const N=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],S2=e("arrow-up",N);const $=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],P2=e("at-sign",$);const z=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],U2=e("ban",z);const q=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],T2=e("book-open",q);const b=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],B2=e("bot",b);const C=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],R2=e("boxes",C);const j=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],D2=e("brain",j);const A=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],E2=e("bug",A);const V=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Z2=e("calendar",V);const H=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],F2=e("chart-column",H);const L=[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]],O2=e("chart-pie",L);const S=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],G2=e("check",S);const P=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],I2=e("chevron-down",P);const U=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],W2=e("chevron-left",U);const T=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],K2=e("chevron-right",T);const B=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Q2=e("chevron-up",B);const R=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],X2=e("chevrons-left",R);const D=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],J2=e("chevrons-right",D);const E=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],Y2=e("chevrons-up-down",E);const Z=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],e0=e("circle-alert",Z);const F=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],a0=e("circle-check-big",F);const O=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],t0=e("circle-check",O);const G=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],c0=e("circle-question-mark",G);const I=[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],o0=e("circle-user-round",I);const W=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],y0=e("circle-user",W);const K=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],h0=e("circle-x",K);const Q=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],n0=e("circle",Q);const X=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]],s0=e("clipboard-check",X);const J=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],d0=e("clipboard-list",J);const Y=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],k0=e("clock",Y);const e1=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],r0=e("code-xml",e1);const a1=[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]],p0=e("container",a1);const t1=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],i0=e("copy",t1);const c1=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],l0=e("cpu",c1);const o1=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],M0=e("database",o1);const y1=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],_0=e("dollar-sign",y1);const h1=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],x0=e("download",h1);const n1=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],m0=e("ellipsis",n1);const s1=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],v0=e("external-link",s1);const d1=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],g0=e("eye-off",d1);const k1=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],u0=e("eye",k1);const r1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]],f0=e("file-question-mark",r1);const p1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],w0=e("file-search",p1);const i1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],N0=e("file-text",i1);const l1=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],$0=e("folder-open",l1);const M1=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],z0=e("funnel",M1);const _1=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],q0=e("git-branch",_1);const x1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],b0=e("globe",x1);const m1=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],C0=e("graduation-cap",m1);const v1=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],j0=e("grip-vertical",v1);const g1=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],A0=e("hard-drive",g1);const u1=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],V0=e("hash",u1);const f1=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],H0=e("heart",f1);const w1=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],L0=e("house",w1);const N1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],S0=e("image",N1);const $1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],P0=e("info",$1);const z1=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],U0=e("key",z1);const q1=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],T0=e("layers",q1);const b1=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],B0=e("layout-grid",b1);const C1=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],R0=e("list-checks",C1);const j1=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],D0=e("list",j1);const A1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],E0=e("loader-circle",A1);const V1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Z0=e("lock",V1);const H1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],F0=e("log-out",H1);const L1=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],O0=e("menu",L1);const S1=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],G0=e("message-circle",S1);const P1=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]],I0=e("message-square-text",P1);const U1=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],W0=e("message-square",U1);const T1=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],K0=e("moon",T1);const B1=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],Q0=e("network",B1);const R1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],X0=e("package",R1);const D1=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],J0=e("palette",D1);const E1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],Y0=e("panels-top-left",E1);const Z1=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],ee=e("pause",Z1);const F1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],ae=e("pen",F1);const O1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],te=e("pencil",O1);const G1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],ce=e("play",G1);const I1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],oe=e("plus",I1);const W1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],ye=e("power",W1);const K1=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],he=e("puzzle",K1);const Q1=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],ne=e("refresh-cw",Q1);const X1=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],se=e("rotate-ccw",X1);const J1=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],de=e("rotate-cw",J1);const Y1=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],ke=e("save",Y1);const e2=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],re=e("search",e2);const a2=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],pe=e("send",a2);const t2=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],ie=e("server",t2);const c2=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],le=e("settings-2",c2);const o2=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Me=e("settings",o2);const y2=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],_e=e("share-2",y2);const h2=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],xe=e("shield",h2);const n2=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],me=e("skip-forward",n2);const s2=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],ve=e("sliders-vertical",s2);const d2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],ge=e("smile",d2);const k2=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],ue=e("sparkles",k2);const r2=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],fe=e("square-pen",r2);const p2=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],we=e("star",p2);const i2=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Ne=e("sun",i2);const l2=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],$e=e("tag",l2);const M2=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ze=e("terminal",M2);const _2=[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]],qe=e("thumbs-down",_2);const x2=[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]],be=e("thumbs-up",x2);const m2=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Ce=e("trash-2",m2);const v2=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],je=e("trending-up",v2);const g2=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ae=e("triangle-alert",g2);const u2=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],Ve=e("trophy",u2);const f2=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],He=e("type",f2);const w2=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Le=e("upload",w2);const N2=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Se=e("user",N2);const $2=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Pe=e("users",$2);const z2=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Ue=e("wifi-off",z2);const q2=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],Te=e("wifi",q2);const b2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Be=e("x",b2);const C2=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Re=e("zap",C2);export{oe as $,A2 as A,B2 as B,e0 as C,_0 as D,m0 as E,N0 as F,c0 as G,A0 as H,P0 as I,ze as J,U0 as K,E0 as L,W0 as M,v0 as N,ue as O,ye as P,ge as Q,ne as R,re as S,je as T,Se as U,me as V,H2 as W,Be as X,L0 as Y,Re as Z,V2 as _,se as a,E2 as a$,w0 as a0,j0 as a1,ke as a2,Y0 as a3,r0 as a4,te as a5,X2 as a6,J2 as a7,Y2 as a8,_e as a9,I0 as aA,de as aB,le as aC,we as aD,B0 as aE,be as aF,qe as aG,q0 as aH,o0 as aI,Te as aJ,Ue as aK,ae as aL,pe as aM,f0 as aN,P2 as aO,H0 as aP,Ve as aQ,L2 as aR,R2 as aS,y0 as aT,F2 as aU,S2 as aV,ve as aW,O0 as aX,O2 as aY,T2 as aZ,F0 as a_,X0 as aa,ie as ab,T0 as ac,R0 as ad,$e as ae,C0 as af,p0 as ag,$0 as ah,S0 as ai,z0 as aj,fe as ak,U2 as al,V0 as am,n0 as an,G0 as ao,b0 as ap,Pe as aq,Q0 as ar,ee as as,ce as at,Z2 as au,He as av,D2 as aw,D0 as ax,a0 as ay,l0 as az,t0 as b,G2 as c,I2 as d,Q2 as e,W2 as f,K2 as g,k0 as h,h0 as i,s0 as j,he as k,Me as l,d0 as m,M0 as n,J0 as o,xe as p,Ae as q,i0 as r,g0 as s,u0 as t,Ce as u,x0 as v,Le as w,Ne as x,K0 as y,Z0 as z}; +import{r as h}from"./router-9vIXuQkh.js";const M=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,c,o)=>o?o.toUpperCase():c.toLowerCase()),d=t=>{const a=_(t);return a.charAt(0).toUpperCase()+a.slice(1)},k=(...t)=>t.filter((a,c,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===c).join(" ").trim(),x=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var m={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const v=h.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:n="",children:y,iconNode:r,...s},p)=>h.createElement("svg",{ref:p,...m,width:a,height:a,stroke:t,strokeWidth:o?Number(c)*24/Number(a):c,className:k("lucide",n),...!y&&!x(s)&&{"aria-hidden":"true"},...s},[...r.map(([i,l])=>h.createElement(i,l)),...Array.isArray(y)?y:[y]]));const e=(t,a)=>{const c=h.forwardRef(({className:o,...n},y)=>h.createElement(v,{ref:y,iconNode:a,className:k(`lucide-${M(d(t))}`,`lucide-${t}`,o),...n}));return c.displayName=d(t),c};const g=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],A2=e("activity",g);const u=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],V2=e("arrow-left",u);const f=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],H2=e("arrow-right",f);const w=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],L2=e("arrow-up-down",w);const N=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],S2=e("arrow-up",N);const $=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],P2=e("at-sign",$);const z=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],U2=e("ban",z);const q=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],T2=e("book-open",q);const b=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],B2=e("bot",b);const C=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],R2=e("boxes",C);const j=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],D2=e("brain",j);const A=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],E2=e("bug",A);const V=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Z2=e("calendar",V);const H=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],F2=e("chart-column",H);const L=[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]],O2=e("chart-pie",L);const S=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],G2=e("check",S);const P=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],I2=e("chevron-down",P);const U=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],W2=e("chevron-left",U);const T=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],K2=e("chevron-right",T);const B=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Q2=e("chevron-up",B);const R=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],X2=e("chevrons-left",R);const D=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],J2=e("chevrons-right",D);const E=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],Y2=e("chevrons-up-down",E);const Z=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],e0=e("circle-alert",Z);const F=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],a0=e("circle-check-big",F);const O=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],t0=e("circle-check",O);const G=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],c0=e("circle-question-mark",G);const I=[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],o0=e("circle-user-round",I);const W=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],y0=e("circle-user",W);const K=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],h0=e("circle-x",K);const Q=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],n0=e("circle",Q);const X=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]],s0=e("clipboard-check",X);const J=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],d0=e("clipboard-list",J);const Y=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],k0=e("clock",Y);const e1=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],r0=e("code-xml",e1);const a1=[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]],p0=e("container",a1);const t1=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],i0=e("copy",t1);const c1=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],l0=e("cpu",c1);const o1=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],M0=e("database",o1);const y1=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],_0=e("dollar-sign",y1);const h1=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],x0=e("download",h1);const n1=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],m0=e("ellipsis",n1);const s1=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],v0=e("external-link",s1);const d1=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],g0=e("eye-off",d1);const k1=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],u0=e("eye",k1);const r1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]],f0=e("file-question-mark",r1);const p1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],w0=e("file-search",p1);const i1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],N0=e("file-text",i1);const l1=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],$0=e("folder-open",l1);const M1=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],z0=e("funnel",M1);const _1=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],q0=e("git-branch",_1);const x1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],b0=e("globe",x1);const m1=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],C0=e("graduation-cap",m1);const v1=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],j0=e("grip-vertical",v1);const g1=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],A0=e("hard-drive",g1);const u1=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],V0=e("hash",u1);const f1=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],H0=e("heart",f1);const w1=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],L0=e("house",w1);const N1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],S0=e("image",N1);const $1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],P0=e("info",$1);const z1=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],U0=e("key",z1);const q1=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],T0=e("layers",q1);const b1=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],B0=e("layout-grid",b1);const C1=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],R0=e("list-checks",C1);const j1=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],D0=e("list",j1);const A1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],E0=e("loader-circle",A1);const V1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Z0=e("lock",V1);const H1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],F0=e("log-out",H1);const L1=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],O0=e("menu",L1);const S1=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],G0=e("message-circle",S1);const P1=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]],I0=e("message-square-text",P1);const U1=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],W0=e("message-square",U1);const T1=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],K0=e("moon",T1);const B1=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],Q0=e("network",B1);const R1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],X0=e("package",R1);const D1=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],J0=e("palette",D1);const E1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],Y0=e("panels-top-left",E1);const Z1=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],ee=e("pause",Z1);const F1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],ae=e("pen",F1);const O1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],te=e("pencil",O1);const G1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],ce=e("play",G1);const I1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],oe=e("plus",I1);const W1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],ye=e("power",W1);const K1=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],he=e("puzzle",K1);const Q1=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],ne=e("refresh-cw",Q1);const X1=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],se=e("rotate-ccw",X1);const J1=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],de=e("rotate-cw",J1);const Y1=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],ke=e("save",Y1);const e2=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],re=e("search",e2);const a2=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],pe=e("send",a2);const t2=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],ie=e("server",t2);const c2=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],le=e("settings-2",c2);const o2=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Me=e("settings",o2);const y2=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],_e=e("share-2",y2);const h2=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],xe=e("shield",h2);const n2=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],me=e("skip-forward",n2);const s2=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],ve=e("sliders-vertical",s2);const d2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],ge=e("smile",d2);const k2=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],ue=e("sparkles",k2);const r2=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],fe=e("square-pen",r2);const p2=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],we=e("star",p2);const i2=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Ne=e("sun",i2);const l2=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],$e=e("tag",l2);const M2=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ze=e("terminal",M2);const _2=[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]],qe=e("thumbs-down",_2);const x2=[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]],be=e("thumbs-up",x2);const m2=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Ce=e("trash-2",m2);const v2=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],je=e("trending-up",v2);const g2=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ae=e("triangle-alert",g2);const u2=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],Ve=e("trophy",u2);const f2=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],He=e("type",f2);const w2=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Le=e("upload",w2);const N2=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Se=e("user",N2);const $2=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Pe=e("users",$2);const z2=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Ue=e("wifi-off",z2);const q2=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],Te=e("wifi",q2);const b2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Be=e("x",b2);const C2=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Re=e("zap",C2);export{L0 as $,A2 as A,U2 as B,e0 as C,_0 as D,m0 as E,N0 as F,K0 as G,A0 as H,P0 as I,Z0 as J,U0 as K,E0 as L,W0 as M,c0 as N,ze as O,ye as P,v0 as Q,ne as R,re as S,je as T,Se as U,ue as V,ge as W,Be as X,me as Y,Re as Z,H2 as _,se as a,E2 as a$,V2 as a0,oe as a1,w0 as a2,j0 as a3,ke as a4,Y0 as a5,r0 as a6,te as a7,X2 as a8,J2 as a9,I0 as aA,de as aB,le as aC,we as aD,B0 as aE,be as aF,qe as aG,q0 as aH,o0 as aI,Te as aJ,Ue as aK,ae as aL,pe as aM,f0 as aN,P2 as aO,H0 as aP,Ve as aQ,L2 as aR,R2 as aS,y0 as aT,F2 as aU,S2 as aV,ve as aW,O0 as aX,O2 as aY,T2 as aZ,F0 as a_,Y2 as aa,_e as ab,X0 as ac,ie as ad,T0 as ae,R0 as af,$e as ag,C0 as ah,p0 as ai,$0 as aj,S0 as ak,z0 as al,fe as am,V0 as an,n0 as ao,G0 as ap,b0 as aq,Pe as ar,Q0 as as,ee as at,ce as au,Z2 as av,He as aw,D2 as ax,a0 as ay,l0 as az,t0 as b,G2 as c,I2 as d,Q2 as e,W2 as f,K2 as g,D0 as h,k0 as i,h0 as j,B2 as k,s0 as l,he as m,Me as n,d0 as o,M0 as p,J0 as q,xe as r,Ae as s,i0 as t,g0 as u,u0 as v,Ce as w,x0 as x,Le as y,Ne as z}; diff --git a/webui/dist/assets/index-B50WYNXg.css b/webui/dist/assets/index-B50WYNXg.css new file mode 100644 index 00000000..2c4fad5b --- /dev/null +++ b/webui/dist/assets/index-B50WYNXg.css @@ -0,0 +1 @@ +@charset "UTF-8";*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 221.2 83.2% 53.3%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 221.2 83.2% 53.3%;--radius: .5rem;--chart-1: 221.2 83.2% 53.3%;--chart-2: 160 60% 45%;--chart-3: 30 80% 55%;--chart-4: 280 65% 60%;--chart-5: 340 75% 55%}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 217.2 91.2% 59.8%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 224.3 76.3% 48%;--chart-1: 217.2 91.2% 59.8%;--chart-2: 160 60% 50%;--chart-3: 30 80% 60%;--chart-4: 280 65% 65%;--chart-5: 340 75% 60%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-16{inset:4rem}.inset-8{inset:2rem}.inset-x-0{left:0;right:0}.inset-x-4{left:1rem;right:1rem}.inset-y-0{top:0;bottom:0}.-bottom-20{bottom:-5rem}.-left-20{left:-5rem}.-right-2{right:-.5rem}.-right-20{right:-5rem}.-top-2{top:-.5rem}.-top-20{top:-5rem}.bottom-0{bottom:0}.bottom-1\/4{bottom:25%}.bottom-24{bottom:6rem}.bottom-4{bottom:1rem}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-1\/4{left:25%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-1\/3{right:33.333333%}.right-1\/4{right:25%}.right-2{right:.5rem}.right-4{right:1rem}.right-8{right:2rem}.top-0{top:0}.top-1{top:.25rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-3{top:.75rem}.top-3\/4{top:75%}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.order-1{order:1}.order-2{order:2}.col-span-1{grid-column:span 1 / span 1}.col-span-2{grid-column:span 2 / span 2}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-0{margin-left:0;margin-right:0}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-1{margin-top:-.25rem}.-mt-2{margin-top:-.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.mb-\[1px\]{margin-bottom:1px}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-10{margin-left:2.5rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.size-\[--cell-size\]{width:var(--cell-size);height:var(--cell-size)}.h-0\.5{height:.125rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-60{height:15rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[--cell-size\]{height:var(--cell-size)}.h-\[1\.25rem\]{height:1.25rem}.h-\[1px\]{height:1px}.h-\[200px\]{height:200px}.h-\[250px\]{height:250px}.h-\[280px\]{height:280px}.h-\[2px\]{height:2px}.h-\[300px\]{height:300px}.h-\[350px\]{height:350px}.h-\[400px\]{height:400px}.h-\[600px\]{height:600px}.h-\[70vh\]{height:70vh}.h-\[90vh\]{height:90vh}.h-\[calc\(100vh-12rem\)\]{height:calc(100vh - 12rem)}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[calc\(100vh-240px\)\]{height:calc(100vh - 240px)}.h-\[calc\(100vh-260px\)\]{height:calc(100vh - 260px)}.h-\[calc\(100vh-4rem\)\]{height:calc(100vh - 4rem)}.h-\[calc\(85vh-220px\)\]{height:calc(85vh - 220px)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-64{max-height:16rem}.max-h-\[--radix-context-menu-content-available-height\]{max-height:var(--radix-context-menu-content-available-height)}.max-h-\[--radix-select-content-available-height\]{max-height:var(--radix-select-content-available-height)}.max-h-\[200px\]{max-height:200px}.max-h-\[300px\]{max-height:300px}.max-h-\[60vh\]{max-height:60vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(90vh-120px\)\]{max-height:calc(90vh - 120px)}.max-h-\[calc\(90vh-8rem\)\]{max-height:calc(90vh - 8rem)}.max-h-full{max-height:100%}.max-h-none{max-height:none}.max-h-screen{max-height:100vh}.min-h-0{min-height:0px}.min-h-10{min-height:2.5rem}.min-h-\[100px\]{min-height:100px}.min-h-\[300px\]{min-height:300px}.min-h-\[400px\]{min-height:400px}.min-h-\[40px\]{min-height:40px}.min-h-\[60px\]{min-height:60px}.min-h-\[xxx\]{min-height:xxx}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-2\/3{width:66.666667%}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-\[--cell-size\]{width:var(--cell-size)}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[130px\]{width:130px}.w-\[140px\]{width:140px}.w-\[1px\]{width:1px}.w-\[200px\]{width:200px}.w-\[600px\]{width:600px}.w-\[65px\]{width:65px}.w-\[70px\]{width:70px}.w-\[95vw\]{width:95vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[--cell-size\]{min-width:var(--cell-size)}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[140px\]{min-width:140px}.min-w-\[160px\]{min-width:160px}.min-w-\[200px\]{min-width:200px}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.max-w-24{max-width:6rem}.max-w-2xl{max-width:42rem}.max-w-32{max-width:8rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[150px\]{max-width:150px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[60px\]{max-width:60px}.max-w-\[75\%\]{max-width:75%}.max-w-\[90\%\]{max-width:90%}.max-w-\[95vw\]{max-width:95vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-none{flex:none}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.origin-\[--radix-context-menu-content-transform-origin\]{transform-origin:var(--radix-context-menu-content-transform-origin)}.origin-\[--radix-popover-content-transform-origin\]{transform-origin:var(--radix-popover-content-transform-origin)}.origin-\[--radix-select-content-transform-origin\]{transform-origin:var(--radix-select-content-transform-origin)}.origin-\[--radix-tooltip-content-transform-origin\]{transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-32{--tw-translate-x: 8rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.animate-\[ping_3s_ease-in-out_infinite\]{animation:ping 3s ease-in-out infinite}.animate-\[ping_3s_ease-in-out_infinite_0\.5s\]{animation:ping 3s ease-in-out infinite .5s}.animate-\[ping_3s_ease-in-out_infinite_1s\]{animation:ping 3s ease-in-out infinite 1s}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-none{resize:none}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.break-inside-avoid{-moz-column-break-inside:avoid;break-inside:avoid}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-rows-\[auto_1fr_auto\]{grid-template-rows:auto 1fr auto}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.rounded-tr-sm{border-top-right-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-4{border-width:4px}.border-\[1\.5px\]{border-width:1.5px}.border-b{border-bottom-width:1px}.border-b-0{border-bottom-width:0px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[--color-border\]{border-color:var(--color-border)}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-amber-500\/20{border-color:#f59e0b33}.border-amber-500\/50{border-color:#f59e0b80}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-700{--tw-border-opacity: 1;border-color:rgb(29 78 216 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-green-300{--tw-border-opacity: 1;border-color:rgb(134 239 172 / var(--tw-border-opacity, 1))}.border-green-500{--tw-border-opacity: 1;border-color:rgb(34 197 94 / var(--tw-border-opacity, 1))}.border-green-600{--tw-border-opacity: 1;border-color:rgb(22 163 74 / var(--tw-border-opacity, 1))}.border-green-700{--tw-border-opacity: 1;border-color:rgb(21 128 61 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-muted-foreground\/30{border-color:hsl(var(--muted-foreground) / .3)}.border-muted-foreground\/50{border-color:hsl(var(--muted-foreground) / .5)}.border-orange-200{--tw-border-opacity: 1;border-color:rgb(254 215 170 / var(--tw-border-opacity, 1))}.border-orange-500{--tw-border-opacity: 1;border-color:rgb(249 115 22 / var(--tw-border-opacity, 1))}.border-orange-600{--tw-border-opacity: 1;border-color:rgb(234 88 12 / var(--tw-border-opacity, 1))}.border-pink-500\/20{border-color:#ec489933}.border-primary{border-color:hsl(var(--primary))}.border-primary\/10{border-color:hsl(var(--primary) / .1)}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-primary\/30{border-color:hsl(var(--primary) / .3)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-purple-500{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-red-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/50{border-color:#ef444480}.border-transparent{border-color:transparent}.border-white\/30{border-color:#ffffff4d}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-yellow-500\/50{border-color:#eab30880}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-amber-700{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.bg-background{background-color:hsl(var(--background))}.bg-background\/50{background-color:hsl(var(--background) / .5)}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-background\/95{background-color:hsl(var(--background) / .95)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-card\/50{background-color:hsl(var(--card) / .5)}.bg-card\/80{background-color:hsl(var(--card) / .8)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-800\/20{background-color:#1f293733}.bg-gray-800\/30{background-color:#1f29374d}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/20{background-color:#22c55e33}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted-foreground\/50{background-color:hsl(var(--muted-foreground) / .5)}.bg-muted\/20{background-color:hsl(var(--muted) / .2)}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-muted\/60{background-color:hsl(var(--muted) / .6)}.bg-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-50\/10{background-color:#fff7ed1a}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-500\/20{background-color:#f9731633}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary-foreground\/20{background-color:hsl(var(--primary-foreground) / .2)}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/15{background-color:hsl(var(--primary) / .15)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-primary\/60{background-color:hsl(var(--primary) / .6)}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/20{background-color:#ef444433}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/5{background-color:hsl(var(--secondary) / .05)}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\/10{background-color:#ffffff1a}.bg-white\/20{background-color:#fff3}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-500\/5{background-color:#eab3080d}.bg-yellow-900\/20{background-color:#713f1233}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-amber-50{--tw-gradient-from: #fffbeb var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 251 235 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-background{--tw-gradient-from: hsl(var(--background)) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-50{--tw-gradient-from: #eef2ff var(--tw-gradient-from-position);--tw-gradient-to: rgb(238 242 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-pink-50{--tw-gradient-from: #fdf2f8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(253 242 248 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-pink-500{--tw-gradient-from: #ec4899 var(--tw-gradient-from-position);--tw-gradient-to: rgb(236 72 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-pink-500\/10{--tw-gradient-from: rgb(236 72 153 / .1) var(--tw-gradient-from-position);--tw-gradient-to: rgb(236 72 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\/5{--tw-gradient-from: hsl(var(--primary) / .05) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-rose-50{--tw-gradient-from: #fff1f2 var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 241 242 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-200{--tw-gradient-from: #e2e8f0 var(--tw-gradient-from-position);--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-300{--tw-gradient-from: #cbd5e1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(203 213 225 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-400{--tw-gradient-from: #94a3b8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(148 163 184 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background)) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-blue-50{--tw-gradient-to: #eff6ff var(--tw-gradient-to-position)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-emerald-500{--tw-gradient-to: #10b981 var(--tw-gradient-to-position)}.to-green-600{--tw-gradient-to: #16a34a var(--tw-gradient-to-position)}.to-muted\/50{--tw-gradient-to: hsl(var(--muted) / .5) var(--tw-gradient-to-position)}.to-orange-50{--tw-gradient-to: #fff7ed var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-50{--tw-gradient-to: #fdf2f8 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-primary\/10{--tw-gradient-to: hsl(var(--primary) / .1) var(--tw-gradient-to-position)}.to-purple-50{--tw-gradient-to: #faf5ff var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.to-purple-500\/10{--tw-gradient-to: rgb(168 85 247 / .1) var(--tw-gradient-to-position)}.to-secondary\/5{--tw-gradient-to: hsl(var(--secondary) / .05) var(--tw-gradient-to-position)}.to-slate-700{--tw-gradient-to: #334155 var(--tw-gradient-to-position)}.to-slate-800{--tw-gradient-to: #1e293b var(--tw-gradient-to-position)}.to-slate-900{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.to-violet-50{--tw-gradient-to: #f5f3ff var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.fill-current{fill:currentColor}.fill-red-500{fill:#ef4444}.fill-yellow-400{fill:#facc15}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[1px\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.px-\[--cell-size\]{padding-left:var(--cell-size);padding-right:var(--cell-size)}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-0{padding-bottom:0}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-10{padding-left:2.5rem}.pl-11{padding-left:2.75rem}.pl-2{padding-left:.5rem}.pl-2\.5{padding-left:.625rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-16{padding-right:4rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[150px\]{font-size:150px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-tighter{letter-spacing:-.05em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-amber-800{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}.text-amber-900{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-indigo-600{--tw-text-opacity: 1;color:rgb(79 70 229 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/10{color:hsl(var(--muted-foreground) / .1)}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-500{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-orange-900{--tw-text-opacity: 1;color:rgb(124 45 18 / var(--tw-text-opacity, 1))}.text-pink-500{--tw-text-opacity: 1;color:rgb(236 72 153 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary-foreground\/70{color:hsl(var(--primary-foreground) / .7)}.text-primary\/10{color:hsl(var(--primary) / .1)}.text-primary\/30{color:hsl(var(--primary) / .3)}.text-primary\/60{color:hsl(var(--primary) / .6)}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-4{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-border\/50{--tw-ring-color: hsl(var(--border) / .5)}.ring-orange-500\/50{--tw-ring-color: rgb(249 115 22 / .5)}.ring-primary{--tw-ring-color: hsl(var(--primary))}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.delay-150{transition-delay:.15s}.delay-300{transition-delay:.3s}.duration-100{transition-duration:.1s}.duration-1000{transition-duration:1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.text-primary-gradient{color:hsl(var(--primary))}.has-gradient .text-primary-gradient{background:var(--primary-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.\[--cell-size\:2rem\]{--cell-size: 2rem}@font-face{font-family:JetBrains Mono;src:url(/fonts/JetBrainsMono-Medium.ttf) format("truetype");font-weight:500;font-style:normal;font-display:swap}.no-animations *,.no-animations *:before,.no-animations *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.no-animations *:hover{transition-duration:.01ms!important}::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:999}.__floater{z-index:99999!important;pointer-events:auto!important}.react-joyride__overlay,.react-joyride__spotlight{z-index:99998!important}.react-joyride__tooltip{pointer-events:auto!important}#tour-portal-container *{pointer-events:auto}.custom-scrollbar{scrollbar-width:thin;scrollbar-color:hsl(var(--border)) transparent}.custom-scrollbar::-webkit-scrollbar{width:8px;height:8px}.custom-scrollbar::-webkit-scrollbar-track{background:transparent;border-radius:4px}.custom-scrollbar::-webkit-scrollbar-thumb{background:hsl(var(--border));border-radius:4px;border:2px solid transparent;background-clip:content-box}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background:hsl(var(--muted-foreground) / .5);background-clip:content-box}.custom-scrollbar::-webkit-scrollbar-corner{background:transparent}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-green-200:hover{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.hover\:border-muted-foreground\/50:hover{border-color:hsl(var(--muted-foreground) / .5)}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:border-red-200:hover{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.hover\:bg-amber-700:hover{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.hover\:bg-background\/50:hover{background-color:hsl(var(--background) / .5)}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-50:hover{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-muted-foreground\/20:hover{background-color:hsl(var(--muted-foreground) / .2)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity, 1))}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary) / .1)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-50:hover{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-white\/30:hover{background-color:#ffffff4d}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:from-pink-500\/20:hover{--tw-gradient-from: rgb(236 72 153 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(236 72 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-purple-500\/20:hover{--tw-gradient-to: rgb(168 85 247 / .2) var(--tw-gradient-to-position)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-amber-900:hover{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-green-600:hover{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.hover\:text-green-700:hover{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.hover\:text-orange-700:hover{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity, 1))}.hover\:text-primary:hover{color:hsl(var(--primary))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-red-600:hover{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:text-yellow-300:hover{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-2xl:hover{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:ring-2:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:ring-primary:hover{--tw-ring-color: hsl(var(--primary))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-0:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\:cursor-grabbing:active{cursor:grabbing}.active\:border-primary\/70:active{border-color:hsl(var(--primary) / .7)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:-translate-y-1{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[state\=inactive\]\:hidden[data-state=inactive]{display:none}.data-\[state\=inactive\]\:h-0[data-state=inactive]{height:0px}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fade-out{0%{opacity:1}to{opacity:0}}.data-\[state\=closed\]\:animate-fade-out[data-state=closed]{animation:fade-out .15s ease-in}.data-\[state\=closed\]\:animate-slide-out-to-right[data-state=closed]{animation:slide-out-to-right .2s ease-in}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.data-\[state\=open\]\:animate-fade-in[data-state=open]{animation:fade-in .2s ease-out}@keyframes slide-in-from-right{0%{transform:translate(100%)}to{transform:translate(0)}}.data-\[state\=open\]\:animate-slide-in-from-right[data-state=open]{animation:slide-in-from-right .3s ease-out}@keyframes slide-out-to-right{0%{transform:translate(0)}to{transform:translate(100%)}}.data-\[swipe\=end\]\:animate-slide-out-to-right[data-swipe=end]{animation:slide-out-to-right .2s ease-in}.data-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true]{border-radius:0}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=active\]\:duration-300[data-state=active]{transition-duration:.3s}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}@supports (backdrop-filter: var(--tw)){.supports-\[backdrop-filter\]\:bg-background\/60{background-color:hsl(var(--background) / .6)}}.dark\:border-amber-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(146 64 14 / var(--tw-border-opacity, 1))}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.dark\:border-blue-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 58 138 / var(--tw-border-opacity, 1))}.dark\:border-gray-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(17 24 39 / var(--tw-border-opacity, 1))}.dark\:border-green-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(22 101 52 / var(--tw-border-opacity, 1))}.dark\:border-green-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(20 83 45 / var(--tw-border-opacity, 1))}.dark\:border-orange-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(124 45 18 / var(--tw-border-opacity, 1))}.dark\:border-red-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(127 29 29 / var(--tw-border-opacity, 1))}.dark\:border-yellow-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(113 63 18 / var(--tw-border-opacity, 1))}.dark\:bg-amber-950\/30:is(.dark *){background-color:#451a034d}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950\/20:is(.dark *){background-color:#17255433}.dark\:bg-blue-950\/30:is(.dark *){background-color:#1725544d}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/30:is(.dark *){background-color:#1f29374d}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-green-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(5 46 22 / var(--tw-bg-opacity, 1))}.dark\:bg-green-950\/20:is(.dark *){background-color:#052e1633}.dark\:bg-orange-950\/20:is(.dark *){background-color:#43140733}.dark\:bg-red-500\/20:is(.dark *){background-color:#ef444433}.dark\:bg-red-600\/30:is(.dark *){background-color:#dc26264d}.dark\:bg-red-900\/30:is(.dark *){background-color:#7f1d1d4d}.dark\:bg-red-950\/20:is(.dark *){background-color:#450a0a33}.dark\:bg-red-950\/50:is(.dark *){background-color:#450a0a80}.dark\:bg-yellow-500\/20:is(.dark *){background-color:#eab30833}.dark\:bg-yellow-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(113 63 18 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:from-amber-950\/20:is(.dark *){--tw-gradient-from: rgb(69 26 3 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(69 26 3 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-indigo-950\/20:is(.dark *){--tw-gradient-from: rgb(30 27 75 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(30 27 75 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-pink-950\/20:is(.dark *){--tw-gradient-from: rgb(80 7 36 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(80 7 36 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-rose-950\/20:is(.dark *){--tw-gradient-from: rgb(76 5 25 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(76 5 25 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:to-blue-950\/20:is(.dark *){--tw-gradient-to: rgb(23 37 84 / .2) var(--tw-gradient-to-position)}.dark\:to-orange-950\/20:is(.dark *){--tw-gradient-to: rgb(67 20 7 / .2) var(--tw-gradient-to-position)}.dark\:to-pink-950\/20:is(.dark *){--tw-gradient-to: rgb(80 7 36 / .2) var(--tw-gradient-to-position)}.dark\:to-purple-950\/20:is(.dark *){--tw-gradient-to: rgb(59 7 100 / .2) var(--tw-gradient-to-position)}.dark\:to-violet-950\/20:is(.dark *){--tw-gradient-to: rgb(46 16 101 / .2) var(--tw-gradient-to-position)}.dark\:text-amber-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 243 199 / var(--tw-text-opacity, 1))}.dark\:text-amber-200:is(.dark *){--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.dark\:text-amber-400:is(.dark *){--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.dark\:text-amber-500:is(.dark *){--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.dark\:text-blue-100:is(.dark *){--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-cyan-500:is(.dark *){--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-green-300:is(.dark *){--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-indigo-400:is(.dark *){--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.dark\:text-orange-100:is(.dark *){--tw-text-opacity: 1;color:rgb(255 237 213 / var(--tw-text-opacity, 1))}.dark\:text-orange-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 215 170 / var(--tw-text-opacity, 1))}.dark\:text-red-300:is(.dark *){--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-red-500:is(.dark *){--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:text-yellow-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.dark\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:text-yellow-500:is(.dark *){--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:hover\:text-amber-200:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.dark\:focus\:bg-gray-800:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}@media(min-width:640px){.sm\:right-2{right:.5rem}.sm\:right-3{right:.75rem}.sm\:top-2{top:.5rem}.sm\:top-3{top:.75rem}.sm\:order-1{order:1}.sm\:order-2{order:2}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-3{margin-bottom:.75rem}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:ml-0{margin-left:0}.sm\:ml-1{margin-left:.25rem}.sm\:mr-1{margin-right:.25rem}.sm\:mt-0{margin-top:0}.sm\:mt-2{margin-top:.5rem}.sm\:mt-3{margin-top:.75rem}.sm\:mt-6{margin-top:1.5rem}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-12{height:3rem}.sm\:h-2{height:.5rem}.sm\:h-2\.5{height:.625rem}.sm\:h-24{height:6rem}.sm\:h-4{height:1rem}.sm\:h-5{height:1.25rem}.sm\:h-8{height:2rem}.sm\:h-9{height:2.25rem}.sm\:h-\[300px\]{height:300px}.sm\:h-\[400px\]{height:400px}.sm\:h-\[500px\]{height:500px}.sm\:h-\[85vh\]{height:85vh}.sm\:h-\[calc\(100vh-220px\)\]{height:calc(100vh - 220px)}.sm\:h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.sm\:w-10{width:2.5rem}.sm\:w-2{width:.5rem}.sm\:w-2\.5{width:.625rem}.sm\:w-24{width:6rem}.sm\:w-28{width:7rem}.sm\:w-32{width:8rem}.sm\:w-4{width:1rem}.sm\:w-48{width:12rem}.sm\:w-5{width:1.25rem}.sm\:w-8{width:2rem}.sm\:w-80{width:20rem}.sm\:w-96{width:24rem}.sm\:w-\[200px\]{width:200px}.sm\:w-\[500px\]{width:500px}.sm\:w-auto{width:auto}.sm\:w-full{width:100%}.sm\:min-w-\[120px\]{min-width:120px}.sm\:max-w-2xl{max-width:42rem}.sm\:max-w-32{max-width:8rem}.sm\:max-w-\[420px\]{max-width:420px}.sm\:max-w-\[500px\]{max-width:500px}.sm\:max-w-\[70\%\]{max-width:70%}.sm\:max-w-\[900px\]{max-width:900px}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-1{flex:1 1 0%}.sm\:flex-none{flex:none}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-start{align-items:flex-start}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-0{gap:0px}.sm\:gap-1{gap:.25rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.sm\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.sm\:space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.sm\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:p-8{padding:2rem}.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-2{padding-top:.5rem;padding-bottom:.5rem}.sm\:pb-3{padding-bottom:.75rem}.sm\:pt-6{padding-top:1.5rem}.sm\:text-left{text-align:left}.sm\:text-right{text-align:right}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-6xl{font-size:3.75rem;line-height:1}.sm\:text-\[200px\]{font-size:200px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}.sm\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:768px){.md\:top-4{top:1rem}.md\:col-span-2{grid-column:span 2 / span 2}.md\:mb-4{margin-bottom:1rem}.md\:mb-6{margin-bottom:1.5rem}.md\:mb-8{margin-bottom:2rem}.md\:mt-8{margin-top:2rem}.md\:block{display:block}.md\:inline{display:inline}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-16{height:4rem}.md\:h-4{height:1rem}.md\:h-5{height:1.25rem}.md\:h-8{height:2rem}.md\:h-96{height:24rem}.md\:h-\[500px\]{height:500px}.md\:min-h-\[400px\]{min-height:400px}.md\:w-16{width:4rem}.md\:w-4{width:1rem}.md\:w-5{width:1.25rem}.md\:w-8{width:2rem}.md\:w-96{width:24rem}.md\:max-w-none{max-width:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-2{gap:.5rem}.md\:gap-3{gap:.75rem}.md\:gap-4{gap:1rem}.md\:gap-6{gap:1.5rem}.md\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.md\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.md\:whitespace-normal{white-space:normal}.md\:p-12{padding:3rem}.md\:p-4{padding:1rem}.md\:p-6{padding:1.5rem}.md\:p-8{padding:2rem}.md\:text-2xl{font-size:1.5rem;line-height:2rem}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-lg{font-size:1.125rem;line-height:1.75rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:1024px){.lg\:invisible{visibility:hidden}.lg\:relative{position:relative}.lg\:z-0{z-index:0}.lg\:col-span-1{grid-column:span 1 / span 1}.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:mx-auto{margin-left:auto;margin-right:auto}.lg\:mb-1{margin-bottom:.25rem}.lg\:block{display:block}.lg\:inline{display:inline}.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:w-12{width:3rem}.lg\:w-16{width:4rem}.lg\:w-64{width:16rem}.lg\:w-8{width:2rem}.lg\:w-\[130px\]{width:130px}.lg\:w-\[160px\]{width:160px}.lg\:w-\[75px\]{width:75px}.lg\:w-auto{width:auto}.lg\:w-full{width:100%}.lg\:max-w-0{max-width:0px}.lg\:flex-1{flex:1 1 0%}.lg\:flex-none{flex:none}.lg\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:items-center{align-items:center}.lg\:justify-center{justify-content:center}.lg\:gap-0{gap:0px}.lg\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.lg\:overflow-hidden{overflow:hidden}.lg\:p-2{padding:.5rem}.lg\:p-4{padding:1rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:px-4{padding-left:1rem;padding-right:1rem}.lg\:pb-4{padding-bottom:1rem}.lg\:text-2xl{font-size:1.5rem;line-height:2rem}.lg\:opacity-0{opacity:0}}@media(min-width:1280px){.xl\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}@media print{.print\:hidden{display:none}.print\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.print\:rounded-none{border-radius:0}.print\:p-0{padding:0}.print\:shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\:\:-webkit-scrollbar-thumb\:hover\]\:bg-border\/80::-webkit-scrollbar-thumb:hover{background-color:hsl(var(--border) / .8)}.\[\&\:\:-webkit-scrollbar-thumb\]\:rounded-full::-webkit-scrollbar-thumb{border-radius:9999px}.\[\&\:\:-webkit-scrollbar-thumb\]\:bg-border::-webkit-scrollbar-thumb{background-color:hsl(var(--border))}.\[\&\:\:-webkit-scrollbar-track\]\:bg-transparent::-webkit-scrollbar-track{background-color:transparent}.\[\&\:\:-webkit-scrollbar\]\:w-2\.5::-webkit-scrollbar{width:.625rem}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>div\]\:bg-green-500>div{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:hsl(var(--muted-foreground))}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:hsl(var(--border) / .5)}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:hsl(var(--border))}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-layer\]\:outline-none .recharts-layer{outline:2px solid transparent;outline-offset:2px}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:hsl(var(--muted))}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-sector\]\:outline-none .recharts-sector,.\[\&_\.recharts-surface\]\:outline-none .recharts-surface{outline:2px solid transparent;outline-offset:2px}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:invisible svg{visibility:hidden}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}[data-slot=card-content] .\[\[data-slot\=card-content\]_\&\]\:bg-transparent,[data-slot=popover-content] .\[\[data-slot\=popover-content\]_\&\]\:bg-transparent{background-color:transparent}@font-face{font-display:block;font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2) format("woff2"),url(/assets/KaTeX_AMS-Regular-DMm9YOAa.woff) format("woff"),url(/assets/KaTeX_AMS-Regular-DRggAlZN.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff) format("woff"),url(/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff) format("woff"),url(/assets/KaTeX_Fraktur-Regular-CB_wures.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Main-Bold-Cx986IdX.woff2) format("woff2"),url(/assets/KaTeX_Main-Bold-Jm3AIy58.woff) format("woff"),url(/assets/KaTeX_Main-Bold-waoOVXN0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2) format("woff2"),url(/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff) format("woff"),url(/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2) format("woff2"),url(/assets/KaTeX_Main-Italic-BMLOBm91.woff) format("woff"),url(/assets/KaTeX_Main-Italic-3WenGoN9.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Main-Regular-B22Nviop.woff2) format("woff2"),url(/assets/KaTeX_Main-Regular-Dr94JaBh.woff) format("woff"),url(/assets/KaTeX_Main-Regular-ypZvNtVU.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2) format("woff2"),url(/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff) format("woff"),url(/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Math-Italic-t53AETM-.woff2) format("woff2"),url(/assets/KaTeX_Math-Italic-DA0__PXp.woff) format("woff"),url(/assets/KaTeX_Math-Italic-flOr_0UB.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff) format("woff"),url(/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff) format("woff"),url(/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff) format("woff"),url(/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Script-Regular-D3wIWfF6.woff2) format("woff2"),url(/assets/KaTeX_Script-Regular-D5yQViql.woff) format("woff"),url(/assets/KaTeX_Script-Regular-C5JkGWo-.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2) format("woff2"),url(/assets/KaTeX_Size1-Regular-C195tn64.woff) format("woff"),url(/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2) format("woff2"),url(/assets/KaTeX_Size2-Regular-oD1tc_U0.woff) format("woff"),url(/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(data:font/woff2;base64,d09GMgABAAAAAA4oAA4AAAAAHbQAAA3TAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgRQIDgmcDBEICo1oijYBNgIkA14LMgAEIAWJAAeBHAyBHBvbGiMRdnO0IkRRkiYDgr9KsJ1NUAf2kILNxgUmgqIgq1P89vcbIcmsQbRps3vCcXdYOKSWEPEKgZgQkprQQsxIXUgq0DqpGKmIvrgkeVGtEQD9DzAO29fM9jYhxZEsL2FeURH2JN4MIcTdO049NCVdxQ/w9NrSYFEBKTDKpLKfNkCGDc1RwjZLQcm3vqJ2UW9Xfa3tgAHz6ivp6vgC2yD4/6352ndnN0X0TL7seypkjZlMsjmZnf0Mm5Q+JykRWQBKCVCVPbARPXWyQtb5VgLB6Biq7/Uixcj2WGqdI8tGSgkuRG+t910GKP2D7AQH0DB9FMDW/obJZ8giFI3Wg8Cvevz0M+5m0rTh7XDBlvo9Y4vm13EXmfttwI4mBo1EG15fxJhUiCLbiiyCf/ZA6MFAhg3pGIZGdGIVjtPn6UcMk9A/UUr9PhoNsCENw1APAq0gpH73e+M+0ueyHbabc3vkbcdtzcf/fiy+NxQEjf9ud/ELBHAXJ0nk4z+MXH2Ev/kWyV4k7SkvpPc9Qr38F6RPWnM9cN6DJ0AdD1BhtgABtmoRoFCvPsBAumNm6soZG2Gk5GyVTo2sJncSyp0jQTYoR6WDvTwaaEcHsxHfvuWhHA3a6bN7twRKtcGok6NsCi7jYRrM2jExsUFMxMQYuJbMhuWNOumEJy9hi29Dmg5zMp/A5+hhPG19j1vBrq8JTLr8ki5VLPmG/PynJHVul440bxg5xuymHUFPBshC+nA9I1FmwbRBTNHAcik3Oae0cxKoI3MOriM42UrPe51nsaGxJ+WfXubAsP84aabUlQSJ1IiE0iPETLUU4CATgfXSCSpuRFRmCGbO+wSpAnzaeaCYW1VNEysRtuXCEL1kUFUbbtMv3Tilt/1c11jt3Q5bbMa84cpWipp8Elw3MZhOHsOlwwVUQM3lAR35JiFQbaYCRnMF2lxAWoOg2gyoIV4PouX8HytNIfLhqpJtXB4vjiViUI8IJ7bkC4ikkQvKksnOTKICwnqWSZ9YS5f0WCxmpgjbIq7EJcM4aI2nmhLNY2JIUgOjXZFWBHb+x5oh6cwb0Tv1ackHdKi0I9OO2wE9aogIOn540CCCziyhN+IaejtgAONKznHlHyutPrHGwCx9S6B8kfS4Mfi4Eyv7OU730bT1SCBjt834cXsf43zVjPUqqJjgrjeGnBxSG4aYAKFuVbeCfkDIjAqMb6yLNIbCuvXhMH2/+k2vkNpkORhR59N1CkzoOENvneIosjYmuTxlhUzaGEJQ/iWqx4dmwpmKjrwTiTGTCVozNAYqk/zXOndWxuWSmJkQpJw3pK5KX6QrLt5LATMqpmPAQhkhK6PUjzHUn7E0gHE0kPE0iKkolgkUx9SZmVAdDgpffdyJKg3k7VmzYGCwVXGz/tXmkOIp+vcWs+EMuhhvN0h9uhfzWJziBQmCREGSIFmQIkgVpAnSBRmC//6hkLZwaVhwxlrJSOdqlFtOYxlau9F2QN5Y98xmIAsiM1HVp2VFX+DHHGg6Ecjh3vmqtidX3qHI2qycTk/iwxSt5UzTmEP92ZBnEWTk4Mx8Mpl78ZDokxg/KWb+Q0QkvdKVmq3TMW+RXEgrsziSAfNXFMhDc60N5N9jQzjfO0kBKpUZl0ZmwJ41j/B9Hz6wmRaJB84niNmQrzp9eSlQCDDzazGDdVi3P36VZQ+Jy4f9UBNp+3zTjqI4abaFAm+GShVaXlsGdF3FYzZcDI6cori4kMxUECl9IjJZpzkvitAoxKue+90pDMvcKRxLl53TmOKCmV/xRolNKSqqUxc6LStOETmFOiLZZptlZepcKiAzteG8PEdpnQpbOMNcMsR4RR2Bs0cKFEvSmIjAFcnarqwUL4lDhHmnVkwu1IwshbiCcgvOheZuYyOteufZZwlcTlLgnZ3o/WcYdzZHW/WGaqaVfmTZ1aWCceJjkbZqsfbkOtcFlUZM/jy+hXHDbaUobWqqXaeWobbLO99yG5N3U4wxco0rQGGcOLASFMXeJoham8M+/x6O2WywK2l4HGbq1CoUyC/IZikQhdq3SiuNrvAEj0AVu9x2x3lp/xWzahaxidezFVtdcb5uEnzyl0ZmYiuKI0exvCd4Xc9CV1KB0db00z92wDPde0kukbvZIWN6jUWFTmPIC/Y4UPCm8UfDTFZpZNon1qLFTkBhxzB+FjQRA2Q/YRJT8pQigslMaUpFyAG8TMlXigiqmAZX4xgijKjRlGpLE0GdplRfCaJo0JQaSxNBk6ZmMzcya0FmrcisDdn0Q3HI2sWSppYigmlM1XT/kLQZSNpMJG0WkjYbSZuDpM1F0uYhFc1HxU4m1QJjDK6iL0S5uSj5rgXc3RejEigtcRBtqYPQsiTskmO5vosV+q4VGIKbOkDg0jtRrq+Em1YloaTFar3EGr1EUC8R0kus1Uus00usL97ABr2BjXoDm/QGNhuWtMVBKOwg/i78lT7hBsAvDmwHc/ao3vmUbBmhjeYySZNWvGkfZAgISDSaDo1SVpzGDsAEkF8B+gEapViUoZgUWXcRIGFZNm6gWbAKk0bp0k1MHG9fLYtV4iS2SmLEQFARzRcnf9PUS0LVn05/J9MiRRBU3v2IrvW974v4N00L7ZMk0wXP1409CHo/an8zTRHD3eSJ6m8D4YMkZNl3M79sqeuAsr/m3f+8/yl7A50aiAEJgeBeMWzu7ui9UfUBCe2TIqZIoOd/3/udRBOQidQZUERzb2/VwZN1H/Sju82ew2H2Wfr6qvfVf3hqwDvAIpkQVFy4B9Pe9e4/XvPeceu7h3dvO56iJPf0+A6cqA2ip18ER+iFgggiuOkvj24bby0N9j2UHIkgqIt+sVgfodC4YghLSMjSZbH0VR/6dMDrYJeKHilKTemt6v6kvzvn3/RrdWtr0GoN/xL+Sex/cPYLUpepx9cz/D46UPU5KXgAQa+NDps1v6J3xP1i2HtaDB0M9aX2deA7SYff//+gUCovMmIK/qfsFcOk+4Y5ZN97XlG6zebqtMbKgeRFi51vnxTQYBUik2rS/Cn6PC8ADR8FGxsRPB82dzfND90gIcshOcYUkfjherBz53odpm6TP8txlwOZ71xmfHHOvq053qFF/MRlS3jP0ELudrf2OeN8DHvp6ZceLe8qKYvWz/7yp0u4dKPfli3CYq0O13Ih71mylJ80tOi10On8wi+F4+LWgDPeJ30msSQt9/vkmHq9/Lvo2b461mP801v3W4xTcs6CbvF9UDdrSt+A8OUbpSh55qAUFXWznBBfdeJ8a4d7ugT5tvxUza3h9m4H7ptTqiG4z0g5dc0X29OcGlhpGFMpQo9ytTS+NViZpNdvU4kWx+LKxNY10kQ1yqGXrhe4/1nvP7E+nd5A92TtaRplbHSqoIdOqtRWti+fkB5/n1+/VvCmz12pG1kpQWsfi1ftlBobm0bpngs16CHkbIwdLnParxtTV3QYRlfJ0KFskH7pdN/YDn+yRuSd7sNH3aO0DYPggk6uWuXrfOc+fa3VTxFVvKaNxHsiHmsXyCLIE5yuOeN3/Jdf8HBL/5M6shjyhxHx9BjB1O0+4NLOnjLLSxwO7ukN4jMbOIcD879KLSi6Pk61Oqm2377n8079PXEEQ7cy7OKEC9nbpet118fxweTafpt69x/Bt8UqGzNQt7aelpc44dn5cqhwf71+qKp/Zf/+a0zcizOUWpl/iBcSXip0pplkatCchoH5c5aUM8I7/dWxAej8WicPL1URFZ9BDJelUwEwTkGqUhgSlydVes95YdXvhh9Gfz/aeFWvgVb4tuLbcv4+wLdutVZv/cUonwBD/6eDlE0aSiKK/uoH3+J1wDE/jMVqY2ysGufN84oIXB0sPzy8ollX/LegY74DgJXJR57sn+VGza0x3DnuIgABFM15LmajjjsNlYj+JEZGbuRYcAMOWxFkPN2w6Wd46xo4gVWQR/X4lyI/R6K/YK0110GzudPRW7Y+UOBGTfNNzHeYT0fiH0taunBpq9HEW8OKSaBGj21L0MqenEmNRWBAWDWAk4CpNoEZJ2tTaPFgbQYj8HxtFilErs3BTRwT8uO1NXQaWfIotchmPkAF5mMBAliEmZiOGVgCG9LgRzpscMAOOwowlT3JhusdazXGSC/hxR3UlmWVwWHpOIKheqONvjyhSiTHIkVUco5bnji8m//zL7PKaT1Vl5I6UE609f+gkr6MZKVyKc7zJRmCahLsdlyA5fdQkRSan9LgnnLEyGSkaKJCJog0wAgvepWBt80+1yKln1bMVtCljfNWDueKLsWwaEbBSfSPTEmVRsUcYYMnEjcjeyCZzBXK9E9BYBXLKjOSpUDR+nEV3TFSUdQaz+ot98QxgXwx0GQ+EEUAKB2qZPkQQ0GqFD8UPFMqyaCHM24BZmSGic9EYMagKizOw9Hz50DMrDLrqqLkTAhplMictiCAx5S3BIUQdeJeLnBy2CNtMfz6cV4u8XKoFZQesbf9YZiIERiHjaNodDW6LgcirX/mPnJIkBGDUpTBhSa0EIr38D5hCIszhCM8URGBqImoWjpvpt1ebu/v3Gl3qJfMnNM+9V+kiRFyROTPHQWOcs1dNW94/ukKMPZBvDi55i5CttdeJz84DLngLqjcdwEZ87bFFR8CIG35OAkDVN6VRDZ7aq67NteYqZ2lpT8oYB2CytoBd6VuAx4WgiAsnuj3WohG+LugzXiQRDeM3XYXlULv4dp5VFYC) format("woff2"),url(/assets/KaTeX_Size3-Regular-CTq5MqoE.woff) format("woff"),url(/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2) format("woff2"),url(/assets/KaTeX_Size4-Regular-BF-4gkZK.woff) format("woff"),url(/assets/KaTeX_Size4-Regular-DWFBv043.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2) format("woff2"),url(/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff) format("woff"),url(/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf) format("truetype")}.katex{font: 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0;text-rendering:auto}.katex *{-ms-high-contrast-adjust:none!important;border-color:currentColor}.katex .katex-version:after{content:"0.16.27"}.katex .katex-mathml{clip:rect(1px,1px,1px,1px);border:0;height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:-moz-min-content;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .mathsfit,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;display:inline-table;table-layout:fixed}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;position:relative;vertical-align:bottom}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;font-size:1px;min-width:2px;vertical-align:bottom;width:2px}.katex .vbox{align-items:baseline;display:inline-flex;flex-direction:column}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{display:inline-flex;flex-direction:row}.katex .thinbox{max-width:0;width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{position:relative;width:0}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline{border-bottom-style:dashed;display:inline-block;width:100%}.katex .sqrt>.root{margin-left:.2777777778em;margin-right:-.5555555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.1666666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.6666666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.4566666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.1466666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.7142857143em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.8571428571em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.1428571429em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.2857142857em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.4285714286em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.7142857143em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.0571428571em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.4685714286em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.9628571429em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.5542857143em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.7777777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.8888888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.1111111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.3044444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.7644444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.5833333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.7283333333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.0733333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.4861111111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.4402777778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.7277777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.2893518519em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.4050925926em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.462962963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.5208333333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.2002314815em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.4398148148em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.2410800386em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2892960463em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.337512054em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.3857280617em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.4339440694em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.4821600771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.5785920926em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.6943105111em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8331726133em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.1996142719em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.2009646302em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.2411575563em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.2813504823em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.3215434084em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.3617363344em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.4019292605em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.4823151125em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.578778135em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.6945337621em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.8336012862em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:block;height:inherit;position:absolute;width:100%}.katex svg path{stroke:none}.katex img{border-style:none;max-height:none;max-width:none;min-height:0;min-width:0}.katex .stretchy{display:block;overflow:hidden;position:relative;width:100%}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{overflow:hidden;position:relative;width:100%}.katex .halfarrow-left{left:0;overflow:hidden;position:absolute;width:50.2%}.katex .halfarrow-right{overflow:hidden;position:absolute;right:0;width:50.2%}.katex .brace-left{left:0;overflow:hidden;position:absolute;width:25.1%}.katex .brace-center{left:25%;overflow:hidden;position:absolute;width:50%}.katex .brace-right{overflow:hidden;position:absolute;right:0;width:25.1%}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{border:.04em solid;box-sizing:border-box}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{border-right:.049em solid;border-top:.049em solid;box-sizing:border-box;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;left:calc(50% + .3em);position:absolute;text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{padding-left:2em;text-align:left}body{counter-reset:katexEqnNo mmlEqnNo}.uppy-Root{box-sizing:border-box;color:#333;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;line-height:1;position:relative;text-align:left;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.uppy-Root[dir=rtl],[dir=rtl] .uppy-Root{text-align:right}.uppy-Root *,.uppy-Root :after,.uppy-Root :before{box-sizing:inherit}.uppy-Root [hidden]{display:none}.uppy-u-reset{all:initial;-webkit-appearance:none;-moz-appearance:none;appearance:none;box-sizing:border-box;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;line-height:1}[dir=rtl] .uppy-u-reset{text-align:right}.uppy-truncate-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.uppy-c-textInput{background-color:#fff;border:1px solid #ddd;border-radius:4px;font-family:inherit;font-size:14px;line-height:1.5;padding:6px 8px}.uppy-size--md .uppy-c-textInput{padding:8px 10px}.uppy-c-textInput:focus{border-color:#1269cf99;box-shadow:0 0 0 3px #1269cf26;outline:none}[data-uppy-theme=dark] .uppy-c-textInput{background-color:#333;border-color:#333;color:#eaeaea}[data-uppy-theme=dark] .uppy-c-textInput:focus{border-color:#525252;box-shadow:none}.uppy-c-icon{display:inline-block;max-height:100%;max-width:100%;overflow:hidden;fill:currentColor}.uppy-c-btn{align-items:center;color:inherit;display:inline-flex;font-family:inherit;font-size:inherit;font-weight:500;justify-content:center;line-height:1;transition-duration:.3s;transition-property:background-color,color;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.uppy-c-btn,[dir=rtl] .uppy-c-btn{text-align:center}.uppy-c-btn:not(:disabled):not(.disabled){cursor:pointer}.uppy-c-btn::-moz-focus-inner{border:0}.uppy-c-btn-primary{background-color:#1269cf;border-radius:4px;color:#fff;font-size:14px;padding:10px 18px}.uppy-c-btn-primary:not(:disabled):hover{background-color:#0e51a0}.uppy-c-btn-primary:focus{box-shadow:0 0 0 3px #1269cf66;outline:none}.uppy-size--md .uppy-c-btn-primary{padding:13px 22px}[data-uppy-theme=dark] .uppy-c-btn-primary{color:#eaeaea}[data-uppy-theme=dark] .uppy-c-btn-primary:focus{outline:none}[data-uppy-theme=dark] .uppy-c-btn-primary::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-c-btn-primary:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-c-btn-primary.uppy-c-btn--disabled{background-color:#8eb2db}.uppy-c-btn-link{background-color:initial;border-radius:4px;color:#525252;font-size:14px;line-height:1;padding:10px 15px}.uppy-c-btn-link:hover{color:#333}.uppy-c-btn-link:focus{box-shadow:0 0 0 3px #1269cf40;outline:none}.uppy-size--md .uppy-c-btn-link{padding:13px 18px}[data-uppy-theme=dark] .uppy-c-btn-link{color:#eaeaea}[data-uppy-theme=dark] .uppy-c-btn-link:focus{outline:none}[data-uppy-theme=dark] .uppy-c-btn-link::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-c-btn-link:focus{box-shadow:0 0 0 2px #aae1ffd9}[data-uppy-theme=dark] .uppy-c-btn-link:hover{color:#939393}.uppy-ProviderBrowser-viewType--grid ul.uppy-ProviderBrowser-list,.uppy-ProviderBrowser-viewType--unsplash ul.uppy-ProviderBrowser-list{align-items:flex-start;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between;padding:6px}.uppy-ProviderBrowser-viewType--grid ul.uppy-ProviderBrowser-list:after,.uppy-ProviderBrowser-viewType--unsplash ul.uppy-ProviderBrowser-list:after{content:"";flex:auto}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem{margin:0;position:relative;width:50%}.uppy-size--md .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem,.uppy-size--md .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem{width:33.3333%}.uppy-size--lg .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem,.uppy-size--lg .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem{width:25%}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem:before,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem:before{content:"";display:block;padding-top:100%}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--selected img,.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--selected svg,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--selected img,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--selected svg{opacity:.85}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--disabled,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--disabled{opacity:.5}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner{background-color:#93939333}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner,[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner{background-color:#eaeaea33}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview svg,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview svg{height:30%;width:30%;fill:#000000b3}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview svg,[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview svg{fill:#fffc}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner{border-radius:4px;height:calc(100% - 14px);inset:7px;overflow:hidden;position:absolute;text-align:center;width:calc(100% - 14px)}@media(hover:none){.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner .uppy-ProviderBrowserItem-author{display:block}}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner,[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner{box-shadow:0 0 0 3px #aae1ffb3}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner img,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner img{border-radius:4px;height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-author{background:#0000004d;bottom:0;color:#fff;display:none;font-size:12px;font-weight:500;left:0;margin:0;padding:5px;position:absolute;text-decoration:none;width:100%}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-author:hover,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-author:hover{background:#0006;text-decoration:underline}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox{background-color:#1269cf;border-radius:50%;height:26px;opacity:0;position:absolute;right:16px;top:16px;width:26px;z-index:1002}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox:after,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox:after{height:7px;inset-inline-start:7px;top:8px;width:12px}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox{opacity:1}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:hover+label .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:hover+label .uppy-ProviderBrowserItem-author{display:block}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label{box-shadow:0 0 0 3px #1269cf80}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label:focus,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label:focus{outline:none}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label::-moz-focus-inner,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label::-moz-focus-inner{border:0}.uppy-ProviderBrowser-viewType--list{background-color:#fff}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--list{background-color:#1f1f1f}.uppy-ProviderBrowser-viewType--list li.uppy-ProviderBrowserItem{align-items:center;display:flex;margin:0;padding:7px 15px}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--list li.uppy-ProviderBrowserItem{color:#eaeaea}.uppy-ProviderBrowser-viewType--list li.uppy-ProviderBrowserItem--disabled{opacity:.6}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox{background-color:#fff;border:1px solid #cfcfcf;border-radius:3px;height:17px;margin-inline-end:15px;width:17px}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox:focus{border:1px solid #1269cf;box-shadow:0 0 0 3px #1269cf40;outline:none}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox:after{height:5px;inset-inline-start:3px;opacity:0;top:4px;width:9px}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox:focus{border-color:#02baf2b3;box-shadow:0 0 0 3px #02baf233}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox,.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-partial .uppy-ProviderBrowserItem-checkbox{background-color:#1269cf;border-color:#1269cf}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox:after,.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-partial .uppy-ProviderBrowserItem-checkbox:after{opacity:1}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner{align-items:center;color:inherit;display:flex;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;overflow:hidden;padding:2px;text-overflow:ellipsis;white-space:nowrap}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner:focus{outline:none;text-decoration:underline}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner img,.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner svg{margin-inline-end:8px}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner span{line-height:1.2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--disabled .uppy-ProviderBrowserItem-inner{cursor:default}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-iconWrap{margin-inline-end:7px;width:20px}.uppy-ProviderBrowserItem-checkbox{cursor:pointer;flex-shrink:0;position:relative}.uppy-ProviderBrowserItem-checkbox:disabled,.uppy-ProviderBrowserItem-checkbox:disabled:after{cursor:default}[data-uppy-theme=dark] .uppy-ProviderBrowserItem-checkbox{background-color:#1f1f1f;border-color:#939393}[data-uppy-theme=dark] .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox{background-color:#333}.uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox:after{border-bottom:2px solid #eaeaea;border-left:2px solid #eaeaea;content:"";cursor:pointer;position:absolute;transform:rotate(-45deg)}.uppy-ProviderBrowserItem--is-partial .uppy-ProviderBrowserItem-checkbox:after{background-color:#eaeaea!important;content:""!important;height:2px!important;left:20%!important;position:absolute!important;right:20%!important;top:50%!important;transform:translateY(-50%)!important}.uppy-SearchProvider{align-items:center;display:flex;flex:1;flex-direction:column;height:100%;justify-content:center;width:100%}[data-uppy-theme=dark] .uppy-SearchProvider{background-color:#1f1f1f}.uppy-SearchProvider-input{margin-bottom:15px;max-width:650px;width:90%}.uppy-size--md .uppy-SearchProvider-input{margin-bottom:20px}.uppy-SearchProvider-input::-webkit-search-cancel-button{display:none}.uppy-SearchProvider-searchButton{padding:13px 25px}.uppy-size--md .uppy-SearchProvider-searchButton{padding:13px 30px}.uppy-DashboardContent-panelBody{align-items:center;display:flex;flex:1;justify-content:center}[data-uppy-theme=dark] .uppy-DashboardContent-panelBody{background-color:#1f1f1f}.uppy-Provider-auth,.uppy-Provider-empty,.uppy-Provider-error,.uppy-Provider-loading{align-items:center;color:#939393;display:flex;flex:1;flex-flow:column wrap;justify-content:center}.uppy-Provider-empty{color:#939393}.uppy-Provider-authIcon svg{height:75px;width:100px}.uppy-Provider-authTitle{color:#757575;font-size:17px;font-weight:400;line-height:1.4;margin-bottom:30px;max-width:500px;padding:0 15px;text-align:center}.uppy-size--md .uppy-Provider-authTitle{font-size:20px}[data-uppy-theme=dark] .uppy-Provider-authTitle{color:#cfcfcf}.uppy-Provider-btn-google{align-items:center;background:#4285f4;display:flex;padding:8px 12px!important}.uppy-Provider-btn-google:hover{background-color:#1266f1}.uppy-Provider-btn-google:focus{box-shadow:0 0 0 3px #4285f466;outline:none}.uppy-Provider-btn-google svg{margin-right:8px}.uppy-Provider-breadcrumbs{color:#525252;flex:1;font-size:12px;margin-bottom:10px;text-align:start}.uppy-size--md .uppy-Provider-breadcrumbs{margin-bottom:0}[data-uppy-theme=dark] .uppy-Provider-breadcrumbs{color:#eaeaea}.uppy-Provider-breadcrumbsIcon{color:#525252;display:inline-block;line-height:1;margin-inline-end:4px;vertical-align:middle}.uppy-Provider-breadcrumbsIcon svg{height:13px;width:13px;fill:#525252}.uppy-Provider-breadcrumbs button{border-radius:3px;display:inline-block;line-height:inherit;padding:4px}.uppy-Provider-breadcrumbs button:focus{outline:none}.uppy-Provider-breadcrumbs button::-moz-focus-inner{border:0}.uppy-Provider-breadcrumbs button:hover{color:#0e51a0}.uppy-Provider-breadcrumbs button:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-Provider-breadcrumbs button:focus{background-color:#333}.uppy-Provider-breadcrumbs button:not(:last-of-type){text-decoration:underline}.uppy-Provider-breadcrumbs button:last-of-type{color:#333;cursor:normal;font-weight:500;pointer-events:none}.uppy-Provider-breadcrumbs button:hover{cursor:pointer}[data-uppy-theme=dark] .uppy-Provider-breadcrumbs button{color:#eaeaea}.uppy-ProviderBrowser{display:flex;flex:1;flex-direction:column;font-size:14px;font-weight:400;height:100%}.uppy-ProviderBrowser-user{color:#333;font-weight:500;margin:0 8px 0 0}[data-uppy-theme=dark] .uppy-ProviderBrowser-user{color:#eaeaea}.uppy-ProviderBrowser-user:after{color:#939393;content:"·";font-weight:400;inset-inline-start:4px;position:relative}.uppy-ProviderBrowser-header{border-bottom:1px solid #eaeaea;position:relative;z-index:1001}[data-uppy-theme=dark] .uppy-ProviderBrowser-header{border-bottom:1px solid #333}.uppy-ProviderBrowser-headerBar{background-color:#fafafa;color:#757575;font-size:12px;line-height:1.4;padding:7px 15px;z-index:1001}.uppy-size--md .uppy-ProviderBrowser-headerBar{align-items:center;display:flex}[data-uppy-theme=dark] .uppy-ProviderBrowser-headerBar{background-color:#1f1f1f}.uppy-ProviderBrowser-headerBar--simple{display:block;justify-content:center;text-align:center}.uppy-ProviderBrowser-headerBar--simple .uppy-Provider-breadcrumbsWrap{display:inline-block;flex:none;vertical-align:middle}.uppy-ProviderBrowser-searchFilter{align-items:center;display:flex;height:30px;margin-bottom:15px;margin-top:15px;padding-left:8px;padding-right:8px;position:relative;width:100%}.uppy-ProviderBrowser-searchFilterInput{background-color:#eaeaea;border:0;border-radius:4px;color:#333;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;font-size:13px;height:30px;line-height:1.4;outline:0;padding-inline-end:30px;padding-inline-start:30px;width:100%;z-index:1001}.uppy-ProviderBrowser-searchFilterInput::-webkit-search-cancel-button{display:none}[data-uppy-theme=dark] .uppy-ProviderBrowser-searchFilterInput{background-color:#1f1f1f;color:#eaeaea}.uppy-ProviderBrowser-searchFilterInput:focus{background-color:#cfcfcf;border:0}[data-uppy-theme=dark] .uppy-ProviderBrowser-searchFilterInput:focus{background-color:#333}.uppy-ProviderBrowser-searchFilterIcon{color:#757575;height:12px;inset-inline-start:16px;position:absolute;width:12px;z-index:1002}.uppy-ProviderBrowser-searchFilterInput::-moz-placeholder{color:#939393;opacity:1}.uppy-ProviderBrowser-searchFilterInput::placeholder{color:#939393;opacity:1}.uppy-ProviderBrowser-searchFilterReset{border-radius:3px;color:#939393;cursor:pointer;height:22px;inset-inline-end:16px;padding:6px;position:absolute;width:22px;z-index:1002}.uppy-ProviderBrowser-searchFilterReset:focus{outline:none}.uppy-ProviderBrowser-searchFilterReset::-moz-focus-inner{border:0}.uppy-ProviderBrowser-searchFilterReset:focus{box-shadow:0 0 0 3px #1269cf80}.uppy-ProviderBrowser-searchFilterReset:hover{color:#757575}.uppy-ProviderBrowser-searchFilterReset svg{vertical-align:text-top}.uppy-ProviderBrowser-userLogout{border-radius:3px;color:#1269cf;cursor:pointer;line-height:inherit;padding:4px}.uppy-ProviderBrowser-userLogout:focus{outline:none}.uppy-ProviderBrowser-userLogout::-moz-focus-inner{border:0}.uppy-ProviderBrowser-userLogout:hover{color:#0e51a0}.uppy-ProviderBrowser-userLogout:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-ProviderBrowser-userLogout:focus{background-color:#333}.uppy-ProviderBrowser-userLogout:hover{text-decoration:underline}[data-uppy-theme=dark] .uppy-ProviderBrowser-userLogout{color:#eaeaea}.uppy-ProviderBrowser-body{flex:1;position:relative}.uppy-ProviderBrowser-list{background-color:#fff;border-spacing:0;display:block;flex:1;height:100%;inset:0;list-style:none;margin:0;overflow-x:hidden;overflow-y:auto;padding:0;position:absolute;width:100%;-webkit-overflow-scrolling:touch}[data-uppy-theme=dark] .uppy-ProviderBrowser-list{background-color:#1f1f1f}.uppy-ProviderBrowser-list:focus{outline:none}.uppy-ProviderBrowserItem-inner{cursor:pointer;font-size:13px;font-weight:500}.uppy-ProviderBrowser-footer{align-items:center;background-color:#fff;border-top:1px solid #eaeaea;display:flex;justify-content:space-between;padding:15px}.uppy-ProviderBrowser-footer button{margin-inline-end:8px}[data-uppy-theme=dark] .uppy-ProviderBrowser-footer{background-color:#1f1f1f;border-top:1px solid #333}.uppy-ProviderBrowser-footer-buttons{flex-shrink:0}.uppy-ProviderBrowser-footer-error{color:#e32437;line-height:18px}@media(max-width:426px){.uppy-ProviderBrowser-footer{align-items:stretch;flex-direction:column-reverse}.uppy-ProviderBrowser-footer-error{padding-bottom:10px}}.picker-dialog-bg{z-index:20000!important}.picker-dialog{z-index:20001!important}.uppy-Dashboard-Item-previewInnerWrap{align-items:center;border-radius:3px;box-shadow:0 0 2px #0006;display:flex;flex-direction:column;height:100%;justify-content:center;overflow:hidden;position:relative;width:100%}.uppy-size--md .uppy-Dashboard-Item-previewInnerWrap{box-shadow:0 1px 2px #00000026}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-previewInnerWrap{box-shadow:none}.uppy-Dashboard-Item-previewInnerWrap:after{background-color:#000000a6;content:"";display:none;inset:0;position:absolute;z-index:1001}.uppy-Dashboard-Item-previewLink{inset:0;position:absolute;z-index:1002}.uppy-Dashboard-Item-previewLink:focus{box-shadow:inset 0 0 0 3px #579df0}[data-uppy-theme=dark] .uppy-Dashboard-Item-previewLink:focus{box-shadow:inset 0 0 0 3px #016c8d}.uppy-Dashboard-Item-preview img.uppy-Dashboard-Item-previewImg{border-radius:3px;height:100%;-o-object-fit:cover;object-fit:cover;transform:translateZ(0);width:100%}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-preview img.uppy-Dashboard-Item-previewImg{height:auto;max-height:100%;max-width:100%;-o-object-fit:contain;object-fit:contain;padding:10px;width:auto}.uppy-Dashboard-Item-progress{color:#fff;left:50%;position:absolute;text-align:center;top:50%;transform:translate(-50%,-50%);transition:all .35 ease;width:120px;z-index:1002}.uppy-Dashboard-Item-progressIndicator{color:#fff;display:inline-block;height:38px;opacity:.9;width:38px}.uppy-size--md .uppy-Dashboard-Item-progressIndicator{height:55px;width:55px}button.uppy-Dashboard-Item-progressIndicator{cursor:pointer}button.uppy-Dashboard-Item-progressIndicator:focus{outline:none}button.uppy-Dashboard-Item-progressIndicator::-moz-focus-inner{border:0}button.uppy-Dashboard-Item-progressIndicator:focus .uppy-Dashboard-Item-progressIcon--bg,button.uppy-Dashboard-Item-progressIndicator:focus .uppy-Dashboard-Item-progressIcon--retry{fill:#579df0}.uppy-Dashboard-Item-progressIcon--circle{height:100%;width:100%}.uppy-Dashboard-Item-progressIcon--bg{stroke:#fff6}.uppy-Dashboard-Item-progressIcon--progress{transition:stroke-dashoffset .5s ease-out;stroke:#fff}.uppy-Dashboard-Item-progressIcon--play{transition:all .2s;fill:#fff;stroke:#fff}.uppy-Dashboard-Item-progressIcon--cancel{transition:all .2s;fill:#fff}.uppy-Dashboard-Item-progressIcon--pause{transition:all .2s;fill:#fff;stroke:#fff}.uppy-Dashboard-Item-progressIcon--check{transition:all .2s;fill:#fff}.uppy-Dashboard-Item-progressIcon--retry{fill:#fff}.uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progress{inset-inline-end:-8px;inset-inline-start:auto;top:-9px;transform:none;width:auto}.uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-progressIndicator{height:18px;width:18px}.uppy-size--md .uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-progressIndicator{height:28px;width:28px}.uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progressIndicator{height:18px;opacity:1;width:18px}.uppy-size--md .uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progressIndicator{height:22px;width:22px}.uppy-Dashboard-Item.is-processing .uppy-Dashboard-Item-progress{opacity:0}.uppy-Dashboard-Item-fileInfo{padding-inline-end:5px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfo{padding-inline-end:10px}.uppy-size--md.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfo{padding-inline-end:15px}.uppy-Dashboard-Item-name{font-size:12px;font-weight:500;line-height:1.3;margin-bottom:5px;word-wrap:anywhere;word-break:break-all}[data-uppy-theme=dark] .uppy-Dashboard-Item-name{color:#eaeaea}.uppy-size--md.uppy-Dashboard--singleFile .uppy-Dashboard-Item-name{font-size:14px;line-height:1.4}.uppy-Dashboard-Item-fileName{align-items:baseline;display:flex}.uppy-Dashboard-Item-fileName button{margin-left:5px}.uppy-Dashboard-Item-author{color:#757575;display:inline-block;font-size:11px;font-weight:400;line-height:1;margin-bottom:5px;vertical-align:bottom}.uppy-Dashboard-Item-author a{color:#757575}.uppy-Dashboard-Item-status{color:#757575;font-size:11px;font-weight:400;line-height:1}[data-uppy-theme=dark] .uppy-Dashboard-Item-status{color:#bbb}.uppy-Dashboard-Item-statusSize{display:inline-block;margin-bottom:5px;text-transform:uppercase;vertical-align:bottom}.uppy-Dashboard-Item-reSelect{color:#1269cf;font-family:inherit;font-size:inherit;font-weight:600}.uppy-Dashboard-Item-errorMessage{background-color:#fdeff1;color:#a51523;font-size:11px;font-weight:500;line-height:1.3;padding:5px 6px}.uppy-Dashboard-Item-errorMessageBtn{color:#a51523;cursor:pointer;font-size:11px;font-weight:500;text-decoration:underline}.uppy-Dashboard-Item-preview .uppy-Dashboard-Item-errorMessage{display:none}.uppy-size--md .uppy-Dashboard-Item-preview .uppy-Dashboard-Item-errorMessage{border-bottom-left-radius:3px;border-bottom-right-radius:3px;border-top:1px solid #f7c2c8;bottom:0;display:block;left:0;line-height:1.4;padding:6px 8px;position:absolute;right:0}.uppy-Dashboard-Item-fileInfo .uppy-Dashboard-Item-errorMessage{border:1px solid #f7c2c8;border-radius:3px;display:inline-block;position:static}.uppy-size--md .uppy-Dashboard-Item-fileInfo .uppy-Dashboard-Item-errorMessage{display:none}.uppy-Dashboard-Item-action{color:#939393;cursor:pointer}.uppy-Dashboard-Item-action:focus{outline:none}.uppy-Dashboard-Item-action::-moz-focus-inner{border:0}.uppy-Dashboard-Item-action:focus{box-shadow:0 0 0 3px #1269cf80}.uppy-Dashboard-Item-action:hover{color:#1f1f1f;opacity:1}[data-uppy-theme=dark] .uppy-Dashboard-Item-action{color:#cfcfcf}[data-uppy-theme=dark] .uppy-Dashboard-Item-action:focus{outline:none}[data-uppy-theme=dark] .uppy-Dashboard-Item-action::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-Dashboard-Item-action:focus{box-shadow:0 0 0 2px #aae1ffd9}[data-uppy-theme=dark] .uppy-Dashboard-Item-action:hover{color:#eaeaea}.uppy-Dashboard-Item-action--remove{color:#1f1f1f;opacity:.95}.uppy-Dashboard-Item-action--remove:hover{color:#000;opacity:1}.uppy-size--md .uppy-Dashboard-Item-action--remove{height:18px;inset-inline-end:-8px;padding:0;position:absolute;top:-8px;width:18px;z-index:1002}.uppy-size--md .uppy-Dashboard-Item-action--remove:focus{border-radius:50%}.uppy-Dashboard--singleFile.uppy-size--height-md .uppy-Dashboard-Item-action--remove{inset-inline-end:8px;position:absolute;top:8px}[data-uppy-theme=dark] .uppy-Dashboard-Item-action--remove{color:#525252}[data-uppy-theme=dark] .uppy-Dashboard-Item-action--remove:hover{color:#333}.uppy-Dashboard:not(.uppy-size--md):not(.uppy-Dashboard--singleFile.uppy-size--height-md) .uppy-Dashboard-Item-actionWrapper{align-items:center;display:flex}.uppy-Dashboard:not(.uppy-size--md):not(.uppy-Dashboard--singleFile.uppy-size--height-md) .uppy-Dashboard-Item-action{height:22px;margin-left:3px;padding:3px;width:22px}.uppy-Dashboard:not(.uppy-size--md):not(.uppy-Dashboard--singleFile.uppy-size--height-md) .uppy-Dashboard-Item-action:focus{border-radius:3px}.uppy-size--md .uppy-Dashboard-Item-action--copyLink,.uppy-size--md .uppy-Dashboard-Item-action--edit{height:16px;padding:0;width:16px}.uppy-size--md .uppy-Dashboard-Item-action--copyLink:focus,.uppy-size--md .uppy-Dashboard-Item-action--edit:focus{border-radius:3px}.uppy-Dashboard-Item{align-items:center;border-bottom:1px solid #eaeaea;display:flex;padding:10px}.uppy-Dashboard:not(.uppy-Dashboard--singleFile) .uppy-Dashboard-Item{padding-inline-end:0}[data-uppy-theme=dark] .uppy-Dashboard-Item{border-bottom:1px solid #333}.uppy-size--md .uppy-Dashboard-Item{border-bottom:0;display:block;float:inline-start;height:215px;margin:5px 15px;padding:0;position:relative;width:calc(33.333% - 30px)}.uppy-size--lg .uppy-Dashboard-Item{height:190px;margin:5px 15px;padding:0;width:calc(25% - 30px)}.uppy-size--xl .uppy-Dashboard-Item{height:210px;padding:0;width:calc(20% - 30px)}.uppy-Dashboard--singleFile .uppy-Dashboard-Item{border-bottom:0;display:flex;flex-direction:column;height:100%;max-width:400px;padding:15px;position:relative;width:100%}.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-previewInnerWrap{opacity:.2}.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-name{opacity:.7}.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-preview:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='35' height='39' viewBox='0 0 35 39'%3E%3Cpath fill='%2523000' d='M1.708 38.66c1.709 0 3.417-3.417 6.834-3.417s5.125 3.417 8.61 3.417c3.348 0 5.056-3.417 8.473-3.417 4.305 0 5.125 3.417 6.833 3.417.889 0 1.709-.889 1.709-1.709v-19.68C34.167-5.757 0-5.757 0 17.271v19.68c0 .82.888 1.709 1.708 1.709m8.542-17.084a3.383 3.383 0 0 1-3.417-3.416 3.383 3.383 0 0 1 3.417-3.417 3.383 3.383 0 0 1 3.417 3.417 3.383 3.383 0 0 1-3.417 3.416m13.667 0A3.383 3.383 0 0 1 20.5 18.16a3.383 3.383 0 0 1 3.417-3.417 3.383 3.383 0 0 1 3.416 3.417 3.383 3.383 0 0 1-3.416 3.416'/%3E%3C/svg%3E");background-position:50% 10px;background-repeat:no-repeat;background-size:25px;content:"";inset:0;opacity:.5;position:absolute;z-index:1005}.uppy-size--md .uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-preview:before{background-position:50% 50%;background-size:40px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-preview:before{background-position:50% 50%;background-size:30%}.uppy-Dashboard-Item-preview{flex-grow:0;flex-shrink:0;height:50px;position:relative;width:50px}.uppy-size--md .uppy-Dashboard-Item-preview{height:140px;width:100%}.uppy-size--lg .uppy-Dashboard-Item-preview{height:120px}.uppy-size--xl .uppy-Dashboard-Item-preview{height:140px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-preview{flex-grow:1;max-height:75%;width:100%}.uppy-Dashboard--singleFile.uppy-size--md .uppy-Dashboard-Item-preview{max-height:100%}.uppy-Dashboard-Item-fileInfoAndButtons{align-items:center;display:flex;flex-grow:1;justify-content:space-between;padding-inline-end:8px;padding-inline-start:12px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfoAndButtons,.uppy-size--md .uppy-Dashboard-Item-fileInfoAndButtons{align-items:flex-start;padding:9px 0 0}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfoAndButtons{flex-grow:0;width:100%}.uppy-Dashboard-Item-fileInfo{flex-grow:1;flex-shrink:1}.uppy-Dashboard-Item-actionWrapper{flex-grow:0;flex-shrink:0}.uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-previewInnerWrap:after,.uppy-Dashboard-Item.is-inprogress .uppy-Dashboard-Item-previewInnerWrap:after{display:block}.uppy-Dashboard-Item-errorDetails{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#939393;border:none;border-radius:50%;color:#fff;cursor:help;flex-shrink:0;font-size:10px;font-weight:600;height:13px;inset-inline-start:2px;line-height:12px;position:relative;text-align:center;top:0;width:13px}.uppy-Dashboard-Item-errorDetails:after{line-height:1.3;word-wrap:break-word}.uppy-Dashboard-FileCard{background-color:#fff;border-radius:5px;box-shadow:0 0 10px 4px #0000001a;display:flex;flex-direction:column;height:100%;inset:0;position:absolute;width:100%;z-index:1005}.uppy-Dashboard-FileCard .uppy-DashboardContent-bar{border-top-left-radius:5px;border-top-right-radius:5px}.uppy-Dashboard-FileCard .uppy-Dashboard-FileCard-actions{border-bottom-left-radius:5px;border-bottom-right-radius:5px}.uppy-Dashboard-FileCard-inner{display:flex;flex-direction:column;flex-grow:1;flex-shrink:1;height:100%;min-height:0}.uppy-Dashboard-FileCard-preview{align-items:center;border-bottom:1px solid #eaeaea;display:flex;flex-grow:0;flex-shrink:1;height:60%;justify-content:center;min-height:0;position:relative}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-preview{background-color:#333;border-bottom:0}.uppy-Dashboard-FileCard-preview img.uppy-Dashboard-Item-previewImg{border-radius:3px;box-shadow:0 3px 20px #00000026;flex:0 0 auto;max-height:90%;max-width:90%;-o-object-fit:cover;object-fit:cover}.uppy-Dashboard-FileCard-edit{background-color:#00000080;border-radius:50px;color:#fff;font-size:13px;inset-inline-end:10px;padding:7px 15px;position:absolute;top:10px}.uppy-Dashboard-FileCard-edit:focus{outline:none}.uppy-Dashboard-FileCard-edit::-moz-focus-inner{border:0}.uppy-Dashboard-FileCard-edit:focus{box-shadow:0 0 0 3px #1269cf80}.uppy-Dashboard-FileCard-edit:hover{background-color:#000c}.uppy-Dashboard-FileCard-info{flex-grow:0;flex-shrink:0;height:40%;overflow-y:auto;padding:30px 20px 20px;-webkit-overflow-scrolling:touch}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-info{background-color:#1f1f1f}.uppy-Dashboard-FileCard-fieldset{border:0;font-size:0;margin:auto auto 12px;max-width:640px;padding:0}.uppy-Dashboard-FileCard-label{color:#525252;display:inline-block;font-size:12px;vertical-align:middle;width:22%}.uppy-size--md .uppy-Dashboard-FileCard-label{font-size:14px}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-label{color:#eaeaea}.uppy-Dashboard-FileCard-input{display:inline-block;vertical-align:middle;width:78%}.uppy-Dashboard-FileCard-actions{align-items:center;background-color:#fafafa;border-top:1px solid #eaeaea;display:flex;flex-grow:0;flex-shrink:0;height:55px;padding:0 15px}.uppy-size--md .uppy-Dashboard-FileCard-actions{height:65px}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-actions{background-color:#1f1f1f;border-top:1px solid #333}.uppy-Dashboard-FileCard-actionsBtn{margin-inline-end:10px}.uppy-Informer{bottom:60px;left:0;position:absolute;right:0;text-align:center;z-index:1005}.uppy-Informer span>div{margin-bottom:6px}.uppy-Informer-animated{opacity:0;transform:translateY(350%);transition:all .3s ease-in;z-index:-1000}.uppy-Informer p{background-color:#757575;border-radius:18px;color:#fff;display:inline-block;font-size:12px;font-weight:400;line-height:1.4;margin:0;max-width:90%;padding:6px 15px}.uppy-size--md .uppy-Informer p{font-size:14px;line-height:1.3;max-width:500px;padding:10px 20px}[data-uppy-theme=dark] .uppy-Informer p{background-color:#333}.uppy-Informer p span{background-color:#fff;border-radius:50%;color:#525252;display:inline-block;font-size:10px;height:13px;inset-inline-start:3px;line-height:12px;margin-inline-start:-1px;position:relative;top:-1px;vertical-align:middle;width:13px}.uppy-Informer p span:hover{cursor:help}.uppy-Informer p span:after{line-height:1.3;word-wrap:break-word}.uppy-Root [aria-label][role~=tooltip]{position:relative}.uppy-Root [aria-label][role~=tooltip]:after,.uppy-Root [aria-label][role~=tooltip]:before{backface-visibility:hidden;box-sizing:border-box;opacity:0;pointer-events:none;position:absolute;transform:translateZ(0);transform-origin:top;transition:all var(--microtip-transition-duration,.18s) var(--microtip-transition-easing,ease-in-out) var(--microtip-transition-delay,0s);will-change:transform;z-index:10}.uppy-Root [aria-label][role~=tooltip]:before{background-size:100% auto!important;content:""}.uppy-Root [aria-label][role~=tooltip]:after{background:#111111e6;border-radius:4px;box-sizing:initial;color:#fff;content:attr(aria-label);font-size:var(--microtip-font-size,13px);font-weight:var(--microtip-font-weight,normal);padding:.5em 1em;text-transform:var(--microtip-text-transform,none);white-space:nowrap}.uppy-Root [aria-label][role~=tooltip]:focus:after,.uppy-Root [aria-label][role~=tooltip]:focus:before,.uppy-Root [aria-label][role~=tooltip]:hover:after,.uppy-Root [aria-label][role~=tooltip]:hover:before{opacity:1;pointer-events:auto}.uppy-Root [role~=tooltip][data-microtip-position|=top]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='12'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M2.658 0h32.004c-6 0-11.627 12.002-16.002 12.002S8.594 0 2.658 0'/%3E%3C/svg%3E") no-repeat;bottom:100%;height:6px;left:50%;margin-bottom:5px;transform:translate3d(-50%,0,0);width:18px}.uppy-Root [role~=tooltip][data-microtip-position|=top]:after{bottom:100%;left:50%;margin-bottom:11px;transform:translate3d(-50%,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=top]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position|=top]:hover:before{transform:translate3d(-50%,-5px,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-left]:after{bottom:100%;transform:translate3d(calc(-100% + 16px),0,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-left]:hover:after{transform:translate3d(calc(-100% + 16px),-5px,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-right]:after{bottom:100%;transform:translate3d(-16px,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-right]:hover:after{transform:translate3d(-16px,-5px,0)}.uppy-Root [role~=tooltip][data-microtip-position|=bottom]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='12'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M33.342 12H1.338c6 0 11.627-12.002 16.002-12.002S27.406 12 33.342 12'/%3E%3C/svg%3E") no-repeat;bottom:auto;height:6px;left:50%;margin-bottom:0;margin-top:5px;top:100%;transform:translate3d(-50%,-10px,0);width:18px}.uppy-Root [role~=tooltip][data-microtip-position|=bottom]:after{left:50%;margin-top:11px;top:100%;transform:translate3d(-50%,-10px,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position|=bottom]:hover:before{transform:translate3d(-50%,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-left]:after{top:100%;transform:translate3d(calc(-100% + 16px),-10px,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-left]:hover:after{transform:translate3d(calc(-100% + 16px),0,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-right]:after{top:100%;transform:translate3d(-16px,-10px,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-right]:hover:after{transform:translate3d(-16px,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=left]:after,.uppy-Root [role~=tooltip][data-microtip-position=left]:before{inset:50% 100% auto auto;transform:translate3d(10px,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-position=left]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='36'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M0 33.342V1.338c0 6 12.002 11.627 12.002 16.002S0 27.406 0 33.342'/%3E%3C/svg%3E") no-repeat;height:18px;margin-bottom:0;margin-right:5px;width:6px}.uppy-Root [role~=tooltip][data-microtip-position=left]:after{margin-right:11px}.uppy-Root [role~=tooltip][data-microtip-position=left]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position=left]:hover:before{transform:translate3d(0,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-position=right]:after,.uppy-Root [role~=tooltip][data-microtip-position=right]:before{bottom:auto;left:100%;top:50%;transform:translate3d(-10px,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-position=right]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='36'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M12 2.658v32.004c0-6-12.002-11.627-12.002-16.002S12 8.594 12 2.658'/%3E%3C/svg%3E") no-repeat;height:18px;margin-bottom:0;margin-left:5px;width:6px}.uppy-Root [role~=tooltip][data-microtip-position=right]:after{margin-left:11px}.uppy-Root [role~=tooltip][data-microtip-position=right]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position=right]:hover:before{transform:translate3d(0,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-size=small]:after{white-space:normal;width:80px}.uppy-Root [role~=tooltip][data-microtip-size=medium]:after{white-space:normal;width:150px}.uppy-Root [role~=tooltip][data-microtip-size=large]:after{white-space:normal;width:260px}.uppy-StatusBar{background-color:#fff;color:#fff;display:flex;font-size:12px;font-weight:400;height:46px;line-height:40px;position:relative;transition:height .2s;z-index:1001}[data-uppy-theme=dark] .uppy-StatusBar{background-color:#1f1f1f}.uppy-StatusBar:before{background-color:#eaeaea;content:"";height:2px;inset:0;position:absolute;width:100%}[data-uppy-theme=dark] .uppy-StatusBar:before{background-color:#757575}.uppy-StatusBar[aria-hidden=true]{height:0;overflow-y:hidden}.uppy-StatusBar.is-complete .uppy-StatusBar-progress{background-color:#1bb240}.uppy-StatusBar.is-error .uppy-StatusBar-progress{background-color:#e32437}.uppy-StatusBar.is-complete .uppy-StatusBar-statusIndicator{color:#1bb240}.uppy-StatusBar.is-error .uppy-StatusBar-statusIndicator{color:#e32437}.uppy-StatusBar:not([aria-hidden=true]).is-waiting{background-color:#fff;border-top:1px solid #eaeaea;height:65px}[data-uppy-theme=dark] .uppy-StatusBar:not([aria-hidden=true]).is-waiting{background-color:#1f1f1f;border-top:1px solid #333}.uppy-StatusBar-progress{background-color:#1269cf;height:2px;position:absolute;transition:background-color,width .3s ease-out;z-index:1001}.uppy-StatusBar-progress.is-indeterminate{animation:uppy-StatusBar-ProgressStripes 1s linear infinite;background-image:linear-gradient(45deg,#0000004d 25%,#0000 0 50%,#0000004d 0 75%,#0000 0,#0000);background-size:64px 64px}@keyframes uppy-StatusBar-ProgressStripes{0%{background-position:0 0}to{background-position:64px 0}}.uppy-StatusBar.is-postprocessing .uppy-StatusBar-progress,.uppy-StatusBar.is-preprocessing .uppy-StatusBar-progress{background-color:#f6a623}.uppy-StatusBar.is-waiting .uppy-StatusBar-progress{display:none}.uppy-StatusBar-content{align-items:center;color:#333;display:flex;height:100%;padding-inline-start:10px;position:relative;text-overflow:ellipsis;white-space:nowrap;z-index:1002}.uppy-size--md .uppy-StatusBar-content{padding-inline-start:15px}[data-uppy-theme=dark] .uppy-StatusBar-content{color:#eaeaea}.uppy-StatusBar-status{display:flex;flex-direction:column;font-weight:400;justify-content:center;line-height:1.4;padding-inline-end:.3em}.uppy-StatusBar-statusPrimary{display:flex;font-weight:500;line-height:1}.uppy-StatusBar-statusPrimary button.uppy-StatusBar-details{margin-left:5px}[data-uppy-theme=dark] .uppy-StatusBar-statusPrimary{color:#eaeaea}.uppy-StatusBar-statusSecondary{color:#757575;display:inline-block;font-size:11px;line-height:1.2;margin-top:1px;white-space:nowrap}[data-uppy-theme=dark] .uppy-StatusBar-statusSecondary{color:#bbb}.uppy-StatusBar-statusSecondaryHint{display:inline-block;line-height:1;margin-inline-end:5px;vertical-align:middle}.uppy-size--md .uppy-StatusBar-statusSecondaryHint{margin-inline-end:8px}.uppy-StatusBar-statusIndicator{color:#525252;margin-inline-end:7px;position:relative;top:1px}.uppy-StatusBar-statusIndicator svg{vertical-align:text-bottom}.uppy-StatusBar-actions{align-items:center;bottom:0;display:flex;inset-inline-end:10px;position:absolute;top:0;z-index:1004}.uppy-StatusBar.is-waiting .uppy-StatusBar-actions{background-color:#fafafa;height:100%;padding:0 15px;position:static;width:100%}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actions{background-color:#1f1f1f}.uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts{flex-direction:column;height:90px}.uppy-size--md .uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts{flex-direction:row;height:65px}.uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts .uppy-StatusBar-actions{flex-direction:column;justify-content:center}.uppy-size--md .uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts .uppy-StatusBar-actions{flex-direction:row;justify-content:normal}.uppy-StatusBar-actionCircleBtn{cursor:pointer;line-height:1;margin:3px;opacity:.9}.uppy-StatusBar-actionCircleBtn:focus{outline:none}.uppy-StatusBar-actionCircleBtn::-moz-focus-inner{border:0}.uppy-StatusBar-actionCircleBtn:focus{box-shadow:0 0 0 3px #1269cf80}[data-uppy-theme=dark] .uppy-StatusBar-actionCircleBtn:focus{outline:none}[data-uppy-theme=dark] .uppy-StatusBar-actionCircleBtn::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-StatusBar-actionCircleBtn:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-StatusBar-actionCircleBtn:hover{opacity:1}.uppy-StatusBar-actionCircleBtn:focus{border-radius:50%}.uppy-StatusBar-actionCircleBtn svg{vertical-align:bottom}.uppy-StatusBar-actionBtn{color:#1269cf;display:inline-block;font-size:10px;line-height:inherit;vertical-align:middle}.uppy-size--md .uppy-StatusBar-actionBtn{font-size:11px}.uppy-StatusBar-actionBtn--disabled{opacity:.4}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--disabled{opacity:.7}.uppy-StatusBar-actionBtn--retry{background-color:#ff4b23;border-radius:8px;color:#fff;height:16px;line-height:1;margin-inline-end:6px;padding:1px 6px 3px 18px;position:relative}.uppy-StatusBar-actionBtn--retry:focus{outline:none}.uppy-StatusBar-actionBtn--retry::-moz-focus-inner{border:0}.uppy-StatusBar-actionBtn--retry:focus{box-shadow:0 0 0 3px #1269cf80}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--retry:focus{outline:none}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--retry::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--retry:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-StatusBar-actionBtn--retry:hover{background-color:#f92d00}.uppy-StatusBar-actionBtn--retry svg{inset-inline-start:6px;position:absolute;top:3px}.uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload{background-color:#1bb240;color:#fff;font-size:14px;line-height:1;padding:15px 10px;width:100%}.uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload:hover{background-color:#189c38}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload{background-color:#1c8b37}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload:hover{background-color:#18762f}.uppy-size--md .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload{padding:13px 22px;width:auto}.uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload.uppy-StatusBar-actionBtn--disabled:hover{background-color:#1bb240;cursor:not-allowed}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload.uppy-StatusBar-actionBtn--disabled:hover{background-color:#1c8b37}.uppy-StatusBar:not(.is-waiting) .uppy-StatusBar-actionBtn--upload{background-color:initial;color:#1269cf}.uppy-StatusBar-actionBtn--uploadNewlyAdded{border-radius:3px;padding-inline-end:3px;padding-bottom:1px;padding-inline-start:3px}.uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{outline:none}.uppy-StatusBar-actionBtn--uploadNewlyAdded::-moz-focus-inner{border:0}.uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{box-shadow:0 0 0 3px #1269cf80}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{outline:none}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--uploadNewlyAdded::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-StatusBar.is-postprocessing .uppy-StatusBar-actionBtn--uploadNewlyAdded,.uppy-StatusBar.is-preprocessing .uppy-StatusBar-actionBtn--uploadNewlyAdded{display:none}.uppy-StatusBar-actionBtn--done{border-radius:3px;line-height:1;padding:7px 8px}.uppy-StatusBar-actionBtn--done:focus{outline:none}.uppy-StatusBar-actionBtn--done::-moz-focus-inner{border:0}.uppy-StatusBar-actionBtn--done:hover{color:#0e51a0}.uppy-StatusBar-actionBtn--done:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--done:focus{background-color:#333}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--done{color:#02baf2}.uppy-size--md .uppy-StatusBar-actionBtn--done{font-size:14px}.uppy-StatusBar-serviceMsg{color:#000;font-size:11px;line-height:1.1;padding-left:10px}.uppy-size--md .uppy-StatusBar-serviceMsg{font-size:14px;padding-left:15px}[data-uppy-theme=dark] .uppy-StatusBar-serviceMsg{color:#eaeaea}.uppy-StatusBar-serviceMsg-ghostsIcon{left:6px;opacity:.5;position:relative;top:2px;vertical-align:text-bottom;width:10px}.uppy-size--md .uppy-StatusBar-serviceMsg-ghostsIcon{left:10px;top:1px;width:15px}.uppy-StatusBar-details{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#939393;border-radius:50%;color:#fff;cursor:help;display:inline-block;font-size:10px;font-weight:600;height:13px;inset-inline-start:2px;line-height:12px;position:relative;text-align:center;top:0;vertical-align:middle;width:13px}.uppy-StatusBar-details:after{line-height:1.3;word-wrap:break-word}.uppy-StatusBar-spinner{animation-duration:1s;animation-iteration-count:infinite;animation-name:uppy-StatusBar-spinnerAnimation;animation-timing-function:linear;fill:#1269cf;margin-inline-end:10px}.uppy-StatusBar.is-postprocessing .uppy-StatusBar-spinner,.uppy-StatusBar.is-preprocessing .uppy-StatusBar-spinner{fill:#f6a623}@keyframes uppy-StatusBar-spinnerAnimation{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.uppy-transition-slideDownUp-enter{opacity:.01;transform:translate3d(0,-105%,0);transition:transform .25s ease-in-out,opacity .25s ease-in-out}.uppy-transition-slideDownUp-enter.uppy-transition-slideDownUp-enter-active{opacity:1;transform:translateZ(0)}.uppy-transition-slideDownUp-leave{opacity:1;transform:translateZ(0);transition:transform .25s ease-in-out,opacity .25s ease-in-out}.uppy-transition-slideDownUp-leave.uppy-transition-slideDownUp-leave-active{opacity:.01;transform:translate3d(0,-105%,0)}@keyframes uppy-Dashboard-fadeIn{0%{opacity:0}to{opacity:1}}@keyframes uppy-Dashboard-fadeOut{0%{opacity:1}to{opacity:0}}@keyframes uppy-Dashboard-slideDownAndFadeIn{0%{opacity:0;transform:translate3d(-50%,-70%,0)}to{opacity:1;transform:translate3d(-50%,-50%,0)}}@keyframes uppy-Dashboard-slideDownAndFadeIn--small{0%{opacity:0;transform:translate3d(0,-20%,0)}to{opacity:1;transform:translateZ(0)}}@keyframes uppy-Dashboard-slideUpFadeOut{0%{opacity:1;transform:translate3d(-50%,-50%,0)}to{opacity:0;transform:translate3d(-50%,-70%,0)}}@keyframes uppy-Dashboard-slideUpFadeOut--small{0%{opacity:1;transform:translateZ(0)}to{opacity:0;transform:translate3d(0,-20%,0)}}.uppy-Dashboard--modal{z-index:1001}.uppy-Dashboard--modal[aria-hidden=true]{display:none}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideDownAndFadeIn--small .3s cubic-bezier(0,0,.2,1)}@media only screen and (min-width:820px){.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideDownAndFadeIn .3s cubic-bezier(0,0,.2,1)}}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose>.uppy-Dashboard-overlay{animation:uppy-Dashboard-fadeIn .3s cubic-bezier(0,0,.2,1)}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideUpFadeOut--small .3s cubic-bezier(0,0,.2,1)}@media only screen and (min-width:820px){.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideUpFadeOut .3s cubic-bezier(0,0,.2,1)}}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing>.uppy-Dashboard-overlay{animation:uppy-Dashboard-fadeOut .3s cubic-bezier(0,0,.2,1)}.uppy-Dashboard-isFixed{height:100vh;overflow:hidden}.uppy-Dashboard--modal .uppy-Dashboard-overlay{background-color:#00000080;inset:0;position:fixed;z-index:1001}.uppy-Dashboard-inner{background-color:#f4f4f4;border:1px solid #eaeaea;border-radius:5px;max-height:100%;max-width:100%;outline:none;position:relative}.uppy-size--md .uppy-Dashboard-inner{min-height:auto}@media only screen and (min-width:820px){.uppy-Dashboard-inner{height:500px;width:650px}}.uppy-Dashboard--modal .uppy-Dashboard-inner{z-index:1002}[data-uppy-theme=dark] .uppy-Dashboard-inner{background-color:#1f1f1f}.uppy-Dashboard--isDisabled .uppy-Dashboard-inner{cursor:not-allowed}.uppy-Dashboard-innerWrap{border-radius:5px;display:flex;flex-direction:column;height:100%;opacity:0;overflow:hidden;position:relative}.uppy-Dashboard--isInnerWrapVisible .uppy-Dashboard-innerWrap{opacity:1}.uppy-Dashboard--isDisabled .uppy-Dashboard-innerWrap{cursor:not-allowed;filter:grayscale(100%);opacity:.6;-webkit-user-select:none;-moz-user-select:none;user-select:none}.uppy-Dashboard--isDisabled .uppy-ProviderIconBg{fill:#9f9f9f}.uppy-Dashboard--isDisabled [aria-disabled],.uppy-Dashboard--isDisabled [disabled]{cursor:not-allowed;pointer-events:none}.uppy-Dashboard--modal .uppy-Dashboard-inner{border:none;inset:35px 15px 15px;position:fixed}@media only screen and (min-width:820px){.uppy-Dashboard--modal .uppy-Dashboard-inner{box-shadow:0 5px 15px 4px #00000026;left:50%;right:auto;top:50%;transform:translate(-50%,-50%)}}.uppy-Dashboard-close{color:#ffffffe6;cursor:pointer;display:block;font-size:27px;inset-inline-end:-2px;position:absolute;top:-33px;z-index:1005}.uppy-Dashboard-close:focus{outline:none}.uppy-Dashboard-close::-moz-focus-inner{border:0}.uppy-Dashboard-close:focus{color:#6eabf2}@media only screen and (min-width:820px){.uppy-Dashboard-close{font-size:35px;inset-inline-end:-35px;top:-10px}}.uppy-Dashboard-serviceMsg{background-color:#fffbf7;border-bottom:1px solid #edd4b9;border-top:1px solid #edd4b9;font-size:12px;font-weight:500;line-height:1.3;padding:12px 0;position:relative;top:-1px;z-index:1004}.uppy-size--md .uppy-Dashboard-serviceMsg{font-size:14px;line-height:1.4}[data-uppy-theme=dark] .uppy-Dashboard-serviceMsg{background-color:#1f1f1f;border-bottom:1px solid #333;border-top:1px solid #333;color:#eaeaea}.uppy-Dashboard-serviceMsg-title{display:block;line-height:1;margin-bottom:4px;padding-left:42px}.uppy-Dashboard-serviceMsg-text{padding:0 15px}.uppy-Dashboard-serviceMsg-actionBtn{color:#1269cf;font-size:inherit;font-weight:inherit;vertical-align:initial}[data-uppy-theme=dark] .uppy-Dashboard-serviceMsg-actionBtn{color:#02baf2e6}.uppy-Dashboard-serviceMsg-icon{left:15px;position:absolute;top:10px}.uppy-Dashboard-AddFiles{align-items:center;display:flex;flex-direction:column;height:100%;justify-content:center;position:relative;text-align:center}[data-uppy-drag-drop-supported=true] .uppy-Dashboard-AddFiles{border:1px dashed #dfdfdf;border-radius:3px;height:calc(100% - 14px);margin:7px}.uppy-Dashboard-AddFilesPanel .uppy-Dashboard-AddFiles{border:none;height:calc(100% - 54px)}.uppy-Dashboard--modal .uppy-Dashboard-AddFiles{border-color:#cfcfcf}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles{border-color:#757575}.uppy-Dashboard-AddFiles-info{display:none;margin-top:auto;padding-bottom:15px;padding-top:15px}.uppy-size--height-md .uppy-Dashboard-AddFiles-info{display:block}.uppy-size--md .uppy-Dashboard-AddFiles-info{bottom:25px;left:0;padding-bottom:0;padding-top:30px;position:absolute;right:0}[data-uppy-num-acquirers="0"] .uppy-Dashboard-AddFiles-info{margin-top:0}.uppy-Dashboard-browse{color:#1269cf;cursor:pointer}.uppy-Dashboard-browse:focus{outline:none}.uppy-Dashboard-browse::-moz-focus-inner{border:0}.uppy-Dashboard-browse:focus,.uppy-Dashboard-browse:hover{border-bottom:1px solid #1269cf}[data-uppy-theme=dark] .uppy-Dashboard-browse{color:#02baf2e6}[data-uppy-theme=dark] .uppy-Dashboard-browse:focus,[data-uppy-theme=dark] .uppy-Dashboard-browse:hover{border-bottom:1px solid #02baf2}.uppy-Dashboard-browseBtn{display:block;font-size:14px;font-weight:500;margin-bottom:5px;margin-top:8px;width:100%}.uppy-size--md .uppy-Dashboard-browseBtn{font-size:15px;margin:15px auto;padding:13px 44px;width:auto}.uppy-Dashboard-AddFiles-list{display:flex;flex:1;flex-direction:column;margin-top:2px;overflow-y:auto;padding:2px 0;width:100%;-webkit-overflow-scrolling:touch}.uppy-size--md .uppy-Dashboard-AddFiles-list{flex:none;flex-direction:row;flex-wrap:wrap;justify-content:center;margin-top:15px;max-width:600px;overflow-y:visible;padding-top:0}.uppy-DashboardTab{border-bottom:1px solid #eaeaea;text-align:center;width:100%}[data-uppy-theme=dark] .uppy-DashboardTab{border-bottom:1px solid #333}.uppy-size--md .uppy-DashboardTab{border-bottom:none;display:inline-block;margin-bottom:10px;width:auto}.uppy-DashboardTab-btn{align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:initial;color:#525252;cursor:pointer;flex-direction:row;height:100%;justify-content:left;padding:12px 15px;width:100%}.uppy-DashboardTab-btn:focus{outline:none}.uppy-size--md .uppy-DashboardTab-btn{border-radius:5px;flex-direction:column;margin-inline-end:1px;padding:10px 3px;width:86px}[data-uppy-theme=dark] .uppy-DashboardTab-btn{color:#eaeaea}.uppy-DashboardTab-btn::-moz-focus-inner{border:0}.uppy-DashboardTab-btn:hover{background-color:#e9ecef}[data-uppy-theme=dark] .uppy-DashboardTab-btn:hover{background-color:#333}.uppy-DashboardTab-btn:active,.uppy-DashboardTab-btn:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-DashboardTab-btn:active,[data-uppy-theme=dark] .uppy-DashboardTab-btn:focus{background-color:#525252}.uppy-DashboardTab-btn svg{display:inline-block;max-height:100%;max-width:100%;overflow:hidden;transition:transform .15s ease-in-out;vertical-align:text-top}.uppy-DashboardTab-inner{align-items:center;background-color:#fff;border-radius:8px;box-shadow:0 1px 1px #0000001a,0 1px 2px #0000001a,0 2px 3px #00000005;display:flex;height:32px;justify-content:center;margin-inline-end:10px;width:32px}.uppy-size--md .uppy-DashboardTab-inner{margin-inline-end:0}[data-uppy-theme=dark] .uppy-DashboardTab-inner{background-color:#323232;box-shadow:0 1px 1px #0003,0 1px 2px #0003,0 2px 3px #00000014}.uppy-DashboardTab-name{font-size:14px;font-weight:400}.uppy-size--md .uppy-DashboardTab-name{font-size:12px;line-height:15px;margin-bottom:0;margin-top:8px}.uppy-DashboardTab-iconMyDevice{color:#1269cf}[data-uppy-theme=dark] .uppy-DashboardTab-iconMyDevice{color:#02baf2}.uppy-DashboardTab-iconBox{color:#0061d5}[data-uppy-theme=dark] .uppy-DashboardTab-iconBox{color:#eaeaea}.uppy-DashboardTab-iconDropbox{color:#0061fe}[data-uppy-theme=dark] .uppy-DashboardTab-iconDropbox{color:#eaeaea}.uppy-DashboardTab-iconUnsplash{color:#111}[data-uppy-theme=dark] .uppy-DashboardTab-iconUnsplash{color:#eaeaea}.uppy-DashboardTab-iconWebdav{color:#111}[data-uppy-theme=dark] .uppy-DashboardTab-iconWebdav{color:#eaeaea}.uppy-DashboardTab-iconScreenRec{color:#2c3e50}[data-uppy-theme=dark] .uppy-DashboardTab-iconScreenRec{color:#eaeaea}.uppy-DashboardTab-iconAudio{color:#8030a3}[data-uppy-theme=dark] .uppy-DashboardTab-iconAudio{color:#bf6ee3}.uppy-Dashboard-input{height:.1px;opacity:0;overflow:hidden;position:absolute;width:.1px;z-index:-1}.uppy-DashboardContent-bar{align-items:center;background-color:#fafafa;border-bottom:1px solid #eaeaea;display:flex;flex-shrink:0;height:40px;justify-content:space-between;padding:0 10px;position:relative;width:100%;z-index:1004}.uppy-size--md .uppy-DashboardContent-bar{height:50px;padding:0 15px}[data-uppy-theme=dark] .uppy-DashboardContent-bar{background-color:#1f1f1f;border-bottom:1px solid #333}.uppy-DashboardContent-title{font-size:12px;font-weight:500;left:0;line-height:40px;margin:auto;max-width:170px;overflow-x:hidden;position:absolute;right:0;text-align:center;text-overflow:ellipsis;top:0;white-space:nowrap;width:100%}.uppy-size--md .uppy-DashboardContent-title{font-size:14px;line-height:50px;max-width:300px}[data-uppy-theme=dark] .uppy-DashboardContent-title{color:#eaeaea}.uppy-DashboardContent-back,.uppy-DashboardContent-save{-webkit-appearance:none;background:none;border:0;border-radius:3px;color:inherit;color:#1269cf;cursor:pointer;font-family:inherit;font-size:inherit;font-size:12px;font-weight:400;line-height:1;margin:0;margin-inline-start:-6px;padding:7px 6px}.uppy-DashboardContent-back:focus,.uppy-DashboardContent-save:focus{outline:none}.uppy-DashboardContent-back::-moz-focus-inner,.uppy-DashboardContent-save::-moz-focus-inner{border:0}.uppy-DashboardContent-back:hover,.uppy-DashboardContent-save:hover{color:#0e51a0}.uppy-DashboardContent-back:focus,.uppy-DashboardContent-save:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-DashboardContent-back:focus,[data-uppy-theme=dark] .uppy-DashboardContent-save:focus{background-color:#333}.uppy-size--md .uppy-DashboardContent-back,.uppy-size--md .uppy-DashboardContent-save{font-size:14px}[data-uppy-theme=dark] .uppy-DashboardContent-back,[data-uppy-theme=dark] .uppy-DashboardContent-save{color:#02baf2}.uppy-DashboardContent-addMore{-webkit-appearance:none;background:none;border:0;border-radius:3px;color:inherit;color:#1269cf;cursor:pointer;font-family:inherit;font-size:inherit;font-weight:500;height:29px;line-height:1;margin:0;margin-inline-end:-5px;padding:7px 8px;width:29px}.uppy-DashboardContent-addMore:focus{outline:none}.uppy-DashboardContent-addMore::-moz-focus-inner{border:0}.uppy-DashboardContent-addMore:hover{color:#0e51a0}.uppy-DashboardContent-addMore:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-DashboardContent-addMore:focus{background-color:#333}.uppy-size--md .uppy-DashboardContent-addMore{font-size:14px;height:auto;margin-inline-end:-8px;width:auto}[data-uppy-theme=dark] .uppy-DashboardContent-addMore{color:#02baf2}.uppy-DashboardContent-addMore svg{margin-inline-end:4px;vertical-align:initial}.uppy-size--md .uppy-DashboardContent-addMore svg{height:11px;width:11px}.uppy-DashboardContent-addMoreCaption{display:none}.uppy-size--md .uppy-DashboardContent-addMoreCaption{display:inline}.uppy-DashboardContent-panel{background-color:#f5f5f5;flex:1}.uppy-Dashboard-AddFilesPanel,.uppy-DashboardContent-panel{border-radius:5px;display:flex;flex-direction:column;inset:0;overflow:hidden;position:absolute;z-index:1005}.uppy-Dashboard-AddFilesPanel{background:#fafafa;background:linear-gradient(0deg,#fafafa 35%,#fafafad9);box-shadow:0 0 10px 5px #00000026}[data-uppy-theme=dark] .uppy-Dashboard-AddFilesPanel{background-color:#333;background-image:linear-gradient(0deg,#1f1f1f 35%,#1f1f1fd9)}.uppy-Dashboard--isAddFilesPanelVisible .uppy-Dashboard-files{filter:blur(2px)}.uppy-Dashboard-progress{bottom:0;height:12%;left:0;position:absolute;width:100%}.uppy-Dashboard-progressBarContainer.is-active{height:100%;left:0;position:absolute;top:0;width:100%;z-index:1004}.uppy-Dashboard-filesContainer{flex:1;margin:0;overflow-y:hidden;position:relative}.uppy-Dashboard-filesContainer:after{clear:both;content:"";display:table}.uppy-Dashboard-files{flex:1;margin:0;overflow-y:auto;padding:0 0 10px;-webkit-overflow-scrolling:touch}.uppy-size--md .uppy-Dashboard-files{padding-top:10px}.uppy-Dashboard--singleFile .uppy-Dashboard-filesInner{align-items:center;display:flex;height:100%;justify-content:center}.uppy-Dashboard-dropFilesHereHint{align-items:center;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath fill='%231269CF' d='M24 1v1C11.85 2 2 11.85 2 24s9.85 22 22 22 22-9.85 22-22S36.15 2 24 2zm0 0V0c13.254 0 24 10.746 24 24S37.254 48 24 48 0 37.254 0 24 10.746 0 24 0zm7.707 19.293a.999.999 0 1 1-1.414 1.414L25 16.414V34a1 1 0 1 1-2 0V16.414l-5.293 5.293a.999.999 0 1 1-1.414-1.414l7-7a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E");background-position:50% 50%;background-repeat:no-repeat;border:1px dashed #1269cf;border-radius:3px;color:#757575;display:flex;font-size:16px;justify-content:center;inset:7px;padding-top:90px;position:absolute;text-align:center;visibility:hidden;z-index:2000}[data-uppy-theme=dark] .uppy-Dashboard-dropFilesHereHint{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath fill='%2302BAF2' d='M24 1v1C11.85 2 2 11.85 2 24s9.85 22 22 22 22-9.85 22-22S36.15 2 24 2zm0 0V0c13.254 0 24 10.746 24 24S37.254 48 24 48 0 37.254 0 24 10.746 0 24 0zm7.707 19.293a.999.999 0 1 1-1.414 1.414L25 16.414V34a1 1 0 1 1-2 0V16.414l-5.293 5.293a.999.999 0 1 1-1.414-1.414l7-7a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E");border-color:#02baf2;color:#bbb}.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-dropFilesHereHint{pointer-events:none;visibility:visible}.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-files,.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-progressindicators,.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-serviceMsg,.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-DashboardContent-bar{opacity:.15}.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-AddFiles{opacity:.03}.uppy-Dashboard-AddFiles-title{color:#000;font-size:17px;font-weight:500;line-height:1.35;margin-bottom:5px;margin-top:15px;padding:0 15px;text-align:inline-start;width:100%}.uppy-size--md .uppy-Dashboard-AddFiles-title{font-size:21px;font-weight:400;margin-top:5px;max-width:480px;padding:0 35px;text-align:center}[data-uppy-num-acquirers="0"] .uppy-Dashboard-AddFiles-title{text-align:center}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles-title{color:#eaeaea}.uppy-Dashboard-AddFiles-title button{font-weight:500}.uppy-size--md .uppy-Dashboard-AddFiles-title button{font-weight:400}.uppy-Dashboard-note{color:#757575;font-size:14px;line-height:1.25;margin:auto;max-width:350px;padding:0 15px;text-align:center}.uppy-size--md .uppy-Dashboard-note{line-height:1.35;max-width:600px}[data-uppy-theme=dark] .uppy-Dashboard-note{color:#cfcfcf}a.uppy-Dashboard-poweredBy{color:#939393;display:inline-block;font-size:11px;margin-top:8px;text-align:center;text-decoration:none}.uppy-Dashboard-poweredByIcon{margin-left:1px;margin-right:1px;opacity:.9;position:relative;top:1px;vertical-align:text-top;fill:none;stroke:#939393}.uppy-Dashboard-Item-previewIcon{height:25px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:25px;z-index:100}.uppy-size--md .uppy-Dashboard-Item-previewIcon{height:38px;width:38px}.uppy-Dashboard-Item-previewIcon svg{height:100%;width:100%}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-previewIcon{height:100%;max-height:60%;max-width:60%;width:100%}.uppy-Dashboard-Item-previewIconWrap{height:76px;max-height:75%;position:relative}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-previewIconWrap{height:100%;width:100%}.uppy-Dashboard-Item-previewIconBg{filter:drop-shadow(rgba(0,0,0,.1) 0 1px 1px);height:100%;width:100%}.uppy-Dashboard-upload{height:50px;position:relative;width:50px}.uppy-size--md .uppy-Dashboard-upload{height:60px;width:60px}.uppy-Dashboard-upload .uppy-c-icon{position:relative;top:1px;width:50%}.uppy-Dashboard-uploadCount{background-color:#1bb240;border-radius:50%;color:#fff;font-size:8px;height:16px;inset-inline-end:-12px;line-height:16px;position:absolute;top:-12px;width:16px}.uppy-size--md .uppy-Dashboard-uploadCount{font-size:9px;height:18px;line-height:18px;width:18px}.uppy-Dashboard-inner{border:none!important;background:transparent!important}.uppy-Dashboard-innerWrap{border-radius:.5rem;overflow:hidden}.uppy-Dashboard-AddFiles{border:2px dashed hsl(var(--border))!important;border-radius:.5rem!important;background:hsl(var(--muted) / .3)!important;transition:all .2s ease}.uppy-Dashboard-AddFiles:hover{border-color:hsl(var(--primary))!important;background:hsl(var(--muted) / .5)!important}.uppy-Dashboard-AddFiles-title{color:hsl(var(--foreground))!important;font-weight:500!important}.uppy-Dashboard-AddFiles-info{color:hsl(var(--muted-foreground))!important}.uppy-Dashboard-browse{color:hsl(var(--primary))!important;font-weight:500!important}.uppy-Dashboard-browse:hover{text-decoration:underline!important}.uppy-Dashboard-files{background:transparent!important}.uppy-Dashboard-Item{border-bottom-color:hsl(var(--border))!important}.uppy-Dashboard-Item-name{color:hsl(var(--foreground))!important}.uppy-Dashboard-Item-status{color:hsl(var(--muted-foreground))!important}.uppy-StatusBar{background:hsl(var(--muted))!important;border-top:1px solid hsl(var(--border))!important}.uppy-StatusBar-progress{background:hsl(var(--primary))!important}.uppy-StatusBar-content{color:hsl(var(--foreground))!important}.uppy-StatusBar-actionBtn--upload{background:hsl(var(--primary))!important;color:hsl(var(--primary-foreground))!important;border-radius:.375rem!important;font-weight:500!important;padding:.5rem 1rem!important}.uppy-StatusBar-actionBtn--upload:hover{background:hsl(var(--primary) / .9)!important}.uppy-Dashboard-note{color:hsl(var(--muted-foreground))!important;font-size:.75rem!important}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles,.dark .uppy-Dashboard-AddFiles{background:hsl(var(--muted) / .2)!important}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles-title,.dark .uppy-Dashboard-AddFiles-title{color:hsl(var(--foreground))!important}[data-uppy-theme=dark] .uppy-StatusBar,.dark .uppy-StatusBar{background:hsl(var(--muted) / .5)!important}.uppy-Dashboard{font-family:inherit!important}.uppy-Dashboard-Item-preview{border-radius:.375rem!important;overflow:hidden}.uppy-Dashboard-Item-action--remove{color:hsl(var(--destructive))!important}.uppy-Dashboard-Item-action--remove:hover{opacity:.8}.uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progress{color:hsl(var(--success, 142 76% 36%))!important}.uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-progress{color:hsl(var(--destructive))!important}.uppy-Dashboard-files::-webkit-scrollbar{width:6px}.uppy-Dashboard-files::-webkit-scrollbar-track{background:transparent}.uppy-Dashboard-files::-webkit-scrollbar-thumb{background:hsl(var(--muted-foreground) / .3);border-radius:3px}.uppy-Dashboard-files::-webkit-scrollbar-thumb:hover{background:hsl(var(--muted-foreground) / .5)}.react-flow{direction:ltr}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;cursor:grab}.react-flow__pane.selection{cursor:pointer}.react-flow__pane.dragging{cursor:grabbing}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow .react-flow__edges{pointer-events:none;overflow:visible}.react-flow__edge-path,.react-flow__connection-path{stroke:#b1b1b7;stroke-width:1;fill:none}.react-flow__edge{pointer-events:visibleStroke;cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:focus .react-flow__edge-path,.react-flow__edge:focus-visible .react-flow__edge-path{stroke:#555}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge-textbg{fill:#fff}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__connectionline{z-index:1001}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:grab}.react-flow__node.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background:#1a192b;border:1px solid white;border-radius:100%}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:-4px;transform:translate(-50%)}.react-flow__handle-top{left:50%;top:-4px;transform:translate(-50%)}.react-flow__handle-left{top:50%;left:-4px;transform:translateY(-50%)}.react-flow__handle-right{right:-4px;top:50%;transform:translateY(-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.center{left:50%;transform:translate(-50%)}.react-flow__attribution{font-size:10px;background:#ffffff80;padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-default,.react-flow__node-input,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:3px;width:150px;font-size:12px;color:#222;text-align:center;border-width:1px;border-style:solid;border-color:#1a192b;background-color:#fff}.react-flow__node-default.selectable:hover,.react-flow__node-input.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:0 1px 4px 1px #00000014}.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:0 0 0 .5px #1a192b}.react-flow__node-group{background-color:#f0f0f040}.react-flow__nodesselection-rect,.react-flow__selection{background:#0059dc14;border:1px dotted rgba(0,89,220,.8)}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls{box-shadow:0 0 2px 1px #00000014}.react-flow__controls-button{border:none;background:#fefefe;border-bottom:1px solid #eee;box-sizing:content-box;display:flex;justify-content:center;align-items:center;width:16px;height:16px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:5px}.react-flow__controls-button:hover{background:#f4f4f4}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__minimap{background-color:#fff}.react-flow__minimap svg{display:block}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:4px;height:4px;border:1px solid #fff;border-radius:1px;background-color:#3367d9;transform:translate(-50%,-50%)}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:#3367d9;border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%} diff --git a/webui/dist/assets/index-CK0sXzir.js b/webui/dist/assets/index-CK0sXzir.js deleted file mode 100644 index b8aefaad..00000000 --- a/webui/dist/assets/index-CK0sXzir.js +++ /dev/null @@ -1,94 +0,0 @@ -import{r as m,j as e,L as Fn,e as ca,R as Ls,b as Q0,f as Y0,g as J0,h as X0,k as Z0,l as Zs,m as W0,n as ew,O as ij,o as sw}from"./router-9vIXuQkh.js";import{a as tw,b as aw,g as lw}from"./react-vendor-BmxF9s7Q.js";import{N as nw,c as rw,O as Wr,P as iw,g as Tm}from"./utils-BqoaXoQ1.js";import{L as cj,T as oj,C as dj,R as cw,a as uj,V as ow,b as dw,S as mj,c as uw,d as xj,I as mw,e as hj,f as xw,g as fj,h as hw,i as fw,j as pw,O as pj,P as gw,k as gj,l as jj,D as vj,A as Nj,m as bj,n as jw,o as vw,p as yj,q as Nw,r as wj,s as bw,t as yw,u as _j,v as ww,w as _w,x as Sj,y as kj,F as Cj,z as Tj,B as Sw,E as kw,G as Ej,H as Cw,J as Tw,K as Ew,M as Mw,N as Aw,Q as zw,U as Rw,W as Dw,X as Ow,Y as Lw,Z as Uw,_ as $w,$ as Bw,a0 as Iw,a1 as Pw,a2 as Mj,a3 as Fw,a4 as Hw}from"./radix-extra-DmmnfeQE.js";import{R as Aj,T as zj,L as Vw,g as Gw,C as Qi,X as Yi,Y as Hr,h as qw,B as Uo,j as Ji,P as Kw,k as Qw,l as Yw}from"./charts-simvewUa.js";import{S as Jw,O as Rj,o as Xw,C as Dj,p as Zw,T as Oj,D as Lj,R as Ww,q as e_,H as Uj,I as s_,J as $j,K as t_,L as Bj,M as Ij,N as a_,Q as Pj,V as l_,U as Fj,X as Hj,Y as n_,Z as r_,_ as Vj,$ as i_,a0 as c_,a1 as Gj,e as qj,f as sd,c as td,P as Zn,d as ad,b as gn,h as o_,l as d_,m as u_,u as Km,r as m_,a as x_,a2 as h_,a3 as Kj,a4 as f_,a5 as p_,a6 as g_,a7 as Qj,a8 as Yj,a9 as Jj,aa as Xj,ab as Zj,ac as Wj,ad as j_}from"./radix-core-DyJi0yyw.js";import{R as xt,a as lc,C as Ct,b as bt,L as Os,X as Aa,c as Mt,d as za,e as Qr,f as Da,g as sa,E as v_,h as na,i as Ka,S as At,B as Vn,U as jn,P as hc,Z as el,j as ev,F as Ea,k as N_,l as vn,m as b_,M as Ra,A as tx,D as y_,n as Yr,T as ax,o as w_,p as sv,I as Vt,q as It,r as Fo,s as nc,t as ia,H as __,u as ls,v as Wt,w as rc,x as lx,y as ec,z as wg,K as nx,G as tv,J as S_,N as $o,O as k_,Q as ld,V as C_,W as T_,Y as nd,_ as Ma,$ as Ys,a0 as rx,a1 as av,a2 as fc,a3 as lv,a4 as nv,a5 as Kn,a6 as Nn,a7 as bn,a8 as ix,a9 as rv,aa as ra,ab as Ll,ac as Qn,ad as Yn,ae as rd,af as E_,ag as M_,ah as A_,ai as cx,aj as Bo,ak as Jn,al as z_,am as Jr,an as Ho,ao as R_,ap as Vo,aq as ic,ar as iv,as as D_,at as O_,au as Go,av as L_,aw as ox,ax as U_,ay as _g,az as $_,aA as B_,aB as cv,aC as I_,aD as mn,aE as ov,aF as Em,aG as Sg,aH as P_,aI as Mm,aJ as F_,aK as H_,aL as V_,aM as G_,aN as dv,aO as q_,aP as Xr,aQ as K_,aR as Q_,aS as uv,aT as mv,aU as Y_,aV as J_,aW as kg,aX as X_,aY as Z_,aZ as W_,a_ as e1,a$ as s1}from"./icons-9Z4kBNLK.js";import{S as t1,p as a1,j as l1,a as n1,E as Am,R as r1,o as i1}from"./codemirror-TZqPU532.js";import{u as xv,a as qo,s as hv,K as fv,P as pv,b as gv,D as jv,c as vv,S as Nv,v as c1,d as bv,C as yv,h as o1}from"./dnd-BiPfFtVp.js";import{_ as ja,c as d1,g as wv,D as u1,z as Ro}from"./misc-CJqnlRwD.js";import{D as m1,U as x1}from"./uppy-DFP_VzYR.js";import{M as h1,r as f1,a as p1,b as g1}from"./markdown-CKA5gBQ9.js";import{c as j1,H as Ko,P as Qo,u as v1,d as N1,R as b1,B as y1,e as w1,C as _1,M as S1,f as k1}from"./reactflow-DtsZHOR4.js";(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))c(d);new MutationObserver(d=>{for(const u of d)if(u.type==="childList")for(const h of u.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function r(d){const u={};return d.integrity&&(u.integrity=d.integrity),d.referrerPolicy&&(u.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?u.credentials="include":d.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function c(d){if(d.ep)return;d.ep=!0;const u=r(d);fetch(d.href,u)}})();var zm={exports:{}},Gi={},Rm={exports:{}},Dm={};var Cg;function C1(){return Cg||(Cg=1,(function(a){function l(R,Q){var $=R.length;R.push(Q);e:for(;0<$;){var ue=$-1>>>1,G=R[ue];if(0>>1;ued(Te,$))qd(B,Te)?(R[ue]=B,R[q]=$,ue=q):(R[ue]=Te,R[fe]=$,ue=fe);else if(qd(B,$))R[ue]=B,R[q]=$,ue=q;else break e}}return Q}function d(R,Q){var $=R.sortIndex-Q.sortIndex;return $!==0?$:R.id-Q.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;a.unstable_now=function(){return u.now()}}else{var h=Date,f=h.now();a.unstable_now=function(){return h.now()-f}}var p=[],g=[],b=1,j=null,y=3,N=!1,w=!1,M=!1,A=!1,S=typeof setTimeout=="function"?setTimeout:null,U=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function C(R){for(var Q=r(g);Q!==null;){if(Q.callback===null)c(g);else if(Q.startTime<=R)c(g),Q.sortIndex=Q.expirationTime,l(p,Q);else break;Q=r(g)}}function D(R){if(M=!1,C(R),!w)if(r(p)!==null)w=!0,P||(P=!0,je());else{var Q=r(g);Q!==null&&ge(D,Q.startTime-R)}}var P=!1,O=-1,J=5,L=-1;function oe(){return A?!0:!(a.unstable_now()-LR&&oe());){var ue=j.callback;if(typeof ue=="function"){j.callback=null,y=j.priorityLevel;var G=ue(j.expirationTime<=R);if(R=a.unstable_now(),typeof G=="function"){j.callback=G,C(R),Q=!0;break s}j===r(p)&&c(p),C(R)}else c(p);j=r(p)}if(j!==null)Q=!0;else{var Se=r(g);Se!==null&&ge(D,Se.startTime-R),Q=!1}}break e}finally{j=null,y=$,N=!1}Q=void 0}}finally{Q?je():P=!1}}}var je;if(typeof E=="function")je=function(){E(Ne)};else if(typeof MessageChannel<"u"){var de=new MessageChannel,he=de.port2;de.port1.onmessage=Ne,je=function(){he.postMessage(null)}}else je=function(){S(Ne,0)};function ge(R,Q){O=S(function(){R(a.unstable_now())},Q)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(R){R.callback=null},a.unstable_forceFrameRate=function(R){0>R||125ue?(R.sortIndex=$,l(g,R),r(p)===null&&R===r(g)&&(M?(U(O),O=-1):M=!0,ge(D,$-ue))):(R.sortIndex=G,l(p,R),w||N||(w=!0,P||(P=!0,je()))),R},a.unstable_shouldYield=oe,a.unstable_wrapCallback=function(R){var Q=y;return function(){var $=y;y=Q;try{return R.apply(this,arguments)}finally{y=$}}}})(Dm)),Dm}var Tg;function T1(){return Tg||(Tg=1,Rm.exports=C1()),Rm.exports}var Eg;function E1(){if(Eg)return Gi;Eg=1;var a=T1(),l=tw(),r=aw();function c(s){var t="https://react.dev/errors/"+s;if(1G||(s.current=ue[G],ue[G]=null,G--)}function Te(s,t){G++,ue[G]=s.current,s.current=t}var q=Se(null),B=Se(null),z=Se(null),K=Se(null);function Ae(s,t){switch(Te(z,t),Te(B,s),Te(q,null),t.nodeType){case 9:case 11:s=(s=t.documentElement)&&(s=s.namespaceURI)?qp(s):0;break;default:if(s=t.tagName,t=t.namespaceURI)t=qp(t),s=Kp(t,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}fe(q),Te(q,s)}function ee(){fe(q),fe(B),fe(z)}function Y(s){s.memoizedState!==null&&Te(K,s);var t=q.current,n=Kp(t,s.type);t!==n&&(Te(B,s),Te(q,n))}function $e(s){B.current===s&&(fe(q),fe(B)),K.current===s&&(fe(K),Pi._currentValue=$)}var H,se;function Ue(s){if(H===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);H=t&&t[1]||"",se=-1)":-1o||I[i]!==ne[o]){var ve=` -`+I[i].replace(" at new "," at ");return s.displayName&&ve.includes("")&&(ve=ve.replace("",s.displayName)),ve}while(1<=i&&0<=o);break}}}finally{ie=!1,Error.prepareStackTrace=n}return(n=s?s.displayName||s.name:"")?Ue(n):""}function me(s,t){switch(s.tag){case 26:case 27:case 5:return Ue(s.type);case 16:return Ue("Lazy");case 13:return s.child!==t&&t!==null?Ue("Suspense Fallback"):Ue("Suspense");case 19:return Ue("SuspenseList");case 0:case 15:return Ee(s.type,!1);case 11:return Ee(s.type.render,!1);case 1:return Ee(s.type,!0);case 31:return Ue("Activity");default:return""}}function ze(s){try{var t="",n=null;do t+=me(s,n),n=s,s=s.return;while(s);return t}catch(i){return` -Error generating stack: `+i.message+` -`+i.stack}}var at=Object.prototype.hasOwnProperty,Pt=a.unstable_scheduleCallback,qt=a.unstable_cancelCallback,Ja=a.unstable_shouldYield,As=a.unstable_requestPaint,vt=a.unstable_now,Z=a.unstable_getCurrentPriorityLevel,qe=a.unstable_ImmediatePriority,Qe=a.unstable_UserBlockingPriority,We=a.unstable_NormalPriority,Rs=a.unstable_LowPriority,He=a.unstable_IdlePriority,Ss=a.log,Ds=a.unstable_setDisableYieldValue,Vs=null,ns=null;function ts(s){if(typeof Ss=="function"&&Ds(s),ns&&typeof ns.setStrictMode=="function")try{ns.setStrictMode(Vs,s)}catch{}}var Ns=Math.clz32?Math.clz32:_s,Le=Math.log,bs=Math.LN2;function _s(s){return s>>>=0,s===0?32:31-(Le(s)/bs|0)|0}var rs=256,ft=262144,zt=4194304;function Oa(s){var t=s&42;if(t!==0)return t;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function ll(s,t,n){var i=s.pendingLanes;if(i===0)return 0;var o=0,x=s.suspendedLanes,v=s.pingedLanes;s=s.warmLanes;var k=i&134217727;return k!==0?(i=k&~x,i!==0?o=Oa(i):(v&=k,v!==0?o=Oa(v):n||(n=k&~s,n!==0&&(o=Oa(n))))):(k=i&~x,k!==0?o=Oa(k):v!==0?o=Oa(v):n||(n=i&~s,n!==0&&(o=Oa(n)))),o===0?0:t!==0&&t!==o&&(t&x)===0&&(x=o&-o,n=t&-t,x>=n||x===32&&(n&4194048)!==0)?t:o}function xl(s,t){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&t)===0}function sr(s,t){switch(s){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function te(){var s=zt;return zt<<=1,(zt&62914560)===0&&(zt=4194304),s}function we(s){for(var t=[],n=0;31>n;n++)t.push(s);return t}function Oe(s,t){s.pendingLanes|=t,t!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Gs(s,t,n,i,o,x){var v=s.pendingLanes;s.pendingLanes=n,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=n,s.entangledLanes&=n,s.errorRecoveryDisabledLanes&=n,s.shellSuspendCounter=0;var k=s.entanglements,I=s.expirationTimes,ne=s.hiddenUpdates;for(n=v&~n;0"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var Fb=/[\n"\\]/g;function Ua(s){return s.replace(Fb,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function yd(s,t,n,i,o,x,v,k){s.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?s.type=v:s.removeAttribute("type"),t!=null?v==="number"?(t===0&&s.value===""||s.value!=t)&&(s.value=""+La(t)):s.value!==""+La(t)&&(s.value=""+La(t)):v!=="submit"&&v!=="reset"||s.removeAttribute("value"),t!=null?wd(s,v,La(t)):n!=null?wd(s,v,La(n)):i!=null&&s.removeAttribute("value"),o==null&&x!=null&&(s.defaultChecked=!!x),o!=null&&(s.checked=o&&typeof o!="function"&&typeof o!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?s.name=""+La(k):s.removeAttribute("name")}function Bx(s,t,n,i,o,x,v,k){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(s.type=x),t!=null||n!=null){if(!(x!=="submit"&&x!=="reset"||t!=null)){bd(s);return}n=n!=null?""+La(n):"",t=t!=null?""+La(t):n,k||t===s.value||(s.value=t),s.defaultValue=t}i=i??o,i=typeof i!="function"&&typeof i!="symbol"&&!!i,s.checked=k?s.checked:!!i,s.defaultChecked=!!i,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(s.name=v),bd(s)}function wd(s,t,n){t==="number"&&yc(s.ownerDocument)===s||s.defaultValue===""+n||(s.defaultValue=""+n)}function ir(s,t,n,i){if(s=s.options,t){t={};for(var o=0;o"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Td=!1;if(pl)try{var ni={};Object.defineProperty(ni,"passive",{get:function(){Td=!0}}),window.addEventListener("test",ni,ni),window.removeEventListener("test",ni,ni)}catch{Td=!1}var Fl=null,Ed=null,_c=null;function qx(){if(_c)return _c;var s,t=Ed,n=t.length,i,o="value"in Fl?Fl.value:Fl.textContent,x=o.length;for(s=0;s=ci),Zx=" ",Wx=!1;function eh(s,t){switch(s){case"keyup":return py.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function sh(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var ur=!1;function jy(s,t){switch(s){case"compositionend":return sh(t);case"keypress":return t.which!==32?null:(Wx=!0,Zx);case"textInput":return s=t.data,s===Zx&&Wx?null:s;default:return null}}function vy(s,t){if(ur)return s==="compositionend"||!Dd&&eh(s,t)?(s=qx(),_c=Ed=Fl=null,ur=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-s};s=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=oh(n)}}function uh(s,t){return s&&t?s===t?!0:s&&s.nodeType===3?!1:t&&t.nodeType===3?uh(s,t.parentNode):"contains"in s?s.contains(t):s.compareDocumentPosition?!!(s.compareDocumentPosition(t)&16):!1:!1}function mh(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var t=yc(s.document);t instanceof s.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)s=t.contentWindow;else break;t=yc(s.document)}return t}function Ud(s){var t=s&&s.nodeName&&s.nodeName.toLowerCase();return t&&(t==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||t==="textarea"||s.contentEditable==="true")}var Cy=pl&&"documentMode"in document&&11>=document.documentMode,mr=null,$d=null,mi=null,Bd=!1;function xh(s,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Bd||mr==null||mr!==yc(i)||(i=mr,"selectionStart"in i&&Ud(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),mi&&ui(mi,i)||(mi=i,i=jo($d,"onSelect"),0>=v,o-=v,nl=1<<32-Ns(t)+o|n<js?(Ms=Ke,Ke=null):Ms=Ke.sibling;var Ps=ce(X,Ke,le[js],be);if(Ps===null){Ke===null&&(Ke=Ms);break}s&&Ke&&Ps.alternate===null&&t(X,Ke),V=x(Ps,V,js),Is===null?Je=Ps:Is.sibling=Ps,Is=Ps,Ke=Ms}if(js===le.length)return n(X,Ke),zs&&jl(X,js),Je;if(Ke===null){for(;jsjs?(Ms=Ke,Ke=null):Ms=Ke.sibling;var un=ce(X,Ke,Ps.value,be);if(un===null){Ke===null&&(Ke=Ms);break}s&&Ke&&un.alternate===null&&t(X,Ke),V=x(un,V,js),Is===null?Je=un:Is.sibling=un,Is=un,Ke=Ms}if(Ps.done)return n(X,Ke),zs&&jl(X,js),Je;if(Ke===null){for(;!Ps.done;js++,Ps=le.next())Ps=ye(X,Ps.value,be),Ps!==null&&(V=x(Ps,V,js),Is===null?Je=Ps:Is.sibling=Ps,Is=Ps);return zs&&jl(X,js),Je}for(Ke=i(Ke);!Ps.done;js++,Ps=le.next())Ps=xe(Ke,X,js,Ps.value,be),Ps!==null&&(s&&Ps.alternate!==null&&Ke.delete(Ps.key===null?js:Ps.key),V=x(Ps,V,js),Is===null?Je=Ps:Is.sibling=Ps,Is=Ps);return s&&Ke.forEach(function(K0){return t(X,K0)}),zs&&jl(X,js),Je}function tt(X,V,le,be){if(typeof le=="object"&&le!==null&&le.type===M&&le.key===null&&(le=le.props.children),typeof le=="object"&&le!==null){switch(le.$$typeof){case N:e:{for(var Je=le.key;V!==null;){if(V.key===Je){if(Je=le.type,Je===M){if(V.tag===7){n(X,V.sibling),be=o(V,le.props.children),be.return=X,X=be;break e}}else if(V.elementType===Je||typeof Je=="object"&&Je!==null&&Je.$$typeof===J&&On(Je)===V.type){n(X,V.sibling),be=o(V,le.props),ji(be,le),be.return=X,X=be;break e}n(X,V);break}else t(X,V);V=V.sibling}le.type===M?(be=Mn(le.props.children,X.mode,be,le.key),be.return=X,X=be):(be=Dc(le.type,le.key,le.props,null,X.mode,be),ji(be,le),be.return=X,X=be)}return v(X);case w:e:{for(Je=le.key;V!==null;){if(V.key===Je)if(V.tag===4&&V.stateNode.containerInfo===le.containerInfo&&V.stateNode.implementation===le.implementation){n(X,V.sibling),be=o(V,le.children||[]),be.return=X,X=be;break e}else{n(X,V);break}else t(X,V);V=V.sibling}be=qd(le,X.mode,be),be.return=X,X=be}return v(X);case J:return le=On(le),tt(X,V,le,be)}if(ge(le))return Ve(X,V,le,be);if(je(le)){if(Je=je(le),typeof Je!="function")throw Error(c(150));return le=Je.call(le),es(X,V,le,be)}if(typeof le.then=="function")return tt(X,V,Pc(le),be);if(le.$$typeof===E)return tt(X,V,Uc(X,le),be);Fc(X,le)}return typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint"?(le=""+le,V!==null&&V.tag===6?(n(X,V.sibling),be=o(V,le),be.return=X,X=be):(n(X,V),be=Gd(le,X.mode,be),be.return=X,X=be),v(X)):n(X,V)}return function(X,V,le,be){try{gi=0;var Je=tt(X,V,le,be);return wr=null,Je}catch(Ke){if(Ke===yr||Ke===Bc)throw Ke;var Is=ba(29,Ke,null,X.mode);return Is.lanes=be,Is.return=X,Is}finally{}}}var Un=Lh(!0),Uh=Lh(!1),Kl=!1;function lu(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function nu(s,t){s=s.updateQueue,t.updateQueue===s&&(t.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function Ql(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Yl(s,t,n){var i=s.updateQueue;if(i===null)return null;if(i=i.shared,(Hs&2)!==0){var o=i.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),i.pending=t,t=Rc(s),Nh(s,null,n),t}return zc(s,i,t,n),Rc(s)}function vi(s,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var i=t.lanes;i&=s.pendingLanes,n|=i,t.lanes=n,ta(s,n)}}function ru(s,t){var n=s.updateQueue,i=s.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var o=null,x=null;if(n=n.firstBaseUpdate,n!==null){do{var v={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};x===null?o=x=v:x=x.next=v,n=n.next}while(n!==null);x===null?o=x=t:x=x.next=t}else o=x=t;n={baseState:i.baseState,firstBaseUpdate:o,lastBaseUpdate:x,shared:i.shared,callbacks:i.callbacks},s.updateQueue=n;return}s=n.lastBaseUpdate,s===null?n.firstBaseUpdate=t:s.next=t,n.lastBaseUpdate=t}var iu=!1;function Ni(){if(iu){var s=br;if(s!==null)throw s}}function bi(s,t,n,i){iu=!1;var o=s.updateQueue;Kl=!1;var x=o.firstBaseUpdate,v=o.lastBaseUpdate,k=o.shared.pending;if(k!==null){o.shared.pending=null;var I=k,ne=I.next;I.next=null,v===null?x=ne:v.next=ne,v=I;var ve=s.alternate;ve!==null&&(ve=ve.updateQueue,k=ve.lastBaseUpdate,k!==v&&(k===null?ve.firstBaseUpdate=ne:k.next=ne,ve.lastBaseUpdate=I))}if(x!==null){var ye=o.baseState;v=0,ve=ne=I=null,k=x;do{var ce=k.lane&-536870913,xe=ce!==k.lane;if(xe?(Es&ce)===ce:(i&ce)===ce){ce!==0&&ce===Nr&&(iu=!0),ve!==null&&(ve=ve.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var Ve=s,es=k;ce=t;var tt=n;switch(es.tag){case 1:if(Ve=es.payload,typeof Ve=="function"){ye=Ve.call(tt,ye,ce);break e}ye=Ve;break e;case 3:Ve.flags=Ve.flags&-65537|128;case 0:if(Ve=es.payload,ce=typeof Ve=="function"?Ve.call(tt,ye,ce):Ve,ce==null)break e;ye=j({},ye,ce);break e;case 2:Kl=!0}}ce=k.callback,ce!==null&&(s.flags|=64,xe&&(s.flags|=8192),xe=o.callbacks,xe===null?o.callbacks=[ce]:xe.push(ce))}else xe={lane:ce,tag:k.tag,payload:k.payload,callback:k.callback,next:null},ve===null?(ne=ve=xe,I=ye):ve=ve.next=xe,v|=ce;if(k=k.next,k===null){if(k=o.shared.pending,k===null)break;xe=k,k=xe.next,xe.next=null,o.lastBaseUpdate=xe,o.shared.pending=null}}while(!0);ve===null&&(I=ye),o.baseState=I,o.firstBaseUpdate=ne,o.lastBaseUpdate=ve,x===null&&(o.shared.lanes=0),en|=v,s.lanes=v,s.memoizedState=ye}}function $h(s,t){if(typeof s!="function")throw Error(c(191,s));s.call(t)}function Bh(s,t){var n=s.callbacks;if(n!==null)for(s.callbacks=null,s=0;sx?x:8;var v=R.T,k={};R.T=k,ku(s,!1,t,n);try{var I=o(),ne=R.S;if(ne!==null&&ne(k,I),I!==null&&typeof I=="object"&&typeof I.then=="function"){var ve=Ly(I,i);_i(s,t,ve,ka(s))}else _i(s,t,i,ka(s))}catch(ye){_i(s,t,{then:function(){},status:"rejected",reason:ye},ka())}finally{Q.p=x,v!==null&&k.types!==null&&(v.types=k.types),R.T=v}}function Fy(){}function _u(s,t,n,i){if(s.tag!==5)throw Error(c(476));var o=jf(s).queue;gf(s,o,t,$,n===null?Fy:function(){return vf(s),n(i)})}function jf(s){var t=s.memoizedState;if(t!==null)return t;t={memoizedState:$,baseState:$,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yl,lastRenderedState:$},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yl,lastRenderedState:n},next:null},s.memoizedState=t,s=s.alternate,s!==null&&(s.memoizedState=t),t}function vf(s){var t=jf(s);t.next===null&&(t=s.alternate.memoizedState),_i(s,t.next.queue,{},ka())}function Su(){return Qt(Pi)}function Nf(){return Et().memoizedState}function bf(){return Et().memoizedState}function Hy(s){for(var t=s.return;t!==null;){switch(t.tag){case 24:case 3:var n=ka();s=Ql(n);var i=Yl(t,s,n);i!==null&&(fa(i,t,n),vi(i,t,n)),t={cache:eu()},s.payload=t;return}t=t.return}}function Vy(s,t,n){var i=ka();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Zc(s)?wf(t,n):(n=Hd(s,t,n,i),n!==null&&(fa(n,s,i),_f(n,t,i)))}function yf(s,t,n){var i=ka();_i(s,t,n,i)}function _i(s,t,n,i){var o={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Zc(s))wf(t,o);else{var x=s.alternate;if(s.lanes===0&&(x===null||x.lanes===0)&&(x=t.lastRenderedReducer,x!==null))try{var v=t.lastRenderedState,k=x(v,n);if(o.hasEagerState=!0,o.eagerState=k,Na(k,v))return zc(s,t,o,0),lt===null&&Ac(),!1}catch{}finally{}if(n=Hd(s,t,o,i),n!==null)return fa(n,s,i),_f(n,t,i),!0}return!1}function ku(s,t,n,i){if(i={lane:2,revertLane:lm(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Zc(s)){if(t)throw Error(c(479))}else t=Hd(s,n,i,2),t!==null&&fa(t,s,2)}function Zc(s){var t=s.alternate;return s===ps||t!==null&&t===ps}function wf(s,t){Sr=Gc=!0;var n=s.pending;n===null?t.next=t:(t.next=n.next,n.next=t),s.pending=t}function _f(s,t,n){if((n&4194048)!==0){var i=t.lanes;i&=s.pendingLanes,n|=i,t.lanes=n,ta(s,n)}}var Si={readContext:Qt,use:Qc,useCallback:wt,useContext:wt,useEffect:wt,useImperativeHandle:wt,useLayoutEffect:wt,useInsertionEffect:wt,useMemo:wt,useReducer:wt,useRef:wt,useState:wt,useDebugValue:wt,useDeferredValue:wt,useTransition:wt,useSyncExternalStore:wt,useId:wt,useHostTransitionStatus:wt,useFormState:wt,useActionState:wt,useOptimistic:wt,useMemoCache:wt,useCacheRefresh:wt};Si.useEffectEvent=wt;var Sf={readContext:Qt,use:Qc,useCallback:function(s,t){return la().memoizedState=[s,t===void 0?null:t],s},useContext:Qt,useEffect:cf,useImperativeHandle:function(s,t,n){n=n!=null?n.concat([s]):null,Jc(4194308,4,mf.bind(null,t,s),n)},useLayoutEffect:function(s,t){return Jc(4194308,4,s,t)},useInsertionEffect:function(s,t){Jc(4,2,s,t)},useMemo:function(s,t){var n=la();t=t===void 0?null:t;var i=s();if($n){ts(!0);try{s()}finally{ts(!1)}}return n.memoizedState=[i,t],i},useReducer:function(s,t,n){var i=la();if(n!==void 0){var o=n(t);if($n){ts(!0);try{n(t)}finally{ts(!1)}}}else o=t;return i.memoizedState=i.baseState=o,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:o},i.queue=s,s=s.dispatch=Vy.bind(null,ps,s),[i.memoizedState,s]},useRef:function(s){var t=la();return s={current:s},t.memoizedState=s},useState:function(s){s=vu(s);var t=s.queue,n=yf.bind(null,ps,t);return t.dispatch=n,[s.memoizedState,n]},useDebugValue:yu,useDeferredValue:function(s,t){var n=la();return wu(n,s,t)},useTransition:function(){var s=vu(!1);return s=gf.bind(null,ps,s.queue,!0,!1),la().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,t,n){var i=ps,o=la();if(zs){if(n===void 0)throw Error(c(407));n=n()}else{if(n=t(),lt===null)throw Error(c(349));(Es&127)!==0||Gh(i,t,n)}o.memoizedState=n;var x={value:n,getSnapshot:t};return o.queue=x,cf(Kh.bind(null,i,x,s),[s]),i.flags|=2048,Cr(9,{destroy:void 0},qh.bind(null,i,x,n,t),null),n},useId:function(){var s=la(),t=lt.identifierPrefix;if(zs){var n=rl,i=nl;n=(i&~(1<<32-Ns(i)-1)).toString(32)+n,t="_"+t+"R_"+n,n=qc++,0<\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof i.is=="string"?v.createElement("select",{is:i.is}):v.createElement("select"),i.multiple?x.multiple=!0:i.size&&(x.size=i.size);break;default:x=typeof i.is=="string"?v.createElement(o,{is:i.is}):v.createElement(o)}}x[ys]=t,x[fs]=i;e:for(v=t.child;v!==null;){if(v.tag===5||v.tag===6)x.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===t)break e;for(;v.sibling===null;){if(v.return===null||v.return===t)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}t.stateNode=x;e:switch(Jt(x,o,i),o){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&_l(t)}}return mt(t),Iu(t,t.type,s===null?null:s.memoizedProps,t.pendingProps,n),null;case 6:if(s&&t.stateNode!=null)s.memoizedProps!==i&&_l(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(c(166));if(s=z.current,jr(t)){if(s=t.stateNode,n=t.memoizedProps,i=null,o=Kt,o!==null)switch(o.tag){case 27:case 5:i=o.memoizedProps}s[ys]=t,s=!!(s.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||Vp(s.nodeValue,n)),s||Gl(t,!0)}else s=vo(s).createTextNode(i),s[ys]=t,t.stateNode=s}return mt(t),null;case 31:if(n=t.memoizedState,s===null||s.memoizedState!==null){if(i=jr(t),n!==null){if(s===null){if(!i)throw Error(c(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(c(557));s[ys]=t}else An(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;mt(t),s=!1}else n=Jd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=n),s=!0;if(!s)return t.flags&256?(wa(t),t):(wa(t),null);if((t.flags&128)!==0)throw Error(c(558))}return mt(t),null;case 13:if(i=t.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(o=jr(t),i!==null&&i.dehydrated!==null){if(s===null){if(!o)throw Error(c(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(c(317));o[ys]=t}else An(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;mt(t),o=!1}else o=Jd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(wa(t),t):(wa(t),null)}return wa(t),(t.flags&128)!==0?(t.lanes=n,t):(n=i!==null,s=s!==null&&s.memoizedState!==null,n&&(i=t.child,o=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(o=i.alternate.memoizedState.cachePool.pool),x=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(x=i.memoizedState.cachePool.pool),x!==o&&(i.flags|=2048)),n!==s&&n&&(t.child.flags|=8192),ao(t,t.updateQueue),mt(t),null);case 4:return ee(),s===null&&cm(t.stateNode.containerInfo),mt(t),null;case 10:return Nl(t.type),mt(t),null;case 19:if(fe(Tt),i=t.memoizedState,i===null)return mt(t),null;if(o=(t.flags&128)!==0,x=i.rendering,x===null)if(o)Ci(i,!1);else{if(_t!==0||s!==null&&(s.flags&128)!==0)for(s=t.child;s!==null;){if(x=Vc(s),x!==null){for(t.flags|=128,Ci(i,!1),s=x.updateQueue,t.updateQueue=s,ao(t,s),t.subtreeFlags=0,s=n,n=t.child;n!==null;)bh(n,s),n=n.sibling;return Te(Tt,Tt.current&1|2),zs&&jl(t,i.treeForkCount),t.child}s=s.sibling}i.tail!==null&&vt()>co&&(t.flags|=128,o=!0,Ci(i,!1),t.lanes=4194304)}else{if(!o)if(s=Vc(x),s!==null){if(t.flags|=128,o=!0,s=s.updateQueue,t.updateQueue=s,ao(t,s),Ci(i,!0),i.tail===null&&i.tailMode==="hidden"&&!x.alternate&&!zs)return mt(t),null}else 2*vt()-i.renderingStartTime>co&&n!==536870912&&(t.flags|=128,o=!0,Ci(i,!1),t.lanes=4194304);i.isBackwards?(x.sibling=t.child,t.child=x):(s=i.last,s!==null?s.sibling=x:t.child=x,i.last=x)}return i.tail!==null?(s=i.tail,i.rendering=s,i.tail=s.sibling,i.renderingStartTime=vt(),s.sibling=null,n=Tt.current,Te(Tt,o?n&1|2:n&1),zs&&jl(t,i.treeForkCount),s):(mt(t),null);case 22:case 23:return wa(t),ou(),i=t.memoizedState!==null,s!==null?s.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(n&536870912)!==0&&(t.flags&128)===0&&(mt(t),t.subtreeFlags&6&&(t.flags|=8192)):mt(t),n=t.updateQueue,n!==null&&ao(t,n.retryQueue),n=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(n=s.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),s!==null&&fe(Dn),null;case 24:return n=null,s!==null&&(n=s.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Nl(Rt),mt(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function Yy(s,t){switch(Qd(t),t.tag){case 1:return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 3:return Nl(Rt),ee(),s=t.flags,(s&65536)!==0&&(s&128)===0?(t.flags=s&-65537|128,t):null;case 26:case 27:case 5:return $e(t),null;case 31:if(t.memoizedState!==null){if(wa(t),t.alternate===null)throw Error(c(340));An()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 13:if(wa(t),s=t.memoizedState,s!==null&&s.dehydrated!==null){if(t.alternate===null)throw Error(c(340));An()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 19:return fe(Tt),null;case 4:return ee(),null;case 10:return Nl(t.type),null;case 22:case 23:return wa(t),ou(),s!==null&&fe(Dn),s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 24:return Nl(Rt),null;case 25:return null;default:return null}}function Yf(s,t){switch(Qd(t),t.tag){case 3:Nl(Rt),ee();break;case 26:case 27:case 5:$e(t);break;case 4:ee();break;case 31:t.memoizedState!==null&&wa(t);break;case 13:wa(t);break;case 19:fe(Tt);break;case 10:Nl(t.type);break;case 22:case 23:wa(t),ou(),s!==null&&fe(Dn);break;case 24:Nl(Rt)}}function Ti(s,t){try{var n=t.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var o=i.next;n=o;do{if((n.tag&s)===s){i=void 0;var x=n.create,v=n.inst;i=x(),v.destroy=i}n=n.next}while(n!==o)}}catch(k){Qs(t,t.return,k)}}function Zl(s,t,n){try{var i=t.updateQueue,o=i!==null?i.lastEffect:null;if(o!==null){var x=o.next;i=x;do{if((i.tag&s)===s){var v=i.inst,k=v.destroy;if(k!==void 0){v.destroy=void 0,o=t;var I=n,ne=k;try{ne()}catch(ve){Qs(o,I,ve)}}}i=i.next}while(i!==x)}}catch(ve){Qs(t,t.return,ve)}}function Jf(s){var t=s.updateQueue;if(t!==null){var n=s.stateNode;try{Bh(t,n)}catch(i){Qs(s,s.return,i)}}}function Xf(s,t,n){n.props=Bn(s.type,s.memoizedProps),n.state=s.memoizedState;try{n.componentWillUnmount()}catch(i){Qs(s,t,i)}}function Ei(s,t){try{var n=s.ref;if(n!==null){switch(s.tag){case 26:case 27:case 5:var i=s.stateNode;break;case 30:i=s.stateNode;break;default:i=s.stateNode}typeof n=="function"?s.refCleanup=n(i):n.current=i}}catch(o){Qs(s,t,o)}}function il(s,t){var n=s.ref,i=s.refCleanup;if(n!==null)if(typeof i=="function")try{i()}catch(o){Qs(s,t,o)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(o){Qs(s,t,o)}else n.current=null}function Zf(s){var t=s.type,n=s.memoizedProps,i=s.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break e;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(o){Qs(s,s.return,o)}}function Pu(s,t,n){try{var i=s.stateNode;g0(i,s.type,n,t),i[fs]=t}catch(o){Qs(s,s.return,o)}}function Wf(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&nn(s.type)||s.tag===4}function Fu(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Wf(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&nn(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Hu(s,t,n){var i=s.tag;if(i===5||i===6)s=s.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(s,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(s),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=fl));else if(i!==4&&(i===27&&nn(s.type)&&(n=s.stateNode,t=null),s=s.child,s!==null))for(Hu(s,t,n),s=s.sibling;s!==null;)Hu(s,t,n),s=s.sibling}function lo(s,t,n){var i=s.tag;if(i===5||i===6)s=s.stateNode,t?n.insertBefore(s,t):n.appendChild(s);else if(i!==4&&(i===27&&nn(s.type)&&(n=s.stateNode),s=s.child,s!==null))for(lo(s,t,n),s=s.sibling;s!==null;)lo(s,t,n),s=s.sibling}function ep(s){var t=s.stateNode,n=s.memoizedProps;try{for(var i=s.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);Jt(t,i,n),t[ys]=s,t[fs]=n}catch(x){Qs(s,s.return,x)}}var Sl=!1,Lt=!1,Vu=!1,sp=typeof WeakSet=="function"?WeakSet:Set,Ht=null;function Jy(s,t){if(s=s.containerInfo,um=ko,s=mh(s),Ud(s)){if("selectionStart"in s)var n={start:s.selectionStart,end:s.selectionEnd};else e:{n=(n=s.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var o=i.anchorOffset,x=i.focusNode;i=i.focusOffset;try{n.nodeType,x.nodeType}catch{n=null;break e}var v=0,k=-1,I=-1,ne=0,ve=0,ye=s,ce=null;s:for(;;){for(var xe;ye!==n||o!==0&&ye.nodeType!==3||(k=v+o),ye!==x||i!==0&&ye.nodeType!==3||(I=v+i),ye.nodeType===3&&(v+=ye.nodeValue.length),(xe=ye.firstChild)!==null;)ce=ye,ye=xe;for(;;){if(ye===s)break s;if(ce===n&&++ne===o&&(k=v),ce===x&&++ve===i&&(I=v),(xe=ye.nextSibling)!==null)break;ye=ce,ce=ye.parentNode}ye=xe}n=k===-1||I===-1?null:{start:k,end:I}}else n=null}n=n||{start:0,end:0}}else n=null;for(mm={focusedElem:s,selectionRange:n},ko=!1,Ht=t;Ht!==null;)if(t=Ht,s=t.child,(t.subtreeFlags&1028)!==0&&s!==null)s.return=t,Ht=s;else for(;Ht!==null;){switch(t=Ht,x=t.alternate,s=t.flags,t.tag){case 0:if((s&4)!==0&&(s=t.updateQueue,s=s!==null?s.events:null,s!==null))for(n=0;n title"))),Jt(x,i,n),x[ys]=s,Ft(x),i=x;break e;case"link":var v=ig("link","href",o).get(i+(n.href||""));if(v){for(var k=0;ktt&&(v=tt,tt=es,es=v);var X=dh(k,es),V=dh(k,tt);if(X&&V&&(xe.rangeCount!==1||xe.anchorNode!==X.node||xe.anchorOffset!==X.offset||xe.focusNode!==V.node||xe.focusOffset!==V.offset)){var le=ye.createRange();le.setStart(X.node,X.offset),xe.removeAllRanges(),es>tt?(xe.addRange(le),xe.extend(V.node,V.offset)):(le.setEnd(V.node,V.offset),xe.addRange(le))}}}}for(ye=[],xe=k;xe=xe.parentNode;)xe.nodeType===1&&ye.push({element:xe,left:xe.scrollLeft,top:xe.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;kn?32:n,R.T=null,n=Xu,Xu=null;var x=tn,v=Ml;if($t=0,zr=tn=null,Ml=0,(Hs&6)!==0)throw Error(c(331));var k=Hs;if(Hs|=4,mp(x.current),op(x,x.current,v,n),Hs=k,Oi(0,!1),ns&&typeof ns.onPostCommitFiberRoot=="function")try{ns.onPostCommitFiberRoot(Vs,x)}catch{}return!0}finally{Q.p=o,R.T=i,Mp(s,t)}}function zp(s,t,n){t=Ba(n,t),t=Mu(s.stateNode,t,2),s=Yl(s,t,2),s!==null&&(Oe(s,2),cl(s))}function Qs(s,t,n){if(s.tag===3)zp(s,s,n);else for(;t!==null;){if(t.tag===3){zp(t,s,n);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(sn===null||!sn.has(i))){s=Ba(n,s),n=Rf(2),i=Yl(t,n,2),i!==null&&(Df(n,i,t,s),Oe(i,2),cl(i));break}}t=t.return}}function sm(s,t,n){var i=s.pingCache;if(i===null){i=s.pingCache=new Wy;var o=new Set;i.set(t,o)}else o=i.get(t),o===void 0&&(o=new Set,i.set(t,o));o.has(n)||(Ku=!0,o.add(n),s=l0.bind(null,s,t,n),t.then(s,s))}function l0(s,t,n){var i=s.pingCache;i!==null&&i.delete(t),s.pingedLanes|=s.suspendedLanes&n,s.warmLanes&=~n,lt===s&&(Es&n)===n&&(_t===4||_t===3&&(Es&62914560)===Es&&300>vt()-io?(Hs&2)===0&&Rr(s,0):Qu|=n,Ar===Es&&(Ar=0)),cl(s)}function Rp(s,t){t===0&&(t=te()),s=En(s,t),s!==null&&(Oe(s,t),cl(s))}function n0(s){var t=s.memoizedState,n=0;t!==null&&(n=t.retryLane),Rp(s,n)}function r0(s,t){var n=0;switch(s.tag){case 31:case 13:var i=s.stateNode,o=s.memoizedState;o!==null&&(n=o.retryLane);break;case 19:i=s.stateNode;break;case 22:i=s.stateNode._retryCache;break;default:throw Error(c(314))}i!==null&&i.delete(t),Rp(s,n)}function i0(s,t){return Pt(s,t)}var fo=null,Or=null,tm=!1,po=!1,am=!1,ln=0;function cl(s){s!==Or&&s.next===null&&(Or===null?fo=Or=s:Or=Or.next=s),po=!0,tm||(tm=!0,o0())}function Oi(s,t){if(!am&&po){am=!0;do for(var n=!1,i=fo;i!==null;){if(s!==0){var o=i.pendingLanes;if(o===0)var x=0;else{var v=i.suspendedLanes,k=i.pingedLanes;x=(1<<31-Ns(42|s)+1)-1,x&=o&~(v&~k),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(n=!0,Up(i,x))}else x=Es,x=ll(i,i===lt?x:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(x&3)===0||xl(i,x)||(n=!0,Up(i,x));i=i.next}while(n);am=!1}}function c0(){Dp()}function Dp(){po=tm=!1;var s=0;ln!==0&&v0()&&(s=ln);for(var t=vt(),n=null,i=fo;i!==null;){var o=i.next,x=Op(i,t);x===0?(i.next=null,n===null?fo=o:n.next=o,o===null&&(Or=n)):(n=i,(s!==0||(x&3)!==0)&&(po=!0)),i=o}$t!==0&&$t!==5||Oi(s),ln!==0&&(ln=0)}function Op(s,t){for(var n=s.suspendedLanes,i=s.pingedLanes,o=s.expirationTimes,x=s.pendingLanes&-62914561;0k)break;var ve=I.transferSize,ye=I.initiatorType;ve&&Gp(ye)&&(I=I.responseEnd,v+=ve*(I"u"?null:document;function ag(s,t,n){var i=Lr;if(i&&typeof t=="string"&&t){var o=Ua(t);o='link[rel="'+s+'"][href="'+o+'"]',typeof n=="string"&&(o+='[crossorigin="'+n+'"]'),tg.has(o)||(tg.add(o),s={rel:s,crossOrigin:n,href:t},i.querySelector(o)===null&&(t=i.createElement("link"),Jt(t,"link",s),Ft(t),i.head.appendChild(t)))}}function T0(s){Al.D(s),ag("dns-prefetch",s,null)}function E0(s,t){Al.C(s,t),ag("preconnect",s,t)}function M0(s,t,n){Al.L(s,t,n);var i=Lr;if(i&&s&&t){var o='link[rel="preload"][as="'+Ua(t)+'"]';t==="image"&&n&&n.imageSrcSet?(o+='[imagesrcset="'+Ua(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(o+='[imagesizes="'+Ua(n.imageSizes)+'"]')):o+='[href="'+Ua(s)+'"]';var x=o;switch(t){case"style":x=Ur(s);break;case"script":x=$r(s)}Ga.has(x)||(s=j({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:s,as:t},n),Ga.set(x,s),i.querySelector(o)!==null||t==="style"&&i.querySelector(Bi(x))||t==="script"&&i.querySelector(Ii(x))||(t=i.createElement("link"),Jt(t,"link",s),Ft(t),i.head.appendChild(t)))}}function A0(s,t){Al.m(s,t);var n=Lr;if(n&&s){var i=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Ua(i)+'"][href="'+Ua(s)+'"]',x=o;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=$r(s)}if(!Ga.has(x)&&(s=j({rel:"modulepreload",href:s},t),Ga.set(x,s),n.querySelector(o)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Ii(x)))return}i=n.createElement("link"),Jt(i,"link",s),Ft(i),n.head.appendChild(i)}}}function z0(s,t,n){Al.S(s,t,n);var i=Lr;if(i&&s){var o=nr(i).hoistableStyles,x=Ur(s);t=t||"default";var v=o.get(x);if(!v){var k={loading:0,preload:null};if(v=i.querySelector(Bi(x)))k.loading=5;else{s=j({rel:"stylesheet",href:s,"data-precedence":t},n),(n=Ga.get(x))&&vm(s,n);var I=v=i.createElement("link");Ft(I),Jt(I,"link",s),I._p=new Promise(function(ne,ve){I.onload=ne,I.onerror=ve}),I.addEventListener("load",function(){k.loading|=1}),I.addEventListener("error",function(){k.loading|=2}),k.loading|=4,bo(v,t,i)}v={type:"stylesheet",instance:v,count:1,state:k},o.set(x,v)}}}function R0(s,t){Al.X(s,t);var n=Lr;if(n&&s){var i=nr(n).hoistableScripts,o=$r(s),x=i.get(o);x||(x=n.querySelector(Ii(o)),x||(s=j({src:s,async:!0},t),(t=Ga.get(o))&&Nm(s,t),x=n.createElement("script"),Ft(x),Jt(x,"link",s),n.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},i.set(o,x))}}function D0(s,t){Al.M(s,t);var n=Lr;if(n&&s){var i=nr(n).hoistableScripts,o=$r(s),x=i.get(o);x||(x=n.querySelector(Ii(o)),x||(s=j({src:s,async:!0,type:"module"},t),(t=Ga.get(o))&&Nm(s,t),x=n.createElement("script"),Ft(x),Jt(x,"link",s),n.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},i.set(o,x))}}function lg(s,t,n,i){var o=(o=z.current)?No(o):null;if(!o)throw Error(c(446));switch(s){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Ur(n.href),n=nr(o).hoistableStyles,i=n.get(t),i||(i={type:"style",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){s=Ur(n.href);var x=nr(o).hoistableStyles,v=x.get(s);if(v||(o=o.ownerDocument||o,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(s,v),(x=o.querySelector(Bi(s)))&&!x._p&&(v.instance=x,v.state.loading=5),Ga.has(s)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Ga.set(s,n),x||O0(o,s,n,v.state))),t&&i===null)throw Error(c(528,""));return v}if(t&&i!==null)throw Error(c(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=$r(n),n=nr(o).hoistableScripts,i=n.get(t),i||(i={type:"script",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(c(444,s))}}function Ur(s){return'href="'+Ua(s)+'"'}function Bi(s){return'link[rel="stylesheet"]['+s+"]"}function ng(s){return j({},s,{"data-precedence":s.precedence,precedence:null})}function O0(s,t,n,i){s.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=s.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),Jt(t,"link",n),Ft(t),s.head.appendChild(t))}function $r(s){return'[src="'+Ua(s)+'"]'}function Ii(s){return"script[async]"+s}function rg(s,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var i=s.querySelector('style[data-href~="'+Ua(n.href)+'"]');if(i)return t.instance=i,Ft(i),i;var o=j({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(s.ownerDocument||s).createElement("style"),Ft(i),Jt(i,"style",o),bo(i,n.precedence,s),t.instance=i;case"stylesheet":o=Ur(n.href);var x=s.querySelector(Bi(o));if(x)return t.state.loading|=4,t.instance=x,Ft(x),x;i=ng(n),(o=Ga.get(o))&&vm(i,o),x=(s.ownerDocument||s).createElement("link"),Ft(x);var v=x;return v._p=new Promise(function(k,I){v.onload=k,v.onerror=I}),Jt(x,"link",i),t.state.loading|=4,bo(x,n.precedence,s),t.instance=x;case"script":return x=$r(n.src),(o=s.querySelector(Ii(x)))?(t.instance=o,Ft(o),o):(i=n,(o=Ga.get(x))&&(i=j({},n),Nm(i,o)),s=s.ownerDocument||s,o=s.createElement("script"),Ft(o),Jt(o,"link",i),s.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(c(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,bo(i,n.precedence,s));return t.instance}function bo(s,t,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=i.length?i[i.length-1]:null,x=o,v=0;v title"):null)}function L0(s,t,n){if(n===1||t.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return s=t.disabled,typeof t.precedence=="string"&&s==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function og(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function U0(s,t,n,i){if(n.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var o=Ur(i.href),x=t.querySelector(Bi(o));if(x){t=x._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(s.count++,s=wo.bind(s),t.then(s,s)),n.state.loading|=4,n.instance=x,Ft(x);return}x=t.ownerDocument||t,i=ng(i),(o=Ga.get(o))&&vm(i,o),x=x.createElement("link"),Ft(x);var v=x;v._p=new Promise(function(k,I){v.onload=k,v.onerror=I}),Jt(x,"link",i),n.instance=x}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(s.count++,n=wo.bind(s),t.addEventListener("load",n),t.addEventListener("error",n))}}var bm=0;function $0(s,t){return s.stylesheets&&s.count===0&&So(s,s.stylesheets),0bm?50:800)+t);return s.unsuspend=n,function(){s.unsuspend=null,clearTimeout(i),clearTimeout(o)}}:null}function wo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)So(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var _o=null;function So(s,t){s.stylesheets=null,s.unsuspend!==null&&(s.count++,_o=new Map,t.forEach(B0,s),_o=null,wo.call(s))}function B0(s,t){if(!(t.state.loading&4)){var n=_o.get(s);if(n)var i=n.get(null);else{n=new Map,_o.set(s,n);for(var o=s.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(l){console.error(l)}}return a(),zm.exports=E1(),zm.exports}var A1=M1();function F(...a){return nw(rw(a))}const ke=m.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:F("rounded-xl border bg-card text-card-foreground shadow",a),...l}));ke.displayName="Card";const Re=m.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:F("flex flex-col space-y-1.5 p-6",a),...l}));Re.displayName="CardHeader";const De=m.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:F("font-semibold leading-none tracking-tight",a),...l}));De.displayName="CardTitle";const is=m.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:F("text-sm text-muted-foreground",a),...l}));is.displayName="CardDescription";const Me=m.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:F("p-6 pt-0",a),...l}));Me.displayName="CardContent";const id=m.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:F("flex items-center p-6 pt-0",a),...l}));id.displayName="CardFooter";const ea=cw,Gt=m.forwardRef(({className:a,...l},r)=>e.jsx(cj,{ref:r,className:F("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",a),...l}));Gt.displayName=cj.displayName;const Xe=m.forwardRef(({className:a,...l},r)=>e.jsx(oj,{ref:r,className:F("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",a),...l}));Xe.displayName=oj.displayName;const vs=m.forwardRef(({className:a,...l},r)=>e.jsx(dj,{ref:r,className:F("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",a),...l}));vs.displayName=dj.displayName;const Ze=m.forwardRef(({className:a,children:l,viewportRef:r,...c},d)=>e.jsxs(uj,{ref:d,className:F("relative overflow-hidden",a),...c,children:[e.jsx(ow,{ref:r,className:"h-full w-full rounded-[inherit]",children:l}),e.jsx(Qm,{}),e.jsx(Qm,{orientation:"horizontal"}),e.jsx(dw,{})]}));Ze.displayName=uj.displayName;const Qm=m.forwardRef(({className:a,orientation:l="vertical",...r},c)=>e.jsx(mj,{ref:c,orientation:l,className:F("flex touch-none select-none transition-colors",l==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",l==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",a),...r,children:e.jsx(uw,{className:"relative flex-1 rounded-full bg-border"})}));Qm.displayName=mj.displayName;function ws({className:a,...l}){return e.jsx("div",{className:F("animate-pulse rounded-md bg-primary/10",a),...l})}const Xn=m.forwardRef(({className:a,value:l,...r},c)=>e.jsx(xj,{ref:c,className:F("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",a),...r,children:e.jsx(mw,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(l||0)}%)`}})}));Xn.displayName=xj.displayName;async function _e(a,l){const c=l?.body instanceof FormData?{...l?.headers}:{"Content-Type":"application/json",...l?.headers},d={...l,credentials:"include",headers:c},u=await fetch(a,d);if(u.status===401)throw window.location.href="/auth",new Error("认证失败,请重新登录");return u}function qs(){return{"Content-Type":"application/json"}}async function z1(){try{await fetch("/api/webui/auth/logout",{method:"POST",credentials:"include"})}catch(a){console.error("登出请求失败:",a)}window.location.href="/auth"}async function cc(){try{return(await(await fetch("/api/webui/auth/check",{method:"GET",credentials:"include"})).json()).authenticated===!0}catch{return!1}}const R1={light:"",dark:".dark"},_v=m.createContext(null);function Sv(){const a=m.useContext(_v);if(!a)throw new Error("useChart must be used within a ");return a}const Vr=m.forwardRef(({id:a,className:l,children:r,config:c,...d},u)=>{const h=m.useId(),f=`chart-${a||h.replace(/:/g,"")}`;return e.jsx(_v.Provider,{value:{config:c},children:e.jsxs("div",{"data-chart":f,ref:u,className:F("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",l),...d,children:[e.jsx(D1,{id:f,config:c}),e.jsx(Aj,{children:r})]})})});Vr.displayName="Chart";const D1=({id:a,config:l})=>{const r=Object.entries(l).filter(([,c])=>c.theme||c.color);return r.length?e.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(R1).map(([c,d])=>` -${d} [data-chart=${a}] { -${r.map(([u,h])=>{const f=h.theme?.[c]||h.color;return f?` --color-${u}: ${f};`:null}).join(` -`)} -} -`).join(` -`)}}):null},qi=zj,Gr=m.forwardRef(({active:a,payload:l,className:r,indicator:c="dot",hideLabel:d=!1,hideIndicator:u=!1,label:h,labelFormatter:f,labelClassName:p,formatter:g,color:b,nameKey:j,labelKey:y},N)=>{const{config:w}=Sv(),M=m.useMemo(()=>{if(d||!l?.length)return null;const[S]=l,U=`${y||S?.dataKey||S?.name||"value"}`,E=Ym(w,S,U),C=!y&&typeof h=="string"?w[h]?.label||h:E?.label;return f?e.jsx("div",{className:F("font-medium",p),children:f(C,l)}):C?e.jsx("div",{className:F("font-medium",p),children:C}):null},[h,f,l,d,p,w,y]);if(!a||!l?.length)return null;const A=l.length===1&&c!=="dot";return e.jsxs("div",{ref:N,className:F("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",r),children:[A?null:M,e.jsx("div",{className:"grid gap-1.5",children:l.filter(S=>S.type!=="none").map((S,U)=>{const E=`${j||S.name||S.dataKey||"value"}`,C=Ym(w,S,E),D=b||S.payload.fill||S.color;return e.jsx("div",{className:F("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",c==="dot"&&"items-center"),children:g&&S?.value!==void 0&&S.name?g(S.value,S.name,S,U,S.payload):e.jsxs(e.Fragment,{children:[C?.icon?e.jsx(C.icon,{}):!u&&e.jsx("div",{className:F("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":c==="dot","w-1":c==="line","w-0 border-[1.5px] border-dashed bg-transparent":c==="dashed","my-0.5":A&&c==="dashed"}),style:{"--color-bg":D,"--color-border":D}}),e.jsxs("div",{className:F("flex flex-1 justify-between leading-none",A?"items-end":"items-center"),children:[e.jsxs("div",{className:"grid gap-1.5",children:[A?M:null,e.jsx("span",{className:"text-muted-foreground",children:C?.label||S.name})]}),S.value&&e.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:S.value.toLocaleString()})]})]})},S.dataKey)})})]})});Gr.displayName="ChartTooltip";const O1=Vw,kv=m.forwardRef(({className:a,hideIcon:l=!1,payload:r,verticalAlign:c="bottom",nameKey:d},u)=>{const{config:h}=Sv();return r?.length?e.jsx("div",{ref:u,className:F("flex items-center justify-center gap-4",c==="top"?"pb-3":"pt-3",a),children:r.filter(f=>f.type!=="none").map(f=>{const p=`${d||f.dataKey||"value"}`,g=Ym(h,f,p);return e.jsxs("div",{className:F("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[g?.icon&&!l?e.jsx(g.icon,{}):e.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:f.color}}),g?.label]},f.value)})}):null});kv.displayName="ChartLegend";function Ym(a,l,r){if(typeof l!="object"||l===null)return;const c="payload"in l&&typeof l.payload=="object"&&l.payload!==null?l.payload:void 0;let d=r;return r in l&&typeof l[r]=="string"?d=l[r]:c&&r in c&&typeof c[r]=="string"&&(d=c[r]),d in a?a[d]:a[r]}const Zr=Wr("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),_=m.forwardRef(({className:a,variant:l,size:r,asChild:c=!1,...d},u)=>{const h=c?Jw:"button";return e.jsx(h,{className:F(Zr({variant:l,size:r,className:a})),ref:u,...d})});_.displayName="Button";const L1=Wr("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Ce({className:a,variant:l,...r}){return e.jsx("div",{className:F(L1({variant:l}),a),...r})}async function U1(){const a=await _e("/api/webui/system/restart",{method:"POST",headers:qs()});if(!a.ok){const l=await a.json();throw new Error(l.detail||"重启失败")}return await a.json()}async function $1(){const a=await _e("/api/webui/system/status",{method:"GET",headers:qs()});if(!a.ok){const l=await a.json();throw new Error(l.detail||"获取状态失败")}return await a.json()}const Ir={INITIAL_DELAY:3e3,CHECK_INTERVAL:2e3,CHECK_TIMEOUT:3e3,MAX_ATTEMPTS:60,PROGRESS_INTERVAL:200,SUCCESS_REDIRECT_DELAY:1500},Cv=m.createContext(null);function Wn({children:a,onRestartComplete:l,onRestartFailed:r,healthCheckUrl:c="/api/webui/system/status",maxAttempts:d=Ir.MAX_ATTEMPTS}){const[u,h]=m.useState({status:"idle",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:d}),f=m.useRef({}),p=m.useCallback(()=>{const M=f.current;M.progress&&(clearInterval(M.progress),M.progress=void 0),M.elapsed&&(clearInterval(M.elapsed),M.elapsed=void 0),M.check&&(clearTimeout(M.check),M.check=void 0)},[]),g=m.useCallback(()=>{p(),h({status:"idle",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:d})},[p,d]),b=m.useCallback(async()=>{try{const M=new AbortController,A=setTimeout(()=>M.abort(),Ir.CHECK_TIMEOUT),S=await fetch(c,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include",signal:M.signal});return clearTimeout(A),S.ok}catch{return!1}},[c]),j=m.useCallback(()=>{let M=0;const A=async()=>{if(M++,h(U=>({...U,status:"checking",checkAttempts:M})),await b())p(),h(U=>({...U,status:"success",progress:100})),setTimeout(()=>{l?.(),window.location.href="/auth"},Ir.SUCCESS_REDIRECT_DELAY);else if(M>=d){p();const U=`健康检查超时 (${M}/${d})`;h(E=>({...E,status:"failed",error:U})),r?.(U)}else{const U=setTimeout(A,Ir.CHECK_INTERVAL);f.current.check=U}};A()},[b,p,d,l,r]),y=m.useCallback(()=>{h(M=>({...M,status:"checking",checkAttempts:0,error:void 0})),j()},[j]),N=m.useCallback(async M=>{const{delay:A=0,skipApiCall:S=!1}=M??{};if(u.status!=="idle"&&u.status!=="failed")return;if(p(),h({status:"requesting",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:d}),A>0&&await new Promise(C=>setTimeout(C,A)),S)h(C=>({...C,status:"restarting"}));else try{h(C=>({...C,status:"restarting"})),await Promise.race([U1(),new Promise(C=>setTimeout(C,5e3))])}catch{}const U=setInterval(()=>{h(C=>({...C,progress:C.progress>=90?C.progress:C.progress+1}))},Ir.PROGRESS_INTERVAL),E=setInterval(()=>{h(C=>({...C,elapsedTime:C.elapsedTime+1}))},1e3);f.current.progress=U,f.current.elapsed=E,setTimeout(()=>{j()},Ir.INITIAL_DELAY)},[u.status,p,d,j]),w={state:u,isRestarting:u.status!=="idle",triggerRestart:N,resetState:g,retryHealthCheck:y};return e.jsx(Cv.Provider,{value:w,children:a})}function yn(){const a=m.useContext(Cv);if(!a)throw new Error("useRestart must be used within a RestartProvider");return a}function B1(){try{return yn()}catch{return null}}const I1=(a,l,r,c,d)=>({idle:{icon:null,title:"",description:"",tip:""},requesting:{icon:e.jsx(Os,{className:"h-16 w-16 text-primary animate-spin"}),title:c??"准备重启",description:d??"正在发送重启请求...",tip:"🔄 正在准备重启麦麦..."},restarting:{icon:e.jsx(Os,{className:"h-16 w-16 text-primary animate-spin"}),title:c??"正在重启麦麦",description:d??"请稍候,麦麦正在重启中...",tip:"🔄 配置已保存,正在重启主程序..."},checking:{icon:e.jsx(Os,{className:"h-16 w-16 text-primary animate-spin"}),title:"检查服务状态",description:`等待服务恢复... (${l}/${r})`,tip:"⏳ 正在等待服务恢复,请勿关闭页面..."},success:{icon:e.jsx(bt,{className:"h-16 w-16 text-green-500"}),title:"重启成功",description:"正在跳转到登录页面...",tip:"✅ 配置已生效,服务运行正常"},failed:{icon:e.jsx(Ct,{className:"h-16 w-16 text-destructive"}),title:"重启超时",description:"服务未能在预期时间内恢复",tip:"⚠️ 如果长时间无响应,请尝试手动重启"}})[a];function er({visible:a,onComplete:l,onFailed:r,title:c,description:d,showAnimation:u=!0,className:h}){const f=B1();return(f?f.isRestarting:a)?f?e.jsx(Tv,{state:f.state,onRetry:f.retryHealthCheck,onComplete:l,onFailed:r,title:c,description:d,showAnimation:u,className:h}):e.jsx(P1,{onComplete:l,onFailed:r,title:c,description:d,showAnimation:u,className:h}):null}function Tv({state:a,onRetry:l,onComplete:r,onFailed:c,title:d,description:u,showAnimation:h,className:f}){const{status:p,progress:g,elapsedTime:b,checkAttempts:j,maxAttempts:y}=a;m.useEffect(()=>{p==="success"&&r?r():p==="failed"&&c&&c()},[p,r,c]);const N=I1(p,j,y,d,u),w=M=>{const A=Math.floor(M/60),S=M%60;return`${A}:${S.toString().padStart(2,"0")}`};return e.jsxs("div",{className:F("fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",f),children:[h&&e.jsx(F1,{}),e.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8 relative z-10",children:[e.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[e.jsxs("div",{className:"relative",children:[N.icon,(p==="restarting"||p==="checking")&&e.jsx("div",{className:"absolute inset-0 rounded-full bg-primary/20 animate-ping"})]}),e.jsx("h2",{className:"text-2xl font-bold",children:N.title}),e.jsx("p",{className:"text-muted-foreground text-center",children:N.description})]}),p!=="failed"&&p!=="idle"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(Xn,{value:g,className:"h-2"}),e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{children:[g,"%"]}),e.jsxs("span",{children:["已用时: ",w(b)]})]})]}),e.jsx("div",{className:"bg-muted/50 rounded-lg p-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:N.tip})}),p==="failed"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(_,{onClick:()=>window.location.reload(),variant:"default",className:"flex-1",children:[e.jsx(xt,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),e.jsxs(_,{onClick:l,variant:"secondary",className:"flex-1",children:[e.jsx(lc,{className:"mr-2 h-4 w-4"}),"重试检测"]})]})]})]})}function P1({onComplete:a,onFailed:l,title:r,description:c,showAnimation:d,className:u}){const[h,f]=m.useState({status:"restarting",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:60}),p=m.useCallback(()=>{let g=0;const b=60,j=async()=>{g++,f(y=>({...y,status:"checking",checkAttempts:g}));try{if((await fetch("/api/webui/system/status",{method:"GET",signal:AbortSignal.timeout(3e3)})).ok){f(N=>({...N,status:"success",progress:100})),setTimeout(()=>{a?.(),window.location.href="/auth"},1500);return}}catch{}g>=b?(f(y=>({...y,status:"failed"})),l?.()):setTimeout(j,2e3)};j()},[a,l]);return m.useEffect(()=>{const g=setInterval(()=>{f(y=>({...y,progress:y.progress>=90?y.progress:y.progress+1}))},200),b=setInterval(()=>{f(y=>({...y,elapsedTime:y.elapsedTime+1}))},1e3),j=setTimeout(()=>{p()},3e3);return()=>{clearInterval(g),clearInterval(b),clearTimeout(j)}},[p]),e.jsx(Tv,{state:h,onRetry:p,onComplete:a,onFailed:l,title:r,description:c,showAnimation:d,className:u})}function F1(){return e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsxs("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[600px] h-[600px]",children:[e.jsx("div",{className:"absolute inset-0 rounded-full border border-primary/10 animate-[ping_3s_ease-in-out_infinite]"}),e.jsx("div",{className:"absolute inset-8 rounded-full border border-primary/10 animate-[ping_3s_ease-in-out_infinite_0.5s]"}),e.jsx("div",{className:"absolute inset-16 rounded-full border border-primary/10 animate-[ping_3s_ease-in-out_infinite_1s]"})]}),e.jsx("div",{className:"absolute top-1/4 left-1/4 w-2 h-2 bg-primary/20 rounded-full animate-bounce"}),e.jsx("div",{className:"absolute top-3/4 right-1/4 w-3 h-3 bg-primary/15 rounded-full animate-bounce delay-150"}),e.jsx("div",{className:"absolute top-1/2 right-1/3 w-2 h-2 bg-primary/20 rounded-full animate-bounce delay-300"})]})}const Fs=Ww,cd=e_,H1=Xw,Ev=m.forwardRef(({className:a,...l},r)=>e.jsx(Rj,{ref:r,className:F("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...l}));Ev.displayName=Rj.displayName;const Us=m.forwardRef(({className:a,children:l,preventOutsideClose:r=!1,...c},d)=>e.jsxs(H1,{children:[e.jsx(Ev,{}),e.jsxs(Dj,{ref:d,className:F("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),onPointerDownOutside:r?u=>u.preventDefault():void 0,onInteractOutside:r?u=>u.preventDefault():void 0,...c,children:[l,e.jsxs(Zw,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(Aa,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Us.displayName=Dj.displayName;const $s=({className:a,...l})=>e.jsx("div",{className:F("flex flex-col space-y-1.5 text-center sm:text-left",a),...l});$s.displayName="DialogHeader";const nt=({className:a,...l})=>e.jsx("div",{className:F("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...l});nt.displayName="DialogFooter";const Bs=m.forwardRef(({className:a,...l},r)=>e.jsx(Oj,{ref:r,className:F("text-lg font-semibold leading-none tracking-tight",a),...l}));Bs.displayName=Oj.displayName;const Xs=m.forwardRef(({className:a,...l},r)=>e.jsx(Lj,{ref:r,className:F("text-sm text-muted-foreground",a),...l}));Xs.displayName=Lj.displayName;const ae=m.forwardRef(({className:a,type:l,...r},c)=>e.jsx("input",{type:l,className:F("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",a),ref:c,...r}));ae.displayName="Input";const Js=m.forwardRef(({className:a,...l},r)=>e.jsx(Uj,{ref:r,className:F("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",a),...l,children:e.jsx(s_,{className:F("grid place-content-center text-current"),children:e.jsx(Mt,{className:"h-4 w-4"})})}));Js.displayName=Uj.displayName;const Pe=i_,Fe=c_,Be=m.forwardRef(({className:a,children:l,...r},c)=>e.jsxs($j,{ref:c,className:F("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",a),...r,children:[l,e.jsx(t_,{asChild:!0,children:e.jsx(za,{className:"h-4 w-4 opacity-50"})})]}));Be.displayName=$j.displayName;const Mv=m.forwardRef(({className:a,...l},r)=>e.jsx(Bj,{ref:r,className:F("flex cursor-default items-center justify-center py-1",a),...l,children:e.jsx(Qr,{className:"h-4 w-4"})}));Mv.displayName=Bj.displayName;const Av=m.forwardRef(({className:a,...l},r)=>e.jsx(Ij,{ref:r,className:F("flex cursor-default items-center justify-center py-1",a),...l,children:e.jsx(za,{className:"h-4 w-4"})}));Av.displayName=Ij.displayName;const Ie=m.forwardRef(({className:a,children:l,position:r="popper",...c},d)=>e.jsx(a_,{children:e.jsxs(Pj,{ref:d,className:F("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:r,...c,children:[e.jsx(Mv,{}),e.jsx(l_,{className:F("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:l}),e.jsx(Av,{})]})}));Ie.displayName=Pj.displayName;const V1=m.forwardRef(({className:a,...l},r)=>e.jsx(Fj,{ref:r,className:F("px-2 py-1.5 text-sm font-semibold",a),...l}));V1.displayName=Fj.displayName;const W=m.forwardRef(({className:a,children:l,...r},c)=>e.jsxs(Hj,{ref:c,className:F("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...r,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(n_,{children:e.jsx(Mt,{className:"h-4 w-4"})})}),e.jsx(r_,{children:l})]}));W.displayName=Hj.displayName;const G1=m.forwardRef(({className:a,...l},r)=>e.jsx(Vj,{ref:r,className:F("-mx-1 my-1 h-px bg-muted",a),...l}));G1.displayName=Vj.displayName;const dx=({className:a,...l})=>e.jsx("nav",{role:"navigation","aria-label":"pagination",className:F("mx-auto flex w-full justify-center",a),...l});dx.displayName="Pagination";const ux=m.forwardRef(({className:a,...l},r)=>e.jsx("ul",{ref:r,className:F("flex flex-row items-center gap-1",a),...l}));ux.displayName="PaginationContent";const qn=m.forwardRef(({className:a,...l},r)=>e.jsx("li",{ref:r,className:F("",a),...l}));qn.displayName="PaginationItem";const pc=({className:a,isActive:l,size:r="icon",...c})=>e.jsx("a",{"aria-current":l?"page":void 0,className:F(Zr({variant:l?"outline":"ghost",size:r}),a),...c});pc.displayName="PaginationLink";const zv=({className:a,...l})=>e.jsxs(pc,{"aria-label":"Go to previous page",size:"default",className:F("gap-1 pl-2.5",a),...l,children:[e.jsx(Da,{className:"h-4 w-4"}),e.jsx("span",{children:"上一页"})]});zv.displayName="PaginationPrevious";const Rv=({className:a,...l})=>e.jsxs(pc,{"aria-label":"Go to next page",size:"default",className:F("gap-1 pr-2.5",a),...l,children:[e.jsx("span",{children:"下一页"}),e.jsx(sa,{className:"h-4 w-4"})]});Rv.displayName="PaginationNext";const Dv=({className:a,...l})=>e.jsxs("span",{"aria-hidden":!0,className:F("flex h-9 w-9 items-center justify-center",a),...l,children:[e.jsx(v_,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"More pages"})]});Dv.displayName="PaginationEllipsis";const q1=5,K1=5e3;let Om=0;function Q1(){return Om=(Om+1)%Number.MAX_SAFE_INTEGER,Om.toString()}const Lm=new Map,Ag=a=>{if(Lm.has(a))return;const l=setTimeout(()=>{Lm.delete(a),sc({type:"REMOVE_TOAST",toastId:a})},K1);Lm.set(a,l)},Y1=(a,l)=>{switch(l.type){case"ADD_TOAST":return{...a,toasts:[l.toast,...a.toasts].slice(0,q1)};case"UPDATE_TOAST":return{...a,toasts:a.toasts.map(r=>r.id===l.toast.id?{...r,...l.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=l;return r?Ag(r):a.toasts.forEach(c=>{Ag(c.id)}),{...a,toasts:a.toasts.map(c=>c.id===r||r===void 0?{...c,open:!1}:c)}}case"REMOVE_TOAST":return l.toastId===void 0?{...a,toasts:[]}:{...a,toasts:a.toasts.filter(r=>r.id!==l.toastId)}}},Io=[];let Po={toasts:[]};function sc(a){Po=Y1(Po,a),Io.forEach(l=>{l(Po)})}function Xt({...a}){const l=Q1(),r=d=>sc({type:"UPDATE_TOAST",toast:{...d,id:l}}),c=()=>sc({type:"DISMISS_TOAST",toastId:l});return sc({type:"ADD_TOAST",toast:{...a,id:l,open:!0,onOpenChange:d=>{d||c()}}}),{id:l,dismiss:c,update:r}}function Ws(){const[a,l]=m.useState(Po);return m.useEffect(()=>(Io.push(l),()=>{const r=Io.indexOf(l);r>-1&&Io.splice(r,1)}),[a]),{...a,toast:Xt,dismiss:r=>sc({type:"DISMISS_TOAST",toastId:r})}}const tl="/api/webui/expression";async function mx(){const a=await _e(`${tl}/chats`,{});if(!a.ok){const l=await a.json();throw new Error(l.detail||"获取聊天列表失败")}return a.json()}async function J1(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.search&&l.append("search",a.search),a.chat_id&&l.append("chat_id",a.chat_id);const r=await _e(`${tl}/list?${l}`,{});if(!r.ok){const c=await r.json();throw new Error(c.detail||"获取表达方式列表失败")}return r.json()}async function X1(a){const l=await _e(`${tl}/${a}`,{});if(!l.ok){const r=await l.json();throw new Error(r.detail||"获取表达方式详情失败")}return l.json()}async function Z1(a){const l=await _e(`${tl}/`,{method:"POST",body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"创建表达方式失败")}return l.json()}async function W1(a,l){const r=await _e(`${tl}/${a}`,{method:"PATCH",body:JSON.stringify(l)});if(!r.ok){const c=await r.json();throw new Error(c.detail||"更新表达方式失败")}return r.json()}async function e2(a){const l=await _e(`${tl}/${a}`,{method:"DELETE"});if(!l.ok){const r=await l.json();throw new Error(r.detail||"删除表达方式失败")}return l.json()}async function s2(a){const l=await _e(`${tl}/batch/delete`,{method:"POST",body:JSON.stringify({ids:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"批量删除表达方式失败")}return l.json()}async function t2(){const a=await _e(`${tl}/stats/summary`,{});if(!a.ok){const l=await a.json();throw new Error(l.detail||"获取统计数据失败")}return a.json()}async function xx(){const a=await _e(`${tl}/review/stats`);if(!a.ok){const l=await a.json();throw new Error(l.detail||"获取审核统计失败")}return a.json()}async function a2(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.filter_type&&l.append("filter_type",a.filter_type),a.search&&l.append("search",a.search),a.chat_id&&l.append("chat_id",a.chat_id);const r=await _e(`${tl}/review/list?${l}`);if(!r.ok){const c=await r.json();throw new Error(c.detail||"获取审核列表失败")}return r.json()}async function zg(a){const l=await _e(`${tl}/review/batch`,{method:"POST",body:JSON.stringify({items:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"批量审核失败")}return l.json()}function Ov({open:a,onOpenChange:l}){const[r,c]=m.useState(null),[d,u]=m.useState([]),[h,f]=m.useState(!1),[p,g]=m.useState(!1),[b,j]=m.useState(0),[y,N]=m.useState(1),[w,M]=m.useState(20),[A,S]=m.useState(""),[U,E]=m.useState("unchecked"),[C,D]=m.useState(""),[P,O]=m.useState(""),[J,L]=m.useState(new Set),[oe,Ne]=m.useState(new Set),[je,de]=m.useState(new Map),{toast:he}=Ws(),ge=m.useCallback(async()=>{try{g(!0);const Y=await xx();c(Y)}catch(Y){console.error("加载统计失败:",Y)}finally{g(!1)}},[]),R=m.useCallback(async()=>{try{f(!0);const Y=await a2({page:y,page_size:w,filter_type:U,search:C||void 0});u(Y.data),j(Y.total)}catch(Y){he({title:"加载失败",description:Y instanceof Error?Y.message:"无法加载列表",variant:"destructive"})}finally{f(!1)}},[y,w,U,C,he]),Q=m.useCallback(async()=>{try{const Y=await mx();if(Y?.data){const $e=new Map;Y.data.forEach(H=>{$e.set(H.chat_id,H.chat_name)}),de($e)}}catch(Y){console.error("加载聊天名称失败:",Y)}},[]);m.useEffect(()=>{a&&(ge(),R(),Q())},[a,ge,R,Q]),m.useEffect(()=>{N(1),L(new Set)},[U,C]);const $=()=>{D(P),N(1)},ue=Y=>je.get(Y)||Y,G=async(Y,$e)=>{try{Ne(se=>new Set(se).add(Y));const H=await zg([{id:Y,rejected:$e,require_unchecked:U==="unchecked"}]);H.results[0]?.success?(he({title:$e?"已拒绝":"已通过",description:`表达方式 #${Y} ${$e?"已拒绝":"已通过"}`}),R(),ge()):he({title:"操作失败",description:H.results[0]?.message||"未知错误",variant:"destructive"})}catch(H){he({title:"操作失败",description:H instanceof Error?H.message:"未知错误",variant:"destructive"})}finally{Ne(H=>{const se=new Set(H);return se.delete(Y),se})}},Se=async Y=>{if(J.size===0){he({title:"请选择",description:"请先选择要审核的表达方式",variant:"destructive"});return}try{f(!0);const $e=Array.from(J).map(se=>({id:se,rejected:Y,require_unchecked:U==="unchecked"})),H=await zg($e);he({title:"批量审核完成",description:`成功 ${H.succeeded} 条,失败 ${H.failed} 条`,variant:H.failed>0?"destructive":"default"}),L(new Set),R(),ge()}catch($e){he({title:"批量审核失败",description:$e instanceof Error?$e.message:"未知错误",variant:"destructive"})}finally{f(!1)}},fe=()=>{J.size===d.length?L(new Set):L(new Set(d.map(Y=>Y.id)))},Te=Y=>{L($e=>{const H=new Set($e);return H.has(Y)?H.delete(Y):H.add(Y),H})},q=Y=>Y?new Date(Y*1e3).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"-",B=Y=>Y.checked?Y.rejected?e.jsxs(Ce,{variant:"destructive",className:"gap-1",children:[e.jsx(Ka,{className:"h-3 w-3"}),"已拒绝"]}):e.jsxs(Ce,{variant:"default",className:"gap-1 bg-green-600",children:[e.jsx(bt,{className:"h-3 w-3"}),"已通过"]}):e.jsxs(Ce,{variant:"outline",className:"gap-1",children:[e.jsx(na,{className:"h-3 w-3"}),"待审核"]}),z=Y=>Y?Y==="ai"?e.jsxs(Ce,{variant:"secondary",className:"gap-1 text-xs",children:[e.jsx(Vn,{className:"h-3 w-3"}),"AI"]}):e.jsxs(Ce,{variant:"secondary",className:"gap-1 text-xs",children:[e.jsx(jn,{className:"h-3 w-3"}),"人工"]}):null,K=Math.ceil(b/w),Ae=()=>{const Y=[];if(K<=7)for(let $e=1;$e<=K;$e++)Y.push($e);else{Y.push(1),y>3&&Y.push("ellipsis");const $e=Math.max(2,y-1),H=Math.min(K-1,y+1);for(let se=$e;se<=H;se++)Y.push(se);y1&&Y.push(K)}return Y},ee=()=>{const Y=parseInt(A,10);!isNaN(Y)&&Y>=1&&Y<=K&&(N(Y),S(""))};return e.jsx(Fs,{open:a,onOpenChange:l,children:e.jsxs(Us,{className:"max-w-5xl w-[95vw] sm:w-full h-[90vh] sm:h-[85vh] flex flex-col p-0",children:[e.jsxs($s,{className:"px-4 sm:px-6 pt-4 sm:pt-6 pb-4 border-b shrink-0",children:[e.jsx(Bs,{className:"text-lg sm:text-xl",children:"表达方式审核"}),e.jsx(Xs,{className:"text-xs sm:text-sm",children:"审核麦麦学习到的表达方式。通过审核的项目才会被使用(可在配置中调整),被拒绝的项目永远不会被使用。"}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 sm:gap-3 mt-4",children:[e.jsxs("div",{className:"rounded-lg border p-2 sm:p-3 text-center",children:[e.jsx("div",{className:"text-xl sm:text-2xl font-bold text-orange-500",children:p?"-":r?.unchecked??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"待审核"})]}),e.jsxs("div",{className:"rounded-lg border p-2 sm:p-3 text-center",children:[e.jsx("div",{className:"text-xl sm:text-2xl font-bold text-green-500",children:p?"-":r?.passed??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"已通过"})]}),e.jsxs("div",{className:"rounded-lg border p-2 sm:p-3 text-center",children:[e.jsx("div",{className:"text-xl sm:text-2xl font-bold text-red-500",children:p?"-":r?.rejected??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"已拒绝"})]}),e.jsxs("div",{className:"rounded-lg border p-2 sm:p-3 text-center",children:[e.jsx("div",{className:"text-xl sm:text-2xl font-bold text-blue-500",children:p?"-":r?.total??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"总计"})]})]})]}),e.jsxs("div",{className:"px-4 sm:px-6 py-3 border-b shrink-0 space-y-3",children:[e.jsx(ea,{value:U,onValueChange:Y=>E(Y),className:"w-full",children:e.jsxs(Gt,{className:"grid w-full grid-cols-4",children:[e.jsxs(Xe,{value:"unchecked",className:"gap-1 text-xs sm:text-sm px-1 sm:px-3",children:[e.jsx(na,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"待审核"}),e.jsx("span",{className:"sm:hidden",children:"待审"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",r?.unchecked??0,")"]})]}),e.jsxs(Xe,{value:"passed",className:"gap-1 text-xs sm:text-sm px-1 sm:px-3",children:[e.jsx(bt,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"已通过"}),e.jsx("span",{className:"sm:hidden",children:"通过"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",r?.passed??0,")"]})]}),e.jsxs(Xe,{value:"rejected",className:"gap-1 text-xs sm:text-sm px-1 sm:px-3",children:[e.jsx(Ka,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"已拒绝"}),e.jsx("span",{className:"sm:hidden",children:"拒绝"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",r?.rejected??0,")"]})]}),e.jsxs(Xe,{value:"all",className:"gap-1 text-xs sm:text-sm px-1 sm:px-3",children:[e.jsx("span",{children:"全部"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",r?.total??0,")"]})]})]})}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(At,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ae,{placeholder:"搜索情景或风格...",value:P,onChange:Y=>O(Y.target.value),onKeyDown:Y=>Y.key==="Enter"&&$(),className:"pl-9"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"icon",onClick:$,children:e.jsx(At,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"icon",onClick:()=>{R(),ge()},disabled:h,children:e.jsx(xt,{className:F("h-4 w-4",h&&"animate-spin")})})]}),U==="unchecked"&&J.size>0&&e.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:[e.jsxs(_,{variant:"default",size:"sm",className:"bg-green-600 hover:bg-green-700 flex-1 sm:flex-none",onClick:()=>Se(!1),disabled:h,children:[e.jsx(bt,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"批量通过"}),e.jsx("span",{className:"sm:hidden",children:"通过"}),"(",J.size,")"]}),e.jsxs(_,{variant:"destructive",size:"sm",className:"flex-1 sm:flex-none",onClick:()=>Se(!0),disabled:h,children:[e.jsx(Ka,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"批量拒绝"}),e.jsx("span",{className:"sm:hidden",children:"拒绝"}),"(",J.size,")"]})]})]})]}),e.jsx(Ze,{className:"flex-1 px-4 sm:px-6",children:h&&d.length===0?e.jsx("div",{className:"flex items-center justify-center h-40",children:e.jsx(xt,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):d.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-40 text-muted-foreground",children:[e.jsx(Ct,{className:"h-8 w-8 mb-2"}),e.jsx("p",{children:"没有找到表达方式"})]}):e.jsxs("div",{className:"space-y-2 py-2",children:[U==="unchecked"&&d.length>0&&e.jsxs("div",{className:"flex items-center gap-2 py-2 px-3 rounded-lg bg-muted/50",children:[e.jsx(Js,{checked:J.size===d.length&&d.length>0,onCheckedChange:fe}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["全选当前页 (",d.length," 条)"]})]}),d.map(Y=>e.jsx("div",{className:F("rounded-lg border p-3 sm:p-4 space-y-2 sm:space-y-3 transition-colors",J.has(Y.id)&&"bg-accent border-primary",oe.has(Y.id)&&"opacity-50"),children:e.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[U==="unchecked"&&e.jsx(Js,{checked:J.has(Y.id),onCheckedChange:()=>Te(Y.id),disabled:oe.has(Y.id),className:"mt-1"}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"情景:"}),e.jsx("p",{className:"text-sm font-medium break-words",children:Y.situation})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"风格:"}),e.jsx("p",{className:"text-sm text-muted-foreground break-words",children:Y.style})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:gap-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:["#",Y.id]}),e.jsx("span",{children:"·"}),e.jsx("span",{title:ue(Y.chat_id),className:"truncate max-w-24 sm:max-w-32",children:ue(Y.chat_id)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:q(Y.create_date)}),e.jsxs("div",{className:"flex items-center gap-1",children:[B(Y),z(Y.modified_by)]})]})]}),e.jsx("div",{className:"flex flex-col gap-1 sm:gap-2 shrink-0",children:U==="unchecked"?e.jsxs(e.Fragment,{children:[e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>G(Y.id,!1),disabled:oe.has(Y.id),children:[e.jsx(bt,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"通过"})]}),e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>G(Y.id,!0),disabled:oe.has(Y.id),children:[e.jsx(Ka,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"拒绝"})]})]}):U==="passed"?e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>G(Y.id,!0),disabled:oe.has(Y.id),children:[e.jsx(Ka,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"改为拒绝"})]}):U==="rejected"?e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>G(Y.id,!1),disabled:oe.has(Y.id),children:[e.jsx(bt,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"改为通过"})]}):e.jsx(e.Fragment,{children:Y.rejected?e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>G(Y.id,!1),disabled:oe.has(Y.id),children:[e.jsx(bt,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"改为通过"})]}):Y.checked?e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>G(Y.id,!0),disabled:oe.has(Y.id),children:[e.jsx(Ka,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"改为拒绝"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>G(Y.id,!1),disabled:oe.has(Y.id),children:[e.jsx(bt,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"通过"})]}),e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>G(Y.id,!0),disabled:oe.has(Y.id),children:[e.jsx(Ka,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"拒绝"})]})]})})})]})},Y.id))]})}),e.jsxs("div",{className:"px-4 sm:px-6 py-3 border-t shrink-0 flex flex-col sm:flex-row items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx("span",{className:"hidden sm:inline",children:"每页"}),e.jsxs(Pe,{value:w.toString(),onValueChange:Y=>{M(parseInt(Y,10)),N(1)},children:[e.jsx(Be,{className:"w-[70px] h-8",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"10",children:"10"}),e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"50",children:"50"}),e.jsx(W,{value:"100",children:"100"})]})]}),e.jsx("span",{className:"hidden sm:inline",children:"条"}),e.jsxs("span",{className:"text-muted-foreground",children:["共 ",b," 条"]})]}),e.jsx(dx,{className:"mx-0 w-auto",children:e.jsxs(ux,{children:[e.jsx(qn,{children:e.jsx(_,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>N(Y=>Math.max(1,Y-1)),disabled:y<=1||h,children:e.jsx(Da,{className:"h-4 w-4"})})}),Ae().map((Y,$e)=>e.jsx(qn,{children:Y==="ellipsis"?e.jsx(Dv,{}):e.jsx(pc,{href:"#",isActive:Y===y,onClick:H=>{H.preventDefault(),N(Y)},className:"h-8 w-8 cursor-pointer",children:Y})},$e)),e.jsx(qn,{children:e.jsx(_,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>N(Y=>Math.min(K,Y+1)),disabled:y>=K||h,children:e.jsx(sa,{className:"h-4 w-4"})})})]})}),e.jsxs("div",{className:"hidden sm:flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"跳至"}),e.jsx(ae,{type:"number",min:1,max:K,value:A,onChange:Y=>S(Y.target.value),onKeyDown:Y=>Y.key==="Enter"&&ee(),className:"w-16 h-8 text-center",placeholder:y.toString()}),e.jsx("span",{className:"text-muted-foreground",children:"页"}),e.jsx(_,{variant:"outline",size:"sm",className:"h-8",onClick:ee,disabled:h,children:"跳转"})]})]})]})})}function l2(){return e.jsx(Wn,{children:e.jsx(r2,{})})}const n2=a=>{const l=[];for(let r=0;r(P.current=!0,()=>{P.current=!1,O.current&&(clearInterval(O.current),O.current=null)}),[]);const J=m.useCallback(async()=>{try{const z=await xx();P.current&&E(z.unchecked)}catch(z){console.error("获取审核统计失败:",z)}},[]),L=m.useCallback(async()=>{try{N(!0);const z=await iw.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");P.current&&j({hitokoto:z.data.hitokoto,from:z.data.from||z.data.from_who||"未知"})}catch(z){console.error("获取一言失败:",z),P.current&&j({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{P.current&&N(!1)}},[]),oe=m.useCallback(async()=>{try{const z=await _e("/api/webui/system/status");if(!P.current)return;if(z.ok){const K=await z.json();M(K)}else M(null)}catch(z){console.error("获取机器人状态失败:",z),P.current&&M(null)}},[]),Ne=async()=>{await C()},je=m.useCallback(async()=>{try{const z=await _e(`/api/webui/statistics/dashboard?hours=${h}`);if(!P.current)return;if(z.ok){const K=await z.json();l(K)}c(!1),u(100)}catch(z){console.error("Failed to fetch dashboard data:",z),P.current&&(c(!1),u(100))}},[h]);if(m.useEffect(()=>{if(!r)return;u(0);const z=setTimeout(()=>u(15),200),K=setTimeout(()=>u(30),800),Ae=setTimeout(()=>u(45),2e3),ee=setTimeout(()=>u(60),4e3),Y=setTimeout(()=>u(75),6500),$e=setTimeout(()=>u(85),9e3),H=setTimeout(()=>u(92),11e3);return()=>{clearTimeout(z),clearTimeout(K),clearTimeout(Ae),clearTimeout(ee),clearTimeout(Y),clearTimeout($e),clearTimeout(H)}},[r]),m.useEffect(()=>{je(),L(),oe(),J()},[je,L,oe,J]),m.useEffect(()=>{if(O.current&&(clearInterval(O.current),O.current=null),!!p)return O.current=setInterval(()=>{P.current&&(je(),oe())},3e4),()=>{O.current&&(clearInterval(O.current),O.current=null)}},[p,je,oe]),r||!a)return e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:e.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[e.jsx(xt,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Xn,{value:d,className:"h-2"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[d,"%"]})]})]})});const{summary:de,model_stats:he=[],hourly_data:ge=[],daily_data:R=[],recent_activity:Q=[]}=a,$=de??{total_requests:0,total_cost:0,total_tokens:0,online_time:0,total_messages:0,total_replies:0,avg_response_time:0,cost_per_hour:0,tokens_per_hour:0},ue=z=>{const K=Math.floor(z/3600),Ae=Math.floor(z%3600/60);return`${K}小时${Ae}分钟`},G=z=>{const K=z.toLocaleString("zh-CN");return z>=1e9?{display:`${(z/1e9).toFixed(2)}B`,exact:K,needsExact:!0}:z>=1e6?{display:`${(z/1e6).toFixed(2)}M`,exact:K,needsExact:!0}:z>=1e4?{display:`${(z/1e3).toFixed(1)}K`,exact:K,needsExact:!0}:z>=1e3?{display:`${(z/1e3).toFixed(2)}K`,exact:K,needsExact:!0}:{display:K,exact:K,needsExact:!1}},Se=z=>{const K=`¥${z.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})}`;return z>=1e6?{display:`¥${(z/1e6).toFixed(2)}M`,exact:K,needsExact:!0}:z>=1e4?{display:`¥${(z/1e3).toFixed(1)}K`,exact:K,needsExact:!0}:z>=1e3?{display:`¥${(z/1e3).toFixed(2)}K`,exact:K,needsExact:!0}:{display:K,exact:K,needsExact:!1}},fe=z=>new Date(z).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),Te=n2(he.length),q=he.map((z,K)=>({name:z.model_name,value:z.request_count,fill:Te[K]})),B={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(ea,{value:h.toString(),onValueChange:z=>f(Number(z)),children:e.jsxs(Gt,{className:"grid grid-cols-3 w-full sm:w-auto",children:[e.jsx(Xe,{value:"24",children:"24小时"}),e.jsx(Xe,{value:"168",children:"7天"}),e.jsx(Xe,{value:"720",children:"30天"})]})}),e.jsxs(_,{variant:p?"default":"outline",size:"sm",onClick:()=>g(!p),className:"gap-2",children:[e.jsx(xt,{className:`h-4 w-4 ${p?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:je,children:e.jsx(xt,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 rounded-lg border border-dashed border-muted-foreground/30 bg-muted/20",children:[y?e.jsx(ws,{className:"h-5 flex-1"}):b?e.jsxs("p",{className:"flex-1 text-sm text-muted-foreground italic truncate",children:['"',b.hitokoto,'" —— ',b.from]}):null,e.jsx(_,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:L,disabled:y,children:e.jsx(xt,{className:`h-3.5 w-3.5 ${y?"animate-spin":""}`})})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-3",children:[e.jsxs(ke,{className:"lg:col-span-1",children:[e.jsx(Re,{className:"pb-3",children:e.jsxs(De,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(hc,{className:"h-4 w-4"}),"麦麦状态"]})}),e.jsx(Me,{children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex items-center gap-2",children:w?.running?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-green-500 animate-pulse"}),e.jsxs(Ce,{variant:"outline",className:"text-green-600 border-green-300 bg-green-50",children:[e.jsx(bt,{className:"h-3 w-3 mr-1"}),"运行中"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-red-500"}),e.jsxs(Ce,{variant:"outline",className:"text-red-600 border-red-300 bg-red-50",children:[e.jsx(Ct,{className:"h-3 w-3 mr-1"}),"已停止"]})]})}),w&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.jsxs("span",{children:["v",w.version]}),e.jsx("span",{className:"mx-2",children:"|"}),e.jsxs("span",{children:["运行 ",ue(w.uptime)]})]})]})})]}),e.jsxs(ke,{children:[e.jsx(Re,{className:"pb-3",children:e.jsxs(De,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(el,{className:"h-4 w-4"}),"快速操作"]})}),e.jsx(Me,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:Ne,disabled:D,className:"gap-2",children:[e.jsx(lc,{className:`h-4 w-4 ${D?"animate-spin":""}`}),D?"重启中...":"重启麦麦"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>S(!0),className:"gap-2",children:[e.jsx(ev,{className:"h-4 w-4"}),"表达审核",U>0&&e.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-xs rounded-full bg-orange-500 text-white",children:U>99?"99+":U})]}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Fn,{to:"/logs",children:[e.jsx(Ea,{className:"h-4 w-4"}),"查看日志"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Fn,{to:"/plugins",children:[e.jsx(N_,{className:"h-4 w-4"}),"插件管理"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Fn,{to:"/settings",children:[e.jsx(vn,{className:"h-4 w-4"}),"系统设置"]})})]})})]}),e.jsxs(ke,{children:[e.jsxs(Re,{className:"pb-3",children:[e.jsxs(De,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(b_,{className:"h-4 w-4"}),"反馈问卷"]}),e.jsx(is,{className:"text-xs",children:"帮助我们改进产品体验"})]}),e.jsx(Me,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Fn,{to:"/survey/webui-feedback",children:[e.jsx(Ea,{className:"h-4 w-4"}),"WebUI 反馈"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Fn,{to:"/survey/maibot-feedback",children:[e.jsx(Ra,{className:"h-4 w-4"}),"麦麦反馈"]})})]})})]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[e.jsxs(ke,{children:[e.jsxs(Re,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(De,{className:"text-sm font-medium",children:"总请求数"}),e.jsx(tx,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Me,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[G($.total_requests).display,G($.total_requests).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",G($.total_requests).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",h<48?h+"小时":Math.floor(h/24)+"天"]})]})]}),e.jsxs(ke,{children:[e.jsxs(Re,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(De,{className:"text-sm font-medium",children:"总花费"}),e.jsx(y_,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Me,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[Se($.total_cost).display,Se($.total_cost).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",Se($.total_cost).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:$.cost_per_hour>0?`¥${$.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),e.jsxs(ke,{children:[e.jsxs(Re,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(De,{className:"text-sm font-medium",children:"Token消耗"}),e.jsx(Yr,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Me,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[G($.total_tokens).display,G($.total_tokens).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",G($.total_tokens).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:$.tokens_per_hour>0?`${G($.tokens_per_hour).display}/小时`:"暂无数据"})]})]}),e.jsxs(ke,{children:[e.jsxs(Re,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(De,{className:"text-sm font-medium",children:"平均响应"}),e.jsx(el,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Me,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[$.avg_response_time.toFixed(2),"s"]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[e.jsxs(ke,{children:[e.jsxs(Re,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(De,{className:"text-sm font-medium",children:"在线时长"}),e.jsx(na,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Me,{children:e.jsxs("div",{className:"text-xl font-bold",children:[ue($.online_time),e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",$.online_time.toLocaleString(),"秒)"]})]})})]}),e.jsxs(ke,{children:[e.jsxs(Re,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(De,{className:"text-sm font-medium",children:"消息处理"}),e.jsx(Ra,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Me,{children:[e.jsxs("div",{className:"text-xl font-bold",children:[G($.total_messages).display,G($.total_messages).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",G($.total_messages).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",G($.total_replies).display,G($.total_replies).needsExact&&e.jsxs("span",{children:["(",G($.total_replies).exact,")"]})," 条"]})]})]}),e.jsxs(ke,{children:[e.jsxs(Re,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(De,{className:"text-sm font-medium",children:"成本效率"}),e.jsx(ax,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Me,{children:[e.jsx("div",{className:"text-xl font-bold",children:$.total_messages>0?`¥${($.total_cost/$.total_messages*100).toFixed(2)}`:"¥0.00"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),e.jsxs(ea,{defaultValue:"trends",className:"space-y-4",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[e.jsx(Xe,{value:"trends",children:"趋势"}),e.jsx(Xe,{value:"models",children:"模型"}),e.jsx(Xe,{value:"activity",children:"活动"}),e.jsx(Xe,{value:"daily",children:"日统计"})]}),e.jsxs(vs,{value:"trends",className:"space-y-4",children:[e.jsxs(ke,{children:[e.jsxs(Re,{children:[e.jsx(De,{children:"请求趋势"}),e.jsxs(is,{children:["最近",h,"小时的请求量变化"]})]}),e.jsx(Me,{children:e.jsx(Vr,{config:B,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(Gw,{data:ge,children:[e.jsx(Qi,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Yi,{dataKey:"timestamp",tickFormatter:z=>fe(z),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Hr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(qi,{content:e.jsx(Gr,{labelFormatter:z=>fe(z)})}),e.jsx(qw,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsxs(ke,{children:[e.jsxs(Re,{children:[e.jsx(De,{children:"花费趋势"}),e.jsx(is,{children:"API调用成本变化"})]}),e.jsx(Me,{children:e.jsx(Vr,{config:B,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(Uo,{data:ge,children:[e.jsx(Qi,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Yi,{dataKey:"timestamp",tickFormatter:z=>fe(z),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Hr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(qi,{content:e.jsx(Gr,{labelFormatter:z=>fe(z)})}),e.jsx(Ji,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),e.jsxs(ke,{children:[e.jsxs(Re,{children:[e.jsx(De,{children:"Token消耗"}),e.jsx(is,{children:"Token使用量变化"})]}),e.jsx(Me,{children:e.jsx(Vr,{config:B,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(Uo,{data:ge,children:[e.jsx(Qi,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Yi,{dataKey:"timestamp",tickFormatter:z=>fe(z),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Hr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(qi,{content:e.jsx(Gr,{labelFormatter:z=>fe(z)})}),e.jsx(Ji,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),e.jsx(vs,{value:"models",className:"space-y-4",children:e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsxs(ke,{children:[e.jsxs(Re,{children:[e.jsx(De,{children:"模型请求分布"}),e.jsxs(is,{children:["各模型使用占比 (共 ",he.length," 个模型)"]})]}),e.jsx(Me,{children:e.jsx(Vr,{config:Object.fromEntries(he.map((z,K)=>[z.model_name,{label:z.model_name,color:Te[K]}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(Kw,{children:[e.jsx(qi,{content:e.jsx(Gr,{})}),e.jsx(Qw,{data:q,cx:"50%",cy:"50%",labelLine:!1,label:({name:z,percent:K})=>K&&K<.05?"":`${z} ${K?(K*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:q.map((z,K)=>e.jsx(Yw,{fill:z.fill},`cell-${K}`))})]})})})]}),e.jsxs(ke,{children:[e.jsxs(Re,{children:[e.jsx(De,{children:"模型详细统计"}),e.jsx(is,{children:"请求数、花费和性能"})]}),e.jsx(Me,{children:e.jsx(Ze,{className:"h-[300px] sm:h-[400px]",children:e.jsx("div",{className:"space-y-3",children:he.map((z,K)=>e.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:z.model_name}),e.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${K%5+1}))`}})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),e.jsx("span",{className:"ml-1 font-medium",children:z.request_count.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1 font-medium",children:["¥",z.total_cost.toFixed(2)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),e.jsxs("span",{className:"ml-1 font-medium",children:[(z.total_tokens/1e3).toFixed(1),"K"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),e.jsxs("span",{className:"ml-1 font-medium",children:[z.avg_response_time.toFixed(2),"s"]})]})]})]},K))})})})]})]})}),e.jsx(vs,{value:"activity",children:e.jsxs(ke,{children:[e.jsxs(Re,{children:[e.jsx(De,{children:"最近活动"}),e.jsx(is,{children:"最新的API调用记录"})]}),e.jsx(Me,{children:e.jsx(Ze,{className:"h-[400px] sm:h-[500px]",children:e.jsx("div",{className:"space-y-2",children:Q.map((z,K)=>e.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm truncate",children:z.model}),e.jsx("div",{className:"text-xs text-muted-foreground",children:z.request_type})]}),e.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:fe(z.timestamp)})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),e.jsx("span",{className:"ml-1",children:z.tokens})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1",children:["¥",z.cost.toFixed(4)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),e.jsxs("span",{className:"ml-1",children:[z.time_cost.toFixed(2),"s"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"状态:"}),e.jsx("span",{className:`ml-1 ${z.status==="success"?"text-green-600":"text-red-600"}`,children:z.status})]})]})]},K))})})})]})}),e.jsx(vs,{value:"daily",children:e.jsxs(ke,{children:[e.jsxs(Re,{children:[e.jsx(De,{children:"每日统计"}),e.jsx(is,{children:"最近7天的数据汇总"})]}),e.jsx(Me,{children:e.jsx(Vr,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:e.jsxs(Uo,{data:R,children:[e.jsx(Qi,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Yi,{dataKey:"timestamp",tickFormatter:z=>{const K=new Date(z);return`${K.getMonth()+1}/${K.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Hr,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Hr,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(qi,{content:e.jsx(Gr,{labelFormatter:z=>new Date(z).toLocaleDateString("zh-CN")})}),e.jsx(O1,{content:e.jsx(kv,{})}),e.jsx(Ji,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),e.jsx(Ji,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),e.jsx(er,{}),e.jsx(Ov,{open:A,onOpenChange:z=>{S(z),z||J()}})]})})}const i2={theme:"system",setTheme:()=>null},Lv=m.createContext(i2),hx=()=>{const a=m.useContext(Lv);if(a===void 0)throw new Error("useTheme must be used within a ThemeProvider");return a},c2=(a,l,r)=>{const c=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||c){l(a);return}const d=r.clientX,u=r.clientY,h=Math.hypot(Math.max(d,innerWidth-d),Math.max(u,innerHeight-u));document.startViewTransition(()=>{l(a)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${d}px ${u}px)`,`circle(${h}px at ${d}px ${u}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},Uv=m.createContext(void 0),$v=()=>{const a=m.useContext(Uv);if(a===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return a},Ge=m.forwardRef(({className:a,...l},r)=>e.jsx(hj,{className:F("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",a),...l,ref:r,children:e.jsx(xw,{className:F("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Ge.displayName=hj.displayName;const o2=Wr("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),T=m.forwardRef(({className:a,...l},r)=>e.jsx(Gj,{ref:r,className:F(o2(),a),...l}));T.displayName=Gj.displayName;const d2=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:a=>a.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:a=>/[A-Z]/.test(a)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:a=>/[a-z]/.test(a)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:a=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(a)}];function u2(a){const l=d2.map(c=>({id:c.id,label:c.label,description:c.description,passed:c.validate(a)}));return{isValid:l.every(c=>c.passed),rules:l}}const od="0.12.2",fx="MaiBot Dashboard",m2=`${fx} v${od}`,x2=(a="v")=>`${a}${od}`,pa={THEME:"maibot-ui-theme",ACCENT_COLOR:"accent-color",ENABLE_ANIMATIONS:"maibot-animations",ENABLE_WAVES_BACKGROUND:"maibot-waves-background",LOG_CACHE_SIZE:"maibot-log-cache-size",LOG_AUTO_SCROLL:"maibot-log-auto-scroll",LOG_FONT_SIZE:"maibot-log-font-size",LOG_LINE_SPACING:"maibot-log-line-spacing",DATA_SYNC_INTERVAL:"maibot-data-sync-interval",WS_RECONNECT_INTERVAL:"maibot-ws-reconnect-interval",WS_MAX_RECONNECT_ATTEMPTS:"maibot-ws-max-reconnect-attempts",COMPLETED_TOURS:"maibot-completed-tours"},dl={theme:"system",accentColor:"blue",enableAnimations:!0,enableWavesBackground:!0,logCacheSize:1e3,logAutoScroll:!0,logFontSize:"xs",logLineSpacing:4,dataSyncInterval:30,wsReconnectInterval:3e3,wsMaxReconnectAttempts:10};function kt(a){const l=Bv(a),r=localStorage.getItem(l);if(r===null)return dl[a];const c=dl[a];if(typeof c=="boolean")return r==="true";if(typeof c=="number"){const d=parseFloat(r);return isNaN(d)?c:d}return r}function qr(a,l){const r=Bv(a);localStorage.setItem(r,String(l)),window.dispatchEvent(new CustomEvent("maibot-settings-change",{detail:{key:a,value:l}}))}function h2(){return{theme:kt("theme"),accentColor:kt("accentColor"),enableAnimations:kt("enableAnimations"),enableWavesBackground:kt("enableWavesBackground"),logCacheSize:kt("logCacheSize"),logAutoScroll:kt("logAutoScroll"),logFontSize:kt("logFontSize"),logLineSpacing:kt("logLineSpacing"),dataSyncInterval:kt("dataSyncInterval"),wsReconnectInterval:kt("wsReconnectInterval"),wsMaxReconnectAttempts:kt("wsMaxReconnectAttempts")}}function f2(){const a=h2(),l=localStorage.getItem(pa.COMPLETED_TOURS),r=l?JSON.parse(l):[];return{...a,completedTours:r}}function p2(a){const l=[],r=[];for(const[c,d]of Object.entries(a)){if(c==="completedTours"){Array.isArray(d)?(localStorage.setItem(pa.COMPLETED_TOURS,JSON.stringify(d)),l.push("completedTours")):r.push("completedTours");continue}if(c in dl){const u=c,h=dl[u];if(typeof d==typeof h){if(u==="theme"&&!["light","dark","system"].includes(d)){r.push(c);continue}if(u==="logFontSize"&&!["xs","sm","base"].includes(d)){r.push(c);continue}qr(u,d),l.push(c)}else r.push(c)}else r.push(c)}return{success:l.length>0,imported:l,skipped:r}}function g2(){for(const a of Object.keys(dl))qr(a,dl[a]);localStorage.removeItem(pa.COMPLETED_TOURS),window.dispatchEvent(new CustomEvent("maibot-settings-reset"))}function j2(){const a=[],l=[],r=[];for(let c=0;cc.size-r.size),{used:a,items:localStorage.length,details:l}}function v2(a){if(a===0)return"0 B";const l=1024,r=["B","KB","MB"],c=Math.floor(Math.log(a)/Math.log(l));return parseFloat((a/Math.pow(l,c)).toFixed(2))+" "+r[c]}function Bv(a){return{theme:pa.THEME,accentColor:pa.ACCENT_COLOR,enableAnimations:pa.ENABLE_ANIMATIONS,enableWavesBackground:pa.ENABLE_WAVES_BACKGROUND,logCacheSize:pa.LOG_CACHE_SIZE,logAutoScroll:pa.LOG_AUTO_SCROLL,logFontSize:pa.LOG_FONT_SIZE,logLineSpacing:pa.LOG_LINE_SPACING,dataSyncInterval:pa.DATA_SYNC_INTERVAL,wsReconnectInterval:pa.WS_RECONNECT_INTERVAL,wsMaxReconnectAttempts:pa.WS_MAX_RECONNECT_ATTEMPTS}[a]}const Qa=m.forwardRef(({className:a,...l},r)=>e.jsxs(fj,{ref:r,className:F("relative flex w-full touch-none select-none items-center",a),...l,children:[e.jsx(hw,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:e.jsx(fw,{className:"absolute h-full bg-primary"})}),e.jsx(pw,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));Qa.displayName=fj.displayName;class N2{ws=null;reconnectTimeout=null;reconnectAttempts=0;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];getMaxCacheSize(){return kt("logCacheSize")}getMaxReconnectAttempts(){return kt("wsMaxReconnectAttempts")}getReconnectInterval(){return kt("wsReconnectInterval")}getWebSocketUrl(l){let r;{const c=window.location.protocol==="https:"?"wss:":"ws:",d=window.location.host;r=`${c}//${d}/ws/logs`}return l?`${r}?token=${encodeURIComponent(l)}`:r}async getWsToken(){try{const l=await _e("/api/webui/ws-token",{method:"GET",credentials:"include"});if(!l.ok)return console.error("获取 WebSocket token 失败:",l.status),null;const r=await l.json();return r.success&&r.token?r.token:null}catch(l){return console.error("获取 WebSocket token 失败:",l),null}}async connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;if(window.location.pathname==="/auth"){console.log("📡 在登录页面,跳过 WebSocket 连接");return}if(!await cc()){console.log("📡 未登录,跳过 WebSocket 连接");return}const r=await this.getWsToken();if(!r){console.log("📡 无法获取 WebSocket token,跳过连接");return}const c=this.getWebSocketUrl(r);try{this.ws=new WebSocket(c),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=d=>{try{if(d.data==="pong")return;const u=JSON.parse(d.data);this.notifyLog(u)}catch(u){console.error("解析日志消息失败:",u)}},this.ws.onerror=d=>{console.error("❌ WebSocket 错误:",d),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(d){console.error("创建 WebSocket 连接失败:",d),this.attemptReconnect()}}attemptReconnect(){const l=this.getMaxReconnectAttempts();if(this.reconnectAttempts>=l)return;this.reconnectAttempts+=1;const r=this.getReconnectInterval(),c=Math.min(r*this.reconnectAttempts,3e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},c)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(l){return this.logCallbacks.add(l),()=>this.logCallbacks.delete(l)}onConnectionChange(l){return this.connectionCallbacks.add(l),l(this.isConnected),()=>this.connectionCallbacks.delete(l)}notifyLog(l){if(!this.logCache.some(c=>c.id===l.id)){this.logCache.push(l);const c=this.getMaxCacheSize();this.logCache.length>c&&(this.logCache=this.logCache.slice(-c)),this.logCallbacks.forEach(d=>{try{d(l)}catch(u){console.error("日志回调执行失败:",u)}})}}notifyConnection(l){this.connectionCallbacks.forEach(r=>{try{r(l)}catch(c){console.error("连接状态回调执行失败:",c)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const Hn=new N2;typeof window<"u"&&setTimeout(()=>{Hn.connect()},100);const gs=jw,jt=vw,b2=gw,Iv=m.forwardRef(({className:a,...l},r)=>e.jsx(pj,{className:F("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...l,ref:r}));Iv.displayName=pj.displayName;const cs=m.forwardRef(({className:a,...l},r)=>e.jsxs(b2,{children:[e.jsx(Iv,{}),e.jsx(gj,{ref:r,className:F("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...l})]}));cs.displayName=gj.displayName;const os=({className:a,...l})=>e.jsx("div",{className:F("flex flex-col space-y-2 text-center sm:text-left",a),...l});os.displayName="AlertDialogHeader";const ds=({className:a,...l})=>e.jsx("div",{className:F("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...l});ds.displayName="AlertDialogFooter";const us=m.forwardRef(({className:a,...l},r)=>e.jsx(jj,{ref:r,className:F("text-lg font-semibold",a),...l}));us.displayName=jj.displayName;const ms=m.forwardRef(({className:a,...l},r)=>e.jsx(vj,{ref:r,className:F("text-sm text-muted-foreground",a),...l}));ms.displayName=vj.displayName;const xs=m.forwardRef(({className:a,variant:l,...r},c)=>e.jsx(Nj,{ref:c,className:F(Zr({variant:l}),a),...r}));xs.displayName=Nj.displayName;const hs=m.forwardRef(({className:a,...l},r)=>e.jsx(bj,{ref:r,className:F(Zr({variant:"outline"}),"mt-2 sm:mt-0",a),...l}));hs.displayName=bj.displayName;function y2(){return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),e.jsxs(ea,{defaultValue:"appearance",className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[e.jsxs(Xe,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(w_,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"外观"})]}),e.jsxs(Xe,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(sv,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"安全"})]}),e.jsxs(Xe,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(vn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"其他"})]}),e.jsxs(Xe,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(Vt,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"关于"})]})]}),e.jsxs(Ze,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[e.jsx(vs,{value:"appearance",className:"mt-0",children:e.jsx(w2,{})}),e.jsx(vs,{value:"security",className:"mt-0",children:e.jsx(_2,{})}),e.jsx(vs,{value:"other",className:"mt-0",children:e.jsx(S2,{})}),e.jsx(vs,{value:"about",className:"mt-0",children:e.jsx(k2,{})})]})]})]})}function Dg(a){const l=document.documentElement,c={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[a];if(c)l.style.setProperty("--primary",c.hsl),c.gradient?(l.style.setProperty("--primary-gradient",c.gradient),l.classList.add("has-gradient")):(l.style.removeProperty("--primary-gradient"),l.classList.remove("has-gradient"));else if(a.startsWith("#")){const d=u=>{u=u.replace("#","");const h=parseInt(u.substring(0,2),16)/255,f=parseInt(u.substring(2,4),16)/255,p=parseInt(u.substring(4,6),16)/255,g=Math.max(h,f,p),b=Math.min(h,f,p);let j=0,y=0;const N=(g+b)/2;if(g!==b){const w=g-b;switch(y=N>.5?w/(2-g-b):w/(g+b),g){case h:j=((f-p)/w+(flocalStorage.getItem("accent-color")||"blue");m.useEffect(()=>{const g=localStorage.getItem("accent-color")||"blue";Dg(g)},[]);const p=g=>{f(g),localStorage.setItem("accent-color",g),Dg(g)};return e.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[e.jsx(Um,{value:"light",current:a,onChange:l,label:"浅色",description:"始终使用浅色主题"}),e.jsx(Um,{value:"dark",current:a,onChange:l,label:"深色",description:"始终使用深色主题"}),e.jsx(Um,{value:"system",current:a,onChange:l,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),e.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[e.jsx(qa,{value:"blue",current:h,onChange:p,label:"蓝色",colorClass:"bg-blue-500"}),e.jsx(qa,{value:"purple",current:h,onChange:p,label:"紫色",colorClass:"bg-purple-500"}),e.jsx(qa,{value:"green",current:h,onChange:p,label:"绿色",colorClass:"bg-green-500"}),e.jsx(qa,{value:"orange",current:h,onChange:p,label:"橙色",colorClass:"bg-orange-500"}),e.jsx(qa,{value:"pink",current:h,onChange:p,label:"粉色",colorClass:"bg-pink-500"}),e.jsx(qa,{value:"red",current:h,onChange:p,label:"红色",colorClass:"bg-red-500"})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),e.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[e.jsx(qa,{value:"gradient-sunset",current:h,onChange:p,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),e.jsx(qa,{value:"gradient-ocean",current:h,onChange:p,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),e.jsx(qa,{value:"gradient-forest",current:h,onChange:p,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),e.jsx(qa,{value:"gradient-aurora",current:h,onChange:p,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),e.jsx(qa,{value:"gradient-fire",current:h,onChange:p,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),e.jsx(qa,{value:"gradient-twilight",current:h,onChange:p,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex-1",children:e.jsx("input",{type:"color",value:h.startsWith("#")?h:"#3b82f6",onChange:g=>p(g.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),e.jsx("div",{className:"flex-1",children:e.jsx(ae,{type:"text",value:h,onChange:g=>p(g.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),e.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),e.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[e.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5 flex-1",children:[e.jsx(T,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),e.jsx(Ge,{id:"animations",checked:r,onCheckedChange:c})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5 flex-1",children:[e.jsx(T,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),e.jsx(Ge,{id:"waves-background",checked:d,onCheckedChange:u})]})})]})]})]})}function _2(){const a=ca(),[l,r]=m.useState(""),[c,d]=m.useState(""),[u,h]=m.useState(!1),[f,p]=m.useState(!1),[g,b]=m.useState(!1),[j,y]=m.useState(!1),[N,w]=m.useState(!1),[M,A]=m.useState(!1),[S,U]=m.useState(""),[E,C]=m.useState(!1),{toast:D}=Ws(),P=m.useMemo(()=>u2(c),[c]),O=async de=>{if(!l){D({title:"无法复制",description:"Token 存储在安全 Cookie 中,请重新生成以获取新 Token",variant:"destructive"});return}try{await navigator.clipboard.writeText(de),w(!0),D({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>w(!1),2e3)}catch{D({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},J=async()=>{if(!c.trim()){D({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!P.isValid){const de=P.rules.filter(he=>!he.passed).map(he=>he.label).join(", ");D({title:"格式错误",description:`Token 不符合要求: ${de}`,variant:"destructive"});return}b(!0);try{const de=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({new_token:c.trim()})}),he=await de.json();de.ok&&he.success?(d(""),r(c.trim()),D({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{a({to:"/auth"})},1500)):D({title:"更新失败",description:he.message||"无法更新 Token",variant:"destructive"})}catch(de){console.error("更新 Token 错误:",de),D({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{b(!1)}},L=async()=>{y(!0);try{const de=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"}),he=await de.json();de.ok&&he.success?(r(he.token),U(he.token),A(!0),C(!1),D({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):D({title:"生成失败",description:he.message||"无法生成新 Token",variant:"destructive"})}catch(de){console.error("生成 Token 错误:",de),D({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{y(!1)}},oe=async()=>{try{await navigator.clipboard.writeText(S),C(!0),D({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{D({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},Ne=()=>{A(!1),setTimeout(()=>{U(""),C(!1)},300),setTimeout(()=>{a({to:"/auth"})},500)},je=de=>{de||Ne()};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(Fs,{open:M,onOpenChange:je,children:e.jsxs(Us,{className:"sm:max-w-md",children:[e.jsxs($s,{children:[e.jsxs(Bs,{className:"flex items-center gap-2",children:[e.jsx(It,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),e.jsx(Xs,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[e.jsx(T,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),e.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:S})]}),e.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(It,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[e.jsx("p",{className:"font-semibold",children:"重要提示"}),e.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[e.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),e.jsx("li",{children:"请立即复制并保存到安全的位置"}),e.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),e.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),e.jsxs(nt,{className:"gap-2 sm:gap-0",children:[e.jsx(_,{variant:"outline",onClick:oe,className:"gap-2",children:E?e.jsxs(e.Fragment,{children:[e.jsx(Mt,{className:"h-4 w-4 text-green-500"}),"已复制"]}):e.jsxs(e.Fragment,{children:[e.jsx(Fo,{className:"h-4 w-4"}),"复制 Token"]})}),e.jsx(_,{onClick:Ne,children:"我已保存,关闭"})]})]})}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),e.jsx("div",{className:"space-y-3 sm:space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ae,{id:"current-token",type:u?"text":"password",value:l||"••••••••••••••••••••••••••••••••",readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"Token 存储在安全 Cookie 中"}),e.jsx("button",{onClick:()=>{l?h(!u):D({title:"无法查看",description:'Token 存储在安全 Cookie 中,如需新 Token 请点击"重新生成"'})},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:u?"隐藏":"显示",children:u?e.jsx(nc,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ia,{className:"h-4 w-4 text-muted-foreground"})})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsx(_,{variant:"outline",size:"icon",onClick:()=>O(l),title:"复制到剪贴板",className:"flex-shrink-0",disabled:!l,children:N?e.jsx(Mt,{className:"h-4 w-4 text-green-500"}):e.jsx(Fo,{className:"h-4 w-4"})}),e.jsxs(gs,{children:[e.jsx(jt,{asChild:!0,children:e.jsxs(_,{variant:"outline",disabled:j,className:"gap-2 flex-1 sm:flex-none",children:[e.jsx(xt,{className:F("h-4 w-4",j&&"animate-spin")}),e.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),e.jsx("span",{className:"sm:hidden",children:"生成"})]})}),e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认重新生成 Token"}),e.jsx(ms,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:L,children:"确认生成"})]})]})]})]})]}),e.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),e.jsxs("div",{className:"relative",children:[e.jsx(ae,{id:"new-token",type:f?"text":"password",value:c,onChange:de=>d(de.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),e.jsx("button",{onClick:()=>p(!f),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:f?"隐藏":"显示",children:f?e.jsx(nc,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ia,{className:"h-4 w-4 text-muted-foreground"})})]}),c&&e.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),e.jsx("div",{className:"space-y-1.5",children:P.rules.map(de=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[de.passed?e.jsx(bt,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):e.jsx(Ka,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:F(de.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:de.label})]},de.id))}),P.isValid&&e.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[e.jsx(Mt,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),e.jsx(_,{onClick:J,disabled:g||!P.isValid||!c,className:"w-full sm:w-auto",children:g?"更新中...":"更新自定义 Token"})]})]}),e.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[e.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),e.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),e.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),e.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),e.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),e.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),e.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function S2(){const a=ca(),{toast:l}=Ws(),[r,c]=m.useState(!1),[d,u]=m.useState(!1),[h,f]=m.useState(()=>kt("logCacheSize")),[p,g]=m.useState(()=>kt("wsReconnectInterval")),[b,j]=m.useState(()=>kt("wsMaxReconnectAttempts")),[y,N]=m.useState(()=>kt("dataSyncInterval")),[w,M]=m.useState(()=>Rg()),[A,S]=m.useState(!1),[U,E]=m.useState(!1),C=m.useRef(null);if(d)throw new Error("这是一个手动触发的测试错误,用于验证错误边界组件是否正常工作。");const D=()=>{M(Rg())},P=R=>{const Q=R[0];f(Q),qr("logCacheSize",Q)},O=R=>{const Q=R[0];g(Q),qr("wsReconnectInterval",Q)},J=R=>{const Q=R[0];j(Q),qr("wsMaxReconnectAttempts",Q)},L=R=>{const Q=R[0];N(Q),qr("dataSyncInterval",Q)},oe=()=>{Hn.clearLogs(),l({title:"日志已清除",description:"日志缓存已清空"})},Ne=()=>{const R=j2();D(),l({title:"缓存已清除",description:`已清除 ${R.clearedKeys.length} 项缓存数据`})},je=()=>{S(!0);try{const R=f2(),Q=JSON.stringify(R,null,2),$=new Blob([Q],{type:"application/json"}),ue=URL.createObjectURL($),G=document.createElement("a");G.href=ue,G.download=`maibot-webui-settings-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(G),G.click(),document.body.removeChild(G),URL.revokeObjectURL(ue),l({title:"导出成功",description:"设置已导出为 JSON 文件"})}catch(R){console.error("导出设置失败:",R),l({title:"导出失败",description:"无法导出设置",variant:"destructive"})}finally{S(!1)}},de=R=>{const Q=R.target.files?.[0];if(!Q)return;E(!0);const $=new FileReader;$.onload=ue=>{try{const G=ue.target?.result,Se=JSON.parse(G),fe=p2(Se);fe.success?(f(kt("logCacheSize")),g(kt("wsReconnectInterval")),j(kt("wsMaxReconnectAttempts")),N(kt("dataSyncInterval")),D(),l({title:"导入成功",description:`成功导入 ${fe.imported.length} 项设置${fe.skipped.length>0?`,跳过 ${fe.skipped.length} 项`:""}`}),(fe.imported.includes("theme")||fe.imported.includes("accentColor"))&&l({title:"提示",description:"部分设置需要刷新页面才能完全生效"})):l({title:"导入失败",description:"没有有效的设置项可导入",variant:"destructive"})}catch(G){console.error("导入设置失败:",G),l({title:"导入失败",description:"文件格式无效",variant:"destructive"})}finally{E(!1),C.current&&(C.current.value="")}},$.readAsText(Q)},he=()=>{g2(),f(dl.logCacheSize),g(dl.wsReconnectInterval),j(dl.wsMaxReconnectAttempts),N(dl.dataSyncInterval),D(),l({title:"已重置",description:"所有设置已恢复为默认值,刷新页面以应用更改"})},ge=async()=>{c(!0);try{const R=await _e("/api/webui/setup/reset",{method:"POST"}),Q=await R.json();R.ok&&Q.success?(l({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{a({to:"/setup"})},1e3)):l({title:"重置失败",description:Q.message||"无法重置配置状态",variant:"destructive"})}catch(R){console.error("重置配置状态错误:",R),l({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{c(!1)}};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(Yr,{className:"h-5 w-5"}),"性能与存储"]}),e.jsxs("div",{className:"space-y-4 sm:space-y-5",children:[e.jsxs("div",{className:"rounded-lg bg-muted/50 p-3 sm:p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("span",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(__,{className:"h-4 w-4"}),"本地存储使用"]}),e.jsx(_,{variant:"ghost",size:"sm",onClick:D,className:"h-7 px-2",children:e.jsx(xt,{className:"h-3 w-3"})})]}),e.jsx("div",{className:"text-2xl font-bold text-primary",children:v2(w.used)}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[w.items," 个存储项"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"日志缓存大小"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h," 条"]})]}),e.jsx(Qa,{value:[h],onValueChange:P,min:100,max:5e3,step:100,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"控制日志查看器最多缓存的日志条数,较大的值会占用更多内存"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"首页数据刷新间隔"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[y," 秒"]})]}),e.jsx(Qa,{value:[y],onValueChange:L,min:10,max:120,step:5,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"控制首页统计数据的自动刷新间隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"WebSocket 重连间隔"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[p/1e3," 秒"]})]}),e.jsx(Qa,{value:[p],onValueChange:O,min:1e3,max:1e4,step:500,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"日志 WebSocket 连接断开后的重连基础间隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"WebSocket 最大重连次数"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[b," 次"]})]}),e.jsx(Qa,{value:[b],onValueChange:J,min:3,max:30,step:1,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"连接失败后的最大重连尝试次数"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 pt-2",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:oe,className:"gap-2",children:[e.jsx(ls,{className:"h-4 w-4"}),"清除日志缓存"]}),e.jsxs(gs,{children:[e.jsx(jt,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(ls,{className:"h-4 w-4"}),"清除本地缓存"]})}),e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认清除本地缓存"}),e.jsx(ms,{children:"这将清除所有本地缓存的设置和数据(不包括登录凭证)。 您可能需要重新配置部分偏好设置。确定要继续吗?"})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:Ne,children:"确认清除"})]})]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(Wt,{className:"h-5 w-5"}),"导入/导出设置"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"导出当前的界面设置以便备份,或从之前导出的文件中恢复设置。"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(_,{variant:"outline",onClick:je,disabled:A,className:"gap-2",children:[e.jsx(Wt,{className:"h-4 w-4"}),A?"导出中...":"导出设置"]}),e.jsx("input",{ref:C,type:"file",accept:".json",onChange:de,className:"hidden"}),e.jsxs(_,{variant:"outline",onClick:()=>C.current?.click(),disabled:U,className:"gap-2",children:[e.jsx(rc,{className:"h-4 w-4"}),U?"导入中...":"导入设置"]})]}),e.jsx("div",{className:"pt-2 border-t",children:e.jsxs(gs,{children:[e.jsx(jt,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"gap-2 text-destructive hover:text-destructive",children:[e.jsx(lc,{className:"h-4 w-4"}),"重置所有设置为默认值"]})}),e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认重置所有设置"}),e.jsx(ms,{children:"这将把所有界面设置恢复为默认值,包括主题、颜色、动画等偏好设置。 此操作不会影响您的登录状态。确定要继续吗?"})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:he,children:"确认重置"})]})]})]})})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsx("div",{className:"space-y-2",children:e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),e.jsxs(gs,{children:[e.jsx(jt,{asChild:!0,children:e.jsxs(_,{variant:"outline",disabled:r,className:"gap-2",children:[e.jsx(lc,{className:F("h-4 w-4",r&&"animate-spin")}),"重新进行初次配置"]})}),e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认重新配置"}),e.jsx(ms,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:ge,children:"确认重置"})]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border border-dashed border-yellow-500/50 bg-yellow-500/5 p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(It,{className:"h-5 w-5 text-yellow-500"}),"开发者工具"]}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsx("div",{className:"space-y-2",children:e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"以下功能仅供开发调试使用,可能会导致页面崩溃或异常。"})}),e.jsxs(gs,{children:[e.jsx(jt,{asChild:!0,children:e.jsxs(_,{variant:"destructive",className:"gap-2",children:[e.jsx(It,{className:"h-4 w-4"}),"触发测试错误"]})}),e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认触发错误"}),e.jsx(ms,{children:"这将手动触发一个 React 错误,用于测试错误边界组件的显示效果。 页面将显示错误界面,您可以通过刷新页面或点击返回首页来恢复。"})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:()=>u(!0),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认触发"})]})]})]})]})]})]})}function k2(){return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx("div",{className:"rounded-lg border-2 border-primary/30 bg-gradient-to-r from-primary/5 to-primary/10 p-4 sm:p-6",children:e.jsxs("div",{className:"flex items-start gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex-shrink-0 rounded-lg bg-primary/10 p-2 sm:p-3",children:e.jsx("svg",{className:"h-6 w-6 sm:h-8 sm:w-8 text-primary",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg sm:text-xl font-bold text-foreground mb-2",children:"开源项目"}),e.jsx("p",{className:"text-sm sm:text-base text-muted-foreground mb-3",children:"本项目在 GitHub 开源,欢迎 Star ⭐ 支持!"}),e.jsxs("a",{href:"https://github.com/Mai-with-u/MaiBot-Dashboard",target:"_blank",rel:"noopener noreferrer",className:F("inline-flex items-center gap-2 px-4 py-2 rounded-lg","bg-primary text-primary-foreground font-medium text-sm","hover:bg-primary/90 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[e.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})}),"前往 GitHub",e.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",fx]}),e.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("p",{children:["版本: ",od]}),e.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),e.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",e.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"React 19.2.0"}),e.jsx("li",{children:"TypeScript 5.7.2"}),e.jsx("li",{children:"Vite 6.0.7"}),e.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"shadcn/ui"}),e.jsx("li",{children:"Radix UI"}),e.jsx("li",{children:"Tailwind CSS 3.4.17"}),e.jsx("li",{children:"Lucide Icons"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"后端"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"Python 3.12+"}),e.jsx("li",{children:"FastAPI"}),e.jsx("li",{children:"Uvicorn"}),e.jsx("li",{children:"WebSocket"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"Bun / npm"}),e.jsx("li",{children:"ESLint 9.17.0"}),e.jsx("li",{children:"PostCSS"})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),e.jsx(Ze,{className:"h-[300px] sm:h-[400px]",children:e.jsxs("div",{className:"space-y-4 pr-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Nt,{name:"React",description:"用户界面构建库",license:"MIT"}),e.jsx(Nt,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),e.jsx(Nt,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),e.jsx(Nt,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),e.jsx(Nt,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Nt,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),e.jsx(Nt,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Nt,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),e.jsx(Nt,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Nt,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),e.jsx(Nt,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),e.jsx(Nt,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),e.jsx(Nt,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Nt,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),e.jsx(Nt,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Nt,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),e.jsx(Nt,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),e.jsx(Nt,{name:"Pydantic",description:"数据验证库",license:"MIT"}),e.jsx(Nt,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Nt,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),e.jsx(Nt,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),e.jsx(Nt,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),e.jsx(Nt,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:e.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:e.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function Nt({name:a,description:l,license:r}){return e.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-foreground truncate",children:a}),e.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:l})]}),e.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:r})]})}function Um({value:a,current:l,onChange:r,label:c,description:d}){const u=l===a;return e.jsxs("button",{onClick:()=>r(a),className:F("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",u?"border-primary bg-accent":"border-border"),children:[u&&e.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm sm:text-base font-medium",children:c}),e.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:d})]}),e.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[a==="light"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),a==="dark"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),a==="system"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function qa({value:a,current:l,onChange:r,label:c,colorClass:d}){const u=l===a;return e.jsxs("button",{onClick:()=>r(a),className:F("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",u?"border-primary bg-accent":"border-border"),children:[u&&e.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),e.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[e.jsx("div",{className:F("h-8 w-8 sm:h-10 sm:w-10 rounded-full",d)}),e.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:c})]})]})}const C2=Date.now()%1e6;class T2{grad3;p;perm;constructor(l=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let r=0;r<256;r++)this.p[r]=Math.floor(Math.random()*256);this.perm=[];for(let r=0;r<512;r++)this.perm[r]=this.p[r&255]}dot(l,r,c){return l[0]*r+l[1]*c}mix(l,r,c){return(1-c)*l+c*r}fade(l){return l*l*l*(l*(l*6-15)+10)}perlin2(l,r){const c=Math.floor(l)&255,d=Math.floor(r)&255;l-=Math.floor(l),r-=Math.floor(r);const u=this.fade(l),h=this.fade(r),f=this.perm[c]+d,p=this.perm[f],g=this.perm[f+1],b=this.perm[c+1]+d,j=this.perm[b],y=this.perm[b+1];return this.mix(this.mix(this.dot(this.grad3[p%12],l,r),this.dot(this.grad3[j%12],l-1,r),u),this.mix(this.dot(this.grad3[g%12],l,r-1),this.dot(this.grad3[y%12],l-1,r-1),u),h)}}function Og(){const a=m.useRef(null),l=m.useRef(null),r=m.useRef(void 0),[c]=m.useState(()=>new T2(C2)),d=m.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:c,bounding:null});return m.useEffect(()=>{const u=l.current,h=a.current;if(!u||!h)return;const f=d.current;f.noise=c;const p=()=>{const A=u.getBoundingClientRect();f.bounding=A,h.style.width=`${A.width}px`,h.style.height=`${A.height}px`},g=()=>{if(!f.bounding)return;const{width:A,height:S}=f.bounding;f.lines=[],f.paths.forEach(oe=>oe.remove()),f.paths=[];const U=10,E=32,C=A+200,D=S+30,P=Math.ceil(C/U),O=Math.ceil(D/E),J=(A-U*P)/2,L=(S-E*O)/2;for(let oe=0;oe<=P;oe++){const Ne=[];for(let de=0;de<=O;de++){const he={x:J+U*oe,y:L+E*de,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};Ne.push(he)}const je=document.createElementNS("http://www.w3.org/2000/svg","path");h.appendChild(je),f.paths.push(je),f.lines.push(Ne)}},b=A=>{const{lines:S,mouse:U,noise:E}=f;S.forEach(C=>{C.forEach(D=>{const P=E.perlin2((D.x+A*.0125)*.002,(D.y+A*.005)*.0015)*12;D.wave.x=Math.cos(P)*32,D.wave.y=Math.sin(P)*16;const O=D.x-U.sx,J=D.y-U.sy,L=Math.hypot(O,J),oe=Math.max(175,U.vs);if(L{const U={x:A.x+A.wave.x+(S?A.cursor.x:0),y:A.y+A.wave.y+(S?A.cursor.y:0)};return U.x=Math.round(U.x*10)/10,U.y=Math.round(U.y*10)/10,U},y=()=>{const{lines:A,paths:S}=f;A.forEach((U,E)=>{let C=j(U[0],!1),D=`M ${C.x} ${C.y}`;U.forEach((P,O)=>{const J=O===U.length-1;C=j(P,!J),D+=`L ${C.x} ${C.y}`}),S[E].setAttribute("d",D)})},N=A=>{const{mouse:S}=f;S.sx+=(S.x-S.sx)*.1,S.sy+=(S.y-S.sy)*.1;const U=S.x-S.lx,E=S.y-S.ly,C=Math.hypot(U,E);S.v=C,S.vs+=(C-S.vs)*.1,S.vs=Math.min(100,S.vs),S.lx=S.x,S.ly=S.y,S.a=Math.atan2(E,U),u&&(u.style.setProperty("--x",`${S.sx}px`),u.style.setProperty("--y",`${S.sy}px`)),b(A),y(),r.current=requestAnimationFrame(N)},w=A=>{if(!f.bounding)return;const{mouse:S}=f;S.x=A.pageX-f.bounding.left,S.y=A.pageY-f.bounding.top+window.scrollY,S.set||(S.sx=S.x,S.sy=S.y,S.lx=S.x,S.ly=S.y,S.set=!0)},M=()=>{p(),g()};return p(),g(),window.addEventListener("resize",M),window.addEventListener("mousemove",w),r.current=requestAnimationFrame(N),()=>{window.removeEventListener("resize",M),window.removeEventListener("mousemove",w),r.current&&cancelAnimationFrame(r.current)}},[c]),e.jsxs("div",{ref:l,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[e.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),e.jsx("svg",{ref:a,style:{display:"block",width:"100%",height:"100%"},children:e.jsx("style",{children:` - path { - fill: none; - stroke: hsl(var(--primary) / 0.20); - stroke-width: 1px; - } - `})})]})}function E2(){const[a,l]=m.useState(""),[r,c]=m.useState(!1),[d,u]=m.useState(""),[h,f]=m.useState(!0),p=ca(),{enableWavesBackground:g,setEnableWavesBackground:b}=$v(),{theme:j,setTheme:y}=hx();m.useEffect(()=>{(async()=>{try{await cc()&&p({to:"/"})}catch{}finally{f(!1)}})()},[p]);const w=j==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":j,M=()=>{y(w==="dark"?"light":"dark")},A=async S=>{if(S.preventDefault(),u(""),!a.trim()){u("请输入 Access Token");return}c(!0),console.log("开始验证 token...");try{const U=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:a.trim()})});console.log("Token 验证响应状态:",U.status);const E=await U.json();if(console.log("Token 验证响应数据:",E),U.ok&&E.valid){console.log("Token 验证成功,准备跳转..."),console.log("is_first_setup:",E.is_first_setup),await new Promise(D=>setTimeout(D,100));const C=await cc();console.log("跳转前认证状态检查:",C),E.is_first_setup?(console.log("跳转到首次配置页面"),p({to:"/setup"})):(console.log("跳转到首页"),p({to:"/"}))}else console.error("Token 验证失败:",E.message),u(E.message||"Token 验证失败,请检查后重试")}catch(U){console.error("Token 验证错误:",U),u("连接服务器失败,请检查网络连接")}finally{c(!1)}};return h?e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[g&&e.jsx(Og,{}),e.jsx("div",{className:"text-muted-foreground",children:"正在检查登录状态..."})]}):e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[g&&e.jsx(Og,{}),e.jsxs(ke,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[e.jsx("button",{onClick:M,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:w==="dark"?"切换到浅色模式":"切换到深色模式",children:w==="dark"?e.jsx(lx,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):e.jsx(ec,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),e.jsxs(Re,{className:"space-y-4 text-center",children:[e.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:e.jsx(wg,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(De,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),e.jsx(is,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),e.jsx(Me,{children:e.jsxs("form",{onSubmit:A,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),e.jsxs("div",{className:"relative",children:[e.jsx(nx,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),e.jsx(ae,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:a,onChange:S=>l(S.target.value),className:F("pl-10",d&&"border-red-500 focus-visible:ring-red-500"),disabled:r,autoFocus:!0,autoComplete:"off"})]})]}),d&&e.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[e.jsx(Ct,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{children:d})]}),e.jsx(_,{type:"submit",className:"w-full",disabled:r,children:r?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),e.jsxs(Fs,{children:[e.jsx(cd,{asChild:!0,children:e.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[e.jsx(tv,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),e.jsxs(Us,{className:"sm:max-w-md",children:[e.jsxs($s,{children:[e.jsxs(Bs,{className:"flex items-center gap-2",children:[e.jsx(wg,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),e.jsx(Xs,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(S_,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),e.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[e.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),e.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ea,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),e.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:e.jsx("code",{className:"text-primary",children:"data/webui.json"})}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",e.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),e.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Ct,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[e.jsx("p",{className:"font-semibold",children:"安全提示"}),e.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[e.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),e.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),e.jsxs(gs,{children:[e.jsx(jt,{asChild:!0,children:e.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[e.jsx(el,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsxs(us,{className:"flex items-center gap-2",children:[e.jsx(el,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),e.jsx(ms,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:()=>b(!1),children:"关闭动画"})]})]})]})]})})]}),e.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:e.jsx("p",{children:m2})})]})}const rt=m.forwardRef(({className:a,autoResize:l=!0,minHeight:r=60,maxHeight:c,value:d,onChange:u,...h},f)=>{const p=m.useRef(null),[g,b]=m.useState(!1);m.useImperativeHandle(f,()=>p.current),m.useEffect(()=>{if(a){const N=/\b(h-\d+|h-\[[\d.]+(?:px|rem|em)\]|min-h-\[[\d.]+(?:px|rem|em)\])\b/.test(a);b(N)}},[a]);const j=m.useCallback(()=>{const N=p.current;if(!N||!l||g)return;N.style.height="auto";const w=N.scrollHeight;let M=Math.max(w,r);c&&c>0&&(M=Math.min(M,c)),N.style.height=`${M}px`,c&&c>0&&w>c?N.style.overflowY="auto":N.style.overflowY="hidden"},[l,g,r,c]);m.useEffect(()=>{j()},[d,j]),m.useEffect(()=>{j()},[j]);const y=m.useCallback(N=>{u?.(N),requestAnimationFrame(()=>{j()})},[u,j]);return e.jsx("textarea",{className:F("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","custom-scrollbar",l&&!g&&"resize-none overflow-hidden",a),ref:p,value:d,onChange:y,style:{minHeight:l&&!g?`${r}px`:void 0},...h})});rt.displayName="Textarea";const Zt=m.forwardRef(({className:a,orientation:l="horizontal",decorative:r=!0,...c},d)=>e.jsx(yj,{ref:d,decorative:r,orientation:l,className:F("shrink-0 bg-border",l==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",a),...c}));Zt.displayName=yj.displayName;function M2({config:a,onChange:l}){const r=d=>{d.trim()&&!a.alias_names.includes(d.trim())&&l({...a,alias_names:[...a.alias_names,d.trim()]})},c=d=>{l({...a,alias_names:a.alias_names.filter((u,h)=>h!==d)})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"qq_account",children:"QQ账号 *"}),e.jsx(ae,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:a.qq_account||"",onChange:d=>l({...a,qq_account:Number(d.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"nickname",children:"昵称 *"}),e.jsx(ae,{id:"nickname",placeholder:"请输入机器人的昵称",value:a.nickname,onChange:d=>l({...a,nickname:d.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{children:"别名"}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:a.alias_names.map((d,u)=>e.jsxs(Ce,{variant:"secondary",className:"gap-1",children:[d,e.jsx("button",{type:"button",onClick:()=>c(u),className:"ml-1 hover:text-destructive",children:e.jsx(Aa,{className:"h-3 w-3"})})]},u))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:d=>{d.key==="Enter"&&(r(d.target.value),d.target.value="")}}),e.jsx(_,{type:"button",variant:"outline",onClick:()=>{const d=document.getElementById("alias_input");d&&(r(d.value),d.value="")},children:"添加"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function A2({config:a,onChange:l}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"personality",children:"人格特征 *"}),e.jsx(rt,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:a.personality,onChange:r=>l({...a,personality:r.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"reply_style",children:"表达风格 *"}),e.jsx(rt,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:a.reply_style,onChange:r=>l({...a,reply_style:r.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"interest",children:"兴趣 *"}),e.jsx(rt,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:a.interest,onChange:r=>l({...a,interest:r.target.value}),rows:2}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),e.jsx(Zt,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"plan_style",children:"群聊说话规则 *"}),e.jsx(rt,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:a.plan_style,onChange:r=>l({...a,plan_style:r.target.value}),rows:4}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),e.jsx(rt,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:a.private_plan_style,onChange:r=>l({...a,private_plan_style:r.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function z2({config:a,onChange:l}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{htmlFor:"emoji_chance",children:"表情包激活概率"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[(a.emoji_chance*100).toFixed(0),"%"]})]}),e.jsx(ae,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:a.emoji_chance,onChange:r=>l({...a,emoji_chance:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"max_reg_num",children:"最大表情包数量"}),e.jsx(ae,{id:"max_reg_num",type:"number",min:"1",max:"200",value:a.max_reg_num,onChange:r=>l({...a,max_reg_num:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"do_replace",children:"达到最大数量时替换"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),e.jsx(Ge,{id:"do_replace",checked:a.do_replace,onCheckedChange:r=>l({...a,do_replace:r})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(ae,{id:"check_interval",type:"number",min:"1",max:"120",value:a.check_interval,onChange:r=>l({...a,check_interval:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),e.jsx(Zt,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"steal_emoji",children:"偷取表情包"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),e.jsx(Ge,{id:"steal_emoji",checked:a.steal_emoji,onCheckedChange:r=>l({...a,steal_emoji:r})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"content_filtration",children:"启用表情包过滤"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),e.jsx(Ge,{id:"content_filtration",checked:a.content_filtration,onCheckedChange:r=>l({...a,content_filtration:r})})]}),a.content_filtration&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(ae,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:a.filtration_prompt,onChange:r=>l({...a,filtration_prompt:r.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function R2({config:a,onChange:l}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"enable_tool",children:"启用工具系统"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),e.jsx(Ge,{id:"enable_tool",checked:a.enable_tool,onCheckedChange:r=>l({...a,enable_tool:r})})]}),e.jsx(Zt,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"all_global",children:"启用全局黑话模式"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),e.jsx(Ge,{id:"all_global",checked:a.all_global,onCheckedChange:r=>l({...a,all_global:r})})]})]})}function D2({config:a,onChange:l}){const[r,c]=m.useState(!1);return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5",children:e.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),e.jsxs("div",{className:"flex-1 text-sm",children:[e.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"关于硅基流动 (SiliconFlow)"}),e.jsx("p",{className:"text-blue-700 dark:text-blue-300 mb-2",children:"硅基流动提供了完整的模型覆盖,包括 DeepSeek V3、Qwen、视觉模型、语音识别和嵌入模型。 只需一个 API Key 即可使用麦麦的所有功能!"}),e.jsxs("a",{href:"https://cloud.siliconflow.cn",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-600 dark:text-blue-400 hover:underline font-medium",children:["前往硅基流动获取 API Key",e.jsx($o,{className:"h-3 w-3"})]})]})]})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"siliconflow_api_key",children:"SiliconFlow API Key *"}),e.jsxs("div",{className:"relative",children:[e.jsx(ae,{id:"siliconflow_api_key",type:r?"text":"password",placeholder:"sk-...",value:a.api_key,onChange:d=>l({api_key:d.target.value}),className:"font-mono pr-10"}),e.jsx(_,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>c(!r),children:r?e.jsx(nc,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ia,{className:"h-4 w-4 text-muted-foreground"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"请输入您的硅基流动 API 密钥。获取后,麦麦将自动配置所有必需的模型。"})]}),e.jsxs("div",{className:"rounded-lg bg-muted/50 p-4 text-sm space-y-2",children:[e.jsx("p",{className:"font-medium",children:"将自动配置以下模型:"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground ml-2",children:[e.jsx("li",{children:"DeepSeek V3 - 主要对话和工具模型"}),e.jsx("li",{children:"Qwen3 30B - 高频小任务和工具调用"}),e.jsx("li",{children:"Qwen3 VL 30B - 图像识别"}),e.jsx("li",{children:"SenseVoice - 语音识别"}),e.jsx("li",{children:"BGE-M3 - 文本嵌入"}),e.jsx("li",{children:"知识库相关模型 (LPMM)"})]})]}),e.jsx("div",{className:"rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/30 p-4",children:e.jsxs("p",{className:"text-sm text-amber-900 dark:text-amber-100",children:[e.jsx("span",{className:"font-medium",children:"💡 提示:"}),'完成向导后,您可以在"系统设置 → 模型配置"中添加更多 API 提供商和模型。']})})]})}async function O2(){const a=await _e("/api/webui/config/bot",{method:"GET",headers:qs()});if(!a.ok)throw new Error("读取Bot配置失败");const r=(await a.json()).config.bot||{};return{qq_account:r.qq_account||0,nickname:r.nickname||"",alias_names:r.alias_names||[]}}async function L2(){const a=await _e("/api/webui/config/bot",{method:"GET",headers:qs()});if(!a.ok)throw new Error("读取人格配置失败");const r=(await a.json()).config.personality||{};return{personality:r.personality||"",reply_style:r.reply_style||"",interest:r.interest||"",plan_style:r.plan_style||"",private_plan_style:r.private_plan_style||""}}async function U2(){const a=await _e("/api/webui/config/bot",{method:"GET",headers:qs()});if(!a.ok)throw new Error("读取表情包配置失败");const r=(await a.json()).config.emoji||{};return{emoji_chance:r.emoji_chance??.4,max_reg_num:r.max_reg_num??40,do_replace:r.do_replace??!0,check_interval:r.check_interval??10,steal_emoji:r.steal_emoji??!0,content_filtration:r.content_filtration??!1,filtration_prompt:r.filtration_prompt||""}}async function $2(){const a=await _e("/api/webui/config/bot",{method:"GET",headers:qs()});if(!a.ok)throw new Error("读取其他配置失败");const r=(await a.json()).config,c=r.tool||{},d=r.expression||{};return{enable_tool:c.enable_tool??!0,all_global:d.all_global_jargon??!0}}async function B2(){const a=await _e("/api/webui/config/model",{method:"GET",headers:qs()});if(!a.ok)throw new Error("读取模型配置失败");return{api_key:((await a.json()).config.api_providers||[]).find(u=>u.name==="SiliconFlow")?.api_key||""}}async function I2(a){const l=await _e("/api/webui/config/bot/section/bot",{method:"POST",headers:qs(),body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"保存Bot基础配置失败")}return await l.json()}async function P2(a){const l=await _e("/api/webui/config/bot/section/personality",{method:"POST",headers:qs(),body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"保存人格配置失败")}return await l.json()}async function F2(a){const l=await _e("/api/webui/config/bot/section/emoji",{method:"POST",headers:qs(),body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"保存表情包配置失败")}return await l.json()}async function H2(a){const l=[];l.push(_e("/api/webui/config/bot/section/tool",{method:"POST",headers:qs(),body:JSON.stringify({enable_tool:a.enable_tool})})),l.push(_e("/api/webui/config/bot/section/expression",{method:"POST",headers:qs(),body:JSON.stringify({all_global_jargon:a.all_global})}));const r=await Promise.all(l);for(const c of r)if(!c.ok){const d=await c.json();throw new Error(d.detail||"保存其他配置失败")}return{success:!0}}async function V2(a){const l=await _e("/api/webui/config/model",{method:"GET",headers:qs()});if(!l.ok)throw new Error("读取模型配置失败");const c=(await l.json()).config,d=c.api_providers||[],u=d.findIndex(p=>p.name==="SiliconFlow");u>=0?d[u]={...d[u],api_key:a.api_key}:d.push({name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",api_key:a.api_key,client_type:"openai",max_retry:3,timeout:120,retry_interval:5});const h={...c,api_providers:d},f=await _e("/api/webui/config/model",{method:"POST",headers:qs(),body:JSON.stringify(h)});if(!f.ok){const p=await f.json();throw new Error(p.detail||"保存模型配置失败")}return await f.json()}async function Lg(){const a=await _e("/api/webui/setup/complete",{method:"POST"});if(!a.ok){const l=await a.json();throw new Error(l.message||"标记配置完成失败")}return await a.json()}function G2(){return e.jsx(Wn,{children:e.jsx(q2,{})})}function q2(){const a=ca(),{toast:l}=Ws(),{triggerRestart:r}=yn(),[c,d]=m.useState(0),[u,h]=m.useState(!1),[f,p]=m.useState(!1),[g,b]=m.useState(!0),[j,y]=m.useState({qq_account:0,nickname:"",alias_names:[]}),[N,w]=m.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 -2.如果相同的内容已经被执行,请不要重复执行 -3.请控制你的发言频率,不要太过频繁的发言 -4.如果有人对你感到厌烦,请减少回复 -5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 -2.如果相同的内容已经被执行,请不要重复执行 -3.某句话如果已经被回复过,不要重复回复`}),[M,A]=m.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[S,U]=m.useState({enable_tool:!0,all_global:!0}),[E,C]=m.useState({api_key:""}),D=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:Vn},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:jn},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:ld},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:vn},{id:"siliconflow",title:"API配置",description:"配置硅基流动API密钥",icon:nx}],P=(c+1)/D.length*100;m.useEffect(()=>{(async()=>{try{b(!0);const[he,ge,R,Q,$]=await Promise.all([O2(),L2(),U2(),$2(),B2()]);y(he),w(ge),A(R),U(Q),C($)}catch(he){l({title:"加载配置失败",description:he instanceof Error?he.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{b(!1)}})()},[l]);const O=async()=>{p(!0);try{switch(c){case 0:await I2(j);break;case 1:await P2(N);break;case 2:await F2(M);break;case 3:await H2(S);break;case 4:await V2(E);break}return l({title:"保存成功",description:`${D[c].title}配置已保存`}),!0}catch(de){return l({title:"保存失败",description:de instanceof Error?de.message:"未知错误",variant:"destructive"}),!1}finally{p(!1)}},J=async()=>{await O()&&c{c>0&&d(c-1)},oe=async()=>{h(!0);try{if(!await O()){h(!1);return}await Lg(),l({title:"配置完成",description:"麦麦正在重启以应用新配置..."}),await r()}catch(de){l({title:"配置失败",description:de instanceof Error?de.message:"未知错误",variant:"destructive"})}finally{h(!1)}},Ne=async()=>{try{await Lg(),a({to:"/"})}catch(de){l({title:"跳过失败",description:de instanceof Error?de.message:"未知错误",variant:"destructive"})}},je=()=>{switch(c){case 0:return e.jsx(M2,{config:j,onChange:y});case 1:return e.jsx(A2,{config:N,onChange:w});case 2:return e.jsx(z2,{config:M,onChange:A});case 3:return e.jsx(R2,{config:S,onChange:U});case 4:return e.jsx(D2,{config:E,onChange:C});default:return null}};return e.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[e.jsx(er,{}),e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute left-1/4 top-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-primary/5 blur-3xl"}),e.jsx("div",{className:"absolute right-1/4 bottom-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-secondary/5 blur-3xl"})]}),g?e.jsxs("div",{className:"relative z-10 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:e.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),e.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[e.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:e.jsx(k_,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),e.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),e.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",fx," 的初始配置"]})]}),e.jsxs("div",{className:"mb-6 md:mb-8",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",c+1," / ",D.length]}),e.jsxs("span",{className:"font-medium text-primary",children:[Math.round(P),"%"]})]}),e.jsx(Xn,{value:P,className:"h-2"})]}),e.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:D.map((de,he)=>{const ge=de.icon;return e.jsxs("div",{className:F("flex flex-1 flex-col items-center gap-1 md:gap-2",hea({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[e.jsx(nd,{className:"h-4 w-4"}),"返回首页"]}),e.jsxs(_,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[e.jsx(Ma,{className:"h-4 w-4"}),"返回上一页"]})]}),e.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}const K2=Ls.memo(function({config:l,onChange:r}){const c=l.platforms||[],d=l.alias_names||[],u=()=>{r({...l,platforms:[...c,""]})},h=j=>{r({...l,platforms:c.filter((y,N)=>N!==j)})},f=(j,y)=>{const N=[...c];N[j]=y,r({...l,platforms:N})},p=()=>{r({...l,alias_names:[...d,""]})},g=j=>{r({...l,alias_names:d.filter((y,N)=>N!==j)})},b=(j,y)=>{const N=[...d];N[j]=y,r({...l,alias_names:N})};return e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"platform",children:"平台"}),e.jsx(ae,{id:"platform",value:l.platform,onChange:j=>r({...l,platform:j.target.value}),placeholder:"qq"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"qq_account",children:"QQ账号"}),e.jsx(ae,{id:"qq_account",value:l.qq_account,onChange:j=>r({...l,qq_account:j.target.value}),placeholder:"123456789"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"nickname",children:"昵称"}),e.jsx(ae,{id:"nickname",value:l.nickname,onChange:j=>r({...l,nickname:j.target.value}),placeholder:"麦麦"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"别名"}),e.jsxs(_,{onClick:p,size:"sm",variant:"outline",children:[e.jsx(Ys,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[d.map((j,y)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{value:j,onChange:N=>b(y,N.target.value),placeholder:"小麦"}),e.jsxs(gs,{children:[e.jsx(jt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认删除"}),e.jsxs(ms,{children:['确定要删除别名 "',j||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:()=>g(y),children:"删除"})]})]})]})]},y)),d.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"其他平台账号"}),e.jsxs(_,{onClick:u,size:"sm",variant:"outline",children:[e.jsx(Ys,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[c.map((j,y)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{value:j,onChange:N=>f(y,N.target.value),placeholder:"wx:114514"}),e.jsxs(gs,{children:[e.jsx(jt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认删除"}),e.jsxs(ms,{children:['确定要删除平台账号 "',j||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:()=>h(y),children:"删除"})]})]})]})]},y)),c.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]})]})]})})}),Q2=Ls.memo(function({config:l,onChange:r}){const c=()=>{r({...l,states:[...l.states,""]})},d=h=>{r({...l,states:l.states.filter((f,p)=>p!==h)})},u=(h,f)=>{const p=[...l.states];p[h]=f,r({...l,states:p})};return e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"personality",children:"人格特质"}),e.jsx(rt,{id:"personality",value:l.personality,onChange:h=>r({...l,personality:h.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"多重人格"}),e.jsxs(_,{onClick:c,size:"sm",variant:"outline",children:[e.jsx(Ys,{className:"h-4 w-4 mr-1"}),"添加人格"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"可以定义多个不同的人格状态,麦麦会随机切换"}),e.jsx("div",{className:"space-y-2",children:l.states.map((h,f)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(rt,{value:h,onChange:p=>u(f,p.target.value),placeholder:"描述一个人格状态",rows:2}),e.jsxs(gs,{children:[e.jsx(jt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认删除"}),e.jsx(ms,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:()=>d(f),children:"删除"})]})]})]})]},f))})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"state_probability",children:"替换为多重人格概率"}),e.jsx(ae,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:l.state_probability,onChange:h=>r({...l,state_probability:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时,用多重人格替换主人格的概率(0.0-1.0)"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"reply_style",children:"表达风格"}),e.jsx(rt,{id:"reply_style",value:l.reply_style,onChange:h=>r({...l,reply_style:h.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"plan_style",children:"说话规则与行为风格"}),e.jsx(rt,{id:"plan_style",value:l.plan_style,onChange:h=>r({...l,plan_style:h.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"visual_style",children:"识图规则"}),e.jsx(rt,{id:"visual_style",value:l.visual_style,onChange:h=>r({...l,visual_style:h.target.value}),placeholder:"识图时的处理规则",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"private_plan_style",children:"私聊规则"}),e.jsx(rt,{id:"private_plan_style",value:l.private_plan_style,onChange:h=>r({...l,private_plan_style:h.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]})]})]})})}),ul=bw,ml=yw,sl=m.forwardRef(({className:a,align:l="center",sideOffset:r=4,...c},d)=>e.jsx(Nw,{children:e.jsx(wj,{ref:d,align:l,sideOffset:r,className:F("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",a),...c})}));sl.displayName=wj.displayName;const Y2=Ls.memo(function({value:l,onChange:r}){const c=m.useMemo(()=>{const N=l.split("-");if(N.length===2){const[w,M]=N,[A,S]=w.split(":"),[U,E]=M.split(":");return{startHour:A?A.padStart(2,"0"):"00",startMinute:S?S.padStart(2,"0"):"00",endHour:U?U.padStart(2,"0"):"23",endMinute:E?E.padStart(2,"0"):"59"}}return{startHour:"00",startMinute:"00",endHour:"23",endMinute:"59"}},[l]),[d,u]=m.useState(c.startHour),[h,f]=m.useState(c.startMinute),[p,g]=m.useState(c.endHour),[b,j]=m.useState(c.endMinute);m.useEffect(()=>{u(c.startHour),f(c.startMinute),g(c.endHour),j(c.endMinute)},[c]);const y=(N,w,M,A)=>{const S=`${N}:${w}-${M}:${A}`;r(S)};return e.jsxs(ul,{children:[e.jsx(ml,{asChild:!0,children:e.jsxs(_,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[e.jsx(na,{className:"h-4 w-4 mr-2"}),l||"选择时间段"]})}),e.jsx(sl,{className:"w-72 sm:w-80",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"小时"}),e.jsxs(Pe,{value:d,onValueChange:N=>{u(N),y(N,h,p,b)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:Array.from({length:24},(N,w)=>w).map(N=>e.jsx(W,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"分钟"}),e.jsxs(Pe,{value:h,onValueChange:N=>{f(N),y(d,N,p,b)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:Array.from({length:60},(N,w)=>w).map(N=>e.jsx(W,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"小时"}),e.jsxs(Pe,{value:p,onValueChange:N=>{g(N),y(d,h,N,b)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:Array.from({length:24},(N,w)=>w).map(N=>e.jsx(W,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"分钟"}),e.jsxs(Pe,{value:b,onValueChange:N=>{j(N),y(d,h,p,N)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:Array.from({length:60},(N,w)=>w).map(N=>e.jsx(W,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]})]})]})]})})]})}),J2=Ls.memo(function({rule:l}){const r=`{ target = "${l.target}", time = "${l.time}", value = ${l.value.toFixed(1)} }`;return e.jsxs(ul,{children:[e.jsx(ml,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ia,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(sl,{className:"w-80 sm:w-96",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:r}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})}),X2=Ls.memo(function({config:l,onChange:r}){const c=()=>{r({...l,talk_value_rules:[...l.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},d=h=>{r({...l,talk_value_rules:l.talk_value_rules.filter((f,p)=>p!==h)})},u=(h,f,p)=>{const g=[...l.talk_value_rules];g[h]={...g[h],[f]:p},r({...l,talk_value_rules:g})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),e.jsx(ae,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:l.talk_value,onChange:h=>r({...l,talk_value:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"think_mode",children:"思考模式"}),e.jsxs(Pe,{value:l.think_mode||"classic",onValueChange:h=>r({...l,think_mode:h}),children:[e.jsx(Be,{id:"think_mode",children:e.jsx(Fe,{placeholder:"选择思考模式"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"classic",children:"经典模式 - 浅度思考和回复"}),e.jsx(W,{value:"deep",children:"深度模式 - 进行深度思考和回复"}),e.jsx(W,{value:"dynamic",children:"动态模式 - 自动选择思考深度"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"控制麦麦的思考深度。经典模式回复快但简单;深度模式更深入但较慢;动态模式根据情况自动选择"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"mentioned_bot_reply",checked:l.mentioned_bot_reply,onCheckedChange:h=>r({...l,mentioned_bot_reply:h})}),e.jsx(T,{htmlFor:"mentioned_bot_reply",className:"cursor-pointer",children:"启用提及必回复"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_context_size",children:"上下文长度"}),e.jsx(ae,{id:"max_context_size",type:"number",min:"1",value:l.max_context_size,onChange:h=>r({...l,max_context_size:parseInt(h.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"planner_smooth",children:"规划器平滑"}),e.jsx(ae,{id:"planner_smooth",type:"number",step:"1",min:"0",value:l.planner_smooth,onChange:h=>r({...l,planner_smooth:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"plan_reply_log_max_per_chat",children:"每个聊天流最大日志数量"}),e.jsx(ae,{id:"plan_reply_log_max_per_chat",type:"number",step:"1",min:"100",value:l.plan_reply_log_max_per_chat??1024,onChange:h=>r({...l,plan_reply_log_max_per_chat:parseInt(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"每个聊天流保存的 Plan/Reply 日志最大数量,超过此数量时会自动删除最老的日志"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"llm_quote",checked:l.llm_quote??!1,onCheckedChange:h=>r({...l,llm_quote:h})}),e.jsx(T,{htmlFor:"llm_quote",className:"cursor-pointer",children:"启用 LLM 控制引用"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2 ml-10",children:"启用后,LLM 可以决定是否在回复时引用消息"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_talk_value_rules",checked:l.enable_talk_value_rules,onCheckedChange:h=>r({...l,enable_talk_value_rules:h})}),e.jsx(T,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]})]})]}),l.enable_talk_value_rules&&e.jsxs("div",{className:"border-t pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),e.jsxs(_,{onClick:c,size:"sm",children:[e.jsx(Ys,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),l.talk_value_rules&&l.talk_value_rules.length>0?e.jsx("div",{className:"space-y-4",children:l.talk_value_rules.map((h,f)=>e.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",f+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J2,{rule:h}),e.jsxs(gs,{children:[e.jsx(jt,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"sm",children:e.jsx(ls,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认删除"}),e.jsxs(ms,{children:["确定要删除规则 #",f+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:()=>d(f),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"配置类型"}),e.jsxs(Pe,{value:h.target===""?"global":"specific",onValueChange:p=>{p==="global"?u(f,"target",""):u(f,"target","qq::group")},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"global",children:"全局配置"}),e.jsx(W,{value:"specific",children:"详细配置"})]})]})]}),h.target!==""&&(()=>{const p=h.target.split(":"),g=p[0]||"qq",b=p[1]||"",j=p[2]||"group";return e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Pe,{value:g,onValueChange:y=>{u(f,"target",`${y}:${b}:${j}`)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"qq",children:"QQ"}),e.jsx(W,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(ae,{value:b,onChange:y=>{u(f,"target",`${g}:${y.target.value}:${j}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Pe,{value:j,onValueChange:y=>{u(f,"target",`${g}:${b}:${y}`)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"group",children:"群组(group)"}),e.jsx(W,{value:"private",children:"私聊(private)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",h.target||"(未设置)"]})]})})(),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"时间段 (Time)"}),e.jsx(Y2,{value:h.time,onChange:p=>u(f,"time",p)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{htmlFor:`rule-value-${f}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),e.jsx(ae,{id:`rule-value-${f}`,type:"number",step:"0.01",min:"0.01",max:"1",value:h.value,onChange:p=>{const g=parseFloat(p.target.value);isNaN(g)||u(f,"value",Math.max(.01,Math.min(1,g)))},className:"w-20 h-8 text-xs"})]}),e.jsx(Qa,{value:[h.value],onValueChange:p=>u(f,"value",p[0]),min:.01,max:1,step:.01,className:"w-full"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"0.01 (极少发言)"}),e.jsx("span",{children:"0.5"}),e.jsx("span",{children:"1.0 (正常)"})]})]})]})]},f))}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:e.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),e.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[e.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),e.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[e.jsxs("li",{children:["• ",e.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}),Z2=Ls.memo(function({config:l,onChange:r}){const c=S=>{if(!S||!S.includes(":"))return{platform:"qq",userId:""};const[U,E]=S.split(":");return{platform:U,userId:E}},{platform:d,userId:u}=c(l.dream_send),[h,f]=m.useState(d),[p,g]=m.useState(u),b=S=>{const[U,E]=S.split("-");return{startTime:U||"09:00",endTime:E||"22:00"}},j=(S,U)=>{const E=U?`${S}:${U}`:"";r({...l,dream_send:E})},y=S=>{f(S),j(S,p)},N=S=>{g(S),j(h,S)},w=()=>{r({...l,dream_time_ranges:[...l.dream_time_ranges,"09:00-22:00"]})},M=S=>{r({...l,dream_time_ranges:l.dream_time_ranges.filter((U,E)=>E!==S)})},A=(S,U,E)=>{const C=[...l.dream_time_ranges],D=b(C[S]);U==="startTime"?D.startTime=E:D.endTime=E,C[S]=`${D.startTime}-${D.endTime}`,r({...l,dream_time_ranges:C})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"做梦配置"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"interval_minutes",children:"做梦时间间隔(分钟)"}),e.jsx(ae,{id:"interval_minutes",type:"number",min:"1",value:l.interval_minutes,onChange:S=>r({...l,interval_minutes:Number(S.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"默认30分钟"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"max_iterations",children:"做梦最大轮次"}),e.jsx(ae,{id:"max_iterations",type:"number",min:"1",value:l.max_iterations,onChange:S=>r({...l,max_iterations:Number(S.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"默认20轮"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"first_delay_seconds",children:"首次做梦延迟(秒)"}),e.jsx(ae,{id:"first_delay_seconds",type:"number",min:"0",value:l.first_delay_seconds,onChange:S=>r({...l,first_delay_seconds:Number(S.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"程序启动后首次做梦前的延迟时间,默认60秒"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"做梦结果推送目标"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Pe,{value:h,onValueChange:y,children:[e.jsx(Be,{className:"w-[120px]",children:e.jsx(Fe,{placeholder:"选择平台"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"qq",children:"QQ"}),e.jsx(W,{value:"wx",children:"微信"}),e.jsx(W,{value:"webui",children:"WebUI"})]})]}),e.jsx(ae,{type:"text",placeholder:"输入用户ID (例如: 123456)",value:p,onChange:S=>N(S.target.value),className:"flex-1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"选择平台并输入用户ID,做梦结束后将梦境发送给该用户。用户ID为空则不推送"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"做梦时间段配置"}),e.jsx(_,{type:"button",size:"sm",onClick:w,children:"添加时间段"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"设置允许做梦的时间段,支持跨夜区间(如 23:00 到次日 02:00)。列表为空则全天允许做梦"}),e.jsxs("div",{className:"space-y-2",children:[l.dream_time_ranges.map((S,U)=>{const{startTime:E,endTime:C}=b(S);return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{type:"time",value:E,onChange:D=>A(U,"startTime",D.target.value),className:"w-[140px]"}),e.jsx("span",{className:"text-muted-foreground",children:"至"}),e.jsx(ae,{type:"time",value:C,onChange:D=>A(U,"endTime",D.target.value),className:"w-[140px]"}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",onClick:()=>M(U),children:e.jsx(Aa,{className:"h-4 w-4"})})]},U)}),l.dream_time_ranges.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"当前配置为全天允许做梦"})]})]})]})}),W2=Ls.memo(function({config:l,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.enable,onCheckedChange:c=>r({...l,enable:c})}),e.jsx(T,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),l.enable&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"LPMM 模式"}),e.jsxs(Pe,{value:l.lpmm_mode,onValueChange:c=>r({...l,lpmm_mode:c}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择 LPMM 模式"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"classic",children:"经典模式"}),e.jsx(W,{value:"agent",children:"Agent 模式"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"同义词搜索 TopK"}),e.jsx(ae,{type:"number",min:"1",value:l.rag_synonym_search_top_k,onChange:c=>r({...l,rag_synonym_search_top_k:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"同义词阈值"}),e.jsx(ae,{type:"number",step:"0.1",min:"0",max:"1",value:l.rag_synonym_threshold,onChange:c=>r({...l,rag_synonym_threshold:parseFloat(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"实体提取线程数"}),e.jsx(ae,{type:"number",min:"1",value:l.info_extraction_workers,onChange:c=>r({...l,info_extraction_workers:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"嵌入向量维度"}),e.jsx(ae,{type:"number",min:"1",value:l.embedding_dimension,onChange:c=>r({...l,embedding_dimension:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"嵌入并发线程数"}),e.jsx(ae,{type:"number",min:"1",value:l.max_embedding_workers,onChange:c=>r({...l,max_embedding_workers:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"每批嵌入条数"}),e.jsx(ae,{type:"number",min:"1",value:l.embedding_chunk_size,onChange:c=>r({...l,embedding_chunk_size:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"同义实体数上限"}),e.jsx(ae,{type:"number",min:"1",value:l.max_synonym_entities,onChange:c=>r({...l,max_synonym_entities:parseInt(c.target.value)})})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.enable_ppr,onCheckedChange:c=>r({...l,enable_ppr:c})}),e.jsx(T,{className:"cursor-pointer",children:"启用 PPR (低配机器可关闭)"})]})]})]})]})}),eS=Ls.memo(function({config:l,onChange:r}){const[c,d]=m.useState(""),[u,h]=m.useState("WARNING"),f=()=>{c&&!l.suppress_libraries.includes(c)&&(r({...l,suppress_libraries:[...l.suppress_libraries,c]}),d(""))},p=w=>{r({...l,suppress_libraries:l.suppress_libraries.filter(M=>M!==w)})},g=()=>{c&&!l.library_log_levels[c]&&(r({...l,library_log_levels:{...l.library_log_levels,[c]:u}}),d(""),h("WARNING"))},b=w=>{const M={...l.library_log_levels};delete M[w],r({...l,library_log_levels:M})},j=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],y=["FULL","compact","lite"],N=["none","title","full"];return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"日期格式"}),e.jsx(ae,{value:l.date_style,onChange:w=>r({...l,date_style:w.target.value}),placeholder:"例如: m-d H:i:s"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"日志级别样式"}),e.jsxs(Pe,{value:l.log_level_style,onValueChange:w=>r({...l,log_level_style:w}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:y.map(w=>e.jsx(W,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"日志文本颜色"}),e.jsxs(Pe,{value:l.color_text,onValueChange:w=>r({...l,color_text:w}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:N.map(w=>e.jsx(W,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"全局日志级别"}),e.jsxs(Pe,{value:l.log_level,onValueChange:w=>r({...l,log_level:w}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:j.map(w=>e.jsx(W,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"控制台日志级别"}),e.jsxs(Pe,{value:l.console_log_level,onValueChange:w=>r({...l,console_log_level:w}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:j.map(w=>e.jsx(W,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"文件日志级别"}),e.jsxs(Pe,{value:l.file_log_level,onValueChange:w=>r({...l,file_log_level:w}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:j.map(w=>e.jsx(W,{value:w,children:w},w))})]})]})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"mb-2 block",children:"完全屏蔽的库"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ae,{value:c,onChange:w=>d(w.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:w=>{w.key==="Enter"&&(w.preventDefault(),f())}}),e.jsx(_,{onClick:f,size:"sm",className:"flex-shrink-0",children:e.jsx(Ys,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:l.suppress_libraries.map(w=>e.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[e.jsx("span",{className:"text-sm",children:w}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>p(w),children:e.jsx(ls,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},w))})]}),e.jsxs("div",{children:[e.jsx(T,{className:"mb-2 block",children:"特定库的日志级别"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ae,{value:c,onChange:w=>d(w.target.value),placeholder:"输入库名",className:"flex-1"}),e.jsxs(Pe,{value:u,onValueChange:h,children:[e.jsx(Be,{className:"w-32",children:e.jsx(Fe,{})}),e.jsx(Ie,{children:j.map(w=>e.jsx(W,{value:w,children:w},w))})]}),e.jsx(_,{onClick:g,size:"sm",children:e.jsx(Ys,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:Object.entries(l.library_log_levels).map(([w,M])=>e.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[e.jsx("span",{className:"text-sm font-medium",children:w}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:M}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>b(w),children:e.jsx(ls,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},w))})]})]})}),sS=Ls.memo(function({config:l,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),e.jsx(Ge,{checked:l.show_prompt,onCheckedChange:c=>r({...l,show_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示回复器 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),e.jsx(Ge,{checked:l.show_replyer_prompt,onCheckedChange:c=>r({...l,show_replyer_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示回复器推理"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),e.jsx(Ge,{checked:l.show_replyer_reasoning,onCheckedChange:c=>r({...l,show_replyer_reasoning:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示 Jargon Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),e.jsx(Ge,{checked:l.show_jargon_prompt,onCheckedChange:c=>r({...l,show_jargon_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示记忆检索 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示记忆检索相关的提示词"})]}),e.jsx(Ge,{checked:l.show_memory_prompt,onCheckedChange:c=>r({...l,show_memory_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示 Planner Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 Planner 的提示词和原始返回结果"})]}),e.jsx(Ge,{checked:l.show_planner_prompt,onCheckedChange:c=>r({...l,show_planner_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示 LPMM 相关文段"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 LPMM 知识库找到的相关文段日志"})]}),e.jsx(Ge,{checked:l.show_lpmm_paragraph,onCheckedChange:c=>r({...l,show_lpmm_paragraph:c})})]})]})]})}),tS=Ls.memo(function({config:l,onChange:r}){const[c,d]=m.useState(""),[u,h]=m.useState(""),f=()=>{c&&!l.auth_token.includes(c)&&(r({...l,auth_token:[...l.auth_token,c]}),d(""))},p=j=>{r({...l,auth_token:l.auth_token.filter((y,N)=>N!==j)})},g=()=>{u&&!l.api_server_allowed_api_keys.includes(u)&&(r({...l,api_server_allowed_api_keys:[...l.api_server_allowed_api_keys,u]}),h(""))},b=j=>{r({...l,api_server_allowed_api_keys:l.api_server_allowed_api_keys.filter((y,N)=>N!==j)})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"旧版 API 认证令牌"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"用于旧版 API 验证,为空则不启用验证"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ae,{value:c,onChange:j=>d(j.target.value),placeholder:"输入认证令牌",onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),f())}}),e.jsx(_,{onClick:f,size:"sm",children:e.jsx(Ys,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:l.auth_token.map((j,y)=>e.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[e.jsx("span",{className:"text-sm font-mono",children:j}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>p(y),children:e.jsx(ls,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},y))})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"新版 API Server 配置"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"启用新版 API Server"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否启用额外的新版 API Server(额外监听端口)"})]}),e.jsx(Ge,{checked:l.enable_api_server,onCheckedChange:j=>r({...l,enable_api_server:j})})]}),l.enable_api_server&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"主机地址"}),e.jsx(ae,{value:l.api_server_host,onChange:j=>r({...l,api_server_host:j.target.value}),placeholder:"0.0.0.0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"端口号"}),e.jsx(ae,{type:"number",value:l.api_server_port,onChange:j=>r({...l,api_server_port:parseInt(j.target.value)}),placeholder:"8090"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.api_server_use_wss,onCheckedChange:j=>r({...l,api_server_use_wss:j})}),e.jsx(T,{children:"启用 WSS 安全连接"})]}),l.api_server_use_wss&&e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"SSL 证书文件路径"}),e.jsx(ae,{value:l.api_server_cert_file,onChange:j=>r({...l,api_server_cert_file:j.target.value}),placeholder:"cert.pem"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"SSL 密钥文件路径"}),e.jsx(ae,{value:l.api_server_key_file,onChange:j=>r({...l,api_server_key_file:j.target.value}),placeholder:"key.pem"})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"mb-2 block",children:"允许的 API Key 列表"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"为空则允许所有连接"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ae,{value:u,onChange:j=>h(j.target.value),placeholder:"输入 API Key",onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),g())}}),e.jsx(_,{onClick:g,size:"sm",children:e.jsx(Ys,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:l.api_server_allowed_api_keys.map((j,y)=>e.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[e.jsx("span",{className:"text-sm font-mono",children:j}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>b(y),children:e.jsx(ls,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},y))})]})]})]})]})]})}),aS=Ls.memo(function({config:l,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"启用统计信息发送"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),e.jsx(Ge,{checked:l.enable,onCheckedChange:c=>r({...l,enable:c})})]})]})}),lS=Ls.memo(function({emojiConfig:l,memoryConfig:r,toolConfig:c,voiceConfig:d,onEmojiChange:u,onMemoryChange:h,onToolChange:f,onVoiceChange:p}){return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_tool",checked:c.enable_tool,onCheckedChange:g=>f({...c,enable_tool:g})}),e.jsx(T,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦使用各种工具来增强功能"}),e.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[e.jsx(Ge,{id:"enable_asr",checked:d.enable_asr,onCheckedChange:g=>p({...d,enable_asr:g})}),e.jsx(T,{htmlFor:"enable_asr",className:"cursor-pointer",children:"启用语音识别"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),e.jsx(ae,{id:"max_agent_iterations",type:"number",min:"1",value:r.max_agent_iterations,onChange:g=>h({...r,max_agent_iterations:parseInt(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"agent_timeout_seconds",children:"最长回忆时间(秒)"}),e.jsx(ae,{id:"agent_timeout_seconds",type:"number",min:"1",step:"0.1",value:r.agent_timeout_seconds??120,onChange:g=>h({...r,agent_timeout_seconds:parseFloat(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"记忆检索的超时时间,避免过长的等待"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_jargon_detection",checked:r.enable_jargon_detection??!0,onCheckedChange:g=>h({...r,enable_jargon_detection:g})}),e.jsx(T,{htmlFor:"enable_jargon_detection",className:"cursor-pointer",children:"启用黑话识别"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"记忆检索过程中是否启用黑话识别"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"global_memory",checked:r.global_memory??!1,onCheckedChange:g=>h({...r,global_memory:g})}),e.jsx(T,{htmlFor:"global_memory",className:"cursor-pointer",children:"全局记忆查询"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许记忆检索在所有聊天记录中进行全局查询(忽略当前聊天流)"})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"emoji_chance",children:"表情包激活概率"}),e.jsx(ae,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:l.emoji_chance,onChange:g=>u({...l,emoji_chance:parseFloat(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_reg_num",children:"最大注册数量"}),e.jsx(ae,{id:"max_reg_num",type:"number",min:"1",value:l.max_reg_num,onChange:g=>u({...l,max_reg_num:parseInt(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(ae,{id:"check_interval",type:"number",min:"1",value:l.check_interval,onChange:g=>u({...l,check_interval:parseInt(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"do_replace",checked:l.do_replace,onCheckedChange:g=>u({...l,do_replace:g})}),e.jsx(T,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"steal_emoji",checked:l.steal_emoji,onCheckedChange:g=>u({...l,steal_emoji:g})}),e.jsx(T,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"content_filtration",checked:l.content_filtration,onCheckedChange:g=>u({...l,content_filtration:g})}),e.jsx(T,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),l.content_filtration&&e.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[e.jsx(T,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(ae,{id:"filtration_prompt",value:l.filtration_prompt,onChange:g=>u({...l,filtration_prompt:g.target.value}),placeholder:"符合公序良俗"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}),nS=Ls.memo(function({member:l,groupIndex:r,memberIndex:c,availableChatIds:d,onUpdate:u,onRemove:h}){const f=d.includes(l)||l==="*",[p,g]=m.useState(!f);return e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"flex-1 flex gap-2",children:p?e.jsxs(e.Fragment,{children:[e.jsx(ae,{value:l,onChange:b=>u(r,c,b.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),d.length>0&&e.jsx(_,{size:"sm",variant:"outline",onClick:()=>g(!1),title:"切换到下拉选择",children:"下拉"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Pe,{value:l,onValueChange:b=>u(r,c,b),children:[e.jsx(Be,{className:"flex-1",children:e.jsx(Fe,{placeholder:"选择聊天流"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"*",children:"* (全局共享)"}),d.map((b,j)=>e.jsx(W,{value:b,children:b},j))]})]}),e.jsx(_,{size:"sm",variant:"outline",onClick:()=>g(!0),title:"切换到手动输入",children:"输入"})]})}),e.jsxs(gs,{children:[e.jsx(jt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认删除"}),e.jsxs(ms,{children:['确定要删除组成员 "',l||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:()=>h(r,c),children:"删除"})]})]})]})]})}),rS=Ls.memo(function({config:l,onChange:r}){const c=()=>{r({...l,learning_list:[...l.learning_list,["","enable","enable","1.0"]]})},d=y=>{r({...l,learning_list:l.learning_list.filter((N,w)=>w!==y)})},u=(y,N,w)=>{const M=[...l.learning_list];M[y][N]=w,r({...l,learning_list:M})},h=({rule:y})=>{const N=`["${y[0]}", "${y[1]}", "${y[2]}", "${y[3]}"]`;return e.jsxs(ul,{children:[e.jsx(ml,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ia,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(sl,{className:"w-80 sm:w-96",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:N}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},f=()=>{r({...l,expression_groups:[...l.expression_groups,[]]})},p=y=>{r({...l,expression_groups:l.expression_groups.filter((N,w)=>w!==y)})},g=y=>{const N=[...l.expression_groups];N[y]=[...N[y],""],r({...l,expression_groups:N})},b=(y,N)=>{const w=[...l.expression_groups];w[y]=w[y].filter((M,A)=>A!==N),r({...l,expression_groups:w})},j=(y,N,w)=>{const M=[...l.expression_groups];M[y][N]=w,r({...l,expression_groups:M})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"黑话设置"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"all_global_jargon",checked:l.all_global_jargon??!1,onCheckedChange:y=>r({...l,all_global_jargon:y})}),e.jsx(T,{htmlFor:"all_global_jargon",className:"cursor-pointer",children:"全局黑话模式"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"开启后,新增的黑话将默认设为全局(所有聊天流共享)。关闭后,已记录的全局黑话不会改变,需要手动删除。"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_jargon_explanation",checked:l.enable_jargon_explanation??!0,onCheckedChange:y=>r({...l,enable_jargon_explanation:y})}),e.jsx(T,{htmlFor:"enable_jargon_explanation",className:"cursor-pointer",children:"启用黑话解释"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"在回复前尝试对上下文中的黑话进行解释。关闭可减少一次LLM调用,仅影响回复前的黑话匹配与解释,不影响黑话学习。"})]}),e.jsxs("div",{children:[e.jsx(T,{htmlFor:"jargon_mode",children:"黑话解释来源模式"}),e.jsxs(Pe,{value:l.jargon_mode??"context",onValueChange:y=>r({...l,jargon_mode:y}),children:[e.jsx(Be,{id:"jargon_mode",className:"mt-2",children:e.jsx(Fe,{placeholder:"选择黑话解释来源"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"context",children:"上下文模式(自动匹配黑话)"}),e.jsx(W,{value:"planner",children:"Planner模式(使用unknown_words列表)"})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["上下文模式:使用上下文自动匹配黑话并解释",e.jsx("br",{}),"Planner模式:仅使用Planner在reply动作中给出的unknown_words列表进行黑话检索"]})]})]}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),e.jsxs(_,{onClick:c,size:"sm",variant:"outline",children:[e.jsx(Ys,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),e.jsxs("div",{className:"space-y-4",children:[l.learning_list.map((y,N)=>{const w=l.learning_list.some((C,D)=>D!==N&&C[0]===""),M=y[0]==="",A=y[0].split(":"),S=A[0]||"qq",U=A[1]||"",E=A[2]||"group";return e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["规则 ",N+1," ",M&&"(全局配置)"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{rule:y}),e.jsxs(gs,{children:[e.jsx(jt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认删除"}),e.jsxs(ms,{children:["确定要删除学习规则 ",N+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:()=>d(N),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"配置类型"}),e.jsxs(Pe,{value:M?"global":"specific",onValueChange:C=>{C==="global"?u(N,0,""):u(N,0,"qq::group")},disabled:w&&!M,children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"global",children:"全局配置"}),e.jsx(W,{value:"specific",disabled:w&&!M,children:"详细配置"})]})]}),w&&!M&&e.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!M&&e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Pe,{value:S,onValueChange:C=>{u(N,0,`${C}:${U}:${E}`)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"qq",children:"QQ"}),e.jsx(W,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(ae,{value:U,onChange:C=>{u(N,0,`${S}:${C.target.value}:${E}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Pe,{value:E,onValueChange:C=>{u(N,0,`${S}:${U}:${C}`)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"group",children:"群组(group)"}),e.jsx(W,{value:"private",children:"私聊(private)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",y[0]||"(未设置)"]})]}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs font-medium",children:"使用学到的表达"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),e.jsx(Ge,{checked:y[1]==="enable",onCheckedChange:C=>u(N,1,C?"enable":"disable")})]})}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs font-medium",children:"学习表达"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),e.jsx(Ge,{checked:y[2]==="enable",onCheckedChange:C=>u(N,2,C?"enable":"disable")})]})}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs font-medium",children:"启用黑话学习"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦在此聊天流中学习和记录黑话"})]}),e.jsx(Ge,{checked:y[3]==="true"||y[3]==="enable",onCheckedChange:C=>u(N,3,C?"true":"false")})]})})]})]},N)}),l.learning_list.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达优化配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何优化和改进表达方式"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"expression_self_reflect",className:"cursor-pointer font-medium",children:"自动表达优化"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后,麦麦会自动检查并优化表达方式,无需管理员手动干预"})]}),e.jsx(Ge,{id:"expression_self_reflect",checked:l.expression_self_reflect??!1,onCheckedChange:y=>r({...l,expression_self_reflect:y})})]}),l.expression_self_reflect&&e.jsxs("div",{className:"space-y-4 pl-4 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"expression_auto_check_interval",children:"自动检查间隔(秒)"}),e.jsx(ae,{id:"expression_auto_check_interval",type:"number",min:"60",value:l.expression_auto_check_interval??3600,onChange:y=>r({...l,expression_auto_check_interval:parseInt(y.target.value)||3600})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"表达方式自动检查的间隔时间(单位:秒),默认值:3600秒(1小时)"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"expression_auto_check_count",children:"每次检查数量"}),e.jsx(ae,{id:"expression_auto_check_count",type:"number",min:"1",max:"100",value:l.expression_auto_check_count??10,onChange:y=>r({...l,expression_auto_check_count:parseInt(y.target.value)||10})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"每次自动检查时随机选取的表达方式数量,默认值:10条"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"自定义评估标准"}),e.jsxs(_,{onClick:()=>{r({...l,expression_auto_check_custom_criteria:[...l.expression_auto_check_custom_criteria||[],""]})},size:"sm",variant:"outline",children:[e.jsx(Ys,{className:"h-4 w-4 mr-1"}),"添加标准"]})]}),e.jsxs("div",{className:"space-y-2",children:[(l.expression_auto_check_custom_criteria||[]).map((y,N)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{value:y,onChange:w=>{const M=[...l.expression_auto_check_custom_criteria||[]];M[N]=w.target.value,r({...l,expression_auto_check_custom_criteria:M})},placeholder:"输入评估标准,例如:是否符合角色人设",className:"flex-1"}),e.jsx(_,{onClick:()=>{r({...l,expression_auto_check_custom_criteria:(l.expression_auto_check_custom_criteria||[]).filter((w,M)=>M!==N)})},size:"icon",variant:"ghost",children:e.jsx(ls,{className:"h-4 w-4"})})]},N)),(!l.expression_auto_check_custom_criteria||l.expression_auto_check_custom_criteria.length===0)&&e.jsx("div",{className:"text-center py-4 text-muted-foreground text-sm",children:'暂无自定义标准,点击"添加标准"开始配置'})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这些标准会被添加到评估提示词中,作为额外的评估要求"})]})]})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"expression_checked_only",className:"cursor-pointer font-medium",children:"仅使用已审核通过的表达方式"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后,只有通过审核(已检查)的项目会被使用;关闭时,未审核的项目也会被使用。无论开关状态,被拒绝的项目永远不会被使用。"})]}),e.jsx(Ge,{id:"expression_checked_only",checked:l.expression_checked_only??!1,onCheckedChange:y=>r({...l,expression_checked_only:y})})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"expression_manual_reflect",className:"cursor-pointer font-medium",children:"手动表达优化"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后,麦麦会主动向管理员询问表达方式是否合适"})]}),e.jsx(Ge,{id:"expression_manual_reflect",checked:l.expression_manual_reflect??!1,onCheckedChange:y=>r({...l,expression_manual_reflect:y})})]}),l.expression_manual_reflect&&e.jsxs("div",{className:"space-y-4 pl-4 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("span",{className:"text-sm font-medium",children:"反思操作员"})}),e.jsx("div",{className:"space-y-4",children:(()=>{const N=(l.manual_reflect_operator_id||"").split(":"),w=N[0]||"qq",M=N[1]||"",A=N[2]||"private";return e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Pe,{value:w,onValueChange:S=>{r({...l,manual_reflect_operator_id:`${S}:${M}:${A}`})},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"qq",children:"QQ"}),e.jsx(W,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"用户/群 ID"}),e.jsx(ae,{value:M,onChange:S=>{r({...l,manual_reflect_operator_id:`${w}:${S.target.value}:${A}`})},placeholder:"输入 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Pe,{value:A,onValueChange:S=>{r({...l,manual_reflect_operator_id:`${w}:${M}:${S}`})},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"private",children:"私聊(private)"}),e.jsx(W,{value:"group",children:"群组(group)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前操作员 ID:",l.manual_reflect_operator_id||"(未设置)"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'手动表达优化操作员ID,格式:platform:id:type (例如 "qq:123456:private" 或 "qq:654321:group")'})]})})()})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium",children:"允许进行表达反思的聊天流"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"只有在此列表中的聊天流才会提出问题并跟踪。如果列表为空,则所有聊天流都可以进行表达反思(前提是启用了手动表达优化)"})]}),e.jsxs(_,{onClick:()=>{r({...l,allow_reflect:[...l.allow_reflect||[],"qq::group"]})},size:"sm",variant:"outline",children:[e.jsx(Ys,{className:"h-4 w-4 mr-1"}),"添加聊天流"]})]}),e.jsxs("div",{className:"space-y-2",children:[(l.allow_reflect||[]).map((y,N)=>{const w=y.split(":"),M=w[0]||"qq",A=w[1]||"",S=w[2]||"group";return e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-muted/50",children:[e.jsxs(Pe,{value:M,onValueChange:U=>{const E=[...l.allow_reflect];E[N]=`${U}:${A}:${S}`,r({...l,allow_reflect:E})},children:[e.jsx(Be,{className:"w-24",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"qq",children:"QQ"}),e.jsx(W,{value:"wx",children:"微信"})]})]}),e.jsx(ae,{value:A,onChange:U=>{const E=[...l.allow_reflect];E[N]=`${M}:${U.target.value}:${S}`,r({...l,allow_reflect:E})},placeholder:"ID",className:"flex-1 font-mono text-sm"}),e.jsxs(Pe,{value:S,onValueChange:U=>{const E=[...l.allow_reflect];E[N]=`${M}:${A}:${U}`,r({...l,allow_reflect:E})},children:[e.jsx(Be,{className:"w-32",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"group",children:"群组"}),e.jsx(W,{value:"private",children:"私聊"})]})]}),e.jsx(_,{onClick:()=>{r({...l,allow_reflect:l.allow_reflect.filter((U,E)=>E!==N)})},size:"sm",variant:"ghost",children:e.jsx(ls,{className:"h-4 w-4"})})]},N)}),(!l.allow_reflect||l.allow_reflect.length===0)&&e.jsx("div",{className:"text-center py-4 text-muted-foreground text-sm",children:"列表为空,所有聊天流都可以进行表达反思"})]})]})]})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),e.jsxs(_,{onClick:f,size:"sm",variant:"outline",children:[e.jsx(Ys,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),e.jsxs("div",{className:"space-y-4",children:[l.expression_groups.map((y,N)=>{const w=l.learning_list.map(M=>M[0]).filter(M=>M!=="");return e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",N+1,y.length===1&&y[0]==="*"&&"(全局共享)"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{onClick:()=>g(N),size:"sm",variant:"outline",children:e.jsx(Ys,{className:"h-4 w-4"})}),e.jsxs(gs,{children:[e.jsx(jt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认删除"}),e.jsxs(ms,{children:["确定要删除共享组 ",N+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:()=>p(N),children:"删除"})]})]})]})]})]}),e.jsx("div",{className:"space-y-2",children:y.map((M,A)=>e.jsx(nS,{member:M,groupIndex:N,memberIndex:A,availableChatIds:w,onUpdate:j,onRemove:b},`${N}-${A}`))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},N)}),l.expression_groups.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})});function iS({regex:a,reaction:l,onRegexChange:r,onReactionChange:c}){const[d,u]=m.useState(!1),[h,f]=m.useState(""),[p,g]=m.useState(null),[b,j]=m.useState(""),[y,N]=m.useState({}),[w,M]=m.useState(""),A=m.useRef(null),[S,U]=m.useState("build"),E=O=>O.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),C=(O,J=0)=>{const L=A.current;if(!L)return;const oe=L.selectionStart||0,Ne=L.selectionEnd||0,je=a.substring(0,oe)+O+a.substring(Ne);r(je),setTimeout(()=>{const de=oe+O.length+J;L.setSelectionRange(de,de),L.focus()},0)};m.useEffect(()=>{if(!a||!h){p!==null&&g(null),Object.keys(y).length>0&&N({}),w!==l&&M(l),b!==""&&j("");return}try{const O=E(a),J=new RegExp(O,"g"),L=h.match(J);g(L),j("");const Ne=new RegExp(O).exec(h);if(Ne&&Ne.groups){N(Ne.groups);let je=l;Object.entries(Ne.groups).forEach(([de,he])=>{je=je.replace(new RegExp(`\\[${de}\\]`,"g"),he||"")}),M(je)}else N({}),M(l)}catch(O){j(O.message),g(null),N({}),M(l)}},[a,h,l,p,y,w,b]);const D=()=>{if(!h||!p||p.length===0)return e.jsx("span",{className:"text-muted-foreground",children:h||"请输入测试文本"});try{const O=E(a),J=new RegExp(O,"g");let L=0;const oe=[];let Ne;for(;(Ne=J.exec(h))!==null;)Ne.index>L&&oe.push(e.jsx("span",{children:h.substring(L,Ne.index)},`text-${L}`)),oe.push(e.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:Ne[0]},`match-${Ne.index}`)),L=Ne.index+Ne[0].length;return L)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return e.jsxs(Fs,{open:d,onOpenChange:u,children:[e.jsx(cd,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(rx,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),e.jsxs(Us,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[e.jsxs($s,{children:[e.jsx(Bs,{children:"正则表达式编辑器"}),e.jsx(Xs,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),e.jsx(Ze,{className:"max-h-[calc(90vh-120px)]",children:e.jsxs(ea,{value:S,onValueChange:O=>U(O),className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2",children:[e.jsx(Xe,{value:"build",children:"🔧 构建器"}),e.jsx(Xe,{value:"test",children:"🧪 测试器"})]}),e.jsxs(vs,{value:"build",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"正则表达式"}),e.jsx(ae,{ref:A,value:a,onChange:O=>r(O.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"Reaction 内容"}),e.jsx(rt,{value:l,onChange:O=>c(O.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),e.jsxs("div",{className:"space-y-4 border-t pt-4",children:[P.map(O=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:O.category}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:O.items.map(J=>e.jsx(_,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>C(J.pattern,J.moveCursor||0),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsx("span",{className:"text-xs font-medium",children:J.label}),e.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:J.pattern})]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:J.desc})]})},J.label))})]},O.category)),e.jsxs("div",{className:"space-y-2 border-t pt-4",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("^(?P\\S{1,20})是这样的$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),e.jsx(_,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),e.jsx(_,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("(?P.+?)(?:是|为什么|怎么)"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),e.jsxs("li",{children:["命名捕获组格式:",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),e.jsxs("li",{children:["在 reaction 中使用 ",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),e.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),e.jsxs(vs,{value:"test",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"当前正则表达式"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:a||"(未设置)"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),e.jsx(rt,{id:"test-text",value:h,onChange:O=>f(O.target.value),placeholder:`在此输入要测试的文本... -例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),b&&e.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[e.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),e.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:b})]}),!b&&h&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:p&&p.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),e.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",p.length," 处)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"匹配高亮"}),e.jsx(Ze,{className:"h-40 rounded-md bg-muted p-3",children:e.jsx("div",{className:"text-sm break-words",children:D()})})]}),Object.keys(y).length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"命名捕获组"}),e.jsx(Ze,{className:"h-32 rounded-md border p-3",children:e.jsx("div",{className:"space-y-2",children:Object.entries(y).map(([O,J])=>e.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[e.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",O,"]"]}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:J})]},O))})})]}),Object.keys(y).length>0&&l&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"Reaction 替换预览"}),e.jsx(Ze,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:e.jsx("div",{className:"text-sm break-words",children:w})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),e.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),e.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),e.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})}const cS=Ls.memo(function({keywordReactionConfig:l,responsePostProcessConfig:r,chineseTypoConfig:c,responseSplitterConfig:d,onKeywordReactionChange:u,onResponsePostProcessChange:h,onChineseTypoChange:f,onResponseSplitterChange:p}){const g=()=>{u({...l,regex_rules:[...l.regex_rules,{regex:[""],reaction:""}]})},b=C=>{u({...l,regex_rules:l.regex_rules.filter((D,P)=>P!==C)})},j=(C,D,P)=>{const O=[...l.regex_rules];D==="regex"&&typeof P=="string"?O[C]={...O[C],regex:[P]}:D==="reaction"&&typeof P=="string"&&(O[C]={...O[C],reaction:P}),u({...l,regex_rules:O})},y=()=>{u({...l,keyword_rules:[...l.keyword_rules,{keywords:[],reaction:""}]})},N=C=>{u({...l,keyword_rules:l.keyword_rules.filter((D,P)=>P!==C)})},w=(C,D,P)=>{const O=[...l.keyword_rules];typeof P=="string"&&(O[C]={...O[C],reaction:P}),u({...l,keyword_rules:O})},M=C=>{const D=[...l.keyword_rules];D[C]={...D[C],keywords:[...D[C].keywords||[],""]},u({...l,keyword_rules:D})},A=(C,D)=>{const P=[...l.keyword_rules];P[C]={...P[C],keywords:(P[C].keywords||[]).filter((O,J)=>J!==D)},u({...l,keyword_rules:P})},S=(C,D,P)=>{const O=[...l.keyword_rules],J=[...O[C].keywords||[]];J[D]=P,O[C]={...O[C],keywords:J},u({...l,keyword_rules:O})},U=({rule:C})=>{const D=`{ regex = [${(C.regex||[]).map(P=>`"${P}"`).join(", ")}], reaction = "${C.reaction}" }`;return e.jsxs(ul,{children:[e.jsx(ml,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ia,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(sl,{className:"w-[95vw] sm:w-[500px]",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx(Ze,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs break-all",children:D})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},E=({rule:C})=>{const D=`[[keyword_reaction.keyword_rules]] -keywords = [${(C.keywords||[]).map(P=>`"${P}"`).join(", ")}] -reaction = "${C.reaction}"`;return e.jsxs(ul,{children:[e.jsx(ml,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ia,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(sl,{className:"w-[95vw] sm:w-[500px]",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx(Ze,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:D})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),e.jsxs(_,{onClick:g,size:"sm",variant:"outline",children:[e.jsx(Ys,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[l.regex_rules.map((C,D)=>e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",D+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(iS,{regex:C.regex&&C.regex[0]||"",reaction:C.reaction,onRegexChange:P=>j(D,"regex",P),onReactionChange:P=>j(D,"reaction",P)}),e.jsx(U,{rule:C}),e.jsxs(gs,{children:[e.jsx(jt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认删除"}),e.jsxs(ms,{children:["确定要删除正则规则 ",D+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:()=>b(D),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),e.jsx(ae,{value:C.regex&&C.regex[0]||"",onChange:P=>j(D,"regex",P.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"反应内容"}),e.jsx(rt,{value:C.reaction,onChange:P=>j(D,"reaction",P.target.value),placeholder:`触发后麦麦的反应... -可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},D)),l.regex_rules.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),e.jsxs("div",{className:"space-y-4 border-t pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),e.jsxs(_,{onClick:y,size:"sm",variant:"outline",children:[e.jsx(Ys,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[l.keyword_rules.map((C,D)=>e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",D+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{rule:C}),e.jsxs(gs,{children:[e.jsx(jt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认删除"}),e.jsxs(ms,{children:["确定要删除关键词规则 ",D+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:()=>N(D),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-xs font-medium",children:"关键词列表"}),e.jsxs(_,{onClick:()=>M(D),size:"sm",variant:"ghost",children:[e.jsx(Ys,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),e.jsxs("div",{className:"space-y-2",children:[(C.keywords||[]).map((P,O)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{value:P,onChange:J=>S(D,O,J.target.value),placeholder:"关键词",className:"flex-1"}),e.jsx(_,{onClick:()=>A(D,O),size:"sm",variant:"ghost",children:e.jsx(ls,{className:"h-4 w-4"})})]},O)),(!C.keywords||C.keywords.length===0)&&e.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"反应内容"}),e.jsx(rt,{value:C.reaction,onChange:P=>w(D,"reaction",P.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},D)),l.keyword_rules.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_response_post_process",checked:r.enable_response_post_process,onCheckedChange:C=>h({...r,enable_response_post_process:C})}),e.jsx(T,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),r.enable_response_post_process&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t pt-6 space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[e.jsx(Ge,{id:"enable_chinese_typo",checked:c.enable,onCheckedChange:C=>f({...c,enable:C})}),e.jsx(T,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),c.enable&&e.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),e.jsx(ae,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:c.error_rate,onChange:C=>f({...c,error_rate:parseFloat(C.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),e.jsx(ae,{id:"min_freq",type:"number",min:"0",value:c.min_freq,onChange:C=>f({...c,min_freq:parseInt(C.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),e.jsx(ae,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:c.tone_error_rate,onChange:C=>f({...c,tone_error_rate:parseFloat(C.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),e.jsx(ae,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:c.word_replace_rate,onChange:C=>f({...c,word_replace_rate:parseFloat(C.target.value)})})]})]})]})}),e.jsx("div",{className:"border-t pt-6 space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[e.jsx(Ge,{id:"enable_response_splitter",checked:d.enable,onCheckedChange:C=>p({...d,enable:C})}),e.jsx(T,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),d.enable&&e.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),e.jsx(ae,{id:"max_length",type:"number",min:"1",value:d.max_length,onChange:C=>p({...d,max_length:parseInt(C.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),e.jsx(ae,{id:"max_sentence_num",type:"number",min:"1",value:d.max_sentence_num,onChange:C=>p({...d,max_sentence_num:parseInt(C.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_kaomoji_protection",checked:d.enable_kaomoji_protection,onCheckedChange:C=>p({...d,enable_kaomoji_protection:C})}),e.jsx(T,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_overflow_return_all",checked:d.enable_overflow_return_all,onCheckedChange:C=>p({...d,enable_overflow_return_all:C})}),e.jsx(T,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})});function oS({config:a,onChange:l}){const[r,c]=m.useState(""),[d,u]=m.useState(""),h=()=>{const y=r.trim();y&&!a.ban_words.includes(y)&&(l({...a,ban_words:[...a.ban_words,y]}),c(""))},f=y=>{l({...a,ban_words:a.ban_words.filter((N,w)=>w!==y)})},p=y=>{y.key==="Enter"&&(y.preventDefault(),h())},g=()=>{const y=d.trim();if(y&&!a.ban_msgs_regex.includes(y))try{new RegExp(y),l({...a,ban_msgs_regex:[...a.ban_msgs_regex,y]}),u("")}catch(N){alert(`正则表达式语法错误:${N.message}`)}},b=y=>{l({...a,ban_msgs_regex:a.ban_msgs_regex.filter((N,w)=>w!==y)})},j=y=>{y.key==="Enter"&&(y.preventDefault(),g())};return e.jsx("div",{className:"space-y-6",children:e.jsxs(ke,{children:[e.jsxs(Re,{children:[e.jsx(De,{children:"消息过滤配置"}),e.jsx(is,{children:"配置消息过滤规则,过滤特定消息或在特定群组启用静默模式"})]}),e.jsx(Me,{children:e.jsxs(ea,{defaultValue:"ban_words",className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2",children:[e.jsx(Xe,{value:"ban_words",children:"禁用关键词"}),e.jsx(Xe,{value:"ban_regex",children:"禁用正则"})]}),e.jsx(vs,{value:"ban_words",className:"space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(It,{className:"h-4 w-4 text-yellow-500 mt-1 flex-shrink-0"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"包含以下关键词的消息将被过滤,Bot 不会读取这些消息"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{placeholder:"输入要禁用的关键词(按回车添加)",value:r,onChange:y=>c(y.target.value),onKeyDown:p}),e.jsx(_,{onClick:h,size:"icon",children:e.jsx(Ys,{className:"h-4 w-4"})})]}),a.ban_words.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-8 text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁用关键词,点击上方添加"})}):e.jsx("div",{className:"space-y-2",children:a.ban_words.map((y,N)=>e.jsxs("div",{className:"flex items-center justify-between rounded-md border p-3",children:[e.jsx("code",{className:"text-sm",children:y}),e.jsxs(gs,{children:[e.jsx(jt,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"icon",children:e.jsx(ls,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认删除"}),e.jsxs(ms,{children:["确定要删除关键词 ",e.jsxs("code",{children:['"',y,'"']})," 吗?"]})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:()=>f(N),children:"删除"})]})]})]})]},N))})]})}),e.jsx(vs,{value:"ban_regex",className:"space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(It,{className:"h-4 w-4 text-yellow-500 mt-1 flex-shrink-0"}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsx("p",{children:"匹配以下正则表达式的消息将被过滤"}),e.jsx("p",{className:"text-xs",children:"⚠️ 若不了解正则表达式,请勿随意修改"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(rt,{placeholder:`输入正则表达式(按回车添加) -示例:https?://[^\\s]+ 匹配链接`,value:d,onChange:y=>u(y.target.value),onKeyDown:j,className:"min-h-[60px] font-mono text-sm"}),e.jsx(_,{onClick:g,size:"icon",children:e.jsx(Ys,{className:"h-4 w-4"})})]}),a.ban_msgs_regex.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-8 text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁用正则表达式,点击上方添加"})}):e.jsx("div",{className:"space-y-2",children:a.ban_msgs_regex.map((y,N)=>e.jsxs("div",{className:"flex items-center justify-between rounded-md border p-3",children:[e.jsx("code",{className:"text-sm font-mono flex-1 break-all",children:y}),e.jsxs(gs,{children:[e.jsx(jt,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"icon",className:"ml-2 flex-shrink-0",children:e.jsx(ls,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认删除"}),e.jsxs(ms,{children:["确定要删除正则表达式 ",e.jsxs("code",{children:['"',y,'"']})," 吗?"]})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:()=>b(N),children:"删除"})]})]})]})]},N))})]})})]})})]})})}const dS=Ls.memo(function({config:l,onChange:r}){const[c,d]=m.useState(""),[u,h]=m.useState(""),[f,p]=m.useState(!1),g=l.allowed_ips?l.allowed_ips.split(",").map(S=>S.trim()).filter(S=>S):[],b=l.trusted_proxies?l.trusted_proxies.split(",").map(S=>S.trim()).filter(S=>S):[],j=()=>{if(!c.trim())return;const S=[...g,c.trim()];r({...l,allowed_ips:S.join(",")}),d("")},y=S=>{const U=g.filter((E,C)=>C!==S);r({...l,allowed_ips:U.join(",")})},N=()=>{if(!u.trim())return;const S=[...b,u.trim()];r({...l,trusted_proxies:S.join(",")}),h("")},w=S=>{const U=b.filter((E,C)=>C!==S);r({...l,trusted_proxies:U.join(",")})},M=S=>{!S&&l.enabled?p(!0):r({...l,enabled:S})},A=()=>{r({...l,enabled:!1}),p(!1)};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"WebUI 服务配置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.enabled,onCheckedChange:M}),e.jsx(T,{className:"cursor-pointer",children:"启用 WebUI"})]}),l.enabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"运行模式"}),e.jsxs(Pe,{value:l.mode,onValueChange:S=>r({...l,mode:S}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择运行模式"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"development",children:"开发模式"}),e.jsx(W,{value:"production",children:"生产模式"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"注意: WebUI 的监听地址和端口请在 .env 文件中配置 WEBUI_HOST 和 WEBUI_PORT"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"防爬虫模式"}),e.jsxs(Pe,{value:l.anti_crawler_mode,onValueChange:S=>r({...l,anti_crawler_mode:S}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择防爬虫模式"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"false",children:"禁用"}),e.jsx(W,{value:"basic",children:"基础(只记录不阻止)"}),e.jsx(W,{value:"loose",children:"宽松"}),e.jsx(W,{value:"strict",children:"严格"})]})]})]}),e.jsxs("div",{className:"grid gap-2 sm:col-span-2",children:[e.jsx(T,{children:"IP 白名单"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{value:c,onChange:S=>d(S.target.value),onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),j())},placeholder:"输入IP地址后按回车或点击添加"}),e.jsx(_,{type:"button",size:"sm",onClick:j,disabled:!c.trim(),children:e.jsx(Ys,{className:"h-4 w-4"})})]}),g.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:g.map((S,U)=>e.jsxs(Ce,{variant:"secondary",className:"flex items-center gap-1",children:[S,e.jsx("button",{type:"button",onClick:()=>y(U),className:"ml-1 hover:bg-destructive/20 rounded-full p-0.5",children:e.jsx(Aa,{className:"h-3 w-3"})})]},U))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"支持精确IP、CIDR格式和通配符(如:127.0.0.1、192.168.1.0/24)"})]}),e.jsxs("div",{className:"grid gap-2 sm:col-span-2",children:[e.jsx(T,{children:"信任的代理 IP"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{value:u,onChange:S=>h(S.target.value),onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),N())},placeholder:"输入代理IP后按回车或点击添加"}),e.jsx(_,{type:"button",size:"sm",onClick:N,disabled:!u.trim(),children:e.jsx(Ys,{className:"h-4 w-4"})})]}),b.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:b.map((S,U)=>e.jsxs(Ce,{variant:"secondary",className:"flex items-center gap-1",children:[S,e.jsx("button",{type:"button",onClick:()=>w(U),className:"ml-1 hover:bg-destructive/20 rounded-full p-0.5",children:e.jsx(Aa,{className:"h-3 w-3"})})]},U))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只有来自这些IP的X-Forwarded-For头才被信任"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.trust_xff,onCheckedChange:S=>r({...l,trust_xff:S})}),e.jsx(T,{className:"cursor-pointer",children:"启用 X-Forwarded-For 代理解析"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.secure_cookie,onCheckedChange:S=>r({...l,secure_cookie:S})}),e.jsx(T,{className:"cursor-pointer",children:"启用安全 Cookie(仅 HTTPS)"})]})]})]}),e.jsx(gs,{open:f,onOpenChange:p,children:e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"警告:即将关闭 WebUI"}),e.jsxs(ms,{children:["关闭 WebUI 后,在您下次重启麦麦之前,WebUI 界面将无法访问。",e.jsx("br",{}),e.jsx("br",{}),"您需要通过修改配置文件或命令行重新启用 WebUI 才能再次访问此界面。",e.jsx("br",{}),e.jsx("br",{}),"确定要关闭 WebUI 吗?"]})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{variant:"destructive",onClick:A,children:"确认关闭"})]})]})})]})}),wn="/api/webui/config";async function Ug(){const l=await(await _e(`${wn}/bot`)).json();if(!l.success)throw new Error("获取配置数据失败");return l.config}async function xn(){const l=await(await _e(`${wn}/model`)).json();if(!l.success)throw new Error("获取模型配置数据失败");return l.config}async function $g(a){const r=await(await _e(`${wn}/bot`,{method:"POST",body:JSON.stringify(a)})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}async function uS(){const l=await(await _e(`${wn}/bot/raw`)).json();if(!l.success)throw new Error("获取配置源代码失败");return l.content}async function mS(a){const r=await(await _e(`${wn}/bot/raw`,{method:"POST",body:JSON.stringify({raw_content:a})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}async function tc(a){const r=await(await _e(`${wn}/model`,{method:"POST",body:JSON.stringify(a)})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}async function xS(a,l){const c=await(await _e(`${wn}/bot/section/${a}`,{method:"POST",body:JSON.stringify(l)})).json();if(!c.success)throw new Error(c.message||`保存配置节 ${a} 失败`)}async function Jm(a,l){const c=await(await _e(`${wn}/model/section/${a}`,{method:"POST",body:JSON.stringify(l)})).json();if(!c.success)throw new Error(c.message||`保存配置节 ${a} 失败`)}async function hS(a,l="openai",r="/models"){const c=new URLSearchParams({provider_name:a,parser:l,endpoint:r}),d=await _e(`/api/webui/models/list?${c}`);if(!d.ok){const h=await d.json().catch(()=>({}));throw new Error(h.detail||`获取模型列表失败 (${d.status})`)}const u=await d.json();if(!u.success)throw new Error("获取模型列表失败");return u.models}async function fS(a){const l=new URLSearchParams({provider_name:a}),r=await _e(`/api/webui/models/test-connection-by-name?${l}`,{method:"POST"});if(!r.ok){const c=await r.json().catch(()=>({}));throw new Error(c.detail||`测试连接失败 (${r.status})`)}return await r.json()}const pS=Wr("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),it=m.forwardRef(({className:a,variant:l,...r},c)=>e.jsx("div",{ref:c,role:"alert",className:F(pS({variant:l}),a),...r}));it.displayName="Alert";const Gn=m.forwardRef(({className:a,...l},r)=>e.jsx("h5",{ref:r,className:F("mb-1 font-medium leading-none tracking-tight",a),...l}));Gn.displayName="AlertTitle";const ct=m.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:F("text-sm [&_p]:leading-relaxed",a),...l}));ct.displayName="AlertDescription";const gS={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(a,l){let r;if(!l.inString&&(r=a.match(/^('''|"""|'|")/))&&(l.stringType=r[0],l.inString=!0),a.sol()&&!l.inString&&l.inArray===0&&(l.lhs=!0),l.inString){for(;l.inString;)if(a.match(l.stringType))l.inString=!1;else if(a.peek()==="\\")a.next(),a.next();else{if(a.eol())break;a.match(/^.[^\\\"\']*/)}return l.lhs?"property":"string"}else{if(l.inArray&&a.peek()==="]")return a.next(),l.inArray--,"bracket";if(l.lhs&&a.peek()==="["&&a.skipTo("]"))return a.next(),a.peek()==="]"&&a.next(),"atom";if(a.peek()==="#")return a.skipToEnd(),"comment";if(a.eatSpace())return null;if(l.lhs&&a.eatWhile(function(c){return c!="="&&c!=" "}))return"property";if(l.lhs&&a.peek()==="=")return a.next(),l.lhs=!1,null;if(!l.lhs&&a.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!l.lhs&&(a.match("true")||a.match("false")))return"atom";if(!l.lhs&&a.peek()==="[")return l.inArray++,a.next(),"bracket";if(!l.lhs&&a.match(/^\-?\d+(?:\.\d+)?/))return"number";a.eatSpace()||a.next()}return null},languageData:{commentTokens:{line:"#"}}},jS={python:[a1()],json:[l1(),n1()],toml:[t1.define(gS)],text:[]};function Fv({value:a,onChange:l,language:r="text",readOnly:c=!1,height:d="400px",minHeight:u,maxHeight:h,placeholder:f,theme:p="dark",className:g=""}){const[b,j]=m.useState(!1);if(m.useEffect(()=>{j(!0)},[]),!b)return e.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${g}`,style:{height:d,minHeight:u,maxHeight:h}});const y=[...jS[r]||[],Am.lineWrapping,Am.theme({"&":{fontFamily:'"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace'},".cm-content":{fontFamily:'"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace'},".cm-gutters":{fontFamily:'"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace'},".cm-scroller":{fontFamily:'"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace'}})];return c&&y.push(Am.editable.of(!1)),e.jsx("div",{className:`rounded-md overflow-hidden border custom-scrollbar ${g}`,children:e.jsx(r1,{value:a,height:d,minHeight:u,maxHeight:h,theme:p==="dark"?i1:void 0,extensions:y,onChange:l,placeholder:f,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,foldGutter:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,syntaxHighlighting:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0}})})}function vS({id:a,index:l,itemType:r,itemFields:c,value:d,onChange:u,onRemove:h,disabled:f,canRemove:p,placeholder:g}){const{attributes:b,listeners:j,setNodeRef:y,transform:N,transition:w,isDragging:M}=bv({id:a,disabled:f}),A={transform:yv.Transform.toString(N),transition:w};return e.jsxs("div",{ref:y,style:A,className:F("flex items-start gap-2 group",M&&"opacity-50 z-50"),children:[e.jsx("button",{type:"button",className:F("flex-shrink-0 p-2 cursor-grab active:cursor-grabbing","text-muted-foreground hover:text-foreground transition-colors","opacity-0 group-hover:opacity-100 focus:opacity-100",f&&"cursor-not-allowed opacity-30"),...b,...j,children:e.jsx(av,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex-1 min-w-0",children:r==="object"&&c?e.jsx(NS,{value:d,onChange:u,fields:c,disabled:f}):r==="number"?e.jsx(ae,{type:"number",value:d??"",onChange:S=>u(parseFloat(S.target.value)||0),placeholder:g??`第 ${l+1} 项`,disabled:f,className:"font-mono"}):e.jsx(ae,{type:"text",value:d??"",onChange:S=>u(S.target.value),placeholder:g??`第 ${l+1} 项`,disabled:f})}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",onClick:h,disabled:f||!p,className:F("flex-shrink-0 text-muted-foreground hover:text-destructive","opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity"),children:e.jsx(ls,{className:"h-4 w-4"})})]})}function NS({value:a,onChange:l,fields:r,disabled:c}){const d=m.useCallback((h,f)=>{l({...a,[h]:f})},[a,l]),u=(h,f)=>{const p=a?.[h];if(f.type==="boolean"||f.type==="switch")return e.jsxs("div",{className:"flex items-center justify-between py-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(Ge,{checked:!!(p??f.default),onCheckedChange:g=>d(h,g),disabled:c})]});if(f.type==="slider"||f.type==="number"&&f.min!=null&&f.max!=null){const g=p??f.default??f.min??0;return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx("span",{className:"text-xs text-muted-foreground",children:g})]}),e.jsx(Qa,{value:[g],onValueChange:b=>d(h,b[0]),min:f.min??0,max:f.max??100,step:f.step??1,disabled:c,className:"py-1"})]})}return f.type==="select"&&f.choices?e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsxs(Pe,{value:String(p??f.default??""),onValueChange:g=>d(h,g),disabled:c,children:[e.jsx(Be,{className:"h-8 text-sm",children:e.jsx(Fe,{placeholder:f.placeholder??"请选择"})}),e.jsx(Ie,{children:f.choices.map(g=>e.jsx(W,{value:String(g),children:String(g)},String(g)))})]})]}):f.type==="number"?e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(ae,{type:"number",value:p??f.default??"",onChange:g=>d(h,parseFloat(g.target.value)||0),placeholder:f.placeholder,disabled:c,className:"h-8 text-sm"})]}):e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(ae,{type:"text",value:p??f.default??"",onChange:g=>d(h,g.target.value),placeholder:f.placeholder,disabled:c,className:"h-8 text-sm"})]})};return e.jsx(ke,{className:"p-3 space-y-2 bg-muted/30",children:Object.entries(r).map(([h,f])=>e.jsx("div",{children:u(h,f)},h))})}function bS({value:a,onChange:l,itemType:r="string",itemFields:c,minItems:d,maxItems:u,disabled:h,placeholder:f}){const p=m.useMemo(()=>Array.isArray(a)?a:typeof a=="string"&&a.trim()?a.split(",").map(E=>E.trim()):[],[a]),[g]=m.useState(()=>new Map),b=m.useCallback(E=>(g.has(E)||g.set(E,`item-${Date.now()}-${E}-${Math.random().toString(36).slice(2)}`),g.get(E)),[g]),j=m.useMemo(()=>{const E=[];for(let C=0;C{const{active:C,over:D}=E;if(D&&C.id!==D.id){const P=j.indexOf(C.id),O=j.indexOf(D.id),J=gv(p,P,O);l(J)}},[p,j,l]),w=m.useCallback(()=>{if(u!=null&&p.length>=u)return;let E;r==="object"&&c?E=Object.fromEntries(Object.entries(c).map(([C,D])=>[C,D.default??""])):r==="number"?E=0:E="",l([...p,E])},[p,u,r,c,l]),M=m.useCallback((E,C)=>{const D=[...p];D[E]=C,l(D)},[p,l]),A=m.useCallback(E=>{if(d!=null&&p.length<=d)return;const C=p.filter((D,P)=>P!==E);g.delete(E),l(C)},[p,d,g,l]),S=u==null||p.lengthd;return e.jsxs("div",{className:"space-y-2",children:[p.length===0?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-4 justify-center border border-dashed rounded-md",children:[e.jsx(Ct,{className:"h-4 w-4"}),e.jsx("span",{children:"暂无数据,点击下方按钮添加"})]}):e.jsx(jv,{sensors:y,collisionDetection:vv,onDragEnd:N,children:e.jsx(Nv,{items:j,strategy:c1,children:e.jsx("div",{className:"space-y-2",children:p.map((E,C)=>e.jsx(vS,{id:j[C],index:C,itemType:r,itemFields:c,value:E,onChange:D=>M(C,D),onRemove:()=>A(C),disabled:h,canRemove:U,placeholder:f},j[C]))})})}),e.jsxs(_,{type:"button",variant:"outline",size:"sm",onClick:w,disabled:h||!S,className:"w-full",children:[e.jsx(Ys,{className:"h-4 w-4 mr-1"}),"添加项目",u!==void 0&&e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",p.length,"/",u,")"]})]}),(d!=null||u!=null)&&(d!==null||u!==null)&&e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:d!=null&&u!=null?`允许 ${d} - ${u} 项`:d!=null?`至少 ${d} 项`:`最多 ${u} 项`})]})}function px({content:a,className:l=""}){return e.jsx("div",{className:`prose prose-sm dark:prose-invert max-w-none ${l}`,children:e.jsx(h1,{remarkPlugins:[p1,g1],rehypePlugins:[f1],components:{code({inline:r,className:c,children:d,...u}){return r?e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-sm font-mono",...u,children:d}):e.jsx("code",{className:`${c} block bg-muted p-4 rounded-lg overflow-x-auto`,...u,children:d})},table({children:r,...c}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsx("table",{className:"border-collapse border border-border",...c,children:r})})},th({children:r,...c}){return e.jsx("th",{className:"border border-border bg-muted px-4 py-2 text-left font-semibold",...c,children:r})},td({children:r,...c}){return e.jsx("td",{className:"border border-border px-4 py-2",...c,children:r})},a({children:r,...c}){return e.jsx("a",{className:"text-primary hover:underline",target:"_blank",rel:"noopener noreferrer",...c,children:r})},blockquote({children:r,...c}){return e.jsx("blockquote",{className:"border-l-4 border-primary pl-4 italic text-muted-foreground",...c,children:r})},h1({children:r,...c}){return e.jsx("h1",{className:"text-3xl font-bold mt-6 mb-4",...c,children:r})},h2({children:r,...c}){return e.jsx("h2",{className:"text-2xl font-bold mt-5 mb-3",...c,children:r})},h3({children:r,...c}){return e.jsx("h3",{className:"text-xl font-bold mt-4 mb-2",...c,children:r})},h4({children:r,...c}){return e.jsx("h4",{className:"text-lg font-semibold mt-3 mb-2",...c,children:r})},ul({children:r,...c}){return e.jsx("ul",{className:"list-disc list-inside space-y-1 my-2",...c,children:r})},ol({children:r,...c}){return e.jsx("ol",{className:"list-decimal list-inside space-y-1 my-2",...c,children:r})},p({children:r,...c}){return e.jsx("p",{className:"my-2 leading-relaxed",...c,children:r})},hr({...r}){return e.jsx("hr",{className:"my-4 border-border",...r})}},children:a})})}function yS(a,l){let r=a.slice(0,l).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function wS(a,l,r){let c=a.split(/\r\n|\n|\r/g),d="",u=(Math.log10(l+1)|0)+1;for(let h=l-1;h<=l+1;h++){let f=c[h-1];f&&(d+=h.toString().padEnd(u," "),d+=": ",d+=f,d+=` -`,h===l&&(d+=" ".repeat(u+r+2),d+=`^ -`))}return d}class Ts extends Error{line;column;codeblock;constructor(l,r){const[c,d]=yS(r.toml,r.ptr),u=wS(r.toml,c,d);super(`Invalid TOML document: ${l} - -${u}`,r),this.line=c,this.column=d,this.codeblock=u}}function _S(a,l){let r=0;for(;a[l-++r]==="\\";);return--r&&r%2}function Yo(a,l=0,r=a.length){let c=a.indexOf(` -`,l);return a[c-1]==="\r"&&c--,c<=r?c:-1}function gx(a,l){for(let r=l;r-1&&r!=="'"&&_S(a,l));return l>-1&&(l+=c.length,c.length>1&&(a[l]===r&&l++,a[l]===r&&l++)),l}let SS=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;class Kr extends Date{#s=!1;#t=!1;#e=null;constructor(l){let r=!0,c=!0,d="Z";if(typeof l=="string"){let u=l.match(SS);u?(u[1]||(r=!1,l=`0000-01-01T${l}`),c=!!u[2],c&&l[10]===" "&&(l=l.replace(" ","T")),u[2]&&+u[2]>23?l="":(d=u[3]||null,l=l.toUpperCase(),!d&&c&&(l+="Z"))):l=""}super(l),isNaN(this.getTime())||(this.#s=r,this.#t=c,this.#e=d)}isDateTime(){return this.#s&&this.#t}isLocal(){return!this.#s||!this.#t||!this.#e}isDate(){return this.#s&&!this.#t}isTime(){return this.#t&&!this.#s}isValid(){return this.#s||this.#t}toISOString(){let l=super.toISOString();if(this.isDate())return l.slice(0,10);if(this.isTime())return l.slice(11,23);if(this.#e===null)return l.slice(0,-1);if(this.#e==="Z")return l;let r=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return r=this.#e[0]==="-"?r:-r,new Date(this.getTime()-r*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(l,r="Z"){let c=new Kr(l);return c.#e=r,c}static wrapAsLocalDateTime(l){let r=new Kr(l);return r.#e=null,r}static wrapAsLocalDate(l){let r=new Kr(l);return r.#t=!1,r.#e=null,r}static wrapAsLocalTime(l){let r=new Kr(l);return r.#s=!1,r.#e=null,r}}let kS=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,CS=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,TS=/^[+-]?0[0-9_]/,ES=/^[0-9a-f]{4,8}$/i,Ig={b:"\b",t:" ",n:` -`,f:"\f",r:"\r",'"':'"',"\\":"\\"};function Vv(a,l=0,r=a.length){let c=a[l]==="'",d=a[l++]===a[l]&&a[l]===a[l+1];d&&(r-=2,a[l+=2]==="\r"&&l++,a[l]===` -`&&l++);let u=0,h,f="",p=l;for(;l-1&&(gx(a,u),d=d.slice(0,u));let h=d.trimEnd();if(!c){let f=d.indexOf(` -`,h.length);if(f>-1)throw new Ts("newlines are not allowed in inline tables",{toml:a,ptr:l+f})}return[h,u]}function jx(a,l,r,c,d){if(c===0)throw new Ts("document contains excessively nested structures. aborting.",{toml:a,ptr:l});let u=a[l];if(u==="["||u==="{"){let[p,g]=u==="["?DS(a,l,c,d):RS(a,l,c,d),b=r?Bg(a,g,",",r):g;if(g-b&&r==="}"){let j=Yo(a,g,b);if(j>-1)throw new Ts("newlines are not allowed in inline tables",{toml:a,ptr:j})}return[p,b]}let h;if(u==='"'||u==="'"){h=Hv(a,l);let p=Vv(a,l,h);if(r){if(h=Ol(a,h,r!=="]"),a[h]&&a[h]!==","&&a[h]!==r&&a[h]!==` -`&&a[h]!=="\r")throw new Ts("unexpected character encountered",{toml:a,ptr:h});h+=+(a[h]===",")}return[p,h]}h=Bg(a,l,",",r);let f=AS(a,l,h-+(a[h-1]===","),r==="]");if(!f[0])throw new Ts("incomplete key-value declaration: no value specified",{toml:a,ptr:l});return r&&f[1]>-1&&(h=Ol(a,l+f[1]),h+=+(a[h]===",")),[MS(f[0],a,l,d),h]}let zS=/^[a-zA-Z0-9-_]+[ \t]*$/;function Xm(a,l,r="="){let c=l-1,d=[],u=a.indexOf(r,l);if(u<0)throw new Ts("incomplete key-value: cannot find end of key",{toml:a,ptr:l});do{let h=a[l=++c];if(h!==" "&&h!==" ")if(h==='"'||h==="'"){if(h===a[l+1]&&h===a[l+2])throw new Ts("multiline strings are not allowed in keys",{toml:a,ptr:l});let f=Hv(a,l);if(f<0)throw new Ts("unfinished string encountered",{toml:a,ptr:l});c=a.indexOf(".",f);let p=a.slice(f,c<0||c>u?u:c),g=Yo(p);if(g>-1)throw new Ts("newlines are not allowed in keys",{toml:a,ptr:l+c+g});if(p.trimStart())throw new Ts("found extra tokens after the string part",{toml:a,ptr:f});if(uu?u:c);if(!zS.test(f))throw new Ts("only letter, numbers, dashes and underscores are allowed in keys",{toml:a,ptr:l});d.push(f.trimEnd())}}while(c+1&&c{try{l(!0),await xS(y,N),r(!1),u?.()}catch(w){console.error(`自动保存 ${y} 失败:`,w),r(!0),h?.(w instanceof Error?w:new Error(String(w)))}finally{l(!1)}},[l,r,u,h]),g=m.useCallback((y,N)=>{a||(r(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{p(y,N)},d))},[a,r,p,d]),b=m.useCallback(async(y,N)=>{f.current&&(clearTimeout(f.current),f.current=null),await p(y,N)},[p]),j=m.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null)},[]);return m.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]),{triggerAutoSave:g,saveNow:b,cancelPendingAutoSave:j}}function Bt(a,l,r,c){m.useEffect(()=>{a&&!r&&c(l,a)},[a])}const PS=500;function FS(){return e.jsx(Wn,{children:e.jsx(HS,{})})}function HS(){const[a,l]=m.useState(!0),[r,c]=m.useState(!1),[d,u]=m.useState(!1),[h,f]=m.useState(!1),[p,g]=m.useState("visual"),[b,j]=m.useState(""),[y,N]=m.useState(!1),[w,M]=m.useState(""),{toast:A}=Ws(),{triggerRestart:S,isRestarting:U}=yn(),[E,C]=m.useState(null),[D,P]=m.useState(null),[O,J]=m.useState(null),[L,oe]=m.useState(null),[Ne,je]=m.useState(null),[de,he]=m.useState(null),[ge,R]=m.useState(null),[Q,$]=m.useState(null),[ue,G]=m.useState(null),[Se,fe]=m.useState(null),[Te,q]=m.useState(null),[B,z]=m.useState(null),[K,Ae]=m.useState(null),[ee,Y]=m.useState(null),[$e,H]=m.useState(null),[se,Ue]=m.useState(null),[ie,Ee]=m.useState(null),[me,ze]=m.useState(null),[at,Pt]=m.useState(null),[qt,Ja]=m.useState(null),As=m.useRef(!0),vt=m.useRef({}),Z=Le=>{const bs=Le.split(` -`);let _s=bs[0];_s=_s.replace(/^Error:\s*/,"");const rs=[[/Invalid TOML document: unrecognized escape sequence/,"TOML 文档错误:无法识别的转义序列(提示:在双引号字符串中使用 \\\\ 转义反斜杠,或使用单引号字符串)"],[/Invalid TOML document: only letter, numbers, dashes and underscores are allowed in keys/,"TOML 文档错误:键名只能包含字母、数字、短横线和下划线"],[/Invalid TOML document: (.+)/,"TOML 文档错误:$1"],[/Unexpected character.*at line (\d+), column (\d+)/,"第 $1 行第 $2 列:意外的字符"],[/Expected.*at line (\d+), column (\d+)/,"第 $1 行第 $2 列:缺少必要的字符"],[/Invalid.*at line (\d+), column (\d+)/,"第 $1 行第 $2 列:无效的语法"],[/Unterminated string at line (\d+)/,"第 $1 行:字符串未正常结束(缺少引号)"],[/Duplicate key.*at line (\d+)/,"第 $1 行:重复的键名"],[/Invalid escape sequence at line (\d+)/,"第 $1 行:无效的转义序列(提示:在双引号字符串中使用 \\\\ 转义反斜杠)"],[/Expected.*but got.*at line (\d+)/,"第 $1 行:类型不匹配"],[/line (\d+), column (\d+)/,"第 $1 行第 $2 列"],[/Unexpected end of input/,"意外的文件结束(可能缺少闭合符号)"],[/Unexpected token/,"意外的标记"],[/Invalid number/,"无效的数字"],[/Invalid date/,"无效的日期格式"],[/Invalid boolean/,"无效的布尔值(应为 true 或 false)"],[/Unexpected character/,"意外的字符"],[/unrecognized escape sequence/,"无法识别的转义序列"]];for(const[ft,zt]of rs)if(ft.test(_s)){_s=_s.replace(ft,zt);break}return bs.length>1?(bs[0]=_s,bs.join(` -`)):_s},qe=m.useCallback(Le=>{vt.current=Le,C(Le.bot),P(Le.personality);const bs=Le.chat;bs.talk_value_rules||(bs.talk_value_rules=[]),J(bs),oe(Le.expression),je(Le.emoji),he(Le.memory),R(Le.tool),$(Le.voice),G(Le.message_receive),fe(Le.dream),q(Le.lpmm_knowledge),z(Le.keyword_reaction),Ae(Le.response_post_process),Y(Le.chinese_typo),H(Le.response_splitter),Ue(Le.log),Ee(Le.debug),ze(Le.maim_message),Pt(Le.telemetry),Ja(Le.webui)},[]),Qe=m.useCallback(()=>({...vt.current,bot:E,personality:D,chat:O,expression:L,emoji:Ne,memory:de,tool:ge,voice:Q,message_receive:ue,dream:Se,lpmm_knowledge:Te,keyword_reaction:B,response_post_process:K,chinese_typo:ee,response_splitter:$e,log:se,debug:ie,maim_message:me,telemetry:at,webui:qt}),[E,D,O,L,Ne,de,ge,Q,ue,Se,Te,B,K,ee,$e,se,ie,me,at,qt]),We=m.useCallback(async()=>{try{const bs=(await uS()).replace(/"([^"]*)"/g,(_s,rs)=>`"${rs.replace(/\\n/g,` -`).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\\\/g,"\\")}"`);j(bs),N(!1)}catch(Le){A({variant:"destructive",title:"加载失败",description:Le instanceof Error?Le.message:"加载源代码失败"})}},[A]),Rs=m.useCallback(async()=>{try{l(!0);const Le=await Ug();qe(Le),f(!1),As.current=!1,await We()}catch(Le){console.error("加载配置失败:",Le),A({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{l(!1)}},[A,We,qe]);m.useEffect(()=>{Rs()},[Rs]);const{triggerAutoSave:He,cancelPendingAutoSave:Ss}=IS(As.current,u,f);Bt(E,"bot",As.current,He),Bt(D,"personality",As.current,He),Bt(O,"chat",As.current,He),Bt(L,"expression",As.current,He),Bt(Ne,"emoji",As.current,He),Bt(de,"memory",As.current,He),Bt(ge,"tool",As.current,He),Bt(Q,"voice",As.current,He),Bt(Se,"dream",As.current,He),Bt(Te,"lpmm_knowledge",As.current,He),Bt(B,"keyword_reaction",As.current,He),Bt(K,"response_post_process",As.current,He),Bt(ee,"chinese_typo",As.current,He),Bt($e,"response_splitter",As.current,He),Bt(se,"log",As.current,He),Bt(ie,"debug",As.current,He),Bt(me,"maim_message",As.current,He),Bt(at,"telemetry",As.current,He),Bt(qt,"webui",As.current,He);const Ds=async()=>{try{c(!0);try{vx(b)}catch(bs){const _s=bs instanceof Error?bs.message:"TOML 格式错误",rs=Z(_s);N(!0),M(rs),A({variant:"destructive",title:"TOML 格式错误",description:rs}),c(!1);return}const Le=b.replace(/"([^"]*)"/g,(bs,_s)=>`"${_s.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")}"`);await mS(Le),f(!1),N(!1),M(""),A({title:"保存成功",description:"配置已保存"}),await Rs()}catch(Le){N(!0);const bs=Le instanceof Error?Le.message:"保存配置失败";M(bs),A({variant:"destructive",title:"保存失败",description:bs})}finally{c(!1)}},Vs=async Le=>{if(h){A({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}if(g(Le),Le==="source")await We();else try{const bs=await Ug();qe(bs),f(!1)}catch(bs){console.error("加载配置失败:",bs),A({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}},ns=async()=>{try{c(!0),Ss(),await $g(Qe()),f(!1),A({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(Le){console.error("保存配置失败:",Le),A({title:"保存失败",description:Le.message,variant:"destructive"})}finally{c(!1)}},ts=async()=>{await S()},Ns=async()=>{try{c(!0),Ss(),await $g(Qe()),f(!1),A({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(Le=>setTimeout(Le,PS)),await ts()}catch(Le){console.error("保存失败:",Le),A({title:"保存失败",description:Le.message,variant:"destructive"})}finally{c(!1)}};return a?e.jsx(Ze,{className:"h-full",children:e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl md:text-3xl font-bold",children:"麦麦主程序配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs sm:text-sm",children:"管理麦麦的核心功能和行为设置"})]}),e.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[e.jsxs(_,{onClick:p==="visual"?ns:Ds,disabled:r||d||!h||U,size:"sm",variant:"outline",className:"w-20 sm:w-24",children:[e.jsx(fc,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:r?"保存中":d?"自动":h?"保存":"已保存"})]}),e.jsxs(gs,{children:[e.jsx(jt,{asChild:!0,children:e.jsxs(_,{disabled:r||d||U,size:"sm",className:"w-20 sm:w-28",children:[e.jsx(hc,{className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:U?"重启中":h?"保存重启":"重启"})]})}),e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认重启麦麦?"}),e.jsx(ms,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:h?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:h?Ns:ts,children:h?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsx("div",{className:"flex",children:e.jsx(ea,{value:p,onValueChange:Le=>Vs(Le),className:"w-full",children:e.jsxs(Gt,{className:"h-8 sm:h-9 w-full grid grid-cols-2",children:[e.jsxs(Xe,{value:"visual",className:"text-xs sm:text-sm",children:[e.jsx(lv,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化编辑"]}),e.jsxs(Xe,{value:"source",className:"text-xs sm:text-sm",children:[e.jsx(nv,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码编辑"]})]})})})]}),e.jsxs(it,{children:[e.jsx(Vt,{className:"h-4 w-4"}),e.jsxs(ct,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),p==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(it,{children:[e.jsx(Vt,{className:"h-4 w-4"}),e.jsxs(ct,{children:[e.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在前端验证格式,只有格式完全正确才能保存。",y&&w&&e.jsxs("div",{className:"text-destructive font-semibold mt-3 p-3 bg-destructive/10 rounded-md",children:[e.jsx("div",{className:"font-bold mb-2",children:"⚠️ TOML 格式错误:"}),e.jsx("pre",{className:"text-sm font-mono whitespace-pre-wrap break-words",children:w})]})]})]}),e.jsx(Fv,{value:b,onChange:Le=>{j(Le),f(!0),y&&(N(!1),M(""))},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),p==="visual"&&e.jsx(e.Fragment,{children:e.jsxs(ea,{defaultValue:"bot",className:"w-full",children:[e.jsxs(Gt,{className:"flex flex-wrap h-auto gap-1 p-1 sm:grid sm:grid-cols-5 lg:grid-cols-10",children:[e.jsx(Xe,{value:"bot",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"基本信息"}),e.jsx(Xe,{value:"personality",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"人格"}),e.jsx(Xe,{value:"chat",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"聊天"}),e.jsx(Xe,{value:"expression",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"表达"}),e.jsx(Xe,{value:"features",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"功能"}),e.jsx(Xe,{value:"processing",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"处理"}),e.jsx(Xe,{value:"dream",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"做梦"}),e.jsx(Xe,{value:"lpmm",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"知识库"}),e.jsx(Xe,{value:"webui",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"WebUI"}),e.jsx(Xe,{value:"other",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"其他"})]}),e.jsx(vs,{value:"bot",className:"space-y-4",children:E&&e.jsx(K2,{config:E,onChange:C})}),e.jsx(vs,{value:"personality",className:"space-y-4",children:D&&e.jsx(Q2,{config:D,onChange:P})}),e.jsx(vs,{value:"chat",className:"space-y-4",children:O&&e.jsx(X2,{config:O,onChange:J})}),e.jsx(vs,{value:"expression",className:"space-y-4",children:L&&e.jsx(rS,{config:L,onChange:oe})}),e.jsx(vs,{value:"features",className:"space-y-4",children:Ne&&de&&ge&&Q&&e.jsx(lS,{emojiConfig:Ne,memoryConfig:de,toolConfig:ge,voiceConfig:Q,onEmojiChange:je,onMemoryChange:he,onToolChange:R,onVoiceChange:$})}),e.jsxs(vs,{value:"processing",className:"space-y-4",children:[B&&K&&ee&&$e&&e.jsx(cS,{keywordReactionConfig:B,responsePostProcessConfig:K,chineseTypoConfig:ee,responseSplitterConfig:$e,onKeywordReactionChange:z,onResponsePostProcessChange:Ae,onChineseTypoChange:Y,onResponseSplitterChange:H}),ue&&e.jsx(oS,{config:ue,onChange:G})]}),e.jsx(vs,{value:"dream",className:"space-y-4",children:Se&&e.jsx(Z2,{config:Se,onChange:fe})}),e.jsx(vs,{value:"lpmm",className:"space-y-4",children:Te&&e.jsx(W2,{config:Te,onChange:q})}),e.jsx(vs,{value:"webui",className:"space-y-4",children:qt&&e.jsx(dS,{config:qt,onChange:Ja})}),e.jsxs(vs,{value:"other",className:"space-y-4",children:[se&&e.jsx(eS,{config:se,onChange:Ue}),ie&&e.jsx(sS,{config:ie,onChange:Ee}),me&&e.jsx(tS,{config:me,onChange:ze}),at&&e.jsx(aS,{config:at,onChange:Pt})]})]})}),e.jsx(er,{})]})})}const Ul=m.forwardRef(({className:a,...l},r)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:r,className:F("w-full caption-bottom text-sm",a),...l})}));Ul.displayName="Table";const $l=m.forwardRef(({className:a,...l},r)=>e.jsx("thead",{ref:r,className:F("[&_tr]:border-b",a),...l}));$l.displayName="TableHeader";const Bl=m.forwardRef(({className:a,...l},r)=>e.jsx("tbody",{ref:r,className:F("[&_tr:last-child]:border-0",a),...l}));Bl.displayName="TableBody";const VS=m.forwardRef(({className:a,...l},r)=>e.jsx("tfoot",{ref:r,className:F("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",a),...l}));VS.displayName="TableFooter";const ht=m.forwardRef(({className:a,...l},r)=>e.jsx("tr",{ref:r,className:F("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",a),...l}));ht.displayName="TableRow";const ss=m.forwardRef(({className:a,...l},r)=>e.jsx("th",{ref:r,className:F("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...l}));ss.displayName="TableHead";const Ye=m.forwardRef(({className:a,...l},r)=>e.jsx("td",{ref:r,className:F("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...l}));Ye.displayName="TableCell";const GS=m.forwardRef(({className:a,...l},r)=>e.jsx("caption",{ref:r,className:F("mt-4 text-sm text-muted-foreground",a),...l}));GS.displayName="TableCaption";const dd=m.forwardRef(({className:a,...l},r)=>e.jsx(ja,{ref:r,className:F("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",a),...l}));dd.displayName=ja.displayName;const ud=m.forwardRef(({className:a,...l},r)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(At,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(ja.Input,{ref:r,className:F("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",a),...l})]}));ud.displayName=ja.Input.displayName;const md=m.forwardRef(({className:a,...l},r)=>e.jsx(ja.List,{ref:r,className:F("max-h-[300px] overflow-y-auto overflow-x-hidden",a),...l}));md.displayName=ja.List.displayName;const xd=m.forwardRef((a,l)=>e.jsx(ja.Empty,{ref:l,className:"py-6 text-center text-sm",...a}));xd.displayName=ja.Empty.displayName;const oc=m.forwardRef(({className:a,...l},r)=>e.jsx(ja.Group,{ref:r,className:F("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",a),...l}));oc.displayName=ja.Group.displayName;const qS=m.forwardRef(({className:a,...l},r)=>e.jsx(ja.Separator,{ref:r,className:F("-mx-1 h-px bg-border",a),...l}));qS.displayName=ja.Separator.displayName;const dc=m.forwardRef(({className:a,...l},r)=>e.jsx(ja.Item,{ref:r,className:F("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",a),...l}));dc.displayName=ja.Item.displayName;const qv=m.createContext(null),Kv="maibot-completed-tours";function KS(){try{const a=localStorage.getItem(Kv);return a?new Set(JSON.parse(a)):new Set}catch{return new Set}}function Fg(a){localStorage.setItem(Kv,JSON.stringify([...a]))}function QS({children:a}){const[l,r]=m.useState({activeTourId:null,stepIndex:0,isRunning:!1}),[c]=m.useState(()=>new Map),[d,u]=m.useState(KS),[,h]=m.useState(0),f=m.useCallback((E,C)=>{c.set(E,C),h(D=>D+1)},[c]),p=m.useCallback(E=>{c.delete(E),r(C=>C.activeTourId===E?{...C,activeTourId:null,isRunning:!1,stepIndex:0}:C)},[c]),g=m.useCallback((E,C=0)=>{c.has(E)&&r({activeTourId:E,stepIndex:C,isRunning:!0})},[c]),b=m.useCallback(()=>{r(E=>({...E,isRunning:!1}))},[]),j=m.useCallback(E=>{r(C=>({...C,stepIndex:E}))},[]),y=m.useCallback(()=>{r(E=>({...E,stepIndex:E.stepIndex+1}))},[]),N=m.useCallback(()=>{r(E=>({...E,stepIndex:Math.max(0,E.stepIndex-1)}))},[]),w=m.useCallback(()=>l.activeTourId?c.get(l.activeTourId)||[]:[],[l.activeTourId,c]),M=m.useCallback(E=>{u(C=>{const D=new Set(C);return D.add(E),Fg(D),D})},[]),A=m.useCallback(E=>{const{action:C,index:D,status:P,type:O}=E,J=["finished","skipped"];if(C==="close"){r(L=>({...L,isRunning:!1,stepIndex:0}));return}J.includes(P)?r(L=>(P==="finished"&&L.activeTourId&&setTimeout(()=>M(L.activeTourId),0),{...L,isRunning:!1,stepIndex:0})):O==="step:after"&&(C==="next"?r(L=>({...L,stepIndex:D+1})):C==="prev"&&r(L=>({...L,stepIndex:D-1})))},[M]),S=m.useCallback(E=>d.has(E),[d]),U=m.useCallback(E=>{u(C=>{const D=new Set(C);return D.delete(E),Fg(D),D})},[]);return e.jsx(qv.Provider,{value:{state:l,tours:c,registerTour:f,unregisterTour:p,startTour:g,stopTour:b,goToStep:j,nextStep:y,prevStep:N,getCurrentSteps:w,handleJoyrideCallback:A,isTourCompleted:S,markTourCompleted:M,resetTourCompleted:U},children:a})}function wx(){const a=m.useContext(qv);if(!a)throw new Error("useTour must be used within a TourProvider");return a}const YS={options:{zIndex:1e4,primaryColor:"hsl(var(--primary))",textColor:"hsl(var(--foreground))",backgroundColor:"hsl(var(--background))",arrowColor:"hsl(var(--background))",overlayColor:"rgba(0, 0, 0, 0.5)"},tooltip:{borderRadius:"var(--radius)",padding:"1rem"},tooltipContainer:{textAlign:"left"},tooltipTitle:{fontSize:"1rem",fontWeight:600,marginBottom:"0.5rem"},tooltipContent:{fontSize:"0.875rem",padding:"0.5rem 0"},buttonNext:{backgroundColor:"hsl(var(--primary))",color:"hsl(var(--primary-foreground))",borderRadius:"calc(var(--radius) - 2px)",fontSize:"0.875rem",padding:"0.5rem 1rem"},buttonBack:{color:"hsl(var(--muted-foreground))",fontSize:"0.875rem",marginRight:"0.5rem"},buttonSkip:{color:"hsl(var(--muted-foreground))",fontSize:"0.875rem"},buttonClose:{color:"hsl(var(--muted-foreground))"},spotlight:{borderRadius:"var(--radius)"}},JS={back:"上一步",close:"关闭",last:"完成",next:"下一步",nextLabelWithProgress:"下一步 ({step}/{steps})",open:"打开对话框",skip:"跳过"};function XS(){const{state:a,getCurrentSteps:l,handleJoyrideCallback:r}=wx(),c=l(),[d,u]=m.useState(!1),h=m.useRef(a.stepIndex),f=m.useRef(null);m.useEffect(()=>{h.current!==a.stepIndex&&(u(!1),h.current=a.stepIndex)},[a.stepIndex]),m.useEffect(()=>{if(!a.isRunning||c.length===0){u(!1);return}const j=c[a.stepIndex];if(!j){u(!1);return}const y=j.target;if(y==="body"){u(!0);return}u(!1);const N=setTimeout(()=>{const w=()=>{const U=document.querySelector(y);if(U){const E=U.getBoundingClientRect();if(E.width>0&&E.height>0)return!0}return!1};if(w()){setTimeout(()=>u(!0),100);return}const M=setInterval(()=>{w()&&(clearInterval(M),setTimeout(()=>u(!0),100))},100),A=setTimeout(()=>{clearInterval(M),u(!0)},5e3),S=()=>{clearInterval(M),clearTimeout(A)};f.current=S},150);return()=>{clearTimeout(N),f.current&&(f.current(),f.current=null)}},[a.isRunning,a.stepIndex,c]);const[p,g]=m.useState(null);if(m.useEffect(()=>{let j=document.getElementById("tour-portal-container");return j||(j=document.createElement("div"),j.id="tour-portal-container",j.style.cssText="position: fixed; top: 0; left: 0; z-index: 99999; pointer-events: none;",document.body.appendChild(j)),g(j),()=>{}},[]),!a.isRunning||c.length===0||!d)return null;const b=e.jsx(d1,{steps:c,stepIndex:a.stepIndex,run:a.isRunning,continuous:!0,showSkipButton:!0,showProgress:!0,disableOverlayClose:!0,disableScrolling:!1,disableScrollParentFix:!1,callback:r,styles:YS,locale:JS,scrollOffset:80,scrollToFirstStep:!0,floaterProps:{styles:{floater:{zIndex:99999}},disableAnimation:!0}},`tour-step-${a.stepIndex}`);return p?Q0.createPortal(b,p):b}const ol="model-assignment-tour",Qv=[{target:"body",content:"本引导旨在帮助你配置模型提供商和对应的模型,并为麦麦的各个组件分配合适的模型。",placement:"center",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="sidebar-model-provider"]',content:'第一步,你需要配置模型提供商。模型提供商决定了你要使用谁家的模型,无论是单一厂商(如 DeepSeek),还是模型平台(如 Siliconflow),都可以在这里进行配置。点击"下一步"进入配置页面。',placement:"right",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="add-provider-button"]',content:'点击"添加提供商"按钮,开始配置你的模型提供商。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="provider-dialog"]',content:"在这里,你可以选择你想要配置的模型提供商,填写相关信息后保存即可。",placement:"left",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-name-input"]',content:"这里的名称是你为这个模型提供商起的一个名字,方便你在后续使用时识别它。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-apikey-input"]',content:"这里需要填写你从模型提供商那里获取的 API 密钥,用于验证和调用模型服务。对于不同的提供商,获取 API 密钥的方式可能有所不同,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-url-input"]',content:"这里需要填写模型提供商的 API 访问地址,确保填写正确以便系统能够连接到模型服务。对于不同的提供商,API 地址可能有所不同,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-template-select"]',content:"当然,如果你不知道如何填写这些信息,很多模型提供商在这里都提供了预设的模板供你选择,选择对应的模板后,相关信息会自动填充。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-save-button"]',content:"填写完所有信息后,点击保存按钮,模型提供商就配置完成了。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-cancel-button"]',content:"因为这次咱们什么都没有填写,所以点击取消按钮退出吧。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="sidebar-model-management"]',content:'配置好模型提供商后,接下来我们需要为麦麦添加模型并分配功能。点击"下一步"进入模型管理页面。',placement:"right",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="add-model-button"]',content:'在为麦麦的组件分配模型之前,首先需要添加你想要分配的模型,点击"添加模型"按钮开始添加。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="model-dialog"]',content:"在这里,你可以选择你之前配置好的模型提供商,然后选择对应的模型来添加。",placement:"left",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-name-input"]',content:"这里的模型名称是你为这个模型起的一个名字,方便你在后续使用时识别它。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-provider-select"]',content:"在这里选择你之前配置好的模型提供商,这样系统才能知道你要添加哪个提供商的模型。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-identifier-input"]',content:"这里需要填写你想要添加的模型的标识符,不同的模型提供商可能有不同的标识符格式,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-save-button"]',content:"填写完所有信息后,点击保存按钮,模型就添加完成了。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-cancel-button"]',content:"当然,因为这次咱们什么都没有填写,所以直接点击取消按钮退出吧,等你准备好了再来添加模型。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="tasks-tab-trigger"]',content:'最后一步,添加好模型后,切换到"为模型分配功能"标签页,为麦麦的各个组件分配合适的模型。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="task-model-select"]',content:"在这里,你可以为每个组件选择一个或多个合适的模型,选择完成后配置会自动保存。恭喜你完成了模型配置的学习!",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1}],Yv={0:"/config/model",1:"/config/model",2:"/config/modelProvider",3:"/config/modelProvider",4:"/config/modelProvider",5:"/config/modelProvider",6:"/config/modelProvider",7:"/config/modelProvider",8:"/config/modelProvider",9:"/config/modelProvider",10:"/config/modelProvider",11:"/config/model",12:"/config/model",13:"/config/model",14:"/config/model",15:"/config/model",16:"/config/model",17:"/config/model",18:"/config/model",19:"/config/model"},Xi=[{id:"siliconflow",name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",client_type:"openai",display_name:"硅基流动 (SiliconFlow)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"deepseek",name:"DeepSeek",base_url:"https://api.deepseek.com",client_type:"openai",display_name:"DeepSeek",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"rinkoai",name:"RinkoAI",base_url:"https://rinkoai.com/v1",client_type:"openai",display_name:"RinkoAI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"zhipu",name:"ZhipuAI",base_url:"https://open.bigmodel.cn/api/paas/v4",client_type:"openai",display_name:"智谱 AI (ZhipuAI / GLM)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"moonshot",name:"Moonshot",base_url:"https://api.moonshot.cn/v1",client_type:"openai",display_name:"月之暗面 (Moonshot / Kimi)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"doubao",name:"Doubao",base_url:"https://ark.cn-beijing.volces.com/api/v3",client_type:"openai",display_name:"字节豆包 (Doubao)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"alibaba",name:"Alibaba",base_url:"https://dashscope.aliyuncs.com/compatible-mode/v1",client_type:"openai",display_name:"阿里云百炼 (Alibaba Qwen)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"baichuan",name:"Baichuan",base_url:"https://api.baichuan-ai.com/v1",client_type:"openai",display_name:"百川智能 (Baichuan)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"minimax",name:"MiniMax",base_url:"https://api.minimax.chat/v1",client_type:"openai",display_name:"MiniMax (海螺 AI)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"stepfun",name:"StepFun",base_url:"https://api.stepfun.com/v1",client_type:"openai",display_name:"阶跃星辰 (StepFun)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"lingyi",name:"Lingyi",base_url:"https://api.lingyiwanwu.com/v1",client_type:"openai",display_name:"零一万物 (Lingyi / Yi)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"openai",name:"OpenAI",base_url:"https://api.openai.com/v1",client_type:"openai",display_name:"OpenAI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"xai",name:"xAI",base_url:"https://api.x.ai/v1",client_type:"openai",display_name:"xAI (Grok)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"anthropic",name:"Anthropic",base_url:"https://api.anthropic.com/v1",client_type:"openai",display_name:"Anthropic (Claude)"},{id:"gemini",name:"Gemini",base_url:"https://generativelanguage.googleapis.com/v1beta",client_type:"gemini",display_name:"Google Gemini",modelFetcher:{endpoint:"/models",parser:"gemini"}},{id:"cohere",name:"Cohere",base_url:"https://api.cohere.ai/v1",client_type:"openai",display_name:"Cohere"},{id:"groq",name:"Groq",base_url:"https://api.groq.com/openai/v1",client_type:"openai",display_name:"Groq",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"together",name:"Together AI",base_url:"https://api.together.xyz/v1",client_type:"openai",display_name:"Together AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"fireworks",name:"Fireworks",base_url:"https://api.fireworks.ai/inference/v1",client_type:"openai",display_name:"Fireworks AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"mistral",name:"Mistral",base_url:"https://api.mistral.ai/v1",client_type:"openai",display_name:"Mistral AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"perplexity",name:"Perplexity",base_url:"https://api.perplexity.ai",client_type:"openai",display_name:"Perplexity AI"},{id:"custom",name:"",base_url:"",client_type:"openai",display_name:"自定义"}];function Hg(a){return a?a.replace(/\/+$/,"").toLowerCase():""}function ZS(a){if(!a)return null;const l=Hg(a);return Xi.find(r=>r.id!=="custom"&&Hg(r.base_url)===l)||null}const Do=a=>({...a,max_retry:a.max_retry??2,timeout:a.timeout??30,retry_interval:a.retry_interval??10}),WS=(a,l=[],r=null)=>{const c={};return a?(a.name?.trim()?l.some((u,h)=>r!==null&&h===r?!1:u.name.trim().toLowerCase()===a.name.trim().toLowerCase())&&(c.name="提供商名称已存在,请使用其他名称"):c.name="请输入提供商名称",a.base_url?.trim()||(c.base_url="请输入基础 URL"),a.api_key?.trim()||(c.api_key="请输入 API Key"),{isValid:Object.keys(c).length===0,errors:c}):{isValid:!1,errors:{name:"提供商数据为空"}}};function e4(){return e.jsx(Wn,{children:e.jsx(s4,{})})}function s4(){const[a,l]=m.useState([]),[r,c]=m.useState(!0),[d,u]=m.useState(!1),[h,f]=m.useState(!1),[p,g]=m.useState(!1),[b,j]=m.useState(!1),[y,N]=m.useState(null),[w,M]=m.useState(null),[A,S]=m.useState("custom"),[U,E]=m.useState(!1),[C,D]=m.useState(!1),[P,O]=m.useState(null),[J,L]=m.useState(!1),[oe,Ne]=m.useState(""),[je,de]=m.useState(new Set),[he,ge]=m.useState(!1),[R,Q]=m.useState(1),[$,ue]=m.useState(20),[G,Se]=m.useState(""),[fe,Te]=m.useState({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),[q,B]=m.useState({}),[z,K]=m.useState(new Set),[Ae,ee]=m.useState(new Map),{toast:Y}=Ws(),$e=ca(),{state:H,goToStep:se,registerTour:Ue}=wx(),{triggerRestart:ie,isRestarting:Ee}=yn(),me=m.useRef(null),ze=m.useRef(!0);m.useEffect(()=>{Ue(ol,Qv)},[Ue]),m.useEffect(()=>{if(H.activeTourId===ol&&H.isRunning){const te=Yv[H.stepIndex];te&&!window.location.pathname.endsWith(te.replace("/config/",""))&&$e({to:te})}},[H.stepIndex,H.activeTourId,H.isRunning,$e]);const at=m.useRef(H.stepIndex);m.useEffect(()=>{if(H.activeTourId===ol&&H.isRunning){const te=at.current,we=H.stepIndex;te>=3&&te<=9&&we<3&&j(!1),te>=10&&we>=3&&we<=9&&(B({}),S("custom"),N({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),M(null),L(!1),j(!0)),at.current=we}},[H.stepIndex,H.activeTourId,H.isRunning]),m.useEffect(()=>{if(H.activeTourId!==ol||!H.isRunning)return;const te=we=>{const Oe=we.target,Gs=H.stepIndex;Gs===2&&Oe.closest('[data-tour="add-provider-button"]')?setTimeout(()=>se(3),300):Gs===9&&Oe.closest('[data-tour="provider-cancel-button"]')&&setTimeout(()=>se(10),300)};return document.addEventListener("click",te,!0),()=>document.removeEventListener("click",te,!0)},[H,se]),m.useEffect(()=>{Pt()},[]);const Pt=async()=>{try{c(!0);const te=await xn();l(te.api_providers||[]),g(!1),ze.current=!1}catch(te){console.error("加载配置失败:",te)}finally{c(!1)}},qt=async()=>{await ie()},Ja=async()=>{try{u(!0),me.current&&clearTimeout(me.current);const te=a.map(dt=>({...dt,max_retry:dt.max_retry??2,timeout:dt.timeout??30,retry_interval:dt.retry_interval??10})),{shouldProceed:we}=await As(te,"restart");if(!we){u(!1);return}const Oe=await xn(),Gs=new Set(te.map(dt=>dt.name)),ta=(Oe.models||[]).filter(dt=>Gs.has(dt.api_provider));Oe.api_providers=te,Oe.models=ta,await tc(Oe),g(!1),Y({title:"保存成功",description:"正在重启麦麦..."}),await qt()}catch(te){console.error("保存配置失败:",te),Y({title:"保存失败",description:te.message,variant:"destructive"}),u(!1)}},As=m.useCallback(async(te,we="auto")=>{try{const Oe=await xn(),Gs=new Set(a.map(pt=>pt.name)),Ut=new Set(te.map(pt=>pt.name)),ta=Array.from(Gs).filter(pt=>!Ut.has(pt));if(ta.length===0)return{shouldProceed:!0,providers:te};const aa=(Oe.models||[]).filter(pt=>ta.includes(pt.api_provider));return aa.length===0?{shouldProceed:!0,providers:te}:(Te({isOpen:!0,providersToDelete:ta,affectedModels:aa,pendingProviders:te,context:we,oldProviders:[...a]}),{shouldProceed:!1,providers:te})}catch(Oe){return console.error("检查删除影响失败:",Oe),{shouldProceed:!0,providers:te}}},[a]),vt=async()=>{try{(fe.context==="auto"?f:u)(!0),Te(pt=>({...pt,isOpen:!1}));const we=await xn(),Oe=fe.pendingProviders.map(Do),Gs=new Set(Oe.map(pt=>pt.name)),ta=(we.models||[]).filter(pt=>Gs.has(pt.api_provider)),dt=new Set(fe.affectedModels.map(pt=>pt.name)),aa=we.model_task_config;aa&&Object.keys(aa).forEach(pt=>{const re=aa[pt];re&&Array.isArray(re.model_list)&&(re.model_list=re.model_list.filter(pe=>!dt.has(pe)))}),we.api_providers=Oe,we.models=ta,we.model_task_config=aa,await tc(we),l(fe.pendingProviders),g(!1),Y({title:"删除成功",description:`已删除 ${fe.providersToDelete.length} 个提供商和 ${fe.affectedModels.length} 个关联模型`}),Te({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),de(new Set),fe.context==="restart"&&await qt()}catch(te){console.error("删除失败:",te),Y({title:"删除失败",description:te.message,variant:"destructive"})}finally{fe.context==="auto"?f(!1):u(!1)}},Z=()=>{fe.oldProviders.length>0&&l(fe.oldProviders),Te({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),g(!1)},qe=m.useCallback(async te=>{if(ze.current)return;const{shouldProceed:we}=await As(te,"auto");if(!we){g(!0);return}try{f(!0);const Oe=te.map(Do);await Jm("api_providers",Oe),g(!1)}catch(Oe){console.error("自动保存失败:",Oe),Y({title:"自动保存失败",description:Oe.message,variant:"destructive"}),g(!0)}finally{f(!1)}},[a,As]);m.useEffect(()=>{if(!ze.current)return g(!0),me.current&&clearTimeout(me.current),me.current=setTimeout(()=>{qe(a)},2e3),()=>{me.current&&clearTimeout(me.current)}},[a,qe]);const Qe=async()=>{try{u(!0),me.current&&clearTimeout(me.current);const te=a.map(Do),{shouldProceed:we}=await As(te,"manual");if(!we){u(!1);return}const Oe=await xn(),Gs=new Set(te.map(dt=>dt.name)),Ut=Oe.models||[],ta=Ut.filter(dt=>{const aa=Gs.has(dt.api_provider);return aa||console.warn(`模型 "${dt.name}" 引用了已删除的提供商 "${dt.api_provider}",将被移除`),aa});if(Ut.length!==ta.length){const dt=Ut.length-ta.length;Y({title:"注意",description:`已自动移除 ${dt} 个引用已删除提供商的模型`,variant:"default"})}console.log("发送的 providers 数据:",te),Oe.api_providers=te,Oe.models=ta,console.log("完整配置数据:",Oe),await tc(Oe),g(!1),Y({title:"保存成功",description:"模型提供商配置已保存"})}catch(te){console.error("保存配置失败:",te),Y({title:"保存失败",description:te.message,variant:"destructive"})}finally{u(!1)}},We=(te,we)=>{if(B({}),te){const Oe=Xi.find(Gs=>Gs.base_url===te.base_url&&Gs.client_type===te.client_type);S(Oe?.id||"custom"),N(te)}else S("custom"),N({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});M(we),L(!1),j(!0)},Rs=m.useCallback(te=>{S(te),E(!1);const we=Xi.find(Oe=>Oe.id===te);we&&we.id!=="custom"?N(Oe=>({...Oe,name:we.name,base_url:we.base_url,client_type:we.client_type})):we?.id==="custom"&&N(Oe=>({...Oe,name:"",base_url:"",client_type:"openai"}))},[]),He=m.useMemo(()=>A!=="custom",[A]),Ss=m.useCallback(async()=>{if(y?.api_key)try{await navigator.clipboard.writeText(y.api_key),Y({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{Y({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},[y?.api_key,Y]),Ds=()=>{if(!y)return;const{isValid:te,errors:we}=WS(y,a,w);if(!te){B(we);return}B({});const Oe=Do(y);if(w!==null){const Gs=[...a];Gs[w]=Oe,l(Gs)}else l([...a,Oe]);j(!1),N(null),M(null)},Vs=te=>{if(!te&&y){const we={...y,max_retry:y.max_retry??2,timeout:y.timeout??30,retry_interval:y.retry_interval??10};N(we)}j(te)},ns=te=>{O(te),D(!0)},ts=async()=>{if(P!==null){const te=a.filter((Oe,Gs)=>Gs!==P),{shouldProceed:we}=await As(te,"manual");we&&(l(te),Y({title:"删除成功",description:"提供商已从列表中移除"}))}D(!1),O(null)},Ns=te=>{const we=new Set(je);we.has(te)?we.delete(te):we.add(te),de(we)},Le=()=>{if(je.size===rs.length)de(new Set);else{const te=rs.map((we,Oe)=>a.findIndex(Gs=>Gs===rs[Oe]));de(new Set(te))}},bs=()=>{if(je.size===0){Y({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}ge(!0)},_s=async()=>{const te=a.filter((Oe,Gs)=>!je.has(Gs)),{shouldProceed:we}=await As(te,"manual");we&&(l(te),de(new Set),Y({title:"批量删除成功",description:`已删除 ${je.size} 个提供商`})),ge(!1)},rs=m.useMemo(()=>{if(!oe)return a;const te=oe.toLowerCase();return a.filter(we=>we.name.toLowerCase().includes(te)||we.base_url.toLowerCase().includes(te)||we.client_type.toLowerCase().includes(te))},[a,oe]),{totalPages:ft,paginatedProviders:zt}=m.useMemo(()=>{const te=Math.ceil(rs.length/$),we=rs.slice((R-1)*$,R*$);return{totalPages:te,paginatedProviders:we}},[rs,R,$]),Oa=m.useCallback(()=>{const te=parseInt(G);te>=1&&te<=ft&&(Q(te),Se(""))},[G,ft]),ll=async te=>{K(we=>new Set(we).add(te));try{const we=await fS(te);ee(Oe=>new Map(Oe).set(te,we)),we.network_ok?we.api_key_valid===!0?Y({title:"连接正常",description:`${te} 网络连接正常,API Key 有效 (${we.latency_ms}ms)`}):we.api_key_valid===!1?Y({title:"连接正常但 Key 无效",description:`${te} 网络连接正常,但 API Key 无效或已过期`,variant:"destructive"}):Y({title:"网络连接正常",description:`${te} 可以访问 (${we.latency_ms}ms)`}):Y({title:"连接失败",description:we.error||"无法连接到提供商",variant:"destructive"})}catch(we){Y({title:"测试失败",description:we.message,variant:"destructive"})}finally{K(we=>{const Oe=new Set(we);return Oe.delete(te),Oe})}},xl=async()=>{for(const te of a)await ll(te.name)},sr=te=>{const we=z.has(te),Oe=Ae.get(te);return we?e.jsxs(Ce,{variant:"secondary",className:"gap-1",children:[e.jsx(Os,{className:"h-3 w-3 animate-spin"}),"测试中"]}):Oe?Oe.network_ok?Oe.api_key_valid===!0?e.jsxs(Ce,{className:"gap-1 bg-green-600 hover:bg-green-700",children:[e.jsx(bt,{className:"h-3 w-3"}),"正常"]}):Oe.api_key_valid===!1?e.jsxs(Ce,{variant:"destructive",className:"gap-1",children:[e.jsx(Ct,{className:"h-3 w-3"}),"Key无效"]}):e.jsxs(Ce,{className:"gap-1 bg-blue-600 hover:bg-blue-700",children:[e.jsx(bt,{className:"h-3 w-3"}),"可访问"]}):e.jsxs(Ce,{variant:"destructive",className:"gap-1",children:[e.jsx(Ka,{className:"h-3 w-3"}),"离线"]}):null};return r?e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"AI模型厂商配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 AI 模型厂商的 API 配置"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[je.size>0&&e.jsxs(_,{onClick:bs,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(ls,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",je.size,")"]}),e.jsxs(_,{onClick:xl,size:"sm",variant:"outline",className:"w-full sm:w-auto",disabled:a.length===0||z.size>0,children:[e.jsx(el,{className:"mr-2 h-4 w-4"}),z.size>0?`测试中 (${z.size})`:"测试全部"]}),e.jsxs(_,{onClick:()=>We(null,null),size:"sm",className:"w-full sm:w-auto","data-tour":"add-provider-button",children:[e.jsx(Ys,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),e.jsxs(_,{onClick:Qe,disabled:d||h||!p||Ee,size:"sm",variant:"outline",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(fc,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),d?"保存中...":h?"自动保存中...":p?"保存配置":"已保存"]}),e.jsxs(gs,{children:[e.jsx(jt,{asChild:!0,children:e.jsxs(_,{disabled:d||h||Ee,size:"sm",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(hc,{className:"mr-2 h-4 w-4"}),Ee?"重启中...":p?"保存并重启":"重启麦麦"]})}),e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认重启麦麦?"}),e.jsx(ms,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:p?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:p?Ja:qt,children:p?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(it,{children:[e.jsx(Vt,{className:"h-4 w-4"}),e.jsxs(ct,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),e.jsxs(Ze,{className:"h-[calc(100vh-260px)]",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[e.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[e.jsx(At,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ae,{placeholder:"搜索提供商名称、URL 或类型...",value:oe,onChange:te=>Ne(te.target.value),className:"pl-9"})]}),oe&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",rs.length," 个结果"]})]}),e.jsx("div",{className:"md:hidden space-y-3",children:rs.length===0?e.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:oe?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):zt.map((te,we)=>{const Oe=a.findIndex(Gs=>Gs===te);return e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:"font-semibold text-base truncate",children:te.name}),sr(te.name)]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:te.base_url})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>ll(te.name),disabled:z.has(te.name),title:"测试连接",children:z.has(te.name)?e.jsx(Os,{className:"h-4 w-4 animate-spin"}):e.jsx(el,{className:"h-4 w-4"})}),e.jsx(_,{variant:"default",size:"sm",onClick:()=>We(te,Oe),children:e.jsx(Kn,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),e.jsx(_,{size:"sm",onClick:()=>ns(Oe),className:"bg-red-600 hover:bg-red-700 text-white",children:e.jsx(ls,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),e.jsx("p",{className:"font-medium",children:te.client_type})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),e.jsx("p",{className:"font-medium",children:te.max_retry})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),e.jsx("p",{className:"font-medium",children:te.timeout})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),e.jsx("p",{className:"font-medium",children:te.retry_interval})]})]})]},we)})}),e.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(Ul,{children:[e.jsx($l,{children:e.jsxs(ht,{children:[e.jsx(ss,{className:"w-12",children:e.jsx(Js,{checked:je.size===rs.length&&rs.length>0,onCheckedChange:Le})}),e.jsx(ss,{children:"状态"}),e.jsx(ss,{children:"名称"}),e.jsx(ss,{children:"基础URL"}),e.jsx(ss,{children:"客户端类型"}),e.jsx(ss,{className:"text-right",children:"最大重试"}),e.jsx(ss,{className:"text-right",children:"超时(秒)"}),e.jsx(ss,{className:"text-right",children:"重试间隔(秒)"}),e.jsx(ss,{className:"text-right",children:"操作"})]})}),e.jsx(Bl,{children:zt.length===0?e.jsx(ht,{children:e.jsx(Ye,{colSpan:9,className:"text-center text-muted-foreground py-8",children:oe?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):zt.map((te,we)=>{const Oe=a.findIndex(Gs=>Gs===te);return e.jsxs(ht,{children:[e.jsx(Ye,{children:e.jsx(Js,{checked:je.has(Oe),onCheckedChange:()=>Ns(Oe)})}),e.jsx(Ye,{children:sr(te.name)||e.jsx(Ce,{variant:"outline",className:"text-muted-foreground",children:"未测试"})}),e.jsx(Ye,{className:"font-medium",children:te.name}),e.jsx(Ye,{className:"max-w-xs truncate",title:te.base_url,children:te.base_url}),e.jsx(Ye,{children:te.client_type}),e.jsx(Ye,{className:"text-right",children:te.max_retry}),e.jsx(Ye,{className:"text-right",children:te.timeout}),e.jsx(Ye,{className:"text-right",children:te.retry_interval}),e.jsx(Ye,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>ll(te.name),disabled:z.has(te.name),title:"测试连接",children:z.has(te.name)?e.jsx(Os,{className:"h-4 w-4 animate-spin"}):e.jsx(el,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"default",size:"sm",onClick:()=>We(te,Oe),children:[e.jsx(Kn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>ns(Oe),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(ls,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},we)})})]})})}),rs.length>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Pe,{value:$.toString(),onValueChange:te=>{ue(parseInt(te)),Q(1),de(new Set)},children:[e.jsx(Be,{id:"page-size-provider",className:"w-20",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"10",children:"10"}),e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"50",children:"50"}),e.jsx(W,{value:"100",children:"100"})]})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(R-1)*$+1," 到"," ",Math.min(R*$,rs.length)," 条,共 ",rs.length," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Q(1),disabled:R===1,className:"hidden sm:flex",children:e.jsx(Nn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>Q(te=>Math.max(1,te-1)),disabled:R===1,children:[e.jsx(Da,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{type:"number",value:G,onChange:te=>Se(te.target.value),onKeyDown:te=>te.key==="Enter"&&Oa(),placeholder:R.toString(),className:"w-16 h-8 text-center",min:1,max:ft}),e.jsx(_,{variant:"outline",size:"sm",onClick:Oa,disabled:!G,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>Q(te=>te+1),disabled:R>=ft,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(sa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Q(ft),disabled:R>=ft,className:"hidden sm:flex",children:e.jsx(bn,{className:"h-4 w-4"})})]})]})]}),e.jsx(Fs,{open:b,onOpenChange:Vs,children:e.jsxs(Us,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"provider-dialog",preventOutsideClose:H.isRunning,children:[e.jsxs($s,{children:[e.jsx(Bs,{children:w!==null?"编辑提供商":"添加提供商"}),e.jsx(Xs,{children:"配置 API 提供商的连接信息和参数"})]}),e.jsxs("form",{onSubmit:te=>{te.preventDefault(),Ds()},autoComplete:"off",children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":"provider-template-select",children:[e.jsx(T,{htmlFor:"template",children:"提供商模板"}),e.jsxs(ul,{open:U,onOpenChange:E,children:[e.jsx(ml,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":U,className:"w-full justify-between",children:[A?Xi.find(te=>te.id===A)?.display_name:"选择提供商模板...",e.jsx(ix,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(sl,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(dd,{children:[e.jsx(ud,{placeholder:"搜索提供商模板..."}),e.jsx(Ze,{className:"h-[300px]",children:e.jsxs(md,{className:"max-h-none overflow-visible",children:[e.jsx(xd,{children:"未找到匹配的模板"}),e.jsx(oc,{children:Xi.map(te=>e.jsxs(dc,{value:te.display_name,onSelect:()=>Rs(te.id),children:[e.jsx(Mt,{className:`mr-2 h-4 w-4 ${A===te.id?"opacity-100":"opacity-0"}`}),te.display_name]},te.id))})]})})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"选择预设模板可自动填充 URL 和客户端类型,支持搜索"})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-name-input",children:[e.jsx(T,{htmlFor:"name",className:q.name?"text-destructive":"",children:"名称 *"}),e.jsx(ae,{id:"name",value:y?.name||"",onChange:te=>{N(we=>we?{...we,name:te.target.value}:null),q.name&&B(we=>({...we,name:void 0}))},placeholder:"例如: DeepSeek, SiliconFlow",className:q.name?"border-destructive focus-visible:ring-destructive":""}),q.name&&e.jsx("p",{className:"text-xs text-destructive",children:q.name})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-url-input",children:[e.jsx(T,{htmlFor:"base_url",className:q.base_url?"text-destructive":"",children:"基础 URL *"}),e.jsx(ae,{id:"base_url",value:y?.base_url||"",onChange:te=>{N(we=>we?{...we,base_url:te.target.value}:null),q.base_url&&B(we=>({...we,base_url:void 0}))},placeholder:"https://api.example.com/v1",disabled:He,className:`${He?"bg-muted cursor-not-allowed":""} ${q.base_url?"border-destructive focus-visible:ring-destructive":""}`}),q.base_url&&e.jsx("p",{className:"text-xs text-destructive",children:q.base_url}),He&&!q.base_url&&e.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时 URL 不可编辑,切换到"自定义"以手动配置'})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-apikey-input",children:[e.jsx(T,{htmlFor:"api_key",className:q.api_key?"text-destructive":"",children:"API Key *"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{id:"api_key",type:J?"text":"password",value:y?.api_key||"",onChange:te=>{N(we=>we?{...we,api_key:te.target.value}:null),q.api_key&&B(we=>({...we,api_key:void 0}))},placeholder:"sk-...",className:`flex-1 ${q.api_key?"border-destructive focus-visible:ring-destructive":""}`}),e.jsx(_,{type:"button",variant:"outline",size:"icon",onClick:()=>L(!J),title:J?"隐藏密钥":"显示密钥",children:J?e.jsx(nc,{className:"h-4 w-4"}):e.jsx(ia,{className:"h-4 w-4"})}),e.jsx(_,{type:"button",variant:"outline",size:"icon",onClick:Ss,title:"复制密钥",children:e.jsx(Fo,{className:"h-4 w-4"})})]}),q.api_key&&e.jsx("p",{className:"text-xs text-destructive",children:q.api_key})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"client_type",children:"客户端类型"}),e.jsxs(Pe,{value:y?.client_type||"openai",onValueChange:te=>N(we=>we?{...we,client_type:te}:null),disabled:He,children:[e.jsx(Be,{id:"client_type",className:He?"bg-muted cursor-not-allowed":"",children:e.jsx(Fe,{placeholder:"选择客户端类型"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"openai",children:"OpenAI"}),e.jsx(W,{value:"gemini",children:"Gemini"})]})]}),He&&e.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时客户端类型不可编辑,切换到"自定义"以手动配置'})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_retry",children:"最大重试"}),e.jsx(ae,{id:"max_retry",type:"number",min:"0",value:y?.max_retry??"",onChange:te=>{const we=te.target.value===""?null:parseInt(te.target.value);N(Oe=>Oe?{...Oe,max_retry:we}:null)},placeholder:"默认: 2"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"timeout",children:"超时(秒)"}),e.jsx(ae,{id:"timeout",type:"number",min:"1",value:y?.timeout??"",onChange:te=>{const we=te.target.value===""?null:parseInt(te.target.value);N(Oe=>Oe?{...Oe,timeout:we}:null)},placeholder:"默认: 30"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),e.jsx(ae,{id:"retry_interval",type:"number",min:"1",value:y?.retry_interval??"",onChange:te=>{const we=te.target.value===""?null:parseInt(te.target.value);N(Oe=>Oe?{...Oe,retry_interval:we}:null)},placeholder:"默认: 10"})]})]})]}),e.jsxs(nt,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>j(!1),"data-tour":"provider-cancel-button",children:"取消"}),e.jsx(_,{type:"submit","data-tour":"provider-save-button",children:"保存"})]})]})]})}),e.jsx(gs,{open:C,onOpenChange:D,children:e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认删除"}),e.jsxs(ms,{children:['确定要删除提供商 "',P!==null?a[P]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:ts,children:"删除"})]})]})}),e.jsx(gs,{open:he,onOpenChange:ge,children:e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认批量删除"}),e.jsxs(ms,{children:["确定要删除选中的 ",je.size," 个提供商吗? 此操作无法撤销。"]})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:_s,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),e.jsx(gs,{open:fe.isOpen,onOpenChange:te=>Te(we=>({...we,isOpen:te})),children:e.jsxs(cs,{className:"max-w-2xl",children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认删除提供商"}),e.jsx(ms,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:["您即将删除以下提供商:",e.jsx("strong",{className:"text-foreground ml-1",children:fe.providersToDelete.join(", ")})]}),e.jsxs("p",{className:"text-yellow-600 dark:text-yellow-500 font-medium",children:["⚠️ 此操作将同时删除 ",fe.affectedModels.length," 个关联的模型:"]}),e.jsx(Ze,{className:"h-32 w-full rounded border p-3",children:e.jsx("div",{className:"space-y-1",children:fe.affectedModels.map((te,we)=>e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-mono text-muted-foreground",children:"•"}),e.jsx("span",{className:"ml-2 font-medium",children:te.name}),e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",te.model_identifier,")"]})]},we))})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"这些模型将从模型列表和所有任务分配中移除。此操作无法撤销。"})]})})]}),e.jsxs(ds,{children:[e.jsx(hs,{onClick:Z,children:"取消"}),e.jsx(xs,{onClick:vt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})}),e.jsx(er,{})]})}function ac(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).substring(2,11)}`}function $m(a){return a===null?"null":Array.isArray(a)?"array":typeof a=="object"?"object":typeof a=="boolean"?"boolean":typeof a=="number"?"number":"string"}function Zm(a){return Object.entries(a).map(([l,r])=>{const c=$m(r),d={id:ac(),key:l,value:r,type:c,expanded:!0};return c==="object"&&r&&typeof r=="object"?d.children=Zm(r):c==="array"&&Array.isArray(r)&&(d.children=r.map((u,h)=>{const f=$m(u),p={id:ac(),key:String(h),value:u,type:f,expanded:!0};return f==="object"&&u&&typeof u=="object"?p.children=Zm(u):f==="array"&&Array.isArray(u)&&(p.children=u.map((g,b)=>({id:ac(),key:String(b),value:g,type:$m(g),expanded:!0}))),p})),d})}function Wm(a){const l={};for(const r of a)r.key.trim()&&(r.type==="object"&&r.children?l[r.key]=Wm(r.children):r.type==="array"&&r.children?l[r.key]=r.children.map(c=>c.type==="object"&&c.children?Wm(c.children):c.type==="array"&&c.children?c.children.map(d=>d.value):c.value):r.type==="null"?l[r.key]=null:l[r.key]=r.value);return l}function Vg(a,l){switch(l){case"boolean":return a==="true";case"number":{const r=parseFloat(a);return isNaN(r)?0:r}case"null":return null;default:return a}}function Jv({node:a,level:l,onUpdate:r,onRemove:c,onAddChild:d,onToggleExpand:u}){const h=a.type==="object"||a.type==="array",f=a.children&&a.children.length>0;return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"grid gap-2 items-center",style:{gridTemplateColumns:h?"32px 1fr 90px 64px":"32px 1fr 1fr 90px 32px",paddingLeft:`${l*20}px`},children:[e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>u(a.id),disabled:!h||!f,children:h&&f?a.expanded?e.jsx(za,{className:"h-4 w-4"}):e.jsx(sa,{className:"h-4 w-4"}):e.jsx("span",{className:"w-4"})}),e.jsx(ae,{value:a.key,onChange:p=>r(a.id,"key",p.target.value),placeholder:"key",className:"h-8 text-sm"}),!h&&e.jsx(e.Fragment,{children:a.type==="boolean"?e.jsxs("div",{className:"flex items-center h-8 px-3 border rounded-md bg-background",children:[e.jsx(Ge,{checked:a.value===!0,onCheckedChange:p=>r(a.id,"value",p)}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:a.value?"true":"false"})]}):a.type==="null"?e.jsx("div",{className:"flex items-center h-8 px-3 border rounded-md bg-muted text-sm text-muted-foreground",children:"null"}):e.jsx(ae,{type:a.type==="number"?"number":"text",value:a.value,onChange:p=>r(a.id,"value",p.target.value),placeholder:"value",className:"h-8 text-sm",step:a.type==="number"?"any":void 0})}),e.jsxs(Pe,{value:a.type,onValueChange:p=>r(a.id,"type",p),children:[e.jsx(Be,{className:"h-8 text-xs",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"string",children:"字符串"}),e.jsx(W,{value:"number",children:"数字"}),e.jsx(W,{value:"boolean",children:"布尔"}),e.jsx(W,{value:"null",children:"Null"}),e.jsx(W,{value:"object",children:"对象"}),e.jsx(W,{value:"array",children:"数组"})]})]}),e.jsxs("div",{className:"flex gap-1 justify-end",children:[h&&e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-primary",onClick:()=>d(a.id),title:"添加子项",children:e.jsx(Ys,{className:"h-4 w-4"})}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>c(a.id),title:"删除",children:e.jsx(ls,{className:"h-4 w-4"})})]})]}),h&&a.expanded&&a.children&&a.children.length>0&&e.jsx("div",{className:"space-y-1",children:a.children.map(p=>e.jsx(Jv,{node:p,level:l+1,onUpdate:r,onRemove:c,onAddChild:d,onToggleExpand:u},p.id))})]})}function t4({value:a,onChange:l,placeholder:r="添加参数..."}){const[c,d]=m.useState(()=>Zm(a||{})),u=m.useCallback(j=>{d(j),l(Wm(j))},[l]),h=m.useCallback(()=>{const j={id:ac(),key:"",value:"",type:"string",expanded:!1};u([...c,j])},[c,u]),f=m.useCallback((j,y,N)=>{const w=M=>M.map(A=>{if(A.id===j)if(y==="type"){const S=N;if(S==="object")return{...A,type:S,value:{},children:[]};if(S==="array")return{...A,type:S,value:[],children:[]};if(S==="null")return{...A,type:S,value:null};{const U=Vg(String(A.value),S);return{...A,type:S,value:U,children:void 0}}}else if(y==="value"){const S=Vg(String(N),A.type);return{...A,value:S}}else return{...A,[y]:String(N)};return A.children?{...A,children:w(A.children)}:A});u(w(c))},[c,u]),p=m.useCallback(j=>{const y=N=>N.filter(w=>w.id!==j).map(w=>w.children?{...w,children:y(w.children)}:w);u(y(c))},[c,u]),g=m.useCallback(j=>{const y=N=>N.map(w=>{if(w.id===j){const M={id:ac(),key:w.type==="array"?String(w.children?.length||0):"",value:"",type:"string",expanded:!0};return{...w,children:[...w.children||[],M]}}return w.children?{...w,children:y(w.children)}:w});u(y(c))},[c,u]),b=m.useCallback(j=>{const y=N=>N.map(w=>w.id===j?{...w,expanded:!w.expanded}:w.children?{...w,children:y(w.children)}:w);d(y(c))},[c]);return e.jsxs("div",{className:"h-full flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[c.length," 个参数"]}),e.jsxs(_,{type:"button",size:"sm",variant:"outline",onClick:h,className:"h-7 text-xs",children:[e.jsx(Ys,{className:"h-3 w-3 mr-1"}),"添加参数"]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto space-y-1",children:c.length===0?e.jsx("div",{className:"text-sm text-muted-foreground text-center py-4 border border-dashed rounded-md",children:r}):e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"grid gap-2 text-xs text-muted-foreground px-1 sticky top-0 bg-background z-10",style:{gridTemplateColumns:"32px 1fr 1fr 90px 32px"},children:[e.jsx("span",{}),e.jsx("span",{children:"键名"}),e.jsx("span",{children:"值"}),e.jsx("span",{children:"类型"}),e.jsx("span",{})]}),c.map(j=>e.jsx(Jv,{node:j,level:0,onUpdate:f,onRemove:p,onAddChild:g,onToggleExpand:b},j.id))]})})]})}function Gg(a){if(!a.trim())return{valid:!0,parsed:{}};try{const l=JSON.parse(a);return typeof l!="object"||l===null||Array.isArray(l)?{valid:!1,error:"必须是一个 JSON 对象 {}"}:{valid:!0,parsed:l}}catch{return{valid:!1,error:"JSON 格式错误"}}}function a4({value:a,onChange:l,className:r,placeholder:c="添加额外参数..."}){const[d,u]=m.useState("list"),h=m.useMemo(()=>Object.keys(a||{}).length>0?JSON.stringify(a,null,2):"",[a]),[f,p]=m.useState(h),[g,b]=m.useState(null);m.useEffect(()=>{p(h)},[h]);const j=m.useMemo(()=>{const w=Gg(f);return w.valid&&w.parsed?{success:!0,data:w.parsed}:{success:!1,data:{}}},[f]),y=m.useCallback(w=>{const M=w;M==="json"&&d==="list"&&(p(Object.keys(a).length>0?JSON.stringify(a,null,2):""),b(null)),u(M)},[d,a]),N=m.useCallback(w=>{p(w);const M=Gg(w);M.valid&&M.parsed?(b(null),l(M.parsed)):b(M.error||"JSON 格式错误")},[l]);return e.jsx("div",{className:F("h-full flex flex-col",r),children:e.jsxs(ea,{value:d,onValueChange:y,className:"w-full flex-1 flex flex-col",children:[e.jsxs(Gt,{className:"h-8 p-0.5 bg-muted/60 w-fit",children:[e.jsx(Xe,{value:"list",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"可视化编辑"}),e.jsx(Xe,{value:"json",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"JSON 编辑"})]}),e.jsx(vs,{value:"list",className:"mt-2 flex-1 flex flex-col overflow-hidden data-[state=inactive]:hidden data-[state=inactive]:h-0",children:e.jsx(t4,{value:a,onChange:l,placeholder:c})}),e.jsx(vs,{value:"json",className:"mt-2 flex-1 flex flex-col overflow-hidden data-[state=inactive]:hidden data-[state=inactive]:h-0",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 flex-1 overflow-hidden",children:[e.jsxs("div",{className:"flex flex-col gap-2 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"编辑"}),g?e.jsxs("div",{className:"flex items-center gap-1 text-xs text-destructive",children:[e.jsx(Ct,{className:"h-3 w-3"}),e.jsx("span",{className:"truncate max-w-[150px]",children:g})]}):f.trim()&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 dark:text-green-400",children:[e.jsx(Mt,{className:"h-3 w-3"}),e.jsx("span",{children:"有效"})]})]}),e.jsx(rt,{value:f,onChange:w=>N(w.target.value),placeholder:`{ - "key": "value" -}`,className:F("font-mono text-sm flex-1 resize-none",g&&"border-destructive focus-visible:ring-destructive")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"支持任意 JSON 类型(包括嵌套对象和数组)"})]}),e.jsxs("div",{className:"flex flex-col gap-2 overflow-hidden",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"预览"}),e.jsx("div",{className:"flex-1 rounded-md border bg-muted/30 p-3 overflow-auto",children:j.success&&Object.keys(j.data).length>0?e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:JSON.stringify(j.data,null,2)}):j.success?e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"暂无参数"}):e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-destructive",children:"JSON 格式错误"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"实时预览解析结果"})]})]})})]})})}function l4({open:a,onOpenChange:l,value:r,onChange:c}){const[d,u]=m.useState(r),h=g=>{g&&u(r),l(g)},f=()=>{c(d),l(!1)},p=()=>{u(r),l(!1)};return e.jsx(Fs,{open:a,onOpenChange:h,children:e.jsxs(Us,{className:"max-w-3xl h-[70vh] flex flex-col",children:[e.jsxs($s,{children:[e.jsx(Bs,{children:"编辑额外参数"}),e.jsx(Xs,{children:"配置模型调用时的额外参数,支持嵌套对象和数组"})]}),e.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:e.jsx(a4,{value:d,onChange:u,placeholder:"添加额外参数(如 thinking、top_p 等)..."})}),e.jsxs(nt,{children:[e.jsx(_,{variant:"outline",onClick:p,children:"取消"}),e.jsx(_,{onClick:f,children:"保存"})]})]})})}const ei="https://maibot-plugin-stats.maibot-webui.workers.dev";async function n4(a){const l=new URLSearchParams;a?.status&&l.set("status",a.status),a?.page&&l.set("page",a.page.toString()),a?.page_size&&l.set("page_size",a.page_size.toString()),a?.search&&l.set("search",a.search),a?.sort_by&&l.set("sort_by",a.sort_by),a?.sort_order&&l.set("sort_order",a.sort_order);const r=await fetch(`${ei}/pack?${l.toString()}`);if(!r.ok)throw new Error(`获取 Pack 列表失败: ${r.status}`);return r.json()}async function r4(a){const l=await fetch(`${ei}/pack/${a}`);if(!l.ok)throw new Error(`获取 Pack 失败: ${l.status}`);const r=await l.json();if(!r.success)throw new Error(r.error||"获取 Pack 失败");return r.pack}async function i4(a){const r=await(await fetch(`${ei}/pack`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).json();if(!r.success)throw new Error(r.error||"创建 Pack 失败");return r}async function c4(a,l){await fetch(`${ei}/pack/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack_id:a,user_id:l})})}async function Xv(a,l){const c=await(await fetch(`${ei}/pack/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack_id:a,user_id:l})})).json();if(!c.success)throw new Error(c.error||"点赞失败");return{likes:c.likes,liked:c.liked}}async function Zv(a,l){return(await(await fetch(`${ei}/pack/like/check?pack_id=${a}&user_id=${l}`)).json()).liked||!1}async function o4(a){const l=await _e("/api/webui/config/model");if(!l.ok)throw new Error("获取当前模型配置失败");const r=await l.json(),c=r.config||r;console.log("=== Pack Conflict Detection ==="),console.log("Pack providers:",a.providers),console.log("Local providers:",c.api_providers);const d={existing_providers:[],new_providers:[],conflicting_models:[]},u=c.api_providers||[];for(const f of a.providers){console.log(` -Checking pack provider: ${f.name}`),console.log(` Pack URL: ${f.base_url}`),console.log(` Normalized: ${Bm(f.base_url)}`);const p=u.filter(g=>{const b=Bm(g.base_url),j=Bm(f.base_url);return console.log(` Comparing with local "${g.name}": ${g.base_url}`),console.log(` Local normalized: ${b}`),console.log(` Match: ${b===j}`),b===j});p.length>0?(console.log(` ✓ Matched with ${p.length} local provider(s):`,p.map(g=>g.name).join(", ")),d.existing_providers.push({pack_provider:f,local_providers:p.map(g=>({name:g.name,base_url:g.base_url}))})):(console.log(" ✗ No match found - will need API key"),d.new_providers.push(f))}const h=c.models||[];console.log(` -=== Model Conflict Detection ===`);for(const f of a.models){const p=h.find(g=>g.name===f.name);p&&(console.log(`Model conflict: ${f.name}`),d.conflicting_models.push({pack_model:f.name,local_model:p.name}))}return console.log(` -=== Detection Summary ===`),console.log(`Existing providers: ${d.existing_providers.length}`),console.log(`New providers: ${d.new_providers.length}`),console.log(`Conflicting models: ${d.conflicting_models.length}`),console.log(`=========================== -`),d}async function d4(a,l,r,c){const d=await _e("/api/webui/config/model");if(!d.ok)throw new Error("获取当前模型配置失败");const u=await d.json(),h=u.config||u;if(l.apply_providers){const p=l.selected_providers?a.providers.filter(g=>l.selected_providers.includes(g.name)):a.providers;for(const g of p){if(r[g.name])continue;const b=c[g.name];if(!b)throw new Error(`提供商 "${g.name}" 缺少 API Key`);const j={...g,api_key:b},y=h.api_providers.findIndex(N=>N.name===g.name);y>=0?h.api_providers[y]=j:h.api_providers.push(j)}}if(l.apply_models){const p=l.selected_models?a.models.filter(g=>l.selected_models.includes(g.name)):a.models;for(const g of p){const b=r[g.api_provider]||g.api_provider,j={...g,api_provider:b},y=h.models.findIndex(N=>N.name===g.name);y>=0?h.models[y]=j:h.models.push(j)}}if(l.apply_task_config){const p=l.selected_tasks||Object.keys(a.task_config);for(const g of p){const b=a.task_config[g];if(!b)continue;const j=new Set(l.selected_models||a.models.map(w=>w.name)),y=b.model_list.filter(w=>j.has(w));if(y.length===0)continue;const N={...b,model_list:y};if(l.task_mode==="replace")h.model_task_config[g]=N;else{const w=h.model_task_config[g];if(w){const M=[...new Set([...w.model_list,...y])];h.model_task_config[g]={...w,model_list:M}}else h.model_task_config[g]=N}}}if(!(await _e("/api/webui/config/model",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)})).ok)throw new Error("保存配置失败")}async function u4(a){const l=await _e("/api/webui/config/model");if(!l.ok)throw new Error("获取当前模型配置失败");const r=await l.json();if(!r.success||!r.config)throw new Error("获取配置失败");const c=r.config;let d=(c.api_providers||[]).map(g=>({name:g.name,base_url:g.base_url,client_type:g.client_type,max_retry:g.max_retry,timeout:g.timeout,retry_interval:g.retry_interval}));a.selectedProviders&&(d=d.filter(g=>a.selectedProviders.includes(g.name)));let u=c.models||[];a.selectedModels&&(u=u.filter(g=>a.selectedModels.includes(g.name)));const h={},f=c.model_task_config||{},p=a.selectedTasks||Object.keys(f);for(const g of p)f[g]&&(h[g]=f[g]);return{providers:d,models:u,task_config:h}}function Bm(a){try{const l=new URL(a);return`${l.protocol}//${l.host}${l.pathname}`.replace(/\/$/,"").toLowerCase()}catch{return a.toLowerCase().replace(/\/$/,"")}}function Wv(){const a="maibot_pack_user_id";let l=localStorage.getItem(a);return l||(l="pack_user_"+Math.random().toString(36).substring(2,15),localStorage.setItem(a,l)),l}const m4={utils:"通用工具",utils_small:"轻量工具",tool_use:"工具调用",replyer:"回复生成",planner:"规划推理",vlm:"视觉模型",voice:"语音处理",embedding:"向量嵌入",lpmm_entity_extract:"实体提取",lpmm_rdf_build:"RDF构建",lpmm_qa:"问答模型"},x4=["官方推荐","性价比","高性能","免费模型","国内可用","海外模型","OpenAI","Claude","Gemini","国产模型","多模态","轻量级"];function h4({trigger:a}){const[l,r]=m.useState(!1),[c,d]=m.useState(1),[u,h]=m.useState(!1),[f,p]=m.useState(!1),[g,b]=m.useState([]),[j,y]=m.useState([]),[N,w]=m.useState({}),[M,A]=m.useState(new Set),[S,U]=m.useState(new Set),[E,C]=m.useState(new Set),[D,P]=m.useState(""),[O,J]=m.useState(""),[L,oe]=m.useState(""),[Ne,je]=m.useState([]);m.useEffect(()=>{l&&c===1&&de()},[l,c]);const de=async()=>{h(!0);try{const q=await u4({name:"",description:"",author:""});b(q.providers),y(q.models),w(q.task_config),A(new Set(q.providers.map(B=>B.name))),U(new Set(q.models.map(B=>B.name))),C(new Set(Object.keys(q.task_config)))}catch(q){console.error("加载配置失败:",q),Xt({title:"加载当前配置失败",variant:"destructive"})}finally{h(!1)}},he=q=>{const B=new Set(M),z=new Set(S),K=new Set(E);B.has(q)?(B.delete(q),j.filter(ee=>ee.api_provider===q).forEach(ee=>z.delete(ee.name)),Object.entries(N).forEach(([ee,Y])=>{Y.model_list&&(Y.model_list.some(H=>z.has(H))||K.delete(ee))})):(B.add(q),j.filter(ee=>ee.api_provider===q).forEach(ee=>z.add(ee.name)),Object.entries(N).forEach(([ee,Y])=>{Y.model_list&&Y.model_list.some(H=>{const se=j.find(Ue=>Ue.name===H);return se&&se.api_provider===q})&&K.add(ee)})),A(B),U(z),C(K)},ge=q=>{const B=new Set(S),z=new Set(E);B.has(q)?(B.delete(q),Object.entries(N).forEach(([K,Ae])=>{Ae.model_list&&(Ae.model_list.some(Y=>B.has(Y))||z.delete(K))})):(B.add(q),Object.entries(N).forEach(([K,Ae])=>{Ae.model_list&&Ae.model_list.includes(q)&&z.add(K)})),U(B),C(z)},R=q=>{const B=new Set(E);B.has(q)?B.delete(q):B.add(q),C(B)},Q=q=>{Ne.includes(q)?je(Ne.filter(B=>B!==q)):Ne.length<5?je([...Ne,q]):Xt({title:"最多选择 5 个标签",variant:"destructive"})},$=()=>{M.size===g.length?A(new Set):A(new Set(g.map(q=>q.name)))},ue=()=>{S.size===j.length?U(new Set):U(new Set(j.map(q=>q.name)))},G=()=>{const q=Object.keys(N);E.size===q.length?C(new Set):C(new Set(q))},Se=async()=>{if(!D.trim()){Xt({title:"请输入模板名称",variant:"destructive"});return}if(!O.trim()){Xt({title:"请输入模板描述",variant:"destructive"});return}if(!L.trim()){Xt({title:"请输入作者名称",variant:"destructive"});return}if(M.size===0&&S.size===0&&E.size===0){Xt({title:"请至少选择一项配置",variant:"destructive"});return}p(!0);try{const q=g.filter(K=>M.has(K.name)),B=j.filter(K=>S.has(K.name)),z={};for(const[K,Ae]of Object.entries(N))E.has(K)&&(z[K]=Ae);await i4({name:D.trim(),description:O.trim(),author:L.trim(),tags:Ne,providers:q,models:B,task_config:z}),Xt({title:"模板已提交审核,审核通过后将显示在市场中"}),r(!1),fe()}catch(q){console.error("提交失败:",q),Xt({title:q instanceof Error?q.message:"提交失败",variant:"destructive"})}finally{p(!1)}},fe=()=>{d(1),P(""),J(""),oe(""),je([]),A(new Set),U(new Set),C(new Set)},Te=2;return e.jsxs(Fs,{open:l,onOpenChange:r,children:[e.jsx(cd,{asChild:!0,children:a||e.jsxs(_,{variant:"outline",children:[e.jsx(rv,{className:"w-4 h-4 mr-2"}),"分享配置"]})}),e.jsxs(Us,{className:"max-w-2xl max-h-[85vh] flex flex-col",children:[e.jsxs($s,{children:[e.jsxs(Bs,{className:"flex items-center gap-2",children:[e.jsx(ra,{className:"w-5 h-5"}),"分享配置模板"]}),e.jsxs(Xs,{children:["步骤 ",c," / ",Te,":",c===1&&"选择要分享的配置",c===2&&"填写模板信息"]})]}),e.jsx(Ze,{className:"h-[calc(85vh-220px)] pr-4",children:u?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(Os,{className:"w-8 h-8 mx-auto animate-spin text-primary"}),e.jsx("p",{className:"mt-4 text-muted-foreground",children:"正在加载当前配置..."})]}):e.jsxs(e.Fragment,{children:[c===1&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(it,{children:[e.jsx(Vt,{className:"h-4 w-4"}),e.jsx(Gn,{children:"安全提示"}),e.jsxs(ct,{children:["分享的配置将",e.jsx("strong",{children:"不包含"})," API Key,其他用户需要自行配置。"]})]}),e.jsxs(ea,{defaultValue:"providers",className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-3",children:[e.jsxs(Xe,{value:"providers",children:[e.jsx(Ll,{className:"w-4 h-4 mr-2"}),"API 提供商",e.jsxs(Ce,{variant:"secondary",className:"ml-2",children:[M.size,"/",g.length]})]}),e.jsxs(Xe,{value:"models",children:[e.jsx(Qn,{className:"w-4 h-4 mr-2"}),"模型配置",e.jsxs(Ce,{variant:"secondary",className:"ml-2",children:[S.size,"/",j.length]})]}),e.jsxs(Xe,{value:"tasks",children:[e.jsx(Yn,{className:"w-4 h-4 mr-2"}),"任务配置",e.jsxs(Ce,{variant:"secondary",className:"ml-2",children:[E.size,"/",Object.keys(N).length]})]})]}),e.jsx(vs,{value:"providers",className:"space-y-2 mt-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(_,{variant:"ghost",size:"sm",onClick:$,children:M.size===g.length?"取消全选":"全选"})}),g.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无提供商配置"}):g.map(q=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 rounded hover:bg-muted",children:[e.jsx(Js,{id:`provider-${q.name}`,checked:M.has(q.name),onCheckedChange:()=>he(q.name)}),e.jsxs(T,{htmlFor:`provider-${q.name}`,className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:q.name}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:q.base_url})]}),e.jsx(Ce,{variant:"outline",className:"text-xs",children:q.client_type})]},q.name))]})}),e.jsx(vs,{value:"models",className:"space-y-2 mt-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(_,{variant:"ghost",size:"sm",onClick:ue,children:S.size===j.length?"取消全选":"全选"})}),j.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无模型配置"}):j.map(q=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 rounded hover:bg-muted",children:[e.jsx(Js,{id:`model-${q.name}`,checked:S.has(q.name),onCheckedChange:()=>ge(q.name)}),e.jsxs(T,{htmlFor:`model-${q.name}`,className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:q.name}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:q.model_identifier})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:q.api_provider})]},q.name))]})}),e.jsx(vs,{value:"tasks",className:"space-y-2 mt-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(_,{variant:"ghost",size:"sm",onClick:G,children:E.size===Object.keys(N).length?"取消全选":"全选"})}),Object.keys(N).length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无任务配置"}):Object.entries(N).map(([q,B])=>e.jsxs("div",{className:"space-y-2 p-2 rounded hover:bg-muted",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Js,{id:`task-${q}`,checked:E.has(q),onCheckedChange:()=>R(q)}),e.jsx(T,{htmlFor:`task-${q}`,className:"flex-1 cursor-pointer",children:e.jsx("span",{className:"font-medium",children:m4[q]||q})}),e.jsxs(Ce,{variant:"outline",className:"text-xs",children:[B.model_list.length," 个模型"]})]}),B.model_list&&B.model_list.length>0&&e.jsx("div",{className:"ml-6 flex flex-wrap gap-1",children:B.model_list.map(z=>{const K=j.find(ee=>ee.name===z),Ae=S.has(z);return e.jsxs(Ce,{variant:Ae?"default":"outline",className:"text-xs cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>ge(z),children:[z,K&&e.jsxs("span",{className:"ml-1 opacity-70",children:["(",K.api_provider,")"]})]},z)})})]},q))]})})]})]}),c===2&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-4 text-sm p-3 bg-muted rounded-lg",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ll,{className:"w-4 h-4"}),M.size," 个提供商"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Qn,{className:"w-4 h-4"}),S.size," 个模型"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Yn,{className:"w-4 h-4"}),E.size," 个任务"]})]}),e.jsx(Zt,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"pack-name",children:"模板名称 *"}),e.jsx(ae,{id:"pack-name",placeholder:"例如:高性价比国产模型配置",value:D,onChange:q=>P(q.target.value),maxLength:50}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[D.length,"/50"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"pack-description",children:"模板描述 *"}),e.jsx(rt,{id:"pack-description",placeholder:"详细描述这个配置模板的特点、适用场景等...",value:O,onChange:q=>J(q.target.value),rows:4,maxLength:500}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[O.length,"/500"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"pack-author",children:"作者名称 *"}),e.jsx(ae,{id:"pack-author",placeholder:"你的昵称或 ID",value:L,onChange:q=>oe(q.target.value),maxLength:30})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"标签(可选,最多 5 个)"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:x4.map(q=>e.jsxs(Ce,{variant:Ne.includes(q)?"default":"outline",className:"cursor-pointer transition-colors",onClick:()=>Q(q),children:[Ne.includes(q)&&e.jsx(Mt,{className:"w-3 h-3 mr-1"}),e.jsx(rd,{className:"w-3 h-3 mr-1"}),q]},q))})]})]}),e.jsxs(it,{children:[e.jsx(Vt,{className:"h-4 w-4"}),e.jsx(Gn,{children:"审核说明"}),e.jsx(ct,{children:"提交后需要经过审核才能在市场中展示。审核通常在 1-3 个工作日内完成。"})]})]})]})}),e.jsxs(nt,{className:"flex justify-between pt-4 border-t",children:[e.jsx("div",{children:c>1&&e.jsx(_,{variant:"outline",onClick:()=>d(c-1),disabled:f,children:"上一步"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{variant:"outline",onClick:()=>{r(!1),fe()},disabled:f,children:"取消"}),cd(c+1),disabled:u||M.size===0&&S.size===0&&E.size===0,children:"下一步"}):e.jsxs(_,{onClick:Se,disabled:f,children:[f&&e.jsx(Os,{className:"w-4 h-4 mr-2 animate-spin"}),"提交审核"]})]})]})]})]})}function f4({value:a,label:l,onRemove:r}){const{attributes:c,listeners:d,setNodeRef:u,transform:h,transition:f,isDragging:p}=bv({id:a}),g={transform:yv.Transform.toString(h),transition:f,opacity:p?.5:1},b=y=>{y.preventDefault(),y.stopPropagation(),r(a)},j=y=>{y.stopPropagation()};return e.jsx("div",{ref:u,style:g,className:F("inline-flex items-center gap-1",p&&"shadow-lg"),children:e.jsxs(Ce,{variant:"secondary",className:"cursor-move hover:bg-secondary/80 flex items-center gap-1",children:[e.jsx("div",{...c,...d,className:"cursor-grab active:cursor-grabbing flex items-center",children:e.jsx(av,{className:"h-3 w-3 text-muted-foreground"})}),e.jsx("span",{children:l}),e.jsx("span",{role:"button",tabIndex:0,className:"ml-1 rounded-sm hover:bg-destructive/20 focus:outline-none focus:ring-1 focus:ring-destructive cursor-pointer",onClick:b,onPointerDown:j,onMouseDown:y=>y.stopPropagation(),onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),b(y))},children:e.jsx(Aa,{className:"h-3 w-3 hover:text-destructive",strokeWidth:2,fill:"none"})})]})})}function p4({options:a,selected:l,onChange:r,placeholder:c="选择选项...",emptyText:d="未找到选项",className:u}){const[h,f]=m.useState(!1),p=xv(qo(pv,{activationConstraint:{distance:8}}),qo(fv,{coordinateGetter:hv})),g=y=>{l.includes(y)?r(l.filter(N=>N!==y)):r([...l,y])},b=y=>{r(l.filter(N=>N!==y))},j=y=>{const{active:N,over:w}=y;if(w&&N.id!==w.id){const M=l.indexOf(N.id),A=l.indexOf(w.id);r(gv(l,M,A))}};return e.jsxs(ul,{open:h,onOpenChange:f,children:[e.jsx(ml,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":h,className:F("w-full justify-between min-h-10 h-auto",u),children:[e.jsx(jv,{sensors:p,collisionDetection:vv,onDragEnd:j,children:e.jsx(Nv,{items:l,strategy:o1,children:e.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:l.length===0?e.jsx("span",{className:"text-muted-foreground",children:c}):l.map(y=>{const N=a.find(w=>w.value===y);return e.jsx(f4,{value:y,label:N?.label||y,onRemove:b},y)})})})}),e.jsx(ix,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),e.jsx(sl,{className:"w-full p-0",align:"start",children:e.jsxs(dd,{children:[e.jsx(ud,{placeholder:"搜索...",className:"h-9"}),e.jsxs(md,{children:[e.jsx(xd,{children:d}),e.jsx(oc,{children:a.map(y=>{const N=l.includes(y.value);return e.jsxs(dc,{value:y.value,onSelect:()=>g(y.value),children:[e.jsx("div",{className:F("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",N?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(Mt,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),e.jsx("span",{children:y.label})]},y.value)})})]})]})})]})}const zl=Ls.memo(function({title:l,description:r,taskConfig:c,modelNames:d,onChange:u,hideTemperature:h=!1,hideMaxTokens:f=!1,dataTour:p}){const g=b=>{u("model_list",b)};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:l}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:r})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":p,children:[e.jsx(T,{children:"模型列表"}),e.jsx(p4,{options:d.map(b=>({label:b,value:b})),selected:c.model_list||[],onChange:g,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!h&&e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"温度"}),e.jsx(ae,{type:"number",step:"0.1",min:"0",max:"1",value:c.temperature??.3,onChange:b=>{const j=parseFloat(b.target.value);!isNaN(j)&&j>=0&&j<=1&&u("temperature",j)},className:"w-20 h-8 text-sm"})]}),e.jsx(Qa,{value:[c.temperature??.3],onValueChange:b=>u("temperature",b[0]),min:0,max:1,step:.1,className:"w-full"})]}),!f&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"最大 Token"}),e.jsx(ae,{type:"number",step:"1",min:"1",value:c.max_tokens??1024,onChange:b=>u("max_tokens",parseInt(b.target.value))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"慢请求阈值 (秒)"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"超时警告"})]}),e.jsx(ae,{type:"number",step:"1",min:"1",value:c.slow_threshold??15,onChange:b=>{const j=parseInt(b.target.value);!isNaN(j)&&j>=1&&u("slow_threshold",j)},placeholder:"15"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"模型响应时间超过此阈值将输出警告日志"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"模型选择策略"}),e.jsxs(Pe,{value:c.selection_strategy??"balance",onValueChange:b=>u("selection_strategy",b),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择模型选择策略"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"balance",children:"负载均衡(balance)"}),e.jsx(W,{value:"random",children:"随机选择(random)"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"负载均衡:优先选择使用次数少的模型。随机选择:完全随机从模型列表中选择"})]})]})]})}),g4=Ls.memo(function({paginatedModels:l,allModels:r,onEdit:c,onDelete:d,isModelUsed:u,searchQuery:h}){return l.length===0?e.jsx("div",{className:"md:hidden text-center text-muted-foreground py-8 rounded-lg border bg-card",children:h?"未找到匹配的模型":"暂无模型配置"}):e.jsx("div",{className:"md:hidden space-y-3",children:l.map((f,p)=>{const g=r.findIndex(j=>j===f),b=u(f.name);return e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"font-semibold text-base",children:f.name}),e.jsx(Ce,{variant:b?"default":"secondary",className:b?"bg-green-600 hover:bg-green-700":"",children:b?"已使用":"未使用"})]}),e.jsx("p",{className:"text-xs text-muted-foreground break-all",title:f.model_identifier,children:f.model_identifier})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>c(f,g),children:[e.jsx(Kn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>d(g),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(ls,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),e.jsx("p",{className:"font-medium",children:f.api_provider})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"模型温度"}),e.jsx("p",{className:"font-medium",children:f.temperature!=null?f.temperature:e.jsx("span",{className:"text-muted-foreground",children:"默认"})})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),e.jsxs("p",{className:"font-medium",children:["¥",f.price_in,"/M"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),e.jsxs("p",{className:"font-medium",children:["¥",f.price_out,"/M"]})]})]})]},p)})})}),j4=Ls.memo(function({paginatedModels:l,allModels:r,filteredModels:c,selectedModels:d,onEdit:u,onDelete:h,onToggleSelection:f,onToggleSelectAll:p,isModelUsed:g,searchQuery:b}){return e.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(Ul,{children:[e.jsx($l,{children:e.jsxs(ht,{children:[e.jsx(ss,{className:"w-12",children:e.jsx(Js,{checked:d.size===c.length&&c.length>0,onCheckedChange:p})}),e.jsx(ss,{className:"w-24",children:"使用状态"}),e.jsx(ss,{children:"模型名称"}),e.jsx(ss,{children:"模型标识符"}),e.jsx(ss,{children:"提供商"}),e.jsx(ss,{className:"text-center",children:"温度"}),e.jsx(ss,{className:"text-right",children:"输入价格"}),e.jsx(ss,{className:"text-right",children:"输出价格"}),e.jsx(ss,{className:"text-right",children:"操作"})]})}),e.jsx(Bl,{children:l.length===0?e.jsx(ht,{children:e.jsx(Ye,{colSpan:9,className:"text-center text-muted-foreground py-8",children:b?"未找到匹配的模型":"暂无模型配置"})}):l.map((j,y)=>{const N=r.findIndex(M=>M===j),w=g(j.name);return e.jsxs(ht,{children:[e.jsx(Ye,{children:e.jsx(Js,{checked:d.has(N),onCheckedChange:()=>f(N)})}),e.jsx(Ye,{children:e.jsx(Ce,{variant:w?"default":"secondary",className:w?"bg-green-600 hover:bg-green-700":"",children:w?"已使用":"未使用"})}),e.jsx(Ye,{className:"font-medium",children:j.name}),e.jsx(Ye,{className:"max-w-xs truncate",title:j.model_identifier,children:j.model_identifier}),e.jsx(Ye,{children:j.api_provider}),e.jsx(Ye,{className:"text-center",children:j.temperature!=null?j.temperature:e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsxs(Ye,{className:"text-right",children:["¥",j.price_in,"/M"]}),e.jsxs(Ye,{className:"text-right",children:["¥",j.price_out,"/M"]}),e.jsx(Ye,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>u(j,N),children:[e.jsx(Kn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>h(N),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(ls,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},y)})})]})})})}),v4=300*1e3,qg=new Map,N4=[10,20,50,100],b4=Ls.memo(function({page:l,pageSize:r,totalItems:c,jumpToPage:d,onPageChange:u,onPageSizeChange:h,onJumpToPageChange:f,onJumpToPage:p,onSelectionClear:g}){const b=Math.ceil(c/r),j=N=>{h(parseInt(N)),u(1),g?.()},y=N=>{N.key==="Enter"&&p()};return c===0?null:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Pe,{value:r.toString(),onValueChange:j,children:[e.jsx(Be,{id:"page-size-model",className:"w-20",children:e.jsx(Fe,{})}),e.jsx(Ie,{children:N4.map(N=>e.jsx(W,{value:N.toString(),children:N},N))})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(l-1)*r+1," 到"," ",Math.min(l*r,c)," 条,共 ",c," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>u(1),disabled:l===1,className:"hidden sm:flex",children:e.jsx(Nn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>u(Math.max(1,l-1)),disabled:l===1,children:[e.jsx(Da,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{type:"number",value:d,onChange:N=>f(N.target.value),onKeyDown:y,placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:b}),e.jsx(_,{variant:"outline",size:"sm",onClick:p,disabled:!d,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>u(l+1),disabled:l>=b,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(sa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>u(b),disabled:l>=b,className:"hidden sm:flex",children:e.jsx(bn,{className:"h-4 w-4"})})]})]})});function y4(a){const{models:l,taskConfig:r,debounceMs:c=2e3,onSavingChange:d,onUnsavedChange:u}=a,h=m.useRef(null),f=m.useRef(null),p=m.useRef(!0),g=m.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null),f.current&&(clearTimeout(f.current),f.current=null)},[]),b=m.useCallback(N=>{const w={model_identifier:N.model_identifier,name:N.name,api_provider:N.api_provider,price_in:N.price_in??0,price_out:N.price_out??0,force_stream_mode:N.force_stream_mode??!1,extra_params:N.extra_params??{}};return N.temperature!=null&&(w.temperature=N.temperature),N.max_tokens!=null&&(w.max_tokens=N.max_tokens),w},[]),j=m.useCallback(async N=>{try{d?.(!0);const w=N.map(b);await Jm("models",w),u?.(!1)}catch(w){console.error("自动保存模型列表失败:",w),u?.(!0)}finally{d?.(!1)}},[d,u,b]),y=m.useCallback(async N=>{try{d?.(!0),await Jm("model_task_config",N),u?.(!1)}catch(w){console.error("自动保存任务配置失败:",w),u?.(!0)}finally{d?.(!1)}},[d,u]);return m.useEffect(()=>{if(!p.current)return u?.(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{j(l)},c),()=>{h.current&&clearTimeout(h.current)}},[l,j,c,u]),m.useEffect(()=>{if(!(p.current||!r))return u?.(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{y(r)},c),()=>{f.current&&clearTimeout(f.current)}},[r,y,c,u]),m.useEffect(()=>()=>{g()},[g]),{clearTimers:g,initialLoadRef:p}}function w4(a={}){const{onCloseEditDialog:l}=a,r=ca(),{registerTour:c,startTour:d,state:u,goToStep:h}=wx(),f=m.useRef(u.stepIndex);return m.useEffect(()=>{c(ol,Qv)},[c]),m.useEffect(()=>{if(u.activeTourId===ol&&u.isRunning){const g=Yv[u.stepIndex];g&&!window.location.pathname.endsWith(g.replace("/config/",""))&&r({to:g})}},[u.stepIndex,u.activeTourId,u.isRunning,r]),m.useEffect(()=>{if(u.activeTourId===ol&&u.isRunning){const g=f.current,b=u.stepIndex;g>=12&&g<=17&&b<12&&l?.(),f.current=b}},[u.stepIndex,u.activeTourId,u.isRunning,l]),m.useEffect(()=>{if(u.activeTourId!==ol||!u.isRunning)return;const g=b=>{const j=b.target,y=u.stepIndex;y===2&&j.closest('[data-tour="add-provider-button"]')?setTimeout(()=>h(3),300):y===9&&j.closest('[data-tour="provider-cancel-button"]')?setTimeout(()=>h(10),300):y===11&&j.closest('[data-tour="add-model-button"]')?setTimeout(()=>h(12),300):y===17&&j.closest('[data-tour="model-cancel-button"]')?setTimeout(()=>h(18),300):y===18&&j.closest('[data-tour="tasks-tab-trigger"]')&&setTimeout(()=>h(19),300)};return document.addEventListener("click",g,!0),()=>document.removeEventListener("click",g,!0)},[u,h]),{startTour:m.useCallback(()=>{d(ol)},[d]),isRunning:u.isRunning&&u.activeTourId===ol,stepIndex:u.stepIndex}}function _4(a){const{getProviderConfig:l}=a,[r,c]=m.useState([]),[d,u]=m.useState(!1),[h,f]=m.useState(null),[p,g]=m.useState(null),b=m.useCallback(()=>{c([]),f(null),g(null)},[]),j=m.useCallback(async(y,N=!1)=>{const w=l(y);if(!w?.base_url){c([]),g(null),f('提供商配置不完整,请先在"模型提供商配置"中配置');return}if(!w.api_key){c([]),g(null),f('该提供商未配置 API Key,请先在"模型提供商配置"中填写');return}const M=ZS(w.base_url);if(g(M),!M?.modelFetcher){c([]),f(null);return}const A=`${y}:${w.base_url}`,S=qg.get(A);if(!N&&S&&Date.now()-S.timestampE(!1)}),{clearTimers:As,initialLoadRef:vt}=y4({models:a,taskConfig:p,onSavingChange:M,onUnsavedChange:S}),Z=m.useCallback((re,pe)=>{if(!re)return;const as=new Set(pe.map(va=>va.name)),ys=[],fs=[],yt=[{key:"utils",label:"工具模型"},{key:"tool_use",label:"工具调用模型"},{key:"replyer",label:"回复模型"},{key:"planner",label:"规划器模型"},{key:"vlm",label:"视觉模型"},{key:"voice",label:"语音模型"},{key:"embedding",label:"嵌入模型"},{key:"lpmm_entity_extract",label:"LPMM实体抽取"},{key:"lpmm_rdf_build",label:"LPMM关系构建"}];for(const{key:va,label:Pl}of yt){const tr=re[va];if(!tr)continue;if(!tr.model_list||tr.model_list.length===0){fs.push(Pl);continue}const ti=tr.model_list.filter(_n=>!as.has(_n));ti.length>0&&ys.push({taskName:Pl,invalidModels:ti})}se(ys),ie(fs)},[]),qe=m.useCallback(async()=>{try{j(!0);const re=await xn(),pe=re.models||[];l(pe),f(pe.map(yt=>yt.name));const as=re.api_providers||[];c(as.map(yt=>yt.name)),u(as);const ys=re.model_task_config||null;g(ys),Z(ys,pe);const fs=ys?.embedding?.model_list||[];Y.current=[...fs],S(!1),vt.current=!1}catch(re){console.error("加载配置失败:",re)}finally{j(!1)}},[vt,Z]);m.useEffect(()=>{qe()},[qe]);const Qe=m.useCallback(re=>d.find(pe=>pe.name===re),[d]),{availableModels:We,fetchingModels:Rs,modelFetchError:He,matchedTemplate:Ss,fetchModelsForProvider:Ds,clearModels:Vs}=_4({getProviderConfig:Qe});m.useEffect(()=>{U&&C?.api_provider&&Ds(C.api_provider)},[U,C?.api_provider,Ds]);const ns=async()=>{await at()},ts=m.useCallback(()=>{if(!p)return;const re=new Set(a.map(ys=>ys.name)),pe={...p},as=Object.keys(pe);for(const ys of as){const fs=pe[ys];fs&&fs.model_list&&(fs.model_list=fs.model_list.filter(yt=>re.has(yt)))}g(pe),se([]),ze({title:"清理完成",description:"已删除所有无效的模型引用"})},[p,a,ze]),Ns=re=>{const pe={model_identifier:re.model_identifier,name:re.name,api_provider:re.api_provider,price_in:re.price_in??0,price_out:re.price_out??0,force_stream_mode:re.force_stream_mode??!1,extra_params:re.extra_params??{}};return re.temperature!=null&&(pe.temperature=re.temperature),re.max_tokens!=null&&(pe.max_tokens=re.max_tokens),pe},Le=async()=>{try{N(!0),As();const re=await xn();re.models=a.map(Ns),re.model_task_config=p,await tc(re),S(!1),ze({title:"保存成功",description:"正在重启麦麦..."}),await ns()}catch(re){console.error("保存配置失败:",re),ze({title:"保存失败",description:re.message,variant:"destructive"}),N(!1)}},bs=async()=>{try{N(!0),As();const re=await xn();re.models=a.map(Ns),re.model_task_config=p,await tc(re),S(!1),ze({title:"保存成功",description:"模型配置已保存"}),await qe()}catch(re){console.error("保存配置失败:",re),ze({title:"保存失败",description:re.message,variant:"destructive"})}finally{N(!1)}},_s=(re,pe)=>{me({}),D(re||{model_identifier:"",name:"",api_provider:r[0]||"",price_in:0,price_out:0,temperature:null,max_tokens:null,force_stream_mode:!1,extra_params:{}}),O(pe),E(!0)},rs=()=>{if(!C)return;const re={};if(C.name?.trim()?a.some((yt,va)=>P!==null&&va===P?!1:yt.name.trim().toLowerCase()===C.name.trim().toLowerCase())&&(re.name="模型名称已存在,请使用其他名称"):re.name="请输入模型名称",C.api_provider?.trim()||(re.api_provider="请选择 API 提供商"),C.model_identifier?.trim()||(re.model_identifier="请输入模型标识符"),Object.keys(re).length>0){me(re);return}me({});const pe={model_identifier:C.model_identifier,name:C.name,api_provider:C.api_provider,price_in:C.price_in??0,price_out:C.price_out??0,force_stream_mode:C.force_stream_mode??!1,extra_params:C.extra_params??{}};C.temperature!=null&&(pe.temperature=C.temperature),C.max_tokens!=null&&(pe.max_tokens=C.max_tokens);let as,ys=null;if(P!==null?(ys=a[P].name,as=[...a],as[P]=pe):as=[...a,pe],l(as),f(as.map(fs=>fs.name)),ys&&ys!==pe.name&&p){const fs=yt=>yt.map(va=>va===ys?pe.name:va);g({...p,utils:{...p.utils,model_list:fs(p.utils?.model_list||[])},tool_use:{...p.tool_use,model_list:fs(p.tool_use?.model_list||[])},replyer:{...p.replyer,model_list:fs(p.replyer?.model_list||[])},planner:{...p.planner,model_list:fs(p.planner?.model_list||[])},vlm:{...p.vlm,model_list:fs(p.vlm?.model_list||[])},voice:{...p.voice,model_list:fs(p.voice?.model_list||[])},embedding:{...p.embedding,model_list:fs(p.embedding?.model_list||[])},lpmm_entity_extract:{...p.lpmm_entity_extract,model_list:fs(p.lpmm_entity_extract?.model_list||[])},lpmm_rdf_build:{...p.lpmm_rdf_build,model_list:fs(p.lpmm_rdf_build?.model_list||[])}})}E(!1),D(null),O(null),ze({title:P!==null?"模型已更新":"模型已添加",description:'配置将在 2 秒后自动保存,或点击右上角"保存配置"按钮立即保存'})},ft=re=>{if(!re&&C){const pe={...C,price_in:C.price_in??0,price_out:C.price_out??0};D(pe)}E(re)},zt=re=>{de(re),Ne(!0)},Oa=()=>{if(je!==null){const re=a.filter((pe,as)=>as!==je);l(re),f(re.map(pe=>pe.name)),Z(p,re),ze({title:"删除成功",description:'配置将在 2 秒后自动保存,或点击右上角"保存配置"按钮立即保存'})}Ne(!1),de(null)},ll=re=>{const pe=new Set(R);pe.has(re)?pe.delete(re):pe.add(re),Q(pe)},xl=()=>{if(R.size===Ut.length)Q(new Set);else{const re=Ut.map((pe,as)=>a.findIndex(ys=>ys===Ut[as]));Q(new Set(re))}},sr=()=>{if(R.size===0){ze({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}ue(!0)},te=()=>{const re=R.size,pe=a.filter((as,ys)=>!R.has(ys));l(pe),f(pe.map(as=>as.name)),Z(p,pe),Q(new Set),ue(!1),ze({title:"批量删除成功",description:`已删除 ${re} 个模型,配置将在 2 秒后自动保存`})},we=(re,pe,as)=>{if(!p)return;if(re==="embedding"&&pe==="model_list"&&Array.isArray(as)){const fs=Y.current,yt=as;if((fs.length!==yt.length||fs.some(Pl=>!yt.includes(Pl))||yt.some(Pl=>!fs.includes(Pl)))&&fs.length>0){$e.current={field:pe,value:as},ee(!0);return}}const ys={...p,[re]:{...p[re],[pe]:as}};g(ys),Z(ys,a),re==="embedding"&&pe==="model_list"&&Array.isArray(as)&&(Y.current=[...as])},Oe=()=>{if(!p||!$e.current)return;const{field:re,value:pe}=$e.current,as={...p,embedding:{...p.embedding,[re]:pe}};g(as),Z(as,a),re==="model_list"&&Array.isArray(pe)&&(Y.current=[...pe]),$e.current=null,ee(!1),ze({title:"嵌入模型已更新",description:"建议重新生成知识库向量以确保最佳匹配精度"})},Gs=()=>{$e.current=null,ee(!1)},Ut=a.filter(re=>{if(!he)return!0;const pe=he.toLowerCase();return re.name.toLowerCase().includes(pe)||re.model_identifier.toLowerCase().includes(pe)||re.api_provider.toLowerCase().includes(pe)}),ta=Math.ceil(Ut.length/fe),dt=Ut.slice((G-1)*fe,G*fe),aa=()=>{const re=parseInt(q);re>=1&&re<=ta&&(Se(re),B(""))},pt=re=>p?[p.utils?.model_list||[],p.tool_use?.model_list||[],p.replyer?.model_list||[],p.planner?.model_list||[],p.vlm?.model_list||[],p.voice?.model_list||[],p.embedding?.model_list||[],p.lpmm_entity_extract?.model_list||[],p.lpmm_rdf_build?.model_list||[]].some(as=>as.includes(re)):!1;return b?e.jsx(Ze,{className:"h-full",children:e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型管理与分配"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"添加模型并为模型分配功能"})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsx(h4,{trigger:e.jsxs(_,{variant:"outline",size:"sm",className:"flex-1 sm:flex-none",children:[e.jsx(rv,{className:"mr-2 h-4 w-4"}),"分享配置"]})}),e.jsxs(_,{onClick:bs,disabled:y||w||!A||Pt,size:"sm",variant:"outline",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(fc,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),y?"保存中...":w?"自动保存中...":A?"保存配置":"已保存"]}),e.jsxs(gs,{children:[e.jsx(jt,{asChild:!0,children:e.jsxs(_,{disabled:y||w||Pt,size:"sm",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(hc,{className:"mr-2 h-4 w-4"}),Pt?"重启中...":A?"保存并重启":"重启麦麦"]})}),e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认重启麦麦?"}),e.jsx(ms,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:A?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:A?Le:ns,children:A?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(it,{children:[e.jsx(Vt,{className:"h-4 w-4"}),e.jsxs(ct,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),H.length>0&&e.jsxs(it,{variant:"destructive",children:[e.jsx(It,{className:"h-4 w-4"}),e.jsxs(ct,{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("strong",{children:"检测到无效的模型引用"}),e.jsx("div",{className:"mt-2 space-y-1",children:H.map(({taskName:re,invalidModels:pe})=>e.jsxs("div",{className:"text-sm",children:[e.jsx("strong",{children:re})," 引用了不存在的模型: ",pe.join(", ")]},re))})]}),e.jsx(_,{variant:"outline",size:"sm",className:"shrink-0 bg-background hover:bg-accent",onClick:ts,children:"一键清理"})]})]}),Ue.length>0&&e.jsxs(it,{variant:"default",className:"border-yellow-500/50 bg-yellow-500/10",children:[e.jsx(It,{className:"h-4 w-4 text-yellow-600"}),e.jsxs(ct,{children:[e.jsx("strong",{className:"text-yellow-600",children:"以下任务未配置模型"}),e.jsxs("div",{className:"mt-2 text-sm",children:[Ue.join("、")," 还未分配模型,这些功能将无法正常工作。"]})]})]}),e.jsxs(it,{className:"hidden lg:flex border-primary/30 bg-primary/5 cursor-pointer hover:bg-primary/10 transition-colors",onClick:qt,children:[e.jsx(E_,{className:"h-4 w-4 text-primary"}),e.jsxs(ct,{className:"flex items-center justify-between",children:[e.jsxs("span",{children:[e.jsx("strong",{className:"text-primary",children:"新手引导:"}),"不知道如何配置模型?点击这里开始学习如何为麦麦的组件分配模型。"]}),e.jsx(_,{variant:"outline",size:"sm",className:"ml-4 shrink-0",children:"开始引导"})]})]}),e.jsxs(ea,{defaultValue:"models",className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[e.jsx(Xe,{value:"models",children:"添加模型"}),e.jsx(Xe,{value:"tasks","data-tour":"tasks-tab-trigger",children:"为模型分配功能"})]}),e.jsxs(vs,{value:"models",className:"space-y-4 mt-0",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[R.size>0&&e.jsxs(_,{onClick:sr,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(ls,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",R.size,")"]}),e.jsxs(_,{onClick:()=>_s(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto","data-tour":"add-model-button",children:[e.jsx(Ys,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[e.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[e.jsx(At,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ae,{placeholder:"搜索模型名称、标识符或提供商...",value:he,onChange:re=>ge(re.target.value),className:"pl-9"})]}),he&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Ut.length," 个结果"]})]}),e.jsx(g4,{paginatedModels:dt,allModels:a,onEdit:_s,onDelete:zt,isModelUsed:pt,searchQuery:he}),e.jsx(j4,{paginatedModels:dt,allModels:a,filteredModels:Ut,selectedModels:R,onEdit:_s,onDelete:zt,onToggleSelection:ll,onToggleSelectAll:xl,isModelUsed:pt,searchQuery:he}),e.jsx(b4,{page:G,pageSize:fe,totalItems:Ut.length,jumpToPage:q,onPageChange:Se,onPageSizeChange:Te,onJumpToPageChange:B,onJumpToPage:aa,onSelectionClear:()=>Q(new Set)})]}),e.jsxs(vs,{value:"tasks",className:"space-y-6 mt-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),p&&e.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[e.jsx(zl,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:p.utils,modelNames:h,onChange:(re,pe)=>we("utils",re,pe),dataTour:"task-model-select"}),e.jsx(zl,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:p.tool_use,modelNames:h,onChange:(re,pe)=>we("tool_use",re,pe)}),e.jsx(zl,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:p.replyer,modelNames:h,onChange:(re,pe)=>we("replyer",re,pe)}),e.jsx(zl,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:p.planner,modelNames:h,onChange:(re,pe)=>we("planner",re,pe)}),e.jsx(zl,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:p.vlm,modelNames:h,onChange:(re,pe)=>we("vlm",re,pe),hideTemperature:!0}),e.jsx(zl,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:p.voice,modelNames:h,onChange:(re,pe)=>we("voice",re,pe),hideTemperature:!0,hideMaxTokens:!0}),e.jsx(zl,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:p.embedding,modelNames:h,onChange:(re,pe)=>we("embedding",re,pe),hideTemperature:!0,hideMaxTokens:!0}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),e.jsx(zl,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:p.lpmm_entity_extract,modelNames:h,onChange:(re,pe)=>we("lpmm_entity_extract",re,pe)}),e.jsx(zl,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:p.lpmm_rdf_build,modelNames:h,onChange:(re,pe)=>we("lpmm_rdf_build",re,pe)})]})]})]})]}),e.jsx(Fs,{open:U,onOpenChange:ft,children:e.jsxs(Us,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"model-dialog",preventOutsideClose:Ja,children:[e.jsxs($s,{children:[e.jsx(Bs,{children:P!==null?"编辑模型":"添加模型"}),e.jsx(Xs,{children:"配置模型的基本信息和参数"})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":"model-name-input",children:[e.jsx(T,{htmlFor:"model_name",className:Ee.name?"text-destructive":"",children:"模型名称 *"}),e.jsx(ae,{id:"model_name",value:C?.name||"",onChange:re=>{D(pe=>pe?{...pe,name:re.target.value}:null),Ee.name&&me(pe=>({...pe,name:void 0}))},placeholder:"例如: qwen3-30b",className:Ee.name?"border-destructive focus-visible:ring-destructive":""}),Ee.name?e.jsx("p",{className:"text-xs text-destructive",children:Ee.name}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"model-provider-select",children:[e.jsx(T,{htmlFor:"api_provider",className:Ee.api_provider?"text-destructive":"",children:"API 提供商 *"}),e.jsxs(Pe,{value:C?.api_provider||"",onValueChange:re=>{D(pe=>pe?{...pe,api_provider:re}:null),Vs(),Ee.api_provider&&me(pe=>({...pe,api_provider:void 0}))},children:[e.jsx(Be,{id:"api_provider",className:Ee.api_provider?"border-destructive focus-visible:ring-destructive":"",children:e.jsx(Fe,{placeholder:"选择提供商"})}),e.jsx(Ie,{children:r.map(re=>e.jsx(W,{value:re,children:re},re))})]}),Ee.api_provider&&e.jsx("p",{className:"text-xs text-destructive",children:Ee.api_provider})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"model-identifier-input",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{htmlFor:"model_identifier",className:Ee.model_identifier?"text-destructive":"",children:"模型标识符 *"}),Ss?.modelFetcher&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ce,{variant:"secondary",className:"text-xs",children:Ss.display_name}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>C?.api_provider&&Ds(C.api_provider,!0),disabled:Rs,children:Rs?e.jsx(Os,{className:"h-3 w-3 animate-spin"}):e.jsx(xt,{className:"h-3 w-3"})})]})]}),Ss?.modelFetcher?e.jsxs(ul,{open:z,onOpenChange:K,children:[e.jsx(ml,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":z,className:"w-full justify-between font-normal",disabled:Rs||!!He,children:[Rs?e.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(Os,{className:"h-4 w-4 animate-spin"}),"正在获取模型列表..."]}):He?e.jsx("span",{className:"text-muted-foreground text-sm",children:"点击下方输入框手动填写"}):C?.model_identifier?e.jsx("span",{className:"truncate",children:C.model_identifier}):e.jsx("span",{className:"text-muted-foreground",children:"搜索或选择模型..."}),e.jsx(ix,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(sl,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(dd,{children:[e.jsx(ud,{placeholder:"搜索模型..."}),e.jsx(Ze,{className:"h-[300px]",children:e.jsxs(md,{className:"max-h-none overflow-visible",children:[e.jsx(xd,{children:He?e.jsxs("div",{className:"py-4 px-2 text-center space-y-2",children:[e.jsx("p",{className:"text-sm text-destructive",children:He}),!He.includes("API Key")&&e.jsx(_,{variant:"link",size:"sm",onClick:()=>C?.api_provider&&Ds(C.api_provider,!0),children:"重试"})]}):"未找到匹配的模型"}),e.jsx(oc,{heading:"可用模型",children:We.map(re=>e.jsxs(dc,{value:re.id,onSelect:()=>{D(pe=>pe?{...pe,model_identifier:re.id}:null),K(!1)},children:[e.jsx(Mt,{className:`mr-2 h-4 w-4 ${C?.model_identifier===re.id?"opacity-100":"opacity-0"}`}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:re.id}),re.name!==re.id&&e.jsx("span",{className:"text-xs text-muted-foreground",children:re.name})]})]},re.id))}),e.jsx(oc,{heading:"手动输入",children:e.jsxs(dc,{value:"__manual_input__",onSelect:()=>{K(!1)},children:[e.jsx(Kn,{className:"mr-2 h-4 w-4"}),"手动输入模型标识符..."]})})]})})]})})]}):e.jsx(ae,{id:"model_identifier",value:C?.model_identifier||"",onChange:re=>{D(pe=>pe?{...pe,model_identifier:re.target.value}:null),Ee.model_identifier&&me(pe=>({...pe,model_identifier:void 0}))},placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507",className:Ee.model_identifier?"border-destructive focus-visible:ring-destructive":""}),Ee.model_identifier&&e.jsx("p",{className:"text-xs text-destructive",children:Ee.model_identifier}),He&&Ss?.modelFetcher&&!Ee.model_identifier&&e.jsxs(it,{variant:"destructive",className:"mt-2 py-2",children:[e.jsx(Vt,{className:"h-4 w-4"}),e.jsx(ct,{className:"text-xs",children:He})]}),Ss?.modelFetcher&&e.jsx(ae,{value:C?.model_identifier||"",onChange:re=>{D(pe=>pe?{...pe,model_identifier:re.target.value}:null),Ee.model_identifier&&me(pe=>({...pe,model_identifier:void 0}))},placeholder:"或手动输入模型标识符",className:`mt-2 ${Ee.model_identifier?"border-destructive focus-visible:ring-destructive":""}`}),!Ee.model_identifier&&e.jsx("p",{className:"text-xs text-muted-foreground",children:He?'请手动输入模型标识符,或前往"模型提供商配置"检查 API Key':Ss?.modelFetcher?`已识别为 ${Ss.display_name},支持自动获取模型列表`:"API 提供商提供的模型 ID"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),e.jsx(ae,{id:"price_in",type:"number",step:"0.1",min:"0",value:C?.price_in??"",onChange:re=>{const pe=re.target.value===""?null:parseFloat(re.target.value);D(as=>as?{...as,price_in:pe}:null)},placeholder:"默认: 0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),e.jsx(ae,{id:"price_out",type:"number",step:"0.1",min:"0",value:C?.price_out??"",onChange:re=>{const pe=re.target.value===""?null:parseFloat(re.target.value);D(as=>as?{...as,price_out:pe}:null)},placeholder:"默认: 0"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"enable_model_temperature",className:"cursor-pointer",children:"自定义模型温度"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后将覆盖「为模型分配功能」中的任务温度配置"})]}),e.jsx(Ge,{id:"enable_model_temperature",checked:C?.temperature!=null,onCheckedChange:re=>{D(re?pe=>pe?{...pe,temperature:.5}:null:pe=>pe?{...pe,temperature:null}:null)}})]}),C?.temperature!=null&&e.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm",children:"温度值"}),e.jsx("span",{className:"text-sm font-medium tabular-nums",children:C.temperature.toFixed(1)})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"0"}),e.jsx(Qa,{value:[C.temperature],onValueChange:re=>D(pe=>pe?{...pe,temperature:re[0]}:null),min:0,max:1,step:.1,className:"flex-1"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"较低的温度(0.1-0.3)产生更确定的输出,较高的温度(0.7-1.0)产生更多样化的输出"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"enable_model_max_tokens",className:"cursor-pointer",children:"自定义最大 Token"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后将覆盖「为模型分配功能」中的任务最大 Token 配置"})]}),e.jsx(Ge,{id:"enable_model_max_tokens",checked:C?.max_tokens!=null,onCheckedChange:re=>{D(re?pe=>pe?{...pe,max_tokens:2048}:null:pe=>pe?{...pe,max_tokens:null}:null)}})]}),C?.max_tokens!=null&&e.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm",children:"最大 Token 数"}),e.jsx(ae,{type:"number",min:"1",max:"128000",value:C.max_tokens,onChange:re=>{const pe=parseInt(re.target.value);!isNaN(pe)&&pe>=1&&D(as=>as?{...as,max_tokens:pe}:null)},className:"w-28 h-8 text-sm"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"限制模型单次输出的最大 token 数量,不同模型支持的上限不同"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"force_stream_mode",checked:C?.force_stream_mode||!1,onCheckedChange:re=>D(pe=>pe?{...pe,force_stream_mode:re}:null)}),e.jsx(T,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"额外参数"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(_,{type:"button",variant:"outline",size:"sm",className:"flex-1 justify-start h-9",onClick:()=>L(!0),children:[e.jsx(vn,{className:"h-4 w-4 mr-2"}),Object.keys(C?.extra_params||{}).length>0?e.jsxs("span",{children:["已配置 ",Object.keys(C?.extra_params||{}).length," 个参数"]}):e.jsx("span",{className:"text-muted-foreground",children:"未配置额外参数"})]})}),Object.keys(C?.extra_params||{}).length>0&&e.jsxs("div",{className:"text-xs text-muted-foreground px-1",children:[Object.keys(C?.extra_params||{}).slice(0,3).map(re=>e.jsx("span",{className:"inline-block mr-2",children:e.jsx("code",{className:"px-1.5 py-0.5 bg-muted rounded",children:re})},re)),Object.keys(C?.extra_params||{}).length>3&&e.jsx("span",{children:"..."})]})]})]}),e.jsxs(nt,{children:[e.jsx(_,{variant:"outline",onClick:()=>E(!1),"data-tour":"model-cancel-button",children:"取消"}),e.jsx(_,{onClick:rs,"data-tour":"model-save-button",children:"保存"})]})]})}),e.jsx(gs,{open:oe,onOpenChange:Ne,children:e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认删除"}),e.jsxs(ms,{children:['确定要删除模型 "',je!==null?a[je]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:Oa,children:"删除"})]})]})}),e.jsx(gs,{open:$,onOpenChange:ue,children:e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认批量删除"}),e.jsxs(ms,{children:["确定要删除选中的 ",R.size," 个模型吗? 此操作无法撤销。"]})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:te,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),e.jsx(gs,{open:Ae,onOpenChange:ee,children:e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsxs(us,{className:"flex items-center gap-2",children:[e.jsx(It,{className:"h-5 w-5 text-amber-500"}),"更换嵌入模型警告"]}),e.jsx(ms,{asChild:!0,children:e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-foreground",children:"注意:"}),"更换嵌入模型可能会影响知识库的匹配精度!"]}),e.jsxs("ul",{className:"space-y-2 ml-4 list-disc text-muted-foreground",children:[e.jsx("li",{children:"不同的嵌入模型会产生不同的向量表示"}),e.jsx("li",{children:"这可能导致现有知识库的检索结果不准确"}),e.jsx("li",{children:"建议更换嵌入模型后重新生成所有知识库的向量"})]}),e.jsx("p",{className:"text-foreground font-medium",children:"确定要更换嵌入模型吗?"})]})})]}),e.jsxs(ds,{children:[e.jsx(hs,{onClick:Gs,children:"取消"}),e.jsx(xs,{onClick:Oe,className:"bg-amber-600 hover:bg-amber-700",children:"确认更换"})]})]})}),e.jsx(l4,{open:J,onOpenChange:L,value:C?.extra_params||{},onChange:re=>D(pe=>pe?{...pe,extra_params:re}:null)}),e.jsx(er,{})]})})}const uc=_j,mc=ww,xc=_w,hd="/api/webui/config";async function C4(){const l=await(await _e(`${hd}/adapter-config/path`)).json();return!l.success||!l.path?null:{path:l.path,lastModified:l.lastModified}}async function Kg(a){const r=await(await _e(`${hd}/adapter-config/path`,{method:"POST",headers:qs(),body:JSON.stringify({path:a})})).json();if(!r.success)throw new Error(r.message||"保存路径失败")}async function Qg(a){const r=await(await _e(`${hd}/adapter-config?path=${encodeURIComponent(a)}`)).json();if(!r.success)throw new Error("读取配置文件失败");return r.content}async function Yg(a,l){const c=await(await _e(`${hd}/adapter-config`,{method:"POST",headers:qs(),body:JSON.stringify({path:a,content:l})})).json();if(!c.success)throw new Error(c.message||"保存配置失败")}const St={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},debug:{level:"INFO"}},Im={oneclick:{name:"一键包",description:"使用一键包部署的适配器配置",path:"../MaiBot-Napcat-Adapter/config.toml",icon:ra},docker:{name:"Docker",description:"Docker Compose 部署的适配器配置",path:"/MaiMBot/adapters-config/config.toml",icon:M_}};function Pm(a){try{const l=vx(a);return{inner:{...St.inner,...l.inner},nickname:{...St.nickname,...l.nickname},napcat_server:{...St.napcat_server,...l.napcat_server},maibot_server:{...St.maibot_server,...l.maibot_server},chat:{...St.chat,...l.chat},voice:{...St.voice,...l.voice},debug:{...St.debug,...l.debug}}}catch(l){throw console.error("TOML 解析失败:",l),new Error(`无法解析 TOML 文件: ${l instanceof Error?l.message:"未知错误"}`)}}function Fm(a){try{const l=(d,u)=>d===""||d===null||d===void 0?u:d,r={inner:{version:l(a.inner.version,St.inner.version)},nickname:{nickname:l(a.nickname.nickname,St.nickname.nickname)},napcat_server:{host:l(a.napcat_server.host,St.napcat_server.host),port:l(a.napcat_server.port||0,St.napcat_server.port),token:l(a.napcat_server.token,St.napcat_server.token),heartbeat_interval:l(a.napcat_server.heartbeat_interval||0,St.napcat_server.heartbeat_interval)},maibot_server:{host:l(a.maibot_server.host,St.maibot_server.host),port:l(a.maibot_server.port||0,St.maibot_server.port)},chat:{group_list_type:l(a.chat.group_list_type,St.chat.group_list_type),group_list:a.chat.group_list||[],private_list_type:l(a.chat.private_list_type,St.chat.private_list_type),private_list:a.chat.private_list||[],ban_user_id:a.chat.ban_user_id||[],ban_qq_bot:a.chat.ban_qq_bot??St.chat.ban_qq_bot,enable_poke:a.chat.enable_poke??St.chat.enable_poke},voice:{use_tts:a.voice.use_tts??St.voice.use_tts},debug:{level:l(a.debug.level,St.debug.level)}};let c=BS(r);return c=T4(c),c}catch(l){throw console.error("TOML 生成失败:",l),new Error(`无法生成 TOML 文件: ${l instanceof Error?l.message:"未知错误"}`)}}function T4(a){const l=a.split(` -`),r=[];for(let c=0;c"|?*\x00-\x1F]/.test(a)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}}function E4(){const[a,l]=m.useState("upload"),[r,c]=m.useState(null),[d,u]=m.useState(""),[h,f]=m.useState(""),[p,g]=m.useState("oneclick"),[b,j]=m.useState(""),[y,N]=m.useState(!1),[w,M]=m.useState(!1),[A,S]=m.useState(!1),[U,E]=m.useState(!1),[C,D]=m.useState(null),[P,O]=m.useState(!1),J=m.useRef(null),{toast:L}=Ws(),oe=m.useRef(null),Ne=z=>{if(f(z),z.trim()){const K=Hm(z);j(K.error)}else j("")},je=m.useCallback(async z=>{const K=Im[z];M(!0);try{const Ae=await Qg(K.path),ee=Pm(Ae);c(ee),g(z),f(K.path),await Kg(K.path),L({title:"加载成功",description:`已从${K.name}预设加载配置`})}catch(Ae){console.error("加载预设配置失败:",Ae),L({title:"加载失败",description:Ae instanceof Error?Ae.message:"无法读取预设配置文件",variant:"destructive"})}finally{M(!1)}},[L]),de=m.useCallback(async z=>{const K=Hm(z);if(!K.valid){j(K.error),L({title:"路径无效",description:K.error,variant:"destructive"});return}j(""),M(!0);try{const Ae=await Qg(z),ee=Pm(Ae);c(ee),f(z),await Kg(z),L({title:"加载成功",description:"已从配置文件加载"})}catch(Ae){console.error("加载配置失败:",Ae),L({title:"加载失败",description:Ae instanceof Error?Ae.message:"无法读取配置文件",variant:"destructive"})}finally{M(!1)}},[L]);m.useEffect(()=>{(async()=>{try{const K=await C4();if(K&&K.path){f(K.path);const Ae=Object.entries(Im).find(([,ee])=>ee.path===K.path);Ae?(l("preset"),g(Ae[0]),await je(Ae[0])):(l("path"),await de(K.path))}}catch(K){console.error("加载保存的路径失败:",K)}})()},[de,je]);const he=m.useCallback(z=>{a!=="path"&&a!=="preset"||!h||(oe.current&&clearTimeout(oe.current),oe.current=setTimeout(async()=>{N(!0);try{const K=Fm(z);await Yg(h,K),L({title:"自动保存成功",description:"配置已保存到文件"})}catch(K){console.error("自动保存失败:",K),L({title:"自动保存失败",description:K instanceof Error?K.message:"保存配置失败",variant:"destructive"})}finally{N(!1)}},1e3))},[a,h,L]),ge=async()=>{if(!r||!h)return;const z=Hm(h);if(!z.valid){L({title:"保存失败",description:z.error,variant:"destructive"});return}N(!0);try{const K=Fm(r);await Yg(h,K),L({title:"保存成功",description:"配置已保存到文件"})}catch(K){console.error("保存失败:",K),L({title:"保存失败",description:K instanceof Error?K.message:"保存配置失败",variant:"destructive"})}finally{N(!1)}},R=async()=>{h&&await de(h)},Q=z=>{if(z!==a){if(r){D(z),S(!0);return}$(z)}},$=z=>{c(null),u(""),j(""),l(z),z==="preset"&&je("oneclick"),L({title:"已切换模式",description:{upload:"现在可以上传配置文件",path:"现在可以指定配置文件路径",preset:"现在可以使用预设配置"}[z]})},ue=()=>{C&&($(C),D(null)),S(!1)},G=()=>{if(r){E(!0);return}Se()},Se=()=>{f(""),c(null),j(""),L({title:"已清空",description:"路径和配置已清空"})},fe=()=>{Se(),E(!1)},Te=z=>{const K=z.target.files?.[0];if(!K)return;const Ae=new FileReader;Ae.onload=ee=>{try{const Y=ee.target?.result,$e=Pm(Y);c($e),u(K.name),L({title:"上传成功",description:`已加载配置文件:${K.name}`})}catch(Y){console.error("解析配置文件失败:",Y),L({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},Ae.readAsText(K)},q=()=>{if(!r)return;const z=Fm(r),K=new Blob([z],{type:"text/plain;charset=utf-8"}),Ae=URL.createObjectURL(K),ee=document.createElement("a");ee.href=Ae,ee.download=d||"config.toml",document.body.appendChild(ee),ee.click(),document.body.removeChild(ee),URL.revokeObjectURL(Ae),L({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},B=()=>{c(JSON.parse(JSON.stringify(St))),u("config.toml"),L({title:"已加载默认配置",description:"可以开始编辑配置"})};return e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg border border-amber-500/50 bg-amber-500/10 text-amber-700 dark:text-amber-400",children:[e.jsx(Ct,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),e.jsx("p",{className:"text-sm",children:"适配器配置保存之后使用 WebUI 的重启功能适配器并不会重启,需要手动重启适配器。"})]}),e.jsx(uc,{open:P,onOpenChange:O,children:e.jsxs(ke,{children:[e.jsx(Re,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(De,{children:"工作模式"}),e.jsx(is,{children:"选择配置文件的管理方式"})]}),e.jsx(mc,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"sm",className:"w-9 p-0",children:[e.jsx(za,{className:`h-4 w-4 transition-transform duration-200 ${P?"transform rotate-180":""}`}),e.jsx("span",{className:"sr-only",children:"切换"})]})})]})}),e.jsx(xc,{children:e.jsxs(Me,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 md:gap-4",children:[e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${a==="preset"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>Q("preset"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(ra,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"预设模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"使用预设的部署配置"})]})]})}),e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${a==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>Q("upload"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(rc,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${a==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>Q("path"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(A_,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),a==="preset"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsx(T,{className:"text-sm md:text-base",children:"选择部署方式"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(Im).map(([z,K])=>{const Ae=K.icon,ee=p===z;return e.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${ee?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{g(z),je(z)},children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ae,{className:"h-5 w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"font-semibold text-sm",children:K.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:K.description}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:K.path})]})]})},z)})})]}),a==="path"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(ae,{id:"config-path",value:h,onChange:z=>Ne(z.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${b?"border-destructive":""}`}),b&&e.jsx("p",{className:"text-xs text-destructive",children:b})]}),e.jsx(_,{onClick:()=>de(h),disabled:w||!h||!!b,className:"w-full sm:w-auto",children:w?e.jsxs(e.Fragment,{children:[e.jsx(xt,{className:"h-4 w-4 animate-spin mr-2"}),e.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sm:hidden",children:"加载配置"}),e.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),e.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[e.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[e.jsx("span",{children:"路径格式说明"}),e.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),e.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),e.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[e.jsx("div",{children:"C:\\Adapter\\config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),e.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[e.jsx("div",{children:"/opt/adapter/config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),e.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})})]})}),e.jsxs(it,{children:[e.jsx(Vt,{className:"h-4 w-4"}),e.jsx(ct,{children:a==="preset"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"预设模式:"}),"选择预设的部署方式,配置会自动加载,修改后 1 秒自动保存",y&&" (正在保存...)"]}):a==="upload"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",y&&" (正在保存...)"]})})]}),a==="upload"&&!r&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[e.jsx("input",{ref:J,type:"file",accept:".toml",className:"hidden",onChange:Te}),e.jsxs(_,{onClick:()=>J.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(rc,{className:"mr-2 h-4 w-4"}),"上传配置"]}),e.jsxs(_,{onClick:B,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(Ea,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),a==="upload"&&r&&e.jsx("div",{className:"flex gap-2",children:e.jsxs(_,{onClick:q,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(Wt,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),(a==="preset"||a==="path")&&r&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs(_,{onClick:ge,size:"sm",disabled:y||!!b,className:"w-full sm:w-auto",children:[e.jsx(fc,{className:"mr-2 h-4 w-4"}),y?"保存中...":"立即保存"]}),e.jsxs(_,{onClick:R,size:"sm",variant:"outline",disabled:w,className:"w-full sm:w-auto",children:[e.jsx(xt,{className:`mr-2 h-4 w-4 ${w?"animate-spin":""}`}),"刷新"]}),a==="path"&&e.jsxs(_,{onClick:G,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(ls,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),r?e.jsxs(ea,{defaultValue:"napcat",className:"w-full",children:[e.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:e.jsxs(Gt,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[e.jsxs(Xe,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),e.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),e.jsxs(Xe,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),e.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),e.jsxs(Xe,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),e.jsx("span",{className:"sm:hidden",children:"聊天"})]}),e.jsxs(Xe,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),e.jsx("span",{className:"sm:hidden",children:"语音"})]}),e.jsx(Xe,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),e.jsx(vs,{value:"napcat",className:"space-y-4",children:e.jsx(M4,{config:r,onChange:z=>{c(z),he(z)}})}),e.jsx(vs,{value:"maibot",className:"space-y-4",children:e.jsx(A4,{config:r,onChange:z=>{c(z),he(z)}})}),e.jsx(vs,{value:"chat",className:"space-y-4",children:e.jsx(z4,{config:r,onChange:z=>{c(z),he(z)}})}),e.jsx(vs,{value:"voice",className:"space-y-4",children:e.jsx(R4,{config:r,onChange:z=>{c(z),he(z)}})}),e.jsx(vs,{value:"debug",className:"space-y-4",children:e.jsx(D4,{config:r,onChange:z=>{c(z),he(z)}})})]}):e.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:e.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[e.jsx(Ea,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:a==="preset"?"请选择预设的部署方式":a==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),e.jsx(gs,{open:A,onOpenChange:S,children:e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认切换模式"}),e.jsxs(ms,{children:["切换模式将清空当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),e.jsxs(ds,{children:[e.jsx(hs,{onClick:()=>{S(!1),D(null)},children:"取消"}),e.jsx(xs,{onClick:ue,children:"确认切换"})]})]})}),e.jsx(gs,{open:U,onOpenChange:E,children:e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认清空路径"}),e.jsxs(ms,{children:["清空路径将清除当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),e.jsxs(ds,{children:[e.jsx(hs,{onClick:()=>E(!1),children:"取消"}),e.jsx(xs,{onClick:fe,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function M4({config:a,onChange:l}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),e.jsxs("div",{className:"grid gap-3 md:gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),e.jsx(ae,{id:"napcat-host",value:a.napcat_server.host,onChange:r=>l({...a,napcat_server:{...a.napcat_server,host:r.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),e.jsx(ae,{id:"napcat-port",type:"number",value:a.napcat_server.port||"",onChange:r=>l({...a,napcat_server:{...a.napcat_server,port:r.target.value?parseInt(r.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),e.jsx(ae,{id:"napcat-token",type:"password",value:a.napcat_server.token,onChange:r=>l({...a,napcat_server:{...a.napcat_server,token:r.target.value}}),placeholder:"留空表示无需令牌",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),e.jsx(ae,{id:"napcat-heartbeat",type:"number",value:a.napcat_server.heartbeat_interval||"",onChange:r=>l({...a,napcat_server:{...a.napcat_server,heartbeat_interval:r.target.value?parseInt(r.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function A4({config:a,onChange:l}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),e.jsxs("div",{className:"grid gap-3 md:gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),e.jsx(ae,{id:"maibot-host",value:a.maibot_server.host,onChange:r=>l({...a,maibot_server:{...a.maibot_server,host:r.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),e.jsx(ae,{id:"maibot-port",type:"number",value:a.maibot_server.port||"",onChange:r=>l({...a,maibot_server:{...a.maibot_server,port:r.target.value?parseInt(r.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function z4({config:a,onChange:l}){const r=u=>{const h={...a};u==="group"?h.chat.group_list=[...h.chat.group_list,0]:u==="private"?h.chat.private_list=[...h.chat.private_list,0]:h.chat.ban_user_id=[...h.chat.ban_user_id,0],l(h)},c=(u,h)=>{const f={...a};u==="group"?f.chat.group_list=f.chat.group_list.filter((p,g)=>g!==h):u==="private"?f.chat.private_list=f.chat.private_list.filter((p,g)=>g!==h):f.chat.ban_user_id=f.chat.ban_user_id.filter((p,g)=>g!==h),l(f)},d=(u,h,f)=>{const p={...a};u==="group"?p.chat.group_list[h]=f:u==="private"?p.chat.private_list[h]=f:p.chat.ban_user_id[h]=f,l(p)};return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),e.jsxs("div",{className:"grid gap-4 md:gap-6",children:[e.jsxs("div",{className:"space-y-3 md:space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-sm md:text-base",children:"群组名单类型"}),e.jsxs(Pe,{value:a.chat.group_list_type,onValueChange:u=>l({...a,chat:{...a.chat,group_list_type:u}}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(W,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsx(T,{className:"text-sm md:text-base",children:"群组列表"}),e.jsxs(_,{onClick:()=>r("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ea,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),a.chat.group_list.map((u,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{type:"number",value:u,onChange:f=>d("group",h,parseInt(f.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),e.jsxs(gs,{children:[e.jsx(jt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认删除"}),e.jsxs(ms,{children:["确定要删除群号 ",u," 吗?此操作无法撤销。"]})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:()=>c("group",h),children:"删除"})]})]})]})]},h)),a.chat.group_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),e.jsxs("div",{className:"space-y-3 md:space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-sm md:text-base",children:"私聊名单类型"}),e.jsxs(Pe,{value:a.chat.private_list_type,onValueChange:u=>l({...a,chat:{...a.chat,private_list_type:u}}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(W,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsx(T,{className:"text-sm md:text-base",children:"私聊列表"}),e.jsxs(_,{onClick:()=>r("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ea,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),a.chat.private_list.map((u,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{type:"number",value:u,onChange:f=>d("private",h,parseInt(f.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(gs,{children:[e.jsx(jt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认删除"}),e.jsxs(ms,{children:["确定要删除用户 ",u," 吗?此操作无法撤销。"]})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:()=>c("private",h),children:"删除"})]})]})]})]},h)),a.chat.private_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-sm md:text-base",children:"全局禁止名单"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),e.jsxs(_,{onClick:()=>r("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ea,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),a.chat.ban_user_id.map((u,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{type:"number",value:u,onChange:f=>d("ban",h,parseInt(f.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(gs,{children:[e.jsx(jt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认删除"}),e.jsxs(ms,{children:["确定要从全局禁止名单中删除用户 ",u," 吗?此操作无法撤销。"]})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:()=>c("ban",h),children:"删除"})]})]})]})]},h)),a.chat.ban_user_id.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),e.jsx(Ge,{checked:a.chat.ban_qq_bot,onCheckedChange:u=>l({...a,chat:{...a.chat,ban_qq_bot:u}})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),e.jsx(Ge,{checked:a.chat.enable_poke,onCheckedChange:u=>l({...a,chat:{...a.chat,enable_poke:u}})})]})]})]})})}function R4({config:a,onChange:l}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),e.jsx(Ge,{checked:a.voice.use_tts,onCheckedChange:r=>l({...a,voice:{use_tts:r}})})]})]})})}function D4({config:a,onChange:l}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),e.jsx("div",{className:"grid gap-3 md:gap-4",children:e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-sm md:text-base",children:"日志等级"}),e.jsxs(Pe,{value:a.debug.level,onValueChange:r=>l({...a,debug:{level:r}}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"DEBUG",children:"DEBUG(调试)"}),e.jsx(W,{value:"INFO",children:"INFO(信息)"}),e.jsx(W,{value:"WARNING",children:"WARNING(警告)"}),e.jsx(W,{value:"ERROR",children:"ERROR(错误)"}),e.jsx(W,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}const O4=["defaultChecked","defaultValue","suppressContentEditableWarning","suppressHydrationWarning","dangerouslySetInnerHTML","accessKey","className","contentEditable","contextMenu","dir","draggable","hidden","id","lang","placeholder","slot","spellCheck","style","tabIndex","title","translate","radioGroup","role","about","datatype","inlist","prefix","property","resource","typeof","vocab","autoCapitalize","autoCorrect","autoSave","color","itemProp","itemScope","itemType","itemID","itemRef","results","security","unselectable","inputMode","is","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],L4=/^(aria-|data-)/,eN=a=>Object.fromEntries(Object.entries(a).filter(([l])=>L4.test(l)||O4.includes(l)));function U4(a,l){const r=eN(a);return Object.keys(a).some(c=>!Object.hasOwn(r,c)&&a[c]!==l[c])}class $4 extends m.Component{container;plugin;componentDidMount(){this.installPlugin()}componentDidUpdate(l){if(l.uppy!==this.props.uppy)this.uninstallPlugin(l),this.installPlugin();else if(U4(this.props,l)){const{uppy:r,...c}={...this.props,target:this.container};this.plugin.setOptions(c)}}componentWillUnmount(){this.uninstallPlugin()}installPlugin(){const{uppy:l,...r}={id:"Dashboard",...this.props,inline:!0,target:this.container};l.use(m1,r),this.plugin=l.getPlugin(r.id)}uninstallPlugin(l=this.props){const{uppy:r}=l;r.removePlugin(this.plugin)}render(){return m.createElement("div",{className:"uppy-Container",ref:l=>{this.container=l},...eN(this.props)})}}function B4({src:a,alt:l="表情包",className:r,maxRetries:c=5,retryInterval:d=1500}){const[u,h]=m.useState("loading"),[f,p]=m.useState(0),[g,b]=m.useState(null),[j,y]=m.useState(a);a!==j&&(h("loading"),p(0),b(null),y(a));const N=m.useCallback(async()=>{try{const w=await fetch(a,{credentials:"include"});if(w.status===202){h("generating"),f{p(S=>S+1)},d):h("error");return}if(!w.ok){h("error");return}const M=await w.blob(),A=URL.createObjectURL(M);b(A),h("loaded")}catch(w){console.error("加载缩略图失败:",w),h("error")}},[a,f,c,d]);return m.useEffect(()=>{N()},[N]),m.useEffect(()=>()=>{g&&URL.revokeObjectURL(g)},[g]),u==="loading"||u==="generating"?e.jsx(ws,{className:F("w-full h-full",r)}):u==="error"||!g?e.jsx("div",{className:F("w-full h-full flex items-center justify-center bg-muted",r),children:e.jsx(cx,{className:"h-8 w-8 text-muted-foreground"})}):e.jsx("img",{src:g,alt:l,className:F("w-full h-full object-contain",r)})}function I4({children:a,className:l}){return e.jsx(px,{content:a,className:l})}const Ya="/api/webui/emoji";async function P4(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.search&&l.append("search",a.search),a.is_registered!==void 0&&l.append("is_registered",a.is_registered.toString()),a.is_banned!==void 0&&l.append("is_banned",a.is_banned.toString()),a.format&&l.append("format",a.format),a.sort_by&&l.append("sort_by",a.sort_by),a.sort_order&&l.append("sort_order",a.sort_order);const r=await _e(`${Ya}/list?${l}`,{});if(!r.ok)throw new Error(`获取表情包列表失败: ${r.statusText}`);return r.json()}async function F4(a){const l=await _e(`${Ya}/${a}`,{});if(!l.ok)throw new Error(`获取表情包详情失败: ${l.statusText}`);return l.json()}async function H4(a,l){const r=await _e(`${Ya}/${a}`,{method:"PATCH",body:JSON.stringify(l)});if(!r.ok)throw new Error(`更新表情包失败: ${r.statusText}`);return r.json()}async function V4(a){const l=await _e(`${Ya}/${a}`,{method:"DELETE"});if(!l.ok)throw new Error(`删除表情包失败: ${l.statusText}`);return l.json()}async function G4(){const a=await _e(`${Ya}/stats/summary`,{});if(!a.ok)throw new Error(`获取统计数据失败: ${a.statusText}`);return a.json()}async function q4(a){const l=await _e(`${Ya}/${a}/register`,{method:"POST"});if(!l.ok)throw new Error(`注册表情包失败: ${l.statusText}`);return l.json()}async function K4(a){const l=await _e(`${Ya}/${a}/ban`,{method:"POST"});if(!l.ok)throw new Error(`封禁表情包失败: ${l.statusText}`);return l.json()}function Q4(a,l=!1){return l?`${Ya}/${a}/thumbnail?original=true`:`${Ya}/${a}/thumbnail`}function Y4(a){return`${Ya}/${a}/thumbnail?original=true`}async function J4(a){const l=await _e(`${Ya}/batch/delete`,{method:"POST",body:JSON.stringify({emoji_ids:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"批量删除失败")}return l.json()}function X4(){return`${Ya}/upload`}function Z4(){const[a,l]=m.useState([]),[r,c]=m.useState(null),[d,u]=m.useState(!1),[h,f]=m.useState(1),[p,g]=m.useState(0),[b,j]=m.useState(20),[y,N]=m.useState("all"),[w,M]=m.useState("all"),[A,S]=m.useState("all"),[U,E]=m.useState("usage_count"),[C,D]=m.useState("desc"),[P,O]=m.useState(null),[J,L]=m.useState(!1),[oe,Ne]=m.useState(!1),[je,de]=m.useState(!1),[he,ge]=m.useState(new Set),[R,Q]=m.useState(!1),[$,ue]=m.useState(""),[G,Se]=m.useState("medium"),[fe,Te]=m.useState(!1),{toast:q}=Ws(),B=m.useCallback(async()=>{try{u(!0);const me=await P4({page:h,page_size:b,is_registered:y==="all"?void 0:y==="registered",is_banned:w==="all"?void 0:w==="banned",format:A==="all"?void 0:A,sort_by:U,sort_order:C});l(me.data),g(me.total)}catch(me){const ze=me instanceof Error?me.message:"加载表情包列表失败";q({title:"错误",description:ze,variant:"destructive"})}finally{u(!1)}},[h,b,y,w,A,U,C,q]),z=async()=>{try{const me=await G4();c(me.data)}catch(me){console.error("加载统计数据失败:",me)}};m.useEffect(()=>{B()},[B]),m.useEffect(()=>{z()},[]);const K=async me=>{try{const ze=await F4(me.id);O(ze.data),L(!0)}catch(ze){const at=ze instanceof Error?ze.message:"加载详情失败";q({title:"错误",description:at,variant:"destructive"})}},Ae=me=>{O(me),Ne(!0)},ee=me=>{O(me),de(!0)},Y=async()=>{if(P)try{await V4(P.id),q({title:"成功",description:"表情包已删除"}),de(!1),O(null),B(),z()}catch(me){const ze=me instanceof Error?me.message:"删除失败";q({title:"错误",description:ze,variant:"destructive"})}},$e=async me=>{try{await q4(me.id),q({title:"成功",description:"表情包已注册"}),B(),z()}catch(ze){const at=ze instanceof Error?ze.message:"注册失败";q({title:"错误",description:at,variant:"destructive"})}},H=async me=>{try{await K4(me.id),q({title:"成功",description:"表情包已封禁"}),B(),z()}catch(ze){const at=ze instanceof Error?ze.message:"封禁失败";q({title:"错误",description:at,variant:"destructive"})}},se=me=>{const ze=new Set(he);ze.has(me)?ze.delete(me):ze.add(me),ge(ze)},Ue=async()=>{try{const me=await J4(Array.from(he));q({title:"批量删除完成",description:me.message}),ge(new Set),Q(!1),B(),z()}catch(me){q({title:"批量删除失败",description:me instanceof Error?me.message:"批量删除失败",variant:"destructive"})}},ie=()=>{const me=parseInt($),ze=Math.ceil(p/b);me>=1&&me<=ze?(f(me),ue("")):q({title:"无效的页码",description:`请输入1-${ze}之间的页码`,variant:"destructive"})},Ee=r?.formats?Object.keys(r.formats):[];return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),e.jsxs(_,{onClick:()=>Te(!0),className:"gap-2",children:[e.jsx(rc,{className:"h-4 w-4"}),"上传表情包"]})]}),e.jsx(Ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[r&&e.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[e.jsx(ke,{children:e.jsxs(Re,{className:"pb-2",children:[e.jsx(is,{children:"总数"}),e.jsx(De,{className:"text-2xl",children:r.total})]})}),e.jsx(ke,{children:e.jsxs(Re,{className:"pb-2",children:[e.jsx(is,{children:"已注册"}),e.jsx(De,{className:"text-2xl text-green-600",children:r.registered})]})}),e.jsx(ke,{children:e.jsxs(Re,{className:"pb-2",children:[e.jsx(is,{children:"已封禁"}),e.jsx(De,{className:"text-2xl text-red-600",children:r.banned})]})}),e.jsx(ke,{children:e.jsxs(Re,{className:"pb-2",children:[e.jsx(is,{children:"未注册"}),e.jsx(De,{className:"text-2xl text-gray-600",children:r.unregistered})]})})]}),e.jsxs(ke,{children:[e.jsx(Re,{children:e.jsxs(De,{className:"flex items-center gap-2",children:[e.jsx(Bo,{className:"h-5 w-5"}),"筛选和排序"]})}),e.jsxs(Me,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"排序方式"}),e.jsxs(Pe,{value:`${U}-${C}`,onValueChange:me=>{const[ze,at]=me.split("-");E(ze),D(at),f(1)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"usage_count-desc",children:"使用次数 (多→少)"}),e.jsx(W,{value:"usage_count-asc",children:"使用次数 (少→多)"}),e.jsx(W,{value:"register_time-desc",children:"注册时间 (新→旧)"}),e.jsx(W,{value:"register_time-asc",children:"注册时间 (旧→新)"}),e.jsx(W,{value:"record_time-desc",children:"记录时间 (新→旧)"}),e.jsx(W,{value:"record_time-asc",children:"记录时间 (旧→新)"}),e.jsx(W,{value:"last_used_time-desc",children:"最后使用 (新→旧)"}),e.jsx(W,{value:"last_used_time-asc",children:"最后使用 (旧→新)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"注册状态"}),e.jsxs(Pe,{value:y,onValueChange:me=>{N(me),f(1)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"全部"}),e.jsx(W,{value:"registered",children:"已注册"}),e.jsx(W,{value:"unregistered",children:"未注册"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"封禁状态"}),e.jsxs(Pe,{value:w,onValueChange:me=>{M(me),f(1)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"全部"}),e.jsx(W,{value:"banned",children:"已封禁"}),e.jsx(W,{value:"unbanned",children:"未封禁"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"格式"}),e.jsxs(Pe,{value:A,onValueChange:me=>{S(me),f(1)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"全部"}),Ee.map(me=>e.jsxs(W,{value:me,children:[me.toUpperCase()," (",r?.formats[me],")"]},me))]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[he.size>0&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",he.size," 个表情包"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{className:"text-sm whitespace-nowrap",children:"卡片大小"}),e.jsxs(Pe,{value:G,onValueChange:me=>Se(me),children:[e.jsx(Be,{className:"w-24",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"small",children:"小"}),e.jsx(W,{value:"medium",children:"中"}),e.jsx(W,{value:"large",children:"大"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Pe,{value:b.toString(),onValueChange:me=>{j(parseInt(me)),f(1),ge(new Set)},children:[e.jsx(Be,{id:"emoji-page-size",className:"w-20",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"40",children:"40"}),e.jsx(W,{value:"60",children:"60"}),e.jsx(W,{value:"100",children:"100"})]})]}),he.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>ge(new Set),children:"取消选择"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>Q(!0),children:[e.jsx(ls,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),e.jsx("div",{className:"flex justify-end pt-4 border-t",children:e.jsxs(_,{variant:"outline",size:"sm",onClick:B,disabled:d,children:[e.jsx(xt,{className:`h-4 w-4 mr-2 ${d?"animate-spin":""}`}),"刷新"]})})]})]}),e.jsxs(ke,{children:[e.jsxs(Re,{children:[e.jsx(De,{children:"表情包列表"}),e.jsxs(is,{children:["共 ",p," 个表情包,当前第 ",h," 页"]})]}),e.jsxs(Me,{children:[a.length===0?e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"暂无数据"}):e.jsx("div",{className:`grid gap-3 ${G==="small"?"grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10":G==="medium"?"grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8":"grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5"}`,children:a.map(me=>e.jsxs("div",{className:`group relative rounded-lg border bg-card overflow-hidden hover:ring-2 hover:ring-primary transition-all cursor-pointer ${he.has(me.id)?"ring-2 ring-primary bg-primary/5":""}`,onClick:()=>se(me.id),children:[e.jsx("div",{className:`absolute top-1 left-1 z-10 transition-opacity ${he.has(me.id)?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:e.jsx("div",{className:`w-5 h-5 rounded-full border-2 flex items-center justify-center ${he.has(me.id)?"bg-primary border-primary text-primary-foreground":"bg-background/80 border-muted-foreground/50"}`,children:he.has(me.id)&&e.jsx(bt,{className:"h-3 w-3"})})}),e.jsxs("div",{className:"absolute top-1 right-1 z-10 flex flex-col gap-0.5",children:[me.is_registered&&e.jsx(Ce,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"已注册"}),me.is_banned&&e.jsx(Ce,{variant:"destructive",className:"text-[10px] px-1 py-0",children:"已封禁"})]}),e.jsx("div",{className:`aspect-square bg-muted flex items-center justify-center overflow-hidden ${G==="small"?"p-1":G==="medium"?"p-2":"p-3"}`,children:e.jsx(B4,{src:Q4(me.id),alt:"表情包"})}),e.jsxs("div",{className:`border-t bg-card ${G==="small"?"p-1":"p-2"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-1 text-xs text-muted-foreground mb-1",children:[e.jsx(Ce,{variant:"outline",className:"text-[10px] px-1 py-0",children:me.format.toUpperCase()}),e.jsxs("span",{className:"font-mono",children:[me.usage_count,"次"]})]}),e.jsxs("div",{className:`flex gap-1 justify-center opacity-0 group-hover:opacity-100 transition-opacity ${G==="small"?"flex-wrap":""}`,children:[e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:ze=>{ze.stopPropagation(),Ae(me)},title:"编辑",children:e.jsx(Jn,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:ze=>{ze.stopPropagation(),K(me)},title:"详情",children:e.jsx(Vt,{className:"h-3 w-3"})}),!me.is_registered&&e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6 text-green-600 hover:text-green-700",onClick:ze=>{ze.stopPropagation(),$e(me)},title:"注册",children:e.jsx(bt,{className:"h-3 w-3"})}),!me.is_banned&&e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6 text-orange-600 hover:text-orange-700",onClick:ze=>{ze.stopPropagation(),H(me)},title:"封禁",children:e.jsx(z_,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:ze=>{ze.stopPropagation(),ee(me)},title:"删除",children:e.jsx(ls,{className:"h-3 w-3"})})]})]})]},me.id))}),p>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(h-1)*b+1," 到"," ",Math.min(h*b,p)," 条,共 ",p," 条"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(Nn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(me=>Math.max(1,me-1)),disabled:h===1,children:[e.jsx(Da,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{type:"number",value:$,onChange:me=>ue(me.target.value),onKeyDown:me=>me.key==="Enter"&&ie(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(p/b)}),e.jsx(_,{variant:"outline",size:"sm",onClick:ie,disabled:!$,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(me=>me+1),disabled:h>=Math.ceil(p/b),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(sa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(p/b)),disabled:h>=Math.ceil(p/b),className:"hidden sm:flex",children:e.jsx(bn,{className:"h-4 w-4"})})]})]})]})]}),e.jsx(W4,{emoji:P,open:J,onOpenChange:L}),e.jsx(ek,{emoji:P,open:oe,onOpenChange:Ne,onSuccess:()=>{B(),z()}}),e.jsx(sk,{open:fe,onOpenChange:Te,onSuccess:()=>{B(),z()}})]})}),e.jsx(gs,{open:R,onOpenChange:Q,children:e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认批量删除"}),e.jsxs(ms,{children:["你确定要删除选中的 ",he.size," 个表情包吗?此操作不可撤销。"]})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:Ue,children:"确认删除"})]})]})}),e.jsx(Fs,{open:je,onOpenChange:de,children:e.jsxs(Us,{children:[e.jsxs($s,{children:[e.jsx(Bs,{children:"确认删除"}),e.jsx(Xs,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),e.jsxs(nt,{children:[e.jsx(_,{variant:"outline",onClick:()=>de(!1),children:"取消"}),e.jsx(_,{variant:"destructive",onClick:Y,children:"删除"})]})]})})]})}function W4({emoji:a,open:l,onOpenChange:r}){if(!a)return null;const c=d=>d?new Date(d*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Fs,{open:l,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl max-h-[90vh]",children:[e.jsx($s,{children:e.jsx(Bs,{children:"表情包详情"})}),e.jsx(Ze,{className:"max-h-[calc(90vh-8rem)] pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:Y4(a.id),alt:a.description||"表情包",className:"w-full h-full object-cover",onError:d=>{const u=d.target;u.style.display="none";const h=u.parentElement;h&&(h.innerHTML='')}})})}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"ID"}),e.jsx("div",{className:"mt-1 font-mono",children:a.id})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"格式"}),e.jsx("div",{className:"mt-1",children:e.jsx(Ce,{variant:"outline",children:a.format.toUpperCase()})})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"文件路径"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:a.full_path})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"哈希值"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:a.emoji_hash})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"描述"}),a.description?e.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:e.jsx(I4,{className:"prose-sm",children:a.description})}):e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"情绪"}),e.jsx("div",{className:"mt-1",children:a.emotion?e.jsx("span",{className:"text-sm",children:a.emotion}):e.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"状态"}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[a.is_registered&&e.jsx(Ce,{variant:"default",className:"bg-green-600",children:"已注册"}),a.is_banned&&e.jsx(Ce,{variant:"destructive",children:"已封禁"}),!a.is_registered&&!a.is_banned&&e.jsx(Ce,{variant:"outline",children:"未注册"})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"使用次数"}),e.jsx("div",{className:"mt-1 font-mono text-lg",children:a.usage_count})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"记录时间"}),e.jsx("div",{className:"mt-1 text-sm",children:c(a.record_time)})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"注册时间"}),e.jsx("div",{className:"mt-1 text-sm",children:c(a.register_time)})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"最后使用"}),e.jsx("div",{className:"mt-1 text-sm",children:c(a.last_used_time)})]})]})})]})})}function ek({emoji:a,open:l,onOpenChange:r,onSuccess:c}){const[d,u]=m.useState(""),[h,f]=m.useState(!1),[p,g]=m.useState(!1),[b,j]=m.useState(!1),{toast:y}=Ws();m.useEffect(()=>{a&&(u(a.emotion||""),f(a.is_registered),g(a.is_banned))},[a]);const N=async()=>{if(a)try{j(!0);const w=d.split(/[,,]/).map(M=>M.trim()).filter(Boolean).join(",");await H4(a.id,{emotion:w||void 0,is_registered:h,is_banned:p}),y({title:"成功",description:"表情包信息已更新"}),r(!1),c()}catch(w){const M=w instanceof Error?w.message:"保存失败";y({title:"错误",description:M,variant:"destructive"})}finally{j(!1)}};return a?e.jsx(Fs,{open:l,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl",children:[e.jsxs($s,{children:[e.jsx(Bs,{children:"编辑表情包"}),e.jsx(Xs,{children:"修改表情包的情绪和状态信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(T,{children:"情绪"}),e.jsx(rt,{value:d,onChange:w=>u(w.target.value),placeholder:"输入情绪描述...",rows:2,className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入情绪相关的文本描述"})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Js,{id:"is_registered",checked:h,onCheckedChange:w=>{w===!0?(f(!0),g(!1)):f(!1)}}),e.jsx(T,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Js,{id:"is_banned",checked:p,onCheckedChange:w=>{w===!0?(g(!0),f(!1)):g(!1)}}),e.jsx(T,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),e.jsxs(nt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(_,{onClick:N,disabled:b,children:b?"保存中...":"保存"})]})]})}):null}function sk({open:a,onOpenChange:l,onSuccess:r}){const[c,d]=m.useState("select"),[u,h]=m.useState([]),[f,p]=m.useState(null),[g,b]=m.useState(!1),{toast:j}=Ws(),y=m.useMemo(()=>new x1({id:"emoji-uploader",autoProceed:!1,restrictions:{maxFileSize:10485760,allowedFileTypes:["image/jpeg","image/png","image/gif","image/webp"],maxNumberOfFiles:20},locale:{pluralize:()=>0,strings:{addMoreFiles:"添加更多文件",addingMoreFiles:"正在添加更多文件",allowedFileTypes:"允许的文件类型:%{types}",cancel:"取消",closeModal:"关闭",complete:"完成",connectedToInternet:"已连接到互联网",copyLink:"复制链接",copyLinkToClipboardFallback:"复制下方链接",copyLinkToClipboardSuccess:"链接已复制到剪贴板",dashboardTitle:"选择文件",dashboardWindowTitle:"文件选择窗口(按 ESC 关闭)",done:"完成",dropHereOr:"拖放文件到这里或 %{browse}",dropHint:"将文件拖放到此处",dropPasteFiles:"将文件拖放到这里或 %{browseFiles}",dropPasteFolders:"将文件拖放到这里或 %{browseFolders}",dropPasteBoth:"将文件拖放到这里,%{browseFiles} 或 %{browseFolders}",dropPasteImportFiles:"将文件拖放到这里,%{browseFiles} 或从以下位置导入:",dropPasteImportFolders:"将文件拖放到这里,%{browseFolders} 或从以下位置导入:",dropPasteImportBoth:"将文件拖放到这里,%{browseFiles},%{browseFolders} 或从以下位置导入:",editFile:"编辑文件",editing:"正在编辑 %{file}",emptyFolderAdded:"未从空文件夹添加文件",exceedsSize:"%{file} 超过了最大允许大小 %{size}",failedToUpload:"上传 %{file} 失败",fileSource:"文件来源:%{name}",filesUploadedOfTotal:{0:"已上传 %{complete} / %{smart_count} 个文件",1:"已上传 %{complete} / %{smart_count} 个文件"},filter:"筛选",finishEditingFile:"完成编辑文件",folderAdded:{0:"已从 %{folder} 添加 %{smart_count} 个文件",1:"已从 %{folder} 添加 %{smart_count} 个文件"},generatingThumbnails:"正在生成缩略图...",import:"导入",importFiles:"从以下位置导入文件:",importFrom:"从 %{name} 导入",loading:"加载中...",logOut:"登出",myDevice:"我的设备",noFilesFound:"这里没有文件或文件夹",noInternetConnection:"无网络连接",openFolderNamed:"打开文件夹 %{name}",pause:"暂停",pauseUpload:"暂停上传",paused:"已暂停",poweredBy:"技术支持:%{uppy}",processingXFiles:{0:"正在处理 %{smart_count} 个文件",1:"正在处理 %{smart_count} 个文件"},recording:"录制中",removeFile:"移除文件",resetFilter:"重置筛选",resume:"继续",resumeUpload:"继续上传",retry:"重试",retryUpload:"重试上传",save:"保存",saveChanges:"保存更改",selectFileNamed:"选择文件 %{name}",selectX:{0:"选择 %{smart_count}",1:"选择 %{smart_count}"},smile:"笑一个!",startRecording:"开始录制视频",stopRecording:"停止录制视频",takePicture:"拍照",timedOut:"上传已停滞 %{seconds} 秒,正在中止。",upload:"下一步",uploadComplete:"上传完成",uploadFailed:"上传失败",uploadPaused:"上传已暂停",uploadXFiles:{0:"下一步(%{smart_count} 个文件)",1:"下一步(%{smart_count} 个文件)"},uploadXNewFiles:{0:"下一步(+%{smart_count} 个文件)",1:"下一步(+%{smart_count} 个文件)"},uploading:"正在上传",uploadingXFiles:{0:"正在上传 %{smart_count} 个文件",1:"正在上传 %{smart_count} 个文件"},xFilesSelected:{0:"已选择 %{smart_count} 个文件",1:"已选择 %{smart_count} 个文件"},xMoreFilesAdded:{0:"又添加了 %{smart_count} 个文件",1:"又添加了 %{smart_count} 个文件"},xTimeLeft:"剩余 %{time}",youCanOnlyUploadFileTypes:"您只能上传:%{types}",youCanOnlyUploadX:{0:"您只能上传 %{smart_count} 个文件",1:"您只能上传 %{smart_count} 个文件"},youHaveToAtLeastSelectX:{0:"您至少需要选择 %{smart_count} 个文件",1:"您至少需要选择 %{smart_count} 个文件"},browseFiles:"浏览文件",browseFolders:"浏览文件夹",cancelUpload:"取消上传",addMore:"添加更多",back:"返回",editFileWithFilename:"编辑文件 %{file}"}}}),[]);m.useEffect(()=>{const P=()=>{const O=y.getFiles();if(O.length===0)return;const J=O.map(L=>({id:L.id,name:L.name,previewUrl:L.preview||URL.createObjectURL(L.data),emotion:"",description:"",isRegistered:!0,file:L.data}));h(J),O.length===1?(p(J[0].id),d("edit-single")):d("edit-multiple")};return y.on("upload",P),()=>{y.off("upload",P)}},[y]),m.useEffect(()=>{a||(y.cancelAll(),d("select"),h([]),p(null),b(!1))},[a,y]);const N=m.useCallback((P,O)=>{h(J=>J.map(L=>L.id===P?{...L,...O}:L))},[]),w=m.useCallback(P=>P.emotion.trim().length>0,[]),M=m.useMemo(()=>u.length>0&&u.every(w),[u,w]),A=m.useMemo(()=>u.find(P=>P.id===f)||null,[u,f]),S=m.useCallback(()=>{(c==="edit-single"||c==="edit-multiple")&&(d("select"),h([]),p(null))},[c]),U=m.useCallback(async()=>{if(!M){j({title:"请填写必填项",description:"每个表情包的情感标签都是必填的",variant:"destructive"});return}b(!0);let P=0,O=0;try{for(const J of u){const L=new FormData;L.append("file",J.file),L.append("emotion",J.emotion),L.append("description",J.description),L.append("is_registered",J.isRegistered.toString());try{(await _e(X4(),{method:"POST",body:L})).ok?P++:O++}catch{O++}}O===0?(j({title:"上传成功",description:`成功上传 ${P} 个表情包`}),l(!1),r()):(j({title:"部分上传失败",description:`成功 ${P} 个,失败 ${O} 个`,variant:"destructive"}),r())}finally{b(!1)}},[M,u,j,l,r]),E=()=>e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"border rounded-lg overflow-hidden w-full",children:e.jsx($4,{uppy:y,proudlyDisplayPoweredByUppy:!1,hideProgressDetails:!0,height:350,width:"100%",theme:"auto",note:"支持 JPG、PNG、GIF、WebP 格式,最多 20 个文件"})})}),C=()=>{const P=u[0];return P?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(_,{variant:"ghost",size:"sm",onClick:S,children:[e.jsx(Ma,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"编辑表情包信息"})]}),e.jsxs("div",{className:"flex gap-6",children:[e.jsxs("div",{className:"flex-shrink-0",children:[e.jsx("div",{className:"w-32 h-32 rounded-lg border overflow-hidden bg-muted flex items-center justify-center",children:e.jsx("img",{src:P.previewUrl,alt:P.name,className:"max-w-full max-h-full object-contain"})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center truncate max-w-32",children:P.name})]}),e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"single-emotion",children:["情感标签 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ae,{id:"single-emotion",value:P.emotion,onChange:O=>N(P.id,{emotion:O.target.value}),placeholder:"多个标签用逗号分隔,如:开心,高兴",className:P.emotion.trim()?"":"border-destructive"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"用于情感匹配,多个标签用逗号分隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"single-description",children:"描述"}),e.jsx(ae,{id:"single-description",value:P.description,onChange:O=>N(P.id,{description:O.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Js,{id:"single-is-registered",checked:P.isRegistered,onCheckedChange:O=>N(P.id,{isRegistered:O===!0})}),e.jsx(T,{htmlFor:"single-is-registered",className:"cursor-pointer",children:"上传后立即注册(可被麦麦使用)"})]})]})]}),e.jsx(nt,{children:e.jsx(_,{onClick:U,disabled:!M||g,children:g?"上传中...":"上传"})})]}):null},D=()=>{const P=u.filter(w).length,O=u.length;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(_,{variant:"ghost",size:"sm",onClick:S,children:[e.jsx(Ma,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["编辑表情包信息(",P,"/",O," 已完成)"]})]}),e.jsx(Ce,{variant:M?"default":"secondary",children:M?e.jsxs(e.Fragment,{children:[e.jsx(Mt,{className:"h-3 w-3 mr-1"}),"全部完成"]}):e.jsxs(e.Fragment,{children:[e.jsx(Aa,{className:"h-3 w-3 mr-1"}),"未完成"]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Ze,{className:"h-[350px] pr-2",children:e.jsx("div",{className:"space-y-2",children:u.map(J=>{const L=w(J),oe=f===J.id;return e.jsxs("div",{onClick:()=>p(J.id),className:` - flex items-center gap-3 p-3 rounded-lg border-2 cursor-pointer transition-all - ${oe?"ring-2 ring-primary":""} - ${L?"border-green-500 bg-green-50 dark:bg-green-950/20":"border-border hover:border-muted-foreground/50"} - `,children:[e.jsx("div",{className:"w-12 h-12 rounded border overflow-hidden bg-muted flex-shrink-0 flex items-center justify-center",children:e.jsx("img",{src:J.previewUrl,alt:J.name,className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:J.name}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:J.emotion||"未填写情感标签"})]}),L?e.jsx(bt,{className:"h-5 w-5 text-green-500 flex-shrink-0"}):e.jsx("div",{className:"h-5 w-5 rounded-full border-2 border-muted-foreground/30 flex-shrink-0"})]},J.id)})})}),e.jsx("div",{className:"border rounded-lg p-4",children:A?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-16 h-16 rounded border overflow-hidden bg-muted flex items-center justify-center",children:e.jsx("img",{src:A.previewUrl,alt:A.name,className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:A.name}),w(A)&&e.jsxs(Ce,{variant:"outline",className:"text-green-600 border-green-600",children:[e.jsx(Mt,{className:"h-3 w-3 mr-1"}),"已完成"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"multi-emotion",children:["情感标签 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ae,{id:"multi-emotion",value:A.emotion,onChange:J=>N(A.id,{emotion:J.target.value}),placeholder:"多个标签用逗号分隔,如:开心,高兴",className:A.emotion.trim()?"":"border-destructive"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"multi-description",children:"描述"}),e.jsx(ae,{id:"multi-description",value:A.description,onChange:J=>N(A.id,{description:J.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Js,{id:"multi-is-registered",checked:A.isRegistered,onCheckedChange:J=>N(A.id,{isRegistered:J===!0})}),e.jsx(T,{htmlFor:"multi-is-registered",className:"cursor-pointer text-sm",children:"上传后立即注册"})]})]}):e.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:e.jsxs("div",{className:"text-center",children:[e.jsx(cx,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"点击左侧卡片编辑"})]})})})]}),e.jsx(nt,{children:e.jsx(_,{onClick:U,disabled:!M||g,children:g?"上传中...":`上传全部 (${O})`})})]})};return e.jsx(Fs,{open:a,onOpenChange:l,children:e.jsxs(Us,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[e.jsxs($s,{children:[e.jsxs(Bs,{className:"flex items-center gap-2",children:[e.jsx(rc,{className:"h-5 w-5"}),c==="select"&&"上传表情包 - 选择文件",c==="edit-single"&&"上传表情包 - 填写信息",c==="edit-multiple"&&"上传表情包 - 批量编辑"]}),e.jsxs(Xs,{children:[c==="select"&&"支持 JPG、PNG、GIF、WebP 格式,单个文件最大 10MB,可同时上传多个文件",c==="edit-single"&&"请填写表情包的情感标签(必填)和描述",c==="edit-multiple"&&"点击左侧卡片编辑每个表情包的信息,情感标签为必填项"]})]}),e.jsxs("div",{className:"overflow-y-auto pr-1",children:[c==="select"&&E(),c==="edit-single"&&C(),c==="edit-multiple"&&D()]})]})})}function tk(){const[a,l]=m.useState([]),[r,c]=m.useState(!0),[d,u]=m.useState(0),[h,f]=m.useState(1),[p,g]=m.useState(20),[b,j]=m.useState(""),[y,N]=m.useState(null),[w,M]=m.useState(!1),[A,S]=m.useState(!1),[U,E]=m.useState(!1),[C,D]=m.useState(null),[P,O]=m.useState(new Set),[J,L]=m.useState(!1),[oe,Ne]=m.useState(""),[je,de]=m.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[he,ge]=m.useState([]),[R,Q]=m.useState(new Map),[$,ue]=m.useState(!1),[G,Se]=m.useState(0),{toast:fe}=Ws(),Te=async()=>{try{c(!0);const ie=await J1({page:h,page_size:p,search:b||void 0});l(ie.data),u(ie.total)}catch(ie){fe({title:"加载失败",description:ie instanceof Error?ie.message:"无法加载表达方式",variant:"destructive"})}finally{c(!1)}},q=async()=>{try{const ie=await t2();ie?.data&&de(ie.data)}catch(ie){console.error("加载统计数据失败:",ie)}},B=async()=>{try{const ie=await xx();Se(ie.unchecked)}catch(ie){console.error("加载审核统计失败:",ie)}},z=async()=>{try{const ie=await mx();if(ie?.data){ge(ie.data);const Ee=new Map;ie.data.forEach(me=>{Ee.set(me.chat_id,me.chat_name)}),Q(Ee)}}catch(ie){console.error("加载聊天列表失败:",ie)}},K=ie=>R.get(ie)||ie;m.useEffect(()=>{Te(),B(),q(),z()},[h,p,b]);const Ae=async ie=>{try{const Ee=await X1(ie.id);N(Ee.data),M(!0)}catch(Ee){fe({title:"加载详情失败",description:Ee instanceof Error?Ee.message:"无法加载表达方式详情",variant:"destructive"})}},ee=ie=>{N(ie),S(!0)},Y=async ie=>{try{await e2(ie.id),fe({title:"删除成功",description:`已删除表达方式: ${ie.situation}`}),D(null),Te(),q()}catch(Ee){fe({title:"删除失败",description:Ee instanceof Error?Ee.message:"无法删除表达方式",variant:"destructive"})}},$e=ie=>{const Ee=new Set(P);Ee.has(ie)?Ee.delete(ie):Ee.add(ie),O(Ee)},H=()=>{P.size===a.length&&a.length>0?O(new Set):O(new Set(a.map(ie=>ie.id)))},se=async()=>{try{await s2(Array.from(P)),fe({title:"批量删除成功",description:`已删除 ${P.size} 个表达方式`}),O(new Set),L(!1),Te(),q()}catch(ie){fe({title:"批量删除失败",description:ie instanceof Error?ie.message:"无法批量删除表达方式",variant:"destructive"})}},Ue=()=>{const ie=parseInt(oe),Ee=Math.ceil(d/p);ie>=1&&ie<=Ee?(f(ie),Ne("")):fe({title:"无效的页码",description:`请输入1-${Ee}之间的页码`,variant:"destructive"})};return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(Ra,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(_,{variant:"outline",onClick:()=>ue(!0),className:"gap-2",children:[e.jsx(ev,{className:"h-4 w-4"}),"人工审核",G>0&&e.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-xs rounded-full bg-orange-500 text-white",children:G>99?"99+":G})]}),e.jsxs(_,{onClick:()=>E(!0),className:"gap-2",children:[e.jsx(Ys,{className:"h-4 w-4"}),"新增表达方式"]})]})]})}),e.jsx(Ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:je.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:je.recent_7days})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:je.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx(T,{htmlFor:"search",children:"搜索"}),e.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(At,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ae,{id:"search",placeholder:"搜索情境、风格或上下文...",value:b,onChange:ie=>j(ie.target.value),className:"pl-9"})]})}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:P.size>0&&e.jsxs("span",{children:["已选择 ",P.size," 个表达方式"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Pe,{value:p.toString(),onValueChange:ie=>{g(parseInt(ie)),f(1),O(new Set)},children:[e.jsx(Be,{id:"page-size",className:"w-20",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"10",children:"10"}),e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"50",children:"50"}),e.jsx(W,{value:"100",children:"100"})]})]}),P.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>O(new Set),children:"取消选择"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>L(!0),children:[e.jsx(ls,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(Ul,{children:[e.jsx($l,{children:e.jsxs(ht,{children:[e.jsx(ss,{className:"w-12",children:e.jsx(Js,{checked:P.size===a.length&&a.length>0,onCheckedChange:H})}),e.jsx(ss,{children:"情境"}),e.jsx(ss,{children:"风格"}),e.jsx(ss,{children:"聊天"}),e.jsx(ss,{className:"text-right",children:"操作"})]})}),e.jsx(Bl,{children:r?e.jsx(ht,{children:e.jsx(Ye,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):a.length===0?e.jsx(ht,{children:e.jsx(Ye,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):a.map(ie=>e.jsxs(ht,{children:[e.jsx(Ye,{children:e.jsx(Js,{checked:P.has(ie.id),onCheckedChange:()=>$e(ie.id)})}),e.jsx(Ye,{className:"font-medium max-w-xs truncate",children:ie.situation}),e.jsx(Ye,{className:"max-w-xs truncate",children:ie.style}),e.jsx(Ye,{className:"max-w-[200px] truncate",title:K(ie.chat_id),style:{wordBreak:"keep-all"},children:e.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:K(ie.chat_id)})}),e.jsx(Ye,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>ee(ie),children:[e.jsx(Jn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>Ae(ie),title:"查看详情",children:e.jsx(ia,{className:"h-4 w-4"})}),e.jsxs(_,{size:"sm",onClick:()=>D(ie),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(ls,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},ie.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:r?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):a.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):a.map(ie=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Js,{checked:P.has(ie.id),onCheckedChange:()=>$e(ie.id),className:"mt-1"}),e.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:ie.situation,children:ie.situation})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),e.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:ie.style,children:ie.style})]})]})]}),e.jsxs("div",{className:"text-sm",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),e.jsx("p",{className:"text-sm truncate",title:K(ie.chat_id),style:{wordBreak:"keep-all"},children:K(ie.chat_id)})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>ee(ie),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(Jn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Ae(ie),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:e.jsx(ia,{className:"h-3 w-3"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>D(ie),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(ls,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},ie.id))}),d>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",d," 条记录,第 ",h," / ",Math.ceil(d/p)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(Nn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Da,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{type:"number",value:oe,onChange:ie=>Ne(ie.target.value),onKeyDown:ie=>ie.key==="Enter"&&Ue(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(d/p)}),e.jsx(_,{variant:"outline",size:"sm",onClick:Ue,disabled:!oe,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(d/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(sa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(d/p)),disabled:h>=Math.ceil(d/p),className:"hidden sm:flex",children:e.jsx(bn,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(ak,{expression:y,open:w,onOpenChange:M,chatNameMap:R}),e.jsx(lk,{open:U,onOpenChange:E,chatList:he,onSuccess:()=>{Te(),q(),E(!1)}}),e.jsx(nk,{expression:y,open:A,onOpenChange:S,chatList:he,onSuccess:()=>{Te(),q(),S(!1)}}),e.jsx(gs,{open:!!C,onOpenChange:()=>D(null),children:e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认删除"}),e.jsxs(ms,{children:['确定要删除表达方式 "',C?.situation,'" 吗? 此操作不可撤销。']})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:()=>C&&Y(C),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(rk,{open:J,onOpenChange:L,onConfirm:se,count:P.size}),e.jsx(Ov,{open:$,onOpenChange:ie=>{ue(ie),ie||(Te(),q(),B())}})]})}function ak({expression:a,open:l,onOpenChange:r,chatNameMap:c}){if(!a)return null;const d=h=>h?new Date(h*1e3).toLocaleString("zh-CN"):"-",u=h=>c.get(h)||h;return e.jsx(Fs,{open:l,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs($s,{children:[e.jsx(Bs,{children:"表达方式详情"}),e.jsx(Xs,{children:"查看表达方式的完整信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Ki,{label:"情境",value:a.situation}),e.jsx(Ki,{label:"风格",value:a.style}),e.jsx(Ki,{label:"聊天",value:u(a.chat_id)}),e.jsx(Ki,{icon:Jr,label:"记录ID",value:a.id.toString(),mono:!0})]}),e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsx(Ki,{icon:na,label:"创建时间",value:d(a.create_date)})}),e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-4",children:[e.jsx(T,{className:"text-xs text-muted-foreground mb-3 block",children:"状态标记"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:F("flex h-8 w-8 items-center justify-center rounded-full",a.checked?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-400 dark:bg-gray-800 dark:text-gray-600"),children:a.checked?e.jsx(bt,{className:"h-5 w-5"}):e.jsx(Ho,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"已检查"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a.checked?"已通过审核":"未审核"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:F("flex h-8 w-8 items-center justify-center rounded-full",a.rejected?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":"bg-gray-100 text-gray-400 dark:bg-gray-800 dark:text-gray-600"),children:a.rejected?e.jsx(Ka,{className:"h-5 w-5"}):e.jsx(Ho,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"已拒绝"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a.rejected?"不会被使用":"正常"})]})]})]})]})]}),e.jsx(nt,{children:e.jsx(_,{onClick:()=>r(!1),children:"关闭"})})]})})}function Ki({icon:a,label:l,value:r,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a&&e.jsx(a,{className:"h-3 w-3"}),l]}),e.jsx("div",{className:F("text-sm",c&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function lk({open:a,onOpenChange:l,chatList:r,onSuccess:c}){const[d,u]=m.useState({situation:"",style:"",chat_id:""}),[h,f]=m.useState(!1),{toast:p}=Ws(),g=async()=>{if(!d.situation||!d.style||!d.chat_id){p({title:"验证失败",description:"请填写必填字段:情境、风格和聊天",variant:"destructive"});return}try{f(!0),await Z1(d),p({title:"创建成功",description:"表达方式已创建"}),u({situation:"",style:"",chat_id:""}),c()}catch(b){p({title:"创建失败",description:b instanceof Error?b.message:"无法创建表达方式",variant:"destructive"})}finally{f(!1)}};return e.jsx(Fs,{open:a,onOpenChange:l,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs($s,{children:[e.jsx(Bs,{children:"新增表达方式"}),e.jsx(Xs,{children:"创建新的表达方式记录"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"situation",children:["情境 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ae,{id:"situation",value:d.situation,onChange:b=>u({...d,situation:b.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"style",children:["风格 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ae,{id:"style",value:d.style,onChange:b=>u({...d,style:b.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"chat_id",children:["聊天 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Pe,{value:d.chat_id,onValueChange:b=>u({...d,chat_id:b}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择关联的聊天"})}),e.jsx(Ie,{children:r.map(b=>e.jsx(W,{value:b.chat_id,children:e.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[b.chat_name,b.is_group&&e.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},b.chat_id))})]})]})]}),e.jsxs(nt,{children:[e.jsx(_,{variant:"outline",onClick:()=>l(!1),children:"取消"}),e.jsx(_,{onClick:g,disabled:h,children:h?"创建中...":"创建"})]})]})})}function nk({expression:a,open:l,onOpenChange:r,chatList:c,onSuccess:d}){const[u,h]=m.useState({}),[f,p]=m.useState(!1),{toast:g}=Ws();m.useEffect(()=>{a&&h({situation:a.situation,style:a.style,chat_id:a.chat_id,checked:a.checked,rejected:a.rejected})},[a]);const b=async()=>{if(a)try{p(!0),await W1(a.id,u),g({title:"保存成功",description:"表达方式已更新"}),d()}catch(j){g({title:"保存失败",description:j instanceof Error?j.message:"无法更新表达方式",variant:"destructive"})}finally{p(!1)}};return a?e.jsx(Fs,{open:l,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs($s,{children:[e.jsx(Bs,{children:"编辑表达方式"}),e.jsx(Xs,{children:"修改表达方式的信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_situation",children:"情境"}),e.jsx(ae,{id:"edit_situation",value:u.situation||"",onChange:j=>h({...u,situation:j.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_style",children:"风格"}),e.jsx(ae,{id:"edit_style",value:u.style||"",onChange:j=>h({...u,style:j.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Pe,{value:u.chat_id||"",onValueChange:j=>h({...u,chat_id:j}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择关联的聊天"})}),e.jsx(Ie,{children:c.map(j=>e.jsx(W,{value:j.chat_id,children:e.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[j.chat_name,j.is_group&&e.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},j.chat_id))})]})]}),e.jsxs(it,{children:[e.jsx(Vt,{className:"h-4 w-4"}),e.jsx(ct,{className:"text-xs",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{children:e.jsx("strong",{children:"状态标记说明:"})}),e.jsx("p",{children:"• 已检查:表示该表达方式已通过审核(可由AI自动检查或人工审核)"}),e.jsx("p",{children:"• 已拒绝:表示该表达方式被标记为不合适,将永远不会被使用"}),e.jsxs("p",{className:"text-muted-foreground mt-2",children:['根据配置中"仅使用已审核通过的表达方式"设置:',e.jsx("br",{}),"• 开启时:只有通过审核(已检查)的项目会被使用",e.jsx("br",{}),"• 关闭时:未审核的项目也会被使用"]})]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between space-x-2 rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"edit_checked",className:"text-sm font-medium",children:"已检查"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"已通过审核"})]}),e.jsx(Ge,{id:"edit_checked",checked:u.checked??!1,onCheckedChange:j=>h({...u,checked:j})})]}),e.jsxs("div",{className:"flex items-center justify-between space-x-2 rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"edit_rejected",className:"text-sm font-medium",children:"已拒绝"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"不会被使用"})]}),e.jsx(Ge,{id:"edit_rejected",checked:u.rejected??!1,onCheckedChange:j=>h({...u,rejected:j})})]})]})]}),e.jsxs(nt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(_,{onClick:b,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}function rk({open:a,onOpenChange:l,onConfirm:r,count:c}){return e.jsx(gs,{open:a,onOpenChange:l,children:e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认批量删除"}),e.jsxs(ms,{children:["您即将删除 ",c," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:r,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const Il="/api/webui/jargon";async function ik(){const a=await _e(`${Il}/chats`,{});if(!a.ok){const l=await a.json();throw new Error(l.detail||"获取聊天列表失败")}return a.json()}async function ck(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.search&&l.append("search",a.search),a.chat_id&&l.append("chat_id",a.chat_id),a.is_jargon!==void 0&&a.is_jargon!==null&&l.append("is_jargon",a.is_jargon.toString()),a.is_global!==void 0&&l.append("is_global",a.is_global.toString());const r=await _e(`${Il}/list?${l}`,{});if(!r.ok){const c=await r.json();throw new Error(c.detail||"获取黑话列表失败")}return r.json()}async function ok(a){const l=await _e(`${Il}/${a}`,{});if(!l.ok){const r=await l.json();throw new Error(r.detail||"获取黑话详情失败")}return l.json()}async function dk(a){const l=await _e(`${Il}/`,{method:"POST",body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"创建黑话失败")}return l.json()}async function uk(a,l){const r=await _e(`${Il}/${a}`,{method:"PATCH",body:JSON.stringify(l)});if(!r.ok){const c=await r.json();throw new Error(c.detail||"更新黑话失败")}return r.json()}async function mk(a){const l=await _e(`${Il}/${a}`,{method:"DELETE"});if(!l.ok){const r=await l.json();throw new Error(r.detail||"删除黑话失败")}return l.json()}async function xk(a){const l=await _e(`${Il}/batch/delete`,{method:"POST",body:JSON.stringify({ids:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"批量删除黑话失败")}return l.json()}async function hk(){const a=await _e(`${Il}/stats/summary`,{});if(!a.ok){const l=await a.json();throw new Error(l.detail||"获取黑话统计失败")}return a.json()}async function fk(a,l){const r=new URLSearchParams;a.forEach(d=>r.append("ids",d.toString())),r.append("is_jargon",l.toString());const c=await _e(`${Il}/batch/set-jargon?${r}`,{method:"POST"});if(!c.ok){const d=await c.json();throw new Error(d.detail||"批量设置黑话状态失败")}return c.json()}function pk(){const[a,l]=m.useState([]),[r,c]=m.useState(!0),[d,u]=m.useState(0),[h,f]=m.useState(1),[p,g]=m.useState(20),[b,j]=m.useState(""),[y,N]=m.useState("all"),[w,M]=m.useState("all"),[A,S]=m.useState(null),[U,E]=m.useState(!1),[C,D]=m.useState(!1),[P,O]=m.useState(!1),[J,L]=m.useState(null),[oe,Ne]=m.useState(new Set),[je,de]=m.useState(!1),[he,ge]=m.useState(""),[R,Q]=m.useState({total:0,confirmed_jargon:0,confirmed_not_jargon:0,pending:0,global_count:0,complete_count:0,chat_count:0,top_chats:{}}),[$,ue]=m.useState([]),{toast:G}=Ws(),Se=async()=>{try{c(!0);const se=await ck({page:h,page_size:p,search:b||void 0,chat_id:y==="all"?void 0:y,is_jargon:w==="all"?void 0:w==="true"?!0:w==="false"?!1:void 0});l(se.data),u(se.total)}catch(se){G({title:"加载失败",description:se instanceof Error?se.message:"无法加载黑话列表",variant:"destructive"})}finally{c(!1)}},fe=async()=>{try{const se=await hk();se?.data&&Q(se.data)}catch(se){console.error("加载统计数据失败:",se)}},Te=async()=>{try{const se=await ik();se?.data&&ue(se.data)}catch(se){console.error("加载聊天列表失败:",se)}};m.useEffect(()=>{Se(),fe(),Te()},[h,p,b,y,w]);const q=async se=>{try{const Ue=await ok(se.id);S(Ue.data),E(!0)}catch(Ue){G({title:"加载详情失败",description:Ue instanceof Error?Ue.message:"无法加载黑话详情",variant:"destructive"})}},B=se=>{S(se),D(!0)},z=async se=>{try{await mk(se.id),G({title:"删除成功",description:`已删除黑话: ${se.content}`}),L(null),Se(),fe()}catch(Ue){G({title:"删除失败",description:Ue instanceof Error?Ue.message:"无法删除黑话",variant:"destructive"})}},K=se=>{const Ue=new Set(oe);Ue.has(se)?Ue.delete(se):Ue.add(se),Ne(Ue)},Ae=()=>{oe.size===a.length&&a.length>0?Ne(new Set):Ne(new Set(a.map(se=>se.id)))},ee=async()=>{try{await xk(Array.from(oe)),G({title:"批量删除成功",description:`已删除 ${oe.size} 个黑话`}),Ne(new Set),de(!1),Se(),fe()}catch(se){G({title:"批量删除失败",description:se instanceof Error?se.message:"无法批量删除黑话",variant:"destructive"})}},Y=async se=>{try{await fk(Array.from(oe),se),G({title:"操作成功",description:`已将 ${oe.size} 个词条设为${se?"黑话":"非黑话"}`}),Ne(new Set),Se(),fe()}catch(Ue){G({title:"操作失败",description:Ue instanceof Error?Ue.message:"批量设置失败",variant:"destructive"})}},$e=()=>{const se=parseInt(he),Ue=Math.ceil(d/p);se>=1&&se<=Ue?(f(se),ge("")):G({title:"无效的页码",description:`请输入1-${Ue}之间的页码`,variant:"destructive"})},H=se=>se===!0?e.jsxs(Ce,{variant:"default",className:"bg-green-600 hover:bg-green-700",children:[e.jsx(Mt,{className:"h-3 w-3 mr-1"}),"是黑话"]}):se===!1?e.jsxs(Ce,{variant:"secondary",children:[e.jsx(Aa,{className:"h-3 w-3 mr-1"}),"非黑话"]}):e.jsxs(Ce,{variant:"outline",children:[e.jsx(tv,{className:"h-3 w-3 mr-1"}),"未判定"]});return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(R_,{className:"h-8 w-8",strokeWidth:2}),"黑话管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦学习到的黑话和俚语"})]}),e.jsxs(_,{onClick:()=>O(!0),className:"gap-2",children:[e.jsx(Ys,{className:"h-4 w-4"}),"新增黑话"]})]})}),e.jsx(Ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-7 gap-3",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"总数量"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1",children:R.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"已确认黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-green-600",children:R.confirmed_jargon})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"确认非黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-gray-500",children:R.confirmed_not_jargon})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"待判定"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-yellow-600",children:R.pending})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"全局黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-blue-600",children:R.global_count})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"推断完成"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-purple-600",children:R.complete_count})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"关联聊天数"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1",children:R.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx(At,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ae,{id:"search",placeholder:"搜索内容、含义...",value:b,onChange:se=>j(se.target.value),className:"pl-9"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{children:"聊天筛选"}),e.jsxs(Pe,{value:y,onValueChange:N,children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"全部聊天"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"全部聊天"}),$.map(se=>e.jsx(W,{value:se.chat_id,children:se.chat_name},se.chat_id))]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{children:"状态筛选"}),e.jsxs(Pe,{value:w,onValueChange:M,children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"全部状态"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"全部状态"}),e.jsx(W,{value:"true",children:"是黑话"}),e.jsx(W,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{htmlFor:"page-size",children:"每页显示"}),e.jsxs(Pe,{value:p.toString(),onValueChange:se=>{g(parseInt(se)),f(1),Ne(new Set)},children:[e.jsx(Be,{id:"page-size",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"10",children:"10"}),e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"50",children:"50"}),e.jsx(W,{value:"100",children:"100"})]})]})]})]}),oe.size>0&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-4 pt-4 border-t",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",oe.size," 个"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>Y(!0),children:[e.jsx(Mt,{className:"h-4 w-4 mr-1"}),"标记为黑话"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>Y(!1),children:[e.jsx(Aa,{className:"h-4 w-4 mr-1"}),"标记为非黑话"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Ne(new Set),children:"取消选择"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>de(!0),children:[e.jsx(ls,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(Ul,{children:[e.jsx($l,{children:e.jsxs(ht,{children:[e.jsx(ss,{className:"w-12",children:e.jsx(Js,{checked:oe.size===a.length&&a.length>0,onCheckedChange:Ae})}),e.jsx(ss,{children:"内容"}),e.jsx(ss,{children:"含义"}),e.jsx(ss,{children:"聊天"}),e.jsx(ss,{children:"状态"}),e.jsx(ss,{className:"text-center",children:"次数"}),e.jsx(ss,{className:"text-right",children:"操作"})]})}),e.jsx(Bl,{children:r?e.jsx(ht,{children:e.jsx(Ye,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):a.length===0?e.jsx(ht,{children:e.jsx(Ye,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):a.map(se=>e.jsxs(ht,{children:[e.jsx(Ye,{children:e.jsx(Js,{checked:oe.has(se.id),onCheckedChange:()=>K(se.id)})}),e.jsx(Ye,{className:"font-medium max-w-[200px]",children:e.jsxs("div",{className:"flex items-center gap-2",children:[se.is_global&&e.jsx("span",{title:"全局黑话",children:e.jsx(Vo,{className:"h-4 w-4 text-blue-500 flex-shrink-0"})}),e.jsx("span",{className:"truncate",title:se.content,children:se.content})]})}),e.jsx(Ye,{className:"max-w-[200px] truncate",title:se.meaning||"",children:se.meaning||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ye,{className:"max-w-[150px] truncate",title:se.chat_name||se.chat_id,children:se.chat_name||se.chat_id}),e.jsx(Ye,{children:H(se.is_jargon)}),e.jsx(Ye,{className:"text-center",children:se.count}),e.jsx(Ye,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>B(se),children:[e.jsx(Jn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>q(se),title:"查看详情",children:e.jsx(ia,{className:"h-4 w-4"})}),e.jsxs(_,{size:"sm",onClick:()=>L(se),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(ls,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},se.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:r?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):a.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):a.map(se=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Js,{checked:oe.has(se.id),onCheckedChange:()=>K(se.id),className:"mt-1"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[se.is_global&&e.jsx(Vo,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),e.jsx("h3",{className:"font-semibold text-sm break-all",children:se.content})]}),se.meaning&&e.jsx("p",{className:"text-sm text-muted-foreground break-all",children:se.meaning}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[H(se.is_jargon),e.jsxs("span",{className:"text-muted-foreground",children:["次数: ",se.count]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:["聊天: ",se.chat_name||se.chat_id]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>B(se),className:"text-xs px-2 py-1 h-auto",children:[e.jsx(Jn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>q(se),className:"text-xs px-2 py-1 h-auto",children:e.jsx(ia,{className:"h-3 w-3"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>L(se),className:"text-xs px-2 py-1 h-auto text-destructive hover:text-destructive",children:[e.jsx(ls,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},se.id))}),d>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",d," 条记录,第 ",h," / ",Math.ceil(d/p)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(Nn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Da,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{type:"number",value:he,onChange:se=>ge(se.target.value),onKeyDown:se=>se.key==="Enter"&&$e(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(d/p)}),e.jsx(_,{variant:"outline",size:"sm",onClick:$e,disabled:!he,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(d/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(sa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(d/p)),disabled:h>=Math.ceil(d/p),className:"hidden sm:flex",children:e.jsx(bn,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(gk,{jargon:A,open:U,onOpenChange:E}),e.jsx(jk,{open:P,onOpenChange:O,chatList:$,onSuccess:()=>{Se(),fe(),O(!1)}}),e.jsx(vk,{jargon:A,open:C,onOpenChange:D,chatList:$,onSuccess:()=>{Se(),fe(),D(!1)}}),e.jsx(gs,{open:!!J,onOpenChange:()=>L(null),children:e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认删除"}),e.jsxs(ms,{children:['确定要删除黑话 "',J?.content,'" 吗?此操作不可撤销。']})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:()=>J&&z(J),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(gs,{open:je,onOpenChange:de,children:e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认批量删除"}),e.jsxs(ms,{children:["您即将删除 ",oe.size," 个黑话,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})]})}function gk({jargon:a,open:l,onOpenChange:r}){return a?e.jsx(Fs,{open:l,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs($s,{children:[e.jsx(Bs,{children:"黑话详情"}),e.jsx(Xs,{children:"查看黑话的完整信息"})]}),e.jsx(Ze,{className:"h-full pr-4",children:e.jsxs("div",{className:"space-y-4 pb-2",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Vm,{icon:Jr,label:"记录ID",value:a.id.toString(),mono:!0}),e.jsx(Vm,{label:"使用次数",value:a.count.toString()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"内容"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all whitespace-pre-wrap",children:a.content})]}),a.raw_content&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"原始内容"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:(()=>{try{const c=JSON.parse(a.raw_content);return Array.isArray(c)?c.map((d,u)=>e.jsxs("div",{children:[u>0&&e.jsx("hr",{className:"my-3 border-border"}),e.jsx("div",{className:"whitespace-pre-wrap",children:d})]},u)):e.jsx("div",{className:"whitespace-pre-wrap",children:a.raw_content})}catch{return e.jsx("div",{className:"whitespace-pre-wrap",children:a.raw_content})}})()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"含义"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:a.meaning?e.jsx(px,{content:a.meaning}):"-"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Vm,{label:"聊天",value:a.chat_name||a.chat_id}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"状态"}),e.jsxs("div",{className:"flex items-center gap-2",children:[a.is_jargon===!0&&e.jsx(Ce,{variant:"default",className:"bg-green-600",children:"是黑话"}),a.is_jargon===!1&&e.jsx(Ce,{variant:"secondary",children:"非黑话"}),a.is_jargon===null&&e.jsx(Ce,{variant:"outline",children:"未判定"}),a.is_global&&e.jsx(Ce,{variant:"outline",className:"border-blue-500 text-blue-500",children:"全局"}),a.is_complete&&e.jsx(Ce,{variant:"outline",className:"border-purple-500 text-purple-500",children:"推断完成"})]})]})]}),a.inference_with_context&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"上下文推断结果"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:a.inference_with_context})]}),a.inference_content_only&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"纯词条推断结果"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:a.inference_content_only})]})]})}),e.jsx(nt,{className:"flex-shrink-0",children:e.jsx(_,{onClick:()=>r(!1),children:"关闭"})})]})}):null}function Vm({icon:a,label:l,value:r,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a&&e.jsx(a,{className:"h-3 w-3"}),l]}),e.jsx("div",{className:F("text-sm",c&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function jk({open:a,onOpenChange:l,chatList:r,onSuccess:c}){const[d,u]=m.useState({content:"",meaning:"",chat_id:"",is_global:!1}),[h,f]=m.useState(!1),{toast:p}=Ws(),g=async()=>{if(!d.content||!d.chat_id){p({title:"验证失败",description:"请填写必填字段:内容和聊天",variant:"destructive"});return}try{f(!0),await dk(d),p({title:"创建成功",description:"黑话已创建"}),u({content:"",meaning:"",chat_id:"",is_global:!1}),c()}catch(b){p({title:"创建失败",description:b instanceof Error?b.message:"无法创建黑话",variant:"destructive"})}finally{f(!1)}};return e.jsx(Fs,{open:a,onOpenChange:l,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs($s,{children:[e.jsx(Bs,{children:"新增黑话"}),e.jsx(Xs,{children:"创建新的黑话记录"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"content",children:["内容 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ae,{id:"content",value:d.content,onChange:b=>u({...d,content:b.target.value}),placeholder:"输入黑话内容"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"meaning",children:"含义"}),e.jsx(rt,{id:"meaning",value:d.meaning||"",onChange:b=>u({...d,meaning:b.target.value}),placeholder:"输入黑话含义(可选)",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"chat_id",children:["聊天 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Pe,{value:d.chat_id,onValueChange:b=>u({...d,chat_id:b}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择关联的聊天"})}),e.jsx(Ie,{children:r.map(b=>e.jsx(W,{value:b.chat_id,children:b.chat_name},b.chat_id))})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"is_global",checked:d.is_global,onCheckedChange:b=>u({...d,is_global:b})}),e.jsx(T,{htmlFor:"is_global",children:"设为全局黑话"})]})]}),e.jsxs(nt,{children:[e.jsx(_,{variant:"outline",onClick:()=>l(!1),children:"取消"}),e.jsx(_,{onClick:g,disabled:h,children:h?"创建中...":"创建"})]})]})})}function vk({jargon:a,open:l,onOpenChange:r,chatList:c,onSuccess:d}){const[u,h]=m.useState({}),[f,p]=m.useState(!1),{toast:g}=Ws();m.useEffect(()=>{a&&h({content:a.content,meaning:a.meaning||"",chat_id:a.stream_id||a.chat_id,is_global:a.is_global,is_jargon:a.is_jargon})},[a]);const b=async()=>{if(a)try{p(!0),await uk(a.id,u),g({title:"保存成功",description:"黑话已更新"}),d()}catch(j){g({title:"保存失败",description:j instanceof Error?j.message:"无法更新黑话",variant:"destructive"})}finally{p(!1)}};return a?e.jsx(Fs,{open:l,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs($s,{children:[e.jsx(Bs,{children:"编辑黑话"}),e.jsx(Xs,{children:"修改黑话的信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_content",children:"内容"}),e.jsx(ae,{id:"edit_content",value:u.content||"",onChange:j=>h({...u,content:j.target.value}),placeholder:"输入黑话内容"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_meaning",children:"含义"}),e.jsx(rt,{id:"edit_meaning",value:u.meaning||"",onChange:j=>h({...u,meaning:j.target.value}),placeholder:"输入黑话含义",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Pe,{value:u.chat_id||"",onValueChange:j=>h({...u,chat_id:j}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择关联的聊天"})}),e.jsx(Ie,{children:c.map(j=>e.jsx(W,{value:j.chat_id,children:j.chat_name},j.chat_id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"黑话状态"}),e.jsxs(Pe,{value:u.is_jargon===null?"null":u.is_jargon?.toString()||"null",onValueChange:j=>h({...u,is_jargon:j==="null"?null:j==="true"}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"null",children:"未判定"}),e.jsx(W,{value:"true",children:"是黑话"}),e.jsx(W,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"edit_is_global",checked:u.is_global,onCheckedChange:j=>h({...u,is_global:j})}),e.jsx(T,{htmlFor:"edit_is_global",children:"全局黑话"})]})]}),e.jsxs(nt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(_,{onClick:b,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}const si="/api/webui/person";async function Nk(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.search&&l.append("search",a.search),a.is_known!==void 0&&l.append("is_known",a.is_known.toString()),a.platform&&l.append("platform",a.platform);const r=await _e(`${si}/list?${l}`,{headers:qs()});if(!r.ok){const c=await r.json();throw new Error(c.detail||"获取人物列表失败")}return r.json()}async function bk(a){const l=await _e(`${si}/${a}`,{headers:qs()});if(!l.ok){const r=await l.json();throw new Error(r.detail||"获取人物详情失败")}return l.json()}async function yk(a,l){const r=await _e(`${si}/${a}`,{method:"PATCH",headers:qs(),body:JSON.stringify(l)});if(!r.ok){const c=await r.json();throw new Error(c.detail||"更新人物信息失败")}return r.json()}async function wk(a){const l=await _e(`${si}/${a}`,{method:"DELETE",headers:qs()});if(!l.ok){const r=await l.json();throw new Error(r.detail||"删除人物信息失败")}return l.json()}async function _k(){const a=await _e(`${si}/stats/summary`,{headers:qs()});if(!a.ok){const l=await a.json();throw new Error(l.detail||"获取统计数据失败")}return a.json()}async function Sk(a){const l=await _e(`${si}/batch/delete`,{method:"POST",headers:qs(),body:JSON.stringify({person_ids:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"批量删除失败")}return l.json()}function kk(){const[a,l]=m.useState([]),[r,c]=m.useState(!0),[d,u]=m.useState(0),[h,f]=m.useState(1),[p,g]=m.useState(20),[b,j]=m.useState(""),[y,N]=m.useState(void 0),[w,M]=m.useState(void 0),[A,S]=m.useState(null),[U,E]=m.useState(!1),[C,D]=m.useState(!1),[P,O]=m.useState(null),[J,L]=m.useState({total:0,known:0,unknown:0,platforms:{}}),[oe,Ne]=m.useState(new Set),[je,de]=m.useState(!1),[he,ge]=m.useState(""),{toast:R}=Ws(),Q=async()=>{try{c(!0);const ee=await Nk({page:h,page_size:p,search:b||void 0,is_known:y,platform:w});l(ee.data),u(ee.total)}catch(ee){R({title:"加载失败",description:ee instanceof Error?ee.message:"无法加载人物信息",variant:"destructive"})}finally{c(!1)}},$=async()=>{try{const ee=await _k();ee?.data&&L(ee.data)}catch(ee){console.error("加载统计数据失败:",ee)}};m.useEffect(()=>{Q(),$()},[h,p,b,y,w]);const ue=async ee=>{try{const Y=await bk(ee.person_id);S(Y.data),E(!0)}catch(Y){R({title:"加载详情失败",description:Y instanceof Error?Y.message:"无法加载人物详情",variant:"destructive"})}},G=ee=>{S(ee),D(!0)},Se=async ee=>{try{await wk(ee.person_id),R({title:"删除成功",description:`已删除人物信息: ${ee.person_name||ee.nickname||ee.user_id}`}),O(null),Q(),$()}catch(Y){R({title:"删除失败",description:Y instanceof Error?Y.message:"无法删除人物信息",variant:"destructive"})}},fe=m.useMemo(()=>Object.keys(J.platforms),[J.platforms]),Te=ee=>{const Y=new Set(oe);Y.has(ee)?Y.delete(ee):Y.add(ee),Ne(Y)},q=()=>{oe.size===a.length&&a.length>0?Ne(new Set):Ne(new Set(a.map(ee=>ee.person_id)))},B=()=>{if(oe.size===0){R({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}de(!0)},z=async()=>{try{const ee=await Sk(Array.from(oe));R({title:"批量删除完成",description:ee.message}),Ne(new Set),de(!1),Q(),$()}catch(ee){R({title:"批量删除失败",description:ee instanceof Error?ee.message:"批量删除失败",variant:"destructive"})}},K=()=>{const ee=parseInt(he),Y=Math.ceil(d/p);ee>=1&&ee<=Y?(f(ee),ge("")):R({title:"无效的页码",description:`请输入1-${Y}之间的页码`,variant:"destructive"})},Ae=ee=>ee?new Date(ee*1e3).toLocaleString("zh-CN"):"-";return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(ic,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),e.jsx(Ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:J.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:J.known})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:J.unknown})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(T,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative mt-1.5",children:[e.jsx(At,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ae,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:b,onChange:ee=>j(ee.target.value),className:"pl-9"})]})]}),e.jsxs("div",{children:[e.jsx(T,{htmlFor:"filter-known",children:"认识状态"}),e.jsxs(Pe,{value:y===void 0?"all":y.toString(),onValueChange:ee=>{N(ee==="all"?void 0:ee==="true"),f(1)},children:[e.jsx(Be,{id:"filter-known",className:"mt-1.5",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"全部"}),e.jsx(W,{value:"true",children:"已认识"}),e.jsx(W,{value:"false",children:"未认识"})]})]})]}),e.jsxs("div",{children:[e.jsx(T,{htmlFor:"filter-platform",children:"平台"}),e.jsxs(Pe,{value:w||"all",onValueChange:ee=>{M(ee==="all"?void 0:ee),f(1)},children:[e.jsx(Be,{id:"filter-platform",className:"mt-1.5",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"全部平台"}),fe.map(ee=>e.jsxs(W,{value:ee,children:[ee," (",J.platforms[ee],")"]},ee))]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:oe.size>0&&e.jsxs("span",{children:["已选择 ",oe.size," 个人物"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Pe,{value:p.toString(),onValueChange:ee=>{g(parseInt(ee)),f(1),Ne(new Set)},children:[e.jsx(Be,{id:"page-size",className:"w-20",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"10",children:"10"}),e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"50",children:"50"}),e.jsx(W,{value:"100",children:"100"})]})]}),oe.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Ne(new Set),children:"取消选择"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:B,children:[e.jsx(ls,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(Ul,{children:[e.jsx($l,{children:e.jsxs(ht,{children:[e.jsx(ss,{className:"w-12",children:e.jsx(Js,{checked:a.length>0&&oe.size===a.length,onCheckedChange:q,"aria-label":"全选"})}),e.jsx(ss,{children:"状态"}),e.jsx(ss,{children:"名称"}),e.jsx(ss,{children:"昵称"}),e.jsx(ss,{children:"平台"}),e.jsx(ss,{children:"用户ID"}),e.jsx(ss,{children:"最后更新"}),e.jsx(ss,{className:"text-right",children:"操作"})]})}),e.jsx(Bl,{children:r?e.jsx(ht,{children:e.jsx(Ye,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):a.length===0?e.jsx(ht,{children:e.jsx(Ye,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):a.map(ee=>e.jsxs(ht,{children:[e.jsx(Ye,{children:e.jsx(Js,{checked:oe.has(ee.person_id),onCheckedChange:()=>Te(ee.person_id),"aria-label":`选择 ${ee.person_name||ee.nickname||ee.user_id}`})}),e.jsx(Ye,{children:e.jsx("div",{className:F("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",ee.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:ee.is_known?"已认识":"未认识"})}),e.jsx(Ye,{className:"font-medium",children:ee.person_name||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ye,{children:ee.nickname||"-"}),e.jsx(Ye,{children:ee.platform}),e.jsx(Ye,{className:"font-mono text-sm",children:ee.user_id}),e.jsx(Ye,{className:"text-sm text-muted-foreground",children:Ae(ee.last_know)}),e.jsx(Ye,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>ue(ee),children:[e.jsx(ia,{className:"h-4 w-4 mr-1"}),"详情"]}),e.jsxs(_,{variant:"default",size:"sm",onClick:()=>G(ee),children:[e.jsx(Jn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>O(ee),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(ls,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},ee.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:r?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):a.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):a.map(ee=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Js,{checked:oe.has(ee.person_id),onCheckedChange:()=>Te(ee.person_id),className:"mt-1"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:F("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",ee.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:ee.is_known?"已认识":"未认识"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:ee.person_name||e.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),ee.nickname&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",ee.nickname]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),e.jsx("p",{className:"font-medium text-xs",children:ee.platform})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),e.jsx("p",{className:"font-mono text-xs truncate",title:ee.user_id,children:ee.user_id})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),e.jsx("p",{className:"text-xs",children:Ae(ee.last_know)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>ue(ee),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(ia,{className:"h-3 w-3 mr-1"}),"查看"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>G(ee),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(Jn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>O(ee),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(ls,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},ee.id))}),d>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",d," 条记录,第 ",h," / ",Math.ceil(d/p)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(Nn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Da,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{type:"number",value:he,onChange:ee=>ge(ee.target.value),onKeyDown:ee=>ee.key==="Enter"&&K(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(d/p)}),e.jsx(_,{variant:"outline",size:"sm",onClick:K,disabled:!he,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(d/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(sa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(d/p)),disabled:h>=Math.ceil(d/p),className:"hidden sm:flex",children:e.jsx(bn,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(Ck,{person:A,open:U,onOpenChange:E}),e.jsx(Tk,{person:A,open:C,onOpenChange:D,onSuccess:()=>{Q(),$(),D(!1)}}),e.jsx(gs,{open:!!P,onOpenChange:()=>O(null),children:e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认删除"}),e.jsxs(ms,{children:['确定要删除人物信息 "',P?.person_name||P?.nickname||P?.user_id,'" 吗? 此操作不可撤销。']})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:()=>P&&Se(P),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(gs,{open:je,onOpenChange:de,children:e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"确认批量删除"}),e.jsxs(ms,{children:["确定要删除选中的 ",oe.size," 个人物信息吗? 此操作不可撤销。"]})]}),e.jsxs(ds,{children:[e.jsx(hs,{children:"取消"}),e.jsx(xs,{onClick:z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function Ck({person:a,open:l,onOpenChange:r}){if(!a)return null;const c=d=>d?new Date(d*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Fs,{open:l,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs($s,{children:[e.jsx(Bs,{children:"人物详情"}),e.jsxs(Xs,{children:["查看 ",a.person_name||a.nickname||a.user_id," 的完整信息"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Rl,{icon:jn,label:"人物名称",value:a.person_name}),e.jsx(Rl,{icon:Ra,label:"昵称",value:a.nickname}),e.jsx(Rl,{icon:Jr,label:"用户ID",value:a.user_id,mono:!0}),e.jsx(Rl,{icon:Jr,label:"人物ID",value:a.person_id,mono:!0}),e.jsx(Rl,{label:"平台",value:a.platform}),e.jsx(Rl,{label:"状态",value:a.is_known?"已认识":"未认识"})]}),a.name_reason&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),e.jsx("p",{className:"mt-1 text-sm",children:a.name_reason})]}),a.memory_points&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"个人印象"}),e.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:a.memory_points})]}),a.group_nick_name&&a.group_nick_name.length>0&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"群昵称"}),e.jsx("div",{className:"mt-2 space-y-1",children:a.group_nick_name.map((d,u)=>e.jsxs("div",{className:"text-sm flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:d.group_id}),e.jsx("span",{children:"→"}),e.jsx("span",{children:d.group_nick_name})]},u))})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(Rl,{icon:na,label:"认识时间",value:c(a.know_times)}),e.jsx(Rl,{icon:na,label:"首次记录",value:c(a.know_since)}),e.jsx(Rl,{icon:na,label:"最后更新",value:c(a.last_know)})]})]}),e.jsx(nt,{children:e.jsx(_,{onClick:()=>r(!1),children:"关闭"})})]})})}function Rl({icon:a,label:l,value:r,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a&&e.jsx(a,{className:"h-3 w-3"}),l]}),e.jsx("div",{className:F("text-sm",c&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function Tk({person:a,open:l,onOpenChange:r,onSuccess:c}){const[d,u]=m.useState({}),[h,f]=m.useState(!1),{toast:p}=Ws();m.useEffect(()=>{a&&u({person_name:a.person_name||"",name_reason:a.name_reason||"",nickname:a.nickname||"",is_known:a.is_known})},[a]);const g=async()=>{if(a)try{f(!0),await yk(a.person_id,d),p({title:"保存成功",description:"人物信息已更新"}),c()}catch(b){p({title:"保存失败",description:b instanceof Error?b.message:"无法更新人物信息",variant:"destructive"})}finally{f(!1)}};return a?e.jsx(Fs,{open:l,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs($s,{children:[e.jsx(Bs,{children:"编辑人物信息"}),e.jsxs(Xs,{children:["修改 ",a.person_name||a.nickname||a.user_id," 的信息"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"person_name",children:"人物名称"}),e.jsx(ae,{id:"person_name",value:d.person_name||"",onChange:b=>u({...d,person_name:b.target.value}),placeholder:"为这个人设置一个名称"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"nickname",children:"昵称"}),e.jsx(ae,{id:"nickname",value:d.nickname||"",onChange:b=>u({...d,nickname:b.target.value}),placeholder:"昵称"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"name_reason",children:"名称设定原因"}),e.jsx(rt,{id:"name_reason",value:d.name_reason||"",onChange:b=>u({...d,name_reason:b.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{children:[e.jsx(T,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),e.jsx(Ge,{id:"is_known",checked:d.is_known,onCheckedChange:b=>u({...d,is_known:b})})]})]}),e.jsxs(nt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(_,{onClick:g,disabled:h,children:h?"保存中...":"保存"})]})]})}):null}var Ek=j1();const Jg=lw(Ek),_x="/api/webui";async function Mk(a=100,l="all"){const r=`${_x}/knowledge/graph?limit=${a}&node_type=${l}`,c=await fetch(r);if(!c.ok)throw new Error(`获取知识图谱失败: ${c.status}`);return c.json()}async function Ak(){const a=await fetch(`${_x}/knowledge/stats`);if(!a.ok)throw new Error("获取知识图谱统计信息失败");return a.json()}async function zk(a){const l=await fetch(`${_x}/knowledge/search?query=${encodeURIComponent(a)}`);if(!l.ok)throw new Error("搜索知识节点失败");return l.json()}const sN=m.memo(({data:a})=>e.jsxs("div",{className:"px-4 py-2 shadow-md rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700 min-w-[120px]",children:[e.jsx(Ko,{type:"target",position:Qo.Top}),e.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:a.content,children:a.label}),e.jsx(Ko,{type:"source",position:Qo.Bottom})]}));sN.displayName="EntityNode";const tN=m.memo(({data:a})=>e.jsxs("div",{className:"px-3 py-2 shadow-md rounded-md bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700 min-w-[100px]",children:[e.jsx(Ko,{type:"target",position:Qo.Top}),e.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:a.content,children:a.label}),e.jsx(Ko,{type:"source",position:Qo.Bottom})]}));tN.displayName="ParagraphNode";const Rk={entity:sN,paragraph:tN};function Dk(a,l){const r=new Jg.graphlib.Graph;r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:"TB",ranksep:100,nodesep:80});const c=[],d=[];return a.forEach(u=>{r.setNode(u.id,{width:150,height:50})}),l.forEach(u=>{r.setEdge(u.source,u.target)}),Jg.layout(r),a.forEach(u=>{const h=r.node(u.id);c.push({id:u.id,type:u.type,position:{x:h.x-75,y:h.y-25},data:{label:u.content.slice(0,20)+(u.content.length>20?"...":""),content:u.content}})}),l.forEach((u,h)=>{const f={id:`edge-${h}`,source:u.source,target:u.target,animated:a.length<=200&&u.weight>5,style:{strokeWidth:Math.min(u.weight/2,5),opacity:.6}};u.weight>10&&a.length<100&&(f.label=`${u.weight.toFixed(0)}`),d.push(f)}),{nodes:c,edges:d}}function Ok(){const a=ca(),[l,r]=m.useState(!1),[c,d]=m.useState(null),[u,h]=m.useState(""),[f,p]=m.useState("all"),[g,b]=m.useState(50),[j,y]=m.useState("50"),[N,w]=m.useState(!1),[M,A]=m.useState(!0),[S,U]=m.useState(!1),[E,C]=m.useState(!1),[D,P,O]=v1([]),[J,L,oe]=N1([]),[Ne,je]=m.useState(0),[de,he]=m.useState(null),[ge,R]=m.useState(null),{toast:Q}=Ws(),$=m.useCallback(z=>z.type==="entity"?"#6366f1":z.type==="paragraph"?"#10b981":"#6b7280",[]),ue=m.useCallback(async(z=!1)=>{try{if(!z&&g>200){C(!0);return}r(!0);const[K,Ae]=await Promise.all([Mk(g,f),Ak()]);if(d(Ae),K.nodes.length===0){Q({title:"提示",description:"知识库为空,请先导入知识数据"}),P([]),L([]);return}const{nodes:ee,edges:Y}=Dk(K.nodes,K.edges);P(ee),L(Y),je(ee.length),Ae&&Ae.total_nodes>g&&Q({title:"提示",description:`知识图谱包含 ${Ae.total_nodes} 个节点,当前显示 ${ee.length} 个`}),Q({title:"加载成功",description:`已加载 ${ee.length} 个节点,${Y.length} 条边`})}catch(K){console.error("加载知识图谱失败:",K),Q({title:"加载失败",description:K instanceof Error?K.message:"未知错误",variant:"destructive"})}finally{r(!1)}},[g,f,Q]),G=m.useCallback(async()=>{if(!u.trim()){Q({title:"提示",description:"请输入搜索关键词"});return}try{const z=await zk(u);if(z.length===0){Q({title:"未找到",description:"没有找到匹配的节点"});return}const K=new Set(z.map(Ae=>Ae.id));P(Ae=>Ae.map(ee=>({...ee,style:{...ee.style,opacity:K.has(ee.id)?1:.3,filter:K.has(ee.id)?"brightness(1.2)":"brightness(0.8)"}}))),Q({title:"搜索完成",description:`找到 ${z.length} 个匹配节点`})}catch(z){console.error("搜索失败:",z),Q({title:"搜索失败",description:z instanceof Error?z.message:"未知错误",variant:"destructive"})}},[u,Q]),Se=m.useCallback(()=>{P(z=>z.map(K=>({...K,style:{...K.style,opacity:1,filter:"brightness(1)"}})))},[]),fe=m.useCallback(()=>{A(!1),U(!0),ue()},[ue]),Te=m.useCallback(()=>{C(!1),setTimeout(()=>{ue(!0)},0)},[ue]),q=m.useCallback((z,K)=>{D.find(ee=>ee.id===K.id)&&he({id:K.id,type:K.type,content:K.data.content})},[D]);m.useEffect(()=>{M||S&&ue()},[g,f,M,S]);const B=m.useCallback((z,K)=>{const Ae=D.find($e=>$e.id===K.source),ee=D.find($e=>$e.id===K.target),Y=J.find($e=>$e.id===K.id);Ae&&ee&&Y&&R({source:{id:Ae.id,type:Ae.type,content:Ae.data.content},target:{id:ee.id,type:ee.type,content:ee.data.content},edge:{source:K.source,target:K.target,weight:parseFloat(K.label||"0")}})},[D,J]);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex-shrink-0 p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦知识库图谱"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"可视化知识实体与关系网络"})]}),c&&e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs(Ce,{variant:"outline",className:"gap-1",children:[e.jsx(Yr,{className:"h-3 w-3"}),"节点: ",c.total_nodes]}),e.jsxs(Ce,{variant:"outline",className:"gap-1",children:[e.jsx(iv,{className:"h-3 w-3"}),"边: ",c.total_edges]}),e.jsxs(Ce,{variant:"outline",className:"gap-1",children:[e.jsx(Vt,{className:"h-3 w-3"}),"实体: ",c.entity_nodes]}),e.jsxs(Ce,{variant:"outline",className:"gap-1",children:[e.jsx(Ea,{className:"h-3 w-3"}),"段落: ",c.paragraph_nodes]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 mt-4",children:[e.jsxs("div",{className:"flex-1 flex gap-2",children:[e.jsx(ae,{placeholder:"搜索节点内容...",value:u,onChange:z=>h(z.target.value),onKeyDown:z=>z.key==="Enter"&&G(),className:"flex-1"}),e.jsx(_,{onClick:G,size:"sm",children:e.jsx(At,{className:"h-4 w-4"})}),e.jsx(_,{onClick:Se,variant:"outline",size:"sm",children:"重置"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Pe,{value:f,onValueChange:z=>p(z),children:[e.jsx(Be,{className:"w-[120px]",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"全部节点"}),e.jsx(W,{value:"entity",children:"仅实体"}),e.jsx(W,{value:"paragraph",children:"仅段落"})]})]}),e.jsxs(Pe,{value:g===1e4?"all":N?"custom":g.toString(),onValueChange:z=>{z==="custom"?(w(!0),y(g.toString())):z==="all"?(w(!1),b(1e4)):(w(!1),b(Number(z)))},children:[e.jsx(Be,{className:"w-[120px]",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"50",children:"50 节点"}),e.jsx(W,{value:"100",children:"100 节点"}),e.jsx(W,{value:"200",children:"200 节点"}),e.jsx(W,{value:"500",children:"500 节点"}),e.jsx(W,{value:"1000",children:"1000 节点"}),e.jsx(W,{value:"all",children:"全部 (最多10000)"}),e.jsx(W,{value:"custom",children:"自定义..."})]})]}),N&&e.jsx(ae,{type:"number",min:"50",value:j,onChange:z=>y(z.target.value),onBlur:()=>{const z=parseInt(j);!isNaN(z)&&z>=50?b(z):(y("50"),b(50))},onKeyDown:z=>{if(z.key==="Enter"){const K=parseInt(j);!isNaN(K)&&K>=50?b(K):(y("50"),b(50))}},placeholder:"最少50个",className:"w-[120px]"}),e.jsx(_,{onClick:()=>ue(),variant:"outline",size:"sm",disabled:l,children:e.jsx(xt,{className:F("h-4 w-4",l&&"animate-spin")})})]})]})]}),e.jsx("div",{className:"flex-1 relative",children:l?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(xt,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"加载知识图谱中..."})]})}):D.length===0?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Yr,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"知识库为空"}),e.jsx("p",{className:"text-muted-foreground",children:"请先导入知识数据"})]})}):e.jsxs(b1,{nodes:D,edges:J,onNodesChange:O,onEdgesChange:oe,onNodeClick:q,onEdgeClick:B,nodeTypes:Rk,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:Ne<=500,nodesDraggable:Ne<=1e3,attributionPosition:"bottom-left",children:[e.jsx(y1,{variant:w1.Dots,gap:12,size:1}),e.jsx(_1,{}),Ne<=500&&e.jsx(S1,{nodeColor:$,nodeBorderRadius:8,pannable:!0,zoomable:!0}),e.jsxs(k1,{position:"top-right",className:"bg-background/95 backdrop-blur-sm rounded-lg border p-3 shadow-lg",children:[e.jsx("div",{className:"text-sm font-semibold mb-2",children:"图例"}),e.jsxs("div",{className:"space-y-2 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700"}),e.jsx("span",{children:"实体节点"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700"}),e.jsx("span",{children:"段落节点"})]}),Ne>200&&e.jsxs("div",{className:"mt-2 pt-2 border-t text-yellow-600 dark:text-yellow-500",children:[e.jsx("div",{className:"font-semibold",children:"性能模式"}),e.jsx("div",{children:"已禁用动画"}),Ne>500&&e.jsx("div",{children:"已禁用缩略图"})]})]})]})]})}),e.jsx(Fs,{open:!!de,onOpenChange:z=>!z&&he(null),children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsx($s,{children:e.jsx(Bs,{children:"节点详情"})}),de&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"类型"}),e.jsx("div",{className:"mt-1",children:e.jsx(Ce,{variant:de.type==="entity"?"default":"secondary",children:de.type==="entity"?"🏷️ 实体":"📄 段落"})})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),e.jsx("code",{className:"mt-1 block p-2 bg-muted rounded text-xs break-all",children:de.id})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"内容"}),e.jsx(Ze,{className:"mt-1 h-40 p-3 bg-muted rounded",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:de.content})})]})]})]})}),e.jsx(Fs,{open:!!ge,onOpenChange:z=>!z&&R(null),children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsx($s,{children:e.jsx(Bs,{children:"边详情"})}),ge&&e.jsx(Ze,{className:"flex-1 pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-blue-50 dark:bg-blue-950 rounded border-2 border-blue-200 dark:border-blue-800",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"源节点"}),e.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:ge.source.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[ge.source.id.slice(0,40),"..."]})]}),e.jsx("div",{className:"text-2xl text-muted-foreground flex-shrink-0",children:"→"}),e.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-green-50 dark:bg-green-950 rounded border-2 border-green-200 dark:border-green-800",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"目标节点"}),e.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:ge.target.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[ge.target.id.slice(0,40),"..."]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"权重"}),e.jsx("div",{className:"mt-1",children:e.jsx(Ce,{variant:"outline",className:"text-base font-mono",children:ge.edge.weight.toFixed(4)})})]})]})})]})}),e.jsx(gs,{open:M,onOpenChange:A,children:e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"加载知识图谱"}),e.jsxs(ms,{children:["知识图谱的动态展示会消耗较多系统资源。",e.jsx("br",{}),"确定要加载知识图谱吗?"]})]}),e.jsxs(ds,{children:[e.jsx(hs,{onClick:()=>a({to:"/"}),children:"取消 (返回首页)"}),e.jsx(xs,{onClick:fe,children:"确认加载"})]})]})}),e.jsx(gs,{open:E,onOpenChange:C,children:e.jsxs(cs,{children:[e.jsxs(os,{children:[e.jsx(us,{children:"⚠️ 节点数量较多"}),e.jsx(ms,{asChild:!0,children:e.jsxs("div",{children:[e.jsxs("p",{children:["您正在尝试加载 ",e.jsx("strong",{className:"text-orange-600",children:g>=1e4?"全部 (最多10000个)":g})," 个节点。"]}),e.jsx("p",{className:"mt-4",children:"节点数量过多可能导致:"}),e.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[e.jsx("li",{children:"页面加载时间较长"}),e.jsx("li",{children:"浏览器卡顿或崩溃"}),e.jsx("li",{children:"系统资源占用过高"})]}),e.jsx("p",{className:"mt-4",children:"建议先选择较少的节点数量 (50-200 个)。"})]})})]}),e.jsxs(ds,{children:[e.jsx(hs,{onClick:()=>{C(!1),g>200&&(b(50),w(!1))},children:"取消"}),e.jsx(xs,{onClick:Te,className:"bg-orange-600 hover:bg-orange-700",children:"我了解风险,继续加载"})]})]})})]})}function Lk(){return e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx("div",{className:"flex-none border-b bg-card/50 px-6 py-4",children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"麦麦知识库管理"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"管理和组织麦麦的知识库内容"})]})})}),e.jsx("div",{className:"flex-1 overflow-auto p-6",children:e.jsx("div",{className:"mx-auto max-w-4xl",children:e.jsxs(ke,{children:[e.jsxs(Re,{className:"text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-20 w-20 items-center justify-center rounded-full bg-primary/10",children:e.jsx(Yr,{className:"h-10 w-10 text-primary"})}),e.jsx(De,{className:"text-2xl",children:"麦麦知识库管理"}),e.jsx(is,{className:"text-base",children:"功能开发中,敬请期待"})]}),e.jsx(Me,{className:"text-center text-sm text-muted-foreground",children:e.jsx("p",{children:"此功能将提供知识库的创建、编辑、导入和管理能力"})})]})})})]})}function Xg({className:a,classNames:l,showOutsideDays:r=!0,captionLayout:c="label",buttonVariant:d="ghost",formatters:u,components:h,...f}){const p=wv();return e.jsx(u1,{showOutsideDays:r,className:F("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,a),captionLayout:c,formatters:{formatMonthDropdown:g=>g.toLocaleString("default",{month:"short"}),...u},classNames:{root:F("w-fit",p.root),months:F("relative flex flex-col gap-4 md:flex-row",p.months),month:F("flex w-full flex-col gap-4",p.month),nav:F("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",p.nav),button_previous:F(Zr({variant:d}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",p.button_previous),button_next:F(Zr({variant:d}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",p.button_next),month_caption:F("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",p.month_caption),dropdowns:F("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",p.dropdowns),dropdown_root:F("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",p.dropdown_root),dropdown:F("bg-popover absolute inset-0 opacity-0",p.dropdown),caption_label:F("select-none font-medium",c==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",p.caption_label),table:"w-full border-collapse",weekdays:F("flex",p.weekdays),weekday:F("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",p.weekday),week:F("mt-2 flex w-full",p.week),week_number_header:F("w-[--cell-size] select-none",p.week_number_header),week_number:F("text-muted-foreground select-none text-[0.8rem]",p.week_number),day:F("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",p.day),range_start:F("bg-accent rounded-l-md",p.range_start),range_middle:F("rounded-none",p.range_middle),range_end:F("bg-accent rounded-r-md",p.range_end),today:F("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",p.today),outside:F("text-muted-foreground aria-selected:text-muted-foreground",p.outside),disabled:F("text-muted-foreground opacity-50",p.disabled),hidden:F("invisible",p.hidden),...l},components:{Root:({className:g,rootRef:b,...j})=>e.jsx("div",{"data-slot":"calendar",ref:b,className:F(g),...j}),Chevron:({className:g,orientation:b,...j})=>b==="left"?e.jsx(Da,{className:F("size-4",g),...j}):b==="right"?e.jsx(sa,{className:F("size-4",g),...j}):e.jsx(za,{className:F("size-4",g),...j}),DayButton:Uk,WeekNumber:({children:g,...b})=>e.jsx("td",{...b,children:e.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:g})}),...h},...f})}function Uk({className:a,day:l,modifiers:r,...c}){const d=wv(),u=m.useRef(null);return m.useEffect(()=>{r.focused&&u.current?.focus()},[r.focused]),e.jsx(_,{ref:u,variant:"ghost",size:"icon","data-day":l.date.toLocaleDateString(),"data-selected-single":r.selected&&!r.range_start&&!r.range_end&&!r.range_middle,"data-range-start":r.range_start,"data-range-end":r.range_end,"data-range-middle":r.range_middle,className:F("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",d.day,a),...c})}const Oo={xs:{label:"小",rowHeight:28,class:"text-[10px] sm:text-xs"},sm:{label:"中",rowHeight:36,class:"text-xs sm:text-sm"},base:{label:"大",rowHeight:44,class:"text-sm sm:text-base"}};function $k(){const[a,l]=m.useState([]),[r,c]=m.useState(""),[d,u]=m.useState("all"),[h,f]=m.useState("all"),[p,g]=m.useState(void 0),[b,j]=m.useState(void 0),[y,N]=m.useState(!0),[w,M]=m.useState(!1),[A,S]=m.useState("xs"),[U,E]=m.useState(4),[C,D]=m.useState(!1),P=m.useRef(null);m.useEffect(()=>{const G=Hn.getAllLogs();l(G);const Se=Hn.onLog(()=>{l(Hn.getAllLogs())}),fe=Hn.onConnectionChange(Te=>{M(Te)});return()=>{Se(),fe()}},[]);const O=m.useMemo(()=>{const G=new Set(a.map(Se=>Se.module).filter(Se=>Se&&Se.trim()!==""));return Array.from(G).sort()},[a]),J=G=>{switch(G){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},L=G=>{switch(G){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},oe=()=>{window.location.reload()},Ne=()=>{Hn.clearLogs(),l([])},je=()=>{const G=ge.map(q=>`${q.timestamp} [${q.level.padEnd(8)}] [${q.module}] ${q.message}`).join(` -`),Se=new Blob([G],{type:"text/plain;charset=utf-8"}),fe=URL.createObjectURL(Se),Te=document.createElement("a");Te.href=fe,Te.download=`logs-${Tm(new Date,"yyyy-MM-dd-HHmmss")}.txt`,Te.click(),URL.revokeObjectURL(fe)},de=()=>{N(!y)},he=()=>{g(void 0),j(void 0)},ge=m.useMemo(()=>a.filter(G=>{const Se=r===""||G.message.toLowerCase().includes(r.toLowerCase())||G.module.toLowerCase().includes(r.toLowerCase()),fe=d==="all"||G.level===d,Te=h==="all"||G.module===h;let q=!0;if(p||b){const B=new Date(G.timestamp);if(p){const z=new Date(p);z.setHours(0,0,0,0),q=q&&B>=z}if(b){const z=new Date(b);z.setHours(23,59,59,999),q=q&&B<=z}}return Se&&fe&&Te&&q}),[a,r,d,h,p,b]),R=Oo[A].rowHeight+U,Q=Y0({count:ge.length,getScrollElement:()=>P.current,estimateSize:()=>R,overscan:50}),$=m.useRef(!1),ue=m.useRef(ge.length);return m.useEffect(()=>{const G=P.current;if(!G)return;const Se=()=>{if($.current)return;const{scrollTop:fe,scrollHeight:Te,clientHeight:q}=G,B=Te-fe-q;B>100&&y?N(!1):B<50&&!y&&N(!0)};return G.addEventListener("scroll",Se,{passive:!0}),()=>G.removeEventListener("scroll",Se)},[y]),m.useEffect(()=>{const G=ge.length>ue.current;ue.current=ge.length,y&&ge.length>0&&G&&($.current=!0,Q.scrollToIndex(ge.length-1,{align:"end",behavior:"auto"}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{$.current=!1})}))},[ge.length,y,Q]),e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex-shrink-0 space-y-2 sm:space-y-3 p-2 sm:p-3 lg:p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg sm:text-xl lg:text-2xl font-bold",children:"日志查看器"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 hidden sm:block",children:"实时查看和分析麦麦运行日志"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:F("h-2 w-2 sm:h-2.5 sm:w-2.5 rounded-full",w?"bg-green-500 animate-pulse":"bg-red-500")}),e.jsx("span",{className:"text-xs text-muted-foreground",children:w?"已连接":"未连接"})]})]}),e.jsx(ke,{className:"p-2 sm:p-3",children:e.jsx(uc,{open:C,onOpenChange:D,children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex-1 relative min-w-0",children:[e.jsx(At,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),e.jsx(ae,{placeholder:"搜索日志...",value:r,onChange:G=>c(G.target.value),className:"pl-8 h-8 text-xs sm:text-sm"})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsxs(_,{variant:y?"default":"outline",size:"sm",onClick:de,className:"h-8 px-2",title:y?"自动滚动":"已暂停",children:[y?e.jsx(D_,{className:"h-3.5 w-3.5"}):e.jsx(O_,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden sm:inline",children:y?"滚动":"暂停"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:Ne,className:"h-8 px-2",title:"清空日志",children:[e.jsx(ls,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden md:inline",children:"清空"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:je,className:"h-8 px-2 hidden sm:flex",title:"导出日志",children:[e.jsx(Wt,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden lg:inline",children:"导出"})]}),e.jsx(mc,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"h-8 px-2",title:C?"收起筛选":"展开筛选",children:[e.jsx(Bo,{className:"h-3.5 w-3.5"}),C?e.jsx(Qr,{className:"h-3.5 w-3.5 ml-1"}):e.jsx(za,{className:"h-3.5 w-3.5 ml-1"})]})})]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground text-center sm:text-right -mt-1",children:[e.jsxs("span",{className:"font-mono",children:[ge.length," / ",a.length]}),e.jsx("span",{className:"ml-1",children:"条日志"})]}),e.jsxs(xc,{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(Pe,{value:d,onValueChange:u,children:[e.jsxs(Be,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(Bo,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx(Fe,{placeholder:"级别"})]}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"全部级别"}),e.jsx(W,{value:"DEBUG",children:"DEBUG"}),e.jsx(W,{value:"INFO",children:"INFO"}),e.jsx(W,{value:"WARNING",children:"WARNING"}),e.jsx(W,{value:"ERROR",children:"ERROR"}),e.jsx(W,{value:"CRITICAL",children:"CRITICAL"})]})]}),e.jsxs(Pe,{value:h,onValueChange:f,children:[e.jsxs(Be,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(Bo,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx(Fe,{placeholder:"模块"})]}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"全部模块"}),O.map(G=>e.jsx(W,{value:G,children:G},G))]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(ul,{children:[e.jsx(ml,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:F("w-full sm:flex-1 justify-start text-left font-normal h-8",!p&&"text-muted-foreground"),children:[e.jsx(Go,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:p?Tm(p,"PP",{locale:Ro}):"开始日期"})]})}),e.jsx(sl,{className:"w-auto p-0",align:"start",children:e.jsx(Xg,{mode:"single",selected:p,onSelect:g,initialFocus:!0,locale:Ro})})]}),e.jsxs(ul,{children:[e.jsx(ml,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:F("w-full sm:flex-1 justify-start text-left font-normal h-8",!b&&"text-muted-foreground"),children:[e.jsx(Go,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:b?Tm(b,"PP",{locale:Ro}):"结束日期"})]})}),e.jsx(sl,{className:"w-auto p-0",align:"start",children:e.jsx(Xg,{mode:"single",selected:b,onSelect:j,initialFocus:!0,locale:Ro})})]}),(p||b)&&e.jsxs(_,{variant:"outline",size:"sm",onClick:he,className:"w-full sm:w-auto h-8",children:[e.jsx(Aa,{className:"h-3.5 w-3.5 sm:mr-1"}),e.jsx("span",{className:"text-xs",children:"清除"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3 pt-2 border-t border-border/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(L_,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"字号"})]}),e.jsx("div",{className:"flex gap-1",children:Object.keys(Oo).map(G=>e.jsx(_,{variant:A===G?"default":"outline",size:"sm",onClick:()=>S(G),className:"h-6 px-2 text-xs",children:Oo[G].label},G))})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-1 max-w-[200px]",children:[e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"行距"}),e.jsx(Qa,{value:[U],onValueChange:([G])=>E(G),min:0,max:12,step:2,className:"flex-1"}),e.jsxs("span",{className:"text-xs text-muted-foreground w-7",children:[U,"px"]})]}),e.jsxs("div",{className:"flex gap-2 sm:hidden",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:oe,className:"flex-1 h-8",children:[e.jsx(xt,{className:"h-3.5 w-3.5 mr-1"}),e.jsx("span",{className:"text-xs",children:"刷新"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:je,className:"flex-1 h-8",children:[e.jsx(Wt,{className:"h-3.5 w-3.5 mr-1"}),e.jsx("span",{className:"text-xs",children:"导出"})]})]})]})]})]})})})]}),e.jsx("div",{className:"flex-1 min-h-0 px-2 sm:px-3 lg:px-4 pb-2 sm:pb-3 lg:pb-4",children:e.jsx(ke,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900 h-full overflow-hidden",children:e.jsx("div",{ref:P,className:F("h-full overflow-auto","[&::-webkit-scrollbar]:w-2.5","[&::-webkit-scrollbar-track]:bg-transparent","[&::-webkit-scrollbar-thumb]:bg-border [&::-webkit-scrollbar-thumb]:rounded-full","[&::-webkit-scrollbar-thumb:hover]:bg-border/80"),children:e.jsx("div",{className:F("p-2 sm:p-3 font-mono relative",Oo[A].class),style:{height:`${Q.getTotalSize()}px`},children:ge.length===0?e.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-xs sm:text-sm",children:"暂无日志数据"}):Q.getVirtualItems().map(G=>{const Se=ge[G.index];return e.jsxs("div",{"data-index":G.index,ref:Q.measureElement,className:F("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors",L(Se.level)),style:{transform:`translateY(${G.start}px)`,paddingTop:`${U/2}px`,paddingBottom:`${U/2}px`},children:[e.jsxs("div",{className:"flex flex-col gap-0.5 sm:hidden",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-600 text-[10px]",children:Se.timestamp}),e.jsxs("span",{className:F("font-semibold text-[10px]",J(Se.level)),children:["[",Se.level,"]"]})]}),e.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 truncate text-[10px]",children:Se.module}),e.jsx("div",{className:"text-gray-300 dark:text-gray-400 whitespace-pre-wrap break-words text-[10px]",children:Se.message})]}),e.jsxs("div",{className:"hidden sm:flex gap-2 items-start",children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[130px] lg:w-[160px]",children:Se.timestamp}),e.jsxs("span",{className:F("flex-shrink-0 w-[65px] lg:w-[75px] font-semibold",J(Se.level)),children:["[",Se.level,"]"]}),e.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[100px] lg:w-[130px] truncate",children:Se.module}),e.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words",children:Se.message})]})]},G.key)})})})})})]})}async function Bk(){return(await _e("/api/planner/overview")).json()}async function Ik(a,l=1,r=20,c){const d=new URLSearchParams({page:l.toString(),page_size:r.toString()});return c&&d.append("search",c),(await _e(`/api/planner/chat/${a}/logs?${d}`)).json()}async function Pk(a,l){return(await _e(`/api/planner/log/${a}/${l}`)).json()}async function Fk(){return(await _e("/api/replier/overview")).json()}async function Hk(a,l=1,r=20,c){const d=new URLSearchParams({page:l.toString(),page_size:r.toString()});return c&&d.append("search",c),(await _e(`/api/replier/chat/${a}/logs?${d}`)).json()}async function Vk(a,l){return(await _e(`/api/replier/log/${a}/${l}`)).json()}function aN(){const[a,l]=m.useState(new Map),[r,c]=m.useState(!0),d=m.useCallback(async()=>{try{c(!0);const h=await mx();if(h?.data){const f=new Map;h.data.forEach(p=>{f.set(p.chat_id,p.chat_name)}),l(f)}}catch(h){console.error("加载聊天列表失败:",h)}finally{c(!1)}},[]);m.useEffect(()=>{d()},[d]);const u=m.useCallback(h=>a.get(h)||h,[a]);return{chatNameMap:a,getChatName:u,loading:r,reload:d}}function Jo(a){return new Date(a*1e3).toLocaleString("zh-CN")}function lN(a){const r=Date.now()/1e3-a;return r<60?"刚刚":r<3600?`${Math.floor(r/60)} 分钟前`:r<86400?`${Math.floor(r/3600)} 小时前`:`${Math.floor(r/86400)} 天前`}function nN(a,l,r=1e4){m.useEffect(()=>{if(!a)return;const c=setInterval(l,r);return()=>clearInterval(c)},[a,l,r])}function Gk({autoRefresh:a,refreshKey:l}){const[r,c]=m.useState("overview"),[d,u]=m.useState(null),{getChatName:h}=aN(),[f,p]=m.useState(null),[g,b]=m.useState(!0),[j,y]=m.useState(null),[N,w]=m.useState(!1),[M,A]=m.useState(1),[S,U]=m.useState(20),[E,C]=m.useState(""),[D,P]=m.useState(""),[O,J]=m.useState(""),[L,oe]=m.useState(null),[Ne,je]=m.useState(!1),[de,he]=m.useState(!1),ge=m.useCallback(async()=>{try{b(!0);const B=await Bk();p(B)}catch(B){console.error("加载规划器总览失败:",B)}finally{b(!1)}},[]),R=m.useCallback(async()=>{if(d)try{w(!0);const B=await Ik(d.chat_id,M,S,D||void 0);y(B)}catch(B){console.error("加载聊天日志失败:",B)}finally{w(!1)}},[d,M,S,D]);m.useEffect(()=>{ge()},[ge]),m.useEffect(()=>{l>0&&(r==="overview"?ge():R())},[l,r,ge,R]),m.useEffect(()=>{r==="chat-logs"&&d&&R()},[r,d,R]),nN(a,m.useCallback(()=>{r==="overview"?ge():R()},[r,ge,R]));const Q=B=>{u(B),A(1),P(""),J(""),c("chat-logs")},$=()=>{c("overview"),u(null),y(null),P(""),J("")},ue=()=>{P(O),A(1)},G=()=>{J(""),P(""),A(1)},Se=async(B,z)=>{try{he(!0),je(!0);const K=await Pk(B,z);oe(K)}catch(K){console.error("加载计划详情失败:",K)}finally{he(!1)}},fe=B=>{U(Number(B)),A(1)},Te=()=>{const B=parseInt(E),z=j?Math.ceil(j.total/j.page_size):0;!isNaN(B)&&B>=1&&B<=z&&(A(B),C(""))},q=j?Math.ceil(j.total/j.page_size):0;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-4",children:r==="overview"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(ke,{children:[e.jsxs(Re,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(De,{className:"text-sm font-medium",children:"聊天数量"}),e.jsx(Ra,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Me,{children:g?e.jsx(ws,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_chats||0})})]}),e.jsxs(ke,{children:[e.jsxs(Re,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(De,{className:"text-sm font-medium",children:"计划总数"}),e.jsx(ax,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Me,{children:g?e.jsx(ws,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_plans||0})})]})]}),e.jsxs(ke,{children:[e.jsxs(Re,{children:[e.jsx(De,{children:"聊天列表"}),e.jsx(is,{children:"点击查看该聊天的所有计划记录"})]}),e.jsx(Me,{children:g?e.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:[...Array(6)].map((B,z)=>e.jsx(ws,{className:"h-24 w-full"},z))}):f?.chats&&f.chats.length>0?e.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:f.chats.map(B=>e.jsxs("div",{className:"border rounded-lg p-4 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>Q(B),children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ra,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm truncate max-w-[180px]",title:h(B.chat_id),children:h(B.chat_id)})]}),e.jsx(Ce,{variant:"secondary",children:B.plan_count})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["最后活动: ",lN(B.latest_timestamp)]})]},B.chat_id))}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无聊天记录"})})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-4 mb-4",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:$,children:[e.jsx(Ma,{className:"h-4 w-4 mr-2"}),"返回聊天列表"]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["当前聊天: ",e.jsx("span",{className:"font-medium",children:d?h(d.chat_id):""}),e.jsx("span",{className:"mx-2",children:"•"}),"共 ",j?.total||0," 条计划记录"]})]}),e.jsxs(ke,{children:[e.jsxs(Re,{children:[e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(De,{children:"计划执行记录"}),e.jsx(is,{children:d?h(d.chat_id):""})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ae,{placeholder:"搜索提示词内容...",value:O,onChange:B=>J(B.target.value),onKeyDown:B=>B.key==="Enter"&&ue(),className:"w-full sm:w-48"}),e.jsx(_,{variant:"outline",size:"icon",onClick:ue,children:e.jsx(At,{className:"h-4 w-4"})}),D&&e.jsx(_,{variant:"ghost",size:"sm",onClick:G,children:"清除"})]}),e.jsxs(Pe,{value:S.toString(),onValueChange:fe,children:[e.jsx(Be,{className:"w-full sm:w-32",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"10",children:"10条/页"}),e.jsx(W,{value:"20",children:"20条/页"}),e.jsx(W,{value:"50",children:"50条/页"}),e.jsx(W,{value:"100",children:"100条/页"})]})]})]})]}),D&&e.jsxs("div",{className:"text-sm text-muted-foreground mt-2",children:["搜索关键词: ",e.jsxs("span",{className:"font-medium",children:['"',D,'"']})]})]}),e.jsx(Me,{children:N?e.jsx("div",{className:"space-y-2",children:[...Array(5)].map((B,z)=>e.jsx(ws,{className:"h-20 w-full"},z))}):j?.data&&j.data.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-2",children:j.data.map(B=>e.jsxs("div",{className:"border rounded-lg p-3 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>Se(B.chat_id,B.filename),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:Jo(B.timestamp)}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsxs(Ce,{variant:"secondary",className:"text-xs",children:[B.action_count," 个动作"]}),e.jsxs(Ce,{variant:"outline",className:"text-xs",children:[B.total_plan_ms.toFixed(0),"ms"]})]})]}),B.action_types&&B.action_types.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:B.action_types.map((z,K)=>e.jsx(Ce,{variant:"outline",className:"text-xs bg-blue-50 dark:bg-blue-950 text-blue-700 dark:text-blue-300 border-blue-200 dark:border-blue-800",children:z},K))}),e.jsx("p",{className:"text-sm line-clamp-2",children:B.reasoning_preview||"无推理内容"})]},B.filename))}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",j.total," 条记录,第 ",M," / ",q," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>A(1),disabled:M===1,className:"hidden sm:flex",children:e.jsx(Nn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>A(B=>Math.max(1,B-1)),disabled:M===1,children:e.jsx(Da,{className:"h-4 w-4"})}),e.jsxs("div",{className:"hidden sm:flex items-center gap-2",children:[e.jsx(ae,{type:"number",min:1,max:q,value:E,onChange:B=>C(B.target.value),onKeyDown:B=>B.key==="Enter"&&Te(),placeholder:"跳转",className:"w-20 h-8"}),e.jsx(_,{size:"sm",variant:"outline",onClick:Te,children:"跳转"})]}),e.jsxs("span",{className:"sm:hidden text-sm text-muted-foreground",children:[M,"/",q]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>A(B=>Math.min(q,B+1)),disabled:M===q,children:e.jsx(sa,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>A(q),disabled:M===q,className:"hidden sm:flex",children:e.jsx(bn,{className:"h-4 w-4"})})]})]})]}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无计划记录"})})]})]})}),e.jsx(Fs,{open:Ne,onOpenChange:je,children:e.jsxs(Us,{className:"max-w-4xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs($s,{children:[e.jsxs(Bs,{className:"flex items-center gap-2",children:[e.jsx(Ea,{className:"h-5 w-5"}),"计划执行详情"]}),e.jsx(Xs,{children:"查看麦麦的详细计划推理过程和执行动作"})]}),e.jsx(Ze,{className:"h-full pr-4",children:e.jsx("div",{className:"space-y-6 pb-4",children:de?e.jsx("div",{className:"space-y-4",children:[...Array(5)].map((B,z)=>e.jsx(ws,{className:"h-24 w-full"},z))}):L?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(na,{className:"h-4 w-4"}),"基本信息"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4 bg-muted/50 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),e.jsx("div",{className:"text-sm",title:L.chat_id,children:h(L.chat_id)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"时间戳"}),e.jsx("div",{className:"text-sm",children:Jo(L.timestamp)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"类型"}),e.jsx(Ce,{variant:"outline",children:L.type})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"动作数量"}),e.jsxs(Ce,{children:[L.actions.length," 个动作"]})]})]})]}),e.jsx(Zt,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(el,{className:"h-4 w-4"}),"性能统计"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs(ke,{children:[e.jsx(Re,{className:"p-4 pb-2",children:e.jsx(De,{className:"text-xs text-muted-foreground",children:"提示词构建"})}),e.jsx(Me,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.prompt_build_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(ke,{children:[e.jsx(Re,{className:"p-4 pb-2",children:e.jsx(De,{className:"text-xs text-muted-foreground",children:"LLM 推理"})}),e.jsx(Me,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.llm_duration_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(ke,{children:[e.jsx(Re,{className:"p-4 pb-2",children:e.jsx(De,{className:"text-xs text-muted-foreground",children:"总计划时间"})}),e.jsx(Me,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.total_plan_ms?.toFixed(2)||0,"ms"]})})]})]})]}),e.jsx(Zt,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(ox,{className:"h-4 w-4"}),"推理过程"]}),e.jsx("div",{className:"p-4 bg-muted/50 rounded-lg",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:L.reasoning||"无推理内容"})})]}),e.jsx(Zt,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(U_,{className:"h-4 w-4"}),"执行动作 (",L.actions.length,")"]}),e.jsx("div",{className:"space-y-3",children:L.actions.map((B,z)=>e.jsxs(ke,{children:[e.jsx(Re,{className:"p-4 pb-3",children:e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Ce,{variant:"default",children:["动作 ",z+1]}),e.jsx(Ce,{variant:"outline",children:B.action_type})]})})}),e.jsxs(Me,{className:"p-4 pt-0 space-y-3",children:[B.reasoning&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"推理依据"}),e.jsx("p",{className:"text-sm bg-muted/30 p-2 rounded",children:typeof B.reasoning=="string"?B.reasoning:JSON.stringify(B.reasoning)})]}),B.action_message&&e.jsxs("div",{className:"overflow-hidden",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"动作消息"}),typeof B.action_message=="string"?e.jsx("p",{className:"text-sm bg-muted/30 p-2 rounded break-all whitespace-pre-wrap",children:B.action_message}):e.jsx("pre",{className:"text-xs bg-muted/30 p-2 rounded overflow-x-auto whitespace-pre-wrap break-all",children:JSON.stringify(B.action_message,null,2)})]}),B.action_data&&Object.keys(B.action_data).length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"动作数据"}),e.jsx("pre",{className:"text-xs bg-muted/30 p-2 rounded overflow-x-auto",children:JSON.stringify(B.action_data,null,2)})]}),B.action_reasoning&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"动作推理"}),e.jsx("p",{className:"text-sm bg-muted/30 p-2 rounded",children:typeof B.action_reasoning=="string"?B.action_reasoning:JSON.stringify(B.action_reasoning)})]})]})]},z))})]}),e.jsx(Zt,{}),L.raw_output&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"原始输出"}),e.jsxs("details",{className:"group",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-muted-foreground hover:text-foreground",children:"点击展开查看完整原始输出"}),e.jsx("div",{className:"mt-2 p-4 bg-muted/50 rounded-lg",children:e.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words",children:L.raw_output})})]})]}),L.prompt&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"完整提示词"}),e.jsxs("details",{className:"group",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-muted-foreground hover:text-foreground",children:"点击展开查看完整提示词"}),e.jsx("div",{className:"mt-2 p-4 bg-muted/50 rounded-lg",children:e.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words",children:L.prompt})})]})]})]}):e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("p",{className:"text-muted-foreground",children:"无数据"})})})}),e.jsx(nt,{className:"flex-shrink-0",children:e.jsx(_,{onClick:()=>je(!1),children:"关闭"})})]})})]})}function qk({autoRefresh:a,refreshKey:l}){const[r,c]=m.useState("overview"),[d,u]=m.useState(null),{getChatName:h}=aN(),[f,p]=m.useState(null),[g,b]=m.useState(!0),[j,y]=m.useState(null),[N,w]=m.useState(!1),[M,A]=m.useState(1),[S,U]=m.useState(20),[E,C]=m.useState(""),[D,P]=m.useState(""),[O,J]=m.useState(""),[L,oe]=m.useState(null),[Ne,je]=m.useState(!1),[de,he]=m.useState(!1),ge=m.useCallback(async()=>{try{b(!0);const B=await Fk();p(B)}catch(B){console.error("加载回复器总览失败:",B)}finally{b(!1)}},[]),R=m.useCallback(async()=>{if(d)try{w(!0);const B=await Hk(d.chat_id,M,S,D||void 0);y(B)}catch(B){console.error("加载聊天日志失败:",B)}finally{w(!1)}},[d,M,S,D]);m.useEffect(()=>{ge()},[ge]),m.useEffect(()=>{l>0&&(r==="overview"?ge():R())},[l,r,ge,R]),m.useEffect(()=>{r==="chat-logs"&&d&&R()},[r,d,R]),nN(a,m.useCallback(()=>{r==="overview"?ge():R()},[r,ge,R]));const Q=B=>{u(B),A(1),P(""),J(""),c("chat-logs")},$=()=>{c("overview"),u(null),y(null),P(""),J("")},ue=()=>{P(O),A(1)},G=()=>{J(""),P(""),A(1)},Se=async(B,z)=>{try{he(!0),je(!0);const K=await Vk(B,z);oe(K)}catch(K){console.error("加载回复详情失败:",K)}finally{he(!1)}},fe=B=>{U(Number(B)),A(1)},Te=()=>{const B=parseInt(E),z=j?Math.ceil(j.total/j.page_size):0;!isNaN(B)&&B>=1&&B<=z&&(A(B),C(""))},q=j?Math.ceil(j.total/j.page_size):0;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-4",children:r==="overview"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(ke,{children:[e.jsxs(Re,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(De,{className:"text-sm font-medium",children:"聊天数量"}),e.jsx(Ra,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Me,{children:g?e.jsx(ws,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_chats||0})})]}),e.jsxs(ke,{children:[e.jsxs(Re,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(De,{className:"text-sm font-medium",children:"回复总数"}),e.jsx(ax,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Me,{children:g?e.jsx(ws,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_replies||0})})]})]}),e.jsxs(ke,{children:[e.jsxs(Re,{children:[e.jsx(De,{children:"聊天列表"}),e.jsx(is,{children:"点击查看该聊天的所有回复记录"})]}),e.jsx(Me,{children:g?e.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:[...Array(6)].map((B,z)=>e.jsx(ws,{className:"h-24 w-full"},z))}):f?.chats&&f.chats.length>0?e.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:f.chats.map(B=>e.jsxs("div",{className:"border rounded-lg p-4 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>Q(B),children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ra,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm truncate max-w-[180px]",title:h(B.chat_id),children:h(B.chat_id)})]}),e.jsx(Ce,{variant:"secondary",children:B.reply_count})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["最后活动: ",lN(B.latest_timestamp)]})]},B.chat_id))}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无聊天记录"})})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-4 mb-4",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:$,children:[e.jsx(Ma,{className:"h-4 w-4 mr-2"}),"返回聊天列表"]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["当前聊天: ",e.jsx("span",{className:"font-medium",children:d?h(d.chat_id):""}),e.jsx("span",{className:"mx-2",children:"•"}),"共 ",j?.total||0," 条回复记录"]})]}),e.jsxs(ke,{children:[e.jsxs(Re,{children:[e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(De,{children:"回复生成记录"}),e.jsx(is,{children:d?h(d.chat_id):""})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ae,{placeholder:"搜索提示词内容...",value:O,onChange:B=>J(B.target.value),onKeyDown:B=>B.key==="Enter"&&ue(),className:"w-full sm:w-48"}),e.jsx(_,{variant:"outline",size:"icon",onClick:ue,children:e.jsx(At,{className:"h-4 w-4"})}),D&&e.jsx(_,{variant:"ghost",size:"sm",onClick:G,children:"清除"})]}),e.jsxs(Pe,{value:S.toString(),onValueChange:fe,children:[e.jsx(Be,{className:"w-full sm:w-32",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"10",children:"10条/页"}),e.jsx(W,{value:"20",children:"20条/页"}),e.jsx(W,{value:"50",children:"50条/页"}),e.jsx(W,{value:"100",children:"100条/页"})]})]})]})]}),D&&e.jsxs("div",{className:"text-sm text-muted-foreground mt-2",children:["搜索关键词: ",e.jsxs("span",{className:"font-medium",children:['"',D,'"']})]})]}),e.jsx(Me,{children:N?e.jsx("div",{className:"space-y-2",children:[...Array(5)].map((B,z)=>e.jsx(ws,{className:"h-20 w-full"},z))}):j?.data&&j.data.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-2",children:j.data.map(B=>e.jsxs("div",{className:"border rounded-lg p-3 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>Se(B.chat_id,B.filename),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:Jo(B.timestamp)}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[B.success?e.jsxs(Ce,{variant:"default",className:"text-xs bg-green-600",children:[e.jsx(_g,{className:"h-3 w-3 mr-1"}),"成功"]}):e.jsxs(Ce,{variant:"destructive",className:"text-xs",children:[e.jsx(Ka,{className:"h-3 w-3 mr-1"}),"失败"]}),e.jsx(Ce,{variant:"outline",className:"text-xs",children:B.model}),e.jsxs(Ce,{variant:"secondary",className:"text-xs",children:[B.overall_ms.toFixed(0),"ms"]})]})]}),e.jsx("p",{className:"text-sm line-clamp-2",children:B.output_preview||"无输出内容"})]},B.filename))}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",j.total," 条记录,第 ",M," / ",q," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>A(1),disabled:M===1,className:"hidden sm:flex",children:e.jsx(Nn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>A(B=>Math.max(1,B-1)),disabled:M===1,children:e.jsx(Da,{className:"h-4 w-4"})}),e.jsxs("div",{className:"hidden sm:flex items-center gap-2",children:[e.jsx(ae,{type:"number",min:1,max:q,value:E,onChange:B=>C(B.target.value),onKeyDown:B=>B.key==="Enter"&&Te(),placeholder:"跳转",className:"w-20 h-8"}),e.jsx(_,{size:"sm",variant:"outline",onClick:Te,children:"跳转"})]}),e.jsxs("span",{className:"sm:hidden text-sm text-muted-foreground",children:[M,"/",q]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>A(B=>Math.min(q,B+1)),disabled:M===q,children:e.jsx(sa,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>A(q),disabled:M===q,className:"hidden sm:flex",children:e.jsx(bn,{className:"h-4 w-4"})})]})]})]}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无回复记录"})})]})]})}),e.jsx(Fs,{open:Ne,onOpenChange:je,children:e.jsxs(Us,{className:"max-w-4xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs($s,{children:[e.jsxs(Bs,{className:"flex items-center gap-2",children:[e.jsx(Ea,{className:"h-5 w-5"}),"回复生成详情"]}),e.jsx(Xs,{children:"查看麦麦的详细回复生成过程"})]}),e.jsx(Ze,{className:"h-full pr-4",children:e.jsx("div",{className:"space-y-6 pb-4",children:de?e.jsx("div",{className:"space-y-4",children:[...Array(5)].map((B,z)=>e.jsx(ws,{className:"h-24 w-full"},z))}):L?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(na,{className:"h-4 w-4"}),"基本信息"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4 bg-muted/50 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),e.jsx("div",{className:"text-sm",title:L.chat_id,children:h(L.chat_id)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"时间戳"}),e.jsx("div",{className:"text-sm",children:Jo(L.timestamp)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"状态"}),L.success?e.jsxs(Ce,{variant:"default",className:"bg-green-600",children:[e.jsx(_g,{className:"h-3 w-3 mr-1"}),"成功"]}):e.jsxs(Ce,{variant:"destructive",children:[e.jsx(Ka,{className:"h-3 w-3 mr-1"}),"失败"]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"思考深度"}),e.jsxs(Ce,{variant:"outline",children:["Level ",L.think_level]})]})]})]}),e.jsx(Zt,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx($_,{className:"h-4 w-4"}),"模型信息"]}),e.jsx("div",{className:"p-4 bg-muted/50 rounded-lg",children:e.jsx(Ce,{variant:"secondary",className:"text-sm",children:L.model})})]}),e.jsx(Zt,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(el,{className:"h-4 w-4"}),"性能统计"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs(ke,{children:[e.jsx(Re,{className:"p-4 pb-2",children:e.jsx(De,{className:"text-xs text-muted-foreground",children:"提示词构建"})}),e.jsx(Me,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.prompt_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(ke,{children:[e.jsx(Re,{className:"p-4 pb-2",children:e.jsx(De,{className:"text-xs text-muted-foreground",children:"LLM 推理"})}),e.jsx(Me,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.llm_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(ke,{children:[e.jsx(Re,{className:"p-4 pb-2",children:e.jsx(De,{className:"text-xs text-muted-foreground",children:"总耗时"})}),e.jsx(Me,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.overall_ms?.toFixed(2)||0,"ms"]})})]})]}),L.timing.timing_logs&&L.timing.timing_logs.length>0&&e.jsxs("div",{className:"mt-3 p-3 bg-muted/30 rounded-lg",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-2",children:"耗时详情"}),e.jsx("div",{className:"space-y-1",children:L.timing.timing_logs.map((B,z)=>e.jsx("div",{className:"text-xs text-muted-foreground",children:B},z))})]}),L.timing.almost_zero&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"近乎零耗时: "}),L.timing.almost_zero]})]}),e.jsx(Zt,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(ox,{className:"h-4 w-4"}),"回复输出"]}),e.jsx("div",{className:"p-4 bg-muted/50 rounded-lg",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:L.output||"无输出内容"})})]}),L.processed_output&&L.processed_output.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Zt,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"处理后的输出"}),e.jsx("div",{className:"space-y-2",children:L.processed_output.map((B,z)=>e.jsx("div",{className:"p-3 bg-muted/30 rounded-lg",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:B})},z))})]})]}),L.reasoning&&e.jsxs(e.Fragment,{children:[e.jsx(Zt,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"推理过程"}),e.jsx("div",{className:"p-4 bg-muted/50 rounded-lg",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:L.reasoning})})]})]}),L.error&&e.jsxs(e.Fragment,{children:[e.jsx(Zt,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold text-destructive",children:"错误信息"}),e.jsx("div",{className:"p-4 bg-destructive/10 rounded-lg border border-destructive/20",children:e.jsx("p",{className:"text-sm text-destructive whitespace-pre-wrap",children:L.error})})]})]}),L.prompt&&e.jsxs(e.Fragment,{children:[e.jsx(Zt,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"完整提示词"}),e.jsxs("details",{className:"group",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-muted-foreground hover:text-foreground",children:"点击展开查看完整提示词"}),e.jsx("div",{className:"mt-2 p-4 bg-muted/50 rounded-lg",children:e.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words",children:L.prompt})})]})]})]})]}):e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("p",{className:"text-muted-foreground",children:"无数据"})})})}),e.jsx(nt,{className:"flex-shrink-0",children:e.jsx(_,{onClick:()=>je(!1),children:"关闭"})})]})})]})}function Kk(){const[a,l]=m.useState("planner"),[r,c]=m.useState(!1),[d,u]=m.useState(0),h=m.useCallback(()=>{u(f=>f+1)},[]);return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"计划器 & 回复器监控"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"实时监控麦麦的任务计划器和回复生成器运行状态"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(_,{variant:r?"default":"outline",size:"sm",onClick:()=>c(!r),children:[e.jsx(xt,{className:`h-4 w-4 mr-2 ${r?"animate-spin":""}`}),r?"自动刷新中":"自动刷新"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:h,children:e.jsx(xt,{className:"h-4 w-4"})})]})]}),e.jsxs(ea,{value:a,onValueChange:f=>l(f),className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2 gap-0.5 sm:gap-1 h-auto p-1",children:[e.jsxs(Xe,{value:"planner",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(tx,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"计划器监控"})]}),e.jsxs(Xe,{value:"replier",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(B_,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"回复器监控"})]})]}),e.jsxs(Ze,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[e.jsx(vs,{value:"planner",className:"mt-0",children:e.jsx(Gk,{autoRefresh:r,refreshKey:d})}),e.jsx(vs,{value:"replier",className:"mt-0",children:e.jsx(qk,{autoRefresh:r,refreshKey:d})})]})]})]})}const Qk="Mai-with-u",Yk="plugin-repo",Jk="main",Xk="plugin_details.json";async function Zk(){try{const a=await _e("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:Qk,repo:Yk,branch:Jk,file_path:Xk})});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);const l=await a.json();if(!l.success||!l.data)throw new Error(l.error||"获取插件列表失败");return JSON.parse(l.data).filter(d=>!d?.id||!d?.manifest?(console.warn("跳过无效插件数据:",d),!1):!d.manifest.name||!d.manifest.version?(console.warn("跳过缺少必需字段的插件:",d.id),!1):!0).map(d=>({id:d.id,manifest:{manifest_version:d.manifest.manifest_version||1,name:d.manifest.name,version:d.manifest.version,description:d.manifest.description||"",author:d.manifest.author||{name:"Unknown"},license:d.manifest.license||"Unknown",host_application:d.manifest.host_application||{min_version:"0.0.0"},homepage_url:d.manifest.homepage_url,repository_url:d.manifest.repository_url,keywords:d.manifest.keywords||[],categories:d.manifest.categories||[],default_locale:d.manifest.default_locale||"zh-CN",locales_path:d.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(a){throw console.error("Failed to fetch plugin list:",a),a}}async function rN(){try{const a=await _e("/api/webui/plugins/git-status");if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return await a.json()}catch(a){return console.error("Failed to check Git status:",a),{installed:!1,error:"无法检测 Git 安装状态"}}}async function iN(){try{const a=await _e("/api/webui/plugins/version");if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return await a.json()}catch(a){return console.error("Failed to get Maimai version:",a),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function cN(a,l,r){const c=a.split(".").map(f=>parseInt(f)||0),d=c[0]||0,u=c[1]||0,h=c[2]||0;if(r.version_majorparseInt(j)||0),p=f[0]||0,g=f[1]||0,b=f[2]||0;if(r.version_major>p||r.version_major===p&&r.version_minor>g||r.version_major===p&&r.version_minor===g&&r.version_patch>b)return!1}return!0}async function Wk(){try{const a=await _e("/api/webui/ws-token");if(!a.ok)return console.error("获取 WebSocket token 失败:",a.status),null;const l=await a.json();return l.success&&l.token?l.token:null}catch(a){return console.error("获取 WebSocket token 失败:",a),null}}async function eC(a,l){const r=await Wk();if(!r)return console.warn("无法获取 WebSocket token,可能未登录"),null;const c=window.location.protocol==="https:"?"wss:":"ws:",d=window.location.host,u=`${c}//${d}/api/webui/ws/plugin-progress?token=${encodeURIComponent(r)}`;try{const h=new WebSocket(u);return h.onopen=()=>{console.log("Plugin progress WebSocket connected");const f=setInterval(()=>{h.readyState===WebSocket.OPEN?h.send("ping"):clearInterval(f)},3e4)},h.onmessage=f=>{try{if(f.data==="pong")return;const p=JSON.parse(f.data);a(p)}catch(p){console.error("Failed to parse progress data:",p)}},h.onerror=f=>{console.error("Plugin progress WebSocket error:",f),l?.(f)},h.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},h}catch(h){return console.error("创建 WebSocket 连接失败:",h),null}}async function Dl(){try{const a=await _e("/api/webui/plugins/installed",{headers:qs()});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);const l=await a.json();if(!l.success)throw new Error(l.message||"获取已安装插件列表失败");return l.plugins||[]}catch(a){return console.error("Failed to get installed plugins:",a),[]}}function hn(a,l){return l.some(r=>r.id===a)}function fn(a,l){const r=l.find(c=>c.id===a);if(r)return r.manifest?.version||r.version}async function oN(a,l,r="main"){const c=await _e("/api/webui/plugins/install",{method:"POST",body:JSON.stringify({plugin_id:a,repository_url:l,branch:r})});if(!c.ok){const d=await c.json();throw new Error(d.detail||"安装失败")}return await c.json()}async function dN(a){const l=await _e("/api/webui/plugins/uninstall",{method:"POST",body:JSON.stringify({plugin_id:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"卸载失败")}return await l.json()}async function uN(a,l,r="main"){const c=await _e("/api/webui/plugins/update",{method:"POST",body:JSON.stringify({plugin_id:a,repository_url:l,branch:r})});if(!c.ok){const d=await c.json();throw new Error(d.detail||"更新失败")}return await c.json()}async function sC(a){const l=await _e(`/api/webui/plugins/config/${a}/schema`,{headers:qs()});if(!l.ok){const c=await l.text();try{const d=JSON.parse(c);throw new Error(d.detail||"获取配置 Schema 失败")}catch{throw new Error(`获取配置 Schema 失败 (${l.status})`)}}const r=await l.json();if(!r.success)throw new Error(r.message||"获取配置 Schema 失败");return r.schema}async function tC(a){const l=await _e(`/api/webui/plugins/config/${a}`,{headers:qs()});if(!l.ok){const c=await l.text();try{const d=JSON.parse(c);throw new Error(d.detail||"获取配置失败")}catch{throw new Error(`获取配置失败 (${l.status})`)}}const r=await l.json();if(!r.success)throw new Error(r.message||"获取配置失败");return r.config}async function aC(a){const l=await _e(`/api/webui/plugins/config/${a}/raw`,{headers:qs()});if(!l.ok){const c=await l.text();try{const d=JSON.parse(c);throw new Error(d.detail||"获取配置失败")}catch{throw new Error(`获取配置失败 (${l.status})`)}}const r=await l.json();if(!r.success)throw new Error(r.message||"获取配置失败");return r.config}async function lC(a,l){const r=await _e(`/api/webui/plugins/config/${a}`,{method:"PUT",headers:qs(),body:JSON.stringify({config:l})});if(!r.ok){const c=await r.json();throw new Error(c.detail||"保存配置失败")}return await r.json()}async function nC(a,l){const r=await _e(`/api/webui/plugins/config/${a}/raw`,{method:"PUT",headers:qs(),body:JSON.stringify({config:l})});if(!r.ok){const c=await r.json();throw new Error(c.detail||"保存配置失败")}return await r.json()}async function rC(a){const l=await _e(`/api/webui/plugins/config/${a}/reset`,{method:"POST",headers:qs()});if(!l.ok){const r=await l.json();throw new Error(r.detail||"重置配置失败")}return await l.json()}async function iC(a){const l=await _e(`/api/webui/plugins/config/${a}/toggle`,{method:"POST",headers:qs()});if(!l.ok){const r=await l.json();throw new Error(r.detail||"切换状态失败")}return await l.json()}const jc="https://maibot-plugin-stats.maibot-webui.workers.dev";async function mN(a){try{const l=await fetch(`${jc}/stats/${a}`);return l.ok?await l.json():(console.error("Failed to fetch plugin stats:",l.statusText),null)}catch(l){return console.error("Error fetching plugin stats:",l),null}}async function cC(a,l){try{const r=l||Sx(),c=await fetch(`${jc}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:a,user_id:r})}),d=await c.json();return c.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:c.ok?{success:!0,...d}:{success:!1,error:d.error||"点赞失败"}}catch(r){return console.error("Error liking plugin:",r),{success:!1,error:"网络错误"}}}async function oC(a,l){try{const r=l||Sx(),c=await fetch(`${jc}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:a,user_id:r})}),d=await c.json();return c.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:c.ok?{success:!0,...d}:{success:!1,error:d.error||"点踩失败"}}catch(r){return console.error("Error disliking plugin:",r),{success:!1,error:"网络错误"}}}async function dC(a,l,r,c){if(l<1||l>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const d=c||Sx(),u=await fetch(`${jc}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:a,rating:l,comment:r,user_id:d})}),h=await u.json();return u.status===429?{success:!1,error:"每天最多评分 3 次"}:u.ok?{success:!0,...h}:{success:!1,error:h.error||"评分失败"}}catch(d){return console.error("Error rating plugin:",d),{success:!1,error:"网络错误"}}}async function xN(a){try{const l=await fetch(`${jc}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:a})}),r=await l.json();return l.status===429?(console.warn("Download recording rate limited"),{success:!0}):l.ok?{success:!0,...r}:(console.error("Failed to record download:",r.error),{success:!1,error:r.error})}catch(l){return console.error("Error recording download:",l),{success:!1,error:"网络错误"}}}function uC(){const a=navigator,l=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,a.deviceMemory||0].join("|");let r=0;for(let c=0;c{const se=H.map(async Ee=>{try{const me=await mN(Ee.id);return{id:Ee.id,stats:me}}catch(me){return console.warn(`Failed to load stats for ${Ee.id}:`,me),{id:Ee.id,stats:null}}}),Ue=await Promise.all(se),ie={};Ue.forEach(({id:Ee,stats:me})=>{me&&(ie[Ee]=me)}),L(ie)};m.useEffect(()=>{let H=null,se=!1;return(async()=>{if(H=await eC(ie=>{se||(C(ie),ie.stage==="success"?setTimeout(()=>{se||C(null)},2e3):ie.stage==="error"&&(w(!1),A(ie.error||"加载失败")))},ie=>{console.error("WebSocket error:",ie),se||fe({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(ie=>{if(!H){ie();return}const Ee=()=>{H&&H.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),ie()):H&&H.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),ie()):setTimeout(Ee,100)};Ee()}),!se){const ie=await rN();U(ie),ie.installed||fe({title:"Git 未安装",description:ie.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!se){const ie=await iN();P(ie)}if(!se)try{w(!0),A(null);const ie=await Zk();if(!se){const Ee=await Dl();O(Ee);const me=ie.map(ze=>{const at=hn(ze.id,Ee),Pt=fn(ze.id,Ee);return{...ze,installed:at,installed_version:Pt}});for(const ze of Ee)!me.some(Pt=>Pt.id===ze.id)&&ze.manifest&&me.push({id:ze.id,manifest:{manifest_version:ze.manifest.manifest_version||1,name:ze.manifest.name,version:ze.manifest.version,description:ze.manifest.description||"",author:ze.manifest.author,license:ze.manifest.license||"Unknown",host_application:ze.manifest.host_application,homepage_url:ze.manifest.homepage_url,repository_url:ze.manifest.repository_url,keywords:ze.manifest.keywords||[],categories:ze.manifest.categories||[],default_locale:ze.manifest.default_locale||"zh-CN",locales_path:ze.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:ze.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});y(me),Te(me)}}catch(ie){if(!se){const Ee=ie instanceof Error?ie.message:"加载插件列表失败";A(Ee),fe({title:"加载失败",description:Ee,variant:"destructive"})}}finally{se||w(!1)}})(),()=>{se=!0,H&&H.close()}},[fe]);const q=H=>{if(!H.installed&&D&&!B(H))return e.jsxs(Ce,{variant:"destructive",className:"gap-1",children:[e.jsx(Ct,{className:"h-3 w-3"}),"不兼容"]});if(H.installed){const se=H.installed_version?.trim(),Ue=H.manifest.version?.trim();if(se!==Ue){const ie=se?.split(".").map(Number)||[0,0,0],Ee=Ue?.split(".").map(Number)||[0,0,0];for(let me=0;me<3;me++){if((Ee[me]||0)>(ie[me]||0))return e.jsxs(Ce,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[e.jsx(Ct,{className:"h-3 w-3"}),"可更新"]});if((Ee[me]||0)<(ie[me]||0))break}}return e.jsxs(Ce,{variant:"default",className:"gap-1",children:[e.jsx(bt,{className:"h-3 w-3"}),"已安装"]})}return null},B=H=>!D||!H.manifest?.host_application?!0:cN(H.manifest.host_application.min_version,H.manifest.host_application.max_version,D),z=H=>{if(!H.installed||!H.installed_version||!H.manifest?.version)return!1;const se=H.installed_version.trim(),Ue=H.manifest.version.trim();if(se===Ue)return!1;const ie=se.split(".").map(Number),Ee=Ue.split(".").map(Number);for(let me=0;me<3;me++){if((Ee[me]||0)>(ie[me]||0))return!0;if((Ee[me]||0)<(ie[me]||0))return!1}return!1},K=j.filter(H=>{if(!H.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",H.id),!1;const se=c===""||H.manifest.name?.toLowerCase().includes(c.toLowerCase())||H.manifest.description?.toLowerCase().includes(c.toLowerCase())||H.manifest.keywords&&H.manifest.keywords.some(me=>me.toLowerCase().includes(c.toLowerCase())),Ue=u==="all"||H.manifest.categories&&H.manifest.categories.includes(u);let ie=!0;f==="installed"?ie=H.installed===!0:f==="updates"&&(ie=H.installed===!0&&z(H));const Ee=!g||!D||B(H);return se&&Ue&&ie&&Ee}),Ae=H=>{if(!S?.installed){fe({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(D&&!B(H)){fe({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}de(H),ge("main"),Q(""),ue("preset"),Se(!1),Ne(!0)},ee=async()=>{if(!je)return;const H=$==="custom"?R:he;if(!H||H.trim()===""){fe({title:"分支名称不能为空",variant:"destructive"});return}try{Ne(!1),await oN(je.id,je.manifest.repository_url||"",H),xN(je.id).catch(Ue=>{console.warn("Failed to record download:",Ue)}),fe({title:"安装成功",description:`${je.manifest.name} 已成功安装`});const se=await Dl();O(se),y(Ue=>Ue.map(ie=>{if(ie.id===je.id){const Ee=hn(ie.id,se),me=fn(ie.id,se);return{...ie,installed:Ee,installed_version:me}}return ie}))}catch(se){fe({title:"安装失败",description:se instanceof Error?se.message:"未知错误",variant:"destructive"})}finally{de(null)}},Y=async H=>{try{await dN(H.id),fe({title:"卸载成功",description:`${H.manifest.name} 已成功卸载`});const se=await Dl();O(se),y(Ue=>Ue.map(ie=>{if(ie.id===H.id){const Ee=hn(ie.id,se),me=fn(ie.id,se);return{...ie,installed:Ee,installed_version:me}}return ie}))}catch(se){fe({title:"卸载失败",description:se instanceof Error?se.message:"未知错误",variant:"destructive"})}},$e=async H=>{if(!S?.installed){fe({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const se=await uN(H.id,H.manifest.repository_url||"","main");fe({title:"更新成功",description:`${H.manifest.name} 已从 ${se.old_version} 更新到 ${se.new_version}`});const Ue=await Dl();O(Ue),y(ie=>ie.map(Ee=>{if(Ee.id===H.id){const me=hn(Ee.id,Ue),ze=fn(Ee.id,Ue);return{...Ee,installed:me,installed_version:ze}}return Ee}))}catch(se){fe({title:"更新失败",description:se instanceof Error?se.message:"未知错误",variant:"destructive"})}};return e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(_,{variant:"outline",onClick:()=>l(),disabled:r,children:[e.jsx(cv,{className:`h-4 w-4 mr-2 ${r?"animate-spin":""}`}),"重启麦麦"]}),e.jsxs(_,{onClick:()=>a({to:"/plugin-mirrors"}),children:[e.jsx(I_,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]})]}),e.jsx(ke,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:e.jsx(Me,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Vt,{className:"h-4 w-4 text-blue-600 flex-shrink-0"}),e.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["安装、卸载或更新插件后,需要",e.jsx("span",{className:"font-semibold",children:"重启麦麦"}),"才能使更改生效"]})]})})}),S&&!S.installed&&e.jsxs(ke,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[e.jsx(Re,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(It,{className:"h-5 w-5 text-orange-600"}),e.jsxs("div",{children:[e.jsx(De,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),e.jsx(is,{className:"text-orange-800 dark:text-orange-200",children:S.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),e.jsx(Me,{children:e.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",e.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),e.jsx(ke,{className:"p-4",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(At,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ae,{placeholder:"搜索插件...",value:c,onChange:H=>d(H.target.value),className:"pl-9"})]}),e.jsxs(Pe,{value:u,onValueChange:h,children:[e.jsx(Be,{className:"w-full sm:w-[200px]",children:e.jsx(Fe,{placeholder:"选择分类"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"全部分类"}),e.jsx(W,{value:"Group Management",children:"群组管理"}),e.jsx(W,{value:"Entertainment & Interaction",children:"娱乐互动"}),e.jsx(W,{value:"Utility Tools",children:"实用工具"}),e.jsx(W,{value:"Content Generation",children:"内容生成"}),e.jsx(W,{value:"Multimedia",children:"多媒体"}),e.jsx(W,{value:"External Integration",children:"外部集成"}),e.jsx(W,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),e.jsx(W,{value:"Other",children:"其他"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Js,{id:"compatible-only",checked:g,onCheckedChange:H=>b(H===!0)}),e.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),e.jsx(ea,{value:f,onValueChange:p,className:"w-full",children:e.jsxs(Gt,{className:"grid w-full grid-cols-3",children:[e.jsxs(Xe,{value:"all",children:["全部插件 (",j.filter(H=>{if(!H.manifest)return!1;const se=c===""||H.manifest.name?.toLowerCase().includes(c.toLowerCase())||H.manifest.description?.toLowerCase().includes(c.toLowerCase())||H.manifest.keywords&&H.manifest.keywords.some(Ee=>Ee.toLowerCase().includes(c.toLowerCase())),Ue=u==="all"||H.manifest.categories&&H.manifest.categories.includes(u),ie=!g||!D||B(H);return se&&Ue&&ie}).length,")"]}),e.jsxs(Xe,{value:"installed",children:["已安装 (",j.filter(H=>{if(!H.manifest)return!1;const se=c===""||H.manifest.name?.toLowerCase().includes(c.toLowerCase())||H.manifest.description?.toLowerCase().includes(c.toLowerCase())||H.manifest.keywords&&H.manifest.keywords.some(Ee=>Ee.toLowerCase().includes(c.toLowerCase())),Ue=u==="all"||H.manifest.categories&&H.manifest.categories.includes(u),ie=!g||!D||B(H);return H.installed&&se&&Ue&&ie}).length,")"]}),e.jsxs(Xe,{value:"updates",children:["可更新 (",j.filter(H=>{if(!H.manifest)return!1;const se=c===""||H.manifest.name?.toLowerCase().includes(c.toLowerCase())||H.manifest.description?.toLowerCase().includes(c.toLowerCase())||H.manifest.keywords&&H.manifest.keywords.some(Ee=>Ee.toLowerCase().includes(c.toLowerCase())),Ue=u==="all"||H.manifest.categories&&H.manifest.categories.includes(u),ie=!g||!D||B(H);return H.installed&&z(H)&&se&&Ue&&ie}).length,")"]})]})}),E&&E.stage==="loading"&&E.operation==="fetch"&&e.jsx(ke,{className:"p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Os,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{className:"text-sm font-medium",children:"加载插件列表"})]}),e.jsxs("span",{className:"text-sm font-medium",children:[E.progress,"%"]})]}),e.jsx(Xn,{value:E.progress,className:"h-2"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:E.message}),E.total_plugins>0&&e.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",E.loaded_plugins," / ",E.total_plugins," 个插件"]})]})}),E&&E.stage==="error"&&E.error&&e.jsx(ke,{className:"border-destructive bg-destructive/10",children:e.jsx(Re,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(It,{className:"h-5 w-5 text-destructive"}),e.jsxs("div",{children:[e.jsx(De,{className:"text-lg text-destructive",children:"加载失败"}),e.jsx(is,{className:"text-destructive/80",children:E.error})]})]})})}),N?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Os,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):M?e.jsx(ke,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(It,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:M}),e.jsx(_,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):K.length===0?e.jsx(ke,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(At,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:c||u!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:K.map(H=>e.jsxs(ke,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[e.jsxs(Re,{children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx(De,{className:"text-xl",children:H.manifest?.name||H.id}),e.jsxs("div",{className:"flex flex-col gap-1",children:[H.manifest?.categories&&H.manifest.categories[0]&&e.jsx(Ce,{variant:"secondary",className:"text-xs whitespace-nowrap",children:mC[H.manifest.categories[0]]||H.manifest.categories[0]}),q(H)]})]}),e.jsx(is,{className:"line-clamp-2",children:H.manifest?.description||"无描述"})]}),e.jsx(Me,{className:"flex-1",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Wt,{className:"h-4 w-4"}),e.jsx("span",{children:(J[H.id]?.downloads??H.downloads??0).toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(mn,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:(J[H.id]?.rating??H.rating??0).toFixed(1)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[H.manifest?.keywords&&H.manifest.keywords.slice(0,3).map(se=>e.jsx(Ce,{variant:"outline",className:"text-xs",children:se},se)),H.manifest?.keywords&&H.manifest.keywords.length>3&&e.jsxs(Ce,{variant:"outline",className:"text-xs",children:["+",H.manifest.keywords.length-3]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[e.jsxs("div",{children:["v",H.manifest?.version||"unknown"," · ",H.manifest?.author?.name||"Unknown"]}),H.manifest?.host_application&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"支持:"}),e.jsxs("span",{className:"font-medium",children:[H.manifest.host_application.min_version,H.manifest.host_application.max_version?` - ${H.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),e.jsx(id,{className:"pt-4",children:e.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>a({to:"/plugin-detail",search:{pluginId:H.id}}),children:"查看详情"}),H.installed?z(H)?e.jsxs(_,{size:"sm",disabled:!S?.installed,title:S?.installed?void 0:"Git 未安装",onClick:()=>$e(H),children:[e.jsx(xt,{className:"h-4 w-4 mr-1"}),"更新"]}):e.jsxs(_,{variant:"destructive",size:"sm",disabled:!S?.installed,title:S?.installed?void 0:"Git 未安装",onClick:()=>Y(H),children:[e.jsx(ls,{className:"h-4 w-4 mr-1"}),"卸载"]}):e.jsxs(_,{size:"sm",disabled:!S?.installed||E?.operation==="install"||D!==null&&!B(H),title:S?.installed?D!==null&&!B(H)?`不兼容当前版本 (需要 ${H.manifest?.host_application?.min_version||"未知"}${H.manifest?.host_application?.max_version?` - ${H.manifest.host_application.max_version}`:"+"},当前 ${D?.version})`:void 0:"Git 未安装",onClick:()=>Ae(H),children:[e.jsx(Wt,{className:"h-4 w-4 mr-1"}),E?.operation==="install"&&E?.plugin_id===H.id?"安装中...":"安装"]})]})}),E&&(E.stage==="loading"||E.stage==="success"||E.stage==="error")&&E.operation!=="fetch"&&E.plugin_id===H.id&&e.jsx("div",{className:"px-6 pb-4 -mt-2",children:e.jsxs("div",{className:`space-y-2 p-3 rounded-lg border ${E.stage==="success"?"bg-green-50 dark:bg-green-950/20 border-green-200 dark:border-green-900":E.stage==="error"?"bg-red-50 dark:bg-red-950/20 border-red-200 dark:border-red-900":"bg-muted/50"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[E.stage==="loading"?e.jsx(Os,{className:"h-3 w-3 animate-spin"}):E.stage==="success"?e.jsx(bt,{className:"h-3 w-3 text-green-600"}):e.jsx(Ct,{className:"h-3 w-3 text-red-600"}),e.jsx("span",{className:`text-xs font-medium ${E.stage==="success"?"text-green-700 dark:text-green-300":E.stage==="error"?"text-red-700 dark:text-red-300":""}`,children:E.stage==="loading"?e.jsxs(e.Fragment,{children:[E.operation==="install"&&"正在安装",E.operation==="uninstall"&&"正在卸载",E.operation==="update"&&"正在更新"]}):E.stage==="success"?e.jsxs(e.Fragment,{children:[E.operation==="install"&&"安装完成",E.operation==="uninstall"&&"卸载完成",E.operation==="update"&&"更新完成"]}):e.jsxs(e.Fragment,{children:[E.operation==="install"&&"安装失败",E.operation==="uninstall"&&"卸载失败",E.operation==="update"&&"更新失败"]})})]}),E.stage!=="error"&&e.jsxs("span",{className:`text-xs font-medium ${E.stage==="success"?"text-green-700 dark:text-green-300":""}`,children:[E.progress,"%"]})]}),E.stage!=="error"&&e.jsx(Xn,{value:E.progress,className:`h-1.5 ${E.stage==="success"?"[&>div]:bg-green-500":""}`}),e.jsx("div",{className:`text-xs ${E.stage==="success"?"text-green-600 dark:text-green-400 truncate":E.stage==="error"?"text-red-600 dark:text-red-400":"text-muted-foreground truncate"}`,children:E.stage==="error"?E.error||E.message||"操作失败":E.message})]})})]},H.id))}),e.jsx(Fs,{open:oe,onOpenChange:Ne,children:e.jsxs(Us,{children:[e.jsxs($s,{children:[e.jsx(Bs,{children:"安装插件"}),e.jsxs(Xs,{children:["安装 ",je?.manifest.name]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["版本: ",je?.manifest.version]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["作者: ",typeof je?.manifest.author=="string"?je.manifest.author:je?.manifest.author?.name]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Js,{id:"advanced-options",checked:G,onCheckedChange:H=>Se(H)}),e.jsx("label",{htmlFor:"advanced-options",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"高级选项"})]}),G&&e.jsx("div",{className:"space-y-4 p-4 border rounded-lg",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"分支选择"}),e.jsxs(ea,{value:$,onValueChange:H=>ue(H),children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2",children:[e.jsx(Xe,{value:"preset",className:"text-xs",children:"预设分支"}),e.jsx(Xe,{value:"custom",className:"text-xs",children:"自定义分支"})]}),$==="preset"&&e.jsx("div",{className:"mt-3",children:e.jsxs(Pe,{value:he,onValueChange:ge,children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择分支"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"main",children:"main (默认)"}),e.jsx(W,{value:"master",children:"master"}),e.jsx(W,{value:"dev",children:"dev (开发版)"}),e.jsx(W,{value:"develop",children:"develop"}),e.jsx(W,{value:"beta",children:"beta (测试版)"}),e.jsx(W,{value:"stable",children:"stable (稳定版)"})]})]})}),$==="custom"&&e.jsxs("div",{className:"space-y-2 mt-3",children:[e.jsx("input",{type:"text",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",placeholder:"输入分支名称,例如: feature/new-feature",value:R,onChange:H=>Q(H.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"输入 Git 分支名称、标签或提交哈希"})]})]})]})}),!G&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"将从默认分支 (main) 安装插件"})]}),e.jsxs(nt,{children:[e.jsx(_,{variant:"outline",onClick:()=>Ne(!1),children:"取消"}),e.jsxs(_,{onClick:ee,children:[e.jsx(Wt,{className:"h-4 w-4 mr-2"}),"安装"]})]})]})}),e.jsx(er,{})]})})}function fC(){return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(ov,{className:"h-8 w-8",strokeWidth:2}),"模型分配预设市场"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"浏览和下载社区共享的模型分配预设配置"})]})})}),e.jsx(Ze,{className:"flex-1",children:e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-12rem)]",children:e.jsxs(ke,{className:"max-w-2xl w-full border-dashed",children:[e.jsxs(Re,{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(ra,{className:"h-16 w-16 text-muted-foreground"})}),e.jsx(De,{className:"text-2xl",children:"功能开发中"}),e.jsx(is,{className:"text-base",children:"模型分配预设市场功能正在开发中,敬请期待!"})]}),e.jsx(Me,{children:e.jsxs("div",{className:"space-y-3 text-sm text-muted-foreground",children:[e.jsx("p",{className:"font-medium text-foreground",children:"📦 即将推出的功能:"}),e.jsxs("ul",{className:"space-y-2 ml-6",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"浏览社区共享的模型分配预设配置"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"一键下载和应用预设配置"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"分享自己的模型分配方案"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"预设配置评分和评论系统"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"根据使用场景智能推荐配置"})]})]})]})})]})})})]})}function pC({field:a,value:l,onChange:r}){const[c,d]=m.useState(!1);switch(a.ui_type){case"switch":return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:a.label}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]}),e.jsx(Ge,{checked:!!l,onCheckedChange:r,disabled:a.disabled})]});case"number":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsx(ae,{type:"number",value:l??a.default,onChange:u=>r(parseFloat(u.target.value)||0),min:a.min,max:a.max,step:a.step??1,placeholder:a.placeholder,disabled:a.disabled}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"slider":return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:a.label}),e.jsx("span",{className:"text-sm text-muted-foreground",children:l??a.default})]}),e.jsx(Qa,{value:[l??a.default],onValueChange:u=>r(u[0]),min:a.min??0,max:a.max??100,step:a.step??1,disabled:a.disabled}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"select":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsxs(Pe,{value:String(l??a.default),onValueChange:r,disabled:a.disabled,children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:a.placeholder??"请选择"})}),e.jsx(Ie,{children:a.choices?.map(u=>e.jsx(W,{value:String(u),children:String(u)},String(u)))})]}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"textarea":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsx(rt,{value:l??a.default,onChange:u=>r(u.target.value),placeholder:a.placeholder,rows:a.rows??3,disabled:a.disabled}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"password":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsxs("div",{className:"relative",children:[e.jsx(ae,{type:c?"text":"password",value:l??"",onChange:u=>r(u.target.value),placeholder:a.placeholder,disabled:a.disabled,className:"pr-10"}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3",onClick:()=>d(!c),children:c?e.jsx(nc,{className:"h-4 w-4"}):e.jsx(ia,{className:"h-4 w-4"})})]}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"list":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsx(bS,{value:Array.isArray(l)?l:[],onChange:u=>r(u),itemType:a.item_type??"string",itemFields:a.item_fields,minItems:a.min_items,maxItems:a.max_items,disabled:a.disabled,placeholder:a.placeholder}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"text":default:return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsx(ae,{type:"text",value:l??a.default??"",onChange:u=>r(u.target.value),placeholder:a.placeholder,maxLength:a.max_length,disabled:a.disabled}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]})}}function Zg({section:a,config:l,onChange:r}){const[c,d]=m.useState(!a.collapsed),u=Object.entries(a.fields).filter(([,h])=>!h.hidden).sort(([,h],[,f])=>h.order-f.order);return e.jsx(uc,{open:c,onOpenChange:d,children:e.jsxs(ke,{children:[e.jsx(mc,{asChild:!0,children:e.jsxs(Re,{className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[c?e.jsx(za,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(sa,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(De,{className:"text-lg",children:a.title})]}),e.jsxs(Ce,{variant:"secondary",className:"text-xs",children:[u.length," 项"]})]}),a.description&&e.jsx(is,{className:"ml-6",children:a.description})]})}),e.jsx(xc,{children:e.jsx(Me,{className:"space-y-4 pt-0",children:u.map(([h,f])=>e.jsx(pC,{field:f,value:l[a.name]?.[h],onChange:p=>r(a.name,h,p),sectionName:a.name},h))})})]})})}function gC({plugin:a,onBack:l}){const{toast:r}=Ws(),{triggerRestart:c,isRestarting:d}=yn(),[u,h]=m.useState("visual"),[f,p]=m.useState(null),[g,b]=m.useState({}),[j,y]=m.useState({}),[N,w]=m.useState(""),[M,A]=m.useState(""),[S,U]=m.useState(!0),[E,C]=m.useState(!1),[D,P]=m.useState(!1),[O,J]=m.useState(!1),[L,oe]=m.useState(!1),Ne=m.useCallback(async()=>{U(!0);try{const[$,ue,G]=await Promise.all([sC(a.id),tC(a.id),aC(a.id)]);p($),b(ue),y(JSON.parse(JSON.stringify(ue))),w(G),A(G)}catch($){r({title:"加载配置失败",description:$ instanceof Error?$.message:"未知错误",variant:"destructive"})}finally{U(!1)}},[a.id,r]);m.useEffect(()=>{Ne()},[Ne]),m.useEffect(()=>{P(u==="visual"?JSON.stringify(g)!==JSON.stringify(j):N!==M)},[g,j,N,M,u]);const je=($,ue,G)=>{b(Se=>({...Se,[$]:{...Se[$]||{},[ue]:G}}))},de=async()=>{C(!0);try{if(u==="source"){try{vx(N)}catch($){J(!0),r({title:"TOML 格式错误",description:$ instanceof Error?$.message:"无法解析 TOML 配置,请检查语法",variant:"destructive"}),C(!1);return}await nC(a.id,N),A(N),J(!1)}else await lC(a.id,g),y(JSON.parse(JSON.stringify(g)));r({title:"配置已保存",description:"更改将在插件重新加载后生效"})}catch($){r({title:"保存失败",description:$ instanceof Error?$.message:"未知错误",variant:"destructive"})}finally{C(!1)}},he=async()=>{try{await rC(a.id),r({title:"配置已重置",description:"下次加载插件时将使用默认配置"}),oe(!1),Ne()}catch($){r({title:"重置失败",description:$ instanceof Error?$.message:"未知错误",variant:"destructive"})}},ge=async()=>{try{const $=await iC(a.id);r({title:$.message,description:$.note}),Ne()}catch($){r({title:"切换状态失败",description:$ instanceof Error?$.message:"未知错误",variant:"destructive"})}};if(S)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(Os,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(!f)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 space-y-4",children:[e.jsx(Ct,{className:"h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"无法加载配置"}),e.jsxs(_,{onClick:l,variant:"outline",children:[e.jsx(Ma,{className:"h-4 w-4 mr-2"}),"返回"]})]});const R=Object.values(f.sections).sort(($,ue)=>$.order-ue.order),Q=g.plugin?.enabled!==!1;return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:l,children:e.jsx(Ma,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:f.plugin_info.name||a.manifest.name}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(Ce,{variant:Q?"default":"secondary",children:Q?"已启用":"已禁用"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["v",f.plugin_info.version||a.manifest.version]})]})]})]}),e.jsxs("div",{className:"flex gap-2 ml-10 sm:ml-0",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>h(u==="visual"?"source":"visual"),children:u==="visual"?e.jsxs(e.Fragment,{children:[e.jsx(nv,{className:"h-4 w-4 mr-2"}),"源代码"]}):e.jsxs(e.Fragment,{children:[e.jsx(lv,{className:"h-4 w-4 mr-2"}),"可视化"]})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>c(),disabled:d,children:[e.jsx(cv,{className:`h-4 w-4 mr-2 ${d?"animate-spin":""}`}),"重启麦麦"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:ge,children:[e.jsx(hc,{className:"h-4 w-4 mr-2"}),Q?"禁用":"启用"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>oe(!0),children:[e.jsx(lc,{className:"h-4 w-4 mr-2"}),"重置"]}),e.jsxs(_,{size:"sm",onClick:de,disabled:!D||E,children:[E?e.jsx(Os,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(fc,{className:"h-4 w-4 mr-2"}),"保存"]})]})]}),D&&e.jsx(ke,{className:"border-orange-200 bg-orange-50 dark:bg-orange-950/20 dark:border-orange-900",children:e.jsx(Me,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Vt,{className:"h-4 w-4 text-orange-600"}),e.jsx("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:"有未保存的更改"})]})})}),u==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(it,{children:[e.jsx(Ct,{className:"h-4 w-4"}),e.jsxs(ct,{children:[e.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。保存时会验证格式,只有格式正确才能保存。",O&&e.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),e.jsx(Fv,{value:N,onChange:$=>{w($),O&&J(!1)},language:"toml",theme:"dark",height:"calc(100vh - 350px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),u==="visual"&&e.jsxs(e.Fragment,{children:[e.jsxs(it,{children:[e.jsx(Vt,{className:"h-4 w-4"}),e.jsxs(ct,{children:[e.jsx("strong",{children:"提示:"}),"如果插件当前未加载或未启用,WebUI 适配器的高级插件可视化编辑功能可能会不可用。 请确保插件已启用并成功加载后,再进行配置编辑。"]})]}),f.layout.type==="tabs"&&f.layout.tabs.length>0?e.jsxs(ea,{defaultValue:f.layout.tabs[0]?.id,children:[e.jsx(Gt,{children:f.layout.tabs.map($=>e.jsxs(Xe,{value:$.id,children:[$.title,$.badge&&e.jsx(Ce,{variant:"secondary",className:"ml-2 text-xs",children:$.badge})]},$.id))}),f.layout.tabs.map($=>e.jsx(vs,{value:$.id,className:"space-y-4 mt-4",children:$.sections.map(ue=>{const G=f.sections[ue];return G?e.jsx(Zg,{section:G,config:g,onChange:je},ue):null})},$.id))]}):e.jsx("div",{className:"space-y-4",children:R.map($=>e.jsx(Zg,{section:$,config:g,onChange:je},$.name))})]}),e.jsx(Fs,{open:L,onOpenChange:oe,children:e.jsxs(Us,{children:[e.jsxs($s,{children:[e.jsx(Bs,{children:"确认重置配置"}),e.jsx(Xs,{children:"这将删除当前配置文件,下次加载插件时将使用默认配置。此操作不可撤销。"})]}),e.jsxs(nt,{children:[e.jsx(_,{variant:"outline",onClick:()=>oe(!1),children:"取消"}),e.jsx(_,{variant:"destructive",onClick:he,children:"确认重置"})]})]})})]})}function jC(){return e.jsx(Wn,{children:e.jsx(vC,{})})}function vC(){const{toast:a}=Ws(),[l,r]=m.useState([]),[c,d]=m.useState(!0),[u,h]=m.useState(""),[f,p]=m.useState(null),g=async()=>{d(!0);try{const w=await Dl();r(w)}catch(w){a({title:"加载插件列表失败",description:w instanceof Error?w.message:"未知错误",variant:"destructive"})}finally{d(!1)}};m.useEffect(()=>{g()},[]);const j=l.filter(w=>{const M=u.toLowerCase();return w.id.toLowerCase().includes(M)||w.manifest.name.toLowerCase().includes(M)||w.manifest.description?.toLowerCase().includes(M)}).filter((w,M,A)=>M===A.findIndex(S=>S.id===w.id)),y=l.length,N=0;return f?e.jsxs(e.Fragment,{children:[e.jsx(Ze,{className:"h-full",children:e.jsx("div",{className:"p-4 sm:p-6",children:e.jsx(gC,{plugin:f,onBack:()=>p(null)})})}),e.jsx(er,{})]}):e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:g,children:[e.jsx(xt,{className:`h-4 w-4 mr-2 ${c?"animate-spin":""}`}),"刷新"]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-3",children:[e.jsxs(ke,{children:[e.jsxs(Re,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(De,{className:"text-sm font-medium",children:"已安装插件"}),e.jsx(ra,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Me,{children:[e.jsx("div",{className:"text-2xl font-bold",children:l.length}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:c?"正在加载...":"个插件"})]})]}),e.jsxs(ke,{children:[e.jsxs(Re,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(De,{className:"text-sm font-medium",children:"已启用"}),e.jsx(bt,{className:"h-4 w-4 text-green-600"})]}),e.jsxs(Me,{children:[e.jsx("div",{className:"text-2xl font-bold",children:y}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),e.jsxs(ke,{children:[e.jsxs(Re,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(De,{className:"text-sm font-medium",children:"已禁用"}),e.jsx(Ct,{className:"h-4 w-4 text-orange-600"})]}),e.jsxs(Me,{children:[e.jsx("div",{className:"text-2xl font-bold",children:N}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(At,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ae,{placeholder:"搜索插件...",value:u,onChange:w=>h(w.target.value),className:"pl-9"})]}),e.jsxs(ke,{children:[e.jsxs(Re,{children:[e.jsx(De,{children:"已安装的插件"}),e.jsx(is,{children:"点击插件查看和编辑配置"})]}),e.jsx(Me,{children:c?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Os,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):j.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[e.jsx(ra,{className:"h-16 w-16 text-muted-foreground/50"}),e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:u?"没有找到匹配的插件":"暂无已安装的插件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:u?"尝试其他搜索关键词":"前往插件市场安装插件"})]})]}):e.jsx("div",{className:"space-y-2",children:j.map(w=>e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>p(w),children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:e.jsx(ra,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-medium truncate",children:w.manifest.name}),e.jsxs(Ce,{variant:"secondary",className:"text-xs flex-shrink-0",children:["v",w.manifest.version]})]}),e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:w.manifest.description||"暂无描述"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(_,{variant:"ghost",size:"sm",children:e.jsx(vn,{className:"h-4 w-4"})}),e.jsx(sa,{className:"h-4 w-4 text-muted-foreground"})]})]},w.id))})})]})]})})}function NC(){const a=ca(),{toast:l}=Ws(),[r,c]=m.useState([]),[d,u]=m.useState(!0),[h,f]=m.useState(null),[p,g]=m.useState(null),[b,j]=m.useState(!1),[y,N]=m.useState(!1),[w,M]=m.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),A=m.useCallback(async()=>{try{u(!0),f(null);const O=await _e("/api/webui/plugins/mirrors");if(!O.ok)throw new Error("获取镜像源列表失败");const J=await O.json();c(J.mirrors||[])}catch(O){const J=O instanceof Error?O.message:"加载镜像源失败";f(J),l({title:"加载失败",description:J,variant:"destructive"})}finally{u(!1)}},[l]);m.useEffect(()=>{A()},[A]);const S=async()=>{try{const O=await _e("/api/webui/plugins/mirrors",{method:"POST",body:JSON.stringify(w)});if(!O.ok){const J=await O.json();throw new Error(J.detail||"添加镜像源失败")}l({title:"添加成功",description:"镜像源已添加"}),j(!1),M({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),A()}catch(O){l({title:"添加失败",description:O instanceof Error?O.message:"未知错误",variant:"destructive"})}},U=async()=>{if(p)try{if(!(await _e(`/api/webui/plugins/mirrors/${p.id}`,{method:"PUT",body:JSON.stringify({name:w.name,raw_prefix:w.raw_prefix,clone_prefix:w.clone_prefix,enabled:w.enabled,priority:w.priority})})).ok)throw new Error("更新镜像源失败");l({title:"更新成功",description:"镜像源已更新"}),N(!1),g(null),A()}catch(O){l({title:"更新失败",description:O instanceof Error?O.message:"未知错误",variant:"destructive"})}},E=async O=>{if(confirm("确定要删除这个镜像源吗?"))try{if(!(await _e(`/api/webui/plugins/mirrors/${O}`,{method:"DELETE"})).ok)throw new Error("删除镜像源失败");l({title:"删除成功",description:"镜像源已删除"}),A()}catch(J){l({title:"删除失败",description:J instanceof Error?J.message:"未知错误",variant:"destructive"})}},C=async O=>{try{if(!(await _e(`/api/webui/plugins/mirrors/${O.id}`,{method:"PUT",body:JSON.stringify({enabled:!O.enabled})})).ok)throw new Error("更新状态失败");A()}catch(J){l({title:"更新失败",description:J instanceof Error?J.message:"未知错误",variant:"destructive"})}},D=O=>{g(O),M({id:O.id,name:O.name,raw_prefix:O.raw_prefix,clone_prefix:O.clone_prefix,enabled:O.enabled,priority:O.priority}),N(!0)},P=async(O,J)=>{const L=J==="up"?O.priority-1:O.priority+1;if(!(L<1))try{if(!(await _e(`/api/webui/plugins/mirrors/${O.id}`,{method:"PUT",body:JSON.stringify({priority:L})})).ok)throw new Error("更新优先级失败");A()}catch(oe){l({title:"更新失败",description:oe instanceof Error?oe.message:"未知错误",variant:"destructive"})}};return e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>a({to:"/plugins"}),children:e.jsx(Ma,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),e.jsxs(_,{onClick:()=>j(!0),children:[e.jsx(Ys,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),d?e.jsx(ke,{className:"p-6",children:e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Os,{className:"h-8 w-8 animate-spin text-primary"})})}):h?e.jsx(ke,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(It,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:h}),e.jsx(_,{onClick:A,children:"重新加载"})]})}):e.jsxs(ke,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(Ul,{children:[e.jsx($l,{children:e.jsxs(ht,{children:[e.jsx(ss,{children:"状态"}),e.jsx(ss,{children:"名称"}),e.jsx(ss,{children:"ID"}),e.jsx(ss,{children:"优先级"}),e.jsx(ss,{className:"text-right",children:"操作"})]})}),e.jsx(Bl,{children:r.map(O=>e.jsxs(ht,{children:[e.jsx(Ye,{children:e.jsx(Ge,{checked:O.enabled,onCheckedChange:()=>C(O)})}),e.jsx(Ye,{children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:O.name}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",O.raw_prefix]})]})}),e.jsx(Ye,{children:e.jsx(Ce,{variant:"outline",children:O.id})}),e.jsx(Ye,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono",children:O.priority}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(_,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>P(O,"up"),disabled:O.priority===1,children:e.jsx(Qr,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>P(O,"down"),children:e.jsx(za,{className:"h-3 w-3"})})]})]})}),e.jsx(Ye,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>D(O),children:e.jsx(Kn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>E(O.id),children:e.jsx(ls,{className:"h-4 w-4 text-destructive"})})]})})]},O.id))})]})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:r.map(O=>e.jsx(ke,{className:"p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-semibold",children:O.name}),O.enabled&&e.jsx(Ce,{variant:"default",className:"text-xs",children:"启用"})]}),e.jsx(Ce,{variant:"outline",className:"mt-1 text-xs",children:O.id})]}),e.jsx(Ge,{checked:O.enabled,onCheckedChange:()=>C(O)})]}),e.jsxs("div",{className:"text-sm space-y-1",children:[e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"Raw: "}),e.jsx("span",{className:"break-all",children:O.raw_prefix})]}),e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"优先级: "}),e.jsx("span",{className:"font-mono",children:O.priority})]})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[e.jsxs(_,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>D(O),children:[e.jsx(Kn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>P(O,"up"),disabled:O.priority===1,children:e.jsx(Qr,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>P(O,"down"),children:e.jsx(za,{className:"h-4 w-4"})}),e.jsx(_,{variant:"destructive",size:"sm",onClick:()=>E(O.id),children:e.jsx(ls,{className:"h-4 w-4"})})]})]})},O.id))})]}),e.jsx(Fs,{open:b,onOpenChange:j,children:e.jsxs(Us,{className:"max-w-lg",children:[e.jsxs($s,{children:[e.jsx(Bs,{children:"添加镜像源"}),e.jsx(Xs,{children:"添加新的 Git 镜像源配置"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-id",children:"镜像源 ID *"}),e.jsx(ae,{id:"add-id",placeholder:"例如: my-mirror",value:w.id,onChange:O=>M({...w,id:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-name",children:"名称 *"}),e.jsx(ae,{id:"add-name",placeholder:"例如: 我的镜像源",value:w.name,onChange:O=>M({...w,name:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),e.jsx(ae,{id:"add-raw",placeholder:"https://example.com/raw",value:w.raw_prefix,onChange:O=>M({...w,raw_prefix:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-clone",children:"克隆前缀 *"}),e.jsx(ae,{id:"add-clone",placeholder:"https://example.com/clone",value:w.clone_prefix,onChange:O=>M({...w,clone_prefix:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-priority",children:"优先级"}),e.jsx(ae,{id:"add-priority",type:"number",min:"1",value:w.priority,onChange:O=>M({...w,priority:parseInt(O.target.value)||1})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"add-enabled",checked:w.enabled,onCheckedChange:O=>M({...w,enabled:O})}),e.jsx(T,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),e.jsxs(nt,{children:[e.jsx(_,{variant:"outline",onClick:()=>j(!1),children:"取消"}),e.jsx(_,{onClick:S,children:"添加"})]})]})}),e.jsx(Fs,{open:y,onOpenChange:N,children:e.jsxs(Us,{className:"max-w-lg",children:[e.jsxs($s,{children:[e.jsx(Bs,{children:"编辑镜像源"}),e.jsx(Xs,{children:"修改镜像源配置"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"镜像源 ID"}),e.jsx(ae,{value:w.id,disabled:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-name",children:"名称 *"}),e.jsx(ae,{id:"edit-name",value:w.name,onChange:O=>M({...w,name:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),e.jsx(ae,{id:"edit-raw",value:w.raw_prefix,onChange:O=>M({...w,raw_prefix:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-clone",children:"克隆前缀 *"}),e.jsx(ae,{id:"edit-clone",value:w.clone_prefix,onChange:O=>M({...w,clone_prefix:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-priority",children:"优先级"}),e.jsx(ae,{id:"edit-priority",type:"number",min:"1",value:w.priority,onChange:O=>M({...w,priority:parseInt(O.target.value)||1})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"edit-enabled",checked:w.enabled,onCheckedChange:O=>M({...w,enabled:O})}),e.jsx(T,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),e.jsxs(nt,{children:[e.jsx(_,{variant:"outline",onClick:()=>N(!1),children:"取消"}),e.jsx(_,{onClick:U,children:"保存"})]})]})})]})})}function bC({pluginId:a,compact:l=!1}){const[r,c]=m.useState(null),[d,u]=m.useState(!0),[h,f]=m.useState(0),[p,g]=m.useState(""),[b,j]=m.useState(!1),{toast:y}=Ws(),N=async()=>{u(!0);const S=await mN(a);S&&c(S),u(!1)};m.useEffect(()=>{N()},[a]);const w=async()=>{const S=await cC(a);S.success?(y({title:"已点赞",description:"感谢你的支持!"}),N()):y({title:"点赞失败",description:S.error||"未知错误",variant:"destructive"})},M=async()=>{const S=await oC(a);S.success?(y({title:"已反馈",description:"感谢你的反馈!"}),N()):y({title:"操作失败",description:S.error||"未知错误",variant:"destructive"})},A=async()=>{if(h===0){y({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const S=await dC(a,h,p||void 0);S.success?(y({title:"评分成功",description:"感谢你的评价!"}),j(!1),f(0),g(""),N()):y({title:"评分失败",description:S.error||"未知错误",variant:"destructive"})};return d?e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Wt,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(mn,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]})]}):r?l?e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${r.downloads.toLocaleString()}`,children:[e.jsx(Wt,{className:"h-4 w-4"}),e.jsx("span",{children:r.downloads.toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${r.rating.toFixed(1)} (${r.rating_count} 条评价)`,children:[e.jsx(mn,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:r.rating.toFixed(1)})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${r.likes}`,children:[e.jsx(Em,{className:"h-4 w-4"}),e.jsx("span",{children:r.likes})]})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(Wt,{className:"h-5 w-5 text-muted-foreground mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:r.downloads.toLocaleString()}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(mn,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),e.jsx("span",{className:"text-2xl font-bold",children:r.rating.toFixed(1)}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.rating_count," 条评价"]})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(Em,{className:"h-5 w-5 text-green-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:r.likes}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(Sg,{className:"h-5 w-5 text-red-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:r.dislikes}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:w,children:[e.jsx(Em,{className:"h-4 w-4 mr-1"}),"点赞"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:M,children:[e.jsx(Sg,{className:"h-4 w-4 mr-1"}),"点踩"]}),e.jsxs(Fs,{open:b,onOpenChange:j,children:[e.jsx(cd,{asChild:!0,children:e.jsxs(_,{variant:"default",size:"sm",children:[e.jsx(mn,{className:"h-4 w-4 mr-1"}),"评分"]})}),e.jsxs(Us,{children:[e.jsxs($s,{children:[e.jsx(Bs,{children:"为插件评分"}),e.jsx(Xs,{children:"分享你的使用体验,帮助其他用户"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(S=>e.jsx("button",{onClick:()=>f(S),className:"focus:outline-none",children:e.jsx(mn,{className:`h-8 w-8 transition-colors ${S<=h?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},S))}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h===0&&"点击星星进行评分",h===1&&"很差",h===2&&"一般",h===3&&"还行",h===4&&"不错",h===5&&"非常好"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),e.jsx(rt,{value:p,onChange:S=>g(S.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[p.length," / 500"]})]})]}),e.jsxs(nt,{children:[e.jsx(_,{variant:"outline",onClick:()=>j(!1),children:"取消"}),e.jsx(_,{onClick:A,disabled:h===0,children:"提交评分"})]})]})]})]}),r.recent_ratings&&r.recent_ratings.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),e.jsx("div",{className:"space-y-3",children:r.recent_ratings.map((S,U)=>e.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(E=>e.jsx(mn,{className:`h-3 w-3 ${E<=S.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},E))}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(S.created_at).toLocaleDateString()})]}),S.comment&&e.jsx("p",{className:"text-sm text-muted-foreground",children:S.comment})]},U))})]})]}):null}const yC={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function wC(){const a=ca(),l=J0({strict:!1}),{toast:r}=Ws(),[c,d]=m.useState(null),[u,h]=m.useState(""),[f,p]=m.useState(!0),[g,b]=m.useState(!0),[j,y]=m.useState(null),[N,w]=m.useState(null),[M,A]=m.useState(null),[S,U]=m.useState(!1),[E,C]=m.useState(),[D,P]=m.useState(!1);m.useEffect(()=>{(async()=>{if(!l.pluginId){y("缺少插件 ID"),p(!1);return}try{p(!0),y(null);const he=await _e("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:"Mai-with-u",repo:"plugin-repo",branch:"main",file_path:"plugin_details.json"})});if(!he.ok)throw new Error("获取插件列表失败");const ge=await he.json();if(!ge.success||!ge.data)throw new Error(ge.error||"获取插件列表失败");const Q=JSON.parse(ge.data).find(fe=>fe.id===l.pluginId);if(!Q)throw new Error("未找到该插件");const $={id:Q.id,manifest:Q.manifest,downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()};d($);const[ue,G,Se]=await Promise.all([rN(),iN(),Dl()]);w(ue),A(G),U(hn(l.pluginId,Se)),C(fn(l.pluginId,Se))}catch(he){y(he instanceof Error?he.message:"加载失败")}finally{p(!1)}})()},[l.pluginId]),m.useEffect(()=>{(async()=>{if(!c?.manifest?.repository_url){b(!1);return}try{if(b(!0),S&&l.pluginId)try{const G=await _e(`/api/webui/plugins/local-readme/${l.pluginId}`);if(G.ok){const Se=await G.json();if(Se.success&&Se.data){h(Se.data),b(!1);return}}}catch(G){console.log("本地 README 获取失败,尝试远程获取:",G)}const he=c.manifest.repository_url.match(/github\.com\/([^/]+)\/([^/\s]+)/);if(!he){h("无法解析仓库地址");return}const[,ge,R]=he,Q=R.replace(/\.git$/,""),$=await _e("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:ge,repo:Q,branch:"main",file_path:"README.md"})});if(!$.ok)throw new Error("获取 README 失败");const ue=await $.json();ue.success&&ue.data?h(ue.data):h("该插件暂无 README 文档")}catch(he){console.error("加载 README 失败:",he),h("加载 README 失败")}finally{b(!1)}})()},[c,S,l.pluginId]);const O=()=>!c||!S||!E?!1:E!==c.manifest.version,J=()=>!c||!M?!0:cN(c.manifest.host_application.min_version,c.manifest.host_application.max_version,M),L=async()=>{if(!(!c||!N?.installed))try{P(!0),await oN(c.id,c.manifest.repository_url||"","main"),xN(c.id).catch(he=>{console.warn("Failed to record download:",he)}),r({title:"安装成功",description:`${c.manifest.name} 已成功安装`});const de=await Dl();U(hn(c.id,de)),C(fn(c.id,de))}catch(de){r({title:"安装失败",description:de instanceof Error?de.message:"未知错误",variant:"destructive"})}finally{P(!1)}},oe=async()=>{if(c)try{P(!0),await dN(c.id),r({title:"卸载成功",description:`${c.manifest.name} 已成功卸载`});const de=await Dl();U(hn(c.id,de)),C(fn(c.id,de))}catch(de){r({title:"卸载失败",description:de instanceof Error?de.message:"未知错误",variant:"destructive"})}finally{P(!1)}},Ne=async()=>{if(!(!c||!N?.installed))try{P(!0);const de=await uN(c.id,c.manifest.repository_url||"","main");r({title:"更新成功",description:`${c.manifest.name} 已从 ${de.old_version} 更新到 ${de.new_version}`});const he=await Dl();U(hn(c.id,he)),C(fn(c.id,he))}catch(de){r({title:"更新失败",description:de instanceof Error?de.message:"未知错误",variant:"destructive"})}finally{P(!1)}};if(f)return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>a({to:"/plugins"}),children:e.jsx(Ma,{className:"h-5 w-5"})}),e.jsx("div",{children:e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件详情"})})]}),e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Os,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件信息中..."})]})]});if(j||!c)return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>a({to:"/plugins"}),children:e.jsx(Ma,{className:"h-5 w-5"})}),e.jsx("div",{children:e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件详情"})})]}),e.jsx(ke,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Ct,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:j}),e.jsx(_,{onClick:()=>a({to:"/plugins"}),children:"返回插件列表"})]})})]});const je=J();return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>a({to:"/plugins"}),className:"shrink-0",children:e.jsx(Ma,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件详情"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:c.manifest.name})]})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:S?e.jsxs(e.Fragment,{children:[O()?e.jsx(_,{disabled:!N?.installed||D,onClick:Ne,title:N?.installed?void 0:"Git 未安装",children:D?e.jsxs(e.Fragment,{children:[e.jsx(Os,{className:"h-4 w-4 mr-2 animate-spin"}),"更新中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(xt,{className:"h-4 w-4 mr-2"}),"更新"]})}):null,e.jsx(_,{variant:"destructive",disabled:!N?.installed||D,onClick:oe,title:N?.installed?void 0:"Git 未安装",children:D?e.jsxs(e.Fragment,{children:[e.jsx(Os,{className:"h-4 w-4 mr-2 animate-spin"}),"卸载中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ls,{className:"h-4 w-4 mr-2"}),"卸载"]})})]}):e.jsx(_,{disabled:!N?.installed||!je||D,onClick:L,title:N?.installed?je?void 0:`不兼容当前版本 (需要 ${c.manifest.host_application.min_version}${c.manifest.host_application.max_version?` - ${c.manifest.host_application.max_version}`:"+"},当前 ${M?.version})`:"Git 未安装",children:D?e.jsxs(e.Fragment,{children:[e.jsx(Os,{className:"h-4 w-4 mr-2 animate-spin"}),"安装中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Wt,{className:"h-4 w-4 mr-2"}),"安装"]})})})]}),e.jsx(Ze,{className:"h-[calc(100vh-200px)] sm:h-[calc(100vh-220px)]",children:e.jsxs("div",{className:"space-y-6 pr-4",children:[e.jsx(ke,{children:e.jsx(Re,{children:e.jsx("div",{className:"flex items-start justify-between gap-4",children:e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx(De,{className:"text-2xl",children:c.manifest.name}),e.jsxs(Ce,{variant:"secondary",className:"text-sm",children:["v",c.manifest.version]}),S&&e.jsxs(Ce,{variant:"default",className:"text-sm",children:[e.jsx(bt,{className:"h-3 w-3 mr-1"}),"已安装 ",E&&`(v${E})`]}),O()&&e.jsxs(Ce,{variant:"outline",className:"text-sm border-orange-500 text-orange-500",children:[e.jsx(xt,{className:"h-3 w-3 mr-1"}),"可更新"]}),!je&&e.jsxs(Ce,{variant:"destructive",className:"text-sm",children:[e.jsx(Ct,{className:"h-3 w-3 mr-1"}),"不兼容"]})]}),e.jsx(is,{className:"text-base",children:c.manifest.description})]})})})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-1 space-y-6",children:[e.jsxs(ke,{children:[e.jsx(Re,{children:e.jsx(De,{className:"text-lg",children:"统计信息"})}),e.jsx(Me,{children:e.jsx(bC,{pluginId:c.id})})]}),e.jsxs(ke,{children:[e.jsx(Re,{children:e.jsx(De,{className:"text-lg",children:"基本信息"})}),e.jsx(Me,{className:"space-y-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(jn,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"作者:"}),e.jsx("span",{className:"font-medium",children:c.manifest.author?.name||"Unknown"}),c.manifest.author?.url&&e.jsx("a",{href:c.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.jsx($o,{className:"h-3 w-3"})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(ra,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"版本:"}),e.jsxs("span",{className:"font-medium",children:["v",c.manifest.version]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(sv,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"许可证:"}),e.jsx("span",{className:"font-medium",children:c.manifest.license})]}),c.manifest.homepage_url&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Vo,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"主页:"}),e.jsxs("a",{href:c.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",children:["访问",e.jsx($o,{className:"h-3 w-3"})]})]}),c.manifest.repository_url&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(P_,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"仓库:"}),e.jsxs("a",{href:c.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",children:["GitHub",e.jsx($o,{className:"h-3 w-3"})]})]}),e.jsxs("div",{className:"pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm mb-2",children:[e.jsx(Vt,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"支持版本:"})]}),e.jsxs("div",{className:"text-sm pl-6 font-medium",children:[c.manifest.host_application.min_version,c.manifest.host_application.max_version?` - ${c.manifest.host_application.max_version}`:" - 最新版本"]})]})]})})]}),(c.manifest.categories||c.manifest.keywords)&&e.jsxs(ke,{children:[e.jsx(Re,{children:e.jsx(De,{className:"text-lg",children:"分类与标签"})}),e.jsxs(Me,{className:"space-y-4",children:[c.manifest.categories&&c.manifest.categories.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"分类"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:c.manifest.categories.map(de=>e.jsx(Ce,{variant:"secondary",children:yC[de]||de},de))})]}),c.manifest.keywords&&c.manifest.keywords.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"标签"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:c.manifest.keywords.map(de=>e.jsxs(Ce,{variant:"outline",className:"text-xs",children:[e.jsx(rd,{className:"h-3 w-3 mr-1"}),de]},de))})]})]})]})]}),e.jsxs(ke,{className:"lg:col-span-2",children:[e.jsx(Re,{children:e.jsx(De,{className:"text-lg",children:"插件说明"})}),e.jsx(Me,{children:e.jsx(Ze,{className:"h-[600px] pr-4",children:g?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Os,{className:"h-6 w-6 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-sm text-muted-foreground",children:"加载说明文档中..."})]}):u?e.jsx(px,{content:u}):e.jsx("div",{className:"text-center text-muted-foreground py-12",children:"暂无说明文档"})})})]})]})]})})]})}const Zi=m.forwardRef(({className:a,...l},r)=>e.jsx(Sj,{ref:r,className:F("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",a),...l}));Zi.displayName=Sj.displayName;const _C=m.forwardRef(({className:a,...l},r)=>e.jsx(kj,{ref:r,className:F("aspect-square h-full w-full",a),...l}));_C.displayName=kj.displayName;const Wi=m.forwardRef(({className:a,...l},r)=>e.jsx(Cj,{ref:r,className:F("flex h-full w-full items-center justify-center rounded-full bg-muted",a),...l}));Wi.displayName=Cj.displayName;function SC(){return"webui_"+Math.random().toString(36).substr(2,9)+"_"+Date.now().toString(36)}function kC(){const a="maibot_webui_user_id";let l=localStorage.getItem(a);return l||(l=SC(),localStorage.setItem(a,l)),l}function CC(){return localStorage.getItem("maibot_webui_user_name")||"WebUI用户"}function TC(a){localStorage.setItem("maibot_webui_user_name",a)}const hN="maibot_webui_virtual_tabs";function EC(){try{const a=localStorage.getItem(hN);if(a)return JSON.parse(a)}catch(a){console.error("[Chat] 加载虚拟标签页失败:",a)}return[]}function Wg(a){try{localStorage.setItem(hN,JSON.stringify(a))}catch(l){console.error("[Chat] 保存虚拟标签页失败:",l)}}function MC({segment:a}){switch(a.type){case"text":return e.jsx("span",{className:"whitespace-pre-wrap",children:String(a.data)});case"image":case"emoji":return e.jsx("img",{src:String(a.data),alt:a.type==="emoji"?"表情包":"图片",className:F("rounded-lg max-w-full",a.type==="emoji"?"max-h-32":"max-h-64"),loading:"lazy",onError:l=>{const r=l.target;r.style.display="none",r.parentElement?.insertAdjacentHTML("beforeend",`[${a.type==="emoji"?"表情包":"图片"}加载失败]`)}});case"voice":return e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("audio",{controls:!0,src:String(a.data),className:"max-w-[200px] h-8",children:"您的浏览器不支持音频播放"})});case"video":return e.jsx("video",{controls:!0,src:String(a.data),className:"rounded-lg max-w-full max-h-64",children:"您的浏览器不支持视频播放"});case"face":return e.jsxs("span",{className:"text-muted-foreground",children:["[表情:",String(a.data),"]"]});case"music":return e.jsx("span",{className:"text-muted-foreground",children:"[音乐分享]"});case"file":return e.jsxs("span",{className:"text-muted-foreground",children:["[文件: ",String(a.data),"]"]});case"reply":return e.jsx("span",{className:"text-muted-foreground text-xs",children:"[回复消息]"});case"forward":return e.jsx("span",{className:"text-muted-foreground",children:"[转发消息]"});case"unknown":default:return e.jsxs("span",{className:"text-muted-foreground",children:["[",a.original_type||"未知消息","]"]})}}function AC({message:a,isBot:l}){return a.message_type==="rich"&&a.segments&&a.segments.length>0?e.jsx("div",{className:"flex flex-col gap-2",children:a.segments.map((r,c)=>e.jsx(MC,{segment:r},c))}):e.jsx("span",{className:"whitespace-pre-wrap",children:a.content})}function zC(){const a={id:"webui-default",type:"webui",label:"WebUI",messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}},l=()=>{const qe=EC().map(Qe=>{const We=Qe.virtualConfig;return!We.groupId&&We.platform&&We.userId&&(We.groupId=`webui_virtual_group_${We.platform}_${We.userId}`),{id:Qe.id,type:"virtual",label:Qe.label,virtualConfig:We,messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}}});return[a,...qe]},[r,c]=m.useState(l),[d,u]=m.useState("webui-default"),h=r.find(Z=>Z.id===d)||r[0],[f,p]=m.useState(""),[g,b]=m.useState(!1),[j,y]=m.useState(!0),[N,w]=m.useState(CC()),[M,A]=m.useState(!1),[S,U]=m.useState(""),[E,C]=m.useState(!1),[D,P]=m.useState([]),[O,J]=m.useState([]),[L,oe]=m.useState(!1),[Ne,je]=m.useState(!1),[de,he]=m.useState(""),[ge,R]=m.useState({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),Q=m.useRef(kC()),$=m.useRef(new Map),ue=m.useRef(null),G=m.useRef(new Map),Se=m.useRef(0),fe=m.useRef(new Map),{toast:Te}=Ws(),q=Z=>(Se.current+=1,`${Z}-${Date.now()}-${Se.current}-${Math.random().toString(36).substr(2,9)}`),B=m.useCallback((Z,qe)=>{c(Qe=>Qe.map(We=>We.id===Z?{...We,...qe}:We))},[]),z=m.useCallback((Z,qe)=>{c(Qe=>Qe.map(We=>We.id===Z?{...We,messages:[...We.messages,qe]}:We))},[]),K=m.useCallback(()=>{ue.current?.scrollIntoView({behavior:"smooth"})},[]);m.useEffect(()=>{K()},[h?.messages,K]);const Ae=m.useCallback(async()=>{oe(!0);try{const Z=await _e("/api/chat/platforms");if(console.log("[Chat] 平台列表响应:",Z.status,Z.headers.get("content-type")),Z.ok){const qe=Z.headers.get("content-type");if(qe&&qe.includes("application/json")){const Qe=await Z.json();console.log("[Chat] 平台列表数据:",Qe),P(Qe.platforms||[])}else{const Qe=await Z.text();console.error("[Chat] 获取平台列表失败: 非 JSON 响应:",Qe.substring(0,200)),Te({title:"连接失败",description:"无法连接到后端服务,请确保 MaiBot 已启动",variant:"destructive"})}}else console.error("[Chat] 获取平台列表失败: HTTP",Z.status),Te({title:"获取平台失败",description:`服务器返回错误: ${Z.status}`,variant:"destructive"})}catch(Z){console.error("[Chat] 获取平台列表失败:",Z),Te({title:"网络错误",description:"无法连接到后端服务",variant:"destructive"})}finally{oe(!1)}},[Te]),ee=m.useCallback(async(Z,qe)=>{je(!0);try{const Qe=new URLSearchParams;Z&&Qe.append("platform",Z),qe&&Qe.append("search",qe),Qe.append("limit","50");const We=await _e(`/api/chat/persons?${Qe.toString()}`);if(We.ok){const Rs=We.headers.get("content-type");if(Rs&&Rs.includes("application/json")){const He=await We.json();J(He.persons||[])}else console.error("[Chat] 获取用户列表失败: 后端返回非 JSON 响应")}}catch(Qe){console.error("[Chat] 获取用户列表失败:",Qe)}finally{je(!1)}},[]);m.useEffect(()=>{ge.platform&&ee(ge.platform,de)},[ge.platform,de,ee]);const Y=m.useCallback(async(Z,qe)=>{y(!0);try{const Qe=new URLSearchParams;Qe.append("user_id",Q.current),Qe.append("limit","50"),qe&&Qe.append("group_id",qe);const We=`/api/chat/history?${Qe.toString()}`;console.log("[Chat] 正在加载历史消息:",We);const Rs=await _e(We);if(Rs.ok){const He=await Rs.text();try{const Ss=JSON.parse(He);if(Ss.messages&&Ss.messages.length>0){const Ds=Ss.messages.map(ns=>({id:ns.id,type:ns.type,content:ns.content,timestamp:ns.timestamp,sender:{name:ns.sender_name||(ns.is_bot?"麦麦":"WebUI用户"),user_id:ns.user_id,is_bot:ns.is_bot}}));B(Z,{messages:Ds});const Vs=fe.current.get(Z)||new Set;Ds.forEach(ns=>{if(ns.type==="bot"){const ts=`bot-${ns.content}-${Math.floor(ns.timestamp*1e3)}`;Vs.add(ts)}}),fe.current.set(Z,Vs)}}catch(Ss){console.error("[Chat] JSON 解析失败:",Ss)}}}catch(Qe){console.error("[Chat] 加载历史消息失败:",Qe)}finally{y(!1)}},[B]),$e=m.useCallback(async(Z,qe,Qe)=>{const We=$.current.get(Z);if(We?.readyState===WebSocket.OPEN||We?.readyState===WebSocket.CONNECTING){console.log(`[Tab ${Z}] WebSocket 已存在,跳过连接`);return}b(!0);let Rs=null;try{const Vs=await _e("/api/webui/ws-token");if(Vs.ok){const ns=await Vs.json();if(ns.success&&ns.token)Rs=ns.token;else{console.warn(`[Tab ${Z}] 获取 WebSocket token 失败: ${ns.message||"未登录"}`),b(!1);return}}}catch(Vs){console.error(`[Tab ${Z}] 获取 WebSocket token 失败:`,Vs),b(!1);return}if(!Rs){b(!1);return}const He=window.location.protocol==="https:"?"wss:":"ws:",Ss=new URLSearchParams;Ss.append("token",Rs),qe==="virtual"&&Qe?(Ss.append("user_id",Qe.userId),Ss.append("user_name",Qe.userName),Ss.append("platform",Qe.platform),Ss.append("person_id",Qe.personId),Ss.append("group_name",Qe.groupName||"WebUI虚拟群聊"),Qe.groupId&&Ss.append("group_id",Qe.groupId)):(Ss.append("user_id",Q.current),Ss.append("user_name",N));const Ds=`${He}//${window.location.host}/api/chat/ws?${Ss.toString()}`;console.log(`[Tab ${Z}] 正在连接 WebSocket:`,Ds);try{const Vs=new WebSocket(Ds);$.current.set(Z,Vs),Vs.onopen=()=>{B(Z,{isConnected:!0}),b(!1),console.log(`[Tab ${Z}] WebSocket 已连接`)},Vs.onmessage=ns=>{try{const ts=JSON.parse(ns.data);switch(ts.type){case"session_info":B(Z,{sessionInfo:{session_id:ts.session_id,user_id:ts.user_id,user_name:ts.user_name,bot_name:ts.bot_name}});break;case"system":z(Z,{id:q("sys"),type:"system",content:ts.content||"",timestamp:ts.timestamp||Date.now()/1e3});break;case"user_message":{const Ns=ts.sender?.user_id,Le=qe==="virtual"&&Qe?Qe.userId:Q.current;console.log(`[Tab ${Z}] 收到 user_message, sender: ${Ns}, current: ${Le}`);const bs=Ns?Ns.replace(/^webui_user_/,""):"",_s=Le?Le.replace(/^webui_user_/,""):"";if(bs&&_s&&bs===_s){console.log(`[Tab ${Z}] 跳过自己的消息(user_id 匹配)`);break}const rs=fe.current.get(Z)||new Set,ft=`user-${ts.content}-${Math.floor((ts.timestamp||0)*1e3)}`;if(rs.has(ft)){console.log(`[Tab ${Z}] 跳过自己的消息(内容去重)`);break}if(rs.add(ft),fe.current.set(Z,rs),rs.size>100){const zt=rs.values().next().value;zt&&rs.delete(zt)}z(Z,{id:ts.message_id||q("user"),type:"user",content:ts.content||"",timestamp:ts.timestamp||Date.now()/1e3,sender:ts.sender});break}case"bot_message":{B(Z,{isTyping:!1});const Ns=fe.current.get(Z)||new Set,Le=`bot-${ts.content}-${Math.floor((ts.timestamp||0)*1e3)}`;if(Ns.has(Le))break;if(Ns.add(Le),fe.current.set(Z,Ns),Ns.size>100){const bs=Ns.values().next().value;bs&&Ns.delete(bs)}c(bs=>bs.map(_s=>{if(_s.id!==Z)return _s;const rs=_s.messages.filter(zt=>zt.type!=="thinking"),ft={id:q("bot"),type:"bot",content:ts.content||"",message_type:ts.message_type==="rich"?"rich":"text",segments:ts.segments,timestamp:ts.timestamp||Date.now()/1e3,sender:ts.sender};return{..._s,messages:[...rs,ft]}}));break}case"typing":B(Z,{isTyping:ts.is_typing||!1});break;case"error":c(Ns=>Ns.map(Le=>{if(Le.id!==Z)return Le;const bs=Le.messages.filter(_s=>_s.type!=="thinking");return{...Le,messages:[...bs,{id:q("error"),type:"error",content:ts.content||"发生错误",timestamp:ts.timestamp||Date.now()/1e3}]}})),Te({title:"错误",description:ts.content,variant:"destructive"});break;case"pong":break;case"history":{const Ns=ts.messages||[];if(Ns.length>0){const Le=fe.current.get(Z)||new Set,bs=Ns.map(_s=>{const rs=_s.is_bot||!1,ft=_s.id||q(rs?"bot":"user"),zt=`${rs?"bot":"user"}-${_s.content}-${Math.floor(_s.timestamp*1e3)}`;return Le.add(zt),{id:ft,type:rs?"bot":"user",content:_s.content,timestamp:_s.timestamp,sender:{name:_s.sender_name||(rs?"麦麦":"用户"),user_id:_s.sender_id,is_bot:rs}}});fe.current.set(Z,Le),B(Z,{messages:bs}),console.log(`[Tab ${Z}] 已加载 ${bs.length} 条历史消息`)}break}default:console.log("未知消息类型:",ts.type)}}catch(ts){console.error("解析消息失败:",ts)}},Vs.onclose=()=>{B(Z,{isConnected:!1}),b(!1),$.current.delete(Z),console.log(`[Tab ${Z}] WebSocket 已断开`);const ns=G.current.get(Z);ns&&clearTimeout(ns);const ts=window.setTimeout(()=>{if(!H.current){const Ns=r.find(Le=>Le.id===Z);Ns&&$e(Z,Ns.type,Ns.virtualConfig)}},5e3);G.current.set(Z,ts)},Vs.onerror=ns=>{console.error(`[Tab ${Z}] WebSocket 错误:`,ns),b(!1)}}catch(Vs){console.error(`[Tab ${Z}] 创建 WebSocket 失败:`,Vs),b(!1)}},[N,B,z,Te,r]),H=m.useRef(!1);m.useEffect(()=>{H.current=!1;const Z=$.current,qe=G.current,Qe=fe.current;Y("webui-default");const We=setTimeout(()=>{H.current||($e("webui-default","webui"),r.forEach(He=>{He.type==="virtual"&&He.virtualConfig&&(Qe.set(He.id,new Set),setTimeout(()=>{H.current||$e(He.id,"virtual",He.virtualConfig)},200))}))},100),Rs=setInterval(()=>{Z.forEach(He=>{He.readyState===WebSocket.OPEN&&He.send(JSON.stringify({type:"ping"}))})},3e4);return()=>{H.current=!0,clearTimeout(We),clearInterval(Rs),qe.forEach(He=>{clearTimeout(He)}),qe.clear(),Z.forEach(He=>{He.close()}),Z.clear()}},[]);const se=m.useCallback(()=>{const Z=$.current.get(d);if(!f.trim()||!Z||Z.readyState!==WebSocket.OPEN)return;const qe=h?.type==="virtual"&&h.virtualConfig?.userName||N,Qe=f.trim(),We=Date.now()/1e3;Z.send(JSON.stringify({type:"message",content:Qe,user_name:qe}));const Rs=fe.current.get(d)||new Set,He=`user-${Qe}-${Math.floor(We*1e3)}`;if(Rs.add(He),fe.current.set(d,Rs),Rs.size>100){const Vs=Rs.values().next().value;Vs&&Rs.delete(Vs)}const Ss={id:q("user"),type:"user",content:Qe,timestamp:We,sender:{name:qe,is_bot:!1}};z(d,Ss);const Ds={id:q("thinking"),type:"thinking",content:"",timestamp:We+.001,sender:{name:h?.sessionInfo.bot_name||"麦麦",is_bot:!0}};z(d,Ds),p("")},[f,N,d,h,z]),Ue=Z=>{Z.key==="Enter"&&!Z.shiftKey&&(Z.preventDefault(),se())},ie=()=>{U(N),A(!0)},Ee=()=>{const Z=S.trim()||"WebUI用户";w(Z),TC(Z),A(!1);const qe=$.current.get(d);qe?.readyState===WebSocket.OPEN&&qe.send(JSON.stringify({type:"update_nickname",user_name:Z}))},me=()=>{U(""),A(!1)},ze=Z=>new Date(Z*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),at=()=>{const Z=$.current.get(d);Z&&(Z.close(),$.current.delete(d)),$e(d,h?.type||"webui",h?.virtualConfig)},Pt=()=>{R({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),he(""),Ae(),C(!0)},qt=()=>{if(!ge.platform||!ge.personId){Te({title:"配置不完整",description:"请选择平台和用户",variant:"destructive"});return}const Z=`webui_virtual_group_${ge.platform}_${ge.userId}`,qe=`virtual-${ge.platform}-${ge.userId}-${Date.now()}`,Qe=ge.userName||ge.userId,We={id:qe,type:"virtual",label:Qe,virtualConfig:{...ge,groupId:Z},messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}};c(Rs=>{const He=[...Rs,We],Ss=He.filter(Ds=>Ds.type==="virtual"&&Ds.virtualConfig).map(Ds=>({id:Ds.id,label:Ds.label,virtualConfig:Ds.virtualConfig,createdAt:Date.now()}));return Wg(Ss),He}),u(qe),C(!1),fe.current.set(qe,new Set),setTimeout(()=>{$e(qe,"virtual",ge)},100),Te({title:"虚拟身份标签页",description:`已创建 ${Qe} 的对话`})},Ja=(Z,qe)=>{if(qe?.stopPropagation(),Z==="webui-default")return;const Qe=$.current.get(Z);Qe&&(Qe.close(),$.current.delete(Z));const We=G.current.get(Z);We&&(clearTimeout(We),G.current.delete(Z)),fe.current.delete(Z),c(Rs=>{const He=Rs.filter(Ds=>Ds.id!==Z),Ss=He.filter(Ds=>Ds.type==="virtual"&&Ds.virtualConfig).map(Ds=>({id:Ds.id,label:Ds.label,virtualConfig:Ds.virtualConfig,createdAt:Date.now()}));return Wg(Ss),He}),d===Z&&u("webui-default")},As=Z=>{u(Z)},vt=Z=>{R(qe=>({...qe,personId:Z.person_id,userId:Z.user_id,userName:Z.nickname||Z.person_name}))};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Fs,{open:E,onOpenChange:C,children:e.jsxs(Us,{className:"sm:max-w-[500px] max-h-[85vh] overflow-hidden flex flex-col",children:[e.jsxs($s,{children:[e.jsxs(Bs,{className:"flex items-center gap-2",children:[e.jsx(Mm,{className:"h-5 w-5"}),"新建虚拟身份对话"]}),e.jsx(Xs,{children:"选择一个麦麦已认识的用户,以该用户的身份与麦麦对话。麦麦将使用她对该用户的记忆和认知来回应。"})]}),e.jsxs("div",{className:"space-y-4 flex-1 overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{className:"flex items-center gap-2",children:[e.jsx(Vo,{className:"h-4 w-4"}),"选择平台"]}),e.jsxs(Pe,{value:ge.platform,onValueChange:Z=>{R(qe=>({...qe,platform:Z,personId:"",userId:"",userName:""})),J([])},children:[e.jsx(Be,{disabled:L,children:e.jsx(Fe,{placeholder:L?"加载中...":"选择平台"})}),e.jsx(Ie,{children:D.map(Z=>e.jsxs(W,{value:Z.platform,children:[Z.platform," (",Z.count," 人)"]},Z.platform))})]})]}),ge.platform&&e.jsxs("div",{className:"space-y-2 flex-1 overflow-hidden flex flex-col",children:[e.jsxs(T,{className:"flex items-center gap-2",children:[e.jsx(ic,{className:"h-4 w-4"}),"选择用户"]}),e.jsxs("div",{className:"relative",children:[e.jsx(At,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ae,{placeholder:"搜索用户名...",value:de,onChange:Z=>he(Z.target.value),className:"pl-9"})]}),e.jsx(Ze,{className:"h-[250px] border rounded-md",children:e.jsx("div",{className:"p-2",children:Ne?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Os,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):O.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[e.jsx(ic,{className:"h-8 w-8 mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"没有找到用户"})]}):e.jsx("div",{className:"space-y-1",children:O.map(Z=>e.jsxs("button",{onClick:()=>vt(Z),className:F("w-full flex items-center gap-3 p-2 rounded-md text-left transition-colors",ge.personId===Z.person_id?"bg-primary text-primary-foreground":"hover:bg-muted"),children:[e.jsx(Zi,{className:"h-8 w-8 shrink-0",children:e.jsx(Wi,{className:F("text-xs",ge.personId===Z.person_id?"bg-primary-foreground/20":"bg-muted"),children:(Z.nickname||Z.person_name||"?").charAt(0)})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-medium truncate",children:Z.nickname||Z.person_name}),e.jsxs("div",{className:F("text-xs truncate",ge.personId===Z.person_id?"text-primary-foreground/70":"text-muted-foreground"),children:["ID: ",Z.user_id,Z.is_known&&" · 已认识"]})]})]},Z.person_id))})})})]}),ge.personId&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"虚拟群名(可选)"}),e.jsx(ae,{placeholder:"WebUI虚拟群聊",value:ge.groupName,onChange:Z=>R(qe=>({...qe,groupName:Z.target.value}))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦会认为这是一个名为此名称的群聊"})]})]}),e.jsxs(nt,{className:"gap-2 sm:gap-0",children:[e.jsx(_,{variant:"outline",onClick:()=>C(!1),children:"取消"}),e.jsx(_,{onClick:qt,disabled:!ge.platform||!ge.personId,children:"创建对话"})]})]})}),e.jsx("div",{className:"shrink-0 border-b bg-muted/30",children:e.jsx("div",{className:"max-w-4xl mx-auto px-2 sm:px-4",children:e.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto py-1.5 scrollbar-thin",children:[r.map(Z=>e.jsxs("div",{className:F("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm whitespace-nowrap transition-colors cursor-pointer","hover:bg-muted",d===Z.id?"bg-background shadow-sm border":"text-muted-foreground"),onClick:()=>As(Z.id),children:[Z.type==="webui"?e.jsx(Ra,{className:"h-3.5 w-3.5"}):e.jsx(Mm,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"max-w-[100px] truncate",children:Z.label}),e.jsx("span",{className:F("w-1.5 h-1.5 rounded-full",Z.isConnected?"bg-green-500":"bg-muted-foreground/50")}),Z.id!=="webui-default"&&e.jsx("span",{onClick:qe=>Ja(Z.id,qe),className:"ml-0.5 p-0.5 rounded hover:bg-muted-foreground/20 cursor-pointer",role:"button",tabIndex:0,onKeyDown:qe=>{(qe.key==="Enter"||qe.key===" ")&&(qe.preventDefault(),Ja(Z.id,qe))},children:e.jsx(Aa,{className:"h-3 w-3"})})]},Z.id)),e.jsx("button",{onClick:Pt,className:"flex items-center gap-1 px-2 py-1.5 rounded-md text-sm text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",title:"新建虚拟身份对话",children:e.jsx(Ys,{className:"h-3.5 w-3.5"})})]})})}),e.jsx("div",{className:"shrink-0 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:e.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[e.jsx(Zi,{className:"h-8 w-8 sm:h-10 sm:w-10 shrink-0",children:e.jsx(Wi,{className:"bg-primary/10 text-primary",children:e.jsx(Vn,{className:"h-4 w-4 sm:h-5 sm:w-5"})})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-base sm:text-lg font-semibold truncate",children:h?.sessionInfo.bot_name||"麦麦"}),e.jsx("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:h?.isConnected?e.jsxs(e.Fragment,{children:[e.jsx(F_,{className:"h-3 w-3 text-green-500"}),e.jsx("span",{className:"text-green-600 dark:text-green-400",children:"已连接"})]}):g?e.jsxs(e.Fragment,{children:[e.jsx(Os,{className:"h-3 w-3 animate-spin"}),e.jsx("span",{children:"连接中..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(H_,{className:"h-3 w-3 text-red-500"}),e.jsx("span",{className:"text-red-600 dark:text-red-400",children:"未连接"})]})})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[j&&e.jsx(Os,{className:"h-4 w-4 animate-spin text-muted-foreground"}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:at,disabled:g,title:"重新连接",children:e.jsx(xt,{className:F("h-4 w-4",g&&"animate-spin")})})]})]}),e.jsx("div",{className:"hidden sm:flex items-center gap-2 mt-2 text-sm text-muted-foreground",children:h?.type==="virtual"&&h.virtualConfig?e.jsxs(e.Fragment,{children:[e.jsx(Mm,{className:"h-3 w-3 text-primary"}),e.jsx("span",{children:"虚拟身份:"}),e.jsx("span",{className:"font-medium text-primary",children:h.virtualConfig.userName}),e.jsxs("span",{className:"text-xs",children:["(",h.virtualConfig.platform,")"]}),h.virtualConfig.groupName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-1",children:"·"}),e.jsxs("span",{className:"text-xs",children:["群:",h.virtualConfig.groupName]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(jn,{className:"h-3 w-3"}),e.jsx("span",{children:"当前身份:"}),M?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{value:S,onChange:Z=>U(Z.target.value),onKeyDown:Z=>{Z.key==="Enter"&&Ee(),Z.key==="Escape"&&me()},className:"h-7 w-32",placeholder:"输入昵称",autoFocus:!0}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:Ee,children:"保存"}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:me,children:"取消"})]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-medium text-foreground",children:N}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:ie,title:"修改昵称",children:e.jsx(V_,{className:"h-3 w-3"})})]})]})})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto space-y-3 sm:space-y-4",children:[h?.messages.length===0&&!j&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(Vn,{className:"h-12 w-12 mb-4 opacity-50"}),e.jsxs("p",{className:"text-sm",children:["开始与 ",h?.sessionInfo.bot_name||"麦麦"," 对话吧!"]})]}),h?.messages.map(Z=>e.jsxs("div",{className:F("flex gap-2 sm:gap-3",Z.type==="user"&&"flex-row-reverse",Z.type==="system"&&"justify-center",Z.type==="error"&&"justify-center"),children:[Z.type==="system"&&e.jsx("div",{className:"text-xs text-muted-foreground bg-muted/50 px-3 py-1 rounded-full max-w-[90%]",children:Z.content}),Z.type==="error"&&e.jsx("div",{className:"text-xs text-red-600 dark:text-red-400 bg-red-100 dark:bg-red-900/30 px-3 py-1 rounded-full max-w-[90%]",children:Z.content}),Z.type==="thinking"&&e.jsxs(e.Fragment,{children:[e.jsx(Zi,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(Wi,{className:"bg-primary/10 text-primary",children:e.jsx(Vn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),e.jsxs("div",{className:"flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",children:[e.jsx("div",{className:"flex items-center gap-2 text-[10px] sm:text-xs text-muted-foreground",children:e.jsx("span",{className:"hidden sm:inline",children:Z.sender?.name||h?.sessionInfo.bot_name})}),e.jsx("div",{className:"bg-muted rounded-2xl rounded-tl-sm px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex gap-1",children:[e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),e.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"思考中..."})]})})]})]}),(Z.type==="user"||Z.type==="bot")&&e.jsxs(e.Fragment,{children:[e.jsx(Zi,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(Wi,{className:F("text-xs",Z.type==="bot"?"bg-primary/10 text-primary":"bg-secondary text-secondary-foreground"),children:Z.type==="bot"?e.jsx(Vn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}):e.jsx(jn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),e.jsxs("div",{className:F("flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",Z.type==="user"&&"items-end"),children:[e.jsxs("div",{className:"flex items-center gap-2 text-[10px] sm:text-xs text-muted-foreground",children:[e.jsx("span",{className:"hidden sm:inline",children:Z.sender?.name||(Z.type==="bot"?h?.sessionInfo.bot_name:N)}),e.jsx("span",{children:ze(Z.timestamp)})]}),e.jsx("div",{className:F("rounded-2xl px-3 py-2 text-sm break-words",Z.type==="bot"?"bg-muted rounded-tl-sm":"bg-primary text-primary-foreground rounded-tr-sm"),children:e.jsx(AC,{message:Z,isBot:Z.type==="bot"})})]})]})]},Z.id)),e.jsx("div",{ref:ue})]})})}),e.jsx("div",{className:"shrink-0 border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:e.jsx("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{value:f,onChange:Z=>p(Z.target.value),onKeyDown:Ue,placeholder:h?.isConnected?"输入消息...":"等待连接...",disabled:!h?.isConnected,className:"flex-1 h-10 sm:h-10"}),e.jsx(_,{onClick:se,disabled:!h?.isConnected||!f.trim(),size:"icon",className:"h-10 w-10 shrink-0",children:e.jsx(G_,{className:"h-4 w-4"})})]})})})]})}var kx="Radio",[RC,fN]=td(kx),[DC,OC]=RC(kx),pN=m.forwardRef((a,l)=>{const{__scopeRadio:r,name:c,checked:d=!1,required:u,disabled:h,value:f="on",onCheck:p,form:g,...b}=a,[j,y]=m.useState(null),N=ad(l,A=>y(A)),w=m.useRef(!1),M=j?g||!!j.closest("form"):!0;return e.jsxs(DC,{scope:r,checked:d,disabled:h,children:[e.jsx(Zn.button,{type:"button",role:"radio","aria-checked":d,"data-state":NN(d),"data-disabled":h?"":void 0,disabled:h,value:f,...b,ref:N,onClick:gn(a.onClick,A=>{d||p?.(),M&&(w.current=A.isPropagationStopped(),w.current||A.stopPropagation())})}),M&&e.jsx(vN,{control:j,bubbles:!w.current,name:c,value:f,checked:d,required:u,disabled:h,form:g,style:{transform:"translateX(-100%)"}})]})});pN.displayName=kx;var gN="RadioIndicator",jN=m.forwardRef((a,l)=>{const{__scopeRadio:r,forceMount:c,...d}=a,u=OC(gN,r);return e.jsx(o_,{present:c||u.checked,children:e.jsx(Zn.span,{"data-state":NN(u.checked),"data-disabled":u.disabled?"":void 0,...d,ref:l})})});jN.displayName=gN;var LC="RadioBubbleInput",vN=m.forwardRef(({__scopeRadio:a,control:l,checked:r,bubbles:c=!0,...d},u)=>{const h=m.useRef(null),f=ad(h,u),p=d_(r),g=u_(l);return m.useEffect(()=>{const b=h.current;if(!b)return;const j=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(j,"checked").set;if(p!==r&&N){const w=new Event("click",{bubbles:c});N.call(b,r),b.dispatchEvent(w)}},[p,r,c]),e.jsx(Zn.input,{type:"radio","aria-hidden":!0,defaultChecked:r,...d,tabIndex:-1,ref:f,style:{...d.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});vN.displayName=LC;function NN(a){return a?"checked":"unchecked"}var UC=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],fd="RadioGroup",[$C]=td(fd,[Tj,fN]),bN=Tj(),yN=fN(),[BC,IC]=$C(fd),wN=m.forwardRef((a,l)=>{const{__scopeRadioGroup:r,name:c,defaultValue:d,value:u,required:h=!1,disabled:f=!1,orientation:p,dir:g,loop:b=!0,onValueChange:j,...y}=a,N=bN(r),w=qj(g),[M,A]=sd({prop:u,defaultProp:d??null,onChange:j,caller:fd});return e.jsx(BC,{scope:r,name:c,required:h,disabled:f,value:M,onValueChange:A,children:e.jsx(Sw,{asChild:!0,...N,orientation:p,dir:w,loop:b,children:e.jsx(Zn.div,{role:"radiogroup","aria-required":h,"aria-orientation":p,"data-disabled":f?"":void 0,dir:w,...y,ref:l})})})});wN.displayName=fd;var _N="RadioGroupItem",SN=m.forwardRef((a,l)=>{const{__scopeRadioGroup:r,disabled:c,...d}=a,u=IC(_N,r),h=u.disabled||c,f=bN(r),p=yN(r),g=m.useRef(null),b=ad(l,g),j=u.value===d.value,y=m.useRef(!1);return m.useEffect(()=>{const N=M=>{UC.includes(M.key)&&(y.current=!0)},w=()=>y.current=!1;return document.addEventListener("keydown",N),document.addEventListener("keyup",w),()=>{document.removeEventListener("keydown",N),document.removeEventListener("keyup",w)}},[]),e.jsx(kw,{asChild:!0,...f,focusable:!h,active:j,children:e.jsx(pN,{disabled:h,required:u.required,checked:j,...p,...d,name:u.name,ref:b,onCheck:()=>u.onValueChange(d.value),onKeyDown:gn(N=>{N.key==="Enter"&&N.preventDefault()}),onFocus:gn(d.onFocus,()=>{y.current&&g.current?.click()})})})});SN.displayName=_N;var PC="RadioGroupIndicator",kN=m.forwardRef((a,l)=>{const{__scopeRadioGroup:r,...c}=a,d=yN(r);return e.jsx(jN,{...d,...c,ref:l})});kN.displayName=PC;var CN=wN,TN=SN,FC=kN;const Cx=m.forwardRef(({className:a,...l},r)=>e.jsx(CN,{className:F("grid gap-2",a),...l,ref:r}));Cx.displayName=CN.displayName;const Xo=m.forwardRef(({className:a,...l},r)=>e.jsx(TN,{ref:r,className:F("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",a),...l,children:e.jsx(FC,{className:"flex items-center justify-center",children:e.jsx(Ho,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Xo.displayName=TN.displayName;function HC({question:a,value:l,onChange:r,error:c,disabled:d=!1}){const[u,h]=m.useState(null),f=d||a.readOnly,p=()=>{switch(a.type){case"single":return e.jsx(Cx,{value:l||"",onValueChange:r,disabled:f,className:"space-y-2",children:a.options?.map(g=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xo,{value:g.value,id:`${a.id}-${g.id}`}),e.jsx(T,{htmlFor:`${a.id}-${g.id}`,className:"cursor-pointer font-normal",children:g.label})]},g.id))});case"multiple":{const g=l||[];return e.jsxs("div",{className:"space-y-2",children:[a.options?.map(b=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Js,{id:`${a.id}-${b.id}`,checked:g.includes(b.value),disabled:f||a.maxSelections!==void 0&&g.length>=a.maxSelections&&!g.includes(b.value),onCheckedChange:j=>{r(j?[...g,b.value]:g.filter(y=>y!==b.value))}}),e.jsx(T,{htmlFor:`${a.id}-${b.id}`,className:"cursor-pointer font-normal",children:b.label})]},b.id)),a.maxSelections&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["最多选择 ",a.maxSelections," 项"]})]})}case"text":return e.jsx(ae,{value:l||"",onChange:g=>r(g.target.value),placeholder:a.placeholder||"请输入...",disabled:f,readOnly:a.readOnly,maxLength:a.maxLength,className:F(a.readOnly&&"bg-muted cursor-not-allowed")});case"textarea":return e.jsxs("div",{className:"space-y-1",children:[e.jsx(rt,{value:l||"",onChange:g=>r(g.target.value),placeholder:a.placeholder||"请输入...",disabled:f,readOnly:a.readOnly,maxLength:a.maxLength,rows:4,className:F(a.readOnly&&"bg-muted cursor-not-allowed")}),a.maxLength&&e.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[(l||"").length," / ",a.maxLength]})]});case"rating":{const g=l||0,b=u!==null?u:g;return e.jsxs("div",{className:"flex items-center gap-1",children:[[1,2,3,4,5].map(j=>e.jsx("button",{type:"button",disabled:f,className:F("p-1 transition-colors focus:outline-none focus:ring-2 focus:ring-ring rounded",f&&"cursor-not-allowed opacity-50"),onMouseEnter:()=>!f&&h(j),onMouseLeave:()=>h(null),onClick:()=>!f&&r(j),children:e.jsx(mn,{className:F("h-6 w-6 transition-colors",j<=b?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},j)),g>0&&e.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[g," / 5"]})]})}case"scale":{const g=a.min??1,b=a.max??10,j=a.step??1,y=l??g;return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Qa,{value:[y],onValueChange:([N])=>r(N),min:g,max:b,step:j,disabled:f}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:a.minLabel||g}),e.jsx("span",{className:"font-medium text-foreground",children:y}),e.jsx("span",{children:a.maxLabel||b})]})]})}case"dropdown":return e.jsxs(Pe,{value:l||"",onValueChange:r,disabled:f,children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:a.placeholder||"请选择..."})}),e.jsx(Ie,{children:a.options?.map(g=>e.jsx(W,{value:g.value,children:g.label},g.id))})]});default:return e.jsx("div",{className:"text-muted-foreground",children:"不支持的问题类型"})}};return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-base font-medium",children:[a.title,a.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:a.description})]}),p(),c&&e.jsx("p",{className:"text-sm text-destructive",children:c})]})}const EN="https://maibot-plugin-stats.maibot-webui.workers.dev";function MN(){const a="maibot_user_id";let l=localStorage.getItem(a);if(!l){const r=Math.random().toString(36).substring(2,10),c=Date.now().toString(36),d=Math.random().toString(36).substring(2,10);l=`fp_${r}_${c}_${d}`,localStorage.setItem(a,l)}return l}async function VC(a,l,r,c){try{const d=c?.userId||MN(),u={surveyId:a,surveyVersion:l,userId:d,answers:r,submittedAt:new Date().toISOString(),allowMultiple:c?.allowMultiple,metadata:{userAgent:navigator.userAgent,language:navigator.language}},h=await fetch(`${EN}/survey/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)}),f=await h.json();return h.status===429?{success:!1,error:"提交过于频繁,请稍后再试"}:h.status===409?{success:!1,error:f.error||"你已经提交过这份问卷了"}:h.ok?{success:!0,submissionId:f.submissionId,message:f.message}:{success:!1,error:f.error||"提交失败"}}catch(d){return console.error("Error submitting survey:",d),{success:!1,error:"网络错误"}}}async function GC(a,l){try{const r=l||MN(),c=new URLSearchParams({user_id:r,survey_id:a}),d=await fetch(`${EN}/survey/check?${c}`);return d.ok?{success:!0,hasSubmitted:(await d.json()).hasSubmitted}:{success:!1,error:(await d.json()).error||"检查失败"}}catch(r){return console.error("Error checking submission:",r),{success:!1,error:"网络错误"}}}function AN({config:a,initialAnswers:l,onSubmitSuccess:r,onSubmitError:c,showProgress:d=!0,paginateQuestions:u=!1,className:h}){const f=m.useCallback(()=>!l||l.length===0?{}:l.reduce(($,ue)=>($[ue.questionId]=ue.value,$),{}),[l]),[p,g]=m.useState(()=>f()),[b,j]=m.useState({}),[y,N]=m.useState(0),[w,M]=m.useState(!1),[A,S]=m.useState(!1),[U,E]=m.useState(null),[C,D]=m.useState(null),[P,O]=m.useState(!1),[J,L]=m.useState(!0);m.useEffect(()=>{l&&l.length>0&&g($=>({...$,...f()}))},[l,f]),m.useEffect(()=>{(async()=>{if(!a.settings?.allowMultiple){const ue=await GC(a.id);ue.success&&ue.hasSubmitted&&O(!0)}L(!1)})()},[a.id,a.settings?.allowMultiple]);const oe=m.useCallback(()=>{const $=new Date;return!(a.settings?.startTime&&new Date(a.settings.startTime)>$||a.settings?.endTime&&new Date(a.settings.endTime)<$)},[a.settings?.startTime,a.settings?.endTime]),Ne=a.questions.filter($=>{const ue=p[$.id];return ue==null?!1:Array.isArray(ue)?ue.length>0:typeof ue=="string"?ue.trim()!=="":!0}).length,je=Ne/a.questions.length*100,de=m.useCallback(($,ue)=>{g(G=>({...G,[$]:ue})),j(G=>{const Se={...G};return delete Se[$],Se})},[]),he=m.useCallback(()=>{const $={};for(const ue of a.questions){if(ue.required){const G=p[ue.id];if(G==null){$[ue.id]="此题为必填项";continue}if(Array.isArray(G)&&G.length===0){$[ue.id]="请至少选择一项";continue}if(typeof G=="string"&&G.trim()===""){$[ue.id]="此题为必填项";continue}}ue.minLength&&typeof p[ue.id]=="string"&&p[ue.id].length{if(!he()){if(u){const $=a.questions.findIndex(ue=>b[ue.id]);$>=0&&N($)}return}M(!0),E(null);try{const $=a.questions.filter(G=>p[G.id]!==void 0).map(G=>({questionId:G.id,value:p[G.id]})),ue=await VC(a.id,a.version,$,{allowMultiple:a.settings?.allowMultiple});if(ue.success&&ue.submissionId)S(!0),D(ue.submissionId),r?.(ue.submissionId);else{const G=ue.error||"提交失败";E(G),c?.(G)}}catch($){const ue=$ instanceof Error?$.message:"提交失败";E(ue),c?.(ue)}finally{M(!1)}},[he,u,a,p,b,r,c]),R=m.useCallback($=>{$>=0&&$e.jsxs("div",{className:F("p-4 rounded-lg border bg-card",b[$.id]?"border-destructive bg-destructive/5":"border-border"),children:[u&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:["问题 ",y+1," / ",a.questions.length]}),!u&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:[ue+1,"."]}),e.jsx(HC,{question:$,value:p[$.id],onChange:G=>de($.id,G),error:b[$.id],disabled:w})]},$.id)),U&&e.jsxs(it,{variant:"destructive",children:[e.jsx(Ct,{className:"h-4 w-4"}),e.jsx(ct,{children:U})]}),e.jsx("div",{className:"flex justify-between items-center py-4",children:u?e.jsxs(e.Fragment,{children:[e.jsxs(_,{variant:"outline",onClick:()=>R(y-1),disabled:y===0||w,children:[e.jsx(Da,{className:"h-4 w-4 mr-1"}),"上一题"]}),y===a.questions.length-1?e.jsxs(_,{onClick:ge,disabled:w,children:[w&&e.jsx(Os,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]}):e.jsxs(_,{onClick:()=>R(y+1),disabled:w,children:["下一题",e.jsx(sa,{className:"h-4 w-4 ml-1"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:Object.keys(b).length>0&&e.jsxs("span",{className:"text-destructive",children:["还有 ",Object.keys(b).length," 个必填项未完成"]})}),e.jsxs(_,{onClick:ge,disabled:w,size:"lg",children:[w&&e.jsx(Os,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]})]})})]})})]})}const qC={id:"webui-feedback-v1",version:"1.0.0",title:"麦麦 WebUI 使用反馈问卷",description:"感谢您使用麦麦 WebUI!您的反馈将帮助我们不断改进产品体验。",questions:[{id:"webui_version",type:"text",title:"你正在使用的 WebUI 版本",description:"此项由系统自动填写",required:!0,readOnly:!0,placeholder:"自动检测中..."},{id:"ui_design_satisfaction",type:"single",title:"你觉得当前的 WebUI 界面设计如何?",required:!0,options:[{id:"very_satisfied",label:"非常满意",value:"very_satisfied"},{id:"satisfied",label:"满意",value:"satisfied"},{id:"neutral",label:"一般",value:"neutral"},{id:"dissatisfied",label:"不满意",value:"dissatisfied"},{id:"very_dissatisfied",label:"非常不满意",value:"very_dissatisfied"}]},{id:"problems_encountered",type:"multiple",title:"你在使用 WebUI 时遇到过哪些问题?",description:"可多选",required:!0,options:[{id:"lag",label:"界面卡顿",value:"lag"},{id:"incomplete",label:"功能不完整",value:"incomplete"},{id:"complex",label:"操作复杂",value:"complex"},{id:"bugs",label:"存在 Bug",value:"bugs"},{id:"none",label:"没有遇到问题",value:"none"},{id:"other",label:"其他",value:"other"}]},{id:"problems_other",type:"text",title:'如选择"其他",请说明遇到的问题',required:!1,placeholder:"请描述你遇到的其他问题...",maxLength:500},{id:"useful_features",type:"textarea",title:"你觉得哪些功能是最有用的?",required:!0,placeholder:"请分享你认为最有价值的功能...",maxLength:1e3},{id:"feature_requests",type:"textarea",title:"你希望在未来的版本中增加哪些功能?",required:!0,placeholder:"请告诉我们你期望的新功能...",maxLength:1e3},{id:"overall_satisfaction",type:"single",title:"你对麦麦 WebUI 的整体满意度如何?",required:!0,options:[{id:"very_satisfied",label:"非常满意",value:"very_satisfied"},{id:"satisfied",label:"满意",value:"satisfied"},{id:"neutral",label:"一般",value:"neutral"},{id:"dissatisfied",label:"不满意",value:"dissatisfied"},{id:"very_dissatisfied",label:"非常不满意",value:"very_dissatisfied"}]},{id:"would_recommend",type:"single",title:"你愿意推荐麦麦 WebUI 给其他人使用吗?",required:!0,options:[{id:"yes",label:"是",value:"yes"},{id:"no",label:"否",value:"no"}]},{id:"other_suggestions",type:"textarea",title:"其他建议或意见",description:"此项为选填",required:!1,placeholder:"如果你有任何其他想法或建议,请在此分享...",maxLength:2e3}],settings:{allowMultiple:!1,thankYouMessage:"感谢你的反馈!你的意见对我们非常重要,我们会认真考虑每一条建议。"}},KC={id:"maibot-feedback-v1",version:"1.0.0",title:"麦麦使用体验反馈问卷",description:"感谢您使用麦麦!您的反馈将帮助我们打造更好的 AI 伙伴。",questions:[{id:"maibot_version",type:"text",title:"你正在使用的麦麦版本",description:"此项由系统自动填写",required:!0,readOnly:!0,placeholder:"自动检测中..."},{id:"improvement_areas",type:"textarea",title:"你认为麦麦还有哪些部分可以改进?",required:!0,placeholder:"请分享你认为可以改进的方面...",maxLength:1e3},{id:"problems_encountered",type:"multiple",title:"你在使用麦麦时遇到过哪些问题?",description:"可多选",required:!0,options:[{id:"incomplete",label:"功能不完整",value:"incomplete"},{id:"slow_response",label:"响应速度慢",value:"slow_response"},{id:"complex",label:"操作复杂",value:"complex"},{id:"unstable",label:"运行不稳定",value:"unstable"},{id:"config_difficult",label:"配置困难",value:"config_difficult"},{id:"none",label:"没有遇到问题",value:"none"},{id:"other",label:"其他",value:"other"}]},{id:"problems_other",type:"text",title:'如选择"其他",请说明遇到的问题',required:!1,placeholder:"请描述你遇到的其他问题...",maxLength:500},{id:"helpful_features",type:"textarea",title:"你觉得麦麦的哪些功能对你最有帮助?",required:!0,placeholder:"请分享对你最有帮助的功能...",maxLength:1e3},{id:"feature_requests",type:"textarea",title:"你希望在未来的版本中增加哪些功能?",required:!0,placeholder:"请告诉我们你期望的新功能...",maxLength:1e3},{id:"overall_satisfaction",type:"single",title:"你对麦麦的整体满意度如何?",required:!0,options:[{id:"very_satisfied",label:"非常满意",value:"very_satisfied"},{id:"satisfied",label:"满意",value:"satisfied"},{id:"neutral",label:"一般",value:"neutral"},{id:"dissatisfied",label:"不满意",value:"dissatisfied"},{id:"very_dissatisfied",label:"非常不满意",value:"very_dissatisfied"}]},{id:"would_recommend",type:"single",title:"你愿意推荐麦麦给其他人使用吗?",required:!0,options:[{id:"yes",label:"是",value:"yes"},{id:"no",label:"否",value:"no"}]},{id:"other_suggestions",type:"textarea",title:"其他建议或意见",description:"此项为选填",required:!1,placeholder:"如果你有任何其他想法或建议,请在此分享...",maxLength:2e3}],settings:{allowMultiple:!1,thankYouMessage:"感谢你的反馈!你的意见对麦麦的成长非常重要,我们会认真考虑每一条建议。"}};function QC(){const[a,l]=m.useState(!0),r=m.useMemo(()=>JSON.parse(JSON.stringify(qC)),[]);m.useEffect(()=>{l(!1)},[]);const c=m.useMemo(()=>[{questionId:"webui_version",value:`v${od}`}],[]),d=m.useCallback(h=>{console.log("WebUI Survey submitted:",h)},[]),u=m.useCallback(h=>{console.error("WebUI Survey submission error:",h)},[]);return a?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(Os,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r?e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(dv,{className:"h-8 w-8",strokeWidth:2}),"WebUI 使用反馈问卷"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"感谢您的反馈,帮助我们持续改进产品体验"})]}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(AN,{config:r,initialAnswers:c,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:d,onSubmitError:u})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(it,{variant:"destructive",className:"max-w-md",children:[e.jsx(Ct,{className:"h-4 w-4"}),e.jsx(ct,{children:"无法加载问卷配置"})]}),e.jsx(_,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}function YC(){const[a,l]=m.useState(null),[r,c]=m.useState(!0),[d,u]=m.useState("未知版本");m.useEffect(()=>{(async()=>{try{const j=await $1();u(j.version||"未知版本")}catch(j){console.error("Failed to get MaiBot version:",j),u("获取失败")}const b=JSON.parse(JSON.stringify(KC));l(b),c(!1)})()},[]);const h=m.useMemo(()=>[{questionId:"maibot_version",value:d}],[d]),f=m.useCallback(g=>{console.log("MaiBot Survey submitted:",g)},[]),p=m.useCallback(g=>{console.error("MaiBot Survey submission error:",g)},[]);return r?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(Os,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):a?e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(dv,{className:"h-8 w-8",strokeWidth:2}),"麦麦使用体验反馈问卷"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"感谢您的反馈,帮助我们打造更好的 AI 伙伴"})]}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(AN,{config:a,initialAnswers:h,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:f,onSubmitError:p})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(it,{variant:"destructive",className:"max-w-md",children:[e.jsx(Ct,{className:"h-4 w-4"}),e.jsx(ct,{children:"无法加载问卷配置"})]}),e.jsx(_,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}async function JC(a=2025){const l=await _e(`/api/webui/annual-report/full?year=${a}`);if(!l.ok){const r=await l.json();throw new Error(r.detail||"获取年度报告失败")}return l.json()}function XC(a,l){if(a.match(/^[a-z]+:\/\//i))return a;if(a.match(/^\/\//))return window.location.protocol+a;if(a.match(/^[a-z]+:/i))return a;const r=document.implementation.createHTMLDocument(),c=r.createElement("base"),d=r.createElement("a");return r.head.appendChild(c),r.body.appendChild(d),l&&(c.href=l),d.href=a,d.href}const ZC=(()=>{let a=0;const l=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(a+=1,`u${l()}${a}`)})();function pn(a){const l=[];for(let r=0,c=a.length;rCa||a.height>Ca)&&(a.width>Ca&&a.height>Ca?a.width>a.height?(a.height*=Ca/a.width,a.width=Ca):(a.width*=Ca/a.height,a.height=Ca):a.width>Ca?(a.height*=Ca/a.width,a.width=Ca):(a.width*=Ca/a.height,a.height=Ca))}function Wo(a){return new Promise((l,r)=>{const c=new Image;c.onload=()=>{c.decode().then(()=>{requestAnimationFrame(()=>l(c))})},c.onerror=r,c.crossOrigin="anonymous",c.decoding="async",c.src=a})}async function a3(a){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(a)).then(encodeURIComponent).then(l=>`data:image/svg+xml;charset=utf-8,${l}`)}async function l3(a,l,r){const c="http://www.w3.org/2000/svg",d=document.createElementNS(c,"svg"),u=document.createElementNS(c,"foreignObject");return d.setAttribute("width",`${l}`),d.setAttribute("height",`${r}`),d.setAttribute("viewBox",`0 0 ${l} ${r}`),u.setAttribute("width","100%"),u.setAttribute("height","100%"),u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("externalResourcesRequired","true"),d.appendChild(u),u.appendChild(a),a3(d)}const ga=(a,l)=>{if(a instanceof l)return!0;const r=Object.getPrototypeOf(a);return r===null?!1:r.constructor.name===l.name||ga(r,l)};function n3(a){const l=a.getPropertyValue("content");return`${a.cssText} content: '${l.replace(/'|"/g,"")}';`}function r3(a,l){return zN(l).map(r=>{const c=a.getPropertyValue(r),d=a.getPropertyPriority(r);return`${r}: ${c}${d?" !important":""};`}).join(" ")}function i3(a,l,r,c){const d=`.${a}:${l}`,u=r.cssText?n3(r):r3(r,c);return document.createTextNode(`${d}{${u}}`)}function ej(a,l,r,c){const d=window.getComputedStyle(a,r),u=d.getPropertyValue("content");if(u===""||u==="none")return;const h=ZC();try{l.className=`${l.className} ${h}`}catch{return}const f=document.createElement("style");f.appendChild(i3(h,r,d,c)),l.appendChild(f)}function c3(a,l,r){ej(a,l,":before",r),ej(a,l,":after",r)}const sj="application/font-woff",tj="image/jpeg",o3={woff:sj,woff2:sj,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:tj,jpeg:tj,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function d3(a){const l=/\.([^./]*?)$/g.exec(a);return l?l[1]:""}function Tx(a){const l=d3(a).toLowerCase();return o3[l]||""}function u3(a){return a.split(/,/)[1]}function ex(a){return a.search(/^(data:)/)!==-1}function m3(a,l){return`data:${l};base64,${a}`}async function DN(a,l,r){const c=await fetch(a,l);if(c.status===404)throw new Error(`Resource "${c.url}" not found`);const d=await c.blob();return new Promise((u,h)=>{const f=new FileReader;f.onerror=h,f.onloadend=()=>{try{u(r({res:c,result:f.result}))}catch(p){h(p)}},f.readAsDataURL(d)})}const Gm={};function x3(a,l,r){let c=a.replace(/\?.*/,"");return r&&(c=a),/ttf|otf|eot|woff2?/i.test(c)&&(c=c.replace(/.*\//,"")),l?`[${l}]${c}`:c}async function Ex(a,l,r){const c=x3(a,l,r.includeQueryParams);if(Gm[c]!=null)return Gm[c];r.cacheBust&&(a+=(/\?/.test(a)?"&":"?")+new Date().getTime());let d;try{const u=await DN(a,r.fetchRequestInit,({res:h,result:f})=>(l||(l=h.headers.get("Content-Type")||""),u3(f)));d=m3(u,l)}catch(u){d=r.imagePlaceholder||"";let h=`Failed to fetch resource: ${a}`;u&&(h=typeof u=="string"?u:u.message),h&&console.warn(h)}return Gm[c]=d,d}async function h3(a){const l=a.toDataURL();return l==="data:,"?a.cloneNode(!1):Wo(l)}async function f3(a,l){if(a.currentSrc){const u=document.createElement("canvas"),h=u.getContext("2d");u.width=a.clientWidth,u.height=a.clientHeight,h?.drawImage(a,0,0,u.width,u.height);const f=u.toDataURL();return Wo(f)}const r=a.poster,c=Tx(r),d=await Ex(r,c,l);return Wo(d)}async function p3(a,l){var r;try{if(!((r=a?.contentDocument)===null||r===void 0)&&r.body)return await pd(a.contentDocument.body,l,!0)}catch{}return a.cloneNode(!1)}async function g3(a,l){return ga(a,HTMLCanvasElement)?h3(a):ga(a,HTMLVideoElement)?f3(a,l):ga(a,HTMLIFrameElement)?p3(a,l):a.cloneNode(ON(a))}const j3=a=>a.tagName!=null&&a.tagName.toUpperCase()==="SLOT",ON=a=>a.tagName!=null&&a.tagName.toUpperCase()==="SVG";async function v3(a,l,r){var c,d;if(ON(l))return l;let u=[];return j3(a)&&a.assignedNodes?u=pn(a.assignedNodes()):ga(a,HTMLIFrameElement)&&(!((c=a.contentDocument)===null||c===void 0)&&c.body)?u=pn(a.contentDocument.body.childNodes):u=pn(((d=a.shadowRoot)!==null&&d!==void 0?d:a).childNodes),u.length===0||ga(a,HTMLVideoElement)||await u.reduce((h,f)=>h.then(()=>pd(f,r)).then(p=>{p&&l.appendChild(p)}),Promise.resolve()),l}function N3(a,l,r){const c=l.style;if(!c)return;const d=window.getComputedStyle(a);d.cssText?(c.cssText=d.cssText,c.transformOrigin=d.transformOrigin):zN(r).forEach(u=>{let h=d.getPropertyValue(u);u==="font-size"&&h.endsWith("px")&&(h=`${Math.floor(parseFloat(h.substring(0,h.length-2)))-.1}px`),ga(a,HTMLIFrameElement)&&u==="display"&&h==="inline"&&(h="block"),u==="d"&&l.getAttribute("d")&&(h=`path(${l.getAttribute("d")})`),c.setProperty(u,h,d.getPropertyPriority(u))})}function b3(a,l){ga(a,HTMLTextAreaElement)&&(l.innerHTML=a.value),ga(a,HTMLInputElement)&&l.setAttribute("value",a.value)}function y3(a,l){if(ga(a,HTMLSelectElement)){const c=Array.from(l.children).find(d=>a.value===d.getAttribute("value"));c&&c.setAttribute("selected","")}}function w3(a,l,r){return ga(l,Element)&&(N3(a,l,r),c3(a,l,r),b3(a,l),y3(a,l)),l}async function _3(a,l){const r=a.querySelectorAll?a.querySelectorAll("use"):[];if(r.length===0)return a;const c={};for(let u=0;ug3(c,l)).then(c=>v3(a,c,l)).then(c=>w3(a,c,l)).then(c=>_3(c,l))}const LN=/url\((['"]?)([^'"]+?)\1\)/g,S3=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,k3=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function C3(a){const l=a.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${l})(['"]?\\))`,"g")}function T3(a){const l=[];return a.replace(LN,(r,c,d)=>(l.push(d),r)),l.filter(r=>!ex(r))}async function E3(a,l,r,c,d){try{const u=r?XC(l,r):l,h=Tx(l);let f;return d||(f=await Ex(u,h,c)),a.replace(C3(l),`$1${f}$3`)}catch{}return a}function M3(a,{preferredFontFormat:l}){return l?a.replace(k3,r=>{for(;;){const[c,,d]=S3.exec(r)||[];if(!d)return"";if(d===l)return`src: ${c};`}}):a}function UN(a){return a.search(LN)!==-1}async function $N(a,l,r){if(!UN(a))return a;const c=M3(a,r);return T3(c).reduce((u,h)=>u.then(f=>E3(f,h,l,r)),Promise.resolve(c))}async function Fr(a,l,r){var c;const d=(c=l.style)===null||c===void 0?void 0:c.getPropertyValue(a);if(d){const u=await $N(d,null,r);return l.style.setProperty(a,u,l.style.getPropertyPriority(a)),!0}return!1}async function A3(a,l){await Fr("background",a,l)||await Fr("background-image",a,l),await Fr("mask",a,l)||await Fr("-webkit-mask",a,l)||await Fr("mask-image",a,l)||await Fr("-webkit-mask-image",a,l)}async function z3(a,l){const r=ga(a,HTMLImageElement);if(!(r&&!ex(a.src))&&!(ga(a,SVGImageElement)&&!ex(a.href.baseVal)))return;const c=r?a.src:a.href.baseVal,d=await Ex(c,Tx(c),l);await new Promise((u,h)=>{a.onload=u,a.onerror=l.onImageErrorHandler?(...p)=>{try{u(l.onImageErrorHandler(...p))}catch(g){h(g)}}:h;const f=a;f.decode&&(f.decode=u),f.loading==="lazy"&&(f.loading="eager"),r?(a.srcset="",a.src=d):a.href.baseVal=d})}async function R3(a,l){const c=pn(a.childNodes).map(d=>BN(d,l));await Promise.all(c).then(()=>a)}async function BN(a,l){ga(a,Element)&&(await A3(a,l),await z3(a,l),await R3(a,l))}function D3(a,l){const{style:r}=a;l.backgroundColor&&(r.backgroundColor=l.backgroundColor),l.width&&(r.width=`${l.width}px`),l.height&&(r.height=`${l.height}px`);const c=l.style;return c!=null&&Object.keys(c).forEach(d=>{r[d]=c[d]}),a}const aj={};async function lj(a){let l=aj[a];if(l!=null)return l;const c=await(await fetch(a)).text();return l={url:a,cssText:c},aj[a]=l,l}async function nj(a,l){let r=a.cssText;const c=/url\(["']?([^"')]+)["']?\)/g,u=(r.match(/url\([^)]+\)/g)||[]).map(async h=>{let f=h.replace(c,"$1");return f.startsWith("https://")||(f=new URL(f,a.url).href),DN(f,l.fetchRequestInit,({result:p})=>(r=r.replace(h,`url(${p})`),[h,p]))});return Promise.all(u).then(()=>r)}function rj(a){if(a==null)return[];const l=[],r=/(\/\*[\s\S]*?\*\/)/gi;let c=a.replace(r,"");const d=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const p=d.exec(c);if(p===null)break;l.push(p[0])}c=c.replace(d,"");const u=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,h="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",f=new RegExp(h,"gi");for(;;){let p=u.exec(c);if(p===null){if(p=f.exec(c),p===null)break;u.lastIndex=f.lastIndex}else f.lastIndex=u.lastIndex;l.push(p[0])}return l}async function O3(a,l){const r=[],c=[];return a.forEach(d=>{if("cssRules"in d)try{pn(d.cssRules||[]).forEach((u,h)=>{if(u.type===CSSRule.IMPORT_RULE){let f=h+1;const p=u.href,g=lj(p).then(b=>nj(b,l)).then(b=>rj(b).forEach(j=>{try{d.insertRule(j,j.startsWith("@import")?f+=1:d.cssRules.length)}catch(y){console.error("Error inserting rule from remote css",{rule:j,error:y})}})).catch(b=>{console.error("Error loading remote css",b.toString())});c.push(g)}})}catch(u){const h=a.find(f=>f.href==null)||document.styleSheets[0];d.href!=null&&c.push(lj(d.href).then(f=>nj(f,l)).then(f=>rj(f).forEach(p=>{h.insertRule(p,h.cssRules.length)})).catch(f=>{console.error("Error loading remote stylesheet",f)})),console.error("Error inlining remote css file",u)}}),Promise.all(c).then(()=>(a.forEach(d=>{if("cssRules"in d)try{pn(d.cssRules||[]).forEach(u=>{r.push(u)})}catch(u){console.error(`Error while reading CSS rules from ${d.href}`,u)}}),r))}function L3(a){return a.filter(l=>l.type===CSSRule.FONT_FACE_RULE).filter(l=>UN(l.style.getPropertyValue("src")))}async function U3(a,l){if(a.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=pn(a.ownerDocument.styleSheets),c=await O3(r,l);return L3(c)}function IN(a){return a.trim().replace(/["']/g,"")}function $3(a){const l=new Set;function r(c){(c.style.fontFamily||getComputedStyle(c).fontFamily).split(",").forEach(u=>{l.add(IN(u))}),Array.from(c.children).forEach(u=>{u instanceof HTMLElement&&r(u)})}return r(a),l}async function B3(a,l){const r=await U3(a,l),c=$3(a);return(await Promise.all(r.filter(u=>c.has(IN(u.style.fontFamily))).map(u=>{const h=u.parentStyleSheet?u.parentStyleSheet.href:null;return $N(u.cssText,h,l)}))).join(` -`)}async function I3(a,l){const r=l.fontEmbedCSS!=null?l.fontEmbedCSS:l.skipFonts?null:await B3(a,l);if(r){const c=document.createElement("style"),d=document.createTextNode(r);c.appendChild(d),a.firstChild?a.insertBefore(c,a.firstChild):a.appendChild(c)}}async function P3(a,l={}){const{width:r,height:c}=RN(a,l),d=await pd(a,l,!0);return await I3(d,l),await BN(d,l),D3(d,l),await l3(d,r,c)}async function F3(a,l={}){const{width:r,height:c}=RN(a,l),d=await P3(a,l),u=await Wo(d),h=document.createElement("canvas"),f=h.getContext("2d"),p=l.pixelRatio||s3(),g=l.canvasWidth||r,b=l.canvasHeight||c;return h.width=g*p,h.height=b*p,l.skipAutoScale||t3(h),h.style.width=`${g}`,h.style.height=`${b}`,l.backgroundColor&&(f.fillStyle=l.backgroundColor,f.fillRect(0,0,h.width,h.height)),f.drawImage(u,0,0,h.width,h.height),h}async function H3(a,l={}){return(await F3(a,l)).toDataURL()}const Lo=["#0088FE","#00C49F","#FFBB28","#FF8042","#8884d8","#82ca9d"];function V3(a){return a>=8760?"相当于全年无休,7x24小时在线!":a>=5e3?"相当于一位全职员工的年工作时长":a>=2e3?"相当于看完了 1000 部电影":a>=1e3?"相当于环球飞行 80 次":a>=500?"相当于读完了 100 本书":a>=100?"相当于马拉松跑了 25 次":"虽然不多,但每一刻都很珍贵"}function G3(a){return a>=1e3?"夜深人静时的知心好友":a>=500?"午夜场的常客":a>=100?"偶尔熬夜的小伙伴":a>=50?"深夜有时也会陪你聊聊":"早睡早起,健康作息"}function q3(a){const l=a/1e6;return l>=100?"思考量堪比一座图书馆":l>=50?"相当于写了一部百科全书":l>=10?"脑细胞估计消耗了不少":l>=1?"也算是费了一番脑筋":"轻轻松松,游刃有余"}function K3(a){return a>=1e3?"这钱够吃一年的泡面了":a>=500?"相当于买了一台游戏机":a>=100?"够请大家喝几杯奶茶":a>=50?"一顿火锅的钱":a>=10?"几杯咖啡的价格":"省钱小能手"}function Q3(a){return a>=80?"沉默是金,惜字如金":a>=60?"话不多但句句到位":a>=40?"该说的时候才开口":a>=20?"能聊的都聊了":"话痨本痨,有问必答"}function Y3(a){return a>=1e4?"眼睛都快看花了":a>=5e3?"堪比专业摄影师的阅片量":a>=1e3?"看图小达人":a>=500?"图片鉴赏家":a>=100?"偶尔欣赏一下美图":"图片?有空再看"}function J3(a){return a>=500?"在不断的纠正中成长":a>=200?"学习永无止境":a>=100?"虚心接受,积极改正":a>=50?"偶尔也会犯错":a>=10?"表现还算不错":"完美表达,无需纠正"}function X3(a){return a>=1?"这次思考的价值堪比一顿大餐!":a>=.5?"为了这个问题,我可是认真思考了!":a>=.1?"下了点功夫,值得的!":a>=.01?"花了点小钱,但很值得":"小小思考,不足挂齿"}function Z3(a,l){return a>=100?"这句话简直是万能钥匙!":a>=50?"百试不爽的经典回复":a>=20?`${l}的口头禅`:a>=10?"常用语录之一":"偶尔用用的小确幸"}function W3(a,l){return a?l>=1e3?"深夜的守护者,黑暗中的光芒":l>=500?"月亮是我的好朋友":l>=100?"越夜越精神,夜晚才是主场":"偶尔熬夜,享受宁静时光":l<=10?"作息规律,健康生活的典范":l<=50?"早睡早起,偶尔也会熬个夜":"虽然是早起鸟,但也会守候深夜"}function e5(a){return a>=1e3?"忙到飞起,键盘都要冒烟了":a>=500?"这天简直是话痨附体":a>=200?"社交达人上线":a>=100?"比平时活跃不少":a>=50?"小忙一下":"还算轻松的一天"}function s5(){const[a]=m.useState(2025),[l,r]=m.useState(null),[c,d]=m.useState(!0),[u,h]=m.useState(!1),[f,p]=m.useState(null),g=m.useRef(null),{toast:b}=Ws(),j=m.useCallback(async()=>{try{d(!0),p(null);const N=await JC(a);r(N)}catch(N){p(N instanceof Error?N:new Error("获取年度报告失败"))}finally{d(!1)}},[a]),y=m.useCallback(async()=>{if(!(!g.current||!l)){h(!0),b({title:"正在生成图片",description:"请稍候..."});try{const N=g.current,w=getComputedStyle(document.documentElement),M=w.getPropertyValue("--background").trim()?`hsl(${w.getPropertyValue("--background").trim()})`:document.documentElement.classList.contains("dark")?"#0a0a0a":"#ffffff",A=N.style.width,S=N.style.maxWidth;N.style.width="1024px",N.style.maxWidth="1024px";const U=await H3(N,{quality:1,pixelRatio:2,backgroundColor:M,cacheBust:!0,filter:C=>!(C instanceof HTMLElement&&C.hasAttribute("data-export-btn"))});N.style.width=A,N.style.maxWidth=S;const E=document.createElement("a");E.download=`${l.bot_name}_${l.year}_年度总结.png`,E.href=U,E.click(),b({title:"导出成功",description:"年度报告已保存为图片"})}catch(N){console.error("导出图片失败:",N),b({title:"导出失败",description:"请重试",variant:"destructive"})}finally{h(!1)}}},[l,b]);return m.useEffect(()=>{j()},[j]),c?e.jsx(t5,{}):f?e.jsxs("div",{className:"flex h-screen items-center justify-center text-red-500",children:["获取年度报告失败: ",f.message]}):l?e.jsx(Ze,{className:"h-[calc(100vh-4rem)]",children:e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-background to-muted/50 p-4 md:p-8 print:p-0",ref:g,children:e.jsxs("div",{className:"mx-auto max-w-5xl space-y-8 print:space-y-4",children:[e.jsxs("header",{className:"relative overflow-hidden rounded-3xl bg-primary p-8 text-primary-foreground shadow-2xl print:rounded-none print:shadow-none",children:[e.jsx("div",{className:"absolute right-4 top-4 z-20 print:hidden","data-export-btn":!0,children:e.jsx(_,{variant:"secondary",size:"sm",onClick:y,disabled:u,className:"gap-2 bg-white/20 hover:bg-white/30 text-white border-white/30",children:u?e.jsxs(e.Fragment,{children:[e.jsx(Os,{className:"h-4 w-4 animate-spin"}),"导出中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Wt,{className:"h-4 w-4"}),"保存图片"]})})}),e.jsxs("div",{className:"relative z-10 flex flex-col items-center text-center",children:[e.jsx(Vn,{className:"mb-4 h-16 w-16 animate-bounce"}),e.jsxs("h1",{className:"text-4xl font-bold tracking-tighter sm:text-6xl",children:[l.bot_name," ",l.year," 年度总结"]}),e.jsx("p",{className:"mt-4 max-w-2xl text-lg opacity-90",children:"连接与成长 · Connection & Growth"}),e.jsxs("div",{className:"mt-6 flex items-center gap-2 text-sm opacity-75",children:[e.jsx(Go,{className:"h-4 w-4"}),e.jsxs("span",{children:["生成时间: ",l.generated_at]})]})]}),e.jsx("div",{className:"absolute -right-20 -top-20 h-64 w-64 rounded-full bg-white/10 blur-3xl"}),e.jsx("div",{className:"absolute -bottom-20 -left-20 h-64 w-64 rounded-full bg-white/10 blur-3xl"})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(na,{className:"h-8 w-8"}),e.jsx("h2",{children:"时光足迹"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[e.jsx(Ta,{title:"年度在线时长",value:`${l.time_footprint.total_online_hours} 小时`,description:V3(l.time_footprint.total_online_hours),icon:e.jsx(na,{className:"h-4 w-4"})}),e.jsx(Ta,{title:"最忙碌的一天",value:l.time_footprint.busiest_day||"N/A",description:e5(l.time_footprint.busiest_day_count),icon:e.jsx(Go,{className:"h-4 w-4"})}),e.jsx(Ta,{title:"深夜互动 (0-4点)",value:`${l.time_footprint.midnight_chat_count} 次`,description:G3(l.time_footprint.midnight_chat_count),icon:e.jsx(ec,{className:"h-4 w-4"})}),e.jsx(Ta,{title:"作息属性",value:l.time_footprint.is_night_owl?"夜猫子":"早起鸟",description:W3(l.time_footprint.is_night_owl,l.time_footprint.midnight_chat_count),icon:l.time_footprint.is_night_owl?e.jsx(ec,{className:"h-4 w-4"}):e.jsx(lx,{className:"h-4 w-4"})})]}),e.jsxs(ke,{className:"overflow-hidden",children:[e.jsxs(Re,{children:[e.jsx(De,{children:"24小时活跃时钟"}),e.jsxs(is,{children:[l.bot_name,"在一天中各个时段的活跃程度"]})]}),e.jsx(Me,{className:"h-[300px]",children:e.jsx(Aj,{width:"100%",height:"100%",children:e.jsxs(Uo,{data:l.time_footprint.hourly_distribution.map((N,w)=>({hour:`${w}点`,count:N})),children:[e.jsx(Qi,{strokeDasharray:"3 3",vertical:!1}),e.jsx(Yi,{dataKey:"hour"}),e.jsx(Hr,{}),e.jsx(zj,{contentStyle:{borderRadius:"8px",border:"none",boxShadow:"0 4px 12px rgba(0,0,0,0.1)"},cursor:{fill:"transparent"}}),e.jsx(Ji,{dataKey:"count",fill:"hsl(var(--primary))",radius:[4,4,0,0]})]})})})]}),l.time_footprint.first_message_time&&e.jsx(ke,{className:"bg-muted/30 border-dashed",children:e.jsxs(Me,{className:"flex flex-col items-center justify-center p-6 text-center",children:[e.jsx("p",{className:"text-muted-foreground mb-2",children:"2025年的故事开始于"}),e.jsx("div",{className:"text-xl font-bold text-primary mb-1",children:l.time_footprint.first_message_time}),e.jsxs("p",{className:"text-lg",children:[e.jsx("span",{className:"font-semibold text-foreground",children:l.time_footprint.first_message_user})," 说:",e.jsxs("span",{className:"italic text-muted-foreground",children:['"',l.time_footprint.first_message_content,'"']})]})]})})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(ic,{className:"h-8 w-8"}),e.jsx("h2",{children:"社交网络"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(Ta,{title:"社交圈子",value:`${l.social_network.total_groups} 个群组`,description:`${l.bot_name}加入的群组总数`,icon:e.jsx(ic,{className:"h-4 w-4"})}),e.jsx(Ta,{title:"被呼叫次数",value:`${l.social_network.at_count+l.social_network.mentioned_count} 次`,description:"我的名字被大家频繁提起",icon:e.jsx(q_,{className:"h-4 w-4"})}),e.jsx(Ta,{title:"最长情陪伴",value:l.social_network.longest_companion_user||"N/A",description:`始终都在,已陪伴 ${l.social_network.longest_companion_days} 天`,icon:e.jsx(Xr,{className:"h-4 w-4 text-red-500"})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(ke,{children:[e.jsx(Re,{children:e.jsx(De,{children:"话痨群组 TOP5"})}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-3",children:l.social_network.top_groups.length>0?l.social_network.top_groups.map((N,w)=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ce,{variant:w===0?"default":"secondary",className:"h-6 w-6 rounded-full p-0 flex items-center justify-center shrink-0",children:w+1}),e.jsx("span",{className:"font-medium truncate max-w-[120px]",children:N.group_name}),N.is_webui&&e.jsx(Ce,{variant:"outline",className:"text-xs px-1.5 py-0 h-5 bg-blue-50 text-blue-600 border-blue-200",children:"WebUI"})]}),e.jsxs("span",{className:"text-muted-foreground text-sm shrink-0",children:[N.message_count," 条消息"]})]},N.group_id)):e.jsx("div",{className:"text-center text-muted-foreground py-4",children:"暂无数据"})})})]}),e.jsxs(ke,{children:[e.jsx(Re,{children:e.jsx(De,{children:"年度最佳损友 TOP5"})}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-3",children:l.social_network.top_users.length>0?l.social_network.top_users.map((N,w)=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ce,{variant:w===0?"default":"secondary",className:"h-6 w-6 rounded-full p-0 flex items-center justify-center shrink-0",children:w+1}),e.jsx("span",{className:"font-medium truncate max-w-[120px]",children:N.user_nickname}),N.is_webui&&e.jsx(Ce,{variant:"outline",className:"text-xs px-1.5 py-0 h-5 bg-blue-50 text-blue-600 border-blue-200",children:"WebUI"})]}),e.jsxs("span",{className:"text-muted-foreground text-sm shrink-0",children:[N.message_count," 次互动"]})]},N.user_id)):e.jsx("div",{className:"text-center text-muted-foreground py-4",children:"暂无数据"})})})]})]})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(ox,{className:"h-8 w-8"}),e.jsx("h2",{children:"最强大脑"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[e.jsx(Ta,{title:"年度 Token 消耗",value:(l.brain_power.total_tokens/1e6).toFixed(2)+" M",description:q3(l.brain_power.total_tokens),icon:e.jsx(el,{className:"h-4 w-4"})}),e.jsx(Ta,{title:"年度总花费",value:`$${l.brain_power.total_cost.toFixed(2)}`,description:K3(l.brain_power.total_cost),icon:e.jsx("span",{className:"font-bold",children:"$"})}),e.jsx(Ta,{title:"高冷指数",value:`${l.brain_power.silence_rate}%`,description:Q3(l.brain_power.silence_rate),icon:e.jsx(ec,{className:"h-4 w-4"})}),e.jsx(Ta,{title:"最高兴趣值",value:l.brain_power.max_interest_value??"N/A",description:l.brain_power.max_interest_time?`出现在 ${l.brain_power.max_interest_time}`:"暂无数据",icon:e.jsx(Xr,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(ke,{children:[e.jsx(Re,{children:e.jsx(De,{children:"模型偏好分布"})}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-3",children:l.brain_power.model_distribution.slice(0,5).map((N,w)=>{const M=l.brain_power.model_distribution[0]?.count||1,A=Math.round(N.count/M*100);return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"font-medium truncate max-w-[200px]",children:N.model}),e.jsxs("span",{className:"text-muted-foreground",children:[N.count.toLocaleString()," 次"]})]}),e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:e.jsx("div",{className:"h-full transition-all duration-500",style:{width:`${A}%`,backgroundColor:Lo[w%Lo.length]}})})]},N.model)})})})]}),l.brain_power.top_reply_models&&l.brain_power.top_reply_models.length>0&&e.jsxs(ke,{children:[e.jsxs(Re,{children:[e.jsx(De,{children:"最喜欢的回复模型 TOP5"}),e.jsxs(is,{children:[l.bot_name,"用来回复消息的模型偏好"]})]}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-3",children:l.brain_power.top_reply_models.map((N,w)=>{const M=l.brain_power.top_reply_models[0]?.count||1,A=Math.round(N.count/M*100);return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"font-medium truncate max-w-[200px]",children:N.model}),e.jsxs("span",{className:"text-muted-foreground",children:[N.count.toLocaleString()," 次"]})]}),e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:e.jsx("div",{className:"h-full transition-all duration-500",style:{width:`${A}%`,backgroundColor:Lo[w%Lo.length]}})})]},N.model)})})})]}),l.brain_power.top_token_consumers&&l.brain_power.top_token_consumers.length>0&&e.jsxs(ke,{children:[e.jsxs(Re,{children:[e.jsx(De,{children:"烧钱大户 TOP3"}),e.jsx(is,{children:"谁消耗了最多的 API 额度"})]}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-6",children:l.brain_power.top_token_consumers.map(N=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between text-sm font-medium",children:[e.jsxs("span",{children:["用户 ",N.user_id]}),e.jsxs("span",{children:["$",N.cost.toFixed(2)]})]}),e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:e.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${N.cost/(l.brain_power.top_token_consumers[0]?.cost||1)*100}%`}})})]},N.user_id))})})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(ke,{className:"bg-gradient-to-br from-amber-50 to-orange-50 dark:from-amber-950/20 dark:to-orange-950/20",children:[e.jsx(Re,{children:e.jsxs(De,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"💰"}),"最昂贵的一次思考"]})}),e.jsxs(Me,{className:"text-center",children:[e.jsxs("div",{className:"text-4xl font-bold text-amber-600 dark:text-amber-400",children:["$",l.brain_power.most_expensive_cost.toFixed(4)]}),l.brain_power.most_expensive_time&&e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["发生在 ",l.brain_power.most_expensive_time]}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:X3(l.brain_power.most_expensive_cost)})]})]}),e.jsxs(ke,{className:"bg-gradient-to-br from-indigo-50 to-blue-50 dark:from-indigo-950/20 dark:to-blue-950/20",children:[e.jsx(Re,{children:e.jsxs(De,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"🧠"}),"思考深度"]})}),e.jsxs(Me,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-center",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-indigo-600 dark:text-indigo-400",children:l.brain_power.avg_reasoning_length?.toFixed(0)||0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"平均思考字数"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-blue-600 dark:text-blue-400",children:l.brain_power.max_reasoning_length?.toLocaleString()||0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"最长思考字数"})]})]}),l.brain_power.max_reasoning_time&&e.jsxs("p",{className:"mt-4 text-center text-xs text-muted-foreground",children:["最深沉的思考发生在 ",l.brain_power.max_reasoning_time]})]})]})]})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(ld,{className:"h-8 w-8"}),e.jsx("h2",{children:"个性与表达"})]}),(l.expression_vibe.late_night_reply||l.expression_vibe.favorite_reply)&&e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[l.expression_vibe.late_night_reply&&e.jsxs(ke,{className:"bg-gradient-to-br from-indigo-50 to-violet-50 dark:from-indigo-950/20 dark:to-violet-950/20",children:[e.jsxs(Re,{children:[e.jsxs(De,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"🌙"}),"深夜还在回复"]}),e.jsxs(is,{children:["凌晨 ",l.expression_vibe.late_night_reply.time,",",l.bot_name,"还在回复..."]})]}),e.jsxs(Me,{className:"text-center",children:[e.jsxs("p",{className:"text-lg italic text-muted-foreground",children:['"',l.expression_vibe.late_night_reply.content,'"']}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"是有什么心事吗?"})]})]}),l.expression_vibe.favorite_reply&&e.jsxs(ke,{className:"bg-gradient-to-br from-rose-50 to-pink-50 dark:from-rose-950/20 dark:to-pink-950/20",children:[e.jsxs(Re,{children:[e.jsxs(De,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"💬"}),"最喜欢的回复"]}),e.jsxs(is,{children:["使用了 ",l.expression_vibe.favorite_reply.count," 次"]})]}),e.jsxs(Me,{className:"text-center",children:[e.jsxs("p",{className:"text-lg font-medium text-primary",children:['"',l.expression_vibe.favorite_reply.content,'"']}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:Z3(l.expression_vibe.favorite_reply.count,l.bot_name)})]})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(ke,{className:"bg-gradient-to-br from-pink-50 to-purple-50 dark:from-pink-950/20 dark:to-purple-950/20",children:[e.jsxs(Re,{children:[e.jsx(De,{children:"使用最多的表情包 TOP3"}),e.jsx(is,{children:"年度最爱的表情包们"})]}),e.jsx(Me,{children:l.expression_vibe.top_emojis&&l.expression_vibe.top_emojis.length>0?e.jsx("div",{className:"flex justify-center gap-4",children:l.expression_vibe.top_emojis.slice(0,3).map((N,w)=>e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:`/api/webui/emoji/${N.id}/thumbnail?original=true`,alt:`TOP ${w+1}`,className:"h-24 w-24 rounded-lg object-cover shadow-md transition-transform hover:scale-105"}),e.jsx(Ce,{className:F("absolute -top-2 -right-2",w===0?"bg-yellow-500":w===1?"bg-gray-400":"bg-amber-700"),children:w+1})]}),e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[N.usage_count," 次"]})]},N.id))}):e.jsx("div",{className:"flex h-32 items-center justify-center text-muted-foreground",children:"暂无数据"})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ke,{children:[e.jsxs(Re,{children:[e.jsx(De,{children:"印象最深刻的表达风格"}),e.jsxs(is,{children:[l.bot_name,"最常使用的表达方式"]})]}),e.jsx(Me,{children:e.jsx("div",{className:"flex flex-wrap gap-2",children:l.expression_vibe.top_expressions.map((N,w)=>e.jsxs(Ce,{variant:"outline",className:F("px-3 py-1 text-sm",w===0&&"border-primary bg-primary/10 text-primary text-base px-4 py-2"),children:[N.style," (",N.count,")"]},N.style))})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Ta,{title:"图片鉴赏",value:`${l.expression_vibe.image_processed_count} 张`,description:Y3(l.expression_vibe.image_processed_count),icon:e.jsx(cx,{className:"h-4 w-4"})}),e.jsx(Ta,{title:"成长的足迹",value:`${l.expression_vibe.rejected_expression_count} 次`,description:J3(l.expression_vibe.rejected_expression_count),icon:e.jsx(el,{className:"h-4 w-4"})})]})]})]}),l.expression_vibe.action_types.length>0&&e.jsxs(ke,{children:[e.jsxs(Re,{children:[e.jsxs(De,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"⚡"}),"行动派"]}),e.jsx(is,{children:"除了聊天,我还帮大家做了这些事"})]}),e.jsx(Me,{children:e.jsx("div",{className:"flex flex-wrap gap-3",children:l.expression_vibe.action_types.map(N=>e.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-primary/10 px-4 py-2",children:[e.jsx("span",{className:"font-medium text-primary",children:N.action}),e.jsxs(Ce,{variant:"secondary",children:[N.count," 次"]})]},N.action))})})]})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(K_,{className:"h-8 w-8"}),e.jsx("h2",{children:"趣味成就"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs(ke,{className:"col-span-1 md:col-span-2",children:[e.jsxs(Re,{children:[e.jsx(De,{children:'新学到的"黑话"'}),e.jsxs(is,{children:["今年我学会了 ",l.achievements.new_jargon_count," 个新词"]})]}),e.jsx(Me,{children:e.jsx("div",{className:"flex flex-wrap gap-3",children:l.achievements.sample_jargons.map(N=>e.jsxs("div",{className:"group relative rounded-lg border bg-card p-3 shadow-sm transition-all hover:shadow-md",children:[e.jsx("div",{className:"font-bold text-primary",children:N.content}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1 line-clamp-2 max-w-[200px]",children:N.meaning||"暂无解释"})]},N.content))})})]}),e.jsx(ke,{className:"flex flex-col justify-center items-center bg-primary text-primary-foreground",children:e.jsxs(Me,{className:"flex flex-col items-center justify-center p-6 text-center",children:[e.jsx(Ra,{className:"h-12 w-12 mb-4 opacity-80"}),e.jsx("div",{className:"text-4xl font-bold mb-2",children:l.achievements.total_messages.toLocaleString()}),e.jsx("div",{className:"text-sm opacity-80",children:"年度总消息数"}),e.jsxs("div",{className:"mt-4 text-xs opacity-60",children:["其中回复了 ",l.achievements.total_replies.toLocaleString()," 次"]})]})})]})]}),e.jsxs("footer",{className:"mt-12 text-center text-muted-foreground",children:[e.jsx("p",{children:"MaiBot 2025 Annual Report"}),e.jsx("p",{className:"text-sm",children:"Generated with ❤️ by MaiBot Team"})]})]})})}):null}function Ta({title:a,value:l,description:r,icon:c}){return e.jsxs(ke,{children:[e.jsxs(Re,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(De,{className:"text-sm font-medium",children:a}),e.jsx("div",{className:"text-muted-foreground",children:c})]}),e.jsxs(Me,{children:[e.jsx("div",{className:"text-2xl font-bold",children:l}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r})]})]})}function t5(){return e.jsxs("div",{className:"container mx-auto space-y-8 p-8",children:[e.jsx(ws,{className:"h-64 w-full rounded-3xl"}),e.jsx("div",{className:"grid gap-4 md:grid-cols-4",children:[...Array(4)].map((a,l)=>e.jsx(ws,{className:"h-32 w-full"},l))}),e.jsx(ws,{className:"h-96 w-full"})]})}var gd="DropdownMenu",[a5]=td(gd,[Ej]),oa=Ej(),[l5,PN]=a5(gd),FN=a=>{const{__scopeDropdownMenu:l,children:r,dir:c,open:d,defaultOpen:u,onOpenChange:h,modal:f=!0}=a,p=oa(l),g=m.useRef(null),[b,j]=sd({prop:d,defaultProp:u??!1,onChange:h,caller:gd});return e.jsx(l5,{scope:l,triggerId:Km(),triggerRef:g,contentId:Km(),open:b,onOpenChange:j,onOpenToggle:m.useCallback(()=>j(y=>!y),[j]),modal:f,children:e.jsx(Uw,{...p,open:b,onOpenChange:j,dir:c,modal:f,children:r})})};FN.displayName=gd;var HN="DropdownMenuTrigger",VN=m.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,disabled:c=!1,...d}=a,u=PN(HN,r),h=oa(r);return e.jsx($w,{asChild:!0,...h,children:e.jsx(Zn.button,{type:"button",id:u.triggerId,"aria-haspopup":"menu","aria-expanded":u.open,"aria-controls":u.open?u.contentId:void 0,"data-state":u.open?"open":"closed","data-disabled":c?"":void 0,disabled:c,...d,ref:m_(l,u.triggerRef),onPointerDown:gn(a.onPointerDown,f=>{!c&&f.button===0&&f.ctrlKey===!1&&(u.onOpenToggle(),u.open||f.preventDefault())}),onKeyDown:gn(a.onKeyDown,f=>{c||(["Enter"," "].includes(f.key)&&u.onOpenToggle(),f.key==="ArrowDown"&&u.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(f.key)&&f.preventDefault())})})})});VN.displayName=HN;var n5="DropdownMenuPortal",GN=a=>{const{__scopeDropdownMenu:l,...r}=a,c=oa(l);return e.jsx(Ew,{...c,...r})};GN.displayName=n5;var qN="DropdownMenuContent",KN=m.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=PN(qN,r),u=oa(r),h=m.useRef(!1);return e.jsx(Mw,{id:d.contentId,"aria-labelledby":d.triggerId,...u,...c,ref:l,onCloseAutoFocus:gn(a.onCloseAutoFocus,f=>{h.current||d.triggerRef.current?.focus(),h.current=!1,f.preventDefault()}),onInteractOutside:gn(a.onInteractOutside,f=>{const p=f.detail.originalEvent,g=p.button===0&&p.ctrlKey===!0,b=p.button===2||g;(!d.modal||b)&&(h.current=!0)}),style:{...a.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});KN.displayName=qN;var r5="DropdownMenuGroup",i5=m.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=oa(r);return e.jsx(Bw,{...d,...c,ref:l})});i5.displayName=r5;var c5="DropdownMenuLabel",QN=m.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=oa(r);return e.jsx(Ow,{...d,...c,ref:l})});QN.displayName=c5;var o5="DropdownMenuItem",YN=m.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=oa(r);return e.jsx(Aw,{...d,...c,ref:l})});YN.displayName=o5;var d5="DropdownMenuCheckboxItem",JN=m.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=oa(r);return e.jsx(zw,{...d,...c,ref:l})});JN.displayName=d5;var u5="DropdownMenuRadioGroup",m5=m.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=oa(r);return e.jsx(Iw,{...d,...c,ref:l})});m5.displayName=u5;var x5="DropdownMenuRadioItem",XN=m.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=oa(r);return e.jsx(Dw,{...d,...c,ref:l})});XN.displayName=x5;var h5="DropdownMenuItemIndicator",ZN=m.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=oa(r);return e.jsx(Rw,{...d,...c,ref:l})});ZN.displayName=h5;var f5="DropdownMenuSeparator",WN=m.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=oa(r);return e.jsx(Lw,{...d,...c,ref:l})});WN.displayName=f5;var p5="DropdownMenuArrow",g5=m.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=oa(r);return e.jsx(Pw,{...d,...c,ref:l})});g5.displayName=p5;var j5="DropdownMenuSubTrigger",eb=m.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=oa(r);return e.jsx(Cw,{...d,...c,ref:l})});eb.displayName=j5;var v5="DropdownMenuSubContent",sb=m.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=oa(r);return e.jsx(Tw,{...d,...c,ref:l,style:{...a.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});sb.displayName=v5;var N5=FN,b5=VN,y5=GN,tb=KN,ab=QN,lb=YN,nb=JN,rb=XN,ib=ZN,cb=WN,ob=eb,db=sb;const w5=N5,_5=b5,S5=m.forwardRef(({className:a,inset:l,children:r,...c},d)=>e.jsxs(ob,{ref:d,className:F("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",l&&"pl-8",a),...c,children:[r,e.jsx(sa,{className:"ml-auto h-4 w-4"})]}));S5.displayName=ob.displayName;const k5=m.forwardRef(({className:a,...l},r)=>e.jsx(db,{ref:r,className:F("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a),...l}));k5.displayName=db.displayName;const ub=m.forwardRef(({className:a,sideOffset:l=4,...r},c)=>e.jsx(y5,{children:e.jsx(tb,{ref:c,sideOffset:l,className:F("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a),...r})}));ub.displayName=tb.displayName;const mb=m.forwardRef(({className:a,inset:l,...r},c)=>e.jsx(lb,{ref:c,className:F("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",l&&"pl-8",a),...r}));mb.displayName=lb.displayName;const C5=m.forwardRef(({className:a,children:l,checked:r,...c},d)=>e.jsxs(nb,{ref:d,className:F("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),checked:r,...c,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(ib,{children:e.jsx(Mt,{className:"h-4 w-4"})})}),l]}));C5.displayName=nb.displayName;const T5=m.forwardRef(({className:a,children:l,...r},c)=>e.jsxs(rb,{ref:c,className:F("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(ib,{children:e.jsx(Ho,{className:"h-2 w-2 fill-current"})})}),l]}));T5.displayName=rb.displayName;const E5=m.forwardRef(({className:a,inset:l,...r},c)=>e.jsx(ab,{ref:c,className:F("px-2 py-1.5 text-sm font-semibold",l&&"pl-8",a),...r}));E5.displayName=ab.displayName;const M5=m.forwardRef(({className:a,...l},r)=>e.jsx(cb,{ref:r,className:F("-mx-1 my-1 h-px bg-muted",a),...l}));M5.displayName=cb.displayName;const qm=[{value:"created_at",label:"最新发布",icon:na},{value:"downloads",label:"下载最多",icon:Wt},{value:"likes",label:"最受欢迎",icon:Xr}];function A5(){const a=ca(),[l,r]=m.useState([]),[c,d]=m.useState(!0),[u,h]=m.useState(""),[f,p]=m.useState("downloads"),[g,b]=m.useState(1),[j,y]=m.useState(1),[N,w]=m.useState(0),[M,A]=m.useState(new Set),[S,U]=m.useState(new Set),E=Wv(),C=m.useCallback(async()=>{d(!0);try{const L=await n4({status:"approved",page:g,page_size:12,search:u||void 0,sort_by:f,sort_order:"desc"});r(L.packs),y(L.total_pages),w(L.total);const oe=new Set;for(const Ne of L.packs)await Zv(Ne.id,E)&&oe.add(Ne.id);A(oe)}catch(L){console.error("加载 Pack 列表失败:",L),Xt({title:"加载 Pack 列表失败",variant:"destructive"})}finally{d(!1)}},[g,u,f,E]);m.useEffect(()=>{C()},[C]);const D=L=>{L.preventDefault(),b(1),C()},P=async L=>{if(!S.has(L)){U(oe=>new Set(oe).add(L));try{const oe=await Xv(L,E);A(Ne=>{const je=new Set(Ne);return oe.liked?je.add(L):je.delete(L),je}),r(Ne=>Ne.map(je=>je.id===L?{...je,likes:oe.likes}:je))}catch(oe){console.error("点赞失败:",oe),Xt({title:"点赞失败",variant:"destructive"})}finally{U(oe=>{const Ne=new Set(oe);return Ne.delete(L),Ne})}}},O=L=>{a({to:"/config/pack-market/$packId",params:{packId:L}})},J=qm.find(L=>L.value===f)||qm[0];return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(ra,{className:"h-8 w-8",strokeWidth:2}),"配置模板市场"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"浏览和应用社区分享的模型配置模板,快速配置你的 MaiBot"})]}),e.jsxs(_,{variant:"outline",onClick:C,disabled:c,className:"gap-2",children:[e.jsx(xt,{className:`h-4 w-4 ${c?"animate-spin":""}`}),"刷新"]})]})}),e.jsx(Ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-4 flex-wrap",children:[e.jsx("form",{onSubmit:D,className:"flex-1 min-w-[200px] max-w-md",children:e.jsxs("div",{className:"relative",children:[e.jsx(At,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(ae,{placeholder:"搜索模板名称、描述...",value:u,onChange:L=>h(L.target.value),className:"pl-10"})]})}),e.jsxs(w5,{children:[e.jsx(_5,{asChild:!0,children:e.jsxs(_,{variant:"outline",className:"min-w-[140px] gap-2",children:[e.jsx(Q_,{className:"w-4 h-4"}),J.label,e.jsx(za,{className:"w-4 h-4 ml-auto"})]})}),e.jsx(ub,{align:"end",children:qm.map(L=>e.jsxs(mb,{onClick:()=>{p(L.value),b(1)},children:[e.jsx(L.icon,{className:"w-4 h-4 mr-2"}),L.label]},L.value))})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共找到 ",e.jsx("span",{className:"font-medium text-foreground",children:N})," 个模板"]}),c?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Array.from({length:6}).map((L,oe)=>e.jsxs(ke,{children:[e.jsxs(Re,{children:[e.jsx(ws,{className:"h-6 w-3/4"}),e.jsx(ws,{className:"h-4 w-full mt-2"})]}),e.jsx(Me,{children:e.jsx(ws,{className:"h-20 w-full"})}),e.jsx(id,{children:e.jsx(ws,{className:"h-9 w-full"})})]},oe))}):l.length===0?e.jsx(ke,{className:"py-12",children:e.jsxs(Me,{className:"text-center text-muted-foreground",children:[e.jsx(ra,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{className:"text-lg font-medium",children:"暂无模板"}),e.jsx("p",{className:"mt-1",children:"还没有人分享配置模板,快来分享第一个吧!"})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:l.map(L=>e.jsx(z5,{pack:L,liked:M.has(L.id),liking:S.has(L.id),onLike:()=>P(L.id),onView:()=>O(L.id)},L.id))}),j>1&&e.jsx(dx,{children:e.jsxs(ux,{children:[e.jsx(qn,{children:e.jsx(zv,{onClick:()=>b(L=>Math.max(1,L-1)),className:g===1?"pointer-events-none opacity-50":"cursor-pointer"})}),Array.from({length:j},(L,oe)=>oe+1).filter(L=>L===1||L===j||Math.abs(L-g)<=1).map((L,oe,Ne)=>{const je=oe>0&&L-Ne[oe-1]>1;return e.jsxs(qn,{children:[je&&e.jsx("span",{className:"px-2",children:"..."}),e.jsx(pc,{onClick:()=>b(L),isActive:L===g,className:"cursor-pointer",children:L})]},L)}),e.jsx(qn,{children:e.jsx(Rv,{onClick:()=>b(L=>Math.min(j,L+1)),className:g===j?"pointer-events-none opacity-50":"cursor-pointer"})})]})})]})})]})}function z5({pack:a,liked:l,liking:r,onLike:c,onView:d}){const u=h=>new Date(h).toLocaleDateString("zh-CN",{year:"numeric",month:"short",day:"numeric"});return e.jsxs(ke,{className:"flex flex-col hover:shadow-md transition-shadow",children:[e.jsxs(Re,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(De,{className:"text-lg line-clamp-1",children:a.name}),e.jsxs(Ce,{variant:"secondary",className:"text-xs",children:["v",a.version]})]}),e.jsx(is,{className:"line-clamp-2 min-h-[40px]",children:a.description})]}),e.jsxs(Me,{className:"flex-1 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(jn,{className:"w-3.5 h-3.5"}),a.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(na,{className:"w-3.5 h-3.5"}),u(a.created_at)]})]}),e.jsxs("div",{className:"flex gap-4 text-sm",children:[e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"提供商数量",children:[e.jsx(Ll,{className:"w-3.5 h-3.5"}),a.provider_count]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"模型数量",children:[e.jsx(Qn,{className:"w-3.5 h-3.5"}),a.model_count]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"任务配置数",children:[e.jsx(Yn,{className:"w-3.5 h-3.5"}),a.task_count]})]}),a.tags&&a.tags.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-1",children:[a.tags.slice(0,3).map(h=>e.jsxs(Ce,{variant:"outline",className:"text-xs",children:[e.jsx(rd,{className:"w-2.5 h-2.5 mr-1"}),h]},h)),a.tags.length>3&&e.jsxs(Ce,{variant:"outline",className:"text-xs",children:["+",a.tags.length-3]})]})]}),e.jsx(id,{className:"pt-3 border-t",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Wt,{className:"w-4 h-4"}),a.downloads]}),e.jsxs("button",{onClick:h=>{h.stopPropagation(),c()},disabled:r,className:`flex items-center gap-1 transition-colors ${l?"text-red-500":"hover:text-red-500"} ${r?"opacity-50":""}`,children:[e.jsx(Xr,{className:`w-4 h-4 ${l?"fill-current":""}`}),a.likes]})]}),e.jsx(_,{size:"sm",onClick:d,children:"查看详情"})]})})]})}var al="Accordion",R5=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Mx,D5,O5]=x_(al),[jd]=td(al,[O5,Mj]),Ax=Mj(),xb=Ls.forwardRef((a,l)=>{const{type:r,...c}=a,d=c,u=c;return e.jsx(Mx.Provider,{scope:a.__scopeAccordion,children:r==="multiple"?e.jsx(B5,{...u,ref:l}):e.jsx($5,{...d,ref:l})})});xb.displayName=al;var[hb,L5]=jd(al),[fb,U5]=jd(al,{collapsible:!1}),$5=Ls.forwardRef((a,l)=>{const{value:r,defaultValue:c,onValueChange:d=()=>{},collapsible:u=!1,...h}=a,[f,p]=sd({prop:r,defaultProp:c??"",onChange:d,caller:al});return e.jsx(hb,{scope:a.__scopeAccordion,value:Ls.useMemo(()=>f?[f]:[],[f]),onItemOpen:p,onItemClose:Ls.useCallback(()=>u&&p(""),[u,p]),children:e.jsx(fb,{scope:a.__scopeAccordion,collapsible:u,children:e.jsx(pb,{...h,ref:l})})})}),B5=Ls.forwardRef((a,l)=>{const{value:r,defaultValue:c,onValueChange:d=()=>{},...u}=a,[h,f]=sd({prop:r,defaultProp:c??[],onChange:d,caller:al}),p=Ls.useCallback(b=>f((j=[])=>[...j,b]),[f]),g=Ls.useCallback(b=>f((j=[])=>j.filter(y=>y!==b)),[f]);return e.jsx(hb,{scope:a.__scopeAccordion,value:h,onItemOpen:p,onItemClose:g,children:e.jsx(fb,{scope:a.__scopeAccordion,collapsible:!0,children:e.jsx(pb,{...u,ref:l})})})}),[I5,vd]=jd(al),pb=Ls.forwardRef((a,l)=>{const{__scopeAccordion:r,disabled:c,dir:d,orientation:u="vertical",...h}=a,f=Ls.useRef(null),p=ad(f,l),g=D5(r),j=qj(d)==="ltr",y=gn(a.onKeyDown,N=>{if(!R5.includes(N.key))return;const w=N.target,M=g().filter(J=>!J.ref.current?.disabled),A=M.findIndex(J=>J.ref.current===w),S=M.length;if(A===-1)return;N.preventDefault();let U=A;const E=0,C=S-1,D=()=>{U=A+1,U>C&&(U=E)},P=()=>{U=A-1,U{const{__scopeAccordion:r,value:c,...d}=a,u=vd(ed,r),h=L5(ed,r),f=Ax(r),p=Km(),g=c&&h.value.includes(c)||!1,b=u.disabled||a.disabled;return e.jsx(P5,{scope:r,open:g,disabled:b,triggerId:p,children:e.jsx(_j,{"data-orientation":u.orientation,"data-state":wb(g),...f,...d,ref:l,disabled:b,open:g,onOpenChange:j=>{j?h.onItemOpen(c):h.onItemClose(c)}})})});gb.displayName=ed;var jb="AccordionHeader",vb=Ls.forwardRef((a,l)=>{const{__scopeAccordion:r,...c}=a,d=vd(al,r),u=zx(jb,r);return e.jsx(Zn.h3,{"data-orientation":d.orientation,"data-state":wb(u.open),"data-disabled":u.disabled?"":void 0,...c,ref:l})});vb.displayName=jb;var sx="AccordionTrigger",Nb=Ls.forwardRef((a,l)=>{const{__scopeAccordion:r,...c}=a,d=vd(al,r),u=zx(sx,r),h=U5(sx,r),f=Ax(r);return e.jsx(Mx.ItemSlot,{scope:r,children:e.jsx(Fw,{"aria-disabled":u.open&&!h.collapsible||void 0,"data-orientation":d.orientation,id:u.triggerId,...f,...c,ref:l})})});Nb.displayName=sx;var bb="AccordionContent",yb=Ls.forwardRef((a,l)=>{const{__scopeAccordion:r,...c}=a,d=vd(al,r),u=zx(bb,r),h=Ax(r);return e.jsx(Hw,{role:"region","aria-labelledby":u.triggerId,"data-orientation":d.orientation,...h,...c,ref:l,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...a.style}})});yb.displayName=bb;function wb(a){return a?"open":"closed"}var F5=xb,H5=gb,V5=vb,_b=Nb,Sb=yb;const G5=F5,kb=m.forwardRef(({className:a,...l},r)=>e.jsx(H5,{ref:r,className:F("border-b",a),...l}));kb.displayName="AccordionItem";const Cb=m.forwardRef(({className:a,children:l,...r},c)=>e.jsx(V5,{className:"flex",children:e.jsxs(_b,{ref:c,className:F("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",a),...r,children:[l,e.jsx(za,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));Cb.displayName=_b.displayName;const Tb=m.forwardRef(({className:a,children:l,...r},c)=>e.jsx(Sb,{ref:c,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:e.jsx("div",{className:F("pb-4 pt-0",a),children:l})}));Tb.displayName=Sb.displayName;const q5={utils:"通用工具",utils_small:"轻量工具",tool_use:"工具调用",replyer:"回复生成",planner:"规划推理",vlm:"视觉模型",voice:"语音处理",embedding:"向量嵌入",lpmm_entity_extract:"实体提取",lpmm_rdf_build:"RDF构建",lpmm_qa:"问答模型"};function K5(){const{packId:a}=Rb.useParams(),l=ca(),[r,c]=m.useState(null),[d,u]=m.useState(!0),[h,f]=m.useState(!1),[p,g]=m.useState(!1),[b,j]=m.useState(!1),[y,N]=m.useState(1),[w,M]=m.useState(null),[A,S]=m.useState(!1),[U,E]=m.useState(!1),[C,D]=m.useState({apply_providers:!0,apply_models:!0,apply_task_config:!0,task_mode:"append",selected_providers:void 0,selected_models:void 0,selected_tasks:void 0}),[P,O]=m.useState({}),[J,L]=m.useState({}),oe=Wv(),Ne=m.useCallback(async()=>{if(a){u(!0);try{const R=await r4(a);c(R);const Q=await Zv(a,oe);f(Q)}catch(R){console.error("加载 Pack 失败:",R),Xt({title:"加载模板失败",variant:"destructive"})}finally{u(!1)}}},[a,oe]);m.useEffect(()=>{Ne()},[Ne]);const je=async()=>{if(!(!a||p)){g(!0);try{const R=await Xv(a,oe);f(R.liked),r&&c({...r,likes:R.likes})}catch(R){console.error("点赞失败:",R),Xt({title:"点赞失败",variant:"destructive"})}finally{g(!1)}}},de=async()=>{if(r){j(!0),N(1),S(!0);try{const R=await o4(r);M(R);const Q={};for(const ue of R.existing_providers)Q[ue.pack_provider.name]=ue.local_providers[0].name;O(Q);const $={};for(const ue of R.new_providers)$[ue.name]="";L($)}catch(R){console.error("检测冲突失败:",R),Xt({title:"检测配置冲突失败",variant:"destructive"}),j(!1)}finally{S(!1)}}},he=async()=>{if(r){if(C.apply_providers&&w){for(const R of w.new_providers)if(!J[R.name]){Xt({title:`请填写提供商 "${R.name}" 的 API Key`,variant:"destructive"});return}}E(!0);try{await d4(r,C,P,J),await c4(r.id,oe),c({...r,downloads:r.downloads+1}),Xt({title:"配置模板应用成功!"}),j(!1)}catch(R){console.error("应用 Pack 失败:",R),Xt({title:R instanceof Error?R.message:"应用配置失败",variant:"destructive"})}finally{E(!1)}}},ge=R=>new Date(R).toLocaleDateString("zh-CN",{year:"numeric",month:"long",day:"numeric"});return d?e.jsx(Y5,{}):r?e.jsx("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:e.jsx(Ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs(_,{variant:"ghost",size:"sm",onClick:()=>l({to:"/config/pack-market"}),className:"gap-2",children:[e.jsx(Ma,{className:"w-4 h-4"}),"返回市场"]}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-6",children:[e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ra,{className:"w-10 h-10 text-primary mt-1"}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[r.name,e.jsxs(Ce,{variant:"secondary",children:["v",r.version]})]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:r.description})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(jn,{className:"w-4 h-4"}),r.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(na,{className:"w-4 h-4"}),ge(r.created_at)]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Wt,{className:"w-4 h-4"}),r.downloads," 次下载"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Xr,{className:`w-4 h-4 ${h?"fill-red-500 text-red-500":""}`}),r.likes," 赞"]})]}),r.tags&&r.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:r.tags.map(R=>e.jsxs(Ce,{variant:"outline",children:[e.jsx(rd,{className:"w-3 h-3 mr-1"}),R]},R))})]}),e.jsxs("div",{className:"flex flex-col gap-2 min-w-[160px]",children:[e.jsxs(_,{size:"lg",onClick:de,children:[e.jsx(Wt,{className:"w-4 h-4 mr-2"}),"应用模板"]}),e.jsxs(_,{variant:"outline",onClick:je,disabled:p,className:h?"text-red-500 border-red-200":"",children:[e.jsx(Xr,{className:`w-4 h-4 mr-2 ${h?"fill-current":""}`}),h?"已点赞":"点赞"]})]})]}),e.jsx(Zt,{}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsx(ke,{children:e.jsxs(Me,{className:"flex items-center gap-3 py-4",children:[e.jsx(Ll,{className:"w-8 h-8 text-blue-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:r.providers.length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"API 提供商"})]})]})}),e.jsx(ke,{children:e.jsxs(Me,{className:"flex items-center gap-3 py-4",children:[e.jsx(Qn,{className:"w-8 h-8 text-green-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:r.models.length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"模型配置"})]})]})}),e.jsx(ke,{children:e.jsxs(Me,{className:"flex items-center gap-3 py-4",children:[e.jsx(Yn,{className:"w-8 h-8 text-purple-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:Object.keys(r.task_config).length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"任务配置"})]})]})})]}),e.jsxs(ea,{defaultValue:"providers",className:"space-y-4",children:[e.jsxs(Gt,{className:"w-full sm:w-auto grid grid-cols-3 sm:flex",children:[e.jsxs(Xe,{value:"providers",className:"gap-1 sm:gap-2",children:[e.jsx(Ll,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"提供商"}),e.jsx("span",{className:"sm:hidden",children:"提供商"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",r.providers.length,")"]})]}),e.jsxs(Xe,{value:"models",className:"gap-1 sm:gap-2",children:[e.jsx(Qn,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"模型"}),e.jsx("span",{className:"sm:hidden",children:"模型"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",r.models.length,")"]})]}),e.jsxs(Xe,{value:"tasks",className:"gap-1 sm:gap-2",children:[e.jsx(Yn,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"任务配置"}),e.jsx("span",{className:"sm:hidden",children:"任务"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",Object.keys(r.task_config).length,")"]})]})]}),e.jsx(vs,{value:"providers",children:e.jsxs(ke,{children:[e.jsxs(Re,{children:[e.jsx(De,{children:"API 提供商"}),e.jsx(is,{children:"模板中包含的 API 提供商配置(不含 API Key)"})]}),e.jsx(Me,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(Ul,{children:[e.jsx($l,{children:e.jsxs(ht,{children:[e.jsx(ss,{children:"名称"}),e.jsx(ss,{children:"Base URL"}),e.jsx(ss,{children:"类型"})]})}),e.jsx(Bl,{children:r.providers.map(R=>e.jsxs(ht,{children:[e.jsx(Ye,{className:"font-medium whitespace-nowrap",children:R.name}),e.jsx(Ye,{className:"text-muted-foreground font-mono text-sm max-w-[200px] truncate",children:R.base_url}),e.jsx(Ye,{children:e.jsx(Ce,{variant:"outline",children:R.client_type})})]},R.name))})]})})})]})}),e.jsx(vs,{value:"models",children:e.jsxs(ke,{children:[e.jsxs(Re,{children:[e.jsx(De,{children:"模型配置"}),e.jsx(is,{children:"模板中包含的模型配置"})]}),e.jsx(Me,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(Ul,{children:[e.jsx($l,{children:e.jsxs(ht,{children:[e.jsx(ss,{children:"模型名称"}),e.jsx(ss,{children:"标识符"}),e.jsx(ss,{children:"提供商"}),e.jsx(ss,{className:"text-right",children:"价格 (入/出)"})]})}),e.jsx(Bl,{children:r.models.map(R=>e.jsxs(ht,{children:[e.jsx(Ye,{className:"font-medium whitespace-nowrap",children:R.name}),e.jsx(Ye,{className:"text-muted-foreground font-mono text-sm max-w-[150px] truncate",children:R.model_identifier}),e.jsx(Ye,{className:"whitespace-nowrap",children:R.api_provider}),e.jsxs(Ye,{className:"text-right text-muted-foreground whitespace-nowrap",children:["¥",R.price_in," / ¥",R.price_out]})]},R.name))})]})})})]})}),e.jsx(vs,{value:"tasks",children:e.jsxs(ke,{children:[e.jsxs(Re,{children:[e.jsx(De,{children:"任务配置"}),e.jsx(is,{children:"模板中各任务类型的模型分配"})]}),e.jsx(Me,{children:e.jsx(G5,{type:"multiple",className:"w-full",children:Object.entries(r.task_config).map(([R,Q])=>e.jsxs(kb,{value:R,children:[e.jsx(Cb,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(vn,{className:"w-4 h-4"}),q5[R]||R,e.jsxs(Ce,{variant:"secondary",className:"ml-2",children:[Q.model_list.length," 个模型"]})]})}),e.jsx(Tb,{children:e.jsxs("div",{className:"space-y-2 pl-6",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"分配的模型:"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Q.model_list.map($=>e.jsx(Ce,{variant:"outline",children:$},$))}),Q.temperature!==void 0&&e.jsxs("div",{className:"text-sm",children:["Temperature: ",e.jsx("span",{className:"font-mono",children:Q.temperature})]}),Q.max_tokens!==void 0&&e.jsxs("div",{className:"text-sm",children:["Max Tokens: ",e.jsx("span",{className:"font-mono",children:Q.max_tokens})]})]})})]},R))})})]})})]}),e.jsx(Q5,{open:b,onOpenChange:j,pack:r,step:y,setStep:N,conflicts:w,detectingConflicts:A,applying:U,options:C,setOptions:D,_providerMapping:P,_setProviderMapping:O,newProviderApiKeys:J,setNewProviderApiKeys:L,onApply:he})]})})}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(ra,{className:"w-16 h-16 mx-auto mb-4 opacity-50"}),e.jsx("h2",{className:"text-xl font-semibold",children:"模板不存在"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"该配置模板可能已被删除或尚未通过审核"}),e.jsxs(_,{className:"mt-4",onClick:()=>l({to:"/config/pack-market"}),children:[e.jsx(Ma,{className:"w-4 h-4 mr-2"}),"返回市场"]})]})}function Q5({open:a,onOpenChange:l,pack:r,step:c,setStep:d,conflicts:u,detectingConflicts:h,applying:f,options:p,setOptions:g,_providerMapping:b,_setProviderMapping:j,newProviderApiKeys:y,setNewProviderApiKeys:N,onApply:w}){return e.jsx(Fs,{open:a,onOpenChange:l,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs($s,{children:[e.jsxs(Bs,{className:"flex items-center gap-2",children:[e.jsx(ra,{className:"w-5 h-5"}),"应用配置模板"]}),e.jsxs(Xs,{children:["步骤 ",c," / ",3,":",c===1&&"选择要应用的内容",c===2&&"配置提供商映射",c===3&&"确认并应用"]})]}),h?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(Os,{className:"w-8 h-8 mx-auto animate-spin text-primary"}),e.jsx("p",{className:"mt-4 text-muted-foreground",children:"正在检测配置冲突..."})]}):e.jsxs(e.Fragment,{children:[c===1&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Js,{id:"apply_providers",checked:p.apply_providers,onCheckedChange:A=>g({...p,apply_providers:A})}),e.jsxs(T,{htmlFor:"apply_providers",className:"flex items-center gap-2",children:[e.jsx(Ll,{className:"w-4 h-4"}),"应用提供商配置 (",r.providers.length," 个)"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Js,{id:"apply_models",checked:p.apply_models,onCheckedChange:A=>g({...p,apply_models:A})}),e.jsxs(T,{htmlFor:"apply_models",className:"flex items-center gap-2",children:[e.jsx(Qn,{className:"w-4 h-4"}),"应用模型配置 (",r.models.length," 个)"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Js,{id:"apply_task_config",checked:p.apply_task_config,onCheckedChange:A=>g({...p,apply_task_config:A})}),e.jsxs(T,{htmlFor:"apply_task_config",className:"flex items-center gap-2",children:[e.jsx(Yn,{className:"w-4 h-4"}),"应用任务配置 (",Object.keys(r.task_config).length," 个)"]})]})]}),p.apply_task_config&&e.jsxs("div",{className:"pl-6 space-y-2 border-l-2 border-muted",children:[e.jsx(T,{className:"text-sm font-medium",children:"任务配置应用模式"}),e.jsxs(Cx,{value:p.task_mode,onValueChange:A=>g({...p,task_mode:A}),children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xo,{value:"append",id:"mode_append"}),e.jsx(T,{htmlFor:"mode_append",className:"font-normal",children:"追加模式 - 将模板中的模型添加到现有配置"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xo,{value:"replace",id:"mode_replace"}),e.jsx(T,{htmlFor:"mode_replace",className:"font-normal",children:"替换模式 - 用模板配置完全替换现有配置"})]})]})]})]}),c===2&&u&&e.jsxs("div",{className:"space-y-4",children:[p.apply_providers&&u.existing_providers.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(it,{children:[e.jsx(Vt,{className:"h-4 w-4"}),e.jsx(Gn,{children:"发现已有的提供商"}),e.jsx(ct,{children:"以下提供商的 URL 与您本地配置中的提供商匹配,将自动使用本地提供商:"})]}),e.jsx("div",{className:"space-y-2",children:u.existing_providers.map(({pack_provider:A,local_providers:S})=>e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-lg",children:[e.jsx(Mt,{className:"w-4 h-4 text-green-500 flex-shrink-0"}),e.jsx("span",{className:"font-medium flex-shrink-0",children:A.name}),e.jsx(sa,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),S.length===1?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:S[0].name}),e.jsx(Ce,{variant:"outline",className:"ml-auto",children:"URL 匹配"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Pe,{value:b[A.name]||S[0].name,onValueChange:U=>j({...b,[A.name]:U}),children:[e.jsx(Be,{className:"w-[200px]",children:e.jsx(Fe,{})}),e.jsx(Ie,{children:S.map(U=>e.jsx(W,{value:U.name,children:U.name},U.name))})]}),e.jsxs(Ce,{variant:"outline",className:"ml-auto",children:[S.length," 个匹配"]})]})]},A.name))})]}),p.apply_providers&&u.new_providers.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(it,{variant:"destructive",children:[e.jsx(It,{className:"h-4 w-4"}),e.jsx(Gn,{children:"需要配置 API Key"}),e.jsx(ct,{children:"以下提供商在您的本地配置中不存在,需要填写 API Key:"})]}),e.jsx("div",{className:"space-y-4",children:u.new_providers.map(A=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(nx,{className:"w-4 h-4 text-amber-500"}),e.jsx("span",{className:"font-medium",children:A.name}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",A.base_url,")"]})]}),e.jsx(ae,{type:"password",placeholder:`输入 ${A.name} 的 API Key`,value:y[A.name]||"",onChange:S=>N({...y,[A.name]:S.target.value})})]},A.name))})]}),(!p.apply_providers||u.existing_providers.length===0&&u.new_providers.length===0)&&e.jsxs(it,{children:[e.jsx(Mt,{className:"h-4 w-4"}),e.jsx(Gn,{children:"无需配置"}),e.jsx(ct,{children:"模板中没有提供商配置,或您选择不应用提供商。"})]})]}),c===3&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(it,{children:[e.jsx(Vt,{className:"h-4 w-4"}),e.jsx(Gn,{children:"确认应用"}),e.jsx(ct,{children:"请确认以下将要应用的内容:"})]}),e.jsxs("div",{className:"space-y-2",children:[p.apply_providers&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Mt,{className:"w-4 h-4 text-green-500"}),e.jsx(Ll,{className:"w-4 h-4"}),e.jsxs("span",{children:["应用 ",r.providers.length," 个提供商配置"]})]}),p.apply_models&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Mt,{className:"w-4 h-4 text-green-500"}),e.jsx(Qn,{className:"w-4 h-4"}),e.jsxs("span",{children:["应用 ",r.models.length," 个模型配置"]})]}),p.apply_task_config&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Mt,{className:"w-4 h-4 text-green-500"}),e.jsx(Yn,{className:"w-4 h-4"}),e.jsxs("span",{children:[p.task_mode==="append"?"追加":"替换"," ",Object.keys(r.task_config).length," 个任务配置"]})]})]}),u&&u.new_providers.length>0&&e.jsxs(it,{variant:"destructive",children:[e.jsx(It,{className:"h-4 w-4"}),e.jsxs(ct,{children:["将添加 ",u.new_providers.length," 个新提供商,请确保已填写正确的 API Key。"]})]})]})]}),e.jsxs(nt,{className:"flex justify-between",children:[e.jsx("div",{children:c>1&&!h&&e.jsx(_,{variant:"outline",onClick:()=>d(c-1),disabled:f,children:"上一步"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{variant:"outline",onClick:()=>l(!1),disabled:f,children:"取消"}),c<3?e.jsx(_,{onClick:()=>d(c+1),disabled:h,children:"下一步"}):e.jsxs(_,{onClick:w,disabled:f,children:[f&&e.jsx(Os,{className:"w-4 h-4 mr-2 animate-spin"}),"应用模板"]})]})]})]})})}function Y5(){return e.jsx("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:e.jsx(Ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(ws,{className:"h-9 w-24"}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-6",children:[e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ws,{className:"w-10 h-10"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(ws,{className:"h-8 w-2/3"}),e.jsx(ws,{className:"h-4 w-full"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsx(ws,{className:"h-4 w-24"}),e.jsx(ws,{className:"h-4 w-32"}),e.jsx(ws,{className:"h-4 w-28"}),e.jsx(ws,{className:"h-4 w-20"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(ws,{className:"h-6 w-20"}),e.jsx(ws,{className:"h-6 w-24"}),e.jsx(ws,{className:"h-6 w-16"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 min-w-[160px]",children:[e.jsx(ws,{className:"h-10 w-full"}),e.jsx(ws,{className:"h-10 w-full"})]})]}),e.jsx(ws,{className:"h-px w-full"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsx(ws,{className:"h-24"}),e.jsx(ws,{className:"h-24"}),e.jsx(ws,{className:"h-24"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ws,{className:"h-10 w-32"}),e.jsx(ws,{className:"h-10 w-32"}),e.jsx(ws,{className:"h-10 w-32"})]}),e.jsx(ws,{className:"h-96 w-full"})]})]})})})}function J5(){const a=ca(),[l,r]=m.useState(!0);return m.useEffect(()=>{let c=!1;return(async()=>{try{const u=await cc();!c&&!u&&a({to:"/auth"})}catch{c||a({to:"/auth"})}finally{c||r(!1)}})(),()=>{c=!0}},[a]),{checking:l}}async function X5(){return await cc()}const Z5=Wr("pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono font-medium opacity-100",{variants:{size:{sm:"h-5 text-[10px]",default:"h-6 text-xs",lg:"h-7 text-sm"}},defaultVariants:{size:"default"}}),Eb=m.forwardRef(({className:a,size:l,abbrTitle:r,children:c,...d},u)=>e.jsx("kbd",{className:F(Z5({size:l,className:a})),ref:u,...d,children:r?e.jsx("abbr",{title:r,children:c}):c}));Eb.displayName="Kbd";const W5=[{icon:nd,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:Ea,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:Ll,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:uv,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:ld,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Ra,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:mv,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:Jr,title:"黑话管理",description:"管理麦麦学习到的黑话和俚语",path:"/resource/jargon",category:"资源"},{icon:Y_,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:ra,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:rx,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:vn,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function eT({open:a,onOpenChange:l}){const[r,c]=m.useState(""),[d,u]=m.useState(0),h=ca(),f=W5.filter(b=>b.title.toLowerCase().includes(r.toLowerCase())||b.description.toLowerCase().includes(r.toLowerCase())||b.category.toLowerCase().includes(r.toLowerCase())),p=m.useCallback(b=>{h({to:b}),l(!1),c(""),u(0)},[h,l]),g=m.useCallback(b=>{b.key==="ArrowDown"?(b.preventDefault(),u(j=>(j+1)%f.length)):b.key==="ArrowUp"?(b.preventDefault(),u(j=>(j-1+f.length)%f.length)):b.key==="Enter"&&f[d]&&(b.preventDefault(),p(f[d].path))},[f,d,p]);return e.jsx(Fs,{open:a,onOpenChange:l,children:e.jsxs(Us,{className:"max-w-2xl p-0 gap-0",children:[e.jsxs($s,{className:"px-4 pt-4 pb-0",children:[e.jsx(Bs,{className:"sr-only",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx(At,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),e.jsx(ae,{value:r,onChange:b=>{c(b.target.value),u(0)},onKeyDown:g,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),e.jsx("div",{className:"border-t",children:e.jsx(Ze,{className:"h-[400px]",children:f.length>0?e.jsx("div",{className:"p-2",children:f.map((b,j)=>{const y=b.icon;return e.jsxs("button",{onClick:()=>p(b.path),onMouseEnter:()=>u(j),className:F("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",j===d?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[e.jsx(y,{className:"h-5 w-5 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm",children:b.title}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:b.description})]}),e.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:b.category})]},b.path)})}):e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(At,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:r?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),e.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function sT(){const a=window.location.protocol==="http:",l=window.location.hostname.toLowerCase(),r=l==="localhost"||l==="127.0.0.1"||l==="::1",c=sessionStorage.getItem("http-warning-dismissed")==="true",[d,u]=m.useState(a&&!r&&!c),[h,f]=m.useState(!1),p=()=>{f(!0),u(!1),sessionStorage.setItem("http-warning-dismissed","true")};return!d||h?null:e.jsx("div",{className:"relative bg-amber-500/10 border-b border-amber-500/20 backdrop-blur-sm",children:e.jsx("div",{className:"container mx-auto px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx(It,{className:"h-5 w-5 text-amber-600 dark:text-amber-500 flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("p",{className:"text-sm font-medium text-amber-900 dark:text-amber-100",children:[e.jsx("span",{className:"font-semibold",children:"安全警告:"}),"您正在使用 ",e.jsx("strong",{children:"HTTP"})," 访问 MaiBot WebUI"]}),e.jsx("p",{className:"text-xs text-amber-800 dark:text-amber-200 mt-1",children:"如果这是公网服务器,您的数据(包括 Token、聊天记录等)可能在传输过程中被窃取。强烈建议使用 HTTPS 访问或仅在本地网络使用。"})]})]}),e.jsx(_,{variant:"ghost",size:"icon",onClick:p,className:"h-8 w-8 text-amber-700 hover:text-amber-900 dark:text-amber-400 dark:hover:text-amber-200 flex-shrink-0","aria-label":"关闭警告",children:e.jsx(Aa,{className:"h-4 w-4"})})]})})})}function tT(){const[a,l]=m.useState(0),[r,c]=m.useState(!1),d=m.useRef(null);m.useEffect(()=>{const g=b=>{const j=b.target;if(j.scrollHeight>j.clientHeight+100){d.current=j;const y=j.scrollTop,N=j.scrollHeight-j.clientHeight,w=N>0?y/N*100:0;l(w),c(y>300)}};return window.addEventListener("scroll",g,{capture:!0,passive:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})},[]);const u=()=>{d.current?.scrollTo({top:0,behavior:"smooth"})},h=18,f=2*Math.PI*h,p=f-a/100*f;return e.jsx("div",{className:F("fixed bottom-24 right-8 z-50 transition-all duration-500 ease-in-out transform",r?"translate-x-0 opacity-100":"translate-x-32 opacity-0 pointer-events-none"),children:e.jsxs(_,{variant:"outline",size:"icon",className:F("relative h-12 w-12 rounded-full shadow-xl","bg-background/80 backdrop-blur-md border-border/50","hover:bg-accent hover:scale-110 hover:shadow-2xl hover:border-primary/50","transition-all duration-300","group"),onClick:u,"aria-label":"回到顶部",children:[e.jsxs("svg",{className:"absolute inset-0 h-full w-full -rotate-90 transform p-1",viewBox:"0 0 44 44",children:[e.jsx("circle",{className:"text-muted-foreground/10",strokeWidth:"3",stroke:"currentColor",fill:"transparent",r:h,cx:"22",cy:"22"}),e.jsx("circle",{className:"text-primary transition-all duration-100 ease-out",strokeWidth:"3",strokeDasharray:f,strokeDashoffset:p,strokeLinecap:"round",stroke:"currentColor",fill:"transparent",r:h,cx:"22",cy:"22"})]}),e.jsx(J_,{className:"h-5 w-5 text-primary transition-transform duration-300 group-hover:-translate-y-1 group-hover:scale-110",strokeWidth:2.5}),e.jsx("div",{className:"absolute inset-0 rounded-full bg-primary/5 opacity-0 group-hover:opacity-100 transition-opacity duration-300"})]})})}const aT=f_,lT=p_,nT=g_,Mb=m.forwardRef(({className:a,sideOffset:l=4,...r},c)=>e.jsx(h_,{children:e.jsx(Kj,{ref:c,sideOffset:l,className:F("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",a),...r})}));Mb.displayName=Kj.displayName;function rT({children:a}){const{checking:l}=J5(),[r,c]=m.useState(!0),[d,u]=m.useState(!1),[h,f]=m.useState(!1),[p,g]=m.useState(!1),{theme:b,setTheme:j}=hx(),y=X0();if(m.useEffect(()=>{if(r)g(!1);else{const S=setTimeout(()=>{g(!0)},350);return()=>clearTimeout(S)}},[r]),m.useEffect(()=>{const S=U=>{(U.metaKey||U.ctrlKey)&&U.key==="k"&&(U.preventDefault(),f(!0))};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[]),l)return e.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:e.jsx("div",{className:"text-muted-foreground",children:"正在验证登录状态..."})});const N=[{title:"概览",items:[{icon:nd,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:Ea,label:"麦麦主程序配置",path:"/config/bot"},{icon:Ll,label:"AI模型厂商配置",path:"/config/modelProvider",tourId:"sidebar-model-provider"},{icon:uv,label:"模型管理与分配",path:"/config/model",tourId:"sidebar-model-management"},{icon:kg,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:ld,label:"表情包管理",path:"/resource/emoji"},{icon:Ra,label:"表达方式管理",path:"/resource/expression"},{icon:Jr,label:"黑话管理",path:"/resource/jargon"},{icon:mv,label:"人物信息管理",path:"/resource/person"},{icon:iv,label:"知识库图谱可视化",path:"/resource/knowledge-graph"},{icon:Yr,label:"麦麦知识库管理",path:"/resource/knowledge-base"}]},{title:"扩展与监控",items:[{icon:ra,label:"插件市场",path:"/plugins"},{icon:ov,label:"配置模板市场",path:"/config/pack-market"},{icon:kg,label:"插件配置",path:"/plugin-config"},{icon:rx,label:"日志查看器",path:"/logs"},{icon:tx,label:"计划器&回复器监控",path:"/planner-monitor"},{icon:Ra,label:"本地聊天室",path:"/chat"}]},{title:"系统",items:[{icon:vn,label:"系统设置",path:"/settings"}]}],M=b==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":b,A=async()=>{await z1()};return e.jsx(aT,{delayDuration:300,children:e.jsxs("div",{className:"flex h-screen overflow-hidden",children:[e.jsxs("aside",{className:F("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",r?"lg:w-64":"lg:w-16",d?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[e.jsx("div",{className:"flex h-16 items-center border-b px-4",children:e.jsxs("div",{className:F("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!r&&"lg:flex-none lg:w-8"),children:[e.jsxs("div",{className:F("flex items-baseline gap-2",!r&&"lg:hidden"),children:[e.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),e.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:x2()})]}),!r&&e.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),e.jsx(Ze,{className:F("flex-1 overflow-x-hidden",!r&&"lg:w-16"),children:e.jsx("nav",{className:F("p-4",!r&&"lg:p-2 lg:w-16"),children:e.jsx("ul",{className:F("space-y-6",!r&&"lg:space-y-3 lg:w-full"),children:N.map((S,U)=>e.jsxs("li",{children:[e.jsx("div",{className:F("px-3 h-[1.25rem]","mb-2",!r&&"lg:mb-1 lg:invisible"),children:e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:S.title})}),!r&&U>0&&e.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),e.jsx("ul",{className:"space-y-1",children:S.items.map(E=>{const C=y({to:E.path}),D=E.icon,P=e.jsxs(e.Fragment,{children:[C&&e.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),e.jsxs("div",{className:F("flex items-center transition-all duration-300",r?"gap-3":"gap-3 lg:gap-0"),children:[e.jsx(D,{className:F("h-5 w-5 flex-shrink-0",C&&"text-primary"),strokeWidth:2,fill:"none"}),e.jsx("span",{className:F("text-sm font-medium whitespace-nowrap transition-all duration-300",C&&"font-semibold",r?"opacity-100 max-w-[200px]":"opacity-100 max-w-[200px] lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:E.label})]})]});return e.jsx("li",{className:"relative",children:e.jsxs(lT,{children:[e.jsx(nT,{asChild:!0,children:e.jsx(Fn,{to:E.path,"data-tour":E.tourId,className:F("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",C?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",r?"px-3":"px-3 lg:px-0 lg:justify-center lg:w-12 lg:mx-auto"),onClick:()=>u(!1),children:P})}),p&&e.jsx(Mb,{side:"right",className:"hidden lg:block",children:e.jsx("p",{children:E.label})})]})},E.path)})})]},S.title))})})})]}),d&&e.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>u(!1)}),e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx(sT,{}),e.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{onClick:()=>u(!d),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:e.jsx(X_,{className:"h-5 w-5"})}),e.jsx("button",{onClick:()=>c(!r),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:r?"收起侧边栏":"展开侧边栏",children:e.jsx(Da,{className:F("h-5 w-5 transition-transform",!r&&"rotate-180")})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Fn,{to:"/annual-report",children:e.jsxs(_,{variant:"ghost",size:"sm",className:"gap-2 bg-gradient-to-r from-pink-500/10 to-purple-500/10 hover:from-pink-500/20 hover:to-purple-500/20 border border-pink-500/20",title:"查看年度总结",children:[e.jsx(Z_,{className:"h-4 w-4 text-pink-500"}),e.jsx("span",{className:"hidden sm:inline bg-gradient-to-r from-pink-500 to-purple-500 bg-clip-text text-transparent font-medium",children:"2025 年度总结"})]})}),e.jsxs("button",{onClick:()=>f(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[e.jsx(At,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),e.jsxs(Eb,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[e.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),e.jsx(eT,{open:h,onOpenChange:f}),e.jsxs(_,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[e.jsx(W_,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),e.jsx("button",{onClick:S=>{c2(M==="dark"?"light":"dark",j,S)},className:"rounded-lg p-2 hover:bg-accent",title:M==="dark"?"切换到浅色模式":"切换到深色模式",children:M==="dark"?e.jsx(lx,{className:"h-5 w-5"}):e.jsx(ec,{className:"h-5 w-5"})}),e.jsx("div",{className:"h-6 w-px bg-border"}),e.jsxs(_,{variant:"ghost",size:"sm",onClick:A,className:"gap-2",title:"登出系统",children:[e.jsx(e1,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),e.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:a}),e.jsx(tT,{})]})]})})}function iT(a){const l=a.split(` -`).slice(1),r=[];for(const c of l){const d=c.trim();if(!d.startsWith("at "))continue;const u=d.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);u?r.push({functionName:u[1]||"",fileName:u[2],lineNumber:u[3],columnNumber:u[4],raw:d}):r.push({functionName:"",fileName:"",lineNumber:"",columnNumber:"",raw:d})}return r}function cT({error:a,errorInfo:l}){const[r,c]=m.useState(!0),[d,u]=m.useState(!1),[h,f]=m.useState(!1),p=a.stack?iT(a.stack):[],g=async()=>{const b=` -Error: ${a.name} -Message: ${a.message} - -Stack Trace: -${a.stack||"No stack trace available"} - -Component Stack: -${l?.componentStack||"No component stack available"} - -URL: ${window.location.href} -User Agent: ${navigator.userAgent} -Time: ${new Date().toISOString()} - `.trim();try{await navigator.clipboard.writeText(b),f(!0),setTimeout(()=>f(!1),2e3)}catch(j){console.error("Failed to copy:",j)}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(it,{variant:"destructive",className:"border-red-500/50 bg-red-500/10",children:[e.jsx(It,{className:"h-4 w-4"}),e.jsxs(ct,{className:"font-mono text-sm",children:[e.jsxs("span",{className:"font-semibold",children:[a.name,":"]})," ",a.message]})]}),p.length>0&&e.jsxs(uc,{open:r,onOpenChange:c,children:[e.jsx(mc,{asChild:!0,children:e.jsxs(_,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[e.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(s1,{className:"h-4 w-4"}),"Stack Trace (",p.length," frames)"]}),r?e.jsx(Qr,{className:"h-4 w-4"}):e.jsx(za,{className:"h-4 w-4"})]})}),e.jsx(xc,{children:e.jsx(Ze,{className:"h-[280px] rounded-md border bg-muted/30",children:e.jsx("div",{className:"p-3 space-y-1",children:p.map((b,j)=>e.jsx("div",{className:"font-mono text-xs p-2 rounded hover:bg-muted/50 transition-colors",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs("span",{className:"text-muted-foreground w-6 text-right flex-shrink-0",children:[j+1,"."]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-primary font-medium",children:b.functionName}),b.fileName&&e.jsxs("div",{className:"text-muted-foreground mt-0.5 break-all",children:[b.fileName,b.lineNumber&&e.jsxs("span",{className:"text-yellow-600 dark:text-yellow-400",children:[":",b.lineNumber,":",b.columnNumber]})]})]})]})},j))})})})]}),l?.componentStack&&e.jsxs(uc,{open:d,onOpenChange:u,children:[e.jsx(mc,{asChild:!0,children:e.jsxs(_,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[e.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(It,{className:"h-4 w-4"}),"Component Stack"]}),d?e.jsx(Qr,{className:"h-4 w-4"}):e.jsx(za,{className:"h-4 w-4"})]})}),e.jsx(xc,{children:e.jsx(Ze,{className:"h-[200px] rounded-md border bg-muted/30",children:e.jsx("pre",{className:"p-3 font-mono text-xs whitespace-pre-wrap text-muted-foreground",children:l.componentStack})})})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:g,className:"w-full",children:h?e.jsxs(e.Fragment,{children:[e.jsx(Mt,{className:"mr-2 h-4 w-4 text-green-500"}),"已复制到剪贴板"]}):e.jsxs(e.Fragment,{children:[e.jsx(Fo,{className:"mr-2 h-4 w-4"}),"复制错误信息"]})})]})}function Ab({error:a,errorInfo:l}){const r=()=>{window.location.href="/"},c=()=>{window.location.reload()};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs(ke,{className:"w-full max-w-2xl shadow-lg",children:[e.jsxs(Re,{className:"text-center pb-2",children:[e.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30 mb-4",children:e.jsx(It,{className:"h-8 w-8 text-red-600 dark:text-red-400"})}),e.jsx(De,{className:"text-2xl font-bold",children:"页面出现了问题"}),e.jsx(is,{className:"text-base mt-2",children:"应用程序遇到了意外错误。您可以尝试刷新页面或返回首页。"})]}),e.jsxs(Me,{className:"space-y-4",children:[e.jsx(cT,{error:a,errorInfo:l}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 pt-2",children:[e.jsxs(_,{onClick:c,className:"flex-1",children:[e.jsx(xt,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),e.jsxs(_,{onClick:r,variant:"outline",className:"flex-1",children:[e.jsx(nd,{className:"mr-2 h-4 w-4"}),"返回首页"]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground pt-2",children:"如果问题持续存在,请将错误信息复制并反馈给开发者"})]})]})})}class oT extends m.Component{constructor(l){super(l),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(l){return{hasError:!0,error:l}}componentDidCatch(l,r){console.error("ErrorBoundary caught an error:",l,r),this.setState({errorInfo:r})}handleReset=()=>{this.setState({hasError:!1,error:null,errorInfo:null})};render(){return this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback:e.jsx(Ab,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}function zb({error:a}){return e.jsx(Ab,{error:a,errorInfo:null})}const vc=Z0({component:()=>e.jsxs(e.Fragment,{children:[e.jsx(ij,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!X5())throw ew({to:"/auth"})}}),dT=Zs({getParentRoute:()=>vc,path:"/auth",component:E2}),uT=Zs({getParentRoute:()=>vc,path:"/setup",component:G2}),ot=Zs({getParentRoute:()=>vc,id:"protected",component:()=>e.jsx(rT,{children:e.jsx(ij,{})}),errorComponent:({error:a})=>e.jsx(zb,{error:a})}),mT=Zs({getParentRoute:()=>ot,path:"/",component:l2}),xT=Zs({getParentRoute:()=>ot,path:"/config/bot",component:FS}),hT=Zs({getParentRoute:()=>ot,path:"/config/modelProvider",component:e4}),fT=Zs({getParentRoute:()=>ot,path:"/config/model",component:S4}),pT=Zs({getParentRoute:()=>ot,path:"/config/adapter",component:E4}),gT=Zs({getParentRoute:()=>ot,path:"/resource/emoji",component:Z4}),jT=Zs({getParentRoute:()=>ot,path:"/resource/expression",component:tk}),vT=Zs({getParentRoute:()=>ot,path:"/resource/person",component:kk}),NT=Zs({getParentRoute:()=>ot,path:"/resource/jargon",component:pk}),bT=Zs({getParentRoute:()=>ot,path:"/resource/knowledge-graph",component:Ok}),yT=Zs({getParentRoute:()=>ot,path:"/resource/knowledge-base",component:Lk}),wT=Zs({getParentRoute:()=>ot,path:"/logs",component:$k}),_T=Zs({getParentRoute:()=>ot,path:"/planner-monitor",component:Kk}),ST=Zs({getParentRoute:()=>ot,path:"/chat",component:zC}),kT=Zs({getParentRoute:()=>ot,path:"/plugins",component:xC}),CT=Zs({getParentRoute:()=>ot,path:"/plugin-detail",component:wC}),TT=Zs({getParentRoute:()=>ot,path:"/model-presets",component:fC}),ET=Zs({getParentRoute:()=>ot,path:"/plugin-config",component:jC}),MT=Zs({getParentRoute:()=>ot,path:"/plugin-mirrors",component:NC}),AT=Zs({getParentRoute:()=>ot,path:"/settings",component:y2}),zT=Zs({getParentRoute:()=>ot,path:"/config/pack-market",component:A5}),Rb=Zs({getParentRoute:()=>ot,path:"/config/pack-market/$packId",component:K5}),RT=Zs({getParentRoute:()=>ot,path:"/survey/webui-feedback",component:QC}),DT=Zs({getParentRoute:()=>ot,path:"/survey/maibot-feedback",component:YC}),OT=Zs({getParentRoute:()=>ot,path:"/annual-report",component:s5}),LT=Zs({getParentRoute:()=>vc,path:"*",component:Pv}),UT=vc.addChildren([dT,uT,ot.addChildren([mT,xT,hT,fT,pT,gT,jT,NT,vT,bT,yT,kT,CT,TT,ET,MT,wT,_T,ST,AT,zT,Rb,RT,DT,OT]),LT]),$T=W0({routeTree:UT,defaultNotFoundComponent:Pv,defaultErrorComponent:({error:a})=>e.jsx(zb,{error:a})});function BT({children:a,defaultTheme:l="system",storageKey:r="ui-theme",...c}){const[d,u]=m.useState(()=>localStorage.getItem(r)||l);m.useEffect(()=>{const f=window.document.documentElement;if(f.classList.remove("light","dark"),d==="system"){const p=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";f.classList.add(p);return}f.classList.add(d)},[d]),m.useEffect(()=>{const f=localStorage.getItem("accent-color");if(f){const p=document.documentElement,b={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[f];b&&(p.style.setProperty("--primary",b.hsl),b.gradient?(p.style.setProperty("--primary-gradient",b.gradient),p.classList.add("has-gradient")):(p.style.removeProperty("--primary-gradient"),p.classList.remove("has-gradient")))}},[]);const h={theme:d,setTheme:f=>{localStorage.setItem(r,f),u(f)}};return e.jsx(Lv.Provider,{...c,value:h,children:a})}function IT({children:a,defaultEnabled:l=!0,defaultWavesEnabled:r=!0,storageKey:c="enable-animations",wavesStorageKey:d="enable-waves-background"}){const[u,h]=m.useState(()=>{const b=localStorage.getItem(c);return b!==null?b==="true":l}),[f,p]=m.useState(()=>{const b=localStorage.getItem(d);return b!==null?b==="true":r});m.useEffect(()=>{const b=document.documentElement;u?b.classList.remove("no-animations"):b.classList.add("no-animations"),localStorage.setItem(c,String(u))},[u,c]),m.useEffect(()=>{localStorage.setItem(d,String(f))},[f,d]);const g={enableAnimations:u,setEnableAnimations:h,enableWavesBackground:f,setEnableWavesBackground:p};return e.jsx(Uv.Provider,{value:g,children:a})}const PT=j_,Db=m.forwardRef(({className:a,...l},r)=>e.jsx(Qj,{ref:r,className:F("fixed bottom-0 right-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:max-w-[420px] gap-2",a),...l}));Db.displayName=Qj.displayName;const FT=Wr("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-slide-in-from-right data-[state=open]:animate-fade-in data-[state=closed]:animate-slide-out-to-right data-[state=closed]:animate-fade-out data-[swipe=end]:animate-slide-out-to-right",{variants:{variant:{default:"border bg-primary/5 text-foreground backdrop-blur-sm",destructive:"destructive group border-destructive bg-destructive/10 text-destructive-foreground backdrop-blur-sm"}},defaultVariants:{variant:"default"}}),Ob=m.forwardRef(({className:a,variant:l,...r},c)=>e.jsx(Yj,{ref:c,className:F(FT({variant:l}),a),...r}));Ob.displayName=Yj.displayName;const HT=m.forwardRef(({className:a,...l},r)=>e.jsx(Jj,{ref:r,className:F("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",a),...l}));HT.displayName=Jj.displayName;const Lb=m.forwardRef(({className:a,...l},r)=>e.jsx(Xj,{ref:r,className:F("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",a),"toast-close":"",...l,children:e.jsx(Aa,{className:"h-4 w-4"})}));Lb.displayName=Xj.displayName;const Ub=m.forwardRef(({className:a,...l},r)=>e.jsx(Zj,{ref:r,className:F("text-sm font-semibold [&+div]:text-xs",a),...l}));Ub.displayName=Zj.displayName;const $b=m.forwardRef(({className:a,...l},r)=>e.jsx(Wj,{ref:r,className:F("text-sm opacity-90",a),...l}));$b.displayName=Wj.displayName;function VT(){const{toasts:a}=Ws();return e.jsxs(PT,{children:[a.map(function({id:l,title:r,description:c,action:d,...u}){return e.jsxs(Ob,{...u,children:[e.jsxs("div",{className:"grid gap-1",children:[r&&e.jsx(Ub,{children:r}),c&&e.jsx($b,{children:c})]}),d,e.jsx(Lb,{})]},l)}),e.jsx(Db,{})]})}A1.createRoot(document.getElementById("root")).render(e.jsx(m.StrictMode,{children:e.jsx(oT,{children:e.jsx(BT,{defaultTheme:"system",children:e.jsx(IT,{children:e.jsxs(QS,{children:[e.jsx(sw,{router:$T}),e.jsx(XS,{}),e.jsx(VT,{})]})})})})})); diff --git a/webui/dist/assets/index-CcX1ThoO.css b/webui/dist/assets/index-CcX1ThoO.css deleted file mode 100644 index 5ad471ed..00000000 --- a/webui/dist/assets/index-CcX1ThoO.css +++ /dev/null @@ -1 +0,0 @@ -@charset "UTF-8";*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 221.2 83.2% 53.3%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 221.2 83.2% 53.3%;--radius: .5rem;--chart-1: 221.2 83.2% 53.3%;--chart-2: 160 60% 45%;--chart-3: 30 80% 55%;--chart-4: 280 65% 60%;--chart-5: 340 75% 55%}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 217.2 91.2% 59.8%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 224.3 76.3% 48%;--chart-1: 217.2 91.2% 59.8%;--chart-2: 160 60% 50%;--chart-3: 30 80% 60%;--chart-4: 280 65% 65%;--chart-5: 340 75% 60%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-16{inset:4rem}.inset-8{inset:2rem}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.-bottom-20{bottom:-5rem}.-left-20{left:-5rem}.-right-2{right:-.5rem}.-right-20{right:-5rem}.-top-2{top:-.5rem}.-top-20{top:-5rem}.bottom-0{bottom:0}.bottom-1\/4{bottom:25%}.bottom-24{bottom:6rem}.bottom-4{bottom:1rem}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-1\/4{left:25%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-1\/3{right:33.333333%}.right-1\/4{right:25%}.right-2{right:.5rem}.right-4{right:1rem}.right-8{right:2rem}.top-0{top:0}.top-1{top:.25rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-3{top:.75rem}.top-3\/4{top:75%}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.order-1{order:1}.order-2{order:2}.col-span-1{grid-column:span 1 / span 1}.col-span-2{grid-column:span 2 / span 2}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-0{margin-left:0;margin-right:0}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-1{margin-top:-.25rem}.-mt-2{margin-top:-.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-10{margin-left:2.5rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.size-\[--cell-size\]{width:var(--cell-size);height:var(--cell-size)}.h-0\.5{height:.125rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-60{height:15rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[--cell-size\]{height:var(--cell-size)}.h-\[1\.25rem\]{height:1.25rem}.h-\[1px\]{height:1px}.h-\[200px\]{height:200px}.h-\[250px\]{height:250px}.h-\[280px\]{height:280px}.h-\[300px\]{height:300px}.h-\[350px\]{height:350px}.h-\[400px\]{height:400px}.h-\[600px\]{height:600px}.h-\[70vh\]{height:70vh}.h-\[90vh\]{height:90vh}.h-\[calc\(100vh-12rem\)\]{height:calc(100vh - 12rem)}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[calc\(100vh-240px\)\]{height:calc(100vh - 240px)}.h-\[calc\(100vh-260px\)\]{height:calc(100vh - 260px)}.h-\[calc\(100vh-4rem\)\]{height:calc(100vh - 4rem)}.h-\[calc\(85vh-220px\)\]{height:calc(85vh - 220px)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-64{max-height:16rem}.max-h-\[--radix-context-menu-content-available-height\]{max-height:var(--radix-context-menu-content-available-height)}.max-h-\[--radix-select-content-available-height\]{max-height:var(--radix-select-content-available-height)}.max-h-\[200px\]{max-height:200px}.max-h-\[300px\]{max-height:300px}.max-h-\[60vh\]{max-height:60vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(90vh-120px\)\]{max-height:calc(90vh - 120px)}.max-h-\[calc\(90vh-8rem\)\]{max-height:calc(90vh - 8rem)}.max-h-full{max-height:100%}.max-h-none{max-height:none}.max-h-screen{max-height:100vh}.min-h-0{min-height:0px}.min-h-10{min-height:2.5rem}.min-h-\[100px\]{min-height:100px}.min-h-\[300px\]{min-height:300px}.min-h-\[400px\]{min-height:400px}.min-h-\[40px\]{min-height:40px}.min-h-\[60px\]{min-height:60px}.min-h-\[xxx\]{min-height:xxx}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-2\/3{width:66.666667%}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-\[--cell-size\]{width:var(--cell-size)}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[130px\]{width:130px}.w-\[140px\]{width:140px}.w-\[1px\]{width:1px}.w-\[200px\]{width:200px}.w-\[600px\]{width:600px}.w-\[65px\]{width:65px}.w-\[70px\]{width:70px}.w-\[95vw\]{width:95vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[--cell-size\]{min-width:var(--cell-size)}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[140px\]{min-width:140px}.min-w-\[160px\]{min-width:160px}.min-w-\[200px\]{min-width:200px}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.max-w-24{max-width:6rem}.max-w-2xl{max-width:42rem}.max-w-32{max-width:8rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[150px\]{max-width:150px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[60px\]{max-width:60px}.max-w-\[75\%\]{max-width:75%}.max-w-\[90\%\]{max-width:90%}.max-w-\[95vw\]{max-width:95vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-none{flex:none}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.origin-\[--radix-context-menu-content-transform-origin\]{transform-origin:var(--radix-context-menu-content-transform-origin)}.origin-\[--radix-popover-content-transform-origin\]{transform-origin:var(--radix-popover-content-transform-origin)}.origin-\[--radix-select-content-transform-origin\]{transform-origin:var(--radix-select-content-transform-origin)}.origin-\[--radix-tooltip-content-transform-origin\]{transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-32{--tw-translate-x: 8rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.animate-\[ping_3s_ease-in-out_infinite\]{animation:ping 3s ease-in-out infinite}.animate-\[ping_3s_ease-in-out_infinite_0\.5s\]{animation:ping 3s ease-in-out infinite .5s}.animate-\[ping_3s_ease-in-out_infinite_1s\]{animation:ping 3s ease-in-out infinite 1s}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-none{resize:none}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.break-inside-avoid{-moz-column-break-inside:avoid;break-inside:avoid}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-rows-\[auto_1fr_auto\]{grid-template-rows:auto 1fr auto}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.rounded-tr-sm{border-top-right-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-4{border-width:4px}.border-\[1\.5px\]{border-width:1.5px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[--color-border\]{border-color:var(--color-border)}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-amber-500\/20{border-color:#f59e0b33}.border-amber-500\/50{border-color:#f59e0b80}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-700{--tw-border-opacity: 1;border-color:rgb(29 78 216 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-green-300{--tw-border-opacity: 1;border-color:rgb(134 239 172 / var(--tw-border-opacity, 1))}.border-green-500{--tw-border-opacity: 1;border-color:rgb(34 197 94 / var(--tw-border-opacity, 1))}.border-green-600{--tw-border-opacity: 1;border-color:rgb(22 163 74 / var(--tw-border-opacity, 1))}.border-green-700{--tw-border-opacity: 1;border-color:rgb(21 128 61 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-muted-foreground\/30{border-color:hsl(var(--muted-foreground) / .3)}.border-muted-foreground\/50{border-color:hsl(var(--muted-foreground) / .5)}.border-orange-200{--tw-border-opacity: 1;border-color:rgb(254 215 170 / var(--tw-border-opacity, 1))}.border-orange-500{--tw-border-opacity: 1;border-color:rgb(249 115 22 / var(--tw-border-opacity, 1))}.border-orange-600{--tw-border-opacity: 1;border-color:rgb(234 88 12 / var(--tw-border-opacity, 1))}.border-pink-500\/20{border-color:#ec489933}.border-primary{border-color:hsl(var(--primary))}.border-primary\/10{border-color:hsl(var(--primary) / .1)}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-primary\/30{border-color:hsl(var(--primary) / .3)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-purple-500{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-red-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/50{border-color:#ef444480}.border-transparent{border-color:transparent}.border-white\/30{border-color:#ffffff4d}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-yellow-500\/50{border-color:#eab30880}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-amber-700{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.bg-background{background-color:hsl(var(--background))}.bg-background\/50{background-color:hsl(var(--background) / .5)}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-background\/95{background-color:hsl(var(--background) / .95)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-card\/50{background-color:hsl(var(--card) / .5)}.bg-card\/80{background-color:hsl(var(--card) / .8)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-800\/20{background-color:#1f293733}.bg-gray-800\/30{background-color:#1f29374d}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted-foreground\/50{background-color:hsl(var(--muted-foreground) / .5)}.bg-muted\/20{background-color:hsl(var(--muted) / .2)}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-muted\/60{background-color:hsl(var(--muted) / .6)}.bg-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary-foreground\/20{background-color:hsl(var(--primary-foreground) / .2)}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/15{background-color:hsl(var(--primary) / .15)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-primary\/60{background-color:hsl(var(--primary) / .6)}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/5{background-color:hsl(var(--secondary) / .05)}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\/10{background-color:#ffffff1a}.bg-white\/20{background-color:#fff3}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-500\/5{background-color:#eab3080d}.bg-yellow-900\/20{background-color:#713f1233}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-amber-50{--tw-gradient-from: #fffbeb var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 251 235 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-background{--tw-gradient-from: hsl(var(--background)) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-50{--tw-gradient-from: #eef2ff var(--tw-gradient-from-position);--tw-gradient-to: rgb(238 242 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-pink-50{--tw-gradient-from: #fdf2f8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(253 242 248 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-pink-500{--tw-gradient-from: #ec4899 var(--tw-gradient-from-position);--tw-gradient-to: rgb(236 72 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-pink-500\/10{--tw-gradient-from: rgb(236 72 153 / .1) var(--tw-gradient-from-position);--tw-gradient-to: rgb(236 72 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\/5{--tw-gradient-from: hsl(var(--primary) / .05) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-rose-50{--tw-gradient-from: #fff1f2 var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 241 242 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-200{--tw-gradient-from: #e2e8f0 var(--tw-gradient-from-position);--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-300{--tw-gradient-from: #cbd5e1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(203 213 225 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-400{--tw-gradient-from: #94a3b8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(148 163 184 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background)) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-blue-50{--tw-gradient-to: #eff6ff var(--tw-gradient-to-position)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-emerald-500{--tw-gradient-to: #10b981 var(--tw-gradient-to-position)}.to-green-600{--tw-gradient-to: #16a34a var(--tw-gradient-to-position)}.to-muted\/50{--tw-gradient-to: hsl(var(--muted) / .5) var(--tw-gradient-to-position)}.to-orange-50{--tw-gradient-to: #fff7ed var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-50{--tw-gradient-to: #fdf2f8 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-primary\/10{--tw-gradient-to: hsl(var(--primary) / .1) var(--tw-gradient-to-position)}.to-purple-50{--tw-gradient-to: #faf5ff var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.to-purple-500\/10{--tw-gradient-to: rgb(168 85 247 / .1) var(--tw-gradient-to-position)}.to-secondary\/5{--tw-gradient-to: hsl(var(--secondary) / .05) var(--tw-gradient-to-position)}.to-slate-700{--tw-gradient-to: #334155 var(--tw-gradient-to-position)}.to-slate-800{--tw-gradient-to: #1e293b var(--tw-gradient-to-position)}.to-slate-900{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.to-violet-50{--tw-gradient-to: #f5f3ff var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.fill-current{fill:currentColor}.fill-red-500{fill:#ef4444}.fill-yellow-400{fill:#facc15}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[1px\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.px-\[--cell-size\]{padding-left:var(--cell-size);padding-right:var(--cell-size)}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-0{padding-bottom:0}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-10{padding-left:2.5rem}.pl-11{padding-left:2.75rem}.pl-2{padding-left:.5rem}.pl-2\.5{padding-left:.625rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-16{padding-right:4rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[150px\]{font-size:150px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-tighter{letter-spacing:-.05em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-amber-800{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}.text-amber-900{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-indigo-600{--tw-text-opacity: 1;color:rgb(79 70 229 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/10{color:hsl(var(--muted-foreground) / .1)}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-500{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-orange-900{--tw-text-opacity: 1;color:rgb(124 45 18 / var(--tw-text-opacity, 1))}.text-pink-500{--tw-text-opacity: 1;color:rgb(236 72 153 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary-foreground\/70{color:hsl(var(--primary-foreground) / .7)}.text-primary\/10{color:hsl(var(--primary) / .1)}.text-primary\/30{color:hsl(var(--primary) / .3)}.text-primary\/60{color:hsl(var(--primary) / .6)}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-primary{--tw-ring-color: hsl(var(--primary))}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.delay-150{transition-delay:.15s}.delay-300{transition-delay:.3s}.duration-100{transition-duration:.1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.text-primary-gradient{color:hsl(var(--primary))}.has-gradient .text-primary-gradient{background:var(--primary-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.\[--cell-size\:2rem\]{--cell-size: 2rem}@font-face{font-family:JetBrains Mono;src:url(/fonts/JetBrainsMono-Medium.ttf) format("truetype");font-weight:500;font-style:normal;font-display:swap}.no-animations *,.no-animations *:before,.no-animations *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.no-animations *:hover{transition-duration:.01ms!important}::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:999}.__floater{z-index:99999!important;pointer-events:auto!important}.react-joyride__overlay,.react-joyride__spotlight{z-index:99998!important}.react-joyride__tooltip{pointer-events:auto!important}#tour-portal-container *{pointer-events:auto}.custom-scrollbar{scrollbar-width:thin;scrollbar-color:hsl(var(--border)) transparent}.custom-scrollbar::-webkit-scrollbar{width:8px;height:8px}.custom-scrollbar::-webkit-scrollbar-track{background:transparent;border-radius:4px}.custom-scrollbar::-webkit-scrollbar-thumb{background:hsl(var(--border));border-radius:4px;border:2px solid transparent;background-clip:content-box}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background:hsl(var(--muted-foreground) / .5);background-clip:content-box}.custom-scrollbar::-webkit-scrollbar-corner{background:transparent}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-muted-foreground\/50:hover{border-color:hsl(var(--muted-foreground) / .5)}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.hover\:bg-amber-700:hover{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-50:hover{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-muted-foreground\/20:hover{background-color:hsl(var(--muted-foreground) / .2)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity, 1))}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary) / .1)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-50:hover{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-white\/30:hover{background-color:#ffffff4d}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:from-pink-500\/20:hover{--tw-gradient-from: rgb(236 72 153 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(236 72 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-purple-500\/20:hover{--tw-gradient-to: rgb(168 85 247 / .2) var(--tw-gradient-to-position)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-amber-900:hover{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-green-700:hover{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.hover\:text-orange-700:hover{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity, 1))}.hover\:text-primary:hover{color:hsl(var(--primary))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:text-yellow-300:hover{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-2xl:hover{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:ring-2:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:ring-primary:hover{--tw-ring-color: hsl(var(--primary))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-0:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:cursor-grabbing:active{cursor:grabbing}.active\:border-primary\/70:active{border-color:hsl(var(--primary) / .7)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:-translate-y-1{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[state\=inactive\]\:hidden[data-state=inactive]{display:none}.data-\[state\=inactive\]\:h-0[data-state=inactive]{height:0px}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fade-out{0%{opacity:1}to{opacity:0}}.data-\[state\=closed\]\:animate-fade-out[data-state=closed]{animation:fade-out .15s ease-in}.data-\[state\=closed\]\:animate-slide-out-to-right[data-state=closed]{animation:slide-out-to-right .2s ease-in}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.data-\[state\=open\]\:animate-fade-in[data-state=open]{animation:fade-in .2s ease-out}@keyframes slide-in-from-right{0%{transform:translate(100%)}to{transform:translate(0)}}.data-\[state\=open\]\:animate-slide-in-from-right[data-state=open]{animation:slide-in-from-right .3s ease-out}@keyframes slide-out-to-right{0%{transform:translate(0)}to{transform:translate(100%)}}.data-\[swipe\=end\]\:animate-slide-out-to-right[data-swipe=end]{animation:slide-out-to-right .2s ease-in}.data-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true]{border-radius:0}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=active\]\:duration-300[data-state=active]{transition-duration:.3s}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}@supports (backdrop-filter: var(--tw)){.supports-\[backdrop-filter\]\:bg-background\/60{background-color:hsl(var(--background) / .6)}}.dark\:border-amber-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(146 64 14 / var(--tw-border-opacity, 1))}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.dark\:border-blue-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 58 138 / var(--tw-border-opacity, 1))}.dark\:border-gray-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(17 24 39 / var(--tw-border-opacity, 1))}.dark\:border-green-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(22 101 52 / var(--tw-border-opacity, 1))}.dark\:border-green-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(20 83 45 / var(--tw-border-opacity, 1))}.dark\:border-orange-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(124 45 18 / var(--tw-border-opacity, 1))}.dark\:border-red-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(127 29 29 / var(--tw-border-opacity, 1))}.dark\:border-yellow-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(113 63 18 / var(--tw-border-opacity, 1))}.dark\:bg-amber-950\/30:is(.dark *){background-color:#451a034d}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950\/20:is(.dark *){background-color:#17255433}.dark\:bg-blue-950\/30:is(.dark *){background-color:#1725544d}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/30:is(.dark *){background-color:#1f29374d}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-green-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(5 46 22 / var(--tw-bg-opacity, 1))}.dark\:bg-green-950\/20:is(.dark *){background-color:#052e1633}.dark\:bg-orange-950\/20:is(.dark *){background-color:#43140733}.dark\:bg-red-500\/20:is(.dark *){background-color:#ef444433}.dark\:bg-red-600\/30:is(.dark *){background-color:#dc26264d}.dark\:bg-red-900\/30:is(.dark *){background-color:#7f1d1d4d}.dark\:bg-red-950\/20:is(.dark *){background-color:#450a0a33}.dark\:bg-red-950\/50:is(.dark *){background-color:#450a0a80}.dark\:bg-yellow-500\/20:is(.dark *){background-color:#eab30833}.dark\:bg-yellow-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(113 63 18 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:from-amber-950\/20:is(.dark *){--tw-gradient-from: rgb(69 26 3 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(69 26 3 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-indigo-950\/20:is(.dark *){--tw-gradient-from: rgb(30 27 75 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(30 27 75 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-pink-950\/20:is(.dark *){--tw-gradient-from: rgb(80 7 36 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(80 7 36 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-rose-950\/20:is(.dark *){--tw-gradient-from: rgb(76 5 25 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(76 5 25 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:to-blue-950\/20:is(.dark *){--tw-gradient-to: rgb(23 37 84 / .2) var(--tw-gradient-to-position)}.dark\:to-orange-950\/20:is(.dark *){--tw-gradient-to: rgb(67 20 7 / .2) var(--tw-gradient-to-position)}.dark\:to-pink-950\/20:is(.dark *){--tw-gradient-to: rgb(80 7 36 / .2) var(--tw-gradient-to-position)}.dark\:to-purple-950\/20:is(.dark *){--tw-gradient-to: rgb(59 7 100 / .2) var(--tw-gradient-to-position)}.dark\:to-violet-950\/20:is(.dark *){--tw-gradient-to: rgb(46 16 101 / .2) var(--tw-gradient-to-position)}.dark\:text-amber-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 243 199 / var(--tw-text-opacity, 1))}.dark\:text-amber-200:is(.dark *){--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.dark\:text-amber-400:is(.dark *){--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.dark\:text-amber-500:is(.dark *){--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.dark\:text-blue-100:is(.dark *){--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-cyan-500:is(.dark *){--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-green-300:is(.dark *){--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-indigo-400:is(.dark *){--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.dark\:text-orange-100:is(.dark *){--tw-text-opacity: 1;color:rgb(255 237 213 / var(--tw-text-opacity, 1))}.dark\:text-orange-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 215 170 / var(--tw-text-opacity, 1))}.dark\:text-red-300:is(.dark *){--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-red-500:is(.dark *){--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:text-yellow-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.dark\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:text-yellow-500:is(.dark *){--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:hover\:text-amber-200:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.dark\:focus\:bg-gray-800:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}@media(min-width:640px){.sm\:right-2{right:.5rem}.sm\:right-3{right:.75rem}.sm\:top-2{top:.5rem}.sm\:top-3{top:.75rem}.sm\:order-1{order:1}.sm\:order-2{order:2}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-3{margin-bottom:.75rem}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:ml-0{margin-left:0}.sm\:ml-1{margin-left:.25rem}.sm\:mr-1{margin-right:.25rem}.sm\:mt-0{margin-top:0}.sm\:mt-2{margin-top:.5rem}.sm\:mt-3{margin-top:.75rem}.sm\:mt-6{margin-top:1.5rem}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-12{height:3rem}.sm\:h-2{height:.5rem}.sm\:h-2\.5{height:.625rem}.sm\:h-24{height:6rem}.sm\:h-4{height:1rem}.sm\:h-5{height:1.25rem}.sm\:h-8{height:2rem}.sm\:h-9{height:2.25rem}.sm\:h-\[300px\]{height:300px}.sm\:h-\[400px\]{height:400px}.sm\:h-\[500px\]{height:500px}.sm\:h-\[85vh\]{height:85vh}.sm\:h-\[calc\(100vh-220px\)\]{height:calc(100vh - 220px)}.sm\:h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.sm\:w-10{width:2.5rem}.sm\:w-2{width:.5rem}.sm\:w-2\.5{width:.625rem}.sm\:w-24{width:6rem}.sm\:w-28{width:7rem}.sm\:w-32{width:8rem}.sm\:w-4{width:1rem}.sm\:w-48{width:12rem}.sm\:w-5{width:1.25rem}.sm\:w-8{width:2rem}.sm\:w-80{width:20rem}.sm\:w-96{width:24rem}.sm\:w-\[200px\]{width:200px}.sm\:w-\[500px\]{width:500px}.sm\:w-auto{width:auto}.sm\:w-full{width:100%}.sm\:min-w-\[120px\]{min-width:120px}.sm\:max-w-2xl{max-width:42rem}.sm\:max-w-32{max-width:8rem}.sm\:max-w-\[420px\]{max-width:420px}.sm\:max-w-\[500px\]{max-width:500px}.sm\:max-w-\[70\%\]{max-width:70%}.sm\:max-w-\[900px\]{max-width:900px}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-1{flex:1 1 0%}.sm\:flex-none{flex:none}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-start{align-items:flex-start}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-0{gap:0px}.sm\:gap-1{gap:.25rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.sm\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.sm\:space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.sm\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-2{padding-top:.5rem;padding-bottom:.5rem}.sm\:pb-3{padding-bottom:.75rem}.sm\:pt-6{padding-top:1.5rem}.sm\:text-left{text-align:left}.sm\:text-right{text-align:right}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-6xl{font-size:3.75rem;line-height:1}.sm\:text-\[200px\]{font-size:200px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}.sm\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:768px){.md\:top-4{top:1rem}.md\:col-span-2{grid-column:span 2 / span 2}.md\:mb-4{margin-bottom:1rem}.md\:mb-6{margin-bottom:1.5rem}.md\:mb-8{margin-bottom:2rem}.md\:mt-8{margin-top:2rem}.md\:block{display:block}.md\:inline{display:inline}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-16{height:4rem}.md\:h-4{height:1rem}.md\:h-5{height:1.25rem}.md\:h-8{height:2rem}.md\:h-96{height:24rem}.md\:h-\[500px\]{height:500px}.md\:min-h-\[400px\]{min-height:400px}.md\:w-16{width:4rem}.md\:w-4{width:1rem}.md\:w-5{width:1.25rem}.md\:w-8{width:2rem}.md\:w-96{width:24rem}.md\:max-w-none{max-width:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-2{gap:.5rem}.md\:gap-3{gap:.75rem}.md\:gap-4{gap:1rem}.md\:gap-6{gap:1.5rem}.md\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.md\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.md\:whitespace-normal{white-space:normal}.md\:p-12{padding:3rem}.md\:p-4{padding:1rem}.md\:p-6{padding:1.5rem}.md\:p-8{padding:2rem}.md\:text-2xl{font-size:1.5rem;line-height:2rem}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-lg{font-size:1.125rem;line-height:1.75rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:1024px){.lg\:invisible{visibility:hidden}.lg\:relative{position:relative}.lg\:z-0{z-index:0}.lg\:col-span-1{grid-column:span 1 / span 1}.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:mx-auto{margin-left:auto;margin-right:auto}.lg\:mb-1{margin-bottom:.25rem}.lg\:block{display:block}.lg\:inline{display:inline}.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:w-12{width:3rem}.lg\:w-16{width:4rem}.lg\:w-64{width:16rem}.lg\:w-8{width:2rem}.lg\:w-\[130px\]{width:130px}.lg\:w-\[160px\]{width:160px}.lg\:w-\[75px\]{width:75px}.lg\:w-auto{width:auto}.lg\:w-full{width:100%}.lg\:max-w-0{max-width:0px}.lg\:flex-1{flex:1 1 0%}.lg\:flex-none{flex:none}.lg\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:items-center{align-items:center}.lg\:justify-center{justify-content:center}.lg\:gap-0{gap:0px}.lg\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.lg\:overflow-hidden{overflow:hidden}.lg\:p-2{padding:.5rem}.lg\:p-4{padding:1rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:px-4{padding-left:1rem;padding-right:1rem}.lg\:pb-4{padding-bottom:1rem}.lg\:text-2xl{font-size:1.5rem;line-height:2rem}.lg\:opacity-0{opacity:0}}@media(min-width:1280px){.xl\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}@media print{.print\:hidden{display:none}.print\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.print\:rounded-none{border-radius:0}.print\:p-0{padding:0}.print\:shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\:\:-webkit-scrollbar-thumb\:hover\]\:bg-border\/80::-webkit-scrollbar-thumb:hover{background-color:hsl(var(--border) / .8)}.\[\&\:\:-webkit-scrollbar-thumb\]\:rounded-full::-webkit-scrollbar-thumb{border-radius:9999px}.\[\&\:\:-webkit-scrollbar-thumb\]\:bg-border::-webkit-scrollbar-thumb{background-color:hsl(var(--border))}.\[\&\:\:-webkit-scrollbar-track\]\:bg-transparent::-webkit-scrollbar-track{background-color:transparent}.\[\&\:\:-webkit-scrollbar\]\:w-2\.5::-webkit-scrollbar{width:.625rem}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>div\]\:bg-green-500>div{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:hsl(var(--muted-foreground))}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:hsl(var(--border) / .5)}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:hsl(var(--border))}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-layer\]\:outline-none .recharts-layer{outline:2px solid transparent;outline-offset:2px}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:hsl(var(--muted))}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-sector\]\:outline-none .recharts-sector,.\[\&_\.recharts-surface\]\:outline-none .recharts-surface{outline:2px solid transparent;outline-offset:2px}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:invisible svg{visibility:hidden}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}[data-slot=card-content] .\[\[data-slot\=card-content\]_\&\]\:bg-transparent,[data-slot=popover-content] .\[\[data-slot\=popover-content\]_\&\]\:bg-transparent{background-color:transparent}@font-face{font-display:block;font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2) format("woff2"),url(/assets/KaTeX_AMS-Regular-DMm9YOAa.woff) format("woff"),url(/assets/KaTeX_AMS-Regular-DRggAlZN.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff) format("woff"),url(/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff) format("woff"),url(/assets/KaTeX_Fraktur-Regular-CB_wures.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Main-Bold-Cx986IdX.woff2) format("woff2"),url(/assets/KaTeX_Main-Bold-Jm3AIy58.woff) format("woff"),url(/assets/KaTeX_Main-Bold-waoOVXN0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2) format("woff2"),url(/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff) format("woff"),url(/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2) format("woff2"),url(/assets/KaTeX_Main-Italic-BMLOBm91.woff) format("woff"),url(/assets/KaTeX_Main-Italic-3WenGoN9.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Main-Regular-B22Nviop.woff2) format("woff2"),url(/assets/KaTeX_Main-Regular-Dr94JaBh.woff) format("woff"),url(/assets/KaTeX_Main-Regular-ypZvNtVU.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2) format("woff2"),url(/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff) format("woff"),url(/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Math-Italic-t53AETM-.woff2) format("woff2"),url(/assets/KaTeX_Math-Italic-DA0__PXp.woff) format("woff"),url(/assets/KaTeX_Math-Italic-flOr_0UB.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff) format("woff"),url(/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff) format("woff"),url(/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff) format("woff"),url(/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Script-Regular-D3wIWfF6.woff2) format("woff2"),url(/assets/KaTeX_Script-Regular-D5yQViql.woff) format("woff"),url(/assets/KaTeX_Script-Regular-C5JkGWo-.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2) format("woff2"),url(/assets/KaTeX_Size1-Regular-C195tn64.woff) format("woff"),url(/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2) format("woff2"),url(/assets/KaTeX_Size2-Regular-oD1tc_U0.woff) format("woff"),url(/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(data:font/woff2;base64,d09GMgABAAAAAA4oAA4AAAAAHbQAAA3TAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgRQIDgmcDBEICo1oijYBNgIkA14LMgAEIAWJAAeBHAyBHBvbGiMRdnO0IkRRkiYDgr9KsJ1NUAf2kILNxgUmgqIgq1P89vcbIcmsQbRps3vCcXdYOKSWEPEKgZgQkprQQsxIXUgq0DqpGKmIvrgkeVGtEQD9DzAO29fM9jYhxZEsL2FeURH2JN4MIcTdO049NCVdxQ/w9NrSYFEBKTDKpLKfNkCGDc1RwjZLQcm3vqJ2UW9Xfa3tgAHz6ivp6vgC2yD4/6352ndnN0X0TL7seypkjZlMsjmZnf0Mm5Q+JykRWQBKCVCVPbARPXWyQtb5VgLB6Biq7/Uixcj2WGqdI8tGSgkuRG+t910GKP2D7AQH0DB9FMDW/obJZ8giFI3Wg8Cvevz0M+5m0rTh7XDBlvo9Y4vm13EXmfttwI4mBo1EG15fxJhUiCLbiiyCf/ZA6MFAhg3pGIZGdGIVjtPn6UcMk9A/UUr9PhoNsCENw1APAq0gpH73e+M+0ueyHbabc3vkbcdtzcf/fiy+NxQEjf9ud/ELBHAXJ0nk4z+MXH2Ev/kWyV4k7SkvpPc9Qr38F6RPWnM9cN6DJ0AdD1BhtgABtmoRoFCvPsBAumNm6soZG2Gk5GyVTo2sJncSyp0jQTYoR6WDvTwaaEcHsxHfvuWhHA3a6bN7twRKtcGok6NsCi7jYRrM2jExsUFMxMQYuJbMhuWNOumEJy9hi29Dmg5zMp/A5+hhPG19j1vBrq8JTLr8ki5VLPmG/PynJHVul440bxg5xuymHUFPBshC+nA9I1FmwbRBTNHAcik3Oae0cxKoI3MOriM42UrPe51nsaGxJ+WfXubAsP84aabUlQSJ1IiE0iPETLUU4CATgfXSCSpuRFRmCGbO+wSpAnzaeaCYW1VNEysRtuXCEL1kUFUbbtMv3Tilt/1c11jt3Q5bbMa84cpWipp8Elw3MZhOHsOlwwVUQM3lAR35JiFQbaYCRnMF2lxAWoOg2gyoIV4PouX8HytNIfLhqpJtXB4vjiViUI8IJ7bkC4ikkQvKksnOTKICwnqWSZ9YS5f0WCxmpgjbIq7EJcM4aI2nmhLNY2JIUgOjXZFWBHb+x5oh6cwb0Tv1ackHdKi0I9OO2wE9aogIOn540CCCziyhN+IaejtgAONKznHlHyutPrHGwCx9S6B8kfS4Mfi4Eyv7OU730bT1SCBjt834cXsf43zVjPUqqJjgrjeGnBxSG4aYAKFuVbeCfkDIjAqMb6yLNIbCuvXhMH2/+k2vkNpkORhR59N1CkzoOENvneIosjYmuTxlhUzaGEJQ/iWqx4dmwpmKjrwTiTGTCVozNAYqk/zXOndWxuWSmJkQpJw3pK5KX6QrLt5LATMqpmPAQhkhK6PUjzHUn7E0gHE0kPE0iKkolgkUx9SZmVAdDgpffdyJKg3k7VmzYGCwVXGz/tXmkOIp+vcWs+EMuhhvN0h9uhfzWJziBQmCREGSIFmQIkgVpAnSBRmC//6hkLZwaVhwxlrJSOdqlFtOYxlau9F2QN5Y98xmIAsiM1HVp2VFX+DHHGg6Ecjh3vmqtidX3qHI2qycTk/iwxSt5UzTmEP92ZBnEWTk4Mx8Mpl78ZDokxg/KWb+Q0QkvdKVmq3TMW+RXEgrsziSAfNXFMhDc60N5N9jQzjfO0kBKpUZl0ZmwJ41j/B9Hz6wmRaJB84niNmQrzp9eSlQCDDzazGDdVi3P36VZQ+Jy4f9UBNp+3zTjqI4abaFAm+GShVaXlsGdF3FYzZcDI6cori4kMxUECl9IjJZpzkvitAoxKue+90pDMvcKRxLl53TmOKCmV/xRolNKSqqUxc6LStOETmFOiLZZptlZepcKiAzteG8PEdpnQpbOMNcMsR4RR2Bs0cKFEvSmIjAFcnarqwUL4lDhHmnVkwu1IwshbiCcgvOheZuYyOteufZZwlcTlLgnZ3o/WcYdzZHW/WGaqaVfmTZ1aWCceJjkbZqsfbkOtcFlUZM/jy+hXHDbaUobWqqXaeWobbLO99yG5N3U4wxco0rQGGcOLASFMXeJoham8M+/x6O2WywK2l4HGbq1CoUyC/IZikQhdq3SiuNrvAEj0AVu9x2x3lp/xWzahaxidezFVtdcb5uEnzyl0ZmYiuKI0exvCd4Xc9CV1KB0db00z92wDPde0kukbvZIWN6jUWFTmPIC/Y4UPCm8UfDTFZpZNon1qLFTkBhxzB+FjQRA2Q/YRJT8pQigslMaUpFyAG8TMlXigiqmAZX4xgijKjRlGpLE0GdplRfCaJo0JQaSxNBk6ZmMzcya0FmrcisDdn0Q3HI2sWSppYigmlM1XT/kLQZSNpMJG0WkjYbSZuDpM1F0uYhFc1HxU4m1QJjDK6iL0S5uSj5rgXc3RejEigtcRBtqYPQsiTskmO5vosV+q4VGIKbOkDg0jtRrq+Em1YloaTFar3EGr1EUC8R0kus1Uus00usL97ABr2BjXoDm/QGNhuWtMVBKOwg/i78lT7hBsAvDmwHc/ao3vmUbBmhjeYySZNWvGkfZAgISDSaDo1SVpzGDsAEkF8B+gEapViUoZgUWXcRIGFZNm6gWbAKk0bp0k1MHG9fLYtV4iS2SmLEQFARzRcnf9PUS0LVn05/J9MiRRBU3v2IrvW974v4N00L7ZMk0wXP1409CHo/an8zTRHD3eSJ6m8D4YMkZNl3M79sqeuAsr/m3f+8/yl7A50aiAEJgeBeMWzu7ui9UfUBCe2TIqZIoOd/3/udRBOQidQZUERzb2/VwZN1H/Sju82ew2H2Wfr6qvfVf3hqwDvAIpkQVFy4B9Pe9e4/XvPeceu7h3dvO56iJPf0+A6cqA2ip18ER+iFgggiuOkvj24bby0N9j2UHIkgqIt+sVgfodC4YghLSMjSZbH0VR/6dMDrYJeKHilKTemt6v6kvzvn3/RrdWtr0GoN/xL+Sex/cPYLUpepx9cz/D46UPU5KXgAQa+NDps1v6J3xP1i2HtaDB0M9aX2deA7SYff//+gUCovMmIK/qfsFcOk+4Y5ZN97XlG6zebqtMbKgeRFi51vnxTQYBUik2rS/Cn6PC8ADR8FGxsRPB82dzfND90gIcshOcYUkfjherBz53odpm6TP8txlwOZ71xmfHHOvq053qFF/MRlS3jP0ELudrf2OeN8DHvp6ZceLe8qKYvWz/7yp0u4dKPfli3CYq0O13Ih71mylJ80tOi10On8wi+F4+LWgDPeJ30msSQt9/vkmHq9/Lvo2b461mP801v3W4xTcs6CbvF9UDdrSt+A8OUbpSh55qAUFXWznBBfdeJ8a4d7ugT5tvxUza3h9m4H7ptTqiG4z0g5dc0X29OcGlhpGFMpQo9ytTS+NViZpNdvU4kWx+LKxNY10kQ1yqGXrhe4/1nvP7E+nd5A92TtaRplbHSqoIdOqtRWti+fkB5/n1+/VvCmz12pG1kpQWsfi1ftlBobm0bpngs16CHkbIwdLnParxtTV3QYRlfJ0KFskH7pdN/YDn+yRuSd7sNH3aO0DYPggk6uWuXrfOc+fa3VTxFVvKaNxHsiHmsXyCLIE5yuOeN3/Jdf8HBL/5M6shjyhxHx9BjB1O0+4NLOnjLLSxwO7ukN4jMbOIcD879KLSi6Pk61Oqm2377n8079PXEEQ7cy7OKEC9nbpet118fxweTafpt69x/Bt8UqGzNQt7aelpc44dn5cqhwf71+qKp/Zf/+a0zcizOUWpl/iBcSXip0pplkatCchoH5c5aUM8I7/dWxAej8WicPL1URFZ9BDJelUwEwTkGqUhgSlydVes95YdXvhh9Gfz/aeFWvgVb4tuLbcv4+wLdutVZv/cUonwBD/6eDlE0aSiKK/uoH3+J1wDE/jMVqY2ysGufN84oIXB0sPzy8ollX/LegY74DgJXJR57sn+VGza0x3DnuIgABFM15LmajjjsNlYj+JEZGbuRYcAMOWxFkPN2w6Wd46xo4gVWQR/X4lyI/R6K/YK0110GzudPRW7Y+UOBGTfNNzHeYT0fiH0taunBpq9HEW8OKSaBGj21L0MqenEmNRWBAWDWAk4CpNoEZJ2tTaPFgbQYj8HxtFilErs3BTRwT8uO1NXQaWfIotchmPkAF5mMBAliEmZiOGVgCG9LgRzpscMAOOwowlT3JhusdazXGSC/hxR3UlmWVwWHpOIKheqONvjyhSiTHIkVUco5bnji8m//zL7PKaT1Vl5I6UE609f+gkr6MZKVyKc7zJRmCahLsdlyA5fdQkRSan9LgnnLEyGSkaKJCJog0wAgvepWBt80+1yKln1bMVtCljfNWDueKLsWwaEbBSfSPTEmVRsUcYYMnEjcjeyCZzBXK9E9BYBXLKjOSpUDR+nEV3TFSUdQaz+ot98QxgXwx0GQ+EEUAKB2qZPkQQ0GqFD8UPFMqyaCHM24BZmSGic9EYMagKizOw9Hz50DMrDLrqqLkTAhplMictiCAx5S3BIUQdeJeLnBy2CNtMfz6cV4u8XKoFZQesbf9YZiIERiHjaNodDW6LgcirX/mPnJIkBGDUpTBhSa0EIr38D5hCIszhCM8URGBqImoWjpvpt1ebu/v3Gl3qJfMnNM+9V+kiRFyROTPHQWOcs1dNW94/ukKMPZBvDi55i5CttdeJz84DLngLqjcdwEZ87bFFR8CIG35OAkDVN6VRDZ7aq67NteYqZ2lpT8oYB2CytoBd6VuAx4WgiAsnuj3WohG+LugzXiQRDeM3XYXlULv4dp5VFYC) format("woff2"),url(/assets/KaTeX_Size3-Regular-CTq5MqoE.woff) format("woff"),url(/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2) format("woff2"),url(/assets/KaTeX_Size4-Regular-BF-4gkZK.woff) format("woff"),url(/assets/KaTeX_Size4-Regular-DWFBv043.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2) format("woff2"),url(/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff) format("woff"),url(/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf) format("truetype")}.katex{font: 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0;text-rendering:auto}.katex *{-ms-high-contrast-adjust:none!important;border-color:currentColor}.katex .katex-version:after{content:"0.16.27"}.katex .katex-mathml{clip:rect(1px,1px,1px,1px);border:0;height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:-moz-min-content;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .mathsfit,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;display:inline-table;table-layout:fixed}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;position:relative;vertical-align:bottom}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;font-size:1px;min-width:2px;vertical-align:bottom;width:2px}.katex .vbox{align-items:baseline;display:inline-flex;flex-direction:column}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{display:inline-flex;flex-direction:row}.katex .thinbox{max-width:0;width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{position:relative;width:0}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline{border-bottom-style:dashed;display:inline-block;width:100%}.katex .sqrt>.root{margin-left:.2777777778em;margin-right:-.5555555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.1666666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.6666666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.4566666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.1466666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.7142857143em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.8571428571em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.1428571429em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.2857142857em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.4285714286em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.7142857143em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.0571428571em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.4685714286em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.9628571429em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.5542857143em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.7777777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.8888888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.1111111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.3044444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.7644444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.5833333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.7283333333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.0733333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.4861111111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.4402777778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.7277777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.2893518519em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.4050925926em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.462962963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.5208333333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.2002314815em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.4398148148em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.2410800386em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2892960463em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.337512054em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.3857280617em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.4339440694em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.4821600771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.5785920926em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.6943105111em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8331726133em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.1996142719em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.2009646302em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.2411575563em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.2813504823em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.3215434084em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.3617363344em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.4019292605em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.4823151125em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.578778135em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.6945337621em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.8336012862em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:block;height:inherit;position:absolute;width:100%}.katex svg path{stroke:none}.katex img{border-style:none;max-height:none;max-width:none;min-height:0;min-width:0}.katex .stretchy{display:block;overflow:hidden;position:relative;width:100%}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{overflow:hidden;position:relative;width:100%}.katex .halfarrow-left{left:0;overflow:hidden;position:absolute;width:50.2%}.katex .halfarrow-right{overflow:hidden;position:absolute;right:0;width:50.2%}.katex .brace-left{left:0;overflow:hidden;position:absolute;width:25.1%}.katex .brace-center{left:25%;overflow:hidden;position:absolute;width:50%}.katex .brace-right{overflow:hidden;position:absolute;right:0;width:25.1%}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{border:.04em solid;box-sizing:border-box}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{border-right:.049em solid;border-top:.049em solid;box-sizing:border-box;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;left:calc(50% + .3em);position:absolute;text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{padding-left:2em;text-align:left}body{counter-reset:katexEqnNo mmlEqnNo}.uppy-Root{box-sizing:border-box;color:#333;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;line-height:1;position:relative;text-align:left;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.uppy-Root[dir=rtl],[dir=rtl] .uppy-Root{text-align:right}.uppy-Root *,.uppy-Root :after,.uppy-Root :before{box-sizing:inherit}.uppy-Root [hidden]{display:none}.uppy-u-reset{all:initial;-webkit-appearance:none;-moz-appearance:none;appearance:none;box-sizing:border-box;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;line-height:1}[dir=rtl] .uppy-u-reset{text-align:right}.uppy-truncate-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.uppy-c-textInput{background-color:#fff;border:1px solid #ddd;border-radius:4px;font-family:inherit;font-size:14px;line-height:1.5;padding:6px 8px}.uppy-size--md .uppy-c-textInput{padding:8px 10px}.uppy-c-textInput:focus{border-color:#1269cf99;box-shadow:0 0 0 3px #1269cf26;outline:none}[data-uppy-theme=dark] .uppy-c-textInput{background-color:#333;border-color:#333;color:#eaeaea}[data-uppy-theme=dark] .uppy-c-textInput:focus{border-color:#525252;box-shadow:none}.uppy-c-icon{display:inline-block;max-height:100%;max-width:100%;overflow:hidden;fill:currentColor}.uppy-c-btn{align-items:center;color:inherit;display:inline-flex;font-family:inherit;font-size:inherit;font-weight:500;justify-content:center;line-height:1;transition-duration:.3s;transition-property:background-color,color;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.uppy-c-btn,[dir=rtl] .uppy-c-btn{text-align:center}.uppy-c-btn:not(:disabled):not(.disabled){cursor:pointer}.uppy-c-btn::-moz-focus-inner{border:0}.uppy-c-btn-primary{background-color:#1269cf;border-radius:4px;color:#fff;font-size:14px;padding:10px 18px}.uppy-c-btn-primary:not(:disabled):hover{background-color:#0e51a0}.uppy-c-btn-primary:focus{box-shadow:0 0 0 3px #1269cf66;outline:none}.uppy-size--md .uppy-c-btn-primary{padding:13px 22px}[data-uppy-theme=dark] .uppy-c-btn-primary{color:#eaeaea}[data-uppy-theme=dark] .uppy-c-btn-primary:focus{outline:none}[data-uppy-theme=dark] .uppy-c-btn-primary::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-c-btn-primary:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-c-btn-primary.uppy-c-btn--disabled{background-color:#8eb2db}.uppy-c-btn-link{background-color:initial;border-radius:4px;color:#525252;font-size:14px;line-height:1;padding:10px 15px}.uppy-c-btn-link:hover{color:#333}.uppy-c-btn-link:focus{box-shadow:0 0 0 3px #1269cf40;outline:none}.uppy-size--md .uppy-c-btn-link{padding:13px 18px}[data-uppy-theme=dark] .uppy-c-btn-link{color:#eaeaea}[data-uppy-theme=dark] .uppy-c-btn-link:focus{outline:none}[data-uppy-theme=dark] .uppy-c-btn-link::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-c-btn-link:focus{box-shadow:0 0 0 2px #aae1ffd9}[data-uppy-theme=dark] .uppy-c-btn-link:hover{color:#939393}.uppy-ProviderBrowser-viewType--grid ul.uppy-ProviderBrowser-list,.uppy-ProviderBrowser-viewType--unsplash ul.uppy-ProviderBrowser-list{align-items:flex-start;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between;padding:6px}.uppy-ProviderBrowser-viewType--grid ul.uppy-ProviderBrowser-list:after,.uppy-ProviderBrowser-viewType--unsplash ul.uppy-ProviderBrowser-list:after{content:"";flex:auto}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem{margin:0;position:relative;width:50%}.uppy-size--md .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem,.uppy-size--md .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem{width:33.3333%}.uppy-size--lg .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem,.uppy-size--lg .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem{width:25%}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem:before,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem:before{content:"";display:block;padding-top:100%}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--selected img,.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--selected svg,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--selected img,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--selected svg{opacity:.85}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--disabled,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--disabled{opacity:.5}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner{background-color:#93939333}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner,[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner{background-color:#eaeaea33}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview svg,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview svg{height:30%;width:30%;fill:#000000b3}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview svg,[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview svg{fill:#fffc}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner{border-radius:4px;height:calc(100% - 14px);inset:7px;overflow:hidden;position:absolute;text-align:center;width:calc(100% - 14px)}@media(hover:none){.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner .uppy-ProviderBrowserItem-author{display:block}}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner,[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner{box-shadow:0 0 0 3px #aae1ffb3}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner img,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner img{border-radius:4px;height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-author{background:#0000004d;bottom:0;color:#fff;display:none;font-size:12px;font-weight:500;left:0;margin:0;padding:5px;position:absolute;text-decoration:none;width:100%}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-author:hover,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-author:hover{background:#0006;text-decoration:underline}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox{background-color:#1269cf;border-radius:50%;height:26px;opacity:0;position:absolute;right:16px;top:16px;width:26px;z-index:1002}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox:after,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox:after{height:7px;inset-inline-start:7px;top:8px;width:12px}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox{opacity:1}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:hover+label .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:hover+label .uppy-ProviderBrowserItem-author{display:block}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label{box-shadow:0 0 0 3px #1269cf80}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label:focus,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label:focus{outline:none}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label::-moz-focus-inner,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label::-moz-focus-inner{border:0}.uppy-ProviderBrowser-viewType--list{background-color:#fff}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--list{background-color:#1f1f1f}.uppy-ProviderBrowser-viewType--list li.uppy-ProviderBrowserItem{align-items:center;display:flex;margin:0;padding:7px 15px}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--list li.uppy-ProviderBrowserItem{color:#eaeaea}.uppy-ProviderBrowser-viewType--list li.uppy-ProviderBrowserItem--disabled{opacity:.6}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox{background-color:#fff;border:1px solid #cfcfcf;border-radius:3px;height:17px;margin-inline-end:15px;width:17px}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox:focus{border:1px solid #1269cf;box-shadow:0 0 0 3px #1269cf40;outline:none}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox:after{height:5px;inset-inline-start:3px;opacity:0;top:4px;width:9px}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox:focus{border-color:#02baf2b3;box-shadow:0 0 0 3px #02baf233}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox,.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-partial .uppy-ProviderBrowserItem-checkbox{background-color:#1269cf;border-color:#1269cf}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox:after,.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-partial .uppy-ProviderBrowserItem-checkbox:after{opacity:1}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner{align-items:center;color:inherit;display:flex;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;overflow:hidden;padding:2px;text-overflow:ellipsis;white-space:nowrap}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner:focus{outline:none;text-decoration:underline}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner img,.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner svg{margin-inline-end:8px}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner span{line-height:1.2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--disabled .uppy-ProviderBrowserItem-inner{cursor:default}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-iconWrap{margin-inline-end:7px;width:20px}.uppy-ProviderBrowserItem-checkbox{cursor:pointer;flex-shrink:0;position:relative}.uppy-ProviderBrowserItem-checkbox:disabled,.uppy-ProviderBrowserItem-checkbox:disabled:after{cursor:default}[data-uppy-theme=dark] .uppy-ProviderBrowserItem-checkbox{background-color:#1f1f1f;border-color:#939393}[data-uppy-theme=dark] .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox{background-color:#333}.uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox:after{border-bottom:2px solid #eaeaea;border-left:2px solid #eaeaea;content:"";cursor:pointer;position:absolute;transform:rotate(-45deg)}.uppy-ProviderBrowserItem--is-partial .uppy-ProviderBrowserItem-checkbox:after{background-color:#eaeaea!important;content:""!important;height:2px!important;left:20%!important;position:absolute!important;right:20%!important;top:50%!important;transform:translateY(-50%)!important}.uppy-SearchProvider{align-items:center;display:flex;flex:1;flex-direction:column;height:100%;justify-content:center;width:100%}[data-uppy-theme=dark] .uppy-SearchProvider{background-color:#1f1f1f}.uppy-SearchProvider-input{margin-bottom:15px;max-width:650px;width:90%}.uppy-size--md .uppy-SearchProvider-input{margin-bottom:20px}.uppy-SearchProvider-input::-webkit-search-cancel-button{display:none}.uppy-SearchProvider-searchButton{padding:13px 25px}.uppy-size--md .uppy-SearchProvider-searchButton{padding:13px 30px}.uppy-DashboardContent-panelBody{align-items:center;display:flex;flex:1;justify-content:center}[data-uppy-theme=dark] .uppy-DashboardContent-panelBody{background-color:#1f1f1f}.uppy-Provider-auth,.uppy-Provider-empty,.uppy-Provider-error,.uppy-Provider-loading{align-items:center;color:#939393;display:flex;flex:1;flex-flow:column wrap;justify-content:center}.uppy-Provider-empty{color:#939393}.uppy-Provider-authIcon svg{height:75px;width:100px}.uppy-Provider-authTitle{color:#757575;font-size:17px;font-weight:400;line-height:1.4;margin-bottom:30px;max-width:500px;padding:0 15px;text-align:center}.uppy-size--md .uppy-Provider-authTitle{font-size:20px}[data-uppy-theme=dark] .uppy-Provider-authTitle{color:#cfcfcf}.uppy-Provider-btn-google{align-items:center;background:#4285f4;display:flex;padding:8px 12px!important}.uppy-Provider-btn-google:hover{background-color:#1266f1}.uppy-Provider-btn-google:focus{box-shadow:0 0 0 3px #4285f466;outline:none}.uppy-Provider-btn-google svg{margin-right:8px}.uppy-Provider-breadcrumbs{color:#525252;flex:1;font-size:12px;margin-bottom:10px;text-align:start}.uppy-size--md .uppy-Provider-breadcrumbs{margin-bottom:0}[data-uppy-theme=dark] .uppy-Provider-breadcrumbs{color:#eaeaea}.uppy-Provider-breadcrumbsIcon{color:#525252;display:inline-block;line-height:1;margin-inline-end:4px;vertical-align:middle}.uppy-Provider-breadcrumbsIcon svg{height:13px;width:13px;fill:#525252}.uppy-Provider-breadcrumbs button{border-radius:3px;display:inline-block;line-height:inherit;padding:4px}.uppy-Provider-breadcrumbs button:focus{outline:none}.uppy-Provider-breadcrumbs button::-moz-focus-inner{border:0}.uppy-Provider-breadcrumbs button:hover{color:#0e51a0}.uppy-Provider-breadcrumbs button:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-Provider-breadcrumbs button:focus{background-color:#333}.uppy-Provider-breadcrumbs button:not(:last-of-type){text-decoration:underline}.uppy-Provider-breadcrumbs button:last-of-type{color:#333;cursor:normal;font-weight:500;pointer-events:none}.uppy-Provider-breadcrumbs button:hover{cursor:pointer}[data-uppy-theme=dark] .uppy-Provider-breadcrumbs button{color:#eaeaea}.uppy-ProviderBrowser{display:flex;flex:1;flex-direction:column;font-size:14px;font-weight:400;height:100%}.uppy-ProviderBrowser-user{color:#333;font-weight:500;margin:0 8px 0 0}[data-uppy-theme=dark] .uppy-ProviderBrowser-user{color:#eaeaea}.uppy-ProviderBrowser-user:after{color:#939393;content:"·";font-weight:400;inset-inline-start:4px;position:relative}.uppy-ProviderBrowser-header{border-bottom:1px solid #eaeaea;position:relative;z-index:1001}[data-uppy-theme=dark] .uppy-ProviderBrowser-header{border-bottom:1px solid #333}.uppy-ProviderBrowser-headerBar{background-color:#fafafa;color:#757575;font-size:12px;line-height:1.4;padding:7px 15px;z-index:1001}.uppy-size--md .uppy-ProviderBrowser-headerBar{align-items:center;display:flex}[data-uppy-theme=dark] .uppy-ProviderBrowser-headerBar{background-color:#1f1f1f}.uppy-ProviderBrowser-headerBar--simple{display:block;justify-content:center;text-align:center}.uppy-ProviderBrowser-headerBar--simple .uppy-Provider-breadcrumbsWrap{display:inline-block;flex:none;vertical-align:middle}.uppy-ProviderBrowser-searchFilter{align-items:center;display:flex;height:30px;margin-bottom:15px;margin-top:15px;padding-left:8px;padding-right:8px;position:relative;width:100%}.uppy-ProviderBrowser-searchFilterInput{background-color:#eaeaea;border:0;border-radius:4px;color:#333;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;font-size:13px;height:30px;line-height:1.4;outline:0;padding-inline-end:30px;padding-inline-start:30px;width:100%;z-index:1001}.uppy-ProviderBrowser-searchFilterInput::-webkit-search-cancel-button{display:none}[data-uppy-theme=dark] .uppy-ProviderBrowser-searchFilterInput{background-color:#1f1f1f;color:#eaeaea}.uppy-ProviderBrowser-searchFilterInput:focus{background-color:#cfcfcf;border:0}[data-uppy-theme=dark] .uppy-ProviderBrowser-searchFilterInput:focus{background-color:#333}.uppy-ProviderBrowser-searchFilterIcon{color:#757575;height:12px;inset-inline-start:16px;position:absolute;width:12px;z-index:1002}.uppy-ProviderBrowser-searchFilterInput::-moz-placeholder{color:#939393;opacity:1}.uppy-ProviderBrowser-searchFilterInput::placeholder{color:#939393;opacity:1}.uppy-ProviderBrowser-searchFilterReset{border-radius:3px;color:#939393;cursor:pointer;height:22px;inset-inline-end:16px;padding:6px;position:absolute;width:22px;z-index:1002}.uppy-ProviderBrowser-searchFilterReset:focus{outline:none}.uppy-ProviderBrowser-searchFilterReset::-moz-focus-inner{border:0}.uppy-ProviderBrowser-searchFilterReset:focus{box-shadow:0 0 0 3px #1269cf80}.uppy-ProviderBrowser-searchFilterReset:hover{color:#757575}.uppy-ProviderBrowser-searchFilterReset svg{vertical-align:text-top}.uppy-ProviderBrowser-userLogout{border-radius:3px;color:#1269cf;cursor:pointer;line-height:inherit;padding:4px}.uppy-ProviderBrowser-userLogout:focus{outline:none}.uppy-ProviderBrowser-userLogout::-moz-focus-inner{border:0}.uppy-ProviderBrowser-userLogout:hover{color:#0e51a0}.uppy-ProviderBrowser-userLogout:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-ProviderBrowser-userLogout:focus{background-color:#333}.uppy-ProviderBrowser-userLogout:hover{text-decoration:underline}[data-uppy-theme=dark] .uppy-ProviderBrowser-userLogout{color:#eaeaea}.uppy-ProviderBrowser-body{flex:1;position:relative}.uppy-ProviderBrowser-list{background-color:#fff;border-spacing:0;display:block;flex:1;height:100%;inset:0;list-style:none;margin:0;overflow-x:hidden;overflow-y:auto;padding:0;position:absolute;width:100%;-webkit-overflow-scrolling:touch}[data-uppy-theme=dark] .uppy-ProviderBrowser-list{background-color:#1f1f1f}.uppy-ProviderBrowser-list:focus{outline:none}.uppy-ProviderBrowserItem-inner{cursor:pointer;font-size:13px;font-weight:500}.uppy-ProviderBrowser-footer{align-items:center;background-color:#fff;border-top:1px solid #eaeaea;display:flex;justify-content:space-between;padding:15px}.uppy-ProviderBrowser-footer button{margin-inline-end:8px}[data-uppy-theme=dark] .uppy-ProviderBrowser-footer{background-color:#1f1f1f;border-top:1px solid #333}.uppy-ProviderBrowser-footer-buttons{flex-shrink:0}.uppy-ProviderBrowser-footer-error{color:#e32437;line-height:18px}@media(max-width:426px){.uppy-ProviderBrowser-footer{align-items:stretch;flex-direction:column-reverse}.uppy-ProviderBrowser-footer-error{padding-bottom:10px}}.picker-dialog-bg{z-index:20000!important}.picker-dialog{z-index:20001!important}.uppy-Dashboard-Item-previewInnerWrap{align-items:center;border-radius:3px;box-shadow:0 0 2px #0006;display:flex;flex-direction:column;height:100%;justify-content:center;overflow:hidden;position:relative;width:100%}.uppy-size--md .uppy-Dashboard-Item-previewInnerWrap{box-shadow:0 1px 2px #00000026}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-previewInnerWrap{box-shadow:none}.uppy-Dashboard-Item-previewInnerWrap:after{background-color:#000000a6;content:"";display:none;inset:0;position:absolute;z-index:1001}.uppy-Dashboard-Item-previewLink{inset:0;position:absolute;z-index:1002}.uppy-Dashboard-Item-previewLink:focus{box-shadow:inset 0 0 0 3px #579df0}[data-uppy-theme=dark] .uppy-Dashboard-Item-previewLink:focus{box-shadow:inset 0 0 0 3px #016c8d}.uppy-Dashboard-Item-preview img.uppy-Dashboard-Item-previewImg{border-radius:3px;height:100%;-o-object-fit:cover;object-fit:cover;transform:translateZ(0);width:100%}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-preview img.uppy-Dashboard-Item-previewImg{height:auto;max-height:100%;max-width:100%;-o-object-fit:contain;object-fit:contain;padding:10px;width:auto}.uppy-Dashboard-Item-progress{color:#fff;left:50%;position:absolute;text-align:center;top:50%;transform:translate(-50%,-50%);transition:all .35 ease;width:120px;z-index:1002}.uppy-Dashboard-Item-progressIndicator{color:#fff;display:inline-block;height:38px;opacity:.9;width:38px}.uppy-size--md .uppy-Dashboard-Item-progressIndicator{height:55px;width:55px}button.uppy-Dashboard-Item-progressIndicator{cursor:pointer}button.uppy-Dashboard-Item-progressIndicator:focus{outline:none}button.uppy-Dashboard-Item-progressIndicator::-moz-focus-inner{border:0}button.uppy-Dashboard-Item-progressIndicator:focus .uppy-Dashboard-Item-progressIcon--bg,button.uppy-Dashboard-Item-progressIndicator:focus .uppy-Dashboard-Item-progressIcon--retry{fill:#579df0}.uppy-Dashboard-Item-progressIcon--circle{height:100%;width:100%}.uppy-Dashboard-Item-progressIcon--bg{stroke:#fff6}.uppy-Dashboard-Item-progressIcon--progress{transition:stroke-dashoffset .5s ease-out;stroke:#fff}.uppy-Dashboard-Item-progressIcon--play{transition:all .2s;fill:#fff;stroke:#fff}.uppy-Dashboard-Item-progressIcon--cancel{transition:all .2s;fill:#fff}.uppy-Dashboard-Item-progressIcon--pause{transition:all .2s;fill:#fff;stroke:#fff}.uppy-Dashboard-Item-progressIcon--check{transition:all .2s;fill:#fff}.uppy-Dashboard-Item-progressIcon--retry{fill:#fff}.uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progress{inset-inline-end:-8px;inset-inline-start:auto;top:-9px;transform:none;width:auto}.uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-progressIndicator{height:18px;width:18px}.uppy-size--md .uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-progressIndicator{height:28px;width:28px}.uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progressIndicator{height:18px;opacity:1;width:18px}.uppy-size--md .uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progressIndicator{height:22px;width:22px}.uppy-Dashboard-Item.is-processing .uppy-Dashboard-Item-progress{opacity:0}.uppy-Dashboard-Item-fileInfo{padding-inline-end:5px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfo{padding-inline-end:10px}.uppy-size--md.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfo{padding-inline-end:15px}.uppy-Dashboard-Item-name{font-size:12px;font-weight:500;line-height:1.3;margin-bottom:5px;word-wrap:anywhere;word-break:break-all}[data-uppy-theme=dark] .uppy-Dashboard-Item-name{color:#eaeaea}.uppy-size--md.uppy-Dashboard--singleFile .uppy-Dashboard-Item-name{font-size:14px;line-height:1.4}.uppy-Dashboard-Item-fileName{align-items:baseline;display:flex}.uppy-Dashboard-Item-fileName button{margin-left:5px}.uppy-Dashboard-Item-author{color:#757575;display:inline-block;font-size:11px;font-weight:400;line-height:1;margin-bottom:5px;vertical-align:bottom}.uppy-Dashboard-Item-author a{color:#757575}.uppy-Dashboard-Item-status{color:#757575;font-size:11px;font-weight:400;line-height:1}[data-uppy-theme=dark] .uppy-Dashboard-Item-status{color:#bbb}.uppy-Dashboard-Item-statusSize{display:inline-block;margin-bottom:5px;text-transform:uppercase;vertical-align:bottom}.uppy-Dashboard-Item-reSelect{color:#1269cf;font-family:inherit;font-size:inherit;font-weight:600}.uppy-Dashboard-Item-errorMessage{background-color:#fdeff1;color:#a51523;font-size:11px;font-weight:500;line-height:1.3;padding:5px 6px}.uppy-Dashboard-Item-errorMessageBtn{color:#a51523;cursor:pointer;font-size:11px;font-weight:500;text-decoration:underline}.uppy-Dashboard-Item-preview .uppy-Dashboard-Item-errorMessage{display:none}.uppy-size--md .uppy-Dashboard-Item-preview .uppy-Dashboard-Item-errorMessage{border-bottom-left-radius:3px;border-bottom-right-radius:3px;border-top:1px solid #f7c2c8;bottom:0;display:block;left:0;line-height:1.4;padding:6px 8px;position:absolute;right:0}.uppy-Dashboard-Item-fileInfo .uppy-Dashboard-Item-errorMessage{border:1px solid #f7c2c8;border-radius:3px;display:inline-block;position:static}.uppy-size--md .uppy-Dashboard-Item-fileInfo .uppy-Dashboard-Item-errorMessage{display:none}.uppy-Dashboard-Item-action{color:#939393;cursor:pointer}.uppy-Dashboard-Item-action:focus{outline:none}.uppy-Dashboard-Item-action::-moz-focus-inner{border:0}.uppy-Dashboard-Item-action:focus{box-shadow:0 0 0 3px #1269cf80}.uppy-Dashboard-Item-action:hover{color:#1f1f1f;opacity:1}[data-uppy-theme=dark] .uppy-Dashboard-Item-action{color:#cfcfcf}[data-uppy-theme=dark] .uppy-Dashboard-Item-action:focus{outline:none}[data-uppy-theme=dark] .uppy-Dashboard-Item-action::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-Dashboard-Item-action:focus{box-shadow:0 0 0 2px #aae1ffd9}[data-uppy-theme=dark] .uppy-Dashboard-Item-action:hover{color:#eaeaea}.uppy-Dashboard-Item-action--remove{color:#1f1f1f;opacity:.95}.uppy-Dashboard-Item-action--remove:hover{color:#000;opacity:1}.uppy-size--md .uppy-Dashboard-Item-action--remove{height:18px;inset-inline-end:-8px;padding:0;position:absolute;top:-8px;width:18px;z-index:1002}.uppy-size--md .uppy-Dashboard-Item-action--remove:focus{border-radius:50%}.uppy-Dashboard--singleFile.uppy-size--height-md .uppy-Dashboard-Item-action--remove{inset-inline-end:8px;position:absolute;top:8px}[data-uppy-theme=dark] .uppy-Dashboard-Item-action--remove{color:#525252}[data-uppy-theme=dark] .uppy-Dashboard-Item-action--remove:hover{color:#333}.uppy-Dashboard:not(.uppy-size--md):not(.uppy-Dashboard--singleFile.uppy-size--height-md) .uppy-Dashboard-Item-actionWrapper{align-items:center;display:flex}.uppy-Dashboard:not(.uppy-size--md):not(.uppy-Dashboard--singleFile.uppy-size--height-md) .uppy-Dashboard-Item-action{height:22px;margin-left:3px;padding:3px;width:22px}.uppy-Dashboard:not(.uppy-size--md):not(.uppy-Dashboard--singleFile.uppy-size--height-md) .uppy-Dashboard-Item-action:focus{border-radius:3px}.uppy-size--md .uppy-Dashboard-Item-action--copyLink,.uppy-size--md .uppy-Dashboard-Item-action--edit{height:16px;padding:0;width:16px}.uppy-size--md .uppy-Dashboard-Item-action--copyLink:focus,.uppy-size--md .uppy-Dashboard-Item-action--edit:focus{border-radius:3px}.uppy-Dashboard-Item{align-items:center;border-bottom:1px solid #eaeaea;display:flex;padding:10px}.uppy-Dashboard:not(.uppy-Dashboard--singleFile) .uppy-Dashboard-Item{padding-inline-end:0}[data-uppy-theme=dark] .uppy-Dashboard-Item{border-bottom:1px solid #333}.uppy-size--md .uppy-Dashboard-Item{border-bottom:0;display:block;float:inline-start;height:215px;margin:5px 15px;padding:0;position:relative;width:calc(33.333% - 30px)}.uppy-size--lg .uppy-Dashboard-Item{height:190px;margin:5px 15px;padding:0;width:calc(25% - 30px)}.uppy-size--xl .uppy-Dashboard-Item{height:210px;padding:0;width:calc(20% - 30px)}.uppy-Dashboard--singleFile .uppy-Dashboard-Item{border-bottom:0;display:flex;flex-direction:column;height:100%;max-width:400px;padding:15px;position:relative;width:100%}.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-previewInnerWrap{opacity:.2}.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-name{opacity:.7}.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-preview:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='35' height='39' viewBox='0 0 35 39'%3E%3Cpath fill='%2523000' d='M1.708 38.66c1.709 0 3.417-3.417 6.834-3.417s5.125 3.417 8.61 3.417c3.348 0 5.056-3.417 8.473-3.417 4.305 0 5.125 3.417 6.833 3.417.889 0 1.709-.889 1.709-1.709v-19.68C34.167-5.757 0-5.757 0 17.271v19.68c0 .82.888 1.709 1.708 1.709m8.542-17.084a3.383 3.383 0 0 1-3.417-3.416 3.383 3.383 0 0 1 3.417-3.417 3.383 3.383 0 0 1 3.417 3.417 3.383 3.383 0 0 1-3.417 3.416m13.667 0A3.383 3.383 0 0 1 20.5 18.16a3.383 3.383 0 0 1 3.417-3.417 3.383 3.383 0 0 1 3.416 3.417 3.383 3.383 0 0 1-3.416 3.416'/%3E%3C/svg%3E");background-position:50% 10px;background-repeat:no-repeat;background-size:25px;content:"";inset:0;opacity:.5;position:absolute;z-index:1005}.uppy-size--md .uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-preview:before{background-position:50% 50%;background-size:40px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-preview:before{background-position:50% 50%;background-size:30%}.uppy-Dashboard-Item-preview{flex-grow:0;flex-shrink:0;height:50px;position:relative;width:50px}.uppy-size--md .uppy-Dashboard-Item-preview{height:140px;width:100%}.uppy-size--lg .uppy-Dashboard-Item-preview{height:120px}.uppy-size--xl .uppy-Dashboard-Item-preview{height:140px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-preview{flex-grow:1;max-height:75%;width:100%}.uppy-Dashboard--singleFile.uppy-size--md .uppy-Dashboard-Item-preview{max-height:100%}.uppy-Dashboard-Item-fileInfoAndButtons{align-items:center;display:flex;flex-grow:1;justify-content:space-between;padding-inline-end:8px;padding-inline-start:12px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfoAndButtons,.uppy-size--md .uppy-Dashboard-Item-fileInfoAndButtons{align-items:flex-start;padding:9px 0 0}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfoAndButtons{flex-grow:0;width:100%}.uppy-Dashboard-Item-fileInfo{flex-grow:1;flex-shrink:1}.uppy-Dashboard-Item-actionWrapper{flex-grow:0;flex-shrink:0}.uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-previewInnerWrap:after,.uppy-Dashboard-Item.is-inprogress .uppy-Dashboard-Item-previewInnerWrap:after{display:block}.uppy-Dashboard-Item-errorDetails{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#939393;border:none;border-radius:50%;color:#fff;cursor:help;flex-shrink:0;font-size:10px;font-weight:600;height:13px;inset-inline-start:2px;line-height:12px;position:relative;text-align:center;top:0;width:13px}.uppy-Dashboard-Item-errorDetails:after{line-height:1.3;word-wrap:break-word}.uppy-Dashboard-FileCard{background-color:#fff;border-radius:5px;box-shadow:0 0 10px 4px #0000001a;display:flex;flex-direction:column;height:100%;inset:0;position:absolute;width:100%;z-index:1005}.uppy-Dashboard-FileCard .uppy-DashboardContent-bar{border-top-left-radius:5px;border-top-right-radius:5px}.uppy-Dashboard-FileCard .uppy-Dashboard-FileCard-actions{border-bottom-left-radius:5px;border-bottom-right-radius:5px}.uppy-Dashboard-FileCard-inner{display:flex;flex-direction:column;flex-grow:1;flex-shrink:1;height:100%;min-height:0}.uppy-Dashboard-FileCard-preview{align-items:center;border-bottom:1px solid #eaeaea;display:flex;flex-grow:0;flex-shrink:1;height:60%;justify-content:center;min-height:0;position:relative}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-preview{background-color:#333;border-bottom:0}.uppy-Dashboard-FileCard-preview img.uppy-Dashboard-Item-previewImg{border-radius:3px;box-shadow:0 3px 20px #00000026;flex:0 0 auto;max-height:90%;max-width:90%;-o-object-fit:cover;object-fit:cover}.uppy-Dashboard-FileCard-edit{background-color:#00000080;border-radius:50px;color:#fff;font-size:13px;inset-inline-end:10px;padding:7px 15px;position:absolute;top:10px}.uppy-Dashboard-FileCard-edit:focus{outline:none}.uppy-Dashboard-FileCard-edit::-moz-focus-inner{border:0}.uppy-Dashboard-FileCard-edit:focus{box-shadow:0 0 0 3px #1269cf80}.uppy-Dashboard-FileCard-edit:hover{background-color:#000c}.uppy-Dashboard-FileCard-info{flex-grow:0;flex-shrink:0;height:40%;overflow-y:auto;padding:30px 20px 20px;-webkit-overflow-scrolling:touch}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-info{background-color:#1f1f1f}.uppy-Dashboard-FileCard-fieldset{border:0;font-size:0;margin:auto auto 12px;max-width:640px;padding:0}.uppy-Dashboard-FileCard-label{color:#525252;display:inline-block;font-size:12px;vertical-align:middle;width:22%}.uppy-size--md .uppy-Dashboard-FileCard-label{font-size:14px}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-label{color:#eaeaea}.uppy-Dashboard-FileCard-input{display:inline-block;vertical-align:middle;width:78%}.uppy-Dashboard-FileCard-actions{align-items:center;background-color:#fafafa;border-top:1px solid #eaeaea;display:flex;flex-grow:0;flex-shrink:0;height:55px;padding:0 15px}.uppy-size--md .uppy-Dashboard-FileCard-actions{height:65px}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-actions{background-color:#1f1f1f;border-top:1px solid #333}.uppy-Dashboard-FileCard-actionsBtn{margin-inline-end:10px}.uppy-Informer{bottom:60px;left:0;position:absolute;right:0;text-align:center;z-index:1005}.uppy-Informer span>div{margin-bottom:6px}.uppy-Informer-animated{opacity:0;transform:translateY(350%);transition:all .3s ease-in;z-index:-1000}.uppy-Informer p{background-color:#757575;border-radius:18px;color:#fff;display:inline-block;font-size:12px;font-weight:400;line-height:1.4;margin:0;max-width:90%;padding:6px 15px}.uppy-size--md .uppy-Informer p{font-size:14px;line-height:1.3;max-width:500px;padding:10px 20px}[data-uppy-theme=dark] .uppy-Informer p{background-color:#333}.uppy-Informer p span{background-color:#fff;border-radius:50%;color:#525252;display:inline-block;font-size:10px;height:13px;inset-inline-start:3px;line-height:12px;margin-inline-start:-1px;position:relative;top:-1px;vertical-align:middle;width:13px}.uppy-Informer p span:hover{cursor:help}.uppy-Informer p span:after{line-height:1.3;word-wrap:break-word}.uppy-Root [aria-label][role~=tooltip]{position:relative}.uppy-Root [aria-label][role~=tooltip]:after,.uppy-Root [aria-label][role~=tooltip]:before{backface-visibility:hidden;box-sizing:border-box;opacity:0;pointer-events:none;position:absolute;transform:translateZ(0);transform-origin:top;transition:all var(--microtip-transition-duration,.18s) var(--microtip-transition-easing,ease-in-out) var(--microtip-transition-delay,0s);will-change:transform;z-index:10}.uppy-Root [aria-label][role~=tooltip]:before{background-size:100% auto!important;content:""}.uppy-Root [aria-label][role~=tooltip]:after{background:#111111e6;border-radius:4px;box-sizing:initial;color:#fff;content:attr(aria-label);font-size:var(--microtip-font-size,13px);font-weight:var(--microtip-font-weight,normal);padding:.5em 1em;text-transform:var(--microtip-text-transform,none);white-space:nowrap}.uppy-Root [aria-label][role~=tooltip]:focus:after,.uppy-Root [aria-label][role~=tooltip]:focus:before,.uppy-Root [aria-label][role~=tooltip]:hover:after,.uppy-Root [aria-label][role~=tooltip]:hover:before{opacity:1;pointer-events:auto}.uppy-Root [role~=tooltip][data-microtip-position|=top]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='12'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M2.658 0h32.004c-6 0-11.627 12.002-16.002 12.002S8.594 0 2.658 0'/%3E%3C/svg%3E") no-repeat;bottom:100%;height:6px;left:50%;margin-bottom:5px;transform:translate3d(-50%,0,0);width:18px}.uppy-Root [role~=tooltip][data-microtip-position|=top]:after{bottom:100%;left:50%;margin-bottom:11px;transform:translate3d(-50%,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=top]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position|=top]:hover:before{transform:translate3d(-50%,-5px,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-left]:after{bottom:100%;transform:translate3d(calc(-100% + 16px),0,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-left]:hover:after{transform:translate3d(calc(-100% + 16px),-5px,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-right]:after{bottom:100%;transform:translate3d(-16px,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-right]:hover:after{transform:translate3d(-16px,-5px,0)}.uppy-Root [role~=tooltip][data-microtip-position|=bottom]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='12'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M33.342 12H1.338c6 0 11.627-12.002 16.002-12.002S27.406 12 33.342 12'/%3E%3C/svg%3E") no-repeat;bottom:auto;height:6px;left:50%;margin-bottom:0;margin-top:5px;top:100%;transform:translate3d(-50%,-10px,0);width:18px}.uppy-Root [role~=tooltip][data-microtip-position|=bottom]:after{left:50%;margin-top:11px;top:100%;transform:translate3d(-50%,-10px,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position|=bottom]:hover:before{transform:translate3d(-50%,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-left]:after{top:100%;transform:translate3d(calc(-100% + 16px),-10px,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-left]:hover:after{transform:translate3d(calc(-100% + 16px),0,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-right]:after{top:100%;transform:translate3d(-16px,-10px,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-right]:hover:after{transform:translate3d(-16px,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=left]:after,.uppy-Root [role~=tooltip][data-microtip-position=left]:before{inset:50% 100% auto auto;transform:translate3d(10px,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-position=left]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='36'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M0 33.342V1.338c0 6 12.002 11.627 12.002 16.002S0 27.406 0 33.342'/%3E%3C/svg%3E") no-repeat;height:18px;margin-bottom:0;margin-right:5px;width:6px}.uppy-Root [role~=tooltip][data-microtip-position=left]:after{margin-right:11px}.uppy-Root [role~=tooltip][data-microtip-position=left]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position=left]:hover:before{transform:translate3d(0,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-position=right]:after,.uppy-Root [role~=tooltip][data-microtip-position=right]:before{bottom:auto;left:100%;top:50%;transform:translate3d(-10px,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-position=right]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='36'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M12 2.658v32.004c0-6-12.002-11.627-12.002-16.002S12 8.594 12 2.658'/%3E%3C/svg%3E") no-repeat;height:18px;margin-bottom:0;margin-left:5px;width:6px}.uppy-Root [role~=tooltip][data-microtip-position=right]:after{margin-left:11px}.uppy-Root [role~=tooltip][data-microtip-position=right]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position=right]:hover:before{transform:translate3d(0,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-size=small]:after{white-space:normal;width:80px}.uppy-Root [role~=tooltip][data-microtip-size=medium]:after{white-space:normal;width:150px}.uppy-Root [role~=tooltip][data-microtip-size=large]:after{white-space:normal;width:260px}.uppy-StatusBar{background-color:#fff;color:#fff;display:flex;font-size:12px;font-weight:400;height:46px;line-height:40px;position:relative;transition:height .2s;z-index:1001}[data-uppy-theme=dark] .uppy-StatusBar{background-color:#1f1f1f}.uppy-StatusBar:before{background-color:#eaeaea;content:"";height:2px;inset:0;position:absolute;width:100%}[data-uppy-theme=dark] .uppy-StatusBar:before{background-color:#757575}.uppy-StatusBar[aria-hidden=true]{height:0;overflow-y:hidden}.uppy-StatusBar.is-complete .uppy-StatusBar-progress{background-color:#1bb240}.uppy-StatusBar.is-error .uppy-StatusBar-progress{background-color:#e32437}.uppy-StatusBar.is-complete .uppy-StatusBar-statusIndicator{color:#1bb240}.uppy-StatusBar.is-error .uppy-StatusBar-statusIndicator{color:#e32437}.uppy-StatusBar:not([aria-hidden=true]).is-waiting{background-color:#fff;border-top:1px solid #eaeaea;height:65px}[data-uppy-theme=dark] .uppy-StatusBar:not([aria-hidden=true]).is-waiting{background-color:#1f1f1f;border-top:1px solid #333}.uppy-StatusBar-progress{background-color:#1269cf;height:2px;position:absolute;transition:background-color,width .3s ease-out;z-index:1001}.uppy-StatusBar-progress.is-indeterminate{animation:uppy-StatusBar-ProgressStripes 1s linear infinite;background-image:linear-gradient(45deg,#0000004d 25%,#0000 0 50%,#0000004d 0 75%,#0000 0,#0000);background-size:64px 64px}@keyframes uppy-StatusBar-ProgressStripes{0%{background-position:0 0}to{background-position:64px 0}}.uppy-StatusBar.is-postprocessing .uppy-StatusBar-progress,.uppy-StatusBar.is-preprocessing .uppy-StatusBar-progress{background-color:#f6a623}.uppy-StatusBar.is-waiting .uppy-StatusBar-progress{display:none}.uppy-StatusBar-content{align-items:center;color:#333;display:flex;height:100%;padding-inline-start:10px;position:relative;text-overflow:ellipsis;white-space:nowrap;z-index:1002}.uppy-size--md .uppy-StatusBar-content{padding-inline-start:15px}[data-uppy-theme=dark] .uppy-StatusBar-content{color:#eaeaea}.uppy-StatusBar-status{display:flex;flex-direction:column;font-weight:400;justify-content:center;line-height:1.4;padding-inline-end:.3em}.uppy-StatusBar-statusPrimary{display:flex;font-weight:500;line-height:1}.uppy-StatusBar-statusPrimary button.uppy-StatusBar-details{margin-left:5px}[data-uppy-theme=dark] .uppy-StatusBar-statusPrimary{color:#eaeaea}.uppy-StatusBar-statusSecondary{color:#757575;display:inline-block;font-size:11px;line-height:1.2;margin-top:1px;white-space:nowrap}[data-uppy-theme=dark] .uppy-StatusBar-statusSecondary{color:#bbb}.uppy-StatusBar-statusSecondaryHint{display:inline-block;line-height:1;margin-inline-end:5px;vertical-align:middle}.uppy-size--md .uppy-StatusBar-statusSecondaryHint{margin-inline-end:8px}.uppy-StatusBar-statusIndicator{color:#525252;margin-inline-end:7px;position:relative;top:1px}.uppy-StatusBar-statusIndicator svg{vertical-align:text-bottom}.uppy-StatusBar-actions{align-items:center;bottom:0;display:flex;inset-inline-end:10px;position:absolute;top:0;z-index:1004}.uppy-StatusBar.is-waiting .uppy-StatusBar-actions{background-color:#fafafa;height:100%;padding:0 15px;position:static;width:100%}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actions{background-color:#1f1f1f}.uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts{flex-direction:column;height:90px}.uppy-size--md .uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts{flex-direction:row;height:65px}.uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts .uppy-StatusBar-actions{flex-direction:column;justify-content:center}.uppy-size--md .uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts .uppy-StatusBar-actions{flex-direction:row;justify-content:normal}.uppy-StatusBar-actionCircleBtn{cursor:pointer;line-height:1;margin:3px;opacity:.9}.uppy-StatusBar-actionCircleBtn:focus{outline:none}.uppy-StatusBar-actionCircleBtn::-moz-focus-inner{border:0}.uppy-StatusBar-actionCircleBtn:focus{box-shadow:0 0 0 3px #1269cf80}[data-uppy-theme=dark] .uppy-StatusBar-actionCircleBtn:focus{outline:none}[data-uppy-theme=dark] .uppy-StatusBar-actionCircleBtn::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-StatusBar-actionCircleBtn:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-StatusBar-actionCircleBtn:hover{opacity:1}.uppy-StatusBar-actionCircleBtn:focus{border-radius:50%}.uppy-StatusBar-actionCircleBtn svg{vertical-align:bottom}.uppy-StatusBar-actionBtn{color:#1269cf;display:inline-block;font-size:10px;line-height:inherit;vertical-align:middle}.uppy-size--md .uppy-StatusBar-actionBtn{font-size:11px}.uppy-StatusBar-actionBtn--disabled{opacity:.4}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--disabled{opacity:.7}.uppy-StatusBar-actionBtn--retry{background-color:#ff4b23;border-radius:8px;color:#fff;height:16px;line-height:1;margin-inline-end:6px;padding:1px 6px 3px 18px;position:relative}.uppy-StatusBar-actionBtn--retry:focus{outline:none}.uppy-StatusBar-actionBtn--retry::-moz-focus-inner{border:0}.uppy-StatusBar-actionBtn--retry:focus{box-shadow:0 0 0 3px #1269cf80}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--retry:focus{outline:none}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--retry::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--retry:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-StatusBar-actionBtn--retry:hover{background-color:#f92d00}.uppy-StatusBar-actionBtn--retry svg{inset-inline-start:6px;position:absolute;top:3px}.uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload{background-color:#1bb240;color:#fff;font-size:14px;line-height:1;padding:15px 10px;width:100%}.uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload:hover{background-color:#189c38}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload{background-color:#1c8b37}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload:hover{background-color:#18762f}.uppy-size--md .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload{padding:13px 22px;width:auto}.uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload.uppy-StatusBar-actionBtn--disabled:hover{background-color:#1bb240;cursor:not-allowed}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload.uppy-StatusBar-actionBtn--disabled:hover{background-color:#1c8b37}.uppy-StatusBar:not(.is-waiting) .uppy-StatusBar-actionBtn--upload{background-color:initial;color:#1269cf}.uppy-StatusBar-actionBtn--uploadNewlyAdded{border-radius:3px;padding-inline-end:3px;padding-bottom:1px;padding-inline-start:3px}.uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{outline:none}.uppy-StatusBar-actionBtn--uploadNewlyAdded::-moz-focus-inner{border:0}.uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{box-shadow:0 0 0 3px #1269cf80}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{outline:none}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--uploadNewlyAdded::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-StatusBar.is-postprocessing .uppy-StatusBar-actionBtn--uploadNewlyAdded,.uppy-StatusBar.is-preprocessing .uppy-StatusBar-actionBtn--uploadNewlyAdded{display:none}.uppy-StatusBar-actionBtn--done{border-radius:3px;line-height:1;padding:7px 8px}.uppy-StatusBar-actionBtn--done:focus{outline:none}.uppy-StatusBar-actionBtn--done::-moz-focus-inner{border:0}.uppy-StatusBar-actionBtn--done:hover{color:#0e51a0}.uppy-StatusBar-actionBtn--done:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--done:focus{background-color:#333}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--done{color:#02baf2}.uppy-size--md .uppy-StatusBar-actionBtn--done{font-size:14px}.uppy-StatusBar-serviceMsg{color:#000;font-size:11px;line-height:1.1;padding-left:10px}.uppy-size--md .uppy-StatusBar-serviceMsg{font-size:14px;padding-left:15px}[data-uppy-theme=dark] .uppy-StatusBar-serviceMsg{color:#eaeaea}.uppy-StatusBar-serviceMsg-ghostsIcon{left:6px;opacity:.5;position:relative;top:2px;vertical-align:text-bottom;width:10px}.uppy-size--md .uppy-StatusBar-serviceMsg-ghostsIcon{left:10px;top:1px;width:15px}.uppy-StatusBar-details{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#939393;border-radius:50%;color:#fff;cursor:help;display:inline-block;font-size:10px;font-weight:600;height:13px;inset-inline-start:2px;line-height:12px;position:relative;text-align:center;top:0;vertical-align:middle;width:13px}.uppy-StatusBar-details:after{line-height:1.3;word-wrap:break-word}.uppy-StatusBar-spinner{animation-duration:1s;animation-iteration-count:infinite;animation-name:uppy-StatusBar-spinnerAnimation;animation-timing-function:linear;fill:#1269cf;margin-inline-end:10px}.uppy-StatusBar.is-postprocessing .uppy-StatusBar-spinner,.uppy-StatusBar.is-preprocessing .uppy-StatusBar-spinner{fill:#f6a623}@keyframes uppy-StatusBar-spinnerAnimation{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.uppy-transition-slideDownUp-enter{opacity:.01;transform:translate3d(0,-105%,0);transition:transform .25s ease-in-out,opacity .25s ease-in-out}.uppy-transition-slideDownUp-enter.uppy-transition-slideDownUp-enter-active{opacity:1;transform:translateZ(0)}.uppy-transition-slideDownUp-leave{opacity:1;transform:translateZ(0);transition:transform .25s ease-in-out,opacity .25s ease-in-out}.uppy-transition-slideDownUp-leave.uppy-transition-slideDownUp-leave-active{opacity:.01;transform:translate3d(0,-105%,0)}@keyframes uppy-Dashboard-fadeIn{0%{opacity:0}to{opacity:1}}@keyframes uppy-Dashboard-fadeOut{0%{opacity:1}to{opacity:0}}@keyframes uppy-Dashboard-slideDownAndFadeIn{0%{opacity:0;transform:translate3d(-50%,-70%,0)}to{opacity:1;transform:translate3d(-50%,-50%,0)}}@keyframes uppy-Dashboard-slideDownAndFadeIn--small{0%{opacity:0;transform:translate3d(0,-20%,0)}to{opacity:1;transform:translateZ(0)}}@keyframes uppy-Dashboard-slideUpFadeOut{0%{opacity:1;transform:translate3d(-50%,-50%,0)}to{opacity:0;transform:translate3d(-50%,-70%,0)}}@keyframes uppy-Dashboard-slideUpFadeOut--small{0%{opacity:1;transform:translateZ(0)}to{opacity:0;transform:translate3d(0,-20%,0)}}.uppy-Dashboard--modal{z-index:1001}.uppy-Dashboard--modal[aria-hidden=true]{display:none}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideDownAndFadeIn--small .3s cubic-bezier(0,0,.2,1)}@media only screen and (min-width:820px){.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideDownAndFadeIn .3s cubic-bezier(0,0,.2,1)}}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose>.uppy-Dashboard-overlay{animation:uppy-Dashboard-fadeIn .3s cubic-bezier(0,0,.2,1)}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideUpFadeOut--small .3s cubic-bezier(0,0,.2,1)}@media only screen and (min-width:820px){.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideUpFadeOut .3s cubic-bezier(0,0,.2,1)}}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing>.uppy-Dashboard-overlay{animation:uppy-Dashboard-fadeOut .3s cubic-bezier(0,0,.2,1)}.uppy-Dashboard-isFixed{height:100vh;overflow:hidden}.uppy-Dashboard--modal .uppy-Dashboard-overlay{background-color:#00000080;inset:0;position:fixed;z-index:1001}.uppy-Dashboard-inner{background-color:#f4f4f4;border:1px solid #eaeaea;border-radius:5px;max-height:100%;max-width:100%;outline:none;position:relative}.uppy-size--md .uppy-Dashboard-inner{min-height:auto}@media only screen and (min-width:820px){.uppy-Dashboard-inner{height:500px;width:650px}}.uppy-Dashboard--modal .uppy-Dashboard-inner{z-index:1002}[data-uppy-theme=dark] .uppy-Dashboard-inner{background-color:#1f1f1f}.uppy-Dashboard--isDisabled .uppy-Dashboard-inner{cursor:not-allowed}.uppy-Dashboard-innerWrap{border-radius:5px;display:flex;flex-direction:column;height:100%;opacity:0;overflow:hidden;position:relative}.uppy-Dashboard--isInnerWrapVisible .uppy-Dashboard-innerWrap{opacity:1}.uppy-Dashboard--isDisabled .uppy-Dashboard-innerWrap{cursor:not-allowed;filter:grayscale(100%);opacity:.6;-webkit-user-select:none;-moz-user-select:none;user-select:none}.uppy-Dashboard--isDisabled .uppy-ProviderIconBg{fill:#9f9f9f}.uppy-Dashboard--isDisabled [aria-disabled],.uppy-Dashboard--isDisabled [disabled]{cursor:not-allowed;pointer-events:none}.uppy-Dashboard--modal .uppy-Dashboard-inner{border:none;inset:35px 15px 15px;position:fixed}@media only screen and (min-width:820px){.uppy-Dashboard--modal .uppy-Dashboard-inner{box-shadow:0 5px 15px 4px #00000026;left:50%;right:auto;top:50%;transform:translate(-50%,-50%)}}.uppy-Dashboard-close{color:#ffffffe6;cursor:pointer;display:block;font-size:27px;inset-inline-end:-2px;position:absolute;top:-33px;z-index:1005}.uppy-Dashboard-close:focus{outline:none}.uppy-Dashboard-close::-moz-focus-inner{border:0}.uppy-Dashboard-close:focus{color:#6eabf2}@media only screen and (min-width:820px){.uppy-Dashboard-close{font-size:35px;inset-inline-end:-35px;top:-10px}}.uppy-Dashboard-serviceMsg{background-color:#fffbf7;border-bottom:1px solid #edd4b9;border-top:1px solid #edd4b9;font-size:12px;font-weight:500;line-height:1.3;padding:12px 0;position:relative;top:-1px;z-index:1004}.uppy-size--md .uppy-Dashboard-serviceMsg{font-size:14px;line-height:1.4}[data-uppy-theme=dark] .uppy-Dashboard-serviceMsg{background-color:#1f1f1f;border-bottom:1px solid #333;border-top:1px solid #333;color:#eaeaea}.uppy-Dashboard-serviceMsg-title{display:block;line-height:1;margin-bottom:4px;padding-left:42px}.uppy-Dashboard-serviceMsg-text{padding:0 15px}.uppy-Dashboard-serviceMsg-actionBtn{color:#1269cf;font-size:inherit;font-weight:inherit;vertical-align:initial}[data-uppy-theme=dark] .uppy-Dashboard-serviceMsg-actionBtn{color:#02baf2e6}.uppy-Dashboard-serviceMsg-icon{left:15px;position:absolute;top:10px}.uppy-Dashboard-AddFiles{align-items:center;display:flex;flex-direction:column;height:100%;justify-content:center;position:relative;text-align:center}[data-uppy-drag-drop-supported=true] .uppy-Dashboard-AddFiles{border:1px dashed #dfdfdf;border-radius:3px;height:calc(100% - 14px);margin:7px}.uppy-Dashboard-AddFilesPanel .uppy-Dashboard-AddFiles{border:none;height:calc(100% - 54px)}.uppy-Dashboard--modal .uppy-Dashboard-AddFiles{border-color:#cfcfcf}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles{border-color:#757575}.uppy-Dashboard-AddFiles-info{display:none;margin-top:auto;padding-bottom:15px;padding-top:15px}.uppy-size--height-md .uppy-Dashboard-AddFiles-info{display:block}.uppy-size--md .uppy-Dashboard-AddFiles-info{bottom:25px;left:0;padding-bottom:0;padding-top:30px;position:absolute;right:0}[data-uppy-num-acquirers="0"] .uppy-Dashboard-AddFiles-info{margin-top:0}.uppy-Dashboard-browse{color:#1269cf;cursor:pointer}.uppy-Dashboard-browse:focus{outline:none}.uppy-Dashboard-browse::-moz-focus-inner{border:0}.uppy-Dashboard-browse:focus,.uppy-Dashboard-browse:hover{border-bottom:1px solid #1269cf}[data-uppy-theme=dark] .uppy-Dashboard-browse{color:#02baf2e6}[data-uppy-theme=dark] .uppy-Dashboard-browse:focus,[data-uppy-theme=dark] .uppy-Dashboard-browse:hover{border-bottom:1px solid #02baf2}.uppy-Dashboard-browseBtn{display:block;font-size:14px;font-weight:500;margin-bottom:5px;margin-top:8px;width:100%}.uppy-size--md .uppy-Dashboard-browseBtn{font-size:15px;margin:15px auto;padding:13px 44px;width:auto}.uppy-Dashboard-AddFiles-list{display:flex;flex:1;flex-direction:column;margin-top:2px;overflow-y:auto;padding:2px 0;width:100%;-webkit-overflow-scrolling:touch}.uppy-size--md .uppy-Dashboard-AddFiles-list{flex:none;flex-direction:row;flex-wrap:wrap;justify-content:center;margin-top:15px;max-width:600px;overflow-y:visible;padding-top:0}.uppy-DashboardTab{border-bottom:1px solid #eaeaea;text-align:center;width:100%}[data-uppy-theme=dark] .uppy-DashboardTab{border-bottom:1px solid #333}.uppy-size--md .uppy-DashboardTab{border-bottom:none;display:inline-block;margin-bottom:10px;width:auto}.uppy-DashboardTab-btn{align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:initial;color:#525252;cursor:pointer;flex-direction:row;height:100%;justify-content:left;padding:12px 15px;width:100%}.uppy-DashboardTab-btn:focus{outline:none}.uppy-size--md .uppy-DashboardTab-btn{border-radius:5px;flex-direction:column;margin-inline-end:1px;padding:10px 3px;width:86px}[data-uppy-theme=dark] .uppy-DashboardTab-btn{color:#eaeaea}.uppy-DashboardTab-btn::-moz-focus-inner{border:0}.uppy-DashboardTab-btn:hover{background-color:#e9ecef}[data-uppy-theme=dark] .uppy-DashboardTab-btn:hover{background-color:#333}.uppy-DashboardTab-btn:active,.uppy-DashboardTab-btn:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-DashboardTab-btn:active,[data-uppy-theme=dark] .uppy-DashboardTab-btn:focus{background-color:#525252}.uppy-DashboardTab-btn svg{display:inline-block;max-height:100%;max-width:100%;overflow:hidden;transition:transform .15s ease-in-out;vertical-align:text-top}.uppy-DashboardTab-inner{align-items:center;background-color:#fff;border-radius:8px;box-shadow:0 1px 1px #0000001a,0 1px 2px #0000001a,0 2px 3px #00000005;display:flex;height:32px;justify-content:center;margin-inline-end:10px;width:32px}.uppy-size--md .uppy-DashboardTab-inner{margin-inline-end:0}[data-uppy-theme=dark] .uppy-DashboardTab-inner{background-color:#323232;box-shadow:0 1px 1px #0003,0 1px 2px #0003,0 2px 3px #00000014}.uppy-DashboardTab-name{font-size:14px;font-weight:400}.uppy-size--md .uppy-DashboardTab-name{font-size:12px;line-height:15px;margin-bottom:0;margin-top:8px}.uppy-DashboardTab-iconMyDevice{color:#1269cf}[data-uppy-theme=dark] .uppy-DashboardTab-iconMyDevice{color:#02baf2}.uppy-DashboardTab-iconBox{color:#0061d5}[data-uppy-theme=dark] .uppy-DashboardTab-iconBox{color:#eaeaea}.uppy-DashboardTab-iconDropbox{color:#0061fe}[data-uppy-theme=dark] .uppy-DashboardTab-iconDropbox{color:#eaeaea}.uppy-DashboardTab-iconUnsplash{color:#111}[data-uppy-theme=dark] .uppy-DashboardTab-iconUnsplash{color:#eaeaea}.uppy-DashboardTab-iconWebdav{color:#111}[data-uppy-theme=dark] .uppy-DashboardTab-iconWebdav{color:#eaeaea}.uppy-DashboardTab-iconScreenRec{color:#2c3e50}[data-uppy-theme=dark] .uppy-DashboardTab-iconScreenRec{color:#eaeaea}.uppy-DashboardTab-iconAudio{color:#8030a3}[data-uppy-theme=dark] .uppy-DashboardTab-iconAudio{color:#bf6ee3}.uppy-Dashboard-input{height:.1px;opacity:0;overflow:hidden;position:absolute;width:.1px;z-index:-1}.uppy-DashboardContent-bar{align-items:center;background-color:#fafafa;border-bottom:1px solid #eaeaea;display:flex;flex-shrink:0;height:40px;justify-content:space-between;padding:0 10px;position:relative;width:100%;z-index:1004}.uppy-size--md .uppy-DashboardContent-bar{height:50px;padding:0 15px}[data-uppy-theme=dark] .uppy-DashboardContent-bar{background-color:#1f1f1f;border-bottom:1px solid #333}.uppy-DashboardContent-title{font-size:12px;font-weight:500;left:0;line-height:40px;margin:auto;max-width:170px;overflow-x:hidden;position:absolute;right:0;text-align:center;text-overflow:ellipsis;top:0;white-space:nowrap;width:100%}.uppy-size--md .uppy-DashboardContent-title{font-size:14px;line-height:50px;max-width:300px}[data-uppy-theme=dark] .uppy-DashboardContent-title{color:#eaeaea}.uppy-DashboardContent-back,.uppy-DashboardContent-save{-webkit-appearance:none;background:none;border:0;border-radius:3px;color:inherit;color:#1269cf;cursor:pointer;font-family:inherit;font-size:inherit;font-size:12px;font-weight:400;line-height:1;margin:0;margin-inline-start:-6px;padding:7px 6px}.uppy-DashboardContent-back:focus,.uppy-DashboardContent-save:focus{outline:none}.uppy-DashboardContent-back::-moz-focus-inner,.uppy-DashboardContent-save::-moz-focus-inner{border:0}.uppy-DashboardContent-back:hover,.uppy-DashboardContent-save:hover{color:#0e51a0}.uppy-DashboardContent-back:focus,.uppy-DashboardContent-save:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-DashboardContent-back:focus,[data-uppy-theme=dark] .uppy-DashboardContent-save:focus{background-color:#333}.uppy-size--md .uppy-DashboardContent-back,.uppy-size--md .uppy-DashboardContent-save{font-size:14px}[data-uppy-theme=dark] .uppy-DashboardContent-back,[data-uppy-theme=dark] .uppy-DashboardContent-save{color:#02baf2}.uppy-DashboardContent-addMore{-webkit-appearance:none;background:none;border:0;border-radius:3px;color:inherit;color:#1269cf;cursor:pointer;font-family:inherit;font-size:inherit;font-weight:500;height:29px;line-height:1;margin:0;margin-inline-end:-5px;padding:7px 8px;width:29px}.uppy-DashboardContent-addMore:focus{outline:none}.uppy-DashboardContent-addMore::-moz-focus-inner{border:0}.uppy-DashboardContent-addMore:hover{color:#0e51a0}.uppy-DashboardContent-addMore:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-DashboardContent-addMore:focus{background-color:#333}.uppy-size--md .uppy-DashboardContent-addMore{font-size:14px;height:auto;margin-inline-end:-8px;width:auto}[data-uppy-theme=dark] .uppy-DashboardContent-addMore{color:#02baf2}.uppy-DashboardContent-addMore svg{margin-inline-end:4px;vertical-align:initial}.uppy-size--md .uppy-DashboardContent-addMore svg{height:11px;width:11px}.uppy-DashboardContent-addMoreCaption{display:none}.uppy-size--md .uppy-DashboardContent-addMoreCaption{display:inline}.uppy-DashboardContent-panel{background-color:#f5f5f5;flex:1}.uppy-Dashboard-AddFilesPanel,.uppy-DashboardContent-panel{border-radius:5px;display:flex;flex-direction:column;inset:0;overflow:hidden;position:absolute;z-index:1005}.uppy-Dashboard-AddFilesPanel{background:#fafafa;background:linear-gradient(0deg,#fafafa 35%,#fafafad9);box-shadow:0 0 10px 5px #00000026}[data-uppy-theme=dark] .uppy-Dashboard-AddFilesPanel{background-color:#333;background-image:linear-gradient(0deg,#1f1f1f 35%,#1f1f1fd9)}.uppy-Dashboard--isAddFilesPanelVisible .uppy-Dashboard-files{filter:blur(2px)}.uppy-Dashboard-progress{bottom:0;height:12%;left:0;position:absolute;width:100%}.uppy-Dashboard-progressBarContainer.is-active{height:100%;left:0;position:absolute;top:0;width:100%;z-index:1004}.uppy-Dashboard-filesContainer{flex:1;margin:0;overflow-y:hidden;position:relative}.uppy-Dashboard-filesContainer:after{clear:both;content:"";display:table}.uppy-Dashboard-files{flex:1;margin:0;overflow-y:auto;padding:0 0 10px;-webkit-overflow-scrolling:touch}.uppy-size--md .uppy-Dashboard-files{padding-top:10px}.uppy-Dashboard--singleFile .uppy-Dashboard-filesInner{align-items:center;display:flex;height:100%;justify-content:center}.uppy-Dashboard-dropFilesHereHint{align-items:center;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath fill='%231269CF' d='M24 1v1C11.85 2 2 11.85 2 24s9.85 22 22 22 22-9.85 22-22S36.15 2 24 2zm0 0V0c13.254 0 24 10.746 24 24S37.254 48 24 48 0 37.254 0 24 10.746 0 24 0zm7.707 19.293a.999.999 0 1 1-1.414 1.414L25 16.414V34a1 1 0 1 1-2 0V16.414l-5.293 5.293a.999.999 0 1 1-1.414-1.414l7-7a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E");background-position:50% 50%;background-repeat:no-repeat;border:1px dashed #1269cf;border-radius:3px;color:#757575;display:flex;font-size:16px;justify-content:center;inset:7px;padding-top:90px;position:absolute;text-align:center;visibility:hidden;z-index:2000}[data-uppy-theme=dark] .uppy-Dashboard-dropFilesHereHint{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath fill='%2302BAF2' d='M24 1v1C11.85 2 2 11.85 2 24s9.85 22 22 22 22-9.85 22-22S36.15 2 24 2zm0 0V0c13.254 0 24 10.746 24 24S37.254 48 24 48 0 37.254 0 24 10.746 0 24 0zm7.707 19.293a.999.999 0 1 1-1.414 1.414L25 16.414V34a1 1 0 1 1-2 0V16.414l-5.293 5.293a.999.999 0 1 1-1.414-1.414l7-7a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E");border-color:#02baf2;color:#bbb}.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-dropFilesHereHint{pointer-events:none;visibility:visible}.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-files,.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-progressindicators,.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-serviceMsg,.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-DashboardContent-bar{opacity:.15}.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-AddFiles{opacity:.03}.uppy-Dashboard-AddFiles-title{color:#000;font-size:17px;font-weight:500;line-height:1.35;margin-bottom:5px;margin-top:15px;padding:0 15px;text-align:inline-start;width:100%}.uppy-size--md .uppy-Dashboard-AddFiles-title{font-size:21px;font-weight:400;margin-top:5px;max-width:480px;padding:0 35px;text-align:center}[data-uppy-num-acquirers="0"] .uppy-Dashboard-AddFiles-title{text-align:center}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles-title{color:#eaeaea}.uppy-Dashboard-AddFiles-title button{font-weight:500}.uppy-size--md .uppy-Dashboard-AddFiles-title button{font-weight:400}.uppy-Dashboard-note{color:#757575;font-size:14px;line-height:1.25;margin:auto;max-width:350px;padding:0 15px;text-align:center}.uppy-size--md .uppy-Dashboard-note{line-height:1.35;max-width:600px}[data-uppy-theme=dark] .uppy-Dashboard-note{color:#cfcfcf}a.uppy-Dashboard-poweredBy{color:#939393;display:inline-block;font-size:11px;margin-top:8px;text-align:center;text-decoration:none}.uppy-Dashboard-poweredByIcon{margin-left:1px;margin-right:1px;opacity:.9;position:relative;top:1px;vertical-align:text-top;fill:none;stroke:#939393}.uppy-Dashboard-Item-previewIcon{height:25px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:25px;z-index:100}.uppy-size--md .uppy-Dashboard-Item-previewIcon{height:38px;width:38px}.uppy-Dashboard-Item-previewIcon svg{height:100%;width:100%}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-previewIcon{height:100%;max-height:60%;max-width:60%;width:100%}.uppy-Dashboard-Item-previewIconWrap{height:76px;max-height:75%;position:relative}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-previewIconWrap{height:100%;width:100%}.uppy-Dashboard-Item-previewIconBg{filter:drop-shadow(rgba(0,0,0,.1) 0 1px 1px);height:100%;width:100%}.uppy-Dashboard-upload{height:50px;position:relative;width:50px}.uppy-size--md .uppy-Dashboard-upload{height:60px;width:60px}.uppy-Dashboard-upload .uppy-c-icon{position:relative;top:1px;width:50%}.uppy-Dashboard-uploadCount{background-color:#1bb240;border-radius:50%;color:#fff;font-size:8px;height:16px;inset-inline-end:-12px;line-height:16px;position:absolute;top:-12px;width:16px}.uppy-size--md .uppy-Dashboard-uploadCount{font-size:9px;height:18px;line-height:18px;width:18px}.uppy-Dashboard-inner{border:none!important;background:transparent!important}.uppy-Dashboard-innerWrap{border-radius:.5rem;overflow:hidden}.uppy-Dashboard-AddFiles{border:2px dashed hsl(var(--border))!important;border-radius:.5rem!important;background:hsl(var(--muted) / .3)!important;transition:all .2s ease}.uppy-Dashboard-AddFiles:hover{border-color:hsl(var(--primary))!important;background:hsl(var(--muted) / .5)!important}.uppy-Dashboard-AddFiles-title{color:hsl(var(--foreground))!important;font-weight:500!important}.uppy-Dashboard-AddFiles-info{color:hsl(var(--muted-foreground))!important}.uppy-Dashboard-browse{color:hsl(var(--primary))!important;font-weight:500!important}.uppy-Dashboard-browse:hover{text-decoration:underline!important}.uppy-Dashboard-files{background:transparent!important}.uppy-Dashboard-Item{border-bottom-color:hsl(var(--border))!important}.uppy-Dashboard-Item-name{color:hsl(var(--foreground))!important}.uppy-Dashboard-Item-status{color:hsl(var(--muted-foreground))!important}.uppy-StatusBar{background:hsl(var(--muted))!important;border-top:1px solid hsl(var(--border))!important}.uppy-StatusBar-progress{background:hsl(var(--primary))!important}.uppy-StatusBar-content{color:hsl(var(--foreground))!important}.uppy-StatusBar-actionBtn--upload{background:hsl(var(--primary))!important;color:hsl(var(--primary-foreground))!important;border-radius:.375rem!important;font-weight:500!important;padding:.5rem 1rem!important}.uppy-StatusBar-actionBtn--upload:hover{background:hsl(var(--primary) / .9)!important}.uppy-Dashboard-note{color:hsl(var(--muted-foreground))!important;font-size:.75rem!important}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles,.dark .uppy-Dashboard-AddFiles{background:hsl(var(--muted) / .2)!important}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles-title,.dark .uppy-Dashboard-AddFiles-title{color:hsl(var(--foreground))!important}[data-uppy-theme=dark] .uppy-StatusBar,.dark .uppy-StatusBar{background:hsl(var(--muted) / .5)!important}.uppy-Dashboard{font-family:inherit!important}.uppy-Dashboard-Item-preview{border-radius:.375rem!important;overflow:hidden}.uppy-Dashboard-Item-action--remove{color:hsl(var(--destructive))!important}.uppy-Dashboard-Item-action--remove:hover{opacity:.8}.uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progress{color:hsl(var(--success, 142 76% 36%))!important}.uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-progress{color:hsl(var(--destructive))!important}.uppy-Dashboard-files::-webkit-scrollbar{width:6px}.uppy-Dashboard-files::-webkit-scrollbar-track{background:transparent}.uppy-Dashboard-files::-webkit-scrollbar-thumb{background:hsl(var(--muted-foreground) / .3);border-radius:3px}.uppy-Dashboard-files::-webkit-scrollbar-thumb:hover{background:hsl(var(--muted-foreground) / .5)}.react-flow{direction:ltr}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;cursor:grab}.react-flow__pane.selection{cursor:pointer}.react-flow__pane.dragging{cursor:grabbing}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow .react-flow__edges{pointer-events:none;overflow:visible}.react-flow__edge-path,.react-flow__connection-path{stroke:#b1b1b7;stroke-width:1;fill:none}.react-flow__edge{pointer-events:visibleStroke;cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:focus .react-flow__edge-path,.react-flow__edge:focus-visible .react-flow__edge-path{stroke:#555}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge-textbg{fill:#fff}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__connectionline{z-index:1001}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:grab}.react-flow__node.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background:#1a192b;border:1px solid white;border-radius:100%}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:-4px;transform:translate(-50%)}.react-flow__handle-top{left:50%;top:-4px;transform:translate(-50%)}.react-flow__handle-left{top:50%;left:-4px;transform:translateY(-50%)}.react-flow__handle-right{right:-4px;top:50%;transform:translateY(-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.center{left:50%;transform:translate(-50%)}.react-flow__attribution{font-size:10px;background:#ffffff80;padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-default,.react-flow__node-input,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:3px;width:150px;font-size:12px;color:#222;text-align:center;border-width:1px;border-style:solid;border-color:#1a192b;background-color:#fff}.react-flow__node-default.selectable:hover,.react-flow__node-input.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:0 1px 4px 1px #00000014}.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:0 0 0 .5px #1a192b}.react-flow__node-group{background-color:#f0f0f040}.react-flow__nodesselection-rect,.react-flow__selection{background:#0059dc14;border:1px dotted rgba(0,89,220,.8)}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls{box-shadow:0 0 2px 1px #00000014}.react-flow__controls-button{border:none;background:#fefefe;border-bottom:1px solid #eee;box-sizing:content-box;display:flex;justify-content:center;align-items:center;width:16px;height:16px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:5px}.react-flow__controls-button:hover{background:#f4f4f4}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__minimap{background-color:#fff}.react-flow__minimap svg{display:block}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:4px;height:4px;border:1px solid #fff;border-radius:1px;background-color:#3367d9;transform:translate(-50%,-50%)}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:#3367d9;border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%} diff --git a/webui/dist/assets/index-D90_5BXS.js b/webui/dist/assets/index-D90_5BXS.js new file mode 100644 index 00000000..218b5fa2 --- /dev/null +++ b/webui/dist/assets/index-D90_5BXS.js @@ -0,0 +1,94 @@ +import{r as u,j as e,L as Vn,e as xa,R as Hs,b as X0,f as Z0,g as W0,h as ew,k as sw,l as rt,m as tw,n as aw,O as cj,o as lw}from"./router-9vIXuQkh.js";import{a as nw,b as rw,g as iw}from"./react-vendor-BmxF9s7Q.js";import{N as cw,c as ow,O as ei,P as dw,g as Tm}from"./utils-BqoaXoQ1.js";import{L as oj,T as dj,C as uj,R as uw,a as mj,V as mw,b as xw,S as xj,c as hw,d as hj,I as fw,e as fj,f as pw,g as pj,h as gw,i as jw,j as vw,O as gj,P as Nw,k as jj,l as vj,D as Nj,A as bj,m as yj,n as bw,o as yw,p as wj,q as ww,r as _j,s as _w,t as Sw,u as Sj,v as kw,w as Cw,x as kj,y as Cj,F as Tj,z as Ej,B as Tw,E as Ew,G as Mj,H as Mw,J as Aw,K as zw,M as Rw,N as Dw,Q as Ow,U as Lw,W as Uw,X as $w,Y as Bw,Z as Iw,_ as Pw,$ as Fw,a0 as Hw,a1 as qw,a2 as Aj,a3 as Vw,a4 as Gw}from"./radix-extra-DmmnfeQE.js";import{R as zj,T as Rj,L as Kw,g as Qw,C as Qi,X as Yi,Y as qr,h as Yw,B as Uo,j as Ji,P as Jw,k as Xw,l as Zw}from"./charts-simvewUa.js";import{S as Ww,O as Dj,o as e1,C as Oj,p as s1,T as Lj,D as Uj,R as t1,q as a1,H as $j,I as l1,J as Bj,K as n1,L as Ij,M as Pj,N as r1,Q as Fj,V as i1,U as Hj,X as qj,Y as c1,Z as o1,_ as Vj,$ as d1,a0 as u1,a1 as Gj,e as Kj,f as sd,c as td,P as sr,d as ad,b as Nn,h as m1,l as x1,m as h1,u as Qm,r as f1,a as p1,a2 as g1,a3 as Qj,a4 as j1,a5 as v1,a6 as N1,a7 as Yj,a8 as Jj,a9 as Xj,aa as Zj,ab as Wj,ac as ev,ad as b1}from"./radix-core-DyJi0yyw.js";import{R as ut,a as lc,C as Rt,b as tt,L as Fs,X as _a,c as Lt,d as $a,e as Yr,f as Ia,g as ra,E as y1,h as sv,Z as el,i as ia,j as ta,S as Ut,B as tv,U as $l,k as Kn,P as hc,l as av,F as La,m as w1,n as bn,o as _1,M as Ba,A as ax,D as S1,p as Jr,T as lx,q as k1,r as lv,I as Qt,s as qt,t as Fo,u as nc,v as ma,H as C1,w as us,x as na,y as rc,z as nx,G as ec,J as _g,K as rx,N as nv,O as T1,Q as $o,V as E1,W as ld,Y as M1,_ as A1,$ as nd,a0 as Ua,a1 as at,a2 as ix,a3 as rv,a4 as fc,a5 as iv,a6 as cv,a7 as Jn,a8 as yn,a9 as wn,aa as cx,ab as ov,ac as ua,ad as Bl,ae as Xn,af as Zn,ag as rd,ah as z1,ai as R1,aj as D1,ak as ox,al as Bo,am as Wn,an as Xr,ao as Ho,ap as O1,aq as qo,ar as ic,as as dv,at as L1,au as U1,av as Vo,aw as $1,ax as dx,ay as Sg,az as B1,aA as I1,aB as uv,aC as P1,aD as fn,aE as mv,aF as Em,aG as kg,aH as F1,aI as Mm,aJ as H1,aK as q1,aL as V1,aM as G1,aN as xv,aO as K1,aP as Zr,aQ as Q1,aR as Y1,aS as hv,aT as fv,aU as J1,aV as X1,aW as Cg,aX as Z1,aY as W1,aZ as e_,a_ as s_,a$ as t_}from"./icons-CmIU8FzD.js";import{S as a_,p as l_,j as n_,a as r_,E as Am,R as i_,o as c_}from"./codemirror-TZqPU532.js";import{u as pv,a as Go,s as gv,K as jv,P as vv,b as Nv,D as bv,c as yv,S as wv,v as o_,d as _v,C as Sv,h as d_}from"./dnd-BiPfFtVp.js";import{_ as Sa,c as u_,g as kv,D as m_,z as Ro}from"./misc-CJqnlRwD.js";import{D as x_,U as h_}from"./uppy-DFP_VzYR.js";import{M as f_,r as p_,a as g_,b as j_}from"./markdown-CKA5gBQ9.js";import{c as v_,H as Ko,P as Qo,u as N_,d as b_,R as y_,B as w_,e as __,C as S_,M as k_,f as C_}from"./reactflow-DtsZHOR4.js";(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))c(d);new MutationObserver(d=>{for(const m of d)if(m.type==="childList")for(const h of m.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function r(d){const m={};return d.integrity&&(m.integrity=d.integrity),d.referrerPolicy&&(m.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?m.credentials="include":d.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function c(d){if(d.ep)return;d.ep=!0;const m=r(d);fetch(d.href,m)}})();var zm={exports:{}},Vi={},Rm={exports:{}},Dm={};var Tg;function T_(){return Tg||(Tg=1,(function(a){function l(D,K){var B=D.length;D.push(K);e:for(;0>>1,Q=D[ue];if(0>>1;ue<_e;){var he=2*(ue+1)-1,Te=D[he],V=he+1,$=D[V];if(0>d(Te,B))Vd($,Te)?(D[ue]=$,D[V]=B,ue=V):(D[ue]=Te,D[he]=B,ue=he);else if(Vd($,B))D[ue]=$,D[V]=B,ue=V;else break e}}return K}function d(D,K){var B=D.sortIndex-K.sortIndex;return B!==0?B:D.id-K.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var m=performance;a.unstable_now=function(){return m.now()}}else{var h=Date,f=h.now();a.unstable_now=function(){return h.now()-f}}var p=[],g=[],N=1,j=null,y=3,b=!1,w=!1,A=!1,M=!1,S=typeof setTimeout=="function"?setTimeout:null,P=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function C(D){for(var K=r(g);K!==null;){if(K.callback===null)c(g);else if(K.startTime<=D)c(g),K.sortIndex=K.expirationTime,l(p,K);else break;K=r(g)}}function R(D){if(A=!1,C(D),!w)if(r(p)!==null)w=!0,H||(H=!0,je());else{var K=r(g);K!==null&&pe(R,K.startTime-D)}}var H=!1,O=-1,X=5,L=-1;function me(){return M?!0:!(a.unstable_now()-LD&&me());){var ue=j.callback;if(typeof ue=="function"){j.callback=null,y=j.priorityLevel;var Q=ue(j.expirationTime<=D);if(D=a.unstable_now(),typeof Q=="function"){j.callback=Q,C(D),K=!0;break s}j===r(p)&&c(p),C(D)}else c(p);j=r(p)}if(j!==null)K=!0;else{var _e=r(g);_e!==null&&pe(R,_e.startTime-D),K=!1}}break e}finally{j=null,y=B,b=!1}K=void 0}}finally{K?je():H=!1}}}var je;if(typeof E=="function")je=function(){E(Ne)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,ge=ce.port2;ce.port1.onmessage=Ne,je=function(){ge.postMessage(null)}}else je=function(){S(Ne,0)};function pe(D,K){O=S(function(){D(a.unstable_now())},K)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(D){D.callback=null},a.unstable_forceFrameRate=function(D){0>D||125ue?(D.sortIndex=B,l(g,D),r(p)===null&&D===r(g)&&(A?(P(O),O=-1):A=!0,pe(R,B-ue))):(D.sortIndex=Q,l(p,D),w||b||(w=!0,H||(H=!0,je()))),D},a.unstable_shouldYield=me,a.unstable_wrapCallback=function(D){var K=y;return function(){var B=y;y=K;try{return D.apply(this,arguments)}finally{y=B}}}})(Dm)),Dm}var Eg;function E_(){return Eg||(Eg=1,Rm.exports=T_()),Rm.exports}var Mg;function M_(){if(Mg)return Vi;Mg=1;var a=E_(),l=nw(),r=rw();function c(s){var t="https://react.dev/errors/"+s;if(1Q||(s.current=ue[Q],ue[Q]=null,Q--)}function Te(s,t){Q++,ue[Q]=s.current,s.current=t}var V=_e(null),$=_e(null),z=_e(null),G=_e(null);function Re(s,t){switch(Te(z,t),Te($,s),Te(V,null),t.nodeType){case 9:case 11:s=(s=t.documentElement)&&(s=s.namespaceURI)?Kp(s):0;break;default:if(s=t.tagName,t=t.namespaceURI)t=Kp(t),s=Qp(t,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}he(V),Te(V,s)}function se(){he(V),he($),he(z)}function Oe(s){s.memoizedState!==null&&Te(G,s);var t=V.current,n=Qp(t,s.type);t!==n&&(Te($,s),Te(V,n))}function ns(s){$.current===s&&(he(V),he($)),G.current===s&&(he(G),Pi._currentValue=B)}var J,Z;function Le(s){if(J===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);J=t&&t[1]||"",Z=-1)":-1o||I[i]!==ie[o]){var ve=` +`+I[i].replace(" at new "," at ");return s.displayName&&ve.includes("")&&(ve=ve.replace("",s.displayName)),ve}while(1<=i&&0<=o);break}}}finally{ae=!1,Error.prepareStackTrace=n}return(n=s?s.displayName||s.name:"")?Le(n):""}function de(s,t){switch(s.tag){case 26:case 27:case 5:return Le(s.type);case 16:return Le("Lazy");case 13:return s.child!==t&&t!==null?Le("Suspense Fallback"):Le("Suspense");case 19:return Le("SuspenseList");case 0:case 15:return Ee(s.type,!1);case 11:return Ee(s.type.render,!1);case 1:return Ee(s.type,!0);case 31:return Le("Activity");default:return""}}function ze(s){try{var t="",n=null;do t+=de(s,n),n=s,s=s.return;while(s);return t}catch(i){return` +Error generating stack: `+i.message+` +`+i.stack}}var ws=Object.prototype.hasOwnProperty,Zs=a.unstable_scheduleCallback,St=a.unstable_cancelCallback,fa=a.unstable_shouldYield,xs=a.unstable_requestPaint,Is=a.unstable_now,Y=a.unstable_getCurrentPriorityLevel,qe=a.unstable_ImmediatePriority,Ke=a.unstable_UserBlockingPriority,Ze=a.unstable_NormalPriority,Ts=a.unstable_LowPriority,He=a.unstable_IdlePriority,zs=a.log,Ls=a.unstable_setDisableYieldValue,Ks=null,cs=null;function ts(s){if(typeof zs=="function"&&Ls(s),cs&&typeof cs.setStrictMode=="function")try{cs.setStrictMode(Ks,s)}catch{}}var _s=Math.clz32?Math.clz32:os,$e=Math.log,ms=Math.LN2;function os(s){return s>>>=0,s===0?32:31-($e(s)/ms|0)|0}var rs=256,ht=262144,Tt=4194304;function ca(s){var t=s&42;if(t!==0)return t;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function ka(s,t,n){var i=s.pendingLanes;if(i===0)return 0;var o=0,x=s.suspendedLanes,v=s.pingedLanes;s=s.warmLanes;var k=i&134217727;return k!==0?(i=k&~x,i!==0?o=ca(i):(v&=k,v!==0?o=ca(v):n||(n=k&~s,n!==0&&(o=ca(n))))):(k=i&~x,k!==0?o=ca(k):v!==0?o=ca(v):n||(n=i&~s,n!==0&&(o=ca(n)))),o===0?0:t!==0&&t!==o&&(t&x)===0&&(x=o&-o,n=t&-t,x>=n||x===32&&(n&4194048)!==0)?t:o}function Pa(s,t){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&t)===0}function Jt(s,t){switch(s){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function te(){var s=Tt;return Tt<<=1,(Tt&62914560)===0&&(Tt=4194304),s}function ye(s){for(var t=[],n=0;31>n;n++)t.push(s);return t}function U(s,t){s.pendingLanes|=t,t!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Me(s,t,n,i,o,x){var v=s.pendingLanes;s.pendingLanes=n,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=n,s.entangledLanes&=n,s.errorRecoveryDisabledLanes&=n,s.shellSuspendCounter=0;var k=s.entanglements,I=s.expirationTimes,ie=s.hiddenUpdates;for(n=v&~n;0"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var Vb=/[\n"\\]/g;function Ha(s){return s.replace(Vb,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function yd(s,t,n,i,o,x,v,k){s.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?s.type=v:s.removeAttribute("type"),t!=null?v==="number"?(t===0&&s.value===""||s.value!=t)&&(s.value=""+Fa(t)):s.value!==""+Fa(t)&&(s.value=""+Fa(t)):v!=="submit"&&v!=="reset"||s.removeAttribute("value"),t!=null?wd(s,v,Fa(t)):n!=null?wd(s,v,Fa(n)):i!=null&&s.removeAttribute("value"),o==null&&x!=null&&(s.defaultChecked=!!x),o!=null&&(s.checked=o&&typeof o!="function"&&typeof o!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?s.name=""+Fa(k):s.removeAttribute("name")}function Ix(s,t,n,i,o,x,v,k){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(s.type=x),t!=null||n!=null){if(!(x!=="submit"&&x!=="reset"||t!=null)){bd(s);return}n=n!=null?""+Fa(n):"",t=t!=null?""+Fa(t):n,k||t===s.value||(s.value=t),s.defaultValue=t}i=i??o,i=typeof i!="function"&&typeof i!="symbol"&&!!i,s.checked=k?s.checked:!!i,s.defaultChecked=!!i,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(s.name=v),bd(s)}function wd(s,t,n){t==="number"&&yc(s.ownerDocument)===s||s.defaultValue===""+n||(s.defaultValue=""+n)}function cr(s,t,n,i){if(s=s.options,t){t={};for(var o=0;o"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Td=!1;if(jl)try{var ni={};Object.defineProperty(ni,"passive",{get:function(){Td=!0}}),window.addEventListener("test",ni,ni),window.removeEventListener("test",ni,ni)}catch{Td=!1}var Vl=null,Ed=null,_c=null;function Kx(){if(_c)return _c;var s,t=Ed,n=t.length,i,o="value"in Vl?Vl.value:Vl.textContent,x=o.length;for(s=0;s=ci),Wx=" ",eh=!1;function sh(s,t){switch(s){case"keyup":return vy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function th(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var mr=!1;function by(s,t){switch(s){case"compositionend":return th(t);case"keypress":return t.which!==32?null:(eh=!0,Wx);case"textInput":return s=t.data,s===Wx&&eh?null:s;default:return null}}function yy(s,t){if(mr)return s==="compositionend"||!Dd&&sh(s,t)?(s=Kx(),_c=Ed=Vl=null,mr=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-s};s=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=dh(n)}}function mh(s,t){return s&&t?s===t?!0:s&&s.nodeType===3?!1:t&&t.nodeType===3?mh(s,t.parentNode):"contains"in s?s.contains(t):s.compareDocumentPosition?!!(s.compareDocumentPosition(t)&16):!1:!1}function xh(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var t=yc(s.document);t instanceof s.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)s=t.contentWindow;else break;t=yc(s.document)}return t}function Ud(s){var t=s&&s.nodeName&&s.nodeName.toLowerCase();return t&&(t==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||t==="textarea"||s.contentEditable==="true")}var My=jl&&"documentMode"in document&&11>=document.documentMode,xr=null,$d=null,mi=null,Bd=!1;function hh(s,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Bd||xr==null||xr!==yc(i)||(i=xr,"selectionStart"in i&&Ud(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),mi&&ui(mi,i)||(mi=i,i=jo($d,"onSelect"),0>=v,o-=v,cl=1<<32-_s(t)+o|n<Es?($s=Qe,Qe=null):$s=Qe.sibling;var Ys=oe(W,Qe,re[Es],be);if(Ys===null){Qe===null&&(Qe=$s);break}s&&Qe&&Ys.alternate===null&&t(W,Qe),q=x(Ys,q,Es),Qs===null?We=Ys:Qs.sibling=Ys,Qs=Ys,Qe=$s}if(Es===re.length)return n(W,Qe),Bs&&Nl(W,Es),We;if(Qe===null){for(;EsEs?($s=Qe,Qe=null):$s=Qe.sibling;var hn=oe(W,Qe,Ys.value,be);if(hn===null){Qe===null&&(Qe=$s);break}s&&Qe&&hn.alternate===null&&t(W,Qe),q=x(hn,q,Es),Qs===null?We=hn:Qs.sibling=hn,Qs=hn,Qe=$s}if(Ys.done)return n(W,Qe),Bs&&Nl(W,Es),We;if(Qe===null){for(;!Ys.done;Es++,Ys=re.next())Ys=we(W,Ys.value,be),Ys!==null&&(q=x(Ys,q,Es),Qs===null?We=Ys:Qs.sibling=Ys,Qs=Ys);return Bs&&Nl(W,Es),We}for(Qe=i(Qe);!Ys.done;Es++,Ys=re.next())Ys=xe(Qe,W,Es,Ys.value,be),Ys!==null&&(s&&Ys.alternate!==null&&Qe.delete(Ys.key===null?Es:Ys.key),q=x(Ys,q,Es),Qs===null?We=Ys:Qs.sibling=Ys,Qs=Ys);return s&&Qe.forEach(function(J0){return t(W,J0)}),Bs&&Nl(W,Es),We}function dt(W,q,re,be){if(typeof re=="object"&&re!==null&&re.type===A&&re.key===null&&(re=re.props.children),typeof re=="object"&&re!==null){switch(re.$$typeof){case b:e:{for(var We=re.key;q!==null;){if(q.key===We){if(We=re.type,We===A){if(q.tag===7){n(W,q.sibling),be=o(q,re.props.children),be.return=W,W=be;break e}}else if(q.elementType===We||typeof We=="object"&&We!==null&&We.$$typeof===X&&$n(We)===q.type){n(W,q.sibling),be=o(q,re.props),ji(be,re),be.return=W,W=be;break e}n(W,q);break}else t(W,q);q=q.sibling}re.type===A?(be=Rn(re.props.children,W.mode,be,re.key),be.return=W,W=be):(be=Dc(re.type,re.key,re.props,null,W.mode,be),ji(be,re),be.return=W,W=be)}return v(W);case w:e:{for(We=re.key;q!==null;){if(q.key===We)if(q.tag===4&&q.stateNode.containerInfo===re.containerInfo&&q.stateNode.implementation===re.implementation){n(W,q.sibling),be=o(q,re.children||[]),be.return=W,W=be;break e}else{n(W,q);break}else t(W,q);q=q.sibling}be=Gd(re,W.mode,be),be.return=W,W=be}return v(W);case X:return re=$n(re),dt(W,q,re,be)}if(pe(re))return Ve(W,q,re,be);if(je(re)){if(We=je(re),typeof We!="function")throw Error(c(150));return re=We.call(re),as(W,q,re,be)}if(typeof re.then=="function")return dt(W,q,Pc(re),be);if(re.$$typeof===E)return dt(W,q,Uc(W,re),be);Fc(W,re)}return typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint"?(re=""+re,q!==null&&q.tag===6?(n(W,q.sibling),be=o(q,re),be.return=W,W=be):(n(W,q),be=Vd(re,W.mode,be),be.return=W,W=be),v(W)):n(W,q)}return function(W,q,re,be){try{gi=0;var We=dt(W,q,re,be);return _r=null,We}catch(Qe){if(Qe===wr||Qe===Bc)throw Qe;var Qs=Ta(29,Qe,null,W.mode);return Qs.lanes=be,Qs.return=W,Qs}finally{}}}var In=Uh(!0),$h=Uh(!1),Jl=!1;function lu(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function nu(s,t){s=s.updateQueue,t.updateQueue===s&&(t.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function Xl(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Zl(s,t,n){var i=s.updateQueue;if(i===null)return null;if(i=i.shared,(Xs&2)!==0){var o=i.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),i.pending=t,t=Rc(s),bh(s,null,n),t}return zc(s,i,t,n),Rc(s)}function vi(s,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var i=t.lanes;i&=s.pendingLanes,n|=i,t.lanes=n,ds(s,n)}}function ru(s,t){var n=s.updateQueue,i=s.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var o=null,x=null;if(n=n.firstBaseUpdate,n!==null){do{var v={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};x===null?o=x=v:x=x.next=v,n=n.next}while(n!==null);x===null?o=x=t:x=x.next=t}else o=x=t;n={baseState:i.baseState,firstBaseUpdate:o,lastBaseUpdate:x,shared:i.shared,callbacks:i.callbacks},s.updateQueue=n;return}s=n.lastBaseUpdate,s===null?n.firstBaseUpdate=t:s.next=t,n.lastBaseUpdate=t}var iu=!1;function Ni(){if(iu){var s=yr;if(s!==null)throw s}}function bi(s,t,n,i){iu=!1;var o=s.updateQueue;Jl=!1;var x=o.firstBaseUpdate,v=o.lastBaseUpdate,k=o.shared.pending;if(k!==null){o.shared.pending=null;var I=k,ie=I.next;I.next=null,v===null?x=ie:v.next=ie,v=I;var ve=s.alternate;ve!==null&&(ve=ve.updateQueue,k=ve.lastBaseUpdate,k!==v&&(k===null?ve.firstBaseUpdate=ie:k.next=ie,ve.lastBaseUpdate=I))}if(x!==null){var we=o.baseState;v=0,ve=ie=I=null,k=x;do{var oe=k.lane&-536870913,xe=oe!==k.lane;if(xe?(Us&oe)===oe:(i&oe)===oe){oe!==0&&oe===br&&(iu=!0),ve!==null&&(ve=ve.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var Ve=s,as=k;oe=t;var dt=n;switch(as.tag){case 1:if(Ve=as.payload,typeof Ve=="function"){we=Ve.call(dt,we,oe);break e}we=Ve;break e;case 3:Ve.flags=Ve.flags&-65537|128;case 0:if(Ve=as.payload,oe=typeof Ve=="function"?Ve.call(dt,we,oe):Ve,oe==null)break e;we=j({},we,oe);break e;case 2:Jl=!0}}oe=k.callback,oe!==null&&(s.flags|=64,xe&&(s.flags|=8192),xe=o.callbacks,xe===null?o.callbacks=[oe]:xe.push(oe))}else xe={lane:oe,tag:k.tag,payload:k.payload,callback:k.callback,next:null},ve===null?(ie=ve=xe,I=we):ve=ve.next=xe,v|=oe;if(k=k.next,k===null){if(k=o.shared.pending,k===null)break;xe=k,k=xe.next,xe.next=null,o.lastBaseUpdate=xe,o.shared.pending=null}}while(!0);ve===null&&(I=we),o.baseState=I,o.firstBaseUpdate=ie,o.lastBaseUpdate=ve,x===null&&(o.shared.lanes=0),an|=v,s.lanes=v,s.memoizedState=we}}function Bh(s,t){if(typeof s!="function")throw Error(c(191,s));s.call(t)}function Ih(s,t){var n=s.callbacks;if(n!==null)for(s.callbacks=null,s=0;sx?x:8;var v=D.T,k={};D.T=k,ku(s,!1,t,n);try{var I=o(),ie=D.S;if(ie!==null&&ie(k,I),I!==null&&typeof I=="object"&&typeof I.then=="function"){var ve=By(I,i);_i(s,t,ve,Ra(s))}else _i(s,t,i,Ra(s))}catch(we){_i(s,t,{then:function(){},status:"rejected",reason:we},Ra())}finally{K.p=x,v!==null&&k.types!==null&&(v.types=k.types),D.T=v}}function Vy(){}function _u(s,t,n,i){if(s.tag!==5)throw Error(c(476));var o=vf(s).queue;jf(s,o,t,B,n===null?Vy:function(){return Nf(s),n(i)})}function vf(s){var t=s.memoizedState;if(t!==null)return t;t={memoizedState:B,baseState:B,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_l,lastRenderedState:B},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_l,lastRenderedState:n},next:null},s.memoizedState=t,s=s.alternate,s!==null&&(s.memoizedState=t),t}function Nf(s){var t=vf(s);t.next===null&&(t=s.alternate.memoizedState),_i(s,t.next.queue,{},Ra())}function Su(){return Wt(Pi)}function bf(){return Ot().memoizedState}function yf(){return Ot().memoizedState}function Gy(s){for(var t=s.return;t!==null;){switch(t.tag){case 24:case 3:var n=Ra();s=Xl(n);var i=Zl(t,s,n);i!==null&&(ba(i,t,n),vi(i,t,n)),t={cache:eu()},s.payload=t;return}t=t.return}}function Ky(s,t,n){var i=Ra();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Zc(s)?_f(t,n):(n=Hd(s,t,n,i),n!==null&&(ba(n,s,i),Sf(n,t,i)))}function wf(s,t,n){var i=Ra();_i(s,t,n,i)}function _i(s,t,n,i){var o={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Zc(s))_f(t,o);else{var x=s.alternate;if(s.lanes===0&&(x===null||x.lanes===0)&&(x=t.lastRenderedReducer,x!==null))try{var v=t.lastRenderedState,k=x(v,n);if(o.hasEagerState=!0,o.eagerState=k,Ca(k,v))return zc(s,t,o,0),mt===null&&Ac(),!1}catch{}finally{}if(n=Hd(s,t,o,i),n!==null)return ba(n,s,i),Sf(n,t,i),!0}return!1}function ku(s,t,n,i){if(i={lane:2,revertLane:lm(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Zc(s)){if(t)throw Error(c(479))}else t=Hd(s,n,i,2),t!==null&&ba(t,s,2)}function Zc(s){var t=s.alternate;return s===ks||t!==null&&t===ks}function _f(s,t){kr=Vc=!0;var n=s.pending;n===null?t.next=t:(t.next=n.next,n.next=t),s.pending=t}function Sf(s,t,n){if((n&4194048)!==0){var i=t.lanes;i&=s.pendingLanes,n|=i,t.lanes=n,ds(s,n)}}var Si={readContext:Wt,use:Qc,useCallback:Et,useContext:Et,useEffect:Et,useImperativeHandle:Et,useLayoutEffect:Et,useInsertionEffect:Et,useMemo:Et,useReducer:Et,useRef:Et,useState:Et,useDebugValue:Et,useDeferredValue:Et,useTransition:Et,useSyncExternalStore:Et,useId:Et,useHostTransitionStatus:Et,useFormState:Et,useActionState:Et,useOptimistic:Et,useMemoCache:Et,useCacheRefresh:Et};Si.useEffectEvent=Et;var kf={readContext:Wt,use:Qc,useCallback:function(s,t){return da().memoizedState=[s,t===void 0?null:t],s},useContext:Wt,useEffect:of,useImperativeHandle:function(s,t,n){n=n!=null?n.concat([s]):null,Jc(4194308,4,xf.bind(null,t,s),n)},useLayoutEffect:function(s,t){return Jc(4194308,4,s,t)},useInsertionEffect:function(s,t){Jc(4,2,s,t)},useMemo:function(s,t){var n=da();t=t===void 0?null:t;var i=s();if(Pn){ts(!0);try{s()}finally{ts(!1)}}return n.memoizedState=[i,t],i},useReducer:function(s,t,n){var i=da();if(n!==void 0){var o=n(t);if(Pn){ts(!0);try{n(t)}finally{ts(!1)}}}else o=t;return i.memoizedState=i.baseState=o,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:o},i.queue=s,s=s.dispatch=Ky.bind(null,ks,s),[i.memoizedState,s]},useRef:function(s){var t=da();return s={current:s},t.memoizedState=s},useState:function(s){s=vu(s);var t=s.queue,n=wf.bind(null,ks,t);return t.dispatch=n,[s.memoizedState,n]},useDebugValue:yu,useDeferredValue:function(s,t){var n=da();return wu(n,s,t)},useTransition:function(){var s=vu(!1);return s=jf.bind(null,ks,s.queue,!0,!1),da().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,t,n){var i=ks,o=da();if(Bs){if(n===void 0)throw Error(c(407));n=n()}else{if(n=t(),mt===null)throw Error(c(349));(Us&127)!==0||Gh(i,t,n)}o.memoizedState=n;var x={value:n,getSnapshot:t};return o.queue=x,of(Qh.bind(null,i,x,s),[s]),i.flags|=2048,Tr(9,{destroy:void 0},Kh.bind(null,i,x,n,t),null),n},useId:function(){var s=da(),t=mt.identifierPrefix;if(Bs){var n=ol,i=cl;n=(i&~(1<<32-_s(i)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Gc++,0<\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof i.is=="string"?v.createElement("select",{is:i.is}):v.createElement("select"),i.multiple?x.multiple=!0:i.size&&(x.size=i.size);break;default:x=typeof i.is=="string"?v.createElement(o,{is:i.is}):v.createElement(o)}}x[Ss]=t,x[hs]=i;e:for(v=t.child;v!==null;){if(v.tag===5||v.tag===6)x.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===t)break e;for(;v.sibling===null;){if(v.return===null||v.return===t)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}t.stateNode=x;e:switch(sa(x,o,i),o){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&kl(t)}}return Nt(t),Iu(t,t.type,s===null?null:s.memoizedProps,t.pendingProps,n),null;case 6:if(s&&t.stateNode!=null)s.memoizedProps!==i&&kl(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(c(166));if(s=z.current,vr(t)){if(s=t.stateNode,n=t.memoizedProps,i=null,o=Zt,o!==null)switch(o.tag){case 27:case 5:i=o.memoizedProps}s[Ss]=t,s=!!(s.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||Vp(s.nodeValue,n)),s||Ql(t,!0)}else s=vo(s).createTextNode(i),s[Ss]=t,t.stateNode=s}return Nt(t),null;case 31:if(n=t.memoizedState,s===null||s.memoizedState!==null){if(i=vr(t),n!==null){if(s===null){if(!i)throw Error(c(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(c(557));s[Ss]=t}else Dn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Nt(t),s=!1}else n=Jd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=n),s=!0;if(!s)return t.flags&256?(Ma(t),t):(Ma(t),null);if((t.flags&128)!==0)throw Error(c(558))}return Nt(t),null;case 13:if(i=t.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(o=vr(t),i!==null&&i.dehydrated!==null){if(s===null){if(!o)throw Error(c(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(c(317));o[Ss]=t}else Dn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Nt(t),o=!1}else o=Jd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(Ma(t),t):(Ma(t),null)}return Ma(t),(t.flags&128)!==0?(t.lanes=n,t):(n=i!==null,s=s!==null&&s.memoizedState!==null,n&&(i=t.child,o=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(o=i.alternate.memoizedState.cachePool.pool),x=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(x=i.memoizedState.cachePool.pool),x!==o&&(i.flags|=2048)),n!==s&&n&&(t.child.flags|=8192),ao(t,t.updateQueue),Nt(t),null);case 4:return se(),s===null&&cm(t.stateNode.containerInfo),Nt(t),null;case 10:return yl(t.type),Nt(t),null;case 19:if(he(Dt),i=t.memoizedState,i===null)return Nt(t),null;if(o=(t.flags&128)!==0,x=i.rendering,x===null)if(o)Ci(i,!1);else{if(Mt!==0||s!==null&&(s.flags&128)!==0)for(s=t.child;s!==null;){if(x=qc(s),x!==null){for(t.flags|=128,Ci(i,!1),s=x.updateQueue,t.updateQueue=s,ao(t,s),t.subtreeFlags=0,s=n,n=t.child;n!==null;)yh(n,s),n=n.sibling;return Te(Dt,Dt.current&1|2),Bs&&Nl(t,i.treeForkCount),t.child}s=s.sibling}i.tail!==null&&Is()>co&&(t.flags|=128,o=!0,Ci(i,!1),t.lanes=4194304)}else{if(!o)if(s=qc(x),s!==null){if(t.flags|=128,o=!0,s=s.updateQueue,t.updateQueue=s,ao(t,s),Ci(i,!0),i.tail===null&&i.tailMode==="hidden"&&!x.alternate&&!Bs)return Nt(t),null}else 2*Is()-i.renderingStartTime>co&&n!==536870912&&(t.flags|=128,o=!0,Ci(i,!1),t.lanes=4194304);i.isBackwards?(x.sibling=t.child,t.child=x):(s=i.last,s!==null?s.sibling=x:t.child=x,i.last=x)}return i.tail!==null?(s=i.tail,i.rendering=s,i.tail=s.sibling,i.renderingStartTime=Is(),s.sibling=null,n=Dt.current,Te(Dt,o?n&1|2:n&1),Bs&&Nl(t,i.treeForkCount),s):(Nt(t),null);case 22:case 23:return Ma(t),ou(),i=t.memoizedState!==null,s!==null?s.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(n&536870912)!==0&&(t.flags&128)===0&&(Nt(t),t.subtreeFlags&6&&(t.flags|=8192)):Nt(t),n=t.updateQueue,n!==null&&ao(t,n.retryQueue),n=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(n=s.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),s!==null&&he(Un),null;case 24:return n=null,s!==null&&(n=s.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),yl($t),Nt(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function Zy(s,t){switch(Qd(t),t.tag){case 1:return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 3:return yl($t),se(),s=t.flags,(s&65536)!==0&&(s&128)===0?(t.flags=s&-65537|128,t):null;case 26:case 27:case 5:return ns(t),null;case 31:if(t.memoizedState!==null){if(Ma(t),t.alternate===null)throw Error(c(340));Dn()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 13:if(Ma(t),s=t.memoizedState,s!==null&&s.dehydrated!==null){if(t.alternate===null)throw Error(c(340));Dn()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 19:return he(Dt),null;case 4:return se(),null;case 10:return yl(t.type),null;case 22:case 23:return Ma(t),ou(),s!==null&&he(Un),s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 24:return yl($t),null;case 25:return null;default:return null}}function Jf(s,t){switch(Qd(t),t.tag){case 3:yl($t),se();break;case 26:case 27:case 5:ns(t);break;case 4:se();break;case 31:t.memoizedState!==null&&Ma(t);break;case 13:Ma(t);break;case 19:he(Dt);break;case 10:yl(t.type);break;case 22:case 23:Ma(t),ou(),s!==null&&he(Un);break;case 24:yl($t)}}function Ti(s,t){try{var n=t.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var o=i.next;n=o;do{if((n.tag&s)===s){i=void 0;var x=n.create,v=n.inst;i=x(),v.destroy=i}n=n.next}while(n!==o)}}catch(k){st(t,t.return,k)}}function sn(s,t,n){try{var i=t.updateQueue,o=i!==null?i.lastEffect:null;if(o!==null){var x=o.next;i=x;do{if((i.tag&s)===s){var v=i.inst,k=v.destroy;if(k!==void 0){v.destroy=void 0,o=t;var I=n,ie=k;try{ie()}catch(ve){st(o,I,ve)}}}i=i.next}while(i!==x)}}catch(ve){st(t,t.return,ve)}}function Xf(s){var t=s.updateQueue;if(t!==null){var n=s.stateNode;try{Ih(t,n)}catch(i){st(s,s.return,i)}}}function Zf(s,t,n){n.props=Fn(s.type,s.memoizedProps),n.state=s.memoizedState;try{n.componentWillUnmount()}catch(i){st(s,t,i)}}function Ei(s,t){try{var n=s.ref;if(n!==null){switch(s.tag){case 26:case 27:case 5:var i=s.stateNode;break;case 30:i=s.stateNode;break;default:i=s.stateNode}typeof n=="function"?s.refCleanup=n(i):n.current=i}}catch(o){st(s,t,o)}}function dl(s,t){var n=s.ref,i=s.refCleanup;if(n!==null)if(typeof i=="function")try{i()}catch(o){st(s,t,o)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(o){st(s,t,o)}else n.current=null}function Wf(s){var t=s.type,n=s.memoizedProps,i=s.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break e;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(o){st(s,s.return,o)}}function Pu(s,t,n){try{var i=s.stateNode;N0(i,s.type,n,t),i[hs]=t}catch(o){st(s,s.return,o)}}function ep(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&on(s.type)||s.tag===4}function Fu(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||ep(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&on(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Hu(s,t,n){var i=s.tag;if(i===5||i===6)s=s.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(s,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(s),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=gl));else if(i!==4&&(i===27&&on(s.type)&&(n=s.stateNode,t=null),s=s.child,s!==null))for(Hu(s,t,n),s=s.sibling;s!==null;)Hu(s,t,n),s=s.sibling}function lo(s,t,n){var i=s.tag;if(i===5||i===6)s=s.stateNode,t?n.insertBefore(s,t):n.appendChild(s);else if(i!==4&&(i===27&&on(s.type)&&(n=s.stateNode),s=s.child,s!==null))for(lo(s,t,n),s=s.sibling;s!==null;)lo(s,t,n),s=s.sibling}function sp(s){var t=s.stateNode,n=s.memoizedProps;try{for(var i=s.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);sa(t,i,n),t[Ss]=s,t[hs]=n}catch(x){st(s,s.return,x)}}var Cl=!1,Pt=!1,qu=!1,tp=typeof WeakSet=="function"?WeakSet:Set,Kt=null;function Wy(s,t){if(s=s.containerInfo,um=ko,s=xh(s),Ud(s)){if("selectionStart"in s)var n={start:s.selectionStart,end:s.selectionEnd};else e:{n=(n=s.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var o=i.anchorOffset,x=i.focusNode;i=i.focusOffset;try{n.nodeType,x.nodeType}catch{n=null;break e}var v=0,k=-1,I=-1,ie=0,ve=0,we=s,oe=null;s:for(;;){for(var xe;we!==n||o!==0&&we.nodeType!==3||(k=v+o),we!==x||i!==0&&we.nodeType!==3||(I=v+i),we.nodeType===3&&(v+=we.nodeValue.length),(xe=we.firstChild)!==null;)oe=we,we=xe;for(;;){if(we===s)break s;if(oe===n&&++ie===o&&(k=v),oe===x&&++ve===i&&(I=v),(xe=we.nextSibling)!==null)break;we=oe,oe=we.parentNode}we=xe}n=k===-1||I===-1?null:{start:k,end:I}}else n=null}n=n||{start:0,end:0}}else n=null;for(mm={focusedElem:s,selectionRange:n},ko=!1,Kt=t;Kt!==null;)if(t=Kt,s=t.child,(t.subtreeFlags&1028)!==0&&s!==null)s.return=t,Kt=s;else for(;Kt!==null;){switch(t=Kt,x=t.alternate,s=t.flags,t.tag){case 0:if((s&4)!==0&&(s=t.updateQueue,s=s!==null?s.events:null,s!==null))for(n=0;n title"))),sa(x,i,n),x[Ss]=s,Gt(x),i=x;break e;case"link":var v=cg("link","href",o).get(i+(n.href||""));if(v){for(var k=0;kdt&&(v=dt,dt=as,as=v);var W=uh(k,as),q=uh(k,dt);if(W&&q&&(xe.rangeCount!==1||xe.anchorNode!==W.node||xe.anchorOffset!==W.offset||xe.focusNode!==q.node||xe.focusOffset!==q.offset)){var re=we.createRange();re.setStart(W.node,W.offset),xe.removeAllRanges(),as>dt?(xe.addRange(re),xe.extend(q.node,q.offset)):(re.setEnd(q.node,q.offset),xe.addRange(re))}}}}for(we=[],xe=k;xe=xe.parentNode;)xe.nodeType===1&&we.push({element:xe,left:xe.scrollLeft,top:xe.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;kn?32:n,D.T=null,n=Xu,Xu=null;var x=nn,v=zl;if(Ft=0,Rr=nn=null,zl=0,(Xs&6)!==0)throw Error(c(331));var k=Xs;if(Xs|=4,xp(x.current),dp(x,x.current,v,n),Xs=k,Oi(0,!1),cs&&typeof cs.onPostCommitFiberRoot=="function")try{cs.onPostCommitFiberRoot(Ks,x)}catch{}return!0}finally{K.p=o,D.T=i,Ap(s,t)}}function Rp(s,t,n){t=Va(n,t),t=Mu(s.stateNode,t,2),s=Zl(s,t,2),s!==null&&(U(s,2),ul(s))}function st(s,t,n){if(s.tag===3)Rp(s,s,n);else for(;t!==null;){if(t.tag===3){Rp(t,s,n);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(ln===null||!ln.has(i))){s=Va(n,s),n=Df(2),i=Zl(t,n,2),i!==null&&(Of(n,i,t,s),U(i,2),ul(i));break}}t=t.return}}function sm(s,t,n){var i=s.pingCache;if(i===null){i=s.pingCache=new t0;var o=new Set;i.set(t,o)}else o=i.get(t),o===void 0&&(o=new Set,i.set(t,o));o.has(n)||(Ku=!0,o.add(n),s=i0.bind(null,s,t,n),t.then(s,s))}function i0(s,t,n){var i=s.pingCache;i!==null&&i.delete(t),s.pingedLanes|=s.suspendedLanes&n,s.warmLanes&=~n,mt===s&&(Us&n)===n&&(Mt===4||Mt===3&&(Us&62914560)===Us&&300>Is()-io?(Xs&2)===0&&Dr(s,0):Qu|=n,zr===Us&&(zr=0)),ul(s)}function Dp(s,t){t===0&&(t=te()),s=zn(s,t),s!==null&&(U(s,t),ul(s))}function c0(s){var t=s.memoizedState,n=0;t!==null&&(n=t.retryLane),Dp(s,n)}function o0(s,t){var n=0;switch(s.tag){case 31:case 13:var i=s.stateNode,o=s.memoizedState;o!==null&&(n=o.retryLane);break;case 19:i=s.stateNode;break;case 22:i=s.stateNode._retryCache;break;default:throw Error(c(314))}i!==null&&i.delete(t),Dp(s,n)}function d0(s,t){return Zs(s,t)}var fo=null,Lr=null,tm=!1,po=!1,am=!1,cn=0;function ul(s){s!==Lr&&s.next===null&&(Lr===null?fo=Lr=s:Lr=Lr.next=s),po=!0,tm||(tm=!0,m0())}function Oi(s,t){if(!am&&po){am=!0;do for(var n=!1,i=fo;i!==null;){if(s!==0){var o=i.pendingLanes;if(o===0)var x=0;else{var v=i.suspendedLanes,k=i.pingedLanes;x=(1<<31-_s(42|s)+1)-1,x&=o&~(v&~k),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(n=!0,$p(i,x))}else x=Us,x=ka(i,i===mt?x:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(x&3)===0||Pa(i,x)||(n=!0,$p(i,x));i=i.next}while(n);am=!1}}function u0(){Op()}function Op(){po=tm=!1;var s=0;cn!==0&&y0()&&(s=cn);for(var t=Is(),n=null,i=fo;i!==null;){var o=i.next,x=Lp(i,t);x===0?(i.next=null,n===null?fo=o:n.next=o,o===null&&(Lr=n)):(n=i,(s!==0||(x&3)!==0)&&(po=!0)),i=o}Ft!==0&&Ft!==5||Oi(s),cn!==0&&(cn=0)}function Lp(s,t){for(var n=s.suspendedLanes,i=s.pingedLanes,o=s.expirationTimes,x=s.pendingLanes&-62914561;0k)break;var ve=I.transferSize,we=I.initiatorType;ve&&Gp(we)&&(I=I.responseEnd,v+=ve*(I"u"?null:document;function lg(s,t,n){var i=Ur;if(i&&typeof t=="string"&&t){var o=Ha(t);o='link[rel="'+s+'"][href="'+o+'"]',typeof n=="string"&&(o+='[crossorigin="'+n+'"]'),ag.has(o)||(ag.add(o),s={rel:s,crossOrigin:n,href:t},i.querySelector(o)===null&&(t=i.createElement("link"),sa(t,"link",s),Gt(t),i.head.appendChild(t)))}}function A0(s){Rl.D(s),lg("dns-prefetch",s,null)}function z0(s,t){Rl.C(s,t),lg("preconnect",s,t)}function R0(s,t,n){Rl.L(s,t,n);var i=Ur;if(i&&s&&t){var o='link[rel="preload"][as="'+Ha(t)+'"]';t==="image"&&n&&n.imageSrcSet?(o+='[imagesrcset="'+Ha(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(o+='[imagesizes="'+Ha(n.imageSizes)+'"]')):o+='[href="'+Ha(s)+'"]';var x=o;switch(t){case"style":x=$r(s);break;case"script":x=Br(s)}Xa.has(x)||(s=j({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:s,as:t},n),Xa.set(x,s),i.querySelector(o)!==null||t==="style"&&i.querySelector(Bi(x))||t==="script"&&i.querySelector(Ii(x))||(t=i.createElement("link"),sa(t,"link",s),Gt(t),i.head.appendChild(t)))}}function D0(s,t){Rl.m(s,t);var n=Ur;if(n&&s){var i=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Ha(i)+'"][href="'+Ha(s)+'"]',x=o;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Br(s)}if(!Xa.has(x)&&(s=j({rel:"modulepreload",href:s},t),Xa.set(x,s),n.querySelector(o)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Ii(x)))return}i=n.createElement("link"),sa(i,"link",s),Gt(i),n.head.appendChild(i)}}}function O0(s,t,n){Rl.S(s,t,n);var i=Ur;if(i&&s){var o=rr(i).hoistableStyles,x=$r(s);t=t||"default";var v=o.get(x);if(!v){var k={loading:0,preload:null};if(v=i.querySelector(Bi(x)))k.loading=5;else{s=j({rel:"stylesheet",href:s,"data-precedence":t},n),(n=Xa.get(x))&&vm(s,n);var I=v=i.createElement("link");Gt(I),sa(I,"link",s),I._p=new Promise(function(ie,ve){I.onload=ie,I.onerror=ve}),I.addEventListener("load",function(){k.loading|=1}),I.addEventListener("error",function(){k.loading|=2}),k.loading|=4,bo(v,t,i)}v={type:"stylesheet",instance:v,count:1,state:k},o.set(x,v)}}}function L0(s,t){Rl.X(s,t);var n=Ur;if(n&&s){var i=rr(n).hoistableScripts,o=Br(s),x=i.get(o);x||(x=n.querySelector(Ii(o)),x||(s=j({src:s,async:!0},t),(t=Xa.get(o))&&Nm(s,t),x=n.createElement("script"),Gt(x),sa(x,"link",s),n.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},i.set(o,x))}}function U0(s,t){Rl.M(s,t);var n=Ur;if(n&&s){var i=rr(n).hoistableScripts,o=Br(s),x=i.get(o);x||(x=n.querySelector(Ii(o)),x||(s=j({src:s,async:!0,type:"module"},t),(t=Xa.get(o))&&Nm(s,t),x=n.createElement("script"),Gt(x),sa(x,"link",s),n.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},i.set(o,x))}}function ng(s,t,n,i){var o=(o=z.current)?No(o):null;if(!o)throw Error(c(446));switch(s){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=$r(n.href),n=rr(o).hoistableStyles,i=n.get(t),i||(i={type:"style",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){s=$r(n.href);var x=rr(o).hoistableStyles,v=x.get(s);if(v||(o=o.ownerDocument||o,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(s,v),(x=o.querySelector(Bi(s)))&&!x._p&&(v.instance=x,v.state.loading=5),Xa.has(s)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Xa.set(s,n),x||$0(o,s,n,v.state))),t&&i===null)throw Error(c(528,""));return v}if(t&&i!==null)throw Error(c(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Br(n),n=rr(o).hoistableScripts,i=n.get(t),i||(i={type:"script",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(c(444,s))}}function $r(s){return'href="'+Ha(s)+'"'}function Bi(s){return'link[rel="stylesheet"]['+s+"]"}function rg(s){return j({},s,{"data-precedence":s.precedence,precedence:null})}function $0(s,t,n,i){s.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=s.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),sa(t,"link",n),Gt(t),s.head.appendChild(t))}function Br(s){return'[src="'+Ha(s)+'"]'}function Ii(s){return"script[async]"+s}function ig(s,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var i=s.querySelector('style[data-href~="'+Ha(n.href)+'"]');if(i)return t.instance=i,Gt(i),i;var o=j({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(s.ownerDocument||s).createElement("style"),Gt(i),sa(i,"style",o),bo(i,n.precedence,s),t.instance=i;case"stylesheet":o=$r(n.href);var x=s.querySelector(Bi(o));if(x)return t.state.loading|=4,t.instance=x,Gt(x),x;i=rg(n),(o=Xa.get(o))&&vm(i,o),x=(s.ownerDocument||s).createElement("link"),Gt(x);var v=x;return v._p=new Promise(function(k,I){v.onload=k,v.onerror=I}),sa(x,"link",i),t.state.loading|=4,bo(x,n.precedence,s),t.instance=x;case"script":return x=Br(n.src),(o=s.querySelector(Ii(x)))?(t.instance=o,Gt(o),o):(i=n,(o=Xa.get(x))&&(i=j({},n),Nm(i,o)),s=s.ownerDocument||s,o=s.createElement("script"),Gt(o),sa(o,"link",i),s.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(c(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,bo(i,n.precedence,s));return t.instance}function bo(s,t,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=i.length?i[i.length-1]:null,x=o,v=0;v title"):null)}function B0(s,t,n){if(n===1||t.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return s=t.disabled,typeof t.precedence=="string"&&s==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function dg(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function I0(s,t,n,i){if(n.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var o=$r(i.href),x=t.querySelector(Bi(o));if(x){t=x._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(s.count++,s=wo.bind(s),t.then(s,s)),n.state.loading|=4,n.instance=x,Gt(x);return}x=t.ownerDocument||t,i=rg(i),(o=Xa.get(o))&&vm(i,o),x=x.createElement("link"),Gt(x);var v=x;v._p=new Promise(function(k,I){v.onload=k,v.onerror=I}),sa(x,"link",i),n.instance=x}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(s.count++,n=wo.bind(s),t.addEventListener("load",n),t.addEventListener("error",n))}}var bm=0;function P0(s,t){return s.stylesheets&&s.count===0&&So(s,s.stylesheets),0bm?50:800)+t);return s.unsuspend=n,function(){s.unsuspend=null,clearTimeout(i),clearTimeout(o)}}:null}function wo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)So(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var _o=null;function So(s,t){s.stylesheets=null,s.unsuspend!==null&&(s.count++,_o=new Map,t.forEach(F0,s),_o=null,wo.call(s))}function F0(s,t){if(!(t.state.loading&4)){var n=_o.get(s);if(n)var i=n.get(null);else{n=new Map,_o.set(s,n);for(var o=s.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(l){console.error(l)}}return a(),zm.exports=M_(),zm.exports}var z_=A_();function F(...a){return cw(ow(a))}const Ce=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:F("rounded-xl border bg-card text-card-foreground shadow",a),...l}));Ce.displayName="Card";const De=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:F("flex flex-col space-y-1.5 p-6",a),...l}));De.displayName="CardHeader";const Ue=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:F("font-semibold leading-none tracking-tight",a),...l}));Ue.displayName="CardTitle";const fs=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:F("text-sm text-muted-foreground",a),...l}));fs.displayName="CardDescription";const Ae=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:F("p-6 pt-0",a),...l}));Ae.displayName="CardContent";const id=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:F("flex items-center p-6 pt-0",a),...l}));id.displayName="CardFooter";const Yt=uw,Vt=u.forwardRef(({className:a,...l},r)=>e.jsx(oj,{ref:r,className:F("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",a),...l}));Vt.displayName=oj.displayName;const Ye=u.forwardRef(({className:a,...l},r)=>e.jsx(dj,{ref:r,className:F("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",a),...l}));Ye.displayName=dj.displayName;const Ms=u.forwardRef(({className:a,...l},r)=>e.jsx(uj,{ref:r,className:F("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",a),...l}));Ms.displayName=uj.displayName;const ss=u.forwardRef(({className:a,children:l,viewportRef:r,...c},d)=>e.jsxs(mj,{ref:d,className:F("relative overflow-hidden",a),...c,children:[e.jsx(mw,{ref:r,className:"h-full w-full rounded-[inherit]",children:l}),e.jsx(Ym,{}),e.jsx(Ym,{orientation:"horizontal"}),e.jsx(xw,{})]}));ss.displayName=mj.displayName;const Ym=u.forwardRef(({className:a,orientation:l="vertical",...r},c)=>e.jsx(xj,{ref:c,orientation:l,className:F("flex touch-none select-none transition-colors",l==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",l==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",a),...r,children:e.jsx(hw,{className:"relative flex-1 rounded-full bg-border"})}));Ym.displayName=xj.displayName;function As({className:a,...l}){return e.jsx("div",{className:F("animate-pulse rounded-md bg-primary/10",a),...l})}const er=u.forwardRef(({className:a,value:l,...r},c)=>e.jsx(hj,{ref:c,className:F("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",a),...r,children:e.jsx(fw,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(l||0)}%)`}})}));er.displayName=hj.displayName;async function Se(a,l){const c=l?.body instanceof FormData?{...l?.headers}:{"Content-Type":"application/json",...l?.headers},d={...l,credentials:"include",headers:c},m=await fetch(a,d);if(m.status===401)throw window.location.href="/auth",new Error("认证失败,请重新登录");return m}function Ws(){return{"Content-Type":"application/json"}}async function R_(){try{await fetch("/api/webui/auth/logout",{method:"POST",credentials:"include"})}catch(a){console.error("登出请求失败:",a)}window.location.href="/auth"}async function cc(){try{return(await(await fetch("/api/webui/auth/check",{method:"GET",credentials:"include"})).json()).authenticated===!0}catch{return!1}}const D_={light:"",dark:".dark"},Cv=u.createContext(null);function Tv(){const a=u.useContext(Cv);if(!a)throw new Error("useChart must be used within a ");return a}const Vr=u.forwardRef(({id:a,className:l,children:r,config:c,...d},m)=>{const h=u.useId(),f=`chart-${a||h.replace(/:/g,"")}`;return e.jsx(Cv.Provider,{value:{config:c},children:e.jsxs("div",{"data-chart":f,ref:m,className:F("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",l),...d,children:[e.jsx(O_,{id:f,config:c}),e.jsx(zj,{children:r})]})})});Vr.displayName="Chart";const O_=({id:a,config:l})=>{const r=Object.entries(l).filter(([,c])=>c.theme||c.color);return r.length?e.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(D_).map(([c,d])=>` +${d} [data-chart=${a}] { +${r.map(([m,h])=>{const f=h.theme?.[c]||h.color;return f?` --color-${m}: ${f};`:null}).join(` +`)} +} +`).join(` +`)}}):null},Gi=Rj,Gr=u.forwardRef(({active:a,payload:l,className:r,indicator:c="dot",hideLabel:d=!1,hideIndicator:m=!1,label:h,labelFormatter:f,labelClassName:p,formatter:g,color:N,nameKey:j,labelKey:y},b)=>{const{config:w}=Tv(),A=u.useMemo(()=>{if(d||!l?.length)return null;const[S]=l,P=`${y||S?.dataKey||S?.name||"value"}`,E=Jm(w,S,P),C=!y&&typeof h=="string"?w[h]?.label||h:E?.label;return f?e.jsx("div",{className:F("font-medium",p),children:f(C,l)}):C?e.jsx("div",{className:F("font-medium",p),children:C}):null},[h,f,l,d,p,w,y]);if(!a||!l?.length)return null;const M=l.length===1&&c!=="dot";return e.jsxs("div",{ref:b,className:F("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",r),children:[M?null:A,e.jsx("div",{className:"grid gap-1.5",children:l.filter(S=>S.type!=="none").map((S,P)=>{const E=`${j||S.name||S.dataKey||"value"}`,C=Jm(w,S,E),R=N||S.payload.fill||S.color;return e.jsx("div",{className:F("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",c==="dot"&&"items-center"),children:g&&S?.value!==void 0&&S.name?g(S.value,S.name,S,P,S.payload):e.jsxs(e.Fragment,{children:[C?.icon?e.jsx(C.icon,{}):!m&&e.jsx("div",{className:F("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":c==="dot","w-1":c==="line","w-0 border-[1.5px] border-dashed bg-transparent":c==="dashed","my-0.5":M&&c==="dashed"}),style:{"--color-bg":R,"--color-border":R}}),e.jsxs("div",{className:F("flex flex-1 justify-between leading-none",M?"items-end":"items-center"),children:[e.jsxs("div",{className:"grid gap-1.5",children:[M?A:null,e.jsx("span",{className:"text-muted-foreground",children:C?.label||S.name})]}),S.value&&e.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:S.value.toLocaleString()})]})]})},S.dataKey)})})]})});Gr.displayName="ChartTooltip";const L_=Kw,Ev=u.forwardRef(({className:a,hideIcon:l=!1,payload:r,verticalAlign:c="bottom",nameKey:d},m)=>{const{config:h}=Tv();return r?.length?e.jsx("div",{ref:m,className:F("flex items-center justify-center gap-4",c==="top"?"pb-3":"pt-3",a),children:r.filter(f=>f.type!=="none").map(f=>{const p=`${d||f.dataKey||"value"}`,g=Jm(h,f,p);return e.jsxs("div",{className:F("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[g?.icon&&!l?e.jsx(g.icon,{}):e.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:f.color}}),g?.label]},f.value)})}):null});Ev.displayName="ChartLegend";function Jm(a,l,r){if(typeof l!="object"||l===null)return;const c="payload"in l&&typeof l.payload=="object"&&l.payload!==null?l.payload:void 0;let d=r;return r in l&&typeof l[r]=="string"?d=l[r]:c&&r in c&&typeof c[r]=="string"&&(d=c[r]),d in a?a[d]:a[r]}const Wr=ei("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),_=u.forwardRef(({className:a,variant:l,size:r,asChild:c=!1,...d},m)=>{const h=c?Ww:"button";return e.jsx(h,{className:F(Wr({variant:l,size:r,className:a})),ref:m,...d})});_.displayName="Button";const U_=ei("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function ke({className:a,variant:l,...r}){return e.jsx("div",{className:F(U_({variant:l}),a),...r})}async function $_(){const a=await Se("/api/webui/system/restart",{method:"POST",headers:Ws()});if(!a.ok){const l=await a.json();throw new Error(l.detail||"重启失败")}return await a.json()}async function B_(){const a=await Se("/api/webui/system/status",{method:"GET",headers:Ws()});if(!a.ok){const l=await a.json();throw new Error(l.detail||"获取状态失败")}return await a.json()}const Pr={INITIAL_DELAY:3e3,CHECK_INTERVAL:2e3,CHECK_TIMEOUT:3e3,MAX_ATTEMPTS:60,PROGRESS_INTERVAL:200,SUCCESS_REDIRECT_DELAY:1500},Mv=u.createContext(null);function tr({children:a,onRestartComplete:l,onRestartFailed:r,healthCheckUrl:c="/api/webui/system/status",maxAttempts:d=Pr.MAX_ATTEMPTS}){const[m,h]=u.useState({status:"idle",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:d}),f=u.useRef({}),p=u.useCallback(()=>{const A=f.current;A.progress&&(clearInterval(A.progress),A.progress=void 0),A.elapsed&&(clearInterval(A.elapsed),A.elapsed=void 0),A.check&&(clearTimeout(A.check),A.check=void 0)},[]),g=u.useCallback(()=>{p(),h({status:"idle",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:d})},[p,d]),N=u.useCallback(async()=>{try{const A=new AbortController,M=setTimeout(()=>A.abort(),Pr.CHECK_TIMEOUT),S=await fetch(c,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include",signal:A.signal});return clearTimeout(M),S.ok}catch{return!1}},[c]),j=u.useCallback(()=>{let A=0;const M=async()=>{if(A++,h(P=>({...P,status:"checking",checkAttempts:A})),await N())p(),h(P=>({...P,status:"success",progress:100})),setTimeout(()=>{l?.(),window.location.href="/auth"},Pr.SUCCESS_REDIRECT_DELAY);else if(A>=d){p();const P=`健康检查超时 (${A}/${d})`;h(E=>({...E,status:"failed",error:P})),r?.(P)}else{const P=setTimeout(M,Pr.CHECK_INTERVAL);f.current.check=P}};M()},[N,p,d,l,r]),y=u.useCallback(()=>{h(A=>({...A,status:"checking",checkAttempts:0,error:void 0})),j()},[j]),b=u.useCallback(async A=>{const{delay:M=0,skipApiCall:S=!1}=A??{};if(m.status!=="idle"&&m.status!=="failed")return;if(p(),h({status:"requesting",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:d}),M>0&&await new Promise(C=>setTimeout(C,M)),S)h(C=>({...C,status:"restarting"}));else try{h(C=>({...C,status:"restarting"})),await Promise.race([$_(),new Promise(C=>setTimeout(C,5e3))])}catch{}const P=setInterval(()=>{h(C=>({...C,progress:C.progress>=90?C.progress:C.progress+1}))},Pr.PROGRESS_INTERVAL),E=setInterval(()=>{h(C=>({...C,elapsedTime:C.elapsedTime+1}))},1e3);f.current.progress=P,f.current.elapsed=E,setTimeout(()=>{j()},Pr.INITIAL_DELAY)},[m.status,p,d,j]),w={state:m,isRestarting:m.status!=="idle",triggerRestart:b,resetState:g,retryHealthCheck:y};return e.jsx(Mv.Provider,{value:w,children:a})}function _n(){const a=u.useContext(Mv);if(!a)throw new Error("useRestart must be used within a RestartProvider");return a}function I_(){try{return _n()}catch{return null}}const P_=(a,l,r,c,d)=>({idle:{icon:null,title:"",description:"",tip:""},requesting:{icon:e.jsx(Fs,{className:"h-16 w-16 text-primary animate-spin"}),title:c??"准备重启",description:d??"正在发送重启请求...",tip:"🔄 正在准备重启麦麦..."},restarting:{icon:e.jsx(Fs,{className:"h-16 w-16 text-primary animate-spin"}),title:c??"正在重启麦麦",description:d??"请稍候,麦麦正在重启中...",tip:"🔄 配置已保存,正在重启主程序..."},checking:{icon:e.jsx(Fs,{className:"h-16 w-16 text-primary animate-spin"}),title:"检查服务状态",description:`等待服务恢复... (${l}/${r})`,tip:"⏳ 正在等待服务恢复,请勿关闭页面..."},success:{icon:e.jsx(tt,{className:"h-16 w-16 text-green-500"}),title:"重启成功",description:"正在跳转到登录页面...",tip:"✅ 配置已生效,服务运行正常"},failed:{icon:e.jsx(Rt,{className:"h-16 w-16 text-destructive"}),title:"重启超时",description:"服务未能在预期时间内恢复",tip:"⚠️ 如果长时间无响应,请尝试手动重启"}})[a];function ar({visible:a,onComplete:l,onFailed:r,title:c,description:d,showAnimation:m=!0,className:h}){const f=I_();return(f?f.isRestarting:a)?f?e.jsx(Av,{state:f.state,onRetry:f.retryHealthCheck,onComplete:l,onFailed:r,title:c,description:d,showAnimation:m,className:h}):e.jsx(F_,{onComplete:l,onFailed:r,title:c,description:d,showAnimation:m,className:h}):null}function Av({state:a,onRetry:l,onComplete:r,onFailed:c,title:d,description:m,showAnimation:h,className:f}){const{status:p,progress:g,elapsedTime:N,checkAttempts:j,maxAttempts:y}=a;u.useEffect(()=>{p==="success"&&r?r():p==="failed"&&c&&c()},[p,r,c]);const b=P_(p,j,y,d,m),w=A=>{const M=Math.floor(A/60),S=A%60;return`${M}:${S.toString().padStart(2,"0")}`};return e.jsxs("div",{className:F("fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",f),children:[h&&e.jsx(H_,{}),e.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8 relative z-10",children:[e.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[e.jsxs("div",{className:"relative",children:[b.icon,(p==="restarting"||p==="checking")&&e.jsx("div",{className:"absolute inset-0 rounded-full bg-primary/20 animate-ping"})]}),e.jsx("h2",{className:"text-2xl font-bold",children:b.title}),e.jsx("p",{className:"text-muted-foreground text-center",children:b.description})]}),p!=="failed"&&p!=="idle"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(er,{value:g,className:"h-2"}),e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{children:[g,"%"]}),e.jsxs("span",{children:["已用时: ",w(N)]})]})]}),e.jsx("div",{className:"bg-muted/50 rounded-lg p-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:b.tip})}),p==="failed"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(_,{onClick:()=>window.location.reload(),variant:"default",className:"flex-1",children:[e.jsx(ut,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),e.jsxs(_,{onClick:l,variant:"secondary",className:"flex-1",children:[e.jsx(lc,{className:"mr-2 h-4 w-4"}),"重试检测"]})]})]})]})}function F_({onComplete:a,onFailed:l,title:r,description:c,showAnimation:d,className:m}){const[h,f]=u.useState({status:"restarting",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:60}),p=u.useCallback(()=>{let g=0;const N=60,j=async()=>{g++,f(y=>({...y,status:"checking",checkAttempts:g}));try{if((await fetch("/api/webui/system/status",{method:"GET",signal:AbortSignal.timeout(3e3)})).ok){f(b=>({...b,status:"success",progress:100})),setTimeout(()=>{a?.(),window.location.href="/auth"},1500);return}}catch{}g>=N?(f(y=>({...y,status:"failed"})),l?.()):setTimeout(j,2e3)};j()},[a,l]);return u.useEffect(()=>{const g=setInterval(()=>{f(y=>({...y,progress:y.progress>=90?y.progress:y.progress+1}))},200),N=setInterval(()=>{f(y=>({...y,elapsedTime:y.elapsedTime+1}))},1e3),j=setTimeout(()=>{p()},3e3);return()=>{clearInterval(g),clearInterval(N),clearTimeout(j)}},[p]),e.jsx(Av,{state:h,onRetry:p,onComplete:a,onFailed:l,title:r,description:c,showAnimation:d,className:m})}function H_(){return e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsxs("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[600px] h-[600px]",children:[e.jsx("div",{className:"absolute inset-0 rounded-full border border-primary/10 animate-[ping_3s_ease-in-out_infinite]"}),e.jsx("div",{className:"absolute inset-8 rounded-full border border-primary/10 animate-[ping_3s_ease-in-out_infinite_0.5s]"}),e.jsx("div",{className:"absolute inset-16 rounded-full border border-primary/10 animate-[ping_3s_ease-in-out_infinite_1s]"})]}),e.jsx("div",{className:"absolute top-1/4 left-1/4 w-2 h-2 bg-primary/20 rounded-full animate-bounce"}),e.jsx("div",{className:"absolute top-3/4 right-1/4 w-3 h-3 bg-primary/15 rounded-full animate-bounce delay-150"}),e.jsx("div",{className:"absolute top-1/2 right-1/3 w-2 h-2 bg-primary/20 rounded-full animate-bounce delay-300"})]})}const Js=t1,cd=a1,q_=e1,zv=u.forwardRef(({className:a,...l},r)=>e.jsx(Dj,{ref:r,className:F("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...l}));zv.displayName=Dj.displayName;const qs=u.forwardRef(({className:a,children:l,preventOutsideClose:r=!1,hideCloseButton:c=!1,...d},m)=>e.jsxs(q_,{children:[e.jsx(zv,{}),e.jsxs(Oj,{ref:m,className:F("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),onPointerDownOutside:r?h=>h.preventDefault():void 0,onInteractOutside:r?h=>h.preventDefault():void 0,...d,children:[l,!c&&e.jsxs(s1,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(_a,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));qs.displayName=Oj.displayName;const Vs=({className:a,...l})=>e.jsx("div",{className:F("flex flex-col space-y-1.5 text-center sm:text-left",a),...l});Vs.displayName="DialogHeader";const xt=({className:a,...l})=>e.jsx("div",{className:F("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...l});xt.displayName="DialogFooter";const Gs=u.forwardRef(({className:a,...l},r)=>e.jsx(Lj,{ref:r,className:F("text-lg font-semibold leading-none tracking-tight",a),...l}));Gs.displayName=Lj.displayName;const nt=u.forwardRef(({className:a,...l},r)=>e.jsx(Uj,{ref:r,className:F("text-sm text-muted-foreground",a),...l}));nt.displayName=Uj.displayName;const ne=u.forwardRef(({className:a,type:l,...r},c)=>e.jsx("input",{type:l,className:F("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",a),ref:c,...r}));ne.displayName="Input";const lt=u.forwardRef(({className:a,...l},r)=>e.jsx($j,{ref:r,className:F("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",a),...l,children:e.jsx(l1,{className:F("grid place-content-center text-current"),children:e.jsx(Lt,{className:"h-4 w-4"})})}));lt.displayName=$j.displayName;const Pe=d1,Fe=u1,Be=u.forwardRef(({className:a,children:l,...r},c)=>e.jsxs(Bj,{ref:c,className:F("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",a),...r,children:[l,e.jsx(n1,{asChild:!0,children:e.jsx($a,{className:"h-4 w-4 opacity-50"})})]}));Be.displayName=Bj.displayName;const Rv=u.forwardRef(({className:a,...l},r)=>e.jsx(Ij,{ref:r,className:F("flex cursor-default items-center justify-center py-1",a),...l,children:e.jsx(Yr,{className:"h-4 w-4"})}));Rv.displayName=Ij.displayName;const Dv=u.forwardRef(({className:a,...l},r)=>e.jsx(Pj,{ref:r,className:F("flex cursor-default items-center justify-center py-1",a),...l,children:e.jsx($a,{className:"h-4 w-4"})}));Dv.displayName=Pj.displayName;const Ie=u.forwardRef(({className:a,children:l,position:r="popper",...c},d)=>e.jsx(r1,{children:e.jsxs(Fj,{ref:d,className:F("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:r,...c,children:[e.jsx(Rv,{}),e.jsx(i1,{className:F("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:l}),e.jsx(Dv,{})]})}));Ie.displayName=Fj.displayName;const V_=u.forwardRef(({className:a,...l},r)=>e.jsx(Hj,{ref:r,className:F("px-2 py-1.5 text-sm font-semibold",a),...l}));V_.displayName=Hj.displayName;const ee=u.forwardRef(({className:a,children:l,...r},c)=>e.jsxs(qj,{ref:c,className:F("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...r,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(c1,{children:e.jsx(Lt,{className:"h-4 w-4"})})}),e.jsx(o1,{children:l})]}));ee.displayName=qj.displayName;const G_=u.forwardRef(({className:a,...l},r)=>e.jsx(Vj,{ref:r,className:F("-mx-1 my-1 h-px bg-muted",a),...l}));G_.displayName=Vj.displayName;const ux=({className:a,...l})=>e.jsx("nav",{role:"navigation","aria-label":"pagination",className:F("mx-auto flex w-full justify-center",a),...l});ux.displayName="Pagination";const mx=u.forwardRef(({className:a,...l},r)=>e.jsx("ul",{ref:r,className:F("flex flex-row items-center gap-1",a),...l}));mx.displayName="PaginationContent";const Yn=u.forwardRef(({className:a,...l},r)=>e.jsx("li",{ref:r,className:F("",a),...l}));Yn.displayName="PaginationItem";const pc=({className:a,isActive:l,size:r="icon",...c})=>e.jsx("a",{"aria-current":l?"page":void 0,className:F(Wr({variant:l?"outline":"ghost",size:r}),a),...c});pc.displayName="PaginationLink";const Ov=({className:a,...l})=>e.jsxs(pc,{"aria-label":"Go to previous page",size:"default",className:F("gap-1 pl-2.5",a),...l,children:[e.jsx(Ia,{className:"h-4 w-4"}),e.jsx("span",{children:"上一页"})]});Ov.displayName="PaginationPrevious";const Lv=({className:a,...l})=>e.jsxs(pc,{"aria-label":"Go to next page",size:"default",className:F("gap-1 pr-2.5",a),...l,children:[e.jsx("span",{children:"下一页"}),e.jsx(ra,{className:"h-4 w-4"})]});Lv.displayName="PaginationNext";const Uv=({className:a,...l})=>e.jsxs("span",{"aria-hidden":!0,className:F("flex h-9 w-9 items-center justify-center",a),...l,children:[e.jsx(y1,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"More pages"})]});Uv.displayName="PaginationEllipsis";const K_=5,Q_=5e3;let Om=0;function Y_(){return Om=(Om+1)%Number.MAX_SAFE_INTEGER,Om.toString()}const Lm=new Map,zg=a=>{if(Lm.has(a))return;const l=setTimeout(()=>{Lm.delete(a),sc({type:"REMOVE_TOAST",toastId:a})},Q_);Lm.set(a,l)},J_=(a,l)=>{switch(l.type){case"ADD_TOAST":return{...a,toasts:[l.toast,...a.toasts].slice(0,K_)};case"UPDATE_TOAST":return{...a,toasts:a.toasts.map(r=>r.id===l.toast.id?{...r,...l.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=l;return r?zg(r):a.toasts.forEach(c=>{zg(c.id)}),{...a,toasts:a.toasts.map(c=>c.id===r||r===void 0?{...c,open:!1}:c)}}case"REMOVE_TOAST":return l.toastId===void 0?{...a,toasts:[]}:{...a,toasts:a.toasts.filter(r=>r.id!==l.toastId)}}},Io=[];let Po={toasts:[]};function sc(a){Po=J_(Po,a),Io.forEach(l=>{l(Po)})}function aa({...a}){const l=Y_(),r=d=>sc({type:"UPDATE_TOAST",toast:{...d,id:l}}),c=()=>sc({type:"DISMISS_TOAST",toastId:l});return sc({type:"ADD_TOAST",toast:{...a,id:l,open:!0,onOpenChange:d=>{d||c()}}}),{id:l,dismiss:c,update:r}}function it(){const[a,l]=u.useState(Po);return u.useEffect(()=>(Io.push(l),()=>{const r=Io.indexOf(l);r>-1&&Io.splice(r,1)}),[a]),{...a,toast:aa,dismiss:r=>sc({type:"DISMISS_TOAST",toastId:r})}}const rl="/api/webui/expression";async function xx(){const a=await Se(`${rl}/chats`,{});if(!a.ok){const l=await a.json();throw new Error(l.detail||"获取聊天列表失败")}return a.json()}async function X_(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.search&&l.append("search",a.search),a.chat_id&&l.append("chat_id",a.chat_id);const r=await Se(`${rl}/list?${l}`,{});if(!r.ok){const c=await r.json();throw new Error(c.detail||"获取表达方式列表失败")}return r.json()}async function Z_(a){const l=await Se(`${rl}/${a}`,{});if(!l.ok){const r=await l.json();throw new Error(r.detail||"获取表达方式详情失败")}return l.json()}async function W_(a){const l=await Se(`${rl}/`,{method:"POST",body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"创建表达方式失败")}return l.json()}async function e2(a,l){const r=await Se(`${rl}/${a}`,{method:"PATCH",body:JSON.stringify(l)});if(!r.ok){const c=await r.json();throw new Error(c.detail||"更新表达方式失败")}return r.json()}async function s2(a){const l=await Se(`${rl}/${a}`,{method:"DELETE"});if(!l.ok){const r=await l.json();throw new Error(r.detail||"删除表达方式失败")}return l.json()}async function t2(a){const l=await Se(`${rl}/batch/delete`,{method:"POST",body:JSON.stringify({ids:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"批量删除表达方式失败")}return l.json()}async function a2(){const a=await Se(`${rl}/stats/summary`,{});if(!a.ok){const l=await a.json();throw new Error(l.detail||"获取统计数据失败")}return a.json()}async function hx(){const a=await Se(`${rl}/review/stats`);if(!a.ok){const l=await a.json();throw new Error(l.detail||"获取审核统计失败")}return a.json()}async function Rg(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.filter_type&&l.append("filter_type",a.filter_type),a.search&&l.append("search",a.search),a.chat_id&&l.append("chat_id",a.chat_id);const r=await Se(`${rl}/review/list?${l}`);if(!r.ok){const c=await r.json();throw new Error(c.detail||"获取审核列表失败")}return r.json()}async function Um(a){const l=await Se(`${rl}/review/batch`,{method:"POST",body:JSON.stringify({items:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"批量审核失败")}return l.json()}function $v({open:a,onOpenChange:l}){const[r,c]=u.useState("list"),[d,m]=u.useState(null),[h,f]=u.useState([]),[p,g]=u.useState("unchecked"),[N,j]=u.useState([]),[y,b]=u.useState(0),[w,A]=u.useState(!1),[M,S]=u.useState(0),[P,E]=u.useState(1),[C,R]=u.useState(null),[H,O]=u.useState(0),[X,L]=u.useState(!1),[me,Ne]=u.useState(null),je=u.useRef(null),ce=u.useRef(null),ge=u.useRef(!1),[pe,D]=u.useState(!1),[K,B]=u.useState(!1),[ue,Q]=u.useState(0),[_e,he]=u.useState(1),[Te,V]=u.useState(20),[$,z]=u.useState(""),[G,Re]=u.useState("unchecked"),[se,Oe]=u.useState(""),[ns,J]=u.useState(""),[Z,Le]=u.useState(new Set),[ae,Ee]=u.useState(new Set),[de,ze]=u.useState(new Map),{toast:ws}=it(),Zs=u.useCallback(async()=>{try{B(!0);const U=await hx();m(U)}catch(U){console.error("加载统计失败:",U)}finally{B(!1)}},[]),St=u.useCallback(async()=>{try{D(!0);const U=await Rg({page:_e,page_size:Te,filter_type:G,search:se||void 0});f(U.data),Q(U.total)}catch(U){ws({title:"加载失败",description:U instanceof Error?U.message:"无法加载列表",variant:"destructive"})}finally{D(!1)}},[_e,Te,G,se,ws]),fa=u.useCallback(async()=>{try{const U=await xx();if(U?.data){const Me=new Map;U.data.forEach(Xe=>{Me.set(Xe.chat_id,Xe.chat_name)}),ze(Me)}}catch(U){console.error("加载聊天名称失败:",U)}},[]),xs=u.useCallback(async(U=!0,Me=!1)=>{try{A(!0);const Xe=Me?P+1:P,ds=await Rg({page:Xe,page_size:20,filter_type:p});Me?(j(is=>[...is,...ds.data]),E(Xe)):j(ds.data),S(ds.total),U&&b(0)}catch(Xe){ws({title:"加载失败",description:Xe instanceof Error?Xe.message:"无法加载列表",variant:"destructive"})}finally{A(!1)}},[P,p,ws]);u.useEffect(()=>{r==="quick"&&(E(1),b(0))},[p,r]),u.useEffect(()=>{a&&r==="quick"&&(xs(),Zs())},[a,r,P,p,xs,Zs]);const Is=u.useCallback(U=>U?p==="unchecked"?{left:!0,right:!0}:p==="passed"?{left:!0,right:!1}:p==="rejected"?{left:!1,right:!0}:U.checked?U.rejected?{left:!1,right:!0}:{left:!0,right:!1}:{left:!0,right:!0}:{left:!1,right:!1},[p]),Y=u.useCallback(async U=>{const Me=N[y];if(!Me||X)return;const Xe=Is(Me);if(!(U&&!Xe.left||!U&&!Xe.right)){L(!0),R(U?"left":"right"),O(U?-400:400);try{(await Um([{id:Me.id,rejected:U,require_unchecked:p==="unchecked"}])).results[0]?.success?(ws({title:U?"已拒绝":"已通过",description:`表达方式 #${Me.id} ${U?"已拒绝":"已通过"}`}),setTimeout(()=>{j(is=>is.filter((kt,Ps)=>Ps!==y)),S(is=>is-1),y>=N.length-1&&b(Math.max(0,y-1)),R(null),O(0),L(!1),Zs(),N.length<=1&&M>1&&xs(!1)},300)):(Ne(Me.id),ws({title:"数据冲突",description:"该条目已被后台任务处理,正在刷新数据...",variant:"destructive"}),setTimeout(()=>{Ne(null),R(null),O(0),L(!1),xs(!1),Zs()},1500))}catch(ds){ws({title:"操作失败",description:ds instanceof Error?ds.message:"未知错误",variant:"destructive"}),R(null),O(0),L(!1)}}},[N,y,X,Is,p,ws,Zs,M,xs]),qe=u.useCallback((U,Me)=>{X||(ce.current={x:U,y:Me},ge.current=!1)},[X]),Ke=u.useCallback(U=>{X||(L(!0),O(U==="left"?-30:30),setTimeout(()=>{O(0),setTimeout(()=>L(!1),300)},150))},[X]),Ze=u.useCallback(U=>{if(!ce.current||X)return;const Me=U-ce.current.x,Xe=N[y],ds=Is(Xe);if(Me<0&&!ds.left){O(Me*.2),R(null);return}if(Me>0&&!ds.right){O(Me*.2),R(null);return}ge.current=!0,O(Me),Math.abs(Me)>50?R(Me>0?"right":"left"):R(null)},[N,y,Is,X]),Ts=u.useCallback(()=>{if(!ce.current)return;Math.abs(H)>100&&C?Y(C==="left"):(O(0),R(null)),ce.current=null,ge.current=!1},[H,C,Y]),He=u.useCallback(U=>{qe(U.clientX,U.clientY)},[qe]),zs=u.useCallback(U=>{ce.current&&(U.preventDefault(),Ze(U.clientX))},[Ze]),Ls=u.useCallback(()=>{Ts()},[Ts]),Ks=u.useCallback(()=>{ce.current&&Ts()},[Ts]),cs=u.useCallback(U=>{const Me=U.touches[0];qe(Me.clientX,Me.clientY)},[qe]),ts=u.useCallback(U=>{const Me=U.touches[0];Ze(Me.clientX)},[Ze]),_s=u.useCallback(()=>{Ts()},[Ts]);u.useEffect(()=>{if(!a||r!=="quick")return;const U=Me=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(Me.key)||(Me.preventDefault(),Me.stopPropagation(),Me.stopImmediatePropagation(),X||w))return;const Xe=N[y],ds=Is(Xe);Me.key==="ArrowLeft"?ds.left?Y(!0):Ke("left"):Me.key==="ArrowRight"?ds.right?Y(!1):Ke("right"):Me.key==="ArrowDown"?yis+1):Me.key==="ArrowUp"&&y>0&&b(is=>is-1)};return window.addEventListener("keydown",U,!0),()=>window.removeEventListener("keydown",U,!0)},[a,r,N,y,X,w,Is,Y,Ke]),u.useEffect(()=>{if(!a||r!=="quick"||w)return;const U=N.length-y-1,Me=N.length{a&&(Zs(),St(),fa())},[a,Zs,St,fa]),u.useEffect(()=>{he(1),Le(new Set)},[G,se]),u.useEffect(()=>{Le(new Set)},[h]);const $e=()=>{Oe(ns),he(1)},ms=U=>de.get(U)||U,os=async(U,Me)=>{try{Ee(ds=>new Set(ds).add(U));const Xe=await Um([{id:U,rejected:Me,require_unchecked:G==="unchecked"}]);Xe.results[0]?.success?(ws({title:Me?"已拒绝":"已通过",description:`表达方式 #${U} ${Me?"已拒绝":"已通过"}`}),St(),Zs()):ws({title:"操作失败",description:Xe.results[0]?.message||"未知错误",variant:"destructive"})}catch(Xe){ws({title:"操作失败",description:Xe instanceof Error?Xe.message:"未知错误",variant:"destructive"})}finally{Ee(Xe=>{const ds=new Set(Xe);return ds.delete(U),ds})}},rs=async U=>{if(Z.size===0){ws({title:"请选择",description:"请先选择要审核的表达方式",variant:"destructive"});return}try{D(!0);const Me=Array.from(Z).map(ds=>({id:ds,rejected:U,require_unchecked:G==="unchecked"})),Xe=await Um(Me);ws({title:"批量审核完成",description:`成功 ${Xe.succeeded} 条,失败 ${Xe.failed} 条`,variant:Xe.failed>0?"destructive":"default"}),Le(new Set),St(),Zs()}catch(Me){ws({title:"批量审核失败",description:Me instanceof Error?Me.message:"未知错误",variant:"destructive"})}finally{D(!1)}},ht=()=>{Z.size===h.length?Le(new Set):Le(new Set(h.map(U=>U.id)))},Tt=U=>{Le(Me=>{const Xe=new Set(Me);return Xe.has(U)?Xe.delete(U):Xe.add(U),Xe})},ca=U=>U?new Date(U*1e3).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"-",ka=U=>U.checked?U.rejected?e.jsxs(ke,{variant:"destructive",className:"gap-1",children:[e.jsx(ta,{className:"h-3 w-3"}),"已拒绝"]}):e.jsxs(ke,{variant:"default",className:"gap-1 bg-green-600",children:[e.jsx(tt,{className:"h-3 w-3"}),"已通过"]}):e.jsxs(ke,{variant:"outline",className:"gap-1",children:[e.jsx(ia,{className:"h-3 w-3"}),"待审核"]}),Pa=U=>U?U==="ai"?e.jsxs(ke,{variant:"secondary",className:"gap-1 text-xs",children:[e.jsx(Kn,{className:"h-3 w-3"}),"AI"]}):e.jsxs(ke,{variant:"secondary",className:"gap-1 text-xs",children:[e.jsx($l,{className:"h-3 w-3"}),"人工"]}):null,Jt=Math.ceil(ue/Te),te=()=>{const U=[];if(Jt<=7)for(let Me=1;Me<=Jt;Me++)U.push(Me);else{U.push(1),_e>3&&U.push("ellipsis");const Me=Math.max(2,_e-1),Xe=Math.min(Jt-1,_e+1);for(let ds=Me;ds<=Xe;ds++)U.push(ds);_e1&&U.push(Jt)}return U},ye=()=>{const U=parseInt($,10);!isNaN(U)&&U>=1&&U<=Jt&&(he(U),z(""))};return e.jsx(Js,{open:a,onOpenChange:l,children:e.jsxs(qs,{className:"max-w-5xl w-[95vw] sm:w-full h-[90vh] sm:h-[85vh] flex flex-col p-0",hideCloseButton:!0,children:[e.jsxs("div",{className:"flex items-end bg-muted/30 px-2 pt-2 shrink-0",children:[e.jsxs("button",{onClick:()=>c("list"),className:F("group relative flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-t-lg transition-all","hover:bg-background/50",r==="list"?"bg-background text-foreground shadow-sm border border-b-0 border-border":"text-muted-foreground hover:text-foreground"),children:[e.jsx(sv,{className:"h-4 w-4"}),e.jsx("span",{children:"列表模式"}),r==="list"&&e.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-background"})]}),e.jsxs("button",{onClick:()=>c("quick"),className:F("group relative flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-t-lg transition-all","hover:bg-background/50",r==="quick"?"bg-background text-foreground shadow-sm border border-b-0 border-border":"text-muted-foreground hover:text-foreground"),children:[e.jsx(el,{className:"h-4 w-4"}),e.jsx("span",{children:"快速审核"}),e.jsx(ke,{variant:"secondary",className:"ml-1 h-5 px-1.5 text-xs",children:"新"}),r==="quick"&&e.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-background"})]}),e.jsx("div",{className:"flex-1 border-b border-border"}),e.jsx("button",{onClick:()=>l(!1),className:"mb-[1px] p-2 text-muted-foreground hover:text-foreground hover:bg-muted rounded-lg transition-colors",children:e.jsx(_a,{className:"h-4 w-4"})})]}),r==="list"&&e.jsxs(e.Fragment,{children:[e.jsxs(Vs,{className:"px-4 sm:px-6 pt-4 sm:pt-6 pb-4 border-b shrink-0",children:[e.jsx(Gs,{className:"text-lg sm:text-xl",children:"表达方式审核"}),e.jsx(nt,{className:"text-xs sm:text-sm",children:"审核麦麦学习到的表达方式。通过审核的项目才会被使用(可在配置中调整),被拒绝的项目永远不会被使用。"}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 sm:gap-3 mt-4",children:[e.jsxs("div",{className:"rounded-lg border p-2 sm:p-3 text-center",children:[e.jsx("div",{className:"text-xl sm:text-2xl font-bold text-orange-500",children:K?"-":d?.unchecked??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"待审核"})]}),e.jsxs("div",{className:"rounded-lg border p-2 sm:p-3 text-center",children:[e.jsx("div",{className:"text-xl sm:text-2xl font-bold text-green-500",children:K?"-":d?.passed??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"已通过"})]}),e.jsxs("div",{className:"rounded-lg border p-2 sm:p-3 text-center",children:[e.jsx("div",{className:"text-xl sm:text-2xl font-bold text-red-500",children:K?"-":d?.rejected??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"已拒绝"})]}),e.jsxs("div",{className:"rounded-lg border p-2 sm:p-3 text-center",children:[e.jsx("div",{className:"text-xl sm:text-2xl font-bold text-blue-500",children:K?"-":d?.total??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"总计"})]})]})]}),e.jsxs("div",{className:"px-4 sm:px-6 py-3 border-b shrink-0 space-y-3",children:[e.jsx(Yt,{value:G,onValueChange:U=>Re(U),className:"w-full",children:e.jsxs(Vt,{className:"grid w-full grid-cols-4",children:[e.jsxs(Ye,{value:"unchecked",className:"gap-1 text-xs sm:text-sm px-1 sm:px-3",children:[e.jsx(ia,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"待审核"}),e.jsx("span",{className:"sm:hidden",children:"待审"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",d?.unchecked??0,")"]})]}),e.jsxs(Ye,{value:"passed",className:"gap-1 text-xs sm:text-sm px-1 sm:px-3",children:[e.jsx(tt,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"已通过"}),e.jsx("span",{className:"sm:hidden",children:"通过"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",d?.passed??0,")"]})]}),e.jsxs(Ye,{value:"rejected",className:"gap-1 text-xs sm:text-sm px-1 sm:px-3",children:[e.jsx(ta,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"已拒绝"}),e.jsx("span",{className:"sm:hidden",children:"拒绝"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",d?.rejected??0,")"]})]}),e.jsxs(Ye,{value:"all",className:"gap-1 text-xs sm:text-sm px-1 sm:px-3",children:[e.jsx("span",{children:"全部"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",d?.total??0,")"]})]})]})}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Ut,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"搜索情景或风格...",value:ns,onChange:U=>J(U.target.value),onKeyDown:U=>U.key==="Enter"&&$e(),className:"pl-9"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"icon",onClick:$e,children:e.jsx(Ut,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"icon",onClick:()=>{St(),Zs()},disabled:pe,children:e.jsx(ut,{className:F("h-4 w-4",pe&&"animate-spin")})})]}),Z.size>0&&e.jsx("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:G==="unchecked"?e.jsxs(e.Fragment,{children:[e.jsxs(_,{variant:"default",size:"sm",className:"bg-green-600 hover:bg-green-700 flex-1 sm:flex-none",onClick:()=>rs(!1),disabled:pe,children:[e.jsx(tt,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"批量通过"}),e.jsx("span",{className:"sm:hidden",children:"通过"}),"(",Z.size,")"]}),e.jsxs(_,{variant:"destructive",size:"sm",className:"flex-1 sm:flex-none",onClick:()=>rs(!0),disabled:pe,children:[e.jsx(ta,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"批量拒绝"}),e.jsx("span",{className:"sm:hidden",children:"拒绝"}),"(",Z.size,")"]})]}):G==="passed"?e.jsxs(_,{variant:"destructive",size:"sm",className:"flex-1 sm:flex-none",onClick:()=>rs(!0),disabled:pe,children:[e.jsx(ta,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"批量改为拒绝"}),e.jsx("span",{className:"sm:hidden",children:"改为拒绝"}),"(",Z.size,")"]}):G==="rejected"?e.jsxs(_,{variant:"default",size:"sm",className:"bg-green-600 hover:bg-green-700 flex-1 sm:flex-none",onClick:()=>rs(!1),disabled:pe,children:[e.jsx(tt,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"批量改为通过"}),e.jsx("span",{className:"sm:hidden",children:"改为通过"}),"(",Z.size,")"]}):e.jsxs(e.Fragment,{children:[e.jsxs(_,{variant:"default",size:"sm",className:"bg-green-600 hover:bg-green-700 flex-1 sm:flex-none",onClick:()=>rs(!1),disabled:pe,children:[e.jsx(tt,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"批量通过"}),e.jsx("span",{className:"sm:hidden",children:"通过"}),"(",Z.size,")"]}),e.jsxs(_,{variant:"destructive",size:"sm",className:"flex-1 sm:flex-none",onClick:()=>rs(!0),disabled:pe,children:[e.jsx(ta,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"批量拒绝"}),e.jsx("span",{className:"sm:hidden",children:"拒绝"}),"(",Z.size,")"]})]})})]})]}),e.jsx(ss,{className:"flex-1 px-4 sm:px-6",children:pe&&h.length===0?e.jsx("div",{className:"flex items-center justify-center h-40",children:e.jsx(ut,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):h.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-40 text-muted-foreground",children:[e.jsx(Rt,{className:"h-8 w-8 mb-2"}),e.jsx("p",{children:"没有找到表达方式"})]}):e.jsxs("div",{className:"space-y-2 py-2",children:[h.length>0&&e.jsxs("div",{className:"flex items-center justify-between py-2 px-3 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(lt,{checked:Z.size===h.length&&h.length>0,onCheckedChange:ht}),e.jsx("span",{className:"text-sm text-muted-foreground",children:Z.size===h.length&&h.length>0?`已全选当前页 (${h.length} 条)`:`全选当前页 (${h.length} 条)`})]}),Z.size>0&&e.jsx(_,{variant:"ghost",size:"sm",onClick:()=>Le(new Set),className:"h-7 text-xs",children:"取消选择"})]}),h.map(U=>e.jsx("div",{className:F("rounded-lg border p-3 sm:p-4 space-y-2 sm:space-y-3 transition-colors",Z.has(U.id)&&"bg-accent border-primary",ae.has(U.id)&&"opacity-50"),children:e.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[e.jsx(lt,{checked:Z.has(U.id),onCheckedChange:()=>Tt(U.id),disabled:ae.has(U.id),className:"mt-1"}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"情景:"}),e.jsx("p",{className:"text-sm font-medium break-words",children:U.situation})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"风格:"}),e.jsx("p",{className:"text-sm text-muted-foreground break-words",children:U.style})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:gap-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:["#",U.id]}),e.jsx("span",{children:"·"}),e.jsx("span",{title:ms(U.chat_id),className:"truncate max-w-24 sm:max-w-32",children:ms(U.chat_id)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:ca(U.create_date)}),e.jsxs("div",{className:"flex items-center gap-1",children:[ka(U),Pa(U.modified_by)]})]})]}),e.jsx("div",{className:"flex flex-col gap-1 sm:gap-2 shrink-0",children:G==="unchecked"?e.jsxs(e.Fragment,{children:[e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>os(U.id,!1),disabled:ae.has(U.id),children:[e.jsx(tt,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"通过"})]}),e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>os(U.id,!0),disabled:ae.has(U.id),children:[e.jsx(ta,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"拒绝"})]})]}):G==="passed"?e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>os(U.id,!0),disabled:ae.has(U.id),children:[e.jsx(ta,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"改为拒绝"})]}):G==="rejected"?e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>os(U.id,!1),disabled:ae.has(U.id),children:[e.jsx(tt,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"改为通过"})]}):e.jsx(e.Fragment,{children:U.rejected?e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>os(U.id,!1),disabled:ae.has(U.id),children:[e.jsx(tt,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"改为通过"})]}):U.checked?e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>os(U.id,!0),disabled:ae.has(U.id),children:[e.jsx(ta,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"改为拒绝"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>os(U.id,!1),disabled:ae.has(U.id),children:[e.jsx(tt,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"通过"})]}),e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>os(U.id,!0),disabled:ae.has(U.id),children:[e.jsx(ta,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"拒绝"})]})]})})})]})},U.id))]})}),e.jsxs("div",{className:"px-4 sm:px-6 py-3 border-t shrink-0 flex flex-col sm:flex-row items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx("span",{className:"hidden sm:inline",children:"每页"}),e.jsxs(Pe,{value:Te.toString(),onValueChange:U=>{V(parseInt(U,10)),he(1)},children:[e.jsx(Be,{className:"w-[70px] h-8",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"10",children:"10"}),e.jsx(ee,{value:"20",children:"20"}),e.jsx(ee,{value:"50",children:"50"}),e.jsx(ee,{value:"100",children:"100"})]})]}),e.jsx("span",{className:"hidden sm:inline",children:"条"}),e.jsxs("span",{className:"text-muted-foreground",children:["共 ",ue," 条"]})]}),e.jsx(ux,{className:"mx-0 w-auto",children:e.jsxs(mx,{children:[e.jsx(Yn,{children:e.jsx(_,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>he(U=>Math.max(1,U-1)),disabled:_e<=1||pe,children:e.jsx(Ia,{className:"h-4 w-4"})})}),te().map((U,Me)=>e.jsx(Yn,{children:U==="ellipsis"?e.jsx(Uv,{}):e.jsx(pc,{href:"#",isActive:U===_e,onClick:Xe=>{Xe.preventDefault(),he(U)},className:"h-8 w-8 cursor-pointer",children:U})},Me)),e.jsx(Yn,{children:e.jsx(_,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>he(U=>Math.min(Jt,U+1)),disabled:_e>=Jt||pe,children:e.jsx(ra,{className:"h-4 w-4"})})})]})}),e.jsxs("div",{className:"hidden sm:flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"跳至"}),e.jsx(ne,{type:"number",min:1,max:Jt,value:$,onChange:U=>z(U.target.value),onKeyDown:U=>U.key==="Enter"&&ye(),className:"w-16 h-8 text-center",placeholder:_e.toString()}),e.jsx("span",{className:"text-muted-foreground",children:"页"}),e.jsx(_,{variant:"outline",size:"sm",className:"h-8",onClick:ye,disabled:pe,children:"跳转"})]})]})]}),r==="quick"&&e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-4 sm:px-6 py-3 border-b shrink-0 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"text-muted-foreground",children:["待审核: ",e.jsx("span",{className:"font-medium text-orange-500",children:d?.unchecked??0})]}),e.jsxs("span",{className:"text-muted-foreground",children:["已通过: ",e.jsx("span",{className:"font-medium text-green-500",children:d?.passed??0})]}),e.jsxs("span",{className:"text-muted-foreground",children:["已拒绝: ",e.jsx("span",{className:"font-medium text-red-500",children:d?.rejected??0})]})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>{xs(),Zs()},disabled:w,children:[e.jsx(ut,{className:F("h-4 w-4 mr-1",w&&"animate-spin")}),"刷新"]})]}),e.jsx(Yt,{value:p,onValueChange:U=>g(U),className:"w-full",children:e.jsxs(Vt,{className:"grid w-full grid-cols-4",children:[e.jsxs(Ye,{value:"unchecked",className:"gap-1 text-xs sm:text-sm",children:[e.jsx(ia,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"待审核"}),e.jsx("span",{className:"sm:hidden",children:"待审"})]}),e.jsxs(Ye,{value:"passed",className:"gap-1 text-xs sm:text-sm",children:[e.jsx(tt,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"已通过"}),e.jsx("span",{className:"sm:hidden",children:"通过"})]}),e.jsxs(Ye,{value:"rejected",className:"gap-1 text-xs sm:text-sm",children:[e.jsx(ta,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"已拒绝"}),e.jsx("span",{className:"sm:hidden",children:"拒绝"})]}),e.jsx(Ye,{value:"all",className:"gap-1 text-xs sm:text-sm",children:"全部"})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-8 relative overflow-hidden",children:w&&N.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center",children:[e.jsx(ut,{className:"h-8 w-8 animate-spin text-muted-foreground mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})]}):N.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[e.jsx("div",{className:"w-20 h-20 rounded-full bg-muted/50 flex items-center justify-center mb-6",children:e.jsx(tt,{className:"h-10 w-10 text-green-500"})}),e.jsx("h3",{className:"text-xl font-semibold mb-2",children:"全部审核完成!"}),e.jsx("p",{className:"text-muted-foreground",children:"当前筛选条件下没有待处理的项目"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"absolute top-4 left-1/2 -translate-x-1/2 text-sm text-muted-foreground z-50",children:[y+1," / ",N.length,M>N.length&&e.jsxs("span",{className:"ml-1",children:["(共 ",M," 条)"]})]}),e.jsx("div",{className:"absolute inset-x-4 top-1/2 -translate-y-1/2 flex justify-between pointer-events-none z-40",children:(()=>{const U=N[y],Me=Is(U);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:F("flex items-center gap-2 px-4 py-2 rounded-lg transition-all duration-300",C==="left"?"bg-red-500/20 text-red-500 scale-110":"bg-muted/50 text-muted-foreground opacity-0",!Me.left&&"invisible"),children:[e.jsx(ta,{className:"h-8 w-8"}),e.jsx("span",{className:"font-bold text-lg hidden sm:inline",children:"拒绝"})]}),e.jsxs("div",{className:F("flex items-center gap-2 px-4 py-2 rounded-lg transition-all duration-300",C==="right"?"bg-green-500/20 text-green-500 scale-110":"bg-muted/50 text-muted-foreground opacity-0",!Me.right&&"invisible"),children:[e.jsx("span",{className:"font-bold text-lg hidden sm:inline",children:"通过"}),e.jsx(tt,{className:"h-8 w-8"})]})]})})()}),e.jsx("div",{className:"relative w-full max-w-md h-[400px] flex items-center justify-center",children:N.slice(y,y+5).reverse().map((U,Me,Xe)=>{const ds=Xe.length-1-Me,is=ds===0;let kt={zIndex:5-ds,position:"absolute",width:"100%",transition:is&&!ge.current?"all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1)":"none"};if(is)kt={...kt,transform:`translateX(${H}px) rotate(${H*.05}deg)`,opacity:Math.max(0,1-Math.abs(H)/500),cursor:"grab"};else{const Ps=Math.min(Math.abs(H)/200,1),le=Xt=>{const ql=Xt*7%5,kn=Xt*13%7;return{scale:1-Xt*.05,translateY:Xt*12,rotate:(Xt%2===0?1:-1)*(Xt*2)+ql,translateX:(Xt%2===0?-1:1)*(Xt*4)+kn}},fe=le(ds),es=le(ds-1),Ss=fe.scale+(es.scale-fe.scale)*Ps,hs=fe.translateY+(es.translateY-fe.translateY)*Ps,yt=fe.rotate+(es.rotate-fe.rotate)*Ps,oa=fe.translateX+(es.translateX-fe.translateX)*Ps;kt={...kt,transform:`translate3d(${oa}px, ${hs}px, 0) scale(${Ss}) rotate(${yt}deg)`,opacity:1-ds*.15,filter:`blur(${Math.max(0,ds*1-Ps)}px)`,pointerEvents:"none"}}return e.jsxs("div",{ref:is?je:void 0,className:F("bg-card border rounded-xl shadow-xl p-6 select-none h-full flex flex-col",is&&"active:cursor-grabbing shadow-2xl ring-1 ring-border/50",is&&me===U.id&&"ring-4 ring-orange-500/50 bg-orange-50/10"),style:kt,onMouseDown:is?He:void 0,onMouseMove:is?zs:void 0,onMouseUp:is?Ls:void 0,onMouseLeave:is?Ks:void 0,onTouchStart:is?cs:void 0,onTouchMove:is?ts:void 0,onTouchEnd:is?_s:void 0,children:[is&&me===U.id&&e.jsxs("div",{className:"absolute inset-0 z-50 flex flex-col items-center justify-center bg-background/80 backdrop-blur-sm animate-in fade-in duration-300 rounded-xl",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 bg-orange-500/20 rounded-full animate-ping"}),e.jsx(ut,{className:"relative h-16 w-16 text-orange-500 mb-4 animate-spin duration-1000"})]}),e.jsx("h3",{className:"text-xl font-bold text-foreground animate-in slide-in-from-bottom-2 fade-in duration-500",children:"数据已更新"}),e.jsx("p",{className:"text-muted-foreground mt-2 animate-in slide-in-from-bottom-3 fade-in duration-700",children:"后台任务已处理此条目"})]}),is&&e.jsx("div",{className:F("absolute inset-0 flex items-center justify-center z-20 pointer-events-none transition-opacity duration-200",H<-10&&!Is(U).left||H>10&&!Is(U).right?"opacity-100":"opacity-0"),children:e.jsx("div",{className:"bg-background/80 backdrop-blur-sm p-4 rounded-full shadow-lg border border-border",children:e.jsx(tv,{className:"h-12 w-12 text-muted-foreground"})})}),e.jsxs("div",{className:"space-y-4 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm text-muted-foreground font-mono",children:["#",U.id]}),e.jsxs("div",{className:"flex items-center gap-2",children:[ka(U),Pa(U.modified_by)]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"情景"}),e.jsx("div",{className:"p-3 bg-muted/30 rounded-lg border border-border/50",children:e.jsx("p",{className:"text-lg font-medium leading-relaxed",children:U.situation})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"风格"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:U.style.split(/[,,]/).map((Ps,le)=>e.jsx(ke,{variant:"secondary",className:"font-normal",children:Ps.trim()},le))})]})]}),e.jsxs("div",{className:"mt-auto pt-4 border-t flex items-center justify-between text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-6 h-6 rounded-full bg-primary/10 flex items-center justify-center text-primary",children:e.jsx($l,{className:"h-3 w-3"})}),e.jsx("span",{title:ms(U.chat_id),className:"truncate max-w-[120px] font-medium",children:ms(U.chat_id)})]}),e.jsx("span",{className:"font-mono",children:ca(U.create_date)})]})]},U.id)})}),e.jsx("div",{className:"flex items-center gap-8 mt-8 sm:hidden z-50",children:(()=>{const U=N[y],Me=Is(U);return e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"lg",className:F("w-16 h-16 rounded-full border-2 shadow-lg transition-all active:scale-95",Me.left?"hover:bg-red-50 hover:text-red-600 hover:border-red-200":"opacity-30 cursor-not-allowed"),onClick:()=>Me.left&&Y(!0),disabled:!Me.left||X,children:e.jsx(ta,{className:"h-8 w-8"})}),e.jsx(_,{variant:"outline",size:"lg",className:F("w-16 h-16 rounded-full border-2 shadow-lg transition-all active:scale-95",Me.right?"hover:bg-green-50 hover:text-green-600 hover:border-green-200":"opacity-30 cursor-not-allowed"),onClick:()=>Me.right&&Y(!1),disabled:!Me.right||X,children:e.jsx(tt,{className:"h-8 w-8"})})]})})()})]})}),e.jsxs("div",{className:"hidden sm:flex items-center justify-center gap-6 px-6 py-3 border-t text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-2 py-1 bg-muted rounded text-xs",children:"←"}),e.jsx("span",{children:"拒绝"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-2 py-1 bg-muted rounded text-xs",children:"→"}),e.jsx("span",{children:"通过"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-2 py-1 bg-muted rounded text-xs",children:"↑"}),e.jsx("span",{children:"上一条"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-2 py-1 bg-muted rounded text-xs",children:"↓"}),e.jsx("span",{children:"下一条"})]}),e.jsx("span",{className:"text-muted-foreground/50",children:"|"}),e.jsx("span",{children:"拖拽卡片滑动审核"})]})]})]})})}function l2(){return e.jsx(tr,{children:e.jsx(r2,{})})}const n2=a=>{const l=[];for(let r=0;r(H.current=!0,()=>{H.current=!1,O.current&&(clearInterval(O.current),O.current=null)}),[]);const X=u.useCallback(async()=>{try{const z=await hx();H.current&&E(z.unchecked)}catch(z){console.error("获取审核统计失败:",z)}},[]),L=u.useCallback(async()=>{try{b(!0);const z=await dw.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");H.current&&j({hitokoto:z.data.hitokoto,from:z.data.from||z.data.from_who||"未知"})}catch(z){console.error("获取一言失败:",z),H.current&&j({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{H.current&&b(!1)}},[]),me=u.useCallback(async()=>{try{const z=await Se("/api/webui/system/status");if(!H.current)return;if(z.ok){const G=await z.json();A(G)}else A(null)}catch(z){console.error("获取机器人状态失败:",z),H.current&&A(null)}},[]),Ne=async()=>{await C()},je=u.useCallback(async()=>{try{const z=await Se(`/api/webui/statistics/dashboard?hours=${h}`);if(!H.current)return;if(z.ok){const G=await z.json();l(G)}c(!1),m(100)}catch(z){console.error("Failed to fetch dashboard data:",z),H.current&&(c(!1),m(100))}},[h]);if(u.useEffect(()=>{if(!r)return;m(0);const z=setTimeout(()=>m(15),200),G=setTimeout(()=>m(30),800),Re=setTimeout(()=>m(45),2e3),se=setTimeout(()=>m(60),4e3),Oe=setTimeout(()=>m(75),6500),ns=setTimeout(()=>m(85),9e3),J=setTimeout(()=>m(92),11e3);return()=>{clearTimeout(z),clearTimeout(G),clearTimeout(Re),clearTimeout(se),clearTimeout(Oe),clearTimeout(ns),clearTimeout(J)}},[r]),u.useEffect(()=>{je(),L(),me(),X()},[je,L,me,X]),u.useEffect(()=>{if(O.current&&(clearInterval(O.current),O.current=null),!!p)return O.current=setInterval(()=>{H.current&&(je(),me())},3e4),()=>{O.current&&(clearInterval(O.current),O.current=null)}},[p,je,me]),r||!a)return e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:e.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[e.jsx(ut,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(er,{value:d,className:"h-2"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[d,"%"]})]})]})});const{summary:ce,model_stats:ge=[],hourly_data:pe=[],daily_data:D=[],recent_activity:K=[]}=a,B=ce??{total_requests:0,total_cost:0,total_tokens:0,online_time:0,total_messages:0,total_replies:0,avg_response_time:0,cost_per_hour:0,tokens_per_hour:0},ue=z=>{const G=Math.floor(z/3600),Re=Math.floor(z%3600/60);return`${G}小时${Re}分钟`},Q=z=>{const G=z.toLocaleString("zh-CN");return z>=1e9?{display:`${(z/1e9).toFixed(2)}B`,exact:G,needsExact:!0}:z>=1e6?{display:`${(z/1e6).toFixed(2)}M`,exact:G,needsExact:!0}:z>=1e4?{display:`${(z/1e3).toFixed(1)}K`,exact:G,needsExact:!0}:z>=1e3?{display:`${(z/1e3).toFixed(2)}K`,exact:G,needsExact:!0}:{display:G,exact:G,needsExact:!1}},_e=z=>{const G=`¥${z.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})}`;return z>=1e6?{display:`¥${(z/1e6).toFixed(2)}M`,exact:G,needsExact:!0}:z>=1e4?{display:`¥${(z/1e3).toFixed(1)}K`,exact:G,needsExact:!0}:z>=1e3?{display:`¥${(z/1e3).toFixed(2)}K`,exact:G,needsExact:!0}:{display:G,exact:G,needsExact:!1}},he=z=>new Date(z).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),Te=n2(ge.length),V=ge.map((z,G)=>({name:z.model_name,value:z.request_count,fill:Te[G]})),$={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return e.jsx(ss,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(Yt,{value:h.toString(),onValueChange:z=>f(Number(z)),children:e.jsxs(Vt,{className:"grid grid-cols-3 w-full sm:w-auto",children:[e.jsx(Ye,{value:"24",children:"24小时"}),e.jsx(Ye,{value:"168",children:"7天"}),e.jsx(Ye,{value:"720",children:"30天"})]})}),e.jsxs(_,{variant:p?"default":"outline",size:"sm",onClick:()=>g(!p),className:"gap-2",children:[e.jsx(ut,{className:`h-4 w-4 ${p?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:je,children:e.jsx(ut,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 rounded-lg border border-dashed border-muted-foreground/30 bg-muted/20",children:[y?e.jsx(As,{className:"h-5 flex-1"}):N?e.jsxs("p",{className:"flex-1 text-sm text-muted-foreground italic truncate",children:['"',N.hitokoto,'" —— ',N.from]}):null,e.jsx(_,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:L,disabled:y,children:e.jsx(ut,{className:`h-3.5 w-3.5 ${y?"animate-spin":""}`})})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-3",children:[e.jsxs(Ce,{className:"lg:col-span-1",children:[e.jsx(De,{className:"pb-3",children:e.jsxs(Ue,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(hc,{className:"h-4 w-4"}),"麦麦状态"]})}),e.jsx(Ae,{children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex items-center gap-2",children:w?.running?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-green-500 animate-pulse"}),e.jsxs(ke,{variant:"outline",className:"text-green-600 border-green-300 bg-green-50",children:[e.jsx(tt,{className:"h-3 w-3 mr-1"}),"运行中"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-red-500"}),e.jsxs(ke,{variant:"outline",className:"text-red-600 border-red-300 bg-red-50",children:[e.jsx(Rt,{className:"h-3 w-3 mr-1"}),"已停止"]})]})}),w&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.jsxs("span",{children:["v",w.version]}),e.jsx("span",{className:"mx-2",children:"|"}),e.jsxs("span",{children:["运行 ",ue(w.uptime)]})]})]})})]}),e.jsxs(Ce,{children:[e.jsx(De,{className:"pb-3",children:e.jsxs(Ue,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(el,{className:"h-4 w-4"}),"快速操作"]})}),e.jsx(Ae,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:Ne,disabled:R,className:"gap-2",children:[e.jsx(lc,{className:`h-4 w-4 ${R?"animate-spin":""}`}),R?"重启中...":"重启麦麦"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>S(!0),className:"gap-2",children:[e.jsx(av,{className:"h-4 w-4"}),"表达审核",P>0&&e.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-xs rounded-full bg-orange-500 text-white",children:P>99?"99+":P})]}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Vn,{to:"/logs",children:[e.jsx(La,{className:"h-4 w-4"}),"查看日志"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Vn,{to:"/plugins",children:[e.jsx(w1,{className:"h-4 w-4"}),"插件管理"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Vn,{to:"/settings",children:[e.jsx(bn,{className:"h-4 w-4"}),"系统设置"]})})]})})]}),e.jsxs(Ce,{children:[e.jsxs(De,{className:"pb-3",children:[e.jsxs(Ue,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(_1,{className:"h-4 w-4"}),"反馈问卷"]}),e.jsx(fs,{className:"text-xs",children:"帮助我们改进产品体验"})]}),e.jsx(Ae,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Vn,{to:"/survey/webui-feedback",children:[e.jsx(La,{className:"h-4 w-4"}),"WebUI 反馈"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Vn,{to:"/survey/maibot-feedback",children:[e.jsx(Ba,{className:"h-4 w-4"}),"麦麦反馈"]})})]})})]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[e.jsxs(Ce,{children:[e.jsxs(De,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"总请求数"}),e.jsx(ax,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ae,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[Q(B.total_requests).display,Q(B.total_requests).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",Q(B.total_requests).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",h<48?h+"小时":Math.floor(h/24)+"天"]})]})]}),e.jsxs(Ce,{children:[e.jsxs(De,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"总花费"}),e.jsx(S1,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ae,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[_e(B.total_cost).display,_e(B.total_cost).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",_e(B.total_cost).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:B.cost_per_hour>0?`¥${B.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),e.jsxs(Ce,{children:[e.jsxs(De,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"Token消耗"}),e.jsx(Jr,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ae,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[Q(B.total_tokens).display,Q(B.total_tokens).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",Q(B.total_tokens).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:B.tokens_per_hour>0?`${Q(B.tokens_per_hour).display}/小时`:"暂无数据"})]})]}),e.jsxs(Ce,{children:[e.jsxs(De,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"平均响应"}),e.jsx(el,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ae,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[B.avg_response_time.toFixed(2),"s"]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[e.jsxs(Ce,{children:[e.jsxs(De,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"在线时长"}),e.jsx(ia,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Ae,{children:e.jsxs("div",{className:"text-xl font-bold",children:[ue(B.online_time),e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",B.online_time.toLocaleString(),"秒)"]})]})})]}),e.jsxs(Ce,{children:[e.jsxs(De,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"消息处理"}),e.jsx(Ba,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ae,{children:[e.jsxs("div",{className:"text-xl font-bold",children:[Q(B.total_messages).display,Q(B.total_messages).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",Q(B.total_messages).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",Q(B.total_replies).display,Q(B.total_replies).needsExact&&e.jsxs("span",{children:["(",Q(B.total_replies).exact,")"]})," 条"]})]})]}),e.jsxs(Ce,{children:[e.jsxs(De,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"成本效率"}),e.jsx(lx,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ae,{children:[e.jsx("div",{className:"text-xl font-bold",children:B.total_messages>0?`¥${(B.total_cost/B.total_messages*100).toFixed(2)}`:"¥0.00"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),e.jsxs(Yt,{defaultValue:"trends",className:"space-y-4",children:[e.jsxs(Vt,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[e.jsx(Ye,{value:"trends",children:"趋势"}),e.jsx(Ye,{value:"models",children:"模型"}),e.jsx(Ye,{value:"activity",children:"活动"}),e.jsx(Ye,{value:"daily",children:"日统计"})]}),e.jsxs(Ms,{value:"trends",className:"space-y-4",children:[e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Ue,{children:"请求趋势"}),e.jsxs(fs,{children:["最近",h,"小时的请求量变化"]})]}),e.jsx(Ae,{children:e.jsx(Vr,{config:$,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(Qw,{data:pe,children:[e.jsx(Qi,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Yi,{dataKey:"timestamp",tickFormatter:z=>he(z),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(qr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Gi,{content:e.jsx(Gr,{labelFormatter:z=>he(z)})}),e.jsx(Yw,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Ue,{children:"花费趋势"}),e.jsx(fs,{children:"API调用成本变化"})]}),e.jsx(Ae,{children:e.jsx(Vr,{config:$,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(Uo,{data:pe,children:[e.jsx(Qi,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Yi,{dataKey:"timestamp",tickFormatter:z=>he(z),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(qr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Gi,{content:e.jsx(Gr,{labelFormatter:z=>he(z)})}),e.jsx(Ji,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Ue,{children:"Token消耗"}),e.jsx(fs,{children:"Token使用量变化"})]}),e.jsx(Ae,{children:e.jsx(Vr,{config:$,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(Uo,{data:pe,children:[e.jsx(Qi,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Yi,{dataKey:"timestamp",tickFormatter:z=>he(z),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(qr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Gi,{content:e.jsx(Gr,{labelFormatter:z=>he(z)})}),e.jsx(Ji,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),e.jsx(Ms,{value:"models",className:"space-y-4",children:e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Ue,{children:"模型请求分布"}),e.jsxs(fs,{children:["各模型使用占比 (共 ",ge.length," 个模型)"]})]}),e.jsx(Ae,{children:e.jsx(Vr,{config:Object.fromEntries(ge.map((z,G)=>[z.model_name,{label:z.model_name,color:Te[G]}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(Jw,{children:[e.jsx(Gi,{content:e.jsx(Gr,{})}),e.jsx(Xw,{data:V,cx:"50%",cy:"50%",labelLine:!1,label:({name:z,percent:G})=>G&&G<.05?"":`${z} ${G?(G*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:V.map((z,G)=>e.jsx(Zw,{fill:z.fill},`cell-${G}`))})]})})})]}),e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Ue,{children:"模型详细统计"}),e.jsx(fs,{children:"请求数、花费和性能"})]}),e.jsx(Ae,{children:e.jsx(ss,{className:"h-[300px] sm:h-[400px]",children:e.jsx("div",{className:"space-y-3",children:ge.map((z,G)=>e.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:z.model_name}),e.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${G%5+1}))`}})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),e.jsx("span",{className:"ml-1 font-medium",children:z.request_count.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1 font-medium",children:["¥",z.total_cost.toFixed(2)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),e.jsxs("span",{className:"ml-1 font-medium",children:[(z.total_tokens/1e3).toFixed(1),"K"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),e.jsxs("span",{className:"ml-1 font-medium",children:[z.avg_response_time.toFixed(2),"s"]})]})]})]},G))})})})]})]})}),e.jsx(Ms,{value:"activity",children:e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Ue,{children:"最近活动"}),e.jsx(fs,{children:"最新的API调用记录"})]}),e.jsx(Ae,{children:e.jsx(ss,{className:"h-[400px] sm:h-[500px]",children:e.jsx("div",{className:"space-y-2",children:K.map((z,G)=>e.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm truncate",children:z.model}),e.jsx("div",{className:"text-xs text-muted-foreground",children:z.request_type})]}),e.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:he(z.timestamp)})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),e.jsx("span",{className:"ml-1",children:z.tokens})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1",children:["¥",z.cost.toFixed(4)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),e.jsxs("span",{className:"ml-1",children:[z.time_cost.toFixed(2),"s"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"状态:"}),e.jsx("span",{className:`ml-1 ${z.status==="success"?"text-green-600":"text-red-600"}`,children:z.status})]})]})]},G))})})})]})}),e.jsx(Ms,{value:"daily",children:e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Ue,{children:"每日统计"}),e.jsx(fs,{children:"最近7天的数据汇总"})]}),e.jsx(Ae,{children:e.jsx(Vr,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:e.jsxs(Uo,{data:D,children:[e.jsx(Qi,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Yi,{dataKey:"timestamp",tickFormatter:z=>{const G=new Date(z);return`${G.getMonth()+1}/${G.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(qr,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(qr,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Gi,{content:e.jsx(Gr,{labelFormatter:z=>new Date(z).toLocaleDateString("zh-CN")})}),e.jsx(L_,{content:e.jsx(Ev,{})}),e.jsx(Ji,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),e.jsx(Ji,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),e.jsx(ar,{}),e.jsx($v,{open:M,onOpenChange:z=>{S(z),z||X()}})]})})}const i2={theme:"system",setTheme:()=>null},Bv=u.createContext(i2),fx=()=>{const a=u.useContext(Bv);if(a===void 0)throw new Error("useTheme must be used within a ThemeProvider");return a},c2=(a,l,r)=>{const c=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||c){l(a);return}const d=r.clientX,m=r.clientY,h=Math.hypot(Math.max(d,innerWidth-d),Math.max(m,innerHeight-m));document.startViewTransition(()=>{l(a)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${d}px ${m}px)`,`circle(${h}px at ${d}px ${m}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},Iv=u.createContext(void 0),Pv=()=>{const a=u.useContext(Iv);if(a===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return a},Ge=u.forwardRef(({className:a,...l},r)=>e.jsx(fj,{className:F("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",a),...l,ref:r,children:e.jsx(pw,{className:F("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Ge.displayName=fj.displayName;const o2=ei("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),T=u.forwardRef(({className:a,...l},r)=>e.jsx(Gj,{ref:r,className:F(o2(),a),...l}));T.displayName=Gj.displayName;const d2=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:a=>a.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:a=>/[A-Z]/.test(a)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:a=>/[a-z]/.test(a)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:a=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(a)}];function u2(a){const l=d2.map(c=>({id:c.id,label:c.label,description:c.description,passed:c.validate(a)}));return{isValid:l.every(c=>c.passed),rules:l}}const od="0.12.2",px="MaiBot Dashboard",m2=`${px} v${od}`,x2=(a="v")=>`${a}${od}`,ya={THEME:"maibot-ui-theme",ACCENT_COLOR:"accent-color",ENABLE_ANIMATIONS:"maibot-animations",ENABLE_WAVES_BACKGROUND:"maibot-waves-background",LOG_CACHE_SIZE:"maibot-log-cache-size",LOG_AUTO_SCROLL:"maibot-log-auto-scroll",LOG_FONT_SIZE:"maibot-log-font-size",LOG_LINE_SPACING:"maibot-log-line-spacing",DATA_SYNC_INTERVAL:"maibot-data-sync-interval",WS_RECONNECT_INTERVAL:"maibot-ws-reconnect-interval",WS_MAX_RECONNECT_ATTEMPTS:"maibot-ws-max-reconnect-attempts",COMPLETED_TOURS:"maibot-completed-tours"},xl={theme:"system",accentColor:"blue",enableAnimations:!0,enableWavesBackground:!0,logCacheSize:1e3,logAutoScroll:!0,logFontSize:"xs",logLineSpacing:4,dataSyncInterval:30,wsReconnectInterval:3e3,wsMaxReconnectAttempts:10};function zt(a){const l=Fv(a),r=localStorage.getItem(l);if(r===null)return xl[a];const c=xl[a];if(typeof c=="boolean")return r==="true";if(typeof c=="number"){const d=parseFloat(r);return isNaN(d)?c:d}return r}function Kr(a,l){const r=Fv(a);localStorage.setItem(r,String(l)),window.dispatchEvent(new CustomEvent("maibot-settings-change",{detail:{key:a,value:l}}))}function h2(){return{theme:zt("theme"),accentColor:zt("accentColor"),enableAnimations:zt("enableAnimations"),enableWavesBackground:zt("enableWavesBackground"),logCacheSize:zt("logCacheSize"),logAutoScroll:zt("logAutoScroll"),logFontSize:zt("logFontSize"),logLineSpacing:zt("logLineSpacing"),dataSyncInterval:zt("dataSyncInterval"),wsReconnectInterval:zt("wsReconnectInterval"),wsMaxReconnectAttempts:zt("wsMaxReconnectAttempts")}}function f2(){const a=h2(),l=localStorage.getItem(ya.COMPLETED_TOURS),r=l?JSON.parse(l):[];return{...a,completedTours:r}}function p2(a){const l=[],r=[];for(const[c,d]of Object.entries(a)){if(c==="completedTours"){Array.isArray(d)?(localStorage.setItem(ya.COMPLETED_TOURS,JSON.stringify(d)),l.push("completedTours")):r.push("completedTours");continue}if(c in xl){const m=c,h=xl[m];if(typeof d==typeof h){if(m==="theme"&&!["light","dark","system"].includes(d)){r.push(c);continue}if(m==="logFontSize"&&!["xs","sm","base"].includes(d)){r.push(c);continue}Kr(m,d),l.push(c)}else r.push(c)}else r.push(c)}return{success:l.length>0,imported:l,skipped:r}}function g2(){for(const a of Object.keys(xl))Kr(a,xl[a]);localStorage.removeItem(ya.COMPLETED_TOURS),window.dispatchEvent(new CustomEvent("maibot-settings-reset"))}function j2(){const a=[],l=[],r=[];for(let c=0;cc.size-r.size),{used:a,items:localStorage.length,details:l}}function v2(a){if(a===0)return"0 B";const l=1024,r=["B","KB","MB"],c=Math.floor(Math.log(a)/Math.log(l));return parseFloat((a/Math.pow(l,c)).toFixed(2))+" "+r[c]}function Fv(a){return{theme:ya.THEME,accentColor:ya.ACCENT_COLOR,enableAnimations:ya.ENABLE_ANIMATIONS,enableWavesBackground:ya.ENABLE_WAVES_BACKGROUND,logCacheSize:ya.LOG_CACHE_SIZE,logAutoScroll:ya.LOG_AUTO_SCROLL,logFontSize:ya.LOG_FONT_SIZE,logLineSpacing:ya.LOG_LINE_SPACING,dataSyncInterval:ya.DATA_SYNC_INTERVAL,wsReconnectInterval:ya.WS_RECONNECT_INTERVAL,wsMaxReconnectAttempts:ya.WS_MAX_RECONNECT_ATTEMPTS}[a]}const Wa=u.forwardRef(({className:a,...l},r)=>e.jsxs(pj,{ref:r,className:F("relative flex w-full touch-none select-none items-center",a),...l,children:[e.jsx(gw,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:e.jsx(jw,{className:"absolute h-full bg-primary"})}),e.jsx(vw,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));Wa.displayName=pj.displayName;class N2{ws=null;reconnectTimeout=null;reconnectAttempts=0;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];getMaxCacheSize(){return zt("logCacheSize")}getMaxReconnectAttempts(){return zt("wsMaxReconnectAttempts")}getReconnectInterval(){return zt("wsReconnectInterval")}getWebSocketUrl(l){let r;{const c=window.location.protocol==="https:"?"wss:":"ws:",d=window.location.host;r=`${c}//${d}/ws/logs`}return l?`${r}?token=${encodeURIComponent(l)}`:r}async getWsToken(){try{const l=await Se("/api/webui/ws-token",{method:"GET",credentials:"include"});if(!l.ok)return console.error("获取 WebSocket token 失败:",l.status),null;const r=await l.json();return r.success&&r.token?r.token:null}catch(l){return console.error("获取 WebSocket token 失败:",l),null}}async connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;if(window.location.pathname==="/auth"){console.log("📡 在登录页面,跳过 WebSocket 连接");return}if(!await cc()){console.log("📡 未登录,跳过 WebSocket 连接");return}const r=await this.getWsToken();if(!r){console.log("📡 无法获取 WebSocket token,跳过连接");return}const c=this.getWebSocketUrl(r);try{this.ws=new WebSocket(c),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=d=>{try{if(d.data==="pong")return;const m=JSON.parse(d.data);this.notifyLog(m)}catch(m){console.error("解析日志消息失败:",m)}},this.ws.onerror=d=>{console.error("❌ WebSocket 错误:",d),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(d){console.error("创建 WebSocket 连接失败:",d),this.attemptReconnect()}}attemptReconnect(){const l=this.getMaxReconnectAttempts();if(this.reconnectAttempts>=l)return;this.reconnectAttempts+=1;const r=this.getReconnectInterval(),c=Math.min(r*this.reconnectAttempts,3e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},c)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(l){return this.logCallbacks.add(l),()=>this.logCallbacks.delete(l)}onConnectionChange(l){return this.connectionCallbacks.add(l),l(this.isConnected),()=>this.connectionCallbacks.delete(l)}notifyLog(l){if(!this.logCache.some(c=>c.id===l.id)){this.logCache.push(l);const c=this.getMaxCacheSize();this.logCache.length>c&&(this.logCache=this.logCache.slice(-c)),this.logCallbacks.forEach(d=>{try{d(l)}catch(m){console.error("日志回调执行失败:",m)}})}}notifyConnection(l){this.connectionCallbacks.forEach(r=>{try{r(l)}catch(c){console.error("连接状态回调执行失败:",c)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const Gn=new N2;typeof window<"u"&&setTimeout(()=>{Gn.connect()},100);const Cs=bw,_t=yw,b2=Nw,Hv=u.forwardRef(({className:a,...l},r)=>e.jsx(gj,{className:F("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...l,ref:r}));Hv.displayName=gj.displayName;const ps=u.forwardRef(({className:a,...l},r)=>e.jsxs(b2,{children:[e.jsx(Hv,{}),e.jsx(jj,{ref:r,className:F("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...l})]}));ps.displayName=jj.displayName;const gs=({className:a,...l})=>e.jsx("div",{className:F("flex flex-col space-y-2 text-center sm:text-left",a),...l});gs.displayName="AlertDialogHeader";const js=({className:a,...l})=>e.jsx("div",{className:F("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...l});js.displayName="AlertDialogFooter";const vs=u.forwardRef(({className:a,...l},r)=>e.jsx(vj,{ref:r,className:F("text-lg font-semibold",a),...l}));vs.displayName=vj.displayName;const Ns=u.forwardRef(({className:a,...l},r)=>e.jsx(Nj,{ref:r,className:F("text-sm text-muted-foreground",a),...l}));Ns.displayName=Nj.displayName;const bs=u.forwardRef(({className:a,variant:l,...r},c)=>e.jsx(bj,{ref:c,className:F(Wr({variant:l}),a),...r}));bs.displayName=bj.displayName;const ys=u.forwardRef(({className:a,...l},r)=>e.jsx(yj,{ref:r,className:F(Wr({variant:"outline"}),"mt-2 sm:mt-0",a),...l}));ys.displayName=yj.displayName;function y2(){return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),e.jsxs(Yt,{defaultValue:"appearance",className:"w-full",children:[e.jsxs(Vt,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[e.jsxs(Ye,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(k1,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"外观"})]}),e.jsxs(Ye,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(lv,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"安全"})]}),e.jsxs(Ye,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(bn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"其他"})]}),e.jsxs(Ye,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(Qt,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"关于"})]})]}),e.jsxs(ss,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[e.jsx(Ms,{value:"appearance",className:"mt-0",children:e.jsx(w2,{})}),e.jsx(Ms,{value:"security",className:"mt-0",children:e.jsx(_2,{})}),e.jsx(Ms,{value:"other",className:"mt-0",children:e.jsx(S2,{})}),e.jsx(Ms,{value:"about",className:"mt-0",children:e.jsx(k2,{})})]})]})]})}function Og(a){const l=document.documentElement,c={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[a];if(c)l.style.setProperty("--primary",c.hsl),c.gradient?(l.style.setProperty("--primary-gradient",c.gradient),l.classList.add("has-gradient")):(l.style.removeProperty("--primary-gradient"),l.classList.remove("has-gradient"));else if(a.startsWith("#")){const d=m=>{m=m.replace("#","");const h=parseInt(m.substring(0,2),16)/255,f=parseInt(m.substring(2,4),16)/255,p=parseInt(m.substring(4,6),16)/255,g=Math.max(h,f,p),N=Math.min(h,f,p);let j=0,y=0;const b=(g+N)/2;if(g!==N){const w=g-N;switch(y=b>.5?w/(2-g-N):w/(g+N),g){case h:j=((f-p)/w+(flocalStorage.getItem("accent-color")||"blue");u.useEffect(()=>{const g=localStorage.getItem("accent-color")||"blue";Og(g)},[]);const p=g=>{f(g),localStorage.setItem("accent-color",g),Og(g)};return e.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[e.jsx($m,{value:"light",current:a,onChange:l,label:"浅色",description:"始终使用浅色主题"}),e.jsx($m,{value:"dark",current:a,onChange:l,label:"深色",description:"始终使用深色主题"}),e.jsx($m,{value:"system",current:a,onChange:l,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),e.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[e.jsx(Za,{value:"blue",current:h,onChange:p,label:"蓝色",colorClass:"bg-blue-500"}),e.jsx(Za,{value:"purple",current:h,onChange:p,label:"紫色",colorClass:"bg-purple-500"}),e.jsx(Za,{value:"green",current:h,onChange:p,label:"绿色",colorClass:"bg-green-500"}),e.jsx(Za,{value:"orange",current:h,onChange:p,label:"橙色",colorClass:"bg-orange-500"}),e.jsx(Za,{value:"pink",current:h,onChange:p,label:"粉色",colorClass:"bg-pink-500"}),e.jsx(Za,{value:"red",current:h,onChange:p,label:"红色",colorClass:"bg-red-500"})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),e.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[e.jsx(Za,{value:"gradient-sunset",current:h,onChange:p,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),e.jsx(Za,{value:"gradient-ocean",current:h,onChange:p,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),e.jsx(Za,{value:"gradient-forest",current:h,onChange:p,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),e.jsx(Za,{value:"gradient-aurora",current:h,onChange:p,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),e.jsx(Za,{value:"gradient-fire",current:h,onChange:p,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),e.jsx(Za,{value:"gradient-twilight",current:h,onChange:p,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex-1",children:e.jsx("input",{type:"color",value:h.startsWith("#")?h:"#3b82f6",onChange:g=>p(g.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),e.jsx("div",{className:"flex-1",children:e.jsx(ne,{type:"text",value:h,onChange:g=>p(g.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),e.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),e.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[e.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5 flex-1",children:[e.jsx(T,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),e.jsx(Ge,{id:"animations",checked:r,onCheckedChange:c})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5 flex-1",children:[e.jsx(T,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),e.jsx(Ge,{id:"waves-background",checked:d,onCheckedChange:m})]})})]})]})]})}function _2(){const a=xa(),[l,r]=u.useState(""),[c,d]=u.useState(""),[m,h]=u.useState(!1),[f,p]=u.useState(!1),[g,N]=u.useState(!1),[j,y]=u.useState(!1),[b,w]=u.useState(!1),[A,M]=u.useState(!1),[S,P]=u.useState(""),[E,C]=u.useState(!1),{toast:R}=it(),H=u.useMemo(()=>u2(c),[c]),O=async ce=>{if(!l){R({title:"无法复制",description:"Token 存储在安全 Cookie 中,请重新生成以获取新 Token",variant:"destructive"});return}try{await navigator.clipboard.writeText(ce),w(!0),R({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>w(!1),2e3)}catch{R({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},X=async()=>{if(!c.trim()){R({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!H.isValid){const ce=H.rules.filter(ge=>!ge.passed).map(ge=>ge.label).join(", ");R({title:"格式错误",description:`Token 不符合要求: ${ce}`,variant:"destructive"});return}N(!0);try{const ce=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({new_token:c.trim()})}),ge=await ce.json();ce.ok&&ge.success?(d(""),r(c.trim()),R({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{a({to:"/auth"})},1500)):R({title:"更新失败",description:ge.message||"无法更新 Token",variant:"destructive"})}catch(ce){console.error("更新 Token 错误:",ce),R({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{N(!1)}},L=async()=>{y(!0);try{const ce=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"}),ge=await ce.json();ce.ok&&ge.success?(r(ge.token),P(ge.token),M(!0),C(!1),R({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):R({title:"生成失败",description:ge.message||"无法生成新 Token",variant:"destructive"})}catch(ce){console.error("生成 Token 错误:",ce),R({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{y(!1)}},me=async()=>{try{await navigator.clipboard.writeText(S),C(!0),R({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{R({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},Ne=()=>{M(!1),setTimeout(()=>{P(""),C(!1)},300),setTimeout(()=>{a({to:"/auth"})},500)},je=ce=>{ce||Ne()};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(Js,{open:A,onOpenChange:je,children:e.jsxs(qs,{className:"sm:max-w-md",children:[e.jsxs(Vs,{children:[e.jsxs(Gs,{className:"flex items-center gap-2",children:[e.jsx(qt,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),e.jsx(nt,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[e.jsx(T,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),e.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:S})]}),e.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(qt,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[e.jsx("p",{className:"font-semibold",children:"重要提示"}),e.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[e.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),e.jsx("li",{children:"请立即复制并保存到安全的位置"}),e.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),e.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),e.jsxs(xt,{className:"gap-2 sm:gap-0",children:[e.jsx(_,{variant:"outline",onClick:me,className:"gap-2",children:E?e.jsxs(e.Fragment,{children:[e.jsx(Lt,{className:"h-4 w-4 text-green-500"}),"已复制"]}):e.jsxs(e.Fragment,{children:[e.jsx(Fo,{className:"h-4 w-4"}),"复制 Token"]})}),e.jsx(_,{onClick:Ne,children:"我已保存,关闭"})]})]})}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),e.jsx("div",{className:"space-y-3 sm:space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ne,{id:"current-token",type:m?"text":"password",value:l||"••••••••••••••••••••••••••••••••",readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"Token 存储在安全 Cookie 中"}),e.jsx("button",{onClick:()=>{l?h(!m):R({title:"无法查看",description:'Token 存储在安全 Cookie 中,如需新 Token 请点击"重新生成"'})},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:m?"隐藏":"显示",children:m?e.jsx(nc,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ma,{className:"h-4 w-4 text-muted-foreground"})})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsx(_,{variant:"outline",size:"icon",onClick:()=>O(l),title:"复制到剪贴板",className:"flex-shrink-0",disabled:!l,children:b?e.jsx(Lt,{className:"h-4 w-4 text-green-500"}):e.jsx(Fo,{className:"h-4 w-4"})}),e.jsxs(Cs,{children:[e.jsx(_t,{asChild:!0,children:e.jsxs(_,{variant:"outline",disabled:j,className:"gap-2 flex-1 sm:flex-none",children:[e.jsx(ut,{className:F("h-4 w-4",j&&"animate-spin")}),e.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),e.jsx("span",{className:"sm:hidden",children:"生成"})]})}),e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认重新生成 Token"}),e.jsx(Ns,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:L,children:"确认生成"})]})]})]})]})]}),e.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),e.jsxs("div",{className:"relative",children:[e.jsx(ne,{id:"new-token",type:f?"text":"password",value:c,onChange:ce=>d(ce.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),e.jsx("button",{onClick:()=>p(!f),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:f?"隐藏":"显示",children:f?e.jsx(nc,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ma,{className:"h-4 w-4 text-muted-foreground"})})]}),c&&e.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),e.jsx("div",{className:"space-y-1.5",children:H.rules.map(ce=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[ce.passed?e.jsx(tt,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):e.jsx(ta,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:F(ce.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:ce.label})]},ce.id))}),H.isValid&&e.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[e.jsx(Lt,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),e.jsx(_,{onClick:X,disabled:g||!H.isValid||!c,className:"w-full sm:w-auto",children:g?"更新中...":"更新自定义 Token"})]})]}),e.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[e.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),e.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),e.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),e.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),e.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),e.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),e.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function S2(){const a=xa(),{toast:l}=it(),[r,c]=u.useState(!1),[d,m]=u.useState(!1),[h,f]=u.useState(()=>zt("logCacheSize")),[p,g]=u.useState(()=>zt("wsReconnectInterval")),[N,j]=u.useState(()=>zt("wsMaxReconnectAttempts")),[y,b]=u.useState(()=>zt("dataSyncInterval")),[w,A]=u.useState(()=>Dg()),[M,S]=u.useState(!1),[P,E]=u.useState(!1),C=u.useRef(null);if(d)throw new Error("这是一个手动触发的测试错误,用于验证错误边界组件是否正常工作。");const R=()=>{A(Dg())},H=D=>{const K=D[0];f(K),Kr("logCacheSize",K)},O=D=>{const K=D[0];g(K),Kr("wsReconnectInterval",K)},X=D=>{const K=D[0];j(K),Kr("wsMaxReconnectAttempts",K)},L=D=>{const K=D[0];b(K),Kr("dataSyncInterval",K)},me=()=>{Gn.clearLogs(),l({title:"日志已清除",description:"日志缓存已清空"})},Ne=()=>{const D=j2();R(),l({title:"缓存已清除",description:`已清除 ${D.clearedKeys.length} 项缓存数据`})},je=()=>{S(!0);try{const D=f2(),K=JSON.stringify(D,null,2),B=new Blob([K],{type:"application/json"}),ue=URL.createObjectURL(B),Q=document.createElement("a");Q.href=ue,Q.download=`maibot-webui-settings-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(Q),Q.click(),document.body.removeChild(Q),URL.revokeObjectURL(ue),l({title:"导出成功",description:"设置已导出为 JSON 文件"})}catch(D){console.error("导出设置失败:",D),l({title:"导出失败",description:"无法导出设置",variant:"destructive"})}finally{S(!1)}},ce=D=>{const K=D.target.files?.[0];if(!K)return;E(!0);const B=new FileReader;B.onload=ue=>{try{const Q=ue.target?.result,_e=JSON.parse(Q),he=p2(_e);he.success?(f(zt("logCacheSize")),g(zt("wsReconnectInterval")),j(zt("wsMaxReconnectAttempts")),b(zt("dataSyncInterval")),R(),l({title:"导入成功",description:`成功导入 ${he.imported.length} 项设置${he.skipped.length>0?`,跳过 ${he.skipped.length} 项`:""}`}),(he.imported.includes("theme")||he.imported.includes("accentColor"))&&l({title:"提示",description:"部分设置需要刷新页面才能完全生效"})):l({title:"导入失败",description:"没有有效的设置项可导入",variant:"destructive"})}catch(Q){console.error("导入设置失败:",Q),l({title:"导入失败",description:"文件格式无效",variant:"destructive"})}finally{E(!1),C.current&&(C.current.value="")}},B.readAsText(K)},ge=()=>{g2(),f(xl.logCacheSize),g(xl.wsReconnectInterval),j(xl.wsMaxReconnectAttempts),b(xl.dataSyncInterval),R(),l({title:"已重置",description:"所有设置已恢复为默认值,刷新页面以应用更改"})},pe=async()=>{c(!0);try{const D=await Se("/api/webui/setup/reset",{method:"POST"}),K=await D.json();D.ok&&K.success?(l({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{a({to:"/setup"})},1e3)):l({title:"重置失败",description:K.message||"无法重置配置状态",variant:"destructive"})}catch(D){console.error("重置配置状态错误:",D),l({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{c(!1)}};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(Jr,{className:"h-5 w-5"}),"性能与存储"]}),e.jsxs("div",{className:"space-y-4 sm:space-y-5",children:[e.jsxs("div",{className:"rounded-lg bg-muted/50 p-3 sm:p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("span",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(C1,{className:"h-4 w-4"}),"本地存储使用"]}),e.jsx(_,{variant:"ghost",size:"sm",onClick:R,className:"h-7 px-2",children:e.jsx(ut,{className:"h-3 w-3"})})]}),e.jsx("div",{className:"text-2xl font-bold text-primary",children:v2(w.used)}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[w.items," 个存储项"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"日志缓存大小"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h," 条"]})]}),e.jsx(Wa,{value:[h],onValueChange:H,min:100,max:5e3,step:100,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"控制日志查看器最多缓存的日志条数,较大的值会占用更多内存"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"首页数据刷新间隔"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[y," 秒"]})]}),e.jsx(Wa,{value:[y],onValueChange:L,min:10,max:120,step:5,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"控制首页统计数据的自动刷新间隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"WebSocket 重连间隔"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[p/1e3," 秒"]})]}),e.jsx(Wa,{value:[p],onValueChange:O,min:1e3,max:1e4,step:500,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"日志 WebSocket 连接断开后的重连基础间隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"WebSocket 最大重连次数"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[N," 次"]})]}),e.jsx(Wa,{value:[N],onValueChange:X,min:3,max:30,step:1,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"连接失败后的最大重连尝试次数"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 pt-2",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:me,className:"gap-2",children:[e.jsx(us,{className:"h-4 w-4"}),"清除日志缓存"]}),e.jsxs(Cs,{children:[e.jsx(_t,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(us,{className:"h-4 w-4"}),"清除本地缓存"]})}),e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认清除本地缓存"}),e.jsx(Ns,{children:"这将清除所有本地缓存的设置和数据(不包括登录凭证)。 您可能需要重新配置部分偏好设置。确定要继续吗?"})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:Ne,children:"确认清除"})]})]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(na,{className:"h-5 w-5"}),"导入/导出设置"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"导出当前的界面设置以便备份,或从之前导出的文件中恢复设置。"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(_,{variant:"outline",onClick:je,disabled:M,className:"gap-2",children:[e.jsx(na,{className:"h-4 w-4"}),M?"导出中...":"导出设置"]}),e.jsx("input",{ref:C,type:"file",accept:".json",onChange:ce,className:"hidden"}),e.jsxs(_,{variant:"outline",onClick:()=>C.current?.click(),disabled:P,className:"gap-2",children:[e.jsx(rc,{className:"h-4 w-4"}),P?"导入中...":"导入设置"]})]}),e.jsx("div",{className:"pt-2 border-t",children:e.jsxs(Cs,{children:[e.jsx(_t,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"gap-2 text-destructive hover:text-destructive",children:[e.jsx(lc,{className:"h-4 w-4"}),"重置所有设置为默认值"]})}),e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认重置所有设置"}),e.jsx(Ns,{children:"这将把所有界面设置恢复为默认值,包括主题、颜色、动画等偏好设置。 此操作不会影响您的登录状态。确定要继续吗?"})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:ge,children:"确认重置"})]})]})]})})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsx("div",{className:"space-y-2",children:e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),e.jsxs(Cs,{children:[e.jsx(_t,{asChild:!0,children:e.jsxs(_,{variant:"outline",disabled:r,className:"gap-2",children:[e.jsx(lc,{className:F("h-4 w-4",r&&"animate-spin")}),"重新进行初次配置"]})}),e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认重新配置"}),e.jsx(Ns,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:pe,children:"确认重置"})]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border border-dashed border-yellow-500/50 bg-yellow-500/5 p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(qt,{className:"h-5 w-5 text-yellow-500"}),"开发者工具"]}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsx("div",{className:"space-y-2",children:e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"以下功能仅供开发调试使用,可能会导致页面崩溃或异常。"})}),e.jsxs(Cs,{children:[e.jsx(_t,{asChild:!0,children:e.jsxs(_,{variant:"destructive",className:"gap-2",children:[e.jsx(qt,{className:"h-4 w-4"}),"触发测试错误"]})}),e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认触发错误"}),e.jsx(Ns,{children:"这将手动触发一个 React 错误,用于测试错误边界组件的显示效果。 页面将显示错误界面,您可以通过刷新页面或点击返回首页来恢复。"})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:()=>m(!0),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认触发"})]})]})]})]})]})]})}function k2(){return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx("div",{className:"rounded-lg border-2 border-primary/30 bg-gradient-to-r from-primary/5 to-primary/10 p-4 sm:p-6",children:e.jsxs("div",{className:"flex items-start gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex-shrink-0 rounded-lg bg-primary/10 p-2 sm:p-3",children:e.jsx("svg",{className:"h-6 w-6 sm:h-8 sm:w-8 text-primary",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg sm:text-xl font-bold text-foreground mb-2",children:"开源项目"}),e.jsx("p",{className:"text-sm sm:text-base text-muted-foreground mb-3",children:"本项目在 GitHub 开源,欢迎 Star ⭐ 支持!"}),e.jsxs("a",{href:"https://github.com/Mai-with-u/MaiBot-Dashboard",target:"_blank",rel:"noopener noreferrer",className:F("inline-flex items-center gap-2 px-4 py-2 rounded-lg","bg-primary text-primary-foreground font-medium text-sm","hover:bg-primary/90 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[e.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})}),"前往 GitHub",e.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",px]}),e.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("p",{children:["版本: ",od]}),e.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),e.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",e.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"React 19.2.0"}),e.jsx("li",{children:"TypeScript 5.7.2"}),e.jsx("li",{children:"Vite 6.0.7"}),e.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"shadcn/ui"}),e.jsx("li",{children:"Radix UI"}),e.jsx("li",{children:"Tailwind CSS 3.4.17"}),e.jsx("li",{children:"Lucide Icons"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"后端"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"Python 3.12+"}),e.jsx("li",{children:"FastAPI"}),e.jsx("li",{children:"Uvicorn"}),e.jsx("li",{children:"WebSocket"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"Bun / npm"}),e.jsx("li",{children:"ESLint 9.17.0"}),e.jsx("li",{children:"PostCSS"})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),e.jsx(ss,{className:"h-[300px] sm:h-[400px]",children:e.jsxs("div",{className:"space-y-4 pr-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Ct,{name:"React",description:"用户界面构建库",license:"MIT"}),e.jsx(Ct,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),e.jsx(Ct,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),e.jsx(Ct,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),e.jsx(Ct,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Ct,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),e.jsx(Ct,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Ct,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),e.jsx(Ct,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Ct,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),e.jsx(Ct,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),e.jsx(Ct,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),e.jsx(Ct,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Ct,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),e.jsx(Ct,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Ct,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),e.jsx(Ct,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),e.jsx(Ct,{name:"Pydantic",description:"数据验证库",license:"MIT"}),e.jsx(Ct,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Ct,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),e.jsx(Ct,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),e.jsx(Ct,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),e.jsx(Ct,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:e.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:e.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function Ct({name:a,description:l,license:r}){return e.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-foreground truncate",children:a}),e.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:l})]}),e.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:r})]})}function $m({value:a,current:l,onChange:r,label:c,description:d}){const m=l===a;return e.jsxs("button",{onClick:()=>r(a),className:F("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",m?"border-primary bg-accent":"border-border"),children:[m&&e.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm sm:text-base font-medium",children:c}),e.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:d})]}),e.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[a==="light"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),a==="dark"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),a==="system"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function Za({value:a,current:l,onChange:r,label:c,colorClass:d}){const m=l===a;return e.jsxs("button",{onClick:()=>r(a),className:F("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",m?"border-primary bg-accent":"border-border"),children:[m&&e.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),e.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[e.jsx("div",{className:F("h-8 w-8 sm:h-10 sm:w-10 rounded-full",d)}),e.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:c})]})]})}const C2=Date.now()%1e6;class T2{grad3;p;perm;constructor(l=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let r=0;r<256;r++)this.p[r]=Math.floor(Math.random()*256);this.perm=[];for(let r=0;r<512;r++)this.perm[r]=this.p[r&255]}dot(l,r,c){return l[0]*r+l[1]*c}mix(l,r,c){return(1-c)*l+c*r}fade(l){return l*l*l*(l*(l*6-15)+10)}perlin2(l,r){const c=Math.floor(l)&255,d=Math.floor(r)&255;l-=Math.floor(l),r-=Math.floor(r);const m=this.fade(l),h=this.fade(r),f=this.perm[c]+d,p=this.perm[f],g=this.perm[f+1],N=this.perm[c+1]+d,j=this.perm[N],y=this.perm[N+1];return this.mix(this.mix(this.dot(this.grad3[p%12],l,r),this.dot(this.grad3[j%12],l-1,r),m),this.mix(this.dot(this.grad3[g%12],l,r-1),this.dot(this.grad3[y%12],l-1,r-1),m),h)}}function Lg(){const a=u.useRef(null),l=u.useRef(null),r=u.useRef(void 0),[c]=u.useState(()=>new T2(C2)),d=u.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:c,bounding:null});return u.useEffect(()=>{const m=l.current,h=a.current;if(!m||!h)return;const f=d.current;f.noise=c;const p=()=>{const M=m.getBoundingClientRect();f.bounding=M,h.style.width=`${M.width}px`,h.style.height=`${M.height}px`},g=()=>{if(!f.bounding)return;const{width:M,height:S}=f.bounding;f.lines=[],f.paths.forEach(me=>me.remove()),f.paths=[];const P=10,E=32,C=M+200,R=S+30,H=Math.ceil(C/P),O=Math.ceil(R/E),X=(M-P*H)/2,L=(S-E*O)/2;for(let me=0;me<=H;me++){const Ne=[];for(let ce=0;ce<=O;ce++){const ge={x:X+P*me,y:L+E*ce,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};Ne.push(ge)}const je=document.createElementNS("http://www.w3.org/2000/svg","path");h.appendChild(je),f.paths.push(je),f.lines.push(Ne)}},N=M=>{const{lines:S,mouse:P,noise:E}=f;S.forEach(C=>{C.forEach(R=>{const H=E.perlin2((R.x+M*.0125)*.002,(R.y+M*.005)*.0015)*12;R.wave.x=Math.cos(H)*32,R.wave.y=Math.sin(H)*16;const O=R.x-P.sx,X=R.y-P.sy,L=Math.hypot(O,X),me=Math.max(175,P.vs);if(L{const P={x:M.x+M.wave.x+(S?M.cursor.x:0),y:M.y+M.wave.y+(S?M.cursor.y:0)};return P.x=Math.round(P.x*10)/10,P.y=Math.round(P.y*10)/10,P},y=()=>{const{lines:M,paths:S}=f;M.forEach((P,E)=>{let C=j(P[0],!1),R=`M ${C.x} ${C.y}`;P.forEach((H,O)=>{const X=O===P.length-1;C=j(H,!X),R+=`L ${C.x} ${C.y}`}),S[E].setAttribute("d",R)})},b=M=>{const{mouse:S}=f;S.sx+=(S.x-S.sx)*.1,S.sy+=(S.y-S.sy)*.1;const P=S.x-S.lx,E=S.y-S.ly,C=Math.hypot(P,E);S.v=C,S.vs+=(C-S.vs)*.1,S.vs=Math.min(100,S.vs),S.lx=S.x,S.ly=S.y,S.a=Math.atan2(E,P),m&&(m.style.setProperty("--x",`${S.sx}px`),m.style.setProperty("--y",`${S.sy}px`)),N(M),y(),r.current=requestAnimationFrame(b)},w=M=>{if(!f.bounding)return;const{mouse:S}=f;S.x=M.pageX-f.bounding.left,S.y=M.pageY-f.bounding.top+window.scrollY,S.set||(S.sx=S.x,S.sy=S.y,S.lx=S.x,S.ly=S.y,S.set=!0)},A=()=>{p(),g()};return p(),g(),window.addEventListener("resize",A),window.addEventListener("mousemove",w),r.current=requestAnimationFrame(b),()=>{window.removeEventListener("resize",A),window.removeEventListener("mousemove",w),r.current&&cancelAnimationFrame(r.current)}},[c]),e.jsxs("div",{ref:l,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[e.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),e.jsx("svg",{ref:a,style:{display:"block",width:"100%",height:"100%"},children:e.jsx("style",{children:` + path { + fill: none; + stroke: hsl(var(--primary) / 0.20); + stroke-width: 1px; + } + `})})]})}function E2(){const[a,l]=u.useState(""),[r,c]=u.useState(!1),[d,m]=u.useState(""),[h,f]=u.useState(!0),p=xa(),{enableWavesBackground:g,setEnableWavesBackground:N}=Pv(),{theme:j,setTheme:y}=fx();u.useEffect(()=>{(async()=>{try{await cc()&&p({to:"/"})}catch{}finally{f(!1)}})()},[p]);const w=j==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":j,A=()=>{y(w==="dark"?"light":"dark")},M=async S=>{if(S.preventDefault(),m(""),!a.trim()){m("请输入 Access Token");return}c(!0),console.log("开始验证 token...");try{const P=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:a.trim()})});console.log("Token 验证响应状态:",P.status);const E=await P.json();if(console.log("Token 验证响应数据:",E),P.ok&&E.valid){console.log("Token 验证成功,准备跳转..."),console.log("is_first_setup:",E.is_first_setup),await new Promise(R=>setTimeout(R,100));const C=await cc();console.log("跳转前认证状态检查:",C),E.is_first_setup?(console.log("跳转到首次配置页面"),p({to:"/setup"})):(console.log("跳转到首页"),p({to:"/"}))}else console.error("Token 验证失败:",E.message),m(E.message||"Token 验证失败,请检查后重试")}catch(P){console.error("Token 验证错误:",P),m("连接服务器失败,请检查网络连接")}finally{c(!1)}};return h?e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[g&&e.jsx(Lg,{}),e.jsx("div",{className:"text-muted-foreground",children:"正在检查登录状态..."})]}):e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[g&&e.jsx(Lg,{}),e.jsxs(Ce,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[e.jsx("button",{onClick:A,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:w==="dark"?"切换到浅色模式":"切换到深色模式",children:w==="dark"?e.jsx(nx,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):e.jsx(ec,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),e.jsxs(De,{className:"space-y-4 text-center",children:[e.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:e.jsx(_g,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ue,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),e.jsx(fs,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),e.jsx(Ae,{children:e.jsxs("form",{onSubmit:M,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),e.jsxs("div",{className:"relative",children:[e.jsx(rx,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),e.jsx(ne,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:a,onChange:S=>l(S.target.value),className:F("pl-10",d&&"border-red-500 focus-visible:ring-red-500"),disabled:r,autoFocus:!0,autoComplete:"off"})]})]}),d&&e.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[e.jsx(Rt,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{children:d})]}),e.jsx(_,{type:"submit",className:"w-full",disabled:r,children:r?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),e.jsxs(Js,{children:[e.jsx(cd,{asChild:!0,children:e.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[e.jsx(nv,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),e.jsxs(qs,{className:"sm:max-w-md",children:[e.jsxs(Vs,{children:[e.jsxs(Gs,{className:"flex items-center gap-2",children:[e.jsx(_g,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),e.jsx(nt,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(T1,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),e.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[e.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),e.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(La,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),e.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:e.jsx("code",{className:"text-primary",children:"data/webui.json"})}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",e.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),e.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Rt,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[e.jsx("p",{className:"font-semibold",children:"安全提示"}),e.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[e.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),e.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),e.jsxs(Cs,{children:[e.jsx(_t,{asChild:!0,children:e.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[e.jsx(el,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsxs(vs,{className:"flex items-center gap-2",children:[e.jsx(el,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),e.jsx(Ns,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:()=>N(!1),children:"关闭动画"})]})]})]})]})})]}),e.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:e.jsx("p",{children:m2})})]})}const ft=u.forwardRef(({className:a,autoResize:l=!0,minHeight:r=60,maxHeight:c,value:d,onChange:m,...h},f)=>{const p=u.useRef(null),[g,N]=u.useState(!1);u.useImperativeHandle(f,()=>p.current),u.useEffect(()=>{if(a){const b=/\b(h-\d+|h-\[[\d.]+(?:px|rem|em)\]|min-h-\[[\d.]+(?:px|rem|em)\])\b/.test(a);N(b)}},[a]);const j=u.useCallback(()=>{const b=p.current;if(!b||!l||g)return;b.style.height="auto";const w=b.scrollHeight;let A=Math.max(w,r);c&&c>0&&(A=Math.min(A,c)),b.style.height=`${A}px`,c&&c>0&&w>c?b.style.overflowY="auto":b.style.overflowY="hidden"},[l,g,r,c]);u.useEffect(()=>{j()},[d,j]),u.useEffect(()=>{j()},[j]);const y=u.useCallback(b=>{m?.(b),requestAnimationFrame(()=>{j()})},[m,j]);return e.jsx("textarea",{className:F("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","custom-scrollbar",l&&!g&&"resize-none overflow-hidden",a),ref:p,value:d,onChange:y,style:{minHeight:l&&!g?`${r}px`:void 0},...h})});ft.displayName="Textarea";const la=u.forwardRef(({className:a,orientation:l="horizontal",decorative:r=!0,...c},d)=>e.jsx(wj,{ref:d,decorative:r,orientation:l,className:F("shrink-0 bg-border",l==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",a),...c}));la.displayName=wj.displayName;function M2({config:a,onChange:l}){const r=d=>{d.trim()&&!a.alias_names.includes(d.trim())&&l({...a,alias_names:[...a.alias_names,d.trim()]})},c=d=>{l({...a,alias_names:a.alias_names.filter((m,h)=>h!==d)})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"qq_account",children:"QQ账号 *"}),e.jsx(ne,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:a.qq_account||"",onChange:d=>l({...a,qq_account:Number(d.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"nickname",children:"昵称 *"}),e.jsx(ne,{id:"nickname",placeholder:"请输入机器人的昵称",value:a.nickname,onChange:d=>l({...a,nickname:d.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{children:"别名"}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:a.alias_names.map((d,m)=>e.jsxs(ke,{variant:"secondary",className:"gap-1",children:[d,e.jsx("button",{type:"button",onClick:()=>c(m),className:"ml-1 hover:text-destructive",children:e.jsx(_a,{className:"h-3 w-3"})})]},m))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:d=>{d.key==="Enter"&&(r(d.target.value),d.target.value="")}}),e.jsx(_,{type:"button",variant:"outline",onClick:()=>{const d=document.getElementById("alias_input");d&&(r(d.value),d.value="")},children:"添加"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function A2({config:a,onChange:l}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"personality",children:"人格特征 *"}),e.jsx(ft,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:a.personality,onChange:r=>l({...a,personality:r.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"reply_style",children:"表达风格 *"}),e.jsx(ft,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:a.reply_style,onChange:r=>l({...a,reply_style:r.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"interest",children:"兴趣 *"}),e.jsx(ft,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:a.interest,onChange:r=>l({...a,interest:r.target.value}),rows:2}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"plan_style",children:"群聊说话规则 *"}),e.jsx(ft,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:a.plan_style,onChange:r=>l({...a,plan_style:r.target.value}),rows:4}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),e.jsx(ft,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:a.private_plan_style,onChange:r=>l({...a,private_plan_style:r.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function z2({config:a,onChange:l}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{htmlFor:"emoji_chance",children:"表情包激活概率"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[(a.emoji_chance*100).toFixed(0),"%"]})]}),e.jsx(ne,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:a.emoji_chance,onChange:r=>l({...a,emoji_chance:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"max_reg_num",children:"最大表情包数量"}),e.jsx(ne,{id:"max_reg_num",type:"number",min:"1",max:"200",value:a.max_reg_num,onChange:r=>l({...a,max_reg_num:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"do_replace",children:"达到最大数量时替换"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),e.jsx(Ge,{id:"do_replace",checked:a.do_replace,onCheckedChange:r=>l({...a,do_replace:r})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(ne,{id:"check_interval",type:"number",min:"1",max:"120",value:a.check_interval,onChange:r=>l({...a,check_interval:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),e.jsx(la,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"steal_emoji",children:"偷取表情包"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),e.jsx(Ge,{id:"steal_emoji",checked:a.steal_emoji,onCheckedChange:r=>l({...a,steal_emoji:r})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"content_filtration",children:"启用表情包过滤"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),e.jsx(Ge,{id:"content_filtration",checked:a.content_filtration,onCheckedChange:r=>l({...a,content_filtration:r})})]}),a.content_filtration&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(ne,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:a.filtration_prompt,onChange:r=>l({...a,filtration_prompt:r.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function R2({config:a,onChange:l}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"enable_tool",children:"启用工具系统"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),e.jsx(Ge,{id:"enable_tool",checked:a.enable_tool,onCheckedChange:r=>l({...a,enable_tool:r})})]}),e.jsx(la,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"all_global",children:"启用全局黑话模式"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),e.jsx(Ge,{id:"all_global",checked:a.all_global,onCheckedChange:r=>l({...a,all_global:r})})]})]})}function D2({config:a,onChange:l}){const[r,c]=u.useState(!1);return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5",children:e.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),e.jsxs("div",{className:"flex-1 text-sm",children:[e.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"关于硅基流动 (SiliconFlow)"}),e.jsx("p",{className:"text-blue-700 dark:text-blue-300 mb-2",children:"硅基流动提供了完整的模型覆盖,包括 DeepSeek V3、Qwen、视觉模型、语音识别和嵌入模型。 只需一个 API Key 即可使用麦麦的所有功能!"}),e.jsxs("a",{href:"https://cloud.siliconflow.cn",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-600 dark:text-blue-400 hover:underline font-medium",children:["前往硅基流动获取 API Key",e.jsx($o,{className:"h-3 w-3"})]})]})]})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"siliconflow_api_key",children:"SiliconFlow API Key *"}),e.jsxs("div",{className:"relative",children:[e.jsx(ne,{id:"siliconflow_api_key",type:r?"text":"password",placeholder:"sk-...",value:a.api_key,onChange:d=>l({api_key:d.target.value}),className:"font-mono pr-10"}),e.jsx(_,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>c(!r),children:r?e.jsx(nc,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ma,{className:"h-4 w-4 text-muted-foreground"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"请输入您的硅基流动 API 密钥。获取后,麦麦将自动配置所有必需的模型。"})]}),e.jsxs("div",{className:"rounded-lg bg-muted/50 p-4 text-sm space-y-2",children:[e.jsx("p",{className:"font-medium",children:"将自动配置以下模型:"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground ml-2",children:[e.jsx("li",{children:"DeepSeek V3 - 主要对话和工具模型"}),e.jsx("li",{children:"Qwen3 30B - 高频小任务和工具调用"}),e.jsx("li",{children:"Qwen3 VL 30B - 图像识别"}),e.jsx("li",{children:"SenseVoice - 语音识别"}),e.jsx("li",{children:"BGE-M3 - 文本嵌入"}),e.jsx("li",{children:"知识库相关模型 (LPMM)"})]})]}),e.jsx("div",{className:"rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/30 p-4",children:e.jsxs("p",{className:"text-sm text-amber-900 dark:text-amber-100",children:[e.jsx("span",{className:"font-medium",children:"💡 提示:"}),'完成向导后,您可以在"系统设置 → 模型配置"中添加更多 API 提供商和模型。']})})]})}async function O2(){const a=await Se("/api/webui/config/bot",{method:"GET",headers:Ws()});if(!a.ok)throw new Error("读取Bot配置失败");const r=(await a.json()).config.bot||{};return{qq_account:r.qq_account||0,nickname:r.nickname||"",alias_names:r.alias_names||[]}}async function L2(){const a=await Se("/api/webui/config/bot",{method:"GET",headers:Ws()});if(!a.ok)throw new Error("读取人格配置失败");const r=(await a.json()).config.personality||{};return{personality:r.personality||"",reply_style:r.reply_style||"",interest:r.interest||"",plan_style:r.plan_style||"",private_plan_style:r.private_plan_style||""}}async function U2(){const a=await Se("/api/webui/config/bot",{method:"GET",headers:Ws()});if(!a.ok)throw new Error("读取表情包配置失败");const r=(await a.json()).config.emoji||{};return{emoji_chance:r.emoji_chance??.4,max_reg_num:r.max_reg_num??40,do_replace:r.do_replace??!0,check_interval:r.check_interval??10,steal_emoji:r.steal_emoji??!0,content_filtration:r.content_filtration??!1,filtration_prompt:r.filtration_prompt||""}}async function $2(){const a=await Se("/api/webui/config/bot",{method:"GET",headers:Ws()});if(!a.ok)throw new Error("读取其他配置失败");const r=(await a.json()).config,c=r.tool||{},d=r.expression||{};return{enable_tool:c.enable_tool??!0,all_global:d.all_global_jargon??!0}}async function B2(){const a=await Se("/api/webui/config/model",{method:"GET",headers:Ws()});if(!a.ok)throw new Error("读取模型配置失败");return{api_key:((await a.json()).config.api_providers||[]).find(m=>m.name==="SiliconFlow")?.api_key||""}}async function I2(a){const l=await Se("/api/webui/config/bot/section/bot",{method:"POST",headers:Ws(),body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"保存Bot基础配置失败")}return await l.json()}async function P2(a){const l=await Se("/api/webui/config/bot/section/personality",{method:"POST",headers:Ws(),body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"保存人格配置失败")}return await l.json()}async function F2(a){const l=await Se("/api/webui/config/bot/section/emoji",{method:"POST",headers:Ws(),body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"保存表情包配置失败")}return await l.json()}async function H2(a){const l=[];l.push(Se("/api/webui/config/bot/section/tool",{method:"POST",headers:Ws(),body:JSON.stringify({enable_tool:a.enable_tool})})),l.push(Se("/api/webui/config/bot/section/expression",{method:"POST",headers:Ws(),body:JSON.stringify({all_global_jargon:a.all_global})}));const r=await Promise.all(l);for(const c of r)if(!c.ok){const d=await c.json();throw new Error(d.detail||"保存其他配置失败")}return{success:!0}}async function q2(a){const l=await Se("/api/webui/config/model",{method:"GET",headers:Ws()});if(!l.ok)throw new Error("读取模型配置失败");const c=(await l.json()).config,d=c.api_providers||[],m=d.findIndex(p=>p.name==="SiliconFlow");m>=0?d[m]={...d[m],api_key:a.api_key}:d.push({name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",api_key:a.api_key,client_type:"openai",max_retry:3,timeout:120,retry_interval:5});const h={...c,api_providers:d},f=await Se("/api/webui/config/model",{method:"POST",headers:Ws(),body:JSON.stringify(h)});if(!f.ok){const p=await f.json();throw new Error(p.detail||"保存模型配置失败")}return await f.json()}async function Ug(){const a=await Se("/api/webui/setup/complete",{method:"POST"});if(!a.ok){const l=await a.json();throw new Error(l.message||"标记配置完成失败")}return await a.json()}function V2(){return e.jsx(tr,{children:e.jsx(G2,{})})}function G2(){const a=xa(),{toast:l}=it(),{triggerRestart:r}=_n(),[c,d]=u.useState(0),[m,h]=u.useState(!1),[f,p]=u.useState(!1),[g,N]=u.useState(!0),[j,y]=u.useState({qq_account:0,nickname:"",alias_names:[]}),[b,w]=u.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 +2.如果相同的内容已经被执行,请不要重复执行 +3.请控制你的发言频率,不要太过频繁的发言 +4.如果有人对你感到厌烦,请减少回复 +5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 +2.如果相同的内容已经被执行,请不要重复执行 +3.某句话如果已经被回复过,不要重复回复`}),[A,M]=u.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[S,P]=u.useState({enable_tool:!0,all_global:!0}),[E,C]=u.useState({api_key:""}),R=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:Kn},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:$l},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:ld},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:bn},{id:"siliconflow",title:"API配置",description:"配置硅基流动API密钥",icon:rx}],H=(c+1)/R.length*100;u.useEffect(()=>{(async()=>{try{N(!0);const[ge,pe,D,K,B]=await Promise.all([O2(),L2(),U2(),$2(),B2()]);y(ge),w(pe),M(D),P(K),C(B)}catch(ge){l({title:"加载配置失败",description:ge instanceof Error?ge.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{N(!1)}})()},[l]);const O=async()=>{p(!0);try{switch(c){case 0:await I2(j);break;case 1:await P2(b);break;case 2:await F2(A);break;case 3:await H2(S);break;case 4:await q2(E);break}return l({title:"保存成功",description:`${R[c].title}配置已保存`}),!0}catch(ce){return l({title:"保存失败",description:ce instanceof Error?ce.message:"未知错误",variant:"destructive"}),!1}finally{p(!1)}},X=async()=>{await O()&&c{c>0&&d(c-1)},me=async()=>{h(!0);try{if(!await O()){h(!1);return}await Ug(),l({title:"配置完成",description:"麦麦正在重启以应用新配置..."}),await r()}catch(ce){l({title:"配置失败",description:ce instanceof Error?ce.message:"未知错误",variant:"destructive"})}finally{h(!1)}},Ne=async()=>{try{await Ug(),a({to:"/"})}catch(ce){l({title:"跳过失败",description:ce instanceof Error?ce.message:"未知错误",variant:"destructive"})}},je=()=>{switch(c){case 0:return e.jsx(M2,{config:j,onChange:y});case 1:return e.jsx(A2,{config:b,onChange:w});case 2:return e.jsx(z2,{config:A,onChange:M});case 3:return e.jsx(R2,{config:S,onChange:P});case 4:return e.jsx(D2,{config:E,onChange:C});default:return null}};return e.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[e.jsx(ar,{}),e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute left-1/4 top-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-primary/5 blur-3xl"}),e.jsx("div",{className:"absolute right-1/4 bottom-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-secondary/5 blur-3xl"})]}),g?e.jsxs("div",{className:"relative z-10 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:e.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),e.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[e.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:e.jsx(E1,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),e.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),e.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",px," 的初始配置"]})]}),e.jsxs("div",{className:"mb-6 md:mb-8",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",c+1," / ",R.length]}),e.jsxs("span",{className:"font-medium text-primary",children:[Math.round(H),"%"]})]}),e.jsx(er,{value:H,className:"h-2"})]}),e.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:R.map((ce,ge)=>{const pe=ce.icon;return e.jsxs("div",{className:F("flex flex-1 flex-col items-center gap-1 md:gap-2",gea({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[e.jsx(nd,{className:"h-4 w-4"}),"返回首页"]}),e.jsxs(_,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[e.jsx(Ua,{className:"h-4 w-4"}),"返回上一页"]})]}),e.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}const K2=Hs.memo(function({config:l,onChange:r}){const c=l.platforms||[],d=l.alias_names||[],m=()=>{r({...l,platforms:[...c,""]})},h=j=>{r({...l,platforms:c.filter((y,b)=>b!==j)})},f=(j,y)=>{const b=[...c];b[j]=y,r({...l,platforms:b})},p=()=>{r({...l,alias_names:[...d,""]})},g=j=>{r({...l,alias_names:d.filter((y,b)=>b!==j)})},N=(j,y)=>{const b=[...d];b[j]=y,r({...l,alias_names:b})};return e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"platform",children:"平台"}),e.jsx(ne,{id:"platform",value:l.platform,onChange:j=>r({...l,platform:j.target.value}),placeholder:"qq"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"qq_account",children:"QQ账号"}),e.jsx(ne,{id:"qq_account",value:l.qq_account,onChange:j=>r({...l,qq_account:j.target.value}),placeholder:"123456789"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"nickname",children:"昵称"}),e.jsx(ne,{id:"nickname",value:l.nickname,onChange:j=>r({...l,nickname:j.target.value}),placeholder:"麦麦"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"别名"}),e.jsxs(_,{onClick:p,size:"sm",variant:"outline",children:[e.jsx(at,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[d.map((j,y)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{value:j,onChange:b=>N(y,b.target.value),placeholder:"小麦"}),e.jsxs(Cs,{children:[e.jsx(_t,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(us,{className:"h-4 w-4"})})}),e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认删除"}),e.jsxs(Ns,{children:['确定要删除别名 "',j||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:()=>g(y),children:"删除"})]})]})]})]},y)),d.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"其他平台账号"}),e.jsxs(_,{onClick:m,size:"sm",variant:"outline",children:[e.jsx(at,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[c.map((j,y)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{value:j,onChange:b=>f(y,b.target.value),placeholder:"wx:114514"}),e.jsxs(Cs,{children:[e.jsx(_t,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(us,{className:"h-4 w-4"})})}),e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认删除"}),e.jsxs(Ns,{children:['确定要删除平台账号 "',j||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:()=>h(y),children:"删除"})]})]})]})]},y)),c.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]})]})]})})}),Q2=Hs.memo(function({config:l,onChange:r}){const c=()=>{r({...l,states:[...l.states,""]})},d=h=>{r({...l,states:l.states.filter((f,p)=>p!==h)})},m=(h,f)=>{const p=[...l.states];p[h]=f,r({...l,states:p})};return e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"personality",children:"人格特质"}),e.jsx(ft,{id:"personality",value:l.personality,onChange:h=>r({...l,personality:h.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"多重人格"}),e.jsxs(_,{onClick:c,size:"sm",variant:"outline",children:[e.jsx(at,{className:"h-4 w-4 mr-1"}),"添加人格"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"可以定义多个不同的人格状态,麦麦会随机切换"}),e.jsx("div",{className:"space-y-2",children:l.states.map((h,f)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ft,{value:h,onChange:p=>m(f,p.target.value),placeholder:"描述一个人格状态",rows:2}),e.jsxs(Cs,{children:[e.jsx(_t,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(us,{className:"h-4 w-4"})})}),e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认删除"}),e.jsx(Ns,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:()=>d(f),children:"删除"})]})]})]})]},f))})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"state_probability",children:"替换为多重人格概率"}),e.jsx(ne,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:l.state_probability,onChange:h=>r({...l,state_probability:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时,用多重人格替换主人格的概率(0.0-1.0)"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"reply_style",children:"表达风格"}),e.jsx(ft,{id:"reply_style",value:l.reply_style,onChange:h=>r({...l,reply_style:h.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"plan_style",children:"说话规则与行为风格"}),e.jsx(ft,{id:"plan_style",value:l.plan_style,onChange:h=>r({...l,plan_style:h.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"visual_style",children:"识图规则"}),e.jsx(ft,{id:"visual_style",value:l.visual_style,onChange:h=>r({...l,visual_style:h.target.value}),placeholder:"识图时的处理规则",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"private_plan_style",children:"私聊规则"}),e.jsx(ft,{id:"private_plan_style",value:l.private_plan_style,onChange:h=>r({...l,private_plan_style:h.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]})]})]})})}),hl=_w,fl=Sw,nl=u.forwardRef(({className:a,align:l="center",sideOffset:r=4,...c},d)=>e.jsx(ww,{children:e.jsx(_j,{ref:d,align:l,sideOffset:r,className:F("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",a),...c})}));nl.displayName=_j.displayName;const Y2=Hs.memo(function({value:l,onChange:r}){const c=u.useMemo(()=>{const b=l.split("-");if(b.length===2){const[w,A]=b,[M,S]=w.split(":"),[P,E]=A.split(":");return{startHour:M?M.padStart(2,"0"):"00",startMinute:S?S.padStart(2,"0"):"00",endHour:P?P.padStart(2,"0"):"23",endMinute:E?E.padStart(2,"0"):"59"}}return{startHour:"00",startMinute:"00",endHour:"23",endMinute:"59"}},[l]),[d,m]=u.useState(c.startHour),[h,f]=u.useState(c.startMinute),[p,g]=u.useState(c.endHour),[N,j]=u.useState(c.endMinute);u.useEffect(()=>{m(c.startHour),f(c.startMinute),g(c.endHour),j(c.endMinute)},[c]);const y=(b,w,A,M)=>{const S=`${b}:${w}-${A}:${M}`;r(S)};return e.jsxs(hl,{children:[e.jsx(fl,{asChild:!0,children:e.jsxs(_,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[e.jsx(ia,{className:"h-4 w-4 mr-2"}),l||"选择时间段"]})}),e.jsx(nl,{className:"w-72 sm:w-80",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"小时"}),e.jsxs(Pe,{value:d,onValueChange:b=>{m(b),y(b,h,p,N)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:Array.from({length:24},(b,w)=>w).map(b=>e.jsx(ee,{value:b.toString().padStart(2,"0"),children:b.toString().padStart(2,"0")},b))})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"分钟"}),e.jsxs(Pe,{value:h,onValueChange:b=>{f(b),y(d,b,p,N)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:Array.from({length:60},(b,w)=>w).map(b=>e.jsx(ee,{value:b.toString().padStart(2,"0"),children:b.toString().padStart(2,"0")},b))})]})]})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"小时"}),e.jsxs(Pe,{value:p,onValueChange:b=>{g(b),y(d,h,b,N)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:Array.from({length:24},(b,w)=>w).map(b=>e.jsx(ee,{value:b.toString().padStart(2,"0"),children:b.toString().padStart(2,"0")},b))})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"分钟"}),e.jsxs(Pe,{value:N,onValueChange:b=>{j(b),y(d,h,p,b)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:Array.from({length:60},(b,w)=>w).map(b=>e.jsx(ee,{value:b.toString().padStart(2,"0"),children:b.toString().padStart(2,"0")},b))})]})]})]})]})]})})]})}),J2=Hs.memo(function({rule:l}){const r=`{ target = "${l.target}", time = "${l.time}", value = ${l.value.toFixed(1)} }`;return e.jsxs(hl,{children:[e.jsx(fl,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ma,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(nl,{className:"w-80 sm:w-96",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:r}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})}),X2=Hs.memo(function({config:l,onChange:r}){const c=()=>{r({...l,talk_value_rules:[...l.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},d=h=>{r({...l,talk_value_rules:l.talk_value_rules.filter((f,p)=>p!==h)})},m=(h,f,p)=>{const g=[...l.talk_value_rules];g[h]={...g[h],[f]:p},r({...l,talk_value_rules:g})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),e.jsx(ne,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:l.talk_value,onChange:h=>r({...l,talk_value:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"think_mode",children:"思考模式"}),e.jsxs(Pe,{value:l.think_mode||"classic",onValueChange:h=>r({...l,think_mode:h}),children:[e.jsx(Be,{id:"think_mode",children:e.jsx(Fe,{placeholder:"选择思考模式"})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"classic",children:"经典模式 - 浅度思考和回复"}),e.jsx(ee,{value:"deep",children:"深度模式 - 进行深度思考和回复"}),e.jsx(ee,{value:"dynamic",children:"动态模式 - 自动选择思考深度"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"控制麦麦的思考深度。经典模式回复快但简单;深度模式更深入但较慢;动态模式根据情况自动选择"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"mentioned_bot_reply",checked:l.mentioned_bot_reply,onCheckedChange:h=>r({...l,mentioned_bot_reply:h})}),e.jsx(T,{htmlFor:"mentioned_bot_reply",className:"cursor-pointer",children:"启用提及必回复"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_context_size",children:"上下文长度"}),e.jsx(ne,{id:"max_context_size",type:"number",min:"1",value:l.max_context_size,onChange:h=>r({...l,max_context_size:parseInt(h.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"planner_smooth",children:"规划器平滑"}),e.jsx(ne,{id:"planner_smooth",type:"number",step:"1",min:"0",value:l.planner_smooth,onChange:h=>r({...l,planner_smooth:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"plan_reply_log_max_per_chat",children:"每个聊天流最大日志数量"}),e.jsx(ne,{id:"plan_reply_log_max_per_chat",type:"number",step:"1",min:"100",value:l.plan_reply_log_max_per_chat??1024,onChange:h=>r({...l,plan_reply_log_max_per_chat:parseInt(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"每个聊天流保存的 Plan/Reply 日志最大数量,超过此数量时会自动删除最老的日志"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"llm_quote",checked:l.llm_quote??!1,onCheckedChange:h=>r({...l,llm_quote:h})}),e.jsx(T,{htmlFor:"llm_quote",className:"cursor-pointer",children:"启用 LLM 控制引用"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2 ml-10",children:"启用后,LLM 可以决定是否在回复时引用消息"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_talk_value_rules",checked:l.enable_talk_value_rules,onCheckedChange:h=>r({...l,enable_talk_value_rules:h})}),e.jsx(T,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]})]})]}),l.enable_talk_value_rules&&e.jsxs("div",{className:"border-t pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),e.jsxs(_,{onClick:c,size:"sm",children:[e.jsx(at,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),l.talk_value_rules&&l.talk_value_rules.length>0?e.jsx("div",{className:"space-y-4",children:l.talk_value_rules.map((h,f)=>e.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",f+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J2,{rule:h}),e.jsxs(Cs,{children:[e.jsx(_t,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"sm",children:e.jsx(us,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认删除"}),e.jsxs(Ns,{children:["确定要删除规则 #",f+1," 吗?此操作无法撤销。"]})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:()=>d(f),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"配置类型"}),e.jsxs(Pe,{value:h.target===""?"global":"specific",onValueChange:p=>{p==="global"?m(f,"target",""):m(f,"target","qq::group")},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"global",children:"全局配置"}),e.jsx(ee,{value:"specific",children:"详细配置"})]})]})]}),h.target!==""&&(()=>{const p=h.target.split(":"),g=p[0]||"qq",N=p[1]||"",j=p[2]||"group";return e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Pe,{value:g,onValueChange:y=>{m(f,"target",`${y}:${N}:${j}`)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"qq",children:"QQ"}),e.jsx(ee,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(ne,{value:N,onChange:y=>{m(f,"target",`${g}:${y.target.value}:${j}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Pe,{value:j,onValueChange:y=>{m(f,"target",`${g}:${N}:${y}`)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"group",children:"群组(group)"}),e.jsx(ee,{value:"private",children:"私聊(private)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",h.target||"(未设置)"]})]})})(),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"时间段 (Time)"}),e.jsx(Y2,{value:h.time,onChange:p=>m(f,"time",p)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{htmlFor:`rule-value-${f}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),e.jsx(ne,{id:`rule-value-${f}`,type:"number",step:"0.01",min:"0.01",max:"1",value:h.value,onChange:p=>{const g=parseFloat(p.target.value);isNaN(g)||m(f,"value",Math.max(.01,Math.min(1,g)))},className:"w-20 h-8 text-xs"})]}),e.jsx(Wa,{value:[h.value],onValueChange:p=>m(f,"value",p[0]),min:.01,max:1,step:.01,className:"w-full"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"0.01 (极少发言)"}),e.jsx("span",{children:"0.5"}),e.jsx("span",{children:"1.0 (正常)"})]})]})]})]},f))}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:e.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),e.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[e.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),e.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[e.jsxs("li",{children:["• ",e.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}),Z2=Hs.memo(function({config:l,onChange:r}){const c=S=>{if(!S||!S.includes(":"))return{platform:"qq",userId:""};const[P,E]=S.split(":");return{platform:P,userId:E}},{platform:d,userId:m}=c(l.dream_send),[h,f]=u.useState(d),[p,g]=u.useState(m),N=S=>{const[P,E]=S.split("-");return{startTime:P||"09:00",endTime:E||"22:00"}},j=(S,P)=>{const E=P?`${S}:${P}`:"";r({...l,dream_send:E})},y=S=>{f(S),j(S,p)},b=S=>{g(S),j(h,S)},w=()=>{r({...l,dream_time_ranges:[...l.dream_time_ranges,"09:00-22:00"]})},A=S=>{r({...l,dream_time_ranges:l.dream_time_ranges.filter((P,E)=>E!==S)})},M=(S,P,E)=>{const C=[...l.dream_time_ranges],R=N(C[S]);P==="startTime"?R.startTime=E:R.endTime=E,C[S]=`${R.startTime}-${R.endTime}`,r({...l,dream_time_ranges:C})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"做梦配置"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"interval_minutes",children:"做梦时间间隔(分钟)"}),e.jsx(ne,{id:"interval_minutes",type:"number",min:"1",value:l.interval_minutes,onChange:S=>r({...l,interval_minutes:Number(S.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"默认30分钟"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"max_iterations",children:"做梦最大轮次"}),e.jsx(ne,{id:"max_iterations",type:"number",min:"1",value:l.max_iterations,onChange:S=>r({...l,max_iterations:Number(S.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"默认20轮"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"first_delay_seconds",children:"首次做梦延迟(秒)"}),e.jsx(ne,{id:"first_delay_seconds",type:"number",min:"0",value:l.first_delay_seconds,onChange:S=>r({...l,first_delay_seconds:Number(S.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"程序启动后首次做梦前的延迟时间,默认60秒"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"做梦结果推送目标"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Pe,{value:h,onValueChange:y,children:[e.jsx(Be,{className:"w-[120px]",children:e.jsx(Fe,{placeholder:"选择平台"})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"qq",children:"QQ"}),e.jsx(ee,{value:"wx",children:"微信"}),e.jsx(ee,{value:"webui",children:"WebUI"})]})]}),e.jsx(ne,{type:"text",placeholder:"输入用户ID (例如: 123456)",value:p,onChange:S=>b(S.target.value),className:"flex-1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"选择平台并输入用户ID,做梦结束后将梦境发送给该用户。用户ID为空则不推送"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"做梦时间段配置"}),e.jsx(_,{type:"button",size:"sm",onClick:w,children:"添加时间段"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"设置允许做梦的时间段,支持跨夜区间(如 23:00 到次日 02:00)。列表为空则全天允许做梦"}),e.jsxs("div",{className:"space-y-2",children:[l.dream_time_ranges.map((S,P)=>{const{startTime:E,endTime:C}=N(S);return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{type:"time",value:E,onChange:R=>M(P,"startTime",R.target.value),className:"w-[140px]"}),e.jsx("span",{className:"text-muted-foreground",children:"至"}),e.jsx(ne,{type:"time",value:C,onChange:R=>M(P,"endTime",R.target.value),className:"w-[140px]"}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",onClick:()=>A(P),children:e.jsx(_a,{className:"h-4 w-4"})})]},P)}),l.dream_time_ranges.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"当前配置为全天允许做梦"})]})]})]})}),W2=Hs.memo(function({config:l,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.enable,onCheckedChange:c=>r({...l,enable:c})}),e.jsx(T,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),l.enable&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"LPMM 模式"}),e.jsxs(Pe,{value:l.lpmm_mode,onValueChange:c=>r({...l,lpmm_mode:c}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择 LPMM 模式"})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"classic",children:"经典模式"}),e.jsx(ee,{value:"agent",children:"Agent 模式"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"同义词搜索 TopK"}),e.jsx(ne,{type:"number",min:"1",value:l.rag_synonym_search_top_k,onChange:c=>r({...l,rag_synonym_search_top_k:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"同义词阈值"}),e.jsx(ne,{type:"number",step:"0.1",min:"0",max:"1",value:l.rag_synonym_threshold,onChange:c=>r({...l,rag_synonym_threshold:parseFloat(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"实体提取线程数"}),e.jsx(ne,{type:"number",min:"1",value:l.info_extraction_workers,onChange:c=>r({...l,info_extraction_workers:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"嵌入向量维度"}),e.jsx(ne,{type:"number",min:"1",value:l.embedding_dimension,onChange:c=>r({...l,embedding_dimension:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"嵌入并发线程数"}),e.jsx(ne,{type:"number",min:"1",value:l.max_embedding_workers,onChange:c=>r({...l,max_embedding_workers:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"每批嵌入条数"}),e.jsx(ne,{type:"number",min:"1",value:l.embedding_chunk_size,onChange:c=>r({...l,embedding_chunk_size:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"同义实体数上限"}),e.jsx(ne,{type:"number",min:"1",value:l.max_synonym_entities,onChange:c=>r({...l,max_synonym_entities:parseInt(c.target.value)})})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.enable_ppr,onCheckedChange:c=>r({...l,enable_ppr:c})}),e.jsx(T,{className:"cursor-pointer",children:"启用 PPR (低配机器可关闭)"})]})]})]})]})}),eS=Hs.memo(function({config:l,onChange:r}){const[c,d]=u.useState(""),[m,h]=u.useState("WARNING"),f=()=>{c&&!l.suppress_libraries.includes(c)&&(r({...l,suppress_libraries:[...l.suppress_libraries,c]}),d(""))},p=w=>{r({...l,suppress_libraries:l.suppress_libraries.filter(A=>A!==w)})},g=()=>{c&&!l.library_log_levels[c]&&(r({...l,library_log_levels:{...l.library_log_levels,[c]:m}}),d(""),h("WARNING"))},N=w=>{const A={...l.library_log_levels};delete A[w],r({...l,library_log_levels:A})},j=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],y=["FULL","compact","lite"],b=["none","title","full"];return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"日期格式"}),e.jsx(ne,{value:l.date_style,onChange:w=>r({...l,date_style:w.target.value}),placeholder:"例如: m-d H:i:s"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"日志级别样式"}),e.jsxs(Pe,{value:l.log_level_style,onValueChange:w=>r({...l,log_level_style:w}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:y.map(w=>e.jsx(ee,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"日志文本颜色"}),e.jsxs(Pe,{value:l.color_text,onValueChange:w=>r({...l,color_text:w}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:b.map(w=>e.jsx(ee,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"全局日志级别"}),e.jsxs(Pe,{value:l.log_level,onValueChange:w=>r({...l,log_level:w}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:j.map(w=>e.jsx(ee,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"控制台日志级别"}),e.jsxs(Pe,{value:l.console_log_level,onValueChange:w=>r({...l,console_log_level:w}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:j.map(w=>e.jsx(ee,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"文件日志级别"}),e.jsxs(Pe,{value:l.file_log_level,onValueChange:w=>r({...l,file_log_level:w}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:j.map(w=>e.jsx(ee,{value:w,children:w},w))})]})]})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"mb-2 block",children:"完全屏蔽的库"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ne,{value:c,onChange:w=>d(w.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:w=>{w.key==="Enter"&&(w.preventDefault(),f())}}),e.jsx(_,{onClick:f,size:"sm",className:"flex-shrink-0",children:e.jsx(at,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:l.suppress_libraries.map(w=>e.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[e.jsx("span",{className:"text-sm",children:w}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>p(w),children:e.jsx(us,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},w))})]}),e.jsxs("div",{children:[e.jsx(T,{className:"mb-2 block",children:"特定库的日志级别"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ne,{value:c,onChange:w=>d(w.target.value),placeholder:"输入库名",className:"flex-1"}),e.jsxs(Pe,{value:m,onValueChange:h,children:[e.jsx(Be,{className:"w-32",children:e.jsx(Fe,{})}),e.jsx(Ie,{children:j.map(w=>e.jsx(ee,{value:w,children:w},w))})]}),e.jsx(_,{onClick:g,size:"sm",children:e.jsx(at,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:Object.entries(l.library_log_levels).map(([w,A])=>e.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[e.jsx("span",{className:"text-sm font-medium",children:w}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:A}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>N(w),children:e.jsx(us,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},w))})]})]})}),sS=Hs.memo(function({config:l,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),e.jsx(Ge,{checked:l.show_prompt,onCheckedChange:c=>r({...l,show_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示回复器 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),e.jsx(Ge,{checked:l.show_replyer_prompt,onCheckedChange:c=>r({...l,show_replyer_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示回复器推理"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),e.jsx(Ge,{checked:l.show_replyer_reasoning,onCheckedChange:c=>r({...l,show_replyer_reasoning:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示 Jargon Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),e.jsx(Ge,{checked:l.show_jargon_prompt,onCheckedChange:c=>r({...l,show_jargon_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示记忆检索 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示记忆检索相关的提示词"})]}),e.jsx(Ge,{checked:l.show_memory_prompt,onCheckedChange:c=>r({...l,show_memory_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示 Planner Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 Planner 的提示词和原始返回结果"})]}),e.jsx(Ge,{checked:l.show_planner_prompt,onCheckedChange:c=>r({...l,show_planner_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示 LPMM 相关文段"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 LPMM 知识库找到的相关文段日志"})]}),e.jsx(Ge,{checked:l.show_lpmm_paragraph,onCheckedChange:c=>r({...l,show_lpmm_paragraph:c})})]})]})]})}),tS=Hs.memo(function({config:l,onChange:r}){const[c,d]=u.useState(""),[m,h]=u.useState(""),f=()=>{c&&!l.auth_token.includes(c)&&(r({...l,auth_token:[...l.auth_token,c]}),d(""))},p=j=>{r({...l,auth_token:l.auth_token.filter((y,b)=>b!==j)})},g=()=>{m&&!l.api_server_allowed_api_keys.includes(m)&&(r({...l,api_server_allowed_api_keys:[...l.api_server_allowed_api_keys,m]}),h(""))},N=j=>{r({...l,api_server_allowed_api_keys:l.api_server_allowed_api_keys.filter((y,b)=>b!==j)})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"旧版 API 认证令牌"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"用于旧版 API 验证,为空则不启用验证"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ne,{value:c,onChange:j=>d(j.target.value),placeholder:"输入认证令牌",onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),f())}}),e.jsx(_,{onClick:f,size:"sm",children:e.jsx(at,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:l.auth_token.map((j,y)=>e.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[e.jsx("span",{className:"text-sm font-mono",children:j}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>p(y),children:e.jsx(us,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},y))})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"新版 API Server 配置"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"启用新版 API Server"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否启用额外的新版 API Server(额外监听端口)"})]}),e.jsx(Ge,{checked:l.enable_api_server,onCheckedChange:j=>r({...l,enable_api_server:j})})]}),l.enable_api_server&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"主机地址"}),e.jsx(ne,{value:l.api_server_host,onChange:j=>r({...l,api_server_host:j.target.value}),placeholder:"0.0.0.0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"端口号"}),e.jsx(ne,{type:"number",value:l.api_server_port,onChange:j=>r({...l,api_server_port:parseInt(j.target.value)}),placeholder:"8090"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.api_server_use_wss,onCheckedChange:j=>r({...l,api_server_use_wss:j})}),e.jsx(T,{children:"启用 WSS 安全连接"})]}),l.api_server_use_wss&&e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"SSL 证书文件路径"}),e.jsx(ne,{value:l.api_server_cert_file,onChange:j=>r({...l,api_server_cert_file:j.target.value}),placeholder:"cert.pem"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"SSL 密钥文件路径"}),e.jsx(ne,{value:l.api_server_key_file,onChange:j=>r({...l,api_server_key_file:j.target.value}),placeholder:"key.pem"})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"mb-2 block",children:"允许的 API Key 列表"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"为空则允许所有连接"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ne,{value:m,onChange:j=>h(j.target.value),placeholder:"输入 API Key",onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),g())}}),e.jsx(_,{onClick:g,size:"sm",children:e.jsx(at,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:l.api_server_allowed_api_keys.map((j,y)=>e.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[e.jsx("span",{className:"text-sm font-mono",children:j}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>N(y),children:e.jsx(us,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},y))})]})]})]})]})]})}),aS=Hs.memo(function({config:l,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"启用统计信息发送"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),e.jsx(Ge,{checked:l.enable,onCheckedChange:c=>r({...l,enable:c})})]})]})}),lS=Hs.memo(function({emojiConfig:l,memoryConfig:r,toolConfig:c,voiceConfig:d,onEmojiChange:m,onMemoryChange:h,onToolChange:f,onVoiceChange:p}){return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_tool",checked:c.enable_tool,onCheckedChange:g=>f({...c,enable_tool:g})}),e.jsx(T,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦使用各种工具来增强功能"}),e.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[e.jsx(Ge,{id:"enable_asr",checked:d.enable_asr,onCheckedChange:g=>p({...d,enable_asr:g})}),e.jsx(T,{htmlFor:"enable_asr",className:"cursor-pointer",children:"启用语音识别"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),e.jsx(ne,{id:"max_agent_iterations",type:"number",min:"1",value:r.max_agent_iterations,onChange:g=>h({...r,max_agent_iterations:parseInt(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"agent_timeout_seconds",children:"最长回忆时间(秒)"}),e.jsx(ne,{id:"agent_timeout_seconds",type:"number",min:"1",step:"0.1",value:r.agent_timeout_seconds??120,onChange:g=>h({...r,agent_timeout_seconds:parseFloat(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"记忆检索的超时时间,避免过长的等待"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_jargon_detection",checked:r.enable_jargon_detection??!0,onCheckedChange:g=>h({...r,enable_jargon_detection:g})}),e.jsx(T,{htmlFor:"enable_jargon_detection",className:"cursor-pointer",children:"启用黑话识别"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"记忆检索过程中是否启用黑话识别"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"global_memory",checked:r.global_memory??!1,onCheckedChange:g=>h({...r,global_memory:g})}),e.jsx(T,{htmlFor:"global_memory",className:"cursor-pointer",children:"全局记忆查询"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许记忆检索在所有聊天记录中进行全局查询(忽略当前聊天流)"})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"emoji_chance",children:"表情包激活概率"}),e.jsx(ne,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:l.emoji_chance,onChange:g=>m({...l,emoji_chance:parseFloat(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_reg_num",children:"最大注册数量"}),e.jsx(ne,{id:"max_reg_num",type:"number",min:"1",value:l.max_reg_num,onChange:g=>m({...l,max_reg_num:parseInt(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(ne,{id:"check_interval",type:"number",min:"1",value:l.check_interval,onChange:g=>m({...l,check_interval:parseInt(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"do_replace",checked:l.do_replace,onCheckedChange:g=>m({...l,do_replace:g})}),e.jsx(T,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"steal_emoji",checked:l.steal_emoji,onCheckedChange:g=>m({...l,steal_emoji:g})}),e.jsx(T,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"content_filtration",checked:l.content_filtration,onCheckedChange:g=>m({...l,content_filtration:g})}),e.jsx(T,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),l.content_filtration&&e.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[e.jsx(T,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(ne,{id:"filtration_prompt",value:l.filtration_prompt,onChange:g=>m({...l,filtration_prompt:g.target.value}),placeholder:"符合公序良俗"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}),nS=Hs.memo(function({member:l,groupIndex:r,memberIndex:c,availableChatIds:d,onUpdate:m,onRemove:h}){const f=d.includes(l)||l==="*",[p,g]=u.useState(!f);return e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"flex-1 flex gap-2",children:p?e.jsxs(e.Fragment,{children:[e.jsx(ne,{value:l,onChange:N=>m(r,c,N.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),d.length>0&&e.jsx(_,{size:"sm",variant:"outline",onClick:()=>g(!1),title:"切换到下拉选择",children:"下拉"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Pe,{value:l,onValueChange:N=>m(r,c,N),children:[e.jsx(Be,{className:"flex-1",children:e.jsx(Fe,{placeholder:"选择聊天流"})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"*",children:"* (全局共享)"}),d.map((N,j)=>e.jsx(ee,{value:N,children:N},j))]})]}),e.jsx(_,{size:"sm",variant:"outline",onClick:()=>g(!0),title:"切换到手动输入",children:"输入"})]})}),e.jsxs(Cs,{children:[e.jsx(_t,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(us,{className:"h-4 w-4"})})}),e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认删除"}),e.jsxs(Ns,{children:['确定要删除组成员 "',l||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:()=>h(r,c),children:"删除"})]})]})]})]})}),rS=Hs.memo(function({config:l,onChange:r}){const c=()=>{r({...l,learning_list:[...l.learning_list,["","enable","enable","1.0"]]})},d=y=>{r({...l,learning_list:l.learning_list.filter((b,w)=>w!==y)})},m=(y,b,w)=>{const A=[...l.learning_list];A[y][b]=w,r({...l,learning_list:A})},h=({rule:y})=>{const b=`["${y[0]}", "${y[1]}", "${y[2]}", "${y[3]}"]`;return e.jsxs(hl,{children:[e.jsx(fl,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ma,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(nl,{className:"w-80 sm:w-96",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:b}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},f=()=>{r({...l,expression_groups:[...l.expression_groups,[]]})},p=y=>{r({...l,expression_groups:l.expression_groups.filter((b,w)=>w!==y)})},g=y=>{const b=[...l.expression_groups];b[y]=[...b[y],""],r({...l,expression_groups:b})},N=(y,b)=>{const w=[...l.expression_groups];w[y]=w[y].filter((A,M)=>M!==b),r({...l,expression_groups:w})},j=(y,b,w)=>{const A=[...l.expression_groups];A[y][b]=w,r({...l,expression_groups:A})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"黑话设置"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"all_global_jargon",checked:l.all_global_jargon??!1,onCheckedChange:y=>r({...l,all_global_jargon:y})}),e.jsx(T,{htmlFor:"all_global_jargon",className:"cursor-pointer",children:"全局黑话模式"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"开启后,新增的黑话将默认设为全局(所有聊天流共享)。关闭后,已记录的全局黑话不会改变,需要手动删除。"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_jargon_explanation",checked:l.enable_jargon_explanation??!0,onCheckedChange:y=>r({...l,enable_jargon_explanation:y})}),e.jsx(T,{htmlFor:"enable_jargon_explanation",className:"cursor-pointer",children:"启用黑话解释"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"在回复前尝试对上下文中的黑话进行解释。关闭可减少一次LLM调用,仅影响回复前的黑话匹配与解释,不影响黑话学习。"})]}),e.jsxs("div",{children:[e.jsx(T,{htmlFor:"jargon_mode",children:"黑话解释来源模式"}),e.jsxs(Pe,{value:l.jargon_mode??"context",onValueChange:y=>r({...l,jargon_mode:y}),children:[e.jsx(Be,{id:"jargon_mode",className:"mt-2",children:e.jsx(Fe,{placeholder:"选择黑话解释来源"})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"context",children:"上下文模式(自动匹配黑话)"}),e.jsx(ee,{value:"planner",children:"Planner模式(使用unknown_words列表)"})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["上下文模式:使用上下文自动匹配黑话并解释",e.jsx("br",{}),"Planner模式:仅使用Planner在reply动作中给出的unknown_words列表进行黑话检索"]})]})]}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),e.jsxs(_,{onClick:c,size:"sm",variant:"outline",children:[e.jsx(at,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),e.jsxs("div",{className:"space-y-4",children:[l.learning_list.map((y,b)=>{const w=l.learning_list.some((C,R)=>R!==b&&C[0]===""),A=y[0]==="",M=y[0].split(":"),S=M[0]||"qq",P=M[1]||"",E=M[2]||"group";return e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["规则 ",b+1," ",A&&"(全局配置)"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{rule:y}),e.jsxs(Cs,{children:[e.jsx(_t,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(us,{className:"h-4 w-4"})})}),e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认删除"}),e.jsxs(Ns,{children:["确定要删除学习规则 ",b+1," 吗?此操作无法撤销。"]})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:()=>d(b),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"配置类型"}),e.jsxs(Pe,{value:A?"global":"specific",onValueChange:C=>{C==="global"?m(b,0,""):m(b,0,"qq::group")},disabled:w&&!A,children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"global",children:"全局配置"}),e.jsx(ee,{value:"specific",disabled:w&&!A,children:"详细配置"})]})]}),w&&!A&&e.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!A&&e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Pe,{value:S,onValueChange:C=>{m(b,0,`${C}:${P}:${E}`)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"qq",children:"QQ"}),e.jsx(ee,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(ne,{value:P,onChange:C=>{m(b,0,`${S}:${C.target.value}:${E}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Pe,{value:E,onValueChange:C=>{m(b,0,`${S}:${P}:${C}`)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"group",children:"群组(group)"}),e.jsx(ee,{value:"private",children:"私聊(private)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",y[0]||"(未设置)"]})]}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs font-medium",children:"使用学到的表达"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),e.jsx(Ge,{checked:y[1]==="enable",onCheckedChange:C=>m(b,1,C?"enable":"disable")})]})}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs font-medium",children:"学习表达"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),e.jsx(Ge,{checked:y[2]==="enable",onCheckedChange:C=>m(b,2,C?"enable":"disable")})]})}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs font-medium",children:"启用黑话学习"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦在此聊天流中学习和记录黑话"})]}),e.jsx(Ge,{checked:y[3]==="true"||y[3]==="enable",onCheckedChange:C=>m(b,3,C?"true":"false")})]})})]})]},b)}),l.learning_list.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达优化配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何优化和改进表达方式"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"expression_self_reflect",className:"cursor-pointer font-medium",children:"自动表达优化"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后,麦麦会自动检查并优化表达方式,无需管理员手动干预"})]}),e.jsx(Ge,{id:"expression_self_reflect",checked:l.expression_self_reflect??!1,onCheckedChange:y=>r({...l,expression_self_reflect:y})})]}),l.expression_self_reflect&&e.jsxs("div",{className:"space-y-4 pl-4 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"expression_auto_check_interval",children:"自动检查间隔(秒)"}),e.jsx(ne,{id:"expression_auto_check_interval",type:"number",min:"60",value:l.expression_auto_check_interval??3600,onChange:y=>r({...l,expression_auto_check_interval:parseInt(y.target.value)||3600})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"表达方式自动检查的间隔时间(单位:秒),默认值:3600秒(1小时)"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"expression_auto_check_count",children:"每次检查数量"}),e.jsx(ne,{id:"expression_auto_check_count",type:"number",min:"1",max:"100",value:l.expression_auto_check_count??10,onChange:y=>r({...l,expression_auto_check_count:parseInt(y.target.value)||10})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"每次自动检查时随机选取的表达方式数量,默认值:10条"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"自定义评估标准"}),e.jsxs(_,{onClick:()=>{r({...l,expression_auto_check_custom_criteria:[...l.expression_auto_check_custom_criteria||[],""]})},size:"sm",variant:"outline",children:[e.jsx(at,{className:"h-4 w-4 mr-1"}),"添加标准"]})]}),e.jsxs("div",{className:"space-y-2",children:[(l.expression_auto_check_custom_criteria||[]).map((y,b)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{value:y,onChange:w=>{const A=[...l.expression_auto_check_custom_criteria||[]];A[b]=w.target.value,r({...l,expression_auto_check_custom_criteria:A})},placeholder:"输入评估标准,例如:是否符合角色人设",className:"flex-1"}),e.jsx(_,{onClick:()=>{r({...l,expression_auto_check_custom_criteria:(l.expression_auto_check_custom_criteria||[]).filter((w,A)=>A!==b)})},size:"icon",variant:"ghost",children:e.jsx(us,{className:"h-4 w-4"})})]},b)),(!l.expression_auto_check_custom_criteria||l.expression_auto_check_custom_criteria.length===0)&&e.jsx("div",{className:"text-center py-4 text-muted-foreground text-sm",children:'暂无自定义标准,点击"添加标准"开始配置'})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这些标准会被添加到评估提示词中,作为额外的评估要求"})]})]})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"expression_checked_only",className:"cursor-pointer font-medium",children:"仅使用已审核通过的表达方式"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后,只有通过审核(已检查)的项目会被使用;关闭时,未审核的项目也会被使用。无论开关状态,被拒绝的项目永远不会被使用。"})]}),e.jsx(Ge,{id:"expression_checked_only",checked:l.expression_checked_only??!1,onCheckedChange:y=>r({...l,expression_checked_only:y})})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"expression_manual_reflect",className:"cursor-pointer font-medium",children:"手动表达优化"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后,麦麦会主动向管理员询问表达方式是否合适"})]}),e.jsx(Ge,{id:"expression_manual_reflect",checked:l.expression_manual_reflect??!1,onCheckedChange:y=>r({...l,expression_manual_reflect:y})})]}),l.expression_manual_reflect&&e.jsxs("div",{className:"space-y-4 pl-4 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("span",{className:"text-sm font-medium",children:"反思操作员"})}),e.jsx("div",{className:"space-y-4",children:(()=>{const b=(l.manual_reflect_operator_id||"").split(":"),w=b[0]||"qq",A=b[1]||"",M=b[2]||"private";return e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Pe,{value:w,onValueChange:S=>{r({...l,manual_reflect_operator_id:`${S}:${A}:${M}`})},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"qq",children:"QQ"}),e.jsx(ee,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"用户/群 ID"}),e.jsx(ne,{value:A,onChange:S=>{r({...l,manual_reflect_operator_id:`${w}:${S.target.value}:${M}`})},placeholder:"输入 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Pe,{value:M,onValueChange:S=>{r({...l,manual_reflect_operator_id:`${w}:${A}:${S}`})},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"private",children:"私聊(private)"}),e.jsx(ee,{value:"group",children:"群组(group)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前操作员 ID:",l.manual_reflect_operator_id||"(未设置)"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'手动表达优化操作员ID,格式:platform:id:type (例如 "qq:123456:private" 或 "qq:654321:group")'})]})})()})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium",children:"允许进行表达反思的聊天流"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"只有在此列表中的聊天流才会提出问题并跟踪。如果列表为空,则所有聊天流都可以进行表达反思(前提是启用了手动表达优化)"})]}),e.jsxs(_,{onClick:()=>{r({...l,allow_reflect:[...l.allow_reflect||[],"qq::group"]})},size:"sm",variant:"outline",children:[e.jsx(at,{className:"h-4 w-4 mr-1"}),"添加聊天流"]})]}),e.jsxs("div",{className:"space-y-2",children:[(l.allow_reflect||[]).map((y,b)=>{const w=y.split(":"),A=w[0]||"qq",M=w[1]||"",S=w[2]||"group";return e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-muted/50",children:[e.jsxs(Pe,{value:A,onValueChange:P=>{const E=[...l.allow_reflect];E[b]=`${P}:${M}:${S}`,r({...l,allow_reflect:E})},children:[e.jsx(Be,{className:"w-24",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"qq",children:"QQ"}),e.jsx(ee,{value:"wx",children:"微信"})]})]}),e.jsx(ne,{value:M,onChange:P=>{const E=[...l.allow_reflect];E[b]=`${A}:${P.target.value}:${S}`,r({...l,allow_reflect:E})},placeholder:"ID",className:"flex-1 font-mono text-sm"}),e.jsxs(Pe,{value:S,onValueChange:P=>{const E=[...l.allow_reflect];E[b]=`${A}:${M}:${P}`,r({...l,allow_reflect:E})},children:[e.jsx(Be,{className:"w-32",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"group",children:"群组"}),e.jsx(ee,{value:"private",children:"私聊"})]})]}),e.jsx(_,{onClick:()=>{r({...l,allow_reflect:l.allow_reflect.filter((P,E)=>E!==b)})},size:"sm",variant:"ghost",children:e.jsx(us,{className:"h-4 w-4"})})]},b)}),(!l.allow_reflect||l.allow_reflect.length===0)&&e.jsx("div",{className:"text-center py-4 text-muted-foreground text-sm",children:"列表为空,所有聊天流都可以进行表达反思"})]})]})]})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),e.jsxs(_,{onClick:f,size:"sm",variant:"outline",children:[e.jsx(at,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),e.jsxs("div",{className:"space-y-4",children:[l.expression_groups.map((y,b)=>{const w=l.learning_list.map(A=>A[0]).filter(A=>A!=="");return e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",b+1,y.length===1&&y[0]==="*"&&"(全局共享)"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{onClick:()=>g(b),size:"sm",variant:"outline",children:e.jsx(at,{className:"h-4 w-4"})}),e.jsxs(Cs,{children:[e.jsx(_t,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(us,{className:"h-4 w-4"})})}),e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认删除"}),e.jsxs(Ns,{children:["确定要删除共享组 ",b+1," 吗?此操作无法撤销。"]})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:()=>p(b),children:"删除"})]})]})]})]})]}),e.jsx("div",{className:"space-y-2",children:y.map((A,M)=>e.jsx(nS,{member:A,groupIndex:b,memberIndex:M,availableChatIds:w,onUpdate:j,onRemove:N},`${b}-${M}`))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},b)}),l.expression_groups.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})});function iS({regex:a,reaction:l,onRegexChange:r,onReactionChange:c}){const[d,m]=u.useState(!1),[h,f]=u.useState(""),[p,g]=u.useState(null),[N,j]=u.useState(""),[y,b]=u.useState({}),[w,A]=u.useState(""),M=u.useRef(null),[S,P]=u.useState("build"),E=O=>O.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),C=(O,X=0)=>{const L=M.current;if(!L)return;const me=L.selectionStart||0,Ne=L.selectionEnd||0,je=a.substring(0,me)+O+a.substring(Ne);r(je),setTimeout(()=>{const ce=me+O.length+X;L.setSelectionRange(ce,ce),L.focus()},0)};u.useEffect(()=>{if(!a||!h){p!==null&&g(null),Object.keys(y).length>0&&b({}),w!==l&&A(l),N!==""&&j("");return}try{const O=E(a),X=new RegExp(O,"g"),L=h.match(X);g(L),j("");const Ne=new RegExp(O).exec(h);if(Ne&&Ne.groups){b(Ne.groups);let je=l;Object.entries(Ne.groups).forEach(([ce,ge])=>{je=je.replace(new RegExp(`\\[${ce}\\]`,"g"),ge||"")}),A(je)}else b({}),A(l)}catch(O){j(O.message),g(null),b({}),A(l)}},[a,h,l,p,y,w,N]);const R=()=>{if(!h||!p||p.length===0)return e.jsx("span",{className:"text-muted-foreground",children:h||"请输入测试文本"});try{const O=E(a),X=new RegExp(O,"g");let L=0;const me=[];let Ne;for(;(Ne=X.exec(h))!==null;)Ne.index>L&&me.push(e.jsx("span",{children:h.substring(L,Ne.index)},`text-${L}`)),me.push(e.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:Ne[0]},`match-${Ne.index}`)),L=Ne.index+Ne[0].length;return L)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return e.jsxs(Js,{open:d,onOpenChange:m,children:[e.jsx(cd,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ix,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),e.jsxs(qs,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[e.jsxs(Vs,{children:[e.jsx(Gs,{children:"正则表达式编辑器"}),e.jsx(nt,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),e.jsx(ss,{className:"max-h-[calc(90vh-120px)]",children:e.jsxs(Yt,{value:S,onValueChange:O=>P(O),className:"w-full",children:[e.jsxs(Vt,{className:"grid w-full grid-cols-2",children:[e.jsx(Ye,{value:"build",children:"🔧 构建器"}),e.jsx(Ye,{value:"test",children:"🧪 测试器"})]}),e.jsxs(Ms,{value:"build",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"正则表达式"}),e.jsx(ne,{ref:M,value:a,onChange:O=>r(O.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"Reaction 内容"}),e.jsx(ft,{value:l,onChange:O=>c(O.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),e.jsxs("div",{className:"space-y-4 border-t pt-4",children:[H.map(O=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:O.category}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:O.items.map(X=>e.jsx(_,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>C(X.pattern,X.moveCursor||0),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsx("span",{className:"text-xs font-medium",children:X.label}),e.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:X.pattern})]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:X.desc})]})},X.label))})]},O.category)),e.jsxs("div",{className:"space-y-2 border-t pt-4",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("^(?P\\S{1,20})是这样的$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),e.jsx(_,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),e.jsx(_,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("(?P.+?)(?:是|为什么|怎么)"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),e.jsxs("li",{children:["命名捕获组格式:",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),e.jsxs("li",{children:["在 reaction 中使用 ",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),e.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),e.jsxs(Ms,{value:"test",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"当前正则表达式"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:a||"(未设置)"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),e.jsx(ft,{id:"test-text",value:h,onChange:O=>f(O.target.value),placeholder:`在此输入要测试的文本... +例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),N&&e.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[e.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),e.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:N})]}),!N&&h&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:p&&p.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),e.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",p.length," 处)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"匹配高亮"}),e.jsx(ss,{className:"h-40 rounded-md bg-muted p-3",children:e.jsx("div",{className:"text-sm break-words",children:R()})})]}),Object.keys(y).length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"命名捕获组"}),e.jsx(ss,{className:"h-32 rounded-md border p-3",children:e.jsx("div",{className:"space-y-2",children:Object.entries(y).map(([O,X])=>e.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[e.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",O,"]"]}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:X})]},O))})})]}),Object.keys(y).length>0&&l&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"Reaction 替换预览"}),e.jsx(ss,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:e.jsx("div",{className:"text-sm break-words",children:w})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),e.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),e.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),e.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})}const cS=Hs.memo(function({keywordReactionConfig:l,responsePostProcessConfig:r,chineseTypoConfig:c,responseSplitterConfig:d,onKeywordReactionChange:m,onResponsePostProcessChange:h,onChineseTypoChange:f,onResponseSplitterChange:p}){const g=()=>{m({...l,regex_rules:[...l.regex_rules,{regex:[""],reaction:""}]})},N=C=>{m({...l,regex_rules:l.regex_rules.filter((R,H)=>H!==C)})},j=(C,R,H)=>{const O=[...l.regex_rules];R==="regex"&&typeof H=="string"?O[C]={...O[C],regex:[H]}:R==="reaction"&&typeof H=="string"&&(O[C]={...O[C],reaction:H}),m({...l,regex_rules:O})},y=()=>{m({...l,keyword_rules:[...l.keyword_rules,{keywords:[],reaction:""}]})},b=C=>{m({...l,keyword_rules:l.keyword_rules.filter((R,H)=>H!==C)})},w=(C,R,H)=>{const O=[...l.keyword_rules];typeof H=="string"&&(O[C]={...O[C],reaction:H}),m({...l,keyword_rules:O})},A=C=>{const R=[...l.keyword_rules];R[C]={...R[C],keywords:[...R[C].keywords||[],""]},m({...l,keyword_rules:R})},M=(C,R)=>{const H=[...l.keyword_rules];H[C]={...H[C],keywords:(H[C].keywords||[]).filter((O,X)=>X!==R)},m({...l,keyword_rules:H})},S=(C,R,H)=>{const O=[...l.keyword_rules],X=[...O[C].keywords||[]];X[R]=H,O[C]={...O[C],keywords:X},m({...l,keyword_rules:O})},P=({rule:C})=>{const R=`{ regex = [${(C.regex||[]).map(H=>`"${H}"`).join(", ")}], reaction = "${C.reaction}" }`;return e.jsxs(hl,{children:[e.jsx(fl,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ma,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(nl,{className:"w-[95vw] sm:w-[500px]",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx(ss,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs break-all",children:R})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},E=({rule:C})=>{const R=`[[keyword_reaction.keyword_rules]] +keywords = [${(C.keywords||[]).map(H=>`"${H}"`).join(", ")}] +reaction = "${C.reaction}"`;return e.jsxs(hl,{children:[e.jsx(fl,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ma,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(nl,{className:"w-[95vw] sm:w-[500px]",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx(ss,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:R})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),e.jsxs(_,{onClick:g,size:"sm",variant:"outline",children:[e.jsx(at,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[l.regex_rules.map((C,R)=>e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",R+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(iS,{regex:C.regex&&C.regex[0]||"",reaction:C.reaction,onRegexChange:H=>j(R,"regex",H),onReactionChange:H=>j(R,"reaction",H)}),e.jsx(P,{rule:C}),e.jsxs(Cs,{children:[e.jsx(_t,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(us,{className:"h-4 w-4"})})}),e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认删除"}),e.jsxs(Ns,{children:["确定要删除正则规则 ",R+1," 吗?此操作无法撤销。"]})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:()=>N(R),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),e.jsx(ne,{value:C.regex&&C.regex[0]||"",onChange:H=>j(R,"regex",H.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"反应内容"}),e.jsx(ft,{value:C.reaction,onChange:H=>j(R,"reaction",H.target.value),placeholder:`触发后麦麦的反应... +可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},R)),l.regex_rules.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),e.jsxs("div",{className:"space-y-4 border-t pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),e.jsxs(_,{onClick:y,size:"sm",variant:"outline",children:[e.jsx(at,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[l.keyword_rules.map((C,R)=>e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",R+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{rule:C}),e.jsxs(Cs,{children:[e.jsx(_t,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(us,{className:"h-4 w-4"})})}),e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认删除"}),e.jsxs(Ns,{children:["确定要删除关键词规则 ",R+1," 吗?此操作无法撤销。"]})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:()=>b(R),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-xs font-medium",children:"关键词列表"}),e.jsxs(_,{onClick:()=>A(R),size:"sm",variant:"ghost",children:[e.jsx(at,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),e.jsxs("div",{className:"space-y-2",children:[(C.keywords||[]).map((H,O)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{value:H,onChange:X=>S(R,O,X.target.value),placeholder:"关键词",className:"flex-1"}),e.jsx(_,{onClick:()=>M(R,O),size:"sm",variant:"ghost",children:e.jsx(us,{className:"h-4 w-4"})})]},O)),(!C.keywords||C.keywords.length===0)&&e.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"反应内容"}),e.jsx(ft,{value:C.reaction,onChange:H=>w(R,"reaction",H.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},R)),l.keyword_rules.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_response_post_process",checked:r.enable_response_post_process,onCheckedChange:C=>h({...r,enable_response_post_process:C})}),e.jsx(T,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),r.enable_response_post_process&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t pt-6 space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[e.jsx(Ge,{id:"enable_chinese_typo",checked:c.enable,onCheckedChange:C=>f({...c,enable:C})}),e.jsx(T,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),c.enable&&e.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),e.jsx(ne,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:c.error_rate,onChange:C=>f({...c,error_rate:parseFloat(C.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),e.jsx(ne,{id:"min_freq",type:"number",min:"0",value:c.min_freq,onChange:C=>f({...c,min_freq:parseInt(C.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),e.jsx(ne,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:c.tone_error_rate,onChange:C=>f({...c,tone_error_rate:parseFloat(C.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),e.jsx(ne,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:c.word_replace_rate,onChange:C=>f({...c,word_replace_rate:parseFloat(C.target.value)})})]})]})]})}),e.jsx("div",{className:"border-t pt-6 space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[e.jsx(Ge,{id:"enable_response_splitter",checked:d.enable,onCheckedChange:C=>p({...d,enable:C})}),e.jsx(T,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),d.enable&&e.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),e.jsx(ne,{id:"max_length",type:"number",min:"1",value:d.max_length,onChange:C=>p({...d,max_length:parseInt(C.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),e.jsx(ne,{id:"max_sentence_num",type:"number",min:"1",value:d.max_sentence_num,onChange:C=>p({...d,max_sentence_num:parseInt(C.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_kaomoji_protection",checked:d.enable_kaomoji_protection,onCheckedChange:C=>p({...d,enable_kaomoji_protection:C})}),e.jsx(T,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_overflow_return_all",checked:d.enable_overflow_return_all,onCheckedChange:C=>p({...d,enable_overflow_return_all:C})}),e.jsx(T,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})});function oS({config:a,onChange:l}){const[r,c]=u.useState(""),[d,m]=u.useState(""),h=()=>{const y=r.trim();y&&!a.ban_words.includes(y)&&(l({...a,ban_words:[...a.ban_words,y]}),c(""))},f=y=>{l({...a,ban_words:a.ban_words.filter((b,w)=>w!==y)})},p=y=>{y.key==="Enter"&&(y.preventDefault(),h())},g=()=>{const y=d.trim();if(y&&!a.ban_msgs_regex.includes(y))try{new RegExp(y),l({...a,ban_msgs_regex:[...a.ban_msgs_regex,y]}),m("")}catch(b){alert(`正则表达式语法错误:${b.message}`)}},N=y=>{l({...a,ban_msgs_regex:a.ban_msgs_regex.filter((b,w)=>w!==y)})},j=y=>{y.key==="Enter"&&(y.preventDefault(),g())};return e.jsx("div",{className:"space-y-6",children:e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Ue,{children:"消息过滤配置"}),e.jsx(fs,{children:"配置消息过滤规则,过滤特定消息或在特定群组启用静默模式"})]}),e.jsx(Ae,{children:e.jsxs(Yt,{defaultValue:"ban_words",className:"w-full",children:[e.jsxs(Vt,{className:"grid w-full grid-cols-2",children:[e.jsx(Ye,{value:"ban_words",children:"禁用关键词"}),e.jsx(Ye,{value:"ban_regex",children:"禁用正则"})]}),e.jsx(Ms,{value:"ban_words",className:"space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(qt,{className:"h-4 w-4 text-yellow-500 mt-1 flex-shrink-0"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"包含以下关键词的消息将被过滤,Bot 不会读取这些消息"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{placeholder:"输入要禁用的关键词(按回车添加)",value:r,onChange:y=>c(y.target.value),onKeyDown:p}),e.jsx(_,{onClick:h,size:"icon",children:e.jsx(at,{className:"h-4 w-4"})})]}),a.ban_words.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-8 text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁用关键词,点击上方添加"})}):e.jsx("div",{className:"space-y-2",children:a.ban_words.map((y,b)=>e.jsxs("div",{className:"flex items-center justify-between rounded-md border p-3",children:[e.jsx("code",{className:"text-sm",children:y}),e.jsxs(Cs,{children:[e.jsx(_t,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"icon",children:e.jsx(us,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认删除"}),e.jsxs(Ns,{children:["确定要删除关键词 ",e.jsxs("code",{children:['"',y,'"']})," 吗?"]})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:()=>f(b),children:"删除"})]})]})]})]},b))})]})}),e.jsx(Ms,{value:"ban_regex",className:"space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(qt,{className:"h-4 w-4 text-yellow-500 mt-1 flex-shrink-0"}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsx("p",{children:"匹配以下正则表达式的消息将被过滤"}),e.jsx("p",{className:"text-xs",children:"⚠️ 若不了解正则表达式,请勿随意修改"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ft,{placeholder:`输入正则表达式(按回车添加) +示例:https?://[^\\s]+ 匹配链接`,value:d,onChange:y=>m(y.target.value),onKeyDown:j,className:"min-h-[60px] font-mono text-sm"}),e.jsx(_,{onClick:g,size:"icon",children:e.jsx(at,{className:"h-4 w-4"})})]}),a.ban_msgs_regex.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-8 text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁用正则表达式,点击上方添加"})}):e.jsx("div",{className:"space-y-2",children:a.ban_msgs_regex.map((y,b)=>e.jsxs("div",{className:"flex items-center justify-between rounded-md border p-3",children:[e.jsx("code",{className:"text-sm font-mono flex-1 break-all",children:y}),e.jsxs(Cs,{children:[e.jsx(_t,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"icon",className:"ml-2 flex-shrink-0",children:e.jsx(us,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认删除"}),e.jsxs(Ns,{children:["确定要删除正则表达式 ",e.jsxs("code",{children:['"',y,'"']})," 吗?"]})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:()=>N(b),children:"删除"})]})]})]})]},b))})]})})]})})]})})}const dS=Hs.memo(function({config:l,onChange:r}){const[c,d]=u.useState(""),[m,h]=u.useState(""),[f,p]=u.useState(!1),g=l.allowed_ips?l.allowed_ips.split(",").map(S=>S.trim()).filter(S=>S):[],N=l.trusted_proxies?l.trusted_proxies.split(",").map(S=>S.trim()).filter(S=>S):[],j=()=>{if(!c.trim())return;const S=[...g,c.trim()];r({...l,allowed_ips:S.join(",")}),d("")},y=S=>{const P=g.filter((E,C)=>C!==S);r({...l,allowed_ips:P.join(",")})},b=()=>{if(!m.trim())return;const S=[...N,m.trim()];r({...l,trusted_proxies:S.join(",")}),h("")},w=S=>{const P=N.filter((E,C)=>C!==S);r({...l,trusted_proxies:P.join(",")})},A=S=>{!S&&l.enabled?p(!0):r({...l,enabled:S})},M=()=>{r({...l,enabled:!1}),p(!1)};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"WebUI 服务配置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.enabled,onCheckedChange:A}),e.jsx(T,{className:"cursor-pointer",children:"启用 WebUI"})]}),l.enabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"运行模式"}),e.jsxs(Pe,{value:l.mode,onValueChange:S=>r({...l,mode:S}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择运行模式"})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"development",children:"开发模式"}),e.jsx(ee,{value:"production",children:"生产模式"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"注意: WebUI 的监听地址和端口请在 .env 文件中配置 WEBUI_HOST 和 WEBUI_PORT"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"防爬虫模式"}),e.jsxs(Pe,{value:l.anti_crawler_mode,onValueChange:S=>r({...l,anti_crawler_mode:S}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择防爬虫模式"})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"false",children:"禁用"}),e.jsx(ee,{value:"basic",children:"基础(只记录不阻止)"}),e.jsx(ee,{value:"loose",children:"宽松"}),e.jsx(ee,{value:"strict",children:"严格"})]})]})]}),e.jsxs("div",{className:"grid gap-2 sm:col-span-2",children:[e.jsx(T,{children:"IP 白名单"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{value:c,onChange:S=>d(S.target.value),onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),j())},placeholder:"输入IP地址后按回车或点击添加"}),e.jsx(_,{type:"button",size:"sm",onClick:j,disabled:!c.trim(),children:e.jsx(at,{className:"h-4 w-4"})})]}),g.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:g.map((S,P)=>e.jsxs(ke,{variant:"secondary",className:"flex items-center gap-1",children:[S,e.jsx("button",{type:"button",onClick:()=>y(P),className:"ml-1 hover:bg-destructive/20 rounded-full p-0.5",children:e.jsx(_a,{className:"h-3 w-3"})})]},P))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"支持精确IP、CIDR格式和通配符(如:127.0.0.1、192.168.1.0/24)"})]}),e.jsxs("div",{className:"grid gap-2 sm:col-span-2",children:[e.jsx(T,{children:"信任的代理 IP"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{value:m,onChange:S=>h(S.target.value),onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),b())},placeholder:"输入代理IP后按回车或点击添加"}),e.jsx(_,{type:"button",size:"sm",onClick:b,disabled:!m.trim(),children:e.jsx(at,{className:"h-4 w-4"})})]}),N.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:N.map((S,P)=>e.jsxs(ke,{variant:"secondary",className:"flex items-center gap-1",children:[S,e.jsx("button",{type:"button",onClick:()=>w(P),className:"ml-1 hover:bg-destructive/20 rounded-full p-0.5",children:e.jsx(_a,{className:"h-3 w-3"})})]},P))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只有来自这些IP的X-Forwarded-For头才被信任"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.trust_xff,onCheckedChange:S=>r({...l,trust_xff:S})}),e.jsx(T,{className:"cursor-pointer",children:"启用 X-Forwarded-For 代理解析"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.secure_cookie,onCheckedChange:S=>r({...l,secure_cookie:S})}),e.jsx(T,{className:"cursor-pointer",children:"启用安全 Cookie(仅 HTTPS)"})]})]})]}),e.jsx(Cs,{open:f,onOpenChange:p,children:e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"警告:即将关闭 WebUI"}),e.jsxs(Ns,{children:["关闭 WebUI 后,在您下次重启麦麦之前,WebUI 界面将无法访问。",e.jsx("br",{}),e.jsx("br",{}),"您需要通过修改配置文件或命令行重新启用 WebUI 才能再次访问此界面。",e.jsx("br",{}),e.jsx("br",{}),"确定要关闭 WebUI 吗?"]})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{variant:"destructive",onClick:M,children:"确认关闭"})]})]})})]})}),Sn="/api/webui/config";async function $g(){const l=await(await Se(`${Sn}/bot`)).json();if(!l.success)throw new Error("获取配置数据失败");return l.config}async function pn(){const l=await(await Se(`${Sn}/model`)).json();if(!l.success)throw new Error("获取模型配置数据失败");return l.config}async function Bg(a){const r=await(await Se(`${Sn}/bot`,{method:"POST",body:JSON.stringify(a)})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}async function uS(){const l=await(await Se(`${Sn}/bot/raw`)).json();if(!l.success)throw new Error("获取配置源代码失败");return l.content}async function mS(a){const r=await(await Se(`${Sn}/bot/raw`,{method:"POST",body:JSON.stringify({raw_content:a})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}async function tc(a){const r=await(await Se(`${Sn}/model`,{method:"POST",body:JSON.stringify(a)})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}async function xS(a,l){const c=await(await Se(`${Sn}/bot/section/${a}`,{method:"POST",body:JSON.stringify(l)})).json();if(!c.success)throw new Error(c.message||`保存配置节 ${a} 失败`)}async function Xm(a,l){const c=await(await Se(`${Sn}/model/section/${a}`,{method:"POST",body:JSON.stringify(l)})).json();if(!c.success)throw new Error(c.message||`保存配置节 ${a} 失败`)}async function hS(a,l="openai",r="/models"){const c=new URLSearchParams({provider_name:a,parser:l,endpoint:r}),d=await Se(`/api/webui/models/list?${c}`);if(!d.ok){const h=await d.json().catch(()=>({}));throw new Error(h.detail||`获取模型列表失败 (${d.status})`)}const m=await d.json();if(!m.success)throw new Error("获取模型列表失败");return m.models}async function fS(a){const l=new URLSearchParams({provider_name:a}),r=await Se(`/api/webui/models/test-connection-by-name?${l}`,{method:"POST"});if(!r.ok){const c=await r.json().catch(()=>({}));throw new Error(c.detail||`测试连接失败 (${r.status})`)}return await r.json()}const pS=ei("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),pt=u.forwardRef(({className:a,variant:l,...r},c)=>e.jsx("div",{ref:c,role:"alert",className:F(pS({variant:l}),a),...r}));pt.displayName="Alert";const Qn=u.forwardRef(({className:a,...l},r)=>e.jsx("h5",{ref:r,className:F("mb-1 font-medium leading-none tracking-tight",a),...l}));Qn.displayName="AlertTitle";const gt=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:F("text-sm [&_p]:leading-relaxed",a),...l}));gt.displayName="AlertDescription";const gS={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(a,l){let r;if(!l.inString&&(r=a.match(/^('''|"""|'|")/))&&(l.stringType=r[0],l.inString=!0),a.sol()&&!l.inString&&l.inArray===0&&(l.lhs=!0),l.inString){for(;l.inString;)if(a.match(l.stringType))l.inString=!1;else if(a.peek()==="\\")a.next(),a.next();else{if(a.eol())break;a.match(/^.[^\\\"\']*/)}return l.lhs?"property":"string"}else{if(l.inArray&&a.peek()==="]")return a.next(),l.inArray--,"bracket";if(l.lhs&&a.peek()==="["&&a.skipTo("]"))return a.next(),a.peek()==="]"&&a.next(),"atom";if(a.peek()==="#")return a.skipToEnd(),"comment";if(a.eatSpace())return null;if(l.lhs&&a.eatWhile(function(c){return c!="="&&c!=" "}))return"property";if(l.lhs&&a.peek()==="=")return a.next(),l.lhs=!1,null;if(!l.lhs&&a.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!l.lhs&&(a.match("true")||a.match("false")))return"atom";if(!l.lhs&&a.peek()==="[")return l.inArray++,a.next(),"bracket";if(!l.lhs&&a.match(/^\-?\d+(?:\.\d+)?/))return"number";a.eatSpace()||a.next()}return null},languageData:{commentTokens:{line:"#"}}},jS={python:[l_()],json:[n_(),r_()],toml:[a_.define(gS)],text:[]};function Vv({value:a,onChange:l,language:r="text",readOnly:c=!1,height:d="400px",minHeight:m,maxHeight:h,placeholder:f,theme:p="dark",className:g=""}){const[N,j]=u.useState(!1);if(u.useEffect(()=>{j(!0)},[]),!N)return e.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${g}`,style:{height:d,minHeight:m,maxHeight:h}});const y=[...jS[r]||[],Am.lineWrapping,Am.theme({"&":{fontFamily:'"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace'},".cm-content":{fontFamily:'"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace'},".cm-gutters":{fontFamily:'"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace'},".cm-scroller":{fontFamily:'"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace'}})];return c&&y.push(Am.editable.of(!1)),e.jsx("div",{className:`rounded-md overflow-hidden border custom-scrollbar ${g}`,children:e.jsx(i_,{value:a,height:d,minHeight:m,maxHeight:h,theme:p==="dark"?c_:void 0,extensions:y,onChange:l,placeholder:f,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,foldGutter:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,syntaxHighlighting:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0}})})}function vS({id:a,index:l,itemType:r,itemFields:c,value:d,onChange:m,onRemove:h,disabled:f,canRemove:p,placeholder:g}){const{attributes:N,listeners:j,setNodeRef:y,transform:b,transition:w,isDragging:A}=_v({id:a,disabled:f}),M={transform:Sv.Transform.toString(b),transition:w};return e.jsxs("div",{ref:y,style:M,className:F("flex items-start gap-2 group",A&&"opacity-50 z-50"),children:[e.jsx("button",{type:"button",className:F("flex-shrink-0 p-2 cursor-grab active:cursor-grabbing","text-muted-foreground hover:text-foreground transition-colors","opacity-0 group-hover:opacity-100 focus:opacity-100",f&&"cursor-not-allowed opacity-30"),...N,...j,children:e.jsx(rv,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex-1 min-w-0",children:r==="object"&&c?e.jsx(NS,{value:d,onChange:m,fields:c,disabled:f}):r==="number"?e.jsx(ne,{type:"number",value:d??"",onChange:S=>m(parseFloat(S.target.value)||0),placeholder:g??`第 ${l+1} 项`,disabled:f,className:"font-mono"}):e.jsx(ne,{type:"text",value:d??"",onChange:S=>m(S.target.value),placeholder:g??`第 ${l+1} 项`,disabled:f})}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",onClick:h,disabled:f||!p,className:F("flex-shrink-0 text-muted-foreground hover:text-destructive","opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity"),children:e.jsx(us,{className:"h-4 w-4"})})]})}function NS({value:a,onChange:l,fields:r,disabled:c}){const d=u.useCallback((h,f)=>{l({...a,[h]:f})},[a,l]),m=(h,f)=>{const p=a?.[h];if(f.type==="boolean"||f.type==="switch")return e.jsxs("div",{className:"flex items-center justify-between py-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(Ge,{checked:!!(p??f.default),onCheckedChange:g=>d(h,g),disabled:c})]});if(f.type==="slider"||f.type==="number"&&f.min!=null&&f.max!=null){const g=p??f.default??f.min??0;return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx("span",{className:"text-xs text-muted-foreground",children:g})]}),e.jsx(Wa,{value:[g],onValueChange:N=>d(h,N[0]),min:f.min??0,max:f.max??100,step:f.step??1,disabled:c,className:"py-1"})]})}return f.type==="select"&&f.choices?e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsxs(Pe,{value:String(p??f.default??""),onValueChange:g=>d(h,g),disabled:c,children:[e.jsx(Be,{className:"h-8 text-sm",children:e.jsx(Fe,{placeholder:f.placeholder??"请选择"})}),e.jsx(Ie,{children:f.choices.map(g=>e.jsx(ee,{value:String(g),children:String(g)},String(g)))})]})]}):f.type==="number"?e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(ne,{type:"number",value:p??f.default??"",onChange:g=>d(h,parseFloat(g.target.value)||0),placeholder:f.placeholder,disabled:c,className:"h-8 text-sm"})]}):e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(ne,{type:"text",value:p??f.default??"",onChange:g=>d(h,g.target.value),placeholder:f.placeholder,disabled:c,className:"h-8 text-sm"})]})};return e.jsx(Ce,{className:"p-3 space-y-2 bg-muted/30",children:Object.entries(r).map(([h,f])=>e.jsx("div",{children:m(h,f)},h))})}function bS({value:a,onChange:l,itemType:r="string",itemFields:c,minItems:d,maxItems:m,disabled:h,placeholder:f}){const p=u.useMemo(()=>Array.isArray(a)?a:typeof a=="string"&&a.trim()?a.split(",").map(E=>E.trim()):[],[a]),[g]=u.useState(()=>new Map),N=u.useCallback(E=>(g.has(E)||g.set(E,`item-${Date.now()}-${E}-${Math.random().toString(36).slice(2)}`),g.get(E)),[g]),j=u.useMemo(()=>{const E=[];for(let C=0;C{const{active:C,over:R}=E;if(R&&C.id!==R.id){const H=j.indexOf(C.id),O=j.indexOf(R.id),X=Nv(p,H,O);l(X)}},[p,j,l]),w=u.useCallback(()=>{if(m!=null&&p.length>=m)return;let E;r==="object"&&c?E=Object.fromEntries(Object.entries(c).map(([C,R])=>[C,R.default??""])):r==="number"?E=0:E="",l([...p,E])},[p,m,r,c,l]),A=u.useCallback((E,C)=>{const R=[...p];R[E]=C,l(R)},[p,l]),M=u.useCallback(E=>{if(d!=null&&p.length<=d)return;const C=p.filter((R,H)=>H!==E);g.delete(E),l(C)},[p,d,g,l]),S=m==null||p.lengthd;return e.jsxs("div",{className:"space-y-2",children:[p.length===0?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-4 justify-center border border-dashed rounded-md",children:[e.jsx(Rt,{className:"h-4 w-4"}),e.jsx("span",{children:"暂无数据,点击下方按钮添加"})]}):e.jsx(bv,{sensors:y,collisionDetection:yv,onDragEnd:b,children:e.jsx(wv,{items:j,strategy:o_,children:e.jsx("div",{className:"space-y-2",children:p.map((E,C)=>e.jsx(vS,{id:j[C],index:C,itemType:r,itemFields:c,value:E,onChange:R=>A(C,R),onRemove:()=>M(C),disabled:h,canRemove:P,placeholder:f},j[C]))})})}),e.jsxs(_,{type:"button",variant:"outline",size:"sm",onClick:w,disabled:h||!S,className:"w-full",children:[e.jsx(at,{className:"h-4 w-4 mr-1"}),"添加项目",m!==void 0&&e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",p.length,"/",m,")"]})]}),(d!=null||m!=null)&&(d!==null||m!==null)&&e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:d!=null&&m!=null?`允许 ${d} - ${m} 项`:d!=null?`至少 ${d} 项`:`最多 ${m} 项`})]})}function gx({content:a,className:l=""}){return e.jsx("div",{className:`prose prose-sm dark:prose-invert max-w-none ${l}`,children:e.jsx(f_,{remarkPlugins:[g_,j_],rehypePlugins:[p_],components:{code({inline:r,className:c,children:d,...m}){return r?e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-sm font-mono",...m,children:d}):e.jsx("code",{className:`${c} block bg-muted p-4 rounded-lg overflow-x-auto`,...m,children:d})},table({children:r,...c}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsx("table",{className:"border-collapse border border-border",...c,children:r})})},th({children:r,...c}){return e.jsx("th",{className:"border border-border bg-muted px-4 py-2 text-left font-semibold",...c,children:r})},td({children:r,...c}){return e.jsx("td",{className:"border border-border px-4 py-2",...c,children:r})},a({children:r,...c}){return e.jsx("a",{className:"text-primary hover:underline",target:"_blank",rel:"noopener noreferrer",...c,children:r})},blockquote({children:r,...c}){return e.jsx("blockquote",{className:"border-l-4 border-primary pl-4 italic text-muted-foreground",...c,children:r})},h1({children:r,...c}){return e.jsx("h1",{className:"text-3xl font-bold mt-6 mb-4",...c,children:r})},h2({children:r,...c}){return e.jsx("h2",{className:"text-2xl font-bold mt-5 mb-3",...c,children:r})},h3({children:r,...c}){return e.jsx("h3",{className:"text-xl font-bold mt-4 mb-2",...c,children:r})},h4({children:r,...c}){return e.jsx("h4",{className:"text-lg font-semibold mt-3 mb-2",...c,children:r})},ul({children:r,...c}){return e.jsx("ul",{className:"list-disc list-inside space-y-1 my-2",...c,children:r})},ol({children:r,...c}){return e.jsx("ol",{className:"list-decimal list-inside space-y-1 my-2",...c,children:r})},p({children:r,...c}){return e.jsx("p",{className:"my-2 leading-relaxed",...c,children:r})},hr({...r}){return e.jsx("hr",{className:"my-4 border-border",...r})}},children:a})})}function yS(a,l){let r=a.slice(0,l).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function wS(a,l,r){let c=a.split(/\r\n|\n|\r/g),d="",m=(Math.log10(l+1)|0)+1;for(let h=l-1;h<=l+1;h++){let f=c[h-1];f&&(d+=h.toString().padEnd(m," "),d+=": ",d+=f,d+=` +`,h===l&&(d+=" ".repeat(m+r+2),d+=`^ +`))}return d}class Os extends Error{line;column;codeblock;constructor(l,r){const[c,d]=yS(r.toml,r.ptr),m=wS(r.toml,c,d);super(`Invalid TOML document: ${l} + +${m}`,r),this.line=c,this.column=d,this.codeblock=m}}function _S(a,l){let r=0;for(;a[l-++r]==="\\";);return--r&&r%2}function Yo(a,l=0,r=a.length){let c=a.indexOf(` +`,l);return a[c-1]==="\r"&&c--,c<=r?c:-1}function jx(a,l){for(let r=l;r-1&&r!=="'"&&_S(a,l));return l>-1&&(l+=c.length,c.length>1&&(a[l]===r&&l++,a[l]===r&&l++)),l}let SS=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;class Qr extends Date{#s=!1;#t=!1;#e=null;constructor(l){let r=!0,c=!0,d="Z";if(typeof l=="string"){let m=l.match(SS);m?(m[1]||(r=!1,l=`0000-01-01T${l}`),c=!!m[2],c&&l[10]===" "&&(l=l.replace(" ","T")),m[2]&&+m[2]>23?l="":(d=m[3]||null,l=l.toUpperCase(),!d&&c&&(l+="Z"))):l=""}super(l),isNaN(this.getTime())||(this.#s=r,this.#t=c,this.#e=d)}isDateTime(){return this.#s&&this.#t}isLocal(){return!this.#s||!this.#t||!this.#e}isDate(){return this.#s&&!this.#t}isTime(){return this.#t&&!this.#s}isValid(){return this.#s||this.#t}toISOString(){let l=super.toISOString();if(this.isDate())return l.slice(0,10);if(this.isTime())return l.slice(11,23);if(this.#e===null)return l.slice(0,-1);if(this.#e==="Z")return l;let r=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return r=this.#e[0]==="-"?r:-r,new Date(this.getTime()-r*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(l,r="Z"){let c=new Qr(l);return c.#e=r,c}static wrapAsLocalDateTime(l){let r=new Qr(l);return r.#e=null,r}static wrapAsLocalDate(l){let r=new Qr(l);return r.#t=!1,r.#e=null,r}static wrapAsLocalTime(l){let r=new Qr(l);return r.#s=!1,r.#e=null,r}}let kS=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,CS=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,TS=/^[+-]?0[0-9_]/,ES=/^[0-9a-f]{4,8}$/i,Pg={b:"\b",t:" ",n:` +`,f:"\f",r:"\r",'"':'"',"\\":"\\"};function Kv(a,l=0,r=a.length){let c=a[l]==="'",d=a[l++]===a[l]&&a[l]===a[l+1];d&&(r-=2,a[l+=2]==="\r"&&l++,a[l]===` +`&&l++);let m=0,h,f="",p=l;for(;l-1&&(jx(a,m),d=d.slice(0,m));let h=d.trimEnd();if(!c){let f=d.indexOf(` +`,h.length);if(f>-1)throw new Os("newlines are not allowed in inline tables",{toml:a,ptr:l+f})}return[h,m]}function vx(a,l,r,c,d){if(c===0)throw new Os("document contains excessively nested structures. aborting.",{toml:a,ptr:l});let m=a[l];if(m==="["||m==="{"){let[p,g]=m==="["?DS(a,l,c,d):RS(a,l,c,d),N=r?Ig(a,g,",",r):g;if(g-N&&r==="}"){let j=Yo(a,g,N);if(j>-1)throw new Os("newlines are not allowed in inline tables",{toml:a,ptr:j})}return[p,N]}let h;if(m==='"'||m==="'"){h=Gv(a,l);let p=Kv(a,l,h);if(r){if(h=Ul(a,h,r!=="]"),a[h]&&a[h]!==","&&a[h]!==r&&a[h]!==` +`&&a[h]!=="\r")throw new Os("unexpected character encountered",{toml:a,ptr:h});h+=+(a[h]===",")}return[p,h]}h=Ig(a,l,",",r);let f=AS(a,l,h-+(a[h-1]===","),r==="]");if(!f[0])throw new Os("incomplete key-value declaration: no value specified",{toml:a,ptr:l});return r&&f[1]>-1&&(h=Ul(a,l+f[1]),h+=+(a[h]===",")),[MS(f[0],a,l,d),h]}let zS=/^[a-zA-Z0-9-_]+[ \t]*$/;function Zm(a,l,r="="){let c=l-1,d=[],m=a.indexOf(r,l);if(m<0)throw new Os("incomplete key-value: cannot find end of key",{toml:a,ptr:l});do{let h=a[l=++c];if(h!==" "&&h!==" ")if(h==='"'||h==="'"){if(h===a[l+1]&&h===a[l+2])throw new Os("multiline strings are not allowed in keys",{toml:a,ptr:l});let f=Gv(a,l);if(f<0)throw new Os("unfinished string encountered",{toml:a,ptr:l});c=a.indexOf(".",f);let p=a.slice(f,c<0||c>m?m:c),g=Yo(p);if(g>-1)throw new Os("newlines are not allowed in keys",{toml:a,ptr:l+c+g});if(p.trimStart())throw new Os("found extra tokens after the string part",{toml:a,ptr:f});if(mm?m:c);if(!zS.test(f))throw new Os("only letter, numbers, dashes and underscores are allowed in keys",{toml:a,ptr:l});d.push(f.trimEnd())}}while(c+1&&c{try{l(!0),await xS(y,b),r(!1),m?.()}catch(w){console.error(`自动保存 ${y} 失败:`,w),r(!0),h?.(w instanceof Error?w:new Error(String(w)))}finally{l(!1)}},[l,r,m,h]),g=u.useCallback((y,b)=>{a||(r(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{p(y,b)},d))},[a,r,p,d]),N=u.useCallback(async(y,b)=>{f.current&&(clearTimeout(f.current),f.current=null),await p(y,b)},[p]),j=u.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null)},[]);return u.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]),{triggerAutoSave:g,saveNow:N,cancelPendingAutoSave:j}}function Ht(a,l,r,c){u.useEffect(()=>{a&&!r&&c(l,a)},[a])}const PS=500;function FS(){return e.jsx(tr,{children:e.jsx(HS,{})})}function HS(){const[a,l]=u.useState(!0),[r,c]=u.useState(!1),[d,m]=u.useState(!1),[h,f]=u.useState(!1),[p,g]=u.useState("visual"),[N,j]=u.useState(""),[y,b]=u.useState(!1),[w,A]=u.useState(""),{toast:M}=it(),{triggerRestart:S,isRestarting:P}=_n(),[E,C]=u.useState(null),[R,H]=u.useState(null),[O,X]=u.useState(null),[L,me]=u.useState(null),[Ne,je]=u.useState(null),[ce,ge]=u.useState(null),[pe,D]=u.useState(null),[K,B]=u.useState(null),[ue,Q]=u.useState(null),[_e,he]=u.useState(null),[Te,V]=u.useState(null),[$,z]=u.useState(null),[G,Re]=u.useState(null),[se,Oe]=u.useState(null),[ns,J]=u.useState(null),[Z,Le]=u.useState(null),[ae,Ee]=u.useState(null),[de,ze]=u.useState(null),[ws,Zs]=u.useState(null),[St,fa]=u.useState(null),xs=u.useRef(!0),Is=u.useRef({}),Y=$e=>{const ms=$e.split(` +`);let os=ms[0];os=os.replace(/^Error:\s*/,"");const rs=[[/Invalid TOML document: unrecognized escape sequence/,"TOML 文档错误:无法识别的转义序列(提示:在双引号字符串中使用 \\\\ 转义反斜杠,或使用单引号字符串)"],[/Invalid TOML document: only letter, numbers, dashes and underscores are allowed in keys/,"TOML 文档错误:键名只能包含字母、数字、短横线和下划线"],[/Invalid TOML document: (.+)/,"TOML 文档错误:$1"],[/Unexpected character.*at line (\d+), column (\d+)/,"第 $1 行第 $2 列:意外的字符"],[/Expected.*at line (\d+), column (\d+)/,"第 $1 行第 $2 列:缺少必要的字符"],[/Invalid.*at line (\d+), column (\d+)/,"第 $1 行第 $2 列:无效的语法"],[/Unterminated string at line (\d+)/,"第 $1 行:字符串未正常结束(缺少引号)"],[/Duplicate key.*at line (\d+)/,"第 $1 行:重复的键名"],[/Invalid escape sequence at line (\d+)/,"第 $1 行:无效的转义序列(提示:在双引号字符串中使用 \\\\ 转义反斜杠)"],[/Expected.*but got.*at line (\d+)/,"第 $1 行:类型不匹配"],[/line (\d+), column (\d+)/,"第 $1 行第 $2 列"],[/Unexpected end of input/,"意外的文件结束(可能缺少闭合符号)"],[/Unexpected token/,"意外的标记"],[/Invalid number/,"无效的数字"],[/Invalid date/,"无效的日期格式"],[/Invalid boolean/,"无效的布尔值(应为 true 或 false)"],[/Unexpected character/,"意外的字符"],[/unrecognized escape sequence/,"无法识别的转义序列"]];for(const[ht,Tt]of rs)if(ht.test(os)){os=os.replace(ht,Tt);break}return ms.length>1?(ms[0]=os,ms.join(` +`)):os},qe=u.useCallback($e=>{Is.current=$e,C($e.bot),H($e.personality);const ms=$e.chat;ms.talk_value_rules||(ms.talk_value_rules=[]),X(ms),me($e.expression),je($e.emoji),ge($e.memory),D($e.tool),B($e.voice),Q($e.message_receive),he($e.dream),V($e.lpmm_knowledge),z($e.keyword_reaction),Re($e.response_post_process),Oe($e.chinese_typo),J($e.response_splitter),Le($e.log),Ee($e.debug),ze($e.maim_message),Zs($e.telemetry),fa($e.webui)},[]),Ke=u.useCallback(()=>({...Is.current,bot:E,personality:R,chat:O,expression:L,emoji:Ne,memory:ce,tool:pe,voice:K,message_receive:ue,dream:_e,lpmm_knowledge:Te,keyword_reaction:$,response_post_process:G,chinese_typo:se,response_splitter:ns,log:Z,debug:ae,maim_message:de,telemetry:ws,webui:St}),[E,R,O,L,Ne,ce,pe,K,ue,_e,Te,$,G,se,ns,Z,ae,de,ws,St]),Ze=u.useCallback(async()=>{try{const ms=(await uS()).replace(/"([^"]*)"/g,(os,rs)=>`"${rs.replace(/\\n/g,` +`).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\\\/g,"\\")}"`);j(ms),b(!1)}catch($e){M({variant:"destructive",title:"加载失败",description:$e instanceof Error?$e.message:"加载源代码失败"})}},[M]),Ts=u.useCallback(async()=>{try{l(!0);const $e=await $g();qe($e),f(!1),xs.current=!1,await Ze()}catch($e){console.error("加载配置失败:",$e),M({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{l(!1)}},[M,Ze,qe]);u.useEffect(()=>{Ts()},[Ts]);const{triggerAutoSave:He,cancelPendingAutoSave:zs}=IS(xs.current,m,f);Ht(E,"bot",xs.current,He),Ht(R,"personality",xs.current,He),Ht(O,"chat",xs.current,He),Ht(L,"expression",xs.current,He),Ht(Ne,"emoji",xs.current,He),Ht(ce,"memory",xs.current,He),Ht(pe,"tool",xs.current,He),Ht(K,"voice",xs.current,He),Ht(_e,"dream",xs.current,He),Ht(Te,"lpmm_knowledge",xs.current,He),Ht($,"keyword_reaction",xs.current,He),Ht(G,"response_post_process",xs.current,He),Ht(se,"chinese_typo",xs.current,He),Ht(ns,"response_splitter",xs.current,He),Ht(Z,"log",xs.current,He),Ht(ae,"debug",xs.current,He),Ht(de,"maim_message",xs.current,He),Ht(ws,"telemetry",xs.current,He),Ht(St,"webui",xs.current,He);const Ls=async()=>{try{c(!0);try{Nx(N)}catch(ms){const os=ms instanceof Error?ms.message:"TOML 格式错误",rs=Y(os);b(!0),A(rs),M({variant:"destructive",title:"TOML 格式错误",description:rs}),c(!1);return}const $e=N.replace(/"([^"]*)"/g,(ms,os)=>`"${os.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")}"`);await mS($e),f(!1),b(!1),A(""),M({title:"保存成功",description:"配置已保存"}),await Ts()}catch($e){b(!0);const ms=$e instanceof Error?$e.message:"保存配置失败";A(ms),M({variant:"destructive",title:"保存失败",description:ms})}finally{c(!1)}},Ks=async $e=>{if(h){M({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}if(g($e),$e==="source")await Ze();else try{const ms=await $g();qe(ms),f(!1)}catch(ms){console.error("加载配置失败:",ms),M({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}},cs=async()=>{try{c(!0),zs(),await Bg(Ke()),f(!1),M({title:"保存成功",description:"麦麦主程序配置已保存"})}catch($e){console.error("保存配置失败:",$e),M({title:"保存失败",description:$e.message,variant:"destructive"})}finally{c(!1)}},ts=async()=>{await S()},_s=async()=>{try{c(!0),zs(),await Bg(Ke()),f(!1),M({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise($e=>setTimeout($e,PS)),await ts()}catch($e){console.error("保存失败:",$e),M({title:"保存失败",description:$e.message,variant:"destructive"})}finally{c(!1)}};return a?e.jsx(ss,{className:"h-full",children:e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):e.jsx(ss,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl md:text-3xl font-bold",children:"麦麦主程序配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs sm:text-sm",children:"管理麦麦的核心功能和行为设置"})]}),e.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[e.jsxs(_,{onClick:p==="visual"?cs:Ls,disabled:r||d||!h||P,size:"sm",variant:"outline",className:"w-20 sm:w-24",children:[e.jsx(fc,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:r?"保存中":d?"自动":h?"保存":"已保存"})]}),e.jsxs(Cs,{children:[e.jsx(_t,{asChild:!0,children:e.jsxs(_,{disabled:r||d||P,size:"sm",className:"w-20 sm:w-28",children:[e.jsx(hc,{className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:P?"重启中":h?"保存重启":"重启"})]})}),e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认重启麦麦?"}),e.jsx(Ns,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:h?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:h?_s:ts,children:h?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsx("div",{className:"flex",children:e.jsx(Yt,{value:p,onValueChange:$e=>Ks($e),className:"w-full",children:e.jsxs(Vt,{className:"h-8 sm:h-9 w-full grid grid-cols-2",children:[e.jsxs(Ye,{value:"visual",className:"text-xs sm:text-sm",children:[e.jsx(iv,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化编辑"]}),e.jsxs(Ye,{value:"source",className:"text-xs sm:text-sm",children:[e.jsx(cv,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码编辑"]})]})})})]}),e.jsxs(pt,{children:[e.jsx(Qt,{className:"h-4 w-4"}),e.jsxs(gt,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),p==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(pt,{children:[e.jsx(Qt,{className:"h-4 w-4"}),e.jsxs(gt,{children:[e.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在前端验证格式,只有格式完全正确才能保存。",y&&w&&e.jsxs("div",{className:"text-destructive font-semibold mt-3 p-3 bg-destructive/10 rounded-md",children:[e.jsx("div",{className:"font-bold mb-2",children:"⚠️ TOML 格式错误:"}),e.jsx("pre",{className:"text-sm font-mono whitespace-pre-wrap break-words",children:w})]})]})]}),e.jsx(Vv,{value:N,onChange:$e=>{j($e),f(!0),y&&(b(!1),A(""))},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),p==="visual"&&e.jsx(e.Fragment,{children:e.jsxs(Yt,{defaultValue:"bot",className:"w-full",children:[e.jsxs(Vt,{className:"flex flex-wrap h-auto gap-1 p-1 sm:grid sm:grid-cols-5 lg:grid-cols-10",children:[e.jsx(Ye,{value:"bot",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"基本信息"}),e.jsx(Ye,{value:"personality",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"人格"}),e.jsx(Ye,{value:"chat",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"聊天"}),e.jsx(Ye,{value:"expression",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"表达"}),e.jsx(Ye,{value:"features",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"功能"}),e.jsx(Ye,{value:"processing",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"处理"}),e.jsx(Ye,{value:"dream",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"做梦"}),e.jsx(Ye,{value:"lpmm",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"知识库"}),e.jsx(Ye,{value:"webui",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"WebUI"}),e.jsx(Ye,{value:"other",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"其他"})]}),e.jsx(Ms,{value:"bot",className:"space-y-4",children:E&&e.jsx(K2,{config:E,onChange:C})}),e.jsx(Ms,{value:"personality",className:"space-y-4",children:R&&e.jsx(Q2,{config:R,onChange:H})}),e.jsx(Ms,{value:"chat",className:"space-y-4",children:O&&e.jsx(X2,{config:O,onChange:X})}),e.jsx(Ms,{value:"expression",className:"space-y-4",children:L&&e.jsx(rS,{config:L,onChange:me})}),e.jsx(Ms,{value:"features",className:"space-y-4",children:Ne&&ce&&pe&&K&&e.jsx(lS,{emojiConfig:Ne,memoryConfig:ce,toolConfig:pe,voiceConfig:K,onEmojiChange:je,onMemoryChange:ge,onToolChange:D,onVoiceChange:B})}),e.jsxs(Ms,{value:"processing",className:"space-y-4",children:[$&&G&&se&&ns&&e.jsx(cS,{keywordReactionConfig:$,responsePostProcessConfig:G,chineseTypoConfig:se,responseSplitterConfig:ns,onKeywordReactionChange:z,onResponsePostProcessChange:Re,onChineseTypoChange:Oe,onResponseSplitterChange:J}),ue&&e.jsx(oS,{config:ue,onChange:Q})]}),e.jsx(Ms,{value:"dream",className:"space-y-4",children:_e&&e.jsx(Z2,{config:_e,onChange:he})}),e.jsx(Ms,{value:"lpmm",className:"space-y-4",children:Te&&e.jsx(W2,{config:Te,onChange:V})}),e.jsx(Ms,{value:"webui",className:"space-y-4",children:St&&e.jsx(dS,{config:St,onChange:fa})}),e.jsxs(Ms,{value:"other",className:"space-y-4",children:[Z&&e.jsx(eS,{config:Z,onChange:Le}),ae&&e.jsx(sS,{config:ae,onChange:Ee}),de&&e.jsx(tS,{config:de,onChange:ze}),ws&&e.jsx(aS,{config:ws,onChange:Zs})]})]})}),e.jsx(ar,{})]})})}const Il=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:r,className:F("w-full caption-bottom text-sm",a),...l})}));Il.displayName="Table";const Pl=u.forwardRef(({className:a,...l},r)=>e.jsx("thead",{ref:r,className:F("[&_tr]:border-b",a),...l}));Pl.displayName="TableHeader";const Fl=u.forwardRef(({className:a,...l},r)=>e.jsx("tbody",{ref:r,className:F("[&_tr:last-child]:border-0",a),...l}));Fl.displayName="TableBody";const qS=u.forwardRef(({className:a,...l},r)=>e.jsx("tfoot",{ref:r,className:F("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",a),...l}));qS.displayName="TableFooter";const bt=u.forwardRef(({className:a,...l},r)=>e.jsx("tr",{ref:r,className:F("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",a),...l}));bt.displayName="TableRow";const ls=u.forwardRef(({className:a,...l},r)=>e.jsx("th",{ref:r,className:F("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...l}));ls.displayName="TableHead";const Je=u.forwardRef(({className:a,...l},r)=>e.jsx("td",{ref:r,className:F("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...l}));Je.displayName="TableCell";const VS=u.forwardRef(({className:a,...l},r)=>e.jsx("caption",{ref:r,className:F("mt-4 text-sm text-muted-foreground",a),...l}));VS.displayName="TableCaption";const dd=u.forwardRef(({className:a,...l},r)=>e.jsx(Sa,{ref:r,className:F("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",a),...l}));dd.displayName=Sa.displayName;const ud=u.forwardRef(({className:a,...l},r)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(Ut,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(Sa.Input,{ref:r,className:F("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",a),...l})]}));ud.displayName=Sa.Input.displayName;const md=u.forwardRef(({className:a,...l},r)=>e.jsx(Sa.List,{ref:r,className:F("max-h-[300px] overflow-y-auto overflow-x-hidden",a),...l}));md.displayName=Sa.List.displayName;const xd=u.forwardRef((a,l)=>e.jsx(Sa.Empty,{ref:l,className:"py-6 text-center text-sm",...a}));xd.displayName=Sa.Empty.displayName;const oc=u.forwardRef(({className:a,...l},r)=>e.jsx(Sa.Group,{ref:r,className:F("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",a),...l}));oc.displayName=Sa.Group.displayName;const GS=u.forwardRef(({className:a,...l},r)=>e.jsx(Sa.Separator,{ref:r,className:F("-mx-1 h-px bg-border",a),...l}));GS.displayName=Sa.Separator.displayName;const dc=u.forwardRef(({className:a,...l},r)=>e.jsx(Sa.Item,{ref:r,className:F("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",a),...l}));dc.displayName=Sa.Item.displayName;const Yv=u.createContext(null),Jv="maibot-completed-tours";function KS(){try{const a=localStorage.getItem(Jv);return a?new Set(JSON.parse(a)):new Set}catch{return new Set}}function Hg(a){localStorage.setItem(Jv,JSON.stringify([...a]))}function QS({children:a}){const[l,r]=u.useState({activeTourId:null,stepIndex:0,isRunning:!1}),[c]=u.useState(()=>new Map),[d,m]=u.useState(KS),[,h]=u.useState(0),f=u.useCallback((E,C)=>{c.set(E,C),h(R=>R+1)},[c]),p=u.useCallback(E=>{c.delete(E),r(C=>C.activeTourId===E?{...C,activeTourId:null,isRunning:!1,stepIndex:0}:C)},[c]),g=u.useCallback((E,C=0)=>{c.has(E)&&r({activeTourId:E,stepIndex:C,isRunning:!0})},[c]),N=u.useCallback(()=>{r(E=>({...E,isRunning:!1}))},[]),j=u.useCallback(E=>{r(C=>({...C,stepIndex:E}))},[]),y=u.useCallback(()=>{r(E=>({...E,stepIndex:E.stepIndex+1}))},[]),b=u.useCallback(()=>{r(E=>({...E,stepIndex:Math.max(0,E.stepIndex-1)}))},[]),w=u.useCallback(()=>l.activeTourId?c.get(l.activeTourId)||[]:[],[l.activeTourId,c]),A=u.useCallback(E=>{m(C=>{const R=new Set(C);return R.add(E),Hg(R),R})},[]),M=u.useCallback(E=>{const{action:C,index:R,status:H,type:O}=E,X=["finished","skipped"];if(C==="close"){r(L=>({...L,isRunning:!1,stepIndex:0}));return}X.includes(H)?r(L=>(H==="finished"&&L.activeTourId&&setTimeout(()=>A(L.activeTourId),0),{...L,isRunning:!1,stepIndex:0})):O==="step:after"&&(C==="next"?r(L=>({...L,stepIndex:R+1})):C==="prev"&&r(L=>({...L,stepIndex:R-1})))},[A]),S=u.useCallback(E=>d.has(E),[d]),P=u.useCallback(E=>{m(C=>{const R=new Set(C);return R.delete(E),Hg(R),R})},[]);return e.jsx(Yv.Provider,{value:{state:l,tours:c,registerTour:f,unregisterTour:p,startTour:g,stopTour:N,goToStep:j,nextStep:y,prevStep:b,getCurrentSteps:w,handleJoyrideCallback:M,isTourCompleted:S,markTourCompleted:A,resetTourCompleted:P},children:a})}function _x(){const a=u.useContext(Yv);if(!a)throw new Error("useTour must be used within a TourProvider");return a}const YS={options:{zIndex:1e4,primaryColor:"hsl(var(--primary))",textColor:"hsl(var(--foreground))",backgroundColor:"hsl(var(--background))",arrowColor:"hsl(var(--background))",overlayColor:"rgba(0, 0, 0, 0.5)"},tooltip:{borderRadius:"var(--radius)",padding:"1rem"},tooltipContainer:{textAlign:"left"},tooltipTitle:{fontSize:"1rem",fontWeight:600,marginBottom:"0.5rem"},tooltipContent:{fontSize:"0.875rem",padding:"0.5rem 0"},buttonNext:{backgroundColor:"hsl(var(--primary))",color:"hsl(var(--primary-foreground))",borderRadius:"calc(var(--radius) - 2px)",fontSize:"0.875rem",padding:"0.5rem 1rem"},buttonBack:{color:"hsl(var(--muted-foreground))",fontSize:"0.875rem",marginRight:"0.5rem"},buttonSkip:{color:"hsl(var(--muted-foreground))",fontSize:"0.875rem"},buttonClose:{color:"hsl(var(--muted-foreground))"},spotlight:{borderRadius:"var(--radius)"}},JS={back:"上一步",close:"关闭",last:"完成",next:"下一步",nextLabelWithProgress:"下一步 ({step}/{steps})",open:"打开对话框",skip:"跳过"};function XS(){const{state:a,getCurrentSteps:l,handleJoyrideCallback:r}=_x(),c=l(),[d,m]=u.useState(!1),h=u.useRef(a.stepIndex),f=u.useRef(null);u.useEffect(()=>{h.current!==a.stepIndex&&(m(!1),h.current=a.stepIndex)},[a.stepIndex]),u.useEffect(()=>{if(!a.isRunning||c.length===0){m(!1);return}const j=c[a.stepIndex];if(!j){m(!1);return}const y=j.target;if(y==="body"){m(!0);return}m(!1);const b=setTimeout(()=>{const w=()=>{const P=document.querySelector(y);if(P){const E=P.getBoundingClientRect();if(E.width>0&&E.height>0)return!0}return!1};if(w()){setTimeout(()=>m(!0),100);return}const A=setInterval(()=>{w()&&(clearInterval(A),setTimeout(()=>m(!0),100))},100),M=setTimeout(()=>{clearInterval(A),m(!0)},5e3),S=()=>{clearInterval(A),clearTimeout(M)};f.current=S},150);return()=>{clearTimeout(b),f.current&&(f.current(),f.current=null)}},[a.isRunning,a.stepIndex,c]);const[p,g]=u.useState(null);if(u.useEffect(()=>{let j=document.getElementById("tour-portal-container");return j||(j=document.createElement("div"),j.id="tour-portal-container",j.style.cssText="position: fixed; top: 0; left: 0; z-index: 99999; pointer-events: none;",document.body.appendChild(j)),g(j),()=>{}},[]),!a.isRunning||c.length===0||!d)return null;const N=e.jsx(u_,{steps:c,stepIndex:a.stepIndex,run:a.isRunning,continuous:!0,showSkipButton:!0,showProgress:!0,disableOverlayClose:!0,disableScrolling:!1,disableScrollParentFix:!1,callback:r,styles:YS,locale:JS,scrollOffset:80,scrollToFirstStep:!0,floaterProps:{styles:{floater:{zIndex:99999}},disableAnimation:!0}},`tour-step-${a.stepIndex}`);return p?X0.createPortal(N,p):N}const ml="model-assignment-tour",Xv=[{target:"body",content:"本引导旨在帮助你配置模型提供商和对应的模型,并为麦麦的各个组件分配合适的模型。",placement:"center",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="sidebar-model-provider"]',content:'第一步,你需要配置模型提供商。模型提供商决定了你要使用谁家的模型,无论是单一厂商(如 DeepSeek),还是模型平台(如 Siliconflow),都可以在这里进行配置。点击"下一步"进入配置页面。',placement:"right",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="add-provider-button"]',content:'点击"添加提供商"按钮,开始配置你的模型提供商。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="provider-dialog"]',content:"在这里,你可以选择你想要配置的模型提供商,填写相关信息后保存即可。",placement:"left",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-name-input"]',content:"这里的名称是你为这个模型提供商起的一个名字,方便你在后续使用时识别它。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-apikey-input"]',content:"这里需要填写你从模型提供商那里获取的 API 密钥,用于验证和调用模型服务。对于不同的提供商,获取 API 密钥的方式可能有所不同,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-url-input"]',content:"这里需要填写模型提供商的 API 访问地址,确保填写正确以便系统能够连接到模型服务。对于不同的提供商,API 地址可能有所不同,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-template-select"]',content:"当然,如果你不知道如何填写这些信息,很多模型提供商在这里都提供了预设的模板供你选择,选择对应的模板后,相关信息会自动填充。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-save-button"]',content:"填写完所有信息后,点击保存按钮,模型提供商就配置完成了。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-cancel-button"]',content:"因为这次咱们什么都没有填写,所以点击取消按钮退出吧。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="sidebar-model-management"]',content:'配置好模型提供商后,接下来我们需要为麦麦添加模型并分配功能。点击"下一步"进入模型管理页面。',placement:"right",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="add-model-button"]',content:'在为麦麦的组件分配模型之前,首先需要添加你想要分配的模型,点击"添加模型"按钮开始添加。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="model-dialog"]',content:"在这里,你可以选择你之前配置好的模型提供商,然后选择对应的模型来添加。",placement:"left",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-name-input"]',content:"这里的模型名称是你为这个模型起的一个名字,方便你在后续使用时识别它。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-provider-select"]',content:"在这里选择你之前配置好的模型提供商,这样系统才能知道你要添加哪个提供商的模型。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-identifier-input"]',content:"这里需要填写你想要添加的模型的标识符,不同的模型提供商可能有不同的标识符格式,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-save-button"]',content:"填写完所有信息后,点击保存按钮,模型就添加完成了。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-cancel-button"]',content:"当然,因为这次咱们什么都没有填写,所以直接点击取消按钮退出吧,等你准备好了再来添加模型。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="tasks-tab-trigger"]',content:'最后一步,添加好模型后,切换到"为模型分配功能"标签页,为麦麦的各个组件分配合适的模型。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="task-model-select"]',content:"在这里,你可以为每个组件选择一个或多个合适的模型,选择完成后配置会自动保存。恭喜你完成了模型配置的学习!",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1}],Zv={0:"/config/model",1:"/config/model",2:"/config/modelProvider",3:"/config/modelProvider",4:"/config/modelProvider",5:"/config/modelProvider",6:"/config/modelProvider",7:"/config/modelProvider",8:"/config/modelProvider",9:"/config/modelProvider",10:"/config/modelProvider",11:"/config/model",12:"/config/model",13:"/config/model",14:"/config/model",15:"/config/model",16:"/config/model",17:"/config/model",18:"/config/model",19:"/config/model"},Xi=[{id:"siliconflow",name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",client_type:"openai",display_name:"硅基流动 (SiliconFlow)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"deepseek",name:"DeepSeek",base_url:"https://api.deepseek.com",client_type:"openai",display_name:"DeepSeek",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"rinkoai",name:"RinkoAI",base_url:"https://rinkoai.com/v1",client_type:"openai",display_name:"RinkoAI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"zhipu",name:"ZhipuAI",base_url:"https://open.bigmodel.cn/api/paas/v4",client_type:"openai",display_name:"智谱 AI (ZhipuAI / GLM)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"moonshot",name:"Moonshot",base_url:"https://api.moonshot.cn/v1",client_type:"openai",display_name:"月之暗面 (Moonshot / Kimi)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"doubao",name:"Doubao",base_url:"https://ark.cn-beijing.volces.com/api/v3",client_type:"openai",display_name:"字节豆包 (Doubao)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"alibaba",name:"Alibaba",base_url:"https://dashscope.aliyuncs.com/compatible-mode/v1",client_type:"openai",display_name:"阿里云百炼 (Alibaba Qwen)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"baichuan",name:"Baichuan",base_url:"https://api.baichuan-ai.com/v1",client_type:"openai",display_name:"百川智能 (Baichuan)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"minimax",name:"MiniMax",base_url:"https://api.minimax.chat/v1",client_type:"openai",display_name:"MiniMax (海螺 AI)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"stepfun",name:"StepFun",base_url:"https://api.stepfun.com/v1",client_type:"openai",display_name:"阶跃星辰 (StepFun)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"lingyi",name:"Lingyi",base_url:"https://api.lingyiwanwu.com/v1",client_type:"openai",display_name:"零一万物 (Lingyi / Yi)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"openai",name:"OpenAI",base_url:"https://api.openai.com/v1",client_type:"openai",display_name:"OpenAI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"xai",name:"xAI",base_url:"https://api.x.ai/v1",client_type:"openai",display_name:"xAI (Grok)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"anthropic",name:"Anthropic",base_url:"https://api.anthropic.com/v1",client_type:"openai",display_name:"Anthropic (Claude)"},{id:"gemini",name:"Gemini",base_url:"https://generativelanguage.googleapis.com/v1beta",client_type:"gemini",display_name:"Google Gemini",modelFetcher:{endpoint:"/models",parser:"gemini"}},{id:"cohere",name:"Cohere",base_url:"https://api.cohere.ai/v1",client_type:"openai",display_name:"Cohere"},{id:"groq",name:"Groq",base_url:"https://api.groq.com/openai/v1",client_type:"openai",display_name:"Groq",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"together",name:"Together AI",base_url:"https://api.together.xyz/v1",client_type:"openai",display_name:"Together AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"fireworks",name:"Fireworks",base_url:"https://api.fireworks.ai/inference/v1",client_type:"openai",display_name:"Fireworks AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"mistral",name:"Mistral",base_url:"https://api.mistral.ai/v1",client_type:"openai",display_name:"Mistral AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"perplexity",name:"Perplexity",base_url:"https://api.perplexity.ai",client_type:"openai",display_name:"Perplexity AI"},{id:"custom",name:"",base_url:"",client_type:"openai",display_name:"自定义"}];function qg(a){return a?a.replace(/\/+$/,"").toLowerCase():""}function ZS(a){if(!a)return null;const l=qg(a);return Xi.find(r=>r.id!=="custom"&&qg(r.base_url)===l)||null}const Do=a=>({...a,max_retry:a.max_retry??2,timeout:a.timeout??30,retry_interval:a.retry_interval??10}),WS=(a,l=[],r=null)=>{const c={};return a?(a.name?.trim()?l.some((m,h)=>r!==null&&h===r?!1:m.name.trim().toLowerCase()===a.name.trim().toLowerCase())&&(c.name="提供商名称已存在,请使用其他名称"):c.name="请输入提供商名称",a.base_url?.trim()||(c.base_url="请输入基础 URL"),a.api_key?.trim()||(c.api_key="请输入 API Key"),{isValid:Object.keys(c).length===0,errors:c}):{isValid:!1,errors:{name:"提供商数据为空"}}};function e4(){return e.jsx(tr,{children:e.jsx(s4,{})})}function s4(){const[a,l]=u.useState([]),[r,c]=u.useState(!0),[d,m]=u.useState(!1),[h,f]=u.useState(!1),[p,g]=u.useState(!1),[N,j]=u.useState(!1),[y,b]=u.useState(null),[w,A]=u.useState(null),[M,S]=u.useState("custom"),[P,E]=u.useState(!1),[C,R]=u.useState(!1),[H,O]=u.useState(null),[X,L]=u.useState(!1),[me,Ne]=u.useState(""),[je,ce]=u.useState(new Set),[ge,pe]=u.useState(!1),[D,K]=u.useState(1),[B,ue]=u.useState(20),[Q,_e]=u.useState(""),[he,Te]=u.useState({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),[V,$]=u.useState({}),[z,G]=u.useState(new Set),[Re,se]=u.useState(new Map),{toast:Oe}=it(),ns=xa(),{state:J,goToStep:Z,registerTour:Le}=_x(),{triggerRestart:ae,isRestarting:Ee}=_n(),de=u.useRef(null),ze=u.useRef(!0);u.useEffect(()=>{Le(ml,Xv)},[Le]),u.useEffect(()=>{if(J.activeTourId===ml&&J.isRunning){const te=Zv[J.stepIndex];te&&!window.location.pathname.endsWith(te.replace("/config/",""))&&ns({to:te})}},[J.stepIndex,J.activeTourId,J.isRunning,ns]);const ws=u.useRef(J.stepIndex);u.useEffect(()=>{if(J.activeTourId===ml&&J.isRunning){const te=ws.current,ye=J.stepIndex;te>=3&&te<=9&&ye<3&&j(!1),te>=10&&ye>=3&&ye<=9&&($({}),S("custom"),b({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),A(null),L(!1),j(!0)),ws.current=ye}},[J.stepIndex,J.activeTourId,J.isRunning]),u.useEffect(()=>{if(J.activeTourId!==ml||!J.isRunning)return;const te=ye=>{const U=ye.target,Me=J.stepIndex;Me===2&&U.closest('[data-tour="add-provider-button"]')?setTimeout(()=>Z(3),300):Me===9&&U.closest('[data-tour="provider-cancel-button"]')&&setTimeout(()=>Z(10),300)};return document.addEventListener("click",te,!0),()=>document.removeEventListener("click",te,!0)},[J,Z]),u.useEffect(()=>{Zs()},[]);const Zs=async()=>{try{c(!0);const te=await pn();l(te.api_providers||[]),g(!1),ze.current=!1}catch(te){console.error("加载配置失败:",te)}finally{c(!1)}},St=async()=>{await ae()},fa=async()=>{try{m(!0),de.current&&clearTimeout(de.current);const te=a.map(is=>({...is,max_retry:is.max_retry??2,timeout:is.timeout??30,retry_interval:is.retry_interval??10})),{shouldProceed:ye}=await xs(te,"restart");if(!ye){m(!1);return}const U=await pn(),Me=new Set(te.map(is=>is.name)),ds=(U.models||[]).filter(is=>Me.has(is.api_provider));U.api_providers=te,U.models=ds,await tc(U),g(!1),Oe({title:"保存成功",description:"正在重启麦麦..."}),await St()}catch(te){console.error("保存配置失败:",te),Oe({title:"保存失败",description:te.message,variant:"destructive"}),m(!1)}},xs=u.useCallback(async(te,ye="auto")=>{try{const U=await pn(),Me=new Set(a.map(Ps=>Ps.name)),Xe=new Set(te.map(Ps=>Ps.name)),ds=Array.from(Me).filter(Ps=>!Xe.has(Ps));if(ds.length===0)return{shouldProceed:!0,providers:te};const kt=(U.models||[]).filter(Ps=>ds.includes(Ps.api_provider));return kt.length===0?{shouldProceed:!0,providers:te}:(Te({isOpen:!0,providersToDelete:ds,affectedModels:kt,pendingProviders:te,context:ye,oldProviders:[...a]}),{shouldProceed:!1,providers:te})}catch(U){return console.error("检查删除影响失败:",U),{shouldProceed:!0,providers:te}}},[a]),Is=async()=>{try{(he.context==="auto"?f:m)(!0),Te(Ps=>({...Ps,isOpen:!1}));const ye=await pn(),U=he.pendingProviders.map(Do),Me=new Set(U.map(Ps=>Ps.name)),ds=(ye.models||[]).filter(Ps=>Me.has(Ps.api_provider)),is=new Set(he.affectedModels.map(Ps=>Ps.name)),kt=ye.model_task_config;kt&&Object.keys(kt).forEach(Ps=>{const le=kt[Ps];le&&Array.isArray(le.model_list)&&(le.model_list=le.model_list.filter(fe=>!is.has(fe)))}),ye.api_providers=U,ye.models=ds,ye.model_task_config=kt,await tc(ye),l(he.pendingProviders),g(!1),Oe({title:"删除成功",description:`已删除 ${he.providersToDelete.length} 个提供商和 ${he.affectedModels.length} 个关联模型`}),Te({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),ce(new Set),he.context==="restart"&&await St()}catch(te){console.error("删除失败:",te),Oe({title:"删除失败",description:te.message,variant:"destructive"})}finally{he.context==="auto"?f(!1):m(!1)}},Y=()=>{he.oldProviders.length>0&&l(he.oldProviders),Te({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),g(!1)},qe=u.useCallback(async te=>{if(ze.current)return;const{shouldProceed:ye}=await xs(te,"auto");if(!ye){g(!0);return}try{f(!0);const U=te.map(Do);await Xm("api_providers",U),g(!1)}catch(U){console.error("自动保存失败:",U),Oe({title:"自动保存失败",description:U.message,variant:"destructive"}),g(!0)}finally{f(!1)}},[a,xs]);u.useEffect(()=>{if(!ze.current)return g(!0),de.current&&clearTimeout(de.current),de.current=setTimeout(()=>{qe(a)},2e3),()=>{de.current&&clearTimeout(de.current)}},[a,qe]);const Ke=async()=>{try{m(!0),de.current&&clearTimeout(de.current);const te=a.map(Do),{shouldProceed:ye}=await xs(te,"manual");if(!ye){m(!1);return}const U=await pn(),Me=new Set(te.map(is=>is.name)),Xe=U.models||[],ds=Xe.filter(is=>{const kt=Me.has(is.api_provider);return kt||console.warn(`模型 "${is.name}" 引用了已删除的提供商 "${is.api_provider}",将被移除`),kt});if(Xe.length!==ds.length){const is=Xe.length-ds.length;Oe({title:"注意",description:`已自动移除 ${is} 个引用已删除提供商的模型`,variant:"default"})}console.log("发送的 providers 数据:",te),U.api_providers=te,U.models=ds,console.log("完整配置数据:",U),await tc(U),g(!1),Oe({title:"保存成功",description:"模型提供商配置已保存"})}catch(te){console.error("保存配置失败:",te),Oe({title:"保存失败",description:te.message,variant:"destructive"})}finally{m(!1)}},Ze=(te,ye)=>{if($({}),te){const U=Xi.find(Me=>Me.base_url===te.base_url&&Me.client_type===te.client_type);S(U?.id||"custom"),b(te)}else S("custom"),b({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});A(ye),L(!1),j(!0)},Ts=u.useCallback(te=>{S(te),E(!1);const ye=Xi.find(U=>U.id===te);ye&&ye.id!=="custom"?b(U=>({...U,name:ye.name,base_url:ye.base_url,client_type:ye.client_type})):ye?.id==="custom"&&b(U=>({...U,name:"",base_url:"",client_type:"openai"}))},[]),He=u.useMemo(()=>M!=="custom",[M]),zs=u.useCallback(async()=>{if(y?.api_key)try{await navigator.clipboard.writeText(y.api_key),Oe({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{Oe({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},[y?.api_key,Oe]),Ls=()=>{if(!y)return;const{isValid:te,errors:ye}=WS(y,a,w);if(!te){$(ye);return}$({});const U=Do(y);if(w!==null){const Me=[...a];Me[w]=U,l(Me)}else l([...a,U]);j(!1),b(null),A(null)},Ks=te=>{if(!te&&y){const ye={...y,max_retry:y.max_retry??2,timeout:y.timeout??30,retry_interval:y.retry_interval??10};b(ye)}j(te)},cs=te=>{O(te),R(!0)},ts=async()=>{if(H!==null){const te=a.filter((U,Me)=>Me!==H),{shouldProceed:ye}=await xs(te,"manual");ye&&(l(te),Oe({title:"删除成功",description:"提供商已从列表中移除"}))}R(!1),O(null)},_s=te=>{const ye=new Set(je);ye.has(te)?ye.delete(te):ye.add(te),ce(ye)},$e=()=>{if(je.size===rs.length)ce(new Set);else{const te=rs.map((ye,U)=>a.findIndex(Me=>Me===rs[U]));ce(new Set(te))}},ms=()=>{if(je.size===0){Oe({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}pe(!0)},os=async()=>{const te=a.filter((U,Me)=>!je.has(Me)),{shouldProceed:ye}=await xs(te,"manual");ye&&(l(te),ce(new Set),Oe({title:"批量删除成功",description:`已删除 ${je.size} 个提供商`})),pe(!1)},rs=u.useMemo(()=>{if(!me)return a;const te=me.toLowerCase();return a.filter(ye=>ye.name.toLowerCase().includes(te)||ye.base_url.toLowerCase().includes(te)||ye.client_type.toLowerCase().includes(te))},[a,me]),{totalPages:ht,paginatedProviders:Tt}=u.useMemo(()=>{const te=Math.ceil(rs.length/B),ye=rs.slice((D-1)*B,D*B);return{totalPages:te,paginatedProviders:ye}},[rs,D,B]),ca=u.useCallback(()=>{const te=parseInt(Q);te>=1&&te<=ht&&(K(te),_e(""))},[Q,ht]),ka=async te=>{G(ye=>new Set(ye).add(te));try{const ye=await fS(te);se(U=>new Map(U).set(te,ye)),ye.network_ok?ye.api_key_valid===!0?Oe({title:"连接正常",description:`${te} 网络连接正常,API Key 有效 (${ye.latency_ms}ms)`}):ye.api_key_valid===!1?Oe({title:"连接正常但 Key 无效",description:`${te} 网络连接正常,但 API Key 无效或已过期`,variant:"destructive"}):Oe({title:"网络连接正常",description:`${te} 可以访问 (${ye.latency_ms}ms)`}):Oe({title:"连接失败",description:ye.error||"无法连接到提供商",variant:"destructive"})}catch(ye){Oe({title:"测试失败",description:ye.message,variant:"destructive"})}finally{G(ye=>{const U=new Set(ye);return U.delete(te),U})}},Pa=async()=>{for(const te of a)await ka(te.name)},Jt=te=>{const ye=z.has(te),U=Re.get(te);return ye?e.jsxs(ke,{variant:"secondary",className:"gap-1",children:[e.jsx(Fs,{className:"h-3 w-3 animate-spin"}),"测试中"]}):U?U.network_ok?U.api_key_valid===!0?e.jsxs(ke,{className:"gap-1 bg-green-600 hover:bg-green-700",children:[e.jsx(tt,{className:"h-3 w-3"}),"正常"]}):U.api_key_valid===!1?e.jsxs(ke,{variant:"destructive",className:"gap-1",children:[e.jsx(Rt,{className:"h-3 w-3"}),"Key无效"]}):e.jsxs(ke,{className:"gap-1 bg-blue-600 hover:bg-blue-700",children:[e.jsx(tt,{className:"h-3 w-3"}),"可访问"]}):e.jsxs(ke,{variant:"destructive",className:"gap-1",children:[e.jsx(ta,{className:"h-3 w-3"}),"离线"]}):null};return r?e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"AI模型厂商配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 AI 模型厂商的 API 配置"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[je.size>0&&e.jsxs(_,{onClick:ms,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(us,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",je.size,")"]}),e.jsxs(_,{onClick:Pa,size:"sm",variant:"outline",className:"w-full sm:w-auto",disabled:a.length===0||z.size>0,children:[e.jsx(el,{className:"mr-2 h-4 w-4"}),z.size>0?`测试中 (${z.size})`:"测试全部"]}),e.jsxs(_,{onClick:()=>Ze(null,null),size:"sm",className:"w-full sm:w-auto","data-tour":"add-provider-button",children:[e.jsx(at,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),e.jsxs(_,{onClick:Ke,disabled:d||h||!p||Ee,size:"sm",variant:"outline",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(fc,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),d?"保存中...":h?"自动保存中...":p?"保存配置":"已保存"]}),e.jsxs(Cs,{children:[e.jsx(_t,{asChild:!0,children:e.jsxs(_,{disabled:d||h||Ee,size:"sm",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(hc,{className:"mr-2 h-4 w-4"}),Ee?"重启中...":p?"保存并重启":"重启麦麦"]})}),e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认重启麦麦?"}),e.jsx(Ns,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:p?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:p?fa:St,children:p?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(pt,{children:[e.jsx(Qt,{className:"h-4 w-4"}),e.jsxs(gt,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),e.jsxs(ss,{className:"h-[calc(100vh-260px)]",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[e.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[e.jsx(Ut,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"搜索提供商名称、URL 或类型...",value:me,onChange:te=>Ne(te.target.value),className:"pl-9"})]}),me&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",rs.length," 个结果"]})]}),e.jsx("div",{className:"md:hidden space-y-3",children:rs.length===0?e.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:me?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):Tt.map((te,ye)=>{const U=a.findIndex(Me=>Me===te);return e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:"font-semibold text-base truncate",children:te.name}),Jt(te.name)]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:te.base_url})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>ka(te.name),disabled:z.has(te.name),title:"测试连接",children:z.has(te.name)?e.jsx(Fs,{className:"h-4 w-4 animate-spin"}):e.jsx(el,{className:"h-4 w-4"})}),e.jsx(_,{variant:"default",size:"sm",onClick:()=>Ze(te,U),children:e.jsx(Jn,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),e.jsx(_,{size:"sm",onClick:()=>cs(U),className:"bg-red-600 hover:bg-red-700 text-white",children:e.jsx(us,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),e.jsx("p",{className:"font-medium",children:te.client_type})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),e.jsx("p",{className:"font-medium",children:te.max_retry})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),e.jsx("p",{className:"font-medium",children:te.timeout})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),e.jsx("p",{className:"font-medium",children:te.retry_interval})]})]})]},ye)})}),e.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(Il,{children:[e.jsx(Pl,{children:e.jsxs(bt,{children:[e.jsx(ls,{className:"w-12",children:e.jsx(lt,{checked:je.size===rs.length&&rs.length>0,onCheckedChange:$e})}),e.jsx(ls,{children:"状态"}),e.jsx(ls,{children:"名称"}),e.jsx(ls,{children:"基础URL"}),e.jsx(ls,{children:"客户端类型"}),e.jsx(ls,{className:"text-right",children:"最大重试"}),e.jsx(ls,{className:"text-right",children:"超时(秒)"}),e.jsx(ls,{className:"text-right",children:"重试间隔(秒)"}),e.jsx(ls,{className:"text-right",children:"操作"})]})}),e.jsx(Fl,{children:Tt.length===0?e.jsx(bt,{children:e.jsx(Je,{colSpan:9,className:"text-center text-muted-foreground py-8",children:me?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):Tt.map((te,ye)=>{const U=a.findIndex(Me=>Me===te);return e.jsxs(bt,{children:[e.jsx(Je,{children:e.jsx(lt,{checked:je.has(U),onCheckedChange:()=>_s(U)})}),e.jsx(Je,{children:Jt(te.name)||e.jsx(ke,{variant:"outline",className:"text-muted-foreground",children:"未测试"})}),e.jsx(Je,{className:"font-medium",children:te.name}),e.jsx(Je,{className:"max-w-xs truncate",title:te.base_url,children:te.base_url}),e.jsx(Je,{children:te.client_type}),e.jsx(Je,{className:"text-right",children:te.max_retry}),e.jsx(Je,{className:"text-right",children:te.timeout}),e.jsx(Je,{className:"text-right",children:te.retry_interval}),e.jsx(Je,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>ka(te.name),disabled:z.has(te.name),title:"测试连接",children:z.has(te.name)?e.jsx(Fs,{className:"h-4 w-4 animate-spin"}):e.jsx(el,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"default",size:"sm",onClick:()=>Ze(te,U),children:[e.jsx(Jn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>cs(U),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(us,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},ye)})})]})})}),rs.length>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Pe,{value:B.toString(),onValueChange:te=>{ue(parseInt(te)),K(1),ce(new Set)},children:[e.jsx(Be,{id:"page-size-provider",className:"w-20",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"10",children:"10"}),e.jsx(ee,{value:"20",children:"20"}),e.jsx(ee,{value:"50",children:"50"}),e.jsx(ee,{value:"100",children:"100"})]})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(D-1)*B+1," 到"," ",Math.min(D*B,rs.length)," 条,共 ",rs.length," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>K(1),disabled:D===1,className:"hidden sm:flex",children:e.jsx(yn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>K(te=>Math.max(1,te-1)),disabled:D===1,children:[e.jsx(Ia,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{type:"number",value:Q,onChange:te=>_e(te.target.value),onKeyDown:te=>te.key==="Enter"&&ca(),placeholder:D.toString(),className:"w-16 h-8 text-center",min:1,max:ht}),e.jsx(_,{variant:"outline",size:"sm",onClick:ca,disabled:!Q,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>K(te=>te+1),disabled:D>=ht,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>K(ht),disabled:D>=ht,className:"hidden sm:flex",children:e.jsx(wn,{className:"h-4 w-4"})})]})]})]}),e.jsx(Js,{open:N,onOpenChange:Ks,children:e.jsxs(qs,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"provider-dialog",preventOutsideClose:J.isRunning,children:[e.jsxs(Vs,{children:[e.jsx(Gs,{children:w!==null?"编辑提供商":"添加提供商"}),e.jsx(nt,{children:"配置 API 提供商的连接信息和参数"})]}),e.jsxs("form",{onSubmit:te=>{te.preventDefault(),Ls()},autoComplete:"off",children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":"provider-template-select",children:[e.jsx(T,{htmlFor:"template",children:"提供商模板"}),e.jsxs(hl,{open:P,onOpenChange:E,children:[e.jsx(fl,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":P,className:"w-full justify-between",children:[M?Xi.find(te=>te.id===M)?.display_name:"选择提供商模板...",e.jsx(cx,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(nl,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(dd,{children:[e.jsx(ud,{placeholder:"搜索提供商模板..."}),e.jsx(ss,{className:"h-[300px]",children:e.jsxs(md,{className:"max-h-none overflow-visible",children:[e.jsx(xd,{children:"未找到匹配的模板"}),e.jsx(oc,{children:Xi.map(te=>e.jsxs(dc,{value:te.display_name,onSelect:()=>Ts(te.id),children:[e.jsx(Lt,{className:`mr-2 h-4 w-4 ${M===te.id?"opacity-100":"opacity-0"}`}),te.display_name]},te.id))})]})})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"选择预设模板可自动填充 URL 和客户端类型,支持搜索"})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-name-input",children:[e.jsx(T,{htmlFor:"name",className:V.name?"text-destructive":"",children:"名称 *"}),e.jsx(ne,{id:"name",value:y?.name||"",onChange:te=>{b(ye=>ye?{...ye,name:te.target.value}:null),V.name&&$(ye=>({...ye,name:void 0}))},placeholder:"例如: DeepSeek, SiliconFlow",className:V.name?"border-destructive focus-visible:ring-destructive":""}),V.name&&e.jsx("p",{className:"text-xs text-destructive",children:V.name})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-url-input",children:[e.jsx(T,{htmlFor:"base_url",className:V.base_url?"text-destructive":"",children:"基础 URL *"}),e.jsx(ne,{id:"base_url",value:y?.base_url||"",onChange:te=>{b(ye=>ye?{...ye,base_url:te.target.value}:null),V.base_url&&$(ye=>({...ye,base_url:void 0}))},placeholder:"https://api.example.com/v1",disabled:He,className:`${He?"bg-muted cursor-not-allowed":""} ${V.base_url?"border-destructive focus-visible:ring-destructive":""}`}),V.base_url&&e.jsx("p",{className:"text-xs text-destructive",children:V.base_url}),He&&!V.base_url&&e.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时 URL 不可编辑,切换到"自定义"以手动配置'})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-apikey-input",children:[e.jsx(T,{htmlFor:"api_key",className:V.api_key?"text-destructive":"",children:"API Key *"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{id:"api_key",type:X?"text":"password",value:y?.api_key||"",onChange:te=>{b(ye=>ye?{...ye,api_key:te.target.value}:null),V.api_key&&$(ye=>({...ye,api_key:void 0}))},placeholder:"sk-...",className:`flex-1 ${V.api_key?"border-destructive focus-visible:ring-destructive":""}`}),e.jsx(_,{type:"button",variant:"outline",size:"icon",onClick:()=>L(!X),title:X?"隐藏密钥":"显示密钥",children:X?e.jsx(nc,{className:"h-4 w-4"}):e.jsx(ma,{className:"h-4 w-4"})}),e.jsx(_,{type:"button",variant:"outline",size:"icon",onClick:zs,title:"复制密钥",children:e.jsx(Fo,{className:"h-4 w-4"})})]}),V.api_key&&e.jsx("p",{className:"text-xs text-destructive",children:V.api_key})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"client_type",children:"客户端类型"}),e.jsxs(Pe,{value:y?.client_type||"openai",onValueChange:te=>b(ye=>ye?{...ye,client_type:te}:null),disabled:He,children:[e.jsx(Be,{id:"client_type",className:He?"bg-muted cursor-not-allowed":"",children:e.jsx(Fe,{placeholder:"选择客户端类型"})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"openai",children:"OpenAI"}),e.jsx(ee,{value:"gemini",children:"Gemini"})]})]}),He&&e.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时客户端类型不可编辑,切换到"自定义"以手动配置'})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_retry",children:"最大重试"}),e.jsx(ne,{id:"max_retry",type:"number",min:"0",value:y?.max_retry??"",onChange:te=>{const ye=te.target.value===""?null:parseInt(te.target.value);b(U=>U?{...U,max_retry:ye}:null)},placeholder:"默认: 2"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"timeout",children:"超时(秒)"}),e.jsx(ne,{id:"timeout",type:"number",min:"1",value:y?.timeout??"",onChange:te=>{const ye=te.target.value===""?null:parseInt(te.target.value);b(U=>U?{...U,timeout:ye}:null)},placeholder:"默认: 30"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),e.jsx(ne,{id:"retry_interval",type:"number",min:"1",value:y?.retry_interval??"",onChange:te=>{const ye=te.target.value===""?null:parseInt(te.target.value);b(U=>U?{...U,retry_interval:ye}:null)},placeholder:"默认: 10"})]})]})]}),e.jsxs(xt,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>j(!1),"data-tour":"provider-cancel-button",children:"取消"}),e.jsx(_,{type:"submit","data-tour":"provider-save-button",children:"保存"})]})]})]})}),e.jsx(Cs,{open:C,onOpenChange:R,children:e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认删除"}),e.jsxs(Ns,{children:['确定要删除提供商 "',H!==null?a[H]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:ts,children:"删除"})]})]})}),e.jsx(Cs,{open:ge,onOpenChange:pe,children:e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认批量删除"}),e.jsxs(Ns,{children:["确定要删除选中的 ",je.size," 个提供商吗? 此操作无法撤销。"]})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:os,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),e.jsx(Cs,{open:he.isOpen,onOpenChange:te=>Te(ye=>({...ye,isOpen:te})),children:e.jsxs(ps,{className:"max-w-2xl",children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认删除提供商"}),e.jsx(Ns,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:["您即将删除以下提供商:",e.jsx("strong",{className:"text-foreground ml-1",children:he.providersToDelete.join(", ")})]}),e.jsxs("p",{className:"text-yellow-600 dark:text-yellow-500 font-medium",children:["⚠️ 此操作将同时删除 ",he.affectedModels.length," 个关联的模型:"]}),e.jsx(ss,{className:"h-32 w-full rounded border p-3",children:e.jsx("div",{className:"space-y-1",children:he.affectedModels.map((te,ye)=>e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-mono text-muted-foreground",children:"•"}),e.jsx("span",{className:"ml-2 font-medium",children:te.name}),e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",te.model_identifier,")"]})]},ye))})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"这些模型将从模型列表和所有任务分配中移除。此操作无法撤销。"})]})})]}),e.jsxs(js,{children:[e.jsx(ys,{onClick:Y,children:"取消"}),e.jsx(bs,{onClick:Is,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})}),e.jsx(ar,{})]})}function ac(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).substring(2,11)}`}function Bm(a){return a===null?"null":Array.isArray(a)?"array":typeof a=="object"?"object":typeof a=="boolean"?"boolean":typeof a=="number"?"number":"string"}function Wm(a){return Object.entries(a).map(([l,r])=>{const c=Bm(r),d={id:ac(),key:l,value:r,type:c,expanded:!0};return c==="object"&&r&&typeof r=="object"?d.children=Wm(r):c==="array"&&Array.isArray(r)&&(d.children=r.map((m,h)=>{const f=Bm(m),p={id:ac(),key:String(h),value:m,type:f,expanded:!0};return f==="object"&&m&&typeof m=="object"?p.children=Wm(m):f==="array"&&Array.isArray(m)&&(p.children=m.map((g,N)=>({id:ac(),key:String(N),value:g,type:Bm(g),expanded:!0}))),p})),d})}function ex(a){const l={};for(const r of a)r.key.trim()&&(r.type==="object"&&r.children?l[r.key]=ex(r.children):r.type==="array"&&r.children?l[r.key]=r.children.map(c=>c.type==="object"&&c.children?ex(c.children):c.type==="array"&&c.children?c.children.map(d=>d.value):c.value):r.type==="null"?l[r.key]=null:l[r.key]=r.value);return l}function Vg(a,l){switch(l){case"boolean":return a==="true";case"number":{const r=parseFloat(a);return isNaN(r)?0:r}case"null":return null;default:return a}}function Wv({node:a,level:l,onUpdate:r,onRemove:c,onAddChild:d,onToggleExpand:m}){const h=a.type==="object"||a.type==="array",f=a.children&&a.children.length>0;return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"grid gap-2 items-center",style:{gridTemplateColumns:h?"32px 1fr 90px 64px":"32px 1fr 1fr 90px 32px",paddingLeft:`${l*20}px`},children:[e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>m(a.id),disabled:!h||!f,children:h&&f?a.expanded?e.jsx($a,{className:"h-4 w-4"}):e.jsx(ra,{className:"h-4 w-4"}):e.jsx("span",{className:"w-4"})}),e.jsx(ne,{value:a.key,onChange:p=>r(a.id,"key",p.target.value),placeholder:"key",className:"h-8 text-sm"}),!h&&e.jsx(e.Fragment,{children:a.type==="boolean"?e.jsxs("div",{className:"flex items-center h-8 px-3 border rounded-md bg-background",children:[e.jsx(Ge,{checked:a.value===!0,onCheckedChange:p=>r(a.id,"value",p)}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:a.value?"true":"false"})]}):a.type==="null"?e.jsx("div",{className:"flex items-center h-8 px-3 border rounded-md bg-muted text-sm text-muted-foreground",children:"null"}):e.jsx(ne,{type:a.type==="number"?"number":"text",value:a.value,onChange:p=>r(a.id,"value",p.target.value),placeholder:"value",className:"h-8 text-sm",step:a.type==="number"?"any":void 0})}),e.jsxs(Pe,{value:a.type,onValueChange:p=>r(a.id,"type",p),children:[e.jsx(Be,{className:"h-8 text-xs",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"string",children:"字符串"}),e.jsx(ee,{value:"number",children:"数字"}),e.jsx(ee,{value:"boolean",children:"布尔"}),e.jsx(ee,{value:"null",children:"Null"}),e.jsx(ee,{value:"object",children:"对象"}),e.jsx(ee,{value:"array",children:"数组"})]})]}),e.jsxs("div",{className:"flex gap-1 justify-end",children:[h&&e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-primary",onClick:()=>d(a.id),title:"添加子项",children:e.jsx(at,{className:"h-4 w-4"})}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>c(a.id),title:"删除",children:e.jsx(us,{className:"h-4 w-4"})})]})]}),h&&a.expanded&&a.children&&a.children.length>0&&e.jsx("div",{className:"space-y-1",children:a.children.map(p=>e.jsx(Wv,{node:p,level:l+1,onUpdate:r,onRemove:c,onAddChild:d,onToggleExpand:m},p.id))})]})}function t4({value:a,onChange:l,placeholder:r="添加参数..."}){const[c,d]=u.useState(()=>Wm(a||{})),m=u.useCallback(j=>{d(j),l(ex(j))},[l]),h=u.useCallback(()=>{const j={id:ac(),key:"",value:"",type:"string",expanded:!1};m([...c,j])},[c,m]),f=u.useCallback((j,y,b)=>{const w=A=>A.map(M=>{if(M.id===j)if(y==="type"){const S=b;if(S==="object")return{...M,type:S,value:{},children:[]};if(S==="array")return{...M,type:S,value:[],children:[]};if(S==="null")return{...M,type:S,value:null};{const P=Vg(String(M.value),S);return{...M,type:S,value:P,children:void 0}}}else if(y==="value"){const S=Vg(String(b),M.type);return{...M,value:S}}else return{...M,[y]:String(b)};return M.children?{...M,children:w(M.children)}:M});m(w(c))},[c,m]),p=u.useCallback(j=>{const y=b=>b.filter(w=>w.id!==j).map(w=>w.children?{...w,children:y(w.children)}:w);m(y(c))},[c,m]),g=u.useCallback(j=>{const y=b=>b.map(w=>{if(w.id===j){const A={id:ac(),key:w.type==="array"?String(w.children?.length||0):"",value:"",type:"string",expanded:!0};return{...w,children:[...w.children||[],A]}}return w.children?{...w,children:y(w.children)}:w});m(y(c))},[c,m]),N=u.useCallback(j=>{const y=b=>b.map(w=>w.id===j?{...w,expanded:!w.expanded}:w.children?{...w,children:y(w.children)}:w);d(y(c))},[c]);return e.jsxs("div",{className:"h-full flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[c.length," 个参数"]}),e.jsxs(_,{type:"button",size:"sm",variant:"outline",onClick:h,className:"h-7 text-xs",children:[e.jsx(at,{className:"h-3 w-3 mr-1"}),"添加参数"]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto space-y-1",children:c.length===0?e.jsx("div",{className:"text-sm text-muted-foreground text-center py-4 border border-dashed rounded-md",children:r}):e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"grid gap-2 text-xs text-muted-foreground px-1 sticky top-0 bg-background z-10",style:{gridTemplateColumns:"32px 1fr 1fr 90px 32px"},children:[e.jsx("span",{}),e.jsx("span",{children:"键名"}),e.jsx("span",{children:"值"}),e.jsx("span",{children:"类型"}),e.jsx("span",{})]}),c.map(j=>e.jsx(Wv,{node:j,level:0,onUpdate:f,onRemove:p,onAddChild:g,onToggleExpand:N},j.id))]})})]})}function Gg(a){if(!a.trim())return{valid:!0,parsed:{}};try{const l=JSON.parse(a);return typeof l!="object"||l===null||Array.isArray(l)?{valid:!1,error:"必须是一个 JSON 对象 {}"}:{valid:!0,parsed:l}}catch{return{valid:!1,error:"JSON 格式错误"}}}function a4({value:a,onChange:l,className:r,placeholder:c="添加额外参数..."}){const[d,m]=u.useState("list"),h=u.useMemo(()=>Object.keys(a||{}).length>0?JSON.stringify(a,null,2):"",[a]),[f,p]=u.useState(h),[g,N]=u.useState(null);u.useEffect(()=>{p(h)},[h]);const j=u.useMemo(()=>{const w=Gg(f);return w.valid&&w.parsed?{success:!0,data:w.parsed}:{success:!1,data:{}}},[f]),y=u.useCallback(w=>{const A=w;A==="json"&&d==="list"&&(p(Object.keys(a).length>0?JSON.stringify(a,null,2):""),N(null)),m(A)},[d,a]),b=u.useCallback(w=>{p(w);const A=Gg(w);A.valid&&A.parsed?(N(null),l(A.parsed)):N(A.error||"JSON 格式错误")},[l]);return e.jsx("div",{className:F("h-full flex flex-col",r),children:e.jsxs(Yt,{value:d,onValueChange:y,className:"w-full flex-1 flex flex-col",children:[e.jsxs(Vt,{className:"h-8 p-0.5 bg-muted/60 w-fit",children:[e.jsx(Ye,{value:"list",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"可视化编辑"}),e.jsx(Ye,{value:"json",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"JSON 编辑"})]}),e.jsx(Ms,{value:"list",className:"mt-2 flex-1 flex flex-col overflow-hidden data-[state=inactive]:hidden data-[state=inactive]:h-0",children:e.jsx(t4,{value:a,onChange:l,placeholder:c})}),e.jsx(Ms,{value:"json",className:"mt-2 flex-1 flex flex-col overflow-hidden data-[state=inactive]:hidden data-[state=inactive]:h-0",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 flex-1 overflow-hidden",children:[e.jsxs("div",{className:"flex flex-col gap-2 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"编辑"}),g?e.jsxs("div",{className:"flex items-center gap-1 text-xs text-destructive",children:[e.jsx(Rt,{className:"h-3 w-3"}),e.jsx("span",{className:"truncate max-w-[150px]",children:g})]}):f.trim()&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 dark:text-green-400",children:[e.jsx(Lt,{className:"h-3 w-3"}),e.jsx("span",{children:"有效"})]})]}),e.jsx(ft,{value:f,onChange:w=>b(w.target.value),placeholder:`{ + "key": "value" +}`,className:F("font-mono text-sm flex-1 resize-none",g&&"border-destructive focus-visible:ring-destructive")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"支持任意 JSON 类型(包括嵌套对象和数组)"})]}),e.jsxs("div",{className:"flex flex-col gap-2 overflow-hidden",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"预览"}),e.jsx("div",{className:"flex-1 rounded-md border bg-muted/30 p-3 overflow-auto",children:j.success&&Object.keys(j.data).length>0?e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:JSON.stringify(j.data,null,2)}):j.success?e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"暂无参数"}):e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-destructive",children:"JSON 格式错误"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"实时预览解析结果"})]})]})})]})})}function l4({open:a,onOpenChange:l,value:r,onChange:c}){const[d,m]=u.useState(r),h=g=>{g&&m(r),l(g)},f=()=>{c(d),l(!1)},p=()=>{m(r),l(!1)};return e.jsx(Js,{open:a,onOpenChange:h,children:e.jsxs(qs,{className:"max-w-3xl h-[70vh] flex flex-col",children:[e.jsxs(Vs,{children:[e.jsx(Gs,{children:"编辑额外参数"}),e.jsx(nt,{children:"配置模型调用时的额外参数,支持嵌套对象和数组"})]}),e.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:e.jsx(a4,{value:d,onChange:m,placeholder:"添加额外参数(如 thinking、top_p 等)..."})}),e.jsxs(xt,{children:[e.jsx(_,{variant:"outline",onClick:p,children:"取消"}),e.jsx(_,{onClick:f,children:"保存"})]})]})})}const si="https://maibot-plugin-stats.maibot-webui.workers.dev";async function n4(a){const l=new URLSearchParams;a?.status&&l.set("status",a.status),a?.page&&l.set("page",a.page.toString()),a?.page_size&&l.set("page_size",a.page_size.toString()),a?.search&&l.set("search",a.search),a?.sort_by&&l.set("sort_by",a.sort_by),a?.sort_order&&l.set("sort_order",a.sort_order);const r=await fetch(`${si}/pack?${l.toString()}`);if(!r.ok)throw new Error(`获取 Pack 列表失败: ${r.status}`);return r.json()}async function r4(a){const l=await fetch(`${si}/pack/${a}`);if(!l.ok)throw new Error(`获取 Pack 失败: ${l.status}`);const r=await l.json();if(!r.success)throw new Error(r.error||"获取 Pack 失败");return r.pack}async function i4(a){const r=await(await fetch(`${si}/pack`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).json();if(!r.success)throw new Error(r.error||"创建 Pack 失败");return r}async function c4(a,l){await fetch(`${si}/pack/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack_id:a,user_id:l})})}async function eN(a,l){const c=await(await fetch(`${si}/pack/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack_id:a,user_id:l})})).json();if(!c.success)throw new Error(c.error||"点赞失败");return{likes:c.likes,liked:c.liked}}async function sN(a,l){return(await(await fetch(`${si}/pack/like/check?pack_id=${a}&user_id=${l}`)).json()).liked||!1}async function o4(a){const l=await Se("/api/webui/config/model");if(!l.ok)throw new Error("获取当前模型配置失败");const r=await l.json(),c=r.config||r;console.log("=== Pack Conflict Detection ==="),console.log("Pack providers:",a.providers),console.log("Local providers:",c.api_providers);const d={existing_providers:[],new_providers:[],conflicting_models:[]},m=c.api_providers||[];for(const f of a.providers){console.log(` +Checking pack provider: ${f.name}`),console.log(` Pack URL: ${f.base_url}`),console.log(` Normalized: ${Im(f.base_url)}`);const p=m.filter(g=>{const N=Im(g.base_url),j=Im(f.base_url);return console.log(` Comparing with local "${g.name}": ${g.base_url}`),console.log(` Local normalized: ${N}`),console.log(` Match: ${N===j}`),N===j});p.length>0?(console.log(` ✓ Matched with ${p.length} local provider(s):`,p.map(g=>g.name).join(", ")),d.existing_providers.push({pack_provider:f,local_providers:p.map(g=>({name:g.name,base_url:g.base_url}))})):(console.log(" ✗ No match found - will need API key"),d.new_providers.push(f))}const h=c.models||[];console.log(` +=== Model Conflict Detection ===`);for(const f of a.models){const p=h.find(g=>g.name===f.name);p&&(console.log(`Model conflict: ${f.name}`),d.conflicting_models.push({pack_model:f.name,local_model:p.name}))}return console.log(` +=== Detection Summary ===`),console.log(`Existing providers: ${d.existing_providers.length}`),console.log(`New providers: ${d.new_providers.length}`),console.log(`Conflicting models: ${d.conflicting_models.length}`),console.log(`=========================== +`),d}async function d4(a,l,r,c){const d=await Se("/api/webui/config/model");if(!d.ok)throw new Error("获取当前模型配置失败");const m=await d.json(),h=m.config||m;if(l.apply_providers){const p=l.selected_providers?a.providers.filter(g=>l.selected_providers.includes(g.name)):a.providers;for(const g of p){if(r[g.name])continue;const N=c[g.name];if(!N)throw new Error(`提供商 "${g.name}" 缺少 API Key`);const j={...g,api_key:N},y=h.api_providers.findIndex(b=>b.name===g.name);y>=0?h.api_providers[y]=j:h.api_providers.push(j)}}if(l.apply_models){const p=l.selected_models?a.models.filter(g=>l.selected_models.includes(g.name)):a.models;for(const g of p){const N=r[g.api_provider]||g.api_provider,j={...g,api_provider:N},y=h.models.findIndex(b=>b.name===g.name);y>=0?h.models[y]=j:h.models.push(j)}}if(l.apply_task_config){const p=l.selected_tasks||Object.keys(a.task_config);for(const g of p){const N=a.task_config[g];if(!N)continue;const j=new Set(l.selected_models||a.models.map(w=>w.name)),y=N.model_list.filter(w=>j.has(w));if(y.length===0)continue;const b={...N,model_list:y};if(l.task_mode==="replace")h.model_task_config[g]=b;else{const w=h.model_task_config[g];if(w){const A=[...new Set([...w.model_list,...y])];h.model_task_config[g]={...w,model_list:A}}else h.model_task_config[g]=b}}}if(!(await Se("/api/webui/config/model",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)})).ok)throw new Error("保存配置失败")}async function u4(a){const l=await Se("/api/webui/config/model");if(!l.ok)throw new Error("获取当前模型配置失败");const r=await l.json();if(!r.success||!r.config)throw new Error("获取配置失败");const c=r.config;let d=(c.api_providers||[]).map(g=>({name:g.name,base_url:g.base_url,client_type:g.client_type,max_retry:g.max_retry,timeout:g.timeout,retry_interval:g.retry_interval}));a.selectedProviders&&(d=d.filter(g=>a.selectedProviders.includes(g.name)));let m=c.models||[];a.selectedModels&&(m=m.filter(g=>a.selectedModels.includes(g.name)));const h={},f=c.model_task_config||{},p=a.selectedTasks||Object.keys(f);for(const g of p)f[g]&&(h[g]=f[g]);return{providers:d,models:m,task_config:h}}function Im(a){try{const l=new URL(a);return`${l.protocol}//${l.host}${l.pathname}`.replace(/\/$/,"").toLowerCase()}catch{return a.toLowerCase().replace(/\/$/,"")}}function tN(){const a="maibot_pack_user_id";let l=localStorage.getItem(a);return l||(l="pack_user_"+Math.random().toString(36).substring(2,15),localStorage.setItem(a,l)),l}const m4={utils:"通用工具",utils_small:"轻量工具",tool_use:"工具调用",replyer:"回复生成",planner:"规划推理",vlm:"视觉模型",voice:"语音处理",embedding:"向量嵌入",lpmm_entity_extract:"实体提取",lpmm_rdf_build:"RDF构建",lpmm_qa:"问答模型"},x4=["官方推荐","性价比","高性能","免费模型","国内可用","海外模型","OpenAI","Claude","Gemini","国产模型","多模态","轻量级"];function h4({trigger:a}){const[l,r]=u.useState(!1),[c,d]=u.useState(1),[m,h]=u.useState(!1),[f,p]=u.useState(!1),[g,N]=u.useState([]),[j,y]=u.useState([]),[b,w]=u.useState({}),[A,M]=u.useState(new Set),[S,P]=u.useState(new Set),[E,C]=u.useState(new Set),[R,H]=u.useState(""),[O,X]=u.useState(""),[L,me]=u.useState(""),[Ne,je]=u.useState([]);u.useEffect(()=>{l&&c===1&&ce()},[l,c]);const ce=async()=>{h(!0);try{const V=await u4({name:"",description:"",author:""});N(V.providers),y(V.models),w(V.task_config),M(new Set(V.providers.map($=>$.name))),P(new Set(V.models.map($=>$.name))),C(new Set(Object.keys(V.task_config)))}catch(V){console.error("加载配置失败:",V),aa({title:"加载当前配置失败",variant:"destructive"})}finally{h(!1)}},ge=V=>{const $=new Set(A),z=new Set(S),G=new Set(E);$.has(V)?($.delete(V),j.filter(se=>se.api_provider===V).forEach(se=>z.delete(se.name)),Object.entries(b).forEach(([se,Oe])=>{Oe.model_list&&(Oe.model_list.some(J=>z.has(J))||G.delete(se))})):($.add(V),j.filter(se=>se.api_provider===V).forEach(se=>z.add(se.name)),Object.entries(b).forEach(([se,Oe])=>{Oe.model_list&&Oe.model_list.some(J=>{const Z=j.find(Le=>Le.name===J);return Z&&Z.api_provider===V})&&G.add(se)})),M($),P(z),C(G)},pe=V=>{const $=new Set(S),z=new Set(E);$.has(V)?($.delete(V),Object.entries(b).forEach(([G,Re])=>{Re.model_list&&(Re.model_list.some(Oe=>$.has(Oe))||z.delete(G))})):($.add(V),Object.entries(b).forEach(([G,Re])=>{Re.model_list&&Re.model_list.includes(V)&&z.add(G)})),P($),C(z)},D=V=>{const $=new Set(E);$.has(V)?$.delete(V):$.add(V),C($)},K=V=>{Ne.includes(V)?je(Ne.filter($=>$!==V)):Ne.length<5?je([...Ne,V]):aa({title:"最多选择 5 个标签",variant:"destructive"})},B=()=>{A.size===g.length?M(new Set):M(new Set(g.map(V=>V.name)))},ue=()=>{S.size===j.length?P(new Set):P(new Set(j.map(V=>V.name)))},Q=()=>{const V=Object.keys(b);E.size===V.length?C(new Set):C(new Set(V))},_e=async()=>{if(!R.trim()){aa({title:"请输入模板名称",variant:"destructive"});return}if(!O.trim()){aa({title:"请输入模板描述",variant:"destructive"});return}if(!L.trim()){aa({title:"请输入作者名称",variant:"destructive"});return}if(A.size===0&&S.size===0&&E.size===0){aa({title:"请至少选择一项配置",variant:"destructive"});return}p(!0);try{const V=g.filter(G=>A.has(G.name)),$=j.filter(G=>S.has(G.name)),z={};for(const[G,Re]of Object.entries(b))E.has(G)&&(z[G]=Re);await i4({name:R.trim(),description:O.trim(),author:L.trim(),tags:Ne,providers:V,models:$,task_config:z}),aa({title:"模板已提交审核,审核通过后将显示在市场中"}),r(!1),he()}catch(V){console.error("提交失败:",V),aa({title:V instanceof Error?V.message:"提交失败",variant:"destructive"})}finally{p(!1)}},he=()=>{d(1),H(""),X(""),me(""),je([]),M(new Set),P(new Set),C(new Set)},Te=2;return e.jsxs(Js,{open:l,onOpenChange:r,children:[e.jsx(cd,{asChild:!0,children:a||e.jsxs(_,{variant:"outline",children:[e.jsx(ov,{className:"w-4 h-4 mr-2"}),"分享配置"]})}),e.jsxs(qs,{className:"max-w-2xl max-h-[85vh] flex flex-col",children:[e.jsxs(Vs,{children:[e.jsxs(Gs,{className:"flex items-center gap-2",children:[e.jsx(ua,{className:"w-5 h-5"}),"分享配置模板"]}),e.jsxs(nt,{children:["步骤 ",c," / ",Te,":",c===1&&"选择要分享的配置",c===2&&"填写模板信息"]})]}),e.jsx(ss,{className:"h-[calc(85vh-220px)] pr-4",children:m?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(Fs,{className:"w-8 h-8 mx-auto animate-spin text-primary"}),e.jsx("p",{className:"mt-4 text-muted-foreground",children:"正在加载当前配置..."})]}):e.jsxs(e.Fragment,{children:[c===1&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(pt,{children:[e.jsx(Qt,{className:"h-4 w-4"}),e.jsx(Qn,{children:"安全提示"}),e.jsxs(gt,{children:["分享的配置将",e.jsx("strong",{children:"不包含"})," API Key,其他用户需要自行配置。"]})]}),e.jsxs(Yt,{defaultValue:"providers",className:"w-full",children:[e.jsxs(Vt,{className:"grid w-full grid-cols-3",children:[e.jsxs(Ye,{value:"providers",children:[e.jsx(Bl,{className:"w-4 h-4 mr-2"}),"API 提供商",e.jsxs(ke,{variant:"secondary",className:"ml-2",children:[A.size,"/",g.length]})]}),e.jsxs(Ye,{value:"models",children:[e.jsx(Xn,{className:"w-4 h-4 mr-2"}),"模型配置",e.jsxs(ke,{variant:"secondary",className:"ml-2",children:[S.size,"/",j.length]})]}),e.jsxs(Ye,{value:"tasks",children:[e.jsx(Zn,{className:"w-4 h-4 mr-2"}),"任务配置",e.jsxs(ke,{variant:"secondary",className:"ml-2",children:[E.size,"/",Object.keys(b).length]})]})]}),e.jsx(Ms,{value:"providers",className:"space-y-2 mt-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(_,{variant:"ghost",size:"sm",onClick:B,children:A.size===g.length?"取消全选":"全选"})}),g.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无提供商配置"}):g.map(V=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 rounded hover:bg-muted",children:[e.jsx(lt,{id:`provider-${V.name}`,checked:A.has(V.name),onCheckedChange:()=>ge(V.name)}),e.jsxs(T,{htmlFor:`provider-${V.name}`,className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:V.name}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:V.base_url})]}),e.jsx(ke,{variant:"outline",className:"text-xs",children:V.client_type})]},V.name))]})}),e.jsx(Ms,{value:"models",className:"space-y-2 mt-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(_,{variant:"ghost",size:"sm",onClick:ue,children:S.size===j.length?"取消全选":"全选"})}),j.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无模型配置"}):j.map(V=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 rounded hover:bg-muted",children:[e.jsx(lt,{id:`model-${V.name}`,checked:S.has(V.name),onCheckedChange:()=>pe(V.name)}),e.jsxs(T,{htmlFor:`model-${V.name}`,className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:V.name}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:V.model_identifier})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:V.api_provider})]},V.name))]})}),e.jsx(Ms,{value:"tasks",className:"space-y-2 mt-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(_,{variant:"ghost",size:"sm",onClick:Q,children:E.size===Object.keys(b).length?"取消全选":"全选"})}),Object.keys(b).length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无任务配置"}):Object.entries(b).map(([V,$])=>e.jsxs("div",{className:"space-y-2 p-2 rounded hover:bg-muted",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(lt,{id:`task-${V}`,checked:E.has(V),onCheckedChange:()=>D(V)}),e.jsx(T,{htmlFor:`task-${V}`,className:"flex-1 cursor-pointer",children:e.jsx("span",{className:"font-medium",children:m4[V]||V})}),e.jsxs(ke,{variant:"outline",className:"text-xs",children:[$.model_list.length," 个模型"]})]}),$.model_list&&$.model_list.length>0&&e.jsx("div",{className:"ml-6 flex flex-wrap gap-1",children:$.model_list.map(z=>{const G=j.find(se=>se.name===z),Re=S.has(z);return e.jsxs(ke,{variant:Re?"default":"outline",className:"text-xs cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>pe(z),children:[z,G&&e.jsxs("span",{className:"ml-1 opacity-70",children:["(",G.api_provider,")"]})]},z)})})]},V))]})})]})]}),c===2&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-4 text-sm p-3 bg-muted rounded-lg",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Bl,{className:"w-4 h-4"}),A.size," 个提供商"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Xn,{className:"w-4 h-4"}),S.size," 个模型"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Zn,{className:"w-4 h-4"}),E.size," 个任务"]})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"pack-name",children:"模板名称 *"}),e.jsx(ne,{id:"pack-name",placeholder:"例如:高性价比国产模型配置",value:R,onChange:V=>H(V.target.value),maxLength:50}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[R.length,"/50"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"pack-description",children:"模板描述 *"}),e.jsx(ft,{id:"pack-description",placeholder:"详细描述这个配置模板的特点、适用场景等...",value:O,onChange:V=>X(V.target.value),rows:4,maxLength:500}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[O.length,"/500"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"pack-author",children:"作者名称 *"}),e.jsx(ne,{id:"pack-author",placeholder:"你的昵称或 ID",value:L,onChange:V=>me(V.target.value),maxLength:30})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"标签(可选,最多 5 个)"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:x4.map(V=>e.jsxs(ke,{variant:Ne.includes(V)?"default":"outline",className:"cursor-pointer transition-colors",onClick:()=>K(V),children:[Ne.includes(V)&&e.jsx(Lt,{className:"w-3 h-3 mr-1"}),e.jsx(rd,{className:"w-3 h-3 mr-1"}),V]},V))})]})]}),e.jsxs(pt,{children:[e.jsx(Qt,{className:"h-4 w-4"}),e.jsx(Qn,{children:"审核说明"}),e.jsx(gt,{children:"提交后需要经过审核才能在市场中展示。审核通常在 1-3 个工作日内完成。"})]})]})]})}),e.jsxs(xt,{className:"flex justify-between pt-4 border-t",children:[e.jsx("div",{children:c>1&&e.jsx(_,{variant:"outline",onClick:()=>d(c-1),disabled:f,children:"上一步"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{variant:"outline",onClick:()=>{r(!1),he()},disabled:f,children:"取消"}),cd(c+1),disabled:m||A.size===0&&S.size===0&&E.size===0,children:"下一步"}):e.jsxs(_,{onClick:_e,disabled:f,children:[f&&e.jsx(Fs,{className:"w-4 h-4 mr-2 animate-spin"}),"提交审核"]})]})]})]})]})}function f4({value:a,label:l,onRemove:r}){const{attributes:c,listeners:d,setNodeRef:m,transform:h,transition:f,isDragging:p}=_v({id:a}),g={transform:Sv.Transform.toString(h),transition:f,opacity:p?.5:1},N=y=>{y.preventDefault(),y.stopPropagation(),r(a)},j=y=>{y.stopPropagation()};return e.jsx("div",{ref:m,style:g,className:F("inline-flex items-center gap-1",p&&"shadow-lg"),children:e.jsxs(ke,{variant:"secondary",className:"cursor-move hover:bg-secondary/80 flex items-center gap-1",children:[e.jsx("div",{...c,...d,className:"cursor-grab active:cursor-grabbing flex items-center",children:e.jsx(rv,{className:"h-3 w-3 text-muted-foreground"})}),e.jsx("span",{children:l}),e.jsx("span",{role:"button",tabIndex:0,className:"ml-1 rounded-sm hover:bg-destructive/20 focus:outline-none focus:ring-1 focus:ring-destructive cursor-pointer",onClick:N,onPointerDown:j,onMouseDown:y=>y.stopPropagation(),onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),N(y))},children:e.jsx(_a,{className:"h-3 w-3 hover:text-destructive",strokeWidth:2,fill:"none"})})]})})}function p4({options:a,selected:l,onChange:r,placeholder:c="选择选项...",emptyText:d="未找到选项",className:m}){const[h,f]=u.useState(!1),p=pv(Go(vv,{activationConstraint:{distance:8}}),Go(jv,{coordinateGetter:gv})),g=y=>{l.includes(y)?r(l.filter(b=>b!==y)):r([...l,y])},N=y=>{r(l.filter(b=>b!==y))},j=y=>{const{active:b,over:w}=y;if(w&&b.id!==w.id){const A=l.indexOf(b.id),M=l.indexOf(w.id);r(Nv(l,A,M))}};return e.jsxs(hl,{open:h,onOpenChange:f,children:[e.jsx(fl,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":h,className:F("w-full justify-between min-h-10 h-auto",m),children:[e.jsx(bv,{sensors:p,collisionDetection:yv,onDragEnd:j,children:e.jsx(wv,{items:l,strategy:d_,children:e.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:l.length===0?e.jsx("span",{className:"text-muted-foreground",children:c}):l.map(y=>{const b=a.find(w=>w.value===y);return e.jsx(f4,{value:y,label:b?.label||y,onRemove:N},y)})})})}),e.jsx(cx,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),e.jsx(nl,{className:"w-full p-0",align:"start",children:e.jsxs(dd,{children:[e.jsx(ud,{placeholder:"搜索...",className:"h-9"}),e.jsxs(md,{children:[e.jsx(xd,{children:d}),e.jsx(oc,{children:a.map(y=>{const b=l.includes(y.value);return e.jsxs(dc,{value:y.value,onSelect:()=>g(y.value),children:[e.jsx("div",{className:F("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",b?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(Lt,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),e.jsx("span",{children:y.label})]},y.value)})})]})]})})]})}const Dl=Hs.memo(function({title:l,description:r,taskConfig:c,modelNames:d,onChange:m,hideTemperature:h=!1,hideMaxTokens:f=!1,dataTour:p}){const g=N=>{m("model_list",N)};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:l}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:r})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":p,children:[e.jsx(T,{children:"模型列表"}),e.jsx(p4,{options:d.map(N=>({label:N,value:N})),selected:c.model_list||[],onChange:g,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!h&&e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"温度"}),e.jsx(ne,{type:"number",step:"0.1",min:"0",max:"1",value:c.temperature??.3,onChange:N=>{const j=parseFloat(N.target.value);!isNaN(j)&&j>=0&&j<=1&&m("temperature",j)},className:"w-20 h-8 text-sm"})]}),e.jsx(Wa,{value:[c.temperature??.3],onValueChange:N=>m("temperature",N[0]),min:0,max:1,step:.1,className:"w-full"})]}),!f&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"最大 Token"}),e.jsx(ne,{type:"number",step:"1",min:"1",value:c.max_tokens??1024,onChange:N=>m("max_tokens",parseInt(N.target.value))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"慢请求阈值 (秒)"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"超时警告"})]}),e.jsx(ne,{type:"number",step:"1",min:"1",value:c.slow_threshold??15,onChange:N=>{const j=parseInt(N.target.value);!isNaN(j)&&j>=1&&m("slow_threshold",j)},placeholder:"15"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"模型响应时间超过此阈值将输出警告日志"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"模型选择策略"}),e.jsxs(Pe,{value:c.selection_strategy??"balance",onValueChange:N=>m("selection_strategy",N),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择模型选择策略"})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"balance",children:"负载均衡(balance)"}),e.jsx(ee,{value:"random",children:"随机选择(random)"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"负载均衡:优先选择使用次数少的模型。随机选择:完全随机从模型列表中选择"})]})]})]})}),g4=Hs.memo(function({paginatedModels:l,allModels:r,onEdit:c,onDelete:d,isModelUsed:m,searchQuery:h}){return l.length===0?e.jsx("div",{className:"md:hidden text-center text-muted-foreground py-8 rounded-lg border bg-card",children:h?"未找到匹配的模型":"暂无模型配置"}):e.jsx("div",{className:"md:hidden space-y-3",children:l.map((f,p)=>{const g=r.findIndex(j=>j===f),N=m(f.name);return e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"font-semibold text-base",children:f.name}),e.jsx(ke,{variant:N?"default":"secondary",className:N?"bg-green-600 hover:bg-green-700":"",children:N?"已使用":"未使用"})]}),e.jsx("p",{className:"text-xs text-muted-foreground break-all",title:f.model_identifier,children:f.model_identifier})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>c(f,g),children:[e.jsx(Jn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>d(g),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(us,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),e.jsx("p",{className:"font-medium",children:f.api_provider})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"模型温度"}),e.jsx("p",{className:"font-medium",children:f.temperature!=null?f.temperature:e.jsx("span",{className:"text-muted-foreground",children:"默认"})})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),e.jsxs("p",{className:"font-medium",children:["¥",f.price_in,"/M"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),e.jsxs("p",{className:"font-medium",children:["¥",f.price_out,"/M"]})]})]})]},p)})})}),j4=Hs.memo(function({paginatedModels:l,allModels:r,filteredModels:c,selectedModels:d,onEdit:m,onDelete:h,onToggleSelection:f,onToggleSelectAll:p,isModelUsed:g,searchQuery:N}){return e.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(Il,{children:[e.jsx(Pl,{children:e.jsxs(bt,{children:[e.jsx(ls,{className:"w-12",children:e.jsx(lt,{checked:d.size===c.length&&c.length>0,onCheckedChange:p})}),e.jsx(ls,{className:"w-24",children:"使用状态"}),e.jsx(ls,{children:"模型名称"}),e.jsx(ls,{children:"模型标识符"}),e.jsx(ls,{children:"提供商"}),e.jsx(ls,{className:"text-center",children:"温度"}),e.jsx(ls,{className:"text-right",children:"输入价格"}),e.jsx(ls,{className:"text-right",children:"输出价格"}),e.jsx(ls,{className:"text-right",children:"操作"})]})}),e.jsx(Fl,{children:l.length===0?e.jsx(bt,{children:e.jsx(Je,{colSpan:9,className:"text-center text-muted-foreground py-8",children:N?"未找到匹配的模型":"暂无模型配置"})}):l.map((j,y)=>{const b=r.findIndex(A=>A===j),w=g(j.name);return e.jsxs(bt,{children:[e.jsx(Je,{children:e.jsx(lt,{checked:d.has(b),onCheckedChange:()=>f(b)})}),e.jsx(Je,{children:e.jsx(ke,{variant:w?"default":"secondary",className:w?"bg-green-600 hover:bg-green-700":"",children:w?"已使用":"未使用"})}),e.jsx(Je,{className:"font-medium",children:j.name}),e.jsx(Je,{className:"max-w-xs truncate",title:j.model_identifier,children:j.model_identifier}),e.jsx(Je,{children:j.api_provider}),e.jsx(Je,{className:"text-center",children:j.temperature!=null?j.temperature:e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsxs(Je,{className:"text-right",children:["¥",j.price_in,"/M"]}),e.jsxs(Je,{className:"text-right",children:["¥",j.price_out,"/M"]}),e.jsx(Je,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>m(j,b),children:[e.jsx(Jn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>h(b),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(us,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},y)})})]})})})}),v4=300*1e3,Kg=new Map,N4=[10,20,50,100],b4=Hs.memo(function({page:l,pageSize:r,totalItems:c,jumpToPage:d,onPageChange:m,onPageSizeChange:h,onJumpToPageChange:f,onJumpToPage:p,onSelectionClear:g}){const N=Math.ceil(c/r),j=b=>{h(parseInt(b)),m(1),g?.()},y=b=>{b.key==="Enter"&&p()};return c===0?null:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Pe,{value:r.toString(),onValueChange:j,children:[e.jsx(Be,{id:"page-size-model",className:"w-20",children:e.jsx(Fe,{})}),e.jsx(Ie,{children:N4.map(b=>e.jsx(ee,{value:b.toString(),children:b},b))})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(l-1)*r+1," 到"," ",Math.min(l*r,c)," 条,共 ",c," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>m(1),disabled:l===1,className:"hidden sm:flex",children:e.jsx(yn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>m(Math.max(1,l-1)),disabled:l===1,children:[e.jsx(Ia,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{type:"number",value:d,onChange:b=>f(b.target.value),onKeyDown:y,placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:N}),e.jsx(_,{variant:"outline",size:"sm",onClick:p,disabled:!d,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>m(l+1),disabled:l>=N,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>m(N),disabled:l>=N,className:"hidden sm:flex",children:e.jsx(wn,{className:"h-4 w-4"})})]})]})});function y4(a){const{models:l,taskConfig:r,debounceMs:c=2e3,onSavingChange:d,onUnsavedChange:m}=a,h=u.useRef(null),f=u.useRef(null),p=u.useRef(!0),g=u.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null),f.current&&(clearTimeout(f.current),f.current=null)},[]),N=u.useCallback(b=>{const w={model_identifier:b.model_identifier,name:b.name,api_provider:b.api_provider,price_in:b.price_in??0,price_out:b.price_out??0,force_stream_mode:b.force_stream_mode??!1,extra_params:b.extra_params??{}};return b.temperature!=null&&(w.temperature=b.temperature),b.max_tokens!=null&&(w.max_tokens=b.max_tokens),w},[]),j=u.useCallback(async b=>{try{d?.(!0);const w=b.map(N);await Xm("models",w),m?.(!1)}catch(w){console.error("自动保存模型列表失败:",w),m?.(!0)}finally{d?.(!1)}},[d,m,N]),y=u.useCallback(async b=>{try{d?.(!0),await Xm("model_task_config",b),m?.(!1)}catch(w){console.error("自动保存任务配置失败:",w),m?.(!0)}finally{d?.(!1)}},[d,m]);return u.useEffect(()=>{if(!p.current)return m?.(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{j(l)},c),()=>{h.current&&clearTimeout(h.current)}},[l,j,c,m]),u.useEffect(()=>{if(!(p.current||!r))return m?.(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{y(r)},c),()=>{f.current&&clearTimeout(f.current)}},[r,y,c,m]),u.useEffect(()=>()=>{g()},[g]),{clearTimers:g,initialLoadRef:p}}function w4(a={}){const{onCloseEditDialog:l}=a,r=xa(),{registerTour:c,startTour:d,state:m,goToStep:h}=_x(),f=u.useRef(m.stepIndex);return u.useEffect(()=>{c(ml,Xv)},[c]),u.useEffect(()=>{if(m.activeTourId===ml&&m.isRunning){const g=Zv[m.stepIndex];g&&!window.location.pathname.endsWith(g.replace("/config/",""))&&r({to:g})}},[m.stepIndex,m.activeTourId,m.isRunning,r]),u.useEffect(()=>{if(m.activeTourId===ml&&m.isRunning){const g=f.current,N=m.stepIndex;g>=12&&g<=17&&N<12&&l?.(),f.current=N}},[m.stepIndex,m.activeTourId,m.isRunning,l]),u.useEffect(()=>{if(m.activeTourId!==ml||!m.isRunning)return;const g=N=>{const j=N.target,y=m.stepIndex;y===2&&j.closest('[data-tour="add-provider-button"]')?setTimeout(()=>h(3),300):y===9&&j.closest('[data-tour="provider-cancel-button"]')?setTimeout(()=>h(10),300):y===11&&j.closest('[data-tour="add-model-button"]')?setTimeout(()=>h(12),300):y===17&&j.closest('[data-tour="model-cancel-button"]')?setTimeout(()=>h(18),300):y===18&&j.closest('[data-tour="tasks-tab-trigger"]')&&setTimeout(()=>h(19),300)};return document.addEventListener("click",g,!0),()=>document.removeEventListener("click",g,!0)},[m,h]),{startTour:u.useCallback(()=>{d(ml)},[d]),isRunning:m.isRunning&&m.activeTourId===ml,stepIndex:m.stepIndex}}function _4(a){const{getProviderConfig:l}=a,[r,c]=u.useState([]),[d,m]=u.useState(!1),[h,f]=u.useState(null),[p,g]=u.useState(null),N=u.useCallback(()=>{c([]),f(null),g(null)},[]),j=u.useCallback(async(y,b=!1)=>{const w=l(y);if(!w?.base_url){c([]),g(null),f('提供商配置不完整,请先在"模型提供商配置"中配置');return}if(!w.api_key){c([]),g(null),f('该提供商未配置 API Key,请先在"模型提供商配置"中填写');return}const A=ZS(w.base_url);if(g(A),!A?.modelFetcher){c([]),f(null);return}const M=`${y}:${w.base_url}`,S=Kg.get(M);if(!b&&S&&Date.now()-S.timestampE(!1)}),{clearTimers:xs,initialLoadRef:Is}=y4({models:a,taskConfig:p,onSavingChange:A,onUnsavedChange:S}),Y=u.useCallback((le,fe)=>{if(!le)return;const es=new Set(fe.map(oa=>oa.name)),Ss=[],hs=[],yt=[{key:"utils",label:"工具模型"},{key:"tool_use",label:"工具调用模型"},{key:"replyer",label:"回复模型"},{key:"planner",label:"规划器模型"},{key:"vlm",label:"视觉模型"},{key:"voice",label:"语音模型"},{key:"embedding",label:"嵌入模型"},{key:"lpmm_entity_extract",label:"LPMM实体抽取"},{key:"lpmm_rdf_build",label:"LPMM关系构建"}];for(const{key:oa,label:Xt}of yt){const ql=le[oa];if(!ql)continue;if(!ql.model_list||ql.model_list.length===0){hs.push(Xt);continue}const kn=ql.model_list.filter(Cn=>!es.has(Cn));kn.length>0&&Ss.push({taskName:Xt,invalidModels:kn})}Z(Ss),ae(hs)},[]),qe=u.useCallback(async()=>{try{j(!0);const le=await pn(),fe=le.models||[];l(fe),f(fe.map(yt=>yt.name));const es=le.api_providers||[];c(es.map(yt=>yt.name)),m(es);const Ss=le.model_task_config||null;g(Ss),Y(Ss,fe);const hs=Ss?.embedding?.model_list||[];Oe.current=[...hs],S(!1),Is.current=!1}catch(le){console.error("加载配置失败:",le)}finally{j(!1)}},[Is,Y]);u.useEffect(()=>{qe()},[qe]);const Ke=u.useCallback(le=>d.find(fe=>fe.name===le),[d]),{availableModels:Ze,fetchingModels:Ts,modelFetchError:He,matchedTemplate:zs,fetchModelsForProvider:Ls,clearModels:Ks}=_4({getProviderConfig:Ke});u.useEffect(()=>{P&&C?.api_provider&&Ls(C.api_provider)},[P,C?.api_provider,Ls]);const cs=async()=>{await ws()},ts=u.useCallback(()=>{if(!p)return;const le=new Set(a.map(Ss=>Ss.name)),fe={...p},es=Object.keys(fe);for(const Ss of es){const hs=fe[Ss];hs&&hs.model_list&&(hs.model_list=hs.model_list.filter(yt=>le.has(yt)))}g(fe),Z([]),ze({title:"清理完成",description:"已删除所有无效的模型引用"})},[p,a,ze]),_s=le=>{const fe={model_identifier:le.model_identifier,name:le.name,api_provider:le.api_provider,price_in:le.price_in??0,price_out:le.price_out??0,force_stream_mode:le.force_stream_mode??!1,extra_params:le.extra_params??{}};return le.temperature!=null&&(fe.temperature=le.temperature),le.max_tokens!=null&&(fe.max_tokens=le.max_tokens),fe},$e=async()=>{try{b(!0),xs();const le=await pn();le.models=a.map(_s),le.model_task_config=p,await tc(le),S(!1),ze({title:"保存成功",description:"正在重启麦麦..."}),await cs()}catch(le){console.error("保存配置失败:",le),ze({title:"保存失败",description:le.message,variant:"destructive"}),b(!1)}},ms=async()=>{try{b(!0),xs();const le=await pn();le.models=a.map(_s),le.model_task_config=p,await tc(le),S(!1),ze({title:"保存成功",description:"模型配置已保存"}),await qe()}catch(le){console.error("保存配置失败:",le),ze({title:"保存失败",description:le.message,variant:"destructive"})}finally{b(!1)}},os=(le,fe)=>{de({}),R(le||{model_identifier:"",name:"",api_provider:r[0]||"",price_in:0,price_out:0,temperature:null,max_tokens:null,force_stream_mode:!1,extra_params:{}}),O(fe),E(!0)},rs=()=>{if(!C)return;const le={};if(C.name?.trim()?a.some((yt,oa)=>H!==null&&oa===H?!1:yt.name.trim().toLowerCase()===C.name.trim().toLowerCase())&&(le.name="模型名称已存在,请使用其他名称"):le.name="请输入模型名称",C.api_provider?.trim()||(le.api_provider="请选择 API 提供商"),C.model_identifier?.trim()||(le.model_identifier="请输入模型标识符"),Object.keys(le).length>0){de(le);return}de({});const fe={model_identifier:C.model_identifier,name:C.name,api_provider:C.api_provider,price_in:C.price_in??0,price_out:C.price_out??0,force_stream_mode:C.force_stream_mode??!1,extra_params:C.extra_params??{}};C.temperature!=null&&(fe.temperature=C.temperature),C.max_tokens!=null&&(fe.max_tokens=C.max_tokens);let es,Ss=null;if(H!==null?(Ss=a[H].name,es=[...a],es[H]=fe):es=[...a,fe],l(es),f(es.map(hs=>hs.name)),Ss&&Ss!==fe.name&&p){const hs=yt=>yt.map(oa=>oa===Ss?fe.name:oa);g({...p,utils:{...p.utils,model_list:hs(p.utils?.model_list||[])},tool_use:{...p.tool_use,model_list:hs(p.tool_use?.model_list||[])},replyer:{...p.replyer,model_list:hs(p.replyer?.model_list||[])},planner:{...p.planner,model_list:hs(p.planner?.model_list||[])},vlm:{...p.vlm,model_list:hs(p.vlm?.model_list||[])},voice:{...p.voice,model_list:hs(p.voice?.model_list||[])},embedding:{...p.embedding,model_list:hs(p.embedding?.model_list||[])},lpmm_entity_extract:{...p.lpmm_entity_extract,model_list:hs(p.lpmm_entity_extract?.model_list||[])},lpmm_rdf_build:{...p.lpmm_rdf_build,model_list:hs(p.lpmm_rdf_build?.model_list||[])}})}E(!1),R(null),O(null),ze({title:H!==null?"模型已更新":"模型已添加",description:'配置将在 2 秒后自动保存,或点击右上角"保存配置"按钮立即保存'})},ht=le=>{if(!le&&C){const fe={...C,price_in:C.price_in??0,price_out:C.price_out??0};R(fe)}E(le)},Tt=le=>{ce(le),Ne(!0)},ca=()=>{if(je!==null){const le=a.filter((fe,es)=>es!==je);l(le),f(le.map(fe=>fe.name)),Y(p,le),ze({title:"删除成功",description:'配置将在 2 秒后自动保存,或点击右上角"保存配置"按钮立即保存'})}Ne(!1),ce(null)},ka=le=>{const fe=new Set(D);fe.has(le)?fe.delete(le):fe.add(le),K(fe)},Pa=()=>{if(D.size===Xe.length)K(new Set);else{const le=Xe.map((fe,es)=>a.findIndex(Ss=>Ss===Xe[es]));K(new Set(le))}},Jt=()=>{if(D.size===0){ze({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}ue(!0)},te=()=>{const le=D.size,fe=a.filter((es,Ss)=>!D.has(Ss));l(fe),f(fe.map(es=>es.name)),Y(p,fe),K(new Set),ue(!1),ze({title:"批量删除成功",description:`已删除 ${le} 个模型,配置将在 2 秒后自动保存`})},ye=(le,fe,es)=>{if(!p)return;if(le==="embedding"&&fe==="model_list"&&Array.isArray(es)){const hs=Oe.current,yt=es;if((hs.length!==yt.length||hs.some(Xt=>!yt.includes(Xt))||yt.some(Xt=>!hs.includes(Xt)))&&hs.length>0){ns.current={field:fe,value:es},se(!0);return}}const Ss={...p,[le]:{...p[le],[fe]:es}};g(Ss),Y(Ss,a),le==="embedding"&&fe==="model_list"&&Array.isArray(es)&&(Oe.current=[...es])},U=()=>{if(!p||!ns.current)return;const{field:le,value:fe}=ns.current,es={...p,embedding:{...p.embedding,[le]:fe}};g(es),Y(es,a),le==="model_list"&&Array.isArray(fe)&&(Oe.current=[...fe]),ns.current=null,se(!1),ze({title:"嵌入模型已更新",description:"建议重新生成知识库向量以确保最佳匹配精度"})},Me=()=>{ns.current=null,se(!1)},Xe=a.filter(le=>{if(!ge)return!0;const fe=ge.toLowerCase();return le.name.toLowerCase().includes(fe)||le.model_identifier.toLowerCase().includes(fe)||le.api_provider.toLowerCase().includes(fe)}),ds=Math.ceil(Xe.length/he),is=Xe.slice((Q-1)*he,Q*he),kt=()=>{const le=parseInt(V);le>=1&&le<=ds&&(_e(le),$(""))},Ps=le=>p?[p.utils?.model_list||[],p.tool_use?.model_list||[],p.replyer?.model_list||[],p.planner?.model_list||[],p.vlm?.model_list||[],p.voice?.model_list||[],p.embedding?.model_list||[],p.lpmm_entity_extract?.model_list||[],p.lpmm_rdf_build?.model_list||[]].some(es=>es.includes(le)):!1;return N?e.jsx(ss,{className:"h-full",children:e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):e.jsx(ss,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型管理与分配"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"添加模型并为模型分配功能"})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsx(h4,{trigger:e.jsxs(_,{variant:"outline",size:"sm",className:"flex-1 sm:flex-none",children:[e.jsx(ov,{className:"mr-2 h-4 w-4"}),"分享配置"]})}),e.jsxs(_,{onClick:ms,disabled:y||w||!M||Zs,size:"sm",variant:"outline",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(fc,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),y?"保存中...":w?"自动保存中...":M?"保存配置":"已保存"]}),e.jsxs(Cs,{children:[e.jsx(_t,{asChild:!0,children:e.jsxs(_,{disabled:y||w||Zs,size:"sm",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(hc,{className:"mr-2 h-4 w-4"}),Zs?"重启中...":M?"保存并重启":"重启麦麦"]})}),e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认重启麦麦?"}),e.jsx(Ns,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:M?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:M?$e:cs,children:M?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(pt,{children:[e.jsx(Qt,{className:"h-4 w-4"}),e.jsxs(gt,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),J.length>0&&e.jsxs(pt,{variant:"destructive",children:[e.jsx(qt,{className:"h-4 w-4"}),e.jsxs(gt,{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("strong",{children:"检测到无效的模型引用"}),e.jsx("div",{className:"mt-2 space-y-1",children:J.map(({taskName:le,invalidModels:fe})=>e.jsxs("div",{className:"text-sm",children:[e.jsx("strong",{children:le})," 引用了不存在的模型: ",fe.join(", ")]},le))})]}),e.jsx(_,{variant:"outline",size:"sm",className:"shrink-0 bg-background hover:bg-accent",onClick:ts,children:"一键清理"})]})]}),Le.length>0&&e.jsxs(pt,{variant:"default",className:"border-yellow-500/50 bg-yellow-500/10",children:[e.jsx(qt,{className:"h-4 w-4 text-yellow-600"}),e.jsxs(gt,{children:[e.jsx("strong",{className:"text-yellow-600",children:"以下任务未配置模型"}),e.jsxs("div",{className:"mt-2 text-sm",children:[Le.join("、")," 还未分配模型,这些功能将无法正常工作。"]})]})]}),e.jsxs(pt,{className:"hidden lg:flex border-primary/30 bg-primary/5 cursor-pointer hover:bg-primary/10 transition-colors",onClick:St,children:[e.jsx(z1,{className:"h-4 w-4 text-primary"}),e.jsxs(gt,{className:"flex items-center justify-between",children:[e.jsxs("span",{children:[e.jsx("strong",{className:"text-primary",children:"新手引导:"}),"不知道如何配置模型?点击这里开始学习如何为麦麦的组件分配模型。"]}),e.jsx(_,{variant:"outline",size:"sm",className:"ml-4 shrink-0",children:"开始引导"})]})]}),e.jsxs(Yt,{defaultValue:"models",className:"w-full",children:[e.jsxs(Vt,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[e.jsx(Ye,{value:"models",children:"添加模型"}),e.jsx(Ye,{value:"tasks","data-tour":"tasks-tab-trigger",children:"为模型分配功能"})]}),e.jsxs(Ms,{value:"models",className:"space-y-4 mt-0",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[D.size>0&&e.jsxs(_,{onClick:Jt,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(us,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",D.size,")"]}),e.jsxs(_,{onClick:()=>os(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto","data-tour":"add-model-button",children:[e.jsx(at,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[e.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[e.jsx(Ut,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"搜索模型名称、标识符或提供商...",value:ge,onChange:le=>pe(le.target.value),className:"pl-9"})]}),ge&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Xe.length," 个结果"]})]}),e.jsx(g4,{paginatedModels:is,allModels:a,onEdit:os,onDelete:Tt,isModelUsed:Ps,searchQuery:ge}),e.jsx(j4,{paginatedModels:is,allModels:a,filteredModels:Xe,selectedModels:D,onEdit:os,onDelete:Tt,onToggleSelection:ka,onToggleSelectAll:Pa,isModelUsed:Ps,searchQuery:ge}),e.jsx(b4,{page:Q,pageSize:he,totalItems:Xe.length,jumpToPage:V,onPageChange:_e,onPageSizeChange:Te,onJumpToPageChange:$,onJumpToPage:kt,onSelectionClear:()=>K(new Set)})]}),e.jsxs(Ms,{value:"tasks",className:"space-y-6 mt-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),p&&e.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[e.jsx(Dl,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:p.utils,modelNames:h,onChange:(le,fe)=>ye("utils",le,fe),dataTour:"task-model-select"}),e.jsx(Dl,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:p.tool_use,modelNames:h,onChange:(le,fe)=>ye("tool_use",le,fe)}),e.jsx(Dl,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:p.replyer,modelNames:h,onChange:(le,fe)=>ye("replyer",le,fe)}),e.jsx(Dl,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:p.planner,modelNames:h,onChange:(le,fe)=>ye("planner",le,fe)}),e.jsx(Dl,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:p.vlm,modelNames:h,onChange:(le,fe)=>ye("vlm",le,fe),hideTemperature:!0}),e.jsx(Dl,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:p.voice,modelNames:h,onChange:(le,fe)=>ye("voice",le,fe),hideTemperature:!0,hideMaxTokens:!0}),e.jsx(Dl,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:p.embedding,modelNames:h,onChange:(le,fe)=>ye("embedding",le,fe),hideTemperature:!0,hideMaxTokens:!0}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),e.jsx(Dl,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:p.lpmm_entity_extract,modelNames:h,onChange:(le,fe)=>ye("lpmm_entity_extract",le,fe)}),e.jsx(Dl,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:p.lpmm_rdf_build,modelNames:h,onChange:(le,fe)=>ye("lpmm_rdf_build",le,fe)})]})]})]})]}),e.jsx(Js,{open:P,onOpenChange:ht,children:e.jsxs(qs,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"model-dialog",preventOutsideClose:fa,children:[e.jsxs(Vs,{children:[e.jsx(Gs,{children:H!==null?"编辑模型":"添加模型"}),e.jsx(nt,{children:"配置模型的基本信息和参数"})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":"model-name-input",children:[e.jsx(T,{htmlFor:"model_name",className:Ee.name?"text-destructive":"",children:"模型名称 *"}),e.jsx(ne,{id:"model_name",value:C?.name||"",onChange:le=>{R(fe=>fe?{...fe,name:le.target.value}:null),Ee.name&&de(fe=>({...fe,name:void 0}))},placeholder:"例如: qwen3-30b",className:Ee.name?"border-destructive focus-visible:ring-destructive":""}),Ee.name?e.jsx("p",{className:"text-xs text-destructive",children:Ee.name}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"model-provider-select",children:[e.jsx(T,{htmlFor:"api_provider",className:Ee.api_provider?"text-destructive":"",children:"API 提供商 *"}),e.jsxs(Pe,{value:C?.api_provider||"",onValueChange:le=>{R(fe=>fe?{...fe,api_provider:le}:null),Ks(),Ee.api_provider&&de(fe=>({...fe,api_provider:void 0}))},children:[e.jsx(Be,{id:"api_provider",className:Ee.api_provider?"border-destructive focus-visible:ring-destructive":"",children:e.jsx(Fe,{placeholder:"选择提供商"})}),e.jsx(Ie,{children:r.map(le=>e.jsx(ee,{value:le,children:le},le))})]}),Ee.api_provider&&e.jsx("p",{className:"text-xs text-destructive",children:Ee.api_provider})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"model-identifier-input",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{htmlFor:"model_identifier",className:Ee.model_identifier?"text-destructive":"",children:"模型标识符 *"}),zs?.modelFetcher&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ke,{variant:"secondary",className:"text-xs",children:zs.display_name}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>C?.api_provider&&Ls(C.api_provider,!0),disabled:Ts,children:Ts?e.jsx(Fs,{className:"h-3 w-3 animate-spin"}):e.jsx(ut,{className:"h-3 w-3"})})]})]}),zs?.modelFetcher?e.jsxs(hl,{open:z,onOpenChange:G,children:[e.jsx(fl,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":z,className:"w-full justify-between font-normal",disabled:Ts||!!He,children:[Ts?e.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(Fs,{className:"h-4 w-4 animate-spin"}),"正在获取模型列表..."]}):He?e.jsx("span",{className:"text-muted-foreground text-sm",children:"点击下方输入框手动填写"}):C?.model_identifier?e.jsx("span",{className:"truncate",children:C.model_identifier}):e.jsx("span",{className:"text-muted-foreground",children:"搜索或选择模型..."}),e.jsx(cx,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(nl,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(dd,{children:[e.jsx(ud,{placeholder:"搜索模型..."}),e.jsx(ss,{className:"h-[300px]",children:e.jsxs(md,{className:"max-h-none overflow-visible",children:[e.jsx(xd,{children:He?e.jsxs("div",{className:"py-4 px-2 text-center space-y-2",children:[e.jsx("p",{className:"text-sm text-destructive",children:He}),!He.includes("API Key")&&e.jsx(_,{variant:"link",size:"sm",onClick:()=>C?.api_provider&&Ls(C.api_provider,!0),children:"重试"})]}):"未找到匹配的模型"}),e.jsx(oc,{heading:"可用模型",children:Ze.map(le=>e.jsxs(dc,{value:le.id,onSelect:()=>{R(fe=>fe?{...fe,model_identifier:le.id}:null),G(!1)},children:[e.jsx(Lt,{className:`mr-2 h-4 w-4 ${C?.model_identifier===le.id?"opacity-100":"opacity-0"}`}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:le.id}),le.name!==le.id&&e.jsx("span",{className:"text-xs text-muted-foreground",children:le.name})]})]},le.id))}),e.jsx(oc,{heading:"手动输入",children:e.jsxs(dc,{value:"__manual_input__",onSelect:()=>{G(!1)},children:[e.jsx(Jn,{className:"mr-2 h-4 w-4"}),"手动输入模型标识符..."]})})]})})]})})]}):e.jsx(ne,{id:"model_identifier",value:C?.model_identifier||"",onChange:le=>{R(fe=>fe?{...fe,model_identifier:le.target.value}:null),Ee.model_identifier&&de(fe=>({...fe,model_identifier:void 0}))},placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507",className:Ee.model_identifier?"border-destructive focus-visible:ring-destructive":""}),Ee.model_identifier&&e.jsx("p",{className:"text-xs text-destructive",children:Ee.model_identifier}),He&&zs?.modelFetcher&&!Ee.model_identifier&&e.jsxs(pt,{variant:"destructive",className:"mt-2 py-2",children:[e.jsx(Qt,{className:"h-4 w-4"}),e.jsx(gt,{className:"text-xs",children:He})]}),zs?.modelFetcher&&e.jsx(ne,{value:C?.model_identifier||"",onChange:le=>{R(fe=>fe?{...fe,model_identifier:le.target.value}:null),Ee.model_identifier&&de(fe=>({...fe,model_identifier:void 0}))},placeholder:"或手动输入模型标识符",className:`mt-2 ${Ee.model_identifier?"border-destructive focus-visible:ring-destructive":""}`}),!Ee.model_identifier&&e.jsx("p",{className:"text-xs text-muted-foreground",children:He?'请手动输入模型标识符,或前往"模型提供商配置"检查 API Key':zs?.modelFetcher?`已识别为 ${zs.display_name},支持自动获取模型列表`:"API 提供商提供的模型 ID"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),e.jsx(ne,{id:"price_in",type:"number",step:"0.1",min:"0",value:C?.price_in??"",onChange:le=>{const fe=le.target.value===""?null:parseFloat(le.target.value);R(es=>es?{...es,price_in:fe}:null)},placeholder:"默认: 0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),e.jsx(ne,{id:"price_out",type:"number",step:"0.1",min:"0",value:C?.price_out??"",onChange:le=>{const fe=le.target.value===""?null:parseFloat(le.target.value);R(es=>es?{...es,price_out:fe}:null)},placeholder:"默认: 0"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"enable_model_temperature",className:"cursor-pointer",children:"自定义模型温度"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后将覆盖「为模型分配功能」中的任务温度配置"})]}),e.jsx(Ge,{id:"enable_model_temperature",checked:C?.temperature!=null,onCheckedChange:le=>{R(le?fe=>fe?{...fe,temperature:.5}:null:fe=>fe?{...fe,temperature:null}:null)}})]}),C?.temperature!=null&&e.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm",children:"温度值"}),e.jsx("span",{className:"text-sm font-medium tabular-nums",children:C.temperature.toFixed(1)})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"0"}),e.jsx(Wa,{value:[C.temperature],onValueChange:le=>R(fe=>fe?{...fe,temperature:le[0]}:null),min:0,max:1,step:.1,className:"flex-1"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"较低的温度(0.1-0.3)产生更确定的输出,较高的温度(0.7-1.0)产生更多样化的输出"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"enable_model_max_tokens",className:"cursor-pointer",children:"自定义最大 Token"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后将覆盖「为模型分配功能」中的任务最大 Token 配置"})]}),e.jsx(Ge,{id:"enable_model_max_tokens",checked:C?.max_tokens!=null,onCheckedChange:le=>{R(le?fe=>fe?{...fe,max_tokens:2048}:null:fe=>fe?{...fe,max_tokens:null}:null)}})]}),C?.max_tokens!=null&&e.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm",children:"最大 Token 数"}),e.jsx(ne,{type:"number",min:"1",max:"128000",value:C.max_tokens,onChange:le=>{const fe=parseInt(le.target.value);!isNaN(fe)&&fe>=1&&R(es=>es?{...es,max_tokens:fe}:null)},className:"w-28 h-8 text-sm"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"限制模型单次输出的最大 token 数量,不同模型支持的上限不同"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"force_stream_mode",checked:C?.force_stream_mode||!1,onCheckedChange:le=>R(fe=>fe?{...fe,force_stream_mode:le}:null)}),e.jsx(T,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"额外参数"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(_,{type:"button",variant:"outline",size:"sm",className:"flex-1 justify-start h-9",onClick:()=>L(!0),children:[e.jsx(bn,{className:"h-4 w-4 mr-2"}),Object.keys(C?.extra_params||{}).length>0?e.jsxs("span",{children:["已配置 ",Object.keys(C?.extra_params||{}).length," 个参数"]}):e.jsx("span",{className:"text-muted-foreground",children:"未配置额外参数"})]})}),Object.keys(C?.extra_params||{}).length>0&&e.jsxs("div",{className:"text-xs text-muted-foreground px-1",children:[Object.keys(C?.extra_params||{}).slice(0,3).map(le=>e.jsx("span",{className:"inline-block mr-2",children:e.jsx("code",{className:"px-1.5 py-0.5 bg-muted rounded",children:le})},le)),Object.keys(C?.extra_params||{}).length>3&&e.jsx("span",{children:"..."})]})]})]}),e.jsxs(xt,{children:[e.jsx(_,{variant:"outline",onClick:()=>E(!1),"data-tour":"model-cancel-button",children:"取消"}),e.jsx(_,{onClick:rs,"data-tour":"model-save-button",children:"保存"})]})]})}),e.jsx(Cs,{open:me,onOpenChange:Ne,children:e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认删除"}),e.jsxs(Ns,{children:['确定要删除模型 "',je!==null?a[je]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:ca,children:"删除"})]})]})}),e.jsx(Cs,{open:B,onOpenChange:ue,children:e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认批量删除"}),e.jsxs(Ns,{children:["确定要删除选中的 ",D.size," 个模型吗? 此操作无法撤销。"]})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:te,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),e.jsx(Cs,{open:Re,onOpenChange:se,children:e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsxs(vs,{className:"flex items-center gap-2",children:[e.jsx(qt,{className:"h-5 w-5 text-amber-500"}),"更换嵌入模型警告"]}),e.jsx(Ns,{asChild:!0,children:e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-foreground",children:"注意:"}),"更换嵌入模型可能会影响知识库的匹配精度!"]}),e.jsxs("ul",{className:"space-y-2 ml-4 list-disc text-muted-foreground",children:[e.jsx("li",{children:"不同的嵌入模型会产生不同的向量表示"}),e.jsx("li",{children:"这可能导致现有知识库的检索结果不准确"}),e.jsx("li",{children:"建议更换嵌入模型后重新生成所有知识库的向量"})]}),e.jsx("p",{className:"text-foreground font-medium",children:"确定要更换嵌入模型吗?"})]})})]}),e.jsxs(js,{children:[e.jsx(ys,{onClick:Me,children:"取消"}),e.jsx(bs,{onClick:U,className:"bg-amber-600 hover:bg-amber-700",children:"确认更换"})]})]})}),e.jsx(l4,{open:X,onOpenChange:L,value:C?.extra_params||{},onChange:le=>R(fe=>fe?{...fe,extra_params:le}:null)}),e.jsx(ar,{})]})})}const uc=Sj,mc=kw,xc=Cw,hd="/api/webui/config";async function C4(){const l=await(await Se(`${hd}/adapter-config/path`)).json();return!l.success||!l.path?null:{path:l.path,lastModified:l.lastModified}}async function Qg(a){const r=await(await Se(`${hd}/adapter-config/path`,{method:"POST",headers:Ws(),body:JSON.stringify({path:a})})).json();if(!r.success)throw new Error(r.message||"保存路径失败")}async function Yg(a){const r=await(await Se(`${hd}/adapter-config?path=${encodeURIComponent(a)}`)).json();if(!r.success)throw new Error("读取配置文件失败");return r.content}async function Jg(a,l){const c=await(await Se(`${hd}/adapter-config`,{method:"POST",headers:Ws(),body:JSON.stringify({path:a,content:l})})).json();if(!c.success)throw new Error(c.message||"保存配置失败")}const At={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},debug:{level:"INFO"}},Pm={oneclick:{name:"一键包",description:"使用一键包部署的适配器配置",path:"../MaiBot-Napcat-Adapter/config.toml",icon:ua},docker:{name:"Docker",description:"Docker Compose 部署的适配器配置",path:"/MaiMBot/adapters-config/config.toml",icon:R1}};function Fm(a){try{const l=Nx(a);return{inner:{...At.inner,...l.inner},nickname:{...At.nickname,...l.nickname},napcat_server:{...At.napcat_server,...l.napcat_server},maibot_server:{...At.maibot_server,...l.maibot_server},chat:{...At.chat,...l.chat},voice:{...At.voice,...l.voice},debug:{...At.debug,...l.debug}}}catch(l){throw console.error("TOML 解析失败:",l),new Error(`无法解析 TOML 文件: ${l instanceof Error?l.message:"未知错误"}`)}}function Hm(a){try{const l=(d,m)=>d===""||d===null||d===void 0?m:d,r={inner:{version:l(a.inner.version,At.inner.version)},nickname:{nickname:l(a.nickname.nickname,At.nickname.nickname)},napcat_server:{host:l(a.napcat_server.host,At.napcat_server.host),port:l(a.napcat_server.port||0,At.napcat_server.port),token:l(a.napcat_server.token,At.napcat_server.token),heartbeat_interval:l(a.napcat_server.heartbeat_interval||0,At.napcat_server.heartbeat_interval)},maibot_server:{host:l(a.maibot_server.host,At.maibot_server.host),port:l(a.maibot_server.port||0,At.maibot_server.port)},chat:{group_list_type:l(a.chat.group_list_type,At.chat.group_list_type),group_list:a.chat.group_list||[],private_list_type:l(a.chat.private_list_type,At.chat.private_list_type),private_list:a.chat.private_list||[],ban_user_id:a.chat.ban_user_id||[],ban_qq_bot:a.chat.ban_qq_bot??At.chat.ban_qq_bot,enable_poke:a.chat.enable_poke??At.chat.enable_poke},voice:{use_tts:a.voice.use_tts??At.voice.use_tts},debug:{level:l(a.debug.level,At.debug.level)}};let c=BS(r);return c=T4(c),c}catch(l){throw console.error("TOML 生成失败:",l),new Error(`无法生成 TOML 文件: ${l instanceof Error?l.message:"未知错误"}`)}}function T4(a){const l=a.split(` +`),r=[];for(let c=0;c"|?*\x00-\x1F]/.test(a)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}}function E4(){const[a,l]=u.useState("upload"),[r,c]=u.useState(null),[d,m]=u.useState(""),[h,f]=u.useState(""),[p,g]=u.useState("oneclick"),[N,j]=u.useState(""),[y,b]=u.useState(!1),[w,A]=u.useState(!1),[M,S]=u.useState(!1),[P,E]=u.useState(!1),[C,R]=u.useState(null),[H,O]=u.useState(!1),X=u.useRef(null),{toast:L}=it(),me=u.useRef(null),Ne=z=>{if(f(z),z.trim()){const G=qm(z);j(G.error)}else j("")},je=u.useCallback(async z=>{const G=Pm[z];A(!0);try{const Re=await Yg(G.path),se=Fm(Re);c(se),g(z),f(G.path),await Qg(G.path),L({title:"加载成功",description:`已从${G.name}预设加载配置`})}catch(Re){console.error("加载预设配置失败:",Re),L({title:"加载失败",description:Re instanceof Error?Re.message:"无法读取预设配置文件",variant:"destructive"})}finally{A(!1)}},[L]),ce=u.useCallback(async z=>{const G=qm(z);if(!G.valid){j(G.error),L({title:"路径无效",description:G.error,variant:"destructive"});return}j(""),A(!0);try{const Re=await Yg(z),se=Fm(Re);c(se),f(z),await Qg(z),L({title:"加载成功",description:"已从配置文件加载"})}catch(Re){console.error("加载配置失败:",Re),L({title:"加载失败",description:Re instanceof Error?Re.message:"无法读取配置文件",variant:"destructive"})}finally{A(!1)}},[L]);u.useEffect(()=>{(async()=>{try{const G=await C4();if(G&&G.path){f(G.path);const Re=Object.entries(Pm).find(([,se])=>se.path===G.path);Re?(l("preset"),g(Re[0]),await je(Re[0])):(l("path"),await ce(G.path))}}catch(G){console.error("加载保存的路径失败:",G)}})()},[ce,je]);const ge=u.useCallback(z=>{a!=="path"&&a!=="preset"||!h||(me.current&&clearTimeout(me.current),me.current=setTimeout(async()=>{b(!0);try{const G=Hm(z);await Jg(h,G),L({title:"自动保存成功",description:"配置已保存到文件"})}catch(G){console.error("自动保存失败:",G),L({title:"自动保存失败",description:G instanceof Error?G.message:"保存配置失败",variant:"destructive"})}finally{b(!1)}},1e3))},[a,h,L]),pe=async()=>{if(!r||!h)return;const z=qm(h);if(!z.valid){L({title:"保存失败",description:z.error,variant:"destructive"});return}b(!0);try{const G=Hm(r);await Jg(h,G),L({title:"保存成功",description:"配置已保存到文件"})}catch(G){console.error("保存失败:",G),L({title:"保存失败",description:G instanceof Error?G.message:"保存配置失败",variant:"destructive"})}finally{b(!1)}},D=async()=>{h&&await ce(h)},K=z=>{if(z!==a){if(r){R(z),S(!0);return}B(z)}},B=z=>{c(null),m(""),j(""),l(z),z==="preset"&&je("oneclick"),L({title:"已切换模式",description:{upload:"现在可以上传配置文件",path:"现在可以指定配置文件路径",preset:"现在可以使用预设配置"}[z]})},ue=()=>{C&&(B(C),R(null)),S(!1)},Q=()=>{if(r){E(!0);return}_e()},_e=()=>{f(""),c(null),j(""),L({title:"已清空",description:"路径和配置已清空"})},he=()=>{_e(),E(!1)},Te=z=>{const G=z.target.files?.[0];if(!G)return;const Re=new FileReader;Re.onload=se=>{try{const Oe=se.target?.result,ns=Fm(Oe);c(ns),m(G.name),L({title:"上传成功",description:`已加载配置文件:${G.name}`})}catch(Oe){console.error("解析配置文件失败:",Oe),L({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},Re.readAsText(G)},V=()=>{if(!r)return;const z=Hm(r),G=new Blob([z],{type:"text/plain;charset=utf-8"}),Re=URL.createObjectURL(G),se=document.createElement("a");se.href=Re,se.download=d||"config.toml",document.body.appendChild(se),se.click(),document.body.removeChild(se),URL.revokeObjectURL(Re),L({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},$=()=>{c(JSON.parse(JSON.stringify(At))),m("config.toml"),L({title:"已加载默认配置",description:"可以开始编辑配置"})};return e.jsx(ss,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg border border-amber-500/50 bg-amber-500/10 text-amber-700 dark:text-amber-400",children:[e.jsx(Rt,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),e.jsx("p",{className:"text-sm",children:"适配器配置保存之后使用 WebUI 的重启功能适配器并不会重启,需要手动重启适配器。"})]}),e.jsx(uc,{open:H,onOpenChange:O,children:e.jsxs(Ce,{children:[e.jsx(De,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Ue,{children:"工作模式"}),e.jsx(fs,{children:"选择配置文件的管理方式"})]}),e.jsx(mc,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"sm",className:"w-9 p-0",children:[e.jsx($a,{className:`h-4 w-4 transition-transform duration-200 ${H?"transform rotate-180":""}`}),e.jsx("span",{className:"sr-only",children:"切换"})]})})]})}),e.jsx(xc,{children:e.jsxs(Ae,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 md:gap-4",children:[e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${a==="preset"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>K("preset"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(ua,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"预设模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"使用预设的部署配置"})]})]})}),e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${a==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>K("upload"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(rc,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${a==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>K("path"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(D1,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),a==="preset"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsx(T,{className:"text-sm md:text-base",children:"选择部署方式"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(Pm).map(([z,G])=>{const Re=G.icon,se=p===z;return e.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${se?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{g(z),je(z)},children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Re,{className:"h-5 w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"font-semibold text-sm",children:G.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:G.description}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:G.path})]})]})},z)})})]}),a==="path"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(ne,{id:"config-path",value:h,onChange:z=>Ne(z.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${N?"border-destructive":""}`}),N&&e.jsx("p",{className:"text-xs text-destructive",children:N})]}),e.jsx(_,{onClick:()=>ce(h),disabled:w||!h||!!N,className:"w-full sm:w-auto",children:w?e.jsxs(e.Fragment,{children:[e.jsx(ut,{className:"h-4 w-4 animate-spin mr-2"}),e.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sm:hidden",children:"加载配置"}),e.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),e.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[e.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[e.jsx("span",{children:"路径格式说明"}),e.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),e.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),e.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[e.jsx("div",{children:"C:\\Adapter\\config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),e.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[e.jsx("div",{children:"/opt/adapter/config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),e.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})})]})}),e.jsxs(pt,{children:[e.jsx(Qt,{className:"h-4 w-4"}),e.jsx(gt,{children:a==="preset"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"预设模式:"}),"选择预设的部署方式,配置会自动加载,修改后 1 秒自动保存",y&&" (正在保存...)"]}):a==="upload"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",y&&" (正在保存...)"]})})]}),a==="upload"&&!r&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[e.jsx("input",{ref:X,type:"file",accept:".toml",className:"hidden",onChange:Te}),e.jsxs(_,{onClick:()=>X.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(rc,{className:"mr-2 h-4 w-4"}),"上传配置"]}),e.jsxs(_,{onClick:$,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(La,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),a==="upload"&&r&&e.jsx("div",{className:"flex gap-2",children:e.jsxs(_,{onClick:V,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(na,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),(a==="preset"||a==="path")&&r&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs(_,{onClick:pe,size:"sm",disabled:y||!!N,className:"w-full sm:w-auto",children:[e.jsx(fc,{className:"mr-2 h-4 w-4"}),y?"保存中...":"立即保存"]}),e.jsxs(_,{onClick:D,size:"sm",variant:"outline",disabled:w,className:"w-full sm:w-auto",children:[e.jsx(ut,{className:`mr-2 h-4 w-4 ${w?"animate-spin":""}`}),"刷新"]}),a==="path"&&e.jsxs(_,{onClick:Q,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(us,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),r?e.jsxs(Yt,{defaultValue:"napcat",className:"w-full",children:[e.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:e.jsxs(Vt,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[e.jsxs(Ye,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),e.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),e.jsxs(Ye,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),e.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),e.jsxs(Ye,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),e.jsx("span",{className:"sm:hidden",children:"聊天"})]}),e.jsxs(Ye,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),e.jsx("span",{className:"sm:hidden",children:"语音"})]}),e.jsx(Ye,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),e.jsx(Ms,{value:"napcat",className:"space-y-4",children:e.jsx(M4,{config:r,onChange:z=>{c(z),ge(z)}})}),e.jsx(Ms,{value:"maibot",className:"space-y-4",children:e.jsx(A4,{config:r,onChange:z=>{c(z),ge(z)}})}),e.jsx(Ms,{value:"chat",className:"space-y-4",children:e.jsx(z4,{config:r,onChange:z=>{c(z),ge(z)}})}),e.jsx(Ms,{value:"voice",className:"space-y-4",children:e.jsx(R4,{config:r,onChange:z=>{c(z),ge(z)}})}),e.jsx(Ms,{value:"debug",className:"space-y-4",children:e.jsx(D4,{config:r,onChange:z=>{c(z),ge(z)}})})]}):e.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:e.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[e.jsx(La,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:a==="preset"?"请选择预设的部署方式":a==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),e.jsx(Cs,{open:M,onOpenChange:S,children:e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认切换模式"}),e.jsxs(Ns,{children:["切换模式将清空当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),e.jsxs(js,{children:[e.jsx(ys,{onClick:()=>{S(!1),R(null)},children:"取消"}),e.jsx(bs,{onClick:ue,children:"确认切换"})]})]})}),e.jsx(Cs,{open:P,onOpenChange:E,children:e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认清空路径"}),e.jsxs(Ns,{children:["清空路径将清除当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),e.jsxs(js,{children:[e.jsx(ys,{onClick:()=>E(!1),children:"取消"}),e.jsx(bs,{onClick:he,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function M4({config:a,onChange:l}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),e.jsxs("div",{className:"grid gap-3 md:gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),e.jsx(ne,{id:"napcat-host",value:a.napcat_server.host,onChange:r=>l({...a,napcat_server:{...a.napcat_server,host:r.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),e.jsx(ne,{id:"napcat-port",type:"number",value:a.napcat_server.port||"",onChange:r=>l({...a,napcat_server:{...a.napcat_server,port:r.target.value?parseInt(r.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),e.jsx(ne,{id:"napcat-token",type:"password",value:a.napcat_server.token,onChange:r=>l({...a,napcat_server:{...a.napcat_server,token:r.target.value}}),placeholder:"留空表示无需令牌",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),e.jsx(ne,{id:"napcat-heartbeat",type:"number",value:a.napcat_server.heartbeat_interval||"",onChange:r=>l({...a,napcat_server:{...a.napcat_server,heartbeat_interval:r.target.value?parseInt(r.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function A4({config:a,onChange:l}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),e.jsxs("div",{className:"grid gap-3 md:gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),e.jsx(ne,{id:"maibot-host",value:a.maibot_server.host,onChange:r=>l({...a,maibot_server:{...a.maibot_server,host:r.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),e.jsx(ne,{id:"maibot-port",type:"number",value:a.maibot_server.port||"",onChange:r=>l({...a,maibot_server:{...a.maibot_server,port:r.target.value?parseInt(r.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function z4({config:a,onChange:l}){const r=m=>{const h={...a};m==="group"?h.chat.group_list=[...h.chat.group_list,0]:m==="private"?h.chat.private_list=[...h.chat.private_list,0]:h.chat.ban_user_id=[...h.chat.ban_user_id,0],l(h)},c=(m,h)=>{const f={...a};m==="group"?f.chat.group_list=f.chat.group_list.filter((p,g)=>g!==h):m==="private"?f.chat.private_list=f.chat.private_list.filter((p,g)=>g!==h):f.chat.ban_user_id=f.chat.ban_user_id.filter((p,g)=>g!==h),l(f)},d=(m,h,f)=>{const p={...a};m==="group"?p.chat.group_list[h]=f:m==="private"?p.chat.private_list[h]=f:p.chat.ban_user_id[h]=f,l(p)};return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),e.jsxs("div",{className:"grid gap-4 md:gap-6",children:[e.jsxs("div",{className:"space-y-3 md:space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-sm md:text-base",children:"群组名单类型"}),e.jsxs(Pe,{value:a.chat.group_list_type,onValueChange:m=>l({...a,chat:{...a.chat,group_list_type:m}}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(ee,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsx(T,{className:"text-sm md:text-base",children:"群组列表"}),e.jsxs(_,{onClick:()=>r("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(La,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),a.chat.group_list.map((m,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{type:"number",value:m,onChange:f=>d("group",h,parseInt(f.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),e.jsxs(Cs,{children:[e.jsx(_t,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(us,{className:"h-4 w-4"})})}),e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认删除"}),e.jsxs(Ns,{children:["确定要删除群号 ",m," 吗?此操作无法撤销。"]})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:()=>c("group",h),children:"删除"})]})]})]})]},h)),a.chat.group_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),e.jsxs("div",{className:"space-y-3 md:space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-sm md:text-base",children:"私聊名单类型"}),e.jsxs(Pe,{value:a.chat.private_list_type,onValueChange:m=>l({...a,chat:{...a.chat,private_list_type:m}}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(ee,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsx(T,{className:"text-sm md:text-base",children:"私聊列表"}),e.jsxs(_,{onClick:()=>r("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(La,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),a.chat.private_list.map((m,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{type:"number",value:m,onChange:f=>d("private",h,parseInt(f.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(Cs,{children:[e.jsx(_t,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(us,{className:"h-4 w-4"})})}),e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认删除"}),e.jsxs(Ns,{children:["确定要删除用户 ",m," 吗?此操作无法撤销。"]})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:()=>c("private",h),children:"删除"})]})]})]})]},h)),a.chat.private_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-sm md:text-base",children:"全局禁止名单"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),e.jsxs(_,{onClick:()=>r("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(La,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),a.chat.ban_user_id.map((m,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{type:"number",value:m,onChange:f=>d("ban",h,parseInt(f.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(Cs,{children:[e.jsx(_t,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(us,{className:"h-4 w-4"})})}),e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认删除"}),e.jsxs(Ns,{children:["确定要从全局禁止名单中删除用户 ",m," 吗?此操作无法撤销。"]})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:()=>c("ban",h),children:"删除"})]})]})]})]},h)),a.chat.ban_user_id.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),e.jsx(Ge,{checked:a.chat.ban_qq_bot,onCheckedChange:m=>l({...a,chat:{...a.chat,ban_qq_bot:m}})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),e.jsx(Ge,{checked:a.chat.enable_poke,onCheckedChange:m=>l({...a,chat:{...a.chat,enable_poke:m}})})]})]})]})})}function R4({config:a,onChange:l}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),e.jsx(Ge,{checked:a.voice.use_tts,onCheckedChange:r=>l({...a,voice:{use_tts:r}})})]})]})})}function D4({config:a,onChange:l}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),e.jsx("div",{className:"grid gap-3 md:gap-4",children:e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-sm md:text-base",children:"日志等级"}),e.jsxs(Pe,{value:a.debug.level,onValueChange:r=>l({...a,debug:{level:r}}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"DEBUG",children:"DEBUG(调试)"}),e.jsx(ee,{value:"INFO",children:"INFO(信息)"}),e.jsx(ee,{value:"WARNING",children:"WARNING(警告)"}),e.jsx(ee,{value:"ERROR",children:"ERROR(错误)"}),e.jsx(ee,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}const O4=["defaultChecked","defaultValue","suppressContentEditableWarning","suppressHydrationWarning","dangerouslySetInnerHTML","accessKey","className","contentEditable","contextMenu","dir","draggable","hidden","id","lang","placeholder","slot","spellCheck","style","tabIndex","title","translate","radioGroup","role","about","datatype","inlist","prefix","property","resource","typeof","vocab","autoCapitalize","autoCorrect","autoSave","color","itemProp","itemScope","itemType","itemID","itemRef","results","security","unselectable","inputMode","is","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],L4=/^(aria-|data-)/,aN=a=>Object.fromEntries(Object.entries(a).filter(([l])=>L4.test(l)||O4.includes(l)));function U4(a,l){const r=aN(a);return Object.keys(a).some(c=>!Object.hasOwn(r,c)&&a[c]!==l[c])}class $4 extends u.Component{container;plugin;componentDidMount(){this.installPlugin()}componentDidUpdate(l){if(l.uppy!==this.props.uppy)this.uninstallPlugin(l),this.installPlugin();else if(U4(this.props,l)){const{uppy:r,...c}={...this.props,target:this.container};this.plugin.setOptions(c)}}componentWillUnmount(){this.uninstallPlugin()}installPlugin(){const{uppy:l,...r}={id:"Dashboard",...this.props,inline:!0,target:this.container};l.use(x_,r),this.plugin=l.getPlugin(r.id)}uninstallPlugin(l=this.props){const{uppy:r}=l;r.removePlugin(this.plugin)}render(){return u.createElement("div",{className:"uppy-Container",ref:l=>{this.container=l},...aN(this.props)})}}function B4({src:a,alt:l="表情包",className:r,maxRetries:c=5,retryInterval:d=1500}){const[m,h]=u.useState("loading"),[f,p]=u.useState(0),[g,N]=u.useState(null),[j,y]=u.useState(a);a!==j&&(h("loading"),p(0),N(null),y(a));const b=u.useCallback(async()=>{try{const w=await fetch(a,{credentials:"include"});if(w.status===202){h("generating"),f{p(S=>S+1)},d):h("error");return}if(!w.ok){h("error");return}const A=await w.blob(),M=URL.createObjectURL(A);N(M),h("loaded")}catch(w){console.error("加载缩略图失败:",w),h("error")}},[a,f,c,d]);return u.useEffect(()=>{b()},[b]),u.useEffect(()=>()=>{g&&URL.revokeObjectURL(g)},[g]),m==="loading"||m==="generating"?e.jsx(As,{className:F("w-full h-full",r)}):m==="error"||!g?e.jsx("div",{className:F("w-full h-full flex items-center justify-center bg-muted",r),children:e.jsx(ox,{className:"h-8 w-8 text-muted-foreground"})}):e.jsx("img",{src:g,alt:l,className:F("w-full h-full object-contain",r)})}function I4({children:a,className:l}){return e.jsx(gx,{content:a,className:l})}const sl="/api/webui/emoji";async function P4(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.search&&l.append("search",a.search),a.is_registered!==void 0&&l.append("is_registered",a.is_registered.toString()),a.is_banned!==void 0&&l.append("is_banned",a.is_banned.toString()),a.format&&l.append("format",a.format),a.sort_by&&l.append("sort_by",a.sort_by),a.sort_order&&l.append("sort_order",a.sort_order);const r=await Se(`${sl}/list?${l}`,{});if(!r.ok)throw new Error(`获取表情包列表失败: ${r.statusText}`);return r.json()}async function F4(a){const l=await Se(`${sl}/${a}`,{});if(!l.ok)throw new Error(`获取表情包详情失败: ${l.statusText}`);return l.json()}async function H4(a,l){const r=await Se(`${sl}/${a}`,{method:"PATCH",body:JSON.stringify(l)});if(!r.ok)throw new Error(`更新表情包失败: ${r.statusText}`);return r.json()}async function q4(a){const l=await Se(`${sl}/${a}`,{method:"DELETE"});if(!l.ok)throw new Error(`删除表情包失败: ${l.statusText}`);return l.json()}async function V4(){const a=await Se(`${sl}/stats/summary`,{});if(!a.ok)throw new Error(`获取统计数据失败: ${a.statusText}`);return a.json()}async function G4(a){const l=await Se(`${sl}/${a}/register`,{method:"POST"});if(!l.ok)throw new Error(`注册表情包失败: ${l.statusText}`);return l.json()}async function K4(a){const l=await Se(`${sl}/${a}/ban`,{method:"POST"});if(!l.ok)throw new Error(`封禁表情包失败: ${l.statusText}`);return l.json()}function Q4(a,l=!1){return l?`${sl}/${a}/thumbnail?original=true`:`${sl}/${a}/thumbnail`}function Y4(a){return`${sl}/${a}/thumbnail?original=true`}async function J4(a){const l=await Se(`${sl}/batch/delete`,{method:"POST",body:JSON.stringify({emoji_ids:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"批量删除失败")}return l.json()}function X4(){return`${sl}/upload`}function Z4(){const[a,l]=u.useState([]),[r,c]=u.useState(null),[d,m]=u.useState(!1),[h,f]=u.useState(1),[p,g]=u.useState(0),[N,j]=u.useState(20),[y,b]=u.useState("all"),[w,A]=u.useState("all"),[M,S]=u.useState("all"),[P,E]=u.useState("usage_count"),[C,R]=u.useState("desc"),[H,O]=u.useState(null),[X,L]=u.useState(!1),[me,Ne]=u.useState(!1),[je,ce]=u.useState(!1),[ge,pe]=u.useState(new Set),[D,K]=u.useState(!1),[B,ue]=u.useState(""),[Q,_e]=u.useState("medium"),[he,Te]=u.useState(!1),{toast:V}=it(),$=u.useCallback(async()=>{try{m(!0);const de=await P4({page:h,page_size:N,is_registered:y==="all"?void 0:y==="registered",is_banned:w==="all"?void 0:w==="banned",format:M==="all"?void 0:M,sort_by:P,sort_order:C});l(de.data),g(de.total)}catch(de){const ze=de instanceof Error?de.message:"加载表情包列表失败";V({title:"错误",description:ze,variant:"destructive"})}finally{m(!1)}},[h,N,y,w,M,P,C,V]),z=async()=>{try{const de=await V4();c(de.data)}catch(de){console.error("加载统计数据失败:",de)}};u.useEffect(()=>{$()},[$]),u.useEffect(()=>{z()},[]);const G=async de=>{try{const ze=await F4(de.id);O(ze.data),L(!0)}catch(ze){const ws=ze instanceof Error?ze.message:"加载详情失败";V({title:"错误",description:ws,variant:"destructive"})}},Re=de=>{O(de),Ne(!0)},se=de=>{O(de),ce(!0)},Oe=async()=>{if(H)try{await q4(H.id),V({title:"成功",description:"表情包已删除"}),ce(!1),O(null),$(),z()}catch(de){const ze=de instanceof Error?de.message:"删除失败";V({title:"错误",description:ze,variant:"destructive"})}},ns=async de=>{try{await G4(de.id),V({title:"成功",description:"表情包已注册"}),$(),z()}catch(ze){const ws=ze instanceof Error?ze.message:"注册失败";V({title:"错误",description:ws,variant:"destructive"})}},J=async de=>{try{await K4(de.id),V({title:"成功",description:"表情包已封禁"}),$(),z()}catch(ze){const ws=ze instanceof Error?ze.message:"封禁失败";V({title:"错误",description:ws,variant:"destructive"})}},Z=de=>{const ze=new Set(ge);ze.has(de)?ze.delete(de):ze.add(de),pe(ze)},Le=async()=>{try{const de=await J4(Array.from(ge));V({title:"批量删除完成",description:de.message}),pe(new Set),K(!1),$(),z()}catch(de){V({title:"批量删除失败",description:de instanceof Error?de.message:"批量删除失败",variant:"destructive"})}},ae=()=>{const de=parseInt(B),ze=Math.ceil(p/N);de>=1&&de<=ze?(f(de),ue("")):V({title:"无效的页码",description:`请输入1-${ze}之间的页码`,variant:"destructive"})},Ee=r?.formats?Object.keys(r.formats):[];return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),e.jsxs(_,{onClick:()=>Te(!0),className:"gap-2",children:[e.jsx(rc,{className:"h-4 w-4"}),"上传表情包"]})]}),e.jsx(ss,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[r&&e.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[e.jsx(Ce,{children:e.jsxs(De,{className:"pb-2",children:[e.jsx(fs,{children:"总数"}),e.jsx(Ue,{className:"text-2xl",children:r.total})]})}),e.jsx(Ce,{children:e.jsxs(De,{className:"pb-2",children:[e.jsx(fs,{children:"已注册"}),e.jsx(Ue,{className:"text-2xl text-green-600",children:r.registered})]})}),e.jsx(Ce,{children:e.jsxs(De,{className:"pb-2",children:[e.jsx(fs,{children:"已封禁"}),e.jsx(Ue,{className:"text-2xl text-red-600",children:r.banned})]})}),e.jsx(Ce,{children:e.jsxs(De,{className:"pb-2",children:[e.jsx(fs,{children:"未注册"}),e.jsx(Ue,{className:"text-2xl text-gray-600",children:r.unregistered})]})})]}),e.jsxs(Ce,{children:[e.jsx(De,{children:e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx(Bo,{className:"h-5 w-5"}),"筛选和排序"]})}),e.jsxs(Ae,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"排序方式"}),e.jsxs(Pe,{value:`${P}-${C}`,onValueChange:de=>{const[ze,ws]=de.split("-");E(ze),R(ws),f(1)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"usage_count-desc",children:"使用次数 (多→少)"}),e.jsx(ee,{value:"usage_count-asc",children:"使用次数 (少→多)"}),e.jsx(ee,{value:"register_time-desc",children:"注册时间 (新→旧)"}),e.jsx(ee,{value:"register_time-asc",children:"注册时间 (旧→新)"}),e.jsx(ee,{value:"record_time-desc",children:"记录时间 (新→旧)"}),e.jsx(ee,{value:"record_time-asc",children:"记录时间 (旧→新)"}),e.jsx(ee,{value:"last_used_time-desc",children:"最后使用 (新→旧)"}),e.jsx(ee,{value:"last_used_time-asc",children:"最后使用 (旧→新)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"注册状态"}),e.jsxs(Pe,{value:y,onValueChange:de=>{b(de),f(1)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"all",children:"全部"}),e.jsx(ee,{value:"registered",children:"已注册"}),e.jsx(ee,{value:"unregistered",children:"未注册"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"封禁状态"}),e.jsxs(Pe,{value:w,onValueChange:de=>{A(de),f(1)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"all",children:"全部"}),e.jsx(ee,{value:"banned",children:"已封禁"}),e.jsx(ee,{value:"unbanned",children:"未封禁"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"格式"}),e.jsxs(Pe,{value:M,onValueChange:de=>{S(de),f(1)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"all",children:"全部"}),Ee.map(de=>e.jsxs(ee,{value:de,children:[de.toUpperCase()," (",r?.formats[de],")"]},de))]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[ge.size>0&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",ge.size," 个表情包"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{className:"text-sm whitespace-nowrap",children:"卡片大小"}),e.jsxs(Pe,{value:Q,onValueChange:de=>_e(de),children:[e.jsx(Be,{className:"w-24",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"small",children:"小"}),e.jsx(ee,{value:"medium",children:"中"}),e.jsx(ee,{value:"large",children:"大"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Pe,{value:N.toString(),onValueChange:de=>{j(parseInt(de)),f(1),pe(new Set)},children:[e.jsx(Be,{id:"emoji-page-size",className:"w-20",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"20",children:"20"}),e.jsx(ee,{value:"40",children:"40"}),e.jsx(ee,{value:"60",children:"60"}),e.jsx(ee,{value:"100",children:"100"})]})]}),ge.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>pe(new Set),children:"取消选择"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>K(!0),children:[e.jsx(us,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),e.jsx("div",{className:"flex justify-end pt-4 border-t",children:e.jsxs(_,{variant:"outline",size:"sm",onClick:$,disabled:d,children:[e.jsx(ut,{className:`h-4 w-4 mr-2 ${d?"animate-spin":""}`}),"刷新"]})})]})]}),e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Ue,{children:"表情包列表"}),e.jsxs(fs,{children:["共 ",p," 个表情包,当前第 ",h," 页"]})]}),e.jsxs(Ae,{children:[a.length===0?e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"暂无数据"}):e.jsx("div",{className:`grid gap-3 ${Q==="small"?"grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10":Q==="medium"?"grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8":"grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5"}`,children:a.map(de=>e.jsxs("div",{className:`group relative rounded-lg border bg-card overflow-hidden hover:ring-2 hover:ring-primary transition-all cursor-pointer ${ge.has(de.id)?"ring-2 ring-primary bg-primary/5":""}`,onClick:()=>Z(de.id),children:[e.jsx("div",{className:`absolute top-1 left-1 z-10 transition-opacity ${ge.has(de.id)?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:e.jsx("div",{className:`w-5 h-5 rounded-full border-2 flex items-center justify-center ${ge.has(de.id)?"bg-primary border-primary text-primary-foreground":"bg-background/80 border-muted-foreground/50"}`,children:ge.has(de.id)&&e.jsx(tt,{className:"h-3 w-3"})})}),e.jsxs("div",{className:"absolute top-1 right-1 z-10 flex flex-col gap-0.5",children:[de.is_registered&&e.jsx(ke,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"已注册"}),de.is_banned&&e.jsx(ke,{variant:"destructive",className:"text-[10px] px-1 py-0",children:"已封禁"})]}),e.jsx("div",{className:`aspect-square bg-muted flex items-center justify-center overflow-hidden ${Q==="small"?"p-1":Q==="medium"?"p-2":"p-3"}`,children:e.jsx(B4,{src:Q4(de.id),alt:"表情包"})}),e.jsxs("div",{className:`border-t bg-card ${Q==="small"?"p-1":"p-2"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-1 text-xs text-muted-foreground mb-1",children:[e.jsx(ke,{variant:"outline",className:"text-[10px] px-1 py-0",children:de.format.toUpperCase()}),e.jsxs("span",{className:"font-mono",children:[de.usage_count,"次"]})]}),e.jsxs("div",{className:`flex gap-1 justify-center opacity-0 group-hover:opacity-100 transition-opacity ${Q==="small"?"flex-wrap":""}`,children:[e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:ze=>{ze.stopPropagation(),Re(de)},title:"编辑",children:e.jsx(Wn,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:ze=>{ze.stopPropagation(),G(de)},title:"详情",children:e.jsx(Qt,{className:"h-3 w-3"})}),!de.is_registered&&e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6 text-green-600 hover:text-green-700",onClick:ze=>{ze.stopPropagation(),ns(de)},title:"注册",children:e.jsx(tt,{className:"h-3 w-3"})}),!de.is_banned&&e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6 text-orange-600 hover:text-orange-700",onClick:ze=>{ze.stopPropagation(),J(de)},title:"封禁",children:e.jsx(tv,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:ze=>{ze.stopPropagation(),se(de)},title:"删除",children:e.jsx(us,{className:"h-3 w-3"})})]})]})]},de.id))}),p>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(h-1)*N+1," 到"," ",Math.min(h*N,p)," 条,共 ",p," 条"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(yn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(de=>Math.max(1,de-1)),disabled:h===1,children:[e.jsx(Ia,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{type:"number",value:B,onChange:de=>ue(de.target.value),onKeyDown:de=>de.key==="Enter"&&ae(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(p/N)}),e.jsx(_,{variant:"outline",size:"sm",onClick:ae,disabled:!B,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(de=>de+1),disabled:h>=Math.ceil(p/N),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(p/N)),disabled:h>=Math.ceil(p/N),className:"hidden sm:flex",children:e.jsx(wn,{className:"h-4 w-4"})})]})]})]})]}),e.jsx(W4,{emoji:H,open:X,onOpenChange:L}),e.jsx(ek,{emoji:H,open:me,onOpenChange:Ne,onSuccess:()=>{$(),z()}}),e.jsx(sk,{open:he,onOpenChange:Te,onSuccess:()=>{$(),z()}})]})}),e.jsx(Cs,{open:D,onOpenChange:K,children:e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认批量删除"}),e.jsxs(Ns,{children:["你确定要删除选中的 ",ge.size," 个表情包吗?此操作不可撤销。"]})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:Le,children:"确认删除"})]})]})}),e.jsx(Js,{open:je,onOpenChange:ce,children:e.jsxs(qs,{children:[e.jsxs(Vs,{children:[e.jsx(Gs,{children:"确认删除"}),e.jsx(nt,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),e.jsxs(xt,{children:[e.jsx(_,{variant:"outline",onClick:()=>ce(!1),children:"取消"}),e.jsx(_,{variant:"destructive",onClick:Oe,children:"删除"})]})]})})]})}function W4({emoji:a,open:l,onOpenChange:r}){if(!a)return null;const c=d=>d?new Date(d*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Js,{open:l,onOpenChange:r,children:e.jsxs(qs,{className:"max-w-2xl max-h-[90vh]",children:[e.jsx(Vs,{children:e.jsx(Gs,{children:"表情包详情"})}),e.jsx(ss,{className:"max-h-[calc(90vh-8rem)] pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:Y4(a.id),alt:a.description||"表情包",className:"w-full h-full object-cover",onError:d=>{const m=d.target;m.style.display="none";const h=m.parentElement;h&&(h.innerHTML='')}})})}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"ID"}),e.jsx("div",{className:"mt-1 font-mono",children:a.id})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"格式"}),e.jsx("div",{className:"mt-1",children:e.jsx(ke,{variant:"outline",children:a.format.toUpperCase()})})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"文件路径"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:a.full_path})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"哈希值"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:a.emoji_hash})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"描述"}),a.description?e.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:e.jsx(I4,{className:"prose-sm",children:a.description})}):e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"情绪"}),e.jsx("div",{className:"mt-1",children:a.emotion?e.jsx("span",{className:"text-sm",children:a.emotion}):e.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"状态"}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[a.is_registered&&e.jsx(ke,{variant:"default",className:"bg-green-600",children:"已注册"}),a.is_banned&&e.jsx(ke,{variant:"destructive",children:"已封禁"}),!a.is_registered&&!a.is_banned&&e.jsx(ke,{variant:"outline",children:"未注册"})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"使用次数"}),e.jsx("div",{className:"mt-1 font-mono text-lg",children:a.usage_count})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"记录时间"}),e.jsx("div",{className:"mt-1 text-sm",children:c(a.record_time)})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"注册时间"}),e.jsx("div",{className:"mt-1 text-sm",children:c(a.register_time)})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"最后使用"}),e.jsx("div",{className:"mt-1 text-sm",children:c(a.last_used_time)})]})]})})]})})}function ek({emoji:a,open:l,onOpenChange:r,onSuccess:c}){const[d,m]=u.useState(""),[h,f]=u.useState(!1),[p,g]=u.useState(!1),[N,j]=u.useState(!1),{toast:y}=it();u.useEffect(()=>{a&&(m(a.emotion||""),f(a.is_registered),g(a.is_banned))},[a]);const b=async()=>{if(a)try{j(!0);const w=d.split(/[,,]/).map(A=>A.trim()).filter(Boolean).join(",");await H4(a.id,{emotion:w||void 0,is_registered:h,is_banned:p}),y({title:"成功",description:"表情包信息已更新"}),r(!1),c()}catch(w){const A=w instanceof Error?w.message:"保存失败";y({title:"错误",description:A,variant:"destructive"})}finally{j(!1)}};return a?e.jsx(Js,{open:l,onOpenChange:r,children:e.jsxs(qs,{className:"max-w-2xl",children:[e.jsxs(Vs,{children:[e.jsx(Gs,{children:"编辑表情包"}),e.jsx(nt,{children:"修改表情包的情绪和状态信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(T,{children:"情绪"}),e.jsx(ft,{value:d,onChange:w=>m(w.target.value),placeholder:"输入情绪描述...",rows:2,className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入情绪相关的文本描述"})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(lt,{id:"is_registered",checked:h,onCheckedChange:w=>{w===!0?(f(!0),g(!1)):f(!1)}}),e.jsx(T,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(lt,{id:"is_banned",checked:p,onCheckedChange:w=>{w===!0?(g(!0),f(!1)):g(!1)}}),e.jsx(T,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),e.jsxs(xt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(_,{onClick:b,disabled:N,children:N?"保存中...":"保存"})]})]})}):null}function sk({open:a,onOpenChange:l,onSuccess:r}){const[c,d]=u.useState("select"),[m,h]=u.useState([]),[f,p]=u.useState(null),[g,N]=u.useState(!1),{toast:j}=it(),y=u.useMemo(()=>new h_({id:"emoji-uploader",autoProceed:!1,restrictions:{maxFileSize:10485760,allowedFileTypes:["image/jpeg","image/png","image/gif","image/webp"],maxNumberOfFiles:20},locale:{pluralize:()=>0,strings:{addMoreFiles:"添加更多文件",addingMoreFiles:"正在添加更多文件",allowedFileTypes:"允许的文件类型:%{types}",cancel:"取消",closeModal:"关闭",complete:"完成",connectedToInternet:"已连接到互联网",copyLink:"复制链接",copyLinkToClipboardFallback:"复制下方链接",copyLinkToClipboardSuccess:"链接已复制到剪贴板",dashboardTitle:"选择文件",dashboardWindowTitle:"文件选择窗口(按 ESC 关闭)",done:"完成",dropHereOr:"拖放文件到这里或 %{browse}",dropHint:"将文件拖放到此处",dropPasteFiles:"将文件拖放到这里或 %{browseFiles}",dropPasteFolders:"将文件拖放到这里或 %{browseFolders}",dropPasteBoth:"将文件拖放到这里,%{browseFiles} 或 %{browseFolders}",dropPasteImportFiles:"将文件拖放到这里,%{browseFiles} 或从以下位置导入:",dropPasteImportFolders:"将文件拖放到这里,%{browseFolders} 或从以下位置导入:",dropPasteImportBoth:"将文件拖放到这里,%{browseFiles},%{browseFolders} 或从以下位置导入:",editFile:"编辑文件",editing:"正在编辑 %{file}",emptyFolderAdded:"未从空文件夹添加文件",exceedsSize:"%{file} 超过了最大允许大小 %{size}",failedToUpload:"上传 %{file} 失败",fileSource:"文件来源:%{name}",filesUploadedOfTotal:{0:"已上传 %{complete} / %{smart_count} 个文件",1:"已上传 %{complete} / %{smart_count} 个文件"},filter:"筛选",finishEditingFile:"完成编辑文件",folderAdded:{0:"已从 %{folder} 添加 %{smart_count} 个文件",1:"已从 %{folder} 添加 %{smart_count} 个文件"},generatingThumbnails:"正在生成缩略图...",import:"导入",importFiles:"从以下位置导入文件:",importFrom:"从 %{name} 导入",loading:"加载中...",logOut:"登出",myDevice:"我的设备",noFilesFound:"这里没有文件或文件夹",noInternetConnection:"无网络连接",openFolderNamed:"打开文件夹 %{name}",pause:"暂停",pauseUpload:"暂停上传",paused:"已暂停",poweredBy:"技术支持:%{uppy}",processingXFiles:{0:"正在处理 %{smart_count} 个文件",1:"正在处理 %{smart_count} 个文件"},recording:"录制中",removeFile:"移除文件",resetFilter:"重置筛选",resume:"继续",resumeUpload:"继续上传",retry:"重试",retryUpload:"重试上传",save:"保存",saveChanges:"保存更改",selectFileNamed:"选择文件 %{name}",selectX:{0:"选择 %{smart_count}",1:"选择 %{smart_count}"},smile:"笑一个!",startRecording:"开始录制视频",stopRecording:"停止录制视频",takePicture:"拍照",timedOut:"上传已停滞 %{seconds} 秒,正在中止。",upload:"下一步",uploadComplete:"上传完成",uploadFailed:"上传失败",uploadPaused:"上传已暂停",uploadXFiles:{0:"下一步(%{smart_count} 个文件)",1:"下一步(%{smart_count} 个文件)"},uploadXNewFiles:{0:"下一步(+%{smart_count} 个文件)",1:"下一步(+%{smart_count} 个文件)"},uploading:"正在上传",uploadingXFiles:{0:"正在上传 %{smart_count} 个文件",1:"正在上传 %{smart_count} 个文件"},xFilesSelected:{0:"已选择 %{smart_count} 个文件",1:"已选择 %{smart_count} 个文件"},xMoreFilesAdded:{0:"又添加了 %{smart_count} 个文件",1:"又添加了 %{smart_count} 个文件"},xTimeLeft:"剩余 %{time}",youCanOnlyUploadFileTypes:"您只能上传:%{types}",youCanOnlyUploadX:{0:"您只能上传 %{smart_count} 个文件",1:"您只能上传 %{smart_count} 个文件"},youHaveToAtLeastSelectX:{0:"您至少需要选择 %{smart_count} 个文件",1:"您至少需要选择 %{smart_count} 个文件"},browseFiles:"浏览文件",browseFolders:"浏览文件夹",cancelUpload:"取消上传",addMore:"添加更多",back:"返回",editFileWithFilename:"编辑文件 %{file}"}}}),[]);u.useEffect(()=>{const H=()=>{const O=y.getFiles();if(O.length===0)return;const X=O.map(L=>({id:L.id,name:L.name,previewUrl:L.preview||URL.createObjectURL(L.data),emotion:"",description:"",isRegistered:!0,file:L.data}));h(X),O.length===1?(p(X[0].id),d("edit-single")):d("edit-multiple")};return y.on("upload",H),()=>{y.off("upload",H)}},[y]),u.useEffect(()=>{a||(y.cancelAll(),d("select"),h([]),p(null),N(!1))},[a,y]);const b=u.useCallback((H,O)=>{h(X=>X.map(L=>L.id===H?{...L,...O}:L))},[]),w=u.useCallback(H=>H.emotion.trim().length>0,[]),A=u.useMemo(()=>m.length>0&&m.every(w),[m,w]),M=u.useMemo(()=>m.find(H=>H.id===f)||null,[m,f]),S=u.useCallback(()=>{(c==="edit-single"||c==="edit-multiple")&&(d("select"),h([]),p(null))},[c]),P=u.useCallback(async()=>{if(!A){j({title:"请填写必填项",description:"每个表情包的情感标签都是必填的",variant:"destructive"});return}N(!0);let H=0,O=0;try{for(const X of m){const L=new FormData;L.append("file",X.file),L.append("emotion",X.emotion),L.append("description",X.description),L.append("is_registered",X.isRegistered.toString());try{(await Se(X4(),{method:"POST",body:L})).ok?H++:O++}catch{O++}}O===0?(j({title:"上传成功",description:`成功上传 ${H} 个表情包`}),l(!1),r()):(j({title:"部分上传失败",description:`成功 ${H} 个,失败 ${O} 个`,variant:"destructive"}),r())}finally{N(!1)}},[A,m,j,l,r]),E=()=>e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"border rounded-lg overflow-hidden w-full",children:e.jsx($4,{uppy:y,proudlyDisplayPoweredByUppy:!1,hideProgressDetails:!0,height:350,width:"100%",theme:"auto",note:"支持 JPG、PNG、GIF、WebP 格式,最多 20 个文件"})})}),C=()=>{const H=m[0];return H?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(_,{variant:"ghost",size:"sm",onClick:S,children:[e.jsx(Ua,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"编辑表情包信息"})]}),e.jsxs("div",{className:"flex gap-6",children:[e.jsxs("div",{className:"flex-shrink-0",children:[e.jsx("div",{className:"w-32 h-32 rounded-lg border overflow-hidden bg-muted flex items-center justify-center",children:e.jsx("img",{src:H.previewUrl,alt:H.name,className:"max-w-full max-h-full object-contain"})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center truncate max-w-32",children:H.name})]}),e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"single-emotion",children:["情感标签 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ne,{id:"single-emotion",value:H.emotion,onChange:O=>b(H.id,{emotion:O.target.value}),placeholder:"多个标签用逗号分隔,如:开心,高兴",className:H.emotion.trim()?"":"border-destructive"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"用于情感匹配,多个标签用逗号分隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"single-description",children:"描述"}),e.jsx(ne,{id:"single-description",value:H.description,onChange:O=>b(H.id,{description:O.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(lt,{id:"single-is-registered",checked:H.isRegistered,onCheckedChange:O=>b(H.id,{isRegistered:O===!0})}),e.jsx(T,{htmlFor:"single-is-registered",className:"cursor-pointer",children:"上传后立即注册(可被麦麦使用)"})]})]})]}),e.jsx(xt,{children:e.jsx(_,{onClick:P,disabled:!A||g,children:g?"上传中...":"上传"})})]}):null},R=()=>{const H=m.filter(w).length,O=m.length;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(_,{variant:"ghost",size:"sm",onClick:S,children:[e.jsx(Ua,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["编辑表情包信息(",H,"/",O," 已完成)"]})]}),e.jsx(ke,{variant:A?"default":"secondary",children:A?e.jsxs(e.Fragment,{children:[e.jsx(Lt,{className:"h-3 w-3 mr-1"}),"全部完成"]}):e.jsxs(e.Fragment,{children:[e.jsx(_a,{className:"h-3 w-3 mr-1"}),"未完成"]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(ss,{className:"h-[350px] pr-2",children:e.jsx("div",{className:"space-y-2",children:m.map(X=>{const L=w(X),me=f===X.id;return e.jsxs("div",{onClick:()=>p(X.id),className:` + flex items-center gap-3 p-3 rounded-lg border-2 cursor-pointer transition-all + ${me?"ring-2 ring-primary":""} + ${L?"border-green-500 bg-green-50 dark:bg-green-950/20":"border-border hover:border-muted-foreground/50"} + `,children:[e.jsx("div",{className:"w-12 h-12 rounded border overflow-hidden bg-muted flex-shrink-0 flex items-center justify-center",children:e.jsx("img",{src:X.previewUrl,alt:X.name,className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:X.name}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:X.emotion||"未填写情感标签"})]}),L?e.jsx(tt,{className:"h-5 w-5 text-green-500 flex-shrink-0"}):e.jsx("div",{className:"h-5 w-5 rounded-full border-2 border-muted-foreground/30 flex-shrink-0"})]},X.id)})})}),e.jsx("div",{className:"border rounded-lg p-4",children:M?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-16 h-16 rounded border overflow-hidden bg-muted flex items-center justify-center",children:e.jsx("img",{src:M.previewUrl,alt:M.name,className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:M.name}),w(M)&&e.jsxs(ke,{variant:"outline",className:"text-green-600 border-green-600",children:[e.jsx(Lt,{className:"h-3 w-3 mr-1"}),"已完成"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"multi-emotion",children:["情感标签 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ne,{id:"multi-emotion",value:M.emotion,onChange:X=>b(M.id,{emotion:X.target.value}),placeholder:"多个标签用逗号分隔,如:开心,高兴",className:M.emotion.trim()?"":"border-destructive"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"multi-description",children:"描述"}),e.jsx(ne,{id:"multi-description",value:M.description,onChange:X=>b(M.id,{description:X.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(lt,{id:"multi-is-registered",checked:M.isRegistered,onCheckedChange:X=>b(M.id,{isRegistered:X===!0})}),e.jsx(T,{htmlFor:"multi-is-registered",className:"cursor-pointer text-sm",children:"上传后立即注册"})]})]}):e.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:e.jsxs("div",{className:"text-center",children:[e.jsx(ox,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"点击左侧卡片编辑"})]})})})]}),e.jsx(xt,{children:e.jsx(_,{onClick:P,disabled:!A||g,children:g?"上传中...":`上传全部 (${O})`})})]})};return e.jsx(Js,{open:a,onOpenChange:l,children:e.jsxs(qs,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[e.jsxs(Vs,{children:[e.jsxs(Gs,{className:"flex items-center gap-2",children:[e.jsx(rc,{className:"h-5 w-5"}),c==="select"&&"上传表情包 - 选择文件",c==="edit-single"&&"上传表情包 - 填写信息",c==="edit-multiple"&&"上传表情包 - 批量编辑"]}),e.jsxs(nt,{children:[c==="select"&&"支持 JPG、PNG、GIF、WebP 格式,单个文件最大 10MB,可同时上传多个文件",c==="edit-single"&&"请填写表情包的情感标签(必填)和描述",c==="edit-multiple"&&"点击左侧卡片编辑每个表情包的信息,情感标签为必填项"]})]}),e.jsxs("div",{className:"overflow-y-auto pr-1",children:[c==="select"&&E(),c==="edit-single"&&C(),c==="edit-multiple"&&R()]})]})})}function tk(){const[a,l]=u.useState([]),[r,c]=u.useState(!0),[d,m]=u.useState(0),[h,f]=u.useState(1),[p,g]=u.useState(20),[N,j]=u.useState(""),[y,b]=u.useState(null),[w,A]=u.useState(!1),[M,S]=u.useState(!1),[P,E]=u.useState(!1),[C,R]=u.useState(null),[H,O]=u.useState(new Set),[X,L]=u.useState(!1),[me,Ne]=u.useState(""),[je,ce]=u.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[ge,pe]=u.useState([]),[D,K]=u.useState(new Map),[B,ue]=u.useState(!1),[Q,_e]=u.useState(0),{toast:he}=it(),Te=async()=>{try{c(!0);const ae=await X_({page:h,page_size:p,search:N||void 0});l(ae.data),m(ae.total)}catch(ae){he({title:"加载失败",description:ae instanceof Error?ae.message:"无法加载表达方式",variant:"destructive"})}finally{c(!1)}},V=async()=>{try{const ae=await a2();ae?.data&&ce(ae.data)}catch(ae){console.error("加载统计数据失败:",ae)}},$=async()=>{try{const ae=await hx();_e(ae.unchecked)}catch(ae){console.error("加载审核统计失败:",ae)}},z=async()=>{try{const ae=await xx();if(ae?.data){pe(ae.data);const Ee=new Map;ae.data.forEach(de=>{Ee.set(de.chat_id,de.chat_name)}),K(Ee)}}catch(ae){console.error("加载聊天列表失败:",ae)}},G=ae=>D.get(ae)||ae;u.useEffect(()=>{Te(),$(),V(),z()},[h,p,N]);const Re=async ae=>{try{const Ee=await Z_(ae.id);b(Ee.data),A(!0)}catch(Ee){he({title:"加载详情失败",description:Ee instanceof Error?Ee.message:"无法加载表达方式详情",variant:"destructive"})}},se=ae=>{b(ae),S(!0)},Oe=async ae=>{try{await s2(ae.id),he({title:"删除成功",description:`已删除表达方式: ${ae.situation}`}),R(null),Te(),V()}catch(Ee){he({title:"删除失败",description:Ee instanceof Error?Ee.message:"无法删除表达方式",variant:"destructive"})}},ns=ae=>{const Ee=new Set(H);Ee.has(ae)?Ee.delete(ae):Ee.add(ae),O(Ee)},J=()=>{H.size===a.length&&a.length>0?O(new Set):O(new Set(a.map(ae=>ae.id)))},Z=async()=>{try{await t2(Array.from(H)),he({title:"批量删除成功",description:`已删除 ${H.size} 个表达方式`}),O(new Set),L(!1),Te(),V()}catch(ae){he({title:"批量删除失败",description:ae instanceof Error?ae.message:"无法批量删除表达方式",variant:"destructive"})}},Le=()=>{const ae=parseInt(me),Ee=Math.ceil(d/p);ae>=1&&ae<=Ee?(f(ae),Ne("")):he({title:"无效的页码",description:`请输入1-${Ee}之间的页码`,variant:"destructive"})};return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(Ba,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(_,{variant:"outline",onClick:()=>ue(!0),className:"gap-2",children:[e.jsx(av,{className:"h-4 w-4"}),"人工审核",Q>0&&e.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-xs rounded-full bg-orange-500 text-white",children:Q>99?"99+":Q})]}),e.jsxs(_,{onClick:()=>E(!0),className:"gap-2",children:[e.jsx(at,{className:"h-4 w-4"}),"新增表达方式"]})]})]})}),e.jsx(ss,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:je.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:je.recent_7days})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:je.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx(T,{htmlFor:"search",children:"搜索"}),e.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(Ut,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{id:"search",placeholder:"搜索情境、风格或上下文...",value:N,onChange:ae=>j(ae.target.value),className:"pl-9"})]})}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:H.size>0&&e.jsxs("span",{children:["已选择 ",H.size," 个表达方式"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Pe,{value:p.toString(),onValueChange:ae=>{g(parseInt(ae)),f(1),O(new Set)},children:[e.jsx(Be,{id:"page-size",className:"w-20",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"10",children:"10"}),e.jsx(ee,{value:"20",children:"20"}),e.jsx(ee,{value:"50",children:"50"}),e.jsx(ee,{value:"100",children:"100"})]})]}),H.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>O(new Set),children:"取消选择"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>L(!0),children:[e.jsx(us,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(Il,{children:[e.jsx(Pl,{children:e.jsxs(bt,{children:[e.jsx(ls,{className:"w-12",children:e.jsx(lt,{checked:H.size===a.length&&a.length>0,onCheckedChange:J})}),e.jsx(ls,{children:"情境"}),e.jsx(ls,{children:"风格"}),e.jsx(ls,{children:"聊天"}),e.jsx(ls,{className:"text-right",children:"操作"})]})}),e.jsx(Fl,{children:r?e.jsx(bt,{children:e.jsx(Je,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):a.length===0?e.jsx(bt,{children:e.jsx(Je,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):a.map(ae=>e.jsxs(bt,{children:[e.jsx(Je,{children:e.jsx(lt,{checked:H.has(ae.id),onCheckedChange:()=>ns(ae.id)})}),e.jsx(Je,{className:"font-medium max-w-xs truncate",children:ae.situation}),e.jsx(Je,{className:"max-w-xs truncate",children:ae.style}),e.jsx(Je,{className:"max-w-[200px] truncate",title:G(ae.chat_id),style:{wordBreak:"keep-all"},children:e.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:G(ae.chat_id)})}),e.jsx(Je,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>se(ae),children:[e.jsx(Wn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>Re(ae),title:"查看详情",children:e.jsx(ma,{className:"h-4 w-4"})}),e.jsxs(_,{size:"sm",onClick:()=>R(ae),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(us,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},ae.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:r?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):a.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):a.map(ae=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(lt,{checked:H.has(ae.id),onCheckedChange:()=>ns(ae.id),className:"mt-1"}),e.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:ae.situation,children:ae.situation})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),e.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:ae.style,children:ae.style})]})]})]}),e.jsxs("div",{className:"text-sm",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),e.jsx("p",{className:"text-sm truncate",title:G(ae.chat_id),style:{wordBreak:"keep-all"},children:G(ae.chat_id)})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>se(ae),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(Wn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Re(ae),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:e.jsx(ma,{className:"h-3 w-3"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>R(ae),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(us,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},ae.id))}),d>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",d," 条记录,第 ",h," / ",Math.ceil(d/p)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(yn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Ia,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{type:"number",value:me,onChange:ae=>Ne(ae.target.value),onKeyDown:ae=>ae.key==="Enter"&&Le(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(d/p)}),e.jsx(_,{variant:"outline",size:"sm",onClick:Le,disabled:!me,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(d/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(d/p)),disabled:h>=Math.ceil(d/p),className:"hidden sm:flex",children:e.jsx(wn,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(ak,{expression:y,open:w,onOpenChange:A,chatNameMap:D}),e.jsx(lk,{open:P,onOpenChange:E,chatList:ge,onSuccess:()=>{Te(),V(),E(!1)}}),e.jsx(nk,{expression:y,open:M,onOpenChange:S,chatList:ge,onSuccess:()=>{Te(),V(),S(!1)}}),e.jsx(Cs,{open:!!C,onOpenChange:()=>R(null),children:e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认删除"}),e.jsxs(Ns,{children:['确定要删除表达方式 "',C?.situation,'" 吗? 此操作不可撤销。']})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:()=>C&&Oe(C),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(rk,{open:X,onOpenChange:L,onConfirm:Z,count:H.size}),e.jsx($v,{open:B,onOpenChange:ae=>{ue(ae),ae||(Te(),V(),$())}})]})}function ak({expression:a,open:l,onOpenChange:r,chatNameMap:c}){if(!a)return null;const d=h=>h?new Date(h*1e3).toLocaleString("zh-CN"):"-",m=h=>c.get(h)||h;return e.jsx(Js,{open:l,onOpenChange:r,children:e.jsxs(qs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Vs,{children:[e.jsx(Gs,{children:"表达方式详情"}),e.jsx(nt,{children:"查看表达方式的完整信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Ki,{label:"情境",value:a.situation}),e.jsx(Ki,{label:"风格",value:a.style}),e.jsx(Ki,{label:"聊天",value:m(a.chat_id)}),e.jsx(Ki,{icon:Xr,label:"记录ID",value:a.id.toString(),mono:!0})]}),e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsx(Ki,{icon:ia,label:"创建时间",value:d(a.create_date)})}),e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-4",children:[e.jsx(T,{className:"text-xs text-muted-foreground mb-3 block",children:"状态标记"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:F("flex h-8 w-8 items-center justify-center rounded-full",a.checked?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-400 dark:bg-gray-800 dark:text-gray-600"),children:a.checked?e.jsx(tt,{className:"h-5 w-5"}):e.jsx(Ho,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"已检查"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a.checked?"已通过审核":"未审核"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:F("flex h-8 w-8 items-center justify-center rounded-full",a.rejected?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":"bg-gray-100 text-gray-400 dark:bg-gray-800 dark:text-gray-600"),children:a.rejected?e.jsx(ta,{className:"h-5 w-5"}):e.jsx(Ho,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"已拒绝"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a.rejected?"不会被使用":"正常"})]})]})]})]})]}),e.jsx(xt,{children:e.jsx(_,{onClick:()=>r(!1),children:"关闭"})})]})})}function Ki({icon:a,label:l,value:r,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a&&e.jsx(a,{className:"h-3 w-3"}),l]}),e.jsx("div",{className:F("text-sm",c&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function lk({open:a,onOpenChange:l,chatList:r,onSuccess:c}){const[d,m]=u.useState({situation:"",style:"",chat_id:""}),[h,f]=u.useState(!1),{toast:p}=it(),g=async()=>{if(!d.situation||!d.style||!d.chat_id){p({title:"验证失败",description:"请填写必填字段:情境、风格和聊天",variant:"destructive"});return}try{f(!0),await W_(d),p({title:"创建成功",description:"表达方式已创建"}),m({situation:"",style:"",chat_id:""}),c()}catch(N){p({title:"创建失败",description:N instanceof Error?N.message:"无法创建表达方式",variant:"destructive"})}finally{f(!1)}};return e.jsx(Js,{open:a,onOpenChange:l,children:e.jsxs(qs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Vs,{children:[e.jsx(Gs,{children:"新增表达方式"}),e.jsx(nt,{children:"创建新的表达方式记录"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"situation",children:["情境 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ne,{id:"situation",value:d.situation,onChange:N=>m({...d,situation:N.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"style",children:["风格 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ne,{id:"style",value:d.style,onChange:N=>m({...d,style:N.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"chat_id",children:["聊天 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Pe,{value:d.chat_id,onValueChange:N=>m({...d,chat_id:N}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择关联的聊天"})}),e.jsx(Ie,{children:r.map(N=>e.jsx(ee,{value:N.chat_id,children:e.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[N.chat_name,N.is_group&&e.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},N.chat_id))})]})]})]}),e.jsxs(xt,{children:[e.jsx(_,{variant:"outline",onClick:()=>l(!1),children:"取消"}),e.jsx(_,{onClick:g,disabled:h,children:h?"创建中...":"创建"})]})]})})}function nk({expression:a,open:l,onOpenChange:r,chatList:c,onSuccess:d}){const[m,h]=u.useState({}),[f,p]=u.useState(!1),{toast:g}=it();u.useEffect(()=>{a&&h({situation:a.situation,style:a.style,chat_id:a.chat_id,checked:a.checked,rejected:a.rejected})},[a]);const N=async()=>{if(a)try{p(!0),await e2(a.id,m),g({title:"保存成功",description:"表达方式已更新"}),d()}catch(j){g({title:"保存失败",description:j instanceof Error?j.message:"无法更新表达方式",variant:"destructive"})}finally{p(!1)}};return a?e.jsx(Js,{open:l,onOpenChange:r,children:e.jsxs(qs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Vs,{children:[e.jsx(Gs,{children:"编辑表达方式"}),e.jsx(nt,{children:"修改表达方式的信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_situation",children:"情境"}),e.jsx(ne,{id:"edit_situation",value:m.situation||"",onChange:j=>h({...m,situation:j.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_style",children:"风格"}),e.jsx(ne,{id:"edit_style",value:m.style||"",onChange:j=>h({...m,style:j.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Pe,{value:m.chat_id||"",onValueChange:j=>h({...m,chat_id:j}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择关联的聊天"})}),e.jsx(Ie,{children:c.map(j=>e.jsx(ee,{value:j.chat_id,children:e.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[j.chat_name,j.is_group&&e.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},j.chat_id))})]})]}),e.jsxs(pt,{children:[e.jsx(Qt,{className:"h-4 w-4"}),e.jsx(gt,{className:"text-xs",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{children:e.jsx("strong",{children:"状态标记说明:"})}),e.jsx("p",{children:"• 已检查:表示该表达方式已通过审核(可由AI自动检查或人工审核)"}),e.jsx("p",{children:"• 已拒绝:表示该表达方式被标记为不合适,将永远不会被使用"}),e.jsxs("p",{className:"text-muted-foreground mt-2",children:['根据配置中"仅使用已审核通过的表达方式"设置:',e.jsx("br",{}),"• 开启时:只有通过审核(已检查)的项目会被使用",e.jsx("br",{}),"• 关闭时:未审核的项目也会被使用"]})]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between space-x-2 rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"edit_checked",className:"text-sm font-medium",children:"已检查"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"已通过审核"})]}),e.jsx(Ge,{id:"edit_checked",checked:m.checked??!1,onCheckedChange:j=>h({...m,checked:j})})]}),e.jsxs("div",{className:"flex items-center justify-between space-x-2 rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"edit_rejected",className:"text-sm font-medium",children:"已拒绝"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"不会被使用"})]}),e.jsx(Ge,{id:"edit_rejected",checked:m.rejected??!1,onCheckedChange:j=>h({...m,rejected:j})})]})]})]}),e.jsxs(xt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(_,{onClick:N,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}function rk({open:a,onOpenChange:l,onConfirm:r,count:c}){return e.jsx(Cs,{open:a,onOpenChange:l,children:e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认批量删除"}),e.jsxs(Ns,{children:["您即将删除 ",c," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:r,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const Hl="/api/webui/jargon";async function ik(){const a=await Se(`${Hl}/chats`,{});if(!a.ok){const l=await a.json();throw new Error(l.detail||"获取聊天列表失败")}return a.json()}async function ck(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.search&&l.append("search",a.search),a.chat_id&&l.append("chat_id",a.chat_id),a.is_jargon!==void 0&&a.is_jargon!==null&&l.append("is_jargon",a.is_jargon.toString()),a.is_global!==void 0&&l.append("is_global",a.is_global.toString());const r=await Se(`${Hl}/list?${l}`,{});if(!r.ok){const c=await r.json();throw new Error(c.detail||"获取黑话列表失败")}return r.json()}async function ok(a){const l=await Se(`${Hl}/${a}`,{});if(!l.ok){const r=await l.json();throw new Error(r.detail||"获取黑话详情失败")}return l.json()}async function dk(a){const l=await Se(`${Hl}/`,{method:"POST",body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"创建黑话失败")}return l.json()}async function uk(a,l){const r=await Se(`${Hl}/${a}`,{method:"PATCH",body:JSON.stringify(l)});if(!r.ok){const c=await r.json();throw new Error(c.detail||"更新黑话失败")}return r.json()}async function mk(a){const l=await Se(`${Hl}/${a}`,{method:"DELETE"});if(!l.ok){const r=await l.json();throw new Error(r.detail||"删除黑话失败")}return l.json()}async function xk(a){const l=await Se(`${Hl}/batch/delete`,{method:"POST",body:JSON.stringify({ids:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"批量删除黑话失败")}return l.json()}async function hk(){const a=await Se(`${Hl}/stats/summary`,{});if(!a.ok){const l=await a.json();throw new Error(l.detail||"获取黑话统计失败")}return a.json()}async function fk(a,l){const r=new URLSearchParams;a.forEach(d=>r.append("ids",d.toString())),r.append("is_jargon",l.toString());const c=await Se(`${Hl}/batch/set-jargon?${r}`,{method:"POST"});if(!c.ok){const d=await c.json();throw new Error(d.detail||"批量设置黑话状态失败")}return c.json()}function pk(){const[a,l]=u.useState([]),[r,c]=u.useState(!0),[d,m]=u.useState(0),[h,f]=u.useState(1),[p,g]=u.useState(20),[N,j]=u.useState(""),[y,b]=u.useState("all"),[w,A]=u.useState("all"),[M,S]=u.useState(null),[P,E]=u.useState(!1),[C,R]=u.useState(!1),[H,O]=u.useState(!1),[X,L]=u.useState(null),[me,Ne]=u.useState(new Set),[je,ce]=u.useState(!1),[ge,pe]=u.useState(""),[D,K]=u.useState({total:0,confirmed_jargon:0,confirmed_not_jargon:0,pending:0,global_count:0,complete_count:0,chat_count:0,top_chats:{}}),[B,ue]=u.useState([]),{toast:Q}=it(),_e=async()=>{try{c(!0);const Z=await ck({page:h,page_size:p,search:N||void 0,chat_id:y==="all"?void 0:y,is_jargon:w==="all"?void 0:w==="true"?!0:w==="false"?!1:void 0});l(Z.data),m(Z.total)}catch(Z){Q({title:"加载失败",description:Z instanceof Error?Z.message:"无法加载黑话列表",variant:"destructive"})}finally{c(!1)}},he=async()=>{try{const Z=await hk();Z?.data&&K(Z.data)}catch(Z){console.error("加载统计数据失败:",Z)}},Te=async()=>{try{const Z=await ik();Z?.data&&ue(Z.data)}catch(Z){console.error("加载聊天列表失败:",Z)}};u.useEffect(()=>{_e(),he(),Te()},[h,p,N,y,w]);const V=async Z=>{try{const Le=await ok(Z.id);S(Le.data),E(!0)}catch(Le){Q({title:"加载详情失败",description:Le instanceof Error?Le.message:"无法加载黑话详情",variant:"destructive"})}},$=Z=>{S(Z),R(!0)},z=async Z=>{try{await mk(Z.id),Q({title:"删除成功",description:`已删除黑话: ${Z.content}`}),L(null),_e(),he()}catch(Le){Q({title:"删除失败",description:Le instanceof Error?Le.message:"无法删除黑话",variant:"destructive"})}},G=Z=>{const Le=new Set(me);Le.has(Z)?Le.delete(Z):Le.add(Z),Ne(Le)},Re=()=>{me.size===a.length&&a.length>0?Ne(new Set):Ne(new Set(a.map(Z=>Z.id)))},se=async()=>{try{await xk(Array.from(me)),Q({title:"批量删除成功",description:`已删除 ${me.size} 个黑话`}),Ne(new Set),ce(!1),_e(),he()}catch(Z){Q({title:"批量删除失败",description:Z instanceof Error?Z.message:"无法批量删除黑话",variant:"destructive"})}},Oe=async Z=>{try{await fk(Array.from(me),Z),Q({title:"操作成功",description:`已将 ${me.size} 个词条设为${Z?"黑话":"非黑话"}`}),Ne(new Set),_e(),he()}catch(Le){Q({title:"操作失败",description:Le instanceof Error?Le.message:"批量设置失败",variant:"destructive"})}},ns=()=>{const Z=parseInt(ge),Le=Math.ceil(d/p);Z>=1&&Z<=Le?(f(Z),pe("")):Q({title:"无效的页码",description:`请输入1-${Le}之间的页码`,variant:"destructive"})},J=Z=>Z===!0?e.jsxs(ke,{variant:"default",className:"bg-green-600 hover:bg-green-700",children:[e.jsx(Lt,{className:"h-3 w-3 mr-1"}),"是黑话"]}):Z===!1?e.jsxs(ke,{variant:"secondary",children:[e.jsx(_a,{className:"h-3 w-3 mr-1"}),"非黑话"]}):e.jsxs(ke,{variant:"outline",children:[e.jsx(nv,{className:"h-3 w-3 mr-1"}),"未判定"]});return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(O1,{className:"h-8 w-8",strokeWidth:2}),"黑话管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦学习到的黑话和俚语"})]}),e.jsxs(_,{onClick:()=>O(!0),className:"gap-2",children:[e.jsx(at,{className:"h-4 w-4"}),"新增黑话"]})]})}),e.jsx(ss,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-7 gap-3",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"总数量"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1",children:D.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"已确认黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-green-600",children:D.confirmed_jargon})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"确认非黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-gray-500",children:D.confirmed_not_jargon})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"待判定"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-yellow-600",children:D.pending})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"全局黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-blue-600",children:D.global_count})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"推断完成"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-purple-600",children:D.complete_count})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"关联聊天数"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1",children:D.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx(Ut,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{id:"search",placeholder:"搜索内容、含义...",value:N,onChange:Z=>j(Z.target.value),className:"pl-9"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{children:"聊天筛选"}),e.jsxs(Pe,{value:y,onValueChange:b,children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"全部聊天"})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"all",children:"全部聊天"}),B.map(Z=>e.jsx(ee,{value:Z.chat_id,children:Z.chat_name},Z.chat_id))]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{children:"状态筛选"}),e.jsxs(Pe,{value:w,onValueChange:A,children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"全部状态"})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"all",children:"全部状态"}),e.jsx(ee,{value:"true",children:"是黑话"}),e.jsx(ee,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{htmlFor:"page-size",children:"每页显示"}),e.jsxs(Pe,{value:p.toString(),onValueChange:Z=>{g(parseInt(Z)),f(1),Ne(new Set)},children:[e.jsx(Be,{id:"page-size",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"10",children:"10"}),e.jsx(ee,{value:"20",children:"20"}),e.jsx(ee,{value:"50",children:"50"}),e.jsx(ee,{value:"100",children:"100"})]})]})]})]}),me.size>0&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-4 pt-4 border-t",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",me.size," 个"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>Oe(!0),children:[e.jsx(Lt,{className:"h-4 w-4 mr-1"}),"标记为黑话"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>Oe(!1),children:[e.jsx(_a,{className:"h-4 w-4 mr-1"}),"标记为非黑话"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Ne(new Set),children:"取消选择"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>ce(!0),children:[e.jsx(us,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(Il,{children:[e.jsx(Pl,{children:e.jsxs(bt,{children:[e.jsx(ls,{className:"w-12",children:e.jsx(lt,{checked:me.size===a.length&&a.length>0,onCheckedChange:Re})}),e.jsx(ls,{children:"内容"}),e.jsx(ls,{children:"含义"}),e.jsx(ls,{children:"聊天"}),e.jsx(ls,{children:"状态"}),e.jsx(ls,{className:"text-center",children:"次数"}),e.jsx(ls,{className:"text-right",children:"操作"})]})}),e.jsx(Fl,{children:r?e.jsx(bt,{children:e.jsx(Je,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):a.length===0?e.jsx(bt,{children:e.jsx(Je,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):a.map(Z=>e.jsxs(bt,{children:[e.jsx(Je,{children:e.jsx(lt,{checked:me.has(Z.id),onCheckedChange:()=>G(Z.id)})}),e.jsx(Je,{className:"font-medium max-w-[200px]",children:e.jsxs("div",{className:"flex items-center gap-2",children:[Z.is_global&&e.jsx("span",{title:"全局黑话",children:e.jsx(qo,{className:"h-4 w-4 text-blue-500 flex-shrink-0"})}),e.jsx("span",{className:"truncate",title:Z.content,children:Z.content})]})}),e.jsx(Je,{className:"max-w-[200px] truncate",title:Z.meaning||"",children:Z.meaning||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Je,{className:"max-w-[150px] truncate",title:Z.chat_name||Z.chat_id,children:Z.chat_name||Z.chat_id}),e.jsx(Je,{children:J(Z.is_jargon)}),e.jsx(Je,{className:"text-center",children:Z.count}),e.jsx(Je,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>$(Z),children:[e.jsx(Wn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>V(Z),title:"查看详情",children:e.jsx(ma,{className:"h-4 w-4"})}),e.jsxs(_,{size:"sm",onClick:()=>L(Z),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(us,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},Z.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:r?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):a.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):a.map(Z=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(lt,{checked:me.has(Z.id),onCheckedChange:()=>G(Z.id),className:"mt-1"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[Z.is_global&&e.jsx(qo,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),e.jsx("h3",{className:"font-semibold text-sm break-all",children:Z.content})]}),Z.meaning&&e.jsx("p",{className:"text-sm text-muted-foreground break-all",children:Z.meaning}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[J(Z.is_jargon),e.jsxs("span",{className:"text-muted-foreground",children:["次数: ",Z.count]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:["聊天: ",Z.chat_name||Z.chat_id]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>$(Z),className:"text-xs px-2 py-1 h-auto",children:[e.jsx(Wn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>V(Z),className:"text-xs px-2 py-1 h-auto",children:e.jsx(ma,{className:"h-3 w-3"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>L(Z),className:"text-xs px-2 py-1 h-auto text-destructive hover:text-destructive",children:[e.jsx(us,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},Z.id))}),d>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",d," 条记录,第 ",h," / ",Math.ceil(d/p)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(yn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Ia,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{type:"number",value:ge,onChange:Z=>pe(Z.target.value),onKeyDown:Z=>Z.key==="Enter"&&ns(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(d/p)}),e.jsx(_,{variant:"outline",size:"sm",onClick:ns,disabled:!ge,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(d/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(d/p)),disabled:h>=Math.ceil(d/p),className:"hidden sm:flex",children:e.jsx(wn,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(gk,{jargon:M,open:P,onOpenChange:E}),e.jsx(jk,{open:H,onOpenChange:O,chatList:B,onSuccess:()=>{_e(),he(),O(!1)}}),e.jsx(vk,{jargon:M,open:C,onOpenChange:R,chatList:B,onSuccess:()=>{_e(),he(),R(!1)}}),e.jsx(Cs,{open:!!X,onOpenChange:()=>L(null),children:e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认删除"}),e.jsxs(Ns,{children:['确定要删除黑话 "',X?.content,'" 吗?此操作不可撤销。']})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:()=>X&&z(X),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(Cs,{open:je,onOpenChange:ce,children:e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认批量删除"}),e.jsxs(Ns,{children:["您即将删除 ",me.size," 个黑话,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:se,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})]})}function gk({jargon:a,open:l,onOpenChange:r}){return a?e.jsx(Js,{open:l,onOpenChange:r,children:e.jsxs(qs,{className:"max-w-2xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(Vs,{children:[e.jsx(Gs,{children:"黑话详情"}),e.jsx(nt,{children:"查看黑话的完整信息"})]}),e.jsx(ss,{className:"h-full pr-4",children:e.jsxs("div",{className:"space-y-4 pb-2",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Vm,{icon:Xr,label:"记录ID",value:a.id.toString(),mono:!0}),e.jsx(Vm,{label:"使用次数",value:a.count.toString()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"内容"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all whitespace-pre-wrap",children:a.content})]}),a.raw_content&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"原始内容"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:(()=>{try{const c=JSON.parse(a.raw_content);return Array.isArray(c)?c.map((d,m)=>e.jsxs("div",{children:[m>0&&e.jsx("hr",{className:"my-3 border-border"}),e.jsx("div",{className:"whitespace-pre-wrap",children:d})]},m)):e.jsx("div",{className:"whitespace-pre-wrap",children:a.raw_content})}catch{return e.jsx("div",{className:"whitespace-pre-wrap",children:a.raw_content})}})()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"含义"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:a.meaning?e.jsx(gx,{content:a.meaning}):"-"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Vm,{label:"聊天",value:a.chat_name||a.chat_id}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"状态"}),e.jsxs("div",{className:"flex items-center gap-2",children:[a.is_jargon===!0&&e.jsx(ke,{variant:"default",className:"bg-green-600",children:"是黑话"}),a.is_jargon===!1&&e.jsx(ke,{variant:"secondary",children:"非黑话"}),a.is_jargon===null&&e.jsx(ke,{variant:"outline",children:"未判定"}),a.is_global&&e.jsx(ke,{variant:"outline",className:"border-blue-500 text-blue-500",children:"全局"}),a.is_complete&&e.jsx(ke,{variant:"outline",className:"border-purple-500 text-purple-500",children:"推断完成"})]})]})]}),a.inference_with_context&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"上下文推断结果"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:a.inference_with_context})]}),a.inference_content_only&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"纯词条推断结果"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:a.inference_content_only})]})]})}),e.jsx(xt,{className:"flex-shrink-0",children:e.jsx(_,{onClick:()=>r(!1),children:"关闭"})})]})}):null}function Vm({icon:a,label:l,value:r,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a&&e.jsx(a,{className:"h-3 w-3"}),l]}),e.jsx("div",{className:F("text-sm",c&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function jk({open:a,onOpenChange:l,chatList:r,onSuccess:c}){const[d,m]=u.useState({content:"",meaning:"",chat_id:"",is_global:!1}),[h,f]=u.useState(!1),{toast:p}=it(),g=async()=>{if(!d.content||!d.chat_id){p({title:"验证失败",description:"请填写必填字段:内容和聊天",variant:"destructive"});return}try{f(!0),await dk(d),p({title:"创建成功",description:"黑话已创建"}),m({content:"",meaning:"",chat_id:"",is_global:!1}),c()}catch(N){p({title:"创建失败",description:N instanceof Error?N.message:"无法创建黑话",variant:"destructive"})}finally{f(!1)}};return e.jsx(Js,{open:a,onOpenChange:l,children:e.jsxs(qs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Vs,{children:[e.jsx(Gs,{children:"新增黑话"}),e.jsx(nt,{children:"创建新的黑话记录"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"content",children:["内容 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ne,{id:"content",value:d.content,onChange:N=>m({...d,content:N.target.value}),placeholder:"输入黑话内容"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"meaning",children:"含义"}),e.jsx(ft,{id:"meaning",value:d.meaning||"",onChange:N=>m({...d,meaning:N.target.value}),placeholder:"输入黑话含义(可选)",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"chat_id",children:["聊天 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Pe,{value:d.chat_id,onValueChange:N=>m({...d,chat_id:N}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择关联的聊天"})}),e.jsx(Ie,{children:r.map(N=>e.jsx(ee,{value:N.chat_id,children:N.chat_name},N.chat_id))})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"is_global",checked:d.is_global,onCheckedChange:N=>m({...d,is_global:N})}),e.jsx(T,{htmlFor:"is_global",children:"设为全局黑话"})]})]}),e.jsxs(xt,{children:[e.jsx(_,{variant:"outline",onClick:()=>l(!1),children:"取消"}),e.jsx(_,{onClick:g,disabled:h,children:h?"创建中...":"创建"})]})]})})}function vk({jargon:a,open:l,onOpenChange:r,chatList:c,onSuccess:d}){const[m,h]=u.useState({}),[f,p]=u.useState(!1),{toast:g}=it();u.useEffect(()=>{a&&h({content:a.content,meaning:a.meaning||"",chat_id:a.stream_id||a.chat_id,is_global:a.is_global,is_jargon:a.is_jargon})},[a]);const N=async()=>{if(a)try{p(!0),await uk(a.id,m),g({title:"保存成功",description:"黑话已更新"}),d()}catch(j){g({title:"保存失败",description:j instanceof Error?j.message:"无法更新黑话",variant:"destructive"})}finally{p(!1)}};return a?e.jsx(Js,{open:l,onOpenChange:r,children:e.jsxs(qs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Vs,{children:[e.jsx(Gs,{children:"编辑黑话"}),e.jsx(nt,{children:"修改黑话的信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_content",children:"内容"}),e.jsx(ne,{id:"edit_content",value:m.content||"",onChange:j=>h({...m,content:j.target.value}),placeholder:"输入黑话内容"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_meaning",children:"含义"}),e.jsx(ft,{id:"edit_meaning",value:m.meaning||"",onChange:j=>h({...m,meaning:j.target.value}),placeholder:"输入黑话含义",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Pe,{value:m.chat_id||"",onValueChange:j=>h({...m,chat_id:j}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择关联的聊天"})}),e.jsx(Ie,{children:c.map(j=>e.jsx(ee,{value:j.chat_id,children:j.chat_name},j.chat_id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"黑话状态"}),e.jsxs(Pe,{value:m.is_jargon===null?"null":m.is_jargon?.toString()||"null",onValueChange:j=>h({...m,is_jargon:j==="null"?null:j==="true"}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"null",children:"未判定"}),e.jsx(ee,{value:"true",children:"是黑话"}),e.jsx(ee,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"edit_is_global",checked:m.is_global,onCheckedChange:j=>h({...m,is_global:j})}),e.jsx(T,{htmlFor:"edit_is_global",children:"全局黑话"})]})]}),e.jsxs(xt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(_,{onClick:N,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}const ti="/api/webui/person";async function Nk(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.search&&l.append("search",a.search),a.is_known!==void 0&&l.append("is_known",a.is_known.toString()),a.platform&&l.append("platform",a.platform);const r=await Se(`${ti}/list?${l}`,{headers:Ws()});if(!r.ok){const c=await r.json();throw new Error(c.detail||"获取人物列表失败")}return r.json()}async function bk(a){const l=await Se(`${ti}/${a}`,{headers:Ws()});if(!l.ok){const r=await l.json();throw new Error(r.detail||"获取人物详情失败")}return l.json()}async function yk(a,l){const r=await Se(`${ti}/${a}`,{method:"PATCH",headers:Ws(),body:JSON.stringify(l)});if(!r.ok){const c=await r.json();throw new Error(c.detail||"更新人物信息失败")}return r.json()}async function wk(a){const l=await Se(`${ti}/${a}`,{method:"DELETE",headers:Ws()});if(!l.ok){const r=await l.json();throw new Error(r.detail||"删除人物信息失败")}return l.json()}async function _k(){const a=await Se(`${ti}/stats/summary`,{headers:Ws()});if(!a.ok){const l=await a.json();throw new Error(l.detail||"获取统计数据失败")}return a.json()}async function Sk(a){const l=await Se(`${ti}/batch/delete`,{method:"POST",headers:Ws(),body:JSON.stringify({person_ids:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"批量删除失败")}return l.json()}function kk(){const[a,l]=u.useState([]),[r,c]=u.useState(!0),[d,m]=u.useState(0),[h,f]=u.useState(1),[p,g]=u.useState(20),[N,j]=u.useState(""),[y,b]=u.useState(void 0),[w,A]=u.useState(void 0),[M,S]=u.useState(null),[P,E]=u.useState(!1),[C,R]=u.useState(!1),[H,O]=u.useState(null),[X,L]=u.useState({total:0,known:0,unknown:0,platforms:{}}),[me,Ne]=u.useState(new Set),[je,ce]=u.useState(!1),[ge,pe]=u.useState(""),{toast:D}=it(),K=async()=>{try{c(!0);const se=await Nk({page:h,page_size:p,search:N||void 0,is_known:y,platform:w});l(se.data),m(se.total)}catch(se){D({title:"加载失败",description:se instanceof Error?se.message:"无法加载人物信息",variant:"destructive"})}finally{c(!1)}},B=async()=>{try{const se=await _k();se?.data&&L(se.data)}catch(se){console.error("加载统计数据失败:",se)}};u.useEffect(()=>{K(),B()},[h,p,N,y,w]);const ue=async se=>{try{const Oe=await bk(se.person_id);S(Oe.data),E(!0)}catch(Oe){D({title:"加载详情失败",description:Oe instanceof Error?Oe.message:"无法加载人物详情",variant:"destructive"})}},Q=se=>{S(se),R(!0)},_e=async se=>{try{await wk(se.person_id),D({title:"删除成功",description:`已删除人物信息: ${se.person_name||se.nickname||se.user_id}`}),O(null),K(),B()}catch(Oe){D({title:"删除失败",description:Oe instanceof Error?Oe.message:"无法删除人物信息",variant:"destructive"})}},he=u.useMemo(()=>Object.keys(X.platforms),[X.platforms]),Te=se=>{const Oe=new Set(me);Oe.has(se)?Oe.delete(se):Oe.add(se),Ne(Oe)},V=()=>{me.size===a.length&&a.length>0?Ne(new Set):Ne(new Set(a.map(se=>se.person_id)))},$=()=>{if(me.size===0){D({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}ce(!0)},z=async()=>{try{const se=await Sk(Array.from(me));D({title:"批量删除完成",description:se.message}),Ne(new Set),ce(!1),K(),B()}catch(se){D({title:"批量删除失败",description:se instanceof Error?se.message:"批量删除失败",variant:"destructive"})}},G=()=>{const se=parseInt(ge),Oe=Math.ceil(d/p);se>=1&&se<=Oe?(f(se),pe("")):D({title:"无效的页码",description:`请输入1-${Oe}之间的页码`,variant:"destructive"})},Re=se=>se?new Date(se*1e3).toLocaleString("zh-CN"):"-";return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(ic,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),e.jsx(ss,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:X.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:X.known})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:X.unknown})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(T,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative mt-1.5",children:[e.jsx(Ut,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:N,onChange:se=>j(se.target.value),className:"pl-9"})]})]}),e.jsxs("div",{children:[e.jsx(T,{htmlFor:"filter-known",children:"认识状态"}),e.jsxs(Pe,{value:y===void 0?"all":y.toString(),onValueChange:se=>{b(se==="all"?void 0:se==="true"),f(1)},children:[e.jsx(Be,{id:"filter-known",className:"mt-1.5",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"all",children:"全部"}),e.jsx(ee,{value:"true",children:"已认识"}),e.jsx(ee,{value:"false",children:"未认识"})]})]})]}),e.jsxs("div",{children:[e.jsx(T,{htmlFor:"filter-platform",children:"平台"}),e.jsxs(Pe,{value:w||"all",onValueChange:se=>{A(se==="all"?void 0:se),f(1)},children:[e.jsx(Be,{id:"filter-platform",className:"mt-1.5",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"all",children:"全部平台"}),he.map(se=>e.jsxs(ee,{value:se,children:[se," (",X.platforms[se],")"]},se))]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:me.size>0&&e.jsxs("span",{children:["已选择 ",me.size," 个人物"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Pe,{value:p.toString(),onValueChange:se=>{g(parseInt(se)),f(1),Ne(new Set)},children:[e.jsx(Be,{id:"page-size",className:"w-20",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"10",children:"10"}),e.jsx(ee,{value:"20",children:"20"}),e.jsx(ee,{value:"50",children:"50"}),e.jsx(ee,{value:"100",children:"100"})]})]}),me.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Ne(new Set),children:"取消选择"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:$,children:[e.jsx(us,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(Il,{children:[e.jsx(Pl,{children:e.jsxs(bt,{children:[e.jsx(ls,{className:"w-12",children:e.jsx(lt,{checked:a.length>0&&me.size===a.length,onCheckedChange:V,"aria-label":"全选"})}),e.jsx(ls,{children:"状态"}),e.jsx(ls,{children:"名称"}),e.jsx(ls,{children:"昵称"}),e.jsx(ls,{children:"平台"}),e.jsx(ls,{children:"用户ID"}),e.jsx(ls,{children:"最后更新"}),e.jsx(ls,{className:"text-right",children:"操作"})]})}),e.jsx(Fl,{children:r?e.jsx(bt,{children:e.jsx(Je,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):a.length===0?e.jsx(bt,{children:e.jsx(Je,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):a.map(se=>e.jsxs(bt,{children:[e.jsx(Je,{children:e.jsx(lt,{checked:me.has(se.person_id),onCheckedChange:()=>Te(se.person_id),"aria-label":`选择 ${se.person_name||se.nickname||se.user_id}`})}),e.jsx(Je,{children:e.jsx("div",{className:F("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",se.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:se.is_known?"已认识":"未认识"})}),e.jsx(Je,{className:"font-medium",children:se.person_name||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Je,{children:se.nickname||"-"}),e.jsx(Je,{children:se.platform}),e.jsx(Je,{className:"font-mono text-sm",children:se.user_id}),e.jsx(Je,{className:"text-sm text-muted-foreground",children:Re(se.last_know)}),e.jsx(Je,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>ue(se),children:[e.jsx(ma,{className:"h-4 w-4 mr-1"}),"详情"]}),e.jsxs(_,{variant:"default",size:"sm",onClick:()=>Q(se),children:[e.jsx(Wn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>O(se),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(us,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},se.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:r?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):a.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):a.map(se=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(lt,{checked:me.has(se.person_id),onCheckedChange:()=>Te(se.person_id),className:"mt-1"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:F("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",se.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:se.is_known?"已认识":"未认识"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:se.person_name||e.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),se.nickname&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",se.nickname]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),e.jsx("p",{className:"font-medium text-xs",children:se.platform})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),e.jsx("p",{className:"font-mono text-xs truncate",title:se.user_id,children:se.user_id})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),e.jsx("p",{className:"text-xs",children:Re(se.last_know)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>ue(se),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(ma,{className:"h-3 w-3 mr-1"}),"查看"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>Q(se),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(Wn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>O(se),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(us,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},se.id))}),d>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",d," 条记录,第 ",h," / ",Math.ceil(d/p)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(yn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Ia,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{type:"number",value:ge,onChange:se=>pe(se.target.value),onKeyDown:se=>se.key==="Enter"&&G(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(d/p)}),e.jsx(_,{variant:"outline",size:"sm",onClick:G,disabled:!ge,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(d/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(d/p)),disabled:h>=Math.ceil(d/p),className:"hidden sm:flex",children:e.jsx(wn,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(Ck,{person:M,open:P,onOpenChange:E}),e.jsx(Tk,{person:M,open:C,onOpenChange:R,onSuccess:()=>{K(),B(),R(!1)}}),e.jsx(Cs,{open:!!H,onOpenChange:()=>O(null),children:e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认删除"}),e.jsxs(Ns,{children:['确定要删除人物信息 "',H?.person_name||H?.nickname||H?.user_id,'" 吗? 此操作不可撤销。']})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:()=>H&&_e(H),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(Cs,{open:je,onOpenChange:ce,children:e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"确认批量删除"}),e.jsxs(Ns,{children:["确定要删除选中的 ",me.size," 个人物信息吗? 此操作不可撤销。"]})]}),e.jsxs(js,{children:[e.jsx(ys,{children:"取消"}),e.jsx(bs,{onClick:z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function Ck({person:a,open:l,onOpenChange:r}){if(!a)return null;const c=d=>d?new Date(d*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Js,{open:l,onOpenChange:r,children:e.jsxs(qs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Vs,{children:[e.jsx(Gs,{children:"人物详情"}),e.jsxs(nt,{children:["查看 ",a.person_name||a.nickname||a.user_id," 的完整信息"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Ol,{icon:$l,label:"人物名称",value:a.person_name}),e.jsx(Ol,{icon:Ba,label:"昵称",value:a.nickname}),e.jsx(Ol,{icon:Xr,label:"用户ID",value:a.user_id,mono:!0}),e.jsx(Ol,{icon:Xr,label:"人物ID",value:a.person_id,mono:!0}),e.jsx(Ol,{label:"平台",value:a.platform}),e.jsx(Ol,{label:"状态",value:a.is_known?"已认识":"未认识"})]}),a.name_reason&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),e.jsx("p",{className:"mt-1 text-sm",children:a.name_reason})]}),a.memory_points&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"个人印象"}),e.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:a.memory_points})]}),a.group_nick_name&&a.group_nick_name.length>0&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"群昵称"}),e.jsx("div",{className:"mt-2 space-y-1",children:a.group_nick_name.map((d,m)=>e.jsxs("div",{className:"text-sm flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:d.group_id}),e.jsx("span",{children:"→"}),e.jsx("span",{children:d.group_nick_name})]},m))})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(Ol,{icon:ia,label:"认识时间",value:c(a.know_times)}),e.jsx(Ol,{icon:ia,label:"首次记录",value:c(a.know_since)}),e.jsx(Ol,{icon:ia,label:"最后更新",value:c(a.last_know)})]})]}),e.jsx(xt,{children:e.jsx(_,{onClick:()=>r(!1),children:"关闭"})})]})})}function Ol({icon:a,label:l,value:r,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a&&e.jsx(a,{className:"h-3 w-3"}),l]}),e.jsx("div",{className:F("text-sm",c&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function Tk({person:a,open:l,onOpenChange:r,onSuccess:c}){const[d,m]=u.useState({}),[h,f]=u.useState(!1),{toast:p}=it();u.useEffect(()=>{a&&m({person_name:a.person_name||"",name_reason:a.name_reason||"",nickname:a.nickname||"",is_known:a.is_known})},[a]);const g=async()=>{if(a)try{f(!0),await yk(a.person_id,d),p({title:"保存成功",description:"人物信息已更新"}),c()}catch(N){p({title:"保存失败",description:N instanceof Error?N.message:"无法更新人物信息",variant:"destructive"})}finally{f(!1)}};return a?e.jsx(Js,{open:l,onOpenChange:r,children:e.jsxs(qs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Vs,{children:[e.jsx(Gs,{children:"编辑人物信息"}),e.jsxs(nt,{children:["修改 ",a.person_name||a.nickname||a.user_id," 的信息"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"person_name",children:"人物名称"}),e.jsx(ne,{id:"person_name",value:d.person_name||"",onChange:N=>m({...d,person_name:N.target.value}),placeholder:"为这个人设置一个名称"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"nickname",children:"昵称"}),e.jsx(ne,{id:"nickname",value:d.nickname||"",onChange:N=>m({...d,nickname:N.target.value}),placeholder:"昵称"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"name_reason",children:"名称设定原因"}),e.jsx(ft,{id:"name_reason",value:d.name_reason||"",onChange:N=>m({...d,name_reason:N.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{children:[e.jsx(T,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),e.jsx(Ge,{id:"is_known",checked:d.is_known,onCheckedChange:N=>m({...d,is_known:N})})]})]}),e.jsxs(xt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(_,{onClick:g,disabled:h,children:h?"保存中...":"保存"})]})]})}):null}var Ek=v_();const Xg=iw(Ek),Sx="/api/webui";async function Mk(a=100,l="all"){const r=`${Sx}/knowledge/graph?limit=${a}&node_type=${l}`,c=await fetch(r);if(!c.ok)throw new Error(`获取知识图谱失败: ${c.status}`);return c.json()}async function Ak(){const a=await fetch(`${Sx}/knowledge/stats`);if(!a.ok)throw new Error("获取知识图谱统计信息失败");return a.json()}async function zk(a){const l=await fetch(`${Sx}/knowledge/search?query=${encodeURIComponent(a)}`);if(!l.ok)throw new Error("搜索知识节点失败");return l.json()}const lN=u.memo(({data:a})=>e.jsxs("div",{className:"px-4 py-2 shadow-md rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700 min-w-[120px]",children:[e.jsx(Ko,{type:"target",position:Qo.Top}),e.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:a.content,children:a.label}),e.jsx(Ko,{type:"source",position:Qo.Bottom})]}));lN.displayName="EntityNode";const nN=u.memo(({data:a})=>e.jsxs("div",{className:"px-3 py-2 shadow-md rounded-md bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700 min-w-[100px]",children:[e.jsx(Ko,{type:"target",position:Qo.Top}),e.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:a.content,children:a.label}),e.jsx(Ko,{type:"source",position:Qo.Bottom})]}));nN.displayName="ParagraphNode";const Rk={entity:lN,paragraph:nN};function Dk(a,l){const r=new Xg.graphlib.Graph;r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:"TB",ranksep:100,nodesep:80});const c=[],d=[];return a.forEach(m=>{r.setNode(m.id,{width:150,height:50})}),l.forEach(m=>{r.setEdge(m.source,m.target)}),Xg.layout(r),a.forEach(m=>{const h=r.node(m.id);c.push({id:m.id,type:m.type,position:{x:h.x-75,y:h.y-25},data:{label:m.content.slice(0,20)+(m.content.length>20?"...":""),content:m.content}})}),l.forEach((m,h)=>{const f={id:`edge-${h}`,source:m.source,target:m.target,animated:a.length<=200&&m.weight>5,style:{strokeWidth:Math.min(m.weight/2,5),opacity:.6}};m.weight>10&&a.length<100&&(f.label=`${m.weight.toFixed(0)}`),d.push(f)}),{nodes:c,edges:d}}function Ok(){const a=xa(),[l,r]=u.useState(!1),[c,d]=u.useState(null),[m,h]=u.useState(""),[f,p]=u.useState("all"),[g,N]=u.useState(50),[j,y]=u.useState("50"),[b,w]=u.useState(!1),[A,M]=u.useState(!0),[S,P]=u.useState(!1),[E,C]=u.useState(!1),[R,H,O]=N_([]),[X,L,me]=b_([]),[Ne,je]=u.useState(0),[ce,ge]=u.useState(null),[pe,D]=u.useState(null),{toast:K}=it(),B=u.useCallback(z=>z.type==="entity"?"#6366f1":z.type==="paragraph"?"#10b981":"#6b7280",[]),ue=u.useCallback(async(z=!1)=>{try{if(!z&&g>200){C(!0);return}r(!0);const[G,Re]=await Promise.all([Mk(g,f),Ak()]);if(d(Re),G.nodes.length===0){K({title:"提示",description:"知识库为空,请先导入知识数据"}),H([]),L([]);return}const{nodes:se,edges:Oe}=Dk(G.nodes,G.edges);H(se),L(Oe),je(se.length),Re&&Re.total_nodes>g&&K({title:"提示",description:`知识图谱包含 ${Re.total_nodes} 个节点,当前显示 ${se.length} 个`}),K({title:"加载成功",description:`已加载 ${se.length} 个节点,${Oe.length} 条边`})}catch(G){console.error("加载知识图谱失败:",G),K({title:"加载失败",description:G instanceof Error?G.message:"未知错误",variant:"destructive"})}finally{r(!1)}},[g,f,K]),Q=u.useCallback(async()=>{if(!m.trim()){K({title:"提示",description:"请输入搜索关键词"});return}try{const z=await zk(m);if(z.length===0){K({title:"未找到",description:"没有找到匹配的节点"});return}const G=new Set(z.map(Re=>Re.id));H(Re=>Re.map(se=>({...se,style:{...se.style,opacity:G.has(se.id)?1:.3,filter:G.has(se.id)?"brightness(1.2)":"brightness(0.8)"}}))),K({title:"搜索完成",description:`找到 ${z.length} 个匹配节点`})}catch(z){console.error("搜索失败:",z),K({title:"搜索失败",description:z instanceof Error?z.message:"未知错误",variant:"destructive"})}},[m,K]),_e=u.useCallback(()=>{H(z=>z.map(G=>({...G,style:{...G.style,opacity:1,filter:"brightness(1)"}})))},[]),he=u.useCallback(()=>{M(!1),P(!0),ue()},[ue]),Te=u.useCallback(()=>{C(!1),setTimeout(()=>{ue(!0)},0)},[ue]),V=u.useCallback((z,G)=>{R.find(se=>se.id===G.id)&&ge({id:G.id,type:G.type,content:G.data.content})},[R]);u.useEffect(()=>{A||S&&ue()},[g,f,A,S]);const $=u.useCallback((z,G)=>{const Re=R.find(ns=>ns.id===G.source),se=R.find(ns=>ns.id===G.target),Oe=X.find(ns=>ns.id===G.id);Re&&se&&Oe&&D({source:{id:Re.id,type:Re.type,content:Re.data.content},target:{id:se.id,type:se.type,content:se.data.content},edge:{source:G.source,target:G.target,weight:parseFloat(G.label||"0")}})},[R,X]);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex-shrink-0 p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦知识库图谱"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"可视化知识实体与关系网络"})]}),c&&e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs(ke,{variant:"outline",className:"gap-1",children:[e.jsx(Jr,{className:"h-3 w-3"}),"节点: ",c.total_nodes]}),e.jsxs(ke,{variant:"outline",className:"gap-1",children:[e.jsx(dv,{className:"h-3 w-3"}),"边: ",c.total_edges]}),e.jsxs(ke,{variant:"outline",className:"gap-1",children:[e.jsx(Qt,{className:"h-3 w-3"}),"实体: ",c.entity_nodes]}),e.jsxs(ke,{variant:"outline",className:"gap-1",children:[e.jsx(La,{className:"h-3 w-3"}),"段落: ",c.paragraph_nodes]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 mt-4",children:[e.jsxs("div",{className:"flex-1 flex gap-2",children:[e.jsx(ne,{placeholder:"搜索节点内容...",value:m,onChange:z=>h(z.target.value),onKeyDown:z=>z.key==="Enter"&&Q(),className:"flex-1"}),e.jsx(_,{onClick:Q,size:"sm",children:e.jsx(Ut,{className:"h-4 w-4"})}),e.jsx(_,{onClick:_e,variant:"outline",size:"sm",children:"重置"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Pe,{value:f,onValueChange:z=>p(z),children:[e.jsx(Be,{className:"w-[120px]",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"all",children:"全部节点"}),e.jsx(ee,{value:"entity",children:"仅实体"}),e.jsx(ee,{value:"paragraph",children:"仅段落"})]})]}),e.jsxs(Pe,{value:g===1e4?"all":b?"custom":g.toString(),onValueChange:z=>{z==="custom"?(w(!0),y(g.toString())):z==="all"?(w(!1),N(1e4)):(w(!1),N(Number(z)))},children:[e.jsx(Be,{className:"w-[120px]",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"50",children:"50 节点"}),e.jsx(ee,{value:"100",children:"100 节点"}),e.jsx(ee,{value:"200",children:"200 节点"}),e.jsx(ee,{value:"500",children:"500 节点"}),e.jsx(ee,{value:"1000",children:"1000 节点"}),e.jsx(ee,{value:"all",children:"全部 (最多10000)"}),e.jsx(ee,{value:"custom",children:"自定义..."})]})]}),b&&e.jsx(ne,{type:"number",min:"50",value:j,onChange:z=>y(z.target.value),onBlur:()=>{const z=parseInt(j);!isNaN(z)&&z>=50?N(z):(y("50"),N(50))},onKeyDown:z=>{if(z.key==="Enter"){const G=parseInt(j);!isNaN(G)&&G>=50?N(G):(y("50"),N(50))}},placeholder:"最少50个",className:"w-[120px]"}),e.jsx(_,{onClick:()=>ue(),variant:"outline",size:"sm",disabled:l,children:e.jsx(ut,{className:F("h-4 w-4",l&&"animate-spin")})})]})]})]}),e.jsx("div",{className:"flex-1 relative",children:l?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(ut,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"加载知识图谱中..."})]})}):R.length===0?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Jr,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"知识库为空"}),e.jsx("p",{className:"text-muted-foreground",children:"请先导入知识数据"})]})}):e.jsxs(y_,{nodes:R,edges:X,onNodesChange:O,onEdgesChange:me,onNodeClick:V,onEdgeClick:$,nodeTypes:Rk,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:Ne<=500,nodesDraggable:Ne<=1e3,attributionPosition:"bottom-left",children:[e.jsx(w_,{variant:__.Dots,gap:12,size:1}),e.jsx(S_,{}),Ne<=500&&e.jsx(k_,{nodeColor:B,nodeBorderRadius:8,pannable:!0,zoomable:!0}),e.jsxs(C_,{position:"top-right",className:"bg-background/95 backdrop-blur-sm rounded-lg border p-3 shadow-lg",children:[e.jsx("div",{className:"text-sm font-semibold mb-2",children:"图例"}),e.jsxs("div",{className:"space-y-2 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700"}),e.jsx("span",{children:"实体节点"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700"}),e.jsx("span",{children:"段落节点"})]}),Ne>200&&e.jsxs("div",{className:"mt-2 pt-2 border-t text-yellow-600 dark:text-yellow-500",children:[e.jsx("div",{className:"font-semibold",children:"性能模式"}),e.jsx("div",{children:"已禁用动画"}),Ne>500&&e.jsx("div",{children:"已禁用缩略图"})]})]})]})]})}),e.jsx(Js,{open:!!ce,onOpenChange:z=>!z&&ge(null),children:e.jsxs(qs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsx(Vs,{children:e.jsx(Gs,{children:"节点详情"})}),ce&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"类型"}),e.jsx("div",{className:"mt-1",children:e.jsx(ke,{variant:ce.type==="entity"?"default":"secondary",children:ce.type==="entity"?"🏷️ 实体":"📄 段落"})})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),e.jsx("code",{className:"mt-1 block p-2 bg-muted rounded text-xs break-all",children:ce.id})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"内容"}),e.jsx(ss,{className:"mt-1 h-40 p-3 bg-muted rounded",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:ce.content})})]})]})]})}),e.jsx(Js,{open:!!pe,onOpenChange:z=>!z&&D(null),children:e.jsxs(qs,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsx(Vs,{children:e.jsx(Gs,{children:"边详情"})}),pe&&e.jsx(ss,{className:"flex-1 pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-blue-50 dark:bg-blue-950 rounded border-2 border-blue-200 dark:border-blue-800",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"源节点"}),e.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:pe.source.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[pe.source.id.slice(0,40),"..."]})]}),e.jsx("div",{className:"text-2xl text-muted-foreground flex-shrink-0",children:"→"}),e.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-green-50 dark:bg-green-950 rounded border-2 border-green-200 dark:border-green-800",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"目标节点"}),e.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:pe.target.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[pe.target.id.slice(0,40),"..."]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"权重"}),e.jsx("div",{className:"mt-1",children:e.jsx(ke,{variant:"outline",className:"text-base font-mono",children:pe.edge.weight.toFixed(4)})})]})]})})]})}),e.jsx(Cs,{open:A,onOpenChange:M,children:e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"加载知识图谱"}),e.jsxs(Ns,{children:["知识图谱的动态展示会消耗较多系统资源。",e.jsx("br",{}),"确定要加载知识图谱吗?"]})]}),e.jsxs(js,{children:[e.jsx(ys,{onClick:()=>a({to:"/"}),children:"取消 (返回首页)"}),e.jsx(bs,{onClick:he,children:"确认加载"})]})]})}),e.jsx(Cs,{open:E,onOpenChange:C,children:e.jsxs(ps,{children:[e.jsxs(gs,{children:[e.jsx(vs,{children:"⚠️ 节点数量较多"}),e.jsx(Ns,{asChild:!0,children:e.jsxs("div",{children:[e.jsxs("p",{children:["您正在尝试加载 ",e.jsx("strong",{className:"text-orange-600",children:g>=1e4?"全部 (最多10000个)":g})," 个节点。"]}),e.jsx("p",{className:"mt-4",children:"节点数量过多可能导致:"}),e.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[e.jsx("li",{children:"页面加载时间较长"}),e.jsx("li",{children:"浏览器卡顿或崩溃"}),e.jsx("li",{children:"系统资源占用过高"})]}),e.jsx("p",{className:"mt-4",children:"建议先选择较少的节点数量 (50-200 个)。"})]})})]}),e.jsxs(js,{children:[e.jsx(ys,{onClick:()=>{C(!1),g>200&&(N(50),w(!1))},children:"取消"}),e.jsx(bs,{onClick:Te,className:"bg-orange-600 hover:bg-orange-700",children:"我了解风险,继续加载"})]})]})})]})}function Lk(){return e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx("div",{className:"flex-none border-b bg-card/50 px-6 py-4",children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"麦麦知识库管理"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"管理和组织麦麦的知识库内容"})]})})}),e.jsx("div",{className:"flex-1 overflow-auto p-6",children:e.jsx("div",{className:"mx-auto max-w-4xl",children:e.jsxs(Ce,{children:[e.jsxs(De,{className:"text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-20 w-20 items-center justify-center rounded-full bg-primary/10",children:e.jsx(Jr,{className:"h-10 w-10 text-primary"})}),e.jsx(Ue,{className:"text-2xl",children:"麦麦知识库管理"}),e.jsx(fs,{className:"text-base",children:"功能开发中,敬请期待"})]}),e.jsx(Ae,{className:"text-center text-sm text-muted-foreground",children:e.jsx("p",{children:"此功能将提供知识库的创建、编辑、导入和管理能力"})})]})})})]})}function Zg({className:a,classNames:l,showOutsideDays:r=!0,captionLayout:c="label",buttonVariant:d="ghost",formatters:m,components:h,...f}){const p=kv();return e.jsx(m_,{showOutsideDays:r,className:F("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,a),captionLayout:c,formatters:{formatMonthDropdown:g=>g.toLocaleString("default",{month:"short"}),...m},classNames:{root:F("w-fit",p.root),months:F("relative flex flex-col gap-4 md:flex-row",p.months),month:F("flex w-full flex-col gap-4",p.month),nav:F("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",p.nav),button_previous:F(Wr({variant:d}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",p.button_previous),button_next:F(Wr({variant:d}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",p.button_next),month_caption:F("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",p.month_caption),dropdowns:F("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",p.dropdowns),dropdown_root:F("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",p.dropdown_root),dropdown:F("bg-popover absolute inset-0 opacity-0",p.dropdown),caption_label:F("select-none font-medium",c==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",p.caption_label),table:"w-full border-collapse",weekdays:F("flex",p.weekdays),weekday:F("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",p.weekday),week:F("mt-2 flex w-full",p.week),week_number_header:F("w-[--cell-size] select-none",p.week_number_header),week_number:F("text-muted-foreground select-none text-[0.8rem]",p.week_number),day:F("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",p.day),range_start:F("bg-accent rounded-l-md",p.range_start),range_middle:F("rounded-none",p.range_middle),range_end:F("bg-accent rounded-r-md",p.range_end),today:F("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",p.today),outside:F("text-muted-foreground aria-selected:text-muted-foreground",p.outside),disabled:F("text-muted-foreground opacity-50",p.disabled),hidden:F("invisible",p.hidden),...l},components:{Root:({className:g,rootRef:N,...j})=>e.jsx("div",{"data-slot":"calendar",ref:N,className:F(g),...j}),Chevron:({className:g,orientation:N,...j})=>N==="left"?e.jsx(Ia,{className:F("size-4",g),...j}):N==="right"?e.jsx(ra,{className:F("size-4",g),...j}):e.jsx($a,{className:F("size-4",g),...j}),DayButton:Uk,WeekNumber:({children:g,...N})=>e.jsx("td",{...N,children:e.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:g})}),...h},...f})}function Uk({className:a,day:l,modifiers:r,...c}){const d=kv(),m=u.useRef(null);return u.useEffect(()=>{r.focused&&m.current?.focus()},[r.focused]),e.jsx(_,{ref:m,variant:"ghost",size:"icon","data-day":l.date.toLocaleDateString(),"data-selected-single":r.selected&&!r.range_start&&!r.range_end&&!r.range_middle,"data-range-start":r.range_start,"data-range-end":r.range_end,"data-range-middle":r.range_middle,className:F("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",d.day,a),...c})}const Oo={xs:{label:"小",rowHeight:28,class:"text-[10px] sm:text-xs"},sm:{label:"中",rowHeight:36,class:"text-xs sm:text-sm"},base:{label:"大",rowHeight:44,class:"text-sm sm:text-base"}};function $k(){const[a,l]=u.useState([]),[r,c]=u.useState(""),[d,m]=u.useState("all"),[h,f]=u.useState("all"),[p,g]=u.useState(void 0),[N,j]=u.useState(void 0),[y,b]=u.useState(!0),[w,A]=u.useState(!1),[M,S]=u.useState("xs"),[P,E]=u.useState(4),[C,R]=u.useState(!1),H=u.useRef(null);u.useEffect(()=>{const Q=Gn.getAllLogs();l(Q);const _e=Gn.onLog(()=>{l(Gn.getAllLogs())}),he=Gn.onConnectionChange(Te=>{A(Te)});return()=>{_e(),he()}},[]);const O=u.useMemo(()=>{const Q=new Set(a.map(_e=>_e.module).filter(_e=>_e&&_e.trim()!==""));return Array.from(Q).sort()},[a]),X=Q=>{switch(Q){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},L=Q=>{switch(Q){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},me=()=>{window.location.reload()},Ne=()=>{Gn.clearLogs(),l([])},je=()=>{const Q=pe.map(V=>`${V.timestamp} [${V.level.padEnd(8)}] [${V.module}] ${V.message}`).join(` +`),_e=new Blob([Q],{type:"text/plain;charset=utf-8"}),he=URL.createObjectURL(_e),Te=document.createElement("a");Te.href=he,Te.download=`logs-${Tm(new Date,"yyyy-MM-dd-HHmmss")}.txt`,Te.click(),URL.revokeObjectURL(he)},ce=()=>{b(!y)},ge=()=>{g(void 0),j(void 0)},pe=u.useMemo(()=>a.filter(Q=>{const _e=r===""||Q.message.toLowerCase().includes(r.toLowerCase())||Q.module.toLowerCase().includes(r.toLowerCase()),he=d==="all"||Q.level===d,Te=h==="all"||Q.module===h;let V=!0;if(p||N){const $=new Date(Q.timestamp);if(p){const z=new Date(p);z.setHours(0,0,0,0),V=V&&$>=z}if(N){const z=new Date(N);z.setHours(23,59,59,999),V=V&&$<=z}}return _e&&he&&Te&&V}),[a,r,d,h,p,N]),D=Oo[M].rowHeight+P,K=Z0({count:pe.length,getScrollElement:()=>H.current,estimateSize:()=>D,overscan:50}),B=u.useRef(!1),ue=u.useRef(pe.length);return u.useEffect(()=>{const Q=H.current;if(!Q)return;const _e=()=>{if(B.current)return;const{scrollTop:he,scrollHeight:Te,clientHeight:V}=Q,$=Te-he-V;$>100&&y?b(!1):$<50&&!y&&b(!0)};return Q.addEventListener("scroll",_e,{passive:!0}),()=>Q.removeEventListener("scroll",_e)},[y]),u.useEffect(()=>{const Q=pe.length>ue.current;ue.current=pe.length,y&&pe.length>0&&Q&&(B.current=!0,K.scrollToIndex(pe.length-1,{align:"end",behavior:"auto"}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{B.current=!1})}))},[pe.length,y,K]),e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex-shrink-0 space-y-2 sm:space-y-3 p-2 sm:p-3 lg:p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg sm:text-xl lg:text-2xl font-bold",children:"日志查看器"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 hidden sm:block",children:"实时查看和分析麦麦运行日志"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:F("h-2 w-2 sm:h-2.5 sm:w-2.5 rounded-full",w?"bg-green-500 animate-pulse":"bg-red-500")}),e.jsx("span",{className:"text-xs text-muted-foreground",children:w?"已连接":"未连接"})]})]}),e.jsx(Ce,{className:"p-2 sm:p-3",children:e.jsx(uc,{open:C,onOpenChange:R,children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex-1 relative min-w-0",children:[e.jsx(Ut,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),e.jsx(ne,{placeholder:"搜索日志...",value:r,onChange:Q=>c(Q.target.value),className:"pl-8 h-8 text-xs sm:text-sm"})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsxs(_,{variant:y?"default":"outline",size:"sm",onClick:ce,className:"h-8 px-2",title:y?"自动滚动":"已暂停",children:[y?e.jsx(L1,{className:"h-3.5 w-3.5"}):e.jsx(U1,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden sm:inline",children:y?"滚动":"暂停"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:Ne,className:"h-8 px-2",title:"清空日志",children:[e.jsx(us,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden md:inline",children:"清空"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:je,className:"h-8 px-2 hidden sm:flex",title:"导出日志",children:[e.jsx(na,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden lg:inline",children:"导出"})]}),e.jsx(mc,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"h-8 px-2",title:C?"收起筛选":"展开筛选",children:[e.jsx(Bo,{className:"h-3.5 w-3.5"}),C?e.jsx(Yr,{className:"h-3.5 w-3.5 ml-1"}):e.jsx($a,{className:"h-3.5 w-3.5 ml-1"})]})})]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground text-center sm:text-right -mt-1",children:[e.jsxs("span",{className:"font-mono",children:[pe.length," / ",a.length]}),e.jsx("span",{className:"ml-1",children:"条日志"})]}),e.jsxs(xc,{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(Pe,{value:d,onValueChange:m,children:[e.jsxs(Be,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(Bo,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx(Fe,{placeholder:"级别"})]}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"all",children:"全部级别"}),e.jsx(ee,{value:"DEBUG",children:"DEBUG"}),e.jsx(ee,{value:"INFO",children:"INFO"}),e.jsx(ee,{value:"WARNING",children:"WARNING"}),e.jsx(ee,{value:"ERROR",children:"ERROR"}),e.jsx(ee,{value:"CRITICAL",children:"CRITICAL"})]})]}),e.jsxs(Pe,{value:h,onValueChange:f,children:[e.jsxs(Be,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(Bo,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx(Fe,{placeholder:"模块"})]}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"all",children:"全部模块"}),O.map(Q=>e.jsx(ee,{value:Q,children:Q},Q))]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(hl,{children:[e.jsx(fl,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:F("w-full sm:flex-1 justify-start text-left font-normal h-8",!p&&"text-muted-foreground"),children:[e.jsx(Vo,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:p?Tm(p,"PP",{locale:Ro}):"开始日期"})]})}),e.jsx(nl,{className:"w-auto p-0",align:"start",children:e.jsx(Zg,{mode:"single",selected:p,onSelect:g,initialFocus:!0,locale:Ro})})]}),e.jsxs(hl,{children:[e.jsx(fl,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:F("w-full sm:flex-1 justify-start text-left font-normal h-8",!N&&"text-muted-foreground"),children:[e.jsx(Vo,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:N?Tm(N,"PP",{locale:Ro}):"结束日期"})]})}),e.jsx(nl,{className:"w-auto p-0",align:"start",children:e.jsx(Zg,{mode:"single",selected:N,onSelect:j,initialFocus:!0,locale:Ro})})]}),(p||N)&&e.jsxs(_,{variant:"outline",size:"sm",onClick:ge,className:"w-full sm:w-auto h-8",children:[e.jsx(_a,{className:"h-3.5 w-3.5 sm:mr-1"}),e.jsx("span",{className:"text-xs",children:"清除"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3 pt-2 border-t border-border/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx($1,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"字号"})]}),e.jsx("div",{className:"flex gap-1",children:Object.keys(Oo).map(Q=>e.jsx(_,{variant:M===Q?"default":"outline",size:"sm",onClick:()=>S(Q),className:"h-6 px-2 text-xs",children:Oo[Q].label},Q))})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-1 max-w-[200px]",children:[e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"行距"}),e.jsx(Wa,{value:[P],onValueChange:([Q])=>E(Q),min:0,max:12,step:2,className:"flex-1"}),e.jsxs("span",{className:"text-xs text-muted-foreground w-7",children:[P,"px"]})]}),e.jsxs("div",{className:"flex gap-2 sm:hidden",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:me,className:"flex-1 h-8",children:[e.jsx(ut,{className:"h-3.5 w-3.5 mr-1"}),e.jsx("span",{className:"text-xs",children:"刷新"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:je,className:"flex-1 h-8",children:[e.jsx(na,{className:"h-3.5 w-3.5 mr-1"}),e.jsx("span",{className:"text-xs",children:"导出"})]})]})]})]})]})})})]}),e.jsx("div",{className:"flex-1 min-h-0 px-2 sm:px-3 lg:px-4 pb-2 sm:pb-3 lg:pb-4",children:e.jsx(Ce,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900 h-full overflow-hidden",children:e.jsx("div",{ref:H,className:F("h-full overflow-auto","[&::-webkit-scrollbar]:w-2.5","[&::-webkit-scrollbar-track]:bg-transparent","[&::-webkit-scrollbar-thumb]:bg-border [&::-webkit-scrollbar-thumb]:rounded-full","[&::-webkit-scrollbar-thumb:hover]:bg-border/80"),children:e.jsx("div",{className:F("p-2 sm:p-3 font-mono relative",Oo[M].class),style:{height:`${K.getTotalSize()}px`},children:pe.length===0?e.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-xs sm:text-sm",children:"暂无日志数据"}):K.getVirtualItems().map(Q=>{const _e=pe[Q.index];return e.jsxs("div",{"data-index":Q.index,ref:K.measureElement,className:F("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors",L(_e.level)),style:{transform:`translateY(${Q.start}px)`,paddingTop:`${P/2}px`,paddingBottom:`${P/2}px`},children:[e.jsxs("div",{className:"flex flex-col gap-0.5 sm:hidden",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-600 text-[10px]",children:_e.timestamp}),e.jsxs("span",{className:F("font-semibold text-[10px]",X(_e.level)),children:["[",_e.level,"]"]})]}),e.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 truncate text-[10px]",children:_e.module}),e.jsx("div",{className:"text-gray-300 dark:text-gray-400 whitespace-pre-wrap break-words text-[10px]",children:_e.message})]}),e.jsxs("div",{className:"hidden sm:flex gap-2 items-start",children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[130px] lg:w-[160px]",children:_e.timestamp}),e.jsxs("span",{className:F("flex-shrink-0 w-[65px] lg:w-[75px] font-semibold",X(_e.level)),children:["[",_e.level,"]"]}),e.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[100px] lg:w-[130px] truncate",children:_e.module}),e.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words",children:_e.message})]})]},Q.key)})})})})})]})}async function Bk(){return(await Se("/api/planner/overview")).json()}async function Ik(a,l=1,r=20,c){const d=new URLSearchParams({page:l.toString(),page_size:r.toString()});return c&&d.append("search",c),(await Se(`/api/planner/chat/${a}/logs?${d}`)).json()}async function Pk(a,l){return(await Se(`/api/planner/log/${a}/${l}`)).json()}async function Fk(){return(await Se("/api/replier/overview")).json()}async function Hk(a,l=1,r=20,c){const d=new URLSearchParams({page:l.toString(),page_size:r.toString()});return c&&d.append("search",c),(await Se(`/api/replier/chat/${a}/logs?${d}`)).json()}async function qk(a,l){return(await Se(`/api/replier/log/${a}/${l}`)).json()}function rN(){const[a,l]=u.useState(new Map),[r,c]=u.useState(!0),d=u.useCallback(async()=>{try{c(!0);const h=await xx();if(h?.data){const f=new Map;h.data.forEach(p=>{f.set(p.chat_id,p.chat_name)}),l(f)}}catch(h){console.error("加载聊天列表失败:",h)}finally{c(!1)}},[]);u.useEffect(()=>{d()},[d]);const m=u.useCallback(h=>a.get(h)||h,[a]);return{chatNameMap:a,getChatName:m,loading:r,reload:d}}function Jo(a){return new Date(a*1e3).toLocaleString("zh-CN")}function iN(a){const r=Date.now()/1e3-a;return r<60?"刚刚":r<3600?`${Math.floor(r/60)} 分钟前`:r<86400?`${Math.floor(r/3600)} 小时前`:`${Math.floor(r/86400)} 天前`}function cN(a,l,r=1e4){u.useEffect(()=>{if(!a)return;const c=setInterval(l,r);return()=>clearInterval(c)},[a,l,r])}function Vk({autoRefresh:a,refreshKey:l}){const[r,c]=u.useState("overview"),[d,m]=u.useState(null),{getChatName:h}=rN(),[f,p]=u.useState(null),[g,N]=u.useState(!0),[j,y]=u.useState(null),[b,w]=u.useState(!1),[A,M]=u.useState(1),[S,P]=u.useState(20),[E,C]=u.useState(""),[R,H]=u.useState(""),[O,X]=u.useState(""),[L,me]=u.useState(null),[Ne,je]=u.useState(!1),[ce,ge]=u.useState(!1),pe=u.useCallback(async()=>{try{N(!0);const $=await Bk();p($)}catch($){console.error("加载规划器总览失败:",$)}finally{N(!1)}},[]),D=u.useCallback(async()=>{if(d)try{w(!0);const $=await Ik(d.chat_id,A,S,R||void 0);y($)}catch($){console.error("加载聊天日志失败:",$)}finally{w(!1)}},[d,A,S,R]);u.useEffect(()=>{pe()},[pe]),u.useEffect(()=>{l>0&&(r==="overview"?pe():D())},[l,r,pe,D]),u.useEffect(()=>{r==="chat-logs"&&d&&D()},[r,d,D]),cN(a,u.useCallback(()=>{r==="overview"?pe():D()},[r,pe,D]));const K=$=>{m($),M(1),H(""),X(""),c("chat-logs")},B=()=>{c("overview"),m(null),y(null),H(""),X("")},ue=()=>{H(O),M(1)},Q=()=>{X(""),H(""),M(1)},_e=async($,z)=>{try{ge(!0),je(!0);const G=await Pk($,z);me(G)}catch(G){console.error("加载计划详情失败:",G)}finally{ge(!1)}},he=$=>{P(Number($)),M(1)},Te=()=>{const $=parseInt(E),z=j?Math.ceil(j.total/j.page_size):0;!isNaN($)&&$>=1&&$<=z&&(M($),C(""))},V=j?Math.ceil(j.total/j.page_size):0;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-4",children:r==="overview"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Ce,{children:[e.jsxs(De,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"聊天数量"}),e.jsx(Ba,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Ae,{children:g?e.jsx(As,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_chats||0})})]}),e.jsxs(Ce,{children:[e.jsxs(De,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"计划总数"}),e.jsx(lx,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Ae,{children:g?e.jsx(As,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_plans||0})})]})]}),e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Ue,{children:"聊天列表"}),e.jsx(fs,{children:"点击查看该聊天的所有计划记录"})]}),e.jsx(Ae,{children:g?e.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:[...Array(6)].map(($,z)=>e.jsx(As,{className:"h-24 w-full"},z))}):f?.chats&&f.chats.length>0?e.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:f.chats.map($=>e.jsxs("div",{className:"border rounded-lg p-4 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>K($),children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ba,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm truncate max-w-[180px]",title:h($.chat_id),children:h($.chat_id)})]}),e.jsx(ke,{variant:"secondary",children:$.plan_count})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["最后活动: ",iN($.latest_timestamp)]})]},$.chat_id))}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无聊天记录"})})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-4 mb-4",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:B,children:[e.jsx(Ua,{className:"h-4 w-4 mr-2"}),"返回聊天列表"]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["当前聊天: ",e.jsx("span",{className:"font-medium",children:d?h(d.chat_id):""}),e.jsx("span",{className:"mx-2",children:"•"}),"共 ",j?.total||0," 条计划记录"]})]}),e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(Ue,{children:"计划执行记录"}),e.jsx(fs,{children:d?h(d.chat_id):""})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ne,{placeholder:"搜索提示词内容...",value:O,onChange:$=>X($.target.value),onKeyDown:$=>$.key==="Enter"&&ue(),className:"w-full sm:w-48"}),e.jsx(_,{variant:"outline",size:"icon",onClick:ue,children:e.jsx(Ut,{className:"h-4 w-4"})}),R&&e.jsx(_,{variant:"ghost",size:"sm",onClick:Q,children:"清除"})]}),e.jsxs(Pe,{value:S.toString(),onValueChange:he,children:[e.jsx(Be,{className:"w-full sm:w-32",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"10",children:"10条/页"}),e.jsx(ee,{value:"20",children:"20条/页"}),e.jsx(ee,{value:"50",children:"50条/页"}),e.jsx(ee,{value:"100",children:"100条/页"})]})]})]})]}),R&&e.jsxs("div",{className:"text-sm text-muted-foreground mt-2",children:["搜索关键词: ",e.jsxs("span",{className:"font-medium",children:['"',R,'"']})]})]}),e.jsx(Ae,{children:b?e.jsx("div",{className:"space-y-2",children:[...Array(5)].map(($,z)=>e.jsx(As,{className:"h-20 w-full"},z))}):j?.data&&j.data.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-2",children:j.data.map($=>e.jsxs("div",{className:"border rounded-lg p-3 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>_e($.chat_id,$.filename),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:Jo($.timestamp)}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsxs(ke,{variant:"secondary",className:"text-xs",children:[$.action_count," 个动作"]}),e.jsxs(ke,{variant:"outline",className:"text-xs",children:[$.total_plan_ms.toFixed(0),"ms"]})]})]}),$.action_types&&$.action_types.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:$.action_types.map((z,G)=>e.jsx(ke,{variant:"outline",className:"text-xs bg-blue-50 dark:bg-blue-950 text-blue-700 dark:text-blue-300 border-blue-200 dark:border-blue-800",children:z},G))}),e.jsx("p",{className:"text-sm line-clamp-2",children:$.reasoning_preview||"无推理内容"})]},$.filename))}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",j.total," 条记录,第 ",A," / ",V," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M(1),disabled:A===1,className:"hidden sm:flex",children:e.jsx(yn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M($=>Math.max(1,$-1)),disabled:A===1,children:e.jsx(Ia,{className:"h-4 w-4"})}),e.jsxs("div",{className:"hidden sm:flex items-center gap-2",children:[e.jsx(ne,{type:"number",min:1,max:V,value:E,onChange:$=>C($.target.value),onKeyDown:$=>$.key==="Enter"&&Te(),placeholder:"跳转",className:"w-20 h-8"}),e.jsx(_,{size:"sm",variant:"outline",onClick:Te,children:"跳转"})]}),e.jsxs("span",{className:"sm:hidden text-sm text-muted-foreground",children:[A,"/",V]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M($=>Math.min(V,$+1)),disabled:A===V,children:e.jsx(ra,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M(V),disabled:A===V,className:"hidden sm:flex",children:e.jsx(wn,{className:"h-4 w-4"})})]})]})]}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无计划记录"})})]})]})}),e.jsx(Js,{open:Ne,onOpenChange:je,children:e.jsxs(qs,{className:"max-w-4xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(Vs,{children:[e.jsxs(Gs,{className:"flex items-center gap-2",children:[e.jsx(La,{className:"h-5 w-5"}),"计划执行详情"]}),e.jsx(nt,{children:"查看麦麦的详细计划推理过程和执行动作"})]}),e.jsx(ss,{className:"h-full pr-4",children:e.jsx("div",{className:"space-y-6 pb-4",children:ce?e.jsx("div",{className:"space-y-4",children:[...Array(5)].map(($,z)=>e.jsx(As,{className:"h-24 w-full"},z))}):L?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(ia,{className:"h-4 w-4"}),"基本信息"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4 bg-muted/50 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),e.jsx("div",{className:"text-sm",title:L.chat_id,children:h(L.chat_id)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"时间戳"}),e.jsx("div",{className:"text-sm",children:Jo(L.timestamp)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"类型"}),e.jsx(ke,{variant:"outline",children:L.type})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"动作数量"}),e.jsxs(ke,{children:[L.actions.length," 个动作"]})]})]})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(el,{className:"h-4 w-4"}),"性能统计"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs(Ce,{children:[e.jsx(De,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"提示词构建"})}),e.jsx(Ae,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.prompt_build_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Ce,{children:[e.jsx(De,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"LLM 推理"})}),e.jsx(Ae,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.llm_duration_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Ce,{children:[e.jsx(De,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"总计划时间"})}),e.jsx(Ae,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.total_plan_ms?.toFixed(2)||0,"ms"]})})]})]})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(dx,{className:"h-4 w-4"}),"推理过程"]}),e.jsx("div",{className:"p-4 bg-muted/50 rounded-lg",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:L.reasoning||"无推理内容"})})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(sv,{className:"h-4 w-4"}),"执行动作 (",L.actions.length,")"]}),e.jsx("div",{className:"space-y-3",children:L.actions.map(($,z)=>e.jsxs(Ce,{children:[e.jsx(De,{className:"p-4 pb-3",children:e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(ke,{variant:"default",children:["动作 ",z+1]}),e.jsx(ke,{variant:"outline",children:$.action_type})]})})}),e.jsxs(Ae,{className:"p-4 pt-0 space-y-3",children:[$.reasoning&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"推理依据"}),e.jsx("p",{className:"text-sm bg-muted/30 p-2 rounded",children:typeof $.reasoning=="string"?$.reasoning:JSON.stringify($.reasoning)})]}),$.action_message&&e.jsxs("div",{className:"overflow-hidden",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"动作消息"}),typeof $.action_message=="string"?e.jsx("p",{className:"text-sm bg-muted/30 p-2 rounded break-all whitespace-pre-wrap",children:$.action_message}):e.jsx("pre",{className:"text-xs bg-muted/30 p-2 rounded overflow-x-auto whitespace-pre-wrap break-all",children:JSON.stringify($.action_message,null,2)})]}),$.action_data&&Object.keys($.action_data).length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"动作数据"}),e.jsx("pre",{className:"text-xs bg-muted/30 p-2 rounded overflow-x-auto",children:JSON.stringify($.action_data,null,2)})]}),$.action_reasoning&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"动作推理"}),e.jsx("p",{className:"text-sm bg-muted/30 p-2 rounded",children:typeof $.action_reasoning=="string"?$.action_reasoning:JSON.stringify($.action_reasoning)})]})]})]},z))})]}),e.jsx(la,{}),L.raw_output&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"原始输出"}),e.jsxs("details",{className:"group",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-muted-foreground hover:text-foreground",children:"点击展开查看完整原始输出"}),e.jsx("div",{className:"mt-2 p-4 bg-muted/50 rounded-lg",children:e.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words",children:L.raw_output})})]})]}),L.prompt&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"完整提示词"}),e.jsxs("details",{className:"group",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-muted-foreground hover:text-foreground",children:"点击展开查看完整提示词"}),e.jsx("div",{className:"mt-2 p-4 bg-muted/50 rounded-lg",children:e.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words",children:L.prompt})})]})]})]}):e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("p",{className:"text-muted-foreground",children:"无数据"})})})}),e.jsx(xt,{className:"flex-shrink-0",children:e.jsx(_,{onClick:()=>je(!1),children:"关闭"})})]})})]})}function Gk({autoRefresh:a,refreshKey:l}){const[r,c]=u.useState("overview"),[d,m]=u.useState(null),{getChatName:h}=rN(),[f,p]=u.useState(null),[g,N]=u.useState(!0),[j,y]=u.useState(null),[b,w]=u.useState(!1),[A,M]=u.useState(1),[S,P]=u.useState(20),[E,C]=u.useState(""),[R,H]=u.useState(""),[O,X]=u.useState(""),[L,me]=u.useState(null),[Ne,je]=u.useState(!1),[ce,ge]=u.useState(!1),pe=u.useCallback(async()=>{try{N(!0);const $=await Fk();p($)}catch($){console.error("加载回复器总览失败:",$)}finally{N(!1)}},[]),D=u.useCallback(async()=>{if(d)try{w(!0);const $=await Hk(d.chat_id,A,S,R||void 0);y($)}catch($){console.error("加载聊天日志失败:",$)}finally{w(!1)}},[d,A,S,R]);u.useEffect(()=>{pe()},[pe]),u.useEffect(()=>{l>0&&(r==="overview"?pe():D())},[l,r,pe,D]),u.useEffect(()=>{r==="chat-logs"&&d&&D()},[r,d,D]),cN(a,u.useCallback(()=>{r==="overview"?pe():D()},[r,pe,D]));const K=$=>{m($),M(1),H(""),X(""),c("chat-logs")},B=()=>{c("overview"),m(null),y(null),H(""),X("")},ue=()=>{H(O),M(1)},Q=()=>{X(""),H(""),M(1)},_e=async($,z)=>{try{ge(!0),je(!0);const G=await qk($,z);me(G)}catch(G){console.error("加载回复详情失败:",G)}finally{ge(!1)}},he=$=>{P(Number($)),M(1)},Te=()=>{const $=parseInt(E),z=j?Math.ceil(j.total/j.page_size):0;!isNaN($)&&$>=1&&$<=z&&(M($),C(""))},V=j?Math.ceil(j.total/j.page_size):0;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-4",children:r==="overview"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Ce,{children:[e.jsxs(De,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"聊天数量"}),e.jsx(Ba,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Ae,{children:g?e.jsx(As,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_chats||0})})]}),e.jsxs(Ce,{children:[e.jsxs(De,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"回复总数"}),e.jsx(lx,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Ae,{children:g?e.jsx(As,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_replies||0})})]})]}),e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Ue,{children:"聊天列表"}),e.jsx(fs,{children:"点击查看该聊天的所有回复记录"})]}),e.jsx(Ae,{children:g?e.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:[...Array(6)].map(($,z)=>e.jsx(As,{className:"h-24 w-full"},z))}):f?.chats&&f.chats.length>0?e.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:f.chats.map($=>e.jsxs("div",{className:"border rounded-lg p-4 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>K($),children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ba,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm truncate max-w-[180px]",title:h($.chat_id),children:h($.chat_id)})]}),e.jsx(ke,{variant:"secondary",children:$.reply_count})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["最后活动: ",iN($.latest_timestamp)]})]},$.chat_id))}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无聊天记录"})})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-4 mb-4",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:B,children:[e.jsx(Ua,{className:"h-4 w-4 mr-2"}),"返回聊天列表"]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["当前聊天: ",e.jsx("span",{className:"font-medium",children:d?h(d.chat_id):""}),e.jsx("span",{className:"mx-2",children:"•"}),"共 ",j?.total||0," 条回复记录"]})]}),e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(Ue,{children:"回复生成记录"}),e.jsx(fs,{children:d?h(d.chat_id):""})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ne,{placeholder:"搜索提示词内容...",value:O,onChange:$=>X($.target.value),onKeyDown:$=>$.key==="Enter"&&ue(),className:"w-full sm:w-48"}),e.jsx(_,{variant:"outline",size:"icon",onClick:ue,children:e.jsx(Ut,{className:"h-4 w-4"})}),R&&e.jsx(_,{variant:"ghost",size:"sm",onClick:Q,children:"清除"})]}),e.jsxs(Pe,{value:S.toString(),onValueChange:he,children:[e.jsx(Be,{className:"w-full sm:w-32",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"10",children:"10条/页"}),e.jsx(ee,{value:"20",children:"20条/页"}),e.jsx(ee,{value:"50",children:"50条/页"}),e.jsx(ee,{value:"100",children:"100条/页"})]})]})]})]}),R&&e.jsxs("div",{className:"text-sm text-muted-foreground mt-2",children:["搜索关键词: ",e.jsxs("span",{className:"font-medium",children:['"',R,'"']})]})]}),e.jsx(Ae,{children:b?e.jsx("div",{className:"space-y-2",children:[...Array(5)].map(($,z)=>e.jsx(As,{className:"h-20 w-full"},z))}):j?.data&&j.data.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-2",children:j.data.map($=>e.jsxs("div",{className:"border rounded-lg p-3 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>_e($.chat_id,$.filename),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:Jo($.timestamp)}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[$.success?e.jsxs(ke,{variant:"default",className:"text-xs bg-green-600",children:[e.jsx(Sg,{className:"h-3 w-3 mr-1"}),"成功"]}):e.jsxs(ke,{variant:"destructive",className:"text-xs",children:[e.jsx(ta,{className:"h-3 w-3 mr-1"}),"失败"]}),e.jsx(ke,{variant:"outline",className:"text-xs",children:$.model}),e.jsxs(ke,{variant:"secondary",className:"text-xs",children:[$.overall_ms.toFixed(0),"ms"]})]})]}),e.jsx("p",{className:"text-sm line-clamp-2",children:$.output_preview||"无输出内容"})]},$.filename))}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",j.total," 条记录,第 ",A," / ",V," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M(1),disabled:A===1,className:"hidden sm:flex",children:e.jsx(yn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M($=>Math.max(1,$-1)),disabled:A===1,children:e.jsx(Ia,{className:"h-4 w-4"})}),e.jsxs("div",{className:"hidden sm:flex items-center gap-2",children:[e.jsx(ne,{type:"number",min:1,max:V,value:E,onChange:$=>C($.target.value),onKeyDown:$=>$.key==="Enter"&&Te(),placeholder:"跳转",className:"w-20 h-8"}),e.jsx(_,{size:"sm",variant:"outline",onClick:Te,children:"跳转"})]}),e.jsxs("span",{className:"sm:hidden text-sm text-muted-foreground",children:[A,"/",V]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M($=>Math.min(V,$+1)),disabled:A===V,children:e.jsx(ra,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M(V),disabled:A===V,className:"hidden sm:flex",children:e.jsx(wn,{className:"h-4 w-4"})})]})]})]}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无回复记录"})})]})]})}),e.jsx(Js,{open:Ne,onOpenChange:je,children:e.jsxs(qs,{className:"max-w-4xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(Vs,{children:[e.jsxs(Gs,{className:"flex items-center gap-2",children:[e.jsx(La,{className:"h-5 w-5"}),"回复生成详情"]}),e.jsx(nt,{children:"查看麦麦的详细回复生成过程"})]}),e.jsx(ss,{className:"h-full pr-4",children:e.jsx("div",{className:"space-y-6 pb-4",children:ce?e.jsx("div",{className:"space-y-4",children:[...Array(5)].map(($,z)=>e.jsx(As,{className:"h-24 w-full"},z))}):L?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(ia,{className:"h-4 w-4"}),"基本信息"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4 bg-muted/50 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),e.jsx("div",{className:"text-sm",title:L.chat_id,children:h(L.chat_id)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"时间戳"}),e.jsx("div",{className:"text-sm",children:Jo(L.timestamp)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"状态"}),L.success?e.jsxs(ke,{variant:"default",className:"bg-green-600",children:[e.jsx(Sg,{className:"h-3 w-3 mr-1"}),"成功"]}):e.jsxs(ke,{variant:"destructive",children:[e.jsx(ta,{className:"h-3 w-3 mr-1"}),"失败"]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"思考深度"}),e.jsxs(ke,{variant:"outline",children:["Level ",L.think_level]})]})]})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(B1,{className:"h-4 w-4"}),"模型信息"]}),e.jsx("div",{className:"p-4 bg-muted/50 rounded-lg",children:e.jsx(ke,{variant:"secondary",className:"text-sm",children:L.model})})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(el,{className:"h-4 w-4"}),"性能统计"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs(Ce,{children:[e.jsx(De,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"提示词构建"})}),e.jsx(Ae,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.prompt_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Ce,{children:[e.jsx(De,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"LLM 推理"})}),e.jsx(Ae,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.llm_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Ce,{children:[e.jsx(De,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"总耗时"})}),e.jsx(Ae,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.overall_ms?.toFixed(2)||0,"ms"]})})]})]}),L.timing.timing_logs&&L.timing.timing_logs.length>0&&e.jsxs("div",{className:"mt-3 p-3 bg-muted/30 rounded-lg",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-2",children:"耗时详情"}),e.jsx("div",{className:"space-y-1",children:L.timing.timing_logs.map(($,z)=>e.jsx("div",{className:"text-xs text-muted-foreground",children:$},z))})]}),L.timing.almost_zero&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"近乎零耗时: "}),L.timing.almost_zero]})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(dx,{className:"h-4 w-4"}),"回复输出"]}),e.jsx("div",{className:"p-4 bg-muted/50 rounded-lg",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:L.output||"无输出内容"})})]}),L.processed_output&&L.processed_output.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"处理后的输出"}),e.jsx("div",{className:"space-y-2",children:L.processed_output.map(($,z)=>e.jsx("div",{className:"p-3 bg-muted/30 rounded-lg",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:$})},z))})]})]}),L.reasoning&&e.jsxs(e.Fragment,{children:[e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"推理过程"}),e.jsx("div",{className:"p-4 bg-muted/50 rounded-lg",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:L.reasoning})})]})]}),L.error&&e.jsxs(e.Fragment,{children:[e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold text-destructive",children:"错误信息"}),e.jsx("div",{className:"p-4 bg-destructive/10 rounded-lg border border-destructive/20",children:e.jsx("p",{className:"text-sm text-destructive whitespace-pre-wrap",children:L.error})})]})]}),L.prompt&&e.jsxs(e.Fragment,{children:[e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"完整提示词"}),e.jsxs("details",{className:"group",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-muted-foreground hover:text-foreground",children:"点击展开查看完整提示词"}),e.jsx("div",{className:"mt-2 p-4 bg-muted/50 rounded-lg",children:e.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words",children:L.prompt})})]})]})]})]}):e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("p",{className:"text-muted-foreground",children:"无数据"})})})}),e.jsx(xt,{className:"flex-shrink-0",children:e.jsx(_,{onClick:()=>je(!1),children:"关闭"})})]})})]})}function Kk(){const[a,l]=u.useState("planner"),[r,c]=u.useState(!1),[d,m]=u.useState(0),h=u.useCallback(()=>{m(f=>f+1)},[]);return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"计划器 & 回复器监控"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"实时监控麦麦的任务计划器和回复生成器运行状态"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(_,{variant:r?"default":"outline",size:"sm",onClick:()=>c(!r),children:[e.jsx(ut,{className:`h-4 w-4 mr-2 ${r?"animate-spin":""}`}),r?"自动刷新中":"自动刷新"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:h,children:e.jsx(ut,{className:"h-4 w-4"})})]})]}),e.jsxs(Yt,{value:a,onValueChange:f=>l(f),className:"w-full",children:[e.jsxs(Vt,{className:"grid w-full grid-cols-2 gap-0.5 sm:gap-1 h-auto p-1",children:[e.jsxs(Ye,{value:"planner",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(ax,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"计划器监控"})]}),e.jsxs(Ye,{value:"replier",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(I1,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"回复器监控"})]})]}),e.jsxs(ss,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[e.jsx(Ms,{value:"planner",className:"mt-0",children:e.jsx(Vk,{autoRefresh:r,refreshKey:d})}),e.jsx(Ms,{value:"replier",className:"mt-0",children:e.jsx(Gk,{autoRefresh:r,refreshKey:d})})]})]})]})}const Qk="Mai-with-u",Yk="plugin-repo",Jk="main",Xk="plugin_details.json";async function Zk(){try{const a=await Se("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:Qk,repo:Yk,branch:Jk,file_path:Xk})});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);const l=await a.json();if(!l.success||!l.data)throw new Error(l.error||"获取插件列表失败");return JSON.parse(l.data).filter(d=>!d?.id||!d?.manifest?(console.warn("跳过无效插件数据:",d),!1):!d.manifest.name||!d.manifest.version?(console.warn("跳过缺少必需字段的插件:",d.id),!1):!0).map(d=>({id:d.id,manifest:{manifest_version:d.manifest.manifest_version||1,name:d.manifest.name,version:d.manifest.version,description:d.manifest.description||"",author:d.manifest.author||{name:"Unknown"},license:d.manifest.license||"Unknown",host_application:d.manifest.host_application||{min_version:"0.0.0"},homepage_url:d.manifest.homepage_url,repository_url:d.manifest.repository_url,keywords:d.manifest.keywords||[],categories:d.manifest.categories||[],default_locale:d.manifest.default_locale||"zh-CN",locales_path:d.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(a){throw console.error("Failed to fetch plugin list:",a),a}}async function oN(){try{const a=await Se("/api/webui/plugins/git-status");if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return await a.json()}catch(a){return console.error("Failed to check Git status:",a),{installed:!1,error:"无法检测 Git 安装状态"}}}async function dN(){try{const a=await Se("/api/webui/plugins/version");if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return await a.json()}catch(a){return console.error("Failed to get Maimai version:",a),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function uN(a,l,r){const c=a.split(".").map(f=>parseInt(f)||0),d=c[0]||0,m=c[1]||0,h=c[2]||0;if(r.version_majorparseInt(j)||0),p=f[0]||0,g=f[1]||0,N=f[2]||0;if(r.version_major>p||r.version_major===p&&r.version_minor>g||r.version_major===p&&r.version_minor===g&&r.version_patch>N)return!1}return!0}async function Wk(){try{const a=await Se("/api/webui/ws-token");if(!a.ok)return console.error("获取 WebSocket token 失败:",a.status),null;const l=await a.json();return l.success&&l.token?l.token:null}catch(a){return console.error("获取 WebSocket token 失败:",a),null}}async function eC(a,l){const r=await Wk();if(!r)return console.warn("无法获取 WebSocket token,可能未登录"),null;const c=window.location.protocol==="https:"?"wss:":"ws:",d=window.location.host,m=`${c}//${d}/api/webui/ws/plugin-progress?token=${encodeURIComponent(r)}`;try{const h=new WebSocket(m);return h.onopen=()=>{console.log("Plugin progress WebSocket connected");const f=setInterval(()=>{h.readyState===WebSocket.OPEN?h.send("ping"):clearInterval(f)},3e4)},h.onmessage=f=>{try{if(f.data==="pong")return;const p=JSON.parse(f.data);a(p)}catch(p){console.error("Failed to parse progress data:",p)}},h.onerror=f=>{console.error("Plugin progress WebSocket error:",f),l?.(f)},h.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},h}catch(h){return console.error("创建 WebSocket 连接失败:",h),null}}async function Ll(){try{const a=await Se("/api/webui/plugins/installed",{headers:Ws()});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);const l=await a.json();if(!l.success)throw new Error(l.message||"获取已安装插件列表失败");return l.plugins||[]}catch(a){return console.error("Failed to get installed plugins:",a),[]}}function gn(a,l){return l.some(r=>r.id===a)}function jn(a,l){const r=l.find(c=>c.id===a);if(r)return r.manifest?.version||r.version}async function mN(a,l,r="main"){const c=await Se("/api/webui/plugins/install",{method:"POST",body:JSON.stringify({plugin_id:a,repository_url:l,branch:r})});if(!c.ok){const d=await c.json();throw new Error(d.detail||"安装失败")}return await c.json()}async function xN(a){const l=await Se("/api/webui/plugins/uninstall",{method:"POST",body:JSON.stringify({plugin_id:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"卸载失败")}return await l.json()}async function hN(a,l,r="main"){const c=await Se("/api/webui/plugins/update",{method:"POST",body:JSON.stringify({plugin_id:a,repository_url:l,branch:r})});if(!c.ok){const d=await c.json();throw new Error(d.detail||"更新失败")}return await c.json()}async function sC(a){const l=await Se(`/api/webui/plugins/config/${a}/schema`,{headers:Ws()});if(!l.ok){const c=await l.text();try{const d=JSON.parse(c);throw new Error(d.detail||"获取配置 Schema 失败")}catch{throw new Error(`获取配置 Schema 失败 (${l.status})`)}}const r=await l.json();if(!r.success)throw new Error(r.message||"获取配置 Schema 失败");return r.schema}async function tC(a){const l=await Se(`/api/webui/plugins/config/${a}`,{headers:Ws()});if(!l.ok){const c=await l.text();try{const d=JSON.parse(c);throw new Error(d.detail||"获取配置失败")}catch{throw new Error(`获取配置失败 (${l.status})`)}}const r=await l.json();if(!r.success)throw new Error(r.message||"获取配置失败");return r.config}async function aC(a){const l=await Se(`/api/webui/plugins/config/${a}/raw`,{headers:Ws()});if(!l.ok){const c=await l.text();try{const d=JSON.parse(c);throw new Error(d.detail||"获取配置失败")}catch{throw new Error(`获取配置失败 (${l.status})`)}}const r=await l.json();if(!r.success)throw new Error(r.message||"获取配置失败");return r.config}async function lC(a,l){const r=await Se(`/api/webui/plugins/config/${a}`,{method:"PUT",headers:Ws(),body:JSON.stringify({config:l})});if(!r.ok){const c=await r.json();throw new Error(c.detail||"保存配置失败")}return await r.json()}async function nC(a,l){const r=await Se(`/api/webui/plugins/config/${a}/raw`,{method:"PUT",headers:Ws(),body:JSON.stringify({config:l})});if(!r.ok){const c=await r.json();throw new Error(c.detail||"保存配置失败")}return await r.json()}async function rC(a){const l=await Se(`/api/webui/plugins/config/${a}/reset`,{method:"POST",headers:Ws()});if(!l.ok){const r=await l.json();throw new Error(r.detail||"重置配置失败")}return await l.json()}async function iC(a){const l=await Se(`/api/webui/plugins/config/${a}/toggle`,{method:"POST",headers:Ws()});if(!l.ok){const r=await l.json();throw new Error(r.detail||"切换状态失败")}return await l.json()}const jc="https://maibot-plugin-stats.maibot-webui.workers.dev";async function fN(a){try{const l=await fetch(`${jc}/stats/${a}`);return l.ok?await l.json():(console.error("Failed to fetch plugin stats:",l.statusText),null)}catch(l){return console.error("Error fetching plugin stats:",l),null}}async function cC(a,l){try{const r=l||kx(),c=await fetch(`${jc}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:a,user_id:r})}),d=await c.json();return c.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:c.ok?{success:!0,...d}:{success:!1,error:d.error||"点赞失败"}}catch(r){return console.error("Error liking plugin:",r),{success:!1,error:"网络错误"}}}async function oC(a,l){try{const r=l||kx(),c=await fetch(`${jc}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:a,user_id:r})}),d=await c.json();return c.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:c.ok?{success:!0,...d}:{success:!1,error:d.error||"点踩失败"}}catch(r){return console.error("Error disliking plugin:",r),{success:!1,error:"网络错误"}}}async function dC(a,l,r,c){if(l<1||l>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const d=c||kx(),m=await fetch(`${jc}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:a,rating:l,comment:r,user_id:d})}),h=await m.json();return m.status===429?{success:!1,error:"每天最多评分 3 次"}:m.ok?{success:!0,...h}:{success:!1,error:h.error||"评分失败"}}catch(d){return console.error("Error rating plugin:",d),{success:!1,error:"网络错误"}}}async function pN(a){try{const l=await fetch(`${jc}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:a})}),r=await l.json();return l.status===429?(console.warn("Download recording rate limited"),{success:!0}):l.ok?{success:!0,...r}:(console.error("Failed to record download:",r.error),{success:!1,error:r.error})}catch(l){return console.error("Error recording download:",l),{success:!1,error:"网络错误"}}}function uC(){const a=navigator,l=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,a.deviceMemory||0].join("|");let r=0;for(let c=0;c{const Z=J.map(async Ee=>{try{const de=await fN(Ee.id);return{id:Ee.id,stats:de}}catch(de){return console.warn(`Failed to load stats for ${Ee.id}:`,de),{id:Ee.id,stats:null}}}),Le=await Promise.all(Z),ae={};Le.forEach(({id:Ee,stats:de})=>{de&&(ae[Ee]=de)}),L(ae)};u.useEffect(()=>{let J=null,Z=!1;return(async()=>{if(J=await eC(ae=>{Z||(C(ae),ae.stage==="success"?setTimeout(()=>{Z||C(null)},2e3):ae.stage==="error"&&(w(!1),M(ae.error||"加载失败")))},ae=>{console.error("WebSocket error:",ae),Z||he({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(ae=>{if(!J){ae();return}const Ee=()=>{J&&J.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),ae()):J&&J.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),ae()):setTimeout(Ee,100)};Ee()}),!Z){const ae=await oN();P(ae),ae.installed||he({title:"Git 未安装",description:ae.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!Z){const ae=await dN();H(ae)}if(!Z)try{w(!0),M(null);const ae=await Zk();if(!Z){const Ee=await Ll();O(Ee);const de=ae.map(ze=>{const ws=gn(ze.id,Ee),Zs=jn(ze.id,Ee);return{...ze,installed:ws,installed_version:Zs}});for(const ze of Ee)!de.some(Zs=>Zs.id===ze.id)&&ze.manifest&&de.push({id:ze.id,manifest:{manifest_version:ze.manifest.manifest_version||1,name:ze.manifest.name,version:ze.manifest.version,description:ze.manifest.description||"",author:ze.manifest.author,license:ze.manifest.license||"Unknown",host_application:ze.manifest.host_application,homepage_url:ze.manifest.homepage_url,repository_url:ze.manifest.repository_url,keywords:ze.manifest.keywords||[],categories:ze.manifest.categories||[],default_locale:ze.manifest.default_locale||"zh-CN",locales_path:ze.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:ze.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});y(de),Te(de)}}catch(ae){if(!Z){const Ee=ae instanceof Error?ae.message:"加载插件列表失败";M(Ee),he({title:"加载失败",description:Ee,variant:"destructive"})}}finally{Z||w(!1)}})(),()=>{Z=!0,J&&J.close()}},[he]);const V=J=>{if(!J.installed&&R&&!$(J))return e.jsxs(ke,{variant:"destructive",className:"gap-1",children:[e.jsx(Rt,{className:"h-3 w-3"}),"不兼容"]});if(J.installed){const Z=J.installed_version?.trim(),Le=J.manifest.version?.trim();if(Z!==Le){const ae=Z?.split(".").map(Number)||[0,0,0],Ee=Le?.split(".").map(Number)||[0,0,0];for(let de=0;de<3;de++){if((Ee[de]||0)>(ae[de]||0))return e.jsxs(ke,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[e.jsx(Rt,{className:"h-3 w-3"}),"可更新"]});if((Ee[de]||0)<(ae[de]||0))break}}return e.jsxs(ke,{variant:"default",className:"gap-1",children:[e.jsx(tt,{className:"h-3 w-3"}),"已安装"]})}return null},$=J=>!R||!J.manifest?.host_application?!0:uN(J.manifest.host_application.min_version,J.manifest.host_application.max_version,R),z=J=>{if(!J.installed||!J.installed_version||!J.manifest?.version)return!1;const Z=J.installed_version.trim(),Le=J.manifest.version.trim();if(Z===Le)return!1;const ae=Z.split(".").map(Number),Ee=Le.split(".").map(Number);for(let de=0;de<3;de++){if((Ee[de]||0)>(ae[de]||0))return!0;if((Ee[de]||0)<(ae[de]||0))return!1}return!1},G=j.filter(J=>{if(!J.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",J.id),!1;const Z=c===""||J.manifest.name?.toLowerCase().includes(c.toLowerCase())||J.manifest.description?.toLowerCase().includes(c.toLowerCase())||J.manifest.keywords&&J.manifest.keywords.some(de=>de.toLowerCase().includes(c.toLowerCase())),Le=m==="all"||J.manifest.categories&&J.manifest.categories.includes(m);let ae=!0;f==="installed"?ae=J.installed===!0:f==="updates"&&(ae=J.installed===!0&&z(J));const Ee=!g||!R||$(J);return Z&&Le&&ae&&Ee}),Re=J=>{if(!S?.installed){he({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(R&&!$(J)){he({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}ce(J),pe("main"),K(""),ue("preset"),_e(!1),Ne(!0)},se=async()=>{if(!je)return;const J=B==="custom"?D:ge;if(!J||J.trim()===""){he({title:"分支名称不能为空",variant:"destructive"});return}try{Ne(!1),await mN(je.id,je.manifest.repository_url||"",J),pN(je.id).catch(Le=>{console.warn("Failed to record download:",Le)}),he({title:"安装成功",description:`${je.manifest.name} 已成功安装`});const Z=await Ll();O(Z),y(Le=>Le.map(ae=>{if(ae.id===je.id){const Ee=gn(ae.id,Z),de=jn(ae.id,Z);return{...ae,installed:Ee,installed_version:de}}return ae}))}catch(Z){he({title:"安装失败",description:Z instanceof Error?Z.message:"未知错误",variant:"destructive"})}finally{ce(null)}},Oe=async J=>{try{await xN(J.id),he({title:"卸载成功",description:`${J.manifest.name} 已成功卸载`});const Z=await Ll();O(Z),y(Le=>Le.map(ae=>{if(ae.id===J.id){const Ee=gn(ae.id,Z),de=jn(ae.id,Z);return{...ae,installed:Ee,installed_version:de}}return ae}))}catch(Z){he({title:"卸载失败",description:Z instanceof Error?Z.message:"未知错误",variant:"destructive"})}},ns=async J=>{if(!S?.installed){he({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const Z=await hN(J.id,J.manifest.repository_url||"","main");he({title:"更新成功",description:`${J.manifest.name} 已从 ${Z.old_version} 更新到 ${Z.new_version}`});const Le=await Ll();O(Le),y(ae=>ae.map(Ee=>{if(Ee.id===J.id){const de=gn(Ee.id,Le),ze=jn(Ee.id,Le);return{...Ee,installed:de,installed_version:ze}}return Ee}))}catch(Z){he({title:"更新失败",description:Z instanceof Error?Z.message:"未知错误",variant:"destructive"})}};return e.jsx(ss,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(_,{variant:"outline",onClick:()=>l(),disabled:r,children:[e.jsx(uv,{className:`h-4 w-4 mr-2 ${r?"animate-spin":""}`}),"重启麦麦"]}),e.jsxs(_,{onClick:()=>a({to:"/plugin-mirrors"}),children:[e.jsx(P1,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]})]}),e.jsx(Ce,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:e.jsx(Ae,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Qt,{className:"h-4 w-4 text-blue-600 flex-shrink-0"}),e.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["安装、卸载或更新插件后,需要",e.jsx("span",{className:"font-semibold",children:"重启麦麦"}),"才能使更改生效"]})]})})}),S&&!S.installed&&e.jsxs(Ce,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[e.jsx(De,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(qt,{className:"h-5 w-5 text-orange-600"}),e.jsxs("div",{children:[e.jsx(Ue,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),e.jsx(fs,{className:"text-orange-800 dark:text-orange-200",children:S.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),e.jsx(Ae,{children:e.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",e.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),e.jsx(Ce,{className:"p-4",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(Ut,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"搜索插件...",value:c,onChange:J=>d(J.target.value),className:"pl-9"})]}),e.jsxs(Pe,{value:m,onValueChange:h,children:[e.jsx(Be,{className:"w-full sm:w-[200px]",children:e.jsx(Fe,{placeholder:"选择分类"})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"all",children:"全部分类"}),e.jsx(ee,{value:"Group Management",children:"群组管理"}),e.jsx(ee,{value:"Entertainment & Interaction",children:"娱乐互动"}),e.jsx(ee,{value:"Utility Tools",children:"实用工具"}),e.jsx(ee,{value:"Content Generation",children:"内容生成"}),e.jsx(ee,{value:"Multimedia",children:"多媒体"}),e.jsx(ee,{value:"External Integration",children:"外部集成"}),e.jsx(ee,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),e.jsx(ee,{value:"Other",children:"其他"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(lt,{id:"compatible-only",checked:g,onCheckedChange:J=>N(J===!0)}),e.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),e.jsx(Yt,{value:f,onValueChange:p,className:"w-full",children:e.jsxs(Vt,{className:"grid w-full grid-cols-3",children:[e.jsxs(Ye,{value:"all",children:["全部插件 (",j.filter(J=>{if(!J.manifest)return!1;const Z=c===""||J.manifest.name?.toLowerCase().includes(c.toLowerCase())||J.manifest.description?.toLowerCase().includes(c.toLowerCase())||J.manifest.keywords&&J.manifest.keywords.some(Ee=>Ee.toLowerCase().includes(c.toLowerCase())),Le=m==="all"||J.manifest.categories&&J.manifest.categories.includes(m),ae=!g||!R||$(J);return Z&&Le&&ae}).length,")"]}),e.jsxs(Ye,{value:"installed",children:["已安装 (",j.filter(J=>{if(!J.manifest)return!1;const Z=c===""||J.manifest.name?.toLowerCase().includes(c.toLowerCase())||J.manifest.description?.toLowerCase().includes(c.toLowerCase())||J.manifest.keywords&&J.manifest.keywords.some(Ee=>Ee.toLowerCase().includes(c.toLowerCase())),Le=m==="all"||J.manifest.categories&&J.manifest.categories.includes(m),ae=!g||!R||$(J);return J.installed&&Z&&Le&&ae}).length,")"]}),e.jsxs(Ye,{value:"updates",children:["可更新 (",j.filter(J=>{if(!J.manifest)return!1;const Z=c===""||J.manifest.name?.toLowerCase().includes(c.toLowerCase())||J.manifest.description?.toLowerCase().includes(c.toLowerCase())||J.manifest.keywords&&J.manifest.keywords.some(Ee=>Ee.toLowerCase().includes(c.toLowerCase())),Le=m==="all"||J.manifest.categories&&J.manifest.categories.includes(m),ae=!g||!R||$(J);return J.installed&&z(J)&&Z&&Le&&ae}).length,")"]})]})}),E&&E.stage==="loading"&&E.operation==="fetch"&&e.jsx(Ce,{className:"p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Fs,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{className:"text-sm font-medium",children:"加载插件列表"})]}),e.jsxs("span",{className:"text-sm font-medium",children:[E.progress,"%"]})]}),e.jsx(er,{value:E.progress,className:"h-2"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:E.message}),E.total_plugins>0&&e.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",E.loaded_plugins," / ",E.total_plugins," 个插件"]})]})}),E&&E.stage==="error"&&E.error&&e.jsx(Ce,{className:"border-destructive bg-destructive/10",children:e.jsx(De,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(qt,{className:"h-5 w-5 text-destructive"}),e.jsxs("div",{children:[e.jsx(Ue,{className:"text-lg text-destructive",children:"加载失败"}),e.jsx(fs,{className:"text-destructive/80",children:E.error})]})]})})}),b?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):A?e.jsx(Ce,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(qt,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:A}),e.jsx(_,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):G.length===0?e.jsx(Ce,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Ut,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:c||m!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:G.map(J=>e.jsxs(Ce,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[e.jsxs(De,{children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx(Ue,{className:"text-xl",children:J.manifest?.name||J.id}),e.jsxs("div",{className:"flex flex-col gap-1",children:[J.manifest?.categories&&J.manifest.categories[0]&&e.jsx(ke,{variant:"secondary",className:"text-xs whitespace-nowrap",children:mC[J.manifest.categories[0]]||J.manifest.categories[0]}),V(J)]})]}),e.jsx(fs,{className:"line-clamp-2",children:J.manifest?.description||"无描述"})]}),e.jsx(Ae,{className:"flex-1",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(na,{className:"h-4 w-4"}),e.jsx("span",{children:(X[J.id]?.downloads??J.downloads??0).toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(fn,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:(X[J.id]?.rating??J.rating??0).toFixed(1)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[J.manifest?.keywords&&J.manifest.keywords.slice(0,3).map(Z=>e.jsx(ke,{variant:"outline",className:"text-xs",children:Z},Z)),J.manifest?.keywords&&J.manifest.keywords.length>3&&e.jsxs(ke,{variant:"outline",className:"text-xs",children:["+",J.manifest.keywords.length-3]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[e.jsxs("div",{children:["v",J.manifest?.version||"unknown"," · ",J.manifest?.author?.name||"Unknown"]}),J.manifest?.host_application&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"支持:"}),e.jsxs("span",{className:"font-medium",children:[J.manifest.host_application.min_version,J.manifest.host_application.max_version?` - ${J.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),e.jsx(id,{className:"pt-4",children:e.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>a({to:"/plugin-detail",search:{pluginId:J.id}}),children:"查看详情"}),J.installed?z(J)?e.jsxs(_,{size:"sm",disabled:!S?.installed,title:S?.installed?void 0:"Git 未安装",onClick:()=>ns(J),children:[e.jsx(ut,{className:"h-4 w-4 mr-1"}),"更新"]}):e.jsxs(_,{variant:"destructive",size:"sm",disabled:!S?.installed,title:S?.installed?void 0:"Git 未安装",onClick:()=>Oe(J),children:[e.jsx(us,{className:"h-4 w-4 mr-1"}),"卸载"]}):e.jsxs(_,{size:"sm",disabled:!S?.installed||E?.operation==="install"||R!==null&&!$(J),title:S?.installed?R!==null&&!$(J)?`不兼容当前版本 (需要 ${J.manifest?.host_application?.min_version||"未知"}${J.manifest?.host_application?.max_version?` - ${J.manifest.host_application.max_version}`:"+"},当前 ${R?.version})`:void 0:"Git 未安装",onClick:()=>Re(J),children:[e.jsx(na,{className:"h-4 w-4 mr-1"}),E?.operation==="install"&&E?.plugin_id===J.id?"安装中...":"安装"]})]})}),E&&(E.stage==="loading"||E.stage==="success"||E.stage==="error")&&E.operation!=="fetch"&&E.plugin_id===J.id&&e.jsx("div",{className:"px-6 pb-4 -mt-2",children:e.jsxs("div",{className:`space-y-2 p-3 rounded-lg border ${E.stage==="success"?"bg-green-50 dark:bg-green-950/20 border-green-200 dark:border-green-900":E.stage==="error"?"bg-red-50 dark:bg-red-950/20 border-red-200 dark:border-red-900":"bg-muted/50"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[E.stage==="loading"?e.jsx(Fs,{className:"h-3 w-3 animate-spin"}):E.stage==="success"?e.jsx(tt,{className:"h-3 w-3 text-green-600"}):e.jsx(Rt,{className:"h-3 w-3 text-red-600"}),e.jsx("span",{className:`text-xs font-medium ${E.stage==="success"?"text-green-700 dark:text-green-300":E.stage==="error"?"text-red-700 dark:text-red-300":""}`,children:E.stage==="loading"?e.jsxs(e.Fragment,{children:[E.operation==="install"&&"正在安装",E.operation==="uninstall"&&"正在卸载",E.operation==="update"&&"正在更新"]}):E.stage==="success"?e.jsxs(e.Fragment,{children:[E.operation==="install"&&"安装完成",E.operation==="uninstall"&&"卸载完成",E.operation==="update"&&"更新完成"]}):e.jsxs(e.Fragment,{children:[E.operation==="install"&&"安装失败",E.operation==="uninstall"&&"卸载失败",E.operation==="update"&&"更新失败"]})})]}),E.stage!=="error"&&e.jsxs("span",{className:`text-xs font-medium ${E.stage==="success"?"text-green-700 dark:text-green-300":""}`,children:[E.progress,"%"]})]}),E.stage!=="error"&&e.jsx(er,{value:E.progress,className:`h-1.5 ${E.stage==="success"?"[&>div]:bg-green-500":""}`}),e.jsx("div",{className:`text-xs ${E.stage==="success"?"text-green-600 dark:text-green-400 truncate":E.stage==="error"?"text-red-600 dark:text-red-400":"text-muted-foreground truncate"}`,children:E.stage==="error"?E.error||E.message||"操作失败":E.message})]})})]},J.id))}),e.jsx(Js,{open:me,onOpenChange:Ne,children:e.jsxs(qs,{children:[e.jsxs(Vs,{children:[e.jsx(Gs,{children:"安装插件"}),e.jsxs(nt,{children:["安装 ",je?.manifest.name]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["版本: ",je?.manifest.version]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["作者: ",typeof je?.manifest.author=="string"?je.manifest.author:je?.manifest.author?.name]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(lt,{id:"advanced-options",checked:Q,onCheckedChange:J=>_e(J)}),e.jsx("label",{htmlFor:"advanced-options",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"高级选项"})]}),Q&&e.jsx("div",{className:"space-y-4 p-4 border rounded-lg",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"分支选择"}),e.jsxs(Yt,{value:B,onValueChange:J=>ue(J),children:[e.jsxs(Vt,{className:"grid w-full grid-cols-2",children:[e.jsx(Ye,{value:"preset",className:"text-xs",children:"预设分支"}),e.jsx(Ye,{value:"custom",className:"text-xs",children:"自定义分支"})]}),B==="preset"&&e.jsx("div",{className:"mt-3",children:e.jsxs(Pe,{value:ge,onValueChange:pe,children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择分支"})}),e.jsxs(Ie,{children:[e.jsx(ee,{value:"main",children:"main (默认)"}),e.jsx(ee,{value:"master",children:"master"}),e.jsx(ee,{value:"dev",children:"dev (开发版)"}),e.jsx(ee,{value:"develop",children:"develop"}),e.jsx(ee,{value:"beta",children:"beta (测试版)"}),e.jsx(ee,{value:"stable",children:"stable (稳定版)"})]})]})}),B==="custom"&&e.jsxs("div",{className:"space-y-2 mt-3",children:[e.jsx("input",{type:"text",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",placeholder:"输入分支名称,例如: feature/new-feature",value:D,onChange:J=>K(J.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"输入 Git 分支名称、标签或提交哈希"})]})]})]})}),!Q&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"将从默认分支 (main) 安装插件"})]}),e.jsxs(xt,{children:[e.jsx(_,{variant:"outline",onClick:()=>Ne(!1),children:"取消"}),e.jsxs(_,{onClick:se,children:[e.jsx(na,{className:"h-4 w-4 mr-2"}),"安装"]})]})]})}),e.jsx(ar,{})]})})}function fC(){return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(mv,{className:"h-8 w-8",strokeWidth:2}),"模型分配预设市场"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"浏览和下载社区共享的模型分配预设配置"})]})})}),e.jsx(ss,{className:"flex-1",children:e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-12rem)]",children:e.jsxs(Ce,{className:"max-w-2xl w-full border-dashed",children:[e.jsxs(De,{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(ua,{className:"h-16 w-16 text-muted-foreground"})}),e.jsx(Ue,{className:"text-2xl",children:"功能开发中"}),e.jsx(fs,{className:"text-base",children:"模型分配预设市场功能正在开发中,敬请期待!"})]}),e.jsx(Ae,{children:e.jsxs("div",{className:"space-y-3 text-sm text-muted-foreground",children:[e.jsx("p",{className:"font-medium text-foreground",children:"📦 即将推出的功能:"}),e.jsxs("ul",{className:"space-y-2 ml-6",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"浏览社区共享的模型分配预设配置"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"一键下载和应用预设配置"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"分享自己的模型分配方案"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"预设配置评分和评论系统"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"根据使用场景智能推荐配置"})]})]})]})})]})})})]})}function pC({field:a,value:l,onChange:r}){const[c,d]=u.useState(!1);switch(a.ui_type){case"switch":return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:a.label}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]}),e.jsx(Ge,{checked:!!l,onCheckedChange:r,disabled:a.disabled})]});case"number":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsx(ne,{type:"number",value:l??a.default,onChange:m=>r(parseFloat(m.target.value)||0),min:a.min,max:a.max,step:a.step??1,placeholder:a.placeholder,disabled:a.disabled}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"slider":return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:a.label}),e.jsx("span",{className:"text-sm text-muted-foreground",children:l??a.default})]}),e.jsx(Wa,{value:[l??a.default],onValueChange:m=>r(m[0]),min:a.min??0,max:a.max??100,step:a.step??1,disabled:a.disabled}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"select":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsxs(Pe,{value:String(l??a.default),onValueChange:r,disabled:a.disabled,children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:a.placeholder??"请选择"})}),e.jsx(Ie,{children:a.choices?.map(m=>e.jsx(ee,{value:String(m),children:String(m)},String(m)))})]}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"textarea":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsx(ft,{value:l??a.default,onChange:m=>r(m.target.value),placeholder:a.placeholder,rows:a.rows??3,disabled:a.disabled}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"password":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsxs("div",{className:"relative",children:[e.jsx(ne,{type:c?"text":"password",value:l??"",onChange:m=>r(m.target.value),placeholder:a.placeholder,disabled:a.disabled,className:"pr-10"}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3",onClick:()=>d(!c),children:c?e.jsx(nc,{className:"h-4 w-4"}):e.jsx(ma,{className:"h-4 w-4"})})]}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"list":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsx(bS,{value:Array.isArray(l)?l:[],onChange:m=>r(m),itemType:a.item_type??"string",itemFields:a.item_fields,minItems:a.min_items,maxItems:a.max_items,disabled:a.disabled,placeholder:a.placeholder}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"text":default:return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsx(ne,{type:"text",value:l??a.default??"",onChange:m=>r(m.target.value),placeholder:a.placeholder,maxLength:a.max_length,disabled:a.disabled}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]})}}function Wg({section:a,config:l,onChange:r}){const[c,d]=u.useState(!a.collapsed),m=Object.entries(a.fields).filter(([,h])=>!h.hidden).sort(([,h],[,f])=>h.order-f.order);return e.jsx(uc,{open:c,onOpenChange:d,children:e.jsxs(Ce,{children:[e.jsx(mc,{asChild:!0,children:e.jsxs(De,{className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[c?e.jsx($a,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ra,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(Ue,{className:"text-lg",children:a.title})]}),e.jsxs(ke,{variant:"secondary",className:"text-xs",children:[m.length," 项"]})]}),a.description&&e.jsx(fs,{className:"ml-6",children:a.description})]})}),e.jsx(xc,{children:e.jsx(Ae,{className:"space-y-4 pt-0",children:m.map(([h,f])=>e.jsx(pC,{field:f,value:l[a.name]?.[h],onChange:p=>r(a.name,h,p),sectionName:a.name},h))})})]})})}function gC({plugin:a,onBack:l}){const{toast:r}=it(),{triggerRestart:c,isRestarting:d}=_n(),[m,h]=u.useState("visual"),[f,p]=u.useState(null),[g,N]=u.useState({}),[j,y]=u.useState({}),[b,w]=u.useState(""),[A,M]=u.useState(""),[S,P]=u.useState(!0),[E,C]=u.useState(!1),[R,H]=u.useState(!1),[O,X]=u.useState(!1),[L,me]=u.useState(!1),Ne=u.useCallback(async()=>{P(!0);try{const[B,ue,Q]=await Promise.all([sC(a.id),tC(a.id),aC(a.id)]);p(B),N(ue),y(JSON.parse(JSON.stringify(ue))),w(Q),M(Q)}catch(B){r({title:"加载配置失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"})}finally{P(!1)}},[a.id,r]);u.useEffect(()=>{Ne()},[Ne]),u.useEffect(()=>{H(m==="visual"?JSON.stringify(g)!==JSON.stringify(j):b!==A)},[g,j,b,A,m]);const je=(B,ue,Q)=>{N(_e=>({..._e,[B]:{..._e[B]||{},[ue]:Q}}))},ce=async()=>{C(!0);try{if(m==="source"){try{Nx(b)}catch(B){X(!0),r({title:"TOML 格式错误",description:B instanceof Error?B.message:"无法解析 TOML 配置,请检查语法",variant:"destructive"}),C(!1);return}await nC(a.id,b),M(b),X(!1)}else await lC(a.id,g),y(JSON.parse(JSON.stringify(g)));r({title:"配置已保存",description:"更改将在插件重新加载后生效"})}catch(B){r({title:"保存失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"})}finally{C(!1)}},ge=async()=>{try{await rC(a.id),r({title:"配置已重置",description:"下次加载插件时将使用默认配置"}),me(!1),Ne()}catch(B){r({title:"重置失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"})}},pe=async()=>{try{const B=await iC(a.id);r({title:B.message,description:B.note}),Ne()}catch(B){r({title:"切换状态失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"})}};if(S)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(!f)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 space-y-4",children:[e.jsx(Rt,{className:"h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"无法加载配置"}),e.jsxs(_,{onClick:l,variant:"outline",children:[e.jsx(Ua,{className:"h-4 w-4 mr-2"}),"返回"]})]});const D=Object.values(f.sections).sort((B,ue)=>B.order-ue.order),K=g.plugin?.enabled!==!1;return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:l,children:e.jsx(Ua,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:f.plugin_info.name||a.manifest.name}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(ke,{variant:K?"default":"secondary",children:K?"已启用":"已禁用"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["v",f.plugin_info.version||a.manifest.version]})]})]})]}),e.jsxs("div",{className:"flex gap-2 ml-10 sm:ml-0",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>h(m==="visual"?"source":"visual"),children:m==="visual"?e.jsxs(e.Fragment,{children:[e.jsx(cv,{className:"h-4 w-4 mr-2"}),"源代码"]}):e.jsxs(e.Fragment,{children:[e.jsx(iv,{className:"h-4 w-4 mr-2"}),"可视化"]})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>c(),disabled:d,children:[e.jsx(uv,{className:`h-4 w-4 mr-2 ${d?"animate-spin":""}`}),"重启麦麦"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:pe,children:[e.jsx(hc,{className:"h-4 w-4 mr-2"}),K?"禁用":"启用"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>me(!0),children:[e.jsx(lc,{className:"h-4 w-4 mr-2"}),"重置"]}),e.jsxs(_,{size:"sm",onClick:ce,disabled:!R||E,children:[E?e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(fc,{className:"h-4 w-4 mr-2"}),"保存"]})]})]}),R&&e.jsx(Ce,{className:"border-orange-200 bg-orange-50 dark:bg-orange-950/20 dark:border-orange-900",children:e.jsx(Ae,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Qt,{className:"h-4 w-4 text-orange-600"}),e.jsx("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:"有未保存的更改"})]})})}),m==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(pt,{children:[e.jsx(Rt,{className:"h-4 w-4"}),e.jsxs(gt,{children:[e.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。保存时会验证格式,只有格式正确才能保存。",O&&e.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),e.jsx(Vv,{value:b,onChange:B=>{w(B),O&&X(!1)},language:"toml",theme:"dark",height:"calc(100vh - 350px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),m==="visual"&&e.jsxs(e.Fragment,{children:[e.jsxs(pt,{children:[e.jsx(Qt,{className:"h-4 w-4"}),e.jsxs(gt,{children:[e.jsx("strong",{children:"提示:"}),"如果插件当前未加载或未启用,WebUI 适配器的高级插件可视化编辑功能可能会不可用。 请确保插件已启用并成功加载后,再进行配置编辑。"]})]}),f.layout.type==="tabs"&&f.layout.tabs.length>0?e.jsxs(Yt,{defaultValue:f.layout.tabs[0]?.id,children:[e.jsx(Vt,{children:f.layout.tabs.map(B=>e.jsxs(Ye,{value:B.id,children:[B.title,B.badge&&e.jsx(ke,{variant:"secondary",className:"ml-2 text-xs",children:B.badge})]},B.id))}),f.layout.tabs.map(B=>e.jsx(Ms,{value:B.id,className:"space-y-4 mt-4",children:B.sections.map(ue=>{const Q=f.sections[ue];return Q?e.jsx(Wg,{section:Q,config:g,onChange:je},ue):null})},B.id))]}):e.jsx("div",{className:"space-y-4",children:D.map(B=>e.jsx(Wg,{section:B,config:g,onChange:je},B.name))})]}),e.jsx(Js,{open:L,onOpenChange:me,children:e.jsxs(qs,{children:[e.jsxs(Vs,{children:[e.jsx(Gs,{children:"确认重置配置"}),e.jsx(nt,{children:"这将删除当前配置文件,下次加载插件时将使用默认配置。此操作不可撤销。"})]}),e.jsxs(xt,{children:[e.jsx(_,{variant:"outline",onClick:()=>me(!1),children:"取消"}),e.jsx(_,{variant:"destructive",onClick:ge,children:"确认重置"})]})]})})]})}function jC(){return e.jsx(tr,{children:e.jsx(vC,{})})}function vC(){const{toast:a}=it(),[l,r]=u.useState([]),[c,d]=u.useState(!0),[m,h]=u.useState(""),[f,p]=u.useState(null),g=async()=>{d(!0);try{const w=await Ll();r(w)}catch(w){a({title:"加载插件列表失败",description:w instanceof Error?w.message:"未知错误",variant:"destructive"})}finally{d(!1)}};u.useEffect(()=>{g()},[]);const j=l.filter(w=>{const A=m.toLowerCase();return w.id.toLowerCase().includes(A)||w.manifest.name.toLowerCase().includes(A)||w.manifest.description?.toLowerCase().includes(A)}).filter((w,A,M)=>A===M.findIndex(S=>S.id===w.id)),y=l.length,b=0;return f?e.jsxs(e.Fragment,{children:[e.jsx(ss,{className:"h-full",children:e.jsx("div",{className:"p-4 sm:p-6",children:e.jsx(gC,{plugin:f,onBack:()=>p(null)})})}),e.jsx(ar,{})]}):e.jsx(ss,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:g,children:[e.jsx(ut,{className:`h-4 w-4 mr-2 ${c?"animate-spin":""}`}),"刷新"]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-3",children:[e.jsxs(Ce,{children:[e.jsxs(De,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"已安装插件"}),e.jsx(ua,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ae,{children:[e.jsx("div",{className:"text-2xl font-bold",children:l.length}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:c?"正在加载...":"个插件"})]})]}),e.jsxs(Ce,{children:[e.jsxs(De,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"已启用"}),e.jsx(tt,{className:"h-4 w-4 text-green-600"})]}),e.jsxs(Ae,{children:[e.jsx("div",{className:"text-2xl font-bold",children:y}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),e.jsxs(Ce,{children:[e.jsxs(De,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"已禁用"}),e.jsx(Rt,{className:"h-4 w-4 text-orange-600"})]}),e.jsxs(Ae,{children:[e.jsx("div",{className:"text-2xl font-bold",children:b}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Ut,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"搜索插件...",value:m,onChange:w=>h(w.target.value),className:"pl-9"})]}),e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Ue,{children:"已安装的插件"}),e.jsx(fs,{children:"点击插件查看和编辑配置"})]}),e.jsx(Ae,{children:c?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):j.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[e.jsx(ua,{className:"h-16 w-16 text-muted-foreground/50"}),e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:m?"没有找到匹配的插件":"暂无已安装的插件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:m?"尝试其他搜索关键词":"前往插件市场安装插件"})]})]}):e.jsx("div",{className:"space-y-2",children:j.map(w=>e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>p(w),children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:e.jsx(ua,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-medium truncate",children:w.manifest.name}),e.jsxs(ke,{variant:"secondary",className:"text-xs flex-shrink-0",children:["v",w.manifest.version]})]}),e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:w.manifest.description||"暂无描述"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(_,{variant:"ghost",size:"sm",children:e.jsx(bn,{className:"h-4 w-4"})}),e.jsx(ra,{className:"h-4 w-4 text-muted-foreground"})]})]},w.id))})})]})]})})}function NC(){const a=xa(),{toast:l}=it(),[r,c]=u.useState([]),[d,m]=u.useState(!0),[h,f]=u.useState(null),[p,g]=u.useState(null),[N,j]=u.useState(!1),[y,b]=u.useState(!1),[w,A]=u.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),M=u.useCallback(async()=>{try{m(!0),f(null);const O=await Se("/api/webui/plugins/mirrors");if(!O.ok)throw new Error("获取镜像源列表失败");const X=await O.json();c(X.mirrors||[])}catch(O){const X=O instanceof Error?O.message:"加载镜像源失败";f(X),l({title:"加载失败",description:X,variant:"destructive"})}finally{m(!1)}},[l]);u.useEffect(()=>{M()},[M]);const S=async()=>{try{const O=await Se("/api/webui/plugins/mirrors",{method:"POST",body:JSON.stringify(w)});if(!O.ok){const X=await O.json();throw new Error(X.detail||"添加镜像源失败")}l({title:"添加成功",description:"镜像源已添加"}),j(!1),A({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),M()}catch(O){l({title:"添加失败",description:O instanceof Error?O.message:"未知错误",variant:"destructive"})}},P=async()=>{if(p)try{if(!(await Se(`/api/webui/plugins/mirrors/${p.id}`,{method:"PUT",body:JSON.stringify({name:w.name,raw_prefix:w.raw_prefix,clone_prefix:w.clone_prefix,enabled:w.enabled,priority:w.priority})})).ok)throw new Error("更新镜像源失败");l({title:"更新成功",description:"镜像源已更新"}),b(!1),g(null),M()}catch(O){l({title:"更新失败",description:O instanceof Error?O.message:"未知错误",variant:"destructive"})}},E=async O=>{if(confirm("确定要删除这个镜像源吗?"))try{if(!(await Se(`/api/webui/plugins/mirrors/${O}`,{method:"DELETE"})).ok)throw new Error("删除镜像源失败");l({title:"删除成功",description:"镜像源已删除"}),M()}catch(X){l({title:"删除失败",description:X instanceof Error?X.message:"未知错误",variant:"destructive"})}},C=async O=>{try{if(!(await Se(`/api/webui/plugins/mirrors/${O.id}`,{method:"PUT",body:JSON.stringify({enabled:!O.enabled})})).ok)throw new Error("更新状态失败");M()}catch(X){l({title:"更新失败",description:X instanceof Error?X.message:"未知错误",variant:"destructive"})}},R=O=>{g(O),A({id:O.id,name:O.name,raw_prefix:O.raw_prefix,clone_prefix:O.clone_prefix,enabled:O.enabled,priority:O.priority}),b(!0)},H=async(O,X)=>{const L=X==="up"?O.priority-1:O.priority+1;if(!(L<1))try{if(!(await Se(`/api/webui/plugins/mirrors/${O.id}`,{method:"PUT",body:JSON.stringify({priority:L})})).ok)throw new Error("更新优先级失败");M()}catch(me){l({title:"更新失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}};return e.jsx(ss,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>a({to:"/plugins"}),children:e.jsx(Ua,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),e.jsxs(_,{onClick:()=>j(!0),children:[e.jsx(at,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),d?e.jsx(Ce,{className:"p-6",children:e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Fs,{className:"h-8 w-8 animate-spin text-primary"})})}):h?e.jsx(Ce,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(qt,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:h}),e.jsx(_,{onClick:M,children:"重新加载"})]})}):e.jsxs(Ce,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(Il,{children:[e.jsx(Pl,{children:e.jsxs(bt,{children:[e.jsx(ls,{children:"状态"}),e.jsx(ls,{children:"名称"}),e.jsx(ls,{children:"ID"}),e.jsx(ls,{children:"优先级"}),e.jsx(ls,{className:"text-right",children:"操作"})]})}),e.jsx(Fl,{children:r.map(O=>e.jsxs(bt,{children:[e.jsx(Je,{children:e.jsx(Ge,{checked:O.enabled,onCheckedChange:()=>C(O)})}),e.jsx(Je,{children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:O.name}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",O.raw_prefix]})]})}),e.jsx(Je,{children:e.jsx(ke,{variant:"outline",children:O.id})}),e.jsx(Je,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono",children:O.priority}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(_,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>H(O,"up"),disabled:O.priority===1,children:e.jsx(Yr,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>H(O,"down"),children:e.jsx($a,{className:"h-3 w-3"})})]})]})}),e.jsx(Je,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>R(O),children:e.jsx(Jn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>E(O.id),children:e.jsx(us,{className:"h-4 w-4 text-destructive"})})]})})]},O.id))})]})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:r.map(O=>e.jsx(Ce,{className:"p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-semibold",children:O.name}),O.enabled&&e.jsx(ke,{variant:"default",className:"text-xs",children:"启用"})]}),e.jsx(ke,{variant:"outline",className:"mt-1 text-xs",children:O.id})]}),e.jsx(Ge,{checked:O.enabled,onCheckedChange:()=>C(O)})]}),e.jsxs("div",{className:"text-sm space-y-1",children:[e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"Raw: "}),e.jsx("span",{className:"break-all",children:O.raw_prefix})]}),e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"优先级: "}),e.jsx("span",{className:"font-mono",children:O.priority})]})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[e.jsxs(_,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>R(O),children:[e.jsx(Jn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>H(O,"up"),disabled:O.priority===1,children:e.jsx(Yr,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>H(O,"down"),children:e.jsx($a,{className:"h-4 w-4"})}),e.jsx(_,{variant:"destructive",size:"sm",onClick:()=>E(O.id),children:e.jsx(us,{className:"h-4 w-4"})})]})]})},O.id))})]}),e.jsx(Js,{open:N,onOpenChange:j,children:e.jsxs(qs,{className:"max-w-lg",children:[e.jsxs(Vs,{children:[e.jsx(Gs,{children:"添加镜像源"}),e.jsx(nt,{children:"添加新的 Git 镜像源配置"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-id",children:"镜像源 ID *"}),e.jsx(ne,{id:"add-id",placeholder:"例如: my-mirror",value:w.id,onChange:O=>A({...w,id:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-name",children:"名称 *"}),e.jsx(ne,{id:"add-name",placeholder:"例如: 我的镜像源",value:w.name,onChange:O=>A({...w,name:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),e.jsx(ne,{id:"add-raw",placeholder:"https://example.com/raw",value:w.raw_prefix,onChange:O=>A({...w,raw_prefix:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-clone",children:"克隆前缀 *"}),e.jsx(ne,{id:"add-clone",placeholder:"https://example.com/clone",value:w.clone_prefix,onChange:O=>A({...w,clone_prefix:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-priority",children:"优先级"}),e.jsx(ne,{id:"add-priority",type:"number",min:"1",value:w.priority,onChange:O=>A({...w,priority:parseInt(O.target.value)||1})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"add-enabled",checked:w.enabled,onCheckedChange:O=>A({...w,enabled:O})}),e.jsx(T,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),e.jsxs(xt,{children:[e.jsx(_,{variant:"outline",onClick:()=>j(!1),children:"取消"}),e.jsx(_,{onClick:S,children:"添加"})]})]})}),e.jsx(Js,{open:y,onOpenChange:b,children:e.jsxs(qs,{className:"max-w-lg",children:[e.jsxs(Vs,{children:[e.jsx(Gs,{children:"编辑镜像源"}),e.jsx(nt,{children:"修改镜像源配置"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"镜像源 ID"}),e.jsx(ne,{value:w.id,disabled:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-name",children:"名称 *"}),e.jsx(ne,{id:"edit-name",value:w.name,onChange:O=>A({...w,name:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),e.jsx(ne,{id:"edit-raw",value:w.raw_prefix,onChange:O=>A({...w,raw_prefix:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-clone",children:"克隆前缀 *"}),e.jsx(ne,{id:"edit-clone",value:w.clone_prefix,onChange:O=>A({...w,clone_prefix:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-priority",children:"优先级"}),e.jsx(ne,{id:"edit-priority",type:"number",min:"1",value:w.priority,onChange:O=>A({...w,priority:parseInt(O.target.value)||1})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"edit-enabled",checked:w.enabled,onCheckedChange:O=>A({...w,enabled:O})}),e.jsx(T,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),e.jsxs(xt,{children:[e.jsx(_,{variant:"outline",onClick:()=>b(!1),children:"取消"}),e.jsx(_,{onClick:P,children:"保存"})]})]})})]})})}function bC({pluginId:a,compact:l=!1}){const[r,c]=u.useState(null),[d,m]=u.useState(!0),[h,f]=u.useState(0),[p,g]=u.useState(""),[N,j]=u.useState(!1),{toast:y}=it(),b=async()=>{m(!0);const S=await fN(a);S&&c(S),m(!1)};u.useEffect(()=>{b()},[a]);const w=async()=>{const S=await cC(a);S.success?(y({title:"已点赞",description:"感谢你的支持!"}),b()):y({title:"点赞失败",description:S.error||"未知错误",variant:"destructive"})},A=async()=>{const S=await oC(a);S.success?(y({title:"已反馈",description:"感谢你的反馈!"}),b()):y({title:"操作失败",description:S.error||"未知错误",variant:"destructive"})},M=async()=>{if(h===0){y({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const S=await dC(a,h,p||void 0);S.success?(y({title:"评分成功",description:"感谢你的评价!"}),j(!1),f(0),g(""),b()):y({title:"评分失败",description:S.error||"未知错误",variant:"destructive"})};return d?e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(na,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(fn,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]})]}):r?l?e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${r.downloads.toLocaleString()}`,children:[e.jsx(na,{className:"h-4 w-4"}),e.jsx("span",{children:r.downloads.toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${r.rating.toFixed(1)} (${r.rating_count} 条评价)`,children:[e.jsx(fn,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:r.rating.toFixed(1)})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${r.likes}`,children:[e.jsx(Em,{className:"h-4 w-4"}),e.jsx("span",{children:r.likes})]})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(na,{className:"h-5 w-5 text-muted-foreground mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:r.downloads.toLocaleString()}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(fn,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),e.jsx("span",{className:"text-2xl font-bold",children:r.rating.toFixed(1)}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.rating_count," 条评价"]})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(Em,{className:"h-5 w-5 text-green-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:r.likes}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(kg,{className:"h-5 w-5 text-red-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:r.dislikes}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:w,children:[e.jsx(Em,{className:"h-4 w-4 mr-1"}),"点赞"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:A,children:[e.jsx(kg,{className:"h-4 w-4 mr-1"}),"点踩"]}),e.jsxs(Js,{open:N,onOpenChange:j,children:[e.jsx(cd,{asChild:!0,children:e.jsxs(_,{variant:"default",size:"sm",children:[e.jsx(fn,{className:"h-4 w-4 mr-1"}),"评分"]})}),e.jsxs(qs,{children:[e.jsxs(Vs,{children:[e.jsx(Gs,{children:"为插件评分"}),e.jsx(nt,{children:"分享你的使用体验,帮助其他用户"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(S=>e.jsx("button",{onClick:()=>f(S),className:"focus:outline-none",children:e.jsx(fn,{className:`h-8 w-8 transition-colors ${S<=h?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},S))}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h===0&&"点击星星进行评分",h===1&&"很差",h===2&&"一般",h===3&&"还行",h===4&&"不错",h===5&&"非常好"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),e.jsx(ft,{value:p,onChange:S=>g(S.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[p.length," / 500"]})]})]}),e.jsxs(xt,{children:[e.jsx(_,{variant:"outline",onClick:()=>j(!1),children:"取消"}),e.jsx(_,{onClick:M,disabled:h===0,children:"提交评分"})]})]})]})]}),r.recent_ratings&&r.recent_ratings.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),e.jsx("div",{className:"space-y-3",children:r.recent_ratings.map((S,P)=>e.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(E=>e.jsx(fn,{className:`h-3 w-3 ${E<=S.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},E))}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(S.created_at).toLocaleDateString()})]}),S.comment&&e.jsx("p",{className:"text-sm text-muted-foreground",children:S.comment})]},P))})]})]}):null}const yC={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function wC(){const a=xa(),l=W0({strict:!1}),{toast:r}=it(),[c,d]=u.useState(null),[m,h]=u.useState(""),[f,p]=u.useState(!0),[g,N]=u.useState(!0),[j,y]=u.useState(null),[b,w]=u.useState(null),[A,M]=u.useState(null),[S,P]=u.useState(!1),[E,C]=u.useState(),[R,H]=u.useState(!1);u.useEffect(()=>{(async()=>{if(!l.pluginId){y("缺少插件 ID"),p(!1);return}try{p(!0),y(null);const ge=await Se("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:"Mai-with-u",repo:"plugin-repo",branch:"main",file_path:"plugin_details.json"})});if(!ge.ok)throw new Error("获取插件列表失败");const pe=await ge.json();if(!pe.success||!pe.data)throw new Error(pe.error||"获取插件列表失败");const K=JSON.parse(pe.data).find(he=>he.id===l.pluginId);if(!K)throw new Error("未找到该插件");const B={id:K.id,manifest:K.manifest,downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()};d(B);const[ue,Q,_e]=await Promise.all([oN(),dN(),Ll()]);w(ue),M(Q),P(gn(l.pluginId,_e)),C(jn(l.pluginId,_e))}catch(ge){y(ge instanceof Error?ge.message:"加载失败")}finally{p(!1)}})()},[l.pluginId]),u.useEffect(()=>{(async()=>{if(!c?.manifest?.repository_url){N(!1);return}try{if(N(!0),S&&l.pluginId)try{const Q=await Se(`/api/webui/plugins/local-readme/${l.pluginId}`);if(Q.ok){const _e=await Q.json();if(_e.success&&_e.data){h(_e.data),N(!1);return}}}catch(Q){console.log("本地 README 获取失败,尝试远程获取:",Q)}const ge=c.manifest.repository_url.match(/github\.com\/([^/]+)\/([^/\s]+)/);if(!ge){h("无法解析仓库地址");return}const[,pe,D]=ge,K=D.replace(/\.git$/,""),B=await Se("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:pe,repo:K,branch:"main",file_path:"README.md"})});if(!B.ok)throw new Error("获取 README 失败");const ue=await B.json();ue.success&&ue.data?h(ue.data):h("该插件暂无 README 文档")}catch(ge){console.error("加载 README 失败:",ge),h("加载 README 失败")}finally{N(!1)}})()},[c,S,l.pluginId]);const O=()=>!c||!S||!E?!1:E!==c.manifest.version,X=()=>!c||!A?!0:uN(c.manifest.host_application.min_version,c.manifest.host_application.max_version,A),L=async()=>{if(!(!c||!b?.installed))try{H(!0),await mN(c.id,c.manifest.repository_url||"","main"),pN(c.id).catch(ge=>{console.warn("Failed to record download:",ge)}),r({title:"安装成功",description:`${c.manifest.name} 已成功安装`});const ce=await Ll();P(gn(c.id,ce)),C(jn(c.id,ce))}catch(ce){r({title:"安装失败",description:ce instanceof Error?ce.message:"未知错误",variant:"destructive"})}finally{H(!1)}},me=async()=>{if(c)try{H(!0),await xN(c.id),r({title:"卸载成功",description:`${c.manifest.name} 已成功卸载`});const ce=await Ll();P(gn(c.id,ce)),C(jn(c.id,ce))}catch(ce){r({title:"卸载失败",description:ce instanceof Error?ce.message:"未知错误",variant:"destructive"})}finally{H(!1)}},Ne=async()=>{if(!(!c||!b?.installed))try{H(!0);const ce=await hN(c.id,c.manifest.repository_url||"","main");r({title:"更新成功",description:`${c.manifest.name} 已从 ${ce.old_version} 更新到 ${ce.new_version}`});const ge=await Ll();P(gn(c.id,ge)),C(jn(c.id,ge))}catch(ce){r({title:"更新失败",description:ce instanceof Error?ce.message:"未知错误",variant:"destructive"})}finally{H(!1)}};if(f)return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>a({to:"/plugins"}),children:e.jsx(Ua,{className:"h-5 w-5"})}),e.jsx("div",{children:e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件详情"})})]}),e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件信息中..."})]})]});if(j||!c)return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>a({to:"/plugins"}),children:e.jsx(Ua,{className:"h-5 w-5"})}),e.jsx("div",{children:e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件详情"})})]}),e.jsx(Ce,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Rt,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:j}),e.jsx(_,{onClick:()=>a({to:"/plugins"}),children:"返回插件列表"})]})})]});const je=X();return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>a({to:"/plugins"}),className:"shrink-0",children:e.jsx(Ua,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件详情"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:c.manifest.name})]})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:S?e.jsxs(e.Fragment,{children:[O()?e.jsx(_,{disabled:!b?.installed||R,onClick:Ne,title:b?.installed?void 0:"Git 未安装",children:R?e.jsxs(e.Fragment,{children:[e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}),"更新中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ut,{className:"h-4 w-4 mr-2"}),"更新"]})}):null,e.jsx(_,{variant:"destructive",disabled:!b?.installed||R,onClick:me,title:b?.installed?void 0:"Git 未安装",children:R?e.jsxs(e.Fragment,{children:[e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}),"卸载中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(us,{className:"h-4 w-4 mr-2"}),"卸载"]})})]}):e.jsx(_,{disabled:!b?.installed||!je||R,onClick:L,title:b?.installed?je?void 0:`不兼容当前版本 (需要 ${c.manifest.host_application.min_version}${c.manifest.host_application.max_version?` - ${c.manifest.host_application.max_version}`:"+"},当前 ${A?.version})`:"Git 未安装",children:R?e.jsxs(e.Fragment,{children:[e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}),"安装中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(na,{className:"h-4 w-4 mr-2"}),"安装"]})})})]}),e.jsx(ss,{className:"h-[calc(100vh-200px)] sm:h-[calc(100vh-220px)]",children:e.jsxs("div",{className:"space-y-6 pr-4",children:[e.jsx(Ce,{children:e.jsx(De,{children:e.jsx("div",{className:"flex items-start justify-between gap-4",children:e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx(Ue,{className:"text-2xl",children:c.manifest.name}),e.jsxs(ke,{variant:"secondary",className:"text-sm",children:["v",c.manifest.version]}),S&&e.jsxs(ke,{variant:"default",className:"text-sm",children:[e.jsx(tt,{className:"h-3 w-3 mr-1"}),"已安装 ",E&&`(v${E})`]}),O()&&e.jsxs(ke,{variant:"outline",className:"text-sm border-orange-500 text-orange-500",children:[e.jsx(ut,{className:"h-3 w-3 mr-1"}),"可更新"]}),!je&&e.jsxs(ke,{variant:"destructive",className:"text-sm",children:[e.jsx(Rt,{className:"h-3 w-3 mr-1"}),"不兼容"]})]}),e.jsx(fs,{className:"text-base",children:c.manifest.description})]})})})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-1 space-y-6",children:[e.jsxs(Ce,{children:[e.jsx(De,{children:e.jsx(Ue,{className:"text-lg",children:"统计信息"})}),e.jsx(Ae,{children:e.jsx(bC,{pluginId:c.id})})]}),e.jsxs(Ce,{children:[e.jsx(De,{children:e.jsx(Ue,{className:"text-lg",children:"基本信息"})}),e.jsx(Ae,{className:"space-y-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx($l,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"作者:"}),e.jsx("span",{className:"font-medium",children:c.manifest.author?.name||"Unknown"}),c.manifest.author?.url&&e.jsx("a",{href:c.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.jsx($o,{className:"h-3 w-3"})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(ua,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"版本:"}),e.jsxs("span",{className:"font-medium",children:["v",c.manifest.version]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(lv,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"许可证:"}),e.jsx("span",{className:"font-medium",children:c.manifest.license})]}),c.manifest.homepage_url&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(qo,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"主页:"}),e.jsxs("a",{href:c.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",children:["访问",e.jsx($o,{className:"h-3 w-3"})]})]}),c.manifest.repository_url&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(F1,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"仓库:"}),e.jsxs("a",{href:c.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",children:["GitHub",e.jsx($o,{className:"h-3 w-3"})]})]}),e.jsxs("div",{className:"pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm mb-2",children:[e.jsx(Qt,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"支持版本:"})]}),e.jsxs("div",{className:"text-sm pl-6 font-medium",children:[c.manifest.host_application.min_version,c.manifest.host_application.max_version?` - ${c.manifest.host_application.max_version}`:" - 最新版本"]})]})]})})]}),(c.manifest.categories||c.manifest.keywords)&&e.jsxs(Ce,{children:[e.jsx(De,{children:e.jsx(Ue,{className:"text-lg",children:"分类与标签"})}),e.jsxs(Ae,{className:"space-y-4",children:[c.manifest.categories&&c.manifest.categories.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"分类"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:c.manifest.categories.map(ce=>e.jsx(ke,{variant:"secondary",children:yC[ce]||ce},ce))})]}),c.manifest.keywords&&c.manifest.keywords.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"标签"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:c.manifest.keywords.map(ce=>e.jsxs(ke,{variant:"outline",className:"text-xs",children:[e.jsx(rd,{className:"h-3 w-3 mr-1"}),ce]},ce))})]})]})]})]}),e.jsxs(Ce,{className:"lg:col-span-2",children:[e.jsx(De,{children:e.jsx(Ue,{className:"text-lg",children:"插件说明"})}),e.jsx(Ae,{children:e.jsx(ss,{className:"h-[600px] pr-4",children:g?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Fs,{className:"h-6 w-6 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-sm text-muted-foreground",children:"加载说明文档中..."})]}):m?e.jsx(gx,{content:m}):e.jsx("div",{className:"text-center text-muted-foreground py-12",children:"暂无说明文档"})})})]})]})]})})]})}const Zi=u.forwardRef(({className:a,...l},r)=>e.jsx(kj,{ref:r,className:F("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",a),...l}));Zi.displayName=kj.displayName;const _C=u.forwardRef(({className:a,...l},r)=>e.jsx(Cj,{ref:r,className:F("aspect-square h-full w-full",a),...l}));_C.displayName=Cj.displayName;const Wi=u.forwardRef(({className:a,...l},r)=>e.jsx(Tj,{ref:r,className:F("flex h-full w-full items-center justify-center rounded-full bg-muted",a),...l}));Wi.displayName=Tj.displayName;function SC(){return"webui_"+Math.random().toString(36).substr(2,9)+"_"+Date.now().toString(36)}function kC(){const a="maibot_webui_user_id";let l=localStorage.getItem(a);return l||(l=SC(),localStorage.setItem(a,l)),l}function CC(){return localStorage.getItem("maibot_webui_user_name")||"WebUI用户"}function TC(a){localStorage.setItem("maibot_webui_user_name",a)}const gN="maibot_webui_virtual_tabs";function EC(){try{const a=localStorage.getItem(gN);if(a)return JSON.parse(a)}catch(a){console.error("[Chat] 加载虚拟标签页失败:",a)}return[]}function ej(a){try{localStorage.setItem(gN,JSON.stringify(a))}catch(l){console.error("[Chat] 保存虚拟标签页失败:",l)}}function MC({segment:a}){switch(a.type){case"text":return e.jsx("span",{className:"whitespace-pre-wrap",children:String(a.data)});case"image":case"emoji":return e.jsx("img",{src:String(a.data),alt:a.type==="emoji"?"表情包":"图片",className:F("rounded-lg max-w-full",a.type==="emoji"?"max-h-32":"max-h-64"),loading:"lazy",onError:l=>{const r=l.target;r.style.display="none",r.parentElement?.insertAdjacentHTML("beforeend",`[${a.type==="emoji"?"表情包":"图片"}加载失败]`)}});case"voice":return e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("audio",{controls:!0,src:String(a.data),className:"max-w-[200px] h-8",children:"您的浏览器不支持音频播放"})});case"video":return e.jsx("video",{controls:!0,src:String(a.data),className:"rounded-lg max-w-full max-h-64",children:"您的浏览器不支持视频播放"});case"face":return e.jsxs("span",{className:"text-muted-foreground",children:["[表情:",String(a.data),"]"]});case"music":return e.jsx("span",{className:"text-muted-foreground",children:"[音乐分享]"});case"file":return e.jsxs("span",{className:"text-muted-foreground",children:["[文件: ",String(a.data),"]"]});case"reply":return e.jsx("span",{className:"text-muted-foreground text-xs",children:"[回复消息]"});case"forward":return e.jsx("span",{className:"text-muted-foreground",children:"[转发消息]"});case"unknown":default:return e.jsxs("span",{className:"text-muted-foreground",children:["[",a.original_type||"未知消息","]"]})}}function AC({message:a,isBot:l}){return a.message_type==="rich"&&a.segments&&a.segments.length>0?e.jsx("div",{className:"flex flex-col gap-2",children:a.segments.map((r,c)=>e.jsx(MC,{segment:r},c))}):e.jsx("span",{className:"whitespace-pre-wrap",children:a.content})}function zC(){const a={id:"webui-default",type:"webui",label:"WebUI",messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}},l=()=>{const qe=EC().map(Ke=>{const Ze=Ke.virtualConfig;return!Ze.groupId&&Ze.platform&&Ze.userId&&(Ze.groupId=`webui_virtual_group_${Ze.platform}_${Ze.userId}`),{id:Ke.id,type:"virtual",label:Ke.label,virtualConfig:Ze,messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}}});return[a,...qe]},[r,c]=u.useState(l),[d,m]=u.useState("webui-default"),h=r.find(Y=>Y.id===d)||r[0],[f,p]=u.useState(""),[g,N]=u.useState(!1),[j,y]=u.useState(!0),[b,w]=u.useState(CC()),[A,M]=u.useState(!1),[S,P]=u.useState(""),[E,C]=u.useState(!1),[R,H]=u.useState([]),[O,X]=u.useState([]),[L,me]=u.useState(!1),[Ne,je]=u.useState(!1),[ce,ge]=u.useState(""),[pe,D]=u.useState({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),K=u.useRef(kC()),B=u.useRef(new Map),ue=u.useRef(null),Q=u.useRef(new Map),_e=u.useRef(0),he=u.useRef(new Map),{toast:Te}=it(),V=Y=>(_e.current+=1,`${Y}-${Date.now()}-${_e.current}-${Math.random().toString(36).substr(2,9)}`),$=u.useCallback((Y,qe)=>{c(Ke=>Ke.map(Ze=>Ze.id===Y?{...Ze,...qe}:Ze))},[]),z=u.useCallback((Y,qe)=>{c(Ke=>Ke.map(Ze=>Ze.id===Y?{...Ze,messages:[...Ze.messages,qe]}:Ze))},[]),G=u.useCallback(()=>{ue.current?.scrollIntoView({behavior:"smooth"})},[]);u.useEffect(()=>{G()},[h?.messages,G]);const Re=u.useCallback(async()=>{me(!0);try{const Y=await Se("/api/chat/platforms");if(console.log("[Chat] 平台列表响应:",Y.status,Y.headers.get("content-type")),Y.ok){const qe=Y.headers.get("content-type");if(qe&&qe.includes("application/json")){const Ke=await Y.json();console.log("[Chat] 平台列表数据:",Ke),H(Ke.platforms||[])}else{const Ke=await Y.text();console.error("[Chat] 获取平台列表失败: 非 JSON 响应:",Ke.substring(0,200)),Te({title:"连接失败",description:"无法连接到后端服务,请确保 MaiBot 已启动",variant:"destructive"})}}else console.error("[Chat] 获取平台列表失败: HTTP",Y.status),Te({title:"获取平台失败",description:`服务器返回错误: ${Y.status}`,variant:"destructive"})}catch(Y){console.error("[Chat] 获取平台列表失败:",Y),Te({title:"网络错误",description:"无法连接到后端服务",variant:"destructive"})}finally{me(!1)}},[Te]),se=u.useCallback(async(Y,qe)=>{je(!0);try{const Ke=new URLSearchParams;Y&&Ke.append("platform",Y),qe&&Ke.append("search",qe),Ke.append("limit","50");const Ze=await Se(`/api/chat/persons?${Ke.toString()}`);if(Ze.ok){const Ts=Ze.headers.get("content-type");if(Ts&&Ts.includes("application/json")){const He=await Ze.json();X(He.persons||[])}else console.error("[Chat] 获取用户列表失败: 后端返回非 JSON 响应")}}catch(Ke){console.error("[Chat] 获取用户列表失败:",Ke)}finally{je(!1)}},[]);u.useEffect(()=>{pe.platform&&se(pe.platform,ce)},[pe.platform,ce,se]);const Oe=u.useCallback(async(Y,qe)=>{y(!0);try{const Ke=new URLSearchParams;Ke.append("user_id",K.current),Ke.append("limit","50"),qe&&Ke.append("group_id",qe);const Ze=`/api/chat/history?${Ke.toString()}`;console.log("[Chat] 正在加载历史消息:",Ze);const Ts=await Se(Ze);if(Ts.ok){const He=await Ts.text();try{const zs=JSON.parse(He);if(zs.messages&&zs.messages.length>0){const Ls=zs.messages.map(cs=>({id:cs.id,type:cs.type,content:cs.content,timestamp:cs.timestamp,sender:{name:cs.sender_name||(cs.is_bot?"麦麦":"WebUI用户"),user_id:cs.user_id,is_bot:cs.is_bot}}));$(Y,{messages:Ls});const Ks=he.current.get(Y)||new Set;Ls.forEach(cs=>{if(cs.type==="bot"){const ts=`bot-${cs.content}-${Math.floor(cs.timestamp*1e3)}`;Ks.add(ts)}}),he.current.set(Y,Ks)}}catch(zs){console.error("[Chat] JSON 解析失败:",zs)}}}catch(Ke){console.error("[Chat] 加载历史消息失败:",Ke)}finally{y(!1)}},[$]),ns=u.useCallback(async(Y,qe,Ke)=>{const Ze=B.current.get(Y);if(Ze?.readyState===WebSocket.OPEN||Ze?.readyState===WebSocket.CONNECTING){console.log(`[Tab ${Y}] WebSocket 已存在,跳过连接`);return}N(!0);let Ts=null;try{const Ks=await Se("/api/webui/ws-token");if(Ks.ok){const cs=await Ks.json();if(cs.success&&cs.token)Ts=cs.token;else{console.warn(`[Tab ${Y}] 获取 WebSocket token 失败: ${cs.message||"未登录"}`),N(!1);return}}}catch(Ks){console.error(`[Tab ${Y}] 获取 WebSocket token 失败:`,Ks),N(!1);return}if(!Ts){N(!1);return}const He=window.location.protocol==="https:"?"wss:":"ws:",zs=new URLSearchParams;zs.append("token",Ts),qe==="virtual"&&Ke?(zs.append("user_id",Ke.userId),zs.append("user_name",Ke.userName),zs.append("platform",Ke.platform),zs.append("person_id",Ke.personId),zs.append("group_name",Ke.groupName||"WebUI虚拟群聊"),Ke.groupId&&zs.append("group_id",Ke.groupId)):(zs.append("user_id",K.current),zs.append("user_name",b));const Ls=`${He}//${window.location.host}/api/chat/ws?${zs.toString()}`;console.log(`[Tab ${Y}] 正在连接 WebSocket:`,Ls);try{const Ks=new WebSocket(Ls);B.current.set(Y,Ks),Ks.onopen=()=>{$(Y,{isConnected:!0}),N(!1),console.log(`[Tab ${Y}] WebSocket 已连接`)},Ks.onmessage=cs=>{try{const ts=JSON.parse(cs.data);switch(ts.type){case"session_info":$(Y,{sessionInfo:{session_id:ts.session_id,user_id:ts.user_id,user_name:ts.user_name,bot_name:ts.bot_name}});break;case"system":z(Y,{id:V("sys"),type:"system",content:ts.content||"",timestamp:ts.timestamp||Date.now()/1e3});break;case"user_message":{const _s=ts.sender?.user_id,$e=qe==="virtual"&&Ke?Ke.userId:K.current;console.log(`[Tab ${Y}] 收到 user_message, sender: ${_s}, current: ${$e}`);const ms=_s?_s.replace(/^webui_user_/,""):"",os=$e?$e.replace(/^webui_user_/,""):"";if(ms&&os&&ms===os){console.log(`[Tab ${Y}] 跳过自己的消息(user_id 匹配)`);break}const rs=he.current.get(Y)||new Set,ht=`user-${ts.content}-${Math.floor((ts.timestamp||0)*1e3)}`;if(rs.has(ht)){console.log(`[Tab ${Y}] 跳过自己的消息(内容去重)`);break}if(rs.add(ht),he.current.set(Y,rs),rs.size>100){const Tt=rs.values().next().value;Tt&&rs.delete(Tt)}z(Y,{id:ts.message_id||V("user"),type:"user",content:ts.content||"",timestamp:ts.timestamp||Date.now()/1e3,sender:ts.sender});break}case"bot_message":{$(Y,{isTyping:!1});const _s=he.current.get(Y)||new Set,$e=`bot-${ts.content}-${Math.floor((ts.timestamp||0)*1e3)}`;if(_s.has($e))break;if(_s.add($e),he.current.set(Y,_s),_s.size>100){const ms=_s.values().next().value;ms&&_s.delete(ms)}c(ms=>ms.map(os=>{if(os.id!==Y)return os;const rs=os.messages.filter(Tt=>Tt.type!=="thinking"),ht={id:V("bot"),type:"bot",content:ts.content||"",message_type:ts.message_type==="rich"?"rich":"text",segments:ts.segments,timestamp:ts.timestamp||Date.now()/1e3,sender:ts.sender};return{...os,messages:[...rs,ht]}}));break}case"typing":$(Y,{isTyping:ts.is_typing||!1});break;case"error":c(_s=>_s.map($e=>{if($e.id!==Y)return $e;const ms=$e.messages.filter(os=>os.type!=="thinking");return{...$e,messages:[...ms,{id:V("error"),type:"error",content:ts.content||"发生错误",timestamp:ts.timestamp||Date.now()/1e3}]}})),Te({title:"错误",description:ts.content,variant:"destructive"});break;case"pong":break;case"history":{const _s=ts.messages||[];if(_s.length>0){const $e=he.current.get(Y)||new Set,ms=_s.map(os=>{const rs=os.is_bot||!1,ht=os.id||V(rs?"bot":"user"),Tt=`${rs?"bot":"user"}-${os.content}-${Math.floor(os.timestamp*1e3)}`;return $e.add(Tt),{id:ht,type:rs?"bot":"user",content:os.content,timestamp:os.timestamp,sender:{name:os.sender_name||(rs?"麦麦":"用户"),user_id:os.sender_id,is_bot:rs}}});he.current.set(Y,$e),$(Y,{messages:ms}),console.log(`[Tab ${Y}] 已加载 ${ms.length} 条历史消息`)}break}default:console.log("未知消息类型:",ts.type)}}catch(ts){console.error("解析消息失败:",ts)}},Ks.onclose=()=>{$(Y,{isConnected:!1}),N(!1),B.current.delete(Y),console.log(`[Tab ${Y}] WebSocket 已断开`);const cs=Q.current.get(Y);cs&&clearTimeout(cs);const ts=window.setTimeout(()=>{if(!J.current){const _s=r.find($e=>$e.id===Y);_s&&ns(Y,_s.type,_s.virtualConfig)}},5e3);Q.current.set(Y,ts)},Ks.onerror=cs=>{console.error(`[Tab ${Y}] WebSocket 错误:`,cs),N(!1)}}catch(Ks){console.error(`[Tab ${Y}] 创建 WebSocket 失败:`,Ks),N(!1)}},[b,$,z,Te,r]),J=u.useRef(!1);u.useEffect(()=>{J.current=!1;const Y=B.current,qe=Q.current,Ke=he.current;Oe("webui-default");const Ze=setTimeout(()=>{J.current||(ns("webui-default","webui"),r.forEach(He=>{He.type==="virtual"&&He.virtualConfig&&(Ke.set(He.id,new Set),setTimeout(()=>{J.current||ns(He.id,"virtual",He.virtualConfig)},200))}))},100),Ts=setInterval(()=>{Y.forEach(He=>{He.readyState===WebSocket.OPEN&&He.send(JSON.stringify({type:"ping"}))})},3e4);return()=>{J.current=!0,clearTimeout(Ze),clearInterval(Ts),qe.forEach(He=>{clearTimeout(He)}),qe.clear(),Y.forEach(He=>{He.close()}),Y.clear()}},[]);const Z=u.useCallback(()=>{const Y=B.current.get(d);if(!f.trim()||!Y||Y.readyState!==WebSocket.OPEN)return;const qe=h?.type==="virtual"&&h.virtualConfig?.userName||b,Ke=f.trim(),Ze=Date.now()/1e3;Y.send(JSON.stringify({type:"message",content:Ke,user_name:qe}));const Ts=he.current.get(d)||new Set,He=`user-${Ke}-${Math.floor(Ze*1e3)}`;if(Ts.add(He),he.current.set(d,Ts),Ts.size>100){const Ks=Ts.values().next().value;Ks&&Ts.delete(Ks)}const zs={id:V("user"),type:"user",content:Ke,timestamp:Ze,sender:{name:qe,is_bot:!1}};z(d,zs);const Ls={id:V("thinking"),type:"thinking",content:"",timestamp:Ze+.001,sender:{name:h?.sessionInfo.bot_name||"麦麦",is_bot:!0}};z(d,Ls),p("")},[f,b,d,h,z]),Le=Y=>{Y.key==="Enter"&&!Y.shiftKey&&(Y.preventDefault(),Z())},ae=()=>{P(b),M(!0)},Ee=()=>{const Y=S.trim()||"WebUI用户";w(Y),TC(Y),M(!1);const qe=B.current.get(d);qe?.readyState===WebSocket.OPEN&&qe.send(JSON.stringify({type:"update_nickname",user_name:Y}))},de=()=>{P(""),M(!1)},ze=Y=>new Date(Y*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),ws=()=>{const Y=B.current.get(d);Y&&(Y.close(),B.current.delete(d)),ns(d,h?.type||"webui",h?.virtualConfig)},Zs=()=>{D({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),ge(""),Re(),C(!0)},St=()=>{if(!pe.platform||!pe.personId){Te({title:"配置不完整",description:"请选择平台和用户",variant:"destructive"});return}const Y=`webui_virtual_group_${pe.platform}_${pe.userId}`,qe=`virtual-${pe.platform}-${pe.userId}-${Date.now()}`,Ke=pe.userName||pe.userId,Ze={id:qe,type:"virtual",label:Ke,virtualConfig:{...pe,groupId:Y},messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}};c(Ts=>{const He=[...Ts,Ze],zs=He.filter(Ls=>Ls.type==="virtual"&&Ls.virtualConfig).map(Ls=>({id:Ls.id,label:Ls.label,virtualConfig:Ls.virtualConfig,createdAt:Date.now()}));return ej(zs),He}),m(qe),C(!1),he.current.set(qe,new Set),setTimeout(()=>{ns(qe,"virtual",pe)},100),Te({title:"虚拟身份标签页",description:`已创建 ${Ke} 的对话`})},fa=(Y,qe)=>{if(qe?.stopPropagation(),Y==="webui-default")return;const Ke=B.current.get(Y);Ke&&(Ke.close(),B.current.delete(Y));const Ze=Q.current.get(Y);Ze&&(clearTimeout(Ze),Q.current.delete(Y)),he.current.delete(Y),c(Ts=>{const He=Ts.filter(Ls=>Ls.id!==Y),zs=He.filter(Ls=>Ls.type==="virtual"&&Ls.virtualConfig).map(Ls=>({id:Ls.id,label:Ls.label,virtualConfig:Ls.virtualConfig,createdAt:Date.now()}));return ej(zs),He}),d===Y&&m("webui-default")},xs=Y=>{m(Y)},Is=Y=>{D(qe=>({...qe,personId:Y.person_id,userId:Y.user_id,userName:Y.nickname||Y.person_name}))};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Js,{open:E,onOpenChange:C,children:e.jsxs(qs,{className:"sm:max-w-[500px] max-h-[85vh] overflow-hidden flex flex-col",children:[e.jsxs(Vs,{children:[e.jsxs(Gs,{className:"flex items-center gap-2",children:[e.jsx(Mm,{className:"h-5 w-5"}),"新建虚拟身份对话"]}),e.jsx(nt,{children:"选择一个麦麦已认识的用户,以该用户的身份与麦麦对话。麦麦将使用她对该用户的记忆和认知来回应。"})]}),e.jsxs("div",{className:"space-y-4 flex-1 overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{className:"flex items-center gap-2",children:[e.jsx(qo,{className:"h-4 w-4"}),"选择平台"]}),e.jsxs(Pe,{value:pe.platform,onValueChange:Y=>{D(qe=>({...qe,platform:Y,personId:"",userId:"",userName:""})),X([])},children:[e.jsx(Be,{disabled:L,children:e.jsx(Fe,{placeholder:L?"加载中...":"选择平台"})}),e.jsx(Ie,{children:R.map(Y=>e.jsxs(ee,{value:Y.platform,children:[Y.platform," (",Y.count," 人)"]},Y.platform))})]})]}),pe.platform&&e.jsxs("div",{className:"space-y-2 flex-1 overflow-hidden flex flex-col",children:[e.jsxs(T,{className:"flex items-center gap-2",children:[e.jsx(ic,{className:"h-4 w-4"}),"选择用户"]}),e.jsxs("div",{className:"relative",children:[e.jsx(Ut,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"搜索用户名...",value:ce,onChange:Y=>ge(Y.target.value),className:"pl-9"})]}),e.jsx(ss,{className:"h-[250px] border rounded-md",children:e.jsx("div",{className:"p-2",children:Ne?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Fs,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):O.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[e.jsx(ic,{className:"h-8 w-8 mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"没有找到用户"})]}):e.jsx("div",{className:"space-y-1",children:O.map(Y=>e.jsxs("button",{onClick:()=>Is(Y),className:F("w-full flex items-center gap-3 p-2 rounded-md text-left transition-colors",pe.personId===Y.person_id?"bg-primary text-primary-foreground":"hover:bg-muted"),children:[e.jsx(Zi,{className:"h-8 w-8 shrink-0",children:e.jsx(Wi,{className:F("text-xs",pe.personId===Y.person_id?"bg-primary-foreground/20":"bg-muted"),children:(Y.nickname||Y.person_name||"?").charAt(0)})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-medium truncate",children:Y.nickname||Y.person_name}),e.jsxs("div",{className:F("text-xs truncate",pe.personId===Y.person_id?"text-primary-foreground/70":"text-muted-foreground"),children:["ID: ",Y.user_id,Y.is_known&&" · 已认识"]})]})]},Y.person_id))})})})]}),pe.personId&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"虚拟群名(可选)"}),e.jsx(ne,{placeholder:"WebUI虚拟群聊",value:pe.groupName,onChange:Y=>D(qe=>({...qe,groupName:Y.target.value}))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦会认为这是一个名为此名称的群聊"})]})]}),e.jsxs(xt,{className:"gap-2 sm:gap-0",children:[e.jsx(_,{variant:"outline",onClick:()=>C(!1),children:"取消"}),e.jsx(_,{onClick:St,disabled:!pe.platform||!pe.personId,children:"创建对话"})]})]})}),e.jsx("div",{className:"shrink-0 border-b bg-muted/30",children:e.jsx("div",{className:"max-w-4xl mx-auto px-2 sm:px-4",children:e.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto py-1.5 scrollbar-thin",children:[r.map(Y=>e.jsxs("div",{className:F("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm whitespace-nowrap transition-colors cursor-pointer","hover:bg-muted",d===Y.id?"bg-background shadow-sm border":"text-muted-foreground"),onClick:()=>xs(Y.id),children:[Y.type==="webui"?e.jsx(Ba,{className:"h-3.5 w-3.5"}):e.jsx(Mm,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"max-w-[100px] truncate",children:Y.label}),e.jsx("span",{className:F("w-1.5 h-1.5 rounded-full",Y.isConnected?"bg-green-500":"bg-muted-foreground/50")}),Y.id!=="webui-default"&&e.jsx("span",{onClick:qe=>fa(Y.id,qe),className:"ml-0.5 p-0.5 rounded hover:bg-muted-foreground/20 cursor-pointer",role:"button",tabIndex:0,onKeyDown:qe=>{(qe.key==="Enter"||qe.key===" ")&&(qe.preventDefault(),fa(Y.id,qe))},children:e.jsx(_a,{className:"h-3 w-3"})})]},Y.id)),e.jsx("button",{onClick:Zs,className:"flex items-center gap-1 px-2 py-1.5 rounded-md text-sm text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",title:"新建虚拟身份对话",children:e.jsx(at,{className:"h-3.5 w-3.5"})})]})})}),e.jsx("div",{className:"shrink-0 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:e.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[e.jsx(Zi,{className:"h-8 w-8 sm:h-10 sm:w-10 shrink-0",children:e.jsx(Wi,{className:"bg-primary/10 text-primary",children:e.jsx(Kn,{className:"h-4 w-4 sm:h-5 sm:w-5"})})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-base sm:text-lg font-semibold truncate",children:h?.sessionInfo.bot_name||"麦麦"}),e.jsx("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:h?.isConnected?e.jsxs(e.Fragment,{children:[e.jsx(H1,{className:"h-3 w-3 text-green-500"}),e.jsx("span",{className:"text-green-600 dark:text-green-400",children:"已连接"})]}):g?e.jsxs(e.Fragment,{children:[e.jsx(Fs,{className:"h-3 w-3 animate-spin"}),e.jsx("span",{children:"连接中..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(q1,{className:"h-3 w-3 text-red-500"}),e.jsx("span",{className:"text-red-600 dark:text-red-400",children:"未连接"})]})})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[j&&e.jsx(Fs,{className:"h-4 w-4 animate-spin text-muted-foreground"}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:ws,disabled:g,title:"重新连接",children:e.jsx(ut,{className:F("h-4 w-4",g&&"animate-spin")})})]})]}),e.jsx("div",{className:"hidden sm:flex items-center gap-2 mt-2 text-sm text-muted-foreground",children:h?.type==="virtual"&&h.virtualConfig?e.jsxs(e.Fragment,{children:[e.jsx(Mm,{className:"h-3 w-3 text-primary"}),e.jsx("span",{children:"虚拟身份:"}),e.jsx("span",{className:"font-medium text-primary",children:h.virtualConfig.userName}),e.jsxs("span",{className:"text-xs",children:["(",h.virtualConfig.platform,")"]}),h.virtualConfig.groupName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-1",children:"·"}),e.jsxs("span",{className:"text-xs",children:["群:",h.virtualConfig.groupName]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx($l,{className:"h-3 w-3"}),e.jsx("span",{children:"当前身份:"}),A?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{value:S,onChange:Y=>P(Y.target.value),onKeyDown:Y=>{Y.key==="Enter"&&Ee(),Y.key==="Escape"&&de()},className:"h-7 w-32",placeholder:"输入昵称",autoFocus:!0}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:Ee,children:"保存"}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:de,children:"取消"})]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-medium text-foreground",children:b}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:ae,title:"修改昵称",children:e.jsx(V1,{className:"h-3 w-3"})})]})]})})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(ss,{className:"h-full",children:e.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto space-y-3 sm:space-y-4",children:[h?.messages.length===0&&!j&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(Kn,{className:"h-12 w-12 mb-4 opacity-50"}),e.jsxs("p",{className:"text-sm",children:["开始与 ",h?.sessionInfo.bot_name||"麦麦"," 对话吧!"]})]}),h?.messages.map(Y=>e.jsxs("div",{className:F("flex gap-2 sm:gap-3",Y.type==="user"&&"flex-row-reverse",Y.type==="system"&&"justify-center",Y.type==="error"&&"justify-center"),children:[Y.type==="system"&&e.jsx("div",{className:"text-xs text-muted-foreground bg-muted/50 px-3 py-1 rounded-full max-w-[90%]",children:Y.content}),Y.type==="error"&&e.jsx("div",{className:"text-xs text-red-600 dark:text-red-400 bg-red-100 dark:bg-red-900/30 px-3 py-1 rounded-full max-w-[90%]",children:Y.content}),Y.type==="thinking"&&e.jsxs(e.Fragment,{children:[e.jsx(Zi,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(Wi,{className:"bg-primary/10 text-primary",children:e.jsx(Kn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),e.jsxs("div",{className:"flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",children:[e.jsx("div",{className:"flex items-center gap-2 text-[10px] sm:text-xs text-muted-foreground",children:e.jsx("span",{className:"hidden sm:inline",children:Y.sender?.name||h?.sessionInfo.bot_name})}),e.jsx("div",{className:"bg-muted rounded-2xl rounded-tl-sm px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex gap-1",children:[e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),e.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"思考中..."})]})})]})]}),(Y.type==="user"||Y.type==="bot")&&e.jsxs(e.Fragment,{children:[e.jsx(Zi,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(Wi,{className:F("text-xs",Y.type==="bot"?"bg-primary/10 text-primary":"bg-secondary text-secondary-foreground"),children:Y.type==="bot"?e.jsx(Kn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}):e.jsx($l,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),e.jsxs("div",{className:F("flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",Y.type==="user"&&"items-end"),children:[e.jsxs("div",{className:"flex items-center gap-2 text-[10px] sm:text-xs text-muted-foreground",children:[e.jsx("span",{className:"hidden sm:inline",children:Y.sender?.name||(Y.type==="bot"?h?.sessionInfo.bot_name:b)}),e.jsx("span",{children:ze(Y.timestamp)})]}),e.jsx("div",{className:F("rounded-2xl px-3 py-2 text-sm break-words",Y.type==="bot"?"bg-muted rounded-tl-sm":"bg-primary text-primary-foreground rounded-tr-sm"),children:e.jsx(AC,{message:Y,isBot:Y.type==="bot"})})]})]})]},Y.id)),e.jsx("div",{ref:ue})]})})}),e.jsx("div",{className:"shrink-0 border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:e.jsx("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{value:f,onChange:Y=>p(Y.target.value),onKeyDown:Le,placeholder:h?.isConnected?"输入消息...":"等待连接...",disabled:!h?.isConnected,className:"flex-1 h-10 sm:h-10"}),e.jsx(_,{onClick:Z,disabled:!h?.isConnected||!f.trim(),size:"icon",className:"h-10 w-10 shrink-0",children:e.jsx(G1,{className:"h-4 w-4"})})]})})})]})}var Cx="Radio",[RC,jN]=td(Cx),[DC,OC]=RC(Cx),vN=u.forwardRef((a,l)=>{const{__scopeRadio:r,name:c,checked:d=!1,required:m,disabled:h,value:f="on",onCheck:p,form:g,...N}=a,[j,y]=u.useState(null),b=ad(l,M=>y(M)),w=u.useRef(!1),A=j?g||!!j.closest("form"):!0;return e.jsxs(DC,{scope:r,checked:d,disabled:h,children:[e.jsx(sr.button,{type:"button",role:"radio","aria-checked":d,"data-state":wN(d),"data-disabled":h?"":void 0,disabled:h,value:f,...N,ref:b,onClick:Nn(a.onClick,M=>{d||p?.(),A&&(w.current=M.isPropagationStopped(),w.current||M.stopPropagation())})}),A&&e.jsx(yN,{control:j,bubbles:!w.current,name:c,value:f,checked:d,required:m,disabled:h,form:g,style:{transform:"translateX(-100%)"}})]})});vN.displayName=Cx;var NN="RadioIndicator",bN=u.forwardRef((a,l)=>{const{__scopeRadio:r,forceMount:c,...d}=a,m=OC(NN,r);return e.jsx(m1,{present:c||m.checked,children:e.jsx(sr.span,{"data-state":wN(m.checked),"data-disabled":m.disabled?"":void 0,...d,ref:l})})});bN.displayName=NN;var LC="RadioBubbleInput",yN=u.forwardRef(({__scopeRadio:a,control:l,checked:r,bubbles:c=!0,...d},m)=>{const h=u.useRef(null),f=ad(h,m),p=x1(r),g=h1(l);return u.useEffect(()=>{const N=h.current;if(!N)return;const j=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(j,"checked").set;if(p!==r&&b){const w=new Event("click",{bubbles:c});b.call(N,r),N.dispatchEvent(w)}},[p,r,c]),e.jsx(sr.input,{type:"radio","aria-hidden":!0,defaultChecked:r,...d,tabIndex:-1,ref:f,style:{...d.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});yN.displayName=LC;function wN(a){return a?"checked":"unchecked"}var UC=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],fd="RadioGroup",[$C]=td(fd,[Ej,jN]),_N=Ej(),SN=jN(),[BC,IC]=$C(fd),kN=u.forwardRef((a,l)=>{const{__scopeRadioGroup:r,name:c,defaultValue:d,value:m,required:h=!1,disabled:f=!1,orientation:p,dir:g,loop:N=!0,onValueChange:j,...y}=a,b=_N(r),w=Kj(g),[A,M]=sd({prop:m,defaultProp:d??null,onChange:j,caller:fd});return e.jsx(BC,{scope:r,name:c,required:h,disabled:f,value:A,onValueChange:M,children:e.jsx(Tw,{asChild:!0,...b,orientation:p,dir:w,loop:N,children:e.jsx(sr.div,{role:"radiogroup","aria-required":h,"aria-orientation":p,"data-disabled":f?"":void 0,dir:w,...y,ref:l})})})});kN.displayName=fd;var CN="RadioGroupItem",TN=u.forwardRef((a,l)=>{const{__scopeRadioGroup:r,disabled:c,...d}=a,m=IC(CN,r),h=m.disabled||c,f=_N(r),p=SN(r),g=u.useRef(null),N=ad(l,g),j=m.value===d.value,y=u.useRef(!1);return u.useEffect(()=>{const b=A=>{UC.includes(A.key)&&(y.current=!0)},w=()=>y.current=!1;return document.addEventListener("keydown",b),document.addEventListener("keyup",w),()=>{document.removeEventListener("keydown",b),document.removeEventListener("keyup",w)}},[]),e.jsx(Ew,{asChild:!0,...f,focusable:!h,active:j,children:e.jsx(vN,{disabled:h,required:m.required,checked:j,...p,...d,name:m.name,ref:N,onCheck:()=>m.onValueChange(d.value),onKeyDown:Nn(b=>{b.key==="Enter"&&b.preventDefault()}),onFocus:Nn(d.onFocus,()=>{y.current&&g.current?.click()})})})});TN.displayName=CN;var PC="RadioGroupIndicator",EN=u.forwardRef((a,l)=>{const{__scopeRadioGroup:r,...c}=a,d=SN(r);return e.jsx(bN,{...d,...c,ref:l})});EN.displayName=PC;var MN=kN,AN=TN,FC=EN;const Tx=u.forwardRef(({className:a,...l},r)=>e.jsx(MN,{className:F("grid gap-2",a),...l,ref:r}));Tx.displayName=MN.displayName;const Xo=u.forwardRef(({className:a,...l},r)=>e.jsx(AN,{ref:r,className:F("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",a),...l,children:e.jsx(FC,{className:"flex items-center justify-center",children:e.jsx(Ho,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Xo.displayName=AN.displayName;function HC({question:a,value:l,onChange:r,error:c,disabled:d=!1}){const[m,h]=u.useState(null),f=d||a.readOnly,p=()=>{switch(a.type){case"single":return e.jsx(Tx,{value:l||"",onValueChange:r,disabled:f,className:"space-y-2",children:a.options?.map(g=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xo,{value:g.value,id:`${a.id}-${g.id}`}),e.jsx(T,{htmlFor:`${a.id}-${g.id}`,className:"cursor-pointer font-normal",children:g.label})]},g.id))});case"multiple":{const g=l||[];return e.jsxs("div",{className:"space-y-2",children:[a.options?.map(N=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(lt,{id:`${a.id}-${N.id}`,checked:g.includes(N.value),disabled:f||a.maxSelections!==void 0&&g.length>=a.maxSelections&&!g.includes(N.value),onCheckedChange:j=>{r(j?[...g,N.value]:g.filter(y=>y!==N.value))}}),e.jsx(T,{htmlFor:`${a.id}-${N.id}`,className:"cursor-pointer font-normal",children:N.label})]},N.id)),a.maxSelections&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["最多选择 ",a.maxSelections," 项"]})]})}case"text":return e.jsx(ne,{value:l||"",onChange:g=>r(g.target.value),placeholder:a.placeholder||"请输入...",disabled:f,readOnly:a.readOnly,maxLength:a.maxLength,className:F(a.readOnly&&"bg-muted cursor-not-allowed")});case"textarea":return e.jsxs("div",{className:"space-y-1",children:[e.jsx(ft,{value:l||"",onChange:g=>r(g.target.value),placeholder:a.placeholder||"请输入...",disabled:f,readOnly:a.readOnly,maxLength:a.maxLength,rows:4,className:F(a.readOnly&&"bg-muted cursor-not-allowed")}),a.maxLength&&e.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[(l||"").length," / ",a.maxLength]})]});case"rating":{const g=l||0,N=m!==null?m:g;return e.jsxs("div",{className:"flex items-center gap-1",children:[[1,2,3,4,5].map(j=>e.jsx("button",{type:"button",disabled:f,className:F("p-1 transition-colors focus:outline-none focus:ring-2 focus:ring-ring rounded",f&&"cursor-not-allowed opacity-50"),onMouseEnter:()=>!f&&h(j),onMouseLeave:()=>h(null),onClick:()=>!f&&r(j),children:e.jsx(fn,{className:F("h-6 w-6 transition-colors",j<=N?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},j)),g>0&&e.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[g," / 5"]})]})}case"scale":{const g=a.min??1,N=a.max??10,j=a.step??1,y=l??g;return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Wa,{value:[y],onValueChange:([b])=>r(b),min:g,max:N,step:j,disabled:f}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:a.minLabel||g}),e.jsx("span",{className:"font-medium text-foreground",children:y}),e.jsx("span",{children:a.maxLabel||N})]})]})}case"dropdown":return e.jsxs(Pe,{value:l||"",onValueChange:r,disabled:f,children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:a.placeholder||"请选择..."})}),e.jsx(Ie,{children:a.options?.map(g=>e.jsx(ee,{value:g.value,children:g.label},g.id))})]});default:return e.jsx("div",{className:"text-muted-foreground",children:"不支持的问题类型"})}};return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-base font-medium",children:[a.title,a.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:a.description})]}),p(),c&&e.jsx("p",{className:"text-sm text-destructive",children:c})]})}const zN="https://maibot-plugin-stats.maibot-webui.workers.dev";function RN(){const a="maibot_user_id";let l=localStorage.getItem(a);if(!l){const r=Math.random().toString(36).substring(2,10),c=Date.now().toString(36),d=Math.random().toString(36).substring(2,10);l=`fp_${r}_${c}_${d}`,localStorage.setItem(a,l)}return l}async function qC(a,l,r,c){try{const d=c?.userId||RN(),m={surveyId:a,surveyVersion:l,userId:d,answers:r,submittedAt:new Date().toISOString(),allowMultiple:c?.allowMultiple,metadata:{userAgent:navigator.userAgent,language:navigator.language}},h=await fetch(`${zN}/survey/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(m)}),f=await h.json();return h.status===429?{success:!1,error:"提交过于频繁,请稍后再试"}:h.status===409?{success:!1,error:f.error||"你已经提交过这份问卷了"}:h.ok?{success:!0,submissionId:f.submissionId,message:f.message}:{success:!1,error:f.error||"提交失败"}}catch(d){return console.error("Error submitting survey:",d),{success:!1,error:"网络错误"}}}async function VC(a,l){try{const r=l||RN(),c=new URLSearchParams({user_id:r,survey_id:a}),d=await fetch(`${zN}/survey/check?${c}`);return d.ok?{success:!0,hasSubmitted:(await d.json()).hasSubmitted}:{success:!1,error:(await d.json()).error||"检查失败"}}catch(r){return console.error("Error checking submission:",r),{success:!1,error:"网络错误"}}}function DN({config:a,initialAnswers:l,onSubmitSuccess:r,onSubmitError:c,showProgress:d=!0,paginateQuestions:m=!1,className:h}){const f=u.useCallback(()=>!l||l.length===0?{}:l.reduce((B,ue)=>(B[ue.questionId]=ue.value,B),{}),[l]),[p,g]=u.useState(()=>f()),[N,j]=u.useState({}),[y,b]=u.useState(0),[w,A]=u.useState(!1),[M,S]=u.useState(!1),[P,E]=u.useState(null),[C,R]=u.useState(null),[H,O]=u.useState(!1),[X,L]=u.useState(!0);u.useEffect(()=>{l&&l.length>0&&g(B=>({...B,...f()}))},[l,f]),u.useEffect(()=>{(async()=>{if(!a.settings?.allowMultiple){const ue=await VC(a.id);ue.success&&ue.hasSubmitted&&O(!0)}L(!1)})()},[a.id,a.settings?.allowMultiple]);const me=u.useCallback(()=>{const B=new Date;return!(a.settings?.startTime&&new Date(a.settings.startTime)>B||a.settings?.endTime&&new Date(a.settings.endTime){const ue=p[B.id];return ue==null?!1:Array.isArray(ue)?ue.length>0:typeof ue=="string"?ue.trim()!=="":!0}).length,je=Ne/a.questions.length*100,ce=u.useCallback((B,ue)=>{g(Q=>({...Q,[B]:ue})),j(Q=>{const _e={...Q};return delete _e[B],_e})},[]),ge=u.useCallback(()=>{const B={};for(const ue of a.questions){if(ue.required){const Q=p[ue.id];if(Q==null){B[ue.id]="此题为必填项";continue}if(Array.isArray(Q)&&Q.length===0){B[ue.id]="请至少选择一项";continue}if(typeof Q=="string"&&Q.trim()===""){B[ue.id]="此题为必填项";continue}}ue.minLength&&typeof p[ue.id]=="string"&&p[ue.id].length{if(!ge()){if(m){const B=a.questions.findIndex(ue=>N[ue.id]);B>=0&&b(B)}return}A(!0),E(null);try{const B=a.questions.filter(Q=>p[Q.id]!==void 0).map(Q=>({questionId:Q.id,value:p[Q.id]})),ue=await qC(a.id,a.version,B,{allowMultiple:a.settings?.allowMultiple});if(ue.success&&ue.submissionId)S(!0),R(ue.submissionId),r?.(ue.submissionId);else{const Q=ue.error||"提交失败";E(Q),c?.(Q)}}catch(B){const ue=B instanceof Error?B.message:"提交失败";E(ue),c?.(ue)}finally{A(!1)}},[ge,m,a,p,N,r,c]),D=u.useCallback(B=>{B>=0&&Be.jsxs("div",{className:F("p-4 rounded-lg border bg-card",N[B.id]?"border-destructive bg-destructive/5":"border-border"),children:[m&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:["问题 ",y+1," / ",a.questions.length]}),!m&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:[ue+1,"."]}),e.jsx(HC,{question:B,value:p[B.id],onChange:Q=>ce(B.id,Q),error:N[B.id],disabled:w})]},B.id)),P&&e.jsxs(pt,{variant:"destructive",children:[e.jsx(Rt,{className:"h-4 w-4"}),e.jsx(gt,{children:P})]}),e.jsx("div",{className:"flex justify-between items-center py-4",children:m?e.jsxs(e.Fragment,{children:[e.jsxs(_,{variant:"outline",onClick:()=>D(y-1),disabled:y===0||w,children:[e.jsx(Ia,{className:"h-4 w-4 mr-1"}),"上一题"]}),y===a.questions.length-1?e.jsxs(_,{onClick:pe,disabled:w,children:[w&&e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]}):e.jsxs(_,{onClick:()=>D(y+1),disabled:w,children:["下一题",e.jsx(ra,{className:"h-4 w-4 ml-1"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:Object.keys(N).length>0&&e.jsxs("span",{className:"text-destructive",children:["还有 ",Object.keys(N).length," 个必填项未完成"]})}),e.jsxs(_,{onClick:pe,disabled:w,size:"lg",children:[w&&e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]})]})})]})})]})}const GC={id:"webui-feedback-v1",version:"1.0.0",title:"麦麦 WebUI 使用反馈问卷",description:"感谢您使用麦麦 WebUI!您的反馈将帮助我们不断改进产品体验。",questions:[{id:"webui_version",type:"text",title:"你正在使用的 WebUI 版本",description:"此项由系统自动填写",required:!0,readOnly:!0,placeholder:"自动检测中..."},{id:"ui_design_satisfaction",type:"single",title:"你觉得当前的 WebUI 界面设计如何?",required:!0,options:[{id:"very_satisfied",label:"非常满意",value:"very_satisfied"},{id:"satisfied",label:"满意",value:"satisfied"},{id:"neutral",label:"一般",value:"neutral"},{id:"dissatisfied",label:"不满意",value:"dissatisfied"},{id:"very_dissatisfied",label:"非常不满意",value:"very_dissatisfied"}]},{id:"problems_encountered",type:"multiple",title:"你在使用 WebUI 时遇到过哪些问题?",description:"可多选",required:!0,options:[{id:"lag",label:"界面卡顿",value:"lag"},{id:"incomplete",label:"功能不完整",value:"incomplete"},{id:"complex",label:"操作复杂",value:"complex"},{id:"bugs",label:"存在 Bug",value:"bugs"},{id:"none",label:"没有遇到问题",value:"none"},{id:"other",label:"其他",value:"other"}]},{id:"problems_other",type:"text",title:'如选择"其他",请说明遇到的问题',required:!1,placeholder:"请描述你遇到的其他问题...",maxLength:500},{id:"useful_features",type:"textarea",title:"你觉得哪些功能是最有用的?",required:!0,placeholder:"请分享你认为最有价值的功能...",maxLength:1e3},{id:"feature_requests",type:"textarea",title:"你希望在未来的版本中增加哪些功能?",required:!0,placeholder:"请告诉我们你期望的新功能...",maxLength:1e3},{id:"overall_satisfaction",type:"single",title:"你对麦麦 WebUI 的整体满意度如何?",required:!0,options:[{id:"very_satisfied",label:"非常满意",value:"very_satisfied"},{id:"satisfied",label:"满意",value:"satisfied"},{id:"neutral",label:"一般",value:"neutral"},{id:"dissatisfied",label:"不满意",value:"dissatisfied"},{id:"very_dissatisfied",label:"非常不满意",value:"very_dissatisfied"}]},{id:"would_recommend",type:"single",title:"你愿意推荐麦麦 WebUI 给其他人使用吗?",required:!0,options:[{id:"yes",label:"是",value:"yes"},{id:"no",label:"否",value:"no"}]},{id:"other_suggestions",type:"textarea",title:"其他建议或意见",description:"此项为选填",required:!1,placeholder:"如果你有任何其他想法或建议,请在此分享...",maxLength:2e3}],settings:{allowMultiple:!1,thankYouMessage:"感谢你的反馈!你的意见对我们非常重要,我们会认真考虑每一条建议。"}},KC={id:"maibot-feedback-v1",version:"1.0.0",title:"麦麦使用体验反馈问卷",description:"感谢您使用麦麦!您的反馈将帮助我们打造更好的 AI 伙伴。",questions:[{id:"maibot_version",type:"text",title:"你正在使用的麦麦版本",description:"此项由系统自动填写",required:!0,readOnly:!0,placeholder:"自动检测中..."},{id:"improvement_areas",type:"textarea",title:"你认为麦麦还有哪些部分可以改进?",required:!0,placeholder:"请分享你认为可以改进的方面...",maxLength:1e3},{id:"problems_encountered",type:"multiple",title:"你在使用麦麦时遇到过哪些问题?",description:"可多选",required:!0,options:[{id:"incomplete",label:"功能不完整",value:"incomplete"},{id:"slow_response",label:"响应速度慢",value:"slow_response"},{id:"complex",label:"操作复杂",value:"complex"},{id:"unstable",label:"运行不稳定",value:"unstable"},{id:"config_difficult",label:"配置困难",value:"config_difficult"},{id:"none",label:"没有遇到问题",value:"none"},{id:"other",label:"其他",value:"other"}]},{id:"problems_other",type:"text",title:'如选择"其他",请说明遇到的问题',required:!1,placeholder:"请描述你遇到的其他问题...",maxLength:500},{id:"helpful_features",type:"textarea",title:"你觉得麦麦的哪些功能对你最有帮助?",required:!0,placeholder:"请分享对你最有帮助的功能...",maxLength:1e3},{id:"feature_requests",type:"textarea",title:"你希望在未来的版本中增加哪些功能?",required:!0,placeholder:"请告诉我们你期望的新功能...",maxLength:1e3},{id:"overall_satisfaction",type:"single",title:"你对麦麦的整体满意度如何?",required:!0,options:[{id:"very_satisfied",label:"非常满意",value:"very_satisfied"},{id:"satisfied",label:"满意",value:"satisfied"},{id:"neutral",label:"一般",value:"neutral"},{id:"dissatisfied",label:"不满意",value:"dissatisfied"},{id:"very_dissatisfied",label:"非常不满意",value:"very_dissatisfied"}]},{id:"would_recommend",type:"single",title:"你愿意推荐麦麦给其他人使用吗?",required:!0,options:[{id:"yes",label:"是",value:"yes"},{id:"no",label:"否",value:"no"}]},{id:"other_suggestions",type:"textarea",title:"其他建议或意见",description:"此项为选填",required:!1,placeholder:"如果你有任何其他想法或建议,请在此分享...",maxLength:2e3}],settings:{allowMultiple:!1,thankYouMessage:"感谢你的反馈!你的意见对麦麦的成长非常重要,我们会认真考虑每一条建议。"}};function QC(){const[a,l]=u.useState(!0),r=u.useMemo(()=>JSON.parse(JSON.stringify(GC)),[]);u.useEffect(()=>{l(!1)},[]);const c=u.useMemo(()=>[{questionId:"webui_version",value:`v${od}`}],[]),d=u.useCallback(h=>{console.log("WebUI Survey submitted:",h)},[]),m=u.useCallback(h=>{console.error("WebUI Survey submission error:",h)},[]);return a?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r?e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(xv,{className:"h-8 w-8",strokeWidth:2}),"WebUI 使用反馈问卷"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"感谢您的反馈,帮助我们持续改进产品体验"})]}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(DN,{config:r,initialAnswers:c,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:d,onSubmitError:m})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(pt,{variant:"destructive",className:"max-w-md",children:[e.jsx(Rt,{className:"h-4 w-4"}),e.jsx(gt,{children:"无法加载问卷配置"})]}),e.jsx(_,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}function YC(){const[a,l]=u.useState(null),[r,c]=u.useState(!0),[d,m]=u.useState("未知版本");u.useEffect(()=>{(async()=>{try{const j=await B_();m(j.version||"未知版本")}catch(j){console.error("Failed to get MaiBot version:",j),m("获取失败")}const N=JSON.parse(JSON.stringify(KC));l(N),c(!1)})()},[]);const h=u.useMemo(()=>[{questionId:"maibot_version",value:d}],[d]),f=u.useCallback(g=>{console.log("MaiBot Survey submitted:",g)},[]),p=u.useCallback(g=>{console.error("MaiBot Survey submission error:",g)},[]);return r?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):a?e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(xv,{className:"h-8 w-8",strokeWidth:2}),"麦麦使用体验反馈问卷"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"感谢您的反馈,帮助我们打造更好的 AI 伙伴"})]}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(DN,{config:a,initialAnswers:h,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:f,onSubmitError:p})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(pt,{variant:"destructive",className:"max-w-md",children:[e.jsx(Rt,{className:"h-4 w-4"}),e.jsx(gt,{children:"无法加载问卷配置"})]}),e.jsx(_,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}async function JC(a=2025){const l=await Se(`/api/webui/annual-report/full?year=${a}`);if(!l.ok){const r=await l.json();throw new Error(r.detail||"获取年度报告失败")}return l.json()}function XC(a,l){if(a.match(/^[a-z]+:\/\//i))return a;if(a.match(/^\/\//))return window.location.protocol+a;if(a.match(/^[a-z]+:/i))return a;const r=document.implementation.createHTMLDocument(),c=r.createElement("base"),d=r.createElement("a");return r.head.appendChild(c),r.body.appendChild(d),l&&(c.href=l),d.href=a,d.href}const ZC=(()=>{let a=0;const l=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(a+=1,`u${l()}${a}`)})();function vn(a){const l=[];for(let r=0,c=a.length;rDa||a.height>Da)&&(a.width>Da&&a.height>Da?a.width>a.height?(a.height*=Da/a.width,a.width=Da):(a.width*=Da/a.height,a.height=Da):a.width>Da?(a.height*=Da/a.width,a.width=Da):(a.width*=Da/a.height,a.height=Da))}function Wo(a){return new Promise((l,r)=>{const c=new Image;c.onload=()=>{c.decode().then(()=>{requestAnimationFrame(()=>l(c))})},c.onerror=r,c.crossOrigin="anonymous",c.decoding="async",c.src=a})}async function a3(a){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(a)).then(encodeURIComponent).then(l=>`data:image/svg+xml;charset=utf-8,${l}`)}async function l3(a,l,r){const c="http://www.w3.org/2000/svg",d=document.createElementNS(c,"svg"),m=document.createElementNS(c,"foreignObject");return d.setAttribute("width",`${l}`),d.setAttribute("height",`${r}`),d.setAttribute("viewBox",`0 0 ${l} ${r}`),m.setAttribute("width","100%"),m.setAttribute("height","100%"),m.setAttribute("x","0"),m.setAttribute("y","0"),m.setAttribute("externalResourcesRequired","true"),d.appendChild(m),m.appendChild(a),a3(d)}const wa=(a,l)=>{if(a instanceof l)return!0;const r=Object.getPrototypeOf(a);return r===null?!1:r.constructor.name===l.name||wa(r,l)};function n3(a){const l=a.getPropertyValue("content");return`${a.cssText} content: '${l.replace(/'|"/g,"")}';`}function r3(a,l){return ON(l).map(r=>{const c=a.getPropertyValue(r),d=a.getPropertyPriority(r);return`${r}: ${c}${d?" !important":""};`}).join(" ")}function i3(a,l,r,c){const d=`.${a}:${l}`,m=r.cssText?n3(r):r3(r,c);return document.createTextNode(`${d}{${m}}`)}function sj(a,l,r,c){const d=window.getComputedStyle(a,r),m=d.getPropertyValue("content");if(m===""||m==="none")return;const h=ZC();try{l.className=`${l.className} ${h}`}catch{return}const f=document.createElement("style");f.appendChild(i3(h,r,d,c)),l.appendChild(f)}function c3(a,l,r){sj(a,l,":before",r),sj(a,l,":after",r)}const tj="application/font-woff",aj="image/jpeg",o3={woff:tj,woff2:tj,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:aj,jpeg:aj,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function d3(a){const l=/\.([^./]*?)$/g.exec(a);return l?l[1]:""}function Ex(a){const l=d3(a).toLowerCase();return o3[l]||""}function u3(a){return a.split(/,/)[1]}function sx(a){return a.search(/^(data:)/)!==-1}function m3(a,l){return`data:${l};base64,${a}`}async function UN(a,l,r){const c=await fetch(a,l);if(c.status===404)throw new Error(`Resource "${c.url}" not found`);const d=await c.blob();return new Promise((m,h)=>{const f=new FileReader;f.onerror=h,f.onloadend=()=>{try{m(r({res:c,result:f.result}))}catch(p){h(p)}},f.readAsDataURL(d)})}const Gm={};function x3(a,l,r){let c=a.replace(/\?.*/,"");return r&&(c=a),/ttf|otf|eot|woff2?/i.test(c)&&(c=c.replace(/.*\//,"")),l?`[${l}]${c}`:c}async function Mx(a,l,r){const c=x3(a,l,r.includeQueryParams);if(Gm[c]!=null)return Gm[c];r.cacheBust&&(a+=(/\?/.test(a)?"&":"?")+new Date().getTime());let d;try{const m=await UN(a,r.fetchRequestInit,({res:h,result:f})=>(l||(l=h.headers.get("Content-Type")||""),u3(f)));d=m3(m,l)}catch(m){d=r.imagePlaceholder||"";let h=`Failed to fetch resource: ${a}`;m&&(h=typeof m=="string"?m:m.message),h&&console.warn(h)}return Gm[c]=d,d}async function h3(a){const l=a.toDataURL();return l==="data:,"?a.cloneNode(!1):Wo(l)}async function f3(a,l){if(a.currentSrc){const m=document.createElement("canvas"),h=m.getContext("2d");m.width=a.clientWidth,m.height=a.clientHeight,h?.drawImage(a,0,0,m.width,m.height);const f=m.toDataURL();return Wo(f)}const r=a.poster,c=Ex(r),d=await Mx(r,c,l);return Wo(d)}async function p3(a,l){var r;try{if(!((r=a?.contentDocument)===null||r===void 0)&&r.body)return await pd(a.contentDocument.body,l,!0)}catch{}return a.cloneNode(!1)}async function g3(a,l){return wa(a,HTMLCanvasElement)?h3(a):wa(a,HTMLVideoElement)?f3(a,l):wa(a,HTMLIFrameElement)?p3(a,l):a.cloneNode($N(a))}const j3=a=>a.tagName!=null&&a.tagName.toUpperCase()==="SLOT",$N=a=>a.tagName!=null&&a.tagName.toUpperCase()==="SVG";async function v3(a,l,r){var c,d;if($N(l))return l;let m=[];return j3(a)&&a.assignedNodes?m=vn(a.assignedNodes()):wa(a,HTMLIFrameElement)&&(!((c=a.contentDocument)===null||c===void 0)&&c.body)?m=vn(a.contentDocument.body.childNodes):m=vn(((d=a.shadowRoot)!==null&&d!==void 0?d:a).childNodes),m.length===0||wa(a,HTMLVideoElement)||await m.reduce((h,f)=>h.then(()=>pd(f,r)).then(p=>{p&&l.appendChild(p)}),Promise.resolve()),l}function N3(a,l,r){const c=l.style;if(!c)return;const d=window.getComputedStyle(a);d.cssText?(c.cssText=d.cssText,c.transformOrigin=d.transformOrigin):ON(r).forEach(m=>{let h=d.getPropertyValue(m);m==="font-size"&&h.endsWith("px")&&(h=`${Math.floor(parseFloat(h.substring(0,h.length-2)))-.1}px`),wa(a,HTMLIFrameElement)&&m==="display"&&h==="inline"&&(h="block"),m==="d"&&l.getAttribute("d")&&(h=`path(${l.getAttribute("d")})`),c.setProperty(m,h,d.getPropertyPriority(m))})}function b3(a,l){wa(a,HTMLTextAreaElement)&&(l.innerHTML=a.value),wa(a,HTMLInputElement)&&l.setAttribute("value",a.value)}function y3(a,l){if(wa(a,HTMLSelectElement)){const c=Array.from(l.children).find(d=>a.value===d.getAttribute("value"));c&&c.setAttribute("selected","")}}function w3(a,l,r){return wa(l,Element)&&(N3(a,l,r),c3(a,l,r),b3(a,l),y3(a,l)),l}async function _3(a,l){const r=a.querySelectorAll?a.querySelectorAll("use"):[];if(r.length===0)return a;const c={};for(let m=0;mg3(c,l)).then(c=>v3(a,c,l)).then(c=>w3(a,c,l)).then(c=>_3(c,l))}const BN=/url\((['"]?)([^'"]+?)\1\)/g,S3=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,k3=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function C3(a){const l=a.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${l})(['"]?\\))`,"g")}function T3(a){const l=[];return a.replace(BN,(r,c,d)=>(l.push(d),r)),l.filter(r=>!sx(r))}async function E3(a,l,r,c,d){try{const m=r?XC(l,r):l,h=Ex(l);let f;return d||(f=await Mx(m,h,c)),a.replace(C3(l),`$1${f}$3`)}catch{}return a}function M3(a,{preferredFontFormat:l}){return l?a.replace(k3,r=>{for(;;){const[c,,d]=S3.exec(r)||[];if(!d)return"";if(d===l)return`src: ${c};`}}):a}function IN(a){return a.search(BN)!==-1}async function PN(a,l,r){if(!IN(a))return a;const c=M3(a,r);return T3(c).reduce((m,h)=>m.then(f=>E3(f,h,l,r)),Promise.resolve(c))}async function Hr(a,l,r){var c;const d=(c=l.style)===null||c===void 0?void 0:c.getPropertyValue(a);if(d){const m=await PN(d,null,r);return l.style.setProperty(a,m,l.style.getPropertyPriority(a)),!0}return!1}async function A3(a,l){await Hr("background",a,l)||await Hr("background-image",a,l),await Hr("mask",a,l)||await Hr("-webkit-mask",a,l)||await Hr("mask-image",a,l)||await Hr("-webkit-mask-image",a,l)}async function z3(a,l){const r=wa(a,HTMLImageElement);if(!(r&&!sx(a.src))&&!(wa(a,SVGImageElement)&&!sx(a.href.baseVal)))return;const c=r?a.src:a.href.baseVal,d=await Mx(c,Ex(c),l);await new Promise((m,h)=>{a.onload=m,a.onerror=l.onImageErrorHandler?(...p)=>{try{m(l.onImageErrorHandler(...p))}catch(g){h(g)}}:h;const f=a;f.decode&&(f.decode=m),f.loading==="lazy"&&(f.loading="eager"),r?(a.srcset="",a.src=d):a.href.baseVal=d})}async function R3(a,l){const c=vn(a.childNodes).map(d=>FN(d,l));await Promise.all(c).then(()=>a)}async function FN(a,l){wa(a,Element)&&(await A3(a,l),await z3(a,l),await R3(a,l))}function D3(a,l){const{style:r}=a;l.backgroundColor&&(r.backgroundColor=l.backgroundColor),l.width&&(r.width=`${l.width}px`),l.height&&(r.height=`${l.height}px`);const c=l.style;return c!=null&&Object.keys(c).forEach(d=>{r[d]=c[d]}),a}const lj={};async function nj(a){let l=lj[a];if(l!=null)return l;const c=await(await fetch(a)).text();return l={url:a,cssText:c},lj[a]=l,l}async function rj(a,l){let r=a.cssText;const c=/url\(["']?([^"')]+)["']?\)/g,m=(r.match(/url\([^)]+\)/g)||[]).map(async h=>{let f=h.replace(c,"$1");return f.startsWith("https://")||(f=new URL(f,a.url).href),UN(f,l.fetchRequestInit,({result:p})=>(r=r.replace(h,`url(${p})`),[h,p]))});return Promise.all(m).then(()=>r)}function ij(a){if(a==null)return[];const l=[],r=/(\/\*[\s\S]*?\*\/)/gi;let c=a.replace(r,"");const d=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const p=d.exec(c);if(p===null)break;l.push(p[0])}c=c.replace(d,"");const m=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,h="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",f=new RegExp(h,"gi");for(;;){let p=m.exec(c);if(p===null){if(p=f.exec(c),p===null)break;m.lastIndex=f.lastIndex}else f.lastIndex=m.lastIndex;l.push(p[0])}return l}async function O3(a,l){const r=[],c=[];return a.forEach(d=>{if("cssRules"in d)try{vn(d.cssRules||[]).forEach((m,h)=>{if(m.type===CSSRule.IMPORT_RULE){let f=h+1;const p=m.href,g=nj(p).then(N=>rj(N,l)).then(N=>ij(N).forEach(j=>{try{d.insertRule(j,j.startsWith("@import")?f+=1:d.cssRules.length)}catch(y){console.error("Error inserting rule from remote css",{rule:j,error:y})}})).catch(N=>{console.error("Error loading remote css",N.toString())});c.push(g)}})}catch(m){const h=a.find(f=>f.href==null)||document.styleSheets[0];d.href!=null&&c.push(nj(d.href).then(f=>rj(f,l)).then(f=>ij(f).forEach(p=>{h.insertRule(p,h.cssRules.length)})).catch(f=>{console.error("Error loading remote stylesheet",f)})),console.error("Error inlining remote css file",m)}}),Promise.all(c).then(()=>(a.forEach(d=>{if("cssRules"in d)try{vn(d.cssRules||[]).forEach(m=>{r.push(m)})}catch(m){console.error(`Error while reading CSS rules from ${d.href}`,m)}}),r))}function L3(a){return a.filter(l=>l.type===CSSRule.FONT_FACE_RULE).filter(l=>IN(l.style.getPropertyValue("src")))}async function U3(a,l){if(a.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=vn(a.ownerDocument.styleSheets),c=await O3(r,l);return L3(c)}function HN(a){return a.trim().replace(/["']/g,"")}function $3(a){const l=new Set;function r(c){(c.style.fontFamily||getComputedStyle(c).fontFamily).split(",").forEach(m=>{l.add(HN(m))}),Array.from(c.children).forEach(m=>{m instanceof HTMLElement&&r(m)})}return r(a),l}async function B3(a,l){const r=await U3(a,l),c=$3(a);return(await Promise.all(r.filter(m=>c.has(HN(m.style.fontFamily))).map(m=>{const h=m.parentStyleSheet?m.parentStyleSheet.href:null;return PN(m.cssText,h,l)}))).join(` +`)}async function I3(a,l){const r=l.fontEmbedCSS!=null?l.fontEmbedCSS:l.skipFonts?null:await B3(a,l);if(r){const c=document.createElement("style"),d=document.createTextNode(r);c.appendChild(d),a.firstChild?a.insertBefore(c,a.firstChild):a.appendChild(c)}}async function P3(a,l={}){const{width:r,height:c}=LN(a,l),d=await pd(a,l,!0);return await I3(d,l),await FN(d,l),D3(d,l),await l3(d,r,c)}async function F3(a,l={}){const{width:r,height:c}=LN(a,l),d=await P3(a,l),m=await Wo(d),h=document.createElement("canvas"),f=h.getContext("2d"),p=l.pixelRatio||s3(),g=l.canvasWidth||r,N=l.canvasHeight||c;return h.width=g*p,h.height=N*p,l.skipAutoScale||t3(h),h.style.width=`${g}`,h.style.height=`${N}`,l.backgroundColor&&(f.fillStyle=l.backgroundColor,f.fillRect(0,0,h.width,h.height)),f.drawImage(m,0,0,h.width,h.height),h}async function H3(a,l={}){return(await F3(a,l)).toDataURL()}const Lo=["#0088FE","#00C49F","#FFBB28","#FF8042","#8884d8","#82ca9d"];function q3(a){return a>=8760?"相当于全年无休,7x24小时在线!":a>=5e3?"相当于一位全职员工的年工作时长":a>=2e3?"相当于看完了 1000 部电影":a>=1e3?"相当于环球飞行 80 次":a>=500?"相当于读完了 100 本书":a>=100?"相当于马拉松跑了 25 次":"虽然不多,但每一刻都很珍贵"}function V3(a){return a>=1e3?"夜深人静时的知心好友":a>=500?"午夜场的常客":a>=100?"偶尔熬夜的小伙伴":a>=50?"深夜有时也会陪你聊聊":"早睡早起,健康作息"}function G3(a){const l=a/1e6;return l>=100?"思考量堪比一座图书馆":l>=50?"相当于写了一部百科全书":l>=10?"脑细胞估计消耗了不少":l>=1?"也算是费了一番脑筋":"轻轻松松,游刃有余"}function K3(a){return a>=1e3?"这钱够吃一年的泡面了":a>=500?"相当于买了一台游戏机":a>=100?"够请大家喝几杯奶茶":a>=50?"一顿火锅的钱":a>=10?"几杯咖啡的价格":"省钱小能手"}function Q3(a){return a>=80?"沉默是金,惜字如金":a>=60?"话不多但句句到位":a>=40?"该说的时候才开口":a>=20?"能聊的都聊了":"话痨本痨,有问必答"}function Y3(a){return a>=1e4?"眼睛都快看花了":a>=5e3?"堪比专业摄影师的阅片量":a>=1e3?"看图小达人":a>=500?"图片鉴赏家":a>=100?"偶尔欣赏一下美图":"图片?有空再看"}function J3(a){return a>=500?"在不断的纠正中成长":a>=200?"学习永无止境":a>=100?"虚心接受,积极改正":a>=50?"偶尔也会犯错":a>=10?"表现还算不错":"完美表达,无需纠正"}function X3(a){return a>=1?"这次思考的价值堪比一顿大餐!":a>=.5?"为了这个问题,我可是认真思考了!":a>=.1?"下了点功夫,值得的!":a>=.01?"花了点小钱,但很值得":"小小思考,不足挂齿"}function Z3(a,l){return a>=100?"这句话简直是万能钥匙!":a>=50?"百试不爽的经典回复":a>=20?`${l}的口头禅`:a>=10?"常用语录之一":"偶尔用用的小确幸"}function W3(a,l){return a?l>=1e3?"深夜的守护者,黑暗中的光芒":l>=500?"月亮是我的好朋友":l>=100?"越夜越精神,夜晚才是主场":"偶尔熬夜,享受宁静时光":l<=10?"作息规律,健康生活的典范":l<=50?"早睡早起,偶尔也会熬个夜":"虽然是早起鸟,但也会守候深夜"}function e5(a){return a>=1e3?"忙到飞起,键盘都要冒烟了":a>=500?"这天简直是话痨附体":a>=200?"社交达人上线":a>=100?"比平时活跃不少":a>=50?"小忙一下":"还算轻松的一天"}function s5(){const[a]=u.useState(2025),[l,r]=u.useState(null),[c,d]=u.useState(!0),[m,h]=u.useState(!1),[f,p]=u.useState(null),g=u.useRef(null),{toast:N}=it(),j=u.useCallback(async()=>{try{d(!0),p(null);const b=await JC(a);r(b)}catch(b){p(b instanceof Error?b:new Error("获取年度报告失败"))}finally{d(!1)}},[a]),y=u.useCallback(async()=>{if(!(!g.current||!l)){h(!0),N({title:"正在生成图片",description:"请稍候..."});try{const b=g.current,w=getComputedStyle(document.documentElement),A=w.getPropertyValue("--background").trim()?`hsl(${w.getPropertyValue("--background").trim()})`:document.documentElement.classList.contains("dark")?"#0a0a0a":"#ffffff",M=b.style.width,S=b.style.maxWidth;b.style.width="1024px",b.style.maxWidth="1024px";const P=await H3(b,{quality:1,pixelRatio:2,backgroundColor:A,cacheBust:!0,filter:C=>!(C instanceof HTMLElement&&C.hasAttribute("data-export-btn"))});b.style.width=M,b.style.maxWidth=S;const E=document.createElement("a");E.download=`${l.bot_name}_${l.year}_年度总结.png`,E.href=P,E.click(),N({title:"导出成功",description:"年度报告已保存为图片"})}catch(b){console.error("导出图片失败:",b),N({title:"导出失败",description:"请重试",variant:"destructive"})}finally{h(!1)}}},[l,N]);return u.useEffect(()=>{j()},[j]),c?e.jsx(t5,{}):f?e.jsxs("div",{className:"flex h-screen items-center justify-center text-red-500",children:["获取年度报告失败: ",f.message]}):l?e.jsx(ss,{className:"h-[calc(100vh-4rem)]",children:e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-background to-muted/50 p-4 md:p-8 print:p-0",ref:g,children:e.jsxs("div",{className:"mx-auto max-w-5xl space-y-8 print:space-y-4",children:[e.jsxs("header",{className:"relative overflow-hidden rounded-3xl bg-primary p-8 text-primary-foreground shadow-2xl print:rounded-none print:shadow-none",children:[e.jsx("div",{className:"absolute right-4 top-4 z-20 print:hidden","data-export-btn":!0,children:e.jsx(_,{variant:"secondary",size:"sm",onClick:y,disabled:m,className:"gap-2 bg-white/20 hover:bg-white/30 text-white border-white/30",children:m?e.jsxs(e.Fragment,{children:[e.jsx(Fs,{className:"h-4 w-4 animate-spin"}),"导出中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(na,{className:"h-4 w-4"}),"保存图片"]})})}),e.jsxs("div",{className:"relative z-10 flex flex-col items-center text-center",children:[e.jsx(Kn,{className:"mb-4 h-16 w-16 animate-bounce"}),e.jsxs("h1",{className:"text-4xl font-bold tracking-tighter sm:text-6xl",children:[l.bot_name," ",l.year," 年度总结"]}),e.jsx("p",{className:"mt-4 max-w-2xl text-lg opacity-90",children:"连接与成长 · Connection & Growth"}),e.jsxs("div",{className:"mt-6 flex items-center gap-2 text-sm opacity-75",children:[e.jsx(Vo,{className:"h-4 w-4"}),e.jsxs("span",{children:["生成时间: ",l.generated_at]})]})]}),e.jsx("div",{className:"absolute -right-20 -top-20 h-64 w-64 rounded-full bg-white/10 blur-3xl"}),e.jsx("div",{className:"absolute -bottom-20 -left-20 h-64 w-64 rounded-full bg-white/10 blur-3xl"})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(ia,{className:"h-8 w-8"}),e.jsx("h2",{children:"时光足迹"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[e.jsx(Oa,{title:"年度在线时长",value:`${l.time_footprint.total_online_hours} 小时`,description:q3(l.time_footprint.total_online_hours),icon:e.jsx(ia,{className:"h-4 w-4"})}),e.jsx(Oa,{title:"最忙碌的一天",value:l.time_footprint.busiest_day||"N/A",description:e5(l.time_footprint.busiest_day_count),icon:e.jsx(Vo,{className:"h-4 w-4"})}),e.jsx(Oa,{title:"深夜互动 (0-4点)",value:`${l.time_footprint.midnight_chat_count} 次`,description:V3(l.time_footprint.midnight_chat_count),icon:e.jsx(ec,{className:"h-4 w-4"})}),e.jsx(Oa,{title:"作息属性",value:l.time_footprint.is_night_owl?"夜猫子":"早起鸟",description:W3(l.time_footprint.is_night_owl,l.time_footprint.midnight_chat_count),icon:l.time_footprint.is_night_owl?e.jsx(ec,{className:"h-4 w-4"}):e.jsx(nx,{className:"h-4 w-4"})})]}),e.jsxs(Ce,{className:"overflow-hidden",children:[e.jsxs(De,{children:[e.jsx(Ue,{children:"24小时活跃时钟"}),e.jsxs(fs,{children:[l.bot_name,"在一天中各个时段的活跃程度"]})]}),e.jsx(Ae,{className:"h-[300px]",children:e.jsx(zj,{width:"100%",height:"100%",children:e.jsxs(Uo,{data:l.time_footprint.hourly_distribution.map((b,w)=>({hour:`${w}点`,count:b})),children:[e.jsx(Qi,{strokeDasharray:"3 3",vertical:!1}),e.jsx(Yi,{dataKey:"hour"}),e.jsx(qr,{}),e.jsx(Rj,{contentStyle:{borderRadius:"8px",border:"none",boxShadow:"0 4px 12px rgba(0,0,0,0.1)"},cursor:{fill:"transparent"}}),e.jsx(Ji,{dataKey:"count",fill:"hsl(var(--primary))",radius:[4,4,0,0]})]})})})]}),l.time_footprint.first_message_time&&e.jsx(Ce,{className:"bg-muted/30 border-dashed",children:e.jsxs(Ae,{className:"flex flex-col items-center justify-center p-6 text-center",children:[e.jsx("p",{className:"text-muted-foreground mb-2",children:"2025年的故事开始于"}),e.jsx("div",{className:"text-xl font-bold text-primary mb-1",children:l.time_footprint.first_message_time}),e.jsxs("p",{className:"text-lg",children:[e.jsx("span",{className:"font-semibold text-foreground",children:l.time_footprint.first_message_user})," 说:",e.jsxs("span",{className:"italic text-muted-foreground",children:['"',l.time_footprint.first_message_content,'"']})]})]})})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(ic,{className:"h-8 w-8"}),e.jsx("h2",{children:"社交网络"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(Oa,{title:"社交圈子",value:`${l.social_network.total_groups} 个群组`,description:`${l.bot_name}加入的群组总数`,icon:e.jsx(ic,{className:"h-4 w-4"})}),e.jsx(Oa,{title:"被呼叫次数",value:`${l.social_network.at_count+l.social_network.mentioned_count} 次`,description:"我的名字被大家频繁提起",icon:e.jsx(K1,{className:"h-4 w-4"})}),e.jsx(Oa,{title:"最长情陪伴",value:l.social_network.longest_companion_user||"N/A",description:`始终都在,已陪伴 ${l.social_network.longest_companion_days} 天`,icon:e.jsx(Zr,{className:"h-4 w-4 text-red-500"})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Ce,{children:[e.jsx(De,{children:e.jsx(Ue,{children:"话痨群组 TOP5"})}),e.jsx(Ae,{children:e.jsx("div",{className:"space-y-3",children:l.social_network.top_groups.length>0?l.social_network.top_groups.map((b,w)=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ke,{variant:w===0?"default":"secondary",className:"h-6 w-6 rounded-full p-0 flex items-center justify-center shrink-0",children:w+1}),e.jsx("span",{className:"font-medium truncate max-w-[120px]",children:b.group_name}),b.is_webui&&e.jsx(ke,{variant:"outline",className:"text-xs px-1.5 py-0 h-5 bg-blue-50 text-blue-600 border-blue-200",children:"WebUI"})]}),e.jsxs("span",{className:"text-muted-foreground text-sm shrink-0",children:[b.message_count," 条消息"]})]},b.group_id)):e.jsx("div",{className:"text-center text-muted-foreground py-4",children:"暂无数据"})})})]}),e.jsxs(Ce,{children:[e.jsx(De,{children:e.jsx(Ue,{children:"年度最佳损友 TOP5"})}),e.jsx(Ae,{children:e.jsx("div",{className:"space-y-3",children:l.social_network.top_users.length>0?l.social_network.top_users.map((b,w)=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ke,{variant:w===0?"default":"secondary",className:"h-6 w-6 rounded-full p-0 flex items-center justify-center shrink-0",children:w+1}),e.jsx("span",{className:"font-medium truncate max-w-[120px]",children:b.user_nickname}),b.is_webui&&e.jsx(ke,{variant:"outline",className:"text-xs px-1.5 py-0 h-5 bg-blue-50 text-blue-600 border-blue-200",children:"WebUI"})]}),e.jsxs("span",{className:"text-muted-foreground text-sm shrink-0",children:[b.message_count," 次互动"]})]},b.user_id)):e.jsx("div",{className:"text-center text-muted-foreground py-4",children:"暂无数据"})})})]})]})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(dx,{className:"h-8 w-8"}),e.jsx("h2",{children:"最强大脑"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[e.jsx(Oa,{title:"年度 Token 消耗",value:(l.brain_power.total_tokens/1e6).toFixed(2)+" M",description:G3(l.brain_power.total_tokens),icon:e.jsx(el,{className:"h-4 w-4"})}),e.jsx(Oa,{title:"年度总花费",value:`$${l.brain_power.total_cost.toFixed(2)}`,description:K3(l.brain_power.total_cost),icon:e.jsx("span",{className:"font-bold",children:"$"})}),e.jsx(Oa,{title:"高冷指数",value:`${l.brain_power.silence_rate}%`,description:Q3(l.brain_power.silence_rate),icon:e.jsx(ec,{className:"h-4 w-4"})}),e.jsx(Oa,{title:"最高兴趣值",value:l.brain_power.max_interest_value??"N/A",description:l.brain_power.max_interest_time?`出现在 ${l.brain_power.max_interest_time}`:"暂无数据",icon:e.jsx(Zr,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Ce,{children:[e.jsx(De,{children:e.jsx(Ue,{children:"模型偏好分布"})}),e.jsx(Ae,{children:e.jsx("div",{className:"space-y-3",children:l.brain_power.model_distribution.slice(0,5).map((b,w)=>{const A=l.brain_power.model_distribution[0]?.count||1,M=Math.round(b.count/A*100);return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"font-medium truncate max-w-[200px]",children:b.model}),e.jsxs("span",{className:"text-muted-foreground",children:[b.count.toLocaleString()," 次"]})]}),e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:e.jsx("div",{className:"h-full transition-all duration-500",style:{width:`${M}%`,backgroundColor:Lo[w%Lo.length]}})})]},b.model)})})})]}),l.brain_power.top_reply_models&&l.brain_power.top_reply_models.length>0&&e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Ue,{children:"最喜欢的回复模型 TOP5"}),e.jsxs(fs,{children:[l.bot_name,"用来回复消息的模型偏好"]})]}),e.jsx(Ae,{children:e.jsx("div",{className:"space-y-3",children:l.brain_power.top_reply_models.map((b,w)=>{const A=l.brain_power.top_reply_models[0]?.count||1,M=Math.round(b.count/A*100);return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"font-medium truncate max-w-[200px]",children:b.model}),e.jsxs("span",{className:"text-muted-foreground",children:[b.count.toLocaleString()," 次"]})]}),e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:e.jsx("div",{className:"h-full transition-all duration-500",style:{width:`${M}%`,backgroundColor:Lo[w%Lo.length]}})})]},b.model)})})})]}),l.brain_power.top_token_consumers&&l.brain_power.top_token_consumers.length>0&&e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Ue,{children:"烧钱大户 TOP3"}),e.jsx(fs,{children:"谁消耗了最多的 API 额度"})]}),e.jsx(Ae,{children:e.jsx("div",{className:"space-y-6",children:l.brain_power.top_token_consumers.map(b=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between text-sm font-medium",children:[e.jsxs("span",{children:["用户 ",b.user_id]}),e.jsxs("span",{children:["$",b.cost.toFixed(2)]})]}),e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:e.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${b.cost/(l.brain_power.top_token_consumers[0]?.cost||1)*100}%`}})})]},b.user_id))})})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Ce,{className:"bg-gradient-to-br from-amber-50 to-orange-50 dark:from-amber-950/20 dark:to-orange-950/20",children:[e.jsx(De,{children:e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"💰"}),"最昂贵的一次思考"]})}),e.jsxs(Ae,{className:"text-center",children:[e.jsxs("div",{className:"text-4xl font-bold text-amber-600 dark:text-amber-400",children:["$",l.brain_power.most_expensive_cost.toFixed(4)]}),l.brain_power.most_expensive_time&&e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["发生在 ",l.brain_power.most_expensive_time]}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:X3(l.brain_power.most_expensive_cost)})]})]}),e.jsxs(Ce,{className:"bg-gradient-to-br from-indigo-50 to-blue-50 dark:from-indigo-950/20 dark:to-blue-950/20",children:[e.jsx(De,{children:e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"🧠"}),"思考深度"]})}),e.jsxs(Ae,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-center",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-indigo-600 dark:text-indigo-400",children:l.brain_power.avg_reasoning_length?.toFixed(0)||0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"平均思考字数"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-blue-600 dark:text-blue-400",children:l.brain_power.max_reasoning_length?.toLocaleString()||0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"最长思考字数"})]})]}),l.brain_power.max_reasoning_time&&e.jsxs("p",{className:"mt-4 text-center text-xs text-muted-foreground",children:["最深沉的思考发生在 ",l.brain_power.max_reasoning_time]})]})]})]})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(ld,{className:"h-8 w-8"}),e.jsx("h2",{children:"个性与表达"})]}),(l.expression_vibe.late_night_reply||l.expression_vibe.favorite_reply)&&e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[l.expression_vibe.late_night_reply&&e.jsxs(Ce,{className:"bg-gradient-to-br from-indigo-50 to-violet-50 dark:from-indigo-950/20 dark:to-violet-950/20",children:[e.jsxs(De,{children:[e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"🌙"}),"深夜还在回复"]}),e.jsxs(fs,{children:["凌晨 ",l.expression_vibe.late_night_reply.time,",",l.bot_name,"还在回复..."]})]}),e.jsxs(Ae,{className:"text-center",children:[e.jsxs("p",{className:"text-lg italic text-muted-foreground",children:['"',l.expression_vibe.late_night_reply.content,'"']}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"是有什么心事吗?"})]})]}),l.expression_vibe.favorite_reply&&e.jsxs(Ce,{className:"bg-gradient-to-br from-rose-50 to-pink-50 dark:from-rose-950/20 dark:to-pink-950/20",children:[e.jsxs(De,{children:[e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"💬"}),"最喜欢的回复"]}),e.jsxs(fs,{children:["使用了 ",l.expression_vibe.favorite_reply.count," 次"]})]}),e.jsxs(Ae,{className:"text-center",children:[e.jsxs("p",{className:"text-lg font-medium text-primary",children:['"',l.expression_vibe.favorite_reply.content,'"']}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:Z3(l.expression_vibe.favorite_reply.count,l.bot_name)})]})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Ce,{className:"bg-gradient-to-br from-pink-50 to-purple-50 dark:from-pink-950/20 dark:to-purple-950/20",children:[e.jsxs(De,{children:[e.jsx(Ue,{children:"使用最多的表情包 TOP3"}),e.jsx(fs,{children:"年度最爱的表情包们"})]}),e.jsx(Ae,{children:l.expression_vibe.top_emojis&&l.expression_vibe.top_emojis.length>0?e.jsx("div",{className:"flex justify-center gap-4",children:l.expression_vibe.top_emojis.slice(0,3).map((b,w)=>e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:`/api/webui/emoji/${b.id}/thumbnail?original=true`,alt:`TOP ${w+1}`,className:"h-24 w-24 rounded-lg object-cover shadow-md transition-transform hover:scale-105"}),e.jsx(ke,{className:F("absolute -top-2 -right-2",w===0?"bg-yellow-500":w===1?"bg-gray-400":"bg-amber-700"),children:w+1})]}),e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[b.usage_count," 次"]})]},b.id))}):e.jsx("div",{className:"flex h-32 items-center justify-center text-muted-foreground",children:"暂无数据"})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Ue,{children:"印象最深刻的表达风格"}),e.jsxs(fs,{children:[l.bot_name,"最常使用的表达方式"]})]}),e.jsx(Ae,{children:e.jsx("div",{className:"flex flex-wrap gap-2",children:l.expression_vibe.top_expressions.map((b,w)=>e.jsxs(ke,{variant:"outline",className:F("px-3 py-1 text-sm",w===0&&"border-primary bg-primary/10 text-primary text-base px-4 py-2"),children:[b.style," (",b.count,")"]},b.style))})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Oa,{title:"图片鉴赏",value:`${l.expression_vibe.image_processed_count} 张`,description:Y3(l.expression_vibe.image_processed_count),icon:e.jsx(ox,{className:"h-4 w-4"})}),e.jsx(Oa,{title:"成长的足迹",value:`${l.expression_vibe.rejected_expression_count} 次`,description:J3(l.expression_vibe.rejected_expression_count),icon:e.jsx(el,{className:"h-4 w-4"})})]})]})]}),l.expression_vibe.action_types.length>0&&e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"⚡"}),"行动派"]}),e.jsx(fs,{children:"除了聊天,我还帮大家做了这些事"})]}),e.jsx(Ae,{children:e.jsx("div",{className:"flex flex-wrap gap-3",children:l.expression_vibe.action_types.map(b=>e.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-primary/10 px-4 py-2",children:[e.jsx("span",{className:"font-medium text-primary",children:b.action}),e.jsxs(ke,{variant:"secondary",children:[b.count," 次"]})]},b.action))})})]})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(Q1,{className:"h-8 w-8"}),e.jsx("h2",{children:"趣味成就"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs(Ce,{className:"col-span-1 md:col-span-2",children:[e.jsxs(De,{children:[e.jsx(Ue,{children:'新学到的"黑话"'}),e.jsxs(fs,{children:["今年我学会了 ",l.achievements.new_jargon_count," 个新词"]})]}),e.jsx(Ae,{children:e.jsx("div",{className:"flex flex-wrap gap-3",children:l.achievements.sample_jargons.map(b=>e.jsxs("div",{className:"group relative rounded-lg border bg-card p-3 shadow-sm transition-all hover:shadow-md",children:[e.jsx("div",{className:"font-bold text-primary",children:b.content}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1 line-clamp-2 max-w-[200px]",children:b.meaning||"暂无解释"})]},b.content))})})]}),e.jsx(Ce,{className:"flex flex-col justify-center items-center bg-primary text-primary-foreground",children:e.jsxs(Ae,{className:"flex flex-col items-center justify-center p-6 text-center",children:[e.jsx(Ba,{className:"h-12 w-12 mb-4 opacity-80"}),e.jsx("div",{className:"text-4xl font-bold mb-2",children:l.achievements.total_messages.toLocaleString()}),e.jsx("div",{className:"text-sm opacity-80",children:"年度总消息数"}),e.jsxs("div",{className:"mt-4 text-xs opacity-60",children:["其中回复了 ",l.achievements.total_replies.toLocaleString()," 次"]})]})})]})]}),e.jsxs("footer",{className:"mt-12 text-center text-muted-foreground",children:[e.jsx("p",{children:"MaiBot 2025 Annual Report"}),e.jsx("p",{className:"text-sm",children:"Generated with ❤️ by MaiBot Team"})]})]})})}):null}function Oa({title:a,value:l,description:r,icon:c}){return e.jsxs(Ce,{children:[e.jsxs(De,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:a}),e.jsx("div",{className:"text-muted-foreground",children:c})]}),e.jsxs(Ae,{children:[e.jsx("div",{className:"text-2xl font-bold",children:l}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r})]})]})}function t5(){return e.jsxs("div",{className:"container mx-auto space-y-8 p-8",children:[e.jsx(As,{className:"h-64 w-full rounded-3xl"}),e.jsx("div",{className:"grid gap-4 md:grid-cols-4",children:[...Array(4)].map((a,l)=>e.jsx(As,{className:"h-32 w-full"},l))}),e.jsx(As,{className:"h-96 w-full"})]})}var gd="DropdownMenu",[a5]=td(gd,[Mj]),ha=Mj(),[l5,qN]=a5(gd),VN=a=>{const{__scopeDropdownMenu:l,children:r,dir:c,open:d,defaultOpen:m,onOpenChange:h,modal:f=!0}=a,p=ha(l),g=u.useRef(null),[N,j]=sd({prop:d,defaultProp:m??!1,onChange:h,caller:gd});return e.jsx(l5,{scope:l,triggerId:Qm(),triggerRef:g,contentId:Qm(),open:N,onOpenChange:j,onOpenToggle:u.useCallback(()=>j(y=>!y),[j]),modal:f,children:e.jsx(Iw,{...p,open:N,onOpenChange:j,dir:c,modal:f,children:r})})};VN.displayName=gd;var GN="DropdownMenuTrigger",KN=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,disabled:c=!1,...d}=a,m=qN(GN,r),h=ha(r);return e.jsx(Pw,{asChild:!0,...h,children:e.jsx(sr.button,{type:"button",id:m.triggerId,"aria-haspopup":"menu","aria-expanded":m.open,"aria-controls":m.open?m.contentId:void 0,"data-state":m.open?"open":"closed","data-disabled":c?"":void 0,disabled:c,...d,ref:f1(l,m.triggerRef),onPointerDown:Nn(a.onPointerDown,f=>{!c&&f.button===0&&f.ctrlKey===!1&&(m.onOpenToggle(),m.open||f.preventDefault())}),onKeyDown:Nn(a.onKeyDown,f=>{c||(["Enter"," "].includes(f.key)&&m.onOpenToggle(),f.key==="ArrowDown"&&m.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(f.key)&&f.preventDefault())})})})});KN.displayName=GN;var n5="DropdownMenuPortal",QN=a=>{const{__scopeDropdownMenu:l,...r}=a,c=ha(l);return e.jsx(zw,{...c,...r})};QN.displayName=n5;var YN="DropdownMenuContent",JN=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=qN(YN,r),m=ha(r),h=u.useRef(!1);return e.jsx(Rw,{id:d.contentId,"aria-labelledby":d.triggerId,...m,...c,ref:l,onCloseAutoFocus:Nn(a.onCloseAutoFocus,f=>{h.current||d.triggerRef.current?.focus(),h.current=!1,f.preventDefault()}),onInteractOutside:Nn(a.onInteractOutside,f=>{const p=f.detail.originalEvent,g=p.button===0&&p.ctrlKey===!0,N=p.button===2||g;(!d.modal||N)&&(h.current=!0)}),style:{...a.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});JN.displayName=YN;var r5="DropdownMenuGroup",i5=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=ha(r);return e.jsx(Fw,{...d,...c,ref:l})});i5.displayName=r5;var c5="DropdownMenuLabel",XN=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=ha(r);return e.jsx($w,{...d,...c,ref:l})});XN.displayName=c5;var o5="DropdownMenuItem",ZN=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=ha(r);return e.jsx(Dw,{...d,...c,ref:l})});ZN.displayName=o5;var d5="DropdownMenuCheckboxItem",WN=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=ha(r);return e.jsx(Ow,{...d,...c,ref:l})});WN.displayName=d5;var u5="DropdownMenuRadioGroup",m5=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=ha(r);return e.jsx(Hw,{...d,...c,ref:l})});m5.displayName=u5;var x5="DropdownMenuRadioItem",eb=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=ha(r);return e.jsx(Uw,{...d,...c,ref:l})});eb.displayName=x5;var h5="DropdownMenuItemIndicator",sb=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=ha(r);return e.jsx(Lw,{...d,...c,ref:l})});sb.displayName=h5;var f5="DropdownMenuSeparator",tb=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=ha(r);return e.jsx(Bw,{...d,...c,ref:l})});tb.displayName=f5;var p5="DropdownMenuArrow",g5=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=ha(r);return e.jsx(qw,{...d,...c,ref:l})});g5.displayName=p5;var j5="DropdownMenuSubTrigger",ab=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=ha(r);return e.jsx(Mw,{...d,...c,ref:l})});ab.displayName=j5;var v5="DropdownMenuSubContent",lb=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=ha(r);return e.jsx(Aw,{...d,...c,ref:l,style:{...a.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});lb.displayName=v5;var N5=VN,b5=KN,y5=QN,nb=JN,rb=XN,ib=ZN,cb=WN,ob=eb,db=sb,ub=tb,mb=ab,xb=lb;const w5=N5,_5=b5,S5=u.forwardRef(({className:a,inset:l,children:r,...c},d)=>e.jsxs(mb,{ref:d,className:F("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",l&&"pl-8",a),...c,children:[r,e.jsx(ra,{className:"ml-auto h-4 w-4"})]}));S5.displayName=mb.displayName;const k5=u.forwardRef(({className:a,...l},r)=>e.jsx(xb,{ref:r,className:F("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a),...l}));k5.displayName=xb.displayName;const hb=u.forwardRef(({className:a,sideOffset:l=4,...r},c)=>e.jsx(y5,{children:e.jsx(nb,{ref:c,sideOffset:l,className:F("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a),...r})}));hb.displayName=nb.displayName;const fb=u.forwardRef(({className:a,inset:l,...r},c)=>e.jsx(ib,{ref:c,className:F("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",l&&"pl-8",a),...r}));fb.displayName=ib.displayName;const C5=u.forwardRef(({className:a,children:l,checked:r,...c},d)=>e.jsxs(cb,{ref:d,className:F("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),checked:r,...c,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(db,{children:e.jsx(Lt,{className:"h-4 w-4"})})}),l]}));C5.displayName=cb.displayName;const T5=u.forwardRef(({className:a,children:l,...r},c)=>e.jsxs(ob,{ref:c,className:F("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(db,{children:e.jsx(Ho,{className:"h-2 w-2 fill-current"})})}),l]}));T5.displayName=ob.displayName;const E5=u.forwardRef(({className:a,inset:l,...r},c)=>e.jsx(rb,{ref:c,className:F("px-2 py-1.5 text-sm font-semibold",l&&"pl-8",a),...r}));E5.displayName=rb.displayName;const M5=u.forwardRef(({className:a,...l},r)=>e.jsx(ub,{ref:r,className:F("-mx-1 my-1 h-px bg-muted",a),...l}));M5.displayName=ub.displayName;const Km=[{value:"created_at",label:"最新发布",icon:ia},{value:"downloads",label:"下载最多",icon:na},{value:"likes",label:"最受欢迎",icon:Zr}];function A5(){const a=xa(),[l,r]=u.useState([]),[c,d]=u.useState(!0),[m,h]=u.useState(""),[f,p]=u.useState("downloads"),[g,N]=u.useState(1),[j,y]=u.useState(1),[b,w]=u.useState(0),[A,M]=u.useState(new Set),[S,P]=u.useState(new Set),E=tN(),C=u.useCallback(async()=>{d(!0);try{const L=await n4({status:"approved",page:g,page_size:12,search:m||void 0,sort_by:f,sort_order:"desc"});r(L.packs),y(L.total_pages),w(L.total);const me=new Set;for(const Ne of L.packs)await sN(Ne.id,E)&&me.add(Ne.id);M(me)}catch(L){console.error("加载 Pack 列表失败:",L),aa({title:"加载 Pack 列表失败",variant:"destructive"})}finally{d(!1)}},[g,m,f,E]);u.useEffect(()=>{C()},[C]);const R=L=>{L.preventDefault(),N(1),C()},H=async L=>{if(!S.has(L)){P(me=>new Set(me).add(L));try{const me=await eN(L,E);M(Ne=>{const je=new Set(Ne);return me.liked?je.add(L):je.delete(L),je}),r(Ne=>Ne.map(je=>je.id===L?{...je,likes:me.likes}:je))}catch(me){console.error("点赞失败:",me),aa({title:"点赞失败",variant:"destructive"})}finally{P(me=>{const Ne=new Set(me);return Ne.delete(L),Ne})}}},O=L=>{a({to:"/config/pack-market/$packId",params:{packId:L}})},X=Km.find(L=>L.value===f)||Km[0];return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(ua,{className:"h-8 w-8",strokeWidth:2}),"配置模板市场"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"浏览和应用社区分享的模型配置模板,快速配置你的 MaiBot"})]}),e.jsxs(_,{variant:"outline",onClick:C,disabled:c,className:"gap-2",children:[e.jsx(ut,{className:`h-4 w-4 ${c?"animate-spin":""}`}),"刷新"]})]})}),e.jsx(ss,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-4 flex-wrap",children:[e.jsx("form",{onSubmit:R,className:"flex-1 min-w-[200px] max-w-md",children:e.jsxs("div",{className:"relative",children:[e.jsx(Ut,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"搜索模板名称、描述...",value:m,onChange:L=>h(L.target.value),className:"pl-10"})]})}),e.jsxs(w5,{children:[e.jsx(_5,{asChild:!0,children:e.jsxs(_,{variant:"outline",className:"min-w-[140px] gap-2",children:[e.jsx(Y1,{className:"w-4 h-4"}),X.label,e.jsx($a,{className:"w-4 h-4 ml-auto"})]})}),e.jsx(hb,{align:"end",children:Km.map(L=>e.jsxs(fb,{onClick:()=>{p(L.value),N(1)},children:[e.jsx(L.icon,{className:"w-4 h-4 mr-2"}),L.label]},L.value))})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共找到 ",e.jsx("span",{className:"font-medium text-foreground",children:b})," 个模板"]}),c?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Array.from({length:6}).map((L,me)=>e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(As,{className:"h-6 w-3/4"}),e.jsx(As,{className:"h-4 w-full mt-2"})]}),e.jsx(Ae,{children:e.jsx(As,{className:"h-20 w-full"})}),e.jsx(id,{children:e.jsx(As,{className:"h-9 w-full"})})]},me))}):l.length===0?e.jsx(Ce,{className:"py-12",children:e.jsxs(Ae,{className:"text-center text-muted-foreground",children:[e.jsx(ua,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{className:"text-lg font-medium",children:"暂无模板"}),e.jsx("p",{className:"mt-1",children:"还没有人分享配置模板,快来分享第一个吧!"})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:l.map(L=>e.jsx(z5,{pack:L,liked:A.has(L.id),liking:S.has(L.id),onLike:()=>H(L.id),onView:()=>O(L.id)},L.id))}),j>1&&e.jsx(ux,{children:e.jsxs(mx,{children:[e.jsx(Yn,{children:e.jsx(Ov,{onClick:()=>N(L=>Math.max(1,L-1)),className:g===1?"pointer-events-none opacity-50":"cursor-pointer"})}),Array.from({length:j},(L,me)=>me+1).filter(L=>L===1||L===j||Math.abs(L-g)<=1).map((L,me,Ne)=>{const je=me>0&&L-Ne[me-1]>1;return e.jsxs(Yn,{children:[je&&e.jsx("span",{className:"px-2",children:"..."}),e.jsx(pc,{onClick:()=>N(L),isActive:L===g,className:"cursor-pointer",children:L})]},L)}),e.jsx(Yn,{children:e.jsx(Lv,{onClick:()=>N(L=>Math.min(j,L+1)),className:g===j?"pointer-events-none opacity-50":"cursor-pointer"})})]})})]})})]})}function z5({pack:a,liked:l,liking:r,onLike:c,onView:d}){const m=h=>new Date(h).toLocaleDateString("zh-CN",{year:"numeric",month:"short",day:"numeric"});return e.jsxs(Ce,{className:"flex flex-col hover:shadow-md transition-shadow",children:[e.jsxs(De,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(Ue,{className:"text-lg line-clamp-1",children:a.name}),e.jsxs(ke,{variant:"secondary",className:"text-xs",children:["v",a.version]})]}),e.jsx(fs,{className:"line-clamp-2 min-h-[40px]",children:a.description})]}),e.jsxs(Ae,{className:"flex-1 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx($l,{className:"w-3.5 h-3.5"}),a.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ia,{className:"w-3.5 h-3.5"}),m(a.created_at)]})]}),e.jsxs("div",{className:"flex gap-4 text-sm",children:[e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"提供商数量",children:[e.jsx(Bl,{className:"w-3.5 h-3.5"}),a.provider_count]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"模型数量",children:[e.jsx(Xn,{className:"w-3.5 h-3.5"}),a.model_count]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"任务配置数",children:[e.jsx(Zn,{className:"w-3.5 h-3.5"}),a.task_count]})]}),a.tags&&a.tags.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-1",children:[a.tags.slice(0,3).map(h=>e.jsxs(ke,{variant:"outline",className:"text-xs",children:[e.jsx(rd,{className:"w-2.5 h-2.5 mr-1"}),h]},h)),a.tags.length>3&&e.jsxs(ke,{variant:"outline",className:"text-xs",children:["+",a.tags.length-3]})]})]}),e.jsx(id,{className:"pt-3 border-t",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(na,{className:"w-4 h-4"}),a.downloads]}),e.jsxs("button",{onClick:h=>{h.stopPropagation(),c()},disabled:r,className:`flex items-center gap-1 transition-colors ${l?"text-red-500":"hover:text-red-500"} ${r?"opacity-50":""}`,children:[e.jsx(Zr,{className:`w-4 h-4 ${l?"fill-current":""}`}),a.likes]})]}),e.jsx(_,{size:"sm",onClick:d,children:"查看详情"})]})})]})}var il="Accordion",R5=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Ax,D5,O5]=p1(il),[jd]=td(il,[O5,Aj]),zx=Aj(),pb=Hs.forwardRef((a,l)=>{const{type:r,...c}=a,d=c,m=c;return e.jsx(Ax.Provider,{scope:a.__scopeAccordion,children:r==="multiple"?e.jsx(B5,{...m,ref:l}):e.jsx($5,{...d,ref:l})})});pb.displayName=il;var[gb,L5]=jd(il),[jb,U5]=jd(il,{collapsible:!1}),$5=Hs.forwardRef((a,l)=>{const{value:r,defaultValue:c,onValueChange:d=()=>{},collapsible:m=!1,...h}=a,[f,p]=sd({prop:r,defaultProp:c??"",onChange:d,caller:il});return e.jsx(gb,{scope:a.__scopeAccordion,value:Hs.useMemo(()=>f?[f]:[],[f]),onItemOpen:p,onItemClose:Hs.useCallback(()=>m&&p(""),[m,p]),children:e.jsx(jb,{scope:a.__scopeAccordion,collapsible:m,children:e.jsx(vb,{...h,ref:l})})})}),B5=Hs.forwardRef((a,l)=>{const{value:r,defaultValue:c,onValueChange:d=()=>{},...m}=a,[h,f]=sd({prop:r,defaultProp:c??[],onChange:d,caller:il}),p=Hs.useCallback(N=>f((j=[])=>[...j,N]),[f]),g=Hs.useCallback(N=>f((j=[])=>j.filter(y=>y!==N)),[f]);return e.jsx(gb,{scope:a.__scopeAccordion,value:h,onItemOpen:p,onItemClose:g,children:e.jsx(jb,{scope:a.__scopeAccordion,collapsible:!0,children:e.jsx(vb,{...m,ref:l})})})}),[I5,vd]=jd(il),vb=Hs.forwardRef((a,l)=>{const{__scopeAccordion:r,disabled:c,dir:d,orientation:m="vertical",...h}=a,f=Hs.useRef(null),p=ad(f,l),g=D5(r),j=Kj(d)==="ltr",y=Nn(a.onKeyDown,b=>{if(!R5.includes(b.key))return;const w=b.target,A=g().filter(X=>!X.ref.current?.disabled),M=A.findIndex(X=>X.ref.current===w),S=A.length;if(M===-1)return;b.preventDefault();let P=M;const E=0,C=S-1,R=()=>{P=M+1,P>C&&(P=E)},H=()=>{P=M-1,P{const{__scopeAccordion:r,value:c,...d}=a,m=vd(ed,r),h=L5(ed,r),f=zx(r),p=Qm(),g=c&&h.value.includes(c)||!1,N=m.disabled||a.disabled;return e.jsx(P5,{scope:r,open:g,disabled:N,triggerId:p,children:e.jsx(Sj,{"data-orientation":m.orientation,"data-state":kb(g),...f,...d,ref:l,disabled:N,open:g,onOpenChange:j=>{j?h.onItemOpen(c):h.onItemClose(c)}})})});Nb.displayName=ed;var bb="AccordionHeader",yb=Hs.forwardRef((a,l)=>{const{__scopeAccordion:r,...c}=a,d=vd(il,r),m=Rx(bb,r);return e.jsx(sr.h3,{"data-orientation":d.orientation,"data-state":kb(m.open),"data-disabled":m.disabled?"":void 0,...c,ref:l})});yb.displayName=bb;var tx="AccordionTrigger",wb=Hs.forwardRef((a,l)=>{const{__scopeAccordion:r,...c}=a,d=vd(il,r),m=Rx(tx,r),h=U5(tx,r),f=zx(r);return e.jsx(Ax.ItemSlot,{scope:r,children:e.jsx(Vw,{"aria-disabled":m.open&&!h.collapsible||void 0,"data-orientation":d.orientation,id:m.triggerId,...f,...c,ref:l})})});wb.displayName=tx;var _b="AccordionContent",Sb=Hs.forwardRef((a,l)=>{const{__scopeAccordion:r,...c}=a,d=vd(il,r),m=Rx(_b,r),h=zx(r);return e.jsx(Gw,{role:"region","aria-labelledby":m.triggerId,"data-orientation":d.orientation,...h,...c,ref:l,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...a.style}})});Sb.displayName=_b;function kb(a){return a?"open":"closed"}var F5=pb,H5=Nb,q5=yb,Cb=wb,Tb=Sb;const V5=F5,Eb=u.forwardRef(({className:a,...l},r)=>e.jsx(H5,{ref:r,className:F("border-b",a),...l}));Eb.displayName="AccordionItem";const Mb=u.forwardRef(({className:a,children:l,...r},c)=>e.jsx(q5,{className:"flex",children:e.jsxs(Cb,{ref:c,className:F("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",a),...r,children:[l,e.jsx($a,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));Mb.displayName=Cb.displayName;const Ab=u.forwardRef(({className:a,children:l,...r},c)=>e.jsx(Tb,{ref:c,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:e.jsx("div",{className:F("pb-4 pt-0",a),children:l})}));Ab.displayName=Tb.displayName;const G5={utils:"通用工具",utils_small:"轻量工具",tool_use:"工具调用",replyer:"回复生成",planner:"规划推理",vlm:"视觉模型",voice:"语音处理",embedding:"向量嵌入",lpmm_entity_extract:"实体提取",lpmm_rdf_build:"RDF构建",lpmm_qa:"问答模型"};function K5(){const{packId:a}=Lb.useParams(),l=xa(),[r,c]=u.useState(null),[d,m]=u.useState(!0),[h,f]=u.useState(!1),[p,g]=u.useState(!1),[N,j]=u.useState(!1),[y,b]=u.useState(1),[w,A]=u.useState(null),[M,S]=u.useState(!1),[P,E]=u.useState(!1),[C,R]=u.useState({apply_providers:!0,apply_models:!0,apply_task_config:!0,task_mode:"append",selected_providers:void 0,selected_models:void 0,selected_tasks:void 0}),[H,O]=u.useState({}),[X,L]=u.useState({}),me=tN(),Ne=u.useCallback(async()=>{if(a){m(!0);try{const D=await r4(a);c(D);const K=await sN(a,me);f(K)}catch(D){console.error("加载 Pack 失败:",D),aa({title:"加载模板失败",variant:"destructive"})}finally{m(!1)}}},[a,me]);u.useEffect(()=>{Ne()},[Ne]);const je=async()=>{if(!(!a||p)){g(!0);try{const D=await eN(a,me);f(D.liked),r&&c({...r,likes:D.likes})}catch(D){console.error("点赞失败:",D),aa({title:"点赞失败",variant:"destructive"})}finally{g(!1)}}},ce=async()=>{if(r){j(!0),b(1),S(!0);try{const D=await o4(r);A(D);const K={};for(const ue of D.existing_providers)K[ue.pack_provider.name]=ue.local_providers[0].name;O(K);const B={};for(const ue of D.new_providers)B[ue.name]="";L(B)}catch(D){console.error("检测冲突失败:",D),aa({title:"检测配置冲突失败",variant:"destructive"}),j(!1)}finally{S(!1)}}},ge=async()=>{if(r){if(C.apply_providers&&w){for(const D of w.new_providers)if(!X[D.name]){aa({title:`请填写提供商 "${D.name}" 的 API Key`,variant:"destructive"});return}}E(!0);try{await d4(r,C,H,X),await c4(r.id,me),c({...r,downloads:r.downloads+1}),aa({title:"配置模板应用成功!"}),j(!1)}catch(D){console.error("应用 Pack 失败:",D),aa({title:D instanceof Error?D.message:"应用配置失败",variant:"destructive"})}finally{E(!1)}}},pe=D=>new Date(D).toLocaleDateString("zh-CN",{year:"numeric",month:"long",day:"numeric"});return d?e.jsx(Y5,{}):r?e.jsx("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:e.jsx(ss,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs(_,{variant:"ghost",size:"sm",onClick:()=>l({to:"/config/pack-market"}),className:"gap-2",children:[e.jsx(Ua,{className:"w-4 h-4"}),"返回市场"]}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-6",children:[e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ua,{className:"w-10 h-10 text-primary mt-1"}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[r.name,e.jsxs(ke,{variant:"secondary",children:["v",r.version]})]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:r.description})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx($l,{className:"w-4 h-4"}),r.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ia,{className:"w-4 h-4"}),pe(r.created_at)]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(na,{className:"w-4 h-4"}),r.downloads," 次下载"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Zr,{className:`w-4 h-4 ${h?"fill-red-500 text-red-500":""}`}),r.likes," 赞"]})]}),r.tags&&r.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:r.tags.map(D=>e.jsxs(ke,{variant:"outline",children:[e.jsx(rd,{className:"w-3 h-3 mr-1"}),D]},D))})]}),e.jsxs("div",{className:"flex flex-col gap-2 min-w-[160px]",children:[e.jsxs(_,{size:"lg",onClick:ce,children:[e.jsx(na,{className:"w-4 h-4 mr-2"}),"应用模板"]}),e.jsxs(_,{variant:"outline",onClick:je,disabled:p,className:h?"text-red-500 border-red-200":"",children:[e.jsx(Zr,{className:`w-4 h-4 mr-2 ${h?"fill-current":""}`}),h?"已点赞":"点赞"]})]})]}),e.jsx(la,{}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsx(Ce,{children:e.jsxs(Ae,{className:"flex items-center gap-3 py-4",children:[e.jsx(Bl,{className:"w-8 h-8 text-blue-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:r.providers.length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"API 提供商"})]})]})}),e.jsx(Ce,{children:e.jsxs(Ae,{className:"flex items-center gap-3 py-4",children:[e.jsx(Xn,{className:"w-8 h-8 text-green-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:r.models.length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"模型配置"})]})]})}),e.jsx(Ce,{children:e.jsxs(Ae,{className:"flex items-center gap-3 py-4",children:[e.jsx(Zn,{className:"w-8 h-8 text-purple-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:Object.keys(r.task_config).length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"任务配置"})]})]})})]}),e.jsxs(Yt,{defaultValue:"providers",className:"space-y-4",children:[e.jsxs(Vt,{className:"w-full sm:w-auto grid grid-cols-3 sm:flex",children:[e.jsxs(Ye,{value:"providers",className:"gap-1 sm:gap-2",children:[e.jsx(Bl,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"提供商"}),e.jsx("span",{className:"sm:hidden",children:"提供商"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",r.providers.length,")"]})]}),e.jsxs(Ye,{value:"models",className:"gap-1 sm:gap-2",children:[e.jsx(Xn,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"模型"}),e.jsx("span",{className:"sm:hidden",children:"模型"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",r.models.length,")"]})]}),e.jsxs(Ye,{value:"tasks",className:"gap-1 sm:gap-2",children:[e.jsx(Zn,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"任务配置"}),e.jsx("span",{className:"sm:hidden",children:"任务"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",Object.keys(r.task_config).length,")"]})]})]}),e.jsx(Ms,{value:"providers",children:e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Ue,{children:"API 提供商"}),e.jsx(fs,{children:"模板中包含的 API 提供商配置(不含 API Key)"})]}),e.jsx(Ae,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(Il,{children:[e.jsx(Pl,{children:e.jsxs(bt,{children:[e.jsx(ls,{children:"名称"}),e.jsx(ls,{children:"Base URL"}),e.jsx(ls,{children:"类型"})]})}),e.jsx(Fl,{children:r.providers.map(D=>e.jsxs(bt,{children:[e.jsx(Je,{className:"font-medium whitespace-nowrap",children:D.name}),e.jsx(Je,{className:"text-muted-foreground font-mono text-sm max-w-[200px] truncate",children:D.base_url}),e.jsx(Je,{children:e.jsx(ke,{variant:"outline",children:D.client_type})})]},D.name))})]})})})]})}),e.jsx(Ms,{value:"models",children:e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Ue,{children:"模型配置"}),e.jsx(fs,{children:"模板中包含的模型配置"})]}),e.jsx(Ae,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(Il,{children:[e.jsx(Pl,{children:e.jsxs(bt,{children:[e.jsx(ls,{children:"模型名称"}),e.jsx(ls,{children:"标识符"}),e.jsx(ls,{children:"提供商"}),e.jsx(ls,{className:"text-right",children:"价格 (入/出)"})]})}),e.jsx(Fl,{children:r.models.map(D=>e.jsxs(bt,{children:[e.jsx(Je,{className:"font-medium whitespace-nowrap",children:D.name}),e.jsx(Je,{className:"text-muted-foreground font-mono text-sm max-w-[150px] truncate",children:D.model_identifier}),e.jsx(Je,{className:"whitespace-nowrap",children:D.api_provider}),e.jsxs(Je,{className:"text-right text-muted-foreground whitespace-nowrap",children:["¥",D.price_in," / ¥",D.price_out]})]},D.name))})]})})})]})}),e.jsx(Ms,{value:"tasks",children:e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Ue,{children:"任务配置"}),e.jsx(fs,{children:"模板中各任务类型的模型分配"})]}),e.jsx(Ae,{children:e.jsx(V5,{type:"multiple",className:"w-full",children:Object.entries(r.task_config).map(([D,K])=>e.jsxs(Eb,{value:D,children:[e.jsx(Mb,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(bn,{className:"w-4 h-4"}),G5[D]||D,e.jsxs(ke,{variant:"secondary",className:"ml-2",children:[K.model_list.length," 个模型"]})]})}),e.jsx(Ab,{children:e.jsxs("div",{className:"space-y-2 pl-6",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"分配的模型:"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:K.model_list.map(B=>e.jsx(ke,{variant:"outline",children:B},B))}),K.temperature!==void 0&&e.jsxs("div",{className:"text-sm",children:["Temperature: ",e.jsx("span",{className:"font-mono",children:K.temperature})]}),K.max_tokens!==void 0&&e.jsxs("div",{className:"text-sm",children:["Max Tokens: ",e.jsx("span",{className:"font-mono",children:K.max_tokens})]})]})})]},D))})})]})})]}),e.jsx(Q5,{open:N,onOpenChange:j,pack:r,step:y,setStep:b,conflicts:w,detectingConflicts:M,applying:P,options:C,setOptions:R,_providerMapping:H,_setProviderMapping:O,newProviderApiKeys:X,setNewProviderApiKeys:L,onApply:ge})]})})}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(ua,{className:"w-16 h-16 mx-auto mb-4 opacity-50"}),e.jsx("h2",{className:"text-xl font-semibold",children:"模板不存在"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"该配置模板可能已被删除或尚未通过审核"}),e.jsxs(_,{className:"mt-4",onClick:()=>l({to:"/config/pack-market"}),children:[e.jsx(Ua,{className:"w-4 h-4 mr-2"}),"返回市场"]})]})}function Q5({open:a,onOpenChange:l,pack:r,step:c,setStep:d,conflicts:m,detectingConflicts:h,applying:f,options:p,setOptions:g,_providerMapping:N,_setProviderMapping:j,newProviderApiKeys:y,setNewProviderApiKeys:b,onApply:w}){return e.jsx(Js,{open:a,onOpenChange:l,children:e.jsxs(qs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Vs,{children:[e.jsxs(Gs,{className:"flex items-center gap-2",children:[e.jsx(ua,{className:"w-5 h-5"}),"应用配置模板"]}),e.jsxs(nt,{children:["步骤 ",c," / ",3,":",c===1&&"选择要应用的内容",c===2&&"配置提供商映射",c===3&&"确认并应用"]})]}),h?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(Fs,{className:"w-8 h-8 mx-auto animate-spin text-primary"}),e.jsx("p",{className:"mt-4 text-muted-foreground",children:"正在检测配置冲突..."})]}):e.jsxs(e.Fragment,{children:[c===1&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(lt,{id:"apply_providers",checked:p.apply_providers,onCheckedChange:M=>g({...p,apply_providers:M})}),e.jsxs(T,{htmlFor:"apply_providers",className:"flex items-center gap-2",children:[e.jsx(Bl,{className:"w-4 h-4"}),"应用提供商配置 (",r.providers.length," 个)"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(lt,{id:"apply_models",checked:p.apply_models,onCheckedChange:M=>g({...p,apply_models:M})}),e.jsxs(T,{htmlFor:"apply_models",className:"flex items-center gap-2",children:[e.jsx(Xn,{className:"w-4 h-4"}),"应用模型配置 (",r.models.length," 个)"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(lt,{id:"apply_task_config",checked:p.apply_task_config,onCheckedChange:M=>g({...p,apply_task_config:M})}),e.jsxs(T,{htmlFor:"apply_task_config",className:"flex items-center gap-2",children:[e.jsx(Zn,{className:"w-4 h-4"}),"应用任务配置 (",Object.keys(r.task_config).length," 个)"]})]})]}),p.apply_task_config&&e.jsxs("div",{className:"pl-6 space-y-2 border-l-2 border-muted",children:[e.jsx(T,{className:"text-sm font-medium",children:"任务配置应用模式"}),e.jsxs(Tx,{value:p.task_mode,onValueChange:M=>g({...p,task_mode:M}),children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xo,{value:"append",id:"mode_append"}),e.jsx(T,{htmlFor:"mode_append",className:"font-normal",children:"追加模式 - 将模板中的模型添加到现有配置"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xo,{value:"replace",id:"mode_replace"}),e.jsx(T,{htmlFor:"mode_replace",className:"font-normal",children:"替换模式 - 用模板配置完全替换现有配置"})]})]})]})]}),c===2&&m&&e.jsxs("div",{className:"space-y-4",children:[p.apply_providers&&m.existing_providers.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(pt,{children:[e.jsx(Qt,{className:"h-4 w-4"}),e.jsx(Qn,{children:"发现已有的提供商"}),e.jsx(gt,{children:"以下提供商的 URL 与您本地配置中的提供商匹配,将自动使用本地提供商:"})]}),e.jsx("div",{className:"space-y-2",children:m.existing_providers.map(({pack_provider:M,local_providers:S})=>e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-lg",children:[e.jsx(Lt,{className:"w-4 h-4 text-green-500 flex-shrink-0"}),e.jsx("span",{className:"font-medium flex-shrink-0",children:M.name}),e.jsx(ra,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),S.length===1?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:S[0].name}),e.jsx(ke,{variant:"outline",className:"ml-auto",children:"URL 匹配"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Pe,{value:N[M.name]||S[0].name,onValueChange:P=>j({...N,[M.name]:P}),children:[e.jsx(Be,{className:"w-[200px]",children:e.jsx(Fe,{})}),e.jsx(Ie,{children:S.map(P=>e.jsx(ee,{value:P.name,children:P.name},P.name))})]}),e.jsxs(ke,{variant:"outline",className:"ml-auto",children:[S.length," 个匹配"]})]})]},M.name))})]}),p.apply_providers&&m.new_providers.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(pt,{variant:"destructive",children:[e.jsx(qt,{className:"h-4 w-4"}),e.jsx(Qn,{children:"需要配置 API Key"}),e.jsx(gt,{children:"以下提供商在您的本地配置中不存在,需要填写 API Key:"})]}),e.jsx("div",{className:"space-y-4",children:m.new_providers.map(M=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(rx,{className:"w-4 h-4 text-amber-500"}),e.jsx("span",{className:"font-medium",children:M.name}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",M.base_url,")"]})]}),e.jsx(ne,{type:"password",placeholder:`输入 ${M.name} 的 API Key`,value:y[M.name]||"",onChange:S=>b({...y,[M.name]:S.target.value})})]},M.name))})]}),(!p.apply_providers||m.existing_providers.length===0&&m.new_providers.length===0)&&e.jsxs(pt,{children:[e.jsx(Lt,{className:"h-4 w-4"}),e.jsx(Qn,{children:"无需配置"}),e.jsx(gt,{children:"模板中没有提供商配置,或您选择不应用提供商。"})]})]}),c===3&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(pt,{children:[e.jsx(Qt,{className:"h-4 w-4"}),e.jsx(Qn,{children:"确认应用"}),e.jsx(gt,{children:"请确认以下将要应用的内容:"})]}),e.jsxs("div",{className:"space-y-2",children:[p.apply_providers&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Lt,{className:"w-4 h-4 text-green-500"}),e.jsx(Bl,{className:"w-4 h-4"}),e.jsxs("span",{children:["应用 ",r.providers.length," 个提供商配置"]})]}),p.apply_models&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Lt,{className:"w-4 h-4 text-green-500"}),e.jsx(Xn,{className:"w-4 h-4"}),e.jsxs("span",{children:["应用 ",r.models.length," 个模型配置"]})]}),p.apply_task_config&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Lt,{className:"w-4 h-4 text-green-500"}),e.jsx(Zn,{className:"w-4 h-4"}),e.jsxs("span",{children:[p.task_mode==="append"?"追加":"替换"," ",Object.keys(r.task_config).length," 个任务配置"]})]})]}),m&&m.new_providers.length>0&&e.jsxs(pt,{variant:"destructive",children:[e.jsx(qt,{className:"h-4 w-4"}),e.jsxs(gt,{children:["将添加 ",m.new_providers.length," 个新提供商,请确保已填写正确的 API Key。"]})]})]})]}),e.jsxs(xt,{className:"flex justify-between",children:[e.jsx("div",{children:c>1&&!h&&e.jsx(_,{variant:"outline",onClick:()=>d(c-1),disabled:f,children:"上一步"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{variant:"outline",onClick:()=>l(!1),disabled:f,children:"取消"}),c<3?e.jsx(_,{onClick:()=>d(c+1),disabled:h,children:"下一步"}):e.jsxs(_,{onClick:w,disabled:f,children:[f&&e.jsx(Fs,{className:"w-4 h-4 mr-2 animate-spin"}),"应用模板"]})]})]})]})})}function Y5(){return e.jsx("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:e.jsx(ss,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(As,{className:"h-9 w-24"}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-6",children:[e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(As,{className:"w-10 h-10"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(As,{className:"h-8 w-2/3"}),e.jsx(As,{className:"h-4 w-full"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsx(As,{className:"h-4 w-24"}),e.jsx(As,{className:"h-4 w-32"}),e.jsx(As,{className:"h-4 w-28"}),e.jsx(As,{className:"h-4 w-20"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(As,{className:"h-6 w-20"}),e.jsx(As,{className:"h-6 w-24"}),e.jsx(As,{className:"h-6 w-16"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 min-w-[160px]",children:[e.jsx(As,{className:"h-10 w-full"}),e.jsx(As,{className:"h-10 w-full"})]})]}),e.jsx(As,{className:"h-px w-full"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsx(As,{className:"h-24"}),e.jsx(As,{className:"h-24"}),e.jsx(As,{className:"h-24"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(As,{className:"h-10 w-32"}),e.jsx(As,{className:"h-10 w-32"}),e.jsx(As,{className:"h-10 w-32"})]}),e.jsx(As,{className:"h-96 w-full"})]})]})})})}function J5(){const a=xa(),[l,r]=u.useState(!0);return u.useEffect(()=>{let c=!1;return(async()=>{try{const m=await cc();!c&&!m&&a({to:"/auth"})}catch{c||a({to:"/auth"})}finally{c||r(!1)}})(),()=>{c=!0}},[a]),{checking:l}}async function X5(){return await cc()}const Z5=ei("pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono font-medium opacity-100",{variants:{size:{sm:"h-5 text-[10px]",default:"h-6 text-xs",lg:"h-7 text-sm"}},defaultVariants:{size:"default"}}),zb=u.forwardRef(({className:a,size:l,abbrTitle:r,children:c,...d},m)=>e.jsx("kbd",{className:F(Z5({size:l,className:a})),ref:m,...d,children:r?e.jsx("abbr",{title:r,children:c}):c}));zb.displayName="Kbd";const W5=[{icon:nd,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:La,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:Bl,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:hv,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:ld,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Ba,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:fv,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:Xr,title:"黑话管理",description:"管理麦麦学习到的黑话和俚语",path:"/resource/jargon",category:"资源"},{icon:J1,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:ua,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:ix,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:bn,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function eT({open:a,onOpenChange:l}){const[r,c]=u.useState(""),[d,m]=u.useState(0),h=xa(),f=W5.filter(N=>N.title.toLowerCase().includes(r.toLowerCase())||N.description.toLowerCase().includes(r.toLowerCase())||N.category.toLowerCase().includes(r.toLowerCase())),p=u.useCallback(N=>{h({to:N}),l(!1),c(""),m(0)},[h,l]),g=u.useCallback(N=>{N.key==="ArrowDown"?(N.preventDefault(),m(j=>(j+1)%f.length)):N.key==="ArrowUp"?(N.preventDefault(),m(j=>(j-1+f.length)%f.length)):N.key==="Enter"&&f[d]&&(N.preventDefault(),p(f[d].path))},[f,d,p]);return e.jsx(Js,{open:a,onOpenChange:l,children:e.jsxs(qs,{className:"max-w-2xl p-0 gap-0",children:[e.jsxs(Vs,{className:"px-4 pt-4 pb-0",children:[e.jsx(Gs,{className:"sr-only",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx(Ut,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),e.jsx(ne,{value:r,onChange:N=>{c(N.target.value),m(0)},onKeyDown:g,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),e.jsx("div",{className:"border-t",children:e.jsx(ss,{className:"h-[400px]",children:f.length>0?e.jsx("div",{className:"p-2",children:f.map((N,j)=>{const y=N.icon;return e.jsxs("button",{onClick:()=>p(N.path),onMouseEnter:()=>m(j),className:F("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",j===d?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[e.jsx(y,{className:"h-5 w-5 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm",children:N.title}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:N.description})]}),e.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:N.category})]},N.path)})}):e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(Ut,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:r?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),e.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function sT(){const a=window.location.protocol==="http:",l=window.location.hostname.toLowerCase(),r=l==="localhost"||l==="127.0.0.1"||l==="::1",c=sessionStorage.getItem("http-warning-dismissed")==="true",[d,m]=u.useState(a&&!r&&!c),[h,f]=u.useState(!1),p=()=>{f(!0),m(!1),sessionStorage.setItem("http-warning-dismissed","true")};return!d||h?null:e.jsx("div",{className:"relative bg-amber-500/10 border-b border-amber-500/20 backdrop-blur-sm",children:e.jsx("div",{className:"container mx-auto px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx(qt,{className:"h-5 w-5 text-amber-600 dark:text-amber-500 flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("p",{className:"text-sm font-medium text-amber-900 dark:text-amber-100",children:[e.jsx("span",{className:"font-semibold",children:"安全警告:"}),"您正在使用 ",e.jsx("strong",{children:"HTTP"})," 访问 MaiBot WebUI"]}),e.jsx("p",{className:"text-xs text-amber-800 dark:text-amber-200 mt-1",children:"如果这是公网服务器,您的数据(包括 Token、聊天记录等)可能在传输过程中被窃取。强烈建议使用 HTTPS 访问或仅在本地网络使用。"})]})]}),e.jsx(_,{variant:"ghost",size:"icon",onClick:p,className:"h-8 w-8 text-amber-700 hover:text-amber-900 dark:text-amber-400 dark:hover:text-amber-200 flex-shrink-0","aria-label":"关闭警告",children:e.jsx(_a,{className:"h-4 w-4"})})]})})})}function tT(){const[a,l]=u.useState(0),[r,c]=u.useState(!1),d=u.useRef(null);u.useEffect(()=>{const g=N=>{const j=N.target;if(j.scrollHeight>j.clientHeight+100){d.current=j;const y=j.scrollTop,b=j.scrollHeight-j.clientHeight,w=b>0?y/b*100:0;l(w),c(y>300)}};return window.addEventListener("scroll",g,{capture:!0,passive:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})},[]);const m=()=>{d.current?.scrollTo({top:0,behavior:"smooth"})},h=18,f=2*Math.PI*h,p=f-a/100*f;return e.jsx("div",{className:F("fixed bottom-24 right-8 z-50 transition-all duration-500 ease-in-out transform",r?"translate-x-0 opacity-100":"translate-x-32 opacity-0 pointer-events-none"),children:e.jsxs(_,{variant:"outline",size:"icon",className:F("relative h-12 w-12 rounded-full shadow-xl","bg-background/80 backdrop-blur-md border-border/50","hover:bg-accent hover:scale-110 hover:shadow-2xl hover:border-primary/50","transition-all duration-300","group"),onClick:m,"aria-label":"回到顶部",children:[e.jsxs("svg",{className:"absolute inset-0 h-full w-full -rotate-90 transform p-1",viewBox:"0 0 44 44",children:[e.jsx("circle",{className:"text-muted-foreground/10",strokeWidth:"3",stroke:"currentColor",fill:"transparent",r:h,cx:"22",cy:"22"}),e.jsx("circle",{className:"text-primary transition-all duration-100 ease-out",strokeWidth:"3",strokeDasharray:f,strokeDashoffset:p,strokeLinecap:"round",stroke:"currentColor",fill:"transparent",r:h,cx:"22",cy:"22"})]}),e.jsx(X1,{className:"h-5 w-5 text-primary transition-transform duration-300 group-hover:-translate-y-1 group-hover:scale-110",strokeWidth:2.5}),e.jsx("div",{className:"absolute inset-0 rounded-full bg-primary/5 opacity-0 group-hover:opacity-100 transition-opacity duration-300"})]})})}const aT=j1,lT=v1,nT=N1,Rb=u.forwardRef(({className:a,sideOffset:l=4,...r},c)=>e.jsx(g1,{children:e.jsx(Qj,{ref:c,sideOffset:l,className:F("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",a),...r})}));Rb.displayName=Qj.displayName;function rT({children:a}){const{checking:l}=J5(),[r,c]=u.useState(!0),[d,m]=u.useState(!1),[h,f]=u.useState(!1),[p,g]=u.useState(!1),{theme:N,setTheme:j}=fx(),y=ew();if(u.useEffect(()=>{if(r)g(!1);else{const S=setTimeout(()=>{g(!0)},350);return()=>clearTimeout(S)}},[r]),u.useEffect(()=>{const S=P=>{(P.metaKey||P.ctrlKey)&&P.key==="k"&&(P.preventDefault(),f(!0))};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[]),l)return e.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:e.jsx("div",{className:"text-muted-foreground",children:"正在验证登录状态..."})});const b=[{title:"概览",items:[{icon:nd,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:La,label:"麦麦主程序配置",path:"/config/bot"},{icon:Bl,label:"AI模型厂商配置",path:"/config/modelProvider",tourId:"sidebar-model-provider"},{icon:hv,label:"模型管理与分配",path:"/config/model",tourId:"sidebar-model-management"},{icon:Cg,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:ld,label:"表情包管理",path:"/resource/emoji"},{icon:Ba,label:"表达方式管理",path:"/resource/expression"},{icon:Xr,label:"黑话管理",path:"/resource/jargon"},{icon:fv,label:"人物信息管理",path:"/resource/person"},{icon:dv,label:"知识库图谱可视化",path:"/resource/knowledge-graph"},{icon:Jr,label:"麦麦知识库管理",path:"/resource/knowledge-base"}]},{title:"扩展与监控",items:[{icon:ua,label:"插件市场",path:"/plugins"},{icon:mv,label:"配置模板市场",path:"/config/pack-market"},{icon:Cg,label:"插件配置",path:"/plugin-config"},{icon:ix,label:"日志查看器",path:"/logs"},{icon:ax,label:"计划器&回复器监控",path:"/planner-monitor"},{icon:Ba,label:"本地聊天室",path:"/chat"}]},{title:"系统",items:[{icon:bn,label:"系统设置",path:"/settings"}]}],A=N==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":N,M=async()=>{await R_()};return e.jsx(aT,{delayDuration:300,children:e.jsxs("div",{className:"flex h-screen overflow-hidden",children:[e.jsxs("aside",{className:F("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",r?"lg:w-64":"lg:w-16",d?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[e.jsx("div",{className:"flex h-16 items-center border-b px-4",children:e.jsxs("div",{className:F("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!r&&"lg:flex-none lg:w-8"),children:[e.jsxs("div",{className:F("flex items-baseline gap-2",!r&&"lg:hidden"),children:[e.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),e.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:x2()})]}),!r&&e.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),e.jsx(ss,{className:F("flex-1 overflow-x-hidden",!r&&"lg:w-16"),children:e.jsx("nav",{className:F("p-4",!r&&"lg:p-2 lg:w-16"),children:e.jsx("ul",{className:F("space-y-6",!r&&"lg:space-y-3 lg:w-full"),children:b.map((S,P)=>e.jsxs("li",{children:[e.jsx("div",{className:F("px-3 h-[1.25rem]","mb-2",!r&&"lg:mb-1 lg:invisible"),children:e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:S.title})}),!r&&P>0&&e.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),e.jsx("ul",{className:"space-y-1",children:S.items.map(E=>{const C=y({to:E.path}),R=E.icon,H=e.jsxs(e.Fragment,{children:[C&&e.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),e.jsxs("div",{className:F("flex items-center transition-all duration-300",r?"gap-3":"gap-3 lg:gap-0"),children:[e.jsx(R,{className:F("h-5 w-5 flex-shrink-0",C&&"text-primary"),strokeWidth:2,fill:"none"}),e.jsx("span",{className:F("text-sm font-medium whitespace-nowrap transition-all duration-300",C&&"font-semibold",r?"opacity-100 max-w-[200px]":"opacity-100 max-w-[200px] lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:E.label})]})]});return e.jsx("li",{className:"relative",children:e.jsxs(lT,{children:[e.jsx(nT,{asChild:!0,children:e.jsx(Vn,{to:E.path,"data-tour":E.tourId,className:F("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",C?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",r?"px-3":"px-3 lg:px-0 lg:justify-center lg:w-12 lg:mx-auto"),onClick:()=>m(!1),children:H})}),p&&e.jsx(Rb,{side:"right",className:"hidden lg:block",children:e.jsx("p",{children:E.label})})]})},E.path)})})]},S.title))})})})]}),d&&e.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>m(!1)}),e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx(sT,{}),e.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{onClick:()=>m(!d),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:e.jsx(Z1,{className:"h-5 w-5"})}),e.jsx("button",{onClick:()=>c(!r),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:r?"收起侧边栏":"展开侧边栏",children:e.jsx(Ia,{className:F("h-5 w-5 transition-transform",!r&&"rotate-180")})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Vn,{to:"/annual-report",children:e.jsxs(_,{variant:"ghost",size:"sm",className:"gap-2 bg-gradient-to-r from-pink-500/10 to-purple-500/10 hover:from-pink-500/20 hover:to-purple-500/20 border border-pink-500/20",title:"查看年度总结",children:[e.jsx(W1,{className:"h-4 w-4 text-pink-500"}),e.jsx("span",{className:"hidden sm:inline bg-gradient-to-r from-pink-500 to-purple-500 bg-clip-text text-transparent font-medium",children:"2025 年度总结"})]})}),e.jsxs("button",{onClick:()=>f(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[e.jsx(Ut,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),e.jsxs(zb,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[e.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),e.jsx(eT,{open:h,onOpenChange:f}),e.jsxs(_,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[e.jsx(e_,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),e.jsx("button",{onClick:S=>{c2(A==="dark"?"light":"dark",j,S)},className:"rounded-lg p-2 hover:bg-accent",title:A==="dark"?"切换到浅色模式":"切换到深色模式",children:A==="dark"?e.jsx(nx,{className:"h-5 w-5"}):e.jsx(ec,{className:"h-5 w-5"})}),e.jsx("div",{className:"h-6 w-px bg-border"}),e.jsxs(_,{variant:"ghost",size:"sm",onClick:M,className:"gap-2",title:"登出系统",children:[e.jsx(s_,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),e.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:a}),e.jsx(tT,{})]})]})})}function iT(a){const l=a.split(` +`).slice(1),r=[];for(const c of l){const d=c.trim();if(!d.startsWith("at "))continue;const m=d.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);m?r.push({functionName:m[1]||"",fileName:m[2],lineNumber:m[3],columnNumber:m[4],raw:d}):r.push({functionName:"",fileName:"",lineNumber:"",columnNumber:"",raw:d})}return r}function cT({error:a,errorInfo:l}){const[r,c]=u.useState(!0),[d,m]=u.useState(!1),[h,f]=u.useState(!1),p=a.stack?iT(a.stack):[],g=async()=>{const N=` +Error: ${a.name} +Message: ${a.message} + +Stack Trace: +${a.stack||"No stack trace available"} + +Component Stack: +${l?.componentStack||"No component stack available"} + +URL: ${window.location.href} +User Agent: ${navigator.userAgent} +Time: ${new Date().toISOString()} + `.trim();try{await navigator.clipboard.writeText(N),f(!0),setTimeout(()=>f(!1),2e3)}catch(j){console.error("Failed to copy:",j)}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(pt,{variant:"destructive",className:"border-red-500/50 bg-red-500/10",children:[e.jsx(qt,{className:"h-4 w-4"}),e.jsxs(gt,{className:"font-mono text-sm",children:[e.jsxs("span",{className:"font-semibold",children:[a.name,":"]})," ",a.message]})]}),p.length>0&&e.jsxs(uc,{open:r,onOpenChange:c,children:[e.jsx(mc,{asChild:!0,children:e.jsxs(_,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[e.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(t_,{className:"h-4 w-4"}),"Stack Trace (",p.length," frames)"]}),r?e.jsx(Yr,{className:"h-4 w-4"}):e.jsx($a,{className:"h-4 w-4"})]})}),e.jsx(xc,{children:e.jsx(ss,{className:"h-[280px] rounded-md border bg-muted/30",children:e.jsx("div",{className:"p-3 space-y-1",children:p.map((N,j)=>e.jsx("div",{className:"font-mono text-xs p-2 rounded hover:bg-muted/50 transition-colors",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs("span",{className:"text-muted-foreground w-6 text-right flex-shrink-0",children:[j+1,"."]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-primary font-medium",children:N.functionName}),N.fileName&&e.jsxs("div",{className:"text-muted-foreground mt-0.5 break-all",children:[N.fileName,N.lineNumber&&e.jsxs("span",{className:"text-yellow-600 dark:text-yellow-400",children:[":",N.lineNumber,":",N.columnNumber]})]})]})]})},j))})})})]}),l?.componentStack&&e.jsxs(uc,{open:d,onOpenChange:m,children:[e.jsx(mc,{asChild:!0,children:e.jsxs(_,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[e.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(qt,{className:"h-4 w-4"}),"Component Stack"]}),d?e.jsx(Yr,{className:"h-4 w-4"}):e.jsx($a,{className:"h-4 w-4"})]})}),e.jsx(xc,{children:e.jsx(ss,{className:"h-[200px] rounded-md border bg-muted/30",children:e.jsx("pre",{className:"p-3 font-mono text-xs whitespace-pre-wrap text-muted-foreground",children:l.componentStack})})})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:g,className:"w-full",children:h?e.jsxs(e.Fragment,{children:[e.jsx(Lt,{className:"mr-2 h-4 w-4 text-green-500"}),"已复制到剪贴板"]}):e.jsxs(e.Fragment,{children:[e.jsx(Fo,{className:"mr-2 h-4 w-4"}),"复制错误信息"]})})]})}function Db({error:a,errorInfo:l}){const r=()=>{window.location.href="/"},c=()=>{window.location.reload()};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs(Ce,{className:"w-full max-w-2xl shadow-lg",children:[e.jsxs(De,{className:"text-center pb-2",children:[e.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30 mb-4",children:e.jsx(qt,{className:"h-8 w-8 text-red-600 dark:text-red-400"})}),e.jsx(Ue,{className:"text-2xl font-bold",children:"页面出现了问题"}),e.jsx(fs,{className:"text-base mt-2",children:"应用程序遇到了意外错误。您可以尝试刷新页面或返回首页。"})]}),e.jsxs(Ae,{className:"space-y-4",children:[e.jsx(cT,{error:a,errorInfo:l}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 pt-2",children:[e.jsxs(_,{onClick:c,className:"flex-1",children:[e.jsx(ut,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),e.jsxs(_,{onClick:r,variant:"outline",className:"flex-1",children:[e.jsx(nd,{className:"mr-2 h-4 w-4"}),"返回首页"]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground pt-2",children:"如果问题持续存在,请将错误信息复制并反馈给开发者"})]})]})})}class oT extends u.Component{constructor(l){super(l),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(l){return{hasError:!0,error:l}}componentDidCatch(l,r){console.error("ErrorBoundary caught an error:",l,r),this.setState({errorInfo:r})}handleReset=()=>{this.setState({hasError:!1,error:null,errorInfo:null})};render(){return this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback:e.jsx(Db,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}function Ob({error:a}){return e.jsx(Db,{error:a,errorInfo:null})}const vc=sw({component:()=>e.jsxs(e.Fragment,{children:[e.jsx(cj,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!X5())throw aw({to:"/auth"})}}),dT=rt({getParentRoute:()=>vc,path:"/auth",component:E2}),uT=rt({getParentRoute:()=>vc,path:"/setup",component:V2}),jt=rt({getParentRoute:()=>vc,id:"protected",component:()=>e.jsx(rT,{children:e.jsx(cj,{})}),errorComponent:({error:a})=>e.jsx(Ob,{error:a})}),mT=rt({getParentRoute:()=>jt,path:"/",component:l2}),xT=rt({getParentRoute:()=>jt,path:"/config/bot",component:FS}),hT=rt({getParentRoute:()=>jt,path:"/config/modelProvider",component:e4}),fT=rt({getParentRoute:()=>jt,path:"/config/model",component:S4}),pT=rt({getParentRoute:()=>jt,path:"/config/adapter",component:E4}),gT=rt({getParentRoute:()=>jt,path:"/resource/emoji",component:Z4}),jT=rt({getParentRoute:()=>jt,path:"/resource/expression",component:tk}),vT=rt({getParentRoute:()=>jt,path:"/resource/person",component:kk}),NT=rt({getParentRoute:()=>jt,path:"/resource/jargon",component:pk}),bT=rt({getParentRoute:()=>jt,path:"/resource/knowledge-graph",component:Ok}),yT=rt({getParentRoute:()=>jt,path:"/resource/knowledge-base",component:Lk}),wT=rt({getParentRoute:()=>jt,path:"/logs",component:$k}),_T=rt({getParentRoute:()=>jt,path:"/planner-monitor",component:Kk}),ST=rt({getParentRoute:()=>jt,path:"/chat",component:zC}),kT=rt({getParentRoute:()=>jt,path:"/plugins",component:xC}),CT=rt({getParentRoute:()=>jt,path:"/plugin-detail",component:wC}),TT=rt({getParentRoute:()=>jt,path:"/model-presets",component:fC}),ET=rt({getParentRoute:()=>jt,path:"/plugin-config",component:jC}),MT=rt({getParentRoute:()=>jt,path:"/plugin-mirrors",component:NC}),AT=rt({getParentRoute:()=>jt,path:"/settings",component:y2}),zT=rt({getParentRoute:()=>jt,path:"/config/pack-market",component:A5}),Lb=rt({getParentRoute:()=>jt,path:"/config/pack-market/$packId",component:K5}),RT=rt({getParentRoute:()=>jt,path:"/survey/webui-feedback",component:QC}),DT=rt({getParentRoute:()=>jt,path:"/survey/maibot-feedback",component:YC}),OT=rt({getParentRoute:()=>jt,path:"/annual-report",component:s5}),LT=rt({getParentRoute:()=>vc,path:"*",component:qv}),UT=vc.addChildren([dT,uT,jt.addChildren([mT,xT,hT,fT,pT,gT,jT,NT,vT,bT,yT,kT,CT,TT,ET,MT,wT,_T,ST,AT,zT,Lb,RT,DT,OT]),LT]),$T=tw({routeTree:UT,defaultNotFoundComponent:qv,defaultErrorComponent:({error:a})=>e.jsx(Ob,{error:a})});function BT({children:a,defaultTheme:l="system",storageKey:r="ui-theme",...c}){const[d,m]=u.useState(()=>localStorage.getItem(r)||l);u.useEffect(()=>{const f=window.document.documentElement;if(f.classList.remove("light","dark"),d==="system"){const p=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";f.classList.add(p);return}f.classList.add(d)},[d]),u.useEffect(()=>{const f=localStorage.getItem("accent-color");if(f){const p=document.documentElement,N={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[f];N&&(p.style.setProperty("--primary",N.hsl),N.gradient?(p.style.setProperty("--primary-gradient",N.gradient),p.classList.add("has-gradient")):(p.style.removeProperty("--primary-gradient"),p.classList.remove("has-gradient")))}},[]);const h={theme:d,setTheme:f=>{localStorage.setItem(r,f),m(f)}};return e.jsx(Bv.Provider,{...c,value:h,children:a})}function IT({children:a,defaultEnabled:l=!0,defaultWavesEnabled:r=!0,storageKey:c="enable-animations",wavesStorageKey:d="enable-waves-background"}){const[m,h]=u.useState(()=>{const N=localStorage.getItem(c);return N!==null?N==="true":l}),[f,p]=u.useState(()=>{const N=localStorage.getItem(d);return N!==null?N==="true":r});u.useEffect(()=>{const N=document.documentElement;m?N.classList.remove("no-animations"):N.classList.add("no-animations"),localStorage.setItem(c,String(m))},[m,c]),u.useEffect(()=>{localStorage.setItem(d,String(f))},[f,d]);const g={enableAnimations:m,setEnableAnimations:h,enableWavesBackground:f,setEnableWavesBackground:p};return e.jsx(Iv.Provider,{value:g,children:a})}const PT=b1,Ub=u.forwardRef(({className:a,...l},r)=>e.jsx(Yj,{ref:r,className:F("fixed bottom-0 right-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:max-w-[420px] gap-2",a),...l}));Ub.displayName=Yj.displayName;const FT=ei("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-slide-in-from-right data-[state=open]:animate-fade-in data-[state=closed]:animate-slide-out-to-right data-[state=closed]:animate-fade-out data-[swipe=end]:animate-slide-out-to-right",{variants:{variant:{default:"border bg-primary/5 text-foreground backdrop-blur-sm",destructive:"destructive group border-destructive bg-destructive/10 text-destructive-foreground backdrop-blur-sm"}},defaultVariants:{variant:"default"}}),$b=u.forwardRef(({className:a,variant:l,...r},c)=>e.jsx(Jj,{ref:c,className:F(FT({variant:l}),a),...r}));$b.displayName=Jj.displayName;const HT=u.forwardRef(({className:a,...l},r)=>e.jsx(Xj,{ref:r,className:F("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",a),...l}));HT.displayName=Xj.displayName;const Bb=u.forwardRef(({className:a,...l},r)=>e.jsx(Zj,{ref:r,className:F("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",a),"toast-close":"",...l,children:e.jsx(_a,{className:"h-4 w-4"})}));Bb.displayName=Zj.displayName;const Ib=u.forwardRef(({className:a,...l},r)=>e.jsx(Wj,{ref:r,className:F("text-sm font-semibold [&+div]:text-xs",a),...l}));Ib.displayName=Wj.displayName;const Pb=u.forwardRef(({className:a,...l},r)=>e.jsx(ev,{ref:r,className:F("text-sm opacity-90",a),...l}));Pb.displayName=ev.displayName;function qT(){const{toasts:a}=it();return e.jsxs(PT,{children:[a.map(function({id:l,title:r,description:c,action:d,...m}){return e.jsxs($b,{...m,children:[e.jsxs("div",{className:"grid gap-1",children:[r&&e.jsx(Ib,{children:r}),c&&e.jsx(Pb,{children:c})]}),d,e.jsx(Bb,{})]},l)}),e.jsx(Ub,{})]})}z_.createRoot(document.getElementById("root")).render(e.jsx(u.StrictMode,{children:e.jsx(oT,{children:e.jsx(BT,{defaultTheme:"system",children:e.jsx(IT,{children:e.jsxs(QS,{children:[e.jsx(lw,{router:$T}),e.jsx(XS,{}),e.jsx(qT,{})]})})})})})); diff --git a/webui/dist/index.html b/webui/dist/index.html index 288dc1c2..a5acb015 100644 --- a/webui/dist/index.html +++ b/webui/dist/index.html @@ -11,21 +11,21 @@ MaiBot Dashboard - + - + - +